Socket
Socket
Sign inDemoInstall

timeline

Package Overview
Dependencies
0
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.3.1 to 3.4.1

3

build/api.js

@@ -6,2 +6,3 @@ "use strict";

const constants_1 = require("./constants");
const event_bus_1 = require("./event-bus");
class Api {

@@ -45,3 +46,3 @@ constructor() {

realFunc = func;
document.addEventListener(eventType, realFunc);
event_bus_1.default.register(eventType, realFunc);
}

@@ -48,0 +49,0 @@ }

@@ -11,3 +11,3 @@ import { Props } from './models/props';

import { EventType } from './constants';
export { Config as TimelineConfig, Ev3nt, Ev3ntLocation, EventsBand, EventType, MinimapBand, OrderedTimeline, Props as TimelineProps, RawEv3nt, calcPixelsPerMillisecond, formatDate, orderEvents, Voyage, };
export { Config as TimelineConfig, Ev3nt, Ev3ntLocation, EventType, EventsBand, MinimapBand, OrderedTimeline, Props as TimelineProps, RawEv3nt, Voyage, calcPixelsPerMillisecond, formatDate, orderEvents, };
export declare type OnSelectFunction = (e: Ev3nt, band: EventsBand, props: Props) => void;

@@ -21,4 +21,6 @@ export default class Timeline extends Api {

private render;
center(): number;
visibleEvents(): Ev3nt[];
private renderLabels;
private appendToWrapper;
}

