From 8ac893855c179d1052f6147a255a550f718ea0a8 Mon Sep 17 00:00:00 2001 From: josdejong Date: Fri, 10 May 2013 17:22:20 +0200 Subject: [PATCH] Halfway implementation of groups --- Jakefile.js | 3 + examples/timeline/05_groups.html | 60 +++ src/component/css/groupset.css | 7 + src/component/css/item.css | 17 - src/component/css/itemset.css | 28 ++ src/component/groupset.js | 389 +++++++++++++++ src/component/itemset.js | 113 ++--- src/stack.js | 2 +- src/visualization/timeline.js | 166 +++++-- vis.js | 799 +++++++++++++++++++++++++------ vis.min.js | 8 +- 11 files changed, 1308 insertions(+), 284 deletions(-) create mode 100644 examples/timeline/05_groups.html create mode 100644 src/component/css/groupset.css create mode 100644 src/component/css/itemset.css create mode 100644 src/component/groupset.js diff --git a/Jakefile.js b/Jakefile.js index 5d03d365..05eaab7c 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -30,6 +30,8 @@ task('build', {async: true}, function () { var result = concat({ src: [ './src/component/css/panel.css', + './src/component/css/groupset.css', + './src/component/css/itemset.css', './src/component/css/item.css', './src/component/css/timeaxis.css' ], @@ -59,6 +61,7 @@ task('build', {async: true}, function () { './src/component/timeaxis.js', './src/component/itemset.js', './src/component/item/*.js', + './src/component/groupset.js', './src/visualization/timeline.js', diff --git a/examples/timeline/05_groups.html b/examples/timeline/05_groups.html new file mode 100644 index 00000000..bb67bc0c --- /dev/null +++ b/examples/timeline/05_groups.html @@ -0,0 +1,60 @@ + + + + Timeline | Group example + + + + + + +
+ + + + \ No newline at end of file diff --git a/src/component/css/groupset.css b/src/component/css/groupset.css new file mode 100644 index 00000000..6ce62586 --- /dev/null +++ b/src/component/css/groupset.css @@ -0,0 +1,7 @@ + +.graph .groupset { + position: absolute; + padding: 0; + margin: 0; + overflow: hidden; +} diff --git a/src/component/css/item.css b/src/component/css/item.css index 7d16561b..d3458141 100644 --- a/src/component/css/item.css +++ b/src/component/css/item.css @@ -1,21 +1,4 @@ -.graph .itemset { - position: absolute; - padding: 0; - margin: 0; - overflow: hidden; -} - -.graph .background { -} - -.graph .foreground { -} - -.graph .itemset-axis { - position: absolute; -} - .graph .item { position: absolute; color: #1A1A1A; diff --git a/src/component/css/itemset.css b/src/component/css/itemset.css new file mode 100644 index 00000000..c80800c8 --- /dev/null +++ b/src/component/css/itemset.css @@ -0,0 +1,28 @@ + +.graph .itemset { + position: absolute; + padding: 0; + margin: 0; + overflow: hidden; +} + +.graph .groupset .itemset { + position: relative; + padding: 0; + margin: 0; + overflow: hidden; +} + +.graph .background { +} + +.graph .foreground { +} + +.graph .itemset-axis { + position: absolute; +} + +.graph .groupset .itemset-axis { + position: relative; +} \ No newline at end of file diff --git a/src/component/groupset.js b/src/component/groupset.js new file mode 100644 index 00000000..76c45677 --- /dev/null +++ b/src/component/groupset.js @@ -0,0 +1,389 @@ +/** + * An GroupSet holds a set of groups + * @param {Component} parent + * @param {Component[]} [depends] Components on which this components depends + * (except for the parent) + * @param {Object} [options] See GroupSet.setOptions for the available + * options. + * @constructor GroupSet + * @extends Panel + */ +function GroupSet(parent, depends, options) { + this.id = util.randomUUID(); + this.parent = parent; + this.depends = depends; + + this.options = {}; + + this.range = null; // Range or Object {start: number, end: number} + this.items = null; // dataset with items + this.groups = null; // dataset with groups + + this.contents = {}; // object with an ItemSet for every group + + // changes in groups are queued + this.queue = {}; + + var me = this; + this.listeners = { + 'add': function (event, params) { + me._onAdd(params.items); + }, + 'update': function (event, params) { + me._onUpdate(params.items); + }, + 'remove': function (event, params) { + me._onRemove(params.items); + } + }; + + if (options) { + this.setOptions(options); + } +} + +GroupSet.prototype = new Panel(); + +/** + * Set options for the ItemSet. Existing options will be extended/overwritten. + * @param {Object} [options] The following options are available: + * TODO: describe options + */ +GroupSet.prototype.setOptions = function setOptions(options) { + util.extend(this.options, options); + + // TODO: implement options +}; + +GroupSet.prototype.setRange = function (range) { + // TODO: implement setRange +}; + +/** + * Set items + * @param {vis.DataSet | null} items + */ +GroupSet.prototype.setItems = function setItems(items) { + this.items = items; + + util.forEach(this.contents, function (group) { + group.setItems(items); + }); + +}; + +/** + * Get items + * @return {vis.DataSet | null} items + */ +GroupSet.prototype.getItems = function getItems() { + return this.items; +}; + +/** + * Set range (start and end). + * @param {Range | Object} range A Range or an object containing start and end. + */ +GroupSet.prototype.setRange = function setRange(range) { + this.range = range; +}; + +/** + * Set groups + * @param {vis.DataSet} groups + */ +GroupSet.prototype.setGroups = function setGroups(groups) { + var me = this, + dataGroups, + ids; + + // unsubscribe from current dataset + if (this.groups) { + util.forEach(this.listeners, function (callback, event) { + me.groups.unsubscribe(event, callback); + }); + + // remove all drawn groups + dataGroups = this.groups.get({fields: ['id']}); + ids = []; + util.forEach(dataGroups, function (dataGroup, index) { + ids[index] = dataGroup.id; + }); + this._onRemove(ids); + } + + // replace the dataset + if (!groups) { + this.groups = null; + } + else if (groups instanceof DataSet) { + this.groups = groups; + } + else { + this.groups = new DataSet({ + fieldTypes: { + start: 'Date', + end: 'Date' + } + }); + this.groups.add(groups); + } + + if (this.groups) { + // subscribe to new dataset + var id = this.id; + util.forEach(this.listeners, function (callback, event) { + me.groups.subscribe(event, callback, id); + }); + + // draw all new groups + dataGroups = this.groups.get({fields: ['id']}); + ids = []; + util.forEach(dataGroups, function (dataGroup, index) { + ids[index] = dataGroup.id; + }); + this._onAdd(ids); + } +}; + +/** + * Get groups + * @return {vis.DataSet | null} groups + */ +GroupSet.prototype.getGroups = function getGroups() { + return this.groups; +}; + +/** + * Repaint the component + * @return {Boolean} changed + */ +GroupSet.prototype.repaint = function repaint() { + var changed = 0, + update = util.updateProperty, + asSize = util.option.asSize, + options = this.options, + frame = this.frame; + + if (!frame) { + frame = document.createElement('div'); + frame.className = 'groupset'; + + if (options.className) { + util.addClassName(frame, util.option.asString(options.className)); + } + + this.frame = frame; + changed += 1; + } + + if (!this.parent) { + throw new Error('Cannot repaint groupset: no parent attached'); + } + var parentContainer = this.parent.getContainer(); + if (!parentContainer) { + throw new Error('Cannot repaint groupset: parent has no container element'); + } + if (!frame.parentNode) { + parentContainer.appendChild(frame); + changed += 1; + } + + // reposition frame + changed += update(frame.style, 'height', asSize(options.height, this.height + 'px')); + changed += update(frame.style, 'top', asSize(options.top, '0px')); + changed += update(frame.style, 'left', asSize(options.left, '0px')); + changed += update(frame.style, 'width', asSize(options.width, '100%')); + + var me = this, + queue = this.queue, + items = this.items, + contents = this.contents, + groups = this.groups, + dataOptions = { + fields: ['id', 'content'] + }; + + // show/hide added/changed/removed items + Object.keys(queue).forEach(function (id) { + var entry = queue[id]; + var group = entry.item; + //noinspection FallthroughInSwitchStatementJS + switch (entry.action) { + case 'add': + // TODO: create group + group = new ItemSet(me); + group.setRange(me.range); + group.setItems(me.items); + + // update lists + contents[id] = group; + delete queue[id]; + break; + + case 'update': + // TODO: update group + + // update lists + contents[id] = group; + delete queue[id]; + break; + + case 'remove': + if (group) { + // remove DOM of the group + changed += group.hide(); + } + + // update lists + delete contents[id]; + delete queue[id]; + break; + + default: + console.log('Error: unknown action "' + entry.action + '"'); + } + }); + + // reposition all groups + util.forEach(this.contents, function (group) { + changed += group.repaint(); + }); + + return (changed > 0); +}; + +/** + * Get container element + * @return {HTMLElement} container + */ +GroupSet.prototype.getContainer = function getContainer() { + // TODO: replace later on with container element for holding itemsets + return this.frame; +}; + +/** + * Reflow the component + * @return {Boolean} resized + */ +GroupSet.prototype.reflow = function reflow() { + var changed = 0, + options = this.options, + update = util.updateProperty, + asNumber = util.option.asNumber, + frame = this.frame; + + if (frame) { + // reposition all groups + util.forEach(this.contents, function (group) { + changed += group.reflow(); + }); + + var maxHeight = asNumber(options.maxHeight); + var height; + if (options.height != null) { + height = frame.offsetHeight; + } + else { + // height is not specified, calculate the sum of the height of all groups + height = 0; + util.forEach(this.contents, function (group) { + height += group.height; + }); + } + if (maxHeight != null) { + height = Math.min(height, maxHeight); + } + changed += update(this, 'height', height); + + changed += update(this, 'top', frame.offsetTop); + changed += update(this, 'left', frame.offsetLeft); + changed += update(this, 'width', frame.offsetWidth); + } + + return (changed > 0); +}; + +/** + * Hide the component from the DOM + * @return {Boolean} changed + */ +GroupSet.prototype.hide = function hide() { + if (this.frame && this.frame.parentNode) { + this.frame.parentNode.removeChild(this.frame); + return true; + } + else { + return false; + } +}; + +/** + * Show the component in the DOM (when not already visible). + * A repaint will be executed when the component is not visible + * @return {Boolean} changed + */ +GroupSet.prototype.show = function show() { + if (!this.frame || !this.frame.parentNode) { + return this.repaint(); + } + else { + return false; + } +}; + +/** + * Handle updated groups + * @param {Number[]} ids + * @private + */ +GroupSet.prototype._onUpdate = function _onUpdate(ids) { + this._toQueue(ids, 'update'); +}; + +/** + * Handle changed groups + * @param {Number[]} ids + * @private + */ +GroupSet.prototype._onAdd = function _onAdd(ids) { + this._toQueue(ids, 'add'); +}; + +/** + * Handle removed groups + * @param {Number[]} ids + * @private + */ +GroupSet.prototype._onRemove = function _onRemove(ids) { + this._toQueue(ids, 'remove'); +}; + +/** + * Put groups in the queue to be added/updated/remove + * @param {Number[]} ids + * @param {String} action can be 'add', 'update', 'remove' + */ +GroupSet.prototype._toQueue = function _toQueue(ids, action) { + var groups = this.groups; + var queue = this.queue; + ids.forEach(function (id) { + var entry = queue[id]; + if (entry) { + // already queued, update the action of the entry + entry.action = action; + } + else { + // not yet queued, add an entry to the queue + queue[id] = { + item: groups[id] || null, + action: action + }; + } + }); + + if (this.controller) { + //this.requestReflow(); + this.requestRepaint(); + } +}; diff --git a/src/component/itemset.js b/src/component/itemset.js index 564dd0c3..0b350547 100644 --- a/src/component/itemset.js +++ b/src/component/itemset.js @@ -31,8 +31,9 @@ function ItemSet(parent, depends, options) { this.dom = {}; var me = this; - this.data = null; // DataSet + this.items = null; // DataSet this.range = null; // Range or Object {start: number, end: number} + this.listeners = { 'add': function (event, params) { me._onAdd(params.items); @@ -45,8 +46,8 @@ function ItemSet(parent, depends, options) { } }; - this.items = {}; - this.queue = {}; // queue with items to be added/updated/removed + this.contents = {}; // object with an Item for every data item + this.queue = {}; // queue with id/actions: 'add', 'update', 'delete' this.stack = new Stack(this); this.conversion = null; @@ -179,8 +180,8 @@ ItemSet.prototype.repaint = function repaint() { var me = this, queue = this.queue, - data = this.data, items = this.items, + contents = this.contents, dataOptions = { fields: ['id', 'start', 'end', 'content', 'type'] }; @@ -189,13 +190,16 @@ ItemSet.prototype.repaint = function repaint() { // show/hide added/changed/removed items Object.keys(queue).forEach(function (id) { - var entry = queue[id]; - var item = entry.item; + //var entry = queue[id]; + var action = queue[id]; + var item = contents[id]; + //var item = entry.item; //noinspection FallthroughInSwitchStatementJS - switch (entry.action) { + switch (action) { case 'add': case 'update': - var itemData = data.get(id, dataOptions); + var itemData = items.get(id, dataOptions); + var type = itemData.type || (itemData.start && itemData.end && 'range') || 'box'; @@ -227,7 +231,7 @@ ItemSet.prototype.repaint = function repaint() { } // update lists - items[id] = item; + contents[id] = item; delete queue[id]; break; @@ -238,17 +242,17 @@ ItemSet.prototype.repaint = function repaint() { } // update lists - delete items[id]; + delete contents[id]; delete queue[id]; break; default: - console.log('Error: unknown action "' + entry.action + '"'); + console.log('Error: unknown action "' + action + '"'); } }); // reposition all items. Show items only when in the visible area - util.forEach(this.items, function (item) { + util.forEach(this.contents, function (item) { if (item.visible) { changed += item.show(); item.reposition(); @@ -299,7 +303,7 @@ ItemSet.prototype.reflow = function reflow () { if (frame) { this._updateConversion(); - util.forEach(this.items, function (item) { + util.forEach(this.contents, function (item) { changed += item.reflow(); }); @@ -367,15 +371,15 @@ ItemSet.prototype.hide = function hide() { /** * Set items - * @param {vis.DataSet | Array | DataTable | null} data + * @param {vis.DataSet | null} items */ -ItemSet.prototype.setItems = function setItems(data) { +ItemSet.prototype.setItems = function setItems(items) { var me = this, dataItems, ids; // unsubscribe from current dataset - var current = this.data; + var current = this.items; if (current) { util.forEach(this.listeners, function (callback, event) { current.unsubscribe(event, callback); @@ -391,31 +395,25 @@ ItemSet.prototype.setItems = function setItems(data) { } // replace the dataset - if (!data) { - this.data = null; + if (!items) { + this.items = null; } - else if (data instanceof DataSet) { - this.data = data; + else if (items instanceof DataSet) { + this.items = items; } else { - this.data = new DataSet({ - fieldTypes: { - start: 'Date', - end: 'Date' - } - }); - this.data.add(data); + throw new TypeError('Data must be an instance of DataSet'); } - if (this.data) { + if (this.items) { // subscribe to new dataset var id = this.id; util.forEach(this.listeners, function (callback, event) { - me.data.subscribe(event, callback, id); + me.items.subscribe(event, callback, id); }); // draw all new items - dataItems = this.data.get({fields: ['id']}); + dataItems = this.items.get({fields: ['id']}); ids = []; util.forEach(dataItems, function (dataItem, index) { ids[index] = dataItem.id; @@ -425,45 +423,11 @@ ItemSet.prototype.setItems = function setItems(data) { }; /** - * Get the current items data - * @returns {vis.DataSet} + * Get the current items items + * @returns {vis.DataSet | null} */ ItemSet.prototype.getItems = function getItems() { - return this.data; -}; - -/** - * Get the data range of the item set. - * @returns {{min: Date, max: Date}} range A range with a start and end Date. - * When no minimum is found, min==null - * When no maximum is found, max==null - */ -ItemSet.prototype.getItemRange = function getItemRange() { - // calculate min from start filed - var data = this.data; - var minItem = data.min('start'); - var min = minItem ? minItem.start.valueOf() : null; - - // calculate max of both start and end fields - var max = null; - var maxStartItem = data.max('start'); - if (maxStartItem) { - max = maxStartItem.start.valueOf(); - } - var maxEndItem = data.max('end'); - if (maxEndItem) { - if (max == null) { - max = maxEndItem.end.valueOf(); - } - else { - max = Math.max(max, maxEndItem.end.valueOf()); - } - } - - return { - min: (min != null) ? new Date(min) : null, - max: (max != null) ? new Date(max) : null - }; + return this.items; }; /** @@ -472,6 +436,7 @@ ItemSet.prototype.getItemRange = function getItemRange() { * @private */ ItemSet.prototype._onUpdate = function _onUpdate(ids) { + console.log('onUpdate', ids) this._toQueue(ids, 'update'); }; @@ -499,21 +464,9 @@ ItemSet.prototype._onRemove = function _onRemove(ids) { * @param {String} action can be 'add', 'update', 'remove' */ ItemSet.prototype._toQueue = function _toQueue(ids, action) { - var items = this.items; var queue = this.queue; ids.forEach(function (id) { - var entry = queue[id]; - if (entry) { - // already queued, update the action of the entry - entry.action = action; - } - else { - // not yet queued, add an entry to the queue - queue[id] = { - item: items[id] || null, - action: action - }; - } + queue[id] = action; }); if (this.controller) { diff --git a/src/stack.js b/src/stack.js index 8b0d317a..bf0f35b1 100644 --- a/src/stack.js +++ b/src/stack.js @@ -67,7 +67,7 @@ Stack.prototype.update = function update() { * @private */ Stack.prototype._order = function _order () { - var items = this.parent.items; + var items = this.parent.contents; if (!items) { throw new Error('Cannot stack items: parent does not contain items'); } diff --git a/src/visualization/timeline.js b/src/visualization/timeline.js index 2419c788..8a98dd7f 100644 --- a/src/visualization/timeline.js +++ b/src/visualization/timeline.js @@ -55,16 +55,11 @@ function Timeline (container, items, options) { this.timeaxis.setRange(this.range); this.controller.add(this.timeaxis); - // contents panel containing the items. - // Is an ItemSet by default, can be changed to a GroupSet - this.content = new ItemSet(this.main, [this.timeaxis], { - orientation: this.options.orientation - }); - this.content.setRange(this.range); - this.controller.add(this.content); + // create itemset or groupset + this.setGroups(null); - this.items = null; // data - this.groups = null; // data + this.items = null; // DataSet + this.groups = null; // DataSet // set options (must take place before setting the data) if (options) { @@ -108,9 +103,9 @@ Timeline.prototype.setOptions = function (options) { } } - if (options.height) { + if (this.options.height) { // fixed height - mainHeight = options.height; + mainHeight = this.options.height; itemsHeight = function () { return me.main.height - me.timeaxis.height; }; @@ -149,44 +144,58 @@ Timeline.prototype.setOptions = function (options) { /** * Set items - * @param {vis.DataSet | Array | DataTable} items + * @param {vis.DataSet | Array | DataTable | null} items */ Timeline.prototype.setItems = function(items) { - var current = this.content.getItems(); - if (!current) { - // initial load of data - this.content.setItems(items); - - if (this.options.start == undefined || this.options.end == undefined) { - // apply the data range as range - var dataRange = this.content.getItemRange(); - - // add 5% on both sides - var min = dataRange.min; - var max = dataRange.max; - if (min != null && max != null) { - var interval = (max.valueOf() - min.valueOf()); - min = new Date(min.valueOf() - interval * 0.05); - max = new Date(max.valueOf() + interval * 0.05); - } + var initialLoad = (this.items == null); - // override specified start and/or end date - if (this.options.start != undefined) { - min = new Date(this.options.start.valueOf()); - } - if (this.options.end != undefined) { - max = new Date(this.options.end.valueOf()); + // convert to type DataSet when needed + var newItemSet; + if (!items) { + newItemSet = null; + } + else if (items instanceof DataSet) { + newItemSet = items; + } + if (!(items instanceof DataSet)) { + newItemSet = new DataSet({ + fieldTypes: { + start: 'Date', + end: 'Date' } + }); + newItemSet.add(items); + } - // apply range if there is a min or max available - if (min != null || max != null) { - this.range.setRange(min, max); - } + // set items + this.items = newItemSet; + this.content.setItems(newItemSet); + + if (initialLoad && (this.options.start == undefined || this.options.end == undefined)) { + // apply the data range as range + var dataRange = this.getItemRange(); + + // add 5% on both sides + var min = dataRange.min; + var max = dataRange.max; + if (min != null && max != null) { + var interval = (max.valueOf() - min.valueOf()); + min = new Date(min.valueOf() - interval * 0.05); + max = new Date(max.valueOf() + interval * 0.05); + } + + // override specified start and/or end date + if (this.options.start != undefined) { + min = new Date(this.options.start.valueOf()); + } + if (this.options.end != undefined) { + max = new Date(this.options.end.valueOf()); + } + + // apply range if there is a min or max available + if (min != null || max != null) { + this.range.setRange(min, max); } - } - else { - // updated data - this.content.setItems(items); } }; @@ -195,7 +204,74 @@ Timeline.prototype.setItems = function(items) { * @param {vis.DataSet | Array | DataTable} groups */ Timeline.prototype.setGroups = function(groups) { - // TODO: cleanup previous groups or itemset - this.groups = groups; + + // switch content type between ItemSet or GroupSet when needed + var type = this.groups ? GroupSet : ItemSet; + if (!(this.content instanceof type)) { + // remove old content set + if (this.content) { + this.content.hide(); + if (this.content.setItems) { + this.content.setItems(); + } + if (this.content.setGroups) { + this.content.setGroups(); + } + this.controller.remove(this.content); + } + + // create new content set + this.content = new type(this.main, [this.timeaxis]); + if (this.content.setRange) { + this.content.setRange(this.range); + } + if (this.content.setItems) { + this.content.setItems(this.items); + } + if (this.content.setGroups) { + this.content.setGroups(this.groups); + } + this.controller.add(this.content); + this.setOptions(this.options); + } +}; + +/** + * Get the data range of the item set. + * @returns {{min: Date, max: Date}} range A range with a start and end Date. + * When no minimum is found, min==null + * When no maximum is found, max==null + */ +Timeline.prototype.getItemRange = function getItemRange() { + // calculate min from start filed + var items = this.items, + min = null, + max = null; + + if (items) { + // calculate the minimum value of the field 'start' + var minItem = items.min('start'); + min = minItem ? minItem.start.valueOf() : null; + + // calculate maximum value of fields 'start' and 'end' + var maxStartItem = items.max('start'); + if (maxStartItem) { + max = maxStartItem.start.valueOf(); + } + var maxEndItem = items.max('end'); + if (maxEndItem) { + if (max == null) { + max = maxEndItem.end.valueOf(); + } + else { + max = Math.max(max, maxEndItem.end.valueOf()); + } + } + } + + return { + min: (min != null) ? new Date(min) : null, + max: (max != null) ? new Date(max) : null + }; }; diff --git a/vis.js b/vis.js index 56660648..a7aa191a 100644 --- a/vis.js +++ b/vis.js @@ -5,7 +5,7 @@ * A dynamic, browser-based visualization library. * * @version 0.0.8 - * @date 2013-05-08 + * @date 2013-05-10 * * @license * Copyright (C) 2011-2013 Almende B.V, http://almende.com @@ -2206,7 +2206,7 @@ Stack.prototype.update = function update() { * @private */ Stack.prototype._order = function _order () { - var items = this.parent.items; + var items = this.parent.contents; if (!items) { throw new Error('Cannot stack items: parent does not contain items'); } @@ -2949,9 +2949,9 @@ function Controller () { /** * Add a component to the controller - * @param {Component | Controller} component + * @param {Component} component */ -Controller.prototype.add = function (component) { +Controller.prototype.add = function add(component) { // validate the component if (component.id == undefined) { throw new Error('Component has no field id'); @@ -2966,12 +2966,31 @@ Controller.prototype.add = function (component) { this.components[component.id] = component; }; +/** + * Remove a component from the controller + * @param {Component | String} component + */ +Controller.prototype.remove = function remove(component) { + var id; + for (id in this.components) { + if (this.components.hasOwnProperty(id)) { + if (id == component || this.components[id] == component) { + break; + } + } + } + + if (id) { + delete this.components[id]; + } +}; + /** * Request a reflow. The controller will schedule a reflow * @param {Boolean} [force] If true, an immediate reflow is forced. Default * is false. */ -Controller.prototype.requestReflow = function (force) { +Controller.prototype.requestReflow = function requestReflow(force) { if (force) { this.reflow(); } @@ -2991,7 +3010,7 @@ Controller.prototype.requestReflow = function (force) { * @param {Boolean} [force] If true, an immediate repaint is forced. Default * is false. */ -Controller.prototype.requestRepaint = function (force) { +Controller.prototype.requestRepaint = function requestRepaint(force) { if (force) { this.repaint(); } @@ -3009,7 +3028,7 @@ Controller.prototype.requestRepaint = function (force) { /** * Repaint all components */ -Controller.prototype.repaint = function () { +Controller.prototype.repaint = function repaint() { var changed = false; // cancel any running repaint request @@ -3050,7 +3069,7 @@ Controller.prototype.repaint = function () { /** * Reflow all components */ -Controller.prototype.reflow = function () { +Controller.prototype.reflow = function reflow() { var resized = false; // cancel any running repaint request @@ -3116,7 +3135,7 @@ function Component () { * {String | Number | function} [width] * {String | Number | function} [height] */ -Component.prototype.setOptions = function(options) { +Component.prototype.setOptions = function setOptions(options) { if (!options) { return; } @@ -3135,7 +3154,7 @@ Component.prototype.setOptions = function(options) { * that case null is returned. * @returns {HTMLElement | null} container */ -Component.prototype.getContainer = function () { +Component.prototype.getContainer = function getContainer() { // should be implemented by the component return null; }; @@ -3144,7 +3163,7 @@ Component.prototype.getContainer = function () { * Get the frame element of the component, the outer HTML DOM element. * @returns {HTMLElement | null} frame */ -Component.prototype.getFrame = function () { +Component.prototype.getFrame = function getFrame() { return this.frame; }; @@ -3152,7 +3171,7 @@ Component.prototype.getFrame = function () { * Repaint the component * @return {Boolean} changed */ -Component.prototype.repaint = function () { +Component.prototype.repaint = function repaint() { // should be implemented by the component return false; }; @@ -3161,15 +3180,43 @@ Component.prototype.repaint = function () { * Reflow the component * @return {Boolean} resized */ -Component.prototype.reflow = function () { +Component.prototype.reflow = function reflow() { // should be implemented by the component return false; }; +/** + * Hide the component from the DOM + * @return {Boolean} changed + */ +Component.prototype.hide = function hide() { + if (this.frame && this.frame.parentNode) { + this.frame.parentNode.removeChild(this.frame); + return true; + } + else { + return false; + } +}; + +/** + * Show the component in the DOM (when not already visible). + * A repaint will be executed when the component is not visible + * @return {Boolean} changed + */ +Component.prototype.show = function show() { + if (!this.frame || !this.frame.parentNode) { + return this.repaint(); + } + else { + return false; + } +}; + /** * Request a repaint. The controller will schedule a repaint */ -Component.prototype.requestRepaint = function () { +Component.prototype.requestRepaint = function requestRepaint() { if (this.controller) { this.controller.requestRepaint(); } @@ -3182,7 +3229,7 @@ Component.prototype.requestRepaint = function () { /** * Request a reflow. The controller will schedule a reflow */ -Component.prototype.requestReflow = function () { +Component.prototype.requestReflow = function requestReflow() { if (this.controller) { this.controller.requestReflow(); } @@ -4053,8 +4100,9 @@ function ItemSet(parent, depends, options) { this.dom = {}; var me = this; - this.data = null; // DataSet + this.items = null; // DataSet this.range = null; // Range or Object {start: number, end: number} + this.listeners = { 'add': function (event, params) { me._onAdd(params.items); @@ -4067,12 +4115,14 @@ function ItemSet(parent, depends, options) { } }; - this.items = {}; - this.queue = {}; // queue with items to be added/updated/removed + this.contents = {}; // object with an Item for every data item + this.queue = {}; // queue with id/actions: 'add', 'update', 'delete' this.stack = new Stack(this); this.conversion = null; - this.setOptions(options); + if (options) { + this.setOptions(options); + } } ItemSet.prototype = new Panel(); @@ -4199,8 +4249,8 @@ ItemSet.prototype.repaint = function repaint() { var me = this, queue = this.queue, - data = this.data, items = this.items, + contents = this.contents, dataOptions = { fields: ['id', 'start', 'end', 'content', 'type'] }; @@ -4209,13 +4259,16 @@ ItemSet.prototype.repaint = function repaint() { // show/hide added/changed/removed items Object.keys(queue).forEach(function (id) { - var entry = queue[id]; - var item = entry.item; + //var entry = queue[id]; + var action = queue[id]; + var item = contents[id]; + //var item = entry.item; //noinspection FallthroughInSwitchStatementJS - switch (entry.action) { + switch (action) { case 'add': case 'update': - var itemData = data.get(id, dataOptions); + var itemData = items.get(id, dataOptions); + var type = itemData.type || (itemData.start && itemData.end && 'range') || 'box'; @@ -4247,7 +4300,7 @@ ItemSet.prototype.repaint = function repaint() { } // update lists - items[id] = item; + contents[id] = item; delete queue[id]; break; @@ -4258,17 +4311,17 @@ ItemSet.prototype.repaint = function repaint() { } // update lists - delete items[id]; + delete contents[id]; delete queue[id]; break; default: - console.log('Error: unknown action "' + entry.action + '"'); + console.log('Error: unknown action "' + action + '"'); } }); // reposition all items. Show items only when in the visible area - util.forEach(this.items, function (item) { + util.forEach(this.contents, function (item) { if (item.visible) { changed += item.show(); item.reposition(); @@ -4319,7 +4372,7 @@ ItemSet.prototype.reflow = function reflow () { if (frame) { this._updateConversion(); - util.forEach(this.items, function (item) { + util.forEach(this.contents, function (item) { changed += item.reflow(); }); @@ -4366,16 +4419,36 @@ ItemSet.prototype.reflow = function reflow () { }; /** - * Set data - * @param {DataSet | Array | DataTable} data + * Hide this component from the DOM + * @return {Boolean} changed + */ +ItemSet.prototype.hide = function hide() { + var changed = false; + + // remove the DOM + if (this.frame && this.frame.parentNode) { + this.frame.parentNode.removeChild(this.frame); + changed = true; + } + if (this.dom.axis && this.dom.axis.parentNode) { + this.dom.axis.parentNode.removeChild(this.dom.axis); + changed = true; + } + + return changed; +}; + +/** + * Set items + * @param {vis.DataSet | null} items */ -ItemSet.prototype.setData = function setData(data) { +ItemSet.prototype.setItems = function setItems(items) { var me = this, dataItems, ids; // unsubscribe from current dataset - var current = this.data; + var current = this.items; if (current) { util.forEach(this.listeners, function (callback, event) { current.unsubscribe(event, callback); @@ -4391,58 +4464,39 @@ ItemSet.prototype.setData = function setData(data) { } // replace the dataset - if (data instanceof DataSet) { - this.data = data; + if (!items) { + this.items = null; + } + else if (items instanceof DataSet) { + this.items = items; } else { - this.data = new DataSet({ - fieldTypes: { - start: 'Date', - end: 'Date' - } - }); - this.data.add(data); + throw new TypeError('Data must be an instance of DataSet'); } - // subscribe to new dataset - var id = this.id; - util.forEach(this.listeners, function (callback, event) { - me.data.subscribe(event, callback, id); - }); + if (this.items) { + // subscribe to new dataset + var id = this.id; + util.forEach(this.listeners, function (callback, event) { + me.items.subscribe(event, callback, id); + }); - // draw all new items - dataItems = this.data.get({fields: ['id']}); - ids = []; - util.forEach(dataItems, function (dataItem, index) { - ids[index] = dataItem.id; - }); - this._onAdd(ids); + // draw all new items + dataItems = this.items.get({fields: ['id']}); + ids = []; + util.forEach(dataItems, function (dataItem, index) { + ids[index] = dataItem.id; + }); + this._onAdd(ids); + } }; - /** - * Get the data range of the item set. - * @returns {{min: Date, max: Date}} range A range with a start and end Date. - * When no minimum is found, min==null - * When no maximum is found, max==null + * Get the current items items + * @returns {vis.DataSet | null} */ -ItemSet.prototype.getDataRange = function getDataRange() { - // calculate min from start filed - var data = this.data; - var min = data.min('start'); - min = min ? min.start.valueOf() : null; - - // calculate max of both start and end fields - var maxStart = data.max('start'); - var maxEnd = data.max('end'); - maxStart = maxStart ? maxStart.start.valueOf() : null; - maxEnd = maxEnd ? maxEnd.end.valueOf() : null; - var max = Math.max(maxStart, maxEnd); - - return { - min: new Date(min), - max: new Date(max) - }; +ItemSet.prototype.getItems = function getItems() { + return this.items; }; /** @@ -4451,6 +4505,7 @@ ItemSet.prototype.getDataRange = function getDataRange() { * @private */ ItemSet.prototype._onUpdate = function _onUpdate(ids) { + console.log('onUpdate', ids) this._toQueue(ids, 'update'); }; @@ -4478,21 +4533,9 @@ ItemSet.prototype._onRemove = function _onRemove(ids) { * @param {String} action can be 'add', 'update', 'remove' */ ItemSet.prototype._toQueue = function _toQueue(ids, action) { - var items = this.items; var queue = this.queue; ids.forEach(function (id) { - var entry = queue[id]; - if (entry) { - // already queued, update the action of the entry - entry.action = action; - } - else { - // not yet queued, add an entry to the queue - queue[id] = { - item: items[id] || null, - action: action - }; - } + queue[id] = action; }); if (this.controller) { @@ -5444,14 +5487,404 @@ ItemRange.prototype.reposition = function reposition() { } }; +/** + * An GroupSet holds a set of groups + * @param {Component} parent + * @param {Component[]} [depends] Components on which this components depends + * (except for the parent) + * @param {Object} [options] See GroupSet.setOptions for the available + * options. + * @constructor GroupSet + * @extends Panel + */ +function GroupSet(parent, depends, options) { + this.id = util.randomUUID(); + this.parent = parent; + this.depends = depends; + + this.options = {}; + + this.range = null; // Range or Object {start: number, end: number} + this.items = null; // dataset with items + this.groups = null; // dataset with groups + + this.contents = {}; // object with an ItemSet for every group + + // changes in groups are queued + this.queue = {}; + + var me = this; + this.listeners = { + 'add': function (event, params) { + me._onAdd(params.items); + }, + 'update': function (event, params) { + me._onUpdate(params.items); + }, + 'remove': function (event, params) { + me._onRemove(params.items); + } + }; + + if (options) { + this.setOptions(options); + } +} + +GroupSet.prototype = new Panel(); + +/** + * Set options for the ItemSet. Existing options will be extended/overwritten. + * @param {Object} [options] The following options are available: + * TODO: describe options + */ +GroupSet.prototype.setOptions = function setOptions(options) { + util.extend(this.options, options); + + // TODO: implement options +}; + +GroupSet.prototype.setRange = function (range) { + // TODO: implement setRange +}; + +/** + * Set items + * @param {vis.DataSet | null} items + */ +GroupSet.prototype.setItems = function setItems(items) { + this.items = items; + + util.forEach(this.contents, function (group) { + group.setItems(items); + }); + +}; + +/** + * Get items + * @return {vis.DataSet | null} items + */ +GroupSet.prototype.getItems = function getItems() { + return this.items; +}; + +/** + * Set range (start and end). + * @param {Range | Object} range A Range or an object containing start and end. + */ +GroupSet.prototype.setRange = function setRange(range) { + this.range = range; +}; + +/** + * Set groups + * @param {vis.DataSet} groups + */ +GroupSet.prototype.setGroups = function setGroups(groups) { + var me = this, + dataGroups, + ids; + + // unsubscribe from current dataset + if (this.groups) { + util.forEach(this.listeners, function (callback, event) { + me.groups.unsubscribe(event, callback); + }); + + // remove all drawn groups + dataGroups = this.groups.get({fields: ['id']}); + ids = []; + util.forEach(dataGroups, function (dataGroup, index) { + ids[index] = dataGroup.id; + }); + this._onRemove(ids); + } + + // replace the dataset + if (!groups) { + this.groups = null; + } + else if (groups instanceof DataSet) { + this.groups = groups; + } + else { + this.groups = new DataSet({ + fieldTypes: { + start: 'Date', + end: 'Date' + } + }); + this.groups.add(groups); + } + + if (this.groups) { + // subscribe to new dataset + var id = this.id; + util.forEach(this.listeners, function (callback, event) { + me.groups.subscribe(event, callback, id); + }); + + // draw all new groups + dataGroups = this.groups.get({fields: ['id']}); + ids = []; + util.forEach(dataGroups, function (dataGroup, index) { + ids[index] = dataGroup.id; + }); + this._onAdd(ids); + } +}; + +/** + * Get groups + * @return {vis.DataSet | null} groups + */ +GroupSet.prototype.getGroups = function getGroups() { + return this.groups; +}; + +/** + * Repaint the component + * @return {Boolean} changed + */ +GroupSet.prototype.repaint = function repaint() { + var changed = 0, + update = util.updateProperty, + asSize = util.option.asSize, + options = this.options, + frame = this.frame; + + if (!frame) { + frame = document.createElement('div'); + frame.className = 'groupset'; + + if (options.className) { + util.addClassName(frame, util.option.asString(options.className)); + } + + this.frame = frame; + changed += 1; + } + + if (!this.parent) { + throw new Error('Cannot repaint groupset: no parent attached'); + } + var parentContainer = this.parent.getContainer(); + if (!parentContainer) { + throw new Error('Cannot repaint groupset: parent has no container element'); + } + if (!frame.parentNode) { + parentContainer.appendChild(frame); + changed += 1; + } + + // reposition frame + changed += update(frame.style, 'height', asSize(options.height, this.height + 'px')); + changed += update(frame.style, 'top', asSize(options.top, '0px')); + changed += update(frame.style, 'left', asSize(options.left, '0px')); + changed += update(frame.style, 'width', asSize(options.width, '100%')); + + var me = this, + queue = this.queue, + items = this.items, + contents = this.contents, + groups = this.groups, + dataOptions = { + fields: ['id', 'content'] + }; + + // show/hide added/changed/removed items + Object.keys(queue).forEach(function (id) { + var entry = queue[id]; + var group = entry.item; + //noinspection FallthroughInSwitchStatementJS + switch (entry.action) { + case 'add': + // TODO: create group + group = new ItemSet(me); + group.setRange(me.range); + group.setItems(me.items); + + // update lists + contents[id] = group; + delete queue[id]; + break; + + case 'update': + // TODO: update group + + // update lists + contents[id] = group; + delete queue[id]; + break; + + case 'remove': + if (group) { + // remove DOM of the group + changed += group.hide(); + } + + // update lists + delete contents[id]; + delete queue[id]; + break; + + default: + console.log('Error: unknown action "' + entry.action + '"'); + } + }); + + // reposition all groups + util.forEach(this.contents, function (group) { + changed += group.repaint(); + }); + + return (changed > 0); +}; + +/** + * Get container element + * @return {HTMLElement} container + */ +GroupSet.prototype.getContainer = function getContainer() { + // TODO: replace later on with container element for holding itemsets + return this.frame; +}; + +/** + * Reflow the component + * @return {Boolean} resized + */ +GroupSet.prototype.reflow = function reflow() { + var changed = 0, + options = this.options, + update = util.updateProperty, + asNumber = util.option.asNumber, + frame = this.frame; + + if (frame) { + // reposition all groups + util.forEach(this.contents, function (group) { + changed += group.reflow(); + }); + + var maxHeight = asNumber(options.maxHeight); + var height; + if (options.height != null) { + height = frame.offsetHeight; + } + else { + // height is not specified, calculate the sum of the height of all groups + height = 0; + util.forEach(this.contents, function (group) { + height += group.height; + }); + } + if (maxHeight != null) { + height = Math.min(height, maxHeight); + } + changed += update(this, 'height', height); + + changed += update(this, 'top', frame.offsetTop); + changed += update(this, 'left', frame.offsetLeft); + changed += update(this, 'width', frame.offsetWidth); + } + + return (changed > 0); +}; + +/** + * Hide the component from the DOM + * @return {Boolean} changed + */ +GroupSet.prototype.hide = function hide() { + if (this.frame && this.frame.parentNode) { + this.frame.parentNode.removeChild(this.frame); + return true; + } + else { + return false; + } +}; + +/** + * Show the component in the DOM (when not already visible). + * A repaint will be executed when the component is not visible + * @return {Boolean} changed + */ +GroupSet.prototype.show = function show() { + if (!this.frame || !this.frame.parentNode) { + return this.repaint(); + } + else { + return false; + } +}; + +/** + * Handle updated groups + * @param {Number[]} ids + * @private + */ +GroupSet.prototype._onUpdate = function _onUpdate(ids) { + this._toQueue(ids, 'update'); +}; + +/** + * Handle changed groups + * @param {Number[]} ids + * @private + */ +GroupSet.prototype._onAdd = function _onAdd(ids) { + this._toQueue(ids, 'add'); +}; + +/** + * Handle removed groups + * @param {Number[]} ids + * @private + */ +GroupSet.prototype._onRemove = function _onRemove(ids) { + this._toQueue(ids, 'remove'); +}; + +/** + * Put groups in the queue to be added/updated/remove + * @param {Number[]} ids + * @param {String} action can be 'add', 'update', 'remove' + */ +GroupSet.prototype._toQueue = function _toQueue(ids, action) { + var groups = this.groups; + var queue = this.queue; + ids.forEach(function (id) { + var entry = queue[id]; + if (entry) { + // already queued, update the action of the entry + entry.action = action; + } + else { + // not yet queued, add an entry to the queue + queue[id] = { + item: groups[id] || null, + action: action + }; + } + }); + + if (this.controller) { + //this.requestReflow(); + this.requestRepaint(); + } +}; + /** * Create a timeline visualization * @param {HTMLElement} container - * @param {DataSet | Array | DataTable} [data] + * @param {vis.DataSet | Array | DataTable} [items] * @param {Object} [options] See Timeline.setOptions for the available options. * @constructor */ -function Timeline (container, data, options) { +function Timeline (container, items, options) { var me = this; this.options = { orientation: 'bottom', @@ -5501,19 +5934,20 @@ function Timeline (container, data, options) { this.timeaxis.setRange(this.range); this.controller.add(this.timeaxis); - // items panel - this.itemset = new ItemSet(this.main, [this.timeaxis], { - orientation: this.options.orientation - }); - this.itemset.setRange(this.range); - this.controller.add(this.itemset); + // create itemset or groupset + this.setGroups(null); + + this.items = null; // DataSet + this.groups = null; // DataSet // set options (must take place before setting the data) - this.setOptions(options); + if (options) { + this.setOptions(options); + } // set data - if (data) { - this.setData(data); + if (items) { + this.setItems(items); } } @@ -5530,7 +5964,7 @@ Timeline.prototype.setOptions = function (options) { // update options for the range this.range.setOptions(this.options); - // update options the itemset + // update options the content var itemsTop, itemsHeight, mainHeight, @@ -5544,13 +5978,13 @@ Timeline.prototype.setOptions = function (options) { } else { itemsTop = function () { - return me.main.height - me.timeaxis.height - me.itemset.height; + return me.main.height - me.timeaxis.height - me.content.height; } } - if (options.height) { + if (this.options.height) { // fixed height - mainHeight = options.height; + mainHeight = this.options.height; itemsHeight = function () { return me.main.height - me.timeaxis.height; }; @@ -5558,7 +5992,7 @@ Timeline.prototype.setOptions = function (options) { else { // auto height mainHeight = function () { - return me.timeaxis.height + me.itemset.height; + return me.timeaxis.height + me.content.height; }; itemsHeight = null; } @@ -5577,7 +6011,7 @@ Timeline.prototype.setOptions = function (options) { height: mainHeight }); - this.itemset.setOptions({ + this.content.setOptions({ orientation: this.options.orientation, top: itemsTop, height: itemsHeight, @@ -5588,46 +6022,137 @@ Timeline.prototype.setOptions = function (options) { }; /** - * Set data - * @param {DataSet | Array | DataTable} data + * Set items + * @param {vis.DataSet | Array | DataTable | null} items */ -Timeline.prototype.setData = function(data) { - var dataset = this.itemset.data; - if (!dataset) { - // first load of data - this.itemset.setData(data); - - if (this.options.start == undefined || this.options.end == undefined) { - // apply the data range as range - var dataRange = this.itemset.getDataRange(); +Timeline.prototype.setItems = function(items) { + var initialLoad = (this.items == null); - // add 5% on both sides - var min = dataRange.min; - var max = dataRange.max; - if (min != null && max != null) { - var interval = (max.valueOf() - min.valueOf()); - min = new Date(min.valueOf() - interval * 0.05); - max = new Date(max.valueOf() + interval * 0.05); + // convert to type DataSet when needed + var newItemSet; + if (!items) { + newItemSet = null; + } + else if (items instanceof DataSet) { + newItemSet = items; + } + if (!(items instanceof DataSet)) { + newItemSet = new DataSet({ + fieldTypes: { + start: 'Date', + end: 'Date' } + }); + newItemSet.add(items); + } + + // set items + this.items = newItemSet; + this.content.setItems(newItemSet); + + if (initialLoad && (this.options.start == undefined || this.options.end == undefined)) { + // apply the data range as range + var dataRange = this.getItemRange(); + + // add 5% on both sides + var min = dataRange.min; + var max = dataRange.max; + if (min != null && max != null) { + var interval = (max.valueOf() - min.valueOf()); + min = new Date(min.valueOf() - interval * 0.05); + max = new Date(max.valueOf() + interval * 0.05); + } + + // override specified start and/or end date + if (this.options.start != undefined) { + min = new Date(this.options.start.valueOf()); + } + if (this.options.end != undefined) { + max = new Date(this.options.end.valueOf()); + } + + // apply range if there is a min or max available + if (min != null || max != null) { + this.range.setRange(min, max); + } + } +}; - // override specified start and/or end date - if (this.options.start != undefined) { - min = new Date(this.options.start.valueOf()); +/** + * Set groups + * @param {vis.DataSet | Array | DataTable} groups + */ +Timeline.prototype.setGroups = function(groups) { + this.groups = groups; + + // switch content type between ItemSet or GroupSet when needed + var type = this.groups ? GroupSet : ItemSet; + if (!(this.content instanceof type)) { + // remove old content set + if (this.content) { + this.content.hide(); + if (this.content.setItems) { + this.content.setItems(); } - if (this.options.end != undefined) { - max = new Date(this.options.end.valueOf()); + if (this.content.setGroups) { + this.content.setGroups(); } + this.controller.remove(this.content); + } - // apply range if there is a min or max available - if (min != null || max != null) { - this.range.setRange(min, max); - } + // create new content set + this.content = new type(this.main, [this.timeaxis]); + if (this.content.setRange) { + this.content.setRange(this.range); } + if (this.content.setItems) { + this.content.setItems(this.items); + } + if (this.content.setGroups) { + this.content.setGroups(this.groups); + } + this.controller.add(this.content); + this.setOptions(this.options); } - else { - // updated data - this.itemset.setData(data); +}; + +/** + * Get the data range of the item set. + * @returns {{min: Date, max: Date}} range A range with a start and end Date. + * When no minimum is found, min==null + * When no maximum is found, max==null + */ +Timeline.prototype.getItemRange = function getItemRange() { + // calculate min from start filed + var items = this.items, + min = null, + max = null; + + if (items) { + // calculate the minimum value of the field 'start' + var minItem = items.min('start'); + min = minItem ? minItem.start.valueOf() : null; + + // calculate maximum value of fields 'start' and 'end' + var maxStartItem = items.max('start'); + if (maxStartItem) { + max = maxStartItem.start.valueOf(); + } + var maxEndItem = items.max('end'); + if (maxEndItem) { + if (max == null) { + max = maxEndItem.end.valueOf(); + } + else { + max = Math.max(max, maxEndItem.end.valueOf()); + } + } } + + return { + min: (min != null) ? new Date(min) : null, + max: (max != null) ? new Date(max) : null + }; }; /** @@ -5690,7 +6215,7 @@ if (typeof window !== 'undefined') { } // inject css -util.loadCss("/* vis.js stylesheet */\n\n.graph {\n position: relative;\n border: 1px solid #bfbfbf;\n}\n\n.graph .panel {\n position: absolute;\n}\n\n.graph .itemset {\n position: absolute;\n padding: 0;\n margin: 0;\n overflow: hidden;\n}\n\n.graph .background {\n}\n\n.graph .foreground {\n}\n\n.graph .itemset-axis {\n position: absolute;\n}\n\n.graph .item {\n position: absolute;\n color: #1A1A1A;\n border-color: #97B0F8;\n background-color: #D5DDF6;\n display: inline-block;\n}\n\n.graph .item.selected {\n border-color: #FFC200;\n background-color: #FFF785;\n z-index: 999;\n}\n\n.graph .item.cluster {\n /* TODO: use another color or pattern? */\n background: #97B0F8 url('img/cluster_bg.png');\n color: white;\n}\n.graph .item.cluster.point {\n border-color: #D5DDF6;\n}\n\n.graph .item.box {\n text-align: center;\n border-style: solid;\n border-width: 1px;\n border-radius: 5px;\n -moz-border-radius: 5px; /* For Firefox 3.6 and older */\n}\n\n.graph .item.point {\n background: none;\n}\n\n.graph .dot {\n border: 5px solid #97B0F8;\n position: absolute;\n border-radius: 5px;\n -moz-border-radius: 5px; /* For Firefox 3.6 and older */\n}\n\n.graph .item.range {\n overflow: hidden;\n border-style: solid;\n border-width: 1px;\n border-radius: 2px;\n -moz-border-radius: 2px; /* For Firefox 3.6 and older */\n}\n\n.graph .item.range .drag-left {\n cursor: w-resize;\n z-index: 1000;\n}\n\n.graph .item.range .drag-right {\n cursor: e-resize;\n z-index: 1000;\n}\n\n.graph .item.range .content {\n position: relative;\n display: inline-block;\n}\n\n.graph .item.line {\n position: absolute;\n width: 0;\n border-left-width: 1px;\n border-left-style: solid;\n}\n\n.graph .item .content {\n margin: 5px;\n white-space: nowrap;\n overflow: hidden;\n}\n\n/* TODO: better css name, 'graph' is way to generic */\n\n.graph {\n overflow: hidden;\n}\n\n.graph .axis {\n position: relative;\n}\n\n.graph .axis .text {\n position: absolute;\n color: #4d4d4d;\n padding: 3px;\n white-space: nowrap;\n}\n\n.graph .axis .text.measure {\n position: absolute;\n padding-left: 0;\n padding-right: 0;\n margin-left: 0;\n margin-right: 0;\n visibility: hidden;\n}\n\n.graph .axis .grid.vertical {\n position: absolute;\n width: 0;\n border-right: 1px solid;\n}\n\n.graph .axis .grid.horizontal {\n position: absolute;\n left: 0;\n width: 100%;\n height: 0;\n border-bottom: 1px solid;\n}\n\n.graph .axis .grid.minor {\n border-color: #e5e5e5;\n}\n\n.graph .axis .grid.major {\n border-color: #bfbfbf;\n}\n\n"); +util.loadCss("/* vis.js stylesheet */\n\n.graph {\n position: relative;\n border: 1px solid #bfbfbf;\n}\n\n.graph .panel {\n position: absolute;\n}\n\n.graph .groupset {\n position: absolute;\n padding: 0;\n margin: 0;\n overflow: hidden;\n}\n\n\n.graph .itemset {\n position: absolute;\n padding: 0;\n margin: 0;\n overflow: hidden;\n}\n\n.graph .groupset .itemset {\n position: relative;\n padding: 0;\n margin: 0;\n overflow: hidden;\n}\n\n.graph .background {\n}\n\n.graph .foreground {\n}\n\n.graph .itemset-axis {\n position: absolute;\n}\n\n.graph .groupset .itemset-axis {\n position: relative;\n}\n\n.graph .item {\n position: absolute;\n color: #1A1A1A;\n border-color: #97B0F8;\n background-color: #D5DDF6;\n display: inline-block;\n}\n\n.graph .item.selected {\n border-color: #FFC200;\n background-color: #FFF785;\n z-index: 999;\n}\n\n.graph .item.cluster {\n /* TODO: use another color or pattern? */\n background: #97B0F8 url('img/cluster_bg.png');\n color: white;\n}\n.graph .item.cluster.point {\n border-color: #D5DDF6;\n}\n\n.graph .item.box {\n text-align: center;\n border-style: solid;\n border-width: 1px;\n border-radius: 5px;\n -moz-border-radius: 5px; /* For Firefox 3.6 and older */\n}\n\n.graph .item.point {\n background: none;\n}\n\n.graph .dot {\n border: 5px solid #97B0F8;\n position: absolute;\n border-radius: 5px;\n -moz-border-radius: 5px; /* For Firefox 3.6 and older */\n}\n\n.graph .item.range {\n overflow: hidden;\n border-style: solid;\n border-width: 1px;\n border-radius: 2px;\n -moz-border-radius: 2px; /* For Firefox 3.6 and older */\n}\n\n.graph .item.range .drag-left {\n cursor: w-resize;\n z-index: 1000;\n}\n\n.graph .item.range .drag-right {\n cursor: e-resize;\n z-index: 1000;\n}\n\n.graph .item.range .content {\n position: relative;\n display: inline-block;\n}\n\n.graph .item.line {\n position: absolute;\n width: 0;\n border-left-width: 1px;\n border-left-style: solid;\n}\n\n.graph .item .content {\n margin: 5px;\n white-space: nowrap;\n overflow: hidden;\n}\n\n/* TODO: better css name, 'graph' is way to generic */\n\n.graph {\n overflow: hidden;\n}\n\n.graph .axis {\n position: relative;\n}\n\n.graph .axis .text {\n position: absolute;\n color: #4d4d4d;\n padding: 3px;\n white-space: nowrap;\n}\n\n.graph .axis .text.measure {\n position: absolute;\n padding-left: 0;\n padding-right: 0;\n margin-left: 0;\n margin-right: 0;\n visibility: hidden;\n}\n\n.graph .axis .grid.vertical {\n position: absolute;\n width: 0;\n border-right: 1px solid;\n}\n\n.graph .axis .grid.horizontal {\n position: absolute;\n left: 0;\n width: 100%;\n height: 0;\n border-bottom: 1px solid;\n}\n\n.graph .axis .grid.minor {\n border-color: #e5e5e5;\n}\n\n.graph .axis .grid.major {\n border-color: #bfbfbf;\n}\n\n"); },{"moment":2}],2:[function(require,module,exports){ (function(){// moment.js diff --git a/vis.min.js b/vis.min.js index 09524a69..5ffc7a6c 100644 --- a/vis.min.js +++ b/vis.min.js @@ -5,7 +5,7 @@ * A dynamic, browser-based visualization library. * * @version 0.0.8 - * @date 2013-05-08 + * @date 2013-05-10 * * @license * Copyright (C) 2011-2013 Almende B.V, http://almende.com @@ -22,6 +22,6 @@ * License for the specific language governing permissions and limitations under * the License. */ -(function(t){if("function"==typeof bootstrap)bootstrap("vis",t);else if("object"==typeof exports)module.exports=t();else if("function"==typeof define&&define.amd)define(t);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeVis=t}else"undefined"!=typeof window?window.vis=t():global.vis=t()})(function(){var t;return function(t,e,n){function i(n,o){if(!e[n]){if(!t[n]){var s="function"==typeof require&&require;if(!o&&s)return s(n,!0);if(r)return r(n,!0);throw Error("Cannot find module '"+n+"'")}var a=e[n]={exports:{}};t[n][0].call(a.exports,function(e){var r=t[n][1][e];return i(r?r:e)},a,a.exports)}return e[n].exports}for(var r="function"==typeof require&&require,o=0;n.length>o;o++)i(n[o]);return i}({1:[function(e,n,i){function r(t){var e=this;this.options=t||{},this.data={},this.fieldId=this.options.fieldId||"id",this.fieldTypes={},this.options.fieldTypes&&w.forEach(this.options.fieldTypes,function(t,n){e.fieldTypes[n]="Date"==t||"ISODate"==t||"ASPDate"==t?"Date":t}),this.subscribers={},this.internalIds={}}function o(t,e){this.parent=t,this.options={order:function(t,e){if(t instanceof v){if(e instanceof v){var n=t.data.end-t.data.start,i=e.data.end-e.data.start;return n-i||t.data.start-e.data.start}return-1}return e instanceof v?1:t.data.start-e.data.start}},this.ordered=[],this.setOptions(e)}function s(t){this.id=w.randomUUID(),this.start=0,this.end=0,this.options={min:null,max:null,zoomMin:null,zoomMax:null},this.setOptions(t),this.listeners=[]}function a(){this.subscriptions=[]}function h(){this.id=w.randomUUID(),this.components={},this.repaintTimer=void 0,this.reflowTimer=void 0}function c(){this.id=null,this.parent=null,this.depends=null,this.controller=null,this.options=null,this.frame=null,this.top=0,this.left=0,this.width=0,this.height=0}function p(t,e,n){this.id=w.randomUUID(),this.parent=t,this.depends=e,this.options={},this.setOptions(n)}function u(t,e){this.id=w.randomUUID(),this.container=t,this.options={autoResize:!0},this.listeners={},this.setOptions(e)}function d(t,e,n){this.id=w.randomUUID(),this.parent=t,this.depends=e,this.dom={majorLines:[],majorTexts:[],minorLines:[],minorTexts:[],redundant:{majorLines:[],majorTexts:[],minorLines:[],minorTexts:[]}},this.props={range:{start:0,end:0,minimumStep:0},lineTop:0},this.options={orientation:"bottom",showMinorLabels:!0,showMajorLabels:!0},this.conversion=null,this.range=null,this.setOptions(n)}function l(t,e,n){this.id=w.randomUUID(),this.parent=t,this.depends=e,this.options={style:"box",align:"center",orientation:"bottom",margin:{axis:20,item:10},padding:5},this.dom={};var i=this;this.data=null,this.range=null,this.listeners={add:function(t,e){i._onAdd(e.items)},update:function(t,e){i._onUpdate(e.items)},remove:function(t,e){i._onRemove(e.items)}},this.items={},this.queue={},this.stack=new o(this),this.conversion=null,this.setOptions(n)}function f(t,e,n){this.parent=t,this.data=e,this.dom=null,this.options=n,this.selected=!1,this.visible=!1,this.top=0,this.left=0,this.width=0,this.height=0}function m(t,e,n){this.props={dot:{left:0,top:0,width:0,height:0},line:{top:0,left:0,width:0,height:0}},f.call(this,t,e,n)}function g(t,e,n){this.props={dot:{top:0,width:0,height:0},content:{height:0,marginLeft:0}},f.call(this,t,e,n)}function v(t,e,n){this.props={content:{left:0,width:0}},f.call(this,t,e,n)}function y(t,e,n){var i=this;if(this.options={orientation:"bottom",zoomMin:10,zoomMax:31536e10,moveable:!0,zoomable:!0},this.controller=new h,!t)throw Error("No container element provided");this.main=new u(t,{autoResize:!1}),this.controller.add(this.main);var r=S().hours(0).minutes(0).seconds(0).milliseconds(0);this.range=new s({start:r.clone().add("days",-3).valueOf(),end:r.clone().add("days",4).valueOf()}),this.range.subscribe(this.main,"move","horizontal"),this.range.subscribe(this.main,"zoom","horizontal"),this.range.on("rangechange",function(){var t=!0;i.controller.requestReflow(t)}),this.range.on("rangechanged",function(){var t=!0;i.controller.requestReflow(t)}),this.timeaxis=new d(this.main,[],{orientation:this.options.orientation,range:this.range}),this.timeaxis.setRange(this.range),this.controller.add(this.timeaxis),this.itemset=new l(this.main,[this.timeaxis],{orientation:this.options.orientation}),this.itemset.setRange(this.range),this.controller.add(this.itemset),this.setOptions(n),e&&this.setData(e)}var S=e("moment"),w={};w.isNumber=function(t){return t instanceof Number||"number"==typeof t},w.isString=function(t){return t instanceof String||"string"==typeof t},w.isDate=function(t){if(t instanceof Date)return!0;if(w.isString(t)){var e=b.exec(t);if(e)return!0;if(!isNaN(Date.parse(t)))return!0}return!1},w.isDataTable=function(t){return"undefined"!=typeof google&&google.visualization&&google.visualization.DataTable&&t instanceof google.visualization.DataTable},w.randomUUID=function(){var t=function(){return Math.floor(65536*Math.random()).toString(16)};return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()},w.extend=function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t},w.cast=function(t,e){var n;if(void 0===t)return void 0;if(null===t)return null;if(!e)return t;if("string"!=typeof e&&!(e instanceof String))throw Error("Type must be a string");switch(e){case"boolean":case"Boolean":return Boolean(t);case"number":case"Number":return Number(t);case"string":case"String":return t+"";case"Date":if(w.isNumber(t))return new Date(t);if(t instanceof Date)return new Date(t.valueOf());if(S.isMoment(t))return new Date(t.valueOf());if(w.isString(t))return n=b.exec(t),n?new Date(Number(n[1])):S(t).toDate();throw Error("Cannot cast object of type "+w.getType(t)+" to type Date");case"Moment":if(w.isNumber(t))return S(t);if(t instanceof Date)return S(t.valueOf());if(S.isMoment(t))return S.clone();if(w.isString(t))return n=b.exec(t),n?S(Number(n[1])):S(t);throw Error("Cannot cast object of type "+w.getType(t)+" to type Date");case"ISODate":if(t instanceof Date)return t.toISOString();if(S.isMoment(t))return t.toDate().toISOString();if(w.isNumber(t)||w.isString(t))return S(t).toDate().toISOString();throw Error("Cannot cast object of type "+w.getType(t)+" to type ISODate");case"ASPDate":if(t instanceof Date)return"/Date("+t.valueOf()+")/";if(w.isNumber(t)||w.isString(t))return"/Date("+S(t).valueOf()+")/";throw Error("Cannot cast object of type "+w.getType(t)+" to type ASPDate");default:throw Error("Cannot cast object of type "+w.getType(t)+' to type "'+e+'"')}};var b=/^\/?Date\((\-?\d+)/i;if(w.getType=function(t){var e=typeof t;return"object"==e?null==t?"null":t instanceof Boolean?"Boolean":t instanceof Number?"Number":t instanceof String?"String":t instanceof Array?"Array":t instanceof Date?"Date":"Object":"number"==e?"Number":"boolean"==e?"Boolean":"string"==e?"String":e},w.getAbsoluteLeft=function(t){for(var e=document.documentElement,n=document.body,i=t.offsetLeft,r=t.offsetParent;null!=r&&r!=n&&r!=e;)i+=r.offsetLeft,i-=r.scrollLeft,r=r.offsetParent;return i},w.getAbsoluteTop=function(t){for(var e=document.documentElement,n=document.body,i=t.offsetTop,r=t.offsetParent;null!=r&&r!=n&&r!=e;)i+=r.offsetTop,i-=r.scrollTop,r=r.offsetParent;return i},w.getPageY=function(t){if("pageY"in t)return t.pageY;var e;e="targetTouches"in t&&t.targetTouches.length?t.targetTouches[0].clientY:t.clientY;var n=document.documentElement,i=document.body;return e+(n&&n.scrollTop||i&&i.scrollTop||0)-(n&&n.clientTop||i&&i.clientTop||0)},w.getPageX=function(t){if("pageY"in t)return t.pageX;var e;e="targetTouches"in t&&t.targetTouches.length?t.targetTouches[0].clientX:t.clientX;var n=document.documentElement,i=document.body;return e+(n&&n.scrollLeft||i&&i.scrollLeft||0)-(n&&n.clientLeft||i&&i.clientLeft||0)},w.addClassName=function(t,e){var n=t.className.split(" ");-1==n.indexOf(e)&&(n.push(e),t.className=n.join(" "))},w.removeClassName=function(t,e){var n=t.className.split(" "),i=n.indexOf(e);-1!=i&&(n.splice(i,1),t.className=n.join(" "))},w.forEach=function(t,e){var n,i;if(t instanceof Array)for(n=0,i=t.length;i>n;n++)e(t[n],n,t);else for(n in t)t.hasOwnProperty(n)&&e(t[n],n,t)},w.updateProperty=function(t,e,n){return t[e]!==n?(t[e]=n,!0):!1},w.addEventListener=function(t,e,n,i){t.addEventListener?(void 0===i&&(i=!1),"mousewheel"===e&&navigator.userAgent.indexOf("Firefox")>=0&&(e="DOMMouseScroll"),t.addEventListener(e,n,i)):t.attachEvent("on"+e,n)},w.removeEventListener=function(t,e,n,i){t.removeEventListener?(void 0===i&&(i=!1),"mousewheel"===e&&navigator.userAgent.indexOf("Firefox")>=0&&(e="DOMMouseScroll"),t.removeEventListener(e,n,i)):t.detachEvent("on"+e,n)},w.getTarget=function(t){t||(t=window.event);var e;return t.target?e=t.target:t.srcElement&&(e=t.srcElement),void 0!=e.nodeType&&3==e.nodeType&&(e=e.parentNode),e},w.stopPropagation=function(t){t||(t=window.event),t.stopPropagation?t.stopPropagation():t.cancelBubble=!0},w.preventDefault=function(t){t||(t=window.event),t.preventDefault?t.preventDefault():t.returnValue=!1},w.option={},w.option.asBoolean=function(t,e){return"function"==typeof t&&(t=t()),null!=t?0!=t:e||null},w.option.asNumber=function(t,e){return"function"==typeof t&&(t=t()),null!=t?Number(t)||e||null:e||null},w.option.asString=function(t,e){return"function"==typeof t&&(t=t()),null!=t?t+"":e||null},w.option.asSize=function(t,e){return"function"==typeof t&&(t=t()),w.isString(t)?t:w.isNumber(t)?t+"px":e||null},w.option.asElement=function(t,e){return"function"==typeof t&&(t=t()),t||e||null},w.loadCss=function(t){if("undefined"!=typeof document){var e=document.createElement("style");e.type="text/css",e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t)),document.getElementsByTagName("head")[0].appendChild(e)}},!Array.prototype.indexOf){Array.prototype.indexOf=function(t){for(var e=0;this.length>e;e++)if(this[e]==t)return e;return-1};try{console.log("Warning: Ancient browser detected. Please update your browser")}catch(T){}}Array.prototype.forEach||(Array.prototype.forEach=function(t,e){for(var n=0,i=this.length;i>n;++n)t.call(e||this,this[n],n,this)}),Array.prototype.map||(Array.prototype.map=function(t,e){var n,i,r;if(null==this)throw new TypeError(" this is null or not defined");var o=Object(this),s=o.length>>>0;if("function"!=typeof t)throw new TypeError(t+" is not a function");for(e&&(n=e),i=Array(s),r=0;s>r;){var a,h;r in o&&(a=o[r],h=t.call(n,a,r,o),i[r]=h),r++}return i}),Array.prototype.filter||(Array.prototype.filter=function(t){"use strict";if(null==this)throw new TypeError;var e=Object(this),n=e.length>>>0;if("function"!=typeof t)throw new TypeError;for(var i=[],r=arguments[1],o=0;n>o;o++)if(o in e){var s=e[o];t.call(r,s,o,e)&&i.push(s)}return i}),Object.keys||(Object.keys=function(){var t=Object.prototype.hasOwnProperty,e=!{toString:null}.propertyIsEnumerable("toString"),n=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],i=n.length;return function(r){if("object"!=typeof r&&"function"!=typeof r||null===r)throw new TypeError("Object.keys called on non-object");var o=[];for(var s in r)t.call(r,s)&&o.push(s);if(e)for(var a=0;i>a;a++)t.call(r,n[a])&&o.push(n[a]);return o}}()),Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),Function.prototype.bind||(Function.prototype.bind=function(t){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var e=Array.prototype.slice.call(arguments,1),n=this,i=function(){},r=function(){return n.apply(this instanceof i&&t?this:t,e.concat(Array.prototype.slice.call(arguments)))};return i.prototype=this.prototype,r.prototype=new i,r});var E={listeners:[],indexOf:function(t){for(var e=this.listeners,n=0,i=this.listeners.length;i>n;n++){var r=e[n];if(r&&r.object==t)return n}return-1},addListener:function(t,e,n){var i=this.indexOf(t),r=this.listeners[i];r||(r={object:t,events:{}},this.listeners.push(r));var o=r.events[e];o||(o=[],r.events[e]=o),-1==o.indexOf(n)&&o.push(n)},removeListener:function(t,e,n){var i=this.indexOf(t),r=this.listeners[i];if(r){var o=r.events[e];o&&(i=o.indexOf(n),-1!=i&&o.splice(i,1),0==o.length&&delete r.events[e]);var s=0,a=r.events;for(var h in a)a.hasOwnProperty(h)&&s++;0==s&&delete this.listeners[i]}},removeAllListeners:function(){this.listeners=[]},trigger:function(t,e,n){var i=this.indexOf(t),r=this.listeners[i];if(r){var o=r.events[e];if(o)for(var s=0,a=o.length;a>s;s++)o[s](n)}}};TimeStep=function(t,e,n){this.current=new Date,this._start=new Date,this._end=new Date,this.autoScale=!0,this.scale=TimeStep.SCALE.DAY,this.step=1,this.setRange(t,e,n)},TimeStep.SCALE={MILLISECOND:1,SECOND:2,MINUTE:3,HOUR:4,DAY:5,WEEKDAY:6,MONTH:7,YEAR:8},TimeStep.prototype.setRange=function(t,e,n){t instanceof Date&&e instanceof Date&&(this._start=void 0!=t?new Date(t.valueOf()):new Date,this._end=void 0!=e?new Date(e.valueOf()):new Date,this.autoScale&&this.setMinimumStep(n))},TimeStep.prototype.first=function(){this.current=new Date(this._start.valueOf()),this.roundToMinor()},TimeStep.prototype.roundToMinor=function(){switch(this.scale){case TimeStep.SCALE.YEAR:this.current.setFullYear(this.step*Math.floor(this.current.getFullYear()/this.step)),this.current.setMonth(0);case TimeStep.SCALE.MONTH:this.current.setDate(1);case TimeStep.SCALE.DAY:case TimeStep.SCALE.WEEKDAY:this.current.setHours(0);case TimeStep.SCALE.HOUR:this.current.setMinutes(0);case TimeStep.SCALE.MINUTE:this.current.setSeconds(0);case TimeStep.SCALE.SECOND:this.current.setMilliseconds(0)}if(1!=this.step)switch(this.scale){case TimeStep.SCALE.MILLISECOND:this.current.setMilliseconds(this.current.getMilliseconds()-this.current.getMilliseconds()%this.step);break;case TimeStep.SCALE.SECOND:this.current.setSeconds(this.current.getSeconds()-this.current.getSeconds()%this.step);break;case TimeStep.SCALE.MINUTE:this.current.setMinutes(this.current.getMinutes()-this.current.getMinutes()%this.step);break;case TimeStep.SCALE.HOUR:this.current.setHours(this.current.getHours()-this.current.getHours()%this.step);break;case TimeStep.SCALE.WEEKDAY:case TimeStep.SCALE.DAY:this.current.setDate(this.current.getDate()-1-(this.current.getDate()-1)%this.step+1);break;case TimeStep.SCALE.MONTH:this.current.setMonth(this.current.getMonth()-this.current.getMonth()%this.step);break;case TimeStep.SCALE.YEAR:this.current.setFullYear(this.current.getFullYear()-this.current.getFullYear()%this.step);break;default:}},TimeStep.prototype.hasNext=function(){return this.current.valueOf()<=this._end.valueOf()},TimeStep.prototype.next=function(){var t=this.current.valueOf();if(6>this.current.getMonth())switch(this.scale){case TimeStep.SCALE.MILLISECOND:this.current=new Date(this.current.valueOf()+this.step);break;case TimeStep.SCALE.SECOND:this.current=new Date(this.current.valueOf()+1e3*this.step);break;case TimeStep.SCALE.MINUTE:this.current=new Date(this.current.valueOf()+60*1e3*this.step);break;case TimeStep.SCALE.HOUR:this.current=new Date(this.current.valueOf()+60*60*1e3*this.step);var e=this.current.getHours();this.current.setHours(e-e%this.step);break;case TimeStep.SCALE.WEEKDAY:case TimeStep.SCALE.DAY:this.current.setDate(this.current.getDate()+this.step);break;case TimeStep.SCALE.MONTH:this.current.setMonth(this.current.getMonth()+this.step);break;case TimeStep.SCALE.YEAR:this.current.setFullYear(this.current.getFullYear()+this.step);break;default:}else switch(this.scale){case TimeStep.SCALE.MILLISECOND:this.current=new Date(this.current.valueOf()+this.step);break;case TimeStep.SCALE.SECOND:this.current.setSeconds(this.current.getSeconds()+this.step);break;case TimeStep.SCALE.MINUTE:this.current.setMinutes(this.current.getMinutes()+this.step);break;case TimeStep.SCALE.HOUR:this.current.setHours(this.current.getHours()+this.step);break;case TimeStep.SCALE.WEEKDAY:case TimeStep.SCALE.DAY:this.current.setDate(this.current.getDate()+this.step);break;case TimeStep.SCALE.MONTH:this.current.setMonth(this.current.getMonth()+this.step);break;case TimeStep.SCALE.YEAR:this.current.setFullYear(this.current.getFullYear()+this.step);break;default:}if(1!=this.step)switch(this.scale){case TimeStep.SCALE.MILLISECOND:this.current.getMilliseconds()0&&(this.step=e),this.autoScale=!1},TimeStep.prototype.setAutoScale=function(t){this.autoScale=t},TimeStep.prototype.setMinimumStep=function(t){if(void 0!=t){var e=31104e6,n=2592e6,i=864e5,r=36e5,o=6e4,s=1e3,a=1;1e3*e>t&&(this.scale=TimeStep.SCALE.YEAR,this.step=1e3),500*e>t&&(this.scale=TimeStep.SCALE.YEAR,this.step=500),100*e>t&&(this.scale=TimeStep.SCALE.YEAR,this.step=100),50*e>t&&(this.scale=TimeStep.SCALE.YEAR,this.step=50),10*e>t&&(this.scale=TimeStep.SCALE.YEAR,this.step=10),5*e>t&&(this.scale=TimeStep.SCALE.YEAR,this.step=5),e>t&&(this.scale=TimeStep.SCALE.YEAR,this.step=1),3*n>t&&(this.scale=TimeStep.SCALE.MONTH,this.step=3),n>t&&(this.scale=TimeStep.SCALE.MONTH,this.step=1),5*i>t&&(this.scale=TimeStep.SCALE.DAY,this.step=5),2*i>t&&(this.scale=TimeStep.SCALE.DAY,this.step=2),i>t&&(this.scale=TimeStep.SCALE.DAY,this.step=1),i/2>t&&(this.scale=TimeStep.SCALE.WEEKDAY,this.step=1),4*r>t&&(this.scale=TimeStep.SCALE.HOUR,this.step=4),r>t&&(this.scale=TimeStep.SCALE.HOUR,this.step=1),15*o>t&&(this.scale=TimeStep.SCALE.MINUTE,this.step=15),10*o>t&&(this.scale=TimeStep.SCALE.MINUTE,this.step=10),5*o>t&&(this.scale=TimeStep.SCALE.MINUTE,this.step=5),o>t&&(this.scale=TimeStep.SCALE.MINUTE,this.step=1),15*s>t&&(this.scale=TimeStep.SCALE.SECOND,this.step=15),10*s>t&&(this.scale=TimeStep.SCALE.SECOND,this.step=10),5*s>t&&(this.scale=TimeStep.SCALE.SECOND,this.step=5),s>t&&(this.scale=TimeStep.SCALE.SECOND,this.step=1),200*a>t&&(this.scale=TimeStep.SCALE.MILLISECOND,this.step=200),100*a>t&&(this.scale=TimeStep.SCALE.MILLISECOND,this.step=100),50*a>t&&(this.scale=TimeStep.SCALE.MILLISECOND,this.step=50),10*a>t&&(this.scale=TimeStep.SCALE.MILLISECOND,this.step=10),5*a>t&&(this.scale=TimeStep.SCALE.MILLISECOND,this.step=5),a>t&&(this.scale=TimeStep.SCALE.MILLISECOND,this.step=1)}},TimeStep.prototype.snap=function(t){if(this.scale==TimeStep.SCALE.YEAR){var e=t.getFullYear()+Math.round(t.getMonth()/12);t.setFullYear(Math.round(e/this.step)*this.step),t.setMonth(0),t.setDate(0),t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0)}else if(this.scale==TimeStep.SCALE.MONTH)t.getDate()>15?(t.setDate(1),t.setMonth(t.getMonth()+1)):t.setDate(1),t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0);else if(this.scale==TimeStep.SCALE.DAY||this.scale==TimeStep.SCALE.WEEKDAY){switch(this.step){case 5:case 2:t.setHours(24*Math.round(t.getHours()/24));break;default:t.setHours(12*Math.round(t.getHours()/12))}t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0)}else if(this.scale==TimeStep.SCALE.HOUR){switch(this.step){case 4:t.setMinutes(60*Math.round(t.getMinutes()/60));break;default:t.setMinutes(30*Math.round(t.getMinutes()/30))}t.setSeconds(0),t.setMilliseconds(0)}else if(this.scale==TimeStep.SCALE.MINUTE){switch(this.step){case 15:case 10:t.setMinutes(5*Math.round(t.getMinutes()/5)),t.setSeconds(0);break;case 5:t.setSeconds(60*Math.round(t.getSeconds()/60));break;default:t.setSeconds(30*Math.round(t.getSeconds()/30))}t.setMilliseconds(0)}else if(this.scale==TimeStep.SCALE.SECOND)switch(this.step){case 15:case 10:t.setSeconds(5*Math.round(t.getSeconds()/5)),t.setMilliseconds(0);break;case 5:t.setMilliseconds(1e3*Math.round(t.getMilliseconds()/1e3));break;default:t.setMilliseconds(500*Math.round(t.getMilliseconds()/500))}else if(this.scale==TimeStep.SCALE.MILLISECOND){var n=this.step>5?this.step/2:1;t.setMilliseconds(Math.round(t.getMilliseconds()/n)*n)}},TimeStep.prototype.isMajor=function(){switch(this.scale){case TimeStep.SCALE.MILLISECOND:return 0==this.current.getMilliseconds();case TimeStep.SCALE.SECOND:return 0==this.current.getSeconds();case TimeStep.SCALE.MINUTE:return 0==this.current.getHours()&&0==this.current.getMinutes();case TimeStep.SCALE.HOUR:return 0==this.current.getHours();case TimeStep.SCALE.WEEKDAY:case TimeStep.SCALE.DAY:return 1==this.current.getDate();case TimeStep.SCALE.MONTH:return 0==this.current.getMonth();case TimeStep.SCALE.YEAR:return!1;default:return!1}},TimeStep.prototype.getLabelMinor=function(t){switch(void 0==t&&(t=this.current),this.scale){case TimeStep.SCALE.MILLISECOND:return S(t).format("SSS");case TimeStep.SCALE.SECOND:return S(t).format("s");case TimeStep.SCALE.MINUTE:return S(t).format("HH:mm");case TimeStep.SCALE.HOUR:return S(t).format("HH:mm");case TimeStep.SCALE.WEEKDAY:return S(t).format("ddd D");case TimeStep.SCALE.DAY:return S(t).format("D");case TimeStep.SCALE.MONTH:return S(t).format("MMM");case TimeStep.SCALE.YEAR:return S(t).format("YYYY");default:return""}},TimeStep.prototype.getLabelMajor=function(t){switch(void 0==t&&(t=this.current),this.scale){case TimeStep.SCALE.MILLISECOND:return S(t).format("HH:mm:ss");case TimeStep.SCALE.SECOND:return S(t).format("D MMMM HH:mm");case TimeStep.SCALE.MINUTE:case TimeStep.SCALE.HOUR:return S(t).format("ddd D MMMM");case TimeStep.SCALE.WEEKDAY:case TimeStep.SCALE.DAY:return S(t).format("MMMM YYYY");case TimeStep.SCALE.MONTH:return S(t).format("YYYY");case TimeStep.SCALE.YEAR:return"";default:return""}},r.prototype.subscribe=function(t,e,n){var i=this.subscribers[t];i||(i=[],this.subscribers[t]=i),i.push({id:n?n+"":null,callback:e})},r.prototype.unsubscribe=function(t,e){var n=this.subscribers[t];n&&(this.subscribers[t]=n.filter(function(t){return t.callback!=e}))},r.prototype._trigger=function(t,e,n){if("*"==t)throw Error("Cannot trigger event *");var i=[];t in this.subscribers&&(i=i.concat(this.subscribers[t])),"*"in this.subscribers&&(i=i.concat(this.subscribers["*"])),i.forEach(function(i){i.id!=n&&i.callback&&i.callback(t,e,n||null)})},r.prototype.add=function(t,e){var n,i=[],r=this;if(t instanceof Array)t.forEach(function(t){var e=r._addItem(t);i.push(e)});else if(w.isDataTable(t))for(var o=this._getColumnNames(t),s=0,a=t.getNumberOfRows();a>s;s++){var h={};o.forEach(function(e,n){h[e]=t.getValue(s,n)}),n=r._addItem(h),i.push(n)}else{if(!(t instanceof Object))throw Error("Unknown dataType");n=r._addItem(t),i.push(n)}this._trigger("add",{items:i},e)},r.prototype.update=function(t,e){var n,i=[],r=this;if(t instanceof Array)t.forEach(function(t){var e=r._updateItem(t);i.push(e)});else if(w.isDataTable(t))for(var o=this._getColumnNames(t),s=0,a=t.getNumberOfRows();a>s;s++){var h={};o.forEach(function(e,n){h[e]=t.getValue(s,n)}),n=r._updateItem(h),i.push(n)}else{if(!(t instanceof Object))throw Error("Unknown dataType");n=r._updateItem(t),i.push(n)}this._trigger("update",{items:i},e)},r.prototype.get=function(t,e,n){var i=this;"Object"==w.getType(t)&&(n=e,e=t,t=void 0);var r,o=this._mergeFieldTypes(e&&e.fieldTypes),s=e&&e.fields,a=e&&e.filter;if(e&&e.type){if(r="DataTable"==e.type?"DataTable":"Array",n&&r!=w.getType(n))throw Error('Type of parameter "data" ('+w.getType(n)+") "+"does not correspond with specified options.type ("+e.type+")");if("DataTable"==r&&!w.isDataTable(n))throw Error('Parameter "data" must be a DataTable when options.type is "DataTable"')}else r=n?"DataTable"==w.getType(n)?"DataTable":"Array":"Array";if("DataTable"==r){var h=this._getColumnNames(n);if(void 0==t)w.forEach(this.data,function(t){var e=i._castItem(t);(!e||a(e))&&i._appendRow(n,h,e)});else if(w.isNumber(t)||w.isString(t)){var c=i._castItem(i.data[t],o,s);this._appendRow(n,h,c)}else{if(!(t instanceof Array))throw new TypeError('Parameter "ids" must be undefined, a String, Number, or Array');t.forEach(function(t){var e=i._castItem(i.data[t],o,s);(!e||a(e))&&i._appendRow(n,h,e)})}}else if(n=n||[],void 0==t)w.forEach(this.data,function(t){var e=i._castItem(t,o,s);(!a||a(e))&&n.push(e)});else{if(w.isNumber(t)||w.isString(t))return this._castItem(i.data[t],o,s);if(!(t instanceof Array))throw new TypeError('Parameter "ids" must be undefined, a String, Number, or Array');t.forEach(function(t){var e=i._castItem(i.data[t],o,s);(!a||a(e))&&n.push(e)})}return n},r.prototype.forEach=function(t,e){var n=this._mergeFieldTypes(e&&e.fieldTypes),i=e&&e.fields,r=e&&e.filter,o=this;w.forEach(this.data,function(e,s){var a=o._castItem(e,n,i);(!r||r(a))&&t(a,s)})},r.prototype.map=function(t,e){var n=this._mergeFieldTypes(e&&e.fieldTypes),i=e&&e.fields,r=e&&e.filter,o=this,s=[];return w.forEach(this.data,function(e,a){var h=o._castItem(e,n,i);if(!r||r(h)){var c=t(h,a);s.push(c)}}),s},r.prototype._mergeFieldTypes=function(t){var e={};return this.options&&this.options.fieldTypes&&w.forEach(this.options.fieldTypes,function(t,n){e[n]=t}),t&&w.forEach(t,function(t,n){e[n]=t}),e},r.prototype.remove=function(t,e){var n=[],i=this;if(w.isNumber(t)||w.isString(t))delete this.data[t],delete this.internalIds[t],n.push(t);else if(t instanceof Array)t.forEach(function(t){i.remove(t)}),n=n.concat(t);else if(t instanceof Object)for(var r in this.data)this.data.hasOwnProperty(r)&&this.data[r]==t&&(delete this.data[r],delete this.internalIds[r],n.push(r));this._trigger("remove",{items:n},e)},r.prototype.clear=function(t){var e=Object.keys(this.data);this.data={},this.internalIds={},this._trigger("remove",{items:e},t)},r.prototype.max=function(t){var e=this.data,n=Object.keys(e),i=null,r=null;return n.forEach(function(n){var o=e[n],s=o[t];null!=s&&(!i||s>r)&&(i=o,r=s)}),i},r.prototype.min=function(t){var e=this.data,n=Object.keys(e),i=null,r=null;return n.forEach(function(n){var o=e[n],s=o[t];null!=s&&(!i||r>s)&&(i=o,r=s)}),i},r.prototype.distinct=function(t){var e=this.data,n=[],i=this.options.fieldTypes[t],r=0;for(var o in e)if(e.hasOwnProperty(o)){for(var s=e[o],a=w.cast(s[t],i),h=!1,c=0;r>c;c++)if(n[c]==a){h=!0;break}h||(n[r]=a,r++)}return n},r.prototype._addItem=function(t){var e=t[this.fieldId];void 0==e&&(e=w.randomUUID(),t[this.fieldId]=e,this.internalIds[e]=t);var n={};for(var i in t)if(t.hasOwnProperty(i)){var r=this.fieldTypes[i];n[i]=w.cast(t[i],r)}return this.data[e]=n,e},r.prototype._castItem=function(t,e,n){var i,r=this.fieldId,o=this.internalIds;return t?(i={},e=e||{},n?w.forEach(t,function(t,r){-1!=n.indexOf(r)&&(i[r]=w.cast(t,e[r]))}):w.forEach(t,function(t,n){n==r&&t in o||(i[n]=w.cast(t,e[n]))})):i=null,i},r.prototype._updateItem=function(t){var e=t[this.fieldId];if(void 0==e)throw Error("Item has no id (item: "+JSON.stringify(t)+")");var n=this.data[e];if(n){for(var i in t)if(t.hasOwnProperty(i)){var r=this.fieldTypes[i];n[i]=w.cast(t[i],r)}}else this._addItem(t);return e},r.prototype._getColumnNames=function(t){for(var e=[],n=0,i=t.getNumberOfColumns();i>n;n++)e[n]=t.getColumnId(n)||t.getColumnLabel(n);return e},r.prototype._appendRow=function(t,e,n){var i=t.addRow();e.forEach(function(e,r){t.setValue(i,r,n[e])})},o.prototype.setOptions=function(t){w.extend(this.options,t)},o.prototype.update=function(){this._order(),this._stack()},o.prototype._order=function(){var t=this.parent.items;if(!t)throw Error("Cannot stack items: parent does not contain items");var e=[],n=0;w.forEach(t,function(t){t.visible&&(e[n]=t,n++)});var i=this.options.order;if("function"!=typeof this.options.order)throw Error("Option order must be a function");e.sort(i),this.ordered=e},o.prototype._stack=function(){var t,e,n=this.ordered,i=this.options,r="top"==i.orientation,o=i.margin&&i.margin.item||0;for(t=0,e=n.length;e>t;t++){var s=n[t],a=null;do a=this.checkOverlap(n,t,0,t-1,o),null!=a&&(s.top=r?a.top+a.height+o:a.top-s.height-o);while(a)}},o.prototype.checkOverlap=function(t,e,n,i,r){for(var o=this.collision,s=t[e],a=i;a>=n;a--){var h=t[a];if(o(s,h,r)&&a!=e)return h}return null},o.prototype.collision=function(t,e,n){return t.left-ne.left&&t.top-ne.top},s.prototype.setOptions=function(t){w.extend(this.options,t),(null!=t.start||null!=t.end)&&this.setRange(t.start,t.end)},s.prototype.subscribe=function(t,e,n){var i,r=this;if("horizontal"!=n&&"vertical"!=n)throw new TypeError('Unknown direction "'+n+'". '+'Choose "horizontal" or "vertical".');if("move"==e)i={component:t,event:e,direction:n,callback:function(t){r._onMouseDown(t,i)},params:{}},t.on("mousedown",i.callback),r.listeners.push(i);else{if("zoom"!=e)throw new TypeError('Unknown event "'+e+'". '+'Choose "move" or "zoom".');i={component:t,event:e,direction:n,callback:function(t){r._onMouseWheel(t,i)},params:{}},t.on("mousewheel",i.callback),r.listeners.push(i)}},s.prototype.on=function(t,e){E.addListener(this,t,e)},s.prototype._trigger=function(t){E.trigger(this,t,{start:this.start,end:this.end})},s.prototype.setRange=function(t,e){var n=this._applyRange(t,e);n&&(this._trigger("rangechange"),this._trigger("rangechanged"))},s.prototype._applyRange=function(t,e){var n,i=null!=t?w.cast(t,"Number"):this.start,r=null!=e?w.cast(e,"Number"):this.end;if(isNaN(i))throw Error('Invalid start "'+t+'"');if(isNaN(r))throw Error('Invalid end "'+e+'"');if(i>r&&(r=i),null!=this.options.min){var o=this.options.min.valueOf();o>i&&(n=o-i,i+=n,r+=n)}if(null!=this.options.max){var s=this.options.max.valueOf();r>s&&(n=r-s,i-=n,r-=n)}if(null!=this.options.zoomMin){var a=this.options.zoomMin.valueOf();0>a&&(a=0),a>r-i&&(this.end-this.start>a?(n=a-(r-i),i-=n/2,r+=n/2):(i=this.start,r=this.end))}if(null!=this.options.zoomMax){var h=this.options.zoomMax.valueOf();0>h&&(h=0),r-i>h&&(h>this.end-this.start?(n=r-i-h,i+=n/2,r-=n/2):(i=this.start,r=this.end))}var c=this.start!=i||this.end!=r;return this.start=i,this.end=r,c},s.prototype.getRange=function(){return{start:this.start,end:this.end}},s.prototype.conversion=function(t){return this.start,this.end,s.conversion(this.start,this.end,t)},s.conversion=function(t,e,n){return 0!=n&&0!=e-t?{offset:t,factor:n/(e-t)}:{offset:0,factor:1}},s.prototype._onMouseDown=function(t,e){t=t||window.event;var n=e.params,i=t.which?1==t.which:1==t.button;if(i){n.mouseX=w.getPageX(t),n.mouseY=w.getPageY(t),n.previousLeft=0,n.previousOffset=0,n.moved=!1,n.start=this.start,n.end=this.end;var r=e.component.frame;r&&(r.style.cursor="move");var o=this;n.onMouseMove||(n.onMouseMove=function(t){o._onMouseMove(t,e)},w.addEventListener(document,"mousemove",n.onMouseMove)),n.onMouseUp||(n.onMouseUp=function(t){o._onMouseUp(t,e)},w.addEventListener(document,"mouseup",n.onMouseUp)),w.preventDefault(t)}},s.prototype._onMouseMove=function(t,e){t=t||window.event;var n=e.params,i=w.getPageX(t),r=w.getPageY(t);void 0==n.mouseX&&(n.mouseX=i),void 0==n.mouseY&&(n.mouseY=r);var o=i-n.mouseX,s=r-n.mouseY,a="horizontal"==e.direction?o:s;Math.abs(a)>=1&&(n.moved=!0);var h=n.end-n.start,c="horizontal"==e.direction?e.component.width:e.component.height,p=-a/c*h;this._applyRange(n.start+p,n.end+p),this._trigger("rangechange"),w.preventDefault(t)},s.prototype._onMouseUp=function(t,e){t=t||window.event;var n=e.params;e.component.frame&&(e.component.frame.style.cursor="auto"),n.onMouseMove&&(w.removeEventListener(document,"mousemove",n.onMouseMove),n.onMouseMove=null),n.onMouseUp&&(w.removeEventListener(document,"mouseup",n.onMouseUp),n.onMouseUp=null),n.moved&&this._trigger("rangechanged")},s.prototype._onMouseWheel=function(t,e){t=t||window.event;var n=0;if(t.wheelDelta?n=t.wheelDelta/120:t.detail&&(n=-t.detail/3),n){var i=this,r=function(){var r=n/5,o=null,s=e.component.frame;if(s){var a,h;if("horizontal"==e.direction){a=e.component.width,h=i.conversion(a); -var c=w.getAbsoluteLeft(s),p=w.getPageX(t);o=(p-c)/h.factor+h.offset}else{a=e.component.height,h=i.conversion(a);var u=w.getAbsoluteTop(s),d=w.getPageY(t);o=(u+a-d-u)/h.factor+h.offset}}i.zoom(r,o)};r()}w.preventDefault(t)},s.prototype.zoom=function(t,e){null==e&&(e=(this.start+this.end)/2),t>=1&&(t=.9),-1>=t&&(t=-.9),0>t&&(t/=1+t);var n=this.start-e,i=this.end-e,r=this.start-n*t,o=this.end-i*t;this.setRange(r,o)},s.prototype.move=function(t){var e=this.end-this.start,n=this.start+e*t,i=this.end+e*t;this.start=n,this.end=i},a.prototype.on=function(t,e,n){var i=t instanceof RegExp?t:RegExp(t.replace("*","\\w+")),r={id:w.randomUUID(),event:t,regexp:i,callback:"function"==typeof e?e:null,target:n};return this.subscriptions.push(r),r.id},a.prototype.off=function(t){for(var e=0;this.subscriptions.length>e;){var n=this.subscriptions[e],i=!0;if(t instanceof Object)for(var r in t)t.hasOwnProperty(r)&&t[r]!==n[r]&&(i=!1);else i=n.id==t;i?this.subscriptions.splice(e,1):e++}},a.prototype.emit=function(t,e,n){for(var i=0;this.subscriptions.length>i;i++){var r=this.subscriptions[i];r.regexp.test(t)&&r.callback&&r.callback(t,e,n)}},h.prototype.add=function(t){if(void 0==t.id)throw Error("Component has no field id");if(!(t instanceof c||t instanceof h))throw new TypeError("Component must be an instance of prototype Component or Controller");t.controller=this,this.components[t.id]=t},h.prototype.requestReflow=function(t){if(t)this.reflow();else if(!this.reflowTimer){var e=this;this.reflowTimer=setTimeout(function(){e.reflowTimer=void 0,e.reflow()},0)}},h.prototype.requestRepaint=function(t){if(t)this.repaint();else if(!this.repaintTimer){var e=this;this.repaintTimer=setTimeout(function(){e.repaintTimer=void 0,e.repaint()},0)}},h.prototype.repaint=function(){function t(i,r){r in n||(i.depends&&i.depends.forEach(function(e){t(e,e.id)}),i.parent&&t(i.parent,i.parent.id),e=i.repaint()||e,n[r]=!0)}var e=!1;this.repaintTimer&&(clearTimeout(this.repaintTimer),this.repaintTimer=void 0);var n={};w.forEach(this.components,t),e&&this.reflow()},h.prototype.reflow=function(){function t(i,r){r in n||(i.depends&&i.depends.forEach(function(e){t(e,e.id)}),i.parent&&t(i.parent,i.parent.id),e=i.reflow()||e,n[r]=!0)}var e=!1;this.reflowTimer&&(clearTimeout(this.reflowTimer),this.reflowTimer=void 0);var n={};w.forEach(this.components,t),e&&this.repaint()},c.prototype.setOptions=function(t){t&&(w.extend(this.options,t),this.controller&&(this.requestRepaint(),this.requestReflow()))},c.prototype.getContainer=function(){return null},c.prototype.getFrame=function(){return this.frame},c.prototype.repaint=function(){return!1},c.prototype.reflow=function(){return!1},c.prototype.requestRepaint=function(){if(!this.controller)throw Error("Cannot request a repaint: no controller configured");this.controller.requestRepaint()},c.prototype.requestReflow=function(){if(!this.controller)throw Error("Cannot request a reflow: no controller configured");this.controller.requestReflow()},p.prototype=new c,p.prototype.getContainer=function(){return this.frame},p.prototype.repaint=function(){var t=0,e=w.updateProperty,n=w.option.asSize,i=this.options,r=this.frame;if(r||(r=document.createElement("div"),r.className="panel",i.className&&("function"==typeof i.className?w.addClassName(r,i.className()+""):w.addClassName(r,i.className+"")),this.frame=r,t+=1),!r.parentNode){if(!this.parent)throw Error("Cannot repaint panel: no parent attached");var o=this.parent.getContainer();if(!o)throw Error("Cannot repaint panel: parent has no container element");o.appendChild(r),t+=1}return t+=e(r.style,"top",n(i.top,"0px")),t+=e(r.style,"left",n(i.left,"0px")),t+=e(r.style,"width",n(i.width,"100%")),t+=e(r.style,"height",n(i.height,"100%")),t>0},p.prototype.reflow=function(){var t=0,e=w.updateProperty,n=this.frame;return n?(t+=e(this,"top",n.offsetTop),t+=e(this,"left",n.offsetLeft),t+=e(this,"width",n.offsetWidth),t+=e(this,"height",n.offsetHeight)):t+=1,t>0},u.prototype=new p,u.prototype.setOptions=function(t){w.extend(this.options,t),this.options.autoResize?this._watch():this._unwatch()},u.prototype.repaint=function(){var t=0,e=w.updateProperty,n=w.option.asSize,i=this.options,r=this.frame;if(r||(r=document.createElement("div"),r.className="graph panel",i.className&&w.addClassName(r,w.option.asString(i.className)),this.frame=r,t+=1),!r.parentNode){if(!this.container)throw Error("Cannot repaint root panel: no container attached");this.container.appendChild(r),t+=1}return t+=e(r.style,"top",n(i.top,"0px")),t+=e(r.style,"left",n(i.left,"0px")),t+=e(r.style,"width",n(i.width,"100%")),t+=e(r.style,"height",n(i.height,"100%")),this._updateEventEmitters(),t>0},u.prototype.reflow=function(){var t=0,e=w.updateProperty,n=this.frame;return n?(t+=e(this,"top",n.offsetTop),t+=e(this,"left",n.offsetLeft),t+=e(this,"width",n.offsetWidth),t+=e(this,"height",n.offsetHeight)):t+=1,t>0},u.prototype._watch=function(){var t=this;this._unwatch();var e=function(){return t.options.autoResize?(t.frame&&(t.frame.clientWidth!=t.width||t.frame.clientHeight!=t.height)&&t.requestReflow(),void 0):(t._unwatch(),void 0)};w.addEventListener(window,"resize",e),this.watchTimer=setInterval(e,1e3)},u.prototype._unwatch=function(){this.watchTimer&&(clearInterval(this.watchTimer),this.watchTimer=void 0)},u.prototype.on=function(t,e){var n=this.listeners[t];n||(n=[],this.listeners[t]=n),n.push(e),this._updateEventEmitters()},u.prototype._updateEventEmitters=function(){if(this.listeners){var t=this;w.forEach(this.listeners,function(e,n){if(t.emitters||(t.emitters={}),!(n in t.emitters)){var i=t.frame;if(i){var r=function(t){e.forEach(function(e){e(t)})};t.emitters[n]=r,w.addEventListener(i,n,r)}}})}},d.prototype=new c,d.prototype.setOptions=function(t){w.extend(this.options,t)},d.prototype.setRange=function(t){if(!(t instanceof s||t&&t.start&&t.end))throw new TypeError("Range must be an instance of Range, or an object containing start and end.");this.range=t},d.prototype.toTime=function(t){var e=this.conversion;return new Date(t/e.factor+e.offset)},d.prototype.toScreen=function(t){var e=this.conversion;return(t.valueOf()-e.offset)*e.factor},d.prototype.repaint=function(){var t=0,e=w.updateProperty,n=w.option.asSize,i=this.options,r=this.props,o=this.step,s=this.frame;if(s||(s=document.createElement("div"),this.frame=s,t+=1),s.className="axis "+i.orientation,!s.parentNode){if(!this.parent)throw Error("Cannot repaint time axis: no parent attached");var a=this.parent.getContainer();if(!a)throw Error("Cannot repaint time axis: parent has no container element");a.appendChild(s),t+=1}var h=s.parentNode;if(h){var c=s.nextSibling;h.removeChild(s);var p=i.orientation,u="bottom"==p&&this.props.parentHeight&&this.height?this.props.parentHeight-this.height+"px":"0px";if(t+=e(s.style,"top",n(i.top,u)),t+=e(s.style,"left",n(i.left,"0px")),t+=e(s.style,"width",n(i.width,"100%")),t+=e(s.style,"height",n(i.height,this.height+"px")),this._repaintMeasureChars(),this.step){this._repaintStart(),o.first();for(var d=void 0,l=0;o.hasNext()&&1e3>l;){l++;var f=o.getCurrent(),m=this.toScreen(f),g=o.isMajor();i.showMinorLabels&&this._repaintMinorText(m,o.getLabelMinor()),g&&i.showMajorLabels?(m>0&&(void 0==d&&(d=m),this._repaintMajorText(m,o.getLabelMajor())),this._repaintMajorLine(m)):this._repaintMinorLine(m),o.next()}if(i.showMajorLabels){var v=this.toTime(0),y=o.getLabelMajor(v),S=y.length*(r.majorCharWidth||10)+10;(void 0==d||d>S)&&this._repaintMajorText(0,y)}this._repaintEnd()}this._repaintLine(),c?h.insertBefore(s,c):h.appendChild(s)}return t>0},d.prototype._repaintStart=function(){var t=this.dom,e=t.redundant;e.majorLines=t.majorLines,e.majorTexts=t.majorTexts,e.minorLines=t.minorLines,e.minorTexts=t.minorTexts,t.majorLines=[],t.majorTexts=[],t.minorLines=[],t.minorTexts=[]},d.prototype._repaintEnd=function(){w.forEach(this.dom.redundant,function(t){for(;t.length;){var e=t.pop();e&&e.parentNode&&e.parentNode.removeChild(e)}})},d.prototype._repaintMinorText=function(t,e){var n=this.dom.redundant.minorTexts.shift();if(!n){var i=document.createTextNode("");n=document.createElement("div"),n.appendChild(i),n.className="text minor",this.frame.appendChild(n)}this.dom.minorTexts.push(n),n.childNodes[0].nodeValue=e,n.style.left=t+"px",n.style.top=this.props.minorLabelTop+"px"},d.prototype._repaintMajorText=function(t,e){var n=this.dom.redundant.majorTexts.shift();if(!n){var i=document.createTextNode(e);n=document.createElement("div"),n.className="text major",n.appendChild(i),this.frame.appendChild(n)}this.dom.majorTexts.push(n),n.childNodes[0].nodeValue=e,n.style.top=this.props.majorLabelTop+"px",n.style.left=t+"px"},d.prototype._repaintMinorLine=function(t){var e=this.dom.redundant.minorLines.shift();e||(e=document.createElement("div"),e.className="grid vertical minor",this.frame.appendChild(e)),this.dom.minorLines.push(e);var n=this.props;e.style.top=n.minorLineTop+"px",e.style.height=n.minorLineHeight+"px",e.style.left=t-n.minorLineWidth/2+"px"},d.prototype._repaintMajorLine=function(t){var e=this.dom.redundant.majorLines.shift();e||(e=document.createElement("DIV"),e.className="grid vertical major",this.frame.appendChild(e)),this.dom.majorLines.push(e);var n=this.props;e.style.top=n.majorLineTop+"px",e.style.left=t-n.majorLineWidth/2+"px",e.style.height=n.majorLineHeight+"px"},d.prototype._repaintLine=function(){var t=this.dom.line,e=this.frame,n=this.options;n.showMinorLabels||n.showMajorLabels?(t?(e.removeChild(t),e.appendChild(t)):(t=document.createElement("div"),t.className="grid horizontal major",e.appendChild(t),this.dom.line=t),t.style.top=this.props.lineTop+"px"):t&&axis.parentElement&&(e.removeChild(axis.line),delete this.dom.line)},d.prototype._repaintMeasureChars=function(){var t,e=this.dom;if(!e.characterMinor){t=document.createTextNode("0");var n=document.createElement("DIV");n.className="text minor measure",n.appendChild(t),this.frame.appendChild(n),e.measureCharMinor=n}if(!e.characterMajor){t=document.createTextNode("0");var i=document.createElement("DIV");i.className="text major measure",i.appendChild(t),this.frame.appendChild(i),e.measureCharMajor=i}},d.prototype.reflow=function(){var t=0,e=w.updateProperty,n=this.frame,i=this.range;if(!i)throw Error("Cannot repaint time axis: no range configured");if(n){t+=e(this,"top",n.offsetTop),t+=e(this,"left",n.offsetLeft);var r=this.props,o=this.options.showMinorLabels,s=this.options.showMajorLabels,a=this.dom.measureCharMinor,h=this.dom.measureCharMajor;a&&(r.minorCharHeight=a.clientHeight,r.minorCharWidth=a.clientWidth),h&&(r.majorCharHeight=h.clientHeight,r.majorCharWidth=h.clientWidth);var c=n.parentNode?n.parentNode.offsetHeight:0;switch(c!=r.parentHeight&&(r.parentHeight=c,t+=1),this.options.orientation){case"bottom":r.minorLabelHeight=o?r.minorCharHeight:0,r.majorLabelHeight=s?r.majorCharHeight:0,r.minorLabelTop=0,r.majorLabelTop=r.minorLabelTop+r.minorLabelHeight,r.minorLineTop=-this.top,r.minorLineHeight=Math.max(this.top+r.majorLabelHeight,0),r.minorLineWidth=1,r.majorLineTop=-this.top,r.majorLineHeight=Math.max(this.top+r.minorLabelHeight+r.majorLabelHeight,0),r.majorLineWidth=1,r.lineTop=0;break;case"top":r.minorLabelHeight=o?r.minorCharHeight:0,r.majorLabelHeight=s?r.majorCharHeight:0,r.majorLabelTop=0,r.minorLabelTop=r.majorLabelTop+r.majorLabelHeight,r.minorLineTop=r.minorLabelTop,r.minorLineHeight=Math.max(c-r.majorLabelHeight-this.top),r.minorLineWidth=1,r.majorLineTop=0,r.majorLineHeight=Math.max(c-this.top),r.majorLineWidth=1,r.lineTop=r.majorLabelHeight+r.minorLabelHeight;break;default:throw Error('Unkown orientation "'+this.options.orientation+'"')}var p=r.minorLabelHeight+r.majorLabelHeight;t+=e(this,"width",n.offsetWidth),t+=e(this,"height",p),this._updateConversion();var u=w.cast(i.start,"Date"),d=w.cast(i.end,"Date"),l=this.toTime(5*(r.minorCharWidth||10))-this.toTime(0);this.step=new TimeStep(u,d,l),t+=e(r.range,"start",u.valueOf()),t+=e(r.range,"end",d.valueOf()),t+=e(r.range,"minimumStep",l.valueOf())}return t>0},d.prototype._updateConversion=function(){var t=this.range;if(!t)throw Error("No range configured");this.conversion=t.conversion?t.conversion(this.width):s.conversion(t.start,t.end,this.width)},l.prototype=new p,l.types={box:m,range:v,point:g},l.prototype.setOptions=function(t){w.extend(this.options,t),this.stack.setOptions(this.options)},l.prototype.setRange=function(t){if(!(t instanceof s||t&&t.start&&t.end))throw new TypeError("Range must be an instance of Range, or an object containing start and end.");this.range=t},l.prototype.repaint=function(){var t=0,e=w.updateProperty,n=w.option.asSize,i=this.options,r=this.frame;if(!r){r=document.createElement("div"),r.className="itemset",i.className&&w.addClassName(r,w.option.asString(i.className));var o=document.createElement("div");o.className="background",r.appendChild(o),this.dom.background=o;var s=document.createElement("div");s.className="foreground",r.appendChild(s),this.dom.foreground=s;var a=document.createElement("div");a.className="itemset-axis",this.dom.axis=a,this.frame=r,t+=1}if(!this.parent)throw Error("Cannot repaint itemset: no parent attached");var h=this.parent.getContainer();if(!h)throw Error("Cannot repaint itemset: parent has no container element");r.parentNode||(h.appendChild(r),t+=1),this.dom.axis.parentNode||(h.appendChild(this.dom.axis),t+=1),t+=e(r.style,"height",n(i.height,this.height+"px")),t+=e(r.style,"top",n(i.top,"0px")),t+=e(r.style,"left",n(i.left,"0px")),t+=e(r.style,"width",n(i.width,"100%")),t+=e(this.dom.axis.style,"top",n(i.top,"0px")),this._updateConversion();var c=this,p=this.queue,u=this.data,d=this.items,f={fields:["id","start","end","content","type"]};return Object.keys(p).forEach(function(e){var n=p[e],r=n.item;switch(n.action){case"add":case"update":var o=u.get(e,f),s=o.type||o.start&&o.end&&"range"||"box",a=l.types[s];if(r&&(a&&r instanceof a?(r.data=o,t++):(t+=r.hide(),r=null)),!r){if(!a)throw new TypeError('Unknown item type "'+s+'"');r=new a(c,o,i),t++}d[e]=r,delete p[e];break;case"remove":r&&(t+=r.hide()),delete d[e],delete p[e];break;default:console.log('Error: unknown action "'+n.action+'"')}}),w.forEach(this.items,function(e){e.visible?(t+=e.show(),e.reposition()):t+=e.hide()}),t>0},l.prototype.getForeground=function(){return this.dom.foreground},l.prototype.getBackground=function(){return this.dom.background},l.prototype.getAxis=function(){return this.dom.axis},l.prototype.reflow=function(){var t=0,e=this.options,n=w.updateProperty,i=w.option.asNumber,r=this.frame;if(r){this._updateConversion(),w.forEach(this.items,function(e){t+=e.reflow()}),this.stack.update();var o,s=i(e.maxHeight);if(null!=e.height)o=r.offsetHeight;else{var a=this.stack.ordered;if(a.length){var h=a[0].top,c=a[0].top+a[0].height;w.forEach(a,function(t){h=Math.min(h,t.top),c=Math.max(c,t.top+t.height)}),o=c-h+e.margin.axis+e.margin.item}else o=e.margin.axis+e.margin.item}null!=s&&(o=Math.min(o,s)),t+=n(this,"height",o),t+=n(this,"top",r.offsetTop),t+=n(this,"left",r.offsetLeft),t+=n(this,"width",r.offsetWidth)}else t+=1;return t>0},l.prototype.setData=function(t){var e,n,i=this,o=this.data;o&&(w.forEach(this.listeners,function(t,e){o.unsubscribe(e,t)}),e=o.get({fields:["id"]}),n=[],w.forEach(e,function(t,e){n[e]=t.id}),this._onRemove(n)),t instanceof r?this.data=t:(this.data=new r({fieldTypes:{start:"Date",end:"Date"}}),this.data.add(t));var s=this.id;w.forEach(this.listeners,function(t,e){i.data.subscribe(e,t,s)}),e=this.data.get({fields:["id"]}),n=[],w.forEach(e,function(t,e){n[e]=t.id}),this._onAdd(n)},l.prototype.getDataRange=function(){var t=this.data,e=t.min("start");e=e?e.start.valueOf():null;var n=t.max("start"),i=t.max("end");n=n?n.start.valueOf():null,i=i?i.end.valueOf():null;var r=Math.max(n,i);return{min:new Date(e),max:new Date(r)}},l.prototype._onUpdate=function(t){this._toQueue(t,"update")},l.prototype._onAdd=function(t){this._toQueue(t,"add")},l.prototype._onRemove=function(t){this._toQueue(t,"remove")},l.prototype._toQueue=function(t,e){var n=this.items,i=this.queue;t.forEach(function(t){var r=i[t];r?r.action=e:i[t]={item:n[t]||null,action:e}}),this.controller&&this.requestRepaint()},l.prototype._updateConversion=function(){var t=this.range;if(!t)throw Error("No range configured");this.conversion=t.conversion?t.conversion(this.width):s.conversion(t.start,t.end,this.width)},l.prototype.toTime=function(t){var e=this.conversion;return new Date(t/e.factor+e.offset)},l.prototype.toScreen=function(t){var e=this.conversion;return(t.valueOf()-e.offset)*e.factor},f.prototype.select=function(){this.selected=!0},f.prototype.unselect=function(){this.selected=!1},f.prototype.show=function(){return!1},f.prototype.hide=function(){return!1},f.prototype.repaint=function(){return!1},f.prototype.reflow=function(){return!1},m.prototype=new f(null,null),m.prototype.select=function(){this.selected=!0},m.prototype.unselect=function(){this.selected=!1},m.prototype.repaint=function(){var t=!1,e=this.dom;if(e||(this._create(),e=this.dom,t=!0),e){if(!this.options&&!this.parent)throw Error("Cannot repaint item: no parent attached");var n=this.parent.getForeground();if(!n)throw Error("Cannot repaint time axis: parent has no foreground container element");var i=this.parent.getBackground();if(!i)throw Error("Cannot repaint time axis: parent has no background container element");var r=this.parent.getAxis();if(!i)throw Error("Cannot repaint time axis: parent has no axis container element");if(e.box.parentNode||(n.appendChild(e.box),t=!0),e.line.parentNode||(i.appendChild(e.line),t=!0),e.dot.parentNode||(r.appendChild(e.dot),t=!0),this.data.content!=this.content){if(this.content=this.data.content,this.content instanceof Element)e.content.innerHTML="",e.content.appendChild(this.content);else{if(void 0==this.data.content)throw Error('Property "content" missing in item '+this.data.id);e.content.innerHTML=this.content}t=!0}var o=(this.data.className?" "+this.data.className:"")+(this.selected?" selected":"");this.className!=o&&(this.className=o,e.box.className="item box"+o,e.line.className="item line"+o,e.dot.className="item dot"+o,t=!0)}return t},m.prototype.show=function(){return this.dom&&this.dom.box.parentNode?!1:this.repaint()},m.prototype.hide=function(){var t=!1,e=this.dom;return e&&(e.box.parentNode&&(e.box.parentNode.removeChild(e.box),t=!0),e.line.parentNode&&e.line.parentNode.removeChild(e.line),e.dot.parentNode&&e.dot.parentNode.removeChild(e.dot)),t},m.prototype.reflow=function(){var t,e,n,i,r,o,s,a,h,c,p,u=0;if(void 0==this.data.start)throw Error('Property "start" missing in item '+this.data.id);if(c=this.data,p=this.parent&&this.parent.range,this.visible=c&&p?c.start>p.start&&c.start0},m.prototype._create=function(){var t=this.dom;t||(this.dom=t={},t.box=document.createElement("DIV"),t.content=document.createElement("DIV"),t.content.className="content",t.box.appendChild(t.content),t.line=document.createElement("DIV"),t.line.className="line",t.dot=document.createElement("DIV"),t.dot.className="dot")},m.prototype.reposition=function(){var t=this.dom,e=this.props,n=this.options.orientation;if(t){var i=t.box,r=t.line,o=t.dot;i.style.left=this.left+"px",i.style.top=this.top+"px",r.style.left=e.line.left+"px","top"==n?(r.style.top="0px",r.style.height=this.top+"px"):(r.style.top=e.line.top+"px",r.style.top=this.top+this.height+"px",r.style.height=Math.max(e.dot.top-this.top-this.height,0)+"px"),o.style.left=e.dot.left+"px",o.style.top=e.dot.top+"px"}},g.prototype=new f(null,null),g.prototype.select=function(){this.selected=!0},g.prototype.unselect=function(){this.selected=!1},g.prototype.repaint=function(){var t=!1,e=this.dom;if(e||(this._create(),e=this.dom,t=!0),e){if(!this.options&&!this.options.parent)throw Error("Cannot repaint item: no parent attached");var n=this.parent.getForeground();if(!n)throw Error("Cannot repaint time axis: parent has no foreground container element");if(e.point.parentNode||(n.appendChild(e.point),n.appendChild(e.point),t=!0),this.data.content!=this.content){if(this.content=this.data.content,this.content instanceof Element)e.content.innerHTML="",e.content.appendChild(this.content);else{if(void 0==this.data.content)throw Error('Property "content" missing in item '+this.data.id);e.content.innerHTML=this.content}t=!0}var i=(this.data.className?" "+this.data.className:"")+(this.selected?" selected":"");this.className!=i&&(this.className=i,e.point.className="item point"+i,t=!0)}return t},g.prototype.show=function(){return this.dom&&this.dom.point.parentNode?!1:this.repaint()},g.prototype.hide=function(){var t=!1,e=this.dom;return e&&e.point.parentNode&&(e.point.parentNode.removeChild(e.point),t=!0),t},g.prototype.reflow=function(){var t,e,n,i,r,o,s,a,h,c=0;if(void 0==this.data.start)throw Error('Property "start" missing in item '+this.data.id);if(a=this.data,h=this.parent&&this.parent.range,this.visible=a&&h?a.start>h.start&&a.start0},g.prototype._create=function(){var t=this.dom;t||(this.dom=t={},t.point=document.createElement("div"),t.content=document.createElement("div"),t.content.className="content",t.point.appendChild(t.content),t.dot=document.createElement("div"),t.dot.className="dot",t.point.appendChild(t.dot))},g.prototype.reposition=function(){var t=this.dom,e=this.props;t&&(t.point.style.top=this.top+"px",t.point.style.left=this.left+"px",t.content.style.marginLeft=e.content.marginLeft+"px",t.dot.style.top=e.dot.top+"px")},v.prototype=new f(null,null),v.prototype.select=function(){this.selected=!0},v.prototype.unselect=function(){this.selected=!1},v.prototype.repaint=function(){var t=!1,e=this.dom;if(e||(this._create(),e=this.dom,t=!0),e){if(!this.options&&!this.options.parent)throw Error("Cannot repaint item: no parent attached");var n=this.parent.getForeground();if(!n)throw Error("Cannot repaint time axis: parent has no foreground container element");if(e.box.parentNode||(n.appendChild(e.box),t=!0),this.data.content!=this.content){if(this.content=this.data.content,this.content instanceof Element)e.content.innerHTML="",e.content.appendChild(this.content);else{if(void 0==this.data.content)throw Error('Property "content" missing in item '+this.data.id);e.content.innerHTML=this.content}t=!0}var i=this.data.className?""+this.data.className:"";this.className!=i&&(this.className=i,e.box.className="item range"+i,t=!0)}return t},v.prototype.show=function(){return this.dom&&this.dom.box.parentNode?!1:this.repaint()},v.prototype.hide=function(){var t=!1,e=this.dom;return e&&e.box.parentNode&&(e.box.parentNode.removeChild(e.box),t=!0),t},v.prototype.reflow=function(){var t,e,n,i,r,o,s,a,h,c,p,u,d,l,f=0;if(void 0==this.data.start)throw Error('Property "start" missing in item '+this.data.id);if(void 0==this.data.end)throw Error('Property "end" missing in item '+this.data.id);return s=this.data,a=this.parent&&this.parent.range,this.visible=s&&a?s.starta.start:!1,this.visible&&(t=this.dom,t?(e=this.props,n=this.options,i=this.parent,r=i.toScreen(this.data.start),o=i.toScreen(this.data.end),h=w.updateProperty,c=t.box,p=i.width,d=n.orientation,f+=h(e.content,"width",t.content.offsetWidth),f+=h(this,"height",c.offsetHeight),-p>r&&(r=-p),o>2*p&&(o=2*p),u=0>r?Math.min(-r,o-r-e.content.width-2*n.padding):0,f+=h(e.content,"left",u),"top"==d?(l=n.margin.axis,f+=h(this,"top",l)):(l=i.height-this.height-n.margin.axis,f+=h(this,"top",l)),f+=h(this,"left",r),f+=h(this,"width",Math.max(o-r,1))):f+=1),f>0},v.prototype._create=function(){var t=this.dom;t||(this.dom=t={},t.box=document.createElement("div"),t.content=document.createElement("div"),t.content.className="content",t.box.appendChild(t.content))},v.prototype.reposition=function(){var t=this.dom,e=this.props;t&&(t.box.style.top=this.top+"px",t.box.style.left=this.left+"px",t.box.style.width=this.width+"px",t.content.style.left=e.content.left+"px")},y.prototype.setOptions=function(t){w.extend(this.options,t),this.timeaxis.setOptions(this.options),this.range.setOptions(this.options);var e,n,i,r,o=this;if(e="top"==this.options.orientation?function(){return o.timeaxis.height}:function(){return o.main.height-o.timeaxis.height-o.itemset.height},t.height?(i=t.height,n=function(){return o.main.height-o.timeaxis.height}):(i=function(){return o.timeaxis.height+o.itemset.height},n=null),this.options.maxHeight){if(!w.isNumber(this.options.maxHeight))throw new TypeError("Number expected for property maxHeight");r=function(){return o.options.maxHeight-o.timeaxis.height}}this.main.setOptions({height:i}),this.itemset.setOptions({orientation:this.options.orientation,top:e,height:n,maxHeight:r}),this.controller.repaint()},y.prototype.setData=function(t){var e=this.itemset.data;if(e)this.itemset.setData(t);else if(this.itemset.setData(t),void 0==this.options.start||void 0==this.options.end){var n=this.itemset.getDataRange(),i=n.min,r=n.max;if(null!=i&&null!=r){var o=r.valueOf()-i.valueOf();i=new Date(i.valueOf()-.05*o),r=new Date(r.valueOf()+.05*o)}void 0!=this.options.start&&(i=new Date(this.options.start.valueOf())),void 0!=this.options.end&&(r=new Date(this.options.end.valueOf())),(null!=i||null!=r)&&this.range.setRange(i,r)}};var M={util:w,events:E,Controller:h,DataSet:r,Range:s,Stack:o,TimeStep:TimeStep,EventBus:a,components:{items:{Item:f,ItemBox:m,ItemPoint:g,ItemRange:v},Component:c,Panel:p,RootPanel:u,ItemSet:l,TimeAxis:d},Timeline:y};i!==void 0&&(i=M),n!==void 0&&n.exports!==void 0&&(n.exports=M),"function"==typeof t&&t(function(){return M}),"undefined"!=typeof window&&(window.vis=M),w.loadCss("/* vis.js stylesheet */\n\n.graph {\n position: relative;\n border: 1px solid #bfbfbf;\n}\n\n.graph .panel {\n position: absolute;\n}\n\n.graph .itemset {\n position: absolute;\n padding: 0;\n margin: 0;\n overflow: hidden;\n}\n\n.graph .background {\n}\n\n.graph .foreground {\n}\n\n.graph .itemset-axis {\n position: absolute;\n}\n\n.graph .item {\n position: absolute;\n color: #1A1A1A;\n border-color: #97B0F8;\n background-color: #D5DDF6;\n display: inline-block;\n}\n\n.graph .item.selected {\n border-color: #FFC200;\n background-color: #FFF785;\n z-index: 999;\n}\n\n.graph .item.cluster {\n /* TODO: use another color or pattern? */\n background: #97B0F8 url('img/cluster_bg.png');\n color: white;\n}\n.graph .item.cluster.point {\n border-color: #D5DDF6;\n}\n\n.graph .item.box {\n text-align: center;\n border-style: solid;\n border-width: 1px;\n border-radius: 5px;\n -moz-border-radius: 5px; /* For Firefox 3.6 and older */\n}\n\n.graph .item.point {\n background: none;\n}\n\n.graph .dot {\n border: 5px solid #97B0F8;\n position: absolute;\n border-radius: 5px;\n -moz-border-radius: 5px; /* For Firefox 3.6 and older */\n}\n\n.graph .item.range {\n overflow: hidden;\n border-style: solid;\n border-width: 1px;\n border-radius: 2px;\n -moz-border-radius: 2px; /* For Firefox 3.6 and older */\n}\n\n.graph .item.range .drag-left {\n cursor: w-resize;\n z-index: 1000;\n}\n\n.graph .item.range .drag-right {\n cursor: e-resize;\n z-index: 1000;\n}\n\n.graph .item.range .content {\n position: relative;\n display: inline-block;\n}\n\n.graph .item.line {\n position: absolute;\n width: 0;\n border-left-width: 1px;\n border-left-style: solid;\n}\n\n.graph .item .content {\n margin: 5px;\n white-space: nowrap;\n overflow: hidden;\n}\n\n/* TODO: better css name, 'graph' is way to generic */\n\n.graph {\n overflow: hidden;\n}\n\n.graph .axis {\n position: relative;\n}\n\n.graph .axis .text {\n position: absolute;\n color: #4d4d4d;\n padding: 3px;\n white-space: nowrap;\n}\n\n.graph .axis .text.measure {\n position: absolute;\n padding-left: 0;\n padding-right: 0;\n margin-left: 0;\n margin-right: 0;\n visibility: hidden;\n}\n\n.graph .axis .grid.vertical {\n position: absolute;\n width: 0;\n border-right: 1px solid;\n}\n\n.graph .axis .grid.horizontal {\n position: absolute;\n left: 0;\n width: 100%;\n height: 0;\n border-bottom: 1px solid;\n}\n\n.graph .axis .grid.minor {\n border-color: #e5e5e5;\n}\n\n.graph .axis .grid.major {\n border-color: #bfbfbf;\n}\n\n")},{moment:2}],2:[function(e,n){(function(){(function(i){function r(t,e){return function(n){return u(t.call(this,n),e)}}function o(t){return function(e){return this.lang().ordinal(t.call(this,e))}}function s(){}function a(t){c(this,t)}function h(t){var e=this._data={},n=t.years||t.year||t.y||0,i=t.months||t.month||t.M||0,r=t.weeks||t.week||t.w||0,o=t.days||t.day||t.d||0,s=t.hours||t.hour||t.h||0,a=t.minutes||t.minute||t.m||0,h=t.seconds||t.second||t.s||0,c=t.milliseconds||t.millisecond||t.ms||0;this._milliseconds=c+1e3*h+6e4*a+36e5*s,this._days=o+7*r,this._months=i+12*n,e.milliseconds=c%1e3,h+=p(c/1e3),e.seconds=h%60,a+=p(h/60),e.minutes=a%60,s+=p(a/60),e.hours=s%24,o+=p(s/24),o+=7*r,e.days=o%30,i+=p(o/30),e.months=i%12,n+=p(i/12),e.years=n}function c(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function p(t){return 0>t?Math.ceil(t):Math.floor(t)}function u(t,e){for(var n=t+"";e>n.length;)n="0"+n;return n}function d(t,e,n){var i,r=e._milliseconds,o=e._days,s=e._months;r&&t._d.setTime(+t+r*n),o&&t.date(t.date()+o*n),s&&(i=t.date(),t.date(1).month(t.month()+s*n).date(Math.min(i,t.daysInMonth())))}function l(t){return"[object Array]"===Object.prototype.toString.call(t)}function f(t,e){var n,i=Math.min(t.length,e.length),r=Math.abs(t.length-e.length),o=0;for(n=0;i>n;n++)~~t[n]!==~~e[n]&&o++;return o+r}function m(t,e){return e.abbr=t,R[t]||(R[t]=new s),R[t].set(e),R[t]}function g(t){return t?(!R[t]&&U&&e("./lang/"+t),R[t]):k.fn._lang}function v(t){return t.match(/\[.*\]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function y(t){var e,n,i=t.match(P);for(e=0,n=i.length;n>e;e++)i[e]=ae[i[e]]?ae[i[e]]:v(i[e]);return function(r){var o="";for(e=0;n>e;e++)o+="function"==typeof i[e].call?i[e].call(r,t):i[e];return o}}function S(t,e){function n(e){return t.lang().longDateFormat(e)||e}for(var i=5;i--&&z.test(e);)e=e.replace(z,n);return re[e]||(re[e]=y(e)),re[e](t)}function w(t){switch(t){case"DDDD":return V;case"YYYY":return B;case"YYYYY":return Z;case"S":case"SS":case"SSS":case"DDD":return q;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":case"a":case"A":return X;case"X":return $;case"Z":case"ZZ":return K;case"T":return J;case"MM":case"DD":case"YY":case"HH":case"hh":case"mm":case"ss":case"M":case"D":case"d":case"H":case"h":case"m":case"s":return W;default:return RegExp(t.replace("\\",""))}}function b(t,e,n){var i,r=n._a;switch(t){case"M":case"MM":r[1]=null==e?0:~~e-1; -break;case"MMM":case"MMMM":i=g(n._l).monthsParse(e),null!=i?r[1]=i:n._isValid=!1;break;case"D":case"DD":case"DDD":case"DDDD":null!=e&&(r[2]=~~e);break;case"YY":r[0]=~~e+(~~e>68?1900:2e3);break;case"YYYY":case"YYYYY":r[0]=~~e;break;case"a":case"A":n._isPm="pm"===(e+"").toLowerCase();break;case"H":case"HH":case"h":case"hh":r[3]=~~e;break;case"m":case"mm":r[4]=~~e;break;case"s":case"ss":r[5]=~~e;break;case"S":case"SS":case"SSS":r[6]=~~(1e3*("0."+e));break;case"X":n._d=new Date(1e3*parseFloat(e));break;case"Z":case"ZZ":n._useUTC=!0,i=(e+"").match(ee),i&&i[1]&&(n._tzh=~~i[1]),i&&i[2]&&(n._tzm=~~i[2]),i&&"+"===i[0]&&(n._tzh=-n._tzh,n._tzm=-n._tzm)}null==e&&(n._isValid=!1)}function T(t){var e,n,i=[];if(!t._d){for(e=0;7>e;e++)t._a[e]=i[e]=null==t._a[e]?2===e?1:0:t._a[e];i[3]+=t._tzh||0,i[4]+=t._tzm||0,n=new Date(0),t._useUTC?(n.setUTCFullYear(i[0],i[1],i[2]),n.setUTCHours(i[3],i[4],i[5],i[6])):(n.setFullYear(i[0],i[1],i[2]),n.setHours(i[3],i[4],i[5],i[6])),t._d=n}}function E(t){var e,n,i=t._f.match(P),r=t._i;for(t._a=[],e=0;i.length>e;e++)n=(w(i[e]).exec(r)||[])[0],n&&(r=r.slice(r.indexOf(n)+n.length)),ae[i[e]]&&b(i[e],n,t);t._isPm&&12>t._a[3]&&(t._a[3]+=12),t._isPm===!1&&12===t._a[3]&&(t._a[3]=0),T(t)}function M(t){for(var e,n,i,r,o=99;t._f.length;){if(e=c({},t),e._f=t._f.pop(),E(e),n=new a(e),n.isValid()){i=n;break}r=f(e._a,n.toArray()),o>r&&(o=r,i=n)}c(t,i)}function _(t){var e,n=t._i;if(Q.exec(n)){for(t._f="YYYY-MM-DDT",e=0;4>e;e++)if(te[e][1].exec(n)){t._f+=te[e][0];break}K.exec(n)&&(t._f+=" Z"),E(t)}else t._d=new Date(n)}function D(t){var e=t._i,n=F.exec(e);e===i?t._d=new Date:n?t._d=new Date(+n[1]):"string"==typeof e?_(t):l(e)?(t._a=e.slice(0),T(t)):t._d=e instanceof Date?new Date(+e):new Date(e)}function L(t,e,n,i,r){return r.relativeTime(e||1,!!n,t,i)}function C(t,e,n){var i=j(Math.abs(t)/1e3),r=j(i/60),o=j(r/60),s=j(o/24),a=j(s/365),h=45>i&&["s",i]||1===r&&["m"]||45>r&&["mm",r]||1===o&&["h"]||22>o&&["hh",o]||1===s&&["d"]||25>=s&&["dd",s]||45>=s&&["M"]||345>s&&["MM",j(s/30)]||1===a&&["y"]||["yy",a];return h[2]=e,h[3]=t>0,h[4]=n,L.apply({},h)}function x(t,e,n){var i=n-e,r=n-t.day();return r>i&&(r-=7),i-7>r&&(r+=7),Math.ceil(k(t).add("d",r).dayOfYear()/7)}function A(t){var e=t._i,n=t._f;return null===e||""===e?null:("string"==typeof e&&(t._i=e=g().preparse(e)),k.isMoment(e)?(t=c({},e),t._d=new Date(+e._d)):n?l(n)?M(t):E(t):D(t),new a(t))}function O(t,e){k.fn[t]=k.fn[t+"s"]=function(t){var n=this._isUTC?"UTC":"";return null!=t?(this._d["set"+n+e](t),this):this._d["get"+n+e]()}}function N(t){k.duration.fn[t]=function(){return this._data[t]}}function Y(t,e){k.duration.fn["as"+t]=function(){return+this/e}}for(var k,H,I="2.0.0",j=Math.round,R={},U=n!==i&&n.exports,F=/^\/?Date\((\-?\d+)/i,P=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYY|YYYY|YY|a|A|hh?|HH?|mm?|ss?|SS?S?|X|zz?|ZZ?|.)/g,z=/(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,W=/\d\d?/,q=/\d{1,3}/,V=/\d{3}/,B=/\d{1,4}/,Z=/[+\-]?\d{1,6}/,X=/[0-9]*[a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF]+\s*?[\u0600-\u06FF]+/i,K=/Z|[\+\-]\d\d:?\d\d/i,J=/T/i,$=/[\+\-]?\d+(\.\d{1,3})?/,Q=/^\s*\d{4}-\d\d-\d\d((T| )(\d\d(:\d\d(:\d\d(\.\d\d?\d?)?)?)?)?([\+\-]\d\d:?\d\d)?)?/,G="YYYY-MM-DDTHH:mm:ssZ",te=[["HH:mm:ss.S",/(T| )\d\d:\d\d:\d\d\.\d{1,3}/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],ee=/([\+\-]|\d\d)/gi,ne="Month|Date|Hours|Minutes|Seconds|Milliseconds".split("|"),ie={Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6},re={},oe="DDD w W M D d".split(" "),se="M D H h m s w W".split(" "),ae={M:function(){return this.month()+1},MMM:function(t){return this.lang().monthsShort(this,t)},MMMM:function(t){return this.lang().months(this,t)},D:function(){return this.date()},DDD:function(){return this.dayOfYear()},d:function(){return this.day()},dd:function(t){return this.lang().weekdaysMin(this,t)},ddd:function(t){return this.lang().weekdaysShort(this,t)},dddd:function(t){return this.lang().weekdays(this,t)},w:function(){return this.week()},W:function(){return this.isoWeek()},YY:function(){return u(this.year()%100,2)},YYYY:function(){return u(this.year(),4)},YYYYY:function(){return u(this.year(),5)},a:function(){return this.lang().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.lang().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return~~(this.milliseconds()/100)},SS:function(){return u(~~(this.milliseconds()/10),2)},SSS:function(){return u(this.milliseconds(),3)},Z:function(){var t=-this.zone(),e="+";return 0>t&&(t=-t,e="-"),e+u(~~(t/60),2)+":"+u(~~t%60,2)},ZZ:function(){var t=-this.zone(),e="+";return 0>t&&(t=-t,e="-"),e+u(~~(10*t/6),4)},X:function(){return this.unix()}};oe.length;)H=oe.pop(),ae[H+"o"]=o(ae[H]);for(;se.length;)H=se.pop(),ae[H+H]=r(ae[H],2);for(ae.DDDD=r(ae.DDD,3),s.prototype={set:function(t){var e,n;for(n in t)e=t[n],"function"==typeof e?this[n]=e:this["_"+n]=e},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(t){return this._months[t.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(t){return this._monthsShort[t.month()]},monthsParse:function(t){var e,n,i;for(this._monthsParse||(this._monthsParse=[]),e=0;12>e;e++)if(this._monthsParse[e]||(n=k([2e3,e]),i="^"+this.months(n,"")+"|^"+this.monthsShort(n,""),this._monthsParse[e]=RegExp(i.replace(".",""),"i")),this._monthsParse[e].test(t))return e},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(t){return this._weekdays[t.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(t){return this._weekdaysShort[t.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(t){return this._weekdaysMin[t.day()]},_longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY LT",LLLL:"dddd, MMMM D YYYY LT"},longDateFormat:function(t){var e=this._longDateFormat[t];return!e&&this._longDateFormat[t.toUpperCase()]&&(e=this._longDateFormat[t.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(t){return t.slice(1)}),this._longDateFormat[t]=e),e},meridiem:function(t,e,n){return t>11?n?"pm":"PM":n?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[last] dddd [at] LT",sameElse:"L"},calendar:function(t,e){var n=this._calendar[t];return"function"==typeof n?n.apply(e):n},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(t,e,n,i){var r=this._relativeTime[n];return"function"==typeof r?r(t,e,n,i):r.replace(/%d/i,t)},pastFuture:function(t,e){var n=this._relativeTime[t>0?"future":"past"];return"function"==typeof n?n(e):n.replace(/%s/i,e)},ordinal:function(t){return this._ordinal.replace("%d",t)},_ordinal:"%d",preparse:function(t){return t},postformat:function(t){return t},week:function(t){return x(t,this._week.dow,this._week.doy)},_week:{dow:0,doy:6}},k=function(t,e,n){return A({_i:t,_f:e,_l:n,_isUTC:!1})},k.utc=function(t,e,n){return A({_useUTC:!0,_isUTC:!0,_l:n,_i:t,_f:e})},k.unix=function(t){return k(1e3*t)},k.duration=function(t,e){var n,i=k.isDuration(t),r="number"==typeof t,o=i?t._data:r?{}:t;return r&&(e?o[e]=t:o.milliseconds=t),n=new h(o),i&&t.hasOwnProperty("_lang")&&(n._lang=t._lang),n},k.version=I,k.defaultFormat=G,k.lang=function(t,e){return t?(e?m(t,e):R[t]||g(t),k.duration.fn._lang=k.fn._lang=g(t),i):k.fn._lang._abbr},k.langData=function(t){return t&&t._lang&&t._lang._abbr&&(t=t._lang._abbr),g(t)},k.isMoment=function(t){return t instanceof a},k.isDuration=function(t){return t instanceof h},k.fn=a.prototype={clone:function(){return k(this)},valueOf:function(){return+this._d},unix:function(){return Math.floor(+this._d/1e3)},toString:function(){return this.format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._d},toJSON:function(){return k.utc(this).format("YYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},toArray:function(){var t=this;return[t.year(),t.month(),t.date(),t.hours(),t.minutes(),t.seconds(),t.milliseconds()]},isValid:function(){return null==this._isValid&&(this._isValid=this._a?!f(this._a,(this._isUTC?k.utc(this._a):k(this._a)).toArray()):!isNaN(this._d.getTime())),!!this._isValid},utc:function(){return this._isUTC=!0,this},local:function(){return this._isUTC=!1,this},format:function(t){var e=S(this,t||k.defaultFormat);return this.lang().postformat(e)},add:function(t,e){var n;return n="string"==typeof t?k.duration(+e,t):k.duration(t,e),d(this,n,1),this},subtract:function(t,e){var n;return n="string"==typeof t?k.duration(+e,t):k.duration(t,e),d(this,n,-1),this},diff:function(t,e,n){var i,r,o=this._isUTC?k(t).utc():k(t).local(),s=6e4*(this.zone()-o.zone());return e&&(e=e.replace(/s$/,"")),"year"===e||"month"===e?(i=432e5*(this.daysInMonth()+o.daysInMonth()),r=12*(this.year()-o.year())+(this.month()-o.month()),r+=(this-k(this).startOf("month")-(o-k(o).startOf("month")))/i,"year"===e&&(r/=12)):(i=this-o-s,r="second"===e?i/1e3:"minute"===e?i/6e4:"hour"===e?i/36e5:"day"===e?i/864e5:"week"===e?i/6048e5:i),n?r:p(r)},from:function(t,e){return k.duration(this.diff(t)).lang(this.lang()._abbr).humanize(!e)},fromNow:function(t){return this.from(k(),t)},calendar:function(){var t=this.diff(k().startOf("day"),"days",!0),e=-6>t?"sameElse":-1>t?"lastWeek":0>t?"lastDay":1>t?"sameDay":2>t?"nextDay":7>t?"nextWeek":"sameElse";return this.format(this.lang().calendar(e,this))},isLeapYear:function(){var t=this.year();return 0===t%4&&0!==t%100||0===t%400},isDST:function(){return this.zone()+k(t).startOf(e)},isBefore:function(t,e){return e=e!==i?e:"millisecond",+this.clone().startOf(e)<+k(t).startOf(e)},isSame:function(t,e){return e=e!==i?e:"millisecond",+this.clone().startOf(e)===+k(t).startOf(e)},zone:function(){return this._isUTC?0:this._d.getTimezoneOffset()},daysInMonth:function(){return k.utc([this.year(),this.month()+1,0]).date()},dayOfYear:function(t){var e=j((k(this).startOf("day")-k(this).startOf("year"))/864e5)+1;return null==t?e:this.add("d",t-e)},isoWeek:function(t){var e=x(this,1,4);return null==t?e:this.add("d",7*(t-e))},week:function(t){var e=this.lang().week(this);return null==t?e:this.add("d",7*(t-e))},lang:function(t){return t===i?this._lang:(this._lang=g(t),this)}},H=0;ne.length>H;H++)O(ne[H].toLowerCase().replace(/s$/,""),ne[H]);O("year","FullYear"),k.fn.days=k.fn.day,k.fn.weeks=k.fn.week,k.fn.isoWeeks=k.fn.isoWeek,k.duration.fn=h.prototype={weeks:function(){return p(this.days()/7)},valueOf:function(){return this._milliseconds+864e5*this._days+2592e6*this._months},humanize:function(t){var e=+this,n=C(e,!t,this.lang());return t&&(n=this.lang().pastFuture(e,n)),this.lang().postformat(n)},lang:k.fn.lang};for(H in ie)ie.hasOwnProperty(H)&&(Y(H,ie[H]),N(H.toLowerCase()));Y("Weeks",6048e5),k.lang("en",{ordinal:function(t){var e=t%10,n=1===~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th";return t+n}}),U&&(n.exports=k),"undefined"==typeof ender&&(this.moment=k),"function"==typeof t&&t.amd&&t("moment",[],function(){return k})}).call(this)})()},{}]},{},[1])(1)}); \ No newline at end of file +(function(t){if("function"==typeof bootstrap)bootstrap("vis",t);else if("object"==typeof exports)module.exports=t();else if("function"==typeof define&&define.amd)define(t);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeVis=t}else"undefined"!=typeof window?window.vis=t():global.vis=t()})(function(){var t;return function(t,e,n){function i(n,r){if(!e[n]){if(!t[n]){var s="function"==typeof require&&require;if(!r&&s)return s(n,!0);if(o)return o(n,!0);throw Error("Cannot find module '"+n+"'")}var a=e[n]={exports:{}};t[n][0].call(a.exports,function(e){var o=t[n][1][e];return i(o?o:e)},a,a.exports)}return e[n].exports}for(var o="function"==typeof require&&require,r=0;n.length>r;r++)i(n[r]);return i}({1:[function(e,n,i){function o(t){var e=this;this.options=t||{},this.data={},this.fieldId=this.options.fieldId||"id",this.fieldTypes={},this.options.fieldTypes&&b.forEach(this.options.fieldTypes,function(t,n){e.fieldTypes[n]="Date"==t||"ISODate"==t||"ASPDate"==t?"Date":t}),this.subscribers={},this.internalIds={}}function r(t,e){this.parent=t,this.options={order:function(t,e){if(t instanceof v){if(e instanceof v){var n=t.data.end-t.data.start,i=e.data.end-e.data.start;return n-i||t.data.start-e.data.start}return-1}return e instanceof v?1:t.data.start-e.data.start}},this.ordered=[],this.setOptions(e)}function s(t){this.id=b.randomUUID(),this.start=0,this.end=0,this.options={min:null,max:null,zoomMin:null,zoomMax:null},this.setOptions(t),this.listeners=[]}function a(){this.subscriptions=[]}function h(){this.id=b.randomUUID(),this.components={},this.repaintTimer=void 0,this.reflowTimer=void 0}function p(){this.id=null,this.parent=null,this.depends=null,this.controller=null,this.options=null,this.frame=null,this.top=0,this.left=0,this.width=0,this.height=0}function c(t,e,n){this.id=b.randomUUID(),this.parent=t,this.depends=e,this.options={},this.setOptions(n)}function u(t,e){this.id=b.randomUUID(),this.container=t,this.options={autoResize:!0},this.listeners={},this.setOptions(e)}function d(t,e,n){this.id=b.randomUUID(),this.parent=t,this.depends=e,this.dom={majorLines:[],majorTexts:[],minorLines:[],minorTexts:[],redundant:{majorLines:[],majorTexts:[],minorLines:[],minorTexts:[]}},this.props={range:{start:0,end:0,minimumStep:0},lineTop:0},this.options={orientation:"bottom",showMinorLabels:!0,showMajorLabels:!0},this.conversion=null,this.range=null,this.setOptions(n)}function l(t,e,n){this.id=b.randomUUID(),this.parent=t,this.depends=e,this.options={style:"box",align:"center",orientation:"bottom",margin:{axis:20,item:10},padding:5},this.dom={};var i=this;this.items=null,this.range=null,this.listeners={add:function(t,e){i._onAdd(e.items)},update:function(t,e){i._onUpdate(e.items)},remove:function(t,e){i._onRemove(e.items)}},this.contents={},this.queue={},this.stack=new r(this),this.conversion=null,n&&this.setOptions(n)}function f(t,e,n){this.parent=t,this.data=e,this.dom=null,this.options=n,this.selected=!1,this.visible=!1,this.top=0,this.left=0,this.width=0,this.height=0}function m(t,e,n){this.props={dot:{left:0,top:0,width:0,height:0},line:{top:0,left:0,width:0,height:0}},f.call(this,t,e,n)}function g(t,e,n){this.props={dot:{top:0,width:0,height:0},content:{height:0,marginLeft:0}},f.call(this,t,e,n)}function v(t,e,n){this.props={content:{left:0,width:0}},f.call(this,t,e,n)}function y(t,e,n){this.id=b.randomUUID(),this.parent=t,this.depends=e,this.options={},this.range=null,this.items=null,this.groups=null,this.contents={},this.queue={};var i=this;this.listeners={add:function(t,e){i._onAdd(e.items)},update:function(t,e){i._onUpdate(e.items)},remove:function(t,e){i._onRemove(e.items)}},n&&this.setOptions(n)}function S(t,e,n){var i=this;if(this.options={orientation:"bottom",zoomMin:10,zoomMax:31536e10,moveable:!0,zoomable:!0},this.controller=new h,!t)throw Error("No container element provided");this.main=new u(t,{autoResize:!1}),this.controller.add(this.main);var o=w().hours(0).minutes(0).seconds(0).milliseconds(0);this.range=new s({start:o.clone().add("days",-3).valueOf(),end:o.clone().add("days",4).valueOf()}),this.range.subscribe(this.main,"move","horizontal"),this.range.subscribe(this.main,"zoom","horizontal"),this.range.on("rangechange",function(){var t=!0;i.controller.requestReflow(t)}),this.range.on("rangechanged",function(){var t=!0;i.controller.requestReflow(t)}),this.timeaxis=new d(this.main,[],{orientation:this.options.orientation,range:this.range}),this.timeaxis.setRange(this.range),this.controller.add(this.timeaxis),this.setGroups(null),this.items=null,this.groups=null,n&&this.setOptions(n),e&&this.setItems(e)}var w=e("moment"),b={};b.isNumber=function(t){return t instanceof Number||"number"==typeof t},b.isString=function(t){return t instanceof String||"string"==typeof t},b.isDate=function(t){if(t instanceof Date)return!0;if(b.isString(t)){var e=E.exec(t);if(e)return!0;if(!isNaN(Date.parse(t)))return!0}return!1},b.isDataTable=function(t){return"undefined"!=typeof google&&google.visualization&&google.visualization.DataTable&&t instanceof google.visualization.DataTable},b.randomUUID=function(){var t=function(){return Math.floor(65536*Math.random()).toString(16)};return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()},b.extend=function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t},b.cast=function(t,e){var n;if(void 0===t)return void 0;if(null===t)return null;if(!e)return t;if("string"!=typeof e&&!(e instanceof String))throw Error("Type must be a string");switch(e){case"boolean":case"Boolean":return Boolean(t);case"number":case"Number":return Number(t);case"string":case"String":return t+"";case"Date":if(b.isNumber(t))return new Date(t);if(t instanceof Date)return new Date(t.valueOf());if(w.isMoment(t))return new Date(t.valueOf());if(b.isString(t))return n=E.exec(t),n?new Date(Number(n[1])):w(t).toDate();throw Error("Cannot cast object of type "+b.getType(t)+" to type Date");case"Moment":if(b.isNumber(t))return w(t);if(t instanceof Date)return w(t.valueOf());if(w.isMoment(t))return w.clone();if(b.isString(t))return n=E.exec(t),n?w(Number(n[1])):w(t);throw Error("Cannot cast object of type "+b.getType(t)+" to type Date");case"ISODate":if(t instanceof Date)return t.toISOString();if(w.isMoment(t))return t.toDate().toISOString();if(b.isNumber(t)||b.isString(t))return w(t).toDate().toISOString();throw Error("Cannot cast object of type "+b.getType(t)+" to type ISODate");case"ASPDate":if(t instanceof Date)return"/Date("+t.valueOf()+")/";if(b.isNumber(t)||b.isString(t))return"/Date("+w(t).valueOf()+")/";throw Error("Cannot cast object of type "+b.getType(t)+" to type ASPDate");default:throw Error("Cannot cast object of type "+b.getType(t)+' to type "'+e+'"')}};var E=/^\/?Date\((\-?\d+)/i;if(b.getType=function(t){var e=typeof t;return"object"==e?null==t?"null":t instanceof Boolean?"Boolean":t instanceof Number?"Number":t instanceof String?"String":t instanceof Array?"Array":t instanceof Date?"Date":"Object":"number"==e?"Number":"boolean"==e?"Boolean":"string"==e?"String":e},b.getAbsoluteLeft=function(t){for(var e=document.documentElement,n=document.body,i=t.offsetLeft,o=t.offsetParent;null!=o&&o!=n&&o!=e;)i+=o.offsetLeft,i-=o.scrollLeft,o=o.offsetParent;return i},b.getAbsoluteTop=function(t){for(var e=document.documentElement,n=document.body,i=t.offsetTop,o=t.offsetParent;null!=o&&o!=n&&o!=e;)i+=o.offsetTop,i-=o.scrollTop,o=o.offsetParent;return i},b.getPageY=function(t){if("pageY"in t)return t.pageY;var e;e="targetTouches"in t&&t.targetTouches.length?t.targetTouches[0].clientY:t.clientY;var n=document.documentElement,i=document.body;return e+(n&&n.scrollTop||i&&i.scrollTop||0)-(n&&n.clientTop||i&&i.clientTop||0)},b.getPageX=function(t){if("pageY"in t)return t.pageX;var e;e="targetTouches"in t&&t.targetTouches.length?t.targetTouches[0].clientX:t.clientX;var n=document.documentElement,i=document.body;return e+(n&&n.scrollLeft||i&&i.scrollLeft||0)-(n&&n.clientLeft||i&&i.clientLeft||0)},b.addClassName=function(t,e){var n=t.className.split(" ");-1==n.indexOf(e)&&(n.push(e),t.className=n.join(" "))},b.removeClassName=function(t,e){var n=t.className.split(" "),i=n.indexOf(e);-1!=i&&(n.splice(i,1),t.className=n.join(" "))},b.forEach=function(t,e){var n,i;if(t instanceof Array)for(n=0,i=t.length;i>n;n++)e(t[n],n,t);else for(n in t)t.hasOwnProperty(n)&&e(t[n],n,t)},b.updateProperty=function(t,e,n){return t[e]!==n?(t[e]=n,!0):!1},b.addEventListener=function(t,e,n,i){t.addEventListener?(void 0===i&&(i=!1),"mousewheel"===e&&navigator.userAgent.indexOf("Firefox")>=0&&(e="DOMMouseScroll"),t.addEventListener(e,n,i)):t.attachEvent("on"+e,n)},b.removeEventListener=function(t,e,n,i){t.removeEventListener?(void 0===i&&(i=!1),"mousewheel"===e&&navigator.userAgent.indexOf("Firefox")>=0&&(e="DOMMouseScroll"),t.removeEventListener(e,n,i)):t.detachEvent("on"+e,n)},b.getTarget=function(t){t||(t=window.event);var e;return t.target?e=t.target:t.srcElement&&(e=t.srcElement),void 0!=e.nodeType&&3==e.nodeType&&(e=e.parentNode),e},b.stopPropagation=function(t){t||(t=window.event),t.stopPropagation?t.stopPropagation():t.cancelBubble=!0},b.preventDefault=function(t){t||(t=window.event),t.preventDefault?t.preventDefault():t.returnValue=!1},b.option={},b.option.asBoolean=function(t,e){return"function"==typeof t&&(t=t()),null!=t?0!=t:e||null},b.option.asNumber=function(t,e){return"function"==typeof t&&(t=t()),null!=t?Number(t)||e||null:e||null},b.option.asString=function(t,e){return"function"==typeof t&&(t=t()),null!=t?t+"":e||null},b.option.asSize=function(t,e){return"function"==typeof t&&(t=t()),b.isString(t)?t:b.isNumber(t)?t+"px":e||null},b.option.asElement=function(t,e){return"function"==typeof t&&(t=t()),t||e||null},b.loadCss=function(t){if("undefined"!=typeof document){var e=document.createElement("style");e.type="text/css",e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t)),document.getElementsByTagName("head")[0].appendChild(e)}},!Array.prototype.indexOf){Array.prototype.indexOf=function(t){for(var e=0;this.length>e;e++)if(this[e]==t)return e;return-1};try{console.log("Warning: Ancient browser detected. Please update your browser")}catch(T){}}Array.prototype.forEach||(Array.prototype.forEach=function(t,e){for(var n=0,i=this.length;i>n;++n)t.call(e||this,this[n],n,this)}),Array.prototype.map||(Array.prototype.map=function(t,e){var n,i,o;if(null==this)throw new TypeError(" this is null or not defined");var r=Object(this),s=r.length>>>0;if("function"!=typeof t)throw new TypeError(t+" is not a function");for(e&&(n=e),i=Array(s),o=0;s>o;){var a,h;o in r&&(a=r[o],h=t.call(n,a,o,r),i[o]=h),o++}return i}),Array.prototype.filter||(Array.prototype.filter=function(t){"use strict";if(null==this)throw new TypeError;var e=Object(this),n=e.length>>>0;if("function"!=typeof t)throw new TypeError;for(var i=[],o=arguments[1],r=0;n>r;r++)if(r in e){var s=e[r];t.call(o,s,r,e)&&i.push(s)}return i}),Object.keys||(Object.keys=function(){var t=Object.prototype.hasOwnProperty,e=!{toString:null}.propertyIsEnumerable("toString"),n=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],i=n.length;return function(o){if("object"!=typeof o&&"function"!=typeof o||null===o)throw new TypeError("Object.keys called on non-object");var r=[];for(var s in o)t.call(o,s)&&r.push(s);if(e)for(var a=0;i>a;a++)t.call(o,n[a])&&r.push(n[a]);return r}}()),Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),Function.prototype.bind||(Function.prototype.bind=function(t){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var e=Array.prototype.slice.call(arguments,1),n=this,i=function(){},o=function(){return n.apply(this instanceof i&&t?this:t,e.concat(Array.prototype.slice.call(arguments)))};return i.prototype=this.prototype,o.prototype=new i,o});var M={listeners:[],indexOf:function(t){for(var e=this.listeners,n=0,i=this.listeners.length;i>n;n++){var o=e[n];if(o&&o.object==t)return n}return-1},addListener:function(t,e,n){var i=this.indexOf(t),o=this.listeners[i];o||(o={object:t,events:{}},this.listeners.push(o));var r=o.events[e];r||(r=[],o.events[e]=r),-1==r.indexOf(n)&&r.push(n)},removeListener:function(t,e,n){var i=this.indexOf(t),o=this.listeners[i];if(o){var r=o.events[e];r&&(i=r.indexOf(n),-1!=i&&r.splice(i,1),0==r.length&&delete o.events[e]);var s=0,a=o.events;for(var h in a)a.hasOwnProperty(h)&&s++;0==s&&delete this.listeners[i]}},removeAllListeners:function(){this.listeners=[]},trigger:function(t,e,n){var i=this.indexOf(t),o=this.listeners[i];if(o){var r=o.events[e];if(r)for(var s=0,a=r.length;a>s;s++)r[s](n)}}};TimeStep=function(t,e,n){this.current=new Date,this._start=new Date,this._end=new Date,this.autoScale=!0,this.scale=TimeStep.SCALE.DAY,this.step=1,this.setRange(t,e,n)},TimeStep.SCALE={MILLISECOND:1,SECOND:2,MINUTE:3,HOUR:4,DAY:5,WEEKDAY:6,MONTH:7,YEAR:8},TimeStep.prototype.setRange=function(t,e,n){t instanceof Date&&e instanceof Date&&(this._start=void 0!=t?new Date(t.valueOf()):new Date,this._end=void 0!=e?new Date(e.valueOf()):new Date,this.autoScale&&this.setMinimumStep(n))},TimeStep.prototype.first=function(){this.current=new Date(this._start.valueOf()),this.roundToMinor()},TimeStep.prototype.roundToMinor=function(){switch(this.scale){case TimeStep.SCALE.YEAR:this.current.setFullYear(this.step*Math.floor(this.current.getFullYear()/this.step)),this.current.setMonth(0);case TimeStep.SCALE.MONTH:this.current.setDate(1);case TimeStep.SCALE.DAY:case TimeStep.SCALE.WEEKDAY:this.current.setHours(0);case TimeStep.SCALE.HOUR:this.current.setMinutes(0);case TimeStep.SCALE.MINUTE:this.current.setSeconds(0);case TimeStep.SCALE.SECOND:this.current.setMilliseconds(0)}if(1!=this.step)switch(this.scale){case TimeStep.SCALE.MILLISECOND:this.current.setMilliseconds(this.current.getMilliseconds()-this.current.getMilliseconds()%this.step);break;case TimeStep.SCALE.SECOND:this.current.setSeconds(this.current.getSeconds()-this.current.getSeconds()%this.step);break;case TimeStep.SCALE.MINUTE:this.current.setMinutes(this.current.getMinutes()-this.current.getMinutes()%this.step);break;case TimeStep.SCALE.HOUR:this.current.setHours(this.current.getHours()-this.current.getHours()%this.step);break;case TimeStep.SCALE.WEEKDAY:case TimeStep.SCALE.DAY:this.current.setDate(this.current.getDate()-1-(this.current.getDate()-1)%this.step+1);break;case TimeStep.SCALE.MONTH:this.current.setMonth(this.current.getMonth()-this.current.getMonth()%this.step);break;case TimeStep.SCALE.YEAR:this.current.setFullYear(this.current.getFullYear()-this.current.getFullYear()%this.step);break;default:}},TimeStep.prototype.hasNext=function(){return this.current.valueOf()<=this._end.valueOf()},TimeStep.prototype.next=function(){var t=this.current.valueOf();if(6>this.current.getMonth())switch(this.scale){case TimeStep.SCALE.MILLISECOND:this.current=new Date(this.current.valueOf()+this.step);break;case TimeStep.SCALE.SECOND:this.current=new Date(this.current.valueOf()+1e3*this.step);break;case TimeStep.SCALE.MINUTE:this.current=new Date(this.current.valueOf()+60*1e3*this.step);break;case TimeStep.SCALE.HOUR:this.current=new Date(this.current.valueOf()+60*60*1e3*this.step);var e=this.current.getHours();this.current.setHours(e-e%this.step);break;case TimeStep.SCALE.WEEKDAY:case TimeStep.SCALE.DAY:this.current.setDate(this.current.getDate()+this.step);break;case TimeStep.SCALE.MONTH:this.current.setMonth(this.current.getMonth()+this.step);break;case TimeStep.SCALE.YEAR:this.current.setFullYear(this.current.getFullYear()+this.step);break;default:}else switch(this.scale){case TimeStep.SCALE.MILLISECOND:this.current=new Date(this.current.valueOf()+this.step);break;case TimeStep.SCALE.SECOND:this.current.setSeconds(this.current.getSeconds()+this.step);break;case TimeStep.SCALE.MINUTE:this.current.setMinutes(this.current.getMinutes()+this.step);break;case TimeStep.SCALE.HOUR:this.current.setHours(this.current.getHours()+this.step);break;case TimeStep.SCALE.WEEKDAY:case TimeStep.SCALE.DAY:this.current.setDate(this.current.getDate()+this.step);break;case TimeStep.SCALE.MONTH:this.current.setMonth(this.current.getMonth()+this.step);break;case TimeStep.SCALE.YEAR:this.current.setFullYear(this.current.getFullYear()+this.step);break;default:}if(1!=this.step)switch(this.scale){case TimeStep.SCALE.MILLISECOND:this.current.getMilliseconds()0&&(this.step=e),this.autoScale=!1},TimeStep.prototype.setAutoScale=function(t){this.autoScale=t},TimeStep.prototype.setMinimumStep=function(t){if(void 0!=t){var e=31104e6,n=2592e6,i=864e5,o=36e5,r=6e4,s=1e3,a=1;1e3*e>t&&(this.scale=TimeStep.SCALE.YEAR,this.step=1e3),500*e>t&&(this.scale=TimeStep.SCALE.YEAR,this.step=500),100*e>t&&(this.scale=TimeStep.SCALE.YEAR,this.step=100),50*e>t&&(this.scale=TimeStep.SCALE.YEAR,this.step=50),10*e>t&&(this.scale=TimeStep.SCALE.YEAR,this.step=10),5*e>t&&(this.scale=TimeStep.SCALE.YEAR,this.step=5),e>t&&(this.scale=TimeStep.SCALE.YEAR,this.step=1),3*n>t&&(this.scale=TimeStep.SCALE.MONTH,this.step=3),n>t&&(this.scale=TimeStep.SCALE.MONTH,this.step=1),5*i>t&&(this.scale=TimeStep.SCALE.DAY,this.step=5),2*i>t&&(this.scale=TimeStep.SCALE.DAY,this.step=2),i>t&&(this.scale=TimeStep.SCALE.DAY,this.step=1),i/2>t&&(this.scale=TimeStep.SCALE.WEEKDAY,this.step=1),4*o>t&&(this.scale=TimeStep.SCALE.HOUR,this.step=4),o>t&&(this.scale=TimeStep.SCALE.HOUR,this.step=1),15*r>t&&(this.scale=TimeStep.SCALE.MINUTE,this.step=15),10*r>t&&(this.scale=TimeStep.SCALE.MINUTE,this.step=10),5*r>t&&(this.scale=TimeStep.SCALE.MINUTE,this.step=5),r>t&&(this.scale=TimeStep.SCALE.MINUTE,this.step=1),15*s>t&&(this.scale=TimeStep.SCALE.SECOND,this.step=15),10*s>t&&(this.scale=TimeStep.SCALE.SECOND,this.step=10),5*s>t&&(this.scale=TimeStep.SCALE.SECOND,this.step=5),s>t&&(this.scale=TimeStep.SCALE.SECOND,this.step=1),200*a>t&&(this.scale=TimeStep.SCALE.MILLISECOND,this.step=200),100*a>t&&(this.scale=TimeStep.SCALE.MILLISECOND,this.step=100),50*a>t&&(this.scale=TimeStep.SCALE.MILLISECOND,this.step=50),10*a>t&&(this.scale=TimeStep.SCALE.MILLISECOND,this.step=10),5*a>t&&(this.scale=TimeStep.SCALE.MILLISECOND,this.step=5),a>t&&(this.scale=TimeStep.SCALE.MILLISECOND,this.step=1)}},TimeStep.prototype.snap=function(t){if(this.scale==TimeStep.SCALE.YEAR){var e=t.getFullYear()+Math.round(t.getMonth()/12);t.setFullYear(Math.round(e/this.step)*this.step),t.setMonth(0),t.setDate(0),t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0)}else if(this.scale==TimeStep.SCALE.MONTH)t.getDate()>15?(t.setDate(1),t.setMonth(t.getMonth()+1)):t.setDate(1),t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0);else if(this.scale==TimeStep.SCALE.DAY||this.scale==TimeStep.SCALE.WEEKDAY){switch(this.step){case 5:case 2:t.setHours(24*Math.round(t.getHours()/24));break;default:t.setHours(12*Math.round(t.getHours()/12))}t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0)}else if(this.scale==TimeStep.SCALE.HOUR){switch(this.step){case 4:t.setMinutes(60*Math.round(t.getMinutes()/60));break;default:t.setMinutes(30*Math.round(t.getMinutes()/30))}t.setSeconds(0),t.setMilliseconds(0)}else if(this.scale==TimeStep.SCALE.MINUTE){switch(this.step){case 15:case 10:t.setMinutes(5*Math.round(t.getMinutes()/5)),t.setSeconds(0);break;case 5:t.setSeconds(60*Math.round(t.getSeconds()/60));break;default:t.setSeconds(30*Math.round(t.getSeconds()/30))}t.setMilliseconds(0)}else if(this.scale==TimeStep.SCALE.SECOND)switch(this.step){case 15:case 10:t.setSeconds(5*Math.round(t.getSeconds()/5)),t.setMilliseconds(0);break;case 5:t.setMilliseconds(1e3*Math.round(t.getMilliseconds()/1e3));break;default:t.setMilliseconds(500*Math.round(t.getMilliseconds()/500))}else if(this.scale==TimeStep.SCALE.MILLISECOND){var n=this.step>5?this.step/2:1;t.setMilliseconds(Math.round(t.getMilliseconds()/n)*n)}},TimeStep.prototype.isMajor=function(){switch(this.scale){case TimeStep.SCALE.MILLISECOND:return 0==this.current.getMilliseconds();case TimeStep.SCALE.SECOND:return 0==this.current.getSeconds();case TimeStep.SCALE.MINUTE:return 0==this.current.getHours()&&0==this.current.getMinutes();case TimeStep.SCALE.HOUR:return 0==this.current.getHours();case TimeStep.SCALE.WEEKDAY:case TimeStep.SCALE.DAY:return 1==this.current.getDate();case TimeStep.SCALE.MONTH:return 0==this.current.getMonth();case TimeStep.SCALE.YEAR:return!1;default:return!1}},TimeStep.prototype.getLabelMinor=function(t){switch(void 0==t&&(t=this.current),this.scale){case TimeStep.SCALE.MILLISECOND:return w(t).format("SSS");case TimeStep.SCALE.SECOND:return w(t).format("s");case TimeStep.SCALE.MINUTE:return w(t).format("HH:mm");case TimeStep.SCALE.HOUR:return w(t).format("HH:mm");case TimeStep.SCALE.WEEKDAY:return w(t).format("ddd D");case TimeStep.SCALE.DAY:return w(t).format("D");case TimeStep.SCALE.MONTH:return w(t).format("MMM");case TimeStep.SCALE.YEAR:return w(t).format("YYYY");default:return""}},TimeStep.prototype.getLabelMajor=function(t){switch(void 0==t&&(t=this.current),this.scale){case TimeStep.SCALE.MILLISECOND:return w(t).format("HH:mm:ss");case TimeStep.SCALE.SECOND:return w(t).format("D MMMM HH:mm");case TimeStep.SCALE.MINUTE:case TimeStep.SCALE.HOUR:return w(t).format("ddd D MMMM");case TimeStep.SCALE.WEEKDAY:case TimeStep.SCALE.DAY:return w(t).format("MMMM YYYY");case TimeStep.SCALE.MONTH:return w(t).format("YYYY");case TimeStep.SCALE.YEAR:return"";default:return""}},o.prototype.subscribe=function(t,e,n){var i=this.subscribers[t];i||(i=[],this.subscribers[t]=i),i.push({id:n?n+"":null,callback:e})},o.prototype.unsubscribe=function(t,e){var n=this.subscribers[t];n&&(this.subscribers[t]=n.filter(function(t){return t.callback!=e}))},o.prototype._trigger=function(t,e,n){if("*"==t)throw Error("Cannot trigger event *");var i=[];t in this.subscribers&&(i=i.concat(this.subscribers[t])),"*"in this.subscribers&&(i=i.concat(this.subscribers["*"])),i.forEach(function(i){i.id!=n&&i.callback&&i.callback(t,e,n||null)})},o.prototype.add=function(t,e){var n,i=[],o=this;if(t instanceof Array)t.forEach(function(t){var e=o._addItem(t);i.push(e)});else if(b.isDataTable(t))for(var r=this._getColumnNames(t),s=0,a=t.getNumberOfRows();a>s;s++){var h={};r.forEach(function(e,n){h[e]=t.getValue(s,n)}),n=o._addItem(h),i.push(n)}else{if(!(t instanceof Object))throw Error("Unknown dataType");n=o._addItem(t),i.push(n)}this._trigger("add",{items:i},e)},o.prototype.update=function(t,e){var n,i=[],o=this;if(t instanceof Array)t.forEach(function(t){var e=o._updateItem(t);i.push(e)});else if(b.isDataTable(t))for(var r=this._getColumnNames(t),s=0,a=t.getNumberOfRows();a>s;s++){var h={};r.forEach(function(e,n){h[e]=t.getValue(s,n)}),n=o._updateItem(h),i.push(n)}else{if(!(t instanceof Object))throw Error("Unknown dataType");n=o._updateItem(t),i.push(n)}this._trigger("update",{items:i},e)},o.prototype.get=function(t,e,n){var i=this;"Object"==b.getType(t)&&(n=e,e=t,t=void 0);var o,r=this._mergeFieldTypes(e&&e.fieldTypes),s=e&&e.fields,a=e&&e.filter;if(e&&e.type){if(o="DataTable"==e.type?"DataTable":"Array",n&&o!=b.getType(n))throw Error('Type of parameter "data" ('+b.getType(n)+") "+"does not correspond with specified options.type ("+e.type+")");if("DataTable"==o&&!b.isDataTable(n))throw Error('Parameter "data" must be a DataTable when options.type is "DataTable"')}else o=n?"DataTable"==b.getType(n)?"DataTable":"Array":"Array";if("DataTable"==o){var h=this._getColumnNames(n);if(void 0==t)b.forEach(this.data,function(t){var e=i._castItem(t);(!e||a(e))&&i._appendRow(n,h,e)});else if(b.isNumber(t)||b.isString(t)){var p=i._castItem(i.data[t],r,s);this._appendRow(n,h,p)}else{if(!(t instanceof Array))throw new TypeError('Parameter "ids" must be undefined, a String, Number, or Array');t.forEach(function(t){var e=i._castItem(i.data[t],r,s);(!e||a(e))&&i._appendRow(n,h,e)})}}else if(n=n||[],void 0==t)b.forEach(this.data,function(t){var e=i._castItem(t,r,s);(!a||a(e))&&n.push(e)});else{if(b.isNumber(t)||b.isString(t))return this._castItem(i.data[t],r,s);if(!(t instanceof Array))throw new TypeError('Parameter "ids" must be undefined, a String, Number, or Array');t.forEach(function(t){var e=i._castItem(i.data[t],r,s);(!a||a(e))&&n.push(e)})}return n},o.prototype.forEach=function(t,e){var n=this._mergeFieldTypes(e&&e.fieldTypes),i=e&&e.fields,o=e&&e.filter,r=this;b.forEach(this.data,function(e,s){var a=r._castItem(e,n,i);(!o||o(a))&&t(a,s)})},o.prototype.map=function(t,e){var n=this._mergeFieldTypes(e&&e.fieldTypes),i=e&&e.fields,o=e&&e.filter,r=this,s=[];return b.forEach(this.data,function(e,a){var h=r._castItem(e,n,i);if(!o||o(h)){var p=t(h,a);s.push(p)}}),s},o.prototype._mergeFieldTypes=function(t){var e={};return this.options&&this.options.fieldTypes&&b.forEach(this.options.fieldTypes,function(t,n){e[n]=t}),t&&b.forEach(t,function(t,n){e[n]=t}),e},o.prototype.remove=function(t,e){var n=[],i=this;if(b.isNumber(t)||b.isString(t))delete this.data[t],delete this.internalIds[t],n.push(t);else if(t instanceof Array)t.forEach(function(t){i.remove(t)}),n=n.concat(t);else if(t instanceof Object)for(var o in this.data)this.data.hasOwnProperty(o)&&this.data[o]==t&&(delete this.data[o],delete this.internalIds[o],n.push(o));this._trigger("remove",{items:n},e)},o.prototype.clear=function(t){var e=Object.keys(this.data);this.data={},this.internalIds={},this._trigger("remove",{items:e},t)},o.prototype.max=function(t){var e=this.data,n=Object.keys(e),i=null,o=null;return n.forEach(function(n){var r=e[n],s=r[t];null!=s&&(!i||s>o)&&(i=r,o=s)}),i},o.prototype.min=function(t){var e=this.data,n=Object.keys(e),i=null,o=null;return n.forEach(function(n){var r=e[n],s=r[t];null!=s&&(!i||o>s)&&(i=r,o=s)}),i},o.prototype.distinct=function(t){var e=this.data,n=[],i=this.options.fieldTypes[t],o=0;for(var r in e)if(e.hasOwnProperty(r)){for(var s=e[r],a=b.cast(s[t],i),h=!1,p=0;o>p;p++)if(n[p]==a){h=!0;break}h||(n[o]=a,o++)}return n},o.prototype._addItem=function(t){var e=t[this.fieldId];void 0==e&&(e=b.randomUUID(),t[this.fieldId]=e,this.internalIds[e]=t);var n={};for(var i in t)if(t.hasOwnProperty(i)){var o=this.fieldTypes[i];n[i]=b.cast(t[i],o)}return this.data[e]=n,e},o.prototype._castItem=function(t,e,n){var i,o=this.fieldId,r=this.internalIds;return t?(i={},e=e||{},n?b.forEach(t,function(t,o){-1!=n.indexOf(o)&&(i[o]=b.cast(t,e[o]))}):b.forEach(t,function(t,n){n==o&&t in r||(i[n]=b.cast(t,e[n]))})):i=null,i},o.prototype._updateItem=function(t){var e=t[this.fieldId];if(void 0==e)throw Error("Item has no id (item: "+JSON.stringify(t)+")");var n=this.data[e];if(n){for(var i in t)if(t.hasOwnProperty(i)){var o=this.fieldTypes[i];n[i]=b.cast(t[i],o)}}else this._addItem(t);return e},o.prototype._getColumnNames=function(t){for(var e=[],n=0,i=t.getNumberOfColumns();i>n;n++)e[n]=t.getColumnId(n)||t.getColumnLabel(n);return e},o.prototype._appendRow=function(t,e,n){var i=t.addRow();e.forEach(function(e,o){t.setValue(i,o,n[e])})},r.prototype.setOptions=function(t){b.extend(this.options,t)},r.prototype.update=function(){this._order(),this._stack()},r.prototype._order=function(){var t=this.parent.contents;if(!t)throw Error("Cannot stack items: parent does not contain items");var e=[],n=0;b.forEach(t,function(t){t.visible&&(e[n]=t,n++)});var i=this.options.order;if("function"!=typeof this.options.order)throw Error("Option order must be a function");e.sort(i),this.ordered=e},r.prototype._stack=function(){var t,e,n=this.ordered,i=this.options,o="top"==i.orientation,r=i.margin&&i.margin.item||0;for(t=0,e=n.length;e>t;t++){var s=n[t],a=null;do a=this.checkOverlap(n,t,0,t-1,r),null!=a&&(s.top=o?a.top+a.height+r:a.top-s.height-r);while(a)}},r.prototype.checkOverlap=function(t,e,n,i,o){for(var r=this.collision,s=t[e],a=i;a>=n;a--){var h=t[a];if(r(s,h,o)&&a!=e)return h}return null},r.prototype.collision=function(t,e,n){return t.left-ne.left&&t.top-ne.top},s.prototype.setOptions=function(t){b.extend(this.options,t),(null!=t.start||null!=t.end)&&this.setRange(t.start,t.end)},s.prototype.subscribe=function(t,e,n){var i,o=this;if("horizontal"!=n&&"vertical"!=n)throw new TypeError('Unknown direction "'+n+'". '+'Choose "horizontal" or "vertical".');if("move"==e)i={component:t,event:e,direction:n,callback:function(t){o._onMouseDown(t,i)},params:{}},t.on("mousedown",i.callback),o.listeners.push(i);else{if("zoom"!=e)throw new TypeError('Unknown event "'+e+'". '+'Choose "move" or "zoom".');i={component:t,event:e,direction:n,callback:function(t){o._onMouseWheel(t,i)},params:{}},t.on("mousewheel",i.callback),o.listeners.push(i)}},s.prototype.on=function(t,e){M.addListener(this,t,e)},s.prototype._trigger=function(t){M.trigger(this,t,{start:this.start,end:this.end})},s.prototype.setRange=function(t,e){var n=this._applyRange(t,e);n&&(this._trigger("rangechange"),this._trigger("rangechanged"))},s.prototype._applyRange=function(t,e){var n,i=null!=t?b.cast(t,"Number"):this.start,o=null!=e?b.cast(e,"Number"):this.end;if(isNaN(i))throw Error('Invalid start "'+t+'"');if(isNaN(o))throw Error('Invalid end "'+e+'"');if(i>o&&(o=i),null!=this.options.min){var r=this.options.min.valueOf();r>i&&(n=r-i,i+=n,o+=n)}if(null!=this.options.max){var s=this.options.max.valueOf();o>s&&(n=o-s,i-=n,o-=n)}if(null!=this.options.zoomMin){var a=this.options.zoomMin.valueOf();0>a&&(a=0),a>o-i&&(this.end-this.start>a?(n=a-(o-i),i-=n/2,o+=n/2):(i=this.start,o=this.end))}if(null!=this.options.zoomMax){var h=this.options.zoomMax.valueOf();0>h&&(h=0),o-i>h&&(h>this.end-this.start?(n=o-i-h,i+=n/2,o-=n/2):(i=this.start,o=this.end))}var p=this.start!=i||this.end!=o;return this.start=i,this.end=o,p},s.prototype.getRange=function(){return{start:this.start,end:this.end}},s.prototype.conversion=function(t){return this.start,this.end,s.conversion(this.start,this.end,t)},s.conversion=function(t,e,n){return 0!=n&&0!=e-t?{offset:t,factor:n/(e-t)}:{offset:0,factor:1}},s.prototype._onMouseDown=function(t,e){t=t||window.event;var n=e.params,i=t.which?1==t.which:1==t.button;if(i){n.mouseX=b.getPageX(t),n.mouseY=b.getPageY(t),n.previousLeft=0,n.previousOffset=0,n.moved=!1,n.start=this.start,n.end=this.end;var o=e.component.frame;o&&(o.style.cursor="move");var r=this;n.onMouseMove||(n.onMouseMove=function(t){r._onMouseMove(t,e)},b.addEventListener(document,"mousemove",n.onMouseMove)),n.onMouseUp||(n.onMouseUp=function(t){r._onMouseUp(t,e)},b.addEventListener(document,"mouseup",n.onMouseUp)),b.preventDefault(t)}},s.prototype._onMouseMove=function(t,e){t=t||window.event;var n=e.params,i=b.getPageX(t),o=b.getPageY(t);void 0==n.mouseX&&(n.mouseX=i),void 0==n.mouseY&&(n.mouseY=o);var r=i-n.mouseX,s=o-n.mouseY,a="horizontal"==e.direction?r:s;Math.abs(a)>=1&&(n.moved=!0);var h=n.end-n.start,p="horizontal"==e.direction?e.component.width:e.component.height,c=-a/p*h;this._applyRange(n.start+c,n.end+c),this._trigger("rangechange"),b.preventDefault(t)},s.prototype._onMouseUp=function(t,e){t=t||window.event;var n=e.params;e.component.frame&&(e.component.frame.style.cursor="auto"),n.onMouseMove&&(b.removeEventListener(document,"mousemove",n.onMouseMove),n.onMouseMove=null),n.onMouseUp&&(b.removeEventListener(document,"mouseup",n.onMouseUp),n.onMouseUp=null),n.moved&&this._trigger("rangechanged") +},s.prototype._onMouseWheel=function(t,e){t=t||window.event;var n=0;if(t.wheelDelta?n=t.wheelDelta/120:t.detail&&(n=-t.detail/3),n){var i=this,o=function(){var o=n/5,r=null,s=e.component.frame;if(s){var a,h;if("horizontal"==e.direction){a=e.component.width,h=i.conversion(a);var p=b.getAbsoluteLeft(s),c=b.getPageX(t);r=(c-p)/h.factor+h.offset}else{a=e.component.height,h=i.conversion(a);var u=b.getAbsoluteTop(s),d=b.getPageY(t);r=(u+a-d-u)/h.factor+h.offset}}i.zoom(o,r)};o()}b.preventDefault(t)},s.prototype.zoom=function(t,e){null==e&&(e=(this.start+this.end)/2),t>=1&&(t=.9),-1>=t&&(t=-.9),0>t&&(t/=1+t);var n=this.start-e,i=this.end-e,o=this.start-n*t,r=this.end-i*t;this.setRange(o,r)},s.prototype.move=function(t){var e=this.end-this.start,n=this.start+e*t,i=this.end+e*t;this.start=n,this.end=i},a.prototype.on=function(t,e,n){var i=t instanceof RegExp?t:RegExp(t.replace("*","\\w+")),o={id:b.randomUUID(),event:t,regexp:i,callback:"function"==typeof e?e:null,target:n};return this.subscriptions.push(o),o.id},a.prototype.off=function(t){for(var e=0;this.subscriptions.length>e;){var n=this.subscriptions[e],i=!0;if(t instanceof Object)for(var o in t)t.hasOwnProperty(o)&&t[o]!==n[o]&&(i=!1);else i=n.id==t;i?this.subscriptions.splice(e,1):e++}},a.prototype.emit=function(t,e,n){for(var i=0;this.subscriptions.length>i;i++){var o=this.subscriptions[i];o.regexp.test(t)&&o.callback&&o.callback(t,e,n)}},h.prototype.add=function(t){if(void 0==t.id)throw Error("Component has no field id");if(!(t instanceof p||t instanceof h))throw new TypeError("Component must be an instance of prototype Component or Controller");t.controller=this,this.components[t.id]=t},h.prototype.remove=function(t){var e;for(e in this.components)if(this.components.hasOwnProperty(e)&&(e==t||this.components[e]==t))break;e&&delete this.components[e]},h.prototype.requestReflow=function(t){if(t)this.reflow();else if(!this.reflowTimer){var e=this;this.reflowTimer=setTimeout(function(){e.reflowTimer=void 0,e.reflow()},0)}},h.prototype.requestRepaint=function(t){if(t)this.repaint();else if(!this.repaintTimer){var e=this;this.repaintTimer=setTimeout(function(){e.repaintTimer=void 0,e.repaint()},0)}},h.prototype.repaint=function(){function t(i,o){o in n||(i.depends&&i.depends.forEach(function(e){t(e,e.id)}),i.parent&&t(i.parent,i.parent.id),e=i.repaint()||e,n[o]=!0)}var e=!1;this.repaintTimer&&(clearTimeout(this.repaintTimer),this.repaintTimer=void 0);var n={};b.forEach(this.components,t),e&&this.reflow()},h.prototype.reflow=function(){function t(i,o){o in n||(i.depends&&i.depends.forEach(function(e){t(e,e.id)}),i.parent&&t(i.parent,i.parent.id),e=i.reflow()||e,n[o]=!0)}var e=!1;this.reflowTimer&&(clearTimeout(this.reflowTimer),this.reflowTimer=void 0);var n={};b.forEach(this.components,t),e&&this.repaint()},p.prototype.setOptions=function(t){t&&(b.extend(this.options,t),this.controller&&(this.requestRepaint(),this.requestReflow()))},p.prototype.getContainer=function(){return null},p.prototype.getFrame=function(){return this.frame},p.prototype.repaint=function(){return!1},p.prototype.reflow=function(){return!1},p.prototype.hide=function(){return this.frame&&this.frame.parentNode?(this.frame.parentNode.removeChild(this.frame),!0):!1},p.prototype.show=function(){return this.frame&&this.frame.parentNode?!1:this.repaint()},p.prototype.requestRepaint=function(){if(!this.controller)throw Error("Cannot request a repaint: no controller configured");this.controller.requestRepaint()},p.prototype.requestReflow=function(){if(!this.controller)throw Error("Cannot request a reflow: no controller configured");this.controller.requestReflow()},c.prototype=new p,c.prototype.getContainer=function(){return this.frame},c.prototype.repaint=function(){var t=0,e=b.updateProperty,n=b.option.asSize,i=this.options,o=this.frame;if(o||(o=document.createElement("div"),o.className="panel",i.className&&("function"==typeof i.className?b.addClassName(o,i.className()+""):b.addClassName(o,i.className+"")),this.frame=o,t+=1),!o.parentNode){if(!this.parent)throw Error("Cannot repaint panel: no parent attached");var r=this.parent.getContainer();if(!r)throw Error("Cannot repaint panel: parent has no container element");r.appendChild(o),t+=1}return t+=e(o.style,"top",n(i.top,"0px")),t+=e(o.style,"left",n(i.left,"0px")),t+=e(o.style,"width",n(i.width,"100%")),t+=e(o.style,"height",n(i.height,"100%")),t>0},c.prototype.reflow=function(){var t=0,e=b.updateProperty,n=this.frame;return n?(t+=e(this,"top",n.offsetTop),t+=e(this,"left",n.offsetLeft),t+=e(this,"width",n.offsetWidth),t+=e(this,"height",n.offsetHeight)):t+=1,t>0},u.prototype=new c,u.prototype.setOptions=function(t){b.extend(this.options,t),this.options.autoResize?this._watch():this._unwatch()},u.prototype.repaint=function(){var t=0,e=b.updateProperty,n=b.option.asSize,i=this.options,o=this.frame;if(o||(o=document.createElement("div"),o.className="graph panel",i.className&&b.addClassName(o,b.option.asString(i.className)),this.frame=o,t+=1),!o.parentNode){if(!this.container)throw Error("Cannot repaint root panel: no container attached");this.container.appendChild(o),t+=1}return t+=e(o.style,"top",n(i.top,"0px")),t+=e(o.style,"left",n(i.left,"0px")),t+=e(o.style,"width",n(i.width,"100%")),t+=e(o.style,"height",n(i.height,"100%")),this._updateEventEmitters(),t>0},u.prototype.reflow=function(){var t=0,e=b.updateProperty,n=this.frame;return n?(t+=e(this,"top",n.offsetTop),t+=e(this,"left",n.offsetLeft),t+=e(this,"width",n.offsetWidth),t+=e(this,"height",n.offsetHeight)):t+=1,t>0},u.prototype._watch=function(){var t=this;this._unwatch();var e=function(){return t.options.autoResize?(t.frame&&(t.frame.clientWidth!=t.width||t.frame.clientHeight!=t.height)&&t.requestReflow(),void 0):(t._unwatch(),void 0)};b.addEventListener(window,"resize",e),this.watchTimer=setInterval(e,1e3)},u.prototype._unwatch=function(){this.watchTimer&&(clearInterval(this.watchTimer),this.watchTimer=void 0)},u.prototype.on=function(t,e){var n=this.listeners[t];n||(n=[],this.listeners[t]=n),n.push(e),this._updateEventEmitters()},u.prototype._updateEventEmitters=function(){if(this.listeners){var t=this;b.forEach(this.listeners,function(e,n){if(t.emitters||(t.emitters={}),!(n in t.emitters)){var i=t.frame;if(i){var o=function(t){e.forEach(function(e){e(t)})};t.emitters[n]=o,b.addEventListener(i,n,o)}}})}},d.prototype=new p,d.prototype.setOptions=function(t){b.extend(this.options,t)},d.prototype.setRange=function(t){if(!(t instanceof s||t&&t.start&&t.end))throw new TypeError("Range must be an instance of Range, or an object containing start and end.");this.range=t},d.prototype.toTime=function(t){var e=this.conversion;return new Date(t/e.factor+e.offset)},d.prototype.toScreen=function(t){var e=this.conversion;return(t.valueOf()-e.offset)*e.factor},d.prototype.repaint=function(){var t=0,e=b.updateProperty,n=b.option.asSize,i=this.options,o=this.props,r=this.step,s=this.frame;if(s||(s=document.createElement("div"),this.frame=s,t+=1),s.className="axis "+i.orientation,!s.parentNode){if(!this.parent)throw Error("Cannot repaint time axis: no parent attached");var a=this.parent.getContainer();if(!a)throw Error("Cannot repaint time axis: parent has no container element");a.appendChild(s),t+=1}var h=s.parentNode;if(h){var p=s.nextSibling;h.removeChild(s);var c=i.orientation,u="bottom"==c&&this.props.parentHeight&&this.height?this.props.parentHeight-this.height+"px":"0px";if(t+=e(s.style,"top",n(i.top,u)),t+=e(s.style,"left",n(i.left,"0px")),t+=e(s.style,"width",n(i.width,"100%")),t+=e(s.style,"height",n(i.height,this.height+"px")),this._repaintMeasureChars(),this.step){this._repaintStart(),r.first();for(var d=void 0,l=0;r.hasNext()&&1e3>l;){l++;var f=r.getCurrent(),m=this.toScreen(f),g=r.isMajor();i.showMinorLabels&&this._repaintMinorText(m,r.getLabelMinor()),g&&i.showMajorLabels?(m>0&&(void 0==d&&(d=m),this._repaintMajorText(m,r.getLabelMajor())),this._repaintMajorLine(m)):this._repaintMinorLine(m),r.next()}if(i.showMajorLabels){var v=this.toTime(0),y=r.getLabelMajor(v),S=y.length*(o.majorCharWidth||10)+10;(void 0==d||d>S)&&this._repaintMajorText(0,y)}this._repaintEnd()}this._repaintLine(),p?h.insertBefore(s,p):h.appendChild(s)}return t>0},d.prototype._repaintStart=function(){var t=this.dom,e=t.redundant;e.majorLines=t.majorLines,e.majorTexts=t.majorTexts,e.minorLines=t.minorLines,e.minorTexts=t.minorTexts,t.majorLines=[],t.majorTexts=[],t.minorLines=[],t.minorTexts=[]},d.prototype._repaintEnd=function(){b.forEach(this.dom.redundant,function(t){for(;t.length;){var e=t.pop();e&&e.parentNode&&e.parentNode.removeChild(e)}})},d.prototype._repaintMinorText=function(t,e){var n=this.dom.redundant.minorTexts.shift();if(!n){var i=document.createTextNode("");n=document.createElement("div"),n.appendChild(i),n.className="text minor",this.frame.appendChild(n)}this.dom.minorTexts.push(n),n.childNodes[0].nodeValue=e,n.style.left=t+"px",n.style.top=this.props.minorLabelTop+"px"},d.prototype._repaintMajorText=function(t,e){var n=this.dom.redundant.majorTexts.shift();if(!n){var i=document.createTextNode(e);n=document.createElement("div"),n.className="text major",n.appendChild(i),this.frame.appendChild(n)}this.dom.majorTexts.push(n),n.childNodes[0].nodeValue=e,n.style.top=this.props.majorLabelTop+"px",n.style.left=t+"px"},d.prototype._repaintMinorLine=function(t){var e=this.dom.redundant.minorLines.shift();e||(e=document.createElement("div"),e.className="grid vertical minor",this.frame.appendChild(e)),this.dom.minorLines.push(e);var n=this.props;e.style.top=n.minorLineTop+"px",e.style.height=n.minorLineHeight+"px",e.style.left=t-n.minorLineWidth/2+"px"},d.prototype._repaintMajorLine=function(t){var e=this.dom.redundant.majorLines.shift();e||(e=document.createElement("DIV"),e.className="grid vertical major",this.frame.appendChild(e)),this.dom.majorLines.push(e);var n=this.props;e.style.top=n.majorLineTop+"px",e.style.left=t-n.majorLineWidth/2+"px",e.style.height=n.majorLineHeight+"px"},d.prototype._repaintLine=function(){var t=this.dom.line,e=this.frame,n=this.options;n.showMinorLabels||n.showMajorLabels?(t?(e.removeChild(t),e.appendChild(t)):(t=document.createElement("div"),t.className="grid horizontal major",e.appendChild(t),this.dom.line=t),t.style.top=this.props.lineTop+"px"):t&&axis.parentElement&&(e.removeChild(axis.line),delete this.dom.line)},d.prototype._repaintMeasureChars=function(){var t,e=this.dom;if(!e.characterMinor){t=document.createTextNode("0");var n=document.createElement("DIV");n.className="text minor measure",n.appendChild(t),this.frame.appendChild(n),e.measureCharMinor=n}if(!e.characterMajor){t=document.createTextNode("0");var i=document.createElement("DIV");i.className="text major measure",i.appendChild(t),this.frame.appendChild(i),e.measureCharMajor=i}},d.prototype.reflow=function(){var t=0,e=b.updateProperty,n=this.frame,i=this.range;if(!i)throw Error("Cannot repaint time axis: no range configured");if(n){t+=e(this,"top",n.offsetTop),t+=e(this,"left",n.offsetLeft);var o=this.props,r=this.options.showMinorLabels,s=this.options.showMajorLabels,a=this.dom.measureCharMinor,h=this.dom.measureCharMajor;a&&(o.minorCharHeight=a.clientHeight,o.minorCharWidth=a.clientWidth),h&&(o.majorCharHeight=h.clientHeight,o.majorCharWidth=h.clientWidth);var p=n.parentNode?n.parentNode.offsetHeight:0;switch(p!=o.parentHeight&&(o.parentHeight=p,t+=1),this.options.orientation){case"bottom":o.minorLabelHeight=r?o.minorCharHeight:0,o.majorLabelHeight=s?o.majorCharHeight:0,o.minorLabelTop=0,o.majorLabelTop=o.minorLabelTop+o.minorLabelHeight,o.minorLineTop=-this.top,o.minorLineHeight=Math.max(this.top+o.majorLabelHeight,0),o.minorLineWidth=1,o.majorLineTop=-this.top,o.majorLineHeight=Math.max(this.top+o.minorLabelHeight+o.majorLabelHeight,0),o.majorLineWidth=1,o.lineTop=0;break;case"top":o.minorLabelHeight=r?o.minorCharHeight:0,o.majorLabelHeight=s?o.majorCharHeight:0,o.majorLabelTop=0,o.minorLabelTop=o.majorLabelTop+o.majorLabelHeight,o.minorLineTop=o.minorLabelTop,o.minorLineHeight=Math.max(p-o.majorLabelHeight-this.top),o.minorLineWidth=1,o.majorLineTop=0,o.majorLineHeight=Math.max(p-this.top),o.majorLineWidth=1,o.lineTop=o.majorLabelHeight+o.minorLabelHeight;break;default:throw Error('Unkown orientation "'+this.options.orientation+'"')}var c=o.minorLabelHeight+o.majorLabelHeight;t+=e(this,"width",n.offsetWidth),t+=e(this,"height",c),this._updateConversion();var u=b.cast(i.start,"Date"),d=b.cast(i.end,"Date"),l=this.toTime(5*(o.minorCharWidth||10))-this.toTime(0);this.step=new TimeStep(u,d,l),t+=e(o.range,"start",u.valueOf()),t+=e(o.range,"end",d.valueOf()),t+=e(o.range,"minimumStep",l.valueOf())}return t>0},d.prototype._updateConversion=function(){var t=this.range;if(!t)throw Error("No range configured");this.conversion=t.conversion?t.conversion(this.width):s.conversion(t.start,t.end,this.width)},l.prototype=new c,l.types={box:m,range:v,point:g},l.prototype.setOptions=function(t){b.extend(this.options,t),this.stack.setOptions(this.options)},l.prototype.setRange=function(t){if(!(t instanceof s||t&&t.start&&t.end))throw new TypeError("Range must be an instance of Range, or an object containing start and end.");this.range=t},l.prototype.repaint=function(){var t=0,e=b.updateProperty,n=b.option.asSize,i=this.options,o=this.frame;if(!o){o=document.createElement("div"),o.className="itemset",i.className&&b.addClassName(o,b.option.asString(i.className));var r=document.createElement("div");r.className="background",o.appendChild(r),this.dom.background=r;var s=document.createElement("div");s.className="foreground",o.appendChild(s),this.dom.foreground=s;var a=document.createElement("div");a.className="itemset-axis",this.dom.axis=a,this.frame=o,t+=1}if(!this.parent)throw Error("Cannot repaint itemset: no parent attached");var h=this.parent.getContainer();if(!h)throw Error("Cannot repaint itemset: parent has no container element");o.parentNode||(h.appendChild(o),t+=1),this.dom.axis.parentNode||(h.appendChild(this.dom.axis),t+=1),t+=e(o.style,"height",n(i.height,this.height+"px")),t+=e(o.style,"top",n(i.top,"0px")),t+=e(o.style,"left",n(i.left,"0px")),t+=e(o.style,"width",n(i.width,"100%")),t+=e(this.dom.axis.style,"top",n(i.top,"0px")),this._updateConversion();var p=this,c=this.queue,u=this.items,d=this.contents,f={fields:["id","start","end","content","type"]};return Object.keys(c).forEach(function(e){var n=c[e],o=d[e];switch(n){case"add":case"update":var r=u.get(e,f),s=r.type||r.start&&r.end&&"range"||"box",a=l.types[s];if(o&&(a&&o instanceof a?(o.data=r,t++):(t+=o.hide(),o=null)),!o){if(!a)throw new TypeError('Unknown item type "'+s+'"');o=new a(p,r,i),t++}d[e]=o,delete c[e];break;case"remove":o&&(t+=o.hide()),delete d[e],delete c[e];break;default:console.log('Error: unknown action "'+n+'"')}}),b.forEach(this.contents,function(e){e.visible?(t+=e.show(),e.reposition()):t+=e.hide()}),t>0},l.prototype.getForeground=function(){return this.dom.foreground},l.prototype.getBackground=function(){return this.dom.background},l.prototype.getAxis=function(){return this.dom.axis},l.prototype.reflow=function(){var t=0,e=this.options,n=b.updateProperty,i=b.option.asNumber,o=this.frame;if(o){this._updateConversion(),b.forEach(this.contents,function(e){t+=e.reflow()}),this.stack.update();var r,s=i(e.maxHeight);if(null!=e.height)r=o.offsetHeight;else{var a=this.stack.ordered;if(a.length){var h=a[0].top,p=a[0].top+a[0].height;b.forEach(a,function(t){h=Math.min(h,t.top),p=Math.max(p,t.top+t.height)}),r=p-h+e.margin.axis+e.margin.item}else r=e.margin.axis+e.margin.item}null!=s&&(r=Math.min(r,s)),t+=n(this,"height",r),t+=n(this,"top",o.offsetTop),t+=n(this,"left",o.offsetLeft),t+=n(this,"width",o.offsetWidth)}else t+=1;return t>0},l.prototype.hide=function(){var t=!1;return this.frame&&this.frame.parentNode&&(this.frame.parentNode.removeChild(this.frame),t=!0),this.dom.axis&&this.dom.axis.parentNode&&(this.dom.axis.parentNode.removeChild(this.dom.axis),t=!0),t},l.prototype.setItems=function(t){var e,n,i=this,r=this.items;if(r&&(b.forEach(this.listeners,function(t,e){r.unsubscribe(e,t)}),e=r.get({fields:["id"]}),n=[],b.forEach(e,function(t,e){n[e]=t.id}),this._onRemove(n)),t){if(!(t instanceof o))throw new TypeError("Data must be an instance of DataSet");this.items=t}else this.items=null;if(this.items){var s=this.id;b.forEach(this.listeners,function(t,e){i.items.subscribe(e,t,s)}),e=this.items.get({fields:["id"]}),n=[],b.forEach(e,function(t,e){n[e]=t.id}),this._onAdd(n)}},l.prototype.getItems=function(){return this.items},l.prototype._onUpdate=function(t){console.log("onUpdate",t),this._toQueue(t,"update")},l.prototype._onAdd=function(t){this._toQueue(t,"add")},l.prototype._onRemove=function(t){this._toQueue(t,"remove")},l.prototype._toQueue=function(t,e){var n=this.queue;t.forEach(function(t){n[t]=e}),this.controller&&this.requestRepaint()},l.prototype._updateConversion=function(){var t=this.range;if(!t)throw Error("No range configured");this.conversion=t.conversion?t.conversion(this.width):s.conversion(t.start,t.end,this.width)},l.prototype.toTime=function(t){var e=this.conversion;return new Date(t/e.factor+e.offset)},l.prototype.toScreen=function(t){var e=this.conversion;return(t.valueOf()-e.offset)*e.factor},f.prototype.select=function(){this.selected=!0},f.prototype.unselect=function(){this.selected=!1},f.prototype.show=function(){return!1},f.prototype.hide=function(){return!1},f.prototype.repaint=function(){return!1},f.prototype.reflow=function(){return!1},m.prototype=new f(null,null),m.prototype.select=function(){this.selected=!0},m.prototype.unselect=function(){this.selected=!1},m.prototype.repaint=function(){var t=!1,e=this.dom;if(e||(this._create(),e=this.dom,t=!0),e){if(!this.options&&!this.parent)throw Error("Cannot repaint item: no parent attached");var n=this.parent.getForeground();if(!n)throw Error("Cannot repaint time axis: parent has no foreground container element");var i=this.parent.getBackground();if(!i)throw Error("Cannot repaint time axis: parent has no background container element");var o=this.parent.getAxis();if(!i)throw Error("Cannot repaint time axis: parent has no axis container element");if(e.box.parentNode||(n.appendChild(e.box),t=!0),e.line.parentNode||(i.appendChild(e.line),t=!0),e.dot.parentNode||(o.appendChild(e.dot),t=!0),this.data.content!=this.content){if(this.content=this.data.content,this.content instanceof Element)e.content.innerHTML="",e.content.appendChild(this.content);else{if(void 0==this.data.content)throw Error('Property "content" missing in item '+this.data.id);e.content.innerHTML=this.content}t=!0}var r=(this.data.className?" "+this.data.className:"")+(this.selected?" selected":"");this.className!=r&&(this.className=r,e.box.className="item box"+r,e.line.className="item line"+r,e.dot.className="item dot"+r,t=!0)}return t},m.prototype.show=function(){return this.dom&&this.dom.box.parentNode?!1:this.repaint()},m.prototype.hide=function(){var t=!1,e=this.dom;return e&&(e.box.parentNode&&(e.box.parentNode.removeChild(e.box),t=!0),e.line.parentNode&&e.line.parentNode.removeChild(e.line),e.dot.parentNode&&e.dot.parentNode.removeChild(e.dot)),t},m.prototype.reflow=function(){var t,e,n,i,o,r,s,a,h,p,c,u=0;if(void 0==this.data.start)throw Error('Property "start" missing in item '+this.data.id);if(p=this.data,c=this.parent&&this.parent.range,this.visible=p&&c?p.start>c.start&&p.start0},m.prototype._create=function(){var t=this.dom;t||(this.dom=t={},t.box=document.createElement("DIV"),t.content=document.createElement("DIV"),t.content.className="content",t.box.appendChild(t.content),t.line=document.createElement("DIV"),t.line.className="line",t.dot=document.createElement("DIV"),t.dot.className="dot")},m.prototype.reposition=function(){var t=this.dom,e=this.props,n=this.options.orientation;if(t){var i=t.box,o=t.line,r=t.dot;i.style.left=this.left+"px",i.style.top=this.top+"px",o.style.left=e.line.left+"px","top"==n?(o.style.top="0px",o.style.height=this.top+"px"):(o.style.top=e.line.top+"px",o.style.top=this.top+this.height+"px",o.style.height=Math.max(e.dot.top-this.top-this.height,0)+"px"),r.style.left=e.dot.left+"px",r.style.top=e.dot.top+"px"}},g.prototype=new f(null,null),g.prototype.select=function(){this.selected=!0},g.prototype.unselect=function(){this.selected=!1},g.prototype.repaint=function(){var t=!1,e=this.dom;if(e||(this._create(),e=this.dom,t=!0),e){if(!this.options&&!this.options.parent)throw Error("Cannot repaint item: no parent attached");var n=this.parent.getForeground();if(!n)throw Error("Cannot repaint time axis: parent has no foreground container element");if(e.point.parentNode||(n.appendChild(e.point),n.appendChild(e.point),t=!0),this.data.content!=this.content){if(this.content=this.data.content,this.content instanceof Element)e.content.innerHTML="",e.content.appendChild(this.content);else{if(void 0==this.data.content)throw Error('Property "content" missing in item '+this.data.id);e.content.innerHTML=this.content}t=!0}var i=(this.data.className?" "+this.data.className:"")+(this.selected?" selected":"");this.className!=i&&(this.className=i,e.point.className="item point"+i,t=!0)}return t},g.prototype.show=function(){return this.dom&&this.dom.point.parentNode?!1:this.repaint()},g.prototype.hide=function(){var t=!1,e=this.dom;return e&&e.point.parentNode&&(e.point.parentNode.removeChild(e.point),t=!0),t},g.prototype.reflow=function(){var t,e,n,i,o,r,s,a,h,p=0;if(void 0==this.data.start)throw Error('Property "start" missing in item '+this.data.id);if(a=this.data,h=this.parent&&this.parent.range,this.visible=a&&h?a.start>h.start&&a.start0},g.prototype._create=function(){var t=this.dom;t||(this.dom=t={},t.point=document.createElement("div"),t.content=document.createElement("div"),t.content.className="content",t.point.appendChild(t.content),t.dot=document.createElement("div"),t.dot.className="dot",t.point.appendChild(t.dot))},g.prototype.reposition=function(){var t=this.dom,e=this.props;t&&(t.point.style.top=this.top+"px",t.point.style.left=this.left+"px",t.content.style.marginLeft=e.content.marginLeft+"px",t.dot.style.top=e.dot.top+"px")},v.prototype=new f(null,null),v.prototype.select=function(){this.selected=!0},v.prototype.unselect=function(){this.selected=!1},v.prototype.repaint=function(){var t=!1,e=this.dom;if(e||(this._create(),e=this.dom,t=!0),e){if(!this.options&&!this.options.parent)throw Error("Cannot repaint item: no parent attached");var n=this.parent.getForeground();if(!n)throw Error("Cannot repaint time axis: parent has no foreground container element");if(e.box.parentNode||(n.appendChild(e.box),t=!0),this.data.content!=this.content){if(this.content=this.data.content,this.content instanceof Element)e.content.innerHTML="",e.content.appendChild(this.content);else{if(void 0==this.data.content)throw Error('Property "content" missing in item '+this.data.id);e.content.innerHTML=this.content}t=!0}var i=this.data.className?""+this.data.className:"";this.className!=i&&(this.className=i,e.box.className="item range"+i,t=!0)}return t},v.prototype.show=function(){return this.dom&&this.dom.box.parentNode?!1:this.repaint()},v.prototype.hide=function(){var t=!1,e=this.dom;return e&&e.box.parentNode&&(e.box.parentNode.removeChild(e.box),t=!0),t},v.prototype.reflow=function(){var t,e,n,i,o,r,s,a,h,p,c,u,d,l,f=0;if(void 0==this.data.start)throw Error('Property "start" missing in item '+this.data.id);if(void 0==this.data.end)throw Error('Property "end" missing in item '+this.data.id);return s=this.data,a=this.parent&&this.parent.range,this.visible=s&&a?s.starta.start:!1,this.visible&&(t=this.dom,t?(e=this.props,n=this.options,i=this.parent,o=i.toScreen(this.data.start),r=i.toScreen(this.data.end),h=b.updateProperty,p=t.box,c=i.width,d=n.orientation,f+=h(e.content,"width",t.content.offsetWidth),f+=h(this,"height",p.offsetHeight),-c>o&&(o=-c),r>2*c&&(r=2*c),u=0>o?Math.min(-o,r-o-e.content.width-2*n.padding):0,f+=h(e.content,"left",u),"top"==d?(l=n.margin.axis,f+=h(this,"top",l)):(l=i.height-this.height-n.margin.axis,f+=h(this,"top",l)),f+=h(this,"left",o),f+=h(this,"width",Math.max(r-o,1))):f+=1),f>0},v.prototype._create=function(){var t=this.dom;t||(this.dom=t={},t.box=document.createElement("div"),t.content=document.createElement("div"),t.content.className="content",t.box.appendChild(t.content))},v.prototype.reposition=function(){var t=this.dom,e=this.props;t&&(t.box.style.top=this.top+"px",t.box.style.left=this.left+"px",t.box.style.width=this.width+"px",t.content.style.left=e.content.left+"px")},y.prototype=new c,y.prototype.setOptions=function(t){b.extend(this.options,t)},y.prototype.setRange=function(){},y.prototype.setItems=function(t){this.items=t,b.forEach(this.contents,function(e){e.setItems(t)})},y.prototype.getItems=function(){return this.items},y.prototype.setRange=function(t){this.range=t},y.prototype.setGroups=function(t){var e,n,i=this;if(this.groups&&(b.forEach(this.listeners,function(t,e){i.groups.unsubscribe(e,t)}),e=this.groups.get({fields:["id"]}),n=[],b.forEach(e,function(t,e){n[e]=t.id}),this._onRemove(n)),t?t instanceof o?this.groups=t:(this.groups=new o({fieldTypes:{start:"Date",end:"Date"}}),this.groups.add(t)):this.groups=null,this.groups){var r=this.id;b.forEach(this.listeners,function(t,e){i.groups.subscribe(e,t,r)}),e=this.groups.get({fields:["id"]}),n=[],b.forEach(e,function(t,e){n[e]=t.id}),this._onAdd(n)}},y.prototype.getGroups=function(){return this.groups},y.prototype.repaint=function(){var t=0,e=b.updateProperty,n=b.option.asSize,i=this.options,o=this.frame;if(o||(o=document.createElement("div"),o.className="groupset",i.className&&b.addClassName(o,b.option.asString(i.className)),this.frame=o,t+=1),!this.parent)throw Error("Cannot repaint groupset: no parent attached");var r=this.parent.getContainer();if(!r)throw Error("Cannot repaint groupset: parent has no container element");o.parentNode||(r.appendChild(o),t+=1),t+=e(o.style,"height",n(i.height,this.height+"px")),t+=e(o.style,"top",n(i.top,"0px")),t+=e(o.style,"left",n(i.left,"0px")),t+=e(o.style,"width",n(i.width,"100%"));var s=this,a=this.queue,h=(this.items,this.contents);return this.groups,Object.keys(a).forEach(function(e){var n=a[e],i=n.item;switch(n.action){case"add":i=new l(s),i.setRange(s.range),i.setItems(s.items),h[e]=i,delete a[e];break;case"update":h[e]=i,delete a[e];break;case"remove":i&&(t+=i.hide()),delete h[e],delete a[e];break;default:console.log('Error: unknown action "'+n.action+'"')}}),b.forEach(this.contents,function(e){t+=e.repaint()}),t>0},y.prototype.getContainer=function(){return this.frame},y.prototype.reflow=function(){var t=0,e=this.options,n=b.updateProperty,i=b.option.asNumber,o=this.frame;if(o){b.forEach(this.contents,function(e){t+=e.reflow()});var r,s=i(e.maxHeight);null!=e.height?r=o.offsetHeight:(r=0,b.forEach(this.contents,function(t){r+=t.height})),null!=s&&(r=Math.min(r,s)),t+=n(this,"height",r),t+=n(this,"top",o.offsetTop),t+=n(this,"left",o.offsetLeft),t+=n(this,"width",o.offsetWidth)}return t>0},y.prototype.hide=function(){return this.frame&&this.frame.parentNode?(this.frame.parentNode.removeChild(this.frame),!0):!1},y.prototype.show=function(){return this.frame&&this.frame.parentNode?!1:this.repaint()},y.prototype._onUpdate=function(t){this._toQueue(t,"update")},y.prototype._onAdd=function(t){this._toQueue(t,"add")},y.prototype._onRemove=function(t){this._toQueue(t,"remove")},y.prototype._toQueue=function(t,e){var n=this.groups,i=this.queue;t.forEach(function(t){var o=i[t];o?o.action=e:i[t]={item:n[t]||null,action:e}}),this.controller&&this.requestRepaint()},S.prototype.setOptions=function(t){b.extend(this.options,t),this.timeaxis.setOptions(this.options),this.range.setOptions(this.options);var e,n,i,o,r=this;if(e="top"==this.options.orientation?function(){return r.timeaxis.height}:function(){return r.main.height-r.timeaxis.height-r.content.height},this.options.height?(i=this.options.height,n=function(){return r.main.height-r.timeaxis.height}):(i=function(){return r.timeaxis.height+r.content.height},n=null),this.options.maxHeight){if(!b.isNumber(this.options.maxHeight))throw new TypeError("Number expected for property maxHeight");o=function(){return r.options.maxHeight-r.timeaxis.height}}this.main.setOptions({height:i}),this.content.setOptions({orientation:this.options.orientation,top:e,height:n,maxHeight:o}),this.controller.repaint()},S.prototype.setItems=function(t){var e,n=null==this.items;if(t?t instanceof o&&(e=t):e=null,t instanceof o||(e=new o({fieldTypes:{start:"Date",end:"Date"}}),e.add(t)),this.items=e,this.content.setItems(e),n&&(void 0==this.options.start||void 0==this.options.end)){var i=this.getItemRange(),r=i.min,s=i.max;if(null!=r&&null!=s){var a=s.valueOf()-r.valueOf();r=new Date(r.valueOf()-.05*a),s=new Date(s.valueOf()+.05*a)}void 0!=this.options.start&&(r=new Date(this.options.start.valueOf())),void 0!=this.options.end&&(s=new Date(this.options.end.valueOf())),(null!=r||null!=s)&&this.range.setRange(r,s)}},S.prototype.setGroups=function(t){this.groups=t;var e=this.groups?y:l;this.content instanceof e||(this.content&&(this.content.hide(),this.content.setItems&&this.content.setItems(),this.content.setGroups&&this.content.setGroups(),this.controller.remove(this.content)),this.content=new e(this.main,[this.timeaxis]),this.content.setRange&&this.content.setRange(this.range),this.content.setItems&&this.content.setItems(this.items),this.content.setGroups&&this.content.setGroups(this.groups),this.controller.add(this.content),this.setOptions(this.options))},S.prototype.getItemRange=function(){var t=this.items,e=null,n=null;if(t){var i=t.min("start");e=i?i.start.valueOf():null;var o=t.max("start");o&&(n=o.start.valueOf());var r=t.max("end");r&&(n=null==n?r.end.valueOf():Math.max(n,r.end.valueOf()))}return{min:null!=e?new Date(e):null,max:null!=n?new Date(n):null}};var _={util:b,events:M,Controller:h,DataSet:o,Range:s,Stack:r,TimeStep:TimeStep,EventBus:a,components:{items:{Item:f,ItemBox:m,ItemPoint:g,ItemRange:v},Component:p,Panel:c,RootPanel:u,ItemSet:l,TimeAxis:d},Timeline:S};i!==void 0&&(i=_),n!==void 0&&n.exports!==void 0&&(n.exports=_),"function"==typeof t&&t(function(){return _}),"undefined"!=typeof window&&(window.vis=_),b.loadCss("/* vis.js stylesheet */\n\n.graph {\n position: relative;\n border: 1px solid #bfbfbf;\n}\n\n.graph .panel {\n position: absolute;\n}\n\n.graph .groupset {\n position: absolute;\n padding: 0;\n margin: 0;\n overflow: hidden;\n}\n\n\n.graph .itemset {\n position: absolute;\n padding: 0;\n margin: 0;\n overflow: hidden;\n}\n\n.graph .groupset .itemset {\n position: relative;\n padding: 0;\n margin: 0;\n overflow: hidden;\n}\n\n.graph .background {\n}\n\n.graph .foreground {\n}\n\n.graph .itemset-axis {\n position: absolute;\n}\n\n.graph .groupset .itemset-axis {\n position: relative;\n}\n\n.graph .item {\n position: absolute;\n color: #1A1A1A;\n border-color: #97B0F8;\n background-color: #D5DDF6;\n display: inline-block;\n}\n\n.graph .item.selected {\n border-color: #FFC200;\n background-color: #FFF785;\n z-index: 999;\n}\n\n.graph .item.cluster {\n /* TODO: use another color or pattern? */\n background: #97B0F8 url('img/cluster_bg.png');\n color: white;\n}\n.graph .item.cluster.point {\n border-color: #D5DDF6;\n}\n\n.graph .item.box {\n text-align: center;\n border-style: solid;\n border-width: 1px;\n border-radius: 5px;\n -moz-border-radius: 5px; /* For Firefox 3.6 and older */\n}\n\n.graph .item.point {\n background: none;\n}\n\n.graph .dot {\n border: 5px solid #97B0F8;\n position: absolute;\n border-radius: 5px;\n -moz-border-radius: 5px; /* For Firefox 3.6 and older */\n}\n\n.graph .item.range {\n overflow: hidden;\n border-style: solid;\n border-width: 1px;\n border-radius: 2px;\n -moz-border-radius: 2px; /* For Firefox 3.6 and older */\n}\n\n.graph .item.range .drag-left {\n cursor: w-resize;\n z-index: 1000;\n}\n\n.graph .item.range .drag-right {\n cursor: e-resize;\n z-index: 1000;\n}\n\n.graph .item.range .content {\n position: relative;\n display: inline-block;\n}\n\n.graph .item.line {\n position: absolute;\n width: 0;\n border-left-width: 1px;\n border-left-style: solid;\n}\n\n.graph .item .content {\n margin: 5px;\n white-space: nowrap;\n overflow: hidden;\n}\n\n/* TODO: better css name, 'graph' is way to generic */\n\n.graph {\n overflow: hidden;\n}\n\n.graph .axis {\n position: relative;\n}\n\n.graph .axis .text {\n position: absolute;\n color: #4d4d4d;\n padding: 3px;\n white-space: nowrap;\n}\n\n.graph .axis .text.measure {\n position: absolute;\n padding-left: 0;\n padding-right: 0;\n margin-left: 0;\n margin-right: 0;\n visibility: hidden;\n}\n\n.graph .axis .grid.vertical {\n position: absolute;\n width: 0;\n border-right: 1px solid;\n}\n\n.graph .axis .grid.horizontal {\n position: absolute;\n left: 0;\n width: 100%;\n height: 0;\n border-bottom: 1px solid;\n}\n\n.graph .axis .grid.minor {\n border-color: #e5e5e5;\n}\n\n.graph .axis .grid.major {\n border-color: #bfbfbf;\n}\n\n") +},{moment:2}],2:[function(e,n){(function(){(function(i){function o(t,e){return function(n){return u(t.call(this,n),e)}}function r(t){return function(e){return this.lang().ordinal(t.call(this,e))}}function s(){}function a(t){p(this,t)}function h(t){var e=this._data={},n=t.years||t.year||t.y||0,i=t.months||t.month||t.M||0,o=t.weeks||t.week||t.w||0,r=t.days||t.day||t.d||0,s=t.hours||t.hour||t.h||0,a=t.minutes||t.minute||t.m||0,h=t.seconds||t.second||t.s||0,p=t.milliseconds||t.millisecond||t.ms||0;this._milliseconds=p+1e3*h+6e4*a+36e5*s,this._days=r+7*o,this._months=i+12*n,e.milliseconds=p%1e3,h+=c(p/1e3),e.seconds=h%60,a+=c(h/60),e.minutes=a%60,s+=c(a/60),e.hours=s%24,r+=c(s/24),r+=7*o,e.days=r%30,i+=c(r/30),e.months=i%12,n+=c(i/12),e.years=n}function p(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function c(t){return 0>t?Math.ceil(t):Math.floor(t)}function u(t,e){for(var n=t+"";e>n.length;)n="0"+n;return n}function d(t,e,n){var i,o=e._milliseconds,r=e._days,s=e._months;o&&t._d.setTime(+t+o*n),r&&t.date(t.date()+r*n),s&&(i=t.date(),t.date(1).month(t.month()+s*n).date(Math.min(i,t.daysInMonth())))}function l(t){return"[object Array]"===Object.prototype.toString.call(t)}function f(t,e){var n,i=Math.min(t.length,e.length),o=Math.abs(t.length-e.length),r=0;for(n=0;i>n;n++)~~t[n]!==~~e[n]&&r++;return r+o}function m(t,e){return e.abbr=t,R[t]||(R[t]=new s),R[t].set(e),R[t]}function g(t){return t?(!R[t]&&U&&e("./lang/"+t),R[t]):k.fn._lang}function v(t){return t.match(/\[.*\]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function y(t){var e,n,i=t.match(P);for(e=0,n=i.length;n>e;e++)i[e]=ae[i[e]]?ae[i[e]]:v(i[e]);return function(o){var r="";for(e=0;n>e;e++)r+="function"==typeof i[e].call?i[e].call(o,t):i[e];return r}}function S(t,e){function n(e){return t.lang().longDateFormat(e)||e}for(var i=5;i--&&z.test(e);)e=e.replace(z,n);return oe[e]||(oe[e]=y(e)),oe[e](t)}function w(t){switch(t){case"DDDD":return V;case"YYYY":return B;case"YYYYY":return Z;case"S":case"SS":case"SSS":case"DDD":return q;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":case"a":case"A":return X;case"X":return J;case"Z":case"ZZ":return K;case"T":return G;case"MM":case"DD":case"YY":case"HH":case"hh":case"mm":case"ss":case"M":case"D":case"d":case"H":case"h":case"m":case"s":return W;default:return RegExp(t.replace("\\",""))}}function b(t,e,n){var i,o=n._a;switch(t){case"M":case"MM":o[1]=null==e?0:~~e-1;break;case"MMM":case"MMMM":i=g(n._l).monthsParse(e),null!=i?o[1]=i:n._isValid=!1;break;case"D":case"DD":case"DDD":case"DDDD":null!=e&&(o[2]=~~e);break;case"YY":o[0]=~~e+(~~e>68?1900:2e3);break;case"YYYY":case"YYYYY":o[0]=~~e;break;case"a":case"A":n._isPm="pm"===(e+"").toLowerCase();break;case"H":case"HH":case"h":case"hh":o[3]=~~e;break;case"m":case"mm":o[4]=~~e;break;case"s":case"ss":o[5]=~~e;break;case"S":case"SS":case"SSS":o[6]=~~(1e3*("0."+e));break;case"X":n._d=new Date(1e3*parseFloat(e));break;case"Z":case"ZZ":n._useUTC=!0,i=(e+"").match(ee),i&&i[1]&&(n._tzh=~~i[1]),i&&i[2]&&(n._tzm=~~i[2]),i&&"+"===i[0]&&(n._tzh=-n._tzh,n._tzm=-n._tzm)}null==e&&(n._isValid=!1)}function E(t){var e,n,i=[];if(!t._d){for(e=0;7>e;e++)t._a[e]=i[e]=null==t._a[e]?2===e?1:0:t._a[e];i[3]+=t._tzh||0,i[4]+=t._tzm||0,n=new Date(0),t._useUTC?(n.setUTCFullYear(i[0],i[1],i[2]),n.setUTCHours(i[3],i[4],i[5],i[6])):(n.setFullYear(i[0],i[1],i[2]),n.setHours(i[3],i[4],i[5],i[6])),t._d=n}}function T(t){var e,n,i=t._f.match(P),o=t._i;for(t._a=[],e=0;i.length>e;e++)n=(w(i[e]).exec(o)||[])[0],n&&(o=o.slice(o.indexOf(n)+n.length)),ae[i[e]]&&b(i[e],n,t);t._isPm&&12>t._a[3]&&(t._a[3]+=12),t._isPm===!1&&12===t._a[3]&&(t._a[3]=0),E(t)}function M(t){for(var e,n,i,o,r=99;t._f.length;){if(e=p({},t),e._f=t._f.pop(),T(e),n=new a(e),n.isValid()){i=n;break}o=f(e._a,n.toArray()),r>o&&(r=o,i=n)}p(t,i)}function _(t){var e,n=t._i;if(Q.exec(n)){for(t._f="YYYY-MM-DDT",e=0;4>e;e++)if(te[e][1].exec(n)){t._f+=te[e][0];break}K.exec(n)&&(t._f+=" Z"),T(t)}else t._d=new Date(n)}function C(t){var e=t._i,n=F.exec(e);e===i?t._d=new Date:n?t._d=new Date(+n[1]):"string"==typeof e?_(t):l(e)?(t._a=e.slice(0),E(t)):t._d=e instanceof Date?new Date(+e):new Date(e)}function D(t,e,n,i,o){return o.relativeTime(e||1,!!n,t,i)}function L(t,e,n){var i=j(Math.abs(t)/1e3),o=j(i/60),r=j(o/60),s=j(r/24),a=j(s/365),h=45>i&&["s",i]||1===o&&["m"]||45>o&&["mm",o]||1===r&&["h"]||22>r&&["hh",r]||1===s&&["d"]||25>=s&&["dd",s]||45>=s&&["M"]||345>s&&["MM",j(s/30)]||1===a&&["y"]||["yy",a];return h[2]=e,h[3]=t>0,h[4]=n,D.apply({},h)}function x(t,e,n){var i=n-e,o=n-t.day();return o>i&&(o-=7),i-7>o&&(o+=7),Math.ceil(k(t).add("d",o).dayOfYear()/7)}function N(t){var e=t._i,n=t._f;return null===e||""===e?null:("string"==typeof e&&(t._i=e=g().preparse(e)),k.isMoment(e)?(t=p({},e),t._d=new Date(+e._d)):n?l(n)?M(t):T(t):C(t),new a(t))}function A(t,e){k.fn[t]=k.fn[t+"s"]=function(t){var n=this._isUTC?"UTC":"";return null!=t?(this._d["set"+n+e](t),this):this._d["get"+n+e]()}}function O(t){k.duration.fn[t]=function(){return this._data[t]}}function Y(t,e){k.duration.fn["as"+t]=function(){return+this/e}}for(var k,H,I="2.0.0",j=Math.round,R={},U=n!==i&&n.exports,F=/^\/?Date\((\-?\d+)/i,P=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYY|YYYY|YY|a|A|hh?|HH?|mm?|ss?|SS?S?|X|zz?|ZZ?|.)/g,z=/(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,W=/\d\d?/,q=/\d{1,3}/,V=/\d{3}/,B=/\d{1,4}/,Z=/[+\-]?\d{1,6}/,X=/[0-9]*[a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF]+\s*?[\u0600-\u06FF]+/i,K=/Z|[\+\-]\d\d:?\d\d/i,G=/T/i,J=/[\+\-]?\d+(\.\d{1,3})?/,Q=/^\s*\d{4}-\d\d-\d\d((T| )(\d\d(:\d\d(:\d\d(\.\d\d?\d?)?)?)?)?([\+\-]\d\d:?\d\d)?)?/,$="YYYY-MM-DDTHH:mm:ssZ",te=[["HH:mm:ss.S",/(T| )\d\d:\d\d:\d\d\.\d{1,3}/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],ee=/([\+\-]|\d\d)/gi,ne="Month|Date|Hours|Minutes|Seconds|Milliseconds".split("|"),ie={Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6},oe={},re="DDD w W M D d".split(" "),se="M D H h m s w W".split(" "),ae={M:function(){return this.month()+1},MMM:function(t){return this.lang().monthsShort(this,t)},MMMM:function(t){return this.lang().months(this,t)},D:function(){return this.date()},DDD:function(){return this.dayOfYear()},d:function(){return this.day()},dd:function(t){return this.lang().weekdaysMin(this,t)},ddd:function(t){return this.lang().weekdaysShort(this,t)},dddd:function(t){return this.lang().weekdays(this,t)},w:function(){return this.week()},W:function(){return this.isoWeek()},YY:function(){return u(this.year()%100,2)},YYYY:function(){return u(this.year(),4)},YYYYY:function(){return u(this.year(),5)},a:function(){return this.lang().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.lang().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return~~(this.milliseconds()/100)},SS:function(){return u(~~(this.milliseconds()/10),2)},SSS:function(){return u(this.milliseconds(),3)},Z:function(){var t=-this.zone(),e="+";return 0>t&&(t=-t,e="-"),e+u(~~(t/60),2)+":"+u(~~t%60,2)},ZZ:function(){var t=-this.zone(),e="+";return 0>t&&(t=-t,e="-"),e+u(~~(10*t/6),4)},X:function(){return this.unix()}};re.length;)H=re.pop(),ae[H+"o"]=r(ae[H]);for(;se.length;)H=se.pop(),ae[H+H]=o(ae[H],2);for(ae.DDDD=o(ae.DDD,3),s.prototype={set:function(t){var e,n;for(n in t)e=t[n],"function"==typeof e?this[n]=e:this["_"+n]=e},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(t){return this._months[t.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(t){return this._monthsShort[t.month()]},monthsParse:function(t){var e,n,i;for(this._monthsParse||(this._monthsParse=[]),e=0;12>e;e++)if(this._monthsParse[e]||(n=k([2e3,e]),i="^"+this.months(n,"")+"|^"+this.monthsShort(n,""),this._monthsParse[e]=RegExp(i.replace(".",""),"i")),this._monthsParse[e].test(t))return e},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(t){return this._weekdays[t.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(t){return this._weekdaysShort[t.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(t){return this._weekdaysMin[t.day()]},_longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY LT",LLLL:"dddd, MMMM D YYYY LT"},longDateFormat:function(t){var e=this._longDateFormat[t];return!e&&this._longDateFormat[t.toUpperCase()]&&(e=this._longDateFormat[t.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(t){return t.slice(1)}),this._longDateFormat[t]=e),e},meridiem:function(t,e,n){return t>11?n?"pm":"PM":n?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[last] dddd [at] LT",sameElse:"L"},calendar:function(t,e){var n=this._calendar[t];return"function"==typeof n?n.apply(e):n},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(t,e,n,i){var o=this._relativeTime[n];return"function"==typeof o?o(t,e,n,i):o.replace(/%d/i,t)},pastFuture:function(t,e){var n=this._relativeTime[t>0?"future":"past"];return"function"==typeof n?n(e):n.replace(/%s/i,e)},ordinal:function(t){return this._ordinal.replace("%d",t)},_ordinal:"%d",preparse:function(t){return t},postformat:function(t){return t},week:function(t){return x(t,this._week.dow,this._week.doy)},_week:{dow:0,doy:6}},k=function(t,e,n){return N({_i:t,_f:e,_l:n,_isUTC:!1})},k.utc=function(t,e,n){return N({_useUTC:!0,_isUTC:!0,_l:n,_i:t,_f:e})},k.unix=function(t){return k(1e3*t)},k.duration=function(t,e){var n,i=k.isDuration(t),o="number"==typeof t,r=i?t._data:o?{}:t;return o&&(e?r[e]=t:r.milliseconds=t),n=new h(r),i&&t.hasOwnProperty("_lang")&&(n._lang=t._lang),n},k.version=I,k.defaultFormat=$,k.lang=function(t,e){return t?(e?m(t,e):R[t]||g(t),k.duration.fn._lang=k.fn._lang=g(t),i):k.fn._lang._abbr},k.langData=function(t){return t&&t._lang&&t._lang._abbr&&(t=t._lang._abbr),g(t)},k.isMoment=function(t){return t instanceof a},k.isDuration=function(t){return t instanceof h},k.fn=a.prototype={clone:function(){return k(this)},valueOf:function(){return+this._d},unix:function(){return Math.floor(+this._d/1e3)},toString:function(){return this.format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._d},toJSON:function(){return k.utc(this).format("YYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},toArray:function(){var t=this;return[t.year(),t.month(),t.date(),t.hours(),t.minutes(),t.seconds(),t.milliseconds()]},isValid:function(){return null==this._isValid&&(this._isValid=this._a?!f(this._a,(this._isUTC?k.utc(this._a):k(this._a)).toArray()):!isNaN(this._d.getTime())),!!this._isValid},utc:function(){return this._isUTC=!0,this},local:function(){return this._isUTC=!1,this},format:function(t){var e=S(this,t||k.defaultFormat);return this.lang().postformat(e)},add:function(t,e){var n;return n="string"==typeof t?k.duration(+e,t):k.duration(t,e),d(this,n,1),this},subtract:function(t,e){var n;return n="string"==typeof t?k.duration(+e,t):k.duration(t,e),d(this,n,-1),this},diff:function(t,e,n){var i,o,r=this._isUTC?k(t).utc():k(t).local(),s=6e4*(this.zone()-r.zone());return e&&(e=e.replace(/s$/,"")),"year"===e||"month"===e?(i=432e5*(this.daysInMonth()+r.daysInMonth()),o=12*(this.year()-r.year())+(this.month()-r.month()),o+=(this-k(this).startOf("month")-(r-k(r).startOf("month")))/i,"year"===e&&(o/=12)):(i=this-r-s,o="second"===e?i/1e3:"minute"===e?i/6e4:"hour"===e?i/36e5:"day"===e?i/864e5:"week"===e?i/6048e5:i),n?o:c(o)},from:function(t,e){return k.duration(this.diff(t)).lang(this.lang()._abbr).humanize(!e)},fromNow:function(t){return this.from(k(),t)},calendar:function(){var t=this.diff(k().startOf("day"),"days",!0),e=-6>t?"sameElse":-1>t?"lastWeek":0>t?"lastDay":1>t?"sameDay":2>t?"nextDay":7>t?"nextWeek":"sameElse";return this.format(this.lang().calendar(e,this))},isLeapYear:function(){var t=this.year();return 0===t%4&&0!==t%100||0===t%400},isDST:function(){return this.zone()+k(t).startOf(e)},isBefore:function(t,e){return e=e!==i?e:"millisecond",+this.clone().startOf(e)<+k(t).startOf(e)},isSame:function(t,e){return e=e!==i?e:"millisecond",+this.clone().startOf(e)===+k(t).startOf(e)},zone:function(){return this._isUTC?0:this._d.getTimezoneOffset()},daysInMonth:function(){return k.utc([this.year(),this.month()+1,0]).date()},dayOfYear:function(t){var e=j((k(this).startOf("day")-k(this).startOf("year"))/864e5)+1;return null==t?e:this.add("d",t-e)},isoWeek:function(t){var e=x(this,1,4);return null==t?e:this.add("d",7*(t-e))},week:function(t){var e=this.lang().week(this);return null==t?e:this.add("d",7*(t-e))},lang:function(t){return t===i?this._lang:(this._lang=g(t),this)}},H=0;ne.length>H;H++)A(ne[H].toLowerCase().replace(/s$/,""),ne[H]);A("year","FullYear"),k.fn.days=k.fn.day,k.fn.weeks=k.fn.week,k.fn.isoWeeks=k.fn.isoWeek,k.duration.fn=h.prototype={weeks:function(){return c(this.days()/7)},valueOf:function(){return this._milliseconds+864e5*this._days+2592e6*this._months},humanize:function(t){var e=+this,n=L(e,!t,this.lang());return t&&(n=this.lang().pastFuture(e,n)),this.lang().postformat(n)},lang:k.fn.lang};for(H in ie)ie.hasOwnProperty(H)&&(Y(H,ie[H]),O(H.toLowerCase()));Y("Weeks",6048e5),k.lang("en",{ordinal:function(t){var e=t%10,n=1===~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th";return t+n}}),U&&(n.exports=k),"undefined"==typeof ender&&(this.moment=k),"function"==typeof t&&t.amd&&t("moment",[],function(){return k})}).call(this)})()},{}]},{},[1])(1)}); \ No newline at end of file