/**
 * vis-network - network
 * http://visjs.org/
 *
 * A dynamic, browser-based visualization library.
 *
 * @version 6.4.3
 * @date    2019-11-19T20:53:53Z
 *
 * @copyright (c) 2011-2017 Almende B.V, http://almende.com
 * @copyright (c) 2018-2019 visjs contributors, https://github.com/visjs
 *
 * @license 
 * vis.js is dual licensed under both
 *
 *   1. The Apache 2.0 License
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *   and
 *
 *   2. The MIT License
 *      http://opensource.org/licenses/MIT
 *
 * vis.js may be distributed under either license.
 */
(function (global, factory) {
	typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
	typeof define === 'function' && define.amd ? define(['exports'], factory) :
	(global = global || self, factory(global.vis = global.vis || {}));
}(this, (function (exports) { 'use strict';

	var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};

	function unwrapExports (x) {
		return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
	}

	function createCommonjsModule(fn, module) {
		return module = { exports: {} }, fn(module, module.exports), module.exports;
	}

	function getCjsExportFromNamespace (n) {
		return n && n['default'] || n;
	}

	var check = function (it) {
	  return it && it.Math == Math && it;
	};

	// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
	var global_1 =
	  // eslint-disable-next-line no-undef
	  check(typeof globalThis == 'object' && globalThis) ||
	  check(typeof window == 'object' && window) ||
	  check(typeof self == 'object' && self) ||
	  check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
	  // eslint-disable-next-line no-new-func
	  Function('return this')();

	var fails = function (exec) {
	  try {
	    return !!exec();
	  } catch (error) {
	    return true;
	  }
	};

	// Thank's IE8 for his funny defineProperty
	var descriptors = !fails(function () {
	  return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
	});

	var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
	var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;

	// Nashorn ~ JDK8 bug
	var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);

	// `Object.prototype.propertyIsEnumerable` method implementation
	// https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable
	var f = NASHORN_BUG ? function propertyIsEnumerable(V) {
	  var descriptor = getOwnPropertyDescriptor(this, V);
	  return !!descriptor && descriptor.enumerable;
	} : nativePropertyIsEnumerable;

	var objectPropertyIsEnumerable = {
		f: f
	};

	var createPropertyDescriptor = function (bitmap, value) {
	  return {
	    enumerable: !(bitmap & 1),
	    configurable: !(bitmap & 2),
	    writable: !(bitmap & 4),
	    value: value
	  };
	};

	var toString = {}.toString;

	var classofRaw = function (it) {
	  return toString.call(it).slice(8, -1);
	};

	var split = ''.split;

	// fallback for non-array-like ES3 and non-enumerable old V8 strings
	var indexedObject = fails(function () {
	  // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
	  // eslint-disable-next-line no-prototype-builtins
	  return !Object('z').propertyIsEnumerable(0);
	}) ? function (it) {
	  return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
	} : Object;

	// `RequireObjectCoercible` abstract operation
	// https://tc39.github.io/ecma262/#sec-requireobjectcoercible
	var requireObjectCoercible = function (it) {
	  if (it == undefined) throw TypeError("Can't call method on " + it);
	  return it;
	};

	// toObject with fallback for non-array-like ES3 strings



	var toIndexedObject = function (it) {
	  return indexedObject(requireObjectCoercible(it));
	};

	var isObject = function (it) {
	  return typeof it === 'object' ? it !== null : typeof it === 'function';
	};

	// `ToPrimitive` abstract operation
	// https://tc39.github.io/ecma262/#sec-toprimitive
	// instead of the ES6 spec version, we didn't implement @@toPrimitive case
	// and the second argument - flag - preferred type is a string
	var toPrimitive = function (input, PREFERRED_STRING) {
	  if (!isObject(input)) return input;
	  var fn, val;
	  if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
	  if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
	  if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
	  throw TypeError("Can't convert object to primitive value");
	};

	var hasOwnProperty = {}.hasOwnProperty;

	var has = function (it, key) {
	  return hasOwnProperty.call(it, key);
	};

	var document$1 = global_1.document;
	// typeof document.createElement is 'object' in old IE
	var EXISTS = isObject(document$1) && isObject(document$1.createElement);

	var documentCreateElement = function (it) {
	  return EXISTS ? document$1.createElement(it) : {};
	};

	// Thank's IE8 for his funny defineProperty
	var ie8DomDefine = !descriptors && !fails(function () {
	  return Object.defineProperty(documentCreateElement('div'), 'a', {
	    get: function () { return 7; }
	  }).a != 7;
	});

	var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;

	// `Object.getOwnPropertyDescriptor` method
	// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
	var f$1 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
	  O = toIndexedObject(O);
	  P = toPrimitive(P, true);
	  if (ie8DomDefine) try {
	    return nativeGetOwnPropertyDescriptor(O, P);
	  } catch (error) { /* empty */ }
	  if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
	};

	var objectGetOwnPropertyDescriptor = {
		f: f$1
	};

	var replacement = /#|\.prototype\./;

	var isForced = function (feature, detection) {
	  var value = data[normalize(feature)];
	  return value == POLYFILL ? true
	    : value == NATIVE ? false
	    : typeof detection == 'function' ? fails(detection)
	    : !!detection;
	};

	var normalize = isForced.normalize = function (string) {
	  return String(string).replace(replacement, '.').toLowerCase();
	};

	var data = isForced.data = {};
	var NATIVE = isForced.NATIVE = 'N';
	var POLYFILL = isForced.POLYFILL = 'P';

	var isForced_1 = isForced;

	var path = {};

	var aFunction = function (it) {
	  if (typeof it != 'function') {
	    throw TypeError(String(it) + ' is not a function');
	  } return it;
	};

	// optional / simple context binding
	var bindContext = function (fn, that, length) {
	  aFunction(fn);
	  if (that === undefined) return fn;
	  switch (length) {
	    case 0: return function () {
	      return fn.call(that);
	    };
	    case 1: return function (a) {
	      return fn.call(that, a);
	    };
	    case 2: return function (a, b) {
	      return fn.call(that, a, b);
	    };
	    case 3: return function (a, b, c) {
	      return fn.call(that, a, b, c);
	    };
	  }
	  return function (/* ...args */) {
	    return fn.apply(that, arguments);
	  };
	};

	var anObject = function (it) {
	  if (!isObject(it)) {
	    throw TypeError(String(it) + ' is not an object');
	  } return it;
	};

	var nativeDefineProperty = Object.defineProperty;

	// `Object.defineProperty` method
	// https://tc39.github.io/ecma262/#sec-object.defineproperty
	var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
	  anObject(O);
	  P = toPrimitive(P, true);
	  anObject(Attributes);
	  if (ie8DomDefine) try {
	    return nativeDefineProperty(O, P, Attributes);
	  } catch (error) { /* empty */ }
	  if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
	  if ('value' in Attributes) O[P] = Attributes.value;
	  return O;
	};

	var objectDefineProperty = {
		f: f$2
	};

	var createNonEnumerableProperty = descriptors ? function (object, key, value) {
	  return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
	} : function (object, key, value) {
	  object[key] = value;
	  return object;
	};

	var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;






	var wrapConstructor = function (NativeConstructor) {
	  var Wrapper = function (a, b, c) {
	    if (this instanceof NativeConstructor) {
	      switch (arguments.length) {
	        case 0: return new NativeConstructor();
	        case 1: return new NativeConstructor(a);
	        case 2: return new NativeConstructor(a, b);
	      } return new NativeConstructor(a, b, c);
	    } return NativeConstructor.apply(this, arguments);
	  };
	  Wrapper.prototype = NativeConstructor.prototype;
	  return Wrapper;
	};

	/*
	  options.target      - name of the target object
	  options.global      - target is the global object
	  options.stat        - export as static methods of target
	  options.proto       - export as prototype methods of target
	  options.real        - real prototype method for the `pure` version
	  options.forced      - export even if the native feature is available
	  options.bind        - bind methods to the target, required for the `pure` version
	  options.wrap        - wrap constructors to preventing global pollution, required for the `pure` version
	  options.unsafe      - use the simple assignment of property instead of delete + defineProperty
	  options.sham        - add a flag to not completely full polyfills
	  options.enumerable  - export as enumerable property
	  options.noTargetGet - prevent calling a getter on target
	*/
	var _export = function (options, source) {
	  var TARGET = options.target;
	  var GLOBAL = options.global;
	  var STATIC = options.stat;
	  var PROTO = options.proto;

	  var nativeSource = GLOBAL ? global_1 : STATIC ? global_1[TARGET] : (global_1[TARGET] || {}).prototype;

	  var target = GLOBAL ? path : path[TARGET] || (path[TARGET] = {});
	  var targetPrototype = target.prototype;

	  var FORCED, USE_NATIVE, VIRTUAL_PROTOTYPE;
	  var key, sourceProperty, targetProperty, nativeProperty, resultProperty, descriptor;

	  for (key in source) {
	    FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
	    // contains in native
	    USE_NATIVE = !FORCED && nativeSource && has(nativeSource, key);

	    targetProperty = target[key];

	    if (USE_NATIVE) if (options.noTargetGet) {
	      descriptor = getOwnPropertyDescriptor$1(nativeSource, key);
	      nativeProperty = descriptor && descriptor.value;
	    } else nativeProperty = nativeSource[key];

	    // export native or implementation
	    sourceProperty = (USE_NATIVE && nativeProperty) ? nativeProperty : source[key];

	    if (USE_NATIVE && typeof targetProperty === typeof sourceProperty) continue;

	    // bind timers to global for call from export context
	    if (options.bind && USE_NATIVE) resultProperty = bindContext(sourceProperty, global_1);
	    // wrap global constructors for prevent changs in this version
	    else if (options.wrap && USE_NATIVE) resultProperty = wrapConstructor(sourceProperty);
	    // make static versions for prototype methods
	    else if (PROTO && typeof sourceProperty == 'function') resultProperty = bindContext(Function.call, sourceProperty);
	    // default case
	    else resultProperty = sourceProperty;

	    // add a flag to not completely full polyfills
	    if (options.sham || (sourceProperty && sourceProperty.sham) || (targetProperty && targetProperty.sham)) {
	      createNonEnumerableProperty(resultProperty, 'sham', true);
	    }

	    target[key] = resultProperty;

	    if (PROTO) {
	      VIRTUAL_PROTOTYPE = TARGET + 'Prototype';
	      if (!has(path, VIRTUAL_PROTOTYPE)) {
	        createNonEnumerableProperty(path, VIRTUAL_PROTOTYPE, {});
	      }
	      // export virtual prototype methods
	      path[VIRTUAL_PROTOTYPE][key] = sourceProperty;
	      // export real prototype methods
	      if (options.real && targetPrototype && !targetPrototype[key]) {
	        createNonEnumerableProperty(targetPrototype, key, sourceProperty);
	      }
	    }
	  }
	};

	var slice = [].slice;
	var factories = {};

	var construct = function (C, argsLength, args) {
	  if (!(argsLength in factories)) {
	    for (var list = [], i = 0; i < argsLength; i++) list[i] = 'a[' + i + ']';
	    // eslint-disable-next-line no-new-func
	    factories[argsLength] = Function('C,a', 'return new C(' + list.join(',') + ')');
	  } return factories[argsLength](C, args);
	};

	// `Function.prototype.bind` method implementation
	// https://tc39.github.io/ecma262/#sec-function.prototype.bind
	var functionBind = Function.bind || function bind(that /* , ...args */) {
	  var fn = aFunction(this);
	  var partArgs = slice.call(arguments, 1);
	  var boundFunction = function bound(/* args... */) {
	    var args = partArgs.concat(slice.call(arguments));
	    return this instanceof boundFunction ? construct(fn, args.length, args) : fn.apply(that, args);
	  };
	  if (isObject(fn.prototype)) boundFunction.prototype = fn.prototype;
	  return boundFunction;
	};

	// `Function.prototype.bind` method
	// https://tc39.github.io/ecma262/#sec-function.prototype.bind
	_export({ target: 'Function', proto: true }, {
	  bind: functionBind
	});

	var entryVirtual = function (CONSTRUCTOR) {
	  return path[CONSTRUCTOR + 'Prototype'];
	};

	var bind = entryVirtual('Function').bind;

	var FunctionPrototype = Function.prototype;

	var bind_1 = function (it) {
	  var own = it.bind;
	  return it === FunctionPrototype || (it instanceof Function && own === FunctionPrototype.bind) ? bind : own;
	};

	var bind$1 = bind_1;

	var bind$2 = bind$1;

	/**
	 * Draw a circle.
	 *
	 * @param ctx - The context this shape will be rendered to.
	 * @param x - The position of the center on the x axis.
	 * @param y - The position of the center on the y axis.
	 * @param r - The radius of the circle.
	 */
	function drawCircle(ctx, x, y, r) {
	  ctx.beginPath();
	  ctx.arc(x, y, r, 0, 2 * Math.PI, false);
	  ctx.closePath();
	}
	/**
	 * Draw a square.
	 *
	 * @param ctx - The context this shape will be rendered to.
	 * @param x - The position of the center on the x axis.
	 * @param y - The position of the center on the y axis.
	 * @param r - Half of the width and height of the square.
	 */

	function drawSquare(ctx, x, y, r) {
	  ctx.beginPath();
	  ctx.rect(x - r, y - r, r * 2, r * 2);
	  ctx.closePath();
	}
	/**
	 * Draw an equilateral triangle standing on a side.
	 *
	 * @param ctx - The context this shape will be rendered to.
	 * @param x - The position of the center on the x axis.
	 * @param y - The position of the center on the y axis.
	 * @param r - Half of the length of the sides.
	 *
	 * @remarks
	 * http://en.wikipedia.org/wiki/Equilateral_triangle
	 */

	function drawTriangle(ctx, x, y, r) {
	  ctx.beginPath(); // the change in radius and the offset is here to center the shape

	  r *= 1.15;
	  y += 0.275 * r;
	  var s = r * 2;
	  var s2 = s / 2;
	  var ir = Math.sqrt(3) / 6 * s; // radius of inner circle

	  var h = Math.sqrt(s * s - s2 * s2); // height

	  ctx.moveTo(x, y - (h - ir));
	  ctx.lineTo(x + s2, y + ir);
	  ctx.lineTo(x - s2, y + ir);
	  ctx.lineTo(x, y - (h - ir));
	  ctx.closePath();
	}
	/**
	 * Draw an equilateral triangle standing on a vertex.
	 *
	 * @param ctx - The context this shape will be rendered to.
	 * @param x - The position of the center on the x axis.
	 * @param y - The position of the center on the y axis.
	 * @param r - Half of the length of the sides.
	 *
	 * @remarks
	 * http://en.wikipedia.org/wiki/Equilateral_triangle
	 */

	function drawTriangleDown(ctx, x, y, r) {
	  ctx.beginPath(); // the change in radius and the offset is here to center the shape

	  r *= 1.15;
	  y -= 0.275 * r;
	  var s = r * 2;
	  var s2 = s / 2;
	  var ir = Math.sqrt(3) / 6 * s; // radius of inner circle

	  var h = Math.sqrt(s * s - s2 * s2); // height

	  ctx.moveTo(x, y + (h - ir));
	  ctx.lineTo(x + s2, y - ir);
	  ctx.lineTo(x - s2, y - ir);
	  ctx.lineTo(x, y + (h - ir));
	  ctx.closePath();
	}
	/**
	 * Draw a star.
	 *
	 * @param ctx - The context this shape will be rendered to.
	 * @param x - The position of the center on the x axis.
	 * @param y - The position of the center on the y axis.
	 * @param r - The outer radius of the star.
	 */

	function drawStar(ctx, x, y, r) {
	  // http://www.html5canvastutorials.com/labs/html5-canvas-star-spinner/
	  ctx.beginPath(); // the change in radius and the offset is here to center the shape

	  r *= 0.82;
	  y += 0.1 * r;

	  for (var n = 0; n < 10; n++) {
	    var radius = n % 2 === 0 ? r * 1.3 : r * 0.5;
	    ctx.lineTo(x + radius * Math.sin(n * 2 * Math.PI / 10), y - radius * Math.cos(n * 2 * Math.PI / 10));
	  }

	  ctx.closePath();
	}
	/**
	 * Draw a diamond.
	 *
	 * @param ctx - The context this shape will be rendered to.
	 * @param x - The position of the center on the x axis.
	 * @param y - The position of the center on the y axis.
	 * @param r - Half of the width and height of the diamond.
	 *
	 * @remarks
	 * http://www.html5canvastutorials.com/labs/html5-canvas-star-spinner/
	 */

	function drawDiamond(ctx, x, y, r) {
	  ctx.beginPath();
	  ctx.lineTo(x, y + r);
	  ctx.lineTo(x + r, y);
	  ctx.lineTo(x, y - r);
	  ctx.lineTo(x - r, y);
	  ctx.closePath();
	}
	/**
	 * Draw a rectangle with rounded corners.
	 *
	 * @param ctx - The context this shape will be rendered to.
	 * @param x - The position of the center on the x axis.
	 * @param y - The position of the center on the y axis.
	 * @param w - The width of the rectangle.
	 * @param h - The height of the rectangle.
	 * @param r - The radius of the corners.
	 *
	 * @remarks
	 * http://stackoverflow.com/questions/1255512/how-to-draw-a-rounded-rectangle-on-html-canvas
	 */

	function drawRoundRect(ctx, x, y, w, h, r) {
	  var r2d = Math.PI / 180;

	  if (w - 2 * r < 0) {
	    r = w / 2;
	  } //ensure that the radius isn't too large for x


	  if (h - 2 * r < 0) {
	    r = h / 2;
	  } //ensure that the radius isn't too large for y


	  ctx.beginPath();
	  ctx.moveTo(x + r, y);
	  ctx.lineTo(x + w - r, y);
	  ctx.arc(x + w - r, y + r, r, r2d * 270, r2d * 360, false);
	  ctx.lineTo(x + w, y + h - r);
	  ctx.arc(x + w - r, y + h - r, r, 0, r2d * 90, false);
	  ctx.lineTo(x + r, y + h);
	  ctx.arc(x + r, y + h - r, r, r2d * 90, r2d * 180, false);
	  ctx.lineTo(x, y + r);
	  ctx.arc(x + r, y + r, r, r2d * 180, r2d * 270, false);
	  ctx.closePath();
	}
	/**
	 * Draw an ellipse.
	 *
	 * @param ctx - The context this shape will be rendered to.
	 * @param x - The position of the center on the x axis.
	 * @param y - The position of the center on the y axis.
	 * @param w - The width of the ellipse.
	 * @param h - The height of the ellipse.
	 *
	 * @remarks
	 * http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas
	 *
	 * Postfix '_vis' added to discern it from standard method ellipse().
	 */

	function drawEllipse(ctx, x, y, w, h) {
	  var kappa = 0.5522848,
	      ox = w / 2 * kappa,
	      // control point offset horizontal
	  oy = h / 2 * kappa,
	      // control point offset vertical
	  xe = x + w,
	      // x-end
	  ye = y + h,
	      // y-end
	  xm = x + w / 2,
	      // x-middle
	  ym = y + h / 2; // y-middle

	  ctx.beginPath();
	  ctx.moveTo(x, ym);
	  ctx.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y);
	  ctx.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym);
	  ctx.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye);
	  ctx.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym);
	  ctx.closePath();
	}
	/**
	 * Draw an isometric cylinder.
	 *
	 * @param ctx - The context this shape will be rendered to.
	 * @param x - The position of the center on the x axis.
	 * @param y - The position of the center on the y axis.
	 * @param w - The width of the database.
	 * @param h - The height of the database.
	 *
	 * @remarks
	 * http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas
	 */

	function drawDatabase(ctx, x, y, w, h) {
	  var f = 1 / 3;
	  var wEllipse = w;
	  var hEllipse = h * f;
	  var kappa = 0.5522848,
	      ox = wEllipse / 2 * kappa,
	      // control point offset horizontal
	  oy = hEllipse / 2 * kappa,
	      // control point offset vertical
	  xe = x + wEllipse,
	      // x-end
	  ye = y + hEllipse,
	      // y-end
	  xm = x + wEllipse / 2,
	      // x-middle
	  ym = y + hEllipse / 2,
	      // y-middle
	  ymb = y + (h - hEllipse / 2),
	      // y-midlle, bottom ellipse
	  yeb = y + h; // y-end, bottom ellipse

	  ctx.beginPath();
	  ctx.moveTo(xe, ym);
	  ctx.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye);
	  ctx.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym);
	  ctx.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y);
	  ctx.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym);
	  ctx.lineTo(xe, ymb);
	  ctx.bezierCurveTo(xe, ymb + oy, xm + ox, yeb, xm, yeb);
	  ctx.bezierCurveTo(xm - ox, yeb, x, ymb + oy, x, ymb);
	  ctx.lineTo(x, ym);
	}
	/**
	 * Draw a dashed line.
	 *
	 * @param ctx - The context this shape will be rendered to.
	 * @param x - The start position on the x axis.
	 * @param y - The start position on the y axis.
	 * @param x2 - The end position on the x axis.
	 * @param y2 - The end position on the y axis.
	 * @param pattern - List of lengths starting with line and then alternating between space and line.
	 *
	 * @author David Jordan
	 * @date 2012-08-08
	 * @remarks
	 * http://stackoverflow.com/questions/4576724/dotted-stroke-in-canvas
	 */

	function drawDashedLine(ctx, x, y, x2, y2, pattern) {
	  ctx.beginPath();
	  ctx.moveTo(x, y);
	  var patternLength = pattern.length;
	  var dx = x2 - x;
	  var dy = y2 - y;
	  var slope = dy / dx;
	  var distRemaining = Math.sqrt(dx * dx + dy * dy);
	  var patternIndex = 0;
	  var draw = true;
	  var xStep = 0;
	  var dashLength = +pattern[0];

	  while (distRemaining >= 0.1) {
	    dashLength = +pattern[patternIndex++ % patternLength];

	    if (dashLength > distRemaining) {
	      dashLength = distRemaining;
	    }

	    xStep = Math.sqrt(dashLength * dashLength / (1 + slope * slope));
	    xStep = dx < 0 ? -xStep : xStep;
	    x += xStep;
	    y += slope * xStep;

	    if (draw === true) {
	      ctx.lineTo(x, y);
	    } else {
	      ctx.moveTo(x, y);
	    }

	    distRemaining -= dashLength;
	    draw = !draw;
	  }
	}
	/**
	 * Draw a hexagon.
	 *
	 * @param ctx - The context this shape will be rendered to.
	 * @param x - The position of the center on the x axis.
	 * @param y - The position of the center on the y axis.
	 * @param r - The radius of the hexagon.
	 */

	function drawHexagon(ctx, x, y, r) {
	  ctx.beginPath();
	  var sides = 6;
	  var a = Math.PI * 2 / sides;
	  ctx.moveTo(x + r, y);

	  for (var i = 1; i < sides; i++) {
	    ctx.lineTo(x + r * Math.cos(a * i), y + r * Math.sin(a * i));
	  }

	  ctx.closePath();
	}
	var shapeMap = {
	  circle: drawCircle,
	  dashedLine: drawDashedLine,
	  database: drawDatabase,
	  diamond: drawDiamond,
	  ellipse: drawEllipse,
	  ellipse_vis: drawEllipse,
	  hexagon: drawHexagon,
	  roundRect: drawRoundRect,
	  square: drawSquare,
	  star: drawStar,
	  triangle: drawTriangle,
	  triangleDown: drawTriangleDown
	};
	/**
	 * Returns either custom or native drawing function base on supplied name.
	 *
	 * @param name - The name of the function. Either the name of a
	 * CanvasRenderingContext2D property or an export from shapes.ts without the
	 * draw prefix.
	 *
	 * @returns The function that can be used for rendering. In case of native
	 * CanvasRenderingContext2D function the API is normalized to
	 * `(ctx: CanvasRenderingContext2D, ...originalArgs) => void`.
	 */

	function getShape(name) {
	  if (Object.prototype.hasOwnProperty.call(shapeMap, name)) {
	    return shapeMap[name];
	  } else {
	    return function (ctx) {
	      for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
	        args[_key - 1] = arguments[_key];
	      }

	      CanvasRenderingContext2D.prototype[name].call(ctx, args);
	    };
	  }
	}

	// `IsArray` abstract operation
	// https://tc39.github.io/ecma262/#sec-isarray
	var isArray = Array.isArray || function isArray(arg) {
	  return classofRaw(arg) == 'Array';
	};

	var ceil = Math.ceil;
	var floor = Math.floor;

	// `ToInteger` abstract operation
	// https://tc39.github.io/ecma262/#sec-tointeger
	var toInteger = function (argument) {
	  return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
	};

	var max = Math.max;
	var min = Math.min;

	// Helper for a popular repeating case of the spec:
	// Let integer be ? ToInteger(index).
	// If integer < 0, let result be max((length + integer), 0); else let result be min(length, length).
	var toAbsoluteIndex = function (index, length) {
	  var integer = toInteger(index);
	  return integer < 0 ? max(integer + length, 0) : min(integer, length);
	};

	var min$1 = Math.min;

	// `ToLength` abstract operation
	// https://tc39.github.io/ecma262/#sec-tolength
	var toLength = function (argument) {
	  return argument > 0 ? min$1(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
	};

	var createProperty = function (object, key, value) {
	  var propertyKey = toPrimitive(key);
	  if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
	  else object[propertyKey] = value;
	};

	var isPure = true;

	var setGlobal = function (key, value) {
	  try {
	    createNonEnumerableProperty(global_1, key, value);
	  } catch (error) {
	    global_1[key] = value;
	  } return value;
	};

	var SHARED = '__core-js_shared__';
	var store = global_1[SHARED] || setGlobal(SHARED, {});

	var sharedStore = store;

	var shared = createCommonjsModule(function (module) {
	(module.exports = function (key, value) {
	  return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
	})('versions', []).push({
	  version: '3.4.1',
	  mode:  'pure' ,
	  copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
	});
	});

	var id = 0;
	var postfix = Math.random();

	var uid = function (key) {
	  return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
	};

	var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
	  // Chrome 38 Symbol has incorrect toString conversion
	  // eslint-disable-next-line no-undef
	  return !String(Symbol());
	});

	var Symbol$1 = global_1.Symbol;
	var store$1 = shared('wks');

	var wellKnownSymbol = function (name) {
	  return store$1[name] || (store$1[name] = nativeSymbol && Symbol$1[name]
	    || (nativeSymbol ? Symbol$1 : uid)('Symbol.' + name));
	};

	var aFunction$1 = function (variable) {
	  return typeof variable == 'function' ? variable : undefined;
	};

	var getBuiltIn = function (namespace, method) {
	  return arguments.length < 2 ? aFunction$1(path[namespace]) || aFunction$1(global_1[namespace])
	    : path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method];
	};

	var userAgent = getBuiltIn('navigator', 'userAgent') || '';

	var process = global_1.process;
	var versions = process && process.versions;
	var v8 = versions && versions.v8;
	var match, version;

	if (v8) {
	  match = v8.split('.');
	  version = match[0] + match[1];
	} else if (userAgent) {
	  match = userAgent.match(/Edge\/(\d+)/);
	  if (!match || match[1] >= 74) {
	    match = userAgent.match(/Chrome\/(\d+)/);
	    if (match) version = match[1];
	  }
	}

	var v8Version = version && +version;

	var SPECIES = wellKnownSymbol('species');

	var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
	  // We can't use this feature detection in V8 since it causes
	  // deoptimization and serious performance degradation
	  // https://github.com/zloirock/core-js/issues/677
	  return v8Version >= 51 || !fails(function () {
	    var array = [];
	    var constructor = array.constructor = {};
	    constructor[SPECIES] = function () {
	      return { foo: 1 };
	    };
	    return array[METHOD_NAME](Boolean).foo !== 1;
	  });
	};

	var SPECIES$1 = wellKnownSymbol('species');
	var nativeSlice = [].slice;
	var max$1 = Math.max;

	// `Array.prototype.slice` method
	// https://tc39.github.io/ecma262/#sec-array.prototype.slice
	// fallback for not array-like ES3 strings and DOM objects
	_export({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('slice') }, {
	  slice: function slice(start, end) {
	    var O = toIndexedObject(this);
	    var length = toLength(O.length);
	    var k = toAbsoluteIndex(start, length);
	    var fin = toAbsoluteIndex(end === undefined ? length : end, length);
	    // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
	    var Constructor, result, n;
	    if (isArray(O)) {
	      Constructor = O.constructor;
	      // cross-realm fallback
	      if (typeof Constructor == 'function' && (Constructor === Array || isArray(Constructor.prototype))) {
	        Constructor = undefined;
	      } else if (isObject(Constructor)) {
	        Constructor = Constructor[SPECIES$1];
	        if (Constructor === null) Constructor = undefined;
	      }
	      if (Constructor === Array || Constructor === undefined) {
	        return nativeSlice.call(O, k, fin);
	      }
	    }
	    result = new (Constructor === undefined ? Array : Constructor)(max$1(fin - k, 0));
	    for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
	    result.length = n;
	    return result;
	  }
	});

	var slice$1 = entryVirtual('Array').slice;

	var ArrayPrototype = Array.prototype;

	var slice_1 = function (it) {
	  var own = it.slice;
	  return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.slice) ? slice$1 : own;
	};

	var slice$2 = slice_1;

	var slice$3 = slice$2;

	// `ToObject` abstract operation
	// https://tc39.github.io/ecma262/#sec-toobject
	var toObject = function (argument) {
	  return Object(requireObjectCoercible(argument));
	};

	var SPECIES$2 = wellKnownSymbol('species');

	// `ArraySpeciesCreate` abstract operation
	// https://tc39.github.io/ecma262/#sec-arrayspeciescreate
	var arraySpeciesCreate = function (originalArray, length) {
	  var C;
	  if (isArray(originalArray)) {
	    C = originalArray.constructor;
	    // cross-realm fallback
	    if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
	    else if (isObject(C)) {
	      C = C[SPECIES$2];
	      if (C === null) C = undefined;
	    }
	  } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
	};

	var max$2 = Math.max;
	var min$2 = Math.min;
	var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
	var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded';

	// `Array.prototype.splice` method
	// https://tc39.github.io/ecma262/#sec-array.prototype.splice
	// with adding support of @@species
	_export({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('splice') }, {
	  splice: function splice(start, deleteCount /* , ...items */) {
	    var O = toObject(this);
	    var len = toLength(O.length);
	    var actualStart = toAbsoluteIndex(start, len);
	    var argumentsLength = arguments.length;
	    var insertCount, actualDeleteCount, A, k, from, to;
	    if (argumentsLength === 0) {
	      insertCount = actualDeleteCount = 0;
	    } else if (argumentsLength === 1) {
	      insertCount = 0;
	      actualDeleteCount = len - actualStart;
	    } else {
	      insertCount = argumentsLength - 2;
	      actualDeleteCount = min$2(max$2(toInteger(deleteCount), 0), len - actualStart);
	    }
	    if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER) {
	      throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED);
	    }
	    A = arraySpeciesCreate(O, actualDeleteCount);
	    for (k = 0; k < actualDeleteCount; k++) {
	      from = actualStart + k;
	      if (from in O) createProperty(A, k, O[from]);
	    }
	    A.length = actualDeleteCount;
	    if (insertCount < actualDeleteCount) {
	      for (k = actualStart; k < len - actualDeleteCount; k++) {
	        from = k + actualDeleteCount;
	        to = k + insertCount;
	        if (from in O) O[to] = O[from];
	        else delete O[to];
	      }
	      for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1];
	    } else if (insertCount > actualDeleteCount) {
	      for (k = len - actualDeleteCount; k > actualStart; k--) {
	        from = k + actualDeleteCount - 1;
	        to = k + insertCount - 1;
	        if (from in O) O[to] = O[from];
	        else delete O[to];
	      }
	    }
	    for (k = 0; k < insertCount; k++) {
	      O[k + actualStart] = arguments[k + 2];
	    }
	    O.length = len - actualDeleteCount + insertCount;
	    return A;
	  }
	});

	var splice = entryVirtual('Array').splice;

	var ArrayPrototype$1 = Array.prototype;

	var splice_1 = function (it) {
	  var own = it.splice;
	  return it === ArrayPrototype$1 || (it instanceof Array && own === ArrayPrototype$1.splice) ? splice : own;
	};

	var splice$1 = splice_1;

	var splice$2 = splice$1;

	var componentEmitter = createCommonjsModule(function (module) {
	  /**
	   * Expose `Emitter`.
	   */
	  {
	    module.exports = Emitter;
	  }
	  /**
	   * Initialize a new `Emitter`.
	   *
	   * @api public
	   */


	  function Emitter(obj) {
	    if (obj) return mixin(obj);
	  }
	  /**
	   * Mixin the emitter properties.
	   *
	   * @param {Object} obj
	   * @return {Object}
	   * @api private
	   */

	  function mixin(obj) {
	    for (var key in Emitter.prototype) {
	      obj[key] = Emitter.prototype[key];
	    }

	    return obj;
	  }
	  /**
	   * Listen on the given `event` with `fn`.
	   *
	   * @param {String} event
	   * @param {Function} fn
	   * @return {Emitter}
	   * @api public
	   */


	  Emitter.prototype.on = Emitter.prototype.addEventListener = function (event, fn) {
	    this._callbacks = this._callbacks || {};
	    (this._callbacks['$' + event] = this._callbacks['$' + event] || []).push(fn);
	    return this;
	  };
	  /**
	   * Adds an `event` listener that will be invoked a single
	   * time then automatically removed.
	   *
	   * @param {String} event
	   * @param {Function} fn
	   * @return {Emitter}
	   * @api public
	   */


	  Emitter.prototype.once = function (event, fn) {
	    function on() {
	      this.off(event, on);
	      fn.apply(this, arguments);
	    }

	    on.fn = fn;
	    this.on(event, on);
	    return this;
	  };
	  /**
	   * Remove the given callback for `event` or all
	   * registered callbacks.
	   *
	   * @param {String} event
	   * @param {Function} fn
	   * @return {Emitter}
	   * @api public
	   */


	  Emitter.prototype.off = Emitter.prototype.removeListener = Emitter.prototype.removeAllListeners = Emitter.prototype.removeEventListener = function (event, fn) {
	    this._callbacks = this._callbacks || {}; // all

	    if (0 == arguments.length) {
	      this._callbacks = {};
	      return this;
	    } // specific event


	    var callbacks = this._callbacks['$' + event];
	    if (!callbacks) return this; // remove all handlers

	    if (1 == arguments.length) {
	      delete this._callbacks['$' + event];
	      return this;
	    } // remove specific handler


	    var cb;

	    for (var i = 0; i < callbacks.length; i++) {
	      cb = callbacks[i];

	      if (cb === fn || cb.fn === fn) {
	        splice$2(callbacks).call(callbacks, i, 1);

	        break;
	      }
	    } // Remove event specific arrays for event types that no
	    // one is subscribed for to avoid memory leak.


	    if (callbacks.length === 0) {
	      delete this._callbacks['$' + event];
	    }

	    return this;
	  };
	  /**
	   * Emit `event` with the given args.
	   *
	   * @param {String} event
	   * @param {Mixed} ...
	   * @return {Emitter}
	   */


	  Emitter.prototype.emit = function (event) {
	    this._callbacks = this._callbacks || {};
	    var args = new Array(arguments.length - 1),
	        callbacks = this._callbacks['$' + event];

	    for (var i = 1; i < arguments.length; i++) {
	      args[i - 1] = arguments[i];
	    }

	    if (callbacks) {
	      callbacks = slice$3(callbacks).call(callbacks, 0);

	      for (var i = 0, len = callbacks.length; i < len; ++i) {
	        callbacks[i].apply(this, args);
	      }
	    }

	    return this;
	  };
	  /**
	   * Return array of callbacks for `event`.
	   *
	   * @param {String} event
	   * @return {Array}
	   * @api public
	   */


	  Emitter.prototype.listeners = function (event) {
	    this._callbacks = this._callbacks || {};
	    return this._callbacks['$' + event] || [];
	  };
	  /**
	   * Check if this emitter has `event` handlers.
	   *
	   * @param {String} event
	   * @return {Boolean}
	   * @api public
	   */


	  Emitter.prototype.hasListeners = function (event) {
	    return !!this.listeners(event).length;
	  };
	});

	var freezing = !fails(function () {
	  return Object.isExtensible(Object.preventExtensions({}));
	});

	var hiddenKeys = {};

	var internalMetadata = createCommonjsModule(function (module) {
	var defineProperty = objectDefineProperty.f;



	var METADATA = uid('meta');
	var id = 0;

	var isExtensible = Object.isExtensible || function () {
	  return true;
	};

	var setMetadata = function (it) {
	  defineProperty(it, METADATA, { value: {
	    objectID: 'O' + ++id, // object ID
	    weakData: {}          // weak collections IDs
	  } });
	};

	var fastKey = function (it, create) {
	  // return a primitive with prefix
	  if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
	  if (!has(it, METADATA)) {
	    // can't set metadata to uncaught frozen object
	    if (!isExtensible(it)) return 'F';
	    // not necessary to add metadata
	    if (!create) return 'E';
	    // add missing metadata
	    setMetadata(it);
	  // return object ID
	  } return it[METADATA].objectID;
	};

	var getWeakData = function (it, create) {
	  if (!has(it, METADATA)) {
	    // can't set metadata to uncaught frozen object
	    if (!isExtensible(it)) return true;
	    // not necessary to add metadata
	    if (!create) return false;
	    // add missing metadata
	    setMetadata(it);
	  // return the store of weak collections IDs
	  } return it[METADATA].weakData;
	};

	// add metadata on freeze-family methods calling
	var onFreeze = function (it) {
	  if (freezing && meta.REQUIRED && isExtensible(it) && !has(it, METADATA)) setMetadata(it);
	  return it;
	};

	var meta = module.exports = {
	  REQUIRED: false,
	  fastKey: fastKey,
	  getWeakData: getWeakData,
	  onFreeze: onFreeze
	};

	hiddenKeys[METADATA] = true;
	});
	var internalMetadata_1 = internalMetadata.REQUIRED;
	var internalMetadata_2 = internalMetadata.fastKey;
	var internalMetadata_3 = internalMetadata.getWeakData;
	var internalMetadata_4 = internalMetadata.onFreeze;

	var onFreeze = internalMetadata.onFreeze;

	var nativeFreeze = Object.freeze;
	var FAILS_ON_PRIMITIVES = fails(function () { nativeFreeze(1); });

	// `Object.freeze` method
	// https://tc39.github.io/ecma262/#sec-object.freeze
	_export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !freezing }, {
	  freeze: function freeze(it) {
	    return nativeFreeze && isObject(it) ? nativeFreeze(onFreeze(it)) : it;
	  }
	});

	var freeze = path.Object.freeze;

	var freeze$1 = freeze;

	var freeze$2 = freeze$1;

	// `Array.prototype.{ indexOf, includes }` methods implementation
	var createMethod = function (IS_INCLUDES) {
	  return function ($this, el, fromIndex) {
	    var O = toIndexedObject($this);
	    var length = toLength(O.length);
	    var index = toAbsoluteIndex(fromIndex, length);
	    var value;
	    // Array#includes uses SameValueZero equality algorithm
	    // eslint-disable-next-line no-self-compare
	    if (IS_INCLUDES && el != el) while (length > index) {
	      value = O[index++];
	      // eslint-disable-next-line no-self-compare
	      if (value != value) return true;
	    // Array#indexOf ignores holes, Array#includes - not
	    } else for (;length > index; index++) {
	      if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
	    } return !IS_INCLUDES && -1;
	  };
	};

	var arrayIncludes = {
	  // `Array.prototype.includes` method
	  // https://tc39.github.io/ecma262/#sec-array.prototype.includes
	  includes: createMethod(true),
	  // `Array.prototype.indexOf` method
	  // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
	  indexOf: createMethod(false)
	};

	var indexOf = arrayIncludes.indexOf;


	var objectKeysInternal = function (object, names) {
	  var O = toIndexedObject(object);
	  var i = 0;
	  var result = [];
	  var key;
	  for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
	  // Don't enum bug & hidden keys
	  while (names.length > i) if (has(O, key = names[i++])) {
	    ~indexOf(result, key) || result.push(key);
	  }
	  return result;
	};

	// IE8- don't enum bug keys
	var enumBugKeys = [
	  'constructor',
	  'hasOwnProperty',
	  'isPrototypeOf',
	  'propertyIsEnumerable',
	  'toLocaleString',
	  'toString',
	  'valueOf'
	];

	// `Object.keys` method
	// https://tc39.github.io/ecma262/#sec-object.keys
	var objectKeys = Object.keys || function keys(O) {
	  return objectKeysInternal(O, enumBugKeys);
	};

	var f$3 = Object.getOwnPropertySymbols;

	var objectGetOwnPropertySymbols = {
		f: f$3
	};

	var nativeAssign = Object.assign;

	// `Object.assign` method
	// https://tc39.github.io/ecma262/#sec-object.assign
	// should work with symbols and should have deterministic property order (V8 bug)
	var objectAssign = !nativeAssign || fails(function () {
	  var A = {};
	  var B = {};
	  // eslint-disable-next-line no-undef
	  var symbol = Symbol();
	  var alphabet = 'abcdefghijklmnopqrst';
	  A[symbol] = 7;
	  alphabet.split('').forEach(function (chr) { B[chr] = chr; });
	  return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet;
	}) ? function assign(target, source) { // eslint-disable-line no-unused-vars
	  var T = toObject(target);
	  var argumentsLength = arguments.length;
	  var index = 1;
	  var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
	  var propertyIsEnumerable = objectPropertyIsEnumerable.f;
	  while (argumentsLength > index) {
	    var S = indexedObject(arguments[index++]);
	    var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);
	    var length = keys.length;
	    var j = 0;
	    var key;
	    while (length > j) {
	      key = keys[j++];
	      if (!descriptors || propertyIsEnumerable.call(S, key)) T[key] = S[key];
	    }
	  } return T;
	} : nativeAssign;

	// `Object.assign` method
	// https://tc39.github.io/ecma262/#sec-object.assign
	_export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, {
	  assign: objectAssign
	});

	var assign = path.Object.assign;

	var assign$1 = assign;

	var assign$2 = assign$1;

	// `String.prototype.{ codePointAt, at }` methods implementation
	var createMethod$1 = function (CONVERT_TO_STRING) {
	  return function ($this, pos) {
	    var S = String(requireObjectCoercible($this));
	    var position = toInteger(pos);
	    var size = S.length;
	    var first, second;
	    if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
	    first = S.charCodeAt(position);
	    return first < 0xD800 || first > 0xDBFF || position + 1 === size
	      || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
	        ? CONVERT_TO_STRING ? S.charAt(position) : first
	        : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
	  };
	};

	var stringMultibyte = {
	  // `String.prototype.codePointAt` method
	  // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat
	  codeAt: createMethod$1(false),
	  // `String.prototype.at` method
	  // https://github.com/mathiasbynens/String.prototype.at
	  charAt: createMethod$1(true)
	};

	var functionToString = shared('native-function-to-string', Function.toString);

	var WeakMap = global_1.WeakMap;

	var nativeWeakMap = typeof WeakMap === 'function' && /native code/.test(functionToString.call(WeakMap));

	var keys = shared('keys');

	var sharedKey = function (key) {
	  return keys[key] || (keys[key] = uid(key));
	};

	var WeakMap$1 = global_1.WeakMap;
	var set, get, has$1;

	var enforce = function (it) {
	  return has$1(it) ? get(it) : set(it, {});
	};

	var getterFor = function (TYPE) {
	  return function (it) {
	    var state;
	    if (!isObject(it) || (state = get(it)).type !== TYPE) {
	      throw TypeError('Incompatible receiver, ' + TYPE + ' required');
	    } return state;
	  };
	};

	if (nativeWeakMap) {
	  var store$2 = new WeakMap$1();
	  var wmget = store$2.get;
	  var wmhas = store$2.has;
	  var wmset = store$2.set;
	  set = function (it, metadata) {
	    wmset.call(store$2, it, metadata);
	    return metadata;
	  };
	  get = function (it) {
	    return wmget.call(store$2, it) || {};
	  };
	  has$1 = function (it) {
	    return wmhas.call(store$2, it);
	  };
	} else {
	  var STATE = sharedKey('state');
	  hiddenKeys[STATE] = true;
	  set = function (it, metadata) {
	    createNonEnumerableProperty(it, STATE, metadata);
	    return metadata;
	  };
	  get = function (it) {
	    return has(it, STATE) ? it[STATE] : {};
	  };
	  has$1 = function (it) {
	    return has(it, STATE);
	  };
	}

	var internalState = {
	  set: set,
	  get: get,
	  has: has$1,
	  enforce: enforce,
	  getterFor: getterFor
	};

	var correctPrototypeGetter = !fails(function () {
	  function F() { /* empty */ }
	  F.prototype.constructor = null;
	  return Object.getPrototypeOf(new F()) !== F.prototype;
	});

	var IE_PROTO = sharedKey('IE_PROTO');
	var ObjectPrototype = Object.prototype;

	// `Object.getPrototypeOf` method
	// https://tc39.github.io/ecma262/#sec-object.getprototypeof
	var objectGetPrototypeOf = correctPrototypeGetter ? Object.getPrototypeOf : function (O) {
	  O = toObject(O);
	  if (has(O, IE_PROTO)) return O[IE_PROTO];
	  if (typeof O.constructor == 'function' && O instanceof O.constructor) {
	    return O.constructor.prototype;
	  } return O instanceof Object ? ObjectPrototype : null;
	};

	var ITERATOR = wellKnownSymbol('iterator');
	var BUGGY_SAFARI_ITERATORS = false;

	// `%IteratorPrototype%` object
	// https://tc39.github.io/ecma262/#sec-%iteratorprototype%-object
	var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;

	if ([].keys) {
	  arrayIterator = [].keys();
	  // Safari 8 has buggy iterators w/o `next`
	  if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
	  else {
	    PrototypeOfArrayIteratorPrototype = objectGetPrototypeOf(objectGetPrototypeOf(arrayIterator));
	    if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
	  }
	}

	if (IteratorPrototype == undefined) IteratorPrototype = {};

	var iteratorsCore = {
	  IteratorPrototype: IteratorPrototype,
	  BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
	};

	// `Object.defineProperties` method
	// https://tc39.github.io/ecma262/#sec-object.defineproperties
	var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
	  anObject(O);
	  var keys = objectKeys(Properties);
	  var length = keys.length;
	  var index = 0;
	  var key;
	  while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]);
	  return O;
	};

	var html = getBuiltIn('document', 'documentElement');

	var IE_PROTO$1 = sharedKey('IE_PROTO');

	var PROTOTYPE = 'prototype';
	var Empty = function () { /* empty */ };

	// Create object with fake `null` prototype: use iframe Object with cleared prototype
	var createDict = function () {
	  // Thrash, waste and sodomy: IE GC bug
	  var iframe = documentCreateElement('iframe');
	  var length = enumBugKeys.length;
	  var lt = '<';
	  var script = 'script';
	  var gt = '>';
	  var js = 'java' + script + ':';
	  var iframeDocument;
	  iframe.style.display = 'none';
	  html.appendChild(iframe);
	  iframe.src = String(js);
	  iframeDocument = iframe.contentWindow.document;
	  iframeDocument.open();
	  iframeDocument.write(lt + script + gt + 'document.F=Object' + lt + '/' + script + gt);
	  iframeDocument.close();
	  createDict = iframeDocument.F;
	  while (length--) delete createDict[PROTOTYPE][enumBugKeys[length]];
	  return createDict();
	};

	// `Object.create` method
	// https://tc39.github.io/ecma262/#sec-object.create
	var objectCreate = Object.create || function create(O, Properties) {
	  var result;
	  if (O !== null) {
	    Empty[PROTOTYPE] = anObject(O);
	    result = new Empty();
	    Empty[PROTOTYPE] = null;
	    // add "__proto__" for Object.getPrototypeOf polyfill
	    result[IE_PROTO$1] = O;
	  } else result = createDict();
	  return Properties === undefined ? result : objectDefineProperties(result, Properties);
	};

	hiddenKeys[IE_PROTO$1] = true;

	var TO_STRING_TAG = wellKnownSymbol('toStringTag');
	// ES3 wrong here
	var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';

	// fallback for IE11 Script Access Denied error
	var tryGet = function (it, key) {
	  try {
	    return it[key];
	  } catch (error) { /* empty */ }
	};

	// getting tag from ES6+ `Object.prototype.toString`
	var classof = function (it) {
	  var O, tag, result;
	  return it === undefined ? 'Undefined' : it === null ? 'Null'
	    // @@toStringTag case
	    : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag
	    // builtinTag case
	    : CORRECT_ARGUMENTS ? classofRaw(O)
	    // ES3 arguments fallback
	    : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
	};

	var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
	var test = {};

	test[TO_STRING_TAG$1] = 'z';

	// `Object.prototype.toString` method implementation
	// https://tc39.github.io/ecma262/#sec-object.prototype.tostring
	var objectToString = String(test) !== '[object z]' ? function toString() {
	  return '[object ' + classof(this) + ']';
	} : test.toString;

	var defineProperty = objectDefineProperty.f;





	var TO_STRING_TAG$2 = wellKnownSymbol('toStringTag');
	var METHOD_REQUIRED = objectToString !== ({}).toString;

	var setToStringTag = function (it, TAG, STATIC, SET_METHOD) {
	  if (it) {
	    var target = STATIC ? it : it.prototype;
	    if (!has(target, TO_STRING_TAG$2)) {
	      defineProperty(target, TO_STRING_TAG$2, { configurable: true, value: TAG });
	    }
	    if (SET_METHOD && METHOD_REQUIRED) {
	      createNonEnumerableProperty(target, 'toString', objectToString);
	    }
	  }
	};

	var iterators = {};

	var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;





	var returnThis = function () { return this; };

	var createIteratorConstructor = function (IteratorConstructor, NAME, next) {
	  var TO_STRING_TAG = NAME + ' Iterator';
	  IteratorConstructor.prototype = objectCreate(IteratorPrototype$1, { next: createPropertyDescriptor(1, next) });
	  setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
	  iterators[TO_STRING_TAG] = returnThis;
	  return IteratorConstructor;
	};

	var aPossiblePrototype = function (it) {
	  if (!isObject(it) && it !== null) {
	    throw TypeError("Can't set " + String(it) + ' as a prototype');
	  } return it;
	};

	// `Object.setPrototypeOf` method
	// https://tc39.github.io/ecma262/#sec-object.setprototypeof
	// Works with __proto__ only. Old v8 can't work with null proto objects.
	/* eslint-disable no-proto */
	var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
	  var CORRECT_SETTER = false;
	  var test = {};
	  var setter;
	  try {
	    setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
	    setter.call(test, []);
	    CORRECT_SETTER = test instanceof Array;
	  } catch (error) { /* empty */ }
	  return function setPrototypeOf(O, proto) {
	    anObject(O);
	    aPossiblePrototype(proto);
	    if (CORRECT_SETTER) setter.call(O, proto);
	    else O.__proto__ = proto;
	    return O;
	  };
	}() : undefined);

	var redefine = function (target, key, value, options) {
	  if (options && options.enumerable) target[key] = value;
	  else createNonEnumerableProperty(target, key, value);
	};

	var IteratorPrototype$2 = iteratorsCore.IteratorPrototype;
	var BUGGY_SAFARI_ITERATORS$1 = iteratorsCore.BUGGY_SAFARI_ITERATORS;
	var ITERATOR$1 = wellKnownSymbol('iterator');
	var KEYS = 'keys';
	var VALUES = 'values';
	var ENTRIES = 'entries';

	var returnThis$1 = function () { return this; };

	var defineIterator = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
	  createIteratorConstructor(IteratorConstructor, NAME, next);

	  var getIterationMethod = function (KIND) {
	    if (KIND === DEFAULT && defaultIterator) return defaultIterator;
	    if (!BUGGY_SAFARI_ITERATORS$1 && KIND in IterablePrototype) return IterablePrototype[KIND];
	    switch (KIND) {
	      case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
	      case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
	      case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
	    } return function () { return new IteratorConstructor(this); };
	  };

	  var TO_STRING_TAG = NAME + ' Iterator';
	  var INCORRECT_VALUES_NAME = false;
	  var IterablePrototype = Iterable.prototype;
	  var nativeIterator = IterablePrototype[ITERATOR$1]
	    || IterablePrototype['@@iterator']
	    || DEFAULT && IterablePrototype[DEFAULT];
	  var defaultIterator = !BUGGY_SAFARI_ITERATORS$1 && nativeIterator || getIterationMethod(DEFAULT);
	  var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
	  var CurrentIteratorPrototype, methods, KEY;

	  // fix native
	  if (anyNativeIterator) {
	    CurrentIteratorPrototype = objectGetPrototypeOf(anyNativeIterator.call(new Iterable()));
	    if (IteratorPrototype$2 !== Object.prototype && CurrentIteratorPrototype.next) {
	      // Set @@toStringTag to native iterators
	      setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
	      iterators[TO_STRING_TAG] = returnThis$1;
	    }
	  }

	  // fix Array#{values, @@iterator}.name in V8 / FF
	  if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
	    INCORRECT_VALUES_NAME = true;
	    defaultIterator = function values() { return nativeIterator.call(this); };
	  }

	  // define iterator
	  if (( FORCED) && IterablePrototype[ITERATOR$1] !== defaultIterator) {
	    createNonEnumerableProperty(IterablePrototype, ITERATOR$1, defaultIterator);
	  }
	  iterators[NAME] = defaultIterator;

	  // export additional methods
	  if (DEFAULT) {
	    methods = {
	      values: getIterationMethod(VALUES),
	      keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
	      entries: getIterationMethod(ENTRIES)
	    };
	    if (FORCED) for (KEY in methods) {
	      if (BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
	        redefine(IterablePrototype, KEY, methods[KEY]);
	      }
	    } else _export({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME }, methods);
	  }

	  return methods;
	};

	var charAt = stringMultibyte.charAt;



	var STRING_ITERATOR = 'String Iterator';
	var setInternalState = internalState.set;
	var getInternalState = internalState.getterFor(STRING_ITERATOR);

	// `String.prototype[@@iterator]` method
	// https://tc39.github.io/ecma262/#sec-string.prototype-@@iterator
	defineIterator(String, 'String', function (iterated) {
	  setInternalState(this, {
	    type: STRING_ITERATOR,
	    string: String(iterated),
	    index: 0
	  });
	// `%StringIteratorPrototype%.next` method
	// https://tc39.github.io/ecma262/#sec-%stringiteratorprototype%.next
	}, function next() {
	  var state = getInternalState(this);
	  var string = state.string;
	  var index = state.index;
	  var point;
	  if (index >= string.length) return { value: undefined, done: true };
	  point = charAt(string, index);
	  state.index += point.length;
	  return { value: point, done: false };
	});

	// call something on iterator step with safe closing on error
	var callWithSafeIterationClosing = function (iterator, fn, value, ENTRIES) {
	  try {
	    return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
	  // 7.4.6 IteratorClose(iterator, completion)
	  } catch (error) {
	    var returnMethod = iterator['return'];
	    if (returnMethod !== undefined) anObject(returnMethod.call(iterator));
	    throw error;
	  }
	};

	var ITERATOR$2 = wellKnownSymbol('iterator');
	var ArrayPrototype$2 = Array.prototype;

	// check on default Array iterator
	var isArrayIteratorMethod = function (it) {
	  return it !== undefined && (iterators.Array === it || ArrayPrototype$2[ITERATOR$2] === it);
	};

	var ITERATOR$3 = wellKnownSymbol('iterator');

	var getIteratorMethod = function (it) {
	  if (it != undefined) return it[ITERATOR$3]
	    || it['@@iterator']
	    || iterators[classof(it)];
	};

	// `Array.from` method implementation
	// https://tc39.github.io/ecma262/#sec-array.from
	var arrayFrom = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
	  var O = toObject(arrayLike);
	  var C = typeof this == 'function' ? this : Array;
	  var argumentsLength = arguments.length;
	  var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
	  var mapping = mapfn !== undefined;
	  var index = 0;
	  var iteratorMethod = getIteratorMethod(O);
	  var length, result, step, iterator, next;
	  if (mapping) mapfn = bindContext(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2);
	  // if the target is not iterable or it's an array with the default iterator - use a simple case
	  if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod(iteratorMethod))) {
	    iterator = iteratorMethod.call(O);
	    next = iterator.next;
	    result = new C();
	    for (;!(step = next.call(iterator)).done; index++) {
	      createProperty(result, index, mapping
	        ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true)
	        : step.value
	      );
	    }
	  } else {
	    length = toLength(O.length);
	    result = new C(length);
	    for (;length > index; index++) {
	      createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);
	    }
	  }
	  result.length = index;
	  return result;
	};

	var ITERATOR$4 = wellKnownSymbol('iterator');
	var SAFE_CLOSING = false;

	try {
	  var called = 0;
	  var iteratorWithReturn = {
	    next: function () {
	      return { done: !!called++ };
	    },
	    'return': function () {
	      SAFE_CLOSING = true;
	    }
	  };
	  iteratorWithReturn[ITERATOR$4] = function () {
	    return this;
	  };
	  // eslint-disable-next-line no-throw-literal
	  Array.from(iteratorWithReturn, function () { throw 2; });
	} catch (error) { /* empty */ }

	var checkCorrectnessOfIteration = function (exec, SKIP_CLOSING) {
	  if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
	  var ITERATION_SUPPORT = false;
	  try {
	    var object = {};
	    object[ITERATOR$4] = function () {
	      return {
	        next: function () {
	          return { done: ITERATION_SUPPORT = true };
	        }
	      };
	    };
	    exec(object);
	  } catch (error) { /* empty */ }
	  return ITERATION_SUPPORT;
	};

	var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {
	  Array.from(iterable);
	});

	// `Array.from` method
	// https://tc39.github.io/ecma262/#sec-array.from
	_export({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, {
	  from: arrayFrom
	});

	var from_1 = path.Array.from;

	var from_1$1 = from_1;

	var from_1$2 = from_1$1;

	var push = [].push;

	// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation
	var createMethod$2 = function (TYPE) {
	  var IS_MAP = TYPE == 1;
	  var IS_FILTER = TYPE == 2;
	  var IS_SOME = TYPE == 3;
	  var IS_EVERY = TYPE == 4;
	  var IS_FIND_INDEX = TYPE == 6;
	  var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
	  return function ($this, callbackfn, that, specificCreate) {
	    var O = toObject($this);
	    var self = indexedObject(O);
	    var boundFunction = bindContext(callbackfn, that, 3);
	    var length = toLength(self.length);
	    var index = 0;
	    var create = specificCreate || arraySpeciesCreate;
	    var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
	    var value, result;
	    for (;length > index; index++) if (NO_HOLES || index in self) {
	      value = self[index];
	      result = boundFunction(value, index, O);
	      if (TYPE) {
	        if (IS_MAP) target[index] = result; // map
	        else if (result) switch (TYPE) {
	          case 3: return true;              // some
	          case 5: return value;             // find
	          case 6: return index;             // findIndex
	          case 2: push.call(target, value); // filter
	        } else if (IS_EVERY) return false;  // every
	      }
	    }
	    return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
	  };
	};

	var arrayIteration = {
	  // `Array.prototype.forEach` method
	  // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
	  forEach: createMethod$2(0),
	  // `Array.prototype.map` method
	  // https://tc39.github.io/ecma262/#sec-array.prototype.map
	  map: createMethod$2(1),
	  // `Array.prototype.filter` method
	  // https://tc39.github.io/ecma262/#sec-array.prototype.filter
	  filter: createMethod$2(2),
	  // `Array.prototype.some` method
	  // https://tc39.github.io/ecma262/#sec-array.prototype.some
	  some: createMethod$2(3),
	  // `Array.prototype.every` method
	  // https://tc39.github.io/ecma262/#sec-array.prototype.every
	  every: createMethod$2(4),
	  // `Array.prototype.find` method
	  // https://tc39.github.io/ecma262/#sec-array.prototype.find
	  find: createMethod$2(5),
	  // `Array.prototype.findIndex` method
	  // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex
	  findIndex: createMethod$2(6)
	};

	var $filter = arrayIteration.filter;


	// `Array.prototype.filter` method
	// https://tc39.github.io/ecma262/#sec-array.prototype.filter
	// with adding support of @@species
	_export({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('filter') }, {
	  filter: function filter(callbackfn /* , thisArg */) {
	    return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
	  }
	});

	var filter = entryVirtual('Array').filter;

	var ArrayPrototype$3 = Array.prototype;

	var filter_1 = function (it) {
	  var own = it.filter;
	  return it === ArrayPrototype$3 || (it instanceof Array && own === ArrayPrototype$3.filter) ? filter : own;
	};

	var filter$1 = filter_1;

	var filter$2 = filter$1;

	var ARRAY_ITERATOR = 'Array Iterator';
	var setInternalState$1 = internalState.set;
	var getInternalState$1 = internalState.getterFor(ARRAY_ITERATOR);

	// `Array.prototype.entries` method
	// https://tc39.github.io/ecma262/#sec-array.prototype.entries
	// `Array.prototype.keys` method
	// https://tc39.github.io/ecma262/#sec-array.prototype.keys
	// `Array.prototype.values` method
	// https://tc39.github.io/ecma262/#sec-array.prototype.values
	// `Array.prototype[@@iterator]` method
	// https://tc39.github.io/ecma262/#sec-array.prototype-@@iterator
	// `CreateArrayIterator` internal method
	// https://tc39.github.io/ecma262/#sec-createarrayiterator
	var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) {
	  setInternalState$1(this, {
	    type: ARRAY_ITERATOR,
	    target: toIndexedObject(iterated), // target
	    index: 0,                          // next index
	    kind: kind                         // kind
	  });
	// `%ArrayIteratorPrototype%.next` method
	// https://tc39.github.io/ecma262/#sec-%arrayiteratorprototype%.next
	}, function () {
	  var state = getInternalState$1(this);
	  var target = state.target;
	  var kind = state.kind;
	  var index = state.index++;
	  if (!target || index >= target.length) {
	    state.target = undefined;
	    return { value: undefined, done: true };
	  }
	  if (kind == 'keys') return { value: index, done: false };
	  if (kind == 'values') return { value: target[index], done: false };
	  return { value: [index, target[index]], done: false };
	}, 'values');

	// argumentsList[@@iterator] is %ArrayProto_values%
	// https://tc39.github.io/ecma262/#sec-createunmappedargumentsobject
	// https://tc39.github.io/ecma262/#sec-createmappedargumentsobject
	iterators.Arguments = iterators.Array;

	// iterable DOM collections
	// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
	var domIterables = {
	  CSSRuleList: 0,
	  CSSStyleDeclaration: 0,
	  CSSValueList: 0,
	  ClientRectList: 0,
	  DOMRectList: 0,
	  DOMStringList: 0,
	  DOMTokenList: 1,
	  DataTransferItemList: 0,
	  FileList: 0,
	  HTMLAllCollection: 0,
	  HTMLCollection: 0,
	  HTMLFormElement: 0,
	  HTMLSelectElement: 0,
	  MediaList: 0,
	  MimeTypeArray: 0,
	  NamedNodeMap: 0,
	  NodeList: 1,
	  PaintRequestList: 0,
	  Plugin: 0,
	  PluginArray: 0,
	  SVGLengthList: 0,
	  SVGNumberList: 0,
	  SVGPathSegList: 0,
	  SVGPointList: 0,
	  SVGStringList: 0,
	  SVGTransformList: 0,
	  SourceBufferList: 0,
	  StyleSheetList: 0,
	  TextTrackCueList: 0,
	  TextTrackList: 0,
	  TouchList: 0
	};

	var TO_STRING_TAG$3 = wellKnownSymbol('toStringTag');

	for (var COLLECTION_NAME in domIterables) {
	  var Collection = global_1[COLLECTION_NAME];
	  var CollectionPrototype = Collection && Collection.prototype;
	  if (CollectionPrototype && !CollectionPrototype[TO_STRING_TAG$3]) {
	    createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG$3, COLLECTION_NAME);
	  }
	  iterators[COLLECTION_NAME] = iterators.Array;
	}

	var values = entryVirtual('Array').values;

	var values$1 = values;

	var ArrayPrototype$4 = Array.prototype;

	var DOMIterables = {
	  DOMTokenList: true,
	  NodeList: true
	};

	var values_1 = function (it) {
	  var own = it.values;
	  return it === ArrayPrototype$4 || (it instanceof Array && own === ArrayPrototype$4.values)
	    // eslint-disable-next-line no-prototype-builtins
	    || DOMIterables.hasOwnProperty(classof(it)) ? values$1 : own;
	};

	var values$2 = values_1;

	// a string of all valid unicode whitespaces
	// eslint-disable-next-line max-len
	var whitespaces = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';

	var whitespace = '[' + whitespaces + ']';
	var ltrim = RegExp('^' + whitespace + whitespace + '*');
	var rtrim = RegExp(whitespace + whitespace + '*$');

	// `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
	var createMethod$3 = function (TYPE) {
	  return function ($this) {
	    var string = String(requireObjectCoercible($this));
	    if (TYPE & 1) string = string.replace(ltrim, '');
	    if (TYPE & 2) string = string.replace(rtrim, '');
	    return string;
	  };
	};

	var stringTrim = {
	  // `String.prototype.{ trimLeft, trimStart }` methods
	  // https://tc39.github.io/ecma262/#sec-string.prototype.trimstart
	  start: createMethod$3(1),
	  // `String.prototype.{ trimRight, trimEnd }` methods
	  // https://tc39.github.io/ecma262/#sec-string.prototype.trimend
	  end: createMethod$3(2),
	  // `String.prototype.trim` method
	  // https://tc39.github.io/ecma262/#sec-string.prototype.trim
	  trim: createMethod$3(3)
	};

	var trim = stringTrim.trim;


	var nativeParseInt = global_1.parseInt;
	var hex = /^[+-]?0[Xx]/;
	var FORCED = nativeParseInt(whitespaces + '08') !== 8 || nativeParseInt(whitespaces + '0x16') !== 22;

	// `parseInt` method
	// https://tc39.github.io/ecma262/#sec-parseint-string-radix
	var _parseInt = FORCED ? function parseInt(string, radix) {
	  var S = trim(String(string));
	  return nativeParseInt(S, (radix >>> 0) || (hex.test(S) ? 16 : 10));
	} : nativeParseInt;

	// `parseInt` method
	// https://tc39.github.io/ecma262/#sec-parseint-string-radix
	_export({ global: true, forced: parseInt != _parseInt }, {
	  parseInt: _parseInt
	});

	var _parseInt$1 = path.parseInt;

	var _parseInt$2 = _parseInt$1;

	var _parseInt$3 = _parseInt$2;

	var $map = arrayIteration.map;


	// `Array.prototype.map` method
	// https://tc39.github.io/ecma262/#sec-array.prototype.map
	// with adding support of @@species
	_export({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('map') }, {
	  map: function map(callbackfn /* , thisArg */) {
	    return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
	  }
	});

	var map = entryVirtual('Array').map;

	var ArrayPrototype$5 = Array.prototype;

	var map_1 = function (it) {
	  var own = it.map;
	  return it === ArrayPrototype$5 || (it instanceof Array && own === ArrayPrototype$5.map) ? map : own;
	};

	var map$1 = map_1;

	var map$2 = map$1;

	var non = '\u200B\u0085\u180E';

	// check that a method works with the correct list
	// of whitespaces and has a correct name
	var forcedStringTrimMethod = function (METHOD_NAME) {
	  return fails(function () {
	    return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME;
	  });
	};

	var $trim = stringTrim.trim;


	// `String.prototype.trim` method
	// https://tc39.github.io/ecma262/#sec-string.prototype.trim
	_export({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
	  trim: function trim() {
	    return $trim(this);
	  }
	});

	var trim$1 = entryVirtual('String').trim;

	var StringPrototype = String.prototype;

	var trim_1 = function (it) {
	  var own = it.trim;
	  return typeof it === 'string' || it === StringPrototype
	    || (it instanceof String && own === StringPrototype.trim) ? trim$1 : own;
	};

	var trim$2 = trim_1;

	var trim$3 = trim$2;

	var entries = entryVirtual('Array').entries;

	var entries$1 = entries;

	var ArrayPrototype$6 = Array.prototype;

	var DOMIterables$1 = {
	  DOMTokenList: true,
	  NodeList: true
	};

	var entries_1 = function (it) {
	  var own = it.entries;
	  return it === ArrayPrototype$6 || (it instanceof Array && own === ArrayPrototype$6.entries)
	    // eslint-disable-next-line no-prototype-builtins
	    || DOMIterables$1.hasOwnProperty(classof(it)) ? entries$1 : own;
	};

	var entries$2 = entries_1;

	// `Object.setPrototypeOf` method
	// https://tc39.github.io/ecma262/#sec-object.setprototypeof
	_export({ target: 'Object', stat: true }, {
	  setPrototypeOf: objectSetPrototypeOf
	});

	var setPrototypeOf = path.Object.setPrototypeOf;

	var setPrototypeOf$1 = setPrototypeOf;

	var setPrototypeOf$2 = setPrototypeOf$1;

	var keys$1 = entryVirtual('Array').keys;

	var keys$2 = keys$1;

	var ArrayPrototype$7 = Array.prototype;

	var DOMIterables$2 = {
	  DOMTokenList: true,
	  NodeList: true
	};

	var keys_1 = function (it) {
	  var own = it.keys;
	  return it === ArrayPrototype$7 || (it instanceof Array && own === ArrayPrototype$7.keys)
	    // eslint-disable-next-line no-prototype-builtins
	    || DOMIterables$2.hasOwnProperty(classof(it)) ? keys$2 : own;
	};

	var keys$3 = keys_1;

	var FAILS_ON_PRIMITIVES$1 = fails(function () { objectGetPrototypeOf(1); });

	// `Object.getPrototypeOf` method
	// https://tc39.github.io/ecma262/#sec-object.getprototypeof
	_export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$1, sham: !correctPrototypeGetter }, {
	  getPrototypeOf: function getPrototypeOf(it) {
	    return objectGetPrototypeOf(toObject(it));
	  }
	});

	var getPrototypeOf = path.Object.getPrototypeOf;

	var getPrototypeOf$1 = getPrototypeOf;

	var getPrototypeOf$2 = getPrototypeOf$1;

	var sloppyArrayMethod = function (METHOD_NAME, argument) {
	  var method = [][METHOD_NAME];
	  return !method || !fails(function () {
	    // eslint-disable-next-line no-useless-call,no-throw-literal
	    method.call(null, argument || function () { throw 1; }, 1);
	  });
	};

	var $forEach = arrayIteration.forEach;


	// `Array.prototype.forEach` method implementation
	// https://tc39.github.io/ecma262/#sec-array.prototype.foreach
	var arrayForEach = sloppyArrayMethod('forEach') ? function forEach(callbackfn /* , thisArg */) {
	  return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
	} : [].forEach;

	// `Array.prototype.forEach` method
	// https://tc39.github.io/ecma262/#sec-array.prototype.foreach
	_export({ target: 'Array', proto: true, forced: [].forEach != arrayForEach }, {
	  forEach: arrayForEach
	});

	var forEach = entryVirtual('Array').forEach;

	var forEach$1 = forEach;

	var ArrayPrototype$8 = Array.prototype;

	var DOMIterables$3 = {
	  DOMTokenList: true,
	  NodeList: true
	};

	var forEach_1 = function (it) {
	  var own = it.forEach;
	  return it === ArrayPrototype$8 || (it instanceof Array && own === ArrayPrototype$8.forEach)
	    // eslint-disable-next-line no-prototype-builtins
	    || DOMIterables$3.hasOwnProperty(classof(it)) ? forEach$1 : own;
	};

	var forEach$2 = forEach_1;

	// `Object.create` method
	// https://tc39.github.io/ecma262/#sec-object.create
	_export({ target: 'Object', stat: true, sham: !descriptors }, {
	  create: objectCreate
	});

	var Object$1 = path.Object;

	var create = function create(P, D) {
	  return Object$1.create(P, D);
	};

	var create$1 = create;

	var create$2 = create$1;

	// `Array.isArray` method
	// https://tc39.github.io/ecma262/#sec-array.isarray
	_export({ target: 'Array', stat: true }, {
	  isArray: isArray
	});

	var isArray$1 = path.Array.isArray;

	var isArray$2 = isArray$1;

	var isArray$3 = isArray$2;

	var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
	var MAX_SAFE_INTEGER$1 = 0x1FFFFFFFFFFFFF;
	var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';

	// We can't use this feature detection in V8 since it causes
	// deoptimization and serious performance degradation
	// https://github.com/zloirock/core-js/issues/679
	var IS_CONCAT_SPREADABLE_SUPPORT = v8Version >= 51 || !fails(function () {
	  var array = [];
	  array[IS_CONCAT_SPREADABLE] = false;
	  return array.concat()[0] !== array;
	});

	var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');

	var isConcatSpreadable = function (O) {
	  if (!isObject(O)) return false;
	  var spreadable = O[IS_CONCAT_SPREADABLE];
	  return spreadable !== undefined ? !!spreadable : isArray(O);
	};

	var FORCED$1 = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;

	// `Array.prototype.concat` method
	// https://tc39.github.io/ecma262/#sec-array.prototype.concat
	// with adding support of @@isConcatSpreadable and @@species
	_export({ target: 'Array', proto: true, forced: FORCED$1 }, {
	  concat: function concat(arg) { // eslint-disable-line no-unused-vars
	    var O = toObject(this);
	    var A = arraySpeciesCreate(O, 0);
	    var n = 0;
	    var i, k, length, len, E;
	    for (i = -1, length = arguments.length; i < length; i++) {
	      E = i === -1 ? O : arguments[i];
	      if (isConcatSpreadable(E)) {
	        len = toLength(E.length);
	        if (n + len > MAX_SAFE_INTEGER$1) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
	        for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
	      } else {
	        if (n >= MAX_SAFE_INTEGER$1) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
	        createProperty(A, n++, E);
	      }
	    }
	    A.length = n;
	    return A;
	  }
	});

	var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype');

	// `Object.getOwnPropertyNames` method
	// https://tc39.github.io/ecma262/#sec-object.getownpropertynames
	var f$4 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
	  return objectKeysInternal(O, hiddenKeys$1);
	};

	var objectGetOwnPropertyNames = {
		f: f$4
	};

	var nativeGetOwnPropertyNames = objectGetOwnPropertyNames.f;

	var toString$1 = {}.toString;

	var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
	  ? Object.getOwnPropertyNames(window) : [];

	var getWindowNames = function (it) {
	  try {
	    return nativeGetOwnPropertyNames(it);
	  } catch (error) {
	    return windowNames.slice();
	  }
	};

	// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
	var f$5 = function getOwnPropertyNames(it) {
	  return windowNames && toString$1.call(it) == '[object Window]'
	    ? getWindowNames(it)
	    : nativeGetOwnPropertyNames(toIndexedObject(it));
	};

	var objectGetOwnPropertyNamesExternal = {
		f: f$5
	};

	var f$6 = wellKnownSymbol;

	var wrappedWellKnownSymbol = {
		f: f$6
	};

	var defineProperty$1 = objectDefineProperty.f;

	var defineWellKnownSymbol = function (NAME) {
	  var Symbol = path.Symbol || (path.Symbol = {});
	  if (!has(Symbol, NAME)) defineProperty$1(Symbol, NAME, {
	    value: wrappedWellKnownSymbol.f(NAME)
	  });
	};

	var $forEach$1 = arrayIteration.forEach;

	var HIDDEN = sharedKey('hidden');
	var SYMBOL = 'Symbol';
	var PROTOTYPE$1 = 'prototype';
	var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
	var setInternalState$2 = internalState.set;
	var getInternalState$2 = internalState.getterFor(SYMBOL);
	var ObjectPrototype$1 = Object[PROTOTYPE$1];
	var $Symbol = global_1.Symbol;
	var $stringify = getBuiltIn('JSON', 'stringify');
	var nativeGetOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
	var nativeDefineProperty$1 = objectDefineProperty.f;
	var nativeGetOwnPropertyNames$1 = objectGetOwnPropertyNamesExternal.f;
	var nativePropertyIsEnumerable$1 = objectPropertyIsEnumerable.f;
	var AllSymbols = shared('symbols');
	var ObjectPrototypeSymbols = shared('op-symbols');
	var StringToSymbolRegistry = shared('string-to-symbol-registry');
	var SymbolToStringRegistry = shared('symbol-to-string-registry');
	var WellKnownSymbolsStore = shared('wks');
	var QObject = global_1.QObject;
	// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
	var USE_SETTER = !QObject || !QObject[PROTOTYPE$1] || !QObject[PROTOTYPE$1].findChild;

	// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
	var setSymbolDescriptor = descriptors && fails(function () {
	  return objectCreate(nativeDefineProperty$1({}, 'a', {
	    get: function () { return nativeDefineProperty$1(this, 'a', { value: 7 }).a; }
	  })).a != 7;
	}) ? function (O, P, Attributes) {
	  var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor$1(ObjectPrototype$1, P);
	  if (ObjectPrototypeDescriptor) delete ObjectPrototype$1[P];
	  nativeDefineProperty$1(O, P, Attributes);
	  if (ObjectPrototypeDescriptor && O !== ObjectPrototype$1) {
	    nativeDefineProperty$1(ObjectPrototype$1, P, ObjectPrototypeDescriptor);
	  }
	} : nativeDefineProperty$1;

	var wrap = function (tag, description) {
	  var symbol = AllSymbols[tag] = objectCreate($Symbol[PROTOTYPE$1]);
	  setInternalState$2(symbol, {
	    type: SYMBOL,
	    tag: tag,
	    description: description
	  });
	  if (!descriptors) symbol.description = description;
	  return symbol;
	};

	var isSymbol = nativeSymbol && typeof $Symbol.iterator == 'symbol' ? function (it) {
	  return typeof it == 'symbol';
	} : function (it) {
	  return Object(it) instanceof $Symbol;
	};

	var $defineProperty = function defineProperty(O, P, Attributes) {
	  if (O === ObjectPrototype$1) $defineProperty(ObjectPrototypeSymbols, P, Attributes);
	  anObject(O);
	  var key = toPrimitive(P, true);
	  anObject(Attributes);
	  if (has(AllSymbols, key)) {
	    if (!Attributes.enumerable) {
	      if (!has(O, HIDDEN)) nativeDefineProperty$1(O, HIDDEN, createPropertyDescriptor(1, {}));
	      O[HIDDEN][key] = true;
	    } else {
	      if (has(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;
	      Attributes = objectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) });
	    } return setSymbolDescriptor(O, key, Attributes);
	  } return nativeDefineProperty$1(O, key, Attributes);
	};

	var $defineProperties = function defineProperties(O, Properties) {
	  anObject(O);
	  var properties = toIndexedObject(Properties);
	  var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));
	  $forEach$1(keys, function (key) {
	    if (!descriptors || $propertyIsEnumerable.call(properties, key)) $defineProperty(O, key, properties[key]);
	  });
	  return O;
	};

	var $create = function create(O, Properties) {
	  return Properties === undefined ? objectCreate(O) : $defineProperties(objectCreate(O), Properties);
	};

	var $propertyIsEnumerable = function propertyIsEnumerable(V) {
	  var P = toPrimitive(V, true);
	  var enumerable = nativePropertyIsEnumerable$1.call(this, P);
	  if (this === ObjectPrototype$1 && has(AllSymbols, P) && !has(ObjectPrototypeSymbols, P)) return false;
	  return enumerable || !has(this, P) || !has(AllSymbols, P) || has(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true;
	};

	var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {
	  var it = toIndexedObject(O);
	  var key = toPrimitive(P, true);
	  if (it === ObjectPrototype$1 && has(AllSymbols, key) && !has(ObjectPrototypeSymbols, key)) return;
	  var descriptor = nativeGetOwnPropertyDescriptor$1(it, key);
	  if (descriptor && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) {
	    descriptor.enumerable = true;
	  }
	  return descriptor;
	};

	var $getOwnPropertyNames = function getOwnPropertyNames(O) {
	  var names = nativeGetOwnPropertyNames$1(toIndexedObject(O));
	  var result = [];
	  $forEach$1(names, function (key) {
	    if (!has(AllSymbols, key) && !has(hiddenKeys, key)) result.push(key);
	  });
	  return result;
	};

	var $getOwnPropertySymbols = function getOwnPropertySymbols(O) {
	  var IS_OBJECT_PROTOTYPE = O === ObjectPrototype$1;
	  var names = nativeGetOwnPropertyNames$1(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));
	  var result = [];
	  $forEach$1(names, function (key) {
	    if (has(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || has(ObjectPrototype$1, key))) {
	      result.push(AllSymbols[key]);
	    }
	  });
	  return result;
	};

	// `Symbol` constructor
	// https://tc39.github.io/ecma262/#sec-symbol-constructor
	if (!nativeSymbol) {
	  $Symbol = function Symbol() {
	    if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor');
	    var description = !arguments.length || arguments[0] === undefined ? undefined : String(arguments[0]);
	    var tag = uid(description);
	    var setter = function (value) {
	      if (this === ObjectPrototype$1) setter.call(ObjectPrototypeSymbols, value);
	      if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
	      setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value));
	    };
	    if (descriptors && USE_SETTER) setSymbolDescriptor(ObjectPrototype$1, tag, { configurable: true, set: setter });
	    return wrap(tag, description);
	  };

	  redefine($Symbol[PROTOTYPE$1], 'toString', function toString() {
	    return getInternalState$2(this).tag;
	  });

	  objectPropertyIsEnumerable.f = $propertyIsEnumerable;
	  objectDefineProperty.f = $defineProperty;
	  objectGetOwnPropertyDescriptor.f = $getOwnPropertyDescriptor;
	  objectGetOwnPropertyNames.f = objectGetOwnPropertyNamesExternal.f = $getOwnPropertyNames;
	  objectGetOwnPropertySymbols.f = $getOwnPropertySymbols;

	  if (descriptors) {
	    // https://github.com/tc39/proposal-Symbol-description
	    nativeDefineProperty$1($Symbol[PROTOTYPE$1], 'description', {
	      configurable: true,
	      get: function description() {
	        return getInternalState$2(this).description;
	      }
	    });
	  }

	  wrappedWellKnownSymbol.f = function (name) {
	    return wrap(wellKnownSymbol(name), name);
	  };
	}

	_export({ global: true, wrap: true, forced: !nativeSymbol, sham: !nativeSymbol }, {
	  Symbol: $Symbol
	});

	$forEach$1(objectKeys(WellKnownSymbolsStore), function (name) {
	  defineWellKnownSymbol(name);
	});

	_export({ target: SYMBOL, stat: true, forced: !nativeSymbol }, {
	  // `Symbol.for` method
	  // https://tc39.github.io/ecma262/#sec-symbol.for
	  'for': function (key) {
	    var string = String(key);
	    if (has(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];
	    var symbol = $Symbol(string);
	    StringToSymbolRegistry[string] = symbol;
	    SymbolToStringRegistry[symbol] = string;
	    return symbol;
	  },
	  // `Symbol.keyFor` method
	  // https://tc39.github.io/ecma262/#sec-symbol.keyfor
	  keyFor: function keyFor(sym) {
	    if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol');
	    if (has(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];
	  },
	  useSetter: function () { USE_SETTER = true; },
	  useSimple: function () { USE_SETTER = false; }
	});

	_export({ target: 'Object', stat: true, forced: !nativeSymbol, sham: !descriptors }, {
	  // `Object.create` method
	  // https://tc39.github.io/ecma262/#sec-object.create
	  create: $create,
	  // `Object.defineProperty` method
	  // https://tc39.github.io/ecma262/#sec-object.defineproperty
	  defineProperty: $defineProperty,
	  // `Object.defineProperties` method
	  // https://tc39.github.io/ecma262/#sec-object.defineproperties
	  defineProperties: $defineProperties,
	  // `Object.getOwnPropertyDescriptor` method
	  // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors
	  getOwnPropertyDescriptor: $getOwnPropertyDescriptor
	});

	_export({ target: 'Object', stat: true, forced: !nativeSymbol }, {
	  // `Object.getOwnPropertyNames` method
	  // https://tc39.github.io/ecma262/#sec-object.getownpropertynames
	  getOwnPropertyNames: $getOwnPropertyNames,
	  // `Object.getOwnPropertySymbols` method
	  // https://tc39.github.io/ecma262/#sec-object.getownpropertysymbols
	  getOwnPropertySymbols: $getOwnPropertySymbols
	});

	// Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
	// https://bugs.chromium.org/p/v8/issues/detail?id=3443
	_export({ target: 'Object', stat: true, forced: fails(function () { objectGetOwnPropertySymbols.f(1); }) }, {
	  getOwnPropertySymbols: function getOwnPropertySymbols(it) {
	    return objectGetOwnPropertySymbols.f(toObject(it));
	  }
	});

	// `JSON.stringify` method behavior with symbols
	// https://tc39.github.io/ecma262/#sec-json.stringify
	if ($stringify) {
	  var FORCED_JSON_STRINGIFY = !nativeSymbol || fails(function () {
	    var symbol = $Symbol();
	    // MS Edge converts symbol values to JSON as {}
	    return $stringify([symbol]) != '[null]'
	      // WebKit converts symbol values to JSON as null
	      || $stringify({ a: symbol }) != '{}'
	      // V8 throws on boxed symbols
	      || $stringify(Object(symbol)) != '{}';
	  });

	  _export({ target: 'JSON', stat: true, forced: FORCED_JSON_STRINGIFY }, {
	    // eslint-disable-next-line no-unused-vars
	    stringify: function stringify(it, replacer, space) {
	      var args = [it];
	      var index = 1;
	      var $replacer;
	      while (arguments.length > index) args.push(arguments[index++]);
	      $replacer = replacer;
	      if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
	      if (!isArray(replacer)) replacer = function (key, value) {
	        if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
	        if (!isSymbol(value)) return value;
	      };
	      args[1] = replacer;
	      return $stringify.apply(null, args);
	    }
	  });
	}

	// `Symbol.prototype[@@toPrimitive]` method
	// https://tc39.github.io/ecma262/#sec-symbol.prototype-@@toprimitive
	if (!$Symbol[PROTOTYPE$1][TO_PRIMITIVE]) {
	  createNonEnumerableProperty($Symbol[PROTOTYPE$1], TO_PRIMITIVE, $Symbol[PROTOTYPE$1].valueOf);
	}
	// `Symbol.prototype[@@toStringTag]` property
	// https://tc39.github.io/ecma262/#sec-symbol.prototype-@@tostringtag
	setToStringTag($Symbol, SYMBOL);

	hiddenKeys[HIDDEN] = true;

	// `Symbol.asyncIterator` well-known symbol
	// https://tc39.github.io/ecma262/#sec-symbol.asynciterator
	defineWellKnownSymbol('asyncIterator');

	// `Symbol.hasInstance` well-known symbol
	// https://tc39.github.io/ecma262/#sec-symbol.hasinstance
	defineWellKnownSymbol('hasInstance');

	// `Symbol.isConcatSpreadable` well-known symbol
	// https://tc39.github.io/ecma262/#sec-symbol.isconcatspreadable
	defineWellKnownSymbol('isConcatSpreadable');

	// `Symbol.iterator` well-known symbol
	// https://tc39.github.io/ecma262/#sec-symbol.iterator
	defineWellKnownSymbol('iterator');

	// `Symbol.match` well-known symbol
	// https://tc39.github.io/ecma262/#sec-symbol.match
	defineWellKnownSymbol('match');

	// `Symbol.matchAll` well-known symbol
	defineWellKnownSymbol('matchAll');

	// `Symbol.replace` well-known symbol
	// https://tc39.github.io/ecma262/#sec-symbol.replace
	defineWellKnownSymbol('replace');

	// `Symbol.search` well-known symbol
	// https://tc39.github.io/ecma262/#sec-symbol.search
	defineWellKnownSymbol('search');

	// `Symbol.species` well-known symbol
	// https://tc39.github.io/ecma262/#sec-symbol.species
	defineWellKnownSymbol('species');

	// `Symbol.split` well-known symbol
	// https://tc39.github.io/ecma262/#sec-symbol.split
	defineWellKnownSymbol('split');

	// `Symbol.toPrimitive` well-known symbol
	// https://tc39.github.io/ecma262/#sec-symbol.toprimitive
	defineWellKnownSymbol('toPrimitive');

	// `Symbol.toStringTag` well-known symbol
	// https://tc39.github.io/ecma262/#sec-symbol.tostringtag
	defineWellKnownSymbol('toStringTag');

	// `Symbol.unscopables` well-known symbol
	// https://tc39.github.io/ecma262/#sec-symbol.unscopables
	defineWellKnownSymbol('unscopables');

	// Math[@@toStringTag] property
	// https://tc39.github.io/ecma262/#sec-math-@@tostringtag
	setToStringTag(Math, 'Math', true);

	// JSON[@@toStringTag] property
	// https://tc39.github.io/ecma262/#sec-json-@@tostringtag
	setToStringTag(global_1.JSON, 'JSON', true);

	var symbol = path.Symbol;

	var symbol$1 = symbol;

	var symbol$2 = symbol$1;

	var getOwnPropertySymbols = path.Object.getOwnPropertySymbols;

	var getOwnPropertySymbols$1 = getOwnPropertySymbols;

	var getOwnPropertySymbols$2 = getOwnPropertySymbols$1;

	var nativeGetOwnPropertyNames$2 = objectGetOwnPropertyNamesExternal.f;

	var FAILS_ON_PRIMITIVES$2 = fails(function () { return !Object.getOwnPropertyNames(1); });

	// `Object.getOwnPropertyNames` method
	// https://tc39.github.io/ecma262/#sec-object.getownpropertynames
	_export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$2 }, {
	  getOwnPropertyNames: nativeGetOwnPropertyNames$2
	});

	var Object$2 = path.Object;

	var getOwnPropertyNames = function getOwnPropertyNames(it) {
	  return Object$2.getOwnPropertyNames(it);
	};

	var getOwnPropertyNames$1 = getOwnPropertyNames;

	var getOwnPropertyNames$2 = getOwnPropertyNames$1;

	var concat = entryVirtual('Array').concat;

	var ArrayPrototype$9 = Array.prototype;

	var concat_1 = function (it) {
	  var own = it.concat;
	  return it === ArrayPrototype$9 || (it instanceof Array && own === ArrayPrototype$9.concat) ? concat : own;
	};

	var concat$1 = concat_1;

	var concat$2 = concat$1;

	// `Object.defineProperties` method
	// https://tc39.github.io/ecma262/#sec-object.defineproperties
	_export({ target: 'Object', stat: true, forced: !descriptors, sham: !descriptors }, {
	  defineProperties: objectDefineProperties
	});

	var defineProperties_1 = createCommonjsModule(function (module) {
	var Object = path.Object;

	var defineProperties = module.exports = function defineProperties(T, D) {
	  return Object.defineProperties(T, D);
	};

	if (Object.defineProperties.sham) defineProperties.sham = true;
	});

	var defineProperties = defineProperties_1;

	var defineProperties$1 = defineProperties;

	var FAILS_ON_PRIMITIVES$3 = fails(function () { objectKeys(1); });

	// `Object.keys` method
	// https://tc39.github.io/ecma262/#sec-object.keys
	_export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$3 }, {
	  keys: function keys(it) {
	    return objectKeys(toObject(it));
	  }
	});

	var keys$4 = path.Object.keys;

	var keys$5 = keys$4;

	var keys$6 = keys$5;

	var $indexOf = arrayIncludes.indexOf;


	var nativeIndexOf = [].indexOf;

	var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0;
	var SLOPPY_METHOD = sloppyArrayMethod('indexOf');

	// `Array.prototype.indexOf` method
	// https://tc39.github.io/ecma262/#sec-array.prototype.indexof
	_export({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || SLOPPY_METHOD }, {
	  indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
	    return NEGATIVE_ZERO
	      // convert -0 to +0
	      ? nativeIndexOf.apply(this, arguments) || 0
	      : $indexOf(this, searchElement, arguments.length > 1 ? arguments[1] : undefined);
	  }
	});

	var indexOf$1 = entryVirtual('Array').indexOf;

	var ArrayPrototype$a = Array.prototype;

	var indexOf_1 = function (it) {
	  var own = it.indexOf;
	  return it === ArrayPrototype$a || (it instanceof Array && own === ArrayPrototype$a.indexOf) ? indexOf$1 : own;
	};

	var indexOf$2 = indexOf_1;

	var indexOf$3 = indexOf$2;

	var nativeGetOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f;


	var FAILS_ON_PRIMITIVES$4 = fails(function () { nativeGetOwnPropertyDescriptor$2(1); });
	var FORCED$2 = !descriptors || FAILS_ON_PRIMITIVES$4;

	// `Object.getOwnPropertyDescriptor` method
	// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
	_export({ target: 'Object', stat: true, forced: FORCED$2, sham: !descriptors }, {
	  getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) {
	    return nativeGetOwnPropertyDescriptor$2(toIndexedObject(it), key);
	  }
	});

	var getOwnPropertyDescriptor_1 = createCommonjsModule(function (module) {
	var Object = path.Object;

	var getOwnPropertyDescriptor = module.exports = function getOwnPropertyDescriptor(it, key) {
	  return Object.getOwnPropertyDescriptor(it, key);
	};

	if (Object.getOwnPropertyDescriptor.sham) getOwnPropertyDescriptor.sham = true;
	});

	var getOwnPropertyDescriptor$2 = getOwnPropertyDescriptor_1;

	var getOwnPropertyDescriptor$3 = getOwnPropertyDescriptor$2;

	// `Object.defineProperty` method
	// https://tc39.github.io/ecma262/#sec-object.defineproperty
	_export({ target: 'Object', stat: true, forced: !descriptors, sham: !descriptors }, {
	  defineProperty: objectDefineProperty.f
	});

	var defineProperty_1 = createCommonjsModule(function (module) {
	var Object = path.Object;

	var defineProperty = module.exports = function defineProperty(it, key, desc) {
	  return Object.defineProperty(it, key, desc);
	};

	if (Object.defineProperty.sham) defineProperty.sham = true;
	});

	var defineProperty$2 = defineProperty_1;

	var defineProperty$3 = defineProperty$2;

	var iterator = wrappedWellKnownSymbol.f('iterator');

	var iterator$1 = iterator;

	var iterator$2 = iterator$1;

	// `Symbol.asyncDispose` well-known symbol
	// https://github.com/tc39/proposal-using-statement
	defineWellKnownSymbol('asyncDispose');

	// `Symbol.dispose` well-known symbol
	// https://github.com/tc39/proposal-using-statement
	defineWellKnownSymbol('dispose');

	// `Symbol.observable` well-known symbol
	// https://github.com/tc39/proposal-observable
	defineWellKnownSymbol('observable');

	// `Symbol.patternMatch` well-known symbol
	// https://github.com/tc39/proposal-pattern-matching
	defineWellKnownSymbol('patternMatch');

	// TODO: remove from `core-js@4`


	defineWellKnownSymbol('replaceAll');

	var symbol$3 = symbol;

	var symbol$4 = symbol$3;

	var _typeof_1 = createCommonjsModule(function (module) {
	function _typeof2(obj) { if (typeof symbol$4 === "function" && typeof iterator$2 === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof symbol$4 === "function" && obj.constructor === symbol$4 && obj !== symbol$4.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); }

	function _typeof(obj) {
	  if (typeof symbol$4 === "function" && _typeof2(iterator$2) === "symbol") {
	    module.exports = _typeof = function _typeof(obj) {
	      return _typeof2(obj);
	    };
	  } else {
	    module.exports = _typeof = function _typeof(obj) {
	      return obj && typeof symbol$4 === "function" && obj.constructor === symbol$4 && obj !== symbol$4.prototype ? "symbol" : _typeof2(obj);
	    };
	  }

	  return _typeof(obj);
	}

	module.exports = _typeof;
	});

	var _context16;

	var commonjsGlobal$1 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};

	function createCommonjsModule$1(fn, module) {
	  return module = {
	    exports: {}
	  }, fn(module, module.exports), module.exports;
	}

	var check$1 = function check(it) {
	  return it && it.Math == Math && it;
	}; // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028


	var global_1$1 = // eslint-disable-next-line no-undef
	check$1((typeof globalThis === "undefined" ? "undefined" : _typeof_1(globalThis)) == 'object' && globalThis) || check$1((typeof window === "undefined" ? "undefined" : _typeof_1(window)) == 'object' && window) || check$1((typeof self === "undefined" ? "undefined" : _typeof_1(self)) == 'object' && self) || check$1(_typeof_1(commonjsGlobal$1) == 'object' && commonjsGlobal$1) || // eslint-disable-next-line no-new-func
	Function('return this')();

	var fails$1 = function fails(exec) {
	  try {
	    return !!exec();
	  } catch (error) {
	    return true;
	  }
	}; // Thank's IE8 for his funny defineProperty


	var descriptors$1 = !fails$1(function () {
	  return defineProperty$3({}, 'a', {
	    get: function get() {
	      return 7;
	    }
	  }).a != 7;
	});
	var nativePropertyIsEnumerable$2 = {}.propertyIsEnumerable;
	var getOwnPropertyDescriptor$4 = getOwnPropertyDescriptor$3; // Nashorn ~ JDK8 bug

	var NASHORN_BUG$1 = getOwnPropertyDescriptor$4 && !nativePropertyIsEnumerable$2.call({
	  1: 2
	}, 1); // `Object.prototype.propertyIsEnumerable` method implementation
	// https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable

	var f$7 = NASHORN_BUG$1 ? function propertyIsEnumerable(V) {
	  var descriptor = getOwnPropertyDescriptor$4(this, V);
	  return !!descriptor && descriptor.enumerable;
	} : nativePropertyIsEnumerable$2;
	var objectPropertyIsEnumerable$1 = {
	  f: f$7
	};

	var createPropertyDescriptor$1 = function createPropertyDescriptor(bitmap, value) {
	  return {
	    enumerable: !(bitmap & 1),
	    configurable: !(bitmap & 2),
	    writable: !(bitmap & 4),
	    value: value
	  };
	};

	var toString$2 = {}.toString;

	var classofRaw$1 = function classofRaw(it) {
	  var _context13;

	  return slice$3(_context13 = toString$2.call(it)).call(_context13, 8, -1);
	};

	var split$1 = ''.split; // fallback for non-array-like ES3 and non-enumerable old V8 strings

	var indexedObject$1 = fails$1(function () {
	  // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
	  // eslint-disable-next-line no-prototype-builtins
	  return !Object('z').propertyIsEnumerable(0);
	}) ? function (it) {
	  return classofRaw$1(it) == 'String' ? split$1.call(it, '') : Object(it);
	} : Object; // `RequireObjectCoercible` abstract operation
	// https://tc39.github.io/ecma262/#sec-requireobjectcoercible

	var requireObjectCoercible$1 = function requireObjectCoercible(it) {
	  if (it == undefined) throw TypeError("Can't call method on " + it);
	  return it;
	}; // toObject with fallback for non-array-like ES3 strings


	var toIndexedObject$1 = function toIndexedObject(it) {
	  return indexedObject$1(requireObjectCoercible$1(it));
	};

	var isObject$1 = function isObject(it) {
	  return _typeof_1(it) === 'object' ? it !== null : typeof it === 'function';
	}; // `ToPrimitive` abstract operation
	// https://tc39.github.io/ecma262/#sec-toprimitive
	// instead of the ES6 spec version, we didn't implement @@toPrimitive case
	// and the second argument - flag - preferred type is a string


	var toPrimitive$1 = function toPrimitive(input, PREFERRED_STRING) {
	  if (!isObject$1(input)) return input;
	  var fn, val;
	  if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject$1(val = fn.call(input))) return val;
	  if (typeof (fn = input.valueOf) == 'function' && !isObject$1(val = fn.call(input))) return val;
	  if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject$1(val = fn.call(input))) return val;
	  throw TypeError("Can't convert object to primitive value");
	};

	var hasOwnProperty$1 = {}.hasOwnProperty;

	var has$2 = function has(it, key) {
	  return hasOwnProperty$1.call(it, key);
	};

	var document$1$1 = global_1$1.document; // typeof document.createElement is 'object' in old IE

	var EXISTS$1 = isObject$1(document$1$1) && isObject$1(document$1$1.createElement);

	var documentCreateElement$1 = function documentCreateElement(it) {
	  return EXISTS$1 ? document$1$1.createElement(it) : {};
	}; // Thank's IE8 for his funny defineProperty


	var ie8DomDefine$1 = !descriptors$1 && !fails$1(function () {
	  return defineProperty$3(documentCreateElement$1('div'), 'a', {
	    get: function get() {
	      return 7;
	    }
	  }).a != 7;
	});
	var nativeGetOwnPropertyDescriptor$3 = getOwnPropertyDescriptor$3; // `Object.getOwnPropertyDescriptor` method
	// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor

	var f$1$1 = descriptors$1 ? nativeGetOwnPropertyDescriptor$3 : function getOwnPropertyDescriptor(O, P) {
	  O = toIndexedObject$1(O);
	  P = toPrimitive$1(P, true);
	  if (ie8DomDefine$1) try {
	    return nativeGetOwnPropertyDescriptor$3(O, P);
	  } catch (error) {
	    /* empty */
	  }
	  if (has$2(O, P)) return createPropertyDescriptor$1(!objectPropertyIsEnumerable$1.f.call(O, P), O[P]);
	};
	var objectGetOwnPropertyDescriptor$1 = {
	  f: f$1$1
	};
	var replacement$1 = /#|\.prototype\./;

	var isForced$1 = function isForced(feature, detection) {
	  var value = data$1[normalize$1(feature)];
	  return value == POLYFILL$1 ? true : value == NATIVE$1 ? false : typeof detection == 'function' ? fails$1(detection) : !!detection;
	};

	var normalize$1 = isForced$1.normalize = function (string) {
	  return String(string).replace(replacement$1, '.').toLowerCase();
	};

	var data$1 = isForced$1.data = {};
	var NATIVE$1 = isForced$1.NATIVE = 'N';
	var POLYFILL$1 = isForced$1.POLYFILL = 'P';
	var isForced_1$1 = isForced$1;
	var path$1 = {};

	var aFunction$2 = function aFunction(it) {
	  if (typeof it != 'function') {
	    throw TypeError(String(it) + ' is not a function');
	  }

	  return it;
	}; // optional / simple context binding


	var bindContext$1 = function bindContext(fn, that, length) {
	  aFunction$2(fn);
	  if (that === undefined) return fn;

	  switch (length) {
	    case 0:
	      return function () {
	        return fn.call(that);
	      };

	    case 1:
	      return function (a) {
	        return fn.call(that, a);
	      };

	    case 2:
	      return function (a, b) {
	        return fn.call(that, a, b);
	      };

	    case 3:
	      return function (a, b, c) {
	        return fn.call(that, a, b, c);
	      };
	  }

	  return function ()
	  /* ...args */
	  {
	    return fn.apply(that, arguments);
	  };
	};

	var anObject$1 = function anObject(it) {
	  if (!isObject$1(it)) {
	    throw TypeError(String(it) + ' is not an object');
	  }

	  return it;
	};

	var nativeDefineProperty$2 = defineProperty$3; // `Object.defineProperty` method
	// https://tc39.github.io/ecma262/#sec-object.defineproperty

	var f$2$1 = descriptors$1 ? nativeDefineProperty$2 : function defineProperty(O, P, Attributes) {
	  anObject$1(O);
	  P = toPrimitive$1(P, true);
	  anObject$1(Attributes);
	  if (ie8DomDefine$1) try {
	    return nativeDefineProperty$2(O, P, Attributes);
	  } catch (error) {
	    /* empty */
	  }
	  if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
	  if ('value' in Attributes) O[P] = Attributes.value;
	  return O;
	};
	var objectDefineProperty$1 = {
	  f: f$2$1
	};
	var createNonEnumerableProperty$1 = descriptors$1 ? function (object, key, value) {
	  return objectDefineProperty$1.f(object, key, createPropertyDescriptor$1(1, value));
	} : function (object, key, value) {
	  object[key] = value;
	  return object;
	};
	var getOwnPropertyDescriptor$1$1 = objectGetOwnPropertyDescriptor$1.f;

	var wrapConstructor$1 = function wrapConstructor(NativeConstructor) {
	  var Wrapper = function Wrapper(a, b, c) {
	    if (this instanceof NativeConstructor) {
	      switch (arguments.length) {
	        case 0:
	          return new NativeConstructor();

	        case 1:
	          return new NativeConstructor(a);

	        case 2:
	          return new NativeConstructor(a, b);
	      }

	      return new NativeConstructor(a, b, c);
	    }

	    return NativeConstructor.apply(this, arguments);
	  };

	  Wrapper.prototype = NativeConstructor.prototype;
	  return Wrapper;
	};
	/*
	  options.target      - name of the target object
	  options.global      - target is the global object
	  options.stat        - export as static methods of target
	  options.proto       - export as prototype methods of target
	  options.real        - real prototype method for the `pure` version
	  options.forced      - export even if the native feature is available
	  options.bind        - bind methods to the target, required for the `pure` version
	  options.wrap        - wrap constructors to preventing global pollution, required for the `pure` version
	  options.unsafe      - use the simple assignment of property instead of delete + defineProperty
	  options.sham        - add a flag to not completely full polyfills
	  options.enumerable  - export as enumerable property
	  options.noTargetGet - prevent calling a getter on target
	*/


	var _export$1 = function _export(options, source) {
	  var TARGET = options.target;
	  var GLOBAL = options.global;
	  var STATIC = options.stat;
	  var PROTO = options.proto;
	  var nativeSource = GLOBAL ? global_1$1 : STATIC ? global_1$1[TARGET] : (global_1$1[TARGET] || {}).prototype;
	  var target = GLOBAL ? path$1 : path$1[TARGET] || (path$1[TARGET] = {});
	  var targetPrototype = target.prototype;
	  var FORCED, USE_NATIVE, VIRTUAL_PROTOTYPE;
	  var key, sourceProperty, targetProperty, nativeProperty, resultProperty, descriptor;

	  for (key in source) {
	    FORCED = isForced_1$1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); // contains in native

	    USE_NATIVE = !FORCED && nativeSource && has$2(nativeSource, key);
	    targetProperty = target[key];
	    if (USE_NATIVE) if (options.noTargetGet) {
	      descriptor = getOwnPropertyDescriptor$1$1(nativeSource, key);
	      nativeProperty = descriptor && descriptor.value;
	    } else nativeProperty = nativeSource[key]; // export native or implementation

	    sourceProperty = USE_NATIVE && nativeProperty ? nativeProperty : source[key];
	    if (USE_NATIVE && _typeof_1(targetProperty) === _typeof_1(sourceProperty)) continue; // bind timers to global for call from export context

	    if (bind$2(options) && USE_NATIVE) resultProperty = bindContext$1(sourceProperty, global_1$1); // wrap global constructors for prevent changs in this version
	    else if (options.wrap && USE_NATIVE) resultProperty = wrapConstructor$1(sourceProperty); // make static versions for prototype methods
	      else if (PROTO && typeof sourceProperty == 'function') resultProperty = bindContext$1(Function.call, sourceProperty); // default case
	        else resultProperty = sourceProperty; // add a flag to not completely full polyfills

	    if (options.sham || sourceProperty && sourceProperty.sham || targetProperty && targetProperty.sham) {
	      createNonEnumerableProperty$1(resultProperty, 'sham', true);
	    }

	    target[key] = resultProperty;

	    if (PROTO) {
	      VIRTUAL_PROTOTYPE = TARGET + 'Prototype';

	      if (!has$2(path$1, VIRTUAL_PROTOTYPE)) {
	        createNonEnumerableProperty$1(path$1, VIRTUAL_PROTOTYPE, {});
	      } // export virtual prototype methods


	      path$1[VIRTUAL_PROTOTYPE][key] = sourceProperty; // export real prototype methods

	      if (options.real && targetPrototype && !targetPrototype[key]) {
	        createNonEnumerableProperty$1(targetPrototype, key, sourceProperty);
	      }
	    }
	  }
	}; // `Object.defineProperty` method
	// https://tc39.github.io/ecma262/#sec-object.defineproperty


	_export$1({
	  target: 'Object',
	  stat: true,
	  forced: !descriptors$1,
	  sham: !descriptors$1
	}, {
	  defineProperty: objectDefineProperty$1.f
	});

	var defineProperty_1$1 = createCommonjsModule$1(function (module) {
	  var Object = path$1.Object;

	  var defineProperty = module.exports = function defineProperty(it, key, desc) {
	    return Object.defineProperty(it, key, desc);
	  };

	  if (Object.defineProperty.sham) defineProperty.sham = true;
	});
	var defineProperty$4 = defineProperty_1$1;
	var defineProperty$1$1 = defineProperty$4;
	var ceil$1 = Math.ceil;
	var floor$1 = Math.floor; // `ToInteger` abstract operation
	// https://tc39.github.io/ecma262/#sec-tointeger

	var toInteger$1 = function toInteger(argument) {
	  return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor$1 : ceil$1)(argument);
	};

	var min$3 = Math.min; // `ToLength` abstract operation
	// https://tc39.github.io/ecma262/#sec-tolength

	var toLength$1 = function toLength(argument) {
	  return argument > 0 ? min$3(toInteger$1(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
	};

	var max$3 = Math.max;
	var min$1$1 = Math.min; // Helper for a popular repeating case of the spec:
	// Let integer be ? ToInteger(index).
	// If integer < 0, let result be max((length + integer), 0); else let result be min(length, length).

	var toAbsoluteIndex$1 = function toAbsoluteIndex(index, length) {
	  var integer = toInteger$1(index);
	  return integer < 0 ? max$3(integer + length, 0) : min$1$1(integer, length);
	}; // `Array.prototype.{ indexOf, includes }` methods implementation


	var createMethod$4 = function createMethod(IS_INCLUDES) {
	  return function ($this, el, fromIndex) {
	    var O = toIndexedObject$1($this);
	    var length = toLength$1(O.length);
	    var index = toAbsoluteIndex$1(fromIndex, length);
	    var value; // Array#includes uses SameValueZero equality algorithm
	    // eslint-disable-next-line no-self-compare

	    if (IS_INCLUDES && el != el) while (length > index) {
	      value = O[index++]; // eslint-disable-next-line no-self-compare

	      if (value != value) return true; // Array#indexOf ignores holes, Array#includes - not
	    } else for (; length > index; index++) {
	      if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
	    }
	    return !IS_INCLUDES && -1;
	  };
	};

	var arrayIncludes$1 = {
	  // `Array.prototype.includes` method
	  // https://tc39.github.io/ecma262/#sec-array.prototype.includes
	  includes: createMethod$4(true),
	  // `Array.prototype.indexOf` method
	  // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
	  indexOf: createMethod$4(false)
	};
	var hiddenKeys$2 = {};

	var indexOf$4 = indexOf$3(arrayIncludes$1);

	var objectKeysInternal$1 = function objectKeysInternal(object, names) {
	  var O = toIndexedObject$1(object);
	  var i = 0;
	  var result = [];
	  var key;

	  for (key in O) {
	    !has$2(hiddenKeys$2, key) && has$2(O, key) && result.push(key);
	  } // Don't enum bug & hidden keys


	  while (names.length > i) {
	    if (has$2(O, key = names[i++])) {
	      ~indexOf$4(result, key) || result.push(key);
	    }
	  }

	  return result;
	}; // IE8- don't enum bug keys


	var enumBugKeys$1 = ['constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf']; // `Object.keys` method
	// https://tc39.github.io/ecma262/#sec-object.keys

	var objectKeys$1 = keys$6 || function keys(O) {
	  return objectKeysInternal$1(O, enumBugKeys$1);
	}; // `Object.defineProperties` method
	// https://tc39.github.io/ecma262/#sec-object.defineproperties


	var objectDefineProperties$1 = descriptors$1 ? defineProperties$1 : function defineProperties(O, Properties) {
	  anObject$1(O);
	  var keys = objectKeys$1(Properties);
	  var length = keys.length;
	  var index = 0;
	  var key;

	  while (length > index) {
	    objectDefineProperty$1.f(O, key = keys[index++], Properties[key]);
	  }

	  return O;
	}; // `Object.defineProperties` method
	// https://tc39.github.io/ecma262/#sec-object.defineproperties

	_export$1({
	  target: 'Object',
	  stat: true,
	  forced: !descriptors$1,
	  sham: !descriptors$1
	}, {
	  defineProperties: objectDefineProperties$1
	});

	var defineProperties_1$1 = createCommonjsModule$1(function (module) {
	  var Object = path$1.Object;

	  var defineProperties = module.exports = function defineProperties(T, D) {
	    return Object.defineProperties(T, D);
	  };

	  if (Object.defineProperties.sham) defineProperties.sham = true;
	});
	var defineProperties$2 = defineProperties_1$1;
	var defineProperties$1$1 = defineProperties$2;

	var aFunction$1$1 = function aFunction$1(variable) {
	  return typeof variable == 'function' ? variable : undefined;
	};

	var getBuiltIn$1 = function getBuiltIn(namespace, method) {
	  return arguments.length < 2 ? aFunction$1$1(path$1[namespace]) || aFunction$1$1(global_1$1[namespace]) : path$1[namespace] && path$1[namespace][method] || global_1$1[namespace] && global_1$1[namespace][method];
	};

	var hiddenKeys$1$1 = concat$2(enumBugKeys$1).call(enumBugKeys$1, 'length', 'prototype'); // `Object.getOwnPropertyNames` method
	// https://tc39.github.io/ecma262/#sec-object.getownpropertynames


	var f$3$1 = getOwnPropertyNames$2 || function getOwnPropertyNames(O) {
	  return objectKeysInternal$1(O, hiddenKeys$1$1);
	};

	var objectGetOwnPropertyNames$1 = {
	  f: f$3$1
	};
	var f$4$1 = getOwnPropertySymbols$2;
	var objectGetOwnPropertySymbols$1 = {
	  f: f$4$1
	}; // all object keys, includes non-enumerable and symbols

	var ownKeys = getBuiltIn$1('Reflect', 'ownKeys') || function ownKeys(it) {
	  var keys = objectGetOwnPropertyNames$1.f(anObject$1(it));
	  var getOwnPropertySymbols = objectGetOwnPropertySymbols$1.f;
	  return getOwnPropertySymbols ? concat$2(keys).call(keys, getOwnPropertySymbols(it)) : keys;
	};

	var createProperty$1 = function createProperty(object, key, value) {
	  var propertyKey = toPrimitive$1(key);
	  if (propertyKey in object) objectDefineProperty$1.f(object, propertyKey, createPropertyDescriptor$1(0, value));else object[propertyKey] = value;
	}; // `Object.getOwnPropertyDescriptors` method
	// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors


	_export$1({
	  target: 'Object',
	  stat: true,
	  sham: !descriptors$1
	}, {
	  getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) {
	    var O = toIndexedObject$1(object);
	    var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor$1.f;
	    var keys = ownKeys(O);
	    var result = {};
	    var index = 0;
	    var key, descriptor;

	    while (keys.length > index) {
	      descriptor = getOwnPropertyDescriptor(O, key = keys[index++]);
	      if (descriptor !== undefined) createProperty$1(result, key, descriptor);
	    }

	    return result;
	  }
	});

	var getOwnPropertyDescriptors = path$1.Object.getOwnPropertyDescriptors;
	var getOwnPropertyDescriptors$1 = getOwnPropertyDescriptors;
	var getOwnPropertyDescriptors$2 = getOwnPropertyDescriptors$1;
	var nativeGetOwnPropertyDescriptor$1$1 = objectGetOwnPropertyDescriptor$1.f;
	var FAILS_ON_PRIMITIVES$5 = fails$1(function () {
	  nativeGetOwnPropertyDescriptor$1$1(1);
	});
	var FORCED$3 = !descriptors$1 || FAILS_ON_PRIMITIVES$5; // `Object.getOwnPropertyDescriptor` method
	// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor

	_export$1({
	  target: 'Object',
	  stat: true,
	  forced: FORCED$3,
	  sham: !descriptors$1
	}, {
	  getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) {
	    return nativeGetOwnPropertyDescriptor$1$1(toIndexedObject$1(it), key);
	  }
	});

	var getOwnPropertyDescriptor_1$1 = createCommonjsModule$1(function (module) {
	  var Object = path$1.Object;

	  var getOwnPropertyDescriptor = module.exports = function getOwnPropertyDescriptor(it, key) {
	    return Object.getOwnPropertyDescriptor(it, key);
	  };

	  if (Object.getOwnPropertyDescriptor.sham) getOwnPropertyDescriptor.sham = true;
	});
	var getOwnPropertyDescriptor$2$1 = getOwnPropertyDescriptor_1$1;
	var getOwnPropertyDescriptor$3$1 = getOwnPropertyDescriptor$2$1;
	var nativeSymbol$1 = !!getOwnPropertySymbols$2 && !fails$1(function () {
	  // Chrome 38 Symbol has incorrect toString conversion
	  // eslint-disable-next-line no-undef
	  return !String(symbol$2());
	}); // `IsArray` abstract operation
	// https://tc39.github.io/ecma262/#sec-isarray

	var isArray$4 = isArray$3 || function isArray(arg) {
	  return classofRaw$1(arg) == 'Array';
	}; // `ToObject` abstract operation
	// https://tc39.github.io/ecma262/#sec-toobject


	var toObject$1 = function toObject(argument) {
	  return Object(requireObjectCoercible$1(argument));
	};

	var html$1 = getBuiltIn$1('document', 'documentElement');

	var setGlobal$1 = function setGlobal(key, value) {
	  try {
	    createNonEnumerableProperty$1(global_1$1, key, value);
	  } catch (error) {
	    global_1$1[key] = value;
	  }

	  return value;
	};

	var SHARED$1 = '__core-js_shared__';
	var store$3 = global_1$1[SHARED$1] || setGlobal$1(SHARED$1, {});
	var sharedStore$1 = store$3;
	var shared$1 = createCommonjsModule$1(function (module) {
	  (module.exports = function (key, value) {
	    return sharedStore$1[key] || (sharedStore$1[key] = value !== undefined ? value : {});
	  })('versions', []).push({
	    version: '3.4.1',
	    mode: 'pure',
	    copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
	  });
	});
	var id$1 = 0;
	var postfix$1 = Math.random();

	var uid$1 = function uid(key) {
	  return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id$1 + postfix$1).toString(36);
	};

	var keys$7 = shared$1('keys');

	var sharedKey$1 = function sharedKey(key) {
	  return keys$7[key] || (keys$7[key] = uid$1(key));
	};

	var IE_PROTO$2 = sharedKey$1('IE_PROTO');
	var PROTOTYPE$2 = 'prototype';

	var Empty$1 = function Empty() {
	  /* empty */
	}; // Create object with fake `null` prototype: use iframe Object with cleared prototype


	var _createDict = function createDict() {
	  // Thrash, waste and sodomy: IE GC bug
	  var iframe = documentCreateElement$1('iframe');
	  var length = enumBugKeys$1.length;
	  var lt = '<';
	  var script = 'script';
	  var gt = '>';
	  var js = 'java' + script + ':';
	  var iframeDocument;
	  iframe.style.display = 'none';
	  html$1.appendChild(iframe);
	  iframe.src = String(js);
	  iframeDocument = iframe.contentWindow.document;
	  iframeDocument.open();
	  iframeDocument.write(lt + script + gt + 'document.F=Object' + lt + '/' + script + gt);
	  iframeDocument.close();
	  _createDict = iframeDocument.F;

	  while (length--) {
	    delete _createDict[PROTOTYPE$2][enumBugKeys$1[length]];
	  }

	  return _createDict();
	}; // `Object.create` method
	// https://tc39.github.io/ecma262/#sec-object.create


	var objectCreate$1 = create$2 || function create(O, Properties) {
	  var result;

	  if (O !== null) {
	    Empty$1[PROTOTYPE$2] = anObject$1(O);
	    result = new Empty$1();
	    Empty$1[PROTOTYPE$2] = null; // add "__proto__" for Object.getPrototypeOf polyfill

	    result[IE_PROTO$2] = O;
	  } else result = _createDict();

	  return Properties === undefined ? result : objectDefineProperties$1(result, Properties);
	};

	hiddenKeys$2[IE_PROTO$2] = true;
	var nativeGetOwnPropertyNames$3 = objectGetOwnPropertyNames$1.f;
	var toString$1$1 = {}.toString;
	var windowNames$1 = (typeof window === "undefined" ? "undefined" : _typeof_1(window)) == 'object' && window && getOwnPropertyNames$2 ? getOwnPropertyNames$2(window) : [];

	var getWindowNames$1 = function getWindowNames(it) {
	  try {
	    return nativeGetOwnPropertyNames$3(it);
	  } catch (error) {
	    return slice$3(windowNames$1).call(windowNames$1);
	  }
	}; // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window


	var f$5$1 = function getOwnPropertyNames(it) {
	  return windowNames$1 && toString$1$1.call(it) == '[object Window]' ? getWindowNames$1(it) : nativeGetOwnPropertyNames$3(toIndexedObject$1(it));
	};

	var objectGetOwnPropertyNamesExternal$1 = {
	  f: f$5$1
	};

	var redefine$1 = function redefine(target, key, value, options) {
	  if (options && options.enumerable) target[key] = value;else createNonEnumerableProperty$1(target, key, value);
	};

	var Symbol$1$1 = global_1$1.Symbol;
	var store$1$1 = shared$1('wks');

	var wellKnownSymbol$1 = function wellKnownSymbol(name) {
	  return store$1$1[name] || (store$1$1[name] = nativeSymbol$1 && Symbol$1$1[name] || (nativeSymbol$1 ? Symbol$1$1 : uid$1)('Symbol.' + name));
	};

	var f$6$1 = wellKnownSymbol$1;
	var wrappedWellKnownSymbol$1 = {
	  f: f$6$1
	};
	var defineProperty$2$1 = objectDefineProperty$1.f;

	var defineWellKnownSymbol$1 = function defineWellKnownSymbol(NAME) {
	  var _Symbol2 = path$1.Symbol || (path$1.Symbol = {});

	  if (!has$2(_Symbol2, NAME)) defineProperty$2$1(_Symbol2, NAME, {
	    value: wrappedWellKnownSymbol$1.f(NAME)
	  });
	};

	var TO_STRING_TAG$4 = wellKnownSymbol$1('toStringTag'); // ES3 wrong here

	var CORRECT_ARGUMENTS$1 = classofRaw$1(function () {
	  return arguments;
	}()) == 'Arguments'; // fallback for IE11 Script Access Denied error

	var tryGet$1 = function tryGet(it, key) {
	  try {
	    return it[key];
	  } catch (error) {
	    /* empty */
	  }
	}; // getting tag from ES6+ `Object.prototype.toString`


	var classof$1 = function classof(it) {
	  var O, tag, result;
	  return it === undefined ? 'Undefined' : it === null ? 'Null' // @@toStringTag case
	  : typeof (tag = tryGet$1(O = Object(it), TO_STRING_TAG$4)) == 'string' ? tag // builtinTag case
	  : CORRECT_ARGUMENTS$1 ? classofRaw$1(O) // ES3 arguments fallback
	  : (result = classofRaw$1(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
	};

	var TO_STRING_TAG$1$1 = wellKnownSymbol$1('toStringTag');
	var test$1 = {};
	test$1[TO_STRING_TAG$1$1] = 'z'; // `Object.prototype.toString` method implementation
	// https://tc39.github.io/ecma262/#sec-object.prototype.tostring

	var objectToString$1 = String(test$1) !== '[object z]' ? function toString() {
	  return '[object ' + classof$1(this) + ']';
	} : test$1.toString;
	var defineProperty$3$1 = objectDefineProperty$1.f;
	var TO_STRING_TAG$2$1 = wellKnownSymbol$1('toStringTag');
	var METHOD_REQUIRED$1 = objectToString$1 !== {}.toString;

	var setToStringTag$1 = function setToStringTag(it, TAG, STATIC, SET_METHOD) {
	  if (it) {
	    var target = STATIC ? it : it.prototype;

	    if (!has$2(target, TO_STRING_TAG$2$1)) {
	      defineProperty$3$1(target, TO_STRING_TAG$2$1, {
	        configurable: true,
	        value: TAG
	      });
	    }

	    if (SET_METHOD && METHOD_REQUIRED$1) {
	      createNonEnumerableProperty$1(target, 'toString', objectToString$1);
	    }
	  }
	};

	var functionToString$1 = shared$1('native-function-to-string', Function.toString);
	var WeakMap$2 = global_1$1.WeakMap;
	var nativeWeakMap$1 = typeof WeakMap$2 === 'function' && /native code/.test(functionToString$1.call(WeakMap$2));
	var WeakMap$1$1 = global_1$1.WeakMap;
	var set$1, get$1, has$1$1;

	var enforce$1 = function enforce(it) {
	  return has$1$1(it) ? get$1(it) : set$1(it, {});
	};

	var getterFor$1 = function getterFor(TYPE) {
	  return function (it) {
	    var state;

	    if (!isObject$1(it) || (state = get$1(it)).type !== TYPE) {
	      throw TypeError('Incompatible receiver, ' + TYPE + ' required');
	    }

	    return state;
	  };
	};

	if (nativeWeakMap$1) {
	  var store$2$1 = new WeakMap$1$1();
	  var wmget$1 = store$2$1.get;
	  var wmhas$1 = store$2$1.has;
	  var wmset$1 = store$2$1.set;

	  set$1 = function set(it, metadata) {
	    wmset$1.call(store$2$1, it, metadata);
	    return metadata;
	  };

	  get$1 = function get(it) {
	    return wmget$1.call(store$2$1, it) || {};
	  };

	  has$1$1 = function has$1(it) {
	    return wmhas$1.call(store$2$1, it);
	  };
	} else {
	  var STATE$1 = sharedKey$1('state');
	  hiddenKeys$2[STATE$1] = true;

	  set$1 = function set(it, metadata) {
	    createNonEnumerableProperty$1(it, STATE$1, metadata);
	    return metadata;
	  };

	  get$1 = function get(it) {
	    return has$2(it, STATE$1) ? it[STATE$1] : {};
	  };

	  has$1$1 = function has$1(it) {
	    return has$2(it, STATE$1);
	  };
	}

	var internalState$1 = {
	  set: set$1,
	  get: get$1,
	  has: has$1$1,
	  enforce: enforce$1,
	  getterFor: getterFor$1
	};
	var SPECIES$3 = wellKnownSymbol$1('species'); // `ArraySpeciesCreate` abstract operation
	// https://tc39.github.io/ecma262/#sec-arrayspeciescreate

	var arraySpeciesCreate$1 = function arraySpeciesCreate(originalArray, length) {
	  var C;

	  if (isArray$4(originalArray)) {
	    C = originalArray.constructor; // cross-realm fallback

	    if (typeof C == 'function' && (C === Array || isArray$4(C.prototype))) C = undefined;else if (isObject$1(C)) {
	      C = C[SPECIES$3];
	      if (C === null) C = undefined;
	    }
	  }

	  return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
	};

	var push$1 = [].push; // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation

	var createMethod$1$1 = function createMethod$1(TYPE) {
	  var IS_MAP = TYPE == 1;
	  var IS_FILTER = TYPE == 2;
	  var IS_SOME = TYPE == 3;
	  var IS_EVERY = TYPE == 4;
	  var IS_FIND_INDEX = TYPE == 6;
	  var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
	  return function ($this, callbackfn, that, specificCreate) {
	    var O = toObject$1($this);
	    var self = indexedObject$1(O);
	    var boundFunction = bindContext$1(callbackfn, that, 3);
	    var length = toLength$1(self.length);
	    var index = 0;
	    var create = specificCreate || arraySpeciesCreate$1;
	    var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
	    var value, result;

	    for (; length > index; index++) {
	      if (NO_HOLES || index in self) {
	        value = self[index];
	        result = boundFunction(value, index, O);

	        if (TYPE) {
	          if (IS_MAP) target[index] = result; // map
	          else if (result) switch (TYPE) {
	              case 3:
	                return true;
	              // some

	              case 5:
	                return value;
	              // find

	              case 6:
	                return index;
	              // findIndex

	              case 2:
	                push$1.call(target, value);
	              // filter
	            } else if (IS_EVERY) return false; // every
	        }
	      }
	    }

	    return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
	  };
	};

	var arrayIteration$1 = {
	  // `Array.prototype.forEach` method
	  // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
	  forEach: createMethod$1$1(0),
	  // `Array.prototype.map` method
	  // https://tc39.github.io/ecma262/#sec-array.prototype.map
	  map: createMethod$1$1(1),
	  // `Array.prototype.filter` method
	  // https://tc39.github.io/ecma262/#sec-array.prototype.filter
	  filter: createMethod$1$1(2),
	  // `Array.prototype.some` method
	  // https://tc39.github.io/ecma262/#sec-array.prototype.some
	  some: createMethod$1$1(3),
	  // `Array.prototype.every` method
	  // https://tc39.github.io/ecma262/#sec-array.prototype.every
	  every: createMethod$1$1(4),
	  // `Array.prototype.find` method
	  // https://tc39.github.io/ecma262/#sec-array.prototype.find
	  find: createMethod$1$1(5),
	  // `Array.prototype.findIndex` method
	  // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex
	  findIndex: createMethod$1$1(6)
	};

	var $forEach$2 = forEach$2(arrayIteration$1);

	var HIDDEN$1 = sharedKey$1('hidden');
	var SYMBOL$1 = 'Symbol';
	var PROTOTYPE$1$1 = 'prototype';
	var TO_PRIMITIVE$1 = wellKnownSymbol$1('toPrimitive');
	var setInternalState$3 = internalState$1.set;
	var getInternalState$3 = internalState$1.getterFor(SYMBOL$1);
	var ObjectPrototype$2 = Object[PROTOTYPE$1$1];
	var $Symbol$1 = global_1$1.Symbol;
	var $stringify$1 = getBuiltIn$1('JSON', 'stringify');
	var nativeGetOwnPropertyDescriptor$2$1 = objectGetOwnPropertyDescriptor$1.f;
	var nativeDefineProperty$1$1 = objectDefineProperty$1.f;
	var nativeGetOwnPropertyNames$1$1 = objectGetOwnPropertyNamesExternal$1.f;
	var nativePropertyIsEnumerable$1$1 = objectPropertyIsEnumerable$1.f;
	var AllSymbols$1 = shared$1('symbols');
	var ObjectPrototypeSymbols$1 = shared$1('op-symbols');
	var StringToSymbolRegistry$1 = shared$1('string-to-symbol-registry');
	var SymbolToStringRegistry$1 = shared$1('symbol-to-string-registry');
	var WellKnownSymbolsStore$1 = shared$1('wks');
	var QObject$1 = global_1$1.QObject; // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173

	var USE_SETTER$1 = !QObject$1 || !QObject$1[PROTOTYPE$1$1] || !QObject$1[PROTOTYPE$1$1].findChild; // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687

	var setSymbolDescriptor$1 = descriptors$1 && fails$1(function () {
	  return objectCreate$1(nativeDefineProperty$1$1({}, 'a', {
	    get: function get() {
	      return nativeDefineProperty$1$1(this, 'a', {
	        value: 7
	      }).a;
	    }
	  })).a != 7;
	}) ? function (O, P, Attributes) {
	  var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor$2$1(ObjectPrototype$2, P);
	  if (ObjectPrototypeDescriptor) delete ObjectPrototype$2[P];
	  nativeDefineProperty$1$1(O, P, Attributes);

	  if (ObjectPrototypeDescriptor && O !== ObjectPrototype$2) {
	    nativeDefineProperty$1$1(ObjectPrototype$2, P, ObjectPrototypeDescriptor);
	  }
	} : nativeDefineProperty$1$1;

	var wrap$1 = function wrap(tag, description) {
	  var symbol = AllSymbols$1[tag] = objectCreate$1($Symbol$1[PROTOTYPE$1$1]);
	  setInternalState$3(symbol, {
	    type: SYMBOL$1,
	    tag: tag,
	    description: description
	  });
	  if (!descriptors$1) symbol.description = description;
	  return symbol;
	};

	var isSymbol$1 = nativeSymbol$1 && _typeof_1($Symbol$1.iterator) == 'symbol' ? function (it) {
	  return _typeof_1(it) == 'symbol';
	} : function (it) {
	  return Object(it) instanceof $Symbol$1;
	};

	var $defineProperty$1 = function defineProperty(O, P, Attributes) {
	  if (O === ObjectPrototype$2) $defineProperty$1(ObjectPrototypeSymbols$1, P, Attributes);
	  anObject$1(O);
	  var key = toPrimitive$1(P, true);
	  anObject$1(Attributes);

	  if (has$2(AllSymbols$1, key)) {
	    if (!Attributes.enumerable) {
	      if (!has$2(O, HIDDEN$1)) nativeDefineProperty$1$1(O, HIDDEN$1, createPropertyDescriptor$1(1, {}));
	      O[HIDDEN$1][key] = true;
	    } else {
	      if (has$2(O, HIDDEN$1) && O[HIDDEN$1][key]) O[HIDDEN$1][key] = false;
	      Attributes = objectCreate$1(Attributes, {
	        enumerable: createPropertyDescriptor$1(0, false)
	      });
	    }

	    return setSymbolDescriptor$1(O, key, Attributes);
	  }

	  return nativeDefineProperty$1$1(O, key, Attributes);
	};

	var $defineProperties$1 = function defineProperties(O, Properties) {
	  var _context14;

	  anObject$1(O);
	  var properties = toIndexedObject$1(Properties);

	  var keys = concat$2(_context14 = objectKeys$1(properties)).call(_context14, $getOwnPropertySymbols$1(properties));

	  $forEach$2(keys, function (key) {
	    if (!descriptors$1 || $propertyIsEnumerable$1.call(properties, key)) $defineProperty$1(O, key, properties[key]);
	  });
	  return O;
	};

	var $create$1 = function create(O, Properties) {
	  return Properties === undefined ? objectCreate$1(O) : $defineProperties$1(objectCreate$1(O), Properties);
	};

	var $propertyIsEnumerable$1 = function propertyIsEnumerable(V) {
	  var P = toPrimitive$1(V, true);
	  var enumerable = nativePropertyIsEnumerable$1$1.call(this, P);
	  if (this === ObjectPrototype$2 && has$2(AllSymbols$1, P) && !has$2(ObjectPrototypeSymbols$1, P)) return false;
	  return enumerable || !has$2(this, P) || !has$2(AllSymbols$1, P) || has$2(this, HIDDEN$1) && this[HIDDEN$1][P] ? enumerable : true;
	};

	var $getOwnPropertyDescriptor$1 = function getOwnPropertyDescriptor(O, P) {
	  var it = toIndexedObject$1(O);
	  var key = toPrimitive$1(P, true);
	  if (it === ObjectPrototype$2 && has$2(AllSymbols$1, key) && !has$2(ObjectPrototypeSymbols$1, key)) return;
	  var descriptor = nativeGetOwnPropertyDescriptor$2$1(it, key);

	  if (descriptor && has$2(AllSymbols$1, key) && !(has$2(it, HIDDEN$1) && it[HIDDEN$1][key])) {
	    descriptor.enumerable = true;
	  }

	  return descriptor;
	};

	var $getOwnPropertyNames$1 = function getOwnPropertyNames(O) {
	  var names = nativeGetOwnPropertyNames$1$1(toIndexedObject$1(O));
	  var result = [];
	  $forEach$2(names, function (key) {
	    if (!has$2(AllSymbols$1, key) && !has$2(hiddenKeys$2, key)) result.push(key);
	  });
	  return result;
	};

	var $getOwnPropertySymbols$1 = function getOwnPropertySymbols(O) {
	  var IS_OBJECT_PROTOTYPE = O === ObjectPrototype$2;
	  var names = nativeGetOwnPropertyNames$1$1(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols$1 : toIndexedObject$1(O));
	  var result = [];
	  $forEach$2(names, function (key) {
	    if (has$2(AllSymbols$1, key) && (!IS_OBJECT_PROTOTYPE || has$2(ObjectPrototype$2, key))) {
	      result.push(AllSymbols$1[key]);
	    }
	  });
	  return result;
	}; // `Symbol` constructor
	// https://tc39.github.io/ecma262/#sec-symbol-constructor


	if (!nativeSymbol$1) {
	  $Symbol$1 = function _Symbol3() {
	    if (this instanceof $Symbol$1) throw TypeError('Symbol is not a constructor');
	    var description = !arguments.length || arguments[0] === undefined ? undefined : String(arguments[0]);
	    var tag = uid$1(description);

	    var setter = function setter(value) {
	      if (this === ObjectPrototype$2) setter.call(ObjectPrototypeSymbols$1, value);
	      if (has$2(this, HIDDEN$1) && has$2(this[HIDDEN$1], tag)) this[HIDDEN$1][tag] = false;
	      setSymbolDescriptor$1(this, tag, createPropertyDescriptor$1(1, value));
	    };

	    if (descriptors$1 && USE_SETTER$1) setSymbolDescriptor$1(ObjectPrototype$2, tag, {
	      configurable: true,
	      set: setter
	    });
	    return wrap$1(tag, description);
	  };

	  redefine$1($Symbol$1[PROTOTYPE$1$1], 'toString', function toString() {
	    return getInternalState$3(this).tag;
	  });
	  objectPropertyIsEnumerable$1.f = $propertyIsEnumerable$1;
	  objectDefineProperty$1.f = $defineProperty$1;
	  objectGetOwnPropertyDescriptor$1.f = $getOwnPropertyDescriptor$1;
	  objectGetOwnPropertyNames$1.f = objectGetOwnPropertyNamesExternal$1.f = $getOwnPropertyNames$1;
	  objectGetOwnPropertySymbols$1.f = $getOwnPropertySymbols$1;

	  if (descriptors$1) {
	    // https://github.com/tc39/proposal-Symbol-description
	    nativeDefineProperty$1$1($Symbol$1[PROTOTYPE$1$1], 'description', {
	      configurable: true,
	      get: function description() {
	        return getInternalState$3(this).description;
	      }
	    });
	  }

	  wrappedWellKnownSymbol$1.f = function (name) {
	    return wrap$1(wellKnownSymbol$1(name), name);
	  };
	}

	_export$1({
	  global: true,
	  wrap: true,
	  forced: !nativeSymbol$1,
	  sham: !nativeSymbol$1
	}, {
	  Symbol: $Symbol$1
	});

	$forEach$2(objectKeys$1(WellKnownSymbolsStore$1), function (name) {
	  defineWellKnownSymbol$1(name);
	});

	_export$1({
	  target: SYMBOL$1,
	  stat: true,
	  forced: !nativeSymbol$1
	}, {
	  // `Symbol.for` method
	  // https://tc39.github.io/ecma262/#sec-symbol.for
	  'for': function _for(key) {
	    var string = String(key);
	    if (has$2(StringToSymbolRegistry$1, string)) return StringToSymbolRegistry$1[string];
	    var symbol = $Symbol$1(string);
	    StringToSymbolRegistry$1[string] = symbol;
	    SymbolToStringRegistry$1[symbol] = string;
	    return symbol;
	  },
	  // `Symbol.keyFor` method
	  // https://tc39.github.io/ecma262/#sec-symbol.keyfor
	  keyFor: function keyFor(sym) {
	    if (!isSymbol$1(sym)) throw TypeError(sym + ' is not a symbol');
	    if (has$2(SymbolToStringRegistry$1, sym)) return SymbolToStringRegistry$1[sym];
	  },
	  useSetter: function useSetter() {
	    USE_SETTER$1 = true;
	  },
	  useSimple: function useSimple() {
	    USE_SETTER$1 = false;
	  }
	});

	_export$1({
	  target: 'Object',
	  stat: true,
	  forced: !nativeSymbol$1,
	  sham: !descriptors$1
	}, {
	  // `Object.create` method
	  // https://tc39.github.io/ecma262/#sec-object.create
	  create: $create$1,
	  // `Object.defineProperty` method
	  // https://tc39.github.io/ecma262/#sec-object.defineproperty
	  defineProperty: $defineProperty$1,
	  // `Object.defineProperties` method
	  // https://tc39.github.io/ecma262/#sec-object.defineproperties
	  defineProperties: $defineProperties$1,
	  // `Object.getOwnPropertyDescriptor` method
	  // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors
	  getOwnPropertyDescriptor: $getOwnPropertyDescriptor$1
	});

	_export$1({
	  target: 'Object',
	  stat: true,
	  forced: !nativeSymbol$1
	}, {
	  // `Object.getOwnPropertyNames` method
	  // https://tc39.github.io/ecma262/#sec-object.getownpropertynames
	  getOwnPropertyNames: $getOwnPropertyNames$1,
	  // `Object.getOwnPropertySymbols` method
	  // https://tc39.github.io/ecma262/#sec-object.getownpropertysymbols
	  getOwnPropertySymbols: $getOwnPropertySymbols$1
	}); // Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
	// https://bugs.chromium.org/p/v8/issues/detail?id=3443


	_export$1({
	  target: 'Object',
	  stat: true,
	  forced: fails$1(function () {
	    objectGetOwnPropertySymbols$1.f(1);
	  })
	}, {
	  getOwnPropertySymbols: function getOwnPropertySymbols(it) {
	    return objectGetOwnPropertySymbols$1.f(toObject$1(it));
	  }
	}); // `JSON.stringify` method behavior with symbols
	// https://tc39.github.io/ecma262/#sec-json.stringify


	if ($stringify$1) {
	  var FORCED_JSON_STRINGIFY$1 = !nativeSymbol$1 || fails$1(function () {
	    var symbol = $Symbol$1(); // MS Edge converts symbol values to JSON as {}

	    return $stringify$1([symbol]) != '[null]' // WebKit converts symbol values to JSON as null
	    || $stringify$1({
	      a: symbol
	    }) != '{}' // V8 throws on boxed symbols
	    || $stringify$1(Object(symbol)) != '{}';
	  });

	  _export$1({
	    target: 'JSON',
	    stat: true,
	    forced: FORCED_JSON_STRINGIFY$1
	  }, {
	    // eslint-disable-next-line no-unused-vars
	    stringify: function stringify(it, replacer, space) {
	      var args = [it];
	      var index = 1;
	      var $replacer;

	      while (arguments.length > index) {
	        args.push(arguments[index++]);
	      }

	      $replacer = replacer;
	      if (!isObject$1(replacer) && it === undefined || isSymbol$1(it)) return; // IE8 returns string on undefined

	      if (!isArray$4(replacer)) replacer = function replacer(key, value) {
	        if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
	        if (!isSymbol$1(value)) return value;
	      };
	      args[1] = replacer;
	      return $stringify$1.apply(null, args);
	    }
	  });
	} // `Symbol.prototype[@@toPrimitive]` method
	// https://tc39.github.io/ecma262/#sec-symbol.prototype-@@toprimitive


	if (!$Symbol$1[PROTOTYPE$1$1][TO_PRIMITIVE$1]) {
	  createNonEnumerableProperty$1($Symbol$1[PROTOTYPE$1$1], TO_PRIMITIVE$1, $Symbol$1[PROTOTYPE$1$1].valueOf);
	} // `Symbol.prototype[@@toStringTag]` property
	// https://tc39.github.io/ecma262/#sec-symbol.prototype-@@tostringtag


	setToStringTag$1($Symbol$1, SYMBOL$1);
	hiddenKeys$2[HIDDEN$1] = true;
	var getOwnPropertySymbols$3 = path$1.Object.getOwnPropertySymbols;
	var getOwnPropertySymbols$1$1 = getOwnPropertySymbols$3;
	var getOwnPropertySymbols$2$1 = getOwnPropertySymbols$1$1;
	var iterators$1 = {};
	var correctPrototypeGetter$1 = !fails$1(function () {
	  function F() {
	    /* empty */
	  }

	  F.prototype.constructor = null;
	  return getPrototypeOf$2(new F()) !== F.prototype;
	});
	var IE_PROTO$1$1 = sharedKey$1('IE_PROTO');
	var ObjectPrototype$1$1 = Object.prototype; // `Object.getPrototypeOf` method
	// https://tc39.github.io/ecma262/#sec-object.getprototypeof

	var objectGetPrototypeOf$1 = correctPrototypeGetter$1 ? getPrototypeOf$2 : function (O) {
	  O = toObject$1(O);
	  if (has$2(O, IE_PROTO$1$1)) return O[IE_PROTO$1$1];

	  if (typeof O.constructor == 'function' && O instanceof O.constructor) {
	    return O.constructor.prototype;
	  }

	  return O instanceof Object ? ObjectPrototype$1$1 : null;
	};
	var ITERATOR$5 = wellKnownSymbol$1('iterator');
	var BUGGY_SAFARI_ITERATORS$2 = false; // `%IteratorPrototype%` object
	// https://tc39.github.io/ecma262/#sec-%iteratorprototype%-object

	var IteratorPrototype$3, PrototypeOfArrayIteratorPrototype$1, arrayIterator$1;

	if (keys$3([])) {
	  var _context15;

	  arrayIterator$1 = keys$3(_context15 = []).call(_context15); // Safari 8 has buggy iterators w/o `next`

	  if (!('next' in arrayIterator$1)) BUGGY_SAFARI_ITERATORS$2 = true;else {
	    PrototypeOfArrayIteratorPrototype$1 = objectGetPrototypeOf$1(objectGetPrototypeOf$1(arrayIterator$1));
	    if (PrototypeOfArrayIteratorPrototype$1 !== Object.prototype) IteratorPrototype$3 = PrototypeOfArrayIteratorPrototype$1;
	  }
	}

	if (IteratorPrototype$3 == undefined) IteratorPrototype$3 = {};
	var iteratorsCore$1 = {
	  IteratorPrototype: IteratorPrototype$3,
	  BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS$2
	};
	var IteratorPrototype$1$1 = iteratorsCore$1.IteratorPrototype;

	var returnThis$2 = function returnThis() {
	  return this;
	};

	var createIteratorConstructor$1 = function createIteratorConstructor(IteratorConstructor, NAME, next) {
	  var TO_STRING_TAG = NAME + ' Iterator';
	  IteratorConstructor.prototype = objectCreate$1(IteratorPrototype$1$1, {
	    next: createPropertyDescriptor$1(1, next)
	  });
	  setToStringTag$1(IteratorConstructor, TO_STRING_TAG, false, true);
	  iterators$1[TO_STRING_TAG] = returnThis$2;
	  return IteratorConstructor;
	};

	var aPossiblePrototype$1 = function aPossiblePrototype(it) {
	  if (!isObject$1(it) && it !== null) {
	    throw TypeError("Can't set " + String(it) + ' as a prototype');
	  }

	  return it;
	}; // `Object.setPrototypeOf` method
	// https://tc39.github.io/ecma262/#sec-object.setprototypeof
	// Works with __proto__ only. Old v8 can't work with null proto objects.

	/* eslint-disable no-proto */


	var objectSetPrototypeOf$1 = setPrototypeOf$2 || ('__proto__' in {} ? function () {
	  var CORRECT_SETTER = false;
	  var test = {};
	  var setter;

	  try {
	    setter = getOwnPropertyDescriptor$3(Object.prototype, '__proto__').set;
	    setter.call(test, []);
	    CORRECT_SETTER = test instanceof Array;
	  } catch (error) {
	    /* empty */
	  }

	  return function setPrototypeOf(O, proto) {
	    anObject$1(O);
	    aPossiblePrototype$1(proto);
	    if (CORRECT_SETTER) setter.call(O, proto);else O.__proto__ = proto;
	    return O;
	  };
	}() : undefined);
	var IteratorPrototype$2$1 = iteratorsCore$1.IteratorPrototype;
	var BUGGY_SAFARI_ITERATORS$1$1 = iteratorsCore$1.BUGGY_SAFARI_ITERATORS;
	var ITERATOR$1$1 = wellKnownSymbol$1('iterator');
	var KEYS$1 = 'keys';
	var VALUES$1 = 'values';
	var ENTRIES$1 = 'entries';

	var returnThis$1$1 = function returnThis$1() {
	  return this;
	};

	var defineIterator$1 = function defineIterator(Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
	  createIteratorConstructor$1(IteratorConstructor, NAME, next);

	  var getIterationMethod = function getIterationMethod(KIND) {
	    if (KIND === DEFAULT && defaultIterator) return defaultIterator;
	    if (!BUGGY_SAFARI_ITERATORS$1$1 && KIND in IterablePrototype) return IterablePrototype[KIND];

	    switch (KIND) {
	      case KEYS$1:
	        return function keys() {
	          return new IteratorConstructor(this, KIND);
	        };

	      case VALUES$1:
	        return function values() {
	          return new IteratorConstructor(this, KIND);
	        };

	      case ENTRIES$1:
	        return function entries() {
	          return new IteratorConstructor(this, KIND);
	        };
	    }

	    return function () {
	      return new IteratorConstructor(this);
	    };
	  };

	  var TO_STRING_TAG = NAME + ' Iterator';
	  var INCORRECT_VALUES_NAME = false;
	  var IterablePrototype = Iterable.prototype;
	  var nativeIterator = IterablePrototype[ITERATOR$1$1] || IterablePrototype['@@iterator'] || DEFAULT && IterablePrototype[DEFAULT];
	  var defaultIterator = !BUGGY_SAFARI_ITERATORS$1$1 && nativeIterator || getIterationMethod(DEFAULT);
	  var anyNativeIterator = NAME == 'Array' ? entries$2(IterablePrototype) || nativeIterator : nativeIterator;
	  var CurrentIteratorPrototype, methods, KEY; // fix native

	  if (anyNativeIterator) {
	    CurrentIteratorPrototype = objectGetPrototypeOf$1(anyNativeIterator.call(new Iterable()));

	    if (IteratorPrototype$2$1 !== Object.prototype && CurrentIteratorPrototype.next) {
	      // Set @@toStringTag to native iterators
	      setToStringTag$1(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
	      iterators$1[TO_STRING_TAG] = returnThis$1$1;
	    }
	  } // fix Array#{values, @@iterator}.name in V8 / FF


	  if (DEFAULT == VALUES$1 && nativeIterator && nativeIterator.name !== VALUES$1) {
	    INCORRECT_VALUES_NAME = true;

	    defaultIterator = function values() {
	      return nativeIterator.call(this);
	    };
	  } // define iterator


	  if (FORCED && IterablePrototype[ITERATOR$1$1] !== defaultIterator) {
	    createNonEnumerableProperty$1(IterablePrototype, ITERATOR$1$1, defaultIterator);
	  }

	  iterators$1[NAME] = defaultIterator; // export additional methods

	  if (DEFAULT) {
	    methods = {
	      values: getIterationMethod(VALUES$1),
	      keys: IS_SET ? defaultIterator : getIterationMethod(KEYS$1),
	      entries: getIterationMethod(ENTRIES$1)
	    };
	    if (FORCED) for (KEY in methods) {
	      if (BUGGY_SAFARI_ITERATORS$1$1 || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
	        redefine$1(IterablePrototype, KEY, methods[KEY]);
	      }
	    } else _export$1({
	      target: NAME,
	      proto: true,
	      forced: BUGGY_SAFARI_ITERATORS$1$1 || INCORRECT_VALUES_NAME
	    }, methods);
	  }

	  return methods;
	};

	var ARRAY_ITERATOR$1 = 'Array Iterator';
	var setInternalState$1$1 = internalState$1.set;
	var getInternalState$1$1 = internalState$1.getterFor(ARRAY_ITERATOR$1); // `Array.prototype.entries` method
	// https://tc39.github.io/ecma262/#sec-array.prototype.entries
	// `Array.prototype.keys` method
	// https://tc39.github.io/ecma262/#sec-array.prototype.keys
	// `Array.prototype.values` method
	// https://tc39.github.io/ecma262/#sec-array.prototype.values
	// `Array.prototype[@@iterator]` method
	// https://tc39.github.io/ecma262/#sec-array.prototype-@@iterator
	// `CreateArrayIterator` internal method
	// https://tc39.github.io/ecma262/#sec-createarrayiterator

	var es_array_iterator$1 = defineIterator$1(Array, 'Array', function (iterated, kind) {
	  setInternalState$1$1(this, {
	    type: ARRAY_ITERATOR$1,
	    target: toIndexedObject$1(iterated),
	    // target
	    index: 0,
	    // next index
	    kind: kind // kind

	  }); // `%ArrayIteratorPrototype%.next` method
	  // https://tc39.github.io/ecma262/#sec-%arrayiteratorprototype%.next
	}, function () {
	  var state = getInternalState$1$1(this);
	  var target = state.target;
	  var kind = state.kind;
	  var index = state.index++;

	  if (!target || index >= target.length) {
	    state.target = undefined;
	    return {
	      value: undefined,
	      done: true
	    };
	  }

	  if (kind == 'keys') return {
	    value: index,
	    done: false
	  };
	  if (kind == 'values') return {
	    value: target[index],
	    done: false
	  };
	  return {
	    value: [index, target[index]],
	    done: false
	  };
	}, 'values'); // argumentsList[@@iterator] is %ArrayProto_values%
	// https://tc39.github.io/ecma262/#sec-createunmappedargumentsobject
	// https://tc39.github.io/ecma262/#sec-createmappedargumentsobject

	iterators$1.Arguments = iterators$1.Array; // iterable DOM collections
	// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods

	var domIterables$1 = {
	  CSSRuleList: 0,
	  CSSStyleDeclaration: 0,
	  CSSValueList: 0,
	  ClientRectList: 0,
	  DOMRectList: 0,
	  DOMStringList: 0,
	  DOMTokenList: 1,
	  DataTransferItemList: 0,
	  FileList: 0,
	  HTMLAllCollection: 0,
	  HTMLCollection: 0,
	  HTMLFormElement: 0,
	  HTMLSelectElement: 0,
	  MediaList: 0,
	  MimeTypeArray: 0,
	  NamedNodeMap: 0,
	  NodeList: 1,
	  PaintRequestList: 0,
	  Plugin: 0,
	  PluginArray: 0,
	  SVGLengthList: 0,
	  SVGNumberList: 0,
	  SVGPathSegList: 0,
	  SVGPointList: 0,
	  SVGStringList: 0,
	  SVGTransformList: 0,
	  SourceBufferList: 0,
	  StyleSheetList: 0,
	  TextTrackCueList: 0,
	  TextTrackList: 0,
	  TouchList: 0
	};
	var TO_STRING_TAG$3$1 = wellKnownSymbol$1('toStringTag');

	for (var COLLECTION_NAME$1 in domIterables$1) {
	  var Collection$1 = global_1$1[COLLECTION_NAME$1];
	  var CollectionPrototype$1 = Collection$1 && Collection$1.prototype;

	  if (CollectionPrototype$1 && !CollectionPrototype$1[TO_STRING_TAG$3$1]) {
	    createNonEnumerableProperty$1(CollectionPrototype$1, TO_STRING_TAG$3$1, COLLECTION_NAME$1);
	  }

	  iterators$1[COLLECTION_NAME$1] = iterators$1.Array;
	} // `String.prototype.{ codePointAt, at }` methods implementation


	var createMethod$2$1 = function createMethod$2(CONVERT_TO_STRING) {
	  return function ($this, pos) {
	    var S = String(requireObjectCoercible$1($this));
	    var position = toInteger$1(pos);
	    var size = S.length;
	    var first, second;
	    if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
	    first = S.charCodeAt(position);
	    return first < 0xD800 || first > 0xDBFF || position + 1 === size || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF ? CONVERT_TO_STRING ? S.charAt(position) : first : CONVERT_TO_STRING ? slice$3(S).call(S, position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
	  };
	};

	var stringMultibyte$1 = {
	  // `String.prototype.codePointAt` method
	  // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat
	  codeAt: createMethod$2$1(false),
	  // `String.prototype.at` method
	  // https://github.com/mathiasbynens/String.prototype.at
	  charAt: createMethod$2$1(true)
	};
	var charAt$1 = stringMultibyte$1.charAt;
	var STRING_ITERATOR$1 = 'String Iterator';
	var setInternalState$2$1 = internalState$1.set;
	var getInternalState$2$1 = internalState$1.getterFor(STRING_ITERATOR$1); // `String.prototype[@@iterator]` method
	// https://tc39.github.io/ecma262/#sec-string.prototype-@@iterator

	defineIterator$1(String, 'String', function (iterated) {
	  setInternalState$2$1(this, {
	    type: STRING_ITERATOR$1,
	    string: String(iterated),
	    index: 0
	  }); // `%StringIteratorPrototype%.next` method
	  // https://tc39.github.io/ecma262/#sec-%stringiteratorprototype%.next
	}, function next() {
	  var state = getInternalState$2$1(this);
	  var string = state.string;
	  var index = state.index;
	  var point;
	  if (index >= string.length) return {
	    value: undefined,
	    done: true
	  };
	  point = charAt$1(string, index);
	  state.index += point.length;
	  return {
	    value: point,
	    done: false
	  };
	});
	var ITERATOR$2$1 = wellKnownSymbol$1('iterator');

	var getIteratorMethod$1 = function getIteratorMethod(it) {
	  if (it != undefined) return it[ITERATOR$2$1] || it['@@iterator'] || iterators$1[classof$1(it)];
	};

	var getIterator = function getIterator(it) {
	  var iteratorMethod = getIteratorMethod$1(it);

	  if (typeof iteratorMethod != 'function') {
	    throw TypeError(String(it) + ' is not iterable');
	  }

	  return anObject$1(iteratorMethod.call(it));
	};

	var getIterator$1 = getIterator;
	var getIterator$2 = getIterator$1; // `Object.create` method
	// https://tc39.github.io/ecma262/#sec-object.create

	_export$1({
	  target: 'Object',
	  stat: true,
	  sham: !descriptors$1
	}, {
	  create: objectCreate$1
	});

	var Object$1$1 = path$1.Object;

	var create$3 = function create(P, D) {
	  return Object$1$1.create(P, D);
	};

	var create$1$1 = create$3;
	var create$2$1 = create$1$1;
	var defineProperty$4$1 = defineProperty_1$1;
	var defineProperty$5 = defineProperty$4$1;

	function _defineProperty(obj, key, value) {
	  if (key in obj) {
	    defineProperty$5(obj, key, {
	      value: value,
	      enumerable: true,
	      configurable: true,
	      writable: true
	    });
	  } else {
	    obj[key] = value;
	  }

	  return obj;
	}

	var defineProperty$6 = _defineProperty;
	var FAILS_ON_PRIMITIVES$1$1 = fails$1(function () {
	  objectKeys$1(1);
	}); // `Object.keys` method
	// https://tc39.github.io/ecma262/#sec-object.keys

	_export$1({
	  target: 'Object',
	  stat: true,
	  forced: FAILS_ON_PRIMITIVES$1$1
	}, {
	  keys: function keys(it) {
	    return objectKeys$1(toObject$1(it));
	  }
	});

	var keys$1$1 = keys$3(path$1.Object);

	var keys$2$1 = keys$1$1;
	var keys$3$1 = keys$2$1; // a string of all valid unicode whitespaces
	// eslint-disable-next-line max-len

	var whitespaces$1 = "\t\n\x0B\f\r \xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF";
	var whitespace$1 = '[' + whitespaces$1 + ']';
	var ltrim$1 = RegExp('^' + whitespace$1 + whitespace$1 + '*');
	var rtrim$1 = RegExp(whitespace$1 + whitespace$1 + '*$'); // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation

	var createMethod$3$1 = function createMethod$3(TYPE) {
	  return function ($this) {
	    var string = String(requireObjectCoercible$1($this));
	    if (TYPE & 1) string = string.replace(ltrim$1, '');
	    if (TYPE & 2) string = string.replace(rtrim$1, '');
	    return string;
	  };
	};

	var stringTrim$1 = {
	  // `String.prototype.{ trimLeft, trimStart }` methods
	  // https://tc39.github.io/ecma262/#sec-string.prototype.trimstart
	  start: createMethod$3$1(1),
	  // `String.prototype.{ trimRight, trimEnd }` methods
	  // https://tc39.github.io/ecma262/#sec-string.prototype.trimend
	  end: createMethod$3$1(2),
	  // `String.prototype.trim` method
	  // https://tc39.github.io/ecma262/#sec-string.prototype.trim
	  trim: createMethod$3$1(3)
	};
	var non$1 = "\u200B\x85\u180E"; // check that a method works with the correct list
	// of whitespaces and has a correct name

	var forcedStringTrimMethod$1 = function forcedStringTrimMethod(METHOD_NAME) {
	  return fails$1(function () {
	    return !!whitespaces$1[METHOD_NAME]() || non$1[METHOD_NAME]() != non$1 || whitespaces$1[METHOD_NAME].name !== METHOD_NAME;
	  });
	};

	var $trim$1 = trim$3(stringTrim$1); // `String.prototype.trim` method
	// https://tc39.github.io/ecma262/#sec-string.prototype.trim


	_export$1({
	  target: 'String',
	  proto: true,
	  forced: forcedStringTrimMethod$1('trim')
	}, {
	  trim: function trim() {
	    return $trim$1(this);
	  }
	});

	var entryVirtual$1 = function entryVirtual(CONSTRUCTOR) {
	  return path$1[CONSTRUCTOR + 'Prototype'];
	};

	var trim$4 = trim$3(entryVirtual$1('String'));

	var StringPrototype$1 = String.prototype;

	var trim_1$1 = function trim_1(it) {
	  var own = trim$3(it);

	  return typeof it === 'string' || it === StringPrototype$1 || it instanceof String && own === trim$3(StringPrototype$1) ? trim$4 : own;
	};

	var trim$1$1 = trim_1$1;
	var trim$2$1 = trim$1$1;

	var sloppyArrayMethod$1 = function sloppyArrayMethod(METHOD_NAME, argument) {
	  var method = [][METHOD_NAME];
	  return !method || !fails$1(function () {
	    // eslint-disable-next-line no-useless-call,no-throw-literal
	    method.call(null, argument || function () {
	      throw 1;
	    }, 1);
	  });
	};

	var $forEach$1$1 = forEach$2(arrayIteration$1); // `Array.prototype.forEach` method implementation
	// https://tc39.github.io/ecma262/#sec-array.prototype.foreach


	var arrayForEach$1 = sloppyArrayMethod$1('forEach') ? function forEach(callbackfn
	/* , thisArg */
	) {
	  return $forEach$1$1(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
	} : forEach$2([]); // `Array.prototype.forEach` method
	// https://tc39.github.io/ecma262/#sec-array.prototype.foreach

	_export$1({
	  target: 'Array',
	  proto: true,
	  forced: forEach$2([]) != arrayForEach$1
	}, {
	  forEach: arrayForEach$1
	});

	var forEach$3 = forEach$2(entryVirtual$1('Array'));

	var forEach$1$1 = forEach$3;
	var ArrayPrototype$b = Array.prototype;
	var DOMIterables$4 = {
	  DOMTokenList: true,
	  NodeList: true
	};

	var forEach_1$1 = function forEach_1(it) {
	  var own = forEach$2(it);

	  return it === ArrayPrototype$b || it instanceof Array && own === forEach$2(ArrayPrototype$b) // eslint-disable-next-line no-prototype-builtins
	  || DOMIterables$4.hasOwnProperty(classof$1(it)) ? forEach$1$1 : own;
	};

	var forEach$2$1 = forEach_1$1;
	var userAgent$1 = getBuiltIn$1('navigator', 'userAgent') || '';
	var process$1 = global_1$1.process;
	var versions$1 = process$1 && process$1.versions;
	var v8$1 = versions$1 && versions$1.v8;
	var match$1, version$1;

	if (v8$1) {
	  match$1 = v8$1.split('.');
	  version$1 = match$1[0] + match$1[1];
	} else if (userAgent$1) {
	  match$1 = userAgent$1.match(/Edge\/(\d+)/);

	  if (!match$1 || match$1[1] >= 74) {
	    match$1 = userAgent$1.match(/Chrome\/(\d+)/);
	    if (match$1) version$1 = match$1[1];
	  }
	}

	var v8Version$1 = version$1 && +version$1;
	var SPECIES$1$1 = wellKnownSymbol$1('species');

	var arrayMethodHasSpeciesSupport$1 = function arrayMethodHasSpeciesSupport(METHOD_NAME) {
	  // We can't use this feature detection in V8 since it causes
	  // deoptimization and serious performance degradation
	  // https://github.com/zloirock/core-js/issues/677
	  return v8Version$1 >= 51 || !fails$1(function () {
	    var array = [];
	    var constructor = array.constructor = {};

	    constructor[SPECIES$1$1] = function () {
	      return {
	        foo: 1
	      };
	    };

	    return array[METHOD_NAME](Boolean).foo !== 1;
	  });
	};

	var $map$1 = map$2(arrayIteration$1); // `Array.prototype.map` method
	// https://tc39.github.io/ecma262/#sec-array.prototype.map
	// with adding support of @@species


	_export$1({
	  target: 'Array',
	  proto: true,
	  forced: !arrayMethodHasSpeciesSupport$1('map')
	}, {
	  map: function map(callbackfn
	  /* , thisArg */
	  ) {
	    return $map$1(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
	  }
	});

	var map$3 = map$2(entryVirtual$1('Array'));

	var ArrayPrototype$1$1 = Array.prototype;

	var map_1$1 = function map_1(it) {
	  var own = map$2(it);

	  return it === ArrayPrototype$1$1 || it instanceof Array && own === map$2(ArrayPrototype$1$1) ? map$3 : own;
	};

	var map$1$1 = map_1$1;
	var map$2$1 = map$1$1;

	var trim$3$1 = trim$3(stringTrim$1);

	var nativeParseInt$1 = global_1$1.parseInt;
	var hex$1 = /^[+-]?0[Xx]/;
	var FORCED$1$1 = nativeParseInt$1(whitespaces$1 + '08') !== 8 || nativeParseInt$1(whitespaces$1 + '0x16') !== 22; // `parseInt` method
	// https://tc39.github.io/ecma262/#sec-parseint-string-radix

	var _parseInt$4 = FORCED$1$1 ? function parseInt(string, radix) {
	  var S = trim$3$1(String(string));
	  return nativeParseInt$1(S, radix >>> 0 || (hex$1.test(S) ? 16 : 10));
	} : nativeParseInt$1; // `parseInt` method
	// https://tc39.github.io/ecma262/#sec-parseint-string-radix


	_export$1({
	  global: true,
	  forced: _parseInt$3 != _parseInt$4
	}, {
	  parseInt: _parseInt$4
	});

	var _parseInt$1$1 = path$1.parseInt;
	var _parseInt$2$1 = _parseInt$1$1;
	var _parseInt$3$1 = _parseInt$2$1;
	var propertyIsEnumerable = objectPropertyIsEnumerable$1.f; // `Object.{ entries, values }` methods implementation

	var createMethod$4$1 = function createMethod$4(TO_ENTRIES) {
	  return function (it) {
	    var O = toIndexedObject$1(it);
	    var keys = objectKeys$1(O);
	    var length = keys.length;
	    var i = 0;
	    var result = [];
	    var key;

	    while (length > i) {
	      key = keys[i++];

	      if (!descriptors$1 || propertyIsEnumerable.call(O, key)) {
	        result.push(TO_ENTRIES ? [key, O[key]] : O[key]);
	      }
	    }

	    return result;
	  };
	};

	var objectToArray = {
	  // `Object.entries` method
	  // https://tc39.github.io/ecma262/#sec-object.entries
	  entries: createMethod$4$1(true),
	  // `Object.values` method
	  // https://tc39.github.io/ecma262/#sec-object.values
	  values: createMethod$4$1(false)
	};

	var $values = values$2(objectToArray); // `Object.values` method
	// https://tc39.github.io/ecma262/#sec-object.values


	_export$1({
	  target: 'Object',
	  stat: true
	}, {
	  values: function values(O) {
	    return $values(O);
	  }
	});

	var values$3 = values$2(path$1.Object);

	var values$1$1 = values$3;
	var values$2$1 = values$1$1;

	var $filter$1 = filter$2(arrayIteration$1); // `Array.prototype.filter` method
	// https://tc39.github.io/ecma262/#sec-array.prototype.filter
	// with adding support of @@species


	_export$1({
	  target: 'Array',
	  proto: true,
	  forced: !arrayMethodHasSpeciesSupport$1('filter')
	}, {
	  filter: function filter(callbackfn
	  /* , thisArg */
	  ) {
	    return $filter$1(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
	  }
	});

	var filter$3 = filter$2(entryVirtual$1('Array'));

	var ArrayPrototype$2$1 = Array.prototype;

	var filter_1$1 = function filter_1(it) {
	  var own = filter$2(it);

	  return it === ArrayPrototype$2$1 || it instanceof Array && own === filter$2(ArrayPrototype$2$1) ? filter$3 : own;
	};

	var filter$1$1 = filter_1$1;
	var filter$2$1 = filter$1$1;
	var IS_CONCAT_SPREADABLE$1 = wellKnownSymbol$1('isConcatSpreadable');
	var MAX_SAFE_INTEGER$2 = 0x1FFFFFFFFFFFFF;
	var MAXIMUM_ALLOWED_INDEX_EXCEEDED$1 = 'Maximum allowed index exceeded'; // We can't use this feature detection in V8 since it causes
	// deoptimization and serious performance degradation
	// https://github.com/zloirock/core-js/issues/679

	var IS_CONCAT_SPREADABLE_SUPPORT$1 = v8Version$1 >= 51 || !fails$1(function () {
	  var array = [];
	  array[IS_CONCAT_SPREADABLE$1] = false;
	  return concat$2(array).call(array)[0] !== array;
	});
	var SPECIES_SUPPORT$1 = arrayMethodHasSpeciesSupport$1('concat');

	var isConcatSpreadable$1 = function isConcatSpreadable(O) {
	  if (!isObject$1(O)) return false;
	  var spreadable = O[IS_CONCAT_SPREADABLE$1];
	  return spreadable !== undefined ? !!spreadable : isArray$4(O);
	};

	var FORCED$2$1 = !IS_CONCAT_SPREADABLE_SUPPORT$1 || !SPECIES_SUPPORT$1; // `Array.prototype.concat` method
	// https://tc39.github.io/ecma262/#sec-array.prototype.concat
	// with adding support of @@isConcatSpreadable and @@species

	_export$1({
	  target: 'Array',
	  proto: true,
	  forced: FORCED$2$1
	}, {
	  concat: function concat(arg) {
	    // eslint-disable-line no-unused-vars
	    var O = toObject$1(this);
	    var A = arraySpeciesCreate$1(O, 0);
	    var n = 0;
	    var i, k, length, len, E;

	    for (i = -1, length = arguments.length; i < length; i++) {
	      E = i === -1 ? O : arguments[i];

	      if (isConcatSpreadable$1(E)) {
	        len = toLength$1(E.length);
	        if (n + len > MAX_SAFE_INTEGER$2) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED$1);

	        for (k = 0; k < len; k++, n++) {
	          if (k in E) createProperty$1(A, n, E[k]);
	        }
	      } else {
	        if (n >= MAX_SAFE_INTEGER$2) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED$1);
	        createProperty$1(A, n++, E);
	      }
	    }

	    A.length = n;
	    return A;
	  }
	});

	var concat$3 = concat$2(entryVirtual$1('Array'));

	var ArrayPrototype$3$1 = Array.prototype;

	var concat_1$1 = function concat_1(it) {
	  var own = concat$2(it);

	  return it === ArrayPrototype$3$1 || it instanceof Array && own === concat$2(ArrayPrototype$3$1) ? concat$3 : own;
	};

	var concat$1$1 = concat_1$1;
	var concat$2$1 = concat$1$1; // `Array.isArray` method
	// https://tc39.github.io/ecma262/#sec-array.isarray

	_export$1({
	  target: 'Array',
	  stat: true
	}, {
	  isArray: isArray$4
	});

	var isArray$1$1 = path$1.Array.isArray;
	var isArray$2$1 = isArray$1$1;
	var isArray$3$1 = isArray$2$1;

	function _arrayWithoutHoles(arr) {
	  if (isArray$3$1(arr)) {
	    for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
	      arr2[i] = arr[i];
	    }

	    return arr2;
	  }
	}

	var arrayWithoutHoles = _arrayWithoutHoles; // call something on iterator step with safe closing on error

	var callWithSafeIterationClosing$1 = function callWithSafeIterationClosing(iterator, fn, value, ENTRIES) {
	  try {
	    return ENTRIES ? fn(anObject$1(value)[0], value[1]) : fn(value); // 7.4.6 IteratorClose(iterator, completion)
	  } catch (error) {
	    var returnMethod = iterator['return'];
	    if (returnMethod !== undefined) anObject$1(returnMethod.call(iterator));
	    throw error;
	  }
	};

	var ITERATOR$3$1 = wellKnownSymbol$1('iterator');
	var ArrayPrototype$4$1 = Array.prototype; // check on default Array iterator

	var isArrayIteratorMethod$1 = function isArrayIteratorMethod(it) {
	  return it !== undefined && (iterators$1.Array === it || ArrayPrototype$4$1[ITERATOR$3$1] === it);
	}; // `Array.from` method implementation
	// https://tc39.github.io/ecma262/#sec-array.from


	var arrayFrom$1 = function from(arrayLike
	/* , mapfn = undefined, thisArg = undefined */
	) {
	  var O = toObject$1(arrayLike);
	  var C = typeof this == 'function' ? this : Array;
	  var argumentsLength = arguments.length;
	  var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
	  var mapping = mapfn !== undefined;
	  var index = 0;
	  var iteratorMethod = getIteratorMethod$1(O);
	  var length, result, step, iterator, next;
	  if (mapping) mapfn = bindContext$1(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2); // if the target is not iterable or it's an array with the default iterator - use a simple case

	  if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod$1(iteratorMethod))) {
	    iterator = iteratorMethod.call(O);
	    next = iterator.next;
	    result = new C();

	    for (; !(step = next.call(iterator)).done; index++) {
	      createProperty$1(result, index, mapping ? callWithSafeIterationClosing$1(iterator, mapfn, [step.value, index], true) : step.value);
	    }
	  } else {
	    length = toLength$1(O.length);
	    result = new C(length);

	    for (; length > index; index++) {
	      createProperty$1(result, index, mapping ? mapfn(O[index], index) : O[index]);
	    }
	  }

	  result.length = index;
	  return result;
	};

	var ITERATOR$4$1 = wellKnownSymbol$1('iterator');
	var SAFE_CLOSING$1 = false;

	try {
	  var called$1 = 0;
	  var iteratorWithReturn$1 = {
	    next: function next() {
	      return {
	        done: !!called$1++
	      };
	    },
	    'return': function _return() {
	      SAFE_CLOSING$1 = true;
	    }
	  };

	  iteratorWithReturn$1[ITERATOR$4$1] = function () {
	    return this;
	  }; // eslint-disable-next-line no-throw-literal


	  from_1$2(iteratorWithReturn$1, function () {
	    throw 2;
	  });
	} catch (error) {
	  /* empty */
	}

	var checkCorrectnessOfIteration$1 = function checkCorrectnessOfIteration(exec, SKIP_CLOSING) {
	  if (!SKIP_CLOSING && !SAFE_CLOSING$1) return false;
	  var ITERATION_SUPPORT = false;

	  try {
	    var object = {};

	    object[ITERATOR$4$1] = function () {
	      return {
	        next: function next() {
	          return {
	            done: ITERATION_SUPPORT = true
	          };
	        }
	      };
	    };

	    exec(object);
	  } catch (error) {
	    /* empty */
	  }

	  return ITERATION_SUPPORT;
	};

	var INCORRECT_ITERATION$1 = !checkCorrectnessOfIteration$1(function (iterable) {
	  from_1$2(iterable);
	}); // `Array.from` method
	// https://tc39.github.io/ecma262/#sec-array.from

	_export$1({
	  target: 'Array',
	  stat: true,
	  forced: INCORRECT_ITERATION$1
	}, {
	  from: arrayFrom$1
	});

	var from_1$3 = path$1.Array.from;
	var from_1$1$1 = from_1$3;
	var from_1$2$1 = from_1$1$1;
	var ITERATOR$5$1 = wellKnownSymbol$1('iterator');

	var isIterable = function isIterable(it) {
	  var O = Object(it);
	  return O[ITERATOR$5$1] !== undefined || '@@iterator' in O // eslint-disable-next-line no-prototype-builtins
	  || iterators$1.hasOwnProperty(classof$1(O));
	};

	var isIterable$1 = isIterable;
	var isIterable$2 = isIterable$1;

	function _iterableToArray(iter) {
	  if (isIterable$2(Object(iter)) || Object.prototype.toString.call(iter) === "[object Arguments]") return from_1$2$1(iter);
	}

	var iterableToArray = _iterableToArray;

	function _nonIterableSpread() {
	  throw new TypeError("Invalid attempt to spread non-iterable instance");
	}

	var nonIterableSpread = _nonIterableSpread;

	function _toConsumableArray(arr) {
	  return arrayWithoutHoles(arr) || iterableToArray(arr) || nonIterableSpread();
	}

	var toConsumableArray = _toConsumableArray;
	var SPECIES$2$1 = wellKnownSymbol$1('species');

	var nativeSlice$1 = slice$3([]);

	var max$1$1 = Math.max; // `Array.prototype.slice` method
	// https://tc39.github.io/ecma262/#sec-array.prototype.slice
	// fallback for not array-like ES3 strings and DOM objects

	_export$1({
	  target: 'Array',
	  proto: true,
	  forced: !arrayMethodHasSpeciesSupport$1('slice')
	}, {
	  slice: function slice(start, end) {
	    var O = toIndexedObject$1(this);
	    var length = toLength$1(O.length);
	    var k = toAbsoluteIndex$1(start, length);
	    var fin = toAbsoluteIndex$1(end === undefined ? length : end, length); // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible

	    var Constructor, result, n;

	    if (isArray$4(O)) {
	      Constructor = O.constructor; // cross-realm fallback

	      if (typeof Constructor == 'function' && (Constructor === Array || isArray$4(Constructor.prototype))) {
	        Constructor = undefined;
	      } else if (isObject$1(Constructor)) {
	        Constructor = Constructor[SPECIES$2$1];
	        if (Constructor === null) Constructor = undefined;
	      }

	      if (Constructor === Array || Constructor === undefined) {
	        return nativeSlice$1.call(O, k, fin);
	      }
	    }

	    result = new (Constructor === undefined ? Array : Constructor)(max$1$1(fin - k, 0));

	    for (n = 0; k < fin; k++, n++) {
	      if (k in O) createProperty$1(result, n, O[k]);
	    }

	    result.length = n;
	    return result;
	  }
	});

	var slice$4 = slice$3(entryVirtual$1('Array'));

	var ArrayPrototype$5$1 = Array.prototype;

	var slice_1$1 = function slice_1(it) {
	  var own = slice$3(it);

	  return it === ArrayPrototype$5$1 || it instanceof Array && own === slice$3(ArrayPrototype$5$1) ? slice$4 : own;
	};

	var slice$1$1 = slice_1$1;
	var slice$2$1 = slice$1$1;
	var FAILS_ON_PRIMITIVES$2$1 = fails$1(function () {
	  objectGetPrototypeOf$1(1);
	}); // `Object.getPrototypeOf` method
	// https://tc39.github.io/ecma262/#sec-object.getprototypeof

	_export$1({
	  target: 'Object',
	  stat: true,
	  forced: FAILS_ON_PRIMITIVES$2$1,
	  sham: !correctPrototypeGetter$1
	}, {
	  getPrototypeOf: function getPrototypeOf(it) {
	    return objectGetPrototypeOf$1(toObject$1(it));
	  }
	});

	var getPrototypeOf$3 = path$1.Object.getPrototypeOf;
	var getPrototypeOf$1$1 = getPrototypeOf$3;
	var getPrototypeOf$2$1 = getPrototypeOf$1$1;

	var $indexOf$1 = indexOf$3(arrayIncludes$1);

	var nativeIndexOf$1 = indexOf$3([]);

	var NEGATIVE_ZERO$1 = !!nativeIndexOf$1 && 1 / indexOf$3(_context16 = [1]).call(_context16, 1, -0) < 0;
	var SLOPPY_METHOD$1 = sloppyArrayMethod$1('indexOf'); // `Array.prototype.indexOf` method
	// https://tc39.github.io/ecma262/#sec-array.prototype.indexof

	_export$1({
	  target: 'Array',
	  proto: true,
	  forced: NEGATIVE_ZERO$1 || SLOPPY_METHOD$1
	}, {
	  indexOf: function indexOf(searchElement
	  /* , fromIndex = 0 */
	  ) {
	    return NEGATIVE_ZERO$1 // convert -0 to +0
	    ? nativeIndexOf$1.apply(this, arguments) || 0 : $indexOf$1(this, searchElement, arguments.length > 1 ? arguments[1] : undefined);
	  }
	});

	var indexOf$1$1 = indexOf$3(entryVirtual$1('Array'));

	var ArrayPrototype$6$1 = Array.prototype;

	var indexOf_1$1 = function indexOf_1(it) {
	  var own = indexOf$3(it);

	  return it === ArrayPrototype$6$1 || it instanceof Array && own === indexOf$3(ArrayPrototype$6$1) ? indexOf$1$1 : own;
	};

	var indexOf$2$1 = indexOf_1$1;
	var indexOf$3$1 = indexOf$2$1;
	var isArray$4$1 = isArray$1$1;
	var isArray$5 = isArray$4$1;
	var nativeAssign$1 = assign$2; // `Object.assign` method
	// https://tc39.github.io/ecma262/#sec-object.assign
	// should work with symbols and should have deterministic property order (V8 bug)

	var objectAssign$1 = !nativeAssign$1 || fails$1(function () {
	  var _context17;

	  var A = {};
	  var B = {}; // eslint-disable-next-line no-undef

	  var symbol = symbol$2();

	  var alphabet = 'abcdefghijklmnopqrst';
	  A[symbol] = 7;

	  forEach$2(_context17 = alphabet.split('')).call(_context17, function (chr) {
	    B[chr] = chr;
	  });

	  return nativeAssign$1({}, A)[symbol] != 7 || objectKeys$1(nativeAssign$1({}, B)).join('') != alphabet;
	}) ? function assign(target, source) {
	  // eslint-disable-line no-unused-vars
	  var T = toObject$1(target);
	  var argumentsLength = arguments.length;
	  var index = 1;
	  var getOwnPropertySymbols = objectGetOwnPropertySymbols$1.f;
	  var propertyIsEnumerable = objectPropertyIsEnumerable$1.f;

	  while (argumentsLength > index) {
	    var _context18;

	    var S = indexedObject$1(arguments[index++]);
	    var keys = getOwnPropertySymbols ? concat$2(_context18 = objectKeys$1(S)).call(_context18, getOwnPropertySymbols(S)) : objectKeys$1(S);
	    var length = keys.length;
	    var j = 0;
	    var key;

	    while (length > j) {
	      key = keys[j++];
	      if (!descriptors$1 || propertyIsEnumerable.call(S, key)) T[key] = S[key];
	    }
	  }

	  return T;
	} : nativeAssign$1; // `Object.assign` method
	// https://tc39.github.io/ecma262/#sec-object.assign

	_export$1({
	  target: 'Object',
	  stat: true,
	  forced: assign$2 !== objectAssign$1
	}, {
	  assign: objectAssign$1
	});

	var assign$3 = path$1.Object.assign;
	var assign$1$1 = assign$3;
	var assign$2$1 = assign$1$1; // `Symbol.iterator` well-known symbol
	// https://tc39.github.io/ecma262/#sec-symbol.iterator

	defineWellKnownSymbol$1('iterator');
	var iterator$3 = wrappedWellKnownSymbol$1.f('iterator');
	var iterator$1$1 = iterator$3;
	var iterator$2$1 = iterator$1$1; // `Symbol.asyncIterator` well-known symbol
	// https://tc39.github.io/ecma262/#sec-symbol.asynciterator

	defineWellKnownSymbol$1('asyncIterator'); // `Symbol.hasInstance` well-known symbol
	// https://tc39.github.io/ecma262/#sec-symbol.hasinstance

	defineWellKnownSymbol$1('hasInstance'); // `Symbol.isConcatSpreadable` well-known symbol
	// https://tc39.github.io/ecma262/#sec-symbol.isconcatspreadable

	defineWellKnownSymbol$1('isConcatSpreadable'); // `Symbol.match` well-known symbol
	// https://tc39.github.io/ecma262/#sec-symbol.match

	defineWellKnownSymbol$1('match'); // `Symbol.matchAll` well-known symbol

	defineWellKnownSymbol$1('matchAll'); // `Symbol.replace` well-known symbol
	// https://tc39.github.io/ecma262/#sec-symbol.replace

	defineWellKnownSymbol$1('replace'); // `Symbol.search` well-known symbol
	// https://tc39.github.io/ecma262/#sec-symbol.search

	defineWellKnownSymbol$1('search'); // `Symbol.species` well-known symbol
	// https://tc39.github.io/ecma262/#sec-symbol.species

	defineWellKnownSymbol$1('species'); // `Symbol.split` well-known symbol
	// https://tc39.github.io/ecma262/#sec-symbol.split

	defineWellKnownSymbol$1('split'); // `Symbol.toPrimitive` well-known symbol
	// https://tc39.github.io/ecma262/#sec-symbol.toprimitive

	defineWellKnownSymbol$1('toPrimitive'); // `Symbol.toStringTag` well-known symbol
	// https://tc39.github.io/ecma262/#sec-symbol.tostringtag

	defineWellKnownSymbol$1('toStringTag'); // `Symbol.unscopables` well-known symbol
	// https://tc39.github.io/ecma262/#sec-symbol.unscopables

	defineWellKnownSymbol$1('unscopables'); // Math[@@toStringTag] property
	// https://tc39.github.io/ecma262/#sec-math-@@tostringtag

	setToStringTag$1(Math, 'Math', true); // JSON[@@toStringTag] property
	// https://tc39.github.io/ecma262/#sec-json-@@tostringtag

	setToStringTag$1(global_1$1.JSON, 'JSON', true);
	var symbol$5 = path$1.Symbol; // `Symbol.asyncDispose` well-known symbol
	// https://github.com/tc39/proposal-using-statement

	defineWellKnownSymbol$1('asyncDispose'); // `Symbol.dispose` well-known symbol
	// https://github.com/tc39/proposal-using-statement

	defineWellKnownSymbol$1('dispose'); // `Symbol.observable` well-known symbol
	// https://github.com/tc39/proposal-observable

	defineWellKnownSymbol$1('observable'); // `Symbol.patternMatch` well-known symbol
	// https://github.com/tc39/proposal-pattern-matching

	defineWellKnownSymbol$1('patternMatch'); // TODO: remove from `core-js@4`

	defineWellKnownSymbol$1('replaceAll');
	var symbol$1$1 = symbol$5;
	var symbol$2$1 = symbol$1$1;

	var _typeof_1$1 = createCommonjsModule$1(function (module) {
	  function _typeof2(obj) {
	    if (typeof symbol$2$1 === "function" && _typeof_1(iterator$2$1) === "symbol") {
	      _typeof2 = function _typeof2(obj) {
	        return _typeof_1(obj);
	      };
	    } else {
	      _typeof2 = function _typeof2(obj) {
	        return obj && typeof symbol$2$1 === "function" && obj.constructor === symbol$2$1 && obj !== symbol$2$1.prototype ? "symbol" : _typeof_1(obj);
	      };
	    }

	    return _typeof2(obj);
	  }

	  function _typeof(obj) {
	    if (typeof symbol$2$1 === "function" && _typeof2(iterator$2$1) === "symbol") {
	      module.exports = _typeof = function _typeof(obj) {
	        return _typeof2(obj);
	      };
	    } else {
	      module.exports = _typeof = function _typeof(obj) {
	        return obj && typeof symbol$2$1 === "function" && obj.constructor === symbol$2$1 && obj !== symbol$2$1.prototype ? "symbol" : _typeof2(obj);
	      };
	    }

	    return _typeof(obj);
	  }

	  module.exports = _typeof;
	}); // Maps for number <-> hex string conversion


	var byteToHex = [];

	for (var i = 0; i < 256; i++) {
	  byteToHex[i] = (i + 0x100).toString(16).substr(1);
	}
	/**
	 * Represent binary UUID into it's string representation.
	 *
	 * @param buf - Buffer containing UUID bytes.
	 * @param offset - Offset from the start of the buffer where the UUID is saved (not needed if the buffer starts with the UUID).
	 *
	 * @returns String representation of the UUID.
	 */


	function stringifyUUID(buf, offset) {
	  var i = offset || 0;
	  var bth = byteToHex;
	  return bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]];
	}
	/**
	 * Generate 16 random bytes to be used as a base for UUID.
	 *
	 * @ignore
	 */


	var random = function () {
	  if (typeof crypto !== 'undefined' && crypto.getRandomValues) {
	    // WHATWG crypto-based RNG - http://wiki.whatwg.org/wiki/Crypto
	    // Moderately fast, high quality
	    var _rnds8 = new Uint8Array(16);

	    return function whatwgRNG() {
	      crypto.getRandomValues(_rnds8);
	      return _rnds8;
	    };
	  } // Math.random()-based (RNG)
	  //
	  // If all else fails, use Math.random().
	  // It's fast, but is of unspecified quality.


	  var _rnds = new Array(16);

	  return function () {
	    for (var i = 0, r; i < 16; i++) {
	      if ((i & 0x03) === 0) {
	        r = Math.random() * 0x100000000;
	      }

	      _rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
	    }

	    return _rnds;
	  }; //     uuid.js
	  //
	  //     Copyright (c) 2010-2012 Robert Kieffer
	  //     MIT License - http://opensource.org/licenses/mit-license.php
	  // Unique ID creation requires a high quality random # generator.  We feature
	  // detect to determine the best RNG source, normalizing to a function that
	  // returns 128-bits of randomness, since that's what's usually required
	  // return require('./rng');
	}();

	var byteToHex$1 = [];

	for (var i$1 = 0; i$1 < 256; i$1++) {
	  byteToHex$1[i$1] = (i$1 + 0x100).toString(16).substr(1);
	} // **`v1()` - Generate time-based UUID**
	//
	// Inspired by https://github.com/LiosK/UUID.js
	// and http://docs.python.org/library/uuid.html
	// random #'s we need to init node and clockseq


	var seedBytes = random(); // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)

	var defaultNodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]]; // Per 4.2.2, randomize (14 bit) clockseq

	var defaultClockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff; // Previous uuid creation time

	/**
	 * UUIDv4 options.
	 */

	/**
	 * Generate UUIDv4
	 *
	 * @param options - Options to be used instead of default generated values.
	 * String 'binary' is a shorthand for uuid4({}, new Array(16)).
	 * @param buf - If present the buffer will be filled with the generated UUID.
	 * @param offset - Offset of the UUID from the start of the buffer.
	 *
	 * @returns UUIDv4
	 */

	function uuid4() {
	  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
	  var buf = arguments.length > 1 ? arguments[1] : undefined;
	  var offset = arguments.length > 2 ? arguments[2] : undefined; // Deprecated - 'format' argument, as supported in v1.2

	  var i = buf && offset || 0;

	  if (typeof options === 'string') {
	    buf = options === 'binary' ? new Array(16) : undefined;
	    options = {};
	  }

	  var rnds = options.random || (options.rng || random)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`

	  rnds[6] = rnds[6] & 0x0f | 0x40;
	  rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided

	  if (buf) {
	    for (var ii = 0; ii < 16; ii++) {
	      buf[i + ii] = rnds[ii];
	    }
	  }

	  return buf || stringifyUUID(rnds);
	} // Rollup will complain about mixing default and named exports in UMD build,


	function ownKeys$1(object, enumerableOnly) {
	  var keys = keys$3$1(object);

	  if (getOwnPropertySymbols$2$1) {
	    var symbols = getOwnPropertySymbols$2$1(object);
	    if (enumerableOnly) symbols = filter$2$1(symbols).call(symbols, function (sym) {
	      return getOwnPropertyDescriptor$3$1(object, sym).enumerable;
	    });
	    keys.push.apply(keys, symbols);
	  }

	  return keys;
	}

	function _objectSpread(target) {
	  for (var i = 1; i < arguments.length; i++) {
	    var source = arguments[i] != null ? arguments[i] : {};

	    if (i % 2) {
	      var _context11;

	      forEach$2$1(_context11 = ownKeys$1(source, true)).call(_context11, function (key) {
	        defineProperty$6(target, key, source[key]);
	      });
	    } else if (getOwnPropertyDescriptors$2) {
	      defineProperties$1$1(target, getOwnPropertyDescriptors$2(source));
	    } else {
	      var _context12;

	      forEach$2$1(_context12 = ownKeys$1(source)).call(_context12, function (key) {
	        defineProperty$1$1(target, key, getOwnPropertyDescriptor$3$1(source, key));
	      });
	    }
	  }

	  return target;
	} // for example '/Date(1198908717056)/' or '/Date(1198908717056-0700)/'
	// code from http://momentjs.com/


	var ASPDateRegex = /^\/?Date\((-?\d+)/i; // Color REs

	var fullHexRE = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i;
	var shortHexRE = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
	var rgbRE = /^rgb\( *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *\)$/i;
	var rgbaRE = /^rgba\( *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *([01]|0?\.\d+) *\)$/i;
	/**
	 * Hue, Saturation, Value.
	 */

	/**
	 * Test whether given object is a number
	 *
	 * @param value - Input value of unknown type.
	 *
	 * @returns True if number, false otherwise.
	 */

	function isNumber(value) {
	  return value instanceof Number || typeof value === "number";
	}
	/**
	 * Remove everything in the DOM object
	 *
	 * @param DOMobject - Node whose child nodes will be recursively deleted.
	 */


	function recursiveDOMDelete(DOMobject) {
	  if (DOMobject) {
	    while (DOMobject.hasChildNodes() === true) {
	      var child = DOMobject.firstChild;

	      if (child) {
	        recursiveDOMDelete(child);
	        DOMobject.removeChild(child);
	      }
	    }
	  }
	}
	/**
	 * Test whether given object is a string
	 *
	 * @param value - Input value of unknown type.
	 *
	 * @returns True if string, false otherwise.
	 */


	function isString(value) {
	  return value instanceof String || typeof value === "string";
	}
	/**
	 * Test whether given object is a object (not primitive or null).
	 *
	 * @param value - Input value of unknown type.
	 *
	 * @returns True if not null object, false otherwise.
	 */


	function isObject$1$1(value) {
	  return _typeof_1$1(value) === "object" && value !== null;
	}
	/**
	 * Test whether given object is a Date, or a String containing a Date
	 *
	 * @param value - Input value of unknown type.
	 *
	 * @returns True if Date instance or string date representation, false otherwise.
	 */


	function isDate(value) {
	  if (value instanceof Date) {
	    return true;
	  } else if (isString(value)) {
	    // test whether this string contains a date
	    var match = ASPDateRegex.exec(value);

	    if (match) {
	      return true;
	    } else if (!isNaN(Date.parse(value))) {
	      return true;
	    }
	  }

	  return false;
	}
	/**
	 * Copy property from b to a if property present in a.
	 * If property in b explicitly set to null, delete it if `allowDeletion` set.
	 *
	 * Internal helper routine, should not be exported. Not added to `exports` for that reason.
	 *
	 * @param a - Target object.
	 * @param b - Source object.
	 * @param prop - Name of property to copy from b to a.
	 * @param allowDeletion  if true, delete property in a if explicitly set to null in b
	 */


	function copyOrDelete(a, b, prop, allowDeletion) {
	  var doDeletion = false;

	  if (allowDeletion === true) {
	    doDeletion = b[prop] === null && a[prop] !== undefined;
	  }

	  if (doDeletion) {
	    delete a[prop];
	  } else {
	    a[prop] = b[prop]; // Remember, this is a reference copy!
	  }
	}
	/**
	 * Fill an object with a possibly partially defined other object.
	 *
	 * Only copies values for the properties already present in a.
	 * That means an object is not created on a property if only the b object has it.
	 *
	 * @param a - The object that will have it's properties updated.
	 * @param b - The object with property updates.
	 * @param allowDeletion - if true, delete properties in a that are explicitly set to null in b
	 */


	function fillIfDefined(a, b) {
	  var allowDeletion = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; // NOTE: iteration of properties of a
	  // NOTE: prototype properties iterated over as well

	  for (var prop in a) {
	    if (b[prop] !== undefined) {
	      if (b[prop] === null || _typeof_1$1(b[prop]) !== "object") {
	        // Note: typeof null === 'object'
	        copyOrDelete(a, b, prop, allowDeletion);
	      } else {
	        var aProp = a[prop];
	        var bProp = b[prop];

	        if (isObject$1$1(aProp) && isObject$1$1(bProp)) {
	          fillIfDefined(aProp, bProp, allowDeletion);
	        }
	      }
	    }
	  }
	}
	/**
	 * Copy the values of all of the enumerable own properties from one or more source objects to a
	 * target object. Returns the target object.
	 *
	 * @param target - The target object to copy to.
	 * @param source - The source object from which to copy properties.
	 *
	 * @return The target object.
	 */


	var extend = assign$2$1;
	/**
	 * Extend object a with selected properties of object b or a series of objects
	 * Only properties with defined values are copied
	 *
	 * @param props - Properties to be copied to a.
	 * @param a - The target.
	 * @param others - The sources.
	 *
	 * @returns Argument a.
	 */

	function selectiveExtend(props, a) {
	  if (!isArray$5(props)) {
	    throw new Error("Array with property names expected as first argument");
	  }

	  for (var _len = arguments.length, others = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
	    others[_key - 2] = arguments[_key];
	  }

	  for (var _i = 0, _others = others; _i < _others.length; _i++) {
	    var other = _others[_i];

	    for (var p = 0; p < props.length; p++) {
	      var prop = props[p];

	      if (other && Object.prototype.hasOwnProperty.call(other, prop)) {
	        a[prop] = other[prop];
	      }
	    }
	  }

	  return a;
	}
	/**
	 * Extend object a with selected properties of object b.
	 * Only properties with defined values are copied.
	 *
	 * **Note:** Previous version of this routine implied that multiple source objects
	 *           could be used; however, the implementation was **wrong**.
	 *           Since multiple (>1) sources weren't used anywhere in the `vis.js` code,
	 *           this has been removed
	 *
	 * @param props - Names of first-level properties to copy over.
	 * @param a - Target object.
	 * @param b - Source object.
	 * @param allowDeletion - If true, delete property in a if explicitly set to null in b.
	 *
	 * @returns Argument a.
	 */


	function selectiveDeepExtend(props, a, b) {
	  var allowDeletion = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; // TODO: add support for Arrays to deepExtend

	  if (isArray$5(b)) {
	    throw new TypeError("Arrays are not supported by deepExtend");
	  }

	  for (var p = 0; p < props.length; p++) {
	    var prop = props[p];

	    if (Object.prototype.hasOwnProperty.call(b, prop)) {
	      if (b[prop] && b[prop].constructor === Object) {
	        if (a[prop] === undefined) {
	          a[prop] = {};
	        }

	        if (a[prop].constructor === Object) {
	          deepExtend(a[prop], b[prop], false, allowDeletion);
	        } else {
	          copyOrDelete(a, b, prop, allowDeletion);
	        }
	      } else if (isArray$5(b[prop])) {
	        throw new TypeError("Arrays are not supported by deepExtend");
	      } else {
	        copyOrDelete(a, b, prop, allowDeletion);
	      }
	    }
	  }

	  return a;
	}
	/**
	 * Extend object `a` with properties of object `b`, ignoring properties which are explicitly
	 * specified to be excluded.
	 *
	 * The properties of `b` are considered for copying.
	 * Properties which are themselves objects are are also extended.
	 * Only properties with defined values are copied
	 *
	 * @param propsToExclude - Names of properties which should *not* be copied.
	 * @param a - Object to extend.
	 * @param b - Object to take properties from for extension.
	 * @param allowDeletion - If true, delete properties in a that are explicitly set to null in b.
	 *
	 * @returns Argument a.
	 */


	function selectiveNotDeepExtend(propsToExclude, a, b) {
	  var allowDeletion = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; // TODO: add support for Arrays to deepExtend
	  // NOTE: array properties have an else-below; apparently, there is a problem here.

	  if (isArray$5(b)) {
	    throw new TypeError("Arrays are not supported by deepExtend");
	  }

	  for (var prop in b) {
	    if (!Object.prototype.hasOwnProperty.call(b, prop)) {
	      continue;
	    } // Handle local properties only


	    if (indexOf$3$1(propsToExclude).call(propsToExclude, prop) !== -1) {
	      continue;
	    } // In exclusion list, skip


	    if (b[prop] && b[prop].constructor === Object) {
	      if (a[prop] === undefined) {
	        a[prop] = {};
	      }

	      if (a[prop].constructor === Object) {
	        deepExtend(a[prop], b[prop]); // NOTE: allowDeletion not propagated!
	      } else {
	        copyOrDelete(a, b, prop, allowDeletion);
	      }
	    } else if (isArray$5(b[prop])) {
	      a[prop] = [];

	      for (var i = 0; i < b[prop].length; i++) {
	        a[prop].push(b[prop][i]);
	      }
	    } else {
	      copyOrDelete(a, b, prop, allowDeletion);
	    }
	  }

	  return a;
	}
	/**
	 * Deep extend an object a with the properties of object b
	 *
	 * @param a - Target object.
	 * @param b - Source object.
	 * @param protoExtend - If true, the prototype values will also be extended
	 * (ie. the options objects that inherit from others will also get the inherited options).
	 * @param allowDeletion - If true, the values of fields that are null will be deleted.
	 *
	 * @returns Argument a.
	 */


	function deepExtend(a, b) {
	  var protoExtend = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
	  var allowDeletion = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;

	  for (var prop in b) {
	    if (Object.prototype.hasOwnProperty.call(b, prop) || protoExtend === true) {
	      if (_typeof_1$1(b[prop]) === "object" && b[prop] !== null && getPrototypeOf$2$1(b[prop]) === Object.prototype) {
	        if (a[prop] === undefined) {
	          a[prop] = deepExtend({}, b[prop], protoExtend); // NOTE: allowDeletion not propagated!
	        } else if (_typeof_1$1(a[prop]) === "object" && a[prop] !== null && getPrototypeOf$2$1(a[prop]) === Object.prototype) {
	          deepExtend(a[prop], b[prop], protoExtend); // NOTE: allowDeletion not propagated!
	        } else {
	          copyOrDelete(a, b, prop, allowDeletion);
	        }
	      } else if (isArray$5(b[prop])) {
	        var _context;

	        a[prop] = slice$2$1(_context = b[prop]).call(_context);
	      } else {
	        copyOrDelete(a, b, prop, allowDeletion);
	      }
	    }
	  }

	  return a;
	}
	/**
	 * Test whether all elements in two arrays are equal.
	 *
	 * @param a - First array.
	 * @param b - Second array.
	 *
	 * @returns True if both arrays have the same length and same elements (1 = '1').
	 */


	function equalArray(a, b) {
	  if (a.length !== b.length) {
	    return false;
	  }

	  for (var i = 0, len = a.length; i < len; i++) {
	    if (a[i] != b[i]) {
	      return false;
	    }
	  }

	  return true;
	}
	/**
	 * Get the type of an object, for example exports.getType([]) returns 'Array'
	 *
	 * @param object - Input value of unknown type.
	 *
	 * @returns Detected type.
	 */


	function getType(object) {
	  var type = _typeof_1$1(object);

	  if (type === "object") {
	    if (object === null) {
	      return "null";
	    }

	    if (object instanceof Boolean) {
	      return "Boolean";
	    }

	    if (object instanceof Number) {
	      return "Number";
	    }

	    if (object instanceof String) {
	      return "String";
	    }

	    if (isArray$5(object)) {
	      return "Array";
	    }

	    if (object instanceof Date) {
	      return "Date";
	    }

	    return "Object";
	  }

	  if (type === "number") {
	    return "Number";
	  }

	  if (type === "boolean") {
	    return "Boolean";
	  }

	  if (type === "string") {
	    return "String";
	  }

	  if (type === undefined) {
	    return "undefined";
	  }

	  return type;
	}
	/**
	 * Used to extend an array and copy it. This is used to propagate paths recursively.
	 *
	 * @param arr - First part.
	 * @param newValue - The value to be aadded into the array.
	 *
	 * @returns A new array with all items from arr and newValue (which is last).
	 */


	function copyAndExtendArray(arr, newValue) {
	  var _context2;

	  return concat$2$1(_context2 = []).call(_context2, toConsumableArray(arr), [newValue]);
	}
	/**
	 * Used to extend an array and copy it. This is used to propagate paths recursively.
	 *
	 * @param arr - The array to be copied.
	 *
	 * @returns Shallow copy of arr.
	 */


	function copyArray(arr) {
	  return slice$2$1(arr).call(arr);
	}
	/**
	 * Retrieve the absolute left value of a DOM element
	 *
	 * @param elem - A dom element, for example a div.
	 *
	 * @returns The absolute left position of this element in the browser page.
	 */


	function getAbsoluteLeft(elem) {
	  return elem.getBoundingClientRect().left;
	}
	/**
	 * Retrieve the absolute right value of a DOM element
	 *
	 * @param elem - A dom element, for example a div.
	 *
	 * @returns The absolute right position of this element in the browser page.
	 */


	function getAbsoluteRight(elem) {
	  return elem.getBoundingClientRect().right;
	}
	/**
	 * Retrieve the absolute top value of a DOM element
	 *
	 * @param elem - A dom element, for example a div.
	 *
	 * @returns The absolute top position of this element in the browser page.
	 */


	function getAbsoluteTop(elem) {
	  return elem.getBoundingClientRect().top;
	}
	/**
	 * Add a className to the given elements style.
	 *
	 * @param elem - The element to which the classes will be added.
	 * @param classNames - Space separated list of classes.
	 */


	function addClassName(elem, classNames) {
	  var classes = elem.className.split(" ");
	  var newClasses = classNames.split(" ");
	  classes = concat$2$1(classes).call(classes, filter$2$1(newClasses).call(newClasses, function (className) {
	    return indexOf$3$1(classes).call(classes, className) < 0;
	  }));
	  elem.className = classes.join(" ");
	}
	/**
	 * Remove a className from the given elements style.
	 *
	 * @param elem - The element from which the classes will be removed.
	 * @param classNames - Space separated list of classes.
	 */


	function removeClassName(elem, classNames) {
	  var classes = elem.className.split(" ");
	  var oldClasses = classNames.split(" ");
	  classes = filter$2$1(classes).call(classes, function (className) {
	    return indexOf$3$1(oldClasses).call(oldClasses, className) < 0;
	  });
	  elem.className = classes.join(" ");
	}
	/**
	 * For each method for both arrays and objects.
	 * In case of an array, the built-in Array.forEach() is applied (**No, it's not!**).
	 * In case of an Object, the method loops over all properties of the object.
	 *
	 * @param object - An Object or Array to be iterated over.
	 * @param callback - Array.forEach-like callback.
	 */


	function forEach$3$1(object, callback) {
	  if (isArray$5(object)) {
	    // array
	    var len = object.length;

	    for (var i = 0; i < len; i++) {
	      callback(object[i], i, object);
	    }
	  } else {
	    // object
	    for (var _key2 in object) {
	      if (Object.prototype.hasOwnProperty.call(object, _key2)) {
	        callback(object[_key2], _key2, object);
	      }
	    }
	  }
	}
	/**
	 * Convert an object into an array: all objects properties are put into the array. The resulting array is unordered.
	 *
	 * @param o - Object that contains the properties and methods.
	 *
	 * @returns An array of unordered values.
	 */


	var toArray = values$2$1;
	/**
	 * Update a property in an object
	 *
	 * @param object - The object whose property will be updated.
	 * @param key - Name of the property to be updated.
	 * @param value - The new value to be assigned.
	 *
	 * @returns Whether the value was updated (true) or already strictly the same in the original object (false).
	 */

	function updateProperty(object, key, value) {
	  if (object[key] !== value) {
	    object[key] = value;
	    return true;
	  } else {
	    return false;
	  }
	}
	/**
	 * Throttle the given function to be only executed once per animation frame.
	 *
	 * @param fn - The original function.
	 *
	 * @returns The throttled function.
	 */


	function throttle(fn) {
	  var scheduled = false;
	  return function () {
	    if (!scheduled) {
	      scheduled = true;
	      requestAnimationFrame(function () {
	        scheduled = false;
	        fn();
	      });
	    }
	  };
	}
	/**
	 * Add and event listener. Works for all browsers.
	 *
	 * @param element - The element to bind the event listener to.
	 * @param action - Same as Element.addEventListener(action, —, —).
	 * @param listener - Same as Element.addEventListener(—, listener, —).
	 * @param useCapture - Same as Element.addEventListener(—, —, useCapture).
	 */


	function addEventListener(element, action, listener, useCapture) {
	  if (element.addEventListener) {
	    var _context3;

	    if (useCapture === undefined) {
	      useCapture = false;
	    }

	    if (action === "mousewheel" && indexOf$3$1(_context3 = navigator.userAgent).call(_context3, "Firefox") >= 0) {
	      action = "DOMMouseScroll"; // For Firefox
	    }

	    element.addEventListener(action, listener, useCapture);
	  } else {
	    // @TODO: IE types? Does anyone care?
	    element.attachEvent("on" + action, listener); // IE browsers
	  }
	}
	/**
	 * Remove an event listener from an element
	 *
	 * @param element - The element to bind the event listener to.
	 * @param action - Same as Element.removeEventListener(action, —, —).
	 * @param listener - Same as Element.removeEventListener(—, listener, —).
	 * @param useCapture - Same as Element.removeEventListener(—, —, useCapture).
	 */


	function removeEventListener(element, action, listener, useCapture) {
	  if (element.removeEventListener) {
	    var _context4; // non-IE browsers


	    if (useCapture === undefined) {
	      useCapture = false;
	    }

	    if (action === "mousewheel" && indexOf$3$1(_context4 = navigator.userAgent).call(_context4, "Firefox") >= 0) {
	      action = "DOMMouseScroll"; // For Firefox
	    }

	    element.removeEventListener(action, listener, useCapture);
	  } else {
	    // @TODO: IE types? Does anyone care?
	    element.detachEvent("on" + action, listener); // IE browsers
	  }
	}
	/**
	 * Cancels the event's default action if it is cancelable, without stopping further propagation of the event.
	 *
	 * @param event - The event whose default action should be prevented.
	 */


	function preventDefault(event) {
	  if (!event) {
	    event = window.event;
	  }

	  if (!event) ;else if (event.preventDefault) {
	    event.preventDefault(); // non-IE browsers
	  } else {
	    // @TODO: IE types? Does anyone care?
	    event.returnValue = false; // IE browsers
	  }
	}
	/**
	 * Get HTML element which is the target of the event.
	 *
	 * @param event - The event.
	 *
	 * @returns The element or null if not obtainable.
	 */


	function getTarget() {
	  var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.event; // code from http://www.quirksmode.org/js/events_properties.html
	  // @TODO: EventTarget can be almost anything, is it okay to return only Elements?

	  var target = null;
	  if (!event) ;else if (event.target) {
	    target = event.target;
	  } else if (event.srcElement) {
	    target = event.srcElement;
	  }

	  if (!(target instanceof Element)) {
	    return null;
	  }

	  if (target.nodeType != null && target.nodeType == 3) {
	    // defeat Safari bug
	    target = target.parentNode;

	    if (!(target instanceof Element)) {
	      return null;
	    }
	  }

	  return target;
	}
	/**
	 * Check if given element contains given parent somewhere in the DOM tree
	 *
	 * @param element - The element to be tested.
	 * @param parent - The ancestor (not necessarily parent) of the element.
	 *
	 * @returns True if parent is an ancestor of the element, false otherwise.
	 */


	function hasParent(element, parent) {
	  var elem = element;

	  while (elem) {
	    if (elem === parent) {
	      return true;
	    } else if (elem.parentNode) {
	      elem = elem.parentNode;
	    } else {
	      return false;
	    }
	  }

	  return false;
	}

	var option = {
	  /**
	   * Convert a value into a boolean.
	   *
	   * @param value - Value to be converted intoboolean, a function will be executed as (() => unknown).
	   * @param defaultValue - If the value or the return value of the function == null then this will be returned.
	   *
	   * @returns Corresponding boolean value, if none then the default value, if none then null.
	   */
	  asBoolean: function asBoolean(value, defaultValue) {
	    if (typeof value == "function") {
	      value = value();
	    }

	    if (value != null) {
	      return value != false;
	    }

	    return defaultValue || null;
	  },

	  /**
	   * Convert a value into a number.
	   *
	   * @param value - Value to be converted intonumber, a function will be executed as (() => unknown).
	   * @param defaultValue - If the value or the return value of the function == null then this will be returned.
	   *
	   * @returns Corresponding **boxed** number value, if none then the default value, if none then null.
	   */
	  asNumber: function asNumber(value, defaultValue) {
	    if (typeof value == "function") {
	      value = value();
	    }

	    if (value != null) {
	      return Number(value) || defaultValue || null;
	    }

	    return defaultValue || null;
	  },

	  /**
	   * Convert a value into a string.
	   *
	   * @param value - Value to be converted intostring, a function will be executed as (() => unknown).
	   * @param defaultValue - If the value or the return value of the function == null then this will be returned.
	   *
	   * @returns Corresponding **boxed** string value, if none then the default value, if none then null.
	   */
	  asString: function asString(value, defaultValue) {
	    if (typeof value == "function") {
	      value = value();
	    }

	    if (value != null) {
	      return String(value);
	    }

	    return defaultValue || null;
	  },

	  /**
	   * Convert a value into a size.
	   *
	   * @param value - Value to be converted intosize, a function will be executed as (() => unknown).
	   * @param defaultValue - If the value or the return value of the function == null then this will be returned.
	   *
	   * @returns Corresponding string value (number + 'px'), if none then the default value, if none then null.
	   */
	  asSize: function asSize(value, defaultValue) {
	    if (typeof value == "function") {
	      value = value();
	    }

	    if (isString(value)) {
	      return value;
	    } else if (isNumber(value)) {
	      return value + "px";
	    } else {
	      return defaultValue || null;
	    }
	  },

	  /**
	   * Convert a value into a DOM Element.
	   *
	   * @param value - Value to be converted into DOM Element, a function will be executed as (() => unknown).
	   * @param defaultValue - If the value or the return value of the function == null then this will be returned.
	   *
	   * @returns The DOM Element, if none then the default value, if none then null.
	   */
	  asElement: function asElement(value, defaultValue) {
	    if (typeof value == "function") {
	      value = value();
	    }

	    return value || defaultValue || null;
	  }
	};
	/**
	 * Convert hex color string into RGB color object.
	 * http://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb
	 *
	 * @param hex - Hex color string (3 or 6 digits, with or without #).
	 *
	 * @returns RGB color object.
	 */

	function hexToRGB(hex) {
	  var result;

	  switch (hex.length) {
	    case 3:
	    case 4:
	      result = shortHexRE.exec(hex);
	      return result ? {
	        r: _parseInt$3$1(result[1] + result[1], 16),
	        g: _parseInt$3$1(result[2] + result[2], 16),
	        b: _parseInt$3$1(result[3] + result[3], 16)
	      } : null;

	    case 6:
	    case 7:
	      result = fullHexRE.exec(hex);
	      return result ? {
	        r: _parseInt$3$1(result[1], 16),
	        g: _parseInt$3$1(result[2], 16),
	        b: _parseInt$3$1(result[3], 16)
	      } : null;

	    default:
	      return null;
	  }
	}
	/**
	 * This function takes string color in hex or RGB format and adds the opacity, RGBA is passed through unchanged.
	 *
	 * @param color - The color string (hex, RGB, RGBA).
	 * @param opacity - The new opacity.
	 *
	 * @returns RGBA string, for example 'rgba(255, 0, 127, 0.3)'.
	 */


	function overrideOpacity(color, opacity) {
	  if (indexOf$3$1(color).call(color, "rgba") !== -1) {
	    return color;
	  } else if (indexOf$3$1(color).call(color, "rgb") !== -1) {
	    var rgb = color.substr(indexOf$3$1(color).call(color, "(") + 1).replace(")", "").split(",");
	    return "rgba(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + "," + opacity + ")";
	  } else {
	    var _rgb = hexToRGB(color);

	    if (_rgb == null) {
	      return color;
	    } else {
	      return "rgba(" + _rgb.r + "," + _rgb.g + "," + _rgb.b + "," + opacity + ")";
	    }
	  }
	}
	/**
	 * Convert RGB <0, 255> into hex color string.
	 *
	 * @param red - Red channel.
	 * @param green - Green channel.
	 * @param blue - Blue channel.
	 *
	 * @returns Hex color string (for example: '#0acdc0').
	 */


	function RGBToHex(red, green, blue) {
	  var _context5;

	  return "#" + slice$2$1(_context5 = ((1 << 24) + (red << 16) + (green << 8) + blue).toString(16)).call(_context5, 1);
	}
	/**
	 * Parse a color property into an object with border, background, and highlight colors
	 *
	 * @param inputColor - Shorthand color string or input color object.
	 * @param defaultColor - Full color object to fill in missing values in inputColor.
	 *
	 * @returns Color object.
	 */


	function parseColor(inputColor, defaultColor) {
	  if (isString(inputColor)) {
	    var colorStr = inputColor;

	    if (isValidRGB(colorStr)) {
	      var _context6;

	      var rgb = map$2$1(_context6 = colorStr.substr(4).substr(0, colorStr.length - 5).split(",")).call(_context6, function (value) {
	        return _parseInt$3$1(value);
	      });
	      colorStr = RGBToHex(rgb[0], rgb[1], rgb[2]);
	    }

	    if (isValidHex(colorStr) === true) {
	      var hsv = hexToHSV(colorStr);
	      var lighterColorHSV = {
	        h: hsv.h,
	        s: hsv.s * 0.8,
	        v: Math.min(1, hsv.v * 1.02)
	      };
	      var darkerColorHSV = {
	        h: hsv.h,
	        s: Math.min(1, hsv.s * 1.25),
	        v: hsv.v * 0.8
	      };
	      var darkerColorHex = HSVToHex(darkerColorHSV.h, darkerColorHSV.s, darkerColorHSV.v);
	      var lighterColorHex = HSVToHex(lighterColorHSV.h, lighterColorHSV.s, lighterColorHSV.v);
	      return {
	        background: colorStr,
	        border: darkerColorHex,
	        highlight: {
	          background: lighterColorHex,
	          border: darkerColorHex
	        },
	        hover: {
	          background: lighterColorHex,
	          border: darkerColorHex
	        }
	      };
	    } else {
	      return {
	        background: colorStr,
	        border: colorStr,
	        highlight: {
	          background: colorStr,
	          border: colorStr
	        },
	        hover: {
	          background: colorStr,
	          border: colorStr
	        }
	      };
	    }
	  } else {
	    if (defaultColor) {
	      var color = {
	        background: inputColor.background || defaultColor.background,
	        border: inputColor.border || defaultColor.border,
	        highlight: isString(inputColor.highlight) ? {
	          border: inputColor.highlight,
	          background: inputColor.highlight
	        } : {
	          background: inputColor.highlight && inputColor.highlight.background || defaultColor.highlight.background,
	          border: inputColor.highlight && inputColor.highlight.border || defaultColor.highlight.border
	        },
	        hover: isString(inputColor.hover) ? {
	          border: inputColor.hover,
	          background: inputColor.hover
	        } : {
	          border: inputColor.hover && inputColor.hover.border || defaultColor.hover.border,
	          background: inputColor.hover && inputColor.hover.background || defaultColor.hover.background
	        }
	      };
	      return color;
	    } else {
	      var _color = {
	        background: inputColor.background || undefined,
	        border: inputColor.border || undefined,
	        highlight: isString(inputColor.highlight) ? {
	          border: inputColor.highlight,
	          background: inputColor.highlight
	        } : {
	          background: inputColor.highlight && inputColor.highlight.background || undefined,
	          border: inputColor.highlight && inputColor.highlight.border || undefined
	        },
	        hover: isString(inputColor.hover) ? {
	          border: inputColor.hover,
	          background: inputColor.hover
	        } : {
	          border: inputColor.hover && inputColor.hover.border || undefined,
	          background: inputColor.hover && inputColor.hover.background || undefined
	        }
	      };
	      return _color;
	    }
	  }
	}
	/**
	 * Convert RGB <0, 255> into HSV object.
	 * http://www.javascripter.net/faq/rgb2hsv.htm
	 *
	 * @param red - Red channel.
	 * @param green - Green channel.
	 * @param blue - Blue channel.
	 *
	 * @returns HSV color object.
	 */


	function RGBToHSV(red, green, blue) {
	  red = red / 255;
	  green = green / 255;
	  blue = blue / 255;
	  var minRGB = Math.min(red, Math.min(green, blue));
	  var maxRGB = Math.max(red, Math.max(green, blue)); // Black-gray-white

	  if (minRGB === maxRGB) {
	    return {
	      h: 0,
	      s: 0,
	      v: minRGB
	    };
	  } // Colors other than black-gray-white:


	  var d = red === minRGB ? green - blue : blue === minRGB ? red - green : blue - red;
	  var h = red === minRGB ? 3 : blue === minRGB ? 1 : 5;
	  var hue = 60 * (h - d / (maxRGB - minRGB)) / 360;
	  var saturation = (maxRGB - minRGB) / maxRGB;
	  var value = maxRGB;
	  return {
	    h: hue,
	    s: saturation,
	    v: value
	  };
	}

	var cssUtil = {
	  // split a string with css styles into an object with key/values
	  split: function split(cssText) {
	    var _context7;

	    var styles = {};
	    forEach$2$1(_context7 = cssText.split(";")).call(_context7, function (style) {
	      if (trim$2$1(style).call(style) != "") {
	        var _context8, _context9;

	        var parts = style.split(":");

	        var _key3 = trim$2$1(_context8 = parts[0]).call(_context8);

	        var _value = trim$2$1(_context9 = parts[1]).call(_context9);

	        styles[_key3] = _value;
	      }
	    });
	    return styles;
	  },
	  // build a css text string from an object with key/values
	  join: function join(styles) {
	    var _context10;

	    return map$2$1(_context10 = keys$3$1(styles)).call(_context10, function (key) {
	      return key + ": " + styles[key];
	    }).join("; ");
	  }
	};
	/**
	 * Append a string with css styles to an element
	 *
	 * @param element - The element that will receive new styles.
	 * @param cssText - The styles to be appended.
	 */

	function addCssText(element, cssText) {
	  var currentStyles = cssUtil.split(element.style.cssText);
	  var newStyles = cssUtil.split(cssText);

	  var styles = _objectSpread({}, currentStyles, {}, newStyles);

	  element.style.cssText = cssUtil.join(styles);
	}
	/**
	 * Remove a string with css styles from an element
	 *
	 * @param element - The element from which styles should be removed.
	 * @param cssText - The styles to be removed.
	 */


	function removeCssText(element, cssText) {
	  var styles = cssUtil.split(element.style.cssText);
	  var removeStyles = cssUtil.split(cssText);

	  for (var _key4 in removeStyles) {
	    if (Object.prototype.hasOwnProperty.call(removeStyles, _key4)) {
	      delete styles[_key4];
	    }
	  }

	  element.style.cssText = cssUtil.join(styles);
	}
	/**
	 * Convert HSV <0, 1> into RGB color object.
	 * https://gist.github.com/mjijackson/5311256
	 *
	 * @param h - Hue
	 * @param s - Saturation
	 * @param v - Value
	 *
	 * @returns RGB color object.
	 */


	function HSVToRGB(h, s, v) {
	  var r;
	  var g;
	  var b;
	  var i = Math.floor(h * 6);
	  var f = h * 6 - i;
	  var p = v * (1 - s);
	  var q = v * (1 - f * s);
	  var t = v * (1 - (1 - f) * s);

	  switch (i % 6) {
	    case 0:
	      r = v, g = t, b = p;
	      break;

	    case 1:
	      r = q, g = v, b = p;
	      break;

	    case 2:
	      r = p, g = v, b = t;
	      break;

	    case 3:
	      r = p, g = q, b = v;
	      break;

	    case 4:
	      r = t, g = p, b = v;
	      break;

	    case 5:
	      r = v, g = p, b = q;
	      break;
	  }

	  return {
	    r: Math.floor(r * 255),
	    g: Math.floor(g * 255),
	    b: Math.floor(b * 255)
	  };
	}
	/**
	 * Convert HSV <0, 1> into hex color string.
	 *
	 * @param h - Hue
	 * @param s - Saturation
	 * @param v - Value
	 *
	 * @returns Hex color string.
	 */


	function HSVToHex(h, s, v) {
	  var rgb = HSVToRGB(h, s, v);
	  return RGBToHex(rgb.r, rgb.g, rgb.b);
	}
	/**
	 * Convert hex color string into HSV <0, 1>.
	 *
	 * @param hex - Hex color string.
	 *
	 * @returns HSV color object.
	 */


	function hexToHSV(hex) {
	  var rgb = hexToRGB(hex);

	  if (!rgb) {
	    throw new TypeError("'".concat(hex, "' is not a valid color."));
	  }

	  return RGBToHSV(rgb.r, rgb.g, rgb.b);
	}
	/**
	 * Validate hex color string.
	 *
	 * @param hex - Unknown string that may contain a color.
	 *
	 * @returns True if the string is valid, false otherwise.
	 */


	function isValidHex(hex) {
	  var isOk = /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(hex);
	  return isOk;
	}
	/**
	 * Validate RGB color string.
	 *
	 * @param rgb - Unknown string that may contain a color.
	 *
	 * @returns True if the string is valid, false otherwise.
	 */


	function isValidRGB(rgb) {
	  return rgbRE.test(rgb);
	}
	/**
	 * Validate RGBA color string.
	 *
	 * @param rgba - Unknown string that may contain a color.
	 *
	 * @returns True if the string is valid, false otherwise.
	 */


	function isValidRGBA(rgba) {
	  return rgbaRE.test(rgba);
	}
	/**
	 * This recursively redirects the prototype of JSON objects to the referenceObject.
	 * This is used for default options.
	 *
	 * @param fields - Names of properties to be bridged.
	 * @param referenceObject - The original object.
	 *
	 * @returns A new object inheriting from the referenceObject.
	 */


	function selectiveBridgeObject(fields, referenceObject) {
	  if (referenceObject !== null && _typeof_1$1(referenceObject) === "object") {
	    // !!! typeof null === 'object'
	    var objectTo = create$2$1(referenceObject);

	    for (var i = 0; i < fields.length; i++) {
	      if (Object.prototype.hasOwnProperty.call(referenceObject, fields[i])) {
	        if (_typeof_1$1(referenceObject[fields[i]]) == "object") {
	          objectTo[fields[i]] = bridgeObject(referenceObject[fields[i]]);
	        }
	      }
	    }

	    return objectTo;
	  } else {
	    return null;
	  }
	}
	/**
	 * This recursively redirects the prototype of JSON objects to the referenceObject.
	 * This is used for default options.
	 *
	 * @param referenceObject - The original object.
	 *
	 * @returns The Element if the referenceObject is an Element, or a new object inheriting from the referenceObject.
	 */


	function bridgeObject(referenceObject) {
	  if (referenceObject === null || _typeof_1$1(referenceObject) !== "object") {
	    return null;
	  }

	  if (referenceObject instanceof Element) {
	    // Avoid bridging DOM objects
	    return referenceObject;
	  }

	  var objectTo = create$2$1(referenceObject);

	  for (var i in referenceObject) {
	    if (Object.prototype.hasOwnProperty.call(referenceObject, i)) {
	      if (_typeof_1$1(referenceObject[i]) == "object") {
	        objectTo[i] = bridgeObject(referenceObject[i]);
	      }
	    }
	  }

	  return objectTo;
	}
	/**
	 * This method provides a stable sort implementation, very fast for presorted data.
	 *
	 * @param a - The array to be sorted (in-place).
	 * @param compare - An order comparator.
	 *
	 * @returns The argument a.
	 */


	function insertSort(a, compare) {
	  for (var i = 0; i < a.length; i++) {
	    var k = a[i];
	    var j = void 0;

	    for (j = i; j > 0 && compare(k, a[j - 1]) < 0; j--) {
	      a[j] = a[j - 1];
	    }

	    a[j] = k;
	  }

	  return a;
	}
	/**
	 * This is used to set the options of subobjects in the options object.
	 *
	 * A requirement of these subobjects is that they have an 'enabled' element
	 * which is optional for the user but mandatory for the program.
	 *
	 * The added value here of the merge is that option 'enabled' is set as required.
	 *
	 * @param mergeTarget - Either this.options or the options used for the groups.
	 * @param options - Options.
	 * @param option - Option key in the options argument.
	 * @param globalOptions - Global options, passed in to determine value of option 'enabled'.
	 */


	function mergeOptions(mergeTarget, options, option) {
	  var globalOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; // Local helpers

	  var isPresent = function isPresent(obj) {
	    return obj !== null && obj !== undefined;
	  };

	  var isObject = function isObject(obj) {
	    return obj !== null && _typeof_1$1(obj) === "object";
	  }; // https://stackoverflow.com/a/34491287/1223531


	  var isEmpty = function isEmpty(obj) {
	    for (var x in obj) {
	      if (Object.prototype.hasOwnProperty.call(obj, x)) {
	        return false;
	      }
	    }

	    return true;
	  }; // Guards


	  if (!isObject(mergeTarget)) {
	    throw new Error("Parameter mergeTarget must be an object");
	  }

	  if (!isObject(options)) {
	    throw new Error("Parameter options must be an object");
	  }

	  if (!isPresent(option)) {
	    throw new Error("Parameter option must have a value");
	  }

	  if (!isObject(globalOptions)) {
	    throw new Error("Parameter globalOptions must be an object");
	  } //
	  // Actual merge routine, separated from main logic
	  // Only a single level of options is merged. Deeper levels are ref'd. This may actually be an issue.
	  //


	  var doMerge = function doMerge(target, options, option) {
	    if (!isObject(target[option])) {
	      target[option] = {};
	    }

	    var src = options[option];
	    var dst = target[option];

	    for (var prop in src) {
	      if (Object.prototype.hasOwnProperty.call(src, prop)) {
	        dst[prop] = src[prop];
	      }
	    }
	  }; // Local initialization


	  var srcOption = options[option];
	  var globalPassed = isObject(globalOptions) && !isEmpty(globalOptions);
	  var globalOption = globalPassed ? globalOptions[option] : undefined;
	  var globalEnabled = globalOption ? globalOption.enabled : undefined; /////////////////////////////////////////
	  // Main routine
	  /////////////////////////////////////////

	  if (srcOption === undefined) {
	    return; // Nothing to do
	  }

	  if (typeof srcOption === "boolean") {
	    if (!isObject(mergeTarget[option])) {
	      mergeTarget[option] = {};
	    }

	    mergeTarget[option].enabled = srcOption;
	    return;
	  }

	  if (srcOption === null && !isObject(mergeTarget[option])) {
	    // If possible, explicit copy from globals
	    if (isPresent(globalOption)) {
	      mergeTarget[option] = create$2$1(globalOption);
	    } else {
	      return; // Nothing to do
	    }
	  }

	  if (!isObject(srcOption)) {
	    return;
	  } //
	  // Ensure that 'enabled' is properly set. It is required internally
	  // Note that the value from options will always overwrite the existing value
	  //


	  var enabled = true; // default value

	  if (srcOption.enabled !== undefined) {
	    enabled = srcOption.enabled;
	  } else {
	    // Take from globals, if present
	    if (globalEnabled !== undefined) {
	      enabled = globalOption.enabled;
	    }
	  }

	  doMerge(mergeTarget, options, option);
	  mergeTarget[option].enabled = enabled;
	}
	/**
	 * This function does a binary search for a visible item in a sorted list. If we find a visible item, the code that uses
	 * this function will then iterate in both directions over this sorted list to find all visible items.
	 *
	 * @param orderedItems - Items ordered by start
	 * @param comparator - -1 is lower, 0 is equal, 1 is higher
	 * @param field - Property name on an item (i.e. item[field]).
	 * @param field2 - Second property name on an item (i.e. item[field][field2]).
	 *
	 * @returns Index of the found item or -1 if nothing was found.
	 */


	function binarySearchCustom(orderedItems, comparator, field, field2) {
	  var maxIterations = 10000;
	  var iteration = 0;
	  var low = 0;
	  var high = orderedItems.length - 1;

	  while (low <= high && iteration < maxIterations) {
	    var middle = Math.floor((low + high) / 2);
	    var item = orderedItems[middle];

	    var _value2 = field2 === undefined ? item[field] : item[field][field2];

	    var searchResult = comparator(_value2);

	    if (searchResult == 0) {
	      // jihaa, found a visible item!
	      return middle;
	    } else if (searchResult == -1) {
	      // it is too small --> increase low
	      low = middle + 1;
	    } else {
	      // it is too big --> decrease high
	      high = middle - 1;
	    }

	    iteration++;
	  }

	  return -1;
	}
	/**
	 * This function does a binary search for a specific value in a sorted array. If it does not exist but is in between of
	 * two values, we return either the one before or the one after, depending on user input
	 * If it is found, we return the index, else -1.
	 *
	 * @param orderedItems - Sorted array.
	 * @param target - The searched value.
	 * @param field - Name of the property in items to be searched.
	 * @param sidePreference - If the target is between two values, should the index of the before or the after be returned?
	 * @param comparator - An optional comparator, returning -1, 0, 1 for <, ===, >.
	 *
	 * @returns The index of found value or -1 if nothing was found.
	 */


	function binarySearchValue(orderedItems, target, field, sidePreference, comparator) {
	  var maxIterations = 10000;
	  var iteration = 0;
	  var low = 0;
	  var high = orderedItems.length - 1;
	  var prevValue;
	  var value;
	  var nextValue;
	  var middle;
	  comparator = comparator != undefined ? comparator : function (a, b) {
	    return a == b ? 0 : a < b ? -1 : 1;
	  };

	  while (low <= high && iteration < maxIterations) {
	    // get a new guess
	    middle = Math.floor(0.5 * (high + low));
	    prevValue = orderedItems[Math.max(0, middle - 1)][field];
	    value = orderedItems[middle][field];
	    nextValue = orderedItems[Math.min(orderedItems.length - 1, middle + 1)][field];

	    if (comparator(value, target) == 0) {
	      // we found the target
	      return middle;
	    } else if (comparator(prevValue, target) < 0 && comparator(value, target) > 0) {
	      // target is in between of the previous and the current
	      return sidePreference == "before" ? Math.max(0, middle - 1) : middle;
	    } else if (comparator(value, target) < 0 && comparator(nextValue, target) > 0) {
	      // target is in between of the current and the next
	      return sidePreference == "before" ? middle : Math.min(orderedItems.length - 1, middle + 1);
	    } else {
	      // didnt find the target, we need to change our boundaries.
	      if (comparator(value, target) < 0) {
	        // it is too small --> increase low
	        low = middle + 1;
	      } else {
	        // it is too big --> decrease high
	        high = middle - 1;
	      }
	    }

	    iteration++;
	  } // didnt find anything. Return -1.


	  return -1;
	}
	/*
	 * Easing Functions.
	 * Only considering the t value for the range [0, 1] => [0, 1].
	 *
	 * Inspiration: from http://gizma.com/easing/
	 * https://gist.github.com/gre/1650294
	 */


	var easingFunctions = {
	  /**
	   * no easing, no acceleration
	   *
	   * @param t - Time.
	   *
	   * @returns Value at time t.
	   */
	  linear: function linear(t) {
	    return t;
	  },

	  /**
	   * accelerating from zero velocity
	   *
	   * @param t - Time.
	   *
	   * @returns Value at time t.
	   */
	  easeInQuad: function easeInQuad(t) {
	    return t * t;
	  },

	  /**
	   * decelerating to zero velocity
	   *
	   * @param t - Time.
	   *
	   * @returns Value at time t.
	   */
	  easeOutQuad: function easeOutQuad(t) {
	    return t * (2 - t);
	  },

	  /**
	   * acceleration until halfway, then deceleration
	   *
	   * @param t - Time.
	   *
	   * @returns Value at time t.
	   */
	  easeInOutQuad: function easeInOutQuad(t) {
	    return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
	  },

	  /**
	   * accelerating from zero velocity
	   *
	   * @param t - Time.
	   *
	   * @returns Value at time t.
	   */
	  easeInCubic: function easeInCubic(t) {
	    return t * t * t;
	  },

	  /**
	   * decelerating to zero velocity
	   *
	   * @param t - Time.
	   *
	   * @returns Value at time t.
	   */
	  easeOutCubic: function easeOutCubic(t) {
	    return --t * t * t + 1;
	  },

	  /**
	   * acceleration until halfway, then deceleration
	   *
	   * @param t - Time.
	   *
	   * @returns Value at time t.
	   */
	  easeInOutCubic: function easeInOutCubic(t) {
	    return t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;
	  },

	  /**
	   * accelerating from zero velocity
	   *
	   * @param t - Time.
	   *
	   * @returns Value at time t.
	   */
	  easeInQuart: function easeInQuart(t) {
	    return t * t * t * t;
	  },

	  /**
	   * decelerating to zero velocity
	   *
	   * @param t - Time.
	   *
	   * @returns Value at time t.
	   */
	  easeOutQuart: function easeOutQuart(t) {
	    return 1 - --t * t * t * t;
	  },

	  /**
	   * acceleration until halfway, then deceleration
	   *
	   * @param t - Time.
	   *
	   * @returns Value at time t.
	   */
	  easeInOutQuart: function easeInOutQuart(t) {
	    return t < 0.5 ? 8 * t * t * t * t : 1 - 8 * --t * t * t * t;
	  },

	  /**
	   * accelerating from zero velocity
	   *
	   * @param t - Time.
	   *
	   * @returns Value at time t.
	   */
	  easeInQuint: function easeInQuint(t) {
	    return t * t * t * t * t;
	  },

	  /**
	   * decelerating to zero velocity
	   *
	   * @param t - Time.
	   *
	   * @returns Value at time t.
	   */
	  easeOutQuint: function easeOutQuint(t) {
	    return 1 + --t * t * t * t * t;
	  },

	  /**
	   * acceleration until halfway, then deceleration
	   *
	   * @param t - Time.
	   *
	   * @returns Value at time t.
	   */
	  easeInOutQuint: function easeInOutQuint(t) {
	    return t < 0.5 ? 16 * t * t * t * t * t : 1 + 16 * --t * t * t * t * t;
	  }
	};
	/**
	 * Experimentaly compute the width of the scrollbar for this browser.
	 *
	 * @returns The width in pixels.
	 */

	function getScrollBarWidth() {
	  var inner = document.createElement("p");
	  inner.style.width = "100%";
	  inner.style.height = "200px";
	  var outer = document.createElement("div");
	  outer.style.position = "absolute";
	  outer.style.top = "0px";
	  outer.style.left = "0px";
	  outer.style.visibility = "hidden";
	  outer.style.width = "200px";
	  outer.style.height = "150px";
	  outer.style.overflow = "hidden";
	  outer.appendChild(inner);
	  document.body.appendChild(outer);
	  var w1 = inner.offsetWidth;
	  outer.style.overflow = "scroll";
	  var w2 = inner.offsetWidth;

	  if (w1 == w2) {
	    w2 = outer.clientWidth;
	  }

	  document.body.removeChild(outer);
	  return w1 - w2;
	} // @TODO: This doesn't work properly.
	// It works only for single property objects,
	// otherwise it combines all of the types in a union.
	// export function topMost<K1 extends string, V1> (
	//   pile: Record<K1, undefined | V1>[],
	//   accessors: K1 | [K1]
	// ): undefined | V1
	// export function topMost<K1 extends string, K2 extends string, V1, V2> (
	//   pile: Record<K1, undefined | V1 | Record<K2, undefined | V2>>[],
	//   accessors: [K1, K2]
	// ): undefined | V1 | V2
	// export function topMost<K1 extends string, K2 extends string, K3 extends string, V1, V2, V3> (
	//   pile: Record<K1, undefined | V1 | Record<K2, undefined | V2 | Record<K3, undefined | V3>>>[],
	//   accessors: [K1, K2, K3]
	// ): undefined | V1 | V2 | V3

	/**
	 * Get the top most property value from a pile of objects.
	 *
	 * @param pile - Array of objects, no required format.
	 * @param accessors - Array of property names (e.g. object['foo']['bar'] → ['foo', 'bar']).
	 *
	 * @returns Value of the property with given accessors path from the first pile item where it's not undefined.
	 */


	function topMost(pile, accessors) {
	  var candidate;

	  if (!isArray$5(accessors)) {
	    accessors = [accessors];
	  }

	  var _iteratorNormalCompletion = true;
	  var _didIteratorError = false;
	  var _iteratorError = undefined;

	  try {
	    for (var _iterator = getIterator$2(pile), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
	      var member = _step.value;

	      if (member) {
	        candidate = member[accessors[0]];

	        for (var i = 1; i < accessors.length; i++) {
	          if (candidate) {
	            candidate = candidate[accessors[i]];
	          }
	        }

	        if (typeof candidate !== "undefined") {
	          break;
	        }
	      }
	    }
	  } catch (err) {
	    _didIteratorError = true;
	    _iteratorError = err;
	  } finally {
	    try {
	      if (!_iteratorNormalCompletion && _iterator.return != null) {
	        _iterator.return();
	      }
	    } finally {
	      if (_didIteratorError) {
	        throw _iteratorError;
	      }
	    }
	  }

	  return candidate;
	}

	var util =
	/*#__PURE__*/
	freeze$2({
	  __proto__: null,
	  isNumber: isNumber,
	  recursiveDOMDelete: recursiveDOMDelete,
	  isString: isString,
	  isObject: isObject$1$1,
	  isDate: isDate,
	  fillIfDefined: fillIfDefined,
	  extend: extend,
	  selectiveExtend: selectiveExtend,
	  selectiveDeepExtend: selectiveDeepExtend,
	  selectiveNotDeepExtend: selectiveNotDeepExtend,
	  deepExtend: deepExtend,
	  equalArray: equalArray,
	  getType: getType,
	  copyAndExtendArray: copyAndExtendArray,
	  copyArray: copyArray,
	  getAbsoluteLeft: getAbsoluteLeft,
	  getAbsoluteRight: getAbsoluteRight,
	  getAbsoluteTop: getAbsoluteTop,
	  addClassName: addClassName,
	  removeClassName: removeClassName,
	  forEach: forEach$3$1,
	  toArray: toArray,
	  updateProperty: updateProperty,
	  throttle: throttle,
	  addEventListener: addEventListener,
	  removeEventListener: removeEventListener,
	  preventDefault: preventDefault,
	  getTarget: getTarget,
	  hasParent: hasParent,
	  option: option,
	  hexToRGB: hexToRGB,
	  overrideOpacity: overrideOpacity,
	  RGBToHex: RGBToHex,
	  parseColor: parseColor,
	  RGBToHSV: RGBToHSV,
	  addCssText: addCssText,
	  removeCssText: removeCssText,
	  HSVToRGB: HSVToRGB,
	  HSVToHex: HSVToHex,
	  hexToHSV: hexToHSV,
	  isValidHex: isValidHex,
	  isValidRGB: isValidRGB,
	  isValidRGBA: isValidRGBA,
	  selectiveBridgeObject: selectiveBridgeObject,
	  bridgeObject: bridgeObject,
	  insertSort: insertSort,
	  mergeOptions: mergeOptions,
	  binarySearchCustom: binarySearchCustom,
	  binarySearchValue: binarySearchValue,
	  easingFunctions: easingFunctions,
	  getScrollBarWidth: getScrollBarWidth,
	  topMost: topMost,
	  randomUUID: uuid4
	}); // New API (tree shakeable).

	var visUtil = /*#__PURE__*/Object.freeze({
		__proto__: null,
		'default': util,
		HSVToHex: HSVToHex,
		HSVToRGB: HSVToRGB,
		RGBToHSV: RGBToHSV,
		RGBToHex: RGBToHex,
		addClassName: addClassName,
		addCssText: addCssText,
		addEventListener: addEventListener,
		binarySearchCustom: binarySearchCustom,
		binarySearchValue: binarySearchValue,
		bridgeObject: bridgeObject,
		copyAndExtendArray: copyAndExtendArray,
		copyArray: copyArray,
		deepExtend: deepExtend,
		easingFunctions: easingFunctions,
		equalArray: equalArray,
		extend: extend,
		fillIfDefined: fillIfDefined,
		forEach: forEach$3$1,
		getAbsoluteLeft: getAbsoluteLeft,
		getAbsoluteRight: getAbsoluteRight,
		getAbsoluteTop: getAbsoluteTop,
		getScrollBarWidth: getScrollBarWidth,
		getTarget: getTarget,
		getType: getType,
		hasParent: hasParent,
		hexToHSV: hexToHSV,
		hexToRGB: hexToRGB,
		insertSort: insertSort,
		isDate: isDate,
		isNumber: isNumber,
		isObject: isObject$1$1,
		isString: isString,
		isValidHex: isValidHex,
		isValidRGB: isValidRGB,
		isValidRGBA: isValidRGBA,
		mergeOptions: mergeOptions,
		option: option,
		overrideOpacity: overrideOpacity,
		parseColor: parseColor,
		preventDefault: preventDefault,
		randomUUID: uuid4,
		recursiveDOMDelete: recursiveDOMDelete,
		removeClassName: removeClassName,
		removeCssText: removeCssText,
		removeEventListener: removeEventListener,
		selectiveBridgeObject: selectiveBridgeObject,
		selectiveDeepExtend: selectiveDeepExtend,
		selectiveExtend: selectiveExtend,
		selectiveNotDeepExtend: selectiveNotDeepExtend,
		throttle: throttle,
		toArray: toArray,
		topMost: topMost,
		updateProperty: updateProperty
	});

	var $includes = arrayIncludes.includes;


	// `Array.prototype.includes` method
	// https://tc39.github.io/ecma262/#sec-array.prototype.includes
	_export({ target: 'Array', proto: true }, {
	  includes: function includes(el /* , fromIndex = 0 */) {
	    return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
	  }
	});

	var includes = entryVirtual('Array').includes;

	var MATCH = wellKnownSymbol('match');

	// `IsRegExp` abstract operation
	// https://tc39.github.io/ecma262/#sec-isregexp
	var isRegexp = function (it) {
	  var isRegExp;
	  return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
	};

	var notARegexp = function (it) {
	  if (isRegexp(it)) {
	    throw TypeError("The method doesn't accept regular expressions");
	  } return it;
	};

	var MATCH$1 = wellKnownSymbol('match');

	var correctIsRegexpLogic = function (METHOD_NAME) {
	  var regexp = /./;
	  try {
	    '/./'[METHOD_NAME](regexp);
	  } catch (e) {
	    try {
	      regexp[MATCH$1] = false;
	      return '/./'[METHOD_NAME](regexp);
	    } catch (f) { /* empty */ }
	  } return false;
	};

	// `String.prototype.includes` method
	// https://tc39.github.io/ecma262/#sec-string.prototype.includes
	_export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('includes') }, {
	  includes: function includes(searchString /* , position = 0 */) {
	    return !!~String(requireObjectCoercible(this))
	      .indexOf(notARegexp(searchString), arguments.length > 1 ? arguments[1] : undefined);
	  }
	});

	var includes$1 = entryVirtual('String').includes;

	var ArrayPrototype$c = Array.prototype;
	var StringPrototype$2 = String.prototype;

	var includes$2 = function (it) {
	  var own = it.includes;
	  if (it === ArrayPrototype$c || (it instanceof Array && own === ArrayPrototype$c.includes)) return includes;
	  if (typeof it === 'string' || it === StringPrototype$2 || (it instanceof String && own === StringPrototype$2.includes)) {
	    return includes$1;
	  } return own;
	};

	var includes$3 = includes$2;

	var includes$4 = includes$3;

	/**
	 * Parse a text source containing data in DOT language into a JSON object.
	 * The object contains two lists: one with nodes and one with edges.
	 *
	 * DOT language reference: http://www.graphviz.org/doc/info/lang.html
	 *
	 * DOT language attributes: http://graphviz.org/content/attrs
	 *
	 * @param {string} data     Text containing a graph in DOT-notation
	 * @return {Object} graph   An object containing two parameters:
	 *                          {Object[]} nodes
	 *                          {Object[]} edges
	 *
	 * -------------------------------------------
	 * TODO
	 * ====
	 *
	 * For label handling, this is an incomplete implementation. From docs (quote #3015):
	 * 
	 * > the escape sequences "\n", "\l" and "\r" divide the label into lines, centered, 
	 * > left-justified, and right-justified, respectively.
	 *
	 * Source: http://www.graphviz.org/content/attrs#kescString
	 *
	 * > As another aid for readability, dot allows double-quoted strings to span multiple physical
	 * > lines using the standard C convention of a backslash immediately preceding a newline
	 * > character
	 * > In addition, double-quoted strings can be concatenated using a '+' operator.
	 * > As HTML strings can contain newline characters, which are used solely for formatting,
	 * > the language does not allow escaped newlines or concatenation operators to be used
	 * > within them.
	 *
	 * - Currently, only '\\n' is handled
	 * - Note that text explicitly says 'labels'; the dot parser currently handles escape
	 *   sequences in **all** strings.
	 */
	function parseDOT(data) {
	  dot = data;
	  return parseGraph();
	} // mapping of attributes from DOT (the keys) to vis.js (the values)


	var NODE_ATTR_MAPPING = {
	  'fontsize': 'font.size',
	  'fontcolor': 'font.color',
	  'labelfontcolor': 'font.color',
	  'fontname': 'font.face',
	  'color': ['color.border', 'color.background'],
	  'fillcolor': 'color.background',
	  'tooltip': 'title',
	  'labeltooltip': 'title'
	};

	var EDGE_ATTR_MAPPING = create$2(NODE_ATTR_MAPPING);

	EDGE_ATTR_MAPPING.color = 'color.color';
	EDGE_ATTR_MAPPING.style = 'dashes'; // token types enumeration

	var TOKENTYPE = {
	  NULL: 0,
	  DELIMITER: 1,
	  IDENTIFIER: 2,
	  UNKNOWN: 3
	}; // map with all delimiters

	var DELIMITERS = {
	  '{': true,
	  '}': true,
	  '[': true,
	  ']': true,
	  ';': true,
	  '=': true,
	  ',': true,
	  '->': true,
	  '--': true
	};
	var dot = ''; // current dot file

	var index = 0; // current index in dot file

	var c = ''; // current token character in expr

	var token = ''; // current token

	var tokenType = TOKENTYPE.NULL; // type of the token

	/**
	 * Get the first character from the dot file.
	 * The character is stored into the char c. If the end of the dot file is
	 * reached, the function puts an empty string in c.
	 */

	function first() {
	  index = 0;
	  c = dot.charAt(0);
	}
	/**
	 * Get the next character from the dot file.
	 * The character is stored into the char c. If the end of the dot file is
	 * reached, the function puts an empty string in c.
	 */


	function next() {
	  index++;
	  c = dot.charAt(index);
	}
	/**
	 * Preview the next character from the dot file.
	 * @return {string} cNext
	 */


	function nextPreview() {
	  return dot.charAt(index + 1);
	}

	var regexAlphaNumeric = /[a-zA-Z_0-9.:#]/;
	/**
	 * Test whether given character is alphabetic or numeric
	 * @param {string} c
	 * @return {Boolean} isAlphaNumeric
	 */

	function isAlphaNumeric(c) {
	  return regexAlphaNumeric.test(c);
	}
	/**
	 * Merge all options of object b into object b
	 * @param {Object} a
	 * @param {Object} b
	 * @return {Object} a
	 */


	function merge(a, b) {
	  if (!a) {
	    a = {};
	  }

	  if (b) {
	    for (var name in b) {
	      if (b.hasOwnProperty(name)) {
	        a[name] = b[name];
	      }
	    }
	  }

	  return a;
	}
	/**
	 * Set a value in an object, where the provided parameter name can be a
	 * path with nested parameters. For example:
	 *
	 *     var obj = {a: 2};
	 *     setValue(obj, 'b.c', 3);     // obj = {a: 2, b: {c: 3}}
	 *
	 * @param {Object} obj
	 * @param {string} path  A parameter name or dot-separated parameter path,
	 *                      like "color.highlight.border".
	 * @param {*} value
	 */


	function setValue(obj, path, value) {
	  var keys = path.split('.');
	  var o = obj;

	  while (keys.length) {
	    var key = keys.shift();

	    if (keys.length) {
	      // this isn't the end point
	      if (!o[key]) {
	        o[key] = {};
	      }

	      o = o[key];
	    } else {
	      // this is the end point
	      o[key] = value;
	    }
	  }
	}
	/**
	 * Add a node to a graph object. If there is already a node with
	 * the same id, their attributes will be merged.
	 * @param {Object} graph
	 * @param {Object} node
	 */


	function addNode(graph, node) {
	  var i, len;
	  var current = null; // find root graph (in case of subgraph)

	  var graphs = [graph]; // list with all graphs from current graph to root graph

	  var root = graph;

	  while (root.parent) {
	    graphs.push(root.parent);
	    root = root.parent;
	  } // find existing node (at root level) by its id


	  if (root.nodes) {
	    for (i = 0, len = root.nodes.length; i < len; i++) {
	      if (node.id === root.nodes[i].id) {
	        current = root.nodes[i];
	        break;
	      }
	    }
	  }

	  if (!current) {
	    // this is a new node
	    current = {
	      id: node.id
	    };

	    if (graph.node) {
	      // clone default attributes
	      current.attr = merge(current.attr, graph.node);
	    }
	  } // add node to this (sub)graph and all its parent graphs


	  for (i = graphs.length - 1; i >= 0; i--) {
	    var _context;

	    var g = graphs[i];

	    if (!g.nodes) {
	      g.nodes = [];
	    }

	    if (indexOf$3(_context = g.nodes).call(_context, current) === -1) {
	      g.nodes.push(current);
	    }
	  } // merge attributes


	  if (node.attr) {
	    current.attr = merge(current.attr, node.attr);
	  }
	}
	/**
	 * Add an edge to a graph object
	 * @param {Object} graph
	 * @param {Object} edge
	 */


	function addEdge(graph, edge) {
	  if (!graph.edges) {
	    graph.edges = [];
	  }

	  graph.edges.push(edge);

	  if (graph.edge) {
	    var attr = merge({}, graph.edge); // clone default attributes

	    edge.attr = merge(attr, edge.attr); // merge attributes
	  }
	}
	/**
	 * Create an edge to a graph object
	 * @param {Object} graph
	 * @param {string | number | Object} from
	 * @param {string | number | Object} to
	 * @param {string} type
	 * @param {Object | null} attr
	 * @return {Object} edge
	 */


	function createEdge(graph, from, to, type, attr) {
	  var edge = {
	    from: from,
	    to: to,
	    type: type
	  };

	  if (graph.edge) {
	    edge.attr = merge({}, graph.edge); // clone default attributes
	  }

	  edge.attr = merge(edge.attr || {}, attr); // merge attributes
	  // Move arrows attribute from attr to edge temporally created in
	  // parseAttributeList().

	  if (attr != null) {
	    if (attr.hasOwnProperty('arrows') && attr['arrows'] != null) {
	      edge['arrows'] = {
	        to: {
	          enabled: true,
	          type: attr.arrows.type
	        }
	      };
	      attr['arrows'] = null;
	    }
	  }

	  return edge;
	}
	/**
	 * Get next token in the current dot file.
	 * The token and token type are available as token and tokenType
	 */


	function getToken() {
	  tokenType = TOKENTYPE.NULL;
	  token = ''; // skip over whitespaces

	  while (c === ' ' || c === '\t' || c === '\n' || c === '\r') {
	    // space, tab, enter
	    next();
	  }

	  do {
	    var isComment = false; // skip comment

	    if (c === '#') {
	      // find the previous non-space character
	      var i = index - 1;

	      while (dot.charAt(i) === ' ' || dot.charAt(i) === '\t') {
	        i--;
	      }

	      if (dot.charAt(i) === '\n' || dot.charAt(i) === '') {
	        // the # is at the start of a line, this is indeed a line comment
	        while (c != '' && c != '\n') {
	          next();
	        }

	        isComment = true;
	      }
	    }

	    if (c === '/' && nextPreview() === '/') {
	      // skip line comment
	      while (c != '' && c != '\n') {
	        next();
	      }

	      isComment = true;
	    }

	    if (c === '/' && nextPreview() === '*') {
	      // skip block comment
	      while (c != '') {
	        if (c === '*' && nextPreview() === '/') {
	          // end of block comment found. skip these last two characters
	          next();
	          next();
	          break;
	        } else {
	          next();
	        }
	      }

	      isComment = true;
	    } // skip over whitespaces


	    while (c === ' ' || c === '\t' || c === '\n' || c === '\r') {
	      // space, tab, enter
	      next();
	    }
	  } while (isComment); // check for end of dot file


	  if (c === '') {
	    // token is still empty
	    tokenType = TOKENTYPE.DELIMITER;
	    return;
	  } // check for delimiters consisting of 2 characters


	  var c2 = c + nextPreview();

	  if (DELIMITERS[c2]) {
	    tokenType = TOKENTYPE.DELIMITER;
	    token = c2;
	    next();
	    next();
	    return;
	  } // check for delimiters consisting of 1 character


	  if (DELIMITERS[c]) {
	    tokenType = TOKENTYPE.DELIMITER;
	    token = c;
	    next();
	    return;
	  } // check for an identifier (number or string)
	  // TODO: more precise parsing of numbers/strings (and the port separator ':')


	  if (isAlphaNumeric(c) || c === '-') {
	    token += c;
	    next();

	    while (isAlphaNumeric(c)) {
	      token += c;
	      next();
	    }

	    if (token === 'false') {
	      token = false; // convert to boolean
	    } else if (token === 'true') {
	      token = true; // convert to boolean
	    } else if (!isNaN(Number(token))) {
	      token = Number(token); // convert to number
	    }

	    tokenType = TOKENTYPE.IDENTIFIER;
	    return;
	  } // check for a string enclosed by double quotes


	  if (c === '"') {
	    next();

	    while (c != '' && (c != '"' || c === '"' && nextPreview() === '"')) {
	      if (c === '"') {
	        // skip the escape character
	        token += c;
	        next();
	      } else if (c === '\\' && nextPreview() === 'n') {
	        // Honor a newline escape sequence
	        token += '\n';
	        next();
	      } else {
	        token += c;
	      }

	      next();
	    }

	    if (c != '"') {
	      throw newSyntaxError('End of string " expected');
	    }

	    next();
	    tokenType = TOKENTYPE.IDENTIFIER;
	    return;
	  } // something unknown is found, wrong characters, a syntax error


	  tokenType = TOKENTYPE.UNKNOWN;

	  while (c != '') {
	    token += c;
	    next();
	  }

	  throw new SyntaxError('Syntax error in part "' + chop(token, 30) + '"');
	}
	/**
	 * Parse a graph.
	 * @returns {Object} graph
	 */


	function parseGraph() {
	  var graph = {};
	  first();
	  getToken(); // optional strict keyword

	  if (token === 'strict') {
	    graph.strict = true;
	    getToken();
	  } // graph or digraph keyword


	  if (token === 'graph' || token === 'digraph') {
	    graph.type = token;
	    getToken();
	  } // optional graph id


	  if (tokenType === TOKENTYPE.IDENTIFIER) {
	    graph.id = token;
	    getToken();
	  } // open angle bracket


	  if (token != '{') {
	    throw newSyntaxError('Angle bracket { expected');
	  }

	  getToken(); // statements

	  parseStatements(graph); // close angle bracket

	  if (token != '}') {
	    throw newSyntaxError('Angle bracket } expected');
	  }

	  getToken(); // end of file

	  if (token !== '') {
	    throw newSyntaxError('End of file expected');
	  }

	  getToken(); // remove temporary default options

	  delete graph.node;
	  delete graph.edge;
	  delete graph.graph;
	  return graph;
	}
	/**
	 * Parse a list with statements.
	 * @param {Object} graph
	 */


	function parseStatements(graph) {
	  while (token !== '' && token != '}') {
	    parseStatement(graph);

	    if (token === ';') {
	      getToken();
	    }
	  }
	}
	/**
	 * Parse a single statement. Can be a an attribute statement, node
	 * statement, a series of node statements and edge statements, or a
	 * parameter.
	 * @param {Object} graph
	 */


	function parseStatement(graph) {
	  // parse subgraph
	  var subgraph = parseSubgraph(graph);

	  if (subgraph) {
	    // edge statements
	    parseEdge(graph, subgraph);
	    return;
	  } // parse an attribute statement


	  var attr = parseAttributeStatement(graph);

	  if (attr) {
	    return;
	  } // parse node


	  if (tokenType != TOKENTYPE.IDENTIFIER) {
	    throw newSyntaxError('Identifier expected');
	  }

	  var id = token; // id can be a string or a number

	  getToken();

	  if (token === '=') {
	    // id statement
	    getToken();

	    if (tokenType != TOKENTYPE.IDENTIFIER) {
	      throw newSyntaxError('Identifier expected');
	    }

	    graph[id] = token;
	    getToken(); // TODO: implement comma separated list with "a_list: ID=ID [','] [a_list] "
	  } else {
	    parseNodeStatement(graph, id);
	  }
	}
	/**
	 * Parse a subgraph
	 * @param {Object} graph    parent graph object
	 * @return {Object | null} subgraph
	 */


	function parseSubgraph(graph) {
	  var subgraph = null; // optional subgraph keyword

	  if (token === 'subgraph') {
	    subgraph = {};
	    subgraph.type = 'subgraph';
	    getToken(); // optional graph id

	    if (tokenType === TOKENTYPE.IDENTIFIER) {
	      subgraph.id = token;
	      getToken();
	    }
	  } // open angle bracket


	  if (token === '{') {
	    getToken();

	    if (!subgraph) {
	      subgraph = {};
	    }

	    subgraph.parent = graph;
	    subgraph.node = graph.node;
	    subgraph.edge = graph.edge;
	    subgraph.graph = graph.graph; // statements

	    parseStatements(subgraph); // close angle bracket

	    if (token != '}') {
	      throw newSyntaxError('Angle bracket } expected');
	    }

	    getToken(); // remove temporary default options

	    delete subgraph.node;
	    delete subgraph.edge;
	    delete subgraph.graph;
	    delete subgraph.parent; // register at the parent graph

	    if (!graph.subgraphs) {
	      graph.subgraphs = [];
	    }

	    graph.subgraphs.push(subgraph);
	  }

	  return subgraph;
	}
	/**
	 * parse an attribute statement like "node [shape=circle fontSize=16]".
	 * Available keywords are 'node', 'edge', 'graph'.
	 * The previous list with default attributes will be replaced
	 * @param {Object} graph
	 * @returns {String | null} keyword Returns the name of the parsed attribute
	 *                                  (node, edge, graph), or null if nothing
	 *                                  is parsed.
	 */


	function parseAttributeStatement(graph) {
	  // attribute statements
	  if (token === 'node') {
	    getToken(); // node attributes

	    graph.node = parseAttributeList();
	    return 'node';
	  } else if (token === 'edge') {
	    getToken(); // edge attributes

	    graph.edge = parseAttributeList();
	    return 'edge';
	  } else if (token === 'graph') {
	    getToken(); // graph attributes

	    graph.graph = parseAttributeList();
	    return 'graph';
	  }

	  return null;
	}
	/**
	 * parse a node statement
	 * @param {Object} graph
	 * @param {string | number} id
	 */


	function parseNodeStatement(graph, id) {
	  // node statement
	  var node = {
	    id: id
	  };
	  var attr = parseAttributeList();

	  if (attr) {
	    node.attr = attr;
	  }

	  addNode(graph, node); // edge statements

	  parseEdge(graph, id);
	}
	/**
	 * Parse an edge or a series of edges
	 * @param {Object} graph
	 * @param {string | number} from        Id of the from node
	 */


	function parseEdge(graph, from) {
	  while (token === '->' || token === '--') {
	    var to;
	    var type = token;
	    getToken();
	    var subgraph = parseSubgraph(graph);

	    if (subgraph) {
	      to = subgraph;
	    } else {
	      if (tokenType != TOKENTYPE.IDENTIFIER) {
	        throw newSyntaxError('Identifier or subgraph expected');
	      }

	      to = token;
	      addNode(graph, {
	        id: to
	      });
	      getToken();
	    } // parse edge attributes


	    var attr = parseAttributeList(); // create edge

	    var edge = createEdge(graph, from, to, type, attr);
	    addEdge(graph, edge);
	    from = to;
	  }
	}
	/**
	 * Parse a set with attributes,
	 * for example [label="1.000", shape=solid]
	 * @return {Object | null} attr
	 */


	function parseAttributeList() {
	  var i;
	  var attr = null; // edge styles of dot and vis

	  var edgeStyles = {
	    'dashed': true,
	    'solid': false,
	    'dotted': [1, 5]
	  };
	  /**
	   * Define arrow types.
	   * vis currently supports types defined in 'arrowTypes'.
	   * Details of arrow shapes are described in
	   * http://www.graphviz.org/content/arrow-shapes
	   */

	  var arrowTypes = {
	    dot: 'circle',
	    box: 'box',
	    crow: 'crow',
	    curve: 'curve',
	    icurve: 'inv_curve',
	    normal: 'triangle',
	    inv: 'inv_triangle',
	    diamond: 'diamond',
	    tee: 'bar',
	    vee: 'vee'
	  };
	  /**
	   * 'attr_list' contains attributes for checking if some of them are affected
	   * later. For instance, both of 'arrowhead' and 'dir' (edge style defined
	   * in DOT) make changes to 'arrows' attribute in vis.
	   */

	  var attr_list = new Array();
	  var attr_names = new Array(); // used for checking the case.
	  // parse attributes

	  while (token === '[') {
	    getToken();
	    attr = {};

	    while (token !== '' && token != ']') {
	      if (tokenType != TOKENTYPE.IDENTIFIER) {
	        throw newSyntaxError('Attribute name expected');
	      }

	      var name = token;
	      getToken();

	      if (token != '=') {
	        throw newSyntaxError('Equal sign = expected');
	      }

	      getToken();

	      if (tokenType != TOKENTYPE.IDENTIFIER) {
	        throw newSyntaxError('Attribute value expected');
	      }

	      var value = token; // convert from dot style to vis

	      if (name === 'style') {
	        value = edgeStyles[value];
	      }

	      var arrowType;

	      if (name === 'arrowhead') {
	        arrowType = arrowTypes[value];
	        name = 'arrows';
	        value = {
	          'to': {
	            'enabled': true,
	            'type': arrowType
	          }
	        };
	      }

	      if (name === 'arrowtail') {
	        arrowType = arrowTypes[value];
	        name = 'arrows';
	        value = {
	          'from': {
	            'enabled': true,
	            'type': arrowType
	          }
	        };
	      }

	      attr_list.push({
	        'attr': attr,
	        'name': name,
	        'value': value
	      });
	      attr_names.push(name);
	      getToken();

	      if (token == ',') {
	        getToken();
	      }
	    }

	    if (token != ']') {
	      throw newSyntaxError('Bracket ] expected');
	    }

	    getToken();
	  }
	  /**
	   * As explained in [1], graphviz has limitations for combination of
	   * arrow[head|tail] and dir. If attribute list includes 'dir',
	   * following cases just be supported.
	   *   1. both or none + arrowhead, arrowtail
	   *   2. forward + arrowhead (arrowtail is not affedted)
	   *   3. back + arrowtail (arrowhead is not affected)
	   * [1] https://www.graphviz.org/doc/info/attrs.html#h:undir_note
	   */


	  if (includes$4(attr_names).call(attr_names, 'dir')) {
	    var idx = {}; // get index of 'arrows' and 'dir'

	    idx.arrows = {};

	    for (i = 0; i < attr_list.length; i++) {
	      if (attr_list[i].name === 'arrows') {
	        if (attr_list[i].value.to != null) {
	          idx.arrows.to = i;
	        } else if (attr_list[i].value.from != null) {
	          idx.arrows.from = i;
	        } else {
	          throw newSyntaxError('Invalid value of arrows');
	        }
	      } else if (attr_list[i].name === 'dir') {
	        idx.dir = i;
	      }
	    } // first, add default arrow shape if it is not assigned to avoid error


	    var dir_type = attr_list[idx.dir].value;

	    if (!includes$4(attr_names).call(attr_names, 'arrows')) {
	      if (dir_type === 'both') {
	        attr_list.push({
	          'attr': attr_list[idx.dir].attr,
	          'name': 'arrows',
	          'value': {
	            to: {
	              enabled: true
	            }
	          }
	        });
	        idx.arrows.to = attr_list.length - 1;
	        attr_list.push({
	          'attr': attr_list[idx.dir].attr,
	          'name': 'arrows',
	          'value': {
	            from: {
	              enabled: true
	            }
	          }
	        });
	        idx.arrows.from = attr_list.length - 1;
	      } else if (dir_type === 'forward') {
	        attr_list.push({
	          'attr': attr_list[idx.dir].attr,
	          'name': 'arrows',
	          'value': {
	            to: {
	              enabled: true
	            }
	          }
	        });
	        idx.arrows.to = attr_list.length - 1;
	      } else if (dir_type === 'back') {
	        attr_list.push({
	          'attr': attr_list[idx.dir].attr,
	          'name': 'arrows',
	          'value': {
	            from: {
	              enabled: true
	            }
	          }
	        });
	        idx.arrows.from = attr_list.length - 1;
	      } else if (dir_type === 'none') {
	        attr_list.push({
	          'attr': attr_list[idx.dir].attr,
	          'name': 'arrows',
	          'value': ''
	        });
	        idx.arrows.to = attr_list.length - 1;
	      } else {
	        throw newSyntaxError('Invalid dir type "' + dir_type + '"');
	      }
	    }

	    var from_type;
	    var to_type; // update 'arrows' attribute from 'dir'.

	    if (dir_type === 'both') {
	      // both of shapes of 'from' and 'to' are given
	      if (idx.arrows.to && idx.arrows.from) {
	        to_type = attr_list[idx.arrows.to].value.to.type;
	        from_type = attr_list[idx.arrows.from].value.from.type;
	        attr_list[idx.arrows.to] = {
	          'attr': attr_list[idx.arrows.to].attr,
	          'name': attr_list[idx.arrows.to].name,
	          'value': {
	            to: {
	              enabled: true,
	              type: to_type
	            },
	            from: {
	              enabled: true,
	              type: from_type
	            }
	          }
	        };

	        splice$2(attr_list).call(attr_list, idx.arrows.from, 1); // shape of 'to' is assigned and use default to 'from'

	      } else if (idx.arrows.to) {
	        to_type = attr_list[idx.arrows.to].value.to.type;
	        from_type = 'arrow';
	        attr_list[idx.arrows.to] = {
	          'attr': attr_list[idx.arrows.to].attr,
	          'name': attr_list[idx.arrows.to].name,
	          'value': {
	            to: {
	              enabled: true,
	              type: to_type
	            },
	            from: {
	              enabled: true,
	              type: from_type
	            }
	          }
	        }; // only shape of 'from' is assigned and use default for 'to'
	      } else if (idx.arrows.from) {
	        to_type = 'arrow';
	        from_type = attr_list[idx.arrows.from].value.from.type;
	        attr_list[idx.arrows.from] = {
	          'attr': attr_list[idx.arrows.from].attr,
	          'name': attr_list[idx.arrows.from].name,
	          'value': {
	            to: {
	              enabled: true,
	              type: to_type
	            },
	            from: {
	              enabled: true,
	              type: from_type
	            }
	          }
	        };
	      }
	    } else if (dir_type === 'back') {
	      // given both of shapes, but use only 'from'
	      if (idx.arrows.to && idx.arrows.from) {
	        to_type = '';
	        from_type = attr_list[idx.arrows.from].value.from.type;
	        attr_list[idx.arrows.from] = {
	          'attr': attr_list[idx.arrows.from].attr,
	          'name': attr_list[idx.arrows.from].name,
	          'value': {
	            to: {
	              enabled: true,
	              type: to_type
	            },
	            from: {
	              enabled: true,
	              type: from_type
	            }
	          }
	        }; // given shape of 'to', but does not use it
	      } else if (idx.arrows.to) {
	        to_type = '';
	        from_type = 'arrow';
	        idx.arrows.from = idx.arrows.to;
	        attr_list[idx.arrows.from] = {
	          'attr': attr_list[idx.arrows.from].attr,
	          'name': attr_list[idx.arrows.from].name,
	          'value': {
	            to: {
	              enabled: true,
	              type: to_type
	            },
	            from: {
	              enabled: true,
	              type: from_type
	            }
	          }
	        }; // assign given 'from' shape
	      } else if (idx.arrows.from) {
	        to_type = '';
	        from_type = attr_list[idx.arrows.from].value.from.type;
	        attr_list[idx.arrows.to] = {
	          'attr': attr_list[idx.arrows.from].attr,
	          'name': attr_list[idx.arrows.from].name,
	          'value': {
	            to: {
	              enabled: true,
	              type: to_type
	            },
	            from: {
	              enabled: true,
	              type: from_type
	            }
	          }
	        };
	      }

	      attr_list[idx.arrows.from] = {
	        'attr': attr_list[idx.arrows.from].attr,
	        'name': attr_list[idx.arrows.from].name,
	        'value': {
	          from: {
	            enabled: true,
	            type: attr_list[idx.arrows.from].value.from.type
	          }
	        }
	      };
	    } else if (dir_type === 'none') {
	      var idx_arrow;

	      if (idx.arrows.to) {
	        idx_arrow = idx.arrows.to;
	      } else {
	        idx_arrow = idx.arrows.from;
	      }

	      attr_list[idx_arrow] = {
	        'attr': attr_list[idx_arrow].attr,
	        'name': attr_list[idx_arrow].name,
	        'value': ''
	      };
	    } else if (dir_type === 'forward') {
	      // given both of shapes, but use only 'to'
	      if (idx.arrows.to && idx.arrows.from) {
	        to_type = attr_list[idx.arrows.to].value.to.type;
	        from_type = '';
	        attr_list[idx.arrows.to] = {
	          'attr': attr_list[idx.arrows.to].attr,
	          'name': attr_list[idx.arrows.to].name,
	          'value': {
	            to: {
	              enabled: true,
	              type: to_type
	            },
	            from: {
	              enabled: true,
	              type: from_type
	            }
	          }
	        }; // assign given 'to' shape
	      } else if (idx.arrows.to) {
	        to_type = attr_list[idx.arrows.to].value.to.type;
	        from_type = '';
	        attr_list[idx.arrows.to] = {
	          'attr': attr_list[idx.arrows.to].attr,
	          'name': attr_list[idx.arrows.to].name,
	          'value': {
	            to: {
	              enabled: true,
	              type: to_type
	            },
	            from: {
	              enabled: true,
	              type: from_type
	            }
	          }
	        }; // given shape of 'from', but does not use it
	      } else if (idx.arrows.from) {
	        to_type = 'arrow';
	        from_type = '';
	        idx.arrows.to = idx.arrows.from;
	        attr_list[idx.arrows.to] = {
	          'attr': attr_list[idx.arrows.to].attr,
	          'name': attr_list[idx.arrows.to].name,
	          'value': {
	            to: {
	              enabled: true,
	              type: to_type
	            },
	            from: {
	              enabled: true,
	              type: from_type
	            }
	          }
	        };
	      }

	      attr_list[idx.arrows.to] = {
	        'attr': attr_list[idx.arrows.to].attr,
	        'name': attr_list[idx.arrows.to].name,
	        'value': {
	          to: {
	            enabled: true,
	            type: attr_list[idx.arrows.to].value.to.type
	          }
	        }
	      };
	    } else {
	      throw newSyntaxError('Invalid dir type "' + dir_type + '"');
	    } // remove 'dir' attribute no need anymore


	    splice$2(attr_list).call(attr_list, idx.dir, 1);
	  } // parse 'penwidth'


	  var nof_attr_list;

	  if (includes$4(attr_names).call(attr_names, 'penwidth')) {
	    var tmp_attr_list = [];
	    nof_attr_list = attr_list.length;

	    for (i = 0; i < nof_attr_list; i++) {
	      // exclude 'width' from attr_list if 'penwidth' exists
	      if (attr_list[i].name !== 'width') {
	        if (attr_list[i].name === 'penwidth') {
	          attr_list[i].name = 'width';
	        }

	        tmp_attr_list.push(attr_list[i]);
	      }
	    }

	    attr_list = tmp_attr_list;
	  }

	  nof_attr_list = attr_list.length;

	  for (i = 0; i < nof_attr_list; i++) {
	    setValue(attr_list[i].attr, attr_list[i].name, attr_list[i].value);
	  }

	  return attr;
	}
	/**
	 * Create a syntax error with extra information on current token and index.
	 * @param {string} message
	 * @returns {SyntaxError} err
	 */


	function newSyntaxError(message) {
	  return new SyntaxError(message + ', got "' + chop(token, 30) + '" (char ' + index + ')');
	}
	/**
	 * Chop off text after a maximum length
	 * @param {string} text
	 * @param {number} maxLength
	 * @returns {String}
	 */


	function chop(text, maxLength) {
	  return text.length <= maxLength ? text : text.substr(0, 27) + '...';
	}
	/**
	 * Execute a function fn for each pair of elements in two arrays
	 * @param {Array | *} array1
	 * @param {Array | *} array2
	 * @param {function} fn
	 */


	function forEach2(array1, array2, fn) {
	  if (isArray$3(array1)) {
	    forEach$2(array1).call(array1, function (elem1) {
	      if (isArray$3(array2)) {
	        forEach$2(array2).call(array2, function (elem2) {
	          fn(elem1, elem2);
	        });
	      } else {
	        fn(elem1, array2);
	      }
	    });
	  } else {
	    if (isArray$3(array2)) {
	      forEach$2(array2).call(array2, function (elem2) {
	        fn(array1, elem2);
	      });
	    } else {
	      fn(array1, array2);
	    }
	  }
	}
	/**
	 * Set a nested property on an object
	 * When nested objects are missing, they will be created.
	 * For example setProp({}, 'font.color', 'red') will return {font: {color: 'red'}}
	 * @param {Object} object
	 * @param {string} path   A dot separated string like 'font.color'
	 * @param {*} value       Value for the property
	 * @return {Object} Returns the original object, allows for chaining.
	 */


	function setProp(object, path, value) {
	  var names = path.split('.');
	  var prop = names.pop(); // traverse over the nested objects

	  var obj = object;

	  for (var i = 0; i < names.length; i++) {
	    var name = names[i];

	    if (!(name in obj)) {
	      obj[name] = {};
	    }

	    obj = obj[name];
	  } // set the property value


	  obj[prop] = value;
	  return object;
	}
	/**
	 * Convert an object with DOT attributes to their vis.js equivalents.
	 * @param {Object} attr     Object with DOT attributes
	 * @param {Object} mapping
	 * @return {Object}         Returns an object with vis.js attributes
	 */


	function convertAttr(attr, mapping) {
	  var converted = {};

	  for (var prop in attr) {
	    if (attr.hasOwnProperty(prop)) {
	      var visProp = mapping[prop];

	      if (isArray$3(visProp)) {
	        forEach$2(visProp).call(visProp, function (visPropI) {
	          setProp(converted, visPropI, attr[prop]);
	        });
	      } else if (typeof visProp === 'string') {
	        setProp(converted, visProp, attr[prop]);
	      } else {
	        setProp(converted, prop, attr[prop]);
	      }
	    }
	  }

	  return converted;
	}
	/**
	 * Convert a string containing a graph in DOT language into a map containing
	 * with nodes and edges in the format of graph.
	 * @param {string} data         Text containing a graph in DOT-notation
	 * @return {Object} graphData
	 */


	function DOTToGraph(data) {
	  // parse the DOT file
	  var dotData = parseDOT(data);
	  var graphData = {
	    nodes: [],
	    edges: [],
	    options: {}
	  }; // copy the nodes

	  if (dotData.nodes) {
	    var _context2;

	    forEach$2(_context2 = dotData.nodes).call(_context2, function (dotNode) {
	      var graphNode = {
	        id: dotNode.id,
	        label: String(dotNode.label || dotNode.id)
	      };
	      merge(graphNode, convertAttr(dotNode.attr, NODE_ATTR_MAPPING));

	      if (graphNode.image) {
	        graphNode.shape = 'image';
	      }

	      graphData.nodes.push(graphNode);
	    });
	  } // copy the edges


	  if (dotData.edges) {
	    var _context3;

	    /**
	     * Convert an edge in DOT format to an edge with VisGraph format
	     * @param {Object} dotEdge
	     * @returns {Object} graphEdge
	     */
	    var convertEdge = function convertEdge(dotEdge) {
	      var graphEdge = {
	        from: dotEdge.from,
	        to: dotEdge.to
	      };
	      merge(graphEdge, convertAttr(dotEdge.attr, EDGE_ATTR_MAPPING)); // Add arrows attribute to default styled arrow.
	      // The reason why default style is not added in parseAttributeList() is
	      // because only default is cleared before here.

	      if (graphEdge.arrows == null && dotEdge.type === '->') {
	        graphEdge.arrows = 'to';
	      }

	      return graphEdge;
	    };

	    forEach$2(_context3 = dotData.edges).call(_context3, function (dotEdge) {
	      var from, to;

	      if (dotEdge.from instanceof Object) {
	        from = dotEdge.from.nodes;
	      } else {
	        from = {
	          id: dotEdge.from
	        };
	      }

	      if (dotEdge.to instanceof Object) {
	        to = dotEdge.to.nodes;
	      } else {
	        to = {
	          id: dotEdge.to
	        };
	      }

	      if (dotEdge.from instanceof Object && dotEdge.from.edges) {
	        var _context4;

	        forEach$2(_context4 = dotEdge.from.edges).call(_context4, function (subEdge) {
	          var graphEdge = convertEdge(subEdge);
	          graphData.edges.push(graphEdge);
	        });
	      }

	      forEach2(from, to, function (from, to) {
	        var subEdge = createEdge(graphData, from.id, to.id, dotEdge.type, dotEdge.attr);
	        var graphEdge = convertEdge(subEdge);
	        graphData.edges.push(graphEdge);
	      });

	      if (dotEdge.to instanceof Object && dotEdge.to.edges) {
	        var _context5;

	        forEach$2(_context5 = dotEdge.to.edges).call(_context5, function (subEdge) {
	          var graphEdge = convertEdge(subEdge);
	          graphData.edges.push(graphEdge);
	        });
	      }
	    });
	  } // copy the options


	  if (dotData.attr) {
	    graphData.options = dotData.attr;
	  }

	  return graphData;
	} // exports


	var parseDOT_1 = parseDOT;
	var DOTToGraph_1 = DOTToGraph;
	var dotparser = {
	  parseDOT: parseDOT_1,
	  DOTToGraph: DOTToGraph_1
	};

	var dotparser$1 = /*#__PURE__*/Object.freeze({
		__proto__: null,
		'default': dotparser,
		__moduleExports: dotparser,
		parseDOT: parseDOT_1,
		DOTToGraph: DOTToGraph_1
	});

	/**
	 * Convert Gephi to Vis.
	 *
	 * @param gephiJSON - The parsed JSON data in Gephi format.
	 * @param optionsObj - Additional options.
	 *
	 * @returns The converted data ready to be used in Vis.
	 */
	function parseGephi(gephiJSON, optionsObj) {
	  var _context;

	  var options = {
	    edges: {
	      inheritColor: false
	    },
	    nodes: {
	      fixed: false,
	      parseColor: false
	    }
	  };

	  if (optionsObj != null) {
	    if (optionsObj.fixed != null) {
	      options.nodes.fixed = optionsObj.fixed;
	    }

	    if (optionsObj.parseColor != null) {
	      options.nodes.parseColor = optionsObj.parseColor;
	    }

	    if (optionsObj.inheritColor != null) {
	      options.edges.inheritColor = optionsObj.inheritColor;
	    }
	  }

	  var gEdges = gephiJSON.edges;

	  var vEdges = map$2(gEdges).call(gEdges, function (gEdge) {
	    var vEdge = {
	      from: gEdge.source,
	      id: gEdge.id,
	      to: gEdge.target
	    };

	    if (gEdge.attributes != null) {
	      vEdge.attributes = gEdge.attributes;
	    }

	    if (gEdge.label != null) {
	      vEdge.label = gEdge.label;
	    }

	    if (gEdge.attributes != null && gEdge.attributes.title != null) {
	      vEdge.title = gEdge.attributes.title;
	    }

	    if (gEdge.type === 'Directed') {
	      vEdge.arrows = 'to';
	    } // edge['value'] = gEdge.attributes != null ? gEdge.attributes.Weight : undefined;
	    // edge['width'] = edge['value'] != null ? undefined : edgegEdge.size;


	    if (gEdge.color && options.edges.inheritColor === false) {
	      vEdge.color = gEdge.color;
	    }

	    return vEdge;
	  });

	  var vNodes = map$2(_context = gephiJSON.nodes).call(_context, function (gNode) {
	    var vNode = {
	      id: gNode.id,
	      fixed: options.nodes.fixed && gNode.x != null && gNode.y != null
	    };

	    if (gNode.attributes != null) {
	      vNode.attributes = gNode.attributes;
	    }

	    if (gNode.label != null) {
	      vNode.label = gNode.label;
	    }

	    if (gNode.size != null) {
	      vNode.size = gNode.size;
	    }

	    if (gNode.attributes != null && gNode.attributes.title != null) {
	      vNode.title = gNode.attributes.title;
	    }

	    if (gNode.title != null) {
	      vNode.title = gNode.title;
	    }

	    if (gNode.x != null) {
	      vNode.x = gNode.x;
	    }

	    if (gNode.y != null) {
	      vNode.y = gNode.y;
	    }

	    if (gNode.color != null) {
	      if (options.nodes.parseColor === true) {
	        vNode.color = gNode.color;
	      } else {
	        vNode.color = {
	          background: gNode.color,
	          border: gNode.color,
	          highlight: {
	            background: gNode.color,
	            border: gNode.color
	          },
	          hover: {
	            background: gNode.color,
	            border: gNode.color
	          }
	        };
	      }
	    }

	    return vNode;
	  });

	  return {
	    nodes: vNodes,
	    edges: vEdges
	  };
	}

	var gephiParser = /*#__PURE__*/Object.freeze({
		__proto__: null,
		parseGephi: parseGephi
	});

	function styleInject(css, ref) {
	  if (ref === void 0) ref = {};
	  var insertAt = ref.insertAt;

	  if (!css || typeof document === 'undefined') {
	    return;
	  }

	  var head = document.head || document.getElementsByTagName('head')[0];
	  var style = document.createElement('style');
	  style.type = 'text/css';

	  if (insertAt === 'top') {
	    if (head.firstChild) {
	      head.insertBefore(style, head.firstChild);
	    } else {
	      head.appendChild(style);
	    }
	  } else {
	    head.appendChild(style);
	  }

	  if (style.styleSheet) {
	    style.styleSheet.cssText = css;
	  } else {
	    style.appendChild(document.createTextNode(css));
	  }
	}

	var css = ".vis-overlay {\n  position: absolute;\n  top: 0px;\n  right: 0px;\n  bottom: 0px;\n  left: 0px;\n\n  /* Must be displayed above for example selected Timeline items */\n  z-index: 10;\n}\n\n.vis-active {\n  box-shadow: 0 0 10px #86d5f8;\n}\n\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkFjdGl2YXRvci5jc3MiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7RUFDRSxrQkFBa0I7RUFDbEIsUUFBUTtFQUNSLFVBQVU7RUFDVixXQUFXO0VBQ1gsU0FBUzs7RUFFVCxnRUFBZ0U7RUFDaEUsV0FBVztBQUNiOztBQUVBO0VBQ0UsNEJBQTRCO0FBQzlCIiwiZmlsZSI6IkFjdGl2YXRvci5jc3MiLCJzb3VyY2VzQ29udGVudCI6WyIudmlzLW92ZXJsYXkge1xuICBwb3NpdGlvbjogYWJzb2x1dGU7XG4gIHRvcDogMHB4O1xuICByaWdodDogMHB4O1xuICBib3R0b206IDBweDtcbiAgbGVmdDogMHB4O1xuXG4gIC8qIE11c3QgYmUgZGlzcGxheWVkIGFib3ZlIGZvciBleGFtcGxlIHNlbGVjdGVkIFRpbWVsaW5lIGl0ZW1zICovXG4gIHotaW5kZXg6IDEwO1xufVxuXG4udmlzLWFjdGl2ZSB7XG4gIGJveC1zaGFkb3c6IDAgMCAxMHB4ICM4NmQ1Zjg7XG59XG4iXX0= */";
	styleInject(css);

	var Activator = /*#__PURE__*/Object.freeze({
		__proto__: null,
		'default': css
	});

	var keycharm = createCommonjsModule(function (module, exports) {
	  /**
	   * Created by Alex on 11/6/2014.
	   */
	  // https://github.com/umdjs/umd/blob/master/returnExports.js#L40-L60
	  // if the module has no dependencies, the above pattern can be simplified to

	  (function (root, factory) {
	    {
	      // Node. Does not work with strict CommonJS, but
	      // only CommonJS-like environments that support module.exports,
	      // like Node.
	      module.exports = factory();
	    }
	  })(commonjsGlobal, function () {
	    function keycharm(options) {
	      var preventDefault = options && options.preventDefault || false;
	      var container = options && options.container || window;
	      var _exportFunctions = {};
	      var _bound = {
	        keydown: {},
	        keyup: {}
	      };
	      var _keys = {};
	      var i; // a - z

	      for (i = 97; i <= 122; i++) {
	        _keys[String.fromCharCode(i)] = {
	          code: 65 + (i - 97),
	          shift: false
	        };
	      } // A - Z


	      for (i = 65; i <= 90; i++) {
	        _keys[String.fromCharCode(i)] = {
	          code: i,
	          shift: true
	        };
	      } // 0 - 9


	      for (i = 0; i <= 9; i++) {
	        _keys['' + i] = {
	          code: 48 + i,
	          shift: false
	        };
	      } // F1 - F12


	      for (i = 1; i <= 12; i++) {
	        _keys['F' + i] = {
	          code: 111 + i,
	          shift: false
	        };
	      } // num0 - num9


	      for (i = 0; i <= 9; i++) {
	        _keys['num' + i] = {
	          code: 96 + i,
	          shift: false
	        };
	      } // numpad misc


	      _keys['num*'] = {
	        code: 106,
	        shift: false
	      };
	      _keys['num+'] = {
	        code: 107,
	        shift: false
	      };
	      _keys['num-'] = {
	        code: 109,
	        shift: false
	      };
	      _keys['num/'] = {
	        code: 111,
	        shift: false
	      };
	      _keys['num.'] = {
	        code: 110,
	        shift: false
	      }; // arrows

	      _keys['left'] = {
	        code: 37,
	        shift: false
	      };
	      _keys['up'] = {
	        code: 38,
	        shift: false
	      };
	      _keys['right'] = {
	        code: 39,
	        shift: false
	      };
	      _keys['down'] = {
	        code: 40,
	        shift: false
	      }; // extra keys

	      _keys['space'] = {
	        code: 32,
	        shift: false
	      };
	      _keys['enter'] = {
	        code: 13,
	        shift: false
	      };
	      _keys['shift'] = {
	        code: 16,
	        shift: undefined
	      };
	      _keys['esc'] = {
	        code: 27,
	        shift: false
	      };
	      _keys['backspace'] = {
	        code: 8,
	        shift: false
	      };
	      _keys['tab'] = {
	        code: 9,
	        shift: false
	      };
	      _keys['ctrl'] = {
	        code: 17,
	        shift: false
	      };
	      _keys['alt'] = {
	        code: 18,
	        shift: false
	      };
	      _keys['delete'] = {
	        code: 46,
	        shift: false
	      };
	      _keys['pageup'] = {
	        code: 33,
	        shift: false
	      };
	      _keys['pagedown'] = {
	        code: 34,
	        shift: false
	      }; // symbols

	      _keys['='] = {
	        code: 187,
	        shift: false
	      };
	      _keys['-'] = {
	        code: 189,
	        shift: false
	      };
	      _keys[']'] = {
	        code: 221,
	        shift: false
	      };
	      _keys['['] = {
	        code: 219,
	        shift: false
	      };

	      var down = function down(event) {
	        handleEvent(event, 'keydown');
	      };

	      var up = function up(event) {
	        handleEvent(event, 'keyup');
	      }; // handle the actualy bound key with the event


	      var handleEvent = function handleEvent(event, type) {
	        if (_bound[type][event.keyCode] !== undefined) {
	          var bound = _bound[type][event.keyCode];

	          for (var i = 0; i < bound.length; i++) {
	            if (bound[i].shift === undefined) {
	              bound[i].fn(event);
	            } else if (bound[i].shift == true && event.shiftKey == true) {
	              bound[i].fn(event);
	            } else if (bound[i].shift == false && event.shiftKey == false) {
	              bound[i].fn(event);
	            }
	          }

	          if (preventDefault == true) {
	            event.preventDefault();
	          }
	        }
	      }; // bind a key to a callback


	      _exportFunctions.bind = function (key, callback, type) {
	        if (type === undefined) {
	          type = 'keydown';
	        }

	        if (_keys[key] === undefined) {
	          throw new Error("unsupported key: " + key);
	        }

	        if (_bound[type][_keys[key].code] === undefined) {
	          _bound[type][_keys[key].code] = [];
	        }

	        _bound[type][_keys[key].code].push({
	          fn: callback,
	          shift: _keys[key].shift
	        });
	      }; // bind all keys to a call back (demo purposes)


	      _exportFunctions.bindAll = function (callback, type) {
	        if (type === undefined) {
	          type = 'keydown';
	        }

	        for (var key in _keys) {
	          if (_keys.hasOwnProperty(key)) {
	            bind$2(_exportFunctions).call(_exportFunctions, key, callback, type);
	          }
	        }
	      }; // get the key label from an event


	      _exportFunctions.getKey = function (event) {
	        for (var key in _keys) {
	          if (_keys.hasOwnProperty(key)) {
	            if (event.shiftKey == true && _keys[key].shift == true && event.keyCode == _keys[key].code) {
	              return key;
	            } else if (event.shiftKey == false && _keys[key].shift == false && event.keyCode == _keys[key].code) {
	              return key;
	            } else if (event.keyCode == _keys[key].code && key == 'shift') {
	              return key;
	            }
	          }
	        }

	        return "unknown key, currently not supported";
	      }; // unbind either a specific callback from a key or all of them (by leaving callback undefined)


	      _exportFunctions.unbind = function (key, callback, type) {
	        if (type === undefined) {
	          type = 'keydown';
	        }

	        if (_keys[key] === undefined) {
	          throw new Error("unsupported key: " + key);
	        }

	        if (callback !== undefined) {
	          var newBindings = [];
	          var bound = _bound[type][_keys[key].code];

	          if (bound !== undefined) {
	            for (var i = 0; i < bound.length; i++) {
	              if (!(bound[i].fn == callback && bound[i].shift == _keys[key].shift)) {
	                newBindings.push(_bound[type][_keys[key].code][i]);
	              }
	            }
	          }

	          _bound[type][_keys[key].code] = newBindings;
	        } else {
	          _bound[type][_keys[key].code] = [];
	        }
	      }; // reset all bound variables.


	      _exportFunctions.reset = function () {
	        _bound = {
	          keydown: {},
	          keyup: {}
	        };
	      }; // unbind all listeners and reset all variables.


	      _exportFunctions.destroy = function () {
	        _bound = {
	          keydown: {},
	          keyup: {}
	        };
	        container.removeEventListener('keydown', down, true);
	        container.removeEventListener('keyup', up, true);
	      }; // create listeners.


	      container.addEventListener('keydown', down, true);
	      container.addEventListener('keyup', up, true); // return the public functions.

	      return _exportFunctions;
	    }

	    return keycharm;
	  });
	});

	var slice$5 = [].slice;
	var MSIE = /MSIE .\./.test(userAgent); // <- dirty ie9- check

	var wrap$2 = function (scheduler) {
	  return function (handler, timeout /* , ...arguments */) {
	    var boundArgs = arguments.length > 2;
	    var args = boundArgs ? slice$5.call(arguments, 2) : undefined;
	    return scheduler(boundArgs ? function () {
	      // eslint-disable-next-line no-new-func
	      (typeof handler == 'function' ? handler : Function(handler)).apply(this, args);
	    } : handler, timeout);
	  };
	};

	// ie9- setTimeout & setInterval additional parameters fix
	// https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#timers
	_export({ global: true, bind: true, forced: MSIE }, {
	  // `setTimeout` method
	  // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-settimeout
	  setTimeout: wrap$2(global_1.setTimeout),
	  // `setInterval` method
	  // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-setinterval
	  setInterval: wrap$2(global_1.setInterval)
	});

	var setTimeout$1 = path.setTimeout;

	var setTimeout$2 = setTimeout$1;

	var test$2 = [];
	var nativeSort = test$2.sort;

	// IE8-
	var FAILS_ON_UNDEFINED = fails(function () {
	  test$2.sort(undefined);
	});
	// V8 bug
	var FAILS_ON_NULL = fails(function () {
	  test$2.sort(null);
	});
	// Old WebKit
	var SLOPPY_METHOD$2 = sloppyArrayMethod('sort');

	var FORCED$4 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || SLOPPY_METHOD$2;

	// `Array.prototype.sort` method
	// https://tc39.github.io/ecma262/#sec-array.prototype.sort
	_export({ target: 'Array', proto: true, forced: FORCED$4 }, {
	  sort: function sort(comparefn) {
	    return comparefn === undefined
	      ? nativeSort.call(toObject(this))
	      : nativeSort.call(toObject(this), aFunction(comparefn));
	  }
	});

	var sort = entryVirtual('Array').sort;

	var ArrayPrototype$d = Array.prototype;

	var sort_1 = function (it) {
	  var own = it.sort;
	  return it === ArrayPrototype$d || (it instanceof Array && own === ArrayPrototype$d.sort) ? sort : own;
	};

	var sort$1 = sort_1;

	var sort$2 = sort$1;

	// `Date.now` method
	// https://tc39.github.io/ecma262/#sec-date.now
	_export({ target: 'Date', stat: true }, {
	  now: function now() {
	    return new Date().getTime();
	  }
	});

	var now = path.Date.now;

	var now$1 = now;

	var now$2 = now$1;

	/*! Hammer.JS - v2.0.16 - 2019-11-11
	 * http://naver.github.io/egjs
	 *
	 * Forked By Naver egjs
	 * Copyright (c) hammerjs
	 * Licensed under the MIT license */
	function _extends() {
	  _extends = assign$2 || function (target) {
	    for (var i = 1; i < arguments.length; i++) {
	      var source = arguments[i];

	      for (var key in source) {
	        if (Object.prototype.hasOwnProperty.call(source, key)) {
	          target[key] = source[key];
	        }
	      }
	    }

	    return target;
	  };

	  return _extends.apply(this, arguments);
	}

	function _inheritsLoose(subClass, superClass) {
	  subClass.prototype = create$2(superClass.prototype);
	  subClass.prototype.constructor = subClass;
	  subClass.__proto__ = superClass;
	}

	function _assertThisInitialized(self) {
	  if (self === void 0) {
	    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
	  }

	  return self;
	}
	/**
	 * @private
	 * extend object.
	 * means that properties in dest will be overwritten by the ones in src.
	 * @param {Object} target
	 * @param {...Object} objects_to_assign
	 * @returns {Object} target
	 */


	var assign$4;

	if (typeof assign$2 !== 'function') {
	  assign$4 = function assign(target) {
	    if (target === undefined || target === null) {
	      throw new TypeError('Cannot convert undefined or null to object');
	    }

	    var output = Object(target);

	    for (var index = 1; index < arguments.length; index++) {
	      var source = arguments[index];

	      if (source !== undefined && source !== null) {
	        for (var nextKey in source) {
	          if (source.hasOwnProperty(nextKey)) {
	            output[nextKey] = source[nextKey];
	          }
	        }
	      }
	    }

	    return output;
	  };
	} else {
	  assign$4 = assign$2;
	}

	var assign$1$2 = assign$4;
	var VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];
	var TEST_ELEMENT = typeof document === "undefined" ? {
	  style: {}
	} : document.createElement('div');
	var TYPE_FUNCTION = 'function';
	var round = Math.round,
	    abs = Math.abs;
	var now$3 = now$2;
	/**
	 * @private
	 * get the prefixed property
	 * @param {Object} obj
	 * @param {String} property
	 * @returns {String|Undefined} prefixed
	 */

	function prefixed(obj, property) {
	  var prefix;
	  var prop;

	  var camelProp = property[0].toUpperCase() + slice$3(property).call(property, 1);

	  var i = 0;

	  while (i < VENDOR_PREFIXES.length) {
	    prefix = VENDOR_PREFIXES[i];
	    prop = prefix ? prefix + camelProp : property;

	    if (prop in obj) {
	      return prop;
	    }

	    i++;
	  }

	  return undefined;
	}
	/* eslint-disable no-new-func, no-nested-ternary */


	var win;

	if (typeof window === "undefined") {
	  // window is undefined in node.js
	  win = {};
	} else {
	  win = window;
	}

	var PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');
	var NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined;

	function getTouchActionProps() {
	  var _context;

	  if (!NATIVE_TOUCH_ACTION) {
	    return false;
	  }

	  var touchMap = {};
	  var cssSupports = win.CSS && win.CSS.supports;

	  forEach$2(_context = ['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none']).call(_context, function (val) {
	    // If css.supports is not supported but there is native touch-action assume it supports
	    // all values. This is the case for IE 10 and 11.
	    return touchMap[val] = cssSupports ? win.CSS.supports('touch-action', val) : true;
	  });

	  return touchMap;
	}

	var TOUCH_ACTION_COMPUTE = 'compute';
	var TOUCH_ACTION_AUTO = 'auto';
	var TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented

	var TOUCH_ACTION_NONE = 'none';
	var TOUCH_ACTION_PAN_X = 'pan-x';
	var TOUCH_ACTION_PAN_Y = 'pan-y';
	var TOUCH_ACTION_MAP = getTouchActionProps();
	var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;
	var SUPPORT_TOUCH = 'ontouchstart' in win;
	var SUPPORT_POINTER_EVENTS = prefixed(win, 'PointerEvent') !== undefined;
	var SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);
	var INPUT_TYPE_TOUCH = 'touch';
	var INPUT_TYPE_PEN = 'pen';
	var INPUT_TYPE_MOUSE = 'mouse';
	var INPUT_TYPE_KINECT = 'kinect';
	var COMPUTE_INTERVAL = 25;
	var INPUT_START = 1;
	var INPUT_MOVE = 2;
	var INPUT_END = 4;
	var INPUT_CANCEL = 8;
	var DIRECTION_NONE = 1;
	var DIRECTION_LEFT = 2;
	var DIRECTION_RIGHT = 4;
	var DIRECTION_UP = 8;
	var DIRECTION_DOWN = 16;
	var DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;
	var DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;
	var DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;
	var PROPS_XY = ['x', 'y'];
	var PROPS_CLIENT_XY = ['clientX', 'clientY'];
	/**
	 * @private
	 * walk objects and arrays
	 * @param {Object} obj
	 * @param {Function} iterator
	 * @param {Object} context
	 */

	function each(obj, iterator, context) {
	  var i;

	  if (!obj) {
	    return;
	  }

	  if (forEach$2(obj)) {
	    forEach$2(obj).call(obj, iterator, context);
	  } else if (obj.length !== undefined) {
	    i = 0;

	    while (i < obj.length) {
	      iterator.call(context, obj[i], i, obj);
	      i++;
	    }
	  } else {
	    for (i in obj) {
	      obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);
	    }
	  }
	}
	/**
	 * @private
	 * let a boolean value also be a function that must return a boolean
	 * this first item in args will be used as the context
	 * @param {Boolean|Function} val
	 * @param {Array} [args]
	 * @returns {Boolean}
	 */


	function boolOrFn(val, args) {
	  if (_typeof_1(val) === TYPE_FUNCTION) {
	    return val.apply(args ? args[0] || undefined : undefined, args);
	  }

	  return val;
	}
	/**
	 * @private
	 * small indexOf wrapper
	 * @param {String} str
	 * @param {String} find
	 * @returns {Boolean} found
	 */


	function inStr(str, find) {
	  return indexOf$3(str).call(str, find) > -1;
	}
	/**
	 * @private
	 * when the touchActions are collected they are not a valid value, so we need to clean things up. *
	 * @param {String} actions
	 * @returns {*}
	 */


	function cleanTouchActions(actions) {
	  // none
	  if (inStr(actions, TOUCH_ACTION_NONE)) {
	    return TOUCH_ACTION_NONE;
	  }

	  var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);
	  var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y); // if both pan-x and pan-y are set (different recognizers
	  // for different directions, e.g. horizontal pan but vertical swipe?)
	  // we need none (as otherwise with pan-x pan-y combined none of these
	  // recognizers will work, since the browser would handle all panning

	  if (hasPanX && hasPanY) {
	    return TOUCH_ACTION_NONE;
	  } // pan-x OR pan-y


	  if (hasPanX || hasPanY) {
	    return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;
	  } // manipulation


	  if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {
	    return TOUCH_ACTION_MANIPULATION;
	  }

	  return TOUCH_ACTION_AUTO;
	}
	/**
	 * @private
	 * Touch Action
	 * sets the touchAction property or uses the js alternative
	 * @param {Manager} manager
	 * @param {String} value
	 * @constructor
	 */


	var TouchAction =
	/*#__PURE__*/
	function () {
	  function TouchAction(manager, value) {
	    this.manager = manager;
	    this.set(value);
	  }
	  /**
	   * @private
	   * set the touchAction value on the element or enable the polyfill
	   * @param {String} value
	   */


	  var _proto = TouchAction.prototype;

	  _proto.set = function set(value) {
	    var _context2;

	    // find out the touch-action by the event handlers
	    if (value === TOUCH_ACTION_COMPUTE) {
	      value = this.compute();
	    }

	    if (NATIVE_TOUCH_ACTION && this.manager.element.style && TOUCH_ACTION_MAP[value]) {
	      this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;
	    }

	    this.actions = trim$3(_context2 = value.toLowerCase()).call(_context2);
	  };
	  /**
	   * @private
	   * just re-set the touchAction value
	   */


	  _proto.update = function update() {
	    this.set(this.manager.options.touchAction);
	  };
	  /**
	   * @private
	   * compute the value for the touchAction property based on the recognizer's settings
	   * @returns {String} value
	   */


	  _proto.compute = function compute() {
	    var actions = [];
	    each(this.manager.recognizers, function (recognizer) {
	      if (boolOrFn(recognizer.options.enable, [recognizer])) {
	        actions = concat$2(actions).call(actions, recognizer.getTouchAction());
	      }
	    });
	    return cleanTouchActions(actions.join(' '));
	  };
	  /**
	   * @private
	   * this method is called on each input cycle and provides the preventing of the browser behavior
	   * @param {Object} input
	   */


	  _proto.preventDefaults = function preventDefaults(input) {
	    var srcEvent = input.srcEvent;
	    var direction = input.offsetDirection; // if the touch action did prevented once this session

	    if (this.manager.session.prevented) {
	      srcEvent.preventDefault();
	      return;
	    }

	    var actions = this.actions;
	    var hasNone = inStr(actions, TOUCH_ACTION_NONE) && !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE];
	    var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y];
	    var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X];

	    if (hasNone) {
	      // do not prevent defaults if this is a tap gesture
	      var isTapPointer = input.pointers.length === 1;
	      var isTapMovement = input.distance < 2;
	      var isTapTouchTime = input.deltaTime < 250;

	      if (isTapPointer && isTapMovement && isTapTouchTime) {
	        return;
	      }
	    }

	    if (hasPanX && hasPanY) {
	      // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent
	      return;
	    }

	    if (hasNone || hasPanY && direction & DIRECTION_HORIZONTAL || hasPanX && direction & DIRECTION_VERTICAL) {
	      return this.preventSrc(srcEvent);
	    }
	  };
	  /**
	   * @private
	   * call preventDefault to prevent the browser's default behavior (scrolling in most cases)
	   * @param {Object} srcEvent
	   */


	  _proto.preventSrc = function preventSrc(srcEvent) {
	    this.manager.session.prevented = true;
	    srcEvent.preventDefault();
	  };

	  return TouchAction;
	}();
	/**
	 * @private
	 * find if a node is in the given parent
	 * @method hasParent
	 * @param {HTMLElement} node
	 * @param {HTMLElement} parent
	 * @return {Boolean} found
	 */


	function hasParent$1(node, parent) {
	  while (node) {
	    if (node === parent) {
	      return true;
	    }

	    node = node.parentNode;
	  }

	  return false;
	}
	/**
	 * @private
	 * get the center of all the pointers
	 * @param {Array} pointers
	 * @return {Object} center contains `x` and `y` properties
	 */


	function getCenter(pointers) {
	  var pointersLength = pointers.length; // no need to loop when only one touch

	  if (pointersLength === 1) {
	    return {
	      x: round(pointers[0].clientX),
	      y: round(pointers[0].clientY)
	    };
	  }

	  var x = 0;
	  var y = 0;
	  var i = 0;

	  while (i < pointersLength) {
	    x += pointers[i].clientX;
	    y += pointers[i].clientY;
	    i++;
	  }

	  return {
	    x: round(x / pointersLength),
	    y: round(y / pointersLength)
	  };
	}
	/**
	 * @private
	 * create a simple clone from the input used for storage of firstInput and firstMultiple
	 * @param {Object} input
	 * @returns {Object} clonedInputData
	 */


	function simpleCloneInputData(input) {
	  // make a simple copy of the pointers because we will get a reference if we don't
	  // we only need clientXY for the calculations
	  var pointers = [];
	  var i = 0;

	  while (i < input.pointers.length) {
	    pointers[i] = {
	      clientX: round(input.pointers[i].clientX),
	      clientY: round(input.pointers[i].clientY)
	    };
	    i++;
	  }

	  return {
	    timeStamp: now$3(),
	    pointers: pointers,
	    center: getCenter(pointers),
	    deltaX: input.deltaX,
	    deltaY: input.deltaY
	  };
	}
	/**
	 * @private
	 * calculate the absolute distance between two points
	 * @param {Object} p1 {x, y}
	 * @param {Object} p2 {x, y}
	 * @param {Array} [props] containing x and y keys
	 * @return {Number} distance
	 */


	function getDistance(p1, p2, props) {
	  if (!props) {
	    props = PROPS_XY;
	  }

	  var x = p2[props[0]] - p1[props[0]];
	  var y = p2[props[1]] - p1[props[1]];
	  return Math.sqrt(x * x + y * y);
	}
	/**
	 * @private
	 * calculate the angle between two coordinates
	 * @param {Object} p1
	 * @param {Object} p2
	 * @param {Array} [props] containing x and y keys
	 * @return {Number} angle
	 */


	function getAngle(p1, p2, props) {
	  if (!props) {
	    props = PROPS_XY;
	  }

	  var x = p2[props[0]] - p1[props[0]];
	  var y = p2[props[1]] - p1[props[1]];
	  return Math.atan2(y, x) * 180 / Math.PI;
	}
	/**
	 * @private
	 * get the direction between two points
	 * @param {Number} x
	 * @param {Number} y
	 * @return {Number} direction
	 */


	function getDirection(x, y) {
	  if (x === y) {
	    return DIRECTION_NONE;
	  }

	  if (abs(x) >= abs(y)) {
	    return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;
	  }

	  return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;
	}

	function computeDeltaXY(session, input) {
	  var center = input.center; // let { offsetDelta:offset = {}, prevDelta = {}, prevInput = {} } = session;
	  // jscs throwing error on defalut destructured values and without defaults tests fail

	  var offset = session.offsetDelta || {};
	  var prevDelta = session.prevDelta || {};
	  var prevInput = session.prevInput || {};

	  if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {
	    prevDelta = session.prevDelta = {
	      x: prevInput.deltaX || 0,
	      y: prevInput.deltaY || 0
	    };
	    offset = session.offsetDelta = {
	      x: center.x,
	      y: center.y
	    };
	  }

	  input.deltaX = prevDelta.x + (center.x - offset.x);
	  input.deltaY = prevDelta.y + (center.y - offset.y);
	}
	/**
	 * @private
	 * calculate the velocity between two points. unit is in px per ms.
	 * @param {Number} deltaTime
	 * @param {Number} x
	 * @param {Number} y
	 * @return {Object} velocity `x` and `y`
	 */


	function getVelocity(deltaTime, x, y) {
	  return {
	    x: x / deltaTime || 0,
	    y: y / deltaTime || 0
	  };
	}
	/**
	 * @private
	 * calculate the scale factor between two pointersets
	 * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out
	 * @param {Array} start array of pointers
	 * @param {Array} end array of pointers
	 * @return {Number} scale
	 */


	function getScale(start, end) {
	  return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);
	}
	/**
	 * @private
	 * calculate the rotation degrees between two pointersets
	 * @param {Array} start array of pointers
	 * @param {Array} end array of pointers
	 * @return {Number} rotation
	 */


	function getRotation(start, end) {
	  return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);
	}
	/**
	 * @private
	 * velocity is calculated every x ms
	 * @param {Object} session
	 * @param {Object} input
	 */


	function computeIntervalInputData(session, input) {
	  var last = session.lastInterval || input;
	  var deltaTime = input.timeStamp - last.timeStamp;
	  var velocity;
	  var velocityX;
	  var velocityY;
	  var direction;

	  if (input.eventType !== INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {
	    var deltaX = input.deltaX - last.deltaX;
	    var deltaY = input.deltaY - last.deltaY;
	    var v = getVelocity(deltaTime, deltaX, deltaY);
	    velocityX = v.x;
	    velocityY = v.y;
	    velocity = abs(v.x) > abs(v.y) ? v.x : v.y;
	    direction = getDirection(deltaX, deltaY);
	    session.lastInterval = input;
	  } else {
	    // use latest velocity info if it doesn't overtake a minimum period
	    velocity = last.velocity;
	    velocityX = last.velocityX;
	    velocityY = last.velocityY;
	    direction = last.direction;
	  }

	  input.velocity = velocity;
	  input.velocityX = velocityX;
	  input.velocityY = velocityY;
	  input.direction = direction;
	}
	/**
	* @private
	 * extend the data with some usable properties like scale, rotate, velocity etc
	 * @param {Object} manager
	 * @param {Object} input
	 */


	function computeInputData(manager, input) {
	  var session = manager.session;
	  var pointers = input.pointers;
	  var pointersLength = pointers.length; // store the first input to calculate the distance and direction

	  if (!session.firstInput) {
	    session.firstInput = simpleCloneInputData(input);
	  } // to compute scale and rotation we need to store the multiple touches


	  if (pointersLength > 1 && !session.firstMultiple) {
	    session.firstMultiple = simpleCloneInputData(input);
	  } else if (pointersLength === 1) {
	    session.firstMultiple = false;
	  }

	  var firstInput = session.firstInput,
	      firstMultiple = session.firstMultiple;
	  var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;
	  var center = input.center = getCenter(pointers);
	  input.timeStamp = now$3();
	  input.deltaTime = input.timeStamp - firstInput.timeStamp;
	  input.angle = getAngle(offsetCenter, center);
	  input.distance = getDistance(offsetCenter, center);
	  computeDeltaXY(session, input);
	  input.offsetDirection = getDirection(input.deltaX, input.deltaY);
	  var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY);
	  input.overallVelocityX = overallVelocity.x;
	  input.overallVelocityY = overallVelocity.y;
	  input.overallVelocity = abs(overallVelocity.x) > abs(overallVelocity.y) ? overallVelocity.x : overallVelocity.y;
	  input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;
	  input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;
	  input.maxPointers = !session.prevInput ? input.pointers.length : input.pointers.length > session.prevInput.maxPointers ? input.pointers.length : session.prevInput.maxPointers;
	  computeIntervalInputData(session, input); // find the correct target

	  var target = manager.element;
	  var srcEvent = input.srcEvent;
	  var srcEventTarget;

	  if (srcEvent.composedPath) {
	    srcEventTarget = srcEvent.composedPath()[0];
	  } else if (srcEvent.path) {
	    srcEventTarget = srcEvent.path[0];
	  } else {
	    srcEventTarget = target;
	  }

	  if (hasParent$1(srcEventTarget, target)) {
	    target = srcEventTarget;
	  }

	  input.target = target;
	}
	/**
	 * @private
	 * handle input events
	 * @param {Manager} manager
	 * @param {String} eventType
	 * @param {Object} input
	 */


	function inputHandler(manager, eventType, input) {
	  var pointersLen = input.pointers.length;
	  var changedPointersLen = input.changedPointers.length;
	  var isFirst = eventType & INPUT_START && pointersLen - changedPointersLen === 0;
	  var isFinal = eventType & (INPUT_END | INPUT_CANCEL) && pointersLen - changedPointersLen === 0;
	  input.isFirst = !!isFirst;
	  input.isFinal = !!isFinal;

	  if (isFirst) {
	    manager.session = {};
	  } // source event is the normalized value of the domEvents
	  // like 'touchstart, mouseup, pointerdown'


	  input.eventType = eventType; // compute scale, rotation etc

	  computeInputData(manager, input); // emit secret event

	  manager.emit('hammer.input', input);
	  manager.recognize(input);
	  manager.session.prevInput = input;
	}
	/**
	 * @private
	 * split string on whitespace
	 * @param {String} str
	 * @returns {Array} words
	 */


	function splitStr(str) {
	  return trim$3(str).call(str).split(/\s+/g);
	}
	/**
	 * @private
	 * addEventListener with multiple events at once
	 * @param {EventTarget} target
	 * @param {String} types
	 * @param {Function} handler
	 */


	function addEventListeners(target, types, handler) {
	  each(splitStr(types), function (type) {
	    target.addEventListener(type, handler, false);
	  });
	}
	/**
	 * @private
	 * removeEventListener with multiple events at once
	 * @param {EventTarget} target
	 * @param {String} types
	 * @param {Function} handler
	 */


	function removeEventListeners(target, types, handler) {
	  each(splitStr(types), function (type) {
	    target.removeEventListener(type, handler, false);
	  });
	}
	/**
	 * @private
	 * get the window object of an element
	 * @param {HTMLElement} element
	 * @returns {DocumentView|Window}
	 */


	function getWindowForElement(element) {
	  var doc = element.ownerDocument || element;
	  return doc.defaultView || doc.parentWindow || window;
	}
	/**
	 * @private
	 * create new input type manager
	 * @param {Manager} manager
	 * @param {Function} callback
	 * @returns {Input}
	 * @constructor
	 */


	var Input =
	/*#__PURE__*/
	function () {
	  function Input(manager, callback) {
	    var self = this;
	    this.manager = manager;
	    this.callback = callback;
	    this.element = manager.element;
	    this.target = manager.options.inputTarget; // smaller wrapper around the handler, for the scope and the enabled state of the manager,
	    // so when disabled the input events are completely bypassed.

	    this.domHandler = function (ev) {
	      if (boolOrFn(manager.options.enable, [manager])) {
	        self.handler(ev);
	      }
	    };

	    this.init();
	  }
	  /**
	   * @private
	   * should handle the inputEvent data and trigger the callback
	   * @virtual
	   */


	  var _proto = Input.prototype;

	  _proto.handler = function handler() {};
	  /**
	   * @private
	   * bind the events
	   */


	  _proto.init = function init() {
	    this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);
	    this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);
	    this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);
	  };
	  /**
	   * @private
	   * unbind the events
	   */


	  _proto.destroy = function destroy() {
	    this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);
	    this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);
	    this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);
	  };

	  return Input;
	}();
	/**
	 * @private
	 * find if a array contains the object using indexOf or a simple polyFill
	 * @param {Array} src
	 * @param {String} find
	 * @param {String} [findByKey]
	 * @return {Boolean|Number} false when not found, or the index
	 */


	function inArray(src, find, findByKey) {
	  if (indexOf$3(src) && !findByKey) {
	    return indexOf$3(src).call(src, find);
	  } else {
	    var i = 0;

	    while (i < src.length) {
	      if (findByKey && src[i][findByKey] == find || !findByKey && src[i] === find) {
	        // do not use === here, test fails
	        return i;
	      }

	      i++;
	    }

	    return -1;
	  }
	}

	var POINTER_INPUT_MAP = {
	  pointerdown: INPUT_START,
	  pointermove: INPUT_MOVE,
	  pointerup: INPUT_END,
	  pointercancel: INPUT_CANCEL,
	  pointerout: INPUT_CANCEL
	}; // in IE10 the pointer types is defined as an enum

	var IE10_POINTER_TYPE_ENUM = {
	  2: INPUT_TYPE_TOUCH,
	  3: INPUT_TYPE_PEN,
	  4: INPUT_TYPE_MOUSE,
	  5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816

	};
	var POINTER_ELEMENT_EVENTS = 'pointerdown';
	var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel'; // IE10 has prefixed support, and case-sensitive

	if (win.MSPointerEvent && !win.PointerEvent) {
	  POINTER_ELEMENT_EVENTS = 'MSPointerDown';
	  POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';
	}
	/**
	 * @private
	 * Pointer events input
	 * @constructor
	 * @extends Input
	 */


	var PointerEventInput =
	/*#__PURE__*/
	function (_Input) {
	  _inheritsLoose(PointerEventInput, _Input);

	  function PointerEventInput() {
	    var _this;

	    var proto = PointerEventInput.prototype;
	    proto.evEl = POINTER_ELEMENT_EVENTS;
	    proto.evWin = POINTER_WINDOW_EVENTS;
	    _this = _Input.apply(this, arguments) || this;
	    _this.store = _this.manager.session.pointerEvents = [];
	    return _this;
	  }
	  /**
	   * @private
	   * handle mouse events
	   * @param {Object} ev
	   */


	  var _proto = PointerEventInput.prototype;

	  _proto.handler = function handler(ev) {
	    var store = this.store;
	    var removePointer = false;
	    var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');
	    var eventType = POINTER_INPUT_MAP[eventTypeNormalized];
	    var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;
	    var isTouch = pointerType === INPUT_TYPE_TOUCH; // get index of the event in the store

	    var storeIndex = inArray(store, ev.pointerId, 'pointerId'); // start and mouse must be down

	    if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {
	      if (storeIndex < 0) {
	        store.push(ev);
	        storeIndex = store.length - 1;
	      }
	    } else if (eventType & (INPUT_END | INPUT_CANCEL)) {
	      removePointer = true;
	    } // it not found, so the pointer hasn't been down (so it's probably a hover)


	    if (storeIndex < 0) {
	      return;
	    } // update the event in the store


	    store[storeIndex] = ev;
	    this.callback(this.manager, eventType, {
	      pointers: store,
	      changedPointers: [ev],
	      pointerType: pointerType,
	      srcEvent: ev
	    });

	    if (removePointer) {
	      // remove from the store
	      splice$2(store).call(store, storeIndex, 1);
	    }
	  };

	  return PointerEventInput;
	}(Input);
	/**
	 * @private
	 * convert array-like objects to real arrays
	 * @param {Object} obj
	 * @returns {Array}
	 */


	function toArray$1(obj) {
	  return slice$3(Array.prototype).call(obj, 0);
	}
	/**
	 * @private
	 * unique array with objects based on a key (like 'id') or just by the array's value
	 * @param {Array} src [{id:1},{id:2},{id:1}]
	 * @param {String} [key]
	 * @param {Boolean} [sort=False]
	 * @returns {Array} [{id:1},{id:2}]
	 */


	function uniqueArray(src, key, sort) {
	  var results = [];
	  var values = [];
	  var i = 0;

	  while (i < src.length) {
	    var val = key ? src[i][key] : src[i];

	    if (inArray(values, val) < 0) {
	      results.push(src[i]);
	    }

	    values[i] = val;
	    i++;
	  }

	  if (sort) {
	    if (!key) {
	      results = sort$2(results).call(results);
	    } else {
	      results = sort$2(results).call(results, function (a, b) {
	        return a[key] > b[key];
	      });
	    }
	  }

	  return results;
	}

	var TOUCH_INPUT_MAP = {
	  touchstart: INPUT_START,
	  touchmove: INPUT_MOVE,
	  touchend: INPUT_END,
	  touchcancel: INPUT_CANCEL
	};
	var TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';
	/**
	 * @private
	 * Multi-user touch events input
	 * @constructor
	 * @extends Input
	 */

	var TouchInput =
	/*#__PURE__*/
	function (_Input) {
	  _inheritsLoose(TouchInput, _Input);

	  function TouchInput() {
	    var _this;

	    TouchInput.prototype.evTarget = TOUCH_TARGET_EVENTS;
	    _this = _Input.apply(this, arguments) || this;
	    _this.targetIds = {}; // this.evTarget = TOUCH_TARGET_EVENTS;

	    return _this;
	  }

	  var _proto = TouchInput.prototype;

	  _proto.handler = function handler(ev) {
	    var type = TOUCH_INPUT_MAP[ev.type];
	    var touches = getTouches.call(this, ev, type);

	    if (!touches) {
	      return;
	    }

	    this.callback(this.manager, type, {
	      pointers: touches[0],
	      changedPointers: touches[1],
	      pointerType: INPUT_TYPE_TOUCH,
	      srcEvent: ev
	    });
	  };

	  return TouchInput;
	}(Input);

	function getTouches(ev, type) {
	  var allTouches = toArray$1(ev.touches);
	  var targetIds = this.targetIds; // when there is only one touch, the process can be simplified

	  if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {
	    targetIds[allTouches[0].identifier] = true;
	    return [allTouches, allTouches];
	  }

	  var i;
	  var targetTouches;
	  var changedTouches = toArray$1(ev.changedTouches);
	  var changedTargetTouches = [];
	  var target = this.target; // get target touches from touches

	  targetTouches = filter$2(allTouches).call(allTouches, function (touch) {
	    return hasParent$1(touch.target, target);
	  }); // collect touches

	  if (type === INPUT_START) {
	    i = 0;

	    while (i < targetTouches.length) {
	      targetIds[targetTouches[i].identifier] = true;
	      i++;
	    }
	  } // filter changed touches to only contain touches that exist in the collected target ids


	  i = 0;

	  while (i < changedTouches.length) {
	    if (targetIds[changedTouches[i].identifier]) {
	      changedTargetTouches.push(changedTouches[i]);
	    } // cleanup removed touches


	    if (type & (INPUT_END | INPUT_CANCEL)) {
	      delete targetIds[changedTouches[i].identifier];
	    }

	    i++;
	  }

	  if (!changedTargetTouches.length) {
	    return;
	  }

	  return [// merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'
	  uniqueArray(concat$2(targetTouches).call(targetTouches, changedTargetTouches), 'identifier', true), changedTargetTouches];
	}

	var MOUSE_INPUT_MAP = {
	  mousedown: INPUT_START,
	  mousemove: INPUT_MOVE,
	  mouseup: INPUT_END
	};
	var MOUSE_ELEMENT_EVENTS = 'mousedown';
	var MOUSE_WINDOW_EVENTS = 'mousemove mouseup';
	/**
	 * @private
	 * Mouse events input
	 * @constructor
	 * @extends Input
	 */

	var MouseInput =
	/*#__PURE__*/
	function (_Input) {
	  _inheritsLoose(MouseInput, _Input);

	  function MouseInput() {
	    var _this;

	    var proto = MouseInput.prototype;
	    proto.evEl = MOUSE_ELEMENT_EVENTS;
	    proto.evWin = MOUSE_WINDOW_EVENTS;
	    _this = _Input.apply(this, arguments) || this;
	    _this.pressed = false; // mousedown state

	    return _this;
	  }
	  /**
	   * @private
	   * handle mouse events
	   * @param {Object} ev
	   */


	  var _proto = MouseInput.prototype;

	  _proto.handler = function handler(ev) {
	    var eventType = MOUSE_INPUT_MAP[ev.type]; // on start we want to have the left mouse button down

	    if (eventType & INPUT_START && ev.button === 0) {
	      this.pressed = true;
	    }

	    if (eventType & INPUT_MOVE && ev.which !== 1) {
	      eventType = INPUT_END;
	    } // mouse must be down


	    if (!this.pressed) {
	      return;
	    }

	    if (eventType & INPUT_END) {
	      this.pressed = false;
	    }

	    this.callback(this.manager, eventType, {
	      pointers: [ev],
	      changedPointers: [ev],
	      pointerType: INPUT_TYPE_MOUSE,
	      srcEvent: ev
	    });
	  };

	  return MouseInput;
	}(Input);
	/**
	 * @private
	 * Combined touch and mouse input
	 *
	 * Touch has a higher priority then mouse, and while touching no mouse events are allowed.
	 * This because touch devices also emit mouse events while doing a touch.
	 *
	 * @constructor
	 * @extends Input
	 */


	var DEDUP_TIMEOUT = 2500;
	var DEDUP_DISTANCE = 25;

	function setLastTouch(eventData) {
	  var _eventData$changedPoi = eventData.changedPointers,
	      touch = _eventData$changedPoi[0];

	  if (touch.identifier === this.primaryTouch) {
	    var lastTouch = {
	      x: touch.clientX,
	      y: touch.clientY
	    };
	    var lts = this.lastTouches;
	    this.lastTouches.push(lastTouch);

	    var removeLastTouch = function removeLastTouch() {
	      var i = indexOf$3(lts).call(lts, lastTouch);

	      if (i > -1) {
	        splice$2(lts).call(lts, i, 1);
	      }
	    };

	    setTimeout$2(removeLastTouch, DEDUP_TIMEOUT);
	  }
	}

	function recordTouches(eventType, eventData) {
	  if (eventType & INPUT_START) {
	    this.primaryTouch = eventData.changedPointers[0].identifier;
	    setLastTouch.call(this, eventData);
	  } else if (eventType & (INPUT_END | INPUT_CANCEL)) {
	    setLastTouch.call(this, eventData);
	  }
	}

	function isSyntheticEvent(eventData) {
	  var x = eventData.srcEvent.clientX;
	  var y = eventData.srcEvent.clientY;

	  for (var i = 0; i < this.lastTouches.length; i++) {
	    var t = this.lastTouches[i];
	    var dx = Math.abs(x - t.x);
	    var dy = Math.abs(y - t.y);

	    if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) {
	      return true;
	    }
	  }

	  return false;
	}

	var TouchMouseInput =
	/*#__PURE__*/
	function () {
	  var TouchMouseInput =
	  /*#__PURE__*/
	  function (_Input) {
	    _inheritsLoose(TouchMouseInput, _Input);

	    function TouchMouseInput(_manager, callback) {
	      var _this;

	      _this = _Input.call(this, _manager, callback) || this;

	      _this.handler = function (manager, inputEvent, inputData) {
	        var isTouch = inputData.pointerType === INPUT_TYPE_TOUCH;
	        var isMouse = inputData.pointerType === INPUT_TYPE_MOUSE;

	        if (isMouse && inputData.sourceCapabilities && inputData.sourceCapabilities.firesTouchEvents) {
	          return;
	        } // when we're in a touch event, record touches to  de-dupe synthetic mouse event


	        if (isTouch) {
	          recordTouches.call(_assertThisInitialized(_assertThisInitialized(_this)), inputEvent, inputData);
	        } else if (isMouse && isSyntheticEvent.call(_assertThisInitialized(_assertThisInitialized(_this)), inputData)) {
	          return;
	        }

	        _this.callback(manager, inputEvent, inputData);
	      };

	      _this.touch = new TouchInput(_this.manager, _this.handler);
	      _this.mouse = new MouseInput(_this.manager, _this.handler);
	      _this.primaryTouch = null;
	      _this.lastTouches = [];
	      return _this;
	    }
	    /**
	     * @private
	     * handle mouse and touch events
	     * @param {Hammer} manager
	     * @param {String} inputEvent
	     * @param {Object} inputData
	     */


	    var _proto = TouchMouseInput.prototype;
	    /**
	     * @private
	     * remove the event listeners
	     */

	    _proto.destroy = function destroy() {
	      this.touch.destroy();
	      this.mouse.destroy();
	    };

	    return TouchMouseInput;
	  }(Input);

	  return TouchMouseInput;
	}();
	/**
	 * @private
	 * create new input type manager
	 * called by the Manager constructor
	 * @param {Hammer} manager
	 * @returns {Input}
	 */


	function createInputInstance(manager) {
	  var Type; // let inputClass = manager.options.inputClass;

	  var inputClass = manager.options.inputClass;

	  if (inputClass) {
	    Type = inputClass;
	  } else if (SUPPORT_POINTER_EVENTS) {
	    Type = PointerEventInput;
	  } else if (SUPPORT_ONLY_TOUCH) {
	    Type = TouchInput;
	  } else if (!SUPPORT_TOUCH) {
	    Type = MouseInput;
	  } else {
	    Type = TouchMouseInput;
	  }

	  return new Type(manager, inputHandler);
	}
	/**
	 * @private
	 * if the argument is an array, we want to execute the fn on each entry
	 * if it aint an array we don't want to do a thing.
	 * this is used by all the methods that accept a single and array argument.
	 * @param {*|Array} arg
	 * @param {String} fn
	 * @param {Object} [context]
	 * @returns {Boolean}
	 */


	function invokeArrayArg(arg, fn, context) {
	  if (isArray$3(arg)) {
	    each(arg, context[fn], context);
	    return true;
	  }

	  return false;
	}

	var STATE_POSSIBLE = 1;
	var STATE_BEGAN = 2;
	var STATE_CHANGED = 4;
	var STATE_ENDED = 8;
	var STATE_RECOGNIZED = STATE_ENDED;
	var STATE_CANCELLED = 16;
	var STATE_FAILED = 32;
	/**
	 * @private
	 * get a unique id
	 * @returns {number} uniqueId
	 */

	var _uniqueId = 1;

	function uniqueId() {
	  return _uniqueId++;
	}
	/**
	 * @private
	 * get a recognizer by name if it is bound to a manager
	 * @param {Recognizer|String} otherRecognizer
	 * @param {Recognizer} recognizer
	 * @returns {Recognizer}
	 */


	function getRecognizerByNameIfManager(otherRecognizer, recognizer) {
	  var manager = recognizer.manager;

	  if (manager) {
	    return manager.get(otherRecognizer);
	  }

	  return otherRecognizer;
	}
	/**
	 * @private
	 * get a usable string, used as event postfix
	 * @param {constant} state
	 * @returns {String} state
	 */


	function stateStr(state) {
	  if (state & STATE_CANCELLED) {
	    return 'cancel';
	  } else if (state & STATE_ENDED) {
	    return 'end';
	  } else if (state & STATE_CHANGED) {
	    return 'move';
	  } else if (state & STATE_BEGAN) {
	    return 'start';
	  }

	  return '';
	}
	/**
	 * @private
	 * Recognizer flow explained; *
	 * All recognizers have the initial state of POSSIBLE when a input session starts.
	 * The definition of a input session is from the first input until the last input, with all it's movement in it. *
	 * Example session for mouse-input: mousedown -> mousemove -> mouseup
	 *
	 * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed
	 * which determines with state it should be.
	 *
	 * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to
	 * POSSIBLE to give it another change on the next cycle.
	 *
	 *               Possible
	 *                  |
	 *            +-----+---------------+
	 *            |                     |
	 *      +-----+-----+               |
	 *      |           |               |
	 *   Failed      Cancelled          |
	 *                          +-------+------+
	 *                          |              |
	 *                      Recognized       Began
	 *                                         |
	 *                                      Changed
	 *                                         |
	 *                                  Ended/Recognized
	 */

	/**
	 * @private
	 * Recognizer
	 * Every recognizer needs to extend from this class.
	 * @constructor
	 * @param {Object} options
	 */


	var Recognizer =
	/*#__PURE__*/
	function () {
	  function Recognizer(options) {
	    if (options === void 0) {
	      options = {};
	    }

	    this.options = _extends({
	      enable: true
	    }, options);
	    this.id = uniqueId();
	    this.manager = null; // default is enable true

	    this.state = STATE_POSSIBLE;
	    this.simultaneous = {};
	    this.requireFail = [];
	  }
	  /**
	   * @private
	   * set options
	   * @param {Object} options
	   * @return {Recognizer}
	   */


	  var _proto = Recognizer.prototype;

	  _proto.set = function set(options) {
	    assign$1$2(this.options, options); // also update the touchAction, in case something changed about the directions/enabled state

	    this.manager && this.manager.touchAction.update();
	    return this;
	  };
	  /**
	   * @private
	   * recognize simultaneous with an other recognizer.
	   * @param {Recognizer} otherRecognizer
	   * @returns {Recognizer} this
	   */


	  _proto.recognizeWith = function recognizeWith(otherRecognizer) {
	    if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {
	      return this;
	    }

	    var simultaneous = this.simultaneous;
	    otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);

	    if (!simultaneous[otherRecognizer.id]) {
	      simultaneous[otherRecognizer.id] = otherRecognizer;
	      otherRecognizer.recognizeWith(this);
	    }

	    return this;
	  };
	  /**
	   * @private
	   * drop the simultaneous link. it doesnt remove the link on the other recognizer.
	   * @param {Recognizer} otherRecognizer
	   * @returns {Recognizer} this
	   */


	  _proto.dropRecognizeWith = function dropRecognizeWith(otherRecognizer) {
	    if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {
	      return this;
	    }

	    otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
	    delete this.simultaneous[otherRecognizer.id];
	    return this;
	  };
	  /**
	   * @private
	   * recognizer can only run when an other is failing
	   * @param {Recognizer} otherRecognizer
	   * @returns {Recognizer} this
	   */


	  _proto.requireFailure = function requireFailure(otherRecognizer) {
	    if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {
	      return this;
	    }

	    var requireFail = this.requireFail;
	    otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);

	    if (inArray(requireFail, otherRecognizer) === -1) {
	      requireFail.push(otherRecognizer);
	      otherRecognizer.requireFailure(this);
	    }

	    return this;
	  };
	  /**
	   * @private
	   * drop the requireFailure link. it does not remove the link on the other recognizer.
	   * @param {Recognizer} otherRecognizer
	   * @returns {Recognizer} this
	   */


	  _proto.dropRequireFailure = function dropRequireFailure(otherRecognizer) {
	    if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {
	      return this;
	    }

	    otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
	    var index = inArray(this.requireFail, otherRecognizer);

	    if (index > -1) {
	      var _context3;

	      splice$2(_context3 = this.requireFail).call(_context3, index, 1);
	    }

	    return this;
	  };
	  /**
	   * @private
	   * has require failures boolean
	   * @returns {boolean}
	   */


	  _proto.hasRequireFailures = function hasRequireFailures() {
	    return this.requireFail.length > 0;
	  };
	  /**
	   * @private
	   * if the recognizer can recognize simultaneous with an other recognizer
	   * @param {Recognizer} otherRecognizer
	   * @returns {Boolean}
	   */


	  _proto.canRecognizeWith = function canRecognizeWith(otherRecognizer) {
	    return !!this.simultaneous[otherRecognizer.id];
	  };
	  /**
	   * @private
	   * You should use `tryEmit` instead of `emit` directly to check
	   * that all the needed recognizers has failed before emitting.
	   * @param {Object} input
	   */


	  _proto.emit = function emit(input) {
	    var self = this;
	    var state = this.state;

	    function emit(event) {
	      self.manager.emit(event, input);
	    } // 'panstart' and 'panmove'


	    if (state < STATE_ENDED) {
	      emit(self.options.event + stateStr(state));
	    }

	    emit(self.options.event); // simple 'eventName' events

	    if (input.additionalEvent) {
	      // additional event(panleft, panright, pinchin, pinchout...)
	      emit(input.additionalEvent);
	    } // panend and pancancel


	    if (state >= STATE_ENDED) {
	      emit(self.options.event + stateStr(state));
	    }
	  };
	  /**
	   * @private
	   * Check that all the require failure recognizers has failed,
	   * if true, it emits a gesture event,
	   * otherwise, setup the state to FAILED.
	   * @param {Object} input
	   */


	  _proto.tryEmit = function tryEmit(input) {
	    if (this.canEmit()) {
	      return this.emit(input);
	    } // it's failing anyway


	    this.state = STATE_FAILED;
	  };
	  /**
	   * @private
	   * can we emit?
	   * @returns {boolean}
	   */


	  _proto.canEmit = function canEmit() {
	    var i = 0;

	    while (i < this.requireFail.length) {
	      if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {
	        return false;
	      }

	      i++;
	    }

	    return true;
	  };
	  /**
	   * @private
	   * update the recognizer
	   * @param {Object} inputData
	   */


	  _proto.recognize = function recognize(inputData) {
	    // make a new copy of the inputData
	    // so we can change the inputData without messing up the other recognizers
	    var inputDataClone = assign$1$2({}, inputData); // is is enabled and allow recognizing?

	    if (!boolOrFn(this.options.enable, [this, inputDataClone])) {
	      this.reset();
	      this.state = STATE_FAILED;
	      return;
	    } // reset when we've reached the end


	    if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {
	      this.state = STATE_POSSIBLE;
	    }

	    this.state = this.process(inputDataClone); // the recognizer has recognized a gesture
	    // so trigger an event

	    if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {
	      this.tryEmit(inputDataClone);
	    }
	  };
	  /**
	   * @private
	   * return the state of the recognizer
	   * the actual recognizing happens in this method
	   * @virtual
	   * @param {Object} inputData
	   * @returns {constant} STATE
	   */

	  /* jshint ignore:start */


	  _proto.process = function process(inputData) {};
	  /* jshint ignore:end */

	  /**
	   * @private
	   * return the preferred touch-action
	   * @virtual
	   * @returns {Array}
	   */


	  _proto.getTouchAction = function getTouchAction() {};
	  /**
	   * @private
	   * called when the gesture isn't allowed to recognize
	   * like when another is being recognized or it is disabled
	   * @virtual
	   */


	  _proto.reset = function reset() {};

	  return Recognizer;
	}();

	var defaults = {
	  /**
	   * @private
	   * set if DOM events are being triggered.
	   * But this is slower and unused by simple implementations, so disabled by default.
	   * @type {Boolean}
	   * @default false
	   */
	  domEvents: false,

	  /**
	   * @private
	   * The value for the touchAction property/fallback.
	   * When set to `compute` it will magically set the correct value based on the added recognizers.
	   * @type {String}
	   * @default compute
	   */
	  touchAction: TOUCH_ACTION_COMPUTE,

	  /**
	   * @private
	   * @type {Boolean}
	   * @default true
	   */
	  enable: true,

	  /**
	   * @private
	   * EXPERIMENTAL FEATURE -- can be removed/changed
	   * Change the parent input target element.
	   * If Null, then it is being set the to main element.
	   * @type {Null|EventTarget}
	   * @default null
	   */
	  inputTarget: null,

	  /**
	   * @private
	   * force an input class
	   * @type {Null|Function}
	   * @default null
	   */
	  inputClass: null,

	  /**
	   * @private
	   * Default recognizer setup when calling `Hammer()`
	   * When creating a new Manager these will be skipped.
	   * @type {Array}
	   */
	  preset: [],

	  /**
	   * @private
	   * Some CSS properties can be used to improve the working of Hammer.
	   * Add them to this method and they will be set when creating a new Manager.
	   * @namespace
	   */
	  cssProps: {
	    /**
	     * @private
	     * Disables text selection to improve the dragging gesture. Mainly for desktop browsers.
	     * @type {String}
	     * @default 'none'
	     */
	    userSelect: "none",

	    /**
	     * @private
	     * Disable the Windows Phone grippers when pressing an element.
	     * @type {String}
	     * @default 'none'
	     */
	    touchSelect: "none",

	    /**
	     * @private
	     * Disables the default callout shown when you touch and hold a touch target.
	     * On iOS, when you touch and hold a touch target such as a link, Safari displays
	     * a callout containing information about the link. This property allows you to disable that callout.
	     * @type {String}
	     * @default 'none'
	     */
	    touchCallout: "none",

	    /**
	     * @private
	     * Specifies whether zooming is enabled. Used by IE10>
	     * @type {String}
	     * @default 'none'
	     */
	    contentZooming: "none",

	    /**
	     * @private
	     * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.
	     * @type {String}
	     * @default 'none'
	     */
	    userDrag: "none",

	    /**
	     * @private
	     * Overrides the highlight color shown when the user taps a link or a JavaScript
	     * clickable element in iOS. This property obeys the alpha value, if specified.
	     * @type {String}
	     * @default 'rgba(0,0,0,0)'
	     */
	    tapHighlightColor: "rgba(0,0,0,0)"
	  }
	};
	var STOP = 1;
	var FORCED_STOP = 2;
	/**
	 * @private
	 * add/remove the css properties as defined in manager.options.cssProps
	 * @param {Manager} manager
	 * @param {Boolean} add
	 */

	function toggleCssProps(manager, add) {
	  var element = manager.element;

	  if (!element.style) {
	    return;
	  }

	  var prop;
	  each(manager.options.cssProps, function (value, name) {
	    prop = prefixed(element.style, name);

	    if (add) {
	      manager.oldCssProps[prop] = element.style[prop];
	      element.style[prop] = value;
	    } else {
	      element.style[prop] = manager.oldCssProps[prop] || "";
	    }
	  });

	  if (!add) {
	    manager.oldCssProps = {};
	  }
	}
	/**
	 * @private
	 * trigger dom event
	 * @param {String} event
	 * @param {Object} data
	 */


	function triggerDomEvent(event, data) {
	  var gestureEvent = document.createEvent("Event");
	  gestureEvent.initEvent(event, true, true);
	  gestureEvent.gesture = data;
	  data.target.dispatchEvent(gestureEvent);
	}
	/**
	* @private
	 * Manager
	 * @param {HTMLElement} element
	 * @param {Object} [options]
	 * @constructor
	 */


	var Manager =
	/*#__PURE__*/
	function () {
	  function Manager(element, options) {
	    var _this = this;

	    this.options = assign$1$2({}, defaults, options || {});
	    this.options.inputTarget = this.options.inputTarget || element;
	    this.handlers = {};
	    this.session = {};
	    this.recognizers = [];
	    this.oldCssProps = {};
	    this.element = element;
	    this.input = createInputInstance(this);
	    this.touchAction = new TouchAction(this, this.options.touchAction);
	    toggleCssProps(this, true);
	    each(this.options.recognizers, function (item) {
	      var recognizer = _this.add(new item[0](item[1]));

	      item[2] && recognizer.recognizeWith(item[2]);
	      item[3] && recognizer.requireFailure(item[3]);
	    }, this);
	  }
	  /**
	   * @private
	   * set options
	   * @param {Object} options
	   * @returns {Manager}
	   */


	  var _proto = Manager.prototype;

	  _proto.set = function set(options) {
	    assign$1$2(this.options, options); // Options that need a little more setup

	    if (options.touchAction) {
	      this.touchAction.update();
	    }

	    if (options.inputTarget) {
	      // Clean up existing event listeners and reinitialize
	      this.input.destroy();
	      this.input.target = options.inputTarget;
	      this.input.init();
	    }

	    return this;
	  };
	  /**
	   * @private
	   * stop recognizing for this session.
	   * This session will be discarded, when a new [input]start event is fired.
	   * When forced, the recognizer cycle is stopped immediately.
	   * @param {Boolean} [force]
	   */


	  _proto.stop = function stop(force) {
	    this.session.stopped = force ? FORCED_STOP : STOP;
	  };
	  /**
	   * @private
	   * run the recognizers!
	   * called by the inputHandler function on every movement of the pointers (touches)
	   * it walks through all the recognizers and tries to detect the gesture that is being made
	   * @param {Object} inputData
	   */


	  _proto.recognize = function recognize(inputData) {
	    var session = this.session;

	    if (session.stopped) {
	      return;
	    } // run the touch-action polyfill


	    this.touchAction.preventDefaults(inputData);
	    var recognizer;
	    var recognizers = this.recognizers; // this holds the recognizer that is being recognized.
	    // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED
	    // if no recognizer is detecting a thing, it is set to `null`

	    var curRecognizer = session.curRecognizer; // reset when the last recognizer is recognized
	    // or when we're in a new session

	    if (!curRecognizer || curRecognizer && curRecognizer.state & STATE_RECOGNIZED) {
	      session.curRecognizer = null;
	      curRecognizer = null;
	    }

	    var i = 0;

	    while (i < recognizers.length) {
	      recognizer = recognizers[i]; // find out if we are allowed try to recognize the input for this one.
	      // 1.   allow if the session is NOT forced stopped (see the .stop() method)
	      // 2.   allow if we still haven't recognized a gesture in this session, or the this recognizer is the one
	      //      that is being recognized.
	      // 3.   allow if the recognizer is allowed to run simultaneous with the current recognized recognizer.
	      //      this can be setup with the `recognizeWith()` method on the recognizer.

	      if (session.stopped !== FORCED_STOP && ( // 1
	      !curRecognizer || recognizer === curRecognizer || // 2
	      recognizer.canRecognizeWith(curRecognizer))) {
	        // 3
	        recognizer.recognize(inputData);
	      } else {
	        recognizer.reset();
	      } // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the
	      // current active recognizer. but only if we don't already have an active recognizer


	      if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {
	        session.curRecognizer = recognizer;
	        curRecognizer = recognizer;
	      }

	      i++;
	    }
	  };
	  /**
	   * @private
	   * get a recognizer by its event name.
	   * @param {Recognizer|String} recognizer
	   * @returns {Recognizer|Null}
	   */


	  _proto.get = function get(recognizer) {
	    if (recognizer instanceof Recognizer) {
	      return recognizer;
	    }

	    var recognizers = this.recognizers;

	    for (var i = 0; i < recognizers.length; i++) {
	      if (recognizers[i].options.event === recognizer) {
	        return recognizers[i];
	      }
	    }

	    return null;
	  };
	  /**
	   * @private add a recognizer to the manager
	   * existing recognizers with the same event name will be removed
	   * @param {Recognizer} recognizer
	   * @returns {Recognizer|Manager}
	   */


	  _proto.add = function add(recognizer) {
	    if (invokeArrayArg(recognizer, "add", this)) {
	      return this;
	    } // remove existing


	    var existing = this.get(recognizer.options.event);

	    if (existing) {
	      this.remove(existing);
	    }

	    this.recognizers.push(recognizer);
	    recognizer.manager = this;
	    this.touchAction.update();
	    return recognizer;
	  };
	  /**
	   * @private
	   * remove a recognizer by name or instance
	   * @param {Recognizer|String} recognizer
	   * @returns {Manager}
	   */


	  _proto.remove = function remove(recognizer) {
	    if (invokeArrayArg(recognizer, "remove", this)) {
	      return this;
	    }

	    var targetRecognizer = this.get(recognizer); // let's make sure this recognizer exists

	    if (recognizer) {
	      var recognizers = this.recognizers;
	      var index = inArray(recognizers, targetRecognizer);

	      if (index !== -1) {
	        splice$2(recognizers).call(recognizers, index, 1);

	        this.touchAction.update();
	      }
	    }

	    return this;
	  };
	  /**
	   * @private
	   * bind event
	   * @param {String} events
	   * @param {Function} handler
	   * @returns {EventEmitter} this
	   */


	  _proto.on = function on(events, handler) {
	    if (events === undefined || handler === undefined) {
	      return this;
	    }

	    var handlers = this.handlers;
	    each(splitStr(events), function (event) {
	      handlers[event] = handlers[event] || [];
	      handlers[event].push(handler);
	    });
	    return this;
	  };
	  /**
	   * @private unbind event, leave emit blank to remove all handlers
	   * @param {String} events
	   * @param {Function} [handler]
	   * @returns {EventEmitter} this
	   */


	  _proto.off = function off(events, handler) {
	    if (events === undefined) {
	      return this;
	    }

	    var handlers = this.handlers;
	    each(splitStr(events), function (event) {
	      if (!handler) {
	        delete handlers[event];
	      } else {
	        var _context4;

	        handlers[event] && splice$2(_context4 = handlers[event]).call(_context4, inArray(handlers[event], handler), 1);
	      }
	    });
	    return this;
	  };
	  /**
	   * @private emit event to the listeners
	   * @param {String} event
	   * @param {Object} data
	   */


	  _proto.emit = function emit(event, data) {
	    var _context5;

	    // we also want to trigger dom events
	    if (this.options.domEvents) {
	      triggerDomEvent(event, data);
	    } // no handlers, so skip it all


	    var handlers = this.handlers[event] && slice$3(_context5 = this.handlers[event]).call(_context5);

	    if (!handlers || !handlers.length) {
	      return;
	    }

	    data.type = event;

	    data.preventDefault = function () {
	      data.srcEvent.preventDefault();
	    };

	    var i = 0;

	    while (i < handlers.length) {
	      handlers[i](data);
	      i++;
	    }
	  };
	  /**
	   * @private
	   * destroy the manager and unbinds all events
	   * it doesn't unbind dom events, that is the user own responsibility
	   */


	  _proto.destroy = function destroy() {
	    this.element && toggleCssProps(this, false);
	    this.handlers = {};
	    this.session = {};
	    this.input.destroy();
	    this.element = null;
	  };

	  return Manager;
	}();

	var SINGLE_TOUCH_INPUT_MAP = {
	  touchstart: INPUT_START,
	  touchmove: INPUT_MOVE,
	  touchend: INPUT_END,
	  touchcancel: INPUT_CANCEL
	};
	var SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';
	var SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';
	/**
	 * @private
	 * Touch events input
	 * @constructor
	 * @extends Input
	 */

	var SingleTouchInput =
	/*#__PURE__*/
	function (_Input) {
	  _inheritsLoose(SingleTouchInput, _Input);

	  function SingleTouchInput() {
	    var _this;

	    var proto = SingleTouchInput.prototype;
	    proto.evTarget = SINGLE_TOUCH_TARGET_EVENTS;
	    proto.evWin = SINGLE_TOUCH_WINDOW_EVENTS;
	    _this = _Input.apply(this, arguments) || this;
	    _this.started = false;
	    return _this;
	  }

	  var _proto = SingleTouchInput.prototype;

	  _proto.handler = function handler(ev) {
	    var type = SINGLE_TOUCH_INPUT_MAP[ev.type]; // should we handle the touch events?

	    if (type === INPUT_START) {
	      this.started = true;
	    }

	    if (!this.started) {
	      return;
	    }

	    var touches = normalizeSingleTouches.call(this, ev, type); // when done, reset the started state

	    if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {
	      this.started = false;
	    }

	    this.callback(this.manager, type, {
	      pointers: touches[0],
	      changedPointers: touches[1],
	      pointerType: INPUT_TYPE_TOUCH,
	      srcEvent: ev
	    });
	  };

	  return SingleTouchInput;
	}(Input);

	function normalizeSingleTouches(ev, type) {
	  var all = toArray$1(ev.touches);
	  var changed = toArray$1(ev.changedTouches);

	  if (type & (INPUT_END | INPUT_CANCEL)) {
	    all = uniqueArray(concat$2(all).call(all, changed), 'identifier', true);
	  }

	  return [all, changed];
	}
	/**
	 * @private
	 * This recognizer is just used as a base for the simple attribute recognizers.
	 * @constructor
	 * @extends Recognizer
	 */


	var AttrRecognizer =
	/*#__PURE__*/
	function (_Recognizer) {
	  _inheritsLoose(AttrRecognizer, _Recognizer);

	  function AttrRecognizer(options) {
	    if (options === void 0) {
	      options = {};
	    }

	    return _Recognizer.call(this, _extends({
	      pointers: 1
	    }, options)) || this;
	  }
	  /**
	   * @private
	   * Used to check if it the recognizer receives valid input, like input.distance > 10.
	   * @memberof AttrRecognizer
	   * @param {Object} input
	   * @returns {Boolean} recognized
	   */


	  var _proto = AttrRecognizer.prototype;

	  _proto.attrTest = function attrTest(input) {
	    var optionPointers = this.options.pointers;
	    return optionPointers === 0 || input.pointers.length === optionPointers;
	  };
	  /**
	   * @private
	   * Process the input and return the state for the recognizer
	   * @memberof AttrRecognizer
	   * @param {Object} input
	   * @returns {*} State
	   */


	  _proto.process = function process(input) {
	    var state = this.state;
	    var eventType = input.eventType;
	    var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);
	    var isValid = this.attrTest(input); // on cancel input and we've recognized before, return STATE_CANCELLED

	    if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {
	      return state | STATE_CANCELLED;
	    } else if (isRecognized || isValid) {
	      if (eventType & INPUT_END) {
	        return state | STATE_ENDED;
	      } else if (!(state & STATE_BEGAN)) {
	        return STATE_BEGAN;
	      }

	      return state | STATE_CHANGED;
	    }

	    return STATE_FAILED;
	  };

	  return AttrRecognizer;
	}(Recognizer);
	/**
	 * @private
	 * A tap is recognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur
	 * between the given interval and position. The delay option can be used to recognize multi-taps without firing
	 * a single tap.
	 *
	 * The eventData from the emitted event contains the property `tapCount`, which contains the amount of
	 * multi-taps being recognized.
	 * @constructor
	 * @extends Recognizer
	 */


	var TapRecognizer =
	/*#__PURE__*/
	function (_Recognizer) {
	  _inheritsLoose(TapRecognizer, _Recognizer);

	  function TapRecognizer(options) {
	    var _this;

	    if (options === void 0) {
	      options = {};
	    }

	    _this = _Recognizer.call(this, _extends({
	      event: 'tap',
	      pointers: 1,
	      taps: 1,
	      interval: 300,
	      // max time between the multi-tap taps
	      time: 250,
	      // max time of the pointer to be down (like finger on the screen)
	      threshold: 9,
	      // a minimal movement is ok, but keep it low
	      posThreshold: 10
	    }, options)) || this; // previous time and center,
	    // used for tap counting

	    _this.pTime = false;
	    _this.pCenter = false;
	    _this._timer = null;
	    _this._input = null;
	    _this.count = 0;
	    return _this;
	  }

	  var _proto = TapRecognizer.prototype;

	  _proto.getTouchAction = function getTouchAction() {
	    return [TOUCH_ACTION_MANIPULATION];
	  };

	  _proto.process = function process(input) {
	    var _this2 = this;

	    var options = this.options;
	    var validPointers = input.pointers.length === options.pointers;
	    var validMovement = input.distance < options.threshold;
	    var validTouchTime = input.deltaTime < options.time;
	    this.reset();

	    if (input.eventType & INPUT_START && this.count === 0) {
	      return this.failTimeout();
	    } // we only allow little movement
	    // and we've reached an end event, so a tap is possible


	    if (validMovement && validTouchTime && validPointers) {
	      if (input.eventType !== INPUT_END) {
	        return this.failTimeout();
	      }

	      var validInterval = this.pTime ? input.timeStamp - this.pTime < options.interval : true;
	      var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;
	      this.pTime = input.timeStamp;
	      this.pCenter = input.center;

	      if (!validMultiTap || !validInterval) {
	        this.count = 1;
	      } else {
	        this.count += 1;
	      }

	      this._input = input; // if tap count matches we have recognized it,
	      // else it has began recognizing...

	      var tapCount = this.count % options.taps;

	      if (tapCount === 0) {
	        // no failing requirements, immediately trigger the tap event
	        // or wait as long as the multitap interval to trigger
	        if (!this.hasRequireFailures()) {
	          return STATE_RECOGNIZED;
	        } else {
	          this._timer = setTimeout$2(function () {
	            _this2.state = STATE_RECOGNIZED;

	            _this2.tryEmit();
	          }, options.interval);
	          return STATE_BEGAN;
	        }
	      }
	    }

	    return STATE_FAILED;
	  };

	  _proto.failTimeout = function failTimeout() {
	    var _this3 = this;

	    this._timer = setTimeout$2(function () {
	      _this3.state = STATE_FAILED;
	    }, this.options.interval);
	    return STATE_FAILED;
	  };

	  _proto.reset = function reset() {
	    clearTimeout(this._timer);
	  };

	  _proto.emit = function emit() {
	    if (this.state === STATE_RECOGNIZED) {
	      this._input.tapCount = this.count;
	      this.manager.emit(this.options.event, this._input);
	    }
	  };

	  return TapRecognizer;
	}(Recognizer);
	/**
	 * @private
	 * direction cons to string
	 * @param {constant} direction
	 * @returns {String}
	 */


	function directionStr(direction) {
	  if (direction === DIRECTION_DOWN) {
	    return 'down';
	  } else if (direction === DIRECTION_UP) {
	    return 'up';
	  } else if (direction === DIRECTION_LEFT) {
	    return 'left';
	  } else if (direction === DIRECTION_RIGHT) {
	    return 'right';
	  }

	  return '';
	}
	/**
	 * @private
	 * Pan
	 * Recognized when the pointer is down and moved in the allowed direction.
	 * @constructor
	 * @extends AttrRecognizer
	 */


	var PanRecognizer =
	/*#__PURE__*/
	function (_AttrRecognizer) {
	  _inheritsLoose(PanRecognizer, _AttrRecognizer);

	  function PanRecognizer(options) {
	    var _this;

	    if (options === void 0) {
	      options = {};
	    }

	    _this = _AttrRecognizer.call(this, _extends({
	      event: 'pan',
	      threshold: 10,
	      pointers: 1,
	      direction: DIRECTION_ALL
	    }, options)) || this;
	    _this.pX = null;
	    _this.pY = null;
	    return _this;
	  }

	  var _proto = PanRecognizer.prototype;

	  _proto.getTouchAction = function getTouchAction() {
	    var direction = this.options.direction;
	    var actions = [];

	    if (direction & DIRECTION_HORIZONTAL) {
	      actions.push(TOUCH_ACTION_PAN_Y);
	    }

	    if (direction & DIRECTION_VERTICAL) {
	      actions.push(TOUCH_ACTION_PAN_X);
	    }

	    return actions;
	  };

	  _proto.directionTest = function directionTest(input) {
	    var options = this.options;
	    var hasMoved = true;
	    var distance = input.distance;
	    var direction = input.direction;
	    var x = input.deltaX;
	    var y = input.deltaY; // lock to axis?

	    if (!(direction & options.direction)) {
	      if (options.direction & DIRECTION_HORIZONTAL) {
	        direction = x === 0 ? DIRECTION_NONE : x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;
	        hasMoved = x !== this.pX;
	        distance = Math.abs(input.deltaX);
	      } else {
	        direction = y === 0 ? DIRECTION_NONE : y < 0 ? DIRECTION_UP : DIRECTION_DOWN;
	        hasMoved = y !== this.pY;
	        distance = Math.abs(input.deltaY);
	      }
	    }

	    input.direction = direction;
	    return hasMoved && distance > options.threshold && direction & options.direction;
	  };

	  _proto.attrTest = function attrTest(input) {
	    return AttrRecognizer.prototype.attrTest.call(this, input) && ( // replace with a super call
	    this.state & STATE_BEGAN || !(this.state & STATE_BEGAN) && this.directionTest(input));
	  };

	  _proto.emit = function emit(input) {
	    this.pX = input.deltaX;
	    this.pY = input.deltaY;
	    var direction = directionStr(input.direction);

	    if (direction) {
	      input.additionalEvent = this.options.event + direction;
	    }

	    _AttrRecognizer.prototype.emit.call(this, input);
	  };

	  return PanRecognizer;
	}(AttrRecognizer);
	/**
	 * @private
	 * Swipe
	 * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction.
	 * @constructor
	 * @extends AttrRecognizer
	 */


	var SwipeRecognizer =
	/*#__PURE__*/
	function (_AttrRecognizer) {
	  _inheritsLoose(SwipeRecognizer, _AttrRecognizer);

	  function SwipeRecognizer(options) {
	    if (options === void 0) {
	      options = {};
	    }

	    return _AttrRecognizer.call(this, _extends({
	      event: 'swipe',
	      threshold: 10,
	      velocity: 0.3,
	      direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,
	      pointers: 1
	    }, options)) || this;
	  }

	  var _proto = SwipeRecognizer.prototype;

	  _proto.getTouchAction = function getTouchAction() {
	    return PanRecognizer.prototype.getTouchAction.call(this);
	  };

	  _proto.attrTest = function attrTest(input) {
	    var direction = this.options.direction;
	    var velocity;

	    if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {
	      velocity = input.overallVelocity;
	    } else if (direction & DIRECTION_HORIZONTAL) {
	      velocity = input.overallVelocityX;
	    } else if (direction & DIRECTION_VERTICAL) {
	      velocity = input.overallVelocityY;
	    }

	    return _AttrRecognizer.prototype.attrTest.call(this, input) && direction & input.offsetDirection && input.distance > this.options.threshold && input.maxPointers === this.options.pointers && abs(velocity) > this.options.velocity && input.eventType & INPUT_END;
	  };

	  _proto.emit = function emit(input) {
	    var direction = directionStr(input.offsetDirection);

	    if (direction) {
	      this.manager.emit(this.options.event + direction, input);
	    }

	    this.manager.emit(this.options.event, input);
	  };

	  return SwipeRecognizer;
	}(AttrRecognizer);
	/**
	 * @private
	 * Pinch
	 * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out).
	 * @constructor
	 * @extends AttrRecognizer
	 */


	var PinchRecognizer =
	/*#__PURE__*/
	function (_AttrRecognizer) {
	  _inheritsLoose(PinchRecognizer, _AttrRecognizer);

	  function PinchRecognizer(options) {
	    if (options === void 0) {
	      options = {};
	    }

	    return _AttrRecognizer.call(this, _extends({
	      event: 'pinch',
	      threshold: 0,
	      pointers: 2
	    }, options)) || this;
	  }

	  var _proto = PinchRecognizer.prototype;

	  _proto.getTouchAction = function getTouchAction() {
	    return [TOUCH_ACTION_NONE];
	  };

	  _proto.attrTest = function attrTest(input) {
	    return _AttrRecognizer.prototype.attrTest.call(this, input) && (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);
	  };

	  _proto.emit = function emit(input) {
	    if (input.scale !== 1) {
	      var inOut = input.scale < 1 ? 'in' : 'out';
	      input.additionalEvent = this.options.event + inOut;
	    }

	    _AttrRecognizer.prototype.emit.call(this, input);
	  };

	  return PinchRecognizer;
	}(AttrRecognizer);
	/**
	 * @private
	 * Rotate
	 * Recognized when two or more pointer are moving in a circular motion.
	 * @constructor
	 * @extends AttrRecognizer
	 */


	var RotateRecognizer =
	/*#__PURE__*/
	function (_AttrRecognizer) {
	  _inheritsLoose(RotateRecognizer, _AttrRecognizer);

	  function RotateRecognizer(options) {
	    if (options === void 0) {
	      options = {};
	    }

	    return _AttrRecognizer.call(this, _extends({
	      event: 'rotate',
	      threshold: 0,
	      pointers: 2
	    }, options)) || this;
	  }

	  var _proto = RotateRecognizer.prototype;

	  _proto.getTouchAction = function getTouchAction() {
	    return [TOUCH_ACTION_NONE];
	  };

	  _proto.attrTest = function attrTest(input) {
	    return _AttrRecognizer.prototype.attrTest.call(this, input) && (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);
	  };

	  return RotateRecognizer;
	}(AttrRecognizer);
	/**
	 * @private
	 * Press
	 * Recognized when the pointer is down for x ms without any movement.
	 * @constructor
	 * @extends Recognizer
	 */


	var PressRecognizer =
	/*#__PURE__*/
	function (_Recognizer) {
	  _inheritsLoose(PressRecognizer, _Recognizer);

	  function PressRecognizer(options) {
	    var _this;

	    if (options === void 0) {
	      options = {};
	    }

	    _this = _Recognizer.call(this, _extends({
	      event: 'press',
	      pointers: 1,
	      time: 251,
	      // minimal time of the pointer to be pressed
	      threshold: 9
	    }, options)) || this;
	    _this._timer = null;
	    _this._input = null;
	    return _this;
	  }

	  var _proto = PressRecognizer.prototype;

	  _proto.getTouchAction = function getTouchAction() {
	    return [TOUCH_ACTION_AUTO];
	  };

	  _proto.process = function process(input) {
	    var _this2 = this;

	    var options = this.options;
	    var validPointers = input.pointers.length === options.pointers;
	    var validMovement = input.distance < options.threshold;
	    var validTime = input.deltaTime > options.time;
	    this._input = input; // we only allow little movement
	    // and we've reached an end event, so a tap is possible

	    if (!validMovement || !validPointers || input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime) {
	      this.reset();
	    } else if (input.eventType & INPUT_START) {
	      this.reset();
	      this._timer = setTimeout$2(function () {
	        _this2.state = STATE_RECOGNIZED;

	        _this2.tryEmit();
	      }, options.time);
	    } else if (input.eventType & INPUT_END) {
	      return STATE_RECOGNIZED;
	    }

	    return STATE_FAILED;
	  };

	  _proto.reset = function reset() {
	    clearTimeout(this._timer);
	  };

	  _proto.emit = function emit(input) {
	    if (this.state !== STATE_RECOGNIZED) {
	      return;
	    }

	    if (input && input.eventType & INPUT_END) {
	      this.manager.emit(this.options.event + "up", input);
	    } else {
	      this._input.timeStamp = now$3();
	      this.manager.emit(this.options.event, this._input);
	    }
	  };

	  return PressRecognizer;
	}(Recognizer);
	/**
	 * @private
	 * wrap a method with a deprecation warning and stack trace
	 * @param {Function} method
	 * @param {String} name
	 * @param {String} message
	 * @returns {Function} A new function wrapping the supplied method.
	 */


	function deprecate(method, name, message) {
	  var deprecationMessage = "DEPRECATED METHOD: " + name + "\n" + message + " AT \n";
	  return function () {
	    var e = new Error('get-stack-trace');
	    var stack = e && e.stack ? e.stack.replace(/^[^\(]+?[\n$]/gm, '').replace(/^\s+at\s+/gm, '').replace(/^Object.<anonymous>\s*\(/gm, '{anonymous}()@') : 'Unknown Stack Trace';
	    var log = window.console && (window.console.warn || window.console.log);

	    if (log) {
	      log.call(window.console, deprecationMessage, stack);
	    }

	    return method.apply(this, arguments);
	  };
	}
	/**
	 * @private
	 * extend object.
	 * means that properties in dest will be overwritten by the ones in src.
	 * @param {Object} dest
	 * @param {Object} src
	 * @param {Boolean} [merge=false]
	 * @returns {Object} dest
	 */


	var extend$1 = deprecate(function (dest, src, merge) {
	  var keys = keys$6(src);

	  var i = 0;

	  while (i < keys.length) {
	    if (!merge || merge && dest[keys[i]] === undefined) {
	      dest[keys[i]] = src[keys[i]];
	    }

	    i++;
	  }

	  return dest;
	}, 'extend', 'Use `assign`.');
	/**
	 * @private
	 * merge the values from src in the dest.
	 * means that properties that exist in dest will not be overwritten by src
	 * @param {Object} dest
	 * @param {Object} src
	 * @returns {Object} dest
	 */

	var merge$1 = deprecate(function (dest, src) {
	  return extend$1(dest, src, true);
	}, 'merge', 'Use `assign`.');
	/**
	 * @private
	 * simple class inheritance
	 * @param {Function} child
	 * @param {Function} base
	 * @param {Object} [properties]
	 */

	function inherit(child, base, properties) {
	  var baseP = base.prototype;
	  var childP;
	  childP = child.prototype = create$2(baseP);
	  childP.constructor = child;
	  childP._super = baseP;

	  if (properties) {
	    assign$1$2(childP, properties);
	  }
	}
	/**
	 * @private
	 * simple function bind
	 * @param {Function} fn
	 * @param {Object} context
	 * @returns {Function}
	 */


	function bindFn(fn, context) {
	  return function boundFn() {
	    return fn.apply(context, arguments);
	  };
	}
	/**
	 * @private
	 * Simple way to create a manager with a default set of recognizers.
	 * @param {HTMLElement} element
	 * @param {Object} [options]
	 * @constructor
	 */


	var Hammer =
	/*#__PURE__*/
	function () {
	  var Hammer =
	  /**
	    * @private
	    * @const {string}
	    */
	  function Hammer(element, options) {
	    if (options === void 0) {
	      options = {};
	    }

	    return new Manager(element, _extends({
	      recognizers: [// RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...]
	      [RotateRecognizer, {
	        enable: false
	      }], [PinchRecognizer, {
	        enable: false
	      }, ['rotate']], [SwipeRecognizer, {
	        direction: DIRECTION_HORIZONTAL
	      }], [PanRecognizer, {
	        direction: DIRECTION_HORIZONTAL
	      }, ['swipe']], [TapRecognizer], [TapRecognizer, {
	        event: 'doubletap',
	        taps: 2
	      }, ['tap']], [PressRecognizer]]
	    }, options));
	  };

	  Hammer.VERSION = "2.0.16";
	  Hammer.DIRECTION_ALL = DIRECTION_ALL;
	  Hammer.DIRECTION_DOWN = DIRECTION_DOWN;
	  Hammer.DIRECTION_LEFT = DIRECTION_LEFT;
	  Hammer.DIRECTION_RIGHT = DIRECTION_RIGHT;
	  Hammer.DIRECTION_UP = DIRECTION_UP;
	  Hammer.DIRECTION_HORIZONTAL = DIRECTION_HORIZONTAL;
	  Hammer.DIRECTION_VERTICAL = DIRECTION_VERTICAL;
	  Hammer.DIRECTION_NONE = DIRECTION_NONE;
	  Hammer.DIRECTION_DOWN = DIRECTION_DOWN;
	  Hammer.INPUT_START = INPUT_START;
	  Hammer.INPUT_MOVE = INPUT_MOVE;
	  Hammer.INPUT_END = INPUT_END;
	  Hammer.INPUT_CANCEL = INPUT_CANCEL;
	  Hammer.STATE_POSSIBLE = STATE_POSSIBLE;
	  Hammer.STATE_BEGAN = STATE_BEGAN;
	  Hammer.STATE_CHANGED = STATE_CHANGED;
	  Hammer.STATE_ENDED = STATE_ENDED;
	  Hammer.STATE_RECOGNIZED = STATE_RECOGNIZED;
	  Hammer.STATE_CANCELLED = STATE_CANCELLED;
	  Hammer.STATE_FAILED = STATE_FAILED;
	  Hammer.Manager = Manager;
	  Hammer.Input = Input;
	  Hammer.TouchAction = TouchAction;
	  Hammer.TouchInput = TouchInput;
	  Hammer.MouseInput = MouseInput;
	  Hammer.PointerEventInput = PointerEventInput;
	  Hammer.TouchMouseInput = TouchMouseInput;
	  Hammer.SingleTouchInput = SingleTouchInput;
	  Hammer.Recognizer = Recognizer;
	  Hammer.AttrRecognizer = AttrRecognizer;
	  Hammer.Tap = TapRecognizer;
	  Hammer.Pan = PanRecognizer;
	  Hammer.Swipe = SwipeRecognizer;
	  Hammer.Pinch = PinchRecognizer;
	  Hammer.Rotate = RotateRecognizer;
	  Hammer.Press = PressRecognizer;
	  Hammer.on = addEventListeners;
	  Hammer.off = removeEventListeners;
	  Hammer.each = each;
	  Hammer.merge = merge$1;
	  Hammer.extend = extend$1;
	  Hammer.bindFn = bindFn;
	  Hammer.assign = assign$1$2;
	  Hammer.inherit = inherit;
	  Hammer.bindFn = bindFn;
	  Hammer.prefixed = prefixed;
	  Hammer.toArray = toArray$1;
	  Hammer.inArray = inArray;
	  Hammer.uniqueArray = uniqueArray;
	  Hammer.splitStr = splitStr;
	  Hammer.boolOrFn = boolOrFn;
	  Hammer.hasParent = hasParent$1;
	  Hammer.addEventListeners = addEventListeners;
	  Hammer.removeEventListeners = removeEventListeners;
	  Hammer.defaults = defaults;
	  return Hammer;
	}();

	var hammer = createCommonjsModule(function (module) {
	  /**
	   * Setup a mock hammer.js object, for unit testing.
	   *
	   * Inspiration: https://github.com/uber/deck.gl/pull/658
	   *
	   * @returns {{on: noop, off: noop, destroy: noop, emit: noop, get: get}}
	   */
	  function hammerMock() {
	    var noop = function noop() {};

	    return {
	      on: noop,
	      off: noop,
	      destroy: noop,
	      emit: noop,
	      get: function get(m) {
	        //eslint-disable-line no-unused-vars
	        return {
	          set: noop
	        };
	      }
	    };
	  }

	  if (typeof window !== 'undefined') {
	    var Hammer$1 = window['Hammer'] || Hammer;
	    module.exports = Hammer$1;
	  } else {
	    module.exports = function () {
	      // hammer.js is only available in a browser, not in node.js. Replacing it with a mock object.
	      return hammerMock();
	    };
	  }
	});

	getCjsExportFromNamespace(Activator);

	/**
	 * Turn an element into an clickToUse element.
	 * When not active, the element has a transparent overlay. When the overlay is
	 * clicked, the mode is changed to active.
	 * When active, the element is displayed with a blue border around it, and
	 * the interactive contents of the element can be used. When clicked outside
	 * the element, the elements mode is changed to inactive.
	 * @param {Element} container
	 * @constructor Activator
	 */

	function Activator$1(container) {
	  var _context,
	      _this = this,
	      _context2;

	  this.active = false;
	  this.dom = {
	    container: container
	  };
	  this.dom.overlay = document.createElement('div');
	  this.dom.overlay.className = 'vis-overlay';
	  this.dom.container.appendChild(this.dom.overlay);
	  this.hammer = hammer(this.dom.overlay);
	  this.hammer.on('tap', bind$2(_context = this._onTapOverlay).call(_context, this)); // block all touch events (except tap)

	  var events = ['tap', 'doubletap', 'press', 'pinch', 'pan', 'panstart', 'panmove', 'panend'];

	  forEach$2(events).call(events, function (event) {
	    _this.hammer.on(event, function (event) {
	      event.srcEvent.stopPropagation();
	    });
	  }); // attach a click event to the window, in order to deactivate when clicking outside the timeline


	  if (document && document.body) {
	    this.onClick = function (event) {
	      if (!_hasParent(event.target, container)) {
	        _this.deactivate();
	      }
	    };

	    document.body.addEventListener('click', this.onClick);
	  }

	  if (this.keycharm !== undefined) {
	    this.keycharm.destroy();
	  }

	  this.keycharm = keycharm(); // keycharm listener only bounded when active)

	  this.escListener = bind$2(_context2 = this.deactivate).call(_context2, this);
	} // turn into an event emitter


	componentEmitter(Activator$1.prototype); // The currently active activator

	Activator$1.current = null;
	/**
	 * Destroy the activator. Cleans up all created DOM and event listeners
	 */

	Activator$1.prototype.destroy = function () {
	  this.deactivate(); // remove dom

	  this.dom.overlay.parentNode.removeChild(this.dom.overlay); // remove global event listener

	  if (this.onClick) {
	    document.body.removeEventListener('click', this.onClick);
	  } // remove keycharm


	  if (this.keycharm !== undefined) {
	    this.keycharm.destroy();
	  }

	  this.keycharm = null; // cleanup hammer instances

	  this.hammer.destroy();
	  this.hammer = null; // FIXME: cleaning up hammer instances doesn't work (Timeline not removed from memory)
	};
	/**
	 * Activate the element
	 * Overlay is hidden, element is decorated with a blue shadow border
	 */


	Activator$1.prototype.activate = function () {
	  var _context3;

	  // we allow only one active activator at a time
	  if (Activator$1.current) {
	    Activator$1.current.deactivate();
	  }

	  Activator$1.current = this;
	  this.active = true;
	  this.dom.overlay.style.display = 'none';
	  util.addClassName(this.dom.container, 'vis-active');
	  this.emit('change');
	  this.emit('activate'); // ugly hack: bind ESC after emitting the events, as the Network rebinds all
	  // keyboard events on a 'change' event

	  bind$2(_context3 = this.keycharm).call(_context3, 'esc', this.escListener);
	};
	/**
	 * Deactivate the element
	 * Overlay is displayed on top of the element
	 */


	Activator$1.prototype.deactivate = function () {
	  this.active = false;
	  this.dom.overlay.style.display = 'block';
	  util.removeClassName(this.dom.container, 'vis-active');
	  this.keycharm.unbind('esc', this.escListener);
	  this.emit('change');
	  this.emit('deactivate');
	};
	/**
	 * Handle a tap event: activate the container
	 * @param {Event}  event   The event
	 * @private
	 */


	Activator$1.prototype._onTapOverlay = function (event) {
	  // activate the container
	  this.activate();
	  event.srcEvent.stopPropagation();
	};
	/**
	 * Test whether the element has the requested parent element somewhere in
	 * its chain of parent nodes.
	 * @param {HTMLElement} element
	 * @param {HTMLElement} parent
	 * @returns {boolean} Returns true when the parent is found somewhere in the
	 *                    chain of parent nodes.
	 * @private
	 */


	function _hasParent(element, parent) {
	  while (element) {
	    if (element === parent) {
	      return true;
	    }

	    element = element.parentNode;
	  }

	  return false;
	}

	var Activator_1 = Activator$1;

	var locales = createCommonjsModule(function (module, exports) {
	  // English
	  exports['en'] = {
	    edit: 'Edit',
	    del: 'Delete selected',
	    back: 'Back',
	    addNode: 'Add Node',
	    addEdge: 'Add Edge',
	    editNode: 'Edit Node',
	    editEdge: 'Edit Edge',
	    addDescription: 'Click in an empty space to place a new node.',
	    edgeDescription: 'Click on a node and drag the edge to another node to connect them.',
	    editEdgeDescription: 'Click on the control points and drag them to a node to connect to it.',
	    createEdgeError: 'Cannot link edges to a cluster.',
	    deleteClusterError: 'Clusters cannot be deleted.',
	    editClusterError: 'Clusters cannot be edited.'
	  };
	  exports['en_EN'] = exports['en'];
	  exports['en_US'] = exports['en']; // German

	  exports['de'] = {
	    edit: 'Editieren',
	    del: "L\xF6sche Auswahl",
	    back: "Zur\xFCck",
	    addNode: "Knoten hinzuf\xFCgen",
	    addEdge: "Kante hinzuf\xFCgen",
	    editNode: 'Knoten editieren',
	    editEdge: 'Kante editieren',
	    addDescription: 'Klicke auf eine freie Stelle, um einen neuen Knoten zu plazieren.',
	    edgeDescription: 'Klicke auf einen Knoten und ziehe die Kante zu einem anderen Knoten, um diese zu verbinden.',
	    editEdgeDescription: 'Klicke auf die Verbindungspunkte und ziehe diese auf einen Knoten, um sie zu verbinden.',
	    createEdgeError: "Es ist nicht m\xF6glich, Kanten mit Clustern zu verbinden.",
	    deleteClusterError: "Cluster k\xF6nnen nicht gel\xF6scht werden.",
	    editClusterError: "Cluster k\xF6nnen nicht editiert werden."
	  };
	  exports['de_DE'] = exports['de']; // Spanish

	  exports['es'] = {
	    edit: 'Editar',
	    del: "Eliminar selecci\xF3n",
	    back: "Atr\xE1s",
	    addNode: "A\xF1adir nodo",
	    addEdge: "A\xF1adir arista",
	    editNode: 'Editar nodo',
	    editEdge: 'Editar arista',
	    addDescription: "Haga clic en un lugar vac\xEDo para colocar un nuevo nodo.",
	    edgeDescription: 'Haga clic en un nodo y arrastre la arista hacia otro nodo para conectarlos.',
	    editEdgeDescription: 'Haga clic en un punto de control y arrastrelo a un nodo para conectarlo.',
	    createEdgeError: 'No se puede conectar una arista a un grupo.',
	    deleteClusterError: 'No es posible eliminar grupos.',
	    editClusterError: 'No es posible editar grupos.'
	  };
	  exports['es_ES'] = exports['es']; //Italiano

	  exports['it'] = {
	    edit: 'Modifica',
	    del: 'Cancella la selezione',
	    back: 'Indietro',
	    addNode: 'Aggiungi un nodo',
	    addEdge: 'Aggiungi un vertice',
	    editNode: 'Modifica il nodo',
	    editEdge: 'Modifica il vertice',
	    addDescription: 'Clicca per aggiungere un nuovo nodo',
	    edgeDescription: 'Clicca su un nodo e trascinalo ad un altro nodo per connetterli.',
	    editEdgeDescription: 'Clicca sui Punti di controllo e trascinali ad un nodo per connetterli.',
	    createEdgeError: 'Non si possono collegare vertici ad un cluster',
	    deleteClusterError: 'I cluster non possono essere cancellati',
	    editClusterError: 'I clusters non possono essere modificati.'
	  };
	  exports['it_IT'] = exports['it']; // Dutch

	  exports['nl'] = {
	    edit: 'Wijzigen',
	    del: 'Selectie verwijderen',
	    back: 'Terug',
	    addNode: 'Node toevoegen',
	    addEdge: 'Link toevoegen',
	    editNode: 'Node wijzigen',
	    editEdge: 'Link wijzigen',
	    addDescription: 'Klik op een leeg gebied om een nieuwe node te maken.',
	    edgeDescription: 'Klik op een node en sleep de link naar een andere node om ze te verbinden.',
	    editEdgeDescription: 'Klik op de verbindingspunten en sleep ze naar een node om daarmee te verbinden.',
	    createEdgeError: 'Kan geen link maken naar een cluster.',
	    deleteClusterError: 'Clusters kunnen niet worden verwijderd.',
	    editClusterError: 'Clusters kunnen niet worden aangepast.'
	  };
	  exports['nl_NL'] = exports['nl'];
	  exports['nl_BE'] = exports['nl']; // Portuguese Brazil

	  exports['pt-br'] = {
	    edit: 'Editar',
	    del: 'Remover selecionado',
	    back: 'Voltar',
	    addNode: 'Adicionar nó',
	    addEdge: 'Adicionar aresta',
	    editNode: 'Editar nó',
	    editEdge: 'Editar aresta',
	    addDescription: 'Clique em um espaço em branco para adicionar um novo nó',
	    edgeDescription: 'Clique em um nó e arraste a aresta até outro nó para conectá-los',
	    editEdgeDescription: 'Clique nos pontos de controle e os arraste para um nó para conectá-los',
	    createEdgeError: 'Não foi possível linkar arestas a um cluster.',
	    deleteClusterError: 'Clusters não puderam ser removidos.',
	    editClusterError: 'Clusters não puderam ser editados.'
	  };
	  exports['pt-BR'] = exports['pt-br'];
	  exports['pt_BR'] = exports['pt-br'];
	  exports['pt_br'] = exports['pt-br']; // Russian

	  exports['ru'] = {
	    edit: 'Редактировать',
	    del: 'Удалить выбранное',
	    back: 'Назад',
	    addNode: 'Добавить узел',
	    addEdge: 'Добавить ребро',
	    editNode: 'Редактировать узел',
	    editEdge: 'Редактировать ребро',
	    addDescription: 'Кликните в свободное место, чтобы добавить новый узел.',
	    edgeDescription: 'Кликните на узел и протяните ребро к другому узлу, чтобы соединить их.',
	    editEdgeDescription: 'Кликните на контрольные точки и перетащите их в узел, чтобы подключиться к нему.',
	    createEdgeError: 'Невозможно соединить ребра в кластер.',
	    deleteClusterError: 'Кластеры не могут быть удалены',
	    editClusterError: 'Кластеры недоступны для редактирования.'
	  };
	  exports['ru_RU'] = exports['ru']; // Chinese

	  exports['cn'] = {
	    edit: '编辑',
	    del: '删除选定',
	    back: '返回',
	    addNode: '添加节点',
	    addEdge: '添加连接线',
	    editNode: '编辑节点',
	    editEdge: '编辑连接线',
	    addDescription: '单击空白处放置新节点。',
	    edgeDescription: '单击某个节点并将该连接线拖动到另一个节点以连接它们。',
	    editEdgeDescription: '单击控制节点并将它们拖到节点上连接。',
	    createEdgeError: '无法将连接线连接到群集。',
	    deleteClusterError: '无法删除群集。',
	    editClusterError: '无法编辑群集。'
	  };
	  exports['zh_CN'] = exports['cn']; // Ukrainian

	  exports['uk'] = {
	    edit: 'Редагувати',
	    del: 'Видалити обране',
	    back: 'Назад',
	    addNode: 'Додати вузол',
	    addEdge: 'Додати край',
	    editNode: 'Редагувати вузол',
	    editEdge: 'Редагувати край',
	    addDescription: 'Kлікніть на вільне місце, щоб додати новий вузол.',
	    edgeDescription: 'Клікніть на вузол і перетягніть край до іншого вузла, щоб їх з\'єднати.',
	    editEdgeDescription: 'Клікніть на контрольні точки і перетягніть їх у вузол, щоб підключитися до нього.',
	    createEdgeError: 'Не можливо об\'єднати краї в групу.',
	    deleteClusterError: 'Групи не можуть бути видалені.',
	    editClusterError: 'Групи недоступні для редагування.'
	  };
	  exports['uk_UA'] = exports['uk']; // French

	  exports['fr'] = {
	    edit: 'Editer',
	    del: 'Effacer la selection',
	    back: 'Retour',
	    addNode: 'Ajouter un noeud',
	    addEdge: 'Ajouter un lien',
	    editNode: 'Editer le noeud',
	    editEdge: 'Editer le lien',
	    addDescription: 'Cliquez dans un endroit vide pour placer un noeud.',
	    edgeDescription: 'Cliquez sur un noeud et glissez le lien vers un autre noeud pour les connecter.',
	    editEdgeDescription: 'Cliquez sur les points de contrôle et glissez-les pour connecter un noeud.',
	    createEdgeError: 'Impossible de créer un lien vers un cluster.',
	    deleteClusterError: 'Les clusters ne peuvent pas être éffacés.',
	    editClusterError: 'Les clusters ne peuvent pas être édites.'
	  };
	  exports['fr_FR'] = exports['fr']; // Czech

	  exports['cs'] = {
	    edit: 'Upravit',
	    del: 'Smazat výběr',
	    back: 'Zpět',
	    addNode: 'Přidat vrchol',
	    addEdge: 'Přidat hranu',
	    editNode: 'Upravit vrchol',
	    editEdge: 'Upravit hranu',
	    addDescription: 'Kluknutím do prázdného prostoru můžete přidat nový vrchol.',
	    edgeDescription: 'Přetažením z jednoho vrcholu do druhého můžete spojit tyto vrcholy novou hranou.',
	    editEdgeDescription: 'Přetažením kontrolního vrcholu hrany ji můžete připojit k jinému vrcholu.',
	    createEdgeError: 'Nelze připojit hranu ke shluku.',
	    deleteClusterError: 'Nelze mazat shluky.',
	    editClusterError: 'Nelze upravovat shluky.'
	  };
	  exports['cs_CZ'] = exports['cs'];
	});

	function _classCallCheck(instance, Constructor) {
	  if (!(instance instanceof Constructor)) {
	    throw new TypeError("Cannot call a class as a function");
	  }
	}

	var classCallCheck = _classCallCheck;

	var defineProperty$7 = defineProperty_1;

	var defineProperty$8 = defineProperty$7;

	function _defineProperties(target, props) {
	  for (var i = 0; i < props.length; i++) {
	    var descriptor = props[i];
	    descriptor.enumerable = descriptor.enumerable || false;
	    descriptor.configurable = true;
	    if ("value" in descriptor) descriptor.writable = true;

	    defineProperty$8(target, descriptor.key, descriptor);
	  }
	}

	function _createClass(Constructor, protoProps, staticProps) {
	  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
	  if (staticProps) _defineProperties(Constructor, staticProps);
	  return Constructor;
	}

	var createClass = _createClass;

	/**
	 * Associates a canvas to a given image, containing a number of renderings
	 * of the image at various sizes.
	 *
	 * This technique is known as 'mipmapping'.
	 *
	 * NOTE: Images can also be of type 'data:svg+xml`. This code also works
	 *       for svg, but the mipmapping may not be necessary.
	 *
	 * @param {Image} image
	 */
	var CachedImage =
	/*#__PURE__*/
	function () {
	  /**
	   * @ignore
	   */
	  function CachedImage() {
	    classCallCheck(this, CachedImage);

	    // eslint-disable-line no-unused-vars
	    this.NUM_ITERATIONS = 4; // Number of items in the coordinates array

	    this.image = new Image();
	    this.canvas = document.createElement('canvas');
	  }
	  /**
	   * Called when the image has been successfully loaded.
	   */


	  createClass(CachedImage, [{
	    key: "init",
	    value: function init() {
	      if (this.initialized()) return;
	      this.src = this.image.src; // For same interface with Image

	      var w = this.image.width;
	      var h = this.image.height; // Ease external access

	      this.width = w;
	      this.height = h;
	      var h2 = Math.floor(h / 2);
	      var h4 = Math.floor(h / 4);
	      var h8 = Math.floor(h / 8);
	      var h16 = Math.floor(h / 16);
	      var w2 = Math.floor(w / 2);
	      var w4 = Math.floor(w / 4);
	      var w8 = Math.floor(w / 8);
	      var w16 = Math.floor(w / 16); // Make canvas as small as possible

	      this.canvas.width = 3 * w4;
	      this.canvas.height = h2; // Coordinates and sizes of images contained in the canvas
	      // Values per row:  [top x, left y, width, height]

	      this.coordinates = [[0, 0, w2, h2], [w2, 0, w4, h4], [w2, h4, w8, h8], [5 * w8, h4, w16, h16]];

	      this._fillMipMap();
	    }
	    /**
	     * @return {Boolean} true if init() has been called, false otherwise.
	     */

	  }, {
	    key: "initialized",
	    value: function initialized() {
	      return this.coordinates !== undefined;
	    }
	    /**
	     * Redraw main image in various sizes to the context.
	     *
	     * The rationale behind this is to reduce artefacts due to interpolation
	     * at differing zoom levels.
	     *
	     * Source: http://stackoverflow.com/q/18761404/1223531
	     *
	     * This methods takes the resizing out of the drawing loop, in order to
	     * reduce performance overhead.
	     *
	     * TODO: The code assumes that a 2D context can always be gotten. This is
	     *       not necessarily true! OTOH, if not true then usage of this class
	     *       is senseless.
	     *
	     * @private
	     */

	  }, {
	    key: "_fillMipMap",
	    value: function _fillMipMap() {
	      var ctx = this.canvas.getContext('2d'); // First zoom-level comes from the image

	      var to = this.coordinates[0];
	      ctx.drawImage(this.image, to[0], to[1], to[2], to[3]); // The rest are copy actions internal to the canvas/context

	      for (var iterations = 1; iterations < this.NUM_ITERATIONS; iterations++) {
	        var from = this.coordinates[iterations - 1];
	        var _to = this.coordinates[iterations];
	        ctx.drawImage(this.canvas, from[0], from[1], from[2], from[3], _to[0], _to[1], _to[2], _to[3]);
	      }
	    }
	    /**
	     * Draw the image, using the mipmap if necessary.
	     *
	     * MipMap is only used if param factor > 2; otherwise, original bitmap
	     * is resized. This is also used to skip mipmap usage, e.g. by setting factor = 1
	     *
	     * Credits to 'Alex de Mulder' for original implementation.
	     *
	     * @param {CanvasRenderingContext2D} ctx  context on which to draw zoomed image
	     * @param {Float} factor scale factor at which to draw
	     * @param {number} left
	     * @param {number} top
	     * @param {number} width
	     * @param {number} height
	     */

	  }, {
	    key: "drawImageAtPosition",
	    value: function drawImageAtPosition(ctx, factor, left, top, width, height) {
	      if (!this.initialized()) return; //can't draw image yet not intialized

	      if (factor > 2) {
	        // Determine which zoomed image to use
	        factor *= 0.5;
	        var iterations = 0;

	        while (factor > 2 && iterations < this.NUM_ITERATIONS) {
	          factor *= 0.5;
	          iterations += 1;
	        }

	        if (iterations >= this.NUM_ITERATIONS) {
	          iterations = this.NUM_ITERATIONS - 1;
	        } //console.log("iterations: " + iterations);


	        var from = this.coordinates[iterations];
	        ctx.drawImage(this.canvas, from[0], from[1], from[2], from[3], left, top, width, height);
	      } else {
	        // Draw image directly
	        ctx.drawImage(this.image, left, top, width, height);
	      }
	    }
	  }]);

	  return CachedImage;
	}();

	/**
	 * This callback is a callback that accepts an Image.
	 * @callback ImageCallback
	 * @param {Image} image
	 */

	/**
	 * This class loads images and keeps them stored.
	 *
	 * @param {ImageCallback} callback
	 */

	var Images =
	/*#__PURE__*/
	function () {
	  /**
	   * @param {ImageCallback} callback
	   */
	  function Images(callback) {
	    classCallCheck(this, Images);

	    this.images = {};
	    this.imageBroken = {};
	    this.callback = callback;
	  }
	  /**
	   * @param {string} url                      The original Url that failed to load, if the broken image is successfully loaded it will be added to the cache using this Url as the key so that subsequent requests for this Url will return the broken image
	   * @param {string} brokenUrl                Url the broken image to try and load
	   * @param {Image} imageToLoadBrokenUrlOn   The image object
	   */


	  createClass(Images, [{
	    key: "_tryloadBrokenUrl",
	    value: function _tryloadBrokenUrl(url, brokenUrl, imageToLoadBrokenUrlOn) {
	      //If these parameters aren't specified then exit the function because nothing constructive can be done
	      if (url === undefined || imageToLoadBrokenUrlOn === undefined) return;

	      if (brokenUrl === undefined) {
	        console.warn("No broken url image defined");
	        return;
	      } //Clear the old subscription to the error event and put a new in place that only handle errors in loading the brokenImageUrl


	      imageToLoadBrokenUrlOn.image.onerror = function () {
	        console.error("Could not load brokenImage:", brokenUrl); // cache item will contain empty image, this should be OK for default
	      }; //Set the source of the image to the brokenUrl, this is actually what kicks off the loading of the broken image


	      imageToLoadBrokenUrlOn.image.src = brokenUrl;
	    }
	    /**
	     *
	     * @param {vis.Image} imageToRedrawWith
	     * @private
	     */

	  }, {
	    key: "_redrawWithImage",
	    value: function _redrawWithImage(imageToRedrawWith) {
	      if (this.callback) {
	        this.callback(imageToRedrawWith);
	      }
	    }
	    /**
	     * @param {string} url          Url of the image
	     * @param {string} brokenUrl    Url of an image to use if the url image is not found
	     * @return {Image} img          The image object
	     */

	  }, {
	    key: "load",
	    value: function load(url, brokenUrl) {
	      var _this = this;

	      //Try and get the image from the cache, if successful then return the cached image   
	      var cachedImage = this.images[url];
	      if (cachedImage) return cachedImage; //Create a new image

	      var img = new CachedImage(); // Need to add to cache here, otherwise final return will spawn different copies of the same image,
	      // Also, there will be multiple loads of the same image.

	      this.images[url] = img; //Subscribe to the event that is raised if the image loads successfully 

	      img.image.onload = function () {
	        // Properly init the cached item and then request a redraw
	        _this._fixImageCoordinates(img.image);

	        img.init();

	        _this._redrawWithImage(img);
	      }; //Subscribe to the event that is raised if the image fails to load


	      img.image.onerror = function () {
	        console.error("Could not load image:", url); //Try and load the image specified by the brokenUrl using

	        _this._tryloadBrokenUrl(url, brokenUrl, img);
	      }; //Set the source of the image to the url, this is what actually kicks off the loading of the image


	      img.image.src = url; //Return the new image

	      return img;
	    }
	    /**
	     * IE11 fix -- thanks dponch!
	     *
	     * Local helper function
	     * @param {vis.Image} imageToCache
	     * @private
	     */

	  }, {
	    key: "_fixImageCoordinates",
	    value: function _fixImageCoordinates(imageToCache) {
	      if (imageToCache.width === 0) {
	        document.body.appendChild(imageToCache);
	        imageToCache.width = imageToCache.offsetWidth;
	        imageToCache.height = imageToCache.offsetHeight;
	        document.body.removeChild(imageToCache);
	      }
	    }
	  }]);

	  return Images;
	}();

	/**
	 * This class can store groups and options specific for groups.
	 */

	var Groups =
	/*#__PURE__*/
	function () {
	  /**
	   * @ignore
	   */
	  function Groups() {
	    classCallCheck(this, Groups);

	    this.clear();
	    this.defaultIndex = 0;
	    this.groupsArray = [];
	    this.groupIndex = 0;
	    this.defaultGroups = [{
	      border: "#2B7CE9",
	      background: "#97C2FC",
	      highlight: {
	        border: "#2B7CE9",
	        background: "#D2E5FF"
	      },
	      hover: {
	        border: "#2B7CE9",
	        background: "#D2E5FF"
	      }
	    }, // 0: blue
	    {
	      border: "#FFA500",
	      background: "#FFFF00",
	      highlight: {
	        border: "#FFA500",
	        background: "#FFFFA3"
	      },
	      hover: {
	        border: "#FFA500",
	        background: "#FFFFA3"
	      }
	    }, // 1: yellow
	    {
	      border: "#FA0A10",
	      background: "#FB7E81",
	      highlight: {
	        border: "#FA0A10",
	        background: "#FFAFB1"
	      },
	      hover: {
	        border: "#FA0A10",
	        background: "#FFAFB1"
	      }
	    }, // 2: red
	    {
	      border: "#41A906",
	      background: "#7BE141",
	      highlight: {
	        border: "#41A906",
	        background: "#A1EC76"
	      },
	      hover: {
	        border: "#41A906",
	        background: "#A1EC76"
	      }
	    }, // 3: green
	    {
	      border: "#E129F0",
	      background: "#EB7DF4",
	      highlight: {
	        border: "#E129F0",
	        background: "#F0B3F5"
	      },
	      hover: {
	        border: "#E129F0",
	        background: "#F0B3F5"
	      }
	    }, // 4: magenta
	    {
	      border: "#7C29F0",
	      background: "#AD85E4",
	      highlight: {
	        border: "#7C29F0",
	        background: "#D3BDF0"
	      },
	      hover: {
	        border: "#7C29F0",
	        background: "#D3BDF0"
	      }
	    }, // 5: purple
	    {
	      border: "#C37F00",
	      background: "#FFA807",
	      highlight: {
	        border: "#C37F00",
	        background: "#FFCA66"
	      },
	      hover: {
	        border: "#C37F00",
	        background: "#FFCA66"
	      }
	    }, // 6: orange
	    {
	      border: "#4220FB",
	      background: "#6E6EFD",
	      highlight: {
	        border: "#4220FB",
	        background: "#9B9BFD"
	      },
	      hover: {
	        border: "#4220FB",
	        background: "#9B9BFD"
	      }
	    }, // 7: darkblue
	    {
	      border: "#FD5A77",
	      background: "#FFC0CB",
	      highlight: {
	        border: "#FD5A77",
	        background: "#FFD1D9"
	      },
	      hover: {
	        border: "#FD5A77",
	        background: "#FFD1D9"
	      }
	    }, // 8: pink
	    {
	      border: "#4AD63A",
	      background: "#C2FABC",
	      highlight: {
	        border: "#4AD63A",
	        background: "#E6FFE3"
	      },
	      hover: {
	        border: "#4AD63A",
	        background: "#E6FFE3"
	      }
	    }, // 9: mint
	    {
	      border: "#990000",
	      background: "#EE0000",
	      highlight: {
	        border: "#BB0000",
	        background: "#FF3333"
	      },
	      hover: {
	        border: "#BB0000",
	        background: "#FF3333"
	      }
	    }, // 10:bright red
	    {
	      border: "#FF6000",
	      background: "#FF6000",
	      highlight: {
	        border: "#FF6000",
	        background: "#FF6000"
	      },
	      hover: {
	        border: "#FF6000",
	        background: "#FF6000"
	      }
	    }, // 12: real orange
	    {
	      border: "#97C2FC",
	      background: "#2B7CE9",
	      highlight: {
	        border: "#D2E5FF",
	        background: "#2B7CE9"
	      },
	      hover: {
	        border: "#D2E5FF",
	        background: "#2B7CE9"
	      }
	    }, // 13: blue
	    {
	      border: "#399605",
	      background: "#255C03",
	      highlight: {
	        border: "#399605",
	        background: "#255C03"
	      },
	      hover: {
	        border: "#399605",
	        background: "#255C03"
	      }
	    }, // 14: green
	    {
	      border: "#B70054",
	      background: "#FF007E",
	      highlight: {
	        border: "#B70054",
	        background: "#FF007E"
	      },
	      hover: {
	        border: "#B70054",
	        background: "#FF007E"
	      }
	    }, // 15: magenta
	    {
	      border: "#AD85E4",
	      background: "#7C29F0",
	      highlight: {
	        border: "#D3BDF0",
	        background: "#7C29F0"
	      },
	      hover: {
	        border: "#D3BDF0",
	        background: "#7C29F0"
	      }
	    }, // 16: purple
	    {
	      border: "#4557FA",
	      background: "#000EA1",
	      highlight: {
	        border: "#6E6EFD",
	        background: "#000EA1"
	      },
	      hover: {
	        border: "#6E6EFD",
	        background: "#000EA1"
	      }
	    }, // 17: darkblue
	    {
	      border: "#FFC0CB",
	      background: "#FD5A77",
	      highlight: {
	        border: "#FFD1D9",
	        background: "#FD5A77"
	      },
	      hover: {
	        border: "#FFD1D9",
	        background: "#FD5A77"
	      }
	    }, // 18: pink
	    {
	      border: "#C2FABC",
	      background: "#74D66A",
	      highlight: {
	        border: "#E6FFE3",
	        background: "#74D66A"
	      },
	      hover: {
	        border: "#E6FFE3",
	        background: "#74D66A"
	      }
	    }, // 19: mint
	    {
	      border: "#EE0000",
	      background: "#990000",
	      highlight: {
	        border: "#FF3333",
	        background: "#BB0000"
	      },
	      hover: {
	        border: "#FF3333",
	        background: "#BB0000"
	      }
	    } // 20:bright red
	    ];
	    this.options = {};
	    this.defaultOptions = {
	      useDefaultGroups: true
	    };
	    extend(this.options, this.defaultOptions);
	  }
	  /**
	   *
	   * @param {Object} options
	   */


	  createClass(Groups, [{
	    key: "setOptions",
	    value: function setOptions(options) {
	      var optionFields = ['useDefaultGroups'];

	      if (options !== undefined) {
	        for (var groupName in options) {
	          if (options.hasOwnProperty(groupName)) {
	            if (indexOf$3(optionFields).call(optionFields, groupName) === -1) {
	              var group = options[groupName];
	              this.add(groupName, group);
	            }
	          }
	        }
	      }
	    }
	    /**
	     * Clear all groups
	     */

	  }, {
	    key: "clear",
	    value: function clear() {
	      this.groups = {};
	      this.groupsArray = [];
	    }
	    /**
	     * Get group options of a groupname.
	     * If groupname is not found, a new group may be created.
	     *
	     * @param {*}       groupname     Can be a number, string, Date, etc.
	     * @param {boolean} [shouldCreate=true] If true, create a new group
	     * @return {Object} The found or created group
	     */

	  }, {
	    key: "get",
	    value: function get(groupname) {
	      var shouldCreate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
	      var group = this.groups[groupname];

	      if (group === undefined && shouldCreate) {
	        if (this.options.useDefaultGroups === false && this.groupsArray.length > 0) {
	          // create new group
	          var index = this.groupIndex % this.groupsArray.length;
	          this.groupIndex++;
	          group = {};
	          group.color = this.groups[this.groupsArray[index]];
	          this.groups[groupname] = group;
	        } else {
	          // create new group
	          var _index = this.defaultIndex % this.defaultGroups.length;

	          this.defaultIndex++;
	          group = {};
	          group.color = this.defaultGroups[_index];
	          this.groups[groupname] = group;
	        }
	      }

	      return group;
	    }
	    /**
	     * Add a custom group style
	     * @param {string} groupName
	     * @param {Object} style       An object containing borderColor,
	     *                             backgroundColor, etc.
	     * @return {Object} group      The created group object
	     */

	  }, {
	    key: "add",
	    value: function add(groupName, style) {
	      this.groups[groupName] = style;
	      this.groupsArray.push(groupName);
	      return style;
	    }
	  }]);

	  return Groups;
	}();

	var getIterator$3 = function (it) {
	  var iteratorMethod = getIteratorMethod(it);
	  if (typeof iteratorMethod != 'function') {
	    throw TypeError(String(it) + ' is not iterable');
	  } return anObject(iteratorMethod.call(it));
	};

	var getIterator$4 = getIterator$3;

	var getIterator$5 = getIterator$4;

	var $some = arrayIteration.some;


	// `Array.prototype.some` method
	// https://tc39.github.io/ecma262/#sec-array.prototype.some
	_export({ target: 'Array', proto: true, forced: sloppyArrayMethod('some') }, {
	  some: function some(callbackfn /* , thisArg */) {
	    return $some(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
	  }
	});

	var some = entryVirtual('Array').some;

	var ArrayPrototype$e = Array.prototype;

	var some_1 = function (it) {
	  var own = it.some;
	  return it === ArrayPrototype$e || (it instanceof Array && own === ArrayPrototype$e.some) ? some : own;
	};

	var some$1 = some_1;

	var some$2 = some$1;

	var $stringify$2 = getBuiltIn('JSON', 'stringify');
	var re = /[\uD800-\uDFFF]/g;
	var low = /^[\uD800-\uDBFF]$/;
	var hi = /^[\uDC00-\uDFFF]$/;

	var fix = function (match, offset, string) {
	  var prev = string.charAt(offset - 1);
	  var next = string.charAt(offset + 1);
	  if ((low.test(match) && !hi.test(next)) || (hi.test(match) && !low.test(prev))) {
	    return '\\u' + match.charCodeAt(0).toString(16);
	  } return match;
	};

	var FORCED$5 = fails(function () {
	  return $stringify$2('\uDF06\uD834') !== '"\\udf06\\ud834"'
	    || $stringify$2('\uDEAD') !== '"\\udead"';
	});

	if ($stringify$2) {
	  // https://github.com/tc39/proposal-well-formed-stringify
	  _export({ target: 'JSON', stat: true, forced: FORCED$5 }, {
	    // eslint-disable-next-line no-unused-vars
	    stringify: function stringify(it, replacer, space) {
	      var result = $stringify$2.apply(null, arguments);
	      return typeof result == 'string' ? result.replace(re, fix) : result;
	    }
	  });
	}

	if (!path.JSON) path.JSON = { stringify: JSON.stringify };

	// eslint-disable-next-line no-unused-vars
	var stringify = function stringify(it, replacer, space) {
	  return path.JSON.stringify.apply(null, arguments);
	};

	var stringify$1 = stringify;

	var stringify$2 = stringify$1;

	// `Array.prototype.{ reduce, reduceRight }` methods implementation
	var createMethod$5 = function (IS_RIGHT) {
	  return function (that, callbackfn, argumentsLength, memo) {
	    aFunction(callbackfn);
	    var O = toObject(that);
	    var self = indexedObject(O);
	    var length = toLength(O.length);
	    var index = IS_RIGHT ? length - 1 : 0;
	    var i = IS_RIGHT ? -1 : 1;
	    if (argumentsLength < 2) while (true) {
	      if (index in self) {
	        memo = self[index];
	        index += i;
	        break;
	      }
	      index += i;
	      if (IS_RIGHT ? index < 0 : length <= index) {
	        throw TypeError('Reduce of empty array with no initial value');
	      }
	    }
	    for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
	      memo = callbackfn(memo, self[index], index, O);
	    }
	    return memo;
	  };
	};

	var arrayReduce = {
	  // `Array.prototype.reduce` method
	  // https://tc39.github.io/ecma262/#sec-array.prototype.reduce
	  left: createMethod$5(false),
	  // `Array.prototype.reduceRight` method
	  // https://tc39.github.io/ecma262/#sec-array.prototype.reduceright
	  right: createMethod$5(true)
	};

	var $reduce = arrayReduce.left;


	// `Array.prototype.reduce` method
	// https://tc39.github.io/ecma262/#sec-array.prototype.reduce
	_export({ target: 'Array', proto: true, forced: sloppyArrayMethod('reduce') }, {
	  reduce: function reduce(callbackfn /* , initialValue */) {
	    return $reduce(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined);
	  }
	});

	var reduce = entryVirtual('Array').reduce;

	var ArrayPrototype$f = Array.prototype;

	var reduce_1 = function (it) {
	  var own = it.reduce;
	  return it === ArrayPrototype$f || (it instanceof Array && own === ArrayPrototype$f.reduce) ? reduce : own;
	};

	var reduce$1 = reduce_1;

	var reduce$2 = reduce$1;

	// all object keys, includes non-enumerable and symbols
	var ownKeys$2 = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
	  var keys = objectGetOwnPropertyNames.f(anObject(it));
	  var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
	  return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
	};

	// `Object.getOwnPropertyDescriptors` method
	// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors
	_export({ target: 'Object', stat: true, sham: !descriptors }, {
	  getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) {
	    var O = toIndexedObject(object);
	    var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
	    var keys = ownKeys$2(O);
	    var result = {};
	    var index = 0;
	    var key, descriptor;
	    while (keys.length > index) {
	      descriptor = getOwnPropertyDescriptor(O, key = keys[index++]);
	      if (descriptor !== undefined) createProperty(result, key, descriptor);
	    }
	    return result;
	  }
	});

	var getOwnPropertyDescriptors$3 = path.Object.getOwnPropertyDescriptors;

	var getOwnPropertyDescriptors$4 = getOwnPropertyDescriptors$3;

	var getOwnPropertyDescriptors$5 = getOwnPropertyDescriptors$4;

	var iterate_1 = createCommonjsModule(function (module) {
	var Result = function (stopped, result) {
	  this.stopped = stopped;
	  this.result = result;
	};

	var iterate = module.exports = function (iterable, fn, that, AS_ENTRIES, IS_ITERATOR) {
	  var boundFunction = bindContext(fn, that, AS_ENTRIES ? 2 : 1);
	  var iterator, iterFn, index, length, result, next, step;

	  if (IS_ITERATOR) {
	    iterator = iterable;
	  } else {
	    iterFn = getIteratorMethod(iterable);
	    if (typeof iterFn != 'function') throw TypeError('Target is not iterable');
	    // optimisation for array iterators
	    if (isArrayIteratorMethod(iterFn)) {
	      for (index = 0, length = toLength(iterable.length); length > index; index++) {
	        result = AS_ENTRIES
	          ? boundFunction(anObject(step = iterable[index])[0], step[1])
	          : boundFunction(iterable[index]);
	        if (result && result instanceof Result) return result;
	      } return new Result(false);
	    }
	    iterator = iterFn.call(iterable);
	  }

	  next = iterator.next;
	  while (!(step = next.call(iterator)).done) {
	    result = callWithSafeIterationClosing(iterator, boundFunction, step.value, AS_ENTRIES);
	    if (typeof result == 'object' && result && result instanceof Result) return result;
	  } return new Result(false);
	};

	iterate.stop = function (result) {
	  return new Result(true, result);
	};
	});

	var anInstance = function (it, Constructor, name) {
	  if (!(it instanceof Constructor)) {
	    throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation');
	  } return it;
	};

	var defineProperty$9 = objectDefineProperty.f;
	var forEach$4 = arrayIteration.forEach;



	var setInternalState$4 = internalState.set;
	var internalStateGetterFor = internalState.getterFor;

	var collection = function (CONSTRUCTOR_NAME, wrapper, common, IS_MAP, IS_WEAK) {
	  var NativeConstructor = global_1[CONSTRUCTOR_NAME];
	  var NativePrototype = NativeConstructor && NativeConstructor.prototype;
	  var ADDER = IS_MAP ? 'set' : 'add';
	  var exported = {};
	  var Constructor;

	  if (!descriptors || typeof NativeConstructor != 'function'
	    || !(IS_WEAK || NativePrototype.forEach && !fails(function () { new NativeConstructor().entries().next(); }))
	  ) {
	    // create collection constructor
	    Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);
	    internalMetadata.REQUIRED = true;
	  } else {
	    Constructor = wrapper(function (target, iterable) {
	      setInternalState$4(anInstance(target, Constructor, CONSTRUCTOR_NAME), {
	        type: CONSTRUCTOR_NAME,
	        collection: new NativeConstructor()
	      });
	      if (iterable != undefined) iterate_1(iterable, target[ADDER], target, IS_MAP);
	    });

	    var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);

	    forEach$4(['add', 'clear', 'delete', 'forEach', 'get', 'has', 'set', 'keys', 'values', 'entries'], function (KEY) {
	      var IS_ADDER = KEY == 'add' || KEY == 'set';
	      if (KEY in NativePrototype && !(IS_WEAK && KEY == 'clear')) {
	        createNonEnumerableProperty(Constructor.prototype, KEY, function (a, b) {
	          var collection = getInternalState(this).collection;
	          if (!IS_ADDER && IS_WEAK && !isObject(a)) return KEY == 'get' ? undefined : false;
	          var result = collection[KEY](a === 0 ? 0 : a, b);
	          return IS_ADDER ? this : result;
	        });
	      }
	    });

	    IS_WEAK || defineProperty$9(Constructor.prototype, 'size', {
	      get: function () {
	        return getInternalState(this).collection.size;
	      }
	    });
	  }

	  setToStringTag(Constructor, CONSTRUCTOR_NAME, false, true);

	  exported[CONSTRUCTOR_NAME] = Constructor;
	  _export({ global: true, forced: true }, exported);

	  if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);

	  return Constructor;
	};

	var redefineAll = function (target, src, options) {
	  for (var key in src) {
	    if (options && options.unsafe && target[key]) target[key] = src[key];
	    else redefine(target, key, src[key], options);
	  } return target;
	};

	var SPECIES$4 = wellKnownSymbol('species');

	var setSpecies = function (CONSTRUCTOR_NAME) {
	  var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
	  var defineProperty = objectDefineProperty.f;

	  if (descriptors && Constructor && !Constructor[SPECIES$4]) {
	    defineProperty(Constructor, SPECIES$4, {
	      configurable: true,
	      get: function () { return this; }
	    });
	  }
	};

	var defineProperty$a = objectDefineProperty.f;








	var fastKey = internalMetadata.fastKey;


	var setInternalState$5 = internalState.set;
	var internalStateGetterFor$1 = internalState.getterFor;

	var collectionStrong = {
	  getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
	    var C = wrapper(function (that, iterable) {
	      anInstance(that, C, CONSTRUCTOR_NAME);
	      setInternalState$5(that, {
	        type: CONSTRUCTOR_NAME,
	        index: objectCreate(null),
	        first: undefined,
	        last: undefined,
	        size: 0
	      });
	      if (!descriptors) that.size = 0;
	      if (iterable != undefined) iterate_1(iterable, that[ADDER], that, IS_MAP);
	    });

	    var getInternalState = internalStateGetterFor$1(CONSTRUCTOR_NAME);

	    var define = function (that, key, value) {
	      var state = getInternalState(that);
	      var entry = getEntry(that, key);
	      var previous, index;
	      // change existing entry
	      if (entry) {
	        entry.value = value;
	      // create new entry
	      } else {
	        state.last = entry = {
	          index: index = fastKey(key, true),
	          key: key,
	          value: value,
	          previous: previous = state.last,
	          next: undefined,
	          removed: false
	        };
	        if (!state.first) state.first = entry;
	        if (previous) previous.next = entry;
	        if (descriptors) state.size++;
	        else that.size++;
	        // add to index
	        if (index !== 'F') state.index[index] = entry;
	      } return that;
	    };

	    var getEntry = function (that, key) {
	      var state = getInternalState(that);
	      // fast case
	      var index = fastKey(key);
	      var entry;
	      if (index !== 'F') return state.index[index];
	      // frozen object case
	      for (entry = state.first; entry; entry = entry.next) {
	        if (entry.key == key) return entry;
	      }
	    };

	    redefineAll(C.prototype, {
	      // 23.1.3.1 Map.prototype.clear()
	      // 23.2.3.2 Set.prototype.clear()
	      clear: function clear() {
	        var that = this;
	        var state = getInternalState(that);
	        var data = state.index;
	        var entry = state.first;
	        while (entry) {
	          entry.removed = true;
	          if (entry.previous) entry.previous = entry.previous.next = undefined;
	          delete data[entry.index];
	          entry = entry.next;
	        }
	        state.first = state.last = undefined;
	        if (descriptors) state.size = 0;
	        else that.size = 0;
	      },
	      // 23.1.3.3 Map.prototype.delete(key)
	      // 23.2.3.4 Set.prototype.delete(value)
	      'delete': function (key) {
	        var that = this;
	        var state = getInternalState(that);
	        var entry = getEntry(that, key);
	        if (entry) {
	          var next = entry.next;
	          var prev = entry.previous;
	          delete state.index[entry.index];
	          entry.removed = true;
	          if (prev) prev.next = next;
	          if (next) next.previous = prev;
	          if (state.first == entry) state.first = next;
	          if (state.last == entry) state.last = prev;
	          if (descriptors) state.size--;
	          else that.size--;
	        } return !!entry;
	      },
	      // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
	      // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
	      forEach: function forEach(callbackfn /* , that = undefined */) {
	        var state = getInternalState(this);
	        var boundFunction = bindContext(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3);
	        var entry;
	        while (entry = entry ? entry.next : state.first) {
	          boundFunction(entry.value, entry.key, this);
	          // revert to the last existing entry
	          while (entry && entry.removed) entry = entry.previous;
	        }
	      },
	      // 23.1.3.7 Map.prototype.has(key)
	      // 23.2.3.7 Set.prototype.has(value)
	      has: function has(key) {
	        return !!getEntry(this, key);
	      }
	    });

	    redefineAll(C.prototype, IS_MAP ? {
	      // 23.1.3.6 Map.prototype.get(key)
	      get: function get(key) {
	        var entry = getEntry(this, key);
	        return entry && entry.value;
	      },
	      // 23.1.3.9 Map.prototype.set(key, value)
	      set: function set(key, value) {
	        return define(this, key === 0 ? 0 : key, value);
	      }
	    } : {
	      // 23.2.3.1 Set.prototype.add(value)
	      add: function add(value) {
	        return define(this, value = value === 0 ? 0 : value, value);
	      }
	    });
	    if (descriptors) defineProperty$a(C.prototype, 'size', {
	      get: function () {
	        return getInternalState(this).size;
	      }
	    });
	    return C;
	  },
	  setStrong: function (C, CONSTRUCTOR_NAME, IS_MAP) {
	    var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator';
	    var getInternalCollectionState = internalStateGetterFor$1(CONSTRUCTOR_NAME);
	    var getInternalIteratorState = internalStateGetterFor$1(ITERATOR_NAME);
	    // add .keys, .values, .entries, [@@iterator]
	    // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11
	    defineIterator(C, CONSTRUCTOR_NAME, function (iterated, kind) {
	      setInternalState$5(this, {
	        type: ITERATOR_NAME,
	        target: iterated,
	        state: getInternalCollectionState(iterated),
	        kind: kind,
	        last: undefined
	      });
	    }, function () {
	      var state = getInternalIteratorState(this);
	      var kind = state.kind;
	      var entry = state.last;
	      // revert to the last existing entry
	      while (entry && entry.removed) entry = entry.previous;
	      // get next entry
	      if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) {
	        // or finish the iteration
	        state.target = undefined;
	        return { value: undefined, done: true };
	      }
	      // return step by kind
	      if (kind == 'keys') return { value: entry.key, done: false };
	      if (kind == 'values') return { value: entry.value, done: false };
	      return { value: [entry.key, entry.value], done: false };
	    }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);

	    // add [@@species], 23.1.2.2, 23.2.2.2
	    setSpecies(CONSTRUCTOR_NAME);
	  }
	};

	// `Set` constructor
	// https://tc39.github.io/ecma262/#sec-set-objects
	var es_set = collection('Set', function (get) {
	  return function Set() { return get(this, arguments.length ? arguments[0] : undefined); };
	}, collectionStrong);

	var set$2 = path.Set;

	var set$3 = set$2;

	var set$4 = set$3;

	// `Map` constructor
	// https://tc39.github.io/ecma262/#sec-map-objects
	var es_map = collection('Map', function (get) {
	  return function Map() { return get(this, arguments.length ? arguments[0] : undefined); };
	}, collectionStrong, true);

	var map$4 = path.Map;

	var map$5 = map$4;

	var map$6 = map$5;

	var nativeIsFrozen = Object.isFrozen;
	var FAILS_ON_PRIMITIVES$6 = fails(function () { nativeIsFrozen(1); });

	// `Object.isFrozen` method
	// https://tc39.github.io/ecma262/#sec-object.isfrozen
	_export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$6 }, {
	  isFrozen: function isFrozen(it) {
	    return isObject(it) ? nativeIsFrozen ? nativeIsFrozen(it) : false : true;
	  }
	});

	var isFrozen = path.Object.isFrozen;

	var isFrozen$1 = isFrozen;

	var isFrozen$2 = isFrozen$1;

	var trim$5 = stringTrim.trim;


	var nativeParseFloat = global_1.parseFloat;
	var FORCED$6 = 1 / nativeParseFloat(whitespaces + '-0') !== -Infinity;

	// `parseFloat` method
	// https://tc39.github.io/ecma262/#sec-parsefloat-string
	var _parseFloat = FORCED$6 ? function parseFloat(string) {
	  var trimmedString = trim$5(String(string));
	  var result = nativeParseFloat(trimmedString);
	  return result === 0 && trimmedString.charAt(0) == '-' ? -0 : result;
	} : nativeParseFloat;

	// `parseFloat` method
	// https://tc39.github.io/ecma262/#sec-parsefloat-string
	_export({ global: true, forced: parseFloat != _parseFloat }, {
	  parseFloat: _parseFloat
	});

	var _parseFloat$1 = path.parseFloat;

	var _parseFloat$2 = _parseFloat$1;

	var _parseFloat$3 = _parseFloat$2;

	var iterator$4 = iterator;

	var iterator$5 = iterator$4;

	var ITERATOR$6 = wellKnownSymbol('iterator');

	var isIterable$3 = function (it) {
	  var O = Object(it);
	  return O[ITERATOR$6] !== undefined
	    || '@@iterator' in O
	    // eslint-disable-next-line no-prototype-builtins
	    || iterators.hasOwnProperty(classof(O));
	};

	var isIterable$4 = isIterable$3;

	var isIterable$5 = isIterable$4;

	var nativeReverse = [].reverse;
	var test$3 = [1, 2];

	// `Array.prototype.reverse` method
	// https://tc39.github.io/ecma262/#sec-array.prototype.reverse
	// fix for Safari 12.0 bug
	// https://bugs.webkit.org/show_bug.cgi?id=188794
	_export({ target: 'Array', proto: true, forced: String(test$3) === String(test$3.reverse()) }, {
	  reverse: function reverse() {
	    // eslint-disable-next-line no-self-assign
	    if (isArray(this)) this.length = this.length;
	    return nativeReverse.call(this);
	  }
	});

	var reverse = entryVirtual('Array').reverse;

	var ArrayPrototype$g = Array.prototype;

	var reverse_1 = function (it) {
	  var own = it.reverse;
	  return it === ArrayPrototype$g || (it instanceof Array && own === ArrayPrototype$g.reverse) ? reverse : own;
	};

	var reverse$1 = reverse_1;

	var reverse$2 = reverse$1;

	var nativePromiseConstructor = global_1.Promise;

	var SPECIES$5 = wellKnownSymbol('species');

	// `SpeciesConstructor` abstract operation
	// https://tc39.github.io/ecma262/#sec-speciesconstructor
	var speciesConstructor = function (O, defaultConstructor) {
	  var C = anObject(O).constructor;
	  var S;
	  return C === undefined || (S = anObject(C)[SPECIES$5]) == undefined ? defaultConstructor : aFunction(S);
	};

	var isIos = /(iphone|ipod|ipad).*applewebkit/i.test(userAgent);

	var location = global_1.location;
	var set$5 = global_1.setImmediate;
	var clear = global_1.clearImmediate;
	var process$2 = global_1.process;
	var MessageChannel = global_1.MessageChannel;
	var Dispatch = global_1.Dispatch;
	var counter = 0;
	var queue = {};
	var ONREADYSTATECHANGE = 'onreadystatechange';
	var defer, channel, port;

	var run = function (id) {
	  // eslint-disable-next-line no-prototype-builtins
	  if (queue.hasOwnProperty(id)) {
	    var fn = queue[id];
	    delete queue[id];
	    fn();
	  }
	};

	var runner = function (id) {
	  return function () {
	    run(id);
	  };
	};

	var listener = function (event) {
	  run(event.data);
	};

	var post = function (id) {
	  // old engines have not location.origin
	  global_1.postMessage(id + '', location.protocol + '//' + location.host);
	};

	// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
	if (!set$5 || !clear) {
	  set$5 = function setImmediate(fn) {
	    var args = [];
	    var i = 1;
	    while (arguments.length > i) args.push(arguments[i++]);
	    queue[++counter] = function () {
	      // eslint-disable-next-line no-new-func
	      (typeof fn == 'function' ? fn : Function(fn)).apply(undefined, args);
	    };
	    defer(counter);
	    return counter;
	  };
	  clear = function clearImmediate(id) {
	    delete queue[id];
	  };
	  // Node.js 0.8-
	  if (classofRaw(process$2) == 'process') {
	    defer = function (id) {
	      process$2.nextTick(runner(id));
	    };
	  // Sphere (JS game engine) Dispatch API
	  } else if (Dispatch && Dispatch.now) {
	    defer = function (id) {
	      Dispatch.now(runner(id));
	    };
	  // Browsers with MessageChannel, includes WebWorkers
	  // except iOS - https://github.com/zloirock/core-js/issues/624
	  } else if (MessageChannel && !isIos) {
	    channel = new MessageChannel();
	    port = channel.port2;
	    channel.port1.onmessage = listener;
	    defer = bindContext(port.postMessage, port, 1);
	  // Browsers with postMessage, skip WebWorkers
	  // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
	  } else if (global_1.addEventListener && typeof postMessage == 'function' && !global_1.importScripts && !fails(post)) {
	    defer = post;
	    global_1.addEventListener('message', listener, false);
	  // IE8-
	  } else if (ONREADYSTATECHANGE in documentCreateElement('script')) {
	    defer = function (id) {
	      html.appendChild(documentCreateElement('script'))[ONREADYSTATECHANGE] = function () {
	        html.removeChild(this);
	        run(id);
	      };
	    };
	  // Rest old browsers
	  } else {
	    defer = function (id) {
	      setTimeout(runner(id), 0);
	    };
	  }
	}

	var task = {
	  set: set$5,
	  clear: clear
	};

	var getOwnPropertyDescriptor$5 = objectGetOwnPropertyDescriptor.f;

	var macrotask = task.set;


	var MutationObserver = global_1.MutationObserver || global_1.WebKitMutationObserver;
	var process$3 = global_1.process;
	var Promise = global_1.Promise;
	var IS_NODE = classofRaw(process$3) == 'process';
	// Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`
	var queueMicrotaskDescriptor = getOwnPropertyDescriptor$5(global_1, 'queueMicrotask');
	var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;

	var flush, head, last, notify, toggle, node, promise, then;

	// modern engines have queueMicrotask method
	if (!queueMicrotask) {
	  flush = function () {
	    var parent, fn;
	    if (IS_NODE && (parent = process$3.domain)) parent.exit();
	    while (head) {
	      fn = head.fn;
	      head = head.next;
	      try {
	        fn();
	      } catch (error) {
	        if (head) notify();
	        else last = undefined;
	        throw error;
	      }
	    } last = undefined;
	    if (parent) parent.enter();
	  };

	  // Node.js
	  if (IS_NODE) {
	    notify = function () {
	      process$3.nextTick(flush);
	    };
	  // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
	  } else if (MutationObserver && !isIos) {
	    toggle = true;
	    node = document.createTextNode('');
	    new MutationObserver(flush).observe(node, { characterData: true });
	    notify = function () {
	      node.data = toggle = !toggle;
	    };
	  // environments with maybe non-completely correct, but existent Promise
	  } else if (Promise && Promise.resolve) {
	    // Promise.resolve without an argument throws an error in LG WebOS 2
	    promise = Promise.resolve(undefined);
	    then = promise.then;
	    notify = function () {
	      then.call(promise, flush);
	    };
	  // for other environments - macrotask based on:
	  // - setImmediate
	  // - MessageChannel
	  // - window.postMessag
	  // - onreadystatechange
	  // - setTimeout
	  } else {
	    notify = function () {
	      // strange IE + webpack dev server bug - use .call(global)
	      macrotask.call(global_1, flush);
	    };
	  }
	}

	var microtask = queueMicrotask || function (fn) {
	  var task = { fn: fn, next: undefined };
	  if (last) last.next = task;
	  if (!head) {
	    head = task;
	    notify();
	  } last = task;
	};

	var PromiseCapability = function (C) {
	  var resolve, reject;
	  this.promise = new C(function ($$resolve, $$reject) {
	    if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
	    resolve = $$resolve;
	    reject = $$reject;
	  });
	  this.resolve = aFunction(resolve);
	  this.reject = aFunction(reject);
	};

	// 25.4.1.5 NewPromiseCapability(C)
	var f$8 = function (C) {
	  return new PromiseCapability(C);
	};

	var newPromiseCapability = {
		f: f$8
	};

	var promiseResolve = function (C, x) {
	  anObject(C);
	  if (isObject(x) && x.constructor === C) return x;
	  var promiseCapability = newPromiseCapability.f(C);
	  var resolve = promiseCapability.resolve;
	  resolve(x);
	  return promiseCapability.promise;
	};

	var hostReportErrors = function (a, b) {
	  var console = global_1.console;
	  if (console && console.error) {
	    arguments.length === 1 ? console.error(a) : console.error(a, b);
	  }
	};

	var perform = function (exec) {
	  try {
	    return { error: false, value: exec() };
	  } catch (error) {
	    return { error: true, value: error };
	  }
	};

	var task$1 = task.set;










	var SPECIES$6 = wellKnownSymbol('species');
	var PROMISE = 'Promise';
	var getInternalState$4 = internalState.get;
	var setInternalState$6 = internalState.set;
	var getInternalPromiseState = internalState.getterFor(PROMISE);
	var PromiseConstructor = nativePromiseConstructor;
	var TypeError$1 = global_1.TypeError;
	var document$2 = global_1.document;
	var process$4 = global_1.process;
	var inspectSource = shared('inspectSource');
	var $fetch = getBuiltIn('fetch');
	var newPromiseCapability$1 = newPromiseCapability.f;
	var newGenericPromiseCapability = newPromiseCapability$1;
	var IS_NODE$1 = classofRaw(process$4) == 'process';
	var DISPATCH_EVENT = !!(document$2 && document$2.createEvent && global_1.dispatchEvent);
	var UNHANDLED_REJECTION = 'unhandledrejection';
	var REJECTION_HANDLED = 'rejectionhandled';
	var PENDING = 0;
	var FULFILLED = 1;
	var REJECTED = 2;
	var HANDLED = 1;
	var UNHANDLED = 2;
	var Internal, OwnPromiseCapability, PromiseWrapper;

	var FORCED$7 = isForced_1(PROMISE, function () {
	  var GLOBAL_CORE_JS_PROMISE = inspectSource(PromiseConstructor) !== String(PromiseConstructor);
	  // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
	  // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
	  // We can't detect it synchronously, so just check versions
	  if (v8Version === 66) return true;
	  // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
	  if (!GLOBAL_CORE_JS_PROMISE && !IS_NODE$1 && typeof PromiseRejectionEvent != 'function') return true;
	  // We need Promise#finally in the pure version for preventing prototype pollution
	  if ( !PromiseConstructor.prototype['finally']) return true;
	  // We can't use @@species feature detection in V8 since it causes
	  // deoptimization and performance degradation
	  // https://github.com/zloirock/core-js/issues/679
	  if (v8Version >= 51 && /native code/.test(PromiseConstructor)) return false;
	  // Detect correctness of subclassing with @@species support
	  var promise = PromiseConstructor.resolve(1);
	  var FakePromise = function (exec) {
	    exec(function () { /* empty */ }, function () { /* empty */ });
	  };
	  var constructor = promise.constructor = {};
	  constructor[SPECIES$6] = FakePromise;
	  return !(promise.then(function () { /* empty */ }) instanceof FakePromise);
	});

	var INCORRECT_ITERATION$2 = FORCED$7 || !checkCorrectnessOfIteration(function (iterable) {
	  PromiseConstructor.all(iterable)['catch'](function () { /* empty */ });
	});

	// helpers
	var isThenable = function (it) {
	  var then;
	  return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
	};

	var notify$1 = function (promise, state, isReject) {
	  if (state.notified) return;
	  state.notified = true;
	  var chain = state.reactions;
	  microtask(function () {
	    var value = state.value;
	    var ok = state.state == FULFILLED;
	    var index = 0;
	    // variable length - can't use forEach
	    while (chain.length > index) {
	      var reaction = chain[index++];
	      var handler = ok ? reaction.ok : reaction.fail;
	      var resolve = reaction.resolve;
	      var reject = reaction.reject;
	      var domain = reaction.domain;
	      var result, then, exited;
	      try {
	        if (handler) {
	          if (!ok) {
	            if (state.rejection === UNHANDLED) onHandleUnhandled(promise, state);
	            state.rejection = HANDLED;
	          }
	          if (handler === true) result = value;
	          else {
	            if (domain) domain.enter();
	            result = handler(value); // can throw
	            if (domain) {
	              domain.exit();
	              exited = true;
	            }
	          }
	          if (result === reaction.promise) {
	            reject(TypeError$1('Promise-chain cycle'));
	          } else if (then = isThenable(result)) {
	            then.call(result, resolve, reject);
	          } else resolve(result);
	        } else reject(value);
	      } catch (error) {
	        if (domain && !exited) domain.exit();
	        reject(error);
	      }
	    }
	    state.reactions = [];
	    state.notified = false;
	    if (isReject && !state.rejection) onUnhandled(promise, state);
	  });
	};

	var dispatchEvent = function (name, promise, reason) {
	  var event, handler;
	  if (DISPATCH_EVENT) {
	    event = document$2.createEvent('Event');
	    event.promise = promise;
	    event.reason = reason;
	    event.initEvent(name, false, true);
	    global_1.dispatchEvent(event);
	  } else event = { promise: promise, reason: reason };
	  if (handler = global_1['on' + name]) handler(event);
	  else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
	};

	var onUnhandled = function (promise, state) {
	  task$1.call(global_1, function () {
	    var value = state.value;
	    var IS_UNHANDLED = isUnhandled(state);
	    var result;
	    if (IS_UNHANDLED) {
	      result = perform(function () {
	        if (IS_NODE$1) {
	          process$4.emit('unhandledRejection', value, promise);
	        } else dispatchEvent(UNHANDLED_REJECTION, promise, value);
	      });
	      // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
	      state.rejection = IS_NODE$1 || isUnhandled(state) ? UNHANDLED : HANDLED;
	      if (result.error) throw result.value;
	    }
	  });
	};

	var isUnhandled = function (state) {
	  return state.rejection !== HANDLED && !state.parent;
	};

	var onHandleUnhandled = function (promise, state) {
	  task$1.call(global_1, function () {
	    if (IS_NODE$1) {
	      process$4.emit('rejectionHandled', promise);
	    } else dispatchEvent(REJECTION_HANDLED, promise, state.value);
	  });
	};

	var bind$3 = function (fn, promise, state, unwrap) {
	  return function (value) {
	    fn(promise, state, value, unwrap);
	  };
	};

	var internalReject = function (promise, state, value, unwrap) {
	  if (state.done) return;
	  state.done = true;
	  if (unwrap) state = unwrap;
	  state.value = value;
	  state.state = REJECTED;
	  notify$1(promise, state, true);
	};

	var internalResolve = function (promise, state, value, unwrap) {
	  if (state.done) return;
	  state.done = true;
	  if (unwrap) state = unwrap;
	  try {
	    if (promise === value) throw TypeError$1("Promise can't be resolved itself");
	    var then = isThenable(value);
	    if (then) {
	      microtask(function () {
	        var wrapper = { done: false };
	        try {
	          then.call(value,
	            bind$3(internalResolve, promise, wrapper, state),
	            bind$3(internalReject, promise, wrapper, state)
	          );
	        } catch (error) {
	          internalReject(promise, wrapper, error, state);
	        }
	      });
	    } else {
	      state.value = value;
	      state.state = FULFILLED;
	      notify$1(promise, state, false);
	    }
	  } catch (error) {
	    internalReject(promise, { done: false }, error, state);
	  }
	};

	// constructor polyfill
	if (FORCED$7) {
	  // 25.4.3.1 Promise(executor)
	  PromiseConstructor = function Promise(executor) {
	    anInstance(this, PromiseConstructor, PROMISE);
	    aFunction(executor);
	    Internal.call(this);
	    var state = getInternalState$4(this);
	    try {
	      executor(bind$3(internalResolve, this, state), bind$3(internalReject, this, state));
	    } catch (error) {
	      internalReject(this, state, error);
	    }
	  };
	  // eslint-disable-next-line no-unused-vars
	  Internal = function Promise(executor) {
	    setInternalState$6(this, {
	      type: PROMISE,
	      done: false,
	      notified: false,
	      parent: false,
	      reactions: [],
	      rejection: false,
	      state: PENDING,
	      value: undefined
	    });
	  };
	  Internal.prototype = redefineAll(PromiseConstructor.prototype, {
	    // `Promise.prototype.then` method
	    // https://tc39.github.io/ecma262/#sec-promise.prototype.then
	    then: function then(onFulfilled, onRejected) {
	      var state = getInternalPromiseState(this);
	      var reaction = newPromiseCapability$1(speciesConstructor(this, PromiseConstructor));
	      reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
	      reaction.fail = typeof onRejected == 'function' && onRejected;
	      reaction.domain = IS_NODE$1 ? process$4.domain : undefined;
	      state.parent = true;
	      state.reactions.push(reaction);
	      if (state.state != PENDING) notify$1(this, state, false);
	      return reaction.promise;
	    },
	    // `Promise.prototype.catch` method
	    // https://tc39.github.io/ecma262/#sec-promise.prototype.catch
	    'catch': function (onRejected) {
	      return this.then(undefined, onRejected);
	    }
	  });
	  OwnPromiseCapability = function () {
	    var promise = new Internal();
	    var state = getInternalState$4(promise);
	    this.promise = promise;
	    this.resolve = bind$3(internalResolve, promise, state);
	    this.reject = bind$3(internalReject, promise, state);
	  };
	  newPromiseCapability.f = newPromiseCapability$1 = function (C) {
	    return C === PromiseConstructor || C === PromiseWrapper
	      ? new OwnPromiseCapability(C)
	      : newGenericPromiseCapability(C);
	  };
	}

	_export({ global: true, wrap: true, forced: FORCED$7 }, {
	  Promise: PromiseConstructor
	});

	setToStringTag(PromiseConstructor, PROMISE, false, true);
	setSpecies(PROMISE);

	PromiseWrapper = getBuiltIn(PROMISE);

	// statics
	_export({ target: PROMISE, stat: true, forced: FORCED$7 }, {
	  // `Promise.reject` method
	  // https://tc39.github.io/ecma262/#sec-promise.reject
	  reject: function reject(r) {
	    var capability = newPromiseCapability$1(this);
	    capability.reject.call(undefined, r);
	    return capability.promise;
	  }
	});

	_export({ target: PROMISE, stat: true, forced: isPure  }, {
	  // `Promise.resolve` method
	  // https://tc39.github.io/ecma262/#sec-promise.resolve
	  resolve: function resolve(x) {
	    return promiseResolve( this === PromiseWrapper ? PromiseConstructor : this, x);
	  }
	});

	_export({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION$2 }, {
	  // `Promise.all` method
	  // https://tc39.github.io/ecma262/#sec-promise.all
	  all: function all(iterable) {
	    var C = this;
	    var capability = newPromiseCapability$1(C);
	    var resolve = capability.resolve;
	    var reject = capability.reject;
	    var result = perform(function () {
	      var $promiseResolve = aFunction(C.resolve);
	      var values = [];
	      var counter = 0;
	      var remaining = 1;
	      iterate_1(iterable, function (promise) {
	        var index = counter++;
	        var alreadyCalled = false;
	        values.push(undefined);
	        remaining++;
	        $promiseResolve.call(C, promise).then(function (value) {
	          if (alreadyCalled) return;
	          alreadyCalled = true;
	          values[index] = value;
	          --remaining || resolve(values);
	        }, reject);
	      });
	      --remaining || resolve(values);
	    });
	    if (result.error) reject(result.value);
	    return capability.promise;
	  },
	  // `Promise.race` method
	  // https://tc39.github.io/ecma262/#sec-promise.race
	  race: function race(iterable) {
	    var C = this;
	    var capability = newPromiseCapability$1(C);
	    var reject = capability.reject;
	    var result = perform(function () {
	      var $promiseResolve = aFunction(C.resolve);
	      iterate_1(iterable, function (promise) {
	        $promiseResolve.call(C, promise).then(capability.resolve, reject);
	      });
	    });
	    if (result.error) reject(result.value);
	    return capability.promise;
	  }
	});

	// `Promise.allSettled` method
	// https://github.com/tc39/proposal-promise-allSettled
	_export({ target: 'Promise', stat: true }, {
	  allSettled: function allSettled(iterable) {
	    var C = this;
	    var capability = newPromiseCapability.f(C);
	    var resolve = capability.resolve;
	    var reject = capability.reject;
	    var result = perform(function () {
	      var promiseResolve = aFunction(C.resolve);
	      var values = [];
	      var counter = 0;
	      var remaining = 1;
	      iterate_1(iterable, function (promise) {
	        var index = counter++;
	        var alreadyCalled = false;
	        values.push(undefined);
	        remaining++;
	        promiseResolve.call(C, promise).then(function (value) {
	          if (alreadyCalled) return;
	          alreadyCalled = true;
	          values[index] = { status: 'fulfilled', value: value };
	          --remaining || resolve(values);
	        }, function (e) {
	          if (alreadyCalled) return;
	          alreadyCalled = true;
	          values[index] = { status: 'rejected', reason: e };
	          --remaining || resolve(values);
	        });
	      });
	      --remaining || resolve(values);
	    });
	    if (result.error) reject(result.value);
	    return capability.promise;
	  }
	});

	// `Promise.prototype.finally` method
	// https://tc39.github.io/ecma262/#sec-promise.prototype.finally
	_export({ target: 'Promise', proto: true, real: true }, {
	  'finally': function (onFinally) {
	    var C = speciesConstructor(this, getBuiltIn('Promise'));
	    var isFunction = typeof onFinally == 'function';
	    return this.then(
	      isFunction ? function (x) {
	        return promiseResolve(C, onFinally()).then(function () { return x; });
	      } : onFinally,
	      isFunction ? function (e) {
	        return promiseResolve(C, onFinally()).then(function () { throw e; });
	      } : onFinally
	    );
	  }
	});

	var promise$1 = path.Promise;

	var promise$2 = promise$1;

	var promise$3 = promise$2;

	var _context12;

	/** 
	 * vis-data - data
	 * http://visjs.org/
	 * 
	 * Manage unstructured data using DataSet. Add, update, and remove data, and listen for changes in the data.
	 * 
	 * @version 6.2.2
	 * @date    2019-11-08T16:20:01Z
	 * 
	 * @copyright (c) 2011-2017 Almende B.V, http://almende.com
	 * @copyright (c) 2018-2019 visjs contributors, https://github.com/visjs
	 * 
	 * @license 
	 * vis.js is dual licensed under both
	 * 
	 *   1. The Apache 2.0 License
	 *      http://www.apache.org/licenses/LICENSE-2.0
	 * 
	 *   and
	 * 
	 *   2. The MIT License
	 *      http://opensource.org/licenses/MIT
	 * 
	 * vis.js may be distributed under either license.
	 */
	function createCommonjsModule$2(fn, module) {
	  return module = {
	    exports: {}
	  }, fn(module, module.exports), module.exports;
	}

	var runtime_1 = createCommonjsModule$2(function (module) {
	  /**
	   * Copyright (c) 2014-present, Facebook, Inc.
	   *
	   * This source code is licensed under the MIT license found in the
	   * LICENSE file in the root directory of this source tree.
	   */
	  var runtime = function (exports) {
	    var Op = Object.prototype;
	    var hasOwn = Op.hasOwnProperty;
	    var undefined$1; // More compressible than void 0.

	    var $Symbol = typeof symbol$2 === "function" ? symbol$2 : {};
	    var iteratorSymbol = $Symbol.iterator || "@@iterator";
	    var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
	    var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";

	    function wrap(innerFn, outerFn, self, tryLocsList) {
	      // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
	      var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;

	      var generator = create$2(protoGenerator.prototype);

	      var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next,
	      // .throw, and .return methods.

	      generator._invoke = makeInvokeMethod(innerFn, self, context);
	      return generator;
	    }

	    exports.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion
	    // record like context.tryEntries[i].completion. This interface could
	    // have been (and was previously) designed to take a closure to be
	    // invoked without arguments, but in all the cases we care about we
	    // already have an existing method we want to call, so there's no need
	    // to create a new function object. We can even get away with assuming
	    // the method takes exactly one argument, since that happens to be true
	    // in every case, so we don't have to touch the arguments object. The
	    // only additional allocation required is the completion record, which
	    // has a stable shape and so hopefully should be cheap to allocate.

	    function tryCatch(fn, obj, arg) {
	      try {
	        return {
	          type: "normal",
	          arg: fn.call(obj, arg)
	        };
	      } catch (err) {
	        return {
	          type: "throw",
	          arg: err
	        };
	      }
	    }

	    var GenStateSuspendedStart = "suspendedStart";
	    var GenStateSuspendedYield = "suspendedYield";
	    var GenStateExecuting = "executing";
	    var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as
	    // breaking out of the dispatch switch statement.

	    var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and
	    // .constructor.prototype properties for functions that return Generator
	    // objects. For full spec compliance, you may wish to configure your
	    // minifier not to mangle the names of these two functions.

	    function Generator() {}

	    function GeneratorFunction() {}

	    function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that
	    // don't natively support it.


	    var IteratorPrototype = {};

	    IteratorPrototype[iteratorSymbol] = function () {
	      return this;
	    };

	    var getProto = getPrototypeOf$2;
	    var NativeIteratorPrototype = getProto && getProto(getProto(values([])));

	    if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
	      // This environment has a native %IteratorPrototype%; use it instead
	      // of the polyfill.
	      IteratorPrototype = NativeIteratorPrototype;
	    }

	    var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = create$2(IteratorPrototype);

	    GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
	    GeneratorFunctionPrototype.constructor = GeneratorFunction;
	    GeneratorFunctionPrototype[toStringTagSymbol] = GeneratorFunction.displayName = "GeneratorFunction"; // Helper for defining the .next, .throw, and .return methods of the
	    // Iterator interface in terms of a single ._invoke method.

	    function defineIteratorMethods(prototype) {
	      var _context7;

	      forEach$2(_context7 = ["next", "throw", "return"]).call(_context7, function (method) {
	        prototype[method] = function (arg) {
	          return this._invoke(method, arg);
	        };
	      });
	    }

	    exports.isGeneratorFunction = function (genFun) {
	      var ctor = typeof genFun === "function" && genFun.constructor;
	      return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can
	      // do is to check its .name property.
	      (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
	    };

	    exports.mark = function (genFun) {
	      if (setPrototypeOf$2) {
	        setPrototypeOf$2(genFun, GeneratorFunctionPrototype);
	      } else {
	        genFun.__proto__ = GeneratorFunctionPrototype;

	        if (!(toStringTagSymbol in genFun)) {
	          genFun[toStringTagSymbol] = "GeneratorFunction";
	        }
	      }

	      genFun.prototype = create$2(Gp);
	      return genFun;
	    }; // Within the body of any async function, `await x` is transformed to
	    // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
	    // `hasOwn.call(value, "__await")` to determine if the yielded value is
	    // meant to be awaited.


	    exports.awrap = function (arg) {
	      return {
	        __await: arg
	      };
	    };

	    function AsyncIterator(generator) {
	      function invoke(method, arg, resolve, reject) {
	        var record = tryCatch(generator[method], generator, arg);

	        if (record.type === "throw") {
	          reject(record.arg);
	        } else {
	          var result = record.arg;
	          var value = result.value;

	          if (value && _typeof_1(value) === "object" && hasOwn.call(value, "__await")) {
	            return promise$3.resolve(value.__await).then(function (value) {
	              invoke("next", value, resolve, reject);
	            }, function (err) {
	              invoke("throw", err, resolve, reject);
	            });
	          }

	          return promise$3.resolve(value).then(function (unwrapped) {
	            // When a yielded Promise is resolved, its final value becomes
	            // the .value of the Promise<{value,done}> result for the
	            // current iteration.
	            result.value = unwrapped;
	            resolve(result);
	          }, function (error) {
	            // If a rejected Promise was yielded, throw the rejection back
	            // into the async generator function so it can be handled there.
	            return invoke("throw", error, resolve, reject);
	          });
	        }
	      }

	      var previousPromise;

	      function enqueue(method, arg) {
	        function callInvokeWithMethodAndArg() {
	          return new promise$3(function (resolve, reject) {
	            invoke(method, arg, resolve, reject);
	          });
	        }

	        return previousPromise = // If enqueue has been called before, then we want to wait until
	        // all previous Promises have been resolved before calling invoke,
	        // so that results are always delivered in the correct order. If
	        // enqueue has not been called before, then it is important to
	        // call invoke immediately, without waiting on a callback to fire,
	        // so that the async generator function has the opportunity to do
	        // any necessary setup in a predictable way. This predictability
	        // is why the Promise constructor synchronously invokes its
	        // executor callback, and why async functions synchronously
	        // execute code before the first await. Since we implement simple
	        // async functions in terms of async generators, it is especially
	        // important to get this right, even though it requires care.
	        previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later
	        // invocations of the iterator.
	        callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
	      } // Define the unified helper method that is used to implement .next,
	      // .throw, and .return (see defineIteratorMethods).


	      this._invoke = enqueue;
	    }

	    defineIteratorMethods(AsyncIterator.prototype);

	    AsyncIterator.prototype[asyncIteratorSymbol] = function () {
	      return this;
	    };

	    exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of
	    // AsyncIterator objects; they just return a Promise for the value of
	    // the final result produced by the iterator.

	    exports.async = function (innerFn, outerFn, self, tryLocsList) {
	      var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList));
	      return exports.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator.
	      : iter.next().then(function (result) {
	        return result.done ? result.value : iter.next();
	      });
	    };

	    function makeInvokeMethod(innerFn, self, context) {
	      var state = GenStateSuspendedStart;
	      return function invoke(method, arg) {
	        if (state === GenStateExecuting) {
	          throw new Error("Generator is already running");
	        }

	        if (state === GenStateCompleted) {
	          if (method === "throw") {
	            throw arg;
	          } // Be forgiving, per 25.3.3.3.3 of the spec:
	          // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume


	          return doneResult();
	        }

	        context.method = method;
	        context.arg = arg;

	        while (true) {
	          var delegate = context.delegate;

	          if (delegate) {
	            var delegateResult = maybeInvokeDelegate(delegate, context);

	            if (delegateResult) {
	              if (delegateResult === ContinueSentinel) continue;
	              return delegateResult;
	            }
	          }

	          if (context.method === "next") {
	            // Setting context._sent for legacy support of Babel's
	            // function.sent implementation.
	            context.sent = context._sent = context.arg;
	          } else if (context.method === "throw") {
	            if (state === GenStateSuspendedStart) {
	              state = GenStateCompleted;
	              throw context.arg;
	            }

	            context.dispatchException(context.arg);
	          } else if (context.method === "return") {
	            context.abrupt("return", context.arg);
	          }

	          state = GenStateExecuting;
	          var record = tryCatch(innerFn, self, context);

	          if (record.type === "normal") {
	            // If an exception is thrown from innerFn, we leave state ===
	            // GenStateExecuting and loop back for another invocation.
	            state = context.done ? GenStateCompleted : GenStateSuspendedYield;

	            if (record.arg === ContinueSentinel) {
	              continue;
	            }

	            return {
	              value: record.arg,
	              done: context.done
	            };
	          } else if (record.type === "throw") {
	            state = GenStateCompleted; // Dispatch the exception by looping back around to the
	            // context.dispatchException(context.arg) call above.

	            context.method = "throw";
	            context.arg = record.arg;
	          }
	        }
	      };
	    } // Call delegate.iterator[context.method](context.arg) and handle the
	    // result, either by returning a { value, done } result from the
	    // delegate iterator, or by modifying context.method and context.arg,
	    // setting context.delegate to null, and returning the ContinueSentinel.


	    function maybeInvokeDelegate(delegate, context) {
	      var method = delegate.iterator[context.method];

	      if (method === undefined$1) {
	        // A .throw or .return when the delegate iterator has no .throw
	        // method always terminates the yield* loop.
	        context.delegate = null;

	        if (context.method === "throw") {
	          // Note: ["return"] must be used for ES3 parsing compatibility.
	          if (delegate.iterator["return"]) {
	            // If the delegate iterator has a return method, give it a
	            // chance to clean up.
	            context.method = "return";
	            context.arg = undefined$1;
	            maybeInvokeDelegate(delegate, context);

	            if (context.method === "throw") {
	              // If maybeInvokeDelegate(context) changed context.method from
	              // "return" to "throw", let that override the TypeError below.
	              return ContinueSentinel;
	            }
	          }

	          context.method = "throw";
	          context.arg = new TypeError("The iterator does not provide a 'throw' method");
	        }

	        return ContinueSentinel;
	      }

	      var record = tryCatch(method, delegate.iterator, context.arg);

	      if (record.type === "throw") {
	        context.method = "throw";
	        context.arg = record.arg;
	        context.delegate = null;
	        return ContinueSentinel;
	      }

	      var info = record.arg;

	      if (!info) {
	        context.method = "throw";
	        context.arg = new TypeError("iterator result is not an object");
	        context.delegate = null;
	        return ContinueSentinel;
	      }

	      if (info.done) {
	        // Assign the result of the finished delegate to the temporary
	        // variable specified by delegate.resultName (see delegateYield).
	        context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield).

	        context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the
	        // exception, let the outer generator proceed normally. If
	        // context.method was "next", forget context.arg since it has been
	        // "consumed" by the delegate iterator. If context.method was
	        // "return", allow the original .return call to continue in the
	        // outer generator.

	        if (context.method !== "return") {
	          context.method = "next";
	          context.arg = undefined$1;
	        }
	      } else {
	        // Re-yield the result returned by the delegate method.
	        return info;
	      } // The delegate iterator is finished, so forget it and continue with
	      // the outer generator.


	      context.delegate = null;
	      return ContinueSentinel;
	    } // Define Generator.prototype.{next,throw,return} in terms of the
	    // unified ._invoke helper method.


	    defineIteratorMethods(Gp);
	    Gp[toStringTagSymbol] = "Generator"; // A Generator should always return itself as the iterator object when the
	    // @@iterator function is called on it. Some browsers' implementations of the
	    // iterator prototype chain incorrectly implement this, causing the Generator
	    // object to not be returned from this call. This ensures that doesn't happen.
	    // See https://github.com/facebook/regenerator/issues/274 for more details.

	    Gp[iteratorSymbol] = function () {
	      return this;
	    };

	    Gp.toString = function () {
	      return "[object Generator]";
	    };

	    function pushTryEntry(locs) {
	      var entry = {
	        tryLoc: locs[0]
	      };

	      if (1 in locs) {
	        entry.catchLoc = locs[1];
	      }

	      if (2 in locs) {
	        entry.finallyLoc = locs[2];
	        entry.afterLoc = locs[3];
	      }

	      this.tryEntries.push(entry);
	    }

	    function resetTryEntry(entry) {
	      var record = entry.completion || {};
	      record.type = "normal";
	      delete record.arg;
	      entry.completion = record;
	    }

	    function Context(tryLocsList) {
	      // The root entry object (effectively a try statement without a catch
	      // or a finally block) gives us a place to store values thrown from
	      // locations where there is no enclosing try statement.
	      this.tryEntries = [{
	        tryLoc: "root"
	      }];

	      forEach$2(tryLocsList).call(tryLocsList, pushTryEntry, this);

	      this.reset(true);
	    }

	    exports.keys = function (object) {
	      var keys = [];

	      for (var key in object) {
	        keys.push(key);
	      }

	      reverse$2(keys).call(keys); // Rather than returning an object with a next method, we keep
	      // things simple and return the next function itself.


	      return function next() {
	        while (keys.length) {
	          var key = keys.pop();

	          if (key in object) {
	            next.value = key;
	            next.done = false;
	            return next;
	          }
	        } // To avoid creating an additional object, we just hang the .value
	        // and .done properties off the next function object itself. This
	        // also ensures that the minifier will not anonymize the function.


	        next.done = true;
	        return next;
	      };
	    };

	    function values(iterable) {
	      if (iterable) {
	        var iteratorMethod = iterable[iteratorSymbol];

	        if (iteratorMethod) {
	          return iteratorMethod.call(iterable);
	        }

	        if (typeof iterable.next === "function") {
	          return iterable;
	        }

	        if (!isNaN(iterable.length)) {
	          var i = -1,
	              next = function next() {
	            while (++i < iterable.length) {
	              if (hasOwn.call(iterable, i)) {
	                next.value = iterable[i];
	                next.done = false;
	                return next;
	              }
	            }

	            next.value = undefined$1;
	            next.done = true;
	            return next;
	          };

	          return next.next = next;
	        }
	      } // Return an iterator with no values.


	      return {
	        next: doneResult
	      };
	    }

	    exports.values = values;

	    function doneResult() {
	      return {
	        value: undefined$1,
	        done: true
	      };
	    }

	    Context.prototype = {
	      constructor: Context,
	      reset: function reset(skipTempReset) {
	        var _context8;

	        this.prev = 0;
	        this.next = 0; // Resetting context._sent for legacy support of Babel's
	        // function.sent implementation.

	        this.sent = this._sent = undefined$1;
	        this.done = false;
	        this.delegate = null;
	        this.method = "next";
	        this.arg = undefined$1;

	        forEach$2(_context8 = this.tryEntries).call(_context8, resetTryEntry);

	        if (!skipTempReset) {
	          for (var name in this) {
	            // Not sure about the optimal order of these conditions:
	            if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+slice$3(name).call(name, 1))) {
	              this[name] = undefined$1;
	            }
	          }
	        }
	      },
	      stop: function stop() {
	        this.done = true;
	        var rootEntry = this.tryEntries[0];
	        var rootRecord = rootEntry.completion;

	        if (rootRecord.type === "throw") {
	          throw rootRecord.arg;
	        }

	        return this.rval;
	      },
	      dispatchException: function dispatchException(exception) {
	        if (this.done) {
	          throw exception;
	        }

	        var context = this;

	        function handle(loc, caught) {
	          record.type = "throw";
	          record.arg = exception;
	          context.next = loc;

	          if (caught) {
	            // If the dispatched exception was caught by a catch block,
	            // then let that catch block handle the exception normally.
	            context.method = "next";
	            context.arg = undefined$1;
	          }

	          return !!caught;
	        }

	        for (var i = this.tryEntries.length - 1; i >= 0; --i) {
	          var entry = this.tryEntries[i];
	          var record = entry.completion;

	          if (entry.tryLoc === "root") {
	            // Exception thrown outside of any try block that could handle
	            // it, so set the completion value of the entire function to
	            // throw the exception.
	            return handle("end");
	          }

	          if (entry.tryLoc <= this.prev) {
	            var hasCatch = hasOwn.call(entry, "catchLoc");
	            var hasFinally = hasOwn.call(entry, "finallyLoc");

	            if (hasCatch && hasFinally) {
	              if (this.prev < entry.catchLoc) {
	                return handle(entry.catchLoc, true);
	              } else if (this.prev < entry.finallyLoc) {
	                return handle(entry.finallyLoc);
	              }
	            } else if (hasCatch) {
	              if (this.prev < entry.catchLoc) {
	                return handle(entry.catchLoc, true);
	              }
	            } else if (hasFinally) {
	              if (this.prev < entry.finallyLoc) {
	                return handle(entry.finallyLoc);
	              }
	            } else {
	              throw new Error("try statement without catch or finally");
	            }
	          }
	        }
	      },
	      abrupt: function abrupt(type, arg) {
	        for (var i = this.tryEntries.length - 1; i >= 0; --i) {
	          var entry = this.tryEntries[i];

	          if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
	            var finallyEntry = entry;
	            break;
	          }
	        }

	        if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
	          // Ignore the finally entry if control is not jumping to a
	          // location outside the try/catch block.
	          finallyEntry = null;
	        }

	        var record = finallyEntry ? finallyEntry.completion : {};
	        record.type = type;
	        record.arg = arg;

	        if (finallyEntry) {
	          this.method = "next";
	          this.next = finallyEntry.finallyLoc;
	          return ContinueSentinel;
	        }

	        return this.complete(record);
	      },
	      complete: function complete(record, afterLoc) {
	        if (record.type === "throw") {
	          throw record.arg;
	        }

	        if (record.type === "break" || record.type === "continue") {
	          this.next = record.arg;
	        } else if (record.type === "return") {
	          this.rval = this.arg = record.arg;
	          this.method = "return";
	          this.next = "end";
	        } else if (record.type === "normal" && afterLoc) {
	          this.next = afterLoc;
	        }

	        return ContinueSentinel;
	      },
	      finish: function finish(finallyLoc) {
	        for (var i = this.tryEntries.length - 1; i >= 0; --i) {
	          var entry = this.tryEntries[i];

	          if (entry.finallyLoc === finallyLoc) {
	            this.complete(entry.completion, entry.afterLoc);
	            resetTryEntry(entry);
	            return ContinueSentinel;
	          }
	        }
	      },
	      "catch": function _catch(tryLoc) {
	        for (var i = this.tryEntries.length - 1; i >= 0; --i) {
	          var entry = this.tryEntries[i];

	          if (entry.tryLoc === tryLoc) {
	            var record = entry.completion;

	            if (record.type === "throw") {
	              var thrown = record.arg;
	              resetTryEntry(entry);
	            }

	            return thrown;
	          }
	        } // The context.catch method must only be called with a location
	        // argument that corresponds to a known catch block.


	        throw new Error("illegal catch attempt");
	      },
	      delegateYield: function delegateYield(iterable, resultName, nextLoc) {
	        this.delegate = {
	          iterator: values(iterable),
	          resultName: resultName,
	          nextLoc: nextLoc
	        };

	        if (this.method === "next") {
	          // Deliberately forget the last sent value so that we don't
	          // accidentally pass it on to the delegate.
	          this.arg = undefined$1;
	        }

	        return ContinueSentinel;
	      }
	    }; // Regardless of whether this script is executing as a CommonJS module
	    // or not, return the runtime object so that we can declare the variable
	    // regeneratorRuntime in the outer scope, which allows this module to be
	    // injected easily by `bin/regenerator --include-runtime script.js`.

	    return exports;
	  }( // If this script is executing as a CommonJS module, use module.exports
	  // as the regeneratorRuntime namespace. Otherwise create a new empty
	  // object. Either way, the resulting object will be used to initialize
	  // the regeneratorRuntime variable at the top of this file.
	  module.exports);

	  try {
	    regeneratorRuntime = runtime;
	  } catch (accidentalStrictMode) {
	    // This module should not be running in strict mode, so the above
	    // assignment should always work unless something is misconfigured. Just
	    // in case runtime.js accidentally runs in strict mode, we can escape
	    // strict mode using a global Function call. This could conceivably fail
	    // if a Content Security Policy forbids using Function, but in that case
	    // the proper solution is to fix the accidental strict mode problem. If
	    // you've misconfigured your bundler to force strict mode and applied a
	    // CSP to forbid Function, and you're not willing to fix either of those
	    // problems, please detail your unique predicament in a GitHub issue.
	    Function("r", "regeneratorRuntime = r")(runtime);
	  }
	});
	var regenerator = runtime_1;

	function _defineProperty$1(obj, key, value) {
	  if (key in obj) {
	    defineProperty$3(obj, key, {
	      value: value,
	      enumerable: true,
	      configurable: true,
	      writable: true
	    });
	  } else {
	    obj[key] = value;
	  }

	  return obj;
	}

	var defineProperty$b = _defineProperty$1;

	function _arrayWithoutHoles$1(arr) {
	  if (isArray$3(arr)) {
	    for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
	      arr2[i] = arr[i];
	    }

	    return arr2;
	  }
	}

	var arrayWithoutHoles$1 = _arrayWithoutHoles$1;

	function _iterableToArray$1(iter) {
	  if (isIterable$5(Object(iter)) || Object.prototype.toString.call(iter) === "[object Arguments]") return from_1$2(iter);
	}

	var iterableToArray$1 = _iterableToArray$1;

	function _nonIterableSpread$1() {
	  throw new TypeError("Invalid attempt to spread non-iterable instance");
	}

	var nonIterableSpread$1 = _nonIterableSpread$1;

	function _toConsumableArray$1(arr) {
	  return arrayWithoutHoles$1(arr) || iterableToArray$1(arr) || nonIterableSpread$1();
	}

	var toConsumableArray$1 = _toConsumableArray$1;

	var _typeof_1$2 = createCommonjsModule$2(function (module) {
	  function _typeof2(obj) {
	    if (typeof symbol$2 === "function" && _typeof_1(iterator$5) === "symbol") {
	      _typeof2 = function _typeof2(obj) {
	        return _typeof_1(obj);
	      };
	    } else {
	      _typeof2 = function _typeof2(obj) {
	        return obj && typeof symbol$2 === "function" && obj.constructor === symbol$2 && obj !== symbol$2.prototype ? "symbol" : _typeof_1(obj);
	      };
	    }

	    return _typeof2(obj);
	  }

	  function _typeof(obj) {
	    if (typeof symbol$2 === "function" && _typeof2(iterator$5) === "symbol") {
	      module.exports = _typeof = function _typeof(obj) {
	        return _typeof2(obj);
	      };
	    } else {
	      module.exports = _typeof = function _typeof(obj) {
	        return obj && typeof symbol$2 === "function" && obj.constructor === symbol$2 && obj !== symbol$2.prototype ? "symbol" : _typeof2(obj);
	      };
	    }

	    return _typeof(obj);
	  }

	  module.exports = _typeof;
	});

	function _classCallCheck$1(instance, Constructor) {
	  if (!(instance instanceof Constructor)) {
	    throw new TypeError("Cannot call a class as a function");
	  }
	}

	var classCallCheck$1 = _classCallCheck$1;

	function _defineProperties$1(target, props) {
	  for (var i = 0; i < props.length; i++) {
	    var descriptor = props[i];
	    descriptor.enumerable = descriptor.enumerable || false;
	    descriptor.configurable = true;
	    if ("value" in descriptor) descriptor.writable = true;

	    defineProperty$3(target, descriptor.key, descriptor);
	  }
	}

	function _createClass$1(Constructor, protoProps, staticProps) {
	  if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
	  if (staticProps) _defineProperties$1(Constructor, staticProps);
	  return Constructor;
	}

	var createClass$1 = _createClass$1;

	function _assertThisInitialized$1(self) {
	  if (self === void 0) {
	    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
	  }

	  return self;
	}

	var assertThisInitialized = _assertThisInitialized$1;

	function _possibleConstructorReturn(self, call) {
	  if (call && (_typeof_1$2(call) === "object" || typeof call === "function")) {
	    return call;
	  }

	  return assertThisInitialized(self);
	}

	var possibleConstructorReturn = _possibleConstructorReturn;
	var getPrototypeOf$4 = createCommonjsModule$2(function (module) {
	  function _getPrototypeOf(o) {
	    module.exports = _getPrototypeOf = setPrototypeOf$2 ? getPrototypeOf$2 : function _getPrototypeOf(o) {
	      return o.__proto__ || getPrototypeOf$2(o);
	    };
	    return _getPrototypeOf(o);
	  }

	  module.exports = _getPrototypeOf;
	});
	var setPrototypeOf$3 = createCommonjsModule$2(function (module) {
	  function _setPrototypeOf(o, p) {
	    module.exports = _setPrototypeOf = setPrototypeOf$2 || function _setPrototypeOf(o, p) {
	      o.__proto__ = p;
	      return o;
	    };

	    return _setPrototypeOf(o, p);
	  }

	  module.exports = _setPrototypeOf;
	});

	function _inherits(subClass, superClass) {
	  if (typeof superClass !== "function" && superClass !== null) {
	    throw new TypeError("Super expression must either be null or a function");
	  }

	  subClass.prototype = create$2(superClass && superClass.prototype, {
	    constructor: {
	      value: subClass,
	      writable: true,
	      configurable: true
	    }
	  });
	  if (superClass) setPrototypeOf$3(subClass, superClass);
	}

	var inherits = _inherits; // Maps for number <-> hex string conversion

	var byteToHex$2 = [];

	for (var i$2 = 0; i$2 < 256; i$2++) {
	  byteToHex$2[i$2] = (i$2 + 0x100).toString(16).substr(1);
	}
	/**
	 * Represent binary UUID into it's string representation.
	 *
	 * @param buf - Buffer containing UUID bytes.
	 * @param offset - Offset from the start of the buffer where the UUID is saved (not needed if the buffer starts with the UUID).
	 *
	 * @returns String representation of the UUID.
	 */


	function stringifyUUID$1(buf, offset) {
	  var i = offset || 0;
	  var bth = byteToHex$2;
	  return bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]];
	}
	/**
	 * Generate 16 random bytes to be used as a base for UUID.
	 *
	 * @ignore
	 */


	var random$1 = function () {
	  if (typeof crypto !== 'undefined' && crypto.getRandomValues) {
	    // WHATWG crypto-based RNG - http://wiki.whatwg.org/wiki/Crypto
	    // Moderately fast, high quality
	    var _rnds8 = new Uint8Array(16);

	    return function whatwgRNG() {
	      crypto.getRandomValues(_rnds8);
	      return _rnds8;
	    };
	  } // Math.random()-based (RNG)
	  //
	  // If all else fails, use Math.random().
	  // It's fast, but is of unspecified quality.


	  var _rnds = new Array(16);

	  return function () {
	    for (var i = 0, r; i < 16; i++) {
	      if ((i & 0x03) === 0) {
	        r = Math.random() * 0x100000000;
	      }

	      _rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
	    }

	    return _rnds;
	  }; //     uuid.js
	  //
	  //     Copyright (c) 2010-2012 Robert Kieffer
	  //     MIT License - http://opensource.org/licenses/mit-license.php
	  // Unique ID creation requires a high quality random # generator.  We feature
	  // detect to determine the best RNG source, normalizing to a function that
	  // returns 128-bits of randomness, since that's what's usually required
	  // return require('./rng');
	}();

	var byteToHex$1$1 = [];

	for (var i$1$1 = 0; i$1$1 < 256; i$1$1++) {
	  byteToHex$1$1[i$1$1] = (i$1$1 + 0x100).toString(16).substr(1);
	} // **`v1()` - Generate time-based UUID**
	//
	// Inspired by https://github.com/LiosK/UUID.js
	// and http://docs.python.org/library/uuid.html
	// random #'s we need to init node and clockseq


	var seedBytes$1 = random$1(); // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)

	var defaultNodeId$1 = [seedBytes$1[0] | 0x01, seedBytes$1[1], seedBytes$1[2], seedBytes$1[3], seedBytes$1[4], seedBytes$1[5]]; // Per 4.2.2, randomize (14 bit) clockseq

	var defaultClockseq$1 = (seedBytes$1[6] << 8 | seedBytes$1[7]) & 0x3fff; // Previous uuid creation time

	/**
	 * UUIDv4 options.
	 */

	/**
	 * Generate UUIDv4
	 *
	 * @param options - Options to be used instead of default generated values.
	 * String 'binary' is a shorthand for uuid4({}, new Array(16)).
	 * @param buf - If present the buffer will be filled with the generated UUID.
	 * @param offset - Offset of the UUID from the start of the buffer.
	 *
	 * @returns UUIDv4
	 */

	function uuid4$1() {
	  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
	  var buf = arguments.length > 1 ? arguments[1] : undefined;
	  var offset = arguments.length > 2 ? arguments[2] : undefined; // Deprecated - 'format' argument, as supported in v1.2

	  var i = buf && offset || 0;

	  if (typeof options === 'string') {
	    buf = options === 'binary' ? new Array(16) : undefined;
	    options = {};
	  }

	  var rnds = options.random || (options.rng || random$1)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`

	  rnds[6] = rnds[6] & 0x0f | 0x40;
	  rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided

	  if (buf) {
	    for (var ii = 0; ii < 16; ii++) {
	      buf[i + ii] = rnds[ii];
	    }
	  }

	  return buf || stringifyUUID$1(rnds);
	} // Rollup will complain about mixing default and named exports in UMD build,


	var commonjsGlobal$2 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};

	function commonjsRequire() {
	  throw new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs');
	}

	function createCommonjsModule$1$1(fn, module) {
	  return module = {
	    exports: {}
	  }, fn(module, module.exports), module.exports;
	}

	var check$2 = function check(it) {
	  return it && it.Math == Math && it;
	}; // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028


	var global_1$2 = // eslint-disable-next-line no-undef
	check$2((typeof globalThis === "undefined" ? "undefined" : _typeof_1(globalThis)) == 'object' && globalThis) || check$2((typeof window === "undefined" ? "undefined" : _typeof_1(window)) == 'object' && window) || check$2((typeof self === "undefined" ? "undefined" : _typeof_1(self)) == 'object' && self) || check$2(_typeof_1(commonjsGlobal$2) == 'object' && commonjsGlobal$2) || // eslint-disable-next-line no-new-func
	Function('return this')();

	var fails$2 = function fails(exec) {
	  try {
	    return !!exec();
	  } catch (error) {
	    return true;
	  }
	}; // Thank's IE8 for his funny defineProperty


	var descriptors$2 = !fails$2(function () {
	  return defineProperty$3({}, 'a', {
	    get: function get() {
	      return 7;
	    }
	  }).a != 7;
	});
	var nativePropertyIsEnumerable$3 = {}.propertyIsEnumerable;
	var getOwnPropertyDescriptor$6 = getOwnPropertyDescriptor$3; // Nashorn ~ JDK8 bug

	var NASHORN_BUG$2 = getOwnPropertyDescriptor$6 && !nativePropertyIsEnumerable$3.call({
	  1: 2
	}, 1); // `Object.prototype.propertyIsEnumerable` method implementation
	// https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable

	var f$9 = NASHORN_BUG$2 ? function propertyIsEnumerable(V) {
	  var descriptor = getOwnPropertyDescriptor$6(this, V);
	  return !!descriptor && descriptor.enumerable;
	} : nativePropertyIsEnumerable$3;
	var objectPropertyIsEnumerable$2 = {
	  f: f$9
	};

	var createPropertyDescriptor$2 = function createPropertyDescriptor(bitmap, value) {
	  return {
	    enumerable: !(bitmap & 1),
	    configurable: !(bitmap & 2),
	    writable: !(bitmap & 4),
	    value: value
	  };
	};

	var toString$3 = {}.toString;

	var classofRaw$2 = function classofRaw(it) {
	  var _context9;

	  return slice$3(_context9 = toString$3.call(it)).call(_context9, 8, -1);
	};

	var split$2 = ''.split; // fallback for non-array-like ES3 and non-enumerable old V8 strings

	var indexedObject$2 = fails$2(function () {
	  // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
	  // eslint-disable-next-line no-prototype-builtins
	  return !Object('z').propertyIsEnumerable(0);
	}) ? function (it) {
	  return classofRaw$2(it) == 'String' ? split$2.call(it, '') : Object(it);
	} : Object; // `RequireObjectCoercible` abstract operation
	// https://tc39.github.io/ecma262/#sec-requireobjectcoercible

	var requireObjectCoercible$2 = function requireObjectCoercible(it) {
	  if (it == undefined) throw TypeError("Can't call method on " + it);
	  return it;
	}; // toObject with fallback for non-array-like ES3 strings


	var toIndexedObject$2 = function toIndexedObject(it) {
	  return indexedObject$2(requireObjectCoercible$2(it));
	};

	var isObject$2 = function isObject(it) {
	  return _typeof_1(it) === 'object' ? it !== null : typeof it === 'function';
	}; // `ToPrimitive` abstract operation
	// https://tc39.github.io/ecma262/#sec-toprimitive
	// instead of the ES6 spec version, we didn't implement @@toPrimitive case
	// and the second argument - flag - preferred type is a string


	var toPrimitive$2 = function toPrimitive(input, PREFERRED_STRING) {
	  if (!isObject$2(input)) return input;
	  var fn, val;
	  if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject$2(val = fn.call(input))) return val;
	  if (typeof (fn = input.valueOf) == 'function' && !isObject$2(val = fn.call(input))) return val;
	  if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject$2(val = fn.call(input))) return val;
	  throw TypeError("Can't convert object to primitive value");
	};

	var hasOwnProperty$2 = {}.hasOwnProperty;

	var has$3 = function has(it, key) {
	  return hasOwnProperty$2.call(it, key);
	};

	var document$1$2 = global_1$2.document; // typeof document.createElement is 'object' in old IE

	var EXISTS$2 = isObject$2(document$1$2) && isObject$2(document$1$2.createElement);

	var documentCreateElement$2 = function documentCreateElement(it) {
	  return EXISTS$2 ? document$1$2.createElement(it) : {};
	}; // Thank's IE8 for his funny defineProperty


	var ie8DomDefine$2 = !descriptors$2 && !fails$2(function () {
	  return defineProperty$3(documentCreateElement$2('div'), 'a', {
	    get: function get() {
	      return 7;
	    }
	  }).a != 7;
	});
	var nativeGetOwnPropertyDescriptor$4 = getOwnPropertyDescriptor$3; // `Object.getOwnPropertyDescriptor` method
	// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor

	var f$1$2 = descriptors$2 ? nativeGetOwnPropertyDescriptor$4 : function getOwnPropertyDescriptor(O, P) {
	  O = toIndexedObject$2(O);
	  P = toPrimitive$2(P, true);
	  if (ie8DomDefine$2) try {
	    return nativeGetOwnPropertyDescriptor$4(O, P);
	  } catch (error) {
	    /* empty */
	  }
	  if (has$3(O, P)) return createPropertyDescriptor$2(!objectPropertyIsEnumerable$2.f.call(O, P), O[P]);
	};
	var objectGetOwnPropertyDescriptor$2 = {
	  f: f$1$2
	};
	var replacement$2 = /#|\.prototype\./;

	var isForced$2 = function isForced(feature, detection) {
	  var value = data$2[normalize$2(feature)];
	  return value == POLYFILL$2 ? true : value == NATIVE$2 ? false : typeof detection == 'function' ? fails$2(detection) : !!detection;
	};

	var normalize$2 = isForced$2.normalize = function (string) {
	  return String(string).replace(replacement$2, '.').toLowerCase();
	};

	var data$2 = isForced$2.data = {};
	var NATIVE$2 = isForced$2.NATIVE = 'N';
	var POLYFILL$2 = isForced$2.POLYFILL = 'P';
	var isForced_1$2 = isForced$2;
	var path$2 = {};

	var aFunction$3 = function aFunction(it) {
	  if (typeof it != 'function') {
	    throw TypeError(String(it) + ' is not a function');
	  }

	  return it;
	}; // optional / simple context binding


	var bindContext$2 = function bindContext(fn, that, length) {
	  aFunction$3(fn);
	  if (that === undefined) return fn;

	  switch (length) {
	    case 0:
	      return function () {
	        return fn.call(that);
	      };

	    case 1:
	      return function (a) {
	        return fn.call(that, a);
	      };

	    case 2:
	      return function (a, b) {
	        return fn.call(that, a, b);
	      };

	    case 3:
	      return function (a, b, c) {
	        return fn.call(that, a, b, c);
	      };
	  }

	  return function ()
	  /* ...args */
	  {
	    return fn.apply(that, arguments);
	  };
	};

	var anObject$2 = function anObject(it) {
	  if (!isObject$2(it)) {
	    throw TypeError(String(it) + ' is not an object');
	  }

	  return it;
	};

	var nativeDefineProperty$3 = defineProperty$3; // `Object.defineProperty` method
	// https://tc39.github.io/ecma262/#sec-object.defineproperty

	var f$2$2 = descriptors$2 ? nativeDefineProperty$3 : function defineProperty(O, P, Attributes) {
	  anObject$2(O);
	  P = toPrimitive$2(P, true);
	  anObject$2(Attributes);
	  if (ie8DomDefine$2) try {
	    return nativeDefineProperty$3(O, P, Attributes);
	  } catch (error) {
	    /* empty */
	  }
	  if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
	  if ('value' in Attributes) O[P] = Attributes.value;
	  return O;
	};
	var objectDefineProperty$2 = {
	  f: f$2$2
	};
	var createNonEnumerableProperty$2 = descriptors$2 ? function (object, key, value) {
	  return objectDefineProperty$2.f(object, key, createPropertyDescriptor$2(1, value));
	} : function (object, key, value) {
	  object[key] = value;
	  return object;
	};
	var getOwnPropertyDescriptor$1$2 = objectGetOwnPropertyDescriptor$2.f;

	var wrapConstructor$2 = function wrapConstructor(NativeConstructor) {
	  var Wrapper = function Wrapper(a, b, c) {
	    if (this instanceof NativeConstructor) {
	      switch (arguments.length) {
	        case 0:
	          return new NativeConstructor();

	        case 1:
	          return new NativeConstructor(a);

	        case 2:
	          return new NativeConstructor(a, b);
	      }

	      return new NativeConstructor(a, b, c);
	    }

	    return NativeConstructor.apply(this, arguments);
	  };

	  Wrapper.prototype = NativeConstructor.prototype;
	  return Wrapper;
	};
	/*
	  options.target      - name of the target object
	  options.global      - target is the global object
	  options.stat        - export as static methods of target
	  options.proto       - export as prototype methods of target
	  options.real        - real prototype method for the `pure` version
	  options.forced      - export even if the native feature is available
	  options.bind        - bind methods to the target, required for the `pure` version
	  options.wrap        - wrap constructors to preventing global pollution, required for the `pure` version
	  options.unsafe      - use the simple assignment of property instead of delete + defineProperty
	  options.sham        - add a flag to not completely full polyfills
	  options.enumerable  - export as enumerable property
	  options.noTargetGet - prevent calling a getter on target
	*/


	var _export$2 = function _export(options, source) {
	  var TARGET = options.target;
	  var GLOBAL = options.global;
	  var STATIC = options.stat;
	  var PROTO = options.proto;
	  var nativeSource = GLOBAL ? global_1$2 : STATIC ? global_1$2[TARGET] : (global_1$2[TARGET] || {}).prototype;
	  var target = GLOBAL ? path$2 : path$2[TARGET] || (path$2[TARGET] = {});
	  var targetPrototype = target.prototype;
	  var FORCED, USE_NATIVE, VIRTUAL_PROTOTYPE;
	  var key, sourceProperty, targetProperty, nativeProperty, resultProperty, descriptor;

	  for (key in source) {
	    FORCED = isForced_1$2(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); // contains in native

	    USE_NATIVE = !FORCED && nativeSource && has$3(nativeSource, key);
	    targetProperty = target[key];
	    if (USE_NATIVE) if (options.noTargetGet) {
	      descriptor = getOwnPropertyDescriptor$1$2(nativeSource, key);
	      nativeProperty = descriptor && descriptor.value;
	    } else nativeProperty = nativeSource[key]; // export native or implementation

	    sourceProperty = USE_NATIVE && nativeProperty ? nativeProperty : source[key];
	    if (USE_NATIVE && _typeof_1(targetProperty) === _typeof_1(sourceProperty)) continue; // bind timers to global for call from export context

	    if (bind$2(options) && USE_NATIVE) resultProperty = bindContext$2(sourceProperty, global_1$2); // wrap global constructors for prevent changs in this version
	    else if (options.wrap && USE_NATIVE) resultProperty = wrapConstructor$2(sourceProperty); // make static versions for prototype methods
	      else if (PROTO && typeof sourceProperty == 'function') resultProperty = bindContext$2(Function.call, sourceProperty); // default case
	        else resultProperty = sourceProperty; // add a flag to not completely full polyfills

	    if (options.sham || sourceProperty && sourceProperty.sham || targetProperty && targetProperty.sham) {
	      createNonEnumerableProperty$2(resultProperty, 'sham', true);
	    }

	    target[key] = resultProperty;

	    if (PROTO) {
	      VIRTUAL_PROTOTYPE = TARGET + 'Prototype';

	      if (!has$3(path$2, VIRTUAL_PROTOTYPE)) {
	        createNonEnumerableProperty$2(path$2, VIRTUAL_PROTOTYPE, {});
	      } // export virtual prototype methods


	      path$2[VIRTUAL_PROTOTYPE][key] = sourceProperty; // export real prototype methods

	      if (options.real && targetPrototype && !targetPrototype[key]) {
	        createNonEnumerableProperty$2(targetPrototype, key, sourceProperty);
	      }
	    }
	  }
	}; // `Object.defineProperty` method
	// https://tc39.github.io/ecma262/#sec-object.defineproperty


	_export$2({
	  target: 'Object',
	  stat: true,
	  forced: !descriptors$2,
	  sham: !descriptors$2
	}, {
	  defineProperty: objectDefineProperty$2.f
	});

	var defineProperty_1$2 = createCommonjsModule$1$1(function (module) {
	  var Object = path$2.Object;

	  var defineProperty = module.exports = function defineProperty(it, key, desc) {
	    return Object.defineProperty(it, key, desc);
	  };

	  if (Object.defineProperty.sham) defineProperty.sham = true;
	});
	var ceil$2 = Math.ceil;
	var floor$2 = Math.floor; // `ToInteger` abstract operation
	// https://tc39.github.io/ecma262/#sec-tointeger

	var toInteger$2 = function toInteger(argument) {
	  return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor$2 : ceil$2)(argument);
	};

	var min$4 = Math.min; // `ToLength` abstract operation
	// https://tc39.github.io/ecma262/#sec-tolength

	var toLength$2 = function toLength(argument) {
	  return argument > 0 ? min$4(toInteger$2(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
	};

	var max$4 = Math.max;
	var min$1$2 = Math.min; // Helper for a popular repeating case of the spec:
	// Let integer be ? ToInteger(index).
	// If integer < 0, let result be max((length + integer), 0); else let result be min(length, length).

	var toAbsoluteIndex$2 = function toAbsoluteIndex(index, length) {
	  var integer = toInteger$2(index);
	  return integer < 0 ? max$4(integer + length, 0) : min$1$2(integer, length);
	}; // `Array.prototype.{ indexOf, includes }` methods implementation


	var createMethod$6 = function createMethod(IS_INCLUDES) {
	  return function ($this, el, fromIndex) {
	    var O = toIndexedObject$2($this);
	    var length = toLength$2(O.length);
	    var index = toAbsoluteIndex$2(fromIndex, length);
	    var value; // Array#includes uses SameValueZero equality algorithm
	    // eslint-disable-next-line no-self-compare

	    if (IS_INCLUDES && el != el) while (length > index) {
	      value = O[index++]; // eslint-disable-next-line no-self-compare

	      if (value != value) return true; // Array#indexOf ignores holes, Array#includes - not
	    } else for (; length > index; index++) {
	      if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
	    }
	    return !IS_INCLUDES && -1;
	  };
	};

	var arrayIncludes$2 = {
	  // `Array.prototype.includes` method
	  // https://tc39.github.io/ecma262/#sec-array.prototype.includes
	  includes: createMethod$6(true),
	  // `Array.prototype.indexOf` method
	  // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
	  indexOf: createMethod$6(false)
	};
	var hiddenKeys$3 = {};

	var indexOf$5 = indexOf$3(arrayIncludes$2);

	var objectKeysInternal$2 = function objectKeysInternal(object, names) {
	  var O = toIndexedObject$2(object);
	  var i = 0;
	  var result = [];
	  var key;

	  for (key in O) {
	    !has$3(hiddenKeys$3, key) && has$3(O, key) && result.push(key);
	  } // Don't enum bug & hidden keys


	  while (names.length > i) {
	    if (has$3(O, key = names[i++])) {
	      ~indexOf$5(result, key) || result.push(key);
	    }
	  }

	  return result;
	}; // IE8- don't enum bug keys


	var enumBugKeys$2 = ['constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf']; // `Object.keys` method
	// https://tc39.github.io/ecma262/#sec-object.keys

	var objectKeys$2 = keys$6 || function keys(O) {
	  return objectKeysInternal$2(O, enumBugKeys$2);
	}; // `Object.defineProperties` method
	// https://tc39.github.io/ecma262/#sec-object.defineproperties


	var objectDefineProperties$2 = descriptors$2 ? defineProperties$1 : function defineProperties(O, Properties) {
	  anObject$2(O);
	  var keys = objectKeys$2(Properties);
	  var length = keys.length;
	  var index = 0;
	  var key;

	  while (length > index) {
	    objectDefineProperty$2.f(O, key = keys[index++], Properties[key]);
	  }

	  return O;
	}; // `Object.defineProperties` method
	// https://tc39.github.io/ecma262/#sec-object.defineproperties

	_export$2({
	  target: 'Object',
	  stat: true,
	  forced: !descriptors$2,
	  sham: !descriptors$2
	}, {
	  defineProperties: objectDefineProperties$2
	});

	var defineProperties_1$2 = createCommonjsModule$1$1(function (module) {
	  var Object = path$2.Object;

	  var defineProperties = module.exports = function defineProperties(T, D) {
	    return Object.defineProperties(T, D);
	  };

	  if (Object.defineProperties.sham) defineProperties.sham = true;
	});

	var aFunction$1$2 = function aFunction$1(variable) {
	  return typeof variable == 'function' ? variable : undefined;
	};

	var getBuiltIn$2 = function getBuiltIn(namespace, method) {
	  return arguments.length < 2 ? aFunction$1$2(path$2[namespace]) || aFunction$1$2(global_1$2[namespace]) : path$2[namespace] && path$2[namespace][method] || global_1$2[namespace] && global_1$2[namespace][method];
	};

	var hiddenKeys$1$2 = concat$2(enumBugKeys$2).call(enumBugKeys$2, 'length', 'prototype'); // `Object.getOwnPropertyNames` method
	// https://tc39.github.io/ecma262/#sec-object.getownpropertynames


	var f$3$2 = getOwnPropertyNames$2 || function getOwnPropertyNames(O) {
	  return objectKeysInternal$2(O, hiddenKeys$1$2);
	};

	var objectGetOwnPropertyNames$2 = {
	  f: f$3$2
	};
	var f$4$2 = getOwnPropertySymbols$2;
	var objectGetOwnPropertySymbols$2 = {
	  f: f$4$2
	}; // all object keys, includes non-enumerable and symbols

	var ownKeys$3 = getBuiltIn$2('Reflect', 'ownKeys') || function ownKeys(it) {
	  var keys = objectGetOwnPropertyNames$2.f(anObject$2(it));
	  var getOwnPropertySymbols = objectGetOwnPropertySymbols$2.f;
	  return getOwnPropertySymbols ? concat$2(keys).call(keys, getOwnPropertySymbols(it)) : keys;
	};

	var createProperty$2 = function createProperty(object, key, value) {
	  var propertyKey = toPrimitive$2(key);
	  if (propertyKey in object) objectDefineProperty$2.f(object, propertyKey, createPropertyDescriptor$2(0, value));else object[propertyKey] = value;
	}; // `Object.getOwnPropertyDescriptors` method
	// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors


	_export$2({
	  target: 'Object',
	  stat: true,
	  sham: !descriptors$2
	}, {
	  getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) {
	    var O = toIndexedObject$2(object);
	    var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor$2.f;
	    var keys = ownKeys$3(O);
	    var result = {};
	    var index = 0;
	    var key, descriptor;

	    while (keys.length > index) {
	      descriptor = getOwnPropertyDescriptor(O, key = keys[index++]);
	      if (descriptor !== undefined) createProperty$2(result, key, descriptor);
	    }

	    return result;
	  }
	});

	var getOwnPropertyDescriptors$6 = path$2.Object.getOwnPropertyDescriptors;
	var nativeGetOwnPropertyDescriptor$1$2 = objectGetOwnPropertyDescriptor$2.f;
	var FAILS_ON_PRIMITIVES$7 = fails$2(function () {
	  nativeGetOwnPropertyDescriptor$1$2(1);
	});
	var FORCED$8 = !descriptors$2 || FAILS_ON_PRIMITIVES$7; // `Object.getOwnPropertyDescriptor` method
	// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor

	_export$2({
	  target: 'Object',
	  stat: true,
	  forced: FORCED$8,
	  sham: !descriptors$2
	}, {
	  getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) {
	    return nativeGetOwnPropertyDescriptor$1$2(toIndexedObject$2(it), key);
	  }
	});

	var getOwnPropertyDescriptor_1$2 = createCommonjsModule$1$1(function (module) {
	  var Object = path$2.Object;

	  var getOwnPropertyDescriptor = module.exports = function getOwnPropertyDescriptor(it, key) {
	    return Object.getOwnPropertyDescriptor(it, key);
	  };

	  if (Object.getOwnPropertyDescriptor.sham) getOwnPropertyDescriptor.sham = true;
	});
	var nativeSymbol$2 = !!getOwnPropertySymbols$2 && !fails$2(function () {
	  // Chrome 38 Symbol has incorrect toString conversion
	  // eslint-disable-next-line no-undef
	  return !String(symbol$2());
	}); // `IsArray` abstract operation
	// https://tc39.github.io/ecma262/#sec-isarray

	var isArray$6 = isArray$3 || function isArray(arg) {
	  return classofRaw$2(arg) == 'Array';
	}; // `ToObject` abstract operation
	// https://tc39.github.io/ecma262/#sec-toobject


	var toObject$2 = function toObject(argument) {
	  return Object(requireObjectCoercible$2(argument));
	};

	var html$2 = getBuiltIn$2('document', 'documentElement');

	var setGlobal$2 = function setGlobal(key, value) {
	  try {
	    createNonEnumerableProperty$2(global_1$2, key, value);
	  } catch (error) {
	    global_1$2[key] = value;
	  }

	  return value;
	};

	var SHARED$2 = '__core-js_shared__';
	var store$4 = global_1$2[SHARED$2] || setGlobal$2(SHARED$2, {});
	var sharedStore$2 = store$4;
	var shared$2 = createCommonjsModule$1$1(function (module) {
	  (module.exports = function (key, value) {
	    return sharedStore$2[key] || (sharedStore$2[key] = value !== undefined ? value : {});
	  })('versions', []).push({
	    version: '3.3.6',
	    mode: 'pure',
	    copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
	  });
	});
	var id$2 = 0;
	var postfix$2 = Math.random();

	var uid$2 = function uid(key) {
	  return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id$2 + postfix$2).toString(36);
	};

	var keys$8 = shared$2('keys');

	var sharedKey$2 = function sharedKey(key) {
	  return keys$8[key] || (keys$8[key] = uid$2(key));
	};

	var IE_PROTO$3 = sharedKey$2('IE_PROTO');
	var PROTOTYPE$3 = 'prototype';

	var Empty$2 = function Empty() {
	  /* empty */
	}; // Create object with fake `null` prototype: use iframe Object with cleared prototype


	var _createDict$1 = function createDict() {
	  // Thrash, waste and sodomy: IE GC bug
	  var iframe = documentCreateElement$2('iframe');
	  var length = enumBugKeys$2.length;
	  var lt = '<';
	  var script = 'script';
	  var gt = '>';
	  var js = 'java' + script + ':';
	  var iframeDocument;
	  iframe.style.display = 'none';
	  html$2.appendChild(iframe);
	  iframe.src = String(js);
	  iframeDocument = iframe.contentWindow.document;
	  iframeDocument.open();
	  iframeDocument.write(lt + script + gt + 'document.F=Object' + lt + '/' + script + gt);
	  iframeDocument.close();
	  _createDict$1 = iframeDocument.F;

	  while (length--) {
	    delete _createDict$1[PROTOTYPE$3][enumBugKeys$2[length]];
	  }

	  return _createDict$1();
	}; // `Object.create` method
	// https://tc39.github.io/ecma262/#sec-object.create


	var objectCreate$2 = create$2 || function create(O, Properties) {
	  var result;

	  if (O !== null) {
	    Empty$2[PROTOTYPE$3] = anObject$2(O);
	    result = new Empty$2();
	    Empty$2[PROTOTYPE$3] = null; // add "__proto__" for Object.getPrototypeOf polyfill

	    result[IE_PROTO$3] = O;
	  } else result = _createDict$1();

	  return Properties === undefined ? result : objectDefineProperties$2(result, Properties);
	};

	hiddenKeys$3[IE_PROTO$3] = true;
	var nativeGetOwnPropertyNames$4 = objectGetOwnPropertyNames$2.f;
	var toString$1$2 = {}.toString;
	var windowNames$2 = (typeof window === "undefined" ? "undefined" : _typeof_1(window)) == 'object' && window && getOwnPropertyNames$2 ? getOwnPropertyNames$2(window) : [];

	var getWindowNames$2 = function getWindowNames(it) {
	  try {
	    return nativeGetOwnPropertyNames$4(it);
	  } catch (error) {
	    return slice$3(windowNames$2).call(windowNames$2);
	  }
	}; // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window


	var f$5$2 = function getOwnPropertyNames(it) {
	  return windowNames$2 && toString$1$2.call(it) == '[object Window]' ? getWindowNames$2(it) : nativeGetOwnPropertyNames$4(toIndexedObject$2(it));
	};

	var objectGetOwnPropertyNamesExternal$2 = {
	  f: f$5$2
	};

	var redefine$2 = function redefine(target, key, value, options) {
	  if (options && options.enumerable) target[key] = value;else createNonEnumerableProperty$2(target, key, value);
	};

	var Symbol$1$2 = global_1$2.Symbol;
	var store$1$2 = shared$2('wks');

	var wellKnownSymbol$2 = function wellKnownSymbol(name) {
	  return store$1$2[name] || (store$1$2[name] = nativeSymbol$2 && Symbol$1$2[name] || (nativeSymbol$2 ? Symbol$1$2 : uid$2)('Symbol.' + name));
	};

	var f$6$2 = wellKnownSymbol$2;
	var wrappedWellKnownSymbol$2 = {
	  f: f$6$2
	};
	var defineProperty$2$2 = objectDefineProperty$2.f;

	var defineWellKnownSymbol$2 = function defineWellKnownSymbol(NAME) {
	  var _Symbol2 = path$2.Symbol || (path$2.Symbol = {});

	  if (!has$3(_Symbol2, NAME)) defineProperty$2$2(_Symbol2, NAME, {
	    value: wrappedWellKnownSymbol$2.f(NAME)
	  });
	};

	var TO_STRING_TAG$5 = wellKnownSymbol$2('toStringTag'); // ES3 wrong here

	var CORRECT_ARGUMENTS$2 = classofRaw$2(function () {
	  return arguments;
	}()) == 'Arguments'; // fallback for IE11 Script Access Denied error

	var tryGet$2 = function tryGet(it, key) {
	  try {
	    return it[key];
	  } catch (error) {
	    /* empty */
	  }
	}; // getting tag from ES6+ `Object.prototype.toString`


	var classof$2 = function classof(it) {
	  var O, tag, result;
	  return it === undefined ? 'Undefined' : it === null ? 'Null' // @@toStringTag case
	  : typeof (tag = tryGet$2(O = Object(it), TO_STRING_TAG$5)) == 'string' ? tag // builtinTag case
	  : CORRECT_ARGUMENTS$2 ? classofRaw$2(O) // ES3 arguments fallback
	  : (result = classofRaw$2(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
	};

	var TO_STRING_TAG$1$2 = wellKnownSymbol$2('toStringTag');
	var test$4 = {};
	test$4[TO_STRING_TAG$1$2] = 'z'; // `Object.prototype.toString` method implementation
	// https://tc39.github.io/ecma262/#sec-object.prototype.tostring

	var objectToString$2 = String(test$4) !== '[object z]' ? function toString() {
	  return '[object ' + classof$2(this) + ']';
	} : test$4.toString;
	var defineProperty$3$2 = objectDefineProperty$2.f;
	var TO_STRING_TAG$2$2 = wellKnownSymbol$2('toStringTag');
	var METHOD_REQUIRED$2 = objectToString$2 !== {}.toString;

	var setToStringTag$2 = function setToStringTag(it, TAG, STATIC, SET_METHOD) {
	  if (it) {
	    var target = STATIC ? it : it.prototype;

	    if (!has$3(target, TO_STRING_TAG$2$2)) {
	      defineProperty$3$2(target, TO_STRING_TAG$2$2, {
	        configurable: true,
	        value: TAG
	      });
	    }

	    if (SET_METHOD && METHOD_REQUIRED$2) {
	      createNonEnumerableProperty$2(target, 'toString', objectToString$2);
	    }
	  }
	};

	var functionToString$2 = shared$2('native-function-to-string', Function.toString);
	var WeakMap$3 = global_1$2.WeakMap;
	var nativeWeakMap$2 = typeof WeakMap$3 === 'function' && /native code/.test(functionToString$2.call(WeakMap$3));
	var WeakMap$1$2 = global_1$2.WeakMap;
	var set$6, get$2, has$1$2;

	var enforce$2 = function enforce(it) {
	  return has$1$2(it) ? get$2(it) : set$6(it, {});
	};

	var getterFor$2 = function getterFor(TYPE) {
	  return function (it) {
	    var state;

	    if (!isObject$2(it) || (state = get$2(it)).type !== TYPE) {
	      throw TypeError('Incompatible receiver, ' + TYPE + ' required');
	    }

	    return state;
	  };
	};

	if (nativeWeakMap$2) {
	  var store$2$2 = new WeakMap$1$2();
	  var wmget$2 = store$2$2.get;
	  var wmhas$2 = store$2$2.has;
	  var wmset$2 = store$2$2.set;

	  set$6 = function set(it, metadata) {
	    wmset$2.call(store$2$2, it, metadata);
	    return metadata;
	  };

	  get$2 = function get(it) {
	    return wmget$2.call(store$2$2, it) || {};
	  };

	  has$1$2 = function has$1(it) {
	    return wmhas$2.call(store$2$2, it);
	  };
	} else {
	  var STATE$2 = sharedKey$2('state');
	  hiddenKeys$3[STATE$2] = true;

	  set$6 = function set(it, metadata) {
	    createNonEnumerableProperty$2(it, STATE$2, metadata);
	    return metadata;
	  };

	  get$2 = function get(it) {
	    return has$3(it, STATE$2) ? it[STATE$2] : {};
	  };

	  has$1$2 = function has$1(it) {
	    return has$3(it, STATE$2);
	  };
	}

	var internalState$2 = {
	  set: set$6,
	  get: get$2,
	  has: has$1$2,
	  enforce: enforce$2,
	  getterFor: getterFor$2
	};
	var SPECIES$7 = wellKnownSymbol$2('species'); // `ArraySpeciesCreate` abstract operation
	// https://tc39.github.io/ecma262/#sec-arrayspeciescreate

	var arraySpeciesCreate$2 = function arraySpeciesCreate(originalArray, length) {
	  var C;

	  if (isArray$6(originalArray)) {
	    C = originalArray.constructor; // cross-realm fallback

	    if (typeof C == 'function' && (C === Array || isArray$6(C.prototype))) C = undefined;else if (isObject$2(C)) {
	      C = C[SPECIES$7];
	      if (C === null) C = undefined;
	    }
	  }

	  return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
	};

	var push$2 = [].push; // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation

	var createMethod$1$2 = function createMethod$1(TYPE) {
	  var IS_MAP = TYPE == 1;
	  var IS_FILTER = TYPE == 2;
	  var IS_SOME = TYPE == 3;
	  var IS_EVERY = TYPE == 4;
	  var IS_FIND_INDEX = TYPE == 6;
	  var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
	  return function ($this, callbackfn, that, specificCreate) {
	    var O = toObject$2($this);
	    var self = indexedObject$2(O);
	    var boundFunction = bindContext$2(callbackfn, that, 3);
	    var length = toLength$2(self.length);
	    var index = 0;
	    var create = specificCreate || arraySpeciesCreate$2;
	    var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
	    var value, result;

	    for (; length > index; index++) {
	      if (NO_HOLES || index in self) {
	        value = self[index];
	        result = boundFunction(value, index, O);

	        if (TYPE) {
	          if (IS_MAP) target[index] = result; // map
	          else if (result) switch (TYPE) {
	              case 3:
	                return true;
	              // some

	              case 5:
	                return value;
	              // find

	              case 6:
	                return index;
	              // findIndex

	              case 2:
	                push$2.call(target, value);
	              // filter
	            } else if (IS_EVERY) return false; // every
	        }
	      }
	    }

	    return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
	  };
	};

	var arrayIteration$2 = {
	  // `Array.prototype.forEach` method
	  // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
	  forEach: createMethod$1$2(0),
	  // `Array.prototype.map` method
	  // https://tc39.github.io/ecma262/#sec-array.prototype.map
	  map: createMethod$1$2(1),
	  // `Array.prototype.filter` method
	  // https://tc39.github.io/ecma262/#sec-array.prototype.filter
	  filter: createMethod$1$2(2),
	  // `Array.prototype.some` method
	  // https://tc39.github.io/ecma262/#sec-array.prototype.some
	  some: createMethod$1$2(3),
	  // `Array.prototype.every` method
	  // https://tc39.github.io/ecma262/#sec-array.prototype.every
	  every: createMethod$1$2(4),
	  // `Array.prototype.find` method
	  // https://tc39.github.io/ecma262/#sec-array.prototype.find
	  find: createMethod$1$2(5),
	  // `Array.prototype.findIndex` method
	  // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex
	  findIndex: createMethod$1$2(6)
	};

	var $forEach$3 = forEach$2(arrayIteration$2);

	var HIDDEN$2 = sharedKey$2('hidden');
	var SYMBOL$2 = 'Symbol';
	var PROTOTYPE$1$2 = 'prototype';
	var TO_PRIMITIVE$2 = wellKnownSymbol$2('toPrimitive');
	var setInternalState$7 = internalState$2.set;
	var getInternalState$5 = internalState$2.getterFor(SYMBOL$2);
	var ObjectPrototype$3 = Object[PROTOTYPE$1$2];
	var $Symbol$2 = global_1$2.Symbol;
	var JSON$1 = global_1$2.JSON;
	var nativeJSONStringify = JSON$1 && JSON$1.stringify;
	var nativeGetOwnPropertyDescriptor$2$2 = objectGetOwnPropertyDescriptor$2.f;
	var nativeDefineProperty$1$2 = objectDefineProperty$2.f;
	var nativeGetOwnPropertyNames$1$2 = objectGetOwnPropertyNamesExternal$2.f;
	var nativePropertyIsEnumerable$1$2 = objectPropertyIsEnumerable$2.f;
	var AllSymbols$2 = shared$2('symbols');
	var ObjectPrototypeSymbols$2 = shared$2('op-symbols');
	var StringToSymbolRegistry$2 = shared$2('string-to-symbol-registry');
	var SymbolToStringRegistry$2 = shared$2('symbol-to-string-registry');
	var WellKnownSymbolsStore$2 = shared$2('wks');
	var QObject$2 = global_1$2.QObject; // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173

	var USE_SETTER$2 = !QObject$2 || !QObject$2[PROTOTYPE$1$2] || !QObject$2[PROTOTYPE$1$2].findChild; // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687

	var setSymbolDescriptor$2 = descriptors$2 && fails$2(function () {
	  return objectCreate$2(nativeDefineProperty$1$2({}, 'a', {
	    get: function get() {
	      return nativeDefineProperty$1$2(this, 'a', {
	        value: 7
	      }).a;
	    }
	  })).a != 7;
	}) ? function (O, P, Attributes) {
	  var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor$2$2(ObjectPrototype$3, P);
	  if (ObjectPrototypeDescriptor) delete ObjectPrototype$3[P];
	  nativeDefineProperty$1$2(O, P, Attributes);

	  if (ObjectPrototypeDescriptor && O !== ObjectPrototype$3) {
	    nativeDefineProperty$1$2(ObjectPrototype$3, P, ObjectPrototypeDescriptor);
	  }
	} : nativeDefineProperty$1$2;

	var wrap$3 = function wrap(tag, description) {
	  var symbol = AllSymbols$2[tag] = objectCreate$2($Symbol$2[PROTOTYPE$1$2]);
	  setInternalState$7(symbol, {
	    type: SYMBOL$2,
	    tag: tag,
	    description: description
	  });
	  if (!descriptors$2) symbol.description = description;
	  return symbol;
	};

	var isSymbol$2 = nativeSymbol$2 && _typeof_1($Symbol$2.iterator) == 'symbol' ? function (it) {
	  return _typeof_1(it) == 'symbol';
	} : function (it) {
	  return Object(it) instanceof $Symbol$2;
	};

	var $defineProperty$2 = function defineProperty(O, P, Attributes) {
	  if (O === ObjectPrototype$3) $defineProperty$2(ObjectPrototypeSymbols$2, P, Attributes);
	  anObject$2(O);
	  var key = toPrimitive$2(P, true);
	  anObject$2(Attributes);

	  if (has$3(AllSymbols$2, key)) {
	    if (!Attributes.enumerable) {
	      if (!has$3(O, HIDDEN$2)) nativeDefineProperty$1$2(O, HIDDEN$2, createPropertyDescriptor$2(1, {}));
	      O[HIDDEN$2][key] = true;
	    } else {
	      if (has$3(O, HIDDEN$2) && O[HIDDEN$2][key]) O[HIDDEN$2][key] = false;
	      Attributes = objectCreate$2(Attributes, {
	        enumerable: createPropertyDescriptor$2(0, false)
	      });
	    }

	    return setSymbolDescriptor$2(O, key, Attributes);
	  }

	  return nativeDefineProperty$1$2(O, key, Attributes);
	};

	var $defineProperties$2 = function defineProperties(O, Properties) {
	  var _context10;

	  anObject$2(O);
	  var properties = toIndexedObject$2(Properties);

	  var keys = concat$2(_context10 = objectKeys$2(properties)).call(_context10, $getOwnPropertySymbols$2(properties));

	  $forEach$3(keys, function (key) {
	    if (!descriptors$2 || $propertyIsEnumerable$2.call(properties, key)) $defineProperty$2(O, key, properties[key]);
	  });
	  return O;
	};

	var $create$2 = function create(O, Properties) {
	  return Properties === undefined ? objectCreate$2(O) : $defineProperties$2(objectCreate$2(O), Properties);
	};

	var $propertyIsEnumerable$2 = function propertyIsEnumerable(V) {
	  var P = toPrimitive$2(V, true);
	  var enumerable = nativePropertyIsEnumerable$1$2.call(this, P);
	  if (this === ObjectPrototype$3 && has$3(AllSymbols$2, P) && !has$3(ObjectPrototypeSymbols$2, P)) return false;
	  return enumerable || !has$3(this, P) || !has$3(AllSymbols$2, P) || has$3(this, HIDDEN$2) && this[HIDDEN$2][P] ? enumerable : true;
	};

	var $getOwnPropertyDescriptor$2 = function getOwnPropertyDescriptor(O, P) {
	  var it = toIndexedObject$2(O);
	  var key = toPrimitive$2(P, true);
	  if (it === ObjectPrototype$3 && has$3(AllSymbols$2, key) && !has$3(ObjectPrototypeSymbols$2, key)) return;
	  var descriptor = nativeGetOwnPropertyDescriptor$2$2(it, key);

	  if (descriptor && has$3(AllSymbols$2, key) && !(has$3(it, HIDDEN$2) && it[HIDDEN$2][key])) {
	    descriptor.enumerable = true;
	  }

	  return descriptor;
	};

	var $getOwnPropertyNames$2 = function getOwnPropertyNames(O) {
	  var names = nativeGetOwnPropertyNames$1$2(toIndexedObject$2(O));
	  var result = [];
	  $forEach$3(names, function (key) {
	    if (!has$3(AllSymbols$2, key) && !has$3(hiddenKeys$3, key)) result.push(key);
	  });
	  return result;
	};

	var $getOwnPropertySymbols$2 = function getOwnPropertySymbols(O) {
	  var IS_OBJECT_PROTOTYPE = O === ObjectPrototype$3;
	  var names = nativeGetOwnPropertyNames$1$2(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols$2 : toIndexedObject$2(O));
	  var result = [];
	  $forEach$3(names, function (key) {
	    if (has$3(AllSymbols$2, key) && (!IS_OBJECT_PROTOTYPE || has$3(ObjectPrototype$3, key))) {
	      result.push(AllSymbols$2[key]);
	    }
	  });
	  return result;
	}; // `Symbol` constructor
	// https://tc39.github.io/ecma262/#sec-symbol-constructor


	if (!nativeSymbol$2) {
	  $Symbol$2 = function _Symbol3() {
	    if (this instanceof $Symbol$2) throw TypeError('Symbol is not a constructor');
	    var description = !arguments.length || arguments[0] === undefined ? undefined : String(arguments[0]);
	    var tag = uid$2(description);

	    var setter = function setter(value) {
	      if (this === ObjectPrototype$3) setter.call(ObjectPrototypeSymbols$2, value);
	      if (has$3(this, HIDDEN$2) && has$3(this[HIDDEN$2], tag)) this[HIDDEN$2][tag] = false;
	      setSymbolDescriptor$2(this, tag, createPropertyDescriptor$2(1, value));
	    };

	    if (descriptors$2 && USE_SETTER$2) setSymbolDescriptor$2(ObjectPrototype$3, tag, {
	      configurable: true,
	      set: setter
	    });
	    return wrap$3(tag, description);
	  };

	  redefine$2($Symbol$2[PROTOTYPE$1$2], 'toString', function toString() {
	    return getInternalState$5(this).tag;
	  });
	  objectPropertyIsEnumerable$2.f = $propertyIsEnumerable$2;
	  objectDefineProperty$2.f = $defineProperty$2;
	  objectGetOwnPropertyDescriptor$2.f = $getOwnPropertyDescriptor$2;
	  objectGetOwnPropertyNames$2.f = objectGetOwnPropertyNamesExternal$2.f = $getOwnPropertyNames$2;
	  objectGetOwnPropertySymbols$2.f = $getOwnPropertySymbols$2;

	  if (descriptors$2) {
	    // https://github.com/tc39/proposal-Symbol-description
	    nativeDefineProperty$1$2($Symbol$2[PROTOTYPE$1$2], 'description', {
	      configurable: true,
	      get: function description() {
	        return getInternalState$5(this).description;
	      }
	    });
	  }

	  wrappedWellKnownSymbol$2.f = function (name) {
	    return wrap$3(wellKnownSymbol$2(name), name);
	  };
	}

	_export$2({
	  global: true,
	  wrap: true,
	  forced: !nativeSymbol$2,
	  sham: !nativeSymbol$2
	}, {
	  Symbol: $Symbol$2
	});

	$forEach$3(objectKeys$2(WellKnownSymbolsStore$2), function (name) {
	  defineWellKnownSymbol$2(name);
	});

	_export$2({
	  target: SYMBOL$2,
	  stat: true,
	  forced: !nativeSymbol$2
	}, {
	  // `Symbol.for` method
	  // https://tc39.github.io/ecma262/#sec-symbol.for
	  'for': function _for(key) {
	    var string = String(key);
	    if (has$3(StringToSymbolRegistry$2, string)) return StringToSymbolRegistry$2[string];
	    var symbol = $Symbol$2(string);
	    StringToSymbolRegistry$2[string] = symbol;
	    SymbolToStringRegistry$2[symbol] = string;
	    return symbol;
	  },
	  // `Symbol.keyFor` method
	  // https://tc39.github.io/ecma262/#sec-symbol.keyfor
	  keyFor: function keyFor(sym) {
	    if (!isSymbol$2(sym)) throw TypeError(sym + ' is not a symbol');
	    if (has$3(SymbolToStringRegistry$2, sym)) return SymbolToStringRegistry$2[sym];
	  },
	  useSetter: function useSetter() {
	    USE_SETTER$2 = true;
	  },
	  useSimple: function useSimple() {
	    USE_SETTER$2 = false;
	  }
	});

	_export$2({
	  target: 'Object',
	  stat: true,
	  forced: !nativeSymbol$2,
	  sham: !descriptors$2
	}, {
	  // `Object.create` method
	  // https://tc39.github.io/ecma262/#sec-object.create
	  create: $create$2,
	  // `Object.defineProperty` method
	  // https://tc39.github.io/ecma262/#sec-object.defineproperty
	  defineProperty: $defineProperty$2,
	  // `Object.defineProperties` method
	  // https://tc39.github.io/ecma262/#sec-object.defineproperties
	  defineProperties: $defineProperties$2,
	  // `Object.getOwnPropertyDescriptor` method
	  // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors
	  getOwnPropertyDescriptor: $getOwnPropertyDescriptor$2
	});

	_export$2({
	  target: 'Object',
	  stat: true,
	  forced: !nativeSymbol$2
	}, {
	  // `Object.getOwnPropertyNames` method
	  // https://tc39.github.io/ecma262/#sec-object.getownpropertynames
	  getOwnPropertyNames: $getOwnPropertyNames$2,
	  // `Object.getOwnPropertySymbols` method
	  // https://tc39.github.io/ecma262/#sec-object.getownpropertysymbols
	  getOwnPropertySymbols: $getOwnPropertySymbols$2
	}); // Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
	// https://bugs.chromium.org/p/v8/issues/detail?id=3443


	_export$2({
	  target: 'Object',
	  stat: true,
	  forced: fails$2(function () {
	    objectGetOwnPropertySymbols$2.f(1);
	  })
	}, {
	  getOwnPropertySymbols: function getOwnPropertySymbols(it) {
	    return objectGetOwnPropertySymbols$2.f(toObject$2(it));
	  }
	}); // `JSON.stringify` method behavior with symbols
	// https://tc39.github.io/ecma262/#sec-json.stringify


	JSON$1 && _export$2({
	  target: 'JSON',
	  stat: true,
	  forced: !nativeSymbol$2 || fails$2(function () {
	    var symbol = $Symbol$2(); // MS Edge converts symbol values to JSON as {}

	    return nativeJSONStringify([symbol]) != '[null]' // WebKit converts symbol values to JSON as null
	    || nativeJSONStringify({
	      a: symbol
	    }) != '{}' // V8 throws on boxed symbols
	    || nativeJSONStringify(Object(symbol)) != '{}';
	  })
	}, {
	  stringify: function stringify(it) {
	    var args = [it];
	    var index = 1;
	    var replacer, $replacer;

	    while (arguments.length > index) {
	      args.push(arguments[index++]);
	    }

	    $replacer = replacer = args[1];
	    if (!isObject$2(replacer) && it === undefined || isSymbol$2(it)) return; // IE8 returns string on undefined

	    if (!isArray$6(replacer)) replacer = function replacer(key, value) {
	      if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
	      if (!isSymbol$2(value)) return value;
	    };
	    args[1] = replacer;
	    return nativeJSONStringify.apply(JSON$1, args);
	  }
	}); // `Symbol.prototype[@@toPrimitive]` method
	// https://tc39.github.io/ecma262/#sec-symbol.prototype-@@toprimitive

	if (!$Symbol$2[PROTOTYPE$1$2][TO_PRIMITIVE$2]) {
	  createNonEnumerableProperty$2($Symbol$2[PROTOTYPE$1$2], TO_PRIMITIVE$2, $Symbol$2[PROTOTYPE$1$2].valueOf);
	} // `Symbol.prototype[@@toStringTag]` property
	// https://tc39.github.io/ecma262/#sec-symbol.prototype-@@tostringtag


	setToStringTag$2($Symbol$2, SYMBOL$2);
	hiddenKeys$3[HIDDEN$2] = true;
	var getOwnPropertySymbols$4 = path$2.Object.getOwnPropertySymbols;
	var iterators$2 = {};
	var correctPrototypeGetter$2 = !fails$2(function () {
	  function F() {
	    /* empty */
	  }

	  F.prototype.constructor = null;
	  return getPrototypeOf$2(new F()) !== F.prototype;
	});
	var IE_PROTO$1$2 = sharedKey$2('IE_PROTO');
	var ObjectPrototype$1$2 = Object.prototype; // `Object.getPrototypeOf` method
	// https://tc39.github.io/ecma262/#sec-object.getprototypeof

	var objectGetPrototypeOf$2 = correctPrototypeGetter$2 ? getPrototypeOf$2 : function (O) {
	  O = toObject$2(O);
	  if (has$3(O, IE_PROTO$1$2)) return O[IE_PROTO$1$2];

	  if (typeof O.constructor == 'function' && O instanceof O.constructor) {
	    return O.constructor.prototype;
	  }

	  return O instanceof Object ? ObjectPrototype$1$2 : null;
	};
	var ITERATOR$7 = wellKnownSymbol$2('iterator');
	var BUGGY_SAFARI_ITERATORS$3 = false; // `%IteratorPrototype%` object
	// https://tc39.github.io/ecma262/#sec-%iteratorprototype%-object

	var IteratorPrototype$4, PrototypeOfArrayIteratorPrototype$2, arrayIterator$2;

	if (keys$3([])) {
	  var _context11;

	  arrayIterator$2 = keys$3(_context11 = []).call(_context11); // Safari 8 has buggy iterators w/o `next`

	  if (!('next' in arrayIterator$2)) BUGGY_SAFARI_ITERATORS$3 = true;else {
	    PrototypeOfArrayIteratorPrototype$2 = objectGetPrototypeOf$2(objectGetPrototypeOf$2(arrayIterator$2));
	    if (PrototypeOfArrayIteratorPrototype$2 !== Object.prototype) IteratorPrototype$4 = PrototypeOfArrayIteratorPrototype$2;
	  }
	}

	if (IteratorPrototype$4 == undefined) IteratorPrototype$4 = {};
	var iteratorsCore$2 = {
	  IteratorPrototype: IteratorPrototype$4,
	  BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS$3
	};
	var IteratorPrototype$1$2 = iteratorsCore$2.IteratorPrototype;

	var returnThis$3 = function returnThis() {
	  return this;
	};

	var createIteratorConstructor$2 = function createIteratorConstructor(IteratorConstructor, NAME, next) {
	  var TO_STRING_TAG = NAME + ' Iterator';
	  IteratorConstructor.prototype = objectCreate$2(IteratorPrototype$1$2, {
	    next: createPropertyDescriptor$2(1, next)
	  });
	  setToStringTag$2(IteratorConstructor, TO_STRING_TAG, false, true);
	  iterators$2[TO_STRING_TAG] = returnThis$3;
	  return IteratorConstructor;
	};

	var aPossiblePrototype$2 = function aPossiblePrototype(it) {
	  if (!isObject$2(it) && it !== null) {
	    throw TypeError("Can't set " + String(it) + ' as a prototype');
	  }

	  return it;
	}; // `Object.setPrototypeOf` method
	// https://tc39.github.io/ecma262/#sec-object.setprototypeof
	// Works with __proto__ only. Old v8 can't work with null proto objects.

	/* eslint-disable no-proto */


	var objectSetPrototypeOf$2 = setPrototypeOf$2 || ('__proto__' in {} ? function () {
	  var CORRECT_SETTER = false;
	  var test = {};
	  var setter;

	  try {
	    setter = getOwnPropertyDescriptor$3(Object.prototype, '__proto__').set;
	    setter.call(test, []);
	    CORRECT_SETTER = test instanceof Array;
	  } catch (error) {
	    /* empty */
	  }

	  return function setPrototypeOf(O, proto) {
	    anObject$2(O);
	    aPossiblePrototype$2(proto);
	    if (CORRECT_SETTER) setter.call(O, proto);else O.__proto__ = proto;
	    return O;
	  };
	}() : undefined);
	var IteratorPrototype$2$2 = iteratorsCore$2.IteratorPrototype;
	var BUGGY_SAFARI_ITERATORS$1$2 = iteratorsCore$2.BUGGY_SAFARI_ITERATORS;
	var ITERATOR$1$2 = wellKnownSymbol$2('iterator');
	var KEYS$2 = 'keys';
	var VALUES$2 = 'values';
	var ENTRIES$2 = 'entries';

	var returnThis$1$2 = function returnThis$1() {
	  return this;
	};

	var defineIterator$2 = function defineIterator(Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
	  createIteratorConstructor$2(IteratorConstructor, NAME, next);

	  var getIterationMethod = function getIterationMethod(KIND) {
	    if (KIND === DEFAULT && defaultIterator) return defaultIterator;
	    if (!BUGGY_SAFARI_ITERATORS$1$2 && KIND in IterablePrototype) return IterablePrototype[KIND];

	    switch (KIND) {
	      case KEYS$2:
	        return function keys() {
	          return new IteratorConstructor(this, KIND);
	        };

	      case VALUES$2:
	        return function values() {
	          return new IteratorConstructor(this, KIND);
	        };

	      case ENTRIES$2:
	        return function entries() {
	          return new IteratorConstructor(this, KIND);
	        };
	    }

	    return function () {
	      return new IteratorConstructor(this);
	    };
	  };

	  var TO_STRING_TAG = NAME + ' Iterator';
	  var INCORRECT_VALUES_NAME = false;
	  var IterablePrototype = Iterable.prototype;
	  var nativeIterator = IterablePrototype[ITERATOR$1$2] || IterablePrototype['@@iterator'] || DEFAULT && IterablePrototype[DEFAULT];
	  var defaultIterator = !BUGGY_SAFARI_ITERATORS$1$2 && nativeIterator || getIterationMethod(DEFAULT);
	  var anyNativeIterator = NAME == 'Array' ? entries$2(IterablePrototype) || nativeIterator : nativeIterator;
	  var CurrentIteratorPrototype, methods, KEY; // fix native

	  if (anyNativeIterator) {
	    CurrentIteratorPrototype = objectGetPrototypeOf$2(anyNativeIterator.call(new Iterable()));

	    if (IteratorPrototype$2$2 !== Object.prototype && CurrentIteratorPrototype.next) {
	      // Set @@toStringTag to native iterators
	      setToStringTag$2(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
	      iterators$2[TO_STRING_TAG] = returnThis$1$2;
	    }
	  } // fix Array#{values, @@iterator}.name in V8 / FF


	  if (DEFAULT == VALUES$2 && nativeIterator && nativeIterator.name !== VALUES$2) {
	    INCORRECT_VALUES_NAME = true;

	    defaultIterator = function values() {
	      return nativeIterator.call(this);
	    };
	  } // define iterator


	  if (FORCED && IterablePrototype[ITERATOR$1$2] !== defaultIterator) {
	    createNonEnumerableProperty$2(IterablePrototype, ITERATOR$1$2, defaultIterator);
	  }

	  iterators$2[NAME] = defaultIterator; // export additional methods

	  if (DEFAULT) {
	    methods = {
	      values: getIterationMethod(VALUES$2),
	      keys: IS_SET ? defaultIterator : getIterationMethod(KEYS$2),
	      entries: getIterationMethod(ENTRIES$2)
	    };
	    if (FORCED) for (KEY in methods) {
	      if (BUGGY_SAFARI_ITERATORS$1$2 || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
	        redefine$2(IterablePrototype, KEY, methods[KEY]);
	      }
	    } else _export$2({
	      target: NAME,
	      proto: true,
	      forced: BUGGY_SAFARI_ITERATORS$1$2 || INCORRECT_VALUES_NAME
	    }, methods);
	  }

	  return methods;
	};

	var ARRAY_ITERATOR$2 = 'Array Iterator';
	var setInternalState$1$2 = internalState$2.set;
	var getInternalState$1$2 = internalState$2.getterFor(ARRAY_ITERATOR$2); // `Array.prototype.entries` method
	// https://tc39.github.io/ecma262/#sec-array.prototype.entries
	// `Array.prototype.keys` method
	// https://tc39.github.io/ecma262/#sec-array.prototype.keys
	// `Array.prototype.values` method
	// https://tc39.github.io/ecma262/#sec-array.prototype.values
	// `Array.prototype[@@iterator]` method
	// https://tc39.github.io/ecma262/#sec-array.prototype-@@iterator
	// `CreateArrayIterator` internal method
	// https://tc39.github.io/ecma262/#sec-createarrayiterator

	var es_array_iterator$2 = defineIterator$2(Array, 'Array', function (iterated, kind) {
	  setInternalState$1$2(this, {
	    type: ARRAY_ITERATOR$2,
	    target: toIndexedObject$2(iterated),
	    // target
	    index: 0,
	    // next index
	    kind: kind // kind

	  }); // `%ArrayIteratorPrototype%.next` method
	  // https://tc39.github.io/ecma262/#sec-%arrayiteratorprototype%.next
	}, function () {
	  var state = getInternalState$1$2(this);
	  var target = state.target;
	  var kind = state.kind;
	  var index = state.index++;

	  if (!target || index >= target.length) {
	    state.target = undefined;
	    return {
	      value: undefined,
	      done: true
	    };
	  }

	  if (kind == 'keys') return {
	    value: index,
	    done: false
	  };
	  if (kind == 'values') return {
	    value: target[index],
	    done: false
	  };
	  return {
	    value: [index, target[index]],
	    done: false
	  };
	}, 'values'); // argumentsList[@@iterator] is %ArrayProto_values%
	// https://tc39.github.io/ecma262/#sec-createunmappedargumentsobject
	// https://tc39.github.io/ecma262/#sec-createmappedargumentsobject

	iterators$2.Arguments = iterators$2.Array; // iterable DOM collections
	// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods

	var domIterables$2 = {
	  CSSRuleList: 0,
	  CSSStyleDeclaration: 0,
	  CSSValueList: 0,
	  ClientRectList: 0,
	  DOMRectList: 0,
	  DOMStringList: 0,
	  DOMTokenList: 1,
	  DataTransferItemList: 0,
	  FileList: 0,
	  HTMLAllCollection: 0,
	  HTMLCollection: 0,
	  HTMLFormElement: 0,
	  HTMLSelectElement: 0,
	  MediaList: 0,
	  MimeTypeArray: 0,
	  NamedNodeMap: 0,
	  NodeList: 1,
	  PaintRequestList: 0,
	  Plugin: 0,
	  PluginArray: 0,
	  SVGLengthList: 0,
	  SVGNumberList: 0,
	  SVGPathSegList: 0,
	  SVGPointList: 0,
	  SVGStringList: 0,
	  SVGTransformList: 0,
	  SourceBufferList: 0,
	  StyleSheetList: 0,
	  TextTrackCueList: 0,
	  TextTrackList: 0,
	  TouchList: 0
	};
	var TO_STRING_TAG$3$2 = wellKnownSymbol$2('toStringTag');

	for (var COLLECTION_NAME$2 in domIterables$2) {
	  var Collection$2 = global_1$2[COLLECTION_NAME$2];
	  var CollectionPrototype$2 = Collection$2 && Collection$2.prototype;

	  if (CollectionPrototype$2 && !CollectionPrototype$2[TO_STRING_TAG$3$2]) {
	    createNonEnumerableProperty$2(CollectionPrototype$2, TO_STRING_TAG$3$2, COLLECTION_NAME$2);
	  }

	  iterators$2[COLLECTION_NAME$2] = iterators$2.Array;
	} // `String.prototype.{ codePointAt, at }` methods implementation


	var createMethod$2$2 = function createMethod$2(CONVERT_TO_STRING) {
	  return function ($this, pos) {
	    var S = String(requireObjectCoercible$2($this));
	    var position = toInteger$2(pos);
	    var size = S.length;
	    var first, second;
	    if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
	    first = S.charCodeAt(position);
	    return first < 0xD800 || first > 0xDBFF || position + 1 === size || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF ? CONVERT_TO_STRING ? S.charAt(position) : first : CONVERT_TO_STRING ? slice$3(S).call(S, position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
	  };
	};

	var stringMultibyte$2 = {
	  // `String.prototype.codePointAt` method
	  // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat
	  codeAt: createMethod$2$2(false),
	  // `String.prototype.at` method
	  // https://github.com/mathiasbynens/String.prototype.at
	  charAt: createMethod$2$2(true)
	};
	var charAt$2 = stringMultibyte$2.charAt;
	var STRING_ITERATOR$2 = 'String Iterator';
	var setInternalState$2$2 = internalState$2.set;
	var getInternalState$2$2 = internalState$2.getterFor(STRING_ITERATOR$2); // `String.prototype[@@iterator]` method
	// https://tc39.github.io/ecma262/#sec-string.prototype-@@iterator

	defineIterator$2(String, 'String', function (iterated) {
	  setInternalState$2$2(this, {
	    type: STRING_ITERATOR$2,
	    string: String(iterated),
	    index: 0
	  }); // `%StringIteratorPrototype%.next` method
	  // https://tc39.github.io/ecma262/#sec-%stringiteratorprototype%.next
	}, function next() {
	  var state = getInternalState$2$2(this);
	  var string = state.string;
	  var index = state.index;
	  var point;
	  if (index >= string.length) return {
	    value: undefined,
	    done: true
	  };
	  point = charAt$2(string, index);
	  state.index += point.length;
	  return {
	    value: point,
	    done: false
	  };
	});
	var ITERATOR$2$2 = wellKnownSymbol$2('iterator');

	var getIteratorMethod$2 = function getIteratorMethod(it) {
	  if (it != undefined) return it[ITERATOR$2$2] || it['@@iterator'] || iterators$2[classof$2(it)];
	}; // https://tc39.github.io/ecma262/#sec-object.create


	_export$2({
	  target: 'Object',
	  stat: true,
	  sham: !descriptors$2
	}, {
	  create: objectCreate$2
	});

	var FAILS_ON_PRIMITIVES$1$2 = fails$2(function () {
	  objectKeys$2(1);
	}); // `Object.keys` method
	// https://tc39.github.io/ecma262/#sec-object.keys

	_export$2({
	  target: 'Object',
	  stat: true,
	  forced: FAILS_ON_PRIMITIVES$1$2
	}, {
	  keys: function keys(it) {
	    return objectKeys$2(toObject$2(it));
	  }
	});

	var keys$1$2 = keys$3(path$2.Object);

	var keys$2$2 = keys$1$2;
	var keys$3$2 = keys$2$2; // a string of all valid unicode whitespaces
	// eslint-disable-next-line max-len

	var whitespaces$2 = "\t\n\x0B\f\r \xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF";
	var whitespace$2 = '[' + whitespaces$2 + ']';
	var ltrim$2 = RegExp('^' + whitespace$2 + whitespace$2 + '*');
	var rtrim$2 = RegExp(whitespace$2 + whitespace$2 + '*$'); // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation

	var createMethod$3$2 = function createMethod$3(TYPE) {
	  return function ($this) {
	    var string = String(requireObjectCoercible$2($this));
	    if (TYPE & 1) string = string.replace(ltrim$2, '');
	    if (TYPE & 2) string = string.replace(rtrim$2, '');
	    return string;
	  };
	};

	var stringTrim$2 = {
	  // `String.prototype.{ trimLeft, trimStart }` methods
	  // https://tc39.github.io/ecma262/#sec-string.prototype.trimstart
	  start: createMethod$3$2(1),
	  // `String.prototype.{ trimRight, trimEnd }` methods
	  // https://tc39.github.io/ecma262/#sec-string.prototype.trimend
	  end: createMethod$3$2(2),
	  // `String.prototype.trim` method
	  // https://tc39.github.io/ecma262/#sec-string.prototype.trim
	  trim: createMethod$3$2(3)
	};
	var non$2 = "\u200B\x85\u180E"; // check that a method works with the correct list
	// of whitespaces and has a correct name

	var forcedStringTrimMethod$2 = function forcedStringTrimMethod(METHOD_NAME) {
	  return fails$2(function () {
	    return !!whitespaces$2[METHOD_NAME]() || non$2[METHOD_NAME]() != non$2 || whitespaces$2[METHOD_NAME].name !== METHOD_NAME;
	  });
	};

	var $trim$2 = trim$3(stringTrim$2); // `String.prototype.trim` method
	// https://tc39.github.io/ecma262/#sec-string.prototype.trim


	_export$2({
	  target: 'String',
	  proto: true,
	  forced: forcedStringTrimMethod$2('trim')
	}, {
	  trim: function trim() {
	    return $trim$2(this);
	  }
	});

	var entryVirtual$2 = function entryVirtual(CONSTRUCTOR) {
	  return path$2[CONSTRUCTOR + 'Prototype'];
	};

	var trim$6 = trim$3(entryVirtual$2('String'));

	var sloppyArrayMethod$2 = function sloppyArrayMethod(METHOD_NAME, argument) {
	  var method = [][METHOD_NAME];
	  return !method || !fails$2(function () {
	    // eslint-disable-next-line no-useless-call,no-throw-literal
	    method.call(null, argument || function () {
	      throw 1;
	    }, 1);
	  });
	};

	var $forEach$1$2 = forEach$2(arrayIteration$2); // `Array.prototype.forEach` method implementation
	// https://tc39.github.io/ecma262/#sec-array.prototype.foreach


	var arrayForEach$2 = sloppyArrayMethod$2('forEach') ? function forEach(callbackfn
	/* , thisArg */
	) {
	  return $forEach$1$2(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
	} : forEach$2([]); // `Array.prototype.forEach` method
	// https://tc39.github.io/ecma262/#sec-array.prototype.foreach

	_export$2({
	  target: 'Array',
	  proto: true,
	  forced: forEach$2([]) != arrayForEach$2
	}, {
	  forEach: arrayForEach$2
	});

	var forEach$5 = forEach$2(entryVirtual$2('Array'));

	var forEach$1$2 = forEach$5;
	var ArrayPrototype$h = Array.prototype;
	var DOMIterables$5 = {
	  DOMTokenList: true,
	  NodeList: true
	};

	var forEach_1$2 = function forEach_1(it) {
	  var own = forEach$2(it);

	  return it === ArrayPrototype$h || it instanceof Array && own === forEach$2(ArrayPrototype$h) // eslint-disable-next-line no-prototype-builtins
	  || DOMIterables$5.hasOwnProperty(classof$2(it)) ? forEach$1$2 : own;
	};

	var forEach$2$2 = forEach_1$2;
	var userAgent$2 = getBuiltIn$2('navigator', 'userAgent') || '';
	var process$5 = global_1$2.process;
	var versions$2 = process$5 && process$5.versions;
	var v8$2 = versions$2 && versions$2.v8;
	var match$2, version$2;

	if (v8$2) {
	  match$2 = v8$2.split('.');
	  version$2 = match$2[0] + match$2[1];
	} else if (userAgent$2) {
	  match$2 = userAgent$2.match(/Edge\/(\d+)/);

	  if (!match$2 || match$2[1] >= 74) {
	    match$2 = userAgent$2.match(/Chrome\/(\d+)/);
	    if (match$2) version$2 = match$2[1];
	  }
	}

	var v8Version$2 = version$2 && +version$2;
	var SPECIES$1$2 = wellKnownSymbol$2('species');

	var arrayMethodHasSpeciesSupport$2 = function arrayMethodHasSpeciesSupport(METHOD_NAME) {
	  // We can't use this feature detection in V8 since it causes
	  // deoptimization and serious performance degradation
	  // https://github.com/zloirock/core-js/issues/677
	  return v8Version$2 >= 51 || !fails$2(function () {
	    var array = [];
	    var constructor = array.constructor = {};

	    constructor[SPECIES$1$2] = function () {
	      return {
	        foo: 1
	      };
	    };

	    return array[METHOD_NAME](Boolean).foo !== 1;
	  });
	};

	var $map$2 = map$2(arrayIteration$2); // `Array.prototype.map` method
	// https://tc39.github.io/ecma262/#sec-array.prototype.map
	// with adding support of @@species


	_export$2({
	  target: 'Array',
	  proto: true,
	  forced: !arrayMethodHasSpeciesSupport$2('map')
	}, {
	  map: function map(callbackfn
	  /* , thisArg */
	  ) {
	    return $map$2(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
	  }
	});

	var map$7 = map$2(entryVirtual$2('Array'));

	var trim$3$2 = trim$3(stringTrim$2);

	var nativeParseInt$2 = global_1$2.parseInt;
	var hex$2 = /^[+-]?0[Xx]/;
	var FORCED$1$2 = nativeParseInt$2(whitespaces$2 + '08') !== 8 || nativeParseInt$2(whitespaces$2 + '0x16') !== 22; // `parseInt` method
	// https://tc39.github.io/ecma262/#sec-parseint-string-radix

	var _parseInt$5 = FORCED$1$2 ? function parseInt(string, radix) {
	  var S = trim$3$2(String(string));
	  return nativeParseInt$2(S, radix >>> 0 || (hex$2.test(S) ? 16 : 10));
	} : nativeParseInt$2; // `parseInt` method
	// https://tc39.github.io/ecma262/#sec-parseint-string-radix


	_export$2({
	  global: true,
	  forced: _parseInt$3 != _parseInt$5
	}, {
	  parseInt: _parseInt$5
	});

	var _parseInt$1$2 = path$2.parseInt;
	var _parseInt$2$2 = _parseInt$1$2;
	var _parseInt$3$2 = _parseInt$2$2;
	var propertyIsEnumerable$1 = objectPropertyIsEnumerable$2.f; // `Object.{ entries, values }` methods implementation

	var createMethod$4$2 = function createMethod$4(TO_ENTRIES) {
	  return function (it) {
	    var O = toIndexedObject$2(it);
	    var keys = objectKeys$2(O);
	    var length = keys.length;
	    var i = 0;
	    var result = [];
	    var key;

	    while (length > i) {
	      key = keys[i++];

	      if (!descriptors$2 || propertyIsEnumerable$1.call(O, key)) {
	        result.push(TO_ENTRIES ? [key, O[key]] : O[key]);
	      }
	    }

	    return result;
	  };
	};

	var objectToArray$1 = {
	  // `Object.entries` method
	  // https://tc39.github.io/ecma262/#sec-object.entries
	  entries: createMethod$4$2(true),
	  // `Object.values` method
	  // https://tc39.github.io/ecma262/#sec-object.values
	  values: createMethod$4$2(false)
	};

	var $values$1 = values$2(objectToArray$1); // `Object.values` method
	// https://tc39.github.io/ecma262/#sec-object.values


	_export$2({
	  target: 'Object',
	  stat: true
	}, {
	  values: function values(O) {
	    return $values$1(O);
	  }
	});

	var values$4 = values$2(path$2.Object);

	var $filter$2 = filter$2(arrayIteration$2); // `Array.prototype.filter` method
	// https://tc39.github.io/ecma262/#sec-array.prototype.filter
	// with adding support of @@species


	_export$2({
	  target: 'Array',
	  proto: true,
	  forced: !arrayMethodHasSpeciesSupport$2('filter')
	}, {
	  filter: function filter(callbackfn
	  /* , thisArg */
	  ) {
	    return $filter$2(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
	  }
	});

	var filter$4 = filter$2(entryVirtual$2('Array'));

	var IS_CONCAT_SPREADABLE$2 = wellKnownSymbol$2('isConcatSpreadable');
	var MAX_SAFE_INTEGER$3 = 0x1FFFFFFFFFFFFF;
	var MAXIMUM_ALLOWED_INDEX_EXCEEDED$2 = 'Maximum allowed index exceeded'; // We can't use this feature detection in V8 since it causes
	// deoptimization and serious performance degradation
	// https://github.com/zloirock/core-js/issues/679

	var IS_CONCAT_SPREADABLE_SUPPORT$2 = v8Version$2 >= 51 || !fails$2(function () {
	  var array = [];
	  array[IS_CONCAT_SPREADABLE$2] = false;
	  return concat$2(array).call(array)[0] !== array;
	});
	var SPECIES_SUPPORT$2 = arrayMethodHasSpeciesSupport$2('concat');

	var isConcatSpreadable$2 = function isConcatSpreadable(O) {
	  if (!isObject$2(O)) return false;
	  var spreadable = O[IS_CONCAT_SPREADABLE$2];
	  return spreadable !== undefined ? !!spreadable : isArray$6(O);
	};

	var FORCED$2$2 = !IS_CONCAT_SPREADABLE_SUPPORT$2 || !SPECIES_SUPPORT$2; // `Array.prototype.concat` method
	// https://tc39.github.io/ecma262/#sec-array.prototype.concat
	// with adding support of @@isConcatSpreadable and @@species

	_export$2({
	  target: 'Array',
	  proto: true,
	  forced: FORCED$2$2
	}, {
	  concat: function concat(arg) {
	    // eslint-disable-line no-unused-vars
	    var O = toObject$2(this);
	    var A = arraySpeciesCreate$2(O, 0);
	    var n = 0;
	    var i, k, length, len, E;

	    for (i = -1, length = arguments.length; i < length; i++) {
	      E = i === -1 ? O : arguments[i];

	      if (isConcatSpreadable$2(E)) {
	        len = toLength$2(E.length);
	        if (n + len > MAX_SAFE_INTEGER$3) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED$2);

	        for (k = 0; k < len; k++, n++) {
	          if (k in E) createProperty$2(A, n, E[k]);
	        }
	      } else {
	        if (n >= MAX_SAFE_INTEGER$3) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED$2);
	        createProperty$2(A, n++, E);
	      }
	    }

	    A.length = n;
	    return A;
	  }
	});

	var concat$4 = concat$2(entryVirtual$2('Array'));

	var ArrayPrototype$3$2 = Array.prototype;

	var concat_1$2 = function concat_1(it) {
	  var own = concat$2(it);

	  return it === ArrayPrototype$3$2 || it instanceof Array && own === concat$2(ArrayPrototype$3$2) ? concat$4 : own;
	};

	var concat$1$2 = concat_1$2;
	var concat$2$2 = concat$1$2; // `Array.isArray` method
	// https://tc39.github.io/ecma262/#sec-array.isarray

	_export$2({
	  target: 'Array',
	  stat: true
	}, {
	  isArray: isArray$6
	});

	var isArray$1$2 = path$2.Array.isArray;

	var callWithSafeIterationClosing$2 = function callWithSafeIterationClosing(iterator, fn, value, ENTRIES) {
	  try {
	    return ENTRIES ? fn(anObject$2(value)[0], value[1]) : fn(value); // 7.4.6 IteratorClose(iterator, completion)
	  } catch (error) {
	    var returnMethod = iterator['return'];
	    if (returnMethod !== undefined) anObject$2(returnMethod.call(iterator));
	    throw error;
	  }
	};

	var ITERATOR$3$2 = wellKnownSymbol$2('iterator');
	var ArrayPrototype$4$2 = Array.prototype; // check on default Array iterator

	var isArrayIteratorMethod$2 = function isArrayIteratorMethod(it) {
	  return it !== undefined && (iterators$2.Array === it || ArrayPrototype$4$2[ITERATOR$3$2] === it);
	}; // `Array.from` method implementation
	// https://tc39.github.io/ecma262/#sec-array.from


	var arrayFrom$2 = function from(arrayLike
	/* , mapfn = undefined, thisArg = undefined */
	) {
	  var O = toObject$2(arrayLike);
	  var C = typeof this == 'function' ? this : Array;
	  var argumentsLength = arguments.length;
	  var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
	  var mapping = mapfn !== undefined;
	  var index = 0;
	  var iteratorMethod = getIteratorMethod$2(O);
	  var length, result, step, iterator, next;
	  if (mapping) mapfn = bindContext$2(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2); // if the target is not iterable or it's an array with the default iterator - use a simple case

	  if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod$2(iteratorMethod))) {
	    iterator = iteratorMethod.call(O);
	    next = iterator.next;
	    result = new C();

	    for (; !(step = next.call(iterator)).done; index++) {
	      createProperty$2(result, index, mapping ? callWithSafeIterationClosing$2(iterator, mapfn, [step.value, index], true) : step.value);
	    }
	  } else {
	    length = toLength$2(O.length);
	    result = new C(length);

	    for (; length > index; index++) {
	      createProperty$2(result, index, mapping ? mapfn(O[index], index) : O[index]);
	    }
	  }

	  result.length = index;
	  return result;
	};

	var ITERATOR$4$2 = wellKnownSymbol$2('iterator');
	var SAFE_CLOSING$2 = false;

	try {
	  var called$2 = 0;
	  var iteratorWithReturn$2 = {
	    next: function next() {
	      return {
	        done: !!called$2++
	      };
	    },
	    'return': function _return() {
	      SAFE_CLOSING$2 = true;
	    }
	  };

	  iteratorWithReturn$2[ITERATOR$4$2] = function () {
	    return this;
	  }; // eslint-disable-next-line no-throw-literal


	  from_1$2(iteratorWithReturn$2, function () {
	    throw 2;
	  });
	} catch (error) {
	  /* empty */
	}

	var checkCorrectnessOfIteration$2 = function checkCorrectnessOfIteration(exec, SKIP_CLOSING) {
	  if (!SKIP_CLOSING && !SAFE_CLOSING$2) return false;
	  var ITERATION_SUPPORT = false;

	  try {
	    var object = {};

	    object[ITERATOR$4$2] = function () {
	      return {
	        next: function next() {
	          return {
	            done: ITERATION_SUPPORT = true
	          };
	        }
	      };
	    };

	    exec(object);
	  } catch (error) {
	    /* empty */
	  }

	  return ITERATION_SUPPORT;
	};

	var INCORRECT_ITERATION$3 = !checkCorrectnessOfIteration$2(function (iterable) {
	  from_1$2(iterable);
	}); // `Array.from` method
	// https://tc39.github.io/ecma262/#sec-array.from

	_export$2({
	  target: 'Array',
	  stat: true,
	  forced: INCORRECT_ITERATION$3
	}, {
	  from: arrayFrom$2
	});

	var from_1$4 = path$2.Array.from;
	var ITERATOR$5$2 = wellKnownSymbol$2('iterator');
	var SPECIES$2$2 = wellKnownSymbol$2('species');

	var nativeSlice$2 = slice$3([]);

	var max$1$2 = Math.max; // `Array.prototype.slice` method
	// https://tc39.github.io/ecma262/#sec-array.prototype.slice
	// fallback for not array-like ES3 strings and DOM objects

	_export$2({
	  target: 'Array',
	  proto: true,
	  forced: !arrayMethodHasSpeciesSupport$2('slice')
	}, {
	  slice: function slice(start, end) {
	    var O = toIndexedObject$2(this);
	    var length = toLength$2(O.length);
	    var k = toAbsoluteIndex$2(start, length);
	    var fin = toAbsoluteIndex$2(end === undefined ? length : end, length); // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible

	    var Constructor, result, n;

	    if (isArray$6(O)) {
	      Constructor = O.constructor; // cross-realm fallback

	      if (typeof Constructor == 'function' && (Constructor === Array || isArray$6(Constructor.prototype))) {
	        Constructor = undefined;
	      } else if (isObject$2(Constructor)) {
	        Constructor = Constructor[SPECIES$2$2];
	        if (Constructor === null) Constructor = undefined;
	      }

	      if (Constructor === Array || Constructor === undefined) {
	        return nativeSlice$2.call(O, k, fin);
	      }
	    }

	    result = new (Constructor === undefined ? Array : Constructor)(max$1$2(fin - k, 0));

	    for (n = 0; k < fin; k++, n++) {
	      if (k in O) createProperty$2(result, n, O[k]);
	    }

	    result.length = n;
	    return result;
	  }
	});

	var slice$6 = slice$3(entryVirtual$2('Array'));

	var ArrayPrototype$5$2 = Array.prototype;

	var slice_1$2 = function slice_1(it) {
	  var own = slice$3(it);

	  return it === ArrayPrototype$5$2 || it instanceof Array && own === slice$3(ArrayPrototype$5$2) ? slice$6 : own;
	};

	var slice$1$2 = slice_1$2;
	var slice$2$2 = slice$1$2;
	var FAILS_ON_PRIMITIVES$2$2 = fails$2(function () {
	  objectGetPrototypeOf$2(1);
	}); // `Object.getPrototypeOf` method
	// https://tc39.github.io/ecma262/#sec-object.getprototypeof

	_export$2({
	  target: 'Object',
	  stat: true,
	  forced: FAILS_ON_PRIMITIVES$2$2,
	  sham: !correctPrototypeGetter$2
	}, {
	  getPrototypeOf: function getPrototypeOf(it) {
	    return objectGetPrototypeOf$2(toObject$2(it));
	  }
	});

	var getPrototypeOf$1$2 = path$2.Object.getPrototypeOf;
	var getPrototypeOf$1$1$1 = getPrototypeOf$1$2;
	var getPrototypeOf$2$2 = getPrototypeOf$1$1$1;

	var $indexOf$2 = indexOf$3(arrayIncludes$2);

	var nativeIndexOf$2 = indexOf$3([]);

	var NEGATIVE_ZERO$2 = !!nativeIndexOf$2 && 1 / indexOf$3(_context12 = [1]).call(_context12, 1, -0) < 0;
	var SLOPPY_METHOD$3 = sloppyArrayMethod$2('indexOf'); // `Array.prototype.indexOf` method
	// https://tc39.github.io/ecma262/#sec-array.prototype.indexof

	_export$2({
	  target: 'Array',
	  proto: true,
	  forced: NEGATIVE_ZERO$2 || SLOPPY_METHOD$3
	}, {
	  indexOf: function indexOf(searchElement
	  /* , fromIndex = 0 */
	  ) {
	    return NEGATIVE_ZERO$2 // convert -0 to +0
	    ? nativeIndexOf$2.apply(this, arguments) || 0 : $indexOf$2(this, searchElement, arguments.length > 1 ? arguments[1] : undefined);
	  }
	});

	var indexOf$1$2 = indexOf$3(entryVirtual$2('Array'));

	var ArrayPrototype$6$2 = Array.prototype;

	var indexOf_1$2 = function indexOf_1(it) {
	  var own = indexOf$3(it);

	  return it === ArrayPrototype$6$2 || it instanceof Array && own === indexOf$3(ArrayPrototype$6$2) ? indexOf$1$2 : own;
	};

	var indexOf$2$2 = indexOf_1$2;
	var indexOf$3$2 = indexOf$2$2;
	var isArray$4$2 = isArray$1$2;
	var isArray$5$1 = isArray$4$2;
	var nativeAssign$2 = assign$2; // `Object.assign` method
	// https://tc39.github.io/ecma262/#sec-object.assign
	// should work with symbols and should have deterministic property order (V8 bug)

	var objectAssign$2 = !nativeAssign$2 || fails$2(function () {
	  var _context13;

	  var A = {};
	  var B = {}; // eslint-disable-next-line no-undef

	  var symbol = symbol$2();

	  var alphabet = 'abcdefghijklmnopqrst';
	  A[symbol] = 7;

	  forEach$2(_context13 = alphabet.split('')).call(_context13, function (chr) {
	    B[chr] = chr;
	  });

	  return nativeAssign$2({}, A)[symbol] != 7 || objectKeys$2(nativeAssign$2({}, B)).join('') != alphabet;
	}) ? function assign(target, source) {
	  // eslint-disable-line no-unused-vars
	  var T = toObject$2(target);
	  var argumentsLength = arguments.length;
	  var index = 1;
	  var getOwnPropertySymbols = objectGetOwnPropertySymbols$2.f;
	  var propertyIsEnumerable = objectPropertyIsEnumerable$2.f;

	  while (argumentsLength > index) {
	    var _context14;

	    var S = indexedObject$2(arguments[index++]);
	    var keys = getOwnPropertySymbols ? concat$2(_context14 = objectKeys$2(S)).call(_context14, getOwnPropertySymbols(S)) : objectKeys$2(S);
	    var length = keys.length;
	    var j = 0;
	    var key;

	    while (length > j) {
	      key = keys[j++];
	      if (!descriptors$2 || propertyIsEnumerable.call(S, key)) T[key] = S[key];
	    }
	  }

	  return T;
	} : nativeAssign$2; // `Object.assign` method
	// https://tc39.github.io/ecma262/#sec-object.assign

	_export$2({
	  target: 'Object',
	  stat: true,
	  forced: assign$2 !== objectAssign$2
	}, {
	  assign: objectAssign$2
	});

	var assign$5 = path$2.Object.assign; // https://tc39.github.io/ecma262/#sec-symbol.iterator

	defineWellKnownSymbol$2('iterator');
	var iterator$6 = wrappedWellKnownSymbol$2.f('iterator');
	var iterator$1$2 = iterator$6;
	var iterator$2$2 = iterator$1$2; // `Symbol.asyncIterator` well-known symbol
	// https://tc39.github.io/ecma262/#sec-symbol.asynciterator

	defineWellKnownSymbol$2('asyncIterator'); // `Symbol.hasInstance` well-known symbol
	// https://tc39.github.io/ecma262/#sec-symbol.hasinstance

	defineWellKnownSymbol$2('hasInstance'); // `Symbol.isConcatSpreadable` well-known symbol
	// https://tc39.github.io/ecma262/#sec-symbol.isconcatspreadable

	defineWellKnownSymbol$2('isConcatSpreadable'); // `Symbol.match` well-known symbol
	// https://tc39.github.io/ecma262/#sec-symbol.match

	defineWellKnownSymbol$2('match'); // `Symbol.matchAll` well-known symbol

	defineWellKnownSymbol$2('matchAll'); // `Symbol.replace` well-known symbol
	// https://tc39.github.io/ecma262/#sec-symbol.replace

	defineWellKnownSymbol$2('replace'); // `Symbol.search` well-known symbol
	// https://tc39.github.io/ecma262/#sec-symbol.search

	defineWellKnownSymbol$2('search'); // `Symbol.species` well-known symbol
	// https://tc39.github.io/ecma262/#sec-symbol.species

	defineWellKnownSymbol$2('species'); // `Symbol.split` well-known symbol
	// https://tc39.github.io/ecma262/#sec-symbol.split

	defineWellKnownSymbol$2('split'); // `Symbol.toPrimitive` well-known symbol
	// https://tc39.github.io/ecma262/#sec-symbol.toprimitive

	defineWellKnownSymbol$2('toPrimitive'); // `Symbol.toStringTag` well-known symbol
	// https://tc39.github.io/ecma262/#sec-symbol.tostringtag

	defineWellKnownSymbol$2('toStringTag'); // `Symbol.unscopables` well-known symbol
	// https://tc39.github.io/ecma262/#sec-symbol.unscopables

	defineWellKnownSymbol$2('unscopables'); // Math[@@toStringTag] property
	// https://tc39.github.io/ecma262/#sec-math-@@tostringtag

	setToStringTag$2(Math, 'Math', true); // JSON[@@toStringTag] property
	// https://tc39.github.io/ecma262/#sec-json-@@tostringtag

	setToStringTag$2(global_1$2.JSON, 'JSON', true);
	var symbol$6 = path$2.Symbol; // `Symbol.asyncDispose` well-known symbol
	// https://github.com/tc39/proposal-using-statement

	defineWellKnownSymbol$2('asyncDispose'); // `Symbol.dispose` well-known symbol
	// https://github.com/tc39/proposal-using-statement

	defineWellKnownSymbol$2('dispose'); // `Symbol.observable` well-known symbol
	// https://github.com/tc39/proposal-observable

	defineWellKnownSymbol$2('observable'); // `Symbol.patternMatch` well-known symbol
	// https://github.com/tc39/proposal-pattern-matching

	defineWellKnownSymbol$2('patternMatch'); // TODO: remove from `core-js@4`

	defineWellKnownSymbol$2('replaceAll');
	var symbol$1$2 = symbol$6;
	var symbol$2$2 = symbol$1$2;

	var _typeof_1$1$1 = createCommonjsModule$1$1(function (module) {
	  function _typeof2(obj) {
	    if (typeof symbol$2$2 === "function" && _typeof_1(iterator$2$2) === "symbol") {
	      _typeof2 = function _typeof2(obj) {
	        return _typeof_1(obj);
	      };
	    } else {
	      _typeof2 = function _typeof2(obj) {
	        return obj && typeof symbol$2$2 === "function" && obj.constructor === symbol$2$2 && obj !== symbol$2$2.prototype ? "symbol" : _typeof_1(obj);
	      };
	    }

	    return _typeof2(obj);
	  }

	  function _typeof(obj) {
	    if (typeof symbol$2$2 === "function" && _typeof2(iterator$2$2) === "symbol") {
	      module.exports = _typeof = function _typeof(obj) {
	        return _typeof2(obj);
	      };
	    } else {
	      module.exports = _typeof = function _typeof(obj) {
	        return obj && typeof symbol$2$2 === "function" && obj.constructor === symbol$2$2 && obj !== symbol$2$2.prototype ? "symbol" : _typeof2(obj);
	      };
	    }

	    return _typeof(obj);
	  }

	  module.exports = _typeof;
	});

	var trim$4$1 = trim$3(stringTrim$2);

	var nativeParseFloat$1 = global_1$2.parseFloat;
	var FORCED$3$1 = 1 / nativeParseFloat$1(whitespaces$2 + '-0') !== -Infinity; // `parseFloat` method
	// https://tc39.github.io/ecma262/#sec-parsefloat-string

	var _parseFloat$4 = FORCED$3$1 ? function parseFloat(string) {
	  var trimmedString = trim$4$1(String(string));
	  var result = nativeParseFloat$1(trimmedString);
	  return result === 0 && trimmedString.charAt(0) == '-' ? -0 : result;
	} : nativeParseFloat$1; // `parseFloat` method
	// https://tc39.github.io/ecma262/#sec-parsefloat-string


	_export$2({
	  global: true,
	  forced: _parseFloat$3 != _parseFloat$4
	}, {
	  parseFloat: _parseFloat$4
	});

	var _parseFloat$1$1 = path$2.parseFloat;
	var _parseFloat$2$1 = _parseFloat$1$1;
	var _parseFloat$3$1 = _parseFloat$2$1; // `Date.now` method
	// https://tc39.github.io/ecma262/#sec-date.now

	_export$2({
	  target: 'Date',
	  stat: true
	}, {
	  now: function now() {
	    return new Date().getTime();
	  }
	});

	var now$4 = path$2.Date.now;
	var now$1$1 = now$4;
	var now$2$1 = now$1$1;

	var nativeSort$1 = sort$2([]);

	var test$1$1 = [1, 2, 3]; // IE8-

	var FAILS_ON_UNDEFINED$1 = fails$2(function () {
	  sort$2(test$1$1).call(test$1$1, undefined);
	}); // V8 bug

	var FAILS_ON_NULL$1 = fails$2(function () {
	  sort$2(test$1$1).call(test$1$1, null);
	}); // Old WebKit

	var SLOPPY_METHOD$1$1 = sloppyArrayMethod$2('sort');
	var FORCED$4$1 = FAILS_ON_UNDEFINED$1 || !FAILS_ON_NULL$1 || SLOPPY_METHOD$1$1; // `Array.prototype.sort` method
	// https://tc39.github.io/ecma262/#sec-array.prototype.sort

	_export$2({
	  target: 'Array',
	  proto: true,
	  forced: FORCED$4$1
	}, {
	  sort: function sort(comparefn) {
	    return comparefn === undefined ? nativeSort$1.call(toObject$2(this)) : nativeSort$1.call(toObject$2(this), aFunction$3(comparefn));
	  }
	});

	var sort$3 = sort$2(entryVirtual$2('Array'));

	var ArrayPrototype$7$1 = Array.prototype;

	var sort_1$1 = function sort_1(it) {
	  var own = sort$2(it);

	  return it === ArrayPrototype$7$1 || it instanceof Array && own === sort$2(ArrayPrototype$7$1) ? sort$3 : own;
	};

	var sort$1$1 = sort_1$1;
	var sort$2$1 = sort$1$1;
	var nativeIsFrozen$1 = isFrozen$2;
	var FAILS_ON_PRIMITIVES$3$1 = fails$2(function () {
	  nativeIsFrozen$1(1);
	}); // `Object.isFrozen` method
	// https://tc39.github.io/ecma262/#sec-object.isfrozen

	_export$2({
	  target: 'Object',
	  stat: true,
	  forced: FAILS_ON_PRIMITIVES$3$1
	}, {
	  isFrozen: function isFrozen(it) {
	    return isObject$2(it) ? nativeIsFrozen$1 ? nativeIsFrozen$1(it) : false : true;
	  }
	});

	var isFrozen$3 = path$2.Object.isFrozen;
	var isFrozen$1$1 = isFrozen$3;
	var isFrozen$2$1 = isFrozen$1$1;

	var $some$1 = some$2(arrayIteration$2); // `Array.prototype.some` method
	// https://tc39.github.io/ecma262/#sec-array.prototype.some


	_export$2({
	  target: 'Array',
	  proto: true,
	  forced: sloppyArrayMethod$2('some')
	}, {
	  some: function some(callbackfn
	  /* , thisArg */
	  ) {
	    return $some$1(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
	  }
	});

	var some$3 = some$2(entryVirtual$2('Array'));

	var ArrayPrototype$8$1 = Array.prototype;

	var some_1$1 = function some_1(it) {
	  var own = some$2(it);

	  return it === ArrayPrototype$8$1 || it instanceof Array && own === some$2(ArrayPrototype$8$1) ? some$3 : own;
	};

	var some$1$1 = some_1$1;
	var some$2$1 = some$1$1;
	var nativeGetOwnPropertyNames$2$1 = objectGetOwnPropertyNamesExternal$2.f;
	var FAILS_ON_PRIMITIVES$4$1 = fails$2(function () {
	  return !getOwnPropertyNames$2(1);
	}); // `Object.getOwnPropertyNames` method
	// https://tc39.github.io/ecma262/#sec-object.getownpropertynames

	_export$2({
	  target: 'Object',
	  stat: true,
	  forced: FAILS_ON_PRIMITIVES$4$1
	}, {
	  getOwnPropertyNames: nativeGetOwnPropertyNames$2$1
	});

	var Object$2$1 = path$2.Object;

	var getOwnPropertyNames$3 = function getOwnPropertyNames(it) {
	  return Object$2$1.getOwnPropertyNames(it);
	};

	var getOwnPropertyNames$1$1 = getOwnPropertyNames$3;
	var getOwnPropertyNames$2$1 = getOwnPropertyNames$1$1;
	var moment = createCommonjsModule$1$1(function (module, exports) {
	  (function (global, factory) {
	    module.exports = factory();
	  })(commonjsGlobal$2, function () {
	    var hookCallback;

	    function hooks() {
	      return hookCallback.apply(null, arguments);
	    } // This is done to register the method called with moment()
	    // without creating circular dependencies.


	    function setHookCallback(callback) {
	      hookCallback = callback;
	    }

	    function isArray(input) {
	      return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]';
	    }

	    function isObject(input) {
	      // IE8 will treat undefined and null as object if it wasn't for
	      // input != null
	      return input != null && Object.prototype.toString.call(input) === '[object Object]';
	    }

	    function isObjectEmpty(obj) {
	      if (getOwnPropertyNames$2$1) {
	        return getOwnPropertyNames$2$1(obj).length === 0;
	      } else {
	        var k;

	        for (k in obj) {
	          if (obj.hasOwnProperty(k)) {
	            return false;
	          }
	        }

	        return true;
	      }
	    }

	    function isUndefined(input) {
	      return input === void 0;
	    }

	    function isNumber(input) {
	      return typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]';
	    }

	    function isDate(input) {
	      return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]';
	    }

	    function map(arr, fn) {
	      var res = [],
	          i;

	      for (i = 0; i < arr.length; ++i) {
	        res.push(fn(arr[i], i));
	      }

	      return res;
	    }

	    function hasOwnProp(a, b) {
	      return Object.prototype.hasOwnProperty.call(a, b);
	    }

	    function extend(a, b) {
	      for (var i in b) {
	        if (hasOwnProp(b, i)) {
	          a[i] = b[i];
	        }
	      }

	      if (hasOwnProp(b, 'toString')) {
	        a.toString = b.toString;
	      }

	      if (hasOwnProp(b, 'valueOf')) {
	        a.valueOf = b.valueOf;
	      }

	      return a;
	    }

	    function createUTC(input, format, locale, strict) {
	      return createLocalOrUTC(input, format, locale, strict, true).utc();
	    }

	    function defaultParsingFlags() {
	      // We need to deep clone this object.
	      return {
	        empty: false,
	        unusedTokens: [],
	        unusedInput: [],
	        overflow: -2,
	        charsLeftOver: 0,
	        nullInput: false,
	        invalidMonth: null,
	        invalidFormat: false,
	        userInvalidated: false,
	        iso: false,
	        parsedDateParts: [],
	        meridiem: null,
	        rfc2822: false,
	        weekdayMismatch: false
	      };
	    }

	    function getParsingFlags(m) {
	      if (m._pf == null) {
	        m._pf = defaultParsingFlags();
	      }

	      return m._pf;
	    }

	    var some;

	    if (some$2$1(Array.prototype)) {
	      some = some$2$1(Array.prototype);
	    } else {
	      some = function some(fun) {
	        var t = Object(this);
	        var len = t.length >>> 0;

	        for (var i = 0; i < len; i++) {
	          if (i in t && fun.call(this, t[i], i, t)) {
	            return true;
	          }
	        }

	        return false;
	      };
	    }

	    function isValid(m) {
	      if (m._isValid == null) {
	        var flags = getParsingFlags(m);
	        var parsedParts = some.call(flags.parsedDateParts, function (i) {
	          return i != null;
	        });
	        var isNowValid = !isNaN(m._d.getTime()) && flags.overflow < 0 && !flags.empty && !flags.invalidMonth && !flags.invalidWeekday && !flags.weekdayMismatch && !flags.nullInput && !flags.invalidFormat && !flags.userInvalidated && (!flags.meridiem || flags.meridiem && parsedParts);

	        if (m._strict) {
	          isNowValid = isNowValid && flags.charsLeftOver === 0 && flags.unusedTokens.length === 0 && flags.bigHour === undefined;
	        }

	        if (isFrozen$2$1 == null || !isFrozen$2$1(m)) {
	          m._isValid = isNowValid;
	        } else {
	          return isNowValid;
	        }
	      }

	      return m._isValid;
	    }

	    function createInvalid(flags) {
	      var m = createUTC(NaN);

	      if (flags != null) {
	        extend(getParsingFlags(m), flags);
	      } else {
	        getParsingFlags(m).userInvalidated = true;
	      }

	      return m;
	    } // Plugins that add properties should also add the key here (null value),
	    // so we can properly clone ourselves.


	    var momentProperties = hooks.momentProperties = [];

	    function copyConfig(to, from) {
	      var i, prop, val;

	      if (!isUndefined(from._isAMomentObject)) {
	        to._isAMomentObject = from._isAMomentObject;
	      }

	      if (!isUndefined(from._i)) {
	        to._i = from._i;
	      }

	      if (!isUndefined(from._f)) {
	        to._f = from._f;
	      }

	      if (!isUndefined(from._l)) {
	        to._l = from._l;
	      }

	      if (!isUndefined(from._strict)) {
	        to._strict = from._strict;
	      }

	      if (!isUndefined(from._tzm)) {
	        to._tzm = from._tzm;
	      }

	      if (!isUndefined(from._isUTC)) {
	        to._isUTC = from._isUTC;
	      }

	      if (!isUndefined(from._offset)) {
	        to._offset = from._offset;
	      }

	      if (!isUndefined(from._pf)) {
	        to._pf = getParsingFlags(from);
	      }

	      if (!isUndefined(from._locale)) {
	        to._locale = from._locale;
	      }

	      if (momentProperties.length > 0) {
	        for (i = 0; i < momentProperties.length; i++) {
	          prop = momentProperties[i];
	          val = from[prop];

	          if (!isUndefined(val)) {
	            to[prop] = val;
	          }
	        }
	      }

	      return to;
	    }

	    var updateInProgress = false; // Moment prototype object

	    function Moment(config) {
	      copyConfig(this, config);
	      this._d = new Date(config._d != null ? config._d.getTime() : NaN);

	      if (!this.isValid()) {
	        this._d = new Date(NaN);
	      } // Prevent infinite loop in case updateOffset creates new moment
	      // objects.


	      if (updateInProgress === false) {
	        updateInProgress = true;
	        hooks.updateOffset(this);
	        updateInProgress = false;
	      }
	    }

	    function isMoment(obj) {
	      return obj instanceof Moment || obj != null && obj._isAMomentObject != null;
	    }

	    function absFloor(number) {
	      if (number < 0) {
	        // -0 -> 0
	        return Math.ceil(number) || 0;
	      } else {
	        return Math.floor(number);
	      }
	    }

	    function toInt(argumentForCoercion) {
	      var coercedNumber = +argumentForCoercion,
	          value = 0;

	      if (coercedNumber !== 0 && isFinite(coercedNumber)) {
	        value = absFloor(coercedNumber);
	      }

	      return value;
	    } // compare two arrays, return the number of differences


	    function compareArrays(array1, array2, dontConvert) {
	      var len = Math.min(array1.length, array2.length),
	          lengthDiff = Math.abs(array1.length - array2.length),
	          diffs = 0,
	          i;

	      for (i = 0; i < len; i++) {
	        if (dontConvert && array1[i] !== array2[i] || !dontConvert && toInt(array1[i]) !== toInt(array2[i])) {
	          diffs++;
	        }
	      }

	      return diffs + lengthDiff;
	    }

	    function warn(msg) {
	      if (hooks.suppressDeprecationWarnings === false && typeof console !== 'undefined' && console.warn) {
	        console.warn('Deprecation warning: ' + msg);
	      }
	    }

	    function deprecate(msg, fn) {
	      var firstTime = true;
	      return extend(function () {
	        if (hooks.deprecationHandler != null) {
	          hooks.deprecationHandler(null, msg);
	        }

	        if (firstTime) {
	          var args = [];
	          var arg;

	          for (var i = 0; i < arguments.length; i++) {
	            arg = '';

	            if (_typeof_1$1$1(arguments[i]) === 'object') {
	              arg += '\n[' + i + '] ';

	              for (var key in arguments[0]) {
	                arg += key + ': ' + arguments[0][key] + ', ';
	              }

	              arg = slice$2$2(arg).call(arg, 0, -2); // Remove trailing comma and space
	            } else {
	              arg = arguments[i];
	            }

	            args.push(arg);
	          }

	          warn(msg + '\nArguments: ' + slice$2$2(Array.prototype).call(args).join('') + '\n' + new Error().stack);
	          firstTime = false;
	        }

	        return fn.apply(this, arguments);
	      }, fn);
	    }

	    var deprecations = {};

	    function deprecateSimple(name, msg) {
	      if (hooks.deprecationHandler != null) {
	        hooks.deprecationHandler(name, msg);
	      }

	      if (!deprecations[name]) {
	        warn(msg);
	        deprecations[name] = true;
	      }
	    }

	    hooks.suppressDeprecationWarnings = false;
	    hooks.deprecationHandler = null;

	    function isFunction(input) {
	      return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]';
	    }

	    function set(config) {
	      var prop, i;

	      for (i in config) {
	        prop = config[i];

	        if (isFunction(prop)) {
	          this[i] = prop;
	        } else {
	          this['_' + i] = prop;
	        }
	      }

	      this._config = config; // Lenient ordinal parsing accepts just a number in addition to
	      // number + (possibly) stuff coming from _dayOfMonthOrdinalParse.
	      // TODO: Remove "ordinalParse" fallback in next major release.

	      this._dayOfMonthOrdinalParseLenient = new RegExp((this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + '|' + /\d{1,2}/.source);
	    }

	    function mergeConfigs(parentConfig, childConfig) {
	      var res = extend({}, parentConfig),
	          prop;

	      for (prop in childConfig) {
	        if (hasOwnProp(childConfig, prop)) {
	          if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
	            res[prop] = {};
	            extend(res[prop], parentConfig[prop]);
	            extend(res[prop], childConfig[prop]);
	          } else if (childConfig[prop] != null) {
	            res[prop] = childConfig[prop];
	          } else {
	            delete res[prop];
	          }
	        }
	      }

	      for (prop in parentConfig) {
	        if (hasOwnProp(parentConfig, prop) && !hasOwnProp(childConfig, prop) && isObject(parentConfig[prop])) {
	          // make sure changes to properties don't modify parent config
	          res[prop] = extend({}, res[prop]);
	        }
	      }

	      return res;
	    }

	    function Locale(config) {
	      if (config != null) {
	        this.set(config);
	      }
	    }

	    var keys;

	    if (keys$3$2) {
	      keys = keys$3$2;
	    } else {
	      keys = function keys(obj) {
	        var i,
	            res = [];

	        for (i in obj) {
	          if (hasOwnProp(obj, i)) {
	            res.push(i);
	          }
	        }

	        return res;
	      };
	    }

	    var defaultCalendar = {
	      sameDay: '[Today at] LT',
	      nextDay: '[Tomorrow at] LT',
	      nextWeek: 'dddd [at] LT',
	      lastDay: '[Yesterday at] LT',
	      lastWeek: '[Last] dddd [at] LT',
	      sameElse: 'L'
	    };

	    function calendar(key, mom, now) {
	      var output = this._calendar[key] || this._calendar['sameElse'];
	      return isFunction(output) ? output.call(mom, now) : output;
	    }

	    var defaultLongDateFormat = {
	      LTS: 'h:mm:ss A',
	      LT: 'h:mm A',
	      L: 'MM/DD/YYYY',
	      LL: 'MMMM D, YYYY',
	      LLL: 'MMMM D, YYYY h:mm A',
	      LLLL: 'dddd, MMMM D, YYYY h:mm A'
	    };

	    function longDateFormat(key) {
	      var format = this._longDateFormat[key],
	          formatUpper = this._longDateFormat[key.toUpperCase()];

	      if (format || !formatUpper) {
	        return format;
	      }

	      this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) {
	        return slice$2$2(val).call(val, 1);
	      });
	      return this._longDateFormat[key];
	    }

	    var defaultInvalidDate = 'Invalid date';

	    function invalidDate() {
	      return this._invalidDate;
	    }

	    var defaultOrdinal = '%d';
	    var defaultDayOfMonthOrdinalParse = /\d{1,2}/;

	    function ordinal(number) {
	      return this._ordinal.replace('%d', number);
	    }

	    var defaultRelativeTime = {
	      future: 'in %s',
	      past: '%s ago',
	      s: 'a few seconds',
	      ss: '%d seconds',
	      m: 'a minute',
	      mm: '%d minutes',
	      h: 'an hour',
	      hh: '%d hours',
	      d: 'a day',
	      dd: '%d days',
	      M: 'a month',
	      MM: '%d months',
	      y: 'a year',
	      yy: '%d years'
	    };

	    function relativeTime(number, withoutSuffix, string, isFuture) {
	      var output = this._relativeTime[string];
	      return isFunction(output) ? output(number, withoutSuffix, string, isFuture) : output.replace(/%d/i, number);
	    }

	    function pastFuture(diff, output) {
	      var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
	      return isFunction(format) ? format(output) : format.replace(/%s/i, output);
	    }

	    var aliases = {};

	    function addUnitAlias(unit, shorthand) {
	      var lowerCase = unit.toLowerCase();
	      aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
	    }

	    function normalizeUnits(units) {
	      return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined;
	    }

	    function normalizeObjectUnits(inputObject) {
	      var normalizedInput = {},
	          normalizedProp,
	          prop;

	      for (prop in inputObject) {
	        if (hasOwnProp(inputObject, prop)) {
	          normalizedProp = normalizeUnits(prop);

	          if (normalizedProp) {
	            normalizedInput[normalizedProp] = inputObject[prop];
	          }
	        }
	      }

	      return normalizedInput;
	    }

	    var priorities = {};

	    function addUnitPriority(unit, priority) {
	      priorities[unit] = priority;
	    }

	    function getPrioritizedUnits(unitsObj) {
	      var units = [];

	      for (var u in unitsObj) {
	        units.push({
	          unit: u,
	          priority: priorities[u]
	        });
	      }

	      sort$2$1(units).call(units, function (a, b) {
	        return a.priority - b.priority;
	      });
	      return units;
	    }

	    function zeroFill(number, targetLength, forceSign) {
	      var absNumber = '' + Math.abs(number),
	          zerosToFill = targetLength - absNumber.length,
	          sign = number >= 0;
	      return (sign ? forceSign ? '+' : '' : '-') + Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber;
	    }

	    var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;
	    var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g;
	    var formatFunctions = {};
	    var formatTokenFunctions = {}; // token:    'M'
	    // padded:   ['MM', 2]
	    // ordinal:  'Mo'
	    // callback: function () { this.month() + 1 }

	    function addFormatToken(token, padded, ordinal, callback) {
	      var func = callback;

	      if (typeof callback === 'string') {
	        func = function func() {
	          return this[callback]();
	        };
	      }

	      if (token) {
	        formatTokenFunctions[token] = func;
	      }

	      if (padded) {
	        formatTokenFunctions[padded[0]] = function () {
	          return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
	        };
	      }

	      if (ordinal) {
	        formatTokenFunctions[ordinal] = function () {
	          return this.localeData().ordinal(func.apply(this, arguments), token);
	        };
	      }
	    }

	    function removeFormattingTokens(input) {
	      if (input.match(/\[[\s\S]/)) {
	        return input.replace(/^\[|\]$/g, '');
	      }

	      return input.replace(/\\/g, '');
	    }

	    function makeFormatFunction(format) {
	      var array = format.match(formattingTokens),
	          i,
	          length;

	      for (i = 0, length = array.length; i < length; i++) {
	        if (formatTokenFunctions[array[i]]) {
	          array[i] = formatTokenFunctions[array[i]];
	        } else {
	          array[i] = removeFormattingTokens(array[i]);
	        }
	      }

	      return function (mom) {
	        var output = '',
	            i;

	        for (i = 0; i < length; i++) {
	          output += isFunction(array[i]) ? array[i].call(mom, format) : array[i];
	        }

	        return output;
	      };
	    } // format date using native date object


	    function formatMoment(m, format) {
	      if (!m.isValid()) {
	        return m.localeData().invalidDate();
	      }

	      format = expandFormat(format, m.localeData());
	      formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);
	      return formatFunctions[format](m);
	    }

	    function expandFormat(format, locale) {
	      var i = 5;

	      function replaceLongDateFormatTokens(input) {
	        return locale.longDateFormat(input) || input;
	      }

	      localFormattingTokens.lastIndex = 0;

	      while (i >= 0 && localFormattingTokens.test(format)) {
	        format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);
	        localFormattingTokens.lastIndex = 0;
	        i -= 1;
	      }

	      return format;
	    }

	    var match1 = /\d/; //       0 - 9

	    var match2 = /\d\d/; //      00 - 99

	    var match3 = /\d{3}/; //     000 - 999

	    var match4 = /\d{4}/; //    0000 - 9999

	    var match6 = /[+-]?\d{6}/; // -999999 - 999999

	    var match1to2 = /\d\d?/; //       0 - 99

	    var match3to4 = /\d\d\d\d?/; //     999 - 9999

	    var match5to6 = /\d\d\d\d\d\d?/; //   99999 - 999999

	    var match1to3 = /\d{1,3}/; //       0 - 999

	    var match1to4 = /\d{1,4}/; //       0 - 9999

	    var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999

	    var matchUnsigned = /\d+/; //       0 - inf

	    var matchSigned = /[+-]?\d+/; //    -inf - inf

	    var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z

	    var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z

	    var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123
	    // any word (or two) characters or numbers including two/three word month in arabic.
	    // includes scottish gaelic two word and hyphenated months

	    var matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i;
	    var regexes = {};

	    function addRegexToken(token, regex, strictRegex) {
	      regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) {
	        return isStrict && strictRegex ? strictRegex : regex;
	      };
	    }

	    function getParseRegexForToken(token, config) {
	      if (!hasOwnProp(regexes, token)) {
	        return new RegExp(unescapeFormat(token));
	      }

	      return regexes[token](config._strict, config._locale);
	    } // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript


	    function unescapeFormat(s) {
	      return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) {
	        return p1 || p2 || p3 || p4;
	      }));
	    }

	    function regexEscape(s) {
	      return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
	    }

	    var tokens = {};

	    function addParseToken(token, callback) {
	      var i,
	          func = callback;

	      if (typeof token === 'string') {
	        token = [token];
	      }

	      if (isNumber(callback)) {
	        func = function func(input, array) {
	          array[callback] = toInt(input);
	        };
	      }

	      for (i = 0; i < token.length; i++) {
	        tokens[token[i]] = func;
	      }
	    }

	    function addWeekParseToken(token, callback) {
	      addParseToken(token, function (input, array, config, token) {
	        config._w = config._w || {};
	        callback(input, config._w, config, token);
	      });
	    }

	    function addTimeToArrayFromToken(token, input, config) {
	      if (input != null && hasOwnProp(tokens, token)) {
	        tokens[token](input, config._a, config, token);
	      }
	    }

	    var YEAR = 0;
	    var MONTH = 1;
	    var DATE = 2;
	    var HOUR = 3;
	    var MINUTE = 4;
	    var SECOND = 5;
	    var MILLISECOND = 6;
	    var WEEK = 7;
	    var WEEKDAY = 8; // FORMATTING

	    addFormatToken('Y', 0, 0, function () {
	      var y = this.year();
	      return y <= 9999 ? '' + y : '+' + y;
	    });
	    addFormatToken(0, ['YY', 2], 0, function () {
	      return this.year() % 100;
	    });
	    addFormatToken(0, ['YYYY', 4], 0, 'year');
	    addFormatToken(0, ['YYYYY', 5], 0, 'year');
	    addFormatToken(0, ['YYYYYY', 6, true], 0, 'year'); // ALIASES

	    addUnitAlias('year', 'y'); // PRIORITIES

	    addUnitPriority('year', 1); // PARSING

	    addRegexToken('Y', matchSigned);
	    addRegexToken('YY', match1to2, match2);
	    addRegexToken('YYYY', match1to4, match4);
	    addRegexToken('YYYYY', match1to6, match6);
	    addRegexToken('YYYYYY', match1to6, match6);
	    addParseToken(['YYYYY', 'YYYYYY'], YEAR);
	    addParseToken('YYYY', function (input, array) {
	      array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);
	    });
	    addParseToken('YY', function (input, array) {
	      array[YEAR] = hooks.parseTwoDigitYear(input);
	    });
	    addParseToken('Y', function (input, array) {
	      array[YEAR] = _parseInt$3$2(input, 10);
	    }); // HELPERS

	    function daysInYear(year) {
	      return isLeapYear(year) ? 366 : 365;
	    }

	    function isLeapYear(year) {
	      return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
	    } // HOOKS


	    hooks.parseTwoDigitYear = function (input) {
	      return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
	    }; // MOMENTS


	    var getSetYear = makeGetSet('FullYear', true);

	    function getIsLeapYear() {
	      return isLeapYear(this.year());
	    }

	    function makeGetSet(unit, keepTime) {
	      return function (value) {
	        if (value != null) {
	          set$1(this, unit, value);
	          hooks.updateOffset(this, keepTime);
	          return this;
	        } else {
	          return get(this, unit);
	        }
	      };
	    }

	    function get(mom, unit) {
	      return mom.isValid() ? mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN;
	    }

	    function set$1(mom, unit, value) {
	      if (mom.isValid() && !isNaN(value)) {
	        if (unit === 'FullYear' && isLeapYear(mom.year()) && mom.month() === 1 && mom.date() === 29) {
	          mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value, mom.month(), daysInMonth(value, mom.month()));
	        } else {
	          mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
	        }
	      }
	    } // MOMENTS


	    function stringGet(units) {
	      units = normalizeUnits(units);

	      if (isFunction(this[units])) {
	        return this[units]();
	      }

	      return this;
	    }

	    function stringSet(units, value) {
	      if (_typeof_1$1$1(units) === 'object') {
	        units = normalizeObjectUnits(units);
	        var prioritized = getPrioritizedUnits(units);

	        for (var i = 0; i < prioritized.length; i++) {
	          this[prioritized[i].unit](units[prioritized[i].unit]);
	        }
	      } else {
	        units = normalizeUnits(units);

	        if (isFunction(this[units])) {
	          return this[units](value);
	        }
	      }

	      return this;
	    }

	    function mod(n, x) {
	      return (n % x + x) % x;
	    }

	    var indexOf;

	    if (indexOf$3$2(Array.prototype)) {
	      indexOf = indexOf$3$2(Array.prototype);
	    } else {
	      indexOf = function indexOf(o) {
	        // I know
	        var i;

	        for (i = 0; i < this.length; ++i) {
	          if (this[i] === o) {
	            return i;
	          }
	        }

	        return -1;
	      };
	    }

	    function daysInMonth(year, month) {
	      if (isNaN(year) || isNaN(month)) {
	        return NaN;
	      }

	      var modMonth = mod(month, 12);
	      year += (month - modMonth) / 12;
	      return modMonth === 1 ? isLeapYear(year) ? 29 : 28 : 31 - modMonth % 7 % 2;
	    } // FORMATTING


	    addFormatToken('M', ['MM', 2], 'Mo', function () {
	      return this.month() + 1;
	    });
	    addFormatToken('MMM', 0, 0, function (format) {
	      return this.localeData().monthsShort(this, format);
	    });
	    addFormatToken('MMMM', 0, 0, function (format) {
	      return this.localeData().months(this, format);
	    }); // ALIASES

	    addUnitAlias('month', 'M'); // PRIORITY

	    addUnitPriority('month', 8); // PARSING

	    addRegexToken('M', match1to2);
	    addRegexToken('MM', match1to2, match2);
	    addRegexToken('MMM', function (isStrict, locale) {
	      return locale.monthsShortRegex(isStrict);
	    });
	    addRegexToken('MMMM', function (isStrict, locale) {
	      return locale.monthsRegex(isStrict);
	    });
	    addParseToken(['M', 'MM'], function (input, array) {
	      array[MONTH] = toInt(input) - 1;
	    });
	    addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
	      var month = config._locale.monthsParse(input, token, config._strict); // if we didn't find a month name, mark the date as invalid.


	      if (month != null) {
	        array[MONTH] = month;
	      } else {
	        getParsingFlags(config).invalidMonth = input;
	      }
	    }); // LOCALES

	    var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/;
	    var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_');

	    function localeMonths(m, format) {
	      if (!m) {
	        return isArray(this._months) ? this._months : this._months['standalone'];
	      }

	      return isArray(this._months) ? this._months[m.month()] : this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? 'format' : 'standalone'][m.month()];
	    }

	    var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_');

	    function localeMonthsShort(m, format) {
	      if (!m) {
	        return isArray(this._monthsShort) ? this._monthsShort : this._monthsShort['standalone'];
	      }

	      return isArray(this._monthsShort) ? this._monthsShort[m.month()] : this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()];
	    }

	    function handleStrictParse(monthName, format, strict) {
	      var i,
	          ii,
	          mom,
	          llc = monthName.toLocaleLowerCase();

	      if (!this._monthsParse) {
	        // this is not used
	        this._monthsParse = [];
	        this._longMonthsParse = [];
	        this._shortMonthsParse = [];

	        for (i = 0; i < 12; ++i) {
	          mom = createUTC([2000, i]);
	          this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase();
	          this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();
	        }
	      }

	      if (strict) {
	        if (format === 'MMM') {
	          ii = indexOf.call(this._shortMonthsParse, llc);
	          return ii !== -1 ? ii : null;
	        } else {
	          ii = indexOf.call(this._longMonthsParse, llc);
	          return ii !== -1 ? ii : null;
	        }
	      } else {
	        if (format === 'MMM') {
	          ii = indexOf.call(this._shortMonthsParse, llc);

	          if (ii !== -1) {
	            return ii;
	          }

	          ii = indexOf.call(this._longMonthsParse, llc);
	          return ii !== -1 ? ii : null;
	        } else {
	          ii = indexOf.call(this._longMonthsParse, llc);

	          if (ii !== -1) {
	            return ii;
	          }

	          ii = indexOf.call(this._shortMonthsParse, llc);
	          return ii !== -1 ? ii : null;
	        }
	      }
	    }

	    function localeMonthsParse(monthName, format, strict) {
	      var i, mom, regex;

	      if (this._monthsParseExact) {
	        return handleStrictParse.call(this, monthName, format, strict);
	      }

	      if (!this._monthsParse) {
	        this._monthsParse = [];
	        this._longMonthsParse = [];
	        this._shortMonthsParse = [];
	      } // TODO: add sorting
	      // Sorting makes sure if one month (or abbr) is a prefix of another
	      // see sorting in computeMonthsParse


	      for (i = 0; i < 12; i++) {
	        // make the regex if we don't have it already
	        mom = createUTC([2000, i]);

	        if (strict && !this._longMonthsParse[i]) {
	          this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i');
	          this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i');
	        }

	        if (!strict && !this._monthsParse[i]) {
	          regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
	          this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
	        } // test the regex


	        if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) {
	          return i;
	        } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) {
	          return i;
	        } else if (!strict && this._monthsParse[i].test(monthName)) {
	          return i;
	        }
	      }
	    } // MOMENTS


	    function setMonth(mom, value) {
	      var dayOfMonth;

	      if (!mom.isValid()) {
	        // No op
	        return mom;
	      }

	      if (typeof value === 'string') {
	        if (/^\d+$/.test(value)) {
	          value = toInt(value);
	        } else {
	          value = mom.localeData().monthsParse(value); // TODO: Another silent failure?

	          if (!isNumber(value)) {
	            return mom;
	          }
	        }
	      }

	      dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));

	      mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);

	      return mom;
	    }

	    function getSetMonth(value) {
	      if (value != null) {
	        setMonth(this, value);
	        hooks.updateOffset(this, true);
	        return this;
	      } else {
	        return get(this, 'Month');
	      }
	    }

	    function getDaysInMonth() {
	      return daysInMonth(this.year(), this.month());
	    }

	    var defaultMonthsShortRegex = matchWord;

	    function monthsShortRegex(isStrict) {
	      if (this._monthsParseExact) {
	        if (!hasOwnProp(this, '_monthsRegex')) {
	          computeMonthsParse.call(this);
	        }

	        if (isStrict) {
	          return this._monthsShortStrictRegex;
	        } else {
	          return this._monthsShortRegex;
	        }
	      } else {
	        if (!hasOwnProp(this, '_monthsShortRegex')) {
	          this._monthsShortRegex = defaultMonthsShortRegex;
	        }

	        return this._monthsShortStrictRegex && isStrict ? this._monthsShortStrictRegex : this._monthsShortRegex;
	      }
	    }

	    var defaultMonthsRegex = matchWord;

	    function monthsRegex(isStrict) {
	      if (this._monthsParseExact) {
	        if (!hasOwnProp(this, '_monthsRegex')) {
	          computeMonthsParse.call(this);
	        }

	        if (isStrict) {
	          return this._monthsStrictRegex;
	        } else {
	          return this._monthsRegex;
	        }
	      } else {
	        if (!hasOwnProp(this, '_monthsRegex')) {
	          this._monthsRegex = defaultMonthsRegex;
	        }

	        return this._monthsStrictRegex && isStrict ? this._monthsStrictRegex : this._monthsRegex;
	      }
	    }

	    function computeMonthsParse() {
	      function cmpLenRev(a, b) {
	        return b.length - a.length;
	      }

	      var shortPieces = [],
	          longPieces = [],
	          mixedPieces = [],
	          i,
	          mom;

	      for (i = 0; i < 12; i++) {
	        // make the regex if we don't have it already
	        mom = createUTC([2000, i]);
	        shortPieces.push(this.monthsShort(mom, ''));
	        longPieces.push(this.months(mom, ''));
	        mixedPieces.push(this.months(mom, ''));
	        mixedPieces.push(this.monthsShort(mom, ''));
	      } // Sorting makes sure if one month (or abbr) is a prefix of another it
	      // will match the longer piece.


	      sort$2$1(shortPieces).call(shortPieces, cmpLenRev);
	      sort$2$1(longPieces).call(longPieces, cmpLenRev);
	      sort$2$1(mixedPieces).call(mixedPieces, cmpLenRev);

	      for (i = 0; i < 12; i++) {
	        shortPieces[i] = regexEscape(shortPieces[i]);
	        longPieces[i] = regexEscape(longPieces[i]);
	      }

	      for (i = 0; i < 24; i++) {
	        mixedPieces[i] = regexEscape(mixedPieces[i]);
	      }

	      this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
	      this._monthsShortRegex = this._monthsRegex;
	      this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');
	      this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');
	    }

	    function createDate(y, m, d, h, M, s, ms) {
	      // can't just apply() to create a date:
	      // https://stackoverflow.com/q/181348
	      var date; // the date constructor remaps years 0-99 to 1900-1999

	      if (y < 100 && y >= 0) {
	        // preserve leap years using a full 400 year cycle, then reset
	        date = new Date(y + 400, m, d, h, M, s, ms);

	        if (isFinite(date.getFullYear())) {
	          date.setFullYear(y);
	        }
	      } else {
	        date = new Date(y, m, d, h, M, s, ms);
	      }

	      return date;
	    }

	    function createUTCDate(y) {
	      var date; // the Date.UTC function remaps years 0-99 to 1900-1999

	      if (y < 100 && y >= 0) {
	        var args = slice$2$2(Array.prototype).call(arguments); // preserve leap years using a full 400 year cycle, then reset

	        args[0] = y + 400;
	        date = new Date(Date.UTC.apply(null, args));

	        if (isFinite(date.getUTCFullYear())) {
	          date.setUTCFullYear(y);
	        }
	      } else {
	        date = new Date(Date.UTC.apply(null, arguments));
	      }

	      return date;
	    } // start-of-first-week - start-of-year


	    function firstWeekOffset(year, dow, doy) {
	      var // first-week day -- which january is always in the first week (4 for iso, 1 for other)
	      fwd = 7 + dow - doy,
	          // first-week day local weekday -- which local weekday is fwd
	      fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
	      return -fwdlw + fwd - 1;
	    } // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday


	    function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
	      var localWeekday = (7 + weekday - dow) % 7,
	          weekOffset = firstWeekOffset(year, dow, doy),
	          dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,
	          resYear,
	          resDayOfYear;

	      if (dayOfYear <= 0) {
	        resYear = year - 1;
	        resDayOfYear = daysInYear(resYear) + dayOfYear;
	      } else if (dayOfYear > daysInYear(year)) {
	        resYear = year + 1;
	        resDayOfYear = dayOfYear - daysInYear(year);
	      } else {
	        resYear = year;
	        resDayOfYear = dayOfYear;
	      }

	      return {
	        year: resYear,
	        dayOfYear: resDayOfYear
	      };
	    }

	    function weekOfYear(mom, dow, doy) {
	      var weekOffset = firstWeekOffset(mom.year(), dow, doy),
	          week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,
	          resWeek,
	          resYear;

	      if (week < 1) {
	        resYear = mom.year() - 1;
	        resWeek = week + weeksInYear(resYear, dow, doy);
	      } else if (week > weeksInYear(mom.year(), dow, doy)) {
	        resWeek = week - weeksInYear(mom.year(), dow, doy);
	        resYear = mom.year() + 1;
	      } else {
	        resYear = mom.year();
	        resWeek = week;
	      }

	      return {
	        week: resWeek,
	        year: resYear
	      };
	    }

	    function weeksInYear(year, dow, doy) {
	      var weekOffset = firstWeekOffset(year, dow, doy),
	          weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
	      return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
	    } // FORMATTING


	    addFormatToken('w', ['ww', 2], 'wo', 'week');
	    addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek'); // ALIASES

	    addUnitAlias('week', 'w');
	    addUnitAlias('isoWeek', 'W'); // PRIORITIES

	    addUnitPriority('week', 5);
	    addUnitPriority('isoWeek', 5); // PARSING

	    addRegexToken('w', match1to2);
	    addRegexToken('ww', match1to2, match2);
	    addRegexToken('W', match1to2);
	    addRegexToken('WW', match1to2, match2);
	    addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) {
	      week[token.substr(0, 1)] = toInt(input);
	    }); // HELPERS
	    // LOCALES

	    function localeWeek(mom) {
	      return weekOfYear(mom, this._week.dow, this._week.doy).week;
	    }

	    var defaultLocaleWeek = {
	      dow: 0,
	      // Sunday is the first day of the week.
	      doy: 6 // The week that contains Jan 6th is the first week of the year.

	    };

	    function localeFirstDayOfWeek() {
	      return this._week.dow;
	    }

	    function localeFirstDayOfYear() {
	      return this._week.doy;
	    } // MOMENTS


	    function getSetWeek(input) {
	      var week = this.localeData().week(this);
	      return input == null ? week : this.add((input - week) * 7, 'd');
	    }

	    function getSetISOWeek(input) {
	      var week = weekOfYear(this, 1, 4).week;
	      return input == null ? week : this.add((input - week) * 7, 'd');
	    } // FORMATTING


	    addFormatToken('d', 0, 'do', 'day');
	    addFormatToken('dd', 0, 0, function (format) {
	      return this.localeData().weekdaysMin(this, format);
	    });
	    addFormatToken('ddd', 0, 0, function (format) {
	      return this.localeData().weekdaysShort(this, format);
	    });
	    addFormatToken('dddd', 0, 0, function (format) {
	      return this.localeData().weekdays(this, format);
	    });
	    addFormatToken('e', 0, 0, 'weekday');
	    addFormatToken('E', 0, 0, 'isoWeekday'); // ALIASES

	    addUnitAlias('day', 'd');
	    addUnitAlias('weekday', 'e');
	    addUnitAlias('isoWeekday', 'E'); // PRIORITY

	    addUnitPriority('day', 11);
	    addUnitPriority('weekday', 11);
	    addUnitPriority('isoWeekday', 11); // PARSING

	    addRegexToken('d', match1to2);
	    addRegexToken('e', match1to2);
	    addRegexToken('E', match1to2);
	    addRegexToken('dd', function (isStrict, locale) {
	      return locale.weekdaysMinRegex(isStrict);
	    });
	    addRegexToken('ddd', function (isStrict, locale) {
	      return locale.weekdaysShortRegex(isStrict);
	    });
	    addRegexToken('dddd', function (isStrict, locale) {
	      return locale.weekdaysRegex(isStrict);
	    });
	    addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {
	      var weekday = config._locale.weekdaysParse(input, token, config._strict); // if we didn't get a weekday name, mark the date as invalid


	      if (weekday != null) {
	        week.d = weekday;
	      } else {
	        getParsingFlags(config).invalidWeekday = input;
	      }
	    });
	    addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
	      week[token] = toInt(input);
	    }); // HELPERS

	    function parseWeekday(input, locale) {
	      if (typeof input !== 'string') {
	        return input;
	      }

	      if (!isNaN(input)) {
	        return _parseInt$3$2(input, 10);
	      }

	      input = locale.weekdaysParse(input);

	      if (typeof input === 'number') {
	        return input;
	      }

	      return null;
	    }

	    function parseIsoWeekday(input, locale) {
	      if (typeof input === 'string') {
	        return locale.weekdaysParse(input) % 7 || 7;
	      }

	      return isNaN(input) ? null : input;
	    } // LOCALES


	    function shiftWeekdays(ws, n) {
	      var _context;

	      return concat$2$2(_context = slice$2$2(ws).call(ws, n, 7)).call(_context, slice$2$2(ws).call(ws, 0, n));
	    }

	    var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_');

	    function localeWeekdays(m, format) {
	      var weekdays = isArray(this._weekdays) ? this._weekdays : this._weekdays[m && m !== true && this._weekdays.isFormat.test(format) ? 'format' : 'standalone'];
	      return m === true ? shiftWeekdays(weekdays, this._week.dow) : m ? weekdays[m.day()] : weekdays;
	    }

	    var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_');

	    function localeWeekdaysShort(m) {
	      return m === true ? shiftWeekdays(this._weekdaysShort, this._week.dow) : m ? this._weekdaysShort[m.day()] : this._weekdaysShort;
	    }

	    var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_');

	    function localeWeekdaysMin(m) {
	      return m === true ? shiftWeekdays(this._weekdaysMin, this._week.dow) : m ? this._weekdaysMin[m.day()] : this._weekdaysMin;
	    }

	    function handleStrictParse$1(weekdayName, format, strict) {
	      var i,
	          ii,
	          mom,
	          llc = weekdayName.toLocaleLowerCase();

	      if (!this._weekdaysParse) {
	        this._weekdaysParse = [];
	        this._shortWeekdaysParse = [];
	        this._minWeekdaysParse = [];

	        for (i = 0; i < 7; ++i) {
	          mom = createUTC([2000, 1]).day(i);
	          this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase();
	          this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase();
	          this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();
	        }
	      }

	      if (strict) {
	        if (format === 'dddd') {
	          ii = indexOf.call(this._weekdaysParse, llc);
	          return ii !== -1 ? ii : null;
	        } else if (format === 'ddd') {
	          ii = indexOf.call(this._shortWeekdaysParse, llc);
	          return ii !== -1 ? ii : null;
	        } else {
	          ii = indexOf.call(this._minWeekdaysParse, llc);
	          return ii !== -1 ? ii : null;
	        }
	      } else {
	        if (format === 'dddd') {
	          ii = indexOf.call(this._weekdaysParse, llc);

	          if (ii !== -1) {
	            return ii;
	          }

	          ii = indexOf.call(this._shortWeekdaysParse, llc);

	          if (ii !== -1) {
	            return ii;
	          }

	          ii = indexOf.call(this._minWeekdaysParse, llc);
	          return ii !== -1 ? ii : null;
	        } else if (format === 'ddd') {
	          ii = indexOf.call(this._shortWeekdaysParse, llc);

	          if (ii !== -1) {
	            return ii;
	          }

	          ii = indexOf.call(this._weekdaysParse, llc);

	          if (ii !== -1) {
	            return ii;
	          }

	          ii = indexOf.call(this._minWeekdaysParse, llc);
	          return ii !== -1 ? ii : null;
	        } else {
	          ii = indexOf.call(this._minWeekdaysParse, llc);

	          if (ii !== -1) {
	            return ii;
	          }

	          ii = indexOf.call(this._weekdaysParse, llc);

	          if (ii !== -1) {
	            return ii;
	          }

	          ii = indexOf.call(this._shortWeekdaysParse, llc);
	          return ii !== -1 ? ii : null;
	        }
	      }
	    }

	    function localeWeekdaysParse(weekdayName, format, strict) {
	      var i, mom, regex;

	      if (this._weekdaysParseExact) {
	        return handleStrictParse$1.call(this, weekdayName, format, strict);
	      }

	      if (!this._weekdaysParse) {
	        this._weekdaysParse = [];
	        this._minWeekdaysParse = [];
	        this._shortWeekdaysParse = [];
	        this._fullWeekdaysParse = [];
	      }

	      for (i = 0; i < 7; i++) {
	        // make the regex if we don't have it already
	        mom = createUTC([2000, 1]).day(i);

	        if (strict && !this._fullWeekdaysParse[i]) {
	          this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\\.?') + '$', 'i');
	          this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$', 'i');
	          this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$', 'i');
	        }

	        if (!this._weekdaysParse[i]) {
	          regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
	          this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
	        } // test the regex


	        if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) {
	          return i;
	        } else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) {
	          return i;
	        } else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) {
	          return i;
	        } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
	          return i;
	        }
	      }
	    } // MOMENTS


	    function getSetDayOfWeek(input) {
	      if (!this.isValid()) {
	        return input != null ? this : NaN;
	      }

	      var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();

	      if (input != null) {
	        input = parseWeekday(input, this.localeData());
	        return this.add(input - day, 'd');
	      } else {
	        return day;
	      }
	    }

	    function getSetLocaleDayOfWeek(input) {
	      if (!this.isValid()) {
	        return input != null ? this : NaN;
	      }

	      var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
	      return input == null ? weekday : this.add(input - weekday, 'd');
	    }

	    function getSetISODayOfWeek(input) {
	      if (!this.isValid()) {
	        return input != null ? this : NaN;
	      } // behaves the same as moment#day except
	      // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
	      // as a setter, sunday should belong to the previous week.


	      if (input != null) {
	        var weekday = parseIsoWeekday(input, this.localeData());
	        return this.day(this.day() % 7 ? weekday : weekday - 7);
	      } else {
	        return this.day() || 7;
	      }
	    }

	    var defaultWeekdaysRegex = matchWord;

	    function weekdaysRegex(isStrict) {
	      if (this._weekdaysParseExact) {
	        if (!hasOwnProp(this, '_weekdaysRegex')) {
	          computeWeekdaysParse.call(this);
	        }

	        if (isStrict) {
	          return this._weekdaysStrictRegex;
	        } else {
	          return this._weekdaysRegex;
	        }
	      } else {
	        if (!hasOwnProp(this, '_weekdaysRegex')) {
	          this._weekdaysRegex = defaultWeekdaysRegex;
	        }

	        return this._weekdaysStrictRegex && isStrict ? this._weekdaysStrictRegex : this._weekdaysRegex;
	      }
	    }

	    var defaultWeekdaysShortRegex = matchWord;

	    function weekdaysShortRegex(isStrict) {
	      if (this._weekdaysParseExact) {
	        if (!hasOwnProp(this, '_weekdaysRegex')) {
	          computeWeekdaysParse.call(this);
	        }

	        if (isStrict) {
	          return this._weekdaysShortStrictRegex;
	        } else {
	          return this._weekdaysShortRegex;
	        }
	      } else {
	        if (!hasOwnProp(this, '_weekdaysShortRegex')) {
	          this._weekdaysShortRegex = defaultWeekdaysShortRegex;
	        }

	        return this._weekdaysShortStrictRegex && isStrict ? this._weekdaysShortStrictRegex : this._weekdaysShortRegex;
	      }
	    }

	    var defaultWeekdaysMinRegex = matchWord;

	    function weekdaysMinRegex(isStrict) {
	      if (this._weekdaysParseExact) {
	        if (!hasOwnProp(this, '_weekdaysRegex')) {
	          computeWeekdaysParse.call(this);
	        }

	        if (isStrict) {
	          return this._weekdaysMinStrictRegex;
	        } else {
	          return this._weekdaysMinRegex;
	        }
	      } else {
	        if (!hasOwnProp(this, '_weekdaysMinRegex')) {
	          this._weekdaysMinRegex = defaultWeekdaysMinRegex;
	        }

	        return this._weekdaysMinStrictRegex && isStrict ? this._weekdaysMinStrictRegex : this._weekdaysMinRegex;
	      }
	    }

	    function computeWeekdaysParse() {
	      function cmpLenRev(a, b) {
	        return b.length - a.length;
	      }

	      var minPieces = [],
	          shortPieces = [],
	          longPieces = [],
	          mixedPieces = [],
	          i,
	          mom,
	          minp,
	          shortp,
	          longp;

	      for (i = 0; i < 7; i++) {
	        // make the regex if we don't have it already
	        mom = createUTC([2000, 1]).day(i);
	        minp = this.weekdaysMin(mom, '');
	        shortp = this.weekdaysShort(mom, '');
	        longp = this.weekdays(mom, '');
	        minPieces.push(minp);
	        shortPieces.push(shortp);
	        longPieces.push(longp);
	        mixedPieces.push(minp);
	        mixedPieces.push(shortp);
	        mixedPieces.push(longp);
	      } // Sorting makes sure if one weekday (or abbr) is a prefix of another it
	      // will match the longer piece.


	      sort$2$1(minPieces).call(minPieces, cmpLenRev);
	      sort$2$1(shortPieces).call(shortPieces, cmpLenRev);
	      sort$2$1(longPieces).call(longPieces, cmpLenRev);
	      sort$2$1(mixedPieces).call(mixedPieces, cmpLenRev);

	      for (i = 0; i < 7; i++) {
	        shortPieces[i] = regexEscape(shortPieces[i]);
	        longPieces[i] = regexEscape(longPieces[i]);
	        mixedPieces[i] = regexEscape(mixedPieces[i]);
	      }

	      this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
	      this._weekdaysShortRegex = this._weekdaysRegex;
	      this._weekdaysMinRegex = this._weekdaysRegex;
	      this._weekdaysStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');
	      this._weekdaysShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');
	      this._weekdaysMinStrictRegex = new RegExp('^(' + minPieces.join('|') + ')', 'i');
	    } // FORMATTING


	    function hFormat() {
	      return this.hours() % 12 || 12;
	    }

	    function kFormat() {
	      return this.hours() || 24;
	    }

	    addFormatToken('H', ['HH', 2], 0, 'hour');
	    addFormatToken('h', ['hh', 2], 0, hFormat);
	    addFormatToken('k', ['kk', 2], 0, kFormat);
	    addFormatToken('hmm', 0, 0, function () {
	      return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);
	    });
	    addFormatToken('hmmss', 0, 0, function () {
	      return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2);
	    });
	    addFormatToken('Hmm', 0, 0, function () {
	      return '' + this.hours() + zeroFill(this.minutes(), 2);
	    });
	    addFormatToken('Hmmss', 0, 0, function () {
	      return '' + this.hours() + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2);
	    });

	    function meridiem(token, lowercase) {
	      addFormatToken(token, 0, 0, function () {
	        return this.localeData().meridiem(this.hours(), this.minutes(), lowercase);
	      });
	    }

	    meridiem('a', true);
	    meridiem('A', false); // ALIASES

	    addUnitAlias('hour', 'h'); // PRIORITY

	    addUnitPriority('hour', 13); // PARSING

	    function matchMeridiem(isStrict, locale) {
	      return locale._meridiemParse;
	    }

	    addRegexToken('a', matchMeridiem);
	    addRegexToken('A', matchMeridiem);
	    addRegexToken('H', match1to2);
	    addRegexToken('h', match1to2);
	    addRegexToken('k', match1to2);
	    addRegexToken('HH', match1to2, match2);
	    addRegexToken('hh', match1to2, match2);
	    addRegexToken('kk', match1to2, match2);
	    addRegexToken('hmm', match3to4);
	    addRegexToken('hmmss', match5to6);
	    addRegexToken('Hmm', match3to4);
	    addRegexToken('Hmmss', match5to6);
	    addParseToken(['H', 'HH'], HOUR);
	    addParseToken(['k', 'kk'], function (input, array, config) {
	      var kInput = toInt(input);
	      array[HOUR] = kInput === 24 ? 0 : kInput;
	    });
	    addParseToken(['a', 'A'], function (input, array, config) {
	      config._isPm = config._locale.isPM(input);
	      config._meridiem = input;
	    });
	    addParseToken(['h', 'hh'], function (input, array, config) {
	      array[HOUR] = toInt(input);
	      getParsingFlags(config).bigHour = true;
	    });
	    addParseToken('hmm', function (input, array, config) {
	      var pos = input.length - 2;
	      array[HOUR] = toInt(input.substr(0, pos));
	      array[MINUTE] = toInt(input.substr(pos));
	      getParsingFlags(config).bigHour = true;
	    });
	    addParseToken('hmmss', function (input, array, config) {
	      var pos1 = input.length - 4;
	      var pos2 = input.length - 2;
	      array[HOUR] = toInt(input.substr(0, pos1));
	      array[MINUTE] = toInt(input.substr(pos1, 2));
	      array[SECOND] = toInt(input.substr(pos2));
	      getParsingFlags(config).bigHour = true;
	    });
	    addParseToken('Hmm', function (input, array, config) {
	      var pos = input.length - 2;
	      array[HOUR] = toInt(input.substr(0, pos));
	      array[MINUTE] = toInt(input.substr(pos));
	    });
	    addParseToken('Hmmss', function (input, array, config) {
	      var pos1 = input.length - 4;
	      var pos2 = input.length - 2;
	      array[HOUR] = toInt(input.substr(0, pos1));
	      array[MINUTE] = toInt(input.substr(pos1, 2));
	      array[SECOND] = toInt(input.substr(pos2));
	    }); // LOCALES

	    function localeIsPM(input) {
	      // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
	      // Using charAt should be more compatible.
	      return (input + '').toLowerCase().charAt(0) === 'p';
	    }

	    var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i;

	    function localeMeridiem(hours, minutes, isLower) {
	      if (hours > 11) {
	        return isLower ? 'pm' : 'PM';
	      } else {
	        return isLower ? 'am' : 'AM';
	      }
	    } // MOMENTS
	    // Setting the hour should keep the time, because the user explicitly
	    // specified which hour they want. So trying to maintain the same hour (in
	    // a new timezone) makes sense. Adding/subtracting hours does not follow
	    // this rule.


	    var getSetHour = makeGetSet('Hours', true);
	    var baseConfig = {
	      calendar: defaultCalendar,
	      longDateFormat: defaultLongDateFormat,
	      invalidDate: defaultInvalidDate,
	      ordinal: defaultOrdinal,
	      dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,
	      relativeTime: defaultRelativeTime,
	      months: defaultLocaleMonths,
	      monthsShort: defaultLocaleMonthsShort,
	      week: defaultLocaleWeek,
	      weekdays: defaultLocaleWeekdays,
	      weekdaysMin: defaultLocaleWeekdaysMin,
	      weekdaysShort: defaultLocaleWeekdaysShort,
	      meridiemParse: defaultLocaleMeridiemParse
	    }; // internal storage for locale config files

	    var locales = {};
	    var localeFamilies = {};
	    var globalLocale;

	    function normalizeLocale(key) {
	      return key ? key.toLowerCase().replace('_', '-') : key;
	    } // pick the locale from the array
	    // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
	    // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root


	    function chooseLocale(names) {
	      var i = 0,
	          j,
	          next,
	          locale,
	          split;

	      while (i < names.length) {
	        split = normalizeLocale(names[i]).split('-');
	        j = split.length;
	        next = normalizeLocale(names[i + 1]);
	        next = next ? next.split('-') : null;

	        while (j > 0) {
	          locale = loadLocale(slice$2$2(split).call(split, 0, j).join('-'));

	          if (locale) {
	            return locale;
	          }

	          if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {
	            //the next array item is better than a shallower substring of this one
	            break;
	          }

	          j--;
	        }

	        i++;
	      }

	      return globalLocale;
	    }

	    function loadLocale(name) {
	      var oldLocale = null; // TODO: Find a better way to register and load all the locales in Node

	      if (!locales[name] && 'object' !== 'undefined' && module && module.exports) {
	        try {
	          oldLocale = globalLocale._abbr;
	          var aliasedRequire = commonjsRequire;
	          aliasedRequire('./locale/' + name);
	          getSetGlobalLocale(oldLocale);
	        } catch (e) {}
	      }

	      return locales[name];
	    } // This function will load locale and then set the global locale.  If
	    // no arguments are passed in, it will simply return the current global
	    // locale key.


	    function getSetGlobalLocale(key, values) {
	      var data;

	      if (key) {
	        if (isUndefined(values)) {
	          data = getLocale(key);
	        } else {
	          data = defineLocale(key, values);
	        }

	        if (data) {
	          // moment.duration._locale = moment._locale = data;
	          globalLocale = data;
	        } else {
	          if (typeof console !== 'undefined' && console.warn) {
	            //warn user if arguments are passed but the locale could not be set
	            console.warn('Locale ' + key + ' not found. Did you forget to load it?');
	          }
	        }
	      }

	      return globalLocale._abbr;
	    }

	    function defineLocale(name, config) {
	      if (config !== null) {
	        var locale,
	            parentConfig = baseConfig;
	        config.abbr = name;

	        if (locales[name] != null) {
	          deprecateSimple('defineLocaleOverride', 'use moment.updateLocale(localeName, config) to change ' + 'an existing locale. moment.defineLocale(localeName, ' + 'config) should only be used for creating a new locale ' + 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.');
	          parentConfig = locales[name]._config;
	        } else if (config.parentLocale != null) {
	          if (locales[config.parentLocale] != null) {
	            parentConfig = locales[config.parentLocale]._config;
	          } else {
	            locale = loadLocale(config.parentLocale);

	            if (locale != null) {
	              parentConfig = locale._config;
	            } else {
	              if (!localeFamilies[config.parentLocale]) {
	                localeFamilies[config.parentLocale] = [];
	              }

	              localeFamilies[config.parentLocale].push({
	                name: name,
	                config: config
	              });
	              return null;
	            }
	          }
	        }

	        locales[name] = new Locale(mergeConfigs(parentConfig, config));

	        if (localeFamilies[name]) {
	          var _context2;

	          forEach$2$2(_context2 = localeFamilies[name]).call(_context2, function (x) {
	            defineLocale(x.name, x.config);
	          });
	        } // backwards compat for now: also set the locale
	        // make sure we set the locale AFTER all child locales have been
	        // created, so we won't end up with the child locale set.


	        getSetGlobalLocale(name);
	        return locales[name];
	      } else {
	        // useful for testing
	        delete locales[name];
	        return null;
	      }
	    }

	    function updateLocale(name, config) {
	      if (config != null) {
	        var locale,
	            tmpLocale,
	            parentConfig = baseConfig; // MERGE

	        tmpLocale = loadLocale(name);

	        if (tmpLocale != null) {
	          parentConfig = tmpLocale._config;
	        }

	        config = mergeConfigs(parentConfig, config);
	        locale = new Locale(config);
	        locale.parentLocale = locales[name];
	        locales[name] = locale; // backwards compat for now: also set the locale

	        getSetGlobalLocale(name);
	      } else {
	        // pass null for config to unupdate, useful for tests
	        if (locales[name] != null) {
	          if (locales[name].parentLocale != null) {
	            locales[name] = locales[name].parentLocale;
	          } else if (locales[name] != null) {
	            delete locales[name];
	          }
	        }
	      }

	      return locales[name];
	    } // returns locale data


	    function getLocale(key) {
	      var locale;

	      if (key && key._locale && key._locale._abbr) {
	        key = key._locale._abbr;
	      }

	      if (!key) {
	        return globalLocale;
	      }

	      if (!isArray(key)) {
	        //short-circuit everything else
	        locale = loadLocale(key);

	        if (locale) {
	          return locale;
	        }

	        key = [key];
	      }

	      return chooseLocale(key);
	    }

	    function listLocales() {
	      return keys(locales);
	    }

	    function checkOverflow(m) {
	      var overflow;
	      var a = m._a;

	      if (a && getParsingFlags(m).overflow === -2) {
	        overflow = a[MONTH] < 0 || a[MONTH] > 11 ? MONTH : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE : a[HOUR] < 0 || a[HOUR] > 24 || a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0) ? HOUR : a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE : a[SECOND] < 0 || a[SECOND] > 59 ? SECOND : a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND : -1;

	        if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
	          overflow = DATE;
	        }

	        if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
	          overflow = WEEK;
	        }

	        if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
	          overflow = WEEKDAY;
	        }

	        getParsingFlags(m).overflow = overflow;
	      }

	      return m;
	    } // Pick the first defined of two or three arguments.


	    function defaults(a, b, c) {
	      if (a != null) {
	        return a;
	      }

	      if (b != null) {
	        return b;
	      }

	      return c;
	    }

	    function currentDateArray(config) {
	      // hooks is actually the exported moment object
	      var nowValue = new Date(hooks.now());

	      if (config._useUTC) {
	        return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()];
	      }

	      return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
	    } // convert an array to a date.
	    // the array should mirror the parameters below
	    // note: all values past the year are optional and will default to the lowest possible value.
	    // [year, month, day , hour, minute, second, millisecond]


	    function configFromArray(config) {
	      var i,
	          date,
	          input = [],
	          currentDate,
	          expectedWeekday,
	          yearToUse;

	      if (config._d) {
	        return;
	      }

	      currentDate = currentDateArray(config); //compute day of the year from weeks and weekdays

	      if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
	        dayOfYearFromWeekInfo(config);
	      } //if the day of the year is set, figure out what it is


	      if (config._dayOfYear != null) {
	        yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);

	        if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) {
	          getParsingFlags(config)._overflowDayOfYear = true;
	        }

	        date = createUTCDate(yearToUse, 0, config._dayOfYear);
	        config._a[MONTH] = date.getUTCMonth();
	        config._a[DATE] = date.getUTCDate();
	      } // Default to current date.
	      // * if no year, month, day of month are given, default to today
	      // * if day of month is given, default month and year
	      // * if month is given, default only year
	      // * if year is given, don't default anything


	      for (i = 0; i < 3 && config._a[i] == null; ++i) {
	        config._a[i] = input[i] = currentDate[i];
	      } // Zero out whatever was not defaulted, including time


	      for (; i < 7; i++) {
	        config._a[i] = input[i] = config._a[i] == null ? i === 2 ? 1 : 0 : config._a[i];
	      } // Check for 24:00:00.000


	      if (config._a[HOUR] === 24 && config._a[MINUTE] === 0 && config._a[SECOND] === 0 && config._a[MILLISECOND] === 0) {
	        config._nextDay = true;
	        config._a[HOUR] = 0;
	      }

	      config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);
	      expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay(); // Apply timezone offset from input. The actual utcOffset can be changed
	      // with parseZone.

	      if (config._tzm != null) {
	        config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
	      }

	      if (config._nextDay) {
	        config._a[HOUR] = 24;
	      } // check for mismatching day of week


	      if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== expectedWeekday) {
	        getParsingFlags(config).weekdayMismatch = true;
	      }
	    }

	    function dayOfYearFromWeekInfo(config) {
	      var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow;
	      w = config._w;

	      if (w.GG != null || w.W != null || w.E != null) {
	        dow = 1;
	        doy = 4; // TODO: We need to take the current isoWeekYear, but that depends on
	        // how we interpret now (local, utc, fixed offset). So create
	        // a now version of current config (take local/utc/offset flags, and
	        // create now).

	        weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(createLocal(), 1, 4).year);
	        week = defaults(w.W, 1);
	        weekday = defaults(w.E, 1);

	        if (weekday < 1 || weekday > 7) {
	          weekdayOverflow = true;
	        }
	      } else {
	        dow = config._locale._week.dow;
	        doy = config._locale._week.doy;
	        var curWeek = weekOfYear(createLocal(), dow, doy);
	        weekYear = defaults(w.gg, config._a[YEAR], curWeek.year); // Default to current week.

	        week = defaults(w.w, curWeek.week);

	        if (w.d != null) {
	          // weekday -- low day numbers are considered next week
	          weekday = w.d;

	          if (weekday < 0 || weekday > 6) {
	            weekdayOverflow = true;
	          }
	        } else if (w.e != null) {
	          // local weekday -- counting starts from beginning of week
	          weekday = w.e + dow;

	          if (w.e < 0 || w.e > 6) {
	            weekdayOverflow = true;
	          }
	        } else {
	          // default to beginning of week
	          weekday = dow;
	        }
	      }

	      if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
	        getParsingFlags(config)._overflowWeeks = true;
	      } else if (weekdayOverflow != null) {
	        getParsingFlags(config)._overflowWeekday = true;
	      } else {
	        temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
	        config._a[YEAR] = temp.year;
	        config._dayOfYear = temp.dayOfYear;
	      }
	    } // iso 8601 regex
	    // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)


	    var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
	    var basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
	    var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/;
	    var isoDates = [['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/], ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/], ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/], ['GGGG-[W]WW', /\d{4}-W\d\d/, false], ['YYYY-DDD', /\d{4}-\d{3}/], ['YYYY-MM', /\d{4}-\d\d/, false], ['YYYYYYMMDD', /[+-]\d{10}/], ['YYYYMMDD', /\d{8}/], // YYYYMM is NOT allowed by the standard
	    ['GGGG[W]WWE', /\d{4}W\d{3}/], ['GGGG[W]WW', /\d{4}W\d{2}/, false], ['YYYYDDD', /\d{7}/]]; // iso time formats and regexes

	    var isoTimes = [['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/], ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/], ['HH:mm:ss', /\d\d:\d\d:\d\d/], ['HH:mm', /\d\d:\d\d/], ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/], ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/], ['HHmmss', /\d\d\d\d\d\d/], ['HHmm', /\d\d\d\d/], ['HH', /\d\d/]];
	    var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i; // date from iso format

	    function configFromISO(config) {
	      var i,
	          l,
	          string = config._i,
	          match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),
	          allowTime,
	          dateFormat,
	          timeFormat,
	          tzFormat;

	      if (match) {
	        getParsingFlags(config).iso = true;

	        for (i = 0, l = isoDates.length; i < l; i++) {
	          if (isoDates[i][1].exec(match[1])) {
	            dateFormat = isoDates[i][0];
	            allowTime = isoDates[i][2] !== false;
	            break;
	          }
	        }

	        if (dateFormat == null) {
	          config._isValid = false;
	          return;
	        }

	        if (match[3]) {
	          for (i = 0, l = isoTimes.length; i < l; i++) {
	            if (isoTimes[i][1].exec(match[3])) {
	              // match[2] should be 'T' or space
	              timeFormat = (match[2] || ' ') + isoTimes[i][0];
	              break;
	            }
	          }

	          if (timeFormat == null) {
	            config._isValid = false;
	            return;
	          }
	        }

	        if (!allowTime && timeFormat != null) {
	          config._isValid = false;
	          return;
	        }

	        if (match[4]) {
	          if (tzRegex.exec(match[4])) {
	            tzFormat = 'Z';
	          } else {
	            config._isValid = false;
	            return;
	          }
	        }

	        config._f = dateFormat + (timeFormat || '') + (tzFormat || '');
	        configFromStringAndFormat(config);
	      } else {
	        config._isValid = false;
	      }
	    } // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3


	    var rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/;

	    function extractFromRFC2822Strings(yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {
	      var result = [untruncateYear(yearStr), indexOf$3$2(defaultLocaleMonthsShort).call(defaultLocaleMonthsShort, monthStr), _parseInt$3$2(dayStr, 10), _parseInt$3$2(hourStr, 10), _parseInt$3$2(minuteStr, 10)];

	      if (secondStr) {
	        result.push(_parseInt$3$2(secondStr, 10));
	      }

	      return result;
	    }

	    function untruncateYear(yearStr) {
	      var year = _parseInt$3$2(yearStr, 10);

	      if (year <= 49) {
	        return 2000 + year;
	      } else if (year <= 999) {
	        return 1900 + year;
	      }

	      return year;
	    }

	    function preprocessRFC2822(s) {
	      // Remove comments and folding whitespace and replace multiple-spaces with a single space
	      return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').replace(/^\s\s*/, '').replace(/\s\s*$/, '');
	    }

	    function checkWeekday(weekdayStr, parsedInput, config) {
	      if (weekdayStr) {
	        // TODO: Replace the vanilla JS Date object with an indepentent day-of-week check.
	        var weekdayProvided = indexOf$3$2(defaultLocaleWeekdaysShort).call(defaultLocaleWeekdaysShort, weekdayStr),
	            weekdayActual = new Date(parsedInput[0], parsedInput[1], parsedInput[2]).getDay();

	        if (weekdayProvided !== weekdayActual) {
	          getParsingFlags(config).weekdayMismatch = true;
	          config._isValid = false;
	          return false;
	        }
	      }

	      return true;
	    }

	    var obsOffsets = {
	      UT: 0,
	      GMT: 0,
	      EDT: -4 * 60,
	      EST: -5 * 60,
	      CDT: -5 * 60,
	      CST: -6 * 60,
	      MDT: -6 * 60,
	      MST: -7 * 60,
	      PDT: -7 * 60,
	      PST: -8 * 60
	    };

	    function calculateOffset(obsOffset, militaryOffset, numOffset) {
	      if (obsOffset) {
	        return obsOffsets[obsOffset];
	      } else if (militaryOffset) {
	        // the only allowed military tz is Z
	        return 0;
	      } else {
	        var hm = _parseInt$3$2(numOffset, 10);

	        var m = hm % 100,
	            h = (hm - m) / 100;
	        return h * 60 + m;
	      }
	    } // date and time from ref 2822 format


	    function configFromRFC2822(config) {
	      var match = rfc2822.exec(preprocessRFC2822(config._i));

	      if (match) {
	        var parsedArray = extractFromRFC2822Strings(match[4], match[3], match[2], match[5], match[6], match[7]);

	        if (!checkWeekday(match[1], parsedArray, config)) {
	          return;
	        }

	        config._a = parsedArray;
	        config._tzm = calculateOffset(match[8], match[9], match[10]);
	        config._d = createUTCDate.apply(null, config._a);

	        config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);

	        getParsingFlags(config).rfc2822 = true;
	      } else {
	        config._isValid = false;
	      }
	    } // date from iso format or fallback


	    function configFromString(config) {
	      var matched = aspNetJsonRegex.exec(config._i);

	      if (matched !== null) {
	        config._d = new Date(+matched[1]);
	        return;
	      }

	      configFromISO(config);

	      if (config._isValid === false) {
	        delete config._isValid;
	      } else {
	        return;
	      }

	      configFromRFC2822(config);

	      if (config._isValid === false) {
	        delete config._isValid;
	      } else {
	        return;
	      } // Final attempt, use Input Fallback


	      hooks.createFromInputFallback(config);
	    }

	    hooks.createFromInputFallback = deprecate('value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' + 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' + 'discouraged and will be removed in an upcoming major release. Please refer to ' + 'http://momentjs.com/guides/#/warnings/js-date/ for more info.', function (config) {
	      config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
	    }); // constant that refers to the ISO standard

	    hooks.ISO_8601 = function () {}; // constant that refers to the RFC 2822 form


	    hooks.RFC_2822 = function () {}; // date from string and format string


	    function configFromStringAndFormat(config) {
	      var _context3; // TODO: Move this to another part of the creation flow to prevent circular deps


	      if (config._f === hooks.ISO_8601) {
	        configFromISO(config);
	        return;
	      }

	      if (config._f === hooks.RFC_2822) {
	        configFromRFC2822(config);
	        return;
	      }

	      config._a = [];
	      getParsingFlags(config).empty = true; // This array is used to make a Date, either with `new Date` or `Date.UTC`

	      var string = '' + config._i,
	          i,
	          parsedInput,
	          tokens,
	          token,
	          skipped,
	          stringLength = string.length,
	          totalParsedInputLength = 0;
	      tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];

	      for (i = 0; i < tokens.length; i++) {
	        token = tokens[i];
	        parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0]; // console.log('token', token, 'parsedInput', parsedInput,
	        //         'regex', getParseRegexForToken(token, config));

	        if (parsedInput) {
	          skipped = string.substr(0, indexOf$3$2(string).call(string, parsedInput));

	          if (skipped.length > 0) {
	            getParsingFlags(config).unusedInput.push(skipped);
	          }

	          string = slice$2$2(string).call(string, indexOf$3$2(string).call(string, parsedInput) + parsedInput.length);
	          totalParsedInputLength += parsedInput.length;
	        } // don't parse if it's not a known token


	        if (formatTokenFunctions[token]) {
	          if (parsedInput) {
	            getParsingFlags(config).empty = false;
	          } else {
	            getParsingFlags(config).unusedTokens.push(token);
	          }

	          addTimeToArrayFromToken(token, parsedInput, config);
	        } else if (config._strict && !parsedInput) {
	          getParsingFlags(config).unusedTokens.push(token);
	        }
	      } // add remaining unparsed input length to the string


	      getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength;

	      if (string.length > 0) {
	        getParsingFlags(config).unusedInput.push(string);
	      } // clear _12h flag if hour is <= 12


	      if (config._a[HOUR] <= 12 && getParsingFlags(config).bigHour === true && config._a[HOUR] > 0) {
	        getParsingFlags(config).bigHour = undefined;
	      }

	      getParsingFlags(config).parsedDateParts = slice$2$2(_context3 = config._a).call(_context3, 0);
	      getParsingFlags(config).meridiem = config._meridiem; // handle meridiem

	      config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem);
	      configFromArray(config);
	      checkOverflow(config);
	    }

	    function meridiemFixWrap(locale, hour, meridiem) {
	      var isPm;

	      if (meridiem == null) {
	        // nothing to do
	        return hour;
	      }

	      if (locale.meridiemHour != null) {
	        return locale.meridiemHour(hour, meridiem);
	      } else if (locale.isPM != null) {
	        // Fallback
	        isPm = locale.isPM(meridiem);

	        if (isPm && hour < 12) {
	          hour += 12;
	        }

	        if (!isPm && hour === 12) {
	          hour = 0;
	        }

	        return hour;
	      } else {
	        // this is not supposed to happen
	        return hour;
	      }
	    } // date from string and array of format strings


	    function configFromStringAndArray(config) {
	      var tempConfig, bestMoment, scoreToBeat, i, currentScore;

	      if (config._f.length === 0) {
	        getParsingFlags(config).invalidFormat = true;
	        config._d = new Date(NaN);
	        return;
	      }

	      for (i = 0; i < config._f.length; i++) {
	        currentScore = 0;
	        tempConfig = copyConfig({}, config);

	        if (config._useUTC != null) {
	          tempConfig._useUTC = config._useUTC;
	        }

	        tempConfig._f = config._f[i];
	        configFromStringAndFormat(tempConfig);

	        if (!isValid(tempConfig)) {
	          continue;
	        } // if there is any input that was not parsed add a penalty for that format


	        currentScore += getParsingFlags(tempConfig).charsLeftOver; //or tokens

	        currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
	        getParsingFlags(tempConfig).score = currentScore;

	        if (scoreToBeat == null || currentScore < scoreToBeat) {
	          scoreToBeat = currentScore;
	          bestMoment = tempConfig;
	        }
	      }

	      extend(config, bestMoment || tempConfig);
	    }

	    function configFromObject(config) {
	      if (config._d) {
	        return;
	      }

	      var i = normalizeObjectUnits(config._i);
	      config._a = map([i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond], function (obj) {
	        return obj && _parseInt$3$2(obj, 10);
	      });
	      configFromArray(config);
	    }

	    function createFromConfig(config) {
	      var res = new Moment(checkOverflow(prepareConfig(config)));

	      if (res._nextDay) {
	        // Adding is smart enough around DST
	        res.add(1, 'd');
	        res._nextDay = undefined;
	      }

	      return res;
	    }

	    function prepareConfig(config) {
	      var input = config._i,
	          format = config._f;
	      config._locale = config._locale || getLocale(config._l);

	      if (input === null || format === undefined && input === '') {
	        return createInvalid({
	          nullInput: true
	        });
	      }

	      if (typeof input === 'string') {
	        config._i = input = config._locale.preparse(input);
	      }

	      if (isMoment(input)) {
	        return new Moment(checkOverflow(input));
	      } else if (isDate(input)) {
	        config._d = input;
	      } else if (isArray(format)) {
	        configFromStringAndArray(config);
	      } else if (format) {
	        configFromStringAndFormat(config);
	      } else {
	        configFromInput(config);
	      }

	      if (!isValid(config)) {
	        config._d = null;
	      }

	      return config;
	    }

	    function configFromInput(config) {
	      var input = config._i;

	      if (isUndefined(input)) {
	        config._d = new Date(hooks.now());
	      } else if (isDate(input)) {
	        config._d = new Date(input.valueOf());
	      } else if (typeof input === 'string') {
	        configFromString(config);
	      } else if (isArray(input)) {
	        config._a = map(slice$2$2(input).call(input, 0), function (obj) {
	          return _parseInt$3$2(obj, 10);
	        });
	        configFromArray(config);
	      } else if (isObject(input)) {
	        configFromObject(config);
	      } else if (isNumber(input)) {
	        // from milliseconds
	        config._d = new Date(input);
	      } else {
	        hooks.createFromInputFallback(config);
	      }
	    }

	    function createLocalOrUTC(input, format, locale, strict, isUTC) {
	      var c = {};

	      if (locale === true || locale === false) {
	        strict = locale;
	        locale = undefined;
	      }

	      if (isObject(input) && isObjectEmpty(input) || isArray(input) && input.length === 0) {
	        input = undefined;
	      } // object construction must be done this way.
	      // https://github.com/moment/moment/issues/1423


	      c._isAMomentObject = true;
	      c._useUTC = c._isUTC = isUTC;
	      c._l = locale;
	      c._i = input;
	      c._f = format;
	      c._strict = strict;
	      return createFromConfig(c);
	    }

	    function createLocal(input, format, locale, strict) {
	      return createLocalOrUTC(input, format, locale, strict, false);
	    }

	    var prototypeMin = deprecate('moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/', function () {
	      var other = createLocal.apply(null, arguments);

	      if (this.isValid() && other.isValid()) {
	        return other < this ? this : other;
	      } else {
	        return createInvalid();
	      }
	    });
	    var prototypeMax = deprecate('moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/', function () {
	      var other = createLocal.apply(null, arguments);

	      if (this.isValid() && other.isValid()) {
	        return other > this ? this : other;
	      } else {
	        return createInvalid();
	      }
	    }); // Pick a moment m from moments so that m[fn](other) is true for all
	    // other. This relies on the function fn to be transitive.
	    //
	    // moments should either be an array of moment objects or an array, whose
	    // first element is an array of moment objects.

	    function pickBy(fn, moments) {
	      var res, i;

	      if (moments.length === 1 && isArray(moments[0])) {
	        moments = moments[0];
	      }

	      if (!moments.length) {
	        return createLocal();
	      }

	      res = moments[0];

	      for (i = 1; i < moments.length; ++i) {
	        if (!moments[i].isValid() || moments[i][fn](res)) {
	          res = moments[i];
	        }
	      }

	      return res;
	    } // TODO: Use [].sort instead?


	    function min() {
	      var args = slice$2$2([]).call(arguments, 0);
	      return pickBy('isBefore', args);
	    }

	    function max() {
	      var args = slice$2$2([]).call(arguments, 0);
	      return pickBy('isAfter', args);
	    }

	    var now = function now() {
	      return now$2$1 ? now$2$1() : +new Date();
	    };

	    var ordering = ['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond'];

	    function isDurationValid(m) {
	      for (var key in m) {
	        if (!(indexOf.call(ordering, key) !== -1 && (m[key] == null || !isNaN(m[key])))) {
	          return false;
	        }
	      }

	      var unitHasDecimal = false;

	      for (var i = 0; i < ordering.length; ++i) {
	        if (m[ordering[i]]) {
	          if (unitHasDecimal) {
	            return false; // only allow non-integers for smallest unit
	          }

	          if (_parseFloat$3$1(m[ordering[i]]) !== toInt(m[ordering[i]])) {
	            unitHasDecimal = true;
	          }
	        }
	      }

	      return true;
	    }

	    function isValid$1() {
	      return this._isValid;
	    }

	    function createInvalid$1() {
	      return createDuration(NaN);
	    }

	    function Duration(duration) {
	      var normalizedInput = normalizeObjectUnits(duration),
	          years = normalizedInput.year || 0,
	          quarters = normalizedInput.quarter || 0,
	          months = normalizedInput.month || 0,
	          weeks = normalizedInput.week || normalizedInput.isoWeek || 0,
	          days = normalizedInput.day || 0,
	          hours = normalizedInput.hour || 0,
	          minutes = normalizedInput.minute || 0,
	          seconds = normalizedInput.second || 0,
	          milliseconds = normalizedInput.millisecond || 0;
	      this._isValid = isDurationValid(normalizedInput); // representation for dateAddRemove

	      this._milliseconds = +milliseconds + seconds * 1e3 + // 1000
	      minutes * 6e4 + // 1000 * 60
	      hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978
	      // Because of dateAddRemove treats 24 hours as different from a
	      // day when working around DST, we need to store them separately

	      this._days = +days + weeks * 7; // It is impossible to translate months into days without knowing
	      // which months you are are talking about, so we have to store
	      // it separately.

	      this._months = +months + quarters * 3 + years * 12;
	      this._data = {};
	      this._locale = getLocale();

	      this._bubble();
	    }

	    function isDuration(obj) {
	      return obj instanceof Duration;
	    }

	    function absRound(number) {
	      if (number < 0) {
	        return Math.round(-1 * number) * -1;
	      } else {
	        return Math.round(number);
	      }
	    } // FORMATTING


	    function offset(token, separator) {
	      addFormatToken(token, 0, 0, function () {
	        var offset = this.utcOffset();
	        var sign = '+';

	        if (offset < 0) {
	          offset = -offset;
	          sign = '-';
	        }

	        return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~offset % 60, 2);
	      });
	    }

	    offset('Z', ':');
	    offset('ZZ', ''); // PARSING

	    addRegexToken('Z', matchShortOffset);
	    addRegexToken('ZZ', matchShortOffset);
	    addParseToken(['Z', 'ZZ'], function (input, array, config) {
	      config._useUTC = true;
	      config._tzm = offsetFromString(matchShortOffset, input);
	    }); // HELPERS
	    // timezone chunker
	    // '+10:00' > ['10',  '00']
	    // '-1530'  > ['-15', '30']

	    var chunkOffset = /([\+\-]|\d\d)/gi;

	    function offsetFromString(matcher, string) {
	      var matches = (string || '').match(matcher);

	      if (matches === null) {
	        return null;
	      }

	      var chunk = matches[matches.length - 1] || [];
	      var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
	      var minutes = +(parts[1] * 60) + toInt(parts[2]);
	      return minutes === 0 ? 0 : parts[0] === '+' ? minutes : -minutes;
	    } // Return a moment from input, that is local/utc/zone equivalent to model.


	    function cloneWithOffset(input, model) {
	      var res, diff;

	      if (model._isUTC) {
	        res = model.clone();
	        diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf(); // Use low-level api, because this fn is low-level api.

	        res._d.setTime(res._d.valueOf() + diff);

	        hooks.updateOffset(res, false);
	        return res;
	      } else {
	        return createLocal(input).local();
	      }
	    }

	    function getDateOffset(m) {
	      // On Firefox.24 Date#getTimezoneOffset returns a floating point.
	      // https://github.com/moment/moment/pull/1871
	      return -Math.round(m._d.getTimezoneOffset() / 15) * 15;
	    } // HOOKS
	    // This function will be called whenever a moment is mutated.
	    // It is intended to keep the offset in sync with the timezone.


	    hooks.updateOffset = function () {}; // MOMENTS
	    // keepLocalTime = true means only change the timezone, without
	    // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
	    // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
	    // +0200, so we adjust the time as needed, to be valid.
	    //
	    // Keeping the time actually adds/subtracts (one hour)
	    // from the actual represented time. That is why we call updateOffset
	    // a second time. In case it wants us to change the offset again
	    // _changeInProgress == true case, then we have to adjust, because
	    // there is no such time in the given timezone.


	    function getSetOffset(input, keepLocalTime, keepMinutes) {
	      var offset = this._offset || 0,
	          localAdjust;

	      if (!this.isValid()) {
	        return input != null ? this : NaN;
	      }

	      if (input != null) {
	        if (typeof input === 'string') {
	          input = offsetFromString(matchShortOffset, input);

	          if (input === null) {
	            return this;
	          }
	        } else if (Math.abs(input) < 16 && !keepMinutes) {
	          input = input * 60;
	        }

	        if (!this._isUTC && keepLocalTime) {
	          localAdjust = getDateOffset(this);
	        }

	        this._offset = input;
	        this._isUTC = true;

	        if (localAdjust != null) {
	          this.add(localAdjust, 'm');
	        }

	        if (offset !== input) {
	          if (!keepLocalTime || this._changeInProgress) {
	            addSubtract(this, createDuration(input - offset, 'm'), 1, false);
	          } else if (!this._changeInProgress) {
	            this._changeInProgress = true;
	            hooks.updateOffset(this, true);
	            this._changeInProgress = null;
	          }
	        }

	        return this;
	      } else {
	        return this._isUTC ? offset : getDateOffset(this);
	      }
	    }

	    function getSetZone(input, keepLocalTime) {
	      if (input != null) {
	        if (typeof input !== 'string') {
	          input = -input;
	        }

	        this.utcOffset(input, keepLocalTime);
	        return this;
	      } else {
	        return -this.utcOffset();
	      }
	    }

	    function setOffsetToUTC(keepLocalTime) {
	      return this.utcOffset(0, keepLocalTime);
	    }

	    function setOffsetToLocal(keepLocalTime) {
	      if (this._isUTC) {
	        this.utcOffset(0, keepLocalTime);
	        this._isUTC = false;

	        if (keepLocalTime) {
	          this.subtract(getDateOffset(this), 'm');
	        }
	      }

	      return this;
	    }

	    function setOffsetToParsedOffset() {
	      if (this._tzm != null) {
	        this.utcOffset(this._tzm, false, true);
	      } else if (typeof this._i === 'string') {
	        var tZone = offsetFromString(matchOffset, this._i);

	        if (tZone != null) {
	          this.utcOffset(tZone);
	        } else {
	          this.utcOffset(0, true);
	        }
	      }

	      return this;
	    }

	    function hasAlignedHourOffset(input) {
	      if (!this.isValid()) {
	        return false;
	      }

	      input = input ? createLocal(input).utcOffset() : 0;
	      return (this.utcOffset() - input) % 60 === 0;
	    }

	    function isDaylightSavingTime() {
	      return this.utcOffset() > this.clone().month(0).utcOffset() || this.utcOffset() > this.clone().month(5).utcOffset();
	    }

	    function isDaylightSavingTimeShifted() {
	      if (!isUndefined(this._isDSTShifted)) {
	        return this._isDSTShifted;
	      }

	      var c = {};
	      copyConfig(c, this);
	      c = prepareConfig(c);

	      if (c._a) {
	        var other = c._isUTC ? createUTC(c._a) : createLocal(c._a);
	        this._isDSTShifted = this.isValid() && compareArrays(c._a, other.toArray()) > 0;
	      } else {
	        this._isDSTShifted = false;
	      }

	      return this._isDSTShifted;
	    }

	    function isLocal() {
	      return this.isValid() ? !this._isUTC : false;
	    }

	    function isUtcOffset() {
	      return this.isValid() ? this._isUTC : false;
	    }

	    function isUtc() {
	      return this.isValid() ? this._isUTC && this._offset === 0 : false;
	    } // ASP.NET json date format regex


	    var aspNetRegex = /^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/; // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
	    // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
	    // and further modified to allow for strings containing both week and day

	    var isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;

	    function createDuration(input, key) {
	      var duration = input,
	          // matching against regexp is expensive, do it on demand
	      match = null,
	          sign,
	          ret,
	          diffRes;

	      if (isDuration(input)) {
	        duration = {
	          ms: input._milliseconds,
	          d: input._days,
	          M: input._months
	        };
	      } else if (isNumber(input)) {
	        duration = {};

	        if (key) {
	          duration[key] = input;
	        } else {
	          duration.milliseconds = input;
	        }
	      } else if (!!(match = aspNetRegex.exec(input))) {
	        sign = match[1] === '-' ? -1 : 1;
	        duration = {
	          y: 0,
	          d: toInt(match[DATE]) * sign,
	          h: toInt(match[HOUR]) * sign,
	          m: toInt(match[MINUTE]) * sign,
	          s: toInt(match[SECOND]) * sign,
	          ms: toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match

	        };
	      } else if (!!(match = isoRegex.exec(input))) {
	        sign = match[1] === '-' ? -1 : 1;
	        duration = {
	          y: parseIso(match[2], sign),
	          M: parseIso(match[3], sign),
	          w: parseIso(match[4], sign),
	          d: parseIso(match[5], sign),
	          h: parseIso(match[6], sign),
	          m: parseIso(match[7], sign),
	          s: parseIso(match[8], sign)
	        };
	      } else if (duration == null) {
	        // checks for null or undefined
	        duration = {};
	      } else if (_typeof_1$1$1(duration) === 'object' && ('from' in duration || 'to' in duration)) {
	        diffRes = momentsDifference(createLocal(duration.from), createLocal(duration.to));
	        duration = {};
	        duration.ms = diffRes.milliseconds;
	        duration.M = diffRes.months;
	      }

	      ret = new Duration(duration);

	      if (isDuration(input) && hasOwnProp(input, '_locale')) {
	        ret._locale = input._locale;
	      }

	      return ret;
	    }

	    createDuration.fn = Duration.prototype;
	    createDuration.invalid = createInvalid$1;

	    function parseIso(inp, sign) {
	      // We'd normally use ~~inp for this, but unfortunately it also
	      // converts floats to ints.
	      // inp may be undefined, so careful calling replace on it.
	      var res = inp && _parseFloat$3$1(inp.replace(',', '.')); // apply sign while we're at it


	      return (isNaN(res) ? 0 : res) * sign;
	    }

	    function positiveMomentsDifference(base, other) {
	      var res = {};
	      res.months = other.month() - base.month() + (other.year() - base.year()) * 12;

	      if (base.clone().add(res.months, 'M').isAfter(other)) {
	        --res.months;
	      }

	      res.milliseconds = +other - +base.clone().add(res.months, 'M');
	      return res;
	    }

	    function momentsDifference(base, other) {
	      var res;

	      if (!(base.isValid() && other.isValid())) {
	        return {
	          milliseconds: 0,
	          months: 0
	        };
	      }

	      other = cloneWithOffset(other, base);

	      if (base.isBefore(other)) {
	        res = positiveMomentsDifference(base, other);
	      } else {
	        res = positiveMomentsDifference(other, base);
	        res.milliseconds = -res.milliseconds;
	        res.months = -res.months;
	      }

	      return res;
	    } // TODO: remove 'name' arg after deprecation is removed


	    function createAdder(direction, name) {
	      return function (val, period) {
	        var dur, tmp; //invert the arguments, but complain about it

	        if (period !== null && !isNaN(+period)) {
	          deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' + 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.');
	          tmp = val;
	          val = period;
	          period = tmp;
	        }

	        val = typeof val === 'string' ? +val : val;
	        dur = createDuration(val, period);
	        addSubtract(this, dur, direction);
	        return this;
	      };
	    }

	    function addSubtract(mom, duration, isAdding, updateOffset) {
	      var milliseconds = duration._milliseconds,
	          days = absRound(duration._days),
	          months = absRound(duration._months);

	      if (!mom.isValid()) {
	        // No op
	        return;
	      }

	      updateOffset = updateOffset == null ? true : updateOffset;

	      if (months) {
	        setMonth(mom, get(mom, 'Month') + months * isAdding);
	      }

	      if (days) {
	        set$1(mom, 'Date', get(mom, 'Date') + days * isAdding);
	      }

	      if (milliseconds) {
	        mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding);
	      }

	      if (updateOffset) {
	        hooks.updateOffset(mom, days || months);
	      }
	    }

	    var add = createAdder(1, 'add');
	    var subtract = createAdder(-1, 'subtract');

	    function getCalendarFormat(myMoment, now) {
	      var diff = myMoment.diff(now, 'days', true);
	      return diff < -6 ? 'sameElse' : diff < -1 ? 'lastWeek' : diff < 0 ? 'lastDay' : diff < 1 ? 'sameDay' : diff < 2 ? 'nextDay' : diff < 7 ? 'nextWeek' : 'sameElse';
	    }

	    function calendar$1(time, formats) {
	      // We want to compare the start of today, vs this.
	      // Getting start-of-today depends on whether we're local/utc/offset or not.
	      var now = time || createLocal(),
	          sod = cloneWithOffset(now, this).startOf('day'),
	          format = hooks.calendarFormat(this, sod) || 'sameElse';
	      var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]);
	      return this.format(output || this.localeData().calendar(format, this, createLocal(now)));
	    }

	    function clone() {
	      return new Moment(this);
	    }

	    function isAfter(input, units) {
	      var localInput = isMoment(input) ? input : createLocal(input);

	      if (!(this.isValid() && localInput.isValid())) {
	        return false;
	      }

	      units = normalizeUnits(units) || 'millisecond';

	      if (units === 'millisecond') {
	        return this.valueOf() > localInput.valueOf();
	      } else {
	        return localInput.valueOf() < this.clone().startOf(units).valueOf();
	      }
	    }

	    function isBefore(input, units) {
	      var localInput = isMoment(input) ? input : createLocal(input);

	      if (!(this.isValid() && localInput.isValid())) {
	        return false;
	      }

	      units = normalizeUnits(units) || 'millisecond';

	      if (units === 'millisecond') {
	        return this.valueOf() < localInput.valueOf();
	      } else {
	        return this.clone().endOf(units).valueOf() < localInput.valueOf();
	      }
	    }

	    function isBetween(from, to, units, inclusivity) {
	      var localFrom = isMoment(from) ? from : createLocal(from),
	          localTo = isMoment(to) ? to : createLocal(to);

	      if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) {
	        return false;
	      }

	      inclusivity = inclusivity || '()';
	      return (inclusivity[0] === '(' ? this.isAfter(localFrom, units) : !this.isBefore(localFrom, units)) && (inclusivity[1] === ')' ? this.isBefore(localTo, units) : !this.isAfter(localTo, units));
	    }

	    function isSame(input, units) {
	      var localInput = isMoment(input) ? input : createLocal(input),
	          inputMs;

	      if (!(this.isValid() && localInput.isValid())) {
	        return false;
	      }

	      units = normalizeUnits(units) || 'millisecond';

	      if (units === 'millisecond') {
	        return this.valueOf() === localInput.valueOf();
	      } else {
	        inputMs = localInput.valueOf();
	        return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf();
	      }
	    }

	    function isSameOrAfter(input, units) {
	      return this.isSame(input, units) || this.isAfter(input, units);
	    }

	    function isSameOrBefore(input, units) {
	      return this.isSame(input, units) || this.isBefore(input, units);
	    }

	    function diff(input, units, asFloat) {
	      var that, zoneDelta, output;

	      if (!this.isValid()) {
	        return NaN;
	      }

	      that = cloneWithOffset(input, this);

	      if (!that.isValid()) {
	        return NaN;
	      }

	      zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
	      units = normalizeUnits(units);

	      switch (units) {
	        case 'year':
	          output = monthDiff(this, that) / 12;
	          break;

	        case 'month':
	          output = monthDiff(this, that);
	          break;

	        case 'quarter':
	          output = monthDiff(this, that) / 3;
	          break;

	        case 'second':
	          output = (this - that) / 1e3;
	          break;
	        // 1000

	        case 'minute':
	          output = (this - that) / 6e4;
	          break;
	        // 1000 * 60

	        case 'hour':
	          output = (this - that) / 36e5;
	          break;
	        // 1000 * 60 * 60

	        case 'day':
	          output = (this - that - zoneDelta) / 864e5;
	          break;
	        // 1000 * 60 * 60 * 24, negate dst

	        case 'week':
	          output = (this - that - zoneDelta) / 6048e5;
	          break;
	        // 1000 * 60 * 60 * 24 * 7, negate dst

	        default:
	          output = this - that;
	      }

	      return asFloat ? output : absFloor(output);
	    }

	    function monthDiff(a, b) {
	      // difference in months
	      var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()),
	          // b is in (anchor - 1 month, anchor + 1 month)
	      anchor = a.clone().add(wholeMonthDiff, 'months'),
	          anchor2,
	          adjust;

	      if (b - anchor < 0) {
	        anchor2 = a.clone().add(wholeMonthDiff - 1, 'months'); // linear across the month

	        adjust = (b - anchor) / (anchor - anchor2);
	      } else {
	        anchor2 = a.clone().add(wholeMonthDiff + 1, 'months'); // linear across the month

	        adjust = (b - anchor) / (anchor2 - anchor);
	      } //check for negative zero, return zero if negative zero


	      return -(wholeMonthDiff + adjust) || 0;
	    }

	    hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
	    hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';

	    function toString() {
	      return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
	    }

	    function toISOString(keepOffset) {
	      if (!this.isValid()) {
	        return null;
	      }

	      var utc = keepOffset !== true;
	      var m = utc ? this.clone().utc() : this;

	      if (m.year() < 0 || m.year() > 9999) {
	        return formatMoment(m, utc ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ');
	      }

	      if (isFunction(Date.prototype.toISOString)) {
	        // native implementation is ~50x faster, use it when we can
	        if (utc) {
	          return this.toDate().toISOString();
	        } else {
	          return new Date(this.valueOf() + this.utcOffset() * 60 * 1000).toISOString().replace('Z', formatMoment(m, 'Z'));
	        }
	      }

	      return formatMoment(m, utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ');
	    }
	    /**
	     * Return a human readable representation of a moment that can
	     * also be evaluated to get a new moment which is the same
	     *
	     * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects
	     */


	    function inspect() {
	      if (!this.isValid()) {
	        return 'moment.invalid(/* ' + this._i + ' */)';
	      }

	      var func = 'moment';
	      var zone = '';

	      if (!this.isLocal()) {
	        func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';
	        zone = 'Z';
	      }

	      var prefix = '[' + func + '("]';
	      var year = 0 <= this.year() && this.year() <= 9999 ? 'YYYY' : 'YYYYYY';
	      var datetime = '-MM-DD[T]HH:mm:ss.SSS';
	      var suffix = zone + '[")]';
	      return this.format(prefix + year + datetime + suffix);
	    }

	    function format(inputString) {
	      if (!inputString) {
	        inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat;
	      }

	      var output = formatMoment(this, inputString);
	      return this.localeData().postformat(output);
	    }

	    function from(time, withoutSuffix) {
	      if (this.isValid() && (isMoment(time) && time.isValid() || createLocal(time).isValid())) {
	        return createDuration({
	          to: this,
	          from: time
	        }).locale(this.locale()).humanize(!withoutSuffix);
	      } else {
	        return this.localeData().invalidDate();
	      }
	    }

	    function fromNow(withoutSuffix) {
	      return this.from(createLocal(), withoutSuffix);
	    }

	    function to(time, withoutSuffix) {
	      if (this.isValid() && (isMoment(time) && time.isValid() || createLocal(time).isValid())) {
	        return createDuration({
	          from: this,
	          to: time
	        }).locale(this.locale()).humanize(!withoutSuffix);
	      } else {
	        return this.localeData().invalidDate();
	      }
	    }

	    function toNow(withoutSuffix) {
	      return this.to(createLocal(), withoutSuffix);
	    } // If passed a locale key, it will set the locale for this
	    // instance.  Otherwise, it will return the locale configuration
	    // variables for this instance.


	    function locale(key) {
	      var newLocaleData;

	      if (key === undefined) {
	        return this._locale._abbr;
	      } else {
	        newLocaleData = getLocale(key);

	        if (newLocaleData != null) {
	          this._locale = newLocaleData;
	        }

	        return this;
	      }
	    }

	    var lang = deprecate('moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.', function (key) {
	      if (key === undefined) {
	        return this.localeData();
	      } else {
	        return this.locale(key);
	      }
	    });

	    function localeData() {
	      return this._locale;
	    }

	    var MS_PER_SECOND = 1000;
	    var MS_PER_MINUTE = 60 * MS_PER_SECOND;
	    var MS_PER_HOUR = 60 * MS_PER_MINUTE;
	    var MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR; // actual modulo - handles negative numbers (for dates before 1970):

	    function mod$1(dividend, divisor) {
	      return (dividend % divisor + divisor) % divisor;
	    }

	    function localStartOfDate(y, m, d) {
	      // the date constructor remaps years 0-99 to 1900-1999
	      if (y < 100 && y >= 0) {
	        // preserve leap years using a full 400 year cycle, then reset
	        return new Date(y + 400, m, d) - MS_PER_400_YEARS;
	      } else {
	        return new Date(y, m, d).valueOf();
	      }
	    }

	    function utcStartOfDate(y, m, d) {
	      // Date.UTC remaps years 0-99 to 1900-1999
	      if (y < 100 && y >= 0) {
	        // preserve leap years using a full 400 year cycle, then reset
	        return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS;
	      } else {
	        return Date.UTC(y, m, d);
	      }
	    }

	    function startOf(units) {
	      var time;
	      units = normalizeUnits(units);

	      if (units === undefined || units === 'millisecond' || !this.isValid()) {
	        return this;
	      }

	      var startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;

	      switch (units) {
	        case 'year':
	          time = startOfDate(this.year(), 0, 1);
	          break;

	        case 'quarter':
	          time = startOfDate(this.year(), this.month() - this.month() % 3, 1);
	          break;

	        case 'month':
	          time = startOfDate(this.year(), this.month(), 1);
	          break;

	        case 'week':
	          time = startOfDate(this.year(), this.month(), this.date() - this.weekday());
	          break;

	        case 'isoWeek':
	          time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1));
	          break;

	        case 'day':
	        case 'date':
	          time = startOfDate(this.year(), this.month(), this.date());
	          break;

	        case 'hour':
	          time = this._d.valueOf();
	          time -= mod$1(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR);
	          break;

	        case 'minute':
	          time = this._d.valueOf();
	          time -= mod$1(time, MS_PER_MINUTE);
	          break;

	        case 'second':
	          time = this._d.valueOf();
	          time -= mod$1(time, MS_PER_SECOND);
	          break;
	      }

	      this._d.setTime(time);

	      hooks.updateOffset(this, true);
	      return this;
	    }

	    function endOf(units) {
	      var time;
	      units = normalizeUnits(units);

	      if (units === undefined || units === 'millisecond' || !this.isValid()) {
	        return this;
	      }

	      var startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;

	      switch (units) {
	        case 'year':
	          time = startOfDate(this.year() + 1, 0, 1) - 1;
	          break;

	        case 'quarter':
	          time = startOfDate(this.year(), this.month() - this.month() % 3 + 3, 1) - 1;
	          break;

	        case 'month':
	          time = startOfDate(this.year(), this.month() + 1, 1) - 1;
	          break;

	        case 'week':
	          time = startOfDate(this.year(), this.month(), this.date() - this.weekday() + 7) - 1;
	          break;

	        case 'isoWeek':
	          time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1) + 7) - 1;
	          break;

	        case 'day':
	        case 'date':
	          time = startOfDate(this.year(), this.month(), this.date() + 1) - 1;
	          break;

	        case 'hour':
	          time = this._d.valueOf();
	          time += MS_PER_HOUR - mod$1(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR) - 1;
	          break;

	        case 'minute':
	          time = this._d.valueOf();
	          time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1;
	          break;

	        case 'second':
	          time = this._d.valueOf();
	          time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1;
	          break;
	      }

	      this._d.setTime(time);

	      hooks.updateOffset(this, true);
	      return this;
	    }

	    function valueOf() {
	      return this._d.valueOf() - (this._offset || 0) * 60000;
	    }

	    function unix() {
	      return Math.floor(this.valueOf() / 1000);
	    }

	    function toDate() {
	      return new Date(this.valueOf());
	    }

	    function toArray() {
	      var m = this;
	      return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()];
	    }

	    function toObject() {
	      var m = this;
	      return {
	        years: m.year(),
	        months: m.month(),
	        date: m.date(),
	        hours: m.hours(),
	        minutes: m.minutes(),
	        seconds: m.seconds(),
	        milliseconds: m.milliseconds()
	      };
	    }

	    function toJSON() {
	      // new Date(NaN).toJSON() === null
	      return this.isValid() ? this.toISOString() : null;
	    }

	    function isValid$2() {
	      return isValid(this);
	    }

	    function parsingFlags() {
	      return extend({}, getParsingFlags(this));
	    }

	    function invalidAt() {
	      return getParsingFlags(this).overflow;
	    }

	    function creationData() {
	      return {
	        input: this._i,
	        format: this._f,
	        locale: this._locale,
	        isUTC: this._isUTC,
	        strict: this._strict
	      };
	    } // FORMATTING


	    addFormatToken(0, ['gg', 2], 0, function () {
	      return this.weekYear() % 100;
	    });
	    addFormatToken(0, ['GG', 2], 0, function () {
	      return this.isoWeekYear() % 100;
	    });

	    function addWeekYearFormatToken(token, getter) {
	      addFormatToken(0, [token, token.length], 0, getter);
	    }

	    addWeekYearFormatToken('gggg', 'weekYear');
	    addWeekYearFormatToken('ggggg', 'weekYear');
	    addWeekYearFormatToken('GGGG', 'isoWeekYear');
	    addWeekYearFormatToken('GGGGG', 'isoWeekYear'); // ALIASES

	    addUnitAlias('weekYear', 'gg');
	    addUnitAlias('isoWeekYear', 'GG'); // PRIORITY

	    addUnitPriority('weekYear', 1);
	    addUnitPriority('isoWeekYear', 1); // PARSING

	    addRegexToken('G', matchSigned);
	    addRegexToken('g', matchSigned);
	    addRegexToken('GG', match1to2, match2);
	    addRegexToken('gg', match1to2, match2);
	    addRegexToken('GGGG', match1to4, match4);
	    addRegexToken('gggg', match1to4, match4);
	    addRegexToken('GGGGG', match1to6, match6);
	    addRegexToken('ggggg', match1to6, match6);
	    addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) {
	      week[token.substr(0, 2)] = toInt(input);
	    });
	    addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
	      week[token] = hooks.parseTwoDigitYear(input);
	    }); // MOMENTS

	    function getSetWeekYear(input) {
	      return getSetWeekYearHelper.call(this, input, this.week(), this.weekday(), this.localeData()._week.dow, this.localeData()._week.doy);
	    }

	    function getSetISOWeekYear(input) {
	      return getSetWeekYearHelper.call(this, input, this.isoWeek(), this.isoWeekday(), 1, 4);
	    }

	    function getISOWeeksInYear() {
	      return weeksInYear(this.year(), 1, 4);
	    }

	    function getWeeksInYear() {
	      var weekInfo = this.localeData()._week;

	      return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
	    }

	    function getSetWeekYearHelper(input, week, weekday, dow, doy) {
	      var weeksTarget;

	      if (input == null) {
	        return weekOfYear(this, dow, doy).year;
	      } else {
	        weeksTarget = weeksInYear(input, dow, doy);

	        if (week > weeksTarget) {
	          week = weeksTarget;
	        }

	        return setWeekAll.call(this, input, week, weekday, dow, doy);
	      }
	    }

	    function setWeekAll(weekYear, week, weekday, dow, doy) {
	      var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),
	          date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
	      this.year(date.getUTCFullYear());
	      this.month(date.getUTCMonth());
	      this.date(date.getUTCDate());
	      return this;
	    } // FORMATTING


	    addFormatToken('Q', 0, 'Qo', 'quarter'); // ALIASES

	    addUnitAlias('quarter', 'Q'); // PRIORITY

	    addUnitPriority('quarter', 7); // PARSING

	    addRegexToken('Q', match1);
	    addParseToken('Q', function (input, array) {
	      array[MONTH] = (toInt(input) - 1) * 3;
	    }); // MOMENTS

	    function getSetQuarter(input) {
	      return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
	    } // FORMATTING


	    addFormatToken('D', ['DD', 2], 'Do', 'date'); // ALIASES

	    addUnitAlias('date', 'D'); // PRIORITY

	    addUnitPriority('date', 9); // PARSING

	    addRegexToken('D', match1to2);
	    addRegexToken('DD', match1to2, match2);
	    addRegexToken('Do', function (isStrict, locale) {
	      // TODO: Remove "ordinalParse" fallback in next major release.
	      return isStrict ? locale._dayOfMonthOrdinalParse || locale._ordinalParse : locale._dayOfMonthOrdinalParseLenient;
	    });
	    addParseToken(['D', 'DD'], DATE);
	    addParseToken('Do', function (input, array) {
	      array[DATE] = toInt(input.match(match1to2)[0]);
	    }); // MOMENTS

	    var getSetDayOfMonth = makeGetSet('Date', true); // FORMATTING

	    addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear'); // ALIASES

	    addUnitAlias('dayOfYear', 'DDD'); // PRIORITY

	    addUnitPriority('dayOfYear', 4); // PARSING

	    addRegexToken('DDD', match1to3);
	    addRegexToken('DDDD', match3);
	    addParseToken(['DDD', 'DDDD'], function (input, array, config) {
	      config._dayOfYear = toInt(input);
	    }); // HELPERS
	    // MOMENTS

	    function getSetDayOfYear(input) {
	      var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1;
	      return input == null ? dayOfYear : this.add(input - dayOfYear, 'd');
	    } // FORMATTING


	    addFormatToken('m', ['mm', 2], 0, 'minute'); // ALIASES

	    addUnitAlias('minute', 'm'); // PRIORITY

	    addUnitPriority('minute', 14); // PARSING

	    addRegexToken('m', match1to2);
	    addRegexToken('mm', match1to2, match2);
	    addParseToken(['m', 'mm'], MINUTE); // MOMENTS

	    var getSetMinute = makeGetSet('Minutes', false); // FORMATTING

	    addFormatToken('s', ['ss', 2], 0, 'second'); // ALIASES

	    addUnitAlias('second', 's'); // PRIORITY

	    addUnitPriority('second', 15); // PARSING

	    addRegexToken('s', match1to2);
	    addRegexToken('ss', match1to2, match2);
	    addParseToken(['s', 'ss'], SECOND); // MOMENTS

	    var getSetSecond = makeGetSet('Seconds', false); // FORMATTING

	    addFormatToken('S', 0, 0, function () {
	      return ~~(this.millisecond() / 100);
	    });
	    addFormatToken(0, ['SS', 2], 0, function () {
	      return ~~(this.millisecond() / 10);
	    });
	    addFormatToken(0, ['SSS', 3], 0, 'millisecond');
	    addFormatToken(0, ['SSSS', 4], 0, function () {
	      return this.millisecond() * 10;
	    });
	    addFormatToken(0, ['SSSSS', 5], 0, function () {
	      return this.millisecond() * 100;
	    });
	    addFormatToken(0, ['SSSSSS', 6], 0, function () {
	      return this.millisecond() * 1000;
	    });
	    addFormatToken(0, ['SSSSSSS', 7], 0, function () {
	      return this.millisecond() * 10000;
	    });
	    addFormatToken(0, ['SSSSSSSS', 8], 0, function () {
	      return this.millisecond() * 100000;
	    });
	    addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
	      return this.millisecond() * 1000000;
	    }); // ALIASES

	    addUnitAlias('millisecond', 'ms'); // PRIORITY

	    addUnitPriority('millisecond', 16); // PARSING

	    addRegexToken('S', match1to3, match1);
	    addRegexToken('SS', match1to3, match2);
	    addRegexToken('SSS', match1to3, match3);
	    var token;

	    for (token = 'SSSS'; token.length <= 9; token += 'S') {
	      addRegexToken(token, matchUnsigned);
	    }

	    function parseMs(input, array) {
	      array[MILLISECOND] = toInt(('0.' + input) * 1000);
	    }

	    for (token = 'S'; token.length <= 9; token += 'S') {
	      addParseToken(token, parseMs);
	    } // MOMENTS


	    var getSetMillisecond = makeGetSet('Milliseconds', false); // FORMATTING

	    addFormatToken('z', 0, 0, 'zoneAbbr');
	    addFormatToken('zz', 0, 0, 'zoneName'); // MOMENTS

	    function getZoneAbbr() {
	      return this._isUTC ? 'UTC' : '';
	    }

	    function getZoneName() {
	      return this._isUTC ? 'Coordinated Universal Time' : '';
	    }

	    var proto = Moment.prototype;
	    proto.add = add;
	    proto.calendar = calendar$1;
	    proto.clone = clone;
	    proto.diff = diff;
	    proto.endOf = endOf;
	    proto.format = format;
	    proto.from = from;
	    proto.fromNow = fromNow;
	    proto.to = to;
	    proto.toNow = toNow;
	    proto.get = stringGet;
	    proto.invalidAt = invalidAt;
	    proto.isAfter = isAfter;
	    proto.isBefore = isBefore;
	    proto.isBetween = isBetween;
	    proto.isSame = isSame;
	    proto.isSameOrAfter = isSameOrAfter;
	    proto.isSameOrBefore = isSameOrBefore;
	    proto.isValid = isValid$2;
	    proto.lang = lang;
	    proto.locale = locale;
	    proto.localeData = localeData;
	    proto.max = prototypeMax;
	    proto.min = prototypeMin;
	    proto.parsingFlags = parsingFlags;
	    proto.set = stringSet;
	    proto.startOf = startOf;
	    proto.subtract = subtract;
	    proto.toArray = toArray;
	    proto.toObject = toObject;
	    proto.toDate = toDate;
	    proto.toISOString = toISOString;
	    proto.inspect = inspect;
	    proto.toJSON = toJSON;
	    proto.toString = toString;
	    proto.unix = unix;
	    proto.valueOf = valueOf;
	    proto.creationData = creationData;
	    proto.year = getSetYear;
	    proto.isLeapYear = getIsLeapYear;
	    proto.weekYear = getSetWeekYear;
	    proto.isoWeekYear = getSetISOWeekYear;
	    proto.quarter = proto.quarters = getSetQuarter;
	    proto.month = getSetMonth;
	    proto.daysInMonth = getDaysInMonth;
	    proto.week = proto.weeks = getSetWeek;
	    proto.isoWeek = proto.isoWeeks = getSetISOWeek;
	    proto.weeksInYear = getWeeksInYear;
	    proto.isoWeeksInYear = getISOWeeksInYear;
	    proto.date = getSetDayOfMonth;
	    proto.day = proto.days = getSetDayOfWeek;
	    proto.weekday = getSetLocaleDayOfWeek;
	    proto.isoWeekday = getSetISODayOfWeek;
	    proto.dayOfYear = getSetDayOfYear;
	    proto.hour = proto.hours = getSetHour;
	    proto.minute = proto.minutes = getSetMinute;
	    proto.second = proto.seconds = getSetSecond;
	    proto.millisecond = proto.milliseconds = getSetMillisecond;
	    proto.utcOffset = getSetOffset;
	    proto.utc = setOffsetToUTC;
	    proto.local = setOffsetToLocal;
	    proto.parseZone = setOffsetToParsedOffset;
	    proto.hasAlignedHourOffset = hasAlignedHourOffset;
	    proto.isDST = isDaylightSavingTime;
	    proto.isLocal = isLocal;
	    proto.isUtcOffset = isUtcOffset;
	    proto.isUtc = isUtc;
	    proto.isUTC = isUtc;
	    proto.zoneAbbr = getZoneAbbr;
	    proto.zoneName = getZoneName;
	    proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth);
	    proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth);
	    proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear);
	    proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone);
	    proto.isDSTShifted = deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted);

	    function createUnix(input) {
	      return createLocal(input * 1000);
	    }

	    function createInZone() {
	      return createLocal.apply(null, arguments).parseZone();
	    }

	    function preParsePostFormat(string) {
	      return string;
	    }

	    var proto$1 = Locale.prototype;
	    proto$1.calendar = calendar;
	    proto$1.longDateFormat = longDateFormat;
	    proto$1.invalidDate = invalidDate;
	    proto$1.ordinal = ordinal;
	    proto$1.preparse = preParsePostFormat;
	    proto$1.postformat = preParsePostFormat;
	    proto$1.relativeTime = relativeTime;
	    proto$1.pastFuture = pastFuture;
	    proto$1.set = set;
	    proto$1.months = localeMonths;
	    proto$1.monthsShort = localeMonthsShort;
	    proto$1.monthsParse = localeMonthsParse;
	    proto$1.monthsRegex = monthsRegex;
	    proto$1.monthsShortRegex = monthsShortRegex;
	    proto$1.week = localeWeek;
	    proto$1.firstDayOfYear = localeFirstDayOfYear;
	    proto$1.firstDayOfWeek = localeFirstDayOfWeek;
	    proto$1.weekdays = localeWeekdays;
	    proto$1.weekdaysMin = localeWeekdaysMin;
	    proto$1.weekdaysShort = localeWeekdaysShort;
	    proto$1.weekdaysParse = localeWeekdaysParse;
	    proto$1.weekdaysRegex = weekdaysRegex;
	    proto$1.weekdaysShortRegex = weekdaysShortRegex;
	    proto$1.weekdaysMinRegex = weekdaysMinRegex;
	    proto$1.isPM = localeIsPM;
	    proto$1.meridiem = localeMeridiem;

	    function get$1(format, index, field, setter) {
	      var locale = getLocale();
	      var utc = createUTC().set(setter, index);
	      return locale[field](utc, format);
	    }

	    function listMonthsImpl(format, index, field) {
	      if (isNumber(format)) {
	        index = format;
	        format = undefined;
	      }

	      format = format || '';

	      if (index != null) {
	        return get$1(format, index, field, 'month');
	      }

	      var i;
	      var out = [];

	      for (i = 0; i < 12; i++) {
	        out[i] = get$1(format, i, field, 'month');
	      }

	      return out;
	    } // ()
	    // (5)
	    // (fmt, 5)
	    // (fmt)
	    // (true)
	    // (true, 5)
	    // (true, fmt, 5)
	    // (true, fmt)


	    function listWeekdaysImpl(localeSorted, format, index, field) {
	      if (typeof localeSorted === 'boolean') {
	        if (isNumber(format)) {
	          index = format;
	          format = undefined;
	        }

	        format = format || '';
	      } else {
	        format = localeSorted;
	        index = format;
	        localeSorted = false;

	        if (isNumber(format)) {
	          index = format;
	          format = undefined;
	        }

	        format = format || '';
	      }

	      var locale = getLocale(),
	          shift = localeSorted ? locale._week.dow : 0;

	      if (index != null) {
	        return get$1(format, (index + shift) % 7, field, 'day');
	      }

	      var i;
	      var out = [];

	      for (i = 0; i < 7; i++) {
	        out[i] = get$1(format, (i + shift) % 7, field, 'day');
	      }

	      return out;
	    }

	    function listMonths(format, index) {
	      return listMonthsImpl(format, index, 'months');
	    }

	    function listMonthsShort(format, index) {
	      return listMonthsImpl(format, index, 'monthsShort');
	    }

	    function listWeekdays(localeSorted, format, index) {
	      return listWeekdaysImpl(localeSorted, format, index, 'weekdays');
	    }

	    function listWeekdaysShort(localeSorted, format, index) {
	      return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');
	    }

	    function listWeekdaysMin(localeSorted, format, index) {
	      return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');
	    }

	    getSetGlobalLocale('en', {
	      dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
	      ordinal: function ordinal(number) {
	        var b = number % 10,
	            output = toInt(number % 100 / 10) === 1 ? 'th' : b === 1 ? 'st' : b === 2 ? 'nd' : b === 3 ? 'rd' : 'th';
	        return number + output;
	      }
	    }); // Side effect imports

	    hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', getSetGlobalLocale);
	    hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', getLocale);
	    var mathAbs = Math.abs;

	    function abs() {
	      var data = this._data;
	      this._milliseconds = mathAbs(this._milliseconds);
	      this._days = mathAbs(this._days);
	      this._months = mathAbs(this._months);
	      data.milliseconds = mathAbs(data.milliseconds);
	      data.seconds = mathAbs(data.seconds);
	      data.minutes = mathAbs(data.minutes);
	      data.hours = mathAbs(data.hours);
	      data.months = mathAbs(data.months);
	      data.years = mathAbs(data.years);
	      return this;
	    }

	    function addSubtract$1(duration, input, value, direction) {
	      var other = createDuration(input, value);
	      duration._milliseconds += direction * other._milliseconds;
	      duration._days += direction * other._days;
	      duration._months += direction * other._months;
	      return duration._bubble();
	    } // supports only 2.0-style add(1, 's') or add(duration)


	    function add$1(input, value) {
	      return addSubtract$1(this, input, value, 1);
	    } // supports only 2.0-style subtract(1, 's') or subtract(duration)


	    function subtract$1(input, value) {
	      return addSubtract$1(this, input, value, -1);
	    }

	    function absCeil(number) {
	      if (number < 0) {
	        return Math.floor(number);
	      } else {
	        return Math.ceil(number);
	      }
	    }

	    function bubble() {
	      var milliseconds = this._milliseconds;
	      var days = this._days;
	      var months = this._months;
	      var data = this._data;
	      var seconds, minutes, hours, years, monthsFromDays; // if we have a mix of positive and negative values, bubble down first
	      // check: https://github.com/moment/moment/issues/2166

	      if (!(milliseconds >= 0 && days >= 0 && months >= 0 || milliseconds <= 0 && days <= 0 && months <= 0)) {
	        milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
	        days = 0;
	        months = 0;
	      } // The following code bubbles up values, see the tests for
	      // examples of what that means.


	      data.milliseconds = milliseconds % 1000;
	      seconds = absFloor(milliseconds / 1000);
	      data.seconds = seconds % 60;
	      minutes = absFloor(seconds / 60);
	      data.minutes = minutes % 60;
	      hours = absFloor(minutes / 60);
	      data.hours = hours % 24;
	      days += absFloor(hours / 24); // convert days to months

	      monthsFromDays = absFloor(daysToMonths(days));
	      months += monthsFromDays;
	      days -= absCeil(monthsToDays(monthsFromDays)); // 12 months -> 1 year

	      years = absFloor(months / 12);
	      months %= 12;
	      data.days = days;
	      data.months = months;
	      data.years = years;
	      return this;
	    }

	    function daysToMonths(days) {
	      // 400 years have 146097 days (taking into account leap year rules)
	      // 400 years have 12 months === 4800
	      return days * 4800 / 146097;
	    }

	    function monthsToDays(months) {
	      // the reverse of daysToMonths
	      return months * 146097 / 4800;
	    }

	    function as(units) {
	      if (!this.isValid()) {
	        return NaN;
	      }

	      var days;
	      var months;
	      var milliseconds = this._milliseconds;
	      units = normalizeUnits(units);

	      if (units === 'month' || units === 'quarter' || units === 'year') {
	        days = this._days + milliseconds / 864e5;
	        months = this._months + daysToMonths(days);

	        switch (units) {
	          case 'month':
	            return months;

	          case 'quarter':
	            return months / 3;

	          case 'year':
	            return months / 12;
	        }
	      } else {
	        // handle milliseconds separately because of floating point math errors (issue #1867)
	        days = this._days + Math.round(monthsToDays(this._months));

	        switch (units) {
	          case 'week':
	            return days / 7 + milliseconds / 6048e5;

	          case 'day':
	            return days + milliseconds / 864e5;

	          case 'hour':
	            return days * 24 + milliseconds / 36e5;

	          case 'minute':
	            return days * 1440 + milliseconds / 6e4;

	          case 'second':
	            return days * 86400 + milliseconds / 1000;
	          // Math.floor prevents floating point math errors here

	          case 'millisecond':
	            return Math.floor(days * 864e5) + milliseconds;

	          default:
	            throw new Error('Unknown unit ' + units);
	        }
	      }
	    } // TODO: Use this.as('ms')?


	    function valueOf$1() {
	      if (!this.isValid()) {
	        return NaN;
	      }

	      return this._milliseconds + this._days * 864e5 + this._months % 12 * 2592e6 + toInt(this._months / 12) * 31536e6;
	    }

	    function makeAs(alias) {
	      return function () {
	        return this.as(alias);
	      };
	    }

	    var asMilliseconds = makeAs('ms');
	    var asSeconds = makeAs('s');
	    var asMinutes = makeAs('m');
	    var asHours = makeAs('h');
	    var asDays = makeAs('d');
	    var asWeeks = makeAs('w');
	    var asMonths = makeAs('M');
	    var asQuarters = makeAs('Q');
	    var asYears = makeAs('y');

	    function clone$1() {
	      return createDuration(this);
	    }

	    function get$2(units) {
	      units = normalizeUnits(units);
	      return this.isValid() ? this[units + 's']() : NaN;
	    }

	    function makeGetter(name) {
	      return function () {
	        return this.isValid() ? this._data[name] : NaN;
	      };
	    }

	    var milliseconds = makeGetter('milliseconds');
	    var seconds = makeGetter('seconds');
	    var minutes = makeGetter('minutes');
	    var hours = makeGetter('hours');
	    var days = makeGetter('days');
	    var months = makeGetter('months');
	    var years = makeGetter('years');

	    function weeks() {
	      return absFloor(this.days() / 7);
	    }

	    var round = Math.round;
	    var thresholds = {
	      ss: 44,
	      // a few seconds to seconds
	      s: 45,
	      // seconds to minute
	      m: 45,
	      // minutes to hour
	      h: 22,
	      // hours to day
	      d: 26,
	      // days to month
	      M: 11 // months to year

	    }; // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize

	    function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
	      return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
	    }

	    function relativeTime$1(posNegDuration, withoutSuffix, locale) {
	      var duration = createDuration(posNegDuration).abs();
	      var seconds = round(duration.as('s'));
	      var minutes = round(duration.as('m'));
	      var hours = round(duration.as('h'));
	      var days = round(duration.as('d'));
	      var months = round(duration.as('M'));
	      var years = round(duration.as('y'));
	      var a = seconds <= thresholds.ss && ['s', seconds] || seconds < thresholds.s && ['ss', seconds] || minutes <= 1 && ['m'] || minutes < thresholds.m && ['mm', minutes] || hours <= 1 && ['h'] || hours < thresholds.h && ['hh', hours] || days <= 1 && ['d'] || days < thresholds.d && ['dd', days] || months <= 1 && ['M'] || months < thresholds.M && ['MM', months] || years <= 1 && ['y'] || ['yy', years];
	      a[2] = withoutSuffix;
	      a[3] = +posNegDuration > 0;
	      a[4] = locale;
	      return substituteTimeAgo.apply(null, a);
	    } // This function allows you to set the rounding function for relative time strings


	    function getSetRelativeTimeRounding(roundingFunction) {
	      if (roundingFunction === undefined) {
	        return round;
	      }

	      if (typeof roundingFunction === 'function') {
	        round = roundingFunction;
	        return true;
	      }

	      return false;
	    } // This function allows you to set a threshold for relative time strings


	    function getSetRelativeTimeThreshold(threshold, limit) {
	      if (thresholds[threshold] === undefined) {
	        return false;
	      }

	      if (limit === undefined) {
	        return thresholds[threshold];
	      }

	      thresholds[threshold] = limit;

	      if (threshold === 's') {
	        thresholds.ss = limit - 1;
	      }

	      return true;
	    }

	    function humanize(withSuffix) {
	      if (!this.isValid()) {
	        return this.localeData().invalidDate();
	      }

	      var locale = this.localeData();
	      var output = relativeTime$1(this, !withSuffix, locale);

	      if (withSuffix) {
	        output = locale.pastFuture(+this, output);
	      }

	      return locale.postformat(output);
	    }

	    var abs$1 = Math.abs;

	    function sign(x) {
	      return (x > 0) - (x < 0) || +x;
	    }

	    function toISOString$1() {
	      // for ISO strings we do not use the normal bubbling rules:
	      //  * milliseconds bubble up until they become hours
	      //  * days do not bubble at all
	      //  * months bubble up until they become years
	      // This is because there is no context-free conversion between hours and days
	      // (think of clock changes)
	      // and also not between days and months (28-31 days per month)
	      if (!this.isValid()) {
	        return this.localeData().invalidDate();
	      }

	      var seconds = abs$1(this._milliseconds) / 1000;
	      var days = abs$1(this._days);
	      var months = abs$1(this._months);
	      var minutes, hours, years; // 3600 seconds -> 60 minutes -> 1 hour

	      minutes = absFloor(seconds / 60);
	      hours = absFloor(minutes / 60);
	      seconds %= 60;
	      minutes %= 60; // 12 months -> 1 year

	      years = absFloor(months / 12);
	      months %= 12; // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js

	      var Y = years;
	      var M = months;
	      var D = days;
	      var h = hours;
	      var m = minutes;
	      var s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : '';
	      var total = this.asSeconds();

	      if (!total) {
	        // this is the same as C#'s (Noda) and python (isodate)...
	        // but not other JS (goog.date)
	        return 'P0D';
	      }

	      var totalSign = total < 0 ? '-' : '';
	      var ymSign = sign(this._months) !== sign(total) ? '-' : '';
	      var daysSign = sign(this._days) !== sign(total) ? '-' : '';
	      var hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : '';
	      return totalSign + 'P' + (Y ? ymSign + Y + 'Y' : '') + (M ? ymSign + M + 'M' : '') + (D ? daysSign + D + 'D' : '') + (h || m || s ? 'T' : '') + (h ? hmsSign + h + 'H' : '') + (m ? hmsSign + m + 'M' : '') + (s ? hmsSign + s + 'S' : '');
	    }

	    var proto$2 = Duration.prototype;
	    proto$2.isValid = isValid$1;
	    proto$2.abs = abs;
	    proto$2.add = add$1;
	    proto$2.subtract = subtract$1;
	    proto$2.as = as;
	    proto$2.asMilliseconds = asMilliseconds;
	    proto$2.asSeconds = asSeconds;
	    proto$2.asMinutes = asMinutes;
	    proto$2.asHours = asHours;
	    proto$2.asDays = asDays;
	    proto$2.asWeeks = asWeeks;
	    proto$2.asMonths = asMonths;
	    proto$2.asQuarters = asQuarters;
	    proto$2.asYears = asYears;
	    proto$2.valueOf = valueOf$1;
	    proto$2._bubble = bubble;
	    proto$2.clone = clone$1;
	    proto$2.get = get$2;
	    proto$2.milliseconds = milliseconds;
	    proto$2.seconds = seconds;
	    proto$2.minutes = minutes;
	    proto$2.hours = hours;
	    proto$2.days = days;
	    proto$2.weeks = weeks;
	    proto$2.months = months;
	    proto$2.years = years;
	    proto$2.humanize = humanize;
	    proto$2.toISOString = toISOString$1;
	    proto$2.toString = toISOString$1;
	    proto$2.toJSON = toISOString$1;
	    proto$2.locale = locale;
	    proto$2.localeData = localeData;
	    proto$2.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', toISOString$1);
	    proto$2.lang = lang; // Side effect imports
	    // FORMATTING

	    addFormatToken('X', 0, 0, 'unix');
	    addFormatToken('x', 0, 0, 'valueOf'); // PARSING

	    addRegexToken('x', matchSigned);
	    addRegexToken('X', matchTimestamp);
	    addParseToken('X', function (input, array, config) {
	      config._d = new Date(_parseFloat$3$1(input, 10) * 1000);
	    });
	    addParseToken('x', function (input, array, config) {
	      config._d = new Date(toInt(input));
	    }); // Side effect imports

	    hooks.version = '2.24.0';
	    setHookCallback(createLocal);
	    hooks.fn = proto;
	    hooks.min = min;
	    hooks.max = max;
	    hooks.now = now;
	    hooks.utc = createUTC;
	    hooks.unix = createUnix;
	    hooks.months = listMonths;
	    hooks.isDate = isDate;
	    hooks.locale = getSetGlobalLocale;
	    hooks.invalid = createInvalid;
	    hooks.duration = createDuration;
	    hooks.isMoment = isMoment;
	    hooks.weekdays = listWeekdays;
	    hooks.parseZone = createInZone;
	    hooks.localeData = getLocale;
	    hooks.isDuration = isDuration;
	    hooks.monthsShort = listMonthsShort;
	    hooks.weekdaysMin = listWeekdaysMin;
	    hooks.defineLocale = defineLocale;
	    hooks.updateLocale = updateLocale;
	    hooks.locales = listLocales;
	    hooks.weekdaysShort = listWeekdaysShort;
	    hooks.normalizeUnits = normalizeUnits;
	    hooks.relativeTimeRounding = getSetRelativeTimeRounding;
	    hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;
	    hooks.calendarFormat = getCalendarFormat;
	    hooks.prototype = proto; // currently HTML5 input type only supports 24-hour formats

	    hooks.HTML5_FMT = {
	      DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm',
	      // <input type="datetime-local" />
	      DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss',
	      // <input type="datetime-local" step="1" />
	      DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS',
	      // <input type="datetime-local" step="0.001" />
	      DATE: 'YYYY-MM-DD',
	      // <input type="date" />
	      TIME: 'HH:mm',
	      // <input type="time" />
	      TIME_SECONDS: 'HH:mm:ss',
	      // <input type="time" step="1" />
	      TIME_MS: 'HH:mm:ss.SSS',
	      // <input type="time" step="0.001" />
	      WEEK: 'GGGG-[W]WW',
	      // <input type="week" />
	      MONTH: 'YYYY-MM' // <input type="month" />

	    };
	    return hooks;
	  });
	}); // Maps for number <-> hex string conversion

	var byteToHex$2$1 = [];

	for (var i$2$1 = 0; i$2$1 < 256; i$2$1++) {
	  byteToHex$2$1[i$2$1] = (i$2$1 + 0x100).toString(16).substr(1);
	}
	/**
	 * Generate 16 random bytes to be used as a base for UUID.
	 *
	 * @ignore
	 */


	var random$1$1 = function () {
	  if (typeof crypto !== 'undefined' && crypto.getRandomValues) {
	    // WHATWG crypto-based RNG - http://wiki.whatwg.org/wiki/Crypto
	    // Moderately fast, high quality
	    var _rnds8 = new Uint8Array(16);

	    return function whatwgRNG() {
	      crypto.getRandomValues(_rnds8);
	      return _rnds8;
	    };
	  } // Math.random()-based (RNG)
	  //
	  // If all else fails, use Math.random().
	  // It's fast, but is of unspecified quality.


	  var _rnds = new Array(16);

	  return function () {
	    for (var i = 0, r; i < 16; i++) {
	      if ((i & 0x03) === 0) {
	        r = Math.random() * 0x100000000;
	      }

	      _rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
	    }

	    return _rnds;
	  }; //     uuid.js
	  //
	  //     Copyright (c) 2010-2012 Robert Kieffer
	  //     MIT License - http://opensource.org/licenses/mit-license.php
	  // Unique ID creation requires a high quality random # generator.  We feature
	  // detect to determine the best RNG source, normalizing to a function that
	  // returns 128-bits of randomness, since that's what's usually required
	  // return require('./rng');
	}();

	var byteToHex$1$1$1 = [];

	for (var i$1$1$1 = 0; i$1$1$1 < 256; i$1$1$1++) {
	  byteToHex$1$1$1[i$1$1$1] = (i$1$1$1 + 0x100).toString(16).substr(1);
	} // **`v1()` - Generate time-based UUID**
	//
	// Inspired by https://github.com/LiosK/UUID.js
	// and http://docs.python.org/library/uuid.html
	// random #'s we need to init node and clockseq


	var seedBytes$1$1 = random$1$1(); // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)

	var defaultNodeId$1$1 = [seedBytes$1$1[0] | 0x01, seedBytes$1$1[1], seedBytes$1$1[2], seedBytes$1$1[3], seedBytes$1$1[4], seedBytes$1$1[5]]; // Per 4.2.2, randomize (14 bit) clockseq

	var defaultClockseq$1$1 = (seedBytes$1$1[6] << 8 | seedBytes$1$1[7]) & 0x3fff; // Previous uuid creation time
	// code from http://momentjs.com/

	var ASPDateRegex$1 = /^\/?Date\((-?\d+)/i; // Color REs

	/**
	 * Hue, Saturation, Value.
	 */

	/**
	 * Test whether given object is a number
	 *
	 * @param value - Input value of unknown type.
	 *
	 * @returns True if number, false otherwise.
	 */

	function isNumber$1(value) {
	  return value instanceof Number || typeof value === "number";
	}
	/**
	 * Test whether given object is a string
	 *
	 * @param value - Input value of unknown type.
	 *
	 * @returns True if string, false otherwise.
	 */


	function isString$1(value) {
	  return value instanceof String || typeof value === "string";
	}
	/**
	 * Test whether given object is a Moment date.
	 * @TODO: This is basically a workaround, if Moment was imported property it wouldn't necessary as moment.isMoment is a TS type guard.
	 *
	 * @param value - Input value of unknown type.
	 *
	 * @returns True if Moment instance, false otherwise.
	 */


	function isMoment(value) {
	  return moment.isMoment(value);
	}
	/**
	 * Copy property from b to a if property present in a.
	 * If property in b explicitly set to null, delete it if `allowDeletion` set.
	 *
	 * Internal helper routine, should not be exported. Not added to `exports` for that reason.
	 *
	 * @param a - Target object.
	 * @param b - Source object.
	 * @param prop - Name of property to copy from b to a.
	 * @param allowDeletion  if true, delete property in a if explicitly set to null in b
	 */


	function copyOrDelete$1(a, b, prop, allowDeletion) {
	  var doDeletion = false;

	  if (allowDeletion === true) {
	    doDeletion = b[prop] === null && a[prop] !== undefined;
	  }

	  if (doDeletion) {
	    delete a[prop];
	  } else {
	    a[prop] = b[prop]; // Remember, this is a reference copy!
	  }
	}
	/**
	 * Deep extend an object a with the properties of object b
	 *
	 * @param a - Target object.
	 * @param b - Source object.
	 * @param protoExtend - If true, the prototype values will also be extended
	 * (ie. the options objects that inherit from others will also get the inherited options).
	 * @param allowDeletion - If true, the values of fields that are null will be deleted.
	 *
	 * @returns Argument a.
	 */


	function deepExtend$1(a, b) {
	  var protoExtend = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
	  var allowDeletion = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;

	  for (var prop in b) {
	    if (Object.prototype.hasOwnProperty.call(b, prop) || protoExtend === true) {
	      if (_typeof_1$1$1(b[prop]) === "object" && b[prop] !== null && getPrototypeOf$2$2(b[prop]) === Object.prototype) {
	        if (a[prop] === undefined) {
	          a[prop] = deepExtend$1({}, b[prop], protoExtend); // NOTE: allowDeletion not propagated!
	        } else if (_typeof_1$1$1(a[prop]) === "object" && a[prop] !== null && getPrototypeOf$2$2(a[prop]) === Object.prototype) {
	          deepExtend$1(a[prop], b[prop], protoExtend); // NOTE: allowDeletion not propagated!
	        } else {
	          copyOrDelete$1(a, b, prop, allowDeletion);
	        }
	      } else if (isArray$5$1(b[prop])) {
	        var _context;

	        a[prop] = slice$2$2(_context = b[prop]).call(_context);
	      } else {
	        copyOrDelete$1(a, b, prop, allowDeletion);
	      }
	    }
	  }

	  return a;
	}
	/**
	 * Convert an object into another type
	 *
	 * @param object - Value of unknown type.
	 * @param type - Name of the desired type.
	 *
	 * @returns Object in the desired type.
	 * @throws Error
	 */


	function convert(object, type) {
	  var match;

	  if (object === undefined) {
	    return undefined;
	  }

	  if (object === null) {
	    return null;
	  }

	  if (!type) {
	    return object;
	  }

	  if (!(typeof type === "string") && !(type instanceof String)) {
	    throw new Error("Type must be a string");
	  } //noinspection FallthroughInSwitchStatementJS


	  switch (type) {
	    case "boolean":
	    case "Boolean":
	      return Boolean(object);

	    case "number":
	    case "Number":
	      if (isString$1(object) && !isNaN(Date.parse(object))) {
	        return moment(object).valueOf();
	      } else {
	        // @TODO: I don't think that Number and String constructors are a good idea.
	        // This could also fail if the object doesn't have valueOf method or if it's redefined.
	        // For example: Object.create(null) or { valueOf: 7 }.
	        return Number(object.valueOf());
	      }

	    case "string":
	    case "String":
	      return String(object);

	    case "Date":
	      if (isNumber$1(object)) {
	        return new Date(object);
	      }

	      if (object instanceof Date) {
	        return new Date(object.valueOf());
	      } else if (isMoment(object)) {
	        return new Date(object.valueOf());
	      }

	      if (isString$1(object)) {
	        match = ASPDateRegex$1.exec(object);

	        if (match) {
	          // object is an ASP date
	          return new Date(Number(match[1])); // parse number
	        } else {
	          return moment(new Date(object)).toDate(); // parse string
	        }
	      } else {
	        throw new Error("Cannot convert object of type " + getType$1(object) + " to type Date");
	      }

	    case "Moment":
	      if (isNumber$1(object)) {
	        return moment(object);
	      }

	      if (object instanceof Date) {
	        return moment(object.valueOf());
	      } else if (isMoment(object)) {
	        return moment(object);
	      }

	      if (isString$1(object)) {
	        match = ASPDateRegex$1.exec(object);

	        if (match) {
	          // object is an ASP date
	          return moment(Number(match[1])); // parse number
	        } else {
	          return moment(object); // parse string
	        }
	      } else {
	        throw new Error("Cannot convert object of type " + getType$1(object) + " to type Date");
	      }

	    case "ISODate":
	      if (isNumber$1(object)) {
	        return new Date(object);
	      } else if (object instanceof Date) {
	        return object.toISOString();
	      } else if (isMoment(object)) {
	        return object.toDate().toISOString();
	      } else if (isString$1(object)) {
	        match = ASPDateRegex$1.exec(object);

	        if (match) {
	          // object is an ASP date
	          return new Date(Number(match[1])).toISOString(); // parse number
	        } else {
	          return moment(object).format(); // ISO 8601
	        }
	      } else {
	        throw new Error("Cannot convert object of type " + getType$1(object) + " to type ISODate");
	      }

	    case "ASPDate":
	      if (isNumber$1(object)) {
	        return "/Date(" + object + ")/";
	      } else if (object instanceof Date || isMoment(object)) {
	        return "/Date(" + object.valueOf() + ")/";
	      } else if (isString$1(object)) {
	        match = ASPDateRegex$1.exec(object);

	        var _value;

	        if (match) {
	          // object is an ASP date
	          _value = new Date(Number(match[1])).valueOf(); // parse number
	        } else {
	          _value = new Date(object).valueOf(); // parse string
	        }

	        return "/Date(" + _value + ")/";
	      } else {
	        throw new Error("Cannot convert object of type " + getType$1(object) + " to type ASPDate");
	      }

	    default:
	      var never = type;
	      throw new Error("Unknown type ".concat(never));
	  }
	}
	/**
	 * Get the type of an object, for example exports.getType([]) returns 'Array'
	 *
	 * @param object - Input value of unknown type.
	 *
	 * @returns Detected type.
	 */


	function getType$1(object) {
	  var type = _typeof_1$1$1(object);

	  if (type === "object") {
	    if (object === null) {
	      return "null";
	    }

	    if (object instanceof Boolean) {
	      return "Boolean";
	    }

	    if (object instanceof Number) {
	      return "Number";
	    }

	    if (object instanceof String) {
	      return "String";
	    }

	    if (isArray$5$1(object)) {
	      return "Array";
	    }

	    if (object instanceof Date) {
	      return "Date";
	    }

	    return "Object";
	  }

	  if (type === "number") {
	    return "Number";
	  }

	  if (type === "boolean") {
	    return "Boolean";
	  }

	  if (type === "string") {
	    return "String";
	  }

	  if (type === undefined) {
	    return "undefined";
	  }

	  return type;
	}
	/**
	 * Determine whether a value can be used as an id.
	 *
	 * @param value - Input value of unknown type.
	 *
	 * @returns True if the value is valid id, false otherwise.
	 */


	function isId(value) {
	  return typeof value === "string" || typeof value === "number";
	}
	/* eslint @typescript-eslint/member-ordering: ["error", { "classes": ["field", "constructor", "method"] }] */

	/**
	 * A queue.
	 *
	 * @typeParam T - The type of method names to be replaced by queued versions.
	 */


	var Queue =
	/*#__PURE__*/
	function () {
	  /**
	   * Construct a new Queue.
	   *
	   * @param options - Queue configuration.
	   */
	  function Queue(options) {
	    classCallCheck$1(this, Queue);
	    this._queue = [];
	    this._timeout = null;
	    this._extended = null; // options

	    this.delay = null;
	    this.max = Infinity;
	    this.setOptions(options);
	  }
	  /**
	   * Update the configuration of the queue.
	   *
	   * @param options - Queue configuration.
	   */


	  createClass$1(Queue, [{
	    key: "setOptions",
	    value: function setOptions(options) {
	      if (options && typeof options.delay !== "undefined") {
	        this.delay = options.delay;
	      }

	      if (options && typeof options.max !== "undefined") {
	        this.max = options.max;
	      }

	      this._flushIfNeeded();
	    }
	    /**
	     * Extend an object with queuing functionality.
	     * The object will be extended with a function flush, and the methods provided in options.replace will be replaced with queued ones.
	     *
	     * @param object - The object to be extended.
	     * @param options - Additional options.
	     *
	     * @returns The created queue.
	     */

	  }, {
	    key: "destroy",

	    /**
	     * Destroy the queue. The queue will first flush all queued actions, and in case it has extended an object, will restore the original object.
	     */
	    value: function destroy() {
	      this.flush();

	      if (this._extended) {
	        var object = this._extended.object;
	        var methods = this._extended.methods;

	        for (var i = 0; i < methods.length; i++) {
	          var method = methods[i];

	          if (method.original) {
	            // @TODO: better solution?
	            object[method.name] = method.original;
	          } else {
	            // @TODO: better solution?
	            delete object[method.name];
	          }
	        }

	        this._extended = null;
	      }
	    }
	    /**
	     * Replace a method on an object with a queued version.
	     *
	     * @param object - Object having the method.
	     * @param method - The method name.
	     */

	  }, {
	    key: "replace",
	    value: function replace(object, method) {
	      /* eslint-disable-next-line @typescript-eslint/no-this-alias */
	      var me = this;
	      var original = object[method];

	      if (!original) {
	        throw new Error("Method " + method + " undefined");
	      }

	      object[method] = function () {
	        for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
	          args[_key] = arguments[_key];
	        } // add this call to the queue


	        me.queue({
	          args: args,
	          fn: original,
	          context: this
	        });
	      };
	    }
	    /**
	     * Queue a call.
	     *
	     * @param entry - The function or entry to be queued.
	     */

	  }, {
	    key: "queue",
	    value: function queue(entry) {
	      if (typeof entry === "function") {
	        this._queue.push({
	          fn: entry
	        });
	      } else {
	        this._queue.push(entry);
	      }

	      this._flushIfNeeded();
	    }
	    /**
	     * Check whether the queue needs to be flushed.
	     */

	  }, {
	    key: "_flushIfNeeded",
	    value: function _flushIfNeeded() {
	      var _this = this; // flush when the maximum is exceeded.


	      if (this._queue.length > this.max) {
	        this.flush();
	      } // flush after a period of inactivity when a delay is configured


	      if (this._timeout != null) {
	        clearTimeout(this._timeout);
	        this._timeout = null;
	      }

	      if (this.queue.length > 0 && typeof this.delay === "number") {
	        this._timeout = setTimeout$2(function () {
	          _this.flush();
	        }, this.delay);
	      }
	    }
	    /**
	     * Flush all queued calls
	     */

	  }, {
	    key: "flush",
	    value: function flush() {
	      var _context15, _context16;

	      forEach$2(_context15 = splice$2(_context16 = this._queue).call(_context16, 0)).call(_context15, function (entry) {
	        entry.fn.apply(entry.context || entry.fn, entry.args || []);
	      });
	    }
	  }], [{
	    key: "extend",
	    value: function extend(object, options) {
	      var queue = new Queue(options);

	      if (object.flush !== undefined) {
	        throw new Error("Target object already has a property flush");
	      }

	      object.flush = function () {
	        queue.flush();
	      };

	      var methods = [{
	        name: "flush",
	        original: undefined
	      }];

	      if (options && options.replace) {
	        for (var i = 0; i < options.replace.length; i++) {
	          var name = options.replace[i];
	          methods.push({
	            name: name,
	            // @TODO: better solution?
	            original: object[name]
	          }); // @TODO: better solution?

	          queue.replace(object, name);
	        }
	      }

	      queue._extended = {
	        object: object,
	        methods: methods
	      };
	      return queue;
	    }
	  }]);
	  return Queue;
	}();
	/* eslint-disable @typescript-eslint/member-ordering */

	/**
	 * [[DataSet]] code that can be reused in [[DataView]] or other similar implementations of [[DataInterface]].
	 *
	 * @typeParam Item - Item type that may or may not have an id.
	 * @typeParam IdProp - Name of the property that contains the id.
	 */


	var DataSetPart =
	/*#__PURE__*/
	function () {
	  function DataSetPart() {
	    classCallCheck$1(this, DataSetPart);
	    this._subscribers = {
	      "*": [],
	      add: [],
	      remove: [],
	      update: []
	    };
	    /**
	     * @deprecated Use on instead (PS: DataView.subscribe === DataView.on).
	     */

	    this.subscribe = DataSetPart.prototype.on;
	    /**
	     * @deprecated Use off instead (PS: DataView.unsubscribe === DataView.off).
	     */

	    this.unsubscribe = DataSetPart.prototype.off;
	  }
	  /**
	   * Trigger an event
	   *
	   * @param event - Event name.
	   * @param payload - Event payload.
	   * @param senderId - Id of the sender.
	   */


	  createClass$1(DataSetPart, [{
	    key: "_trigger",
	    value: function _trigger(event, payload, senderId) {
	      var _context17, _context18;

	      if (event === "*") {
	        throw new Error("Cannot trigger event *");
	      }

	      forEach$2(_context17 = concat$2(_context18 = []).call(_context18, toConsumableArray$1(this._subscribers[event]), toConsumableArray$1(this._subscribers["*"]))).call(_context17, function (subscriber) {
	        subscriber(event, payload, senderId != null ? senderId : null);
	      });
	    }
	    /**
	     * Subscribe to an event, add an event listener.
	     *
	     * @remarks Non-function callbacks are ignored.
	     *
	     * @param event - Event name.
	     * @param callback - Callback method.
	     */

	  }, {
	    key: "on",
	    value: function on(event, callback) {
	      if (typeof callback === "function") {
	        this._subscribers[event].push(callback);
	      } // @TODO: Maybe throw for invalid callbacks?

	    }
	    /**
	     * Unsubscribe from an event, remove an event listener.
	     *
	     * @remarks If the same callback was subscribed more than once **all** occurences will be removed.
	     *
	     * @param event - Event name.
	     * @param callback - Callback method.
	     */

	  }, {
	    key: "off",
	    value: function off(event, callback) {
	      var _context19;

	      this._subscribers[event] = filter$2(_context19 = this._subscribers[event]).call(_context19, function (subscriber) {
	        return subscriber !== callback;
	      });
	    }
	  }]);
	  return DataSetPart;
	}();

	function _arrayWithHoles(arr) {
	  if (isArray$3(arr)) return arr;
	}

	var arrayWithHoles = _arrayWithHoles;

	function _iterableToArrayLimit(arr, i) {
	  var _arr = [];
	  var _n = true;
	  var _d = false;
	  var _e = undefined;

	  try {
	    for (var _i = getIterator$5(arr), _s; !(_n = (_s = _i.next()).done); _n = true) {
	      _arr.push(_s.value);

	      if (i && _arr.length === i) break;
	    }
	  } catch (err) {
	    _d = true;
	    _e = err;
	  } finally {
	    try {
	      if (!_n && _i["return"] != null) _i["return"]();
	    } finally {
	      if (_d) throw _e;
	    }
	  }

	  return _arr;
	}

	var iterableToArrayLimit = _iterableToArrayLimit;

	function _nonIterableRest() {
	  throw new TypeError("Invalid attempt to destructure non-iterable instance");
	}

	var nonIterableRest = _nonIterableRest;

	function _slicedToArray(arr, i) {
	  return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || nonIterableRest();
	}

	var slicedToArray = _slicedToArray;
	/**
	 * Data stream
	 *
	 * @remarks
	 * [[DataStream]] offers an always up to date stream of items from a [[DataSet]] or [[DataView]].
	 * That means that the stream is evaluated at the time of iteration, conversion to another data type or when [[cache]] is called, not when the [[DataStream]] was created.
	 * Multiple invocations of for example [[toItemArray]] may yield different results (if the data source like for example [[DataSet]] gets modified).
	 *
	 * @typeparam Item - The item type this stream is going to work with.
	 */

	var DataStream =
	/*#__PURE__*/
	function () {
	  /**
	   * Create a new data stream.
	   *
	   * @param _pairs - The id, item pairs.
	   */
	  function DataStream(_pairs) {
	    classCallCheck$1(this, DataStream);
	    this._pairs = _pairs;
	  }
	  /**
	   * Return an iterable of key, value pairs for every entry in the stream.
	   */


	  createClass$1(DataStream, [{
	    key: iterator$5,
	    value:
	    /*#__PURE__*/
	    regenerator.mark(function value() {
	      var _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step$value, id, item;

	      return regenerator.wrap(function value$(_context) {
	        while (1) {
	          switch (_context.prev = _context.next) {
	            case 0:
	              _iteratorNormalCompletion = true;
	              _didIteratorError = false;
	              _iteratorError = undefined;
	              _context.prev = 3;
	              _iterator = getIterator$5(this._pairs);

	            case 5:
	              if (_iteratorNormalCompletion = (_step = _iterator.next()).done) {
	                _context.next = 12;
	                break;
	              }

	              _step$value = slicedToArray(_step.value, 2), id = _step$value[0], item = _step$value[1];
	              _context.next = 9;
	              return [id, item];

	            case 9:
	              _iteratorNormalCompletion = true;
	              _context.next = 5;
	              break;

	            case 12:
	              _context.next = 18;
	              break;

	            case 14:
	              _context.prev = 14;
	              _context.t0 = _context["catch"](3);
	              _didIteratorError = true;
	              _iteratorError = _context.t0;

	            case 18:
	              _context.prev = 18;
	              _context.prev = 19;

	              if (!_iteratorNormalCompletion && _iterator.return != null) {
	                _iterator.return();
	              }

	            case 21:
	              _context.prev = 21;

	              if (!_didIteratorError) {
	                _context.next = 24;
	                break;
	              }

	              throw _iteratorError;

	            case 24:
	              return _context.finish(21);

	            case 25:
	              return _context.finish(18);

	            case 26:
	            case "end":
	              return _context.stop();
	          }
	        }
	      }, value, this, [[3, 14, 18, 26], [19,, 21, 25]]);
	    })
	    /**
	     * Return an iterable of key, value pairs for every entry in the stream.
	     */

	  }, {
	    key: "entries",
	    value:
	    /*#__PURE__*/
	    regenerator.mark(function entries() {
	      var _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, _step2$value, id, item;

	      return regenerator.wrap(function entries$(_context2) {
	        while (1) {
	          switch (_context2.prev = _context2.next) {
	            case 0:
	              _iteratorNormalCompletion2 = true;
	              _didIteratorError2 = false;
	              _iteratorError2 = undefined;
	              _context2.prev = 3;
	              _iterator2 = getIterator$5(this._pairs);

	            case 5:
	              if (_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done) {
	                _context2.next = 12;
	                break;
	              }

	              _step2$value = slicedToArray(_step2.value, 2), id = _step2$value[0], item = _step2$value[1];
	              _context2.next = 9;
	              return [id, item];

	            case 9:
	              _iteratorNormalCompletion2 = true;
	              _context2.next = 5;
	              break;

	            case 12:
	              _context2.next = 18;
	              break;

	            case 14:
	              _context2.prev = 14;
	              _context2.t0 = _context2["catch"](3);
	              _didIteratorError2 = true;
	              _iteratorError2 = _context2.t0;

	            case 18:
	              _context2.prev = 18;
	              _context2.prev = 19;

	              if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
	                _iterator2.return();
	              }

	            case 21:
	              _context2.prev = 21;

	              if (!_didIteratorError2) {
	                _context2.next = 24;
	                break;
	              }

	              throw _iteratorError2;

	            case 24:
	              return _context2.finish(21);

	            case 25:
	              return _context2.finish(18);

	            case 26:
	            case "end":
	              return _context2.stop();
	          }
	        }
	      }, entries, this, [[3, 14, 18, 26], [19,, 21, 25]]);
	    })
	    /**
	     * Return an iterable of keys in the stream.
	     */

	  }, {
	    key: "keys",
	    value:
	    /*#__PURE__*/
	    regenerator.mark(function keys() {
	      var _iteratorNormalCompletion3, _didIteratorError3, _iteratorError3, _iterator3, _step3, _step3$value, id;

	      return regenerator.wrap(function keys$(_context3) {
	        while (1) {
	          switch (_context3.prev = _context3.next) {
	            case 0:
	              _iteratorNormalCompletion3 = true;
	              _didIteratorError3 = false;
	              _iteratorError3 = undefined;
	              _context3.prev = 3;
	              _iterator3 = getIterator$5(this._pairs);

	            case 5:
	              if (_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done) {
	                _context3.next = 12;
	                break;
	              }

	              _step3$value = slicedToArray(_step3.value, 1), id = _step3$value[0];
	              _context3.next = 9;
	              return id;

	            case 9:
	              _iteratorNormalCompletion3 = true;
	              _context3.next = 5;
	              break;

	            case 12:
	              _context3.next = 18;
	              break;

	            case 14:
	              _context3.prev = 14;
	              _context3.t0 = _context3["catch"](3);
	              _didIteratorError3 = true;
	              _iteratorError3 = _context3.t0;

	            case 18:
	              _context3.prev = 18;
	              _context3.prev = 19;

	              if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
	                _iterator3.return();
	              }

	            case 21:
	              _context3.prev = 21;

	              if (!_didIteratorError3) {
	                _context3.next = 24;
	                break;
	              }

	              throw _iteratorError3;

	            case 24:
	              return _context3.finish(21);

	            case 25:
	              return _context3.finish(18);

	            case 26:
	            case "end":
	              return _context3.stop();
	          }
	        }
	      }, keys, this, [[3, 14, 18, 26], [19,, 21, 25]]);
	    })
	    /**
	     * Return an iterable of values in the stream.
	     */

	  }, {
	    key: "values",
	    value:
	    /*#__PURE__*/
	    regenerator.mark(function values() {
	      var _iteratorNormalCompletion4, _didIteratorError4, _iteratorError4, _iterator4, _step4, _step4$value, item;

	      return regenerator.wrap(function values$(_context4) {
	        while (1) {
	          switch (_context4.prev = _context4.next) {
	            case 0:
	              _iteratorNormalCompletion4 = true;
	              _didIteratorError4 = false;
	              _iteratorError4 = undefined;
	              _context4.prev = 3;
	              _iterator4 = getIterator$5(this._pairs);

	            case 5:
	              if (_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done) {
	                _context4.next = 12;
	                break;
	              }

	              _step4$value = slicedToArray(_step4.value, 2), item = _step4$value[1];
	              _context4.next = 9;
	              return item;

	            case 9:
	              _iteratorNormalCompletion4 = true;
	              _context4.next = 5;
	              break;

	            case 12:
	              _context4.next = 18;
	              break;

	            case 14:
	              _context4.prev = 14;
	              _context4.t0 = _context4["catch"](3);
	              _didIteratorError4 = true;
	              _iteratorError4 = _context4.t0;

	            case 18:
	              _context4.prev = 18;
	              _context4.prev = 19;

	              if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
	                _iterator4.return();
	              }

	            case 21:
	              _context4.prev = 21;

	              if (!_didIteratorError4) {
	                _context4.next = 24;
	                break;
	              }

	              throw _iteratorError4;

	            case 24:
	              return _context4.finish(21);

	            case 25:
	              return _context4.finish(18);

	            case 26:
	            case "end":
	              return _context4.stop();
	          }
	        }
	      }, values, this, [[3, 14, 18, 26], [19,, 21, 25]]);
	    })
	    /**
	     * Return an array containing all the ids in this stream.
	     *
	     * @remarks
	     * The array may contain duplicities.
	     *
	     * @returns The array with all ids from this stream.
	     */

	  }, {
	    key: "toIdArray",
	    value: function toIdArray() {
	      var _context20;

	      return map$2(_context20 = toConsumableArray$1(this._pairs)).call(_context20, function (pair) {
	        return pair[0];
	      });
	    }
	    /**
	     * Return an array containing all the items in this stream.
	     *
	     * @remarks
	     * The array may contain duplicities.
	     *
	     * @returns The array with all items from this stream.
	     */

	  }, {
	    key: "toItemArray",
	    value: function toItemArray() {
	      var _context21;

	      return map$2(_context21 = toConsumableArray$1(this._pairs)).call(_context21, function (pair) {
	        return pair[1];
	      });
	    }
	    /**
	     * Return an array containing all the entries in this stream.
	     *
	     * @remarks
	     * The array may contain duplicities.
	     *
	     * @returns The array with all entries from this stream.
	     */

	  }, {
	    key: "toEntryArray",
	    value: function toEntryArray() {
	      return toConsumableArray$1(this._pairs);
	    }
	    /**
	     * Return an object map containing all the items in this stream accessible by ids.
	     *
	     * @remarks
	     * In case of duplicate ids (coerced to string so `7 == '7'`) the last encoutered appears in the returned object.
	     *
	     * @returns The object map of all id → item pairs from this stream.
	     */

	  }, {
	    key: "toObjectMap",
	    value: function toObjectMap() {
	      var map = create$2(null);

	      var _iteratorNormalCompletion5 = true;
	      var _didIteratorError5 = false;
	      var _iteratorError5 = undefined;

	      try {
	        for (var _iterator5 = getIterator$5(this._pairs), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
	          var _step5$value = slicedToArray(_step5.value, 2),
	              id = _step5$value[0],
	              item = _step5$value[1];

	          map[id] = item;
	        }
	      } catch (err) {
	        _didIteratorError5 = true;
	        _iteratorError5 = err;
	      } finally {
	        try {
	          if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
	            _iterator5.return();
	          }
	        } finally {
	          if (_didIteratorError5) {
	            throw _iteratorError5;
	          }
	        }
	      }

	      return map;
	    }
	    /**
	     * Return a map containing all the items in this stream accessible by ids.
	     *
	     * @returns The map of all id → item pairs from this stream.
	     */

	  }, {
	    key: "toMap",
	    value: function toMap() {
	      return new map$6(this._pairs);
	    }
	    /**
	     * Return a set containing all the (unique) ids in this stream.
	     *
	     * @returns The set of all ids from this stream.
	     */

	  }, {
	    key: "toIdSet",
	    value: function toIdSet() {
	      return new set$4(this.toIdArray());
	    }
	    /**
	     * Return a set containing all the (unique) items in this stream.
	     *
	     * @returns The set of all items from this stream.
	     */

	  }, {
	    key: "toItemSet",
	    value: function toItemSet() {
	      return new set$4(this.toItemArray());
	    }
	    /**
	     * Cache the items from this stream.
	     *
	     * @remarks
	     * This method allows for items to be fetched immediatelly and used (possibly multiple times) later.
	     * It can also be used to optimize performance as [[DataStream]] would otherwise reevaluate everything upon each iteration.
	     *
	     * ## Example
	     * ```javascript
	     * const ds = new DataSet([…])
	     *
	     * const cachedStream = ds.stream()
	     *   .filter(…)
	     *   .sort(…)
	     *   .map(…)
	     *   .cached(…) // Data are fetched, processed and cached here.
	     *
	     * ds.clear()
	     * chachedStream // Still has all the items.
	     * ```
	     *
	     * @returns A new [[DataStream]] with cached items (detached from the original [[DataSet]]).
	     */

	  }, {
	    key: "cache",
	    value: function cache() {
	      return new DataStream(toConsumableArray$1(this._pairs));
	    }
	    /**
	     * Get the distinct values of given property.
	     *
	     * @param callback - The function that picks and possibly converts the property.
	     *
	     * @typeparam T - The type of the distinct value.
	     *
	     * @returns A set of all distinct properties.
	     */

	  }, {
	    key: "distinct",
	    value: function distinct(callback) {
	      var set = new set$4();
	      var _iteratorNormalCompletion6 = true;
	      var _didIteratorError6 = false;
	      var _iteratorError6 = undefined;

	      try {
	        for (var _iterator6 = getIterator$5(this._pairs), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
	          var _step6$value = slicedToArray(_step6.value, 2),
	              id = _step6$value[0],
	              item = _step6$value[1];

	          set.add(callback(item, id));
	        }
	      } catch (err) {
	        _didIteratorError6 = true;
	        _iteratorError6 = err;
	      } finally {
	        try {
	          if (!_iteratorNormalCompletion6 && _iterator6.return != null) {
	            _iterator6.return();
	          }
	        } finally {
	          if (_didIteratorError6) {
	            throw _iteratorError6;
	          }
	        }
	      }

	      return set;
	    }
	    /**
	     * Filter the items of the stream.
	     *
	     * @param callback - The function that decides whether an item will be included.
	     *
	     * @returns A new data stream with the filtered items.
	     */

	  }, {
	    key: "filter",
	    value: function filter(callback) {
	      var pairs = this._pairs;
	      return new DataStream(defineProperty$b({}, iterator$5,
	      /*#__PURE__*/
	      regenerator.mark(function _callee() {
	        var _iteratorNormalCompletion7, _didIteratorError7, _iteratorError7, _iterator7, _step7, _step7$value, id, item;

	        return regenerator.wrap(function _callee$(_context5) {
	          while (1) {
	            switch (_context5.prev = _context5.next) {
	              case 0:
	                _iteratorNormalCompletion7 = true;
	                _didIteratorError7 = false;
	                _iteratorError7 = undefined;
	                _context5.prev = 3;
	                _iterator7 = getIterator$5(pairs);

	              case 5:
	                if (_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done) {
	                  _context5.next = 13;
	                  break;
	                }

	                _step7$value = slicedToArray(_step7.value, 2), id = _step7$value[0], item = _step7$value[1];

	                if (!callback(item, id)) {
	                  _context5.next = 10;
	                  break;
	                }

	                _context5.next = 10;
	                return [id, item];

	              case 10:
	                _iteratorNormalCompletion7 = true;
	                _context5.next = 5;
	                break;

	              case 13:
	                _context5.next = 19;
	                break;

	              case 15:
	                _context5.prev = 15;
	                _context5.t0 = _context5["catch"](3);
	                _didIteratorError7 = true;
	                _iteratorError7 = _context5.t0;

	              case 19:
	                _context5.prev = 19;
	                _context5.prev = 20;

	                if (!_iteratorNormalCompletion7 && _iterator7.return != null) {
	                  _iterator7.return();
	                }

	              case 22:
	                _context5.prev = 22;

	                if (!_didIteratorError7) {
	                  _context5.next = 25;
	                  break;
	                }

	                throw _iteratorError7;

	              case 25:
	                return _context5.finish(22);

	              case 26:
	                return _context5.finish(19);

	              case 27:
	              case "end":
	                return _context5.stop();
	            }
	          }
	        }, _callee, null, [[3, 15, 19, 27], [20,, 22, 26]]);
	      })));
	    }
	    /**
	     * Execute a callback for each item of the stream.
	     *
	     * @param callback - The function that will be invoked for each item.
	     */

	  }, {
	    key: "forEach",
	    value: function forEach(callback) {
	      var _iteratorNormalCompletion8 = true;
	      var _didIteratorError8 = false;
	      var _iteratorError8 = undefined;

	      try {
	        for (var _iterator8 = getIterator$5(this._pairs), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {
	          var _step8$value = slicedToArray(_step8.value, 2),
	              id = _step8$value[0],
	              item = _step8$value[1];

	          callback(item, id);
	        }
	      } catch (err) {
	        _didIteratorError8 = true;
	        _iteratorError8 = err;
	      } finally {
	        try {
	          if (!_iteratorNormalCompletion8 && _iterator8.return != null) {
	            _iterator8.return();
	          }
	        } finally {
	          if (_didIteratorError8) {
	            throw _iteratorError8;
	          }
	        }
	      }
	    }
	    /**
	     * Map the items into a different type.
	     *
	     * @param callback - The function that does the conversion.
	     *
	     * @typeparam Mapped - The type of the item after mapping.
	     *
	     * @returns A new data stream with the mapped items.
	     */

	  }, {
	    key: "map",
	    value: function map(callback) {
	      var pairs = this._pairs;
	      return new DataStream(defineProperty$b({}, iterator$5,
	      /*#__PURE__*/
	      regenerator.mark(function _callee2() {
	        var _iteratorNormalCompletion9, _didIteratorError9, _iteratorError9, _iterator9, _step9, _step9$value, id, item;

	        return regenerator.wrap(function _callee2$(_context6) {
	          while (1) {
	            switch (_context6.prev = _context6.next) {
	              case 0:
	                _iteratorNormalCompletion9 = true;
	                _didIteratorError9 = false;
	                _iteratorError9 = undefined;
	                _context6.prev = 3;
	                _iterator9 = getIterator$5(pairs);

	              case 5:
	                if (_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done) {
	                  _context6.next = 12;
	                  break;
	                }

	                _step9$value = slicedToArray(_step9.value, 2), id = _step9$value[0], item = _step9$value[1];
	                _context6.next = 9;
	                return [id, callback(item, id)];

	              case 9:
	                _iteratorNormalCompletion9 = true;
	                _context6.next = 5;
	                break;

	              case 12:
	                _context6.next = 18;
	                break;

	              case 14:
	                _context6.prev = 14;
	                _context6.t0 = _context6["catch"](3);
	                _didIteratorError9 = true;
	                _iteratorError9 = _context6.t0;

	              case 18:
	                _context6.prev = 18;
	                _context6.prev = 19;

	                if (!_iteratorNormalCompletion9 && _iterator9.return != null) {
	                  _iterator9.return();
	                }

	              case 21:
	                _context6.prev = 21;

	                if (!_didIteratorError9) {
	                  _context6.next = 24;
	                  break;
	                }

	                throw _iteratorError9;

	              case 24:
	                return _context6.finish(21);

	              case 25:
	                return _context6.finish(18);

	              case 26:
	              case "end":
	                return _context6.stop();
	            }
	          }
	        }, _callee2, null, [[3, 14, 18, 26], [19,, 21, 25]]);
	      })));
	    }
	    /**
	     * Get the item with the maximum value of given property.
	     *
	     * @param callback - The function that picks and possibly converts the property.
	     *
	     * @returns The item with the maximum if found otherwise null.
	     */

	  }, {
	    key: "max",
	    value: function max(callback) {
	      var iter = getIterator$5(this._pairs);

	      var curr = iter.next();

	      if (curr.done) {
	        return null;
	      }

	      var maxItem = curr.value[1];
	      var maxValue = callback(curr.value[1], curr.value[0]);

	      while (!(curr = iter.next()).done) {
	        var _curr$value = slicedToArray(curr.value, 2),
	            id = _curr$value[0],
	            item = _curr$value[1];

	        var _value = callback(item, id);

	        if (_value > maxValue) {
	          maxValue = _value;
	          maxItem = item;
	        }
	      }

	      return maxItem;
	    }
	    /**
	     * Get the item with the minimum value of given property.
	     *
	     * @param callback - The function that picks and possibly converts the property.
	     *
	     * @returns The item with the minimum if found otherwise null.
	     */

	  }, {
	    key: "min",
	    value: function min(callback) {
	      var iter = getIterator$5(this._pairs);

	      var curr = iter.next();

	      if (curr.done) {
	        return null;
	      }

	      var minItem = curr.value[1];
	      var minValue = callback(curr.value[1], curr.value[0]);

	      while (!(curr = iter.next()).done) {
	        var _curr$value2 = slicedToArray(curr.value, 2),
	            id = _curr$value2[0],
	            item = _curr$value2[1];

	        var _value2 = callback(item, id);

	        if (_value2 < minValue) {
	          minValue = _value2;
	          minItem = item;
	        }
	      }

	      return minItem;
	    }
	    /**
	     * Reduce the items into a single value.
	     *
	     * @param callback - The function that does the reduction.
	     * @param accumulator - The initial value of the accumulator.
	     *
	     * @typeparam T - The type of the accumulated value.
	     *
	     * @returns The reduced value.
	     */

	  }, {
	    key: "reduce",
	    value: function reduce(callback, accumulator) {
	      var _iteratorNormalCompletion10 = true;
	      var _didIteratorError10 = false;
	      var _iteratorError10 = undefined;

	      try {
	        for (var _iterator10 = getIterator$5(this._pairs), _step10; !(_iteratorNormalCompletion10 = (_step10 = _iterator10.next()).done); _iteratorNormalCompletion10 = true) {
	          var _step10$value = slicedToArray(_step10.value, 2),
	              id = _step10$value[0],
	              item = _step10$value[1];

	          accumulator = callback(accumulator, item, id);
	        }
	      } catch (err) {
	        _didIteratorError10 = true;
	        _iteratorError10 = err;
	      } finally {
	        try {
	          if (!_iteratorNormalCompletion10 && _iterator10.return != null) {
	            _iterator10.return();
	          }
	        } finally {
	          if (_didIteratorError10) {
	            throw _iteratorError10;
	          }
	        }
	      }

	      return accumulator;
	    }
	    /**
	     * Sort the items.
	     *
	     * @param callback - Item comparator.
	     *
	     * @returns A new stream with sorted items.
	     */

	  }, {
	    key: "sort",
	    value: function sort(callback) {
	      var _this = this;

	      return new DataStream(defineProperty$b({}, iterator$5, function () {
	        var _context22;

	        return getIterator$5(sort$2(_context22 = toConsumableArray$1(_this._pairs)).call(_context22, function (_ref3, _ref4) {
	          var _ref5 = slicedToArray(_ref3, 2),
	              idA = _ref5[0],
	              itemA = _ref5[1];

	          var _ref6 = slicedToArray(_ref4, 2),
	              idB = _ref6[0],
	              itemB = _ref6[1];

	          return callback(itemA, itemB, idA, idB);
	        }));
	      }));
	    }
	  }]);
	  return DataStream;
	}();

	function ownKeys$1$1(object, enumerableOnly) {
	  var keys = keys$6(object);

	  if (getOwnPropertySymbols$2) {
	    keys.push.apply(keys, getOwnPropertySymbols$2(object));
	  }

	  if (enumerableOnly) keys = filter$2(keys).call(keys, function (sym) {
	    return getOwnPropertyDescriptor$3(object, sym).enumerable;
	  });
	  return keys;
	}

	function _objectSpread$1(target) {
	  for (var i = 1; i < arguments.length; i++) {
	    var source = arguments[i] != null ? arguments[i] : {};

	    if (i % 2) {
	      var _context23;

	      forEach$2(_context23 = ownKeys$1$1(source, true)).call(_context23, function (key) {
	        defineProperty$b(target, key, source[key]);
	      });
	    } else if (getOwnPropertyDescriptors$5) {
	      defineProperties$1(target, getOwnPropertyDescriptors$5(source));
	    } else {
	      var _context24;

	      forEach$2(_context24 = ownKeys$1$1(source)).call(_context24, function (key) {
	        defineProperty$3(target, key, getOwnPropertyDescriptor$3(source, key));
	      });
	    }
	  }

	  return target;
	}
	/**
	 * # DataSet
	 *
	 * Vis.js comes with a flexible DataSet, which can be used to hold and manipulate unstructured data and listen for changes in the data. The DataSet is key/value based. Data items can be added, updated and removed from the DataSet, and one can subscribe to changes in the DataSet. The data in the DataSet can be filtered and ordered, and fields (like dates) can be converted to a specific type. Data can be normalized when appending it to the DataSet as well.
	 *
	 * ## Example
	 *
	 * The following example shows how to use a DataSet.
	 *
	 * ```javascript
	 * // create a DataSet
	 * var options = {};
	 * var data = new vis.DataSet(options);
	 *
	 * // add items
	 * // note that the data items can contain different properties and data formats
	 * data.add([
	 *   {id: 1, text: 'item 1', date: new Date(2013, 6, 20), group: 1, first: true},
	 *   {id: 2, text: 'item 2', date: '2013-06-23', group: 2},
	 *   {id: 3, text: 'item 3', date: '2013-06-25', group: 2},
	 *   {id: 4, text: 'item 4'}
	 * ]);
	 *
	 * // subscribe to any change in the DataSet
	 * data.on('*', function (event, properties, senderId) {
	 *   console.log('event', event, properties);
	 * });
	 *
	 * // update an existing item
	 * data.update({id: 2, group: 1});
	 *
	 * // remove an item
	 * data.remove(4);
	 *
	 * // get all ids
	 * var ids = data.getIds();
	 * console.log('ids', ids);
	 *
	 * // get a specific item
	 * var item1 = data.get(1);
	 * console.log('item1', item1);
	 *
	 * // retrieve a filtered subset of the data
	 * var items = data.get({
	 *   filter: function (item) {
	 *     return item.group == 1;
	 *   }
	 * });
	 * console.log('filtered items', items);
	 *
	 * // retrieve formatted items
	 * var items = data.get({
	 *   fields: ['id', 'date'],
	 *   type: {
	 *     date: 'ISODate'
	 *   }
	 * });
	 * console.log('formatted items', items);
	 * ```
	 *
	 * @typeParam Item - Item type that may or may not have an id.
	 * @typeParam IdProp - Name of the property that contains the id.
	 */


	var DataSet =
	/*#__PURE__*/
	function (_DataSetPart) {
	  inherits(DataSet, _DataSetPart);
	  /**
	   * Construct a new DataSet.
	   *
	   * @param data - Initial data or options.
	   * @param options - Options (type error if data is also options).
	   */

	  function DataSet(data, options) {
	    var _this;

	    classCallCheck$1(this, DataSet);
	    _this = possibleConstructorReturn(this, getPrototypeOf$4(DataSet).call(this)); // correctly read optional arguments

	    if (data && !isArray$3(data)) {
	      options = data;
	      data = [];
	    }

	    _this._options = options || {};
	    _this._data = new map$6(); // map with data indexed by id

	    _this.length = 0; // number of items in the DataSet

	    _this._idProp = _this._options.fieldId || "id"; // name of the field containing id

	    _this._type = {}; // internal field types (NOTE: this can differ from this._options.type)
	    // all variants of a Date are internally stored as Date, so we can convert
	    // from everything to everything (also from ISODate to Number for example)

	    if (_this._options.type) {
	      var fields = keys$6(_this._options.type);

	      for (var i = 0, len = fields.length; i < len; i++) {
	        var field = fields[i];
	        var value = _this._options.type[field];

	        if (value == "Date" || value == "ISODate" || value == "ASPDate") {
	          _this._type[field] = "Date";
	        } else {
	          _this._type[field] = value;
	        }
	      }
	    } // add initial data when provided


	    if (data && data.length) {
	      _this.add(data);
	    }

	    _this.setOptions(options);

	    return _this;
	  }
	  /**
	   * Set new options.
	   *
	   * @param options - The new options.
	   */


	  createClass$1(DataSet, [{
	    key: "setOptions",
	    value: function setOptions(options) {
	      if (options && options.queue !== undefined) {
	        if (options.queue === false) {
	          // delete queue if loaded
	          if (this._queue) {
	            this._queue.destroy();

	            delete this._queue;
	          }
	        } else {
	          // create queue and update its options
	          if (!this._queue) {
	            this._queue = Queue.extend(this, {
	              replace: ["add", "update", "remove"]
	            });
	          }

	          if (options.queue && _typeof_1$2(options.queue) === "object") {
	            this._queue.setOptions(options.queue);
	          }
	        }
	      }
	    }
	    /**
	     * Add a data item or an array with items.
	     *
	     * After the items are added to the DataSet, the DataSet will trigger an event `add`. When a `senderId` is provided, this id will be passed with the triggered event to all subscribers.
	     *
	     * ## Example
	     *
	     * ```javascript
	     * // create a DataSet
	     * const data = new vis.DataSet()
	     *
	     * // add items
	     * const ids = data.add([
	     *   { id: 1, text: 'item 1' },
	     *   { id: 2, text: 'item 2' },
	     *   { text: 'item without an id' }
	     * ])
	     *
	     * console.log(ids) // [1, 2, '<UUIDv4>']
	     * ```
	     *
	     * @param data - Items to be added (ids will be generated if missing).
	     * @param senderId - Sender id.
	     *
	     * @returns addedIds - Array with the ids (generated if not present) of the added items.
	     *
	     * @throws When an item with the same id as any of the added items already exists.
	     */

	  }, {
	    key: "add",
	    value: function add(data, senderId) {
	      var _this2 = this;

	      var addedIds = [];
	      var id;

	      if (isArray$3(data)) {
	        // Array
	        var idsToAdd = map$2(data).call(data, function (d) {
	          return d[_this2._idProp];
	        });

	        if (some$2(idsToAdd).call(idsToAdd, function (id) {
	          return _this2._data.has(id);
	        })) {
	          throw new Error("A duplicate id was found in the parameter array.");
	        }

	        for (var i = 0, len = data.length; i < len; i++) {
	          id = this._addItem(data[i]);
	          addedIds.push(id);
	        }
	      } else if (data && _typeof_1$2(data) === "object") {
	        // Single item
	        id = this._addItem(data);
	        addedIds.push(id);
	      } else {
	        throw new Error("Unknown dataType");
	      }

	      if (addedIds.length) {
	        this._trigger("add", {
	          items: addedIds
	        }, senderId);
	      }

	      return addedIds;
	    }
	    /**
	     * Update existing items. When an item does not exist, it will be created.
	     *
	     * @remarks
	     * The provided properties will be merged in the existing item. When an item does not exist, it will be created.
	     *
	     * After the items are updated, the DataSet will trigger an event `add` for the added items, and an event `update`. When a `senderId` is provided, this id will be passed with the triggered event to all subscribers.
	     *
	     * ## Example
	     *
	     * ```javascript
	     * // create a DataSet
	     * const data = new vis.DataSet([
	     *   { id: 1, text: 'item 1' },
	     *   { id: 2, text: 'item 2' },
	     *   { id: 3, text: 'item 3' }
	     * ])
	     *
	     * // update items
	     * const ids = data.update([
	     *   { id: 2, text: 'item 2 (updated)' },
	     *   { id: 4, text: 'item 4 (new)' }
	     * ])
	     *
	     * console.log(ids) // [2, 4]
	     * ```
	     *
	     * ## Warning for TypeScript users
	     * This method may introduce partial items into the data set. Use add or updateOnly instead for better type safety.
	     *
	     * @param data - Items to be updated (if the id is already present) or added (if the id is missing).
	     * @param senderId - Sender id.
	     *
	     * @returns updatedIds - The ids of the added (these may be newly generated if there was no id in the item from the data) or updated items.
	     *
	     * @throws When the supplied data is neither an item nor an array of items.
	     */

	  }, {
	    key: "update",
	    value: function update(data, senderId) {
	      var _this3 = this;

	      var addedIds = [];
	      var updatedIds = [];
	      var oldData = [];
	      var updatedData = [];
	      var idProp = this._idProp;

	      var addOrUpdate = function addOrUpdate(item) {
	        var origId = item[idProp];

	        if (origId != null && _this3._data.has(origId)) {
	          var fullItem = item; // it has an id, therefore it is a fullitem

	          var oldItem = assign$2({}, _this3._data.get(origId)); // update item


	          var id = _this3._updateItem(fullItem);

	          updatedIds.push(id);
	          updatedData.push(fullItem);
	          oldData.push(oldItem);
	        } else {
	          // add new item
	          var _id = _this3._addItem(item);

	          addedIds.push(_id);
	        }
	      };

	      if (isArray$3(data)) {
	        // Array
	        for (var i = 0, len = data.length; i < len; i++) {
	          if (data[i] && _typeof_1$2(data[i]) === "object") {
	            addOrUpdate(data[i]);
	          } else {
	            console.warn("Ignoring input item, which is not an object at index " + i);
	          }
	        }
	      } else if (data && _typeof_1$2(data) === "object") {
	        // Single item
	        addOrUpdate(data);
	      } else {
	        throw new Error("Unknown dataType");
	      }

	      if (addedIds.length) {
	        this._trigger("add", {
	          items: addedIds
	        }, senderId);
	      }

	      if (updatedIds.length) {
	        var props = {
	          items: updatedIds,
	          oldData: oldData,
	          data: updatedData
	        }; // TODO: remove deprecated property 'data' some day
	        //Object.defineProperty(props, 'data', {
	        //  'get': (function() {
	        //    console.warn('Property data is deprecated. Use DataSet.get(ids) to retrieve the new data, use the oldData property on this object to get the old data');
	        //    return updatedData;
	        //  }).bind(this)
	        //});

	        this._trigger("update", props, senderId);
	      }

	      return concat$2(addedIds).call(addedIds, updatedIds);
	    }
	    /**
	     * Update existing items. When an item does not exist, an error will be thrown.
	     *
	     * @remarks
	     * The provided properties will be deeply merged into the existing item.
	     * When an item does not exist (id not present in the data set or absent), an error will be thrown and nothing will be changed.
	     *
	     * After the items are updated, the DataSet will trigger an event `update`.
	     * When a `senderId` is provided, this id will be passed with the triggered event to all subscribers.
	     *
	     * ## Example
	     *
	     * ```javascript
	     * // create a DataSet
	     * const data = new vis.DataSet([
	     *   { id: 1, text: 'item 1' },
	     *   { id: 2, text: 'item 2' },
	     *   { id: 3, text: 'item 3' },
	     * ])
	     *
	     * // update items
	     * const ids = data.update([
	     *   { id: 2, text: 'item 2 (updated)' }, // works
	     *   // { id: 4, text: 'item 4 (new)' }, // would throw
	     *   // { text: 'item 4 (new)' }, // would also throw
	     * ])
	     *
	     * console.log(ids) // [2]
	     * ```
	     *
	     * @param data - Updates (the id and optionally other props) to the items in this data set.
	     * @param senderId - Sender id.
	     *
	     * @returns updatedIds - The ids of the updated items.
	     *
	     * @throws When the supplied data is neither an item nor an array of items, when the ids are missing.
	     */

	  }, {
	    key: "updateOnly",
	    value: function updateOnly(data, senderId) {
	      var _context25;

	      var _this4 = this;

	      if (!isArray$3(data)) {
	        data = [data];
	      }

	      var updateEventData = map$2(_context25 = map$2(data).call(data, function (update) {
	        var oldData = _this4._data.get(update[_this4._idProp]);

	        if (oldData == null) {
	          throw new Error("Updating non-existent items is not allowed.");
	        }

	        return {
	          oldData: oldData,
	          update: update
	        };
	      })).call(_context25, function (_ref) {
	        var oldData = _ref.oldData,
	            update = _ref.update;
	        var id = oldData[_this4._idProp];
	        var updatedData = deepExtend$1(deepExtend$1({}, oldData), update);

	        _this4._data.set(id, updatedData);

	        return {
	          id: id,
	          oldData: oldData,
	          updatedData: updatedData
	        };
	      });

	      if (updateEventData.length) {
	        var props = {
	          items: map$2(updateEventData).call(updateEventData, function (value) {
	            return value.id;
	          }),
	          oldData: map$2(updateEventData).call(updateEventData, function (value) {
	            return value.oldData;
	          }),
	          data: map$2(updateEventData).call(updateEventData, function (value) {
	            return value.updatedData;
	          })
	        }; // TODO: remove deprecated property 'data' some day
	        //Object.defineProperty(props, 'data', {
	        //  'get': (function() {
	        //    console.warn('Property data is deprecated. Use DataSet.get(ids) to retrieve the new data, use the oldData property on this object to get the old data');
	        //    return updatedData;
	        //  }).bind(this)
	        //});

	        this._trigger("update", props, senderId);

	        return props.items;
	      } else {
	        return [];
	      }
	    }
	    /** @inheritdoc */

	  }, {
	    key: "get",
	    value: function get(first, second) {
	      // @TODO: Woudn't it be better to split this into multiple methods?
	      // parse the arguments
	      var id = undefined;
	      var ids = undefined;
	      var options = undefined;

	      if (isId(first)) {
	        // get(id [, options])
	        id = first;
	        options = second;
	      } else if (isArray$3(first)) {
	        // get(ids [, options])
	        ids = first;
	        options = second;
	      } else {
	        // get([, options])
	        options = first;
	      } // determine the return type


	      var returnType = options && options.returnType === "Object" ? "Object" : "Array"; // @TODO: WTF is this? Or am I missing something?
	      // var returnType
	      // if (options && options.returnType) {
	      //   var allowedValues = ['Array', 'Object']
	      //   returnType =
	      //     allowedValues.indexOf(options.returnType) == -1
	      //       ? 'Array'
	      //       : options.returnType
	      // } else {
	      //   returnType = 'Array'
	      // }
	      // build options

	      var type = options && options.type || this._options.type;

	      var filter = options && filter$2(options);

	      var items = [];
	      var item = null;
	      var itemIds = null;
	      var itemId = null; // convert items

	      if (id != null) {
	        // return a single item
	        item = this._getItem(id, type);

	        if (item && filter && !filter(item)) {
	          item = null;
	        }
	      } else if (ids != null) {
	        // return a subset of items
	        for (var i = 0, len = ids.length; i < len; i++) {
	          item = this._getItem(ids[i], type);

	          if (item != null && (!filter || filter(item))) {
	            items.push(item);
	          }
	        }
	      } else {
	        var _context26;

	        // return all items
	        itemIds = toConsumableArray$1(keys$3(_context26 = this._data).call(_context26));

	        for (var _i = 0, _len = itemIds.length; _i < _len; _i++) {
	          itemId = itemIds[_i];
	          item = this._getItem(itemId, type);

	          if (item != null && (!filter || filter(item))) {
	            items.push(item);
	          }
	        }
	      } // order the results


	      if (options && options.order && id == undefined) {
	        this._sort(items, options.order);
	      } // filter fields of the items


	      if (options && options.fields) {
	        var fields = options.fields;

	        if (id != undefined && item != null) {
	          item = this._filterFields(item, fields);
	        } else {
	          for (var _i2 = 0, _len2 = items.length; _i2 < _len2; _i2++) {
	            items[_i2] = this._filterFields(items[_i2], fields);
	          }
	        }
	      } // return the results


	      if (returnType == "Object") {
	        var result = {};

	        for (var _i3 = 0, _len3 = items.length; _i3 < _len3; _i3++) {
	          var resultant = items[_i3]; // @TODO: Shoudn't this be this._fieldId?
	          // result[resultant.id] = resultant

	          var _id2 = resultant[this._idProp];
	          result[_id2] = resultant;
	        }

	        return result;
	      } else {
	        if (id != null) {
	          // a single item
	          return item;
	        } else {
	          // just return our array
	          return items;
	        }
	      }
	    }
	    /** @inheritdoc */

	  }, {
	    key: "getIds",
	    value: function getIds(options) {
	      var data = this._data;

	      var filter = options && filter$2(options);

	      var order = options && options.order;
	      var type = options && options.type || this._options.type;
	      var itemIds = toConsumableArray$1(keys$3(data).call(data));
	      var ids = [];
	      var item;
	      var items;

	      if (filter) {
	        // get filtered items
	        if (order) {
	          // create ordered list
	          items = [];

	          for (var i = 0, len = itemIds.length; i < len; i++) {
	            var id = itemIds[i];
	            item = this._getItem(id, type);

	            if (filter(item)) {
	              items.push(item);
	            }
	          }

	          this._sort(items, order);

	          for (var _i4 = 0, _len4 = items.length; _i4 < _len4; _i4++) {
	            ids.push(items[_i4][this._idProp]);
	          }
	        } else {
	          // create unordered list
	          for (var _i5 = 0, _len5 = itemIds.length; _i5 < _len5; _i5++) {
	            var _id3 = itemIds[_i5];
	            item = this._getItem(_id3, type);

	            if (filter(item)) {
	              ids.push(item[this._idProp]);
	            }
	          }
	        }
	      } else {
	        // get all items
	        if (order) {
	          // create an ordered list
	          items = [];

	          for (var _i6 = 0, _len6 = itemIds.length; _i6 < _len6; _i6++) {
	            var _id4 = itemIds[_i6];
	            items.push(data.get(_id4));
	          }

	          this._sort(items, order);

	          for (var _i7 = 0, _len7 = items.length; _i7 < _len7; _i7++) {
	            ids.push(items[_i7][this._idProp]);
	          }
	        } else {
	          // create unordered list
	          for (var _i8 = 0, _len8 = itemIds.length; _i8 < _len8; _i8++) {
	            var _id5 = itemIds[_i8];
	            item = data.get(_id5);
	            ids.push(item[this._idProp]);
	          }
	        }
	      }

	      return ids;
	    }
	    /** @inheritdoc */

	  }, {
	    key: "getDataSet",
	    value: function getDataSet() {
	      return this;
	    }
	    /** @inheritdoc */

	  }, {
	    key: "forEach",
	    value: function forEach(callback, options) {
	      var filter = options && filter$2(options);

	      var type = options && options.type || this._options.type;
	      var data = this._data;
	      var itemIds = toConsumableArray$1(keys$3(data).call(data));

	      if (options && options.order) {
	        // execute forEach on ordered list
	        var items = this.get(options);

	        for (var i = 0, len = items.length; i < len; i++) {
	          var item = items[i];
	          var id = item[this._idProp];
	          callback(item, id);
	        }
	      } else {
	        // unordered
	        for (var _i9 = 0, _len9 = itemIds.length; _i9 < _len9; _i9++) {
	          var _id6 = itemIds[_i9];

	          var _item = this._getItem(_id6, type);

	          if (!filter || filter(_item)) {
	            callback(_item, _id6);
	          }
	        }
	      }
	    }
	    /** @inheritdoc */

	  }, {
	    key: "map",
	    value: function map(callback, options) {
	      var filter = options && filter$2(options);

	      var type = options && options.type || this._options.type;
	      var mappedItems = [];
	      var data = this._data;
	      var itemIds = toConsumableArray$1(keys$3(data).call(data)); // convert and filter items

	      for (var i = 0, len = itemIds.length; i < len; i++) {
	        var id = itemIds[i];

	        var item = this._getItem(id, type);

	        if (!filter || filter(item)) {
	          mappedItems.push(callback(item, id));
	        }
	      } // order items


	      if (options && options.order) {
	        this._sort(mappedItems, options.order);
	      }

	      return mappedItems;
	    }
	    /**
	     * Filter the fields of an item.
	     *
	     * @param item - The item whose fields should be filtered.
	     * @param fields - The names of the fields that will be kept.
	     *
	     * @typeParam K - Field name type.
	     *
	     * @returns The item without any additional fields.
	     */

	  }, {
	    key: "_filterFields",
	    value: function _filterFields(item, fields) {
	      var _context27;

	      if (!item) {
	        // item is null
	        return item;
	      }

	      return reduce$2(_context27 = isArray$3(fields) ? // Use the supplied array
	      fields : // Use the keys of the supplied object
	      keys$6(fields)).call(_context27, function (filteredItem, field) {
	        filteredItem[field] = item[field];
	        return filteredItem;
	      }, {});
	    }
	    /**
	     * Sort the provided array with items.
	     *
	     * @param items - Items to be sorted in place.
	     * @param order - A field name or custom sort function.
	     *
	     * @typeParam T - The type of the items in the items array.
	     */

	  }, {
	    key: "_sort",
	    value: function _sort(items, order) {
	      if (typeof order === "string") {
	        // order by provided field name
	        var name = order; // field name

	        sort$2(items).call(items, function (a, b) {
	          // @TODO: How to treat missing properties?
	          var av = a[name];
	          var bv = b[name];
	          return av > bv ? 1 : av < bv ? -1 : 0;
	        });
	      } else if (typeof order === "function") {
	        // order by sort function
	        sort$2(items).call(items, order);
	      } else {
	        // TODO: extend order by an Object {field:string, direction:string}
	        //       where direction can be 'asc' or 'desc'
	        throw new TypeError("Order must be a function or a string");
	      }
	    }
	    /**
	     * Remove an item or multiple items by “reference” (only the id is used) or by id.
	     *
	     * The method ignores removal of non-existing items, and returns an array containing the ids of the items which are actually removed from the DataSet.
	     *
	     * After the items are removed, the DataSet will trigger an event `remove` for the removed items. When a `senderId` is provided, this id will be passed with the triggered event to all subscribers.
	     *
	     * ## Example
	     * ```javascript
	     * // create a DataSet
	     * const data = new vis.DataSet([
	     *   { id: 1, text: 'item 1' },
	     *   { id: 2, text: 'item 2' },
	     *   { id: 3, text: 'item 3' }
	     * ])
	     *
	     * // remove items
	     * const ids = data.remove([2, { id: 3 }, 4])
	     *
	     * console.log(ids) // [2, 3]
	     * ```
	     *
	     * @param id - One or more items or ids of items to be removed.
	     * @param senderId - Sender id.
	     *
	     * @returns The ids of the removed items.
	     */

	  }, {
	    key: "remove",
	    value: function remove(id, senderId) {
	      var removedIds = [];
	      var removedItems = []; // force everything to be an array for simplicity

	      var ids = isArray$3(id) ? id : [id];

	      for (var i = 0, len = ids.length; i < len; i++) {
	        var item = this._remove(ids[i]);

	        if (item) {
	          var itemId = item[this._idProp];

	          if (itemId != null) {
	            removedIds.push(itemId);
	            removedItems.push(item);
	          }
	        }
	      }

	      if (removedIds.length) {
	        this._trigger("remove", {
	          items: removedIds,
	          oldData: removedItems
	        }, senderId);
	      }

	      return removedIds;
	    }
	    /**
	     * Remove an item by its id or reference.
	     *
	     * @param id - Id of an item or the item itself.
	     *
	     * @returns The removed item if removed, null otherwise.
	     */

	  }, {
	    key: "_remove",
	    value: function _remove(id) {
	      // @TODO: It origianlly returned the item although the docs say id.
	      // The code expects the item, so probably an error in the docs.
	      var ident; // confirm the id to use based on the args type

	      if (isId(id)) {
	        ident = id;
	      } else if (id && _typeof_1$2(id) === "object") {
	        ident = id[this._idProp]; // look for the identifier field using ._idProp
	      } // do the removing if the item is found


	      if (ident != null && this._data.has(ident)) {
	        var item = this._data.get(ident) || null;

	        this._data.delete(ident);

	        --this.length;
	        return item;
	      }

	      return null;
	    }
	    /**
	     * Clear the entire data set.
	     *
	     * After the items are removed, the [[DataSet]] will trigger an event `remove` for all removed items. When a `senderId` is provided, this id will be passed with the triggered event to all subscribers.
	     *
	     * @param senderId - Sender id.
	     *
	     * @returns removedIds - The ids of all removed items.
	     */

	  }, {
	    key: "clear",
	    value: function clear(senderId) {
	      var _context28;

	      var ids = toConsumableArray$1(keys$3(_context28 = this._data).call(_context28));
	      var items = [];

	      for (var i = 0, len = ids.length; i < len; i++) {
	        items.push(this._data.get(ids[i]));
	      }

	      this._data.clear();

	      this.length = 0;

	      this._trigger("remove", {
	        items: ids,
	        oldData: items
	      }, senderId);

	      return ids;
	    }
	    /**
	     * Find the item with maximum value of a specified field.
	     *
	     * @param field - Name of the property that should be searched for max value.
	     *
	     * @returns Item containing max value, or null if no items.
	     */

	  }, {
	    key: "max",
	    value: function max(field) {
	      var max = null;
	      var maxField = null;
	      var _iteratorNormalCompletion = true;
	      var _didIteratorError = false;
	      var _iteratorError = undefined;

	      try {
	        for (var _iterator = getIterator$5(values$2(_context29 = this._data).call(_context29)), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
	          var _context29;

	          var item = _step.value;
	          var itemField = item[field];

	          if (typeof itemField === "number" && (maxField == null || itemField > maxField)) {
	            max = item;
	            maxField = itemField;
	          }
	        }
	      } catch (err) {
	        _didIteratorError = true;
	        _iteratorError = err;
	      } finally {
	        try {
	          if (!_iteratorNormalCompletion && _iterator.return != null) {
	            _iterator.return();
	          }
	        } finally {
	          if (_didIteratorError) {
	            throw _iteratorError;
	          }
	        }
	      }

	      return max || null;
	    }
	    /**
	     * Find the item with minimum value of a specified field.
	     *
	     * @param field - Name of the property that should be searched for min value.
	     *
	     * @returns Item containing min value, or null if no items.
	     */

	  }, {
	    key: "min",
	    value: function min(field) {
	      var min = null;
	      var minField = null;
	      var _iteratorNormalCompletion2 = true;
	      var _didIteratorError2 = false;
	      var _iteratorError2 = undefined;

	      try {
	        for (var _iterator2 = getIterator$5(values$2(_context30 = this._data).call(_context30)), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
	          var _context30;

	          var item = _step2.value;
	          var itemField = item[field];

	          if (typeof itemField === "number" && (minField == null || itemField < minField)) {
	            min = item;
	            minField = itemField;
	          }
	        }
	      } catch (err) {
	        _didIteratorError2 = true;
	        _iteratorError2 = err;
	      } finally {
	        try {
	          if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
	            _iterator2.return();
	          }
	        } finally {
	          if (_didIteratorError2) {
	            throw _iteratorError2;
	          }
	        }
	      }

	      return min || null;
	    }
	    /**
	     * Find all distinct values of a specified field
	     *
	     * @param prop - The property name whose distinct values should be returned.
	     *
	     * @returns Unordered array containing all distinct values. Items without specified property are ignored.
	     */

	  }, {
	    key: "distinct",
	    value: function distinct(prop) {
	      var data = this._data;
	      var itemIds = toConsumableArray$1(keys$3(data).call(data));
	      var values = [];
	      var fieldType = this._options.type && this._options.type[prop] || null;
	      var count = 0;

	      for (var i = 0, len = itemIds.length; i < len; i++) {
	        var id = itemIds[i];
	        var item = data.get(id);
	        var value = item[prop];
	        var exists = false;

	        for (var j = 0; j < count; j++) {
	          if (values[j] == value) {
	            exists = true;
	            break;
	          }
	        }

	        if (!exists && value !== undefined) {
	          values[count] = value;
	          count++;
	        }
	      }

	      if (fieldType) {
	        for (var _i10 = 0, _len10 = values.length; _i10 < _len10; _i10++) {
	          values[_i10] = convert(values[_i10], fieldType);
	        }
	      }

	      return values;
	    }
	    /**
	     * Add a single item. Will fail when an item with the same id already exists.
	     *
	     * @param item - A new item to be added.
	     *
	     * @returns Added item's id. An id is generated when it is not present in the item.
	     */

	  }, {
	    key: "_addItem",
	    value: function _addItem(item) {
	      var id = item[this._idProp];

	      if (id != null) {
	        // check whether this id is already taken
	        if (this._data.has(id)) {
	          // item already exists
	          throw new Error("Cannot add item: item with id " + id + " already exists");
	        }
	      } else {
	        // generate an id
	        id = uuid4$1();
	        item[this._idProp] = id;
	      }

	      var d = {};

	      var fields = keys$6(item);

	      for (var i = 0, len = fields.length; i < len; i++) {
	        var field = fields[i];
	        var fieldType = this._type[field]; // type may be undefined

	        d[field] = convert(item[field], fieldType);
	      }

	      this._data.set(id, d);

	      ++this.length;
	      return id;
	    }
	    /**
	     * Get an item. Fields can be converted to a specific type
	     *
	     * @param id - Id of the requested item.
	     * @param types - Property name to type name object map of type converstions.
	     *
	     * @returns The item, optionally after type conversion.
	     */

	  }, {
	    key: "_getItem",
	    value: function _getItem(id, types) {
	      // @TODO: I have no idea how to type this.
	      // get the item from the dataset
	      var raw = this._data.get(id);

	      if (!raw) {
	        return null;
	      } // convert the items field types


	      var converted;

	      var fields = keys$6(raw);

	      if (types) {
	        converted = {};

	        for (var i = 0, len = fields.length; i < len; i++) {
	          var field = fields[i];
	          var value = raw[field];
	          converted[field] = convert(value, types[field]);
	        }
	      } else {
	        // no field types specified, no converting needed
	        converted = _objectSpread$1({}, raw);
	      }

	      if (converted[this._idProp] == null) {
	        converted[this._idProp] = raw.id;
	      }

	      return converted;
	    }
	    /**
	     * Update a single item: merge with existing item.
	     * Will fail when the item has no id, or when there does not exist an item with the same id.
	     *
	     * @param item - The new item
	     *
	     * @returns The id of the updated item.
	     */

	  }, {
	    key: "_updateItem",
	    value: function _updateItem(item) {
	      var id = item[this._idProp];

	      if (id == null) {
	        throw new Error("Cannot update item: item has no id (item: " + stringify$2(item) + ")");
	      }

	      var d = this._data.get(id);

	      if (!d) {
	        // item doesn't exist
	        throw new Error("Cannot update item: no item with id " + id + " found");
	      } // merge with current item


	      var fields = keys$6(item);

	      for (var i = 0, len = fields.length; i < len; i++) {
	        var field = fields[i];
	        var fieldType = this._type[field]; // type may be undefined

	        d[field] = convert(item[field], fieldType);
	      }

	      return id;
	    }
	    /** @inheritdoc */

	  }, {
	    key: "stream",
	    value: function stream(ids) {
	      if (ids) {
	        var data = this._data;
	        return new DataStream(defineProperty$b({}, iterator$5,
	        /*#__PURE__*/
	        regenerator.mark(function _callee() {
	          var _iteratorNormalCompletion3, _didIteratorError3, _iteratorError3, _iterator3, _step3, id, item;

	          return regenerator.wrap(function _callee$(_context) {
	            while (1) {
	              switch (_context.prev = _context.next) {
	                case 0:
	                  _iteratorNormalCompletion3 = true;
	                  _didIteratorError3 = false;
	                  _iteratorError3 = undefined;
	                  _context.prev = 3;
	                  _iterator3 = getIterator$5(ids);

	                case 5:
	                  if (_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done) {
	                    _context.next = 14;
	                    break;
	                  }

	                  id = _step3.value;
	                  item = data.get(id);

	                  if (!(item != null)) {
	                    _context.next = 11;
	                    break;
	                  }

	                  _context.next = 11;
	                  return [id, item];

	                case 11:
	                  _iteratorNormalCompletion3 = true;
	                  _context.next = 5;
	                  break;

	                case 14:
	                  _context.next = 20;
	                  break;

	                case 16:
	                  _context.prev = 16;
	                  _context.t0 = _context["catch"](3);
	                  _didIteratorError3 = true;
	                  _iteratorError3 = _context.t0;

	                case 20:
	                  _context.prev = 20;
	                  _context.prev = 21;

	                  if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
	                    _iterator3.return();
	                  }

	                case 23:
	                  _context.prev = 23;

	                  if (!_didIteratorError3) {
	                    _context.next = 26;
	                    break;
	                  }

	                  throw _iteratorError3;

	                case 26:
	                  return _context.finish(23);

	                case 27:
	                  return _context.finish(20);

	                case 28:
	                case "end":
	                  return _context.stop();
	              }
	            }
	          }, _callee, null, [[3, 16, 20, 28], [21,, 23, 27]]);
	        })));
	      } else {
	        var _context31;

	        return new DataStream(defineProperty$b({}, iterator$5, bind$2(_context31 = entries$2(this._data)).call(_context31, this._data)));
	      }
	    }
	  }]);
	  return DataSet;
	}(DataSetPart);
	/**
	 * DataView
	 *
	 * A DataView offers a filtered and/or formatted view on a DataSet. One can subscribe to changes in a DataView, and easily get filtered or formatted data without having to specify filters and field types all the time.
	 *
	 * ## Example
	 * ```javascript
	 * // create a DataSet
	 * var data = new vis.DataSet();
	 * data.add([
	 *   {id: 1, text: 'item 1', date: new Date(2013, 6, 20), group: 1, first: true},
	 *   {id: 2, text: 'item 2', date: '2013-06-23', group: 2},
	 *   {id: 3, text: 'item 3', date: '2013-06-25', group: 2},
	 *   {id: 4, text: 'item 4'}
	 * ]);
	 *
	 * // create a DataView
	 * // the view will only contain items having a property group with value 1,
	 * // and will only output fields id, text, and date.
	 * var view = new vis.DataView(data, {
	 *   filter: function (item) {
	 *     return (item.group == 1);
	 *   },
	 *   fields: ['id', 'text', 'date']
	 * });
	 *
	 * // subscribe to any change in the DataView
	 * view.on('*', function (event, properties, senderId) {
	 *   console.log('event', event, properties);
	 * });
	 *
	 * // update an item in the data set
	 * data.update({id: 2, group: 1});
	 *
	 * // get all ids in the view
	 * var ids = view.getIds();
	 * console.log('ids', ids); // will output [1, 2]
	 *
	 * // get all items in the view
	 * var items = view.get();
	 * ```
	 *
	 * @typeParam Item - Item type that may or may not have an id.
	 * @typeParam IdProp - Name of the property that contains the id.
	 */


	var DataView =
	/*#__PURE__*/
	function (_DataSetPart) {
	  inherits(DataView, _DataSetPart);
	  /**
	   * Create a DataView.
	   *
	   * @param data - The instance containing data (directly or indirectly).
	   * @param options - Options to configure this data view.
	   */

	  function DataView(data, options) {
	    var _context32;

	    var _this;

	    classCallCheck$1(this, DataView);
	    _this = possibleConstructorReturn(this, getPrototypeOf$4(DataView).call(this));
	    /** @inheritdoc */

	    _this.length = 0;
	    _this._ids = new set$4(); // ids of the items currently in memory (just contains a boolean true)

	    _this._options = options || {};
	    _this._listener = bind$2(_context32 = _this._onEvent).call(_context32, assertThisInitialized(_this));

	    _this.setData(data);

	    return _this;
	  } // TODO: implement a function .config() to dynamically update things like configured filter
	  // and trigger changes accordingly

	  /**
	   * Set a data source for the view.
	   *
	   * @param data - The instance containing data (directly or indirectly).
	   */


	  createClass$1(DataView, [{
	    key: "setData",
	    value: function setData(data) {
	      if (this._data) {
	        // unsubscribe from current dataset
	        if (this._data.off) {
	          this._data.off("*", this._listener);
	        } // trigger a remove of all items in memory


	        var ids = this._data.getIds({
	          filter: filter$2(this._options)
	        });

	        var items = this._data.get(ids);

	        this._ids.clear();

	        this.length = 0;

	        this._trigger("remove", {
	          items: ids,
	          oldData: items
	        });
	      }

	      if (data != null) {
	        this._data = data; // trigger an add of all added items

	        var _ids = this._data.getIds({
	          filter: filter$2(this._options)
	        });

	        for (var i = 0, len = _ids.length; i < len; i++) {
	          var id = _ids[i];

	          this._ids.add(id);
	        }

	        this.length = _ids.length;

	        this._trigger("add", {
	          items: _ids
	        });
	      } else {
	        this._data = new DataSet();
	      } // subscribe to new dataset


	      if (this._data.on) {
	        this._data.on("*", this._listener);
	      }
	    }
	    /**
	     * Refresh the DataView.
	     * Useful when the DataView has a filter function containing a variable parameter.
	     */

	  }, {
	    key: "refresh",
	    value: function refresh() {
	      var ids = this._data.getIds({
	        filter: filter$2(this._options)
	      });

	      var oldIds = toConsumableArray$1(this._ids);
	      var newIds = {};
	      var addedIds = [];
	      var removedIds = [];
	      var removedItems = []; // check for additions

	      for (var i = 0, len = ids.length; i < len; i++) {
	        var id = ids[i];
	        newIds[id] = true;

	        if (!this._ids.has(id)) {
	          addedIds.push(id);

	          this._ids.add(id);
	        }
	      } // check for removals


	      for (var _i = 0, _len = oldIds.length; _i < _len; _i++) {
	        var _id = oldIds[_i];

	        var item = this._data.get(_id);

	        if (item == null) {
	          // @TODO: Investigate.
	          // Doesn't happen during tests or examples.
	          // Is it really impossible or could it eventually happen?
	          // How to handle it if it does? The types guarantee non-nullable items.
	          console.error("If you see this, report it please.");
	        } else if (!newIds[_id]) {
	          removedIds.push(_id);
	          removedItems.push(item);

	          this._ids.delete(_id);
	        }
	      }

	      this.length += addedIds.length - removedIds.length; // trigger events

	      if (addedIds.length) {
	        this._trigger("add", {
	          items: addedIds
	        });
	      }

	      if (removedIds.length) {
	        this._trigger("remove", {
	          items: removedIds,
	          oldData: removedItems
	        });
	      }
	    }
	    /** @inheritdoc */

	  }, {
	    key: "get",
	    value: function get(first, second) {
	      if (this._data == null) {
	        return null;
	      } // parse the arguments


	      var ids = null;
	      var options;

	      if (isId(first) || isArray$3(first)) {
	        ids = first;
	        options = second;
	      } else {
	        options = first;
	      } // extend the options with the default options and provided options


	      var viewOptions = assign$2({}, this._options, options); // create a combined filter method when needed


	      var thisFilter = filter$2(this._options);

	      var optionsFilter = options && filter$2(options);

	      if (thisFilter && optionsFilter) {
	        viewOptions.filter = function (item) {
	          return thisFilter(item) && optionsFilter(item);
	        };
	      }

	      if (ids == null) {
	        return this._data.get(viewOptions);
	      } else {
	        return this._data.get(ids, viewOptions);
	      }
	    }
	    /** @inheritdoc */

	  }, {
	    key: "getIds",
	    value: function getIds(options) {
	      if (this._data.length) {
	        var defaultFilter = filter$2(this._options);

	        var optionsFilter = options != null ? filter$2(options) : null;
	        var filter;

	        if (optionsFilter) {
	          if (defaultFilter) {
	            filter = function filter(item) {
	              return defaultFilter(item) && optionsFilter(item);
	            };
	          } else {
	            filter = optionsFilter;
	          }
	        } else {
	          filter = defaultFilter;
	        }

	        return this._data.getIds({
	          filter: filter,
	          order: options && options.order
	        });
	      } else {
	        return [];
	      }
	    }
	    /** @inheritdoc */

	  }, {
	    key: "forEach",
	    value: function forEach(callback, options) {
	      if (this._data) {
	        var _context33;

	        var defaultFilter = filter$2(this._options);

	        var optionsFilter = options && filter$2(options);

	        var filter;

	        if (optionsFilter) {
	          if (defaultFilter) {
	            filter = function filter(item) {
	              return defaultFilter(item) && optionsFilter(item);
	            };
	          } else {
	            filter = optionsFilter;
	          }
	        } else {
	          filter = defaultFilter;
	        }

	        forEach$2(_context33 = this._data).call(_context33, callback, {
	          filter: filter,
	          order: options && options.order
	        });
	      }
	    }
	    /** @inheritdoc */

	  }, {
	    key: "map",
	    value: function map(callback, options) {
	      if (this._data) {
	        var _context34;

	        var defaultFilter = filter$2(this._options);

	        var optionsFilter = options && filter$2(options);

	        var filter;

	        if (optionsFilter) {
	          if (defaultFilter) {
	            filter = function filter(item) {
	              return defaultFilter(item) && optionsFilter(item);
	            };
	          } else {
	            filter = optionsFilter;
	          }
	        } else {
	          filter = defaultFilter;
	        }

	        return map$2(_context34 = this._data).call(_context34, callback, {
	          filter: filter,
	          order: options && options.order
	        });
	      } else {
	        return [];
	      }
	    }
	    /** @inheritdoc */

	  }, {
	    key: "getDataSet",
	    value: function getDataSet() {
	      return this._data.getDataSet();
	    }
	    /** @inheritdoc */

	  }, {
	    key: "stream",
	    value: function stream(ids) {
	      var _context35;

	      return this._data.stream(ids || defineProperty$b({}, iterator$5, bind$2(_context35 = keys$3(this._ids)).call(_context35, this._ids)));
	    }
	    /**
	     * Event listener. Will propagate all events from the connected data set to the subscribers of the DataView, but will filter the items and only trigger when there are changes in the filtered data set.
	     *
	     * @param event - The name of the event.
	     * @param params - Parameters of the event.
	     * @param senderId - Id supplied by the sender.
	     */

	  }, {
	    key: "_onEvent",
	    value: function _onEvent(event, params, senderId) {
	      if (!params || !params.items || !this._data) {
	        return;
	      }

	      var ids = params.items;
	      var addedIds = [];
	      var updatedIds = [];
	      var removedIds = [];
	      var oldItems = [];
	      var updatedItems = [];
	      var removedItems = [];

	      switch (event) {
	        case "add":
	          // filter the ids of the added items
	          for (var i = 0, len = ids.length; i < len; i++) {
	            var id = ids[i];
	            var item = this.get(id);

	            if (item) {
	              this._ids.add(id);

	              addedIds.push(id);
	            }
	          }

	          break;

	        case "update":
	          // determine the event from the views viewpoint: an updated
	          // item can be added, updated, or removed from this view.
	          for (var _i2 = 0, _len2 = ids.length; _i2 < _len2; _i2++) {
	            var _id2 = ids[_i2];

	            var _item = this.get(_id2);

	            if (_item) {
	              if (this._ids.has(_id2)) {
	                updatedIds.push(_id2);
	                updatedItems.push(params.data[_i2]);
	                oldItems.push(params.oldData[_i2]);
	              } else {
	                this._ids.add(_id2);

	                addedIds.push(_id2);
	              }
	            } else {
	              if (this._ids.has(_id2)) {
	                this._ids.delete(_id2);

	                removedIds.push(_id2);
	                removedItems.push(params.oldData[_i2]);
	              }
	            }
	          }

	          break;

	        case "remove":
	          // filter the ids of the removed items
	          for (var _i3 = 0, _len3 = ids.length; _i3 < _len3; _i3++) {
	            var _id3 = ids[_i3];

	            if (this._ids.has(_id3)) {
	              this._ids.delete(_id3);

	              removedIds.push(_id3);
	              removedItems.push(params.oldData[_i3]);
	            }
	          }

	          break;
	      }

	      this.length += addedIds.length - removedIds.length;

	      if (addedIds.length) {
	        this._trigger("add", {
	          items: addedIds
	        }, senderId);
	      }

	      if (updatedIds.length) {
	        this._trigger("update", {
	          items: updatedIds,
	          oldData: oldItems,
	          data: updatedItems
	        }, senderId);
	      }

	      if (removedIds.length) {
	        this._trigger("remove", {
	          items: removedIds,
	          oldData: removedItems
	        }, senderId);
	      }
	    }
	  }]);
	  return DataView;
	}(DataSetPart);

	var index$1 = {
	  DataSet: DataSet,
	  DataView: DataView,
	  Queue: Queue
	};

	var esm = /*#__PURE__*/Object.freeze({
		__proto__: null,
		'default': index$1,
		DataSet: DataSet,
		DataStream: DataStream,
		DataView: DataView,
		Queue: Queue
	});

	function _defineProperty$2(obj, key, value) {
	  if (key in obj) {
	    defineProperty$8(obj, key, {
	      value: value,
	      enumerable: true,
	      configurable: true,
	      writable: true
	    });
	  } else {
	    obj[key] = value;
	  }

	  return obj;
	}

	var defineProperty$c = _defineProperty$2;

	var isArray$7 = isArray$1;

	var isArray$8 = isArray$7;

	function _arrayWithHoles$1(arr) {
	  if (isArray$8(arr)) return arr;
	}

	var arrayWithHoles$1 = _arrayWithHoles$1;

	function _iterableToArrayLimit$1(arr, i) {
	  if (!(isIterable$5(Object(arr)) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
	    return;
	  }

	  var _arr = [];
	  var _n = true;
	  var _d = false;
	  var _e = undefined;

	  try {
	    for (var _i = getIterator$5(arr), _s; !(_n = (_s = _i.next()).done); _n = true) {
	      _arr.push(_s.value);

	      if (i && _arr.length === i) break;
	    }
	  } catch (err) {
	    _d = true;
	    _e = err;
	  } finally {
	    try {
	      if (!_n && _i["return"] != null) _i["return"]();
	    } finally {
	      if (_d) throw _e;
	    }
	  }

	  return _arr;
	}

	var iterableToArrayLimit$1 = _iterableToArrayLimit$1;

	function _nonIterableRest$1() {
	  throw new TypeError("Invalid attempt to destructure non-iterable instance");
	}

	var nonIterableRest$1 = _nonIterableRest$1;

	function _slicedToArray$1(arr, i) {
	  return arrayWithHoles$1(arr) || iterableToArrayLimit$1(arr, i) || nonIterableRest$1();
	}

	var slicedToArray$1 = _slicedToArray$1;

	/**
	 * Helper functions for components
	 * @class
	 */

	var ComponentUtil =
	/*#__PURE__*/
	function () {
	  function ComponentUtil() {
	    classCallCheck(this, ComponentUtil);
	  }

	  createClass(ComponentUtil, null, [{
	    key: "choosify",

	    /**
	     * Determine values to use for (sub)options of 'chosen'.
	     *
	     * This option is either a boolean or an object whose values should be examined further.
	     * The relevant structures are:
	     *
	     * - chosen: <boolean value>
	     * - chosen: { subOption: <boolean or function> }
	     *
	     * Where subOption is 'node', 'edge' or 'label'.
	     *
	     * The intention of this method appears to be to set a specific priority to the options;
	     * Since most properties are either bridged or merged into the local options objects, there
	     * is not much point in handling them separately.
	     * TODO: examine if 'most' in previous sentence can be replaced with 'all'. In that case, we
	     *       should be able to get rid of this method.
	     *
	     * @param {string}  subOption  option within object 'chosen' to consider; either 'node', 'edge' or 'label'
	     * @param {Object}  pile       array of options objects to consider
	     * 
	     * @return {boolean|function}  value for passed subOption of 'chosen' to use
	     */
	    value: function choosify(subOption, pile) {
	      // allowed values for subOption
	      var allowed = ['node', 'edge', 'label'];
	      var value = true;
	      var chosen = topMost(pile, 'chosen');

	      if (typeof chosen === 'boolean') {
	        value = chosen;
	      } else if (_typeof_1(chosen) === 'object') {
	        if (indexOf$3(allowed).call(allowed, subOption) === -1) {
	          throw new Error('choosify: subOption \'' + subOption + '\' should be one of ' + "'" + allowed.join("', '") + "'");
	        }

	        var chosenEdge = topMost(pile, ['chosen', subOption]);

	        if (typeof chosenEdge === 'boolean' || typeof chosenEdge === 'function') {
	          value = chosenEdge;
	        }
	      }

	      return value;
	    }
	    /**
	     * Check if the point falls within the given rectangle.
	     *
	     * @param {rect} rect
	     * @param {point} point
	     * @param {rotationPoint} [rotationPoint] if specified, the rotation that applies to the rectangle.
	     * @returns {boolean}  true if point within rectangle, false otherwise
	     * @static
	     */

	  }, {
	    key: "pointInRect",
	    value: function pointInRect(rect, point, rotationPoint) {
	      if (rect.width <= 0 || rect.height <= 0) {
	        return false; // early out
	      }

	      if (rotationPoint !== undefined) {
	        // Rotate the point the same amount as the rectangle
	        var tmp = {
	          x: point.x - rotationPoint.x,
	          y: point.y - rotationPoint.y
	        };

	        if (rotationPoint.angle !== 0) {
	          // In order to get the coordinates the same, you need to 
	          // rotate in the reverse direction
	          var angle = -rotationPoint.angle;
	          var tmp2 = {
	            x: Math.cos(angle) * tmp.x - Math.sin(angle) * tmp.y,
	            y: Math.sin(angle) * tmp.x + Math.cos(angle) * tmp.y
	          };
	          point = tmp2;
	        } else {
	          point = tmp;
	        } // Note that if a rotation is specified, the rectangle coordinates
	        // are **not* the full canvas coordinates. They are relative to the
	        // rotationPoint. Hence, the point coordinates need not be translated
	        // back in this case.

	      }

	      var right = rect.x + rect.width;
	      var bottom = rect.y + rect.width;
	      return rect.left < point.x && right > point.x && rect.top < point.y && bottom > point.y;
	    }
	    /**
	     * Check if given value is acceptable as a label text.
	     *
	     * @param {*} text value to check; can be anything at this point
	     * @returns {boolean} true if valid label value, false otherwise
	     */

	  }, {
	    key: "isValidLabel",
	    value: function isValidLabel(text) {
	      // Note that this is quite strict: types that *might* be converted to string are disallowed
	      return typeof text === 'string' && text !== '';
	    }
	  }]);

	  return ComponentUtil;
	}();

	/**
	 * Callback to determine text dimensions, using the parent label settings.
	 * @callback MeasureText
	 * @param {text} text
	 * @param {text} mod
	 * @return {Object} { width, values} width in pixels and font attributes
	 */

	/**
	 * Helper class for Label which collects results of splitting labels into lines and blocks.
	 *
	 * @private
	 */
	var LabelAccumulator =
	/*#__PURE__*/
	function () {
	  /**
	   * @param {MeasureText} measureText
	   */
	  function LabelAccumulator(measureText) {
	    classCallCheck(this, LabelAccumulator);

	    this.measureText = measureText;
	    this.current = 0;
	    this.width = 0;
	    this.height = 0;
	    this.lines = [];
	  }
	  /**
	   * Append given text to the given line.
	   *
	   * @param {number}  l    index of line to add to
	   * @param {string}  text string to append to line
	   * @param {'bold'|'ital'|'boldital'|'mono'|'normal'} [mod='normal']
	   * @private
	   */


	  createClass(LabelAccumulator, [{
	    key: "_add",
	    value: function _add(l, text) {
	      var mod = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'normal';

	      if (this.lines[l] === undefined) {
	        this.lines[l] = {
	          width: 0,
	          height: 0,
	          blocks: []
	        };
	      } // We still need to set a block for undefined and empty texts, hence return at this point
	      // This is necessary because we don't know at this point if we're at the
	      // start of an empty line or not.
	      // To compensate, empty blocks are removed in `finalize()`.
	      //
	      // Empty strings should still have a height


	      var tmpText = text;
	      if (text === undefined || text === "") tmpText = " "; // Determine width and get the font properties

	      var result = this.measureText(tmpText, mod);

	      var block = assign$2({}, values$2(result));

	      block.text = text;
	      block.width = result.width;
	      block.mod = mod;

	      if (text === undefined || text === "") {
	        block.width = 0;
	      }

	      this.lines[l].blocks.push(block); // Update the line width. We need this for determining if a string goes over max width

	      this.lines[l].width += block.width;
	    }
	    /**
	     * Returns the width in pixels of the current line.
	     *
	     * @returns {number}
	     */

	  }, {
	    key: "curWidth",
	    value: function curWidth() {
	      var line = this.lines[this.current];
	      if (line === undefined) return 0;
	      return line.width;
	    }
	    /**
	     * Add text in block to current line
	     *
	     * @param {string} text
	     * @param {'bold'|'ital'|'boldital'|'mono'|'normal'} [mod='normal']
	     */

	  }, {
	    key: "append",
	    value: function append(text) {
	      var mod = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'normal';

	      this._add(this.current, text, mod);
	    }
	    /**
	     * Add text in block to current line and start a new line
	     *
	     * @param {string} text
	     * @param {'bold'|'ital'|'boldital'|'mono'|'normal'} [mod='normal']
	     */

	  }, {
	    key: "newLine",
	    value: function newLine(text) {
	      var mod = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'normal';

	      this._add(this.current, text, mod);

	      this.current++;
	    }
	    /**
	     * Determine and set the heights of all the lines currently contained in this instance
	     *
	     * Note that width has already been set.
	     * 
	     * @private
	     */

	  }, {
	    key: "determineLineHeights",
	    value: function determineLineHeights() {
	      for (var k = 0; k < this.lines.length; k++) {
	        var line = this.lines[k]; // Looking for max height of blocks in line

	        var height = 0;

	        if (line.blocks !== undefined) {
	          // Can happen if text contains e.g. '\n '
	          for (var l = 0; l < line.blocks.length; l++) {
	            var block = line.blocks[l];

	            if (height < block.height) {
	              height = block.height;
	            }
	          }
	        }

	        line.height = height;
	      }
	    }
	    /**
	     * Determine the full size of the label text, as determined by current lines and blocks
	     * 
	     * @private
	     */

	  }, {
	    key: "determineLabelSize",
	    value: function determineLabelSize() {
	      var width = 0;
	      var height = 0;

	      for (var k = 0; k < this.lines.length; k++) {
	        var line = this.lines[k];

	        if (line.width > width) {
	          width = line.width;
	        }

	        height += line.height;
	      }

	      this.width = width;
	      this.height = height;
	    }
	    /**
	     * Remove all empty blocks and empty lines we don't need
	     * 
	     * This must be done after the width/height determination,
	     * so that these are set properly for processing here.
	     *
	     * @returns {Array<Line>} Lines with empty blocks (and some empty lines) removed
	     * @private
	     */

	  }, {
	    key: "removeEmptyBlocks",
	    value: function removeEmptyBlocks() {
	      var tmpLines = [];

	      for (var k = 0; k < this.lines.length; k++) {
	        var line = this.lines[k]; // Note: an empty line in between text has width zero but is still relevant to layout.
	        // So we can't use width for testing empty line here

	        if (line.blocks.length === 0) continue; // Discard final empty line always

	        if (k === this.lines.length - 1) {
	          if (line.width === 0) continue;
	        }

	        var tmpLine = {};

	        assign$2(tmpLine, line);

	        tmpLine.blocks = [];
	        var firstEmptyBlock = void 0;
	        var tmpBlocks = [];

	        for (var l = 0; l < line.blocks.length; l++) {
	          var block = line.blocks[l];

	          if (block.width !== 0) {
	            tmpBlocks.push(block);
	          } else {
	            if (firstEmptyBlock === undefined) {
	              firstEmptyBlock = block;
	            }
	          }
	        } // Ensure that there is *some* text present


	        if (tmpBlocks.length === 0 && firstEmptyBlock !== undefined) {
	          tmpBlocks.push(firstEmptyBlock);
	        }

	        tmpLine.blocks = tmpBlocks;
	        tmpLines.push(tmpLine);
	      }

	      return tmpLines;
	    }
	    /**
	     * Set the sizes for all lines and the whole thing.
	     *
	     * @returns {{width: (number|*), height: (number|*), lines: Array}}
	     */

	  }, {
	    key: "finalize",
	    value: function finalize() {
	      //console.log(JSON.stringify(this.lines, null, 2));
	      this.determineLineHeights();
	      this.determineLabelSize();
	      var tmpLines = this.removeEmptyBlocks(); // Return a simple hash object for further processing.

	      return {
	        width: this.width,
	        height: this.height,
	        lines: tmpLines
	      };
	    }
	  }]);

	  return LabelAccumulator;
	}();

	var tagPattern = {
	  // HTML
	  '<b>': /<b>/,
	  '<i>': /<i>/,
	  '<code>': /<code>/,
	  '</b>': /<\/b>/,
	  '</i>': /<\/i>/,
	  '</code>': /<\/code>/,
	  // Markdown
	  '*': /\*/,
	  // bold
	  '_': /\_/,
	  // ital
	  '`': /`/,
	  // mono
	  'afterBold': /[^\*]/,
	  'afterItal': /[^_]/,
	  'afterMono': /[^`]/
	};
	/**
	 * Internal helper class for parsing the markup tags for HTML and Markdown.
	 *
	 * NOTE: Sequences of tabs and spaces are reduced to single space.
	 *       Scan usage of `this.spacing` within method
	 */

	var MarkupAccumulator =
	/*#__PURE__*/
	function () {
	  /**
	   * Create an instance
	   *
	   * @param {string} text  text to parse for markup
	   */
	  function MarkupAccumulator(text) {
	    classCallCheck(this, MarkupAccumulator);

	    this.text = text;
	    this.bold = false;
	    this.ital = false;
	    this.mono = false;
	    this.spacing = false;
	    this.position = 0;
	    this.buffer = "";
	    this.modStack = [];
	    this.blocks = [];
	  }
	  /**
	   * Return the mod label currently on the top of the stack
	   *
	   * @returns {string}  label of topmost mod 
	   * @private
	   */


	  createClass(MarkupAccumulator, [{
	    key: "mod",
	    value: function mod() {
	      return this.modStack.length === 0 ? 'normal' : this.modStack[0];
	    }
	    /**
	     * Return the mod label currently active
	     * 
	     * @returns {string}  label of active mod 
	     * @private
	     */

	  }, {
	    key: "modName",
	    value: function modName() {
	      if (this.modStack.length === 0) return 'normal';else if (this.modStack[0] === 'mono') return 'mono';else {
	        if (this.bold && this.ital) {
	          return 'boldital';
	        } else if (this.bold) {
	          return 'bold';
	        } else if (this.ital) {
	          return 'ital';
	        }
	      }
	    }
	    /**
	     * @private
	     */

	  }, {
	    key: "emitBlock",
	    value: function emitBlock() {
	      if (this.spacing) {
	        this.add(" ");
	        this.spacing = false;
	      }

	      if (this.buffer.length > 0) {
	        this.blocks.push({
	          text: this.buffer,
	          mod: this.modName()
	        });
	        this.buffer = "";
	      }
	    }
	    /**
	     * Output text to buffer
	     *
	     * @param {string} text  text to add
	     * @private
	     */

	  }, {
	    key: "add",
	    value: function add(text) {
	      if (text === " ") {
	        this.spacing = true;
	      }

	      if (this.spacing) {
	        this.buffer += " ";
	        this.spacing = false;
	      }

	      if (text != " ") {
	        this.buffer += text;
	      }
	    }
	    /**
	     * Handle parsing of whitespace
	     *
	     * @param {string} ch  the character to check
	     * @returns {boolean} true if the character was processed as whitespace, false otherwise
	     */

	  }, {
	    key: "parseWS",
	    value: function parseWS(ch) {
	      if (/[ \t]/.test(ch)) {
	        if (!this.mono) {
	          this.spacing = true;
	        } else {
	          this.add(ch);
	        }

	        return true;
	      }

	      return false;
	    }
	    /**
	     * @param {string} tagName  label for block type to set
	     * @private
	     */

	  }, {
	    key: "setTag",
	    value: function setTag(tagName) {
	      this.emitBlock();
	      this[tagName] = true;
	      this.modStack.unshift(tagName);
	    }
	    /**
	     * @param {string} tagName  label for block type to unset
	     * @private
	     */

	  }, {
	    key: "unsetTag",
	    value: function unsetTag(tagName) {
	      this.emitBlock();
	      this[tagName] = false;
	      this.modStack.shift();
	    }
	    /**
	     * @param {string} tagName label for block type we are currently processing
	     * @param {string|RegExp} tag string to match in text
	     * @returns {boolean} true if the tag was processed, false otherwise
	     */

	  }, {
	    key: "parseStartTag",
	    value: function parseStartTag(tagName, tag) {
	      // Note: if 'mono' passed as tagName, there is a double check here. This is OK
	      if (!this.mono && !this[tagName] && this.match(tag)) {
	        this.setTag(tagName);
	        return true;
	      }

	      return false;
	    }
	    /**
	     * @param {string|RegExp} tag
	     * @param {number} [advance=true] if set, advance current position in text
	     * @returns {boolean} true if match at given position, false otherwise
	     * @private
	     */

	  }, {
	    key: "match",
	    value: function match(tag) {
	      var advance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;

	      var _this$prepareRegExp = this.prepareRegExp(tag),
	          _this$prepareRegExp2 = slicedToArray$1(_this$prepareRegExp, 2),
	          regExp = _this$prepareRegExp2[0],
	          length = _this$prepareRegExp2[1];

	      var matched = regExp.test(this.text.substr(this.position, length));

	      if (matched && advance) {
	        this.position += length - 1;
	      }

	      return matched;
	    }
	    /**
	     * @param {string} tagName label for block type we are currently processing
	     * @param {string|RegExp} tag string to match in text
	     * @param {RegExp} [nextTag] regular expression to match for characters *following* the current tag 
	     * @returns {boolean} true if the tag was processed, false otherwise
	     */

	  }, {
	    key: "parseEndTag",
	    value: function parseEndTag(tagName, tag, nextTag) {
	      var checkTag = this.mod() === tagName;

	      if (tagName === 'mono') {
	        // special handling for 'mono'
	        checkTag = checkTag && this.mono;
	      } else {
	        checkTag = checkTag && !this.mono;
	      }

	      if (checkTag && this.match(tag)) {
	        if (nextTag !== undefined) {
	          // Purpose of the following match is to prevent a direct unset/set of a given tag
	          // E.g. '*bold **still bold*' => '*bold still bold*'
	          if (this.position === this.text.length - 1 || this.match(nextTag, false)) {
	            this.unsetTag(tagName);
	          }
	        } else {
	          this.unsetTag(tagName);
	        }

	        return true;
	      }

	      return false;
	    }
	    /**
	     * @param {string|RegExp} tag  string to match in text
	     * @param {value} value  string to replace tag with, if found at current position
	     * @returns {boolean} true if the tag was processed, false otherwise
	     */

	  }, {
	    key: "replace",
	    value: function replace(tag, value) {
	      if (this.match(tag)) {
	        this.add(value);
	        this.position += length - 1;
	        return true;
	      }

	      return false;
	    }
	    /**
	     * Create a regular expression for the tag if it isn't already one.
	     *
	     * The return value is an array `[RegExp, number]`, with exactly two value, where:
	     *  - RegExp is the regular expression to use
	     *  - number is the lenth of the input string to match
	     *
	     * @param {string|RegExp} tag  string to match in text
	     * @returns {Array}  regular expression to use and length of input string to match
	     * @private
	     */

	  }, {
	    key: "prepareRegExp",
	    value: function prepareRegExp(tag) {
	      var length;
	      var regExp;

	      if (tag instanceof RegExp) {
	        regExp = tag;
	        length = 1; // ASSUMPTION: regexp only tests one character
	      } else {
	        // use prepared regexp if present
	        var prepared = tagPattern[tag];

	        if (prepared !== undefined) {
	          regExp = prepared;
	        } else {
	          regExp = new RegExp(tag);
	        }

	        length = tag.length;
	      }

	      return [regExp, length];
	    }
	  }]);

	  return MarkupAccumulator;
	}();
	/**
	 * Helper class for Label which explodes the label text into lines and blocks within lines
	 *
	 * @private
	 */


	var LabelSplitter =
	/*#__PURE__*/
	function () {
	  /**
	   * @param {CanvasRenderingContext2D} ctx Canvas rendering context
	   * @param {Label} parent reference to the Label instance using current instance
	   * @param {boolean} selected 
	   * @param {boolean} hover
	   */
	  function LabelSplitter(ctx, parent, selected, hover) {
	    var _this = this;

	    classCallCheck(this, LabelSplitter);

	    this.ctx = ctx;
	    this.parent = parent;
	    this.selected = selected;
	    this.hover = hover;
	    /**
	     * Callback to determine text width; passed to LabelAccumulator instance
	     *
	     * @param  {String} text string to determine width of
	     * @param  {String} mod  font type to use for this text
	     * @return {Object} { width, values} width in pixels and font attributes
	     */

	    var textWidth = function textWidth(text, mod) {
	      if (text === undefined) return 0; // TODO: This can be done more efficiently with caching
	      // This will set the ctx.font correctly, depending on selected/hover and mod - so that ctx.measureText() will be accurate.

	      var values = _this.parent.getFormattingValues(ctx, selected, hover, mod);

	      var width = 0;

	      if (text !== '') {
	        var measure = _this.ctx.measureText(text);

	        width = measure.width;
	      }

	      return {
	        width: width,
	        values: values
	      };
	    };

	    this.lines = new LabelAccumulator(textWidth);
	  }
	  /**
	   * Split passed text of a label into lines and blocks.
	   *
	   * # NOTE
	   *
	   * The handling of spacing is option dependent:
	   *
	   * - if `font.multi : false`, all spaces are retained
	   * - if `font.multi : true`, every sequence of spaces is compressed to a single space
	   *
	   * This might not be the best way to do it, but this is as it has been working till now.
	   * In order not to break existing functionality, for the time being this behaviour will
	   * be retained in any code changes. 
	   *
	   * @param {string} text  text to split
	   * @returns {Array<line>}
	   */


	  createClass(LabelSplitter, [{
	    key: "process",
	    value: function process(text) {
	      if (!ComponentUtil.isValidLabel(text)) {
	        return this.lines.finalize();
	      }

	      var font = this.parent.fontOptions; // Normalize the end-of-line's to a single representation - order important

	      text = text.replace(/\r\n/g, '\n'); // Dos EOL's

	      text = text.replace(/\r/g, '\n'); // Mac EOL's
	      // Note that at this point, there can be no \r's in the text.
	      // This is used later on splitStringIntoLines() to split multifont texts.

	      var nlLines = String(text).split('\n');
	      var lineCount = nlLines.length;

	      if (font.multi) {
	        // Multi-font case: styling tags active
	        for (var i = 0; i < lineCount; i++) {
	          var blocks = this.splitBlocks(nlLines[i], font.multi); // Post: Sequences of tabs and spaces are reduced to single space

	          if (blocks === undefined) continue;

	          if (blocks.length === 0) {
	            this.lines.newLine("");
	            continue;
	          }

	          if (font.maxWdt > 0) {
	            // widthConstraint.maximum defined
	            //console.log('Running widthConstraint multi, max: ' + this.fontOptions.maxWdt);
	            for (var j = 0; j < blocks.length; j++) {
	              var mod = blocks[j].mod;
	              var _text = blocks[j].text;
	              this.splitStringIntoLines(_text, mod, true);
	            }
	          } else {
	            // widthConstraint.maximum NOT defined
	            for (var _j = 0; _j < blocks.length; _j++) {
	              var _mod = blocks[_j].mod;
	              var _text2 = blocks[_j].text;
	              this.lines.append(_text2, _mod);
	            }
	          }

	          this.lines.newLine();
	        }
	      } else {
	        // Single-font case
	        if (font.maxWdt > 0) {
	          // widthConstraint.maximum defined
	          // console.log('Running widthConstraint normal, max: ' + this.fontOptions.maxWdt);
	          for (var _i = 0; _i < lineCount; _i++) {
	            this.splitStringIntoLines(nlLines[_i]);
	          }
	        } else {
	          // widthConstraint.maximum NOT defined
	          for (var _i2 = 0; _i2 < lineCount; _i2++) {
	            this.lines.newLine(nlLines[_i2]);
	          }
	        }
	      }

	      return this.lines.finalize();
	    }
	    /**
	     * normalize the markup system
	     *
	     * @param {boolean|'md'|'markdown'|'html'} markupSystem
	     * @returns {string}
	     */

	  }, {
	    key: "decodeMarkupSystem",
	    value: function decodeMarkupSystem(markupSystem) {
	      var system = 'none';

	      if (markupSystem === 'markdown' || markupSystem === 'md') {
	        system = 'markdown';
	      } else if (markupSystem === true || markupSystem === 'html') {
	        system = 'html';
	      }

	      return system;
	    }
	    /**
	     *
	     * @param {string} text
	     * @returns {Array}
	     */

	  }, {
	    key: "splitHtmlBlocks",
	    value: function splitHtmlBlocks(text) {
	      var s = new MarkupAccumulator(text);

	      var parseEntities = function parseEntities(ch) {
	        if (/&/.test(ch)) {
	          var parsed = s.replace(s.text, '&lt;', '<') || s.replace(s.text, '&amp;', '&');

	          if (!parsed) {
	            s.add("&");
	          }

	          return true;
	        }

	        return false;
	      };

	      while (s.position < s.text.length) {
	        var ch = s.text.charAt(s.position);
	        var parsed = s.parseWS(ch) || /</.test(ch) && (s.parseStartTag('bold', '<b>') || s.parseStartTag('ital', '<i>') || s.parseStartTag('mono', '<code>') || s.parseEndTag('bold', '</b>') || s.parseEndTag('ital', '</i>') || s.parseEndTag('mono', '</code>')) || parseEntities(ch);

	        if (!parsed) {
	          s.add(ch);
	        }

	        s.position++;
	      }

	      s.emitBlock();
	      return s.blocks;
	    }
	    /**
	     *
	     * @param {string} text
	     * @returns {Array}
	     */

	  }, {
	    key: "splitMarkdownBlocks",
	    value: function splitMarkdownBlocks(text) {
	      var _this2 = this;

	      var s = new MarkupAccumulator(text);
	      var beginable = true;

	      var parseOverride = function parseOverride(ch) {
	        if (/\\/.test(ch)) {
	          if (s.position < _this2.text.length + 1) {
	            s.position++;
	            ch = _this2.text.charAt(s.position);

	            if (/ \t/.test(ch)) {
	              s.spacing = true;
	            } else {
	              s.add(ch);
	              beginable = false;
	            }
	          }

	          return true;
	        }

	        return false;
	      };

	      while (s.position < s.text.length) {
	        var ch = s.text.charAt(s.position);
	        var parsed = s.parseWS(ch) || parseOverride(ch) || (beginable || s.spacing) && (s.parseStartTag('bold', '*') || s.parseStartTag('ital', '_') || s.parseStartTag('mono', '`')) || s.parseEndTag('bold', '*', 'afterBold') || s.parseEndTag('ital', '_', 'afterItal') || s.parseEndTag('mono', '`', 'afterMono');

	        if (!parsed) {
	          s.add(ch);
	          beginable = false;
	        }

	        s.position++;
	      }

	      s.emitBlock();
	      return s.blocks;
	    }
	    /**
	     * Explodes a piece of text into single-font blocks using a given markup
	     *
	     * @param {string} text
	     * @param {boolean|'md'|'markdown'|'html'} markupSystem
	     * @returns {Array.<{text: string, mod: string}>}
	     * @private
	     */

	  }, {
	    key: "splitBlocks",
	    value: function splitBlocks(text, markupSystem) {
	      var system = this.decodeMarkupSystem(markupSystem);

	      if (system === 'none') {
	        return [{
	          text: text,
	          mod: 'normal'
	        }];
	      } else if (system === 'markdown') {
	        return this.splitMarkdownBlocks(text);
	      } else if (system === 'html') {
	        return this.splitHtmlBlocks(text);
	      }
	    }
	    /**
	     * @param {string} text
	     * @returns {boolean} true if text length over the current max with
	     * @private
	     */

	  }, {
	    key: "overMaxWidth",
	    value: function overMaxWidth(text) {
	      var width = this.ctx.measureText(text).width;
	      return this.lines.curWidth() + width > this.parent.fontOptions.maxWdt;
	    }
	    /**
	     * Determine the longest part of the sentence which still fits in the 
	     * current max width.
	     * 
	     * @param {Array} words  Array of strings signifying a text lines
	     * @return {number}      index of first item in string making string go over max
	     * @private
	     */

	  }, {
	    key: "getLongestFit",
	    value: function getLongestFit(words) {
	      var text = '';
	      var w = 0;

	      while (w < words.length) {
	        var pre = text === '' ? '' : ' ';
	        var newText = text + pre + words[w];
	        if (this.overMaxWidth(newText)) break;
	        text = newText;
	        w++;
	      }

	      return w;
	    }
	    /**
	     * Determine the longest part of the string which still fits in the
	     * current max width.
	     * 
	     * @param {Array} words Array of strings signifying a text lines
	     * @return {number} index of first item in string making string go over max
	     */

	  }, {
	    key: "getLongestFitWord",
	    value: function getLongestFitWord(words) {
	      var w = 0;

	      while (w < words.length) {
	        if (this.overMaxWidth(slice$3(words).call(words, 0, w))) break;
	        w++;
	      }

	      return w;
	    }
	    /**
	     * Split the passed text into lines, according to width constraint (if any).
	     * 
	     * The method assumes that the input string is a single line, i.e. without lines break.
	     *
	     * This method retains spaces, if still present (case `font.multi: false`).
	     * A space which falls on an internal line break, will be replaced by a newline.
	     * There is no special handling of tabs; these go along with the flow.
	     * 
	     * @param {string} str
	     * @param {string} [mod='normal']
	     * @param {boolean} [appendLast=false]
	     * @private
	     */

	  }, {
	    key: "splitStringIntoLines",
	    value: function splitStringIntoLines(str) {
	      var mod = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'normal';
	      var appendLast = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
	      // Set the canvas context font, based upon the current selected/hover state
	      // and the provided mod, so the text measurement performed by getLongestFit
	      // will be accurate - and not just use the font of whoever last used the canvas.
	      this.parent.getFormattingValues(this.ctx, this.selected, this.hover, mod); // Still-present spaces are relevant, retain them

	      str = str.replace(/^( +)/g, '$1\r');
	      str = str.replace(/([^\r][^ ]*)( +)/g, '$1\r$2\r');
	      var words = str.split('\r');

	      while (words.length > 0) {
	        var w = this.getLongestFit(words);

	        if (w === 0) {
	          // Special case: the first word is already larger than the max width.
	          var word = words[0]; // Break the word to the largest part that fits the line

	          var x = this.getLongestFitWord(word);
	          this.lines.newLine(slice$3(word).call(word, 0, x), mod); // Adjust the word, so that the rest will be done next iteration

	          words[0] = slice$3(word).call(word, x);
	        } else {
	          // skip any space that is replaced by a newline
	          var newW = w;

	          if (words[w - 1] === ' ') {
	            w--;
	          } else if (words[newW] === ' ') {
	            newW++;
	          }

	          var text = slice$3(words).call(words, 0, w).join("");

	          if (w == words.length && appendLast) {
	            this.lines.append(text, mod);
	          } else {
	            this.lines.newLine(text, mod);
	          } // Adjust the word, so that the rest will be done next iteration


	          words = slice$3(words).call(words, newW);
	        }
	      }
	    }
	  }]);

	  return LabelSplitter;
	}();

	/**
	 * List of special styles for multi-fonts
	 * @private
	 */

	var multiFontStyle = ['bold', 'ital', 'boldital', 'mono'];
	/**
	 * A Label to be used for Nodes or Edges.
	 */

	var Label =
	/*#__PURE__*/
	function () {
	  /**
	   * @param {Object} body
	   * @param {Object} options
	   * @param {boolean} [edgelabel=false]
	   */
	  function Label(body, options) {
	    var edgelabel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;

	    classCallCheck(this, Label);

	    this.body = body;
	    this.pointToSelf = false;
	    this.baseSize = undefined;
	    this.fontOptions = {}; // instance variable containing the *instance-local* font options

	    this.setOptions(options);
	    this.size = {
	      top: 0,
	      left: 0,
	      width: 0,
	      height: 0,
	      yLine: 0
	    };
	    this.isEdgeLabel = edgelabel;
	  }
	  /**
	   * @param {Object} options the options of the parent Node-instance
	   */


	  createClass(Label, [{
	    key: "setOptions",
	    value: function setOptions(options) {
	      this.elementOptions = options; // Reference to the options of the parent Node-instance 

	      this.initFontOptions(options.font);

	      if (ComponentUtil.isValidLabel(options.label)) {
	        this.labelDirty = true;
	      } else {
	        // Bad label! Change the option value to prevent bad stuff happening
	        options.label = undefined;
	      }

	      if (options.font !== undefined && options.font !== null) {
	        // font options can be deleted at various levels
	        if (typeof options.font === 'string') {
	          this.baseSize = this.fontOptions.size;
	        } else if (_typeof_1(options.font) === 'object') {
	          var size = options.font.size;

	          if (size !== undefined) {
	            this.baseSize = size;
	          }
	        }
	      }
	    }
	    /**
	     * Init the font Options structure.
	     *
	     * Member fontOptions serves as an accumulator for the current font options.
	     * As such, it needs to be completely separated from the node options.
	     *
	     * @param {Object} newFontOptions the new font options to process
	     * @private
	     */

	  }, {
	    key: "initFontOptions",
	    value: function initFontOptions(newFontOptions) {
	      var _this = this;

	      // Prepare the multi-font option objects.
	      // These will be filled in propagateFonts(), if required
	      forEach$3$1(multiFontStyle, function (style) {
	        _this.fontOptions[style] = {};
	      }); // Handle shorthand option, if present

	      if (Label.parseFontString(this.fontOptions, newFontOptions)) {
	        this.fontOptions.vadjust = 0;
	        return;
	      } // Copy over the non-multifont options, if specified


	      forEach$3$1(newFontOptions, function (prop, n) {
	        if (prop !== undefined && prop !== null && _typeof_1(prop) !== 'object') {
	          _this.fontOptions[n] = prop;
	        }
	      });
	    }
	    /**
	     * If in-variable is a string, parse it as a font specifier.
	     *
	     * Note that following is not done here and have to be done after the call:
	     * - Not all font options are set (vadjust, mod)
	     *
	     * @param {Object} outOptions  out-parameter, object in which to store the parse results (if any)
	     * @param {Object} inOptions  font options to parse
	     * @return {boolean} true if font parsed as string, false otherwise
	     * @static
	     */

	  }, {
	    key: "constrain",

	    /**
	     * Set the width and height constraints based on 'nearest' value
	     *
	     * @param {Array} pile array of option objects to consider
	     * @returns {object} the actual constraint values to use
	     * @private
	     */
	    value: function constrain(pile) {
	      // NOTE: constrainWidth and  constrainHeight never set!
	      // NOTE: for edge labels, only 'maxWdt' set
	      // Node labels can set all the fields
	      var fontOptions = {
	        constrainWidth: false,
	        maxWdt: -1,
	        minWdt: -1,
	        constrainHeight: false,
	        minHgt: -1,
	        valign: 'middle'
	      };
	      var widthConstraint = topMost(pile, 'widthConstraint');

	      if (typeof widthConstraint === 'number') {
	        fontOptions.maxWdt = Number(widthConstraint);
	        fontOptions.minWdt = Number(widthConstraint);
	      } else if (_typeof_1(widthConstraint) === 'object') {
	        var widthConstraintMaximum = topMost(pile, ['widthConstraint', 'maximum']);

	        if (typeof widthConstraintMaximum === 'number') {
	          fontOptions.maxWdt = Number(widthConstraintMaximum);
	        }

	        var widthConstraintMinimum = topMost(pile, ['widthConstraint', 'minimum']);

	        if (typeof widthConstraintMinimum === 'number') {
	          fontOptions.minWdt = Number(widthConstraintMinimum);
	        }
	      }

	      var heightConstraint = topMost(pile, 'heightConstraint');

	      if (typeof heightConstraint === 'number') {
	        fontOptions.minHgt = Number(heightConstraint);
	      } else if (_typeof_1(heightConstraint) === 'object') {
	        var heightConstraintMinimum = topMost(pile, ['heightConstraint', 'minimum']);

	        if (typeof heightConstraintMinimum === 'number') {
	          fontOptions.minHgt = Number(heightConstraintMinimum);
	        }

	        var heightConstraintValign = topMost(pile, ['heightConstraint', 'valign']);

	        if (typeof heightConstraintValign === 'string') {
	          if (heightConstraintValign === 'top' || heightConstraintValign === 'bottom') {
	            fontOptions.valign = heightConstraintValign;
	          }
	        }
	      }

	      return fontOptions;
	    }
	    /**
	     * Set options and update internal state
	     *
	     * @param {Object} options  options to set
	     * @param {Array}  pile     array of option objects to consider for option 'chosen'
	     */

	  }, {
	    key: "update",
	    value: function update(options, pile) {
	      this.setOptions(options, true);
	      this.propagateFonts(pile);
	      deepExtend(this.fontOptions, this.constrain(pile));
	      this.fontOptions.chooser = ComponentUtil.choosify('label', pile);
	    }
	    /**
	     * When margins are set in an element, adjust sizes is called to remove them
	     * from the width/height constraints. This must be done prior to label sizing.
	     *
	     * @param {{top: number, right: number, bottom: number, left: number}} margins
	     */

	  }, {
	    key: "adjustSizes",
	    value: function adjustSizes(margins) {
	      var widthBias = margins ? margins.right + margins.left : 0;

	      if (this.fontOptions.constrainWidth) {
	        this.fontOptions.maxWdt -= widthBias;
	        this.fontOptions.minWdt -= widthBias;
	      }

	      var heightBias = margins ? margins.top + margins.bottom : 0;

	      if (this.fontOptions.constrainHeight) {
	        this.fontOptions.minHgt -= heightBias;
	      }
	    } /////////////////////////////////////////////////////////
	    // Methods for handling options piles
	    // Eventually, these will be moved to a separate class
	    /////////////////////////////////////////////////////////

	    /**
	     * Add the font members of the passed list of option objects to the pile.
	     *
	     * @param {Pile} dstPile  pile of option objects add to 
	     * @param {Pile} srcPile  pile of option objects to take font options from
	     * @private
	     */

	  }, {
	    key: "addFontOptionsToPile",
	    value: function addFontOptionsToPile(dstPile, srcPile) {
	      for (var i = 0; i < srcPile.length; ++i) {
	        this.addFontToPile(dstPile, srcPile[i]);
	      }
	    }
	    /**
	     * Add given font option object to the list of objects (the 'pile') to consider for determining
	     * multi-font option values.
	     *
	     * @param {Pile} pile  pile of option objects to use
	     * @param {object} options  instance to add to pile
	     * @private
	     */

	  }, {
	    key: "addFontToPile",
	    value: function addFontToPile(pile, options) {
	      if (options === undefined) return;
	      if (options.font === undefined || options.font === null) return;
	      var item = options.font;
	      pile.push(item);
	    }
	    /**
	     * Collect all own-property values from the font pile that aren't multi-font option objectss.
	     *
	     * @param {Pile} pile  pile of option objects to use
	     * @returns {object} object with all current own basic font properties
	     * @private
	     */

	  }, {
	    key: "getBasicOptions",
	    value: function getBasicOptions(pile) {
	      var ret = {}; // Scans the whole pile to get all options present

	      for (var n = 0; n < pile.length; ++n) {
	        var fontOptions = pile[n]; // Convert shorthand if necessary

	        var tmpShorthand = {};

	        if (Label.parseFontString(tmpShorthand, fontOptions)) {
	          fontOptions = tmpShorthand;
	        }

	        forEach$3$1(fontOptions, function (opt, name) {
	          if (opt === undefined) return; // multi-font option need not be present 

	          if (ret.hasOwnProperty(name)) return; // Keep first value we encounter

	          if (indexOf$3(multiFontStyle).call(multiFontStyle, name) !== -1) {
	            // Skip multi-font properties but we do need the structure
	            ret[name] = {};
	          } else {
	            ret[name] = opt;
	          }
	        });
	      }

	      return ret;
	    }
	    /**
	     * Return the value for given option for the given multi-font.
	     *
	     * All available option objects are trawled in the set order to construct the option values.
	     *
	     * ---------------------------------------------------------------------
	     * ## Traversal of pile for multi-fonts
	     *
	     * The determination of multi-font option values is a special case, because any values not
	     * present in the multi-font options should by definition be taken from the main font options,
	     * i.e. from the current 'parent' object of the multi-font option.
	     *
	     * ### Search order for multi-fonts
	     *
	     * 'bold' used as example:
	     *
	     *   - search in option group 'bold' in local properties
	     *   - search in main font option group in local properties
	     *
	     * ---------------------------------------------------------------------
	     *
	     * @param {Pile} pile  pile of option objects to use
	     * @param {MultiFontStyle} multiName sub path for the multi-font
	     * @param {string} option  the option to search for, for the given multi-font
	     * @returns {string|number} the value for the given option
	     * @private
	     */

	  }, {
	    key: "getFontOption",
	    value: function getFontOption(pile, multiName, option) {
	      var multiFont; // Search multi font in local properties

	      for (var n = 0; n < pile.length; ++n) {
	        var fontOptions = pile[n];

	        if (fontOptions.hasOwnProperty(multiName)) {
	          multiFont = fontOptions[multiName];
	          if (multiFont === undefined || multiFont === null) continue; // Convert shorthand if necessary
	          // TODO: inefficient to do this conversion every time; find a better way.

	          var tmpShorthand = {};

	          if (Label.parseFontString(tmpShorthand, multiFont)) {
	            multiFont = tmpShorthand;
	          }

	          if (multiFont.hasOwnProperty(option)) {
	            return multiFont[option];
	          }
	        }
	      } // Option is not mentioned in the multi font options; take it from the parent font options.
	      // These have already been converted with getBasicOptions(), so use the converted values.


	      if (this.fontOptions.hasOwnProperty(option)) {
	        return this.fontOptions[option];
	      } // A value **must** be found; you should never get here.


	      throw new Error("Did not find value for multi-font for property: '" + option + "'");
	    }
	    /**
	     * Return all options values for the given multi-font.
	     *
	     * All available option objects are trawled in the set order to construct the option values.
	     *
	     * @param {Pile} pile  pile of option objects to use
	     * @param {MultiFontStyle} multiName sub path for the mod-font
	     * @returns {MultiFontOptions}
	     * @private
	     */

	  }, {
	    key: "getFontOptions",
	    value: function getFontOptions(pile, multiName) {
	      var result = {};
	      var optionNames = ['color', 'size', 'face', 'mod', 'vadjust']; // List of allowed options per multi-font

	      for (var i = 0; i < optionNames.length; ++i) {
	        var mod = optionNames[i];
	        result[mod] = this.getFontOption(pile, multiName, mod);
	      }

	      return result;
	    } /////////////////////////////////////////////////////////
	    // End methods for handling options piles
	    /////////////////////////////////////////////////////////

	    /**
	     * Collapse the font options for the multi-font to single objects, from
	     * the chain of option objects passed (the 'pile').
	     *
	     * @param {Pile} pile  sequence of option objects to consider.
	     *                     First item in list assumed to be the newly set options.
	     */

	  }, {
	    key: "propagateFonts",
	    value: function propagateFonts(pile) {
	      var _this2 = this;

	      var fontPile = []; // sequence of font objects to consider, order important
	      // Note that this.elementOptions is not used here.

	      this.addFontOptionsToPile(fontPile, pile);
	      this.fontOptions = this.getBasicOptions(fontPile); // We set multifont values even if multi === false, for consistency (things break otherwise)

	      var _loop = function _loop(i) {
	        var mod = multiFontStyle[i];
	        var modOptions = _this2.fontOptions[mod];

	        var tmpMultiFontOptions = _this2.getFontOptions(fontPile, mod); // Copy over found values


	        forEach$3$1(tmpMultiFontOptions, function (option, n) {
	          modOptions[n] = option;
	        });
	        modOptions.size = Number(modOptions.size);
	        modOptions.vadjust = Number(modOptions.vadjust);
	      };

	      for (var i = 0; i < multiFontStyle.length; ++i) {
	        _loop(i);
	      }
	    }
	    /**
	     * Main function. This is called from anything that wants to draw a label.
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {number} x
	     * @param {number} y
	     * @param {boolean} selected
	     * @param {boolean} hover
	     * @param {string} [baseline='middle']
	     */

	  }, {
	    key: "draw",
	    value: function draw(ctx, x, y, selected, hover) {
	      var baseline = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 'middle';
	      // if no label, return
	      if (this.elementOptions.label === undefined) return; // check if we have to render the label

	      var viewFontSize = this.fontOptions.size * this.body.view.scale;
	      if (this.elementOptions.label && viewFontSize < this.elementOptions.scaling.label.drawThreshold - 1) return; // This ensures that there will not be HUGE letters on screen
	      // by setting an upper limit on the visible text size (regardless of zoomLevel)

	      if (viewFontSize >= this.elementOptions.scaling.label.maxVisible) {
	        viewFontSize = Number(this.elementOptions.scaling.label.maxVisible) / this.body.view.scale;
	      } // update the size cache if required


	      this.calculateLabelSize(ctx, selected, hover, x, y, baseline);

	      this._drawBackground(ctx);

	      this._drawText(ctx, x, this.size.yLine, baseline, viewFontSize);
	    }
	    /**
	     * Draws the label background
	     * @param {CanvasRenderingContext2D} ctx
	     * @private
	     */

	  }, {
	    key: "_drawBackground",
	    value: function _drawBackground(ctx) {
	      if (this.fontOptions.background !== undefined && this.fontOptions.background !== "none") {
	        ctx.fillStyle = this.fontOptions.background;
	        var size = this.getSize();
	        ctx.fillRect(size.left, size.top, size.width, size.height);
	      }
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {number} x
	     * @param {number} y
	     * @param {string} [baseline='middle']
	     * @param {number} viewFontSize 
	     * @private
	     */

	  }, {
	    key: "_drawText",
	    value: function _drawText(ctx, x, y) {
	      var baseline = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'middle';
	      var viewFontSize = arguments.length > 4 ? arguments[4] : undefined;

	      var _this$_setAlignment = this._setAlignment(ctx, x, y, baseline);

	      var _this$_setAlignment2 = slicedToArray$1(_this$_setAlignment, 2);

	      x = _this$_setAlignment2[0];
	      y = _this$_setAlignment2[1];
	      ctx.textAlign = 'left';
	      x = x - this.size.width / 2; // Shift label 1/2-distance to the left

	      if (this.fontOptions.valign && this.size.height > this.size.labelHeight) {
	        if (this.fontOptions.valign === 'top') {
	          y -= (this.size.height - this.size.labelHeight) / 2;
	        }

	        if (this.fontOptions.valign === 'bottom') {
	          y += (this.size.height - this.size.labelHeight) / 2;
	        }
	      } // draw the text


	      for (var i = 0; i < this.lineCount; i++) {
	        var line = this.lines[i];

	        if (line && line.blocks) {
	          var width = 0;

	          if (this.isEdgeLabel || this.fontOptions.align === 'center') {
	            width += (this.size.width - line.width) / 2;
	          } else if (this.fontOptions.align === 'right') {
	            width += this.size.width - line.width;
	          }

	          for (var j = 0; j < line.blocks.length; j++) {
	            var block = line.blocks[j];
	            ctx.font = block.font;

	            var _this$_getColor = this._getColor(block.color, viewFontSize, block.strokeColor),
	                _this$_getColor2 = slicedToArray$1(_this$_getColor, 2),
	                fontColor = _this$_getColor2[0],
	                strokeColor = _this$_getColor2[1];

	            if (block.strokeWidth > 0) {
	              ctx.lineWidth = block.strokeWidth;
	              ctx.strokeStyle = strokeColor;
	              ctx.lineJoin = 'round';
	            }

	            ctx.fillStyle = fontColor;

	            if (block.strokeWidth > 0) {
	              ctx.strokeText(block.text, x + width, y + block.vadjust);
	            }

	            ctx.fillText(block.text, x + width, y + block.vadjust);
	            width += block.width;
	          }

	          y += line.height;
	        }
	      }
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {number} x
	     * @param {number} y
	     * @param {string} baseline
	     * @returns {Array.<number>}
	     * @private
	     */

	  }, {
	    key: "_setAlignment",
	    value: function _setAlignment(ctx, x, y, baseline) {
	      // check for label alignment (for edges)
	      // TODO: make alignment for nodes
	      if (this.isEdgeLabel && this.fontOptions.align !== 'horizontal' && this.pointToSelf === false) {
	        x = 0;
	        y = 0;
	        var lineMargin = 2;

	        if (this.fontOptions.align === 'top') {
	          ctx.textBaseline = 'alphabetic';
	          y -= 2 * lineMargin; // distance from edge, required because we use alphabetic. Alphabetic has less difference between browsers
	        } else if (this.fontOptions.align === 'bottom') {
	          ctx.textBaseline = 'hanging';
	          y += 2 * lineMargin; // distance from edge, required because we use hanging. Hanging has less difference between browsers
	        } else {
	          ctx.textBaseline = 'middle';
	        }
	      } else {
	        ctx.textBaseline = baseline;
	      }

	      return [x, y];
	    }
	    /**
	     * fade in when relative scale is between threshold and threshold - 1.
	     * If the relative scale would be smaller than threshold -1 the draw function would have returned before coming here.
	     *
	     * @param {string} color  The font color to use
	     * @param {number} viewFontSize
	     * @param {string} initialStrokeColor
	     * @returns {Array.<string>} An array containing the font color and stroke color
	     * @private
	     */

	  }, {
	    key: "_getColor",
	    value: function _getColor(color, viewFontSize, initialStrokeColor) {
	      var fontColor = color || '#000000';
	      var strokeColor = initialStrokeColor || '#ffffff';

	      if (viewFontSize <= this.elementOptions.scaling.label.drawThreshold) {
	        var opacity = Math.max(0, Math.min(1, 1 - (this.elementOptions.scaling.label.drawThreshold - viewFontSize)));
	        fontColor = overrideOpacity(fontColor, opacity);
	        strokeColor = overrideOpacity(strokeColor, opacity);
	      }

	      return [fontColor, strokeColor];
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {boolean} selected
	     * @param {boolean} hover
	     * @returns {{width: number, height: number}}
	     */

	  }, {
	    key: "getTextSize",
	    value: function getTextSize(ctx) {
	      var selected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
	      var hover = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;

	      this._processLabel(ctx, selected, hover);

	      return {
	        width: this.size.width,
	        height: this.size.height,
	        lineCount: this.lineCount
	      };
	    }
	    /**
	     * Get the current dimensions of the label
	     *
	     * @return {rect}
	     */

	  }, {
	    key: "getSize",
	    value: function getSize() {
	      var lineMargin = 2;
	      var x = this.size.left; // default values which might be overridden below

	      var y = this.size.top - 0.5 * lineMargin; // idem

	      if (this.isEdgeLabel) {
	        var x2 = -this.size.width * 0.5;

	        switch (this.fontOptions.align) {
	          case 'middle':
	            x = x2;
	            y = -this.size.height * 0.5;
	            break;

	          case 'top':
	            x = x2;
	            y = -(this.size.height + lineMargin);
	            break;

	          case 'bottom':
	            x = x2;
	            y = lineMargin;
	            break;
	        }
	      }

	      var ret = {
	        left: x,
	        top: y,
	        width: this.size.width,
	        height: this.size.height
	      };
	      return ret;
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {boolean} selected
	     * @param {boolean} hover
	     * @param {number} [x=0]
	     * @param {number} [y=0]
	     * @param {'middle'|'hanging'} [baseline='middle']
	     */

	  }, {
	    key: "calculateLabelSize",
	    value: function calculateLabelSize(ctx, selected, hover) {
	      var x = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
	      var y = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
	      var baseline = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 'middle';

	      this._processLabel(ctx, selected, hover);

	      this.size.left = x - this.size.width * 0.5;
	      this.size.top = y - this.size.height * 0.5;
	      this.size.yLine = y + (1 - this.lineCount) * 0.5 * this.fontOptions.size;

	      if (baseline === "hanging") {
	        this.size.top += 0.5 * this.fontOptions.size;
	        this.size.top += 4; // distance from node, required because we use hanging. Hanging has less difference between browsers

	        this.size.yLine += 4; // distance from node
	      }
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {boolean} selected
	     * @param {boolean} hover
	     * @param {string} mod
	     * @returns {{color, size, face, mod, vadjust, strokeWidth: *, strokeColor: (*|string|allOptions.edges.font.strokeColor|{string}|allOptions.nodes.font.strokeColor|Array)}}
	     */

	  }, {
	    key: "getFormattingValues",
	    value: function getFormattingValues(ctx, selected, hover, mod) {
	      var getValue = function getValue(fontOptions, mod, option) {
	        if (mod === "normal") {
	          if (option === 'mod') return "";
	          return fontOptions[option];
	        }

	        if (fontOptions[mod][option] !== undefined) {
	          // Grumbl leaving out test on undefined equals false for "" 
	          return fontOptions[mod][option];
	        } else {
	          // Take from parent font option
	          return fontOptions[option];
	        }
	      };

	      var values = {
	        color: getValue(this.fontOptions, mod, 'color'),
	        size: getValue(this.fontOptions, mod, 'size'),
	        face: getValue(this.fontOptions, mod, 'face'),
	        mod: getValue(this.fontOptions, mod, 'mod'),
	        vadjust: getValue(this.fontOptions, mod, 'vadjust'),
	        strokeWidth: this.fontOptions.strokeWidth,
	        strokeColor: this.fontOptions.strokeColor
	      };

	      if (selected || hover) {
	        if (mod === "normal" && this.fontOptions.chooser === true && this.elementOptions.labelHighlightBold) {
	          values.mod = 'bold';
	        } else {
	          if (typeof this.fontOptions.chooser === 'function') {
	            this.fontOptions.chooser(values, this.elementOptions.id, selected, hover);
	          }
	        }
	      }

	      var fontString = "";

	      if (values.mod !== undefined && values.mod !== "") {
	        // safeguard for undefined - this happened
	        fontString += values.mod + " ";
	      }

	      fontString += values.size + "px " + values.face;
	      ctx.font = fontString.replace(/"/g, "");
	      values.font = ctx.font;
	      values.height = values.size;
	      return values;
	    }
	    /**
	     *
	     * @param {boolean} selected
	     * @param {boolean} hover
	     * @returns {boolean}
	     */

	  }, {
	    key: "differentState",
	    value: function differentState(selected, hover) {
	      return selected !== this.selectedState || hover !== this.hoverState;
	    }
	    /**
	     * This explodes the passed text into lines and determines the width, height and number of lines.
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {boolean} selected
	     * @param {boolean} hover
	     * @param {string} inText  the text to explode
	     * @returns {{width, height, lines}|*}
	     * @private
	     */

	  }, {
	    key: "_processLabelText",
	    value: function _processLabelText(ctx, selected, hover, inText) {
	      var splitter = new LabelSplitter(ctx, this, selected, hover);
	      return splitter.process(inText);
	    }
	    /**
	     * This explodes the label string into lines and sets the width, height and number of lines.
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {boolean} selected
	     * @param {boolean} hover
	     * @private
	     */

	  }, {
	    key: "_processLabel",
	    value: function _processLabel(ctx, selected, hover) {
	      if (this.labelDirty === false && !this.differentState(selected, hover)) return;

	      var state = this._processLabelText(ctx, selected, hover, this.elementOptions.label);

	      if (this.fontOptions.minWdt > 0 && state.width < this.fontOptions.minWdt) {
	        state.width = this.fontOptions.minWdt;
	      }

	      this.size.labelHeight = state.height;

	      if (this.fontOptions.minHgt > 0 && state.height < this.fontOptions.minHgt) {
	        state.height = this.fontOptions.minHgt;
	      }

	      this.lines = state.lines;
	      this.lineCount = state.lines.length;
	      this.size.width = state.width;
	      this.size.height = state.height;
	      this.selectedState = selected;
	      this.hoverState = hover;
	      this.labelDirty = false;
	    }
	    /**
	     * Check if this label is visible
	     *
	     * @return {boolean} true if this label will be show, false otherwise
	     */

	  }, {
	    key: "visible",
	    value: function visible() {
	      if (this.size.width === 0 || this.size.height === 0 || this.elementOptions.label === undefined) {
	        return false; // nothing to display
	      }

	      var viewFontSize = this.fontOptions.size * this.body.view.scale;

	      if (viewFontSize < this.elementOptions.scaling.label.drawThreshold - 1) {
	        return false; // Too small or too far away to show
	      }

	      return true;
	    }
	  }], [{
	    key: "parseFontString",
	    value: function parseFontString(outOptions, inOptions) {
	      if (!inOptions || typeof inOptions !== 'string') return false;
	      var newOptionsArray = inOptions.split(" ");
	      outOptions.size = +newOptionsArray[0].replace("px", '');
	      outOptions.face = newOptionsArray[1];
	      outOptions.color = newOptionsArray[2];
	      return true;
	    }
	  }]);

	  return Label;
	}();

	function _assertThisInitialized$2(self) {
	  if (self === void 0) {
	    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
	  }

	  return self;
	}

	var assertThisInitialized$1 = _assertThisInitialized$2;

	function _possibleConstructorReturn$1(self, call) {
	  if (call && (_typeof_1(call) === "object" || typeof call === "function")) {
	    return call;
	  }

	  return assertThisInitialized$1(self);
	}

	var possibleConstructorReturn$1 = _possibleConstructorReturn$1;

	var getPrototypeOf$5 = getPrototypeOf;

	var getPrototypeOf$6 = getPrototypeOf$5;

	var setPrototypeOf$4 = setPrototypeOf;

	var setPrototypeOf$5 = setPrototypeOf$4;

	var getPrototypeOf$7 = createCommonjsModule(function (module) {
	function _getPrototypeOf(o) {
	  module.exports = _getPrototypeOf = setPrototypeOf$5 ? getPrototypeOf$6 : function _getPrototypeOf(o) {
	    return o.__proto__ || getPrototypeOf$6(o);
	  };
	  return _getPrototypeOf(o);
	}

	module.exports = _getPrototypeOf;
	});

	var create$4 = create;

	var create$5 = create$4;

	var setPrototypeOf$6 = createCommonjsModule(function (module) {
	function _setPrototypeOf(o, p) {
	  module.exports = _setPrototypeOf = setPrototypeOf$5 || function _setPrototypeOf(o, p) {
	    o.__proto__ = p;
	    return o;
	  };

	  return _setPrototypeOf(o, p);
	}

	module.exports = _setPrototypeOf;
	});

	function _inherits$1(subClass, superClass) {
	  if (typeof superClass !== "function" && superClass !== null) {
	    throw new TypeError("Super expression must either be null or a function");
	  }

	  subClass.prototype = create$5(superClass && superClass.prototype, {
	    constructor: {
	      value: subClass,
	      writable: true,
	      configurable: true
	    }
	  });
	  if (superClass) setPrototypeOf$6(subClass, superClass);
	}

	var inherits$1 = _inherits$1;

	// `Array.prototype.fill` method implementation
	// https://tc39.github.io/ecma262/#sec-array.prototype.fill
	var arrayFill = function fill(value /* , start = 0, end = @length */) {
	  var O = toObject(this);
	  var length = toLength(O.length);
	  var argumentsLength = arguments.length;
	  var index = toAbsoluteIndex(argumentsLength > 1 ? arguments[1] : undefined, length);
	  var end = argumentsLength > 2 ? arguments[2] : undefined;
	  var endPos = end === undefined ? length : toAbsoluteIndex(end, length);
	  while (endPos > index) O[index++] = value;
	  return O;
	};

	// `Array.prototype.fill` method
	// https://tc39.github.io/ecma262/#sec-array.prototype.fill
	_export({ target: 'Array', proto: true }, {
	  fill: arrayFill
	});

	var fill = entryVirtual('Array').fill;

	var ArrayPrototype$i = Array.prototype;

	var fill_1 = function (it) {
	  var own = it.fill;
	  return it === ArrayPrototype$i || (it instanceof Array && own === ArrayPrototype$i.fill) ? fill : own;
	};

	var fill$1 = fill_1;

	var fill$2 = fill$1;

	/**
	 * The Base class for all Nodes.
	 */
	var NodeBase =
	/*#__PURE__*/
	function () {
	  /**
	   * @param {Object} options
	   * @param {Object} body
	   * @param {Label} labelModule
	   */
	  function NodeBase(options, body, labelModule) {
	    classCallCheck(this, NodeBase);

	    this.body = body;
	    this.labelModule = labelModule;
	    this.setOptions(options);
	    this.top = undefined;
	    this.left = undefined;
	    this.height = undefined;
	    this.width = undefined;
	    this.radius = undefined;
	    this.margin = undefined;
	    this.refreshNeeded = true;
	    this.boundingBox = {
	      top: 0,
	      left: 0,
	      right: 0,
	      bottom: 0
	    };
	  }
	  /**
	   *
	   * @param {Object} options
	   */


	  createClass(NodeBase, [{
	    key: "setOptions",
	    value: function setOptions(options) {
	      this.options = options;
	    }
	    /**
	     *
	     * @param {Label} labelModule
	     * @private
	     */

	  }, {
	    key: "_setMargins",
	    value: function _setMargins(labelModule) {
	      this.margin = {};

	      if (this.options.margin) {
	        if (_typeof_1(this.options.margin) == 'object') {
	          this.margin.top = this.options.margin.top;
	          this.margin.right = this.options.margin.right;
	          this.margin.bottom = this.options.margin.bottom;
	          this.margin.left = this.options.margin.left;
	        } else {
	          this.margin.top = this.options.margin;
	          this.margin.right = this.options.margin;
	          this.margin.bottom = this.options.margin;
	          this.margin.left = this.options.margin;
	        }
	      }

	      labelModule.adjustSizes(this.margin);
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {number} angle
	     * @returns {number}
	     * @private
	     */

	  }, {
	    key: "_distanceToBorder",
	    value: function _distanceToBorder(ctx, angle) {
	      var borderWidth = this.options.borderWidth;
	      this.resize(ctx);
	      return Math.min(Math.abs(this.width / 2 / Math.cos(angle)), Math.abs(this.height / 2 / Math.sin(angle))) + borderWidth;
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {ArrowOptions} values
	     */

	  }, {
	    key: "enableShadow",
	    value: function enableShadow(ctx, values) {
	      if (values.shadow) {
	        ctx.shadowColor = values.shadowColor;
	        ctx.shadowBlur = values.shadowSize;
	        ctx.shadowOffsetX = values.shadowX;
	        ctx.shadowOffsetY = values.shadowY;
	      }
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {ArrowOptions} values
	     */

	  }, {
	    key: "disableShadow",
	    value: function disableShadow(ctx, values) {
	      if (values.shadow) {
	        ctx.shadowColor = 'rgba(0,0,0,0)';
	        ctx.shadowBlur = 0;
	        ctx.shadowOffsetX = 0;
	        ctx.shadowOffsetY = 0;
	      }
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {ArrowOptions} values
	     */

	  }, {
	    key: "enableBorderDashes",
	    value: function enableBorderDashes(ctx, values) {
	      if (values.borderDashes !== false) {
	        if (ctx.setLineDash !== undefined) {
	          var dashes = values.borderDashes;

	          if (dashes === true) {
	            dashes = [5, 15];
	          }

	          ctx.setLineDash(dashes);
	        } else {
	          console.warn("setLineDash is not supported in this browser. The dashed borders cannot be used.");
	          this.options.shapeProperties.borderDashes = false;
	          values.borderDashes = false;
	        }
	      }
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {ArrowOptions} values
	     */

	  }, {
	    key: "disableBorderDashes",
	    value: function disableBorderDashes(ctx, values) {
	      if (values.borderDashes !== false) {
	        if (ctx.setLineDash !== undefined) {
	          ctx.setLineDash([0]);
	        } else {
	          console.warn("setLineDash is not supported in this browser. The dashed borders cannot be used.");
	          this.options.shapeProperties.borderDashes = false;
	          values.borderDashes = false;
	        }
	      }
	    }
	    /**
	     * Determine if the shape of a node needs to be recalculated.
	     *
	     * @param {boolean} selected
	     * @param {boolean} hover
	     * @returns {boolean}
	     * @protected
	     */

	  }, {
	    key: "needsRefresh",
	    value: function needsRefresh(selected, hover) {
	      if (this.refreshNeeded === true) {
	        // This is probably not the best location to reset this member.
	        // However, in the current logic, it is the most convenient one.
	        this.refreshNeeded = false;
	        return true;
	      }

	      return this.width === undefined || this.labelModule.differentState(selected, hover);
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {ArrowOptions} values
	     */

	  }, {
	    key: "initContextForDraw",
	    value: function initContextForDraw(ctx, values) {
	      var borderWidth = values.borderWidth / this.body.view.scale;
	      ctx.lineWidth = Math.min(this.width, borderWidth);
	      ctx.strokeStyle = values.borderColor;
	      ctx.fillStyle = values.color;
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {ArrowOptions} values
	     */

	  }, {
	    key: "performStroke",
	    value: function performStroke(ctx, values) {
	      var borderWidth = values.borderWidth / this.body.view.scale; //draw dashed border if enabled, save and restore is required for firefox not to crash on unix.

	      ctx.save(); // if borders are zero width, they will be drawn with width 1 by default. This prevents that

	      if (borderWidth > 0) {
	        this.enableBorderDashes(ctx, values); //draw the border

	        ctx.stroke(); //disable dashed border for other elements

	        this.disableBorderDashes(ctx, values);
	      }

	      ctx.restore();
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {ArrowOptions} values
	     */

	  }, {
	    key: "performFill",
	    value: function performFill(ctx, values) {
	      // draw shadow if enabled
	      this.enableShadow(ctx, values); // draw the background

	      fill$2(ctx).call(ctx); // disable shadows for other elements.


	      this.disableShadow(ctx, values);
	      this.performStroke(ctx, values);
	    }
	    /**
	     *
	     * @param {number} margin
	     * @private
	     */

	  }, {
	    key: "_addBoundingBoxMargin",
	    value: function _addBoundingBoxMargin(margin) {
	      this.boundingBox.left -= margin;
	      this.boundingBox.top -= margin;
	      this.boundingBox.bottom += margin;
	      this.boundingBox.right += margin;
	    }
	    /**
	     * Actual implementation of this method call.
	     *
	     * Doing it like this makes it easier to override
	     * in the child classes.
	     *
	     * @param {number} x width
	     * @param {number} y height
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {boolean} selected
	     * @param {boolean} hover
	     * @private
	     */

	  }, {
	    key: "_updateBoundingBox",
	    value: function _updateBoundingBox(x, y, ctx, selected, hover) {
	      if (ctx !== undefined) {
	        this.resize(ctx, selected, hover);
	      }

	      this.left = x - this.width / 2;
	      this.top = y - this.height / 2;
	      this.boundingBox.left = this.left;
	      this.boundingBox.top = this.top;
	      this.boundingBox.bottom = this.top + this.height;
	      this.boundingBox.right = this.left + this.width;
	    }
	    /**
	     * Default implementation of this method call.
	     * This acts as a stub which can be overridden.
	     *
	     * @param {number} x width
	     * @param {number} y height
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {boolean} selected
	     * @param {boolean} hover
	     */

	  }, {
	    key: "updateBoundingBox",
	    value: function updateBoundingBox(x, y, ctx, selected, hover) {
	      this._updateBoundingBox(x, y, ctx, selected, hover);
	    }
	    /**
	     * Determine the dimensions to use for nodes with an internal label
	     *
	     * Currently, these are: Circle, Ellipse, Database, Box
	     * The other nodes have external labels, and will not call this method
	     *
	     * If there is no label, decent default values are supplied.
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {boolean} [selected]
	     * @param {boolean} [hover]
	     * @returns {{width:number, height:number}}
	     */

	  }, {
	    key: "getDimensionsFromLabel",
	    value: function getDimensionsFromLabel(ctx, selected, hover) {
	      // NOTE: previously 'textSize' was not put in 'this' for Ellipse
	      // TODO: examine the consequences.
	      this.textSize = this.labelModule.getTextSize(ctx, selected, hover);
	      var width = this.textSize.width;
	      var height = this.textSize.height;
	      var DEFAULT_SIZE = 14;

	      if (width === 0) {
	        // This happens when there is no label text set
	        width = DEFAULT_SIZE; // use a decent default

	        height = DEFAULT_SIZE; // if width zero, then height also always zero
	      }

	      return {
	        width: width,
	        height: height
	      };
	    }
	  }]);

	  return NodeBase;
	}();

	/**
	 * A Box Node/Cluster shape.
	 *
	 * @extends NodeBase
	 */

	var Box =
	/*#__PURE__*/
	function (_NodeBase) {
	  inherits$1(Box, _NodeBase);

	  /**
	   * @param {Object} options
	   * @param {Object} body
	   * @param {Label} labelModule
	   */
	  function Box(options, body, labelModule) {
	    var _this;

	    classCallCheck(this, Box);

	    _this = possibleConstructorReturn$1(this, getPrototypeOf$7(Box).call(this, options, body, labelModule));

	    _this._setMargins(labelModule);

	    return _this;
	  }
	  /**
	   *
	   * @param {CanvasRenderingContext2D} ctx
	   * @param {boolean} [selected]
	   * @param {boolean} [hover]
	   */


	  createClass(Box, [{
	    key: "resize",
	    value: function resize(ctx) {
	      var selected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.selected;
	      var hover = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.hover;

	      if (this.needsRefresh(selected, hover)) {
	        var dimensions = this.getDimensionsFromLabel(ctx, selected, hover);
	        this.width = dimensions.width + this.margin.right + this.margin.left;
	        this.height = dimensions.height + this.margin.top + this.margin.bottom;
	        this.radius = this.width / 2;
	      }
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {number} x width
	     * @param {number} y height
	     * @param {boolean} selected
	     * @param {boolean} hover
	     * @param {ArrowOptions} values
	     */

	  }, {
	    key: "draw",
	    value: function draw(ctx, x, y, selected, hover, values) {
	      this.resize(ctx, selected, hover);
	      this.left = x - this.width / 2;
	      this.top = y - this.height / 2;
	      this.initContextForDraw(ctx, values);
	      drawRoundRect(ctx, this.left, this.top, this.width, this.height, values.borderRadius);
	      this.performFill(ctx, values);
	      this.updateBoundingBox(x, y, ctx, selected, hover);
	      this.labelModule.draw(ctx, this.left + this.textSize.width / 2 + this.margin.left, this.top + this.textSize.height / 2 + this.margin.top, selected, hover);
	    }
	    /**
	     *
	     * @param {number} x width
	     * @param {number} y height
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {boolean} selected
	     * @param {boolean} hover
	     */

	  }, {
	    key: "updateBoundingBox",
	    value: function updateBoundingBox(x, y, ctx, selected, hover) {
	      this._updateBoundingBox(x, y, ctx, selected, hover);

	      var borderRadius = this.options.shapeProperties.borderRadius; // only effective for box

	      this._addBoundingBoxMargin(borderRadius);
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {number} angle
	     * @returns {number}
	     */

	  }, {
	    key: "distanceToBorder",
	    value: function distanceToBorder(ctx, angle) {
	      this.resize(ctx);
	      var borderWidth = this.options.borderWidth;
	      return Math.min(Math.abs(this.width / 2 / Math.cos(angle)), Math.abs(this.height / 2 / Math.sin(angle))) + borderWidth;
	    }
	  }]);

	  return Box;
	}(NodeBase);

	/**
	 * NOTE: This is a bad base class
	 *
	 * Child classes are:
	 *
	 *   Image       - uses *only* image methods
	 *   Circle      - uses *only* _drawRawCircle
	 *   CircleImage - uses all
	 *
	 * TODO: Refactor, move _drawRawCircle to different module, derive Circle from NodeBase
	 *       Rename this to ImageBase
	 *       Consolidate common code in Image and CircleImage to base class
	 *
	 * @extends NodeBase
	 */

	var CircleImageBase =
	/*#__PURE__*/
	function (_NodeBase) {
	  inherits$1(CircleImageBase, _NodeBase);

	  /**
	   * @param {Object} options
	   * @param {Object} body
	   * @param {Label} labelModule
	   */
	  function CircleImageBase(options, body, labelModule) {
	    var _this;

	    classCallCheck(this, CircleImageBase);

	    _this = possibleConstructorReturn$1(this, getPrototypeOf$7(CircleImageBase).call(this, options, body, labelModule));
	    _this.labelOffset = 0;
	    _this.selected = false;
	    return _this;
	  }
	  /**
	   *
	   * @param {Object} options
	   * @param {Object} [imageObj]
	   * @param {Object} [imageObjAlt]
	   */


	  createClass(CircleImageBase, [{
	    key: "setOptions",
	    value: function setOptions(options, imageObj, imageObjAlt) {
	      this.options = options;

	      if (!(imageObj === undefined && imageObjAlt === undefined)) {
	        this.setImages(imageObj, imageObjAlt);
	      }
	    }
	    /**
	     * Set the images for this node.
	     *
	     * The images can be updated after the initial setting of options;
	     * therefore, this method needs to be reentrant. 
	     *
	     * For correct working in error cases, it is necessary to properly set
	     * field 'nodes.brokenImage' in the options.
	     *
	     * @param {Image} imageObj  required; main image to show for this node
	     * @param {Image|undefined} imageObjAlt optional; image to show when node is selected
	     */

	  }, {
	    key: "setImages",
	    value: function setImages(imageObj, imageObjAlt) {
	      if (imageObjAlt && this.selected) {
	        this.imageObj = imageObjAlt;
	        this.imageObjAlt = imageObj;
	      } else {
	        this.imageObj = imageObj;
	        this.imageObjAlt = imageObjAlt;
	      }
	    }
	    /**
	     * Set selection and switch between the base and the selected image.
	     *
	     * Do the switch only if imageObjAlt exists.
	     *
	     * @param {boolean} selected value of new selected state for current node
	     */

	  }, {
	    key: "switchImages",
	    value: function switchImages(selected) {
	      var selection_changed = selected && !this.selected || !selected && this.selected;
	      this.selected = selected; // Remember new selection

	      if (this.imageObjAlt !== undefined && selection_changed) {
	        var imageTmp = this.imageObj;
	        this.imageObj = this.imageObjAlt;
	        this.imageObjAlt = imageTmp;
	      }
	    }
	    /**
	     * Returns Image Padding from node options
	     *
	     * @returns {{top: number,left: number,bottom: number,right: number}} image padding inside this shape
	     * @private
	     */

	  }, {
	    key: "_getImagePadding",
	    value: function _getImagePadding() {
	      var imgPadding = {
	        top: 0,
	        right: 0,
	        bottom: 0,
	        left: 0
	      };

	      if (this.options.imagePadding) {
	        var optImgPadding = this.options.imagePadding;

	        if (_typeof_1(optImgPadding) == 'object') {
	          imgPadding.top = optImgPadding.top;
	          imgPadding.right = optImgPadding.right;
	          imgPadding.bottom = optImgPadding.bottom;
	          imgPadding.left = optImgPadding.left;
	        } else {
	          imgPadding.top = optImgPadding;
	          imgPadding.right = optImgPadding;
	          imgPadding.bottom = optImgPadding;
	          imgPadding.left = optImgPadding;
	        }
	      }

	      return imgPadding;
	    }
	    /**
	     * Adjust the node dimensions for a loaded image.
	     *
	     * Pre: this.imageObj is valid
	     */

	  }, {
	    key: "_resizeImage",
	    value: function _resizeImage() {
	      var width, height;

	      if (this.options.shapeProperties.useImageSize === false) {
	        // Use the size property
	        var ratio_width = 1;
	        var ratio_height = 1; // Only calculate the proper ratio if both width and height not zero

	        if (this.imageObj.width && this.imageObj.height) {
	          if (this.imageObj.width > this.imageObj.height) {
	            ratio_width = this.imageObj.width / this.imageObj.height;
	          } else {
	            ratio_height = this.imageObj.height / this.imageObj.width;
	          }
	        }

	        width = this.options.size * 2 * ratio_width;
	        height = this.options.size * 2 * ratio_height;
	      } else {
	        // Use the image size with image padding
	        var imgPadding = this._getImagePadding();

	        width = this.imageObj.width + imgPadding.left + imgPadding.right;
	        height = this.imageObj.height + imgPadding.top + imgPadding.bottom;
	      }

	      this.width = width;
	      this.height = height;
	      this.radius = 0.5 * this.width;
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {number} x width
	     * @param {number} y height
	     * @param {ArrowOptions} values
	     * @private
	     */

	  }, {
	    key: "_drawRawCircle",
	    value: function _drawRawCircle(ctx, x, y, values) {
	      this.initContextForDraw(ctx, values);
	      drawCircle(ctx, x, y, values.size);
	      this.performFill(ctx, values);
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {ArrowOptions} values
	     * @private
	     */

	  }, {
	    key: "_drawImageAtPosition",
	    value: function _drawImageAtPosition(ctx, values) {
	      if (this.imageObj.width != 0) {
	        // draw the image
	        ctx.globalAlpha = 1.0; // draw shadow if enabled

	        this.enableShadow(ctx, values);
	        var factor = 1;

	        if (this.options.shapeProperties.interpolation === true) {
	          factor = this.imageObj.width / this.width / this.body.view.scale;
	        }

	        var imgPadding = this._getImagePadding();

	        var imgPosLeft = this.left + imgPadding.left;
	        var imgPosTop = this.top + imgPadding.top;
	        var imgWidth = this.width - imgPadding.left - imgPadding.right;
	        var imgHeight = this.height - imgPadding.top - imgPadding.bottom;
	        this.imageObj.drawImageAtPosition(ctx, factor, imgPosLeft, imgPosTop, imgWidth, imgHeight); // disable shadows for other elements.

	        this.disableShadow(ctx, values);
	      }
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {number} x width
	     * @param {number} y height
	     * @param {boolean} selected
	     * @param {boolean} hover
	     * @private
	     */

	  }, {
	    key: "_drawImageLabel",
	    value: function _drawImageLabel(ctx, x, y, selected, hover) {
	      var yLabel;
	      var offset = 0;

	      if (this.height !== undefined) {
	        offset = this.height * 0.5;
	        var labelDimensions = this.labelModule.getTextSize(ctx, selected, hover);

	        if (labelDimensions.lineCount >= 1) {
	          offset += labelDimensions.height / 2;
	        }
	      }

	      yLabel = y + offset;

	      if (this.options.label) {
	        this.labelOffset = offset;
	      }

	      this.labelModule.draw(ctx, x, yLabel, selected, hover, 'hanging');
	    }
	  }]);

	  return CircleImageBase;
	}(NodeBase);

	/**
	 * A Circle Node/Cluster shape.
	 *
	 * @extends CircleImageBase
	 */

	var Circle =
	/*#__PURE__*/
	function (_CircleImageBase) {
	  inherits$1(Circle, _CircleImageBase);

	  /**
	   * @param {Object} options
	   * @param {Object} body
	   * @param {Label} labelModule
	   */
	  function Circle(options, body, labelModule) {
	    var _this;

	    classCallCheck(this, Circle);

	    _this = possibleConstructorReturn$1(this, getPrototypeOf$7(Circle).call(this, options, body, labelModule));

	    _this._setMargins(labelModule);

	    return _this;
	  }
	  /**
	   *
	   * @param {CanvasRenderingContext2D} ctx
	   * @param {boolean} [selected]
	   * @param {boolean} [hover]
	   */


	  createClass(Circle, [{
	    key: "resize",
	    value: function resize(ctx) {
	      var selected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.selected;
	      var hover = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.hover;

	      if (this.needsRefresh(selected, hover)) {
	        var dimensions = this.getDimensionsFromLabel(ctx, selected, hover);
	        var diameter = Math.max(dimensions.width + this.margin.right + this.margin.left, dimensions.height + this.margin.top + this.margin.bottom);
	        this.options.size = diameter / 2; // NOTE: this size field only set here, not in Ellipse, Database, Box

	        this.width = diameter;
	        this.height = diameter;
	        this.radius = this.width / 2;
	      }
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {number} x width
	     * @param {number} y height
	     * @param {boolean} selected
	     * @param {boolean} hover
	     * @param {ArrowOptions} values
	     */

	  }, {
	    key: "draw",
	    value: function draw(ctx, x, y, selected, hover, values) {
	      this.resize(ctx, selected, hover);
	      this.left = x - this.width / 2;
	      this.top = y - this.height / 2;

	      this._drawRawCircle(ctx, x, y, values);

	      this.updateBoundingBox(x, y);
	      this.labelModule.draw(ctx, this.left + this.textSize.width / 2 + this.margin.left, y, selected, hover);
	    }
	    /**
	     *
	     * @param {number} x width
	     * @param {number} y height
	     */

	  }, {
	    key: "updateBoundingBox",
	    value: function updateBoundingBox(x, y) {
	      this.boundingBox.top = y - this.options.size;
	      this.boundingBox.left = x - this.options.size;
	      this.boundingBox.right = x + this.options.size;
	      this.boundingBox.bottom = y + this.options.size;
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {number} angle - Unused
	     * @returns {number}
	     */

	  }, {
	    key: "distanceToBorder",
	    value: function distanceToBorder(ctx, angle) {
	      // eslint-disable-line no-unused-vars
	      this.resize(ctx);
	      return this.width * 0.5;
	    }
	  }]);

	  return Circle;
	}(CircleImageBase);

	/**
	 * A CircularImage Node/Cluster shape.
	 *
	 * @extends CircleImageBase
	 */

	var CircularImage =
	/*#__PURE__*/
	function (_CircleImageBase) {
	  inherits$1(CircularImage, _CircleImageBase);

	  /**
	   * @param {Object} options
	   * @param {Object} body
	   * @param {Label} labelModule
	   * @param {Image} imageObj
	   * @param {Image} imageObjAlt
	   */
	  function CircularImage(options, body, labelModule, imageObj, imageObjAlt) {
	    var _this;

	    classCallCheck(this, CircularImage);

	    _this = possibleConstructorReturn$1(this, getPrototypeOf$7(CircularImage).call(this, options, body, labelModule));

	    _this.setImages(imageObj, imageObjAlt);

	    return _this;
	  }
	  /**
	   *
	   * @param {CanvasRenderingContext2D} ctx
	   * @param {boolean} [selected]
	   * @param {boolean} [hover]
	   */


	  createClass(CircularImage, [{
	    key: "resize",
	    value: function resize(ctx) {
	      var selected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.selected;
	      var hover = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.hover;
	      var imageAbsent = this.imageObj.src === undefined || this.imageObj.width === undefined || this.imageObj.height === undefined;

	      if (imageAbsent) {
	        var diameter = this.options.size * 2;
	        this.width = diameter;
	        this.height = diameter;
	        this.radius = 0.5 * this.width;
	        return;
	      } // At this point, an image is present, i.e. this.imageObj is valid.


	      if (this.needsRefresh(selected, hover)) {
	        this._resizeImage();
	      }
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {number} x width
	     * @param {number} y height
	     * @param {boolean} selected
	     * @param {boolean} hover
	     * @param {ArrowOptions} values
	     */

	  }, {
	    key: "draw",
	    value: function draw(ctx, x, y, selected, hover, values) {
	      this.switchImages(selected);
	      this.resize();
	      this.left = x - this.width / 2;
	      this.top = y - this.height / 2; // draw the background circle. IMPORTANT: the stroke in this method is used by the clip method below.

	      this._drawRawCircle(ctx, x, y, values); // now we draw in the circle, we save so we can revert the clip operation after drawing.


	      ctx.save(); // clip is used to use the stroke in drawRawCircle as an area that we can draw in.

	      ctx.clip(); // draw the image

	      this._drawImageAtPosition(ctx, values); // restore so we can again draw on the full canvas


	      ctx.restore();

	      this._drawImageLabel(ctx, x, y, selected, hover);

	      this.updateBoundingBox(x, y);
	    } // TODO: compare with Circle.updateBoundingBox(), consolidate? More stuff is happening here

	    /**
	     *
	     * @param {number} x width
	     * @param {number} y height
	     */

	  }, {
	    key: "updateBoundingBox",
	    value: function updateBoundingBox(x, y) {
	      this.boundingBox.top = y - this.options.size;
	      this.boundingBox.left = x - this.options.size;
	      this.boundingBox.right = x + this.options.size;
	      this.boundingBox.bottom = y + this.options.size; // TODO: compare with Image.updateBoundingBox(), consolidate?

	      this.boundingBox.left = Math.min(this.boundingBox.left, this.labelModule.size.left);
	      this.boundingBox.right = Math.max(this.boundingBox.right, this.labelModule.size.left + this.labelModule.size.width);
	      this.boundingBox.bottom = Math.max(this.boundingBox.bottom, this.boundingBox.bottom + this.labelOffset);
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {number} angle - Unused
	     * @returns {number}
	     */

	  }, {
	    key: "distanceToBorder",
	    value: function distanceToBorder(ctx, angle) {
	      // eslint-disable-line no-unused-vars
	      this.resize(ctx);
	      return this.width * 0.5;
	    }
	  }]);

	  return CircularImage;
	}(CircleImageBase);

	/**
	 * A Database Node/Cluster shape.
	 *
	 * @extends NodeBase
	 */

	var Database =
	/*#__PURE__*/
	function (_NodeBase) {
	  inherits$1(Database, _NodeBase);

	  /**
	   * @param {Object} options
	   * @param {Object} body
	   * @param {Label} labelModule
	   */
	  function Database(options, body, labelModule) {
	    var _this;

	    classCallCheck(this, Database);

	    _this = possibleConstructorReturn$1(this, getPrototypeOf$7(Database).call(this, options, body, labelModule));

	    _this._setMargins(labelModule);

	    return _this;
	  }
	  /**
	   *
	   * @param {CanvasRenderingContext2D} ctx
	   * @param {boolean} selected
	   * @param {boolean} hover
	   */


	  createClass(Database, [{
	    key: "resize",
	    value: function resize(ctx, selected, hover) {
	      if (this.needsRefresh(selected, hover)) {
	        var dimensions = this.getDimensionsFromLabel(ctx, selected, hover);
	        var size = dimensions.width + this.margin.right + this.margin.left;
	        this.width = size;
	        this.height = size;
	        this.radius = this.width / 2;
	      }
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {number} x width
	     * @param {number} y height
	     * @param {boolean} selected
	     * @param {boolean} hover
	     * @param {ArrowOptions} values
	     */

	  }, {
	    key: "draw",
	    value: function draw(ctx, x, y, selected, hover, values) {
	      this.resize(ctx, selected, hover);
	      this.left = x - this.width / 2;
	      this.top = y - this.height / 2;
	      this.initContextForDraw(ctx, values);
	      drawDatabase(ctx, x - this.width / 2, y - this.height / 2, this.width, this.height);
	      this.performFill(ctx, values);
	      this.updateBoundingBox(x, y, ctx, selected, hover);
	      this.labelModule.draw(ctx, this.left + this.textSize.width / 2 + this.margin.left, this.top + this.textSize.height / 2 + this.margin.top, selected, hover);
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {number} angle
	     * @returns {number}
	     */

	  }, {
	    key: "distanceToBorder",
	    value: function distanceToBorder(ctx, angle) {
	      return this._distanceToBorder(ctx, angle);
	    }
	  }]);

	  return Database;
	}(NodeBase);

	/**
	 * Base class for constructing Node/Cluster Shapes.
	 *
	 * @extends NodeBase
	 */

	var ShapeBase =
	/*#__PURE__*/
	function (_NodeBase) {
	  inherits$1(ShapeBase, _NodeBase);

	  /**
	   * @param {Object} options
	   * @param {Object} body
	   * @param {Label} labelModule
	   */
	  function ShapeBase(options, body, labelModule) {
	    classCallCheck(this, ShapeBase);

	    return possibleConstructorReturn$1(this, getPrototypeOf$7(ShapeBase).call(this, options, body, labelModule));
	  }
	  /**
	   *
	   * @param {CanvasRenderingContext2D} ctx
	   * @param {boolean} [selected]
	   * @param {boolean} [hover]
	   * @param {Object} [values={size: this.options.size}]
	   */


	  createClass(ShapeBase, [{
	    key: "resize",
	    value: function resize(ctx) {
	      var selected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.selected;
	      var hover = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.hover;
	      var values = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {
	        size: this.options.size
	      };

	      if (this.needsRefresh(selected, hover)) {
	        this.labelModule.getTextSize(ctx, selected, hover);
	        var size = 2 * values.size;
	        this.width = size;
	        this.height = size;
	        this.radius = 0.5 * this.width;
	      }
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {string} shape
	     * @param {number} sizeMultiplier - Unused! TODO: Remove next major release
	     * @param {number} x
	     * @param {number} y
	     * @param {boolean} selected
	     * @param {boolean} hover
	     * @param {ArrowOptions} values
	     * @private
	     */

	  }, {
	    key: "_drawShape",
	    value: function _drawShape(ctx, shape, sizeMultiplier, x, y, selected, hover, values) {
	      this.resize(ctx, selected, hover, values);
	      this.left = x - this.width / 2;
	      this.top = y - this.height / 2;
	      this.initContextForDraw(ctx, values);
	      getShape(shape)(ctx, x, y, values.size);
	      this.performFill(ctx, values);

	      if (this.options.icon !== undefined) {
	        if (this.options.icon.code !== undefined) {
	          ctx.font = (selected ? "bold " : "") + this.height / 2 + "px " + (this.options.icon.face || 'FontAwesome');
	          ctx.fillStyle = this.options.icon.color || "black";
	          ctx.textAlign = "center";
	          ctx.textBaseline = "middle";
	          ctx.fillText(this.options.icon.code, x, y);
	        }
	      }

	      if (this.options.label !== undefined) {
	        // Need to call following here in order to ensure value for `this.labelModule.size.height`
	        this.labelModule.calculateLabelSize(ctx, selected, hover, x, y, 'hanging');
	        var yLabel = y + 0.5 * this.height + 0.5 * this.labelModule.size.height;
	        this.labelModule.draw(ctx, x, yLabel, selected, hover, 'hanging');
	      }

	      this.updateBoundingBox(x, y);
	    }
	    /**
	     *
	     * @param {number} x
	     * @param {number} y
	     */

	  }, {
	    key: "updateBoundingBox",
	    value: function updateBoundingBox(x, y) {
	      this.boundingBox.top = y - this.options.size;
	      this.boundingBox.left = x - this.options.size;
	      this.boundingBox.right = x + this.options.size;
	      this.boundingBox.bottom = y + this.options.size;

	      if (this.options.label !== undefined && this.labelModule.size.width > 0) {
	        this.boundingBox.left = Math.min(this.boundingBox.left, this.labelModule.size.left);
	        this.boundingBox.right = Math.max(this.boundingBox.right, this.labelModule.size.left + this.labelModule.size.width);
	        this.boundingBox.bottom = Math.max(this.boundingBox.bottom, this.boundingBox.bottom + this.labelModule.size.height);
	      }
	    }
	  }]);

	  return ShapeBase;
	}(NodeBase);

	/**
	 * A Diamond Node/Cluster shape.
	 *
	 * @extends ShapeBase
	 */

	var Diamond =
	/*#__PURE__*/
	function (_ShapeBase) {
	  inherits$1(Diamond, _ShapeBase);

	  /**
	   * @param {Object} options
	   * @param {Object} body
	   * @param {Label} labelModule
	   */
	  function Diamond(options, body, labelModule) {
	    classCallCheck(this, Diamond);

	    return possibleConstructorReturn$1(this, getPrototypeOf$7(Diamond).call(this, options, body, labelModule));
	  }
	  /**
	   *
	   * @param {CanvasRenderingContext2D} ctx
	   * @param {number} x width
	   * @param {number} y height
	   * @param {boolean} selected
	   * @param {boolean} hover
	   * @param {ArrowOptions} values
	   */


	  createClass(Diamond, [{
	    key: "draw",
	    value: function draw(ctx, x, y, selected, hover, values) {
	      this._drawShape(ctx, 'diamond', 4, x, y, selected, hover, values);
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {number} angle
	     * @returns {number}
	     */

	  }, {
	    key: "distanceToBorder",
	    value: function distanceToBorder(ctx, angle) {
	      return this._distanceToBorder(ctx, angle);
	    }
	  }]);

	  return Diamond;
	}(ShapeBase);

	/**
	 * A Dot Node/Cluster shape.
	 *
	 * @extends ShapeBase
	 */

	var Dot =
	/*#__PURE__*/
	function (_ShapeBase) {
	  inherits$1(Dot, _ShapeBase);

	  /**
	   * @param {Object} options
	   * @param {Object} body
	   * @param {Label} labelModule
	   */
	  function Dot(options, body, labelModule) {
	    classCallCheck(this, Dot);

	    return possibleConstructorReturn$1(this, getPrototypeOf$7(Dot).call(this, options, body, labelModule));
	  }
	  /**
	   *
	   * @param {CanvasRenderingContext2D} ctx
	   * @param {number} x width
	   * @param {number} y height
	   * @param {boolean} selected
	   * @param {boolean} hover
	   * @param {ArrowOptions} values
	   */


	  createClass(Dot, [{
	    key: "draw",
	    value: function draw(ctx, x, y, selected, hover, values) {
	      this._drawShape(ctx, 'circle', 2, x, y, selected, hover, values);
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {number} angle
	     * @returns {number}
	     */

	  }, {
	    key: "distanceToBorder",
	    value: function distanceToBorder(ctx, angle) {
	      // eslint-disable-line no-unused-vars
	      this.resize(ctx);
	      return this.options.size;
	    }
	  }]);

	  return Dot;
	}(ShapeBase);

	/**
	 * Am Ellipse Node/Cluster shape.
	 *
	 * @extends NodeBase
	 */

	var Ellipse =
	/*#__PURE__*/
	function (_NodeBase) {
	  inherits$1(Ellipse, _NodeBase);

	  /**
	   * @param {Object} options
	   * @param {Object} body
	   * @param {Label} labelModule
	   */
	  function Ellipse(options, body, labelModule) {
	    classCallCheck(this, Ellipse);

	    return possibleConstructorReturn$1(this, getPrototypeOf$7(Ellipse).call(this, options, body, labelModule));
	  }
	  /**
	   *
	   * @param {CanvasRenderingContext2D} ctx
	   * @param {boolean} [selected]
	   * @param {boolean} [hover]
	   */


	  createClass(Ellipse, [{
	    key: "resize",
	    value: function resize(ctx) {
	      var selected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.selected;
	      var hover = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.hover;

	      if (this.needsRefresh(selected, hover)) {
	        var dimensions = this.getDimensionsFromLabel(ctx, selected, hover);
	        this.height = dimensions.height * 2;
	        this.width = dimensions.width + dimensions.height;
	        this.radius = 0.5 * this.width;
	      }
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {number} x width
	     * @param {number} y height
	     * @param {boolean} selected
	     * @param {boolean} hover
	     * @param {ArrowOptions} values
	     */

	  }, {
	    key: "draw",
	    value: function draw(ctx, x, y, selected, hover, values) {
	      this.resize(ctx, selected, hover);
	      this.left = x - this.width * 0.5;
	      this.top = y - this.height * 0.5;
	      this.initContextForDraw(ctx, values);
	      drawEllipse(ctx, this.left, this.top, this.width, this.height);
	      this.performFill(ctx, values);
	      this.updateBoundingBox(x, y, ctx, selected, hover);
	      this.labelModule.draw(ctx, x, y, selected, hover);
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {number} angle
	     * @returns {number}
	     */

	  }, {
	    key: "distanceToBorder",
	    value: function distanceToBorder(ctx, angle) {
	      this.resize(ctx);
	      var a = this.width * 0.5;
	      var b = this.height * 0.5;
	      var w = Math.sin(angle) * a;
	      var h = Math.cos(angle) * b;
	      return a * b / Math.sqrt(w * w + h * h);
	    }
	  }]);

	  return Ellipse;
	}(NodeBase);

	/**
	 * An icon replacement for the default Node shape.
	 *
	 * @extends NodeBase
	 */

	var Icon =
	/*#__PURE__*/
	function (_NodeBase) {
	  inherits$1(Icon, _NodeBase);

	  /**
	   * @param {Object} options
	   * @param {Object} body
	   * @param {Label} labelModule
	   */
	  function Icon(options, body, labelModule) {
	    var _this;

	    classCallCheck(this, Icon);

	    _this = possibleConstructorReturn$1(this, getPrototypeOf$7(Icon).call(this, options, body, labelModule));

	    _this._setMargins(labelModule);

	    return _this;
	  }
	  /**
	   *
	   * @param {CanvasRenderingContext2D} ctx - Unused.
	   * @param {boolean} [selected]
	   * @param {boolean} [hover]
	   */


	  createClass(Icon, [{
	    key: "resize",
	    value: function resize(ctx, selected, hover) {
	      if (this.needsRefresh(selected, hover)) {
	        this.iconSize = {
	          width: Number(this.options.icon.size),
	          height: Number(this.options.icon.size)
	        };
	        this.width = this.iconSize.width + this.margin.right + this.margin.left;
	        this.height = this.iconSize.height + this.margin.top + this.margin.bottom;
	        this.radius = 0.5 * this.width;
	      }
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {number} x width
	     * @param {number} y height
	     * @param {boolean} selected
	     * @param {boolean} hover
	     * @param {ArrowOptions} values
	     */

	  }, {
	    key: "draw",
	    value: function draw(ctx, x, y, selected, hover, values) {
	      this.resize(ctx, selected, hover);
	      this.options.icon.size = this.options.icon.size || 50;
	      this.left = x - this.width / 2;
	      this.top = y - this.height / 2;

	      this._icon(ctx, x, y, selected, hover, values);

	      if (this.options.label !== undefined) {
	        var iconTextSpacing = 5;
	        this.labelModule.draw(ctx, this.left + this.iconSize.width / 2 + this.margin.left, y + this.height / 2 + iconTextSpacing, selected);
	      }

	      this.updateBoundingBox(x, y);
	    }
	    /**
	     *
	     * @param {number} x
	     * @param {number} y
	     */

	  }, {
	    key: "updateBoundingBox",
	    value: function updateBoundingBox(x, y) {
	      this.boundingBox.top = y - this.options.icon.size * 0.5;
	      this.boundingBox.left = x - this.options.icon.size * 0.5;
	      this.boundingBox.right = x + this.options.icon.size * 0.5;
	      this.boundingBox.bottom = y + this.options.icon.size * 0.5;

	      if (this.options.label !== undefined && this.labelModule.size.width > 0) {
	        var iconTextSpacing = 5;
	        this.boundingBox.left = Math.min(this.boundingBox.left, this.labelModule.size.left);
	        this.boundingBox.right = Math.max(this.boundingBox.right, this.labelModule.size.left + this.labelModule.size.width);
	        this.boundingBox.bottom = Math.max(this.boundingBox.bottom, this.boundingBox.bottom + this.labelModule.size.height + iconTextSpacing);
	      }
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {number} x width
	     * @param {number} y height
	     * @param {boolean} selected
	     * @param {boolean} hover - Unused
	     * @param {ArrowOptions} values
	     */

	  }, {
	    key: "_icon",
	    value: function _icon(ctx, x, y, selected, hover, values) {
	      var iconSize = Number(this.options.icon.size);

	      if (this.options.icon.code !== undefined) {
	        ctx.font = [this.options.icon.weight != null ? this.options.icon.weight : selected ? "bold" : "", // If the weight is forced (for example to make Font Awesome 5 work
	        // properly) substitute slightly bigger size for bold font face.
	        (this.options.icon.weight != null && selected ? 5 : 0) + iconSize + "px", this.options.icon.face].join(" "); // draw icon

	        ctx.fillStyle = this.options.icon.color || "black";
	        ctx.textAlign = "center";
	        ctx.textBaseline = "middle"; // draw shadow if enabled

	        this.enableShadow(ctx, values);
	        ctx.fillText(this.options.icon.code, x, y); // disable shadows for other elements.

	        this.disableShadow(ctx, values);
	      } else {
	        console.error('When using the icon shape, you need to define the code in the icon options object. This can be done per node or globally.');
	      }
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {number} angle
	     * @returns {number}
	     */

	  }, {
	    key: "distanceToBorder",
	    value: function distanceToBorder(ctx, angle) {
	      return this._distanceToBorder(ctx, angle);
	    }
	  }]);

	  return Icon;
	}(NodeBase);

	/**
	 * An image-based replacement for the default Node shape.
	 *
	 * @extends CircleImageBase
	 */

	var Image$1 =
	/*#__PURE__*/
	function (_CircleImageBase) {
	  inherits$1(Image, _CircleImageBase);

	  /**
	   * @param {Object} options
	   * @param {Object} body
	   * @param {Label} labelModule
	   * @param {Image} imageObj
	   * @param {Image} imageObjAlt
	   */
	  function Image(options, body, labelModule, imageObj, imageObjAlt) {
	    var _this;

	    classCallCheck(this, Image);

	    _this = possibleConstructorReturn$1(this, getPrototypeOf$7(Image).call(this, options, body, labelModule));

	    _this.setImages(imageObj, imageObjAlt);

	    return _this;
	  }
	  /**
	   *
	   * @param {CanvasRenderingContext2D} ctx - Unused.
	   * @param {boolean} [selected]
	   * @param {boolean} [hover]
	   */


	  createClass(Image, [{
	    key: "resize",
	    value: function resize(ctx) {
	      var selected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.selected;
	      var hover = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.hover;
	      var imageAbsent = this.imageObj.src === undefined || this.imageObj.width === undefined || this.imageObj.height === undefined;

	      if (imageAbsent) {
	        var side = this.options.size * 2;
	        this.width = side;
	        this.height = side;
	        return;
	      }

	      if (this.needsRefresh(selected, hover)) {
	        this._resizeImage();
	      }
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {number} x width
	     * @param {number} y height
	     * @param {boolean} selected
	     * @param {boolean} hover
	     * @param {ArrowOptions} values
	     */

	  }, {
	    key: "draw",
	    value: function draw(ctx, x, y, selected, hover, values) {
	      this.switchImages(selected);
	      this.resize();
	      this.left = x - this.width / 2;
	      this.top = y - this.height / 2;

	      if (this.options.shapeProperties.useBorderWithImage === true) {
	        var neutralborderWidth = this.options.borderWidth;
	        var selectionLineWidth = this.options.borderWidthSelected || 2 * this.options.borderWidth;
	        var borderWidth = (selected ? selectionLineWidth : neutralborderWidth) / this.body.view.scale;
	        ctx.lineWidth = Math.min(this.width, borderWidth);
	        ctx.beginPath(); // setup the line properties.

	        ctx.strokeStyle = selected ? this.options.color.highlight.border : hover ? this.options.color.hover.border : this.options.color.border; // set a fillstyle

	        ctx.fillStyle = selected ? this.options.color.highlight.background : hover ? this.options.color.hover.background : this.options.color.background; // draw a rectangle to form the border around. This rectangle is filled so the opacity of a picture (in future vis releases?) can be used to tint the image

	        ctx.rect(this.left - 0.5 * ctx.lineWidth, this.top - 0.5 * ctx.lineWidth, this.width + ctx.lineWidth, this.height + ctx.lineWidth);

	        fill$2(ctx).call(ctx);

	        this.performStroke(ctx, values);
	        ctx.closePath();
	      }

	      this._drawImageAtPosition(ctx, values);

	      this._drawImageLabel(ctx, x, y, selected, hover);

	      this.updateBoundingBox(x, y);
	    }
	    /**
	     *
	     * @param {number} x
	     * @param {number} y
	     */

	  }, {
	    key: "updateBoundingBox",
	    value: function updateBoundingBox(x, y) {
	      this.resize();

	      this._updateBoundingBox(x, y);

	      if (this.options.label !== undefined && this.labelModule.size.width > 0) {
	        this.boundingBox.left = Math.min(this.boundingBox.left, this.labelModule.size.left);
	        this.boundingBox.right = Math.max(this.boundingBox.right, this.labelModule.size.left + this.labelModule.size.width);
	        this.boundingBox.bottom = Math.max(this.boundingBox.bottom, this.boundingBox.bottom + this.labelOffset);
	      }
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {number} angle
	     * @returns {number}
	     */

	  }, {
	    key: "distanceToBorder",
	    value: function distanceToBorder(ctx, angle) {
	      return this._distanceToBorder(ctx, angle);
	    }
	  }]);

	  return Image;
	}(CircleImageBase);

	/**
	 * A Square Node/Cluster shape.
	 *
	 * @extends ShapeBase
	 */

	var Square =
	/*#__PURE__*/
	function (_ShapeBase) {
	  inherits$1(Square, _ShapeBase);

	  /**
	   * @param {Object} options
	   * @param {Object} body
	   * @param {Label} labelModule
	   */
	  function Square(options, body, labelModule) {
	    classCallCheck(this, Square);

	    return possibleConstructorReturn$1(this, getPrototypeOf$7(Square).call(this, options, body, labelModule));
	  }
	  /**
	   *
	   * @param {CanvasRenderingContext2D} ctx
	   * @param {number} x width
	   * @param {number} y height
	   * @param {boolean} selected
	   * @param {boolean} hover
	   * @param {ArrowOptions} values
	   */


	  createClass(Square, [{
	    key: "draw",
	    value: function draw(ctx, x, y, selected, hover, values) {
	      this._drawShape(ctx, 'square', 2, x, y, selected, hover, values);
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {number} angle
	     * @returns {number}
	     */

	  }, {
	    key: "distanceToBorder",
	    value: function distanceToBorder(ctx, angle) {
	      return this._distanceToBorder(ctx, angle);
	    }
	  }]);

	  return Square;
	}(ShapeBase);

	/**
	 * A Hexagon Node/Cluster shape.
	 *
	 * @extends ShapeBase
	 */

	var Hexagon =
	/*#__PURE__*/
	function (_ShapeBase) {
	  inherits$1(Hexagon, _ShapeBase);

	  /**
	   * @param {Object} options
	   * @param {Object} body
	   * @param {Label} labelModule
	   */
	  function Hexagon(options, body, labelModule) {
	    classCallCheck(this, Hexagon);

	    return possibleConstructorReturn$1(this, getPrototypeOf$7(Hexagon).call(this, options, body, labelModule));
	  }
	  /**
	   *
	   * @param {CanvasRenderingContext2D} ctx
	   * @param {number} x width
	   * @param {number} y height
	   * @param {boolean} selected
	   * @param {boolean} hover
	   * @param {ArrowOptions} values
	   */


	  createClass(Hexagon, [{
	    key: "draw",
	    value: function draw(ctx, x, y, selected, hover, values) {
	      this._drawShape(ctx, 'hexagon', 4, x, y, selected, hover, values);
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {number} angle
	     * @returns {number}
	     */

	  }, {
	    key: "distanceToBorder",
	    value: function distanceToBorder(ctx, angle) {
	      return this._distanceToBorder(ctx, angle);
	    }
	  }]);

	  return Hexagon;
	}(ShapeBase);

	/**
	 * A Star Node/Cluster shape.
	 *
	 * @extends ShapeBase
	 */

	var Star =
	/*#__PURE__*/
	function (_ShapeBase) {
	  inherits$1(Star, _ShapeBase);

	  /**
	   * @param {Object} options
	   * @param {Object} body
	   * @param {Label} labelModule
	   */
	  function Star(options, body, labelModule) {
	    classCallCheck(this, Star);

	    return possibleConstructorReturn$1(this, getPrototypeOf$7(Star).call(this, options, body, labelModule));
	  }
	  /**
	   *
	   * @param {CanvasRenderingContext2D} ctx
	   * @param {number} x width
	   * @param {number} y height
	   * @param {boolean} selected
	   * @param {boolean} hover
	   * @param {ArrowOptions} values
	   */


	  createClass(Star, [{
	    key: "draw",
	    value: function draw(ctx, x, y, selected, hover, values) {
	      this._drawShape(ctx, 'star', 4, x, y, selected, hover, values);
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {number} angle
	     * @returns {number}
	     */

	  }, {
	    key: "distanceToBorder",
	    value: function distanceToBorder(ctx, angle) {
	      return this._distanceToBorder(ctx, angle);
	    }
	  }]);

	  return Star;
	}(ShapeBase);

	/**
	 * A text-based replacement for the default Node shape.
	 *
	 * @extends NodeBase
	 */

	var Text =
	/*#__PURE__*/
	function (_NodeBase) {
	  inherits$1(Text, _NodeBase);

	  /**
	   * @param {Object} options
	   * @param {Object} body
	   * @param {Label} labelModule
	   */
	  function Text(options, body, labelModule) {
	    var _this;

	    classCallCheck(this, Text);

	    _this = possibleConstructorReturn$1(this, getPrototypeOf$7(Text).call(this, options, body, labelModule));

	    _this._setMargins(labelModule);

	    return _this;
	  }
	  /**
	   *
	   * @param {CanvasRenderingContext2D} ctx
	   * @param {boolean} selected
	   * @param {boolean} hover
	   */


	  createClass(Text, [{
	    key: "resize",
	    value: function resize(ctx, selected, hover) {
	      if (this.needsRefresh(selected, hover)) {
	        this.textSize = this.labelModule.getTextSize(ctx, selected, hover);
	        this.width = this.textSize.width + this.margin.right + this.margin.left;
	        this.height = this.textSize.height + this.margin.top + this.margin.bottom;
	        this.radius = 0.5 * this.width;
	      }
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {number} x width
	     * @param {number} y height
	     * @param {boolean} selected
	     * @param {boolean} hover
	     * @param {ArrowOptions} values
	     */

	  }, {
	    key: "draw",
	    value: function draw(ctx, x, y, selected, hover, values) {
	      this.resize(ctx, selected, hover);
	      this.left = x - this.width / 2;
	      this.top = y - this.height / 2; // draw shadow if enabled

	      this.enableShadow(ctx, values);
	      this.labelModule.draw(ctx, this.left + this.textSize.width / 2 + this.margin.left, this.top + this.textSize.height / 2 + this.margin.top, selected, hover); // disable shadows for other elements.

	      this.disableShadow(ctx, values);
	      this.updateBoundingBox(x, y, ctx, selected, hover);
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {number} angle
	     * @returns {number}
	     */

	  }, {
	    key: "distanceToBorder",
	    value: function distanceToBorder(ctx, angle) {
	      return this._distanceToBorder(ctx, angle);
	    }
	  }]);

	  return Text;
	}(NodeBase);

	/**
	 * A Triangle Node/Cluster shape.
	 *
	 * @extends ShapeBase
	 */

	var Triangle =
	/*#__PURE__*/
	function (_ShapeBase) {
	  inherits$1(Triangle, _ShapeBase);

	  /**
	   * @param {Object} options
	   * @param {Object} body
	   * @param {Label} labelModule
	   */
	  function Triangle(options, body, labelModule) {
	    classCallCheck(this, Triangle);

	    return possibleConstructorReturn$1(this, getPrototypeOf$7(Triangle).call(this, options, body, labelModule));
	  }
	  /**
	   *
	   * @param {CanvasRenderingContext2D} ctx
	   * @param {number} x
	   * @param {number} y
	   * @param {boolean} selected
	   * @param {boolean} hover
	   * @param {ArrowOptions} values
	   */


	  createClass(Triangle, [{
	    key: "draw",
	    value: function draw(ctx, x, y, selected, hover, values) {
	      this._drawShape(ctx, 'triangle', 3, x, y, selected, hover, values);
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {number} angle
	     * @returns {number}
	     */

	  }, {
	    key: "distanceToBorder",
	    value: function distanceToBorder(ctx, angle) {
	      return this._distanceToBorder(ctx, angle);
	    }
	  }]);

	  return Triangle;
	}(ShapeBase);

	/**
	 * A downward facing Triangle Node/Cluster shape.
	 *
	 * @extends ShapeBase
	 */

	var TriangleDown =
	/*#__PURE__*/
	function (_ShapeBase) {
	  inherits$1(TriangleDown, _ShapeBase);

	  /**
	   * @param {Object} options
	   * @param {Object} body
	   * @param {Label} labelModule
	   */
	  function TriangleDown(options, body, labelModule) {
	    classCallCheck(this, TriangleDown);

	    return possibleConstructorReturn$1(this, getPrototypeOf$7(TriangleDown).call(this, options, body, labelModule));
	  }
	  /**
	   *
	   * @param {CanvasRenderingContext2D} ctx
	   * @param {number} x
	   * @param {number} y
	   * @param {boolean} selected
	   * @param {boolean} hover
	   * @param {ArrowOptions} values
	   */


	  createClass(TriangleDown, [{
	    key: "draw",
	    value: function draw(ctx, x, y, selected, hover, values) {
	      this._drawShape(ctx, 'triangleDown', 3, x, y, selected, hover, values);
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {number} angle
	     * @returns {number}
	     */

	  }, {
	    key: "distanceToBorder",
	    value: function distanceToBorder(ctx, angle) {
	      return this._distanceToBorder(ctx, angle);
	    }
	  }]);

	  return TriangleDown;
	}(ShapeBase);

	var errorFound = false;
	var allOptions;
	var printStyle = 'background: #FFeeee; color: #dd0000';
	/**
	 *  Used to validate options.
	 */

	var Validator =
	/*#__PURE__*/
	function () {
	  /**
	   * @ignore
	   */
	  function Validator() {
	    classCallCheck(this, Validator);
	  }
	  /**
	   * Main function to be called
	   * @param {Object} options
	   * @param {Object} referenceOptions
	   * @param {Object} subObject
	   * @returns {boolean}
	   * @static
	   */


	  createClass(Validator, null, [{
	    key: "validate",
	    value: function validate(options, referenceOptions, subObject) {
	      errorFound = false;
	      allOptions = referenceOptions;
	      var usedOptions = referenceOptions;

	      if (subObject !== undefined) {
	        usedOptions = referenceOptions[subObject];
	      }

	      Validator.parse(options, usedOptions, []);
	      return errorFound;
	    }
	    /**
	     * Will traverse an object recursively and check every value
	     * @param {Object} options
	     * @param {Object} referenceOptions
	     * @param {array} path    | where to look for the actual option
	     * @static
	     */

	  }, {
	    key: "parse",
	    value: function parse(options, referenceOptions, path) {
	      for (var option in options) {
	        if (options.hasOwnProperty(option)) {
	          Validator.check(option, options, referenceOptions, path);
	        }
	      }
	    }
	    /**
	     * Check every value. If the value is an object, call the parse function on that object.
	     * @param {string} option
	     * @param {Object} options
	     * @param {Object} referenceOptions
	     * @param {array} path    | where to look for the actual option
	     * @static
	     */

	  }, {
	    key: "check",
	    value: function check(option, options, referenceOptions, path) {
	      if (referenceOptions[option] === undefined && referenceOptions.__any__ === undefined) {
	        Validator.getSuggestion(option, referenceOptions, path);
	        return;
	      }

	      var referenceOption = option;
	      var is_object = true;

	      if (referenceOptions[option] === undefined && referenceOptions.__any__ !== undefined) {
	        // NOTE: This only triggers if the __any__ is in the top level of the options object.
	        //       THAT'S A REALLY BAD PLACE TO ALLOW IT!!!!
	        // TODO: Examine if needed, remove if possible
	        // __any__ is a wildcard. Any value is accepted and will be further analysed by reference.
	        referenceOption = '__any__'; // if the any-subgroup is not a predefined object in the configurator,
	        // we do not look deeper into the object.

	        is_object = Validator.getType(options[option]) === 'object';
	      }

	      var refOptionObj = referenceOptions[referenceOption];

	      if (is_object && refOptionObj.__type__ !== undefined) {
	        refOptionObj = refOptionObj.__type__;
	      }

	      Validator.checkFields(option, options, referenceOptions, referenceOption, refOptionObj, path);
	    }
	    /**
	     *
	     * @param {string}  option           | the option property
	     * @param {Object}  options          | The supplied options object
	     * @param {Object}  referenceOptions | The reference options containing all options and their allowed formats
	     * @param {string}  referenceOption  | Usually this is the same as option, except when handling an __any__ tag.
	     * @param {string}  refOptionObj     | This is the type object from the reference options
	     * @param {Array}   path             | where in the object is the option
	     * @static
	     */

	  }, {
	    key: "checkFields",
	    value: function checkFields(option, options, referenceOptions, referenceOption, refOptionObj, path) {
	      var log = function log(message) {
	        console.log('%c' + message + Validator.printLocation(path, option), printStyle);
	      };

	      var optionType = Validator.getType(options[option]);
	      var refOptionType = refOptionObj[optionType];

	      if (refOptionType !== undefined) {
	        // if the type is correct, we check if it is supposed to be one of a few select values
	        if (Validator.getType(refOptionType) === 'array' && indexOf$3(refOptionType).call(refOptionType, options[option]) === -1) {
	          log('Invalid option detected in "' + option + '".' + ' Allowed values are:' + Validator.print(refOptionType) + ' not "' + options[option] + '". ');
	          errorFound = true;
	        } else if (optionType === 'object' && referenceOption !== "__any__") {
	          path = copyAndExtendArray(path, option);
	          Validator.parse(options[option], referenceOptions[referenceOption], path);
	        }
	      } else if (refOptionObj['any'] === undefined) {
	        // type of the field is incorrect and the field cannot be any
	        log('Invalid type received for "' + option + '". Expected: ' + Validator.print(keys$6(refOptionObj)) + '. Received [' + optionType + '] "' + options[option] + '"');
	        errorFound = true;
	      }
	    }
	    /**
	     *
	     * @param {Object|boolean|number|string|Array.<number>|Date|Node|Moment|undefined|null} object
	     * @returns {string}
	     * @static
	     */

	  }, {
	    key: "getType",
	    value: function getType(object) {
	      var type = _typeof_1(object);

	      if (type === 'object') {
	        if (object === null) {
	          return 'null';
	        }

	        if (object instanceof Boolean) {
	          return 'boolean';
	        }

	        if (object instanceof Number) {
	          return 'number';
	        }

	        if (object instanceof String) {
	          return 'string';
	        }

	        if (isArray$3(object)) {
	          return 'array';
	        }

	        if (object instanceof Date) {
	          return 'date';
	        }

	        if (object.nodeType !== undefined) {
	          return 'dom';
	        }

	        if (object._isAMomentObject === true) {
	          return 'moment';
	        }

	        return 'object';
	      } else if (type === 'number') {
	        return 'number';
	      } else if (type === 'boolean') {
	        return 'boolean';
	      } else if (type === 'string') {
	        return 'string';
	      } else if (type === undefined) {
	        return 'undefined';
	      }

	      return type;
	    }
	    /**
	     * @param {string} option
	     * @param {Object} options
	     * @param {Array.<string>} path
	     * @static
	     */

	  }, {
	    key: "getSuggestion",
	    value: function getSuggestion(option, options, path) {
	      var localSearch = Validator.findInOptions(option, options, path, false);
	      var globalSearch = Validator.findInOptions(option, allOptions, [], true);
	      var localSearchThreshold = 8;
	      var globalSearchThreshold = 4;
	      var msg;

	      if (localSearch.indexMatch !== undefined) {
	        msg = ' in ' + Validator.printLocation(localSearch.path, option, '') + 'Perhaps it was incomplete? Did you mean: "' + localSearch.indexMatch + '"?\n\n';
	      } else if (globalSearch.distance <= globalSearchThreshold && localSearch.distance > globalSearch.distance) {
	        msg = ' in ' + Validator.printLocation(localSearch.path, option, '') + 'Perhaps it was misplaced? Matching option found at: ' + Validator.printLocation(globalSearch.path, globalSearch.closestMatch, '');
	      } else if (localSearch.distance <= localSearchThreshold) {
	        msg = '. Did you mean "' + localSearch.closestMatch + '"?' + Validator.printLocation(localSearch.path, option);
	      } else {
	        msg = '. Did you mean one of these: ' + Validator.print(keys$6(options)) + Validator.printLocation(path, option);
	      }

	      console.log('%cUnknown option detected: "' + option + '"' + msg, printStyle);
	      errorFound = true;
	    }
	    /**
	     * traverse the options in search for a match.
	     * @param {string} option
	     * @param {Object} options
	     * @param {Array} path    | where to look for the actual option
	     * @param {boolean} [recursive=false]
	     * @returns {{closestMatch: string, path: Array, distance: number}}
	     * @static
	     */

	  }, {
	    key: "findInOptions",
	    value: function findInOptions(option, options, path) {
	      var recursive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
	      var min = 1e9;
	      var closestMatch = '';
	      var closestMatchPath = [];
	      var lowerCaseOption = option.toLowerCase();
	      var indexMatch = undefined;

	      for (var op in options) {
	        // eslint-disable-line guard-for-in
	        var distance = void 0;

	        if (options[op].__type__ !== undefined && recursive === true) {
	          var result = Validator.findInOptions(option, options[op], copyAndExtendArray(path, op));

	          if (min > result.distance) {
	            closestMatch = result.closestMatch;
	            closestMatchPath = result.path;
	            min = result.distance;
	            indexMatch = result.indexMatch;
	          }
	        } else {
	          var _context;

	          if (indexOf$3(_context = op.toLowerCase()).call(_context, lowerCaseOption) !== -1) {
	            indexMatch = op;
	          }

	          distance = Validator.levenshteinDistance(option, op);

	          if (min > distance) {
	            closestMatch = op;
	            closestMatchPath = copyArray(path);
	            min = distance;
	          }
	        }
	      }

	      return {
	        closestMatch: closestMatch,
	        path: closestMatchPath,
	        distance: min,
	        indexMatch: indexMatch
	      };
	    }
	    /**
	     * @param {Array.<string>} path
	     * @param {Object} option
	     * @param {string} prefix
	     * @returns {String}
	     * @static
	     */

	  }, {
	    key: "printLocation",
	    value: function printLocation(path, option) {
	      var prefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'Problem value found at: \n';
	      var str = '\n\n' + prefix + 'options = {\n';

	      for (var i = 0; i < path.length; i++) {
	        for (var j = 0; j < i + 1; j++) {
	          str += '  ';
	        }

	        str += path[i] + ': {\n';
	      }

	      for (var _j = 0; _j < path.length + 1; _j++) {
	        str += '  ';
	      }

	      str += option + '\n';

	      for (var _i = 0; _i < path.length + 1; _i++) {
	        for (var _j2 = 0; _j2 < path.length - _i; _j2++) {
	          str += '  ';
	        }

	        str += '}\n';
	      }

	      return str + '\n\n';
	    }
	    /**
	     * @param {Object} options
	     * @returns {String}
	     * @static
	     */

	  }, {
	    key: "print",
	    value: function print(options) {
	      return stringify$2(options).replace(/(\")|(\[)|(\])|(,"__type__")/g, "").replace(/(\,)/g, ', ');
	    }
	    /**
	     *  Compute the edit distance between the two given strings
	     * http://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Levenshtein_distance#JavaScript
	     *
	     * Copyright (c) 2011 Andrei Mackenzie
	     *
	     * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
	     *
	     * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
	     *
	     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
	     *
	     * @param {string} a
	     * @param {string} b
	     * @returns {Array.<Array.<number>>}}
	     * @static
	     */

	  }, {
	    key: "levenshteinDistance",
	    value: function levenshteinDistance(a, b) {
	      if (a.length === 0) return b.length;
	      if (b.length === 0) return a.length;
	      var matrix = []; // increment along the first column of each row

	      var i;

	      for (i = 0; i <= b.length; i++) {
	        matrix[i] = [i];
	      } // increment each column in the first row


	      var j;

	      for (j = 0; j <= a.length; j++) {
	        matrix[0][j] = j;
	      } // Fill in the rest of the matrix


	      for (i = 1; i <= b.length; i++) {
	        for (j = 1; j <= a.length; j++) {
	          if (b.charAt(i - 1) == a.charAt(j - 1)) {
	            matrix[i][j] = matrix[i - 1][j - 1];
	          } else {
	            matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // substitution
	            Math.min(matrix[i][j - 1] + 1, // insertion
	            matrix[i - 1][j] + 1)); // deletion
	          }
	        }
	      }

	      return matrix[b.length][a.length];
	    }
	  }]);

	  return Validator;
	}();

	function ownKeys$4(object, enumerableOnly) { var keys = keys$6(object); if (getOwnPropertySymbols$2) { var symbols = getOwnPropertySymbols$2(object); if (enumerableOnly) symbols = filter$2(symbols).call(symbols, function (sym) { return getOwnPropertyDescriptor$3(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

	function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context4; forEach$2(_context4 = ownKeys$4(source, true)).call(_context4, function (key) { defineProperty$c(target, key, source[key]); }); } else if (getOwnPropertyDescriptors$5) { defineProperties$1(target, getOwnPropertyDescriptors$5(source)); } else { var _context5; forEach$2(_context5 = ownKeys$4(source)).call(_context5, function (key) { defineProperty$3(target, key, getOwnPropertyDescriptor$3(source, key)); }); } } return target; }
	/**
	 * A node. A node can be connected to other nodes via one or multiple edges.
	 */

	var Node =
	/*#__PURE__*/
	function () {
	  /**
	   *
	   * @param {object} options An object containing options for the node. All
	   *                            options are optional, except for the id.
	   *                              {number} id     Id of the node. Required
	   *                              {string} label  Text label for the node
	   *                              {number} x      Horizontal position of the node
	   *                              {number} y      Vertical position of the node
	   *                              {string} shape  Node shape
	   *                              {string} image  An image url
	   *                              {string} title  A title text, can be HTML
	   *                              {anytype} group A group name or number
	   *
	   * @param {Object} body               Shared state of current network instance
	   * @param {Network.Images} imagelist  A list with images. Only needed when the node has an image
	   * @param {Groups} grouplist          A list with groups. Needed for retrieving group options
	   * @param {Object} globalOptions      Current global node options; these serve as defaults for the node instance
	   * @param {Object} defaultOptions     Global default options for nodes; note that this is also the prototype
	   *                                    for parameter `globalOptions`.
	   */
	  function Node(options, body, imagelist, grouplist, globalOptions, defaultOptions) {
	    classCallCheck(this, Node);

	    this.options = bridgeObject(globalOptions);
	    this.globalOptions = globalOptions;
	    this.defaultOptions = defaultOptions;
	    this.body = body;
	    this.edges = []; // all edges connected to this node
	    // set defaults for the options

	    this.id = undefined;
	    this.imagelist = imagelist;
	    this.grouplist = grouplist; // state options

	    this.x = undefined;
	    this.y = undefined;
	    this.baseSize = this.options.size;
	    this.baseFontSize = this.options.font.size;
	    this.predefinedPosition = false; // used to check if initial fit should just take the range or approximate

	    this.selected = false;
	    this.hover = false;
	    this.labelModule = new Label(this.body, this.options, false
	    /* Not edge label */
	    );
	    this.setOptions(options);
	  }
	  /**
	   * Attach a edge to the node
	   * @param {Edge} edge
	   */


	  createClass(Node, [{
	    key: "attachEdge",
	    value: function attachEdge(edge) {
	      var _context;

	      if (indexOf$3(_context = this.edges).call(_context, edge) === -1) {
	        this.edges.push(edge);
	      }
	    }
	    /**
	     * Detach a edge from the node
	     *
	     * @param {Edge} edge
	     */

	  }, {
	    key: "detachEdge",
	    value: function detachEdge(edge) {
	      var _context2;

	      var index = indexOf$3(_context2 = this.edges).call(_context2, edge);

	      if (index != -1) {
	        var _context3;

	        splice$2(_context3 = this.edges).call(_context3, index, 1);
	      }
	    }
	    /**
	     * Set or overwrite options for the node
	     *
	     * @param {Object} options an object with options
	     * @returns {null|boolean}
	     */

	  }, {
	    key: "setOptions",
	    value: function setOptions(options) {
	      var currentShape = this.options.shape;

	      if (!options) {
	        return; // Note that the return value will be 'undefined'! This is OK.
	      } // Save the color for later.
	      // This is necessary in order to prevent local color from being overwritten by group color.
	      // TODO: To prevent such workarounds the way options are handled should be rewritten from scratch.
	      // This is not the only problem with current options handling.


	      if (typeof options.color !== 'undefined') {
	        this._localColor = options.color;
	      } // basic options


	      if (options.id !== undefined) {
	        this.id = options.id;
	      }

	      if (this.id === undefined) {
	        throw new Error("Node must have an id");
	      }

	      Node.checkMass(options, this.id); // set these options locally
	      // clear x and y positions

	      if (options.x !== undefined) {
	        if (options.x === null) {
	          this.x = undefined;
	          this.predefinedPosition = false;
	        } else {
	          this.x = _parseInt$3(options.x);
	          this.predefinedPosition = true;
	        }
	      }

	      if (options.y !== undefined) {
	        if (options.y === null) {
	          this.y = undefined;
	          this.predefinedPosition = false;
	        } else {
	          this.y = _parseInt$3(options.y);
	          this.predefinedPosition = true;
	        }
	      }

	      if (options.size !== undefined) {
	        this.baseSize = options.size;
	      }

	      if (options.value !== undefined) {
	        options.value = _parseFloat$3(options.value);
	      } // this transforms all shorthands into fully defined options


	      Node.parseOptions(this.options, options, true, this.globalOptions, this.grouplist);
	      var pile = [options, this.options, this.defaultOptions];
	      this.chooser = ComponentUtil.choosify('node', pile);

	      this._load_images();

	      this.updateLabelModule(options);
	      this.updateShape(currentShape);
	      return options.hidden !== undefined || options.physics !== undefined;
	    }
	    /**
	     * Load the images from the options, for the nodes that need them.
	     *
	     * Images are always loaded, even if they are not used in the current shape.
	     * The user may switch to an image shape later on.
	     *
	     * @private
	     */

	  }, {
	    key: "_load_images",
	    value: function _load_images() {
	      if (this.options.shape === 'circularImage' || this.options.shape === 'image') {
	        if (this.options.image === undefined) {
	          throw new Error("Option image must be defined for node type '" + this.options.shape + "'");
	        }
	      }

	      if (this.options.image === undefined) {
	        return;
	      }

	      if (this.imagelist === undefined) {
	        throw new Error("Internal Error: No images provided");
	      }

	      if (typeof this.options.image === 'string') {
	        this.imageObj = this.imagelist.load(this.options.image, this.options.brokenImage, this.id);
	      } else {
	        if (this.options.image.unselected === undefined) {
	          throw new Error("No unselected image provided");
	        }

	        this.imageObj = this.imagelist.load(this.options.image.unselected, this.options.brokenImage, this.id);

	        if (this.options.image.selected !== undefined) {
	          this.imageObjAlt = this.imagelist.load(this.options.image.selected, this.options.brokenImage, this.id);
	        } else {
	          this.imageObjAlt = undefined;
	        }
	      }
	    }
	    /**
	     * Copy group option values into the node options.
	     *
	     * The group options override the global node options, so the copy of group options
	     *  must happen *after* the global node options have been set.
	     *
	     * This method must also be called also if the global node options have changed and the group options did not.
	     *
	     * @param {Object} parentOptions
	     * @param {Object} newOptions  new values for the options, currently only passed in for check
	     * @param {Object} groupList
	     */

	  }, {
	    key: "getFormattingValues",

	    /**
	     *
	     * @returns {{color: *, borderWidth: *, borderColor: *, size: *, borderDashes: (boolean|Array|allOptions.nodes.shapeProperties.borderDashes|{boolean, array}), borderRadius: (number|allOptions.nodes.shapeProperties.borderRadius|{number}|Array), shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *}}
	     */
	    value: function getFormattingValues() {
	      var values = {
	        color: this.options.color.background,
	        borderWidth: this.options.borderWidth,
	        borderColor: this.options.color.border,
	        size: this.options.size,
	        borderDashes: this.options.shapeProperties.borderDashes,
	        borderRadius: this.options.shapeProperties.borderRadius,
	        shadow: this.options.shadow.enabled,
	        shadowColor: this.options.shadow.color,
	        shadowSize: this.options.shadow.size,
	        shadowX: this.options.shadow.x,
	        shadowY: this.options.shadow.y
	      };

	      if (this.selected || this.hover) {
	        if (this.chooser === true) {
	          if (this.selected) {
	            values.borderWidth *= 2;
	            values.color = this.options.color.highlight.background;
	            values.borderColor = this.options.color.highlight.border;
	            values.shadow = this.options.shadow.enabled;
	          } else if (this.hover) {
	            values.color = this.options.color.hover.background;
	            values.borderColor = this.options.color.hover.border;
	            values.shadow = this.options.shadow.enabled;
	          }
	        } else if (typeof this.chooser === 'function') {
	          this.chooser(values, this.options.id, this.selected, this.hover);

	          if (values.shadow === false) {
	            if (values.shadowColor !== this.options.shadow.color || values.shadowSize !== this.options.shadow.size || values.shadowX !== this.options.shadow.x || values.shadowY !== this.options.shadow.y) {
	              values.shadow = true;
	            }
	          }
	        }
	      } else {
	        values.shadow = this.options.shadow.enabled;
	      }

	      return values;
	    }
	    /**
	     *
	     * @param {Object} options
	     */

	  }, {
	    key: "updateLabelModule",
	    value: function updateLabelModule(options) {
	      if (this.options.label === undefined || this.options.label === null) {
	        this.options.label = '';
	      }

	      Node.updateGroupOptions(this.options, _objectSpread$2({}, options, {
	        color: options && options.color || this._localColor || undefined
	      }), this.grouplist); //
	      // Note:The prototype chain for this.options is:
	      //
	      // this.options ->    NodesHandler.options    -> NodesHandler.defaultOptions
	      //                 (also: this.globalOptions)
	      //
	      // Note that the prototypes are mentioned explicitly in the pile list below;
	      // WE DON'T WANT THE ORDER OF THE PROTOTYPES!!!! At least, not for font handling of labels.
	      // This is a good indication that the prototype usage of options is deficient.
	      //

	      var currentGroup = this.grouplist.get(this.options.group, false);
	      var pile = [options, // new options
	      this.options, // current node options, see comment above for prototype
	      currentGroup, // group options, if any
	      this.globalOptions, // Currently set global node options
	      this.defaultOptions // Default global node options
	      ];
	      this.labelModule.update(this.options, pile);

	      if (this.labelModule.baseSize !== undefined) {
	        this.baseFontSize = this.labelModule.baseSize;
	      }
	    }
	    /**
	     *
	     * @param {string} currentShape
	     */

	  }, {
	    key: "updateShape",
	    value: function updateShape(currentShape) {
	      if (currentShape === this.options.shape && this.shape) {
	        this.shape.setOptions(this.options, this.imageObj, this.imageObjAlt);
	      } else {
	        // choose draw method depending on the shape
	        switch (this.options.shape) {
	          case 'box':
	            this.shape = new Box(this.options, this.body, this.labelModule);
	            break;

	          case 'circle':
	            this.shape = new Circle(this.options, this.body, this.labelModule);
	            break;

	          case 'circularImage':
	            this.shape = new CircularImage(this.options, this.body, this.labelModule, this.imageObj, this.imageObjAlt);
	            break;

	          case 'database':
	            this.shape = new Database(this.options, this.body, this.labelModule);
	            break;

	          case 'diamond':
	            this.shape = new Diamond(this.options, this.body, this.labelModule);
	            break;

	          case 'dot':
	            this.shape = new Dot(this.options, this.body, this.labelModule);
	            break;

	          case 'ellipse':
	            this.shape = new Ellipse(this.options, this.body, this.labelModule);
	            break;

	          case 'icon':
	            this.shape = new Icon(this.options, this.body, this.labelModule);
	            break;

	          case 'image':
	            this.shape = new Image$1(this.options, this.body, this.labelModule, this.imageObj, this.imageObjAlt);
	            break;

	          case 'square':
	            this.shape = new Square(this.options, this.body, this.labelModule);
	            break;

	          case 'hexagon':
	            this.shape = new Hexagon(this.options, this.body, this.labelModule);
	            break;

	          case 'star':
	            this.shape = new Star(this.options, this.body, this.labelModule);
	            break;

	          case 'text':
	            this.shape = new Text(this.options, this.body, this.labelModule);
	            break;

	          case 'triangle':
	            this.shape = new Triangle(this.options, this.body, this.labelModule);
	            break;

	          case 'triangleDown':
	            this.shape = new TriangleDown(this.options, this.body, this.labelModule);
	            break;

	          default:
	            this.shape = new Ellipse(this.options, this.body, this.labelModule);
	            break;
	        }
	      }

	      this.needsRefresh();
	    }
	    /**
	     * select this node
	     */

	  }, {
	    key: "select",
	    value: function select() {
	      this.selected = true;
	      this.needsRefresh();
	    }
	    /**
	     * unselect this node
	     */

	  }, {
	    key: "unselect",
	    value: function unselect() {
	      this.selected = false;
	      this.needsRefresh();
	    }
	    /**
	     * Reset the calculated size of the node, forces it to recalculate its size
	     */

	  }, {
	    key: "needsRefresh",
	    value: function needsRefresh() {
	      this.shape.refreshNeeded = true;
	    }
	    /**
	     * get the title of this node.
	     * @return {string} title    The title of the node, or undefined when no title
	     *                           has been set.
	     */

	  }, {
	    key: "getTitle",
	    value: function getTitle() {
	      return this.options.title;
	    }
	    /**
	     * Calculate the distance to the border of the Node
	     * @param {CanvasRenderingContext2D}   ctx
	     * @param {number} angle        Angle in radians
	     * @returns {number} distance   Distance to the border in pixels
	     */

	  }, {
	    key: "distanceToBorder",
	    value: function distanceToBorder(ctx, angle) {
	      return this.shape.distanceToBorder(ctx, angle);
	    }
	    /**
	     * Check if this node has a fixed x and y position
	     * @return {boolean}      true if fixed, false if not
	     */

	  }, {
	    key: "isFixed",
	    value: function isFixed() {
	      return this.options.fixed.x && this.options.fixed.y;
	    }
	    /**
	     * check if this node is selecte
	     * @return {boolean} selected   True if node is selected, else false
	     */

	  }, {
	    key: "isSelected",
	    value: function isSelected() {
	      return this.selected;
	    }
	    /**
	     * Retrieve the value of the node. Can be undefined
	     * @return {number} value
	     */

	  }, {
	    key: "getValue",
	    value: function getValue() {
	      return this.options.value;
	    }
	    /**
	     * Get the current dimensions of the label
	     *
	     * @return {rect}
	     */

	  }, {
	    key: "getLabelSize",
	    value: function getLabelSize() {
	      return this.labelModule.size();
	    }
	    /**
	     * Adjust the value range of the node. The node will adjust it's size
	     * based on its value.
	     * @param {number} min
	     * @param {number} max
	     * @param {number} total
	     */

	  }, {
	    key: "setValueRange",
	    value: function setValueRange(min, max, total) {
	      if (this.options.value !== undefined) {
	        var scale = this.options.scaling.customScalingFunction(min, max, total, this.options.value);
	        var sizeDiff = this.options.scaling.max - this.options.scaling.min;

	        if (this.options.scaling.label.enabled === true) {
	          var fontDiff = this.options.scaling.label.max - this.options.scaling.label.min;
	          this.options.font.size = this.options.scaling.label.min + scale * fontDiff;
	        }

	        this.options.size = this.options.scaling.min + scale * sizeDiff;
	      } else {
	        this.options.size = this.baseSize;
	        this.options.font.size = this.baseFontSize;
	      }

	      this.updateLabelModule();
	    }
	    /**
	     * Draw this node in the given canvas
	     * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d");
	     * @param {CanvasRenderingContext2D}   ctx
	     */

	  }, {
	    key: "draw",
	    value: function draw(ctx) {
	      var values = this.getFormattingValues();
	      this.shape.draw(ctx, this.x, this.y, this.selected, this.hover, values);
	    }
	    /**
	     * Update the bounding box of the shape
	     * @param {CanvasRenderingContext2D}   ctx
	     */

	  }, {
	    key: "updateBoundingBox",
	    value: function updateBoundingBox(ctx) {
	      this.shape.updateBoundingBox(this.x, this.y, ctx);
	    }
	    /**
	     * Recalculate the size of this node in the given canvas
	     * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d");
	     * @param {CanvasRenderingContext2D}   ctx
	     */

	  }, {
	    key: "resize",
	    value: function resize(ctx) {
	      var values = this.getFormattingValues();
	      this.shape.resize(ctx, this.selected, this.hover, values);
	    }
	    /**
	     * Determine all visual elements of this node instance, in which the given
	     * point falls within the bounding shape.
	     *
	     * @param {point} point
	     * @returns {Array.<nodeClickItem|nodeLabelClickItem>} list with the items which are on the point
	     */

	  }, {
	    key: "getItemsOnPoint",
	    value: function getItemsOnPoint(point) {
	      var ret = [];

	      if (this.labelModule.visible()) {
	        if (ComponentUtil.pointInRect(this.labelModule.getSize(), point)) {
	          ret.push({
	            nodeId: this.id,
	            labelId: 0
	          });
	        }
	      }

	      if (ComponentUtil.pointInRect(this.shape.boundingBox, point)) {
	        ret.push({
	          nodeId: this.id
	        });
	      }

	      return ret;
	    }
	    /**
	     * Check if this object is overlapping with the provided object
	     * @param {Object} obj   an object with parameters left, top, right, bottom
	     * @return {boolean}     True if location is located on node
	     */

	  }, {
	    key: "isOverlappingWith",
	    value: function isOverlappingWith(obj) {
	      return this.shape.left < obj.right && this.shape.left + this.shape.width > obj.left && this.shape.top < obj.bottom && this.shape.top + this.shape.height > obj.top;
	    }
	    /**
	     * Check if this object is overlapping with the provided object
	     * @param {Object} obj   an object with parameters left, top, right, bottom
	     * @return {boolean}     True if location is located on node
	     */

	  }, {
	    key: "isBoundingBoxOverlappingWith",
	    value: function isBoundingBoxOverlappingWith(obj) {
	      return this.shape.boundingBox.left < obj.right && this.shape.boundingBox.right > obj.left && this.shape.boundingBox.top < obj.bottom && this.shape.boundingBox.bottom > obj.top;
	    }
	    /**
	    * Check valid values for mass
	    *
	    * The mass may not be negative or zero. If it is, reset to 1
	    *
	    * @param {object} options
	    * @param {Node.id} id
	     * @static
	    */

	  }], [{
	    key: "updateGroupOptions",
	    value: function updateGroupOptions(parentOptions, newOptions, groupList) {
	      if (groupList === undefined) return; // No groups, nothing to do

	      var group = parentOptions.group; // paranoia: the selected group is already merged into node options, check.

	      if (newOptions !== undefined && newOptions.group !== undefined && group !== newOptions.group) {
	        throw new Error("updateGroupOptions: group values in options don't match.");
	      }

	      var hasGroup = typeof group === 'number' || typeof group === 'string' && group != '';
	      if (!hasGroup) return; // current node has no group, no need to merge

	      var groupObj = groupList.get(group); // Skip merging of group font options into parent; these are required to be distinct for labels
	      // Also skip mergin of color IF it is already defined in the node itself. This is to avoid the color of the
	      // group overriding the color set at the node level
	      // TODO: It might not be a good idea either to merge the rest of the options, investigate this.

	      var skipProperties = ['font'];
	      if (newOptions !== undefined && newOptions.color !== undefined && newOptions.color != null) skipProperties.push('color');
	      selectiveNotDeepExtend(skipProperties, parentOptions, groupObj); // the color object needs to be completely defined.
	      // Since groups can partially overwrite the colors, we parse it again, just in case.

	      parentOptions.color = parseColor(parentOptions.color);
	    }
	    /**
	     * This process all possible shorthands in the new options and makes sure that the parentOptions are fully defined.
	     * Static so it can also be used by the handler.
	     *
	     * @param {Object} parentOptions
	     * @param {Object} newOptions
	     * @param {boolean} [allowDeletion=false]
	     * @param {Object} [globalOptions={}]
	     * @param {Object} [groupList]
	     * @static
	     */

	  }, {
	    key: "parseOptions",
	    value: function parseOptions(parentOptions, newOptions) {
	      var allowDeletion = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
	      var globalOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
	      var groupList = arguments.length > 4 ? arguments[4] : undefined;
	      var fields = ['color', 'fixed', 'shadow'];
	      selectiveNotDeepExtend(fields, parentOptions, newOptions, allowDeletion);
	      Node.checkMass(newOptions); // merge the shadow options into the parent.

	      mergeOptions(parentOptions, newOptions, 'shadow', globalOptions); // individual shape newOptions

	      if (newOptions.color !== undefined && newOptions.color !== null) {
	        var parsedColor = parseColor(newOptions.color);
	        fillIfDefined(parentOptions.color, parsedColor);
	      } else if (allowDeletion === true && newOptions.color === null) {
	        parentOptions.color = bridgeObject(globalOptions.color); // set the object back to the global options
	      } // handle the fixed options


	      if (newOptions.fixed !== undefined && newOptions.fixed !== null) {
	        if (typeof newOptions.fixed === 'boolean') {
	          parentOptions.fixed.x = newOptions.fixed;
	          parentOptions.fixed.y = newOptions.fixed;
	        } else {
	          if (newOptions.fixed.x !== undefined && typeof newOptions.fixed.x === 'boolean') {
	            parentOptions.fixed.x = newOptions.fixed.x;
	          }

	          if (newOptions.fixed.y !== undefined && typeof newOptions.fixed.y === 'boolean') {
	            parentOptions.fixed.y = newOptions.fixed.y;
	          }
	        }
	      }

	      if (allowDeletion === true && newOptions.font === null) {
	        parentOptions.font = bridgeObject(globalOptions.font); // set the object back to the global options
	      }

	      Node.updateGroupOptions(parentOptions, newOptions, groupList); // handle the scaling options, specifically the label part

	      if (newOptions.scaling !== undefined) {
	        mergeOptions(parentOptions.scaling, newOptions.scaling, 'label', globalOptions.scaling);
	      }
	    }
	  }, {
	    key: "checkMass",
	    value: function checkMass(options, id) {
	      if (options.mass !== undefined && options.mass <= 0) {
	        var strId = '';

	        if (id !== undefined) {
	          strId = ' in node id: ' + id;
	        }

	        console.log('%cNegative or zero mass disallowed' + strId + ', setting mass to 1.', printStyle);
	        options.mass = 1;
	      }
	    }
	  }]);

	  return Node;
	}();

	/**
	 * Handler for Nodes
	 */

	var NodesHandler =
	/*#__PURE__*/
	function () {
	  /**
	   * @param {Object} body
	   * @param {Images} images
	   * @param {Array.<Group>} groups
	   * @param {LayoutEngine} layoutEngine
	   */
	  function NodesHandler(body, images, groups, layoutEngine) {
	    var _context,
	        _this = this;

	    classCallCheck(this, NodesHandler);

	    this.body = body;
	    this.images = images;
	    this.groups = groups;
	    this.layoutEngine = layoutEngine; // create the node API in the body container

	    this.body.functions.createNode = bind$2(_context = this.create).call(_context, this);
	    this.nodesListeners = {
	      add: function add(event, params) {
	        _this.add(params.items);
	      },
	      update: function update(event, params) {
	        _this.update(params.items, params.data, params.oldData);
	      },
	      remove: function remove(event, params) {
	        _this.remove(params.items);
	      }
	    };
	    this.defaultOptions = {
	      borderWidth: 1,
	      borderWidthSelected: 2,
	      brokenImage: undefined,
	      color: {
	        border: '#2B7CE9',
	        background: '#97C2FC',
	        highlight: {
	          border: '#2B7CE9',
	          background: '#D2E5FF'
	        },
	        hover: {
	          border: '#2B7CE9',
	          background: '#D2E5FF'
	        }
	      },
	      fixed: {
	        x: false,
	        y: false
	      },
	      font: {
	        color: '#343434',
	        size: 14,
	        // px
	        face: 'arial',
	        background: 'none',
	        strokeWidth: 0,
	        // px
	        strokeColor: '#ffffff',
	        align: 'center',
	        vadjust: 0,
	        multi: false,
	        bold: {
	          mod: 'bold'
	        },
	        boldital: {
	          mod: 'bold italic'
	        },
	        ital: {
	          mod: 'italic'
	        },
	        mono: {
	          mod: '',
	          size: 15,
	          // px
	          face: 'monospace',
	          vadjust: 2
	        }
	      },
	      group: undefined,
	      hidden: false,
	      icon: {
	        face: 'FontAwesome',
	        //'FontAwesome',
	        code: undefined,
	        //'\uf007',
	        size: 50,
	        //50,
	        color: '#2B7CE9' //'#aa00ff'

	      },
	      image: undefined,
	      // --> URL
	      imagePadding: {
	        // only for image shape
	        top: 0,
	        right: 0,
	        bottom: 0,
	        left: 0
	      },
	      label: undefined,
	      labelHighlightBold: true,
	      level: undefined,
	      margin: {
	        top: 5,
	        right: 5,
	        bottom: 5,
	        left: 5
	      },
	      mass: 1,
	      physics: true,
	      scaling: {
	        min: 10,
	        max: 30,
	        label: {
	          enabled: false,
	          min: 14,
	          max: 30,
	          maxVisible: 30,
	          drawThreshold: 5
	        },
	        customScalingFunction: function customScalingFunction(min, max, total, value) {
	          if (max === min) {
	            return 0.5;
	          } else {
	            var scale = 1 / (max - min);
	            return Math.max(0, (value - min) * scale);
	          }
	        }
	      },
	      shadow: {
	        enabled: false,
	        color: 'rgba(0,0,0,0.5)',
	        size: 10,
	        x: 5,
	        y: 5
	      },
	      shape: 'ellipse',
	      shapeProperties: {
	        borderDashes: false,
	        // only for borders
	        borderRadius: 6,
	        // only for box shape
	        interpolation: true,
	        // only for image and circularImage shapes
	        useImageSize: false,
	        // only for image and circularImage shapes
	        useBorderWithImage: false // only for image shape

	      },
	      size: 25,
	      title: undefined,
	      value: undefined,
	      x: undefined,
	      y: undefined
	    }; // Protect from idiocy

	    if (this.defaultOptions.mass <= 0) {
	      throw 'Internal error: mass in defaultOptions of NodesHandler may not be zero or negative';
	    }

	    this.options = bridgeObject(this.defaultOptions);
	    this.bindEventListeners();
	  }
	  /**
	   * Binds event listeners
	   */


	  createClass(NodesHandler, [{
	    key: "bindEventListeners",
	    value: function bindEventListeners() {
	      var _context2,
	          _context3,
	          _this2 = this;

	      // refresh the nodes. Used when reverting from hierarchical layout
	      this.body.emitter.on('refreshNodes', bind$2(_context2 = this.refresh).call(_context2, this));
	      this.body.emitter.on('refresh', bind$2(_context3 = this.refresh).call(_context3, this));
	      this.body.emitter.on('destroy', function () {
	        forEach$3$1(_this2.nodesListeners, function (callback, event) {
	          if (_this2.body.data.nodes) _this2.body.data.nodes.off(event, callback);
	        });
	        delete _this2.body.functions.createNode;
	        delete _this2.nodesListeners.add;
	        delete _this2.nodesListeners.update;
	        delete _this2.nodesListeners.remove;
	        delete _this2.nodesListeners;
	      });
	    }
	    /**
	     *
	     * @param {Object} options
	     */

	  }, {
	    key: "setOptions",
	    value: function setOptions(options) {
	      if (options !== undefined) {
	        Node.parseOptions(this.options, options); // update the shape in all nodes

	        if (options.shape !== undefined) {
	          for (var nodeId in this.body.nodes) {
	            if (this.body.nodes.hasOwnProperty(nodeId)) {
	              this.body.nodes[nodeId].updateShape();
	            }
	          }
	        } // update the font in all nodes


	        if (options.font !== undefined) {
	          for (var _nodeId in this.body.nodes) {
	            if (this.body.nodes.hasOwnProperty(_nodeId)) {
	              this.body.nodes[_nodeId].updateLabelModule();

	              this.body.nodes[_nodeId].needsRefresh();
	            }
	          }
	        } // update the shape size in all nodes


	        if (options.size !== undefined) {
	          for (var _nodeId2 in this.body.nodes) {
	            if (this.body.nodes.hasOwnProperty(_nodeId2)) {
	              this.body.nodes[_nodeId2].needsRefresh();
	            }
	          }
	        } // update the state of the variables if needed


	        if (options.hidden !== undefined || options.physics !== undefined) {
	          this.body.emitter.emit('_dataChanged');
	        }
	      }
	    }
	    /**
	     * Set a data set with nodes for the network
	     * @param {Array | DataSet | DataView} nodes         The data containing the nodes.
	     * @param {boolean} [doNotEmit=false]
	     * @private
	     */

	  }, {
	    key: "setData",
	    value: function setData(nodes) {
	      var doNotEmit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
	      var oldNodesData = this.body.data.nodes;

	      if (nodes instanceof DataSet || nodes instanceof DataView) {
	        this.body.data.nodes = nodes;
	      } else if (isArray$3(nodes)) {
	        this.body.data.nodes = new DataSet();
	        this.body.data.nodes.add(nodes);
	      } else if (!nodes) {
	        this.body.data.nodes = new DataSet();
	      } else {
	        throw new TypeError('Array or DataSet expected');
	      }

	      if (oldNodesData) {
	        // unsubscribe from old dataset
	        forEach$3$1(this.nodesListeners, function (callback, event) {
	          oldNodesData.off(event, callback);
	        });
	      } // remove drawn nodes


	      this.body.nodes = {};

	      if (this.body.data.nodes) {
	        // subscribe to new dataset
	        var me = this;
	        forEach$3$1(this.nodesListeners, function (callback, event) {
	          me.body.data.nodes.on(event, callback);
	        }); // draw all new nodes

	        var ids = this.body.data.nodes.getIds();
	        this.add(ids, true);
	      }

	      if (doNotEmit === false) {
	        this.body.emitter.emit("_dataChanged");
	      }
	    }
	    /**
	     * Add nodes
	     * @param {number[] | string[]} ids
	     * @param {boolean} [doNotEmit=false]
	     * @private
	     */

	  }, {
	    key: "add",
	    value: function add(ids) {
	      var doNotEmit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
	      var id;
	      var newNodes = [];

	      for (var i = 0; i < ids.length; i++) {
	        id = ids[i];
	        var properties = this.body.data.nodes.get(id);
	        var node = this.create(properties);
	        newNodes.push(node);
	        this.body.nodes[id] = node; // note: this may replace an existing node
	      }

	      this.layoutEngine.positionInitially(newNodes);

	      if (doNotEmit === false) {
	        this.body.emitter.emit("_dataChanged");
	      }
	    }
	    /**
	     * Update existing nodes, or create them when not yet existing
	     * @param {number[] | string[]} ids id's of changed nodes
	     * @param {Array} changedData array with changed data
	     * @param {Array|undefined} oldData optional; array with previous data
	     * @private
	     */

	  }, {
	    key: "update",
	    value: function update(ids, changedData, oldData) {
	      var nodes = this.body.nodes;
	      var dataChanged = false;

	      for (var i = 0; i < ids.length; i++) {
	        var id = ids[i];
	        var node = nodes[id];
	        var data = changedData[i];

	        if (node !== undefined) {
	          // update node
	          if (node.setOptions(data)) {
	            dataChanged = true;
	          }
	        } else {
	          dataChanged = true; // create node

	          node = this.create(data);
	          nodes[id] = node;
	        }
	      }

	      if (!dataChanged && oldData !== undefined) {
	        // Check for any changes which should trigger a layout recalculation
	        // For now, this is just 'level' for hierarchical layout
	        // Assumption: old and new data arranged in same order; at time of writing, this holds.
	        dataChanged = some$2(changedData).call(changedData, function (newValue, index) {
	          var oldValue = oldData[index];
	          return oldValue && oldValue.level !== newValue.level;
	        });
	      }

	      if (dataChanged === true) {
	        this.body.emitter.emit("_dataChanged");
	      } else {
	        this.body.emitter.emit("_dataUpdated");
	      }
	    }
	    /**
	     * Remove existing nodes. If nodes do not exist, the method will just ignore it.
	     * @param {number[] | string[]} ids
	     * @private
	     */

	  }, {
	    key: "remove",
	    value: function remove(ids) {
	      var nodes = this.body.nodes;

	      for (var i = 0; i < ids.length; i++) {
	        var id = ids[i];
	        delete nodes[id];
	      }

	      this.body.emitter.emit("_dataChanged");
	    }
	    /**
	     * create a node
	     * @param {Object} properties
	     * @param {class} [constructorClass=Node.default]
	     * @returns {*}
	     */

	  }, {
	    key: "create",
	    value: function create(properties) {
	      var constructorClass = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Node;
	      return new constructorClass(properties, this.body, this.images, this.groups, this.options, this.defaultOptions);
	    }
	    /**
	     *
	     * @param {boolean} [clearPositions=false]
	     */

	  }, {
	    key: "refresh",
	    value: function refresh() {
	      var _this3 = this;

	      var clearPositions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
	      forEach$3$1(this.body.nodes, function (node, nodeId) {
	        var data = _this3.body.data.nodes.get(nodeId);

	        if (data !== undefined) {
	          if (clearPositions === true) {
	            node.setOptions({
	              x: null,
	              y: null
	            });
	          }

	          node.setOptions({
	            fixed: false
	          });
	          node.setOptions(data);
	        }
	      });
	    }
	    /**
	     * Returns the positions of the nodes.
	     * @param {Array.<Node.id>|String} [ids]  --> optional, can be array of nodeIds, can be string
	     * @returns {{}}
	     */

	  }, {
	    key: "getPositions",
	    value: function getPositions(ids) {
	      var dataArray = {};

	      if (ids !== undefined) {
	        if (isArray$3(ids) === true) {
	          for (var i = 0; i < ids.length; i++) {
	            if (this.body.nodes[ids[i]] !== undefined) {
	              var node = this.body.nodes[ids[i]];
	              dataArray[ids[i]] = {
	                x: Math.round(node.x),
	                y: Math.round(node.y)
	              };
	            }
	          }
	        } else {
	          if (this.body.nodes[ids] !== undefined) {
	            var _node = this.body.nodes[ids];
	            dataArray[ids] = {
	              x: Math.round(_node.x),
	              y: Math.round(_node.y)
	            };
	          }
	        }
	      } else {
	        for (var _i = 0; _i < this.body.nodeIndices.length; _i++) {
	          var _node2 = this.body.nodes[this.body.nodeIndices[_i]];
	          dataArray[this.body.nodeIndices[_i]] = {
	            x: Math.round(_node2.x),
	            y: Math.round(_node2.y)
	          };
	        }
	      }

	      return dataArray;
	    }
	    /**
	     * Load the XY positions of the nodes into the dataset.
	     */

	  }, {
	    key: "storePositions",
	    value: function storePositions() {
	      // todo: add support for clusters and hierarchical.
	      var dataArray = [];
	      var dataset = this.body.data.nodes.getDataSet();
	      var _iteratorNormalCompletion = true;
	      var _didIteratorError = false;
	      var _iteratorError = undefined;

	      try {
	        for (var _iterator = getIterator$5(dataset.get()), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
	          var dsNode = _step.value;
	          var id = dsNode.id;
	          var bodyNode = this.body.nodes[id];
	          var x = Math.round(bodyNode.x);
	          var y = Math.round(bodyNode.y);

	          if (dsNode.x !== x || dsNode.y !== y) {
	            dataArray.push({
	              id: id,
	              x: x,
	              y: y
	            });
	          }
	        }
	      } catch (err) {
	        _didIteratorError = true;
	        _iteratorError = err;
	      } finally {
	        try {
	          if (!_iteratorNormalCompletion && _iterator.return != null) {
	            _iterator.return();
	          }
	        } finally {
	          if (_didIteratorError) {
	            throw _iteratorError;
	          }
	        }
	      }

	      dataset.update(dataArray);
	    }
	    /**
	     * get the bounding box of a node.
	     * @param {Node.id} nodeId
	     * @returns {j|*}
	     */

	  }, {
	    key: "getBoundingBox",
	    value: function getBoundingBox(nodeId) {
	      if (this.body.nodes[nodeId] !== undefined) {
	        return this.body.nodes[nodeId].shape.boundingBox;
	      }
	    }
	    /**
	     * Get the Ids of nodes connected to this node.
	     * @param {Node.id} nodeId
	     * @param {'to'|'from'|undefined} direction values 'from' and 'to' select respectively parent and child nodes only.
	     *                                          Any other value returns both parent and child nodes.
	     * @returns {Array}
	     */

	  }, {
	    key: "getConnectedNodes",
	    value: function getConnectedNodes(nodeId, direction) {
	      var nodeList = [];

	      if (this.body.nodes[nodeId] !== undefined) {
	        var node = this.body.nodes[nodeId];
	        var nodeObj = {}; // used to quickly check if node already exists

	        for (var i = 0; i < node.edges.length; i++) {
	          var edge = node.edges[i];

	          if (direction !== 'to' && edge.toId == node.id) {
	            // these are double equals since ids can be numeric or string
	            if (nodeObj[edge.fromId] === undefined) {
	              nodeList.push(edge.fromId);
	              nodeObj[edge.fromId] = true;
	            }
	          } else if (direction !== 'from' && edge.fromId == node.id) {
	            // these are double equals since ids can be numeric or string
	            if (nodeObj[edge.toId] === undefined) {
	              nodeList.push(edge.toId);
	              nodeObj[edge.toId] = true;
	            }
	          }
	        }
	      }

	      return nodeList;
	    }
	    /**
	     * Get the ids of the edges connected to this node.
	     * @param {Node.id} nodeId
	     * @returns {*}
	     */

	  }, {
	    key: "getConnectedEdges",
	    value: function getConnectedEdges(nodeId) {
	      var edgeList = [];

	      if (this.body.nodes[nodeId] !== undefined) {
	        var node = this.body.nodes[nodeId];

	        for (var i = 0; i < node.edges.length; i++) {
	          edgeList.push(node.edges[i].id);
	        }
	      } else {
	        console.log("NodeId provided for getConnectedEdges does not exist. Provided: ", nodeId);
	      }

	      return edgeList;
	    }
	    /**
	     * Move a node.
	     *
	     * @param {Node.id} nodeId
	     * @param {number} x
	     * @param {number} y
	     */

	  }, {
	    key: "moveNode",
	    value: function moveNode(nodeId, x, y) {
	      var _this4 = this;

	      if (this.body.nodes[nodeId] !== undefined) {
	        this.body.nodes[nodeId].x = Number(x);
	        this.body.nodes[nodeId].y = Number(y);

	        setTimeout$2(function () {
	          _this4.body.emitter.emit("startSimulation");
	        }, 0);
	      } else {
	        console.log("Node id supplied to moveNode does not exist. Provided: ", nodeId);
	      }
	    }
	  }]);

	  return NodesHandler;
	}();

	var getOwnPropertyDescriptor$7 = getOwnPropertyDescriptor_1;

	var getOwnPropertyDescriptor$8 = getOwnPropertyDescriptor$7;

	// `Reflect.get` method
	// https://tc39.github.io/ecma262/#sec-reflect.get
	function get$3(target, propertyKey /* , receiver */) {
	  var receiver = arguments.length < 3 ? target : arguments[2];
	  var descriptor, prototype;
	  if (anObject(target) === receiver) return target[propertyKey];
	  if (descriptor = objectGetOwnPropertyDescriptor.f(target, propertyKey)) return has(descriptor, 'value')
	    ? descriptor.value
	    : descriptor.get === undefined
	      ? undefined
	      : descriptor.get.call(receiver);
	  if (isObject(prototype = objectGetPrototypeOf(target))) return get$3(prototype, propertyKey, receiver);
	}

	_export({ target: 'Reflect', stat: true }, {
	  get: get$3
	});

	var get$4 = path.Reflect.get;

	var get$5 = get$4;

	var get$6 = get$5;

	function _superPropBase(object, property) {
	  while (!Object.prototype.hasOwnProperty.call(object, property)) {
	    object = getPrototypeOf$7(object);
	    if (object === null) break;
	  }

	  return object;
	}

	var superPropBase = _superPropBase;

	var get$7 = createCommonjsModule(function (module) {
	function _get(target, property, receiver) {
	  if (typeof Reflect !== "undefined" && get$6) {
	    module.exports = _get = get$6;
	  } else {
	    module.exports = _get = function _get(target, property, receiver) {
	      var base = superPropBase(target, property);
	      if (!base) return;

	      var desc = getOwnPropertyDescriptor$8(base, property);

	      if (desc.get) {
	        return desc.get.call(receiver);
	      }

	      return desc.value;
	    };
	  }

	  return _get(target, property, receiver || target);
	}

	module.exports = _get;
	});

	var $hypot = Math.hypot;
	var abs$1 = Math.abs;
	var sqrt = Math.sqrt;

	// Chrome 77 bug
	// https://bugs.chromium.org/p/v8/issues/detail?id=9546
	var BUGGY = !!$hypot && $hypot(Infinity, NaN) !== Infinity;

	// `Math.hypot` method
	// https://tc39.github.io/ecma262/#sec-math.hypot
	_export({ target: 'Math', stat: true, forced: BUGGY }, {
	  hypot: function hypot(value1, value2) { // eslint-disable-line no-unused-vars
	    var sum = 0;
	    var i = 0;
	    var aLen = arguments.length;
	    var larg = 0;
	    var arg, div;
	    while (i < aLen) {
	      arg = abs$1(arguments[i++]);
	      if (larg < arg) {
	        div = larg / arg;
	        sum = sum * div * div + 1;
	        larg = arg;
	      } else if (arg > 0) {
	        div = arg / larg;
	        sum += div * div;
	      } else sum += arg;
	    }
	    return larg === Infinity ? Infinity : larg * sqrt(sum);
	  }
	});

	var hypot = path.Math.hypot;

	var hypot$1 = hypot;

	var hypot$2 = hypot$1;

	/**
	 * Common methods for endpoints
	 *
	 * @class
	 */

	var EndPoint =
	/*#__PURE__*/
	function () {
	  function EndPoint() {
	    classCallCheck(this, EndPoint);
	  }

	  createClass(EndPoint, null, [{
	    key: "transform",

	    /**
	     * Apply transformation on points for display.
	     *
	     * The following is done:
	     * - rotate by the specified angle
	     * - multiply the (normalized) coordinates by the passed length
	     * - offset by the target coordinates
	     *
	     * @param points - The point(s) to be transformed.
	     * @param arrowData - The data determining the result of the transformation.
	     */
	    value: function transform(points, arrowData) {
	      if (!isArray$3(points)) {
	        points = [points];
	      }

	      var x = arrowData.point.x;
	      var y = arrowData.point.y;
	      var angle = arrowData.angle;
	      var length = arrowData.length;

	      for (var i = 0; i < points.length; ++i) {
	        var p = points[i];
	        var xt = p.x * Math.cos(angle) - p.y * Math.sin(angle);
	        var yt = p.x * Math.sin(angle) + p.y * Math.cos(angle);
	        p.x = x + length * xt;
	        p.y = y + length * yt;
	      }
	    }
	    /**
	     * Draw a closed path using the given real coordinates.
	     *
	     * @param ctx - The path will be rendered into this context.
	     * @param points - The points of the path.
	     */

	  }, {
	    key: "drawPath",
	    value: function drawPath(ctx, points) {
	      ctx.beginPath();
	      ctx.moveTo(points[0].x, points[0].y);

	      for (var i = 1; i < points.length; ++i) {
	        ctx.lineTo(points[i].x, points[i].y);
	      }

	      ctx.closePath();
	    }
	  }]);

	  return EndPoint;
	}();
	/**
	 * Drawing methods for the arrow endpoint.
	 */


	var Image$2 =
	/*#__PURE__*/
	function (_EndPoint) {
	  inherits$1(Image, _EndPoint);

	  function Image() {
	    classCallCheck(this, Image);

	    return possibleConstructorReturn$1(this, getPrototypeOf$7(Image).apply(this, arguments));
	  }

	  createClass(Image, null, [{
	    key: "draw",

	    /**
	     * Draw this shape at the end of a line.
	     *
	     * @param ctx - The shape will be rendered into this context.
	     * @param arrowData - The data determining the shape.
	     *
	     * @returns False as there is no way to fill an image.
	     */
	    value: function draw(ctx, arrowData) {
	      if (arrowData.image) {
	        ctx.save();
	        ctx.translate(arrowData.point.x, arrowData.point.y);
	        ctx.rotate(Math.PI / 2 + arrowData.angle);
	        var width = arrowData.imageWidth != null ? arrowData.imageWidth : arrowData.image.width;
	        var height = arrowData.imageHeight != null ? arrowData.imageHeight : arrowData.image.height;
	        arrowData.image.drawImageAtPosition(ctx, 1, // scale
	        -width / 2, // x
	        0, // y
	        width, height);
	        ctx.restore();
	      }

	      return false;
	    }
	  }]);

	  return Image;
	}(EndPoint);
	/**
	 * Drawing methods for the arrow endpoint.
	 */


	var Arrow =
	/*#__PURE__*/
	function (_EndPoint2) {
	  inherits$1(Arrow, _EndPoint2);

	  function Arrow() {
	    classCallCheck(this, Arrow);

	    return possibleConstructorReturn$1(this, getPrototypeOf$7(Arrow).apply(this, arguments));
	  }

	  createClass(Arrow, null, [{
	    key: "draw",

	    /**
	     * Draw this shape at the end of a line.
	     *
	     * @param ctx - The shape will be rendered into this context.
	     * @param arrowData - The data determining the shape.
	     *
	     * @returns True because ctx.fill() can be used to fill the arrow.
	     */
	    value: function draw(ctx, arrowData) {
	      // Normalized points of closed path, in the order that they should be drawn.
	      // (0, 0) is the attachment point, and the point around which should be rotated
	      var points = [{
	        x: 0,
	        y: 0
	      }, {
	        x: -1,
	        y: 0.3
	      }, {
	        x: -0.9,
	        y: 0
	      }, {
	        x: -1,
	        y: -0.3
	      }];
	      EndPoint.transform(points, arrowData);
	      EndPoint.drawPath(ctx, points);
	      return true;
	    }
	  }]);

	  return Arrow;
	}(EndPoint);
	/**
	 * Drawing methods for the crow endpoint.
	 */


	var Crow =
	/*#__PURE__*/
	function () {
	  function Crow() {
	    classCallCheck(this, Crow);
	  }

	  createClass(Crow, null, [{
	    key: "draw",

	    /**
	     * Draw this shape at the end of a line.
	     *
	     * @param ctx - The shape will be rendered into this context.
	     * @param arrowData - The data determining the shape.
	     *
	     * @returns True because ctx.fill() can be used to fill the arrow.
	     */
	    value: function draw(ctx, arrowData) {
	      // Normalized points of closed path, in the order that they should be drawn.
	      // (0, 0) is the attachment point, and the point around which should be rotated
	      var points = [{
	        x: -1,
	        y: 0
	      }, {
	        x: 0,
	        y: 0.3
	      }, {
	        x: -0.4,
	        y: 0
	      }, {
	        x: 0,
	        y: -0.3
	      }];
	      EndPoint.transform(points, arrowData);
	      EndPoint.drawPath(ctx, points);
	      return true;
	    }
	  }]);

	  return Crow;
	}();
	/**
	 * Drawing methods for the curve endpoint.
	 */


	var Curve =
	/*#__PURE__*/
	function () {
	  function Curve() {
	    classCallCheck(this, Curve);
	  }

	  createClass(Curve, null, [{
	    key: "draw",

	    /**
	     * Draw this shape at the end of a line.
	     *
	     * @param ctx - The shape will be rendered into this context.
	     * @param arrowData - The data determining the shape.
	     *
	     * @returns True because ctx.fill() can be used to fill the arrow.
	     */
	    value: function draw(ctx, arrowData) {
	      // Normalized points of closed path, in the order that they should be drawn.
	      // (0, 0) is the attachment point, and the point around which should be rotated
	      var point = {
	        x: -0.4,
	        y: 0
	      };
	      EndPoint.transform(point, arrowData); // Update endpoint style for drawing transparent arc.

	      ctx.strokeStyle = ctx.fillStyle;
	      ctx.fillStyle = "rgba(0, 0, 0, 0)"; // Define curve endpoint as semicircle.

	      var pi = Math.PI;
	      var startAngle = arrowData.angle - pi / 2;
	      var endAngle = arrowData.angle + pi / 2;
	      ctx.beginPath();
	      ctx.arc(point.x, point.y, arrowData.length * 0.4, startAngle, endAngle, false);
	      ctx.stroke();
	      return true;
	    }
	  }]);

	  return Curve;
	}();
	/**
	 * Drawing methods for the inverted curve endpoint.
	 */


	var InvertedCurve =
	/*#__PURE__*/
	function () {
	  function InvertedCurve() {
	    classCallCheck(this, InvertedCurve);
	  }

	  createClass(InvertedCurve, null, [{
	    key: "draw",

	    /**
	     * Draw this shape at the end of a line.
	     *
	     * @param ctx - The shape will be rendered into this context.
	     * @param arrowData - The data determining the shape.
	     *
	     * @returns True because ctx.fill() can be used to fill the arrow.
	     */
	    value: function draw(ctx, arrowData) {
	      // Normalized points of closed path, in the order that they should be drawn.
	      // (0, 0) is the attachment point, and the point around which should be rotated
	      var point = {
	        x: -0.3,
	        y: 0
	      };
	      EndPoint.transform(point, arrowData); // Update endpoint style for drawing transparent arc.

	      ctx.strokeStyle = ctx.fillStyle;
	      ctx.fillStyle = "rgba(0, 0, 0, 0)"; // Define inverted curve endpoint as semicircle.

	      var pi = Math.PI;
	      var startAngle = arrowData.angle + pi / 2;
	      var endAngle = arrowData.angle + 3 * pi / 2;
	      ctx.beginPath();
	      ctx.arc(point.x, point.y, arrowData.length * 0.4, startAngle, endAngle, false);
	      ctx.stroke();
	      return true;
	    }
	  }]);

	  return InvertedCurve;
	}();
	/**
	 * Drawing methods for the trinagle endpoint.
	 */


	var Triangle$1 =
	/*#__PURE__*/
	function () {
	  function Triangle() {
	    classCallCheck(this, Triangle);
	  }

	  createClass(Triangle, null, [{
	    key: "draw",

	    /**
	     * Draw this shape at the end of a line.
	     *
	     * @param ctx - The shape will be rendered into this context.
	     * @param arrowData - The data determining the shape.
	     *
	     * @returns True because ctx.fill() can be used to fill the arrow.
	     */
	    value: function draw(ctx, arrowData) {
	      // Normalized points of closed path, in the order that they should be drawn.
	      // (0, 0) is the attachment point, and the point around which should be rotated
	      var points = [{
	        x: 0.02,
	        y: 0
	      }, {
	        x: -1,
	        y: 0.3
	      }, {
	        x: -1,
	        y: -0.3
	      }];
	      EndPoint.transform(points, arrowData);
	      EndPoint.drawPath(ctx, points);
	      return true;
	    }
	  }]);

	  return Triangle;
	}();
	/**
	 * Drawing methods for the inverted trinagle endpoint.
	 */


	var InvertedTriangle =
	/*#__PURE__*/
	function () {
	  function InvertedTriangle() {
	    classCallCheck(this, InvertedTriangle);
	  }

	  createClass(InvertedTriangle, null, [{
	    key: "draw",

	    /**
	     * Draw this shape at the end of a line.
	     *
	     * @param ctx - The shape will be rendered into this context.
	     * @param arrowData - The data determining the shape.
	     *
	     * @returns True because ctx.fill() can be used to fill the arrow.
	     */
	    value: function draw(ctx, arrowData) {
	      // Normalized points of closed path, in the order that they should be drawn.
	      // (0, 0) is the attachment point, and the point around which should be rotated
	      var points = [{
	        x: 0,
	        y: 0.3
	      }, {
	        x: 0,
	        y: -0.3
	      }, {
	        x: -1,
	        y: 0
	      }];
	      EndPoint.transform(points, arrowData);
	      EndPoint.drawPath(ctx, points);
	      return true;
	    }
	  }]);

	  return InvertedTriangle;
	}();
	/**
	 * Drawing methods for the circle endpoint.
	 */


	var Circle$1 =
	/*#__PURE__*/
	function () {
	  function Circle() {
	    classCallCheck(this, Circle);
	  }

	  createClass(Circle, null, [{
	    key: "draw",

	    /**
	     * Draw this shape at the end of a line.
	     *
	     * @param ctx - The shape will be rendered into this context.
	     * @param arrowData - The data determining the shape.
	     *
	     * @returns True because ctx.fill() can be used to fill the arrow.
	     */
	    value: function draw(ctx, arrowData) {
	      var point = {
	        x: -0.4,
	        y: 0
	      };
	      EndPoint.transform(point, arrowData);
	      drawCircle(ctx, point.x, point.y, arrowData.length * 0.4);
	      return true;
	    }
	  }]);

	  return Circle;
	}();
	/**
	 * Drawing methods for the bar endpoint.
	 */


	var Bar =
	/*#__PURE__*/
	function () {
	  function Bar() {
	    classCallCheck(this, Bar);
	  }

	  createClass(Bar, null, [{
	    key: "draw",

	    /**
	     * Draw this shape at the end of a line.
	     *
	     * @param ctx - The shape will be rendered into this context.
	     * @param arrowData - The data determining the shape.
	     *
	     * @returns True because ctx.fill() can be used to fill the arrow.
	     */
	    value: function draw(ctx, arrowData) {
	      /*
	      var points = [
	        {x:0, y:0.5},
	        {x:0, y:-0.5}
	      ];
	           EndPoint.transform(points, arrowData);
	      ctx.beginPath();
	      ctx.moveTo(points[0].x, points[0].y);
	      ctx.lineTo(points[1].x, points[1].y);
	      ctx.stroke();
	      */
	      var points = [{
	        x: 0,
	        y: 0.5
	      }, {
	        x: 0,
	        y: -0.5
	      }, {
	        x: -0.15,
	        y: -0.5
	      }, {
	        x: -0.15,
	        y: 0.5
	      }];
	      EndPoint.transform(points, arrowData);
	      EndPoint.drawPath(ctx, points);
	      return true;
	    }
	  }]);

	  return Bar;
	}();
	/**
	 * Drawing methods for the box endpoint.
	 */


	var Box$1 =
	/*#__PURE__*/
	function () {
	  function Box() {
	    classCallCheck(this, Box);
	  }

	  createClass(Box, null, [{
	    key: "draw",

	    /**
	     * Draw this shape at the end of a line.
	     *
	     * @param ctx - The shape will be rendered into this context.
	     * @param arrowData - The data determining the shape.
	     *
	     * @returns True because ctx.fill() can be used to fill the arrow.
	     */
	    value: function draw(ctx, arrowData) {
	      var points = [{
	        x: 0,
	        y: 0.3
	      }, {
	        x: 0,
	        y: -0.3
	      }, {
	        x: -0.6,
	        y: -0.3
	      }, {
	        x: -0.6,
	        y: 0.3
	      }];
	      EndPoint.transform(points, arrowData);
	      EndPoint.drawPath(ctx, points);
	      return true;
	    }
	  }]);

	  return Box;
	}();
	/**
	 * Drawing methods for the diamond endpoint.
	 */


	var Diamond$1 =
	/*#__PURE__*/
	function () {
	  function Diamond() {
	    classCallCheck(this, Diamond);
	  }

	  createClass(Diamond, null, [{
	    key: "draw",

	    /**
	     * Draw this shape at the end of a line.
	     *
	     * @param ctx - The shape will be rendered into this context.
	     * @param arrowData - The data determining the shape.
	     *
	     * @returns True because ctx.fill() can be used to fill the arrow.
	     */
	    value: function draw(ctx, arrowData) {
	      var points = [{
	        x: 0,
	        y: 0
	      }, {
	        x: -0.5,
	        y: -0.3
	      }, {
	        x: -1,
	        y: 0
	      }, {
	        x: -0.5,
	        y: 0.3
	      }];
	      EndPoint.transform(points, arrowData);
	      EndPoint.drawPath(ctx, points);
	      return true;
	    }
	  }]);

	  return Diamond;
	}();
	/**
	 * Drawing methods for the vee endpoint.
	 */


	var Vee =
	/*#__PURE__*/
	function () {
	  function Vee() {
	    classCallCheck(this, Vee);
	  }

	  createClass(Vee, null, [{
	    key: "draw",

	    /**
	     * Draw this shape at the end of a line.
	     *
	     * @param ctx - The shape will be rendered into this context.
	     * @param arrowData - The data determining the shape.
	     *
	     * @returns True because ctx.fill() can be used to fill the arrow.
	     */
	    value: function draw(ctx, arrowData) {
	      // Normalized points of closed path, in the order that they should be drawn.
	      // (0, 0) is the attachment point, and the point around which should be rotated
	      var points = [{
	        x: -1,
	        y: 0.3
	      }, {
	        x: -0.5,
	        y: 0
	      }, {
	        x: -1,
	        y: -0.3
	      }, {
	        x: 0,
	        y: 0
	      }];
	      EndPoint.transform(points, arrowData);
	      EndPoint.drawPath(ctx, points);
	      return true;
	    }
	  }]);

	  return Vee;
	}();
	/**
	 * Drawing methods for the endpoints.
	 */


	var EndPoints =
	/*#__PURE__*/
	function () {
	  function EndPoints() {
	    classCallCheck(this, EndPoints);
	  }

	  createClass(EndPoints, null, [{
	    key: "draw",

	    /**
	     * Draw an endpoint.
	     *
	     * @param ctx - The shape will be rendered into this context.
	     * @param arrowData - The data determining the shape.
	     *
	     * @returns True if ctx.fill() can be used to fill the arrow, false otherwise.
	     */
	    value: function draw(ctx, arrowData) {
	      var type;

	      if (arrowData.type) {
	        type = arrowData.type.toLowerCase();
	      }

	      switch (type) {
	        case "image":
	          return Image$2.draw(ctx, arrowData);

	        case "circle":
	          return Circle$1.draw(ctx, arrowData);

	        case "box":
	          return Box$1.draw(ctx, arrowData);

	        case "crow":
	          return Crow.draw(ctx, arrowData);

	        case "curve":
	          return Curve.draw(ctx, arrowData);

	        case "diamond":
	          return Diamond$1.draw(ctx, arrowData);

	        case "inv_curve":
	          return InvertedCurve.draw(ctx, arrowData);

	        case "triangle":
	          return Triangle$1.draw(ctx, arrowData);

	        case "inv_triangle":
	          return InvertedTriangle.draw(ctx, arrowData);

	        case "bar":
	          return Bar.draw(ctx, arrowData);

	        case "vee":
	          return Vee.draw(ctx, arrowData);

	        case "arrow": // fall-through

	        default:
	          return Arrow.draw(ctx, arrowData);
	      }
	    }
	  }]);

	  return EndPoints;
	}();

	function ownKeys$5(object, enumerableOnly) { var keys = keys$6(object); if (getOwnPropertySymbols$2) { var symbols = getOwnPropertySymbols$2(object); if (enumerableOnly) symbols = filter$2(symbols).call(symbols, function (sym) { return getOwnPropertyDescriptor$3(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

	function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context2; forEach$2(_context2 = ownKeys$5(source, true)).call(_context2, function (key) { defineProperty$c(target, key, source[key]); }); } else if (getOwnPropertyDescriptors$5) { defineProperties$1(target, getOwnPropertyDescriptors$5(source)); } else { var _context3; forEach$2(_context3 = ownKeys$5(source)).call(_context3, function (key) { defineProperty$3(target, key, getOwnPropertyDescriptor$3(source, key)); }); } } return target; }
	/**
	 * The Base Class for all edges.
	 */

	var EdgeBase =
	/*#__PURE__*/
	function () {
	  /**
	   * Create a new instance.
	   *
	   * @param options - The options object of given edge.
	   * @param _body - The body of the network.
	   * @param _labelModule - Label module.
	   */
	  function EdgeBase(options, _body, _labelModule) {
	    classCallCheck(this, EdgeBase);

	    this._body = _body;
	    this._labelModule = _labelModule;
	    this.color = {};
	    this.colorDirty = true;
	    this.hoverWidth = 1.5;
	    this.selectionWidth = 2;
	    this.setOptions(options);
	    this.fromPoint = this.from;
	    this.toPoint = this.to;
	  }
	  /** @inheritdoc */


	  createClass(EdgeBase, [{
	    key: "connect",
	    value: function connect() {
	      this.from = this._body.nodes[this.options.from];
	      this.to = this._body.nodes[this.options.to];
	    }
	    /** @inheritdoc */

	  }, {
	    key: "cleanup",
	    value: function cleanup() {
	      return false;
	    }
	    /**
	     * Set new edge options.
	     *
	     * @param options - The new edge options object.
	     */

	  }, {
	    key: "setOptions",
	    value: function setOptions(options) {
	      this.options = options;
	      this.from = this._body.nodes[this.options.from];
	      this.to = this._body.nodes[this.options.to];
	      this.id = this.options.id;
	    }
	    /** @inheritdoc */

	  }, {
	    key: "drawLine",
	    value: function drawLine(ctx, values, _selected, _hover) {
	      var viaNode = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : this.getViaNode();
	      // set style
	      ctx.strokeStyle = this.getColor(ctx, values);
	      ctx.lineWidth = values.width;

	      if (values.dashes !== false) {
	        this._drawDashedLine(ctx, values, viaNode);
	      } else {
	        this._drawLine(ctx, values, viaNode);
	      }
	    }
	    /**
	     * Draw a line with given style between two nodes through supplied node(s).
	     *
	     * @param ctx - The context that will be used for rendering.
	     * @param values - Formatting values like color, opacity or shadow.
	     * @param viaNode - Additional control point(s) for the edge.
	     * @param fromPoint - TODO: Seems ignored, remove?
	     * @param toPoint - TODO: Seems ignored, remove?
	     */

	  }, {
	    key: "_drawLine",
	    value: function _drawLine(ctx, values, viaNode, fromPoint, toPoint) {
	      if (this.from != this.to) {
	        // draw line
	        this._line(ctx, values, viaNode, fromPoint, toPoint);
	      } else {
	        var _this$_getCircleData = this._getCircleData(ctx),
	            _this$_getCircleData2 = slicedToArray$1(_this$_getCircleData, 3),
	            x = _this$_getCircleData2[0],
	            y = _this$_getCircleData2[1],
	            radius = _this$_getCircleData2[2];

	        this._circle(ctx, values, x, y, radius);
	      }
	    }
	    /**
	     * Draw a dashed line with given style between two nodes through supplied node(s).
	     *
	     * @param ctx - The context that will be used for rendering.
	     * @param values - Formatting values like color, opacity or shadow.
	     * @param viaNode - Additional control point(s) for the edge.
	     * @param _fromPoint - Ignored (TODO: remove in the future).
	     * @param _toPoint - Ignored (TODO: remove in the future).
	     */

	  }, {
	    key: "_drawDashedLine",
	    value: function _drawDashedLine(ctx, values, viaNode, _fromPoint, _toPoint) {
	      ctx.lineCap = "round";
	      var pattern = isArray$3(values.dashes) ? values.dashes : [5, 5]; // only firefox and chrome support this method, else we use the legacy one.

	      if (ctx.setLineDash !== undefined) {
	        ctx.save(); // set dash settings for chrome or firefox

	        ctx.setLineDash(pattern);
	        ctx.lineDashOffset = 0; // draw the line

	        if (this.from != this.to) {
	          // draw line
	          this._line(ctx, values, viaNode);
	        } else {
	          var _this$_getCircleData3 = this._getCircleData(ctx),
	              _this$_getCircleData4 = slicedToArray$1(_this$_getCircleData3, 3),
	              x = _this$_getCircleData4[0],
	              y = _this$_getCircleData4[1],
	              radius = _this$_getCircleData4[2];

	          this._circle(ctx, values, x, y, radius);
	        } // restore the dash settings.


	        ctx.setLineDash([0]);
	        ctx.lineDashOffset = 0;
	        ctx.restore();
	      } else {
	        // unsupporting smooth lines
	        if (this.from != this.to) {
	          // draw line
	          drawDashedLine(ctx, this.from.x, this.from.y, this.to.x, this.to.y, pattern);
	        } else {
	          var _this$_getCircleData5 = this._getCircleData(ctx),
	              _this$_getCircleData6 = slicedToArray$1(_this$_getCircleData5, 3),
	              _x = _this$_getCircleData6[0],
	              _y = _this$_getCircleData6[1],
	              _radius = _this$_getCircleData6[2];

	          this._circle(ctx, values, _x, _y, _radius);
	        } // draw shadow if enabled


	        this.enableShadow(ctx, values);
	        ctx.stroke(); // disable shadows for other elements.

	        this.disableShadow(ctx, values);
	      }
	    }
	    /**
	     * Find the intersection between the border of the node and the edge.
	     *
	     * @param node - The node (either from or to node of the edge).
	     * @param ctx - The context that will be used for rendering.
	     * @param options - Additional options.
	     *
	     * @returns Cartesian coordinates of the intersection between the border of the node and the edge.
	     */

	  }, {
	    key: "findBorderPosition",
	    value: function findBorderPosition(node, ctx, options) {
	      if (this.from != this.to) {
	        return this._findBorderPosition(node, ctx, options);
	      } else {
	        return this._findBorderPositionCircle(node, ctx, options);
	      }
	    }
	    /** @inheritdoc */

	  }, {
	    key: "findBorderPositions",
	    value: function findBorderPositions(ctx) {
	      if (this.from != this.to) {
	        return {
	          from: this._findBorderPosition(this.from, ctx),
	          to: this._findBorderPosition(this.to, ctx)
	        };
	      } else {
	        var _context;

	        var _this$_getCircleData$ = slice$3(_context = this._getCircleData(ctx)).call(_context, 0, 2),
	            _this$_getCircleData$2 = slicedToArray$1(_this$_getCircleData$, 2),
	            x = _this$_getCircleData$2[0],
	            y = _this$_getCircleData$2[1];

	        return {
	          from: this._findBorderPositionCircle(this.from, ctx, {
	            x: x,
	            y: y,
	            low: 0.25,
	            high: 0.6,
	            direction: -1
	          }),
	          to: this._findBorderPositionCircle(this.from, ctx, {
	            x: x,
	            y: y,
	            low: 0.6,
	            high: 0.8,
	            direction: 1
	          })
	        };
	      }
	    }
	    /**
	     * Compute the center point and radius of an edge connected to the same node at both ends.
	     *
	     * @param ctx - The context that will be used for rendering.
	     *
	     * @returns `[x, y, radius]`
	     */

	  }, {
	    key: "_getCircleData",
	    value: function _getCircleData(ctx) {
	      var x;
	      var y;
	      var node = this.from;
	      var radius = this.options.selfReferenceSize;

	      if (ctx !== undefined) {
	        if (node.shape.width === undefined) {
	          node.shape.resize(ctx);
	        }
	      } // get circle coordinates


	      if (node.shape.width > node.shape.height) {
	        x = node.x + node.shape.width * 0.5;
	        y = node.y - radius;
	      } else {
	        x = node.x + radius;
	        y = node.y - node.shape.height * 0.5;
	      }

	      return [x, y, radius];
	    }
	    /**
	     * Get a point on a circle.
	     *
	     * @param x - Center of the circle on the x axis.
	     * @param y - Center of the circle on the y axis.
	     * @param radius - Radius of the circle.
	     * @param position - Value between 0 (line start) and 1 (line end).
	     *
	     * @returns Cartesian coordinates of requested point on the circle.
	     */

	  }, {
	    key: "_pointOnCircle",
	    value: function _pointOnCircle(x, y, radius, position) {
	      var angle = position * 2 * Math.PI;
	      return {
	        x: x + radius * Math.cos(angle),
	        y: y - radius * Math.sin(angle)
	      };
	    }
	    /**
	     * Find the intersection between the border of the node and the edge.
	     *
	     * @remarks
	     * This function uses binary search to look for the point where the circle crosses the border of the node.
	     *
	     * @param nearNode - The node (either from or to node of the edge).
	     * @param ctx - The context that will be used for rendering.
	     * @param options - Additional options.
	     *
	     * @returns Cartesian coordinates of the intersection between the border of the node and the edge.
	     */

	  }, {
	    key: "_findBorderPositionCircle",
	    value: function _findBorderPositionCircle(nearNode, ctx, options) {
	      var x = options.x;
	      var y = options.y;
	      var low = options.low;
	      var high = options.high;
	      var direction = options.direction;
	      var maxIterations = 10;
	      var radius = this.options.selfReferenceSize;
	      var threshold = 0.05;
	      var pos;
	      var middle = (low + high) * 0.5;
	      var iteration = 0;

	      do {
	        middle = (low + high) * 0.5;
	        pos = this._pointOnCircle(x, y, radius, middle);
	        var angle = Math.atan2(nearNode.y - pos.y, nearNode.x - pos.x);
	        var distanceToBorder = nearNode.distanceToBorder(ctx, angle);
	        var distanceToPoint = Math.sqrt(Math.pow(pos.x - nearNode.x, 2) + Math.pow(pos.y - nearNode.y, 2));
	        var difference = distanceToBorder - distanceToPoint;

	        if (Math.abs(difference) < threshold) {
	          break; // found
	        } else if (difference > 0) {
	          // distance to nodes is larger than distance to border --> t needs to be bigger if we're looking at the to node.
	          if (direction > 0) {
	            low = middle;
	          } else {
	            high = middle;
	          }
	        } else {
	          if (direction > 0) {
	            high = middle;
	          } else {
	            low = middle;
	          }
	        }

	        ++iteration;
	      } while (low <= high && iteration < maxIterations);

	      return _objectSpread$3({}, pos, {
	        t: middle
	      });
	    }
	    /**
	     * Get the line width of the edge. Depends on width and whether one of the connected nodes is selected.
	     *
	     * @param selected - Determines wheter the line is selected.
	     * @param hover - Determines wheter the line is being hovered, only applies if selected is false.
	     *
	     * @returns The width of the line.
	     */

	  }, {
	    key: "getLineWidth",
	    value: function getLineWidth(selected, hover) {
	      if (selected === true) {
	        return Math.max(this.selectionWidth, 0.3 / this._body.view.scale);
	      } else if (hover === true) {
	        return Math.max(this.hoverWidth, 0.3 / this._body.view.scale);
	      } else {
	        return Math.max(this.options.width, 0.3 / this._body.view.scale);
	      }
	    }
	    /**
	     * Compute the color or gradient for given edge.
	     *
	     * @param ctx - The context that will be used for rendering.
	     * @param values - Formatting values like color, opacity or shadow.
	     * @param _selected - Ignored (TODO: remove in the future).
	     * @param _hover - Ignored (TODO: remove in the future).
	     *
	     * @returns Color string if single color is inherited or gradient if two.
	     */

	  }, {
	    key: "getColor",
	    value: function getColor(ctx, values) {
	      if (values.inheritsColor !== false) {
	        // when this is a loop edge, just use the 'from' method
	        if (values.inheritsColor === "both" && this.from.id !== this.to.id) {
	          var grd = ctx.createLinearGradient(this.from.x, this.from.y, this.to.x, this.to.y);
	          var fromColor = this.from.options.color.highlight.border;
	          var toColor = this.to.options.color.highlight.border;

	          if (this.from.selected === false && this.to.selected === false) {
	            fromColor = overrideOpacity(this.from.options.color.border, values.opacity);
	            toColor = overrideOpacity(this.to.options.color.border, values.opacity);
	          } else if (this.from.selected === true && this.to.selected === false) {
	            toColor = this.to.options.color.border;
	          } else if (this.from.selected === false && this.to.selected === true) {
	            fromColor = this.from.options.color.border;
	          }

	          grd.addColorStop(0, fromColor);
	          grd.addColorStop(1, toColor); // -------------------- this returns -------------------- //

	          return grd;
	        }

	        if (values.inheritsColor === "to") {
	          return overrideOpacity(this.to.options.color.border, values.opacity);
	        } else {
	          // "from"
	          return overrideOpacity(this.from.options.color.border, values.opacity);
	        }
	      } else {
	        return overrideOpacity(values.color, values.opacity);
	      }
	    }
	    /**
	     * Draw a line from a node to itself, a circle.
	     *
	     * @param ctx - The context that will be used for rendering.
	     * @param values - Formatting values like color, opacity or shadow.
	     * @param x - Center of the circle on the x axis.
	     * @param y - Center of the circle on the y axis.
	     * @param radius - Radius of the circle.
	     */

	  }, {
	    key: "_circle",
	    value: function _circle(ctx, values, x, y, radius) {
	      // draw shadow if enabled
	      this.enableShadow(ctx, values); // draw a circle

	      ctx.beginPath();
	      ctx.arc(x, y, radius, 0, 2 * Math.PI, false);
	      ctx.stroke(); // disable shadows for other elements.

	      this.disableShadow(ctx, values);
	    }
	    /**
	     * @inheritdoc
	     *
	     * @remarks
	     * http://stackoverflow.com/questions/849211/shortest-distancae-between-a-point-and-a-line-segment
	     */

	  }, {
	    key: "getDistanceToEdge",
	    value: function getDistanceToEdge(x1, y1, x2, y2, x3, y3) {
	      if (this.from != this.to) {
	        return this._getDistanceToEdge(x1, y1, x2, y2, x3, y3);
	      } else {
	        var _this$_getCircleData7 = this._getCircleData(undefined),
	            _this$_getCircleData8 = slicedToArray$1(_this$_getCircleData7, 3),
	            x = _this$_getCircleData8[0],
	            y = _this$_getCircleData8[1],
	            radius = _this$_getCircleData8[2];

	        var dx = x - x3;
	        var dy = y - y3;
	        return Math.abs(Math.sqrt(dx * dx + dy * dy) - radius);
	      }
	    }
	    /**
	     * Calculate the distance between a point (x3, y3) and a line segment from (x1, y1) to (x2, y2).
	     *
	     * @param x1 - First end of the line segment on the x axis.
	     * @param y1 - First end of the line segment on the y axis.
	     * @param x2 - Second end of the line segment on the x axis.
	     * @param y2 - Second end of the line segment on the y axis.
	     * @param x3 - Position of the point on the x axis.
	     * @param y3 - Position of the point on the y axis.
	     *
	     * @returns The distance between the line segment and the point.
	     */

	  }, {
	    key: "_getDistanceToLine",
	    value: function _getDistanceToLine(x1, y1, x2, y2, x3, y3) {
	      var px = x2 - x1;
	      var py = y2 - y1;
	      var something = px * px + py * py;
	      var u = ((x3 - x1) * px + (y3 - y1) * py) / something;

	      if (u > 1) {
	        u = 1;
	      } else if (u < 0) {
	        u = 0;
	      }

	      var x = x1 + u * px;
	      var y = y1 + u * py;
	      var dx = x - x3;
	      var dy = y - y3; //# Note: If the actual distance does not matter,
	      //# if you only want to compare what this function
	      //# returns to other results of this function, you
	      //# can just return the squared distance instead
	      //# (i.e. remove the sqrt) to gain a little performance

	      return Math.sqrt(dx * dx + dy * dy);
	    }
	    /** @inheritdoc */

	  }, {
	    key: "getArrowData",
	    value: function getArrowData(ctx, position, viaNode, _selected, _hover, values) {
	      // set lets
	      var angle;
	      var arrowPoint;
	      var node1;
	      var node2;
	      var reversed;
	      var scaleFactor;
	      var type;
	      var lineWidth = values.width;

	      if (position === "from") {
	        node1 = this.from;
	        node2 = this.to;
	        reversed = values.fromArrowScale < 0;
	        scaleFactor = Math.abs(values.fromArrowScale);
	        type = values.fromArrowType;
	      } else if (position === "to") {
	        node1 = this.to;
	        node2 = this.from;
	        reversed = values.toArrowScale < 0;
	        scaleFactor = Math.abs(values.toArrowScale);
	        type = values.toArrowType;
	      } else {
	        node1 = this.to;
	        node2 = this.from;
	        reversed = values.middleArrowScale < 0;
	        scaleFactor = Math.abs(values.middleArrowScale);
	        type = values.middleArrowType;
	      }

	      var length = 15 * scaleFactor + 3 * lineWidth; // 3* lineWidth is the width of the edge.
	      // if not connected to itself

	      if (node1 != node2) {
	        var approximateEdgeLength = hypot$2(node1.x - node2.x, node1.y - node2.y);

	        var relativeLength = length / approximateEdgeLength;

	        if (position !== "middle") {
	          // draw arrow head
	          if (this.options.smooth.enabled === true) {
	            var pointT = this._findBorderPosition(node1, ctx, {
	              via: viaNode
	            });

	            var guidePos = this.getPoint(pointT.t + relativeLength * (position === "from" ? 1 : -1), viaNode);
	            angle = Math.atan2(pointT.y - guidePos.y, pointT.x - guidePos.x);
	            arrowPoint = pointT;
	          } else {
	            angle = Math.atan2(node1.y - node2.y, node1.x - node2.x);
	            arrowPoint = this._findBorderPosition(node1, ctx);
	          }
	        } else {
	          // Negative half length reverses arrow direction.
	          var halfLength = (reversed ? -relativeLength : relativeLength) / 2;
	          var guidePos1 = this.getPoint(0.5 + halfLength, viaNode);
	          var guidePos2 = this.getPoint(0.5 - halfLength, viaNode);
	          angle = Math.atan2(guidePos1.y - guidePos2.y, guidePos1.x - guidePos2.x);
	          arrowPoint = this.getPoint(0.5, viaNode);
	        }
	      } else {
	        // draw circle
	        var _this$_getCircleData9 = this._getCircleData(ctx),
	            _this$_getCircleData10 = slicedToArray$1(_this$_getCircleData9, 3),
	            x = _this$_getCircleData10[0],
	            y = _this$_getCircleData10[1],
	            radius = _this$_getCircleData10[2];

	        if (position === "from") {
	          var _pointT = this._findBorderPositionCircle(this.from, ctx, {
	            x: x,
	            y: y,
	            low: 0.25,
	            high: 0.6,
	            direction: -1
	          });

	          angle = _pointT.t * -2 * Math.PI + 1.5 * Math.PI + 0.1 * Math.PI;
	          arrowPoint = _pointT;
	        } else if (position === "to") {
	          var _pointT2 = this._findBorderPositionCircle(this.from, ctx, {
	            x: x,
	            y: y,
	            low: 0.6,
	            high: 1.0,
	            direction: 1
	          });

	          angle = _pointT2.t * -2 * Math.PI + 1.5 * Math.PI - 1.1 * Math.PI;
	          arrowPoint = _pointT2;
	        } else {
	          arrowPoint = this._pointOnCircle(x, y, radius, 0.175);
	          angle = 3.9269908169872414; // === 0.175 * -2 * Math.PI + 1.5 * Math.PI + 0.1 * Math.PI;
	        }
	      }

	      var xi = arrowPoint.x - length * 0.9 * Math.cos(angle);
	      var yi = arrowPoint.y - length * 0.9 * Math.sin(angle);
	      var arrowCore = {
	        x: xi,
	        y: yi
	      };
	      return {
	        point: arrowPoint,
	        core: arrowCore,
	        angle: angle,
	        length: length,
	        type: type
	      };
	    }
	    /** @inheritdoc */

	  }, {
	    key: "drawArrowHead",
	    value: function drawArrowHead(ctx, values, _selected, _hover, arrowData) {
	      // set style
	      ctx.strokeStyle = this.getColor(ctx, values);
	      ctx.fillStyle = ctx.strokeStyle;
	      ctx.lineWidth = values.width;
	      var canFill = EndPoints.draw(ctx, arrowData);

	      if (canFill) {
	        // draw shadow if enabled
	        this.enableShadow(ctx, values);

	        fill$2(ctx).call(ctx); // disable shadows for other elements.


	        this.disableShadow(ctx, values);
	      }
	    }
	    /**
	     * Set the shadow formatting values in the context if enabled, do nothing otherwise.
	     *
	     * @param ctx - The context that will be used for rendering.
	     * @param values - Formatting values for the shadow.
	     */

	  }, {
	    key: "enableShadow",
	    value: function enableShadow(ctx, values) {
	      if (values.shadow === true) {
	        ctx.shadowColor = values.shadowColor;
	        ctx.shadowBlur = values.shadowSize;
	        ctx.shadowOffsetX = values.shadowX;
	        ctx.shadowOffsetY = values.shadowY;
	      }
	    }
	    /**
	     * Reset the shadow formatting values in the context if enabled, do nothing otherwise.
	     *
	     * @param ctx - The context that will be used for rendering.
	     * @param values - Formatting values for the shadow.
	     */

	  }, {
	    key: "disableShadow",
	    value: function disableShadow(ctx, values) {
	      if (values.shadow === true) {
	        ctx.shadowColor = "rgba(0,0,0,0)";
	        ctx.shadowBlur = 0;
	        ctx.shadowOffsetX = 0;
	        ctx.shadowOffsetY = 0;
	      }
	    }
	    /**
	     * Render the background according to the formatting values.
	     *
	     * @param ctx - The context that will be used for rendering.
	     * @param values - Formatting values for the background.
	     */

	  }, {
	    key: "drawBackground",
	    value: function drawBackground(ctx, values) {
	      if (values.background !== false) {
	        // save original line attrs
	        var origCtxAttr = {
	          strokeStyle: ctx.strokeStyle,
	          lineWidth: ctx.lineWidth,
	          dashes: ctx.dashes
	        };
	        ctx.strokeStyle = values.backgroundColor;
	        ctx.lineWidth = values.backgroundSize;
	        this.setStrokeDashed(ctx, values.backgroundDashes);
	        ctx.stroke(); // restore original line attrs

	        ctx.strokeStyle = origCtxAttr.strokeStyle;
	        ctx.lineWidth = origCtxAttr.lineWidth;
	        ctx.dashes = origCtxAttr.dashes;
	        this.setStrokeDashed(ctx, values.dashes);
	      }
	    }
	    /**
	     * Set the line dash pattern if supported. Logs a warning to the console if it isn't supported.
	     *
	     * @param ctx - The context that will be used for rendering.
	     * @param dashes - The pattern [line, space, line…], true for default dashed line or false for normal line.
	     */

	  }, {
	    key: "setStrokeDashed",
	    value: function setStrokeDashed(ctx, dashes) {
	      if (dashes !== false) {
	        if (ctx.setLineDash !== undefined) {
	          var pattern = isArray$3(dashes) ? dashes : [5, 5];
	          ctx.setLineDash(pattern);
	        } else {
	          console.warn("setLineDash is not supported in this browser. The dashed stroke cannot be used.");
	        }
	      } else {
	        if (ctx.setLineDash !== undefined) {
	          ctx.setLineDash([]);
	        } else {
	          console.warn("setLineDash is not supported in this browser. The dashed stroke cannot be used.");
	        }
	      }
	    }
	  }]);

	  return EdgeBase;
	}();

	function ownKeys$6(object, enumerableOnly) { var keys = keys$6(object); if (getOwnPropertySymbols$2) { var symbols = getOwnPropertySymbols$2(object); if (enumerableOnly) symbols = filter$2(symbols).call(symbols, function (sym) { return getOwnPropertyDescriptor$3(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

	function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; forEach$2(_context = ownKeys$6(source, true)).call(_context, function (key) { defineProperty$c(target, key, source[key]); }); } else if (getOwnPropertyDescriptors$5) { defineProperties$1(target, getOwnPropertyDescriptors$5(source)); } else { var _context2; forEach$2(_context2 = ownKeys$6(source)).call(_context2, function (key) { defineProperty$3(target, key, getOwnPropertyDescriptor$3(source, key)); }); } } return target; }
	/**
	 * The Base Class for all Bezier edges.
	 * Bezier curves are used to model smooth gradual curves in paths between nodes.
	 */

	var BezierEdgeBase =
	/*#__PURE__*/
	function (_EdgeBase) {
	  inherits$1(BezierEdgeBase, _EdgeBase);

	  /**
	   * Create a new instance.
	   *
	   * @param options - The options object of given edge.
	   * @param body - The body of the network.
	   * @param labelModule - Label module.
	   */
	  function BezierEdgeBase(options, body, labelModule) {
	    classCallCheck(this, BezierEdgeBase);

	    return possibleConstructorReturn$1(this, getPrototypeOf$7(BezierEdgeBase).call(this, options, body, labelModule));
	  }
	  /**
	   * Find the intersection between the border of the node and the edge.
	   *
	   * @remarks
	   * This function uses binary search to look for the point where the bezier curve crosses the border of the node.
	   *
	   * @param nearNode - The node (either from or to node of the edge).
	   * @param ctx - The context that will be used for rendering.
	   * @param viaNode - Additional node(s) the edge passes through.
	   *
	   * @returns Cartesian coordinates of the intersection between the border of the node and the edge.
	   */


	  createClass(BezierEdgeBase, [{
	    key: "_findBorderPositionBezier",
	    value: function _findBorderPositionBezier(nearNode, ctx) {
	      var viaNode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this._getViaCoordinates();
	      var maxIterations = 10;
	      var threshold = 0.2;
	      var from = false;
	      var high = 1;
	      var low = 0;
	      var node = this.to;
	      var pos;
	      var middle;

	      if (nearNode.id === this.from.id) {
	        node = this.from;
	        from = true;
	      }

	      var iteration = 0;

	      do {
	        middle = (low + high) * 0.5;
	        pos = this.getPoint(middle, viaNode);
	        var angle = Math.atan2(node.y - pos.y, node.x - pos.x);
	        var distanceToBorder = node.distanceToBorder(ctx, angle);
	        var distanceToPoint = Math.sqrt(Math.pow(pos.x - node.x, 2) + Math.pow(pos.y - node.y, 2));
	        var difference = distanceToBorder - distanceToPoint;

	        if (Math.abs(difference) < threshold) {
	          break; // found
	        } else if (difference < 0) {
	          // distance to nodes is larger than distance to border --> t needs to be bigger if we're looking at the to node.
	          if (from === false) {
	            low = middle;
	          } else {
	            high = middle;
	          }
	        } else {
	          if (from === false) {
	            high = middle;
	          } else {
	            low = middle;
	          }
	        }

	        ++iteration;
	      } while (low <= high && iteration < maxIterations);

	      return _objectSpread$4({}, pos, {
	        t: middle
	      });
	    }
	    /**
	     * Calculate the distance between a point (x3,y3) and a line segment from (x1,y1) to (x2,y2).
	     *
	     * @remarks
	     * http://stackoverflow.com/questions/849211/shortest-distancae-between-a-point-and-a-line-segment
	     *
	     * @param x1 - First end of the line segment on the x axis.
	     * @param y1 - First end of the line segment on the y axis.
	     * @param x2 - Second end of the line segment on the x axis.
	     * @param y2 - Second end of the line segment on the y axis.
	     * @param x3 - Position of the point on the x axis.
	     * @param y3 - Position of the point on the y axis.
	     * @param via - The control point for the edge.
	     *
	     * @returns The distance between the line segment and the point.
	     */

	  }, {
	    key: "_getDistanceToBezierEdge",
	    value: function _getDistanceToBezierEdge(x1, y1, x2, y2, x3, y3, via) {
	      // x3,y3 is the point
	      var minDistance = 1e9;
	      var distance;
	      var i, t, x, y;
	      var lastX = x1;
	      var lastY = y1;

	      for (i = 1; i < 10; i++) {
	        t = 0.1 * i;
	        x = Math.pow(1 - t, 2) * x1 + 2 * t * (1 - t) * via.x + Math.pow(t, 2) * x2;
	        y = Math.pow(1 - t, 2) * y1 + 2 * t * (1 - t) * via.y + Math.pow(t, 2) * y2;

	        if (i > 0) {
	          distance = this._getDistanceToLine(lastX, lastY, x, y, x3, y3);
	          minDistance = distance < minDistance ? distance : minDistance;
	        }

	        lastX = x;
	        lastY = y;
	      }

	      return minDistance;
	    }
	    /**
	     * Render a bezier curve between two nodes.
	     *
	     * @remarks
	     * The method accepts zero, one or two control points.
	     * Passing zero control points just draws a straight line.
	     *
	     * @param ctx - The context that will be used for rendering.
	     * @param values - Style options for edge drawing.
	     * @param viaNode1 - First control point for curve drawing.
	     * @param viaNode2 - Second control point for curve drawing.
	     */

	  }, {
	    key: "_bezierCurve",
	    value: function _bezierCurve(ctx, values, viaNode1, viaNode2) {
	      ctx.beginPath();
	      ctx.moveTo(this.fromPoint.x, this.fromPoint.y);

	      if (viaNode1 != null && viaNode1.x != null) {
	        if (viaNode2 != null && viaNode2.x != null) {
	          ctx.bezierCurveTo(viaNode1.x, viaNode1.y, viaNode2.x, viaNode2.y, this.toPoint.x, this.toPoint.y);
	        } else {
	          ctx.quadraticCurveTo(viaNode1.x, viaNode1.y, this.toPoint.x, this.toPoint.y);
	        }
	      } else {
	        // fallback to normal straight edge
	        ctx.lineTo(this.toPoint.x, this.toPoint.y);
	      } // draw a background


	      this.drawBackground(ctx, values); // draw shadow if enabled

	      this.enableShadow(ctx, values);
	      ctx.stroke();
	      this.disableShadow(ctx, values);
	    }
	    /** @inheritdoc */

	  }, {
	    key: "getViaNode",
	    value: function getViaNode() {
	      return this._getViaCoordinates();
	    }
	  }]);

	  return BezierEdgeBase;
	}(EdgeBase);

	/**
	 * A Dynamic Bezier Edge. Bezier curves are used to model smooth gradual
	 * curves in paths between nodes. The Dynamic piece refers to how the curve
	 * reacts to physics changes.
	 *
	 * @extends BezierEdgeBase
	 */

	var BezierEdgeDynamic =
	/*#__PURE__*/
	function (_BezierEdgeBase) {
	  inherits$1(BezierEdgeDynamic, _BezierEdgeBase);

	  /**
	   * Create a new instance.
	   *
	   * @param options - The options object of given edge.
	   * @param body - The body of the network.
	   * @param labelModule - Label module.
	   */
	  function BezierEdgeDynamic(options, body, labelModule) {
	    var _this;

	    classCallCheck(this, BezierEdgeDynamic);

	    //this.via = undefined; // Here for completeness but not allowed to defined before super() is invoked.
	    _this = possibleConstructorReturn$1(this, getPrototypeOf$7(BezierEdgeDynamic).call(this, options, body, labelModule)); // --> this calls the setOptions below

	    _this.via = _this.via; // constructor → super → super → setOptions → setupSupportNode

	    _this._boundFunction = function () {
	      _this.positionBezierNode();
	    };

	    _this._body.emitter.on("_repositionBezierNodes", _this._boundFunction);

	    return _this;
	  }
	  /** @inheritdoc */


	  createClass(BezierEdgeDynamic, [{
	    key: "setOptions",
	    value: function setOptions(options) {
	      get$7(getPrototypeOf$7(BezierEdgeDynamic.prototype), "setOptions", this).call(this, options); // check if the physics has changed.


	      var physicsChange = false;

	      if (this.options.physics !== options.physics) {
	        physicsChange = true;
	      } // set the options and the to and from nodes


	      this.options = options;
	      this.id = this.options.id;
	      this.from = this._body.nodes[this.options.from];
	      this.to = this._body.nodes[this.options.to]; // setup the support node and connect

	      this.setupSupportNode();
	      this.connect(); // when we change the physics state of the edge, we reposition the support node.

	      if (physicsChange === true) {
	        this.via.setOptions({
	          physics: this.options.physics
	        });
	        this.positionBezierNode();
	      }
	    }
	    /** @inheritdoc */

	  }, {
	    key: "connect",
	    value: function connect() {
	      this.from = this._body.nodes[this.options.from];
	      this.to = this._body.nodes[this.options.to];

	      if (this.from === undefined || this.to === undefined || this.options.physics === false) {
	        this.via.setOptions({
	          physics: false
	        });
	      } else {
	        // fix weird behaviour where a self referencing node has physics enabled
	        if (this.from.id === this.to.id) {
	          this.via.setOptions({
	            physics: false
	          });
	        } else {
	          this.via.setOptions({
	            physics: true
	          });
	        }
	      }
	    }
	    /** @inheritdoc */

	  }, {
	    key: "cleanup",
	    value: function cleanup() {
	      this._body.emitter.off("_repositionBezierNodes", this._boundFunction);

	      if (this.via !== undefined) {
	        delete this._body.nodes[this.via.id];
	        this.via = undefined;
	        return true;
	      }

	      return false;
	    }
	    /**
	     * Create and add a support node if not already present.
	     *
	     * @remarks
	     * Bezier curves require an anchor point to calculate the smooth flow.
	     * These points are nodes.
	     * These nodes are invisible but are used for the force calculation.
	     *
	     * The changed data is not called, if needed, it is returned by the main edge constructor.
	     */

	  }, {
	    key: "setupSupportNode",
	    value: function setupSupportNode() {
	      if (this.via === undefined) {
	        var nodeId = "edgeId:" + this.id;

	        var node = this._body.functions.createNode({
	          id: nodeId,
	          shape: "circle",
	          physics: true,
	          hidden: true
	        });

	        this._body.nodes[nodeId] = node;
	        this.via = node;
	        this.via.parentEdgeId = this.id;
	        this.positionBezierNode();
	      }
	    }
	    /**
	     * Position bezier node.
	     */

	  }, {
	    key: "positionBezierNode",
	    value: function positionBezierNode() {
	      if (this.via !== undefined && this.from !== undefined && this.to !== undefined) {
	        this.via.x = 0.5 * (this.from.x + this.to.x);
	        this.via.y = 0.5 * (this.from.y + this.to.y);
	      } else if (this.via !== undefined) {
	        this.via.x = 0;
	        this.via.y = 0;
	      }
	    }
	    /** @inheritdoc */

	  }, {
	    key: "_line",
	    value: function _line(ctx, values, viaNode) {
	      this._bezierCurve(ctx, values, viaNode);
	    }
	    /** @inheritdoc */

	  }, {
	    key: "_getViaCoordinates",
	    value: function _getViaCoordinates() {
	      return this.via;
	    }
	    /** @inheritdoc */

	  }, {
	    key: "getViaNode",
	    value: function getViaNode() {
	      return this.via;
	    }
	    /** @inheritdoc */

	  }, {
	    key: "getPoint",
	    value: function getPoint(position) {
	      var viaNode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.via;

	      if (this.from === this.to) {
	        var _this$_getCircleData = this._getCircleData(),
	            _this$_getCircleData2 = slicedToArray$1(_this$_getCircleData, 3),
	            cx = _this$_getCircleData2[0],
	            cy = _this$_getCircleData2[1],
	            cr = _this$_getCircleData2[2];

	        var a = 2 * Math.PI * (1 - position);
	        return {
	          x: cx + cr * Math.sin(a),
	          y: cy + cr - cr * (1 - Math.cos(a))
	        };
	      } else {
	        return {
	          x: Math.pow(1 - position, 2) * this.fromPoint.x + 2 * position * (1 - position) * viaNode.x + Math.pow(position, 2) * this.toPoint.x,
	          y: Math.pow(1 - position, 2) * this.fromPoint.y + 2 * position * (1 - position) * viaNode.y + Math.pow(position, 2) * this.toPoint.y
	        };
	      }
	    }
	    /** @inheritdoc */

	  }, {
	    key: "_findBorderPosition",
	    value: function _findBorderPosition(nearNode, ctx) {
	      return this._findBorderPositionBezier(nearNode, ctx, this.via);
	    }
	    /** @inheritdoc */

	  }, {
	    key: "_getDistanceToEdge",
	    value: function _getDistanceToEdge(x1, y1, x2, y2, x3, y3) {
	      // x3,y3 is the point
	      return this._getDistanceToBezierEdge(x1, y1, x2, y2, x3, y3, this.via);
	    }
	  }]);

	  return BezierEdgeDynamic;
	}(BezierEdgeBase);

	/**
	 * A Static Bezier Edge. Bezier curves are used to model smooth gradual curves in paths between nodes.
	 */

	var BezierEdgeStatic =
	/*#__PURE__*/
	function (_BezierEdgeBase) {
	  inherits$1(BezierEdgeStatic, _BezierEdgeBase);

	  /**
	   * Create a new instance.
	   *
	   * @param options - The options object of given edge.
	   * @param body - The body of the network.
	   * @param labelModule - Label module.
	   */
	  function BezierEdgeStatic(options, body, labelModule) {
	    classCallCheck(this, BezierEdgeStatic);

	    return possibleConstructorReturn$1(this, getPrototypeOf$7(BezierEdgeStatic).call(this, options, body, labelModule));
	  }
	  /** @inheritdoc */


	  createClass(BezierEdgeStatic, [{
	    key: "_line",
	    value: function _line(ctx, values, viaNode) {
	      this._bezierCurve(ctx, values, viaNode);
	    }
	    /** @inheritdoc */

	  }, {
	    key: "getViaNode",
	    value: function getViaNode() {
	      return this._getViaCoordinates();
	    }
	    /**
	     * Compute the coordinates of the via node.
	     *
	     * @remarks
	     * We do not use the to and fromPoints here to make the via nodes the same as edges without arrows.
	     *
	     * @returns Cartesian coordinates of the via node.
	     */

	  }, {
	    key: "_getViaCoordinates",
	    value: function _getViaCoordinates() {
	      // Assumption: x/y coordinates in from/to always defined
	      var factor = this.options.smooth.roundness;
	      var type = this.options.smooth.type;
	      var dx = Math.abs(this.from.x - this.to.x);
	      var dy = Math.abs(this.from.y - this.to.y);

	      if (type === "discrete" || type === "diagonalCross") {
	        var stepX;
	        var stepY;

	        if (dx <= dy) {
	          stepX = stepY = factor * dy;
	        } else {
	          stepX = stepY = factor * dx;
	        }

	        if (this.from.x > this.to.x) {
	          stepX = -stepX;
	        }

	        if (this.from.y >= this.to.y) {
	          stepY = -stepY;
	        }

	        var xVia = this.from.x + stepX;
	        var yVia = this.from.y + stepY;

	        if (type === "discrete") {
	          if (dx <= dy) {
	            xVia = dx < factor * dy ? this.from.x : xVia;
	          } else {
	            yVia = dy < factor * dx ? this.from.y : yVia;
	          }
	        }

	        return {
	          x: xVia,
	          y: yVia
	        };
	      } else if (type === "straightCross") {
	        var _stepX = (1 - factor) * dx;

	        var _stepY = (1 - factor) * dy;

	        if (dx <= dy) {
	          // up - down
	          _stepX = 0;

	          if (this.from.y < this.to.y) {
	            _stepY = -_stepY;
	          }
	        } else {
	          // left - right
	          if (this.from.x < this.to.x) {
	            _stepX = -_stepX;
	          }

	          _stepY = 0;
	        }

	        return {
	          x: this.to.x + _stepX,
	          y: this.to.y + _stepY
	        };
	      } else if (type === "horizontal") {
	        var _stepX2 = (1 - factor) * dx;

	        if (this.from.x < this.to.x) {
	          _stepX2 = -_stepX2;
	        }

	        return {
	          x: this.to.x + _stepX2,
	          y: this.from.y
	        };
	      } else if (type === "vertical") {
	        var _stepY2 = (1 - factor) * dy;

	        if (this.from.y < this.to.y) {
	          _stepY2 = -_stepY2;
	        }

	        return {
	          x: this.from.x,
	          y: this.to.y + _stepY2
	        };
	      } else if (type === "curvedCW") {
	        dx = this.to.x - this.from.x;
	        dy = this.from.y - this.to.y;
	        var radius = Math.sqrt(dx * dx + dy * dy);
	        var pi = Math.PI;
	        var originalAngle = Math.atan2(dy, dx);
	        var myAngle = (originalAngle + (factor * 0.5 + 0.5) * pi) % (2 * pi);
	        return {
	          x: this.from.x + (factor * 0.5 + 0.5) * radius * Math.sin(myAngle),
	          y: this.from.y + (factor * 0.5 + 0.5) * radius * Math.cos(myAngle)
	        };
	      } else if (type === "curvedCCW") {
	        dx = this.to.x - this.from.x;
	        dy = this.from.y - this.to.y;

	        var _radius = Math.sqrt(dx * dx + dy * dy);

	        var _pi = Math.PI;

	        var _originalAngle = Math.atan2(dy, dx);

	        var _myAngle = (_originalAngle + (-factor * 0.5 + 0.5) * _pi) % (2 * _pi);

	        return {
	          x: this.from.x + (factor * 0.5 + 0.5) * _radius * Math.sin(_myAngle),
	          y: this.from.y + (factor * 0.5 + 0.5) * _radius * Math.cos(_myAngle)
	        };
	      } else {
	        // continuous
	        var _stepX3;

	        var _stepY3;

	        if (dx <= dy) {
	          _stepX3 = _stepY3 = factor * dy;
	        } else {
	          _stepX3 = _stepY3 = factor * dx;
	        }

	        if (this.from.x > this.to.x) {
	          _stepX3 = -_stepX3;
	        }

	        if (this.from.y >= this.to.y) {
	          _stepY3 = -_stepY3;
	        }

	        var _xVia = this.from.x + _stepX3;

	        var _yVia = this.from.y + _stepY3;

	        if (dx <= dy) {
	          if (this.from.x <= this.to.x) {
	            _xVia = this.to.x < _xVia ? this.to.x : _xVia;
	          } else {
	            _xVia = this.to.x > _xVia ? this.to.x : _xVia;
	          }
	        } else {
	          if (this.from.y >= this.to.y) {
	            _yVia = this.to.y > _yVia ? this.to.y : _yVia;
	          } else {
	            _yVia = this.to.y < _yVia ? this.to.y : _yVia;
	          }
	        }

	        return {
	          x: _xVia,
	          y: _yVia
	        };
	      }
	    }
	    /** @inheritdoc */

	  }, {
	    key: "_findBorderPosition",
	    value: function _findBorderPosition(nearNode, ctx) {
	      var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
	      return this._findBorderPositionBezier(nearNode, ctx, options.via);
	    }
	    /** @inheritdoc */

	  }, {
	    key: "_getDistanceToEdge",
	    value: function _getDistanceToEdge(x1, y1, x2, y2, x3, y3) {
	      var viaNode = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : this._getViaCoordinates();
	      // x3,y3 is the point
	      return this._getDistanceToBezierEdge(x1, y1, x2, y2, x3, y3, viaNode);
	    }
	    /** @inheritdoc */

	  }, {
	    key: "getPoint",
	    value: function getPoint(position) {
	      var viaNode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this._getViaCoordinates();
	      var t = position;
	      var x = Math.pow(1 - t, 2) * this.fromPoint.x + 2 * t * (1 - t) * viaNode.x + Math.pow(t, 2) * this.toPoint.x;
	      var y = Math.pow(1 - t, 2) * this.fromPoint.y + 2 * t * (1 - t) * viaNode.y + Math.pow(t, 2) * this.toPoint.y;
	      return {
	        x: x,
	        y: y
	      };
	    }
	  }]);

	  return BezierEdgeStatic;
	}(BezierEdgeBase);

	/**
	 * A Base Class for all Cubic Bezier Edges. Bezier curves are used to model
	 * smooth gradual curves in paths between nodes.
	 *
	 * @extends BezierEdgeBase
	 */

	var CubicBezierEdgeBase =
	/*#__PURE__*/
	function (_BezierEdgeBase) {
	  inherits$1(CubicBezierEdgeBase, _BezierEdgeBase);

	  /**
	   * Create a new instance.
	   *
	   * @param options - The options object of given edge.
	   * @param body - The body of the network.
	   * @param labelModule - Label module.
	   */
	  function CubicBezierEdgeBase(options, body, labelModule) {
	    classCallCheck(this, CubicBezierEdgeBase);

	    return possibleConstructorReturn$1(this, getPrototypeOf$7(CubicBezierEdgeBase).call(this, options, body, labelModule));
	  }
	  /**
	   * Calculate the distance between a point (x3,y3) and a line segment from (x1,y1) to (x2,y2).
	   *
	   * @remarks
	   * http://stackoverflow.com/questions/849211/shortest-distancae-between-a-point-and-a-line-segment
	   * https://en.wikipedia.org/wiki/B%C3%A9zier_curve
	   *
	   * @param x1 - First end of the line segment on the x axis.
	   * @param y1 - First end of the line segment on the y axis.
	   * @param x2 - Second end of the line segment on the x axis.
	   * @param y2 - Second end of the line segment on the y axis.
	   * @param x3 - Position of the point on the x axis.
	   * @param y3 - Position of the point on the y axis.
	   * @param via1 - The first point this edge passes through.
	   * @param via2 - The second point this edge passes through.
	   *
	   * @returns The distance between the line segment and the point.
	   */


	  createClass(CubicBezierEdgeBase, [{
	    key: "_getDistanceToBezierEdge2",
	    value: function _getDistanceToBezierEdge2(x1, y1, x2, y2, x3, y3, via1, via2) {
	      // x3,y3 is the point
	      var minDistance = 1e9;
	      var lastX = x1;
	      var lastY = y1;
	      var vec = [0, 0, 0, 0];

	      for (var i = 1; i < 10; i++) {
	        var t = 0.1 * i;
	        vec[0] = Math.pow(1 - t, 3);
	        vec[1] = 3 * t * Math.pow(1 - t, 2);
	        vec[2] = 3 * Math.pow(t, 2) * (1 - t);
	        vec[3] = Math.pow(t, 3);
	        var x = vec[0] * x1 + vec[1] * via1.x + vec[2] * via2.x + vec[3] * x2;
	        var y = vec[0] * y1 + vec[1] * via1.y + vec[2] * via2.y + vec[3] * y2;

	        if (i > 0) {
	          var distance = this._getDistanceToLine(lastX, lastY, x, y, x3, y3);

	          minDistance = distance < minDistance ? distance : minDistance;
	        }

	        lastX = x;
	        lastY = y;
	      }

	      return minDistance;
	    }
	  }]);

	  return CubicBezierEdgeBase;
	}(BezierEdgeBase);

	/**
	 * A Cubic Bezier Edge. Bezier curves are used to model smooth gradual curves in paths between nodes.
	 */

	var CubicBezierEdge =
	/*#__PURE__*/
	function (_CubicBezierEdgeBase) {
	  inherits$1(CubicBezierEdge, _CubicBezierEdgeBase);

	  /**
	   * Create a new instance.
	   *
	   * @param options - The options object of given edge.
	   * @param body - The body of the network.
	   * @param labelModule - Label module.
	   */
	  function CubicBezierEdge(options, body, labelModule) {
	    classCallCheck(this, CubicBezierEdge);

	    return possibleConstructorReturn$1(this, getPrototypeOf$7(CubicBezierEdge).call(this, options, body, labelModule));
	  }
	  /** @inheritdoc */


	  createClass(CubicBezierEdge, [{
	    key: "_line",
	    value: function _line(ctx, values, viaNodes) {
	      // get the coordinates of the support points.
	      var via1 = viaNodes[0];
	      var via2 = viaNodes[1];

	      this._bezierCurve(ctx, values, via1, via2);
	    }
	    /**
	     * Compute the additional points the edge passes through.
	     *
	     * @returns Cartesian coordinates of the points the edge passes through.
	     */

	  }, {
	    key: "_getViaCoordinates",
	    value: function _getViaCoordinates() {
	      var dx = this.from.x - this.to.x;
	      var dy = this.from.y - this.to.y;
	      var x1;
	      var y1;
	      var x2;
	      var y2;
	      var roundness = this.options.smooth.roundness; // horizontal if x > y or if direction is forced or if direction is horizontal

	      if ((Math.abs(dx) > Math.abs(dy) || this.options.smooth.forceDirection === true || this.options.smooth.forceDirection === "horizontal") && this.options.smooth.forceDirection !== "vertical") {
	        y1 = this.from.y;
	        y2 = this.to.y;
	        x1 = this.from.x - roundness * dx;
	        x2 = this.to.x + roundness * dx;
	      } else {
	        y1 = this.from.y - roundness * dy;
	        y2 = this.to.y + roundness * dy;
	        x1 = this.from.x;
	        x2 = this.to.x;
	      }

	      return [{
	        x: x1,
	        y: y1
	      }, {
	        x: x2,
	        y: y2
	      }];
	    }
	    /** @inheritdoc */

	  }, {
	    key: "getViaNode",
	    value: function getViaNode() {
	      return this._getViaCoordinates();
	    }
	    /** @inheritdoc */

	  }, {
	    key: "_findBorderPosition",
	    value: function _findBorderPosition(nearNode, ctx) {
	      return this._findBorderPositionBezier(nearNode, ctx);
	    }
	    /** @inheritdoc */

	  }, {
	    key: "_getDistanceToEdge",
	    value: function _getDistanceToEdge(x1, y1, x2, y2, x3, y3) {
	      var _ref = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : this._getViaCoordinates(),
	          _ref2 = slicedToArray$1(_ref, 2),
	          via1 = _ref2[0],
	          via2 = _ref2[1];

	      // x3,y3 is the point
	      return this._getDistanceToBezierEdge2(x1, y1, x2, y2, x3, y3, via1, via2);
	    }
	    /** @inheritdoc */

	  }, {
	    key: "getPoint",
	    value: function getPoint(position) {
	      var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this._getViaCoordinates(),
	          _ref4 = slicedToArray$1(_ref3, 2),
	          via1 = _ref4[0],
	          via2 = _ref4[1];

	      var t = position;
	      var vec = [Math.pow(1 - t, 3), 3 * t * Math.pow(1 - t, 2), 3 * Math.pow(t, 2) * (1 - t), Math.pow(t, 3)];
	      var x = vec[0] * this.fromPoint.x + vec[1] * via1.x + vec[2] * via2.x + vec[3] * this.toPoint.x;
	      var y = vec[0] * this.fromPoint.y + vec[1] * via1.y + vec[2] * via2.y + vec[3] * this.toPoint.y;
	      return {
	        x: x,
	        y: y
	      };
	    }
	  }]);

	  return CubicBezierEdge;
	}(CubicBezierEdgeBase);

	/**
	 * A Straight Edge.
	 */

	var StraightEdge =
	/*#__PURE__*/
	function (_EdgeBase) {
	  inherits$1(StraightEdge, _EdgeBase);

	  /**
	   * Create a new instance.
	   *
	   * @param options - The options object of given edge.
	   * @param body - The body of the network.
	   * @param labelModule - Label module.
	   */
	  function StraightEdge(options, body, labelModule) {
	    classCallCheck(this, StraightEdge);

	    return possibleConstructorReturn$1(this, getPrototypeOf$7(StraightEdge).call(this, options, body, labelModule));
	  }
	  /** @inheritdoc */


	  createClass(StraightEdge, [{
	    key: "_line",
	    value: function _line(ctx, values) {
	      // draw a straight line
	      ctx.beginPath();
	      ctx.moveTo(this.fromPoint.x, this.fromPoint.y);
	      ctx.lineTo(this.toPoint.x, this.toPoint.y); // draw shadow if enabled

	      this.enableShadow(ctx, values);
	      ctx.stroke();
	      this.disableShadow(ctx, values);
	    }
	    /** @inheritdoc */

	  }, {
	    key: "getViaNode",
	    value: function getViaNode() {
	      return undefined;
	    }
	    /** @inheritdoc */

	  }, {
	    key: "getPoint",
	    value: function getPoint(position) {
	      return {
	        x: (1 - position) * this.fromPoint.x + position * this.toPoint.x,
	        y: (1 - position) * this.fromPoint.y + position * this.toPoint.y
	      };
	    }
	    /** @inheritdoc */

	  }, {
	    key: "_findBorderPosition",
	    value: function _findBorderPosition(nearNode, ctx) {
	      var node1 = this.to;
	      var node2 = this.from;

	      if (nearNode.id === this.from.id) {
	        node1 = this.from;
	        node2 = this.to;
	      }

	      var angle = Math.atan2(node1.y - node2.y, node1.x - node2.x);
	      var dx = node1.x - node2.x;
	      var dy = node1.y - node2.y;
	      var edgeSegmentLength = Math.sqrt(dx * dx + dy * dy);
	      var toBorderDist = nearNode.distanceToBorder(ctx, angle);
	      var toBorderPoint = (edgeSegmentLength - toBorderDist) / edgeSegmentLength;
	      return {
	        x: (1 - toBorderPoint) * node2.x + toBorderPoint * node1.x,
	        y: (1 - toBorderPoint) * node2.y + toBorderPoint * node1.y,
	        t: 0
	      };
	    }
	    /** @inheritdoc */

	  }, {
	    key: "_getDistanceToEdge",
	    value: function _getDistanceToEdge(x1, y1, x2, y2, x3, y3) {
	      // x3,y3 is the point
	      return this._getDistanceToLine(x1, y1, x2, y2, x3, y3);
	    }
	  }]);

	  return StraightEdge;
	}(EdgeBase);

	/**
	 * An edge connects two nodes and has a specific direction.
	 */

	var Edge =
	/*#__PURE__*/
	function () {
	  /**
	   * @param {Object} options        values specific to this edge, must contain at least 'from' and 'to'
	   * @param {Object} body           shared state from Network instance
	   * @param {Network.Images} imagelist  A list with images. Only needed when the edge has image arrows.
	   * @param {Object} globalOptions  options from the EdgesHandler instance
	   * @param {Object} defaultOptions default options from the EdgeHandler instance. Value and reference are constant
	   */
	  function Edge(options, body, imagelist, globalOptions, defaultOptions) {
	    classCallCheck(this, Edge);

	    if (body === undefined) {
	      throw new Error("No body provided");
	    } // Since globalOptions is constant in values as well as reference,
	    // Following needs to be done only once.


	    this.options = bridgeObject(globalOptions);
	    this.globalOptions = globalOptions;
	    this.defaultOptions = defaultOptions;
	    this.body = body;
	    this.imagelist = imagelist; // initialize variables

	    this.id = undefined;
	    this.fromId = undefined;
	    this.toId = undefined;
	    this.selected = false;
	    this.hover = false;
	    this.labelDirty = true;
	    this.baseWidth = this.options.width;
	    this.baseFontSize = this.options.font.size;
	    this.from = undefined; // a node

	    this.to = undefined; // a node

	    this.edgeType = undefined;
	    this.connected = false;
	    this.labelModule = new Label(this.body, this.options, true
	    /* It's an edge label */
	    );
	    this.setOptions(options);
	  }
	  /**
	   * Set or overwrite options for the edge
	   * @param {Object} options  an object with options
	   * @returns {undefined|boolean} undefined if no options, true if layout affecting data changed, false otherwise.
	   */


	  createClass(Edge, [{
	    key: "setOptions",
	    value: function setOptions(options) {
	      if (!options) {
	        return;
	      } // Following options if changed affect the layout.


	      var affectsLayout = typeof options.physics !== "undefined" && this.options.physics !== options.physics || typeof options.hidden !== "undefined" && (this.options.hidden || false) !== (options.hidden || false) || typeof options.from !== "undefined" && this.options.from !== options.from || typeof options.to !== "undefined" && this.options.to !== options.to;
	      Edge.parseOptions(this.options, options, true, this.globalOptions);

	      if (options.id !== undefined) {
	        this.id = options.id;
	      }

	      if (options.from !== undefined) {
	        this.fromId = options.from;
	      }

	      if (options.to !== undefined) {
	        this.toId = options.to;
	      }

	      if (options.title !== undefined) {
	        this.title = options.title;
	      }

	      if (options.value !== undefined) {
	        options.value = _parseFloat$3(options.value);
	      }

	      var pile = [options, this.options, this.defaultOptions];
	      this.chooser = ComponentUtil.choosify('edge', pile); // update label Module

	      this.updateLabelModule(options); // Update edge type, this if changed affects the layout.

	      affectsLayout = this.updateEdgeType() || affectsLayout; // if anything has been updates, reset the selection width and the hover width

	      this._setInteractionWidths(); // A node is connected when it has a from and to node that both exist in the network.body.nodes.


	      this.connect();
	      return affectsLayout;
	    }
	    /**
	     *
	     * @param {Object} parentOptions
	     * @param {Object} newOptions
	     * @param {boolean} [allowDeletion=false]
	     * @param {Object} [globalOptions={}]
	     * @param {boolean} [copyFromGlobals=false]
	     */

	  }, {
	    key: "getFormattingValues",

	    /**
	     *
	     * @returns {ArrowOptions}
	     */
	    value: function getFormattingValues() {
	      var toArrow = this.options.arrows.to === true || this.options.arrows.to.enabled === true;
	      var fromArrow = this.options.arrows.from === true || this.options.arrows.from.enabled === true;
	      var middleArrow = this.options.arrows.middle === true || this.options.arrows.middle.enabled === true;
	      var inheritsColor = this.options.color.inherit;
	      var values = {
	        toArrow: toArrow,
	        toArrowScale: this.options.arrows.to.scaleFactor,
	        toArrowType: this.options.arrows.to.type,
	        toArrowSrc: this.options.arrows.to.src,
	        toArrowImageWidth: this.options.arrows.to.imageWidth,
	        toArrowImageHeight: this.options.arrows.to.imageHeight,
	        middleArrow: middleArrow,
	        middleArrowScale: this.options.arrows.middle.scaleFactor,
	        middleArrowType: this.options.arrows.middle.type,
	        middleArrowSrc: this.options.arrows.middle.src,
	        middleArrowImageWidth: this.options.arrows.middle.imageWidth,
	        middleArrowImageHeight: this.options.arrows.middle.imageHeight,
	        fromArrow: fromArrow,
	        fromArrowScale: this.options.arrows.from.scaleFactor,
	        fromArrowType: this.options.arrows.from.type,
	        fromArrowSrc: this.options.arrows.from.src,
	        fromArrowImageWidth: this.options.arrows.from.imageWidth,
	        fromArrowImageHeight: this.options.arrows.from.imageHeight,
	        arrowStrikethrough: this.options.arrowStrikethrough,
	        color: inheritsColor ? undefined : this.options.color.color,
	        inheritsColor: inheritsColor,
	        opacity: this.options.color.opacity,
	        hidden: this.options.hidden,
	        length: this.options.length,
	        shadow: this.options.shadow.enabled,
	        shadowColor: this.options.shadow.color,
	        shadowSize: this.options.shadow.size,
	        shadowX: this.options.shadow.x,
	        shadowY: this.options.shadow.y,
	        dashes: this.options.dashes,
	        width: this.options.width,
	        background: this.options.background.enabled,
	        backgroundColor: this.options.background.color,
	        backgroundSize: this.options.background.size,
	        backgroundDashes: this.options.background.dashes
	      };

	      if (this.selected || this.hover) {
	        if (this.chooser === true) {
	          if (this.selected) {
	            var selectedWidth = this.options.selectionWidth;

	            if (typeof selectedWidth === 'function') {
	              values.width = selectedWidth(values.width);
	            } else if (typeof selectedWidth === 'number') {
	              values.width += selectedWidth;
	            }

	            values.width = Math.max(values.width, 0.3 / this.body.view.scale);
	            values.color = this.options.color.highlight;
	            values.shadow = this.options.shadow.enabled;
	          } else if (this.hover) {
	            var hoverWidth = this.options.hoverWidth;

	            if (typeof hoverWidth === 'function') {
	              values.width = hoverWidth(values.width);
	            } else if (typeof hoverWidth === 'number') {
	              values.width += hoverWidth;
	            }

	            values.width = Math.max(values.width, 0.3 / this.body.view.scale);
	            values.color = this.options.color.hover;
	            values.shadow = this.options.shadow.enabled;
	          }
	        } else if (typeof this.chooser === 'function') {
	          this.chooser(values, this.options.id, this.selected, this.hover);

	          if (values.color !== undefined) {
	            values.inheritsColor = false;
	          }

	          if (values.shadow === false) {
	            if (values.shadowColor !== this.options.shadow.color || values.shadowSize !== this.options.shadow.size || values.shadowX !== this.options.shadow.x || values.shadowY !== this.options.shadow.y) {
	              values.shadow = true;
	            }
	          }
	        }
	      } else {
	        values.shadow = this.options.shadow.enabled;
	        values.width = Math.max(values.width, 0.3 / this.body.view.scale);
	      }

	      return values;
	    }
	    /**
	     * update the options in the label module
	     *
	     * @param {Object} options
	     */

	  }, {
	    key: "updateLabelModule",
	    value: function updateLabelModule(options) {
	      var pile = [options, this.options, this.globalOptions, // Currently set global edge options
	      this.defaultOptions];
	      this.labelModule.update(this.options, pile);

	      if (this.labelModule.baseSize !== undefined) {
	        this.baseFontSize = this.labelModule.baseSize;
	      }
	    }
	    /**
	     * update the edge type, set the options
	     * @returns {boolean}
	     */

	  }, {
	    key: "updateEdgeType",
	    value: function updateEdgeType() {
	      var smooth = this.options.smooth;
	      var dataChanged = false;
	      var changeInType = true;

	      if (this.edgeType !== undefined) {
	        if (this.edgeType instanceof BezierEdgeDynamic && smooth.enabled === true && smooth.type === 'dynamic' || this.edgeType instanceof CubicBezierEdge && smooth.enabled === true && smooth.type === 'cubicBezier' || this.edgeType instanceof BezierEdgeStatic && smooth.enabled === true && smooth.type !== 'dynamic' && smooth.type !== 'cubicBezier' || this.edgeType instanceof StraightEdge && smooth.type.enabled === false) {
	          changeInType = false;
	        }

	        if (changeInType === true) {
	          dataChanged = this.cleanup();
	        }
	      }

	      if (changeInType === true) {
	        if (smooth.enabled === true) {
	          if (smooth.type === 'dynamic') {
	            dataChanged = true;
	            this.edgeType = new BezierEdgeDynamic(this.options, this.body, this.labelModule);
	          } else if (smooth.type === 'cubicBezier') {
	            this.edgeType = new CubicBezierEdge(this.options, this.body, this.labelModule);
	          } else {
	            this.edgeType = new BezierEdgeStatic(this.options, this.body, this.labelModule);
	          }
	        } else {
	          this.edgeType = new StraightEdge(this.options, this.body, this.labelModule);
	        }
	      } else {
	        // if nothing changes, we just set the options.
	        this.edgeType.setOptions(this.options);
	      }

	      return dataChanged;
	    }
	    /**
	     * Connect an edge to its nodes
	     */

	  }, {
	    key: "connect",
	    value: function connect() {
	      this.disconnect();
	      this.from = this.body.nodes[this.fromId] || undefined;
	      this.to = this.body.nodes[this.toId] || undefined;
	      this.connected = this.from !== undefined && this.to !== undefined;

	      if (this.connected === true) {
	        this.from.attachEdge(this);
	        this.to.attachEdge(this);
	      } else {
	        if (this.from) {
	          this.from.detachEdge(this);
	        }

	        if (this.to) {
	          this.to.detachEdge(this);
	        }
	      }

	      this.edgeType.connect();
	    }
	    /**
	     * Disconnect an edge from its nodes
	     */

	  }, {
	    key: "disconnect",
	    value: function disconnect() {
	      if (this.from) {
	        this.from.detachEdge(this);
	        this.from = undefined;
	      }

	      if (this.to) {
	        this.to.detachEdge(this);
	        this.to = undefined;
	      }

	      this.connected = false;
	    }
	    /**
	     * get the title of this edge.
	     * @return {string} title    The title of the edge, or undefined when no title
	     *                           has been set.
	     */

	  }, {
	    key: "getTitle",
	    value: function getTitle() {
	      return this.title;
	    }
	    /**
	     * check if this node is selecte
	     * @return {boolean} selected   True if node is selected, else false
	     */

	  }, {
	    key: "isSelected",
	    value: function isSelected() {
	      return this.selected;
	    }
	    /**
	     * Retrieve the value of the edge. Can be undefined
	     * @return {number} value
	     */

	  }, {
	    key: "getValue",
	    value: function getValue() {
	      return this.options.value;
	    }
	    /**
	     * Adjust the value range of the edge. The edge will adjust it's width
	     * based on its value.
	     * @param {number} min
	     * @param {number} max
	     * @param {number} total
	     */

	  }, {
	    key: "setValueRange",
	    value: function setValueRange(min, max, total) {
	      if (this.options.value !== undefined) {
	        var scale = this.options.scaling.customScalingFunction(min, max, total, this.options.value);
	        var widthDiff = this.options.scaling.max - this.options.scaling.min;

	        if (this.options.scaling.label.enabled === true) {
	          var fontDiff = this.options.scaling.label.max - this.options.scaling.label.min;
	          this.options.font.size = this.options.scaling.label.min + scale * fontDiff;
	        }

	        this.options.width = this.options.scaling.min + scale * widthDiff;
	      } else {
	        this.options.width = this.baseWidth;
	        this.options.font.size = this.baseFontSize;
	      }

	      this._setInteractionWidths();

	      this.updateLabelModule();
	    }
	    /**
	     *
	     * @private
	     */

	  }, {
	    key: "_setInteractionWidths",
	    value: function _setInteractionWidths() {
	      if (typeof this.options.hoverWidth === 'function') {
	        this.edgeType.hoverWidth = this.options.hoverWidth(this.options.width);
	      } else {
	        this.edgeType.hoverWidth = this.options.hoverWidth + this.options.width;
	      }

	      if (typeof this.options.selectionWidth === 'function') {
	        this.edgeType.selectionWidth = this.options.selectionWidth(this.options.width);
	      } else {
	        this.edgeType.selectionWidth = this.options.selectionWidth + this.options.width;
	      }
	    }
	    /**
	     * Redraw a edge
	     * Draw this edge in the given canvas
	     * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d");
	     * @param {CanvasRenderingContext2D}   ctx
	     */

	  }, {
	    key: "draw",
	    value: function draw(ctx) {
	      var values = this.getFormattingValues();

	      if (values.hidden) {
	        return;
	      } // get the via node from the edge type


	      var viaNode = this.edgeType.getViaNode();
	      var arrowData = {}; // restore edge targets to defaults

	      this.edgeType.fromPoint = this.edgeType.from;
	      this.edgeType.toPoint = this.edgeType.to; // from and to arrows give a different end point for edges. we set them here

	      if (values.fromArrow) {
	        arrowData.from = this.edgeType.getArrowData(ctx, "from", viaNode, this.selected, this.hover, values);
	        if (values.arrowStrikethrough === false) this.edgeType.fromPoint = arrowData.from.core;

	        if (values.fromArrowSrc) {
	          arrowData.from.image = this.imagelist.load(values.fromArrowSrc);
	        }

	        if (values.fromArrowImageWidth) {
	          arrowData.from.imageWidth = values.fromArrowImageWidth;
	        }

	        if (values.fromArrowImageHeight) {
	          arrowData.from.imageHeight = values.fromArrowImageHeight;
	        }
	      }

	      if (values.toArrow) {
	        arrowData.to = this.edgeType.getArrowData(ctx, "to", viaNode, this.selected, this.hover, values);
	        if (values.arrowStrikethrough === false) this.edgeType.toPoint = arrowData.to.core;

	        if (values.toArrowSrc) {
	          arrowData.to.image = this.imagelist.load(values.toArrowSrc);
	        }

	        if (values.toArrowImageWidth) {
	          arrowData.to.imageWidth = values.toArrowImageWidth;
	        }

	        if (values.toArrowImageHeight) {
	          arrowData.to.imageHeight = values.toArrowImageHeight;
	        }
	      } // the middle arrow depends on the line, which can depend on the to and from arrows so we do this one lastly.


	      if (values.middleArrow) {
	        arrowData.middle = this.edgeType.getArrowData(ctx, "middle", viaNode, this.selected, this.hover, values);

	        if (values.middleArrowSrc) {
	          arrowData.middle.image = this.imagelist.load(values.middleArrowSrc);
	        }

	        if (values.middleArrowImageWidth) {
	          arrowData.middle.imageWidth = values.middleArrowImageWidth;
	        }

	        if (values.middleArrowImageHeight) {
	          arrowData.middle.imageHeight = values.middleArrowImageHeight;
	        }
	      } // draw everything


	      this.edgeType.drawLine(ctx, values, this.selected, this.hover, viaNode);
	      this.drawArrows(ctx, arrowData, values);
	      this.drawLabel(ctx, viaNode);
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {Object} arrowData
	     * @param {ArrowOptions} values
	     */

	  }, {
	    key: "drawArrows",
	    value: function drawArrows(ctx, arrowData, values) {
	      if (values.fromArrow) {
	        this.edgeType.drawArrowHead(ctx, values, this.selected, this.hover, arrowData.from);
	      }

	      if (values.middleArrow) {
	        this.edgeType.drawArrowHead(ctx, values, this.selected, this.hover, arrowData.middle);
	      }

	      if (values.toArrow) {
	        this.edgeType.drawArrowHead(ctx, values, this.selected, this.hover, arrowData.to);
	      }
	    }
	    /**
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {Node} viaNode
	     */

	  }, {
	    key: "drawLabel",
	    value: function drawLabel(ctx, viaNode) {
	      if (this.options.label !== undefined) {
	        // set style
	        var node1 = this.from;
	        var node2 = this.to;

	        if (this.labelModule.differentState(this.selected, this.hover)) {
	          this.labelModule.getTextSize(ctx, this.selected, this.hover);
	        }

	        if (node1.id != node2.id) {
	          this.labelModule.pointToSelf = false;
	          var point = this.edgeType.getPoint(0.5, viaNode);
	          ctx.save();

	          var rotationPoint = this._getRotation(ctx);

	          if (rotationPoint.angle != 0) {
	            ctx.translate(rotationPoint.x, rotationPoint.y);
	            ctx.rotate(rotationPoint.angle);
	          } // draw the label


	          this.labelModule.draw(ctx, point.x, point.y, this.selected, this.hover);
	          /*
	                  // Useful debug code: draw a border around the label
	                  // This should **not** be enabled in production!
	                  var size = this.labelModule.getSize();; // ;; intentional so lint catches it
	                  ctx.strokeStyle = "#ff0000";
	                  ctx.strokeRect(size.left, size.top, size.width, size.height);
	                  // End  debug code
	          */

	          ctx.restore();
	        } else {
	          // Ignore the orientations.
	          this.labelModule.pointToSelf = true;
	          var x, y;
	          var radius = this.options.selfReferenceSize;

	          if (node1.shape.width > node1.shape.height) {
	            x = node1.x + node1.shape.width * 0.5;
	            y = node1.y - radius;
	          } else {
	            x = node1.x + radius;
	            y = node1.y - node1.shape.height * 0.5;
	          }

	          point = this._pointOnCircle(x, y, radius, 0.125);
	          this.labelModule.draw(ctx, point.x, point.y, this.selected, this.hover);
	        }
	      }
	    }
	    /**
	     * Determine all visual elements of this edge instance, in which the given
	     * point falls within the bounding shape.
	     *
	     * @param {point} point
	     * @returns {Array.<edgeClickItem|edgeLabelClickItem>} list with the items which are on the point
	     */

	  }, {
	    key: "getItemsOnPoint",
	    value: function getItemsOnPoint(point) {
	      var ret = [];

	      if (this.labelModule.visible()) {
	        var rotationPoint = this._getRotation();

	        if (ComponentUtil.pointInRect(this.labelModule.getSize(), point, rotationPoint)) {
	          ret.push({
	            edgeId: this.id,
	            labelId: 0
	          });
	        }
	      }

	      var obj = {
	        left: point.x,
	        top: point.y
	      };

	      if (this.isOverlappingWith(obj)) {
	        ret.push({
	          edgeId: this.id
	        });
	      }

	      return ret;
	    }
	    /**
	     * Check if this object is overlapping with the provided object
	     * @param {Object} obj   an object with parameters left, top
	     * @return {boolean}     True if location is located on the edge
	     */

	  }, {
	    key: "isOverlappingWith",
	    value: function isOverlappingWith(obj) {
	      if (this.connected) {
	        var distMax = 10;
	        var xFrom = this.from.x;
	        var yFrom = this.from.y;
	        var xTo = this.to.x;
	        var yTo = this.to.y;
	        var xObj = obj.left;
	        var yObj = obj.top;
	        var dist = this.edgeType.getDistanceToEdge(xFrom, yFrom, xTo, yTo, xObj, yObj);
	        return dist < distMax;
	      } else {
	        return false;
	      }
	    }
	    /** 
	     * Determine the rotation point, if any.
	     *
	     * @param {CanvasRenderingContext2D} [ctx] if passed, do a recalculation of the label size
	     * @returns {rotationPoint} the point to rotate around and the angle in radians to rotate
	     * @private
	     */

	  }, {
	    key: "_getRotation",
	    value: function _getRotation(ctx) {
	      var viaNode = this.edgeType.getViaNode();
	      var point = this.edgeType.getPoint(0.5, viaNode);

	      if (ctx !== undefined) {
	        this.labelModule.calculateLabelSize(ctx, this.selected, this.hover, point.x, point.y);
	      }

	      var ret = {
	        x: point.x,
	        y: this.labelModule.size.yLine,
	        angle: 0
	      };

	      if (!this.labelModule.visible()) {
	        return ret; // Don't even bother doing the atan2, there's nothing to draw
	      }

	      if (this.options.font.align === "horizontal") {
	        return ret; // No need to calculate angle
	      }

	      var dy = this.from.y - this.to.y;
	      var dx = this.from.x - this.to.x;
	      var angle = Math.atan2(dy, dx); // radians
	      // rotate so that label is readable

	      if (angle < -1 && dx < 0 || angle > 0 && dx < 0) {
	        angle += Math.PI;
	      }

	      ret.angle = angle;
	      return ret;
	    }
	    /**
	     * Get a point on a circle
	     * @param {number} x
	     * @param {number} y
	     * @param {number} radius
	     * @param {number} percentage Value between 0 (line start) and 1 (line end)
	     * @return {Object} point
	     * @private
	     */

	  }, {
	    key: "_pointOnCircle",
	    value: function _pointOnCircle(x, y, radius, percentage) {
	      var angle = percentage * 2 * Math.PI;
	      return {
	        x: x + radius * Math.cos(angle),
	        y: y - radius * Math.sin(angle)
	      };
	    }
	    /**
	     * Sets selected state to true
	     */

	  }, {
	    key: "select",
	    value: function select() {
	      this.selected = true;
	    }
	    /**
	     * Sets selected state to false
	     */

	  }, {
	    key: "unselect",
	    value: function unselect() {
	      this.selected = false;
	    }
	    /**
	     * cleans all required things on delete
	     * @returns {*}
	     */

	  }, {
	    key: "cleanup",
	    value: function cleanup() {
	      return this.edgeType.cleanup();
	    }
	    /**
	     * Remove edge from the list and perform necessary cleanup.
	     */

	  }, {
	    key: "remove",
	    value: function remove() {
	      this.cleanup();
	      this.disconnect();
	      delete this.body.edges[this.id];
	    }
	    /**
	     * Check if both connecting nodes exist
	     * @returns {boolean}
	     */

	  }, {
	    key: "endPointsValid",
	    value: function endPointsValid() {
	      return this.body.nodes[this.fromId] !== undefined && this.body.nodes[this.toId] !== undefined;
	    }
	  }], [{
	    key: "parseOptions",
	    value: function parseOptions(parentOptions, newOptions) {
	      var allowDeletion = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
	      var globalOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
	      var copyFromGlobals = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
	      var fields = ['arrowStrikethrough', 'id', 'from', 'hidden', 'hoverWidth', 'labelHighlightBold', 'length', 'line', 'opacity', 'physics', 'scaling', 'selectionWidth', 'selfReferenceSize', 'to', 'title', 'value', 'width', 'font', 'chosen', 'widthConstraint']; // only deep extend the items in the field array. These do not have shorthand.

	      selectiveDeepExtend(fields, parentOptions, newOptions, allowDeletion); // Only copy label if it's a legal value.

	      if (ComponentUtil.isValidLabel(newOptions.label)) {
	        parentOptions.label = newOptions.label;
	      } else if (!ComponentUtil.isValidLabel(parentOptions.label)) {
	        parentOptions.label = undefined;
	      }

	      mergeOptions(parentOptions, newOptions, 'smooth', globalOptions);
	      mergeOptions(parentOptions, newOptions, 'shadow', globalOptions);
	      mergeOptions(parentOptions, newOptions, 'background', globalOptions);

	      if (newOptions.dashes !== undefined && newOptions.dashes !== null) {
	        parentOptions.dashes = newOptions.dashes;
	      } else if (allowDeletion === true && newOptions.dashes === null) {
	        parentOptions.dashes = create$2(globalOptions.dashes); // this sets the pointer of the option back to the global option.
	      } // set the scaling newOptions


	      if (newOptions.scaling !== undefined && newOptions.scaling !== null) {
	        if (newOptions.scaling.min !== undefined) {
	          parentOptions.scaling.min = newOptions.scaling.min;
	        }

	        if (newOptions.scaling.max !== undefined) {
	          parentOptions.scaling.max = newOptions.scaling.max;
	        }

	        mergeOptions(parentOptions.scaling, newOptions.scaling, 'label', globalOptions.scaling);
	      } else if (allowDeletion === true && newOptions.scaling === null) {
	        parentOptions.scaling = create$2(globalOptions.scaling); // this sets the pointer of the option back to the global option.
	      } // handle multiple input cases for arrows


	      if (newOptions.arrows !== undefined && newOptions.arrows !== null) {
	        if (typeof newOptions.arrows === 'string') {
	          var arrows = newOptions.arrows.toLowerCase();
	          parentOptions.arrows.to.enabled = indexOf$3(arrows).call(arrows, "to") != -1;
	          parentOptions.arrows.middle.enabled = indexOf$3(arrows).call(arrows, "middle") != -1;
	          parentOptions.arrows.from.enabled = indexOf$3(arrows).call(arrows, "from") != -1;
	        } else if (_typeof_1(newOptions.arrows) === 'object') {
	          mergeOptions(parentOptions.arrows, newOptions.arrows, 'to', globalOptions.arrows);
	          mergeOptions(parentOptions.arrows, newOptions.arrows, 'middle', globalOptions.arrows);
	          mergeOptions(parentOptions.arrows, newOptions.arrows, 'from', globalOptions.arrows);
	        } else {
	          throw new Error("The arrow newOptions can only be an object or a string. Refer to the documentation. You used:" + stringify$2(newOptions.arrows));
	        }
	      } else if (allowDeletion === true && newOptions.arrows === null) {
	        parentOptions.arrows = create$2(globalOptions.arrows); // this sets the pointer of the option back to the global option.
	      } // handle multiple input cases for color


	      if (newOptions.color !== undefined && newOptions.color !== null) {
	        var fromColor = isString(newOptions.color) ? {
	          color: newOptions.color,
	          highlight: newOptions.color,
	          hover: newOptions.color,
	          inherit: false,
	          opacity: 1
	        } : newOptions.color;
	        var toColor = parentOptions.color; // If passed, fill in values from default options - required in the case of no prototype bridging

	        if (copyFromGlobals) {
	          deepExtend(toColor, globalOptions.color, false, allowDeletion);
	        } else {
	          // Clear local properties - need to do it like this in order to retain prototype bridges
	          for (var i in toColor) {
	            if (toColor.hasOwnProperty(i)) {
	              delete toColor[i];
	            }
	          }
	        }

	        if (isString(toColor)) {
	          toColor.color = toColor;
	          toColor.highlight = toColor;
	          toColor.hover = toColor;
	          toColor.inherit = false;

	          if (fromColor.opacity === undefined) {
	            toColor.opacity = 1.0; // set default
	          }
	        } else {
	          var colorsDefined = false;

	          if (fromColor.color !== undefined) {
	            toColor.color = fromColor.color;
	            colorsDefined = true;
	          }

	          if (fromColor.highlight !== undefined) {
	            toColor.highlight = fromColor.highlight;
	            colorsDefined = true;
	          }

	          if (fromColor.hover !== undefined) {
	            toColor.hover = fromColor.hover;
	            colorsDefined = true;
	          }

	          if (fromColor.inherit !== undefined) {
	            toColor.inherit = fromColor.inherit;
	          }

	          if (fromColor.opacity !== undefined) {
	            toColor.opacity = Math.min(1, Math.max(0, fromColor.opacity));
	          }

	          if (colorsDefined === true) {
	            toColor.inherit = false;
	          } else {
	            if (toColor.inherit === undefined) {
	              toColor.inherit = 'from'; // Set default
	            }
	          }
	        }
	      } else if (allowDeletion === true && newOptions.color === null) {
	        parentOptions.color = bridgeObject(globalOptions.color); // set the object back to the global options
	      }

	      if (allowDeletion === true && newOptions.font === null) {
	        parentOptions.font = bridgeObject(globalOptions.font); // set the object back to the global options
	      }
	    }
	  }]);

	  return Edge;
	}();

	/**
	 * Handler for Edges
	 */

	var EdgesHandler =
	/*#__PURE__*/
	function () {
	  /**
	   * @param {Object} body
	   * @param {Array.<Image>} images
	   * @param {Array.<Group>} groups
	   */
	  function EdgesHandler(body, images, groups) {
	    var _context,
	        _this = this;

	    classCallCheck(this, EdgesHandler);

	    this.body = body;
	    this.images = images;
	    this.groups = groups; // create the edge API in the body container

	    this.body.functions.createEdge = bind$2(_context = this.create).call(_context, this);
	    this.edgesListeners = {
	      add: function add(event, params) {
	        _this.add(params.items);
	      },
	      update: function update(event, params) {
	        _this.update(params.items);
	      },
	      remove: function remove(event, params) {
	        _this.remove(params.items);
	      }
	    };
	    this.options = {};
	    this.defaultOptions = {
	      arrows: {
	        to: {
	          enabled: false,
	          scaleFactor: 1,
	          type: 'arrow'
	        },
	        // boolean / {arrowScaleFactor:1} / {enabled: false, arrowScaleFactor:1}
	        middle: {
	          enabled: false,
	          scaleFactor: 1,
	          type: 'arrow'
	        },
	        from: {
	          enabled: false,
	          scaleFactor: 1,
	          type: 'arrow'
	        }
	      },
	      arrowStrikethrough: true,
	      color: {
	        color: '#848484',
	        highlight: '#848484',
	        hover: '#848484',
	        inherit: 'from',
	        opacity: 1.0
	      },
	      dashes: false,
	      font: {
	        color: '#343434',
	        size: 14,
	        // px
	        face: 'arial',
	        background: 'none',
	        strokeWidth: 2,
	        // px
	        strokeColor: '#ffffff',
	        align: 'horizontal',
	        multi: false,
	        vadjust: 0,
	        bold: {
	          mod: 'bold'
	        },
	        boldital: {
	          mod: 'bold italic'
	        },
	        ital: {
	          mod: 'italic'
	        },
	        mono: {
	          mod: '',
	          size: 15,
	          // px
	          face: 'courier new',
	          vadjust: 2
	        }
	      },
	      hidden: false,
	      hoverWidth: 1.5,
	      label: undefined,
	      labelHighlightBold: true,
	      length: undefined,
	      physics: true,
	      scaling: {
	        min: 1,
	        max: 15,
	        label: {
	          enabled: true,
	          min: 14,
	          max: 30,
	          maxVisible: 30,
	          drawThreshold: 5
	        },
	        customScalingFunction: function customScalingFunction(min, max, total, value) {
	          if (max === min) {
	            return 0.5;
	          } else {
	            var scale = 1 / (max - min);
	            return Math.max(0, (value - min) * scale);
	          }
	        }
	      },
	      selectionWidth: 1.5,
	      selfReferenceSize: 20,
	      shadow: {
	        enabled: false,
	        color: 'rgba(0,0,0,0.5)',
	        size: 10,
	        x: 5,
	        y: 5
	      },
	      background: {
	        enabled: false,
	        color: 'rgba(111,111,111,1)',
	        size: 10,
	        dashes: false
	      },
	      smooth: {
	        enabled: true,
	        type: "dynamic",
	        forceDirection: 'none',
	        roundness: 0.5
	      },
	      title: undefined,
	      width: 1,
	      value: undefined
	    };
	    deepExtend(this.options, this.defaultOptions);
	    this.bindEventListeners();
	  }
	  /**
	   * Binds event listeners
	   */


	  createClass(EdgesHandler, [{
	    key: "bindEventListeners",
	    value: function bindEventListeners() {
	      var _this2 = this,
	          _context2,
	          _context3;

	      // this allows external modules to force all dynamic curves to turn static.
	      this.body.emitter.on("_forceDisableDynamicCurves", function (type) {
	        var emit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;

	        if (type === 'dynamic') {
	          type = 'continuous';
	        }

	        var dataChanged = false;

	        for (var edgeId in _this2.body.edges) {
	          if (_this2.body.edges.hasOwnProperty(edgeId)) {
	            var edge = _this2.body.edges[edgeId];

	            var edgeData = _this2.body.data.edges.get(edgeId); // only forcibly remove the smooth curve if the data has been set of the edge has the smooth curves defined.
	            // this is because a change in the global would not affect these curves.


	            if (edgeData !== undefined) {
	              var smoothOptions = edgeData.smooth;

	              if (smoothOptions !== undefined) {
	                if (smoothOptions.enabled === true && smoothOptions.type === 'dynamic') {
	                  if (type === undefined) {
	                    edge.setOptions({
	                      smooth: false
	                    });
	                  } else {
	                    edge.setOptions({
	                      smooth: {
	                        type: type
	                      }
	                    });
	                  }

	                  dataChanged = true;
	                }
	              }
	            }
	          }
	        }

	        if (emit === true && dataChanged === true) {
	          _this2.body.emitter.emit("_dataChanged");
	        }
	      }); // this is called when options of EXISTING nodes or edges have changed.
	      //
	      // NOTE: Not true, called when options have NOT changed, for both existing as well as new nodes.
	      //       See update() for logic.
	      // TODO: Verify and examine the consequences of this. It might still trigger when
	      //       non-option fields have changed, but then reconnecting edges is still useless.
	      //       Alternatively, it might also be called when edges are removed.
	      //

	      this.body.emitter.on("_dataUpdated", function () {
	        _this2.reconnectEdges();
	      }); // refresh the edges. Used when reverting from hierarchical layout

	      this.body.emitter.on("refreshEdges", bind$2(_context2 = this.refresh).call(_context2, this));
	      this.body.emitter.on("refresh", bind$2(_context3 = this.refresh).call(_context3, this));
	      this.body.emitter.on("destroy", function () {
	        forEach$3$1(_this2.edgesListeners, function (callback, event) {
	          if (_this2.body.data.edges) _this2.body.data.edges.off(event, callback);
	        });
	        delete _this2.body.functions.createEdge;
	        delete _this2.edgesListeners.add;
	        delete _this2.edgesListeners.update;
	        delete _this2.edgesListeners.remove;
	        delete _this2.edgesListeners;
	      });
	    }
	    /**
	     *
	     * @param {Object} options
	     */

	  }, {
	    key: "setOptions",
	    value: function setOptions(options) {
	      if (options !== undefined) {
	        // use the parser from the Edge class to fill in all shorthand notations
	        Edge.parseOptions(this.options, options, true, this.defaultOptions, true); // update smooth settings in all edges

	        var dataChanged = false;

	        if (options.smooth !== undefined) {
	          for (var edgeId in this.body.edges) {
	            if (this.body.edges.hasOwnProperty(edgeId)) {
	              dataChanged = this.body.edges[edgeId].updateEdgeType() || dataChanged;
	            }
	          }
	        } // update fonts in all edges


	        if (options.font !== undefined) {
	          for (var _edgeId in this.body.edges) {
	            if (this.body.edges.hasOwnProperty(_edgeId)) {
	              this.body.edges[_edgeId].updateLabelModule();
	            }
	          }
	        } // update the state of the variables if needed


	        if (options.hidden !== undefined || options.physics !== undefined || dataChanged === true) {
	          this.body.emitter.emit('_dataChanged');
	        }
	      }
	    }
	    /**
	     * Load edges by reading the data table
	     * @param {Array | DataSet | DataView} edges    The data containing the edges.
	     * @param {boolean} [doNotEmit=false]
	     * @private
	     */

	  }, {
	    key: "setData",
	    value: function setData(edges) {
	      var _this3 = this;

	      var doNotEmit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
	      var oldEdgesData = this.body.data.edges;

	      if (edges instanceof DataSet || edges instanceof DataView) {
	        this.body.data.edges = edges;
	      } else if (isArray$3(edges)) {
	        this.body.data.edges = new DataSet();
	        this.body.data.edges.add(edges);
	      } else if (!edges) {
	        this.body.data.edges = new DataSet();
	      } else {
	        throw new TypeError('Array or DataSet expected');
	      } // TODO: is this null or undefined or false?


	      if (oldEdgesData) {
	        // unsubscribe from old dataset
	        forEach$3$1(this.edgesListeners, function (callback, event) {
	          oldEdgesData.off(event, callback);
	        });
	      } // remove drawn edges


	      this.body.edges = {}; // TODO: is this null or undefined or false?

	      if (this.body.data.edges) {
	        // subscribe to new dataset
	        forEach$3$1(this.edgesListeners, function (callback, event) {
	          _this3.body.data.edges.on(event, callback);
	        }); // draw all new nodes

	        var ids = this.body.data.edges.getIds();
	        this.add(ids, true);
	      }

	      this.body.emitter.emit('_adjustEdgesForHierarchicalLayout');

	      if (doNotEmit === false) {
	        this.body.emitter.emit("_dataChanged");
	      }
	    }
	    /**
	     * Add edges
	     * @param {number[] | string[]} ids
	     * @param {boolean} [doNotEmit=false]
	     * @private
	     */

	  }, {
	    key: "add",
	    value: function add(ids) {
	      var doNotEmit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
	      var edges = this.body.edges;
	      var edgesData = this.body.data.edges;

	      for (var i = 0; i < ids.length; i++) {
	        var id = ids[i];
	        var oldEdge = edges[id];

	        if (oldEdge) {
	          oldEdge.disconnect();
	        }

	        var data = edgesData.get(id, {
	          "showInternalIds": true
	        });
	        edges[id] = this.create(data);
	      }

	      this.body.emitter.emit('_adjustEdgesForHierarchicalLayout');

	      if (doNotEmit === false) {
	        this.body.emitter.emit("_dataChanged");
	      }
	    }
	    /**
	     * Update existing edges, or create them when not yet existing
	     * @param {number[] | string[]} ids
	     * @private
	     */

	  }, {
	    key: "update",
	    value: function update(ids) {
	      var edges = this.body.edges;
	      var edgesData = this.body.data.edges;
	      var dataChanged = false;

	      for (var i = 0; i < ids.length; i++) {
	        var id = ids[i];
	        var data = edgesData.get(id);
	        var edge = edges[id];

	        if (edge !== undefined) {
	          // update edge
	          edge.disconnect();
	          dataChanged = edge.setOptions(data) || dataChanged; // if a support node is added, data can be changed.

	          edge.connect();
	        } else {
	          // create edge
	          this.body.edges[id] = this.create(data);
	          dataChanged = true;
	        }
	      }

	      if (dataChanged === true) {
	        this.body.emitter.emit('_adjustEdgesForHierarchicalLayout');
	        this.body.emitter.emit("_dataChanged");
	      } else {
	        this.body.emitter.emit("_dataUpdated");
	      }
	    }
	    /**
	     * Remove existing edges. Non existing ids will be ignored
	     * @param {number[] | string[]} ids
	     * @param {boolean} [emit=true]
	     * @private
	     */

	  }, {
	    key: "remove",
	    value: function remove(ids) {
	      var emit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
	      if (ids.length === 0) return; // early out

	      var edges = this.body.edges;
	      forEach$3$1(ids, function (id) {
	        var edge = edges[id];

	        if (edge !== undefined) {
	          edge.remove();
	        }
	      });

	      if (emit) {
	        this.body.emitter.emit("_dataChanged");
	      }
	    }
	    /**
	     * Refreshes Edge Handler
	     */

	  }, {
	    key: "refresh",
	    value: function refresh() {
	      var _this4 = this;

	      forEach$3$1(this.body.edges, function (edge, edgeId) {
	        var data = _this4.body.data.edges.get(edgeId);

	        if (data !== undefined) {
	          edge.setOptions(data);
	        }
	      });
	    }
	    /**
	     *
	     * @param {Object} properties
	     * @returns {Edge}
	     */

	  }, {
	    key: "create",
	    value: function create(properties) {
	      return new Edge(properties, this.body, this.images, this.options, this.defaultOptions);
	    }
	    /**
	     * Reconnect all edges
	     * @private
	     */

	  }, {
	    key: "reconnectEdges",
	    value: function reconnectEdges() {
	      var id;
	      var nodes = this.body.nodes;
	      var edges = this.body.edges;

	      for (id in nodes) {
	        if (nodes.hasOwnProperty(id)) {
	          nodes[id].edges = [];
	        }
	      }

	      for (id in edges) {
	        if (edges.hasOwnProperty(id)) {
	          var edge = edges[id];
	          edge.from = null;
	          edge.to = null;
	          edge.connect();
	        }
	      }
	    }
	    /**
	     *
	     * @param {Edge.id} edgeId
	     * @returns {Array}
	     */

	  }, {
	    key: "getConnectedNodes",
	    value: function getConnectedNodes(edgeId) {
	      var nodeList = [];

	      if (this.body.edges[edgeId] !== undefined) {
	        var edge = this.body.edges[edgeId];

	        if (edge.fromId !== undefined) {
	          nodeList.push(edge.fromId);
	        }

	        if (edge.toId !== undefined) {
	          nodeList.push(edge.toId);
	        }
	      }

	      return nodeList;
	    }
	    /**
	     * There is no direct relation between the nodes and the edges DataSet,
	     * so the right place to do call this is in the handler for event `_dataUpdated`.
	     */

	  }, {
	    key: "_updateState",
	    value: function _updateState() {
	      this._addMissingEdges();

	      this._removeInvalidEdges();
	    }
	    /**
	     * Scan for missing nodes and remove corresponding edges, if any.
	     * @private
	     */

	  }, {
	    key: "_removeInvalidEdges",
	    value: function _removeInvalidEdges() {
	      var _this5 = this;

	      var edgesToDelete = [];
	      forEach$3$1(this.body.edges, function (edge, id) {
	        var toNode = _this5.body.nodes[edge.toId];
	        var fromNode = _this5.body.nodes[edge.fromId]; // Skip clustering edges here, let the Clustering module handle those

	        if (toNode !== undefined && toNode.isCluster === true || fromNode !== undefined && fromNode.isCluster === true) {
	          return;
	        }

	        if (toNode === undefined || fromNode === undefined) {
	          edgesToDelete.push(id);
	        }
	      });
	      this.remove(edgesToDelete, false);
	    }
	    /**
	     * add all edges from dataset that are not in the cached state
	     * @private
	     */

	  }, {
	    key: "_addMissingEdges",
	    value: function _addMissingEdges() {
	      var edgesData = this.body.data.edges;

	      if (edgesData === undefined || edgesData === null) {
	        return; // No edges DataSet yet; can happen on startup 
	      }

	      var edges = this.body.edges;
	      var addIds = [];

	      forEach$2(edgesData).call(edgesData, function (edgeData, edgeId) {
	        var edge = edges[edgeId];

	        if (edge === undefined) {
	          addIds.push(edgeId);
	        }
	      });

	      this.add(addIds, true);
	    }
	  }]);

	  return EdgesHandler;
	}();

	/**
	 * Barnes Hut Solver
	 */
	var BarnesHutSolver =
	/*#__PURE__*/
	function () {
	  /**
	   * @param {Object} body
	   * @param {{physicsNodeIndices: Array, physicsEdgeIndices: Array, forces: {}, velocities: {}}} physicsBody
	   * @param {Object} options
	   */
	  function BarnesHutSolver(body, physicsBody, options) {
	    classCallCheck(this, BarnesHutSolver);

	    this.body = body;
	    this.physicsBody = physicsBody;
	    this.barnesHutTree;
	    this.setOptions(options);
	    this.randomSeed = 5; // debug: show grid
	    // this.body.emitter.on("afterDrawing", (ctx) => {this._debug(ctx,'#ff0000')})
	  }
	  /**
	   *
	   * @param {Object} options
	   */


	  createClass(BarnesHutSolver, [{
	    key: "setOptions",
	    value: function setOptions(options) {
	      this.options = options;
	      this.thetaInversed = 1 / this.options.theta; // if 1 then min distance = 0.5, if 0.5 then min distance = 0.5 + 0.5*node.shape.radius

	      this.overlapAvoidanceFactor = 1 - Math.max(0, Math.min(1, this.options.avoidOverlap));
	    }
	    /**
	     *
	     * @returns {number} random integer
	     */

	  }, {
	    key: "seededRandom",
	    value: function seededRandom() {
	      var x = Math.sin(this.randomSeed++) * 10000;
	      return x - Math.floor(x);
	    }
	    /**
	     * This function calculates the forces the nodes apply on each other based on a gravitational model.
	     * The Barnes Hut method is used to speed up this N-body simulation.
	     *
	     * @private
	     */

	  }, {
	    key: "solve",
	    value: function solve() {
	      if (this.options.gravitationalConstant !== 0 && this.physicsBody.physicsNodeIndices.length > 0) {
	        var node;
	        var nodes = this.body.nodes;
	        var nodeIndices = this.physicsBody.physicsNodeIndices;
	        var nodeCount = nodeIndices.length; // create the tree

	        var barnesHutTree = this._formBarnesHutTree(nodes, nodeIndices); // for debugging


	        this.barnesHutTree = barnesHutTree; // place the nodes one by one recursively

	        for (var i = 0; i < nodeCount; i++) {
	          node = nodes[nodeIndices[i]];

	          if (node.options.mass > 0) {
	            // starting with root is irrelevant, it never passes the BarnesHutSolver condition
	            this._getForceContributions(barnesHutTree.root, node);
	          }
	        }
	      }
	    }
	    /**
	     * @param {Object} parentBranch
	     * @param {Node} node
	     * @private
	     */

	  }, {
	    key: "_getForceContributions",
	    value: function _getForceContributions(parentBranch, node) {
	      this._getForceContribution(parentBranch.children.NW, node);

	      this._getForceContribution(parentBranch.children.NE, node);

	      this._getForceContribution(parentBranch.children.SW, node);

	      this._getForceContribution(parentBranch.children.SE, node);
	    }
	    /**
	     * This function traverses the barnesHutTree. It checks when it can approximate distant nodes with their center of mass.
	     * If a region contains a single node, we check if it is not itself, then we apply the force.
	     *
	     * @param {Object} parentBranch
	     * @param {Node} node
	     * @private
	     */

	  }, {
	    key: "_getForceContribution",
	    value: function _getForceContribution(parentBranch, node) {
	      // we get no force contribution from an empty region
	      if (parentBranch.childrenCount > 0) {
	        var dx, dy, distance; // get the distance from the center of mass to the node.

	        dx = parentBranch.centerOfMass.x - node.x;
	        dy = parentBranch.centerOfMass.y - node.y;
	        distance = Math.sqrt(dx * dx + dy * dy); // BarnesHutSolver condition
	        // original condition : s/d < theta = passed  ===  d/s > 1/theta = passed
	        // calcSize = 1/s --> d * 1/s > 1/theta = passed

	        if (distance * parentBranch.calcSize > this.thetaInversed) {
	          this._calculateForces(distance, dx, dy, node, parentBranch);
	        } else {
	          // Did not pass the condition, go into children if available
	          if (parentBranch.childrenCount === 4) {
	            this._getForceContributions(parentBranch, node);
	          } else {
	            // parentBranch must have only one node, if it was empty we wouldnt be here
	            if (parentBranch.children.data.id != node.id) {
	              // if it is not self
	              this._calculateForces(distance, dx, dy, node, parentBranch);
	            }
	          }
	        }
	      }
	    }
	    /**
	     * Calculate the forces based on the distance.
	     *
	     * @param {number} distance
	     * @param {number} dx
	     * @param {number} dy
	     * @param {Node} node
	     * @param {Object} parentBranch
	     * @private
	     */

	  }, {
	    key: "_calculateForces",
	    value: function _calculateForces(distance, dx, dy, node, parentBranch) {
	      if (distance === 0) {
	        distance = 0.1;
	        dx = distance;
	      }

	      if (this.overlapAvoidanceFactor < 1 && node.shape.radius) {
	        distance = Math.max(0.1 + this.overlapAvoidanceFactor * node.shape.radius, distance - node.shape.radius);
	      } // the dividing by the distance cubed instead of squared allows us to get the fx and fy components without sines and cosines
	      // it is shorthand for gravityforce with distance squared and fx = dx/distance * gravityForce


	      var gravityForce = this.options.gravitationalConstant * parentBranch.mass * node.options.mass / Math.pow(distance, 3);
	      var fx = dx * gravityForce;
	      var fy = dy * gravityForce;
	      this.physicsBody.forces[node.id].x += fx;
	      this.physicsBody.forces[node.id].y += fy;
	    }
	    /**
	     * This function constructs the barnesHut tree recursively. It creates the root, splits it and starts placing the nodes.
	     *
	     * @param {Array.<Node>} nodes
	     * @param {Array.<number>} nodeIndices
	     * @returns {{root: {centerOfMass: {x: number, y: number}, mass: number, range: {minX: number, maxX: number, minY: number, maxY: number}, size: number, calcSize: number, children: {data: null}, maxWidth: number, level: number, childrenCount: number}}} BarnesHutTree
	     * @private
	     */

	  }, {
	    key: "_formBarnesHutTree",
	    value: function _formBarnesHutTree(nodes, nodeIndices) {
	      var node;
	      var nodeCount = nodeIndices.length;
	      var minX = nodes[nodeIndices[0]].x;
	      var minY = nodes[nodeIndices[0]].y;
	      var maxX = nodes[nodeIndices[0]].x;
	      var maxY = nodes[nodeIndices[0]].y; // get the range of the nodes

	      for (var i = 1; i < nodeCount; i++) {
	        var _node = nodes[nodeIndices[i]];
	        var x = _node.x;
	        var y = _node.y;

	        if (_node.options.mass > 0) {
	          if (x < minX) {
	            minX = x;
	          }

	          if (x > maxX) {
	            maxX = x;
	          }

	          if (y < minY) {
	            minY = y;
	          }

	          if (y > maxY) {
	            maxY = y;
	          }
	        }
	      } // make the range a square


	      var sizeDiff = Math.abs(maxX - minX) - Math.abs(maxY - minY); // difference between X and Y

	      if (sizeDiff > 0) {
	        minY -= 0.5 * sizeDiff;
	        maxY += 0.5 * sizeDiff;
	      } // xSize > ySize
	      else {
	          minX += 0.5 * sizeDiff;
	          maxX -= 0.5 * sizeDiff;
	        } // xSize < ySize


	      var minimumTreeSize = 1e-5;
	      var rootSize = Math.max(minimumTreeSize, Math.abs(maxX - minX));
	      var halfRootSize = 0.5 * rootSize;
	      var centerX = 0.5 * (minX + maxX),
	          centerY = 0.5 * (minY + maxY); // construct the barnesHutTree

	      var barnesHutTree = {
	        root: {
	          centerOfMass: {
	            x: 0,
	            y: 0
	          },
	          mass: 0,
	          range: {
	            minX: centerX - halfRootSize,
	            maxX: centerX + halfRootSize,
	            minY: centerY - halfRootSize,
	            maxY: centerY + halfRootSize
	          },
	          size: rootSize,
	          calcSize: 1 / rootSize,
	          children: {
	            data: null
	          },
	          maxWidth: 0,
	          level: 0,
	          childrenCount: 4
	        }
	      };

	      this._splitBranch(barnesHutTree.root); // place the nodes one by one recursively


	      for (var _i = 0; _i < nodeCount; _i++) {
	        node = nodes[nodeIndices[_i]];

	        if (node.options.mass > 0) {
	          this._placeInTree(barnesHutTree.root, node);
	        }
	      } // make global


	      return barnesHutTree;
	    }
	    /**
	     * this updates the mass of a branch. this is increased by adding a node.
	     *
	     * @param {Object} parentBranch
	     * @param {Node} node
	     * @private
	     */

	  }, {
	    key: "_updateBranchMass",
	    value: function _updateBranchMass(parentBranch, node) {
	      var centerOfMass = parentBranch.centerOfMass;
	      var totalMass = parentBranch.mass + node.options.mass;
	      var totalMassInv = 1 / totalMass;
	      centerOfMass.x = centerOfMass.x * parentBranch.mass + node.x * node.options.mass;
	      centerOfMass.x *= totalMassInv;
	      centerOfMass.y = centerOfMass.y * parentBranch.mass + node.y * node.options.mass;
	      centerOfMass.y *= totalMassInv;
	      parentBranch.mass = totalMass;
	      var biggestSize = Math.max(Math.max(node.height, node.radius), node.width);
	      parentBranch.maxWidth = parentBranch.maxWidth < biggestSize ? biggestSize : parentBranch.maxWidth;
	    }
	    /**
	     * determine in which branch the node will be placed.
	     *
	     * @param {Object} parentBranch
	     * @param {Node} node
	     * @param {boolean} skipMassUpdate
	     * @private
	     */

	  }, {
	    key: "_placeInTree",
	    value: function _placeInTree(parentBranch, node, skipMassUpdate) {
	      if (skipMassUpdate != true || skipMassUpdate === undefined) {
	        // update the mass of the branch.
	        this._updateBranchMass(parentBranch, node);
	      }

	      var range = parentBranch.children.NW.range;
	      var region;

	      if (range.maxX > node.x) {
	        // in NW or SW
	        if (range.maxY > node.y) {
	          region = "NW";
	        } else {
	          region = "SW";
	        }
	      } else {
	        // in NE or SE
	        if (range.maxY > node.y) {
	          region = "NE";
	        } else {
	          region = "SE";
	        }
	      }

	      this._placeInRegion(parentBranch, node, region);
	    }
	    /**
	     * actually place the node in a region (or branch)
	     *
	     * @param {Object} parentBranch
	     * @param {Node} node
	     * @param {'NW'| 'NE' | 'SW' | 'SE'} region
	     * @private
	     */

	  }, {
	    key: "_placeInRegion",
	    value: function _placeInRegion(parentBranch, node, region) {
	      var children = parentBranch.children[region];

	      switch (children.childrenCount) {
	        case 0:
	          // place node here
	          children.children.data = node;
	          children.childrenCount = 1;

	          this._updateBranchMass(children, node);

	          break;

	        case 1:
	          // convert into children
	          // if there are two nodes exactly overlapping (on init, on opening of cluster etc.)
	          // we move one node a little bit and we do not put it in the tree.
	          if (children.children.data.x === node.x && children.children.data.y === node.y) {
	            node.x += this.seededRandom();
	            node.y += this.seededRandom();
	          } else {
	            this._splitBranch(children);

	            this._placeInTree(children, node);
	          }

	          break;

	        case 4:
	          // place in branch
	          this._placeInTree(children, node);

	          break;
	      }
	    }
	    /**
	     * this function splits a branch into 4 sub branches. If the branch contained a node, we place it in the subbranch
	     * after the split is complete.
	     *
	     * @param {Object} parentBranch
	     * @private
	     */

	  }, {
	    key: "_splitBranch",
	    value: function _splitBranch(parentBranch) {
	      // if the branch is shaded with a node, replace the node in the new subset.
	      var containedNode = null;

	      if (parentBranch.childrenCount === 1) {
	        containedNode = parentBranch.children.data;
	        parentBranch.mass = 0;
	        parentBranch.centerOfMass.x = 0;
	        parentBranch.centerOfMass.y = 0;
	      }

	      parentBranch.childrenCount = 4;
	      parentBranch.children.data = null;

	      this._insertRegion(parentBranch, "NW");

	      this._insertRegion(parentBranch, "NE");

	      this._insertRegion(parentBranch, "SW");

	      this._insertRegion(parentBranch, "SE");

	      if (containedNode != null) {
	        this._placeInTree(parentBranch, containedNode);
	      }
	    }
	    /**
	     * This function subdivides the region into four new segments.
	     * Specifically, this inserts a single new segment.
	     * It fills the children section of the parentBranch
	     *
	     * @param {Object} parentBranch
	     * @param {'NW'| 'NE' | 'SW' | 'SE'} region
	     * @private
	     */

	  }, {
	    key: "_insertRegion",
	    value: function _insertRegion(parentBranch, region) {
	      var minX, maxX, minY, maxY;
	      var childSize = 0.5 * parentBranch.size;

	      switch (region) {
	        case "NW":
	          minX = parentBranch.range.minX;
	          maxX = parentBranch.range.minX + childSize;
	          minY = parentBranch.range.minY;
	          maxY = parentBranch.range.minY + childSize;
	          break;

	        case "NE":
	          minX = parentBranch.range.minX + childSize;
	          maxX = parentBranch.range.maxX;
	          minY = parentBranch.range.minY;
	          maxY = parentBranch.range.minY + childSize;
	          break;

	        case "SW":
	          minX = parentBranch.range.minX;
	          maxX = parentBranch.range.minX + childSize;
	          minY = parentBranch.range.minY + childSize;
	          maxY = parentBranch.range.maxY;
	          break;

	        case "SE":
	          minX = parentBranch.range.minX + childSize;
	          maxX = parentBranch.range.maxX;
	          minY = parentBranch.range.minY + childSize;
	          maxY = parentBranch.range.maxY;
	          break;
	      }

	      parentBranch.children[region] = {
	        centerOfMass: {
	          x: 0,
	          y: 0
	        },
	        mass: 0,
	        range: {
	          minX: minX,
	          maxX: maxX,
	          minY: minY,
	          maxY: maxY
	        },
	        size: 0.5 * parentBranch.size,
	        calcSize: 2 * parentBranch.calcSize,
	        children: {
	          data: null
	        },
	        maxWidth: 0,
	        level: parentBranch.level + 1,
	        childrenCount: 0
	      };
	    } //---------------------------  DEBUGGING BELOW  ---------------------------//

	    /**
	     * This function is for debugging purposed, it draws the tree.
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {string} color
	     * @private
	     */

	  }, {
	    key: "_debug",
	    value: function _debug(ctx, color) {
	      if (this.barnesHutTree !== undefined) {
	        ctx.lineWidth = 1;

	        this._drawBranch(this.barnesHutTree.root, ctx, color);
	      }
	    }
	    /**
	     * This function is for debugging purposes. It draws the branches recursively.
	     *
	     * @param {Object} branch
	     * @param {CanvasRenderingContext2D} ctx
	     * @param {string} color
	     * @private
	     */

	  }, {
	    key: "_drawBranch",
	    value: function _drawBranch(branch, ctx, color) {
	      if (color === undefined) {
	        color = "#FF0000";
	      }

	      if (branch.childrenCount === 4) {
	        this._drawBranch(branch.children.NW, ctx);

	        this._drawBranch(branch.children.NE, ctx);

	        this._drawBranch(branch.children.SE, ctx);

	        this._drawBranch(branch.children.SW, ctx);
	      }

	      ctx.strokeStyle = color;
	      ctx.beginPath();
	      ctx.moveTo(branch.range.minX, branch.range.minY);
	      ctx.lineTo(branch.range.maxX, branch.range.minY);
	      ctx.stroke();
	      ctx.beginPath();
	      ctx.moveTo(branch.range.maxX, branch.range.minY);
	      ctx.lineTo(branch.range.maxX, branch.range.maxY);
	      ctx.stroke();
	      ctx.beginPath();
	      ctx.moveTo(branch.range.maxX, branch.range.maxY);
	      ctx.lineTo(branch.range.minX, branch.range.maxY);
	      ctx.stroke();
	      ctx.beginPath();
	      ctx.moveTo(branch.range.minX, branch.range.maxY);
	      ctx.lineTo(branch.range.minX, branch.range.minY);
	      ctx.stroke();
	      /*
	       if (branch.mass > 0) {
	       ctx.circle(branch.centerOfMass.x, branch.centerOfMass.y, 3*branch.mass);
	       ctx.stroke();
	       }
	       */
	    }
	  }]);

	  return BarnesHutSolver;
	}();

	/**
	 * Repulsion Solver
	 */
	var RepulsionSolver =
	/*#__PURE__*/
	function () {
	  /**
	   * @param {Object} body
	   * @param {{physicsNodeIndices: Array, physicsEdgeIndices: Array, forces: {}, velocities: {}}} physicsBody
	   * @param {Object} options
	   */
	  function RepulsionSolver(body, physicsBody, options) {
	    classCallCheck(this, RepulsionSolver);

	    this.body = body;
	    this.physicsBody = physicsBody;
	    this.setOptions(options);
	  }
	  /**
	   *
	   * @param {Object} options
	   */


	  createClass(RepulsionSolver, [{
	    key: "setOptions",
	    value: function setOptions(options) {
	      this.options = options;
	    }
	    /**
	     * Calculate the forces the nodes apply on each other based on a repulsion field.
	     * This field is linearly approximated.
	     *
	     * @private
	     */

	  }, {
	    key: "solve",
	    value: function solve() {
	      var dx, dy, distance, fx, fy, repulsingForce, node1, node2;
	      var nodes = this.body.nodes;
	      var nodeIndices = this.physicsBody.physicsNodeIndices;
	      var forces = this.physicsBody.forces; // repulsing forces between nodes

	      var nodeDistance = this.options.nodeDistance; // approximation constants

	      var a = -2 / 3 / nodeDistance;
	      var b = 4 / 3; // we loop from i over all but the last entree in the array
	      // j loops from i+1 to the last. This way we do not double count any of the indices, nor i === j

	      for (var i = 0; i < nodeIndices.length - 1; i++) {
	        node1 = nodes[nodeIndices[i]];

	        for (var j = i + 1; j < nodeIndices.length; j++) {
	          node2 = nodes[nodeIndices[j]];
	          dx = node2.x - node1.x;
	          dy = node2.y - node1.y;
	          distance = Math.sqrt(dx * dx + dy * dy); // same condition as BarnesHutSolver, making sure nodes are never 100% overlapping.

	          if (distance === 0) {
	            distance = 0.1 * Math.random();
	            dx = distance;
	          }

	          if (distance < 2 * nodeDistance) {
	            if (distance < 0.5 * nodeDistance) {
	              repulsingForce = 1.0;
	            } else {
	              repulsingForce = a * distance + b; // linear approx of  1 / (1 + Math.exp((distance / nodeDistance - 1) * steepness))
	            }

	            repulsingForce = repulsingForce / distance;
	            fx = dx * repulsingForce;
	            fy = dy * repulsingForce;
	            forces[node1.id].x -= fx;
	            forces[node1.id].y -= fy;
	            forces[node2.id].x += fx;
	            forces[node2.id].y += fy;
	          }
	        }
	      }
	    }
	  }]);

	  return RepulsionSolver;
	}();

	function _readOnlyError(name) {
	  throw new Error("\"" + name + "\" is read-only");
	}

	var readOnlyError = _readOnlyError;

	/**
	 * Hierarchical Repulsion Solver
	 */
	var HierarchicalRepulsionSolver =
	/*#__PURE__*/
	function () {
	  /**
	   * @param {Object} body
	   * @param {{physicsNodeIndices: Array, physicsEdgeIndices: Array, forces: {}, velocities: {}}} physicsBody
	   * @param {Object} options
	   */
	  function HierarchicalRepulsionSolver(body, physicsBody, options) {
	    classCallCheck(this, HierarchicalRepulsionSolver);

	    this.body = body;
	    this.physicsBody = physicsBody;
	    this.setOptions(options);
	  }
	  /**
	   *
	   * @param {Object} options
	   */


	  createClass(HierarchicalRepulsionSolver, [{
	    key: "setOptions",
	    value: function setOptions(options) {
	      this.options = options;
	      this.overlapAvoidanceFactor = Math.max(0, Math.min(1, this.options.avoidOverlap || 0));
	    }
	    /**
	     * Calculate the forces the nodes apply on each other based on a repulsion field.
	     * This field is linearly approximated.
	     *
	     * @private
	     */

	  }, {
	    key: "solve",
	    value: function solve() {
	      var nodes = this.body.nodes;
	      var nodeIndices = this.physicsBody.physicsNodeIndices;
	      var forces = this.physicsBody.forces; // repulsing forces between nodes

	      var nodeDistance = this.options.nodeDistance; // we loop from i over all but the last entree in the array
	      // j loops from i+1 to the last. This way we do not double count any of the indices, nor i === j

	      for (var i = 0; i < nodeIndices.length - 1; i++) {
	        var node1 = nodes[nodeIndices[i]];

	        for (var j = i + 1; j < nodeIndices.length; j++) {
	          var node2 = nodes[nodeIndices[j]]; // nodes only affect nodes on their level

	          if (node1.level === node2.level) {
	            var theseNodesDistance = nodeDistance + this.overlapAvoidanceFactor * ((node1.shape.radius || 0) / 2 + (node2.shape.radius || 0) / 2);
	            var dx = node2.x - node1.x;
	            var dy = node2.y - node1.y;
	            var distance = Math.sqrt(dx * dx + dy * dy);
	            var steepness = 0.05;
	            var repulsingForce = void 0;

	            if (distance < theseNodesDistance) {
	              repulsingForce = -Math.pow(steepness * distance, 2) + Math.pow(steepness * theseNodesDistance, 2);
	            } else {
	              repulsingForce = 0;
	            } // normalize force with


	            if (distance === 0) {
	              distance = (readOnlyError("distance"), 0.01);
	            } else {
	              repulsingForce = repulsingForce / distance;
	            }

	            var fx = dx * repulsingForce;
	            var fy = dy * repulsingForce;
	            forces[node1.id].x -= fx;
	            forces[node1.id].y -= fy;
	            forces[node2.id].x += fx;
	            forces[node2.id].y += fy;
	          }
	        }
	      }
	    }
	  }]);

	  return HierarchicalRepulsionSolver;
	}();

	/**
	 * Spring Solver
	 */
	var SpringSolver =
	/*#__PURE__*/
	function () {
	  /**
	   * @param {Object} body
	   * @param {{physicsNodeIndices: Array, physicsEdgeIndices: Array, forces: {}, velocities: {}}} physicsBody
	   * @param {Object} options
	   */
	  function SpringSolver(body, physicsBody, options) {
	    classCallCheck(this, SpringSolver);

	    this.body = body;
	    this.physicsBody = physicsBody;
	    this.setOptions(options);
	  }
	  /**
	   *
	   * @param {Object} options
	   */


	  createClass(SpringSolver, [{
	    key: "setOptions",
	    value: function setOptions(options) {
	      this.options = options;
	    }
	    /**
	     * This function calculates the springforces on the nodes, accounting for the support nodes.
	     *
	     * @private
	     */

	  }, {
	    key: "solve",
	    value: function solve() {
	      var edgeLength, edge;
	      var edgeIndices = this.physicsBody.physicsEdgeIndices;
	      var edges = this.body.edges;
	      var node1, node2, node3; // forces caused by the edges, modelled as springs

	      for (var i = 0; i < edgeIndices.length; i++) {
	        edge = edges[edgeIndices[i]];

	        if (edge.connected === true && edge.toId !== edge.fromId) {
	          // only calculate forces if nodes are in the same sector
	          if (this.body.nodes[edge.toId] !== undefined && this.body.nodes[edge.fromId] !== undefined) {
	            if (edge.edgeType.via !== undefined) {
	              edgeLength = edge.options.length === undefined ? this.options.springLength : edge.options.length;
	              node1 = edge.to;
	              node2 = edge.edgeType.via;
	              node3 = edge.from;

	              this._calculateSpringForce(node1, node2, 0.5 * edgeLength);

	              this._calculateSpringForce(node2, node3, 0.5 * edgeLength);
	            } else {
	              // the * 1.5 is here so the edge looks as large as a smooth edge. It does not initially because the smooth edges use
	              // the support nodes which exert a repulsive force on the to and from nodes, making the edge appear larger.
	              edgeLength = edge.options.length === undefined ? this.options.springLength * 1.5 : edge.options.length;

	              this._calculateSpringForce(edge.from, edge.to, edgeLength);
	            }
	          }
	        }
	      }
	    }
	    /**
	     * This is the code actually performing the calculation for the function above.
	     *
	     * @param {Node} node1
	     * @param {Node} node2
	     * @param {number} edgeLength
	     * @private
	     */

	  }, {
	    key: "_calculateSpringForce",
	    value: function _calculateSpringForce(node1, node2, edgeLength) {
	      var dx = node1.x - node2.x;
	      var dy = node1.y - node2.y;
	      var distance = Math.max(Math.sqrt(dx * dx + dy * dy), 0.01); // the 1/distance is so the fx and fy can be calculated without sine or cosine.

	      var springForce = this.options.springConstant * (edgeLength - distance) / distance;
	      var fx = dx * springForce;
	      var fy = dy * springForce; // handle the case where one node is not part of the physcis

	      if (this.physicsBody.forces[node1.id] !== undefined) {
	        this.physicsBody.forces[node1.id].x += fx;
	        this.physicsBody.forces[node1.id].y += fy;
	      }

	      if (this.physicsBody.forces[node2.id] !== undefined) {
	        this.physicsBody.forces[node2.id].x -= fx;
	        this.physicsBody.forces[node2.id].y -= fy;
	      }
	    }
	  }]);

	  return SpringSolver;
	}();

	/**
	 * Hierarchical Spring Solver
	 */
	var HierarchicalSpringSolver =
	/*#__PURE__*/
	function () {
	  /**
	   * @param {Object} body
	   * @param {{physicsNodeIndices: Array, physicsEdgeIndices: Array, forces: {}, velocities: {}}} physicsBody
	   * @param {Object} options
	   */
	  function HierarchicalSpringSolver(body, physicsBody, options) {
	    classCallCheck(this, HierarchicalSpringSolver);

	    this.body = body;
	    this.physicsBody = physicsBody;
	    this.setOptions(options);
	  }
	  /**
	   *
	   * @param {Object} options
	   */


	  createClass(HierarchicalSpringSolver, [{
	    key: "setOptions",
	    value: function setOptions(options) {
	      this.options = options;
	    }
	    /**
	     * This function calculates the springforces on the nodes, accounting for the support nodes.
	     *
	     * @private
	     */

	  }, {
	    key: "solve",
	    value: function solve() {
	      var edgeLength, edge;
	      var dx, dy, fx, fy, springForce, distance;
	      var edges = this.body.edges;
	      var factor = 0.5;
	      var edgeIndices = this.physicsBody.physicsEdgeIndices;
	      var nodeIndices = this.physicsBody.physicsNodeIndices;
	      var forces = this.physicsBody.forces; // initialize the spring force counters

	      for (var i = 0; i < nodeIndices.length; i++) {
	        var nodeId = nodeIndices[i];
	        forces[nodeId].springFx = 0;
	        forces[nodeId].springFy = 0;
	      } // forces caused by the edges, modelled as springs


	      for (var _i = 0; _i < edgeIndices.length; _i++) {
	        edge = edges[edgeIndices[_i]];

	        if (edge.connected === true) {
	          edgeLength = edge.options.length === undefined ? this.options.springLength : edge.options.length;
	          dx = edge.from.x - edge.to.x;
	          dy = edge.from.y - edge.to.y;
	          distance = Math.sqrt(dx * dx + dy * dy);
	          distance = distance === 0 ? 0.01 : distance; // the 1/distance is so the fx and fy can be calculated without sine or cosine.

	          springForce = this.options.springConstant * (edgeLength - distance) / distance;
	          fx = dx * springForce;
	          fy = dy * springForce;

	          if (edge.to.level != edge.from.level) {
	            if (forces[edge.toId] !== undefined) {
	              forces[edge.toId].springFx -= fx;
	              forces[edge.toId].springFy -= fy;
	            }

	            if (forces[edge.fromId] !== undefined) {
	              forces[edge.fromId].springFx += fx;
	              forces[edge.fromId].springFy += fy;
	            }
	          } else {
	            if (forces[edge.toId] !== undefined) {
	              forces[edge.toId].x -= factor * fx;
	              forces[edge.toId].y -= factor * fy;
	            }

	            if (forces[edge.fromId] !== undefined) {
	              forces[edge.fromId].x += factor * fx;
	              forces[edge.fromId].y += factor * fy;
	            }
	          }
	        }
	      } // normalize spring forces


	      springForce = 1;
	      var springFx, springFy;

	      for (var _i2 = 0; _i2 < nodeIndices.length; _i2++) {
	        var _nodeId = nodeIndices[_i2];
	        springFx = Math.min(springForce, Math.max(-springForce, forces[_nodeId].springFx));
	        springFy = Math.min(springForce, Math.max(-springForce, forces[_nodeId].springFy));
	        forces[_nodeId].x += springFx;
	        forces[_nodeId].y += springFy;
	      } // retain energy balance


	      var totalFx = 0;
	      var totalFy = 0;

	      for (var _i3 = 0; _i3 < nodeIndices.length; _i3++) {
	        var _nodeId2 = nodeIndices[_i3];
	        totalFx += forces[_nodeId2].x;
	        totalFy += forces[_nodeId2].y;
	      }

	      var correctionFx = totalFx / nodeIndices.length;
	      var correctionFy = totalFy / nodeIndices.length;

	      for (var _i4 = 0; _i4 < nodeIndices.length; _i4++) {
	        var _nodeId3 = nodeIndices[_i4];
	        forces[_nodeId3].x -= correctionFx;
	        forces[_nodeId3].y -= correctionFy;
	      }
	    }
	  }]);

	  return HierarchicalSpringSolver;
	}();

	/**
	 * Central Gravity Solver
	 */
	var CentralGravitySolver =
	/*#__PURE__*/
	function () {
	  /**
	   * @param {Object} body
	   * @param {{physicsNodeIndices: Array, physicsEdgeIndices: Array, forces: {}, velocities: {}}} physicsBody
	   * @param {Object} options
	   */
	  function CentralGravitySolver(body, physicsBody, options) {
	    classCallCheck(this, CentralGravitySolver);

	    this.body = body;
	    this.physicsBody = physicsBody;
	    this.setOptions(options);
	  }
	  /**
	   *
	   * @param {Object} options
	   */


	  createClass(CentralGravitySolver, [{
	    key: "setOptions",
	    value: function setOptions(options) {
	      this.options = options;
	    }
	    /**
	     * Calculates forces for each node
	     */

	  }, {
	    key: "solve",
	    value: function solve() {
	      var dx, dy, distance, node;
	      var nodes = this.body.nodes;
	      var nodeIndices = this.physicsBody.physicsNodeIndices;
	      var forces = this.physicsBody.forces;

	      for (var i = 0; i < nodeIndices.length; i++) {
	        var nodeId = nodeIndices[i];
	        node = nodes[nodeId];
	        dx = -node.x;
	        dy = -node.y;
	        distance = Math.sqrt(dx * dx + dy * dy);

	        this._calculateForces(distance, dx, dy, forces, node);
	      }
	    }
	    /**
	     * Calculate the forces based on the distance.
	     * @param {number} distance
	     * @param {number} dx
	     * @param {number} dy
	     * @param {Object<Node.id, vis.Node>} forces
	     * @param {Node} node
	     * @private
	     */

	  }, {
	    key: "_calculateForces",
	    value: function _calculateForces(distance, dx, dy, forces, node) {
	      var gravityForce = distance === 0 ? 0 : this.options.centralGravity / distance;
	      forces[node.id].x = dx * gravityForce;
	      forces[node.id].y = dy * gravityForce;
	    }
	  }]);

	  return CentralGravitySolver;
	}();

	/**
	 * @extends BarnesHutSolver
	 */

	var ForceAtlas2BasedRepulsionSolver =
	/*#__PURE__*/
	function (_BarnesHutSolver) {
	  inherits$1(ForceAtlas2BasedRepulsionSolver, _BarnesHutSolver);

	  /**
	   * @param {Object} body
	   * @param {{physicsNodeIndices: Array, physicsEdgeIndices: Array, forces: {}, velocities: {}}} physicsBody
	   * @param {Object} options
	   */
	  function ForceAtlas2BasedRepulsionSolver(body, physicsBody, options) {
	    classCallCheck(this, ForceAtlas2BasedRepulsionSolver);

	    return possibleConstructorReturn$1(this, getPrototypeOf$7(ForceAtlas2BasedRepulsionSolver).call(this, body, physicsBody, options));
	  }
	  /**
	   * Calculate the forces based on the distance.
	   *
	   * @param {number} distance
	   * @param {number} dx
	   * @param {number} dy
	   * @param {Node} node
	   * @param {Object} parentBranch
	   * @private
	   */


	  createClass(ForceAtlas2BasedRepulsionSolver, [{
	    key: "_calculateForces",
	    value: function _calculateForces(distance, dx, dy, node, parentBranch) {
	      if (distance === 0) {
	        distance = 0.1 * Math.random();
	        dx = distance;
	      }

	      if (this.overlapAvoidanceFactor < 1 && node.shape.radius) {
	        distance = Math.max(0.1 + this.overlapAvoidanceFactor * node.shape.radius, distance - node.shape.radius);
	      }

	      var degree = node.edges.length + 1; // the dividing by the distance cubed instead of squared allows us to get the fx and fy components without sines and cosines
	      // it is shorthand for gravityforce with distance squared and fx = dx/distance * gravityForce

	      var gravityForce = this.options.gravitationalConstant * parentBranch.mass * node.options.mass * degree / Math.pow(distance, 2);
	      var fx = dx * gravityForce;
	      var fy = dy * gravityForce;
	      this.physicsBody.forces[node.id].x += fx;
	      this.physicsBody.forces[node.id].y += fy;
	    }
	  }]);

	  return ForceAtlas2BasedRepulsionSolver;
	}(BarnesHutSolver);

	/**
	 * @extends CentralGravitySolver
	 */

	var ForceAtlas2BasedCentralGravitySolver =
	/*#__PURE__*/
	function (_CentralGravitySolver) {
	  inherits$1(ForceAtlas2BasedCentralGravitySolver, _CentralGravitySolver);

	  /**
	   * @param {Object} body
	   * @param {{physicsNodeIndices: Array, physicsEdgeIndices: Array, forces: {}, velocities: {}}} physicsBody
	   * @param {Object} options
	   */
	  function ForceAtlas2BasedCentralGravitySolver(body, physicsBody, options) {
	    classCallCheck(this, ForceAtlas2BasedCentralGravitySolver);

	    return possibleConstructorReturn$1(this, getPrototypeOf$7(ForceAtlas2BasedCentralGravitySolver).call(this, body, physicsBody, options));
	  }
	  /**
	   * Calculate the forces based on the distance.
	   *
	   * @param {number} distance
	   * @param {number} dx
	   * @param {number} dy
	   * @param {Object<Node.id, Node>} forces
	   * @param {Node} node
	   * @private
	   */


	  createClass(ForceAtlas2BasedCentralGravitySolver, [{
	    key: "_calculateForces",
	    value: function _calculateForces(distance, dx, dy, forces, node) {
	      if (distance > 0) {
	        var degree = node.edges.length + 1;
	        var gravityForce = this.options.centralGravity * degree * node.options.mass;
	        forces[node.id].x = dx * gravityForce;
	        forces[node.id].y = dy * gravityForce;
	      }
	    }
	  }]);

	  return ForceAtlas2BasedCentralGravitySolver;
	}(CentralGravitySolver);

	/**
	 * The physics engine
	 */

	var PhysicsEngine =
	/*#__PURE__*/
	function () {
	  /**
	   * @param {Object} body
	   */
	  function PhysicsEngine(body) {
	    classCallCheck(this, PhysicsEngine);

	    this.body = body;
	    this.physicsBody = {
	      physicsNodeIndices: [],
	      physicsEdgeIndices: [],
	      forces: {},
	      velocities: {}
	    };
	    this.physicsEnabled = true;
	    this.simulationInterval = 1000 / 60;
	    this.requiresTimeout = true;
	    this.previousStates = {};
	    this.referenceState = {};
	    this.freezeCache = {};
	    this.renderTimer = undefined; // parameters for the adaptive timestep

	    this.adaptiveTimestep = false;
	    this.adaptiveTimestepEnabled = false;
	    this.adaptiveCounter = 0;
	    this.adaptiveInterval = 3;
	    this.stabilized = false;
	    this.startedStabilization = false;
	    this.stabilizationIterations = 0;
	    this.ready = false; // will be set to true if the stabilize
	    // default options

	    this.options = {};
	    this.defaultOptions = {
	      enabled: true,
	      barnesHut: {
	        theta: 0.5,
	        gravitationalConstant: -2000,
	        centralGravity: 0.3,
	        springLength: 95,
	        springConstant: 0.04,
	        damping: 0.09,
	        avoidOverlap: 0
	      },
	      forceAtlas2Based: {
	        theta: 0.5,
	        gravitationalConstant: -50,
	        centralGravity: 0.01,
	        springConstant: 0.08,
	        springLength: 100,
	        damping: 0.4,
	        avoidOverlap: 0
	      },
	      repulsion: {
	        centralGravity: 0.2,
	        springLength: 200,
	        springConstant: 0.05,
	        nodeDistance: 100,
	        damping: 0.09,
	        avoidOverlap: 0
	      },
	      hierarchicalRepulsion: {
	        centralGravity: 0.0,
	        springLength: 100,
	        springConstant: 0.01,
	        nodeDistance: 120,
	        damping: 0.09
	      },
	      maxVelocity: 50,
	      minVelocity: 0.75,
	      // px/s
	      solver: 'barnesHut',
	      stabilization: {
	        enabled: true,
	        iterations: 1000,
	        // maximum number of iteration to stabilize
	        updateInterval: 50,
	        onlyDynamicEdges: false,
	        fit: true
	      },
	      timestep: 0.5,
	      adaptiveTimestep: true
	    };
	    extend(this.options, this.defaultOptions);
	    this.timestep = 0.5;
	    this.layoutFailed = false;
	    this.bindEventListeners();
	  }
	  /**
	   * Binds event listeners
	   */


	  createClass(PhysicsEngine, [{
	    key: "bindEventListeners",
	    value: function bindEventListeners() {
	      var _this = this;

	      this.body.emitter.on('initPhysics', function () {
	        _this.initPhysics();
	      });
	      this.body.emitter.on('_layoutFailed', function () {
	        _this.layoutFailed = true;
	      });
	      this.body.emitter.on('resetPhysics', function () {
	        _this.stopSimulation();

	        _this.ready = false;
	      });
	      this.body.emitter.on('disablePhysics', function () {
	        _this.physicsEnabled = false;

	        _this.stopSimulation();
	      });
	      this.body.emitter.on('restorePhysics', function () {
	        _this.setOptions(_this.options);

	        if (_this.ready === true) {
	          _this.startSimulation();
	        }
	      });
	      this.body.emitter.on('startSimulation', function () {
	        if (_this.ready === true) {
	          _this.startSimulation();
	        }
	      });
	      this.body.emitter.on('stopSimulation', function () {
	        _this.stopSimulation();
	      });
	      this.body.emitter.on('destroy', function () {
	        _this.stopSimulation(false);

	        _this.body.emitter.off();
	      });
	      this.body.emitter.on("_dataChanged", function () {
	        // Nodes and/or edges have been added or removed, update shortcut lists.
	        _this.updatePhysicsData();
	      }); // debug: show forces
	      // this.body.emitter.on("afterDrawing", (ctx) => {this._drawForces(ctx);});
	    }
	    /**
	     * set the physics options
	     * @param {Object} options
	     */

	  }, {
	    key: "setOptions",
	    value: function setOptions(options) {
	      if (options !== undefined) {
	        if (options === false) {
	          this.options.enabled = false;
	          this.physicsEnabled = false;
	          this.stopSimulation();
	        } else if (options === true) {
	          this.options.enabled = true;
	          this.physicsEnabled = true;
	          this.startSimulation();
	        } else {
	          this.physicsEnabled = true;
	          selectiveNotDeepExtend(['stabilization'], this.options, options);
	          mergeOptions(this.options, options, 'stabilization');

	          if (options.enabled === undefined) {
	            this.options.enabled = true;
	          }

	          if (this.options.enabled === false) {
	            this.physicsEnabled = false;
	            this.stopSimulation();
	          } // set the timestep


	          this.timestep = this.options.timestep;
	        }
	      }

	      this.init();
	    }
	    /**
	     * configure the engine.
	     */

	  }, {
	    key: "init",
	    value: function init() {
	      var options;

	      if (this.options.solver === 'forceAtlas2Based') {
	        options = this.options.forceAtlas2Based;
	        this.nodesSolver = new ForceAtlas2BasedRepulsionSolver(this.body, this.physicsBody, options);
	        this.edgesSolver = new SpringSolver(this.body, this.physicsBody, options);
	        this.gravitySolver = new ForceAtlas2BasedCentralGravitySolver(this.body, this.physicsBody, options);
	      } else if (this.options.solver === 'repulsion') {
	        options = this.options.repulsion;
	        this.nodesSolver = new RepulsionSolver(this.body, this.physicsBody, options);
	        this.edgesSolver = new SpringSolver(this.body, this.physicsBody, options);
	        this.gravitySolver = new CentralGravitySolver(this.body, this.physicsBody, options);
	      } else if (this.options.solver === 'hierarchicalRepulsion') {
	        options = this.options.hierarchicalRepulsion;
	        this.nodesSolver = new HierarchicalRepulsionSolver(this.body, this.physicsBody, options);
	        this.edgesSolver = new HierarchicalSpringSolver(this.body, this.physicsBody, options);
	        this.gravitySolver = new CentralGravitySolver(this.body, this.physicsBody, options);
	      } else {
	        // barnesHut
	        options = this.options.barnesHut;
	        this.nodesSolver = new BarnesHutSolver(this.body, this.physicsBody, options);
	        this.edgesSolver = new SpringSolver(this.body, this.physicsBody, options);
	        this.gravitySolver = new CentralGravitySolver(this.body, this.physicsBody, options);
	      }

	      this.modelOptions = options;
	    }
	    /**
	     * initialize the engine
	     */

	  }, {
	    key: "initPhysics",
	    value: function initPhysics() {
	      if (this.physicsEnabled === true && this.options.enabled === true) {
	        if (this.options.stabilization.enabled === true) {
	          this.stabilize();
	        } else {
	          this.stabilized = false;
	          this.ready = true;
	          this.body.emitter.emit('fit', {}, this.layoutFailed); // if the layout failed, we use the approximation for the zoom

	          this.startSimulation();
	        }
	      } else {
	        this.ready = true;
	        this.body.emitter.emit('fit');
	      }
	    }
	    /**
	     * Start the simulation
	     */

	  }, {
	    key: "startSimulation",
	    value: function startSimulation() {
	      if (this.physicsEnabled === true && this.options.enabled === true) {
	        this.stabilized = false; // when visible, adaptivity is disabled.

	        this.adaptiveTimestep = false; // this sets the width of all nodes initially which could be required for the avoidOverlap

	        this.body.emitter.emit("_resizeNodes");

	        if (this.viewFunction === undefined) {
	          var _context;

	          this.viewFunction = bind$2(_context = this.simulationStep).call(_context, this);
	          this.body.emitter.on('initRedraw', this.viewFunction);
	          this.body.emitter.emit('_startRendering');
	        }
	      } else {
	        this.body.emitter.emit('_redraw');
	      }
	    }
	    /**
	     * Stop the simulation, force stabilization.
	     * @param {boolean} [emit=true]
	     */

	  }, {
	    key: "stopSimulation",
	    value: function stopSimulation() {
	      var emit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
	      this.stabilized = true;

	      if (emit === true) {
	        this._emitStabilized();
	      }

	      if (this.viewFunction !== undefined) {
	        this.body.emitter.off('initRedraw', this.viewFunction);
	        this.viewFunction = undefined;

	        if (emit === true) {
	          this.body.emitter.emit('_stopRendering');
	        }
	      }
	    }
	    /**
	     * The viewFunction inserts this step into each render loop. It calls the physics tick and handles the cleanup at stabilized.
	     *
	     */

	  }, {
	    key: "simulationStep",
	    value: function simulationStep() {
	      // check if the physics have settled
	      var startTime = now$2();

	      this.physicsTick();
	      var physicsTime = now$2() - startTime; // run double speed if it is a little graph

	      if ((physicsTime < 0.4 * this.simulationInterval || this.runDoubleSpeed === true) && this.stabilized === false) {
	        this.physicsTick(); // this makes sure there is no jitter. The decision is taken once to run it at double speed.

	        this.runDoubleSpeed = true;
	      }

	      if (this.stabilized === true) {
	        this.stopSimulation();
	      }
	    }
	    /**
	     * trigger the stabilized event.
	     *
	     * @param {number} [amountOfIterations=this.stabilizationIterations]
	     * @private
	     */

	  }, {
	    key: "_emitStabilized",
	    value: function _emitStabilized() {
	      var _this2 = this;

	      var amountOfIterations = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.stabilizationIterations;

	      if (this.stabilizationIterations > 1 || this.startedStabilization === true) {
	        setTimeout$2(function () {
	          _this2.body.emitter.emit('stabilized', {
	            iterations: amountOfIterations
	          });

	          _this2.startedStabilization = false;
	          _this2.stabilizationIterations = 0;
	        }, 0);
	      }
	    }
	    /**
	     * Calculate the forces for one physics iteration and move the nodes.
	     * @private
	     */

	  }, {
	    key: "physicsStep",
	    value: function physicsStep() {
	      this.gravitySolver.solve();
	      this.nodesSolver.solve();
	      this.edgesSolver.solve();
	      this.moveNodes();
	    }
	    /**
	     * Make dynamic adjustments to the timestep, based on current state.
	     *
	     * Helper function for physicsTick().
	     * @private
	     */

	  }, {
	    key: "adjustTimeStep",
	    value: function adjustTimeStep() {
	      var factor = 1.2; // Factor for increasing the timestep on success.
	      // we compare the two steps. if it is acceptable we double the step.

	      if (this._evaluateStepQuality() === true) {
	        this.timestep = factor * this.timestep;
	      } else {
	        // if not, we decrease the step to a minimum of the options timestep.
	        // if the decreased timestep is smaller than the options step, we do not reset the counter
	        // we assume that the options timestep is stable enough.
	        if (this.timestep / factor < this.options.timestep) {
	          this.timestep = this.options.timestep;
	        } else {
	          // if the timestep was larger than 2 times the option one we check the adaptivity again to ensure
	          // that large instabilities do not form.
	          this.adaptiveCounter = -1; // check again next iteration

	          this.timestep = Math.max(this.options.timestep, this.timestep / factor);
	        }
	      }
	    }
	    /**
	     * A single simulation step (or 'tick') in the physics simulation
	     *
	     * @private
	     */

	  }, {
	    key: "physicsTick",
	    value: function physicsTick() {
	      this._startStabilizing(); // this ensures that there is no start event when the network is already stable.


	      if (this.stabilized === true) return; // adaptivity means the timestep adapts to the situation, only applicable for stabilization

	      if (this.adaptiveTimestep === true && this.adaptiveTimestepEnabled === true) {
	        // timestep remains stable for "interval" iterations.
	        var doAdaptive = this.adaptiveCounter % this.adaptiveInterval === 0;

	        if (doAdaptive) {
	          // first the big step and revert.
	          this.timestep = 2 * this.timestep;
	          this.physicsStep();
	          this.revert(); // saves the reference state
	          // now the normal step. Since this is the last step, it is the more stable one and we will take this.

	          this.timestep = 0.5 * this.timestep; // since it's half the step, we do it twice.

	          this.physicsStep();
	          this.physicsStep();
	          this.adjustTimeStep();
	        } else {
	          this.physicsStep(); // normal step, keeping timestep constant
	        }

	        this.adaptiveCounter += 1;
	      } else {
	        // case for the static timestep, we reset it to the one in options and take a normal step.
	        this.timestep = this.options.timestep;
	        this.physicsStep();
	      }

	      if (this.stabilized === true) this.revert();
	      this.stabilizationIterations++;
	    }
	    /**
	     * Nodes and edges can have the physics toggles on or off. A collection of indices is created here so we can skip the check all the time.
	     *
	     * @private
	     */

	  }, {
	    key: "updatePhysicsData",
	    value: function updatePhysicsData() {
	      this.physicsBody.forces = {};
	      this.physicsBody.physicsNodeIndices = [];
	      this.physicsBody.physicsEdgeIndices = [];
	      var nodes = this.body.nodes;
	      var edges = this.body.edges; // get node indices for physics

	      for (var nodeId in nodes) {
	        if (nodes.hasOwnProperty(nodeId)) {
	          if (nodes[nodeId].options.physics === true) {
	            this.physicsBody.physicsNodeIndices.push(nodes[nodeId].id);
	          }
	        }
	      } // get edge indices for physics


	      for (var edgeId in edges) {
	        if (edges.hasOwnProperty(edgeId)) {
	          if (edges[edgeId].options.physics === true) {
	            this.physicsBody.physicsEdgeIndices.push(edges[edgeId].id);
	          }
	        }
	      } // get the velocity and the forces vector


	      for (var i = 0; i < this.physicsBody.physicsNodeIndices.length; i++) {
	        var _nodeId = this.physicsBody.physicsNodeIndices[i];
	        this.physicsBody.forces[_nodeId] = {
	          x: 0,
	          y: 0
	        }; // forces can be reset because they are recalculated. Velocities have to persist.

	        if (this.physicsBody.velocities[_nodeId] === undefined) {
	          this.physicsBody.velocities[_nodeId] = {
	            x: 0,
	            y: 0
	          };
	        }
	      } // clean deleted nodes from the velocity vector


	      for (var _nodeId2 in this.physicsBody.velocities) {
	        if (nodes[_nodeId2] === undefined) {
	          delete this.physicsBody.velocities[_nodeId2];
	        }
	      }
	    }
	    /**
	     * Revert the simulation one step. This is done so after stabilization, every new start of the simulation will also say stabilized.
	     */

	  }, {
	    key: "revert",
	    value: function revert() {
	      var nodeIds = keys$6(this.previousStates);

	      var nodes = this.body.nodes;
	      var velocities = this.physicsBody.velocities;
	      this.referenceState = {};

	      for (var i = 0; i < nodeIds.length; i++) {
	        var nodeId = nodeIds[i];

	        if (nodes[nodeId] !== undefined) {
	          if (nodes[nodeId].options.physics === true) {
	            this.referenceState[nodeId] = {
	              positions: {
	                x: nodes[nodeId].x,
	                y: nodes[nodeId].y
	              }
	            };
	            velocities[nodeId].x = this.previousStates[nodeId].vx;
	            velocities[nodeId].y = this.previousStates[nodeId].vy;
	            nodes[nodeId].x = this.previousStates[nodeId].x;
	            nodes[nodeId].y = this.previousStates[nodeId].y;
	          }
	        } else {
	          delete this.previousStates[nodeId];
	        }
	      }
	    }
	    /**
	     * This compares the reference state to the current state
	     *
	     * @returns {boolean}
	     * @private
	     */

	  }, {
	    key: "_evaluateStepQuality",
	    value: function _evaluateStepQuality() {
	      var dx, dy, dpos;
	      var nodes = this.body.nodes;
	      var reference = this.referenceState;
	      var posThreshold = 0.3;

	      for (var nodeId in this.referenceState) {
	        if (this.referenceState.hasOwnProperty(nodeId) && nodes[nodeId] !== undefined) {
	          dx = nodes[nodeId].x - reference[nodeId].positions.x;
	          dy = nodes[nodeId].y - reference[nodeId].positions.y;
	          dpos = Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2));

	          if (dpos > posThreshold) {
	            return false;
	          }
	        }
	      }

	      return true;
	    }
	    /**
	     * move the nodes one timestep and check if they are stabilized
	     */

	  }, {
	    key: "moveNodes",
	    value: function moveNodes() {
	      var nodeIndices = this.physicsBody.physicsNodeIndices;
	      var maxNodeVelocity = 0;
	      var averageNodeVelocity = 0; // the velocity threshold (energy in the system) for the adaptivity toggle

	      var velocityAdaptiveThreshold = 5;

	      for (var i = 0; i < nodeIndices.length; i++) {
	        var nodeId = nodeIndices[i];

	        var nodeVelocity = this._performStep(nodeId); // stabilized is true if stabilized is true and velocity is smaller than vmin --> all nodes must be stabilized


	        maxNodeVelocity = Math.max(maxNodeVelocity, nodeVelocity);
	        averageNodeVelocity += nodeVelocity;
	      } // evaluating the stabilized and adaptiveTimestepEnabled conditions


	      this.adaptiveTimestepEnabled = averageNodeVelocity / nodeIndices.length < velocityAdaptiveThreshold;
	      this.stabilized = maxNodeVelocity < this.options.minVelocity;
	    }
	    /**
	     * Calculate new velocity for a coordinate direction
	     *
	     * @param {number} v  velocity for current coordinate
	     * @param {number} f  regular force for current coordinate
	     * @param {number} m  mass of current node
	     * @returns {number} new velocity for current coordinate
	     * @private
	     */

	  }, {
	    key: "calculateComponentVelocity",
	    value: function calculateComponentVelocity(v, f, m) {
	      var df = this.modelOptions.damping * v; // damping force

	      var a = (f - df) / m; // acceleration

	      v += a * this.timestep; // Put a limit on the velocities if it is really high

	      var maxV = this.options.maxVelocity || 1e9;

	      if (Math.abs(v) > maxV) {
	        v = v > 0 ? maxV : -maxV;
	      }

	      return v;
	    }
	    /**
	     * Perform the actual step
	     *
	     * @param {Node.id} nodeId
	     * @returns {number} the new velocity of given node
	     * @private
	     */

	  }, {
	    key: "_performStep",
	    value: function _performStep(nodeId) {
	      var node = this.body.nodes[nodeId];
	      var force = this.physicsBody.forces[nodeId];
	      var velocity = this.physicsBody.velocities[nodeId]; // store the state so we can revert

	      this.previousStates[nodeId] = {
	        x: node.x,
	        y: node.y,
	        vx: velocity.x,
	        vy: velocity.y
	      };

	      if (node.options.fixed.x === false) {
	        velocity.x = this.calculateComponentVelocity(velocity.x, force.x, node.options.mass);
	        node.x += velocity.x * this.timestep;
	      } else {
	        force.x = 0;
	        velocity.x = 0;
	      }

	      if (node.options.fixed.y === false) {
	        velocity.y = this.calculateComponentVelocity(velocity.y, force.y, node.options.mass);
	        node.y += velocity.y * this.timestep;
	      } else {
	        force.y = 0;
	        velocity.y = 0;
	      }

	      var totalVelocity = Math.sqrt(Math.pow(velocity.x, 2) + Math.pow(velocity.y, 2));
	      return totalVelocity;
	    }
	    /**
	     * When initializing and stabilizing, we can freeze nodes with a predefined position.
	     * This greatly speeds up stabilization because only the supportnodes for the smoothCurves have to settle.
	     *
	     * @private
	     */

	  }, {
	    key: "_freezeNodes",
	    value: function _freezeNodes() {
	      var nodes = this.body.nodes;

	      for (var id in nodes) {
	        if (nodes.hasOwnProperty(id)) {
	          if (nodes[id].x && nodes[id].y) {
	            var fixed = nodes[id].options.fixed;
	            this.freezeCache[id] = {
	              x: fixed.x,
	              y: fixed.y
	            };
	            fixed.x = true;
	            fixed.y = true;
	          }
	        }
	      }
	    }
	    /**
	     * Unfreezes the nodes that have been frozen by _freezeDefinedNodes.
	     *
	     * @private
	     */

	  }, {
	    key: "_restoreFrozenNodes",
	    value: function _restoreFrozenNodes() {
	      var nodes = this.body.nodes;

	      for (var id in nodes) {
	        if (nodes.hasOwnProperty(id)) {
	          if (this.freezeCache[id] !== undefined) {
	            nodes[id].options.fixed.x = this.freezeCache[id].x;
	            nodes[id].options.fixed.y = this.freezeCache[id].y;
	          }
	        }
	      }

	      this.freezeCache = {};
	    }
	    /**
	     * Find a stable position for all nodes
	     *
	     * @param {number} [iterations=this.options.stabilization.iterations]
	     */

	  }, {
	    key: "stabilize",
	    value: function stabilize() {
	      var _this3 = this;

	      var iterations = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.options.stabilization.iterations;

	      if (typeof iterations !== 'number') {
	        iterations = this.options.stabilization.iterations;
	        console.log('The stabilize method needs a numeric amount of iterations. Switching to default: ', iterations);
	      }

	      if (this.physicsBody.physicsNodeIndices.length === 0) {
	        this.ready = true;
	        return;
	      } // enable adaptive timesteps


	      this.adaptiveTimestep =  this.options.adaptiveTimestep; // this sets the width of all nodes initially which could be required for the avoidOverlap

	      this.body.emitter.emit("_resizeNodes");
	      this.stopSimulation(); // stop the render loop

	      this.stabilized = false; // block redraw requests

	      this.body.emitter.emit('_blockRedraw');
	      this.targetIterations = iterations; // start the stabilization

	      if (this.options.stabilization.onlyDynamicEdges === true) {
	        this._freezeNodes();
	      }

	      this.stabilizationIterations = 0;

	      setTimeout$2(function () {
	        return _this3._stabilizationBatch();
	      }, 0);
	    }
	    /**
	     * If not already stabilizing, start it and emit a start event.
	     *
	     * @returns {boolean} true if stabilization started with this call
	     * @private
	     */

	  }, {
	    key: "_startStabilizing",
	    value: function _startStabilizing() {
	      if (this.startedStabilization === true) return false;
	      this.body.emitter.emit('startStabilizing');
	      this.startedStabilization = true;
	      return true;
	    }
	    /**
	     * One batch of stabilization
	     * @private
	     */

	  }, {
	    key: "_stabilizationBatch",
	    value: function _stabilizationBatch() {
	      var _this4 = this;

	      var running = function running() {
	        return _this4.stabilized === false && _this4.stabilizationIterations < _this4.targetIterations;
	      };

	      var sendProgress = function sendProgress() {
	        _this4.body.emitter.emit('stabilizationProgress', {
	          iterations: _this4.stabilizationIterations,
	          total: _this4.targetIterations
	        });
	      };

	      if (this._startStabilizing()) {
	        sendProgress(); // Ensure that there is at least one start event.
	      }

	      var count = 0;

	      while (running() && count < this.options.stabilization.updateInterval) {
	        this.physicsTick();
	        count++;
	      }

	      sendProgress();

	      if (running()) {
	        var _context2;

	        setTimeout$2(bind$2(_context2 = this._stabilizationBatch).call(_context2, this), 0);
	      } else {
	        this._finalizeStabilization();
	      }
	    }
	    /**
	     * Wrap up the stabilization, fit and emit the events.
	     * @private
	     */

	  }, {
	    key: "_finalizeStabilization",
	    value: function _finalizeStabilization() {
	      this.body.emitter.emit('_allowRedraw');

	      if (this.options.stabilization.fit === true) {
	        this.body.emitter.emit('fit');
	      }

	      if (this.options.stabilization.onlyDynamicEdges === true) {
	        this._restoreFrozenNodes();
	      }

	      this.body.emitter.emit('stabilizationIterationsDone');
	      this.body.emitter.emit('_requestRedraw');

	      if (this.stabilized === true) {
	        this._emitStabilized();
	      } else {
	        this.startSimulation();
	      }

	      this.ready = true;
	    } //---------------------------  DEBUGGING BELOW  ---------------------------//

	    /**
	     * Debug function that display arrows for the forces currently active in the network.
	     *
	     * Use this when debugging only.
	     *
	     * @param {CanvasRenderingContext2D} ctx
	     * @private
	     */

	  }, {
	    key: "_drawForces",
	    value: function _drawForces(ctx) {
	      for (var i = 0; i < this.physicsBody.physicsNodeIndices.length; i++) {
	        var index = this.physicsBody.physicsNodeIndices[i];
	        var node = this.body.nodes[index];
	        var force = this.physicsBody.forces[index];
	        var factor = 20;
	        var colorFactor = 0.03;
	        var forceSize = Math.sqrt(Math.pow(force.x, 2) + Math.pow(force.x, 2));
	        var size = Math.min(Math.max(5, forceSize), 15);
	        var arrowSize = 3 * size;
	        var color = HSVToHex((180 - Math.min(1, Math.max(0, colorFactor * forceSize)) * 180) / 360, 1, 1);
	        var point = {
	          x: node.x + factor * force.x,
	          y: node.y + factor * force.y
	        };
	        ctx.lineWidth = size;
	        ctx.strokeStyle = color;
	        ctx.beginPath();
	        ctx.moveTo(node.x, node.y);
	        ctx.lineTo(point.x, point.y);
	        ctx.stroke();
	        var angle = Math.atan2(force.y, force.x);
	        ctx.fillStyle = color;
	        EndPoints.draw(ctx, {
	          type: 'arrow',
	          point: point,
	          angle: angle,
	          length: arrowSize
	        });

	        fill$2(ctx).call(ctx);
	      }
	    }
	  }]);

	  return PhysicsEngine;
	}();

	/**
	 * Utility Class
	 */

	var NetworkUtil =
	/*#__PURE__*/
	function () {
	  /**
	   * @ignore
	   */
	  function NetworkUtil() {
	    classCallCheck(this, NetworkUtil);
	  }
	  /**
	   * Find the center position of the network considering the bounding boxes
	   *
	   * @param {Array.<Node>} allNodes
	   * @param {Array.<Node>} [specificNodes=[]]
	   * @returns {{minX: number, maxX: number, minY: number, maxY: number}}
	   * @static
	   */


	  createClass(NetworkUtil, null, [{
	    key: "getRange",
	    value: function getRange(allNodes) {
	      var specificNodes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
	      var minY = 1e9,
	          maxY = -1e9,
	          minX = 1e9,
	          maxX = -1e9,
	          node;

	      if (specificNodes.length > 0) {
	        for (var i = 0; i < specificNodes.length; i++) {
	          node = allNodes[specificNodes[i]];

	          if (minX > node.shape.boundingBox.left) {
	            minX = node.shape.boundingBox.left;
	          }

	          if (maxX < node.shape.boundingBox.right) {
	            maxX = node.shape.boundingBox.right;
	          }

	          if (minY > node.shape.boundingBox.top) {
	            minY = node.shape.boundingBox.top;
	          } // top is negative, bottom is positive


	          if (maxY < node.shape.boundingBox.bottom) {
	            maxY = node.shape.boundingBox.bottom;
	          } // top is negative, bottom is positive

	        }
	      }

	      if (minX === 1e9 && maxX === -1e9 && minY === 1e9 && maxY === -1e9) {
	        minY = 0, maxY = 0, minX = 0, maxX = 0;
	      }

	      return {
	        minX: minX,
	        maxX: maxX,
	        minY: minY,
	        maxY: maxY
	      };
	    }
	    /**
	     * Find the center position of the network
	     *
	     * @param {Array.<Node>} allNodes
	     * @param {Array.<Node>} [specificNodes=[]]
	     * @returns {{minX: number, maxX: number, minY: number, maxY: number}}
	     * @static
	     */

	  }, {
	    key: "getRangeCore",
	    value: function getRangeCore(allNodes) {
	      var specificNodes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
	      var minY = 1e9,
	          maxY = -1e9,
	          minX = 1e9,
	          maxX = -1e9,
	          node;

	      if (specificNodes.length > 0) {
	        for (var i = 0; i < specificNodes.length; i++) {
	          node = allNodes[specificNodes[i]];

	          if (minX > node.x) {
	            minX = node.x;
	          }

	          if (maxX < node.x) {
	            maxX = node.x;
	          }

	          if (minY > node.y) {
	            minY = node.y;
	          } // top is negative, bottom is positive


	          if (maxY < node.y) {
	            maxY = node.y;
	          } // top is negative, bottom is positive

	        }
	      }

	      if (minX === 1e9 && maxX === -1e9 && minY === 1e9 && maxY === -1e9) {
	        minY = 0, maxY = 0, minX = 0, maxX = 0;
	      }

	      return {
	        minX: minX,
	        maxX: maxX,
	        minY: minY,
	        maxY: maxY
	      };
	    }
	    /**
	     * @param {object} range = {minX: minX, maxX: maxX, minY: minY, maxY: maxY};
	     * @returns {{x: number, y: number}}
	     * @static
	     */

	  }, {
	    key: "findCenter",
	    value: function findCenter(range) {
	      return {
	        x: 0.5 * (range.maxX + range.minX),
	        y: 0.5 * (range.maxY + range.minY)
	      };
	    }
	    /**
	     * This returns a clone of the options or options of the edge or node to be used for construction of new edges or check functions for new nodes.
	     * @param {vis.Item} item
	     * @param {'node'|undefined} type
	     * @returns {{}}
	     * @static
	     */

	  }, {
	    key: "cloneOptions",
	    value: function cloneOptions(item, type) {
	      var clonedOptions = {};

	      if (type === undefined || type === 'node') {
	        deepExtend(clonedOptions, item.options, true);
	        clonedOptions.x = item.x;
	        clonedOptions.y = item.y;
	        clonedOptions.amountOfConnections = item.edges.length;
	      } else {
	        deepExtend(clonedOptions, item.options, true);
	      }

	      return clonedOptions;
	    }
	  }]);

	  return NetworkUtil;
	}();

	/**
	 * A Cluster is a special Node that allows a group of Nodes positioned closely together
	 * to be represented by a single Cluster Node.
	 *
	 * @extends Node
	 */

	var Cluster =
	/*#__PURE__*/
	function (_Node) {
	  inherits$1(Cluster, _Node);

	  /**
	   * @param {Object} options
	   * @param {Object} body
	   * @param {Array.<HTMLImageElement>}imagelist
	   * @param {Array} grouplist
	   * @param {Object} globalOptions
	   * @param {Object} defaultOptions     Global default options for nodes
	   */
	  function Cluster(options, body, imagelist, grouplist, globalOptions, defaultOptions) {
	    var _this;

	    classCallCheck(this, Cluster);

	    _this = possibleConstructorReturn$1(this, getPrototypeOf$7(Cluster).call(this, options, body, imagelist, grouplist, globalOptions, defaultOptions));
	    _this.isCluster = true;
	    _this.containedNodes = {};
	    _this.containedEdges = {};
	    return _this;
	  }
	  /**
	   * Transfer child cluster data to current and disconnect the child cluster.
	   *
	   * Please consult the header comment in 'Clustering.js' for the fields set here.
	   *
	   * @param {string|number} childClusterId  id of child cluster to open
	   */


	  createClass(Cluster, [{
	    key: "_openChildCluster",
	    value: function _openChildCluster(childClusterId) {
	      var _this2 = this;

	      var childCluster = this.body.nodes[childClusterId];

	      if (this.containedNodes[childClusterId] === undefined) {
	        throw new Error('node with id: ' + childClusterId + ' not in current cluster');
	      }

	      if (!childCluster.isCluster) {
	        throw new Error('node with id: ' + childClusterId + ' is not a cluster');
	      } // Disconnect child cluster from current cluster


	      delete this.containedNodes[childClusterId];
	      forEach$3$1(childCluster.edges, function (edge) {
	        delete _this2.containedEdges[edge.id];
	      }); // Transfer nodes and edges

	      forEach$3$1(childCluster.containedNodes, function (node, nodeId) {
	        _this2.containedNodes[nodeId] = node;
	      });
	      childCluster.containedNodes = {};
	      forEach$3$1(childCluster.containedEdges, function (edge, edgeId) {
	        _this2.containedEdges[edgeId] = edge;
	      });
	      childCluster.containedEdges = {}; // Transfer edges within cluster edges which are clustered

	      forEach$3$1(childCluster.edges, function (clusterEdge) {
	        forEach$3$1(_this2.edges, function (parentClusterEdge) {
	          var _context, _context2;

	          // Assumption: a clustered edge can only be present in a single clustering edge
	          // Not tested here
	          var index = indexOf$3(_context = parentClusterEdge.clusteringEdgeReplacingIds).call(_context, clusterEdge.id);

	          if (index === -1) return;
	          forEach$3$1(clusterEdge.clusteringEdgeReplacingIds, function (srcId) {
	            parentClusterEdge.clusteringEdgeReplacingIds.push(srcId); // Maintain correct bookkeeping for transferred edge

	            _this2.body.edges[srcId].edgeReplacedById = parentClusterEdge.id;
	          }); // Remove cluster edge from parent cluster edge

	          splice$2(_context2 = parentClusterEdge.clusteringEdgeReplacingIds).call(_context2, index, 1);
	        });
	      });
	      childCluster.edges = [];
	    }
	  }]);

	  return Cluster;
	}(Node);

	/**
	 * The clustering engine
	 */

	var ClusterEngine =
	/*#__PURE__*/
	function () {
	  /**
	   * @param {Object} body
	   */
	  function ClusterEngine(body) {
	    var _this = this;

	    classCallCheck(this, ClusterEngine);

	    this.body = body;
	    this.clusteredNodes = {}; // key: node id, value: { clusterId: <id of cluster>, node: <node instance>}

	    this.clusteredEdges = {}; // key: edge id, value: restore information for given edge

	    this.options = {};
	    this.defaultOptions = {};
	    extend(this.options, this.defaultOptions);
	    this.body.emitter.on('_resetData', function () {
	      _this.clusteredNodes = {};
	      _this.clusteredEdges = {};
	    });
	  }
	  /**
	  *
	  * @param {number} hubsize
	  * @param {Object} options
	  */


	  createClass(ClusterEngine, [{
	    key: "clusterByHubsize",
	    value: function clusterByHubsize(hubsize, options) {
	      if (hubsize === undefined) {
	        hubsize = this._getHubSize();
	      } else if (_typeof_1(hubsize) === "object") {
	        options = this._checkOptions(hubsize);
	        hubsize = this._getHubSize();
	      }

	      var nodesToCluster = [];

	      for (var i = 0; i < this.body.nodeIndices.length; i++) {
	        var node = this.body.nodes[this.body.nodeIndices[i]];

	        if (node.edges.length >= hubsize) {
	          nodesToCluster.push(node.id);
	        }
	      }

	      for (var _i = 0; _i < nodesToCluster.length; _i++) {
	        this.clusterByConnection(nodesToCluster[_i], options, true);
	      }

	      this.body.emitter.emit('_dataChanged');
	    }
	    /**
	     * loop over all nodes, check if they adhere to the condition and cluster if needed.
	     * @param {Object} options
	     * @param {boolean} [refreshData=true]
	     */

	  }, {
	    key: "cluster",
	    value: function cluster() {
	      var _this2 = this;

	      var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
	      var refreshData = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;

	      if (options.joinCondition === undefined) {
	        throw new Error("Cannot call clusterByNodeData without a joinCondition function in the options.");
	      } // check if the options object is fine, append if needed


	      options = this._checkOptions(options);
	      var childNodesObj = {};
	      var childEdgesObj = {}; // collect the nodes that will be in the cluster

	      forEach$3$1(this.body.nodes, function (node, nodeId) {
	        if (node.options && options.joinCondition(node.options) === true) {
	          childNodesObj[nodeId] = node; // collect the edges that will be in the cluster

	          forEach$3$1(node.edges, function (edge) {
	            if (_this2.clusteredEdges[edge.id] === undefined) {
	              childEdgesObj[edge.id] = edge;
	            }
	          });
	        }
	      });

	      this._cluster(childNodesObj, childEdgesObj, options, refreshData);
	    }
	    /**
	     * Cluster all nodes in the network that have only X edges
	     * @param {number} edgeCount
	     * @param {Object} options
	     * @param {boolean} [refreshData=true]
	     */

	  }, {
	    key: "clusterByEdgeCount",
	    value: function clusterByEdgeCount(edgeCount, options) {
	      var _this3 = this;

	      var refreshData = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
	      options = this._checkOptions(options);
	      var clusters = [];
	      var usedNodes = {};
	      var edge, edges, relevantEdgeCount; // collect the nodes that will be in the cluster

	      var _loop = function _loop(i) {
	        var childNodesObj = {};
	        var childEdgesObj = {};
	        var nodeId = _this3.body.nodeIndices[i];
	        var node = _this3.body.nodes[nodeId]; // if this node is already used in another cluster this session, we do not have to re-evaluate it.

	        if (usedNodes[nodeId] === undefined) {
	          relevantEdgeCount = 0;
	          edges = [];

	          for (var j = 0; j < node.edges.length; j++) {
	            edge = node.edges[j];

	            if (_this3.clusteredEdges[edge.id] === undefined) {
	              if (edge.toId !== edge.fromId) {
	                relevantEdgeCount++;
	              }

	              edges.push(edge);
	            }
	          } // this node qualifies, we collect its neighbours to start the clustering process.


	          if (relevantEdgeCount === edgeCount) {
	            checkJoinCondition = function checkJoinCondition(node) {
	              if (options.joinCondition === undefined || options.joinCondition === null) {
	                return true;
	              }

	              var clonedOptions = NetworkUtil.cloneOptions(node);
	              return options.joinCondition(clonedOptions);
	            };

	            var gatheringSuccessful = true;

	            for (var _j = 0; _j < edges.length; _j++) {
	              edge = edges[_j];

	              var childNodeId = _this3._getConnectedId(edge, nodeId); // add the nodes to the list by the join condition.


	              if (checkJoinCondition(node)) {
	                childEdgesObj[edge.id] = edge;
	                childNodesObj[nodeId] = node;
	                childNodesObj[childNodeId] = _this3.body.nodes[childNodeId];
	                usedNodes[nodeId] = true;
	              } else {
	                // this node does not qualify after all.
	                gatheringSuccessful = false;
	                break;
	              }
	            } // add to the cluster queue


	            if (keys$6(childNodesObj).length > 0 && keys$6(childEdgesObj).length > 0 && gatheringSuccessful === true) {
	              /**
	               * Search for cluster data that contains any of the node id's
	               * @returns {Boolean} true if no joinCondition, otherwise return value of joinCondition
	               */
	              findClusterData = function findClusterData() {
	                for (var n = 0; n < clusters.length; ++n) {
	                  // Search for a cluster containing any of the node id's
	                  for (var m in childNodesObj) {
	                    if (clusters[n].nodes[m] !== undefined) {
	                      return clusters[n];
	                    }
	                  }
	                }

	                return undefined;
	              }; // If any of the found nodes is part of a cluster found in this method,
	              // add the current values to that cluster


	              foundCluster = findClusterData();

	              if (foundCluster !== undefined) {
	                // Add nodes to found cluster if not present
	                for (var m in childNodesObj) {
	                  if (foundCluster.nodes[m] === undefined) {
	                    foundCluster.nodes[m] = childNodesObj[m];
	                  }
	                } // Add edges to found cluster, if not present


	                for (var _m in childEdgesObj) {
	                  if (foundCluster.edges[_m] === undefined) {
	                    foundCluster.edges[_m] = childEdgesObj[_m];
	                  }
	                }
	              } else {
	                // Create a new cluster group
	                clusters.push({
	                  nodes: childNodesObj,
	                  edges: childEdgesObj
	                });
	              }
	            }
	          }
	        }
	      };

	      for (var i = 0; i < this.body.nodeIndices.length; i++) {
	        var checkJoinCondition;
	        var findClusterData;
	        var foundCluster;

	        _loop(i);
	      }

	      for (var _i2 = 0; _i2 < clusters.length; _i2++) {
	        this._cluster(clusters[_i2].nodes, clusters[_i2].edges, options, false);
	      }

	      if (refreshData === true) {
	        this.body.emitter.emit('_dataChanged');
	      }
	    }
	    /**
	     * Cluster all nodes in the network that have only 1 edge
	     * @param {Object} options
	     * @param {boolean} [refreshData=true]
	     */

	  }, {
	    key: "clusterOutliers",
	    value: function clusterOutliers(options) {
	      var refreshData = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
	      this.clusterByEdgeCount(1, options, refreshData);
	    }
	    /**
	     * Cluster all nodes in the network that have only 2 edge
	     * @param {Object} options
	     * @param {boolean} [refreshData=true]
	     */

	  }, {
	    key: "clusterBridges",
	    value: function clusterBridges(options) {
	      var refreshData = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
	      this.clusterByEdgeCount(2, options, refreshData);
	    }
	    /**
	    * suck all connected nodes of a node into the node.
	    * @param {Node.id} nodeId
	    * @param {Object} options
	    * @param {boolean} [refreshData=true]
	    */

	  }, {
	    key: "clusterByConnection",
	    value: function clusterByConnection(nodeId, options) {
	      var _context;

	      var refreshData = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;

	      // kill conditions
	      if (nodeId === undefined) {
	        throw new Error("No nodeId supplied to clusterByConnection!");
	      }

	      if (this.body.nodes[nodeId] === undefined) {
	        throw new Error("The nodeId given to clusterByConnection does not exist!");
	      }

	      var node = this.body.nodes[nodeId];
	      options = this._checkOptions(options, node);

	      if (options.clusterNodeProperties.x === undefined) {
	        options.clusterNodeProperties.x = node.x;
	      }

	      if (options.clusterNodeProperties.y === undefined) {
	        options.clusterNodeProperties.y = node.y;
	      }

	      if (options.clusterNodeProperties.fixed === undefined) {
	        options.clusterNodeProperties.fixed = {};
	        options.clusterNodeProperties.fixed.x = node.options.fixed.x;
	        options.clusterNodeProperties.fixed.y = node.options.fixed.y;
	      }

	      var childNodesObj = {};
	      var childEdgesObj = {};
	      var parentNodeId = node.id;
	      var parentClonedOptions = NetworkUtil.cloneOptions(node);
	      childNodesObj[parentNodeId] = node; // collect the nodes that will be in the cluster

	      for (var i = 0; i < node.edges.length; i++) {
	        var edge = node.edges[i];

	        if (this.clusteredEdges[edge.id] === undefined) {
	          var childNodeId = this._getConnectedId(edge, parentNodeId); // if the child node is not in a cluster


	          if (this.clusteredNodes[childNodeId] === undefined) {
	            if (childNodeId !== parentNodeId) {
	              if (options.joinCondition === undefined) {
	                childEdgesObj[edge.id] = edge;
	                childNodesObj[childNodeId] = this.body.nodes[childNodeId];
	              } else {
	                // clone the options and insert some additional parameters that could be interesting.
	                var childClonedOptions = NetworkUtil.cloneOptions(this.body.nodes[childNodeId]);

	                if (options.joinCondition(parentClonedOptions, childClonedOptions) === true) {
	                  childEdgesObj[edge.id] = edge;
	                  childNodesObj[childNodeId] = this.body.nodes[childNodeId];
	                }
	              }
	            } else {
	              // swallow the edge if it is self-referencing.
	              childEdgesObj[edge.id] = edge;
	            }
	          }
	        }
	      }

	      var childNodeIDs = map$2(_context = keys$6(childNodesObj)).call(_context, function (childNode) {
	        return childNodesObj[childNode].id;
	      });

	      for (childNode in childNodesObj) {
	        if (!childNodesObj.hasOwnProperty(childNode)) continue;
	        var childNode = childNodesObj[childNode];

	        for (var y = 0; y < childNode.edges.length; y++) {
	          var childEdge = childNode.edges[y];

	          if (indexOf$3(childNodeIDs).call(childNodeIDs, this._getConnectedId(childEdge, childNode.id)) > -1) {
	            childEdgesObj[childEdge.id] = childEdge;
	          }
	        }
	      }

	      this._cluster(childNodesObj, childEdgesObj, options, refreshData);
	    }
	    /**
	    * This function creates the edges that will be attached to the cluster
	    * It looks for edges that are connected to the nodes from the "outside' of the cluster.
	    *
	    * @param {{Node.id: vis.Node}} childNodesObj
	    * @param {{vis.Edge.id: vis.Edge}} childEdgesObj
	    * @param {Object} clusterNodeProperties
	    * @param {Object} clusterEdgeProperties
	    * @private
	    */

	  }, {
	    key: "_createClusterEdges",
	    value: function _createClusterEdges(childNodesObj, childEdgesObj, clusterNodeProperties, clusterEdgeProperties) {
	      var edge, childNodeId, childNode, toId, fromId, otherNodeId; // loop over all child nodes and their edges to find edges going out of the cluster
	      // these edges will be replaced by clusterEdges.

	      var childKeys = keys$6(childNodesObj);

	      var createEdges = [];

	      for (var i = 0; i < childKeys.length; i++) {
	        childNodeId = childKeys[i];
	        childNode = childNodesObj[childNodeId]; // construct new edges from the cluster to others

	        for (var j = 0; j < childNode.edges.length; j++) {
	          edge = childNode.edges[j]; // we only handle edges that are visible to the system, not the disabled ones from the clustering process.

	          if (this.clusteredEdges[edge.id] === undefined) {
	            // self-referencing edges will be added to the "hidden" list
	            if (edge.toId == edge.fromId) {
	              childEdgesObj[edge.id] = edge;
	            } else {
	              // set up the from and to.
	              if (edge.toId == childNodeId) {
	                // this is a double equals because ints and strings can be interchanged here.
	                toId = clusterNodeProperties.id;
	                fromId = edge.fromId;
	                otherNodeId = fromId;
	              } else {
	                toId = edge.toId;
	                fromId = clusterNodeProperties.id;
	                otherNodeId = toId;
	              }
	            } // Only edges from the cluster outwards are being replaced.


	            if (childNodesObj[otherNodeId] === undefined) {
	              createEdges.push({
	                edge: edge,
	                fromId: fromId,
	                toId: toId
	              });
	            }
	          }
	        }
	      } //
	      // Here we actually create the replacement edges.
	      //
	      // We could not do this in the loop above as the creation process
	      // would add an edge to the edges array we are iterating over.
	      //
	      // NOTE: a clustered edge can have multiple base edges!
	      //


	      var newEdges = [];
	      /**
	       * Find a cluster edge which matches the given created edge.
	       * @param {vis.Edge} createdEdge
	       * @returns {vis.Edge}
	       */

	      var getNewEdge = function getNewEdge(createdEdge) {
	        for (var _j2 = 0; _j2 < newEdges.length; _j2++) {
	          var newEdge = newEdges[_j2]; // We replace both to and from edges with a single cluster edge

	          var matchToDirection = createdEdge.fromId === newEdge.fromId && createdEdge.toId === newEdge.toId;
	          var matchFromDirection = createdEdge.fromId === newEdge.toId && createdEdge.toId === newEdge.fromId;

	          if (matchToDirection || matchFromDirection) {
	            return newEdge;
	          }
	        }

	        return null;
	      };

	      for (var _j3 = 0; _j3 < createEdges.length; _j3++) {
	        var createdEdge = createEdges[_j3];
	        var _edge = createdEdge.edge;
	        var newEdge = getNewEdge(createdEdge);

	        if (newEdge === null) {
	          // Create a clustered edge for this connection
	          newEdge = this._createClusteredEdge(createdEdge.fromId, createdEdge.toId, _edge, clusterEdgeProperties);
	          newEdges.push(newEdge);
	        } else {
	          newEdge.clusteringEdgeReplacingIds.push(_edge.id);
	        } // also reference the new edge in the old edge


	        this.body.edges[_edge.id].edgeReplacedById = newEdge.id; // hide the replaced edge

	        this._backupEdgeOptions(_edge);

	        _edge.setOptions({
	          physics: false
	        });
	      }
	    }
	    /**
	    * This function checks the options that can be supplied to the different cluster functions
	    * for certain fields and inserts defaults if needed
	    * @param {Object} options
	    * @returns {*}
	    * @private
	    */

	  }, {
	    key: "_checkOptions",
	    value: function _checkOptions() {
	      var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

	      if (options.clusterEdgeProperties === undefined) {
	        options.clusterEdgeProperties = {};
	      }

	      if (options.clusterNodeProperties === undefined) {
	        options.clusterNodeProperties = {};
	      }

	      return options;
	    }
	    /**
	    *
	    * @param {Object}    childNodesObj         | object with node objects, id as keys, same as childNodes except it also contains a source node
	    * @param {Object}    childEdgesObj         | object with edge objects, id as keys
	    * @param {Array}     options               | object with {clusterNodeProperties, clusterEdgeProperties, processProperties}
	    * @param {boolean}   refreshData | when true, do not wrap up
	    * @private
	    */

	  }, {
	    key: "_cluster",
	    value: function _cluster(childNodesObj, childEdgesObj, options) {
	      var refreshData = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
	      // Remove nodes which are already clustered
	      var tmpNodesToRemove = [];

	      for (var nodeId in childNodesObj) {
	        if (childNodesObj.hasOwnProperty(nodeId)) {
	          if (this.clusteredNodes[nodeId] !== undefined) {
	            tmpNodesToRemove.push(nodeId);
	          }
	        }
	      }

	      for (var n = 0; n < tmpNodesToRemove.length; ++n) {
	        delete childNodesObj[tmpNodesToRemove[n]];
	      } // kill condition: no nodes don't bother


	      if (keys$6(childNodesObj).length == 0) {
	        return;
	      } // allow clusters of 1 if options allow


	      if (keys$6(childNodesObj).length == 1 && options.clusterNodeProperties.allowSingleNodeCluster != true) {
	        return;
	      }

	      var clusterNodeProperties = deepExtend({}, options.clusterNodeProperties); // construct the clusterNodeProperties

	      if (options.processProperties !== undefined) {
	        // get the childNode options
	        var childNodesOptions = [];

	        for (var _nodeId in childNodesObj) {
	          if (childNodesObj.hasOwnProperty(_nodeId)) {
	            var clonedOptions = NetworkUtil.cloneOptions(childNodesObj[_nodeId]);
	            childNodesOptions.push(clonedOptions);
	          }
	        } // get cluster properties based on childNodes


	        var childEdgesOptions = [];

	        for (var edgeId in childEdgesObj) {
	          if (childEdgesObj.hasOwnProperty(edgeId)) {
	            // these cluster edges will be removed on creation of the cluster.
	            if (edgeId.substr(0, 12) !== "clusterEdge:") {
	              var _clonedOptions = NetworkUtil.cloneOptions(childEdgesObj[edgeId], 'edge');

	              childEdgesOptions.push(_clonedOptions);
	            }
	          }
	        }

	        clusterNodeProperties = options.processProperties(clusterNodeProperties, childNodesOptions, childEdgesOptions);

	        if (!clusterNodeProperties) {
	          throw new Error("The processProperties function does not return properties!");
	        }
	      } // check if we have an unique id;


	      if (clusterNodeProperties.id === undefined) {
	        clusterNodeProperties.id = 'cluster:' + uuid4();
	      }

	      var clusterId = clusterNodeProperties.id;

	      if (clusterNodeProperties.label === undefined) {
	        clusterNodeProperties.label = 'cluster';
	      } // give the clusterNode a position if it does not have one.


	      var pos = undefined;

	      if (clusterNodeProperties.x === undefined) {
	        pos = this._getClusterPosition(childNodesObj);
	        clusterNodeProperties.x = pos.x;
	      }

	      if (clusterNodeProperties.y === undefined) {
	        if (pos === undefined) {
	          pos = this._getClusterPosition(childNodesObj);
	        }

	        clusterNodeProperties.y = pos.y;
	      } // force the ID to remain the same


	      clusterNodeProperties.id = clusterId; // create the cluster Node
	      // Note that allowSingleNodeCluster, if present, is stored in the options as well

	      var clusterNode = this.body.functions.createNode(clusterNodeProperties, Cluster);
	      clusterNode.containedNodes = childNodesObj;
	      clusterNode.containedEdges = childEdgesObj; // cache a copy from the cluster edge properties if we have to reconnect others later on

	      clusterNode.clusterEdgeProperties = options.clusterEdgeProperties; // finally put the cluster node into global

	      this.body.nodes[clusterNodeProperties.id] = clusterNode;

	      this._clusterEdges(childNodesObj, childEdgesObj, clusterNodeProperties, options.clusterEdgeProperties); // set ID to undefined so no duplicates arise


	      clusterNodeProperties.id = undefined; // wrap up

	      if (refreshData === true) {
	        this.body.emitter.emit('_dataChanged');
	      }
	    }
	    /**
	     *
	     * @param {Edge} edge
	     * @private
	     */

	  }, {
	    key: "_backupEdgeOptions",
	    value: function _backupEdgeOptions(edge) {
	      if (this.clusteredEdges[edge.id] === undefined) {
	        this.clusteredEdges[edge.id] = {
	          physics: edge.options.physics
	        };
	      }
	    }
	    /**
	     *
	     * @param {Edge} edge
	     * @private
	     */

	  }, {
	    key: "_restoreEdge",
	    value: function _restoreEdge(edge) {
	      var originalOptions = this.clusteredEdges[edge.id];

	      if (originalOptions !== undefined) {
	        edge.setOptions({
	          physics: originalOptions.physics
	        });
	        delete this.clusteredEdges[edge.id];
	      }
	    }
	    /**
	    * Check if a node is a cluster.
	    * @param {Node.id} nodeId
	    * @returns {*}
	    */

	  }, {
	    key: "isCluster",
	    value: function isCluster(nodeId) {
	      if (this.body.nodes[nodeId] !== undefined) {
	        return this.body.nodes[nodeId].isCluster === true;
	      } else {
	        console.log("Node does not exist.");
	        return false;
	      }
	    }
	    /**
	    * get the position of the cluster node based on what's inside
	    * @param {object} childNodesObj    | object with node objects, id as keys
	    * @returns {{x: number, y: number}}
	    * @private
	    */

	  }, {
	    key: "_getClusterPosition",
	    value: function _getClusterPosition(childNodesObj) {
	      var childKeys = keys$6(childNodesObj);

	      var minX = childNodesObj[childKeys[0]].x;
	      var maxX = childNodesObj[childKeys[0]].x;
	      var minY = childNodesObj[childKeys[0]].y;
	      var maxY = childNodesObj[childKeys[0]].y;
	      var node;

	      for (var i = 1; i < childKeys.length; i++) {
	        node = childNodesObj[childKeys[i]];
	        minX = node.x < minX ? node.x : minX;
	        maxX = node.x > maxX ? node.x : maxX;
	        minY = node.y < minY ? node.y : minY;
	        maxY = node.y > maxY ? node.y : maxY;
	      }

	      return {
	        x: 0.5 * (minX + maxX),
	        y: 0.5 * (minY + maxY)
	      };
	    }
	    /**
	     * Open a cluster by calling this function.
	     * @param {vis.Edge.id}  clusterNodeId | the ID of the cluster node
	     * @param {Object} options
	     * @param {boolean} refreshData | wrap up afterwards if not true
	     */

	  }, {
	    key: "openCluster",
	    value: function openCluster(clusterNodeId, options) {
	      var refreshData = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;

	      // kill conditions
	      if (clusterNodeId === undefined) {
	        throw new Error("No clusterNodeId supplied to openCluster.");
	      }

	      var clusterNode = this.body.nodes[clusterNodeId];

	      if (clusterNode === undefined) {
	        throw new Error("The clusterNodeId supplied to openCluster does not exist.");
	      }

	      if (clusterNode.isCluster !== true || clusterNode.containedNodes === undefined || clusterNode.containedEdges === undefined) {
	        throw new Error("The node:" + clusterNodeId + " is not a valid cluster.");
	      } // Check if current cluster is clustered itself


	      var stack = this.findNode(clusterNodeId);
	      var parentIndex = indexOf$3(stack).call(stack, clusterNodeId) - 1;

	      if (parentIndex >= 0) {
	        // Current cluster is clustered; transfer contained nodes and edges to parent
	        var parentClusterNodeId = stack[parentIndex];
	        var parentClusterNode = this.body.nodes[parentClusterNodeId]; // clustering.clusteredNodes and clustering.clusteredEdges remain unchanged

	        parentClusterNode._openChildCluster(clusterNodeId); // All components of child cluster node have been transferred. It can die now.


	        delete this.body.nodes[clusterNodeId];

	        if (refreshData === true) {
	          this.body.emitter.emit('_dataChanged');
	        }

	        return;
	      } // main body 


	      var containedNodes = clusterNode.containedNodes;
	      var containedEdges = clusterNode.containedEdges; // allow the user to position the nodes after release.

	      if (options !== undefined && options.releaseFunction !== undefined && typeof options.releaseFunction === 'function') {
	        var positions = {};
	        var clusterPosition = {
	          x: clusterNode.x,
	          y: clusterNode.y
	        };

	        for (var nodeId in containedNodes) {
	          if (containedNodes.hasOwnProperty(nodeId)) {
	            var containedNode = this.body.nodes[nodeId];
	            positions[nodeId] = {
	              x: containedNode.x,
	              y: containedNode.y
	            };
	          }
	        }

	        var newPositions = options.releaseFunction(clusterPosition, positions);

	        for (var _nodeId2 in containedNodes) {
	          if (containedNodes.hasOwnProperty(_nodeId2)) {
	            var _containedNode = this.body.nodes[_nodeId2];

	            if (newPositions[_nodeId2] !== undefined) {
	              _containedNode.x = newPositions[_nodeId2].x === undefined ? clusterNode.x : newPositions[_nodeId2].x;
	              _containedNode.y = newPositions[_nodeId2].y === undefined ? clusterNode.y : newPositions[_nodeId2].y;
	            }
	          }
	        }
	      } else {
	        // copy the position from the cluster
	        forEach$3$1(containedNodes, function (containedNode) {
	          // inherit position
	          if (containedNode.options.fixed.x === false) {
	            containedNode.x = clusterNode.x;
	          }

	          if (containedNode.options.fixed.y === false) {
	            containedNode.y = clusterNode.y;
	          }
	        });
	      } // release nodes


	      for (var _nodeId3 in containedNodes) {
	        if (containedNodes.hasOwnProperty(_nodeId3)) {
	          var _containedNode2 = this.body.nodes[_nodeId3]; // inherit speed

	          _containedNode2.vx = clusterNode.vx;
	          _containedNode2.vy = clusterNode.vy;

	          _containedNode2.setOptions({
	            physics: true
	          });

	          delete this.clusteredNodes[_nodeId3];
	        }
	      } // copy the clusterNode edges because we cannot iterate over an object that we add or remove from.


	      var edgesToBeDeleted = [];

	      for (var i = 0; i < clusterNode.edges.length; i++) {
	        edgesToBeDeleted.push(clusterNode.edges[i]);
	      } // actually handling the deleting.


	      for (var _i3 = 0; _i3 < edgesToBeDeleted.length; _i3++) {
	        var edge = edgesToBeDeleted[_i3];

	        var otherNodeId = this._getConnectedId(edge, clusterNodeId);

	        var otherNode = this.clusteredNodes[otherNodeId];

	        for (var j = 0; j < edge.clusteringEdgeReplacingIds.length; j++) {
	          var transferId = edge.clusteringEdgeReplacingIds[j];
	          var transferEdge = this.body.edges[transferId];
	          if (transferEdge === undefined) continue; // if the other node is in another cluster, we transfer ownership of this edge to the other cluster

	          if (otherNode !== undefined) {
	            // transfer ownership:
	            var otherCluster = this.body.nodes[otherNode.clusterId];
	            otherCluster.containedEdges[transferEdge.id] = transferEdge; // delete local reference

	            delete containedEdges[transferEdge.id]; // get to and from

	            var fromId = transferEdge.fromId;
	            var toId = transferEdge.toId;

	            if (transferEdge.toId == otherNodeId) {
	              toId = otherNode.clusterId;
	            } else {
	              fromId = otherNode.clusterId;
	            } // create new cluster edge from the otherCluster


	            this._createClusteredEdge(fromId, toId, transferEdge, otherCluster.clusterEdgeProperties, {
	              hidden: false,
	              physics: true
	            });
	          } else {
	            this._restoreEdge(transferEdge);
	          }
	        }

	        edge.remove();
	      } // handle the releasing of the edges


	      for (var edgeId in containedEdges) {
	        if (containedEdges.hasOwnProperty(edgeId)) {
	          this._restoreEdge(containedEdges[edgeId]);
	        }
	      } // remove clusterNode


	      delete this.body.nodes[clusterNodeId];

	      if (refreshData === true) {
	        this.body.emitter.emit('_dataChanged');
	      }
	    }
	    /**
	     *
	     * @param {Cluster.id} clusterId
	     * @returns {Array.<Node.id>}
	     */

	  }, {
	    key: "getNodesInCluster",
	    value: function getNodesInCluster(clusterId) {
	      var nodesArray = [];

	      if (this.isCluster(clusterId) === true) {
	        var containedNodes = this.body.nodes[clusterId].containedNodes;

	        for (var nodeId in containedNodes) {
	          if (containedNodes.hasOwnProperty(nodeId)) {
	            nodesArray.push(this.body.nodes[nodeId].id);
	          }
	        }
	      }

	      return nodesArray;
	    }
	    /**
	    * Get the stack clusterId's that a certain node resides in. cluster A -> cluster B -> cluster C -> node
	    *
	    * If a node can't be found in the chain, return an empty array.
	    *
	    * @param {string|number} nodeId
	    * @returns {Array}
	    */

	  }, {
	    key: "findNode",
	    value: function findNode(nodeId) {
	      var stack = [];
	      var max = 100;
	      var counter = 0;
	      var node;

	      while (this.clusteredNodes[nodeId] !== undefined && counter < max) {
	        node = this.body.nodes[nodeId];
	        if (node === undefined) return [];
	        stack.push(node.id);
	        nodeId = this.clusteredNodes[nodeId].clusterId;
	        counter++;
	      }

	      node = this.body.nodes[nodeId];
	      if (node === undefined) return [];
	      stack.push(node.id);

	      reverse$2(stack).call(stack);

	      return stack;
	    }
	    /**
	    * Using a clustered nodeId, update with the new options
	    * @param {vis.Edge.id} clusteredNodeId
	    * @param {object} newOptions
	    */

	  }, {
	    key: "updateClusteredNode",
	    value: function updateClusteredNode(clusteredNodeId, newOptions) {
	      if (clusteredNodeId === undefined) {
	        throw new Error("No clusteredNodeId supplied to updateClusteredNode.");
	      }

	      if (newOptions === undefined) {
	        throw new Error("No newOptions supplied to updateClusteredNode.");
	      }

	      if (this.body.nodes[clusteredNodeId] === undefined) {
	        throw new Error("The clusteredNodeId supplied to updateClusteredNode does not exist.");
	      }

	      this.body.nodes[clusteredNodeId].setOptions(newOptions);
	      this.body.emitter.emit('_dataChanged');
	    }
	    /**
	    * Using a base edgeId, update all related clustered edges with the new options
	    * @param {vis.Edge.id} startEdgeId
	    * @param {object} newOptions
	    */

	  }, {
	    key: "updateEdge",
	    value: function updateEdge(startEdgeId, newOptions) {
	      if (startEdgeId === undefined) {
	        throw new Error("No startEdgeId supplied to updateEdge.");
	      }

	      if (newOptions === undefined) {
	        throw new Error("No newOptions supplied to updateEdge.");
	      }

	      if (this.body.edges[startEdgeId] === undefined) {
	        throw new Error("The startEdgeId supplied to updateEdge does not exist.");
	      }

	      var allEdgeIds = this.getClusteredEdges(startEdgeId);

	      for (var i = 0; i < allEdgeIds.length; i++) {
	        var edge = this.body.edges[allEdgeIds[i]];
	        edge.setOptions(newOptions);
	      }

	      this.body.emitter.emit('_dataChanged');
	    }
	    /**
	    * Get a stack of clusterEdgeId's (+base edgeid) that a base edge is the same as. cluster edge C -> cluster edge B -> cluster edge A -> base edge(edgeId)
	    * @param {vis.Edge.id} edgeId
	    * @returns {Array.<vis.Edge.id>}
	    */

	  }, {
	    key: "getClusteredEdges",
	    value: function getClusteredEdges(edgeId) {
	      var stack = [];
	      var max = 100;
	      var counter = 0;

	      while (edgeId !== undefined && this.body.edges[edgeId] !== undefined && counter < max) {
	        stack.push(this.body.edges[edgeId].id);
	        edgeId = this.body.edges[edgeId].edgeReplacedById;
	        counter++;
	      }

	      reverse$2(stack).call(stack);

	      return stack;
	    }
	    /**
	    * Get the base edge id of clusterEdgeId. cluster edge (clusteredEdgeId) -> cluster edge B -> cluster edge C -> base edge
	    * @param {vis.Edge.id} clusteredEdgeId
	    * @returns {vis.Edge.id} baseEdgeId
	    *
	    * TODO: deprecate in 5.0.0. Method getBaseEdges() is the correct one to use.
	    */

	  }, {
	    key: "getBaseEdge",
	    value: function getBaseEdge(clusteredEdgeId) {
	      // Just kludge this by returning the first base edge id found
	      return this.getBaseEdges(clusteredEdgeId)[0];
	    }
	    /**
	     * Get all regular edges for this clustered edge id.
	     *
	     * @param {vis.Edge.id} clusteredEdgeId
	     * @returns {Array.<vis.Edge.id>} all baseEdgeId's under this clustered edge
	     */

	  }, {
	    key: "getBaseEdges",
	    value: function getBaseEdges(clusteredEdgeId) {
	      var IdsToHandle = [clusteredEdgeId];
	      var doneIds = [];
	      var foundIds = [];
	      var max = 100;
	      var counter = 0;

	      while (IdsToHandle.length > 0 && counter < max) {
	        var nextId = IdsToHandle.pop();
	        if (nextId === undefined) continue; // Paranoia here and onwards

	        var nextEdge = this.body.edges[nextId];
	        if (nextEdge === undefined) continue;
	        counter++;
	        var replacingIds = nextEdge.clusteringEdgeReplacingIds;

	        if (replacingIds === undefined) {
	          // nextId is a base id
	          foundIds.push(nextId);
	        } else {
	          // Another cluster edge, unravel this one as well
	          for (var i = 0; i < replacingIds.length; ++i) {
	            var replacingId = replacingIds[i]; // Don't add if already handled
	            // TODO: never triggers; find a test-case which does

	            if (indexOf$3(IdsToHandle).call(IdsToHandle, replacingIds) !== -1 || indexOf$3(doneIds).call(doneIds, replacingIds) !== -1) {
	              continue;
	            }

	            IdsToHandle.push(replacingId);
	          }
	        }

	        doneIds.push(nextId);
	      }

	      return foundIds;
	    }
	    /**
	    * Get the Id the node is connected to
	    * @param {vis.Edge} edge
	    * @param {Node.id} nodeId
	    * @returns {*}
	    * @private
	    */

	  }, {
	    key: "_getConnectedId",
	    value: function _getConnectedId(edge, nodeId) {
	      if (edge.toId != nodeId) {
	        return edge.toId;
	      } else if (edge.fromId != nodeId) {
	        return edge.fromId;
	      } else {
	        return edge.fromId;
	      }
	    }
	    /**
	    * We determine how many connections denote an important hub.
	    * We take the mean + 2*std as the important hub size. (Assuming a normal distribution of data, ~2.2%)
	    *
	    * @returns {number}
	    * @private
	    */

	  }, {
	    key: "_getHubSize",
	    value: function _getHubSize() {
	      var average = 0;
	      var averageSquared = 0;
	      var hubCounter = 0;
	      var largestHub = 0;

	      for (var i = 0; i < this.body.nodeIndices.length; i++) {
	        var node = this.body.nodes[this.body.nodeIndices[i]];

	        if (node.edges.length > largestHub) {
	          largestHub = node.edges.length;
	        }

	        average += node.edges.length;
	        averageSquared += Math.pow(node.edges.length, 2);
	        hubCounter += 1;
	      }

	      average = average / hubCounter;
	      averageSquared = averageSquared / hubCounter;
	      var variance = averageSquared - Math.pow(average, 2);
	      var standardDeviation = Math.sqrt(variance);
	      var hubThreshold = Math.floor(average + 2 * standardDeviation); // always have at least one to cluster

	      if (hubThreshold > largestHub) {
	        hubThreshold = largestHub;
	      }

	      return hubThreshold;
	    }
	    /**
	     * Create an edge for the cluster representation.
	     *
	     * @param {Node.id} fromId
	     * @param {Node.id} toId
	     * @param {vis.Edge} baseEdge
	     * @param {Object} clusterEdgeProperties
	     * @param {Object} extraOptions
	     * @returns {Edge} newly created clustered edge
	     * @private
	     */

	  }, {
	    key: "_createClusteredEdge",
	    value: function _createClusteredEdge(fromId, toId, baseEdge, clusterEdgeProperties, extraOptions) {
	      // copy the options of the edge we will replace
	      var clonedOptions = NetworkUtil.cloneOptions(baseEdge, 'edge'); // make sure the properties of clusterEdges are superimposed on it

	      deepExtend(clonedOptions, clusterEdgeProperties); // set up the edge

	      clonedOptions.from = fromId;
	      clonedOptions.to = toId;
	      clonedOptions.id = 'clusterEdge:' + uuid4(); // apply the edge specific options to it if specified

	      if (extraOptions !== undefined) {
	        deepExtend(clonedOptions, extraOptions);
	      }

	      var newEdge = this.body.functions.createEdge(clonedOptions);
	      newEdge.clusteringEdgeReplacingIds = [baseEdge.id];
	      newEdge.connect(); // Register the new edge

	      this.body.edges[newEdge.id] = newEdge;
	      return newEdge;
	    }
	    /**
	     * Add the passed child nodes and edges to the given cluster node.
	     *
	     * @param {Object|Node} childNodes  hash of nodes or single node to add in cluster
	     * @param {Object|Edge} childEdges  hash of edges or single edge to take into account when clustering
	     * @param {Node} clusterNode  cluster node to add nodes and edges to
	     * @param {Object} [clusterEdgeProperties]
	     * @private
	     */

	  }, {
	    key: "_clusterEdges",
	    value: function _clusterEdges(childNodes, childEdges, clusterNode, clusterEdgeProperties) {
	      if (childEdges instanceof Edge) {
	        var edge = childEdges;
	        var obj = {};
	        obj[edge.id] = edge;
	        childEdges = obj;
	      }

	      if (childNodes instanceof Node) {
	        var node = childNodes;
	        var _obj = {};
	        _obj[node.id] = node;
	        childNodes = _obj;
	      }

	      if (clusterNode === undefined || clusterNode === null) {
	        throw new Error("_clusterEdges: parameter clusterNode required");
	      }

	      if (clusterEdgeProperties === undefined) {
	        // Take the required properties from the cluster node
	        clusterEdgeProperties = clusterNode.clusterEdgeProperties;
	      } // create the new edges that will connect to the cluster.
	      // All self-referencing edges will be added to childEdges here.


	      this._createClusterEdges(childNodes, childEdges, clusterNode, clusterEdgeProperties); // disable the childEdges


	      for (var edgeId in childEdges) {
	        if (childEdges.hasOwnProperty(edgeId)) {
	          if (this.body.edges[edgeId] !== undefined) {
	            var _edge2 = this.body.edges[edgeId]; // cache the options before changing

	            this._backupEdgeOptions(_edge2); // disable physics and hide the edge


	            _edge2.setOptions({
	              physics: false
	            });
	          }
	        }
	      } // disable the childNodes


	      for (var nodeId in childNodes) {
	        if (childNodes.hasOwnProperty(nodeId)) {
	          this.clusteredNodes[nodeId] = {
	            clusterId: clusterNode.id,
	            node: this.body.nodes[nodeId]
	          };
	          this.body.nodes[nodeId].setOptions({
	            physics: false
	          });
	        }
	      }
	    }
	    /**
	     * Determine in which cluster given nodeId resides.
	     *
	     * If not in cluster, return undefined.
	     *
	     * NOTE: If you know a cleaner way to do this, please enlighten me (wimrijnders).
	     *
	     * @param {Node.id} nodeId
	     * @returns {Node|undefined} Node instance for cluster, if present
	     * @private
	     */

	  }, {
	    key: "_getClusterNodeForNode",
	    value: function _getClusterNodeForNode(nodeId) {
	      if (nodeId === undefined) return undefined;
	      var clusteredNode = this.clusteredNodes[nodeId]; // NOTE: If no cluster info found, it should actually be an error

	      if (clusteredNode === undefined) return undefined;
	      var clusterId = clusteredNode.clusterId;
	      if (clusterId === undefined) return undefined;
	      return this.body.nodes[clusterId];
	    }
	    /**
	     * Internal helper function for conditionally removing items in array
	     *
	     * Done like this because Array.filter() is not fully supported by all IE's.
	     *
	     * @param {Array} arr
	     * @param {function} callback
	     * @returns {Array}
	     * @private
	     */

	  }, {
	    key: "_filter",
	    value: function _filter(arr, callback) {
	      var ret = [];
	      forEach$3$1(arr, function (item) {
	        if (callback(item)) {
	          ret.push(item);
	        }
	      });
	      return ret;
	    }
	    /**
	     * Scan all edges for changes in clustering and adjust this if necessary.
	     *
	     * Call this (internally) after there has been a change in node or edge data.
	     *
	     * Pre: States of this.body.nodes and this.body.edges consistent
	     * Pre: this.clusteredNodes and this.clusteredEdge consistent with containedNodes and containedEdges
	     *      of cluster nodes.
	     */

	  }, {
	    key: "_updateState",
	    value: function _updateState() {
	      var _this4 = this;

	      var nodeId;
	      var deletedNodeIds = [];
	      var deletedEdgeIds = {};
	      /**
	       * Utility function to iterate over clustering nodes only
	       *
	       * @param {Function} callback  function to call for each cluster node
	       */

	      var eachClusterNode = function eachClusterNode(callback) {
	        forEach$3$1(_this4.body.nodes, function (node) {
	          if (node.isCluster === true) {
	            callback(node);
	          }
	        });
	      }; //
	      // Remove deleted regular nodes from clustering
	      //
	      // Determine the deleted nodes


	      for (nodeId in this.clusteredNodes) {
	        if (!this.clusteredNodes.hasOwnProperty(nodeId)) continue;
	        var node = this.body.nodes[nodeId];

	        if (node === undefined) {
	          deletedNodeIds.push(nodeId);
	        }
	      } // Remove nodes from cluster nodes


	      eachClusterNode(function (clusterNode) {
	        for (var n = 0; n < deletedNodeIds.length; n++) {
	          delete clusterNode.containedNodes[deletedNodeIds[n]];
	        }
	      }); // Remove nodes from cluster list

	      for (var n = 0; n < deletedNodeIds.length; n++) {
	        delete this.clusteredNodes[deletedNodeIds[n]];
	      } //
	      // Remove deleted edges from clustering
	      //
	      // Add the deleted clustered edges to the list


	      forEach$3$1(this.clusteredEdges, function (edgeId) {
	        var edge = _this4.body.edges[edgeId];

	        if (edge === undefined || !edge.endPointsValid()) {
	          deletedEdgeIds[edgeId] = edgeId;
	        }
	      }); // Cluster nodes can also contain edges which are not clustered, 
	      // i.e. nodes 1-2 within cluster with an edge in between.
	      // So the cluster nodes also need to be scanned for invalid edges

	      eachClusterNode(function (clusterNode) {
	        forEach$3$1(clusterNode.containedEdges, function (edge, edgeId) {
	          if (!edge.endPointsValid() && !deletedEdgeIds[edgeId]) {
	            deletedEdgeIds[edgeId] = edgeId;
	          }
	        });
	      }); // Also scan for cluster edges which need to be removed in the active list.
	      // Regular edges have been removed beforehand, so this only picks up the cluster edges.

	      forEach$3$1(this.body.edges, function (edge, edgeId) {
	        // Explicitly scan the contained edges for validity
	        var isValid = true;
	        var replacedIds = edge.clusteringEdgeReplacingIds;

	        if (replacedIds !== undefined) {
	          var numValid = 0;
	          forEach$3$1(replacedIds, function (containedEdgeId) {
	            var containedEdge = _this4.body.edges[containedEdgeId];

	            if (containedEdge !== undefined && containedEdge.endPointsValid()) {
	              numValid += 1;
	            }
	          });
	          isValid = numValid > 0;
	        }

	        if (!edge.endPointsValid() || !isValid) {
	          deletedEdgeIds[edgeId] = edgeId;
	        }
	      }); // Remove edges from cluster nodes

	      eachClusterNode(function (clusterNode) {
	        forEach$3$1(deletedEdgeIds, function (deletedEdgeId) {
	          delete clusterNode.containedEdges[deletedEdgeId];
	          forEach$3$1(clusterNode.edges, function (edge, m) {
	            if (edge.id === deletedEdgeId) {
	              clusterNode.edges[m] = null; // Don't want to directly delete here, because in the loop

	              return;
	            }

	            edge.clusteringEdgeReplacingIds = _this4._filter(edge.clusteringEdgeReplacingIds, function (id) {
	              return !deletedEdgeIds[id];
	            });
	          }); // Clean up the nulls

	          clusterNode.edges = _this4._filter(clusterNode.edges, function (item) {
	            return item !== null;
	          });
	        });
	      }); // Remove from cluster list

	      forEach$3$1(deletedEdgeIds, function (edgeId) {
	        delete _this4.clusteredEdges[edgeId];
	      }); // Remove cluster edges from active list (this.body.edges).
	      // deletedEdgeIds still contains id of regular edges, but these should all
	      // be gone when you reach here.

	      forEach$3$1(deletedEdgeIds, function (edgeId) {
	        delete _this4.body.edges[edgeId];
	      }); //
	      // Check changed cluster state of edges
	      //
	      // Iterating over keys here, because edges may be removed in the loop

	      var ids = keys$6(this.body.edges);

	      forEach$3$1(ids, function (edgeId) {
	        var edge = _this4.body.edges[edgeId];

	        var shouldBeClustered = _this4._isClusteredNode(edge.fromId) || _this4._isClusteredNode(edge.toId);

	        if (shouldBeClustered === _this4._isClusteredEdge(edge.id)) {
	          return; // all is well
	        }

	        if (shouldBeClustered) {
	          // add edge to clustering
	          var clusterFrom = _this4._getClusterNodeForNode(edge.fromId);

	          if (clusterFrom !== undefined) {
	            _this4._clusterEdges(_this4.body.nodes[edge.fromId], edge, clusterFrom);
	          }

	          var clusterTo = _this4._getClusterNodeForNode(edge.toId);

	          if (clusterTo !== undefined) {
	            _this4._clusterEdges(_this4.body.nodes[edge.toId], edge, clusterTo);
	          } // TODO: check that it works for both edges clustered
	          //       (This might be paranoia)

	        } else {
	          delete _this4._clusterEdges[edgeId];

	          _this4._restoreEdge(edge); // This should not be happening, the state should
	          // be properly updated at this point.
	          // 
	          // If it *is* reached during normal operation, then we have to implement
	          // undo clustering for this edge here.
	          // throw new Error('remove edge from clustering not implemented!')

	        }
	      }); // Clusters may be nested to any level. Keep on opening until nothing to open

	      var changed = false;
	      var continueLoop = true;

	      var _loop2 = function _loop2() {
	        var clustersToOpen = []; // Determine the id's of clusters that need opening

	        eachClusterNode(function (clusterNode) {
	          var numNodes = keys$6(clusterNode.containedNodes).length;

	          var allowSingle = clusterNode.options.allowSingleNodeCluster === true;

	          if (allowSingle && numNodes < 1 || !allowSingle && numNodes < 2) {
	            clustersToOpen.push(clusterNode.id);
	          }
	        }); // Open them

	        for (var _n = 0; _n < clustersToOpen.length; ++_n) {
	          _this4.openCluster(clustersToOpen[_n], {}, false
	          /* Don't refresh, we're in an refresh/update already */
	          );
	        }

	        continueLoop = clustersToOpen.length > 0;
	        changed = changed || continueLoop;
	      };

	      while (continueLoop) {
	        _loop2();
	      }

	      if (changed) {
	        this._updateState(); // Redo this method (recursion possible! should be safe)

	      }
	    }
	    /**
	     * Determine if node with given id is part of a cluster.
	     *
	     * @param {Node.id} nodeId
	     * @return {boolean} true if part of a cluster.
	     */

	  }, {
	    key: "_isClusteredNode",
	    value: function _isClusteredNode(nodeId) {
	      return this.clusteredNodes[nodeId] !== undefined;
	    }
	    /**
	     * Determine if edge with given id is not visible due to clustering.
	     *
	     * An edge is considered clustered if:
	     * - it is directly replaced by a clustering edge
	     * - any of its connecting nodes is in a cluster
	     *
	     * @param {vis.Edge.id} edgeId
	     * @return {boolean} true if part of a cluster.
	     */

	  }, {
	    key: "_isClusteredEdge",
	    value: function _isClusteredEdge(edgeId) {
	      return this.clusteredEdges[edgeId] !== undefined;
	    }
	  }]);

	  return ClusterEngine;
	}();

	/**
	 * Initializes window.requestAnimationFrame() to a usable form.
	 *
	 * Specifically, set up this method for the case of running on node.js with jsdom enabled.
	 *
	 * NOTES:
	 *
	 * * On node.js, when calling this directly outside of this class, `window` is not defined.
	 *   This happens even if jsdom is used.
	 * * For node.js + jsdom, `window` is available at the moment the constructor is called.
	 *   For this reason, the called is placed within the constructor.
	 * * Even then, `window.requestAnimationFrame()` is not defined, so it still needs to be added.
	 * * During unit testing, it happens that the window object is reset during execution, causing
	 *   a runtime error due to missing `requestAnimationFrame()`. This needs to be compensated for,
	 *   see `_requestNextFrame()`.
	 * * Since this is a global object, it may affect other modules besides `Network`. With normal
	 *   usage, this does not cause any problems. During unit testing, errors may occur. These have
	 *   been compensated for, see comment block in _requestNextFrame().
	 *
	 * @private
	 */
	function _initRequestAnimationFrame() {
	  var func;

	  if (window !== undefined) {
	    func = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;
	  }

	  if (func === undefined) {
	    // window or method not present, setting mock requestAnimationFrame
	    window.requestAnimationFrame = function (callback) {
	      //console.log("Called mock requestAnimationFrame");
	      callback();
	    };
	  } else {
	    window.requestAnimationFrame = func;
	  }
	}
	/**
	 * The canvas renderer
	 */

	var CanvasRenderer =
	/*#__PURE__*/
	function () {
	  /**
	   * @param {Object} body
	   * @param {Canvas} canvas
	   */
	  function CanvasRenderer(body, canvas) {
	    classCallCheck(this, CanvasRenderer);

	    _initRequestAnimationFrame();

	    this.body = body;
	    this.canvas = canvas;
	    this.redrawRequested = false;
	    this.renderTimer = undefined;
	    this.requiresTimeout = true;
	    this.renderingActive = false;
	    this.renderRequests = 0;
	    this.allowRedraw = true;
	    this.dragging = false;
	    this.zooming = false;
	    this.options = {};
	    this.defaultOptions = {
	      hideEdgesOnDrag: false,
	      hideEdgesOnZoom: false,
	      hideNodesOnDrag: false
	    };
	    extend(this.options, this.defaultOptions);

	    this._determineBrowserMethod();

	    this.bindEventListeners();
	  }
	  /**
	   * Binds event listeners
	   */


	  createClass(CanvasRenderer, [{
	    key: "bindEventListeners",
	    value: function bindEventListeners() {
	      var _this = this,
	          _context2;

	      this.body.emitter.on("dragStart", function () {
	        _this.dragging = true;
	      });
	      this.body.emitter.on("dragEnd", function () {
	        _this.dragging = false;
	      });
	      this.body.emitter.on("zoom", function () {
	        _this.zooming = true;
	        window.clearTimeout(_this.zoomTimeoutId);
	        _this.zoomTimeoutId = window.setTimeout(function () {
	          var _context;

	          _this.zooming = false;

	          bind$2(_context = _this._requestRedraw).call(_context, _this)();
	        }, 250);
	      });
	      this.body.emitter.on("_resizeNodes", function () {
	        _this._resizeNodes();
	      });
	      this.body.emitter.on("_redraw", function () {
	        if (_this.renderingActive === false) {
	          _this._redraw();
	        }
	      });
	      this.body.emitter.on("_blockRedraw", function () {
	        _this.allowRedraw = false;
	      });
	      this.body.emitter.on("_allowRedraw", function () {
	        _this.allowRedraw = true;
	        _this.redrawRequested = false;
	      });
	      this.body.emitter.on("_requestRedraw", bind$2(_context2 = this._requestRedraw).call(_context2, this));
	      this.body.emitter.on("_startRendering", function () {
	        _this.renderRequests += 1;
	        _this.renderingActive = true;

	        _this._startRendering();
	      });
	      this.body.emitter.on("_stopRendering", function () {
	        _this.renderRequests -= 1;
	        _this.renderingActive = _this.renderRequests > 0;
	        _this.renderTimer = undefined;
	      });
	      this.body.emitter.on('destroy', function () {
	        _this.renderRequests = 0;
	        _this.allowRedraw = false;
	        _this.renderingActive = false;

	        if (_this.requiresTimeout === true) {
	          clearTimeout(_this.renderTimer);
	        } else {
	          window.cancelAnimationFrame(_this.renderTimer);
	        }

	        _this.body.emitter.off();
	      });
	    }
	    /**
	     *
	     * @param {Object} options
	     */

	  }, {
	    key: "setOptions",
	    value: function setOptions(options) {
	      if (options !== undefined) {
	        var fields = ['hideEdgesOnDrag', 'hideEdgesOnZoom', 'hideNodesOnDrag'];
	        selectiveDeepExtend(fields, this.options, options);
	      }
	    }
	    /**
	     * Prepare the drawing of the next frame.
	     *
	     * Calls the callback when the next frame can or will be drawn.
	     *
	     * @param {function} callback
	     * @param {number} delay - timeout case only, wait this number of milliseconds
	     * @returns {function|undefined}
	     * @private
	     */

	  }, {
	    key: "_requestNextFrame",
	    value: function _requestNextFrame(callback, delay) {
	      // During unit testing, it happens that the mock window object is reset while
	      // the next frame is still pending. Then, either 'window' is not present, or
	      // 'requestAnimationFrame()' is not present because it is not defined on the
	      // mock window object.
	      //
	      // As a consequence, unrelated unit tests may appear to fail, even if the problem
	      // described happens in the current unit test.
	      //
	      // This is not something that will happen in normal operation, but we still need
	      // to take it into account.
	      //
	      if (typeof window === 'undefined') return; // Doing `if (window === undefined)` does not work here!

	      var timer;
	      var myWindow = window; // Grab a reference to reduce the possibility that 'window' is reset
	      // while running this method.

	      if (this.requiresTimeout === true) {
	        // wait given number of milliseconds and perform the animation step function
	        timer = myWindow.setTimeout(callback, delay);
	      } else {
	        if (myWindow.requestAnimationFrame) {
	          timer = myWindow.requestAnimationFrame(callback);
	        }
	      }

	      return timer;
	    }
	    /**
	     *
	     * @private
	     */

	  }, {
	    key: "_startRendering",
	    value: function _startRendering() {
	      if (this.renderingActive === true) {
	        if (this.renderTimer === undefined) {
	          var _context3;

	          this.renderTimer = this._requestNextFrame(bind$2(_context3 = this._renderStep).call(_context3, this), this.simulationInterval);
	        }
	      }
	    }
	    /**
	     *
	     * @private
	     */

	  }, {
	    key: "_renderStep",
	    value: function _renderStep() {
	      if (this.renderingActive === true) {
	        // reset the renderTimer so a new scheduled animation step can be set
	        this.renderTimer = undefined;

	        if (this.requiresTimeout === true) {
	          // this schedules a new simulation step
	          this._startRendering();
	        }

	        this._redraw();

	        if (this.requiresTimeout === false) {
	          // this schedules a new simulation step
	          this._startRendering();
	        }
	      }
	    }
	    /**
	     * Redraw the network with the current data
	     * chart will be resized too.
	     */

	  }, {
	    key: "redraw",
	    value: function redraw() {
	      this.body.emitter.emit('setSize');

	      this._redraw();
	    }
	    /**
	     * Redraw the network with the current data
	     * @private
	     */

	  }, {
	    key: "_requestRedraw",
	    value: function _requestRedraw() {
	      var _this2 = this;

	      if (this.redrawRequested !== true && this.renderingActive === false && this.allowRedraw === true) {
	        this.redrawRequested = true;

	        this._requestNextFrame(function () {
	          _this2._redraw(false);
	        }, 0);
	      }
	    }
	    /**
	     * Redraw the network with the current data
	     * @param {boolean} [hidden=false] | Used to get the first estimate of the node sizes.
	     *                                   Only the nodes are drawn after which they are quickly drawn over.
	     * @private
	     */

	  }, {
	    key: "_redraw",
	    value: function _redraw() {
	      var hidden = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;

	      if (this.allowRedraw === true) {
	        this.body.emitter.emit("initRedraw");
	        this.redrawRequested = false; // when the container div was hidden, this fixes it back up!

	        if (this.canvas.frame.canvas.width === 0 || this.canvas.frame.canvas.height === 0) {
	          this.canvas.setSize();
	        }

	        this.canvas.setTransform();
	        var ctx = this.canvas.getContext(); // clear the canvas

	        var w = this.canvas.frame.canvas.clientWidth;
	        var h = this.canvas.frame.canvas.clientHeight;
	        ctx.clearRect(0, 0, w, h); // if the div is hidden, we stop the redraw here for performance.

	        if (this.canvas.frame.clientWidth === 0) {
	          return;
	        } // set scaling and translation


	        ctx.save();
	        ctx.translate(this.body.view.translation.x, this.body.view.translation.y);
	        ctx.scale(this.body.view.scale, this.body.view.scale);
	        ctx.beginPath();
	        this.body.emitter.emit("beforeDrawing", ctx);
	        ctx.closePath();

	        if (hidden === false) {
	          if ((this.dragging === false || this.dragging === true && this.options.hideEdgesOnDrag === false) && (this.zooming === false || this.zooming === true && this.options.hideEdgesOnZoom === false)) {
	            this._drawEdges(ctx);
	          }
	        }

	        if (this.dragging === false || this.dragging === true && this.options.hideNodesOnDrag === false) {
	          this._drawNodes(ctx, hidden);
	        }

	        ctx.beginPath();
	        this.body.emitter.emit("afterDrawing", ctx);
	        ctx.closePath(); // restore original scaling and translation

	        ctx.restore();

	        if (hidden === true) {
	          ctx.clearRect(0, 0, w, h);
	        }
	      }
	    }
	    /**
	     * Redraw all nodes
	     *
	     * @param {CanvasRenderingContext2D}   ctx
	     * @param {boolean} [alwaysShow]
	     * @private
	     */

	  }, {
	    key: "_resizeNodes",
	    value: function _resizeNodes() {
	      this.canvas.setTransform();
	      var ctx = this.canvas.getContext();
	      ctx.save();
	      ctx.translate(this.body.view.translation.x, this.body.view.translation.y);
	      ctx.scale(this.body.view.scale, this.body.view.scale);
	      var nodes = this.body.nodes;
	      var node; // resize all nodes

	      for (var nodeId in nodes) {
	        if (nodes.hasOwnProperty(nodeId)) {
	          node = nodes[nodeId];
	          node.resize(ctx);
	          node.updateBoundingBox(ctx, node.selected);
	        }
	      } // restore original scaling and translation


	      ctx.restore();
	    }
	    /**
	     * Redraw all nodes
	     *
	     * @param {CanvasRenderingContext2D} ctx  2D context of a HTML canvas
	     * @param {boolean} [alwaysShow]
	     * @private
	     */

	  }, {
	    key: "_drawNodes",
	    value: function _drawNodes(ctx) {
	      var alwaysShow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
	      var nodes = this.body.nodes;
	      var nodeIndices = this.body.nodeIndices;
	      var node;
	      var selected = [];
	      var margin = 20;
	      var topLeft = this.canvas.DOMtoCanvas({
	        x: -margin,
	        y: -margin
	      });
	      var bottomRight = this.canvas.DOMtoCanvas({
	        x: this.canvas.frame.canvas.clientWidth + margin,
	        y: this.canvas.frame.canvas.clientHeight + margin
	      });
	      var viewableArea = {
	        top: topLeft.y,
	        left: topLeft.x,
	        bottom: bottomRight.y,
	        right: bottomRight.x
	      }; // draw unselected nodes;

	      for (var i = 0; i < nodeIndices.length; i++) {
	        node = nodes[nodeIndices[i]]; // set selected nodes aside

	        if (node.isSelected()) {
	          selected.push(nodeIndices[i]);
	        } else {
	          if (alwaysShow === true) {
	            node.draw(ctx);
	          } else if (node.isBoundingBoxOverlappingWith(viewableArea) === true) {
	            node.draw(ctx);
	          } else {
	            node.updateBoundingBox(ctx, node.selected);
	          }
	        }
	      } // draw the selected nodes on top


	      for (var _i = 0; _i < selected.length; _i++) {
	        node = nodes[selected[_i]];
	        node.draw(ctx);
	      }
	    }
	    /**
	     * Redraw all edges
	     * @param {CanvasRenderingContext2D} ctx  2D context of a HTML canvas
	     * @private
	     */

	  }, {
	    key: "_drawEdges",
	    value: function _drawEdges(ctx) {
	      var edges = this.body.edges;
	      var edgeIndices = this.body.edgeIndices;
	      var edge;

	      for (var i = 0; i < edgeIndices.length; i++) {
	        edge = edges[edgeIndices[i]];

	        if (edge.connected === true) {
	          edge.draw(ctx);
	        }
	      }
	    }
	    /**
	     * Determine if the browser requires a setTimeout or a requestAnimationFrame. This was required because
	     * some implementations (safari and IE9) did not support requestAnimationFrame
	     * @private
	     */

	  }, {
	    key: "_determineBrowserMethod",
	    value: function _determineBrowserMethod() {
	      if (typeof window !== 'undefined') {
	        var browserType = navigator.userAgent.toLowerCase();
	        this.requiresTimeout = false;

	        if (indexOf$3(browserType).call(browserType, 'msie 9.0') != -1) {
	          // IE 9
	          this.requiresTimeout = true;
	        } else if (indexOf$3(browserType).call(browserType, 'safari') != -1) {
	          // safari
	          if (indexOf$3(browserType).call(browserType, 'chrome') <= -1) {
	            this.requiresTimeout = true;
	          }
	        }
	      } else {
	        this.requiresTimeout = true;
	      }
	    }
	  }]);

	  return CanvasRenderer;
	}();

	var setInterval = path.setInterval;

	var setInterval$1 = setInterval;

	var hammerUtil = createCommonjsModule(function (module, exports) {
	  /**
	   * Register a touch event, taking place before a gesture
	   * @param {Hammer} hammer       A hammer instance
	   * @param {function} callback   Callback, called as callback(event)
	   */
	  exports.onTouch = function (hammer, callback) {
	    callback.inputHandler = function (event) {
	      if (event.isFirst) {
	        callback(event);
	      }
	    };

	    hammer.on('hammer.input', callback.inputHandler);
	  };
	  /**
	   * Register a release event, taking place after a gesture
	   * @param {Hammer} hammer       A hammer instance
	   * @param {function} callback   Callback, called as callback(event)
	   * @returns {*}
	   */


	  exports.onRelease = function (hammer, callback) {
	    callback.inputHandler = function (event) {
	      if (event.isFinal) {
	        callback(event);
	      }
	    };

	    return hammer.on('hammer.input', callback.inputHandler);
	  };
	  /**
	   * Unregister a touch event, taking place before a gesture
	   * @param {Hammer} hammer       A hammer instance
	   * @param {function} callback   Callback, called as callback(event)
	   */


	  exports.offTouch = function (hammer, callback) {
	    hammer.off('hammer.input', callback.inputHandler);
	  };
	  /**
	   * Unregister a release event, taking place before a gesture
	   * @param {Hammer} hammer       A hammer instance
	   * @param {function} callback   Callback, called as callback(event)
	   */


	  exports.offRelease = exports.offTouch;
	  /**
	   * Hack the PinchRecognizer such that it doesn't prevent default behavior
	   * for vertical panning.
	   *
	   * Yeah ... this is quite a hack ... see https://github.com/hammerjs/hammer.js/issues/932
	   *
	   * @param {Hammer.Pinch} pinchRecognizer
	   * @return {Hammer.Pinch} returns the pinchRecognizer
	   */

	  exports.disablePreventDefaultVertically = function (pinchRecognizer) {
	    var TOUCH_ACTION_PAN_Y = 'pan-y';

	    pinchRecognizer.getTouchAction = function () {
	      // default method returns [TOUCH_ACTION_NONE]
	      return [TOUCH_ACTION_PAN_Y];
	    };

	    return pinchRecognizer;
	  };
	});
	var hammerUtil_1 = hammerUtil.onTouch;
	var hammerUtil_2 = hammerUtil.onRelease;
	var hammerUtil_3 = hammerUtil.offTouch;
	var hammerUtil_4 = hammerUtil.offRelease;
	var hammerUtil_5 = hammerUtil.disablePreventDefaultVertically;

	/**
	 * Create the main frame for the Network.
	 * This function is executed once when a Network object is created. The frame
	 * contains a canvas, and this canvas contains all objects like the axis and
	 * nodes.
	 */

	var Canvas =
	/*#__PURE__*/
	function () {
	  /**
	   * @param {Object} body
	   */
	  function Canvas(body) {
	    var _context;

	    classCallCheck(this, Canvas);

	    this.body = body;
	    this.pixelRatio = 1;
	    this.resizeTimer = undefined;
	    this.resizeFunction = bind$2(_context = this._onResize).call(_context, this);
	    this.cameraState = {};
	    this.initialized = false;
	    this.canvasViewCenter = {};
	    this.options = {};
	    this.defaultOptions = {
	      autoResize: true,
	      height: '100%',
	      width: '100%'
	    };
	    extend(this.options, this.defaultOptions);
	    this.bindEventListeners();
	  }
	  /**
	   * Binds event listeners
	   */


	  createClass(Canvas, [{
	    key: "bindEventListeners",
	    value: function bindEventListeners() {
	      var _this = this,
	          _context2;

	      // bind the events
	      this.body.emitter.once("resize", function (obj) {
	        if (obj.width !== 0) {
	          _this.body.view.translation.x = obj.width * 0.5;
	        }

	        if (obj.height !== 0) {
	          _this.body.view.translation.y = obj.height * 0.5;
	        }
	      });
	      this.body.emitter.on("setSize", bind$2(_context2 = this.setSize).call(_context2, this));
	      this.body.emitter.on("destroy", function () {
	        _this.hammerFrame.destroy();

	        _this.hammer.destroy();

	        _this._cleanUp();
	      });
	    }
	    /**
	     * @param {Object} options
	     */

	  }, {
	    key: "setOptions",
	    value: function setOptions(options) {
	      var _this2 = this;

	      if (options !== undefined) {
	        var fields = ['width', 'height', 'autoResize'];
	        selectiveDeepExtend(fields, this.options, options);
	      }

	      if (this.options.autoResize === true) {
	        var _context3;

	        // automatically adapt to a changing size of the browser.
	        this._cleanUp();

	        this.resizeTimer = setInterval$1(function () {
	          var changed = _this2.setSize();

	          if (changed === true) {
	            _this2.body.emitter.emit("_requestRedraw");
	          }
	        }, 1000);
	        this.resizeFunction = bind$2(_context3 = this._onResize).call(_context3, this);
	        addEventListener(window, 'resize', this.resizeFunction);
	      }
	    }
	    /**
	     * @private
	     */

	  }, {
	    key: "_cleanUp",
	    value: function _cleanUp() {
	      // automatically adapt to a changing size of the browser.
	      if (this.resizeTimer !== undefined) {
	        clearInterval(this.resizeTimer);
	      }

	      removeEventListener(window, 'resize', this.resizeFunction);
	      this.resizeFunction = undefined;
	    }
	    /**
	     * @private
	     */

	  }, {
	    key: "_onResize",
	    value: function _onResize() {
	      this.setSize();
	      this.body.emitter.emit("_redraw");
	    }
	    /**
	     * Get and store the cameraState
	     *
	     * @param {number} [pixelRatio=this.pixelRatio]
	     * @private
	     */

	  }, {
	    key: "_getCameraState",
	    value: function _getCameraState() {
	      var pixelRatio = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.pixelRatio;

	      if (this.initialized === true) {
	        this.cameraState.previousWidth = this.frame.canvas.width / pixelRatio;
	        this.cameraState.previousHeight = this.frame.canvas.height / pixelRatio;
	        this.cameraState.scale = this.body.view.scale;
	        this.cameraState.position = this.DOMtoCanvas({
	          x: 0.5 * this.frame.canvas.width / pixelRatio,
	          y: 0.5 * this.frame.canvas.height / pixelRatio
	        });
	      }
	    }
	    /**
	     * Set the cameraState
	     * @private
	     */

	  }, {
	    key: "_setCameraState",
	    value: function _setCameraState() {
	      if (this.cameraState.scale !== undefined && this.frame.canvas.clientWidth !== 0 && this.frame.canvas.clientHeight !== 0 && this.pixelRatio !== 0 && this.cameraState.previousWidth > 0) {
	        var widthRatio = this.frame.canvas.width / this.pixelRatio / this.cameraState.previousWidth;
	        var heightRatio = this.frame.canvas.height / this.pixelRatio / this.cameraState.previousHeight;
	        var newScale = this.cameraState.scale;

	        if (widthRatio != 1 && heightRatio != 1) {
	          newScale = this.cameraState.scale * 0.5 * (widthRatio + heightRatio);
	        } else if (widthRatio != 1) {
	          newScale = this.cameraState.scale * widthRatio;
	        } else if (heightRatio != 1) {
	          newScale = this.cameraState.scale * heightRatio;
	        }

	        this.body.view.scale = newScale; // this comes from the view module.

	        var currentViewCenter = this.DOMtoCanvas({
	          x: 0.5 * this.frame.canvas.clientWidth,
	          y: 0.5 * this.frame.canvas.clientHeight
	        });
	        var distanceFromCenter = {
	          // offset from view, distance view has to change by these x and y to center the node
	          x: currentViewCenter.x - this.cameraState.position.x,
	          y: currentViewCenter.y - this.cameraState.position.y
	        };
	        this.body.view.translation.x += distanceFromCenter.x * this.body.view.scale;
	        this.body.view.translation.y += distanceFromCenter.y * this.body.view.scale;
	      }
	    }
	    /**
	     *
	     * @param {number|string} value
	     * @returns {string}
	     * @private
	     */

	  }, {
	    key: "_prepareValue",
	    value: function _prepareValue(value) {
	      if (typeof value === 'number') {
	        return value + 'px';
	      } else if (typeof value === 'string') {
	        if (indexOf$3(value).call(value, '%') !== -1 || indexOf$3(value).call(value, 'px') !== -1) {
	          return value;
	        } else if (indexOf$3(value).call(value, '%') === -1) {
	          return value + 'px';
	        }
	      }

	      throw new Error('Could not use the value supplied for width or height:' + value);
	    }
	    /**
	     * Create the HTML
	     */

	  }, {
	    key: "_create",
	    value: function _create() {
	      // remove all elements from the container element.
	      while (this.body.container.hasChildNodes()) {
	        this.body.container.removeChild(this.body.container.firstChild);
	      }

	      this.frame = document.createElement('div');
	      this.frame.className = 'vis-network';
	      this.frame.style.position = 'relative';
	      this.frame.style.overflow = 'hidden';
	      this.frame.tabIndex = 900; // tab index is required for keycharm to bind keystrokes to the div instead of the window
	      //////////////////////////////////////////////////////////////////

	      this.frame.canvas = document.createElement("canvas");
	      this.frame.canvas.style.position = 'relative';
	      this.frame.appendChild(this.frame.canvas);

	      if (!this.frame.canvas.getContext) {
	        var noCanvas = document.createElement('DIV');
	        noCanvas.style.color = 'red';
	        noCanvas.style.fontWeight = 'bold';
	        noCanvas.style.padding = '10px';
	        noCanvas.innerHTML = 'Error: your browser does not support HTML canvas';
	        this.frame.canvas.appendChild(noCanvas);
	      } else {
	        this._setPixelRatio();

	        this.setTransform();
	      } // add the frame to the container element


	      this.body.container.appendChild(this.frame);
	      this.body.view.scale = 1;
	      this.body.view.translation = {
	        x: 0.5 * this.frame.canvas.clientWidth,
	        y: 0.5 * this.frame.canvas.clientHeight
	      };

	      this._bindHammer();
	    }
	    /**
	     * This function binds hammer, it can be repeated over and over due to the uniqueness check.
	     * @private
	     */

	  }, {
	    key: "_bindHammer",
	    value: function _bindHammer() {
	      var _this3 = this;

	      if (this.hammer !== undefined) {
	        this.hammer.destroy();
	      }

	      this.drag = {};
	      this.pinch = {}; // init hammer

	      this.hammer = new hammer(this.frame.canvas);
	      this.hammer.get('pinch').set({
	        enable: true
	      }); // enable to get better response, todo: test on mobile.

	      this.hammer.get('pan').set({
	        threshold: 5,
	        direction: hammer.DIRECTION_ALL
	      });
	      hammerUtil.onTouch(this.hammer, function (event) {
	        _this3.body.eventListeners.onTouch(event);
	      });
	      this.hammer.on('tap', function (event) {
	        _this3.body.eventListeners.onTap(event);
	      });
	      this.hammer.on('doubletap', function (event) {
	        _this3.body.eventListeners.onDoubleTap(event);
	      });
	      this.hammer.on('press', function (event) {
	        _this3.body.eventListeners.onHold(event);
	      });
	      this.hammer.on('panstart', function (event) {
	        _this3.body.eventListeners.onDragStart(event);
	      });
	      this.hammer.on('panmove', function (event) {
	        _this3.body.eventListeners.onDrag(event);
	      });
	      this.hammer.on('panend', function (event) {
	        _this3.body.eventListeners.onDragEnd(event);
	      });
	      this.hammer.on('pinch', function (event) {
	        _this3.body.eventListeners.onPinch(event);
	      }); // TODO: neatly cleanup these handlers when re-creating the Canvas, IF these are done with hammer, event.stopPropagation will not work?

	      this.frame.canvas.addEventListener('wheel', function (event) {
	        _this3.body.eventListeners.onMouseWheel(event);
	      });
	      this.frame.canvas.addEventListener('mousemove', function (event) {
	        _this3.body.eventListeners.onMouseMove(event);
	      });
	      this.frame.canvas.addEventListener('contextmenu', function (event) {
	        _this3.body.eventListeners.onContext(event);
	      });
	      this.hammerFrame = new hammer(this.frame);
	      hammerUtil.onRelease(this.hammerFrame, function (event) {
	        _this3.body.eventListeners.onRelease(event);
	      });
	    }
	    /**
	     * Set a new size for the network
	     * @param {string} width   Width in pixels or percentage (for example '800px'
	     *                         or '50%')
	     * @param {string} height  Height in pixels or percentage  (for example '400px'
	     *                         or '30%')
	     * @returns {boolean}
	     */

	  }, {
	    key: "setSize",
	    value: function setSize() {
	      var width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.options.width;
	      var height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.options.height;
	      width = this._prepareValue(width);
	      height = this._prepareValue(height);
	      var emitEvent = false;
	      var oldWidth = this.frame.canvas.width;
	      var oldHeight = this.frame.canvas.height; // update the pixel ratio
	      //
	      // NOTE: Comment in following is rather inconsistent; this is the ONLY place in the code
	      //       where it is assumed that the pixel ratio could change at runtime.
	      //       The only way I can think of this happening is a rotating screen or tablet; but then
	      //       there should be a mechanism for reloading the data (TODO: check if this is present).
	      //
	      //       If the assumption is true (i.e. pixel ratio can change at runtime), then *all* usage
	      //       of pixel ratio must be overhauled for this.
	      //
	      //       For the time being, I will humor the assumption here, and in the rest of the code assume it is
	      //       constant.

	      var previousRatio = this.pixelRatio; // we cache this because the camera state storage needs the old value

	      this._setPixelRatio();

	      if (width != this.options.width || height != this.options.height || this.frame.style.width != width || this.frame.style.height != height) {
	        this._getCameraState(previousRatio);

	        this.frame.style.width = width;
	        this.frame.style.height = height;
	        this.frame.canvas.style.width = '100%';
	        this.frame.canvas.style.height = '100%';
	        this.frame.canvas.width = Math.round(this.frame.canvas.clientWidth * this.pixelRatio);
	        this.frame.canvas.height = Math.round(this.frame.canvas.clientHeight * this.pixelRatio);
	        this.options.width = width;
	        this.options.height = height;
	        this.canvasViewCenter = {
	          x: 0.5 * this.frame.clientWidth,
	          y: 0.5 * this.frame.clientHeight
	        };
	        emitEvent = true;
	      } else {
	        // this would adapt the width of the canvas to the width from 100% if and only if
	        // there is a change.
	        var newWidth = Math.round(this.frame.canvas.clientWidth * this.pixelRatio);
	        var newHeight = Math.round(this.frame.canvas.clientHeight * this.pixelRatio); // store the camera if there is a change in size.

	        if (this.frame.canvas.width !== newWidth || this.frame.canvas.height !== newHeight) {
	          this._getCameraState(previousRatio);
	        }

	        if (this.frame.canvas.width !== newWidth) {
	          this.frame.canvas.width = newWidth;
	          emitEvent = true;
	        }

	        if (this.frame.canvas.height !== newHeight) {
	          this.frame.canvas.height = newHeight;
	          emitEvent = true;
	        }
	      }

	      if (emitEvent === true) {
	        this.body.emitter.emit('resize', {
	          width: Math.round(this.frame.canvas.width / this.pixelRatio),
	          height: Math.round(this.frame.canvas.height / this.pixelRatio),
	          oldWidth: Math.round(oldWidth / this.pixelRatio),
	          oldHeight: Math.round(oldHeight / this.pixelRatio)
	        }); // restore the camera on change.

	        this._setCameraState();
	      } // set initialized so the get and set camera will work from now on.


	      this.initialized = true;
	      return emitEvent;
	    }
	    /**
	     *
	     * @returns {CanvasRenderingContext2D}
	     */

	  }, {
	    key: "getContext",
	    value: function getContext() {
	      return this.frame.canvas.getContext("2d");
	    }
	    /**
	     * Determine the pixel ratio for various browsers.
	     *
	     * @returns {number}
	     * @private
	     */

	  }, {
	    key: "_determinePixelRatio",
	    value: function _determinePixelRatio() {
	      var ctx = this.getContext();

	      if (ctx === undefined) {
	        throw new Error("Could not get canvax context");
	      }

	      var numerator = 1;

	      if (typeof window !== 'undefined') {
	        // (window !== undefined) doesn't work here!
	        // Protection during unit tests, where 'window' can be missing
	        numerator = window.devicePixelRatio || 1;
	      }

	      var denominator = ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1;
	      return numerator / denominator;
	    }
	    /**
	     * Lazy determination of pixel ratio.
	     *
	     * @private
	     */

	  }, {
	    key: "_setPixelRatio",
	    value: function _setPixelRatio() {
	      this.pixelRatio = this._determinePixelRatio();
	    }
	    /**
	     * Set the transform in the contained context, based on its pixelRatio
	     */

	  }, {
	    key: "setTransform",
	    value: function setTransform() {
	      var ctx = this.getContext();

	      if (ctx === undefined) {
	        throw new Error("Could not get canvax context");
	      }

	      ctx.setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0);
	    }
	    /**
	     * Convert the X coordinate in DOM-space (coordinate point in browser relative to the container div) to
	     * the X coordinate in canvas-space (the simulation sandbox, which the camera looks upon)
	     * @param {number} x
	     * @returns {number}
	     * @private
	     */

	  }, {
	    key: "_XconvertDOMtoCanvas",
	    value: function _XconvertDOMtoCanvas(x) {
	      return (x - this.body.view.translation.x) / this.body.view.scale;
	    }
	    /**
	     * Convert the X coordinate in canvas-space (the simulation sandbox, which the camera looks upon) to
	     * the X coordinate in DOM-space (coordinate point in browser relative to the container div)
	     * @param {number} x
	     * @returns {number}
	     * @private
	     */

	  }, {
	    key: "_XconvertCanvasToDOM",
	    value: function _XconvertCanvasToDOM(x) {
	      return x * this.body.view.scale + this.body.view.translation.x;
	    }
	    /**
	     * Convert the Y coordinate in DOM-space (coordinate point in browser relative to the container div) to
	     * the Y coordinate in canvas-space (the simulation sandbox, which the camera looks upon)
	     * @param {number} y
	     * @returns {number}
	     * @private
	     */

	  }, {
	    key: "_YconvertDOMtoCanvas",
	    value: function _YconvertDOMtoCanvas(y) {
	      return (y - this.body.view.translation.y) / this.body.view.scale;
	    }
	    /**
	     * Convert the Y coordinate in canvas-space (the simulation sandbox, which the camera looks upon) to
	     * the Y coordinate in DOM-space (coordinate point in browser relative to the container div)
	     * @param {number} y
	     * @returns {number}
	     * @private
	     */

	  }, {
	    key: "_YconvertCanvasToDOM",
	    value: function _YconvertCanvasToDOM(y) {
	      return y * this.body.view.scale + this.body.view.translation.y;
	    }
	    /**
	     * @param {point} pos
	     * @returns {point}
	     */

	  }, {
	    key: "canvasToDOM",
	    value: function canvasToDOM(pos) {
	      return {
	        x: this._XconvertCanvasToDOM(pos.x),
	        y: this._YconvertCanvasToDOM(pos.y)
	      };
	    }
	    /**
	     *
	     * @param {point} pos
	     * @returns {point}
	     */

	  }, {
	    key: "DOMtoCanvas",
	    value: function DOMtoCanvas(pos) {
	      return {
	        x: this._XconvertDOMtoCanvas(pos.x),
	        y: this._YconvertDOMtoCanvas(pos.y)
	      };
	    }
	  }]);

	  return Canvas;
	}();

	var globalIsFinite = global_1.isFinite;

	// `Number.isFinite` method
	// https://tc39.github.io/ecma262/#sec-number.isfinite
	var numberIsFinite = Number.isFinite || function isFinite(it) {
	  return typeof it == 'number' && globalIsFinite(it);
	};

	// `Number.isFinite` method
	// https://tc39.github.io/ecma262/#sec-number.isfinite
	_export({ target: 'Number', stat: true }, { isFinite: numberIsFinite });

	var _isFinite = path.Number.isFinite;

	var _isFinite$1 = _isFinite;

	var _isFinite$2 = _isFinite$1;

	/**
	 * The view
	 */

	var View =
	/*#__PURE__*/
	function () {
	  /**
	   * @param {Object} body
	   * @param {Canvas} canvas
	   */
	  function View(body, canvas) {
	    var _context,
	        _this = this,
	        _context2;

	    classCallCheck(this, View);

	    this.body = body;
	    this.canvas = canvas;
	    this.animationSpeed = 1 / this.renderRefreshRate;
	    this.animationEasingFunction = "easeInOutQuint";
	    this.easingTime = 0;
	    this.sourceScale = 0;
	    this.targetScale = 0;
	    this.sourceTranslation = 0;
	    this.targetTranslation = 0;
	    this.lockedOnNodeId = undefined;
	    this.lockedOnNodeOffset = undefined;
	    this.touchTime = 0;
	    this.viewFunction = undefined;
	    this.body.emitter.on("fit", bind$2(_context = this.fit).call(_context, this));
	    this.body.emitter.on("animationFinished", function () {
	      _this.body.emitter.emit("_stopRendering");
	    });
	    this.body.emitter.on("unlockNode", bind$2(_context2 = this.releaseNode).call(_context2, this));
	  }
	  /**
	   *
	   * @param {Object} [options={}]
	   */


	  createClass(View, [{
	    key: "setOptions",
	    value: function setOptions() {
	      var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
	      this.options = options;
	    }
	    /**
	     * This function zooms out to fit all data on screen based on amount of nodes
	     * @param {Object} [options={{nodes=Array}}]
	     * @param {boolean} [initialZoom=false]  | zoom based on fitted formula or range, true = fitted, default = false;
	     */

	  }, {
	    key: "fit",
	    value: function fit() {
	      var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
	        nodes: []
	      };
	      var initialZoom = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
	      var range;
	      var zoomLevel;
	      options = assign$2({}, options);

	      if (options.nodes === undefined || options.nodes.length === 0) {
	        options.nodes = this.body.nodeIndices;
	      }

	      if (initialZoom === true) {
	        // check if more than half of the nodes have a predefined position. If so, we use the range, not the approximation.
	        var positionDefined = 0;

	        for (var nodeId in this.body.nodes) {
	          if (this.body.nodes.hasOwnProperty(nodeId)) {
	            var node = this.body.nodes[nodeId];

	            if (node.predefinedPosition === true) {
	              positionDefined += 1;
	            }
	          }
	        }

	        if (positionDefined > 0.5 * this.body.nodeIndices.length) {
	          this.fit(options, false);
	          return;
	        }

	        range = NetworkUtil.getRange(this.body.nodes, options.nodes);
	        var numberOfNodes = this.body.nodeIndices.length;
	        zoomLevel = 12.662 / (numberOfNodes + 7.4147) + 0.0964822; // this is obtained from fitting a dataset from 5 points with scale levels that looked good.
	        // correct for larger canvasses.

	        var factor = Math.min(this.canvas.frame.canvas.clientWidth / 600, this.canvas.frame.canvas.clientHeight / 600);
	        zoomLevel *= factor;
	      } else {
	        this.body.emitter.emit("_resizeNodes");
	        range = NetworkUtil.getRange(this.body.nodes, options.nodes);
	        var xDistance = Math.abs(range.maxX - range.minX) * 1.1;
	        var yDistance = Math.abs(range.maxY - range.minY) * 1.1;
	        var xZoomLevel = this.canvas.frame.canvas.clientWidth / xDistance;
	        var yZoomLevel = this.canvas.frame.canvas.clientHeight / yDistance;
	        zoomLevel = xZoomLevel <= yZoomLevel ? xZoomLevel : yZoomLevel;
	      }

	      if (zoomLevel > 1.0) {
	        zoomLevel = 1.0;
	      } else if (zoomLevel === 0) {
	        zoomLevel = 1.0;
	      }

	      var center = NetworkUtil.findCenter(range);
	      var animationOptions = {
	        position: center,
	        scale: zoomLevel,
	        animation: options.animation
	      };
	      this.moveTo(animationOptions);
	    } // animation

	    /**
	     * Center a node in view.
	     *
	     * @param {number} nodeId
	     * @param {number} [options]
	     */

	  }, {
	    key: "focus",
	    value: function focus(nodeId) {
	      var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

	      if (this.body.nodes[nodeId] !== undefined) {
	        var nodePosition = {
	          x: this.body.nodes[nodeId].x,
	          y: this.body.nodes[nodeId].y
	        };
	        options.position = nodePosition;
	        options.lockedOnNode = nodeId;
	        this.moveTo(options);
	      } else {
	        console.log("Node: " + nodeId + " cannot be found.");
	      }
	    }
	    /**
	     *
	     * @param {Object} options  |  options.offset   = {x:number, y:number}   // offset from the center in DOM pixels
	     *                          |  options.scale    = number                 // scale to move to
	     *                          |  options.position = {x:number, y:number}   // position to move to
	     *                          |  options.animation = {duration:number, easingFunction:String} || Boolean   // position to move to
	     */

	  }, {
	    key: "moveTo",
	    value: function moveTo(options) {
	      if (options === undefined) {
	        options = {};
	        return;
	      }

	      if (options.offset != null) {
	        if (options.offset.x != null) {
	          // Coerce and verify that x is valid.
	          options.offset.x = +options.offset.x;

	          if (!_isFinite$2(options.offset.x)) {
	            throw new TypeError('The option "offset.x" has to be a finite number.');
	          }
	        } else {
	          options.offset.x = 0;
	        }

	        if (options.offset.y != null) {
	          // Coerce and verify that y is valid.
	          options.offset.y = +options.offset.y;

	          if (!_isFinite$2(options.offset.y)) {
	            throw new TypeError('The option "offset.y" has to be a finite number.');
	          }
	        } else {
	          options.offset.x = 0;
	        }
	      } else {
	        options.offset = {
	          x: 0,
	          y: 0
	        };
	      }

	      if (options.position != null) {
	        if (options.position.x != null) {
	          // Coerce and verify that x is valid.
	          options.position.x = +options.position.x;

	          if (!_isFinite$2(options.position.x)) {
	            throw new TypeError('The option "position.x" has to be a finite number.');
	          }
	        } else {
	          options.position.x = 0;
	        }

	        if (options.position.y != null) {
	          // Coerce and verify that y is valid.
	          options.position.y = +options.position.y;

	          if (!_isFinite$2(options.position.y)) {
	            throw new TypeError('The option "position.y" has to be a finite number.');
	          }
	        } else {
	          options.position.x = 0;
	        }
	      } else {
	        options.position = this.getViewPosition();
	      }

	      if (options.scale != null) {
	        // Coerce and verify that the scale is valid.
	        options.scale = +options.scale;

	        if (!(options.scale > 0)) {
	          throw new TypeError('The option "scale" has to be a number greater than zero.');
	        }
	      } else {
	        options.scale = this.body.view.scale;
	      }

	      if (options.animation === undefined) {
	        options.animation = {
	          duration: 0
	        };
	      }

	      if (options.animation === false) {
	        options.animation = {
	          duration: 0
	        };
	      }

	      if (options.animation === true) {
	        options.animation = {};
	      }

	      if (options.animation.duration === undefined) {
	        options.animation.duration = 1000;
	      } // default duration


	      if (options.animation.easingFunction === undefined) {
	        options.animation.easingFunction = "easeInOutQuad";
	      } // default easing function


	      this.animateView(options);
	    }
	    /**
	     *
	     * @param {Object} options  |  options.offset   = {x:number, y:number}   // offset from the center in DOM pixels
	     *                          |  options.time     = number                 // animation time in milliseconds
	     *                          |  options.scale    = number                 // scale to animate to
	     *                          |  options.position = {x:number, y:number}   // position to animate to
	     *                          |  options.easingFunction = String           // linear, easeInQuad, easeOutQuad, easeInOutQuad,
	     *                                                                       // easeInCubic, easeOutCubic, easeInOutCubic,
	     *                                                                       // easeInQuart, easeOutQuart, easeInOutQuart,
	     *                                                                       // easeInQuint, easeOutQuint, easeInOutQuint
	     */

	  }, {
	    key: "animateView",
	    value: function animateView(options) {
	      if (options === undefined) {
	        return;
	      }

	      this.animationEasingFunction = options.animation.easingFunction; // release if something focussed on the node

	      this.releaseNode();

	      if (options.locked === true) {
	        this.lockedOnNodeId = options.lockedOnNode;
	        this.lockedOnNodeOffset = options.offset;
	      } // forcefully complete the old animation if it was still running


	      if (this.easingTime != 0) {
	        this._transitionRedraw(true); // by setting easingtime to 1, we finish the animation.

	      }

	      this.sourceScale = this.body.view.scale;
	      this.sourceTranslation = this.body.view.translation;
	      this.targetScale = options.scale; // set the scale so the viewCenter is based on the correct zoom level. This is overridden in the transitionRedraw
	      // but at least then we'll have the target transition

	      this.body.view.scale = this.targetScale;
	      var viewCenter = this.canvas.DOMtoCanvas({
	        x: 0.5 * this.canvas.frame.canvas.clientWidth,
	        y: 0.5 * this.canvas.frame.canvas.clientHeight
	      });
	      var distanceFromCenter = {
	        // offset from view, distance view has to change by these x and y to center the node
	        x: viewCenter.x - options.position.x,
	        y: viewCenter.y - options.position.y
	      };
	      this.targetTranslation = {
	        x: this.sourceTranslation.x + distanceFromCenter.x * this.targetScale + options.offset.x,
	        y: this.sourceTranslation.y + distanceFromCenter.y * this.targetScale + options.offset.y
	      }; // if the time is set to 0, don't do an animation

	      if (options.animation.duration === 0) {
	        if (this.lockedOnNodeId != undefined) {
	          var _context3;

	          this.viewFunction = bind$2(_context3 = this._lockedRedraw).call(_context3, this);
	          this.body.emitter.on("initRedraw", this.viewFunction);
	        } else {
	          this.body.view.scale = this.targetScale;
	          this.body.view.translation = this.targetTranslation;
	          this.body.emitter.emit("_requestRedraw");
	        }
	      } else {
	        var _context4;

	        this.animationSpeed = 1 / (60 * options.animation.duration * 0.001) || 1 / 60; // 60 for 60 seconds, 0.001 for milli's

	        this.animationEasingFunction = options.animation.easingFunction;
	        this.viewFunction = bind$2(_context4 = this._transitionRedraw).call(_context4, this);
	        this.body.emitter.on("initRedraw", this.viewFunction);
	        this.body.emitter.emit("_startRendering");
	      }
	    }
	    /**
	     * used to animate smoothly by hijacking the redraw function.
	     * @private
	     */

	  }, {
	    key: "_lockedRedraw",
	    value: function _lockedRedraw() {
	      var nodePosition = {
	        x: this.body.nodes[this.lockedOnNodeId].x,
	        y: this.body.nodes[this.lockedOnNodeId].y
	      };
	      var viewCenter = this.canvas.DOMtoCanvas({
	        x: 0.5 * this.canvas.frame.canvas.clientWidth,
	        y: 0.5 * this.canvas.frame.canvas.clientHeight
	      });
	      var distanceFromCenter = {
	        // offset from view, distance view has to change by these x and y to center the node
	        x: viewCenter.x - nodePosition.x,
	        y: viewCenter.y - nodePosition.y
	      };
	      var sourceTranslation = this.body.view.translation;
	      var targetTranslation = {
	        x: sourceTranslation.x + distanceFromCenter.x * this.body.view.scale + this.lockedOnNodeOffset.x,
	        y: sourceTranslation.y + distanceFromCenter.y * this.body.view.scale + this.lockedOnNodeOffset.y
	      };
	      this.body.view.translation = targetTranslation;
	    }
	    /**
	     * Resets state of a locked on Node
	     */

	  }, {
	    key: "releaseNode",
	    value: function releaseNode() {
	      if (this.lockedOnNodeId !== undefined && this.viewFunction !== undefined) {
	        this.body.emitter.off("initRedraw", this.viewFunction);
	        this.lockedOnNodeId = undefined;
	        this.lockedOnNodeOffset = undefined;
	      }
	    }
	    /**
	     * @param {boolean} [finished=false]
	     * @private
	     */

	  }, {
	    key: "_transitionRedraw",
	    value: function _transitionRedraw() {
	      var finished = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
	      this.easingTime += this.animationSpeed;
	      this.easingTime = finished === true ? 1.0 : this.easingTime;
	      var progress = easingFunctions[this.animationEasingFunction](this.easingTime);
	      this.body.view.scale = this.sourceScale + (this.targetScale - this.sourceScale) * progress;
	      this.body.view.translation = {
	        x: this.sourceTranslation.x + (this.targetTranslation.x - this.sourceTranslation.x) * progress,
	        y: this.sourceTranslation.y + (this.targetTranslation.y - this.sourceTranslation.y) * progress
	      }; // cleanup

	      if (this.easingTime >= 1.0) {
	        this.body.emitter.off("initRedraw", this.viewFunction);
	        this.easingTime = 0;

	        if (this.lockedOnNodeId != undefined) {
	          var _context5;

	          this.viewFunction = bind$2(_context5 = this._lockedRedraw).call(_context5, this);
	          this.body.emitter.on("initRedraw", this.viewFunction);
	        }

	        this.body.emitter.emit("animationFinished");
	      }
	    }
	    /**
	     *
	     * @returns {number}
	     */

	  }, {
	    key: "getScale",
	    value: function getScale() {
	      return this.body.view.scale;
	    }
	    /**
	     *
	     * @returns {{x: number, y: number}}
	     */

	  }, {
	    key: "getViewPosition",
	    value: function getViewPosition() {
	      return this.canvas.DOMtoCanvas({
	        x: 0.5 * this.canvas.frame.canvas.clientWidth,
	        y: 0.5 * this.canvas.frame.canvas.clientHeight
	      });
	    }
	  }]);

	  return View;
	}();

	var css$1 = "div.vis-network div.vis-navigation div.vis-button {\n    width:34px;\n    height:34px;\n    -moz-border-radius: 17px;\n    border-radius: 17px;\n    position:absolute;\n    display:inline-block;\n    background-position: 2px 2px;\n    background-repeat:no-repeat;\n    cursor: pointer;\n    -webkit-touch-callout: none;\n    -webkit-user-select: none;\n    -khtml-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n}\n\ndiv.vis-network div.vis-navigation div.vis-button:hover {\n    box-shadow: 0 0 3px 3px rgba(56, 207, 21, 0.30);\n}\n\ndiv.vis-network div.vis-navigation div.vis-button:active {\n    box-shadow: 0 0 1px 3px rgba(56, 207, 21, 0.95);\n}\n\ndiv.vis-network div.vis-navigation div.vis-button.vis-up {\n    background-image: url('data:image/png;base64,[encoded data, 5948 characters]');\n    bottom:50px;\n    left:55px;\n}\ndiv.vis-network div.vis-navigation div.vis-button.vis-down {\n    background-image: url('data:image/png;base64,[encoded data, 5948 characters]');\n    bottom:10px;\n    left:55px;\n}\ndiv.vis-network div.vis-navigation div.vis-button.vis-left {\n    background-image: url('data:image/png;base64,[encoded data, 6044 characters]');\n    bottom:10px;\n    left:15px;\n}\ndiv.vis-network div.vis-navigation div.vis-button.vis-right {\n    background-image: url('data:image/png;base64,[encoded data, 6020 characters]');\n    bottom:10px;\n    left:95px;\n}\ndiv.vis-network div.vis-navigation div.vis-button.vis-zoomIn {\n    background-image: url('data:image/png;base64,[encoded data, 5788 characters]');\n    bottom:10px;\n    right:15px;\n}\ndiv.vis-network div.vis-navigation div.vis-button.vis-zoomOut {\n    background-image: url('data:image/png;base64,[encoded data, 5532 characters]');\n    bottom:10px;\n    right:55px;\n}\ndiv.vis-network div.vis-navigation div.vis-button.vis-zoomExtends {\n    background-image: url('data:image/png;base64,[encoded data, 5952 characters]');\n    bottom:50px;\n    right:15px;\n}\n\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIk5hdmlnYXRpb25IYW5kbGVyLmNzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTtJQUNJLFVBQVU7SUFDVixXQUFXO0lBQ1gsd0JBQXdCO0lBQ3hCLG1CQUFtQjtJQUNuQixpQkFBaUI7SUFDakIsb0JBQW9CO0lBQ3BCLDRCQUE0QjtJQUM1QiwyQkFBMkI7SUFDM0IsZUFBZTtJQUNmLDJCQUEyQjtJQUMzQix5QkFBeUI7SUFDekIsd0JBQXdCO0lBQ3hCLHNCQUFzQjtJQUN0QixxQkFBcUI7SUFDckIsaUJBQWlCO0FBQ3JCOztBQUVBO0lBQ0ksK0NBQStDO0FBQ25EOztBQUVBO0lBQ0ksK0NBQStDO0FBQ25EOztBQUVBO0lBQ0ksMjJMQUF1QztJQUN2QyxXQUFXO0lBQ1gsU0FBUztBQUNiO0FBQ0E7SUFDSSwyMkxBQXlDO0lBQ3pDLFdBQVc7SUFDWCxTQUFTO0FBQ2I7QUFDQTtJQUNJLDI4TEFBeUM7SUFDekMsV0FBVztJQUNYLFNBQVM7QUFDYjtBQUNBO0lBQ0ksbTdMQUEwQztJQUMxQyxXQUFXO0lBQ1gsU0FBUztBQUNiO0FBQ0E7SUFDSSwyc0xBQW9DO0lBQ3BDLFdBQVc7SUFDWCxVQUFVO0FBQ2Q7QUFDQTtJQUNJLDI4S0FBcUM7SUFDckMsV0FBVztJQUNYLFVBQVU7QUFDZDtBQUNBO0lBQ0ksKzJMQUEyQztJQUMzQyxXQUFXO0lBQ1gsVUFBVTtBQUNkIiwiZmlsZSI6Ik5hdmlnYXRpb25IYW5kbGVyLmNzcyIsInNvdXJjZXNDb250ZW50IjpbImRpdi52aXMtbmV0d29yayBkaXYudmlzLW5hdmlnYXRpb24gZGl2LnZpcy1idXR0b24ge1xuICAgIHdpZHRoOjM0cHg7XG4gICAgaGVpZ2h0OjM0cHg7XG4gICAgLW1vei1ib3JkZXItcmFkaXVzOiAxN3B4O1xuICAgIGJvcmRlci1yYWRpdXM6IDE3cHg7XG4gICAgcG9zaXRpb246YWJzb2x1dGU7XG4gICAgZGlzcGxheTppbmxpbmUtYmxvY2s7XG4gICAgYmFja2dyb3VuZC1wb3NpdGlvbjogMnB4IDJweDtcbiAgICBiYWNrZ3JvdW5kLXJlcGVhdDpuby1yZXBlYXQ7XG4gICAgY3Vyc29yOiBwb2ludGVyO1xuICAgIC13ZWJraXQtdG91Y2gtY2FsbG91dDogbm9uZTtcbiAgICAtd2Via2l0LXVzZXItc2VsZWN0OiBub25lO1xuICAgIC1raHRtbC11c2VyLXNlbGVjdDogbm9uZTtcbiAgICAtbW96LXVzZXItc2VsZWN0OiBub25lO1xuICAgIC1tcy11c2VyLXNlbGVjdDogbm9uZTtcbiAgICB1c2VyLXNlbGVjdDogbm9uZTtcbn1cblxuZGl2LnZpcy1uZXR3b3JrIGRpdi52aXMtbmF2aWdhdGlvbiBkaXYudmlzLWJ1dHRvbjpob3ZlciB7XG4gICAgYm94LXNoYWRvdzogMCAwIDNweCAzcHggcmdiYSg1NiwgMjA3LCAyMSwgMC4zMCk7XG59XG5cbmRpdi52aXMtbmV0d29yayBkaXYudmlzLW5hdmlnYXRpb24gZGl2LnZpcy1idXR0b246YWN0aXZlIHtcbiAgICBib3gtc2hhZG93OiAwIDAgMXB4IDNweCByZ2JhKDU2LCAyMDcsIDIxLCAwLjk1KTtcbn1cblxuZGl2LnZpcy1uZXR3b3JrIGRpdi52aXMtbmF2aWdhdGlvbiBkaXYudmlzLWJ1dHRvbi52aXMtdXAge1xuICAgIGJhY2tncm91bmQtaW1hZ2U6IGlubGluZShcInVwQXJyb3cucG5nXCIpO1xuICAgIGJvdHRvbTo1MHB4O1xuICAgIGxlZnQ6NTVweDtcbn1cbmRpdi52aXMtbmV0d29yayBkaXYudmlzLW5hdmlnYXRpb24gZGl2LnZpcy1idXR0b24udmlzLWRvd24ge1xuICAgIGJhY2tncm91bmQtaW1hZ2U6IGlubGluZShcImRvd25BcnJvdy5wbmdcIik7XG4gICAgYm90dG9tOjEwcHg7XG4gICAgbGVmdDo1NXB4O1xufVxuZGl2LnZpcy1uZXR3b3JrIGRpdi52aXMtbmF2aWdhdGlvbiBkaXYudmlzLWJ1dHRvbi52aXMtbGVmdCB7XG4gICAgYmFja2dyb3VuZC1pbWFnZTogaW5saW5lKFwibGVmdEFycm93LnBuZ1wiKTtcbiAgICBib3R0b206MTBweDtcbiAgICBsZWZ0OjE1cHg7XG59XG5kaXYudmlzLW5ldHdvcmsgZGl2LnZpcy1uYXZpZ2F0aW9uIGRpdi52aXMtYnV0dG9uLnZpcy1yaWdodCB7XG4gICAgYmFja2dyb3VuZC1pbWFnZTogaW5saW5lKFwicmlnaHRBcnJvdy5wbmdcIik7XG4gICAgYm90dG9tOjEwcHg7XG4gICAgbGVmdDo5NXB4O1xufVxuZGl2LnZpcy1uZXR3b3JrIGRpdi52aXMtbmF2aWdhdGlvbiBkaXYudmlzLWJ1dHRvbi52aXMtem9vbUluIHtcbiAgICBiYWNrZ3JvdW5kLWltYWdlOiBpbmxpbmUoXCJwbHVzLnBuZ1wiKTtcbiAgICBib3R0b206MTBweDtcbiAgICByaWdodDoxNXB4O1xufVxuZGl2LnZpcy1uZXR3b3JrIGRpdi52aXMtbmF2aWdhdGlvbiBkaXYudmlzLWJ1dHRvbi52aXMtem9vbU91dCB7XG4gICAgYmFja2dyb3VuZC1pbWFnZTogaW5saW5lKFwibWludXMucG5nXCIpO1xuICAgIGJvdHRvbToxMHB4O1xuICAgIHJpZ2h0OjU1cHg7XG59XG5kaXYudmlzLW5ldHdvcmsgZGl2LnZpcy1uYXZpZ2F0aW9uIGRpdi52aXMtYnV0dG9uLnZpcy16b29tRXh0ZW5kcyB7XG4gICAgYmFja2dyb3VuZC1pbWFnZTogaW5saW5lKFwiem9vbUV4dGVuZHMucG5nXCIpO1xuICAgIGJvdHRvbTo1MHB4O1xuICAgIHJpZ2h0OjE1cHg7XG59XG4iXX0= */";
	styleInject(css$1);

	/**
	 * Navigation Handler
	 */

	var NavigationHandler =
	/*#__PURE__*/
	function () {
	  /**
	   * @param {Object} body
	   * @param {Canvas} canvas
	   */
	  function NavigationHandler(body, canvas) {
	    var _this = this;

	    classCallCheck(this, NavigationHandler);

	    this.body = body;
	    this.canvas = canvas;
	    this.iconsCreated = false;
	    this.navigationHammers = [];
	    this.boundFunctions = {};
	    this.touchTime = 0;
	    this.activated = false;
	    this.body.emitter.on("activate", function () {
	      _this.activated = true;

	      _this.configureKeyboardBindings();
	    });
	    this.body.emitter.on("deactivate", function () {
	      _this.activated = false;

	      _this.configureKeyboardBindings();
	    });
	    this.body.emitter.on("destroy", function () {
	      if (_this.keycharm !== undefined) {
	        _this.keycharm.destroy();
	      }
	    });
	    this.options = {};
	  }
	  /**
	   *
	   * @param {Object} options
	   */


	  createClass(NavigationHandler, [{
	    key: "setOptions",
	    value: function setOptions(options) {
	      if (options !== undefined) {
	        this.options = options;
	        this.create();
	      }
	    }
	    /**
	     * Creates or refreshes navigation and sets key bindings
	     */

	  }, {
	    key: "create",
	    value: function create() {
	      if (this.options.navigationButtons === true) {
	        if (this.iconsCreated === false) {
	          this.loadNavigationElements();
	        }
	      } else if (this.iconsCreated === true) {
	        this.cleanNavigation();
	      }

	      this.configureKeyboardBindings();
	    }
	    /**
	     * Cleans up previous navigation items
	     */

	  }, {
	    key: "cleanNavigation",
	    value: function cleanNavigation() {
	      // clean hammer bindings
	      if (this.navigationHammers.length != 0) {
	        for (var i = 0; i < this.navigationHammers.length; i++) {
	          this.navigationHammers[i].destroy();
	        }

	        this.navigationHammers = [];
	      } // clean up previous navigation items


	      if (this.navigationDOM && this.navigationDOM['wrapper'] && this.navigationDOM['wrapper'].parentNode) {
	        this.navigationDOM['wrapper'].parentNode.removeChild(this.navigationDOM['wrapper']);
	      }

	      this.iconsCreated = false;
	    }
	    /**
	     * Creation of the navigation controls nodes. They are drawn over the rest of the nodes and are not affected by scale and translation
	     * they have a triggerFunction which is called on click. If the position of the navigation controls is dependent
	     * on this.frame.canvas.clientWidth or this.frame.canvas.clientHeight, we flag horizontalAlignLeft and verticalAlignTop false.
	     * This means that the location will be corrected by the _relocateNavigation function on a size change of the canvas.
	     *
	     * @private
	     */

	  }, {
	    key: "loadNavigationElements",
	    value: function loadNavigationElements() {
	      var _this2 = this;

	      this.cleanNavigation();
	      this.navigationDOM = {};
	      var navigationDivs = ['up', 'down', 'left', 'right', 'zoomIn', 'zoomOut', 'zoomExtends'];
	      var navigationDivActions = ['_moveUp', '_moveDown', '_moveLeft', '_moveRight', '_zoomIn', '_zoomOut', '_fit'];
	      this.navigationDOM['wrapper'] = document.createElement('div');
	      this.navigationDOM['wrapper'].className = 'vis-navigation';
	      this.canvas.frame.appendChild(this.navigationDOM['wrapper']);

	      for (var i = 0; i < navigationDivs.length; i++) {
	        this.navigationDOM[navigationDivs[i]] = document.createElement('div');
	        this.navigationDOM[navigationDivs[i]].className = 'vis-button vis-' + navigationDivs[i];
	        this.navigationDOM['wrapper'].appendChild(this.navigationDOM[navigationDivs[i]]);
	        var hammer$1 = new hammer(this.navigationDOM[navigationDivs[i]]);

	        if (navigationDivActions[i] === "_fit") {
	          var _context;

	          hammerUtil.onTouch(hammer$1, bind$2(_context = this._fit).call(_context, this));
	        } else {
	          var _context2;

	          hammerUtil.onTouch(hammer$1, bind$2(_context2 = this.bindToRedraw).call(_context2, this, navigationDivActions[i]));
	        }

	        this.navigationHammers.push(hammer$1);
	      } // use a hammer for the release so we do not require the one used in the rest of the network
	      // the one the rest uses can be overloaded by the manipulation system.


	      var hammerFrame = new hammer(this.canvas.frame);
	      hammerUtil.onRelease(hammerFrame, function () {
	        _this2._stopMovement();
	      });
	      this.navigationHammers.push(hammerFrame);
	      this.iconsCreated = true;
	    }
	    /**
	     *
	     * @param {string} action
	     */

	  }, {
	    key: "bindToRedraw",
	    value: function bindToRedraw(action) {
	      if (this.boundFunctions[action] === undefined) {
	        var _context3;

	        this.boundFunctions[action] = bind$2(_context3 = this[action]).call(_context3, this);
	        this.body.emitter.on("initRedraw", this.boundFunctions[action]);
	        this.body.emitter.emit("_startRendering");
	      }
	    }
	    /**
	     *
	     * @param {string} action
	     */

	  }, {
	    key: "unbindFromRedraw",
	    value: function unbindFromRedraw(action) {
	      if (this.boundFunctions[action] !== undefined) {
	        this.body.emitter.off("initRedraw", this.boundFunctions[action]);
	        this.body.emitter.emit("_stopRendering");
	        delete this.boundFunctions[action];
	      }
	    }
	    /**
	     * this stops all movement induced by the navigation buttons
	     *
	     * @private
	     */

	  }, {
	    key: "_fit",
	    value: function _fit() {
	      if (new Date().valueOf() - this.touchTime > 700) {
	        // TODO: fix ugly hack to avoid hammer's double fireing of event (because we use release?)
	        this.body.emitter.emit("fit", {
	          duration: 700
	        });
	        this.touchTime = new Date().valueOf();
	      }
	    }
	    /**
	     * this stops all movement induced by the navigation buttons
	     *
	     * @private
	     */

	  }, {
	    key: "_stopMovement",
	    value: function _stopMovement() {
	      for (var boundAction in this.boundFunctions) {
	        if (this.boundFunctions.hasOwnProperty(boundAction)) {
	          this.body.emitter.off("initRedraw", this.boundFunctions[boundAction]);
	          this.body.emitter.emit("_stopRendering");
	        }
	      }

	      this.boundFunctions = {};
	    }
	    /**
	     *
	     * @private
	     */

	  }, {
	    key: "_moveUp",
	    value: function _moveUp() {
	      this.body.view.translation.y += this.options.keyboard.speed.y;
	    }
	    /**
	     *
	     * @private
	     */

	  }, {
	    key: "_moveDown",
	    value: function _moveDown() {
	      this.body.view.translation.y -= this.options.keyboard.speed.y;
	    }
	    /**
	     *
	     * @private
	     */

	  }, {
	    key: "_moveLeft",
	    value: function _moveLeft() {
	      this.body.view.translation.x += this.options.keyboard.speed.x;
	    }
	    /**
	     *
	     * @private
	     */

	  }, {
	    key: "_moveRight",
	    value: function _moveRight() {
	      this.body.view.translation.x -= this.options.keyboard.speed.x;
	    }
	    /**
	     *
	     * @private
	     */

	  }, {
	    key: "_zoomIn",
	    value: function _zoomIn() {
	      var scaleOld = this.body.view.scale;
	      var scale = this.body.view.scale * (1 + this.options.keyboard.speed.zoom);
	      var translation = this.body.view.translation;
	      var scaleFrac = scale / scaleOld;
	      var tx = (1 - scaleFrac) * this.canvas.canvasViewCenter.x + translation.x * scaleFrac;
	      var ty = (1 - scaleFrac) * this.canvas.canvasViewCenter.y + translation.y * scaleFrac;
	      this.body.view.scale = scale;
	      this.body.view.translation = {
	        x: tx,
	        y: ty
	      };
	      this.body.emitter.emit('zoom', {
	        direction: '+',
	        scale: this.body.view.scale,
	        pointer: null
	      });
	    }
	    /**
	     *
	     * @private
	     */

	  }, {
	    key: "_zoomOut",
	    value: function _zoomOut() {
	      var scaleOld = this.body.view.scale;
	      var scale = this.body.view.scale / (1 + this.options.keyboard.speed.zoom);
	      var translation = this.body.view.translation;
	      var scaleFrac = scale / scaleOld;
	      var tx = (1 - scaleFrac) * this.canvas.canvasViewCenter.x + translation.x * scaleFrac;
	      var ty = (1 - scaleFrac) * this.canvas.canvasViewCenter.y + translation.y * scaleFrac;
	      this.body.view.scale = scale;
	      this.body.view.translation = {
	        x: tx,
	        y: ty
	      };
	      this.body.emitter.emit('zoom', {
	        direction: '-',
	        scale: this.body.view.scale,
	        pointer: null
	      });
	    }
	    /**
	     * bind all keys using keycharm.
	     */

	  }, {
	    key: "configureKeyboardBindings",
	    value: function configureKeyboardBindings() {
	      var _this3 = this;

	      if (this.keycharm !== undefined) {
	        this.keycharm.destroy();
	      }

	      if (this.options.keyboard.enabled === true) {
	        if (this.options.keyboard.bindToWindow === true) {
	          this.keycharm = keycharm({
	            container: window,
	            preventDefault: true
	          });
	        } else {
	          this.keycharm = keycharm({
	            container: this.canvas.frame,
	            preventDefault: true
	          });
	        }

	        this.keycharm.reset();

	        if (this.activated === true) {
	          var _context4, _context5, _context6, _context7, _context8, _context9, _context10, _context11, _context12, _context13, _context14, _context15, _context16, _context17, _context18, _context19, _context20, _context21, _context22, _context23, _context24, _context25, _context26, _context27;

	          bind$2(_context4 = this.keycharm).call(_context4, "up", function () {
	            _this3.bindToRedraw("_moveUp");
	          }, "keydown");

	          bind$2(_context5 = this.keycharm).call(_context5, "down", function () {
	            _this3.bindToRedraw("_moveDown");
	          }, "keydown");

	          bind$2(_context6 = this.keycharm).call(_context6, "left", function () {
	            _this3.bindToRedraw("_moveLeft");
	          }, "keydown");

	          bind$2(_context7 = this.keycharm).call(_context7, "right", function () {
	            _this3.bindToRedraw("_moveRight");
	          }, "keydown");

	          bind$2(_context8 = this.keycharm).call(_context8, "=", function () {
	            _this3.bindToRedraw("_zoomIn");
	          }, "keydown");

	          bind$2(_context9 = this.keycharm).call(_context9, "num+", function () {
	            _this3.bindToRedraw("_zoomIn");
	          }, "keydown");

	          bind$2(_context10 = this.keycharm).call(_context10, "num-", function () {
	            _this3.bindToRedraw("_zoomOut");
	          }, "keydown");

	          bind$2(_context11 = this.keycharm).call(_context11, "-", function () {
	            _this3.bindToRedraw("_zoomOut");
	          }, "keydown");

	          bind$2(_context12 = this.keycharm).call(_context12, "[", function () {
	            _this3.bindToRedraw("_zoomOut");
	          }, "keydown");

	          bind$2(_context13 = this.keycharm).call(_context13, "]", function () {
	            _this3.bindToRedraw("_zoomIn");
	          }, "keydown");

	          bind$2(_context14 = this.keycharm).call(_context14, "pageup", function () {
	            _this3.bindToRedraw("_zoomIn");
	          }, "keydown");

	          bind$2(_context15 = this.keycharm).call(_context15, "pagedown", function () {
	            _this3.bindToRedraw("_zoomOut");
	          }, "keydown");

	          bind$2(_context16 = this.keycharm).call(_context16, "up", function () {
	            _this3.unbindFromRedraw("_moveUp");
	          }, "keyup");

	          bind$2(_context17 = this.keycharm).call(_context17, "down", function () {
	            _this3.unbindFromRedraw("_moveDown");
	          }, "keyup");

	          bind$2(_context18 = this.keycharm).call(_context18, "left", function () {
	            _this3.unbindFromRedraw("_moveLeft");
	          }, "keyup");

	          bind$2(_context19 = this.keycharm).call(_context19, "right", function () {
	            _this3.unbindFromRedraw("_moveRight");
	          }, "keyup");

	          bind$2(_context20 = this.keycharm).call(_context20, "=", function () {
	            _this3.unbindFromRedraw("_zoomIn");
	          }, "keyup");

	          bind$2(_context21 = this.keycharm).call(_context21, "num+", function () {
	            _this3.unbindFromRedraw("_zoomIn");
	          }, "keyup");

	          bind$2(_context22 = this.keycharm).call(_context22, "num-", function () {
	            _this3.unbindFromRedraw("_zoomOut");
	          }, "keyup");

	          bind$2(_context23 = this.keycharm).call(_context23, "-", function () {
	            _this3.unbindFromRedraw("_zoomOut");
	          }, "keyup");

	          bind$2(_context24 = this.keycharm).call(_context24, "[", function () {
	            _this3.unbindFromRedraw("_zoomOut");
	          }, "keyup");

	          bind$2(_context25 = this.keycharm).call(_context25, "]", function () {
	            _this3.unbindFromRedraw("_zoomIn");
	          }, "keyup");

	          bind$2(_context26 = this.keycharm).call(_context26, "pageup", function () {
	            _this3.unbindFromRedraw("_zoomIn");
	          }, "keyup");

	          bind$2(_context27 = this.keycharm).call(_context27, "pagedown", function () {
	            _this3.unbindFromRedraw("_zoomOut");
	          }, "keyup");
	        }
	      }
	    }
	  }]);

	  return NavigationHandler;
	}();

	var css$2 = "div.vis-tooltip {\n  position: absolute;\n  visibility: hidden;\n  padding: 5px;\n  white-space: nowrap;\n\n  font-family: verdana;\n  font-size:14px;\n  color:#000000;\n  background-color: #f5f4ed;\n\n  -moz-border-radius: 3px;\n  -webkit-border-radius: 3px;\n  border-radius: 3px;\n  border: 1px solid #808074;\n\n  box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.2);\n  pointer-events: none;\n\n  z-index: 5;\n}\n\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlBvcHVwLmNzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTtFQUNFLGtCQUFrQjtFQUNsQixrQkFBa0I7RUFDbEIsWUFBWTtFQUNaLG1CQUFtQjs7RUFFbkIsb0JBQW9CO0VBQ3BCLGNBQWM7RUFDZCxhQUFhO0VBQ2IseUJBQXlCOztFQUV6Qix1QkFBdUI7RUFDdkIsMEJBQTBCO0VBQzFCLGtCQUFrQjtFQUNsQix5QkFBeUI7O0VBRXpCLDJDQUEyQztFQUMzQyxvQkFBb0I7O0VBRXBCLFVBQVU7QUFDWiIsImZpbGUiOiJQb3B1cC5jc3MiLCJzb3VyY2VzQ29udGVudCI6WyJkaXYudmlzLXRvb2x0aXAge1xuICBwb3NpdGlvbjogYWJzb2x1dGU7XG4gIHZpc2liaWxpdHk6IGhpZGRlbjtcbiAgcGFkZGluZzogNXB4O1xuICB3aGl0ZS1zcGFjZTogbm93cmFwO1xuXG4gIGZvbnQtZmFtaWx5OiB2ZXJkYW5hO1xuICBmb250LXNpemU6MTRweDtcbiAgY29sb3I6IzAwMDAwMDtcbiAgYmFja2dyb3VuZC1jb2xvcjogI2Y1ZjRlZDtcblxuICAtbW96LWJvcmRlci1yYWRpdXM6IDNweDtcbiAgLXdlYmtpdC1ib3JkZXItcmFkaXVzOiAzcHg7XG4gIGJvcmRlci1yYWRpdXM6IDNweDtcbiAgYm9yZGVyOiAxcHggc29saWQgIzgwODA3NDtcblxuICBib3gtc2hhZG93OiAzcHggM3B4IDEwcHggcmdiYSgwLCAwLCAwLCAwLjIpO1xuICBwb2ludGVyLWV2ZW50czogbm9uZTtcblxuICB6LWluZGV4OiA1O1xufVxuIl19 */";
	styleInject(css$2);

	/**
	 * Popup is a class to create a popup window with some text
	 */

	var Popup =
	/*#__PURE__*/
	function () {
	  /**
	   * @param {Element} container       The container object.
	   * @param {string}  overflowMethod  How the popup should act to overflowing ('flip' or 'cap')
	   */
	  function Popup(container, overflowMethod) {
	    classCallCheck(this, Popup);

	    this.container = container;
	    this.overflowMethod = overflowMethod || 'cap';
	    this.x = 0;
	    this.y = 0;
	    this.padding = 5;
	    this.hidden = false; // create the frame

	    this.frame = document.createElement('div');
	    this.frame.className = 'vis-tooltip';
	    this.container.appendChild(this.frame);
	  }
	  /**
	   * @param {number} x   Horizontal position of the popup window
	   * @param {number} y   Vertical position of the popup window
	   */


	  createClass(Popup, [{
	    key: "setPosition",
	    value: function setPosition(x, y) {
	      this.x = _parseInt$3(x);
	      this.y = _parseInt$3(y);
	    }
	    /**
	     * Set the content for the popup window. This can be HTML code or text.
	     * @param {string | Element} content
	     */

	  }, {
	    key: "setText",
	    value: function setText(content) {
	      if (content instanceof Element) {
	        this.frame.innerHTML = '';
	        this.frame.appendChild(content);
	      } else {
	        this.frame.innerHTML = content; // string containing text or HTML
	      }
	    }
	    /**
	     * Show the popup window
	     * @param {boolean} [doShow]    Show or hide the window
	     */

	  }, {
	    key: "show",
	    value: function show(doShow) {
	      if (doShow === undefined) {
	        doShow = true;
	      }

	      if (doShow === true) {
	        var height = this.frame.clientHeight;
	        var width = this.frame.clientWidth;
	        var maxHeight = this.frame.parentNode.clientHeight;
	        var maxWidth = this.frame.parentNode.clientWidth;
	        var left = 0,
	            top = 0;

	        if (this.overflowMethod == 'flip') {
	          var isLeft = false,
	              isTop = true; // Where around the position it's located

	          if (this.y - height < this.padding) {
	            isTop = false;
	          }

	          if (this.x + width > maxWidth - this.padding) {
	            isLeft = true;
	          }

	          if (isLeft) {
	            left = this.x - width;
	          } else {
	            left = this.x;
	          }

	          if (isTop) {
	            top = this.y - height;
	          } else {
	            top = this.y;
	          }
	        } else {
	          top = this.y - height;

	          if (top + height + this.padding > maxHeight) {
	            top = maxHeight - height - this.padding;
	          }

	          if (top < this.padding) {
	            top = this.padding;
	          }

	          left = this.x;

	          if (left + width + this.padding > maxWidth) {
	            left = maxWidth - width - this.padding;
	          }

	          if (left < this.padding) {
	            left = this.padding;
	          }
	        }

	        this.frame.style.left = left + "px";
	        this.frame.style.top = top + "px";
	        this.frame.style.visibility = "visible";
	        this.hidden = false;
	      } else {
	        this.hide();
	      }
	    }
	    /**
	     * Hide the popup window
	     */

	  }, {
	    key: "hide",
	    value: function hide() {
	      this.hidden = true;
	      this.frame.style.left = "0";
	      this.frame.style.top = "0";
	      this.frame.style.visibility = "hidden";
	    }
	    /**
	     * Remove the popup window
	     */

	  }, {
	    key: "destroy",
	    value: function destroy() {
	      this.frame.parentNode.removeChild(this.frame); // Remove element from DOM
	    }
	  }]);

	  return Popup;
	}();

	/**
	 * Handler for interactions
	 */

	var InteractionHandler =
	/*#__PURE__*/
	function () {
	  /**
	   * @param {Object} body
	   * @param {Canvas} canvas
	   * @param {SelectionHandler} selectionHandler
	   */
	  function InteractionHandler(body, canvas, selectionHandler) {
	    var _context, _context2, _context3, _context4, _context5, _context6, _context7, _context8, _context9, _context10, _context11, _context12, _context13;

	    classCallCheck(this, InteractionHandler);

	    this.body = body;
	    this.canvas = canvas;
	    this.selectionHandler = selectionHandler;
	    this.navigationHandler = new NavigationHandler(body, canvas); // bind the events from hammer to functions in this object

	    this.body.eventListeners.onTap = bind$2(_context = this.onTap).call(_context, this);
	    this.body.eventListeners.onTouch = bind$2(_context2 = this.onTouch).call(_context2, this);
	    this.body.eventListeners.onDoubleTap = bind$2(_context3 = this.onDoubleTap).call(_context3, this);
	    this.body.eventListeners.onHold = bind$2(_context4 = this.onHold).call(_context4, this);
	    this.body.eventListeners.onDragStart = bind$2(_context5 = this.onDragStart).call(_context5, this);
	    this.body.eventListeners.onDrag = bind$2(_context6 = this.onDrag).call(_context6, this);
	    this.body.eventListeners.onDragEnd = bind$2(_context7 = this.onDragEnd).call(_context7, this);
	    this.body.eventListeners.onMouseWheel = bind$2(_context8 = this.onMouseWheel).call(_context8, this);
	    this.body.eventListeners.onPinch = bind$2(_context9 = this.onPinch).call(_context9, this);
	    this.body.eventListeners.onMouseMove = bind$2(_context10 = this.onMouseMove).call(_context10, this);
	    this.body.eventListeners.onRelease = bind$2(_context11 = this.onRelease).call(_context11, this);
	    this.body.eventListeners.onContext = bind$2(_context12 = this.onContext).call(_context12, this);
	    this.touchTime = 0;
	    this.drag = {};
	    this.pinch = {};
	    this.popup = undefined;
	    this.popupObj = undefined;
	    this.popupTimer = undefined;
	    this.body.functions.getPointer = bind$2(_context13 = this.getPointer).call(_context13, this);
	    this.options = {};
	    this.defaultOptions = {
	      dragNodes: true,
	      dragView: true,
	      hover: false,
	      keyboard: {
	        enabled: false,
	        speed: {
	          x: 10,
	          y: 10,
	          zoom: 0.02
	        },
	        bindToWindow: true
	      },
	      navigationButtons: false,
	      tooltipDelay: 300,
	      zoomView: true,
	      zoomSpeed: 1
	    };
	    extend(this.options, this.defaultOptions);
	    this.bindEventListeners();
	  }
	  /**
	   * Binds event listeners
	   */


	  createClass(InteractionHandler, [{
	    key: "bindEventListeners",
	    value: function bindEventListeners() {
	      var _this = this;

	      this.body.emitter.on('destroy', function () {
	        clearTimeout(_this.popupTimer);
	        delete _this.body.functions.getPointer;
	      });
	    }
	    /**
	     *
	     * @param {Object} options
	     */

	  }, {
	    key: "setOptions",
	    value: function setOptions(options) {
	      if (options !== undefined) {
	        // extend all but the values in fields
	        var fields = ['hideEdgesOnDrag', 'hideEdgesOnZoom', 'hideNodesOnDrag', 'keyboard', 'multiselect', 'selectable', 'selectConnectedEdges'];
	        selectiveNotDeepExtend(fields, this.options, options); // merge the keyboard options in.

	        mergeOptions(this.options, options, 'keyboard');

	        if (options.tooltip) {
	          extend(this.options.tooltip, options.tooltip);

	          if (options.tooltip.color) {
	            this.options.tooltip.color = parseColor(options.tooltip.color);
	          }
	        }
	      }

	      this.navigationHandler.setOptions(this.options);
	    }
	    /**
	     * Get the pointer location from a touch location
	     * @param {{x: number, y: number}} touch
	     * @return {{x: number, y: number}} pointer
	     * @private
	     */

	  }, {
	    key: "getPointer",
	    value: function getPointer(touch) {
	      return {
	        x: touch.x - getAbsoluteLeft(this.canvas.frame.canvas),
	        y: touch.y - getAbsoluteTop(this.canvas.frame.canvas)
	      };
	    }
	    /**
	     * On start of a touch gesture, store the pointer
	     * @param {Event}  event   The event
	     * @private
	     */

	  }, {
	    key: "onTouch",
	    value: function onTouch(event) {
	      if (new Date().valueOf() - this.touchTime > 50) {
	        this.drag.pointer = this.getPointer(event.center);
	        this.drag.pinched = false;
	        this.pinch.scale = this.body.view.scale; // to avoid double fireing of this event because we have two hammer instances. (on canvas and on frame)

	        this.touchTime = new Date().valueOf();
	      }
	    }
	    /**
	     * handle tap/click event: select/unselect a node
	     * @param {Event} event
	     * @private
	     */

	  }, {
	    key: "onTap",
	    value: function onTap(event) {
	      var pointer = this.getPointer(event.center);
	      var multiselect = this.selectionHandler.options.multiselect && (event.changedPointers[0].ctrlKey || event.changedPointers[0].metaKey);
	      this.checkSelectionChanges(pointer, event, multiselect);

	      this.selectionHandler._generateClickEvent('click', event, pointer);
	    }
	    /**
	     * handle doubletap event
	     * @param {Event} event
	     * @private
	     */

	  }, {
	    key: "onDoubleTap",
	    value: function onDoubleTap(event) {
	      var pointer = this.getPointer(event.center);

	      this.selectionHandler._generateClickEvent('doubleClick', event, pointer);
	    }
	    /**
	     * handle long tap event: multi select nodes
	     * @param {Event} event
	     * @private
	     */

	  }, {
	    key: "onHold",
	    value: function onHold(event) {
	      var pointer = this.getPointer(event.center);
	      var multiselect = this.selectionHandler.options.multiselect;
	      this.checkSelectionChanges(pointer, event, multiselect);

	      this.selectionHandler._generateClickEvent('click', event, pointer);

	      this.selectionHandler._generateClickEvent('hold', event, pointer);
	    }
	    /**
	     * handle the release of the screen
	     *
	     * @param {Event} event
	     * @private
	     */

	  }, {
	    key: "onRelease",
	    value: function onRelease(event) {
	      if (new Date().valueOf() - this.touchTime > 10) {
	        var pointer = this.getPointer(event.center);

	        this.selectionHandler._generateClickEvent('release', event, pointer); // to avoid double fireing of this event because we have two hammer instances. (on canvas and on frame)


	        this.touchTime = new Date().valueOf();
	      }
	    }
	    /**
	     *
	     * @param {Event} event
	     */

	  }, {
	    key: "onContext",
	    value: function onContext(event) {
	      var pointer = this.getPointer({
	        x: event.clientX,
	        y: event.clientY
	      });

	      this.selectionHandler._generateClickEvent('oncontext', event, pointer);
	    }
	    /**
	     * Select and deselect nodes depending current selection change.
	     *
	     * For changing nodes, select/deselect events are fired.
	     *
	     * NOTE: For a given edge, if one connecting node is deselected and with the same
	     *       click the other node is selected, no events for the edge will fire.
	     *       It was selected and it will remain selected.
	     *
	     * TODO: This is all SelectionHandler calls; the method should be moved to there.
	     *
	     * @param {{x: number, y: number}} pointer
	     * @param {Event} event
	     * @param {boolean} [add=false]
	     */

	  }, {
	    key: "checkSelectionChanges",
	    value: function checkSelectionChanges(pointer, event) {
	      var add = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
	      var previousSelection = this.selectionHandler.getSelection();
	      var selected = false;

	      if (add === true) {
	        selected = this.selectionHandler.selectAdditionalOnPoint(pointer);
	      } else {
	        selected = this.selectionHandler.selectOnPoint(pointer);
	      }

	      var currentSelection = this.selectionHandler.getSelection(); // See NOTE in method comment for the reason to do it like this

	      var deselectedItems = this._determineDifference(previousSelection, currentSelection);

	      var selectedItems = this._determineDifference(currentSelection, previousSelection);

	      if (deselectedItems.edges.length > 0) {
	        this.selectionHandler._generateClickEvent('deselectEdge', event, pointer, previousSelection);

	        selected = true;
	      }

	      if (deselectedItems.nodes.length > 0) {
	        this.selectionHandler._generateClickEvent('deselectNode', event, pointer, previousSelection);

	        selected = true;
	      }

	      if (selectedItems.nodes.length > 0) {
	        this.selectionHandler._generateClickEvent('selectNode', event, pointer);

	        selected = true;
	      }

	      if (selectedItems.edges.length > 0) {
	        this.selectionHandler._generateClickEvent('selectEdge', event, pointer);

	        selected = true;
	      } // fire the select event if anything has been selected or deselected


	      if (selected === true) {
	        // select or unselect
	        this.selectionHandler._generateClickEvent('select', event, pointer);
	      }
	    }
	    /**
	     * Remove all node and edge id's from the first set that are present in the second one.
	     *
	     * @param {{nodes: Array.<Node>, edges: Array.<vis.Edge>}} firstSet
	     * @param {{nodes: Array.<Node>, edges: Array.<vis.Edge>}} secondSet
	     * @returns {{nodes: Array.<Node>, edges: Array.<vis.Edge>}}
	     * @private
	     */

	  }, {
	    key: "_determineDifference",
	    value: function _determineDifference(firstSet, secondSet) {
	      var arrayDiff = function arrayDiff(firstArr, secondArr) {
	        var result = [];

	        for (var i = 0; i < firstArr.length; i++) {
	          var value = firstArr[i];

	          if (indexOf$3(secondArr).call(secondArr, value) === -1) {
	            result.push(value);
	          }
	        }

	        return result;
	      };

	      return {
	        nodes: arrayDiff(firstSet.nodes, secondSet.nodes),
	        edges: arrayDiff(firstSet.edges, secondSet.edges)
	      };
	    }
	    /**
	     * This function is called by onDragStart.
	     * It is separated out because we can then overload it for the datamanipulation system.
	     *
	     * @param {Event} event
	     * @private
	     */

	  }, {
	    key: "onDragStart",
	    value: function onDragStart(event) {
	      //in case the touch event was triggered on an external div, do the initial touch now.
	      if (this.drag.pointer === undefined) {
	        this.onTouch(event);
	      } // note: drag.pointer is set in onTouch to get the initial touch location


	      var node = this.selectionHandler.getNodeAt(this.drag.pointer);
	      this.drag.dragging = true;
	      this.drag.selection = [];
	      this.drag.translation = extend({}, this.body.view.translation); // copy the object

	      this.drag.nodeId = undefined;

	      if (node !== undefined && this.options.dragNodes === true) {
	        this.drag.nodeId = node.id; // select the clicked node if not yet selected

	        if (node.isSelected() === false) {
	          this.selectionHandler.unselectAll();
	          this.selectionHandler.selectObject(node);
	        } // after select to contain the node


	        this.selectionHandler._generateClickEvent('dragStart', event, this.drag.pointer);

	        var selection = this.selectionHandler.selectionObj.nodes; // create an array with the selected nodes and their original location and status

	        for (var nodeId in selection) {
	          if (selection.hasOwnProperty(nodeId)) {
	            var object = selection[nodeId];
	            var s = {
	              id: object.id,
	              node: object,
	              // store original x, y, xFixed and yFixed, make the node temporarily Fixed
	              x: object.x,
	              y: object.y,
	              xFixed: object.options.fixed.x,
	              yFixed: object.options.fixed.y
	            };
	            object.options.fixed.x = true;
	            object.options.fixed.y = true;
	            this.drag.selection.push(s);
	          }
	        }
	      } else {
	        // fallback if no node is selected and thus the view is dragged.
	        this.selectionHandler._generateClickEvent('dragStart', event, this.drag.pointer, undefined, true);
	      }
	    }
	    /**
	     * handle drag event
	     * @param {Event} event
	     * @private
	     */

	  }, {
	    key: "onDrag",
	    value: function onDrag(event) {
	      var _this2 = this;

	      if (this.drag.pinched === true) {
	        return;
	      } // remove the focus on node if it is focussed on by the focusOnNode


	      this.body.emitter.emit('unlockNode');
	      var pointer = this.getPointer(event.center);
	      var selection = this.drag.selection;

	      if (selection && selection.length && this.options.dragNodes === true) {
	        this.selectionHandler._generateClickEvent('dragging', event, pointer); // calculate delta's and new location


	        var deltaX = pointer.x - this.drag.pointer.x;
	        var deltaY = pointer.y - this.drag.pointer.y; // update position of all selected nodes

	        forEach$2(selection).call(selection, function (selection) {
	          var node = selection.node; // only move the node if it was not fixed initially

	          if (selection.xFixed === false) {
	            node.x = _this2.canvas._XconvertDOMtoCanvas(_this2.canvas._XconvertCanvasToDOM(selection.x) + deltaX);
	          } // only move the node if it was not fixed initially


	          if (selection.yFixed === false) {
	            node.y = _this2.canvas._YconvertDOMtoCanvas(_this2.canvas._YconvertCanvasToDOM(selection.y) + deltaY);
	          }
	        }); // start the simulation of the physics


	        this.body.emitter.emit('startSimulation');
	      } else {
	        // move the network
	        if (this.options.dragView === true) {
	          this.selectionHandler._generateClickEvent('dragging', event, pointer, undefined, true); // if the drag was not started properly because the click started outside the network div, start it now.


	          if (this.drag.pointer === undefined) {
	            this.onDragStart(event);
	            return;
	          }

	          var diffX = pointer.x - this.drag.pointer.x;
	          var diffY = pointer.y - this.drag.pointer.y;
	          this.body.view.translation = {
	            x: this.drag.translation.x + diffX,
	            y: this.drag.translation.y + diffY
	          };
	          this.body.emitter.emit('_requestRedraw');
	        }
	      }
	    }
	    /**
	     * handle drag start event
	     * @param {Event} event
	     * @private
	     */

	  }, {
	    key: "onDragEnd",
	    value: function onDragEnd(event) {
	      this.drag.dragging = false;
	      var selection = this.drag.selection;

	      if (selection && selection.length) {
	        forEach$2(selection).call(selection, function (s) {
	          // restore original xFixed and yFixed
	          s.node.options.fixed.x = s.xFixed;
	          s.node.options.fixed.y = s.yFixed;
	        });

	        this.selectionHandler._generateClickEvent('dragEnd', event, this.getPointer(event.center));

	        this.body.emitter.emit('startSimulation');
	      } else {
	        this.selectionHandler._generateClickEvent('dragEnd', event, this.getPointer(event.center), undefined, true);

	        this.body.emitter.emit('_requestRedraw');
	      }
	    }
	    /**
	     * Handle pinch event
	     * @param {Event}  event   The event
	     * @private
	     */

	  }, {
	    key: "onPinch",
	    value: function onPinch(event) {
	      var pointer = this.getPointer(event.center);
	      this.drag.pinched = true;

	      if (this.pinch['scale'] === undefined) {
	        this.pinch.scale = 1;
	      } // TODO: enabled moving while pinching?


	      var scale = this.pinch.scale * event.scale;
	      this.zoom(scale, pointer);
	    }
	    /**
	     * Zoom the network in or out
	     * @param {number} scale a number around 1, and between 0.01 and 10
	     * @param {{x: number, y: number}} pointer    Position on screen
	     * @private
	     */

	  }, {
	    key: "zoom",
	    value: function zoom(scale, pointer) {
	      if (this.options.zoomView === true) {
	        var scaleOld = this.body.view.scale;

	        if (scale < 0.00001) {
	          scale = 0.00001;
	        }

	        if (scale > 10) {
	          scale = 10;
	        }

	        var preScaleDragPointer = undefined;

	        if (this.drag !== undefined) {
	          if (this.drag.dragging === true) {
	            preScaleDragPointer = this.canvas.DOMtoCanvas(this.drag.pointer);
	          }
	        } // + this.canvas.frame.canvas.clientHeight / 2


	        var translation = this.body.view.translation;
	        var scaleFrac = scale / scaleOld;
	        var tx = (1 - scaleFrac) * pointer.x + translation.x * scaleFrac;
	        var ty = (1 - scaleFrac) * pointer.y + translation.y * scaleFrac;
	        this.body.view.scale = scale;
	        this.body.view.translation = {
	          x: tx,
	          y: ty
	        };

	        if (preScaleDragPointer != undefined) {
	          var postScaleDragPointer = this.canvas.canvasToDOM(preScaleDragPointer);
	          this.drag.pointer.x = postScaleDragPointer.x;
	          this.drag.pointer.y = postScaleDragPointer.y;
	        }

	        this.body.emitter.emit('_requestRedraw');

	        if (scaleOld < scale) {
	          this.body.emitter.emit('zoom', {
	            direction: '+',
	            scale: this.body.view.scale,
	            pointer: pointer
	          });
	        } else {
	          this.body.emitter.emit('zoom', {
	            direction: '-',
	            scale: this.body.view.scale,
	            pointer: pointer
	          });
	        }
	      }
	    }
	    /**
	     * Event handler for mouse wheel event, used to zoom the timeline
	     * See http://adomas.org/javascript-mouse-wheel/
	     *     https://github.com/EightMedia/hammer.js/issues/256
	     * @param {MouseEvent}  event
	     * @private
	     */

	  }, {
	    key: "onMouseWheel",
	    value: function onMouseWheel(event) {
	      if (this.options.zoomView === true) {
	        // If delta is nonzero, handle it.
	        // Basically, delta is now positive if wheel was scrolled up,
	        // and negative, if wheel was scrolled down.
	        if (event.deltaY !== 0) {
	          // calculate the new scale
	          var scale = this.body.view.scale;
	          scale *= 1 + (event.deltaY < 0 ? 1 : -1) * (this.options.zoomSpeed * 0.1); // calculate the pointer location

	          var pointer = this.getPointer({
	            x: event.clientX,
	            y: event.clientY
	          }); // apply the new scale

	          this.zoom(scale, pointer);
	        } // Prevent default actions caused by mouse wheel.


	        event.preventDefault();
	      }
	    }
	    /**
	     * Mouse move handler for checking whether the title moves over a node with a title.
	     * @param  {Event} event
	     * @private
	     */

	  }, {
	    key: "onMouseMove",
	    value: function onMouseMove(event) {
	      var _this3 = this;

	      var pointer = this.getPointer({
	        x: event.clientX,
	        y: event.clientY
	      });
	      var popupVisible = false; // check if the previously selected node is still selected

	      if (this.popup !== undefined) {
	        if (this.popup.hidden === false) {
	          this._checkHidePopup(pointer);
	        } // if the popup was not hidden above


	        if (this.popup.hidden === false) {
	          popupVisible = true;
	          this.popup.setPosition(pointer.x + 3, pointer.y - 5);
	          this.popup.show();
	        }
	      } // if we bind the keyboard to the div, we have to highlight it to use it. This highlights it on mouse over.


	      if (this.options.keyboard.bindToWindow === false && this.options.keyboard.enabled === true) {
	        this.canvas.frame.focus();
	      } // start a timeout that will check if the mouse is positioned above an element


	      if (popupVisible === false) {
	        if (this.popupTimer !== undefined) {
	          clearInterval(this.popupTimer); // stop any running calculationTimer

	          this.popupTimer = undefined;
	        }

	        if (!this.drag.dragging) {
	          this.popupTimer = setTimeout$2(function () {
	            return _this3._checkShowPopup(pointer);
	          }, this.options.tooltipDelay);
	        }
	      } // adding hover highlights


	      if (this.options.hover === true) {
	        this.selectionHandler.hoverObject(event, pointer);
	      }
	    }
	    /**
	     * Check if there is an element on the given position in the network
	     * (a node or edge). If so, and if this element has a title,
	     * show a popup window with its title.
	     *
	     * @param {{x:number, y:number}} pointer
	     * @private
	     */

	  }, {
	    key: "_checkShowPopup",
	    value: function _checkShowPopup(pointer) {
	      var x = this.canvas._XconvertDOMtoCanvas(pointer.x);

	      var y = this.canvas._YconvertDOMtoCanvas(pointer.y);

	      var pointerObj = {
	        left: x,
	        top: y,
	        right: x,
	        bottom: y
	      };
	      var previousPopupObjId = this.popupObj === undefined ? undefined : this.popupObj.id;
	      var nodeUnderCursor = false;
	      var popupType = 'node'; // check if a node is under the cursor.

	      if (this.popupObj === undefined) {
	        // search the nodes for overlap, select the top one in case of multiple nodes
	        var nodeIndices = this.body.nodeIndices;
	        var nodes = this.body.nodes;
	        var node;
	        var overlappingNodes = [];

	        for (var i = 0; i < nodeIndices.length; i++) {
	          node = nodes[nodeIndices[i]];

	          if (node.isOverlappingWith(pointerObj) === true) {
	            nodeUnderCursor = true;

	            if (node.getTitle() !== undefined) {
	              overlappingNodes.push(nodeIndices[i]);
	            }
	          }
	        }

	        if (overlappingNodes.length > 0) {
	          // if there are overlapping nodes, select the last one, this is the one which is drawn on top of the others
	          this.popupObj = nodes[overlappingNodes[overlappingNodes.length - 1]]; // if you hover over a node, the title of the edge is not supposed to be shown.

	          nodeUnderCursor = true;
	        }
	      }

	      if (this.popupObj === undefined && nodeUnderCursor === false) {
	        // search the edges for overlap
	        var edgeIndices = this.body.edgeIndices;
	        var edges = this.body.edges;
	        var edge;
	        var overlappingEdges = [];

	        for (var _i = 0; _i < edgeIndices.length; _i++) {
	          edge = edges[edgeIndices[_i]];

	          if (edge.isOverlappingWith(pointerObj) === true) {
	            if (edge.connected === true && edge.getTitle() !== undefined) {
	              overlappingEdges.push(edgeIndices[_i]);
	            }
	          }
	        }

	        if (overlappingEdges.length > 0) {
	          this.popupObj = edges[overlappingEdges[overlappingEdges.length - 1]];
	          popupType = 'edge';
	        }
	      }

	      if (this.popupObj !== undefined) {
	        // show popup message window
	        if (this.popupObj.id !== previousPopupObjId) {
	          if (this.popup === undefined) {
	            this.popup = new Popup(this.canvas.frame);
	          }

	          this.popup.popupTargetType = popupType;
	          this.popup.popupTargetId = this.popupObj.id; // adjust a small offset such that the mouse cursor is located in the
	          // bottom left location of the popup, and you can easily move over the
	          // popup area

	          this.popup.setPosition(pointer.x + 3, pointer.y - 5);
	          this.popup.setText(this.popupObj.getTitle());
	          this.popup.show();
	          this.body.emitter.emit('showPopup', this.popupObj.id);
	        }
	      } else {
	        if (this.popup !== undefined) {
	          this.popup.hide();
	          this.body.emitter.emit('hidePopup');
	        }
	      }
	    }
	    /**
	     * Check if the popup must be hidden, which is the case when the mouse is no
	     * longer hovering on the object
	     * @param {{x:number, y:number}} pointer
	     * @private
	     */

	  }, {
	    key: "_checkHidePopup",
	    value: function _checkHidePopup(pointer) {
	      var pointerObj = this.selectionHandler._pointerToPositionObject(pointer);

	      var stillOnObj = false;

	      if (this.popup.popupTargetType === 'node') {
	        if (this.body.nodes[this.popup.popupTargetId] !== undefined) {
	          stillOnObj = this.body.nodes[this.popup.popupTargetId].isOverlappingWith(pointerObj); // if the mouse is still one the node, we have to check if it is not also on one that is drawn on top of it.
	          // we initially only check stillOnObj because this is much faster.

	          if (stillOnObj === true) {
	            var overNode = this.selectionHandler.getNodeAt(pointer);
	            stillOnObj = overNode === undefined ? false : overNode.id === this.popup.popupTargetId;
	          }
	        }
	      } else {
	        if (this.selectionHandler.getNodeAt(pointer) === undefined) {
	          if (this.body.edges[this.popup.popupTargetId] !== undefined) {
	            stillOnObj = this.body.edges[this.popup.popupTargetId].isOverlappingWith(pointerObj);
	          }
	        }
	      }

	      if (stillOnObj === false) {
	        this.popupObj = undefined;
	        this.popup.hide();
	        this.body.emitter.emit('hidePopup');
	      }
	    }
	  }]);

	  return InteractionHandler;
	}();

	/**
	 * The handler for selections
	 */

	var SelectionHandler =
	/*#__PURE__*/
	function () {
	  /**
	   * @param {Object} body
	   * @param {Canvas} canvas
	   */
	  function SelectionHandler(body, canvas) {
	    var _this = this;

	    classCallCheck(this, SelectionHandler);

	    this.body = body;
	    this.canvas = canvas;
	    this.selectionObj = {
	      nodes: [],
	      edges: []
	    };
	    this.hoverObj = {
	      nodes: {},
	      edges: {}
	    };
	    this.options = {};
	    this.defaultOptions = {
	      multiselect: false,
	      selectable: true,
	      selectConnectedEdges: true,
	      hoverConnectedEdges: true
	    };
	    extend(this.options, this.defaultOptions);
	    this.body.emitter.on("_dataChanged", function () {
	      _this.updateSelection();
	    });
	  }
	  /**
	   *
	   * @param {Object} [options]
	   */


	  createClass(SelectionHandler, [{
	    key: "setOptions",
	    value: function setOptions(options) {
	      if (options !== undefined) {
	        var fields = ['multiselect', 'hoverConnectedEdges', 'selectable', 'selectConnectedEdges'];
	        selectiveDeepExtend(fields, this.options, options);
	      }
	    }
	    /**
	     * handles the selection part of the tap;
	     *
	     * @param {{x: number, y: number}} pointer
	     * @returns {boolean}
	     */

	  }, {
	    key: "selectOnPoint",
	    value: function selectOnPoint(pointer) {
	      var selected = false;

	      if (this.options.selectable === true) {
	        var obj = this.getNodeAt(pointer) || this.getEdgeAt(pointer); // unselect after getting the objects in order to restore width and height.

	        this.unselectAll();

	        if (obj !== undefined) {
	          selected = this.selectObject(obj);
	        }

	        this.body.emitter.emit("_requestRedraw");
	      }

	      return selected;
	    }
	    /**
	     *
	     * @param {{x: number, y: number}} pointer
	     * @returns {boolean}
	     */

	  }, {
	    key: "selectAdditionalOnPoint",
	    value: function selectAdditionalOnPoint(pointer) {
	      var selectionChanged = false;

	      if (this.options.selectable === true) {
	        var obj = this.getNodeAt(pointer) || this.getEdgeAt(pointer);

	        if (obj !== undefined) {
	          selectionChanged = true;

	          if (obj.isSelected() === true) {
	            this.deselectObject(obj);
	          } else {
	            this.selectObject(obj);
	          }

	          this.body.emitter.emit("_requestRedraw");
	        }
	      }

	      return selectionChanged;
	    }
	    /**
	     * Create an object containing the standard fields for an event.
	     *
	     * @param {Event} event
	     * @param {{x: number, y: number}} pointer Object with the x and y screen coordinates of the mouse
	     * @returns {{}}
	     * @private
	     */

	  }, {
	    key: "_initBaseEvent",
	    value: function _initBaseEvent(event, pointer) {
	      var properties = {};
	      properties['pointer'] = {
	        DOM: {
	          x: pointer.x,
	          y: pointer.y
	        },
	        canvas: this.canvas.DOMtoCanvas(pointer)
	      };
	      properties['event'] = event;
	      return properties;
	    }
	    /**
	     * Generate an event which the user can catch.
	     *
	     * This adds some extra data to the event with respect to cursor position and
	     * selected nodes and edges.
	     *
	     * @param {string} eventType                          Name of event to send
	     * @param {Event}  event
	     * @param {{x: number, y: number}} pointer            Object with the x and y screen coordinates of the mouse
	     * @param {Object|undefined} oldSelection             If present, selection state before event occured
	     * @param {boolean|undefined} [emptySelection=false]  Indicate if selection data should be passed
	     */

	  }, {
	    key: "_generateClickEvent",
	    value: function _generateClickEvent(eventType, event, pointer, oldSelection) {
	      var emptySelection = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;

	      var properties = this._initBaseEvent(event, pointer);

	      if (emptySelection === true) {
	        properties.nodes = [];
	        properties.edges = [];
	      } else {
	        var tmp = this.getSelection();
	        properties.nodes = tmp.nodes;
	        properties.edges = tmp.edges;
	      }

	      if (oldSelection !== undefined) {
	        properties['previousSelection'] = oldSelection;
	      }

	      if (eventType == 'click') {
	        // For the time being, restrict this functionality to
	        // just the click event.
	        properties.items = this.getClickedItems(pointer);
	      }

	      if (event.controlEdge !== undefined) {
	        properties.controlEdge = event.controlEdge;
	      }

	      this.body.emitter.emit(eventType, properties);
	    }
	    /**
	     *
	     * @param {Object} obj
	     * @param {boolean} [highlightEdges=this.options.selectConnectedEdges]
	     * @returns {boolean}
	     */

	  }, {
	    key: "selectObject",
	    value: function selectObject(obj) {
	      var highlightEdges = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.options.selectConnectedEdges;

	      if (obj !== undefined) {
	        if (obj instanceof Node) {
	          if (highlightEdges === true) {
	            this._selectConnectedEdges(obj);
	          }
	        }

	        obj.select();

	        this._addToSelection(obj);

	        return true;
	      }

	      return false;
	    }
	    /**
	     *
	     * @param {Object} obj
	     */

	  }, {
	    key: "deselectObject",
	    value: function deselectObject(obj) {
	      if (obj.isSelected() === true) {
	        obj.selected = false;

	        this._removeFromSelection(obj);
	      }
	    }
	    /**
	     * retrieve all nodes overlapping with given object
	     * @param {Object} object  An object with parameters left, top, right, bottom
	     * @return {number[]}   An array with id's of the overlapping nodes
	     * @private
	     */

	  }, {
	    key: "_getAllNodesOverlappingWith",
	    value: function _getAllNodesOverlappingWith(object) {
	      var overlappingNodes = [];
	      var nodes = this.body.nodes;

	      for (var i = 0; i < this.body.nodeIndices.length; i++) {
	        var nodeId = this.body.nodeIndices[i];

	        if (nodes[nodeId].isOverlappingWith(object)) {
	          overlappingNodes.push(nodeId);
	        }
	      }

	      return overlappingNodes;
	    }
	    /**
	     * Return a position object in canvasspace from a single point in screenspace
	     *
	     * @param {{x: number, y: number}} pointer
	     * @returns {{left: number, top: number, right: number, bottom: number}}
	     * @private
	     */

	  }, {
	    key: "_pointerToPositionObject",
	    value: function _pointerToPositionObject(pointer) {
	      var canvasPos = this.canvas.DOMtoCanvas(pointer);
	      return {
	        left: canvasPos.x - 1,
	        top: canvasPos.y + 1,
	        right: canvasPos.x + 1,
	        bottom: canvasPos.y - 1
	      };
	    }
	    /**
	     * Get the top node at the passed point (like a click)
	     *
	     * @param {{x: number, y: number}} pointer
	     * @param {boolean} [returnNode=true]
	     * @return {Node | undefined} node
	     */

	  }, {
	    key: "getNodeAt",
	    value: function getNodeAt(pointer) {
	      var returnNode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;

	      // we first check if this is an navigation controls element
	      var positionObject = this._pointerToPositionObject(pointer);

	      var overlappingNodes = this._getAllNodesOverlappingWith(positionObject); // if there are overlapping nodes, select the last one, this is the
	      // one which is drawn on top of the others


	      if (overlappingNodes.length > 0) {
	        if (returnNode === true) {
	          return this.body.nodes[overlappingNodes[overlappingNodes.length - 1]];
	        } else {
	          return overlappingNodes[overlappingNodes.length - 1];
	        }
	      } else {
	        return undefined;
	      }
	    }
	    /**
	     * retrieve all edges overlapping with given object, selector is around center
	     * @param {Object} object  An object with parameters left, top, right, bottom
	     * @param {number[]} overlappingEdges An array with id's of the overlapping nodes
	     * @private
	     */

	  }, {
	    key: "_getEdgesOverlappingWith",
	    value: function _getEdgesOverlappingWith(object, overlappingEdges) {
	      var edges = this.body.edges;

	      for (var i = 0; i < this.body.edgeIndices.length; i++) {
	        var edgeId = this.body.edgeIndices[i];

	        if (edges[edgeId].isOverlappingWith(object)) {
	          overlappingEdges.push(edgeId);
	        }
	      }
	    }
	    /**
	     * retrieve all nodes overlapping with given object
	     * @param {Object} object  An object with parameters left, top, right, bottom
	     * @return {number[]}   An array with id's of the overlapping nodes
	     * @private
	     */

	  }, {
	    key: "_getAllEdgesOverlappingWith",
	    value: function _getAllEdgesOverlappingWith(object) {
	      var overlappingEdges = [];

	      this._getEdgesOverlappingWith(object, overlappingEdges);

	      return overlappingEdges;
	    }
	    /**
	     * Get the edges nearest to the passed point (like a click)
	     *
	     * @param {{x: number, y: number}} pointer
	     * @param {boolean} [returnEdge=true]
	     * @return {Edge | undefined} node
	     */

	  }, {
	    key: "getEdgeAt",
	    value: function getEdgeAt(pointer) {
	      var returnEdge = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
	      // Iterate over edges, pick closest within 10
	      var canvasPos = this.canvas.DOMtoCanvas(pointer);
	      var mindist = 10;
	      var overlappingEdge = null;
	      var edges = this.body.edges;

	      for (var i = 0; i < this.body.edgeIndices.length; i++) {
	        var edgeId = this.body.edgeIndices[i];
	        var edge = edges[edgeId];

	        if (edge.connected) {
	          var xFrom = edge.from.x;
	          var yFrom = edge.from.y;
	          var xTo = edge.to.x;
	          var yTo = edge.to.y;
	          var dist = edge.edgeType.getDistanceToEdge(xFrom, yFrom, xTo, yTo, canvasPos.x, canvasPos.y);

	          if (dist < mindist) {
	            overlappingEdge = edgeId;
	            mindist = dist;
	          }
	        }
	      }

	      if (overlappingEdge !== null) {
	        if (returnEdge === true) {
	          return this.body.edges[overlappingEdge];
	        } else {
	          return overlappingEdge;
	        }
	      } else {
	        return undefined;
	      }
	    }
	    /**
	     * Add object to the selection array.
	     *
	     * @param {Object} obj
	     * @private
	     */

	  }, {
	    key: "_addToSelection",
	    value: function _addToSelection(obj) {
	      if (obj instanceof Node) {
	        this.selectionObj.nodes[obj.id] = obj;
	      } else {
	        this.selectionObj.edges[obj.id] = obj;
	      }
	    }
	    /**
	     * Add object to the selection array.
	     *
	     * @param {Object} obj
	     * @private
	     */

	  }, {
	    key: "_addToHover",
	    value: function _addToHover(obj) {
	      if (obj instanceof Node) {
	        this.hoverObj.nodes[obj.id] = obj;
	      } else {
	        this.hoverObj.edges[obj.id] = obj;
	      }
	    }
	    /**
	     * Remove a single option from selection.
	     *
	     * @param {Object} obj
	     * @private
	     */

	  }, {
	    key: "_removeFromSelection",
	    value: function _removeFromSelection(obj) {
	      if (obj instanceof Node) {
	        delete this.selectionObj.nodes[obj.id];

	        this._unselectConnectedEdges(obj);
	      } else {
	        delete this.selectionObj.edges[obj.id];
	      }
	    }
	    /**
	     * Unselect all. The selectionObj is useful for this.
	     */

	  }, {
	    key: "unselectAll",
	    value: function unselectAll() {
	      for (var nodeId in this.selectionObj.nodes) {
	        if (this.selectionObj.nodes.hasOwnProperty(nodeId)) {
	          this.selectionObj.nodes[nodeId].unselect();
	        }
	      }

	      for (var edgeId in this.selectionObj.edges) {
	        if (this.selectionObj.edges.hasOwnProperty(edgeId)) {
	          this.selectionObj.edges[edgeId].unselect();
	        }
	      }

	      this.selectionObj = {
	        nodes: {},
	        edges: {}
	      };
	    }
	    /**
	     * return the number of selected nodes
	     *
	     * @returns {number}
	     * @private
	     */

	  }, {
	    key: "_getSelectedNodeCount",
	    value: function _getSelectedNodeCount() {
	      var count = 0;

	      for (var nodeId in this.selectionObj.nodes) {
	        if (this.selectionObj.nodes.hasOwnProperty(nodeId)) {
	          count += 1;
	        }
	      }

	      return count;
	    }
	    /**
	     * return the selected node
	     *
	     * @returns {number}
	     * @private
	     */

	  }, {
	    key: "_getSelectedNode",
	    value: function _getSelectedNode() {
	      for (var nodeId in this.selectionObj.nodes) {
	        if (this.selectionObj.nodes.hasOwnProperty(nodeId)) {
	          return this.selectionObj.nodes[nodeId];
	        }
	      }

	      return undefined;
	    }
	    /**
	     * return the selected edge
	     *
	     * @returns {number}
	     * @private
	     */

	  }, {
	    key: "_getSelectedEdge",
	    value: function _getSelectedEdge() {
	      for (var edgeId in this.selectionObj.edges) {
	        if (this.selectionObj.edges.hasOwnProperty(edgeId)) {
	          return this.selectionObj.edges[edgeId];
	        }
	      }

	      return undefined;
	    }
	    /**
	     * return the number of selected edges
	     *
	     * @returns {number}
	     * @private
	     */

	  }, {
	    key: "_getSelectedEdgeCount",
	    value: function _getSelectedEdgeCount() {
	      var count = 0;

	      for (var edgeId in this.selectionObj.edges) {
	        if (this.selectionObj.edges.hasOwnProperty(edgeId)) {
	          count += 1;
	        }
	      }

	      return count;
	    }
	    /**
	     * return the number of selected objects.
	     *
	     * @returns {number}
	     * @private
	     */

	  }, {
	    key: "_getSelectedObjectCount",
	    value: function _getSelectedObjectCount() {
	      var count = 0;

	      for (var nodeId in this.selectionObj.nodes) {
	        if (this.selectionObj.nodes.hasOwnProperty(nodeId)) {
	          count += 1;
	        }
	      }

	      for (var edgeId in this.selectionObj.edges) {
	        if (this.selectionObj.edges.hasOwnProperty(edgeId)) {
	          count += 1;
	        }
	      }

	      return count;
	    }
	    /**
	     * Check if anything is selected
	     *
	     * @returns {boolean}
	     * @private
	     */

	  }, {
	    key: "_selectionIsEmpty",
	    value: function _selectionIsEmpty() {
	      for (var nodeId in this.selectionObj.nodes) {
	        if (this.selectionObj.nodes.hasOwnProperty(nodeId)) {
	          return false;
	        }
	      }

	      for (var edgeId in this.selectionObj.edges) {
	        if (this.selectionObj.edges.hasOwnProperty(edgeId)) {
	          return false;
	        }
	      }

	      return true;
	    }
	    /**
	     * check if one of the selected nodes is a cluster.
	     *
	     * @returns {boolean}
	     * @private
	     */

	  }, {
	    key: "_clusterInSelection",
	    value: function _clusterInSelection() {
	      for (var nodeId in this.selectionObj.nodes) {
	        if (this.selectionObj.nodes.hasOwnProperty(nodeId)) {
	          if (this.selectionObj.nodes[nodeId].clusterSize > 1) {
	            return true;
	          }
	        }
	      }

	      return false;
	    }
	    /**
	     * select the edges connected to the node that is being selected
	     *
	     * @param {Node} node
	     * @private
	     */

	  }, {
	    key: "_selectConnectedEdges",
	    value: function _selectConnectedEdges(node) {
	      for (var i = 0; i < node.edges.length; i++) {
	        var edge = node.edges[i];
	        edge.select();

	        this._addToSelection(edge);
	      }
	    }
	    /**
	     * select the edges connected to the node that is being selected
	     *
	     * @param {Node} node
	     * @private
	     */

	  }, {
	    key: "_hoverConnectedEdges",
	    value: function _hoverConnectedEdges(node) {
	      for (var i = 0; i < node.edges.length; i++) {
	        var edge = node.edges[i];
	        edge.hover = true;

	        this._addToHover(edge);
	      }
	    }
	    /**
	     * unselect the edges connected to the node that is being selected
	     *
	     * @param {Node} node
	     * @private
	     */

	  }, {
	    key: "_unselectConnectedEdges",
	    value: function _unselectConnectedEdges(node) {
	      for (var i = 0; i < node.edges.length; i++) {
	        var edge = node.edges[i];
	        edge.unselect();

	        this._removeFromSelection(edge);
	      }
	    }
	    /**
	     * Remove the highlight from a node or edge, in response to mouse movement
	     *
	     * @param {Event}  event
	     * @param {{x: number, y: number}} pointer object with the x and y screen coordinates of the mouse
	     * @param {Node|vis.Edge} object
	     * @private
	     */

	  }, {
	    key: "emitBlurEvent",
	    value: function emitBlurEvent(event, pointer, object) {
	      var properties = this._initBaseEvent(event, pointer);

	      if (object.hover === true) {
	        object.hover = false;

	        if (object instanceof Node) {
	          properties.node = object.id;
	          this.body.emitter.emit("blurNode", properties);
	        } else {
	          properties.edge = object.id;
	          this.body.emitter.emit("blurEdge", properties);
	        }
	      }
	    }
	    /**
	     * Create the highlight for a node or edge, in response to mouse movement
	     *
	     * @param {Event}  event
	     * @param {{x: number, y: number}} pointer object with the x and y screen coordinates of the mouse
	     * @param {Node|vis.Edge} object
	     * @returns {boolean} hoverChanged
	     * @private
	     */

	  }, {
	    key: "emitHoverEvent",
	    value: function emitHoverEvent(event, pointer, object) {
	      var properties = this._initBaseEvent(event, pointer);

	      var hoverChanged = false;

	      if (object.hover === false) {
	        object.hover = true;

	        this._addToHover(object);

	        hoverChanged = true;

	        if (object instanceof Node) {
	          properties.node = object.id;
	          this.body.emitter.emit("hoverNode", properties);
	        } else {
	          properties.edge = object.id;
	          this.body.emitter.emit("hoverEdge", properties);
	        }
	      }

	      return hoverChanged;
	    }
	    /**
	     * Perform actions in response to a mouse movement.
	     *
	     * @param {Event}  event
	     * @param {{x: number, y: number}} pointer | object with the x and y screen coordinates of the mouse
	     */

	  }, {
	    key: "hoverObject",
	    value: function hoverObject(event, pointer) {
	      var object = this.getNodeAt(pointer);

	      if (object === undefined) {
	        object = this.getEdgeAt(pointer);
	      }

	      var hoverChanged = false; // remove all node hover highlights

	      for (var nodeId in this.hoverObj.nodes) {
	        if (this.hoverObj.nodes.hasOwnProperty(nodeId)) {
	          if (object === undefined || object instanceof Node && object.id != nodeId || object instanceof Edge) {
	            this.emitBlurEvent(event, pointer, this.hoverObj.nodes[nodeId]);
	            delete this.hoverObj.nodes[nodeId];
	            hoverChanged = true;
	          }
	        }
	      } // removing all edge hover highlights


	      for (var edgeId in this.hoverObj.edges) {
	        if (this.hoverObj.edges.hasOwnProperty(edgeId)) {
	          // if the hover has been changed here it means that the node has been hovered over or off
	          // we then do not use the emitBlurEvent method here.
	          if (hoverChanged === true) {
	            this.hoverObj.edges[edgeId].hover = false;
	            delete this.hoverObj.edges[edgeId];
	          } // if the blur remains the same and the object is undefined (mouse off) or another
	          // edge has been hovered, or another node has been hovered we blur the edge.
	          else if (object === undefined || object instanceof Edge && object.id != edgeId || object instanceof Node && !object.hover) {
	              this.emitBlurEvent(event, pointer, this.hoverObj.edges[edgeId]);
	              delete this.hoverObj.edges[edgeId];
	              hoverChanged = true;
	            }
	        }
	      }

	      if (object !== undefined) {
	        var hoveredEdgesCount = keys$6(this.hoverObj.edges).length;

	        var hoveredNodesCount = keys$6(this.hoverObj.nodes).length;

	        var newOnlyHoveredEdge = object instanceof Edge && hoveredEdgesCount === 0 && hoveredNodesCount === 0;
	        var newOnlyHoveredNode = object instanceof Node && hoveredEdgesCount === 0 && hoveredNodesCount === 0;

	        if (hoverChanged || newOnlyHoveredEdge || newOnlyHoveredNode) {
	          hoverChanged = this.emitHoverEvent(event, pointer, object);
	        }

	        if (object instanceof Node && this.options.hoverConnectedEdges === true) {
	          this._hoverConnectedEdges(object);
	        }
	      }

	      if (hoverChanged === true) {
	        this.body.emitter.emit('_requestRedraw');
	      }
	    }
	    /**
	     *
	     * retrieve the currently selected objects
	     * @return {{nodes: Array.<string>, edges: Array.<string>}} selection
	     */

	  }, {
	    key: "getSelection",
	    value: function getSelection() {
	      var nodeIds = this.getSelectedNodes();
	      var edgeIds = this.getSelectedEdges();
	      return {
	        nodes: nodeIds,
	        edges: edgeIds
	      };
	    }
	    /**
	     *
	     * retrieve the currently selected nodes
	     * @return {string[]} selection    An array with the ids of the
	     *                                            selected nodes.
	     */

	  }, {
	    key: "getSelectedNodes",
	    value: function getSelectedNodes() {
	      var idArray = [];

	      if (this.options.selectable === true) {
	        for (var nodeId in this.selectionObj.nodes) {
	          if (this.selectionObj.nodes.hasOwnProperty(nodeId)) {
	            idArray.push(this.selectionObj.nodes[nodeId].id);
	          }
	        }
	      }

	      return idArray;
	    }
	    /**
	     *
	     * retrieve the currently selected edges
	     * @return {Array} selection    An array with the ids of the
	     *                                            selected nodes.
	     */

	  }, {
	    key: "getSelectedEdges",
	    value: function getSelectedEdges() {
	      var idArray = [];

	      if (this.options.selectable === true) {
	        for (var edgeId in this.selectionObj.edges) {
	          if (this.selectionObj.edges.hasOwnProperty(edgeId)) {
	            idArray.push(this.selectionObj.edges[edgeId].id);
	          }
	        }
	      }

	      return idArray;
	    }
	    /**
	     * Updates the current selection
	     * @param {{nodes: Array.<string>, edges: Array.<string>}} selection
	     * @param {Object} options                                 Options
	     */

	  }, {
	    key: "setSelection",
	    value: function setSelection(selection) {
	      var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
	      var i, id;
	      if (!selection || !selection.nodes && !selection.edges) throw 'Selection must be an object with nodes and/or edges properties'; // first unselect any selected node, if option is true or undefined

	      if (options.unselectAll || options.unselectAll === undefined) {
	        this.unselectAll();
	      }

	      if (selection.nodes) {
	        for (i = 0; i < selection.nodes.length; i++) {
	          id = selection.nodes[i];
	          var node = this.body.nodes[id];

	          if (!node) {
	            throw new RangeError('Node with id "' + id + '" not found');
	          } // don't select edges with it


	          this.selectObject(node, options.highlightEdges);
	        }
	      }

	      if (selection.edges) {
	        for (i = 0; i < selection.edges.length; i++) {
	          id = selection.edges[i];
	          var edge = this.body.edges[id];

	          if (!edge) {
	            throw new RangeError('Edge with id "' + id + '" not found');
	          }

	          this.selectObject(edge);
	        }
	      }

	      this.body.emitter.emit('_requestRedraw');
	    }
	    /**
	     * select zero or more nodes with the option to highlight edges
	     * @param {number[] | string[]} selection     An array with the ids of the
	     *                                            selected nodes.
	     * @param {boolean} [highlightEdges]
	     */

	  }, {
	    key: "selectNodes",
	    value: function selectNodes(selection) {
	      var highlightEdges = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
	      if (!selection || selection.length === undefined) throw 'Selection must be an array with ids';
	      this.setSelection({
	        nodes: selection
	      }, {
	        highlightEdges: highlightEdges
	      });
	    }
	    /**
	     * select zero or more edges
	     * @param {number[] | string[]} selection     An array with the ids of the
	     *                                            selected nodes.
	     */

	  }, {
	    key: "selectEdges",
	    value: function selectEdges(selection) {
	      if (!selection || selection.length === undefined) throw 'Selection must be an array with ids';
	      this.setSelection({
	        edges: selection
	      });
	    }
	    /**
	     * Validate the selection: remove ids of nodes which no longer exist
	     * @private
	     */

	  }, {
	    key: "updateSelection",
	    value: function updateSelection() {
	      for (var nodeId in this.selectionObj.nodes) {
	        if (this.selectionObj.nodes.hasOwnProperty(nodeId)) {
	          if (!this.body.nodes.hasOwnProperty(nodeId)) {
	            delete this.selectionObj.nodes[nodeId];
	          }
	        }
	      }

	      for (var edgeId in this.selectionObj.edges) {
	        if (this.selectionObj.edges.hasOwnProperty(edgeId)) {
	          if (!this.body.edges.hasOwnProperty(edgeId)) {
	            delete this.selectionObj.edges[edgeId];
	          }
	        }
	      }
	    }
	    /**
	     * Determine all the visual elements clicked which are on the given point.
	     *
	     * All elements are returned; this includes nodes, edges and their labels.
	     * The order returned is from highest to lowest, i.e. element 0 of the return
	     * value is the topmost item clicked on.
	     *
	     * The return value consists of an array of the following possible elements:
	     *
	     * - `{nodeId:number}`             - node with given id clicked on
	     * - `{nodeId:number, labelId:0}`  - label of node with given id clicked on
	     * - `{edgeId:number}`             - edge with given id clicked on
	     * - `{edge:number, labelId:0}`    - label of edge with given id clicked on
	     *
	     * ## NOTES
	     *
	     * - Currently, there is only one label associated with a node or an edge,
	     *   but this is expected to change somewhere in the future.
	     * - Since there is no z-indexing yet, it is not really possible to set the nodes and
	     *   edges in the correct order. For the time being, nodes come first.
	     *
	     * @param {point} pointer  mouse position in screen coordinates
	     * @returns {Array.<nodeClickItem|nodeLabelClickItem|edgeClickItem|edgeLabelClickItem>}
	     * @private
	     */

	  }, {
	    key: "getClickedItems",
	    value: function getClickedItems(pointer) {
	      var point = this.canvas.DOMtoCanvas(pointer);
	      var items = []; // Note reverse order; we want the topmost clicked items to be first in the array
	      // Also note that selected nodes are disregarded here; these normally display on top

	      var nodeIndices = this.body.nodeIndices;
	      var nodes = this.body.nodes;

	      for (var i = nodeIndices.length - 1; i >= 0; i--) {
	        var node = nodes[nodeIndices[i]];
	        var ret = node.getItemsOnPoint(point);
	        items.push.apply(items, ret); // Append the return value to the running list.
	      }

	      var edgeIndices = this.body.edgeIndices;
	      var edges = this.body.edges;

	      for (var _i = edgeIndices.length - 1; _i >= 0; _i--) {
	        var edge = edges[edgeIndices[_i]];

	        var _ret = edge.getItemsOnPoint(point);

	        items.push.apply(items, _ret); // Append the return value to the running list.
	      }

	      return items;
	    }
	  }]);

	  return SelectionHandler;
	}();

	var timsort = createCommonjsModule(function (module, exports) {
	  /****
	   * The MIT License
	   *
	   * Copyright (c) 2015 Marco Ziccardi
	   *
	   * Permission is hereby granted, free of charge, to any person obtaining a copy
	   * of this software and associated documentation files (the "Software"), to deal
	   * in the Software without restriction, including without limitation the rights
	   * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
	   * copies of the Software, and to permit persons to whom the Software is
	   * furnished to do so, subject to the following conditions:
	   *
	   * The above copyright notice and this permission notice shall be included in
	   * all copies or substantial portions of the Software.
	   *
	   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
	   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
	   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
	   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
	   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
	   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
	   * THE SOFTWARE.
	   *
	   ****/
	  (function (global, factory) {
	    {
	      factory(exports);
	    }
	  })(commonjsGlobal, function (exports) {

	    exports.__esModule = true;
	    exports.sort = sort;

	    function _classCallCheck(instance, Constructor) {
	      if (!(instance instanceof Constructor)) {
	        throw new TypeError('Cannot call a class as a function');
	      }
	    }

	    var DEFAULT_MIN_MERGE = 32;
	    var DEFAULT_MIN_GALLOPING = 7;
	    var DEFAULT_TMP_STORAGE_LENGTH = 256;
	    var POWERS_OF_TEN = [1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9];

	    function log10(x) {
	      if (x < 1e5) {
	        if (x < 1e2) {
	          return x < 1e1 ? 0 : 1;
	        }

	        if (x < 1e4) {
	          return x < 1e3 ? 2 : 3;
	        }

	        return 4;
	      }

	      if (x < 1e7) {
	        return x < 1e6 ? 5 : 6;
	      }

	      if (x < 1e9) {
	        return x < 1e8 ? 7 : 8;
	      }

	      return 9;
	    }

	    function alphabeticalCompare(a, b) {
	      if (a === b) {
	        return 0;
	      }

	      if (~~a === a && ~~b === b) {
	        if (a === 0 || b === 0) {
	          return a < b ? -1 : 1;
	        }

	        if (a < 0 || b < 0) {
	          if (b >= 0) {
	            return -1;
	          }

	          if (a >= 0) {
	            return 1;
	          }

	          a = -a;
	          b = -b;
	        }

	        var al = log10(a);
	        var bl = log10(b);
	        var t = 0;

	        if (al < bl) {
	          a *= POWERS_OF_TEN[bl - al - 1];
	          b /= 10;
	          t = -1;
	        } else if (al > bl) {
	          b *= POWERS_OF_TEN[al - bl - 1];
	          a /= 10;
	          t = 1;
	        }

	        if (a === b) {
	          return t;
	        }

	        return a < b ? -1 : 1;
	      }

	      var aStr = String(a);
	      var bStr = String(b);

	      if (aStr === bStr) {
	        return 0;
	      }

	      return aStr < bStr ? -1 : 1;
	    }

	    function minRunLength(n) {
	      var r = 0;

	      while (n >= DEFAULT_MIN_MERGE) {
	        r |= n & 1;
	        n >>= 1;
	      }

	      return n + r;
	    }

	    function makeAscendingRun(array, lo, hi, compare) {
	      var runHi = lo + 1;

	      if (runHi === hi) {
	        return 1;
	      }

	      if (compare(array[runHi++], array[lo]) < 0) {
	        while (runHi < hi && compare(array[runHi], array[runHi - 1]) < 0) {
	          runHi++;
	        }

	        reverseRun(array, lo, runHi);
	      } else {
	        while (runHi < hi && compare(array[runHi], array[runHi - 1]) >= 0) {
	          runHi++;
	        }
	      }

	      return runHi - lo;
	    }

	    function reverseRun(array, lo, hi) {
	      hi--;

	      while (lo < hi) {
	        var t = array[lo];
	        array[lo++] = array[hi];
	        array[hi--] = t;
	      }
	    }

	    function binaryInsertionSort(array, lo, hi, start, compare) {
	      if (start === lo) {
	        start++;
	      }

	      for (; start < hi; start++) {
	        var pivot = array[start];
	        var left = lo;
	        var right = start;

	        while (left < right) {
	          var mid = left + right >>> 1;

	          if (compare(pivot, array[mid]) < 0) {
	            right = mid;
	          } else {
	            left = mid + 1;
	          }
	        }

	        var n = start - left;

	        switch (n) {
	          case 3:
	            array[left + 3] = array[left + 2];

	          case 2:
	            array[left + 2] = array[left + 1];

	          case 1:
	            array[left + 1] = array[left];
	            break;

	          default:
	            while (n > 0) {
	              array[left + n] = array[left + n - 1];
	              n--;
	            }

	        }

	        array[left] = pivot;
	      }
	    }

	    function gallopLeft(value, array, start, length, hint, compare) {
	      var lastOffset = 0;
	      var maxOffset = 0;
	      var offset = 1;

	      if (compare(value, array[start + hint]) > 0) {
	        maxOffset = length - hint;

	        while (offset < maxOffset && compare(value, array[start + hint + offset]) > 0) {
	          lastOffset = offset;
	          offset = (offset << 1) + 1;

	          if (offset <= 0) {
	            offset = maxOffset;
	          }
	        }

	        if (offset > maxOffset) {
	          offset = maxOffset;
	        }

	        lastOffset += hint;
	        offset += hint;
	      } else {
	        maxOffset = hint + 1;

	        while (offset < maxOffset && compare(value, array[start + hint - offset]) <= 0) {
	          lastOffset = offset;
	          offset = (offset << 1) + 1;

	          if (offset <= 0) {
	            offset = maxOffset;
	          }
	        }

	        if (offset > maxOffset) {
	          offset = maxOffset;
	        }

	        var tmp = lastOffset;
	        lastOffset = hint - offset;
	        offset = hint - tmp;
	      }

	      lastOffset++;

	      while (lastOffset < offset) {
	        var m = lastOffset + (offset - lastOffset >>> 1);

	        if (compare(value, array[start + m]) > 0) {
	          lastOffset = m + 1;
	        } else {
	          offset = m;
	        }
	      }

	      return offset;
	    }

	    function gallopRight(value, array, start, length, hint, compare) {
	      var lastOffset = 0;
	      var maxOffset = 0;
	      var offset = 1;

	      if (compare(value, array[start + hint]) < 0) {
	        maxOffset = hint + 1;

	        while (offset < maxOffset && compare(value, array[start + hint - offset]) < 0) {
	          lastOffset = offset;
	          offset = (offset << 1) + 1;

	          if (offset <= 0) {
	            offset = maxOffset;
	          }
	        }

	        if (offset > maxOffset) {
	          offset = maxOffset;
	        }

	        var tmp = lastOffset;
	        lastOffset = hint - offset;
	        offset = hint - tmp;
	      } else {
	        maxOffset = length - hint;

	        while (offset < maxOffset && compare(value, array[start + hint + offset]) >= 0) {
	          lastOffset = offset;
	          offset = (offset << 1) + 1;

	          if (offset <= 0) {
	            offset = maxOffset;
	          }
	        }

	        if (offset > maxOffset) {
	          offset = maxOffset;
	        }

	        lastOffset += hint;
	        offset += hint;
	      }

	      lastOffset++;

	      while (lastOffset < offset) {
	        var m = lastOffset + (offset - lastOffset >>> 1);

	        if (compare(value, array[start + m]) < 0) {
	          offset = m;
	        } else {
	          lastOffset = m + 1;
	        }
	      }

	      return offset;
	    }

	    var TimSort = function () {
	      function TimSort(array, compare) {
	        _classCallCheck(this, TimSort);

	        this.array = null;
	        this.compare = null;
	        this.minGallop = DEFAULT_MIN_GALLOPING;
	        this.length = 0;
	        this.tmpStorageLength = DEFAULT_TMP_STORAGE_LENGTH;
	        this.stackLength = 0;
	        this.runStart = null;
	        this.runLength = null;
	        this.stackSize = 0;
	        this.array = array;
	        this.compare = compare;
	        this.length = array.length;

	        if (this.length < 2 * DEFAULT_TMP_STORAGE_LENGTH) {
	          this.tmpStorageLength = this.length >>> 1;
	        }

	        this.tmp = new Array(this.tmpStorageLength);
	        this.stackLength = this.length < 120 ? 5 : this.length < 1542 ? 10 : this.length < 119151 ? 19 : 40;
	        this.runStart = new Array(this.stackLength);
	        this.runLength = new Array(this.stackLength);
	      }

	      TimSort.prototype.pushRun = function pushRun(runStart, runLength) {
	        this.runStart[this.stackSize] = runStart;
	        this.runLength[this.stackSize] = runLength;
	        this.stackSize += 1;
	      };

	      TimSort.prototype.mergeRuns = function mergeRuns() {
	        while (this.stackSize > 1) {
	          var n = this.stackSize - 2;

	          if (n >= 1 && this.runLength[n - 1] <= this.runLength[n] + this.runLength[n + 1] || n >= 2 && this.runLength[n - 2] <= this.runLength[n] + this.runLength[n - 1]) {
	            if (this.runLength[n - 1] < this.runLength[n + 1]) {
	              n--;
	            }
	          } else if (this.runLength[n] > this.runLength[n + 1]) {
	            break;
	          }

	          this.mergeAt(n);
	        }
	      };

	      TimSort.prototype.forceMergeRuns = function forceMergeRuns() {
	        while (this.stackSize > 1) {
	          var n = this.stackSize - 2;

	          if (n > 0 && this.runLength[n - 1] < this.runLength[n + 1]) {
	            n--;
	          }

	          this.mergeAt(n);
	        }
	      };

	      TimSort.prototype.mergeAt = function mergeAt(i) {
	        var compare = this.compare;
	        var array = this.array;
	        var start1 = this.runStart[i];
	        var length1 = this.runLength[i];
	        var start2 = this.runStart[i + 1];
	        var length2 = this.runLength[i + 1];
	        this.runLength[i] = length1 + length2;

	        if (i === this.stackSize - 3) {
	          this.runStart[i + 1] = this.runStart[i + 2];
	          this.runLength[i + 1] = this.runLength[i + 2];
	        }

	        this.stackSize--;
	        var k = gallopRight(array[start2], array, start1, length1, 0, compare);
	        start1 += k;
	        length1 -= k;

	        if (length1 === 0) {
	          return;
	        }

	        length2 = gallopLeft(array[start1 + length1 - 1], array, start2, length2, length2 - 1, compare);

	        if (length2 === 0) {
	          return;
	        }

	        if (length1 <= length2) {
	          this.mergeLow(start1, length1, start2, length2);
	        } else {
	          this.mergeHigh(start1, length1, start2, length2);
	        }
	      };

	      TimSort.prototype.mergeLow = function mergeLow(start1, length1, start2, length2) {
	        var compare = this.compare;
	        var array = this.array;
	        var tmp = this.tmp;
	        var i = 0;

	        for (i = 0; i < length1; i++) {
	          tmp[i] = array[start1 + i];
	        }

	        var cursor1 = 0;
	        var cursor2 = start2;
	        var dest = start1;
	        array[dest++] = array[cursor2++];

	        if (--length2 === 0) {
	          for (i = 0; i < length1; i++) {
	            array[dest + i] = tmp[cursor1 + i];
	          }

	          return;
	        }

	        if (length1 === 1) {
	          for (i = 0; i < length2; i++) {
	            array[dest + i] = array[cursor2 + i];
	          }

	          array[dest + length2] = tmp[cursor1];
	          return;
	        }

	        var minGallop = this.minGallop;

	        while (true) {
	          var count1 = 0;
	          var count2 = 0;
	          var exit = false;

	          do {
	            if (compare(array[cursor2], tmp[cursor1]) < 0) {
	              array[dest++] = array[cursor2++];
	              count2++;
	              count1 = 0;

	              if (--length2 === 0) {
	                exit = true;
	                break;
	              }
	            } else {
	              array[dest++] = tmp[cursor1++];
	              count1++;
	              count2 = 0;

	              if (--length1 === 1) {
	                exit = true;
	                break;
	              }
	            }
	          } while ((count1 | count2) < minGallop);

	          if (exit) {
	            break;
	          }

	          do {
	            count1 = gallopRight(array[cursor2], tmp, cursor1, length1, 0, compare);

	            if (count1 !== 0) {
	              for (i = 0; i < count1; i++) {
	                array[dest + i] = tmp[cursor1 + i];
	              }

	              dest += count1;
	              cursor1 += count1;
	              length1 -= count1;

	              if (length1 <= 1) {
	                exit = true;
	                break;
	              }
	            }

	            array[dest++] = array[cursor2++];

	            if (--length2 === 0) {
	              exit = true;
	              break;
	            }

	            count2 = gallopLeft(tmp[cursor1], array, cursor2, length2, 0, compare);

	            if (count2 !== 0) {
	              for (i = 0; i < count2; i++) {
	                array[dest + i] = array[cursor2 + i];
	              }

	              dest += count2;
	              cursor2 += count2;
	              length2 -= count2;

	              if (length2 === 0) {
	                exit = true;
	                break;
	              }
	            }

	            array[dest++] = tmp[cursor1++];

	            if (--length1 === 1) {
	              exit = true;
	              break;
	            }

	            minGallop--;
	          } while (count1 >= DEFAULT_MIN_GALLOPING || count2 >= DEFAULT_MIN_GALLOPING);

	          if (exit) {
	            break;
	          }

	          if (minGallop < 0) {
	            minGallop = 0;
	          }

	          minGallop += 2;
	        }

	        this.minGallop = minGallop;

	        if (minGallop < 1) {
	          this.minGallop = 1;
	        }

	        if (length1 === 1) {
	          for (i = 0; i < length2; i++) {
	            array[dest + i] = array[cursor2 + i];
	          }

	          array[dest + length2] = tmp[cursor1];
	        } else if (length1 === 0) {
	          throw new Error('mergeLow preconditions were not respected');
	        } else {
	          for (i = 0; i < length1; i++) {
	            array[dest + i] = tmp[cursor1 + i];
	          }
	        }
	      };

	      TimSort.prototype.mergeHigh = function mergeHigh(start1, length1, start2, length2) {
	        var compare = this.compare;
	        var array = this.array;
	        var tmp = this.tmp;
	        var i = 0;

	        for (i = 0; i < length2; i++) {
	          tmp[i] = array[start2 + i];
	        }

	        var cursor1 = start1 + length1 - 1;
	        var cursor2 = length2 - 1;
	        var dest = start2 + length2 - 1;
	        var customCursor = 0;
	        var customDest = 0;
	        array[dest--] = array[cursor1--];

	        if (--length1 === 0) {
	          customCursor = dest - (length2 - 1);

	          for (i = 0; i < length2; i++) {
	            array[customCursor + i] = tmp[i];
	          }

	          return;
	        }

	        if (length2 === 1) {
	          dest -= length1;
	          cursor1 -= length1;
	          customDest = dest + 1;
	          customCursor = cursor1 + 1;

	          for (i = length1 - 1; i >= 0; i--) {
	            array[customDest + i] = array[customCursor + i];
	          }

	          array[dest] = tmp[cursor2];
	          return;
	        }

	        var minGallop = this.minGallop;

	        while (true) {
	          var count1 = 0;
	          var count2 = 0;
	          var exit = false;

	          do {
	            if (compare(tmp[cursor2], array[cursor1]) < 0) {
	              array[dest--] = array[cursor1--];
	              count1++;
	              count2 = 0;

	              if (--length1 === 0) {
	                exit = true;
	                break;
	              }
	            } else {
	              array[dest--] = tmp[cursor2--];
	              count2++;
	              count1 = 0;

	              if (--length2 === 1) {
	                exit = true;
	                break;
	              }
	            }
	          } while ((count1 | count2) < minGallop);

	          if (exit) {
	            break;
	          }

	          do {
	            count1 = length1 - gallopRight(tmp[cursor2], array, start1, length1, length1 - 1, compare);

	            if (count1 !== 0) {
	              dest -= count1;
	              cursor1 -= count1;
	              length1 -= count1;
	              customDest = dest + 1;
	              customCursor = cursor1 + 1;

	              for (i = count1 - 1; i >= 0; i--) {
	                array[customDest + i] = array[customCursor + i];
	              }

	              if (length1 === 0) {
	                exit = true;
	                break;
	              }
	            }

	            array[dest--] = tmp[cursor2--];

	            if (--length2 === 1) {
	              exit = true;
	              break;
	            }

	            count2 = length2 - gallopLeft(array[cursor1], tmp, 0, length2, length2 - 1, compare);

	            if (count2 !== 0) {
	              dest -= count2;
	              cursor2 -= count2;
	              length2 -= count2;
	              customDest = dest + 1;
	              customCursor = cursor2 + 1;

	              for (i = 0; i < count2; i++) {
	                array[customDest + i] = tmp[customCursor + i];
	              }

	              if (length2 <= 1) {
	                exit = true;
	                break;
	              }
	            }

	            array[dest--] = array[cursor1--];

	            if (--length1 === 0) {
	              exit = true;
	              break;
	            }

	            minGallop--;
	          } while (count1 >= DEFAULT_MIN_GALLOPING || count2 >= DEFAULT_MIN_GALLOPING);

	          if (exit) {
	            break;
	          }

	          if (minGallop < 0) {
	            minGallop = 0;
	          }

	          minGallop += 2;
	        }

	        this.minGallop = minGallop;

	        if (minGallop < 1) {
	          this.minGallop = 1;
	        }

	        if (length2 === 1) {
	          dest -= length1;
	          cursor1 -= length1;
	          customDest = dest + 1;
	          customCursor = cursor1 + 1;

	          for (i = length1 - 1; i >= 0; i--) {
	            array[customDest + i] = array[customCursor + i];
	          }

	          array[dest] = tmp[cursor2];
	        } else if (length2 === 0) {
	          throw new Error('mergeHigh preconditions were not respected');
	        } else {
	          customCursor = dest - (length2 - 1);

	          for (i = 0; i < length2; i++) {
	            array[customCursor + i] = tmp[i];
	          }
	        }
	      };

	      return TimSort;
	    }();

	    function sort(array, compare, lo, hi) {
	      if (!isArray$3(array)) {
	        throw new TypeError('Can only sort arrays');
	      }

	      if (!compare) {
	        compare = alphabeticalCompare;
	      } else if (typeof compare !== 'function') {
	        hi = lo;
	        lo = compare;
	        compare = alphabeticalCompare;
	      }

	      if (!lo) {
	        lo = 0;
	      }

	      if (!hi) {
	        hi = array.length;
	      }

	      var remaining = hi - lo;

	      if (remaining < 2) {
	        return;
	      }

	      var runLength = 0;

	      if (remaining < DEFAULT_MIN_MERGE) {
	        runLength = makeAscendingRun(array, lo, hi, compare);
	        binaryInsertionSort(array, lo, hi, lo + runLength, compare);
	        return;
	      }

	      var ts = new TimSort(array, compare);
	      var minRun = minRunLength(remaining);

	      do {
	        runLength = makeAscendingRun(array, lo, hi, compare);

	        if (runLength < minRun) {
	          var force = remaining;

	          if (force > minRun) {
	            force = minRun;
	          }

	          binaryInsertionSort(array, lo, lo + force, lo + runLength, compare);
	          runLength = force;
	        }

	        ts.pushRun(lo, runLength);
	        ts.mergeRuns();
	        remaining -= runLength;
	        lo += runLength;
	      } while (remaining !== 0);

	      ts.forceMergeRuns();
	    }
	  });
	});
	unwrapExports(timsort);

	var timsort$1 = timsort;

	var timsort_1 = sort$2(timsort$1);

	/**
	 * Interface definition for direction strategy classes.
	 *
	 * This class describes the interface for the Strategy
	 * pattern classes used to differentiate horizontal and vertical
	 * direction of hierarchical results.
	 *
	 * For a given direction, one coordinate will be 'fixed', meaning that it is
	 * determined by level.
	 * The other coordinate is 'unfixed', meaning that the nodes on a given level
	 * can still move along that coordinate. So:
	 *
	 * - `vertical` layout: `x` unfixed, `y` fixed per level
	 * - `horizontal` layout: `x` fixed per level, `y` unfixed
	 *
	 * The local methods are stubs and should be regarded as abstract.
	 * Derived classes **must** implement all the methods themselves.
	 *
	 * @private
	 */

	var DirectionInterface =
	/*#__PURE__*/
	function () {
	  function DirectionInterface() {
	    classCallCheck(this, DirectionInterface);
	  }

	  createClass(DirectionInterface, [{
	    key: "abstract",

	    /** @ignore **/
	    value: function abstract() {
	      throw new Error("Can't instantiate abstract class!");
	    }
	    /**
	     * This is a dummy call which is used to suppress the jsdoc errors of type:
	     *
	     *   "'param' is assigned a value but never used"
	     *
	     * @ignore
	     **/

	  }, {
	    key: "fake_use",
	    value: function fake_use() {} // Do nothing special

	    /**
	     * Type to use to translate dynamic curves to, in the case of hierarchical layout.
	     * Dynamic curves do not work for these.
	     *
	     * The value should be perpendicular to the actual direction of the layout.
	     *
	     * @return {string} Direction, either 'vertical' or 'horizontal'
	     */

	  }, {
	    key: "curveType",
	    value: function curveType() {
	      return this.abstract();
	    }
	    /**
	     * Return the value of the coordinate that is not fixed for this direction.
	     *
	     * @param {Node} node The node to read
	     * @return {number} Value of the unfixed coordinate
	     */

	  }, {
	    key: "getPosition",
	    value: function getPosition(node) {
	      this.fake_use(node);
	      return this.abstract();
	    }
	    /**
	     * Set the value of the coordinate that is not fixed for this direction.
	     *
	     * @param {Node} node The node to adjust
	     * @param {number} position
	     * @param {number} [level] if specified, the hierarchy level that this node should be fixed to
	     */

	  }, {
	    key: "setPosition",
	    value: function setPosition(node, position) {
	      var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
	      this.fake_use(node, position, level);
	      this.abstract();
	    }
	    /**
	     * Get the width of a tree.
	     *
	     * A `tree` here is a subset of nodes within the network which are not connected to other nodes,
	     * only among themselves. In essence, it is a sub-network.
	     *
	     * @param {number} index The index number of a tree
	     * @return {number} the width of a tree in the view coordinates
	     */

	  }, {
	    key: "getTreeSize",
	    value: function getTreeSize(index) {
	      this.fake_use(index);
	      return this.abstract();
	    }
	    /**
	     * Sort array of nodes on the unfixed coordinates.
	     *
	     * **Note:** chrome has non-stable sorting implementation, which
	     * has a tendency to change the order of the array items,
	     * even if the custom sort function returns 0.
	     *
	     * For this reason, an external sort implementation is used,
	     * which has the added benefit of being faster than the standard
	     * platforms implementation. This has been verified on `node.js`,
	     * `firefox` and `chrome` (all linux).
	     *
	     * @param {Array.<Node>} nodeArray array of nodes to sort
	     */

	  }, {
	    key: "sort",
	    value: function sort(nodeArray) {
	      this.fake_use(nodeArray);
	      this.abstract();
	    }
	    /**
	     * Assign the fixed coordinate of the node to the given level
	     *
	     * @param {Node} node The node to adjust
	     * @param {number} level The level to fix to
	     */

	  }, {
	    key: "fix",
	    value: function fix(node, level) {
	      this.fake_use(node, level);
	      this.abstract();
	    }
	    /**
	     * Add an offset to the unfixed coordinate of the given node. 
	     *
	     * @param {NodeId} nodeId Id of the node to adjust
	     * @param {number} diff Offset to add to the unfixed coordinate
	     */

	  }, {
	    key: "shift",
	    value: function shift(nodeId, diff) {
	      this.fake_use(nodeId, diff);
	      this.abstract();
	    }
	  }]);

	  return DirectionInterface;
	}();
	/**
	 * Vertical Strategy
	 *
	 * Coordinate `y` is fixed on levels, coordinate `x` is unfixed.
	 *
	 * @extends DirectionInterface
	 * @private
	 */


	var VerticalStrategy =
	/*#__PURE__*/
	function (_DirectionInterface) {
	  inherits$1(VerticalStrategy, _DirectionInterface);

	  /**
	   * Constructor
	   *
	   * @param {Object} layout reference to the parent LayoutEngine instance.
	   */
	  function VerticalStrategy(layout) {
	    var _this;

	    classCallCheck(this, VerticalStrategy);

	    _this = possibleConstructorReturn$1(this, getPrototypeOf$7(VerticalStrategy).call(this));
	    _this.layout = layout;
	    return _this;
	  }
	  /** @inheritdoc */


	  createClass(VerticalStrategy, [{
	    key: "curveType",
	    value: function curveType() {
	      return 'horizontal';
	    }
	    /** @inheritdoc */

	  }, {
	    key: "getPosition",
	    value: function getPosition(node) {
	      return node.x;
	    }
	    /** @inheritdoc */

	  }, {
	    key: "setPosition",
	    value: function setPosition(node, position) {
	      var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;

	      if (level !== undefined) {
	        this.layout.hierarchical.addToOrdering(node, level);
	      }

	      node.x = position;
	    }
	    /** @inheritdoc */

	  }, {
	    key: "getTreeSize",
	    value: function getTreeSize(index) {
	      var res = this.layout.hierarchical.getTreeSize(this.layout.body.nodes, index);
	      return {
	        min: res.min_x,
	        max: res.max_x
	      };
	    }
	    /** @inheritdoc */

	  }, {
	    key: "sort",
	    value: function sort(nodeArray) {
	      timsort_1(nodeArray, function (a, b) {
	        return a.x - b.x;
	      });
	    }
	    /** @inheritdoc */

	  }, {
	    key: "fix",
	    value: function fix(node, level) {
	      node.y = this.layout.options.hierarchical.levelSeparation * level;
	      node.options.fixed.y = true;
	    }
	    /** @inheritdoc */

	  }, {
	    key: "shift",
	    value: function shift(nodeId, diff) {
	      this.layout.body.nodes[nodeId].x += diff;
	    }
	  }]);

	  return VerticalStrategy;
	}(DirectionInterface);
	/**
	 * Horizontal Strategy
	 *
	 * Coordinate `x` is fixed on levels, coordinate `y` is unfixed.
	 *
	 * @extends DirectionInterface
	 * @private
	 */


	var HorizontalStrategy =
	/*#__PURE__*/
	function (_DirectionInterface2) {
	  inherits$1(HorizontalStrategy, _DirectionInterface2);

	  /**
	   * Constructor
	   *
	   * @param {Object} layout reference to the parent LayoutEngine instance.
	   */
	  function HorizontalStrategy(layout) {
	    var _this2;

	    classCallCheck(this, HorizontalStrategy);

	    _this2 = possibleConstructorReturn$1(this, getPrototypeOf$7(HorizontalStrategy).call(this));
	    _this2.layout = layout;
	    return _this2;
	  }
	  /** @inheritdoc */


	  createClass(HorizontalStrategy, [{
	    key: "curveType",
	    value: function curveType() {
	      return 'vertical';
	    }
	    /** @inheritdoc */

	  }, {
	    key: "getPosition",
	    value: function getPosition(node) {
	      return node.y;
	    }
	    /** @inheritdoc */

	  }, {
	    key: "setPosition",
	    value: function setPosition(node, position) {
	      var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;

	      if (level !== undefined) {
	        this.layout.hierarchical.addToOrdering(node, level);
	      }

	      node.y = position;
	    }
	    /** @inheritdoc */

	  }, {
	    key: "getTreeSize",
	    value: function getTreeSize(index) {
	      var res = this.layout.hierarchical.getTreeSize(this.layout.body.nodes, index);
	      return {
	        min: res.min_y,
	        max: res.max_y
	      };
	    }
	    /** @inheritdoc */

	  }, {
	    key: "sort",
	    value: function sort(nodeArray) {
	      timsort_1(nodeArray, function (a, b) {
	        return a.y - b.y;
	      });
	    }
	    /** @inheritdoc */

	  }, {
	    key: "fix",
	    value: function fix(node, level) {
	      node.x = this.layout.options.hierarchical.levelSeparation * level;
	      node.options.fixed.x = true;
	    }
	    /** @inheritdoc */

	  }, {
	    key: "shift",
	    value: function shift(nodeId, diff) {
	      this.layout.body.nodes[nodeId].y += diff;
	    }
	  }]);

	  return HorizontalStrategy;
	}(DirectionInterface);

	var $every = arrayIteration.every;


	// `Array.prototype.every` method
	// https://tc39.github.io/ecma262/#sec-array.prototype.every
	_export({ target: 'Array', proto: true, forced: sloppyArrayMethod('every') }, {
	  every: function every(callbackfn /* , thisArg */) {
	    return $every(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
	  }
	});

	var every = entryVirtual('Array').every;

	var ArrayPrototype$j = Array.prototype;

	var every_1 = function (it) {
	  var own = it.every;
	  return it === ArrayPrototype$j || (it instanceof Array && own === ArrayPrototype$j.every) ? every : own;
	};

	var every$1 = every_1;

	var every$2 = every$1;

	/**
	 * Try to assign levels to nodes according to their positions in the cyclic “hierarchy”.
	 *
	 * @param nodes - Nodes of the graph.
	 * @param levels - If present levels will be added to it, if not a new object will be created.
	 *
	 * @returns Populated node levels.
	 */
	function fillLevelsByDirectionCyclic(nodes, levels) {
	  var edges = new set$4();

	  forEach$2(nodes).call(nodes, function (node) {
	    var _context;

	    forEach$2(_context = node.edges).call(_context, function (edge) {
	      if (edge.connected) {
	        edges.add(edge);
	      }
	    });
	  });

	  forEach$2(edges).call(edges, function (edge) {
	    var fromId = edge.from.id;
	    var toId = edge.to.id;

	    if (levels[fromId] == null) {
	      levels[fromId] = 0;
	    }

	    if (levels[toId] == null || levels[fromId] >= levels[toId]) {
	      levels[toId] = levels[fromId] + 1;
	    }
	  });

	  return levels;
	}
	/**
	 * Assign levels to nodes according to their positions in the hierarchy. Leaves will be lined up at the bottom and all other nodes as close to their children as possible.
	 *
	 * @param nodes - Nodes of the graph.
	 * @param levels - If present levels will be added to it, if not a new object will be created.
	 *
	 * @returns Populated node levels.
	 */


	function fillLevelsByDirectionLeaves(nodes) {
	  var levels = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : create$2(null);
	  return fillLevelsByDirection( // Pick only leaves (nodes without children).
	  function (node) {
	    var _context2;

	    return !every$2(_context2 = node.edges).call(_context2, function (edge) {
	      return edge.to === node;
	    });
	  }, // Use the lowest level.
	  function (newLevel, oldLevel) {
	    return oldLevel > newLevel;
	  }, // Go against the direction of the edges.
	  "from", nodes, levels);
	}
	/**
	 * Assign levels to nodes according to their positions in the hierarchy. Roots will be lined up at the top and all nodes as close to their parents as possible.
	 *
	 * @param nodes - Nodes of the graph.
	 * @param levels - If present levels will be added to it, if not a new object will be created.
	 *
	 * @returns Populated node levels.
	 */

	function fillLevelsByDirectionRoots(nodes) {
	  var levels = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : create$2(null);
	  return fillLevelsByDirection( // Pick only roots (nodes without parents).
	  function (node) {
	    var _context3;

	    return !every$2(_context3 = node.edges).call(_context3, function (edge) {
	      return edge.from === node;
	    });
	  }, // Use the highest level.
	  function (newLevel, oldLevel) {
	    return oldLevel < newLevel;
	  }, // Go in the direction of the edges.
	  "to", nodes, levels);
	}
	/**
	 * Assign levels to nodes according to their positions in the hierarchy.
	 *
	 * @param isEntryNode - Checks and return true if the graph should be traversed from this node.
	 * @param shouldLevelBeReplaced - Checks and returns true if the level of given node should be updated to the new value.
	 * @param direction - Wheter the graph should be traversed in the direction of the edges `"to"` or in the other way `"from"`.
	 * @param nodes - Nodes of the graph.
	 * @param levels - If present levels will be added to it, if not a new object will be created.
	 *
	 * @returns Populated node levels.
	 */

	function fillLevelsByDirection(isEntryNode, shouldLevelBeReplaced, direction, nodes, levels) {
	  var limit = nodes.length;
	  var edgeIdProp = direction + "Id";
	  var newLevelDiff = direction === "to" ? 1 : -1;
	  var _iteratorNormalCompletion = true;
	  var _didIteratorError = false;
	  var _iteratorError = undefined;

	  try {
	    var _loop = function _loop() {
	      var entryNode = _step.value;

	      if (isEntryNode(entryNode)) {
	        return "continue";
	      } // Line up all the entry nodes on level 0.


	      levels[entryNode.id] = 0;
	      var stack = [entryNode];
	      var done = 0;
	      var node = void 0;

	      var _loop2 = function _loop2() {
	        var _context4, _context5;

	        var newLevel = levels[node.id] + newLevelDiff;

	        forEach$2(_context4 = filter$2(_context5 = node.edges).call(_context5, function (edge) {
	          return (// Ignore disconnected edges.
	            edge.connected && // Ignore circular edges.
	            edge.to !== edge.from && // Ignore edges leading to the node that's currently being processed.
	            edge[direction] !== node
	          );
	        })).call(_context4, function (edge) {
	          var targetNodeId = edge[edgeIdProp];
	          var oldLevel = levels[targetNodeId];

	          if (oldLevel == null || shouldLevelBeReplaced(newLevel, oldLevel)) {
	            levels[targetNodeId] = newLevel;
	            stack.push(edge[direction]);
	          }
	        });

	        if (done > limit) {
	          // This would run forever on a cyclic graph.
	          return {
	            v: {
	              v: fillLevelsByDirectionCyclic(nodes, levels)
	            }
	          };
	        } else {
	          ++done;
	        }
	      };

	      while (node = stack.pop()) {
	        var _ret2 = _loop2();

	        if (_typeof_1(_ret2) === "object") return _ret2.v;
	      }
	    };

	    for (var _iterator = getIterator$5(nodes), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
	      var _ret = _loop();

	      switch (_ret) {
	        case "continue":
	          continue;

	        default:
	          if (_typeof_1(_ret) === "object") return _ret.v;
	      }
	    }
	  } catch (err) {
	    _didIteratorError = true;
	    _iteratorError = err;
	  } finally {
	    try {
	      if (!_iteratorNormalCompletion && _iterator.return != null) {
	        _iterator.return();
	      }
	    } finally {
	      if (_didIteratorError) {
	        throw _iteratorError;
	      }
	    }
	  }

	  return levels;
	}

	/**
	 * There's a mix-up with terms in the code. Following are the formal definitions:
	 *
	 *   tree   - a strict hierarchical network, i.e. every node has at most one parent
	 *   forest - a collection of trees. These distinct trees are thus not connected.
	 *
	 * So:
	 * - in a network that is not a tree, there exist nodes with multiple parents.
	 * - a network consisting of unconnected sub-networks, of which at least one
	 *   is not a tree, is not a forest.
	 *
	 * In the code, the definitions are:
	 *
	 *   tree   - any disconnected sub-network, strict hierarchical or not.
	 *   forest - a bunch of these sub-networks
	 *
	 * The difference between tree and not-tree is important in the code, notably within
	 * to the block-shifting algorithm. The algorithm assumes formal trees and fails
	 * for not-trees, often in a spectacular manner (search for 'exploding network' in the issues).
	 *
	 * In order to distinguish the definitions in the following code, the adjective 'formal' is
	 * used. If 'formal' is absent, you must assume the non-formal definition.
	 *
	 * ----------------------------------------------------------------------------------
	 * NOTES
	 * =====
	 *
	 * A hierarchical layout is a different thing from a hierarchical network.
	 * The layout is a way to arrange the nodes in the view; this can be done
	 * on non-hierarchical networks as well. The converse is also possible.
	 */
	/**
	 * Container for derived data on current network, relating to hierarchy.
	 *
	 * @private
	 */

	var HierarchicalStatus =
	/*#__PURE__*/
	function () {
	  /**
	   * @ignore
	   */
	  function HierarchicalStatus() {
	    classCallCheck(this, HierarchicalStatus);

	    this.childrenReference = {}; // child id's per node id

	    this.parentReference = {}; // parent id's per node id

	    this.trees = {}; // tree id per node id; i.e. to which tree does given node id belong

	    this.distributionOrdering = {}; // The nodes per level, in the display order

	    this.levels = {}; // hierarchy level per node id

	    this.distributionIndex = {}; // The position of the node in the level sorting order, per node id.

	    this.isTree = false; // True if current network is a formal tree 

	    this.treeIndex = -1; // Highest tree id in current network.
	  }
	  /**
	   * Add the relation between given nodes to the current state.
	   *
	   * @param {Node.id} parentNodeId
	   * @param {Node.id} childNodeId
	   */


	  createClass(HierarchicalStatus, [{
	    key: "addRelation",
	    value: function addRelation(parentNodeId, childNodeId) {
	      if (this.childrenReference[parentNodeId] === undefined) {
	        this.childrenReference[parentNodeId] = [];
	      }

	      this.childrenReference[parentNodeId].push(childNodeId);

	      if (this.parentReference[childNodeId] === undefined) {
	        this.parentReference[childNodeId] = [];
	      }

	      this.parentReference[childNodeId].push(parentNodeId);
	    }
	    /**
	     * Check if the current state is for a formal tree or formal forest.
	     *
	     * This is the case if every node has at most one parent.
	     *
	     * Pre: parentReference init'ed properly for current network
	     */

	  }, {
	    key: "checkIfTree",
	    value: function checkIfTree() {
	      for (var i in this.parentReference) {
	        if (this.parentReference[i].length > 1) {
	          this.isTree = false;
	          return;
	        }
	      }

	      this.isTree = true;
	    }
	    /**
	     * Return the number of separate trees in the current network.
	     * @returns {number}
	     */

	  }, {
	    key: "numTrees",
	    value: function numTrees() {
	      return this.treeIndex + 1; // This assumes the indexes are assigned consecitively
	    }
	    /**
	     * Assign a tree id to a node
	     * @param {Node} node
	     * @param {string|number} treeId
	     */

	  }, {
	    key: "setTreeIndex",
	    value: function setTreeIndex(node, treeId) {
	      if (treeId === undefined) return; // Don't bother

	      if (this.trees[node.id] === undefined) {
	        this.trees[node.id] = treeId;
	        this.treeIndex = Math.max(treeId, this.treeIndex);
	      }
	    }
	    /**
	     * Ensure level for given id is defined.
	     *
	     * Sets level to zero for given node id if not already present
	     *
	     * @param {Node.id} nodeId
	     */

	  }, {
	    key: "ensureLevel",
	    value: function ensureLevel(nodeId) {
	      if (this.levels[nodeId] === undefined) {
	        this.levels[nodeId] = 0;
	      }
	    }
	    /**
	     * get the maximum level of a branch.
	     *
	     * TODO: Never entered; find a test case to test this!
	     * @param {Node.id} nodeId
	     * @returns {number}
	     */

	  }, {
	    key: "getMaxLevel",
	    value: function getMaxLevel(nodeId) {
	      var _this = this;

	      var accumulator = {};

	      var _getMaxLevel = function _getMaxLevel(nodeId) {
	        if (accumulator[nodeId] !== undefined) {
	          return accumulator[nodeId];
	        }

	        var level = _this.levels[nodeId];

	        if (_this.childrenReference[nodeId]) {
	          var children = _this.childrenReference[nodeId];

	          if (children.length > 0) {
	            for (var i = 0; i < children.length; i++) {
	              level = Math.max(level, _getMaxLevel(children[i]));
	            }
	          }
	        }

	        accumulator[nodeId] = level;
	        return level;
	      };

	      return _getMaxLevel(nodeId);
	    }
	    /**
	     *
	     * @param {Node} nodeA
	     * @param {Node} nodeB
	     */

	  }, {
	    key: "levelDownstream",
	    value: function levelDownstream(nodeA, nodeB) {
	      if (this.levels[nodeB.id] === undefined) {
	        // set initial level
	        if (this.levels[nodeA.id] === undefined) {
	          this.levels[nodeA.id] = 0;
	        } // set level


	        this.levels[nodeB.id] = this.levels[nodeA.id] + 1;
	      }
	    }
	    /**
	     * Small util method to set the minimum levels of the nodes to zero.
	     *
	     * @param {Array.<Node>} nodes
	     */

	  }, {
	    key: "setMinLevelToZero",
	    value: function setMinLevelToZero(nodes) {
	      var minLevel = 1e9; // get the minimum level

	      for (var nodeId in nodes) {
	        if (nodes.hasOwnProperty(nodeId)) {
	          if (this.levels[nodeId] !== undefined) {
	            minLevel = Math.min(this.levels[nodeId], minLevel);
	          }
	        }
	      } // subtract the minimum from the set so we have a range starting from 0


	      for (var _nodeId in nodes) {
	        if (nodes.hasOwnProperty(_nodeId)) {
	          if (this.levels[_nodeId] !== undefined) {
	            this.levels[_nodeId] -= minLevel;
	          }
	        }
	      }
	    }
	    /**
	     * Get the min and max xy-coordinates of a given tree
	     *
	     * @param {Array.<Node>} nodes
	     * @param {number} index
	     * @returns {{min_x: number, max_x: number, min_y: number, max_y: number}}
	     */

	  }, {
	    key: "getTreeSize",
	    value: function getTreeSize(nodes, index) {
	      var min_x = 1e9;
	      var max_x = -1e9;
	      var min_y = 1e9;
	      var max_y = -1e9;

	      for (var nodeId in this.trees) {
	        if (this.trees.hasOwnProperty(nodeId)) {
	          if (this.trees[nodeId] === index) {
	            var node = nodes[nodeId];
	            min_x = Math.min(node.x, min_x);
	            max_x = Math.max(node.x, max_x);
	            min_y = Math.min(node.y, min_y);
	            max_y = Math.max(node.y, max_y);
	          }
	        }
	      }

	      return {
	        min_x: min_x,
	        max_x: max_x,
	        min_y: min_y,
	        max_y: max_y
	      };
	    }
	    /**
	     * Check if two nodes have the same parent(s)
	     *
	     * @param {Node} node1
	     * @param {Node} node2
	     * @return {boolean} true if the two nodes have a same ancestor node, false otherwise
	     */

	  }, {
	    key: "hasSameParent",
	    value: function hasSameParent(node1, node2) {
	      var parents1 = this.parentReference[node1.id];
	      var parents2 = this.parentReference[node2.id];

	      if (parents1 === undefined || parents2 === undefined) {
	        return false;
	      }

	      for (var i = 0; i < parents1.length; i++) {
	        for (var j = 0; j < parents2.length; j++) {
	          if (parents1[i] == parents2[j]) {
	            return true;
	          }
	        }
	      }

	      return false;
	    }
	    /**
	     * Check if two nodes are in the same tree.
	     *
	     * @param {Node} node1
	     * @param {Node} node2
	     * @return {Boolean} true if this is so, false otherwise
	     */

	  }, {
	    key: "inSameSubNetwork",
	    value: function inSameSubNetwork(node1, node2) {
	      return this.trees[node1.id] === this.trees[node2.id];
	    }
	    /**
	     * Get a list of the distinct levels in the current network
	     *
	     * @returns {Array}
	     */

	  }, {
	    key: "getLevels",
	    value: function getLevels() {
	      return keys$6(this.distributionOrdering);
	    }
	    /**
	     * Add a node to the ordering per level
	     *
	     * @param {Node} node
	     * @param {number} level
	     */

	  }, {
	    key: "addToOrdering",
	    value: function addToOrdering(node, level) {
	      if (this.distributionOrdering[level] === undefined) {
	        this.distributionOrdering[level] = [];
	      }

	      var isPresent = false;
	      var curLevel = this.distributionOrdering[level];

	      for (var n in curLevel) {
	        //if (curLevel[n].id === node.id) {
	        if (curLevel[n] === node) {
	          isPresent = true;
	          break;
	        }
	      }

	      if (!isPresent) {
	        this.distributionOrdering[level].push(node);
	        this.distributionIndex[node.id] = this.distributionOrdering[level].length - 1;
	      }
	    }
	  }]);

	  return HierarchicalStatus;
	}();
	/**
	 * The Layout Engine
	 */


	var LayoutEngine =
	/*#__PURE__*/
	function () {
	  /**
	   * @param {Object} body
	   */
	  function LayoutEngine(body) {
	    classCallCheck(this, LayoutEngine);

	    this.body = body;
	    this.initialRandomSeed = Math.round(Math.random() * 1000000);
	    this.randomSeed = this.initialRandomSeed;
	    this.setPhysics = false;
	    this.options = {};
	    this.optionsBackup = {
	      physics: {}
	    };
	    this.defaultOptions = {
	      randomSeed: undefined,
	      improvedLayout: true,
	      clusterThreshold: 150,
	      hierarchical: {
	        enabled: false,
	        levelSeparation: 150,
	        nodeSpacing: 100,
	        treeSpacing: 200,
	        blockShifting: true,
	        edgeMinimization: true,
	        parentCentralization: true,
	        direction: 'UD',
	        // UD, DU, LR, RL
	        sortMethod: 'hubsize' // hubsize, directed

	      }
	    };
	    extend(this.options, this.defaultOptions);
	    this.bindEventListeners();
	  }
	  /**
	   * Binds event listeners
	   */


	  createClass(LayoutEngine, [{
	    key: "bindEventListeners",
	    value: function bindEventListeners() {
	      var _this2 = this;

	      this.body.emitter.on('_dataChanged', function () {
	        _this2.setupHierarchicalLayout();
	      });
	      this.body.emitter.on('_dataLoaded', function () {
	        _this2.layoutNetwork();
	      });
	      this.body.emitter.on('_resetHierarchicalLayout', function () {
	        _this2.setupHierarchicalLayout();
	      });
	      this.body.emitter.on('_adjustEdgesForHierarchicalLayout', function () {
	        if (_this2.options.hierarchical.enabled !== true) {
	          return;
	        } // get the type of static smooth curve in case it is required


	        var type = _this2.direction.curveType(); // force all edges into static smooth curves.


	        _this2.body.emitter.emit('_forceDisableDynamicCurves', type, false);
	      });
	    }
	    /**
	     *
	     * @param {Object} options
	     * @param {Object} allOptions
	     * @returns {Object}
	     */

	  }, {
	    key: "setOptions",
	    value: function setOptions(options, allOptions) {
	      if (options !== undefined) {
	        var hierarchical = this.options.hierarchical;
	        var prevHierarchicalState = hierarchical.enabled;
	        selectiveDeepExtend(["randomSeed", "improvedLayout", "clusterThreshold"], this.options, options);
	        mergeOptions(this.options, options, 'hierarchical');

	        if (options.randomSeed !== undefined) {
	          this.initialRandomSeed = options.randomSeed;
	        }

	        if (hierarchical.enabled === true) {
	          if (prevHierarchicalState === true) {
	            // refresh the overridden options for nodes and edges.
	            this.body.emitter.emit('refresh', true);
	          } // make sure the level separation is the right way up


	          if (hierarchical.direction === 'RL' || hierarchical.direction === 'DU') {
	            if (hierarchical.levelSeparation > 0) {
	              hierarchical.levelSeparation *= -1;
	            }
	          } else {
	            if (hierarchical.levelSeparation < 0) {
	              hierarchical.levelSeparation *= -1;
	            }
	          }

	          this.setDirectionStrategy();
	          this.body.emitter.emit('_resetHierarchicalLayout'); // because the hierarchical system needs it's own physics and smooth curve settings,
	          // we adapt the other options if needed.

	          return this.adaptAllOptionsForHierarchicalLayout(allOptions);
	        } else {
	          if (prevHierarchicalState === true) {
	            // refresh the overridden options for nodes and edges.
	            this.body.emitter.emit('refresh');
	            return deepExtend(allOptions, this.optionsBackup);
	          }
	        }
	      }

	      return allOptions;
	    }
	    /**
	     *
	     * @param {Object} allOptions
	     * @returns {Object}
	     */

	  }, {
	    key: "adaptAllOptionsForHierarchicalLayout",
	    value: function adaptAllOptionsForHierarchicalLayout(allOptions) {
	      if (this.options.hierarchical.enabled === true) {
	        var backupPhysics = this.optionsBackup.physics; // set the physics

	        if (allOptions.physics === undefined || allOptions.physics === true) {
	          allOptions.physics = {
	            enabled: backupPhysics.enabled === undefined ? true : backupPhysics.enabled,
	            solver: 'hierarchicalRepulsion'
	          };
	          backupPhysics.enabled = backupPhysics.enabled === undefined ? true : backupPhysics.enabled;
	          backupPhysics.solver = backupPhysics.solver || 'barnesHut';
	        } else if (_typeof_1(allOptions.physics) === 'object') {
	          backupPhysics.enabled = allOptions.physics.enabled === undefined ? true : allOptions.physics.enabled;
	          backupPhysics.solver = allOptions.physics.solver || 'barnesHut';
	          allOptions.physics.solver = 'hierarchicalRepulsion';
	        } else if (allOptions.physics !== false) {
	          backupPhysics.solver = 'barnesHut';
	          allOptions.physics = {
	            solver: 'hierarchicalRepulsion'
	          };
	        } // get the type of static smooth curve in case it is required


	        var type = this.direction.curveType(); // disable smooth curves if nothing is defined. If smooth curves have been turned on,
	        // turn them into static smooth curves.

	        if (allOptions.edges === undefined) {
	          this.optionsBackup.edges = {
	            smooth: {
	              enabled: true,
	              type: 'dynamic'
	            }
	          };
	          allOptions.edges = {
	            smooth: false
	          };
	        } else if (allOptions.edges.smooth === undefined) {
	          this.optionsBackup.edges = {
	            smooth: {
	              enabled: true,
	              type: 'dynamic'
	            }
	          };
	          allOptions.edges.smooth = false;
	        } else {
	          if (typeof allOptions.edges.smooth === 'boolean') {
	            this.optionsBackup.edges = {
	              smooth: allOptions.edges.smooth
	            };
	            allOptions.edges.smooth = {
	              enabled: allOptions.edges.smooth,
	              type: type
	            };
	          } else {
	            var smooth = allOptions.edges.smooth; // allow custom types except for dynamic

	            if (smooth.type !== undefined && smooth.type !== 'dynamic') {
	              type = smooth.type;
	            } // TODO: this is options merging; see if the standard routines can be used here.


	            this.optionsBackup.edges = {
	              smooth: smooth.enabled === undefined ? true : smooth.enabled,
	              type: smooth.type === undefined ? 'dynamic' : smooth.type,
	              roundness: smooth.roundness === undefined ? 0.5 : smooth.roundness,
	              forceDirection: smooth.forceDirection === undefined ? false : smooth.forceDirection
	            }; // NOTE: Copying an object to self; this is basically setting defaults for undefined variables

	            allOptions.edges.smooth = {
	              enabled: smooth.enabled === undefined ? true : smooth.enabled,
	              type: type,
	              roundness: smooth.roundness === undefined ? 0.5 : smooth.roundness,
	              forceDirection: smooth.forceDirection === undefined ? false : smooth.forceDirection
	            };
	          }
	        } // Force all edges into static smooth curves.
	        // Only applies to edges that do not use the global options for smooth.


	        this.body.emitter.emit('_forceDisableDynamicCurves', type);
	      }

	      return allOptions;
	    }
	    /**
	     *
	     * @returns {number}
	     */

	  }, {
	    key: "seededRandom",
	    value: function seededRandom() {
	      var x = Math.sin(this.randomSeed++) * 10000;
	      return x - Math.floor(x);
	    }
	    /**
	     *
	     * @param {Array.<Node>} nodesArray
	     */

	  }, {
	    key: "positionInitially",
	    value: function positionInitially(nodesArray) {
	      if (this.options.hierarchical.enabled !== true) {
	        this.randomSeed = this.initialRandomSeed;
	        var radius = nodesArray.length + 50;

	        for (var i = 0; i < nodesArray.length; i++) {
	          var node = nodesArray[i];
	          var angle = 2 * Math.PI * this.seededRandom();

	          if (node.x === undefined) {
	            node.x = radius * Math.cos(angle);
	          }

	          if (node.y === undefined) {
	            node.y = radius * Math.sin(angle);
	          }
	        }
	      }
	    }
	    /**
	     * Use Kamada Kawai to position nodes. This is quite a heavy algorithm so if there are a lot of nodes we
	     * cluster them first to reduce the amount.
	     */

	  }, {
	    key: "layoutNetwork",
	    value: function layoutNetwork() {
	      if (this.options.hierarchical.enabled !== true && this.options.improvedLayout === true) {
	        var indices = this.body.nodeIndices; // first check if we should Kamada Kawai to layout. The threshold is if less than half of the visible
	        // nodes have predefined positions we use this.

	        var positionDefined = 0;

	        for (var i = 0; i < indices.length; i++) {
	          var node = this.body.nodes[indices[i]];

	          if (node.predefinedPosition === true) {
	            positionDefined += 1;
	          }
	        } // if less than half of the nodes have a predefined position we continue


	        if (positionDefined < 0.5 * indices.length) {
	          var MAX_LEVELS = 10;
	          var level = 0;
	          var clusterThreshold = this.options.clusterThreshold; //
	          // Define the options for the hidden cluster nodes
	          // These options don't propagate outside the clustering phase.
	          //
	          // Some options are explicitly disabled, because they may be set in group or default node options.
	          // The clusters are never displayed, so most explicit settings here serve as performance optimizations.
	          //
	          // The explicit setting of 'shape' is to avoid `shape: 'image'`; images are not passed to the hidden
	          // cluster nodes, leading to an exception on creation.
	          //
	          // All settings here are performance related, except when noted otherwise.
	          //

	          var clusterOptions = {
	            clusterNodeProperties: {
	              shape: 'ellipse',
	              // Bugfix: avoid type 'image', no images supplied
	              label: '',
	              // avoid label handling
	              group: '',
	              // avoid group handling
	              font: {
	                multi: false
	              } // avoid font propagation

	            },
	            clusterEdgeProperties: {
	              label: '',
	              // avoid label handling
	              font: {
	                multi: false
	              },
	              // avoid font propagation
	              smooth: {
	                enabled: false // avoid drawing penalty for complex edges

	              }
	            }
	          }; // if there are a lot of nodes, we cluster before we run the algorithm.
	          // NOTE: this part fails to find clusters for large scale-free networks, which should
	          //       be easily clusterable.
	          // TODO: examine why this is so

	          if (indices.length > clusterThreshold) {
	            var startLength = indices.length;

	            while (indices.length > clusterThreshold && level <= MAX_LEVELS) {
	              //console.time("clustering")
	              level += 1;
	              var before = indices.length; // if there are many nodes we do a hubsize cluster

	              if (level % 3 === 0) {
	                this.body.modules.clustering.clusterBridges(clusterOptions);
	              } else {
	                this.body.modules.clustering.clusterOutliers(clusterOptions);
	              }

	              var after = indices.length;

	              if (before == after && level % 3 !== 0) {
	                this._declusterAll();

	                this.body.emitter.emit("_layoutFailed");
	                console.info("This network could not be positioned by this version of the improved layout algorithm." + " Please disable improvedLayout for better performance.");
	                return;
	              } //console.timeEnd("clustering")
	              //console.log(before,level,after);

	            } // increase the size of the edges


	            this.body.modules.kamadaKawai.setOptions({
	              springLength: Math.max(150, 2 * startLength)
	            });
	          }

	          if (level > MAX_LEVELS) {
	            console.info("The clustering didn't succeed within the amount of interations allowed," + " progressing with partial result.");
	          } // position the system for these nodes and edges


	          this.body.modules.kamadaKawai.solve(indices, this.body.edgeIndices, true); // shift to center point

	          this._shiftToCenter(); // perturb the nodes a little bit to force the physics to kick in


	          var offset = 70;

	          for (var _i = 0; _i < indices.length; _i++) {
	            // Only perturb the nodes that aren't fixed
	            var _node = this.body.nodes[indices[_i]];

	            if (_node.predefinedPosition === false) {
	              _node.x += (0.5 - this.seededRandom()) * offset;
	              _node.y += (0.5 - this.seededRandom()) * offset;
	            }
	          } // uncluster all clusters


	          this._declusterAll(); // reposition all bezier nodes.


	          this.body.emitter.emit("_repositionBezierNodes");
	        }
	      }
	    }
	    /**
	     * Move all the nodes towards to the center so gravitational pull wil not move the nodes away from view
	     * @private
	     */

	  }, {
	    key: "_shiftToCenter",
	    value: function _shiftToCenter() {
	      var range = NetworkUtil.getRangeCore(this.body.nodes, this.body.nodeIndices);
	      var center = NetworkUtil.findCenter(range);

	      for (var i = 0; i < this.body.nodeIndices.length; i++) {
	        var node = this.body.nodes[this.body.nodeIndices[i]];
	        node.x -= center.x;
	        node.y -= center.y;
	      }
	    }
	    /**
	     * Expands all clusters
	     * @private
	     */

	  }, {
	    key: "_declusterAll",
	    value: function _declusterAll() {
	      var clustersPresent = true;

	      while (clustersPresent === true) {
	        clustersPresent = false;

	        for (var i = 0; i < this.body.nodeIndices.length; i++) {
	          if (this.body.nodes[this.body.nodeIndices[i]].isCluster === true) {
	            clustersPresent = true;
	            this.body.modules.clustering.openCluster(this.body.nodeIndices[i], {}, false);
	          }
	        }

	        if (clustersPresent === true) {
	          this.body.emitter.emit('_dataChanged');
	        }
	      }
	    }
	    /**
	     *
	     * @returns {number|*}
	     */

	  }, {
	    key: "getSeed",
	    value: function getSeed() {
	      return this.initialRandomSeed;
	    }
	    /**
	     * This is the main function to layout the nodes in a hierarchical way.
	     * It checks if the node details are supplied correctly
	     *
	     * @private
	     */

	  }, {
	    key: "setupHierarchicalLayout",
	    value: function setupHierarchicalLayout() {
	      if (this.options.hierarchical.enabled === true && this.body.nodeIndices.length > 0) {
	        // get the size of the largest hubs and check if the user has defined a level for a node.
	        var node, nodeId;
	        var definedLevel = false;
	        var undefinedLevel = false;
	        this.lastNodeOnLevel = {};
	        this.hierarchical = new HierarchicalStatus();

	        for (nodeId in this.body.nodes) {
	          if (this.body.nodes.hasOwnProperty(nodeId)) {
	            node = this.body.nodes[nodeId];

	            if (node.options.level !== undefined) {
	              definedLevel = true;
	              this.hierarchical.levels[nodeId] = node.options.level;
	            } else {
	              undefinedLevel = true;
	            }
	          }
	        } // if the user defined some levels but not all, alert and run without hierarchical layout


	        if (undefinedLevel === true && definedLevel === true) {
	          throw new Error('To use the hierarchical layout, nodes require either no predefined levels' + ' or levels have to be defined for all nodes.');
	        } else {
	          // define levels if undefined by the users. Based on hubsize.
	          if (undefinedLevel === true) {
	            var sortMethod = this.options.hierarchical.sortMethod;

	            if (sortMethod === 'hubsize') {
	              this._determineLevelsByHubsize();
	            } else if (sortMethod === 'directed') {
	              this._determineLevelsDirected();
	            } else if (sortMethod === 'custom') {
	              this._determineLevelsCustomCallback();
	            }
	          } // fallback for cases where there are nodes but no edges


	          for (var _nodeId2 in this.body.nodes) {
	            if (this.body.nodes.hasOwnProperty(_nodeId2)) {
	              this.hierarchical.ensureLevel(_nodeId2);
	            }
	          } // check the distribution of the nodes per level.


	          var distribution = this._getDistribution(); // get the parent children relations.


	          this._generateMap(); // place the nodes on the canvas.


	          this._placeNodesByHierarchy(distribution); // condense the whitespace.


	          this._condenseHierarchy(); // shift to center so gravity does not have to do much


	          this._shiftToCenter();
	        }
	      }
	    }
	    /**
	     * @private
	     */

	  }, {
	    key: "_condenseHierarchy",
	    value: function _condenseHierarchy() {
	      var _this3 = this;

	      // Global var in this scope to define when the movement has stopped.
	      var stillShifting = false;
	      var branches = {}; // first we have some methods to help shifting trees around.
	      // the main method to shift the trees

	      var shiftTrees = function shiftTrees() {
	        var treeSizes = getTreeSizes();
	        var shiftBy = 0;

	        for (var i = 0; i < treeSizes.length - 1; i++) {
	          var diff = treeSizes[i].max - treeSizes[i + 1].min;
	          shiftBy += diff + _this3.options.hierarchical.treeSpacing;
	          shiftTree(i + 1, shiftBy);
	        }
	      }; // shift a single tree by an offset


	      var shiftTree = function shiftTree(index, offset) {
	        var trees = _this3.hierarchical.trees;

	        for (var nodeId in trees) {
	          if (trees.hasOwnProperty(nodeId)) {
	            if (trees[nodeId] === index) {
	              _this3.direction.shift(nodeId, offset);
	            }
	          }
	        }
	      }; // get the width of all trees


	      var getTreeSizes = function getTreeSizes() {
	        var treeWidths = [];

	        for (var i = 0; i < _this3.hierarchical.numTrees(); i++) {
	          treeWidths.push(_this3.direction.getTreeSize(i));
	        }

	        return treeWidths;
	      }; // get a map of all nodes in this branch


	      var getBranchNodes = function getBranchNodes(source, map) {
	        if (map[source.id]) {
	          return;
	        }

	        map[source.id] = true;

	        if (_this3.hierarchical.childrenReference[source.id]) {
	          var children = _this3.hierarchical.childrenReference[source.id];

	          if (children.length > 0) {
	            for (var i = 0; i < children.length; i++) {
	              getBranchNodes(_this3.body.nodes[children[i]], map);
	            }
	          }
	        }
	      }; // get a min max width as well as the maximum movement space it has on either sides
	      // we use min max terminology because width and height can interchange depending on the direction of the layout


	      var getBranchBoundary = function getBranchBoundary(branchMap) {
	        var maxLevel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1e9;
	        var minSpace = 1e9;
	        var maxSpace = 1e9;
	        var min = 1e9;
	        var max = -1e9;

	        for (var branchNode in branchMap) {
	          if (branchMap.hasOwnProperty(branchNode)) {
	            var node = _this3.body.nodes[branchNode];
	            var level = _this3.hierarchical.levels[node.id];

	            var position = _this3.direction.getPosition(node); // get the space around the node.


	            var _this3$_getSpaceAroun = _this3._getSpaceAroundNode(node, branchMap),
	                _this3$_getSpaceAroun2 = slicedToArray$1(_this3$_getSpaceAroun, 2),
	                minSpaceNode = _this3$_getSpaceAroun2[0],
	                maxSpaceNode = _this3$_getSpaceAroun2[1];

	            minSpace = Math.min(minSpaceNode, minSpace);
	            maxSpace = Math.min(maxSpaceNode, maxSpace); // the width is only relevant for the levels two nodes have in common. This is why we filter on this.

	            if (level <= maxLevel) {
	              min = Math.min(position, min);
	              max = Math.max(position, max);
	            }
	          }
	        }

	        return [min, max, minSpace, maxSpace];
	      }; // check what the maximum level is these nodes have in common.


	      var getCollisionLevel = function getCollisionLevel(node1, node2) {
	        var maxLevel1 = _this3.hierarchical.getMaxLevel(node1.id);

	        var maxLevel2 = _this3.hierarchical.getMaxLevel(node2.id);

	        return Math.min(maxLevel1, maxLevel2);
	      };
	      /**
	       * Condense elements. These can be nodes or branches depending on the callback.
	       *
	       * @param {function} callback
	       * @param {Array.<number>} levels
	       * @param {*} centerParents
	       */


	      var shiftElementsCloser = function shiftElementsCloser(callback, levels, centerParents) {
	        var hier = _this3.hierarchical;

	        for (var i = 0; i < levels.length; i++) {
	          var level = levels[i];
	          var levelNodes = hier.distributionOrdering[level];

	          if (levelNodes.length > 1) {
	            for (var j = 0; j < levelNodes.length - 1; j++) {
	              var node1 = levelNodes[j];
	              var node2 = levelNodes[j + 1]; // NOTE: logic maintained as it was; if nodes have same ancestor,
	              //       then of course they are in the same sub-network.

	              if (hier.hasSameParent(node1, node2) && hier.inSameSubNetwork(node1, node2)) {
	                callback(node1, node2, centerParents);
	              }
	            }
	          }
	        }
	      }; // callback for shifting branches


	      var branchShiftCallback = function branchShiftCallback(node1, node2) {
	        var centerParent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;

	        //window.CALLBACKS.push(() => {
	        var pos1 = _this3.direction.getPosition(node1);

	        var pos2 = _this3.direction.getPosition(node2);

	        var diffAbs = Math.abs(pos2 - pos1);
	        var nodeSpacing = _this3.options.hierarchical.nodeSpacing; //console.log("NOW CHECKING:", node1.id, node2.id, diffAbs);

	        if (diffAbs > nodeSpacing) {
	          var branchNodes1 = {};
	          var branchNodes2 = {};
	          getBranchNodes(node1, branchNodes1);
	          getBranchNodes(node2, branchNodes2); // check the largest distance between the branches

	          var maxLevel = getCollisionLevel(node1, node2);
	          var branchNodeBoundary1 = getBranchBoundary(branchNodes1, maxLevel);
	          var branchNodeBoundary2 = getBranchBoundary(branchNodes2, maxLevel);
	          var max1 = branchNodeBoundary1[1];
	          var min2 = branchNodeBoundary2[0];
	          var minSpace2 = branchNodeBoundary2[2]; //console.log(node1.id, getBranchBoundary(branchNodes1, maxLevel), node2.id,
	          //            getBranchBoundary(branchNodes2, maxLevel), maxLevel);

	          var diffBranch = Math.abs(max1 - min2);

	          if (diffBranch > nodeSpacing) {
	            var offset = max1 - min2 + nodeSpacing;

	            if (offset < -minSpace2 + nodeSpacing) {
	              offset = -minSpace2 + nodeSpacing; //console.log("RESETTING OFFSET", max1 - min2 + this.options.hierarchical.nodeSpacing, -minSpace2, offset);
	            }

	            if (offset < 0) {
	              //console.log("SHIFTING", node2.id, offset);
	              _this3._shiftBlock(node2.id, offset);

	              stillShifting = true;
	              if (centerParent === true) _this3._centerParent(node2);
	            }
	          }
	        } //this.body.emitter.emit("_redraw");})

	      };

	      var minimizeEdgeLength = function minimizeEdgeLength(iterations, node) {
	        //window.CALLBACKS.push(() => {
	        //  console.log("ts",node.id);
	        var nodeId = node.id;
	        var allEdges = node.edges;
	        var nodeLevel = _this3.hierarchical.levels[node.id]; // gather constants

	        var C2 = _this3.options.hierarchical.levelSeparation * _this3.options.hierarchical.levelSeparation;
	        var referenceNodes = {};
	        var aboveEdges = [];

	        for (var i = 0; i < allEdges.length; i++) {
	          var edge = allEdges[i];

	          if (edge.toId != edge.fromId) {
	            var otherNode = edge.toId == nodeId ? edge.from : edge.to;
	            referenceNodes[allEdges[i].id] = otherNode;

	            if (_this3.hierarchical.levels[otherNode.id] < nodeLevel) {
	              aboveEdges.push(edge);
	            }
	          }
	        } // differentiated sum of lengths based on only moving one node over one axis


	        var getFx = function getFx(point, edges) {
	          var sum = 0;

	          for (var _i2 = 0; _i2 < edges.length; _i2++) {
	            if (referenceNodes[edges[_i2].id] !== undefined) {
	              var a = _this3.direction.getPosition(referenceNodes[edges[_i2].id]) - point;
	              sum += a / Math.sqrt(a * a + C2);
	            }
	          }

	          return sum;
	        }; // doubly differentiated sum of lengths based on only moving one node over one axis


	        var getDFx = function getDFx(point, edges) {
	          var sum = 0;

	          for (var _i3 = 0; _i3 < edges.length; _i3++) {
	            if (referenceNodes[edges[_i3].id] !== undefined) {
	              var a = _this3.direction.getPosition(referenceNodes[edges[_i3].id]) - point;
	              sum -= C2 * Math.pow(a * a + C2, -1.5);
	            }
	          }

	          return sum;
	        };

	        var getGuess = function getGuess(iterations, edges) {
	          var guess = _this3.direction.getPosition(node); // Newton's method for optimization


	          var guessMap = {};

	          for (var _i4 = 0; _i4 < iterations; _i4++) {
	            var fx = getFx(guess, edges);
	            var dfx = getDFx(guess, edges); // we limit the movement to avoid instability.

	            var limit = 40;
	            var ratio = Math.max(-limit, Math.min(limit, Math.round(fx / dfx)));
	            guess = guess - ratio; // reduce duplicates

	            if (guessMap[guess] !== undefined) {
	              break;
	            }

	            guessMap[guess] = _i4;
	          }

	          return guess;
	        };

	        var moveBranch = function moveBranch(guess) {
	          // position node if there is space
	          var nodePosition = _this3.direction.getPosition(node); // check movable area of the branch


	          if (branches[node.id] === undefined) {
	            var branchNodes = {};
	            getBranchNodes(node, branchNodes);
	            branches[node.id] = branchNodes;
	          }

	          var branchBoundary = getBranchBoundary(branches[node.id]);
	          var minSpaceBranch = branchBoundary[2];
	          var maxSpaceBranch = branchBoundary[3];
	          var diff = guess - nodePosition; // check if we are allowed to move the node:

	          var branchOffset = 0;

	          if (diff > 0) {
	            branchOffset = Math.min(diff, maxSpaceBranch - _this3.options.hierarchical.nodeSpacing);
	          } else if (diff < 0) {
	            branchOffset = -Math.min(-diff, minSpaceBranch - _this3.options.hierarchical.nodeSpacing);
	          }

	          if (branchOffset != 0) {
	            //console.log("moving branch:",branchOffset, maxSpaceBranch, minSpaceBranch)
	            _this3._shiftBlock(node.id, branchOffset); //this.body.emitter.emit("_redraw");


	            stillShifting = true;
	          }
	        };

	        var moveNode = function moveNode(guess) {
	          var nodePosition = _this3.direction.getPosition(node); // position node if there is space


	          var _this3$_getSpaceAroun3 = _this3._getSpaceAroundNode(node),
	              _this3$_getSpaceAroun4 = slicedToArray$1(_this3$_getSpaceAroun3, 2),
	              minSpace = _this3$_getSpaceAroun4[0],
	              maxSpace = _this3$_getSpaceAroun4[1];

	          var diff = guess - nodePosition; // check if we are allowed to move the node:

	          var newPosition = nodePosition;

	          if (diff > 0) {
	            newPosition = Math.min(nodePosition + (maxSpace - _this3.options.hierarchical.nodeSpacing), guess);
	          } else if (diff < 0) {
	            newPosition = Math.max(nodePosition - (minSpace - _this3.options.hierarchical.nodeSpacing), guess);
	          }

	          if (newPosition !== nodePosition) {
	            //console.log("moving Node:",diff, minSpace, maxSpace);
	            _this3.direction.setPosition(node, newPosition); //this.body.emitter.emit("_redraw");


	            stillShifting = true;
	          }
	        };

	        var guess = getGuess(iterations, aboveEdges);
	        moveBranch(guess);
	        guess = getGuess(iterations, allEdges);
	        moveNode(guess); //})
	      }; // method to remove whitespace between branches. Because we do bottom up, we can center the parents.


	      var minimizeEdgeLengthBottomUp = function minimizeEdgeLengthBottomUp(iterations) {
	        var levels = _this3.hierarchical.getLevels();

	        levels = reverse$2(levels).call(levels);

	        for (var i = 0; i < iterations; i++) {
	          stillShifting = false;

	          for (var j = 0; j < levels.length; j++) {
	            var level = levels[j];
	            var levelNodes = _this3.hierarchical.distributionOrdering[level];

	            for (var k = 0; k < levelNodes.length; k++) {
	              minimizeEdgeLength(1000, levelNodes[k]);
	            }
	          }

	          if (stillShifting !== true) {
	            //console.log("FINISHED minimizeEdgeLengthBottomUp IN " + i);
	            break;
	          }
	        }
	      }; // method to remove whitespace between branches. Because we do bottom up, we can center the parents.


	      var shiftBranchesCloserBottomUp = function shiftBranchesCloserBottomUp(iterations) {
	        var levels = _this3.hierarchical.getLevels();

	        levels = reverse$2(levels).call(levels);

	        for (var i = 0; i < iterations; i++) {
	          stillShifting = false;
	          shiftElementsCloser(branchShiftCallback, levels, true);

	          if (stillShifting !== true) {
	            //console.log("FINISHED shiftBranchesCloserBottomUp IN " + (i+1));
	            break;
	          }
	        }
	      }; // center all parents


	      var centerAllParents = function centerAllParents() {
	        for (var nodeId in _this3.body.nodes) {
	          if (_this3.body.nodes.hasOwnProperty(nodeId)) _this3._centerParent(_this3.body.nodes[nodeId]);
	        }
	      }; // center all parents


	      var centerAllParentsBottomUp = function centerAllParentsBottomUp() {
	        var levels = _this3.hierarchical.getLevels();

	        levels = reverse$2(levels).call(levels);

	        for (var i = 0; i < levels.length; i++) {
	          var level = levels[i];
	          var levelNodes = _this3.hierarchical.distributionOrdering[level];

	          for (var j = 0; j < levelNodes.length; j++) {
	            _this3._centerParent(levelNodes[j]);
	          }
	        }
	      }; // the actual work is done here.


	      if (this.options.hierarchical.blockShifting === true) {
	        shiftBranchesCloserBottomUp(5);
	        centerAllParents();
	      } // minimize edge length


	      if (this.options.hierarchical.edgeMinimization === true) {
	        minimizeEdgeLengthBottomUp(20);
	      }

	      if (this.options.hierarchical.parentCentralization === true) {
	        centerAllParentsBottomUp();
	      }

	      shiftTrees();
	    }
	    /**
	     * This gives the space around the node. IF a map is supplied, it will only check against nodes NOT in the map.
	     * This is used to only get the distances to nodes outside of a branch.
	     * @param {Node} node
	     * @param {{Node.id: vis.Node}} map
	     * @returns {number[]}
	     * @private
	     */

	  }, {
	    key: "_getSpaceAroundNode",
	    value: function _getSpaceAroundNode(node, map) {
	      var useMap = true;

	      if (map === undefined) {
	        useMap = false;
	      }

	      var level = this.hierarchical.levels[node.id];

	      if (level !== undefined) {
	        var index = this.hierarchical.distributionIndex[node.id];
	        var position = this.direction.getPosition(node);
	        var ordering = this.hierarchical.distributionOrdering[level];
	        var minSpace = 1e9;
	        var maxSpace = 1e9;

	        if (index !== 0) {
	          var prevNode = ordering[index - 1];

	          if (useMap === true && map[prevNode.id] === undefined || useMap === false) {
	            var prevPos = this.direction.getPosition(prevNode);
	            minSpace = position - prevPos;
	          }
	        }

	        if (index != ordering.length - 1) {
	          var nextNode = ordering[index + 1];

	          if (useMap === true && map[nextNode.id] === undefined || useMap === false) {
	            var nextPos = this.direction.getPosition(nextNode);
	            maxSpace = Math.min(maxSpace, nextPos - position);
	          }
	        }

	        return [minSpace, maxSpace];
	      } else {
	        return [0, 0];
	      }
	    }
	    /**
	     * We use this method to center a parent node and check if it does not cross other nodes when it does.
	     * @param {Node} node
	     * @private
	     */

	  }, {
	    key: "_centerParent",
	    value: function _centerParent(node) {
	      if (this.hierarchical.parentReference[node.id]) {
	        var parents = this.hierarchical.parentReference[node.id];

	        for (var i = 0; i < parents.length; i++) {
	          var parentId = parents[i];
	          var parentNode = this.body.nodes[parentId];
	          var children = this.hierarchical.childrenReference[parentId];

	          if (children !== undefined) {
	            // get the range of the children
	            var newPosition = this._getCenterPosition(children);

	            var position = this.direction.getPosition(parentNode);

	            var _this$_getSpaceAround = this._getSpaceAroundNode(parentNode),
	                _this$_getSpaceAround2 = slicedToArray$1(_this$_getSpaceAround, 2),
	                minSpace = _this$_getSpaceAround2[0],
	                maxSpace = _this$_getSpaceAround2[1];

	            var diff = position - newPosition;

	            if (diff < 0 && Math.abs(diff) < maxSpace - this.options.hierarchical.nodeSpacing || diff > 0 && Math.abs(diff) < minSpace - this.options.hierarchical.nodeSpacing) {
	              this.direction.setPosition(parentNode, newPosition);
	            }
	          }
	        }
	      }
	    }
	    /**
	     * This function places the nodes on the canvas based on the hierarchial distribution.
	     *
	     * @param {Object} distribution | obtained by the function this._getDistribution()
	     * @private
	     */

	  }, {
	    key: "_placeNodesByHierarchy",
	    value: function _placeNodesByHierarchy(distribution) {
	      this.positionedNodes = {}; // start placing all the level 0 nodes first. Then recursively position their branches.

	      for (var level in distribution) {
	        if (distribution.hasOwnProperty(level)) {
	          var _context;

	          // sort nodes in level by position:
	          var nodeArray = keys$6(distribution[level]);

	          nodeArray = this._indexArrayToNodes(nodeArray);

	          sort$2(_context = this.direction).call(_context, nodeArray);

	          var handledNodeCount = 0;

	          for (var i = 0; i < nodeArray.length; i++) {
	            var node = nodeArray[i];

	            if (this.positionedNodes[node.id] === undefined) {
	              var spacing = this.options.hierarchical.nodeSpacing;
	              var pos = spacing * handledNodeCount; // We get the X or Y values we need and store them in pos and previousPos.
	              // The get and set make sure we get X or Y

	              if (handledNodeCount > 0) {
	                pos = this.direction.getPosition(nodeArray[i - 1]) + spacing;
	              }

	              this.direction.setPosition(node, pos, level);

	              this._validatePositionAndContinue(node, level, pos);

	              handledNodeCount++;
	            }
	          }
	        }
	      }
	    }
	    /**
	     * This is a recursively called function to enumerate the branches from the largest hubs and place the nodes
	     * on a X position that ensures there will be no overlap.
	     *
	     * @param {Node.id} parentId
	     * @param {number} parentLevel
	     * @private
	     */

	  }, {
	    key: "_placeBranchNodes",
	    value: function _placeBranchNodes(parentId, parentLevel) {
	      var _context2;

	      var childRef = this.hierarchical.childrenReference[parentId]; // if this is not a parent, cancel the placing. This can happen with multiple parents to one child.

	      if (childRef === undefined) {
	        return;
	      } // get a list of childNodes


	      var childNodes = [];

	      for (var i = 0; i < childRef.length; i++) {
	        childNodes.push(this.body.nodes[childRef[i]]);
	      } // use the positions to order the nodes.


	      sort$2(_context2 = this.direction).call(_context2, childNodes); // position the childNodes


	      for (var _i5 = 0; _i5 < childNodes.length; _i5++) {
	        var childNode = childNodes[_i5];
	        var childNodeLevel = this.hierarchical.levels[childNode.id]; // check if the child node is below the parent node and if it has already been positioned.

	        if (childNodeLevel > parentLevel && this.positionedNodes[childNode.id] === undefined) {
	          // get the amount of space required for this node. If parent the width is based on the amount of children.
	          var spacing = this.options.hierarchical.nodeSpacing;
	          var pos = void 0; // we get the X or Y values we need and store them in pos and previousPos.
	          // The get and set make sure we get X or Y

	          if (_i5 === 0) {
	            pos = this.direction.getPosition(this.body.nodes[parentId]);
	          } else {
	            pos = this.direction.getPosition(childNodes[_i5 - 1]) + spacing;
	          }

	          this.direction.setPosition(childNode, pos, childNodeLevel);

	          this._validatePositionAndContinue(childNode, childNodeLevel, pos);
	        } else {
	          return;
	        }
	      } // center the parent nodes.


	      var center = this._getCenterPosition(childNodes);

	      this.direction.setPosition(this.body.nodes[parentId], center, parentLevel);
	    }
	    /**
	     * This method checks for overlap and if required shifts the branch. It also keeps records of positioned nodes.
	     * Finally it will call _placeBranchNodes to place the branch nodes.
	     * @param {Node} node
	     * @param {number} level
	     * @param {number} pos
	     * @private
	     */

	  }, {
	    key: "_validatePositionAndContinue",
	    value: function _validatePositionAndContinue(node, level, pos) {
	      // This method only works for formal trees and formal forests
	      // Early exit if this is not the case
	      if (!this.hierarchical.isTree) return; // if overlap has been detected, we shift the branch

	      if (this.lastNodeOnLevel[level] !== undefined) {
	        var previousPos = this.direction.getPosition(this.body.nodes[this.lastNodeOnLevel[level]]);

	        if (pos - previousPos < this.options.hierarchical.nodeSpacing) {
	          var diff = previousPos + this.options.hierarchical.nodeSpacing - pos;

	          var sharedParent = this._findCommonParent(this.lastNodeOnLevel[level], node.id);

	          this._shiftBlock(sharedParent.withChild, diff);
	        }
	      }

	      this.lastNodeOnLevel[level] = node.id; // store change in position.

	      this.positionedNodes[node.id] = true;

	      this._placeBranchNodes(node.id, level);
	    }
	    /**
	     * Receives an array with node indices and returns an array with the actual node references.
	     * Used for sorting based on node properties.
	     * @param {Array.<Node.id>} idArray
	     * @returns {Array.<Node>}
	     */

	  }, {
	    key: "_indexArrayToNodes",
	    value: function _indexArrayToNodes(idArray) {
	      var array = [];

	      for (var i = 0; i < idArray.length; i++) {
	        array.push(this.body.nodes[idArray[i]]);
	      }

	      return array;
	    }
	    /**
	     * This function get the distribution of levels based on hubsize
	     *
	     * @returns {Object}
	     * @private
	     */

	  }, {
	    key: "_getDistribution",
	    value: function _getDistribution() {
	      var distribution = {};
	      var nodeId, node; // we fix Y because the hierarchy is vertical,
	      // we fix X so we do not give a node an x position for a second time.
	      // the fix of X is removed after the x value has been set.

	      for (nodeId in this.body.nodes) {
	        if (this.body.nodes.hasOwnProperty(nodeId)) {
	          node = this.body.nodes[nodeId];
	          var level = this.hierarchical.levels[nodeId] === undefined ? 0 : this.hierarchical.levels[nodeId];
	          this.direction.fix(node, level);

	          if (distribution[level] === undefined) {
	            distribution[level] = {};
	          }

	          distribution[level][nodeId] = node;
	        }
	      }

	      return distribution;
	    }
	    /**
	     * Return the active (i.e. visible) edges for this node
	     *
	     * @param {Node} node
	     * @returns {Array.<vis.Edge>} Array of edge instances
	     * @private
	     */

	  }, {
	    key: "_getActiveEdges",
	    value: function _getActiveEdges(node) {
	      var _this4 = this;

	      var result = [];
	      forEach$3$1(node.edges, function (edge) {
	        var _context3;

	        if (indexOf$3(_context3 = _this4.body.edgeIndices).call(_context3, edge.id) !== -1) {
	          result.push(edge);
	        }
	      });
	      return result;
	    }
	    /**
	     * Get the hubsizes for all active nodes.
	     *
	     * @returns {number}
	     * @private
	     */

	  }, {
	    key: "_getHubSizes",
	    value: function _getHubSizes() {
	      var _this5 = this;

	      var hubSizes = {};
	      var nodeIds = this.body.nodeIndices;
	      forEach$3$1(nodeIds, function (nodeId) {
	        var node = _this5.body.nodes[nodeId];

	        var hubSize = _this5._getActiveEdges(node).length;

	        hubSizes[hubSize] = true;
	      }); // Make an array of the size sorted descending

	      var result = [];
	      forEach$3$1(hubSizes, function (size) {
	        result.push(Number(size));
	      });

	      sort$2(timsort$1).call(timsort$1, result, function (a, b) {
	        return b - a;
	      });

	      return result;
	    }
	    /**
	     * this function allocates nodes in levels based on the recursive branching from the largest hubs.
	     *
	     * @private
	     */

	  }, {
	    key: "_determineLevelsByHubsize",
	    value: function _determineLevelsByHubsize() {
	      var _this6 = this;

	      var levelDownstream = function levelDownstream(nodeA, nodeB) {
	        _this6.hierarchical.levelDownstream(nodeA, nodeB);
	      };

	      var hubSizes = this._getHubSizes();

	      var _loop = function _loop(i) {
	        var hubSize = hubSizes[i];
	        if (hubSize === 0) return "break";
	        forEach$3$1(_this6.body.nodeIndices, function (nodeId) {
	          var node = _this6.body.nodes[nodeId];

	          if (hubSize === _this6._getActiveEdges(node).length) {
	            _this6._crawlNetwork(levelDownstream, nodeId);
	          }
	        });
	      };

	      for (var i = 0; i < hubSizes.length; ++i) {
	        var _ret = _loop(i);

	        if (_ret === "break") break;
	      }
	    }
	    /**
	     * TODO: release feature
	     * TODO: Determine if this feature is needed at all
	     *
	     * @private
	     */

	  }, {
	    key: "_determineLevelsCustomCallback",
	    value: function _determineLevelsCustomCallback() {
	      var _this7 = this;

	      var minLevel = 100000; // TODO: this should come from options.

	      var customCallback = function customCallback(nodeA, nodeB, edge) {// eslint-disable-line no-unused-vars
	      }; // TODO: perhaps move to HierarchicalStatus.
	      //       But I currently don't see the point, this method is not used.


	      var levelByDirection = function levelByDirection(nodeA, nodeB, edge) {
	        var levelA = _this7.hierarchical.levels[nodeA.id]; // set initial level

	        if (levelA === undefined) {
	          levelA = _this7.hierarchical.levels[nodeA.id] = minLevel;
	        }

	        var diff = customCallback(NetworkUtil.cloneOptions(nodeA, 'node'), NetworkUtil.cloneOptions(nodeB, 'node'), NetworkUtil.cloneOptions(edge, 'edge'));
	        _this7.hierarchical.levels[nodeB.id] = levelA + diff;
	      };

	      this._crawlNetwork(levelByDirection);

	      this.hierarchical.setMinLevelToZero(this.body.nodes);
	    }
	    /**
	     * Allocate nodes in levels based on the direction of the edges.
	     *
	     * @private
	     */

	  }, {
	    key: "_determineLevelsDirected",
	    value: function _determineLevelsDirected() {
	      var _context4,
	          _this8 = this;

	      var nodes = map$2(_context4 = this.body.nodeIndices).call(_context4, function (id) {
	        return _this8.body.nodes[id];
	      });

	      var levels = this.hierarchical.levels;

	      if (this.options.hierarchical.shakeTowards === "roots") {
	        this.hierarchical.levels = fillLevelsByDirectionRoots(nodes, this.hierarchical.levels);
	      } else {
	        this.hierarchical.levels = fillLevelsByDirectionLeaves(nodes, this.hierarchical.levels);
	      }

	      this.hierarchical.setMinLevelToZero(this.body.nodes);
	    }
	    /**
	     * Update the bookkeeping of parent and child.
	     * @private
	     */

	  }, {
	    key: "_generateMap",
	    value: function _generateMap() {
	      var _this9 = this;

	      var fillInRelations = function fillInRelations(parentNode, childNode) {
	        if (_this9.hierarchical.levels[childNode.id] > _this9.hierarchical.levels[parentNode.id]) {
	          _this9.hierarchical.addRelation(parentNode.id, childNode.id);
	        }
	      };

	      this._crawlNetwork(fillInRelations);

	      this.hierarchical.checkIfTree();
	    }
	    /**
	     * Crawl over the entire network and use a callback on each node couple that is connected to each other.
	     * @param {function} [callback=function(){}]          | will receive nodeA, nodeB and the connecting edge. A and B are distinct.
	     * @param {Node.id} startingNodeId
	     * @private
	     */

	  }, {
	    key: "_crawlNetwork",
	    value: function _crawlNetwork() {
	      var _this10 = this;

	      var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};
	      var startingNodeId = arguments.length > 1 ? arguments[1] : undefined;
	      var progress = {};

	      var crawler = function crawler(node, tree) {
	        if (progress[node.id] === undefined) {
	          _this10.hierarchical.setTreeIndex(node, tree);

	          progress[node.id] = true;
	          var childNode;

	          var edges = _this10._getActiveEdges(node);

	          for (var i = 0; i < edges.length; i++) {
	            var edge = edges[i];

	            if (edge.connected === true) {
	              if (edge.toId == node.id) {
	                // Not '===' because id's can be string and numeric
	                childNode = edge.from;
	              } else {
	                childNode = edge.to;
	              }

	              if (node.id != childNode.id) {
	                // Not '!==' because id's can be string and numeric
	                callback(node, childNode, edge);
	                crawler(childNode, tree);
	              }
	            }
	          }
	        }
	      };

	      if (startingNodeId === undefined) {
	        // Crawl over all nodes
	        var treeIndex = 0; // Serves to pass a unique id for the current distinct tree

	        for (var i = 0; i < this.body.nodeIndices.length; i++) {
	          var nodeId = this.body.nodeIndices[i];

	          if (progress[nodeId] === undefined) {
	            var node = this.body.nodes[nodeId];
	            crawler(node, treeIndex);
	            treeIndex += 1;
	          }
	        }
	      } else {
	        // Crawl from the given starting node
	        var _node2 = this.body.nodes[startingNodeId];

	        if (_node2 === undefined) {
	          console.error("Node not found:", startingNodeId);
	          return;
	        }

	        crawler(_node2);
	      }
	    }
	    /**
	     * Shift a branch a certain distance
	     * @param {Node.id} parentId
	     * @param {number} diff
	     * @private
	     */

	  }, {
	    key: "_shiftBlock",
	    value: function _shiftBlock(parentId, diff) {
	      var _this11 = this;

	      var progress = {};

	      var shifter = function shifter(parentId) {
	        if (progress[parentId]) {
	          return;
	        }

	        progress[parentId] = true;

	        _this11.direction.shift(parentId, diff);

	        var childRef = _this11.hierarchical.childrenReference[parentId];

	        if (childRef !== undefined) {
	          for (var i = 0; i < childRef.length; i++) {
	            shifter(childRef[i]);
	          }
	        }
	      };

	      shifter(parentId);
	    }
	    /**
	     * Find a common parent between branches.
	     * @param {Node.id} childA
	     * @param {Node.id} childB
	     * @returns {{foundParent, withChild}}
	     * @private
	     */

	  }, {
	    key: "_findCommonParent",
	    value: function _findCommonParent(childA, childB) {
	      var _this12 = this;

	      var parents = {};

	      var iterateParents = function iterateParents(parents, child) {
	        var parentRef = _this12.hierarchical.parentReference[child];

	        if (parentRef !== undefined) {
	          for (var i = 0; i < parentRef.length; i++) {
	            var parent = parentRef[i];
	            parents[parent] = true;
	            iterateParents(parents, parent);
	          }
	        }
	      };

	      var findParent = function findParent(parents, child) {
	        var parentRef = _this12.hierarchical.parentReference[child];

	        if (parentRef !== undefined) {
	          for (var i = 0; i < parentRef.length; i++) {
	            var parent = parentRef[i];

	            if (parents[parent] !== undefined) {
	              return {
	                foundParent: parent,
	                withChild: child
	              };
	            }

	            var branch = findParent(parents, parent);

	            if (branch.foundParent !== null) {
	              return branch;
	            }
	          }
	        }

	        return {
	          foundParent: null,
	          withChild: child
	        };
	      };

	      iterateParents(parents, childA);
	      return findParent(parents, childB);
	    }
	    /**
	     * Set the strategy pattern for handling the coordinates given the current direction.
	     *
	     * The individual instances contain all the operations and data specific to a layout direction.
	     *
	     * @param {Node} node
	     * @param {{x: number, y: number}} position
	     * @param {number} level
	     * @param {boolean} [doNotUpdate=false]
	     * @private
	     */

	  }, {
	    key: "setDirectionStrategy",
	    value: function setDirectionStrategy() {
	      var isVertical = this.options.hierarchical.direction === 'UD' || this.options.hierarchical.direction === 'DU';

	      if (isVertical) {
	        this.direction = new VerticalStrategy(this);
	      } else {
	        this.direction = new HorizontalStrategy(this);
	      }
	    }
	    /**
	     * Determine the center position of a branch from the passed list of child nodes
	     *
	     * This takes into account the positions of all the child nodes.
	     * @param {Array.<Node|vis.Node.id>} childNodes  Array of either child nodes or node id's
	     * @return {number}
	     * @private
	     */

	  }, {
	    key: "_getCenterPosition",
	    value: function _getCenterPosition(childNodes) {
	      var minPos = 1e9;
	      var maxPos = -1e9;

	      for (var i = 0; i < childNodes.length; i++) {
	        var childNode = void 0;

	        if (childNodes[i].id !== undefined) {
	          childNode = childNodes[i];
	        } else {
	          var childNodeId = childNodes[i];
	          childNode = this.body.nodes[childNodeId];
	        }

	        var position = this.direction.getPosition(childNode);
	        minPos = Math.min(minPos, position);
	        maxPos = Math.max(maxPos, position);
	      }

	      return 0.5 * (minPos + maxPos);
	    }
	  }]);

	  return LayoutEngine;
	}();

	var css$3 = "div.vis-network div.vis-manipulation {\n  box-sizing: content-box;\n\n  border-width: 0;\n  border-bottom: 1px;\n  border-style:solid;\n  border-color: #d6d9d8;\n  background: #ffffff; /* Old browsers */\n  background: -moz-linear-gradient(top,  #ffffff 0%, #fcfcfc 48%, #fafafa 50%, #fcfcfc 100%); /* FF3.6+ */\n  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(48%,#fcfcfc), color-stop(50%,#fafafa), color-stop(100%,#fcfcfc)); /* Chrome,Safari4+ */\n  background: -webkit-linear-gradient(top,  #ffffff 0%,#fcfcfc 48%,#fafafa 50%,#fcfcfc 100%); /* Chrome10+,Safari5.1+ */\n  background: -o-linear-gradient(top,  #ffffff 0%,#fcfcfc 48%,#fafafa 50%,#fcfcfc 100%); /* Opera 11.10+ */\n  background: -ms-linear-gradient(top,  #ffffff 0%,#fcfcfc 48%,#fafafa 50%,#fcfcfc 100%); /* IE10+ */\n  background: linear-gradient(to bottom,  #ffffff 0%,#fcfcfc 48%,#fafafa 50%,#fcfcfc 100%); /* W3C */\n  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#fcfcfc',GradientType=0 ); /* IE6-9 */\n\n  padding-top:4px;\n  position: absolute;\n  left: 0;\n  top: 0;\n  width: 100%;\n  height: 28px;\n}\n\ndiv.vis-network div.vis-edit-mode {\n  position:absolute;\n  left: 0;\n  top: 5px;\n  height: 30px;\n}\n\n/* FIXME: shouldn't the vis-close button be a child of the vis-manipulation div? */\n\ndiv.vis-network div.vis-close {\n  position:absolute;\n  right: 0;\n  top: 0;\n  width: 30px;\n  height: 30px;\n\n  background-position: 20px 3px;\n  background-repeat: no-repeat;\n  background-image: url('data:image/png;base64,[encoded data, 24404 characters]');\n  cursor: pointer;\n  -webkit-touch-callout: none;\n  -webkit-user-select: none;\n  -khtml-user-select: none;\n  -moz-user-select: none;\n  -ms-user-select: none;\n  user-select: none;\n}\n\ndiv.vis-network div.vis-close:hover {\n  opacity: 0.6;\n}\n\ndiv.vis-network div.vis-manipulation div.vis-button,\ndiv.vis-network div.vis-edit-mode div.vis-button {\n  float:left;\n  font-family: verdana;\n  font-size: 12px;\n  -moz-border-radius: 15px;\n  border-radius: 15px;\n  display:inline-block;\n  background-position: 0px 0px;\n  background-repeat:no-repeat;\n  height:24px;\n  margin-left: 10px;\n  /*vertical-align:middle;*/\n  cursor: pointer;\n  padding: 0px 8px 0px 8px;\n  -webkit-touch-callout: none;\n  -webkit-user-select: none;\n  -khtml-user-select: none;\n  -moz-user-select: none;\n  -ms-user-select: none;\n  user-select: none;\n}\n\ndiv.vis-network div.vis-manipulation div.vis-button:hover {\n  box-shadow: 1px 1px 8px rgba(0, 0, 0, 0.20);\n}\n\ndiv.vis-network div.vis-manipulation div.vis-button:active {\n  box-shadow: 1px 1px 8px rgba(0, 0, 0, 0.50);\n}\n\ndiv.vis-network div.vis-manipulation div.vis-button.vis-back {\n  background-image: url('data:image/png;base64,[encoded data, 27736 characters]');\n}\n\ndiv.vis-network div.vis-manipulation div.vis-button.vis-none:hover {\n  box-shadow: 1px 1px 8px rgba(0, 0, 0, 0.0);\n  cursor: default;\n}\ndiv.vis-network div.vis-manipulation div.vis-button.vis-none:active {\n  box-shadow: 1px 1px 8px rgba(0, 0, 0, 0.0);\n}\ndiv.vis-network div.vis-manipulation div.vis-button.vis-none {\n  padding: 0;\n}\ndiv.vis-network div.vis-manipulation div.notification {\n  margin: 2px;\n  font-weight: bold;\n}\n\ndiv.vis-network div.vis-manipulation div.vis-button.vis-add {\n  background-image: url('data:image/png;base64,[encoded data, 28000 characters]');\n}\n\ndiv.vis-network div.vis-manipulation div.vis-button.vis-edit,\ndiv.vis-network div.vis-edit-mode div.vis-button.vis-edit {\n  background-image: url('data:image/png;base64,[encoded data, 28024 characters]');\n}\n\ndiv.vis-network div.vis-edit-mode div.vis-button.vis-edit.vis-edit-mode {\n  background-color: #fcfcfc;\n  border: 1px solid #cccccc;\n}\n\ndiv.vis-network div.vis-manipulation div.vis-button.vis-connect {\n  background-image: url('data:image/png;base64,[encoded data, 27688 characters]');\n}\n\ndiv.vis-network div.vis-manipulation div.vis-button.vis-delete {\n  background-image: url('data:image/png;base64,[encoded data, 27976 characters]');\n}\n/* top right bottom left */\ndiv.vis-network div.vis-manipulation div.vis-label,\ndiv.vis-network div.vis-edit-mode div.vis-label {\n  margin: 0 0 0 23px;\n  line-height: 25px;\n}\ndiv.vis-network div.vis-manipulation div.vis-separator-line {\n  float:left;\n  display:inline-block;\n  width:1px;\n  height:21px;\n  background-color: #bdbdbd;\n  margin: 0px 7px 0 15px; /*top right bottom left*/\n}\n\n/* TODO: is this redundant?\ndiv.network-navigation_wrapper {\n  position: absolute;\n  left: 0;\n  top: 0;\n  width: 100%;\n  height: 100%;\n}\n*/\n\n/*# sourceMappingURL=data:application/json;base64,[encoded data, 7904 characters] */";
	styleInject(css$3);

	/**
	 * Clears the toolbar div element of children
	 *
	 * @private
	 */

	var ManipulationSystem =
	/*#__PURE__*/
	function () {
	  /**
	   * @param {Object} body
	   * @param {Canvas} canvas
	   * @param {SelectionHandler} selectionHandler
	   */
	  function ManipulationSystem(body, canvas, selectionHandler, interactionHandler) {
	    var _this = this,
	        _context,
	        _context2;

	    classCallCheck(this, ManipulationSystem);

	    this.body = body;
	    this.canvas = canvas;
	    this.selectionHandler = selectionHandler;
	    this.interactionHandler = interactionHandler;
	    this.editMode = false;
	    this.manipulationDiv = undefined;
	    this.editModeDiv = undefined;
	    this.closeDiv = undefined;
	    this.manipulationHammers = [];
	    this.temporaryUIFunctions = {};
	    this.temporaryEventFunctions = [];
	    this.touchTime = 0;
	    this.temporaryIds = {
	      nodes: [],
	      edges: []
	    };
	    this.guiEnabled = false;
	    this.inMode = false;
	    this.selectedControlNode = undefined;
	    this.options = {};
	    this.defaultOptions = {
	      enabled: false,
	      initiallyActive: false,
	      addNode: true,
	      addEdge: true,
	      editNode: undefined,
	      editEdge: true,
	      deleteNode: true,
	      deleteEdge: true,
	      controlNodeStyle: {
	        shape: 'dot',
	        size: 6,
	        color: {
	          background: '#ff0000',
	          border: '#3c3c3c',
	          highlight: {
	            background: '#07f968',
	            border: '#3c3c3c'
	          }
	        },
	        borderWidth: 2,
	        borderWidthSelected: 2
	      }
	    };
	    extend(this.options, this.defaultOptions);
	    this.body.emitter.on('destroy', function () {
	      _this._clean();
	    });
	    this.body.emitter.on('_dataChanged', bind$2(_context = this._restore).call(_context, this));
	    this.body.emitter.on('_resetData', bind$2(_context2 = this._restore).call(_context2, this));
	  }
	  /**
	   * If something changes in the data during editing, switch back to the initial datamanipulation state and close all edit modes.
	   * @private
	   */


	  createClass(ManipulationSystem, [{
	    key: "_restore",
	    value: function _restore() {
	      if (this.inMode !== false) {
	        if (this.options.initiallyActive === true) {
	          this.enableEditMode();
	        } else {
	          this.disableEditMode();
	        }
	      }
	    }
	    /**
	     * Set the Options
	     *
	     * @param {Object} options
	     * @param {Object} allOptions
	     * @param {Object} globalOptions
	     */

	  }, {
	    key: "setOptions",
	    value: function setOptions(options, allOptions, globalOptions) {
	      if (allOptions !== undefined) {
	        if (allOptions.locale !== undefined) {
	          this.options.locale = allOptions.locale;
	        } else {
	          this.options.locale = globalOptions.locale;
	        }

	        if (allOptions.locales !== undefined) {
	          this.options.locales = allOptions.locales;
	        } else {
	          this.options.locales = globalOptions.locales;
	        }
	      }

	      if (options !== undefined) {
	        if (typeof options === 'boolean') {
	          this.options.enabled = options;
	        } else {
	          this.options.enabled = true;
	          deepExtend(this.options, options);
	        }

	        if (this.options.initiallyActive === true) {
	          this.editMode = true;
	        }

	        this._setup();
	      }
	    }
	    /**
	     * Enable or disable edit-mode. Draws the DOM required and cleans up after itself.
	     *
	     * @private
	     */

	  }, {
	    key: "toggleEditMode",
	    value: function toggleEditMode() {
	      if (this.editMode === true) {
	        this.disableEditMode();
	      } else {
	        this.enableEditMode();
	      }
	    }
	    /**
	     * Enables Edit Mode
	     */

	  }, {
	    key: "enableEditMode",
	    value: function enableEditMode() {
	      this.editMode = true;

	      this._clean();

	      if (this.guiEnabled === true) {
	        this.manipulationDiv.style.display = 'block';
	        this.closeDiv.style.display = 'block';
	        this.editModeDiv.style.display = 'none';
	        this.showManipulatorToolbar();
	      }
	    }
	    /**
	     * Disables Edit Mode
	     */

	  }, {
	    key: "disableEditMode",
	    value: function disableEditMode() {
	      this.editMode = false;

	      this._clean();

	      if (this.guiEnabled === true) {
	        this.manipulationDiv.style.display = 'none';
	        this.closeDiv.style.display = 'none';
	        this.editModeDiv.style.display = 'block';

	        this._createEditButton();
	      }
	    }
	    /**
	     * Creates the main toolbar. Removes functions bound to the select event. Binds all the buttons of the toolbar.
	     *
	     * @private
	     */

	  }, {
	    key: "showManipulatorToolbar",
	    value: function showManipulatorToolbar() {
	      // restore the state of any bound functions or events, remove control nodes, restore physics
	      this._clean(); // reset global variables


	      this.manipulationDOM = {}; // if the gui is enabled, draw all elements.

	      if (this.guiEnabled === true) {
	        var _context3, _context4;

	        // a _restore will hide these menus
	        this.editMode = true;
	        this.manipulationDiv.style.display = 'block';
	        this.closeDiv.style.display = 'block';

	        var selectedNodeCount = this.selectionHandler._getSelectedNodeCount();

	        var selectedEdgeCount = this.selectionHandler._getSelectedEdgeCount();

	        var selectedTotalCount = selectedNodeCount + selectedEdgeCount;
	        var locale = this.options.locales[this.options.locale];
	        var needSeperator = false;

	        if (this.options.addNode !== false) {
	          this._createAddNodeButton(locale);

	          needSeperator = true;
	        }

	        if (this.options.addEdge !== false) {
	          if (needSeperator === true) {
	            this._createSeperator(1);
	          } else {
	            needSeperator = true;
	          }

	          this._createAddEdgeButton(locale);
	        }

	        if (selectedNodeCount === 1 && typeof this.options.editNode === 'function') {
	          if (needSeperator === true) {
	            this._createSeperator(2);
	          } else {
	            needSeperator = true;
	          }

	          this._createEditNodeButton(locale);
	        } else if (selectedEdgeCount === 1 && selectedNodeCount === 0 && this.options.editEdge !== false) {
	          if (needSeperator === true) {
	            this._createSeperator(3);
	          } else {
	            needSeperator = true;
	          }

	          this._createEditEdgeButton(locale);
	        } // remove buttons


	        if (selectedTotalCount !== 0) {
	          if (selectedNodeCount > 0 && this.options.deleteNode !== false) {
	            if (needSeperator === true) {
	              this._createSeperator(4);
	            }

	            this._createDeleteButton(locale);
	          } else if (selectedNodeCount === 0 && this.options.deleteEdge !== false) {
	            if (needSeperator === true) {
	              this._createSeperator(4);
	            }

	            this._createDeleteButton(locale);
	          }
	        } // bind the close button


	        this._bindHammerToDiv(this.closeDiv, bind$2(_context3 = this.toggleEditMode).call(_context3, this)); // refresh this bar based on what has been selected


	        this._temporaryBindEvent('select', bind$2(_context4 = this.showManipulatorToolbar).call(_context4, this));
	      } // redraw to show any possible changes


	      this.body.emitter.emit('_redraw');
	    }
	    /**
	     * Create the toolbar for adding Nodes
	     */

	  }, {
	    key: "addNodeMode",
	    value: function addNodeMode() {
	      var _context6;

	      // when using the gui, enable edit mode if it wasnt already.
	      if (this.editMode !== true) {
	        this.enableEditMode();
	      } // restore the state of any bound functions or events, remove control nodes, restore physics


	      this._clean();

	      this.inMode = 'addNode';

	      if (this.guiEnabled === true) {
	        var _context5;

	        var locale = this.options.locales[this.options.locale];
	        this.manipulationDOM = {};

	        this._createBackButton(locale);

	        this._createSeperator();

	        this._createDescription(locale['addDescription'] || this.options.locales['en']['addDescription']); // bind the close button


	        this._bindHammerToDiv(this.closeDiv, bind$2(_context5 = this.toggleEditMode).call(_context5, this));
	      }

	      this._temporaryBindEvent('click', bind$2(_context6 = this._performAddNode).call(_context6, this));
	    }
	    /**
	     * call the bound function to handle the editing of the node. The node has to be selected.
	     */

	  }, {
	    key: "editNode",
	    value: function editNode() {
	      var _this2 = this;

	      // when using the gui, enable edit mode if it wasnt already.
	      if (this.editMode !== true) {
	        this.enableEditMode();
	      } // restore the state of any bound functions or events, remove control nodes, restore physics


	      this._clean();

	      var node = this.selectionHandler._getSelectedNode();

	      if (node !== undefined) {
	        this.inMode = 'editNode';

	        if (typeof this.options.editNode === 'function') {
	          if (node.isCluster !== true) {
	            var data = deepExtend({}, node.options, false);
	            data.x = node.x;
	            data.y = node.y;

	            if (this.options.editNode.length === 2) {
	              this.options.editNode(data, function (finalizedData) {
	                if (finalizedData !== null && finalizedData !== undefined && _this2.inMode === 'editNode') {
	                  // if for whatever reason the mode has changes (due to dataset change) disregard the callback) {
	                  _this2.body.data.nodes.getDataSet().update(finalizedData);
	                }

	                _this2.showManipulatorToolbar();
	              });
	            } else {
	              throw new Error('The function for edit does not support two arguments (data, callback)');
	            }
	          } else {
	            alert(this.options.locales[this.options.locale]['editClusterError'] || this.options.locales['en']['editClusterError']);
	          }
	        } else {
	          throw new Error('No function has been configured to handle the editing of nodes.');
	        }
	      } else {
	        this.showManipulatorToolbar();
	      }
	    }
	    /**
	     * create the toolbar to connect nodes
	     */

	  }, {
	    key: "addEdgeMode",
	    value: function addEdgeMode() {
	      var _context8, _context9, _context10, _context11, _context12;

	      // when using the gui, enable edit mode if it wasnt already.
	      if (this.editMode !== true) {
	        this.enableEditMode();
	      } // restore the state of any bound functions or events, remove control nodes, restore physics


	      this._clean();

	      this.inMode = 'addEdge';

	      if (this.guiEnabled === true) {
	        var _context7;

	        var locale = this.options.locales[this.options.locale];
	        this.manipulationDOM = {};

	        this._createBackButton(locale);

	        this._createSeperator();

	        this._createDescription(locale['edgeDescription'] || this.options.locales['en']['edgeDescription']); // bind the close button


	        this._bindHammerToDiv(this.closeDiv, bind$2(_context7 = this.toggleEditMode).call(_context7, this));
	      } // temporarily overload functions


	      this._temporaryBindUI('onTouch', bind$2(_context8 = this._handleConnect).call(_context8, this));

	      this._temporaryBindUI('onDragEnd', bind$2(_context9 = this._finishConnect).call(_context9, this));

	      this._temporaryBindUI('onDrag', bind$2(_context10 = this._dragControlNode).call(_context10, this));

	      this._temporaryBindUI('onRelease', bind$2(_context11 = this._finishConnect).call(_context11, this));

	      this._temporaryBindUI('onDragStart', bind$2(_context12 = this._dragStartEdge).call(_context12, this));

	      this._temporaryBindUI('onHold', function () {});
	    }
	    /**
	     * create the toolbar to edit edges
	     */

	  }, {
	    key: "editEdgeMode",
	    value: function editEdgeMode() {
	      // when using the gui, enable edit mode if it wasn't already.
	      if (this.editMode !== true) {
	        this.enableEditMode();
	      } // restore the state of any bound functions or events, remove control nodes, restore physics


	      this._clean();

	      this.inMode = 'editEdge';

	      if (_typeof_1(this.options.editEdge) === 'object' && typeof this.options.editEdge.editWithoutDrag === "function") {
	        this.edgeBeingEditedId = this.selectionHandler.getSelectedEdges()[0];

	        if (this.edgeBeingEditedId !== undefined) {
	          var edge = this.body.edges[this.edgeBeingEditedId];

	          this._performEditEdge(edge.from.id, edge.to.id);

	          return;
	        }
	      }

	      if (this.guiEnabled === true) {
	        var _context13;

	        var locale = this.options.locales[this.options.locale];
	        this.manipulationDOM = {};

	        this._createBackButton(locale);

	        this._createSeperator();

	        this._createDescription(locale['editEdgeDescription'] || this.options.locales['en']['editEdgeDescription']); // bind the close button


	        this._bindHammerToDiv(this.closeDiv, bind$2(_context13 = this.toggleEditMode).call(_context13, this));
	      }

	      this.edgeBeingEditedId = this.selectionHandler.getSelectedEdges()[0];

	      if (this.edgeBeingEditedId !== undefined) {
	        var _context14, _context15, _context16, _context17;

	        var _edge = this.body.edges[this.edgeBeingEditedId]; // create control nodes

	        var controlNodeFrom = this._getNewTargetNode(_edge.from.x, _edge.from.y);

	        var controlNodeTo = this._getNewTargetNode(_edge.to.x, _edge.to.y);

	        this.temporaryIds.nodes.push(controlNodeFrom.id);
	        this.temporaryIds.nodes.push(controlNodeTo.id);
	        this.body.nodes[controlNodeFrom.id] = controlNodeFrom;
	        this.body.nodeIndices.push(controlNodeFrom.id);
	        this.body.nodes[controlNodeTo.id] = controlNodeTo;
	        this.body.nodeIndices.push(controlNodeTo.id); // temporarily overload UI functions, cleaned up automatically because of _temporaryBindUI

	        this._temporaryBindUI('onTouch', bind$2(_context14 = this._controlNodeTouch).call(_context14, this)); // used to get the position


	        this._temporaryBindUI('onTap', function () {}); // disabled


	        this._temporaryBindUI('onHold', function () {}); // disabled


	        this._temporaryBindUI('onDragStart', bind$2(_context15 = this._controlNodeDragStart).call(_context15, this)); // used to select control node


	        this._temporaryBindUI('onDrag', bind$2(_context16 = this._controlNodeDrag).call(_context16, this)); // used to drag control node


	        this._temporaryBindUI('onDragEnd', bind$2(_context17 = this._controlNodeDragEnd).call(_context17, this)); // used to connect or revert control nodes


	        this._temporaryBindUI('onMouseMove', function () {}); // disabled
	        // create function to position control nodes correctly on movement
	        // automatically cleaned up because we use the temporary bind


	        this._temporaryBindEvent('beforeDrawing', function (ctx) {
	          var positions = _edge.edgeType.findBorderPositions(ctx);

	          if (controlNodeFrom.selected === false) {
	            controlNodeFrom.x = positions.from.x;
	            controlNodeFrom.y = positions.from.y;
	          }

	          if (controlNodeTo.selected === false) {
	            controlNodeTo.x = positions.to.x;
	            controlNodeTo.y = positions.to.y;
	          }
	        });

	        this.body.emitter.emit('_redraw');
	      } else {
	        this.showManipulatorToolbar();
	      }
	    }
	    /**
	     * delete everything in the selection
	     */

	  }, {
	    key: "deleteSelected",
	    value: function deleteSelected() {
	      var _this3 = this;

	      // when using the gui, enable edit mode if it wasnt already.
	      if (this.editMode !== true) {
	        this.enableEditMode();
	      } // restore the state of any bound functions or events, remove control nodes, restore physics


	      this._clean();

	      this.inMode = 'delete';
	      var selectedNodes = this.selectionHandler.getSelectedNodes();
	      var selectedEdges = this.selectionHandler.getSelectedEdges();
	      var deleteFunction = undefined;

	      if (selectedNodes.length > 0) {
	        for (var i = 0; i < selectedNodes.length; i++) {
	          if (this.body.nodes[selectedNodes[i]].isCluster === true) {
	            alert(this.options.locales[this.options.locale]['deleteClusterError'] || this.options.locales['en']['deleteClusterError']);
	            return;
	          }
	        }

	        if (typeof this.options.deleteNode === 'function') {
	          deleteFunction = this.options.deleteNode;
	        }
	      } else if (selectedEdges.length > 0) {
	        if (typeof this.options.deleteEdge === 'function') {
	          deleteFunction = this.options.deleteEdge;
	        }
	      }

	      if (typeof deleteFunction === 'function') {
	        var data = {
	          nodes: selectedNodes,
	          edges: selectedEdges
	        };

	        if (deleteFunction.length === 2) {
	          deleteFunction(data, function (finalizedData) {
	            if (finalizedData !== null && finalizedData !== undefined && _this3.inMode === 'delete') {
	              // if for whatever reason the mode has changes (due to dataset change) disregard the callback) {
	              _this3.body.data.edges.getDataSet().remove(finalizedData.edges);

	              _this3.body.data.nodes.getDataSet().remove(finalizedData.nodes);

	              _this3.body.emitter.emit('startSimulation');

	              _this3.showManipulatorToolbar();
	            } else {
	              _this3.body.emitter.emit('startSimulation');

	              _this3.showManipulatorToolbar();
	            }
	          });
	        } else {
	          throw new Error('The function for delete does not support two arguments (data, callback)');
	        }
	      } else {
	        this.body.data.edges.getDataSet().remove(selectedEdges);
	        this.body.data.nodes.getDataSet().remove(selectedNodes);
	        this.body.emitter.emit('startSimulation');
	        this.showManipulatorToolbar();
	      }
	    } //********************************************** PRIVATE ***************************************//

	    /**
	     * draw or remove the DOM
	     * @private
	     */

	  }, {
	    key: "_setup",
	    value: function _setup() {
	      if (this.options.enabled === true) {
	        // Enable the GUI
	        this.guiEnabled = true;

	        this._createWrappers();

	        if (this.editMode === false) {
	          this._createEditButton();
	        } else {
	          this.showManipulatorToolbar();
	        }
	      } else {
	        this._removeManipulationDOM(); // disable the gui


	        this.guiEnabled = false;
	      }
	    }
	    /**
	     * create the div overlays that contain the DOM
	     * @private
	     */

	  }, {
	    key: "_createWrappers",
	    value: function _createWrappers() {
	      // load the manipulator HTML elements. All styling done in css.
	      if (this.manipulationDiv === undefined) {
	        this.manipulationDiv = document.createElement('div');
	        this.manipulationDiv.className = 'vis-manipulation';

	        if (this.editMode === true) {
	          this.manipulationDiv.style.display = 'block';
	        } else {
	          this.manipulationDiv.style.display = 'none';
	        }

	        this.canvas.frame.appendChild(this.manipulationDiv);
	      } // container for the edit button.


	      if (this.editModeDiv === undefined) {
	        this.editModeDiv = document.createElement('div');
	        this.editModeDiv.className = 'vis-edit-mode';

	        if (this.editMode === true) {
	          this.editModeDiv.style.display = 'none';
	        } else {
	          this.editModeDiv.style.display = 'block';
	        }

	        this.canvas.frame.appendChild(this.editModeDiv);
	      } // container for the close div button


	      if (this.closeDiv === undefined) {
	        this.closeDiv = document.createElement('div');
	        this.closeDiv.className = 'vis-close';
	        this.closeDiv.style.display = this.manipulationDiv.style.display;
	        this.canvas.frame.appendChild(this.closeDiv);
	      }
	    }
	    /**
	     * generate a new target node. Used for creating new edges and editing edges
	     *
	     * @param {number} x
	     * @param {number} y
	     * @returns {Node}
	     * @private
	     */

	  }, {
	    key: "_getNewTargetNode",
	    value: function _getNewTargetNode(x, y) {
	      var controlNodeStyle = deepExtend({}, this.options.controlNodeStyle);
	      controlNodeStyle.id = 'targetNode' + uuid4();
	      controlNodeStyle.hidden = false;
	      controlNodeStyle.physics = false;
	      controlNodeStyle.x = x;
	      controlNodeStyle.y = y; // we have to define the bounding box in order for the nodes to be drawn immediately

	      var node = this.body.functions.createNode(controlNodeStyle);
	      node.shape.boundingBox = {
	        left: x,
	        right: x,
	        top: y,
	        bottom: y
	      };
	      return node;
	    }
	    /**
	     * Create the edit button
	     */

	  }, {
	    key: "_createEditButton",
	    value: function _createEditButton() {
	      var _context18;

	      // restore everything to it's original state (if applicable)
	      this._clean(); // reset the manipulationDOM


	      this.manipulationDOM = {}; // empty the editModeDiv

	      recursiveDOMDelete(this.editModeDiv); // create the contents for the editMode button

	      var locale = this.options.locales[this.options.locale];

	      var button = this._createButton('editMode', 'vis-button vis-edit vis-edit-mode', locale['edit'] || this.options.locales['en']['edit']);

	      this.editModeDiv.appendChild(button); // bind a hammer listener to the button, calling the function toggleEditMode.

	      this._bindHammerToDiv(button, bind$2(_context18 = this.toggleEditMode).call(_context18, this));
	    }
	    /**
	     * this function cleans up after everything this module does. Temporary elements, functions and events are removed, physics restored, hammers removed.
	     * @private
	     */

	  }, {
	    key: "_clean",
	    value: function _clean() {
	      // not in mode
	      this.inMode = false; // _clean the divs

	      if (this.guiEnabled === true) {
	        recursiveDOMDelete(this.editModeDiv);
	        recursiveDOMDelete(this.manipulationDiv); // removes all the bindings and overloads

	        this._cleanManipulatorHammers();
	      } // remove temporary nodes and edges


	      this._cleanupTemporaryNodesAndEdges(); // restore overloaded UI functions


	      this._unbindTemporaryUIs(); // remove the temporaryEventFunctions


	      this._unbindTemporaryEvents(); // restore the physics if required


	      this.body.emitter.emit('restorePhysics');
	    }
	    /**
	     * Each dom element has it's own hammer. They are stored in this.manipulationHammers. This cleans them up.
	     * @private
	     */

	  }, {
	    key: "_cleanManipulatorHammers",
	    value: function _cleanManipulatorHammers() {
	      // _clean hammer bindings
	      if (this.manipulationHammers.length != 0) {
	        for (var i = 0; i < this.manipulationHammers.length; i++) {
	          this.manipulationHammers[i].destroy();
	        }

	        this.manipulationHammers = [];
	      }
	    }
	    /**
	     * Remove all DOM elements created by this module.
	     * @private
	     */

	  }, {
	    key: "_removeManipulationDOM",
	    value: function _removeManipulationDOM() {
	      // removes all the bindings and overloads
	      this._clean(); // empty the manipulation divs


	      recursiveDOMDelete(this.manipulationDiv);
	      recursiveDOMDelete(this.editModeDiv);
	      recursiveDOMDelete(this.closeDiv); // remove the manipulation divs

	      if (this.manipulationDiv) {
	        this.canvas.frame.removeChild(this.manipulationDiv);
	      }

	      if (this.editModeDiv) {
	        this.canvas.frame.removeChild(this.editModeDiv);
	      }

	      if (this.closeDiv) {
	        this.canvas.frame.removeChild(this.closeDiv);
	      } // set the references to undefined


	      this.manipulationDiv = undefined;
	      this.editModeDiv = undefined;
	      this.closeDiv = undefined;
	    }
	    /**
	     * create a seperator line. the index is to differentiate in the manipulation dom
	     * @param {number} [index=1]
	     * @private
	     */

	  }, {
	    key: "_createSeperator",
	    value: function _createSeperator() {
	      var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
	      this.manipulationDOM['seperatorLineDiv' + index] = document.createElement('div');
	      this.manipulationDOM['seperatorLineDiv' + index].className = 'vis-separator-line';
	      this.manipulationDiv.appendChild(this.manipulationDOM['seperatorLineDiv' + index]);
	    } // ----------------------    DOM functions for buttons    --------------------------//

	    /**
	     *
	     * @param {Locale} locale
	     * @private
	     */

	  }, {
	    key: "_createAddNodeButton",
	    value: function _createAddNodeButton(locale) {
	      var _context19;

	      var button = this._createButton('addNode', 'vis-button vis-add', locale['addNode'] || this.options.locales['en']['addNode']);

	      this.manipulationDiv.appendChild(button);

	      this._bindHammerToDiv(button, bind$2(_context19 = this.addNodeMode).call(_context19, this));
	    }
	    /**
	     *
	     * @param {Locale} locale
	     * @private
	     */

	  }, {
	    key: "_createAddEdgeButton",
	    value: function _createAddEdgeButton(locale) {
	      var _context20;

	      var button = this._createButton('addEdge', 'vis-button vis-connect', locale['addEdge'] || this.options.locales['en']['addEdge']);

	      this.manipulationDiv.appendChild(button);

	      this._bindHammerToDiv(button, bind$2(_context20 = this.addEdgeMode).call(_context20, this));
	    }
	    /**
	     *
	     * @param {Locale} locale
	     * @private
	     */

	  }, {
	    key: "_createEditNodeButton",
	    value: function _createEditNodeButton(locale) {
	      var _context21;

	      var button = this._createButton('editNode', 'vis-button vis-edit', locale['editNode'] || this.options.locales['en']['editNode']);

	      this.manipulationDiv.appendChild(button);

	      this._bindHammerToDiv(button, bind$2(_context21 = this.editNode).call(_context21, this));
	    }
	    /**
	     *
	     * @param {Locale} locale
	     * @private
	     */

	  }, {
	    key: "_createEditEdgeButton",
	    value: function _createEditEdgeButton(locale) {
	      var _context22;

	      var button = this._createButton('editEdge', 'vis-button vis-edit', locale['editEdge'] || this.options.locales['en']['editEdge']);

	      this.manipulationDiv.appendChild(button);

	      this._bindHammerToDiv(button, bind$2(_context22 = this.editEdgeMode).call(_context22, this));
	    }
	    /**
	     *
	     * @param {Locale} locale
	     * @private
	     */

	  }, {
	    key: "_createDeleteButton",
	    value: function _createDeleteButton(locale) {
	      var _context23;

	      var deleteBtnClass;

	      if (this.options.rtl) {
	        deleteBtnClass = 'vis-button vis-delete-rtl';
	      } else {
	        deleteBtnClass = 'vis-button vis-delete';
	      }

	      var button = this._createButton('delete', deleteBtnClass, locale['del'] || this.options.locales['en']['del']);

	      this.manipulationDiv.appendChild(button);

	      this._bindHammerToDiv(button, bind$2(_context23 = this.deleteSelected).call(_context23, this));
	    }
	    /**
	     *
	     * @param {Locale} locale
	     * @private
	     */

	  }, {
	    key: "_createBackButton",
	    value: function _createBackButton(locale) {
	      var _context24;

	      var button = this._createButton('back', 'vis-button vis-back', locale['back'] || this.options.locales['en']['back']);

	      this.manipulationDiv.appendChild(button);

	      this._bindHammerToDiv(button, bind$2(_context24 = this.showManipulatorToolbar).call(_context24, this));
	    }
	    /**
	     *
	     * @param {number|string} id
	     * @param {string} className
	     * @param {label} label
	     * @param {string} labelClassName
	     * @returns {HTMLElement}
	     * @private
	     */

	  }, {
	    key: "_createButton",
	    value: function _createButton(id, className, label) {
	      var labelClassName = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'vis-label';
	      this.manipulationDOM[id + 'Div'] = document.createElement('div');
	      this.manipulationDOM[id + 'Div'].className = className;
	      this.manipulationDOM[id + 'Label'] = document.createElement('div');
	      this.manipulationDOM[id + 'Label'].className = labelClassName;
	      this.manipulationDOM[id + 'Label'].innerHTML = label;
	      this.manipulationDOM[id + 'Div'].appendChild(this.manipulationDOM[id + 'Label']);
	      return this.manipulationDOM[id + 'Div'];
	    }
	    /**
	     *
	     * @param {Label} label
	     * @private
	     */

	  }, {
	    key: "_createDescription",
	    value: function _createDescription(label) {
	      this.manipulationDiv.appendChild(this._createButton('description', 'vis-button vis-none', label));
	    } // -------------------------- End of DOM functions for buttons ------------------------------//

	    /**
	     * this binds an event until cleanup by the clean functions.
	     * @param {Event}  event   The event
	     * @param {function} newFunction
	     * @private
	     */

	  }, {
	    key: "_temporaryBindEvent",
	    value: function _temporaryBindEvent(event, newFunction) {
	      this.temporaryEventFunctions.push({
	        event: event,
	        boundFunction: newFunction
	      });
	      this.body.emitter.on(event, newFunction);
	    }
	    /**
	     * this overrides an UI function until cleanup by the clean function
	     * @param {string} UIfunctionName
	     * @param {function} newFunction
	     * @private
	     */

	  }, {
	    key: "_temporaryBindUI",
	    value: function _temporaryBindUI(UIfunctionName, newFunction) {
	      if (this.body.eventListeners[UIfunctionName] !== undefined) {
	        this.temporaryUIFunctions[UIfunctionName] = this.body.eventListeners[UIfunctionName];
	        this.body.eventListeners[UIfunctionName] = newFunction;
	      } else {
	        throw new Error('This UI function does not exist. Typo? You tried: ' + UIfunctionName + ' possible are: ' + stringify$2(keys$6(this.body.eventListeners)));
	      }
	    }
	    /**
	     * Restore the overridden UI functions to their original state.
	     *
	     * @private
	     */

	  }, {
	    key: "_unbindTemporaryUIs",
	    value: function _unbindTemporaryUIs() {
	      for (var functionName in this.temporaryUIFunctions) {
	        if (this.temporaryUIFunctions.hasOwnProperty(functionName)) {
	          this.body.eventListeners[functionName] = this.temporaryUIFunctions[functionName];
	          delete this.temporaryUIFunctions[functionName];
	        }
	      }

	      this.temporaryUIFunctions = {};
	    }
	    /**
	     * Unbind the events created by _temporaryBindEvent
	     * @private
	     */

	  }, {
	    key: "_unbindTemporaryEvents",
	    value: function _unbindTemporaryEvents() {
	      for (var i = 0; i < this.temporaryEventFunctions.length; i++) {
	        var eventName = this.temporaryEventFunctions[i].event;
	        var boundFunction = this.temporaryEventFunctions[i].boundFunction;
	        this.body.emitter.off(eventName, boundFunction);
	      }

	      this.temporaryEventFunctions = [];
	    }
	    /**
	     * Bind an hammer instance to a DOM element.
	     *
	     * @param {Element} domElement
	     * @param {function} boundFunction
	     */

	  }, {
	    key: "_bindHammerToDiv",
	    value: function _bindHammerToDiv(domElement, boundFunction) {
	      var hammer$1 = new hammer(domElement, {});
	      hammerUtil.onTouch(hammer$1, boundFunction);
	      this.manipulationHammers.push(hammer$1);
	    }
	    /**
	     * Neatly clean up temporary edges and nodes
	     * @private
	     */

	  }, {
	    key: "_cleanupTemporaryNodesAndEdges",
	    value: function _cleanupTemporaryNodesAndEdges() {
	      // _clean temporary edges
	      for (var i = 0; i < this.temporaryIds.edges.length; i++) {
	        var _context25;

	        this.body.edges[this.temporaryIds.edges[i]].disconnect();
	        delete this.body.edges[this.temporaryIds.edges[i]];

	        var indexTempEdge = indexOf$3(_context25 = this.body.edgeIndices).call(_context25, this.temporaryIds.edges[i]);

	        if (indexTempEdge !== -1) {
	          var _context26;

	          splice$2(_context26 = this.body.edgeIndices).call(_context26, indexTempEdge, 1);
	        }
	      } // _clean temporary nodes


	      for (var _i = 0; _i < this.temporaryIds.nodes.length; _i++) {
	        var _context27;

	        delete this.body.nodes[this.temporaryIds.nodes[_i]];

	        var indexTempNode = indexOf$3(_context27 = this.body.nodeIndices).call(_context27, this.temporaryIds.nodes[_i]);

	        if (indexTempNode !== -1) {
	          var _context28;

	          splice$2(_context28 = this.body.nodeIndices).call(_context28, indexTempNode, 1);
	        }
	      }

	      this.temporaryIds = {
	        nodes: [],
	        edges: []
	      };
	    } // ------------------------------------------ EDIT EDGE FUNCTIONS -----------------------------------------//

	    /**
	     * the touch is used to get the position of the initial click
	     * @param {Event}  event   The event
	     * @private
	     */

	  }, {
	    key: "_controlNodeTouch",
	    value: function _controlNodeTouch(event) {
	      this.selectionHandler.unselectAll();
	      this.lastTouch = this.body.functions.getPointer(event.center);
	      this.lastTouch.translation = extend({}, this.body.view.translation); // copy the object
	    }
	    /**
	     * the drag start is used to mark one of the control nodes as selected.
	     * @param {Event}  event   The event
	     * @private
	     */

	  }, {
	    key: "_controlNodeDragStart",
	    value: function _controlNodeDragStart(event) {
	      // eslint-disable-line no-unused-vars
	      var pointer = this.lastTouch;

	      var pointerObj = this.selectionHandler._pointerToPositionObject(pointer);

	      var from = this.body.nodes[this.temporaryIds.nodes[0]];
	      var to = this.body.nodes[this.temporaryIds.nodes[1]];
	      var edge = this.body.edges[this.edgeBeingEditedId];
	      this.selectedControlNode = undefined;
	      var fromSelect = from.isOverlappingWith(pointerObj);
	      var toSelect = to.isOverlappingWith(pointerObj);

	      if (fromSelect === true) {
	        this.selectedControlNode = from;
	        edge.edgeType.from = from;
	      } else if (toSelect === true) {
	        this.selectedControlNode = to;
	        edge.edgeType.to = to;
	      } // we use the selection to find the node that is being dragged. We explicitly select it here.


	      if (this.selectedControlNode !== undefined) {
	        this.selectionHandler.selectObject(this.selectedControlNode);
	      }

	      this.body.emitter.emit('_redraw');
	    }
	    /**
	     * dragging the control nodes or the canvas
	     * @param {Event}  event   The event
	     * @private
	     */

	  }, {
	    key: "_controlNodeDrag",
	    value: function _controlNodeDrag(event) {
	      this.body.emitter.emit('disablePhysics');
	      var pointer = this.body.functions.getPointer(event.center);
	      var pos = this.canvas.DOMtoCanvas(pointer);

	      if (this.selectedControlNode !== undefined) {
	        this.selectedControlNode.x = pos.x;
	        this.selectedControlNode.y = pos.y;
	      } else {
	        this.interactionHandler.onDrag(event);
	      }

	      this.body.emitter.emit('_redraw');
	    }
	    /**
	     * connecting or restoring the control nodes.
	     * @param {Event}  event   The event
	     * @private
	     */

	  }, {
	    key: "_controlNodeDragEnd",
	    value: function _controlNodeDragEnd(event) {
	      var pointer = this.body.functions.getPointer(event.center);

	      var pointerObj = this.selectionHandler._pointerToPositionObject(pointer);

	      var edge = this.body.edges[this.edgeBeingEditedId]; // if the node that was dragged is not a control node, return

	      if (this.selectedControlNode === undefined) {
	        return;
	      } // we use the selection to find the node that is being dragged. We explicitly DEselect the control node here.


	      this.selectionHandler.unselectAll();

	      var overlappingNodeIds = this.selectionHandler._getAllNodesOverlappingWith(pointerObj);

	      var node = undefined;

	      for (var i = overlappingNodeIds.length - 1; i >= 0; i--) {
	        if (overlappingNodeIds[i] !== this.selectedControlNode.id) {
	          node = this.body.nodes[overlappingNodeIds[i]];
	          break;
	        }
	      } // perform the connection


	      if (node !== undefined && this.selectedControlNode !== undefined) {
	        if (node.isCluster === true) {
	          alert(this.options.locales[this.options.locale]['createEdgeError'] || this.options.locales['en']['createEdgeError']);
	        } else {
	          var from = this.body.nodes[this.temporaryIds.nodes[0]];

	          if (this.selectedControlNode.id === from.id) {
	            this._performEditEdge(node.id, edge.to.id);
	          } else {
	            this._performEditEdge(edge.from.id, node.id);
	          }
	        }
	      } else {
	        edge.updateEdgeType();
	        this.body.emitter.emit('restorePhysics');
	      }

	      this.body.emitter.emit('_redraw');
	    } // ------------------------------------ END OF EDIT EDGE FUNCTIONS -----------------------------------------//
	    // ------------------------------------------- ADD EDGE FUNCTIONS -----------------------------------------//

	    /**
	     * the function bound to the selection event. It checks if you want to connect a cluster and changes the description
	     * to walk the user through the process.
	     *
	     * @param {Event} event
	     * @private
	     */

	  }, {
	    key: "_handleConnect",
	    value: function _handleConnect(event) {
	      // check to avoid double fireing of this function.
	      if (new Date().valueOf() - this.touchTime > 100) {
	        this.lastTouch = this.body.functions.getPointer(event.center);
	        this.lastTouch.translation = extend({}, this.body.view.translation); // copy the object

	        var pointer = this.lastTouch;
	        var node = this.selectionHandler.getNodeAt(pointer);

	        if (node !== undefined) {
	          if (node.isCluster === true) {
	            alert(this.options.locales[this.options.locale]['createEdgeError'] || this.options.locales['en']['createEdgeError']);
	          } else {
	            // create a node the temporary line can look at
	            var targetNode = this._getNewTargetNode(node.x, node.y);

	            this.body.nodes[targetNode.id] = targetNode;
	            this.body.nodeIndices.push(targetNode.id); // create a temporary edge

	            var connectionEdge = this.body.functions.createEdge({
	              id: 'connectionEdge' + uuid4(),
	              from: node.id,
	              to: targetNode.id,
	              physics: false,
	              smooth: {
	                enabled: true,
	                type: 'continuous',
	                roundness: 0.5
	              }
	            });
	            this.body.edges[connectionEdge.id] = connectionEdge;
	            this.body.edgeIndices.push(connectionEdge.id);
	            this.temporaryIds.nodes.push(targetNode.id);
	            this.temporaryIds.edges.push(connectionEdge.id);
	          }
	        }

	        this.touchTime = new Date().valueOf();
	      }
	    }
	    /**
	     *
	     * @param {Event} event
	     * @private
	     */

	  }, {
	    key: "_dragControlNode",
	    value: function _dragControlNode(event) {
	      var pointer = this.body.functions.getPointer(event.center);

	      var pointerObj = this.selectionHandler._pointerToPositionObject(pointer); // remember the edge id


	      var connectFromId = undefined;

	      if (this.temporaryIds.edges[0] !== undefined) {
	        connectFromId = this.body.edges[this.temporaryIds.edges[0]].fromId;
	      } // get the overlapping node but NOT the temporary node;


	      var overlappingNodeIds = this.selectionHandler._getAllNodesOverlappingWith(pointerObj);

	      var node = undefined;

	      for (var i = overlappingNodeIds.length - 1; i >= 0; i--) {
	        var _context29;

	        // if the node id is NOT a temporary node, accept the node.
	        if (indexOf$3(_context29 = this.temporaryIds.nodes).call(_context29, overlappingNodeIds[i]) === -1) {
	          node = this.body.nodes[overlappingNodeIds[i]];
	          break;
	        }
	      }

	      event.controlEdge = {
	        from: connectFromId,
	        to: node ? node.id : undefined
	      };

	      this.selectionHandler._generateClickEvent('controlNodeDragging', event, pointer);

	      if (this.temporaryIds.nodes[0] !== undefined) {
	        var targetNode = this.body.nodes[this.temporaryIds.nodes[0]]; // there is only one temp node in the add edge mode.

	        targetNode.x = this.canvas._XconvertDOMtoCanvas(pointer.x);
	        targetNode.y = this.canvas._YconvertDOMtoCanvas(pointer.y);
	        this.body.emitter.emit('_redraw');
	      } else {
	        this.interactionHandler.onDrag(event);
	      }
	    }
	    /**
	     * Connect the new edge to the target if one exists, otherwise remove temp line
	     * @param {Event}  event   The event
	     * @private
	     */

	  }, {
	    key: "_finishConnect",
	    value: function _finishConnect(event) {
	      var pointer = this.body.functions.getPointer(event.center);

	      var pointerObj = this.selectionHandler._pointerToPositionObject(pointer); // remember the edge id


	      var connectFromId = undefined;

	      if (this.temporaryIds.edges[0] !== undefined) {
	        connectFromId = this.body.edges[this.temporaryIds.edges[0]].fromId;
	      } // get the overlapping node but NOT the temporary node;


	      var overlappingNodeIds = this.selectionHandler._getAllNodesOverlappingWith(pointerObj);

	      var node = undefined;

	      for (var i = overlappingNodeIds.length - 1; i >= 0; i--) {
	        var _context30;

	        // if the node id is NOT a temporary node, accept the node.
	        if (indexOf$3(_context30 = this.temporaryIds.nodes).call(_context30, overlappingNodeIds[i]) === -1) {
	          node = this.body.nodes[overlappingNodeIds[i]];
	          break;
	        }
	      } // clean temporary nodes and edges.


	      this._cleanupTemporaryNodesAndEdges(); // perform the connection


	      if (node !== undefined) {
	        if (node.isCluster === true) {
	          alert(this.options.locales[this.options.locale]['createEdgeError'] || this.options.locales['en']['createEdgeError']);
	        } else {
	          if (this.body.nodes[connectFromId] !== undefined && this.body.nodes[node.id] !== undefined) {
	            this._performAddEdge(connectFromId, node.id);
	          }
	        }
	      }

	      event.controlEdge = {
	        from: connectFromId,
	        to: node ? node.id : undefined
	      };

	      this.selectionHandler._generateClickEvent('controlNodeDragEnd', event, pointer); // No need to do _generateclickevent('dragEnd') here, the regular dragEnd event fires.


	      this.body.emitter.emit('_redraw');
	    }
	    /**
	     *
	     * @param {Event} event
	     * @private
	     */

	  }, {
	    key: "_dragStartEdge",
	    value: function _dragStartEdge(event) {
	      var pointer = this.lastTouch;

	      this.selectionHandler._generateClickEvent('dragStart', event, pointer, undefined, true);
	    } // --------------------------------------- END OF ADD EDGE FUNCTIONS -------------------------------------//
	    // ------------------------------ Performing all the actual data manipulation ------------------------//

	    /**
	     * Adds a node on the specified location
	     *
	     * @param {Object} clickData
	     * @private
	     */

	  }, {
	    key: "_performAddNode",
	    value: function _performAddNode(clickData) {
	      var _this4 = this;

	      var defaultData = {
	        id: uuid4(),
	        x: clickData.pointer.canvas.x,
	        y: clickData.pointer.canvas.y,
	        label: 'new'
	      };

	      if (typeof this.options.addNode === 'function') {
	        if (this.options.addNode.length === 2) {
	          this.options.addNode(defaultData, function (finalizedData) {
	            if (finalizedData !== null && finalizedData !== undefined && _this4.inMode === 'addNode') {
	              // if for whatever reason the mode has changes (due to dataset change) disregard the callback
	              _this4.body.data.nodes.getDataSet().add(finalizedData);
	            }

	            _this4.showManipulatorToolbar();
	          });
	        } else {
	          this.showManipulatorToolbar();
	          throw new Error('The function for add does not support two arguments (data,callback)');
	        }
	      } else {
	        this.body.data.nodes.getDataSet().add(defaultData);
	        this.showManipulatorToolbar();
	      }
	    }
	    /**
	     * connect two nodes with a new edge.
	     *
	     * @param {Node.id} sourceNodeId
	     * @param {Node.id} targetNodeId
	     * @private
	     */

	  }, {
	    key: "_performAddEdge",
	    value: function _performAddEdge(sourceNodeId, targetNodeId) {
	      var _this5 = this;

	      var defaultData = {
	        from: sourceNodeId,
	        to: targetNodeId
	      };

	      if (typeof this.options.addEdge === 'function') {
	        if (this.options.addEdge.length === 2) {
	          this.options.addEdge(defaultData, function (finalizedData) {
	            if (finalizedData !== null && finalizedData !== undefined && _this5.inMode === 'addEdge') {
	              // if for whatever reason the mode has changes (due to dataset change) disregard the callback
	              _this5.body.data.edges.getDataSet().add(finalizedData);

	              _this5.selectionHandler.unselectAll();

	              _this5.showManipulatorToolbar();
	            }
	          });
	        } else {
	          throw new Error('The function for connect does not support two arguments (data,callback)');
	        }
	      } else {
	        this.body.data.edges.getDataSet().add(defaultData);
	        this.selectionHandler.unselectAll();
	        this.showManipulatorToolbar();
	      }
	    }
	    /**
	     * connect two nodes with a new edge.
	     *
	     * @param {Node.id} sourceNodeId
	     * @param {Node.id} targetNodeId
	     * @private
	     */

	  }, {
	    key: "_performEditEdge",
	    value: function _performEditEdge(sourceNodeId, targetNodeId) {
	      var _this6 = this;

	      var defaultData = {
	        id: this.edgeBeingEditedId,
	        from: sourceNodeId,
	        to: targetNodeId,
	        label: this.body.data.edges.get(this.edgeBeingEditedId).label
	      };
	      var eeFunct = this.options.editEdge;

	      if (_typeof_1(eeFunct) === 'object') {
	        eeFunct = eeFunct.editWithoutDrag;
	      }

	      if (typeof eeFunct === 'function') {
	        if (eeFunct.length === 2) {
	          eeFunct(defaultData, function (finalizedData) {
	            if (finalizedData === null || finalizedData === undefined || _this6.inMode !== 'editEdge') {
	              // if for whatever reason the mode has changes (due to dataset change) disregard the callback) {
	              _this6.body.edges[defaultData.id].updateEdgeType();

	              _this6.body.emitter.emit('_redraw');

	              _this6.showManipulatorToolbar();
	            } else {
	              _this6.body.data.edges.getDataSet().update(finalizedData);

	              _this6.selectionHandler.unselectAll();

	              _this6.showManipulatorToolbar();
	            }
	          });
	        } else {
	          throw new Error('The function for edit does not support two arguments (data, callback)');
	        }
	      } else {
	        this.body.data.edges.getDataSet().update(defaultData);
	        this.selectionHandler.unselectAll();
	        this.showManipulatorToolbar();
	      }
	    }
	  }]);

	  return ManipulationSystem;
	}();

	var css$4 = "div.vis-configuration {\n    position:relative;\n    display:block;\n    float:left;\n    font-size:12px;\n}\n\ndiv.vis-configuration-wrapper {\n    display:block;\n    width:700px;\n}\n\ndiv.vis-configuration-wrapper::after {\n  clear: both;\n  content: \"\";\n  display: block;\n}\n\ndiv.vis-configuration.vis-config-option-container{\n    display:block;\n    width:495px;\n    background-color: #ffffff;\n    border:2px solid #f7f8fa;\n    border-radius:4px;\n    margin-top:20px;\n    left:10px;\n    padding-left:5px;\n}\n\ndiv.vis-configuration.vis-config-button{\n    display:block;\n    width:495px;\n    height:25px;\n    vertical-align: middle;\n    line-height:25px;\n    background-color: #f7f8fa;\n    border:2px solid #ceced0;\n    border-radius:4px;\n    margin-top:20px;\n    left:10px;\n    padding-left:5px;\n    cursor: pointer;\n    margin-bottom:30px;\n}\n\ndiv.vis-configuration.vis-config-button.hover{\n    background-color: #4588e6;\n    border:2px solid #214373;\n    color:#ffffff;\n}\n\ndiv.vis-configuration.vis-config-item{\n    display:block;\n    float:left;\n    width:495px;\n    height:25px;\n    vertical-align: middle;\n    line-height:25px;\n}\n\n\ndiv.vis-configuration.vis-config-item.vis-config-s2{\n    left:10px;\n    background-color: #f7f8fa;\n    padding-left:5px;\n    border-radius:3px;\n}\ndiv.vis-configuration.vis-config-item.vis-config-s3{\n    left:20px;\n    background-color: #e4e9f0;\n    padding-left:5px;\n    border-radius:3px;\n}\ndiv.vis-configuration.vis-config-item.vis-config-s4{\n    left:30px;\n    background-color: #cfd8e6;\n    padding-left:5px;\n    border-radius:3px;\n}\n\ndiv.vis-configuration.vis-config-header{\n    font-size:18px;\n    font-weight: bold;\n}\n\ndiv.vis-configuration.vis-config-label{\n    width:120px;\n    height:25px;\n    line-height: 25px;\n}\n\ndiv.vis-configuration.vis-config-label.vis-config-s3{\n    width:110px;\n}\ndiv.vis-configuration.vis-config-label.vis-config-s4{\n    width:100px;\n}\n\ndiv.vis-configuration.vis-config-colorBlock{\n    top:1px;\n    width:30px;\n    height:19px;\n    border:1px solid #444444;\n    border-radius:2px;\n    padding:0px;\n    margin:0px;\n    cursor:pointer;\n}\n\ninput.vis-configuration.vis-config-checkbox {\n    left:-5px;\n}\n\n\ninput.vis-configuration.vis-config-rangeinput{\n    position:relative;\n    top:-5px;\n    width:60px;\n    /*height:13px;*/\n    padding:1px;\n    margin:0;\n    pointer-events:none;\n}\n\ninput.vis-configuration.vis-config-range{\n    /*removes default webkit styles*/\n    -webkit-appearance: none;\n\n    /*fix for FF unable to apply focus style bug */\n    border: 0px solid white;\n    background-color:rgba(0,0,0,0);\n\n    /*required for proper track sizing in FF*/\n    width: 300px;\n    height:20px;\n}\ninput.vis-configuration.vis-config-range::-webkit-slider-runnable-track {\n    width: 300px;\n    height: 5px;\n    background: #dedede; /* Old browsers */\n    background: -moz-linear-gradient(top,  #dedede 0%, #c8c8c8 99%); /* FF3.6+ */\n    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#dedede), color-stop(99%,#c8c8c8)); /* Chrome,Safari4+ */\n    background: -webkit-linear-gradient(top,  #dedede 0%,#c8c8c8 99%); /* Chrome10+,Safari5.1+ */\n    background: -o-linear-gradient(top, #dedede 0%, #c8c8c8 99%); /* Opera 11.10+ */\n    background: -ms-linear-gradient(top,  #dedede 0%,#c8c8c8 99%); /* IE10+ */\n    background: linear-gradient(to bottom,  #dedede 0%,#c8c8c8 99%); /* W3C */\n    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#dedede', endColorstr='#c8c8c8',GradientType=0 ); /* IE6-9 */\n\n    border: 1px solid #999999;\n    box-shadow: #aaaaaa 0px 0px 3px 0px;\n    border-radius: 3px;\n}\ninput.vis-configuration.vis-config-range::-webkit-slider-thumb {\n    -webkit-appearance: none;\n    border: 1px solid #14334b;\n    height: 17px;\n    width: 17px;\n    border-radius: 50%;\n    background: #3876c2; /* Old browsers */\n    background: -moz-linear-gradient(top,  #3876c2 0%, #385380 100%); /* FF3.6+ */\n    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#3876c2), color-stop(100%,#385380)); /* Chrome,Safari4+ */\n    background: -webkit-linear-gradient(top,  #3876c2 0%,#385380 100%); /* Chrome10+,Safari5.1+ */\n    background: -o-linear-gradient(top,  #3876c2 0%,#385380 100%); /* Opera 11.10+ */\n    background: -ms-linear-gradient(top,  #3876c2 0%,#385380 100%); /* IE10+ */\n    background: linear-gradient(to bottom,  #3876c2 0%,#385380 100%); /* W3C */\n    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#3876c2', endColorstr='#385380',GradientType=0 ); /* IE6-9 */\n    box-shadow: #111927 0px 0px 1px 0px;\n    margin-top: -7px;\n}\ninput.vis-configuration.vis-config-range:focus {\n    outline: none;\n}\ninput.vis-configuration.vis-config-range:focus::-webkit-slider-runnable-track {\n    background: #9d9d9d; /* Old browsers */\n    background: -moz-linear-gradient(top, #9d9d9d 0%, #c8c8c8 99%); /* FF3.6+ */\n    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#9d9d9d), color-stop(99%,#c8c8c8)); /* Chrome,Safari4+ */\n    background: -webkit-linear-gradient(top,  #9d9d9d 0%,#c8c8c8 99%); /* Chrome10+,Safari5.1+ */\n    background: -o-linear-gradient(top,  #9d9d9d 0%,#c8c8c8 99%); /* Opera 11.10+ */\n    background: -ms-linear-gradient(top,  #9d9d9d 0%,#c8c8c8 99%); /* IE10+ */\n    background: linear-gradient(to bottom,  #9d9d9d 0%,#c8c8c8 99%); /* W3C */\n    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#9d9d9d', endColorstr='#c8c8c8',GradientType=0 ); /* IE6-9 */\n}\n\ninput.vis-configuration.vis-config-range::-moz-range-track {\n    width: 300px;\n    height: 10px;\n    background: #dedede; /* Old browsers */\n    background: -moz-linear-gradient(top,  #dedede 0%, #c8c8c8 99%); /* FF3.6+ */\n    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#dedede), color-stop(99%,#c8c8c8)); /* Chrome,Safari4+ */\n    background: -webkit-linear-gradient(top,  #dedede 0%,#c8c8c8 99%); /* Chrome10+,Safari5.1+ */\n    background: -o-linear-gradient(top, #dedede 0%, #c8c8c8 99%); /* Opera 11.10+ */\n    background: -ms-linear-gradient(top,  #dedede 0%,#c8c8c8 99%); /* IE10+ */\n    background: linear-gradient(to bottom,  #dedede 0%,#c8c8c8 99%); /* W3C */\n    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#dedede', endColorstr='#c8c8c8',GradientType=0 ); /* IE6-9 */\n\n    border: 1px solid #999999;\n    box-shadow: #aaaaaa 0px 0px 3px 0px;\n    border-radius: 3px;\n}\ninput.vis-configuration.vis-config-range::-moz-range-thumb {\n    border: none;\n    height: 16px;\n    width: 16px;\n\n    border-radius: 50%;\n    background:  #385380;\n}\n\n/*hide the outline behind the border*/\ninput.vis-configuration.vis-config-range:-moz-focusring{\n    outline: 1px solid white;\n    outline-offset: -1px;\n}\n\ninput.vis-configuration.vis-config-range::-ms-track {\n    width: 300px;\n    height: 5px;\n\n    /*remove bg colour from the track, we'll use ms-fill-lower and ms-fill-upper instead */\n    background: transparent;\n\n    /*leave room for the larger thumb to overflow with a transparent border */\n    border-color: transparent;\n    border-width: 6px 0;\n\n    /*remove default tick marks*/\n    color: transparent;\n}\ninput.vis-configuration.vis-config-range::-ms-fill-lower {\n    background: #777;\n    border-radius: 10px;\n}\ninput.vis-configuration.vis-config-range::-ms-fill-upper {\n    background: #ddd;\n    border-radius: 10px;\n}\ninput.vis-configuration.vis-config-range::-ms-thumb {\n    border: none;\n    height: 16px;\n    width: 16px;\n    border-radius: 50%;\n    background:  #385380;\n}\ninput.vis-configuration.vis-config-range:focus::-ms-fill-lower {\n    background: #888;\n}\ninput.vis-configuration.vis-config-range:focus::-ms-fill-upper {\n    background: #ccc;\n}\n\n.vis-configuration-popup {\n    position: absolute;\n    background: rgba(57, 76, 89, 0.85);\n    border: 2px solid #f2faff;\n    line-height:30px;\n    height:30px;\n    width:150px;\n    text-align:center;\n    color: #ffffff;\n    font-size:14px;\n    border-radius:4px;\n    -webkit-transition: opacity 0.3s ease-in-out;\n    -moz-transition: opacity 0.3s ease-in-out;\n    transition: opacity 0.3s ease-in-out;\n}\n.vis-configuration-popup:after, .vis-configuration-popup:before {\n    left: 100%;\n    top: 50%;\n    border: solid transparent;\n    content: \" \";\n    height: 0;\n    width: 0;\n    position: absolute;\n    pointer-events: none;\n}\n\n.vis-configuration-popup:after {\n    border-color: rgba(136, 183, 213, 0);\n    border-left-color: rgba(57, 76, 89, 0.85);\n    border-width: 8px;\n    margin-top: -8px;\n}\n.vis-configuration-popup:before {\n    border-color: rgba(194, 225, 245, 0);\n    border-left-color: #f2faff;\n    border-width: 12px;\n    margin-top: -12px;\n}\n/*# sourceMappingURL=data:application/json;base64,[encoded data, 16064 characters] */";
	styleInject(css$4);

	var css$5 = "\ndiv.vis-color-picker {\n  position:absolute;\n  top: 0px;\n  left: 30px;\n  margin-top:-140px;\n  margin-left:30px;\n  width:310px;\n  height:444px;\n  z-index: 1;\n  padding: 10px;\n  border-radius:15px;\n  background-color:#ffffff;\n  display: none;\n  box-shadow: rgba(0,0,0,0.5) 0px 0px 10px 0px;\n}\n\ndiv.vis-color-picker div.vis-arrow {\n  position: absolute;\n  top:147px;\n  left:5px;\n}\n\ndiv.vis-color-picker div.vis-arrow::after,\ndiv.vis-color-picker div.vis-arrow::before {\n  right: 100%;\n  top: 50%;\n  border: solid transparent;\n  content: \" \";\n  height: 0;\n  width: 0;\n  position: absolute;\n  pointer-events: none;\n}\n\ndiv.vis-color-picker div.vis-arrow:after {\n  border-color: rgba(255, 255, 255, 0);\n  border-right-color: #ffffff;\n  border-width: 30px;\n  margin-top: -30px;\n}\n\ndiv.vis-color-picker div.vis-color {\n  position:absolute;\n  width: 289px;\n  height: 289px;\n  cursor: pointer;\n}\n\n\n\ndiv.vis-color-picker div.vis-brightness {\n  position: absolute;\n  top:313px;\n}\n\ndiv.vis-color-picker div.vis-opacity {\n  position:absolute;\n  top:350px;\n}\n\ndiv.vis-color-picker div.vis-selector {\n  position:absolute;\n  top:137px;\n  left:137px;\n  width:15px;\n  height:15px;\n  border-radius:15px;\n  border:1px solid #ffffff;\n  background: #4c4c4c; /* Old browsers */\n  background: -moz-linear-gradient(top,  #4c4c4c 0%, #595959 12%, #666666 25%, #474747 39%, #2c2c2c 50%, #000000 51%, #111111 60%, #2b2b2b 76%, #1c1c1c 91%, #131313 100%); /* FF3.6+ */\n  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#4c4c4c), color-stop(12%,#595959), color-stop(25%,#666666), color-stop(39%,#474747), color-stop(50%,#2c2c2c), color-stop(51%,#000000), color-stop(60%,#111111), color-stop(76%,#2b2b2b), color-stop(91%,#1c1c1c), color-stop(100%,#131313)); /* Chrome,Safari4+ */\n  background: -webkit-linear-gradient(top,  #4c4c4c 0%,#595959 12%,#666666 25%,#474747 39%,#2c2c2c 50%,#000000 51%,#111111 60%,#2b2b2b 76%,#1c1c1c 91%,#131313 100%); /* Chrome10+,Safari5.1+ */\n  background: -o-linear-gradient(top,  #4c4c4c 0%,#595959 12%,#666666 25%,#474747 39%,#2c2c2c 50%,#000000 51%,#111111 60%,#2b2b2b 76%,#1c1c1c 91%,#131313 100%); /* Opera 11.10+ */\n  background: -ms-linear-gradient(top,  #4c4c4c 0%,#595959 12%,#666666 25%,#474747 39%,#2c2c2c 50%,#000000 51%,#111111 60%,#2b2b2b 76%,#1c1c1c 91%,#131313 100%); /* IE10+ */\n  background: linear-gradient(to bottom,  #4c4c4c 0%,#595959 12%,#666666 25%,#474747 39%,#2c2c2c 50%,#000000 51%,#111111 60%,#2b2b2b 76%,#1c1c1c 91%,#131313 100%); /* W3C */\n  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#4c4c4c', endColorstr='#131313',GradientType=0 ); /* IE6-9 */\n}\n\n\n\ndiv.vis-color-picker div.vis-new-color {\n  position:absolute;\n  width:140px;\n  height:20px;\n  border:1px solid rgba(0,0,0,0.1);\n  border-radius:5px;\n  top:380px;\n  left:159px;\n  text-align:right;\n  padding-right:2px;\n  font-size:10px;\n  color:rgba(0,0,0,0.4);\n  vertical-align:middle;\n  line-height:20px;\n\n}\n\ndiv.vis-color-picker div.vis-initial-color {\n  position:absolute;\n  width:140px;\n  height:20px;\n  border:1px solid rgba(0,0,0,0.1);\n  border-radius:5px;\n  top:380px;\n  left:10px;\n  text-align:left;\n  padding-left:2px;\n  font-size:10px;\n  color:rgba(0,0,0,0.4);\n  vertical-align:middle;\n  line-height:20px;\n}\n\ndiv.vis-color-picker div.vis-label {\n  position:absolute;\n  width:300px;\n  left:10px;\n}\n\ndiv.vis-color-picker div.vis-label.vis-brightness {\n  top:300px;\n}\n\ndiv.vis-color-picker div.vis-label.vis-opacity {\n  top:338px;\n}\n\ndiv.vis-color-picker div.vis-button {\n  position:absolute;\n  width:68px;\n  height:25px;\n  border-radius:10px;\n  vertical-align: middle;\n  text-align:center;\n  line-height: 25px;\n  top:410px;\n  border:2px solid #d9d9d9;\n  background-color: #f7f7f7;\n  cursor:pointer;\n}\n\ndiv.vis-color-picker div.vis-button.vis-cancel {\n  /*border:2px solid #ff4e33;*/\n  /*background-color: #ff7761;*/\n  left:5px;\n}\ndiv.vis-color-picker div.vis-button.vis-load {\n  /*border:2px solid #a153e6;*/\n  /*background-color: #cb8dff;*/\n  left:82px;\n}\ndiv.vis-color-picker div.vis-button.vis-apply {\n  /*border:2px solid #4588e6;*/\n  /*background-color: #82b6ff;*/\n  left:159px;\n}\ndiv.vis-color-picker div.vis-button.vis-save {\n  /*border:2px solid #45e655;*/\n  /*background-color: #6dff7c;*/\n  left:236px;\n}\n\n\ndiv.vis-color-picker input.vis-range {\n  width: 290px;\n  height:20px;\n}\n\n/* TODO: is this redundant?\ndiv.vis-color-picker input.vis-range-brightness {\n  width: 289px !important;\n}\n\n\ndiv.vis-color-picker input.vis-saturation-range {\n  width: 289px !important;\n}*/\n/*# sourceMappingURL=data:application/json;base64,[encoded data, 8504 characters] */";
	styleInject(css$5);

	var htmlColors = {
	  black: '#000000',
	  navy: '#000080',
	  darkblue: '#00008B',
	  mediumblue: '#0000CD',
	  blue: '#0000FF',
	  darkgreen: '#006400',
	  green: '#008000',
	  teal: '#008080',
	  darkcyan: '#008B8B',
	  deepskyblue: '#00BFFF',
	  darkturquoise: '#00CED1',
	  mediumspringgreen: '#00FA9A',
	  lime: '#00FF00',
	  springgreen: '#00FF7F',
	  aqua: '#00FFFF',
	  cyan: '#00FFFF',
	  midnightblue: '#191970',
	  dodgerblue: '#1E90FF',
	  lightseagreen: '#20B2AA',
	  forestgreen: '#228B22',
	  seagreen: '#2E8B57',
	  darkslategray: '#2F4F4F',
	  limegreen: '#32CD32',
	  mediumseagreen: '#3CB371',
	  turquoise: '#40E0D0',
	  royalblue: '#4169E1',
	  steelblue: '#4682B4',
	  darkslateblue: '#483D8B',
	  mediumturquoise: '#48D1CC',
	  indigo: '#4B0082',
	  darkolivegreen: '#556B2F',
	  cadetblue: '#5F9EA0',
	  cornflowerblue: '#6495ED',
	  mediumaquamarine: '#66CDAA',
	  dimgray: '#696969',
	  slateblue: '#6A5ACD',
	  olivedrab: '#6B8E23',
	  slategray: '#708090',
	  lightslategray: '#778899',
	  mediumslateblue: '#7B68EE',
	  lawngreen: '#7CFC00',
	  chartreuse: '#7FFF00',
	  aquamarine: '#7FFFD4',
	  maroon: '#800000',
	  purple: '#800080',
	  olive: '#808000',
	  gray: '#808080',
	  skyblue: '#87CEEB',
	  lightskyblue: '#87CEFA',
	  blueviolet: '#8A2BE2',
	  darkred: '#8B0000',
	  darkmagenta: '#8B008B',
	  saddlebrown: '#8B4513',
	  darkseagreen: '#8FBC8F',
	  lightgreen: '#90EE90',
	  mediumpurple: '#9370D8',
	  darkviolet: '#9400D3',
	  palegreen: '#98FB98',
	  darkorchid: '#9932CC',
	  yellowgreen: '#9ACD32',
	  sienna: '#A0522D',
	  brown: '#A52A2A',
	  darkgray: '#A9A9A9',
	  lightblue: '#ADD8E6',
	  greenyellow: '#ADFF2F',
	  paleturquoise: '#AFEEEE',
	  lightsteelblue: '#B0C4DE',
	  powderblue: '#B0E0E6',
	  firebrick: '#B22222',
	  darkgoldenrod: '#B8860B',
	  mediumorchid: '#BA55D3',
	  rosybrown: '#BC8F8F',
	  darkkhaki: '#BDB76B',
	  silver: '#C0C0C0',
	  mediumvioletred: '#C71585',
	  indianred: '#CD5C5C',
	  peru: '#CD853F',
	  chocolate: '#D2691E',
	  tan: '#D2B48C',
	  lightgrey: '#D3D3D3',
	  palevioletred: '#D87093',
	  thistle: '#D8BFD8',
	  orchid: '#DA70D6',
	  goldenrod: '#DAA520',
	  crimson: '#DC143C',
	  gainsboro: '#DCDCDC',
	  plum: '#DDA0DD',
	  burlywood: '#DEB887',
	  lightcyan: '#E0FFFF',
	  lavender: '#E6E6FA',
	  darksalmon: '#E9967A',
	  violet: '#EE82EE',
	  palegoldenrod: '#EEE8AA',
	  lightcoral: '#F08080',
	  khaki: '#F0E68C',
	  aliceblue: '#F0F8FF',
	  honeydew: '#F0FFF0',
	  azure: '#F0FFFF',
	  sandybrown: '#F4A460',
	  wheat: '#F5DEB3',
	  beige: '#F5F5DC',
	  whitesmoke: '#F5F5F5',
	  mintcream: '#F5FFFA',
	  ghostwhite: '#F8F8FF',
	  salmon: '#FA8072',
	  antiquewhite: '#FAEBD7',
	  linen: '#FAF0E6',
	  lightgoldenrodyellow: '#FAFAD2',
	  oldlace: '#FDF5E6',
	  red: '#FF0000',
	  fuchsia: '#FF00FF',
	  magenta: '#FF00FF',
	  deeppink: '#FF1493',
	  orangered: '#FF4500',
	  tomato: '#FF6347',
	  hotpink: '#FF69B4',
	  coral: '#FF7F50',
	  darkorange: '#FF8C00',
	  lightsalmon: '#FFA07A',
	  orange: '#FFA500',
	  lightpink: '#FFB6C1',
	  pink: '#FFC0CB',
	  gold: '#FFD700',
	  peachpuff: '#FFDAB9',
	  navajowhite: '#FFDEAD',
	  moccasin: '#FFE4B5',
	  bisque: '#FFE4C4',
	  mistyrose: '#FFE4E1',
	  blanchedalmond: '#FFEBCD',
	  papayawhip: '#FFEFD5',
	  lavenderblush: '#FFF0F5',
	  seashell: '#FFF5EE',
	  cornsilk: '#FFF8DC',
	  lemonchiffon: '#FFFACD',
	  floralwhite: '#FFFAF0',
	  snow: '#FFFAFA',
	  yellow: '#FFFF00',
	  lightyellow: '#FFFFE0',
	  ivory: '#FFFFF0',
	  white: '#FFFFFF'
	};
	/**
	 * @param {number} [pixelRatio=1]
	 */

	var ColorPicker =
	/*#__PURE__*/
	function () {
	  /**
	   * @param {number} [pixelRatio=1]
	   */
	  function ColorPicker() {
	    var pixelRatio = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;

	    classCallCheck(this, ColorPicker);

	    this.pixelRatio = pixelRatio;
	    this.generated = false;
	    this.centerCoordinates = {
	      x: 289 / 2,
	      y: 289 / 2
	    };
	    this.r = 289 * 0.49;
	    this.color = {
	      r: 255,
	      g: 255,
	      b: 255,
	      a: 1.0
	    };
	    this.hueCircle = undefined;
	    this.initialColor = {
	      r: 255,
	      g: 255,
	      b: 255,
	      a: 1.0
	    };
	    this.previousColor = undefined;
	    this.applied = false; // bound by

	    this.updateCallback = function () {};

	    this.closeCallback = function () {}; // create all DOM elements


	    this._create();
	  }
	  /**
	   * this inserts the colorPicker into a div from the DOM
	   * @param {Element} container
	   */


	  createClass(ColorPicker, [{
	    key: "insertTo",
	    value: function insertTo(container) {
	      if (this.hammer !== undefined) {
	        this.hammer.destroy();
	        this.hammer = undefined;
	      }

	      this.container = container;
	      this.container.appendChild(this.frame);

	      this._bindHammer();

	      this._setSize();
	    }
	    /**
	     * the callback is executed on apply and save. Bind it to the application
	     * @param {function} callback
	     */

	  }, {
	    key: "setUpdateCallback",
	    value: function setUpdateCallback(callback) {
	      if (typeof callback === 'function') {
	        this.updateCallback = callback;
	      } else {
	        throw new Error("Function attempted to set as colorPicker update callback is not a function.");
	      }
	    }
	    /**
	     * the callback is executed on apply and save. Bind it to the application
	     * @param {function} callback
	     */

	  }, {
	    key: "setCloseCallback",
	    value: function setCloseCallback(callback) {
	      if (typeof callback === 'function') {
	        this.closeCallback = callback;
	      } else {
	        throw new Error("Function attempted to set as colorPicker closing callback is not a function.");
	      }
	    }
	    /**
	     *
	     * @param {string} color
	     * @returns {String}
	     * @private
	     */

	  }, {
	    key: "_isColorString",
	    value: function _isColorString(color) {
	      if (typeof color === 'string') {
	        return htmlColors[color];
	      }
	    }
	    /**
	     * Set the color of the colorPicker
	     * Supported formats:
	     * 'red'                   --> HTML color string
	     * '#ffffff'               --> hex string
	     * 'rgb(255,255,255)'      --> rgb string
	     * 'rgba(255,255,255,1.0)' --> rgba string
	     * {r:255,g:255,b:255}     --> rgb object
	     * {r:255,g:255,b:255,a:1.0} --> rgba object
	     * @param {string|Object} color
	     * @param {boolean} [setInitial=true]
	     */

	  }, {
	    key: "setColor",
	    value: function setColor(color) {
	      var setInitial = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;

	      if (color === 'none') {
	        return;
	      }

	      var rgba; // if a html color shorthand is used, convert to hex

	      var htmlColor = this._isColorString(color);

	      if (htmlColor !== undefined) {
	        color = htmlColor;
	      } // check format


	      if (isString(color) === true) {
	        if (isValidRGB(color) === true) {
	          var rgbaArray = color.substr(4).substr(0, color.length - 5).split(',');
	          rgba = {
	            r: rgbaArray[0],
	            g: rgbaArray[1],
	            b: rgbaArray[2],
	            a: 1.0
	          };
	        } else if (isValidRGBA(color) === true) {
	          var _rgbaArray = color.substr(5).substr(0, color.length - 6).split(',');

	          rgba = {
	            r: _rgbaArray[0],
	            g: _rgbaArray[1],
	            b: _rgbaArray[2],
	            a: _rgbaArray[3]
	          };
	        } else if (isValidHex(color) === true) {
	          var rgbObj = hexToRGB(color);
	          rgba = {
	            r: rgbObj.r,
	            g: rgbObj.g,
	            b: rgbObj.b,
	            a: 1.0
	          };
	        }
	      } else {
	        if (color instanceof Object) {
	          if (color.r !== undefined && color.g !== undefined && color.b !== undefined) {
	            var alpha = color.a !== undefined ? color.a : '1.0';
	            rgba = {
	              r: color.r,
	              g: color.g,
	              b: color.b,
	              a: alpha
	            };
	          }
	        }
	      } // set color


	      if (rgba === undefined) {
	        throw new Error("Unknown color passed to the colorPicker. Supported are strings: rgb, hex, rgba. Object: rgb ({r:r,g:g,b:b,[a:a]}). Supplied: " + stringify$2(color));
	      } else {
	        this._setColor(rgba, setInitial);
	      }
	    }
	    /**
	     * this shows the color picker.
	     * The hue circle is constructed once and stored.
	     */

	  }, {
	    key: "show",
	    value: function show() {
	      if (this.closeCallback !== undefined) {
	        this.closeCallback();
	        this.closeCallback = undefined;
	      }

	      this.applied = false;
	      this.frame.style.display = 'block';

	      this._generateHueCircle();
	    } // ------------------------------------------ PRIVATE ----------------------------- //

	    /**
	     * Hide the picker. Is called by the cancel button.
	     * Optional boolean to store the previous color for easy access later on.
	     * @param {boolean} [storePrevious=true]
	     * @private
	     */

	  }, {
	    key: "_hide",
	    value: function _hide() {
	      var _this = this;

	      var storePrevious = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;

	      // store the previous color for next time;
	      if (storePrevious === true) {
	        this.previousColor = extend({}, this.color);
	      }

	      if (this.applied === true) {
	        this.updateCallback(this.initialColor);
	      }

	      this.frame.style.display = 'none'; // call the closing callback, restoring the onclick method.
	      // this is in a setTimeout because it will trigger the show again before the click is done.

	      setTimeout$2(function () {
	        if (_this.closeCallback !== undefined) {
	          _this.closeCallback();

	          _this.closeCallback = undefined;
	        }
	      }, 0);
	    }
	    /**
	     * bound to the save button. Saves and hides.
	     * @private
	     */

	  }, {
	    key: "_save",
	    value: function _save() {
	      this.updateCallback(this.color);
	      this.applied = false;

	      this._hide();
	    }
	    /**
	     * Bound to apply button. Saves but does not close. Is undone by the cancel button.
	     * @private
	     */

	  }, {
	    key: "_apply",
	    value: function _apply() {
	      this.applied = true;
	      this.updateCallback(this.color);

	      this._updatePicker(this.color);
	    }
	    /**
	     * load the color from the previous session.
	     * @private
	     */

	  }, {
	    key: "_loadLast",
	    value: function _loadLast() {
	      if (this.previousColor !== undefined) {
	        this.setColor(this.previousColor, false);
	      } else {
	        alert("There is no last color to load...");
	      }
	    }
	    /**
	     * set the color, place the picker
	     * @param {Object} rgba
	     * @param {boolean} [setInitial=true]
	     * @private
	     */

	  }, {
	    key: "_setColor",
	    value: function _setColor(rgba) {
	      var setInitial = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;

	      // store the initial color
	      if (setInitial === true) {
	        this.initialColor = extend({}, rgba);
	      }

	      this.color = rgba;
	      var hsv = RGBToHSV(rgba.r, rgba.g, rgba.b);
	      var angleConvert = 2 * Math.PI;
	      var radius = this.r * hsv.s;
	      var x = this.centerCoordinates.x + radius * Math.sin(angleConvert * hsv.h);
	      var y = this.centerCoordinates.y + radius * Math.cos(angleConvert * hsv.h);
	      this.colorPickerSelector.style.left = x - 0.5 * this.colorPickerSelector.clientWidth + 'px';
	      this.colorPickerSelector.style.top = y - 0.5 * this.colorPickerSelector.clientHeight + 'px';

	      this._updatePicker(rgba);
	    }
	    /**
	     * bound to opacity control
	     * @param {number} value
	     * @private
	     */

	  }, {
	    key: "_setOpacity",
	    value: function _setOpacity(value) {
	      this.color.a = value / 100;

	      this._updatePicker(this.color);
	    }
	    /**
	     * bound to brightness control
	     * @param {number} value
	     * @private
	     */

	  }, {
	    key: "_setBrightness",
	    value: function _setBrightness(value) {
	      var hsv = RGBToHSV(this.color.r, this.color.g, this.color.b);
	      hsv.v = value / 100;
	      var rgba = HSVToRGB(hsv.h, hsv.s, hsv.v);
	      rgba['a'] = this.color.a;
	      this.color = rgba;

	      this._updatePicker();
	    }
	    /**
	     * update the color picker. A black circle overlays the hue circle to mimic the brightness decreasing.
	     * @param {Object} rgba
	     * @private
	     */

	  }, {
	    key: "_updatePicker",
	    value: function _updatePicker() {
	      var rgba = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.color;
	      var hsv = RGBToHSV(rgba.r, rgba.g, rgba.b);
	      var ctx = this.colorPickerCanvas.getContext('2d');

	      if (this.pixelRation === undefined) {
	        this.pixelRatio = (window.devicePixelRatio || 1) / (ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1);
	      }

	      ctx.setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0); // clear the canvas

	      var w = this.colorPickerCanvas.clientWidth;
	      var h = this.colorPickerCanvas.clientHeight;
	      ctx.clearRect(0, 0, w, h);
	      ctx.putImageData(this.hueCircle, 0, 0);
	      ctx.fillStyle = 'rgba(0,0,0,' + (1 - hsv.v) + ')';
	      ctx.circle(this.centerCoordinates.x, this.centerCoordinates.y, this.r);

	      fill$2(ctx).call(ctx);

	      this.brightnessRange.value = 100 * hsv.v;
	      this.opacityRange.value = 100 * rgba.a;
	      this.initialColorDiv.style.backgroundColor = 'rgba(' + this.initialColor.r + ',' + this.initialColor.g + ',' + this.initialColor.b + ',' + this.initialColor.a + ')';
	      this.newColorDiv.style.backgroundColor = 'rgba(' + this.color.r + ',' + this.color.g + ',' + this.color.b + ',' + this.color.a + ')';
	    }
	    /**
	     * used by create to set the size of the canvas.
	     * @private
	     */

	  }, {
	    key: "_setSize",
	    value: function _setSize() {
	      this.colorPickerCanvas.style.width = '100%';
	      this.colorPickerCanvas.style.height = '100%';
	      this.colorPickerCanvas.width = 289 * this.pixelRatio;
	      this.colorPickerCanvas.height = 289 * this.pixelRatio;
	    }
	    /**
	     * create all dom elements
	     * TODO: cleanup, lots of similar dom elements
	     * @private
	     */

	  }, {
	    key: "_create",
	    value: function _create() {
	      var _context, _context2, _context3, _context4;

	      this.frame = document.createElement('div');
	      this.frame.className = 'vis-color-picker';
	      this.colorPickerDiv = document.createElement('div');
	      this.colorPickerSelector = document.createElement('div');
	      this.colorPickerSelector.className = 'vis-selector';
	      this.colorPickerDiv.appendChild(this.colorPickerSelector);
	      this.colorPickerCanvas = document.createElement('canvas');
	      this.colorPickerDiv.appendChild(this.colorPickerCanvas);

	      if (!this.colorPickerCanvas.getContext) {
	        var noCanvas = document.createElement('DIV');
	        noCanvas.style.color = 'red';
	        noCanvas.style.fontWeight = 'bold';
	        noCanvas.style.padding = '10px';
	        noCanvas.innerHTML = 'Error: your browser does not support HTML canvas';
	        this.colorPickerCanvas.appendChild(noCanvas);
	      } else {
	        var ctx = this.colorPickerCanvas.getContext("2d");
	        this.pixelRatio = (window.devicePixelRatio || 1) / (ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1);
	        this.colorPickerCanvas.getContext("2d").setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0);
	      }

	      this.colorPickerDiv.className = 'vis-color';
	      this.opacityDiv = document.createElement('div');
	      this.opacityDiv.className = 'vis-opacity';
	      this.brightnessDiv = document.createElement('div');
	      this.brightnessDiv.className = 'vis-brightness';
	      this.arrowDiv = document.createElement('div');
	      this.arrowDiv.className = 'vis-arrow';
	      this.opacityRange = document.createElement('input');

	      try {
	        this.opacityRange.type = 'range'; // Not supported on IE9

	        this.opacityRange.min = '0';
	        this.opacityRange.max = '100';
	      } // TODO: Add some error handling and remove this lint exception
	      catch (err) {} // eslint-disable-line no-empty


	      this.opacityRange.value = '100';
	      this.opacityRange.className = 'vis-range';
	      this.brightnessRange = document.createElement('input');

	      try {
	        this.brightnessRange.type = 'range'; // Not supported on IE9

	        this.brightnessRange.min = '0';
	        this.brightnessRange.max = '100';
	      } // TODO: Add some error handling and remove this lint exception
	      catch (err) {} // eslint-disable-line no-empty


	      this.brightnessRange.value = '100';
	      this.brightnessRange.className = 'vis-range';
	      this.opacityDiv.appendChild(this.opacityRange);
	      this.brightnessDiv.appendChild(this.brightnessRange);
	      var me = this;

	      this.opacityRange.onchange = function () {
	        me._setOpacity(this.value);
	      };

	      this.opacityRange.oninput = function () {
	        me._setOpacity(this.value);
	      };

	      this.brightnessRange.onchange = function () {
	        me._setBrightness(this.value);
	      };

	      this.brightnessRange.oninput = function () {
	        me._setBrightness(this.value);
	      };

	      this.brightnessLabel = document.createElement("div");
	      this.brightnessLabel.className = "vis-label vis-brightness";
	      this.brightnessLabel.innerHTML = 'brightness:';
	      this.opacityLabel = document.createElement("div");
	      this.opacityLabel.className = "vis-label vis-opacity";
	      this.opacityLabel.innerHTML = 'opacity:';
	      this.newColorDiv = document.createElement("div");
	      this.newColorDiv.className = "vis-new-color";
	      this.newColorDiv.innerHTML = 'new';
	      this.initialColorDiv = document.createElement("div");
	      this.initialColorDiv.className = "vis-initial-color";
	      this.initialColorDiv.innerHTML = 'initial';
	      this.cancelButton = document.createElement("div");
	      this.cancelButton.className = "vis-button vis-cancel";
	      this.cancelButton.innerHTML = 'cancel';
	      this.cancelButton.onclick = bind$2(_context = this._hide).call(_context, this, false);
	      this.applyButton = document.createElement("div");
	      this.applyButton.className = "vis-button vis-apply";
	      this.applyButton.innerHTML = 'apply';
	      this.applyButton.onclick = bind$2(_context2 = this._apply).call(_context2, this);
	      this.saveButton = document.createElement("div");
	      this.saveButton.className = "vis-button vis-save";
	      this.saveButton.innerHTML = 'save';
	      this.saveButton.onclick = bind$2(_context3 = this._save).call(_context3, this);
	      this.loadButton = document.createElement("div");
	      this.loadButton.className = "vis-button vis-load";
	      this.loadButton.innerHTML = 'load last';
	      this.loadButton.onclick = bind$2(_context4 = this._loadLast).call(_context4, this);
	      this.frame.appendChild(this.colorPickerDiv);
	      this.frame.appendChild(this.arrowDiv);
	      this.frame.appendChild(this.brightnessLabel);
	      this.frame.appendChild(this.brightnessDiv);
	      this.frame.appendChild(this.opacityLabel);
	      this.frame.appendChild(this.opacityDiv);
	      this.frame.appendChild(this.newColorDiv);
	      this.frame.appendChild(this.initialColorDiv);
	      this.frame.appendChild(this.cancelButton);
	      this.frame.appendChild(this.applyButton);
	      this.frame.appendChild(this.saveButton);
	      this.frame.appendChild(this.loadButton);
	    }
	    /**
	     * bind hammer to the color picker
	     * @private
	     */

	  }, {
	    key: "_bindHammer",
	    value: function _bindHammer() {
	      var _this2 = this;

	      this.drag = {};
	      this.pinch = {};
	      this.hammer = new hammer(this.colorPickerCanvas);
	      this.hammer.get('pinch').set({
	        enable: true
	      });
	      hammerUtil.onTouch(this.hammer, function (event) {
	        _this2._moveSelector(event);
	      });
	      this.hammer.on('tap', function (event) {
	        _this2._moveSelector(event);
	      });
	      this.hammer.on('panstart', function (event) {
	        _this2._moveSelector(event);
	      });
	      this.hammer.on('panmove', function (event) {
	        _this2._moveSelector(event);
	      });
	      this.hammer.on('panend', function (event) {
	        _this2._moveSelector(event);
	      });
	    }
	    /**
	     * generate the hue circle. This is relatively heavy (200ms) and is done only once on the first time it is shown.
	     * @private
	     */

	  }, {
	    key: "_generateHueCircle",
	    value: function _generateHueCircle() {
	      if (this.generated === false) {
	        var ctx = this.colorPickerCanvas.getContext('2d');

	        if (this.pixelRation === undefined) {
	          this.pixelRatio = (window.devicePixelRatio || 1) / (ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1);
	        }

	        ctx.setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0); // clear the canvas

	        var w = this.colorPickerCanvas.clientWidth;
	        var h = this.colorPickerCanvas.clientHeight;
	        ctx.clearRect(0, 0, w, h); // draw hue circle

	        var x, y, hue, sat;
	        this.centerCoordinates = {
	          x: w * 0.5,
	          y: h * 0.5
	        };
	        this.r = 0.49 * w;
	        var angleConvert = 2 * Math.PI / 360;
	        var hfac = 1 / 360;
	        var sfac = 1 / this.r;
	        var rgb;

	        for (hue = 0; hue < 360; hue++) {
	          for (sat = 0; sat < this.r; sat++) {
	            x = this.centerCoordinates.x + sat * Math.sin(angleConvert * hue);
	            y = this.centerCoordinates.y + sat * Math.cos(angleConvert * hue);
	            rgb = HSVToRGB(hue * hfac, sat * sfac, 1);
	            ctx.fillStyle = 'rgb(' + rgb.r + ',' + rgb.g + ',' + rgb.b + ')';
	            ctx.fillRect(x - 0.5, y - 0.5, 2, 2);
	          }
	        }

	        ctx.strokeStyle = 'rgba(0,0,0,1)';
	        ctx.circle(this.centerCoordinates.x, this.centerCoordinates.y, this.r);
	        ctx.stroke();
	        this.hueCircle = ctx.getImageData(0, 0, w, h);
	      }

	      this.generated = true;
	    }
	    /**
	     * move the selector. This is called by hammer functions.
	     *
	     * @param {Event}  event   The event
	     * @private
	     */

	  }, {
	    key: "_moveSelector",
	    value: function _moveSelector(event) {
	      var rect = this.colorPickerDiv.getBoundingClientRect();
	      var left = event.center.x - rect.left;
	      var top = event.center.y - rect.top;
	      var centerY = 0.5 * this.colorPickerDiv.clientHeight;
	      var centerX = 0.5 * this.colorPickerDiv.clientWidth;
	      var x = left - centerX;
	      var y = top - centerY;
	      var angle = Math.atan2(x, y);
	      var radius = 0.98 * Math.min(Math.sqrt(x * x + y * y), centerX);
	      var newTop = Math.cos(angle) * radius + centerY;
	      var newLeft = Math.sin(angle) * radius + centerX;
	      this.colorPickerSelector.style.top = newTop - 0.5 * this.colorPickerSelector.clientHeight + 'px';
	      this.colorPickerSelector.style.left = newLeft - 0.5 * this.colorPickerSelector.clientWidth + 'px'; // set color

	      var h = angle / (2 * Math.PI);
	      h = h < 0 ? h + 1 : h;
	      var s = radius / this.r;
	      var hsv = RGBToHSV(this.color.r, this.color.g, this.color.b);
	      hsv.h = h;
	      hsv.s = s;
	      var rgba = HSVToRGB(hsv.h, hsv.s, hsv.v);
	      rgba['a'] = this.color.a;
	      this.color = rgba; // update previews

	      this.initialColorDiv.style.backgroundColor = 'rgba(' + this.initialColor.r + ',' + this.initialColor.g + ',' + this.initialColor.b + ',' + this.initialColor.a + ')';
	      this.newColorDiv.style.backgroundColor = 'rgba(' + this.color.r + ',' + this.color.g + ',' + this.color.b + ',' + this.color.a + ')';
	    }
	  }]);

	  return ColorPicker;
	}();

	/**
	 * The way this works is for all properties of this.possible options, you can supply the property name in any form to list the options.
	 * Boolean options are recognised as Boolean
	 * Number options should be written as array: [default value, min value, max value, stepsize]
	 * Colors should be written as array: ['color', '#ffffff']
	 * Strings with should be written as array: [option1, option2, option3, ..]
	 *
	 * The options are matched with their counterparts in each of the modules and the values used in the configuration are
	 */

	var Configurator =
	/*#__PURE__*/
	function () {
	  /**
	   * @param {Object} parentModule        | the location where parentModule.setOptions() can be called
	   * @param {Object} defaultContainer    | the default container of the module
	   * @param {Object} configureOptions    | the fully configured and predefined options set found in allOptions.js
	   * @param {number} pixelRatio          | canvas pixel ratio
	   */
	  function Configurator(parentModule, defaultContainer, configureOptions) {
	    var pixelRatio = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;

	    classCallCheck(this, Configurator);

	    this.parent = parentModule;
	    this.changedOptions = [];
	    this.container = defaultContainer;
	    this.allowCreation = false;
	    this.options = {};
	    this.initialized = false;
	    this.popupCounter = 0;
	    this.defaultOptions = {
	      enabled: false,
	      filter: true,
	      container: undefined,
	      showButton: true
	    };
	    extend(this.options, this.defaultOptions);
	    this.configureOptions = configureOptions;
	    this.moduleOptions = {};
	    this.domElements = [];
	    this.popupDiv = {};
	    this.popupLimit = 5;
	    this.popupHistory = {};
	    this.colorPicker = new ColorPicker(pixelRatio);
	    this.wrapper = undefined;
	  }
	  /**
	   * refresh all options.
	   * Because all modules parse their options by themselves, we just use their options. We copy them here.
	   *
	   * @param {Object} options
	   */


	  createClass(Configurator, [{
	    key: "setOptions",
	    value: function setOptions(options) {
	      if (options !== undefined) {
	        // reset the popup history because the indices may have been changed.
	        this.popupHistory = {};

	        this._removePopup();

	        var enabled = true;

	        if (typeof options === 'string') {
	          this.options.filter = options;
	        } else if (options instanceof Array) {
	          this.options.filter = options.join();
	        } else if (_typeof_1(options) === 'object') {
	          if (options == null) {
	            throw new TypeError('options cannot be null');
	          }

	          if (options.container !== undefined) {
	            this.options.container = options.container;
	          }

	          if (filter$2(options) !== undefined) {
	            this.options.filter = filter$2(options);
	          }

	          if (options.showButton !== undefined) {
	            this.options.showButton = options.showButton;
	          }

	          if (options.enabled !== undefined) {
	            enabled = options.enabled;
	          }
	        } else if (typeof options === 'boolean') {
	          this.options.filter = true;
	          enabled = options;
	        } else if (typeof options === 'function') {
	          this.options.filter = options;
	          enabled = true;
	        }

	        if (filter$2(this.options) === false) {
	          enabled = false;
	        }

	        this.options.enabled = enabled;
	      }

	      this._clean();
	    }
	    /**
	     *
	     * @param {Object} moduleOptions
	     */

	  }, {
	    key: "setModuleOptions",
	    value: function setModuleOptions(moduleOptions) {
	      this.moduleOptions = moduleOptions;

	      if (this.options.enabled === true) {
	        this._clean();

	        if (this.options.container !== undefined) {
	          this.container = this.options.container;
	        }

	        this._create();
	      }
	    }
	    /**
	     * Create all DOM elements
	     * @private
	     */

	  }, {
	    key: "_create",
	    value: function _create() {
	      this._clean();

	      this.changedOptions = [];

	      var filter = filter$2(this.options);

	      var counter = 0;
	      var show = false;

	      for (var option in this.configureOptions) {
	        if (this.configureOptions.hasOwnProperty(option)) {
	          this.allowCreation = false;
	          show = false;

	          if (typeof filter === 'function') {
	            show = filter(option, []);
	            show = show || this._handleObject(this.configureOptions[option], [option], true);
	          } else if (filter === true || indexOf$3(filter).call(filter, option) !== -1) {
	            show = true;
	          }

	          if (show !== false) {
	            this.allowCreation = true; // linebreak between categories

	            if (counter > 0) {
	              this._makeItem([]);
	            } // a header for the category


	            this._makeHeader(option); // get the sub options


	            this._handleObject(this.configureOptions[option], [option]);
	          }

	          counter++;
	        }
	      }

	      this._makeButton();

	      this._push(); //~ this.colorPicker.insertTo(this.container);

	    }
	    /**
	     * draw all DOM elements on the screen
	     * @private
	     */

	  }, {
	    key: "_push",
	    value: function _push() {
	      this.wrapper = document.createElement('div');
	      this.wrapper.className = 'vis-configuration-wrapper';
	      this.container.appendChild(this.wrapper);

	      for (var i = 0; i < this.domElements.length; i++) {
	        this.wrapper.appendChild(this.domElements[i]);
	      }

	      this._showPopupIfNeeded();
	    }
	    /**
	     * delete all DOM elements
	     * @private
	     */

	  }, {
	    key: "_clean",
	    value: function _clean() {
	      for (var i = 0; i < this.domElements.length; i++) {
	        this.wrapper.removeChild(this.domElements[i]);
	      }

	      if (this.wrapper !== undefined) {
	        this.container.removeChild(this.wrapper);
	        this.wrapper = undefined;
	      }

	      this.domElements = [];

	      this._removePopup();
	    }
	    /**
	     * get the value from the actualOptions if it exists
	     * @param {array} path    | where to look for the actual option
	     * @returns {*}
	     * @private
	     */

	  }, {
	    key: "_getValue",
	    value: function _getValue(path) {
	      var base = this.moduleOptions;

	      for (var i = 0; i < path.length; i++) {
	        if (base[path[i]] !== undefined) {
	          base = base[path[i]];
	        } else {
	          base = undefined;
	          break;
	        }
	      }

	      return base;
	    }
	    /**
	     * all option elements are wrapped in an item
	     * @param {Array} path    | where to look for the actual option
	     * @param {Array.<Element>} domElements
	     * @returns {number}
	     * @private
	     */

	  }, {
	    key: "_makeItem",
	    value: function _makeItem(path) {
	      if (this.allowCreation === true) {
	        var item = document.createElement('div');
	        item.className = 'vis-configuration vis-config-item vis-config-s' + path.length;

	        for (var _len = arguments.length, domElements = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
	          domElements[_key - 1] = arguments[_key];
	        }

	        forEach$2(domElements).call(domElements, function (element) {
	          item.appendChild(element);
	        });

	        this.domElements.push(item);
	        return this.domElements.length;
	      }

	      return 0;
	    }
	    /**
	     * header for major subjects
	     * @param {string} name
	     * @private
	     */

	  }, {
	    key: "_makeHeader",
	    value: function _makeHeader(name) {
	      var div = document.createElement('div');
	      div.className = 'vis-configuration vis-config-header';
	      div.innerHTML = name;

	      this._makeItem([], div);
	    }
	    /**
	     * make a label, if it is an object label, it gets different styling.
	     * @param {string} name
	     * @param {array} path    | where to look for the actual option
	     * @param {string} objectLabel
	     * @returns {HTMLElement}
	     * @private
	     */

	  }, {
	    key: "_makeLabel",
	    value: function _makeLabel(name, path) {
	      var objectLabel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
	      var div = document.createElement('div');
	      div.className = 'vis-configuration vis-config-label vis-config-s' + path.length;

	      if (objectLabel === true) {
	        div.innerHTML = '<i><b>' + name + ':</b></i>';
	      } else {
	        div.innerHTML = name + ':';
	      }

	      return div;
	    }
	    /**
	     * make a dropdown list for multiple possible string optoins
	     * @param {Array.<number>} arr
	     * @param {number} value
	     * @param {array} path    | where to look for the actual option
	     * @private
	     */

	  }, {
	    key: "_makeDropdown",
	    value: function _makeDropdown(arr, value, path) {
	      var select = document.createElement('select');
	      select.className = 'vis-configuration vis-config-select';
	      var selectedValue = 0;

	      if (value !== undefined) {
	        if (indexOf$3(arr).call(arr, value) !== -1) {
	          selectedValue = indexOf$3(arr).call(arr, value);
	        }
	      }

	      for (var i = 0; i < arr.length; i++) {
	        var option = document.createElement('option');
	        option.value = arr[i];

	        if (i === selectedValue) {
	          option.selected = 'selected';
	        }

	        option.innerHTML = arr[i];
	        select.appendChild(option);
	      }

	      var me = this;

	      select.onchange = function () {
	        me._update(this.value, path);
	      };

	      var label = this._makeLabel(path[path.length - 1], path);

	      this._makeItem(path, label, select);
	    }
	    /**
	     * make a range object for numeric options
	     * @param {Array.<number>} arr
	     * @param {number} value
	     * @param {array} path    | where to look for the actual option
	     * @private
	     */

	  }, {
	    key: "_makeRange",
	    value: function _makeRange(arr, value, path) {
	      var defaultValue = arr[0];
	      var min = arr[1];
	      var max = arr[2];
	      var step = arr[3];
	      var range = document.createElement('input');
	      range.className = 'vis-configuration vis-config-range';

	      try {
	        range.type = 'range'; // not supported on IE9

	        range.min = min;
	        range.max = max;
	      } // TODO: Add some error handling and remove this lint exception
	      catch (err) {} // eslint-disable-line no-empty


	      range.step = step; // set up the popup settings in case they are needed.

	      var popupString = '';
	      var popupValue = 0;

	      if (value !== undefined) {
	        var factor = 1.20;

	        if (value < 0 && value * factor < min) {
	          range.min = Math.ceil(value * factor);
	          popupValue = range.min;
	          popupString = 'range increased';
	        } else if (value / factor < min) {
	          range.min = Math.ceil(value / factor);
	          popupValue = range.min;
	          popupString = 'range increased';
	        }

	        if (value * factor > max && max !== 1) {
	          range.max = Math.ceil(value * factor);
	          popupValue = range.max;
	          popupString = 'range increased';
	        }

	        range.value = value;
	      } else {
	        range.value = defaultValue;
	      }

	      var input = document.createElement('input');
	      input.className = 'vis-configuration vis-config-rangeinput';
	      input.value = range.value;
	      var me = this;

	      range.onchange = function () {
	        input.value = this.value;

	        me._update(Number(this.value), path);
	      };

	      range.oninput = function () {
	        input.value = this.value;
	      };

	      var label = this._makeLabel(path[path.length - 1], path);

	      var itemIndex = this._makeItem(path, label, range, input); // if a popup is needed AND it has not been shown for this value, show it.


	      if (popupString !== '' && this.popupHistory[itemIndex] !== popupValue) {
	        this.popupHistory[itemIndex] = popupValue;

	        this._setupPopup(popupString, itemIndex);
	      }
	    }
	    /**
	     * make a button object
	     * @private
	     */

	  }, {
	    key: "_makeButton",
	    value: function _makeButton() {
	      var _this = this;

	      if (this.options.showButton === true) {
	        var generateButton = document.createElement('div');
	        generateButton.className = 'vis-configuration vis-config-button';
	        generateButton.innerHTML = 'generate options';

	        generateButton.onclick = function () {
	          _this._printOptions();
	        };

	        generateButton.onmouseover = function () {
	          generateButton.className = 'vis-configuration vis-config-button hover';
	        };

	        generateButton.onmouseout = function () {
	          generateButton.className = 'vis-configuration vis-config-button';
	        };

	        this.optionsContainer = document.createElement('div');
	        this.optionsContainer.className = 'vis-configuration vis-config-option-container';
	        this.domElements.push(this.optionsContainer);
	        this.domElements.push(generateButton);
	      }
	    }
	    /**
	     * prepare the popup
	     * @param {string} string
	     * @param {number} index
	     * @private
	     */

	  }, {
	    key: "_setupPopup",
	    value: function _setupPopup(string, index) {
	      var _this2 = this;

	      if (this.initialized === true && this.allowCreation === true && this.popupCounter < this.popupLimit) {
	        var div = document.createElement("div");
	        div.id = "vis-configuration-popup";
	        div.className = "vis-configuration-popup";
	        div.innerHTML = string;

	        div.onclick = function () {
	          _this2._removePopup();
	        };

	        this.popupCounter += 1;
	        this.popupDiv = {
	          html: div,
	          index: index
	        };
	      }
	    }
	    /**
	     * remove the popup from the dom
	     * @private
	     */

	  }, {
	    key: "_removePopup",
	    value: function _removePopup() {
	      if (this.popupDiv.html !== undefined) {
	        this.popupDiv.html.parentNode.removeChild(this.popupDiv.html);
	        clearTimeout(this.popupDiv.hideTimeout);
	        clearTimeout(this.popupDiv.deleteTimeout);
	        this.popupDiv = {};
	      }
	    }
	    /**
	     * Show the popup if it is needed.
	     * @private
	     */

	  }, {
	    key: "_showPopupIfNeeded",
	    value: function _showPopupIfNeeded() {
	      var _this3 = this;

	      if (this.popupDiv.html !== undefined) {
	        var correspondingElement = this.domElements[this.popupDiv.index];
	        var rect = correspondingElement.getBoundingClientRect();
	        this.popupDiv.html.style.left = rect.left + "px";
	        this.popupDiv.html.style.top = rect.top - 30 + "px"; // 30 is the height;

	        document.body.appendChild(this.popupDiv.html);
	        this.popupDiv.hideTimeout = setTimeout$2(function () {
	          _this3.popupDiv.html.style.opacity = 0;
	        }, 1500);
	        this.popupDiv.deleteTimeout = setTimeout$2(function () {
	          _this3._removePopup();
	        }, 1800);
	      }
	    }
	    /**
	     * make a checkbox for boolean options.
	     * @param {number} defaultValue
	     * @param {number} value
	     * @param {array} path    | where to look for the actual option
	     * @private
	     */

	  }, {
	    key: "_makeCheckbox",
	    value: function _makeCheckbox(defaultValue, value, path) {
	      var checkbox = document.createElement('input');
	      checkbox.type = 'checkbox';
	      checkbox.className = 'vis-configuration vis-config-checkbox';
	      checkbox.checked = defaultValue;

	      if (value !== undefined) {
	        checkbox.checked = value;

	        if (value !== defaultValue) {
	          if (_typeof_1(defaultValue) === 'object') {
	            if (value !== defaultValue.enabled) {
	              this.changedOptions.push({
	                path: path,
	                value: value
	              });
	            }
	          } else {
	            this.changedOptions.push({
	              path: path,
	              value: value
	            });
	          }
	        }
	      }

	      var me = this;

	      checkbox.onchange = function () {
	        me._update(this.checked, path);
	      };

	      var label = this._makeLabel(path[path.length - 1], path);

	      this._makeItem(path, label, checkbox);
	    }
	    /**
	     * make a text input field for string options.
	     * @param {number} defaultValue
	     * @param {number} value
	     * @param {array} path    | where to look for the actual option
	     * @private
	     */

	  }, {
	    key: "_makeTextInput",
	    value: function _makeTextInput(defaultValue, value, path) {
	      var checkbox = document.createElement('input');
	      checkbox.type = 'text';
	      checkbox.className = 'vis-configuration vis-config-text';
	      checkbox.value = value;

	      if (value !== defaultValue) {
	        this.changedOptions.push({
	          path: path,
	          value: value
	        });
	      }

	      var me = this;

	      checkbox.onchange = function () {
	        me._update(this.value, path);
	      };

	      var label = this._makeLabel(path[path.length - 1], path);

	      this._makeItem(path, label, checkbox);
	    }
	    /**
	     * make a color field with a color picker for color fields
	     * @param {Array.<number>} arr
	     * @param {number} value
	     * @param {array} path    | where to look for the actual option
	     * @private
	     */

	  }, {
	    key: "_makeColorField",
	    value: function _makeColorField(arr, value, path) {
	      var _this4 = this;

	      var defaultColor = arr[1];
	      var div = document.createElement('div');
	      value = value === undefined ? defaultColor : value;

	      if (value !== 'none') {
	        div.className = 'vis-configuration vis-config-colorBlock';
	        div.style.backgroundColor = value;
	      } else {
	        div.className = 'vis-configuration vis-config-colorBlock none';
	      }

	      value = value === undefined ? defaultColor : value;

	      div.onclick = function () {
	        _this4._showColorPicker(value, div, path);
	      };

	      var label = this._makeLabel(path[path.length - 1], path);

	      this._makeItem(path, label, div);
	    }
	    /**
	     * used by the color buttons to call the color picker.
	     * @param {number} value
	     * @param {HTMLElement} div
	     * @param {array} path    | where to look for the actual option
	     * @private
	     */

	  }, {
	    key: "_showColorPicker",
	    value: function _showColorPicker(value, div, path) {
	      var _this5 = this;

	      // clear the callback from this div
	      div.onclick = function () {};

	      this.colorPicker.insertTo(div);
	      this.colorPicker.show();
	      this.colorPicker.setColor(value);
	      this.colorPicker.setUpdateCallback(function (color) {
	        var colorString = 'rgba(' + color.r + ',' + color.g + ',' + color.b + ',' + color.a + ')';
	        div.style.backgroundColor = colorString;

	        _this5._update(colorString, path);
	      }); // on close of the colorpicker, restore the callback.

	      this.colorPicker.setCloseCallback(function () {
	        div.onclick = function () {
	          _this5._showColorPicker(value, div, path);
	        };
	      });
	    }
	    /**
	     * parse an object and draw the correct items
	     * @param {Object} obj
	     * @param {array} [path=[]]    | where to look for the actual option
	     * @param {boolean} [checkOnly=false]
	     * @returns {boolean}
	     * @private
	     */

	  }, {
	    key: "_handleObject",
	    value: function _handleObject(obj) {
	      var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
	      var checkOnly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
	      var show = false;

	      var filter = filter$2(this.options);

	      var visibleInSet = false;

	      for (var subObj in obj) {
	        if (obj.hasOwnProperty(subObj)) {
	          show = true;
	          var item = obj[subObj];
	          var newPath = copyAndExtendArray(path, subObj);

	          if (typeof filter === 'function') {
	            show = filter(subObj, path); // if needed we must go deeper into the object.

	            if (show === false) {
	              if (!(item instanceof Array) && typeof item !== 'string' && typeof item !== 'boolean' && item instanceof Object) {
	                this.allowCreation = false;
	                show = this._handleObject(item, newPath, true);
	                this.allowCreation = checkOnly === false;
	              }
	            }
	          }

	          if (show !== false) {
	            visibleInSet = true;

	            var value = this._getValue(newPath);

	            if (item instanceof Array) {
	              this._handleArray(item, value, newPath);
	            } else if (typeof item === 'string') {
	              this._makeTextInput(item, value, newPath);
	            } else if (typeof item === 'boolean') {
	              this._makeCheckbox(item, value, newPath);
	            } else if (item instanceof Object) {
	              // collapse the physics options that are not enabled
	              var draw = true;

	              if (indexOf$3(path).call(path, 'physics') !== -1) {
	                if (this.moduleOptions.physics.solver !== subObj) {
	                  draw = false;
	                }
	              }

	              if (draw === true) {
	                // initially collapse options with an disabled enabled option.
	                if (item.enabled !== undefined) {
	                  var enabledPath = copyAndExtendArray(newPath, 'enabled');

	                  var enabledValue = this._getValue(enabledPath);

	                  if (enabledValue === true) {
	                    var label = this._makeLabel(subObj, newPath, true);

	                    this._makeItem(newPath, label);

	                    visibleInSet = this._handleObject(item, newPath) || visibleInSet;
	                  } else {
	                    this._makeCheckbox(item, enabledValue, newPath);
	                  }
	                } else {
	                  var _label = this._makeLabel(subObj, newPath, true);

	                  this._makeItem(newPath, _label);

	                  visibleInSet = this._handleObject(item, newPath) || visibleInSet;
	                }
	              }
	            } else {
	              console.error('dont know how to handle', item, subObj, newPath);
	            }
	          }
	        }
	      }

	      return visibleInSet;
	    }
	    /**
	     * handle the array type of option
	     * @param {Array.<number>} arr
	     * @param {number} value
	     * @param {array} path    | where to look for the actual option
	     * @private
	     */

	  }, {
	    key: "_handleArray",
	    value: function _handleArray(arr, value, path) {
	      if (typeof arr[0] === 'string' && arr[0] === 'color') {
	        this._makeColorField(arr, value, path);

	        if (arr[1] !== value) {
	          this.changedOptions.push({
	            path: path,
	            value: value
	          });
	        }
	      } else if (typeof arr[0] === 'string') {
	        this._makeDropdown(arr, value, path);

	        if (arr[0] !== value) {
	          this.changedOptions.push({
	            path: path,
	            value: value
	          });
	        }
	      } else if (typeof arr[0] === 'number') {
	        this._makeRange(arr, value, path);

	        if (arr[0] !== value) {
	          this.changedOptions.push({
	            path: path,
	            value: Number(value)
	          });
	        }
	      }
	    }
	    /**
	     * called to update the network with the new settings.
	     * @param {number} value
	     * @param {array} path    | where to look for the actual option
	     * @private
	     */

	  }, {
	    key: "_update",
	    value: function _update(value, path) {
	      var options = this._constructOptions(value, path);

	      if (this.parent.body && this.parent.body.emitter && this.parent.body.emitter.emit) {
	        this.parent.body.emitter.emit("configChange", options);
	      }

	      this.initialized = true;
	      this.parent.setOptions(options);
	    }
	    /**
	     *
	     * @param {string|Boolean} value
	     * @param {Array.<string>} path
	     * @param {{}} optionsObj
	     * @returns {{}}
	     * @private
	     */

	  }, {
	    key: "_constructOptions",
	    value: function _constructOptions(value, path) {
	      var optionsObj = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
	      var pointer = optionsObj; // when dropdown boxes can be string or boolean, we typecast it into correct types

	      value = value === 'true' ? true : value;
	      value = value === 'false' ? false : value;

	      for (var i = 0; i < path.length; i++) {
	        if (path[i] !== 'global') {
	          if (pointer[path[i]] === undefined) {
	            pointer[path[i]] = {};
	          }

	          if (i !== path.length - 1) {
	            pointer = pointer[path[i]];
	          } else {
	            pointer[path[i]] = value;
	          }
	        }
	      }

	      return optionsObj;
	    }
	    /**
	     * @private
	     */

	  }, {
	    key: "_printOptions",
	    value: function _printOptions() {
	      var options = this.getOptions();
	      this.optionsContainer.innerHTML = '<pre>var options = ' + stringify$2(options, null, 2) + '</pre>';
	    }
	    /**
	     *
	     * @returns {{}} options
	     */

	  }, {
	    key: "getOptions",
	    value: function getOptions() {
	      var options = {};

	      for (var i = 0; i < this.changedOptions.length; i++) {
	        this._constructOptions(this.changedOptions[i].value, this.changedOptions[i].path, options);
	      }

	      return options;
	    }
	  }]);

	  return Configurator;
	}();

	/**
	 * This object contains all possible options. It will check if the types are correct, if required if the option is one
	 * of the allowed values.
	 *
	 * __any__ means that the name of the property does not matter.
	 * __type__ is a required field for all objects and contains the allowed types of all objects
	 */
	var string = 'string';
	var bool = 'boolean';
	var number = 'number';
	var array = 'array';
	var object = 'object'; // should only be in a __type__ property

	var dom = 'dom';
	var any = 'any'; // List of endpoints

	var endPoints = ["arrow", "bar", "box", "circle", "crow", "curve", "diamond", "image", "inv_curve", "inv_triangle", "triangle", "vee"];
	var allOptions$1 = {
	  configure: {
	    enabled: {
	      boolean: bool
	    },
	    filter: {
	      boolean: bool,
	      string: string,
	      array: array,
	      'function': 'function'
	    },
	    container: {
	      dom: dom
	    },
	    showButton: {
	      boolean: bool
	    },
	    __type__: {
	      object: object,
	      boolean: bool,
	      string: string,
	      array: array,
	      'function': 'function'
	    }
	  },
	  edges: {
	    arrows: {
	      to: {
	        enabled: {
	          boolean: bool
	        },
	        scaleFactor: {
	          number: number
	        },
	        type: {
	          string: endPoints
	        },
	        imageHeight: {
	          number: number
	        },
	        imageWidth: {
	          number: number
	        },
	        src: {
	          string: string
	        },
	        __type__: {
	          object: object,
	          boolean: bool
	        }
	      },
	      middle: {
	        enabled: {
	          boolean: bool
	        },
	        scaleFactor: {
	          number: number
	        },
	        type: {
	          string: endPoints
	        },
	        imageWidth: {
	          number: number
	        },
	        imageHeight: {
	          number: number
	        },
	        src: {
	          string: string
	        },
	        __type__: {
	          object: object,
	          boolean: bool
	        }
	      },
	      from: {
	        enabled: {
	          boolean: bool
	        },
	        scaleFactor: {
	          number: number
	        },
	        type: {
	          string: endPoints
	        },
	        imageWidth: {
	          number: number
	        },
	        imageHeight: {
	          number: number
	        },
	        src: {
	          string: string
	        },
	        __type__: {
	          object: object,
	          boolean: bool
	        }
	      },
	      __type__: {
	        string: ["from", "to", "middle"],
	        object: object
	      }
	    },
	    arrowStrikethrough: {
	      boolean: bool
	    },
	    background: {
	      enabled: {
	        boolean: bool
	      },
	      color: {
	        string: string
	      },
	      size: {
	        number: number
	      },
	      dashes: {
	        boolean: bool,
	        array: array
	      },
	      __type__: {
	        object: object,
	        boolean: bool
	      }
	    },
	    chosen: {
	      label: {
	        boolean: bool,
	        'function': 'function'
	      },
	      edge: {
	        boolean: bool,
	        'function': 'function'
	      },
	      __type__: {
	        object: object,
	        boolean: bool
	      }
	    },
	    color: {
	      color: {
	        string: string
	      },
	      highlight: {
	        string: string
	      },
	      hover: {
	        string: string
	      },
	      inherit: {
	        string: ['from', 'to', 'both'],
	        boolean: bool
	      },
	      opacity: {
	        number: number
	      },
	      __type__: {
	        object: object,
	        string: string
	      }
	    },
	    dashes: {
	      boolean: bool,
	      array: array
	    },
	    font: {
	      color: {
	        string: string
	      },
	      size: {
	        number: number
	      },
	      // px
	      face: {
	        string: string
	      },
	      background: {
	        string: string
	      },
	      strokeWidth: {
	        number: number
	      },
	      // px
	      strokeColor: {
	        string: string
	      },
	      align: {
	        string: ['horizontal', 'top', 'middle', 'bottom']
	      },
	      vadjust: {
	        number: number
	      },
	      multi: {
	        boolean: bool,
	        string: string
	      },
	      bold: {
	        color: {
	          string: string
	        },
	        size: {
	          number: number
	        },
	        // px
	        face: {
	          string: string
	        },
	        mod: {
	          string: string
	        },
	        vadjust: {
	          number: number
	        },
	        __type__: {
	          object: object,
	          string: string
	        }
	      },
	      boldital: {
	        color: {
	          string: string
	        },
	        size: {
	          number: number
	        },
	        // px
	        face: {
	          string: string
	        },
	        mod: {
	          string: string
	        },
	        vadjust: {
	          number: number
	        },
	        __type__: {
	          object: object,
	          string: string
	        }
	      },
	      ital: {
	        color: {
	          string: string
	        },
	        size: {
	          number: number
	        },
	        // px
	        face: {
	          string: string
	        },
	        mod: {
	          string: string
	        },
	        vadjust: {
	          number: number
	        },
	        __type__: {
	          object: object,
	          string: string
	        }
	      },
	      mono: {
	        color: {
	          string: string
	        },
	        size: {
	          number: number
	        },
	        // px
	        face: {
	          string: string
	        },
	        mod: {
	          string: string
	        },
	        vadjust: {
	          number: number
	        },
	        __type__: {
	          object: object,
	          string: string
	        }
	      },
	      __type__: {
	        object: object,
	        string: string
	      }
	    },
	    hidden: {
	      boolean: bool
	    },
	    hoverWidth: {
	      'function': 'function',
	      number: number
	    },
	    label: {
	      string: string,
	      'undefined': 'undefined'
	    },
	    labelHighlightBold: {
	      boolean: bool
	    },
	    length: {
	      number: number,
	      'undefined': 'undefined'
	    },
	    physics: {
	      boolean: bool
	    },
	    scaling: {
	      min: {
	        number: number
	      },
	      max: {
	        number: number
	      },
	      label: {
	        enabled: {
	          boolean: bool
	        },
	        min: {
	          number: number
	        },
	        max: {
	          number: number
	        },
	        maxVisible: {
	          number: number
	        },
	        drawThreshold: {
	          number: number
	        },
	        __type__: {
	          object: object,
	          boolean: bool
	        }
	      },
	      customScalingFunction: {
	        'function': 'function'
	      },
	      __type__: {
	        object: object
	      }
	    },
	    selectionWidth: {
	      'function': 'function',
	      number: number
	    },
	    selfReferenceSize: {
	      number: number
	    },
	    shadow: {
	      enabled: {
	        boolean: bool
	      },
	      color: {
	        string: string
	      },
	      size: {
	        number: number
	      },
	      x: {
	        number: number
	      },
	      y: {
	        number: number
	      },
	      __type__: {
	        object: object,
	        boolean: bool
	      }
	    },
	    smooth: {
	      enabled: {
	        boolean: bool
	      },
	      type: {
	        string: ['dynamic', 'continuous', 'discrete', 'diagonalCross', 'straightCross', 'horizontal', 'vertical', 'curvedCW', 'curvedCCW', 'cubicBezier']
	      },
	      roundness: {
	        number: number
	      },
	      forceDirection: {
	        string: ['horizontal', 'vertical', 'none'],
	        boolean: bool
	      },
	      __type__: {
	        object: object,
	        boolean: bool
	      }
	    },
	    title: {
	      string: string,
	      'undefined': 'undefined'
	    },
	    width: {
	      number: number
	    },
	    widthConstraint: {
	      maximum: {
	        number: number
	      },
	      __type__: {
	        object: object,
	        boolean: bool,
	        number: number
	      }
	    },
	    value: {
	      number: number,
	      'undefined': 'undefined'
	    },
	    __type__: {
	      object: object
	    }
	  },
	  groups: {
	    useDefaultGroups: {
	      boolean: bool
	    },
	    __any__: 'get from nodes, will be overwritten below',
	    __type__: {
	      object: object
	    }
	  },
	  interaction: {
	    dragNodes: {
	      boolean: bool
	    },
	    dragView: {
	      boolean: bool
	    },
	    hideEdgesOnDrag: {
	      boolean: bool
	    },
	    hideEdgesOnZoom: {
	      boolean: bool
	    },
	    hideNodesOnDrag: {
	      boolean: bool
	    },
	    hover: {
	      boolean: bool
	    },
	    keyboard: {
	      enabled: {
	        boolean: bool
	      },
	      speed: {
	        x: {
	          number: number
	        },
	        y: {
	          number: number
	        },
	        zoom: {
	          number: number
	        },
	        __type__: {
	          object: object
	        }
	      },
	      bindToWindow: {
	        boolean: bool
	      },
	      __type__: {
	        object: object,
	        boolean: bool
	      }
	    },
	    multiselect: {
	      boolean: bool
	    },
	    navigationButtons: {
	      boolean: bool
	    },
	    selectable: {
	      boolean: bool
	    },
	    selectConnectedEdges: {
	      boolean: bool
	    },
	    hoverConnectedEdges: {
	      boolean: bool
	    },
	    tooltipDelay: {
	      number: number
	    },
	    zoomView: {
	      boolean: bool
	    },
	    zoomSpeed: {
	      number: number
	    },
	    __type__: {
	      object: object
	    }
	  },
	  layout: {
	    randomSeed: {
	      'undefined': 'undefined',
	      number: number
	    },
	    improvedLayout: {
	      boolean: bool
	    },
	    clusterThreshold: {
	      number: number
	    },
	    hierarchical: {
	      enabled: {
	        boolean: bool
	      },
	      levelSeparation: {
	        number: number
	      },
	      nodeSpacing: {
	        number: number
	      },
	      treeSpacing: {
	        number: number
	      },
	      blockShifting: {
	        boolean: bool
	      },
	      edgeMinimization: {
	        boolean: bool
	      },
	      parentCentralization: {
	        boolean: bool
	      },
	      direction: {
	        string: ['UD', 'DU', 'LR', 'RL']
	      },
	      // UD, DU, LR, RL
	      sortMethod: {
	        string: ['hubsize', 'directed']
	      },
	      // hubsize, directed
	      shakeTowards: {
	        string: ['leaves', 'roots']
	      },
	      // leaves, roots
	      __type__: {
	        object: object,
	        boolean: bool
	      }
	    },
	    __type__: {
	      object: object
	    }
	  },
	  manipulation: {
	    enabled: {
	      boolean: bool
	    },
	    initiallyActive: {
	      boolean: bool
	    },
	    addNode: {
	      boolean: bool,
	      'function': 'function'
	    },
	    addEdge: {
	      boolean: bool,
	      'function': 'function'
	    },
	    editNode: {
	      'function': 'function'
	    },
	    editEdge: {
	      editWithoutDrag: {
	        'function': 'function'
	      },
	      __type__: {
	        object: object,
	        boolean: bool,
	        'function': 'function'
	      }
	    },
	    deleteNode: {
	      boolean: bool,
	      'function': 'function'
	    },
	    deleteEdge: {
	      boolean: bool,
	      'function': 'function'
	    },
	    controlNodeStyle: 'get from nodes, will be overwritten below',
	    __type__: {
	      object: object,
	      boolean: bool
	    }
	  },
	  nodes: {
	    borderWidth: {
	      number: number
	    },
	    borderWidthSelected: {
	      number: number,
	      'undefined': 'undefined'
	    },
	    brokenImage: {
	      string: string,
	      'undefined': 'undefined'
	    },
	    chosen: {
	      label: {
	        boolean: bool,
	        'function': 'function'
	      },
	      node: {
	        boolean: bool,
	        'function': 'function'
	      },
	      __type__: {
	        object: object,
	        boolean: bool
	      }
	    },
	    color: {
	      border: {
	        string: string
	      },
	      background: {
	        string: string
	      },
	      highlight: {
	        border: {
	          string: string
	        },
	        background: {
	          string: string
	        },
	        __type__: {
	          object: object,
	          string: string
	        }
	      },
	      hover: {
	        border: {
	          string: string
	        },
	        background: {
	          string: string
	        },
	        __type__: {
	          object: object,
	          string: string
	        }
	      },
	      __type__: {
	        object: object,
	        string: string
	      }
	    },
	    fixed: {
	      x: {
	        boolean: bool
	      },
	      y: {
	        boolean: bool
	      },
	      __type__: {
	        object: object,
	        boolean: bool
	      }
	    },
	    font: {
	      align: {
	        string: string
	      },
	      color: {
	        string: string
	      },
	      size: {
	        number: number
	      },
	      // px
	      face: {
	        string: string
	      },
	      background: {
	        string: string
	      },
	      strokeWidth: {
	        number: number
	      },
	      // px
	      strokeColor: {
	        string: string
	      },
	      vadjust: {
	        number: number
	      },
	      multi: {
	        boolean: bool,
	        string: string
	      },
	      bold: {
	        color: {
	          string: string
	        },
	        size: {
	          number: number
	        },
	        // px
	        face: {
	          string: string
	        },
	        mod: {
	          string: string
	        },
	        vadjust: {
	          number: number
	        },
	        __type__: {
	          object: object,
	          string: string
	        }
	      },
	      boldital: {
	        color: {
	          string: string
	        },
	        size: {
	          number: number
	        },
	        // px
	        face: {
	          string: string
	        },
	        mod: {
	          string: string
	        },
	        vadjust: {
	          number: number
	        },
	        __type__: {
	          object: object,
	          string: string
	        }
	      },
	      ital: {
	        color: {
	          string: string
	        },
	        size: {
	          number: number
	        },
	        // px
	        face: {
	          string: string
	        },
	        mod: {
	          string: string
	        },
	        vadjust: {
	          number: number
	        },
	        __type__: {
	          object: object,
	          string: string
	        }
	      },
	      mono: {
	        color: {
	          string: string
	        },
	        size: {
	          number: number
	        },
	        // px
	        face: {
	          string: string
	        },
	        mod: {
	          string: string
	        },
	        vadjust: {
	          number: number
	        },
	        __type__: {
	          object: object,
	          string: string
	        }
	      },
	      __type__: {
	        object: object,
	        string: string
	      }
	    },
	    group: {
	      string: string,
	      number: number,
	      'undefined': 'undefined'
	    },
	    heightConstraint: {
	      minimum: {
	        number: number
	      },
	      valign: {
	        string: string
	      },
	      __type__: {
	        object: object,
	        boolean: bool,
	        number: number
	      }
	    },
	    hidden: {
	      boolean: bool
	    },
	    icon: {
	      face: {
	        string: string
	      },
	      code: {
	        string: string
	      },
	      //'\uf007',
	      size: {
	        number: number
	      },
	      //50,
	      color: {
	        string: string
	      },
	      weight: {
	        string: string,
	        number: number
	      },
	      __type__: {
	        object: object
	      }
	    },
	    id: {
	      string: string,
	      number: number
	    },
	    image: {
	      selected: {
	        string: string,
	        'undefined': 'undefined'
	      },
	      // --> URL
	      unselected: {
	        string: string,
	        'undefined': 'undefined'
	      },
	      // --> URL
	      __type__: {
	        object: object,
	        string: string
	      }
	    },
	    imagePadding: {
	      top: {
	        number: number
	      },
	      right: {
	        number: number
	      },
	      bottom: {
	        number: number
	      },
	      left: {
	        number: number
	      },
	      __type__: {
	        object: object,
	        number: number
	      }
	    },
	    label: {
	      string: string,
	      'undefined': 'undefined'
	    },
	    labelHighlightBold: {
	      boolean: bool
	    },
	    level: {
	      number: number,
	      'undefined': 'undefined'
	    },
	    margin: {
	      top: {
	        number: number
	      },
	      right: {
	        number: number
	      },
	      bottom: {
	        number: number
	      },
	      left: {
	        number: number
	      },
	      __type__: {
	        object: object,
	        number: number
	      }
	    },
	    mass: {
	      number: number
	    },
	    physics: {
	      boolean: bool
	    },
	    scaling: {
	      min: {
	        number: number
	      },
	      max: {
	        number: number
	      },
	      label: {
	        enabled: {
	          boolean: bool
	        },
	        min: {
	          number: number
	        },
	        max: {
	          number: number
	        },
	        maxVisible: {
	          number: number
	        },
	        drawThreshold: {
	          number: number
	        },
	        __type__: {
	          object: object,
	          boolean: bool
	        }
	      },
	      customScalingFunction: {
	        'function': 'function'
	      },
	      __type__: {
	        object: object
	      }
	    },
	    shadow: {
	      enabled: {
	        boolean: bool
	      },
	      color: {
	        string: string
	      },
	      size: {
	        number: number
	      },
	      x: {
	        number: number
	      },
	      y: {
	        number: number
	      },
	      __type__: {
	        object: object,
	        boolean: bool
	      }
	    },
	    shape: {
	      string: ['ellipse', 'circle', 'database', 'box', 'text', 'image', 'circularImage', 'diamond', 'dot', 'star', 'triangle', 'triangleDown', 'square', 'icon', 'hexagon']
	    },
	    shapeProperties: {
	      borderDashes: {
	        boolean: bool,
	        array: array
	      },
	      borderRadius: {
	        number: number
	      },
	      interpolation: {
	        boolean: bool
	      },
	      useImageSize: {
	        boolean: bool
	      },
	      useBorderWithImage: {
	        boolean: bool
	      },
	      __type__: {
	        object: object
	      }
	    },
	    size: {
	      number: number
	    },
	    title: {
	      string: string,
	      dom: dom,
	      'undefined': 'undefined'
	    },
	    value: {
	      number: number,
	      'undefined': 'undefined'
	    },
	    widthConstraint: {
	      minimum: {
	        number: number
	      },
	      maximum: {
	        number: number
	      },
	      __type__: {
	        object: object,
	        boolean: bool,
	        number: number
	      }
	    },
	    x: {
	      number: number
	    },
	    y: {
	      number: number
	    },
	    __type__: {
	      object: object
	    }
	  },
	  physics: {
	    enabled: {
	      boolean: bool
	    },
	    barnesHut: {
	      gravitationalConstant: {
	        number: number
	      },
	      centralGravity: {
	        number: number
	      },
	      springLength: {
	        number: number
	      },
	      springConstant: {
	        number: number
	      },
	      damping: {
	        number: number
	      },
	      avoidOverlap: {
	        number: number
	      },
	      __type__: {
	        object: object
	      }
	    },
	    forceAtlas2Based: {
	      gravitationalConstant: {
	        number: number
	      },
	      centralGravity: {
	        number: number
	      },
	      springLength: {
	        number: number
	      },
	      springConstant: {
	        number: number
	      },
	      damping: {
	        number: number
	      },
	      avoidOverlap: {
	        number: number
	      },
	      __type__: {
	        object: object
	      }
	    },
	    repulsion: {
	      centralGravity: {
	        number: number
	      },
	      springLength: {
	        number: number
	      },
	      springConstant: {
	        number: number
	      },
	      nodeDistance: {
	        number: number
	      },
	      damping: {
	        number: number
	      },
	      __type__: {
	        object: object
	      }
	    },
	    hierarchicalRepulsion: {
	      centralGravity: {
	        number: number
	      },
	      springLength: {
	        number: number
	      },
	      springConstant: {
	        number: number
	      },
	      nodeDistance: {
	        number: number
	      },
	      damping: {
	        number: number
	      },
	      avoidOverlap: {
	        number: number
	      },
	      __type__: {
	        object: object
	      }
	    },
	    maxVelocity: {
	      number: number
	    },
	    minVelocity: {
	      number: number
	    },
	    // px/s
	    solver: {
	      string: ['barnesHut', 'repulsion', 'hierarchicalRepulsion', 'forceAtlas2Based']
	    },
	    stabilization: {
	      enabled: {
	        boolean: bool
	      },
	      iterations: {
	        number: number
	      },
	      // maximum number of iteration to stabilize
	      updateInterval: {
	        number: number
	      },
	      onlyDynamicEdges: {
	        boolean: bool
	      },
	      fit: {
	        boolean: bool
	      },
	      __type__: {
	        object: object,
	        boolean: bool
	      }
	    },
	    timestep: {
	      number: number
	    },
	    adaptiveTimestep: {
	      boolean: bool
	    },
	    __type__: {
	      object: object,
	      boolean: bool
	    }
	  },
	  //globals :
	  autoResize: {
	    boolean: bool
	  },
	  clickToUse: {
	    boolean: bool
	  },
	  locale: {
	    string: string
	  },
	  locales: {
	    __any__: {
	      any: any
	    },
	    __type__: {
	      object: object
	    }
	  },
	  height: {
	    string: string
	  },
	  width: {
	    string: string
	  },
	  __type__: {
	    object: object
	  }
	};
	allOptions$1.groups.__any__ = allOptions$1.nodes;
	allOptions$1.manipulation.controlNodeStyle = allOptions$1.nodes;
	var configureOptions = {
	  nodes: {
	    borderWidth: [1, 0, 10, 1],
	    borderWidthSelected: [2, 0, 10, 1],
	    color: {
	      border: ['color', '#2B7CE9'],
	      background: ['color', '#97C2FC'],
	      highlight: {
	        border: ['color', '#2B7CE9'],
	        background: ['color', '#D2E5FF']
	      },
	      hover: {
	        border: ['color', '#2B7CE9'],
	        background: ['color', '#D2E5FF']
	      }
	    },
	    fixed: {
	      x: false,
	      y: false
	    },
	    font: {
	      color: ['color', '#343434'],
	      size: [14, 0, 100, 1],
	      // px
	      face: ['arial', 'verdana', 'tahoma'],
	      background: ['color', 'none'],
	      strokeWidth: [0, 0, 50, 1],
	      // px
	      strokeColor: ['color', '#ffffff']
	    },
	    //group: 'string',
	    hidden: false,
	    labelHighlightBold: true,
	    //icon: {
	    //  face: 'string',  //'FontAwesome',
	    //  code: 'string',  //'\uf007',
	    //  size: [50, 0, 200, 1],  //50,
	    //  color: ['color','#2B7CE9']   //'#aa00ff'
	    //},
	    //image: 'string', // --> URL
	    physics: true,
	    scaling: {
	      min: [10, 0, 200, 1],
	      max: [30, 0, 200, 1],
	      label: {
	        enabled: false,
	        min: [14, 0, 200, 1],
	        max: [30, 0, 200, 1],
	        maxVisible: [30, 0, 200, 1],
	        drawThreshold: [5, 0, 20, 1]
	      }
	    },
	    shadow: {
	      enabled: false,
	      color: 'rgba(0,0,0,0.5)',
	      size: [10, 0, 20, 1],
	      x: [5, -30, 30, 1],
	      y: [5, -30, 30, 1]
	    },
	    shape: ['ellipse', 'box', 'circle', 'database', 'diamond', 'dot', 'square', 'star', 'text', 'triangle', 'triangleDown', 'hexagon'],
	    shapeProperties: {
	      borderDashes: false,
	      borderRadius: [6, 0, 20, 1],
	      interpolation: true,
	      useImageSize: false
	    },
	    size: [25, 0, 200, 1]
	  },
	  edges: {
	    arrows: {
	      to: {
	        enabled: false,
	        scaleFactor: [1, 0, 3, 0.05],
	        type: 'arrow'
	      },
	      middle: {
	        enabled: false,
	        scaleFactor: [1, 0, 3, 0.05],
	        type: 'arrow'
	      },
	      from: {
	        enabled: false,
	        scaleFactor: [1, 0, 3, 0.05],
	        type: 'arrow'
	      }
	    },
	    arrowStrikethrough: true,
	    color: {
	      color: ['color', '#848484'],
	      highlight: ['color', '#848484'],
	      hover: ['color', '#848484'],
	      inherit: ['from', 'to', 'both', true, false],
	      opacity: [1, 0, 1, 0.05]
	    },
	    dashes: false,
	    font: {
	      color: ['color', '#343434'],
	      size: [14, 0, 100, 1],
	      // px
	      face: ['arial', 'verdana', 'tahoma'],
	      background: ['color', 'none'],
	      strokeWidth: [2, 0, 50, 1],
	      // px
	      strokeColor: ['color', '#ffffff'],
	      align: ['horizontal', 'top', 'middle', 'bottom']
	    },
	    hidden: false,
	    hoverWidth: [1.5, 0, 5, 0.1],
	    labelHighlightBold: true,
	    physics: true,
	    scaling: {
	      min: [1, 0, 100, 1],
	      max: [15, 0, 100, 1],
	      label: {
	        enabled: true,
	        min: [14, 0, 200, 1],
	        max: [30, 0, 200, 1],
	        maxVisible: [30, 0, 200, 1],
	        drawThreshold: [5, 0, 20, 1]
	      }
	    },
	    selectionWidth: [1.5, 0, 5, 0.1],
	    selfReferenceSize: [20, 0, 200, 1],
	    shadow: {
	      enabled: false,
	      color: 'rgba(0,0,0,0.5)',
	      size: [10, 0, 20, 1],
	      x: [5, -30, 30, 1],
	      y: [5, -30, 30, 1]
	    },
	    smooth: {
	      enabled: true,
	      type: ['dynamic', 'continuous', 'discrete', 'diagonalCross', 'straightCross', 'horizontal', 'vertical', 'curvedCW', 'curvedCCW', 'cubicBezier'],
	      forceDirection: ['horizontal', 'vertical', 'none'],
	      roundness: [0.5, 0, 1, 0.05]
	    },
	    width: [1, 0, 30, 1]
	  },
	  layout: {
	    //randomSeed: [0, 0, 500, 1],
	    //improvedLayout: true,
	    hierarchical: {
	      enabled: false,
	      levelSeparation: [150, 20, 500, 5],
	      nodeSpacing: [100, 20, 500, 5],
	      treeSpacing: [200, 20, 500, 5],
	      blockShifting: true,
	      edgeMinimization: true,
	      parentCentralization: true,
	      direction: ['UD', 'DU', 'LR', 'RL'],
	      // UD, DU, LR, RL
	      sortMethod: ['hubsize', 'directed'],
	      // hubsize, directed
	      shakeTowards: ['leaves', 'roots'] // leaves, roots

	    }
	  },
	  interaction: {
	    dragNodes: true,
	    dragView: true,
	    hideEdgesOnDrag: false,
	    hideEdgesOnZoom: false,
	    hideNodesOnDrag: false,
	    hover: false,
	    keyboard: {
	      enabled: false,
	      speed: {
	        x: [10, 0, 40, 1],
	        y: [10, 0, 40, 1],
	        zoom: [0.02, 0, 0.1, 0.005]
	      },
	      bindToWindow: true
	    },
	    multiselect: false,
	    navigationButtons: false,
	    selectable: true,
	    selectConnectedEdges: true,
	    hoverConnectedEdges: true,
	    tooltipDelay: [300, 0, 1000, 25],
	    zoomView: true,
	    zoomSpeed: [1, 1, 1, 1]
	  },
	  manipulation: {
	    enabled: false,
	    initiallyActive: false
	  },
	  physics: {
	    enabled: true,
	    barnesHut: {
	      //theta: [0.5, 0.1, 1, 0.05],
	      gravitationalConstant: [-2000, -30000, 0, 50],
	      centralGravity: [0.3, 0, 10, 0.05],
	      springLength: [95, 0, 500, 5],
	      springConstant: [0.04, 0, 1.2, 0.005],
	      damping: [0.09, 0, 1, 0.01],
	      avoidOverlap: [0, 0, 1, 0.01]
	    },
	    forceAtlas2Based: {
	      //theta: [0.5, 0.1, 1, 0.05],
	      gravitationalConstant: [-50, -500, 0, 1],
	      centralGravity: [0.01, 0, 1, 0.005],
	      springLength: [95, 0, 500, 5],
	      springConstant: [0.08, 0, 1.2, 0.005],
	      damping: [0.4, 0, 1, 0.01],
	      avoidOverlap: [0, 0, 1, 0.01]
	    },
	    repulsion: {
	      centralGravity: [0.2, 0, 10, 0.05],
	      springLength: [200, 0, 500, 5],
	      springConstant: [0.05, 0, 1.2, 0.005],
	      nodeDistance: [100, 0, 500, 5],
	      damping: [0.09, 0, 1, 0.01]
	    },
	    hierarchicalRepulsion: {
	      centralGravity: [0.2, 0, 10, 0.05],
	      springLength: [100, 0, 500, 5],
	      springConstant: [0.01, 0, 1.2, 0.005],
	      nodeDistance: [120, 0, 500, 5],
	      damping: [0.09, 0, 1, 0.01],
	      avoidOverlap: [0, 0, 1, 0.01]
	    },
	    maxVelocity: [50, 0, 150, 1],
	    minVelocity: [0.1, 0.01, 0.5, 0.01],
	    solver: ['barnesHut', 'forceAtlas2Based', 'repulsion', 'hierarchicalRepulsion'],
	    timestep: [0.5, 0.01, 1, 0.01] //adaptiveTimestep: true

	  }
	};

	var options = /*#__PURE__*/Object.freeze({
		__proto__: null,
		allOptions: allOptions$1,
		configureOptions: configureOptions
	});

	/**
	 *  The Floyd–Warshall algorithm is an algorithm for finding shortest paths in
	 *  a weighted graph with positive or negative edge weights (but with no negative
	 *  cycles). - https://en.wikipedia.org/wiki/Floyd–Warshall_algorithm
	 */
	var FloydWarshall =
	/*#__PURE__*/
	function () {
	  /**
	   * @ignore
	   */
	  function FloydWarshall() {
	    classCallCheck(this, FloydWarshall);
	  }
	  /**
	   *
	   * @param {Object} body
	   * @param {Array.<Node>} nodesArray
	   * @param {Array.<Edge>} edgesArray
	   * @returns {{}}
	   */


	  createClass(FloydWarshall, [{
	    key: "getDistances",
	    value: function getDistances(body, nodesArray, edgesArray) {
	      var D_matrix = {};
	      var edges = body.edges; // prepare matrix with large numbers

	      for (var i = 0; i < nodesArray.length; i++) {
	        var node = nodesArray[i];
	        var cell = {};
	        D_matrix[node] = cell;

	        for (var j = 0; j < nodesArray.length; j++) {
	          cell[nodesArray[j]] = i == j ? 0 : 1e9;
	        }
	      } // put the weights for the edges in. This assumes unidirectionality.


	      for (var _i = 0; _i < edgesArray.length; _i++) {
	        var edge = edges[edgesArray[_i]]; // edge has to be connected if it counts to the distances. If it is connected to inner clusters it will crash so we also check if it is in the D_matrix

	        if (edge.connected === true && D_matrix[edge.fromId] !== undefined && D_matrix[edge.toId] !== undefined) {
	          D_matrix[edge.fromId][edge.toId] = 1;
	          D_matrix[edge.toId][edge.fromId] = 1;
	        }
	      }

	      var nodeCount = nodesArray.length; // Adapted FloydWarshall based on unidirectionality to greatly reduce complexity.

	      for (var k = 0; k < nodeCount; k++) {
	        var knode = nodesArray[k];
	        var kcolm = D_matrix[knode];

	        for (var _i2 = 0; _i2 < nodeCount - 1; _i2++) {
	          var inode = nodesArray[_i2];
	          var icolm = D_matrix[inode];

	          for (var _j = _i2 + 1; _j < nodeCount; _j++) {
	            var jnode = nodesArray[_j];
	            var jcolm = D_matrix[jnode];
	            var val = Math.min(icolm[jnode], icolm[knode] + kcolm[jnode]);
	            icolm[jnode] = val;
	            jcolm[inode] = val;
	          }
	        }
	      }

	      return D_matrix;
	    }
	  }]);

	  return FloydWarshall;
	}();

	/**
	 * KamadaKawai positions the nodes initially based on
	 *
	 * "AN ALGORITHM FOR DRAWING GENERAL UNDIRECTED GRAPHS"
	 * -- Tomihisa KAMADA and Satoru KAWAI in 1989
	 *
	 * Possible optimizations in the distance calculation can be implemented.
	 */

	var KamadaKawai =
	/*#__PURE__*/
	function () {
	  /**
	   * @param {Object} body
	   * @param {number} edgeLength
	   * @param {number} edgeStrength
	   */
	  function KamadaKawai(body, edgeLength, edgeStrength) {
	    classCallCheck(this, KamadaKawai);

	    this.body = body;
	    this.springLength = edgeLength;
	    this.springConstant = edgeStrength;
	    this.distanceSolver = new FloydWarshall();
	  }
	  /**
	   * Not sure if needed but can be used to update the spring length and spring constant
	   * @param {Object} options
	   */


	  createClass(KamadaKawai, [{
	    key: "setOptions",
	    value: function setOptions(options) {
	      if (options) {
	        if (options.springLength) {
	          this.springLength = options.springLength;
	        }

	        if (options.springConstant) {
	          this.springConstant = options.springConstant;
	        }
	      }
	    }
	    /**
	     * Position the system
	     * @param {Array.<Node>} nodesArray
	     * @param {Array.<vis.Edge>} edgesArray
	     * @param {boolean} [ignoreClusters=false]
	     */

	  }, {
	    key: "solve",
	    value: function solve(nodesArray, edgesArray) {
	      var ignoreClusters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
	      // get distance matrix
	      var D_matrix = this.distanceSolver.getDistances(this.body, nodesArray, edgesArray); // distance matrix
	      // get the L Matrix

	      this._createL_matrix(D_matrix); // get the K Matrix


	      this._createK_matrix(D_matrix); // initial E Matrix


	      this._createE_matrix(); // calculate positions


	      var threshold = 0.01;
	      var innerThreshold = 1;
	      var iterations = 0;
	      var maxIterations = Math.max(1000, Math.min(10 * this.body.nodeIndices.length, 6000));
	      var maxInnerIterations = 5;
	      var maxEnergy = 1e9;
	      var highE_nodeId = 0,
	          dE_dx = 0,
	          dE_dy = 0,
	          delta_m = 0,
	          subIterations = 0;

	      while (maxEnergy > threshold && iterations < maxIterations) {
	        iterations += 1;

	        var _this$_getHighestEner = this._getHighestEnergyNode(ignoreClusters);

	        var _this$_getHighestEner2 = slicedToArray$1(_this$_getHighestEner, 4);

	        highE_nodeId = _this$_getHighestEner2[0];
	        maxEnergy = _this$_getHighestEner2[1];
	        dE_dx = _this$_getHighestEner2[2];
	        dE_dy = _this$_getHighestEner2[3];
	        delta_m = maxEnergy;
	        subIterations = 0;

	        while (delta_m > innerThreshold && subIterations < maxInnerIterations) {
	          subIterations += 1;

	          this._moveNode(highE_nodeId, dE_dx, dE_dy);

	          var _this$_getEnergy = this._getEnergy(highE_nodeId);

	          var _this$_getEnergy2 = slicedToArray$1(_this$_getEnergy, 3);

	          delta_m = _this$_getEnergy2[0];
	          dE_dx = _this$_getEnergy2[1];
	          dE_dy = _this$_getEnergy2[2];
	        }
	      }
	    }
	    /**
	     * get the node with the highest energy
	     * @param {boolean} ignoreClusters
	     * @returns {number[]}
	     * @private
	     */

	  }, {
	    key: "_getHighestEnergyNode",
	    value: function _getHighestEnergyNode(ignoreClusters) {
	      var nodesArray = this.body.nodeIndices;
	      var nodes = this.body.nodes;
	      var maxEnergy = 0;
	      var maxEnergyNodeId = nodesArray[0];
	      var dE_dx_max = 0,
	          dE_dy_max = 0;

	      for (var nodeIdx = 0; nodeIdx < nodesArray.length; nodeIdx++) {
	        var m = nodesArray[nodeIdx]; // by not evaluating nodes with predefined positions we should only move nodes that have no positions.

	        if (nodes[m].predefinedPosition === false || nodes[m].isCluster === true && ignoreClusters === true || nodes[m].options.fixed.x === true || nodes[m].options.fixed.y === true) {
	          var _this$_getEnergy3 = this._getEnergy(m),
	              _this$_getEnergy4 = slicedToArray$1(_this$_getEnergy3, 3),
	              delta_m = _this$_getEnergy4[0],
	              dE_dx = _this$_getEnergy4[1],
	              dE_dy = _this$_getEnergy4[2];

	          if (maxEnergy < delta_m) {
	            maxEnergy = delta_m;
	            maxEnergyNodeId = m;
	            dE_dx_max = dE_dx;
	            dE_dy_max = dE_dy;
	          }
	        }
	      }

	      return [maxEnergyNodeId, maxEnergy, dE_dx_max, dE_dy_max];
	    }
	    /**
	     * calculate the energy of a single node
	     * @param {Node.id} m
	     * @returns {number[]}
	     * @private
	     */

	  }, {
	    key: "_getEnergy",
	    value: function _getEnergy(m) {
	      var _this$E_sums$m = slicedToArray$1(this.E_sums[m], 2),
	          dE_dx = _this$E_sums$m[0],
	          dE_dy = _this$E_sums$m[1];

	      var delta_m = Math.sqrt(Math.pow(dE_dx, 2) + Math.pow(dE_dy, 2));
	      return [delta_m, dE_dx, dE_dy];
	    }
	    /**
	     * move the node based on it's energy
	     * the dx and dy are calculated from the linear system proposed by Kamada and Kawai
	     * @param {number} m
	     * @param {number} dE_dx
	     * @param {number} dE_dy
	     * @private
	     */

	  }, {
	    key: "_moveNode",
	    value: function _moveNode(m, dE_dx, dE_dy) {
	      var nodesArray = this.body.nodeIndices;
	      var nodes = this.body.nodes;
	      var d2E_dx2 = 0;
	      var d2E_dxdy = 0;
	      var d2E_dy2 = 0;
	      var x_m = nodes[m].x;
	      var y_m = nodes[m].y;
	      var km = this.K_matrix[m];
	      var lm = this.L_matrix[m];

	      for (var iIdx = 0; iIdx < nodesArray.length; iIdx++) {
	        var i = nodesArray[iIdx];

	        if (i !== m) {
	          var x_i = nodes[i].x;
	          var y_i = nodes[i].y;
	          var kmat = km[i];
	          var lmat = lm[i];
	          var denominator = 1.0 / Math.pow(Math.pow(x_m - x_i, 2) + Math.pow(y_m - y_i, 2), 1.5);
	          d2E_dx2 += kmat * (1 - lmat * Math.pow(y_m - y_i, 2) * denominator);
	          d2E_dxdy += kmat * (lmat * (x_m - x_i) * (y_m - y_i) * denominator);
	          d2E_dy2 += kmat * (1 - lmat * Math.pow(x_m - x_i, 2) * denominator);
	        }
	      } // make the variable names easier to make the solving of the linear system easier to read


	      var A = d2E_dx2,
	          B = d2E_dxdy,
	          C = dE_dx,
	          D = d2E_dy2,
	          E = dE_dy; // solve the linear system for dx and dy

	      var dy = (C / A + E / B) / (B / A - D / B);
	      var dx = -(B * dy + C) / A; // move the node

	      nodes[m].x += dx;
	      nodes[m].y += dy; // Recalculate E_matrix (should be incremental)

	      this._updateE_matrix(m);
	    }
	    /**
	     * Create the L matrix: edge length times shortest path
	     * @param {Object} D_matrix
	     * @private
	     */

	  }, {
	    key: "_createL_matrix",
	    value: function _createL_matrix(D_matrix) {
	      var nodesArray = this.body.nodeIndices;
	      var edgeLength = this.springLength;
	      this.L_matrix = [];

	      for (var i = 0; i < nodesArray.length; i++) {
	        this.L_matrix[nodesArray[i]] = {};

	        for (var j = 0; j < nodesArray.length; j++) {
	          this.L_matrix[nodesArray[i]][nodesArray[j]] = edgeLength * D_matrix[nodesArray[i]][nodesArray[j]];
	        }
	      }
	    }
	    /**
	     * Create the K matrix: spring constants times shortest path
	     * @param {Object} D_matrix
	     * @private
	     */

	  }, {
	    key: "_createK_matrix",
	    value: function _createK_matrix(D_matrix) {
	      var nodesArray = this.body.nodeIndices;
	      var edgeStrength = this.springConstant;
	      this.K_matrix = [];

	      for (var i = 0; i < nodesArray.length; i++) {
	        this.K_matrix[nodesArray[i]] = {};

	        for (var j = 0; j < nodesArray.length; j++) {
	          this.K_matrix[nodesArray[i]][nodesArray[j]] = edgeStrength * Math.pow(D_matrix[nodesArray[i]][nodesArray[j]], -2);
	        }
	      }
	    }
	    /**
	     *  Create matrix with all energies between nodes
	     *  @private
	     */

	  }, {
	    key: "_createE_matrix",
	    value: function _createE_matrix() {
	      var nodesArray = this.body.nodeIndices;
	      var nodes = this.body.nodes;
	      this.E_matrix = {};
	      this.E_sums = {};

	      for (var mIdx = 0; mIdx < nodesArray.length; mIdx++) {
	        this.E_matrix[nodesArray[mIdx]] = [];
	      }

	      for (var _mIdx = 0; _mIdx < nodesArray.length; _mIdx++) {
	        var m = nodesArray[_mIdx];
	        var x_m = nodes[m].x;
	        var y_m = nodes[m].y;
	        var dE_dx = 0;
	        var dE_dy = 0;

	        for (var iIdx = _mIdx; iIdx < nodesArray.length; iIdx++) {
	          var i = nodesArray[iIdx];

	          if (i !== m) {
	            var x_i = nodes[i].x;
	            var y_i = nodes[i].y;
	            var denominator = 1.0 / Math.sqrt(Math.pow(x_m - x_i, 2) + Math.pow(y_m - y_i, 2));
	            this.E_matrix[m][iIdx] = [this.K_matrix[m][i] * (x_m - x_i - this.L_matrix[m][i] * (x_m - x_i) * denominator), this.K_matrix[m][i] * (y_m - y_i - this.L_matrix[m][i] * (y_m - y_i) * denominator)];
	            this.E_matrix[i][_mIdx] = this.E_matrix[m][iIdx];
	            dE_dx += this.E_matrix[m][iIdx][0];
	            dE_dy += this.E_matrix[m][iIdx][1];
	          }
	        } //Store sum


	        this.E_sums[m] = [dE_dx, dE_dy];
	      }
	    }
	    /**
	     * Update method, just doing single column (rows are auto-updated) (update all sums)
	     *
	     * @param {number} m
	     * @private
	     */

	  }, {
	    key: "_updateE_matrix",
	    value: function _updateE_matrix(m) {
	      var nodesArray = this.body.nodeIndices;
	      var nodes = this.body.nodes;
	      var colm = this.E_matrix[m];
	      var kcolm = this.K_matrix[m];
	      var lcolm = this.L_matrix[m];
	      var x_m = nodes[m].x;
	      var y_m = nodes[m].y;
	      var dE_dx = 0;
	      var dE_dy = 0;

	      for (var iIdx = 0; iIdx < nodesArray.length; iIdx++) {
	        var i = nodesArray[iIdx];

	        if (i !== m) {
	          //Keep old energy value for sum modification below
	          var cell = colm[iIdx];
	          var oldDx = cell[0];
	          var oldDy = cell[1]; //Calc new energy:

	          var x_i = nodes[i].x;
	          var y_i = nodes[i].y;
	          var denominator = 1.0 / Math.sqrt(Math.pow(x_m - x_i, 2) + Math.pow(y_m - y_i, 2));
	          var dx = kcolm[i] * (x_m - x_i - lcolm[i] * (x_m - x_i) * denominator);
	          var dy = kcolm[i] * (y_m - y_i - lcolm[i] * (y_m - y_i) * denominator);
	          colm[iIdx] = [dx, dy];
	          dE_dx += dx;
	          dE_dy += dy; //add new energy to sum of each column

	          var sum = this.E_sums[i];
	          sum[0] += dx - oldDx;
	          sum[1] += dy - oldDy;
	        }
	      } //Store sum at -1 index


	      this.E_sums[m] = [dE_dx, dE_dy];
	    }
	  }]);

	  return KamadaKawai;
	}();

	/**
	 * Create a network visualization, displaying nodes and edges.
	 *
	 * @param {Element} container   The DOM element in which the Network will
	 *                                  be created. Normally a div element.
	 * @param {Object} data         An object containing parameters
	 *                              {Array} nodes
	 *                              {Array} edges
	 * @param {Object} options      Options
	 * @constructor Network
	 */

	function Network(container, data, options) {
	  var _context,
	      _context2,
	      _context3,
	      _context4,
	      _this = this;

	  if (!(this instanceof Network)) {
	    throw new SyntaxError('Constructor must be called with the new operator');
	  } // set constant values


	  this.options = {};
	  this.defaultOptions = {
	    locale: 'en',
	    locales: locales,
	    clickToUse: false
	  };
	  extend(this.options, this.defaultOptions);
	  /**
	   * Containers for nodes and edges.
	   *
	   * 'edges' and 'nodes' contain the full definitions of all the network elements.
	   * 'nodeIndices' and 'edgeIndices' contain the id's of the active elements.
	   *
	   * The distinction is important, because a defined node need not be active, i.e.
	   * visible on the canvas. This happens in particular when clusters are defined, in
	   * that case there will be nodes and edges not displayed.
	   * The bottom line is that all code with actions related to visibility, *must* use
	   * 'nodeIndices' and 'edgeIndices', not 'nodes' and 'edges' directly.
	   */

	  this.body = {
	    container: container,
	    // See comment above for following fields
	    nodes: {},
	    nodeIndices: [],
	    edges: {},
	    edgeIndices: [],
	    emitter: {
	      on: bind$2(_context = this.on).call(_context, this),
	      off: bind$2(_context2 = this.off).call(_context2, this),
	      emit: bind$2(_context3 = this.emit).call(_context3, this),
	      once: bind$2(_context4 = this.once).call(_context4, this)
	    },
	    eventListeners: {
	      onTap: function onTap() {},
	      onTouch: function onTouch() {},
	      onDoubleTap: function onDoubleTap() {},
	      onHold: function onHold() {},
	      onDragStart: function onDragStart() {},
	      onDrag: function onDrag() {},
	      onDragEnd: function onDragEnd() {},
	      onMouseWheel: function onMouseWheel() {},
	      onPinch: function onPinch() {},
	      onMouseMove: function onMouseMove() {},
	      onRelease: function onRelease() {},
	      onContext: function onContext() {}
	    },
	    data: {
	      nodes: null,
	      // A DataSet or DataView
	      edges: null // A DataSet or DataView

	    },
	    functions: {
	      createNode: function createNode() {},
	      createEdge: function createEdge() {},
	      getPointer: function getPointer() {}
	    },
	    modules: {},
	    view: {
	      scale: 1,
	      translation: {
	        x: 0,
	        y: 0
	      }
	    }
	  }; // bind the event listeners

	  this.bindEventListeners(); // setting up all modules

	  this.images = new Images(function () {
	    return _this.body.emitter.emit("_requestRedraw");
	  }); // object with images

	  this.groups = new Groups(); // object with groups

	  this.canvas = new Canvas(this.body); // DOM handler

	  this.selectionHandler = new SelectionHandler(this.body, this.canvas); // Selection handler

	  this.interactionHandler = new InteractionHandler(this.body, this.canvas, this.selectionHandler); // Interaction handler handles all the hammer bindings (that are bound by canvas), key

	  this.view = new View(this.body, this.canvas); // camera handler, does animations and zooms

	  this.renderer = new CanvasRenderer(this.body, this.canvas); // renderer, starts renderloop, has events that modules can hook into

	  this.physics = new PhysicsEngine(this.body); // physics engine, does all the simulations

	  this.layoutEngine = new LayoutEngine(this.body); // layout engine for inital layout and hierarchical layout

	  this.clustering = new ClusterEngine(this.body); // clustering api

	  this.manipulation = new ManipulationSystem(this.body, this.canvas, this.selectionHandler, this.interactionHandler); // data manipulation system

	  this.nodesHandler = new NodesHandler(this.body, this.images, this.groups, this.layoutEngine); // Handle adding, deleting and updating of nodes as well as global options

	  this.edgesHandler = new EdgesHandler(this.body, this.images, this.groups); // Handle adding, deleting and updating of edges as well as global options

	  this.body.modules["kamadaKawai"] = new KamadaKawai(this.body, 150, 0.05); // Layouting algorithm.

	  this.body.modules["clustering"] = this.clustering; // create the DOM elements

	  this.canvas._create(); // apply options


	  this.setOptions(options); // load data (the disable start variable will be the same as the enabled clustering)

	  this.setData(data);
	} // Extend Network with an Emitter mixin

	componentEmitter(Network.prototype);
	/**
	 * Set options
	 * @param {Object} options
	 */

	Network.prototype.setOptions = function (options) {
	  var _this2 = this;

	  if (options === null) {
	    options = undefined; // This ensures that options handling doesn't crash in the handling
	  }

	  if (options !== undefined) {
	    var errorFound = Validator.validate(options, allOptions$1);

	    if (errorFound === true) {
	      console.log('%cErrors have been found in the supplied options object.', printStyle);
	    } // copy the global fields over


	    var fields = ['locale', 'locales', 'clickToUse'];
	    selectiveDeepExtend(fields, this.options, options); // the hierarchical system can adapt the edges and the physics to it's own options because not all combinations work with the hierarichical system.

	    options = this.layoutEngine.setOptions(options.layout, options);
	    this.canvas.setOptions(options); // options for canvas are in globals
	    // pass the options to the modules

	    this.groups.setOptions(options.groups);
	    this.nodesHandler.setOptions(options.nodes);
	    this.edgesHandler.setOptions(options.edges);
	    this.physics.setOptions(options.physics);
	    this.manipulation.setOptions(options.manipulation, options, this.options); // manipulation uses the locales in the globals

	    this.interactionHandler.setOptions(options.interaction);
	    this.renderer.setOptions(options.interaction); // options for rendering are in interaction

	    this.selectionHandler.setOptions(options.interaction); // options for selection are in interaction
	    // reload the settings of the nodes to apply changes in groups that are not referenced by pointer.

	    if (options.groups !== undefined) {
	      this.body.emitter.emit("refreshNodes");
	    } // these two do not have options at the moment, here for completeness
	    //this.view.setOptions(options.view);
	    //this.clustering.setOptions(options.clustering);


	    if ('configure' in options) {
	      if (!this.configurator) {
	        this.configurator = new Configurator(this, this.body.container, configureOptions, this.canvas.pixelRatio);
	      }

	      this.configurator.setOptions(options.configure);
	    } // if the configuration system is enabled, copy all options and put them into the config system


	    if (this.configurator && this.configurator.options.enabled === true) {
	      var networkOptions = {
	        nodes: {},
	        edges: {},
	        layout: {},
	        interaction: {},
	        manipulation: {},
	        physics: {},
	        global: {}
	      };
	      deepExtend(networkOptions.nodes, this.nodesHandler.options);
	      deepExtend(networkOptions.edges, this.edgesHandler.options);
	      deepExtend(networkOptions.layout, this.layoutEngine.options); // load the selectionHandler and render default options in to the interaction group

	      deepExtend(networkOptions.interaction, this.selectionHandler.options);
	      deepExtend(networkOptions.interaction, this.renderer.options);
	      deepExtend(networkOptions.interaction, this.interactionHandler.options);
	      deepExtend(networkOptions.manipulation, this.manipulation.options);
	      deepExtend(networkOptions.physics, this.physics.options); // load globals into the global object

	      deepExtend(networkOptions.global, this.canvas.options);
	      deepExtend(networkOptions.global, this.options);
	      this.configurator.setModuleOptions(networkOptions);
	    } // handle network global options


	    if (options.clickToUse !== undefined) {
	      if (options.clickToUse === true) {
	        if (this.activator === undefined) {
	          this.activator = new Activator_1(this.canvas.frame);
	          this.activator.on('change', function () {
	            _this2.body.emitter.emit("activate");
	          });
	        }
	      } else {
	        if (this.activator !== undefined) {
	          this.activator.destroy();
	          delete this.activator;
	        }

	        this.body.emitter.emit("activate");
	      }
	    } else {
	      this.body.emitter.emit("activate");
	    }

	    this.canvas.setSize(); // start the physics simulation. Can be safely called multiple times.

	    this.body.emitter.emit("startSimulation");
	  }
	};
	/**
	 * Update the visible nodes and edges list with the most recent node state.
	 *
	 * Visible nodes are stored in this.body.nodeIndices.
	 * Visible edges are stored in this.body.edgeIndices.
	 * A node or edges is visible if it is not hidden or clustered.
	 *
	 * @private
	 */


	Network.prototype._updateVisibleIndices = function () {
	  var nodes = this.body.nodes;
	  var edges = this.body.edges;
	  this.body.nodeIndices = [];
	  this.body.edgeIndices = [];

	  for (var nodeId in nodes) {
	    if (nodes.hasOwnProperty(nodeId)) {
	      if (!this.clustering._isClusteredNode(nodeId) && nodes[nodeId].options.hidden === false) {
	        this.body.nodeIndices.push(nodes[nodeId].id);
	      }
	    }
	  }

	  for (var edgeId in edges) {
	    if (edges.hasOwnProperty(edgeId)) {
	      var edge = edges[edgeId]; // It can happen that this is executed *after* a node edge has been removed,
	      // but *before* the edge itself has been removed. Taking this into account.

	      var fromNode = nodes[edge.fromId];
	      var toNode = nodes[edge.toId];
	      var edgeNodesPresent = fromNode !== undefined && toNode !== undefined;
	      var isVisible = !this.clustering._isClusteredEdge(edgeId) && edge.options.hidden === false && edgeNodesPresent && fromNode.options.hidden === false // Also hidden if any of its connecting nodes are hidden
	      && toNode.options.hidden === false; // idem

	      if (isVisible) {
	        this.body.edgeIndices.push(edge.id);
	      }
	    }
	  }
	};
	/**
	 * Bind all events
	 */


	Network.prototype.bindEventListeners = function () {
	  var _this3 = this;

	  // This event will trigger a rebuilding of the cache everything.
	  // Used when nodes or edges have been added or removed.
	  this.body.emitter.on("_dataChanged", function () {
	    _this3.edgesHandler._updateState();

	    _this3.body.emitter.emit("_dataUpdated");
	  }); // this is called when options of EXISTING nodes or edges have changed.

	  this.body.emitter.on("_dataUpdated", function () {
	    // Order important in following block
	    _this3.clustering._updateState();

	    _this3._updateVisibleIndices();

	    _this3._updateValueRange(_this3.body.nodes);

	    _this3._updateValueRange(_this3.body.edges); // start simulation (can be called safely, even if already running)


	    _this3.body.emitter.emit("startSimulation");

	    _this3.body.emitter.emit("_requestRedraw");
	  });
	};
	/**
	 * Set nodes and edges, and optionally options as well.
	 *
	 * @param {Object} data              Object containing parameters:
	 *                                   {Array | DataSet | DataView} [nodes] Array with nodes
	 *                                   {Array | DataSet | DataView} [edges] Array with edges
	 *                                   {String} [dot] String containing data in DOT format
	 *                                   {String} [gephi] String containing data in gephi JSON format
	 *                                   {Options} [options] Object with options
	 */


	Network.prototype.setData = function (data) {
	  // reset the physics engine.
	  this.body.emitter.emit("resetPhysics");
	  this.body.emitter.emit("_resetData"); // unselect all to ensure no selections from old data are carried over.

	  this.selectionHandler.unselectAll();

	  if (data && data.dot && (data.nodes || data.edges)) {
	    throw new SyntaxError('Data must contain either parameter "dot" or ' + ' parameter pair "nodes" and "edges", but not both.');
	  } // set options


	  this.setOptions(data && data.options); // set all data

	  if (data && data.dot) {
	    console.log('The dot property has been deprecated. Please use the static convertDot method to convert DOT into vis.network format and use the normal data format with nodes and edges. This converter is used like this: var data = vis.network.convertDot(dotString);'); // parse DOT file

	    var dotData = dotparser.DOTToGraph(data.dot);
	    this.setData(dotData);
	    return;
	  } else if (data && data.gephi) {
	    // parse DOT file
	    console.log('The gephi property has been deprecated. Please use the static convertGephi method to convert gephi into vis.network format and use the normal data format with nodes and edges. This converter is used like this: var data = vis.network.convertGephi(gephiJson);');
	    var gephiData = parseGephi(data.gephi);
	    this.setData(gephiData);
	    return;
	  } else {
	    this.nodesHandler.setData(data && data.nodes, true);
	    this.edgesHandler.setData(data && data.edges, true);
	  } // emit change in data


	  this.body.emitter.emit("_dataChanged"); // emit data loaded

	  this.body.emitter.emit("_dataLoaded"); // find a stable position or start animating to a stable position

	  this.body.emitter.emit("initPhysics");
	};
	/**
	 * Cleans up all bindings of the network, removing it fully from the memory IF the variable is set to null after calling this function.
	 * var network = new vis.Network(..);
	 * network.destroy();
	 * network = null;
	 */


	Network.prototype.destroy = function () {
	  this.body.emitter.emit("destroy"); // clear events

	  this.body.emitter.off();
	  this.off(); // delete modules

	  delete this.groups;
	  delete this.canvas;
	  delete this.selectionHandler;
	  delete this.interactionHandler;
	  delete this.view;
	  delete this.renderer;
	  delete this.physics;
	  delete this.layoutEngine;
	  delete this.clustering;
	  delete this.manipulation;
	  delete this.nodesHandler;
	  delete this.edgesHandler;
	  delete this.configurator;
	  delete this.images;

	  for (var nodeId in this.body.nodes) {
	    if (!this.body.nodes.hasOwnProperty(nodeId)) continue;
	    delete this.body.nodes[nodeId];
	  }

	  for (var edgeId in this.body.edges) {
	    if (!this.body.edges.hasOwnProperty(edgeId)) continue;
	    delete this.body.edges[edgeId];
	  } // remove the container and everything inside it recursively


	  recursiveDOMDelete(this.body.container);
	};
	/**
	 * Update the values of all object in the given array according to the current
	 * value range of the objects in the array.
	 * @param {Object} obj    An object containing a set of Edges or Nodes
	 *                        The objects must have a method getValue() and
	 *                        setValueRange(min, max).
	 * @private
	 */


	Network.prototype._updateValueRange = function (obj) {
	  var id; // determine the range of the objects

	  var valueMin = undefined;
	  var valueMax = undefined;
	  var valueTotal = 0;

	  for (id in obj) {
	    if (obj.hasOwnProperty(id)) {
	      var value = obj[id].getValue();

	      if (value !== undefined) {
	        valueMin = valueMin === undefined ? value : Math.min(value, valueMin);
	        valueMax = valueMax === undefined ? value : Math.max(value, valueMax);
	        valueTotal += value;
	      }
	    }
	  } // adjust the range of all objects


	  if (valueMin !== undefined && valueMax !== undefined) {
	    for (id in obj) {
	      if (obj.hasOwnProperty(id)) {
	        obj[id].setValueRange(valueMin, valueMax, valueTotal);
	      }
	    }
	  }
	};
	/**
	 * Returns true when the Network is active.
	 * @returns {boolean}
	 */


	Network.prototype.isActive = function () {
	  return !this.activator || this.activator.active;
	};

	Network.prototype.setSize = function () {
	  return this.canvas.setSize.apply(this.canvas, arguments);
	};

	Network.prototype.canvasToDOM = function () {
	  return this.canvas.canvasToDOM.apply(this.canvas, arguments);
	};

	Network.prototype.DOMtoCanvas = function () {
	  return this.canvas.DOMtoCanvas.apply(this.canvas, arguments);
	};
	/**
	 * Nodes can be in clusters. Clusters can also be in clusters. This function returns and array of
	 * nodeIds showing where the node is.
	 *
	 * If any nodeId in the chain, especially the first passed in as a parameter, is not present in
	 * the current nodes list, an empty array is returned.
	 *
	 * Example:
	 * cluster 'A' contains cluster 'B',
	 * cluster 'B' contains cluster 'C',
	 * cluster 'C' contains node 'fred'.
	 * `jsnetwork.clustering.findNode('fred')` will return `['A','B','C','fred']`.
	 *
	 * @param {string|number} nodeId
	 * @returns {Array}
	 */


	Network.prototype.findNode = function () {
	  return this.clustering.findNode.apply(this.clustering, arguments);
	};

	Network.prototype.isCluster = function () {
	  return this.clustering.isCluster.apply(this.clustering, arguments);
	};

	Network.prototype.openCluster = function () {
	  return this.clustering.openCluster.apply(this.clustering, arguments);
	};

	Network.prototype.cluster = function () {
	  return this.clustering.cluster.apply(this.clustering, arguments);
	};

	Network.prototype.getNodesInCluster = function () {
	  return this.clustering.getNodesInCluster.apply(this.clustering, arguments);
	};

	Network.prototype.clusterByConnection = function () {
	  return this.clustering.clusterByConnection.apply(this.clustering, arguments);
	};

	Network.prototype.clusterByHubsize = function () {
	  return this.clustering.clusterByHubsize.apply(this.clustering, arguments);
	};
	/**
	 * This method will cluster all nodes with 1 edge with their respective connected node.
	 * The options object is explained in full <a data-scroll="" data-options="{ &quot;easing&quot;: &quot;easeInCubic&quot; }" href="#optionsObject">below</a>.
	 *
	 * @param {object} [options]
	 * @returns {undefined}
	 */


	Network.prototype.clusterOutliers = function () {
	  return this.clustering.clusterOutliers.apply(this.clustering, arguments);
	};

	Network.prototype.getSeed = function () {
	  return this.layoutEngine.getSeed.apply(this.layoutEngine, arguments);
	};

	Network.prototype.enableEditMode = function () {
	  return this.manipulation.enableEditMode.apply(this.manipulation, arguments);
	};

	Network.prototype.disableEditMode = function () {
	  return this.manipulation.disableEditMode.apply(this.manipulation, arguments);
	};

	Network.prototype.addNodeMode = function () {
	  return this.manipulation.addNodeMode.apply(this.manipulation, arguments);
	};

	Network.prototype.editNode = function () {
	  return this.manipulation.editNode.apply(this.manipulation, arguments);
	};

	Network.prototype.editNodeMode = function () {
	  console.log("Deprecated: Please use editNode instead of editNodeMode.");
	  return this.manipulation.editNode.apply(this.manipulation, arguments);
	};

	Network.prototype.addEdgeMode = function () {
	  return this.manipulation.addEdgeMode.apply(this.manipulation, arguments);
	};

	Network.prototype.editEdgeMode = function () {
	  return this.manipulation.editEdgeMode.apply(this.manipulation, arguments);
	};

	Network.prototype.deleteSelected = function () {
	  return this.manipulation.deleteSelected.apply(this.manipulation, arguments);
	};

	Network.prototype.getPositions = function () {
	  return this.nodesHandler.getPositions.apply(this.nodesHandler, arguments);
	};

	Network.prototype.storePositions = function () {
	  return this.nodesHandler.storePositions.apply(this.nodesHandler, arguments);
	};

	Network.prototype.moveNode = function () {
	  return this.nodesHandler.moveNode.apply(this.nodesHandler, arguments);
	};

	Network.prototype.getBoundingBox = function () {
	  return this.nodesHandler.getBoundingBox.apply(this.nodesHandler, arguments);
	};

	Network.prototype.getConnectedNodes = function (objectId) {
	  if (this.body.nodes[objectId] !== undefined) {
	    return this.nodesHandler.getConnectedNodes.apply(this.nodesHandler, arguments);
	  } else {
	    return this.edgesHandler.getConnectedNodes.apply(this.edgesHandler, arguments);
	  }
	};

	Network.prototype.getConnectedEdges = function () {
	  return this.nodesHandler.getConnectedEdges.apply(this.nodesHandler, arguments);
	};

	Network.prototype.startSimulation = function () {
	  return this.physics.startSimulation.apply(this.physics, arguments);
	};

	Network.prototype.stopSimulation = function () {
	  return this.physics.stopSimulation.apply(this.physics, arguments);
	};

	Network.prototype.stabilize = function () {
	  return this.physics.stabilize.apply(this.physics, arguments);
	};

	Network.prototype.getSelection = function () {
	  return this.selectionHandler.getSelection.apply(this.selectionHandler, arguments);
	};

	Network.prototype.setSelection = function () {
	  return this.selectionHandler.setSelection.apply(this.selectionHandler, arguments);
	};

	Network.prototype.getSelectedNodes = function () {
	  return this.selectionHandler.getSelectedNodes.apply(this.selectionHandler, arguments);
	};

	Network.prototype.getSelectedEdges = function () {
	  return this.selectionHandler.getSelectedEdges.apply(this.selectionHandler, arguments);
	};

	Network.prototype.getNodeAt = function () {
	  var node = this.selectionHandler.getNodeAt.apply(this.selectionHandler, arguments);

	  if (node !== undefined && node.id !== undefined) {
	    return node.id;
	  }

	  return node;
	};

	Network.prototype.getEdgeAt = function () {
	  var edge = this.selectionHandler.getEdgeAt.apply(this.selectionHandler, arguments);

	  if (edge !== undefined && edge.id !== undefined) {
	    return edge.id;
	  }

	  return edge;
	};

	Network.prototype.selectNodes = function () {
	  return this.selectionHandler.selectNodes.apply(this.selectionHandler, arguments);
	};

	Network.prototype.selectEdges = function () {
	  return this.selectionHandler.selectEdges.apply(this.selectionHandler, arguments);
	};

	Network.prototype.unselectAll = function () {
	  this.selectionHandler.unselectAll.apply(this.selectionHandler, arguments);
	  this.redraw();
	};

	Network.prototype.redraw = function () {
	  return this.renderer.redraw.apply(this.renderer, arguments);
	};

	Network.prototype.getScale = function () {
	  return this.view.getScale.apply(this.view, arguments);
	};

	Network.prototype.getViewPosition = function () {
	  return this.view.getViewPosition.apply(this.view, arguments);
	};

	Network.prototype.fit = function () {
	  return this.view.fit.apply(this.view, arguments);
	};

	Network.prototype.moveTo = function () {
	  return this.view.moveTo.apply(this.view, arguments);
	};

	Network.prototype.focus = function () {
	  return this.view.focus.apply(this.view, arguments);
	};

	Network.prototype.releaseNode = function () {
	  return this.view.releaseNode.apply(this.view, arguments);
	};

	Network.prototype.getOptionsFromConfigurator = function () {
	  var options = {};

	  if (this.configurator) {
	    options = this.configurator.getOptions.apply(this.configurator);
	  }

	  return options;
	};

	var parseDOTNetwork = DOTToGraph_1;
	// overflow in UMD builds. They all export vis namespace therefore reexporting
	// leads to loading vis to load vis to load vis…

	exports.DataSet = DataSet;
	exports.DataView = DataView;
	exports.Network = Network;
	exports.NetworkImages = Images;
	exports.Queue = Queue;
	exports.data = esm;
	exports.networkDOTParser = dotparser$1;
	exports.networkGephiParser = gephiParser;
	exports.networkOptions = options;
	exports.parseDOTNetwork = parseDOTNetwork;
	exports.parseGephiNetwork = parseGephi;
	exports.util = visUtil;

	Object.defineProperty(exports, '__esModule', { value: true });

})));
//# sourceMappingURL=vis-network.js.map
