vis.js is a dynamic, browser-based visualization library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

27 lines
71 KiB

/**
* vis.js
* https://github.com/almende/vis
*
* A dynamic, browser-based visualization library.
*
* @version 0.0.5
* @date 2013-04-23
*
* @license
* Copyright (C) 2011-2013 Almende B.V, http://almende.com
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
function DataSet(t){var e=this;this.options=t||{},this.data={},this.fieldId=this.options.fieldId||"id",this.fieldTypes={},this.options.fieldTypes&&util.forEach(this.options.fieldTypes,function(t,i){e.fieldTypes[i]="Date"==t||"ISODate"==t||"ASPDate"==t?"Date":t}),this.subscribers={},this.internalIds={}}function Stack(t,e){this.parent=t,this.options={order:function(t,e){return e.width-t.width||t.left-e.left}},this.ordered=[],this.setOptions(e)}function Range(t){this.id=util.randomUUID(),this.start=0,this.end=0,this.options={min:null,max:null,zoomMin:null,zoomMax:null},this.setOptions(t),this.listeners=[]}function Controller(){this.id=util.randomUUID(),this.components={},this.repaintTimer=void 0,this.reflowTimer=void 0}function Component(){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 Panel(t,e,i){this.id=util.randomUUID(),this.parent=t,this.depends=e,this.options={},this.setOptions(i)}function RootPanel(t,e){this.id=util.randomUUID(),this.container=t,this.options={autoResize:!0},this.listeners={},this.setOptions(e)}function TimeAxis(t,e,i){this.id=util.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(i)}function ItemSet(t,e,i){this.id=util.randomUUID(),this.parent=t,this.depends=e,this.options={style:"box",align:"center",orientation:"bottom",margin:{axis:20,item:10},padding:5};var n=this;this.data=null,this.range=null,this.listeners={add:function(t,e){n._onAdd(e.items)},update:function(t,e){n._onUpdate(e.items)},remove:function(t,e){n._onRemove(e.items)}},this.items={},this.queue={},this.stack=new Stack(this),this.conversion=null,this.setOptions(i)}function Item(t,e,i){this.parent=t,this.data=e,this.selected=!1,this.visible=!0,this.dom=null,this.options=i}function ItemBox(t,e,i){this.props={dot:{left:0,top:0,width:0,height:0},line:{top:0,left:0,width:0,height:0}},Item.call(this,t,e,i)}function ItemPoint(t,e,i){this.props={dot:{top:0,width:0,height:0},content:{height:0,marginLeft:0}},Item.call(this,t,e,i)}function ItemRange(t,e,i){this.props={content:{left:0,width:0}},Item.call(this,t,e,i)}function Timeline(t,e,i){var n=this;if(this.options={orientation:"bottom",zoomMin:10,zoomMax:31536e10,moveable:!0,zoomable:!0},this.controller=new Controller,!t)throw Error("No container element provided");this.main=new RootPanel(t,{autoResize:!1,height:function(){return n.timeaxis.height+n.itemset.height}}),this.controller.add(this.main);var o=moment().hours(0).minutes(0).seconds(0).milliseconds(0);this.range=new Range({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(){n.controller.requestReflow()}),this.range.on("rangechanged",function(){n.controller.requestReflow()}),this.timeaxis=new TimeAxis(this.main,null,{orientation:this.options.orientation,range:this.range}),this.timeaxis.setRange(this.range),this.controller.add(this.timeaxis),this.itemset=new ItemSet(this.main,[this.timeaxis],{orientation:this.options.orientation}),this.itemset.setRange(this.range),e&&this.setData(e),this.controller.add(this.itemset),this.setOptions(i)}var util={};util.isNumber=function(t){return t instanceof Number||"number"==typeof t},util.isString=function(t){return t instanceof String||"string"==typeof t},util.isDate=function(t){if(t instanceof Date)return!0;if(util.isString(t)){var e=ASPDateRegex.exec(t);if(e)return!0;if(!isNaN(Date.parse(t)))return!0}return!1},util.isDataTable=function(t){return"undefined"!=typeof google&&google.visualization&&google.visualization.DataTable&&t instanceof google.visualization.DataTable},util.randomUUID=function(){var t=function(){return Math.floor(65536*Math.random()).toString(16)};return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()},util.extend=function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t},util.cast=function(t,e){if(void 0===t)return void 0;if(null===t)return null;if(!e)return t;if("function"==typeof e)return e(t);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(util.isNumber(t))return new Date(t);if(t instanceof Date)return new Date(t.valueOf());if(util.isString(t)){var i=ASPDateRegex.exec(t);return i?new Date(Number(i[1])):moment(t).toDate()}throw Error("Cannot cast object of type "+util.getType(t)+" to type Date");case"ISODate":if(t instanceof Date)return t.toISOString();if(util.isNumber(t)||util.isString(t))return moment(t).toDate().toISOString();throw Error("Cannot cast object of type "+util.getType(t)+" to type ISODate");case"ASPDate":if(t instanceof Date)return"/Date("+t.valueOf()+")/";if(util.isNumber(t)||util.isString(t))return"/Date("+moment(t).valueOf()+")/";throw Error("Cannot cast object of type "+util.getType(t)+" to type ASPDate");default:throw Error("Cannot cast object of type "+util.getType(t)+' to type "'+e+'"')}};var ASPDateRegex=/^\/?Date\((\-?\d+)/i;if(util.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},util.getAbsoluteLeft=function(t){for(var e=document.documentElement,i=document.body,n=t.offsetLeft,o=t.offsetParent;null!=o&&o!=i&&o!=e;)n+=o.offsetLeft,n-=o.scrollLeft,o=o.offsetParent;return n},util.getAbsoluteTop=function(t){for(var e=document.documentElement,i=document.body,n=t.offsetTop,o=t.offsetParent;null!=o&&o!=i&&o!=e;)n+=o.offsetTop,n-=o.scrollTop,o=o.offsetParent;return n},util.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 i=document.documentElement,n=document.body;return e+(i&&i.scrollTop||n&&n.scrollTop||0)-(i&&i.clientTop||n&&n.clientTop||0)},util.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 i=document.documentElement,n=document.body;return e+(i&&i.scrollLeft||n&&n.scrollLeft||0)-(i&&i.clientLeft||n&&n.clientLeft||0)},util.addClassName=function(t,e){var i=t.className.split(" ");-1==i.indexOf(e)&&(i.push(e),t.className=i.join(" "))},util.removeClassName=function(t,e){var i=t.className.split(" "),n=i.indexOf(e);-1!=n&&(i.splice(n,1),t.className=i.join(" "))},util.forEach=function(t,e){if(t instanceof Array)t.forEach(e);else for(var i in t)t.hasOwnProperty(i)&&e(t[i],i,t)},util.updateProperty=function(t,e,i){return t[e]!==i?(t[e]=i,!0):!1},util.addEventListener=function(t,e,i,n){t.addEventListener?(void 0===n&&(n=!1),"mousewheel"===e&&navigator.userAgent.indexOf("Firefox")>=0&&(e="DOMMouseScroll"),t.addEventListener(e,i,n)):t.attachEvent("on"+e,i)},util.removeEventListener=function(t,e,i,n){t.removeEventListener?(void 0===n&&(n=!1),"mousewheel"===e&&navigator.userAgent.indexOf("Firefox")>=0&&(e="DOMMouseScroll"),t.removeEventListener(e,i,n)):t.detachEvent("on"+e,i)},util.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},util.stopPropagation=function(t){t||(t=window.event),t.stopPropagation?t.stopPropagation():t.cancelBubble=!0},util.preventDefault=function(t){t||(t=window.event),t.preventDefault?t.preventDefault():t.returnValue=!1},util.option={},util.option.asBoolean=function(t,e){return"function"==typeof t&&(t=t()),null!=t?0!=t:e||null},util.option.asString=function(t,e){return"function"==typeof t&&(t=t()),null!=t?t+"":e||null},util.option.asSize=function(t,e){return"function"==typeof t&&(t=t()),util.isString(t)?t:util.isNumber(t)?t+"px":e||null},util.option.asElement=function(t,e){return"function"==typeof t&&(t=t()),t||e||null},!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(err){}}Array.prototype.forEach||(Array.prototype.forEach=function(t,e){for(var i=0,n=this.length;n>i;++i)t.call(e||this,this[i],i,this)}),Array.prototype.map||(Array.prototype.map=function(t,e){var i,n,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&&(i=e),n=Array(s),o=0;s>o;){var a,h;o in r&&(a=r[o],h=t.call(i,a,o,r),n[o]=h),o++}return n}),Array.prototype.filter||(Array.prototype.filter=function(t){"use strict";if(null==this)throw new TypeError;var e=Object(this),i=e.length>>>0;if("function"!=typeof t)throw new TypeError;for(var n=[],o=arguments[1],r=0;i>r;r++)if(r in e){var s=e[r];t.call(o,s,r,e)&&n.push(s)}return n}),Object.keys||(Object.keys=function(){var t=Object.prototype.hasOwnProperty,e=!{toString:null}.propertyIsEnumerable("toString"),i=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],n=i.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;n>a;a++)t.call(o,i[a])&&r.push(i[a]);return r}}()),Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)});var events={listeners:[],indexOf:function(t){for(var e=this.listeners,i=0,n=this.listeners.length;n>i;i++){var o=e[i];if(o&&o.object==t)return i}return-1},addListener:function(t,e,i){var n=this.indexOf(t),o=this.listeners[n];o||(o={object:t,events:{}},this.listeners.push(o));var r=o.events[e];r||(r=[],o.events[e]=r),-1==r.indexOf(i)&&r.push(i)},removeListener:function(t,e,i){var n=this.indexOf(t),o=this.listeners[n];if(o){var r=o.events[e];r&&(n=r.indexOf(i),-1!=n&&r.splice(n,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[n]}},removeAllListeners:function(){this.listeners=[]},trigger:function(t,e,i){var n=this.indexOf(t),o=this.listeners[n];if(o){var r=o.events[e];if(r)for(var s=0,a=r.length;a>s;s++)r[s](i)}}};TimeStep=function(t,e,i){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,i)},TimeStep.SCALE={MILLISECOND:1,SECOND:2,MINUTE:3,HOUR:4,DAY:5,WEEKDAY:6,MONTH:7,YEAR:8},TimeStep.prototype.setRange=function(t,e,i){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(i))},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()<this.step&&this.current.setMilliseconds(0);break;case TimeStep.SCALE.SECOND:this.current.getSeconds()<this.step&&this.current.setSeconds(0);break;case TimeStep.SCALE.MINUTE:this.current.getMinutes()<this.step&&this.current.setMinutes(0);break;case TimeStep.SCALE.HOUR:this.current.getHours()<this.step&&this.current.setHours(0);break;case TimeStep.SCALE.WEEKDAY:case TimeStep.SCALE.DAY:this.current.getDate()<this.step+1&&this.current.setDate(1);break;case TimeStep.SCALE.MONTH:this.current.getMonth()<this.step&&this.current.setMonth(0);break;case TimeStep.SCALE.YEAR:break;default:}this.current.valueOf()==t&&(this.current=new Date(this._end.valueOf()))},TimeStep.prototype.getCurrent=function(){return this.current},TimeStep.prototype.setScale=function(t,e){this.scale=t,e>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,i=2592e6,n=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*i>t&&(this.scale=TimeStep.SCALE.MONTH,this.step=3),i>t&&(this.scale=TimeStep.SCALE.MONTH,this.step=1),5*n>t&&(this.scale=TimeStep.SCALE.DAY,this.step=5),2*n>t&&(this.scale=TimeStep.SCALE.DAY,this.step=2),n>t&&(this.scale=TimeStep.SCALE.DAY,this.step=1),n/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 i=this.step>5?this.step/2:1;t.setMilliseconds(Math.round(t.getMilliseconds()/i)*i)}},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 moment(t).format("SSS");case TimeStep.SCALE.SECOND:return moment(t).format("s");case TimeStep.SCALE.MINUTE:return moment(t).format("HH:mm");case TimeStep.SCALE.HOUR:return moment(t).format("HH:mm");case TimeStep.SCALE.WEEKDAY:return moment(t).format("ddd D");case TimeStep.SCALE.DAY:return moment(t).format("D");case TimeStep.SCALE.MONTH:return moment(t).format("MMM");case TimeStep.SCALE.YEAR:return moment(t).format("YYYY");default:return""}},TimeStep.prototype.getLabelMajor=function(t){switch(void 0==t&&(t=this.current),this.scale){case TimeStep.SCALE.MILLISECOND:return moment(t).format("HH:mm:ss");case TimeStep.SCALE.SECOND:return moment(t).format("D MMMM HH:mm");case TimeStep.SCALE.MINUTE:case TimeStep.SCALE.HOUR:return moment(t).format("ddd D MMMM");case TimeStep.SCALE.WEEKDAY:case TimeStep.SCALE.DAY:return moment(t).format("MMMM YYYY");case TimeStep.SCALE.MONTH:return moment(t).format("YYYY");case TimeStep.SCALE.YEAR:return"";default:return""}},DataSet.prototype.subscribe=function(t,e,i){var n=this.subscribers[t];n||(n=[],this.subscribers[t]=n),n.push({id:i?i+"":null,callback:e})},DataSet.prototype.unsubscribe=function(t,e){var i=this.subscribers[t];i&&(this.subscribers[t]=i.filter(function(t){return t.callback!=e}))},DataSet.prototype._trigger=function(t,e,i){if("*"==t)throw Error("Cannot trigger event *");var n=[];t in this.subscribers&&(n=n.concat(this.subscribers[t])),"*"in this.subscribers&&(n=n.concat(this.subscribers["*"])),n.forEach(function(n){n.id!=i&&n.callback&&n.callback(t,e,i||null)})},DataSet.prototype.add=function(t,e){var i,n=[],o=this;if(t instanceof Array)t.forEach(function(t){var e=o._addItem(t);n.push(e)});else if(util.isDataTable(t))for(var r=this._getColumnNames(t),s=0,a=t.getNumberOfRows();a>s;s++){var h={};r.forEach(function(e,i){h[e]=t.getValue(s,i)}),i=o._addItem(h),n.push(i)}else{if(!(t instanceof Object))throw Error("Unknown dataType");i=o._addItem(t),n.push(i)}this._trigger("add",{items:n},e)},DataSet.prototype.update=function(t,e){var i,n=[],o=this;if(t instanceof Array)t.forEach(function(t){var e=o._updateItem(t);n.push(e)});else if(util.isDataTable(t))for(var r=this._getColumnNames(t),s=0,a=t.getNumberOfRows();a>s;s++){var h={};r.forEach(function(e,i){h[e]=t.getValue(s,i)}),i=o._updateItem(h),n.push(i)}else{if(!(t instanceof Object))throw Error("Unknown dataType");i=o._updateItem(t),n.push(i)}this._trigger("update",{items:n},e)},DataSet.prototype.get=function(t,e,i){var n=this;"Object"==util.getType(t)&&(i=e,e=t,t=void 0);var o={};this.options&&this.options.fieldTypes&&util.forEach(this.options.fieldTypes,function(t,e){o[e]=t}),e&&e.fieldTypes&&util.forEach(e.fieldTypes,function(t,e){o[e]=t});var r,s=e?e.fields:void 0;if(e&&e.type){if(r="DataTable"==e.type?"DataTable":"Array",i&&r!=util.getType(i))throw Error('Type of parameter "data" ('+util.getType(i)+") "+"does not correspond with specified options.type ("+e.type+")");if("DataTable"==r&&!util.isDataTable(i))throw Error('Parameter "data" must be a DataTable when options.type is "DataTable"')}else r=i?"DataTable"==util.getType(i)?"DataTable":"Array":"Array";if("DataTable"==r){var a=this._getColumnNames(i);if(void 0==t)util.forEach(this.data,function(t){n._appendRow(i,a,n._castItem(t))});else if(util.isNumber(t)||util.isString(t)){var h=n._castItem(n.data[t],o,s);this._appendRow(i,a,h)}else{if(!(t instanceof Array))throw new TypeError('Parameter "ids" must be undefined, a String, Number, or Array');t.forEach(function(t){var e=n._castItem(n.data[t],o,s);n._appendRow(i,a,e)})}}else if(i=i||[],void 0==t)util.forEach(this.data,function(t){i.push(n._castItem(t,o,s))});else{if(util.isNumber(t)||util.isString(t))return this._castItem(n.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){i.push(n._castItem(n.data[t],o,s))})}return i},DataSet.prototype.remove=function(t,e){var i=[],n=this;if(util.isNumber(t)||util.isString(t))delete this.data[t],delete this.internalIds[t],i.push(t);else if(t instanceof Array)t.forEach(function(t){n.remove(t)}),i=i.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],i.push(o));this._trigger("remove",{items:i},e)},DataSet.prototype.clear=function(t){var e=Object.keys(this.data);this.data={},this.internalIds={},this._trigger("remove",{items:e},t)},DataSet.prototype.max=function(t){var e=this.data,i=Object.keys(e),n=null,o=null;return i.forEach(function(i){var r=e[i],s=r[t];null!=s&&(!n||s>o)&&(n=r,o=s)}),n},DataSet.prototype.min=function(t){var e=this.data,i=Object.keys(e),n=null,o=null;return i.forEach(function(i){var r=e[i],s=r[t];null!=s&&(!n||o>s)&&(n=r,o=s)}),n},DataSet.prototype._addItem=function(t){var e=t[this.fieldId];void 0==e&&(e=util.randomUUID(),t[this.fieldId]=e,this.internalIds[e]=t);var i={};for(var n in t)if(t.hasOwnProperty(n)){var o=this.fieldTypes[n];i[n]=util.cast(t[n],o)}return this.data[e]=i,e},DataSet.prototype._castItem=function(t,e,i){var n,o=this.fieldId,r=this.internalIds;return t?(n={},e=e||{},i?util.forEach(t,function(t,o){-1!=i.indexOf(o)&&(n[o]=util.cast(t,e[o]))}):util.forEach(t,function(t,i){i==o&&t in r||(n[i]=util.cast(t,e[i]))})):n=null,n},DataSet.prototype._updateItem=function(t){var e=t[this.fieldId];if(void 0==e)throw Error("Item has no id (item: "+JSON.stringify(t)+")");var i=this.data[e];if(i){for(var n in t)if(t.hasOwnProperty(n)){var o=this.fieldTypes[n];i[n]=util.cast(t[n],o)}}else this._addItem(t);return e},DataSet.prototype._getColumnNames=function(t){for(var e=[],i=0,n=t.getNumberOfColumns();n>i;i++)e[i]=t.getColumnId(i)||t.getColumnLabel(i);return e},DataSet.prototype._appendRow=function(t,e,i){var n=t.addRow();e.forEach(function(e,o){t.setValue(n,o,i[e])})},Stack.prototype.setOptions=function(t){util.extend(this.options,t)},Stack.prototype.update=function(){this._order(),this._stack()},Stack.prototype._order=function(){var t=this.parent.items;if(!t)throw Error("Cannot stack items: parent does not contain items");var e=[],i=0;util.forEach(t,function(t){e[i]=t,i++});var n=this.options.order;if("function"!=typeof this.options.order)throw Error("Option order must be a function");e.sort(n),this.ordered=e},Stack.prototype._stack=function(){var t,e,i=this.ordered,n=this.options,o="top"==n.orientation,r=n.margin&&n.margin.item||0;for(t=0,e=i.length;e>t;t++){var s=i[t],a=null;do a=this.checkOverlap(i,t,0,t-1,r),null!=a&&(s.top=o?a.top+a.height+r:a.top-s.height-r);while(a)}},Stack.prototype.checkOverlap=function(t,e,i,n,o){for(var r=this.collision,s=t[e],a=n;a>=i;a--){var h=t[a];if(r(s,h,o)&&a!=e)return h}return null},Stack.prototype.collision=function(t,e,i){return t.left-i<e.left+e.width&&t.left+t.width+i>e.left&&t.top-i<e.top+e.height&&t.top+t.height+i>e.top},Range.prototype.setOptions=function(t){util.extend(this.options,t),(null!=t.start||null!=t.end)&&this.setRange(t.start,t.end)},Range.prototype.subscribe=function(t,e,i){var n,o=this;if("horizontal"!=i&&"vertical"!=i)throw new TypeError('Unknown direction "'+i+'". '+'Choose "horizontal" or "vertical".');if("move"==e)n={component:t,event:e,direction:i,callback:function(t){o._onMouseDown(t,n)},params:{}},t.on("mousedown",n.callback),o.listeners.push(n);else{if("zoom"!=e)throw new TypeError('Unknown event "'+e+'". '+'Choose "move" or "zoom".');n={component:t,event:e,direction:i,callback:function(t){o._onMouseWheel(t,n)},params:{}},t.on("mousewheel",n.callback),o.listeners.push(n)}},Range.prototype.on=function(t,e){events.addListener(this,t,e)},Range.prototype._trigger=function(t){events.trigger(this,t,{start:this.start,end:this.end})},Range.prototype.setRange=function(t,e){var i=this._applyRange(t,e);i&&(this._trigger("rangechange"),this._trigger("rangechanged"))},Range.prototype._applyRange=function(t,e){var i,n=null!=t?util.cast(t,"Number"):this.start,o=null!=e?util.cast(e,"Number"):this.end;if(isNaN(n))throw Error('Invalid start "'+t+'"');if(isNaN(o))throw Error('Invalid end "'+e+'"');if(n>o&&(o=n),null!=this.options.min){var r=this.options.min.valueOf();r>n&&(i=r-n,n+=i,o+=i)}if(null!=this.options.max){var s=this.options.max.valueOf();o>s&&(i=o-s,n-=i,o-=i)}if(null!=this.options.zoomMin){var a=this.options.zoomMin.valueOf();0>a&&(a=0),a>o-n&&(this.end-this.start>a?(i=a-(o-n),n-=i/2,o+=i/2):(n=this.start,o=this.end))}if(null!=this.options.zoomMax){var h=this.options.zoomMax.valueOf();0>h&&(h=0),o-n>h&&(h>this.end-this.start?(i=o-n-h,n+=i/2,o-=i/2):(n=this.start,o=this.end))}var u=this.start!=n||this.end!=o;return this.start=n,this.end=o,u},Range.prototype.getRange=function(){return{start:this.start,end:this.end}},Range.prototype.conversion=function(t){return this.start,this.end,Range.conversion(this.start,this.end,t)},Range.conversion=function(t,e,i){return 0!=i&&0!=e-t?{offset:t,factor:i/(e-t)}:{offset:0,factor:1}},Range.prototype._onMouseDown=function(t,e){t=t||window.event;var i=e.params,n=t.which?1==t.which:1==t.button;if(n){i.mouseX=util.getPageX(t),i.mouseY=util.getPageY(t),i.previousLeft=0,i.previousOffset=0,i.moved=!1,i.start=this.start,i.end=this.end;var o=e.component.frame;o&&(o.style.cursor="move");var r=this;i.onMouseMove||(i.onMouseMove=function(t){r._onMouseMove(t,e)},util.addEventListener(document,"mousemove",i.onMouseMove)),i.onMouseUp||(i.onMouseUp=function(t){r._onMouseUp(t,e)},util.addEventListener(document,"mouseup",i.onMouseUp)),util.preventDefault(t)}},Range.prototype._onMouseMove=function(t,e){t=t||window.event;var i=e.params,n=util.getPageX(t),o=util.getPageY(t);void 0==i.mouseX&&(i.mouseX=n),void 0==i.mouseY&&(i.mouseY=o);var r=n-i.mouseX,s=o-i.mouseY,a="horizontal"==e.direction?r:s;Math.abs(a)>=1&&(i.moved=!0);var h=i.end-i.start,u="horizontal"==e.direction?e.component.width:e.component.height,l=-a/u*h;this._applyRange(i.start+l,i.end+l),this._trigger("rangechange"),util.preventDefault(t)},Range.prototype._onMouseUp=function(t,e){t=t||window.event;var i=e.params;e.component.frame&&(e.component.frame.style.cursor="auto"),i.onMouseMove&&(util.removeEventListener(document,"mousemove",i.onMouseMove),i.onMouseMove=null),i.onMouseUp&&(util.removeEventListener(document,"mouseup",i.onMouseUp),i.onMouseUp=null),i.moved&&this._trigger("rangechanged")},Range.prototype._onMouseWheel=function(t,e){t=t||window.event;var i=0;if(t.wheelDelta?i=t.wheelDelta/120:t.detail&&(i=-t.detail/3),i){var n=this,o=function(){var o=i/5,r=null,s=e.component.frame;if(s){var a,h;if("horizontal"==e.direction){a=e.component.width,h=n.conversion(a);var u=util.getAbsoluteLeft(s),l=util.getPageX(t);r=(l-u)/h.factor+h.offset}else{a=e.component.height,h=n.conversion(a);var c=util.getAbsoluteTop(s),p=util.getPageY(t);r=(c+a-p-c)/h.factor+h.offset}}n.zoom(o,r)};o()}util.preventDefault(t)},Range.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 i=this.start-e,n=this.end-e,o=this.start-i*t,r=this.end-n*t;this.setRange(o,r)},Range.prototype.move=function(t){var e=this.end-this.start,i=this.start+e*t,n=this.end+e*t;this.start=i,this.end=n},Controller.prototype.add=function(t){if(void 0==t.id)throw Error("Component has no field id");if(!(t instanceof Component||t instanceof Controller))throw new TypeError("Component must be an instance of prototype Component or Controller");t.controller=this,this.components[t.id]=t},Controller.prototype.requestReflow=function(){if(!this.reflowTimer){var t=this;this.reflowTimer=setTimeout(function(){t.reflowTimer=void 0,t.reflow()},0)}},Controller.prototype.requestRepaint=function(){if(!this.repaintTimer){var t=this;this.repaintTimer=setTimeout(function(){t.repaintTimer=void 0,t.repaint()},0)}},Controller.prototype.repaint=function(){function t(n,o){o in i||(n.depends&&n.depends.forEach(function(e){t(e,e.id)}),n.parent&&t(n.parent,n.parent.id),e=n.repaint()||e,i[o]=!0)}var e=!1;this.repaintTimer&&(clearTimeout(this.repaintTimer),this.repaintTimer=void 0);var i={};util.forEach(this.components,t),e&&this.reflow()},Controller.prototype.reflow=function(){function t(n,o){o in i||(n.depends&&n.depends.forEach(function(e){t(e,e.id)}),n.parent&&t(n.parent,n.parent.id),e=n.reflow()||e,i[o]=!0)}var e=!1;this.reflowTimer&&(clearTimeout(this.reflowTimer),this.reflowTimer=void 0);var i={};util.forEach(this.components,t),e&&this.repaint()};var loadCss=function(t){var e=document.getElementsByTagName("script");e[e.length-1].src.split("?")[0];var i=document.createElement("style");i.type="text/css",i.styleSheet?i.styleSheet.cssText=t:i.appendChild(document.createTextNode(t)),document.getElementsByTagName("head")[0].appendChild(i)};Component.prototype.setOptions=function(t){t&&util.extend(this.options,t),this.controller&&(this.requestRepaint(),this.requestReflow())
},Component.prototype.getContainer=function(){return null},Component.prototype.getFrame=function(){return this.frame},Component.prototype.repaint=function(){return!1},Component.prototype.reflow=function(){return!1},Component.prototype.requestRepaint=function(){if(!this.controller)throw Error("Cannot request a repaint: no controller configured");this.controller.requestRepaint()},Component.prototype.requestReflow=function(){if(!this.controller)throw Error("Cannot request a reflow: no controller configured");this.controller.requestReflow()},Component.prototype.on=function(t,e){if(!this.parent)throw Error("Cannot attach event: no root panel found");this.parent.on(t,e)},Panel.prototype=new Component,Panel.prototype.getContainer=function(){return this.frame},Panel.prototype.repaint=function(){var t=0,e=util.updateProperty,i=util.option.asSize,n=this.options,o=this.frame;if(o||(o=document.createElement("div"),o.className="panel",n.className&&("function"==typeof n.className?util.addClassName(o,n.className()+""):util.addClassName(o,n.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",i(n.top,"0px")),t+=e(o.style,"left",i(n.left,"0px")),t+=e(o.style,"width",i(n.width,"100%")),t+=e(o.style,"height",i(n.height,"100%")),t>0},Panel.prototype.reflow=function(){var t=0,e=util.updateProperty,i=this.frame;return i?(t+=e(this,"top",i.offsetTop),t+=e(this,"left",i.offsetLeft),t+=e(this,"width",i.offsetWidth),t+=e(this,"height",i.offsetHeight)):t+=1,t>0},RootPanel.prototype=new Panel,RootPanel.prototype.setOptions=function(t){util.extend(this.options,t),this.options.autoResize?this._watch():this._unwatch()},RootPanel.prototype.repaint=function(){var t=0,e=util.updateProperty,i=util.option.asSize,n=this.options,o=this.frame;if(o||(o=document.createElement("div"),o.className="graph panel",n.className&&util.addClassName(o,util.option.asString(n.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",i(n.top,"0px")),t+=e(o.style,"left",i(n.left,"0px")),t+=e(o.style,"width",i(n.width,"100%")),t+=e(o.style,"height",i(n.height,"100%")),this._updateEventEmitters(),t>0},RootPanel.prototype.reflow=function(){var t=0,e=util.updateProperty,i=this.frame;return i?(t+=e(this,"top",i.offsetTop),t+=e(this,"left",i.offsetLeft),t+=e(this,"width",i.offsetWidth),t+=e(this,"height",i.offsetHeight)):t+=1,t>0},RootPanel.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)};util.addEventListener(window,"resize",e),this.watchTimer=setInterval(e,1e3)},RootPanel.prototype._unwatch=function(){this.watchTimer&&(clearInterval(this.watchTimer),this.watchTimer=void 0)},RootPanel.prototype.on=function(t,e){var i=this.listeners[t];i||(i=[],this.listeners[t]=i),i.push(e),this._updateEventEmitters()},RootPanel.prototype._updateEventEmitters=function(){if(this.listeners){var t=this;util.forEach(this.listeners,function(e,i){if(t.emitters||(t.emitters={}),!(i in t.emitters)){var n=t.frame;if(n){var o=function(t){e.forEach(function(e){e(t)})};t.emitters[i]=o,util.addEventListener(n,i,o)}}})}},TimeAxis.prototype=new Component,TimeAxis.prototype.setOptions=function(t){util.extend(this.options,t)},TimeAxis.prototype.setRange=function(t){if(!(t instanceof Range||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},TimeAxis.prototype.toTime=function(t){var e=this.conversion;return new Date(t/e.factor+e.offset)},TimeAxis.prototype.toScreen=function(t){var e=this.conversion;return(t.valueOf()-e.offset)*e.factor},TimeAxis.prototype.repaint=function(){var t=0,e=util.updateProperty,i=util.option.asSize,n=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 "+n.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 u=s.nextSibling;h.removeChild(s);var l=n.orientation,c="bottom"==l&&this.props.parentHeight&&this.height?this.props.parentHeight-this.height+"px":"0px";if(t+=e(s.style,"top",i(n.top,c)),t+=e(s.style,"left",i(n.left,"0px")),t+=e(s.style,"width",i(n.width,"100%")),t+=e(s.style,"height",i(n.height,this.height+"px")),this._repaintMeasureChars(),this.step){this._repaintStart(),r.first();for(var p=void 0,d=0;r.hasNext()&&1e3>d;){d++;var f=r.getCurrent(),m=this.toScreen(f),g=r.isMajor();n.showMinorLabels&&this._repaintMinorText(m,r.getLabelMinor()),g&&n.showMajorLabels?(m>0&&(void 0==p&&(p=m),this._repaintMajorText(m,r.getLabelMajor())),this._repaintMajorLine(m)):this._repaintMinorLine(m),r.next()}if(n.showMajorLabels){var v=this.toTime(0),y=r.getLabelMajor(v),S=y.length*(o.majorCharWidth||10)+10;(void 0==p||p>S)&&this._repaintMajorText(0,y)}this._repaintEnd()}this._repaintLine(),u?h.insertBefore(s,u):h.appendChild(s)}return t>0},TimeAxis.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=[]},TimeAxis.prototype._repaintEnd=function(){util.forEach(this.dom.redundant,function(t){for(;t.length;){var e=t.pop();e&&e.parentNode&&e.parentNode.removeChild(e)}})},TimeAxis.prototype._repaintMinorText=function(t,e){var i=this.dom.redundant.minorTexts.shift();if(!i){var n=document.createTextNode("");i=document.createElement("div"),i.appendChild(n),i.className="text minor",this.frame.appendChild(i)}this.dom.minorTexts.push(i),i.childNodes[0].nodeValue=e,i.style.left=t+"px",i.style.top=this.props.minorLabelTop+"px"},TimeAxis.prototype._repaintMajorText=function(t,e){var i=this.dom.redundant.majorTexts.shift();if(!i){var n=document.createTextNode(e);i=document.createElement("div"),i.className="text major",i.appendChild(n),this.frame.appendChild(i)}this.dom.majorTexts.push(i),i.childNodes[0].nodeValue=e,i.style.top=this.props.majorLabelTop+"px",i.style.left=t+"px"},TimeAxis.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 i=this.props;e.style.top=i.minorLineTop+"px",e.style.height=i.minorLineHeight+"px",e.style.left=t-i.minorLineWidth/2+"px"},TimeAxis.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 i=this.props;e.style.top=i.majorLineTop+"px",e.style.left=t-i.majorLineWidth/2+"px",e.style.height=i.majorLineHeight+"px"},TimeAxis.prototype._repaintLine=function(){var t=this.dom.line,e=this.frame,i=this.options;i.showMinorLabels||i.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)},TimeAxis.prototype._repaintMeasureChars=function(){var t,e=this.dom;if(!e.characterMinor){t=document.createTextNode("0");var i=document.createElement("DIV");i.className="text minor measure",i.appendChild(t),this.frame.appendChild(i),e.measureCharMinor=i}if(!e.characterMajor){t=document.createTextNode("0");var n=document.createElement("DIV");n.className="text major measure",n.appendChild(t),this.frame.appendChild(n),e.measureCharMajor=n}},TimeAxis.prototype.reflow=function(){var t=0,e=util.updateProperty,i=this.frame,n=this.range;if(!n)throw Error("Cannot repaint time axis: no range configured");if(i){t+=e(this,"top",i.offsetTop),t+=e(this,"left",i.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 u=i.parentNode?i.parentNode.offsetHeight:0;switch(u!=o.parentHeight&&(o.parentHeight=u,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(u-o.majorLabelHeight-this.top),o.minorLineWidth=1,o.majorLineTop=0,o.majorLineHeight=Math.max(u-this.top),o.majorLineWidth=1,o.lineTop=o.majorLabelHeight+o.minorLabelHeight;break;default:throw Error('Unkown orientation "'+this.options.orientation+'"')}var l=o.minorLabelHeight+o.majorLabelHeight;t+=e(this,"width",i.offsetWidth),t+=e(this,"height",l),this._updateConversion();var c=util.cast(n.start,"Date"),p=util.cast(n.end,"Date"),d=this.toTime(5*(o.minorCharWidth||10))-this.toTime(0);this.step=new TimeStep(c,p,d),t+=e(o.range,"start",c.valueOf()),t+=e(o.range,"end",p.valueOf()),t+=e(o.range,"minimumStep",d.valueOf())}return t>0},TimeAxis.prototype._updateConversion=function(){var t=this.range;if(!t)throw Error("No range configured");this.conversion=t.conversion?t.conversion(this.width):Range.conversion(t.start,t.end,this.width)},ItemSet.prototype=new Panel,ItemSet.prototype.setOptions=function(t){util.extend(this.options,t),this.stack.setOptions(this.options)},ItemSet.prototype.setRange=function(t){if(!(t instanceof Range||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},ItemSet.prototype.repaint=function(){var t=0,e=util.updateProperty,i=util.option.asSize,n=this.options,o=this.frame;if(o||(o=document.createElement("div"),o.className="itemset",n.className&&util.addClassName(o,util.option.asString(n.className)),this.frame=o,t+=1),!o.parentNode){if(!this.parent)throw Error("Cannot repaint itemset: no parent attached");var r=this.parent.getContainer();if(!r)throw Error("Cannot repaint itemset: parent has no container element");r.appendChild(o),t+=1}t+=e(o.style,"height",i(n.height,this.height+"px")),t+=e(o.style,"top",i(n.top,"0px")),t+=e(o.style,"left",i(n.left,"0px")),t+=e(o.style,"width",i(n.width,"100%")),this._updateConversion();var s=this,a=this.queue,h=this.data,u=this.items,l={fields:["id","start","end","content","type"]};return Object.keys(a).forEach(function(e){var i=a[e],o=i.item;switch(i.action){case"add":case"update":var r=h.get(e,l),c=r.type||r.start&&r.end&&"range"||"box",p=itemTypes[c];if(o&&(p&&o instanceof p?(o.data=r,t+=o.repaint()):(o.visible=!1,t+=o.repaint(),o=null)),!o){if(!p)throw new TypeError('Unknown item type "'+c+'"');o=new p(s,r,n),t+=o.repaint()}u[e]=o,delete a[e];break;case"remove":o&&(o.visible=!1,t+=o.repaint()),delete u[e],delete a[e];break;default:console.log('Error: unknown action "'+i.action+'"')}}),util.forEach(this.items,function(t){t.reposition()}),t>0},ItemSet.prototype.reflow=function(){var t=0,e=this.options,i=util.updateProperty,n=this.frame;if(n){if(this._updateConversion(),util.forEach(this.items,function(e){t+=e.reflow()}),this.stack.update(),null!=e.height)t+=i(this,"height",n.offsetHeight);else{var o=this.height,r=0;"top"==e.orientation?util.forEach(this.items,function(t){r=Math.max(r,t.top+t.height)}):util.forEach(this.items,function(t){r=Math.max(r,o-t.top)}),t+=i(this,"height",r+e.margin.axis)}t+=i(this,"top",n.offsetTop),t+=i(this,"left",n.offsetLeft),t+=i(this,"width",n.offsetWidth)}else t+=1;return t>0},ItemSet.prototype.setData=function(t){var e=this.data;e&&util.forEach(this.listeners,function(t,i){e.unsubscribe(i,t)}),t instanceof DataSet?this.data=t:(this.data=new DataSet({fieldTypes:{start:"Date",end:"Date"}}),this.data.add(t));var i=this.id,n=this;util.forEach(this.listeners,function(t,e){n.data.subscribe(e,t,i)});var o=this.data.get({filter:["id"]}),r=[];util.forEach(o,function(t,e){r[e]=t.id}),this._onAdd(r)},ItemSet.prototype.getDataRange=function(){var t=this.data,e=t.min("start");e=e?e.start.valueOf():null;var i=t.max("start"),n=t.max("end");i=i?i.start.valueOf():null,n=n?n.end.valueOf():null;var o=Math.max(i,n);return{min:new Date(e),max:new Date(o)}},ItemSet.prototype._onUpdate=function(t){this._toQueue(t,"update")},ItemSet.prototype._onAdd=function(t){this._toQueue(t,"add")},ItemSet.prototype._onRemove=function(t){this._toQueue(t,"remove")},ItemSet.prototype._toQueue=function(t,e){var i=this.items,n=this.queue;t.forEach(function(t){var o=n[t];o?o.action=e:n[t]={item:i[t]||null,action:e}}),this.controller&&this.requestRepaint()},ItemSet.prototype._updateConversion=function(){var t=this.range;if(!t)throw Error("No range configured");this.conversion=t.conversion?t.conversion(this.width):Range.conversion(t.start,t.end,this.width)},ItemSet.prototype.toTime=function(t){var e=this.conversion;return new Date(t/e.factor+e.offset)},ItemSet.prototype.toScreen=function(t){var e=this.conversion,i=(t.valueOf()-e.offset)*e.factor;return i},Item.prototype=new Component,Item.prototype.select=function(){this.selected=!0},Item.prototype.unselect=function(){this.selected=!1};var itemTypes={};ItemBox.prototype=new Item(null,null),itemTypes.box=ItemBox,ItemBox.prototype.select=function(){this.selected=!0},ItemBox.prototype.unselect=function(){this.selected=!1},ItemBox.prototype.repaint=function(){var t=!1,e=this.dom;if(this.visible){if(e||(this._create(),t=!0),e=this.dom){if(!this.options&&!this.parent)throw Error("Cannot repaint item: no parent attached");var i=this.parent.getContainer();if(!i)throw Error("Cannot repaint time axis: parent has no container element");if(e.box.parentNode||(i.appendChild(e.box),t=!0),e.line.parentNode||(i.appendChild(e.line),t=!0),e.dot.parentNode||(i.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 n=(this.data.className?" "+this.data.className:"")+(this.selected?" selected":"");this.className!=n&&(this.className=n,e.box.className="item box"+n,e.line.className="item line"+n,e.dot.className="item dot"+n,t=!0)}}else e&&(e.box.parentNode&&(e.box.parentNode.removeChild(e.box),t=!0),e.line.parentNode&&(e.line.parentNode.removeChild(e.line),t=!0),e.dot.parentNode&&(e.dot.parentNode.removeChild(e.dot),t=!0));return t},ItemBox.prototype.reflow=function(){if(void 0==this.data.start)throw Error('Property "start" missing in item '+this.data.id);var t,e,i=util.updateProperty,n=this.dom,o=this.props,r=this.options,s=this.parent.toScreen(this.data.start),a=r&&r.align,h=r.orientation,u=0;if(n)if(u+=i(o.dot,"height",n.dot.offsetHeight),u+=i(o.dot,"width",n.dot.offsetWidth),u+=i(o.line,"width",n.line.offsetWidth),u+=i(o.line,"width",n.line.offsetWidth),u+=i(this,"width",n.box.offsetWidth),u+=i(this,"height",n.box.offsetHeight),e="right"==a?s-this.width:"left"==a?s:s-this.width/2,u+=i(this,"left",e),u+=i(o.line,"left",s-o.line.width/2),u+=i(o.dot,"left",s-o.dot.width/2),"top"==h)t=r.margin.axis,u+=i(this,"top",t),u+=i(o.line,"top",0),u+=i(o.line,"height",t),u+=i(o.dot,"top",-o.dot.height/2);else{var l=this.parent.height;t=l-this.height-r.margin.axis,u+=i(this,"top",t),u+=i(o.line,"top",t+this.height),u+=i(o.line,"height",Math.max(r.margin.axis,0)),u+=i(o.dot,"top",l-o.dot.height/2)}else u+=1;return u>0},ItemBox.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")},ItemBox.prototype.reposition=function(){var t=this.dom,e=this.props,i=this.options.orientation;if(t){var n=t.box,o=t.line,r=t.dot;n.style.left=this.left+"px",n.style.top=this.top+"px",o.style.left=e.line.left+"px","top"==i?(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"}},ItemPoint.prototype=new Item(null,null),itemTypes.point=ItemPoint,ItemPoint.prototype.select=function(){this.selected=!0},ItemPoint.prototype.unselect=function(){this.selected=!1},ItemPoint.prototype.repaint=function(){var t=!1,e=this.dom;if(this.visible){if(e||(this._create(),t=!0),e=this.dom){if(!this.options&&!this.options.parent)throw Error("Cannot repaint item: no parent attached");var i=this.parent.getContainer();if(!i)throw Error("Cannot repaint time axis: parent has no container element");if(e.point.parentNode||(i.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 n=(this.data.className?" "+this.data.className:"")+(this.selected?" selected":"");this.className!=n&&(this.className=n,e.point.className="item point"+n,t=!0)}}else e&&e.point.parentNode&&(e.point.parentNode.removeChild(e.point),t=!0);return t},ItemPoint.prototype.reflow=function(){if(void 0==this.data.start)throw Error('Property "start" missing in item '+this.data.id);var t,e=util.updateProperty,i=this.dom,n=this.props,o=this.options,r=o.orientation,s=this.parent.toScreen(this.data.start),a=0;if(i){if(a+=e(this,"width",i.point.offsetWidth),a+=e(this,"height",i.point.offsetHeight),a+=e(n.dot,"width",i.dot.offsetWidth),a+=e(n.dot,"height",i.dot.offsetHeight),a+=e(n.content,"height",i.content.offsetHeight),"top"==r)t=o.margin.axis;else{var h=this.parent.height;t=Math.max(h-this.height-o.margin.axis,0)}a+=e(this,"top",t),a+=e(this,"left",s-n.dot.width/2),a+=e(n.content,"marginLeft",1.5*n.dot.width),a+=e(n.dot,"top",(this.height-n.dot.height)/2)}else a+=1;return a>0},ItemPoint.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))},ItemPoint.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")},ItemRange.prototype=new Item(null,null),itemTypes.range=ItemRange,ItemRange.prototype.select=function(){this.selected=!0},ItemRange.prototype.unselect=function(){this.selected=!1},ItemRange.prototype.repaint=function(){var t=!1,e=this.dom;if(this.visible){if(e||(this._create(),t=!0),e=this.dom){if(!this.options&&!this.options.parent)throw Error("Cannot repaint item: no parent attached");var i=this.parent.getContainer();if(!i)throw Error("Cannot repaint time axis: parent has no container element");if(e.box.parentNode||(i.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 n=this.data.className?""+this.data.className:"";this.className!=n&&(this.className=n,e.box.className="item range"+n,t=!0)}}else e&&e.box.parentNode&&(e.box.parentNode.removeChild(e.box),t=!0);return t},ItemRange.prototype.reflow=function(){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);var t=this.dom,e=this.props,i=this.options,n=this.parent,o=n.toScreen(this.data.start),r=n.toScreen(this.data.end),s=0;if(t){var a,h,u=util.updateProperty,l=t.box,c=n.width,p=i.orientation;s+=u(e.content,"width",t.content.offsetWidth),s+=u(this,"height",l.offsetHeight),-c>o&&(o=-c),r>2*c&&(r=2*c),a=0>o?Math.min(-o,r-o-e.content.width-2*i.padding):0,s+=u(e.content,"left",a),"top"==p?(h=i.margin.axis,s+=u(this,"top",h)):(h=n.height-this.height-i.margin.axis,s+=u(this,"top",h)),s+=u(this,"left",o),s+=u(this,"width",Math.max(r-o,1))}else s+=1;return s>0},ItemRange.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))},ItemRange.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")},Timeline.prototype.setOptions=function(t){util.extend(this.options,t),this.timeaxis.setOptions(this.options),this.range.setOptions(this.options);var e,i=this;e="top"==this.options.orientation?function(){return i.timeaxis.height}:function(){return i.main.height-i.timeaxis.height-i.itemset.height},this.itemset.setOptions({orientation:this.options.orientation,top:e}),this.controller.repaint()},Timeline.prototype.setData=function(t){var e=this.itemset.data;if(e)this.itemset.setData(t);else{this.itemset.setData(t);var i=this.itemset.getDataRange(),n=i.min,o=i.max;if(null!=n&&null!=o){var r=o.valueOf()-n.valueOf();n=new Date(n.valueOf()-.05*r),o=new Date(o.valueOf()+.05*r)}(null!=n||null!=o)&&this.range.setRange(n,o)}},function(t){function e(t,e){return function(i){return h(t.call(this,i),e)}}function i(t){return function(e){return this.lang().ordinal(t.call(this,e))}}function n(){}function o(t){s(this,t)}function r(t){var e=this._data={},i=t.years||t.year||t.y||0,n=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,h=t.minutes||t.minute||t.m||0,u=t.seconds||t.second||t.s||0,l=t.milliseconds||t.millisecond||t.ms||0;this._milliseconds=l+1e3*u+6e4*h+36e5*s,this._days=r+7*o,this._months=n+12*i,e.milliseconds=l%1e3,u+=a(l/1e3),e.seconds=u%60,h+=a(u/60),e.minutes=h%60,s+=a(h/60),e.hours=s%24,r+=a(s/24),r+=7*o,e.days=r%30,n+=a(r/30),e.months=n%12,i+=a(n/12),e.years=i}function s(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t}function a(t){return 0>t?Math.ceil(t):Math.floor(t)}function h(t,e){for(var i=t+"";e>i.length;)i="0"+i;return i}function u(t,e,i){var n,o=e._milliseconds,r=e._days,s=e._months;o&&t._d.setTime(+t+o*i),r&&t.date(t.date()+r*i),s&&(n=t.date(),t.date(1).month(t.month()+s*i).date(Math.min(n,t.daysInMonth())))}function l(t){return"[object Array]"===Object.prototype.toString.call(t)}function c(t,e){var i,n=Math.min(t.length,e.length),o=Math.abs(t.length-e.length),r=0;for(i=0;n>i;i++)~~t[i]!==~~e[i]&&r++;return r+o}function p(t,e){return e.abbr=t,k[t]||(k[t]=new n),k[t].set(e),k[t]}function d(t){return t?(!k[t]&&H&&require("./lang/"+t),k[t]):O.fn._lang}function f(t){return t.match(/\[.*\]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function m(t){var e,i,n=t.match(j);for(e=0,i=n.length;i>e;e++)n[e]=oe[n[e]]?oe[n[e]]:f(n[e]);return function(o){var r="";for(e=0;i>e;e++)r+="function"==typeof n[e].call?n[e].call(o,t):n[e];return r}}function g(t,e){function i(e){return t.lang().longDateFormat(e)||e}for(var n=5;n--&&P.test(e);)e=e.replace(P,i);return ee[e]||(ee[e]=m(e)),ee[e](t)}function v(t){switch(t){case"DDDD":return F;case"YYYY":return W;case"YYYYY":return B;case"S":case"SS":case"SSS":case"DDD":return z;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":case"a":case"A":return V;case"X":return X;case"Z":case"ZZ":return q;case"T":return Z;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 U;default:return RegExp(t.replace("\\",""))}}function y(t,e,i){var n,o=i._a;switch(t){case"M":case"MM":o[1]=null==e?0:~~e-1;break;case"MMM":case"MMMM":n=d(i._l).monthsParse(e),null!=n?o[1]=n:i._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":i._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":i._d=new Date(1e3*parseFloat(e));break;case"Z":case"ZZ":i._useUTC=!0,n=(e+"").match(Q),n&&n[1]&&(i._tzh=~~n[1]),n&&n[2]&&(i._tzm=~~n[2]),n&&"+"===n[0]&&(i._tzh=-i._tzh,i._tzm=-i._tzm)}null==e&&(i._isValid=!1)}function S(t){var e,i,n=[];if(!t._d){for(e=0;7>e;e++)t._a[e]=n[e]=null==t._a[e]?2===e?1:0:t._a[e];n[3]+=t._tzh||0,n[4]+=t._tzm||0,i=new Date(0),t._useUTC?(i.setUTCFullYear(n[0],n[1],n[2]),i.setUTCHours(n[3],n[4],n[5],n[6])):(i.setFullYear(n[0],n[1],n[2]),i.setHours(n[3],n[4],n[5],n[6])),t._d=i}}function T(t){var e,i,n=t._f.match(j),o=t._i;for(t._a=[],e=0;n.length>e;e++)i=(v(n[e]).exec(o)||[])[0],i&&(o=o.slice(o.indexOf(i)+i.length)),oe[n[e]]&&y(n[e],i,t);t._isPm&&12>t._a[3]&&(t._a[3]+=12),t._isPm===!1&&12===t._a[3]&&(t._a[3]=0),S(t)}function w(t){for(var e,i,n,r,a=99;t._f.length;){if(e=s({},t),e._f=t._f.pop(),T(e),i=new o(e),i.isValid()){n=i;break}r=c(e._a,i.toArray()),a>r&&(a=r,n=i)}s(t,n)}function E(t){var e,i=t._i;if(K.exec(i)){for(t._f="YYYY-MM-DDT",e=0;4>e;e++)if($[e][1].exec(i)){t._f+=$[e][0];break}q.exec(i)&&(t._f+=" Z"),T(t)}else t._d=new Date(i)}function b(e){var i=e._i,n=R.exec(i);i===t?e._d=new Date:n?e._d=new Date(+n[1]):"string"==typeof i?E(e):l(i)?(e._a=i.slice(0),S(e)):e._d=i instanceof Date?new Date(+i):new Date(i)}function M(t,e,i,n,o){return o.relativeTime(e||1,!!i,t,n)}function D(t,e,i){var n=I(Math.abs(t)/1e3),o=I(n/60),r=I(o/60),s=I(r/24),a=I(s/365),h=45>n&&["s",n]||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",I(s/30)]||1===a&&["y"]||["yy",a];return h[2]=e,h[3]=t>0,h[4]=i,M.apply({},h)}function _(t,e,i){var n=i-e,o=i-t.day();return o>n&&(o-=7),n-7>o&&(o+=7),Math.ceil(O(t).add("d",o).dayOfYear()/7)}function C(t){var e=t._i,i=t._f;return null===e||""===e?null:("string"==typeof e&&(t._i=e=d().preparse(e)),O.isMoment(e)?(t=s({},e),t._d=new Date(+e._d)):i?l(i)?w(t):T(t):b(t),new o(t))}function L(t,e){O.fn[t]=O.fn[t+"s"]=function(t){var i=this._isUTC?"UTC":"";return null!=t?(this._d["set"+i+e](t),this):this._d["get"+i+e]()}}function x(t){O.duration.fn[t]=function(){return this._data[t]}}function A(t,e){O.duration.fn["as"+t]=function(){return+this/e}}for(var O,N,Y="2.0.0",I=Math.round,k={},H="undefined"!=typeof module&&module.exports,R=/^\/?Date\((\-?\d+)/i,j=/(\[[^\[]*\])|(\\)?(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,P=/(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,U=/\d\d?/,z=/\d{1,3}/,F=/\d{3}/,W=/\d{1,4}/,B=/[+\-]?\d{1,6}/,V=/[0-9]*[a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF]+\s*?[\u0600-\u06FF]+/i,q=/Z|[\+\-]\d\d:?\d\d/i,Z=/T/i,X=/[\+\-]?\d+(\.\d{1,3})?/,K=/^\s*\d{4}-\d\d-\d\d((T| )(\d\d(:\d\d(:\d\d(\.\d\d?\d?)?)?)?)?([\+\-]\d\d:?\d\d)?)?/,J="YYYY-MM-DDTHH:mm:ssZ",$=[["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/]],Q=/([\+\-]|\d\d)/gi,G="Month|Date|Hours|Minutes|Seconds|Milliseconds".split("|"),te={Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6},ee={},ie="DDD w W M D d".split(" "),ne="M D H h m s w W".split(" "),oe={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 h(this.year()%100,2)},YYYY:function(){return h(this.year(),4)},YYYYY:function(){return h(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 h(~~(this.milliseconds()/10),2)},SSS:function(){return h(this.milliseconds(),3)},Z:function(){var t=-this.zone(),e="+";return 0>t&&(t=-t,e="-"),e+h(~~(t/60),2)+":"+h(~~t%60,2)},ZZ:function(){var t=-this.zone(),e="+";return 0>t&&(t=-t,e="-"),e+h(~~(10*t/6),4)},X:function(){return this.unix()}};ie.length;)N=ie.pop(),oe[N+"o"]=i(oe[N]);for(;ne.length;)N=ne.pop(),oe[N+N]=e(oe[N],2);for(oe.DDDD=e(oe.DDD,3),n.prototype={set:function(t){var e,i;for(i in t)e=t[i],"function"==typeof e?this[i]=e:this["_"+i]=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,i,n;for(this._monthsParse||(this._monthsParse=[]),e=0;12>e;e++)if(this._monthsParse[e]||(i=O([2e3,e]),n="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[e]=RegExp(n.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,i){return t>11?i?"pm":"PM":i?"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 i=this._calendar[t];return"function"==typeof i?i.apply(e):i},_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,i,n){var o=this._relativeTime[i];return"function"==typeof o?o(t,e,i,n):o.replace(/%d/i,t)},pastFuture:function(t,e){var i=this._relativeTime[t>0?"future":"past"];return"function"==typeof i?i(e):i.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 _(t,this._week.dow,this._week.doy)},_week:{dow:0,doy:6}},O=function(t,e,i){return C({_i:t,_f:e,_l:i,_isUTC:!1})},O.utc=function(t,e,i){return C({_useUTC:!0,_isUTC:!0,_l:i,_i:t,_f:e})},O.unix=function(t){return O(1e3*t)},O.duration=function(t,e){var i,n=O.isDuration(t),o="number"==typeof t,s=n?t._data:o?{}:t;return o&&(e?s[e]=t:s.milliseconds=t),i=new r(s),n&&t.hasOwnProperty("_lang")&&(i._lang=t._lang),i},O.version=Y,O.defaultFormat=J,O.lang=function(e,i){return e?(i?p(e,i):k[e]||d(e),O.duration.fn._lang=O.fn._lang=d(e),t):O.fn._lang._abbr},O.langData=function(t){return t&&t._lang&&t._lang._abbr&&(t=t._lang._abbr),d(t)},O.isMoment=function(t){return t instanceof o},O.isDuration=function(t){return t instanceof r},O.fn=o.prototype={clone:function(){return O(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 O.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?!c(this._a,(this._isUTC?O.utc(this._a):O(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=g(this,t||O.defaultFormat);return this.lang().postformat(e)},add:function(t,e){var i;return i="string"==typeof t?O.duration(+e,t):O.duration(t,e),u(this,i,1),this},subtract:function(t,e){var i;return i="string"==typeof t?O.duration(+e,t):O.duration(t,e),u(this,i,-1),this},diff:function(t,e,i){var n,o,r=this._isUTC?O(t).utc():O(t).local(),s=6e4*(this.zone()-r.zone());return e&&(e=e.replace(/s$/,"")),"year"===e||"month"===e?(n=432e5*(this.daysInMonth()+r.daysInMonth()),o=12*(this.year()-r.year())+(this.month()-r.month()),o+=(this-O(this).startOf("month")-(r-O(r).startOf("month")))/n,"year"===e&&(o/=12)):(n=this-r-s,o="second"===e?n/1e3:"minute"===e?n/6e4:"hour"===e?n/36e5:"day"===e?n/864e5:"week"===e?n/6048e5:n),i?o:a(o)},from:function(t,e){return O.duration(this.diff(t)).lang(this.lang()._abbr).humanize(!e)},fromNow:function(t){return this.from(O(),t)},calendar:function(){var t=this.diff(O().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()<O([this.year()]).zone()||this.zone()<O([this.year(),5]).zone()},day:function(t){var e=this._isUTC?this._d.getUTCDay():this._d.getDay();return null==t?e:this.add({d:t-e})},startOf:function(t){switch(t=t.replace(/s$/,"")){case"year":this.month(0);case"month":this.date(1);case"week":case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===t&&this.day(0),this},endOf:function(t){return this.startOf(t).add(t.replace(/s?$/,"s"),1).subtract("ms",1)},isAfter:function(e,i){return i=i!==t?i:"millisecond",+this.clone().startOf(i)>+O(e).startOf(i)},isBefore:function(e,i){return i=i!==t?i:"millisecond",+this.clone().startOf(i)<+O(e).startOf(i)},isSame:function(e,i){return i=i!==t?i:"millisecond",+this.clone().startOf(i)===+O(e).startOf(i)},zone:function(){return this._isUTC?0:this._d.getTimezoneOffset()},daysInMonth:function(){return O.utc([this.year(),this.month()+1,0]).date()},dayOfYear:function(t){var e=I((O(this).startOf("day")-O(this).startOf("year"))/864e5)+1;return null==t?e:this.add("d",t-e)},isoWeek:function(t){var e=_(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(e){return e===t?this._lang:(this._lang=d(e),this)}},N=0;G.length>N;N++)L(G[N].toLowerCase().replace(/s$/,""),G[N]);L("year","FullYear"),O.fn.days=O.fn.day,O.fn.weeks=O.fn.week,O.fn.isoWeeks=O.fn.isoWeek,O.duration.fn=r.prototype={weeks:function(){return a(this.days()/7)},valueOf:function(){return this._milliseconds+864e5*this._days+2592e6*this._months},humanize:function(t){var e=+this,i=D(e,!t,this.lang());return t&&(i=this.lang().pastFuture(e,i)),this.lang().postformat(i)},lang:O.fn.lang};for(N in te)te.hasOwnProperty(N)&&(A(N,te[N]),x(N.toLowerCase()));A("Weeks",6048e5),O.lang("en",{ordinal:function(t){var e=t%10,i=1===~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th";return t+i}}),H&&(module.exports=O),"undefined"==typeof ender&&(this.moment=O),"function"==typeof define&&define.amd&&define("moment",[],function(){return O})}.call(this),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}\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 z-index: -1;\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");