UNPKG

vis-timeline

Version:

Create a fully customizable, interactive timeline with items and ranges.

26 lines 255 kB
/** * vis-timeline and vis-graph2d * https://visjs.github.io/vis-timeline/ * * Create a fully customizable, interactive timeline with items and ranges. * * @version 7.7.3 * @date 2023-10-27T17:57:57.604Z * * @copyright (c) 2011-2017 Almende B.V, http://almende.com * @copyright (c) 2017-2019 visjs contributors, https://github.com/visjs * * @license * vis.js is dual licensed under both * * 1. The Apache 2.0 License * http://www.apache.org/licenses/LICENSE-2.0 * * and * * 2. The MIT License * http://opensource.org/licenses/MIT * * vis.js may be distributed under either license. */ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("moment"),require("vis-util/esnext/umd/vis-util.js"),require("vis-data/esnext/umd/vis-data.js"),require("xss"),require("uuid"),require("component-emitter"),require("propagating-hammerjs"),require("@egjs/hammerjs"),require("keycharm")):"function"==typeof define&&define.amd?define(["exports","moment","vis-util/esnext/umd/vis-util.js","vis-data/esnext/umd/vis-data.js","xss","uuid","component-emitter","propagating-hammerjs","@egjs/hammerjs","keycharm"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).vis=t.vis||{},t.moment,t.vis,t.vis,t.filterXSS,t.uuid,t.Emitter,t.propagating,t.Hammer,t.keycharm)}(this,(function(t,e,s,o,n,r,a,h,l,d){function p(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var s=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}var m=p(s);function c(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var u=c("undefined"!=typeof window&&window.moment||e);function g(t){if(!t)return!1;let e=t.idProp??t._idProp;return!!e&&o.isDataViewLike(e,t)}const f=/^\/?Date\((-?\d+)/i,b=/^\d+$/;function y(t,i){let o;if(void 0!==t){if(null===t)return null;if(!i)return t;if("string"!=typeof i&&!(i instanceof String))throw new Error("Type must be a string");switch(i){case"boolean":case"Boolean":return Boolean(t);case"number":case"Number":return s.isString(t)&&!isNaN(Date.parse(t))?e(t).valueOf():Number(t.valueOf());case"string":case"String":return String(t);case"Date":try{return y(t,"Moment").toDate()}catch(e){throw e instanceof TypeError?new TypeError("Cannot convert object of type "+s.getType(t)+" to type "+i):e}case"Moment":if(s.isNumber(t))return e(t);if(t instanceof Date)return e(t.valueOf());if(e.isMoment(t))return e(t);if(s.isString(t))return o=f.exec(t),o?e(Number(o[1])):(o=b.exec(t),e(o?Number(t):t));throw new TypeError("Cannot convert object of type "+s.getType(t)+" to type "+i);case"ISODate":if(s.isNumber(t))return new Date(t);if(t instanceof Date)return t.toISOString();if(e.isMoment(t))return t.toDate().toISOString();if(s.isString(t))return o=f.exec(t),o?new Date(Number(o[1])).toISOString():e(t).format();throw new Error("Cannot convert object of type "+s.getType(t)+" to type ISODate");case"ASPDate":if(s.isNumber(t))return"/Date("+t+")/";if(t instanceof Date||e.isMoment(t))return"/Date("+t.valueOf()+")/";if(s.isString(t)){let e;return o=f.exec(t),e=o?new Date(Number(o[1])).valueOf():new Date(t).valueOf(),"/Date("+e+")/"}throw new Error("Cannot convert object of type "+s.getType(t)+" to type ASPDate");default:throw new Error(`Unknown type ${i}`)}}}function v(t,e={start:"Date",end:"Date"}){const i=t._idProp,s=new o.DataSet({fieldId:i}),n=o.createNewDataPipeFrom(t).map((t=>Object.keys(t).reduce(((i,s)=>(i[s]=y(t[s],e[s]),i)),{}))).to(s);return n.all().start(),{add:(...e)=>t.getDataSet().add(...e),remove:(...e)=>t.getDataSet().remove(...e),update:(...e)=>t.getDataSet().update(...e),updateOnly:(...e)=>t.getDataSet().updateOnly(...e),clear:(...e)=>t.getDataSet().clear(...e),forEach:s.forEach.bind(s),get:s.get.bind(s),getIds:s.getIds.bind(s),off:s.off.bind(s),on:s.on.bind(s),get length(){return s.length},idProp:i,type:e,rawDS:t,coercedDS:s,dispose:()=>n.stop()}}const w=t=>{const e=new n.FilterXSS(t);return t=>e.process(t)},_=t=>t;let x=w();const D={...m,convert:y,setupXSSProtection:t=>{t&&(!0===t.disabled?(x=_,console.warn("You disabled XSS protection for vis-Timeline. I sure hope you know what you're doing!")):t.filterOptions&&(x=w(t.filterOptions)))}};Object.defineProperty(D,"xss",{get:function(){return x}});class C{constructor(t,e){this.options=null,this.props=null}setOptions(t){t&&D.extend(this.options,t)}redraw(){return!1}destroy(){}_isResized(){const t=this.props._previousWidth!==this.props.width||this.props._previousHeight!==this.props.height;return this.props._previousWidth=this.props.width,this.props._previousHeight=this.props.height,t}}function S(t,e,i){if(i&&!Array.isArray(i))return S(t,e,[i]);if(e.hiddenDates=[],i&&1==Array.isArray(i)){for(let s=0;s<i.length;s++)if(void 0===i[s].repeat){const o={};o.start=t(i[s].start).toDate().valueOf(),o.end=t(i[s].end).toDate().valueOf(),e.hiddenDates.push(o)}e.hiddenDates.sort(((t,e)=>t.start-e.start))}}function k(t,e,i){if(i&&!Array.isArray(i))return k(t,e,[i]);if(i&&void 0!==e.domProps.centerContainer.width){S(t,e,i);const s=t(e.range.start),o=t(e.range.end),n=(e.range.end-e.range.start)/e.domProps.centerContainer.width;for(let r=0;r<i.length;r++)if(void 0!==i[r].repeat){const a=t(i[r].start);let h=t(i[r].end);if("Invalid Date"==a._d)throw new Error(`Supplied start date is not valid: ${i[r].start}`);if("Invalid Date"==h._d)throw new Error(`Supplied end date is not valid: ${i[r].end}`);if(h-a>=4*n){let t=0;const n=o.clone();switch(i[r].repeat){case"daily":a.day()!=h.day()&&(t=1),a.dayOfYear(s.dayOfYear()),a.year(s.year()),a.subtract(7,"days"),h.dayOfYear(s.dayOfYear()),h.year(s.year()),h.subtract(7-t,"days"),n.add(1,"weeks");break;case"weekly":{const t=h.diff(a,"days"),e=a.day();a.date(s.date()),a.month(s.month()),a.year(s.year()),h=a.clone(),a.day(e),h.day(e),h.add(t,"days"),a.subtract(1,"weeks"),h.subtract(1,"weeks"),n.add(1,"weeks");break}case"monthly":a.month()!=h.month()&&(t=1),a.month(s.month()),a.year(s.year()),a.subtract(1,"months"),h.month(s.month()),h.year(s.year()),h.subtract(1,"months"),h.add(t,"months"),n.add(1,"months");break;case"yearly":a.year()!=h.year()&&(t=1),a.year(s.year()),a.subtract(1,"years"),h.year(s.year()),h.subtract(1,"years"),h.add(t,"years"),n.add(1,"years");break;default:return void console.log("Wrong repeat format, allowed are: daily, weekly, monthly, yearly. Given:",i[r].repeat)}for(;a<n;)switch(e.hiddenDates.push({start:a.valueOf(),end:h.valueOf()}),i[r].repeat){case"daily":a.add(1,"days"),h.add(1,"days");break;case"weekly":a.add(1,"weeks"),h.add(1,"weeks");break;case"monthly":a.add(1,"months"),h.add(1,"months");break;case"yearly":a.add(1,"y"),h.add(1,"y");break;default:return void console.log("Wrong repeat format, allowed are: daily, weekly, monthly, yearly. Given:",i[r].repeat)}e.hiddenDates.push({start:a.valueOf(),end:h.valueOf()})}}T(e);const r=F(e.range.start,e.hiddenDates),a=F(e.range.end,e.hiddenDates);let h=e.range.start,l=e.range.end;1==r.hidden&&(h=1==e.range.startToFront?r.startDate-1:r.endDate+1),1==a.hidden&&(l=1==e.range.endToFront?a.startDate-1:a.endDate+1),1!=r.hidden&&1!=a.hidden||e.range._applyRange(h,l)}}function T(t){const e=t.hiddenDates,i=[];for(var s=0;s<e.length;s++)for(let t=0;t<e.length;t++)s!=t&&1!=e[t].remove&&1!=e[s].remove&&(e[t].start>=e[s].start&&e[t].end<=e[s].end?e[t].remove=!0:e[t].start>=e[s].start&&e[t].start<=e[s].end?(e[s].end=e[t].end,e[t].remove=!0):e[t].end>=e[s].start&&e[t].end<=e[s].end&&(e[s].start=e[t].start,e[t].remove=!0));for(s=0;s<e.length;s++)!0!==e[s].remove&&i.push(e[s]);t.hiddenDates=i,t.hiddenDates.sort(((t,e)=>t.start-e.start))}function E(t,e,i){let s=!1;const o=e.current.valueOf();for(let t=0;t<e.hiddenDates.length;t++){const i=e.hiddenDates[t].start;var n=e.hiddenDates[t].end;if(o>=i&&o<n){s=!0;break}}if(1==s&&o<e._end.valueOf()&&o!=i){const s=t(i),o=t(n);s.year()!=o.year()?e.switchedYear=!0:s.month()!=o.month()?e.switchedMonth=!0:s.dayOfYear()!=o.dayOfYear()&&(e.switchedDay=!0),e.current=o}}function O(t,e,i){let s;if(0==t.body.hiddenDates.length)return s=t.range.conversion(i),(e.valueOf()-s.offset)*s.scale;{const o=F(e,t.body.hiddenDates);1==o.hidden&&(e=o.startDate);const n=I(t.body.hiddenDates,t.range.start,t.range.end);if(e<t.range.start){s=t.range.conversion(i,n);const o=N(t.body.hiddenDates,e,s.offset);return e=t.options.moment(e).toDate().valueOf(),e+=o,-(s.offset-e.valueOf())*s.scale}if(e>t.range.end){const o={start:t.range.start,end:e};return e=P(t.options.moment,t.body.hiddenDates,o,e),s=t.range.conversion(i,n),(e.valueOf()-s.offset)*s.scale}return e=P(t.options.moment,t.body.hiddenDates,t.range,e),s=t.range.conversion(i,n),(e.valueOf()-s.offset)*s.scale}}function M(t,e,i){if(0==t.body.hiddenDates.length){const s=t.range.conversion(i);return new Date(e/s.scale+s.offset)}{const s=I(t.body.hiddenDates,t.range.start,t.range.end),o=(t.range.end-t.range.start-s)*e/i,n=L(t.body.hiddenDates,t.range,o);return new Date(n+o+t.range.start)}}function I(t,e,i){let s=0;for(let o=0;o<t.length;o++){const n=t[o].start,r=t[o].end;n>=e&&r<i&&(s+=r-n)}return s}function N(t,e,i){let s=0;for(let o=0;o<t.length;o++){const n=t[o].start,r=t[o].end;n>=e&&r<=i&&(s+=r-n)}return s}function P(t,e,i,s){return s=t(s).toDate().valueOf(),s-=A(t,e,i,s)}function A(t,e,i,s){let o=0;s=t(s).toDate().valueOf();for(let t=0;t<e.length;t++){const n=e[t].start,r=e[t].end;n>=i.start&&r<i.end&&s>=r&&(o+=r-n)}return o}function L(t,e,i){let s=0,o=0,n=e.start;for(let r=0;r<t.length;r++){const a=t[r].start,h=t[r].end;if(a>=e.start&&h<e.end){if(o+=a-n,n=h,o>=i)break;s+=h-a}}return s}function R(t,e,i,s){const o=F(e,t);return 1==o.hidden?i<0?1==s?o.startDate-(o.endDate-e)-1:o.startDate-1:1==s?o.endDate+(e-o.startDate)+1:o.endDate+1:e}function F(t,e){for(let o=0;o<e.length;o++){var i=e[o].start,s=e[o].end;if(t>=i&&t<s)return{hidden:!0,startDate:i,endDate:s}}return{hidden:!1,startDate:i,endDate:s}}var G=Object.freeze({__proto__:null,convertHiddenOptions:S,correctTimeForHidden:P,getAccumulatedHiddenDuration:L,getHiddenDurationBefore:A,getHiddenDurationBeforeStart:N,getHiddenDurationBetween:I,getIsHidden:F,printDates:function(t){for(let e=0;e<t.length;e++)console.log(e,new Date(t[e].start),new Date(t[e].end),t[e].start,t[e].end,t[e].remove)},removeDuplicates:T,snapAwayFromHidden:R,stepOverHiddenDates:E,toScreen:O,toTime:M,updateHiddenDates:k});class H extends C{constructor(t,e){super();const i=u().hours(0).minutes(0).seconds(0).milliseconds(0),s=i.clone().add(-3,"days").valueOf(),o=i.clone().add(3,"days").valueOf();this.millisecondsPerPixelCache=void 0,void 0===e?(this.start=s,this.end=o):(this.start=e.start||s,this.end=e.end||o),this.rolling=!1,this.body=t,this.deltaDifference=0,this.scaleOffset=0,this.startToFront=!1,this.endToFront=!0,this.defaultOptions={rtl:!1,start:null,end:null,moment:u,direction:"horizontal",moveable:!0,zoomable:!0,min:null,max:null,zoomMin:10,zoomMax:31536e10,rollingMode:{follow:!1,offset:.5}},this.options=D.extend({},this.defaultOptions),this.props={touch:{}},this.animationTimer=null,this.body.emitter.on("panstart",this._onDragStart.bind(this)),this.body.emitter.on("panmove",this._onDrag.bind(this)),this.body.emitter.on("panend",this._onDragEnd.bind(this)),this.body.emitter.on("mousewheel",this._onMouseWheel.bind(this)),this.body.emitter.on("touch",this._onTouch.bind(this)),this.body.emitter.on("pinch",this._onPinch.bind(this)),this.body.dom.rollingModeBtn.addEventListener("click",this.startRolling.bind(this)),this.setOptions(e)}setOptions(t){if(t){const e=["animation","direction","min","max","zoomMin","zoomMax","moveable","zoomable","moment","activate","hiddenDates","zoomKey","zoomFriction","rtl","showCurrentTime","rollingMode","horizontalScroll"];D.selectiveExtend(e,this.options,t),t.rollingMode&&t.rollingMode.follow&&this.startRolling(),("start"in t||"end"in t)&&this.setRange(t.start,t.end)}}startRolling(){const t=this;!function e(){t.stopRolling(),t.rolling=!0;let i=t.end-t.start;const s=D.convert(new Date,"Date").valueOf(),o=t.options.rollingMode&&t.options.rollingMode.offset||.5,n=s-i*o,r=s+i*(1-o);t.setRange(n,r,{animation:!1}),i=1/t.conversion(t.body.domProps.center.width).scale/10,i<30&&(i=30),i>1e3&&(i=1e3),t.body.dom.rollingModeBtn.style.visibility="hidden",t.currentTimeTimer=setTimeout(e,i)}()}stopRolling(){void 0!==this.currentTimeTimer&&(clearTimeout(this.currentTimeTimer),this.rolling=!1,this.body.dom.rollingModeBtn.style.visibility="visible")}setRange(t,e,i,s,o){i||(i={}),!0!==i.byUser&&(i.byUser=!1);const n=this,r=null!=t?D.convert(t,"Date").valueOf():null,a=null!=e?D.convert(e,"Date").valueOf():null;if(this._cancelAnimation(),this.millisecondsPerPixelCache=void 0,i.animation){const t=this.start,e=this.end,l="object"==typeof i.animation&&"duration"in i.animation?i.animation.duration:500,d="object"==typeof i.animation&&"easingFunction"in i.animation?i.animation.easingFunction:"easeInOutQuad",p=D.easingFunctions[d];if(!p)throw new Error(`Unknown easing function ${JSON.stringify(d)}. Choose from: ${Object.keys(D.easingFunctions).join(", ")}`);const m=Date.now();let c=!1;const u=()=>{if(!n.props.touch.dragging){const d=Date.now()-m,g=p(d/l),f=d>l,b=f||null===r?r:t+(r-t)*g,y=f||null===a?a:e+(a-e)*g;h=n._applyRange(b,y),k(n.options.moment,n.body,n.options.hiddenDates),c=c||h;const v={start:new Date(n.start),end:new Date(n.end),byUser:i.byUser,event:i.event};if(o&&o(g,h,f),h&&n.body.emitter.emit("rangechange",v),f){if(c&&(n.body.emitter.emit("rangechanged",v),s))return s()}else n.animationTimer=setTimeout(u,20)}};return u()}var h=this._applyRange(r,a);if(k(this.options.moment,this.body,this.options.hiddenDates),h){const t={start:new Date(this.start),end:new Date(this.end),byUser:i.byUser,event:i.event};if(this.body.emitter.emit("rangechange",t),clearTimeout(n.timeoutID),n.timeoutID=setTimeout((()=>{n.body.emitter.emit("rangechanged",t)}),200),s)return s()}}getMillisecondsPerPixel(){return void 0===this.millisecondsPerPixelCache&&(this.millisecondsPerPixelCache=(this.end-this.start)/this.body.dom.center.clientWidth),this.millisecondsPerPixelCache}_cancelAnimation(){this.animationTimer&&(clearTimeout(this.animationTimer),this.animationTimer=null)}_applyRange(t,e){let i=null!=t?D.convert(t,"Date").valueOf():this.start,s=null!=e?D.convert(e,"Date").valueOf():this.end;const o=null!=this.options.max?D.convert(this.options.max,"Date").valueOf():null,n=null!=this.options.min?D.convert(this.options.min,"Date").valueOf():null;let r;if(isNaN(i)||null===i)throw new Error(`Invalid start "${t}"`);if(isNaN(s)||null===s)throw new Error(`Invalid end "${e}"`);if(s<i&&(s=i),null!==n&&i<n&&(r=n-i,i+=r,s+=r,null!=o&&s>o&&(s=o)),null!==o&&s>o&&(r=s-o,i-=r,s-=r,null!=n&&i<n&&(i=n)),null!==this.options.zoomMin){let t=parseFloat(this.options.zoomMin);if(t<0&&(t=0),s-i<t){const e=.5;this.end-this.start===t&&i>=this.start-e&&s<=this.end?(i=this.start,s=this.end):(r=t-(s-i),i-=r/2,s+=r/2)}}if(null!==this.options.zoomMax){let t=parseFloat(this.options.zoomMax);t<0&&(t=0),s-i>t&&(this.end-this.start===t&&i<this.start&&s>this.end?(i=this.start,s=this.end):(r=s-i-t,i+=r/2,s-=r/2))}const a=this.start!=i||this.end!=s;return i>=this.start&&i<=this.end||s>=this.start&&s<=this.end||this.start>=i&&this.start<=s||this.end>=i&&this.end<=s||this.body.emitter.emit("checkRangedItems"),this.start=i,this.end=s,a}getRange(){return{start:this.start,end:this.end}}conversion(t,e){return H.conversion(this.start,this.end,t,e)}static conversion(t,e,i,s){return void 0===s&&(s=0),0!=i&&e-t!=0?{offset:t,scale:i/(e-t-s)}:{offset:0,scale:1}}_onDragStart(t){this.deltaDifference=0,this.previousDelta=0,this.options.moveable&&this._isInsideRange(t)&&this.props.touch.allowDragging&&(this.stopRolling(),this.props.touch.start=this.start,this.props.touch.end=this.end,this.props.touch.dragging=!0,this.body.dom.root&&(this.body.dom.root.style.cursor="move"))}_onDrag(t){if(!t)return;if(!this.props.touch.dragging)return;if(!this.options.moveable)return;if(!this.props.touch.allowDragging)return;const e=this.options.direction;j(e);let i="horizontal"==e?t.deltaX:t.deltaY;i-=this.deltaDifference;let s=this.props.touch.end-this.props.touch.start;s-=I(this.body.hiddenDates,this.start,this.end);const o="horizontal"==e?this.body.domProps.center.width:this.body.domProps.center.height;let n;n=this.options.rtl?i/o*s:-i/o*s;const r=this.props.touch.start+n,a=this.props.touch.end+n,h=R(this.body.hiddenDates,r,this.previousDelta-i,!0),l=R(this.body.hiddenDates,a,this.previousDelta-i,!0);if(h!=r||l!=a)return this.deltaDifference+=i,this.props.touch.start=h,this.props.touch.end=l,void this._onDrag(t);this.previousDelta=i,this._applyRange(r,a);const d=new Date(this.start),p=new Date(this.end);this.body.emitter.emit("rangechange",{start:d,end:p,byUser:!0,event:t}),this.body.emitter.emit("panmove")}_onDragEnd(t){this.props.touch.dragging&&this.options.moveable&&this.props.touch.allowDragging&&(this.props.touch.dragging=!1,this.body.dom.root&&(this.body.dom.root.style.cursor="auto"),this.body.emitter.emit("rangechanged",{start:new Date(this.start),end:new Date(this.end),byUser:!0,event:t}))}_onMouseWheel(t){let e=0;if(t.wheelDelta?e=t.wheelDelta/120:t.detail?e=-t.detail/3:t.deltaY&&(e=-t.deltaY/3),!(this.options.zoomKey&&!t[this.options.zoomKey]&&this.options.zoomable||!this.options.zoomable&&this.options.moveable)&&this.options.zoomable&&this.options.moveable&&this._isInsideRange(t)&&e){const i=this.options.zoomFriction||5;let s,o;if(s=e<0?1-e/i:1/(1+e/i),this.rolling){const t=this.options.rollingMode&&this.options.rollingMode.offset||.5;o=this.start+(this.end-this.start)*t}else{const e=this.getPointer({x:t.clientX,y:t.clientY},this.body.dom.center);o=this._pointerToDate(e)}this.zoom(s,o,e,t),t.preventDefault()}}_onTouch(t){this.props.touch.start=this.start,this.props.touch.end=this.end,this.props.touch.allowDragging=!0,this.props.touch.center=null,this.props.touch.centerDate=null,this.scaleOffset=0,this.deltaDifference=0,D.preventDefault(t)}_onPinch(t){if(!this.options.zoomable||!this.options.moveable)return;D.preventDefault(t),this.props.touch.allowDragging=!1,this.props.touch.center||(this.props.touch.center=this.getPointer(t.center,this.body.dom.center),this.props.touch.centerDate=this._pointerToDate(this.props.touch.center)),this.stopRolling();const e=1/(t.scale+this.scaleOffset),i=this.props.touch.centerDate,s=I(this.body.hiddenDates,this.start,this.end),o=A(this.options.moment,this.body.hiddenDates,this,i),n=s-o;let r=i-o+(this.props.touch.start-(i-o))*e,a=i+n+(this.props.touch.end-(i+n))*e;this.startToFront=1-e<=0,this.endToFront=e-1<=0;const h=R(this.body.hiddenDates,r,1-e,!0),l=R(this.body.hiddenDates,a,e-1,!0);h==r&&l==a||(this.props.touch.start=h,this.props.touch.end=l,this.scaleOffset=1-t.scale,r=h,a=l);const d={animation:!1,byUser:!0,event:t};this.setRange(r,a,d),this.startToFront=!1,this.endToFront=!0}_isInsideRange(t){const e=t.center?t.center.x:t.clientX,i=this.body.dom.centerContainer.getBoundingClientRect(),s=this.options.rtl?e-i.left:i.right-e,o=this.body.util.toTime(s);return o>=this.start&&o<=this.end}_pointerToDate(t){let e;const i=this.options.direction;if(j(i),"horizontal"==i)return this.body.util.toTime(t.x).valueOf();{const i=this.body.domProps.center.height;return e=this.conversion(i),t.y/e.scale+e.offset}}getPointer(t,e){const i=e.getBoundingClientRect();return this.options.rtl?{x:i.right-t.x,y:t.y-i.top}:{x:t.x-i.left,y:t.y-i.top}}zoom(t,e,i,s){null==e&&(e=(this.start+this.end)/2);const o=I(this.body.hiddenDates,this.start,this.end),n=A(this.options.moment,this.body.hiddenDates,this,e),r=o-n;let a=e-n+(this.start-(e-n))*t,h=e+r+(this.end-(e+r))*t;this.startToFront=!(i>0),this.endToFront=!(-i>0);const l=R(this.body.hiddenDates,a,i,!0),d=R(this.body.hiddenDates,h,-i,!0);l==a&&d==h||(a=l,h=d);const p={animation:!1,byUser:!0,event:s};this.setRange(a,h,p),this.startToFront=!1,this.endToFront=!0}move(t){const e=this.end-this.start,i=this.start+e*t,s=this.end+e*t;this.start=i,this.end=s}moveTo(t){const e=(this.start+this.end)/2-t,i=this.start-e,s=this.end-e;this.setRange(i,s,{animation:!1,byUser:!0,event:null})}destroy(){this.stopRolling()}}function j(t){if("horizontal"!=t&&"vertical"!=t)throw new TypeError(`Unknown direction "${t}". Choose "horizontal" or "vertical".`)}let z;if("undefined"!=typeof window){z=h(window.Hammer||l,{preventDefault:"mouse"})}else z=()=>function(){const t=()=>{};return{on:t,off:t,destroy:t,emit:t,get:e=>({set:t})}}();var B=z;function Y(t,e){e.inputHandler=function(t){t.isFirst&&e(t)},t.on("hammer.input",e.inputHandler)}class ${constructor(t,e,i,s,o){this.moment=o&&o.moment||u,this.options=o||{},this.current=this.moment(),this._start=this.moment(),this._end=this.moment(),this.autoScale=!0,this.scale="day",this.step=1,this.setRange(t,e,i),this.switchedDay=!1,this.switchedMonth=!1,this.switchedYear=!1,Array.isArray(s)?this.hiddenDates=s:this.hiddenDates=null!=s?[s]:[],this.format=$.FORMAT}setMoment(t){this.moment=t,this.current=this.moment(this.current.valueOf()),this._start=this.moment(this._start.valueOf()),this._end=this.moment(this._end.valueOf())}setFormat(t){const e=D.deepExtend({},$.FORMAT);this.format=D.deepExtend(e,t)}setRange(t,e,i){if(!(t instanceof Date&&e instanceof Date))throw"No legal start or end date in method setRange";this._start=null!=t?this.moment(t.valueOf()):Date.now(),this._end=null!=e?this.moment(e.valueOf()):Date.now(),this.autoScale&&this.setMinimumStep(i)}start(){this.current=this._start.clone(),this.roundToMinor()}roundToMinor(){switch("week"==this.scale&&this.current.weekday(0),this.scale){case"year":this.current.year(this.step*Math.floor(this.current.year()/this.step)),this.current.month(0);case"month":this.current.date(1);case"week":case"day":case"weekday":this.current.hours(0);case"hour":this.current.minutes(0);case"minute":this.current.seconds(0);case"second":this.current.milliseconds(0)}if(1!=this.step){let t=this.current.clone();switch(this.scale){case"millisecond":this.current.subtract(this.current.milliseconds()%this.step,"milliseconds");break;case"second":this.current.subtract(this.current.seconds()%this.step,"seconds");break;case"minute":this.current.subtract(this.current.minutes()%this.step,"minutes");break;case"hour":this.current.subtract(this.current.hours()%this.step,"hours");break;case"weekday":case"day":this.current.subtract((this.current.date()-1)%this.step,"day");break;case"week":this.current.subtract(this.current.week()%this.step,"week");break;case"month":this.current.subtract(this.current.month()%this.step,"month");break;case"year":this.current.subtract(this.current.year()%this.step,"year")}t.isSame(this.current)||(this.current=this.moment(R(this.hiddenDates,this.current.valueOf(),-1,!0)))}}hasNext(){return this.current.valueOf()<=this._end.valueOf()}next(){const t=this.current.valueOf();switch(this.scale){case"millisecond":this.current.add(this.step,"millisecond");break;case"second":this.current.add(this.step,"second");break;case"minute":this.current.add(this.step,"minute");break;case"hour":this.current.add(this.step,"hour"),this.current.month()<6?this.current.subtract(this.current.hours()%this.step,"hour"):this.current.hours()%this.step!=0&&this.current.add(this.step-this.current.hours()%this.step,"hour");break;case"weekday":case"day":this.current.add(this.step,"day");break;case"week":if(0!==this.current.weekday())this.current.weekday(0),this.current.add(this.step,"week");else if(!1===this.options.showMajorLabels)this.current.add(this.step,"week");else{const t=this.current.clone();t.add(1,"week"),t.isSame(this.current,"month")?this.current.add(this.step,"week"):(this.current.add(this.step,"week"),this.current.date(1))}break;case"month":this.current.add(this.step,"month");break;case"year":this.current.add(this.step,"year")}if(1!=this.step)switch(this.scale){case"millisecond":this.current.milliseconds()>0&&this.current.milliseconds()<this.step&&this.current.milliseconds(0);break;case"second":this.current.seconds()>0&&this.current.seconds()<this.step&&this.current.seconds(0);break;case"minute":this.current.minutes()>0&&this.current.minutes()<this.step&&this.current.minutes(0);break;case"hour":this.current.hours()>0&&this.current.hours()<this.step&&this.current.hours(0);break;case"weekday":case"day":this.current.date()<this.step+1&&this.current.date(1);break;case"week":this.current.week()<this.step&&this.current.week(1);break;case"month":this.current.month()<this.step&&this.current.month(0)}this.current.valueOf()==t&&(this.current=this._end.clone()),this.switchedDay=!1,this.switchedMonth=!1,this.switchedYear=!1,E(this.moment,this,t)}getCurrent(){return this.current.clone()}setScale(t){t&&"string"==typeof t.scale&&(this.scale=t.scale,this.step=t.step>0?t.step:1,this.autoScale=!1)}setAutoScale(t){this.autoScale=t}setMinimumStep(t){if(null==t)return;const e=31104e6,i=2592e6,s=864e5,o=36e5,n=6e4,r=1e3;1e3*e>t&&(this.scale="year",this.step=1e3),500*e>t&&(this.scale="year",this.step=500),100*e>t&&(this.scale="year",this.step=100),50*e>t&&(this.scale="year",this.step=50),10*e>t&&(this.scale="year",this.step=10),5*e>t&&(this.scale="year",this.step=5),e>t&&(this.scale="year",this.step=1),7776e6>t&&(this.scale="month",this.step=3),i>t&&(this.scale="month",this.step=1),6048e5>t&&this.options.showWeekScale&&(this.scale="week",this.step=1),1728e5>t&&(this.scale="day",this.step=2),s>t&&(this.scale="day",this.step=1),432e5>t&&(this.scale="weekday",this.step=1),144e5>t&&(this.scale="hour",this.step=4),o>t&&(this.scale="hour",this.step=1),9e5>t&&(this.scale="minute",this.step=15),6e5>t&&(this.scale="minute",this.step=10),3e5>t&&(this.scale="minute",this.step=5),n>t&&(this.scale="minute",this.step=1),15e3>t&&(this.scale="second",this.step=15),1e4>t&&(this.scale="second",this.step=10),5e3>t&&(this.scale="second",this.step=5),r>t&&(this.scale="second",this.step=1),200>t&&(this.scale="millisecond",this.step=200),100>t&&(this.scale="millisecond",this.step=100),50>t&&(this.scale="millisecond",this.step=50),10>t&&(this.scale="millisecond",this.step=10),5>t&&(this.scale="millisecond",this.step=5),1>t&&(this.scale="millisecond",this.step=1)}static snap(t,e,i){const s=u(t);if("year"==e){const t=s.year()+Math.round(s.month()/12);s.year(Math.round(t/i)*i),s.month(0),s.date(0),s.hours(0),s.minutes(0),s.seconds(0),s.milliseconds(0)}else if("month"==e)s.date()>15?(s.date(1),s.add(1,"month")):s.date(1),s.hours(0),s.minutes(0),s.seconds(0),s.milliseconds(0);else if("week"==e)s.weekday()>2?(s.weekday(0),s.add(1,"week")):s.weekday(0),s.hours(0),s.minutes(0),s.seconds(0),s.milliseconds(0);else if("day"==e){switch(i){case 5:case 2:s.hours(24*Math.round(s.hours()/24));break;default:s.hours(12*Math.round(s.hours()/12))}s.minutes(0),s.seconds(0),s.milliseconds(0)}else if("weekday"==e){switch(i){case 5:case 2:s.hours(12*Math.round(s.hours()/12));break;default:s.hours(6*Math.round(s.hours()/6))}s.minutes(0),s.seconds(0),s.milliseconds(0)}else if("hour"==e){if(4===i)s.minutes(60*Math.round(s.minutes()/60));else s.minutes(30*Math.round(s.minutes()/30));s.seconds(0),s.milliseconds(0)}else if("minute"==e){switch(i){case 15:case 10:s.minutes(5*Math.round(s.minutes()/5)),s.seconds(0);break;case 5:s.seconds(60*Math.round(s.seconds()/60));break;default:s.seconds(30*Math.round(s.seconds()/30))}s.milliseconds(0)}else if("second"==e)switch(i){case 15:case 10:s.seconds(5*Math.round(s.seconds()/5)),s.milliseconds(0);break;case 5:s.milliseconds(1e3*Math.round(s.milliseconds()/1e3));break;default:s.milliseconds(500*Math.round(s.milliseconds()/500))}else if("millisecond"==e){const t=i>5?i/2:1;s.milliseconds(Math.round(s.milliseconds()/t)*t)}return s}isMajor(){if(1==this.switchedYear)switch(this.scale){case"year":case"month":case"week":case"weekday":case"day":case"hour":case"minute":case"second":case"millisecond":return!0;default:return!1}else if(1==this.switchedMonth)switch(this.scale){case"week":case"weekday":case"day":case"hour":case"minute":case"second":case"millisecond":return!0;default:return!1}else if(1==this.switchedDay)switch(this.scale){case"millisecond":case"second":case"minute":case"hour":return!0;default:return!1}const t=this.moment(this.current);switch(this.scale){case"millisecond":return 0==t.milliseconds();case"second":return 0==t.seconds();case"minute":return 0==t.hours()&&0==t.minutes();case"hour":return 0==t.hours();case"weekday":case"day":return this.options.showWeekScale?1==t.isoWeekday():1==t.date();case"week":return 1==t.date();case"month":return 0==t.month();default:return!1}}getLabelMinor(t){if(null==t&&(t=this.current),t instanceof Date&&(t=this.moment(t)),"function"==typeof this.format.minorLabels)return this.format.minorLabels(t,this.scale,this.step);const e=this.format.minorLabels[this.scale];return"week"===this.scale&&1===t.date()&&0!==t.weekday()?"":e&&e.length>0?this.moment(t).format(e):""}getLabelMajor(t){if(null==t&&(t=this.current),t instanceof Date&&(t=this.moment(t)),"function"==typeof this.format.majorLabels)return this.format.majorLabels(t,this.scale,this.step);const e=this.format.majorLabels[this.scale];return e&&e.length>0?this.moment(t).format(e):""}getClassName(){const t=this.moment,e=this.moment(this.current),i=e.locale?e.locale("en"):e.lang("en"),s=this.step,o=[];function n(t){return t/s%2==0?" vis-even":" vis-odd"}function r(e){return e.isSame(Date.now(),"day")?" vis-today":e.isSame(t().add(1,"day"),"day")?" vis-tomorrow":e.isSame(t().add(-1,"day"),"day")?" vis-yesterday":""}function a(t){return t.isSame(Date.now(),"week")?" vis-current-week":""}function h(t){return t.isSame(Date.now(),"month")?" vis-current-month":""}switch(this.scale){case"millisecond":o.push(r(i)),o.push(n(i.milliseconds()));break;case"second":o.push(r(i)),o.push(n(i.seconds()));break;case"minute":o.push(r(i)),o.push(n(i.minutes()));break;case"hour":o.push(`vis-h${i.hours()}${4==this.step?"-h"+(i.hours()+4):""}`),o.push(r(i)),o.push(n(i.hours()));break;case"weekday":o.push(`vis-${i.format("dddd").toLowerCase()}`),o.push(r(i)),o.push(a(i)),o.push(n(i.date()));break;case"day":o.push(`vis-day${i.date()}`),o.push(`vis-${i.format("MMMM").toLowerCase()}`),o.push(r(i)),o.push(h(i)),o.push(this.step<=2?r(i):""),o.push(this.step<=2?`vis-${i.format("dddd").toLowerCase()}`:""),o.push(n(i.date()-1));break;case"week":o.push(`vis-week${i.format("w")}`),o.push(a(i)),o.push(n(i.week()));break;case"month":o.push(`vis-${i.format("MMMM").toLowerCase()}`),o.push(h(i)),o.push(n(i.month()));break;case"year":o.push(`vis-year${i.year()}`),o.push(function(t){return t.isSame(Date.now(),"year")?" vis-current-year":""}(i)),o.push(n(i.year()))}return o.filter(String).join(" ")}}$.FORMAT={minorLabels:{millisecond:"SSS",second:"s",minute:"HH:mm",hour:"HH:mm",weekday:"ddd D",day:"D",week:"w",month:"MMM",year:"YYYY"},majorLabels:{millisecond:"HH:mm:ss",second:"D MMMM HH:mm",minute:"ddd D MMMM",hour:"ddd D MMMM",weekday:"MMMM YYYY",day:"MMMM YYYY",week:"MMMM YYYY",month:"YYYY",year:""}};class W extends C{constructor(t,e){super(),this.dom={foreground:null,lines:[],majorTexts:[],minorTexts:[],redundant:{lines:[],majorTexts:[],minorTexts:[]}},this.props={range:{start:0,end:0,minimumStep:0},lineTop:0},this.defaultOptions={orientation:{axis:"bottom"},showMinorLabels:!0,showMajorLabels:!0,showWeekScale:!1,maxMinorChars:7,format:D.extend({},$.FORMAT),moment:u,timeAxis:null},this.options=D.extend({},this.defaultOptions),this.body=t,this._create(),this.setOptions(e)}setOptions(t){t&&(D.selectiveExtend(["showMinorLabels","showMajorLabels","showWeekScale","maxMinorChars","hiddenDates","timeAxis","moment","rtl"],this.options,t),D.selectiveDeepExtend(["format"],this.options,t),"orientation"in t&&("string"==typeof t.orientation?this.options.orientation.axis=t.orientation:"object"==typeof t.orientation&&"axis"in t.orientation&&(this.options.orientation.axis=t.orientation.axis)),"locale"in t&&("function"==typeof u.locale?u.locale(t.locale):u.lang(t.locale)))}_create(){this.dom.foreground=document.createElement("div"),this.dom.background=document.createElement("div"),this.dom.foreground.className="vis-time-axis vis-foreground",this.dom.background.className="vis-time-axis vis-background"}destroy(){this.dom.foreground.parentNode&&this.dom.foreground.parentNode.removeChild(this.dom.foreground),this.dom.background.parentNode&&this.dom.background.parentNode.removeChild(this.dom.background),this.body=null}redraw(){const t=this.props,e=this.dom.foreground,i=this.dom.background,s="top"==this.options.orientation.axis?this.body.dom.top:this.body.dom.bottom,o=e.parentNode!==s;this._calculateCharSize();const n=this.options.showMinorLabels&&"none"!==this.options.orientation.axis,r=this.options.showMajorLabels&&"none"!==this.options.orientation.axis;t.minorLabelHeight=n?t.minorCharHeight:0,t.majorLabelHeight=r?t.majorCharHeight:0,t.height=t.minorLabelHeight+t.majorLabelHeight,t.width=e.offsetWidth,t.minorLineHeight=this.body.domProps.root.height-t.majorLabelHeight-("top"==this.options.orientation.axis?this.body.domProps.bottom.height:this.body.domProps.top.height),t.minorLineWidth=1,t.majorLineHeight=t.minorLineHeight+t.majorLabelHeight,t.majorLineWidth=1;const a=e.nextSibling,h=i.nextSibling;return e.parentNode&&e.parentNode.removeChild(e),i.parentNode&&i.parentNode.removeChild(i),e.style.height=`${this.props.height}px`,this._repaintLabels(),a?s.insertBefore(e,a):s.appendChild(e),h?this.body.dom.backgroundVertical.insertBefore(i,h):this.body.dom.backgroundVertical.appendChild(i),this._isResized()||o}_repaintLabels(){const t=this.options.orientation.axis,e=D.convert(this.body.range.start,"Number"),i=D.convert(this.body.range.end,"Number"),s=this.body.util.toTime((this.props.minorCharWidth||10)*this.options.maxMinorChars).valueOf();let o=s-A(this.options.moment,this.body.hiddenDates,this.body.range,s);o-=this.body.util.toTime(0).valueOf();const n=new $(new Date(e),new Date(i),o,this.body.hiddenDates,this.options);n.setMoment(this.options.moment),this.options.format&&n.setFormat(this.options.format),this.options.timeAxis&&n.setScale(this.options.timeAxis),this.step=n;const r=this.dom;let a,h,l,d,p,m;r.redundant.lines=r.lines,r.redundant.majorTexts=r.majorTexts,r.redundant.minorTexts=r.minorTexts,r.lines=[],r.majorTexts=[],r.minorTexts=[];let c,u,g,f=0,b=0;const y=1e3;let v;for(n.start(),h=n.getCurrent(),d=this.body.util.toScreen(h);n.hasNext()&&b<y;){if(b++,p=n.isMajor(),v=n.getClassName(),a=h,l=d,n.next(),h=n.getCurrent(),d=this.body.util.toScreen(h),c=f,f=d-l,"week"===n.scale)m=!0;else m=f>=.4*c;if(this.options.showMinorLabels&&m){var w=this._repaintMinorText(l,n.getLabelMinor(a),t,v);w.style.width=`${f}px`}p&&this.options.showMajorLabels?(l>0&&(null==g&&(g=l),w=this._repaintMajorText(l,n.getLabelMajor(a),t,v)),u=this._repaintMajorLine(l,f,t,v)):m?u=this._repaintMinorLine(l,f,t,v):u&&(u.style.width=`${parseInt(u.style.width)+f}px`)}if(b!==y||V||(console.warn("Something is wrong with the Timeline scale. Limited drawing of grid lines to 1000 lines."),V=!0),this.options.showMajorLabels){const e=this.body.util.toTime(0),i=n.getLabelMajor(e),s=i.length*(this.props.majorCharWidth||10)+10;(null==g||s<g)&&this._repaintMajorText(0,i,t,v)}D.forEach(this.dom.redundant,(t=>{for(;t.length;){const e=t.pop();e&&e.parentNode&&e.parentNode.removeChild(e)}}))}_repaintMinorText(t,e,i,s){let o=this.dom.redundant.minorTexts.shift();if(!o){const t=document.createTextNode("");o=document.createElement("div"),o.appendChild(t),this.dom.foreground.appendChild(o)}this.dom.minorTexts.push(o),o.innerHTML=D.xss(e);let n="top"==i?this.props.majorLabelHeight:0;return this._setXY(o,t,n),o.className=`vis-text vis-minor ${s}`,o}_repaintMajorText(t,e,i,s){let o=this.dom.redundant.majorTexts.shift();if(!o){const t=document.createElement("div");o=document.createElement("div"),o.appendChild(t),this.dom.foreground.appendChild(o)}o.childNodes[0].innerHTML=D.xss(e),o.className=`vis-text vis-major ${s}`;let n="top"==i?0:this.props.minorLabelHeight;return this._setXY(o,t,n),this.dom.majorTexts.push(o),o}_setXY(t,e,i){const s=this.options.rtl?-1*e:e;t.style.transform=`translate(${s}px, ${i}px)`}_repaintMinorLine(t,e,i,s){let o=this.dom.redundant.lines.shift();o||(o=document.createElement("div"),this.dom.background.appendChild(o)),this.dom.lines.push(o);const n=this.props;o.style.width=`${e}px`,o.style.height=`${n.minorLineHeight}px`;let r="top"==i?n.majorLabelHeight:this.body.domProps.top.height,a=t-n.minorLineWidth/2;return this._setXY(o,a,r),o.className=`vis-grid ${this.options.rtl?"vis-vertical-rtl":"vis-vertical"} vis-minor ${s}`,o}_repaintMajorLine(t,e,i,s){let o=this.dom.redundant.lines.shift();o||(o=document.createElement("div"),this.dom.background.appendChild(o)),this.dom.lines.push(o);const n=this.props;o.style.width=`${e}px`,o.style.height=`${n.majorLineHeight}px`;let r="top"==i?0:this.body.domProps.top.height,a=t-n.majorLineWidth/2;return this._setXY(o,a,r),o.className=`vis-grid ${this.options.rtl?"vis-vertical-rtl":"vis-vertical"} vis-major ${s}`,o}_calculateCharSize(){this.dom.measureCharMinor||(this.dom.measureCharMinor=document.createElement("DIV"),this.dom.measureCharMinor.className="vis-text vis-minor vis-measure",this.dom.measureCharMinor.style.position="absolute",this.dom.measureCharMinor.appendChild(document.createTextNode("0")),this.dom.foreground.appendChild(this.dom.measureCharMinor)),this.props.minorCharHeight=this.dom.measureCharMinor.clientHeight,this.props.minorCharWidth=this.dom.measureCharMinor.clientWidth,this.dom.measureCharMajor||(this.dom.measureCharMajor=document.createElement("DIV"),this.dom.measureCharMajor.className="vis-text vis-major vis-measure",this.dom.measureCharMajor.style.position="absolute",this.dom.measureCharMajor.appendChild(document.createTextNode("0")),this.dom.foreground.appendChild(this.dom.measureCharMajor)),this.props.majorCharHeight=this.dom.measureCharMajor.clientHeight,this.props.majorCharWidth=this.dom.measureCharMajor.clientWidth}}var V=!1;function U(t){this.active=!1,this.dom={container:t},this.dom.overlay=document.createElement("div"),this.dom.overlay.className="vis-overlay",this.dom.container.appendChild(this.dom.overlay),this.hammer=B(this.dom.overlay),this.hammer.on("tap",this._onTapOverlay.bind(this));var e=this;["tap","doubletap","press","pinch","pan","panstart","panmove","panend"].forEach((function(t){e.hammer.on(t,(function(t){t.stopPropagation()}))})),document&&document.body&&(this.onClick=function(i){(function(t,e){for(;t;){if(t===e)return!0;t=t.parentNode}return!1})(i.target,t)||e.deactivate()},document.body.addEventListener("click",this.onClick)),void 0!==this.keycharm&&this.keycharm.destroy(),this.keycharm=d(),this.escListener=this.deactivate.bind(this)}a(U.prototype),U.current=null,U.prototype.destroy=function(){this.deactivate(),this.dom.overlay.parentNode.removeChild(this.dom.overlay),this.onClick&&document.body.removeEventListener("click",this.onClick),void 0!==this.keycharm&&this.keycharm.destroy(),this.keycharm=null,this.hammer.destroy(),this.hammer=null},U.prototype.activate=function(){U.current&&U.current.deactivate(),U.current=this,this.active=!0,this.dom.overlay.style.display="none",D.addClassName(this.dom.container,"vis-active"),this.emit("change"),this.emit("activate"),this.keycharm.bind("esc",this.escListener)},U.prototype.deactivate=function(){U.current===this&&(U.current=null),this.active=!1,this.dom.overlay.style.display="",D.removeClassName(this.dom.container,"vis-active"),this.keycharm.unbind("esc",this.escListener),this.emit("change"),this.emit("deactivate")},U.prototype._onTapOverlay=function(t){this.activate(),t.stopPropagation()};const X={current:"current",time:"time",deleteSelected:"Delete selected"},q={current:"attuale",time:"tempo",deleteSelected:"Cancella la selezione"},K={current:"huidige",time:"tijd",deleteSelected:"Selectie verwijderen"},J={current:"Aktuelle",time:"Zeit",deleteSelected:"Lösche Auswahl"},Z={current:"actuel",time:"heure",deleteSelected:"Effacer la selection"},Q={current:"corriente",time:"hora",deleteSelected:"Eliminar selección"},tt={current:"поточний",time:"час",deleteSelected:"Видалити обране"},et={current:"текущее",time:"время",deleteSelected:"Удалить выбранное"},it={current:"aktualny",time:"czas",deleteSelected:"Usuń wybrane"},st={current:"atual",time:"data",deleteSelected:"Apagar selecionado"},ot={current:"現在",time:"時刻",deleteSelected:"選択されたものを削除"},nt={current:"nuvarande",time:"tid",deleteSelected:"Radera valda"},rt={current:"nåværende",time:"tid",deleteSelected:"Slett valgte"},at={current:"einamas",time:"laikas",deleteSelected:"Pašalinti pasirinktą"},ht={en:X,en_EN:X,en_US:X,it:q,it_IT:q,it_CH:q,nl:K,nl_NL:K,nl_BE:K,de:J,de_DE:J,fr:Z,fr_FR:Z,fr_CA:Z,fr_BE:Z,es:Q,es_ES:Q,uk:tt,uk_UA:tt,ru:et,ru_RU:et,pl:it,pl_PL:it,pt:st,pt_BR:st,pt_PT:st,ja:ot,ja_JP:ot,lt:at,lt_LT:at,sv:nt,sv_SE:nt,nb:rt,nn:rt,nb_NO:rt,nn_NO:rt};class lt extends C{constructor(t,e){super(),this.body=t,this.defaultOptions={moment:u,locales:ht,locale:"en",id:void 0,title:void 0},this.options=D.extend({},this.defaultOptions),this.setOptions(e),this.options.locales=D.extend({},ht,this.options.locales);const i=this.defaultOptions.locales[this.defaultOptions.locale];Object.keys(this.options.locales).forEach((t=>{this.options.locales[t]=D.extend({},i,this.options.locales[t])})),e&&null!=e.time?this.customTime=e.time:this.customTime=new Date,this.eventParams={},this._create()}setOptions(t){t&&D.selectiveExtend(["moment","locale","locales","id","title","rtl","snap"],this.options,t)}_create(){const t=document.createElement("div");t["custom-time"]=this,t.className=`vis-custom-time ${this.options.id||""}`,t.style.position="absolute",t.style.top="0px",t.style.height="100%",this.bar=t;const e=document.createElement("div");function i(t){this.body.range._onMouseWheel(t)}e.style.position="relative",e.style.top="0px",this.options.rtl?e.style.right="-10px":e.style.left="-10px",e.style.height="100%",e.style.width="20px",e.addEventListener?(e.addEventListener("mousewheel",i.bind(this),!1),e.addEventListener("DOMMouseScroll",i.bind(this),!1)):e.attachEvent("onmousewheel",i.bind(this)),t.appendChild(e),this.hammer=new B(e),this.hammer.on("panstart",this._onDragStart.bind(this)),this.hammer.on("panmove",this._onDrag.bind(this)),this.hammer.on("panend",this._onDragEnd.bind(this)),this.hammer.get("pan").set({threshold:5,direction:B.DIRECTION_ALL}),this.hammer.get("press").set({time:1e4})}destroy(){this.hide(),this.hammer.destroy(),this.hammer=null,this.body=null}redraw(){const t=this.body.dom.backgroundVertical;this.bar.parentNode!=t&&(this.bar.parentNode&&this.bar.parentNode.removeChild(this.bar),t.appendChild(this.bar));const e=this.body.util.toScreen(this.customTime);let i=this.options.locales[this.options.locale];i||(this.warned||(console.warn(`WARNING: options.locales['${this.options.locale}'] not found. See https://visjs.github.io/vis-timeline/docs/timeline/#Localization`),this.warned=!0),i=this.options.locales.en);let s=this.options.title;return void 0===s?(s=`${i.time}: ${this.options.moment(this.customTime).format("dddd, MMMM Do YYYY, H:mm:ss")}`,s=s.charAt(0).toUpperCase()+s.substring(1)):"function"==typeof s&&(s=s.call(this,this.customTime)),this.options.rtl?this.bar.style.right=`${e}px`:this.bar.style.left=`${e}px`,this.bar.title=s,!1}hide(){this.bar.parentNode&&this.bar.parentNode.removeChild(this.bar)}setCustomTime(t){this.customTime=D.convert(t,"Date"),this.redraw()}getCustomTime(){return new Date(this.customTime.valueOf())}setCustomMarker(t,e){this.marker&&this.bar.removeChild(this.marker),this.marker=document.createElement("div"),this.marker.className="vis-custom-time-marker",this.marker.innerHTML=D.xss(t),this.marker.style.position="absolute",e&&(this.marker.setAttribute("contenteditable","true"),this.marker.addEventListener("pointerdown",(function(){this.marker.focus()})),this.marker.addEventListener("input",this._onMarkerChange.bind(this)),this.marker.title=t,this.marker.addEventListener("blur",function(t){this.title!=t.target.innerHTML&&(this._onMarkerChanged(t),this.title=t.target.innerHTML)}.bind(this))),this.bar.appendChild(this.marker)}setCustomTitle(t){this.options.title=t}_onDragStart(t){this.eventParams.dragging=!0,this.eventParams.customTime=this.customTime,t.stopPropagation()}_onDrag(t){if(!this.eventParams.dragging)return;let e=this.options.rtl?-1*t.deltaX:t.deltaX;const i=this.body.util.toScreen(this.eventParams.customTime)+e,s=this.body.util.toTime(i),o=this.body.util.getScale(),n=this.body.util.getStep(),r=this.options.snap,a=r?r(s,o,n):s;this.setCustomTime(a),this.body.emitter.emit("timechange",{id:this.options.id,time:new Date(this.customTime.valueOf()),event:t}),t.stopPropagation()}_onDragEnd(t){this.eventParams.dragging&&(this.body.emitter.emit("timechanged",{id:this.options.id,time:new Date(this.customTime.valueOf()),event:t}),t.stopPropagation())}_onMarkerChange(t){this.body.emitter.emit("markerchange",{id:this.options.id,title:t.target.innerHTML,event:t}),t.stopPropagation()}_onMarkerChanged(t){this.body.emitter.emit("markerchanged",{id:this.options.id,title:t.target.innerHTML,event:t}),t.stopPropagation()}static customTimeFromTarget(t){let e=t.target;for(;e;){if(e.hasOwnProperty("custom-time"))return e["custom-time"];e=e.parentNode}return null}}class dt{_create(t){this.dom={},this.dom.container=t,this.dom.container.style.position="relative",this.dom.root=document.createElement("div"),this.dom.background=document.createElement("div"),this.dom.backgroundVertical=document.createElement("div"),this.dom.backgroundHorizontal=document.createElement("div"),this.dom.centerContainer=document.createElement("div"),this.dom.leftContainer=document.createElement("div"),this.dom.rightContainer=document.createElement("div"),this.dom.center=document.createElement("div"),this.dom.left=document.createElement("div"),this.dom.right=document.createElement("div"),this.dom.top=document.createElement("div"),this.dom.bottom=document.createElement("div"),this.dom.shadowTop=document.createElement("div"),this.dom.shadowBottom=document.createElement("div"),this.dom.shadowTopLeft=document.createElement("div"),this.dom.shadowBottomLeft=document.createElement("div"),this.dom.shadowTopRight=document.createElement("div"),this.dom.shadowBottomRight=document.createElement("div"),this.dom.rollingModeBtn=document.createElement("div"),this.dom.loadingScreen=document.createElement("div"),this.dom.root.className="vis-timeline",this.dom.background.className="vis-panel vis-background",this.dom.backgroundVertical.className="vis-panel vis-background vis-vertical",this.dom.backgroundHorizontal.className="vis-panel vis-background vis-horizontal",this.dom.centerContainer.className="vis-panel vis-center",this.dom.leftContainer.className="vis-panel vis-left",this.dom.rightContainer.className="vis-panel vis-right",this.dom.top.className="vis-panel vis-top",this.dom.bottom.className="vis-panel vis-bottom",this.dom.left.className="vis-content",this.dom.center.className="vis-content",this.dom.right.className="vis-content",this.dom.shadowTop.className="vis-shadow vis-top",this.dom.shadowBottom.className="vis-shadow vis-bottom",this.dom.shadowTopLeft.className="vis-shadow vis-top",this.dom.shadowBottomLeft.className="vis-shadow vis-bottom",this.dom.shadowTopRight.className="vis-shadow vis-top",this.dom.shadowBottomRight.className="vis-shadow vis-bottom",this.dom.rollingModeBtn.className="vis-rolling-mode-btn",this.dom.loadingScreen.className="vis-loading-screen",this.dom.root.appendChild(this.dom.background),this.dom.root.appendChild(this.dom.backgroundVertical),this.dom.root.appendChild(this.dom.backgroundHorizontal),this.dom.root.appendChild(this.dom.centerContainer),this.dom.root.appendChild(this.dom.leftContainer),this.dom.root.appendChild(this.dom.rightContainer),this.dom.root.appendChild(this.dom.top),this.dom.root.appendChild(this.dom.bottom),this.dom.root.appendChild(this.dom.rollingModeBtn),this.dom.centerContainer.appendChild(this.dom.center),this.dom.leftContainer.appendChild(this.dom.left),this.dom.rightContainer.appendChild(this.dom.right),this.dom.centerContainer.appendChild(this.dom.shadowTop),this.dom.centerContainer.appendChild(this.dom.shadowBottom),this.dom.leftContainer.appendChild(this.dom.shadowTopLeft),this.dom.leftContainer.appendChild(this.dom.shadowBottomLeft),this.dom.rightContainer.appendChild(this.dom.shadowTopRight),this.dom.rightContainer.appendChild(this.dom.shadowBottomRight),this.props={root:{},background:{},centerContainer:{},leftContainer:{},rightContainer:{},center:{},left:{},right:{},top:{},bottom:{},border:{},scrollTop:0,scrollTopMin:0},this.on("rangechange",(()=>{!0===this.initialDrawDone&&this._redraw()})),this.on("rangechanged",(()=>{this.initialRangeChangeDone||(this.initialRangeChangeDone=!0)})),this.on("touch",this._onTouch.bind(this)),this.on("panmove",this._onDrag.bind(this));const e=this;this._origRedraw=this._redraw.bind(this),this._redraw=D.throttle(this._origRedraw),this.on("_change",(t=>{e.itemSet&&e.itemSet.initialItemSetDrawn&&t&&1==t.queue?e._redraw():e._origRedraw()})),this.hammer=new B(this.dom.root);const i=this.hammer.get("pinch").set({enable:!0});i&&function(t){t.getTouchAction=function(){return["pan-y"]}}(i),this.hammer.get("pan").set({threshold:5,direction:B.DIRECTION_ALL}),this.timelineListeners={};var s,o;function n(t){this.isActive()&&this.emit("mousewheel",t);let e=0,i=0;if("detail"in t&&(i=-1*t.detail),"wheelDelta"in t&&(i=t.wheelDelta),"wheelDeltaY"in t&&(i=t.wheelDeltaY),"wheelDeltaX"in t&&(e=-1*t.wheelDeltaX),"axis"in t&&t.axis===t.HORIZONTAL_AXIS&&(e=-1*i,i=0),"deltaY"in t&&(i=-1*t.deltaY),"deltaX"in t&&(e=t.deltaX),t.deltaMode&&(1===t.deltaMode?(e*=40,i*=40):(e*=40,i*=800)),this.options.preferZoom){if(!this.options.zoomKey||t[this.options.zoomKey])return}else if(this.options.zoomKey&&t[this.options.zoomKey])return;if(this.options.verticalScroll||this.options.horizontalScroll)if(this.options.verticalScroll&&Math.abs(i)>=Math.abs(e)){const e=this.props.scrollTop,s=e+i;if(this.isActive()){this._setScrollTop(s)!==e&&(this._redraw(),this.emit