\\s*\\(/gm, '{anonymous}()@') : 'Unknown Stack Trace';\n var log = window.console && (window.console.warn || window.console.log);\n if (log) {\n log.call(window.console, deprecationMessage, stack);\n }\n return method.apply(this, arguments);\n };\n }\n\n /**\n * extend object.\n * means that properties in dest will be overwritten by the ones in src.\n * @param {Object} target\n * @param {...Object} objects_to_assign\n * @returns {Object} target\n */\n var assign;\n if (typeof Object.assign !== 'function') {\n assign = function assign(target) {\n if (target === undefined || target === null) {\n throw new TypeError('Cannot convert undefined or null to object');\n }\n var output = Object(target);\n for (var index = 1; index < arguments.length; index++) {\n var source = arguments[index];\n if (source !== undefined && source !== null) {\n for (var nextKey in source) {\n if (source.hasOwnProperty(nextKey)) {\n output[nextKey] = source[nextKey];\n }\n }\n }\n }\n return output;\n };\n } else {\n assign = Object.assign;\n }\n\n /**\n * extend object.\n * means that properties in dest will be overwritten by the ones in src.\n * @param {Object} dest\n * @param {Object} src\n * @param {Boolean} [merge=false]\n * @returns {Object} dest\n */\n var extend = deprecate(function extend(dest, src, merge) {\n var keys = Object.keys(src);\n var i = 0;\n while (i < keys.length) {\n if (!merge || merge && dest[keys[i]] === undefined) {\n dest[keys[i]] = src[keys[i]];\n }\n i++;\n }\n return dest;\n }, 'extend', 'Use `assign`.');\n\n /**\n * merge the values from src in the dest.\n * means that properties that exist in dest will not be overwritten by src\n * @param {Object} dest\n * @param {Object} src\n * @returns {Object} dest\n */\n var merge = deprecate(function merge(dest, src) {\n return extend(dest, src, true);\n }, 'merge', 'Use `assign`.');\n\n /**\n * simple class inheritance\n * @param {Function} child\n * @param {Function} base\n * @param {Object} [properties]\n */\n function inherit(child, base, properties) {\n var baseP = base.prototype,\n childP;\n childP = child.prototype = Object.create(baseP);\n childP.constructor = child;\n childP._super = baseP;\n if (properties) {\n assign(childP, properties);\n }\n }\n\n /**\n * simple function bind\n * @param {Function} fn\n * @param {Object} context\n * @returns {Function}\n */\n function bindFn(fn, context) {\n return function boundFn() {\n return fn.apply(context, arguments);\n };\n }\n\n /**\n * let a boolean value also be a function that must return a boolean\n * this first item in args will be used as the context\n * @param {Boolean|Function} val\n * @param {Array} [args]\n * @returns {Boolean}\n */\n function boolOrFn(val, args) {\n if (typeof val == TYPE_FUNCTION) {\n return val.apply(args ? args[0] || undefined : undefined, args);\n }\n return val;\n }\n\n /**\n * use the val2 when val1 is undefined\n * @param {*} val1\n * @param {*} val2\n * @returns {*}\n */\n function ifUndefined(val1, val2) {\n return val1 === undefined ? val2 : val1;\n }\n\n /**\n * addEventListener with multiple events at once\n * @param {EventTarget} target\n * @param {String} types\n * @param {Function} handler\n */\n function addEventListeners(target, types, handler) {\n each(splitStr(types), function (type) {\n target.addEventListener(type, handler, false);\n });\n }\n\n /**\n * removeEventListener with multiple events at once\n * @param {EventTarget} target\n * @param {String} types\n * @param {Function} handler\n */\n function removeEventListeners(target, types, handler) {\n each(splitStr(types), function (type) {\n target.removeEventListener(type, handler, false);\n });\n }\n\n /**\n * find if a node is in the given parent\n * @method hasParent\n * @param {HTMLElement} node\n * @param {HTMLElement} parent\n * @return {Boolean} found\n */\n function hasParent(node, parent) {\n while (node) {\n if (node == parent) {\n return true;\n }\n node = node.parentNode;\n }\n return false;\n }\n\n /**\n * small indexOf wrapper\n * @param {String} str\n * @param {String} find\n * @returns {Boolean} found\n */\n function inStr(str, find) {\n return str.indexOf(find) > -1;\n }\n\n /**\n * split string on whitespace\n * @param {String} str\n * @returns {Array} words\n */\n function splitStr(str) {\n return str.trim().split(/\\s+/g);\n }\n\n /**\n * find if a array contains the object using indexOf or a simple polyFill\n * @param {Array} src\n * @param {String} find\n * @param {String} [findByKey]\n * @return {Boolean|Number} false when not found, or the index\n */\n function inArray(src, find, findByKey) {\n if (src.indexOf && !findByKey) {\n return src.indexOf(find);\n } else {\n var i = 0;\n while (i < src.length) {\n if (findByKey && src[i][findByKey] == find || !findByKey && src[i] === find) {\n return i;\n }\n i++;\n }\n return -1;\n }\n }\n\n /**\n * convert array-like objects to real arrays\n * @param {Object} obj\n * @returns {Array}\n */\n function toArray(obj) {\n return Array.prototype.slice.call(obj, 0);\n }\n\n /**\n * unique array with objects based on a key (like 'id') or just by the array's value\n * @param {Array} src [{id:1},{id:2},{id:1}]\n * @param {String} [key]\n * @param {Boolean} [sort=False]\n * @returns {Array} [{id:1},{id:2}]\n */\n function uniqueArray(src, key, sort) {\n var results = [];\n var values = [];\n var i = 0;\n while (i < src.length) {\n var val = key ? src[i][key] : src[i];\n if (inArray(values, val) < 0) {\n results.push(src[i]);\n }\n values[i] = val;\n i++;\n }\n if (sort) {\n if (!key) {\n results = results.sort();\n } else {\n results = results.sort(function sortUniqueArray(a, b) {\n return a[key] > b[key];\n });\n }\n }\n return results;\n }\n\n /**\n * get the prefixed property\n * @param {Object} obj\n * @param {String} property\n * @returns {String|Undefined} prefixed\n */\n function prefixed(obj, property) {\n var prefix, prop;\n var camelProp = property[0].toUpperCase() + property.slice(1);\n var i = 0;\n while (i < VENDOR_PREFIXES.length) {\n prefix = VENDOR_PREFIXES[i];\n prop = prefix ? prefix + camelProp : property;\n if (prop in obj) {\n return prop;\n }\n i++;\n }\n return undefined;\n }\n\n /**\n * get a unique id\n * @returns {number} uniqueId\n */\n var _uniqueId = 1;\n function uniqueId() {\n return _uniqueId++;\n }\n\n /**\n * get the window object of an element\n * @param {HTMLElement} element\n * @returns {DocumentView|Window}\n */\n function getWindowForElement(element) {\n var doc = element.ownerDocument || element;\n return doc.defaultView || doc.parentWindow || window;\n }\n var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;\n var SUPPORT_TOUCH = ('ontouchstart' in window);\n var SUPPORT_POINTER_EVENTS = prefixed(window, 'PointerEvent') !== undefined;\n var SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);\n var INPUT_TYPE_TOUCH = 'touch';\n var INPUT_TYPE_PEN = 'pen';\n var INPUT_TYPE_MOUSE = 'mouse';\n var INPUT_TYPE_KINECT = 'kinect';\n var COMPUTE_INTERVAL = 25;\n var INPUT_START = 1;\n var INPUT_MOVE = 2;\n var INPUT_END = 4;\n var INPUT_CANCEL = 8;\n var DIRECTION_NONE = 1;\n var DIRECTION_LEFT = 2;\n var DIRECTION_RIGHT = 4;\n var DIRECTION_UP = 8;\n var DIRECTION_DOWN = 16;\n var DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;\n var DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;\n var DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;\n var PROPS_XY = ['x', 'y'];\n var PROPS_CLIENT_XY = ['clientX', 'clientY'];\n\n /**\n * create new input type manager\n * @param {Manager} manager\n * @param {Function} callback\n * @returns {Input}\n * @constructor\n */\n function Input(manager, callback) {\n var self = this;\n this.manager = manager;\n this.callback = callback;\n this.element = manager.element;\n this.target = manager.options.inputTarget;\n\n // smaller wrapper around the handler, for the scope and the enabled state of the manager,\n // so when disabled the input events are completely bypassed.\n this.domHandler = function (ev) {\n if (boolOrFn(manager.options.enable, [manager])) {\n self.handler(ev);\n }\n };\n this.init();\n }\n Input.prototype = {\n /**\n * should handle the inputEvent data and trigger the callback\n * @virtual\n */\n handler: function () {},\n /**\n * bind the events\n */\n init: function () {\n this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);\n this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);\n this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n },\n /**\n * unbind the events\n */\n destroy: function () {\n this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);\n this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);\n this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n }\n };\n\n /**\n * create new input type manager\n * called by the Manager constructor\n * @param {Hammer} manager\n * @returns {Input}\n */\n function createInputInstance(manager) {\n var Type;\n var inputClass = manager.options.inputClass;\n if (inputClass) {\n Type = inputClass;\n } else if (SUPPORT_POINTER_EVENTS) {\n Type = PointerEventInput;\n } else if (SUPPORT_ONLY_TOUCH) {\n Type = TouchInput;\n } else if (!SUPPORT_TOUCH) {\n Type = MouseInput;\n } else {\n Type = TouchMouseInput;\n }\n return new Type(manager, inputHandler);\n }\n\n /**\n * handle input events\n * @param {Manager} manager\n * @param {String} eventType\n * @param {Object} input\n */\n function inputHandler(manager, eventType, input) {\n var pointersLen = input.pointers.length;\n var changedPointersLen = input.changedPointers.length;\n var isFirst = eventType & INPUT_START && pointersLen - changedPointersLen === 0;\n var isFinal = eventType & (INPUT_END | INPUT_CANCEL) && pointersLen - changedPointersLen === 0;\n input.isFirst = !!isFirst;\n input.isFinal = !!isFinal;\n if (isFirst) {\n manager.session = {};\n }\n\n // source event is the normalized value of the domEvents\n // like 'touchstart, mouseup, pointerdown'\n input.eventType = eventType;\n\n // compute scale, rotation etc\n computeInputData(manager, input);\n\n // emit secret event\n manager.emit('hammer.input', input);\n manager.recognize(input);\n manager.session.prevInput = input;\n }\n\n /**\n * extend the data with some usable properties like scale, rotate, velocity etc\n * @param {Object} manager\n * @param {Object} input\n */\n function computeInputData(manager, input) {\n var session = manager.session;\n var pointers = input.pointers;\n var pointersLength = pointers.length;\n\n // store the first input to calculate the distance and direction\n if (!session.firstInput) {\n session.firstInput = simpleCloneInputData(input);\n }\n\n // to compute scale and rotation we need to store the multiple touches\n if (pointersLength > 1 && !session.firstMultiple) {\n session.firstMultiple = simpleCloneInputData(input);\n } else if (pointersLength === 1) {\n session.firstMultiple = false;\n }\n var firstInput = session.firstInput;\n var firstMultiple = session.firstMultiple;\n var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;\n var center = input.center = getCenter(pointers);\n input.timeStamp = now();\n input.deltaTime = input.timeStamp - firstInput.timeStamp;\n input.angle = getAngle(offsetCenter, center);\n input.distance = getDistance(offsetCenter, center);\n computeDeltaXY(session, input);\n input.offsetDirection = getDirection(input.deltaX, input.deltaY);\n var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY);\n input.overallVelocityX = overallVelocity.x;\n input.overallVelocityY = overallVelocity.y;\n input.overallVelocity = abs(overallVelocity.x) > abs(overallVelocity.y) ? overallVelocity.x : overallVelocity.y;\n input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;\n input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;\n input.maxPointers = !session.prevInput ? input.pointers.length : input.pointers.length > session.prevInput.maxPointers ? input.pointers.length : session.prevInput.maxPointers;\n computeIntervalInputData(session, input);\n\n // find the correct target\n var target = manager.element;\n if (hasParent(input.srcEvent.target, target)) {\n target = input.srcEvent.target;\n }\n input.target = target;\n }\n function computeDeltaXY(session, input) {\n var center = input.center;\n var offset = session.offsetDelta || {};\n var prevDelta = session.prevDelta || {};\n var prevInput = session.prevInput || {};\n if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {\n prevDelta = session.prevDelta = {\n x: prevInput.deltaX || 0,\n y: prevInput.deltaY || 0\n };\n offset = session.offsetDelta = {\n x: center.x,\n y: center.y\n };\n }\n input.deltaX = prevDelta.x + (center.x - offset.x);\n input.deltaY = prevDelta.y + (center.y - offset.y);\n }\n\n /**\n * velocity is calculated every x ms\n * @param {Object} session\n * @param {Object} input\n */\n function computeIntervalInputData(session, input) {\n var last = session.lastInterval || input,\n deltaTime = input.timeStamp - last.timeStamp,\n velocity,\n velocityX,\n velocityY,\n direction;\n if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {\n var deltaX = input.deltaX - last.deltaX;\n var deltaY = input.deltaY - last.deltaY;\n var v = getVelocity(deltaTime, deltaX, deltaY);\n velocityX = v.x;\n velocityY = v.y;\n velocity = abs(v.x) > abs(v.y) ? v.x : v.y;\n direction = getDirection(deltaX, deltaY);\n session.lastInterval = input;\n } else {\n // use latest velocity info if it doesn't overtake a minimum period\n velocity = last.velocity;\n velocityX = last.velocityX;\n velocityY = last.velocityY;\n direction = last.direction;\n }\n input.velocity = velocity;\n input.velocityX = velocityX;\n input.velocityY = velocityY;\n input.direction = direction;\n }\n\n /**\n * create a simple clone from the input used for storage of firstInput and firstMultiple\n * @param {Object} input\n * @returns {Object} clonedInputData\n */\n function simpleCloneInputData(input) {\n // make a simple copy of the pointers because we will get a reference if we don't\n // we only need clientXY for the calculations\n var pointers = [];\n var i = 0;\n while (i < input.pointers.length) {\n pointers[i] = {\n clientX: round(input.pointers[i].clientX),\n clientY: round(input.pointers[i].clientY)\n };\n i++;\n }\n return {\n timeStamp: now(),\n pointers: pointers,\n center: getCenter(pointers),\n deltaX: input.deltaX,\n deltaY: input.deltaY\n };\n }\n\n /**\n * get the center of all the pointers\n * @param {Array} pointers\n * @return {Object} center contains `x` and `y` properties\n */\n function getCenter(pointers) {\n var pointersLength = pointers.length;\n\n // no need to loop when only one touch\n if (pointersLength === 1) {\n return {\n x: round(pointers[0].clientX),\n y: round(pointers[0].clientY)\n };\n }\n var x = 0,\n y = 0,\n i = 0;\n while (i < pointersLength) {\n x += pointers[i].clientX;\n y += pointers[i].clientY;\n i++;\n }\n return {\n x: round(x / pointersLength),\n y: round(y / pointersLength)\n };\n }\n\n /**\n * calculate the velocity between two points. unit is in px per ms.\n * @param {Number} deltaTime\n * @param {Number} x\n * @param {Number} y\n * @return {Object} velocity `x` and `y`\n */\n function getVelocity(deltaTime, x, y) {\n return {\n x: x / deltaTime || 0,\n y: y / deltaTime || 0\n };\n }\n\n /**\n * get the direction between two points\n * @param {Number} x\n * @param {Number} y\n * @return {Number} direction\n */\n function getDirection(x, y) {\n if (x === y) {\n return DIRECTION_NONE;\n }\n if (abs(x) >= abs(y)) {\n return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;\n }\n return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;\n }\n\n /**\n * calculate the absolute distance between two points\n * @param {Object} p1 {x, y}\n * @param {Object} p2 {x, y}\n * @param {Array} [props] containing x and y keys\n * @return {Number} distance\n */\n function getDistance(p1, p2, props) {\n if (!props) {\n props = PROPS_XY;\n }\n var x = p2[props[0]] - p1[props[0]],\n y = p2[props[1]] - p1[props[1]];\n return Math.sqrt(x * x + y * y);\n }\n\n /**\n * calculate the angle between two coordinates\n * @param {Object} p1\n * @param {Object} p2\n * @param {Array} [props] containing x and y keys\n * @return {Number} angle\n */\n function getAngle(p1, p2, props) {\n if (!props) {\n props = PROPS_XY;\n }\n var x = p2[props[0]] - p1[props[0]],\n y = p2[props[1]] - p1[props[1]];\n return Math.atan2(y, x) * 180 / Math.PI;\n }\n\n /**\n * calculate the rotation degrees between two pointersets\n * @param {Array} start array of pointers\n * @param {Array} end array of pointers\n * @return {Number} rotation\n */\n function getRotation(start, end) {\n return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);\n }\n\n /**\n * calculate the scale factor between two pointersets\n * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out\n * @param {Array} start array of pointers\n * @param {Array} end array of pointers\n * @return {Number} scale\n */\n function getScale(start, end) {\n return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);\n }\n var MOUSE_INPUT_MAP = {\n mousedown: INPUT_START,\n mousemove: INPUT_MOVE,\n mouseup: INPUT_END\n };\n var MOUSE_ELEMENT_EVENTS = 'mousedown';\n var MOUSE_WINDOW_EVENTS = 'mousemove mouseup';\n\n /**\n * Mouse events input\n * @constructor\n * @extends Input\n */\n function MouseInput() {\n this.evEl = MOUSE_ELEMENT_EVENTS;\n this.evWin = MOUSE_WINDOW_EVENTS;\n this.pressed = false; // mousedown state\n\n Input.apply(this, arguments);\n }\n inherit(MouseInput, Input, {\n /**\n * handle mouse events\n * @param {Object} ev\n */\n handler: function MEhandler(ev) {\n var eventType = MOUSE_INPUT_MAP[ev.type];\n\n // on start we want to have the left mouse button down\n if (eventType & INPUT_START && ev.button === 0) {\n this.pressed = true;\n }\n if (eventType & INPUT_MOVE && ev.which !== 1) {\n eventType = INPUT_END;\n }\n\n // mouse must be down\n if (!this.pressed) {\n return;\n }\n if (eventType & INPUT_END) {\n this.pressed = false;\n }\n this.callback(this.manager, eventType, {\n pointers: [ev],\n changedPointers: [ev],\n pointerType: INPUT_TYPE_MOUSE,\n srcEvent: ev\n });\n }\n });\n var POINTER_INPUT_MAP = {\n pointerdown: INPUT_START,\n pointermove: INPUT_MOVE,\n pointerup: INPUT_END,\n pointercancel: INPUT_CANCEL,\n pointerout: INPUT_CANCEL\n };\n\n // in IE10 the pointer types is defined as an enum\n var IE10_POINTER_TYPE_ENUM = {\n 2: INPUT_TYPE_TOUCH,\n 3: INPUT_TYPE_PEN,\n 4: INPUT_TYPE_MOUSE,\n 5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816\n };\n var POINTER_ELEMENT_EVENTS = 'pointerdown';\n var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel';\n\n // IE10 has prefixed support, and case-sensitive\n if (window.MSPointerEvent && !window.PointerEvent) {\n POINTER_ELEMENT_EVENTS = 'MSPointerDown';\n POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';\n }\n\n /**\n * Pointer events input\n * @constructor\n * @extends Input\n */\n function PointerEventInput() {\n this.evEl = POINTER_ELEMENT_EVENTS;\n this.evWin = POINTER_WINDOW_EVENTS;\n Input.apply(this, arguments);\n this.store = this.manager.session.pointerEvents = [];\n }\n inherit(PointerEventInput, Input, {\n /**\n * handle mouse events\n * @param {Object} ev\n */\n handler: function PEhandler(ev) {\n var store = this.store;\n var removePointer = false;\n var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');\n var eventType = POINTER_INPUT_MAP[eventTypeNormalized];\n var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;\n var isTouch = pointerType == INPUT_TYPE_TOUCH;\n\n // get index of the event in the store\n var storeIndex = inArray(store, ev.pointerId, 'pointerId');\n\n // start and mouse must be down\n if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {\n if (storeIndex < 0) {\n store.push(ev);\n storeIndex = store.length - 1;\n }\n } else if (eventType & (INPUT_END | INPUT_CANCEL)) {\n removePointer = true;\n }\n\n // it not found, so the pointer hasn't been down (so it's probably a hover)\n if (storeIndex < 0) {\n return;\n }\n\n // update the event in the store\n store[storeIndex] = ev;\n this.callback(this.manager, eventType, {\n pointers: store,\n changedPointers: [ev],\n pointerType: pointerType,\n srcEvent: ev\n });\n if (removePointer) {\n // remove from the store\n store.splice(storeIndex, 1);\n }\n }\n });\n var SINGLE_TOUCH_INPUT_MAP = {\n touchstart: INPUT_START,\n touchmove: INPUT_MOVE,\n touchend: INPUT_END,\n touchcancel: INPUT_CANCEL\n };\n var SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';\n var SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';\n\n /**\n * Touch events input\n * @constructor\n * @extends Input\n */\n function SingleTouchInput() {\n this.evTarget = SINGLE_TOUCH_TARGET_EVENTS;\n this.evWin = SINGLE_TOUCH_WINDOW_EVENTS;\n this.started = false;\n Input.apply(this, arguments);\n }\n inherit(SingleTouchInput, Input, {\n handler: function TEhandler(ev) {\n var type = SINGLE_TOUCH_INPUT_MAP[ev.type];\n\n // should we handle the touch events?\n if (type === INPUT_START) {\n this.started = true;\n }\n if (!this.started) {\n return;\n }\n var touches = normalizeSingleTouches.call(this, ev, type);\n\n // when done, reset the started state\n if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {\n this.started = false;\n }\n this.callback(this.manager, type, {\n pointers: touches[0],\n changedPointers: touches[1],\n pointerType: INPUT_TYPE_TOUCH,\n srcEvent: ev\n });\n }\n });\n\n /**\n * @this {TouchInput}\n * @param {Object} ev\n * @param {Number} type flag\n * @returns {undefined|Array} [all, changed]\n */\n function normalizeSingleTouches(ev, type) {\n var all = toArray(ev.touches);\n var changed = toArray(ev.changedTouches);\n if (type & (INPUT_END | INPUT_CANCEL)) {\n all = uniqueArray(all.concat(changed), 'identifier', true);\n }\n return [all, changed];\n }\n var TOUCH_INPUT_MAP = {\n touchstart: INPUT_START,\n touchmove: INPUT_MOVE,\n touchend: INPUT_END,\n touchcancel: INPUT_CANCEL\n };\n var TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';\n\n /**\n * Multi-user touch events input\n * @constructor\n * @extends Input\n */\n function TouchInput() {\n this.evTarget = TOUCH_TARGET_EVENTS;\n this.targetIds = {};\n Input.apply(this, arguments);\n }\n inherit(TouchInput, Input, {\n handler: function MTEhandler(ev) {\n var type = TOUCH_INPUT_MAP[ev.type];\n var touches = getTouches.call(this, ev, type);\n if (!touches) {\n return;\n }\n this.callback(this.manager, type, {\n pointers: touches[0],\n changedPointers: touches[1],\n pointerType: INPUT_TYPE_TOUCH,\n srcEvent: ev\n });\n }\n });\n\n /**\n * @this {TouchInput}\n * @param {Object} ev\n * @param {Number} type flag\n * @returns {undefined|Array} [all, changed]\n */\n function getTouches(ev, type) {\n var allTouches = toArray(ev.touches);\n var targetIds = this.targetIds;\n\n // when there is only one touch, the process can be simplified\n if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {\n targetIds[allTouches[0].identifier] = true;\n return [allTouches, allTouches];\n }\n var i,\n targetTouches,\n changedTouches = toArray(ev.changedTouches),\n changedTargetTouches = [],\n target = this.target;\n\n // get target touches from touches\n targetTouches = allTouches.filter(function (touch) {\n return hasParent(touch.target, target);\n });\n\n // collect touches\n if (type === INPUT_START) {\n i = 0;\n while (i < targetTouches.length) {\n targetIds[targetTouches[i].identifier] = true;\n i++;\n }\n }\n\n // filter changed touches to only contain touches that exist in the collected target ids\n i = 0;\n while (i < changedTouches.length) {\n if (targetIds[changedTouches[i].identifier]) {\n changedTargetTouches.push(changedTouches[i]);\n }\n\n // cleanup removed touches\n if (type & (INPUT_END | INPUT_CANCEL)) {\n delete targetIds[changedTouches[i].identifier];\n }\n i++;\n }\n if (!changedTargetTouches.length) {\n return;\n }\n return [\n // merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'\n uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true), changedTargetTouches];\n }\n\n /**\n * Combined touch and mouse input\n *\n * Touch has a higher priority then mouse, and while touching no mouse events are allowed.\n * This because touch devices also emit mouse events while doing a touch.\n *\n * @constructor\n * @extends Input\n */\n\n var DEDUP_TIMEOUT = 2500;\n var DEDUP_DISTANCE = 25;\n function TouchMouseInput() {\n Input.apply(this, arguments);\n var handler = bindFn(this.handler, this);\n this.touch = new TouchInput(this.manager, handler);\n this.mouse = new MouseInput(this.manager, handler);\n this.primaryTouch = null;\n this.lastTouches = [];\n }\n inherit(TouchMouseInput, Input, {\n /**\n * handle mouse and touch events\n * @param {Hammer} manager\n * @param {String} inputEvent\n * @param {Object} inputData\n */\n handler: function TMEhandler(manager, inputEvent, inputData) {\n var isTouch = inputData.pointerType == INPUT_TYPE_TOUCH,\n isMouse = inputData.pointerType == INPUT_TYPE_MOUSE;\n if (isMouse && inputData.sourceCapabilities && inputData.sourceCapabilities.firesTouchEvents) {\n return;\n }\n\n // when we're in a touch event, record touches to de-dupe synthetic mouse event\n if (isTouch) {\n recordTouches.call(this, inputEvent, inputData);\n } else if (isMouse && isSyntheticEvent.call(this, inputData)) {\n return;\n }\n this.callback(manager, inputEvent, inputData);\n },\n /**\n * remove the event listeners\n */\n destroy: function destroy() {\n this.touch.destroy();\n this.mouse.destroy();\n }\n });\n function recordTouches(eventType, eventData) {\n if (eventType & INPUT_START) {\n this.primaryTouch = eventData.changedPointers[0].identifier;\n setLastTouch.call(this, eventData);\n } else if (eventType & (INPUT_END | INPUT_CANCEL)) {\n setLastTouch.call(this, eventData);\n }\n }\n function setLastTouch(eventData) {\n var touch = eventData.changedPointers[0];\n if (touch.identifier === this.primaryTouch) {\n var lastTouch = {\n x: touch.clientX,\n y: touch.clientY\n };\n this.lastTouches.push(lastTouch);\n var lts = this.lastTouches;\n var removeLastTouch = function () {\n var i = lts.indexOf(lastTouch);\n if (i > -1) {\n lts.splice(i, 1);\n }\n };\n setTimeout(removeLastTouch, DEDUP_TIMEOUT);\n }\n }\n function isSyntheticEvent(eventData) {\n var x = eventData.srcEvent.clientX,\n y = eventData.srcEvent.clientY;\n for (var i = 0; i < this.lastTouches.length; i++) {\n var t = this.lastTouches[i];\n var dx = Math.abs(x - t.x),\n dy = Math.abs(y - t.y);\n if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) {\n return true;\n }\n }\n return false;\n }\n var PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');\n var NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined;\n\n // magical touchAction value\n var TOUCH_ACTION_COMPUTE = 'compute';\n var TOUCH_ACTION_AUTO = 'auto';\n var TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented\n var TOUCH_ACTION_NONE = 'none';\n var TOUCH_ACTION_PAN_X = 'pan-x';\n var TOUCH_ACTION_PAN_Y = 'pan-y';\n var TOUCH_ACTION_MAP = getTouchActionProps();\n\n /**\n * Touch Action\n * sets the touchAction property or uses the js alternative\n * @param {Manager} manager\n * @param {String} value\n * @constructor\n */\n function TouchAction(manager, value) {\n this.manager = manager;\n this.set(value);\n }\n TouchAction.prototype = {\n /**\n * set the touchAction value on the element or enable the polyfill\n * @param {String} value\n */\n set: function (value) {\n // find out the touch-action by the event handlers\n if (value == TOUCH_ACTION_COMPUTE) {\n value = this.compute();\n }\n if (NATIVE_TOUCH_ACTION && this.manager.element.style && TOUCH_ACTION_MAP[value]) {\n this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;\n }\n this.actions = value.toLowerCase().trim();\n },\n /**\n * just re-set the touchAction value\n */\n update: function () {\n this.set(this.manager.options.touchAction);\n },\n /**\n * compute the value for the touchAction property based on the recognizer's settings\n * @returns {String} value\n */\n compute: function () {\n var actions = [];\n each(this.manager.recognizers, function (recognizer) {\n if (boolOrFn(recognizer.options.enable, [recognizer])) {\n actions = actions.concat(recognizer.getTouchAction());\n }\n });\n return cleanTouchActions(actions.join(' '));\n },\n /**\n * this method is called on each input cycle and provides the preventing of the browser behavior\n * @param {Object} input\n */\n preventDefaults: function (input) {\n var srcEvent = input.srcEvent;\n var direction = input.offsetDirection;\n\n // if the touch action did prevented once this session\n if (this.manager.session.prevented) {\n srcEvent.preventDefault();\n return;\n }\n var actions = this.actions;\n var hasNone = inStr(actions, TOUCH_ACTION_NONE) && !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE];\n var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y];\n var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X];\n if (hasNone) {\n //do not prevent defaults if this is a tap gesture\n\n var isTapPointer = input.pointers.length === 1;\n var isTapMovement = input.distance < 2;\n var isTapTouchTime = input.deltaTime < 250;\n if (isTapPointer && isTapMovement && isTapTouchTime) {\n return;\n }\n }\n if (hasPanX && hasPanY) {\n // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent\n return;\n }\n if (hasNone || hasPanY && direction & DIRECTION_HORIZONTAL || hasPanX && direction & DIRECTION_VERTICAL) {\n return this.preventSrc(srcEvent);\n }\n },\n /**\n * call preventDefault to prevent the browser's default behavior (scrolling in most cases)\n * @param {Object} srcEvent\n */\n preventSrc: function (srcEvent) {\n this.manager.session.prevented = true;\n srcEvent.preventDefault();\n }\n };\n\n /**\n * when the touchActions are collected they are not a valid value, so we need to clean things up. *\n * @param {String} actions\n * @returns {*}\n */\n function cleanTouchActions(actions) {\n // none\n if (inStr(actions, TOUCH_ACTION_NONE)) {\n return TOUCH_ACTION_NONE;\n }\n var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);\n var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);\n\n // if both pan-x and pan-y are set (different recognizers\n // for different directions, e.g. horizontal pan but vertical swipe?)\n // we need none (as otherwise with pan-x pan-y combined none of these\n // recognizers will work, since the browser would handle all panning\n if (hasPanX && hasPanY) {\n return TOUCH_ACTION_NONE;\n }\n\n // pan-x OR pan-y\n if (hasPanX || hasPanY) {\n return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;\n }\n\n // manipulation\n if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {\n return TOUCH_ACTION_MANIPULATION;\n }\n return TOUCH_ACTION_AUTO;\n }\n function getTouchActionProps() {\n if (!NATIVE_TOUCH_ACTION) {\n return false;\n }\n var touchMap = {};\n var cssSupports = window.CSS && window.CSS.supports;\n ['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach(function (val) {\n // If css.supports is not supported but there is native touch-action assume it supports\n // all values. This is the case for IE 10 and 11.\n touchMap[val] = cssSupports ? window.CSS.supports('touch-action', val) : true;\n });\n return touchMap;\n }\n\n /**\n * Recognizer flow explained; *\n * All recognizers have the initial state of POSSIBLE when a input session starts.\n * The definition of a input session is from the first input until the last input, with all it's movement in it. *\n * Example session for mouse-input: mousedown -> mousemove -> mouseup\n *\n * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed\n * which determines with state it should be.\n *\n * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to\n * POSSIBLE to give it another change on the next cycle.\n *\n * Possible\n * |\n * +-----+---------------+\n * | |\n * +-----+-----+ |\n * | | |\n * Failed Cancelled |\n * +-------+------+\n * | |\n * Recognized Began\n * |\n * Changed\n * |\n * Ended/Recognized\n */\n var STATE_POSSIBLE = 1;\n var STATE_BEGAN = 2;\n var STATE_CHANGED = 4;\n var STATE_ENDED = 8;\n var STATE_RECOGNIZED = STATE_ENDED;\n var STATE_CANCELLED = 16;\n var STATE_FAILED = 32;\n\n /**\n * Recognizer\n * Every recognizer needs to extend from this class.\n * @constructor\n * @param {Object} options\n */\n function Recognizer(options) {\n this.options = assign({}, this.defaults, options || {});\n this.id = uniqueId();\n this.manager = null;\n\n // default is enable true\n this.options.enable = ifUndefined(this.options.enable, true);\n this.state = STATE_POSSIBLE;\n this.simultaneous = {};\n this.requireFail = [];\n }\n Recognizer.prototype = {\n /**\n * @virtual\n * @type {Object}\n */\n defaults: {},\n /**\n * set options\n * @param {Object} options\n * @return {Recognizer}\n */\n set: function (options) {\n assign(this.options, options);\n\n // also update the touchAction, in case something changed about the directions/enabled state\n this.manager && this.manager.touchAction.update();\n return this;\n },\n /**\n * recognize simultaneous with an other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n recognizeWith: function (otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {\n return this;\n }\n var simultaneous = this.simultaneous;\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n if (!simultaneous[otherRecognizer.id]) {\n simultaneous[otherRecognizer.id] = otherRecognizer;\n otherRecognizer.recognizeWith(this);\n }\n return this;\n },\n /**\n * drop the simultaneous link. it doesnt remove the link on the other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n dropRecognizeWith: function (otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {\n return this;\n }\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n delete this.simultaneous[otherRecognizer.id];\n return this;\n },\n /**\n * recognizer can only run when an other is failing\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n requireFailure: function (otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {\n return this;\n }\n var requireFail = this.requireFail;\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n if (inArray(requireFail, otherRecognizer) === -1) {\n requireFail.push(otherRecognizer);\n otherRecognizer.requireFailure(this);\n }\n return this;\n },\n /**\n * drop the requireFailure link. it does not remove the link on the other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n dropRequireFailure: function (otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {\n return this;\n }\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n var index = inArray(this.requireFail, otherRecognizer);\n if (index > -1) {\n this.requireFail.splice(index, 1);\n }\n return this;\n },\n /**\n * has require failures boolean\n * @returns {boolean}\n */\n hasRequireFailures: function () {\n return this.requireFail.length > 0;\n },\n /**\n * if the recognizer can recognize simultaneous with an other recognizer\n * @param {Recognizer} otherRecognizer\n * @returns {Boolean}\n */\n canRecognizeWith: function (otherRecognizer) {\n return !!this.simultaneous[otherRecognizer.id];\n },\n /**\n * You should use `tryEmit` instead of `emit` directly to check\n * that all the needed recognizers has failed before emitting.\n * @param {Object} input\n */\n emit: function (input) {\n var self = this;\n var state = this.state;\n function emit(event) {\n self.manager.emit(event, input);\n }\n\n // 'panstart' and 'panmove'\n if (state < STATE_ENDED) {\n emit(self.options.event + stateStr(state));\n }\n emit(self.options.event); // simple 'eventName' events\n\n if (input.additionalEvent) {\n // additional event(panleft, panright, pinchin, pinchout...)\n emit(input.additionalEvent);\n }\n\n // panend and pancancel\n if (state >= STATE_ENDED) {\n emit(self.options.event + stateStr(state));\n }\n },\n /**\n * Check that all the require failure recognizers has failed,\n * if true, it emits a gesture event,\n * otherwise, setup the state to FAILED.\n * @param {Object} input\n */\n tryEmit: function (input) {\n if (this.canEmit()) {\n return this.emit(input);\n }\n // it's failing anyway\n this.state = STATE_FAILED;\n },\n /**\n * can we emit?\n * @returns {boolean}\n */\n canEmit: function () {\n var i = 0;\n while (i < this.requireFail.length) {\n if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {\n return false;\n }\n i++;\n }\n return true;\n },\n /**\n * update the recognizer\n * @param {Object} inputData\n */\n recognize: function (inputData) {\n // make a new copy of the inputData\n // so we can change the inputData without messing up the other recognizers\n var inputDataClone = assign({}, inputData);\n\n // is is enabled and allow recognizing?\n if (!boolOrFn(this.options.enable, [this, inputDataClone])) {\n this.reset();\n this.state = STATE_FAILED;\n return;\n }\n\n // reset when we've reached the end\n if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {\n this.state = STATE_POSSIBLE;\n }\n this.state = this.process(inputDataClone);\n\n // the recognizer has recognized a gesture\n // so trigger an event\n if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {\n this.tryEmit(inputDataClone);\n }\n },\n /**\n * return the state of the recognizer\n * the actual recognizing happens in this method\n * @virtual\n * @param {Object} inputData\n * @returns {Const} STATE\n */\n process: function (inputData) {},\n // jshint ignore:line\n\n /**\n * return the preferred touch-action\n * @virtual\n * @returns {Array}\n */\n getTouchAction: function () {},\n /**\n * called when the gesture isn't allowed to recognize\n * like when another is being recognized or it is disabled\n * @virtual\n */\n reset: function () {}\n };\n\n /**\n * get a usable string, used as event postfix\n * @param {Const} state\n * @returns {String} state\n */\n function stateStr(state) {\n if (state & STATE_CANCELLED) {\n return 'cancel';\n } else if (state & STATE_ENDED) {\n return 'end';\n } else if (state & STATE_CHANGED) {\n return 'move';\n } else if (state & STATE_BEGAN) {\n return 'start';\n }\n return '';\n }\n\n /**\n * direction cons to string\n * @param {Const} direction\n * @returns {String}\n */\n function directionStr(direction) {\n if (direction == DIRECTION_DOWN) {\n return 'down';\n } else if (direction == DIRECTION_UP) {\n return 'up';\n } else if (direction == DIRECTION_LEFT) {\n return 'left';\n } else if (direction == DIRECTION_RIGHT) {\n return 'right';\n }\n return '';\n }\n\n /**\n * get a recognizer by name if it is bound to a manager\n * @param {Recognizer|String} otherRecognizer\n * @param {Recognizer} recognizer\n * @returns {Recognizer}\n */\n function getRecognizerByNameIfManager(otherRecognizer, recognizer) {\n var manager = recognizer.manager;\n if (manager) {\n return manager.get(otherRecognizer);\n }\n return otherRecognizer;\n }\n\n /**\n * This recognizer is just used as a base for the simple attribute recognizers.\n * @constructor\n * @extends Recognizer\n */\n function AttrRecognizer() {\n Recognizer.apply(this, arguments);\n }\n inherit(AttrRecognizer, Recognizer, {\n /**\n * @namespace\n * @memberof AttrRecognizer\n */\n defaults: {\n /**\n * @type {Number}\n * @default 1\n */\n pointers: 1\n },\n /**\n * Used to check if it the recognizer receives valid input, like input.distance > 10.\n * @memberof AttrRecognizer\n * @param {Object} input\n * @returns {Boolean} recognized\n */\n attrTest: function (input) {\n var optionPointers = this.options.pointers;\n return optionPointers === 0 || input.pointers.length === optionPointers;\n },\n /**\n * Process the input and return the state for the recognizer\n * @memberof AttrRecognizer\n * @param {Object} input\n * @returns {*} State\n */\n process: function (input) {\n var state = this.state;\n var eventType = input.eventType;\n var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);\n var isValid = this.attrTest(input);\n\n // on cancel input and we've recognized before, return STATE_CANCELLED\n if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {\n return state | STATE_CANCELLED;\n } else if (isRecognized || isValid) {\n if (eventType & INPUT_END) {\n return state | STATE_ENDED;\n } else if (!(state & STATE_BEGAN)) {\n return STATE_BEGAN;\n }\n return state | STATE_CHANGED;\n }\n return STATE_FAILED;\n }\n });\n\n /**\n * Pan\n * Recognized when the pointer is down and moved in the allowed direction.\n * @constructor\n * @extends AttrRecognizer\n */\n function PanRecognizer() {\n AttrRecognizer.apply(this, arguments);\n this.pX = null;\n this.pY = null;\n }\n inherit(PanRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof PanRecognizer\n */\n defaults: {\n event: 'pan',\n threshold: 10,\n pointers: 1,\n direction: DIRECTION_ALL\n },\n getTouchAction: function () {\n var direction = this.options.direction;\n var actions = [];\n if (direction & DIRECTION_HORIZONTAL) {\n actions.push(TOUCH_ACTION_PAN_Y);\n }\n if (direction & DIRECTION_VERTICAL) {\n actions.push(TOUCH_ACTION_PAN_X);\n }\n return actions;\n },\n directionTest: function (input) {\n var options = this.options;\n var hasMoved = true;\n var distance = input.distance;\n var direction = input.direction;\n var x = input.deltaX;\n var y = input.deltaY;\n\n // lock to axis?\n if (!(direction & options.direction)) {\n if (options.direction & DIRECTION_HORIZONTAL) {\n direction = x === 0 ? DIRECTION_NONE : x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;\n hasMoved = x != this.pX;\n distance = Math.abs(input.deltaX);\n } else {\n direction = y === 0 ? DIRECTION_NONE : y < 0 ? DIRECTION_UP : DIRECTION_DOWN;\n hasMoved = y != this.pY;\n distance = Math.abs(input.deltaY);\n }\n }\n input.direction = direction;\n return hasMoved && distance > options.threshold && direction & options.direction;\n },\n attrTest: function (input) {\n return AttrRecognizer.prototype.attrTest.call(this, input) && (this.state & STATE_BEGAN || !(this.state & STATE_BEGAN) && this.directionTest(input));\n },\n emit: function (input) {\n this.pX = input.deltaX;\n this.pY = input.deltaY;\n var direction = directionStr(input.direction);\n if (direction) {\n input.additionalEvent = this.options.event + direction;\n }\n this._super.emit.call(this, input);\n }\n });\n\n /**\n * Pinch\n * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out).\n * @constructor\n * @extends AttrRecognizer\n */\n function PinchRecognizer() {\n AttrRecognizer.apply(this, arguments);\n }\n inherit(PinchRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof PinchRecognizer\n */\n defaults: {\n event: 'pinch',\n threshold: 0,\n pointers: 2\n },\n getTouchAction: function () {\n return [TOUCH_ACTION_NONE];\n },\n attrTest: function (input) {\n return this._super.attrTest.call(this, input) && (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);\n },\n emit: function (input) {\n if (input.scale !== 1) {\n var inOut = input.scale < 1 ? 'in' : 'out';\n input.additionalEvent = this.options.event + inOut;\n }\n this._super.emit.call(this, input);\n }\n });\n\n /**\n * Press\n * Recognized when the pointer is down for x ms without any movement.\n * @constructor\n * @extends Recognizer\n */\n function PressRecognizer() {\n Recognizer.apply(this, arguments);\n this._timer = null;\n this._input = null;\n }\n inherit(PressRecognizer, Recognizer, {\n /**\n * @namespace\n * @memberof PressRecognizer\n */\n defaults: {\n event: 'press',\n pointers: 1,\n time: 251,\n // minimal time of the pointer to be pressed\n threshold: 9 // a minimal movement is ok, but keep it low\n },\n getTouchAction: function () {\n return [TOUCH_ACTION_AUTO];\n },\n process: function (input) {\n var options = this.options;\n var validPointers = input.pointers.length === options.pointers;\n var validMovement = input.distance < options.threshold;\n var validTime = input.deltaTime > options.time;\n this._input = input;\n\n // we only allow little movement\n // and we've reached an end event, so a tap is possible\n if (!validMovement || !validPointers || input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime) {\n this.reset();\n } else if (input.eventType & INPUT_START) {\n this.reset();\n this._timer = setTimeoutContext(function () {\n this.state = STATE_RECOGNIZED;\n this.tryEmit();\n }, options.time, this);\n } else if (input.eventType & INPUT_END) {\n return STATE_RECOGNIZED;\n }\n return STATE_FAILED;\n },\n reset: function () {\n clearTimeout(this._timer);\n },\n emit: function (input) {\n if (this.state !== STATE_RECOGNIZED) {\n return;\n }\n if (input && input.eventType & INPUT_END) {\n this.manager.emit(this.options.event + 'up', input);\n } else {\n this._input.timeStamp = now();\n this.manager.emit(this.options.event, this._input);\n }\n }\n });\n\n /**\n * Rotate\n * Recognized when two or more pointer are moving in a circular motion.\n * @constructor\n * @extends AttrRecognizer\n */\n function RotateRecognizer() {\n AttrRecognizer.apply(this, arguments);\n }\n inherit(RotateRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof RotateRecognizer\n */\n defaults: {\n event: 'rotate',\n threshold: 0,\n pointers: 2\n },\n getTouchAction: function () {\n return [TOUCH_ACTION_NONE];\n },\n attrTest: function (input) {\n return this._super.attrTest.call(this, input) && (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);\n }\n });\n\n /**\n * Swipe\n * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction.\n * @constructor\n * @extends AttrRecognizer\n */\n function SwipeRecognizer() {\n AttrRecognizer.apply(this, arguments);\n }\n inherit(SwipeRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof SwipeRecognizer\n */\n defaults: {\n event: 'swipe',\n threshold: 10,\n velocity: 0.3,\n direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,\n pointers: 1\n },\n getTouchAction: function () {\n return PanRecognizer.prototype.getTouchAction.call(this);\n },\n attrTest: function (input) {\n var direction = this.options.direction;\n var velocity;\n if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {\n velocity = input.overallVelocity;\n } else if (direction & DIRECTION_HORIZONTAL) {\n velocity = input.overallVelocityX;\n } else if (direction & DIRECTION_VERTICAL) {\n velocity = input.overallVelocityY;\n }\n return this._super.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;\n },\n emit: function (input) {\n var direction = directionStr(input.offsetDirection);\n if (direction) {\n this.manager.emit(this.options.event + direction, input);\n }\n this.manager.emit(this.options.event, input);\n }\n });\n\n /**\n * A tap is ecognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur\n * between the given interval and position. The delay option can be used to recognize multi-taps without firing\n * a single tap.\n *\n * The eventData from the emitted event contains the property `tapCount`, which contains the amount of\n * multi-taps being recognized.\n * @constructor\n * @extends Recognizer\n */\n function TapRecognizer() {\n Recognizer.apply(this, arguments);\n\n // previous time and center,\n // used for tap counting\n this.pTime = false;\n this.pCenter = false;\n this._timer = null;\n this._input = null;\n this.count = 0;\n }\n inherit(TapRecognizer, Recognizer, {\n /**\n * @namespace\n * @memberof PinchRecognizer\n */\n defaults: {\n event: 'tap',\n pointers: 1,\n taps: 1,\n interval: 300,\n // max time between the multi-tap taps\n time: 250,\n // max time of the pointer to be down (like finger on the screen)\n threshold: 9,\n // a minimal movement is ok, but keep it low\n posThreshold: 10 // a multi-tap can be a bit off the initial position\n },\n getTouchAction: function () {\n return [TOUCH_ACTION_MANIPULATION];\n },\n process: function (input) {\n var options = this.options;\n var validPointers = input.pointers.length === options.pointers;\n var validMovement = input.distance < options.threshold;\n var validTouchTime = input.deltaTime < options.time;\n this.reset();\n if (input.eventType & INPUT_START && this.count === 0) {\n return this.failTimeout();\n }\n\n // we only allow little movement\n // and we've reached an end event, so a tap is possible\n if (validMovement && validTouchTime && validPointers) {\n if (input.eventType != INPUT_END) {\n return this.failTimeout();\n }\n var validInterval = this.pTime ? input.timeStamp - this.pTime < options.interval : true;\n var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;\n this.pTime = input.timeStamp;\n this.pCenter = input.center;\n if (!validMultiTap || !validInterval) {\n this.count = 1;\n } else {\n this.count += 1;\n }\n this._input = input;\n\n // if tap count matches we have recognized it,\n // else it has began recognizing...\n var tapCount = this.count % options.taps;\n if (tapCount === 0) {\n // no failing requirements, immediately trigger the tap event\n // or wait as long as the multitap interval to trigger\n if (!this.hasRequireFailures()) {\n return STATE_RECOGNIZED;\n } else {\n this._timer = setTimeoutContext(function () {\n this.state = STATE_RECOGNIZED;\n this.tryEmit();\n }, options.interval, this);\n return STATE_BEGAN;\n }\n }\n }\n return STATE_FAILED;\n },\n failTimeout: function () {\n this._timer = setTimeoutContext(function () {\n this.state = STATE_FAILED;\n }, this.options.interval, this);\n return STATE_FAILED;\n },\n reset: function () {\n clearTimeout(this._timer);\n },\n emit: function () {\n if (this.state == STATE_RECOGNIZED) {\n this._input.tapCount = this.count;\n this.manager.emit(this.options.event, this._input);\n }\n }\n });\n\n /**\n * Simple way to create a manager with a default set of recognizers.\n * @param {HTMLElement} element\n * @param {Object} [options]\n * @constructor\n */\n function Hammer(element, options) {\n options = options || {};\n options.recognizers = ifUndefined(options.recognizers, Hammer.defaults.preset);\n return new Manager(element, options);\n }\n\n /**\n * @const {string}\n */\n Hammer.VERSION = '2.0.7';\n\n /**\n * default settings\n * @namespace\n */\n Hammer.defaults = {\n /**\n * set if DOM events are being triggered.\n * But this is slower and unused by simple implementations, so disabled by default.\n * @type {Boolean}\n * @default false\n */\n domEvents: false,\n /**\n * The value for the touchAction property/fallback.\n * When set to `compute` it will magically set the correct value based on the added recognizers.\n * @type {String}\n * @default compute\n */\n touchAction: TOUCH_ACTION_COMPUTE,\n /**\n * @type {Boolean}\n * @default true\n */\n enable: true,\n /**\n * EXPERIMENTAL FEATURE -- can be removed/changed\n * Change the parent input target element.\n * If Null, then it is being set the to main element.\n * @type {Null|EventTarget}\n * @default null\n */\n inputTarget: null,\n /**\n * force an input class\n * @type {Null|Function}\n * @default null\n */\n inputClass: null,\n /**\n * Default recognizer setup when calling `Hammer()`\n * When creating a new Manager these will be skipped.\n * @type {Array}\n */\n preset: [\n // RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...]\n [RotateRecognizer, {\n enable: false\n }], [PinchRecognizer, {\n enable: false\n }, ['rotate']], [SwipeRecognizer, {\n direction: DIRECTION_HORIZONTAL\n }], [PanRecognizer, {\n direction: DIRECTION_HORIZONTAL\n }, ['swipe']], [TapRecognizer], [TapRecognizer, {\n event: 'doubletap',\n taps: 2\n }, ['tap']], [PressRecognizer]],\n /**\n * Some CSS properties can be used to improve the working of Hammer.\n * Add them to this method and they will be set when creating a new Manager.\n * @namespace\n */\n cssProps: {\n /**\n * Disables text selection to improve the dragging gesture. Mainly for desktop browsers.\n * @type {String}\n * @default 'none'\n */\n userSelect: 'none',\n /**\n * Disable the Windows Phone grippers when pressing an element.\n * @type {String}\n * @default 'none'\n */\n touchSelect: 'none',\n /**\n * Disables the default callout shown when you touch and hold a touch target.\n * On iOS, when you touch and hold a touch target such as a link, Safari displays\n * a callout containing information about the link. This property allows you to disable that callout.\n * @type {String}\n * @default 'none'\n */\n touchCallout: 'none',\n /**\n * Specifies whether zooming is enabled. Used by IE10>\n * @type {String}\n * @default 'none'\n */\n contentZooming: 'none',\n /**\n * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.\n * @type {String}\n * @default 'none'\n */\n userDrag: 'none',\n /**\n * Overrides the highlight color shown when the user taps a link or a JavaScript\n * clickable element in iOS. This property obeys the alpha value, if specified.\n * @type {String}\n * @default 'rgba(0,0,0,0)'\n */\n tapHighlightColor: 'rgba(0,0,0,0)'\n }\n };\n var STOP = 1;\n var FORCED_STOP = 2;\n\n /**\n * Manager\n * @param {HTMLElement} element\n * @param {Object} [options]\n * @constructor\n */\n function Manager(element, options) {\n this.options = assign({}, Hammer.defaults, options || {});\n this.options.inputTarget = this.options.inputTarget || element;\n this.handlers = {};\n this.session = {};\n this.recognizers = [];\n this.oldCssProps = {};\n this.element = element;\n this.input = createInputInstance(this);\n this.touchAction = new TouchAction(this, this.options.touchAction);\n toggleCssProps(this, true);\n each(this.options.recognizers, function (item) {\n var recognizer = this.add(new item[0](item[1]));\n item[2] && recognizer.recognizeWith(item[2]);\n item[3] && recognizer.requireFailure(item[3]);\n }, this);\n }\n Manager.prototype = {\n /**\n * set options\n * @param {Object} options\n * @returns {Manager}\n */\n set: function (options) {\n assign(this.options, options);\n\n // Options that need a little more setup\n if (options.touchAction) {\n this.touchAction.update();\n }\n if (options.inputTarget) {\n // Clean up existing event listeners and reinitialize\n this.input.destroy();\n this.input.target = options.inputTarget;\n this.input.init();\n }\n return this;\n },\n /**\n * stop recognizing for this session.\n * This session will be discarded, when a new [input]start event is fired.\n * When forced, the recognizer cycle is stopped immediately.\n * @param {Boolean} [force]\n */\n stop: function (force) {\n this.session.stopped = force ? FORCED_STOP : STOP;\n },\n /**\n * run the recognizers!\n * called by the inputHandler function on every movement of the pointers (touches)\n * it walks through all the recognizers and tries to detect the gesture that is being made\n * @param {Object} inputData\n */\n recognize: function (inputData) {\n var session = this.session;\n if (session.stopped) {\n return;\n }\n\n // run the touch-action polyfill\n this.touchAction.preventDefaults(inputData);\n var recognizer;\n var recognizers = this.recognizers;\n\n // this holds the recognizer that is being recognized.\n // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED\n // if no recognizer is detecting a thing, it is set to `null`\n var curRecognizer = session.curRecognizer;\n\n // reset when the last recognizer is recognized\n // or when we're in a new session\n if (!curRecognizer || curRecognizer && curRecognizer.state & STATE_RECOGNIZED) {\n curRecognizer = session.curRecognizer = null;\n }\n var i = 0;\n while (i < recognizers.length) {\n recognizer = recognizers[i];\n\n // find out if we are allowed try to recognize the input for this one.\n // 1. allow if the session is NOT forced stopped (see the .stop() method)\n // 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one\n // that is being recognized.\n // 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer.\n // this can be setup with the `recognizeWith()` method on the recognizer.\n if (session.stopped !== FORCED_STOP && (\n // 1\n !curRecognizer || recognizer == curRecognizer ||\n // 2\n recognizer.canRecognizeWith(curRecognizer))) {\n // 3\n recognizer.recognize(inputData);\n } else {\n recognizer.reset();\n }\n\n // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the\n // current active recognizer. but only if we don't already have an active recognizer\n if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {\n curRecognizer = session.curRecognizer = recognizer;\n }\n i++;\n }\n },\n /**\n * get a recognizer by its event name.\n * @param {Recognizer|String} recognizer\n * @returns {Recognizer|Null}\n */\n get: function (recognizer) {\n if (recognizer instanceof Recognizer) {\n return recognizer;\n }\n var recognizers = this.recognizers;\n for (var i = 0; i < recognizers.length; i++) {\n if (recognizers[i].options.event == recognizer) {\n return recognizers[i];\n }\n }\n return null;\n },\n /**\n * add a recognizer to the manager\n * existing recognizers with the same event name will be removed\n * @param {Recognizer} recognizer\n * @returns {Recognizer|Manager}\n */\n add: function (recognizer) {\n if (invokeArrayArg(recognizer, 'add', this)) {\n return this;\n }\n\n // remove existing\n var existing = this.get(recognizer.options.event);\n if (existing) {\n this.remove(existing);\n }\n this.recognizers.push(recognizer);\n recognizer.manager = this;\n this.touchAction.update();\n return recognizer;\n },\n /**\n * remove a recognizer by name or instance\n * @param {Recognizer|String} recognizer\n * @returns {Manager}\n */\n remove: function (recognizer) {\n if (invokeArrayArg(recognizer, 'remove', this)) {\n return this;\n }\n recognizer = this.get(recognizer);\n\n // let's make sure this recognizer exists\n if (recognizer) {\n var recognizers = this.recognizers;\n var index = inArray(recognizers, recognizer);\n if (index !== -1) {\n recognizers.splice(index, 1);\n this.touchAction.update();\n }\n }\n return this;\n },\n /**\n * bind event\n * @param {String} events\n * @param {Function} handler\n * @returns {EventEmitter} this\n */\n on: function (events, handler) {\n if (events === undefined) {\n return;\n }\n if (handler === undefined) {\n return;\n }\n var handlers = this.handlers;\n each(splitStr(events), function (event) {\n handlers[event] = handlers[event] || [];\n handlers[event].push(handler);\n });\n return this;\n },\n /**\n * unbind event, leave emit blank to remove all handlers\n * @param {String} events\n * @param {Function} [handler]\n * @returns {EventEmitter} this\n */\n off: function (events, handler) {\n if (events === undefined) {\n return;\n }\n var handlers = this.handlers;\n each(splitStr(events), function (event) {\n if (!handler) {\n delete handlers[event];\n } else {\n handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);\n }\n });\n return this;\n },\n /**\n * emit event to the listeners\n * @param {String} event\n * @param {Object} data\n */\n emit: function (event, data) {\n // we also want to trigger dom events\n if (this.options.domEvents) {\n triggerDomEvent(event, data);\n }\n\n // no handlers, so skip it all\n var handlers = this.handlers[event] && this.handlers[event].slice();\n if (!handlers || !handlers.length) {\n return;\n }\n data.type = event;\n data.preventDefault = function () {\n data.srcEvent.preventDefault();\n };\n var i = 0;\n while (i < handlers.length) {\n handlers[i](data);\n i++;\n }\n },\n /**\n * destroy the manager and unbinds all events\n * it doesn't unbind dom events, that is the user own responsibility\n */\n destroy: function () {\n this.element && toggleCssProps(this, false);\n this.handlers = {};\n this.session = {};\n this.input.destroy();\n this.element = null;\n }\n };\n\n /**\n * add/remove the css properties as defined in manager.options.cssProps\n * @param {Manager} manager\n * @param {Boolean} add\n */\n function toggleCssProps(manager, add) {\n var element = manager.element;\n if (!element.style) {\n return;\n }\n var prop;\n each(manager.options.cssProps, function (value, name) {\n prop = prefixed(element.style, name);\n if (add) {\n manager.oldCssProps[prop] = element.style[prop];\n element.style[prop] = value;\n } else {\n element.style[prop] = manager.oldCssProps[prop] || '';\n }\n });\n if (!add) {\n manager.oldCssProps = {};\n }\n }\n\n /**\n * trigger dom event\n * @param {String} event\n * @param {Object} data\n */\n function triggerDomEvent(event, data) {\n var gestureEvent = document.createEvent('Event');\n gestureEvent.initEvent(event, true, true);\n gestureEvent.gesture = data;\n data.target.dispatchEvent(gestureEvent);\n }\n assign(Hammer, {\n INPUT_START: INPUT_START,\n INPUT_MOVE: INPUT_MOVE,\n INPUT_END: INPUT_END,\n INPUT_CANCEL: INPUT_CANCEL,\n STATE_POSSIBLE: STATE_POSSIBLE,\n STATE_BEGAN: STATE_BEGAN,\n STATE_CHANGED: STATE_CHANGED,\n STATE_ENDED: STATE_ENDED,\n STATE_RECOGNIZED: STATE_RECOGNIZED,\n STATE_CANCELLED: STATE_CANCELLED,\n STATE_FAILED: STATE_FAILED,\n DIRECTION_NONE: DIRECTION_NONE,\n DIRECTION_LEFT: DIRECTION_LEFT,\n DIRECTION_RIGHT: DIRECTION_RIGHT,\n DIRECTION_UP: DIRECTION_UP,\n DIRECTION_DOWN: DIRECTION_DOWN,\n DIRECTION_HORIZONTAL: DIRECTION_HORIZONTAL,\n DIRECTION_VERTICAL: DIRECTION_VERTICAL,\n DIRECTION_ALL: DIRECTION_ALL,\n Manager: Manager,\n Input: Input,\n TouchAction: TouchAction,\n TouchInput: TouchInput,\n MouseInput: MouseInput,\n PointerEventInput: PointerEventInput,\n TouchMouseInput: TouchMouseInput,\n SingleTouchInput: SingleTouchInput,\n Recognizer: Recognizer,\n AttrRecognizer: AttrRecognizer,\n Tap: TapRecognizer,\n Pan: PanRecognizer,\n Swipe: SwipeRecognizer,\n Pinch: PinchRecognizer,\n Rotate: RotateRecognizer,\n Press: PressRecognizer,\n on: addEventListeners,\n off: removeEventListeners,\n each: each,\n merge: merge,\n extend: extend,\n assign: assign,\n inherit: inherit,\n bindFn: bindFn,\n prefixed: prefixed\n });\n\n // this prevents errors when Hammer is loaded in the presence of an AMD\n // style loader but by script tag, not by the loader.\n var freeGlobal = typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}; // jshint ignore:line\n freeGlobal.Hammer = Hammer;\n if (typeof define === 'function' && define.amd) {\n define(function () {\n return Hammer;\n });\n } else if (typeof module != 'undefined' && module.exports) {\n module.exports = Hammer;\n } else {\n window[exportName] = Hammer;\n }\n})(window, document, 'Hammer');","var g;\n\n// This works in non-strict mode\ng = function () {\n return this;\n}();\ntry {\n // This works if eval is allowed (see CSP)\n g = g || new Function(\"return this\")();\n} catch (e) {\n // This works if the window reference is available\n if (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;","import * as React from \"react\";\n\nexport default ({error, resetErrorBoundary}): JSX.Element => {\n return (\n \n
Something went wrong:
\n
{error.message}
\n
\n
\n )\n};\n","\"use client\";\n\nconst _excluded = [\"as\", \"bsPrefix\", \"className\"],\n _excluded2 = [\"className\"];\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\nimport classNames from 'classnames';\nimport * as React from 'react';\nimport { useBootstrapPrefix, useBootstrapBreakpoints, useBootstrapMinBreakpoint } from './ThemeProvider';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport function useCol(_ref) {\n let as = _ref.as,\n bsPrefix = _ref.bsPrefix,\n className = _ref.className,\n props = _objectWithoutProperties(_ref, _excluded);\n bsPrefix = useBootstrapPrefix(bsPrefix, 'col');\n const breakpoints = useBootstrapBreakpoints();\n const minBreakpoint = useBootstrapMinBreakpoint();\n const spans = [];\n const classes = [];\n breakpoints.forEach(brkPoint => {\n const propValue = props[brkPoint];\n delete props[brkPoint];\n let span;\n let offset;\n let order;\n if (typeof propValue === 'object' && propValue != null) {\n span = propValue.span;\n offset = propValue.offset;\n order = propValue.order;\n } else {\n span = propValue;\n }\n const infix = brkPoint !== minBreakpoint ? `-${brkPoint}` : '';\n if (span) spans.push(span === true ? `${bsPrefix}${infix}` : `${bsPrefix}${infix}-${span}`);\n if (order != null) classes.push(`order${infix}-${order}`);\n if (offset != null) classes.push(`offset${infix}-${offset}`);\n });\n return [_objectSpread(_objectSpread({}, props), {}, {\n className: classNames(className, ...spans, ...classes)\n }), {\n as,\n bsPrefix,\n spans\n }];\n}\nconst Col = /*#__PURE__*/React.forwardRef(\n// Need to define the default \"as\" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595\n(props, ref) => {\n const _useCol = useCol(props),\n _useCol2 = _slicedToArray(_useCol, 2),\n _useCol2$ = _useCol2[0],\n className = _useCol2$.className,\n colProps = _objectWithoutProperties(_useCol2$, _excluded2),\n _useCol2$2 = _useCol2[1],\n _useCol2$2$as = _useCol2$2.as,\n Component = _useCol2$2$as === void 0 ? 'div' : _useCol2$2$as,\n bsPrefix = _useCol2$2.bsPrefix,\n spans = _useCol2$2.spans;\n return /*#__PURE__*/_jsx(Component, _objectSpread(_objectSpread({}, colProps), {}, {\n ref: ref,\n className: classNames(className, !spans.length && bsPrefix)\n }));\n});\nCol.displayName = 'Col';\nexport default Col;","function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return (module.exports = _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports), _typeof(o);\n}\nmodule.exports = _typeof, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","import * as React from \"react\";\nimport {forwardRef, useImperativeHandle, useRef} from \"react\";\n\nimport {Chart, registerables, TimeScale, Tooltip} from \"chart.js\";\nimport {Line} from \"react-chartjs-2\";\nimport 'chartjs-adapter-date-fns';\nimport zoomPlugin from 'chartjs-plugin-zoom'\nimport CursorPlugin from \"./cursor\";\nimport {buildTicksForTimeWindow} from \"./DsMonitoringUtils\";\n\nChart.register(\n ...registerables,\n zoomPlugin,\n CursorPlugin\n);\n\nTooltip.positioners['topLeft'] = function () {\n // This callback can actually expect elements and eventPosition parameters but we have no use for them\n const chart = this.chart;\n return {\n x: chart.chartArea.left,\n y: 0,\n xAlign: 'left',\n yAlign: 'top',\n };\n};\n\ntype DsDynoChartProps = {\n datasets: [],\n onZoomStart?: (Chart) => any,\n onZoom?: (Chart) => any,\n onZoomComplete?: (Chart) => any,\n};\n\nconst DsDynoChart = forwardRef(\n ({\n datasets,\n onZoomStart,\n onZoom,\n onZoomComplete,\n }: DsDynoChartProps,\n ref\n ): JSX.Element => {\n const chartRef = useRef(null);\n\n useImperativeHandle(ref, () => ({\n\n resetZoom() {\n chartRef.current.resetZoom();\n },\n\n getZoom() {\n console.log(`DsDynoChart.getZoom`)\n const xScale = chartRef?.current?.scales?.x;\n return {\n min: xScale?.min,\n max: xScale?.max,\n };\n },\n\n setZoom(min, max) {\n console.log(`DsDynoChart.setZoom(${min}, ${max})`);\n const scale = chartRef.current?.scales?.x;\n if (!scale) {\n console.log(`\\t return - scale is ${scale}`);\n return;\n }\n if (scale.min === undefined ||\n scale.max === undefined) {\n console.log(`\\t return - scale.min:${scale.min} scale.max:${scale.max}`);\n return;\n }\n if (scale.min === min && scale.max === max) {\n console.log(`\\t return - both min and max didn't change`);\n return;\n }\n chartRef.current.zoomScale('x', {min: min, max: max});\n },\n\n }));\n\n return (\n \n `${(item.parsed.y)} dyno${item.parsed.y >= 1 && 's'}`,\n },\n },\n zoom: {\n limits: {\n x: {\n min: 'original',\n max: 'original',\n minRange: 5 * 60 * 1000, // 10 minutes\n }\n },\n zoom: {\n wheel: {\n enabled: true,\n },\n drag: {\n enabled: true,\n },\n pinch: {\n enabled: true\n },\n mode: 'x',\n onZoomStart,\n onZoom,\n onZoomComplete\n },\n },\n },\n }}\n />\n
\n );\n });\n\nexport default DsDynoChart;\n","import * as React from \"react\";\nimport {forwardRef, useImperativeHandle, useRef} from \"react\";\n\nimport {Chart, registerables, TimeScale, Tooltip} from \"chart.js\";\nimport {Line} from \"react-chartjs-2\";\nimport 'chartjs-adapter-date-fns';\nimport zoomPlugin from 'chartjs-plugin-zoom'\nimport CursorPlugin from \"./cursor\";\nimport {buildTicksForTimeWindow} from \"./DsMonitoringUtils\";\n\nChart.register(\n ...registerables,\n zoomPlugin,\n CursorPlugin\n);\n\nTooltip.positioners['topLeft'] = function (elements, eventPosition) {\n // This callback can actually expect elements and eventPosition parameters but we have no use for them\n const chart = this.chart;\n return {\n x: chart.chartArea.left,\n y: 0,\n xAlign: 'left',\n yAlign: 'top',\n };\n};\n\ntype DsQueueChartProps = {\n datasets: [],\n onZoomStart?: (Chart) => any,\n onZoom?: (Chart) => any,\n onZoomComplete?: (Chart) => any,\n};\n\nconst DsQueueChart = forwardRef(\n ({\n datasets,\n onZoomStart,\n onZoom,\n onZoomComplete,\n }: DsQueueChartProps,\n ref\n ): JSX.Element => {\n const chartRef = useRef(null);\n\n useImperativeHandle(ref, () => ({\n\n resetZoom() {\n chartRef.current.resetZoom();\n },\n\n getZoom() {\n console.log(`DsQueueChart.getZoom`)\n const xScale = chartRef?.current?.scales?.x;\n return {min: xScale?.min, max: xScale?.max,};\n },\n\n setZoom(min, max) {\n console.log(`DsQueueChart.setZoom(${min}, ${max})`);\n const scale = chartRef.current?.scales?.x;\n if (!scale) {\n console.log(`\\t return - scale is ${scale}`);\n return;\n }\n if (scale.min === undefined ||\n scale.max === undefined) {\n console.log(`\\t return - scale.min:${scale.min} scale.max:${scale.max}`);\n return;\n }\n if (scale.min === min && scale.max === max) {\n console.log(`\\t return - both min and max didn't change`);\n return;\n }\n chartRef.current.zoomScale('x', {min: min, max: max});\n },\n\n }));\n\n return (\n \n \n
\n );\n\n });\n\nexport default DsQueueChart;\n","'use strict';\n\nexport default function bind(fn, thisArg) {\n return function wrap() {\n return fn.apply(thisArg, arguments);\n };\n}","// eslint-disable-next-line strict\nexport default null;","\"use client\";\n\nconst _excluded = [\"bsPrefix\", \"className\", \"as\"];\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\nimport classNames from 'classnames';\nimport * as React from 'react';\nimport { useBootstrapPrefix, useBootstrapBreakpoints, useBootstrapMinBreakpoint } from './ThemeProvider';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst Row = /*#__PURE__*/React.forwardRef((_ref, ref) => {\n let bsPrefix = _ref.bsPrefix,\n className = _ref.className,\n _ref$as = _ref.as,\n Component = _ref$as === void 0 ? 'div' : _ref$as,\n props = _objectWithoutProperties(_ref, _excluded);\n const decoratedBsPrefix = useBootstrapPrefix(bsPrefix, 'row');\n const breakpoints = useBootstrapBreakpoints();\n const minBreakpoint = useBootstrapMinBreakpoint();\n const sizePrefix = `${decoratedBsPrefix}-cols`;\n const classes = [];\n breakpoints.forEach(brkPoint => {\n const propValue = props[brkPoint];\n delete props[brkPoint];\n let cols;\n if (propValue != null && typeof propValue === 'object') {\n cols = propValue.cols;\n } else {\n cols = propValue;\n }\n const infix = brkPoint !== minBreakpoint ? `-${brkPoint}` : '';\n if (cols != null) classes.push(`${sizePrefix}${infix}-${cols}`);\n });\n return /*#__PURE__*/_jsx(Component, _objectSpread(_objectSpread({\n ref: ref\n }, props), {}, {\n className: classNames(className, decoratedBsPrefix, ...classes)\n }));\n});\nRow.displayName = 'Row';\nexport default Row;","const _excluded = [\"height\", \"width\", \"redraw\", \"datasetIdKey\", \"type\", \"data\", \"options\", \"plugins\", \"fallbackContent\", \"updateMode\"];\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport React, { forwardRef, useRef, useEffect } from 'react';\nimport { Chart as Chart$1, LineController, BarController, RadarController, DoughnutController, PolarAreaController, BubbleController, PieController, ScatterController } from 'chart.js';\nconst defaultDatasetIdKey = 'label';\nfunction reforwardRef(ref, value) {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref) {\n ref.current = value;\n }\n}\nfunction setOptions(chart, nextOptions) {\n Object.assign(chart.options, nextOptions);\n}\nfunction setLabels(currentData, nextLabels) {\n currentData.labels = nextLabels;\n}\nfunction setDatasets(currentData, nextDatasets) {\n let datasetIdKey = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : defaultDatasetIdKey;\n const addedDatasets = [];\n currentData.datasets = nextDatasets.map(nextDataset => {\n // given the new set, find it's current match\n const currentDataset = currentData.datasets.find(dataset => dataset[datasetIdKey] === nextDataset[datasetIdKey]);\n // There is no original to update, so simply add new one\n if (!currentDataset || !nextDataset.data || addedDatasets.includes(currentDataset)) {\n return _objectSpread({}, nextDataset);\n }\n addedDatasets.push(currentDataset);\n Object.assign(currentDataset, nextDataset);\n return currentDataset;\n });\n}\nfunction cloneData(data) {\n let datasetIdKey = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : defaultDatasetIdKey;\n const nextData = {\n labels: [],\n datasets: []\n };\n setLabels(nextData, data.labels);\n setDatasets(nextData, data.datasets, datasetIdKey);\n return nextData;\n}\n/**\n * Get dataset from mouse click event\n * @param chart - Chart.js instance\n * @param event - Mouse click event\n * @returns Dataset\n */\nfunction getDatasetAtEvent(chart, event) {\n return chart.getElementsAtEventForMode(event.nativeEvent, 'dataset', {\n intersect: true\n }, false);\n}\n/**\n * Get single dataset element from mouse click event\n * @param chart - Chart.js instance\n * @param event - Mouse click event\n * @returns Dataset\n */\nfunction getElementAtEvent(chart, event) {\n return chart.getElementsAtEventForMode(event.nativeEvent, 'nearest', {\n intersect: true\n }, false);\n}\n/**\n * Get all dataset elements from mouse click event\n * @param chart - Chart.js instance\n * @param event - Mouse click event\n * @returns Dataset\n */\nfunction getElementsAtEvent(chart, event) {\n return chart.getElementsAtEventForMode(event.nativeEvent, 'index', {\n intersect: true\n }, false);\n}\nfunction ChartComponent(param, ref) {\n let _param$height = param.height,\n height = _param$height === void 0 ? 150 : _param$height,\n _param$width = param.width,\n width = _param$width === void 0 ? 300 : _param$width,\n _param$redraw = param.redraw,\n redraw = _param$redraw === void 0 ? false : _param$redraw,\n datasetIdKey = param.datasetIdKey,\n type = param.type,\n data = param.data,\n options = param.options,\n _param$plugins = param.plugins,\n plugins = _param$plugins === void 0 ? [] : _param$plugins,\n fallbackContent = param.fallbackContent,\n updateMode = param.updateMode,\n props = _objectWithoutProperties(param, _excluded);\n const canvasRef = useRef(null);\n const chartRef = useRef();\n const renderChart = () => {\n if (!canvasRef.current) return;\n chartRef.current = new Chart$1(canvasRef.current, {\n type,\n data: cloneData(data, datasetIdKey),\n options: options && _objectSpread({}, options),\n plugins\n });\n reforwardRef(ref, chartRef.current);\n };\n const destroyChart = () => {\n reforwardRef(ref, null);\n if (chartRef.current) {\n chartRef.current.destroy();\n chartRef.current = null;\n }\n };\n useEffect(() => {\n if (!redraw && chartRef.current && options) {\n setOptions(chartRef.current, options);\n }\n }, [redraw, options]);\n useEffect(() => {\n if (!redraw && chartRef.current) {\n setLabels(chartRef.current.config.data, data.labels);\n }\n }, [redraw, data.labels]);\n useEffect(() => {\n if (!redraw && chartRef.current && data.datasets) {\n setDatasets(chartRef.current.config.data, data.datasets, datasetIdKey);\n }\n }, [redraw, data.datasets]);\n useEffect(() => {\n if (!chartRef.current) return;\n if (redraw) {\n destroyChart();\n setTimeout(renderChart);\n } else {\n chartRef.current.update(updateMode);\n }\n }, [redraw, options, data.labels, data.datasets, updateMode]);\n useEffect(() => {\n if (!chartRef.current) return;\n destroyChart();\n setTimeout(renderChart);\n }, [type]);\n useEffect(() => {\n renderChart();\n return () => destroyChart();\n }, []);\n return /*#__PURE__*/React.createElement(\"canvas\", Object.assign({\n ref: canvasRef,\n role: \"img\",\n height: height,\n width: width\n }, props), fallbackContent);\n}\nconst Chart = /*#__PURE__*/forwardRef(ChartComponent);\nfunction createTypedChart(type, registerables) {\n Chart$1.register(registerables);\n return /*#__PURE__*/forwardRef((props, ref) => /*#__PURE__*/React.createElement(Chart, Object.assign({}, props, {\n ref: ref,\n type: type\n })));\n}\nconst Line = /* #__PURE__ */createTypedChart('line', LineController);\nconst Bar = /* #__PURE__ */createTypedChart('bar', BarController);\nconst Radar = /* #__PURE__ */createTypedChart('radar', RadarController);\nconst Doughnut = /* #__PURE__ */createTypedChart('doughnut', DoughnutController);\nconst PolarArea = /* #__PURE__ */createTypedChart('polarArea', PolarAreaController);\nconst Bubble = /* #__PURE__ */createTypedChart('bubble', BubbleController);\nconst Pie = /* #__PURE__ */createTypedChart('pie', PieController);\nconst Scatter = /* #__PURE__ */createTypedChart('scatter', ScatterController);\nexport { Bar, Bubble, Chart, Doughnut, Line, Pie, PolarArea, Radar, Scatter, getDatasetAtEvent, getElementAtEvent, getElementsAtEvent };","export default function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n return target;\n}","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n}","/*!\n* chartjs-plugin-zoom v1.2.1\n* undefined\n * (c) 2016-2022 chartjs-plugin-zoom Contributors\n * Released under the MIT License\n */\nimport Hammer from 'hammerjs';\nimport { each, valueOrDefault, callback, sign } from 'chart.js/helpers';\nconst getModifierKey = opts => opts && opts.enabled && opts.modifierKey;\nconst keyPressed = (key, event) => key && event[key + 'Key'];\nconst keyNotPressed = (key, event) => key && !event[key + 'Key'];\n\n/**\n * @param {string|function} mode can be 'x', 'y' or 'xy'\n * @param {string} dir can be 'x' or 'y'\n * @param {import('chart.js').Chart} chart instance of the chart in question\n * @returns {boolean}\n */\nfunction directionEnabled(mode, dir, chart) {\n if (mode === undefined) {\n return true;\n } else if (typeof mode === 'string') {\n return mode.indexOf(dir) !== -1;\n } else if (typeof mode === 'function') {\n return mode({\n chart\n }).indexOf(dir) !== -1;\n }\n return false;\n}\n\n/**\n * Debounces calling `fn` for `delay` ms\n * @param {function} fn - Function to call. No arguments are passed.\n * @param {number} delay - Delay in ms. 0 = immediate invocation.\n * @returns {function}\n */\nfunction debounce(fn, delay) {\n let timeout;\n return function () {\n clearTimeout(timeout);\n timeout = setTimeout(fn, delay);\n return delay;\n };\n}\n\n/** This function use for check what axis now under mouse cursor.\n * @param {{x: number, y: number}} point - the mouse location\n * @param {import('chart.js').Chart} [chart] instance of the chart in question\n * @return {import('chart.js').Scale}\n */\nfunction getScaleUnderPoint(_ref, chart) {\n let x = _ref.x,\n y = _ref.y;\n const scales = chart.scales;\n const scaleIds = Object.keys(scales);\n for (let i = 0; i < scaleIds.length; i++) {\n const scale = scales[scaleIds[i]];\n if (y >= scale.top && y <= scale.bottom && x >= scale.left && x <= scale.right) {\n return scale;\n }\n }\n return null;\n}\n\n/** This function return only one scale whose position is under mouse cursor and which direction is enabled.\n * If under mouse hasn't scale, then return all other scales which 'mode' is diffrent with overScaleMode.\n * So 'overScaleMode' works as a limiter to scale the user-selected scale (in 'mode') only when the cursor is under the scale,\n * and other directions in 'mode' works as before.\n * Example: mode = 'xy', overScaleMode = 'y' -> it's means 'x' - works as before, and 'y' only works for one scale when cursor is under it.\n * options.overScaleMode can be a function if user want zoom only one scale of many for example.\n * @param {string} mode - 'xy', 'x' or 'y'\n * @param {{x: number, y: number}} point - the mouse location\n * @param {import('chart.js').Chart} [chart] instance of the chart in question\n * @return {import('chart.js').Scale[]}\n */\nfunction getEnabledScalesByPoint(mode, point, chart) {\n const scale = getScaleUnderPoint(point, chart);\n if (scale && directionEnabled(mode, scale.axis, chart)) {\n return [scale];\n }\n const enabledScales = [];\n each(chart.scales, function (scaleItem) {\n if (!directionEnabled(mode, scaleItem.axis, chart)) {\n enabledScales.push(scaleItem);\n }\n });\n return enabledScales;\n}\nconst chartStates = new WeakMap();\nfunction getState(chart) {\n let state = chartStates.get(chart);\n if (!state) {\n state = {\n originalScaleLimits: {},\n updatedScaleLimits: {},\n handlers: {},\n panDelta: {}\n };\n chartStates.set(chart, state);\n }\n return state;\n}\nfunction removeState(chart) {\n chartStates.delete(chart);\n}\nfunction zoomDelta(scale, zoom, center) {\n const range = scale.max - scale.min;\n const newRange = range * (zoom - 1);\n const centerPoint = scale.isHorizontal() ? center.x : center.y;\n // `scale.getValueForPixel()` can return a value less than the `scale.min` or\n // greater than `scale.max` when `centerPoint` is outside chartArea.\n const minPercent = Math.max(0, Math.min(1, (scale.getValueForPixel(centerPoint) - scale.min) / range || 0));\n const maxPercent = 1 - minPercent;\n return {\n min: newRange * minPercent,\n max: newRange * maxPercent\n };\n}\nfunction getLimit(state, scale, scaleLimits, prop, fallback) {\n let limit = scaleLimits[prop];\n if (limit === 'original') {\n const original = state.originalScaleLimits[scale.id][prop];\n limit = valueOrDefault(original.options, original.scale);\n }\n return valueOrDefault(limit, fallback);\n}\nfunction updateRange(scale, _ref2, limits) {\n let min = _ref2.min,\n max = _ref2.max;\n let zoom = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n const state = getState(scale.chart);\n const id = scale.id,\n axis = scale.axis,\n scaleOpts = scale.options;\n const scaleLimits = limits && (limits[id] || limits[axis]) || {};\n const _scaleLimits$minRange = scaleLimits.minRange,\n minRange = _scaleLimits$minRange === void 0 ? 0 : _scaleLimits$minRange;\n const minLimit = getLimit(state, scale, scaleLimits, 'min', -Infinity);\n const maxLimit = getLimit(state, scale, scaleLimits, 'max', Infinity);\n const cmin = Math.max(min, minLimit);\n const cmax = Math.min(max, maxLimit);\n const range = zoom ? Math.max(cmax - cmin, minRange) : scale.max - scale.min;\n if (cmax - cmin !== range) {\n if (minLimit > cmax - range) {\n min = cmin;\n max = cmin + range;\n } else if (maxLimit < cmin + range) {\n max = cmax;\n min = cmax - range;\n } else {\n const offset = (range - cmax + cmin) / 2;\n min = cmin - offset;\n max = cmax + offset;\n }\n } else {\n min = cmin;\n max = cmax;\n }\n scaleOpts.min = min;\n scaleOpts.max = max;\n state.updatedScaleLimits[scale.id] = {\n min,\n max\n };\n\n // return true if the scale range is changed\n return scale.parse(min) !== scale.min || scale.parse(max) !== scale.max;\n}\nfunction zoomNumericalScale(scale, zoom, center, limits) {\n const delta = zoomDelta(scale, zoom, center);\n const newRange = {\n min: scale.min + delta.min,\n max: scale.max - delta.max\n };\n return updateRange(scale, newRange, limits, true);\n}\nconst integerChange = v => v === 0 || isNaN(v) ? 0 : v < 0 ? Math.min(Math.round(v), -1) : Math.max(Math.round(v), 1);\nfunction existCategoryFromMaxZoom(scale) {\n const labels = scale.getLabels();\n const maxIndex = labels.length - 1;\n if (scale.min > 0) {\n scale.min -= 1;\n }\n if (scale.max < maxIndex) {\n scale.max += 1;\n }\n}\nfunction zoomCategoryScale(scale, zoom, center, limits) {\n const delta = zoomDelta(scale, zoom, center);\n if (scale.min === scale.max && zoom < 1) {\n existCategoryFromMaxZoom(scale);\n }\n const newRange = {\n min: scale.min + integerChange(delta.min),\n max: scale.max - integerChange(delta.max)\n };\n return updateRange(scale, newRange, limits, true);\n}\nfunction scaleLength(scale) {\n return scale.isHorizontal() ? scale.width : scale.height;\n}\nfunction panCategoryScale(scale, delta, limits) {\n const labels = scale.getLabels();\n const lastLabelIndex = labels.length - 1;\n let min = scale.min,\n max = scale.max;\n // The visible range. Ticks can be skipped, and thus not reliable.\n const range = Math.max(max - min, 1);\n // How many pixels of delta is required before making a step. stepSize, but limited to max 1/10 of the scale length.\n const stepDelta = Math.round(scaleLength(scale) / Math.max(range, 10));\n const stepSize = Math.round(Math.abs(delta / stepDelta));\n let applied;\n if (delta < -stepDelta) {\n max = Math.min(max + stepSize, lastLabelIndex);\n min = range === 1 ? max : max - range;\n applied = max === lastLabelIndex;\n } else if (delta > stepDelta) {\n min = Math.max(0, min - stepSize);\n max = range === 1 ? min : min + range;\n applied = min === 0;\n }\n return updateRange(scale, {\n min,\n max\n }, limits) || applied;\n}\nconst OFFSETS = {\n second: 500,\n // 500 ms\n minute: 30 * 1000,\n // 30 s\n hour: 30 * 60 * 1000,\n // 30 m\n day: 12 * 60 * 60 * 1000,\n // 12 h\n week: 3.5 * 24 * 60 * 60 * 1000,\n // 3.5 d\n month: 15 * 24 * 60 * 60 * 1000,\n // 15 d\n quarter: 60 * 24 * 60 * 60 * 1000,\n // 60 d\n year: 182 * 24 * 60 * 60 * 1000 // 182 d\n};\nfunction panNumericalScale(scale, delta, limits) {\n let canZoom = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n const prevStart = scale.min,\n prevEnd = scale.max,\n options = scale.options;\n const round = options.time && options.time.round;\n const offset = OFFSETS[round] || 0;\n const newMin = scale.getValueForPixel(scale.getPixelForValue(prevStart + offset) - delta);\n const newMax = scale.getValueForPixel(scale.getPixelForValue(prevEnd + offset) - delta);\n const _ref3 = canZoom && limits && limits[scale.axis] || {},\n _ref3$min = _ref3.min,\n minLimit = _ref3$min === void 0 ? -Infinity : _ref3$min,\n _ref3$max = _ref3.max,\n maxLimit = _ref3$max === void 0 ? Infinity : _ref3$max;\n if (isNaN(newMin) || isNaN(newMax) || newMin < minLimit || newMax > maxLimit) {\n // At limit: No change but return true to indicate no need to store the delta.\n // NaN can happen for 0-dimension scales (either because they were configured\n // with min === max or because the chart has 0 plottable area).\n return true;\n }\n return updateRange(scale, {\n min: newMin,\n max: newMax\n }, limits, canZoom);\n}\nfunction panNonLinearScale(scale, delta, limits) {\n return panNumericalScale(scale, delta, limits, true);\n}\nconst zoomFunctions = {\n category: zoomCategoryScale,\n default: zoomNumericalScale\n};\nconst panFunctions = {\n category: panCategoryScale,\n default: panNumericalScale,\n logarithmic: panNonLinearScale,\n timeseries: panNonLinearScale\n};\nfunction shouldUpdateScaleLimits(scale, originalScaleLimits, updatedScaleLimits) {\n const id = scale.id,\n _scale$options = scale.options,\n min = _scale$options.min,\n max = _scale$options.max;\n if (!originalScaleLimits[id] || !updatedScaleLimits[id]) {\n return true;\n }\n const previous = updatedScaleLimits[id];\n return previous.min !== min || previous.max !== max;\n}\nfunction removeMissingScales(limits, scales) {\n each(limits, (opt, key) => {\n if (!scales[key]) {\n delete limits[key];\n }\n });\n}\nfunction storeOriginalScaleLimits(chart, state) {\n const scales = chart.scales;\n const originalScaleLimits = state.originalScaleLimits,\n updatedScaleLimits = state.updatedScaleLimits;\n each(scales, function (scale) {\n if (shouldUpdateScaleLimits(scale, originalScaleLimits, updatedScaleLimits)) {\n originalScaleLimits[scale.id] = {\n min: {\n scale: scale.min,\n options: scale.options.min\n },\n max: {\n scale: scale.max,\n options: scale.options.max\n }\n };\n }\n });\n removeMissingScales(originalScaleLimits, scales);\n removeMissingScales(updatedScaleLimits, scales);\n return originalScaleLimits;\n}\nfunction doZoom(scale, amount, center, limits) {\n const fn = zoomFunctions[scale.type] || zoomFunctions.default;\n callback(fn, [scale, amount, center, limits]);\n}\nfunction getCenter(chart) {\n const ca = chart.chartArea;\n return {\n x: (ca.left + ca.right) / 2,\n y: (ca.top + ca.bottom) / 2\n };\n}\n\n/**\n * @param chart The chart instance\n * @param {number | {x?: number, y?: number, focalPoint?: {x: number, y: number}}} amount The zoom percentage or percentages and focal point\n * @param {string} [transition] Which transition mode to use. Defaults to 'none'\n */\nfunction zoom(chart, amount) {\n let transition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'none';\n const _ref4 = typeof amount === 'number' ? {\n x: amount,\n y: amount\n } : amount,\n _ref4$x = _ref4.x,\n x = _ref4$x === void 0 ? 1 : _ref4$x,\n _ref4$y = _ref4.y,\n y = _ref4$y === void 0 ? 1 : _ref4$y,\n _ref4$focalPoint = _ref4.focalPoint,\n focalPoint = _ref4$focalPoint === void 0 ? getCenter(chart) : _ref4$focalPoint;\n const state = getState(chart);\n const _state$options = state.options,\n limits = _state$options.limits,\n zoomOptions = _state$options.zoom;\n const _ref5 = zoomOptions || {},\n _ref5$mode = _ref5.mode,\n mode = _ref5$mode === void 0 ? 'xy' : _ref5$mode,\n overScaleMode = _ref5.overScaleMode;\n storeOriginalScaleLimits(chart, state);\n const xEnabled = x !== 1 && directionEnabled(mode, 'x', chart);\n const yEnabled = y !== 1 && directionEnabled(mode, 'y', chart);\n const enabledScales = overScaleMode && getEnabledScalesByPoint(overScaleMode, focalPoint, chart);\n each(enabledScales || chart.scales, function (scale) {\n if (scale.isHorizontal() && xEnabled) {\n doZoom(scale, x, focalPoint, limits);\n } else if (!scale.isHorizontal() && yEnabled) {\n doZoom(scale, y, focalPoint, limits);\n }\n });\n chart.update(transition);\n callback(zoomOptions.onZoom, [{\n chart\n }]);\n}\nfunction getRange(scale, pixel0, pixel1) {\n const v0 = scale.getValueForPixel(pixel0);\n const v1 = scale.getValueForPixel(pixel1);\n return {\n min: Math.min(v0, v1),\n max: Math.max(v0, v1)\n };\n}\nfunction zoomRect(chart, p0, p1) {\n let transition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'none';\n const state = getState(chart);\n const _state$options2 = state.options,\n limits = _state$options2.limits,\n zoomOptions = _state$options2.zoom;\n const _zoomOptions$mode = zoomOptions.mode,\n mode = _zoomOptions$mode === void 0 ? 'xy' : _zoomOptions$mode;\n storeOriginalScaleLimits(chart, state);\n const xEnabled = directionEnabled(mode, 'x', chart);\n const yEnabled = directionEnabled(mode, 'y', chart);\n each(chart.scales, function (scale) {\n if (scale.isHorizontal() && xEnabled) {\n updateRange(scale, getRange(scale, p0.x, p1.x), limits, true);\n } else if (!scale.isHorizontal() && yEnabled) {\n updateRange(scale, getRange(scale, p0.y, p1.y), limits, true);\n }\n });\n chart.update(transition);\n callback(zoomOptions.onZoom, [{\n chart\n }]);\n}\nfunction zoomScale(chart, scaleId, range) {\n let transition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'none';\n storeOriginalScaleLimits(chart, getState(chart));\n const scale = chart.scales[scaleId];\n updateRange(scale, range, undefined, true);\n chart.update(transition);\n}\nfunction resetZoom(chart) {\n let transition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';\n const state = getState(chart);\n const originalScaleLimits = storeOriginalScaleLimits(chart, state);\n each(chart.scales, function (scale) {\n const scaleOptions = scale.options;\n if (originalScaleLimits[scale.id]) {\n scaleOptions.min = originalScaleLimits[scale.id].min.options;\n scaleOptions.max = originalScaleLimits[scale.id].max.options;\n } else {\n delete scaleOptions.min;\n delete scaleOptions.max;\n }\n });\n chart.update(transition);\n callback(state.options.zoom.onZoomComplete, [{\n chart\n }]);\n}\nfunction getOriginalRange(state, scaleId) {\n const original = state.originalScaleLimits[scaleId];\n if (!original) {\n return;\n }\n const min = original.min,\n max = original.max;\n return valueOrDefault(max.options, max.scale) - valueOrDefault(min.options, min.scale);\n}\nfunction getZoomLevel(chart) {\n const state = getState(chart);\n let min = 1;\n let max = 1;\n each(chart.scales, function (scale) {\n const origRange = getOriginalRange(state, scale.id);\n if (origRange) {\n const level = Math.round(origRange / (scale.max - scale.min) * 100) / 100;\n min = Math.min(min, level);\n max = Math.max(max, level);\n }\n });\n return min < 1 ? min : max;\n}\nfunction panScale(scale, delta, limits, state) {\n const panDelta = state.panDelta;\n // Add possible cumulative delta from previous pan attempts where scale did not change\n const storedDelta = panDelta[scale.id] || 0;\n if (sign(storedDelta) === sign(delta)) {\n delta += storedDelta;\n }\n const fn = panFunctions[scale.type] || panFunctions.default;\n if (callback(fn, [scale, delta, limits])) {\n // The scale changed, reset cumulative delta\n panDelta[scale.id] = 0;\n } else {\n // The scale did not change, store cumulative delta\n panDelta[scale.id] = delta;\n }\n}\nfunction pan(chart, delta, enabledScales) {\n let transition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'none';\n const _ref6 = typeof delta === 'number' ? {\n x: delta,\n y: delta\n } : delta,\n _ref6$x = _ref6.x,\n x = _ref6$x === void 0 ? 0 : _ref6$x,\n _ref6$y = _ref6.y,\n y = _ref6$y === void 0 ? 0 : _ref6$y;\n const state = getState(chart);\n const _state$options3 = state.options,\n panOptions = _state$options3.pan,\n limits = _state$options3.limits;\n const _ref7 = panOptions || {},\n _ref7$mode = _ref7.mode,\n mode = _ref7$mode === void 0 ? 'xy' : _ref7$mode,\n onPan = _ref7.onPan;\n storeOriginalScaleLimits(chart, state);\n const xEnabled = x !== 0 && directionEnabled(mode, 'x', chart);\n const yEnabled = y !== 0 && directionEnabled(mode, 'y', chart);\n each(enabledScales || chart.scales, function (scale) {\n if (scale.isHorizontal() && xEnabled) {\n panScale(scale, x, limits, state);\n } else if (!scale.isHorizontal() && yEnabled) {\n panScale(scale, y, limits, state);\n }\n });\n chart.update(transition);\n callback(onPan, [{\n chart\n }]);\n}\nfunction getInitialScaleBounds(chart) {\n const state = getState(chart);\n const scaleBounds = {};\n for (const scaleId of Object.keys(chart.scales)) {\n const _ref8 = state.originalScaleLimits[scaleId] || {\n min: {},\n max: {}\n },\n min = _ref8.min,\n max = _ref8.max;\n scaleBounds[scaleId] = {\n min: min.scale,\n max: max.scale\n };\n }\n return scaleBounds;\n}\nfunction isZoomedOrPanned(chart) {\n const scaleBounds = getInitialScaleBounds(chart);\n for (const scaleId of Object.keys(chart.scales)) {\n const _scaleBounds$scaleId = scaleBounds[scaleId],\n originalMin = _scaleBounds$scaleId.min,\n originalMax = _scaleBounds$scaleId.max;\n if (originalMin !== undefined && chart.scales[scaleId].min !== originalMin) {\n return true;\n }\n if (originalMax !== undefined && chart.scales[scaleId].max !== originalMax) {\n return true;\n }\n }\n return false;\n}\nfunction removeHandler(chart, type) {\n const _getState = getState(chart),\n handlers = _getState.handlers;\n const handler = handlers[type];\n if (handler && handler.target) {\n handler.target.removeEventListener(type, handler);\n delete handlers[type];\n }\n}\nfunction addHandler(chart, target, type, handler) {\n const _getState2 = getState(chart),\n handlers = _getState2.handlers,\n options = _getState2.options;\n const oldHandler = handlers[type];\n if (oldHandler && oldHandler.target === target) {\n // already attached\n return;\n }\n removeHandler(chart, type);\n handlers[type] = event => handler(chart, event, options);\n handlers[type].target = target;\n target.addEventListener(type, handlers[type]);\n}\nfunction mouseMove(chart, event) {\n const state = getState(chart);\n if (state.dragStart) {\n state.dragging = true;\n state.dragEnd = event;\n chart.update('none');\n }\n}\nfunction zoomStart(chart, event, zoomOptions) {\n const onZoomStart = zoomOptions.onZoomStart,\n onZoomRejected = zoomOptions.onZoomRejected;\n if (onZoomStart) {\n const _event$target$getBoun = event.target.getBoundingClientRect(),\n offsetX = _event$target$getBoun.left,\n offsetY = _event$target$getBoun.top;\n const point = {\n x: event.clientX - offsetX,\n y: event.clientY - offsetY\n };\n if (callback(onZoomStart, [{\n chart,\n event,\n point\n }]) === false) {\n callback(onZoomRejected, [{\n chart,\n event\n }]);\n return false;\n }\n }\n}\nfunction mouseDown(chart, event) {\n const state = getState(chart);\n const _state$options4 = state.options,\n panOptions = _state$options4.pan,\n _state$options4$zoom = _state$options4.zoom,\n zoomOptions = _state$options4$zoom === void 0 ? {} : _state$options4$zoom;\n if (keyPressed(getModifierKey(panOptions), event) || keyNotPressed(getModifierKey(zoomOptions.drag), event)) {\n return callback(zoomOptions.onZoomRejected, [{\n chart,\n event\n }]);\n }\n if (zoomStart(chart, event, zoomOptions) === false) {\n return;\n }\n state.dragStart = event;\n addHandler(chart, chart.canvas, 'mousemove', mouseMove);\n}\nfunction computeDragRect(chart, mode, beginPoint, endPoint) {\n const _beginPoint$target$ge = beginPoint.target.getBoundingClientRect(),\n offsetX = _beginPoint$target$ge.left,\n offsetY = _beginPoint$target$ge.top;\n const xEnabled = directionEnabled(mode, 'x', chart);\n const yEnabled = directionEnabled(mode, 'y', chart);\n let _chart$chartArea = chart.chartArea,\n top = _chart$chartArea.top,\n left = _chart$chartArea.left,\n right = _chart$chartArea.right,\n bottom = _chart$chartArea.bottom,\n chartWidth = _chart$chartArea.width,\n chartHeight = _chart$chartArea.height;\n if (xEnabled) {\n left = Math.min(beginPoint.clientX, endPoint.clientX) - offsetX;\n right = Math.max(beginPoint.clientX, endPoint.clientX) - offsetX;\n }\n if (yEnabled) {\n top = Math.min(beginPoint.clientY, endPoint.clientY) - offsetY;\n bottom = Math.max(beginPoint.clientY, endPoint.clientY) - offsetY;\n }\n const width = right - left;\n const height = bottom - top;\n return {\n left,\n top,\n right,\n bottom,\n width,\n height,\n zoomX: xEnabled && width ? 1 + (chartWidth - width) / chartWidth : 1,\n zoomY: yEnabled && height ? 1 + (chartHeight - height) / chartHeight : 1\n };\n}\nfunction mouseUp(chart, event) {\n const state = getState(chart);\n if (!state.dragStart) {\n return;\n }\n removeHandler(chart, 'mousemove');\n const _state$options$zoom = state.options.zoom,\n mode = _state$options$zoom.mode,\n onZoomComplete = _state$options$zoom.onZoomComplete,\n _state$options$zoom$d = _state$options$zoom.drag.threshold,\n threshold = _state$options$zoom$d === void 0 ? 0 : _state$options$zoom$d;\n const rect = computeDragRect(chart, mode, state.dragStart, event);\n const distanceX = directionEnabled(mode, 'x', chart) ? rect.width : 0;\n const distanceY = directionEnabled(mode, 'y', chart) ? rect.height : 0;\n const distance = Math.sqrt(distanceX * distanceX + distanceY * distanceY);\n\n // Remove drag start and end before chart update to stop drawing selected area\n state.dragStart = state.dragEnd = null;\n if (distance <= threshold) {\n state.dragging = false;\n chart.update('none');\n return;\n }\n zoomRect(chart, {\n x: rect.left,\n y: rect.top\n }, {\n x: rect.right,\n y: rect.bottom\n }, 'zoom');\n setTimeout(() => state.dragging = false, 500);\n callback(onZoomComplete, [{\n chart\n }]);\n}\nfunction wheelPreconditions(chart, event, zoomOptions) {\n // Before preventDefault, check if the modifier key required and pressed\n if (keyNotPressed(getModifierKey(zoomOptions.wheel), event)) {\n callback(zoomOptions.onZoomRejected, [{\n chart,\n event\n }]);\n return;\n }\n if (zoomStart(chart, event, zoomOptions) === false) {\n return;\n }\n\n // Prevent the event from triggering the default behavior (eg. Content scrolling).\n if (event.cancelable) {\n event.preventDefault();\n }\n\n // Firefox always fires the wheel event twice:\n // First without the delta and right after that once with the delta properties.\n if (event.deltaY === undefined) {\n return;\n }\n return true;\n}\nfunction wheel(chart, event) {\n const _getState3 = getState(chart),\n onZoomComplete = _getState3.handlers.onZoomComplete,\n zoomOptions = _getState3.options.zoom;\n if (!wheelPreconditions(chart, event, zoomOptions)) {\n return;\n }\n const rect = event.target.getBoundingClientRect();\n const speed = 1 + (event.deltaY >= 0 ? -zoomOptions.wheel.speed : zoomOptions.wheel.speed);\n const amount = {\n x: speed,\n y: speed,\n focalPoint: {\n x: event.clientX - rect.left,\n y: event.clientY - rect.top\n }\n };\n zoom(chart, amount);\n if (onZoomComplete) {\n onZoomComplete();\n }\n}\nfunction addDebouncedHandler(chart, name, handler, delay) {\n if (handler) {\n getState(chart).handlers[name] = debounce(() => callback(handler, [{\n chart\n }]), delay);\n }\n}\nfunction addListeners(chart, options) {\n const canvas = chart.canvas;\n const _options$zoom = options.zoom,\n wheelOptions = _options$zoom.wheel,\n dragOptions = _options$zoom.drag,\n onZoomComplete = _options$zoom.onZoomComplete;\n\n // Install listeners. Do this dynamically based on options so that we can turn zoom on and off\n // We also want to make sure listeners aren't always on. E.g. if you're scrolling down a page\n // and the mouse goes over a chart you don't want it intercepted unless the plugin is enabled\n if (wheelOptions.enabled) {\n addHandler(chart, canvas, 'wheel', wheel);\n addDebouncedHandler(chart, 'onZoomComplete', onZoomComplete, 250);\n } else {\n removeHandler(chart, 'wheel');\n }\n if (dragOptions.enabled) {\n addHandler(chart, canvas, 'mousedown', mouseDown);\n addHandler(chart, canvas.ownerDocument, 'mouseup', mouseUp);\n } else {\n removeHandler(chart, 'mousedown');\n removeHandler(chart, 'mousemove');\n removeHandler(chart, 'mouseup');\n }\n}\nfunction removeListeners(chart) {\n removeHandler(chart, 'mousedown');\n removeHandler(chart, 'mousemove');\n removeHandler(chart, 'mouseup');\n removeHandler(chart, 'wheel');\n removeHandler(chart, 'click');\n}\nfunction createEnabler(chart, state) {\n return function (recognizer, event) {\n const _state$options5 = state.options,\n panOptions = _state$options5.pan,\n _state$options5$zoom = _state$options5.zoom,\n zoomOptions = _state$options5$zoom === void 0 ? {} : _state$options5$zoom;\n if (!panOptions || !panOptions.enabled) {\n return false;\n }\n const srcEvent = event && event.srcEvent;\n if (!srcEvent) {\n // Sometimes Hammer queries this with a null event.\n return true;\n }\n if (!state.panning && event.pointerType === 'mouse' && (keyNotPressed(getModifierKey(panOptions), srcEvent) || keyPressed(getModifierKey(zoomOptions.drag), srcEvent))) {\n callback(panOptions.onPanRejected, [{\n chart,\n event\n }]);\n return false;\n }\n return true;\n };\n}\nfunction pinchAxes(p0, p1) {\n // fingers position difference\n const pinchX = Math.abs(p0.clientX - p1.clientX);\n const pinchY = Math.abs(p0.clientY - p1.clientY);\n\n // diagonal fingers will change both (xy) axes\n const p = pinchX / pinchY;\n let x, y;\n if (p > 0.3 && p < 1.7) {\n x = y = true;\n } else if (pinchX > pinchY) {\n x = true;\n } else {\n y = true;\n }\n return {\n x,\n y\n };\n}\nfunction handlePinch(chart, state, e) {\n if (state.scale) {\n const center = e.center,\n pointers = e.pointers;\n // Hammer reports the total scaling. We need the incremental amount\n const zoomPercent = 1 / state.scale * e.scale;\n const rect = e.target.getBoundingClientRect();\n const pinch = pinchAxes(pointers[0], pointers[1]);\n const mode = state.options.zoom.mode;\n const amount = {\n x: pinch.x && directionEnabled(mode, 'x', chart) ? zoomPercent : 1,\n y: pinch.y && directionEnabled(mode, 'y', chart) ? zoomPercent : 1,\n focalPoint: {\n x: center.x - rect.left,\n y: center.y - rect.top\n }\n };\n zoom(chart, amount);\n\n // Keep track of overall scale\n state.scale = e.scale;\n }\n}\nfunction startPinch(chart, state) {\n if (state.options.zoom.pinch.enabled) {\n state.scale = 1;\n }\n}\nfunction endPinch(chart, state, e) {\n if (state.scale) {\n handlePinch(chart, state, e);\n state.scale = null; // reset\n callback(state.options.zoom.onZoomComplete, [{\n chart\n }]);\n }\n}\nfunction handlePan(chart, state, e) {\n const delta = state.delta;\n if (delta) {\n state.panning = true;\n pan(chart, {\n x: e.deltaX - delta.x,\n y: e.deltaY - delta.y\n }, state.panScales);\n state.delta = {\n x: e.deltaX,\n y: e.deltaY\n };\n }\n}\nfunction startPan(chart, state, event) {\n const _state$options$pan = state.options.pan,\n enabled = _state$options$pan.enabled,\n overScaleMode = _state$options$pan.overScaleMode,\n onPanStart = _state$options$pan.onPanStart,\n onPanRejected = _state$options$pan.onPanRejected;\n if (!enabled) {\n return;\n }\n const rect = event.target.getBoundingClientRect();\n const point = {\n x: event.center.x - rect.left,\n y: event.center.y - rect.top\n };\n if (callback(onPanStart, [{\n chart,\n event,\n point\n }]) === false) {\n return callback(onPanRejected, [{\n chart,\n event\n }]);\n }\n state.panScales = overScaleMode && getEnabledScalesByPoint(overScaleMode, point, chart);\n state.delta = {\n x: 0,\n y: 0\n };\n clearTimeout(state.panEndTimeout);\n handlePan(chart, state, event);\n}\nfunction endPan(chart, state) {\n state.delta = null;\n if (state.panning) {\n state.panEndTimeout = setTimeout(() => state.panning = false, 500);\n callback(state.options.pan.onPanComplete, [{\n chart\n }]);\n }\n}\nconst hammers = new WeakMap();\nfunction startHammer(chart, options) {\n const state = getState(chart);\n const canvas = chart.canvas;\n const panOptions = options.pan,\n zoomOptions = options.zoom;\n const mc = new Hammer.Manager(canvas);\n if (zoomOptions && zoomOptions.pinch.enabled) {\n mc.add(new Hammer.Pinch());\n mc.on('pinchstart', () => startPinch(chart, state));\n mc.on('pinch', e => handlePinch(chart, state, e));\n mc.on('pinchend', e => endPinch(chart, state, e));\n }\n if (panOptions && panOptions.enabled) {\n mc.add(new Hammer.Pan({\n threshold: panOptions.threshold,\n enable: createEnabler(chart, state)\n }));\n mc.on('panstart', e => startPan(chart, state, e));\n mc.on('panmove', e => handlePan(chart, state, e));\n mc.on('panend', () => endPan(chart, state));\n }\n hammers.set(chart, mc);\n}\nfunction stopHammer(chart) {\n const mc = hammers.get(chart);\n if (mc) {\n mc.remove('pinchstart');\n mc.remove('pinch');\n mc.remove('pinchend');\n mc.remove('panstart');\n mc.remove('pan');\n mc.remove('panend');\n mc.destroy();\n hammers.delete(chart);\n }\n}\nvar version = \"1.2.1\";\nvar plugin = {\n id: 'zoom',\n version,\n defaults: {\n pan: {\n enabled: false,\n mode: 'xy',\n threshold: 10,\n modifierKey: null\n },\n zoom: {\n wheel: {\n enabled: false,\n speed: 0.1,\n modifierKey: null\n },\n drag: {\n enabled: false,\n modifierKey: null\n },\n pinch: {\n enabled: false\n },\n mode: 'xy'\n }\n },\n start: function (chart, _args, options) {\n const state = getState(chart);\n state.options = options;\n if (Object.prototype.hasOwnProperty.call(options.zoom, 'enabled')) {\n console.warn('The option `zoom.enabled` is no longer supported. Please use `zoom.wheel.enabled`, `zoom.drag.enabled`, or `zoom.pinch.enabled`.');\n }\n if (Hammer) {\n startHammer(chart, options);\n }\n chart.pan = (delta, panScales, transition) => pan(chart, delta, panScales, transition);\n chart.zoom = (args, transition) => zoom(chart, args, transition);\n chart.zoomScale = (id, range, transition) => zoomScale(chart, id, range, transition);\n chart.resetZoom = transition => resetZoom(chart, transition);\n chart.getZoomLevel = () => getZoomLevel(chart);\n chart.getInitialScaleBounds = () => getInitialScaleBounds(chart);\n chart.isZoomedOrPanned = () => isZoomedOrPanned(chart);\n },\n beforeEvent(chart) {\n const state = getState(chart);\n if (state.panning || state.dragging) {\n // cancel any event handling while panning or dragging\n return false;\n }\n },\n beforeUpdate: function (chart, args, options) {\n const state = getState(chart);\n state.options = options;\n addListeners(chart, options);\n },\n beforeDatasetsDraw: function (chart, args, options) {\n const _getState4 = getState(chart),\n dragStart = _getState4.dragStart,\n dragEnd = _getState4.dragEnd;\n if (dragEnd) {\n const _computeDragRect = computeDragRect(chart, options.zoom.mode, dragStart, dragEnd),\n left = _computeDragRect.left,\n top = _computeDragRect.top,\n width = _computeDragRect.width,\n height = _computeDragRect.height;\n const dragOptions = options.zoom.drag;\n const ctx = chart.ctx;\n ctx.save();\n ctx.beginPath();\n ctx.fillStyle = dragOptions.backgroundColor || 'rgba(225,225,225,0.3)';\n ctx.fillRect(left, top, width, height);\n if (dragOptions.borderWidth > 0) {\n ctx.lineWidth = dragOptions.borderWidth;\n ctx.strokeStyle = dragOptions.borderColor || 'rgba(225,225,225)';\n ctx.strokeRect(left, top, width, height);\n }\n ctx.restore();\n }\n },\n stop: function (chart) {\n removeListeners(chart);\n if (Hammer) {\n stopHammer(chart);\n }\n removeState(chart);\n },\n panFunctions,\n zoomFunctions\n};\nexport { plugin as default, pan, resetZoom, zoom, zoomScale };","'use strict';\n\nvar reactIs = require('react-is');\n\n/**\n * Copyright 2015, Yahoo! Inc.\n * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.\n */\nvar REACT_STATICS = {\n childContextTypes: true,\n contextType: true,\n contextTypes: true,\n defaultProps: true,\n displayName: true,\n getDefaultProps: true,\n getDerivedStateFromError: true,\n getDerivedStateFromProps: true,\n mixins: true,\n propTypes: true,\n type: true\n};\nvar KNOWN_STATICS = {\n name: true,\n length: true,\n prototype: true,\n caller: true,\n callee: true,\n arguments: true,\n arity: true\n};\nvar FORWARD_REF_STATICS = {\n '$$typeof': true,\n render: true,\n defaultProps: true,\n displayName: true,\n propTypes: true\n};\nvar MEMO_STATICS = {\n '$$typeof': true,\n compare: true,\n defaultProps: true,\n displayName: true,\n propTypes: true,\n type: true\n};\nvar TYPE_STATICS = {};\nTYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;\nTYPE_STATICS[reactIs.Memo] = MEMO_STATICS;\nfunction getStatics(component) {\n // React v16.11 and below\n if (reactIs.isMemo(component)) {\n return MEMO_STATICS;\n } // React v16.12 and above\n\n return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;\n}\nvar defineProperty = Object.defineProperty;\nvar getOwnPropertyNames = Object.getOwnPropertyNames;\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\nvar getPrototypeOf = Object.getPrototypeOf;\nvar objectPrototype = Object.prototype;\nfunction hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {\n if (typeof sourceComponent !== 'string') {\n // don't hoist over string (html) components\n if (objectPrototype) {\n var inheritedComponent = getPrototypeOf(sourceComponent);\n if (inheritedComponent && inheritedComponent !== objectPrototype) {\n hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);\n }\n }\n var keys = getOwnPropertyNames(sourceComponent);\n if (getOwnPropertySymbols) {\n keys = keys.concat(getOwnPropertySymbols(sourceComponent));\n }\n var targetStatics = getStatics(targetComponent);\n var sourceStatics = getStatics(sourceComponent);\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {\n var descriptor = getOwnPropertyDescriptor(sourceComponent, key);\n try {\n // Avoid failures from read-only properties\n defineProperty(targetComponent, key, descriptor);\n } catch (e) {}\n }\n }\n }\n return targetComponent;\n}\nmodule.exports = hoistNonReactStatics;","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) : typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ReactErrorBoundary = {}, global.React));\n})(this, function (exports, React) {\n 'use strict';\n\n function _interopNamespace(e) {\n if (e && e.__esModule) return e;\n var n = Object.create(null);\n if (e) {\n Object.keys(e).forEach(function (k) {\n if (k !== 'default') {\n var d = Object.getOwnPropertyDescriptor(e, k);\n Object.defineProperty(n, k, d.get ? d : {\n enumerable: true,\n get: function () {\n return e[k];\n }\n });\n }\n });\n }\n n[\"default\"] = e;\n return Object.freeze(n);\n }\n var React__namespace = /*#__PURE__*/_interopNamespace(React);\n function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n }\n function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n _setPrototypeOf(subClass, superClass);\n }\n var changedArray = function changedArray(a, b) {\n if (a === void 0) {\n a = [];\n }\n if (b === void 0) {\n b = [];\n }\n return a.length !== b.length || a.some(function (item, index) {\n return !Object.is(item, b[index]);\n });\n };\n var initialState = {\n error: null\n };\n var ErrorBoundary = /*#__PURE__*/function (_React$Component) {\n _inheritsLoose(ErrorBoundary, _React$Component);\n function ErrorBoundary() {\n var _this;\n for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {\n _args[_key] = arguments[_key];\n }\n _this = _React$Component.call.apply(_React$Component, [this].concat(_args)) || this;\n _this.state = initialState;\n _this.resetErrorBoundary = function () {\n var _this$props;\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n _this.props.onReset == null ? void 0 : (_this$props = _this.props).onReset.apply(_this$props, args);\n _this.reset();\n };\n return _this;\n }\n ErrorBoundary.getDerivedStateFromError = function getDerivedStateFromError(error) {\n return {\n error: error\n };\n };\n var _proto = ErrorBoundary.prototype;\n _proto.reset = function reset() {\n this.setState(initialState);\n };\n _proto.componentDidCatch = function componentDidCatch(error, info) {\n var _this$props$onError, _this$props2;\n (_this$props$onError = (_this$props2 = this.props).onError) == null ? void 0 : _this$props$onError.call(_this$props2, error, info);\n };\n _proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {\n var error = this.state.error;\n var resetKeys = this.props.resetKeys; // There's an edge case where if the thing that triggered the error\n // happens to *also* be in the resetKeys array, we'd end up resetting\n // the error boundary immediately. This would likely trigger a second\n // error to be thrown.\n // So we make sure that we don't check the resetKeys on the first call\n // of cDU after the error is set\n\n if (error !== null && prevState.error !== null && changedArray(prevProps.resetKeys, resetKeys)) {\n var _this$props$onResetKe, _this$props3;\n (_this$props$onResetKe = (_this$props3 = this.props).onResetKeysChange) == null ? void 0 : _this$props$onResetKe.call(_this$props3, prevProps.resetKeys, resetKeys);\n this.reset();\n }\n };\n _proto.render = function render() {\n var error = this.state.error;\n var _this$props4 = this.props,\n fallbackRender = _this$props4.fallbackRender,\n FallbackComponent = _this$props4.FallbackComponent,\n fallback = _this$props4.fallback;\n if (error !== null) {\n var _props = {\n error: error,\n resetErrorBoundary: this.resetErrorBoundary\n };\n if ( /*#__PURE__*/React__namespace.isValidElement(fallback)) {\n return fallback;\n } else if (typeof fallbackRender === 'function') {\n return fallbackRender(_props);\n } else if (FallbackComponent) {\n return /*#__PURE__*/React__namespace.createElement(FallbackComponent, _props);\n } else {\n throw new Error('react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop');\n }\n }\n return this.props.children;\n };\n return ErrorBoundary;\n }(React__namespace.Component);\n function withErrorBoundary(Component, errorBoundaryProps) {\n var Wrapped = function Wrapped(props) {\n return /*#__PURE__*/React__namespace.createElement(ErrorBoundary, errorBoundaryProps, /*#__PURE__*/React__namespace.createElement(Component, props));\n }; // Format for display in DevTools\n\n var name = Component.displayName || Component.name || 'Unknown';\n Wrapped.displayName = \"withErrorBoundary(\" + name + \")\";\n return Wrapped;\n }\n function useErrorHandler(givenError) {\n var _React$useState = React__namespace.useState(null),\n error = _React$useState[0],\n setError = _React$useState[1];\n if (givenError != null) throw givenError;\n if (error != null) throw error;\n return setError;\n }\n /*\n eslint\n @typescript-eslint/sort-type-union-intersection-members: \"off\",\n @typescript-eslint/no-throw-literal: \"off\",\n @typescript-eslint/prefer-nullish-coalescing: \"off\"\n */\n\n exports.ErrorBoundary = ErrorBoundary;\n exports.useErrorHandler = useErrorHandler;\n exports.withErrorBoundary = withErrorBoundary;\n Object.defineProperty(exports, '__esModule', {\n value: true\n });\n});","import { useEffect, useLayoutEffect } from 'react';\nconst isReactNative = typeof global !== 'undefined' &&\n// @ts-ignore\nglobal.navigator &&\n// @ts-ignore\nglobal.navigator.product === 'ReactNative';\nconst isDOM = typeof document !== 'undefined';\n\n/**\n * Is `useLayoutEffect` in a DOM or React Native environment, otherwise resolves to useEffect\n * Only useful to avoid the console warning.\n *\n * PREFER `useEffect` UNLESS YOU KNOW WHAT YOU ARE DOING.\n *\n * @category effects\n */\nexport default isDOM || isReactNative ? useLayoutEffect : useEffect;","'use strict';\n\nimport toFormData from './toFormData.js';\n\n/**\n * It encodes a string by replacing all characters that are not in the unreserved set with\n * their percent-encoded equivalents\n *\n * @param {string} str - The string to encode.\n *\n * @returns {string} The encoded string.\n */\nfunction encode(str) {\n const charMap = {\n '!': '%21',\n \"'\": '%27',\n '(': '%28',\n ')': '%29',\n '~': '%7E',\n '%20': '+',\n '%00': '\\x00'\n };\n return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {\n return charMap[match];\n });\n}\n\n/**\n * It takes a params object and converts it to a FormData object\n *\n * @param {Object} params - The parameters to be converted to a FormData object.\n * @param {Object} options - The options object passed to the Axios constructor.\n *\n * @returns {void}\n */\nfunction AxiosURLSearchParams(params, options) {\n this._pairs = [];\n params && toFormData(params, this, options);\n}\nconst prototype = AxiosURLSearchParams.prototype;\nprototype.append = function append(name, value) {\n this._pairs.push([name, value]);\n};\nprototype.toString = function toString(encoder) {\n const _encode = encoder ? function (value) {\n return encoder.call(this, value, encode);\n } : encode;\n return this._pairs.map(function each(pair) {\n return _encode(pair[0]) + '=' + _encode(pair[1]);\n }, '').join('&');\n};\nexport default AxiosURLSearchParams;","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosURLSearchParams from '../helpers/AxiosURLSearchParams.js';\n\n/**\n * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their\n * URI encoded counterparts\n *\n * @param {string} val The value to be encoded.\n *\n * @returns {string} The encoded value.\n */\nfunction encode(val) {\n return encodeURIComponent(val).replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+').replace(/%5B/gi, '[').replace(/%5D/gi, ']');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @param {?object} options\n *\n * @returns {string} The formatted url\n */\nexport default function buildURL(url, params, options) {\n /*eslint no-param-reassign:0*/\n if (!params) {\n return url;\n }\n const _encode = options && options.encode || encode;\n const serializeFn = options && options.serialize;\n let serializedParams;\n if (serializeFn) {\n serializedParams = serializeFn(params, options);\n } else {\n serializedParams = utils.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, options).toString(_encode);\n }\n if (serializedParams) {\n const hashmarkIndex = url.indexOf(\"#\");\n if (hashmarkIndex !== -1) {\n url = url.slice(0, hashmarkIndex);\n }\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n return url;\n}","'use strict';\n\nimport utils from './../utils.js';\nclass InterceptorManager {\n constructor() {\n this.handlers = [];\n }\n\n /**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n *\n * @return {Number} An ID used to remove interceptor later\n */\n use(fulfilled, rejected, options) {\n this.handlers.push({\n fulfilled,\n rejected,\n synchronous: options ? options.synchronous : false,\n runWhen: options ? options.runWhen : null\n });\n return this.handlers.length - 1;\n }\n\n /**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n *\n * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise\n */\n eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n }\n\n /**\n * Clear all interceptors from the stack\n *\n * @returns {void}\n */\n clear() {\n if (this.handlers) {\n this.handlers = [];\n }\n }\n\n /**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n *\n * @returns {void}\n */\n forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n }\n}\nexport default InterceptorManager;","'use strict';\n\nexport default {\n silentJSONParsing: true,\n forcedJSONParsing: true,\n clarifyTimeoutError: false\n};","import URLSearchParams from './classes/URLSearchParams.js';\nimport FormData from './classes/FormData.js';\nimport Blob from './classes/Blob.js';\nexport default {\n isBrowser: true,\n classes: {\n URLSearchParams,\n FormData,\n Blob\n },\n protocols: ['http', 'https', 'file', 'blob', 'url', 'data']\n};","'use strict';\n\nimport AxiosURLSearchParams from '../../../helpers/AxiosURLSearchParams.js';\nexport default typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;","'use strict';\n\nexport default typeof FormData !== 'undefined' ? FormData : null;","'use strict';\n\nexport default typeof Blob !== 'undefined' ? Blob : null;","const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';\n\n/**\n * Determine if we're running in a standard browser environment\n *\n * This allows axios to run in a web worker, and react-native.\n * Both environments support XMLHttpRequest, but not fully standard globals.\n *\n * web workers:\n * typeof window -> undefined\n * typeof document -> undefined\n *\n * react-native:\n * navigator.product -> 'ReactNative'\n * nativescript\n * navigator.product -> 'NativeScript' or 'NS'\n *\n * @returns {boolean}\n */\nconst hasStandardBrowserEnv = (product => {\n return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0;\n})(typeof navigator !== 'undefined' && navigator.product);\n\n/**\n * Determine if we're running in a standard browser webWorker environment\n *\n * Although the `isStandardBrowserEnv` method indicates that\n * `allows axios to run in a web worker`, the WebWorker will still be\n * filtered out due to its judgment standard\n * `typeof window !== 'undefined' && typeof document !== 'undefined'`.\n * This leads to a problem when axios post `FormData` in webWorker\n */\nconst hasStandardBrowserWebWorkerEnv = (() => {\n return typeof WorkerGlobalScope !== 'undefined' &&\n // eslint-disable-next-line no-undef\n self instanceof WorkerGlobalScope && typeof self.importScripts === 'function';\n})();\nexport { hasBrowserEnv, hasStandardBrowserWebWorkerEnv, hasStandardBrowserEnv };","function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport platform from './node/index.js';\nimport * as utils from './common/utils.js';\nexport default _objectSpread(_objectSpread({}, utils), platform);","'use strict';\n\nimport utils from '../utils.js';\n\n/**\n * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']\n *\n * @param {string} name - The name of the property to get.\n *\n * @returns An array of strings.\n */\nfunction parsePropPath(name) {\n // foo[x][y][z]\n // foo.x.y.z\n // foo-x-y-z\n // foo x y z\n return utils.matchAll(/\\w+|\\[(\\w*)]/g, name).map(match => {\n return match[0] === '[]' ? '' : match[1] || match[0];\n });\n}\n\n/**\n * Convert an array to an object.\n *\n * @param {Array} arr - The array to convert to an object.\n *\n * @returns An object with the same keys and values as the array.\n */\nfunction arrayToObject(arr) {\n const obj = {};\n const keys = Object.keys(arr);\n let i;\n const len = keys.length;\n let key;\n for (i = 0; i < len; i++) {\n key = keys[i];\n obj[key] = arr[key];\n }\n return obj;\n}\n\n/**\n * It takes a FormData object and returns a JavaScript object\n *\n * @param {string} formData The FormData object to convert to JSON.\n *\n * @returns {Object | null} The converted object.\n */\nfunction formDataToJSON(formData) {\n function buildPath(path, value, target, index) {\n let name = path[index++];\n if (name === '__proto__') return true;\n const isNumericKey = Number.isFinite(+name);\n const isLast = index >= path.length;\n name = !name && utils.isArray(target) ? target.length : name;\n if (isLast) {\n if (utils.hasOwnProp(target, name)) {\n target[name] = [target[name], value];\n } else {\n target[name] = value;\n }\n return !isNumericKey;\n }\n if (!target[name] || !utils.isObject(target[name])) {\n target[name] = [];\n }\n const result = buildPath(path, value, target[name], index);\n if (result && utils.isArray(target[name])) {\n target[name] = arrayToObject(target[name]);\n }\n return !isNumericKey;\n }\n if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {\n const obj = {};\n utils.forEachEntry(formData, (name, value) => {\n buildPath(parsePropPath(name), value, obj, 0);\n });\n return obj;\n }\n return null;\n}\nexport default formDataToJSON;","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosError from '../core/AxiosError.js';\nimport transitionalDefaults from './transitional.js';\nimport toFormData from '../helpers/toFormData.js';\nimport toURLEncodedForm from '../helpers/toURLEncodedForm.js';\nimport platform from '../platform/index.js';\nimport formDataToJSON from '../helpers/formDataToJSON.js';\n\n/**\n * It takes a string, tries to parse it, and if it fails, it returns the stringified version\n * of the input\n *\n * @param {any} rawValue - The value to be stringified.\n * @param {Function} parser - A function that parses a string into a JavaScript object.\n * @param {Function} encoder - A function that takes a value and returns a string.\n *\n * @returns {string} A stringified version of the rawValue.\n */\nfunction stringifySafely(rawValue, parser, encoder) {\n if (utils.isString(rawValue)) {\n try {\n (parser || JSON.parse)(rawValue);\n return utils.trim(rawValue);\n } catch (e) {\n if (e.name !== 'SyntaxError') {\n throw e;\n }\n }\n }\n return (encoder || JSON.stringify)(rawValue);\n}\nconst defaults = {\n transitional: transitionalDefaults,\n adapter: ['xhr', 'http'],\n transformRequest: [function transformRequest(data, headers) {\n const contentType = headers.getContentType() || '';\n const hasJSONContentType = contentType.indexOf('application/json') > -1;\n const isObjectPayload = utils.isObject(data);\n if (isObjectPayload && utils.isHTMLForm(data)) {\n data = new FormData(data);\n }\n const isFormData = utils.isFormData(data);\n if (isFormData) {\n return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;\n }\n if (utils.isArrayBuffer(data) || utils.isBuffer(data) || utils.isStream(data) || utils.isFile(data) || utils.isBlob(data)) {\n return data;\n }\n if (utils.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils.isURLSearchParams(data)) {\n headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);\n return data.toString();\n }\n let isFileList;\n if (isObjectPayload) {\n if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {\n return toURLEncodedForm(data, this.formSerializer).toString();\n }\n if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {\n const _FormData = this.env && this.env.FormData;\n return toFormData(isFileList ? {\n 'files[]': data\n } : data, _FormData && new _FormData(), this.formSerializer);\n }\n }\n if (isObjectPayload || hasJSONContentType) {\n headers.setContentType('application/json', false);\n return stringifySafely(data);\n }\n return data;\n }],\n transformResponse: [function transformResponse(data) {\n const transitional = this.transitional || defaults.transitional;\n const forcedJSONParsing = transitional && transitional.forcedJSONParsing;\n const JSONRequested = this.responseType === 'json';\n if (data && utils.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {\n const silentJSONParsing = transitional && transitional.silentJSONParsing;\n const strictJSONParsing = !silentJSONParsing && JSONRequested;\n try {\n return JSON.parse(data);\n } catch (e) {\n if (strictJSONParsing) {\n if (e.name === 'SyntaxError') {\n throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);\n }\n throw e;\n }\n }\n }\n return data;\n }],\n /**\n * A timeout in milliseconds to abort a request. If set to 0 (default) a\n * timeout is not created.\n */\n timeout: 0,\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n maxContentLength: -1,\n maxBodyLength: -1,\n env: {\n FormData: platform.classes.FormData,\n Blob: platform.classes.Blob\n },\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n },\n headers: {\n common: {\n 'Accept': 'application/json, text/plain, */*',\n 'Content-Type': undefined\n }\n }\n};\nutils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], method => {\n defaults.headers[method] = {};\n});\nexport default defaults;","'use strict';\n\nimport utils from '../utils.js';\nimport toFormData from './toFormData.js';\nimport platform from '../platform/index.js';\nexport default function toURLEncodedForm(data, options) {\n return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({\n visitor: function (value, key, path, helpers) {\n if (platform.isNode && utils.isBuffer(value)) {\n this.append(key, value.toString('base64'));\n return false;\n }\n return helpers.defaultVisitor.apply(this, arguments);\n }\n }, options));\n}","'use strict';\n\nimport utils from './../utils.js';\n\n// RawAxiosHeaders whose duplicates are ignored by node\n// c.f. https://nodejs.org/api/http.html#http_message_headers\nconst ignoreDuplicateOf = utils.toObjectSet(['age', 'authorization', 'content-length', 'content-type', 'etag', 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', 'last-modified', 'location', 'max-forwards', 'proxy-authorization', 'referer', 'retry-after', 'user-agent']);\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} rawHeaders Headers needing to be parsed\n *\n * @returns {Object} Headers parsed into an object\n */\nexport default (rawHeaders => {\n const parsed = {};\n let key;\n let val;\n let i;\n rawHeaders && rawHeaders.split('\\n').forEach(function parser(line) {\n i = line.indexOf(':');\n key = line.substring(0, i).trim().toLowerCase();\n val = line.substring(i + 1).trim();\n if (!key || parsed[key] && ignoreDuplicateOf[key]) {\n return;\n }\n if (key === 'set-cookie') {\n if (parsed[key]) {\n parsed[key].push(val);\n } else {\n parsed[key] = [val];\n }\n } else {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n });\n return parsed;\n});","'use strict';\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nimport utils from '../utils.js';\nimport parseHeaders from '../helpers/parseHeaders.js';\nconst $internals = Symbol('internals');\nfunction normalizeHeader(header) {\n return header && String(header).trim().toLowerCase();\n}\nfunction normalizeValue(value) {\n if (value === false || value == null) {\n return value;\n }\n return utils.isArray(value) ? value.map(normalizeValue) : String(value);\n}\nfunction parseTokens(str) {\n const tokens = Object.create(null);\n const tokensRE = /([^\\s,;=]+)\\s*(?:=\\s*([^,;]+))?/g;\n let match;\n while (match = tokensRE.exec(str)) {\n tokens[match[1]] = match[2];\n }\n return tokens;\n}\nconst isValidHeaderName = str => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());\nfunction matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {\n if (utils.isFunction(filter)) {\n return filter.call(this, value, header);\n }\n if (isHeaderNameFilter) {\n value = header;\n }\n if (!utils.isString(value)) return;\n if (utils.isString(filter)) {\n return value.indexOf(filter) !== -1;\n }\n if (utils.isRegExp(filter)) {\n return filter.test(value);\n }\n}\nfunction formatHeader(header) {\n return header.trim().toLowerCase().replace(/([a-z\\d])(\\w*)/g, (w, char, str) => {\n return char.toUpperCase() + str;\n });\n}\nfunction buildAccessors(obj, header) {\n const accessorName = utils.toCamelCase(' ' + header);\n ['get', 'set', 'has'].forEach(methodName => {\n Object.defineProperty(obj, methodName + accessorName, {\n value: function (arg1, arg2, arg3) {\n return this[methodName].call(this, header, arg1, arg2, arg3);\n },\n configurable: true\n });\n });\n}\nclass AxiosHeaders {\n constructor(headers) {\n headers && this.set(headers);\n }\n set(header, valueOrRewrite, rewrite) {\n const self = this;\n function setHeader(_value, _header, _rewrite) {\n const lHeader = normalizeHeader(_header);\n if (!lHeader) {\n throw new Error('header name must be a non-empty string');\n }\n const key = utils.findKey(self, lHeader);\n if (!key || self[key] === undefined || _rewrite === true || _rewrite === undefined && self[key] !== false) {\n self[key || _header] = normalizeValue(_value);\n }\n }\n const setHeaders = (headers, _rewrite) => utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));\n if (utils.isPlainObject(header) || header instanceof this.constructor) {\n setHeaders(header, valueOrRewrite);\n } else if (utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {\n setHeaders(parseHeaders(header), valueOrRewrite);\n } else {\n header != null && setHeader(valueOrRewrite, header, rewrite);\n }\n return this;\n }\n get(header, parser) {\n header = normalizeHeader(header);\n if (header) {\n const key = utils.findKey(this, header);\n if (key) {\n const value = this[key];\n if (!parser) {\n return value;\n }\n if (parser === true) {\n return parseTokens(value);\n }\n if (utils.isFunction(parser)) {\n return parser.call(this, value, key);\n }\n if (utils.isRegExp(parser)) {\n return parser.exec(value);\n }\n throw new TypeError('parser must be boolean|regexp|function');\n }\n }\n }\n has(header, matcher) {\n header = normalizeHeader(header);\n if (header) {\n const key = utils.findKey(this, header);\n return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));\n }\n return false;\n }\n delete(header, matcher) {\n const self = this;\n let deleted = false;\n function deleteHeader(_header) {\n _header = normalizeHeader(_header);\n if (_header) {\n const key = utils.findKey(self, _header);\n if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {\n delete self[key];\n deleted = true;\n }\n }\n }\n if (utils.isArray(header)) {\n header.forEach(deleteHeader);\n } else {\n deleteHeader(header);\n }\n return deleted;\n }\n clear(matcher) {\n const keys = Object.keys(this);\n let i = keys.length;\n let deleted = false;\n while (i--) {\n const key = keys[i];\n if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {\n delete this[key];\n deleted = true;\n }\n }\n return deleted;\n }\n normalize(format) {\n const self = this;\n const headers = {};\n utils.forEach(this, (value, header) => {\n const key = utils.findKey(headers, header);\n if (key) {\n self[key] = normalizeValue(value);\n delete self[header];\n return;\n }\n const normalized = format ? formatHeader(header) : String(header).trim();\n if (normalized !== header) {\n delete self[header];\n }\n self[normalized] = normalizeValue(value);\n headers[normalized] = true;\n });\n return this;\n }\n concat() {\n for (var _len = arguments.length, targets = new Array(_len), _key = 0; _key < _len; _key++) {\n targets[_key] = arguments[_key];\n }\n return this.constructor.concat(this, ...targets);\n }\n toJSON(asStrings) {\n const obj = Object.create(null);\n utils.forEach(this, (value, header) => {\n value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);\n });\n return obj;\n }\n [Symbol.iterator]() {\n return Object.entries(this.toJSON())[Symbol.iterator]();\n }\n toString() {\n return Object.entries(this.toJSON()).map(_ref => {\n let _ref2 = _slicedToArray(_ref, 2),\n header = _ref2[0],\n value = _ref2[1];\n return header + ': ' + value;\n }).join('\\n');\n }\n get [Symbol.toStringTag]() {\n return 'AxiosHeaders';\n }\n static from(thing) {\n return thing instanceof this ? thing : new this(thing);\n }\n static concat(first) {\n const computed = new this(first);\n for (var _len2 = arguments.length, targets = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n targets[_key2 - 1] = arguments[_key2];\n }\n targets.forEach(target => computed.set(target));\n return computed;\n }\n static accessor(header) {\n const internals = this[$internals] = this[$internals] = {\n accessors: {}\n };\n const accessors = internals.accessors;\n const prototype = this.prototype;\n function defineAccessor(_header) {\n const lHeader = normalizeHeader(_header);\n if (!accessors[lHeader]) {\n buildAccessors(prototype, _header);\n accessors[lHeader] = true;\n }\n }\n utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);\n return this;\n }\n}\nAxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);\n\n// reserved names hotfix\nutils.reduceDescriptors(AxiosHeaders.prototype, (_ref3, key) => {\n let value = _ref3.value;\n let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`\n return {\n get: () => value,\n set(headerValue) {\n this[mapped] = headerValue;\n }\n };\n});\nutils.freezeMethods(AxiosHeaders);\nexport default AxiosHeaders;","'use strict';\n\nimport utils from './../utils.js';\nimport defaults from '../defaults/index.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Array|Function} fns A single function or Array of functions\n * @param {?Object} response The response object\n *\n * @returns {*} The resulting transformed data\n */\nexport default function transformData(fns, response) {\n const config = this || defaults;\n const context = response || config;\n const headers = AxiosHeaders.from(context.headers);\n let data = context.data;\n utils.forEach(fns, function transform(fn) {\n data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);\n });\n headers.normalize();\n return data;\n}","'use strict';\n\nexport default function isCancel(value) {\n return !!(value && value.__CANCEL__);\n}","'use strict';\n\nimport AxiosError from '../core/AxiosError.js';\nimport utils from '../utils.js';\n\n/**\n * A `CanceledError` is an object that is thrown when an operation is canceled.\n *\n * @param {string=} message The message.\n * @param {Object=} config The config.\n * @param {Object=} request The request.\n *\n * @returns {CanceledError} The created error.\n */\nfunction CanceledError(message, config, request) {\n // eslint-disable-next-line no-eq-null,eqeqeq\n AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);\n this.name = 'CanceledError';\n}\nutils.inherits(CanceledError, AxiosError, {\n __CANCEL__: true\n});\nexport default CanceledError;","import utils from './../utils.js';\nimport platform from '../platform/index.js';\nexport default platform.hasStandardBrowserEnv ?\n// Standard browser envs support document.cookie\n{\n write(name, value, expires, path, domain, secure) {\n const cookie = [name + '=' + encodeURIComponent(value)];\n utils.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());\n utils.isString(path) && cookie.push('path=' + path);\n utils.isString(domain) && cookie.push('domain=' + domain);\n secure === true && cookie.push('secure');\n document.cookie = cookie.join('; ');\n },\n read(name) {\n const match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n return match ? decodeURIComponent(match[3]) : null;\n },\n remove(name) {\n this.write(name, '', Date.now() - 86400000);\n }\n} :\n// Non-standard browser env (web workers, react-native) lack needed support.\n{\n write() {},\n read() {\n return null;\n },\n remove() {}\n};","'use strict';\n\nimport isAbsoluteURL from '../helpers/isAbsoluteURL.js';\nimport combineURLs from '../helpers/combineURLs.js';\n\n/**\n * Creates a new URL by combining the baseURL with the requestedURL,\n * only when the requestedURL is not already an absolute URL.\n * If the requestURL is absolute, this function returns the requestedURL untouched.\n *\n * @param {string} baseURL The base URL\n * @param {string} requestedURL Absolute or relative URL to combine\n *\n * @returns {string} The combined full path\n */\nexport default function buildFullPath(baseURL, requestedURL) {\n if (baseURL && !isAbsoluteURL(requestedURL)) {\n return combineURLs(baseURL, requestedURL);\n }\n return requestedURL;\n}","'use strict';\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n *\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nexport default function isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with \"://\" or \"//\" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n return /^([a-z][a-z\\d+\\-.]*:)?\\/\\//i.test(url);\n}","'use strict';\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n *\n * @returns {string} The combined URL\n */\nexport default function combineURLs(baseURL, relativeURL) {\n return relativeURL ? baseURL.replace(/\\/?\\/$/, '') + '/' + relativeURL.replace(/^\\/+/, '') : baseURL;\n}","'use strict';\n\nimport utils from './../utils.js';\nimport platform from '../platform/index.js';\nexport default platform.hasStandardBrowserEnv ?\n// Standard browser envs have full support of the APIs needed to test\n// whether the request URL is of the same origin as current location.\nfunction standardBrowserEnv() {\n const msie = /(msie|trident)/i.test(navigator.userAgent);\n const urlParsingNode = document.createElement('a');\n let originURL;\n\n /**\n * Parse a URL to discover its components\n *\n * @param {String} url The URL to be parsed\n * @returns {Object}\n */\n function resolveURL(url) {\n let href = url;\n if (msie) {\n // IE needs attribute set twice to normalize properties\n urlParsingNode.setAttribute('href', href);\n href = urlParsingNode.href;\n }\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: urlParsingNode.pathname.charAt(0) === '/' ? urlParsingNode.pathname : '/' + urlParsingNode.pathname\n };\n }\n originURL = resolveURL(window.location.href);\n\n /**\n * Determine if a URL shares the same origin as the current location\n *\n * @param {String} requestURL The URL to test\n * @returns {boolean} True if URL shares the same origin, otherwise false\n */\n return function isURLSameOrigin(requestURL) {\n const parsed = utils.isString(requestURL) ? resolveURL(requestURL) : requestURL;\n return parsed.protocol === originURL.protocol && parsed.host === originURL.host;\n };\n}() :\n// Non standard browser envs (web workers, react-native) lack needed support.\nfunction nonStandardBrowserEnv() {\n return function isURLSameOrigin() {\n return true;\n };\n}();","'use strict';\n\n/**\n * Calculate data maxRate\n * @param {Number} [samplesCount= 10]\n * @param {Number} [min= 1000]\n * @returns {Function}\n */\nfunction speedometer(samplesCount, min) {\n samplesCount = samplesCount || 10;\n const bytes = new Array(samplesCount);\n const timestamps = new Array(samplesCount);\n let head = 0;\n let tail = 0;\n let firstSampleTS;\n min = min !== undefined ? min : 1000;\n return function push(chunkLength) {\n const now = Date.now();\n const startedAt = timestamps[tail];\n if (!firstSampleTS) {\n firstSampleTS = now;\n }\n bytes[head] = chunkLength;\n timestamps[head] = now;\n let i = tail;\n let bytesCount = 0;\n while (i !== head) {\n bytesCount += bytes[i++];\n i = i % samplesCount;\n }\n head = (head + 1) % samplesCount;\n if (head === tail) {\n tail = (tail + 1) % samplesCount;\n }\n if (now - firstSampleTS < min) {\n return;\n }\n const passed = startedAt && now - startedAt;\n return passed ? Math.round(bytesCount * 1000 / passed) : undefined;\n };\n}\nexport default speedometer;","'use strict';\n\nfunction _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nimport utils from './../utils.js';\nimport settle from './../core/settle.js';\nimport cookies from './../helpers/cookies.js';\nimport buildURL from './../helpers/buildURL.js';\nimport buildFullPath from '../core/buildFullPath.js';\nimport isURLSameOrigin from './../helpers/isURLSameOrigin.js';\nimport transitionalDefaults from '../defaults/transitional.js';\nimport AxiosError from '../core/AxiosError.js';\nimport CanceledError from '../cancel/CanceledError.js';\nimport parseProtocol from '../helpers/parseProtocol.js';\nimport platform from '../platform/index.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport speedometer from '../helpers/speedometer.js';\nfunction progressEventReducer(listener, isDownloadStream) {\n let bytesNotified = 0;\n const _speedometer = speedometer(50, 250);\n return e => {\n const loaded = e.loaded;\n const total = e.lengthComputable ? e.total : undefined;\n const progressBytes = loaded - bytesNotified;\n const rate = _speedometer(progressBytes);\n const inRange = loaded <= total;\n bytesNotified = loaded;\n const data = {\n loaded,\n total,\n progress: total ? loaded / total : undefined,\n bytes: progressBytes,\n rate: rate ? rate : undefined,\n estimated: rate && total && inRange ? (total - loaded) / rate : undefined,\n event: e\n };\n data[isDownloadStream ? 'download' : 'upload'] = true;\n listener(data);\n };\n}\nconst isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';\nexport default isXHRAdapterSupported && function (config) {\n return new Promise(function dispatchXhrRequest(resolve, reject) {\n let requestData = config.data;\n const requestHeaders = AxiosHeaders.from(config.headers).normalize();\n let responseType = config.responseType,\n withXSRFToken = config.withXSRFToken;\n let onCanceled;\n function done() {\n if (config.cancelToken) {\n config.cancelToken.unsubscribe(onCanceled);\n }\n if (config.signal) {\n config.signal.removeEventListener('abort', onCanceled);\n }\n }\n let contentType;\n if (utils.isFormData(requestData)) {\n if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {\n requestHeaders.setContentType(false); // Let the browser set it\n } else if ((contentType = requestHeaders.getContentType()) !== false) {\n // fix semicolon duplication issue for ReactNative FormData implementation\n const _ref = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [],\n _ref2 = _toArray(_ref),\n type = _ref2[0],\n tokens = _ref2.slice(1);\n requestHeaders.setContentType([type || 'multipart/form-data', ...tokens].join('; '));\n }\n }\n let request = new XMLHttpRequest();\n\n // HTTP basic authentication\n if (config.auth) {\n const username = config.auth.username || '';\n const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';\n requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));\n }\n const fullPath = buildFullPath(config.baseURL, config.url);\n request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);\n\n // Set the request timeout in MS\n request.timeout = config.timeout;\n function onloadend() {\n if (!request) {\n return;\n }\n // Prepare the response\n const responseHeaders = AxiosHeaders.from('getAllResponseHeaders' in request && request.getAllResponseHeaders());\n const responseData = !responseType || responseType === 'text' || responseType === 'json' ? request.responseText : request.response;\n const response = {\n data: responseData,\n status: request.status,\n statusText: request.statusText,\n headers: responseHeaders,\n config,\n request\n };\n settle(function _resolve(value) {\n resolve(value);\n done();\n }, function _reject(err) {\n reject(err);\n done();\n }, response);\n\n // Clean up request\n request = null;\n }\n if ('onloadend' in request) {\n // Use onloadend if available\n request.onloadend = onloadend;\n } else {\n // Listen for ready state to emulate onloadend\n request.onreadystatechange = function handleLoad() {\n if (!request || request.readyState !== 4) {\n return;\n }\n\n // The request errored out and we didn't get a response, this will be\n // handled by onerror instead\n // With one exception: request that using file: protocol, most browsers\n // will return status as 0 even though it's a successful request\n if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {\n return;\n }\n // readystate handler is calling before onerror or ontimeout handlers,\n // so we should call onloadend on the next 'tick'\n setTimeout(onloadend);\n };\n }\n\n // Handle browser request cancellation (as opposed to a manual cancellation)\n request.onabort = function handleAbort() {\n if (!request) {\n return;\n }\n reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError() {\n // Real errors are hidden from us by the browser\n // onerror should only fire if it's a network error\n reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle timeout\n request.ontimeout = function handleTimeout() {\n let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';\n const transitional = config.transitional || transitionalDefaults;\n if (config.timeoutErrorMessage) {\n timeoutErrorMessage = config.timeoutErrorMessage;\n }\n reject(new AxiosError(timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, config, request));\n\n // Clean up request\n request = null;\n };\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n if (platform.hasStandardBrowserEnv) {\n withXSRFToken && utils.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));\n if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(fullPath)) {\n // Add xsrf header\n const xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);\n if (xsrfValue) {\n requestHeaders.set(config.xsrfHeaderName, xsrfValue);\n }\n }\n }\n\n // Remove Content-Type if data is undefined\n requestData === undefined && requestHeaders.setContentType(null);\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {\n request.setRequestHeader(key, val);\n });\n }\n\n // Add withCredentials to request if needed\n if (!utils.isUndefined(config.withCredentials)) {\n request.withCredentials = !!config.withCredentials;\n }\n\n // Add responseType to request if needed\n if (responseType && responseType !== 'json') {\n request.responseType = config.responseType;\n }\n\n // Handle progress if needed\n if (typeof config.onDownloadProgress === 'function') {\n request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));\n }\n\n // Not all browsers support upload events\n if (typeof config.onUploadProgress === 'function' && request.upload) {\n request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));\n }\n if (config.cancelToken || config.signal) {\n // Handle cancellation\n // eslint-disable-next-line func-names\n onCanceled = cancel => {\n if (!request) {\n return;\n }\n reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);\n request.abort();\n request = null;\n };\n config.cancelToken && config.cancelToken.subscribe(onCanceled);\n if (config.signal) {\n config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);\n }\n }\n const protocol = parseProtocol(fullPath);\n if (protocol && platform.protocols.indexOf(protocol) === -1) {\n reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));\n return;\n }\n\n // Send the request\n request.send(requestData || null);\n });\n};","'use strict';\n\nimport AxiosError from './AxiosError.js';\n\n/**\n * Resolve or reject a Promise based on response status.\n *\n * @param {Function} resolve A function that resolves the promise.\n * @param {Function} reject A function that rejects the promise.\n * @param {object} response The response.\n *\n * @returns {object} The response.\n */\nexport default function settle(resolve, reject, response) {\n const validateStatus = response.config.validateStatus;\n if (!response.status || !validateStatus || validateStatus(response.status)) {\n resolve(response);\n } else {\n reject(new AxiosError('Request failed with status code ' + response.status, [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], response.config, response.request, response));\n }\n}","'use strict';\n\nexport default function parseProtocol(url) {\n const match = /^([-+\\w]{1,25})(:?\\/\\/|:)/.exec(url);\n return match && match[1] || '';\n}","function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nimport utils from '../utils.js';\nimport httpAdapter from './http.js';\nimport xhrAdapter from './xhr.js';\nimport AxiosError from \"../core/AxiosError.js\";\nconst knownAdapters = {\n http: httpAdapter,\n xhr: xhrAdapter\n};\nutils.forEach(knownAdapters, (fn, value) => {\n if (fn) {\n try {\n Object.defineProperty(fn, 'name', {\n value\n });\n } catch (e) {\n // eslint-disable-next-line no-empty\n }\n Object.defineProperty(fn, 'adapterName', {\n value\n });\n }\n});\nconst renderReason = reason => `- ${reason}`;\nconst isResolvedHandle = adapter => utils.isFunction(adapter) || adapter === null || adapter === false;\nexport default {\n getAdapter: adapters => {\n adapters = utils.isArray(adapters) ? adapters : [adapters];\n const _adapters = adapters,\n length = _adapters.length;\n let nameOrAdapter;\n let adapter;\n const rejectedReasons = {};\n for (let i = 0; i < length; i++) {\n nameOrAdapter = adapters[i];\n let id;\n adapter = nameOrAdapter;\n if (!isResolvedHandle(nameOrAdapter)) {\n adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];\n if (adapter === undefined) {\n throw new AxiosError(`Unknown adapter '${id}'`);\n }\n }\n if (adapter) {\n break;\n }\n rejectedReasons[id || '#' + i] = adapter;\n }\n if (!adapter) {\n const reasons = Object.entries(rejectedReasons).map(_ref => {\n let _ref2 = _slicedToArray(_ref, 2),\n id = _ref2[0],\n state = _ref2[1];\n return `adapter ${id} ` + (state === false ? 'is not supported by the environment' : 'is not available in the build');\n });\n let s = length ? reasons.length > 1 ? 'since :\\n' + reasons.map(renderReason).join('\\n') : ' ' + renderReason(reasons[0]) : 'as no adapter specified';\n throw new AxiosError(`There is no suitable adapter to dispatch the request ` + s, 'ERR_NOT_SUPPORT');\n }\n return adapter;\n },\n adapters: knownAdapters\n};","'use strict';\n\nimport transformData from './transformData.js';\nimport isCancel from '../cancel/isCancel.js';\nimport defaults from '../defaults/index.js';\nimport CanceledError from '../cancel/CanceledError.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport adapters from \"../adapters/adapters.js\";\n\n/**\n * Throws a `CanceledError` if cancellation has been requested.\n *\n * @param {Object} config The config that is to be used for the request\n *\n * @returns {void}\n */\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n if (config.signal && config.signal.aborted) {\n throw new CanceledError(null, config);\n }\n}\n\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n *\n * @returns {Promise} The Promise to be fulfilled\n */\nexport default function dispatchRequest(config) {\n throwIfCancellationRequested(config);\n config.headers = AxiosHeaders.from(config.headers);\n\n // Transform request data\n config.data = transformData.call(config, config.transformRequest);\n if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {\n config.headers.setContentType('application/x-www-form-urlencoded', false);\n }\n const adapter = adapters.getAdapter(config.adapter || defaults.adapter);\n return adapter(config).then(function onAdapterResolution(response) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n response.data = transformData.call(config, config.transformResponse, response);\n response.headers = AxiosHeaders.from(response.headers);\n return response;\n }, function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n if (reason && reason.response) {\n reason.response.data = transformData.call(config, config.transformResponse, reason.response);\n reason.response.headers = AxiosHeaders.from(reason.response.headers);\n }\n }\n return Promise.reject(reason);\n });\n}","'use strict';\n\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport utils from '../utils.js';\nimport AxiosHeaders from \"./AxiosHeaders.js\";\nconst headersToObject = thing => thing instanceof AxiosHeaders ? _objectSpread({}, thing) : thing;\n\n/**\n * Config-specific merge-function which creates a new config-object\n * by merging two configuration objects together.\n *\n * @param {Object} config1\n * @param {Object} config2\n *\n * @returns {Object} New object resulting from merging config2 to config1\n */\nexport default function mergeConfig(config1, config2) {\n // eslint-disable-next-line no-param-reassign\n config2 = config2 || {};\n const config = {};\n function getMergedValue(target, source, caseless) {\n if (utils.isPlainObject(target) && utils.isPlainObject(source)) {\n return utils.merge.call({\n caseless\n }, target, source);\n } else if (utils.isPlainObject(source)) {\n return utils.merge({}, source);\n } else if (utils.isArray(source)) {\n return source.slice();\n }\n return source;\n }\n\n // eslint-disable-next-line consistent-return\n function mergeDeepProperties(a, b, caseless) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(a, b, caseless);\n } else if (!utils.isUndefined(a)) {\n return getMergedValue(undefined, a, caseless);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function valueFromConfig2(a, b) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(undefined, b);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function defaultToConfig2(a, b) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(undefined, b);\n } else if (!utils.isUndefined(a)) {\n return getMergedValue(undefined, a);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function mergeDirectKeys(a, b, prop) {\n if (prop in config2) {\n return getMergedValue(a, b);\n } else if (prop in config1) {\n return getMergedValue(undefined, a);\n }\n }\n const mergeMap = {\n url: valueFromConfig2,\n method: valueFromConfig2,\n data: valueFromConfig2,\n baseURL: defaultToConfig2,\n transformRequest: defaultToConfig2,\n transformResponse: defaultToConfig2,\n paramsSerializer: defaultToConfig2,\n timeout: defaultToConfig2,\n timeoutMessage: defaultToConfig2,\n withCredentials: defaultToConfig2,\n withXSRFToken: defaultToConfig2,\n adapter: defaultToConfig2,\n responseType: defaultToConfig2,\n xsrfCookieName: defaultToConfig2,\n xsrfHeaderName: defaultToConfig2,\n onUploadProgress: defaultToConfig2,\n onDownloadProgress: defaultToConfig2,\n decompress: defaultToConfig2,\n maxContentLength: defaultToConfig2,\n maxBodyLength: defaultToConfig2,\n beforeRedirect: defaultToConfig2,\n transport: defaultToConfig2,\n httpAgent: defaultToConfig2,\n httpsAgent: defaultToConfig2,\n cancelToken: defaultToConfig2,\n socketPath: defaultToConfig2,\n responseEncoding: defaultToConfig2,\n validateStatus: mergeDirectKeys,\n headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)\n };\n utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {\n const merge = mergeMap[prop] || mergeDeepProperties;\n const configValue = merge(config1[prop], config2[prop], prop);\n utils.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue);\n });\n return config;\n}","export const VERSION = \"1.6.8\";","'use strict';\n\nimport { VERSION } from '../env/data.js';\nimport AxiosError from '../core/AxiosError.js';\nconst validators = {};\n\n// eslint-disable-next-line func-names\n['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {\n validators[type] = function validator(thing) {\n return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;\n };\n});\nconst deprecatedWarnings = {};\n\n/**\n * Transitional option validator\n *\n * @param {function|boolean?} validator - set to false if the transitional option has been removed\n * @param {string?} version - deprecated version / removed since version\n * @param {string?} message - some message with additional info\n *\n * @returns {function}\n */\nvalidators.transitional = function transitional(validator, version, message) {\n function formatMessage(opt, desc) {\n return '[Axios v' + VERSION + '] Transitional option \\'' + opt + '\\'' + desc + (message ? '. ' + message : '');\n }\n\n // eslint-disable-next-line func-names\n return (value, opt, opts) => {\n if (validator === false) {\n throw new AxiosError(formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')), AxiosError.ERR_DEPRECATED);\n }\n if (version && !deprecatedWarnings[opt]) {\n deprecatedWarnings[opt] = true;\n // eslint-disable-next-line no-console\n console.warn(formatMessage(opt, ' has been deprecated since v' + version + ' and will be removed in the near future'));\n }\n return validator ? validator(value, opt, opts) : true;\n };\n};\n\n/**\n * Assert object's properties type\n *\n * @param {object} options\n * @param {object} schema\n * @param {boolean?} allowUnknown\n *\n * @returns {object}\n */\n\nfunction assertOptions(options, schema, allowUnknown) {\n if (typeof options !== 'object') {\n throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);\n }\n const keys = Object.keys(options);\n let i = keys.length;\n while (i-- > 0) {\n const opt = keys[i];\n const validator = schema[opt];\n if (validator) {\n const value = options[opt];\n const result = value === undefined || validator(value, opt, options);\n if (result !== true) {\n throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);\n }\n continue;\n }\n if (allowUnknown !== true) {\n throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);\n }\n }\n}\nexport default {\n assertOptions,\n validators\n};","'use strict';\n\nimport utils from './../utils.js';\nimport buildURL from '../helpers/buildURL.js';\nimport InterceptorManager from './InterceptorManager.js';\nimport dispatchRequest from './dispatchRequest.js';\nimport mergeConfig from './mergeConfig.js';\nimport buildFullPath from './buildFullPath.js';\nimport validator from '../helpers/validator.js';\nimport AxiosHeaders from './AxiosHeaders.js';\nconst validators = validator.validators;\n\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n *\n * @return {Axios} A new instance of Axios\n */\nclass Axios {\n constructor(instanceConfig) {\n this.defaults = instanceConfig;\n this.interceptors = {\n request: new InterceptorManager(),\n response: new InterceptorManager()\n };\n }\n\n /**\n * Dispatch a request\n *\n * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)\n * @param {?Object} config\n *\n * @returns {Promise} The Promise to be fulfilled\n */\n async request(configOrUrl, config) {\n try {\n return await this._request(configOrUrl, config);\n } catch (err) {\n if (err instanceof Error) {\n let dummy;\n Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : dummy = new Error();\n\n // slice off the Error: ... line\n const stack = dummy.stack ? dummy.stack.replace(/^.+\\n/, '') : '';\n if (!err.stack) {\n err.stack = stack;\n // match without the 2 top stack lines\n } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\\n.+\\n/, ''))) {\n err.stack += '\\n' + stack;\n }\n }\n throw err;\n }\n }\n _request(configOrUrl, config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof configOrUrl === 'string') {\n config = config || {};\n config.url = configOrUrl;\n } else {\n config = configOrUrl || {};\n }\n config = mergeConfig(this.defaults, config);\n const _config = config,\n transitional = _config.transitional,\n paramsSerializer = _config.paramsSerializer,\n headers = _config.headers;\n if (transitional !== undefined) {\n validator.assertOptions(transitional, {\n silentJSONParsing: validators.transitional(validators.boolean),\n forcedJSONParsing: validators.transitional(validators.boolean),\n clarifyTimeoutError: validators.transitional(validators.boolean)\n }, false);\n }\n if (paramsSerializer != null) {\n if (utils.isFunction(paramsSerializer)) {\n config.paramsSerializer = {\n serialize: paramsSerializer\n };\n } else {\n validator.assertOptions(paramsSerializer, {\n encode: validators.function,\n serialize: validators.function\n }, true);\n }\n }\n\n // Set config.method\n config.method = (config.method || this.defaults.method || 'get').toLowerCase();\n\n // Flatten headers\n let contextHeaders = headers && utils.merge(headers.common, headers[config.method]);\n headers && utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], method => {\n delete headers[method];\n });\n config.headers = AxiosHeaders.concat(contextHeaders, headers);\n\n // filter out skipped interceptors\n const requestInterceptorChain = [];\n let synchronousRequestInterceptors = true;\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {\n return;\n }\n synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;\n requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n const responseInterceptorChain = [];\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);\n });\n let promise;\n let i = 0;\n let len;\n if (!synchronousRequestInterceptors) {\n const chain = [dispatchRequest.bind(this), undefined];\n chain.unshift.apply(chain, requestInterceptorChain);\n chain.push.apply(chain, responseInterceptorChain);\n len = chain.length;\n promise = Promise.resolve(config);\n while (i < len) {\n promise = promise.then(chain[i++], chain[i++]);\n }\n return promise;\n }\n len = requestInterceptorChain.length;\n let newConfig = config;\n i = 0;\n while (i < len) {\n const onFulfilled = requestInterceptorChain[i++];\n const onRejected = requestInterceptorChain[i++];\n try {\n newConfig = onFulfilled(newConfig);\n } catch (error) {\n onRejected.call(this, error);\n break;\n }\n }\n try {\n promise = dispatchRequest.call(this, newConfig);\n } catch (error) {\n return Promise.reject(error);\n }\n i = 0;\n len = responseInterceptorChain.length;\n while (i < len) {\n promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);\n }\n return promise;\n }\n getUri(config) {\n config = mergeConfig(this.defaults, config);\n const fullPath = buildFullPath(config.baseURL, config.url);\n return buildURL(fullPath, config.params, config.paramsSerializer);\n }\n}\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function (url, config) {\n return this.request(mergeConfig(config || {}, {\n method,\n url,\n data: (config || {}).data\n }));\n };\n});\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n\n function generateHTTPMethod(isForm) {\n return function httpMethod(url, data, config) {\n return this.request(mergeConfig(config || {}, {\n method,\n headers: isForm ? {\n 'Content-Type': 'multipart/form-data'\n } : {},\n url,\n data\n }));\n };\n }\n Axios.prototype[method] = generateHTTPMethod();\n Axios.prototype[method + 'Form'] = generateHTTPMethod(true);\n});\nexport default Axios;","'use strict';\n\nimport CanceledError from './CanceledError.js';\n\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @param {Function} executor The executor function.\n *\n * @returns {CancelToken}\n */\nclass CancelToken {\n constructor(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n let resolvePromise;\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n const token = this;\n\n // eslint-disable-next-line func-names\n this.promise.then(cancel => {\n if (!token._listeners) return;\n let i = token._listeners.length;\n while (i-- > 0) {\n token._listeners[i](cancel);\n }\n token._listeners = null;\n });\n\n // eslint-disable-next-line func-names\n this.promise.then = onfulfilled => {\n let _resolve;\n // eslint-disable-next-line func-names\n const promise = new Promise(resolve => {\n token.subscribe(resolve);\n _resolve = resolve;\n }).then(onfulfilled);\n promise.cancel = function reject() {\n token.unsubscribe(_resolve);\n };\n return promise;\n };\n executor(function cancel(message, config, request) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n token.reason = new CanceledError(message, config, request);\n resolvePromise(token.reason);\n });\n }\n\n /**\n * Throws a `CanceledError` if cancellation has been requested.\n */\n throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n }\n\n /**\n * Subscribe to the cancel signal\n */\n\n subscribe(listener) {\n if (this.reason) {\n listener(this.reason);\n return;\n }\n if (this._listeners) {\n this._listeners.push(listener);\n } else {\n this._listeners = [listener];\n }\n }\n\n /**\n * Unsubscribe from the cancel signal\n */\n\n unsubscribe(listener) {\n if (!this._listeners) {\n return;\n }\n const index = this._listeners.indexOf(listener);\n if (index !== -1) {\n this._listeners.splice(index, 1);\n }\n }\n\n /**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\n static source() {\n let cancel;\n const token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token,\n cancel\n };\n }\n}\nexport default CancelToken;","function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nconst HttpStatusCode = {\n Continue: 100,\n SwitchingProtocols: 101,\n Processing: 102,\n EarlyHints: 103,\n Ok: 200,\n Created: 201,\n Accepted: 202,\n NonAuthoritativeInformation: 203,\n NoContent: 204,\n ResetContent: 205,\n PartialContent: 206,\n MultiStatus: 207,\n AlreadyReported: 208,\n ImUsed: 226,\n MultipleChoices: 300,\n MovedPermanently: 301,\n Found: 302,\n SeeOther: 303,\n NotModified: 304,\n UseProxy: 305,\n Unused: 306,\n TemporaryRedirect: 307,\n PermanentRedirect: 308,\n BadRequest: 400,\n Unauthorized: 401,\n PaymentRequired: 402,\n Forbidden: 403,\n NotFound: 404,\n MethodNotAllowed: 405,\n NotAcceptable: 406,\n ProxyAuthenticationRequired: 407,\n RequestTimeout: 408,\n Conflict: 409,\n Gone: 410,\n LengthRequired: 411,\n PreconditionFailed: 412,\n PayloadTooLarge: 413,\n UriTooLong: 414,\n UnsupportedMediaType: 415,\n RangeNotSatisfiable: 416,\n ExpectationFailed: 417,\n ImATeapot: 418,\n MisdirectedRequest: 421,\n UnprocessableEntity: 422,\n Locked: 423,\n FailedDependency: 424,\n TooEarly: 425,\n UpgradeRequired: 426,\n PreconditionRequired: 428,\n TooManyRequests: 429,\n RequestHeaderFieldsTooLarge: 431,\n UnavailableForLegalReasons: 451,\n InternalServerError: 500,\n NotImplemented: 501,\n BadGateway: 502,\n ServiceUnavailable: 503,\n GatewayTimeout: 504,\n HttpVersionNotSupported: 505,\n VariantAlsoNegotiates: 506,\n InsufficientStorage: 507,\n LoopDetected: 508,\n NotExtended: 510,\n NetworkAuthenticationRequired: 511\n};\nObject.entries(HttpStatusCode).forEach(_ref => {\n let _ref2 = _slicedToArray(_ref, 2),\n key = _ref2[0],\n value = _ref2[1];\n HttpStatusCode[value] = key;\n});\nexport default HttpStatusCode;","'use strict';\n\nimport utils from './utils.js';\nimport bind from './helpers/bind.js';\nimport Axios from './core/Axios.js';\nimport mergeConfig from './core/mergeConfig.js';\nimport defaults from './defaults/index.js';\nimport formDataToJSON from './helpers/formDataToJSON.js';\nimport CanceledError from './cancel/CanceledError.js';\nimport CancelToken from './cancel/CancelToken.js';\nimport isCancel from './cancel/isCancel.js';\nimport { VERSION } from './env/data.js';\nimport toFormData from './helpers/toFormData.js';\nimport AxiosError from './core/AxiosError.js';\nimport spread from './helpers/spread.js';\nimport isAxiosError from './helpers/isAxiosError.js';\nimport AxiosHeaders from \"./core/AxiosHeaders.js\";\nimport adapters from './adapters/adapters.js';\nimport HttpStatusCode from './helpers/HttpStatusCode.js';\n\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n *\n * @returns {Axios} A new instance of Axios\n */\nfunction createInstance(defaultConfig) {\n const context = new Axios(defaultConfig);\n const instance = bind(Axios.prototype.request, context);\n\n // Copy axios.prototype to instance\n utils.extend(instance, Axios.prototype, context, {\n allOwnKeys: true\n });\n\n // Copy context to instance\n utils.extend(instance, context, null, {\n allOwnKeys: true\n });\n\n // Factory for creating new instances\n instance.create = function create(instanceConfig) {\n return createInstance(mergeConfig(defaultConfig, instanceConfig));\n };\n return instance;\n}\n\n// Create the default instance to be exported\nconst axios = createInstance(defaults);\n\n// Expose Axios class to allow class inheritance\naxios.Axios = Axios;\n\n// Expose Cancel & CancelToken\naxios.CanceledError = CanceledError;\naxios.CancelToken = CancelToken;\naxios.isCancel = isCancel;\naxios.VERSION = VERSION;\naxios.toFormData = toFormData;\n\n// Expose AxiosError class\naxios.AxiosError = AxiosError;\n\n// alias for CanceledError for backward compatibility\naxios.Cancel = axios.CanceledError;\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\naxios.spread = spread;\n\n// Expose isAxiosError\naxios.isAxiosError = isAxiosError;\n\n// Expose mergeConfig\naxios.mergeConfig = mergeConfig;\naxios.AxiosHeaders = AxiosHeaders;\naxios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);\naxios.getAdapter = adapters.getAdapter;\naxios.HttpStatusCode = HttpStatusCode;\naxios.default = axios;\n\n// this module should only have a default export\nexport default axios;","'use strict';\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * var args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n *\n * @returns {Function}\n */\nexport default function spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n}","'use strict';\n\nimport utils from './../utils.js';\n\n/**\n * Determines whether the payload is an error thrown by Axios\n *\n * @param {*} payload The value to test\n *\n * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false\n */\nexport default function isAxiosError(payload) {\n return utils.isObject(payload) && payload.isAxiosError === true;\n}","import DsDynoChart from \"./DsDynoChart\";\nimport DsQueueChart from \"./DsQueueChart\";\nimport * as React from \"react\";\nimport {useCallback, useEffect, useRef, useState} from \"react\";\nimport {ErrorBoundary} from \"react-error-boundary\";\nimport DsErrorFallback from \"./DsErrorFallback\";\nimport {numbersAfterAndUpToIncluding} from \"./DsMonitoringUtils\";\n\n\nconst FORMATION_TYPE_WEB = \"web\";\nconst MISSING_DATA_MIN_WIDTH_MS = 300_000;\n\n\ntype MeasurementAt = number[]\n\ntype Queue = {\n name: string;\n measurements: ((number)[])[];\n}\ntype Records = {\n active: MeasurementAt[];\n queues: Queue[];\n}\n\ntype AutoscaleRule = {\n id: number;\n up: number;\n down: number;\n}\n\ntype ThresholdChange = {\n timestamp: number;\n autoscaleRule: AutoscaleRule;\n}\n\ntype DynoAt = [number, number]\n\nclass MonitoringPayload {\n after: number;\n dynos: DynoAt[] | null;\n formationName: string;\n formationType: string;\n records: Records;\n thresholds: ThresholdChange[] | null;\n timeIncrement: number;\n until: number;\n\n static fromJson(json: {}): MonitoringPayload {\n let monitoringPayload = new MonitoringPayload();\n Object.assign(monitoringPayload, json);\n console.log(`monitoringPayload ⤵`);\n console.log(monitoringPayload);\n return monitoringPayload;\n }\n}\n\nMonitoringPayload.prototype.toString = function () {\n return `MonitoringPayload(after:${this.after}, before: ${this.before})`;\n};\n\ntype MsSinceEpoch = number\ntype MeasuredValue = number | null\n\ntype ChartDatapoint = {\n x: MsSinceEpoch,\n y: MeasuredValue\n}\n\nclass MonitoringVM {\n formationType: string;\n measurementsName: string;\n threshUp: Array;\n threshDown: Array;\n max: Array;\n maxP95?: Array;\n missing: Array;\n dynos: Array;\n\n\n constructor(formationType: string) {\n this.formationType = formationType;\n this.measurementsName = \"\";\n this.threshUp = [];\n this.threshDown = [];\n this.max = [];\n this.maxP95 = this.isWebFormation() ? [] : null;\n this.missing = [];\n this.dynos = [];\n }\n\n static fromPayload(payload: MonitoringPayload, queueName?: string): MonitoringVM {\n return monitoringPayloadToVM(payload, queueName);\n }\n\n isWebFormation(): boolean {\n return this.formationType === FORMATION_TYPE_WEB;\n }\n}\n\n/**\n * Return MonitoringVM created from MonitoringPayload\n * if queu\n * @param payload MonitoringPayload to be used as source\n * @param queueName (optional) name of queue to show, default to showing \"active\" measurements (this could be different\n * queues at different times as active rules change throughout the time )\n */\nfunction monitoringPayloadToVM(\n payload: MonitoringPayload,\n queueName?: string\n): MonitoringVM {\n console.log(`monitoringPayloadToVM ⤵ : ${payload}`);\n console.log(payload);\n\n const doShowActive = !queueName || queueName === ACTIVE_MEASUREMENT;\n console.log(`\\t We will ${doShowActive ? \"show active measurements.\" : `be showing queue: \"${queueName}\"`}`);\n\n const {after, until, timeIncrement, records, thresholds, dynos, formationName, formationType} = payload;\n const measurements = doShowActive ? records.active : records.queues[queueName];\n const timeIncrementMs = timeIncrement * 1_000;\n const afterMs = 1_000 * (after + timeIncrement)\n const untilMs = 1_000 * until\n const lastIndex = measurements.length - 1;\n\n // Build an array of all valid timestamp in the time windows of this payload\n\n const timeWindowMs = Array.from(\n {length: 1 + (untilMs - afterMs) / timeIncrementMs},\n (_, i) => untilMs - (i * timeIncrementMs)\n );\n timeWindowMs.reverse();\n\n const viewModel = new MonitoringVM(formationType);\n viewModel.measurementsName = queueName;\n\n function pushMeasurementDataGap(gapStart: number, gapEnd: number) {\n viewModel.max.push({x: gapStart, y: null});\n viewModel.max.push({x: gapEnd, y: null});\n if (viewModel.isWebFormation()) {\n viewModel.maxP95.push({x: gapStart, y: null});\n viewModel.maxP95.push({x: gapEnd, y: null});\n }\n viewModel.missing.push({x: gapStart, y: 1})\n viewModel.missing.push({x: gapEnd, y: 0})\n }\n\n for (let i = 0; i <= lastIndex; i++) {\n const measurementAt = measurements[i];\n const timestampMs = measurementAt[0] * 1_000;\n\n if (i === 0 && timestampMs > afterMs) {\n // missing data at start, add null to correct the chart timeline\n console.log(\"measurements: null at the beginning \");\n viewModel.max.push({x: afterMs, y: null});\n if (viewModel.isWebFormation()) {\n viewModel.maxP95.push({x: afterMs, y: null});\n }\n if (timestampMs - afterMs > MISSING_DATA_MIN_WIDTH_MS) {\n // null chart data between wide gaps and highlight them\n console.log(\"measurements: data gap at start\");\n const gapEnd = timestampMs - timeIncrementMs;\n\n viewModel.max.push({x: gapEnd, y: null});\n if (viewModel.isWebFormation()) {\n viewModel.maxP95.push({x: gapEnd, y: null});\n }\n // also add this gap to missing data\n viewModel.missing.push({x: afterMs, y: 1})\n viewModel.missing.push({x: gapEnd, y: 0})\n }\n\n }\n // null chart data between wide gaps and highlight them\n if (i > 0 && timestampMs - viewModel.max.slice(-1)[0].x > MISSING_DATA_MIN_WIDTH_MS) {\n // the gap between last datapoint and this one is too large\n console.log(\"measurements: data gap within\");\n pushMeasurementDataGap(viewModel.max.slice(-1)[0].x + timeIncrementMs, timestampMs - timeIncrementMs);\n }\n\n // add the actual measurement data\n viewModel.max.push({x: timestampMs, y: measurementAt[1]});\n if (viewModel.isWebFormation()) {\n viewModel.maxP95.push({x: timestampMs, y: measurementAt[2]});\n }\n\n if (i === lastIndex && timestampMs < untilMs) {\n // missing data at the end, add null to correct the chart timeline\n // null chart data between last valid data and end if gap wide enough and show the gap\n console.log(`measurements: Last index: ${i}, timestampMs: ${timestampMs} viewModel.max.slice(-1)[0].x: ${viewModel.max.slice(-1)[0].x}`);\n if (untilMs - viewModel.max.slice(-1)[0].x >= MISSING_DATA_MIN_WIDTH_MS) {\n console.log(\"measurements: gap at the end too large \");\n // the gap between last datapoint and this one is too large\n pushMeasurementDataGap(viewModel.max.slice(-1)[0].x + timeIncrementMs, untilMs);\n }\n console.log(\"measurements: null at the end \");\n viewModel.max.push({x: untilMs, y: null});\n if (viewModel.isWebFormation()) {\n viewModel.maxP95.push({x: untilMs, y: null});\n }\n }\n }\n\n\n // ScaleUP/DOWN annotations ####################################################################################\n if (thresholds) {\n // Take the sparse thresholds received in payload and create a datapoint for each valid timestamp after first\n // received threshold; repeating the values until we hit next in in the sparse array from payload\n const thresholdsForShifting = [...thresholds];\n // First shallow clone the array and sort it by timestamp (just in case they didn't come sorted)\n thresholdsForShifting.sort((a, b) => {\n return a.timestamp - b.timestamp\n });\n let nextThresholdAt = thresholdsForShifting.shift();\n // let currentAutoscaleRule = thresholdsForShifting && thresholdsForShifting[0] && thresholdsForShifting[0].autoscaleRule\n let currentAutoscaleRule = null;\n for (let eachTimestamp of numbersAfterAndUpToIncluding(after, until, timeIncrement)) {\n while ( // this is a while (not if) because we should be able to skip over ALL invalidated timestamps in one go\n nextThresholdAt !== undefined\n && eachTimestamp >= nextThresholdAt.timestamp // current timestamp is at or after next threshold timestamp\n && thresholdsForShifting.length > 0 // and we have another threshold to shift to\n ) {\n // next is current\n currentAutoscaleRule = nextThresholdAt.autoscaleRule;\n nextThresholdAt = thresholdsForShifting.shift();\n }\n if (!currentAutoscaleRule) {\n // this protects filling up the start of chart with assumed data\n continue;\n }\n viewModel.threshUp.push({x: 1000 * eachTimestamp, y: currentAutoscaleRule.up});\n viewModel.threshDown.push({x: 1000 * eachTimestamp, y: currentAutoscaleRule.down});\n }\n }\n\n // Dynos #######################################################################################################\n if (dynos) {\n const dynosLastIndex = dynos.length - 1;\n for (let i = 0; i < dynos.length; i++) {\n const dynoAt: DynoAt = dynos[i];\n const timestampMs = 1000 * dynoAt[0];\n\n // if we're adding first dyno record and the timestamp is larger than payload.after add an empty record\n // because there is at least one missing dyno record and we want both charts to start at same time\n if (i === 0 && timestampMs > afterMs) {\n // if we are missing dynodata at the beginning\n console.log(\"dynos: null at the beginning \");\n viewModel.dynos.push({x: afterMs, y: null});\n }\n\n viewModel.dynos.push({x: timestampMs, y: dynoAt[1]});\n\n // After adding the last dyno record check if the last record timestamp equals valid window timestamp, if not\n // add empty record as we are missing data at the end of the time window\n if (i === dynosLastIndex && timestampMs < untilMs) {\n // if we are missing data at the end\n console.log(\"dynos: null at the end \");\n viewModel.dynos.push({x: untilMs, y: null});\n }\n }\n }\n\n // Return view model\n return viewModel;\n}\n\nfunction getQueueChartDatasets(vm: MonitoringVM): Array