@@ -82,2 +82,10 @@ "use strict";

}
center() {
return props_1.default.center;
}
visibleEvents() {
return props_1.default.eventsBands
.map(band => band.visibleEvents)
.reduce((prev, curr) => prev.concat(curr));
}
renderLabels() {

@@ -84,0 +92,0 @@ props_1.default.bands

@@ -29,6 +29,11 @@ import { Milliseconds, Pixels } from '../constants';

ed: Milliseconds;
route: string;
route?: string;
sp?: Point;
ep?: Point;
}
export declare class Area {
d: Milliseconds;
ed: Milliseconds;
area: string;
}
export declare class RawEv3nt {

@@ -48,2 +53,3 @@ class: string[];

lbl: string;
areas: Area[];
locs: Ev3ntLocation[];

@@ -50,0 +56,0 @@ voyages: Voyage[];

@@ -20,2 +20,5 @@ "use strict";

exports.Voyage = Voyage;
class Area {
}
exports.Area = Area;
class RawEv3nt {

@@ -22,0 +25,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const create_element_1 = require("../../utils/create-element");

@@ -50,21 +49,19 @@ const props_1 = require("../../models/props");

updateImages() {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
for (const band of props_1.default.eventsBands) {
for (const event of band.visibleEvents) {
if (event.img == null)
continue;
if (event.image == null) {
const path = `${props_1.default.imagePath}/${event.wid}__${constants_1.IMAGE_SIZE}.${event.img}`;
event.image = new Image();
const onImgLoad = this.onImgLoad(event);
event.image.addEventListener('load', onImgLoad);
event.image.addEventListener('error', onImgLoad);
event.image.src = path;
}
else {
this.drawImage(event);
}
for (const band of props_1.default.eventsBands) {
for (const event of band.visibleEvents) {
if (event.img == null)
continue;
if (event.image == null) {
const path = `${props_1.default.imagePath}/${event.wid}__${constants_1.IMAGE_SIZE}.${event.img}`;
event.image = new Image();
const onImgLoad = this.onImgLoad(event);
event.image.addEventListener('load', onImgLoad);
event.image.addEventListener('error', onImgLoad);
event.image.src = path;
}
else {
this.drawImage(event);
}
}
});
}
}

@@ -71,0 +68,0 @@ drawImage(event) {

@@ -1,16 +0,1 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Timeline=e():t.Timeline=e()}(this,function(){return function(t){var e={};function i(n){if(e[n])return e[n].exports;var s=e[n]={i:n,l:!1,exports:{}};return t[n].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)i.d(n,s,function(e){return t[e]}.bind(null,s));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="/dist/",i(i.s=9)}([function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.IMAGE_SIZES=[16,32,64,128,256],e.EVENT_HEIGHT=16,e.LETTER_WIDTH=Math.round(.1875*e.EVENT_HEIGHT+3.5),e.FONT_SIZE=Math.round(.3125*e.EVENT_HEIGHT+6),e.ROW_SPACING=Math.round(e.EVENT_HEIGHT/3),e.EVENT_ROW_HEIGHT=e.EVENT_HEIGHT+e.ROW_SPACING,e.DATE_BAR_HEIGHT=e.EVENT_ROW_HEIGHT,e.IMAGE_BOUNDING_BOX=2*e.EVENT_ROW_HEIGHT-2*e.ROW_SPACING,e.IMAGE_BORDER_SIZE=Math.round(e.ROW_SPACING/2),e.IMAGE_SIZE=e.IMAGE_SIZES.reduce((t,i)=>Math.abs(i-e.IMAGE_BOUNDING_BOX)<Math.abs(t-e.IMAGE_BOUNDING_BOX)?i:t),function(t){t.CenterChange="CenterChange",t.ZoomDone="ZoomDone",t.ScrollDone="ScrollDone",t.Pause="Pause",t.Play="Play",t.Select="Select"}(e.EventType||(e.EventType={})),e.PIXELS_PER_LETTER=8,e.DEFAULT_IMAGE_PATH="/images";e.RawSegment=class{},e.colors=["rgba(211,84,0","rgba(219,10,91","rgba(31,58,147","rgba(0,128,0"].map(t=>(e=1)=>`${t},${e})`)},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=i(0),s=i(4),o=i(9),r=i(6);function a(t){return t.type===s.BandType.EventsBand}function l(t){return t.type===s.BandType.MinimapBand}class h{constructor(){this.defaultCenterRatio=.5}get center(){return this._center}set center(t){this._center===this.from&&t<this.from||this._center===this.to&&t>this.to||(t<this.from?this._center=this.from:t>this.to?this._center=this.to:this._center=t,r.default.dispatch(n.EventType.CenterChange))}set dimensions(t){const e=getComputedStyle(t);this.viewportHeight=parseInt(e.getPropertyValue("height"),10),this.viewportOffset=t.getBoundingClientRect().top,this.viewportWidth=parseInt(e.getPropertyValue("width"),10)}init(t){null==t.rootElement&&console.error("[init] No rootElement found"),this.imagePath=null!=t.imagePath?t.imagePath:n.DEFAULT_IMAGE_PATH,this.rootElement=t.rootElement,this.dimensions=this.rootElement,this.bands=t.bands,this.eventsBands=this.bands.filter(a),this.minimapBands=this.bands.filter(l),this.controlBand=null!=t.controlBand?t.controlBand:this.eventsBands[0];const e=performance.now(),i={bands:this.eventsBands.map(t=>({events:t.config.events,zoomLevel:t.config.zoomLevel})),parent:t.parent,viewportWidth:this.viewportWidth},s=o.orderEvents(i);this.parent=s.parent,this.from=s.from,this.to=s.to,this.time=s.time;const r=performance.now();console.log("Performance: ",`${r-e}ms\n[from] ${new Date(this.from).toUTCString()}\n[ to ] ${new Date(this.to).toUTCString()}`),this.center=null!=t.center?t.center:this.from+this.defaultCenterRatio*this.time;for(const[t,e]of this.eventsBands.entries())e.init(s.bands[t]);for(const t of this.minimapBands)t.init()}resize(){this.dimensions=this.rootElement}}e.Props=h,e.default=new h},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=i(1),s=i(0),o=i(6);var r;!function(t){t[t.Backward=-1]="Backward",t[t.Stop=0]="Stop",t[t.Forward=1]="Forward"}(r||(r={}));class a{constructor(){this.elapsedTimeThreshold=2e3,this.goToDuration=300,this.zoomToDuration=300,this.multipliers=[.25,.5,1,2,4,8,16],this.multiplier=1,this.direction=r.Stop,this.elapsedTimeTotal=0,this.models=[],this.views=[],this.animate=(t=>{const e=null==this.prevTimestamp?0:t-this.prevTimestamp;if(e>0||null==this.prevTimestamp){if(null==this.centerMarker&&null==this.zoomMarker)n.default.center+=n.default.controlBand.time/480*this.multiplier*this.direction;else if(null!=this.centerMarker){const t=this.goToDuration-this.elapsedTimeTotal,i=Math.abs(this.centerMarker-n.default.center)/(t/e);t<e?(n.default.center=this.centerMarker,this.stop()):n.default.center=n.default.center+i*this.direction}else if(null!=this.zoomMarker){const t=this.zoomToDuration-this.elapsedTimeTotal,i=(this.zoomMarker-this.activeBand.zoomLevel)/(t/e);if(t<e)this.activeBand.zoomLevel=this.zoomMarker,n.default.eventsBands.forEach(t=>{t===this.activeBand?this.activeBand.zoomLevel=this.zoomMarker:t.zoomLevel=this.zoomMarker+(t.config.zoomLevel-this.activeBand.config.zoomLevel)}),this.adjustMinimapBands(),o.default.dispatch(s.EventType.ZoomDone),this.stop();else{for(const t of n.default.eventsBands)t.zoomLevel=t.zoomLevel+i;this.adjustMinimapBands()}}this.models.forEach(t=>t.update()),this.views.forEach(t=>t.update())}this.elapsedTimeTotal+=e,this.elapsedTimeTotal>this.elapsedTimeThreshold&&this.resetElapsedTimeTotal(),(this.isPlaying()||null!=this.zoomMarker)&&(n.default.center>=n.default.from&&n.default.center<=n.default.to||null!=this.centerMarker||null!=this.zoomMarker?(this.prevTimestamp=t,requestAnimationFrame(this.animate)):this.stop())})}registerModel(t){this.models.push(t)}registerView(t){this.views.push(t)}adjustMinimapBands(){n.default.minimapBands.forEach(t=>{this.activeBand.zoomLevel<t.config.zoomLevel&&(t.zoomLevel=this.activeBand.zoomLevel)})}resetElapsedTimeTotal(){this.elapsedTimeTotal=0,o.default.dispatch(s.EventType.CenterChange)}accelerate(){const t=this.multipliers.indexOf(this.multiplier);return t===this.multipliers.length-1?this.multipliers[this.multipliers.length-1]:(this.multiplier=this.multipliers[t+1],this.multiplier)}decelerate(){const t=this.multipliers.indexOf(this.multiplier);return 0===t?this.multipliers[0]:(this.multiplier=this.multipliers[t-1],this.multiplier)}goTo(t){this.centerMarker=t,t>n.default.center?this.playForward():this.playBackward()}zoomTo(t,e){null==this.zoomMarker&&(e<0&&(e=0),t!==this.activeBand&&(this.stop(),this.activeBand=t),this.activeBand.zoomLevel!==e&&(this.zoomMarker=e,this.nextFrame()))}speed(t){const e=parseFloat(t);-1!==this.multipliers.indexOf(e)&&(this.multiplier=e)}isPlaying(){return this.direction!==r.Stop}isPlayingForward(){return this.direction===r.Forward}isPlayingBackward(){return this.direction===r.Backward}nextFrame(){requestAnimationFrame(this.animate)}playForward(){o.default.dispatch(s.EventType.Play),this.direction=r.Forward,this.nextFrame()}playBackward(){o.default.dispatch(s.EventType.Play),this.direction=r.Backward,this.nextFrame()}stop(){o.default.dispatch(s.EventType.Pause),this.direction=r.Stop,this.activeBand=null,this.centerMarker=null,this.zoomMarker=null,this.prevTimestamp=null,this.elapsedTimeTotal=0}toggle(){this.isPlaying()?this.stop():this.nextFrame()}}e.Animator=a,e.default=new a},function(t,e,i){"use strict";let n;if(Object.defineProperty(e,"__esModule",{value:!0}),e.createSvg=((t,e,i={})=>{const n=document.createElementNS("http://www.w3.org/2000/svg",t);return null!=e&&n.setAttribute("style",e.join(";").concat(";")),Object.keys(i).forEach(t=>n.setAttribute(t,i[t])),n}),"undefined"!=typeof window){const t=document.createElement("style");document.head.appendChild(t),n=t.sheet}const s={};e.default=function(t,e,i,o){if(!e)return document.createElement(t);let r;return s.hasOwnProperty(e)?r=s[e].cloneNode(!1):((r=document.createElement(t)).classList.add(e),i&&n.insertRule(`.${e} { ${i.join(";").concat(";")} }`),s[e]=r.cloneNode(!1)),o&&r.setAttribute("style",o.join(";").concat(";")),r}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=i(5),s=i(1),o=i(0),r=i(7),a=i(2);!function(t){t[t.EventsBand=0]="EventsBand",t[t.MinimapBand=1]="MinimapBand"}(e.BandType||(e.BandType={}));e.default=class{constructor(t){this.config=t,this.defaultZoomLevel=0}get offsetX(){return this._offsetX}set offsetX(t){this.prevOffsetX=this.offsetX||t,this._offsetX=t}get zoomLevel(){return this._zoomLevel}set zoomLevel(t){t<0&&(t=0),this.visibleRatio=r.visibleRatio(t),this.width=Math.round(s.default.viewportWidth/this.visibleRatio),this.pixelsPerMillisecond=this.width/s.default.time,this.time=this.visibleRatio*s.default.time,this.granularity=n.getGranularity(this.pixelsPerMillisecond),this.nextDate=n.subsequentDate(this.granularity),this.prevZoomLevel=this.zoomLevel||t,this._zoomLevel=t,this.setHorizontalProps()}setVerticalProps(){this.visibleHeight=Math.round(this.config.heightRatio*s.default.viewportHeight),this.availableHeight=this.visibleHeight-o.DATE_BAR_HEIGHT,this.availableHeight/this.visibleHeight<.666&&(this.availableHeight=.666*this.visibleHeight),this.visibleRowsCount=Math.floor(this.availableHeight/o.EVENT_ROW_HEIGHT)-1,this.top=Math.round(this.config.topOffsetRatio*s.default.viewportHeight)}setHorizontalProps(){this.from=s.default.center-this.time/2,this.to=s.default.center+this.time/2,this.offsetX=(s.default.from-this.from)*this.pixelsPerMillisecond}init(t){this.zoomLevel=this.config.zoomLevel,this.setVerticalProps(),a.default.registerModel(this)}resize(){this.zoomLevel=this.zoomLevel,this.setVerticalProps()}update(){this.setHorizontalProps()}updateConfig(t){Object.keys(t).forEach(e=>{this.config.hasOwnProperty(e)&&(this.config[e]=t[e])})}positionAtTimestamp(t){return Math.round((t-this.from)*this.pixelsPerMillisecond)}timestampAtProportion(t){return s.default.from+s.default.time*t}timestampAtPosition(t){return this.from+t/this.pixelsPerMillisecond}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],s=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function o(t){return s[t.getUTCMonth()]}function r(t){const e=t.getUTCDate();return`${n[t.getUTCDay()]}, ${e}${function(t){return["st","nd","rd"][((t+90)%100-10)%10-1]||"th"}(e)}`}function a(t){return t.getUTCHours().toString().padStart(2,"0")}function l(t){return t.getUTCMinutes().toString().padStart(2,"0")}function h(t){return t.getUTCSeconds().toString().padStart(2,"0")}function u(t){return t.getUTCMilliseconds().toString().padStart(3,"0")}function d(t){return"YEAR"===t||"YEAR_5"===t||"DECADE"===t||"DECADE_5"===t||"CENTURY"===t||"CENTURY_5"===t||"MILLENIUM"===t}e.formatDate=((t,e)=>{if(null==t)return"∞";const i=new Date(t);let n=i.getUTCFullYear().toString();return d(e)?n:(n=`${o(i)} ${n}`,"MONTH"===e?n:(n=`${r(i)} ${n}`,"DAY"===e?n:(n=`${n} at ${a(i)}:`,"HOUR"===e?`${n}00`:(n=`${n}${l(i)}`,"MINUTE"===e?n:(n=`${n}:${h(i)}`,"SECOND"===e?n:`${n}.${u(i)}`)))))}),e.getGranularity=(t=>t>58?"MILLISECOND":t>12?"MILLISECOND_10":t>2.3?"MILLISECOND_50":t>1.5?"MILLISECOND_100":t>.4?"MILLISECOND_500":t>.00112?"SECOND":t>112e-6?"MINUTE":t>112e-7?"HOUR":t>8e-7?"DAY":t>2.6e-7?"WEEK":t>2.2e-8?"MONTH":t>2.2e-9?"YEAR":t>3.3e-10?"YEAR_5":t>1.6e-10?"DECADE":t>8e-11?"DECADE_5":t>1.5e-11?"CENTURY":t>5e-12?"CENTURY_5":"MILLENIUM"),e.getStep=(t=>{if("YEAR"===t)return 1;if("YEAR_5"===t)return 5;if("DECADE"===t)return 10;if("DECADE_5"===t)return 50;if("CENTURY"===t)return 100;if("CENTURY_5"===t)return 500;if("MILLENIUM"===t)return 1e3;if("MILLISECOND"===t)return 1;if("MILLISECOND_10"===t)return 10;if("MILLISECOND_50"===t)return 50;if("MILLISECOND_100"===t)return 100;if("MILLISECOND_500"===t)return 500;throw new RangeError("[getStep] Only steps with a granularity greater than 'year' calculated")}),e.subsequentDate=function(t){return d(t)?i=>{let n=new Date(i),s=n.getUTCFullYear()+1;if("YEAR"!==t){const i=e.getStep(t);for(;s%i!=0;)s+=1}return s>-1&&s<100?(n.setUTCFullYear(s),n.getTime()):Date.UTC(s,0,1)}:"MONTH"===t?t=>{const e=new Date(t);return Date.UTC(e.getUTCFullYear(),e.getUTCMonth()+1,1)}:"WEEK"===t?t=>{const e=new Date(t);return Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+7)}:"DAY"===t?t=>{const e=new Date(t);return Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+1)}:"HOUR"===t?t=>{const e=new Date(t);return Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours()+1)}:"MINUTE"===t?t=>{const e=new Date(t);return Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes()+1)}:"SECOND"===t?t=>{const e=new Date(t);return Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds()+1)}:"MILLISECOND"===t.slice(0,"MILLISECOND".length)?i=>{const n=e.getStep(t),s=new Date(i);let o=s.getUTCMilliseconds()+1;return n>1&&(o=o+n-o%n),Date.UTC(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate(),s.getUTCHours(),s.getUTCMinutes(),s.getUTCSeconds(),o)}:void 0},e.byDate=function(t,e){const i=null!=t.dmin?t.dmin:t.d,n=null!=e.dmin?e.dmin:e.d;if(i<n)return-1;if(i>n)return 1;const s=null!=t.dmax?t.dmax:t.ed,o=null!=e.dmax?e.dmax:e.ed;return s<o?-1:s>o?1:0};e.labelBody=((t,e)=>{const i=new Date(t);return d(e)?i.getUTCFullYear().toString():"MONTH"===e?o(i):"WEEK"===e?`${o(i)}, week ${(t=>{const e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate())),i=e.getUTCDay()||7;e.setUTCDate(e.getUTCDate()+4-i);const n=new Date(Date.UTC(e.getUTCFullYear(),0,1));return Math.ceil(((e.getTime()-n.getTime())/864e5+1)/7)})(i)}`:"DAY"===e?`${r(i)} ${o(i)}`:"HOUR"===e?`${a(i)}:00`:"MINUTE"===e?`${a(i)}:${l(i)}`:"SECOND"===e?`${a(i)}:${l(i)}:${h(i)}`:"MILLISECOND"===e.slice(0,"MILLISECOND".length)?`${a(i)}:${l(i)}:${h(i)}.${u(i)}`:void 0})},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});class n{constructor(){this.eventsListeners=[]}dispatch(t,e){const i=null!=e?new CustomEvent(t,{detail:e}):new CustomEvent(t);document.dispatchEvent(i)}register(t,e,i=document){i.addEventListener(t,e),this.eventsListeners.push([t,e,i])}flush(){this.eventsListeners.forEach(t=>{const[e,i,n]=t;n.removeEventListener(e,i)}),this.eventsListeners=[]}}e.EventBus=n,e.default=new n},function(t,e,i){"use strict";function n(t){return Math.pow(2,-1*t)}function s(t){if(null==t)return null;return new Date(t).toUTCString()}Object.defineProperty(e,"__esModule",{value:!0}),e.debounce=((t,e)=>{let i;return()=>{clearTimeout(i),i=setTimeout(t,e)}}),e.visibleRatio=n,e.createRange=function(t){return Array.apply(null,{length:t}).map(Number.call,Number)},e.selectRandom=function(t,e){const i=[];for(;i.length<e;){const n=t[Math.floor(Math.random()*t.length)];(-1===i.indexOf(n)||t.length<e)&&i.push(n)}return i},e.calcPixelsPerMillisecond=function(t,e,i){return t/n(e)/i},e.logEvent=function(t,...e){console.log(t.lbl,t,s(t.from),s(t.to),e)}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.DomainConfig=class{};class n{constructor(){this.heightRatio=1,this.rulers=!0,this.rulerLabels=!0,this.topOffsetRatio=0,this.zoomLevel=0}}e.BandConfig=n;e.MinimapBandConfig=class extends n{constructor(){super(...arguments),this.indicatorFor=0,this.targets=[]}};e.EventsBandConfig=class extends n{};e.default=class{}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=i(1);e.TimelineProps=n.Props;const s=i(8);e.TimelineConfig=s.default;const o=i(10),r=i(3),a=i(7);e.calcPixelsPerMillisecond=a.calcPixelsPerMillisecond;const l=i(12);e.OrderedTimeline=l.OrderedTimeline,e.orderEvents=l.orderEvents;const h=i(13),u=i(14),d=i(15),c=i(18),f=i(19),p=i(20);e.MinimapBand=p.default;const m=i(21);e.EventsBand=m.default;const v=i(5);e.formatDate=v.formatDate;const g=i(11);e.Ev3ntLocation=g.Ev3ntLocation,e.RawEv3nt=g.RawEv3nt,e.Ev3nt=g.Ev3nt,e.Voyage=g.Voyage;const E=i(4),w=i(0);e.EventType=w.EventType;e.default=class extends h.default{constructor(t){super(),this.appendToWrapper=(t=>{let e=t.render();Array.isArray(e)||(e=[e]),e.forEach(t=>this.wrapper.appendChild(t))}),n.default.init(t),t.rootElement.appendChild(this.render()),this.popup=new f.default(this.wrapper);const e=a.debounce(this.resize,600);window.addEventListener("resize",e)}hidePopup(){this.popup.hide()}showPopup(t){this.popup.show(t)}render(){this.wrapper=r.default("div","wrapper",["box-sizing: border-box","height: 100%","overflow: hidden","position: relative","user-select: none","width: 100%"]),this.views=n.default.bands.map(t=>t.type===E.BandType.EventsBand?new u.default(t):new o.default(t)),this.views.push(new d.default),this.views.forEach(this.appendToWrapper),this.renderLabels();const t=r.default("div","red-line",["background-color: rgb(126, 0, 0)","bottom: 0","left: calc(50% - 1px)","position: absolute","top: 0","width: 2px","z-index: 4"]);return this.wrapper.appendChild(t),this.wrapper}renderLabels(){n.default.bands.filter(t=>t.type===E.BandType.EventsBand&&null!=t.config.label).map(t=>new c.default(t)).forEach(this.appendToWrapper)}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=i(4),s=i(1),o=i(3),r=i(6),a=i(2),l=i(0);e.default=class{constructor(t){this.band=t,this.onMouseDown=(t=>{document.addEventListener("mouseup",this.onMouseUp),this.dragStartTime=Date.now(),this.dragStartPosition=[t.clientX,t.clientY],this.dragOffsetX=t.clientX,this.dragOffsetY=t.clientY}),this.onMouseMove=(t=>{if(null==this.dragOffsetX)return;const e=t.clientY-this.dragOffsetY,i=t.clientX-this.dragOffsetX;if(this.band.type===n.BandType.EventsBand){const t=this.band;(0!==t.offsetY||Math.abs(e)>Math.abs(i)&&Math.abs(e)>5)&&(t.offsetY=e)}const o=i/this.band.pixelsPerMillisecond;s.default.center-=o,a.default.nextFrame(),this.dragOffsetX=t.clientX,this.dragOffsetY=t.clientY}),this.onMouseUp=(t=>{this.lastDragInterval=Date.now()-this.dragStartTime,this.dispatchScrollDoneEvent(t),this.dragOffsetX=null,this.dragOffsetY=null,document.removeEventListener("mouseup",this.onMouseUp)}),this.onDblClick=(t=>{const e=this.band.timestampAtPosition(t.clientX);a.default.goTo(e)})}render(){return this.rootElement=o.default("div","band-wrap",["position: absolute","z-index: 2"],[`height: ${this.band.visibleHeight}px`,`top: ${this.band.top}px`,`width: ${s.default.viewportWidth}px`]),r.default.register("mousedown",this.onMouseDown,this.rootElement),r.default.register("mousemove",this.onMouseMove,this.rootElement),r.default.register("dblclick",this.onDblClick,this.rootElement),this.rootElement}dispatchScrollDoneEvent(t){const e=[this.dragStartPosition[0]-t.clientX,this.dragStartPosition[1]-t.clientY].map(Math.abs).some(t=>t>5);(this.lastDragInterval>200||e)&&r.default.dispatch(l.EventType.ScrollDone)}resize(){this.rootElement.style.cssText=`height: ${this.band.visibleHeight}px; top: ${this.band.top}px; width: ${s.default.viewportWidth}px;`}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=i(0);!function(t){t.NONE="none",t.JPG="jpg",t.SVG="svg",t.GIF="gif",t.PNG="png"}(e.ImageFileType||(e.ImageFileType={}));e.Ev3ntLocation=class{};e.Voyage=class{};class s{}e.RawEv3nt=s;e.Ev3nt=class extends s{constructor(t,e){super();for(const e in t)null!=t[e]&&(this[e]=t[e]);if(null==this.lbl&&(this.lbl="NO LABEL"),null==this.id&&(this.id="id_"+crypto.getRandomValues(new Uint8Array(4)).join("_")),this.from=this.dmin||this.d,this.to=this.dmax||this.ed,null==this.to&&(this.to=this.from),this.time=this.to-this.from,null!=e){const t=Math.round(2*n.EVENT_HEIGHT/e);let i=this.lbl.length*n.PIXELS_PER_LETTER/e+t;i=i>this.time?i-this.time:0,this.screenTo=Math.round(this.from+this.time+i)}}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=i(0),s=i(11),o=i(7);class r{}e.OrderedTimeline=r,e.orderEvents=function(t){if(null==t.bands||!t.bands.length)return new r;let e,i=t.bands.reduce((t,e)=>{const i=e.events[0];return Math.min(t,i.dmin||1/0,i.d||1/0)},1/0),a=t.bands.reduce((t,e)=>{const i=e.events.reduce((t,e)=>Math.max(t,e.d||-1/0,e.ed||-1/0,e.dmax||-1/0),-1/0);return Math.max(i,t)},-1/0);null!=t.parent&&(e=new s.Ev3nt(t.parent),i=Math.min(i,e.dmin||1/0,e.d||1/0),a=Math.max(a,e.ed||-1/0,e.dmax||-1/0));const l=a-i;return{bands:t.bands.map(function(e){const i=o.calcPixelsPerMillisecond(t.viewportWidth,e.zoomLevel,l),r=[-1/0],a=Math.round(2*n.EVENT_ROW_HEIGHT/i);function h(t,e){return(null==r[t+1]||r[t+1]<e)&&(null==r[t+2]||r[t+2]<e)}return{events:e.events.map(function(t){const e=new s.Ev3nt(t,i);let n;if(e.img){const t=e.time?e.from:e.from-a/2,i=e.time?e.from+a:e.from+a/2;if((n=r.findIndex(e=>t>e))>-1){let e=!1;for(;!e&&!(e=h(n,t));)-1===(n=r.findIndex((e,i)=>i>n&&t>e))&&(e=!0)}-1===n?(n=r.push(e.screenTo)-1,r.push(i),r.push(i)):(r[n]=e.screenTo,r[n+1]=i,r[n+2]=i)}else-1===(n=r.findIndex(t=>e.from>t))?n=r.push(e.screenTo)-1:r[n]=e.screenTo;return e.row=n,e}),zoomLevel:e.zoomLevel,pixelsPerMillisecond:i,rowCount:r.length}}),from:i,parent:e,time:l,to:a}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=i(2),s=i(1),o=i(0);e.default=class{constructor(){this.animator=n.default,this.resize=(()=>{s.default.resize();for(const t of s.default.bands)t.resize();for(const t of this.views)t.resize();this.animator.nextFrame()}),document.addEventListener("keydown",t=>{189===t.keyCode&&s.default.controlBand.zoomOut(),187===t.keyCode&&s.default.controlBand.zoomIn()})}on(t,e){const i={centerchange:o.EventType.CenterChange,pause:o.EventType.Pause,play:o.EventType.Play,scrolldone:o.EventType.ScrollDone,select:o.EventType.Select,zoomdone:o.EventType.ZoomDone};if(Object.keys(i).indexOf(t)>-1){const n=i[t];let r;r=n===o.EventType.CenterChange?()=>e(s.default):n===o.EventType.Select?t=>e(t.detail):e,document.addEventListener(n,r)}}reload(){this.resize()}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=i(10),s=i(6),o=i(0);e.default=class extends n.default{constructor(t){super(t),this.band=t,this.onWheel=(t=>{0===Math.abs(t.deltaX)&&0!==t.deltaY&&(t.deltaY<0&&this.zoomOut(),t.deltaY>0&&this.zoomIn())}),this.onClick=(t=>{if(this.lastDragInterval>175)return;const e=this.band.getEventByCoordinates(t.clientX,t.clientY);s.default.dispatch(o.EventType.Select,e)})}render(){const t=super.render();return s.default.register("click",this.onClick,this.rootElement),s.default.register("wheel",this.onWheel,this.rootElement),t}zoomIn(){this.band.zoomIn()}zoomOut(){this.band.zoomOut()}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=i(16),s=i(3),o=i(1),r=i(0),a=i(2),l=i(17),h=i(6);e.default=class{constructor(){this.indicatorsDrawn=!1,this.onImgLoad=(t=>{const e=i=>{t.image.removeEventListener("load",e),t.image.removeEventListener("error",e),"error"!==i.type?(t.image.width>t.image.height?(t.image.height=Math.round(t.image.height*(r.IMAGE_BOUNDING_BOX/t.image.width)),t.image.width=r.IMAGE_BOUNDING_BOX):(t.image.width=Math.round(t.image.width*(r.IMAGE_BOUNDING_BOX/t.image.height)),t.image.height=r.IMAGE_BOUNDING_BOX),this.drawImage(t)):t.image=null};return e}),this.onAnimationDone=(()=>{}),this.update=(()=>{for(const t of o.default.eventsBands)this.drawEventsBand(t);for(const t of o.default.minimapBands)this.drawMinimapBand(t);this.drawIndicators(),this.updateImages()}),a.default.registerView(this),h.default.register(r.EventType.ZoomDone,this.onAnimationDone),h.default.register(r.EventType.ScrollDone,this.onAnimationDone)}updateImages(){return n.__awaiter(this,void 0,void 0,function*(){for(const t of o.default.eventsBands)for(const e of t.visibleEvents)if(null!=e.img)if(null==e.image){const t=`${o.default.imagePath}/${e.wid}__${r.IMAGE_SIZE}.${e.img}`;e.image=new Image;const i=this.onImgLoad(e);e.image.addEventListener("load",i),e.image.addEventListener("error",i),e.image.src=t}else this.drawImage(e)})}drawImage(t){if(null==t.image||!t.image.complete||!t.image.naturalWidth)return;const e=t.time?t.left:t.left-t.image.width/2-r.IMAGE_BORDER_SIZE,i=t.top-t.image.height;this.ctx.fillStyle=t.color,this.ctx.fillRect(e,i-2*r.IMAGE_BORDER_SIZE,t.image.width+2*r.IMAGE_BORDER_SIZE,t.image.height+2*r.IMAGE_BORDER_SIZE),this.ctx.drawImage(t.image,e+r.IMAGE_BORDER_SIZE,i-r.IMAGE_BORDER_SIZE,t.image.width,t.image.height)}render(){return this.canvas=s.default("canvas","main",["position: absolute"]),this.canvas.width=o.default.viewportWidth,this.canvas.height=o.default.viewportHeight,this.ctx=this.canvas.getContext("2d"),this.indicatorsCanvas=s.default("canvas","indicators",["position: absolute"],["z-index: 1"]),this.indicatorsCanvas.width=o.default.viewportWidth,this.indicatorsCanvas.height=o.default.viewportHeight,this.indicatorsCtx=this.indicatorsCanvas.getContext("2d"),this.update(),[this.canvas,this.indicatorsCanvas]}resize(){this.indicatorsCanvas.width=o.default.viewportWidth,this.indicatorsCanvas.height=o.default.viewportHeight,this.canvas.width=o.default.viewportWidth,this.canvas.height=o.default.viewportHeight,this.indicatorsDrawn=!1}clear(t){this.ctx.clearRect(0,t.top,this.canvas.width,t.visibleHeight)}drawEventsBand(t){this.clear(t),l.default(this.ctx,t);for(const e of t.visibleEvents)if(e.time){let t=e.left,i=e.width;if(e.uncertain_from_width>1){const n=this.ctx.createLinearGradient(e.left,0,e.left+e.uncertain_from_width,0);n.addColorStop(0,"white"),n.addColorStop(1,e.color),this.ctx.fillStyle=n,this.ctx.fillRect(e.left,e.top,e.uncertain_from_width,r.EVENT_HEIGHT),t=e.left+e.uncertain_from_width,i-=e.uncertain_from_width}if(e.uncertain_to_width>1){const n=t+(i-=e.uncertain_to_width),s=n+e.uncertain_to_width,o=this.ctx.createLinearGradient(n,0,s,0);o.addColorStop(0,e.color),o.addColorStop(1,"white"),this.ctx.fillStyle=o,this.ctx.fillRect(n,e.top,e.uncertain_to_width,r.EVENT_HEIGHT)}this.ctx.fillStyle=e.color,this.ctx.fillRect(t,e.top,i,r.EVENT_HEIGHT)}else this.ctx.moveTo(e.left,e.top+r.EVENT_HEIGHT/2),this.ctx.beginPath(),this.ctx.arc(e.left,e.top+r.EVENT_HEIGHT/2,r.EVENT_HEIGHT/3,0,2*Math.PI),this.ctx.fillStyle=e.color,this.ctx.fill();this.drawEventsText(t)}drawEventsText(t){this.ctx.font=`${r.FONT_SIZE}px sans-serif`,this.ctx.fillStyle="rgb(40, 40, 40)";for(const e of t.visibleEvents){let t=e.left;e.left<0&&0!==e.time&&(t=-e.uncertain_from_width);const i=t+(e.time?r.FONT_SIZE/3:r.FONT_SIZE/1.2)+e.uncertain_from_width,n=e.top+r.FONT_SIZE+(r.EVENT_HEIGHT-r.FONT_SIZE)/2-2;this.ctx.fillText(e.lbl,Math.round(i),Math.round(n))}}drawMinimapBand(t){if(t.isDrawn&&t.prevOffsetX===t.offsetX&&t.prevZoomLevel===t.zoomLevel)return;this.clear(t),l.default(this.ctx,t);const e=t.draw();this.ctx.drawImage(e,0,t.top,o.default.viewportWidth,t.availableHeight),t.isDrawn=!0}drawIndicators(){if(!this.indicatorsDrawn||!o.default.eventsBands.every(t=>t.prevZoomLevel===t.zoomLevel)){this.indicatorsCtx.clearRect(0,0,o.default.viewportWidth,o.default.viewportHeight),this.indicatorsCtx.beginPath();for(const t of o.default.minimapBands){const e=o.default.eventsBands[t.config.indicatorFor],i=Math.round(t.config.topOffsetRatio*o.default.viewportHeight),n=t.positionAtTimestamp(e.from);this.indicatorsCtx.rect(0,i,n,t.visibleHeight);const s=t.positionAtTimestamp(e.to);this.indicatorsCtx.rect(s,i,o.default.viewportWidth,t.visibleHeight),this.indicatorsCtx.rect(n,i+t.availableHeight,s-n,t.visibleHeight-t.availableHeight)}this.indicatorsCtx.fillStyle="rgba(0, 0, 0, .04)",this.indicatorsCtx.fill(),this.indicatorsCtx.closePath(),this.indicatorsDrawn=!0}}}},function(t,e,i){"use strict";i.r(e),i.d(e,"__extends",function(){return s}),i.d(e,"__assign",function(){return o}),i.d(e,"__rest",function(){return r}),i.d(e,"__decorate",function(){return a}),i.d(e,"__param",function(){return l}),i.d(e,"__metadata",function(){return h}),i.d(e,"__awaiter",function(){return u}),i.d(e,"__generator",function(){return d}),i.d(e,"__exportStar",function(){return c}),i.d(e,"__values",function(){return f}),i.d(e,"__read",function(){return p}),i.d(e,"__spread",function(){return m}),i.d(e,"__await",function(){return v}),i.d(e,"__asyncGenerator",function(){return g}),i.d(e,"__asyncDelegator",function(){return E}),i.d(e,"__asyncValues",function(){return w}),i.d(e,"__makeTemplateObject",function(){return _}),i.d(e,"__importStar",function(){return T}),i.d(e,"__importDefault",function(){return b});
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
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
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
var n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)};function s(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var o=function(){return(o=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var s in e=arguments[i])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t}).apply(this,arguments)};function r(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&(i[n[s]]=t[n[s]])}return i}function a(t,e,i,n){var s,o=arguments.length,r=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(r=(o<3?s(r):o>3?s(e,i,r):s(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r}function l(t,e){return function(i,n){e(i,n,t)}}function h(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function u(t,e,i,n){return new(i||(i=Promise))(function(s,o){function r(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){t.done?s(t.value):new i(function(e){e(t.value)}).then(r,a)}l((n=n.apply(t,e||[])).next())})}function d(t,e){var i,n,s,o,r={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;r;)try{if(i=1,n&&(s=2&o[0]?n.return:o[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,o[1])).done)return s;switch(n=0,s&&(o=[2&o[0],s.value]),o[0]){case 0:case 1:s=o;break;case 4:return r.label++,{value:o[1],done:!1};case 5:r.label++,n=o[1],o=[0];continue;case 7:o=r.ops.pop(),r.trys.pop();continue;default:if(!(s=(s=r.trys).length>0&&s[s.length-1])&&(6===o[0]||2===o[0])){r=0;continue}if(3===o[0]&&(!s||o[1]>s[0]&&o[1]<s[3])){r.label=o[1];break}if(6===o[0]&&r.label<s[1]){r.label=s[1],s=o;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(o);break}s[2]&&r.ops.pop(),r.trys.pop();continue}o=e.call(t,r)}catch(t){o=[6,t],n=0}finally{i=s=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function c(t,e){for(var i in t)e.hasOwnProperty(i)||(e[i]=t[i])}function f(t){var e="function"==typeof Symbol&&t[Symbol.iterator],i=0;return e?e.call(t):{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}}}function p(t,e){var i="function"==typeof Symbol&&t[Symbol.iterator];if(!i)return t;var n,s,o=i.call(t),r=[];try{for(;(void 0===e||e-- >0)&&!(n=o.next()).done;)r.push(n.value)}catch(t){s={error:t}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(s)throw s.error}}return r}function m(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(p(arguments[e]));return t}function v(t){return this instanceof v?(this.v=t,this):new v(t)}function g(t,e,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,s=i.apply(t,e||[]),o=[];return n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n;function r(t){s[t]&&(n[t]=function(e){return new Promise(function(i,n){o.push([t,e,i,n])>1||a(t,e)})})}function a(t,e){try{!function(t){t.value instanceof v?Promise.resolve(t.value.v).then(l,h):u(o[0][2],t)}(s[t](e))}catch(t){u(o[0][3],t)}}function l(t){a("next",t)}function h(t){a("throw",t)}function u(t,e){t(e),o.shift(),o.length&&a(o[0][0],o[0][1])}}function E(t){var e,i;return e={},n("next"),n("throw",function(t){throw t}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(n,s){e[n]=t[n]?function(e){return(i=!i)?{value:v(t[n](e)),done:"return"===n}:s?s(e):e}:s}}function w(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,i=t[Symbol.asyncIterator];return i?i.call(t):(t=f(t),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(i){e[i]=t[i]&&function(e){return new Promise(function(n,s){(function(t,e,i,n){Promise.resolve(n).then(function(e){t({value:e,done:i})},e)})(n,s,(e=t[i](e)).done,e.value)})}}}function _(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function T(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)Object.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e.default=t,e}function b(t){return t&&t.__esModule?t:{default:t}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=i(1),s=i(0),o=i(5);function r(t,e){return"CENTURY"===e.granularity&&new Date(t).getUTCFullYear()%1e3==0||("YEAR_5"===e.granularity&&new Date(t).getUTCFullYear()%50==0||"YEAR"===e.granularity&&new Date(t).getUTCFullYear()%5==0)}function a(t,e,i,n,s){const r=e.positionAtTimestamp(i);t.moveTo(r,n),t.lineTo(r,s),e.config.rulerLabels&&t.fillText(o.labelBody(i,e.granularity),r+3,s-3)}e.default=function(t,e){if(!e.config.rulers)return;let i=e.nextDate(e.from);const o=e.config.topOffsetRatio*n.default.viewportHeight,l=e.config.heightRatio*n.default.viewportHeight,h=[],u=[];for(;i<e.to;)r(i,e)?u.push(i):h.push(i),i=e.nextDate(i);t.beginPath(),t.font=`${s.FONT_SIZE}px sans-serif`,t.fillStyle="rgb(205, 205, 205)";for(const i of h)a(t,e,i,o,o+l);t.strokeStyle="rgb(235, 235, 235)",t.stroke(),t.beginPath(),t.font=`${1.2*s.FONT_SIZE}px sans-serif`,t.fillStyle="rgb(120, 120, 120)";for(const i of u)a(t,e,i,o,o+l);t.strokeStyle="rgb(150, 150, 150)",t.stroke()}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=i(3);e.default=class{constructor(t){this.band=t}render(){const t=n.default("div","events-label-wrapper",["border-top: 1px solid #CCC","pointer-events: none","position: absolute","width: 100%","z-index: 3"],[`top: ${100*this.band.config.topOffsetRatio}%`]),e=n.default("div","events-label",["background: white","border-bottom-right-radius: 4px","box-shadow: 1px 2px 4px #AAA","color: #444","display: inline-block","font-family: sans-serif","font-size: .8em","padding: 4px 8px"]);return e.innerText=this.band.config.label,t.appendChild(e),t}resize(){}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=i(3),s=i(1),o=i(0),r=i(5),a=i(2),l=14;e.default=class{constructor(t){this.rootElement=t,this.update=(()=>{this.event&&this.setPosition()}),this.loadImage=(()=>{this.el.querySelector("img").removeEventListener("load",this.loadImage),this.setWidth(),this.setPosition()}),this.el=n.default("div"),this.el.id="popup",this.el.style.position="absolute",this.el.style.zIndex="10",this.hide(),this.rootElement.appendChild(this.el),this.el.addEventListener("click",t=>{t.target.matches("#popup-close")&&this.hide()}),a.default.registerView(this)}hide(){this.event=null,this.el.style.width="auto",this.el.style.visibility="hidden",this.el.classList.remove("bottom")}setWidth(){const t=this.el.getBoundingClientRect();this.el.style.width=`${t.width}px`}setPosition(){const t=this.el.getBoundingClientRect();if(this.event.left+this.event.width<l||this.event.left>s.default.viewportWidth-l)return void(this.el.style.visibility="hidden");let e=this.event.left+this.event.width/2-t.width/2;e<l&&(e=l),e+t.width>s.default.viewportWidth-l&&(e=s.default.viewportWidth-t.width-l),this.el.style.left=`${e}px`;let i=this.event.top+o.EVENT_HEIGHT+l;i+t.height>s.default.viewportHeight-l&&(i=this.event.top-t.height-l,this.el.classList.add("bottom")),this.el.style.top=`${i}px`,this.el.style.visibility="visible"}show(t){this.hide(),this.event=t,this.el.innerHTML=function(t){return`\n\t\t<img alt="noimage" src="" />\n\t\t<div class="metadata">\n\t\t\t<h2 class="label">${t.lbl}</h2>\n\t\t\t<div class="description">${t.dsc||""}</div>\n\t\t\t<br />\n\t\t\t<br />\n\t\t\t<div class="from">${r.formatDate(t.from,t.dmin_g||t.d_g)}</div>\n\t\t\t${t.time?`<div class="to">${r.formatDate(t.to,t.dmax_g||t.ed_g)}</div>`:""}\n\t\t</div>\n\t\t<div id="popup-close">✖</div>\n\t`}(t),this.el.querySelector(".label").style.color=t.color;const e=this.el.querySelector("img");t.img?(e.setAttribute("alt",`Image of ${t.lbl}`),e.addEventListener("load",this.loadImage),e.src=t.image.src.replace("32","128")):(e.src=null,e.setAttribute("alt","noimage"),this.setWidth(),this.setPosition())}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=i(4),s=i(8),o=i(1),r=i(3);e.default=class extends n.default{constructor(t){super(function(t){const e=Object.assign({},new s.MinimapBandConfig,t);return e.targets.length||e.targets.push(0),e}(t)),this.type=n.BandType.MinimapBand,this.canvas=r.default("canvas"),this.ctx=this.canvas.getContext("2d"),this.nextCanvas=r.default("canvas"),this.nextCtx=this.nextCanvas.getContext("2d"),this.isDrawn=!1}init(){super.init(),this.maxRowCount=this.config.targets.reduce((t,e)=>{const{rowCount:i}=o.default.eventsBands[e];return Math.max(t,i)},0);const t=this.availableHeight/this.maxRowCount;this.eventHeight=t<1?1:Math.floor(t),this.canvas.width=o.default.viewportWidth,this.canvas.height=this.maxRowCount*this.eventHeight,this.nextCanvas.width=this.canvas.width,this.nextCanvas.height=this.canvas.height}resize(){super.resize(),this.isDrawn=!1}draw(){return this.isDrawn?this.updateNextCanvas():this.drawEvents(),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.ctx.drawImage(this.nextCanvas,0,0),this.canvas}drawEvents(t=this.from,e=this.to){this.nextCtx.beginPath(),this.config.targets.forEach(i=>{const n=o.default.eventsBands[i];for(const i of n.events){if(i.from>e||i.to<t)continue;const n=this.positionAtTimestamp(i.from),s=this.maxRowCount-(i.row+2)*this.eventHeight,o=Math.round(i.time*this.pixelsPerMillisecond),r=o<1?1:o;this.nextCtx.fillStyle="rgb(190, 190, 190)",this.nextCtx.fillRect(n,s,r,this.eventHeight),i.img&&(this.nextCtx.fillStyle="rgb(240, 240, 240)",this.nextCtx.fillRect(n,s-2*this.eventHeight,2*this.eventHeight,2*this.eventHeight))}})}updateNextCanvas(){const t=Math.round(this.offsetX-this.prevOffsetX);if(0===t)return this.canvas;let e,i;this.nextCtx.clearRect(0,0,this.nextCanvas.width,this.nextCanvas.height),this.nextCtx.drawImage(this.canvas,t,0),t<0?(e=this.timestampAtPosition(o.default.viewportWidth+t),i=this.to):(e=this.from,i=this.timestampAtPosition(t)),this.drawEvents(e,i)}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=i(4),s=i(8),o=i(2),r=i(0),a=i(1),l=i(5);e.default=class extends n.default{constructor(t){super(Object.assign({},new s.EventsBandConfig,t)),this.type=n.BandType.EventsBand,this.events=[],this.rowCount=0,this.visibleEvents=[],this._offsetY=0,null!=this.config.events&&this.config.events.sort(l.byDate)}get offsetY(){return this._offsetY}set offsetY(t){this._offsetY+=t,this._offsetY<0&&(this._offsetY=0);const e=this.height>this.availableHeight?this.height-this.availableHeight+r.EVENT_ROW_HEIGHT:0;this._offsetY>e&&(this._offsetY=e);const i=this._offsetY/r.EVENT_ROW_HEIGHT;this.lowestVisibleRow=Math.ceil(i),this.highestVisibleRow=this.lowestVisibleRow+this.visibleRowsCount}init(t){super.init(),this.events=t.events,this.rowCount=t.rowCount,this.height=r.EVENT_ROW_HEIGHT*this.rowCount,this.offsetY=0,this.updateEvents()}getColor(t,e){const i=[49,220,215];let n;if(a.default.center>e)n=a.default.center-e;else{if(!(a.default.center<t))return`rgb(${i.join(", ")})`;n=t-a.default.center}const s=n/(this.time/2),o=a.default.center>e?[253,231,37]:[204,104,232];return`rgb(${i.map((t,e)=>t+(o[e]-t)*s).join(", ")})`}updateEvents(){this.visibleEvents=this.events.filter(t=>!(t.from>this.to||t.to<this.from)&&t.row>=this.lowestVisibleRow&&t.row<=this.highestVisibleRow).map(t=>{if(t.left=this.positionAtTimestamp(t.from),t.width=Math.round(t.time*this.pixelsPerMillisecond),t.time&&t.width<1&&(t.width=1),t.uncertain_from_width=0,null!=t.dmin){let e;if(null!=t.d)e=t.d;else if(null!=t.ed)e=t.ed;else{if(null==t.dmax)throw Error(["updateEvents","Width uncertain from is not definable",JSON.stringify(t)].join("\n"));e=t.dmin+(t.dmax-t.dmin)/2}t.uncertain_from_width=(e-t.dmin)*this.pixelsPerMillisecond}if(t.uncertain_to_width=0,null!=t.dmax){let e;if(null!=t.ed)e=t.ed;else if(null!=t.d)e=t.d;else{if(null==t.dmin)throw Error(["updateEvents","Width uncertain to is not definable",JSON.stringify(t)].join("\n"));e=t.dmin+(t.dmax-t.dmin)/2}t.uncertain_to_width=(t.dmax-e)*this.pixelsPerMillisecond}return t.top=this.top+this.availableHeight-(t.row+1)*r.EVENT_ROW_HEIGHT+this.offsetY,t.color=this.getColor(t.from,t.to),t})}update(){super.update(),this.updateEvents()}getEventByCoordinates(t,e){const i=this.timestampAtPosition(t),n=a.default.viewportOffset+this.top+this.availableHeight+this.offsetY,s=Math.floor((n-e)/r.EVENT_ROW_HEIGHT);return this.events.find(t=>!(!(t.from<i&&t.screenTo>i)||t.row<this.lowestVisibleRow||t.row>this.highestVisibleRow)&&t.row===s)}zoomIn(){o.default.zoomTo(this,this.zoomLevel+1)}zoomOut(){o.default.zoomTo(this,this.zoomLevel-1)}}}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Timeline=e():t.Timeline=e()}(this,function(){return function(t){var e={};function i(s){if(e[s])return e[s].exports;var n=e[s]={i:s,l:!1,exports:{}};return t[s].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=t,i.c=e,i.d=function(t,e,s){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:s})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var s=Object.create(null);if(i.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(s,n,function(e){return t[e]}.bind(null,n));return s},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="/dist/",i(i.s=9)}([function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.IMAGE_SIZES=[16,32,64,128,256],e.EVENT_HEIGHT=16,e.LETTER_WIDTH=Math.round(.1875*e.EVENT_HEIGHT+3.5),e.FONT_SIZE=Math.round(.3125*e.EVENT_HEIGHT+6),e.ROW_SPACING=Math.round(e.EVENT_HEIGHT/3),e.EVENT_ROW_HEIGHT=e.EVENT_HEIGHT+e.ROW_SPACING,e.DATE_BAR_HEIGHT=e.EVENT_ROW_HEIGHT,e.IMAGE_BOUNDING_BOX=2*e.EVENT_ROW_HEIGHT-2*e.ROW_SPACING,e.IMAGE_BORDER_SIZE=Math.round(e.ROW_SPACING/2),e.IMAGE_SIZE=e.IMAGE_SIZES.reduce((t,i)=>Math.abs(i-e.IMAGE_BOUNDING_BOX)<Math.abs(t-e.IMAGE_BOUNDING_BOX)?i:t),function(t){t.CenterChange="CenterChange",t.ZoomDone="ZoomDone",t.ScrollDone="ScrollDone",t.Pause="Pause",t.Play="Play",t.Select="Select"}(e.EventType||(e.EventType={})),e.PIXELS_PER_LETTER=8,e.DEFAULT_IMAGE_PATH="/images";e.RawSegment=class{},e.colors=["rgba(211,84,0","rgba(219,10,91","rgba(31,58,147","rgba(0,128,0"].map(t=>(e=1)=>`${t},${e})`)},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const s=i(0),n=i(5),o=i(9),r=i(3);function a(t){return t.type===n.BandType.EventsBand}function l(t){return t.type===n.BandType.MinimapBand}class h{constructor(){this.defaultCenterRatio=.5}get center(){return this._center}set center(t){this._center===this.from&&t<this.from||this._center===this.to&&t>this.to||(t<this.from?this._center=this.from:t>this.to?this._center=this.to:this._center=t,r.default.dispatch(s.EventType.CenterChange))}set dimensions(t){const e=getComputedStyle(t);this.viewportHeight=parseInt(e.getPropertyValue("height"),10),this.viewportOffset=t.getBoundingClientRect().top,this.viewportWidth=parseInt(e.getPropertyValue("width"),10)}init(t){null==t.rootElement&&console.error("[init] No rootElement found"),this.imagePath=null!=t.imagePath?t.imagePath:s.DEFAULT_IMAGE_PATH,this.rootElement=t.rootElement,this.dimensions=this.rootElement,this.bands=t.bands,this.eventsBands=this.bands.filter(a),this.minimapBands=this.bands.filter(l),this.controlBand=null!=t.controlBand?t.controlBand:this.eventsBands[0];const e=performance.now(),i={bands:this.eventsBands.map(t=>({events:t.config.events,zoomLevel:t.config.zoomLevel})),parent:t.parent,viewportWidth:this.viewportWidth},n=o.orderEvents(i);this.parent=n.parent,this.from=n.from,this.to=n.to,this.time=n.time;const r=performance.now();console.log("Performance: ",`${r-e}ms\n[from] ${new Date(this.from).toUTCString()}\n[ to ] ${new Date(this.to).toUTCString()}`),this.center=null!=t.center?t.center:this.from+this.defaultCenterRatio*this.time;for(const[t,e]of this.eventsBands.entries())e.init(n.bands[t]);for(const t of this.minimapBands)t.init()}resize(){this.dimensions=this.rootElement}}e.Props=h,e.default=new h},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const s=i(1),n=i(0),o=i(3);var r;!function(t){t[t.Backward=-1]="Backward",t[t.Stop=0]="Stop",t[t.Forward=1]="Forward"}(r||(r={}));class a{constructor(){this.elapsedTimeThreshold=2e3,this.goToDuration=300,this.zoomToDuration=300,this.multipliers=[.25,.5,1,2,4,8,16],this.multiplier=1,this.direction=r.Stop,this.elapsedTimeTotal=0,this.models=[],this.views=[],this.animate=(t=>{const e=null==this.prevTimestamp?0:t-this.prevTimestamp;if(e>0||null==this.prevTimestamp){if(null==this.centerMarker&&null==this.zoomMarker)s.default.center+=s.default.controlBand.time/480*this.multiplier*this.direction;else if(null!=this.centerMarker){const t=this.goToDuration-this.elapsedTimeTotal,i=Math.abs(this.centerMarker-s.default.center)/(t/e);t<e?(s.default.center=this.centerMarker,this.stop()):s.default.center=s.default.center+i*this.direction}else if(null!=this.zoomMarker){const t=this.zoomToDuration-this.elapsedTimeTotal,i=(this.zoomMarker-this.activeBand.zoomLevel)/(t/e);if(t<e)this.activeBand.zoomLevel=this.zoomMarker,s.default.eventsBands.forEach(t=>{t===this.activeBand?this.activeBand.zoomLevel=this.zoomMarker:t.zoomLevel=this.zoomMarker+(t.config.zoomLevel-this.activeBand.config.zoomLevel)}),this.adjustMinimapBands(),o.default.dispatch(n.EventType.ZoomDone),this.stop();else{for(const t of s.default.eventsBands)t.zoomLevel=t.zoomLevel+i;this.adjustMinimapBands()}}this.models.forEach(t=>t.update()),this.views.forEach(t=>t.update())}this.elapsedTimeTotal+=e,this.elapsedTimeTotal>this.elapsedTimeThreshold&&this.resetElapsedTimeTotal(),(this.isPlaying()||null!=this.zoomMarker)&&(s.default.center>=s.default.from&&s.default.center<=s.default.to||null!=this.centerMarker||null!=this.zoomMarker?(this.prevTimestamp=t,requestAnimationFrame(this.animate)):this.stop())})}registerModel(t){this.models.push(t)}registerView(t){this.views.push(t)}adjustMinimapBands(){s.default.minimapBands.forEach(t=>{this.activeBand.zoomLevel<t.config.zoomLevel&&(t.zoomLevel=this.activeBand.zoomLevel)})}resetElapsedTimeTotal(){this.elapsedTimeTotal=0,o.default.dispatch(n.EventType.CenterChange)}accelerate(){const t=this.multipliers.indexOf(this.multiplier);return t===this.multipliers.length-1?this.multipliers[this.multipliers.length-1]:(this.multiplier=this.multipliers[t+1],this.multiplier)}decelerate(){const t=this.multipliers.indexOf(this.multiplier);return 0===t?this.multipliers[0]:(this.multiplier=this.multipliers[t-1],this.multiplier)}goTo(t){this.centerMarker=t,t>s.default.center?this.playForward():this.playBackward()}zoomTo(t,e){null==this.zoomMarker&&(e<0&&(e=0),t!==this.activeBand&&(this.stop(),this.activeBand=t),this.activeBand.zoomLevel!==e&&(this.zoomMarker=e,this.nextFrame()))}speed(t){const e=parseFloat(t);-1!==this.multipliers.indexOf(e)&&(this.multiplier=e)}isPlaying(){return this.direction!==r.Stop}isPlayingForward(){return this.direction===r.Forward}isPlayingBackward(){return this.direction===r.Backward}nextFrame(){requestAnimationFrame(this.animate)}playForward(){o.default.dispatch(n.EventType.Play),this.direction=r.Forward,this.nextFrame()}playBackward(){o.default.dispatch(n.EventType.Play),this.direction=r.Backward,this.nextFrame()}stop(){o.default.dispatch(n.EventType.Pause),this.direction=r.Stop,this.activeBand=null,this.centerMarker=null,this.zoomMarker=null,this.prevTimestamp=null,this.elapsedTimeTotal=0}toggle(){this.isPlaying()?this.stop():this.nextFrame()}}e.Animator=a,e.default=new a},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});class s{constructor(){this.eventsListeners=[]}dispatch(t,e){const i=null!=e?new CustomEvent(t,{detail:e}):new CustomEvent(t);document.dispatchEvent(i)}register(t,e,i=document){i.addEventListener(t,e),this.eventsListeners.push([t,e,i])}flush(){this.eventsListeners.forEach(t=>{const[e,i,s]=t;s.removeEventListener(e,i)}),this.eventsListeners=[]}}e.EventBus=s,e.default=new s},function(t,e,i){"use strict";let s;if(Object.defineProperty(e,"__esModule",{value:!0}),e.createSvg=((t,e,i={})=>{const s=document.createElementNS("http://www.w3.org/2000/svg",t);return null!=e&&s.setAttribute("style",e.join(";").concat(";")),Object.keys(i).forEach(t=>s.setAttribute(t,i[t])),s}),"undefined"!=typeof window){const t=document.createElement("style");document.head.appendChild(t),s=t.sheet}const n={};e.default=function(t,e,i,o){if(!e)return document.createElement(t);let r;return n.hasOwnProperty(e)?r=n[e].cloneNode(!1):((r=document.createElement(t)).classList.add(e),i&&s.insertRule(`.${e} { ${i.join(";").concat(";")} }`),n[e]=r.cloneNode(!1)),o&&r.setAttribute("style",o.join(";").concat(";")),r}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const s=i(6),n=i(1),o=i(0),r=i(7),a=i(2);!function(t){t[t.EventsBand=0]="EventsBand",t[t.MinimapBand=1]="MinimapBand"}(e.BandType||(e.BandType={}));e.default=class{constructor(t){this.config=t,this.defaultZoomLevel=0}get offsetX(){return this._offsetX}set offsetX(t){this.prevOffsetX=this.offsetX||t,this._offsetX=t}get zoomLevel(){return this._zoomLevel}set zoomLevel(t){t<0&&(t=0),this.visibleRatio=r.visibleRatio(t),this.width=Math.round(n.default.viewportWidth/this.visibleRatio),this.pixelsPerMillisecond=this.width/n.default.time,this.time=this.visibleRatio*n.default.time,this.granularity=s.getGranularity(this.pixelsPerMillisecond),this.nextDate=s.subsequentDate(this.granularity),this.prevZoomLevel=this.zoomLevel||t,this._zoomLevel=t,this.setHorizontalProps()}setVerticalProps(){this.visibleHeight=Math.round(this.config.heightRatio*n.default.viewportHeight),this.availableHeight=this.visibleHeight-o.DATE_BAR_HEIGHT,this.availableHeight/this.visibleHeight<.666&&(this.availableHeight=.666*this.visibleHeight),this.visibleRowsCount=Math.floor(this.availableHeight/o.EVENT_ROW_HEIGHT)-1,this.top=Math.round(this.config.topOffsetRatio*n.default.viewportHeight)}setHorizontalProps(){this.from=n.default.center-this.time/2,this.to=n.default.center+this.time/2,this.offsetX=(n.default.from-this.from)*this.pixelsPerMillisecond}init(t){this.zoomLevel=this.config.zoomLevel,this.setVerticalProps(),a.default.registerModel(this)}resize(){this.zoomLevel=this.zoomLevel,this.setVerticalProps()}update(){this.setHorizontalProps()}updateConfig(t){Object.keys(t).forEach(e=>{this.config.hasOwnProperty(e)&&(this.config[e]=t[e])})}positionAtTimestamp(t){return Math.round((t-this.from)*this.pixelsPerMillisecond)}timestampAtProportion(t){return n.default.from+n.default.time*t}timestampAtPosition(t){return this.from+t/this.pixelsPerMillisecond}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const s=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],n=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function o(t){return n[t.getUTCMonth()]}function r(t){const e=t.getUTCDate();return`${s[t.getUTCDay()]}, ${e}${function(t){return["st","nd","rd"][((t+90)%100-10)%10-1]||"th"}(e)}`}function a(t){return t.getUTCHours().toString().padStart(2,"0")}function l(t){return t.getUTCMinutes().toString().padStart(2,"0")}function h(t){return t.getUTCSeconds().toString().padStart(2,"0")}function d(t){return t.getUTCMilliseconds().toString().padStart(3,"0")}function u(t){return"YEAR"===t||"YEAR_5"===t||"DECADE"===t||"DECADE_5"===t||"CENTURY"===t||"CENTURY_5"===t||"MILLENIUM"===t}e.formatDate=((t,e)=>{if(null==t)return"∞";const i=new Date(t);let s=i.getUTCFullYear().toString();return u(e)?s:(s=`${o(i)} ${s}`,"MONTH"===e?s:(s=`${r(i)} ${s}`,"DAY"===e?s:(s=`${s} at ${a(i)}:`,"HOUR"===e?`${s}00`:(s=`${s}${l(i)}`,"MINUTE"===e?s:(s=`${s}:${h(i)}`,"SECOND"===e?s:`${s}.${d(i)}`)))))}),e.getGranularity=(t=>t>58?"MILLISECOND":t>12?"MILLISECOND_10":t>2.3?"MILLISECOND_50":t>1.5?"MILLISECOND_100":t>.4?"MILLISECOND_500":t>.00112?"SECOND":t>112e-6?"MINUTE":t>112e-7?"HOUR":t>8e-7?"DAY":t>2.6e-7?"WEEK":t>2.2e-8?"MONTH":t>2.2e-9?"YEAR":t>3.3e-10?"YEAR_5":t>1.6e-10?"DECADE":t>8e-11?"DECADE_5":t>1.5e-11?"CENTURY":t>5e-12?"CENTURY_5":"MILLENIUM"),e.getStep=(t=>{if("YEAR"===t)return 1;if("YEAR_5"===t)return 5;if("DECADE"===t)return 10;if("DECADE_5"===t)return 50;if("CENTURY"===t)return 100;if("CENTURY_5"===t)return 500;if("MILLENIUM"===t)return 1e3;if("MILLISECOND"===t)return 1;if("MILLISECOND_10"===t)return 10;if("MILLISECOND_50"===t)return 50;if("MILLISECOND_100"===t)return 100;if("MILLISECOND_500"===t)return 500;throw new RangeError("[getStep] Only steps with a granularity greater than 'year' calculated")}),e.subsequentDate=function(t){return u(t)?i=>{let s=new Date(i),n=s.getUTCFullYear()+1;if("YEAR"!==t){const i=e.getStep(t);for(;n%i!=0;)n+=1}return n>-1&&n<100?(s.setUTCFullYear(n),s.getTime()):Date.UTC(n,0,1)}:"MONTH"===t?t=>{const e=new Date(t);return Date.UTC(e.getUTCFullYear(),e.getUTCMonth()+1,1)}:"WEEK"===t?t=>{const e=new Date(t);return Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+7)}:"DAY"===t?t=>{const e=new Date(t);return Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+1)}:"HOUR"===t?t=>{const e=new Date(t);return Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours()+1)}:"MINUTE"===t?t=>{const e=new Date(t);return Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes()+1)}:"SECOND"===t?t=>{const e=new Date(t);return Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds()+1)}:"MILLISECOND"===t.slice(0,"MILLISECOND".length)?i=>{const s=e.getStep(t),n=new Date(i);let o=n.getUTCMilliseconds()+1;return s>1&&(o=o+s-o%s),Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate(),n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds(),o)}:void 0},e.byDate=function(t,e){const i=null!=t.dmin?t.dmin:t.d,s=null!=e.dmin?e.dmin:e.d;if(i<s)return-1;if(i>s)return 1;const n=null!=t.dmax?t.dmax:t.ed,o=null!=e.dmax?e.dmax:e.ed;return n<o?-1:n>o?1:0};e.labelBody=((t,e)=>{const i=new Date(t);return u(e)?i.getUTCFullYear().toString():"MONTH"===e?o(i):"WEEK"===e?`${o(i)}, week ${(t=>{const e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate())),i=e.getUTCDay()||7;e.setUTCDate(e.getUTCDate()+4-i);const s=new Date(Date.UTC(e.getUTCFullYear(),0,1));return Math.ceil(((e.getTime()-s.getTime())/864e5+1)/7)})(i)}`:"DAY"===e?`${r(i)} ${o(i)}`:"HOUR"===e?`${a(i)}:00`:"MINUTE"===e?`${a(i)}:${l(i)}`:"SECOND"===e?`${a(i)}:${l(i)}:${h(i)}`:"MILLISECOND"===e.slice(0,"MILLISECOND".length)?`${a(i)}:${l(i)}:${h(i)}.${d(i)}`:void 0})},function(t,e,i){"use strict";function s(t){return Math.pow(2,-1*t)}function n(t){if(null==t)return null;return new Date(t).toUTCString()}Object.defineProperty(e,"__esModule",{value:!0}),e.debounce=((t,e)=>{let i;return()=>{clearTimeout(i),i=setTimeout(t,e)}}),e.visibleRatio=s,e.createRange=function(t){return Array.apply(null,{length:t}).map(Number.call,Number)},e.selectRandom=function(t,e){const i=[];for(;i.length<e;){const s=t[Math.floor(Math.random()*t.length)];(-1===i.indexOf(s)||t.length<e)&&i.push(s)}return i},e.calcPixelsPerMillisecond=function(t,e,i){return t/s(e)/i},e.logEvent=function(t,...e){console.log(t.lbl,t,n(t.from),n(t.to),e)}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.DomainConfig=class{};class s{constructor(){this.heightRatio=1,this.rulers=!0,this.rulerLabels=!0,this.topOffsetRatio=0,this.zoomLevel=0}}e.BandConfig=s;e.MinimapBandConfig=class extends s{constructor(){super(...arguments),this.indicatorFor=0,this.targets=[]}};e.EventsBandConfig=class extends s{};e.default=class{}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const s=i(1);e.TimelineProps=s.Props;const n=i(8);e.TimelineConfig=n.default;const o=i(10),r=i(4),a=i(7);e.calcPixelsPerMillisecond=a.calcPixelsPerMillisecond;const l=i(12);e.OrderedTimeline=l.OrderedTimeline,e.orderEvents=l.orderEvents;const h=i(13),d=i(14),u=i(15),c=i(17),f=i(18),p=i(19);e.MinimapBand=p.default;const m=i(20);e.EventsBand=m.default;const g=i(6);e.formatDate=g.formatDate;const v=i(11);e.Ev3ntLocation=v.Ev3ntLocation,e.RawEv3nt=v.RawEv3nt,e.Ev3nt=v.Ev3nt,e.Voyage=v.Voyage;const E=i(5),T=i(0);e.EventType=T.EventType;e.default=class extends h.default{constructor(t){super(),this.appendToWrapper=(t=>{let e=t.render();Array.isArray(e)||(e=[e]),e.forEach(t=>this.wrapper.appendChild(t))}),s.default.init(t),t.rootElement.appendChild(this.render()),this.popup=new f.default(this.wrapper);const e=a.debounce(this.resize,600);window.addEventListener("resize",e)}hidePopup(){this.popup.hide()}showPopup(t){this.popup.show(t)}render(){this.wrapper=r.default("div","wrapper",["box-sizing: border-box","height: 100%","overflow: hidden","position: relative","user-select: none","width: 100%"]),this.views=s.default.bands.map(t=>t.type===E.BandType.EventsBand?new d.default(t):new o.default(t)),this.views.push(new u.default),this.views.forEach(this.appendToWrapper),this.renderLabels();const t=r.default("div","red-line",["background-color: rgb(126, 0, 0)","bottom: 0","left: calc(50% - 1px)","position: absolute","top: 0","width: 2px","z-index: 4"]);return this.wrapper.appendChild(t),this.wrapper}center(){return s.default.center}visibleEvents(){return s.default.eventsBands.map(t=>t.visibleEvents).reduce((t,e)=>t.concat(e))}renderLabels(){s.default.bands.filter(t=>t.type===E.BandType.EventsBand&&null!=t.config.label).map(t=>new c.default(t)).forEach(this.appendToWrapper)}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const s=i(5),n=i(1),o=i(4),r=i(3),a=i(2),l=i(0);e.default=class{constructor(t){this.band=t,this.onMouseDown=(t=>{document.addEventListener("mouseup",this.onMouseUp),this.dragStartTime=Date.now(),this.dragStartPosition=[t.clientX,t.clientY],this.dragOffsetX=t.clientX,this.dragOffsetY=t.clientY}),this.onMouseMove=(t=>{if(null==this.dragOffsetX)return;const e=t.clientY-this.dragOffsetY,i=t.clientX-this.dragOffsetX;if(this.band.type===s.BandType.EventsBand){const t=this.band;(0!==t.offsetY||Math.abs(e)>Math.abs(i)&&Math.abs(e)>5)&&(t.offsetY=e)}const o=i/this.band.pixelsPerMillisecond;n.default.center-=o,a.default.nextFrame(),this.dragOffsetX=t.clientX,this.dragOffsetY=t.clientY}),this.onMouseUp=(t=>{this.lastDragInterval=Date.now()-this.dragStartTime,this.dispatchScrollDoneEvent(t),this.dragOffsetX=null,this.dragOffsetY=null,document.removeEventListener("mouseup",this.onMouseUp)}),this.onDblClick=(t=>{const e=this.band.timestampAtPosition(t.clientX);a.default.goTo(e)})}render(){return this.rootElement=o.default("div","band-wrap",["position: absolute","z-index: 2"],[`height: ${this.band.visibleHeight}px`,`top: ${this.band.top}px`,`width: ${n.default.viewportWidth}px`]),r.default.register("mousedown",this.onMouseDown,this.rootElement),r.default.register("mousemove",this.onMouseMove,this.rootElement),r.default.register("dblclick",this.onDblClick,this.rootElement),this.rootElement}dispatchScrollDoneEvent(t){const e=[this.dragStartPosition[0]-t.clientX,this.dragStartPosition[1]-t.clientY].map(Math.abs).some(t=>t>5);(this.lastDragInterval>200||e)&&r.default.dispatch(l.EventType.ScrollDone)}resize(){this.rootElement.style.cssText=`height: ${this.band.visibleHeight}px; top: ${this.band.top}px; width: ${n.default.viewportWidth}px;`}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const s=i(0);!function(t){t.NONE="none",t.JPG="jpg",t.SVG="svg",t.GIF="gif",t.PNG="png"}(e.ImageFileType||(e.ImageFileType={}));e.Ev3ntLocation=class{};e.Voyage=class{};e.Area=class{};class n{}e.RawEv3nt=n;e.Ev3nt=class extends n{constructor(t,e){super();for(const e in t)null!=t[e]&&(this[e]=t[e]);if(null==this.lbl&&(this.lbl="NO LABEL"),null==this.id&&(this.id="id_"+crypto.getRandomValues(new Uint8Array(4)).join("_")),this.from=this.dmin||this.d,this.to=this.dmax||this.ed,null==this.to&&(this.to=this.from),this.time=this.to-this.from,null!=e){const t=Math.round(2*s.EVENT_HEIGHT/e);let i=this.lbl.length*s.PIXELS_PER_LETTER/e+t;i=i>this.time?i-this.time:0,this.screenTo=Math.round(this.from+this.time+i)}}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const s=i(0),n=i(11),o=i(7);class r{}e.OrderedTimeline=r,e.orderEvents=function(t){if(null==t.bands||!t.bands.length)return new r;let e,i=t.bands.reduce((t,e)=>{const i=e.events[0];return Math.min(t,i.dmin||1/0,i.d||1/0)},1/0),a=t.bands.reduce((t,e)=>{const i=e.events.reduce((t,e)=>Math.max(t,e.d||-1/0,e.ed||-1/0,e.dmax||-1/0),-1/0);return Math.max(i,t)},-1/0);null!=t.parent&&(e=new n.Ev3nt(t.parent),i=Math.min(i,e.dmin||1/0,e.d||1/0),a=Math.max(a,e.ed||-1/0,e.dmax||-1/0));const l=a-i;return{bands:t.bands.map(function(e){const i=o.calcPixelsPerMillisecond(t.viewportWidth,e.zoomLevel,l),r=[-1/0],a=Math.round(2*s.EVENT_ROW_HEIGHT/i);function h(t,e){return(null==r[t+1]||r[t+1]<e)&&(null==r[t+2]||r[t+2]<e)}return{events:e.events.map(function(t){const e=new n.Ev3nt(t,i);let s;if(e.img){const t=e.time?e.from:e.from-a/2,i=e.time?e.from+a:e.from+a/2;if((s=r.findIndex(e=>t>e))>-1){let e=!1;for(;!e&&!(e=h(s,t));)-1===(s=r.findIndex((e,i)=>i>s&&t>e))&&(e=!0)}-1===s?(s=r.push(e.screenTo)-1,r.push(i),r.push(i)):(r[s]=e.screenTo,r[s+1]=i,r[s+2]=i)}else-1===(s=r.findIndex(t=>e.from>t))?s=r.push(e.screenTo)-1:r[s]=e.screenTo;return e.row=s,e}),zoomLevel:e.zoomLevel,pixelsPerMillisecond:i,rowCount:r.length}}),from:i,parent:e,time:l,to:a}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const s=i(2),n=i(1),o=i(0),r=i(3);e.default=class{constructor(){this.animator=s.default,this.resize=(()=>{n.default.resize();for(const t of n.default.bands)t.resize();for(const t of this.views)t.resize();this.animator.nextFrame()}),document.addEventListener("keydown",t=>{189===t.keyCode&&n.default.controlBand.zoomOut(),187===t.keyCode&&n.default.controlBand.zoomIn()})}on(t,e){const i={centerchange:o.EventType.CenterChange,pause:o.EventType.Pause,play:o.EventType.Play,scrolldone:o.EventType.ScrollDone,select:o.EventType.Select,zoomdone:o.EventType.ZoomDone};if(Object.keys(i).indexOf(t)>-1){const s=i[t];let a;a=s===o.EventType.CenterChange?()=>e(n.default):s===o.EventType.Select?t=>e(t.detail):e,r.default.register(s,a)}}reload(){this.resize()}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const s=i(10),n=i(3),o=i(0);e.default=class extends s.default{constructor(t){super(t),this.band=t,this.onWheel=(t=>{0===Math.abs(t.deltaX)&&0!==t.deltaY&&(t.deltaY<0&&this.zoomOut(),t.deltaY>0&&this.zoomIn())}),this.onClick=(t=>{if(this.lastDragInterval>175)return;const e=this.band.getEventByCoordinates(t.clientX,t.clientY);n.default.dispatch(o.EventType.Select,e)})}render(){const t=super.render();return n.default.register("click",this.onClick,this.rootElement),n.default.register("wheel",this.onWheel,this.rootElement),t}zoomIn(){this.band.zoomIn()}zoomOut(){this.band.zoomOut()}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const s=i(4),n=i(1),o=i(0),r=i(2),a=i(16),l=i(3);e.default=class{constructor(){this.indicatorsDrawn=!1,this.onImgLoad=(t=>{const e=i=>{t.image.removeEventListener("load",e),t.image.removeEventListener("error",e),"error"!==i.type?(t.image.width>t.image.height?(t.image.height=Math.round(t.image.height*(o.IMAGE_BOUNDING_BOX/t.image.width)),t.image.width=o.IMAGE_BOUNDING_BOX):(t.image.width=Math.round(t.image.width*(o.IMAGE_BOUNDING_BOX/t.image.height)),t.image.height=o.IMAGE_BOUNDING_BOX),this.drawImage(t)):t.image=null};return e}),this.onAnimationDone=(()=>{}),this.update=(()=>{for(const t of n.default.eventsBands)this.drawEventsBand(t);for(const t of n.default.minimapBands)this.drawMinimapBand(t);this.drawIndicators(),this.updateImages()}),r.default.registerView(this),l.default.register(o.EventType.ZoomDone,this.onAnimationDone),l.default.register(o.EventType.ScrollDone,this.onAnimationDone)}updateImages(){for(const t of n.default.eventsBands)for(const e of t.visibleEvents)if(null!=e.img)if(null==e.image){const t=`${n.default.imagePath}/${e.wid}__${o.IMAGE_SIZE}.${e.img}`;e.image=new Image;const i=this.onImgLoad(e);e.image.addEventListener("load",i),e.image.addEventListener("error",i),e.image.src=t}else this.drawImage(e)}drawImage(t){if(null==t.image||!t.image.complete||!t.image.naturalWidth)return;const e=t.time?t.left:t.left-t.image.width/2-o.IMAGE_BORDER_SIZE,i=t.top-t.image.height;this.ctx.fillStyle=t.color,this.ctx.fillRect(e,i-2*o.IMAGE_BORDER_SIZE,t.image.width+2*o.IMAGE_BORDER_SIZE,t.image.height+2*o.IMAGE_BORDER_SIZE),this.ctx.drawImage(t.image,e+o.IMAGE_BORDER_SIZE,i-o.IMAGE_BORDER_SIZE,t.image.width,t.image.height)}render(){return this.canvas=s.default("canvas","main",["position: absolute"]),this.canvas.width=n.default.viewportWidth,this.canvas.height=n.default.viewportHeight,this.ctx=this.canvas.getContext("2d"),this.indicatorsCanvas=s.default("canvas","indicators",["position: absolute"],["z-index: 1"]),this.indicatorsCanvas.width=n.default.viewportWidth,this.indicatorsCanvas.height=n.default.viewportHeight,this.indicatorsCtx=this.indicatorsCanvas.getContext("2d"),this.update(),[this.canvas,this.indicatorsCanvas]}resize(){this.indicatorsCanvas.width=n.default.viewportWidth,this.indicatorsCanvas.height=n.default.viewportHeight,this.canvas.width=n.default.viewportWidth,this.canvas.height=n.default.viewportHeight,this.indicatorsDrawn=!1}clear(t){this.ctx.clearRect(0,t.top,this.canvas.width,t.visibleHeight)}drawEventsBand(t){this.clear(t),a.default(this.ctx,t);for(const e of t.visibleEvents)if(e.time){let t=e.left,i=e.width;if(e.uncertain_from_width>1){const s=this.ctx.createLinearGradient(e.left,0,e.left+e.uncertain_from_width,0);s.addColorStop(0,"white"),s.addColorStop(1,e.color),this.ctx.fillStyle=s,this.ctx.fillRect(e.left,e.top,e.uncertain_from_width,o.EVENT_HEIGHT),t=e.left+e.uncertain_from_width,i-=e.uncertain_from_width}if(e.uncertain_to_width>1){const s=t+(i-=e.uncertain_to_width),n=s+e.uncertain_to_width,r=this.ctx.createLinearGradient(s,0,n,0);r.addColorStop(0,e.color),r.addColorStop(1,"white"),this.ctx.fillStyle=r,this.ctx.fillRect(s,e.top,e.uncertain_to_width,o.EVENT_HEIGHT)}this.ctx.fillStyle=e.color,this.ctx.fillRect(t,e.top,i,o.EVENT_HEIGHT)}else this.ctx.moveTo(e.left,e.top+o.EVENT_HEIGHT/2),this.ctx.beginPath(),this.ctx.arc(e.left,e.top+o.EVENT_HEIGHT/2,o.EVENT_HEIGHT/3,0,2*Math.PI),this.ctx.fillStyle=e.color,this.ctx.fill();this.drawEventsText(t)}drawEventsText(t){this.ctx.font=`${o.FONT_SIZE}px sans-serif`,this.ctx.fillStyle="rgb(40, 40, 40)";for(const e of t.visibleEvents){let t=e.left;e.left<0&&0!==e.time&&(t=-e.uncertain_from_width);const i=t+(e.time?o.FONT_SIZE/3:o.FONT_SIZE/1.2)+e.uncertain_from_width,s=e.top+o.FONT_SIZE+(o.EVENT_HEIGHT-o.FONT_SIZE)/2-2;this.ctx.fillText(e.lbl,Math.round(i),Math.round(s))}}drawMinimapBand(t){if(t.isDrawn&&t.prevOffsetX===t.offsetX&&t.prevZoomLevel===t.zoomLevel)return;this.clear(t),a.default(this.ctx,t);const e=t.draw();this.ctx.drawImage(e,0,t.top,n.default.viewportWidth,t.availableHeight),t.isDrawn=!0}drawIndicators(){if(!this.indicatorsDrawn||!n.default.eventsBands.every(t=>t.prevZoomLevel===t.zoomLevel)){this.indicatorsCtx.clearRect(0,0,n.default.viewportWidth,n.default.viewportHeight),this.indicatorsCtx.beginPath();for(const t of n.default.minimapBands){const e=n.default.eventsBands[t.config.indicatorFor],i=Math.round(t.config.topOffsetRatio*n.default.viewportHeight),s=t.positionAtTimestamp(e.from);this.indicatorsCtx.rect(0,i,s,t.visibleHeight);const o=t.positionAtTimestamp(e.to);this.indicatorsCtx.rect(o,i,n.default.viewportWidth,t.visibleHeight),this.indicatorsCtx.rect(s,i+t.availableHeight,o-s,t.visibleHeight-t.availableHeight)}this.indicatorsCtx.fillStyle="rgba(0, 0, 0, .04)",this.indicatorsCtx.fill(),this.indicatorsCtx.closePath(),this.indicatorsDrawn=!0}}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const s=i(1),n=i(0),o=i(6);function r(t,e){return"CENTURY"===e.granularity&&new Date(t).getUTCFullYear()%1e3==0||("YEAR_5"===e.granularity&&new Date(t).getUTCFullYear()%50==0||"YEAR"===e.granularity&&new Date(t).getUTCFullYear()%5==0)}function a(t,e,i,s,n){const r=e.positionAtTimestamp(i);t.moveTo(r,s),t.lineTo(r,n),e.config.rulerLabels&&t.fillText(o.labelBody(i,e.granularity),r+3,n-3)}e.default=function(t,e){if(!e.config.rulers)return;let i=e.nextDate(e.from);const o=e.config.topOffsetRatio*s.default.viewportHeight,l=e.config.heightRatio*s.default.viewportHeight,h=[],d=[];for(;i<e.to;)r(i,e)?d.push(i):h.push(i),i=e.nextDate(i);t.beginPath(),t.font=`${n.FONT_SIZE}px sans-serif`,t.fillStyle="rgb(205, 205, 205)";for(const i of h)a(t,e,i,o,o+l);t.strokeStyle="rgb(235, 235, 235)",t.stroke(),t.beginPath(),t.font=`${1.2*n.FONT_SIZE}px sans-serif`,t.fillStyle="rgb(120, 120, 120)";for(const i of d)a(t,e,i,o,o+l);t.strokeStyle="rgb(150, 150, 150)",t.stroke()}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const s=i(4);e.default=class{constructor(t){this.band=t}render(){const t=s.default("div","events-label-wrapper",["border-top: 1px solid #CCC","pointer-events: none","position: absolute","width: 100%","z-index: 3"],[`top: ${100*this.band.config.topOffsetRatio}%`]),e=s.default("div","events-label",["background: white","border-bottom-right-radius: 4px","box-shadow: 1px 2px 4px #AAA","color: #444","display: inline-block","font-family: sans-serif","font-size: .8em","padding: 4px 8px"]);return e.innerText=this.band.config.label,t.appendChild(e),t}resize(){}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const s=i(4),n=i(1),o=i(0),r=i(6),a=i(2),l=14;e.default=class{constructor(t){this.rootElement=t,this.update=(()=>{this.event&&this.setPosition()}),this.loadImage=(()=>{this.el.querySelector("img").removeEventListener("load",this.loadImage),this.setWidth(),this.setPosition()}),this.el=s.default("div"),this.el.id="popup",this.el.style.position="absolute",this.el.style.zIndex="10",this.hide(),this.rootElement.appendChild(this.el),this.el.addEventListener("click",t=>{t.target.matches("#popup-close")&&this.hide()}),a.default.registerView(this)}hide(){this.event=null,this.el.style.width="auto",this.el.style.visibility="hidden",this.el.classList.remove("bottom")}setWidth(){const t=this.el.getBoundingClientRect();this.el.style.width=`${t.width}px`}setPosition(){const t=this.el.getBoundingClientRect();if(this.event.left+this.event.width<l||this.event.left>n.default.viewportWidth-l)return void(this.el.style.visibility="hidden");let e=this.event.left+this.event.width/2-t.width/2;e<l&&(e=l),e+t.width>n.default.viewportWidth-l&&(e=n.default.viewportWidth-t.width-l),this.el.style.left=`${e}px`;let i=this.event.top+o.EVENT_HEIGHT+l;i+t.height>n.default.viewportHeight-l&&(i=this.event.top-t.height-l,this.el.classList.add("bottom")),this.el.style.top=`${i}px`,this.el.style.visibility="visible"}show(t){this.hide(),this.event=t,this.el.innerHTML=function(t){return`\n\t\t<img alt="noimage" src="" />\n\t\t<div class="metadata">\n\t\t\t<h2 class="label">${t.lbl}</h2>\n\t\t\t<div class="description">${t.dsc||""}</div>\n\t\t\t<br />\n\t\t\t<br />\n\t\t\t<div class="from">${r.formatDate(t.from,t.dmin_g||t.d_g)}</div>\n\t\t\t${t.time?`<div class="to">${r.formatDate(t.to,t.dmax_g||t.ed_g)}</div>`:""}\n\t\t</div>\n\t\t<div id="popup-close">✖</div>\n\t`}(t),this.el.querySelector(".label").style.color=t.color;const e=this.el.querySelector("img");t.img?(e.setAttribute("alt",`Image of ${t.lbl}`),e.addEventListener("load",this.loadImage),e.src=t.image.src.replace("32","128")):(e.src=null,e.setAttribute("alt","noimage"),this.setWidth(),this.setPosition())}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const s=i(5),n=i(8),o=i(1),r=i(4);e.default=class extends s.default{constructor(t){super(function(t){const e=Object.assign({},new n.MinimapBandConfig,t);return e.targets.length||e.targets.push(0),e}(t)),this.type=s.BandType.MinimapBand,this.canvas=r.default("canvas"),this.ctx=this.canvas.getContext("2d"),this.nextCanvas=r.default("canvas"),this.nextCtx=this.nextCanvas.getContext("2d"),this.isDrawn=!1}init(){super.init(),this.maxRowCount=this.config.targets.reduce((t,e)=>{const{rowCount:i}=o.default.eventsBands[e];return Math.max(t,i)},0);const t=this.availableHeight/this.maxRowCount;this.eventHeight=t<1?1:Math.floor(t),this.canvas.width=o.default.viewportWidth,this.canvas.height=this.maxRowCount*this.eventHeight,this.nextCanvas.width=this.canvas.width,this.nextCanvas.height=this.canvas.height}resize(){super.resize(),this.isDrawn=!1}draw(){return this.isDrawn?this.updateNextCanvas():this.drawEvents(),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.ctx.drawImage(this.nextCanvas,0,0),this.canvas}drawEvents(t=this.from,e=this.to){this.nextCtx.beginPath(),this.config.targets.forEach(i=>{const s=o.default.eventsBands[i];for(const i of s.events){if(i.from>e||i.to<t)continue;const s=this.positionAtTimestamp(i.from),n=this.maxRowCount-(i.row+2)*this.eventHeight,o=Math.round(i.time*this.pixelsPerMillisecond),r=o<1?1:o;this.nextCtx.fillStyle="rgb(190, 190, 190)",this.nextCtx.fillRect(s,n,r,this.eventHeight),i.img&&(this.nextCtx.fillStyle="rgb(240, 240, 240)",this.nextCtx.fillRect(s,n-2*this.eventHeight,2*this.eventHeight,2*this.eventHeight))}})}updateNextCanvas(){const t=Math.round(this.offsetX-this.prevOffsetX);if(0===t)return this.canvas;let e,i;this.nextCtx.clearRect(0,0,this.nextCanvas.width,this.nextCanvas.height),this.nextCtx.drawImage(this.canvas,t,0),t<0?(e=this.timestampAtPosition(o.default.viewportWidth+t),i=this.to):(e=this.from,i=this.timestampAtPosition(t)),this.drawEvents(e,i)}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const s=i(5),n=i(8),o=i(2),r=i(0),a=i(1),l=i(6);e.default=class extends s.default{constructor(t){super(Object.assign({},new n.EventsBandConfig,t)),this.type=s.BandType.EventsBand,this.events=[],this.rowCount=0,this.visibleEvents=[],this._offsetY=0,null!=this.config.events&&this.config.events.sort(l.byDate)}get offsetY(){return this._offsetY}set offsetY(t){this._offsetY+=t,this._offsetY<0&&(this._offsetY=0);const e=this.height>this.availableHeight?this.height-this.availableHeight+r.EVENT_ROW_HEIGHT:0;this._offsetY>e&&(this._offsetY=e);const i=this._offsetY/r.EVENT_ROW_HEIGHT;this.lowestVisibleRow=Math.ceil(i),this.highestVisibleRow=this.lowestVisibleRow+this.visibleRowsCount}init(t){super.init(),this.events=t.events,this.rowCount=t.rowCount,this.height=r.EVENT_ROW_HEIGHT*this.rowCount,this.offsetY=0,this.updateEvents()}getColor(t,e){const i=[49,220,215];let s;if(a.default.center>e)s=a.default.center-e;else{if(!(a.default.center<t))return`rgb(${i.join(", ")})`;s=t-a.default.center}const n=s/(this.time/2),o=a.default.center>e?[253,231,37]:[204,104,232];return`rgb(${i.map((t,e)=>t+(o[e]-t)*n).join(", ")})`}updateEvents(){this.visibleEvents=this.events.filter(t=>!(t.from>this.to||t.to<this.from)&&t.row>=this.lowestVisibleRow&&t.row<=this.highestVisibleRow).map(t=>{if(t.left=this.positionAtTimestamp(t.from),t.width=Math.round(t.time*this.pixelsPerMillisecond),t.time&&t.width<1&&(t.width=1),t.uncertain_from_width=0,null!=t.dmin){let e;if(null!=t.d)e=t.d;else if(null!=t.ed)e=t.ed;else{if(null==t.dmax)throw Error(["updateEvents","Width uncertain from is not definable",JSON.stringify(t)].join("\n"));e=t.dmin+(t.dmax-t.dmin)/2}t.uncertain_from_width=(e-t.dmin)*this.pixelsPerMillisecond}if(t.uncertain_to_width=0,null!=t.dmax){let e;if(null!=t.ed)e=t.ed;else if(null!=t.d)e=t.d;else{if(null==t.dmin)throw Error(["updateEvents","Width uncertain to is not definable",JSON.stringify(t)].join("\n"));e=t.dmin+(t.dmax-t.dmin)/2}t.uncertain_to_width=(t.dmax-e)*this.pixelsPerMillisecond}return t.top=this.top+this.availableHeight-(t.row+1)*r.EVENT_ROW_HEIGHT+this.offsetY,t.color=this.getColor(t.from,t.to),t})}update(){super.update(),this.updateEvents()}getEventByCoordinates(t,e){const i=this.timestampAtPosition(t),s=a.default.viewportOffset+this.top+this.availableHeight+this.offsetY,n=Math.floor((s-e)/r.EVENT_ROW_HEIGHT);return this.events.find(t=>!(!(t.from<i&&t.screenTo>i)||t.row<this.lowestVisibleRow||t.row>this.highestVisibleRow)&&t.row===n)}zoomIn(){o.default.zoomTo(this,this.zoomLevel+1)}zoomOut(){o.default.zoomTo(this,this.zoomLevel-1)}}}])});
{
"name": "timeline",
"version": "3.3.1",
"version": "3.4.1",
"description": "",

@@ -5,0 +5,0 @@ "main": "build/index.js",

@@ -5,2 +5,3 @@ import animator, { Animator } from './animator'

import { EventType } from './constants';
import eventBus from './event-bus';

@@ -41,3 +42,3 @@ export type OnChangeFunction = (props: Props, e?: Event) => void

document.addEventListener(eventType, realFunc)
eventBus.register(eventType, realFunc)
}

@@ -44,0 +45,0 @@ }

@@ -25,4 +25,4 @@ import props, { Props } from './models/props'

Ev3ntLocation,
EventType,
EventsBand,
EventType,
MinimapBand,

@@ -32,6 +32,6 @@ OrderedTimeline,

RawEv3nt,
Voyage,
calcPixelsPerMillisecond,
formatDate,
orderEvents,
Voyage,
}

@@ -74,3 +74,5 @@

const debouncedResize = debounce(this.resize, 600)
// TODO use eventBus
window.addEventListener('resize', debouncedResize)
}

@@ -130,2 +132,12 @@

center() {
return props.center
}
visibleEvents() {
return props.eventsBands
.map(band => band.visibleEvents)
.reduce((prev, curr) => prev.concat(curr))
}
private renderLabels() {

@@ -132,0 +144,0 @@ props.bands

@@ -17,23 +17,70 @@ import { Milliseconds, Pixels, PIXELS_PER_LETTER, EVENT_HEIGHT } from '../constants';

// TODO should the location also have dmin and dmax?
export class Ev3ntLocation {
/** Coordinates using the EPSG:3857 coordinate reference system */
coor?: Point
/** Coordinates using the EPSG:4326 coordinate reference system */
coor4326?: Point
/** Earliest possible date. Only used when start date is uncertain */
dmin?: Milliseconds
/** Earliest possible date granularity */
dmin_g?: Granularity
/** Date */
d?: Milliseconds
/** Date granularity */
d_g?: Granularity
/** End date */
ed?: Milliseconds
/** End date granularity */
ed_g?: Granularity
/** Latest possible date. Only used when end date is uncertain */
dmax?: Milliseconds
/** Latest possible date granularity */
dmax_g?: Granularity
}
/** A voyage is a change in the location of an event over time.
*
* The route of the voyage will be determined by:
* - route ID: map of routes should be resolved by props.loadRoutes
* - start point and end point: the route will be interpolated
*/
export class Voyage {
/** Start date of the voyage */
d: Milliseconds
/** End date of the voyage */
ed: Milliseconds
route: string
sp?: Point // Start point
ep?: Point // End point
/** ID of a route */
route?: string
/** Start point */
sp?: Point
/** End point */
ep?: Point
}
/** An area is the surface of an event between two given dates */
export class Area {
/** Start date of the voyage */
d: Milliseconds
/** End date of the voyage */
ed: Milliseconds
/** ID of an area */
area: string
}
export class RawEv3nt {

@@ -53,2 +100,3 @@ class: string[]

lbl: string
areas: Area[]
locs: Ev3ntLocation[]

@@ -64,5 +112,8 @@ voyages: Voyage[]

// The length of time an event took.
// A Point in Time has time = 0
// For an interval, if the event takes 1 year, time = 31536000000
/**
* The length of time of an event
*
* PointInTime has time = 0
* Interval has time = 31536000000, if the event takes 1 year,
*/
time?: Milliseconds

@@ -69,0 +120,0 @@

@@ -44,2 +44,3 @@ import Band, { BandType } from '../../models/band'

private onMouseDown = (ev: MouseEvent) => {
// TODO use eventBus
document.addEventListener('mouseup', this.onMouseUp)

@@ -46,0 +47,0 @@ this.dragStartTime = Date.now()

@@ -31,3 +31,3 @@ import createElement from '../../utils/create-element'

private async updateImages() {
private updateImages() {
for (const band of props.eventsBands) {

@@ -40,2 +40,3 @@ for (const event of band.visibleEvents) {

const onImgLoad = this.onImgLoad(event)
// TODO use eventBus
event.image.addEventListener('load', onImgLoad)

@@ -42,0 +43,0 @@ event.image.addEventListener('error', onImgLoad)

@@ -40,2 +40,3 @@ import { Ev3nt } from '../models/event';

this.rootElement.appendChild(this.el)
// TODO use eventBus
this.el.addEventListener('click', (ev: MouseEvent) => {

@@ -42,0 +43,0 @@ if ((ev.target as HTMLElement).matches('#popup-close')) {

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc