diff --git a/package.json b/package.json index 688ced4..9a51b6b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dayspan", - "version": "0.9.0", + "version": "0.10.0", "description": "A date & schedule library to use for advanced calendars in TypeScript and JS", "main": "umd/dayspan.js", "mainName": "ds", diff --git a/src/Functions.ts b/src/Functions.ts index e113d0d..0546edf 100644 --- a/src/Functions.ts +++ b/src/Functions.ts @@ -163,6 +163,23 @@ export class Functions return this.isDefined( a ) ? a : (this.isDefined( b ) ? b : c); } + /** + * Copies values from `from` object and sets them to the `target` object. + * + * @param target The object to set values to. + * @param from The object to copy value references from. + * @returns The reference to `target`. + */ + public static extend(target: any, from: any): any + { + for (let prop in from) + { + target[ prop ] = from[ prop ]; + } + + return target; + } + /** * Pads the string `x` up to `length` characters with the given `padding` * optionally placing the `padding` `before` `x`. diff --git a/src/Iterator.ts b/src/Iterator.ts index e1e47b8..1c7624b 100644 --- a/src/Iterator.ts +++ b/src/Iterator.ts @@ -14,8 +14,7 @@ export type IteratorCallback = (item: T, iterator: Iterator) => R; /** * An [[Iterator]] source which handles iterating over items and calls - * `callback` for each item, checking [[Iterator.iterating]] after each - * invokation to stop iteration as early as possible. + * [[Iterator.act]] for each item, taking the requested action when possible. * * @param callback The function to invoke for each item. * @param iterator The iterator to check for early exists. @@ -108,7 +107,7 @@ export class Iterator /** * A result of the iteration passed to [[Iterator.stop]]. */ - public result: any = undefined; + public result: any = null; /** * The last action (if any) called on this iterator. diff --git a/src/Parse.ts b/src/Parse.ts index f73cbe7..1334f08 100644 --- a/src/Parse.ts +++ b/src/Parse.ts @@ -56,7 +56,7 @@ export class Parse check.given = true; } - check.input = input; + check.input = fn.coalesce( input, null ); check.property = property; return check; diff --git a/src/Pattern.ts b/src/Pattern.ts index bba4fa9..4e5b704 100644 --- a/src/Pattern.ts +++ b/src/Pattern.ts @@ -3,8 +3,8 @@ import { Functions as fn } from './Functions'; import { Day, DayProperty } from './Day'; import { Suffix } from './Suffix'; import { Weekday } from './Weekday'; -import { FrequencyValueEvery } from './Frequency'; -import { ScheduleInput } from './Schedule'; +import { FrequencyValueEvery, FrequencyValue } from './Frequency'; +import { Schedule, ScheduleInput } from './Schedule'; /** @@ -120,15 +120,47 @@ export class Pattern } /** - * Applies this pattern to schedule input removing and adding any necessary - * properties from the input to match this pattern - based around the day - * provided. + * Applies this pattern to a [[Schedule]] or [[ScheduleInput]] removing and + * adding any necessary properties from the input to match this pattern - + * based around the day provided. * - * @param input The input to update to match this pattern. + * @param schedule The schedule to update to match this pattern. * @param day The day to base the schedule on. * @returns The reference to the input passed in. */ - public apply(input: ScheduleInput, day: Day): ScheduleInput + public apply | Schedule>(schedule: I, day: Day): I + { + if (schedule instanceof Schedule) + { + this.applyGeneric(day, + (prop, frequency) => schedule.setFrequency( prop, frequency ), + (prop) => schedule.setFrequency( prop ) + ); + + schedule.updateChecks(); + } + else + { + this.applyGeneric(day, + (prop, frequency) => schedule[ prop ] = frequency, + (prop) => delete schedule[ prop ] + ); + } + + return schedule; + } + + /** + * Applies this pattern to any object provided they implement the + * `setFrequency` and `removeFrequency` functions. + * + * @param day The day to base the schedule on. + * @param setFrequency The function which sets the frequency on the object. + * @param removeFrequency The function to remove a frequency from the object. + */ + public applyGeneric(day: Day, + setFrequency: (property: DayProperty, frequency: any) => any, + removeFrequency: (property: DayProperty) => any): void { for (let prop of Pattern.PROPS) { @@ -137,23 +169,43 @@ export class Pattern // Should have one value if (rule === 1) { - input[ prop ] = [day[ prop ]]; + setFrequency( prop, [day[ prop ]] ); } // Can be any of the values in the array if (fn.isArray(rule)) { - input[ prop ] = rule; + setFrequency( prop, rule ); } // Must not be present if (!fn.isDefined(rule)) { - delete input[ prop ]; + removeFrequency( prop ); } } + } - return input; + /** + * Determines whether the given [[Schedule]] or [[ScheduleInput]] matches this + * pattern. Optionally a day can be provided to make sure the day matches the + * schedule and pattern together. + * + * @param schedule The schedule input to test. + * @param exactlyWith A day to further validate against for matching. + * @returns `true` if the schedule was a match to this pattern with the + * day if one was provided, otherwise `false`. + */ + public isMatch | Schedule>(schedule: I, exactlyWith?: Day): boolean + { + if (schedule instanceof Schedule) + { + return this.isMatchGeneric((prop) => schedule[ prop ].input, exactlyWith); + } + else + { + return this.isMatchGeneric((prop) => schedule[ prop ], exactlyWith); + } } /** @@ -166,14 +218,14 @@ export class Pattern * @returns `true` if the schedule input was a match to this pattern with the * day if one was provided, otherwise `false`. */ - public isMatch(input: ScheduleInput, exactlyWith?: Day): boolean + public isMatchGeneric(getFrequency: (property: DayProperty) => FrequencyValue, exactlyWith?: Day): boolean { let exactly: boolean = fn.isDefined( exactlyWith ); for (let prop of Pattern.PROPS) { let rule = this.rules[ prop ]; - let curr = input[ prop ]; + let curr = getFrequency( prop ); // Optional, skip it if (rule === false) @@ -196,9 +248,9 @@ export class Pattern // Must be an array of the same size if (fn.isNumber(rule)) { - if (fn.isArray(curr) && curr.length === rule) + if (fn.isArray(curr) && (curr).length === rule) { - if (exactly && curr.indexOf( exactlyWith[ prop ] ) === -1) + if (exactly && (curr).indexOf( exactlyWith[ prop ] ) === -1) { return false; } @@ -217,7 +269,7 @@ export class Pattern return false; } - if (rule.length !== curr.length) + if (rule.length !== (curr).length) { return false; } @@ -245,7 +297,7 @@ export class Pattern } var ruleOffset = rule.offset || 0; - var currOffset = curr.offset || 0; + var currOffset = (curr).offset || 0; if (currOffset !== ruleOffset || curr.every !== rule.every) { @@ -284,11 +336,11 @@ export class Pattern * @param exactlyWith A day to further validate against for matching. * @see [[Pattern.isMatch]] */ - public static findMatch(input: ScheduleInput, listedOnly: boolean = true, exactlyWith?: Day): Pattern + public static findMatch | Schedule>(input: I, listedOnly: boolean = true, exactlyWith?: Day): Pattern { for (let pattern of Patterns) { - if ((pattern.listed || !listedOnly) && pattern.isMatch( input, exactlyWith )) + if ((pattern.listed || !listedOnly) && pattern.isMatch( input, exactlyWith )) { return pattern; } diff --git a/src/Schedule.ts b/src/Schedule.ts index df53d86..bf18e7a 100644 --- a/src/Schedule.ts +++ b/src/Schedule.ts @@ -562,6 +562,70 @@ export class Schedule return this.times.length === 0; } + /** + * Sets whether this schedule is a full day event if it is not already. If + * this schedule is a full day event and `false` is passed to this function + * a single timed event will be added based on `defaultTime`. If this schedule + * has timed events and `true` is passed to make the schedule full day, the + * timed events are removed from this schedule. If the durationUnit is not the + * expected unit based on the new full day flag - the duration is reset to 1 + * and the duration unit is set to the expected unit. + * + * @param fullDay Whether this schedule should represent a full day event or + * timed events. + * @param defaultTime If `fullDay` is `false` and this schedule is currently + * a full day event - this time will be used as the time of the first event. + */ + public setFullDay(fullDay: boolean = true, defaultTime: TimeInput = '08:00'): this + { + if (fullDay !== this.isFullDay()) + { + if (fullDay) + { + this.times = []; + + if (this.durationUnit !== 'days' && this.durationUnit !== 'day') + { + this.duration = 1; + this.durationUnit = 'days'; + } + } + else + { + this.times = [Parse.time( defaultTime )]; + + if (this.durationUnit !== 'hours' && this.durationUnit !== 'hour') + { + this.duration = 1; + this.durationUnit = 'hours'; + } + } + } + + return this; + } + + /** + * Adjusts the [[Schedule.start]] and [[Schedule.end]] dates specified on this + * schedule if this schedule represents a single event and the `start` and + * `end` are already set or `addSpan` is `true`. + * + * @param addSpan If `true`, the `start` and `end` dates will always be + * adjusted if this schedule is a single event. + */ + public adjustDefinedSpan(addSpan: boolean = false): this + { + let single: DaySpan = this.getSingleEventSpan(); + + if (single && (addSpan || (this.start && this.end))) + { + this.start = single.start.start(); + this.end = single.end.end(); + } + + return this; + } + /** * Returns a span of time for a schedule with full day events starting on the * start of the given day with the desired duration in days or weeks. @@ -918,6 +982,21 @@ export class Schedule return !!this.iterateSpans( day, true ).first( span => span.contains( day ) ); } + /** + * Sets the frequency for the given property. This does not update the + * [[Schedule.checks]] array, the [[Schedule.updateChecks]] function needs + * to be called. + * + * @param property The frequency to update. + * @param frequency The new frequency. + */ + public setFrequency(property: DayProperty, frequency?: FrequencyValue): this + { + this[ property ] = Parse.frequency( frequency, property ); + + return this; + } + /** * Changes the exclusion status of the event at the given time. By default * this excludes this event - but `false` may be passed to undo an exclusion. @@ -972,6 +1051,40 @@ export class Schedule return false; } + /** + * Moves a time specified in this schedule to the given time, adjusting + * any cancelled event instances, metadata, and any excluded and included + * event instances. + * + * @param fromTime The time to move. + * @param toTime The new time in the schedule. + * @returns `true` if time was moved, otherwise `false`. + */ + public moveTime(fromTime: Time, toTime: Time): boolean + { + let found: boolean = false; + + for (let i = 0; i < this.times.length && !found; i++) + { + if (found = fromTime.matches( this.times[ i ] )) + { + this.times.splice( i, 1, toTime ); + } + } + + if (found) + { + this.include.moveTime( fromTime, toTime ); + this.exclude.moveTime( fromTime, toTime ); + this.cancel.moveTime( fromTime, toTime ); + this.meta.moveTime( fromTime, toTime ); + + this.adjustDefinedSpan( false ); + } + + return found; + } + /** * Moves the event instance starting at `fromTime` to `toTime` optionally * placing `meta` in the schedules metadata for the new time `toTime`. A move @@ -1033,7 +1146,7 @@ export class Schedule if (this.times.length === 1 && takeTime) { - this.times[ 0 ] = toTime.asTime(); + this.times = [toTime.asTime()]; } this.updateChecks(); @@ -1364,7 +1477,6 @@ export class Schedule * @param alwaysDuration If the duration values (`duration` and * `durationUnit`) should always be returned in the input. * @returns The input that describes this schedule. - * @see [[Schedule.getExclusions]] * @see [[Time.format]] */ public toInput(returnDays: boolean = false, returnTimes: boolean = false, timeFormat: string = '', alwaysDuration: boolean = false): ScheduleInput @@ -1390,7 +1502,7 @@ export class Schedule if (exclusions.length) out.exclude = exclusions; if (inclusions.length) out.include = inclusions; if (cancels.length) out.cancel = cancels; - if (hasMeta) out.meta = this.meta.map; + if (hasMeta) out.meta = fn.extend( {}, this.meta.map ); if (this.dayOfWeek.input) out.dayOfWeek = this.dayOfWeek.input; if (this.dayOfMonth.input) out.dayOfMonth = this.dayOfMonth.input; if (this.lastDayOfMonth.input) out.lastDayOfMonth = this.lastDayOfMonth.input; diff --git a/src/ScheduleModifier.ts b/src/ScheduleModifier.ts index 3826c27..8f0044c 100644 --- a/src/ScheduleModifier.ts +++ b/src/ScheduleModifier.ts @@ -1,6 +1,7 @@ import { Identifier, IdentifierInput } from './Identifier'; import { Day } from './Day'; +import { Time } from './Time'; import { DaySpan } from './DaySpan'; import { Iterator, IteratorAction } from './Iterator'; @@ -135,6 +136,52 @@ export class ScheduleModifier return this; } + /** + * Moves any identifiers with the matching time `fromTime` to `toTime` and + * returns the number of moves. + * + * @param fromTime The time to move from. + * @param toTime The time to move to. + * @returns The number of modifiers moved. + */ + public moveTime(fromTime: Time, toTime: Time): number + { + let type: Identifier = Identifier.Time; + let moveIds: IdentifierInput[] = []; + + this.iterate().iterate(([id, value]) => + { + if (type.is( id )) + { + let start: Day = type.start( id ); + + if (start.sameTime( fromTime )) + { + moveIds.push( id ); + } + } + }); + + let moved: number = 0; + + for (let id of moveIds) + { + let value: T = this.map[ id ]; + let start: Day = type.start( id ); + let newStart: Day = start.withTime( toTime ); + let newId: IdentifierInput = type.get( newStart ); + + if (!this.map[ newId ]) + { + this.map[ newId ] = value; + delete this.map[ id ]; + moved++; + } + } + + return moved; + } + /** * Sets the value/modification in this map given a day, the value, and the * identifier type. @@ -237,7 +284,7 @@ export class ScheduleModifier if (type) { - let span = type.span( id, endInclusive); + let span = type.span( id, endInclusive ); return { span, value }; } diff --git a/src/Time.ts b/src/Time.ts index 99beee3..fbcff3a 100644 --- a/src/Time.ts +++ b/src/Time.ts @@ -128,6 +128,58 @@ export class Time return out; } + /** + * Determines whether this time is an exact match for the given time. + * + * @param time The given time to test against. + * @returns `true` if the time matches this time, otherwise `false`. + */ + public matches(time: Time): boolean + { + return this.hour === time.hour && + this.minute === time.minute && + this.second === time.second && + this.millisecond === time.millisecond; + } + + /** + * Determines whether this time has the same hour as the given time. + * + * @param time The given time to test against. + * @returns `true` if the given hour matches this hour, otherwise `false`. + */ + public matchesHour(time: Time): boolean + { + return this.hour === time.hour; + } + + /** + * Determines whether this time has the same hour and minute as the given time. + * + * @param time The given time to test against. + * @returns `true` if the given hour and minute matches, otherwise `false`. + */ + public matchesMinute(time: Time): boolean + { + return this.hour === time.hour && + this.minute === time.minute; + } + + /** + * Determines whether this time has the same hour, minute, and second as the + * given time. + * + * @param time The given time to test against. + * @returns `true` if the given hour, minute, and second matches, otherwise + * `false`. + */ + public matchesSecond(time: Time): boolean + { + return this.hour === time.hour && + this.minute === time.minute && + this.second === time.second; + } + /** * @returns The number of milliseconds from the start of the day until this * time. diff --git a/src/__tests__/Schedule.spec.ts b/src/__tests__/Schedule.spec.ts index 1f1296a..072f688 100644 --- a/src/__tests__/Schedule.spec.ts +++ b/src/__tests__/Schedule.spec.ts @@ -3,6 +3,7 @@ import { Schedule } from '../Schedule'; import { Weekday } from '../Weekday'; import { Month } from '../Month'; import { Day } from '../Day'; +import { Time } from '../Time'; import { Identifier, IdentifierInput } from '../Identifier'; @@ -495,4 +496,41 @@ describe('Schedule', () => ]); }); + it('moveTime', () => + { + let s1 = new Schedule({ + dayOfWeek: [1], + times: [ + '09:30', + '15:00' + ] + }); + + let c0 = Day.build(2018, 5, 18, 9, 30); + let c1 = Day.build(2018, 5, 18, 9, 0); + + s1.move( + Day.build(2018, 5, 25, 9, 15), + Day.build(2018, 5, 25, 9, 30) + ); + + expect( s1.isCancelled(c0) ).toBe( false ); + + s1.setCancelled(c0); + + expect( s1.isCancelled(c0) ).toBe( true ); + + s1.moveTime( + Time.parse('09:30'), + Time.parse('09:00') + ); + + expect( s1.isCancelled(c0) ).toBe( false ); + expect( s1.isCancelled(c1) ).toBe( true ); + + expect( s1.times.length ).toBe( 2 ); + expect( s1.times[0].format('HH:mm') ).toBe( '09:00' ); + expect( s1.times[1].format('HH:mm') ).toBe( '15:00' ); + }); + }) diff --git a/src/__tests__/ScheduleModifier.spec.ts b/src/__tests__/ScheduleModifier.spec.ts new file mode 100644 index 0000000..8386f12 --- /dev/null +++ b/src/__tests__/ScheduleModifier.spec.ts @@ -0,0 +1,58 @@ +// import { describe, it, expect } from 'jest'; +import { ScheduleModifier } from '../ScheduleModifier'; +import { Time } from '../Time'; +import { Day } from '../Day'; +import { Identifier } from '../Identifier'; + + +describe('ScheduleModifier', () => +{ + + let d0 = Day.fromArray([2017, 2, 11, 8, 30]); + let d1 = Day.fromArray([2014, 5, 15, 16, 23]); + + let t0 = Time.parse('08:30'); + let t1 = Time.parse('09:45'); + + it('moveTime', () => + { + let mod = new ScheduleModifier(); + + mod.set( d0, true, Identifier.Time ); + mod.set( d1, true, Identifier.Time ); + + expect( mod.get( d0, false ) ).toBe( true ); + expect( mod.map[ '201406151623'] ).toBe( true ); + expect( mod.map[ '201703110830'] ).toBe( true ); + expect( mod.map[ '201703110945'] ).toBe( undefined ); + + mod.moveTime( t0, t1 ); + + expect( mod.get( d0, false ) ).toBe( false ); + expect( mod.map[ '201406151623'] ).toBe( true ); + expect( mod.map[ '201703110830'] ).toBe( undefined ); + expect( mod.map[ '201703110945'] ).toBe( true ); + }) + + it('get time first', () => + { + let mod = new ScheduleModifier(); + + mod.set( d0, 1, Identifier.Time ); + mod.set( d0, 2, Identifier.Day ); + + expect( mod.get( d0, 3 ) ).toBe( 1 ); + expect( mod.get( d1, 3 ) ).toBe( 3 ); + }) + + it('get all day', () => + { + let mod = new ScheduleModifier(); + + mod.set( d0, 1, Identifier.Time ); + mod.set( d0, 2, Identifier.Day ); + + expect( mod.getAll( d0 ) ).toEqual( [1, 2] ); + }) + +}) diff --git a/umd/dayspan.js b/umd/dayspan.js index 81881ee..40a18d3 100644 --- a/umd/dayspan.js +++ b/umd/dayspan.js @@ -236,6 +236,19 @@ var Functions = (function () { Functions.coalesce = function (a, b, c) { return this.isDefined(a) ? a : (this.isDefined(b) ? b : c); }; + /** + * Copies values from `from` object and sets them to the `target` object. + * + * @param target The object to set values to. + * @param from The object to copy value references from. + * @returns The reference to `target`. + */ + Functions.extend = function (target, from) { + for (var prop in from) { + target[prop] = from[prop]; + } + return target; + }; /** * Pads the string `x` up to `length` characters with the given `padding` * optionally placing the `padding` `before` `x`. @@ -1547,7 +1560,7 @@ var Iterator_Iterator = (function () { /** * A result of the iteration passed to [[Iterator.stop]]. */ - this.result = undefined; + this.result = null; this.source = source; } /** @@ -2099,6 +2112,41 @@ var ScheduleModifier_ScheduleModifier = (function () { delete this.map[fromIdentifier]; return this; }; + /** + * Moves any identifiers with the matching time `fromTime` to `toTime` and + * returns the number of moves. + * + * @param fromTime The time to move from. + * @param toTime The time to move to. + * @returns The number of modifiers moved. + */ + ScheduleModifier.prototype.moveTime = function (fromTime, toTime) { + var type = Identifier_Identifier.Time; + var moveIds = []; + this.iterate().iterate(function (_a) { + var id = _a[0], value = _a[1]; + if (type.is(id)) { + var start = type.start(id); + if (start.sameTime(fromTime)) { + moveIds.push(id); + } + } + }); + var moved = 0; + for (var _i = 0, moveIds_1 = moveIds; _i < moveIds_1.length; _i++) { + var id = moveIds_1[_i]; + var value = this.map[id]; + var start = type.start(id); + var newStart = start.withTime(toTime); + var newId = type.get(newStart); + if (!this.map[newId]) { + this.map[newId] = value; + delete this.map[id]; + moved++; + } + } + return moved; + }; /** * Sets the value/modification in this map given a day, the value, and the * identifier type. @@ -2446,6 +2494,58 @@ var Schedule_Schedule = (function () { Schedule.prototype.isFullDay = function () { return this.times.length === 0; }; + /** + * Sets whether this schedule is a full day event if it is not already. If + * this schedule is a full day event and `false` is passed to this function + * a single timed event will be added based on `defaultTime`. If this schedule + * has timed events and `true` is passed to make the schedule full day, the + * timed events are removed from this schedule. If the durationUnit is not the + * expected unit based on the new full day flag - the duration is reset to 1 + * and the duration unit is set to the expected unit. + * + * @param fullDay Whether this schedule should represent a full day event or + * timed events. + * @param defaultTime If `fullDay` is `false` and this schedule is currently + * a full day event - this time will be used as the time of the first event. + */ + Schedule.prototype.setFullDay = function (fullDay, defaultTime) { + if (fullDay === void 0) { fullDay = true; } + if (defaultTime === void 0) { defaultTime = '08:00'; } + if (fullDay !== this.isFullDay()) { + if (fullDay) { + this.times = []; + if (this.durationUnit !== 'days' && this.durationUnit !== 'day') { + this.duration = 1; + this.durationUnit = 'days'; + } + } + else { + this.times = [Parse_Parse.time(defaultTime)]; + if (this.durationUnit !== 'hours' && this.durationUnit !== 'hour') { + this.duration = 1; + this.durationUnit = 'hours'; + } + } + } + return this; + }; + /** + * Adjusts the [[Schedule.start]] and [[Schedule.end]] dates specified on this + * schedule if this schedule represents a single event and the `start` and + * `end` are already set or `addSpan` is `true`. + * + * @param addSpan If `true`, the `start` and `end` dates will always be + * adjusted if this schedule is a single event. + */ + Schedule.prototype.adjustDefinedSpan = function (addSpan) { + if (addSpan === void 0) { addSpan = false; } + var single = this.getSingleEventSpan(); + if (single && (addSpan || (this.start && this.end))) { + this.start = single.start.start(); + this.end = single.end.end(); + } + return this; + }; /** * Returns a span of time for a schedule with full day events starting on the * start of the given day with the desired duration in days or weeks. @@ -2743,6 +2843,18 @@ var Schedule_Schedule = (function () { Schedule.prototype.coversTime = function (day) { return !!this.iterateSpans(day, true).first(function (span) { return span.contains(day); }); }; + /** + * Sets the frequency for the given property. This does not update the + * [[Schedule.checks]] array, the [[Schedule.updateChecks]] function needs + * to be called. + * + * @param property The frequency to update. + * @param frequency The new frequency. + */ + Schedule.prototype.setFrequency = function (property, frequency) { + this[property] = Parse_Parse.frequency(frequency, property); + return this; + }; /** * Changes the exclusion status of the event at the given time. By default * this excludes this event - but `false` may be passed to undo an exclusion. @@ -2788,6 +2900,31 @@ var Schedule_Schedule = (function () { } return false; }; + /** + * Moves a time specified in this schedule to the given time, adjusting + * any cancelled event instances, metadata, and any excluded and included + * event instances. + * + * @param fromTime The time to move. + * @param toTime The new time in the schedule. + * @returns `true` if time was moved, otherwise `false`. + */ + Schedule.prototype.moveTime = function (fromTime, toTime) { + var found = false; + for (var i = 0; i < this.times.length && !found; i++) { + if (found = fromTime.matches(this.times[i])) { + this.times.splice(i, 1, toTime); + } + } + if (found) { + this.include.moveTime(fromTime, toTime); + this.exclude.moveTime(fromTime, toTime); + this.cancel.moveTime(fromTime, toTime); + this.meta.moveTime(fromTime, toTime); + this.adjustDefinedSpan(false); + } + return found; + }; /** * Moves the event instance starting at `fromTime` to `toTime` optionally * placing `meta` in the schedules metadata for the new time `toTime`. A move @@ -2837,7 +2974,7 @@ var Schedule_Schedule = (function () { this[prop] = frequency; } if (this.times.length === 1 && takeTime) { - this.times[0] = toTime.asTime(); + this.times = [toTime.asTime()]; } this.updateChecks(); var span = this.getSingleEventSpan(); @@ -3092,7 +3229,6 @@ var Schedule_Schedule = (function () { * @param alwaysDuration If the duration values (`duration` and * `durationUnit`) should always be returned in the input. * @returns The input that describes this schedule. - * @see [[Schedule.getExclusions]] * @see [[Time.format]] */ Schedule.prototype.toInput = function (returnDays, returnTimes, timeFormat, alwaysDuration) { @@ -3128,7 +3264,7 @@ var Schedule_Schedule = (function () { if (cancels.length) out.cancel = cancels; if (hasMeta) - out.meta = this.meta.map; + out.meta = Functions.extend({}, this.meta.map); if (this.dayOfWeek.input) out.dayOfWeek = this.dayOfWeek.input; if (this.dayOfMonth.input) @@ -3431,6 +3567,50 @@ var Time_Time = (function () { } return out; }; + /** + * Determines whether this time is an exact match for the given time. + * + * @param time The given time to test against. + * @returns `true` if the time matches this time, otherwise `false`. + */ + Time.prototype.matches = function (time) { + return this.hour === time.hour && + this.minute === time.minute && + this.second === time.second && + this.millisecond === time.millisecond; + }; + /** + * Determines whether this time has the same hour as the given time. + * + * @param time The given time to test against. + * @returns `true` if the given hour matches this hour, otherwise `false`. + */ + Time.prototype.matchesHour = function (time) { + return this.hour === time.hour; + }; + /** + * Determines whether this time has the same hour and minute as the given time. + * + * @param time The given time to test against. + * @returns `true` if the given hour and minute matches, otherwise `false`. + */ + Time.prototype.matchesMinute = function (time) { + return this.hour === time.hour && + this.minute === time.minute; + }; + /** + * Determines whether this time has the same hour, minute, and second as the + * given time. + * + * @param time The given time to test against. + * @returns `true` if the given hour, minute, and second matches, otherwise + * `false`. + */ + Time.prototype.matchesSecond = function (time) { + return this.hour === time.hour && + this.minute === time.minute && + this.second === time.second; + }; /** * @returns The number of milliseconds from the start of the day until this * time. @@ -3633,7 +3813,7 @@ var Parse_Parse = (function () { }; check.given = true; } - check.input = input; + check.input = Functions.coalesce(input, null); check.property = property; return check; }; @@ -5862,6 +6042,7 @@ var Weekday = (function () { + /** * A class which helps describe [[ScheduleInput]] if it matches a pattern. */ @@ -5882,32 +6063,67 @@ var Pattern_Pattern = (function () { this.rules = rules; } /** - * Applies this pattern to schedule input removing and adding any necessary - * properties from the input to match this pattern - based around the day - * provided. + * Applies this pattern to a [[Schedule]] or [[ScheduleInput]] removing and + * adding any necessary properties from the input to match this pattern - + * based around the day provided. * - * @param input The input to update to match this pattern. + * @param schedule The schedule to update to match this pattern. * @param day The day to base the schedule on. * @returns The reference to the input passed in. */ - Pattern.prototype.apply = function (input, day) { + Pattern.prototype.apply = function (schedule, day) { + if (schedule instanceof Schedule_Schedule) { + this.applyGeneric(day, function (prop, frequency) { return schedule.setFrequency(prop, frequency); }, function (prop) { return schedule.setFrequency(prop); }); + schedule.updateChecks(); + } + else { + this.applyGeneric(day, function (prop, frequency) { return schedule[prop] = frequency; }, function (prop) { return delete schedule[prop]; }); + } + return schedule; + }; + /** + * Applies this pattern to any object provided they implement the + * `setFrequency` and `removeFrequency` functions. + * + * @param day The day to base the schedule on. + * @param setFrequency The function which sets the frequency on the object. + * @param removeFrequency The function to remove a frequency from the object. + */ + Pattern.prototype.applyGeneric = function (day, setFrequency, removeFrequency) { for (var _i = 0, _a = Pattern.PROPS; _i < _a.length; _i++) { var prop = _a[_i]; var rule = this.rules[prop]; // Should have one value if (rule === 1) { - input[prop] = [day[prop]]; + setFrequency(prop, [day[prop]]); } // Can be any of the values in the array if (Functions.isArray(rule)) { - input[prop] = rule; + setFrequency(prop, rule); } // Must not be present if (!Functions.isDefined(rule)) { - delete input[prop]; + removeFrequency(prop); } } - return input; + }; + /** + * Determines whether the given [[Schedule]] or [[ScheduleInput]] matches this + * pattern. Optionally a day can be provided to make sure the day matches the + * schedule and pattern together. + * + * @param schedule The schedule input to test. + * @param exactlyWith A day to further validate against for matching. + * @returns `true` if the schedule was a match to this pattern with the + * day if one was provided, otherwise `false`. + */ + Pattern.prototype.isMatch = function (schedule, exactlyWith) { + if (schedule instanceof Schedule_Schedule) { + return this.isMatchGeneric(function (prop) { return schedule[prop].input; }, exactlyWith); + } + else { + return this.isMatchGeneric(function (prop) { return schedule[prop]; }, exactlyWith); + } }; /** * Determines whether the given input matches this pattern. Optionally a day @@ -5919,12 +6135,12 @@ var Pattern_Pattern = (function () { * @returns `true` if the schedule input was a match to this pattern with the * day if one was provided, otherwise `false`. */ - Pattern.prototype.isMatch = function (input, exactlyWith) { + Pattern.prototype.isMatchGeneric = function (getFrequency, exactlyWith) { var exactly = Functions.isDefined(exactlyWith); for (var _i = 0, _a = Pattern.PROPS; _i < _a.length; _i++) { var prop = _a[_i]; var rule = this.rules[prop]; - var curr = input[prop]; + var curr = getFrequency(prop); // Optional, skip it if (rule === false) { continue; diff --git a/umd/dayspan.js.map b/umd/dayspan.js.map index 7a6b767..6cd12a9 100644 --- a/umd/dayspan.js.map +++ b/umd/dayspan.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 1e1871402b3010cb26a1","webpack:///external {\"commonjs\":\"moment\",\"commonjs2\":\"moment\",\"amd\":\"moment\",\"root\":\"moment\"}","webpack:///./src/Functions.ts","webpack:///./src/Operation.ts","webpack:///./src/Units.ts","webpack:///./src/Constants.ts","webpack:///./src/DaySpan.ts","webpack:///./src/Identifier.ts","webpack:///./src/Suffix.ts","webpack:///./src/Iterator.ts","webpack:///./src/ScheduleModifier.ts","webpack:///./src/Schedule.ts","webpack:///./src/Event.ts","webpack:///./src/Time.ts","webpack:///./src/Parse.ts","webpack:///./src/Day.ts","webpack:///./src/CalendarDay.ts","webpack:///./src/CalendarEvent.ts","webpack:///./src/Calendar.ts","webpack:///./src/Month.ts","webpack:///./src/Weekday.ts","webpack:///./src/Pattern.ts","webpack:///./src/Sort.ts","webpack:///./src/index.ts"],"names":[],"mappings":"AAA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OAAO,CAAC;gBACjB,CAAC;aACF;YAED,MAAM,CAAC,CAAC,CAAC;QACX,CAAC,CAAC;IACJ,CAAC;IAEH,YAAC;AAAD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACzK0B;AACG;AACE;AACR;AACI;AACN;AACI;AAEE;AACC;AACF;AACH;AACI;AACJ;AACE;AACC;AACQ;AACZ;AACE;AACF;AACC;AACE","file":"dayspan.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"moment\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"ds\", [\"moment\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"ds\"] = factory(require(\"moment\"));\n\telse\n\t\troot[\"ds\"] = factory(root[\"moment\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_0__) {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 1e1871402b3010cb26a1","module.exports = __WEBPACK_EXTERNAL_MODULE_0__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external {\"commonjs\":\"moment\",\"commonjs2\":\"moment\",\"amd\":\"moment\",\"root\":\"moment\"}\n// module id = 0\n// module chunks = 0","\n\n/**\n * The class which contains commonly used functions by the library. These\n * functions and variables exist in a class so they may be overridden if\n * desired.\n */\nexport class Functions\n{\n\n /**\n * Determines whether the given input is an array.\n *\n * @param input The variable to test.\n * @returns `true` if the variable is an array, otherwise `false`.\n */\n public static isArray(input: any): boolean\n {\n return input instanceof Array;\n }\n\n /**\n * Determines whether the two arrays given are stricly equivalent. If the\n * arrays are not the same length or contain the same values in the same order\n * then `false` is returned.\n *\n * @param x The first array to test.\n * @param y The second array to test.\n * @returns `true` if they have the same exact values, otherwise `false`.\n */\n public static isArrayEquals(x: any[], y: any[]): boolean\n {\n if (x === y) return true;\n if (x.length !== y.length) return false;\n\n for (let i = 0; i < x.length; i++)\n {\n if (x[ i ] !== y[ i ])\n {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Determines whether the given input is a string.\n *\n * @param input The variable to test.\n * @returns `true` if the variable is a string, otherwise `false`.\n */\n public static isString(input: any): boolean\n {\n return typeof(input) === 'string';\n }\n\n /**\n * Determines whether the given input is a finite number (a number which is\n * not infinite or not the result of a divide-by-zero operation).\n *\n * @param input The variable to test.\n * @returns `true` if the variable is a finite number, otherwise `false`.\n */\n public static isNumber(input: any): boolean\n {\n return isFinite(input);\n }\n\n /**\n * Determines whether the given input is an object and NOT an array.\n *\n * @param input The variable to test.\n * @returns `true` if the variable is a plain object, otherwise `false`.\n */\n public static isObject(input: any): boolean\n {\n return !this.isArray(input) && typeof(input) === 'object';\n }\n\n /**\n * Determines whether the given input is defined.\n *\n * @param input The variable to test.\n * @return `true` if the variable is defined, otherwise `false`.\n */\n public static isDefined(input: any): boolean\n {\n return typeof(input) !== 'undefined';\n }\n\n /**\n * Determines whether the given input is defined and not null.\n *\n * @param input The variable to test.\n * @return `true` if the variable is defined and not null, otherwise `false`.\n */\n public static isValue(input: any): boolean\n {\n return input !== null && typeof(input) !== 'undefined';\n }\n\n /**\n * Determines whether the given input appears to be a valid\n * [[FrequencyValueEvery]].\n *\n * ```typescript\n * Functions.isFrequencyValueEvery({}); // false\n * Functions.isFrequencyValueEvery([]); // false\n * Functions.isFrequencyValueEvery([1]); // false\n * Functions.isFrequencyValueEvery(null); // false\n * Functions.isFrequencyValueEvery({every:2}); // true\n * Functions.isFrequencyValueEvery({offset:1}); // false\n * Functions.isFrequencyValueEvery({every:2, offset:1}); // true\n * ```\n *\n * @param input The variable to test.\n * @returns `true` if the variable appears to be a [[FrequencyValueEvery]],\n * otherwise false.\n */\n public static isFrequencyValueEvery(input: any): boolean\n {\n return this.isObject( input ) && this.isNumber( input.every );\n }\n\n /**\n * Determines whether the given input appears to be a valid\n * [[FrequencyValueOneOf]].\n *\n * ```typescript\n * Functions.isFrequencyValueOneOf({}); // false\n * Functions.isFrequencyValueOneOf([]); // false\n * Functions.isFrequencyValueOneOf([1]); // true\n * Functions.isFrequencyValueOneOf(null); // false\n * ```\n *\n * @param input The variable to test.\n * @returns `true` if the variable appears to be a [[FrequencyValueOneOf]],\n * otherwise false.\n */\n public static isFrequencyValueOneOf(input: any): boolean\n {\n return this.isArray( input ) && input.length > 0;\n }\n\n /**\n * Returns the first argument which is defined.\n *\n * ```typescript\n * Functions.coalesce(3, 4); // 3\n * Functions.coalesce(undefined, 4); // 4\n * Functions.coalesce(null, 4); // null\n * Functions.coalesce(void 0, void 0, 5); // 5\n * ```\n *\n * @param a The first argument to look at.\n * @param b The second argument to look at.\n * @returns The first defined argument.\n * @see [[Functions.isDefined]]\n */\n public static coalesce(a: any, b: any, c?: any): any\n {\n return this.isDefined( a ) ? a : (this.isDefined( b ) ? b : c);\n }\n\n /**\n * Pads the string `x` up to `length` characters with the given `padding`\n * optionally placing the `padding` `before` `x`.\n *\n * ```typescript\n * Functions.pad('hey', 5, '_', false); // 'hey__'\n * Functions.pad('hey', 5, '_', true); // '__hey'\n * Functions.pad('heyman', 5, '_', true); // 'heyman'\n * ```\n *\n * @param x The string to pad.\n * @param length The length to pad to.\n * @param padding The string to pad with.\n * @param before If the padding should go before the string to pad.\n * @returns The padded string if any padding needed be added.\n */\n public static pad(x: string, length: number, padding: string, before: boolean): string\n {\n while (x.length < length)\n {\n before ? x = padding + x : x = x + padding;\n }\n\n return x;\n }\n\n /**\n * Pads the number `x` up to `length` digits where the padding is `0` and it\n * goes before `x`. This function will only return the first `length`\n * characters of the padding string representation of the number but can return\n * an alternative number of `first` characters.\n *\n * ```typescript\n * Functions.padNumber(29, 3); // '029'\n * Functions.padNumber(29, 3, 2); // '02'\n * Functions.padNumber(9573, 3); // '957'\n * ```\n *\n * @param x The number to pad with zeros in the beginning.\n * @param length The number of digits the number should be padded to.\n * @param first The number of digits to return from the start of the string.\n * @returns A padded number.\n */\n public static padNumber(x: number, length: number, first: number = length)\n {\n return this.pad(x + '', length, '0', true).substring( 0, first );\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Functions.ts","\n/**\n * An operation that can be performed on a single number.\n */\nexport enum Op\n{\n /**\n * The number is returned unmodified.\n */\n NONE,\n\n /**\n * The number is rounded down to the nearest whole number.\n */\n FLOOR,\n\n /**\n * The number is rounded up to the nearest whole number.\n */\n CEIL,\n\n /**\n * The number is rounded up or down depending on if the fractional value is\n * greater than or less than 0.5 respectively.\n */\n ROUND,\n\n /**\n * The fractional part of the number is dropped.\n */\n TRUNCATE,\n\n /**\n * The number is rounded up when positive and down when negative. This is\n * effectively ceiling the absolute value where the result preserves the sign.\n */\n UP,\n\n /**\n * The number is rounded down when positive and up when negative. This is\n * effectively floor the absolute value where the result preserves the sign.\n */\n DOWN\n}\n\n\n/**\n * Performs the requested operation on the given number, optionally taking\n * the absolute value of the number before the operation.\n *\n * @param value The number to operate on.\n * @param op The operation to perform.\n * @param absolute If the number should be positive before the operation.\n * @return The operated result, or the original value if its not a valid number.\n */\nexport function operate(value: number, op: Op, absolute: boolean = false)\n{\n if (isFinite(value))\n {\n if (absolute)\n {\n value = Math.abs( value );\n }\n\n switch (op)\n {\n case Op.NONE:\n return value;\n case Op.FLOOR:\n return Math.floor( value );\n case Op.CEIL:\n return Math.ceil( value );\n case Op.ROUND:\n return Math.round( value );\n case Op.TRUNCATE:\n case Op.DOWN:\n return value < 0 ? Math.ceil( value ) : Math.floor( value );\n case Op.UP:\n return value < 0 ? Math.floor( value ) : Math.ceil( value );\n }\n }\n\n return value;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Operation.ts","\n\n/**\n * Units of time that are compromised of 1 or more days for the [[Calendar]] class.\n */\nexport enum Units\n{\n DAY,\n WEEK,\n MONTH,\n YEAR\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Units.ts","\n\n/**\n * A class that stores commonly used values.\n */\nexport class Constants\n{\n\n /**\n * The number of milliseconds in a second.\n */\n public static MILLIS_IN_SECOND: number = 1000;\n\n /**\n * The number of milliseconds in a minute.\n */\n public static MILLIS_IN_MINUTE: number = Constants.MILLIS_IN_SECOND * 60;\n\n /**\n * The number of milliseconds in an hour.\n */\n public static MILLIS_IN_HOUR: number = Constants.MILLIS_IN_MINUTE * 60;\n\n /**\n * The number of milliseconds in a day (not including DST days).\n */\n public static MILLIS_IN_DAY: number = Constants.MILLIS_IN_HOUR * 24;\n\n /**\n * The number of milliseconds in a week (not including ones that include DST).\n */\n public static MILLIS_IN_WEEK: number = Constants.MILLIS_IN_DAY * 7;\n\n\n /**\n * The number of days in a week.\n */\n public static DAYS_IN_WEEK: number = 7;\n\n\n /**\n * The number of months in a year.\n */\n public static MONTHS_IN_YEAR: number = 12;\n\n /**\n * The number of hours in a day (not including DST days).\n */\n public static HOURS_IN_DAY: number = 24;\n\n\n /**\n * The first month of the year.\n */\n public static MONTH_MIN: number = 0;\n\n /**\n * The last month of the year.\n */\n public static MONTH_MAX: number = 11;\n\n /**\n * The first day of a month.\n */\n public static DAY_MIN: number = 1;\n\n /**\n * The last day of the longest month.\n */\n public static DAY_MAX: number = 31;\n\n /**\n * The first hour of the day.\n */\n public static HOUR_MIN: number = 0;\n\n /**\n * The last hour of the day.\n */\n public static HOUR_MAX: number = 23;\n\n /**\n * The first minute of the hour.\n */\n public static MINUTE_MIN: number = 0;\n\n /**\n * The last minute of the hour.\n */\n public static MINUTE_MAX: number = 59;\n\n /**\n * The first second of the minute.\n */\n public static SECOND_MIN: number = 0;\n\n /**\n * The last second of the minute.\n */\n public static SECOND_MAX: number = 59;\n\n /**\n * The first millisecond of the second.\n */\n public static MILLIS_MIN: number = 0;\n\n /**\n * The last millisecond of the second.\n */\n public static MILLIS_MAX: number = 999;\n\n /**\n * The first day of the week.\n */\n public static WEEKDAY_MIN: number = 0;\n\n /**\n * The last day of the week.\n */\n public static WEEKDAY_MAX: number = 6;\n\n\n /**\n * The default duration for an event.\n */\n public static DURATION_DEFAULT: number = 1;\n\n /**\n * The default duration unit for an all day event.\n */\n public static DURATION_DEFAULT_UNIT_ALL: string = 'days';\n\n /**\n * The default duration unit for an event at a given time.\n */\n public static DURATION_DEFAULT_UNIT_TIMES: string = 'hours';\n\n /**\n * Computes the duration unit given its for an all day event.\n *\n * @param all If the event is all day.\n * @return The default unit for the event.\n */\n public static DURATION_DEFAULT_UNIT: (all: boolean) => string =\n all => all ? Constants.DURATION_DEFAULT_UNIT_ALL :\n Constants.DURATION_DEFAULT_UNIT_TIMES;\n\n /**\n * The number of milliseconds for various duration units. These are worse case\n * scenario and do not include DST changes.\n */\n public static DURATION_TO_MILLIS = {\n minute: Constants.MILLIS_IN_MINUTE,\n minutes: Constants.MILLIS_IN_MINUTE,\n hour: Constants.MILLIS_IN_HOUR,\n hours: Constants.MILLIS_IN_HOUR,\n day: Constants.MILLIS_IN_DAY,\n days: Constants.MILLIS_IN_DAY,\n week: Constants.MILLIS_IN_WEEK,\n weeks: Constants.MILLIS_IN_WEEK,\n month: Constants.MILLIS_IN_DAY * Constants.DAY_MAX,\n months: Constants.MILLIS_IN_DAY * Constants.DAY_MAX\n };\n\n /**\n * The maximum estimated number of events per day. This is used to calculate\n * [[CalendarEvent.id]] to give each event a unique ID. If you think you will\n * have more events than this per day, you can enlarge the value.\n */\n public static MAX_EVENTS_PER_DAY: number = 24;\n\n /**\n * The day of the week which determines the first week of the year or month.\n * By default this day is Thursday.\n */\n public static WEEK_OF_MONTH_MINIMUM_WEEKDAY: number = 4;\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Constants.ts","\nimport { Day } from './Day';\nimport { Op } from './Operation';\nimport { Units } from './Units';\nimport { Constants } from './Constants';\n\n\n\n/**\n * The calculated bounds of a DaySpan relative to a given day.\n */\nexport interface DaySpanBounds\n{\n\n /**\n * The top of the span within the rectangle of the given day.\n */\n top: number;\n\n /**\n * The bottom of the span within the rectangle of the givne day.\n */\n bottom: number;\n\n /**\n * The height of the span within the rectangle of the given day. This is\n * equivalent by `bottom - top`.\n */\n height: number;\n\n /**\n * The left of the span within the rectangle of the given day.\n */\n left: number;\n\n /**\n * The right of the span within the rectangle of the given day.\n */\n right: number;\n\n /**\n * The width of the span within the rectangle of the given day. This is\n * equivalent by `right - left`.\n */\n width: number;\n}\n\n/**\n * A class for a range of time between two [[Day]] timestamps.\n */\nexport class DaySpan\n{\n\n\n /**\n * The starting timestamp of the span (inclusive).\n */\n public start: Day;\n\n /**\n * The endind timestamp of the span (inclusive).\n */\n public end: Day;\n\n\n /**\n * Creates a new span of time.\n *\n * @param start The starting timestamp.\n * @param end The ending timestamp.\n */\n public constructor(start: Day, end: Day)\n {\n this.start = start;\n this.end = end;\n }\n\n /**\n * Whether this span starts and ends on the same timestamp.\n */\n public get isPoint(): boolean\n {\n return this.start.time === this.end.time;\n }\n\n /**\n * Determines whether the given timestamp lies between the start and end\n * timestamp.\n *\n * @param day The timestamp to test.\n * @returns True if the day is >= the start and <= the end of this span.\n */\n public contains(day: Day): boolean\n {\n return day.time >= this.start.time && day.time <= this.end.time;\n }\n\n /**\n * Compares the given timestamp to this span. If the timestamp is before this\n * span then `-1` is returned, if the timestamp is after this span then `1`\n * us returned, otherwise `0` is returned when the timestamp is in this span.\n *\n * @param day The timestamp to compare to.\n * @returns `-1`, `0`, or `1` depending on the given timestamp relative to\n * this span.\n */\n public compareTo(day: Day): number\n {\n return day.time < this.start.time ? -1 : (day.time > this.end.time ? 1 : 0);\n }\n\n /**\n * Determines whether the given timestamp is between the start and end\n * timestamp or lies on the same day as the start or end timestamp.\n *\n * @param day The timestamp to test.\n * @see [[Day.sameDay]]\n */\n public matchesDay(day: Day): boolean\n {\n return this.contains( day ) || day.sameDay( this.start ) || day.sameDay( this.end );\n }\n\n /**\n * Determines whether the given timestamp is between the start and end\n * timestamp or lies on the same week as the start or end timestamp.\n *\n * @param day The timestamp to test.\n * @see [[Day.sameWeek]]\n */\n public matchesWeek(day: Day): boolean\n {\n return this.contains( day ) || day.sameWeek( this.start ) || day.sameWeek( this.end );\n }\n\n /**\n * Determines whether the given timestamp is between the start and end\n * timestamp or lies on the same month as the start or end timestamp.\n *\n * @param day The timestamp to test.\n * @see [[Day.sameMonth]]\n */\n public matchesMonth(day: Day): boolean\n {\n return this.contains( day ) || day.sameMonth( this.start ) || day.sameMonth( this.end );\n }\n\n /**\n * Determines whether the given timestamp is between the start and end\n * timestamp or lies on the same year as the start or end timestamp.\n *\n * @param day The timestamp to test.\n * @see [[Day.sameYear]]\n */\n public matchesYear(day: Day): boolean\n {\n return this.contains( day ) || day.sameYear( this.start ) || day.sameYear( this.end );\n }\n\n\n /**\n * Calculates the number of milliseconds between the start and end timestamp.\n *\n * @param op The operation to perform on the result.\n * @param absolute Whether the result should always be positive.\n * @returns The time between the start and end timestamp.\n * @see [[Day.millisBetween]]\n */\n public millis(op: Op = Op.DOWN, absolute: boolean = true): number\n {\n return this.start.millisBetween(this.end, op, absolute);\n }\n\n /**\n * Calculates the number of seconds between the start and end timestamp.\n *\n * @param op The operation to perform on the result.\n * @param absolute Whether the result should always be positive.\n * @returns The time between the start and end timestamp.\n * @see [[Day.secondsBetween]]\n */\n public seconds(op: Op = Op.DOWN, absolute: boolean = true): number\n {\n return this.start.secondsBetween(this.end, op, absolute);\n }\n\n /**\n * Calculates the number of minutes between the start and end timestamp.\n *\n * @param op The operation to perform on the result.\n * @param absolute Whether the result should always be positive.\n * @returns The time between the start and end timestamp.\n * @see [[Day.minutesBetween]]\n */\n public minutes(op: Op = Op.DOWN, absolute: boolean = true): number\n {\n return this.start.minutesBetween(this.end, op, absolute);\n }\n\n /**\n * Calculates the number of hours between the start and end timestamp.\n *\n * @param op The operation to perform on the result.\n * @param absolute Whether the result should always be positive.\n * @returns The time between the start and end timestamp.\n * @see [[Day.hoursBetween]]\n */\n public hours(op: Op = Op.DOWN, absolute: boolean = true): number\n {\n return this.start.hoursBetween(this.end, op, absolute);\n }\n\n /**\n * Calculates the number of days between the start and end timestamp.\n *\n * @param op The operation to perform on the result.\n * @param absolute Whether the result should always be positive.\n * @returns The time between the start and end timestamp.\n * @see [[Day.daysBetween]]\n */\n public days(op: Op = Op.DOWN, absolute: boolean = true): number\n {\n return this.start.daysBetween(this.end, op, absolute);\n }\n\n /**\n * Calculates the number of weeks between the start and end timestamp.\n *\n * @param op The operation to perform on the result.\n * @param absolute Whether the result should always be positive.\n * @returns The time between the start and end timestamp.\n * @see [[Day.weeksBetween]]\n */\n public weeks(op: Op = Op.DOWN, absolute: boolean = true): number\n {\n return this.start.weeksBetween(this.end, op, absolute);\n }\n\n /**\n * Calculates the number of months between the start and end timestamp.\n *\n * @param op The operation to perform on the result.\n * @param absolute Whether the result should always be positive.\n * @returns The time between the start and end timestamp.\n * @see [[Day.monthsBetween]]\n */\n public months(op: Op = Op.DOWN, absolute: boolean = true): number\n {\n return this.start.monthsBetween(this.end, op, absolute);\n }\n\n /**\n * Calculates the number of years between the start and end timestamp.\n *\n * @param op The operation to perform on the result.\n * @param absolute Whether the result should always be positive.\n * @returns The time between the start and end timestamp.\n * @see [[Day.yearsBetween]]\n */\n public years(op: Op = Op.DOWN, absolute: boolean = true): number\n {\n return this.start.yearsBetween(this.end, op, absolute);\n }\n\n /**\n * Returns a delta value between 0 and 1 which represents where the\n * [[DaySpan.start]] is relative to the given day. The delta value would\n * be less than 0 if the start of the event is before the given day.\n *\n * @param relativeTo The day to find the start delta relative to.\n * @return A number between 0 and 1 if the start of this span is in the\n * 24-hour period starting at the given timestamp, otherwise the value\n * returned may be less than 0 or greater than 1.\n */\n public startDelta(relativeTo: Day): number\n {\n return (this.start.time - relativeTo.time) / Constants.MILLIS_IN_DAY;\n }\n\n /**\n * Returns a delta value between 0 and 1 which represents where the\n * [[DaySpan.end]] is relative to the given day. The delta value would\n * be greater than 1 if the end of the event is after the given day.\n *\n * @param relativeTo The day to find the end delta relative to.\n * @return A number between 0 and 1 if the end of this span is in the\n * 24-hour period starting at the given timestamp, otherwise the value\n * returned may be less than 0 or greater than 1.\n */\n public endDelta(relativeTo: Day): number\n {\n return (this.end.time - relativeTo.time) / Constants.MILLIS_IN_DAY;\n }\n\n /**\n * Calculates the bounds for span event if it were placed in a rectangle which\n * represents a day (24 hour period). By default the returned values are\n * between 0 and 1 and can be scaled by the proper rectangle dimensions or the\n * rectangle dimensions can be passed to this function.\n *\n * @param relativeTo The day to find the bounds relative to. If this is not the\n * start of the day the returned bounds is relative to the given time.\n * @param dayHeight The height of the rectangle of the day.\n * @param dayWidth The width of the rectangle of the day.\n * @param columnOffset The offset in the rectangle of the day to adjust this\n * span by. This also reduces the width of the returned bounds to keep the\n * bounds in the rectangle of the day.\n * @param clip `true` if the bounds should stay in the day rectangle, `false`\n * and the bounds may go outside the rectangle of the day for multi-day\n * spans.\n * @param offsetX How much to translate the left & right properties by.\n * @param offsetY How much to translate the top & bottom properties by.\n * @returns The calculated bounds for this span.\n */\n public getBounds(relativeTo: Day, dayHeight: number = 1, dayWidth: number = 1, columnOffset: number = 0, clip: boolean = true, offsetX: number = 0, offsetY: number = 0): DaySpanBounds\n {\n let startRaw: number = this.startDelta( relativeTo );\n let endRaw: number = this.endDelta( relativeTo );\n\n let start: number = clip ? Math.max(0, startRaw) : startRaw;\n let end: number = clip ? Math.min(1, endRaw) : endRaw;\n\n let left: number = columnOffset;\n let right: number = dayWidth - left;\n\n let top: number = start * dayHeight;\n let bottom: number = end * dayHeight;\n\n return {\n top: top + offsetY,\n bottom: bottom + offsetY,\n height: bottom - top,\n left: left + offsetX,\n right: right + offsetX,\n width: right\n };\n }\n\n /**\n * Summarizes this span given an approximate unit of time and a few other\n * options. If the start and end are on the same unit, a single value will\n * be returned. Otherwise a start and end will be returned with a `delimiter`.\n *\n * @param type The unit of time this span is for.\n * @param dayOfWeek When `true` the weekday of the start and end are included.\n * @param short When `true` the short form of weekdays and months will be used.\n * @param repeat When `true` the year will be repeated on the start and end\n * timestamp even if they are the same year.\n * @param contextual When `true` the year will be hidden if it's the current\n * year.\n * @param delimiter The string to separate the start and end timestamps with.\n * @returns The summary of this span.\n */\n public summary(type: Units, dayOfWeek: boolean = true, short: boolean = false, repeat: boolean = false, contextual: boolean = true, delimiter: string = ' - '): string\n {\n let formats = DaySpan.SUMMARY_FORMATS[ type ];\n let today: Day = Day.today();\n let showStartYear: boolean = !contextual || !this.start.sameYear( today );\n let showEndYear: boolean = !contextual || !this.end.sameYear( today );\n let start: string = this.start.format( formats(short, dayOfWeek, showStartYear) );\n let end: string = this.end.format( formats(short, dayOfWeek, showEndYear) );\n let summary: string = start;\n\n if (start !== end)\n {\n if (!repeat)\n {\n summary = this.start.format( formats(short, dayOfWeek, !this.start.sameYear(this.end)) );\n }\n\n summary += delimiter;\n summary += end;\n }\n else\n {\n summary = start;\n }\n\n return summary;\n }\n\n /**\n * Determines whether the gven span intersects with this span.\n *\n * @param span The span to test.\n * @returns `true` if the spans intersect, otherwise `false`.\n */\n public intersects(span: DaySpan): boolean\n {\n return !(\n this.end.time < span.start.time ||\n this.start.time > span.end.time\n );\n }\n\n /**\n * Calculates the intersection between this span and the given span. If there\n * is no intersection between the two spans then `null` is returned.\n *\n * @param span The span to calculate the intersection with.\n * @returns The intersection or `null` if none exists.\n */\n public intersection(span: DaySpan): DaySpan\n {\n let start: Day = this.start.max( span.start );\n let end: Day = this.end.min( span.end );\n\n return start.isAfter( end ) ? null : new DaySpan(start, end);\n }\n\n /**\n * Calculates the union between this span and the given span.\n *\n * @param span The span to calculate the union with.\n * @returns The union of the two spans.\n */\n public union(span: DaySpan): DaySpan\n {\n let start: Day = this.start.min( span.start );\n let end: Day = this.end.max( span.end );\n\n return new DaySpan(start, end);\n }\n\n /**\n * Returns a point [[DaySpan]] with the same start and end timestamp.\n *\n * @param day The timestamp which will be the start and end.\n * @returns The new instance.\n * @see [[DaySpan.isPoint]]\n */\n public static point(day: Day): DaySpan\n {\n return new DaySpan( day, day );\n }\n\n\n /**\n * Formatting functions which assist the [[DaySpan.summary]] function.\n */\n public static SUMMARY_FORMATS =\n {\n [Units.DAY]: (short: boolean, dayOfWeek: boolean, year: boolean) => {\n return (dayOfWeek ? (short ? 'ddd, ' : 'dddd, ') : '') + (short ? 'MMM ' : 'MMMM ') + 'Do' + (year ? ' YYYY' : '');\n },\n [Units.WEEK]: (short: boolean, dayOfWeek: boolean, year: boolean) => {\n return (dayOfWeek ? (short ? 'ddd, ' : 'dddd, ') : '') + (short ? 'MMM ' : 'MMMM ') + 'Do' + (year ? ' YYYY' : '');\n },\n [Units.MONTH]: (short: boolean, dayOfWeek: boolean, year: boolean) => {\n return (short ? 'MMM' : 'MMMM') + (year ? ' YYYY' : '');\n },\n [Units.YEAR]: (short: boolean, dayOfWeek: boolean, year: boolean) => {\n return (year ? 'YYYY' : '');\n }\n };\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/DaySpan.ts","\nimport { Functions as fn } from './Functions';\nimport { Day } from './Day';\nimport { DaySpan } from './DaySpan';\n\n\n/**\n * The type for identifiers. Most of the time an identifier can be stored as a\n * number because the 4 digit year is first. However when the year is below\n * 1000 a string will be used with zero padding. Storing identifiers as numbers\n * enable very quick comparisons and using strings or numbers allows the\n * identifier to be used as a key to a map.\n */\nexport type IdentifierInput = number | string;\n\n/**\n * The possible properties which can be pulled from an identifier.\n */\nexport interface IdentifierObject\n{\n /**\n * The year pulled from an identifier (0-9999).\n */\n year?: number;\n /**\n * The quarter of the year pulled from an identifier (1-4)\n */\n quarter?: number;\n /**\n * The month of the year pulled from an identifier (0-11)\n */\n month?: number;\n /**\n * The week of the year pulled from an identifier (1-52)\n */\n week?: number;\n /**\n * The day of the month pulled from an identifier (1-31)\n */\n day?: number;\n /**\n * The hour of the day pulled from an identifier (0-23)\n */\n hour?: number;\n /**\n * The minute of the hour pulled from an identifier (0-59)\n */\n minute?: number;\n}\n\n\n/**\n * A class for detecting, parsing, and building identifiers to and from days.\n *\n * An identifier is a simple value which represents a span of time. It may\n * represent an entire year, a quarter (3 months) of a year, a week of a year,\n * a month in a year, a specific day of a month of a year, or a specific hour,\n * minute, day, and month of a year.\n *\n * For example:\n * - `2018`: The year 2018\n * - `201801`: January 2018\n * - `2014023`: The 23rd week of 2014\n * - `20170311`: March 11th, 2017\n * - `201406151651`: June 15th 2016 at 4:51 pm\n * - `'0525'`: Year 525 of the first age, Elrond and Elros are born\n */\nexport abstract class Identifier\n{\n\n /**\n * Determines whether the given identifier is this type.\n *\n * @param id The identifier to test.\n * @returns `true` if the identifier is this type, otherwise `false`.\n */\n public is(id: IdentifierInput): boolean\n {\n return (id + '').length === this.getLength();\n }\n\n /**\n * Returns the identifier of this type for the given day,\n *\n * @param day The day to get the identifier of.\n * @returns The identifier for the day of this type.\n */\n abstract get(day: Day): IdentifierInput;\n\n /**\n * Converts the given identifier which has passed [[Identifier.is]] to an\n * object with properties pulled from the identifier.\n *\n * @param id The identifier to parse.\n * @returns The object with properties parsed from the identifer.\n */\n abstract object(id: IdentifierInput): IdentifierObject;\n\n /**\n * Returns the start of the time span the identifier represents.\n *\n * @param id The identifier to convert to a start day.\n * @returns The start of the time span the identifier represents.\n */\n abstract start(id: IdentifierInput): Day;\n\n /**\n * Returns the span of time the identifier represents.\n *\n * @param id The identifier to convert to a span.\n * @param endInclusive When `true` the end of the span will be the very last\n * millisecond that represents the timespan, otherwise `false` the end\n * will be the start of the very next span.\n * @returns\n */\n abstract span(id: IdentifierInput, endInclusive: boolean): DaySpan;\n\n /**\n * Determines if the day matches the given identifier.\n *\n * @param day The day to test.\n * @param id The identifier to compare to.\n * @returns `true` if the day exists in the time span represented by the\n * identifier, otherwise `false`.\n */\n abstract matches(day: Day, id: IdentifierInput): boolean;\n\n /**\n * Describes the given identifier as a human friendly string.\n *\n * @param id The identifier to describe.\n * @param short If the description should use shorter language or longer.\n * @returns The human friendly string that describes the identifier.\n */\n abstract describe(id: IdentifierInput, short: boolean): string;\n\n /**\n * The scales for all the different values stored in an identifier.\n */\n protected abstract getScales(): number[];\n\n /**\n * The length of the identifier of this type in digits.\n */\n protected abstract getLength(): number;\n\n /**\n * Computes the identifier given values taken from a [[Day]].\n *\n * @param values The values to compute.\n * @returns The computed identifier.\n */\n protected compute(...values: number[]): IdentifierInput\n {\n const scales: number[] = this.getScales();\n let total: number = 0;\n\n for (let i = 0; i < values.length; i++)\n {\n total += values[ i ] * scales[ i ];\n }\n\n return this.is( total ) ? total : fn.padNumber(total, this.getLength());\n }\n\n /**\n * Decomputes the given identifier and returns values which describe a span\n * of time.\n *\n * @param id The identifier to decompute.\n * @returns The original values which computed the identifier.\n */\n protected decompute(id: IdentifierInput): number[]\n {\n const scales: number[] = this.getScales();\n let total: number = fn.isNumber(id) ? id : parseInt(id);\n let values: number[] = [];\n\n for (let i = 0; i < scales.length - 1; i++)\n {\n let curr: number = scales[ i + 0 ];\n let next: number = scales[ i + 1 ];\n let mod: number = next / curr;\n let value: number = total % mod;\n\n values.push( value );\n total = Math.floor( total / mod );\n }\n\n values.push( total );\n\n return values;\n }\n\n /**\n * The identifier type for an hour of time on a specific day.\n */\n public static Time: Identifier = null;\n\n /**\n * The identifier type for a specific day.\n */\n public static Day: Identifier = null;\n\n /**\n * The identifier type for a specific week of a year.\n */\n public static Week: Identifier = null;\n\n /**\n * The identifier type for a specific month of a year.\n */\n public static Month: Identifier = null;\n\n /**\n * The identifier type for a specific quarter of a year.\n */\n public static Quarter: Identifier = null;\n\n /**\n * The identifier type for a specific year.\n */\n public static Year: Identifier = null;\n\n\n /**\n * Finds which identifier type matches the given identifier, if any.\n *\n * @param id The identifier to find the type of.\n * @returns The found identifier type, otherwise `null` if none exists.\n */\n public static find(id: IdentifierInput): Identifier\n {\n if (this.Time.is(id)) return this.Time;\n if (this.Day.is(id)) return this.Day;\n if (this.Week.is(id)) return this.Week;\n if (this.Month.is(id)) return this.Month;\n if (this.Year.is(id)) return this.Year;\n\n return null;\n }\n\n /**\n * Determines whether the given time span `outer` contains the time span\n * `inner`.\n *\n * @param outer The potentially larger time span `inner` must be contained in.\n * @param inner The time span to test is contained inside `outer`.\n * @returns `true` if `inner` is equal to or contained in `outer`, otherwise\n * `false`.\n */\n public static contains(outer: IdentifierInput, inner: IdentifierInput): boolean\n {\n let outerString: string = outer + '';\n\n return (inner + '').substring( 0, outerString.length ) === outerString;\n }\n\n}\n\n// YYYYMMddHHmm (12)\nclass IdentifierTime extends Identifier\n{\n\n public static DESCRIBE_FORMAT_LONG: string = 'LLL';\n public static DESCRIBE_FORMAT_SHORT: string = 'lll';\n\n private static SCALES: number[] = [\n 1 /* minute */,\n 100 /* hour */,\n 10000 /* day */,\n 1000000 /* month */,\n 100000000 /* year */];\n private static LENGTH: number = 12;\n\n protected getScales(): number[]\n {\n return IdentifierTime.SCALES;\n }\n\n protected getLength(): number\n {\n return IdentifierTime.LENGTH;\n }\n\n public get(day: Day): IdentifierInput\n {\n return this.compute(day.minute, day.hour, day.dayOfMonth, day.month + 1, day.year);\n }\n\n public object(id: IdentifierInput): IdentifierObject\n {\n let values: number[] = this.decompute(id);\n\n return {\n minute: values[0],\n hour: values[1],\n day: values[2],\n month: values[3] - 1,\n year: values[4]\n };\n }\n\n public start(id: IdentifierInput): Day\n {\n let obj: IdentifierObject = this.object(id);\n let start: Day = Day.build( obj.year, obj.month, obj.day, obj.hour, obj.minute );\n\n return start;\n }\n\n public span(id: IdentifierInput, endInclusive: boolean = false): DaySpan\n {\n let start: Day = this.start( id );\n let end: Day = start.endOfHour( endInclusive );\n\n return new DaySpan(start, end);\n }\n\n public describe(id: IdentifierInput, short: boolean = false): string\n {\n let start: Day = this.start( id );\n let format: string = short ? IdentifierTime.DESCRIBE_FORMAT_SHORT : IdentifierTime.DESCRIBE_FORMAT_LONG;\n\n return start.format( format );\n }\n\n public matches(day: Day, id: IdentifierInput): boolean\n {\n return day.timeIdentifier === id;\n /*\n let obj: IdentifierObject = this.object(id);\n\n return (\n day.year === obj.year &&\n day.month === obj.month &&\n day.dayOfMonth === obj.day &&\n day.hour === obj.hour &&\n day.minute === obj.minute\n );\n */\n }\n\n}\n\n// YYYYMMdd (8)\nclass IdentifierDay extends Identifier\n{\n\n public static DESCRIBE_FORMAT_LONG: string = 'LL';\n public static DESCRIBE_FORMAT_SHORT: string = 'll';\n\n private static SCALES: number[] = [\n 1 /* day */,\n 100 /* month */,\n 10000 /* year */];\n private static LENGTH: number = 8;\n\n protected getScales(): number[]\n {\n return IdentifierDay.SCALES;\n }\n\n protected getLength(): number\n {\n return IdentifierDay.LENGTH;\n }\n\n public get(day: Day): IdentifierInput\n {\n return this.compute(day.dayOfMonth, day.month + 1, day.year);\n }\n\n public object(id: IdentifierInput): IdentifierObject\n {\n let values: number[] = this.decompute(id);\n\n return {\n day: values[0],\n month: values[1] - 1,\n year: values[2]\n };\n }\n\n public start(id: IdentifierInput): Day\n {\n let obj: IdentifierObject = this.object(id);\n let start: Day = Day.build( obj.year, obj.month, obj.day );\n\n return start;\n }\n\n public span(id: IdentifierInput, endInclusive: boolean = false): DaySpan\n {\n let start: Day = this.start( id );\n let end: Day = start.end( endInclusive );\n\n return new DaySpan(start, end);\n }\n\n public describe(id: IdentifierInput, short: boolean = false): string\n {\n let start: Day = this.start( id );\n let format: string = short ? IdentifierDay.DESCRIBE_FORMAT_SHORT : IdentifierDay.DESCRIBE_FORMAT_LONG;\n\n return start.format( format );\n }\n\n public matches(day: Day, id: IdentifierInput): boolean\n {\n return day.dayIdentifier === id;\n /*\n let obj: IdentifierObject = this.object(id);\n\n return (\n day.year === obj.year &&\n day.month === obj.month &&\n day.dayOfMonth === obj.day\n );\n */\n }\n\n}\n\n// YYYY0ww (7)\nclass IdentifierWeek extends Identifier\n{\n\n public static DESCRIBE_FORMAT_LONG: string = 'wo [week of] YYYY';\n public static DESCRIBE_FORMAT_SHORT: string = 'wo [week of] YYYY';\n\n private static SCALES: number[] = [\n 1 /* week */,\n 1000 /* year */];\n private static LENGTH: number = 7;\n\n protected getScales(): number[]\n {\n return IdentifierWeek.SCALES;\n }\n\n protected getLength(): number\n {\n return IdentifierWeek.LENGTH;\n }\n\n public get(day: Day): IdentifierInput\n {\n return this.compute(day.week, day.year);\n }\n\n public object(id: IdentifierInput): IdentifierObject\n {\n let values: number[] = this.decompute(id);\n\n return {\n week: values[0],\n year: values[1]\n };\n }\n\n public start(id: IdentifierInput): Day\n {\n let obj: IdentifierObject = this.object(id);\n let start: Day = Day.build( obj.year, 0 ).withWeek( obj.week );\n\n return start;\n }\n\n public span(id: IdentifierInput, endInclusive: boolean = false): DaySpan\n {\n let start: Day = this.start( id );\n let end: Day = start.endOfWeek( endInclusive );\n\n return new DaySpan(start, end);\n }\n\n public describe(id: IdentifierInput, short: boolean = false): string\n {\n let start: Day = this.start( id );\n let format: string = short ? IdentifierWeek.DESCRIBE_FORMAT_SHORT : IdentifierWeek.DESCRIBE_FORMAT_LONG;\n\n return start.format( format );\n }\n\n public matches(day: Day, id: IdentifierInput): boolean\n {\n return day.weekIdentifier === id;\n /*\n let obj: IdentifierObject = this.object(id);\n\n return (\n day.year === obj.year &&\n day.week === obj.week\n );\n */\n }\n\n}\n\n// YYYYMM (6)\nclass IdentifierMonth extends Identifier\n{\n\n public static DESCRIBE_FORMAT_LONG: string = 'MMMM YYYY';\n public static DESCRIBE_FORMAT_SHORT: string = 'MMM YYYY';\n\n private static SCALES: number[] = [\n 1 /* month */,\n 100 /* year */];\n private static LENGTH: number = 6;\n\n protected getScales(): number[]\n {\n return IdentifierMonth.SCALES;\n }\n\n protected getLength(): number\n {\n return IdentifierMonth.LENGTH;\n }\n\n public get(day: Day): IdentifierInput\n {\n return this.compute(day.month + 1, day.year);\n }\n\n public object(id: IdentifierInput): IdentifierObject\n {\n let values: number[] = this.decompute(id);\n\n return {\n month: values[0] - 1,\n year: values[1]\n };\n }\n\n public start(id: IdentifierInput): Day\n {\n let obj: IdentifierObject = this.object(id);\n let start: Day = Day.build( obj.year, obj.month );\n\n return start;\n }\n\n public span(id: IdentifierInput, endInclusive: boolean = false): DaySpan\n {\n let start: Day = this.start( id );\n let end: Day = start.endOfMonth( endInclusive );\n\n return new DaySpan(start, end);\n }\n\n public describe(id: IdentifierInput, short: boolean = false): string\n {\n let start: Day = this.start( id );\n let format: string = short ? IdentifierMonth.DESCRIBE_FORMAT_SHORT : IdentifierMonth.DESCRIBE_FORMAT_LONG;\n\n return start.format( format );\n }\n\n public matches(day: Day, id: IdentifierInput): boolean\n {\n return day.monthIdentifier === id;\n /*\n let obj: IdentifierObject = this.object(id);\n\n return (\n day.year === obj.year &&\n day.month === obj.month\n );\n */\n }\n\n}\n\n// YYYYQ (5)\nclass IdentifierQuarter extends Identifier\n{\n\n public static DESCRIBE_FORMAT_LONG: string = 'Qo [quarter] YYYY';\n public static DESCRIBE_FORMAT_SHORT: string = 'Qo [quarter] YYYY';\n\n private static SCALES: number[] = [\n 1 /* quarter */,\n 10 /* year */];\n private static LENGTH: number = 5;\n\n protected getScales(): number[]\n {\n return IdentifierQuarter.SCALES;\n }\n\n protected getLength(): number\n {\n return IdentifierQuarter.LENGTH;\n }\n\n public get(day: Day): IdentifierInput\n {\n return this.compute(day.quarter, day.year);\n }\n\n public object(id: IdentifierInput): IdentifierObject\n {\n let values: number[] = this.decompute(id);\n\n return {\n quarter: values[0],\n year: values[1]\n };\n }\n\n public start(id: IdentifierInput): Day\n {\n let obj: IdentifierObject = this.object(id);\n let start: Day = Day.build( obj.year, (obj.quarter - 1) * 3 );\n\n return start;\n }\n\n public span(id: IdentifierInput, endInclusive: boolean = false): DaySpan\n {\n let start: Day = this.start( id );\n let end: Day = start.relativeMonths( 3 ).endOfMonth( endInclusive );\n\n return new DaySpan(start, end);\n }\n\n public describe(id: IdentifierInput, short: boolean = false): string\n {\n let start: Day = this.start( id );\n let format: string = short ? IdentifierQuarter.DESCRIBE_FORMAT_SHORT : IdentifierQuarter.DESCRIBE_FORMAT_LONG;\n\n return start.format( format );\n }\n\n public matches(day: Day, id: IdentifierInput): boolean\n {\n return day.quarterIdentifier === id;\n /*\n let obj: IdentifierObject = this.object(id);\n\n return (\n day.year === obj.year &&\n day.quarter === obj.quarter\n );\n */\n }\n\n}\n\n// YYYY (4)\nclass IdentifierYear extends Identifier\n{\n\n public static DESCRIBE_FORMAT_LONG: string = 'YYYY';\n public static DESCRIBE_FORMAT_SHORT: string = 'YYYY';\n\n private static SCALES: number[] = [\n 1 /* year */];\n private static LENGTH: number = 4;\n\n protected getScales(): number[]\n {\n return IdentifierYear.SCALES;\n }\n\n protected getLength(): number\n {\n return IdentifierYear.LENGTH;\n }\n\n public get(day: Day): IdentifierInput\n {\n return this.compute(day.year);\n }\n\n public object(id: IdentifierInput): IdentifierObject\n {\n let values: number[] = this.decompute(id);\n\n return {\n year: values[0]\n };\n }\n\n public start(id: IdentifierInput): Day\n {\n let obj: IdentifierObject = this.object(id);\n let start: Day = Day.build( obj.year, 0 );\n\n return start;\n }\n\n public span(id: IdentifierInput, endInclusive: boolean = false): DaySpan\n {\n let start: Day = this.start( id );\n let end: Day = start.endOfYear( endInclusive );\n\n return new DaySpan(start, end);\n }\n\n public describe(id: IdentifierInput, short: boolean = false): string\n {\n let start: Day = this.start( id );\n let format: string = short ? IdentifierYear.DESCRIBE_FORMAT_SHORT : IdentifierYear.DESCRIBE_FORMAT_LONG;\n\n return start.format( format );\n }\n\n public matches(day: Day, id: IdentifierInput): boolean\n {\n return day.year === id;\n /*\n let obj: IdentifierObject = this.object(id);\n\n return (\n day.year === obj.year\n );\n */\n }\n\n}\n\n// Sets the Identifier types\nIdentifier.Time = new IdentifierTime();\nIdentifier.Day = new IdentifierDay();\nIdentifier.Week = new IdentifierWeek();\nIdentifier.Month = new IdentifierMonth();\nIdentifier.Quarter = new IdentifierQuarter();\nIdentifier.Year = new IdentifierYear();\n\n\n\n// WEBPACK FOOTER //\n// ./src/Identifier.ts","\n/**\n * A class which takes a number and determines the suffix for that number.\n *\n * ```typescript\n * Suffix.CACHE[ 2 ]; // 2nd\n * Suffix.determine( 3 ); // rd\n * Suffix.get( 4 ); // th\n * Suffix.get( 4, true ); // 4th\n * ```\n */\nexport class Suffix\n{\n\n /**\n * The array of suffixes used.\n */\n public static MAP: string[] = [\n 'th', 'st', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th'\n ];\n\n /**\n * An internal cache of [[Suffix._CACHE_SIZE]] suffixes.\n */\n private static _CACHE: string[];\n\n /**\n * The number of values to store in the cache (inclusive).\n */\n private static _CACHE_SIZE: number = 366;\n\n\n /**\n * The cache of number & suffix pairs.\n */\n public static get CACHE(): string[]\n {\n if (!this._CACHE)\n {\n this._CACHE = [];\n\n for (let i = 0; i <= this._CACHE_SIZE; i++)\n {\n this._CACHE[ i ] = this.get( i, true );\n }\n }\n\n return this._CACHE;\n }\n\n /**\n * Determines the suffix for a given number.\n *\n * @param value The number to find the suffix for.\n * @returns The suffix determined.\n */\n public static determine(value: number): string\n {\n return value >= 11 && value <= 13 ? 'th' : this.MAP[ value % this.MAP.length ];\n }\n\n /**\n * Gets the suffix for a number and optionally appends it before the suffix.\n *\n * @param value The number to get the suffix for.\n * @param prepend When `true` the value is prepended to the suffix.\n * @returns The suffix or value & suffix pair determined.\n */\n public static get(value: number, prepend: boolean = false): string\n {\n let suffix: string = this.determine(value);\n\n return prepend ? value + suffix : suffix;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Suffix.ts","\nimport { Functions as fn } from './Functions';\n\n\n/**\n * The callback which is invoked for each item in the Iterator. The callback\n * can call [[Iterator.stop]] at anytime to stop iteration.\n *\n * @param item The item found in the iterator.\n * @param iterator The iterator with the item.\n * @returns The result of the callback.\n */\nexport type IteratorCallback = (item: T, iterator: Iterator) => R;\n\n/**\n * An [[Iterator]] source which handles iterating over items and calls\n * `callback` for each item, checking [[Iterator.iterating]] after each\n * invokation to stop iteration as early as possible.\n *\n * @param callback The function to invoke for each item.\n * @param iterator The iterator to check for early exists.\n */\nexport type IteratorSource = (iterator: Iterator) => any;\n\n/**\n * A filter to apply duration iteration to only look at certain items when this\n * function returns `true`.\n *\n * @param item The item being iterated.\n * @returns `true` if the item should be iterated, otherwise `false`.\n */\nexport type IteratorFilter = (item: T) => boolean;\n\n/**\n * An action to perform on the source as instructed by the iterator.\n */\nexport enum IteratorAction\n{\n /**\n * Continue iteration.\n */\n Continue,\n\n /**\n * Stop iteration.\n */\n Stop,\n\n /**\n * Remove the current item if possible, and continue iteration.\n */\n Remove\n}\n\n/**\n * A class that allows an iteratable source to be iterated any number of times\n * by providing the following functionality:\n *\n * - [[Iterator.isEmpty]]: Determines whether the source contains any items.\n * - [[Iterator.first]]: Gets the first item in the source.\n * - [[Iterator.count]]: Counds the number of items in the source.\n * - [[Iterator.list]]: Builds a list of the items in the source.\n * - [[Iterator.object]]: Builds an object of the items in the source.\n * - [[Iterator.reduce]]: Reduces the items in the source down to a single value.\n * - [[Iterator.purge]]: Removes items from the source which meet some criteria.\n * - [[Iterator.filter]]: Returns a subset of items that meet some criteria by\n * returning a new Iterator.\n * - [[Iterator.map]]: Maps each item in the source to another item by returning\n * a new Iterator.\n * - [[Iterator.iterate]]: Invokes a function for each item in the source.\n *\n * The following static functions exist to help iterate simple sources:\n *\n * - [[Iterator.forArray]]: Iterates an array, optionally reverse\n * - [[Iterator.forObject]]: Iterates the properties of an object, optionally\n * just the properties explicitly set on the object.\n *\n * ```typescript\n * let iter = object.iterateThings();\n * iter.isEmpty(); // no items?\n * iter.isEmpty(d => d.flag); // no items that meet some criteria?\n * iter.count(); // number of items\n * iter.count(d => d.flag); // number of items that meet some criteria\n * iter.first(); // first item\n * iter.first(d => d.flag); // first item that meets some criteria\n * iter.list(); // get all items as array\n * iter.list(myArray); // add all items to given array\n * iter.list([], d => d.flag); // get all items as array that meet some criteria\n * iter.object(d => d.id); // get all items as an object keyed by a value (ex: id)\n * iter.object(d => d.id, {},\n * d => d.flag); // get all items as an object keyed by a value where the item meets some criteria (ex: key id if flag is truthy)\n * iter.purge(d => d.flag); // remove all items from source that meet some criteria\n * iter.filter(d => d.flag); // returns an iterator which iterates a subset of items which meet some criteria\n * iter.reduce(0,\n * (d, t) => t + d.size); // reduces all items to a single value (ex: sums all size)\n * iter.reduce(0,\n * (d, t) => t + d.size,\n * d => d.flag); // reduces all items to a single value (ex: sums all size) where the item meets some criteria\n * iter.map(d => d.subitem); // return an iterator for subitems if they exist\n * iter.iterate(d => log(d)); // do something for each item\n * ```\n *\n * @typeparam T The type of item being iterated.\n */\nexport class Iterator\n{\n\n /**\n * A result of the iteration passed to [[Iterator.stop]].\n */\n public result: any = undefined;\n\n /**\n * The last action (if any) called on this iterator.\n */\n public action: IteratorAction;\n\n /**\n * The current callback passed to the iterator.\n */\n public callback: IteratorCallback;\n\n /**\n * The source of iterable items. This allows the iteration over any type of\n * structure. The source must call the callback for each item and its\n * recommended that the source checks the [[Iterator.iterating]] flag after\n * each callback invokation.\n */\n private source: IteratorSource;\n\n /**\n * Creates a new Iterator given a source.\n *\n * @param source The source of items to iterator.\n */\n public constructor(source: IteratorSource)\n {\n this.source = source;\n }\n\n /**\n * Returns a clone of this iterator with the same source. This is necessary\n * if you want to iterate all or a portion of the source while already\n * iterating it (like a nested loop).\n */\n public clone(): Iterator\n {\n return new Iterator( this.source );\n }\n\n /**\n * Passes the given item to the iterator callback and returns the action\n * requested at this point in iteration.\n *\n * @param item The current item being iterated.\n */\n public act(item: T): IteratorAction\n {\n this.action = IteratorAction.Continue;\n\n this.callback( item, this );\n\n return this.action;\n }\n\n /**\n * Stops iteration and optionally sets the result of the iteration.\n *\n * @param result The result of the iteration.\n */\n public stop(result?: any): this\n {\n this.result = result;\n this.action = IteratorAction.Stop;\n\n return this;\n }\n\n /**\n * Signals to the iterator source that the current item wants to be removed.\n */\n public remove(): this\n {\n this.action = IteratorAction.Remove;\n\n return this;\n }\n\n /**\n * Determines with this iterator is empty. A filter function can be specified\n * to only check for items which match certain criteria.\n *\n * @param filter A function to the checks items for certain criteria.\n * @returns `true` if no valid items exist in the source.\n */\n public isEmpty(filter: IteratorFilter = null): boolean\n {\n let empty: boolean = true;\n\n this.iterate((item, iterator) =>\n {\n if (filter && !filter( item ))\n {\n return;\n }\n\n empty = false;\n iterator.stop();\n });\n\n return empty;\n }\n\n /**\n * Counts the number of items in the iterator. A filter function can be\n * specified to only count items which match certain criteria.\n *\n * @param filter A function to count items for certain criteria.\n * @returns The number of items in the source that optionally match the given\n * criteria.\n */\n public count(filter: IteratorFilter = null): number\n {\n let total: number = 0;\n\n this.iterate((item, iterator) =>\n {\n if (filter && !filter( item ))\n {\n return;\n }\n\n total++;\n });\n\n return total;\n }\n\n /**\n * Returns the first item in the iterator. A filter function can be specified\n * to only return the first item which matches certain criteria.\n *\n * @param filter A function to compare items to to match certain criteria.\n * @returns The first item found that optonally matches the given criteria.\n */\n public first(filter: IteratorFilter = null): T\n {\n let first: T = null;\n\n this.iterate((item, iterator) =>\n {\n if (filter && !filter( item ))\n {\n return;\n }\n\n first = item;\n iterator.stop();\n });\n\n return first;\n }\n\n /**\n * Builds a list of items from the source. A filter function can be specified\n * so the resulting list only contain items that match certain criteria.\n *\n * @param out The array to place the items in.\n * @param filter The function which determines which items are added to the list.\n * @returns The reference to `out` which has had items added to it which\n * optionally match the given criteria.\n */\n public list(out: T[] = [], filter: IteratorFilter = null): T[]\n {\n this.iterate((item, iterator) =>\n {\n if (filter && !filter( item ))\n {\n return;\n }\n\n out.push( item );\n });\n\n return out;\n }\n\n /**\n * Builds an object of items from the source keyed by a result returned by\n * a `getKey` function.\n *\n * @param getKey The function which returns the key of the object.\n * @param out The object to place the items in.\n * @param filter The function which determines which items are set on the object.\n * @returns The reference to `out` which has had items set to it which\n * optionally match the given criteria.\n */\n public object(getKey: (item: T) => any, out: any = {}, filter: IteratorFilter = null): any\n {\n this.iterate((item, iterator) =>\n {\n if (filter && !filter( item ))\n {\n return;\n }\n\n let key = getKey( item );\n\n out[ key ] = item;\n });\n\n return out;\n }\n\n /**\n * Returns a new iterator that only returns a maximum number of items.\n *\n * @param amount The maximum number of items to return.\n * @returns A new iterator which returns a maximum number of items.\n */\n public take(amount: number): Iterator\n {\n return new Iterator(next =>\n {\n this.iterate((item, prev) =>\n {\n switch (next.act( item ))\n {\n case IteratorAction.Stop:\n prev.stop();\n break;\n case IteratorAction.Remove:\n prev.remove();\n break;\n }\n\n if (--amount <= 0)\n {\n prev.stop();\n }\n });\n });\n }\n\n /**\n * Returns a new iterator that skips the given number of items from the items\n * in this iterator.\n *\n * @param amount The number of items to skip.\n * @returns A new iterator which skipped the given number of items.\n */\n public skip(amount: number): Iterator\n {\n return new Iterator(next =>\n {\n let skipped: number = 0;\n\n this.iterate((item, prev) =>\n {\n if (skipped >= amount)\n {\n switch (next.act( item ))\n {\n case IteratorAction.Stop:\n prev.stop();\n break;\n case IteratorAction.Remove:\n prev.remove();\n break;\n }\n }\n\n skipped++;\n });\n });\n }\n\n /**\n * Returns a new iterator thats items are the items in this iterator followed\n * by the items in the given iterators.\n *\n * @param iterators The iterators to append after this one.\n * @returns A new iterator based on this iterator followed by the given.\n */\n public append(...iterators: Iterator[]): Iterator\n {\n return Iterator.join( this, ...iterators );\n }\n\n /**\n * Returns a new iterator thats items are the items in the given iterators\n * followed by the items in this iterator.\n *\n * @param iterators The iterators to prepend before this one.\n * @returns A new iterator based on the given iterators followed by this.\n */\n public prepend(...iterators: Iterator[]): Iterator\n {\n return Iterator.join( ...iterators, this );\n }\n\n /**\n * Removes items from the source that match certain criteria.\n *\n * @param filter The function which determines which items to remove.\n */\n public purge(filter: IteratorFilter): this\n {\n this.iterate((item, iterator) =>\n {\n if (filter(item))\n {\n iterator.remove();\n }\n });\n\n return this;\n }\n\n /**\n * Returns an iterator which takes items from this iterator and presents them\n * in reverse.\n *\n * @returns A new iterator with the items in this iterator in reverse.\n */\n public reverse(): Iterator\n {\n return new Iterator(iterator =>\n {\n let items: T[] = this.list();\n let removed: T[] = [];\n\n for (let i = items.length - 1; i >= 0; i--)\n {\n let item: T = items[ i ];\n let action: IteratorAction = iterator.act( item );\n\n if (action === IteratorAction.Stop)\n {\n break;\n }\n\n if (action === IteratorAction.Remove)\n {\n removed.push( item );\n }\n }\n\n if (removed.length > 0)\n {\n this.purge(item => removed.indexOf( item ) !== -1);\n }\n });\n }\n\n /**\n * Reduces all the items in the source to a single value given the initial\n * value and a function to convert an item and the current reduced value\n */\n public reduce(initial: R, reducer: (item: T, reduced: R) => R, filter: IteratorFilter = null): R\n {\n let reduced: R = initial;\n\n this.iterate((item, iterator) =>\n {\n if (filter && !filter( item ))\n {\n return;\n }\n\n reduced = reducer( item, reduced );\n });\n\n return reduced;\n }\n\n /**\n * Returns an iterator where this iterator is the source and the returned\n * iterator is built on a subset of items which pass a `filter` function.\n *\n * @param filter The function which determines if an item should be iterated.\n * @returns A new iterator for the filtered items from this iterator.\n */\n public filter(filter: IteratorFilter): Iterator\n {\n return new Iterator(next =>\n {\n this.iterate((prevItem, prev) =>\n {\n if (filter(prevItem))\n {\n switch (next.act( prevItem ))\n {\n case IteratorAction.Stop:\n prev.stop();\n break;\n\n case IteratorAction.Remove:\n prev.remove();\n break;\n }\n }\n });\n });\n }\n\n /**\n * Returns an iterator where this iterator is the source and the returned\n * iterator is built from mapped items pulled from items in the source\n * of this iterator. If the given callback `outerCallback` does not return\n * a mapped value then the returned iterator will not see the item. A filter\n * function can be specified to only look at mapping items which match\n * certain criteria.\n *\n * @param mapper The function which maps an item to another.\n * @param filter The function which determines if an item should be mapped.\n * @returns A new iterator for the mapped items from this iterator.\n */\n public map(mapper: IteratorCallback, filter: IteratorFilter = null): Iterator\n {\n return new Iterator(next =>\n {\n this.iterate((prevItem, prev) =>\n {\n if (filter && !filter( prevItem ))\n {\n return;\n }\n\n let nextItem: W = mapper( prevItem, prev );\n\n if (fn.isDefined( nextItem ))\n {\n switch (next.act( nextItem ))\n {\n case IteratorAction.Stop:\n prev.stop();\n break;\n\n case IteratorAction.Remove:\n prev.remove();\n break;\n }\n }\n });\n });\n }\n\n /**\n * Invokes the callback for each item in the source of this iterator. The\n * second argument in the callback is the reference to this iterator and\n * [[Iterator.stop]] can be called at anytime to cease iteration.\n *\n * @param callback The function to invoke for each item in this iterator.\n */\n public iterate(callback: IteratorCallback): this\n {\n this.result = undefined;\n this.callback = callback;\n this.action = IteratorAction.Continue;\n this.source( this );\n this.callback = null;\n\n return this;\n }\n\n /**\n * Passes the result of the iteration to the given function if a truthy\n * result was passed to [[Iterator.stop]].\n *\n * @param getResult The function to pass the result to if it exists.\n */\n public withResult(getResult: (result: any) => any): this\n {\n if (this.result)\n {\n getResult( this.result );\n }\n\n return this;\n }\n\n /**\n * Returns an iterator for the given array optionally iterating it in reverse.\n *\n * @param items The array of items to iterate.\n * @param reverse If the array should be iterated in reverse.\n * @returns A new iterator for the given array.\n */\n public static forArray(items: T[], reverse: boolean = false): Iterator\n {\n return new Iterator(iterator =>\n {\n if (reverse)\n {\n for (let i = items.length - 1; i >= 0; i--)\n {\n switch (iterator.act(items[ i ]))\n {\n case IteratorAction.Stop:\n return;\n case IteratorAction.Remove:\n items.splice(i, 1);\n break;\n }\n }\n }\n else\n {\n for (let i = 0; i < items.length; i++)\n {\n switch (iterator.act(items[ i ]))\n {\n case IteratorAction.Stop:\n return;\n case IteratorAction.Remove:\n items.splice(i, 1);\n i--;\n break;\n }\n }\n }\n });\n }\n\n /**\n * Returns an iterator for the given object optionally checking the\n * `hasOwnProperty` function on the given object.\n *\n * @param items The object to iterate.\n * @param hasOwnProperty If `hasOwnProperty` should be checked.\n * @returns A new iterator for the given object.\n */\n public static forObject(items: { [key: string]: T }, hasOwnProperty: boolean = true): Iterator\n {\n return new Iterator(iterator =>\n {\n for (let key in items)\n {\n if (hasOwnProperty && !items.hasOwnProperty( key ))\n {\n continue;\n }\n\n switch (iterator.act(items[ key ]))\n {\n case IteratorAction.Stop:\n return;\n case IteratorAction.Remove:\n delete items[ key ];\n break;\n }\n }\n });\n }\n\n /**\n * Joins all the given iterators into a single iterator where the items\n * returned are in the same order as passed to this function. If any items\n * are removed from the returned iterator they will be removed from the given\n * iterator if it supports removal.\n *\n * @param iterators The array of iterators to join as one.\n * @returns A new iterator for the given iterators.\n */\n public static join(...iterators: Iterator[]): Iterator\n {\n return new Iterator(parent =>\n {\n for (let child of iterators)\n {\n child.iterate((item, childIterator) =>\n {\n switch (parent.act( item ))\n {\n case IteratorAction.Remove:\n childIterator.remove();\n break;\n case IteratorAction.Stop:\n childIterator.stop();\n break;\n }\n });\n\n if (child.action === IteratorAction.Stop)\n {\n return;\n }\n }\n });\n }\n\n /**\n * Returns a new iterator with no items.\n *\n * @returns A new iterator with no items.\n */\n public static empty(): Iterator\n {\n return new Iterator(parent => {});\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Iterator.ts","\nimport { Identifier, IdentifierInput } from './Identifier';\nimport { Day } from './Day';\nimport { DaySpan } from './DaySpan';\nimport { Iterator, IteratorAction } from './Iterator';\n\n\n/**\n * A map of values in the [[ScheduleModifier]] keyed by the descriptions of the\n * identifiers.\n */\nexport interface ScheduleModifierDescription\n{\n [description: string]: T\n}\n\n/**\n * An object which carries the span taken from an identifier and the value\n * mapped to it in a [[ScheduleModifier]].\n */\nexport interface ScheduleModifierSpan\n{\n span: DaySpan,\n value: T\n}\n\n/**\n * A class that can modify the events of a schedule by storing [[Identifier]]s\n * and an associated value.\n *\n * @typeparam T The type of data that modifies the schedule.\n */\nexport class ScheduleModifier\n{\n\n /**\n * The map of values mapped by their [[Identifier]]s.\n */\n public map: { [id: string]: T };\n\n\n /**\n * Creates a new schedule modifier.\n */\n public constructor()\n {\n this.map = {};\n }\n\n /**\n * Clears the modifier of all modifications.\n */\n public clear(): this\n {\n this.map = {};\n\n return this;\n }\n\n /**\n * Returns `true` if this modifier lacks any modifications, otherwise `false`.\n */\n public isEmpty(): boolean\n {\n // @ts-ignore\n for (let id in this.map)\n {\n return !id;\n }\n\n return true;\n }\n\n /**\n * Gets the most specific value in this modifier for the given day, if none\n * exists `otherwise` is returned. A modifier can have multiple values for a\n * given day because [[Identifier]]s represent a span of time.\n *\n * @param day The day to get a value for.\n * @param otherwise What to return if no value exists for the given day.\n * @param lookAtTime If the specific time of the given day should be looked at.\n * @returns The most specific value for the given day, or `otherwise`.\n */\n public get(day: Day, otherwise: T, lookAtTime: boolean = true): T\n {\n let map = this.map;\n\n return (lookAtTime && map[ day.timeIdentifier ]) ||\n map[ day.dayIdentifier ] ||\n map[ day.monthIdentifier ] ||\n map[ day.weekIdentifier ] ||\n map[ day.quarterIdentifier ] ||\n otherwise;\n }\n\n /**\n * Gets all values in this modifier for the given day. If none exist, an empty\n * array is returned. The values returned in the array are returned in most\n * specific to least specific.\n *\n * @param day The day to get the values for.\n * @returns An array of values (modifications) for the given day.\n */\n public getAll(day: Day): T[]\n {\n let map = this.map;\n let all: T[] = [];\n\n if (map[ day.timeIdentifier ]) all.push( map[ day.timeIdentifier ] );\n if (map[ day.dayIdentifier ]) all.push( map[ day.dayIdentifier ] );\n if (map[ day.monthIdentifier ]) all.push( map[ day.monthIdentifier ] );\n if (map[ day.weekIdentifier ]) all.push( map[ day.weekIdentifier ] );\n if (map[ day.quarterIdentifier ]) all.push( map[ day.quarterIdentifier ] );\n\n return all;\n }\n\n /**\n * Moves the value/modification from one identifier to another.\n *\n * @param from The day to take the identifier from.\n * @param fromType The identifier type.\n * @param to The day to move the value to.\n * @param toType The identifier type to move the value to.\n */\n public move(from: Day, fromType: Identifier, to: Day, toType: Identifier): this\n {\n let fromIdentifier = fromType.get( from );\n let toIdentifier = toType.get( to );\n\n this.map[ toIdentifier ] = this.map[ fromIdentifier ];\n\n delete this.map[ fromIdentifier ];\n\n return this;\n }\n\n /**\n * Sets the value/modification in this map given a day, the value, and the\n * identifier type.\n *\n * @param day The day to take an identifier from.\n * @param value The value/modification to set.\n * @param type The identifier type.\n */\n public set(day: Day, value: T, type: Identifier): this\n {\n this.map[ type.get( day ) ] = value;\n\n return this;\n }\n\n /**\n * Removes the value/modification from this modifier based on the identifier\n * pulled from the day.\n *\n * @param day The day to take an identifier from.\n * @param type The identifier type.\n */\n public unset(day: Day, type: Identifier): this\n {\n delete this.map[ type.get( day ) ];\n\n return this;\n }\n\n /**\n * Iterates through the modifiers passing the identifier and the related value.\n *\n * @returns A new instance of an [[Iterator]].\n */\n public iterate(): Iterator<[IdentifierInput, T]>\n {\n return new Iterator<[IdentifierInput, T]>(iterator =>\n {\n let map = this.map;\n\n for (let rawId in map)\n {\n let asNumber: number = parseInt( rawId );\n let validAsNumber: boolean = asNumber + '' === rawId;\n let id: IdentifierInput = validAsNumber ? asNumber : rawId;\n\n switch (iterator.act([id, map[ rawId ]]))\n {\n case IteratorAction.Stop:\n return;\n case IteratorAction.Remove:\n delete map[ rawId ];\n break;\n }\n }\n });\n }\n\n /**\n * Queries the modifier for all values/modifications which fall in the time\n * span that the given identifier represents. All identifiers and their value\n * are passed to the given callback.\n *\n * @param prefix The identifier\n * @returns A new instance of an [[Iterator]].\n */\n public query(query: IdentifierInput): Iterator<[IdentifierInput, T]>\n {\n return this.iterate()\n .filter(([id, value]) => Identifier.contains( query, id ));\n ;\n }\n\n /**\n * Returns all identifiers stored in this modifier.\n */\n public identifiers(filter?: (value: T, id: IdentifierInput) => boolean): Iterator\n {\n return this.iterate()\n .filter(([id, value]) => !filter || filter( value, id ))\n .map(([id, ]) => id)\n ;\n }\n\n /**\n * Builds a list of spans and the associated values. The spans are calculated\n * from the identiier key via [[Identifier.span]].\n *\n * @param endInclusive If the end date in the spans should be the last\n * millisecond of the timespan or the first millisecond of the next.\n * @returns An array of spans calculated from the identifiers with the\n * associated values/modifications.\n */\n public spans(endInclusive: boolean = false): Iterator>\n {\n return this.iterate()\n .map(([id, value]) =>\n {\n let type: Identifier = Identifier.find(id);\n\n if (type)\n {\n let span = type.span( id, endInclusive);\n\n return { span, value };\n }\n })\n ;\n }\n\n /**\n * Builds a list of the descriptions of the identifiers in this modifier.\n *\n * @param short If the description should use shorter language or longer.\n * @returns The built list of descriptions.\n */\n public describe(short: boolean = false): Iterator\n {\n return this.iterate()\n .map( ([id, ]) =>\n {\n let type: Identifier = Identifier.find( id );\n\n if (type)\n {\n return type.describe( id, short );\n }\n })\n ;\n }\n\n /**\n * Builds a map of the values/modifications keyed by the descripton of the\n * identifier computed via [[Identifier.describe]].\n *\n * @param short If the description should use shorter language or longer.\n * @returns The built map of description to values/modifications.\n */\n public describeMap(short: boolean = false): ScheduleModifierDescription\n {\n let map = this.map;\n let out: ScheduleModifierDescription = {};\n\n for (let id in map)\n {\n let type: Identifier = Identifier.find(id);\n\n if (type)\n {\n out[ type.describe( id, short ) ] = map[ id ];\n }\n }\n\n return out;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/ScheduleModifier.ts","\nimport { Functions as fn } from './Functions';\nimport { FrequencyValue, FrequencyCheck, FrequencyValueEvery, FrequencyValueOneOf } from './Frequency';\nimport { Day, DayInput, DurationInput, DayProperty } from './Day';\nimport { Identifier, IdentifierInput } from './Identifier';\nimport { DaySpan } from './DaySpan';\nimport { Constants } from './Constants';\nimport { Parse } from './Parse';\nimport { Time, TimeInput } from './Time';\nimport { Suffix } from './Suffix';\nimport { ScheduleModifier, ScheduleModifierSpan } from './ScheduleModifier';\nimport { Units } from './Units';\nimport { Iterator, IteratorAction } from './Iterator';\n\n// @ts-ignore\nimport * as moment from 'moment';\n\n\n/**\n * A tuple which identifies an event on the schedule. The tuple contains the\n * total span of the event occurrence, the day of the event (could be the start\n * day, end day, or any days in between for multi-day events) as well as the\n * identifier for the event.\n */\nexport type ScheduleEventTuple = [DaySpan, Day, IdentifierInput];\n\n/**\n * Input given by a user which describes an event schedule.\n *\n * @typeparam M The type of metadata stored in the schedule.\n */\nexport interface ScheduleInput\n{\n\n /**\n * @see [[Schedule.start]]\n */\n start?: DayInput;\n\n /**\n * @see [[Schedule.end]]\n */\n end?: DayInput;\n\n /**\n * A shortcut to setting the [[Schedule.start]], [[Schedule.end]],\n * [[Schedule.year]], [[Schedule.month]], and [[Schedule.dayOfMonth]].\n */\n on?: DayInput;\n\n /**\n * @see [[Schedule.times]]\n */\n times?: TimeInput[];\n\n /**\n * @see [[Schedule.duration]]\n */\n duration?: number;\n\n /**\n * @see [[Schedule.durationUnit]]\n */\n durationUnit?: DurationInput;\n\n /**\n * An array of days or identifiers which should be excluded from the schedule.\n *\n * @see [[Schedule.exclude]]\n */\n exclude?: (Day | IdentifierInput)[];\n\n /**\n * An array of days or identifiers which should be included in the schedule.\n *\n * @see [[Schedule.include]]\n */\n include?: (Day | IdentifierInput)[];\n\n /**\n * An array of days or identifiers which should be canceled in the schedule.\n *\n * @see [[Schedule.cancel]]\n */\n cancel?: (Day | IdentifierInput)[];\n\n /**\n * @see [[Schedule.meta]]\n */\n meta?: { [identifier: string]: M };\n\n /**\n * @see [[Schedule.month]]\n */\n month?: FrequencyValue;\n\n /**\n * @see [[Schedule.year]]\n */\n year?: FrequencyValue;\n\n /**\n * @see [[Schedule.week]]\n */\n week?: FrequencyValue;\n\n /**\n * @see [[Schedule.dayOfWeek]]\n */\n dayOfWeek?: FrequencyValue;\n\n /**\n * @see [[Schedule.dayOfMonth]]\n */\n dayOfMonth?: FrequencyValue;\n\n /**\n * @see [[Schedule.lastDayOfMonth]]\n */\n lastDayOfMonth?: FrequencyValue;\n\n /**\n * @see [[Schedule.dayOfYear]]\n */\n dayOfYear?: FrequencyValue;\n\n /**\n * @see [[Schedule.weekOfYear]]\n */\n weekOfYear?: FrequencyValue;\n\n /**\n * @see [[Schedule.weekspanOfYear]]\n */\n weekspanOfYear?: FrequencyValue;\n\n /**\n * @see [[Schedule.fullWeekOfYear]]\n */\n fullWeekOfYear?: FrequencyValue;\n\n /**\n * @see [[Schedule.lastWeekspanOfYear]]\n */\n lastWeekspanOfYear?: FrequencyValue;\n\n /**\n * @see [[Schedule.lastFullWeekOfYear]]\n */\n lastFullWeekOfYear?: FrequencyValue;\n\n /**\n * @see [[Schedule.weekOfMonth]]\n */\n weekOfMonth?: FrequencyValue;\n\n /**\n * @see [[Schedule.weekspanOfMonth]]\n */\n weekspanOfMonth?: FrequencyValue;\n\n /**\n * @see [[Schedule.fullWeekOfMonth]]\n */\n fullWeekOfMonth?: FrequencyValue;\n\n /**\n * @see [[Schedule.lastWeekspanOfMonth]]\n */\n lastWeekspanOfMonth?: FrequencyValue;\n\n /**\n * @see [[Schedule.lastFullWeekOfMonth]]\n */\n lastFullWeekOfMonth?: FrequencyValue;\n\n /**\n * The function to parse metadata with.\n */\n parseMeta?: (input: any) => M;\n}\n\n\n/**\n * A class which describes when an event occurs over what time and if it repeats.\n *\n * @typeparam M The type of metadata stored in the schedule.\n */\nexport class Schedule\n{\n\n /**\n * The earliest an event can occur in the schedule, or `null` if there are no\n * restrictions when the earliest event can occur. This day is inclusive.\n */\n public start: Day;\n\n /**\n * The latest an event can occur in the schedule, or `null` if there are no\n * restrictions when the latest event can occur. This day is inclusive.\n */\n public end: Day;\n\n /**\n * The length of events in this schedule.\n */\n public duration: number;\n\n /**\n * The unit which describes the duration of the event.\n */\n public durationUnit: DurationInput;\n\n /**\n * The times at which the events occur on the days they should. If there are\n * no times specified its assumed to be an all day event - potentially over\n * multiple days or weeks based on [[Schedule.duration]] and\n * [[Schedule.durationUnit]].\n */\n public times: Time[];\n\n /**\n * The number of days an event in this schedule lasts PAST the starting day.\n * If this is a full day event with a duration greater than zero this value\n * will be greater than one. If this event occurs at a specific time with a\n * given duration that is taken into account and if it passes over into the\n * next day this value will be greater than one. This value is used to look\n * back in time when trying to figure out what events start or overlap on a\n * given day.\n */\n public durationInDays: number;\n\n /**\n * A set of identifiers which mark what days or times are excluded on the\n * schedule. This typically represents the set of event occurrences removed.\n */\n public exclude: ScheduleModifier;\n\n /**\n * A set of identifiers which mark what days or times are included outside\n * the normal series of days on the schedule. This typically represents\n * an event occurrence which is moved so its added to the exclude and include\n * sets.\n */\n public include: ScheduleModifier;\n\n /**\n * A set of identifiers which mark what days, times, weeks, months, etc that\n * should have all event occurrences cancelled.\n */\n public cancel: ScheduleModifier;\n\n /**\n * A map of metadata keyed by an identifier. The metadata is placed in\n * [[CalendarEvent]].\n */\n public meta: ScheduleModifier;\n\n /**\n * How frequent the event occurs based on [[Day.dayOfWeek]].\n */\n public dayOfWeek: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.dayOfMonth]].\n */\n public dayOfMonth: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.lastDayOfMonth]].\n */\n public lastDayOfMonth: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.dayOfYear]].\n */\n public dayOfYear: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.month]].\n */\n public month: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.week]].\n */\n public week: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.weekOfYear]].\n */\n public weekOfYear: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.weekspanOfYear]].\n */\n public weekspanOfYear: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.fullWeekOfYear]].\n */\n public fullWeekOfYear: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.lastWeekspanOfYear]].\n */\n public lastWeekspanOfYear: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.lastFullWeekOfYear]].\n */\n public lastFullWeekOfYear: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.weekOfMonth]].\n */\n public weekOfMonth: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.weekspanOfMonth]].\n */\n public weekspanOfMonth: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.fullWeekOfMonth]].\n */\n public fullWeekOfMonth: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.lastWeekspanOfMonth]].\n */\n public lastWeekspanOfMonth: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.lastFullWeekOfMonth]].\n */\n public lastFullWeekOfMonth: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.year]].\n */\n public year: FrequencyCheck;\n\n /**\n * The array of frequency functions which had valid frequencies.\n *\n * @see [[FrequencyCheck.given]]\n */\n public checks: FrequencyCheck[];\n\n\n /**\n * Creates a schedule based on the given input.\n *\n * @param input The input which describes the schedule of events.\n */\n public constructor(input?: ScheduleInput)\n {\n this.exclude = new ScheduleModifier();\n this.include = new ScheduleModifier();\n this.cancel = new ScheduleModifier();\n this.meta = new ScheduleModifier();\n\n if (fn.isDefined(input))\n {\n this.set(input);\n }\n }\n\n /**\n * Sets the schedule with the given input.\n *\n * @param input The input which describes the schedule of events.\n * @param parseMeta A function to use when parsing meta input into the desired type.\n * @see [[Parse.schedule]]\n */\n public set(input: ScheduleInput,\n parseMeta: (input: any) => M = (x => x)): this\n {\n Parse.schedule(input, fn.coalesce( input.parseMeta, parseMeta ), this);\n\n return this;\n }\n\n /**\n * Returns the last event time specified or `undefined` if this schedule is\n * for an all day event.\n */\n public get lastTime(): Time\n {\n return this.times[ this.times.length - 1 ];\n }\n\n /**\n * The [[Identifier]] for this schedule. Either [[Identifier.Day]] or\n * [[Identifier.Time]].\n */\n public get identifierType(): Identifier\n {\n return this.isFullDay() ? Identifier.Day : Identifier.Time;\n }\n\n /**\n * Updates the [[Schedule.durationInDays]] variable based on the\n * [[Schedule.lastTime]] (if any), the [[Schedule.duration]] and it's\n * [[Schedule.durationUnit]].\n */\n public updateDurationInDays(): this\n {\n let start: number = this.lastTime ? this.lastTime.toMilliseconds() : 0;\n let duration: number = this.duration * (Constants.DURATION_TO_MILLIS[ this.durationUnit ] || 0);\n let exclude: number = Constants.MILLIS_IN_DAY;\n let day: number = Constants.MILLIS_IN_DAY;\n\n this.durationInDays = Math.max(0, Math.ceil((start + duration - exclude) / day));\n\n return this;\n }\n\n /**\n * Updates [[Schedule.checks]] based on the frequencies that were specified\n * in the schedule input.\n */\n public updateChecks(): this\n {\n this.checks = Parse.givenFrequency([\n this.year,\n this.month,\n this.week,\n this.weekOfYear,\n this.fullWeekOfYear,\n this.weekspanOfYear,\n this.lastFullWeekOfYear,\n this.lastWeekspanOfYear,\n this.weekOfMonth,\n this.weekspanOfMonth,\n this.fullWeekOfMonth,\n this.lastWeekspanOfMonth,\n this.lastFullWeekOfMonth,\n this.dayOfWeek,\n this.dayOfMonth,\n this.lastDayOfMonth,\n this.dayOfYear\n ]);\n\n return this;\n }\n\n /**\n * Determines whether the given day lies between the earliest and latest\n * valid day in the schedule.\n *\n * @param day The day to test.\n * @returns `true` if the day lies in the schedule, otherwise `false`.\n * @see [[Schedule.start]]\n * @see [[Schedule.end]]\n */\n public matchesSpan(day: Day): boolean\n {\n return (this.start === null || day.isSameOrAfter(this.start)) &&\n (this.end === null || day.isBefore(this.end));\n }\n\n /**\n * Determines whether the given range overlaps with the earliest and latest\n * valid days in this schedule (if any).\n *\n * @param start The first day in the range.\n * @param end The last day in the range.\n * @returns `true` if the range intersects with the schedule, otherwise `false`.\n * @see [[Schedule.start]]\n * @see [[Schedule.end]]\n */\n public matchesRange(start: Day, end: Day): boolean\n {\n if (this.start && end.isBefore(this.start))\n {\n return false;\n }\n\n if (this.end && start.isAfter(this.end))\n {\n return false;\n }\n\n return true;\n }\n\n /**\n * Determines whether the given day is explicitly excluded in the schedule.\n *\n * @param day The day to test.\n * @param lookAtTime lookAtTime If the specific time of the given day should\n * be looked at.\n * @returns `true` if the day was excluded, otherwise `false`.\n */\n public isExcluded(day: Day, lookAtTime: boolean = true): boolean\n {\n return this.exclude.get( day, false, lookAtTime );\n }\n\n /**\n * Determines whether the given day is explicitly included in the schedule.\n *\n * @param day The day to test.\n * @param lookAtTime lookAtTime If the specific time of the given day should\n * be looked at.\n * @returns `true` if the day is NOT explicitly included, otherwise `false`.\n */\n public isIncluded(day: Day, lookAtTime: boolean = true): boolean\n {\n return this.include.get( day, false, lookAtTime );\n }\n\n /**\n * Determines whether the given day is cancelled in the schedule.\n *\n * @param day The day to test.\n * @param lookAtTime lookAtTime If the specific time of the given day should\n * be looked at.\n * @returns `true` if the day was cancelled, otherwise `false`.\n */\n public isCancelled(day: Day, lookAtTime: boolean = true): boolean\n {\n return this.cancel.get( day, false, lookAtTime );\n }\n\n /**\n * Returns the metadata for the given day or `null` if there is none.\n *\n * @param day The day to return the metadata for.\n * @param otherwise The data to return if none exists for the given day.\n * @param lookAtTime lookAtTime If the specific time of the given day should\n * be looked at.\n * @returns The metadata or `null`.\n */\n public getMeta(day: Day, otherwise: M = null, lookAtTime: boolean = true): M\n {\n return this.meta.get( day, otherwise, lookAtTime );\n }\n\n /**\n * Returns all metadata for the given day or an empty array if there is none.\n *\n * @param day The day to return the metadata for.\n * @returns The array of metadata ordered by priority or an empty array.\n */\n public getMetas(day: Day): M[]\n {\n return this.meta.getAll( day );\n }\n\n /**\n * Returns whether the events in the schedule are all day long or start at\n * specific times. Full day events start at the start of the day and end at\n * the start of the next day (if the duration = `1` and durationUnit = 'days').\n * Full day events have no times specified and should have a durationUnit of\n * either `days` or `weeks`.\n */\n public isFullDay(): boolean\n {\n return this.times.length === 0;\n }\n\n /**\n * Returns a span of time for a schedule with full day events starting on the\n * start of the given day with the desired duration in days or weeks.\n *\n * @param day The day the span starts on.\n * @returns The span of time starting on the given day.\n */\n public getFullSpan(day: Day): DaySpan\n {\n let start: Day = day.start();\n let end: Day = start.add( this.duration, this.durationUnit );\n\n return new DaySpan( start, end );\n }\n\n /**\n * Returns a span of time starting on the given day at the given day with the\n * duration specified on this schedule.\n *\n * @param day The day the span starts on.\n * @param time The time of day the span starts.\n * @returns The span of time calculated.\n */\n public getTimeSpan(day: Day, time: Time): DaySpan\n {\n let start: Day = day.withTime( time );\n let end: Day = start.add( this.duration, this.durationUnit );\n\n return new DaySpan( start, end );\n }\n\n /**\n * Determines whether the given day is a day on the schedule for the start\n * of an event. If an event is more than one day and the day given is not the\n * start this may return `false`. This does not test for event instances\n * that exist through [[Schedule.include]].\n *\n * @param day The day to test.\n * @returns `true` if the day marks the start of an event on the schedule.\n * @see [[Schedule.isIncluded]]\n * @see [[Schedule.isFullyExcluded]]\n * @see [[Schedule.matchesSpan]]\n */\n public matchesDay(day: Day): boolean\n {\n if (this.isIncluded( day, false ))\n {\n return true;\n }\n\n if (!this.matchesSpan( day ) || this.isFullyExcluded( day ))\n {\n return false;\n }\n\n for (let check of this.checks)\n {\n if (!check( day[ check.property ] ))\n {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Determines whether the given day has events added through\n * [[Schedule.include]].\n *\n * @param day The day to look for included times on.\n * @returns `true` if there are included event instances on the given day,\n * otherwise `false`.\n */\n public hasIncludedTime(day: Day): boolean\n {\n return !this.iterateIncludeTimes( day ).isEmpty();\n }\n\n /**\n * Determines whether the given day is fully excluded from the schedule. A\n * fully excluded day is one that has a day-wide exclusion, or the schedule\n * is not an all-day event and all times in the schedule are specifically\n * excluded.\n *\n * @param day The day to test.*\n * @returns `true` if he day is fully excluded, otherwise `false`.\n */\n public isFullyExcluded(day: Day): boolean\n {\n if (this.isExcluded(day, false))\n {\n return true;\n }\n\n if (this.isFullDay())\n {\n return false;\n }\n\n for (let time of this.times)\n {\n if (!this.isExcluded( day.withTime( time ) ))\n {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Finds the next day an event occurs on the schedule given a day to start,\n * optionally including it, and a maximum number of days to look ahead.\n *\n * @param day The day to start to search from.\n * @param includeDay If the given day should be included in the search.\n * @param lookAhead The maximum number of days to look ahead from the given\n * day for event occurrences.\n * @returns The next day on the schedule or `null` if none exists.\n */\n public nextDay(day: Day, includeDay: boolean = false, lookAhead: number = 366): Day\n {\n return this.iterateDaycast(day, 1, true, includeDay, lookAhead).first();\n }\n\n /**\n * Finds the next specified number of days that events occur on the schedule\n * given a day to start, optionally including it, and a maximum number of days\n * to look ahead.\n *\n * @param day The day to start to search from.\n * @param max The maximum number of days to return in the result.\n * @param includeDay If the given day should be included in the search.\n * @param lookAhead The maximum number of days to look ahead from the given\n * day for event occurrences.\n * @returns An array containing the next days on the schedule that events\n * start or an empty array if there are none.\n */\n public nextDays(day: Day, max: number, includeDay: boolean = false, lookAhead: number = 366): Iterator\n {\n return this.iterateDaycast(day, max, true, includeDay, lookAhead);\n }\n\n /**\n * Finds the previous day an event occurs on the schedule given a day to start,\n * optionally including it, and a maximum number of days to look behind.\n *\n * @param day The day to start to search from.\n * @param includeDay If the given day should be included in the search.\n * @param lookBack The maximum number of days to look behind from the given\n * day for event occurrences.\n * @returns The previous day on the schedule or `null` if none exists.\n */\n public prevDay(day: Day, includeDay: boolean = false, lookBack: number = 366): Day\n {\n return this.iterateDaycast(day, 1, false, includeDay, lookBack).first();\n }\n\n /**\n * Finds the previous specified number of days that events occur on the\n * schedule given a day to start, optionally including it, and a maximum\n * number of days to look behind.\n *\n * @param day The day to start to search from.\n * @param max The maximum number of days to return in the result.\n * @param includeDay If the given day should be included in the search.\n * @param lookAhead The maximum number of days to look behind from the given\n * day for event occurrences.\n * @returns An array containing the previous days on the schedule that events\n * start or an empty array if there are none.\n */\n public prevDays(day: Day, max: number, includeDay: boolean = false, lookBack: number = 366): Iterator\n {\n return this.iterateDaycast(day, max, false, includeDay, lookBack);\n }\n\n /**\n * Iterates over days that events start in the schedule given a day to start,\n * a maximum number of days to find, and a direction to look.\n *\n * @param day The day to start to search from.\n * @param max The maximum number of days to iterate.\n * @param next If `true` this searches forward, otherwise `false` is backwards.\n * @param includeDay If the given day should be included in the search.\n * @param lookup The maximum number of days to look through from the given\n * day for event occurrences.\n * @returns A new Iterator for the days found in the cast.\n * @see [[Schedule.iterateSpans]]\n */\n public iterateDaycast(day: Day, max: number, next: boolean, includeDay: boolean = false, lookup: number = 366): Iterator\n {\n return new Iterator(iterator =>\n {\n let iterated: number = 0;\n\n for (let days = 0; days < lookup; days++)\n {\n if (!includeDay || days > 0)\n {\n day = next ? day.next() : day.prev();\n }\n\n if (!this.iterateSpans( day, false ).isEmpty())\n {\n let action: IteratorAction = iterator.act( day );\n\n if (action === IteratorAction.Stop || ++iterated >= max)\n {\n return;\n }\n }\n }\n });\n }\n\n /**\n * Iterates through the spans (event instances) that start on or covers the\n * given day.\n *\n * @param day The day to look for spans on.\n * @param covers If `true` spans which span multiple days will be looked at\n * to see if they intersect with the given day, otherwise `false` will\n * only look at the given day for the start of events.\n * @returns A new Iterator for all the spans found.\n */\n public iterateSpans(day: Day, covers: boolean = false): Iterator\n {\n return new Iterator(iterator =>\n {\n let current: Day = day;\n let lookBehind: number = covers ? this.durationInDays : 0;\n\n // If the events start at the end of the day and may last multiple days....\n if (this.isFullDay())\n {\n // If the schedule has events which span multiple days we need to look\n // backwards for events that overlap with the given day.\n while (lookBehind >= 0)\n {\n // If the current day matches the schedule rules...\n if (this.matchesDay( current ))\n {\n // Build a DaySpan with the given start day and the schedules duration.\n let span: DaySpan = this.getFullSpan( current );\n\n // If that dayspan intersects with the given day, it's a winner!\n if (span.matchesDay( day ))\n {\n switch (iterator.act( span ))\n {\n case IteratorAction.Stop:\n return;\n }\n }\n }\n\n current = current.prev();\n lookBehind--;\n }\n }\n // This schedule has events which start at certain times\n else\n {\n // If the schedule has events which span multiple days we need to look\n // backwards for events that overlap with the given day.\n while (lookBehind >= 0)\n {\n // If the current day matches the schedule rules...\n if (this.matchesDay( current ))\n {\n // Iterate through each daily occurrence in the schedule...\n for (let time of this.times)\n {\n let span: DaySpan = this.getTimeSpan( current, time );\n\n // If the event intersects with the given day and the occurrence\n // has not specifically been excluded...\n if (span.matchesDay( day ) && !this.isExcluded( span.start, true ))\n {\n switch (iterator.act( span ))\n {\n case IteratorAction.Stop:\n return;\n }\n }\n }\n }\n else\n {\n // The current day does not match the schedule, however the schedule\n // might have moved/random event occurrents on the current day.\n // We only want the ones that overlap with the given day.\n this.iterateIncludeTimes(current, day).iterate((span, timeIterator) =>\n {\n switch (iterator.act( span ))\n {\n case IteratorAction.Stop:\n timeIterator.stop();\n break;\n }\n })\n\n if (iterator.action === IteratorAction.Stop)\n {\n return;\n }\n }\n\n current = current.prev();\n lookBehind--;\n }\n }\n });\n }\n\n /**\n * Determines if the given day is on the schedule and the time specified on\n * the day matches one of the times on the schedule.\n *\n * @param day The day to test.\n * @returns `true` if the day and time match the schedule, otherwise false.\n */\n public matchesTime(day: Day): boolean\n {\n return !!this.iterateSpans( day, true ).first( span => span.start.sameMinute( day ) );\n }\n\n /**\n * Determines if the given day is covered by this schedule. A schedule can\n * specify events that span multiple days - so even though the day does not\n * match the starting day of a span - it can be a day that is within the\n * schedule.\n *\n * @param day The day to test.\n * @returns `true` if the day is covered by an event on this schedule,\n * otherwise `false`.\n */\n public coversDay(day: Day): boolean\n {\n return !this.iterateSpans( day, true ).isEmpty();\n }\n\n /**\n * Determines if the given timestamp lies in an event occurrence on this\n * schedule.\n *\n * @param day The timestamp to test against the schedule.\n * @return `true` if the timestamp lies in an event occurrent start and end\n * timestamps, otherwise `false`.\n */\n public coversTime(day: Day): boolean\n {\n return !!this.iterateSpans( day, true ).first( span => span.contains( day ) );\n }\n\n /**\n * Changes the exclusion status of the event at the given time. By default\n * this excludes this event - but `false` may be passed to undo an exclusion.\n *\n * @param time The start time of the event occurrence to exclude or include.\n * @param excluded Whether the event should be excluded.\n */\n public setExcluded(time: Day, excluded: boolean = true): this\n {\n let type: Identifier = this.identifierType;\n\n this.exclude.set( time, excluded, type );\n this.include.set( time, !excluded, type );\n\n return this;\n }\n\n /**\n * Changes the cancellation status of the event at the given start time. By\n * default this cancels the event occurrence - but `false` may be passed to\n * undo a cancellation.\n *\n * @param time The start time of the event occurrence to cancel or uncancel.\n * @param cancelled Whether the event should be cancelled.\n */\n public setCancelled(time: Day, cancelled: boolean = true): this\n {\n this.cancel.set( time, cancelled, this.identifierType );\n\n return this;\n }\n\n /**\n * Moves the event instance starting at `fromTime` to `toTime` optionally\n * placing `meta` in the schedules metadata for the new time `toTime`.\n * If this schedule has a single event ([[Schedule.isSingleEvent]]) then the\n * only value needed is `toTime` and not `fromTime`.\n *\n * @param toTime The timestamp of the new event.\n * @param fromTime The timestamp of the event on the schedule to move if this\n * schedule generates multiple events.\n * @param meta The metadata to place in the schedule for the given `toTime`.\n * @returns `true` if the schedule had the event moved, otherwise `false`.\n */\n public move(toTime: Day, fromTime?: Day, meta?: M): boolean\n {\n if (!this.moveSingleEvent( toTime ) && fromTime)\n {\n return this.moveInstance( fromTime, toTime, meta );\n }\n\n return false;\n }\n\n /**\n * Moves the event instance starting at `fromTime` to `toTime` optionally\n * placing `meta` in the schedules metadata for the new time `toTime`. A move\n * is accomplished by excluding the current event and adding an inclusion of\n * the new day & time.\n *\n * @param fromTime The timestamp of the event on the schedule to move.\n * @param toTime The timestamp of the new event.\n * @param meta The metadata to place in the schedule for the given `toTime`.\n * @returns `true`.\n * @see [[Schedule.move]]\n */\n public moveInstance(fromTime: Day, toTime: Day, meta?: M): boolean\n {\n let type: Identifier = this.identifierType;\n\n this.exclude.set( fromTime, true, type );\n this.exclude.set( toTime, false, type );\n\n this.include.set( toTime, true, type );\n this.include.set( fromTime, false, type );\n\n if (fn.isValue( meta ))\n {\n this.meta.unset( fromTime, type );\n this.meta.set( toTime, meta, type );\n }\n\n return true;\n }\n\n /**\n * Moves the single event in this schedule to the given day/time if applicable.\n * If this schedule is not a single event schedule then `false` is returned.\n * If this schedule is a timed event the time will take the time of the given\n * `toTime` of `takeTime` is `true`.\n *\n * @param toTime The time to move the single event to.\n * @param takeTime If this schedule has a single timed event, should the time\n * of the event be changed to the time of the given `toTime`?\n * @returns `true` if the schedule was adjusted, otherwise `false`.\n * @see [[Schedule.move]]\n */\n public moveSingleEvent(toTime: Day, takeTime: boolean = true): boolean\n {\n if (!this.isSingleEvent())\n {\n return false;\n }\n\n for (let check of this.checks)\n {\n let prop: DayProperty = check.property;\n let value = toTime[ prop ];\n let frequency: FrequencyCheck = Parse.frequency( [value], prop );\n\n this[ prop ] = frequency;\n }\n\n if (this.times.length === 1 && takeTime)\n {\n this.times[ 0 ] = toTime.asTime();\n }\n\n this.updateChecks();\n\n let span: DaySpan = this.getSingleEventSpan();\n\n if (this.start)\n {\n this.start = span.start.start();\n }\n\n if (this.end)\n {\n this.end = span.end.end();\n }\n\n return true;\n }\n\n /**\n * Returns the span of the single event in this schedule if it's that type of\n * schedule, otherwise `null` is returned.\n *\n * @returns A span of the single event, otherwise `null`.\n * @see [[Schedule.isSingleEvent]]\n */\n public getSingleEventSpan(): DaySpan\n {\n if (!this.isSingleEvent())\n {\n return null;\n }\n\n let startOfYear: Day = Day.build( this.year.input[0], 0, 1 );\n let start: Day = this.iterateDaycast( startOfYear, 1, true, true, 366 ).first();\n\n if (!start)\n {\n return null;\n }\n\n return this.isFullDay() ?\n this.getFullSpan( start ) :\n this.getTimeSpan( start, this.times[ 0 ] );\n }\n\n /**\n * Determines whether this schedule produces a single event, and no more.\n * If this schedule has any includes, it's assumed to be a multiple event\n * schedule. A single event can be detected in the following scenarios where\n * each frequency has a single occurrence (see [[Schedule.isSingleFrequency]]).\n *\n * - year, day of year\n * - year, month, day of month\n * - year, month, week of month, day of week\n * - year, week of year, day of week\n *\n * @returns `true` if this schedule produces a single event, otherwise `false`.\n */\n public isSingleEvent(): boolean\n {\n // 0 = full day, 1 = once a day, 1+ = multiple events a day\n if (this.times.length > 1)\n {\n return false;\n }\n\n // Let's assume if there are includes, this is not a single event.\n if (!this.include.isEmpty())\n {\n return false;\n }\n\n // If this can occur on multiple years, not a single event.\n if (!this.isSingleYear())\n {\n return false;\n }\n\n // If this is a specific year and day of the year: single!\n if (this.isSingleDayOfYear())\n {\n return true;\n }\n\n // If this is a specific year, month, and day of month: single!\n if (this.isSingleMonth() && this.isSingleDayOfMonth())\n {\n return true;\n }\n\n // If this is a specific year, month, week of the month, day of the week: single!\n if (this.isSingleMonth() && this.isSingleWeekOfMonth() && this.isSingleDayOfWeek())\n {\n return true;\n }\n\n // If this is a specific year, week of the year, day of the week: single!\n if (this.isSingleWeekOfYear() && this.isSingleDayOfWeek())\n {\n return true;\n }\n\n // Doesn't look like a single event.\n return false;\n }\n\n /**\n * @returns `true` if this schedule produces events only in a specific year.\n * @see [[Schedule.year]]\n */\n public isSingleYear(): boolean\n {\n return this.isSingleFrequency( this.year );\n }\n\n /**\n * @returns `true` if this schedule produces events only in a specific month.\n * @see [[Schedule.month]]\n */\n public isSingleMonth(): boolean\n {\n return this.isSingleFrequency( this.month );\n }\n\n /**\n * @returns `true` if this schedule produces events only in a specific day of\n * the month.\n * @see [[Schedule.dayOfMonth]]\n * @see [[Schedule.lastDayOfMonth]]\n */\n public isSingleDayOfMonth(): boolean\n {\n return this.isSingleFrequency( this.dayOfMonth ) ||\n this.isSingleFrequency( this.lastDayOfMonth );\n }\n\n /**\n * @returns `true` if this schedule produces events only in a specific day of\n * the week.\n * @see [[Schedule.dayOfWeek]]\n */\n public isSingleDayOfWeek(): boolean\n {\n return this.isSingleFrequency( this.dayOfWeek );\n }\n\n /**\n * @returns `true` if this schedule produces events only in a specific day of\n * the year.\n * @see [[Schedule.dayOfYear]]\n */\n public isSingleDayOfYear(): boolean\n {\n return this.isSingleFrequency( this.dayOfYear );\n }\n\n /**\n * @returns `true` if this schedule produces events only in a specific week of\n * the month.\n * @see [[Schedule.weekspanOfMonth]]\n * @see [[Schedule.fullWeekOfMonth]]\n * @see [[Schedule.weekOfMonth]]\n * @see [[Schedule.lastFullWeekOfMonth]]\n * @see [[Schedule.lastWeekspanOfMonth]]\n */\n public isSingleWeekOfMonth(): boolean\n {\n return this.isSingleFrequency( this.weekspanOfMonth ) ||\n this.isSingleFrequency( this.fullWeekOfMonth ) ||\n this.isSingleFrequency( this.weekOfMonth ) ||\n this.isSingleFrequency( this.lastFullWeekOfMonth ) ||\n this.isSingleFrequency( this.lastWeekspanOfMonth );\n }\n\n /**\n * @returns `true` if this schedule produces events only in a specific week of\n * the year.\n * @see [[Schedule.weekspanOfYear]]\n * @see [[Schedule.fullWeekOfYear]]\n * @see [[Schedule.week]]\n * @see [[Schedule.weekOfYear]]\n * @see [[Schedule.lastFullWeekOfYear]]\n * @see [[Schedule.lastWeekspanOfYear]]\n */\n public isSingleWeekOfYear(): boolean\n {\n return this.isSingleFrequency( this.weekspanOfYear ) ||\n this.isSingleFrequency( this.fullWeekOfYear ) ||\n this.isSingleFrequency( this.week ) ||\n this.isSingleFrequency( this.weekOfYear ) ||\n this.isSingleFrequency( this.lastFullWeekOfYear ) ||\n this.isSingleFrequency( this.lastWeekspanOfYear );\n }\n\n /**\n * Determines if the given [[FrequencyCheck]] results in a single occurrence.\n *\n * @returns `true` if the frequency results in a single event, otherwise `false`.\n */\n public isSingleFrequency(frequency: FrequencyCheck): boolean\n {\n return fn.isArray( frequency.input ) && (frequency.input).length === 1;\n }\n\n /**\n * Creates a forecast for this schedule which returns a number of event\n * occurrences around a given day. A single item could be returned per day, or\n * you could get an item for each timed event occurrence.\n *\n * @param around The day to find a forecast around.\n * @param covers If `true` spans which span multiple days will be looked at\n * to see if they intersect with the given day, otherwise `false` will\n * only look at the given day for the start of events.\n * @param daysAfter The number of events to return before the given day.\n * @param daysBefore The number of events to return after the given day.\n * @param times If timed events should be returned, or only one for each day.\n * @param lookAround How many days to look before and after the given day for\n * event occurrences.\n * @returns A new iterator which provides the event occurence span, the day it\n * starts (or is covered if `covers` is `true`), and the identifier for the\n * event.\n */\n public forecast(around: Day,\n covers: boolean = true,\n daysAfter: number,\n daysBefore: number = daysAfter,\n times: boolean = false,\n lookAround: number = 366): Iterator\n {\n let type: Identifier = this.identifierType;\n\n let tuplesForDay = (day: Day, tuples: Iterator): boolean =>\n {\n let spans: DaySpan[] = this.iterateSpans( day, covers ).list();\n let last: number = times ? spans.length : Math.min( 1, spans.length );\n let offset: number = times ? 0 : spans.length - 1;\n\n for (let i = 0; i < last; i++)\n {\n let span: DaySpan = spans[ i + offset ];\n let id: IdentifierInput = type.get( span.start );\n\n if (tuples.act( [ span, day, id ] ) === IteratorAction.Stop)\n {\n return false;\n }\n }\n\n return true;\n };\n\n let prev = new Iterator(iterator =>\n {\n let curr: Day = around;\n\n for (let i = 0; i < lookAround; i++)\n {\n if (!tuplesForDay( curr, iterator ))\n {\n break;\n }\n\n curr = curr.prev();\n }\n });\n\n let next = new Iterator(iterator =>\n {\n let curr: Day = around;\n\n for (let i = 0; i < lookAround; i++)\n {\n curr = curr.next();\n\n if (!tuplesForDay( curr, iterator ))\n {\n break;\n }\n }\n });\n\n return prev.take( daysBefore + 1 ).reverse().append( next.take( daysAfter ) );\n }\n\n /**\n * Iterates timed events that were explicitly specified on the given day.\n * Those events could span multiple days so may be tested against another day.\n *\n * @param day The day to look for included timed events.\n * @param matchAgainst The day to test against the timed event.\n * @returns A new Iterator for all the included spans found.\n */\n public iterateIncludeTimes(day: Day, matchAgainst: Day = day): Iterator\n {\n let isIncludedTime = (result: [IdentifierInput, boolean]) =>\n {\n let [id, included] = result;\n\n return included && Identifier.Time.is( id );\n };\n\n let getSpan = (result: [IdentifierInput, boolean]) =>\n {\n let [id] = result;\n let time: Day = Identifier.Time.start( id );\n let span: DaySpan = this.getTimeSpan( time, time.asTime() );\n\n if (span.matchesDay( matchAgainst ))\n {\n return span;\n }\n };\n\n return this.include.query( day.dayIdentifier ).map( getSpan, isIncludedTime );\n }\n\n /**\n * Converts the schedule instance back into input.\n *\n * @param returnDays When `true` the start, end, and array of exclusions will\n * have [[Day]] instances, otherwise the UTC timestamp and dayIdentifiers\n * will be used when `false`.\n * @param returnTimes When `true` the times returned in the input will be\n * instances of [[Time]] otherwise the `timeFormat` is used to convert the\n * times to strings.\n * @param timeFormat The time format to use when returning the times as strings.\n * @param alwaysDuration If the duration values (`duration` and\n * `durationUnit`) should always be returned in the input.\n * @returns The input that describes this schedule.\n * @see [[Schedule.getExclusions]]\n * @see [[Time.format]]\n */\n public toInput(returnDays: boolean = false, returnTimes: boolean = false, timeFormat: string = '', alwaysDuration: boolean = false): ScheduleInput\n {\n let defaultUnit: string = Constants.DURATION_DEFAULT_UNIT( this.isFullDay() );\n let exclusions: IdentifierInput[] = this.exclude.identifiers(v => v).list();\n let inclusions: IdentifierInput[] = this.include.identifiers(v => v).list();\n let cancels: IdentifierInput[] = this.cancel.identifiers(v => v).list();\n let hasMeta: boolean = !this.meta.isEmpty();\n let out: ScheduleInput = {};\n let times: TimeInput[] = [];\n\n for (let time of this.times)\n {\n times.push( returnTimes ? time : (timeFormat ? time.format( timeFormat ) : time.toString()) );\n }\n\n if (this.start) out.start = returnDays ? this.start : this.start.time;\n if (this.end) out.end = returnDays ? this.end : this.end.time;\n if (times.length) out.times = times;\n if (alwaysDuration || this.duration !== Constants.DURATION_DEFAULT) out.duration = this.duration;\n if (alwaysDuration || this.durationUnit !== defaultUnit) out.durationUnit = this.durationUnit;\n if (exclusions.length) out.exclude = exclusions;\n if (inclusions.length) out.include = inclusions;\n if (cancels.length) out.cancel = cancels;\n if (hasMeta) out.meta = this.meta.map;\n if (this.dayOfWeek.input) out.dayOfWeek = this.dayOfWeek.input;\n if (this.dayOfMonth.input) out.dayOfMonth = this.dayOfMonth.input;\n if (this.lastDayOfMonth.input) out.lastDayOfMonth = this.lastDayOfMonth.input;\n if (this.dayOfYear.input) out.dayOfYear = this.dayOfYear.input;\n if (this.year.input) out.year = this.year.input;\n if (this.month.input) out.month = this.month.input;\n if (this.week.input) out.week = this.week.input;\n if (this.weekOfYear.input) out.weekOfYear = this.weekOfYear.input;\n if (this.weekspanOfYear.input) out.weekspanOfYear = this.weekspanOfYear.input;\n if (this.fullWeekOfYear.input) out.fullWeekOfYear = this.fullWeekOfYear.input;\n if (this.lastWeekspanOfYear.input) out.lastWeekspanOfYear = this.lastWeekspanOfYear.input;\n if (this.lastFullWeekOfYear.input) out.lastFullWeekOfYear = this.lastFullWeekOfYear.input;\n if (this.weekOfMonth.input) out.weekOfMonth = this.weekOfMonth.input;\n if (this.weekspanOfMonth.input) out.weekspanOfMonth = this.weekspanOfMonth.input;\n if (this.fullWeekOfMonth.input) out.fullWeekOfMonth = this.fullWeekOfMonth.input;\n if (this.lastWeekspanOfMonth.input) out.lastWeekspanOfMonth = this.lastWeekspanOfMonth.input;\n if (this.lastFullWeekOfMonth.input) out.lastFullWeekOfMonth = this.lastFullWeekOfMonth.input;\n\n return out;\n }\n\n /**\n * Describes the schedule in a human friendly string taking into account all\n * possible values specified in this schedule.\n *\n * @param thing A brief description of the things (events) on the schedule.\n * @param includeRange When `true` the [[Schedule.start]] and [[Schedule.end]]\n * are possibly included in the description if they have values.\n * @param includeTimes When `true` the [[Schedule.times]] are possibly included\n * in the description.\n * @param includeDuration When `true` the [[Schedule.duration]] and\n * [[Schedule.durationUnit]] are added to the description if\n * [[Schedule.duration]] is not equal to `1`.\n * @param includeExcludes When `true` the [[Schedule.exclude]] are added\n * to the description if there are any.\n * @param includeIncludes When `true` the [[Schedule.include]] are added\n * to the description if there are any.\n * @param includeCancels When `true` the [[Schedule.cancel]] are added\n * to the description if there are any.\n * @returns The descroption of the schedule.\n */\n public describe(thing: string = 'event',\n includeRange: boolean = true,\n includeTimes: boolean = true,\n includeDuration: boolean = false,\n includeExcludes: boolean = false,\n includeIncludes: boolean = false,\n includeCancels: boolean = false): string\n {\n let out: string = '';\n\n if (includeRange)\n {\n if (this.start)\n {\n out += 'Starting on ' + this.start.format('dddd Do, YYYY');\n\n if (this.end)\n {\n out += ' and ending on ' + this.end.format('dddd Do, YYYY');\n }\n }\n else if (this.end)\n {\n out += 'Up until ' + this.end.format('dddd Do, YYYY');\n }\n }\n\n if (out)\n {\n out += ' the ' + thing + ' will occur';\n }\n else\n {\n out += 'The ' + thing + ' will occur';\n }\n\n out += this.describeRule( this.dayOfWeek.input, 'day of the week', x => moment.weekdays()[x], 1, false);\n out += this.describeRule( this.lastDayOfMonth.input, 'last day of the month', x => Suffix.CACHE[x] );\n out += this.describeRule( this.dayOfMonth.input, 'day of the month', x => Suffix.CACHE[x] );\n out += this.describeRule( this.dayOfYear.input, 'day of the year', x => Suffix.CACHE[x], 1 );\n out += this.describeRule( this.year.input, 'year', x => x, 0, false, ' in ' );\n out += this.describeRule( this.month.input, 'month', x => moment.months()[x], 0, false, ' in ' );\n out += this.describeRule( this.weekOfYear.input, 'week of the year', x => Suffix.CACHE[x] );\n out += this.describeRule( this.weekspanOfYear.input, 'weekspan of the year', x => Suffix.CACHE[x + 1], 1 );\n out += this.describeRule( this.fullWeekOfYear.input, 'full week of the year', x => Suffix.CACHE[x] );\n out += this.describeRule( this.lastWeekspanOfYear.input, 'last weekspan of the year', x => Suffix.CACHE[x + 1], 1 );\n out += this.describeRule( this.lastFullWeekOfYear.input, 'last full week of the year', x => Suffix.CACHE[x] );\n out += this.describeRule( this.weekOfMonth.input, 'week of the month', x => Suffix.CACHE[x] );\n out += this.describeRule( this.fullWeekOfMonth.input, 'full week of the month', x => Suffix.CACHE[x] );\n out += this.describeRule( this.weekspanOfMonth.input, 'weekspan of the month', x => Suffix.CACHE[x + 1], 1 );\n out += this.describeRule( this.lastFullWeekOfMonth.input, 'last full week of the month', x => Suffix.CACHE[x] );\n out += this.describeRule( this.lastWeekspanOfMonth.input, 'last weekspan of the month', x => Suffix.CACHE[x + 1], 1 );\n\n if (includeTimes && this.times.length)\n {\n out += ' at ';\n out += this.describeArray( this.times, x => x.format('hh:mm a') );\n }\n\n if (includeDuration && this.duration !== Constants.DURATION_DEFAULT)\n {\n out += ' lasting ' + this.duration + ' ';\n\n if (this.durationUnit)\n {\n out += this.durationUnit + ' ';\n }\n }\n\n if (includeExcludes)\n {\n let excludes: ScheduleModifierSpan[] = this.exclude.spans().list();\n\n if (excludes.length)\n {\n out += ' excluding ';\n out += this.describeArray( excludes, x => x.span.summary(Units.DAY) );\n }\n }\n\n if (includeIncludes)\n {\n let includes: ScheduleModifierSpan[] = this.include.spans().list();\n\n if (includes.length)\n {\n out += ' including ';\n out += this.describeArray( includes, x => x.span.summary(Units.DAY) );\n }\n }\n\n if (includeCancels)\n {\n let cancels: ScheduleModifierSpan[] = this.cancel.spans().list();\n\n if (cancels.length)\n {\n out += ' with cancellations on ';\n out += this.describeArray( cancels, x => x.span.summary(Units.DAY) );\n }\n }\n\n return out;\n }\n\n /**\n * Describes the given frequency.\n *\n * @param value The frequency to describe.\n * @param unit The unit of the frequency.\n * @param map How the values in the frequency should be described.\n * @param everyOffset A value to add to a [[FrequencyValueEvery]] offset to\n * account for zero-based values that should be shifted for human\n * friendliness.\n * @param the If the word 'the' should be used to describe the unit.\n * @param on The word which preceeds values of the given unit.\n * @param required If the description should always return a non-empty string\n * even if the frequency was not specified in the original input.\n * @returns A string description of the frequency.\n */\n private describeRule(value: FrequencyValue, unit: string, map: (x: number) => any, everyOffset: number = 0, the: boolean = true, on: string = ' on ', required: boolean = false): string\n {\n let out: string = '';\n let suffix: string = the ? ' ' + unit : '';\n\n if (fn.isFrequencyValueEvery(value))\n {\n let valueEvery: FrequencyValueEvery = value;\n\n out += ' every ' + Suffix.CACHE[ valueEvery.every ] + ' ' + unit;\n\n if (valueEvery.offset)\n {\n out += ' starting at ' + map( valueEvery.offset + everyOffset ) + suffix;\n }\n }\n else if (fn.isFrequencyValueOneOf(value))\n {\n let valueOne: FrequencyValueOneOf = value;\n\n if (valueOne.length)\n {\n out += on + (the ? 'the ' : '');\n out += this.describeArray( valueOne, map );\n out += suffix;\n }\n }\n else if (required)\n {\n out += on + 'any ' + unit;\n }\n\n return out;\n }\n\n /**\n * Describes the array by adding commas where appropriate and 'and' before the\n * last value of the array (if its more than `1`).\n *\n * @param array The array of items to describe.\n * @param map The function which converts an item to a string.\n * @returns The final description of the array items.\n */\n private describeArray(array: T[], map: (item: T) => string): string\n {\n let out: string = '';\n let last: number = array.length - 1;\n\n out += map( array[ 0 ] );\n\n for (let i = 1; i < last; i++)\n {\n out += ', ' + map( array[ i ] );\n }\n\n if (last > 0)\n {\n out += ' and ' + map( array[ last ] );\n }\n\n return out;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Schedule.ts","\nimport { Schedule, ScheduleInput } from './Schedule';\n\n/**\n * The input which can be passed to the calendar when adding a schedule and event.\n *\n * @typeparam T The type of data stored in the [[Event]] class.\n * @typeparam M The type of metadata stored in the schedule.\n */\nexport interface EventInput\n{\n id?: any;\n data?: T;\n schedule: ScheduleInput | Schedule;\n}\n\n/**\n * A pairing of a user specified event object and the schedule which defines\n * when it occurs on a calendar.\n *\n * @typeparam T The type of data stored in the [[Event]] class.\n * @typeparam M The type of metadata stored in the schedule.\n */\nexport class Event\n{\n\n /**\n * User specified ID which can be used to find or remove this event from a\n * Calendar.\n */\n public id: any;\n\n /**\n * User specified object which describes this event.\n */\n public data: T;\n\n /**\n * The schedule which defines when this event occurs.\n */\n public schedule: Schedule;\n\n /**\n * If the event is visible on the calendar.\n */\n public visible: boolean;\n\n /**\n * Creates a new event.\n *\n * @param schedule The schedule which defines when the event occurs.\n * @param data User specified object which describes this event.\n * @param id User specified ID which identifies this event.\n */\n public constructor(schedule: Schedule, data?: T, id?: any, visible: boolean = true)\n {\n this.schedule = schedule;\n this.data = data;\n this.id = id;\n this.visible = visible;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Event.ts","\nimport { Functions as fn } from './Functions';\nimport { Constants } from './Constants';\nimport { Parse } from './Parse';\n\n\n/**\n * A value that can possibly be parsed into a Time instance.\n *\n * @see [[Time.parse]]\n */\nexport type TimeInput = Time | number | string | {hour: number, minute?: number, second?: number, millisecond?: number};\n\n/**\n * A class which holds a specific time during in any day.\n */\nexport class Time\n{\n\n /**\n * The regular expression used to parse a time from a string.\n *\n * - ## = hour\n * - ##:## = hour & minute\n * - ##:##:## = hour, minute, & second\n * - ##:##:##.### = hour, minute, second, and milliseconds\n */\n public static REGEX = /^(\\d\\d?):?(\\d\\d)?:?(\\d\\d)?\\.?(\\d\\d\\d)?$/;\n\n /**\n * The hour between 0 and 23\n */\n public hour: number;\n\n /**\n * The minute between 0 and 59\n */\n public minute: number;\n\n /**\n * The second between 0 and 59\n */\n public second: number;\n\n /**\n * The millisecond between 0 and 999\n */\n public millisecond: number;\n\n\n /**\n * Creates a new Time instance given an hour and optionally a minute, second,\n * and millisecond. If they have not been specified they default to 0.\n *\n * @param hour The hour.\n * @param minute The minute.\n * @param second The second.\n * @param millisecond The millisecond.\n */\n public constructor(hour: number, minute: number = Constants.MINUTE_MIN, second: number = Constants.SECOND_MIN, millisecond: number = Constants.MILLIS_MIN)\n {\n this.hour = hour;\n this.minute = minute;\n this.second = second;\n this.millisecond = millisecond;\n }\n\n /**\n * Formats this time into a string. The following list describes the available\n * formatting patterns:\n *\n * ### Hour\n * - H: 0-23\n * - HH: 00-23\n * - h: 12,1-12,1-11\n * - hh: 12,01-12,01-11\n * - k: 1-24\n * - kk: 01-24\n * - a: am,pm\n * - A: AM,PM\n * ### Minute\n * - m: 0-59\n * - mm: 00-59\n * ### Second\n * - s: 0-59\n * - ss: 00-59\n * ### Millisecond\n * - S: 0-9\n * - SS: 00-99\n * - SSS: 000-999\n *\n * @param format The format to output.\n * @returns The formatted time.\n */\n public format(format: string): string\n {\n let formatterEntries = Time.FORMATTERS;\n let out: string = '';\n\n for (let i = 0; i < format.length; i++)\n {\n let handled: boolean = false;\n\n for (let k = 0; k < formatterEntries.length && !handled; k++)\n {\n let entry = formatterEntries[ k ];\n let part: string = format.substring( i, i + entry.size );\n\n if (part.length === entry.size)\n {\n let formatter = entry.formats[ part ];\n\n if (formatter)\n {\n out += formatter(this);\n i += entry.size - 1;\n handled = true;\n }\n }\n }\n\n if (!handled)\n {\n out += format.charAt(i);\n }\n }\n\n return out;\n }\n\n /**\n * @returns The number of milliseconds from the start of the day until this\n * time.\n */\n public toMilliseconds(): number\n {\n return this.hour * Constants.MILLIS_IN_HOUR +\n this.minute * Constants.MILLIS_IN_MINUTE +\n this.second * Constants.MILLIS_IN_SECOND +\n this.millisecond;\n }\n\n /**\n * @returns The time formatted using the smallest format that completely\n * represents this time.\n */\n public toString(): string\n {\n if (this.millisecond) return this.format('HH:mm:ss.SSS');\n if (this.second) return this.format('HH:mm:ss');\n if (this.minute) return this.format('HH:mm');\n\n return this.format('HH');\n }\n\n /**\n * @returns A unique identifier for this time. The number returned is in the\n * following format: SSSssmmHH\n */\n public toIdentifier(): number\n {\n return this.hour +\n this.minute * 100 +\n this.second * 10000 +\n this.millisecond * 10000000;\n }\n\n /**\n * @returns An object with hour, minute, second, a millisecond properties if\n * they are non-zero on this time.\n */\n public toObject(): TimeInput\n {\n let out: TimeInput = {\n hour: this.hour\n };\n\n if (this.minute) out.minute = this.minute;\n if (this.second) out.second = this.second;\n if (this.millisecond) out.millisecond = this.millisecond;\n\n return out;\n }\n\n /**\n * Parses a value and tries to convert it to a Time instance.\n *\n * @param input The input to parse.\n * @returns The instance parsed or `null` if it was invalid.\n * @see [[Parse.time]]\n */\n public static parse(input: any): Time\n {\n return Parse.time(input);\n }\n\n /**\n * Parses a string and converts it to a Time instance. If the string is not\n * in a valid format `null` is returned.\n *\n * @param time The string to parse.\n * @returns The instance parsed or `null` if it was invalid.\n * @see [[Time.REGEX]]\n */\n public static fromString(time: string): Time\n {\n let matches: string[] = this.REGEX.exec( time );\n\n if (!matches)\n {\n return null;\n }\n\n let h: number = parseInt(matches[1]) || 0;\n let m: number = parseInt(matches[2]) || 0;\n let s: number = parseInt(matches[3]) || 0;\n let l: number = parseInt(matches[4]) || 0;\n\n return this.build(h, m, s, l);\n }\n\n /**\n * Parses a number and converts it to a Time instance. The number is assumed\n * to be in the [[Time.toIdentifier]] format.\n *\n * @param time The number to parse.\n * @returns The instance parsed.\n */\n public static fromIdentifier(time: number): Time\n {\n let h: number = time % 100;\n let m: number = Math.floor(time / 100) % 100;\n let s: number = Math.floor(time / 10000) % 100;\n let l: number = Math.floor(time / 10000000) % 1000;\n\n return this.build(h, m, s, l);\n }\n\n /**\n * Returns a new instance given an hour and optionally a minute, second,\n * and millisecond. If they have not been specified they default to 0.\n *\n * @param hour The hour.\n * @param minute The minute.\n * @param second The second.\n * @param millisecond The millisecond.\n * @returns A new instance.\n */\n public static build(hour: number, minute: number = Constants.MINUTE_MIN, second: number = Constants.SECOND_MIN, millisecond: number = Constants.MILLIS_MIN): Time\n {\n return new Time(hour, minute, second, millisecond)\n }\n\n /**\n * A set of formatting functions keyed by their format string.\n */\n public static FORMATTERS = [\n {\n size: 3,\n formats: {\n SSS: (t: Time) => fn.padNumber(t.millisecond, 3)\n }\n },\n {\n size: 2,\n formats: {\n HH: (t: Time) => fn.padNumber(t.hour, 2),\n hh: (t: Time) => fn.padNumber((t.hour % 12) || 12, 2),\n kk: (t: Time) => fn.padNumber(t.hour + 1, 2),\n mm: (t: Time) => fn.padNumber(t.minute, 2),\n ss: (t: Time) => fn.padNumber(t.second, 2),\n SS: (t: Time) => fn.padNumber(t.millisecond, 3, 2)\n }\n },\n {\n size: 1,\n formats: {\n A: (t: Time) => t.hour < 12 ? 'AM' : 'PM',\n a: (t: Time) => t.hour < 12 ? 'am' : 'pm',\n H: (t: Time) => t.hour + '',\n h: (t: Time) => ((t.hour % 12) || 12) + '',\n k: (t: Time) => (t.hour + 1) + '',\n m: (t: Time) => t.minute + '',\n s: (t: Time) => t.second + '',\n S: (t: Time) => fn.padNumber(t.millisecond, 3, 1)\n }\n }\n ];\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Time.ts","\nimport { Functions as fn } from './Functions';\nimport { FrequencyCheck } from './Frequency';\nimport { Schedule, ScheduleInput } from './Schedule';\nimport { ScheduleModifier } from './ScheduleModifier';\nimport { Constants } from './Constants';\nimport { Day, DayProperty, DayInput, DurationInput } from './Day';\nimport { Event } from './Event';\nimport { Time } from './Time';\n\n\n/**\n * The class which takes user input and parses it to specific structures.\n */\nexport class Parse\n{\n\n /**\n * Parses a value and converts it to a [[FrequencyCheck]].\n *\n * @param input The input to parse into a function.\n * @param property The [[Day]] property the frequency is for.\n * @returns A function which determines whether a value matches a frequency.\n * @see [[Schedule]]\n */\n public static frequency(input: any, property: DayProperty): FrequencyCheck\n {\n let check: FrequencyCheck = (value: number) => {\n return true;\n };\n\n check.given = false;\n\n if (fn.isFrequencyValueEvery(input))\n {\n let every: number = input.every;\n let offset: number = (input.offset || 0) % every;\n\n check = (value: number) => {\n return value % every === offset;\n };\n check.given = true;\n }\n\n if (fn.isFrequencyValueOneOf(input))\n {\n let map: object = {};\n\n for (let i = 0; i < input.length; i++) {\n map[ input[ i ] ] = true;\n }\n\n check = (value: number) => {\n return !!map[ value ];\n };\n check.given = true;\n }\n\n check.input = input;\n check.property = property;\n\n return check;\n }\n\n /**\n * Parses [[DayInput]] into a [[Day]] instance.\n *\n * ```typescript\n * Parse.day( 65342300 ); // UTC timestamp\n * Parse.day( '01/02/2014' ); // strings in many formats\n * Parse.day( day ); // return a passed instance\n * Parse.day( [2018, 0, 2] ); // array: 01/02/2018\n * Parse.day( {year: 2018, month: 2} ); // object: 03/01/2018\n * Parse.day( true ); // today\n * ```\n *\n * @param input The input to parse.\n * @returns The Day parsed or `null` if the value is not valid.\n */\n public static day(input: DayInput): Day\n {\n if (fn.isNumber(input))\n {\n return Day.unix( input );\n }\n else if (fn.isString(input))\n {\n return Day.fromString( input );\n }\n else if (input instanceof Day)\n {\n return input;\n }\n else if (fn.isArray( input ))\n {\n return Day.fromArray( input );\n }\n else if (fn.isObject( input ))\n {\n return Day.fromObject( input );\n }\n else if (input === true)\n {\n return Day.today();\n }\n\n return null;\n }\n\n /**\n * Parses a value and tries to convert it to a Time instance.\n *\n * ```typescript\n * Parse.time( time ); // return a passed instance\n * Parse.time( 9 ); // 09:00:00.000\n * Parse.time( 3009 ); // 09:30:00.000\n * Parse.time( 593009 ); // 09:30:59.000\n * Parsetime( '09' ); // 09:00:00.000\n * Parse.time( '9:30' ); // 09:30:00.000\n * Parse.time( '9:30:59' ); // 09:30:59.000\n * Parse.time( {hour: 2} ); // 02:00:00.000\n * ```\n *\n * @param input The input to parse.\n * @returns The instance parsed or `null` if it was invalid.\n * @see [[Time.fromIdentifier]]\n * @see [[Time.fromString]]\n */\n public static time(input: any): Time\n {\n if (input instanceof Time)\n {\n return input;\n }\n if (fn.isNumber(input))\n {\n return Time.fromIdentifier( input );\n }\n if (fn.isString(input))\n {\n return Time.fromString( input );\n }\n if (fn.isObject(input) && fn.isNumber(input.hour))\n {\n return new Time(input.hour, input.minute, input.second, input.millisecond);\n }\n\n return null;\n }\n\n /**\n * Parses a value and tries to convert it to an array of Time instances.\n * If any of the given values are not a valid time value then the resulting\n * array will not contain a time instance.\n *\n * @param input The input to parse.\n * @returns A non-null array of time instances.\n * @see [[Parse.time]]\n */\n public static times(input: any): Time[]\n {\n let times: Time[] = [];\n\n if (fn.isArray(input))\n {\n for (let timeInput of input)\n {\n let time = this.time( timeInput );\n\n if (time)\n {\n times.push( time );\n }\n }\n\n // Sort times from earliest to latest.\n times.sort((a, b) =>\n {\n return a.toMilliseconds() - b.toMilliseconds();\n });\n }\n\n return times;\n }\n\n /**\n * Parses an array of excluded days into a map of excluded days where the\n * array value and returned object key are [[Day.dayIdentifier]].\n *\n * ```typescript\n * Parse.modifier( [ 20180101, 20140506 ] ); // {'20180101': true, '20140506': true}\n * Parse.modifier( [ 20180101, Day.build(2014,4,6) ] ); // {'20180101': true, '20140506': true}\n * ```\n *\n * @param input The input to parse.\n * @param value The default value if the input given is an array of identifiers.\n * @param parseMeta A function to use to parse a modifier.\n * @param out The modifier to set the identifiers and values of and return.\n * @returns The object with identifier keys and `true` values.\n * @see [[Day.dayIdentifier]]\n */\n public static modifier(input: any, value: T,\n parseMeta: (input: any) => T = (x => x),\n out: ScheduleModifier = new ScheduleModifier()): ScheduleModifier\n {\n let map = {};\n\n if (fn.isArray(input))\n {\n for (let identifier of input)\n {\n if (identifier instanceof Day)\n {\n map[ identifier.dayIdentifier ] = value;\n }\n else if (fn.isNumber(identifier))\n {\n map[ identifier ] = value;\n }\n else if (fn.isString(identifier))\n {\n map[ identifier ] = value;\n }\n }\n }\n\n if (fn.isObject(input))\n {\n for (let identifier in input)\n {\n map[ identifier ] = parseMeta( input[ identifier ] );\n }\n }\n\n out.map = map;\n\n return out;\n }\n\n /**\n * Parses an object which specifies a schedule where events may or may not\n * repeat and they may be all day events or at specific times.\n *\n * @param input The input to parse into a schedule.\n * @param parseMeta A function to use when parsing meta input into the desired type.\n * @param out The schedule to set the values of and return.\n * @returns An instance of the parsed [[Schedule]].\n */\n public static schedule(input: ScheduleInput | Schedule,\n parseMeta: (input: any) => M = (x => x),\n out: Schedule = new Schedule()): Schedule\n {\n if (input instanceof Schedule)\n {\n return input;\n }\n\n let on: Day = this.day( input.on );\n let times: Time[] = this.times( input.times );\n let fullDay: boolean = times.length === 0;\n\n if (on)\n {\n input.start = on.start();\n input.end = on.end();\n input.year = [on.year];\n input.month = [on.month];\n input.dayOfMonth = [on.dayOfMonth];\n }\n\n out.times = times;\n out.duration = fn.coalesce( input.duration, Constants.DURATION_DEFAULT );\n out.durationUnit = fn.coalesce( input.durationUnit, Constants.DURATION_DEFAULT_UNIT( fullDay ) );\n out.start = this.day( input.start );\n out.end = this.day( input.end );\n out.exclude = this.modifier( input.exclude, true, undefined, out.exclude );\n out.include = this.modifier( input.include, true, undefined, out.include );\n out.cancel = this.modifier( input.cancel, true, undefined, out.cancel );\n out.meta = this.modifier( input.meta, null, parseMeta, out.meta );\n out.year = this.frequency( input.year, 'year' );\n out.month = this.frequency( input.month, 'month' );\n out.week = this.frequency( input.week, 'week' );\n out.weekOfYear = this.frequency( input.weekOfYear, 'weekOfYear' );\n out.weekspanOfYear = this.frequency( input.weekspanOfYear, 'weekspanOfYear' );\n out.fullWeekOfYear = this.frequency( input.fullWeekOfYear, 'fullWeekOfYear' );\n out.lastWeekspanOfYear = this.frequency( input.lastWeekspanOfYear, 'lastWeekspanOfYear' );\n out.lastFullWeekOfYear = this.frequency( input.lastFullWeekOfYear, 'lastFullWeekOfYear' );\n out.weekOfMonth = this.frequency( input.weekOfMonth, 'weekOfMonth' );\n out.weekspanOfMonth = this.frequency( input.weekspanOfMonth, 'weekspanOfMonth' );\n out.fullWeekOfMonth = this.frequency( input.fullWeekOfMonth, 'fullWeekOfMonth' );\n out.lastWeekspanOfMonth = this.frequency( input.lastWeekspanOfMonth, 'lastWeekspanOfMonth' );\n out.lastFullWeekOfMonth = this.frequency( input.lastFullWeekOfMonth, 'lastFullWeekOfMonth' );\n out.dayOfWeek = this.frequency( input.dayOfWeek, 'dayOfWeek' );\n out.dayOfMonth = this.frequency( input.dayOfMonth, 'dayOfMonth' );\n out.lastDayOfMonth = this.frequency( input.lastDayOfMonth, 'lastDayOfMonth' );\n out.dayOfYear = this.frequency( input.dayOfYear, 'dayOfYear' );\n out.updateDurationInDays();\n out.updateChecks();\n\n return out;\n }\n\n /**\n * Parses an array of [[FrequencyCheck]] functions and returns an array of\n * functions for only the checks that were specified by the user.\n *\n * @param checks The array of check functions to filter through.\n * @returns The array of user specified checks.\n */\n public static givenFrequency(checks: FrequencyCheck[]): FrequencyCheck[]\n {\n let out: FrequencyCheck[] = [];\n\n for (let check of checks)\n {\n if (check.given)\n {\n out.push( check );\n }\n }\n\n return out;\n }\n\n /**\n * Parses [[EventInput]] and returns an [[Event]].\n *\n * @param input The input to parse.\n * @param parseData A function to use when parsing data input into the desired type.\n * @param parseMeta A function to use when parsing meta input into the desired type.\n * @returns The parsed value.\n */\n public static event(input: any,\n parseData: (input: any) => T = (x => x),\n parseMeta: (input: any) => M = (x => x)): Event\n {\n if (input instanceof Event)\n {\n return input;\n }\n\n if (!input.schedule)\n {\n return null;\n }\n\n let schedule: Schedule = this.schedule( input.schedule, parseMeta );\n\n return new Event( schedule, parseData( input.data ), input.id, input.visible );\n }\n\n /**\n * Parses a schedule from a CRON pattern. TODO\n */\n public static cron(pattern: string, out: Schedule = new Schedule()): Schedule\n {\n return out;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Parse.ts","\nimport { Identifier, IdentifierInput } from './Identifier';\nimport { Constants } from './Constants';\nimport { Op, operate } from './Operation';\nimport { Parse } from './Parse';\nimport { Time } from './Time';\n\n// @ts-ignore\nimport * as moment from 'moment';\n\n\n/**\n * Valid durations that can be specified.\n */\nexport type DurationInput = moment.unitOfTime.DurationConstructor;\n\n/**\n * All valid types which may be converted to a [[Day]] instance.\n *\n * - `number`: A UNIX timestamp.\n * - `string`: A string representation of a date.\n * - `Day`: An existing [[Day]] instance.\n * - `number[]`: An array of numbers specifying any of: [year, month, dayOfMonth, hour, minute, second, millisecond].\n * - `object`: An object with any of the following properties: year, month, dayOfMonth, hour, minute, second, millisecond.\n * - `true`: This will be interpreted as [[Day.today]]\n */\nexport type DayInput = number | string | Day | number[] | object | true;\n\n/**\n * One of the properties on the [[Day]] object.\n */\nexport type DayProperty = keyof Day;\n\n/**\n * A class which represents a point in time as\n */\nexport class Day\n{\n\n /**\n *\n */\n public readonly date: moment.Moment;\n\n /**\n *\n */\n public readonly time: number;\n\n /**\n *\n */\n public readonly millis: number;\n\n /**\n *\n */\n public readonly seconds: number;\n\n /**\n *\n */\n public readonly minute: number;\n\n /**\n *\n */\n public readonly hour: number;\n\n /**\n *\n */\n public readonly month: number;\n\n /**\n *\n */\n public readonly year: number;\n\n /**\n *\n */\n public readonly quarter: number;\n\n\n /**\n *\n */\n public readonly dayOfWeek: number;\n\n /**\n *\n */\n public readonly dayOfMonth: number;\n\n /**\n *\n */\n public readonly lastDayOfMonth: number;\n\n /**\n *\n */\n public readonly dayOfYear: number;\n\n\n /**\n *\n */\n public readonly week: number;\n\n /**\n *\n */\n public readonly weekOfYear: number;\n\n /**\n *\n */\n public readonly weekspanOfYear: number;\n\n /**\n *\n */\n public readonly fullWeekOfYear: number;\n\n /**\n *\n */\n public readonly lastWeekspanOfYear: number;\n\n /**\n *\n */\n public readonly lastFullWeekOfYear: number;\n\n\n /**\n *\n */\n public readonly weekOfMonth: number;\n\n /**\n *\n */\n public readonly weekspanOfMonth: number;\n\n /**\n *\n */\n public readonly fullWeekOfMonth: number;\n\n /**\n *\n */\n public readonly lastWeekspanOfMonth: number;\n\n /**\n *\n */\n public readonly lastFullWeekOfMonth: number;\n\n\n /**\n *\n */\n public readonly timeIdentifier: IdentifierInput;\n\n /**\n *\n */\n public readonly dayIdentifier: IdentifierInput;\n\n /**\n *\n */\n public readonly weekIdentifier: IdentifierInput;\n\n /**\n *\n */\n public readonly monthIdentifier: IdentifierInput;\n\n /**\n *\n */\n public readonly quarterIdentifier: IdentifierInput;\n\n\n\n /**\n *\n */\n public constructor(date: moment.Moment)\n {\n this.date = date;\n this.time = date.valueOf();\n this.millis = date.millisecond();\n this.seconds = date.second();\n this.minute = date.minute();\n this.hour = date.hour();\n this.month = date.month();\n this.year = date.year();\n this.quarter = date.quarter();\n this.dayOfWeek = date.day();\n this.dayOfMonth = date.date();\n this.dayOfYear = date.dayOfYear();\n this.week = date.week();\n\n this.lastDayOfMonth = Day.getLastDayOfMonth( date );\n this.weekOfYear = Day.getWeekOfYear( date );\n this.weekspanOfYear = Day.getWeekspanOfYear( date );\n this.fullWeekOfYear = Day.getFullWeekOfYear( date );\n this.lastWeekspanOfYear = Day.getLastWeekspanOfYear( date );\n this.lastFullWeekOfYear = Day.getLastFullWeekOfYear( date );\n\n this.weekOfMonth = Day.getWeekOfMonth( date );\n this.weekspanOfMonth = Day.getWeekspanOfMonth( date );\n this.fullWeekOfMonth = Day.getFullWeekOfMonth( date );\n this.lastWeekspanOfMonth = Day.getLastWeekspanOfMonth( date );\n this.lastFullWeekOfMonth = Day.getLastFullWeekOfMonth( date );\n\n this.timeIdentifier = Identifier.Time.get( this );\n this.dayIdentifier = Identifier.Day.get( this);\n this.weekIdentifier = Identifier.Week.get( this);\n this.monthIdentifier = Identifier.Month.get( this);\n this.quarterIdentifier = Identifier.Quarter.get( this );\n }\n\n // Same\n\n /**\n *\n */\n public sameDay(day: Day): boolean\n {\n return this.dayIdentifier === day.dayIdentifier;\n }\n\n /**\n *\n */\n public sameMonth(day: Day): boolean\n {\n return this.monthIdentifier === day.monthIdentifier;\n }\n\n /**\n *\n */\n public sameWeek(day: Day): boolean\n {\n return this.weekIdentifier === day.weekIdentifier;\n }\n\n /**\n *\n */\n public sameYear(day: Day): boolean\n {\n return this.year === day.year;\n }\n\n /**\n *\n */\n public sameQuarter(day: Day): boolean\n {\n return this.quarterIdentifier === day.quarterIdentifier;\n }\n\n /**\n *\n */\n public sameHour(day: Day): boolean {\n return this.dayIdentifier === day.dayIdentifier && this.hour === day.hour;\n }\n\n /**\n *\n */\n public sameMinute(day: Day): boolean {\n return this.timeIdentifier === day.timeIdentifier;\n }\n\n /**\n *\n */\n public sameTime(time: Time): boolean {\n return this.hour === time.hour && this.minute === time.minute && this.seconds === time.second && this.millis === time.millisecond;\n }\n\n // Comparison\n\n /**\n *\n */\n public isBefore(day: Day, precision?: moment.unitOfTime.StartOf): boolean {\n return this.date.isBefore( day.date, precision );\n }\n\n /**\n *\n */\n public isSameOrBefore(day: Day, precision?: moment.unitOfTime.StartOf): boolean {\n return this.date.isSameOrBefore( day.date, precision );\n }\n\n /**\n *\n */\n public isAfter(day: Day, precision?: moment.unitOfTime.StartOf): boolean {\n return this.date.isAfter( day.date, precision );\n }\n\n /**\n *\n */\n public isSameOrAfter(day: Day, precision?: moment.unitOfTime.StartOf): boolean {\n return this.date.isSameOrAfter( day.date, precision );\n }\n\n /**\n *\n */\n public max(day: Day): Day {\n return this.date.isAfter( day.date ) ? this : day;\n }\n\n /**\n *\n */\n public min(day: Day): Day {\n return this.date.isBefore( day.date ) ? this : day;\n }\n\n // Between\n\n public millisBetween(day: Day, op: Op = Op.DOWN, absolute: boolean = true): number {\n return operate( this.date.diff( day.date, 'milliseconds', true ), op, absolute );\n }\n\n public secondsBetween(day: Day, op: Op = Op.DOWN, absolute: boolean = true): number {\n return operate( this.date.diff( day.date, 'seconds', true ), op, absolute );\n }\n\n public minutesBetween(day: Day, op: Op = Op.DOWN, absolute: boolean = true): number {\n return operate( this.date.diff( day.date, 'minutes', true ), op, absolute );\n }\n\n public hoursBetween(day: Day, op: Op = Op.DOWN, absolute: boolean = true): number {\n return operate( this.date.diff( day.date, 'hours', true ), op, absolute );\n }\n\n public daysBetween(day: Day, op: Op = Op.DOWN, absolute: boolean = true): number {\n return operate( this.date.diff( day.date, 'days', true ), op, absolute );\n }\n\n public weeksBetween(day: Day, op: Op = Op.DOWN, absolute: boolean = true): number {\n return operate( this.date.diff( day.date, 'weeks', true ), op, absolute );\n }\n\n public monthsBetween(day: Day, op: Op = Op.DOWN, absolute: boolean = true): number {\n return operate( this.date.diff( day.date, 'months', true ), op, absolute );\n }\n\n public yearsBetween(day: Day, op: Op = Op.DOWN, absolute: boolean = true): number {\n return operate( this.date.diff( day.date, 'years', true ), op, absolute );\n }\n\n public isBetween(start: Day, end: Day, inclusive: boolean = true): boolean {\n return this.date.isBetween(start.date, end.date, null, inclusive ? '[]' : '[)');\n }\n\n public mutate(mutator: (date: moment.Moment) => void): Day {\n var d = this.toMoment();\n mutator( d );\n return new Day( d );\n }\n\n public add(amount: number, unit: string): Day {\n return this.mutate(d => d.add(amount, unit));\n }\n\n public relative(millis: number): Day {\n return this.mutate(d => d.add(millis, 'milliseconds'));\n }\n\n // Days\n\n public relativeDays(days: number): Day {\n return this.mutate(d => d.add(days, 'days'));\n }\n\n public prev(days: number = 1): Day {\n return this.relativeDays( -days );\n }\n\n public next(days: number = 1): Day {\n return this.relativeDays( days );\n }\n\n public withDayOfMonth(day: number): Day {\n return this.mutate(d => d.date(day));\n }\n\n public withDayOfWeek(dayOfWeek: number): Day {\n return this.mutate(d => d.day(dayOfWeek));\n }\n\n public withDayOfYear(dayOfYear: number): Day {\n return this.mutate(d => d.dayOfYear(dayOfYear));\n }\n\n // Month\n\n public withMonth(month: number): Day {\n return this.mutate(d => d.month(month));\n }\n\n public relativeMonths(months: number): Day {\n return this.mutate(d => d.add(months, 'months'));\n }\n\n public prevMonth(months: number = 1): Day {\n return this.relativeMonths( -months );\n }\n\n public nextMonth(months: number = 1): Day {\n return this.relativeMonths( months );\n }\n\n // Week Of Year\n\n public withWeek(week: number, relativeWeek: number = this.week): Day {\n return this.mutate(d => d.add((week - relativeWeek) * Constants.DAYS_IN_WEEK, 'days'));\n }\n\n public withWeekOfYear(week: number): Day {\n return this.withWeek(week, this.weekOfYear);\n }\n\n public withFullWeekOfYear(week: number): Day {\n return this.withWeek(week, this.fullWeekOfYear);\n }\n\n public withWeekspanOfYear(week: number): Day {\n return this.withWeek(week, this.weekspanOfYear);\n }\n\n public withWeekOfMonth(week: number): Day {\n return this.withWeek(week, this.weekOfMonth);\n }\n\n public withWeekspanOfMonth(week: number): Day {\n return this.withWeek(week, this.weekspanOfMonth);\n }\n\n public withFullWeekOfMonth(week: number): Day {\n return this.withWeek(week, this.fullWeekOfMonth);\n }\n\n public relativeWeeks(weeks: number): Day {\n return this.mutate(d => d.add(weeks, 'weeks'));\n }\n\n public prevWeek(weeks: number = 1): Day {\n return this.relativeWeeks( -weeks );\n }\n\n public nextWeek(weeks: number = 1): Day {\n return this.relativeWeeks( weeks );\n }\n\n // Year\n\n public withYear(year: number): Day {\n return this.mutate(d => d.year(year));\n }\n\n public relativeYears(years: number): Day {\n return this.mutate(d => d.add(years, 'year'));\n }\n\n public prevYear(years: number = 1): Day {\n return this.relativeYears( -years );\n }\n\n public nextYear(years: number = 1): Day {\n return this.relativeYears( years );\n }\n\n // Hour\n\n public withHour(hour: number): Day {\n return this.mutate(d => d.hour(hour));\n }\n\n public relativeHours(hours: number): Day {\n return this.mutate(d => d.add(hours, 'hours'));\n }\n\n public prevHour(hours: number = 1): Day {\n return this.relativeHours( -hours );\n }\n\n public nextHour(hours: number = 1): Day {\n return this.relativeHours( hours );\n }\n\n // Time\n\n public withTimes(\n hour: number = Constants.HOUR_MIN,\n minute: number = Constants.MINUTE_MIN,\n second: number = Constants.SECOND_MIN,\n millisecond: number = Constants.MILLIS_MIN): Day {\n return this.mutate(d => d.set({hour, minute, second, millisecond}));\n }\n\n public withTime(time: Time): Day {\n return this.withTimes(time.hour, time.minute, time.second, time.millisecond);\n }\n\n public asTime(): Time {\n return new Time(this.hour, this.minute, this.seconds, this.millis);\n }\n\n // Start & End\n\n // Time\n\n public start(): Day {\n return this.mutate(d => d.startOf('day'));\n }\n\n public isStart(): boolean {\n return this.hour === Constants.HOUR_MIN &&\n this.minute === Constants.MINUTE_MIN &&\n this.seconds === Constants.SECOND_MIN &&\n this.millis === Constants.MILLIS_MIN;\n }\n\n public end(inclusive: boolean = true): Day {\n return inclusive ?\n this.mutate(d => d.endOf('day')) :\n this.mutate(d => d.startOf('day').add(1, 'day'));\n }\n\n public isEnd(): boolean {\n return this.hour === Constants.HOUR_MAX &&\n this.minute === Constants.MINUTE_MAX &&\n this.seconds === Constants.SECOND_MAX &&\n this.millis === Constants.MILLIS_MAX;\n }\n\n // Hour\n\n public startOfHour(): Day {\n return this.mutate(d => d.startOf('hour'));\n }\n\n public isStartOfHour(): boolean {\n return this.minute === Constants.MINUTE_MIN &&\n this.seconds === Constants.SECOND_MIN &&\n this.millis === Constants.MILLIS_MIN;\n }\n\n public endOfHour(inclusive: boolean = true): Day {\n return inclusive ?\n this.mutate(d => d.endOf('hour')) :\n this.mutate(d => d.startOf('hour').add(1, 'hour'));\n }\n\n public isEndOfHour(): boolean {\n return this.minute === Constants.MINUTE_MAX &&\n this.seconds === Constants.SECOND_MAX &&\n this.millis === Constants.MILLIS_MAX;\n }\n\n // Week\n\n public startOfWeek(): Day {\n return this.mutate(d => d.startOf('week'));\n }\n\n public isStartOfWeek(): boolean {\n return this.dayOfWeek === Constants.WEEKDAY_MIN;\n }\n\n public endOfWeek(inclusive: boolean = true): Day {\n return inclusive ?\n this.mutate(d => d.endOf('week')) :\n this.mutate(d => d.startOf('week').add(1, 'week'));\n }\n\n public isEndOfWeek(): boolean {\n return this.dayOfWeek === Constants.WEEKDAY_MAX;\n }\n\n // Month\n\n public startOfMonth(): Day {\n return this.mutate(d => d.startOf('month'));\n }\n\n public isStartOfMonth(): boolean {\n return this.dayOfMonth === Constants.DAY_MIN;\n }\n\n public endOfMonth(inclusive: boolean = true): Day {\n return inclusive ?\n this.mutate(d => d.endOf('month')) :\n this.mutate(d => d.startOf('month').add(1, 'month'));\n }\n\n public isEndOfMonth(): boolean {\n return this.dayOfMonth === this.daysInMonth();\n }\n\n // Year\n\n public startOfYear(): Day {\n return this.mutate(d => d.startOf('year'));\n }\n\n public isStartOfYear(): boolean {\n return this.month === Constants.MONTH_MIN && this.dayOfMonth === Constants.DAY_MIN;\n }\n\n public endOfYear(inclusive: boolean = true): Day {\n return inclusive ?\n this.mutate(d => d.endOf('year')) :\n this.mutate(d => d.startOf('year').add(1, 'year'));\n }\n\n public isEndOfYear(): boolean {\n return this.month === Constants.MONTH_MAX && this.dayOfMonth === Constants.DAY_MAX;\n }\n\n // Days In X\n\n public daysInMonth(): number {\n return this.date.daysInMonth();\n }\n\n public daysInYear(): number {\n return this.endOfYear().dayOfYear;\n }\n\n public weeksInYear(): number {\n return this.date.weeksInYear();\n }\n\n // Display\n\n public format(format: string): string {\n return this.date.format( format );\n }\n\n public utc(keepLocalTime?: boolean): Day {\n return this.mutate(d => d.utc(keepLocalTime));\n }\n\n public toMoment(): moment.Moment {\n return this.date.clone();\n }\n\n public toDate(): Date {\n return this.date.toDate();\n }\n\n public toArray(): number[] {\n return this.date.toArray();\n }\n\n public toJSON(): string {\n return this.date.toJSON();\n }\n\n public toISOString(keepOffset: boolean = false): string {\n return this.date.toISOString( keepOffset );\n }\n\n public toObject(): object {\n return this.date.toObject();\n }\n\n public toString(): string {\n return this.date.toString();\n }\n\n // State\n\n public isDST(): boolean {\n return this.date.isDST();\n }\n\n public isLeapYear(): boolean {\n return this.date.isLeapYear();\n }\n\n // Instances\n\n public static now(): Day {\n return new Day(moment());\n }\n\n public static today(): Day {\n return this.now().start();\n }\n\n public static tomorrow(): Day {\n return this.today().next();\n }\n\n public static fromMoment(moment: moment.Moment): Day {\n return moment && moment.isValid() ? new Day( moment ) : null;\n }\n\n public static unix(millis: number): Day {\n return this.fromMoment(moment(millis));\n }\n\n public static unixSeconds(millis: number): Day {\n return this.fromMoment(moment.unix(millis));\n }\n\n public static parse(input: DayInput): Day {\n return Parse.day(input);\n }\n\n public static fromString(input: string): Day {\n return this.fromMoment(moment(input));\n }\n\n public static fromFormat(input: string, formats: string | string[]): Day {\n return this.fromMoment(moment(input, formats));\n }\n\n public static fromObject(input: object): Day {\n return this.fromMoment(moment(input));\n }\n\n public static fromDate(input: Date): Day {\n return this.fromMoment(moment(input));\n }\n\n public static fromArray(input: number[]): Day {\n return this.fromMoment(moment(input));\n }\n\n public static fromDayIdentifier(id: number): Day {\n let date: number = id % 100;\n let month: number = (Math.floor(id / 100) % 100) - 1;\n let year: number = Math.floor(id / 10000);\n\n return this.build(year, month, date);\n }\n\n public static build(year: number, month: number,\n date: number = Constants.DAY_MIN,\n hour: number = Constants.HOUR_MIN,\n minute: number = Constants.MINUTE_MIN,\n second: number = Constants.SECOND_MIN,\n millisecond: number = Constants.MILLIS_MIN): Day\n {\n return new Day( moment({year, month, date, hour, minute, second, millisecond}) );\n }\n\n\n\n\n\n\n\n\n public static getWeekspanOfYear(date: moment.Moment): number\n {\n return Math.floor( (date.dayOfYear() - 1) / Constants.DAYS_IN_WEEK );\n }\n\n public static getLastWeekspanOfYear(date: moment.Moment): number\n {\n let lastOfYear = date.clone().endOf('year');\n let daysInYear: number = lastOfYear.dayOfYear();\n\n return Math.floor( (daysInYear - date.dayOfYear()) / Constants.DAYS_IN_WEEK );\n }\n\n public static getWeekOfYear(date: moment.Moment): number\n {\n let firstOfYear = date.clone().startOf('year');\n let weeks: number = date.week();\n\n return firstOfYear.day() > Constants.WEEK_OF_MONTH_MINIMUM_WEEKDAY ? weeks - 1 : weeks;\n }\n\n public static getFullWeekOfYear(date: moment.Moment): number\n {\n let firstOfYear = date.clone().startOf('year');\n let weeks: number = date.week();\n\n return firstOfYear.day() === Constants.WEEKDAY_MIN ? weeks : weeks - 1;\n }\n\n public static getLastFullWeekOfYear(date: moment.Moment): number\n {\n let firstOfYear = date.clone().startOf('year');\n let weeks: number = date.week();\n let weeksMax: number = date.weeksInYear();\n let lastWeek: number = weeksMax - weeks;\n\n return firstOfYear.day() === Constants.WEEKDAY_MIN ? lastWeek + 1 : lastWeek;\n }\n\n public static getWeekspanOfMonth(date: moment.Moment): number\n {\n return Math.floor((date.date() - 1) / Constants.DAYS_IN_WEEK);\n }\n\n public static getLastWeekspanOfMonth(date: moment.Moment): number\n {\n return Math.floor((date.daysInMonth() - date.date()) / Constants.DAYS_IN_WEEK);\n }\n\n public static getFullWeekOfMonth(date: moment.Moment): number\n {\n return Math.floor((date.date() - 1 - date.day() + Constants.DAYS_IN_WEEK) / Constants.DAYS_IN_WEEK);\n }\n\n public static getLastFullWeekOfMonth(date: moment.Moment): number\n {\n return Math.floor((date.daysInMonth() - date.date() - (Constants.WEEKDAY_MAX - date.day()) + Constants.DAYS_IN_WEEK) / Constants.DAYS_IN_WEEK);\n }\n\n public static getWeekOfMonth(date: moment.Moment): number\n {\n let dom = date.date();\n let dow = date.day();\n let sundayDate = dom - dow;\n\n return Math.floor( ( sundayDate + Constants.WEEK_OF_MONTH_MINIMUM_WEEKDAY + 5 ) / Constants.DAYS_IN_WEEK );\n }\n\n public static getLastDayOfMonth(date: moment.Moment): number\n {\n return date.daysInMonth() - date.date() + 1;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Day.ts","\nimport { Op } from './Operation';\nimport { Day } from './Day';\nimport { DaySpan } from './DaySpan';\nimport { CalendarEvent } from './CalendarEvent';\n\n\n/**\n * A day in a [[Calendar]] with extra information relative to any selection on\n * the calendar, the current date, or events on the day.\n *\n * @typeparam T The type of data stored in the [[Event]] class.\n * @typeparam M The type of metadata stored in the schedule.\n */\nexport class CalendarDay extends Day\n{\n\n /**\n * Whether this day is the current day (ex: today).\n */\n public currentDay: boolean = false;\n\n /**\n * Whether this day is on the same week as the current day (ex: today).\n */\n public currentWeek: boolean = false;\n\n /**\n * Whether this day is on the same month as the current day (ex: today).\n */\n public currentMonth: boolean = false;\n\n /**\n * Whether this day is on the same year as the current day (ex: today).\n */\n public currentYear: boolean = false;\n\n /**\n * How many days away this day is from the current day (ex: today). If this\n * day is the current day the offset is 0. If this day is before the current\n * day it will be the negative number of days away. Otherwise this will be\n * positive meaning this day is after the current day by the given days.\n */\n public currentOffset: number = 0;\n\n /**\n * Whether this day is part of a selection on the calendar.\n */\n public selectedDay: boolean = false;\n\n /**\n * Whether this day is on the same week that the calendar selection is.\n */\n public selectedWeek: boolean = false;\n\n /**\n * Whether this day is on the same month that the calendar selection is.\n */\n public selectedMonth: boolean = false;\n\n /**\n * Whether this day is on the same year that the calendar selection is.\n */\n public selectedYear: boolean = false;\n\n /**\n * Whether this day is in the current calendar or not. Some days are outside\n * the calendar span and used to fill in weeks. Month calendars will fill in\n * days so the list of days in the calendar start on Sunday and end on Saturday.\n */\n public inCalendar: boolean = false;\n\n /**\n * The list of events on this day based on the settings and schedules in the\n * calendar.\n */\n public events: CalendarEvent[] = [];\n\n\n /**\n * Updates the current flags on this day given the current day (ex: today).\n *\n * @param current The current day of the calendar.\n */\n public updateCurrent(current: Day): this\n {\n this.currentDay = this.sameDay(current);\n this.currentWeek = this.sameWeek(current);\n this.currentMonth = this.sameMonth(current);\n this.currentYear = this.sameYear(current);\n this.currentOffset = this.daysBetween(current, Op.DOWN, false);\n\n return this;\n }\n\n /**\n * Updates the selection flags on this day given the selection range on the\n * calendar.\n *\n * @param selected The span of days selected on the calendar.\n */\n public updateSelected(selected: DaySpan): this\n {\n this.selectedDay = selected.matchesDay(this);\n this.selectedWeek = selected.matchesWeek(this);\n this.selectedMonth = selected.matchesMonth(this);\n this.selectedYear = selected.matchesYear(this);\n\n return this;\n }\n\n /**\n * Clears the selection flags on this day. This is done when the selection on\n * the calendar is cleared.\n */\n public clearSelected(): this\n {\n this.selectedDay = this.selectedWeek = this.selectedMonth = this.selectedYear = false;\n\n return this;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/CalendarDay.ts","\nimport { Constants } from './Constants';\nimport { Day } from './Day';\nimport { DaySpan, DaySpanBounds } from './DaySpan';\nimport { Event } from './Event';\nimport { Identifier, IdentifierInput } from './Identifier';\nimport { Schedule } from './Schedule';\n\n\n/**\n * An instance of an [[Event]] on a given day of a [[Calendar]] generated by\n * the event's [[Schedule]].\n *\n * @typeparam T The type of data stored in the [[Event]] class.\n * @typeparam M The type of metadata stored in the schedule and in this class.\n */\nexport class CalendarEvent\n{\n\n /**\n * The relatively unique identifier of this event. It is generated based on\n * the index of the schedule in the calendar and the time of day listed in the\n * schedule. This number will no longer be unique if the schedule has more\n * than [[Constants.MAX_EVENTS_PER_DAY]] occurrences in a single day\n * (based on number of times in [[Schedule.times]]).\n */\n public id: number;\n\n /**\n * The event with the schedule.\n */\n public event: Event;\n\n /**\n * Any metadata specified for this event instance in the schedule.\n */\n public meta: M;\n\n /**\n * The day this event occurs on.\n */\n public day: Day;\n\n /**\n * The span of time this event occurs. If this is an all day event this span\n * will start at the beginning of the day and end at the beginning of the\n * next day.\n *\n * @see [[Schedule.isFullDay]]\n */\n public time: DaySpan;\n\n /**\n * Whether this event is an all day event.\n *\n * @see [[Schedule.isFullDay]]\n */\n public fullDay: boolean;\n\n /**\n * Whether this event is the first day of an occurrence. A calendar can\n * generate multiple [[CalendarEvent]] instances over each day it covers if\n * [[Calendar.repeatCovers]] is true. These instances have matching\n * [[CalendarEvent.id]] values.\n */\n public starting: boolean;\n\n /**\n * Whether this event is the last day of an occurrence. A calendar can\n * generate multiple [[CalendarEvent]] instances over each day it covers if\n * [[Calendar.repeatCovers]] is true. These instances have matching\n * [[CalendarEvent.id]] values.\n */\n public ending: boolean;\n\n /**\n * Whether this event instance was marked as cancelled in the schedule.\n */\n public cancelled: boolean;\n\n /**\n * The row this event is on in a visual calendar. An event can span multiple\n * days and it is desirable to have the occurrence on each day to line up.\n * This is only set when [[Calendar.updateRows]] is true or manually set.\n * This value makes sense for visual calendars for all day events or when the\n * visual calendar is not positioning events based on their time span.\n */\n public row: number = 0;\n\n /**\n * The column this event is on in a visual calendar. An event can have its\n * time overlap with another event displaying one of the events in another\n * column. This is only set when [[Calendar.updateColumns]] is true or\n * manually set. This value makes sense for visual calendars that are\n * displaying event occurrences at specific times positioned accordingly.\n */\n public col: number = 0;\n\n\n /**\n * Creates a new event instance given the id, the event paired with the\n * schedule, the schedule, the time span of the event, and the day on the\n * calendar the event belongs to.\n *\n * @param id The relatively unique identifier of this event.\n * @param event The event which created this instance.\n * @param time The time span of this event.\n * @param actualDay The day on the calendar this event is for.\n */\n public constructor(id: number, event: Event, time: DaySpan, actualDay: Day)\n {\n this.id = id;\n this.event = event;\n this.time = time;\n this.day = actualDay;\n this.fullDay = event.schedule.isFullDay();\n this.meta = event.schedule.getMeta( time.start );\n this.cancelled = event.schedule.isCancelled( time.start );\n this.starting = time.isPoint || time.start.sameDay( actualDay );\n this.ending = time.isPoint || time.end.relative(-1).sameDay( actualDay );\n }\n\n /**\n * The id of the schedule uniqe within the calendar which generated this event.\n */\n public get scheduleId(): number\n {\n return Math.floor( this.id / Constants.MAX_EVENTS_PER_DAY );\n }\n\n /**\n * The start timestamp of the event.\n */\n public get start(): Day\n {\n return this.time.start;\n }\n\n /**\n * The end timestamp of the event.\n */\n public get end(): Day\n {\n return this.time.end;\n }\n\n /**\n * The schedule which generated this event.\n */\n public get schedule(): Schedule\n {\n return this.event.schedule;\n }\n\n /**\n * The related event data.\n */\n public get data(): T\n {\n return this.event.data;\n }\n\n /**\n * An [[IdentifierInput]] for the start of this event.\n */\n public get identifier(): IdentifierInput\n {\n return this.identifierType.get( this.start );\n }\n\n /**\n * The [[Identifier]] for this event. Either [[Identifier.Day]] or\n * [[Identifier.Time]].\n */\n public get identifierType(): Identifier\n {\n return this.schedule.identifierType;\n }\n\n /**\n * Returns a delta value between 0 and 1 which represents where the\n * [[CalendarEvent.start]] is relative to [[CalendarEvent.day]]. The delta\n * value would be less than 0 if the start of the event is before\n * [[CalendarEvent.day]].\n */\n public get startDelta(): number\n {\n return this.time.startDelta( this.day );\n }\n\n /**\n * Returns a delta value between 0 and 1 which represents where the\n * [[CalendarEvent.end]] is relative to [[CalendarEvent.day]]. The delta value\n * would be greater than 1 if the end of the event is after\n * [[CalendarEvent.day]].\n */\n public get endDelta(): number\n {\n return this.time.endDelta( this.day );\n }\n\n /**\n * Calculates the bounds for this event if it were placed in a rectangle which\n * represents a day (24 hour period). By default the returned values are\n * between 0 and 1 and can be scaled by the proper rectangle dimensions or the\n * rectangle dimensions can be passed to this function.\n *\n * @param dayHeight The height of the rectangle of the day.\n * @param dayWidth The width of the rectangle of the day.\n * @param columnOffset The offset in the rectangle of the day to adjust this\n * event by if it intersects or is contained in a previous event. This also\n * reduces the width of the returned bounds to keep the bounds in the\n * rectangle of the day.\n * @param clip `true` if the bounds should stay in the day rectangle, `false`\n * and the bounds may go outside the rectangle of the day for multi-day\n * events.\n * @param offsetX How much to translate the left & right properties by.\n * @param offsetY How much to translate the top & bottom properties by.\n * @returns The calculated bounds for this event.\n */\n public getTimeBounds(dayHeight: number = 1, dayWidth: number = 1, columnOffset: number = 0.1, clip: boolean = true, offsetX: number = 0, offsetY: number = 0): DaySpanBounds\n {\n return this.time.getBounds( this.day, dayHeight, dayWidth, this.col * columnOffset, clip, offsetX, offsetY );\n }\n\n /**\n * Changes the cancellation status of this event. By default this cancels\n * this event - but `false` may be passed to undo a cancellation.\n *\n * @param cancelled Whether the event should be cancelled.\n */\n public cancel(cancelled: boolean = true): this\n {\n this.schedule.setCancelled( this.start, cancelled );\n this.cancelled = cancelled;\n\n return this;\n }\n\n /**\n * Changes the exclusion status of this event. By default this excludes this\n * event - but `false` may be passed to undo an exclusion.\n *\n * @param excluded Whether the event should be excluded.\n */\n public exclude(excluded: boolean = true): this\n {\n this.schedule.setExcluded( this.start, excluded );\n\n return this;\n }\n\n /**\n * Moves this event to potentially another day and time. A move is\n * accomplished by excluding the current event and adding an inclusion of the\n * new day & time. Any [[CalendarEvent.meta]] on this event will be moved to\n * the new event. If the schedule represents a single event\n * ([[Schedule.isSingleEvent]]) then the schedule frequencies are updated\n * to match the timestamp provided.\n *\n * @param toTime The timestamp to move this event to.\n * @returns Whether the event was moved to the given time.\n */\n public move(toTime: Day): boolean\n {\n return this.schedule.move( toTime, this.start, this.meta );\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/CalendarEvent.ts","\nimport { Functions as fn } from './Functions';\nimport { Day, DayInput } from './Day';\nimport { DaySpan } from './DaySpan';\nimport { Schedule } from './Schedule';\nimport { EventInput, Event } from './Event';\nimport { Op } from './Operation';\nimport { Units } from './Units';\nimport { Parse } from './Parse';\nimport { SortEvent } from './Sort';\nimport { Constants } from './Constants';\nimport { CalendarDay } from './CalendarDay';\nimport { CalendarEvent } from './CalendarEvent';\nimport { Iterator, IteratorAction } from './Iterator';\n\n\n/**\n * A function which moves a given day by some amount and some unit. This is\n * used to shift a calendar's frame via [[Calendar.next]] and [[Calendar.prev]].\n *\n * @param day The day to move.\n * @param amount The amount to move the day by.\n * @returns A new day instance moved by the given amount.\n */\nexport type CalendarMover = (day: Day, amount: number) => Day;\n\n/**\n * A definition for a given [[Units]] which informs a calendar how to setup the\n * [[Calendar.span]] and how to move with [[Calendar.move]].\n */\nexport interface CalendarTypeDefinition\n{\n getStart(around: Day, size: number, focus: number): Day;\n getEnd(start: Day, size: number, focus: number): Day;\n moveStart(day: Day, amount: number): Day;\n moveEnd(day: Day, amount: number): Day;\n defaultInput: any\n}\n\n/**\n * A map of [[CalendarTypeDefinition]] keyed by the [[Units]].\n */\nexport type CalendarTypeDefinitionMap = { [unit: number]: CalendarTypeDefinition };\n\n/**\n * Input used to initialize or mass change the properties of a [[Calendar]].\n *\n * @typeparam T The type of data stored in the [[Event]] class.\n * @typeparam M The type of metadata stored in the schedule.\n */\nexport interface CalendarInput\n{\n\n /**\n * @see [[Calendar.fill]]\n */\n fill?: boolean;\n /**\n * @see [[Calendar.minimumSize]]\n */\n minimumSize?: number;\n /**\n * @see [[Calendar.repeatCovers]]\n */\n repeatCovers?: boolean;\n /**\n * @see [[Calendar.listTimes]]\n */\n listTimes?: boolean;\n /**\n * @see [[Calendar.eventsOutside]]\n */\n eventsOutside?: boolean;\n /**\n * @see [[Calendar.updateRows]]\n */\n updateRows?: boolean;\n /**\n * @see [[Calendar.updateColumns]]\n */\n updateColumns?: boolean;\n /**\n * @see [[Calendar.eventSorter]]\n */\n eventSorter?: SortEvent;\n /**\n * @see [[Calendar.events]]\n */\n events?: EventInput[];\n /**\n * @see [[Calendar.type]]\n */\n type?: Units;\n /**\n * @see [[Calendar.size]]\n */\n size?: number; // 1\n /**\n * @see [[Calendar.parseMeta]]\n */\n parseMeta?: (input: any) => M;\n /**\n * @see [[Calendar.parseData]]\n */\n parseData?: (input: any) => T;\n /**\n * When morphing a calendar to a fewer number of days, do we want to keep\n * today in the calendar if it is already in the calendar?\n */\n preferToday?: boolean; // true\n /**\n * What day should the calendar be based around (contain)?\n */\n around?: DayInput; // null\n /**\n * When morphing a calendar and `preferToday` is false OR today is not in the\n * calendar AND `around` is not specified, we will pick a day at this number\n * in the current calendar (a value between 0 and 1 signifying the start and\n * and of the current calendar).\n */\n otherwiseFocus?: number; // 0.499999\n /**\n * When morphing or creating passing a value of `true` will avoid calling\n * [[Calendar.refresh]] as is typically done right after each of those\n * functions.\n */\n delayRefresh?: boolean; // false\n}\n\n/**\n * A collection of [[CalendarDay]]s, the events on the calendar, and all\n * [[CalendarEvent]]s generated based on the events.\n *\n * @typeparam T The type of data stored in the [[Event]] class.\n * @typeparam M The type of metadata stored in the schedule.\n */\nexport class Calendar\n{\n\n /**\n * The span of days in the calendar.\n */\n public span: DaySpan;\n\n /**\n * The full span of days represented on the calendar. This may be different\n * than the [[Calendar.span]] when [[Calendar.fill]] is `true` and the\n * calendar is representing months or years and the days need to start on\n * Sunday and end on Saturday.\n */\n public filled: DaySpan;\n\n /**\n * The number of days in the calendar specified by [[Calendar.span]].\n */\n public length: number;\n\n /**\n * The type of calendar.\n */\n public type: Units;\n\n /**\n * The size of the calendar. When the calendar type is...\n *\n * - [[Units.DAY]]: The number of days in the calendar.\n * - [[Units.WEEK]]: The number of weeks in the calendar.\n * - [[Units.MONTH]]: The number of months in the calendar.\n * - [[Units.YEAR]]: The number of years in the calendar.\n */\n public size: number;\n\n /**\n * The function used to move the start day of the calendar when functions like\n * [[Calendar.next]] or [[Calendar.prev]] are called.\n */\n public moveStart: CalendarMover;\n\n /**\n * The function used to move the end day of the calendar when functions like\n * [[Calendar.next]] or [[Calendar.prev]] are called.\n */\n public moveEnd: CalendarMover;\n\n\n /**\n * If the calendar should be filled in so the first day of the calendar is\n * Sunday and the last day is Saturday.\n */\n public fill: boolean = false;\n\n /**\n * The minimum number of days in the calendar no matter what the type or size\n * is. This can be used to display a month with a constant number of weeks -\n * because not all months contain the same number of weeks.\n */\n public minimumSize: number = 0;\n\n /**\n * When `true` a [[CalendarEvent]] instance exists on each [[CalendarDay]]\n * the event covers even if the event didn't start on that day.\n */\n public repeatCovers: boolean = true;\n\n /**\n * When `true` an event instance will be created for each time specified on\n * the schedule. If the schedule specifies an all day event then only one\n * event is added to a day. This is typically done when displaying days or\n * weeks and events can be displayed on a timeline.\n */\n public listTimes: boolean = false;\n\n /**\n * When `true` events will be added to days \"outside\" the calendar. Days\n * outside the calendar are days filled in when [[Calendar.fill]] is `true`.\n * More specifically days that are in [[Calendar.filled]] and not in\n * [[Calendar.span]].\n */\n public eventsOutside: boolean = false;\n\n /**\n * When `true` [[CalendarEvent.row]] will be set so when visually displaying\n * the event with others multi-day events will align and not overlap.\n */\n public updateRows: boolean = false;\n\n /**\n * When `true` [[CalendarEvent.col]] will be set so when visually displaying\n * the event based on start and end time any events that overlap with each\n * other will be \"indented\" to see the event below it.\n */\n public updateColumns: boolean = false;\n\n /**\n * The function (if any) which sorts the events on a calendar day.\n */\n public eventSorter: SortEvent = null;\n\n /**\n * A function to use when parsing meta input into the desired type.\n *\n * @param input The input to parse.\n * @returns The meta parsed from the given input, if any.\n */\n public parseMeta: (input: any) => M = (x => x);\n\n /**\n * A function to use when parsing meta input into the desired type.\n *\n * @param input The input to parse.\n * @returns The meta parsed from the given input, if any.\n */\n public parseData: (input: any) => T = (x => x);\n\n /**\n * A selection of days on the calendar. If no days are selected this is `null`.\n * This is merely used to keep the selection flags in [[CalendarDay]] updated\n * via [[Calendar.refreshSelection]].\n */\n public selection: DaySpan = null;\n\n /**\n * The array of days in this calendar and their events.\n */\n public days: CalendarDay[] = [];\n\n /**\n * The array of scheduled events added to the calendar.\n */\n public events: Event[] = [];\n\n /**\n * The array of visible events on the calendar. This is built based on the\n * span of the schedule in the given event and also the [[Event.visible]] flag.\n */\n public visible: Event[] = [];\n\n\n /**\n * Creates a new calendar given a span, type, size, moving functions, and\n * optionally some default properties for the calendar.\n *\n * @param start The first day on the calendar.\n * @param end The last day on the calendar.\n * @param type The calendar type used for describing the calendar and splitting it.\n * @param size The number of calendar types in this calendar.\n * @param moveStart The function to move the start day.\n * @param moveEnd The function to move the end by.\n * @param input The default properties for this calendar.\n * @see [[Calendar.start]]\n * @see [[Calendar.end]]\n * @see [[Calendar.type]]\n * @see [[Calendar.size]]\n * @see [[Calendar.moveStart]]\n * @see [[Calendar.moveEnd]]\n */\n public constructor(start: Day, end: Day, type: Units, size: number, moveStart: CalendarMover, moveEnd: CalendarMover, input?: CalendarInput)\n {\n this.span = new DaySpan(start, end);\n this.filled = new DaySpan(start, end);\n this.type = type;\n this.size = size;\n this.moveStart = moveStart;\n this.moveEnd = moveEnd;\n\n if (fn.isDefined(input))\n {\n this.set( input );\n }\n else\n {\n this.refresh();\n }\n }\n\n /**\n * Changes the calendar possibly morphing it to a different type or size if\n * specified in the given input. If the type and size are not morphed then\n * the following properties may be updated:\n *\n * - [[Calendar.fill]]\n * - [[Calendar.minimumSize]]\n * - [[Calendar.repeatCovers]]\n * - [[Calendar.listTimes]]\n * - [[Calendar.eventsOutside]]\n * - [[Calendar.updateRows]]\n * - [[Calendar.updateColumns]]\n * - [[Calendar.eventSorter]]\n * - [[Calendar.events]]\n * - [[Calendar.parseData]]\n * - [[Calendar.parseMeta]]\n *\n * If [[CalendarInput.delayRefresh]] is not given with `true` then\n * [[Calendar.refresh]] will be called once the calendar properties have been\n * updated.\n *\n * @param input The new properties for this calendar to overwrite with.\n */\n public set(input: CalendarInput): this\n {\n type CTD = CalendarTypeDefinition;\n\n let typeChange: boolean = fn.isDefined(input.type) && input.type !== this.type;\n let sizeChange: boolean = fn.isDefined(input.size) && input.size !== this.size;\n\n if (typeChange || sizeChange)\n {\n let focus: number = fn.coalesce( input.otherwiseFocus, 0.4999 );\n let prefer: boolean = fn.coalesce( input.preferToday, true );\n let size: number = fn.coalesce( input.size, this.size );\n let type: Units = fn.coalesce( input.type, this.type );\n let around: DayInput = fn.coalesce( input.around, this.days[ Math.floor( (this.days.length - 1) * focus ) ] );\n let today: Day = Day.today();\n\n if (!around || (prefer && this.span.matchesDay(today)))\n {\n around = today;\n }\n\n let meta: CTD = Calendar.TYPES[ type ];\n let start: Day = meta.getStart( Day.parse( around ), size, focus );\n let end: Day = meta.getEnd( start, size, focus );\n\n this.span.start = start;\n this.span.end = end;\n this.type = type;\n this.size = size;\n this.moveStart = meta.moveStart;\n this.moveEnd = meta.moveEnd;\n }\n else if (input.around)\n {\n let focus: number = fn.coalesce( input.otherwiseFocus, 0.4999 );\n let around: Day = Day.parse( input.around );\n let type: Units = this.type;\n let size: number = this.size;\n let meta: CTD = Calendar.TYPES[ type ];\n let start: Day = meta.getStart( around, size, focus );\n let end: Day = meta.getEnd( start, size, focus );\n\n this.span.start = start;\n this.span.end = end;\n }\n\n this.fill = fn.coalesce( input.fill, this.fill );\n this.minimumSize = fn.coalesce( input.minimumSize, this.minimumSize );\n this.repeatCovers = fn.coalesce( input.repeatCovers, this.repeatCovers );\n this.listTimes = fn.coalesce( input.listTimes, this.listTimes );\n this.eventsOutside = fn.coalesce( input.eventsOutside, this.eventsOutside );\n this.updateRows = fn.coalesce( input.updateRows, this.updateRows );\n this.updateColumns = fn.coalesce( input.updateColumns, this.updateColumns );\n this.eventSorter = fn.coalesce( input.eventSorter, this.eventSorter );\n this.parseMeta = fn.coalesce( input.parseMeta, this.parseMeta );\n this.parseData = fn.coalesce( input.parseData, this.parseData );\n\n if (fn.isArray(input.events))\n {\n this.removeEvents();\n this.addEvents(input.events, false, true);\n }\n\n if (!input.delayRefresh)\n {\n this.refresh();\n }\n\n return this;\n }\n\n /**\n * Sets the [[Calendar.minimumSize]] value and returns `this` for method\n * chaining.\n *\n * @param minimumSize The new value.\n */\n public withMinimumSize(minimumSize: number): this\n {\n this.minimumSize = minimumSize;\n this.refresh();\n\n return this;\n }\n\n /**\n * Sets the [[Calendar.repeatCovers]] value and returns `this` for method\n * chaining.\n *\n * @param repeatCovers The new value.\n */\n public withRepeatCovers(repeatCovers: boolean): this\n {\n this.repeatCovers = repeatCovers;\n this.refreshEvents();\n\n return this;\n }\n\n /**\n * Sets the [[Calendar.listTimes]] value and returns `this` for method\n * chaining.\n *\n * @param listTimes The new value.\n */\n public withListTimes(listTimes: boolean): this\n {\n this.listTimes = listTimes;\n this.refreshEvents();\n\n return this;\n }\n\n /**\n * Sets the [[Calendar.eventsOutside]] value and returns `this` for method\n * chaining.\n *\n * @param eventsOutside The new value.\n */\n public withEventsOutside(eventsOutside: boolean): this\n {\n this.eventsOutside = eventsOutside;\n this.refreshEvents();\n\n return this;\n }\n\n /**\n * Sets the [[Calendar.updateRows]] value and returns `this` for method\n * chaining.\n *\n * @param updateRows The new value.\n * @param refresh If the rows should be updated now if `updateRows` is `true`.\n */\n public withUpdateRows(updateRows: boolean, refresh: boolean = true): this\n {\n this.updateRows = updateRows;\n\n if (refresh && updateRows)\n {\n this.refreshRows();\n }\n\n return this;\n }\n\n /**\n * Sets the [[Calendar.updateColumns]] value and returns `this` for method\n * chaining.\n *\n * @param updateColumns The new value.\n * @param refresh If the columns should be updated now if `updateColumns` is\n * `true`.\n */\n public withUpdateColumns(updateColumns: boolean, refresh: boolean = true): this\n {\n this.updateColumns = updateColumns;\n\n if (refresh && updateColumns)\n {\n this.refreshColumns();\n }\n\n return this;\n }\n\n /**\n * Returns the start day of the calendar. If this calendar is filled, this\n * may not represent the very first day in the calendar.\n */\n public get start(): Day\n {\n return this.span.start;\n }\n\n /**\n * Returns the end day of the calendar. If this calendar is filled, this\n * may not represent the very last day in the calendar.\n */\n public get end(): Day\n {\n return this.span.end;\n }\n\n /**\n * Returns the summary of the span of time this calendar represents.\n *\n * @param dayOfWeek [[DaySpan.summary]]\n * @param short [[DaySpan.summary]]\n * @param repeat [[DaySpan.summary]]\n * @param contextual [[DaySpan.summary]]\n * @param delimiter [[DaySpan.summary]]\n * @see [[DaySpan.summary]]\n */\n public summary(dayOfWeek: boolean = true, short: boolean = false, repeat: boolean = false, contextual: boolean = true, delimiter: string = ' - '): string\n {\n return this.span.summary( this.type, dayOfWeek, short, repeat, contextual, delimiter );\n }\n\n /**\n * Splits up this calendar into an iterable collection of calendars. The\n * resulting iterator will return `size / by` number of calendars.\n *\n * @param by The new size of the resulting calendars. If the the size of the\n * current calendar is not divisible by this value the resulting calendars\n * may cover more or less than this calendar covers.\n * @returns An iterator for the calendars produced.\n */\n public split(by: number = 1): Iterator>\n {\n return new Iterator>(iterator =>\n {\n let start: Day = this.start;\n let end: Day = this.moveEnd( this.end, by - this.size );\n\n for (let i = 0; i < this.size; i++)\n {\n let calendar = new Calendar(start, end, this.type, by, this.moveStart, this.moveEnd, this);\n\n if (iterator.act(calendar) === IteratorAction.Stop)\n {\n return;\n }\n\n start = this.moveStart( start, by );\n end = this.moveEnd( end, by );\n }\n });\n }\n\n /**\n * Refreshes the days and events in this calendar based on the start and end\n * days, the calendar properties, and its eventss.\n *\n * @param today The current day to update the calendar days via\n * [[CalendarDay.updateCurrent]].\n */\n public refresh(today: Day = Day.today()): this\n {\n this.length = this.span.days(Op.UP, true);\n this.resetDays();\n this.refreshCurrent(today);\n this.refreshSelection();\n this.refreshVisible();\n this.refreshEvents();\n\n return this;\n }\n\n /**\n * Updates the [[Calendar.filled]] span based on [[Calendar.start]],\n * [[Calendar.end]], and [[Calendar.fill]] properties.\n */\n public resetFilled(): this\n {\n this.filled.start = this.fill ? this.start.startOfWeek() : this.start;\n this.filled.end = this.fill ? this.end.endOfWeek() : this.end;\n\n return this;\n }\n\n /**\n * Updates [[Calendar.days]] to match the span of days in the calendar.\n */\n public resetDays(): this\n {\n this.resetFilled();\n\n let days: CalendarDay[] = this.days;\n let filled: DaySpan = this.filled;\n let current: Day = filled.start;\n let daysBetween: number = filled.days(Op.UP);\n let total: number = Math.max( this.minimumSize, daysBetween );\n\n for (let i = 0; i < total; i++)\n {\n let day: CalendarDay = days[ i ];\n\n if (!day || !day.sameDay( current ))\n {\n day = new CalendarDay( current.date );\n\n if (i < days.length)\n {\n days.splice( i, 1, day );\n }\n else\n {\n days.push( day );\n }\n }\n\n day.inCalendar = this.span.contains( day );\n\n current = current.next();\n }\n\n if (days.length > total)\n {\n days.splice( total, days.length - total );\n }\n\n return this;\n }\n\n /**\n * Updates the list of visible schedules.\n */\n public refreshVisible(): this\n {\n let start: Day = this.filled.start;\n let end: Day = this.filled.end;\n\n this.visible = this.events.filter(e =>\n {\n return e.visible && e.schedule.matchesRange(start, end);\n });\n\n return this;\n }\n\n /**\n * Updates the days with the current day via [[CalendarDay.updateCurrent]].\n *\n * @param today The new current day.\n */\n public refreshCurrent(today: Day = Day.today()): this\n {\n this.iterateDays().iterate(d =>\n {\n d.updateCurrent(today);\n });\n\n return this;\n }\n\n /**\n * Updates the selection flags in [[CalendarDay]] based on the\n * [[Calendar.selection]] property.\n */\n public refreshSelection(): this\n {\n this.iterateDays().iterate(d =>\n {\n if (this.selection)\n {\n d.updateSelected( this.selection );\n }\n else\n {\n d.clearSelected();\n }\n });\n\n return this;\n }\n\n /**\n * Updates the [[CalendarDay.events]] based on the events in this calendar\n * and the following properties:\n *\n * - [[Calendar.eventsForDay]]\n * - [[Calendar.eventsOutside]]\n * - [[Calendar.listTimes]]\n * - [[Calendar.repeatCovers]]\n * - [[Calendar.updateRows]]\n * - [[Calendar.updateColumns]]\n */\n public refreshEvents(): this\n {\n this.iterateDays().iterate(d =>\n {\n if (d.inCalendar || this.eventsOutside)\n {\n d.events = this.eventsForDay(d, this.listTimes, this.repeatCovers);\n }\n });\n\n if (this.updateRows)\n {\n this.refreshRows();\n }\n\n if (this.updateColumns)\n {\n this.refreshColumns();\n }\n\n return this;\n }\n\n /**\n * Refreshes the [[CalendarEvent.row]] property as described in the link.\n */\n public refreshRows(): this\n {\n type EventToRowMap = { [id: number]: number };\n type UsedMap = { [row: number]: boolean };\n\n let eventToRow: EventToRowMap = {};\n let onlyFullDay: boolean = this.listTimes;\n\n this.iterateDays().iterate(d =>\n {\n if (d.dayOfWeek === 0)\n {\n eventToRow = {};\n }\n\n let used: UsedMap = {};\n\n for (let event of d.events)\n {\n if (onlyFullDay && !event.fullDay)\n {\n continue;\n }\n\n if (event.id in eventToRow)\n {\n used[ event.row = eventToRow[ event.id ] ] = true;\n }\n }\n\n let rowIndex: number = 0;\n\n for (let event of d.events)\n {\n if ((onlyFullDay && !event.fullDay) || event.id in eventToRow)\n {\n continue;\n }\n\n while (used[ rowIndex ])\n {\n rowIndex++;\n }\n\n eventToRow[ event.id ] = event.row = rowIndex;\n\n rowIndex++;\n }\n });\n\n return this;\n }\n\n /**\n * Refreshes the [[CalendarEvent.col]] property as described in the link.\n */\n public refreshColumns(): this\n {\n interface Marker {\n time: number,\n event: CalendarEvent,\n start: boolean,\n parent: Marker;\n }\n\n this.iterateDays().iterate(d =>\n {\n let markers: Marker[] = [];\n\n for (let event of d.events)\n {\n if (!event.fullDay)\n {\n markers.push({\n time: event.time.start.time,\n event: event,\n start: true,\n parent: null\n });\n\n markers.push({\n time: event.time.end.time - 1,\n event: event,\n start: false,\n parent: null\n });\n }\n }\n\n markers.sort((a, b) =>\n {\n return a.time - b.time;\n });\n\n let parent = null;\n\n for (let marker of markers)\n {\n if (marker.start)\n {\n marker.parent = parent;\n parent = marker;\n }\n else if (parent)\n {\n parent = parent.parent;\n }\n }\n\n for (let marker of markers)\n {\n if (marker.start)\n {\n marker.event.col = marker.parent ? marker.parent.event.col + 1 : 0;\n }\n }\n });\n\n return this;\n }\n\n /**\n * Iterates over all days in this calendar and passes each day to `iterator`.\n *\n * @param iterator The function to pass [[CalendarDay]]s to.\n */\n public iterateDays(): Iterator>\n {\n return new Iterator>(iterator =>\n {\n let days: CalendarDay[] = this.days;\n\n for (let i = 0; i < days.length; i++)\n {\n switch (iterator.act(days[ i ]))\n {\n case IteratorAction.Stop:\n return;\n }\n }\n });\n }\n\n /**\n * Returns the events for the given day optionally looking at schedule times,\n * optionally looking at events which cover multiple days, and optionally\n * sorted with the given function.\n *\n * @param day The day to find events for.\n * @param getTimes When `true` an event is added to the result for each time\n * specified in the schedule.\n * @param covers When `true` events which don't start on the given day but do\n * overlap are added to the result.\n * @param sorter The function to sort the events by, if any.\n * @returns An array of events that occurred on the given day.\n */\n public eventsForDay(day: Day, getTimes: boolean = true, covers: boolean = true, sorter: SortEvent = this.eventSorter): CalendarEvent[]\n {\n let events: CalendarEvent[] = [];\n let entries: Event[] = this.visible;\n\n for (let entryIndex = 0; entryIndex < entries.length; entryIndex++)\n {\n let entry: Event = entries[ entryIndex ];\n let schedule: Schedule = entry.schedule;\n let eventId: number = entryIndex * Constants.MAX_EVENTS_PER_DAY;\n let timeIndex: number = 0;\n\n schedule.iterateSpans( day, covers ).iterate((span, iterator) =>\n {\n events.push(new CalendarEvent(eventId + timeIndex++, entry, span, day));\n\n if (!getTimes)\n {\n iterator.stop();\n }\n });\n }\n\n if (sorter)\n {\n events.sort( sorter );\n }\n\n return events\n }\n\n /**\n * Finds the event given one of the ways to identify the event.\n *\n * @param input The value to use to search for an event.\n * @returns The refrence to the event or null if not found.\n */\n public findEvent(id: any): Event\n {\n for (let event of this.events)\n {\n if (event === id || event.schedule === id || event.data === id || event.id === id)\n {\n return event;\n }\n }\n\n return null;\n }\n\n /**\n * Removes the list of events if they exist in the calendar.\n *\n * @param events The array of events to remove if they exist. If no\n * events are passed (via `null`) then all events will be removed\n * from the calendar.\n * @param delayRefresh When `true` the [[Calendar.refreshEvents]] will not be\n * called after the events are removed.\n * @see [[Calendar.removeEvent]]\n * @see [[Calendar.refreshEvents]]\n */\n public removeEvents(events: any[] = null, delayRefresh: boolean = false): this\n {\n if (events)\n {\n for (let event of events)\n {\n this.removeEvent( event, true );\n }\n }\n else\n {\n this.events = [];\n }\n\n this.refreshVisible();\n\n if (!delayRefresh)\n {\n this.refreshEvents();\n }\n\n return this;\n }\n\n /**\n * Removes the given event if it exists on the calendar.\n *\n * @param event The event to remove if it exists.\n * @param delayRefresh When `true` the [[Calendar.refreshEvents]] will not be\n * called after the event is removed.\n * @see [[Calendar.refreshEvents]]\n */\n public removeEvent(event: any, delayRefresh: boolean = false): this\n {\n let found: Event = this.findEvent(event);\n\n if (found)\n {\n this.events.splice( this.events.indexOf(found), 1 );\n\n this.refreshVisible();\n\n if (!delayRefresh)\n {\n this.refreshEvents();\n }\n }\n\n return this;\n }\n\n /**\n * Adds the given event to this calendar if it doesn't exist already (or\n * `allowDuplicates` is `true`).\n *\n * @param event The event to add to the calendar.\n * @param allowDuplicates If an event can be added more than once.\n * @param delayRefresh When `true` the [[Calendar.refreshEvents]] will not be\n * called after the event is added.\n * @see [[Calendar.refreshEvents]]\n */\n public addEvent(event: EventInput, allowDuplicates: boolean = false, delayRefresh: boolean = false): this\n {\n let parsed: Event = Parse.event(event, this.parseData, this.parseMeta);\n\n if (!allowDuplicates)\n {\n let existing = this.findEvent(parsed);\n\n if (existing)\n {\n return this;\n }\n }\n\n this.events.push(parsed);\n\n this.refreshVisible();\n\n if (!delayRefresh)\n {\n this.refreshEvents();\n }\n\n return this;\n }\n\n /**\n * Adds the given events to this calendar if they don't exist already (or\n * `allowDuplicates` is `true`).\n *\n * @param events The events to add to the calendar.\n * @param allowDuplicates If an event can be added more than once.\n * @param delayRefresh When `true` the [[Calendar.refreshEvents]] will not be\n * called after the events are added.\n * @see [[Calendar.refreshEvents]]\n */\n public addEvents(events: EventInput[], allowDuplicates: boolean = false, delayRefresh: boolean = false): this\n {\n for (let event of events)\n {\n this.addEvent(event, allowDuplicates, true);\n }\n\n if (!delayRefresh)\n {\n this.refreshEvents();\n }\n\n return this;\n }\n\n /**\n * Sets the selection point or range of the calendar and updates the flags\n * in the days.\n *\n * @param start The start of the selection.\n * @param end The end of the selection.\n * @see [[Calendar.refreshSelection]]\n */\n public select(start: Day, end: Day = start): this\n {\n this.selection = new DaySpan( start, end );\n this.refreshSelection();\n\n return this;\n }\n\n /**\n * Sets the selection of the calendar to nothing.\n *\n * @see [[Calendar.refreshSelection]]\n */\n public unselect(): this\n {\n this.selection = null;\n this.refreshSelection();\n\n return this;\n }\n\n /**\n * Shifts the calendar days by the given amount.\n *\n * @param jump The amount to shift the calendar by.\n * @param delayRefresh When `true` [[Calendar.refresh]] will not be called\n * after calendar is moved.\n */\n public move(jump: number = this.size, delayRefresh: boolean = false): this\n {\n this.span.start = this.moveStart( this.start, jump );\n this.span.end = this.moveEnd( this.end, jump );\n\n if (!delayRefresh)\n {\n this.refresh();\n }\n\n return this;\n }\n\n /**\n * Moves the calenndar to the next set of days.\n *\n * @param jump The amount to shift the calendar by.\n * @param delayRefresh When `true` [[Calendar.refresh]] will not be called\n * after calendar is moved.\n */\n public next(jump: number = this.size, delayRefresh: boolean = false): this\n {\n return this.move( jump, delayRefresh );\n }\n\n /**\n * Moves the calenndar to the previous set of days.\n *\n * @param jump The amount to shift the calendar by.\n * @param delayRefresh When `true` [[Calendar.refresh]] will not be called\n * after calendar is moved.\n */\n public prev(jump: number = this.size, delayRefresh: boolean = false): this\n {\n return this.move( -jump, delayRefresh );\n }\n\n /**\n * Converts this calendar to input which can be used to later recreate this\n * calendar. The only properties of the calendar which will be loss is the\n * [[Calendar.eventSorter]] property because it is a function.\n *\n * @param plain If the returned input should be plain objects as opposed\n * to [[Day]] and [[Event]] instances.\n * @param plainData A function to convert [[Event.data]] to a plain object if\n * it is not already.\n * @param plainMeta A function to convert values in [[Schedule.meta]] to plain\n * objects if they are not alreday.\n * @returns The input generated from this calendar.\n */\n public toInput(plain: boolean = false,\n plainData: (data: T) => any = d => d,\n plainMeta: (meta: M) => any = m => m): CalendarInput\n {\n let out: CalendarInput = {};\n\n out.type = this.type;\n out.size = this.size;\n out.fill = this.fill;\n out.minimumSize = this.minimumSize;\n out.repeatCovers = this.repeatCovers;\n out.listTimes = this.listTimes;\n out.eventsOutside = this.eventsOutside;\n out.updateRows = this.updateRows;\n out.updateColumns = this.updateColumns;\n out.around = plain ? this.span.start.dayIdentifier : this.span.start;\n out.events = [];\n\n for (let event of this.events)\n {\n if (plain)\n {\n let plainEvent: any = {};\n\n if (fn.isDefined(event.id))\n {\n plainEvent.id = event.id;\n }\n\n if (fn.isDefined(event.data))\n {\n plainEvent.data = plainData( event.data );\n }\n\n if (!event.visible)\n {\n plainEvent.visible = event.visible;\n }\n\n plainEvent.schedule = event.schedule.toInput();\n\n let meta = plainEvent.schedule.meta;\n\n if (meta)\n {\n for (let identifier in meta)\n {\n meta[ identifier ] = plainMeta( meta[ identifier ] );\n }\n }\n\n out.events.push( plainEvent );\n }\n else\n {\n out.events.push( event );\n }\n }\n\n return out;\n }\n\n /**\n * Creates a calendar based on the given input.\n *\n * @param input The input which has at least the `type` specified.\n * @returns A new calendar instance.\n */\n public static fromInput(input: CalendarInput): Calendar\n {\n let initial: Day = Day.today();\n\n return new Calendar(initial, initial, null, 1, null, null, input);\n }\n\n /**\n * Creates a calendar based around a given unit optionally focused around a\n * given day.\n *\n * @param type The unit of the calendar.\n * @param days The number of units in the calendar.\n * @param around The day to focus the calendar on.\n * @param focus The value which describes how months are added around the given\n * day. The default value will center the calendar around the given day.\n * When the value is `0` the given day is the first day in the calendar,\n * and when the value is `1` the given day is the last day in the calendar.\n * @param input The default properties for the calendar.\n * @returns A new calendar instance.\n */\n public static forType(type: Units, size: number = 1, around: Day = Day.today(), focus: number = 0.49999, input?: CalendarInput): Calendar\n {\n let meta: CalendarTypeDefinition = this.TYPES[ type ];\n let start: Day = meta.getStart( around, size, focus );\n let end: Day = meta.getEnd( start, size, focus );\n\n return new Calendar(start, end, type, size, meta.moveStart, meta.moveEnd, input || meta.defaultInput);\n }\n\n\n /**\n * Creates a calendar based around days optionally focused around a given day.\n *\n * @param days The number of days in the calendar.\n * @param around The day to focus the calendar on.\n * @param focus The value which describes how days are added around the given\n * day. The default value will center the calendar around the given day.\n * When the value is `0` the given day is the first day in the calendar,\n * and when the value is `1` the given day is the last day in the calendar.\n * @param input The default properties for the calendar.\n * @returns A new calendar instance.\n * @see [[Calendar.forType]]\n */\n public static days(days: number = 1, around: Day = Day.today(), focus: number = 0.4999, input?: CalendarInput): Calendar\n {\n return this.forType( Units.DAY, days, around, focus, input );\n }\n\n /**\n * Creates a calendar based around weeks optionally focused around a given day.\n *\n * @param days The number of weeks in the calendar.\n * @param around The day to focus the calendar on.\n * @param focus The value which describes how weeks are added around the given\n * day. The default value will center the calendar around the given day.\n * When the value is `0` the given day is the first day in the calendar,\n * and when the value is `1` the given day is the last day in the calendar.\n * @param input The default properties for the calendar.\n * @returns A new calendar instance.\n * @see [[Calendar.forType]]\n */\n public static weeks(weeks: number = 1, around: Day = Day.today(), focus: number = 0.4999, input?: CalendarInput): Calendar\n {\n return this.forType( Units.WEEK, weeks, around, focus, input );\n }\n\n /**\n * Creates a calendar based around months optionally focused around a given day.\n *\n * @param days The number of months in the calendar.\n * @param around The day to focus the calendar on.\n * @param focus The value which describes how months are added around the given\n * day. The default value will center the calendar around the given day.\n * When the value is `0` the given day is the first day in the calendar,\n * and when the value is `1` the given day is the last day in the calendar.\n * @param input The default properties for the calendar.\n * @returns A new calendar instance.\n * @see [[Calendar.forType]]\n */\n public static months(months: number = 1, around: Day = Day.today(), focus: number = 0.4999, input?: CalendarInput): Calendar\n {\n return this.forType( Units.MONTH, months, around, focus, input );\n }\n\n /**\n * Creates a calendar based around years optionally focused around a given day.\n *\n * @param days The number of years in the calendar.\n * @param around The day to focus the calendar on.\n * @param focus The value which describes how years are added around the given\n * day. The default value will center the calendar around the given day.\n * When the value is `0` the given day is the first day in the calendar,\n * and when the value is `1` the given day is the last day in the calendar.\n * @param input The default properties for the calendar.\n * @returns A new calendar instance.\n * @see [[Calendar.forType]]\n */\n public static years(years: number = 1, around: Day = Day.today(), focus: number = 0.4999, input?: CalendarInput): Calendar\n {\n return this.forType( Units.YEAR, years, around, focus, input );\n }\n\n /**\n * A map of functions and properties by [[Units]] used to create or morph\n * Calendars.\n */\n public static TYPES: CalendarTypeDefinitionMap =\n {\n [Units.DAY]:\n {\n getStart(around: Day, size: number, focus: number): Day {\n return around.start().relativeDays( -Math.floor( size * focus ) )\n },\n getEnd(start: Day, size: number, focus: number): Day {\n return start.relativeDays( size - 1 ).end();\n },\n moveStart(day: Day, amount: number): Day {\n return day.relativeDays(amount);\n },\n moveEnd(day: Day, amount: number): Day {\n return day.relativeDays(amount);\n },\n defaultInput: undefined\n },\n [Units.WEEK]:\n {\n getStart(around: Day, size: number, focus: number): Day {\n return around.start().startOfWeek().relativeWeeks( -Math.floor( size * focus ) );\n },\n getEnd(start: Day, size: number, focus: number): Day {\n return start.relativeWeeks( size - 1 ).endOfWeek();\n },\n moveStart(day: Day, amount: number): Day {\n return day.relativeWeeks(amount);\n },\n moveEnd(day: Day, amount: number): Day {\n return day.relativeWeeks(amount);\n },\n defaultInput: undefined\n },\n [Units.MONTH]:\n {\n getStart(around: Day, size: number, focus: number): Day {\n return around.start().startOfMonth().relativeMonths( -Math.floor( size * focus ) );\n },\n getEnd(start: Day, size: number, focus: number): Day {\n return start.relativeMonths( size - 1 ).endOfMonth();\n },\n moveStart(day: Day, amount: number): Day {\n return day.relativeMonths(amount);\n },\n moveEnd(day: Day, amount: number): Day {\n return day.startOfMonth().relativeMonths(amount).endOfMonth();\n },\n defaultInput: { fill: true }\n },\n [Units.YEAR]:\n {\n getStart(around: Day, size: number, focus: number): Day {\n return around.start().startOfYear().relativeYears( -Math.floor( size * focus ) );\n },\n getEnd(start: Day, size: number, focus: number): Day {\n return start.relativeYears( size - 1 ).endOfYear();\n },\n moveStart(day: Day, amount: number): Day {\n return day.relativeYears(amount);\n },\n moveEnd(day: Day, amount: number): Day {\n return day.relativeYears(amount);\n },\n defaultInput: { fill: true }\n }\n };\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Calendar.ts","\n/**\n * The months in a year.\n */\nexport class Month\n{\n\n public static JANUARY: number = 0;\n public static FEBRUARY: number = 1;\n public static MARCH: number = 2;\n public static APRIL: number = 3;\n public static MAY: number = 4;\n public static JUNE: number = 5;\n public static JULY: number = 6;\n public static AUGUST: number = 7;\n public static SEPTEMBER: number = 8;\n public static OCTOBER: number = 9;\n public static NOVEMBER: number = 10;\n public static DECEMBER: number = 11;\n\n /**\n * The full list of months in a year.\n */\n public static LIST: number[] = [\n Month.JANUARY,\n Month.FEBRUARY,\n Month.MARCH,\n Month.APRIL,\n Month.MAY,\n Month.JUNE,\n Month.JULY,\n Month.AUGUST,\n Month.SEPTEMBER,\n Month.OCTOBER,\n Month.NOVEMBER,\n Month.DECEMBER\n ];\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Month.ts","\n\n/**\n * The days in a week.\n */\nexport class Weekday\n{\n\n public static SUNDAY: number = 0;\n public static MONDAY: number = 1;\n public static TUESDAY: number = 2;\n public static WEDNESDAY: number = 3;\n public static THURSDAY: number = 4;\n public static FRIDAY: number = 5;\n public static SATURDAY: number = 6;\n\n /**\n * The full list of days in a week.\n */\n public static LIST: number[] = [\n Weekday.SUNDAY,\n Weekday.MONDAY,\n Weekday.TUESDAY,\n Weekday.WEDNESDAY,\n Weekday.THURSDAY,\n Weekday.FRIDAY,\n Weekday.SATURDAY\n ];\n\n /**\n * The list of days starting with Monday and ending on Friday.\n */\n public static WEEK: number[] = [\n Weekday.MONDAY,\n Weekday.TUESDAY,\n Weekday.WEDNESDAY,\n Weekday.THURSDAY,\n Weekday.FRIDAY\n ];\n\n /**\n * The days on the weekend, starting with Saturday and ending with Sunday.\n */\n public static ENDS: number[] = [\n Weekday.SATURDAY,\n Weekday.SUNDAY\n ];\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Weekday.ts","\nimport { Functions as fn } from './Functions';\nimport { Day, DayProperty } from './Day';\nimport { Suffix } from './Suffix';\nimport { Weekday } from './Weekday';\nimport { FrequencyValueEvery } from './Frequency';\nimport { ScheduleInput } from './Schedule';\n\n\n/**\n * Describes a [[Pattern]] given a [[Day]] to base it on.\n *\n * @param day The day to base the description on.\n * @returns The description of the pattern.\n */\nexport type DescribePattern = (day: Day) => string;\n\n/**\n * A rule helps parse [[ScheduleInput]] and determines whether it matches the\n * given pattern.\n *\n * - When a number is given, the input MUST be an array of the same length and contain any values.\n * - When an array of numbers is given, the input MUST be an array containing the same values.\n * - When a TRUE is given the input MUST contain that property and can be any value.\n * - When a FALSE is given the input MAY contain that property (optional).\n * - When a property is NOT specified, the input MUST NOT contain that property.\n * - When an object with every is given, the input must match the every and offset values (have the same frequency).\n */\nexport type PatternRule =\n number | // has array with this number of elements\n number[] | // is array with same values\n boolean | // is true or false\n FrequencyValueEvery; // is object with matching every and offset\n\n/**\n * The set of rules you can specify for determining if a [[ScheduleInput]]\n * matches a pattern.\n */\nexport interface PatternRules\n{\n dayOfWeek?: PatternRule;\n dayOfMonth?: PatternRule;\n lastDayOfMonth?: PatternRule;\n dayOfYear?: PatternRule;\n month?: PatternRule;\n week?: PatternRule;\n year?: PatternRule;\n weekOfYear?: PatternRule;\n weekspanOfYear?: PatternRule;\n fullWeekOfYear?: PatternRule;\n lastWeekspanOfYear?: PatternRule;\n lastFullWeekOfYear?: PatternRule;\n weekOfMonth?: PatternRule;\n weekspanOfMonth?: PatternRule;\n fullWeekOfMonth?: PatternRule;\n lastWeekspanOfMonth?: PatternRule;\n lastFullWeekOfMonth?: PatternRule;\n}\n\n\n/**\n * A class which helps describe [[ScheduleInput]] if it matches a pattern.\n */\nexport class Pattern\n{\n\n /**\n * The properties in the [[ScheduleInput]] which are compared against the\n * rules of a pattern.\n */\n public static PROPS: DayProperty[] =\n [\n 'dayOfWeek', 'dayOfMonth', 'lastDayOfMonth', 'dayOfYear',\n 'month', 'week', 'year',\n 'weekOfYear', 'weekspanOfYear', 'fullWeekOfYear', 'lastWeekspanOfYear', 'lastFullWeekOfYear',\n 'weekOfMonth', 'weekspanOfMonth', 'fullWeekOfMonth', 'lastWeekspanOfMonth', 'lastFullWeekOfMonth'\n ];\n\n /**\n * Whether this pattern should be \"listed\" or not. Visual schedulers may\n * provide a shortcut to describing and changing a [[Schedule]] through\n * patterns and any pattern where listed is `true` could be an option in a\n * list. The default patterns are all listed.\n */\n public listed: boolean;\n\n /**\n * The function which describes this pattern given a [[Day]] to base it on.\n */\n public describe: DescribePattern;\n\n /**\n * The name of this pattern. This is not typically displayed to a user, just\n * to uniquely identify a pattern.\n */\n public name: string;\n\n /**\n * The rules for matching a pattern to a [[Schedule]] or applying a pattern to\n * a schedule.\n */\n public rules: PatternRules;\n\n\n /**\n * Creates a new pattern.\n *\n * @param name The unique name of the pattern.\n * @param listed If the pattern is \"listed\" [[Pattern.listed]].\n * @param describe A function to describe the pattern given a [[Day]].\n * @param rules The rules which describe how to detect and apply the pattern\n * to schedule input.\n */\n public constructor(name: string, listed: boolean, describe: DescribePattern, rules: PatternRules)\n {\n this.name = name;\n this.listed = listed;\n this.describe = describe;\n this.rules = rules;\n }\n\n /**\n * Applies this pattern to schedule input removing and adding any necessary\n * properties from the input to match this pattern - based around the day\n * provided.\n *\n * @param input The input to update to match this pattern.\n * @param day The day to base the schedule on.\n * @returns The reference to the input passed in.\n */\n public apply(input: ScheduleInput, day: Day): ScheduleInput\n {\n for (let prop of Pattern.PROPS)\n {\n let rule = this.rules[ prop ];\n\n // Should have one value\n if (rule === 1)\n {\n input[ prop ] = [day[ prop ]];\n }\n\n // Can be any of the values in the array\n if (fn.isArray(rule))\n {\n input[ prop ] = rule;\n }\n\n // Must not be present\n if (!fn.isDefined(rule))\n {\n delete input[ prop ];\n }\n }\n\n return input;\n }\n\n /**\n * Determines whether the given input matches this pattern. Optionally a day\n * can be provided to make sure the day matches the schedule and pattern\n * together.\n *\n * @param input The schedule input to test.\n * @param exactlyWith A day to further validate against for matching.\n * @returns `true` if the schedule input was a match to this pattern with the\n * day if one was provided, otherwise `false`.\n */\n public isMatch(input: ScheduleInput, exactlyWith?: Day): boolean\n {\n let exactly: boolean = fn.isDefined( exactlyWith );\n\n for (let prop of Pattern.PROPS)\n {\n let rule = this.rules[ prop ];\n let curr = input[ prop ];\n\n // Optional, skip it\n if (rule === false)\n {\n continue;\n }\n\n // Requires any value\n if (rule === true && !curr)\n {\n return false;\n }\n\n // Must not be present\n if (!fn.isDefined(rule) && curr)\n {\n return false;\n }\n\n // Must be an array of the same size\n if (fn.isNumber(rule))\n {\n if (fn.isArray(curr) && curr.length === rule)\n {\n if (exactly && curr.indexOf( exactlyWith[ prop ] ) === -1)\n {\n return false;\n }\n }\n else\n {\n return false;\n }\n }\n\n // Must be an array of the same values\n if (fn.isArray(rule))\n {\n if (!fn.isArray(curr))\n {\n return false;\n }\n\n if (rule.length !== curr.length)\n {\n return false;\n }\n\n for (var i = 0; i < rule.length; i++)\n {\n if (rule[ i ] !== curr[ i ])\n {\n return false;\n }\n }\n\n if (exactly && rule.indexOf( exactlyWith[ prop ] ) === -1)\n {\n return false;\n }\n }\n\n // Must be an object with same over & offset.\n if (fn.isObject(rule))\n {\n if (!fn.isObject(curr))\n {\n return false;\n }\n\n var ruleOffset = rule.offset || 0;\n var currOffset = curr.offset || 0;\n\n if (currOffset !== ruleOffset || curr.every !== rule.every)\n {\n return false;\n }\n\n if (exactly && (exactlyWith[ prop ] % rule.every) !== ruleOffset)\n {\n return false;\n }\n }\n }\n\n return true;\n }\n\n /**\n * Returns the pattern with the given name if one exists. If you add your own\n * patterns make sure to add them to [[PatternMap]].\n *\n * @param name The name of the pattern to return.\n * @return The instance to the pattern with the same name.\n */\n public static withName(name: string): Pattern\n {\n return PatternMap[ name ];\n }\n\n /**\n * Finds a matching pattern to the given input searching through [[Patterns]]\n * for matches. Optionally it will only look at patterns where listed = `true`.\n *\n * @param input The schedule input to use.\n * @param listedOnly When `true` only patterns with [[Pattern.listed]] set to\n * `true` will be looked at, otherwise all patterns are looked at.\n * @param exactlyWith A day to further validate against for matching.\n * @see [[Pattern.isMatch]]\n */\n public static findMatch(input: ScheduleInput, listedOnly: boolean = true, exactlyWith?: Day): Pattern\n {\n for (let pattern of Patterns)\n {\n if ((pattern.listed || !listedOnly) && pattern.isMatch( input, exactlyWith ))\n {\n return pattern;\n }\n }\n\n return null;\n }\n\n}\n\n\n/**\n * The list of patterns that can be searched through for matches to schedule\n * input.\n *\n * @see [[Pattern.findMatch]]\n */\nexport let Patterns: Pattern[] = [\n new Pattern(\n 'none', true,\n (day: Day) => 'Does not repeat',\n {\n year: 1,\n month: 1,\n dayOfMonth: 1\n }\n ),\n new Pattern(\n 'daily', true,\n (day: Day) => 'Daily',\n {\n\n }\n ),\n new Pattern(\n 'weekly', true,\n (day: Day) => 'Weekly on ' + day.format('dddd'),\n {\n dayOfWeek: 1\n }\n ),\n new Pattern(\n 'monthlyWeek', true,\n (day: Day) => 'Monthly on the ' + Suffix.CACHE[day.weekspanOfMonth + 1] + ' ' + day.format('dddd'),\n {\n dayOfWeek: 1,\n weekspanOfMonth: 1\n }\n ),\n new Pattern(\n 'annually', true,\n (day: Day) => 'Annually on ' + day.format('MMMM Do'),\n {\n month: 1,\n dayOfMonth: 1\n }\n ),\n new Pattern(\n 'annuallyMonthWeek', true,\n (day: Day) => 'Annually on the ' + Suffix.CACHE[day.weekspanOfMonth + 1] + ' ' + day.format('dddd') + ' of ' + day.format('MMMM'),\n {\n month: 1,\n dayOfWeek: 1,\n weekspanOfMonth: 1\n }\n ),\n new Pattern(\n 'weekday', true,\n (day: Day) => 'Every weekday (Monday to Friday)',\n {\n dayOfWeek: [Weekday.MONDAY, Weekday.TUESDAY, Weekday.WEDNESDAY, Weekday.THURSDAY, Weekday.FRIDAY]\n }\n ),\n new Pattern(\n 'monthly', true,\n (day: Day) => 'Monthly on the ' + day.format('Do') + ' day',\n {\n dayOfMonth: 1\n }\n ),\n new Pattern(\n 'custom', true,\n (day: Day) => 'Custom...',\n {\n dayOfWeek: false,\n dayOfMonth: false,\n lastDayOfMonth: false,\n dayOfYear: false,\n year: false,\n month: false,\n week: false,\n weekOfYear: false,\n weekspanOfYear: false,\n fullWeekOfYear: false,\n lastWeekspanOfYear: false,\n lastFullWeekOfYear: false,\n weekOfMonth: false,\n weekspanOfMonth: false,\n fullWeekOfMonth: false,\n lastWeekspanOfMonth: false,\n lastFullWeekOfMonth: false\n }\n )\n];\n\n/**\n * The map of patterns keyed by their name.\n *\n * @see [[Pattern.withName]]\n */\nexport let PatternMap: { [name: string]: Pattern } = {};\n\nfor (let pattern of Patterns)\n{\n PatternMap[ pattern.name ] = pattern;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Pattern.ts","\nimport { CalendarEvent } from './CalendarEvent';\nimport { Event } from './Event';\n\n\n/**\n * A function which takes two [[CalendarEvent]]s and returns a number which\n * instructs a sort which event goes before the other in a list.\n *\n * @param a The first event.\n * @param b The second event.\n * @returns When both events are considered equal `0` is returned, when the\n * first event should go before the second event a negative number is\n * returned, when the second event should go before the first event a\n * positive number is returned.\n */\nexport type SortEvent = (a: CalendarEvent, b: CalendarEvent) => number;\n\n/**\n * A class with [[SortEvent]] functions and functions which accept other\n * [[SortEvent]]s and return a new [[SortEvent]].\n *\n * ```typescript\n * // Sorts full day events first, then events in descending order based on start time.\n * Sorts.List([Sorts.FullDay, Sorts.Desc(Sorts.Start)]);\n * ```\n */\nexport class Sorts\n{\n\n /**\n * Sorts the two events by their start time - the earliest event being first\n * in order.\n *\n * @param a The first event.\n * @param b The second event.\n * @returns The difference in time between the start of `a` and `b`.\n * @see [[CalendarEvent.time]]\n */\n public static Start(a: CalendarEvent, b: CalendarEvent): number\n {\n return a.time.start.time - b.time.start.time;\n }\n\n /**\n * Sorts the two events by their end time - the earliest to end being first\n * in order.\n *\n * @param a The first event.\n * @param b The second event.\n * @returns The difference in time between the end of `a` and `b`.\n * @see [[CalendarEvent.time]]\n */\n public static End(a: CalendarEvent, b: CalendarEvent): number\n {\n return a.time.end.time - b.time.end.time;\n }\n\n /**\n * Sorts the two events placing the full day events before the timed events.\n *\n * @param a The first event.\n * @param b The second event.\n * @returns If both are timed or both are full day then `0` is returned,\n * otherwise `-1` is returned if `a` is full day and `1` is returned if\n * `b` is full day.\n * @see [[CalendarEvent.fullDay]]\n */\n public static FullDay(a: CalendarEvent, b: CalendarEvent): number\n {\n let af: number = a.fullDay ? 0 : 1;\n let bf: number = b.fullDay ? 0 : 1;\n\n return af - bf;\n }\n\n /**\n * Sorts the two events placing the shorter events before the longer events.\n * Full day or multiple day events actually take up a day and will be ordered\n * last.\n *\n * @param a The first event.\n * @param b The second event.\n * @returns The difference in milliseconds between `a` and `b`.\n * @see [[CalendarEvent.time]]\n * @see [[DaySpan.millis]]\n */\n public static Duration(a: CalendarEvent, b: CalendarEvent): number\n {\n return a.time.millis() - b.time.millis();\n }\n\n /**\n * Returns a [[SortEvent]] that effectively orders the given sorter in the\n * opposite (often descending) order.\n *\n * @param sorter The sorter to reverse.\n * @returns A new sorter which reverses the one passed in.\n */\n public static Desc(sorter: SortEvent): SortEvent\n {\n return (a, b) =>\n {\n return sorter( b, a );\n };\n }\n\n /**\n * Returns a [[SortEvent]] that orders the events based on a string in each\n * event. A function must be supplied which takes an event of type `T` and\n * returns a string.\n *\n * @param getString A function which returns a string from the event.\n * @returns A sorter which sorts strings alphabetically.\n */\n public static Alphabetical(getString: (event: Event) => string): SortEvent\n {\n return (a, b) =>\n {\n let as: string = getString( a.event ) || '';\n let bs: string = getString( b.event ) || '';\n\n return as.localeCompare( bs );\n };\n }\n\n /**\n * Returns a [[SortEvent]] that orders events based on a number in each event.\n * A function must be supplied which takes an event of type `T` and returns\n * a number.\n *\n * @param getOrder A function which returns a number from the event.\n * @returns A sorter which sorts events based on a number in ascending order.\n */\n public static Ordered(getOrder: (event: Event) => number): SortEvent\n {\n return (a, b) =>\n {\n let ao: number = getOrder( a.event );\n let bo: number = getOrder( b.event );\n\n return ao - bo;\n };\n }\n\n /**\n * Returns a [[SortEvent]] that orders events based on an array of sorters.\n * The first sorter which returns a non-zero result is used.\n *\n * @param sorters A list of sorting functions to test one at a time.\n * @returns A sorter which sorts based on a list of sorters.\n */\n public static List(sorters: SortEvent[]): SortEvent\n {\n return (a, b) =>\n {\n for (let sorter of sorters)\n {\n let compare: number = sorter(a, b);\n\n if (compare !== 0)\n {\n return compare;\n }\n }\n\n return 0;\n };\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Sort.ts","\nexport * from './Calendar';\nexport * from './CalendarDay';\nexport * from './CalendarEvent';\nexport * from './Event';\nexport * from './Constants';\nexport * from './Day';\nexport * from './DaySpan';\nexport * from './Frequency';\nexport * from './Functions';\nexport * from './Identifier';\nexport * from './Iterator';\nexport * from './Month';\nexport * from './Operation';\nexport * from './Parse';\nexport * from './Pattern';\nexport * from './Schedule';\nexport * from './ScheduleModifier';\nexport * from './Sort';\nexport * from './Suffix';\nexport * from './Time';\nexport * from './Units';\nexport * from './Weekday';\n\n\n\n// WEBPACK FOOTER //\n// ./src/index.ts"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 0be101e5490c941bbb11","webpack:///external {\"commonjs\":\"moment\",\"commonjs2\":\"moment\",\"amd\":\"moment\",\"root\":\"moment\"}","webpack:///./src/Functions.ts","webpack:///./src/Operation.ts","webpack:///./src/Units.ts","webpack:///./src/Constants.ts","webpack:///./src/DaySpan.ts","webpack:///./src/Identifier.ts","webpack:///./src/Suffix.ts","webpack:///./src/Iterator.ts","webpack:///./src/ScheduleModifier.ts","webpack:///./src/Schedule.ts","webpack:///./src/Event.ts","webpack:///./src/Time.ts","webpack:///./src/Parse.ts","webpack:///./src/Day.ts","webpack:///./src/CalendarDay.ts","webpack:///./src/CalendarEvent.ts","webpack:///./src/Calendar.ts","webpack:///./src/Month.ts","webpack:///./src/Weekday.ts","webpack:///./src/Pattern.ts","webpack:///./src/Sort.ts","webpack:///./src/index.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;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C,CAAC,CAAC;IACJ,CAAC;IAED;;;;;;;OAOG;IACW,aAAO,GAArB,UAA4B,QAAwC;QAElE,MAAM,CAAC,UAAC,CAAC,EAAE,CAAC;YAEV,IAAI,EAAE,GAAW,QAAQ,CAAE,CAAC,CAAC,KAAK,CAAE,CAAC;YACrC,IAAI,EAAE,GAAW,QAAQ,CAAE,CAAC,CAAC,KAAK,CAAE,CAAC;YAErC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;QACjB,CAAC,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACW,UAAI,GAAlB,UAAyB,OAA0B;QAEjD,MAAM,CAAC,UAAC,CAAC,EAAE,CAAC;YAEV,GAAG,CAAC,CAAe,UAAO,EAAP,mBAAO,EAAP,qBAAO,EAAP,IAAO;gBAArB,IAAI,MAAM;gBAEb,IAAI,OAAO,GAAW,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;gBAEnC,EAAE,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,CAClB,CAAC;oBACC,MAAM,CAAC,OAAO,CAAC;gBACjB,CAAC;aACF;YAED,MAAM,CAAC,CAAC,CAAC;QACX,CAAC,CAAC;IACJ,CAAC;IAEH,YAAC;AAAD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACzK0B;AACG;AACE;AACR;AACI;AACN;AACI;AAEE;AACC;AACF;AACH;AACI;AACJ;AACE;AACC;AACQ;AACZ;AACE;AACF;AACC;AACE","file":"dayspan.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"moment\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"ds\", [\"moment\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"ds\"] = factory(require(\"moment\"));\n\telse\n\t\troot[\"ds\"] = factory(root[\"moment\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_0__) {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 0be101e5490c941bbb11","module.exports = __WEBPACK_EXTERNAL_MODULE_0__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external {\"commonjs\":\"moment\",\"commonjs2\":\"moment\",\"amd\":\"moment\",\"root\":\"moment\"}\n// module id = 0\n// module chunks = 0","\n\n/**\n * The class which contains commonly used functions by the library. These\n * functions and variables exist in a class so they may be overridden if\n * desired.\n */\nexport class Functions\n{\n\n /**\n * Determines whether the given input is an array.\n *\n * @param input The variable to test.\n * @returns `true` if the variable is an array, otherwise `false`.\n */\n public static isArray(input: any): boolean\n {\n return input instanceof Array;\n }\n\n /**\n * Determines whether the two arrays given are stricly equivalent. If the\n * arrays are not the same length or contain the same values in the same order\n * then `false` is returned.\n *\n * @param x The first array to test.\n * @param y The second array to test.\n * @returns `true` if they have the same exact values, otherwise `false`.\n */\n public static isArrayEquals(x: any[], y: any[]): boolean\n {\n if (x === y) return true;\n if (x.length !== y.length) return false;\n\n for (let i = 0; i < x.length; i++)\n {\n if (x[ i ] !== y[ i ])\n {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Determines whether the given input is a string.\n *\n * @param input The variable to test.\n * @returns `true` if the variable is a string, otherwise `false`.\n */\n public static isString(input: any): boolean\n {\n return typeof(input) === 'string';\n }\n\n /**\n * Determines whether the given input is a finite number (a number which is\n * not infinite or not the result of a divide-by-zero operation).\n *\n * @param input The variable to test.\n * @returns `true` if the variable is a finite number, otherwise `false`.\n */\n public static isNumber(input: any): boolean\n {\n return isFinite(input);\n }\n\n /**\n * Determines whether the given input is an object and NOT an array.\n *\n * @param input The variable to test.\n * @returns `true` if the variable is a plain object, otherwise `false`.\n */\n public static isObject(input: any): boolean\n {\n return !this.isArray(input) && typeof(input) === 'object';\n }\n\n /**\n * Determines whether the given input is defined.\n *\n * @param input The variable to test.\n * @return `true` if the variable is defined, otherwise `false`.\n */\n public static isDefined(input: any): boolean\n {\n return typeof(input) !== 'undefined';\n }\n\n /**\n * Determines whether the given input is defined and not null.\n *\n * @param input The variable to test.\n * @return `true` if the variable is defined and not null, otherwise `false`.\n */\n public static isValue(input: any): boolean\n {\n return input !== null && typeof(input) !== 'undefined';\n }\n\n /**\n * Determines whether the given input appears to be a valid\n * [[FrequencyValueEvery]].\n *\n * ```typescript\n * Functions.isFrequencyValueEvery({}); // false\n * Functions.isFrequencyValueEvery([]); // false\n * Functions.isFrequencyValueEvery([1]); // false\n * Functions.isFrequencyValueEvery(null); // false\n * Functions.isFrequencyValueEvery({every:2}); // true\n * Functions.isFrequencyValueEvery({offset:1}); // false\n * Functions.isFrequencyValueEvery({every:2, offset:1}); // true\n * ```\n *\n * @param input The variable to test.\n * @returns `true` if the variable appears to be a [[FrequencyValueEvery]],\n * otherwise false.\n */\n public static isFrequencyValueEvery(input: any): boolean\n {\n return this.isObject( input ) && this.isNumber( input.every );\n }\n\n /**\n * Determines whether the given input appears to be a valid\n * [[FrequencyValueOneOf]].\n *\n * ```typescript\n * Functions.isFrequencyValueOneOf({}); // false\n * Functions.isFrequencyValueOneOf([]); // false\n * Functions.isFrequencyValueOneOf([1]); // true\n * Functions.isFrequencyValueOneOf(null); // false\n * ```\n *\n * @param input The variable to test.\n * @returns `true` if the variable appears to be a [[FrequencyValueOneOf]],\n * otherwise false.\n */\n public static isFrequencyValueOneOf(input: any): boolean\n {\n return this.isArray( input ) && input.length > 0;\n }\n\n /**\n * Returns the first argument which is defined.\n *\n * ```typescript\n * Functions.coalesce(3, 4); // 3\n * Functions.coalesce(undefined, 4); // 4\n * Functions.coalesce(null, 4); // null\n * Functions.coalesce(void 0, void 0, 5); // 5\n * ```\n *\n * @param a The first argument to look at.\n * @param b The second argument to look at.\n * @returns The first defined argument.\n * @see [[Functions.isDefined]]\n */\n public static coalesce(a: any, b: any, c?: any): any\n {\n return this.isDefined( a ) ? a : (this.isDefined( b ) ? b : c);\n }\n\n /**\n * Copies values from `from` object and sets them to the `target` object.\n *\n * @param target The object to set values to.\n * @param from The object to copy value references from.\n * @returns The reference to `target`.\n */\n public static extend(target: any, from: any): any\n {\n for (let prop in from)\n {\n target[ prop ] = from[ prop ];\n }\n\n return target;\n }\n\n /**\n * Pads the string `x` up to `length` characters with the given `padding`\n * optionally placing the `padding` `before` `x`.\n *\n * ```typescript\n * Functions.pad('hey', 5, '_', false); // 'hey__'\n * Functions.pad('hey', 5, '_', true); // '__hey'\n * Functions.pad('heyman', 5, '_', true); // 'heyman'\n * ```\n *\n * @param x The string to pad.\n * @param length The length to pad to.\n * @param padding The string to pad with.\n * @param before If the padding should go before the string to pad.\n * @returns The padded string if any padding needed be added.\n */\n public static pad(x: string, length: number, padding: string, before: boolean): string\n {\n while (x.length < length)\n {\n before ? x = padding + x : x = x + padding;\n }\n\n return x;\n }\n\n /**\n * Pads the number `x` up to `length` digits where the padding is `0` and it\n * goes before `x`. This function will only return the first `length`\n * characters of the padding string representation of the number but can return\n * an alternative number of `first` characters.\n *\n * ```typescript\n * Functions.padNumber(29, 3); // '029'\n * Functions.padNumber(29, 3, 2); // '02'\n * Functions.padNumber(9573, 3); // '957'\n * ```\n *\n * @param x The number to pad with zeros in the beginning.\n * @param length The number of digits the number should be padded to.\n * @param first The number of digits to return from the start of the string.\n * @returns A padded number.\n */\n public static padNumber(x: number, length: number, first: number = length)\n {\n return this.pad(x + '', length, '0', true).substring( 0, first );\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Functions.ts","\n/**\n * An operation that can be performed on a single number.\n */\nexport enum Op\n{\n /**\n * The number is returned unmodified.\n */\n NONE,\n\n /**\n * The number is rounded down to the nearest whole number.\n */\n FLOOR,\n\n /**\n * The number is rounded up to the nearest whole number.\n */\n CEIL,\n\n /**\n * The number is rounded up or down depending on if the fractional value is\n * greater than or less than 0.5 respectively.\n */\n ROUND,\n\n /**\n * The fractional part of the number is dropped.\n */\n TRUNCATE,\n\n /**\n * The number is rounded up when positive and down when negative. This is\n * effectively ceiling the absolute value where the result preserves the sign.\n */\n UP,\n\n /**\n * The number is rounded down when positive and up when negative. This is\n * effectively floor the absolute value where the result preserves the sign.\n */\n DOWN\n}\n\n\n/**\n * Performs the requested operation on the given number, optionally taking\n * the absolute value of the number before the operation.\n *\n * @param value The number to operate on.\n * @param op The operation to perform.\n * @param absolute If the number should be positive before the operation.\n * @return The operated result, or the original value if its not a valid number.\n */\nexport function operate(value: number, op: Op, absolute: boolean = false)\n{\n if (isFinite(value))\n {\n if (absolute)\n {\n value = Math.abs( value );\n }\n\n switch (op)\n {\n case Op.NONE:\n return value;\n case Op.FLOOR:\n return Math.floor( value );\n case Op.CEIL:\n return Math.ceil( value );\n case Op.ROUND:\n return Math.round( value );\n case Op.TRUNCATE:\n case Op.DOWN:\n return value < 0 ? Math.ceil( value ) : Math.floor( value );\n case Op.UP:\n return value < 0 ? Math.floor( value ) : Math.ceil( value );\n }\n }\n\n return value;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Operation.ts","\n\n/**\n * Units of time that are compromised of 1 or more days for the [[Calendar]] class.\n */\nexport enum Units\n{\n DAY,\n WEEK,\n MONTH,\n YEAR\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Units.ts","\n\n/**\n * A class that stores commonly used values.\n */\nexport class Constants\n{\n\n /**\n * The number of milliseconds in a second.\n */\n public static MILLIS_IN_SECOND: number = 1000;\n\n /**\n * The number of milliseconds in a minute.\n */\n public static MILLIS_IN_MINUTE: number = Constants.MILLIS_IN_SECOND * 60;\n\n /**\n * The number of milliseconds in an hour.\n */\n public static MILLIS_IN_HOUR: number = Constants.MILLIS_IN_MINUTE * 60;\n\n /**\n * The number of milliseconds in a day (not including DST days).\n */\n public static MILLIS_IN_DAY: number = Constants.MILLIS_IN_HOUR * 24;\n\n /**\n * The number of milliseconds in a week (not including ones that include DST).\n */\n public static MILLIS_IN_WEEK: number = Constants.MILLIS_IN_DAY * 7;\n\n\n /**\n * The number of days in a week.\n */\n public static DAYS_IN_WEEK: number = 7;\n\n\n /**\n * The number of months in a year.\n */\n public static MONTHS_IN_YEAR: number = 12;\n\n /**\n * The number of hours in a day (not including DST days).\n */\n public static HOURS_IN_DAY: number = 24;\n\n\n /**\n * The first month of the year.\n */\n public static MONTH_MIN: number = 0;\n\n /**\n * The last month of the year.\n */\n public static MONTH_MAX: number = 11;\n\n /**\n * The first day of a month.\n */\n public static DAY_MIN: number = 1;\n\n /**\n * The last day of the longest month.\n */\n public static DAY_MAX: number = 31;\n\n /**\n * The first hour of the day.\n */\n public static HOUR_MIN: number = 0;\n\n /**\n * The last hour of the day.\n */\n public static HOUR_MAX: number = 23;\n\n /**\n * The first minute of the hour.\n */\n public static MINUTE_MIN: number = 0;\n\n /**\n * The last minute of the hour.\n */\n public static MINUTE_MAX: number = 59;\n\n /**\n * The first second of the minute.\n */\n public static SECOND_MIN: number = 0;\n\n /**\n * The last second of the minute.\n */\n public static SECOND_MAX: number = 59;\n\n /**\n * The first millisecond of the second.\n */\n public static MILLIS_MIN: number = 0;\n\n /**\n * The last millisecond of the second.\n */\n public static MILLIS_MAX: number = 999;\n\n /**\n * The first day of the week.\n */\n public static WEEKDAY_MIN: number = 0;\n\n /**\n * The last day of the week.\n */\n public static WEEKDAY_MAX: number = 6;\n\n\n /**\n * The default duration for an event.\n */\n public static DURATION_DEFAULT: number = 1;\n\n /**\n * The default duration unit for an all day event.\n */\n public static DURATION_DEFAULT_UNIT_ALL: string = 'days';\n\n /**\n * The default duration unit for an event at a given time.\n */\n public static DURATION_DEFAULT_UNIT_TIMES: string = 'hours';\n\n /**\n * Computes the duration unit given its for an all day event.\n *\n * @param all If the event is all day.\n * @return The default unit for the event.\n */\n public static DURATION_DEFAULT_UNIT: (all: boolean) => string =\n all => all ? Constants.DURATION_DEFAULT_UNIT_ALL :\n Constants.DURATION_DEFAULT_UNIT_TIMES;\n\n /**\n * The number of milliseconds for various duration units. These are worse case\n * scenario and do not include DST changes.\n */\n public static DURATION_TO_MILLIS = {\n minute: Constants.MILLIS_IN_MINUTE,\n minutes: Constants.MILLIS_IN_MINUTE,\n hour: Constants.MILLIS_IN_HOUR,\n hours: Constants.MILLIS_IN_HOUR,\n day: Constants.MILLIS_IN_DAY,\n days: Constants.MILLIS_IN_DAY,\n week: Constants.MILLIS_IN_WEEK,\n weeks: Constants.MILLIS_IN_WEEK,\n month: Constants.MILLIS_IN_DAY * Constants.DAY_MAX,\n months: Constants.MILLIS_IN_DAY * Constants.DAY_MAX\n };\n\n /**\n * The maximum estimated number of events per day. This is used to calculate\n * [[CalendarEvent.id]] to give each event a unique ID. If you think you will\n * have more events than this per day, you can enlarge the value.\n */\n public static MAX_EVENTS_PER_DAY: number = 24;\n\n /**\n * The day of the week which determines the first week of the year or month.\n * By default this day is Thursday.\n */\n public static WEEK_OF_MONTH_MINIMUM_WEEKDAY: number = 4;\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Constants.ts","\nimport { Day } from './Day';\nimport { Op } from './Operation';\nimport { Units } from './Units';\nimport { Constants } from './Constants';\n\n\n\n/**\n * The calculated bounds of a DaySpan relative to a given day.\n */\nexport interface DaySpanBounds\n{\n\n /**\n * The top of the span within the rectangle of the given day.\n */\n top: number;\n\n /**\n * The bottom of the span within the rectangle of the givne day.\n */\n bottom: number;\n\n /**\n * The height of the span within the rectangle of the given day. This is\n * equivalent by `bottom - top`.\n */\n height: number;\n\n /**\n * The left of the span within the rectangle of the given day.\n */\n left: number;\n\n /**\n * The right of the span within the rectangle of the given day.\n */\n right: number;\n\n /**\n * The width of the span within the rectangle of the given day. This is\n * equivalent by `right - left`.\n */\n width: number;\n}\n\n/**\n * A class for a range of time between two [[Day]] timestamps.\n */\nexport class DaySpan\n{\n\n\n /**\n * The starting timestamp of the span (inclusive).\n */\n public start: Day;\n\n /**\n * The endind timestamp of the span (inclusive).\n */\n public end: Day;\n\n\n /**\n * Creates a new span of time.\n *\n * @param start The starting timestamp.\n * @param end The ending timestamp.\n */\n public constructor(start: Day, end: Day)\n {\n this.start = start;\n this.end = end;\n }\n\n /**\n * Whether this span starts and ends on the same timestamp.\n */\n public get isPoint(): boolean\n {\n return this.start.time === this.end.time;\n }\n\n /**\n * Determines whether the given timestamp lies between the start and end\n * timestamp.\n *\n * @param day The timestamp to test.\n * @returns True if the day is >= the start and <= the end of this span.\n */\n public contains(day: Day): boolean\n {\n return day.time >= this.start.time && day.time <= this.end.time;\n }\n\n /**\n * Compares the given timestamp to this span. If the timestamp is before this\n * span then `-1` is returned, if the timestamp is after this span then `1`\n * us returned, otherwise `0` is returned when the timestamp is in this span.\n *\n * @param day The timestamp to compare to.\n * @returns `-1`, `0`, or `1` depending on the given timestamp relative to\n * this span.\n */\n public compareTo(day: Day): number\n {\n return day.time < this.start.time ? -1 : (day.time > this.end.time ? 1 : 0);\n }\n\n /**\n * Determines whether the given timestamp is between the start and end\n * timestamp or lies on the same day as the start or end timestamp.\n *\n * @param day The timestamp to test.\n * @see [[Day.sameDay]]\n */\n public matchesDay(day: Day): boolean\n {\n return this.contains( day ) || day.sameDay( this.start ) || day.sameDay( this.end );\n }\n\n /**\n * Determines whether the given timestamp is between the start and end\n * timestamp or lies on the same week as the start or end timestamp.\n *\n * @param day The timestamp to test.\n * @see [[Day.sameWeek]]\n */\n public matchesWeek(day: Day): boolean\n {\n return this.contains( day ) || day.sameWeek( this.start ) || day.sameWeek( this.end );\n }\n\n /**\n * Determines whether the given timestamp is between the start and end\n * timestamp or lies on the same month as the start or end timestamp.\n *\n * @param day The timestamp to test.\n * @see [[Day.sameMonth]]\n */\n public matchesMonth(day: Day): boolean\n {\n return this.contains( day ) || day.sameMonth( this.start ) || day.sameMonth( this.end );\n }\n\n /**\n * Determines whether the given timestamp is between the start and end\n * timestamp or lies on the same year as the start or end timestamp.\n *\n * @param day The timestamp to test.\n * @see [[Day.sameYear]]\n */\n public matchesYear(day: Day): boolean\n {\n return this.contains( day ) || day.sameYear( this.start ) || day.sameYear( this.end );\n }\n\n\n /**\n * Calculates the number of milliseconds between the start and end timestamp.\n *\n * @param op The operation to perform on the result.\n * @param absolute Whether the result should always be positive.\n * @returns The time between the start and end timestamp.\n * @see [[Day.millisBetween]]\n */\n public millis(op: Op = Op.DOWN, absolute: boolean = true): number\n {\n return this.start.millisBetween(this.end, op, absolute);\n }\n\n /**\n * Calculates the number of seconds between the start and end timestamp.\n *\n * @param op The operation to perform on the result.\n * @param absolute Whether the result should always be positive.\n * @returns The time between the start and end timestamp.\n * @see [[Day.secondsBetween]]\n */\n public seconds(op: Op = Op.DOWN, absolute: boolean = true): number\n {\n return this.start.secondsBetween(this.end, op, absolute);\n }\n\n /**\n * Calculates the number of minutes between the start and end timestamp.\n *\n * @param op The operation to perform on the result.\n * @param absolute Whether the result should always be positive.\n * @returns The time between the start and end timestamp.\n * @see [[Day.minutesBetween]]\n */\n public minutes(op: Op = Op.DOWN, absolute: boolean = true): number\n {\n return this.start.minutesBetween(this.end, op, absolute);\n }\n\n /**\n * Calculates the number of hours between the start and end timestamp.\n *\n * @param op The operation to perform on the result.\n * @param absolute Whether the result should always be positive.\n * @returns The time between the start and end timestamp.\n * @see [[Day.hoursBetween]]\n */\n public hours(op: Op = Op.DOWN, absolute: boolean = true): number\n {\n return this.start.hoursBetween(this.end, op, absolute);\n }\n\n /**\n * Calculates the number of days between the start and end timestamp.\n *\n * @param op The operation to perform on the result.\n * @param absolute Whether the result should always be positive.\n * @returns The time between the start and end timestamp.\n * @see [[Day.daysBetween]]\n */\n public days(op: Op = Op.DOWN, absolute: boolean = true): number\n {\n return this.start.daysBetween(this.end, op, absolute);\n }\n\n /**\n * Calculates the number of weeks between the start and end timestamp.\n *\n * @param op The operation to perform on the result.\n * @param absolute Whether the result should always be positive.\n * @returns The time between the start and end timestamp.\n * @see [[Day.weeksBetween]]\n */\n public weeks(op: Op = Op.DOWN, absolute: boolean = true): number\n {\n return this.start.weeksBetween(this.end, op, absolute);\n }\n\n /**\n * Calculates the number of months between the start and end timestamp.\n *\n * @param op The operation to perform on the result.\n * @param absolute Whether the result should always be positive.\n * @returns The time between the start and end timestamp.\n * @see [[Day.monthsBetween]]\n */\n public months(op: Op = Op.DOWN, absolute: boolean = true): number\n {\n return this.start.monthsBetween(this.end, op, absolute);\n }\n\n /**\n * Calculates the number of years between the start and end timestamp.\n *\n * @param op The operation to perform on the result.\n * @param absolute Whether the result should always be positive.\n * @returns The time between the start and end timestamp.\n * @see [[Day.yearsBetween]]\n */\n public years(op: Op = Op.DOWN, absolute: boolean = true): number\n {\n return this.start.yearsBetween(this.end, op, absolute);\n }\n\n /**\n * Returns a delta value between 0 and 1 which represents where the\n * [[DaySpan.start]] is relative to the given day. The delta value would\n * be less than 0 if the start of the event is before the given day.\n *\n * @param relativeTo The day to find the start delta relative to.\n * @return A number between 0 and 1 if the start of this span is in the\n * 24-hour period starting at the given timestamp, otherwise the value\n * returned may be less than 0 or greater than 1.\n */\n public startDelta(relativeTo: Day): number\n {\n return (this.start.time - relativeTo.time) / Constants.MILLIS_IN_DAY;\n }\n\n /**\n * Returns a delta value between 0 and 1 which represents where the\n * [[DaySpan.end]] is relative to the given day. The delta value would\n * be greater than 1 if the end of the event is after the given day.\n *\n * @param relativeTo The day to find the end delta relative to.\n * @return A number between 0 and 1 if the end of this span is in the\n * 24-hour period starting at the given timestamp, otherwise the value\n * returned may be less than 0 or greater than 1.\n */\n public endDelta(relativeTo: Day): number\n {\n return (this.end.time - relativeTo.time) / Constants.MILLIS_IN_DAY;\n }\n\n /**\n * Calculates the bounds for span event if it were placed in a rectangle which\n * represents a day (24 hour period). By default the returned values are\n * between 0 and 1 and can be scaled by the proper rectangle dimensions or the\n * rectangle dimensions can be passed to this function.\n *\n * @param relativeTo The day to find the bounds relative to. If this is not the\n * start of the day the returned bounds is relative to the given time.\n * @param dayHeight The height of the rectangle of the day.\n * @param dayWidth The width of the rectangle of the day.\n * @param columnOffset The offset in the rectangle of the day to adjust this\n * span by. This also reduces the width of the returned bounds to keep the\n * bounds in the rectangle of the day.\n * @param clip `true` if the bounds should stay in the day rectangle, `false`\n * and the bounds may go outside the rectangle of the day for multi-day\n * spans.\n * @param offsetX How much to translate the left & right properties by.\n * @param offsetY How much to translate the top & bottom properties by.\n * @returns The calculated bounds for this span.\n */\n public getBounds(relativeTo: Day, dayHeight: number = 1, dayWidth: number = 1, columnOffset: number = 0, clip: boolean = true, offsetX: number = 0, offsetY: number = 0): DaySpanBounds\n {\n let startRaw: number = this.startDelta( relativeTo );\n let endRaw: number = this.endDelta( relativeTo );\n\n let start: number = clip ? Math.max(0, startRaw) : startRaw;\n let end: number = clip ? Math.min(1, endRaw) : endRaw;\n\n let left: number = columnOffset;\n let right: number = dayWidth - left;\n\n let top: number = start * dayHeight;\n let bottom: number = end * dayHeight;\n\n return {\n top: top + offsetY,\n bottom: bottom + offsetY,\n height: bottom - top,\n left: left + offsetX,\n right: right + offsetX,\n width: right\n };\n }\n\n /**\n * Summarizes this span given an approximate unit of time and a few other\n * options. If the start and end are on the same unit, a single value will\n * be returned. Otherwise a start and end will be returned with a `delimiter`.\n *\n * @param type The unit of time this span is for.\n * @param dayOfWeek When `true` the weekday of the start and end are included.\n * @param short When `true` the short form of weekdays and months will be used.\n * @param repeat When `true` the year will be repeated on the start and end\n * timestamp even if they are the same year.\n * @param contextual When `true` the year will be hidden if it's the current\n * year.\n * @param delimiter The string to separate the start and end timestamps with.\n * @returns The summary of this span.\n */\n public summary(type: Units, dayOfWeek: boolean = true, short: boolean = false, repeat: boolean = false, contextual: boolean = true, delimiter: string = ' - '): string\n {\n let formats = DaySpan.SUMMARY_FORMATS[ type ];\n let today: Day = Day.today();\n let showStartYear: boolean = !contextual || !this.start.sameYear( today );\n let showEndYear: boolean = !contextual || !this.end.sameYear( today );\n let start: string = this.start.format( formats(short, dayOfWeek, showStartYear) );\n let end: string = this.end.format( formats(short, dayOfWeek, showEndYear) );\n let summary: string = start;\n\n if (start !== end)\n {\n if (!repeat)\n {\n summary = this.start.format( formats(short, dayOfWeek, !this.start.sameYear(this.end)) );\n }\n\n summary += delimiter;\n summary += end;\n }\n else\n {\n summary = start;\n }\n\n return summary;\n }\n\n /**\n * Determines whether the gven span intersects with this span.\n *\n * @param span The span to test.\n * @returns `true` if the spans intersect, otherwise `false`.\n */\n public intersects(span: DaySpan): boolean\n {\n return !(\n this.end.time < span.start.time ||\n this.start.time > span.end.time\n );\n }\n\n /**\n * Calculates the intersection between this span and the given span. If there\n * is no intersection between the two spans then `null` is returned.\n *\n * @param span The span to calculate the intersection with.\n * @returns The intersection or `null` if none exists.\n */\n public intersection(span: DaySpan): DaySpan\n {\n let start: Day = this.start.max( span.start );\n let end: Day = this.end.min( span.end );\n\n return start.isAfter( end ) ? null : new DaySpan(start, end);\n }\n\n /**\n * Calculates the union between this span and the given span.\n *\n * @param span The span to calculate the union with.\n * @returns The union of the two spans.\n */\n public union(span: DaySpan): DaySpan\n {\n let start: Day = this.start.min( span.start );\n let end: Day = this.end.max( span.end );\n\n return new DaySpan(start, end);\n }\n\n /**\n * Returns a point [[DaySpan]] with the same start and end timestamp.\n *\n * @param day The timestamp which will be the start and end.\n * @returns The new instance.\n * @see [[DaySpan.isPoint]]\n */\n public static point(day: Day): DaySpan\n {\n return new DaySpan( day, day );\n }\n\n\n /**\n * Formatting functions which assist the [[DaySpan.summary]] function.\n */\n public static SUMMARY_FORMATS =\n {\n [Units.DAY]: (short: boolean, dayOfWeek: boolean, year: boolean) => {\n return (dayOfWeek ? (short ? 'ddd, ' : 'dddd, ') : '') + (short ? 'MMM ' : 'MMMM ') + 'Do' + (year ? ' YYYY' : '');\n },\n [Units.WEEK]: (short: boolean, dayOfWeek: boolean, year: boolean) => {\n return (dayOfWeek ? (short ? 'ddd, ' : 'dddd, ') : '') + (short ? 'MMM ' : 'MMMM ') + 'Do' + (year ? ' YYYY' : '');\n },\n [Units.MONTH]: (short: boolean, dayOfWeek: boolean, year: boolean) => {\n return (short ? 'MMM' : 'MMMM') + (year ? ' YYYY' : '');\n },\n [Units.YEAR]: (short: boolean, dayOfWeek: boolean, year: boolean) => {\n return (year ? 'YYYY' : '');\n }\n };\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/DaySpan.ts","\nimport { Functions as fn } from './Functions';\nimport { Day } from './Day';\nimport { DaySpan } from './DaySpan';\n\n\n/**\n * The type for identifiers. Most of the time an identifier can be stored as a\n * number because the 4 digit year is first. However when the year is below\n * 1000 a string will be used with zero padding. Storing identifiers as numbers\n * enable very quick comparisons and using strings or numbers allows the\n * identifier to be used as a key to a map.\n */\nexport type IdentifierInput = number | string;\n\n/**\n * The possible properties which can be pulled from an identifier.\n */\nexport interface IdentifierObject\n{\n /**\n * The year pulled from an identifier (0-9999).\n */\n year?: number;\n /**\n * The quarter of the year pulled from an identifier (1-4)\n */\n quarter?: number;\n /**\n * The month of the year pulled from an identifier (0-11)\n */\n month?: number;\n /**\n * The week of the year pulled from an identifier (1-52)\n */\n week?: number;\n /**\n * The day of the month pulled from an identifier (1-31)\n */\n day?: number;\n /**\n * The hour of the day pulled from an identifier (0-23)\n */\n hour?: number;\n /**\n * The minute of the hour pulled from an identifier (0-59)\n */\n minute?: number;\n}\n\n\n/**\n * A class for detecting, parsing, and building identifiers to and from days.\n *\n * An identifier is a simple value which represents a span of time. It may\n * represent an entire year, a quarter (3 months) of a year, a week of a year,\n * a month in a year, a specific day of a month of a year, or a specific hour,\n * minute, day, and month of a year.\n *\n * For example:\n * - `2018`: The year 2018\n * - `201801`: January 2018\n * - `2014023`: The 23rd week of 2014\n * - `20170311`: March 11th, 2017\n * - `201406151651`: June 15th 2016 at 4:51 pm\n * - `'0525'`: Year 525 of the first age, Elrond and Elros are born\n */\nexport abstract class Identifier\n{\n\n /**\n * Determines whether the given identifier is this type.\n *\n * @param id The identifier to test.\n * @returns `true` if the identifier is this type, otherwise `false`.\n */\n public is(id: IdentifierInput): boolean\n {\n return (id + '').length === this.getLength();\n }\n\n /**\n * Returns the identifier of this type for the given day,\n *\n * @param day The day to get the identifier of.\n * @returns The identifier for the day of this type.\n */\n abstract get(day: Day): IdentifierInput;\n\n /**\n * Converts the given identifier which has passed [[Identifier.is]] to an\n * object with properties pulled from the identifier.\n *\n * @param id The identifier to parse.\n * @returns The object with properties parsed from the identifer.\n */\n abstract object(id: IdentifierInput): IdentifierObject;\n\n /**\n * Returns the start of the time span the identifier represents.\n *\n * @param id The identifier to convert to a start day.\n * @returns The start of the time span the identifier represents.\n */\n abstract start(id: IdentifierInput): Day;\n\n /**\n * Returns the span of time the identifier represents.\n *\n * @param id The identifier to convert to a span.\n * @param endInclusive When `true` the end of the span will be the very last\n * millisecond that represents the timespan, otherwise `false` the end\n * will be the start of the very next span.\n * @returns\n */\n abstract span(id: IdentifierInput, endInclusive: boolean): DaySpan;\n\n /**\n * Determines if the day matches the given identifier.\n *\n * @param day The day to test.\n * @param id The identifier to compare to.\n * @returns `true` if the day exists in the time span represented by the\n * identifier, otherwise `false`.\n */\n abstract matches(day: Day, id: IdentifierInput): boolean;\n\n /**\n * Describes the given identifier as a human friendly string.\n *\n * @param id The identifier to describe.\n * @param short If the description should use shorter language or longer.\n * @returns The human friendly string that describes the identifier.\n */\n abstract describe(id: IdentifierInput, short: boolean): string;\n\n /**\n * The scales for all the different values stored in an identifier.\n */\n protected abstract getScales(): number[];\n\n /**\n * The length of the identifier of this type in digits.\n */\n protected abstract getLength(): number;\n\n /**\n * Computes the identifier given values taken from a [[Day]].\n *\n * @param values The values to compute.\n * @returns The computed identifier.\n */\n protected compute(...values: number[]): IdentifierInput\n {\n const scales: number[] = this.getScales();\n let total: number = 0;\n\n for (let i = 0; i < values.length; i++)\n {\n total += values[ i ] * scales[ i ];\n }\n\n return this.is( total ) ? total : fn.padNumber(total, this.getLength());\n }\n\n /**\n * Decomputes the given identifier and returns values which describe a span\n * of time.\n *\n * @param id The identifier to decompute.\n * @returns The original values which computed the identifier.\n */\n protected decompute(id: IdentifierInput): number[]\n {\n const scales: number[] = this.getScales();\n let total: number = fn.isNumber(id) ? id : parseInt(id);\n let values: number[] = [];\n\n for (let i = 0; i < scales.length - 1; i++)\n {\n let curr: number = scales[ i + 0 ];\n let next: number = scales[ i + 1 ];\n let mod: number = next / curr;\n let value: number = total % mod;\n\n values.push( value );\n total = Math.floor( total / mod );\n }\n\n values.push( total );\n\n return values;\n }\n\n /**\n * The identifier type for an hour of time on a specific day.\n */\n public static Time: Identifier = null;\n\n /**\n * The identifier type for a specific day.\n */\n public static Day: Identifier = null;\n\n /**\n * The identifier type for a specific week of a year.\n */\n public static Week: Identifier = null;\n\n /**\n * The identifier type for a specific month of a year.\n */\n public static Month: Identifier = null;\n\n /**\n * The identifier type for a specific quarter of a year.\n */\n public static Quarter: Identifier = null;\n\n /**\n * The identifier type for a specific year.\n */\n public static Year: Identifier = null;\n\n\n /**\n * Finds which identifier type matches the given identifier, if any.\n *\n * @param id The identifier to find the type of.\n * @returns The found identifier type, otherwise `null` if none exists.\n */\n public static find(id: IdentifierInput): Identifier\n {\n if (this.Time.is(id)) return this.Time;\n if (this.Day.is(id)) return this.Day;\n if (this.Week.is(id)) return this.Week;\n if (this.Month.is(id)) return this.Month;\n if (this.Year.is(id)) return this.Year;\n\n return null;\n }\n\n /**\n * Determines whether the given time span `outer` contains the time span\n * `inner`.\n *\n * @param outer The potentially larger time span `inner` must be contained in.\n * @param inner The time span to test is contained inside `outer`.\n * @returns `true` if `inner` is equal to or contained in `outer`, otherwise\n * `false`.\n */\n public static contains(outer: IdentifierInput, inner: IdentifierInput): boolean\n {\n let outerString: string = outer + '';\n\n return (inner + '').substring( 0, outerString.length ) === outerString;\n }\n\n}\n\n// YYYYMMddHHmm (12)\nclass IdentifierTime extends Identifier\n{\n\n public static DESCRIBE_FORMAT_LONG: string = 'LLL';\n public static DESCRIBE_FORMAT_SHORT: string = 'lll';\n\n private static SCALES: number[] = [\n 1 /* minute */,\n 100 /* hour */,\n 10000 /* day */,\n 1000000 /* month */,\n 100000000 /* year */];\n private static LENGTH: number = 12;\n\n protected getScales(): number[]\n {\n return IdentifierTime.SCALES;\n }\n\n protected getLength(): number\n {\n return IdentifierTime.LENGTH;\n }\n\n public get(day: Day): IdentifierInput\n {\n return this.compute(day.minute, day.hour, day.dayOfMonth, day.month + 1, day.year);\n }\n\n public object(id: IdentifierInput): IdentifierObject\n {\n let values: number[] = this.decompute(id);\n\n return {\n minute: values[0],\n hour: values[1],\n day: values[2],\n month: values[3] - 1,\n year: values[4]\n };\n }\n\n public start(id: IdentifierInput): Day\n {\n let obj: IdentifierObject = this.object(id);\n let start: Day = Day.build( obj.year, obj.month, obj.day, obj.hour, obj.minute );\n\n return start;\n }\n\n public span(id: IdentifierInput, endInclusive: boolean = false): DaySpan\n {\n let start: Day = this.start( id );\n let end: Day = start.endOfHour( endInclusive );\n\n return new DaySpan(start, end);\n }\n\n public describe(id: IdentifierInput, short: boolean = false): string\n {\n let start: Day = this.start( id );\n let format: string = short ? IdentifierTime.DESCRIBE_FORMAT_SHORT : IdentifierTime.DESCRIBE_FORMAT_LONG;\n\n return start.format( format );\n }\n\n public matches(day: Day, id: IdentifierInput): boolean\n {\n return day.timeIdentifier === id;\n /*\n let obj: IdentifierObject = this.object(id);\n\n return (\n day.year === obj.year &&\n day.month === obj.month &&\n day.dayOfMonth === obj.day &&\n day.hour === obj.hour &&\n day.minute === obj.minute\n );\n */\n }\n\n}\n\n// YYYYMMdd (8)\nclass IdentifierDay extends Identifier\n{\n\n public static DESCRIBE_FORMAT_LONG: string = 'LL';\n public static DESCRIBE_FORMAT_SHORT: string = 'll';\n\n private static SCALES: number[] = [\n 1 /* day */,\n 100 /* month */,\n 10000 /* year */];\n private static LENGTH: number = 8;\n\n protected getScales(): number[]\n {\n return IdentifierDay.SCALES;\n }\n\n protected getLength(): number\n {\n return IdentifierDay.LENGTH;\n }\n\n public get(day: Day): IdentifierInput\n {\n return this.compute(day.dayOfMonth, day.month + 1, day.year);\n }\n\n public object(id: IdentifierInput): IdentifierObject\n {\n let values: number[] = this.decompute(id);\n\n return {\n day: values[0],\n month: values[1] - 1,\n year: values[2]\n };\n }\n\n public start(id: IdentifierInput): Day\n {\n let obj: IdentifierObject = this.object(id);\n let start: Day = Day.build( obj.year, obj.month, obj.day );\n\n return start;\n }\n\n public span(id: IdentifierInput, endInclusive: boolean = false): DaySpan\n {\n let start: Day = this.start( id );\n let end: Day = start.end( endInclusive );\n\n return new DaySpan(start, end);\n }\n\n public describe(id: IdentifierInput, short: boolean = false): string\n {\n let start: Day = this.start( id );\n let format: string = short ? IdentifierDay.DESCRIBE_FORMAT_SHORT : IdentifierDay.DESCRIBE_FORMAT_LONG;\n\n return start.format( format );\n }\n\n public matches(day: Day, id: IdentifierInput): boolean\n {\n return day.dayIdentifier === id;\n /*\n let obj: IdentifierObject = this.object(id);\n\n return (\n day.year === obj.year &&\n day.month === obj.month &&\n day.dayOfMonth === obj.day\n );\n */\n }\n\n}\n\n// YYYY0ww (7)\nclass IdentifierWeek extends Identifier\n{\n\n public static DESCRIBE_FORMAT_LONG: string = 'wo [week of] YYYY';\n public static DESCRIBE_FORMAT_SHORT: string = 'wo [week of] YYYY';\n\n private static SCALES: number[] = [\n 1 /* week */,\n 1000 /* year */];\n private static LENGTH: number = 7;\n\n protected getScales(): number[]\n {\n return IdentifierWeek.SCALES;\n }\n\n protected getLength(): number\n {\n return IdentifierWeek.LENGTH;\n }\n\n public get(day: Day): IdentifierInput\n {\n return this.compute(day.week, day.year);\n }\n\n public object(id: IdentifierInput): IdentifierObject\n {\n let values: number[] = this.decompute(id);\n\n return {\n week: values[0],\n year: values[1]\n };\n }\n\n public start(id: IdentifierInput): Day\n {\n let obj: IdentifierObject = this.object(id);\n let start: Day = Day.build( obj.year, 0 ).withWeek( obj.week );\n\n return start;\n }\n\n public span(id: IdentifierInput, endInclusive: boolean = false): DaySpan\n {\n let start: Day = this.start( id );\n let end: Day = start.endOfWeek( endInclusive );\n\n return new DaySpan(start, end);\n }\n\n public describe(id: IdentifierInput, short: boolean = false): string\n {\n let start: Day = this.start( id );\n let format: string = short ? IdentifierWeek.DESCRIBE_FORMAT_SHORT : IdentifierWeek.DESCRIBE_FORMAT_LONG;\n\n return start.format( format );\n }\n\n public matches(day: Day, id: IdentifierInput): boolean\n {\n return day.weekIdentifier === id;\n /*\n let obj: IdentifierObject = this.object(id);\n\n return (\n day.year === obj.year &&\n day.week === obj.week\n );\n */\n }\n\n}\n\n// YYYYMM (6)\nclass IdentifierMonth extends Identifier\n{\n\n public static DESCRIBE_FORMAT_LONG: string = 'MMMM YYYY';\n public static DESCRIBE_FORMAT_SHORT: string = 'MMM YYYY';\n\n private static SCALES: number[] = [\n 1 /* month */,\n 100 /* year */];\n private static LENGTH: number = 6;\n\n protected getScales(): number[]\n {\n return IdentifierMonth.SCALES;\n }\n\n protected getLength(): number\n {\n return IdentifierMonth.LENGTH;\n }\n\n public get(day: Day): IdentifierInput\n {\n return this.compute(day.month + 1, day.year);\n }\n\n public object(id: IdentifierInput): IdentifierObject\n {\n let values: number[] = this.decompute(id);\n\n return {\n month: values[0] - 1,\n year: values[1]\n };\n }\n\n public start(id: IdentifierInput): Day\n {\n let obj: IdentifierObject = this.object(id);\n let start: Day = Day.build( obj.year, obj.month );\n\n return start;\n }\n\n public span(id: IdentifierInput, endInclusive: boolean = false): DaySpan\n {\n let start: Day = this.start( id );\n let end: Day = start.endOfMonth( endInclusive );\n\n return new DaySpan(start, end);\n }\n\n public describe(id: IdentifierInput, short: boolean = false): string\n {\n let start: Day = this.start( id );\n let format: string = short ? IdentifierMonth.DESCRIBE_FORMAT_SHORT : IdentifierMonth.DESCRIBE_FORMAT_LONG;\n\n return start.format( format );\n }\n\n public matches(day: Day, id: IdentifierInput): boolean\n {\n return day.monthIdentifier === id;\n /*\n let obj: IdentifierObject = this.object(id);\n\n return (\n day.year === obj.year &&\n day.month === obj.month\n );\n */\n }\n\n}\n\n// YYYYQ (5)\nclass IdentifierQuarter extends Identifier\n{\n\n public static DESCRIBE_FORMAT_LONG: string = 'Qo [quarter] YYYY';\n public static DESCRIBE_FORMAT_SHORT: string = 'Qo [quarter] YYYY';\n\n private static SCALES: number[] = [\n 1 /* quarter */,\n 10 /* year */];\n private static LENGTH: number = 5;\n\n protected getScales(): number[]\n {\n return IdentifierQuarter.SCALES;\n }\n\n protected getLength(): number\n {\n return IdentifierQuarter.LENGTH;\n }\n\n public get(day: Day): IdentifierInput\n {\n return this.compute(day.quarter, day.year);\n }\n\n public object(id: IdentifierInput): IdentifierObject\n {\n let values: number[] = this.decompute(id);\n\n return {\n quarter: values[0],\n year: values[1]\n };\n }\n\n public start(id: IdentifierInput): Day\n {\n let obj: IdentifierObject = this.object(id);\n let start: Day = Day.build( obj.year, (obj.quarter - 1) * 3 );\n\n return start;\n }\n\n public span(id: IdentifierInput, endInclusive: boolean = false): DaySpan\n {\n let start: Day = this.start( id );\n let end: Day = start.relativeMonths( 3 ).endOfMonth( endInclusive );\n\n return new DaySpan(start, end);\n }\n\n public describe(id: IdentifierInput, short: boolean = false): string\n {\n let start: Day = this.start( id );\n let format: string = short ? IdentifierQuarter.DESCRIBE_FORMAT_SHORT : IdentifierQuarter.DESCRIBE_FORMAT_LONG;\n\n return start.format( format );\n }\n\n public matches(day: Day, id: IdentifierInput): boolean\n {\n return day.quarterIdentifier === id;\n /*\n let obj: IdentifierObject = this.object(id);\n\n return (\n day.year === obj.year &&\n day.quarter === obj.quarter\n );\n */\n }\n\n}\n\n// YYYY (4)\nclass IdentifierYear extends Identifier\n{\n\n public static DESCRIBE_FORMAT_LONG: string = 'YYYY';\n public static DESCRIBE_FORMAT_SHORT: string = 'YYYY';\n\n private static SCALES: number[] = [\n 1 /* year */];\n private static LENGTH: number = 4;\n\n protected getScales(): number[]\n {\n return IdentifierYear.SCALES;\n }\n\n protected getLength(): number\n {\n return IdentifierYear.LENGTH;\n }\n\n public get(day: Day): IdentifierInput\n {\n return this.compute(day.year);\n }\n\n public object(id: IdentifierInput): IdentifierObject\n {\n let values: number[] = this.decompute(id);\n\n return {\n year: values[0]\n };\n }\n\n public start(id: IdentifierInput): Day\n {\n let obj: IdentifierObject = this.object(id);\n let start: Day = Day.build( obj.year, 0 );\n\n return start;\n }\n\n public span(id: IdentifierInput, endInclusive: boolean = false): DaySpan\n {\n let start: Day = this.start( id );\n let end: Day = start.endOfYear( endInclusive );\n\n return new DaySpan(start, end);\n }\n\n public describe(id: IdentifierInput, short: boolean = false): string\n {\n let start: Day = this.start( id );\n let format: string = short ? IdentifierYear.DESCRIBE_FORMAT_SHORT : IdentifierYear.DESCRIBE_FORMAT_LONG;\n\n return start.format( format );\n }\n\n public matches(day: Day, id: IdentifierInput): boolean\n {\n return day.year === id;\n /*\n let obj: IdentifierObject = this.object(id);\n\n return (\n day.year === obj.year\n );\n */\n }\n\n}\n\n// Sets the Identifier types\nIdentifier.Time = new IdentifierTime();\nIdentifier.Day = new IdentifierDay();\nIdentifier.Week = new IdentifierWeek();\nIdentifier.Month = new IdentifierMonth();\nIdentifier.Quarter = new IdentifierQuarter();\nIdentifier.Year = new IdentifierYear();\n\n\n\n// WEBPACK FOOTER //\n// ./src/Identifier.ts","\n/**\n * A class which takes a number and determines the suffix for that number.\n *\n * ```typescript\n * Suffix.CACHE[ 2 ]; // 2nd\n * Suffix.determine( 3 ); // rd\n * Suffix.get( 4 ); // th\n * Suffix.get( 4, true ); // 4th\n * ```\n */\nexport class Suffix\n{\n\n /**\n * The array of suffixes used.\n */\n public static MAP: string[] = [\n 'th', 'st', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th'\n ];\n\n /**\n * An internal cache of [[Suffix._CACHE_SIZE]] suffixes.\n */\n private static _CACHE: string[];\n\n /**\n * The number of values to store in the cache (inclusive).\n */\n private static _CACHE_SIZE: number = 366;\n\n\n /**\n * The cache of number & suffix pairs.\n */\n public static get CACHE(): string[]\n {\n if (!this._CACHE)\n {\n this._CACHE = [];\n\n for (let i = 0; i <= this._CACHE_SIZE; i++)\n {\n this._CACHE[ i ] = this.get( i, true );\n }\n }\n\n return this._CACHE;\n }\n\n /**\n * Determines the suffix for a given number.\n *\n * @param value The number to find the suffix for.\n * @returns The suffix determined.\n */\n public static determine(value: number): string\n {\n return value >= 11 && value <= 13 ? 'th' : this.MAP[ value % this.MAP.length ];\n }\n\n /**\n * Gets the suffix for a number and optionally appends it before the suffix.\n *\n * @param value The number to get the suffix for.\n * @param prepend When `true` the value is prepended to the suffix.\n * @returns The suffix or value & suffix pair determined.\n */\n public static get(value: number, prepend: boolean = false): string\n {\n let suffix: string = this.determine(value);\n\n return prepend ? value + suffix : suffix;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Suffix.ts","\nimport { Functions as fn } from './Functions';\n\n\n/**\n * The callback which is invoked for each item in the Iterator. The callback\n * can call [[Iterator.stop]] at anytime to stop iteration.\n *\n * @param item The item found in the iterator.\n * @param iterator The iterator with the item.\n * @returns The result of the callback.\n */\nexport type IteratorCallback = (item: T, iterator: Iterator) => R;\n\n/**\n * An [[Iterator]] source which handles iterating over items and calls\n * `callback` for each item, checking [[Iterator.iterating]] after each\n * invokation to stop iteration as early as possible.\n *\n * @param callback The function to invoke for each item.\n * @param iterator The iterator to check for early exists.\n */\nexport type IteratorSource = (iterator: Iterator) => any;\n\n/**\n * A filter to apply duration iteration to only look at certain items when this\n * function returns `true`.\n *\n * @param item The item being iterated.\n * @returns `true` if the item should be iterated, otherwise `false`.\n */\nexport type IteratorFilter = (item: T) => boolean;\n\n/**\n * An action to perform on the source as instructed by the iterator.\n */\nexport enum IteratorAction\n{\n /**\n * Continue iteration.\n */\n Continue,\n\n /**\n * Stop iteration.\n */\n Stop,\n\n /**\n * Remove the current item if possible, and continue iteration.\n */\n Remove\n}\n\n/**\n * A class that allows an iteratable source to be iterated any number of times\n * by providing the following functionality:\n *\n * - [[Iterator.isEmpty]]: Determines whether the source contains any items.\n * - [[Iterator.first]]: Gets the first item in the source.\n * - [[Iterator.count]]: Counds the number of items in the source.\n * - [[Iterator.list]]: Builds a list of the items in the source.\n * - [[Iterator.object]]: Builds an object of the items in the source.\n * - [[Iterator.reduce]]: Reduces the items in the source down to a single value.\n * - [[Iterator.purge]]: Removes items from the source which meet some criteria.\n * - [[Iterator.filter]]: Returns a subset of items that meet some criteria by\n * returning a new Iterator.\n * - [[Iterator.map]]: Maps each item in the source to another item by returning\n * a new Iterator.\n * - [[Iterator.iterate]]: Invokes a function for each item in the source.\n *\n * The following static functions exist to help iterate simple sources:\n *\n * - [[Iterator.forArray]]: Iterates an array, optionally reverse\n * - [[Iterator.forObject]]: Iterates the properties of an object, optionally\n * just the properties explicitly set on the object.\n *\n * ```typescript\n * let iter = object.iterateThings();\n * iter.isEmpty(); // no items?\n * iter.isEmpty(d => d.flag); // no items that meet some criteria?\n * iter.count(); // number of items\n * iter.count(d => d.flag); // number of items that meet some criteria\n * iter.first(); // first item\n * iter.first(d => d.flag); // first item that meets some criteria\n * iter.list(); // get all items as array\n * iter.list(myArray); // add all items to given array\n * iter.list([], d => d.flag); // get all items as array that meet some criteria\n * iter.object(d => d.id); // get all items as an object keyed by a value (ex: id)\n * iter.object(d => d.id, {},\n * d => d.flag); // get all items as an object keyed by a value where the item meets some criteria (ex: key id if flag is truthy)\n * iter.purge(d => d.flag); // remove all items from source that meet some criteria\n * iter.filter(d => d.flag); // returns an iterator which iterates a subset of items which meet some criteria\n * iter.reduce(0,\n * (d, t) => t + d.size); // reduces all items to a single value (ex: sums all size)\n * iter.reduce(0,\n * (d, t) => t + d.size,\n * d => d.flag); // reduces all items to a single value (ex: sums all size) where the item meets some criteria\n * iter.map(d => d.subitem); // return an iterator for subitems if they exist\n * iter.iterate(d => log(d)); // do something for each item\n * ```\n *\n * @typeparam T The type of item being iterated.\n */\nexport class Iterator\n{\n\n /**\n * A result of the iteration passed to [[Iterator.stop]].\n */\n public result: any = null;\n\n /**\n * The last action (if any) called on this iterator.\n */\n public action: IteratorAction;\n\n /**\n * The current callback passed to the iterator.\n */\n public callback: IteratorCallback;\n\n /**\n * The source of iterable items. This allows the iteration over any type of\n * structure. The source must call the callback for each item and its\n * recommended that the source checks the [[Iterator.iterating]] flag after\n * each callback invokation.\n */\n private source: IteratorSource;\n\n /**\n * Creates a new Iterator given a source.\n *\n * @param source The source of items to iterator.\n */\n public constructor(source: IteratorSource)\n {\n this.source = source;\n }\n\n /**\n * Returns a clone of this iterator with the same source. This is necessary\n * if you want to iterate all or a portion of the source while already\n * iterating it (like a nested loop).\n */\n public clone(): Iterator\n {\n return new Iterator( this.source );\n }\n\n /**\n * Passes the given item to the iterator callback and returns the action\n * requested at this point in iteration.\n *\n * @param item The current item being iterated.\n */\n public act(item: T): IteratorAction\n {\n this.action = IteratorAction.Continue;\n\n this.callback( item, this );\n\n return this.action;\n }\n\n /**\n * Stops iteration and optionally sets the result of the iteration.\n *\n * @param result The result of the iteration.\n */\n public stop(result?: any): this\n {\n this.result = result;\n this.action = IteratorAction.Stop;\n\n return this;\n }\n\n /**\n * Signals to the iterator source that the current item wants to be removed.\n */\n public remove(): this\n {\n this.action = IteratorAction.Remove;\n\n return this;\n }\n\n /**\n * Determines with this iterator is empty. A filter function can be specified\n * to only check for items which match certain criteria.\n *\n * @param filter A function to the checks items for certain criteria.\n * @returns `true` if no valid items exist in the source.\n */\n public isEmpty(filter: IteratorFilter = null): boolean\n {\n let empty: boolean = true;\n\n this.iterate((item, iterator) =>\n {\n if (filter && !filter( item ))\n {\n return;\n }\n\n empty = false;\n iterator.stop();\n });\n\n return empty;\n }\n\n /**\n * Counts the number of items in the iterator. A filter function can be\n * specified to only count items which match certain criteria.\n *\n * @param filter A function to count items for certain criteria.\n * @returns The number of items in the source that optionally match the given\n * criteria.\n */\n public count(filter: IteratorFilter = null): number\n {\n let total: number = 0;\n\n this.iterate((item, iterator) =>\n {\n if (filter && !filter( item ))\n {\n return;\n }\n\n total++;\n });\n\n return total;\n }\n\n /**\n * Returns the first item in the iterator. A filter function can be specified\n * to only return the first item which matches certain criteria.\n *\n * @param filter A function to compare items to to match certain criteria.\n * @returns The first item found that optonally matches the given criteria.\n */\n public first(filter: IteratorFilter = null): T\n {\n let first: T = null;\n\n this.iterate((item, iterator) =>\n {\n if (filter && !filter( item ))\n {\n return;\n }\n\n first = item;\n iterator.stop();\n });\n\n return first;\n }\n\n /**\n * Builds a list of items from the source. A filter function can be specified\n * so the resulting list only contain items that match certain criteria.\n *\n * @param out The array to place the items in.\n * @param filter The function which determines which items are added to the list.\n * @returns The reference to `out` which has had items added to it which\n * optionally match the given criteria.\n */\n public list(out: T[] = [], filter: IteratorFilter = null): T[]\n {\n this.iterate((item, iterator) =>\n {\n if (filter && !filter( item ))\n {\n return;\n }\n\n out.push( item );\n });\n\n return out;\n }\n\n /**\n * Builds an object of items from the source keyed by a result returned by\n * a `getKey` function.\n *\n * @param getKey The function which returns the key of the object.\n * @param out The object to place the items in.\n * @param filter The function which determines which items are set on the object.\n * @returns The reference to `out` which has had items set to it which\n * optionally match the given criteria.\n */\n public object(getKey: (item: T) => any, out: any = {}, filter: IteratorFilter = null): any\n {\n this.iterate((item, iterator) =>\n {\n if (filter && !filter( item ))\n {\n return;\n }\n\n let key = getKey( item );\n\n out[ key ] = item;\n });\n\n return out;\n }\n\n /**\n * Returns a new iterator that only returns a maximum number of items.\n *\n * @param amount The maximum number of items to return.\n * @returns A new iterator which returns a maximum number of items.\n */\n public take(amount: number): Iterator\n {\n return new Iterator(next =>\n {\n this.iterate((item, prev) =>\n {\n switch (next.act( item ))\n {\n case IteratorAction.Stop:\n prev.stop();\n break;\n case IteratorAction.Remove:\n prev.remove();\n break;\n }\n\n if (--amount <= 0)\n {\n prev.stop();\n }\n });\n });\n }\n\n /**\n * Returns a new iterator that skips the given number of items from the items\n * in this iterator.\n *\n * @param amount The number of items to skip.\n * @returns A new iterator which skipped the given number of items.\n */\n public skip(amount: number): Iterator\n {\n return new Iterator(next =>\n {\n let skipped: number = 0;\n\n this.iterate((item, prev) =>\n {\n if (skipped >= amount)\n {\n switch (next.act( item ))\n {\n case IteratorAction.Stop:\n prev.stop();\n break;\n case IteratorAction.Remove:\n prev.remove();\n break;\n }\n }\n\n skipped++;\n });\n });\n }\n\n /**\n * Returns a new iterator thats items are the items in this iterator followed\n * by the items in the given iterators.\n *\n * @param iterators The iterators to append after this one.\n * @returns A new iterator based on this iterator followed by the given.\n */\n public append(...iterators: Iterator[]): Iterator\n {\n return Iterator.join( this, ...iterators );\n }\n\n /**\n * Returns a new iterator thats items are the items in the given iterators\n * followed by the items in this iterator.\n *\n * @param iterators The iterators to prepend before this one.\n * @returns A new iterator based on the given iterators followed by this.\n */\n public prepend(...iterators: Iterator[]): Iterator\n {\n return Iterator.join( ...iterators, this );\n }\n\n /**\n * Removes items from the source that match certain criteria.\n *\n * @param filter The function which determines which items to remove.\n */\n public purge(filter: IteratorFilter): this\n {\n this.iterate((item, iterator) =>\n {\n if (filter(item))\n {\n iterator.remove();\n }\n });\n\n return this;\n }\n\n /**\n * Returns an iterator which takes items from this iterator and presents them\n * in reverse.\n *\n * @returns A new iterator with the items in this iterator in reverse.\n */\n public reverse(): Iterator\n {\n return new Iterator(iterator =>\n {\n let items: T[] = this.list();\n let removed: T[] = [];\n\n for (let i = items.length - 1; i >= 0; i--)\n {\n let item: T = items[ i ];\n let action: IteratorAction = iterator.act( item );\n\n if (action === IteratorAction.Stop)\n {\n break;\n }\n\n if (action === IteratorAction.Remove)\n {\n removed.push( item );\n }\n }\n\n if (removed.length > 0)\n {\n this.purge(item => removed.indexOf( item ) !== -1);\n }\n });\n }\n\n /**\n * Reduces all the items in the source to a single value given the initial\n * value and a function to convert an item and the current reduced value\n */\n public reduce(initial: R, reducer: (item: T, reduced: R) => R, filter: IteratorFilter = null): R\n {\n let reduced: R = initial;\n\n this.iterate((item, iterator) =>\n {\n if (filter && !filter( item ))\n {\n return;\n }\n\n reduced = reducer( item, reduced );\n });\n\n return reduced;\n }\n\n /**\n * Returns an iterator where this iterator is the source and the returned\n * iterator is built on a subset of items which pass a `filter` function.\n *\n * @param filter The function which determines if an item should be iterated.\n * @returns A new iterator for the filtered items from this iterator.\n */\n public filter(filter: IteratorFilter): Iterator\n {\n return new Iterator(next =>\n {\n this.iterate((prevItem, prev) =>\n {\n if (filter(prevItem))\n {\n switch (next.act( prevItem ))\n {\n case IteratorAction.Stop:\n prev.stop();\n break;\n\n case IteratorAction.Remove:\n prev.remove();\n break;\n }\n }\n });\n });\n }\n\n /**\n * Returns an iterator where this iterator is the source and the returned\n * iterator is built from mapped items pulled from items in the source\n * of this iterator. If the given callback `outerCallback` does not return\n * a mapped value then the returned iterator will not see the item. A filter\n * function can be specified to only look at mapping items which match\n * certain criteria.\n *\n * @param mapper The function which maps an item to another.\n * @param filter The function which determines if an item should be mapped.\n * @returns A new iterator for the mapped items from this iterator.\n */\n public map(mapper: IteratorCallback, filter: IteratorFilter = null): Iterator\n {\n return new Iterator(next =>\n {\n this.iterate((prevItem, prev) =>\n {\n if (filter && !filter( prevItem ))\n {\n return;\n }\n\n let nextItem: W = mapper( prevItem, prev );\n\n if (fn.isDefined( nextItem ))\n {\n switch (next.act( nextItem ))\n {\n case IteratorAction.Stop:\n prev.stop();\n break;\n\n case IteratorAction.Remove:\n prev.remove();\n break;\n }\n }\n });\n });\n }\n\n /**\n * Invokes the callback for each item in the source of this iterator. The\n * second argument in the callback is the reference to this iterator and\n * [[Iterator.stop]] can be called at anytime to cease iteration.\n *\n * @param callback The function to invoke for each item in this iterator.\n */\n public iterate(callback: IteratorCallback): this\n {\n this.result = undefined;\n this.callback = callback;\n this.action = IteratorAction.Continue;\n this.source( this );\n this.callback = null;\n\n return this;\n }\n\n /**\n * Passes the result of the iteration to the given function if a truthy\n * result was passed to [[Iterator.stop]].\n *\n * @param getResult The function to pass the result to if it exists.\n */\n public withResult(getResult: (result: any) => any): this\n {\n if (this.result)\n {\n getResult( this.result );\n }\n\n return this;\n }\n\n /**\n * Returns an iterator for the given array optionally iterating it in reverse.\n *\n * @param items The array of items to iterate.\n * @param reverse If the array should be iterated in reverse.\n * @returns A new iterator for the given array.\n */\n public static forArray(items: T[], reverse: boolean = false): Iterator\n {\n return new Iterator(iterator =>\n {\n if (reverse)\n {\n for (let i = items.length - 1; i >= 0; i--)\n {\n switch (iterator.act(items[ i ]))\n {\n case IteratorAction.Stop:\n return;\n case IteratorAction.Remove:\n items.splice(i, 1);\n break;\n }\n }\n }\n else\n {\n for (let i = 0; i < items.length; i++)\n {\n switch (iterator.act(items[ i ]))\n {\n case IteratorAction.Stop:\n return;\n case IteratorAction.Remove:\n items.splice(i, 1);\n i--;\n break;\n }\n }\n }\n });\n }\n\n /**\n * Returns an iterator for the given object optionally checking the\n * `hasOwnProperty` function on the given object.\n *\n * @param items The object to iterate.\n * @param hasOwnProperty If `hasOwnProperty` should be checked.\n * @returns A new iterator for the given object.\n */\n public static forObject(items: { [key: string]: T }, hasOwnProperty: boolean = true): Iterator\n {\n return new Iterator(iterator =>\n {\n for (let key in items)\n {\n if (hasOwnProperty && !items.hasOwnProperty( key ))\n {\n continue;\n }\n\n switch (iterator.act(items[ key ]))\n {\n case IteratorAction.Stop:\n return;\n case IteratorAction.Remove:\n delete items[ key ];\n break;\n }\n }\n });\n }\n\n /**\n * Joins all the given iterators into a single iterator where the items\n * returned are in the same order as passed to this function. If any items\n * are removed from the returned iterator they will be removed from the given\n * iterator if it supports removal.\n *\n * @param iterators The array of iterators to join as one.\n * @returns A new iterator for the given iterators.\n */\n public static join(...iterators: Iterator[]): Iterator\n {\n return new Iterator(parent =>\n {\n for (let child of iterators)\n {\n child.iterate((item, childIterator) =>\n {\n switch (parent.act( item ))\n {\n case IteratorAction.Remove:\n childIterator.remove();\n break;\n case IteratorAction.Stop:\n childIterator.stop();\n break;\n }\n });\n\n if (child.action === IteratorAction.Stop)\n {\n return;\n }\n }\n });\n }\n\n /**\n * Returns a new iterator with no items.\n *\n * @returns A new iterator with no items.\n */\n public static empty(): Iterator\n {\n return new Iterator(parent => {});\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Iterator.ts","\nimport { Identifier, IdentifierInput } from './Identifier';\nimport { Day } from './Day';\nimport { Time } from './Time';\nimport { DaySpan } from './DaySpan';\nimport { Iterator, IteratorAction } from './Iterator';\n\n\n/**\n * A map of values in the [[ScheduleModifier]] keyed by the descriptions of the\n * identifiers.\n */\nexport interface ScheduleModifierDescription\n{\n [description: string]: T\n}\n\n/**\n * An object which carries the span taken from an identifier and the value\n * mapped to it in a [[ScheduleModifier]].\n */\nexport interface ScheduleModifierSpan\n{\n span: DaySpan,\n value: T\n}\n\n/**\n * A class that can modify the events of a schedule by storing [[Identifier]]s\n * and an associated value.\n *\n * @typeparam T The type of data that modifies the schedule.\n */\nexport class ScheduleModifier\n{\n\n /**\n * The map of values mapped by their [[Identifier]]s.\n */\n public map: { [id: string]: T };\n\n\n /**\n * Creates a new schedule modifier.\n */\n public constructor()\n {\n this.map = {};\n }\n\n /**\n * Clears the modifier of all modifications.\n */\n public clear(): this\n {\n this.map = {};\n\n return this;\n }\n\n /**\n * Returns `true` if this modifier lacks any modifications, otherwise `false`.\n */\n public isEmpty(): boolean\n {\n // @ts-ignore\n for (let id in this.map)\n {\n return !id;\n }\n\n return true;\n }\n\n /**\n * Gets the most specific value in this modifier for the given day, if none\n * exists `otherwise` is returned. A modifier can have multiple values for a\n * given day because [[Identifier]]s represent a span of time.\n *\n * @param day The day to get a value for.\n * @param otherwise What to return if no value exists for the given day.\n * @param lookAtTime If the specific time of the given day should be looked at.\n * @returns The most specific value for the given day, or `otherwise`.\n */\n public get(day: Day, otherwise: T, lookAtTime: boolean = true): T\n {\n let map = this.map;\n\n return (lookAtTime && map[ day.timeIdentifier ]) ||\n map[ day.dayIdentifier ] ||\n map[ day.monthIdentifier ] ||\n map[ day.weekIdentifier ] ||\n map[ day.quarterIdentifier ] ||\n otherwise;\n }\n\n /**\n * Gets all values in this modifier for the given day. If none exist, an empty\n * array is returned. The values returned in the array are returned in most\n * specific to least specific.\n *\n * @param day The day to get the values for.\n * @returns An array of values (modifications) for the given day.\n */\n public getAll(day: Day): T[]\n {\n let map = this.map;\n let all: T[] = [];\n\n if (map[ day.timeIdentifier ]) all.push( map[ day.timeIdentifier ] );\n if (map[ day.dayIdentifier ]) all.push( map[ day.dayIdentifier ] );\n if (map[ day.monthIdentifier ]) all.push( map[ day.monthIdentifier ] );\n if (map[ day.weekIdentifier ]) all.push( map[ day.weekIdentifier ] );\n if (map[ day.quarterIdentifier ]) all.push( map[ day.quarterIdentifier ] );\n\n return all;\n }\n\n /**\n * Moves the value/modification from one identifier to another.\n *\n * @param from The day to take the identifier from.\n * @param fromType The identifier type.\n * @param to The day to move the value to.\n * @param toType The identifier type to move the value to.\n */\n public move(from: Day, fromType: Identifier, to: Day, toType: Identifier): this\n {\n let fromIdentifier = fromType.get( from );\n let toIdentifier = toType.get( to );\n\n this.map[ toIdentifier ] = this.map[ fromIdentifier ];\n\n delete this.map[ fromIdentifier ];\n\n return this;\n }\n\n /**\n * Moves any identifiers with the matching time `fromTime` to `toTime` and\n * returns the number of moves.\n *\n * @param fromTime The time to move from.\n * @param toTime The time to move to.\n * @returns The number of modifiers moved.\n */\n public moveTime(fromTime: Time, toTime: Time): number\n {\n let type: Identifier = Identifier.Time;\n let moveIds: IdentifierInput[] = [];\n\n this.iterate().iterate(([id, value]) =>\n {\n if (type.is( id ))\n {\n let start: Day = type.start( id );\n\n if (start.sameTime( fromTime ))\n {\n moveIds.push( id );\n }\n }\n });\n\n let moved: number = 0;\n\n for (let id of moveIds)\n {\n let value: T = this.map[ id ];\n let start: Day = type.start( id );\n let newStart: Day = start.withTime( toTime );\n let newId: IdentifierInput = type.get( newStart );\n\n if (!this.map[ newId ])\n {\n this.map[ newId ] = value;\n delete this.map[ id ];\n moved++;\n }\n }\n\n return moved;\n }\n\n /**\n * Sets the value/modification in this map given a day, the value, and the\n * identifier type.\n *\n * @param day The day to take an identifier from.\n * @param value The value/modification to set.\n * @param type The identifier type.\n */\n public set(day: Day, value: T, type: Identifier): this\n {\n this.map[ type.get( day ) ] = value;\n\n return this;\n }\n\n /**\n * Removes the value/modification from this modifier based on the identifier\n * pulled from the day.\n *\n * @param day The day to take an identifier from.\n * @param type The identifier type.\n */\n public unset(day: Day, type: Identifier): this\n {\n delete this.map[ type.get( day ) ];\n\n return this;\n }\n\n /**\n * Iterates through the modifiers passing the identifier and the related value.\n *\n * @returns A new instance of an [[Iterator]].\n */\n public iterate(): Iterator<[IdentifierInput, T]>\n {\n return new Iterator<[IdentifierInput, T]>(iterator =>\n {\n let map = this.map;\n\n for (let rawId in map)\n {\n let asNumber: number = parseInt( rawId );\n let validAsNumber: boolean = asNumber + '' === rawId;\n let id: IdentifierInput = validAsNumber ? asNumber : rawId;\n\n switch (iterator.act([id, map[ rawId ]]))\n {\n case IteratorAction.Stop:\n return;\n case IteratorAction.Remove:\n delete map[ rawId ];\n break;\n }\n }\n });\n }\n\n /**\n * Queries the modifier for all values/modifications which fall in the time\n * span that the given identifier represents. All identifiers and their value\n * are passed to the given callback.\n *\n * @param prefix The identifier\n * @returns A new instance of an [[Iterator]].\n */\n public query(query: IdentifierInput): Iterator<[IdentifierInput, T]>\n {\n return this.iterate()\n .filter(([id, value]) => Identifier.contains( query, id ));\n ;\n }\n\n /**\n * Returns all identifiers stored in this modifier.\n */\n public identifiers(filter?: (value: T, id: IdentifierInput) => boolean): Iterator\n {\n return this.iterate()\n .filter(([id, value]) => !filter || filter( value, id ))\n .map(([id, ]) => id)\n ;\n }\n\n /**\n * Builds a list of spans and the associated values. The spans are calculated\n * from the identiier key via [[Identifier.span]].\n *\n * @param endInclusive If the end date in the spans should be the last\n * millisecond of the timespan or the first millisecond of the next.\n * @returns An array of spans calculated from the identifiers with the\n * associated values/modifications.\n */\n public spans(endInclusive: boolean = false): Iterator>\n {\n return this.iterate()\n .map(([id, value]) =>\n {\n let type: Identifier = Identifier.find(id);\n\n if (type)\n {\n let span = type.span( id, endInclusive );\n\n return { span, value };\n }\n })\n ;\n }\n\n /**\n * Builds a list of the descriptions of the identifiers in this modifier.\n *\n * @param short If the description should use shorter language or longer.\n * @returns The built list of descriptions.\n */\n public describe(short: boolean = false): Iterator\n {\n return this.iterate()\n .map( ([id, ]) =>\n {\n let type: Identifier = Identifier.find( id );\n\n if (type)\n {\n return type.describe( id, short );\n }\n })\n ;\n }\n\n /**\n * Builds a map of the values/modifications keyed by the descripton of the\n * identifier computed via [[Identifier.describe]].\n *\n * @param short If the description should use shorter language or longer.\n * @returns The built map of description to values/modifications.\n */\n public describeMap(short: boolean = false): ScheduleModifierDescription\n {\n let map = this.map;\n let out: ScheduleModifierDescription = {};\n\n for (let id in map)\n {\n let type: Identifier = Identifier.find(id);\n\n if (type)\n {\n out[ type.describe( id, short ) ] = map[ id ];\n }\n }\n\n return out;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/ScheduleModifier.ts","\nimport { Functions as fn } from './Functions';\nimport { FrequencyValue, FrequencyCheck, FrequencyValueEvery, FrequencyValueOneOf } from './Frequency';\nimport { Day, DayInput, DurationInput, DayProperty } from './Day';\nimport { Identifier, IdentifierInput } from './Identifier';\nimport { DaySpan } from './DaySpan';\nimport { Constants } from './Constants';\nimport { Parse } from './Parse';\nimport { Time, TimeInput } from './Time';\nimport { Suffix } from './Suffix';\nimport { ScheduleModifier, ScheduleModifierSpan } from './ScheduleModifier';\nimport { Units } from './Units';\nimport { Iterator, IteratorAction } from './Iterator';\n\n// @ts-ignore\nimport * as moment from 'moment';\n\n\n/**\n * A tuple which identifies an event on the schedule. The tuple contains the\n * total span of the event occurrence, the day of the event (could be the start\n * day, end day, or any days in between for multi-day events) as well as the\n * identifier for the event.\n */\nexport type ScheduleEventTuple = [DaySpan, Day, IdentifierInput];\n\n/**\n * Input given by a user which describes an event schedule.\n *\n * @typeparam M The type of metadata stored in the schedule.\n */\nexport interface ScheduleInput\n{\n\n /**\n * @see [[Schedule.start]]\n */\n start?: DayInput;\n\n /**\n * @see [[Schedule.end]]\n */\n end?: DayInput;\n\n /**\n * A shortcut to setting the [[Schedule.start]], [[Schedule.end]],\n * [[Schedule.year]], [[Schedule.month]], and [[Schedule.dayOfMonth]].\n */\n on?: DayInput;\n\n /**\n * @see [[Schedule.times]]\n */\n times?: TimeInput[];\n\n /**\n * @see [[Schedule.duration]]\n */\n duration?: number;\n\n /**\n * @see [[Schedule.durationUnit]]\n */\n durationUnit?: DurationInput;\n\n /**\n * An array of days or identifiers which should be excluded from the schedule.\n *\n * @see [[Schedule.exclude]]\n */\n exclude?: (Day | IdentifierInput)[];\n\n /**\n * An array of days or identifiers which should be included in the schedule.\n *\n * @see [[Schedule.include]]\n */\n include?: (Day | IdentifierInput)[];\n\n /**\n * An array of days or identifiers which should be canceled in the schedule.\n *\n * @see [[Schedule.cancel]]\n */\n cancel?: (Day | IdentifierInput)[];\n\n /**\n * @see [[Schedule.meta]]\n */\n meta?: { [identifier: string]: M };\n\n /**\n * @see [[Schedule.month]]\n */\n month?: FrequencyValue;\n\n /**\n * @see [[Schedule.year]]\n */\n year?: FrequencyValue;\n\n /**\n * @see [[Schedule.week]]\n */\n week?: FrequencyValue;\n\n /**\n * @see [[Schedule.dayOfWeek]]\n */\n dayOfWeek?: FrequencyValue;\n\n /**\n * @see [[Schedule.dayOfMonth]]\n */\n dayOfMonth?: FrequencyValue;\n\n /**\n * @see [[Schedule.lastDayOfMonth]]\n */\n lastDayOfMonth?: FrequencyValue;\n\n /**\n * @see [[Schedule.dayOfYear]]\n */\n dayOfYear?: FrequencyValue;\n\n /**\n * @see [[Schedule.weekOfYear]]\n */\n weekOfYear?: FrequencyValue;\n\n /**\n * @see [[Schedule.weekspanOfYear]]\n */\n weekspanOfYear?: FrequencyValue;\n\n /**\n * @see [[Schedule.fullWeekOfYear]]\n */\n fullWeekOfYear?: FrequencyValue;\n\n /**\n * @see [[Schedule.lastWeekspanOfYear]]\n */\n lastWeekspanOfYear?: FrequencyValue;\n\n /**\n * @see [[Schedule.lastFullWeekOfYear]]\n */\n lastFullWeekOfYear?: FrequencyValue;\n\n /**\n * @see [[Schedule.weekOfMonth]]\n */\n weekOfMonth?: FrequencyValue;\n\n /**\n * @see [[Schedule.weekspanOfMonth]]\n */\n weekspanOfMonth?: FrequencyValue;\n\n /**\n * @see [[Schedule.fullWeekOfMonth]]\n */\n fullWeekOfMonth?: FrequencyValue;\n\n /**\n * @see [[Schedule.lastWeekspanOfMonth]]\n */\n lastWeekspanOfMonth?: FrequencyValue;\n\n /**\n * @see [[Schedule.lastFullWeekOfMonth]]\n */\n lastFullWeekOfMonth?: FrequencyValue;\n\n /**\n * The function to parse metadata with.\n */\n parseMeta?: (input: any) => M;\n}\n\n\n/**\n * A class which describes when an event occurs over what time and if it repeats.\n *\n * @typeparam M The type of metadata stored in the schedule.\n */\nexport class Schedule\n{\n\n /**\n * The earliest an event can occur in the schedule, or `null` if there are no\n * restrictions when the earliest event can occur. This day is inclusive.\n */\n public start: Day;\n\n /**\n * The latest an event can occur in the schedule, or `null` if there are no\n * restrictions when the latest event can occur. This day is inclusive.\n */\n public end: Day;\n\n /**\n * The length of events in this schedule.\n */\n public duration: number;\n\n /**\n * The unit which describes the duration of the event.\n */\n public durationUnit: DurationInput;\n\n /**\n * The times at which the events occur on the days they should. If there are\n * no times specified its assumed to be an all day event - potentially over\n * multiple days or weeks based on [[Schedule.duration]] and\n * [[Schedule.durationUnit]].\n */\n public times: Time[];\n\n /**\n * The number of days an event in this schedule lasts PAST the starting day.\n * If this is a full day event with a duration greater than zero this value\n * will be greater than one. If this event occurs at a specific time with a\n * given duration that is taken into account and if it passes over into the\n * next day this value will be greater than one. This value is used to look\n * back in time when trying to figure out what events start or overlap on a\n * given day.\n */\n public durationInDays: number;\n\n /**\n * A set of identifiers which mark what days or times are excluded on the\n * schedule. This typically represents the set of event occurrences removed.\n */\n public exclude: ScheduleModifier;\n\n /**\n * A set of identifiers which mark what days or times are included outside\n * the normal series of days on the schedule. This typically represents\n * an event occurrence which is moved so its added to the exclude and include\n * sets.\n */\n public include: ScheduleModifier;\n\n /**\n * A set of identifiers which mark what days, times, weeks, months, etc that\n * should have all event occurrences cancelled.\n */\n public cancel: ScheduleModifier;\n\n /**\n * A map of metadata keyed by an identifier. The metadata is placed in\n * [[CalendarEvent]].\n */\n public meta: ScheduleModifier;\n\n /**\n * How frequent the event occurs based on [[Day.dayOfWeek]].\n */\n public dayOfWeek: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.dayOfMonth]].\n */\n public dayOfMonth: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.lastDayOfMonth]].\n */\n public lastDayOfMonth: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.dayOfYear]].\n */\n public dayOfYear: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.month]].\n */\n public month: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.week]].\n */\n public week: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.weekOfYear]].\n */\n public weekOfYear: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.weekspanOfYear]].\n */\n public weekspanOfYear: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.fullWeekOfYear]].\n */\n public fullWeekOfYear: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.lastWeekspanOfYear]].\n */\n public lastWeekspanOfYear: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.lastFullWeekOfYear]].\n */\n public lastFullWeekOfYear: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.weekOfMonth]].\n */\n public weekOfMonth: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.weekspanOfMonth]].\n */\n public weekspanOfMonth: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.fullWeekOfMonth]].\n */\n public fullWeekOfMonth: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.lastWeekspanOfMonth]].\n */\n public lastWeekspanOfMonth: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.lastFullWeekOfMonth]].\n */\n public lastFullWeekOfMonth: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.year]].\n */\n public year: FrequencyCheck;\n\n /**\n * The array of frequency functions which had valid frequencies.\n *\n * @see [[FrequencyCheck.given]]\n */\n public checks: FrequencyCheck[];\n\n\n /**\n * Creates a schedule based on the given input.\n *\n * @param input The input which describes the schedule of events.\n */\n public constructor(input?: ScheduleInput)\n {\n this.exclude = new ScheduleModifier();\n this.include = new ScheduleModifier();\n this.cancel = new ScheduleModifier();\n this.meta = new ScheduleModifier();\n\n if (fn.isDefined(input))\n {\n this.set(input);\n }\n }\n\n /**\n * Sets the schedule with the given input.\n *\n * @param input The input which describes the schedule of events.\n * @param parseMeta A function to use when parsing meta input into the desired type.\n * @see [[Parse.schedule]]\n */\n public set(input: ScheduleInput,\n parseMeta: (input: any) => M = (x => x)): this\n {\n Parse.schedule(input, fn.coalesce( input.parseMeta, parseMeta ), this);\n\n return this;\n }\n\n /**\n * Returns the last event time specified or `undefined` if this schedule is\n * for an all day event.\n */\n public get lastTime(): Time\n {\n return this.times[ this.times.length - 1 ];\n }\n\n /**\n * The [[Identifier]] for this schedule. Either [[Identifier.Day]] or\n * [[Identifier.Time]].\n */\n public get identifierType(): Identifier\n {\n return this.isFullDay() ? Identifier.Day : Identifier.Time;\n }\n\n /**\n * Updates the [[Schedule.durationInDays]] variable based on the\n * [[Schedule.lastTime]] (if any), the [[Schedule.duration]] and it's\n * [[Schedule.durationUnit]].\n */\n public updateDurationInDays(): this\n {\n let start: number = this.lastTime ? this.lastTime.toMilliseconds() : 0;\n let duration: number = this.duration * (Constants.DURATION_TO_MILLIS[ this.durationUnit ] || 0);\n let exclude: number = Constants.MILLIS_IN_DAY;\n let day: number = Constants.MILLIS_IN_DAY;\n\n this.durationInDays = Math.max(0, Math.ceil((start + duration - exclude) / day));\n\n return this;\n }\n\n /**\n * Updates [[Schedule.checks]] based on the frequencies that were specified\n * in the schedule input.\n */\n public updateChecks(): this\n {\n this.checks = Parse.givenFrequency([\n this.year,\n this.month,\n this.week,\n this.weekOfYear,\n this.fullWeekOfYear,\n this.weekspanOfYear,\n this.lastFullWeekOfYear,\n this.lastWeekspanOfYear,\n this.weekOfMonth,\n this.weekspanOfMonth,\n this.fullWeekOfMonth,\n this.lastWeekspanOfMonth,\n this.lastFullWeekOfMonth,\n this.dayOfWeek,\n this.dayOfMonth,\n this.lastDayOfMonth,\n this.dayOfYear\n ]);\n\n return this;\n }\n\n /**\n * Determines whether the given day lies between the earliest and latest\n * valid day in the schedule.\n *\n * @param day The day to test.\n * @returns `true` if the day lies in the schedule, otherwise `false`.\n * @see [[Schedule.start]]\n * @see [[Schedule.end]]\n */\n public matchesSpan(day: Day): boolean\n {\n return (this.start === null || day.isSameOrAfter(this.start)) &&\n (this.end === null || day.isBefore(this.end));\n }\n\n /**\n * Determines whether the given range overlaps with the earliest and latest\n * valid days in this schedule (if any).\n *\n * @param start The first day in the range.\n * @param end The last day in the range.\n * @returns `true` if the range intersects with the schedule, otherwise `false`.\n * @see [[Schedule.start]]\n * @see [[Schedule.end]]\n */\n public matchesRange(start: Day, end: Day): boolean\n {\n if (this.start && end.isBefore(this.start))\n {\n return false;\n }\n\n if (this.end && start.isAfter(this.end))\n {\n return false;\n }\n\n return true;\n }\n\n /**\n * Determines whether the given day is explicitly excluded in the schedule.\n *\n * @param day The day to test.\n * @param lookAtTime lookAtTime If the specific time of the given day should\n * be looked at.\n * @returns `true` if the day was excluded, otherwise `false`.\n */\n public isExcluded(day: Day, lookAtTime: boolean = true): boolean\n {\n return this.exclude.get( day, false, lookAtTime );\n }\n\n /**\n * Determines whether the given day is explicitly included in the schedule.\n *\n * @param day The day to test.\n * @param lookAtTime lookAtTime If the specific time of the given day should\n * be looked at.\n * @returns `true` if the day is NOT explicitly included, otherwise `false`.\n */\n public isIncluded(day: Day, lookAtTime: boolean = true): boolean\n {\n return this.include.get( day, false, lookAtTime );\n }\n\n /**\n * Determines whether the given day is cancelled in the schedule.\n *\n * @param day The day to test.\n * @param lookAtTime lookAtTime If the specific time of the given day should\n * be looked at.\n * @returns `true` if the day was cancelled, otherwise `false`.\n */\n public isCancelled(day: Day, lookAtTime: boolean = true): boolean\n {\n return this.cancel.get( day, false, lookAtTime );\n }\n\n /**\n * Returns the metadata for the given day or `null` if there is none.\n *\n * @param day The day to return the metadata for.\n * @param otherwise The data to return if none exists for the given day.\n * @param lookAtTime lookAtTime If the specific time of the given day should\n * be looked at.\n * @returns The metadata or `null`.\n */\n public getMeta(day: Day, otherwise: M = null, lookAtTime: boolean = true): M\n {\n return this.meta.get( day, otherwise, lookAtTime );\n }\n\n /**\n * Returns all metadata for the given day or an empty array if there is none.\n *\n * @param day The day to return the metadata for.\n * @returns The array of metadata ordered by priority or an empty array.\n */\n public getMetas(day: Day): M[]\n {\n return this.meta.getAll( day );\n }\n\n /**\n * Returns whether the events in the schedule are all day long or start at\n * specific times. Full day events start at the start of the day and end at\n * the start of the next day (if the duration = `1` and durationUnit = 'days').\n * Full day events have no times specified and should have a durationUnit of\n * either `days` or `weeks`.\n */\n public isFullDay(): boolean\n {\n return this.times.length === 0;\n }\n\n /**\n * Sets whether this schedule is a full day event if it is not already. If\n * this schedule is a full day event and `false` is passed to this function\n * a single timed event will be added based on `defaultTime`. If this schedule\n * has timed events and `true` is passed to make the schedule full day, the\n * timed events are removed from this schedule. If the durationUnit is not the\n * expected unit based on the new full day flag - the duration is reset to 1\n * and the duration unit is set to the expected unit.\n *\n * @param fullDay Whether this schedule should represent a full day event or\n * timed events.\n * @param defaultTime If `fullDay` is `false` and this schedule is currently\n * a full day event - this time will be used as the time of the first event.\n */\n public setFullDay(fullDay: boolean = true, defaultTime: TimeInput = '08:00'): this\n {\n if (fullDay !== this.isFullDay())\n {\n if (fullDay)\n {\n this.times = [];\n\n if (this.durationUnit !== 'days' && this.durationUnit !== 'day')\n {\n this.duration = 1;\n this.durationUnit = 'days';\n }\n }\n else\n {\n this.times = [Parse.time( defaultTime )];\n\n if (this.durationUnit !== 'hours' && this.durationUnit !== 'hour')\n {\n this.duration = 1;\n this.durationUnit = 'hours';\n }\n }\n }\n\n return this;\n }\n\n /**\n * Adjusts the [[Schedule.start]] and [[Schedule.end]] dates specified on this\n * schedule if this schedule represents a single event and the `start` and\n * `end` are already set or `addSpan` is `true`.\n *\n * @param addSpan If `true`, the `start` and `end` dates will always be\n * adjusted if this schedule is a single event.\n */\n public adjustDefinedSpan(addSpan: boolean = false): this\n {\n let single: DaySpan = this.getSingleEventSpan();\n\n if (single && (addSpan || (this.start && this.end)))\n {\n this.start = single.start.start();\n this.end = single.end.end();\n }\n\n return this;\n }\n\n /**\n * Returns a span of time for a schedule with full day events starting on the\n * start of the given day with the desired duration in days or weeks.\n *\n * @param day The day the span starts on.\n * @returns The span of time starting on the given day.\n */\n public getFullSpan(day: Day): DaySpan\n {\n let start: Day = day.start();\n let end: Day = start.add( this.duration, this.durationUnit );\n\n return new DaySpan( start, end );\n }\n\n /**\n * Returns a span of time starting on the given day at the given day with the\n * duration specified on this schedule.\n *\n * @param day The day the span starts on.\n * @param time The time of day the span starts.\n * @returns The span of time calculated.\n */\n public getTimeSpan(day: Day, time: Time): DaySpan\n {\n let start: Day = day.withTime( time );\n let end: Day = start.add( this.duration, this.durationUnit );\n\n return new DaySpan( start, end );\n }\n\n /**\n * Determines whether the given day is a day on the schedule for the start\n * of an event. If an event is more than one day and the day given is not the\n * start this may return `false`. This does not test for event instances\n * that exist through [[Schedule.include]].\n *\n * @param day The day to test.\n * @returns `true` if the day marks the start of an event on the schedule.\n * @see [[Schedule.isIncluded]]\n * @see [[Schedule.isFullyExcluded]]\n * @see [[Schedule.matchesSpan]]\n */\n public matchesDay(day: Day): boolean\n {\n if (this.isIncluded( day, false ))\n {\n return true;\n }\n\n if (!this.matchesSpan( day ) || this.isFullyExcluded( day ))\n {\n return false;\n }\n\n for (let check of this.checks)\n {\n if (!check( day[ check.property ] ))\n {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Determines whether the given day has events added through\n * [[Schedule.include]].\n *\n * @param day The day to look for included times on.\n * @returns `true` if there are included event instances on the given day,\n * otherwise `false`.\n */\n public hasIncludedTime(day: Day): boolean\n {\n return !this.iterateIncludeTimes( day ).isEmpty();\n }\n\n /**\n * Determines whether the given day is fully excluded from the schedule. A\n * fully excluded day is one that has a day-wide exclusion, or the schedule\n * is not an all-day event and all times in the schedule are specifically\n * excluded.\n *\n * @param day The day to test.*\n * @returns `true` if he day is fully excluded, otherwise `false`.\n */\n public isFullyExcluded(day: Day): boolean\n {\n if (this.isExcluded(day, false))\n {\n return true;\n }\n\n if (this.isFullDay())\n {\n return false;\n }\n\n for (let time of this.times)\n {\n if (!this.isExcluded( day.withTime( time ) ))\n {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Finds the next day an event occurs on the schedule given a day to start,\n * optionally including it, and a maximum number of days to look ahead.\n *\n * @param day The day to start to search from.\n * @param includeDay If the given day should be included in the search.\n * @param lookAhead The maximum number of days to look ahead from the given\n * day for event occurrences.\n * @returns The next day on the schedule or `null` if none exists.\n */\n public nextDay(day: Day, includeDay: boolean = false, lookAhead: number = 366): Day\n {\n return this.iterateDaycast(day, 1, true, includeDay, lookAhead).first();\n }\n\n /**\n * Finds the next specified number of days that events occur on the schedule\n * given a day to start, optionally including it, and a maximum number of days\n * to look ahead.\n *\n * @param day The day to start to search from.\n * @param max The maximum number of days to return in the result.\n * @param includeDay If the given day should be included in the search.\n * @param lookAhead The maximum number of days to look ahead from the given\n * day for event occurrences.\n * @returns An array containing the next days on the schedule that events\n * start or an empty array if there are none.\n */\n public nextDays(day: Day, max: number, includeDay: boolean = false, lookAhead: number = 366): Iterator\n {\n return this.iterateDaycast(day, max, true, includeDay, lookAhead);\n }\n\n /**\n * Finds the previous day an event occurs on the schedule given a day to start,\n * optionally including it, and a maximum number of days to look behind.\n *\n * @param day The day to start to search from.\n * @param includeDay If the given day should be included in the search.\n * @param lookBack The maximum number of days to look behind from the given\n * day for event occurrences.\n * @returns The previous day on the schedule or `null` if none exists.\n */\n public prevDay(day: Day, includeDay: boolean = false, lookBack: number = 366): Day\n {\n return this.iterateDaycast(day, 1, false, includeDay, lookBack).first();\n }\n\n /**\n * Finds the previous specified number of days that events occur on the\n * schedule given a day to start, optionally including it, and a maximum\n * number of days to look behind.\n *\n * @param day The day to start to search from.\n * @param max The maximum number of days to return in the result.\n * @param includeDay If the given day should be included in the search.\n * @param lookAhead The maximum number of days to look behind from the given\n * day for event occurrences.\n * @returns An array containing the previous days on the schedule that events\n * start or an empty array if there are none.\n */\n public prevDays(day: Day, max: number, includeDay: boolean = false, lookBack: number = 366): Iterator\n {\n return this.iterateDaycast(day, max, false, includeDay, lookBack);\n }\n\n /**\n * Iterates over days that events start in the schedule given a day to start,\n * a maximum number of days to find, and a direction to look.\n *\n * @param day The day to start to search from.\n * @param max The maximum number of days to iterate.\n * @param next If `true` this searches forward, otherwise `false` is backwards.\n * @param includeDay If the given day should be included in the search.\n * @param lookup The maximum number of days to look through from the given\n * day for event occurrences.\n * @returns A new Iterator for the days found in the cast.\n * @see [[Schedule.iterateSpans]]\n */\n public iterateDaycast(day: Day, max: number, next: boolean, includeDay: boolean = false, lookup: number = 366): Iterator\n {\n return new Iterator(iterator =>\n {\n let iterated: number = 0;\n\n for (let days = 0; days < lookup; days++)\n {\n if (!includeDay || days > 0)\n {\n day = next ? day.next() : day.prev();\n }\n\n if (!this.iterateSpans( day, false ).isEmpty())\n {\n let action: IteratorAction = iterator.act( day );\n\n if (action === IteratorAction.Stop || ++iterated >= max)\n {\n return;\n }\n }\n }\n });\n }\n\n /**\n * Iterates through the spans (event instances) that start on or covers the\n * given day.\n *\n * @param day The day to look for spans on.\n * @param covers If `true` spans which span multiple days will be looked at\n * to see if they intersect with the given day, otherwise `false` will\n * only look at the given day for the start of events.\n * @returns A new Iterator for all the spans found.\n */\n public iterateSpans(day: Day, covers: boolean = false): Iterator\n {\n return new Iterator(iterator =>\n {\n let current: Day = day;\n let lookBehind: number = covers ? this.durationInDays : 0;\n\n // If the events start at the end of the day and may last multiple days....\n if (this.isFullDay())\n {\n // If the schedule has events which span multiple days we need to look\n // backwards for events that overlap with the given day.\n while (lookBehind >= 0)\n {\n // If the current day matches the schedule rules...\n if (this.matchesDay( current ))\n {\n // Build a DaySpan with the given start day and the schedules duration.\n let span: DaySpan = this.getFullSpan( current );\n\n // If that dayspan intersects with the given day, it's a winner!\n if (span.matchesDay( day ))\n {\n switch (iterator.act( span ))\n {\n case IteratorAction.Stop:\n return;\n }\n }\n }\n\n current = current.prev();\n lookBehind--;\n }\n }\n // This schedule has events which start at certain times\n else\n {\n // If the schedule has events which span multiple days we need to look\n // backwards for events that overlap with the given day.\n while (lookBehind >= 0)\n {\n // If the current day matches the schedule rules...\n if (this.matchesDay( current ))\n {\n // Iterate through each daily occurrence in the schedule...\n for (let time of this.times)\n {\n let span: DaySpan = this.getTimeSpan( current, time );\n\n // If the event intersects with the given day and the occurrence\n // has not specifically been excluded...\n if (span.matchesDay( day ) && !this.isExcluded( span.start, true ))\n {\n switch (iterator.act( span ))\n {\n case IteratorAction.Stop:\n return;\n }\n }\n }\n }\n else\n {\n // The current day does not match the schedule, however the schedule\n // might have moved/random event occurrents on the current day.\n // We only want the ones that overlap with the given day.\n this.iterateIncludeTimes(current, day).iterate((span, timeIterator) =>\n {\n switch (iterator.act( span ))\n {\n case IteratorAction.Stop:\n timeIterator.stop();\n break;\n }\n })\n\n if (iterator.action === IteratorAction.Stop)\n {\n return;\n }\n }\n\n current = current.prev();\n lookBehind--;\n }\n }\n });\n }\n\n /**\n * Determines if the given day is on the schedule and the time specified on\n * the day matches one of the times on the schedule.\n *\n * @param day The day to test.\n * @returns `true` if the day and time match the schedule, otherwise false.\n */\n public matchesTime(day: Day): boolean\n {\n return !!this.iterateSpans( day, true ).first( span => span.start.sameMinute( day ) );\n }\n\n /**\n * Determines if the given day is covered by this schedule. A schedule can\n * specify events that span multiple days - so even though the day does not\n * match the starting day of a span - it can be a day that is within the\n * schedule.\n *\n * @param day The day to test.\n * @returns `true` if the day is covered by an event on this schedule,\n * otherwise `false`.\n */\n public coversDay(day: Day): boolean\n {\n return !this.iterateSpans( day, true ).isEmpty();\n }\n\n /**\n * Determines if the given timestamp lies in an event occurrence on this\n * schedule.\n *\n * @param day The timestamp to test against the schedule.\n * @return `true` if the timestamp lies in an event occurrent start and end\n * timestamps, otherwise `false`.\n */\n public coversTime(day: Day): boolean\n {\n return !!this.iterateSpans( day, true ).first( span => span.contains( day ) );\n }\n\n /**\n * Sets the frequency for the given property. This does not update the\n * [[Schedule.checks]] array, the [[Schedule.updateChecks]] function needs\n * to be called.\n *\n * @param property The frequency to update.\n * @param frequency The new frequency.\n */\n public setFrequency(property: DayProperty, frequency?: FrequencyValue): this\n {\n this[ property ] = Parse.frequency( frequency, property );\n\n return this;\n }\n\n /**\n * Changes the exclusion status of the event at the given time. By default\n * this excludes this event - but `false` may be passed to undo an exclusion.\n *\n * @param time The start time of the event occurrence to exclude or include.\n * @param excluded Whether the event should be excluded.\n */\n public setExcluded(time: Day, excluded: boolean = true): this\n {\n let type: Identifier = this.identifierType;\n\n this.exclude.set( time, excluded, type );\n this.include.set( time, !excluded, type );\n\n return this;\n }\n\n /**\n * Changes the cancellation status of the event at the given start time. By\n * default this cancels the event occurrence - but `false` may be passed to\n * undo a cancellation.\n *\n * @param time The start time of the event occurrence to cancel or uncancel.\n * @param cancelled Whether the event should be cancelled.\n */\n public setCancelled(time: Day, cancelled: boolean = true): this\n {\n this.cancel.set( time, cancelled, this.identifierType );\n\n return this;\n }\n\n /**\n * Moves the event instance starting at `fromTime` to `toTime` optionally\n * placing `meta` in the schedules metadata for the new time `toTime`.\n * If this schedule has a single event ([[Schedule.isSingleEvent]]) then the\n * only value needed is `toTime` and not `fromTime`.\n *\n * @param toTime The timestamp of the new event.\n * @param fromTime The timestamp of the event on the schedule to move if this\n * schedule generates multiple events.\n * @param meta The metadata to place in the schedule for the given `toTime`.\n * @returns `true` if the schedule had the event moved, otherwise `false`.\n */\n public move(toTime: Day, fromTime?: Day, meta?: M): boolean\n {\n if (!this.moveSingleEvent( toTime ) && fromTime)\n {\n return this.moveInstance( fromTime, toTime, meta );\n }\n\n return false;\n }\n\n /**\n * Moves a time specified in this schedule to the given time, adjusting\n * any cancelled event instances, metadata, and any excluded and included\n * event instances.\n *\n * @param fromTime The time to move.\n * @param toTime The new time in the schedule.\n * @returns `true` if time was moved, otherwise `false`.\n */\n public moveTime(fromTime: Time, toTime: Time): boolean\n {\n let found: boolean = false;\n\n for (let i = 0; i < this.times.length && !found; i++)\n {\n if (found = fromTime.matches( this.times[ i ] ))\n {\n this.times.splice( i, 1, toTime );\n }\n }\n\n if (found)\n {\n this.include.moveTime( fromTime, toTime );\n this.exclude.moveTime( fromTime, toTime );\n this.cancel.moveTime( fromTime, toTime );\n this.meta.moveTime( fromTime, toTime );\n\n this.adjustDefinedSpan( false );\n }\n\n return found;\n }\n\n /**\n * Moves the event instance starting at `fromTime` to `toTime` optionally\n * placing `meta` in the schedules metadata for the new time `toTime`. A move\n * is accomplished by excluding the current event and adding an inclusion of\n * the new day & time.\n *\n * @param fromTime The timestamp of the event on the schedule to move.\n * @param toTime The timestamp of the new event.\n * @param meta The metadata to place in the schedule for the given `toTime`.\n * @returns `true`.\n * @see [[Schedule.move]]\n */\n public moveInstance(fromTime: Day, toTime: Day, meta?: M): boolean\n {\n let type: Identifier = this.identifierType;\n\n this.exclude.set( fromTime, true, type );\n this.exclude.set( toTime, false, type );\n\n this.include.set( toTime, true, type );\n this.include.set( fromTime, false, type );\n\n if (fn.isValue( meta ))\n {\n this.meta.unset( fromTime, type );\n this.meta.set( toTime, meta, type );\n }\n\n return true;\n }\n\n /**\n * Moves the single event in this schedule to the given day/time if applicable.\n * If this schedule is not a single event schedule then `false` is returned.\n * If this schedule is a timed event the time will take the time of the given\n * `toTime` of `takeTime` is `true`.\n *\n * @param toTime The time to move the single event to.\n * @param takeTime If this schedule has a single timed event, should the time\n * of the event be changed to the time of the given `toTime`?\n * @returns `true` if the schedule was adjusted, otherwise `false`.\n * @see [[Schedule.move]]\n */\n public moveSingleEvent(toTime: Day, takeTime: boolean = true): boolean\n {\n if (!this.isSingleEvent())\n {\n return false;\n }\n\n for (let check of this.checks)\n {\n let prop: DayProperty = check.property;\n let value = toTime[ prop ];\n let frequency: FrequencyCheck = Parse.frequency( [value], prop );\n\n this[ prop ] = frequency;\n }\n\n if (this.times.length === 1 && takeTime)\n {\n this.times = [toTime.asTime()];\n }\n\n this.updateChecks();\n\n let span: DaySpan = this.getSingleEventSpan();\n\n if (this.start)\n {\n this.start = span.start.start();\n }\n\n if (this.end)\n {\n this.end = span.end.end();\n }\n\n return true;\n }\n\n /**\n * Returns the span of the single event in this schedule if it's that type of\n * schedule, otherwise `null` is returned.\n *\n * @returns A span of the single event, otherwise `null`.\n * @see [[Schedule.isSingleEvent]]\n */\n public getSingleEventSpan(): DaySpan\n {\n if (!this.isSingleEvent())\n {\n return null;\n }\n\n let startOfYear: Day = Day.build( this.year.input[0], 0, 1 );\n let start: Day = this.iterateDaycast( startOfYear, 1, true, true, 366 ).first();\n\n if (!start)\n {\n return null;\n }\n\n return this.isFullDay() ?\n this.getFullSpan( start ) :\n this.getTimeSpan( start, this.times[ 0 ] );\n }\n\n /**\n * Determines whether this schedule produces a single event, and no more.\n * If this schedule has any includes, it's assumed to be a multiple event\n * schedule. A single event can be detected in the following scenarios where\n * each frequency has a single occurrence (see [[Schedule.isSingleFrequency]]).\n *\n * - year, day of year\n * - year, month, day of month\n * - year, month, week of month, day of week\n * - year, week of year, day of week\n *\n * @returns `true` if this schedule produces a single event, otherwise `false`.\n */\n public isSingleEvent(): boolean\n {\n // 0 = full day, 1 = once a day, 1+ = multiple events a day\n if (this.times.length > 1)\n {\n return false;\n }\n\n // Let's assume if there are includes, this is not a single event.\n if (!this.include.isEmpty())\n {\n return false;\n }\n\n // If this can occur on multiple years, not a single event.\n if (!this.isSingleYear())\n {\n return false;\n }\n\n // If this is a specific year and day of the year: single!\n if (this.isSingleDayOfYear())\n {\n return true;\n }\n\n // If this is a specific year, month, and day of month: single!\n if (this.isSingleMonth() && this.isSingleDayOfMonth())\n {\n return true;\n }\n\n // If this is a specific year, month, week of the month, day of the week: single!\n if (this.isSingleMonth() && this.isSingleWeekOfMonth() && this.isSingleDayOfWeek())\n {\n return true;\n }\n\n // If this is a specific year, week of the year, day of the week: single!\n if (this.isSingleWeekOfYear() && this.isSingleDayOfWeek())\n {\n return true;\n }\n\n // Doesn't look like a single event.\n return false;\n }\n\n /**\n * @returns `true` if this schedule produces events only in a specific year.\n * @see [[Schedule.year]]\n */\n public isSingleYear(): boolean\n {\n return this.isSingleFrequency( this.year );\n }\n\n /**\n * @returns `true` if this schedule produces events only in a specific month.\n * @see [[Schedule.month]]\n */\n public isSingleMonth(): boolean\n {\n return this.isSingleFrequency( this.month );\n }\n\n /**\n * @returns `true` if this schedule produces events only in a specific day of\n * the month.\n * @see [[Schedule.dayOfMonth]]\n * @see [[Schedule.lastDayOfMonth]]\n */\n public isSingleDayOfMonth(): boolean\n {\n return this.isSingleFrequency( this.dayOfMonth ) ||\n this.isSingleFrequency( this.lastDayOfMonth );\n }\n\n /**\n * @returns `true` if this schedule produces events only in a specific day of\n * the week.\n * @see [[Schedule.dayOfWeek]]\n */\n public isSingleDayOfWeek(): boolean\n {\n return this.isSingleFrequency( this.dayOfWeek );\n }\n\n /**\n * @returns `true` if this schedule produces events only in a specific day of\n * the year.\n * @see [[Schedule.dayOfYear]]\n */\n public isSingleDayOfYear(): boolean\n {\n return this.isSingleFrequency( this.dayOfYear );\n }\n\n /**\n * @returns `true` if this schedule produces events only in a specific week of\n * the month.\n * @see [[Schedule.weekspanOfMonth]]\n * @see [[Schedule.fullWeekOfMonth]]\n * @see [[Schedule.weekOfMonth]]\n * @see [[Schedule.lastFullWeekOfMonth]]\n * @see [[Schedule.lastWeekspanOfMonth]]\n */\n public isSingleWeekOfMonth(): boolean\n {\n return this.isSingleFrequency( this.weekspanOfMonth ) ||\n this.isSingleFrequency( this.fullWeekOfMonth ) ||\n this.isSingleFrequency( this.weekOfMonth ) ||\n this.isSingleFrequency( this.lastFullWeekOfMonth ) ||\n this.isSingleFrequency( this.lastWeekspanOfMonth );\n }\n\n /**\n * @returns `true` if this schedule produces events only in a specific week of\n * the year.\n * @see [[Schedule.weekspanOfYear]]\n * @see [[Schedule.fullWeekOfYear]]\n * @see [[Schedule.week]]\n * @see [[Schedule.weekOfYear]]\n * @see [[Schedule.lastFullWeekOfYear]]\n * @see [[Schedule.lastWeekspanOfYear]]\n */\n public isSingleWeekOfYear(): boolean\n {\n return this.isSingleFrequency( this.weekspanOfYear ) ||\n this.isSingleFrequency( this.fullWeekOfYear ) ||\n this.isSingleFrequency( this.week ) ||\n this.isSingleFrequency( this.weekOfYear ) ||\n this.isSingleFrequency( this.lastFullWeekOfYear ) ||\n this.isSingleFrequency( this.lastWeekspanOfYear );\n }\n\n /**\n * Determines if the given [[FrequencyCheck]] results in a single occurrence.\n *\n * @returns `true` if the frequency results in a single event, otherwise `false`.\n */\n public isSingleFrequency(frequency: FrequencyCheck): boolean\n {\n return fn.isArray( frequency.input ) && (frequency.input).length === 1;\n }\n\n /**\n * Creates a forecast for this schedule which returns a number of event\n * occurrences around a given day. A single item could be returned per day, or\n * you could get an item for each timed event occurrence.\n *\n * @param around The day to find a forecast around.\n * @param covers If `true` spans which span multiple days will be looked at\n * to see if they intersect with the given day, otherwise `false` will\n * only look at the given day for the start of events.\n * @param daysAfter The number of events to return before the given day.\n * @param daysBefore The number of events to return after the given day.\n * @param times If timed events should be returned, or only one for each day.\n * @param lookAround How many days to look before and after the given day for\n * event occurrences.\n * @returns A new iterator which provides the event occurence span, the day it\n * starts (or is covered if `covers` is `true`), and the identifier for the\n * event.\n */\n public forecast(around: Day,\n covers: boolean = true,\n daysAfter: number,\n daysBefore: number = daysAfter,\n times: boolean = false,\n lookAround: number = 366): Iterator\n {\n let type: Identifier = this.identifierType;\n\n let tuplesForDay = (day: Day, tuples: Iterator): boolean =>\n {\n let spans: DaySpan[] = this.iterateSpans( day, covers ).list();\n let last: number = times ? spans.length : Math.min( 1, spans.length );\n let offset: number = times ? 0 : spans.length - 1;\n\n for (let i = 0; i < last; i++)\n {\n let span: DaySpan = spans[ i + offset ];\n let id: IdentifierInput = type.get( span.start );\n\n if (tuples.act( [ span, day, id ] ) === IteratorAction.Stop)\n {\n return false;\n }\n }\n\n return true;\n };\n\n let prev = new Iterator(iterator =>\n {\n let curr: Day = around;\n\n for (let i = 0; i < lookAround; i++)\n {\n if (!tuplesForDay( curr, iterator ))\n {\n break;\n }\n\n curr = curr.prev();\n }\n });\n\n let next = new Iterator(iterator =>\n {\n let curr: Day = around;\n\n for (let i = 0; i < lookAround; i++)\n {\n curr = curr.next();\n\n if (!tuplesForDay( curr, iterator ))\n {\n break;\n }\n }\n });\n\n return prev.take( daysBefore + 1 ).reverse().append( next.take( daysAfter ) );\n }\n\n /**\n * Iterates timed events that were explicitly specified on the given day.\n * Those events could span multiple days so may be tested against another day.\n *\n * @param day The day to look for included timed events.\n * @param matchAgainst The day to test against the timed event.\n * @returns A new Iterator for all the included spans found.\n */\n public iterateIncludeTimes(day: Day, matchAgainst: Day = day): Iterator\n {\n let isIncludedTime = (result: [IdentifierInput, boolean]) =>\n {\n let [id, included] = result;\n\n return included && Identifier.Time.is( id );\n };\n\n let getSpan = (result: [IdentifierInput, boolean]) =>\n {\n let [id] = result;\n let time: Day = Identifier.Time.start( id );\n let span: DaySpan = this.getTimeSpan( time, time.asTime() );\n\n if (span.matchesDay( matchAgainst ))\n {\n return span;\n }\n };\n\n return this.include.query( day.dayIdentifier ).map( getSpan, isIncludedTime );\n }\n\n /**\n * Converts the schedule instance back into input.\n *\n * @param returnDays When `true` the start, end, and array of exclusions will\n * have [[Day]] instances, otherwise the UTC timestamp and dayIdentifiers\n * will be used when `false`.\n * @param returnTimes When `true` the times returned in the input will be\n * instances of [[Time]] otherwise the `timeFormat` is used to convert the\n * times to strings.\n * @param timeFormat The time format to use when returning the times as strings.\n * @param alwaysDuration If the duration values (`duration` and\n * `durationUnit`) should always be returned in the input.\n * @returns The input that describes this schedule.\n * @see [[Time.format]]\n */\n public toInput(returnDays: boolean = false, returnTimes: boolean = false, timeFormat: string = '', alwaysDuration: boolean = false): ScheduleInput\n {\n let defaultUnit: string = Constants.DURATION_DEFAULT_UNIT( this.isFullDay() );\n let exclusions: IdentifierInput[] = this.exclude.identifiers(v => v).list();\n let inclusions: IdentifierInput[] = this.include.identifiers(v => v).list();\n let cancels: IdentifierInput[] = this.cancel.identifiers(v => v).list();\n let hasMeta: boolean = !this.meta.isEmpty();\n let out: ScheduleInput = {};\n let times: TimeInput[] = [];\n\n for (let time of this.times)\n {\n times.push( returnTimes ? time : (timeFormat ? time.format( timeFormat ) : time.toString()) );\n }\n\n if (this.start) out.start = returnDays ? this.start : this.start.time;\n if (this.end) out.end = returnDays ? this.end : this.end.time;\n if (times.length) out.times = times;\n if (alwaysDuration || this.duration !== Constants.DURATION_DEFAULT) out.duration = this.duration;\n if (alwaysDuration || this.durationUnit !== defaultUnit) out.durationUnit = this.durationUnit;\n if (exclusions.length) out.exclude = exclusions;\n if (inclusions.length) out.include = inclusions;\n if (cancels.length) out.cancel = cancels;\n if (hasMeta) out.meta = fn.extend( {}, this.meta.map );\n if (this.dayOfWeek.input) out.dayOfWeek = this.dayOfWeek.input;\n if (this.dayOfMonth.input) out.dayOfMonth = this.dayOfMonth.input;\n if (this.lastDayOfMonth.input) out.lastDayOfMonth = this.lastDayOfMonth.input;\n if (this.dayOfYear.input) out.dayOfYear = this.dayOfYear.input;\n if (this.year.input) out.year = this.year.input;\n if (this.month.input) out.month = this.month.input;\n if (this.week.input) out.week = this.week.input;\n if (this.weekOfYear.input) out.weekOfYear = this.weekOfYear.input;\n if (this.weekspanOfYear.input) out.weekspanOfYear = this.weekspanOfYear.input;\n if (this.fullWeekOfYear.input) out.fullWeekOfYear = this.fullWeekOfYear.input;\n if (this.lastWeekspanOfYear.input) out.lastWeekspanOfYear = this.lastWeekspanOfYear.input;\n if (this.lastFullWeekOfYear.input) out.lastFullWeekOfYear = this.lastFullWeekOfYear.input;\n if (this.weekOfMonth.input) out.weekOfMonth = this.weekOfMonth.input;\n if (this.weekspanOfMonth.input) out.weekspanOfMonth = this.weekspanOfMonth.input;\n if (this.fullWeekOfMonth.input) out.fullWeekOfMonth = this.fullWeekOfMonth.input;\n if (this.lastWeekspanOfMonth.input) out.lastWeekspanOfMonth = this.lastWeekspanOfMonth.input;\n if (this.lastFullWeekOfMonth.input) out.lastFullWeekOfMonth = this.lastFullWeekOfMonth.input;\n\n return out;\n }\n\n /**\n * Describes the schedule in a human friendly string taking into account all\n * possible values specified in this schedule.\n *\n * @param thing A brief description of the things (events) on the schedule.\n * @param includeRange When `true` the [[Schedule.start]] and [[Schedule.end]]\n * are possibly included in the description if they have values.\n * @param includeTimes When `true` the [[Schedule.times]] are possibly included\n * in the description.\n * @param includeDuration When `true` the [[Schedule.duration]] and\n * [[Schedule.durationUnit]] are added to the description if\n * [[Schedule.duration]] is not equal to `1`.\n * @param includeExcludes When `true` the [[Schedule.exclude]] are added\n * to the description if there are any.\n * @param includeIncludes When `true` the [[Schedule.include]] are added\n * to the description if there are any.\n * @param includeCancels When `true` the [[Schedule.cancel]] are added\n * to the description if there are any.\n * @returns The descroption of the schedule.\n */\n public describe(thing: string = 'event',\n includeRange: boolean = true,\n includeTimes: boolean = true,\n includeDuration: boolean = false,\n includeExcludes: boolean = false,\n includeIncludes: boolean = false,\n includeCancels: boolean = false): string\n {\n let out: string = '';\n\n if (includeRange)\n {\n if (this.start)\n {\n out += 'Starting on ' + this.start.format('dddd Do, YYYY');\n\n if (this.end)\n {\n out += ' and ending on ' + this.end.format('dddd Do, YYYY');\n }\n }\n else if (this.end)\n {\n out += 'Up until ' + this.end.format('dddd Do, YYYY');\n }\n }\n\n if (out)\n {\n out += ' the ' + thing + ' will occur';\n }\n else\n {\n out += 'The ' + thing + ' will occur';\n }\n\n out += this.describeRule( this.dayOfWeek.input, 'day of the week', x => moment.weekdays()[x], 1, false);\n out += this.describeRule( this.lastDayOfMonth.input, 'last day of the month', x => Suffix.CACHE[x] );\n out += this.describeRule( this.dayOfMonth.input, 'day of the month', x => Suffix.CACHE[x] );\n out += this.describeRule( this.dayOfYear.input, 'day of the year', x => Suffix.CACHE[x], 1 );\n out += this.describeRule( this.year.input, 'year', x => x, 0, false, ' in ' );\n out += this.describeRule( this.month.input, 'month', x => moment.months()[x], 0, false, ' in ' );\n out += this.describeRule( this.weekOfYear.input, 'week of the year', x => Suffix.CACHE[x] );\n out += this.describeRule( this.weekspanOfYear.input, 'weekspan of the year', x => Suffix.CACHE[x + 1], 1 );\n out += this.describeRule( this.fullWeekOfYear.input, 'full week of the year', x => Suffix.CACHE[x] );\n out += this.describeRule( this.lastWeekspanOfYear.input, 'last weekspan of the year', x => Suffix.CACHE[x + 1], 1 );\n out += this.describeRule( this.lastFullWeekOfYear.input, 'last full week of the year', x => Suffix.CACHE[x] );\n out += this.describeRule( this.weekOfMonth.input, 'week of the month', x => Suffix.CACHE[x] );\n out += this.describeRule( this.fullWeekOfMonth.input, 'full week of the month', x => Suffix.CACHE[x] );\n out += this.describeRule( this.weekspanOfMonth.input, 'weekspan of the month', x => Suffix.CACHE[x + 1], 1 );\n out += this.describeRule( this.lastFullWeekOfMonth.input, 'last full week of the month', x => Suffix.CACHE[x] );\n out += this.describeRule( this.lastWeekspanOfMonth.input, 'last weekspan of the month', x => Suffix.CACHE[x + 1], 1 );\n\n if (includeTimes && this.times.length)\n {\n out += ' at ';\n out += this.describeArray( this.times, x => x.format('hh:mm a') );\n }\n\n if (includeDuration && this.duration !== Constants.DURATION_DEFAULT)\n {\n out += ' lasting ' + this.duration + ' ';\n\n if (this.durationUnit)\n {\n out += this.durationUnit + ' ';\n }\n }\n\n if (includeExcludes)\n {\n let excludes: ScheduleModifierSpan[] = this.exclude.spans().list();\n\n if (excludes.length)\n {\n out += ' excluding ';\n out += this.describeArray( excludes, x => x.span.summary(Units.DAY) );\n }\n }\n\n if (includeIncludes)\n {\n let includes: ScheduleModifierSpan[] = this.include.spans().list();\n\n if (includes.length)\n {\n out += ' including ';\n out += this.describeArray( includes, x => x.span.summary(Units.DAY) );\n }\n }\n\n if (includeCancels)\n {\n let cancels: ScheduleModifierSpan[] = this.cancel.spans().list();\n\n if (cancels.length)\n {\n out += ' with cancellations on ';\n out += this.describeArray( cancels, x => x.span.summary(Units.DAY) );\n }\n }\n\n return out;\n }\n\n /**\n * Describes the given frequency.\n *\n * @param value The frequency to describe.\n * @param unit The unit of the frequency.\n * @param map How the values in the frequency should be described.\n * @param everyOffset A value to add to a [[FrequencyValueEvery]] offset to\n * account for zero-based values that should be shifted for human\n * friendliness.\n * @param the If the word 'the' should be used to describe the unit.\n * @param on The word which preceeds values of the given unit.\n * @param required If the description should always return a non-empty string\n * even if the frequency was not specified in the original input.\n * @returns A string description of the frequency.\n */\n private describeRule(value: FrequencyValue, unit: string, map: (x: number) => any, everyOffset: number = 0, the: boolean = true, on: string = ' on ', required: boolean = false): string\n {\n let out: string = '';\n let suffix: string = the ? ' ' + unit : '';\n\n if (fn.isFrequencyValueEvery(value))\n {\n let valueEvery: FrequencyValueEvery = value;\n\n out += ' every ' + Suffix.CACHE[ valueEvery.every ] + ' ' + unit;\n\n if (valueEvery.offset)\n {\n out += ' starting at ' + map( valueEvery.offset + everyOffset ) + suffix;\n }\n }\n else if (fn.isFrequencyValueOneOf(value))\n {\n let valueOne: FrequencyValueOneOf = value;\n\n if (valueOne.length)\n {\n out += on + (the ? 'the ' : '');\n out += this.describeArray( valueOne, map );\n out += suffix;\n }\n }\n else if (required)\n {\n out += on + 'any ' + unit;\n }\n\n return out;\n }\n\n /**\n * Describes the array by adding commas where appropriate and 'and' before the\n * last value of the array (if its more than `1`).\n *\n * @param array The array of items to describe.\n * @param map The function which converts an item to a string.\n * @returns The final description of the array items.\n */\n private describeArray(array: T[], map: (item: T) => string): string\n {\n let out: string = '';\n let last: number = array.length - 1;\n\n out += map( array[ 0 ] );\n\n for (let i = 1; i < last; i++)\n {\n out += ', ' + map( array[ i ] );\n }\n\n if (last > 0)\n {\n out += ' and ' + map( array[ last ] );\n }\n\n return out;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Schedule.ts","\nimport { Schedule, ScheduleInput } from './Schedule';\n\n/**\n * The input which can be passed to the calendar when adding a schedule and event.\n *\n * @typeparam T The type of data stored in the [[Event]] class.\n * @typeparam M The type of metadata stored in the schedule.\n */\nexport interface EventInput\n{\n id?: any;\n data?: T;\n schedule: ScheduleInput | Schedule;\n}\n\n/**\n * A pairing of a user specified event object and the schedule which defines\n * when it occurs on a calendar.\n *\n * @typeparam T The type of data stored in the [[Event]] class.\n * @typeparam M The type of metadata stored in the schedule.\n */\nexport class Event\n{\n\n /**\n * User specified ID which can be used to find or remove this event from a\n * Calendar.\n */\n public id: any;\n\n /**\n * User specified object which describes this event.\n */\n public data: T;\n\n /**\n * The schedule which defines when this event occurs.\n */\n public schedule: Schedule;\n\n /**\n * If the event is visible on the calendar.\n */\n public visible: boolean;\n\n /**\n * Creates a new event.\n *\n * @param schedule The schedule which defines when the event occurs.\n * @param data User specified object which describes this event.\n * @param id User specified ID which identifies this event.\n */\n public constructor(schedule: Schedule, data?: T, id?: any, visible: boolean = true)\n {\n this.schedule = schedule;\n this.data = data;\n this.id = id;\n this.visible = visible;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Event.ts","\nimport { Functions as fn } from './Functions';\nimport { Constants } from './Constants';\nimport { Parse } from './Parse';\n\n\n/**\n * A value that can possibly be parsed into a Time instance.\n *\n * @see [[Time.parse]]\n */\nexport type TimeInput = Time | number | string | {hour: number, minute?: number, second?: number, millisecond?: number};\n\n/**\n * A class which holds a specific time during in any day.\n */\nexport class Time\n{\n\n /**\n * The regular expression used to parse a time from a string.\n *\n * - ## = hour\n * - ##:## = hour & minute\n * - ##:##:## = hour, minute, & second\n * - ##:##:##.### = hour, minute, second, and milliseconds\n */\n public static REGEX = /^(\\d\\d?):?(\\d\\d)?:?(\\d\\d)?\\.?(\\d\\d\\d)?$/;\n\n /**\n * The hour between 0 and 23\n */\n public hour: number;\n\n /**\n * The minute between 0 and 59\n */\n public minute: number;\n\n /**\n * The second between 0 and 59\n */\n public second: number;\n\n /**\n * The millisecond between 0 and 999\n */\n public millisecond: number;\n\n\n /**\n * Creates a new Time instance given an hour and optionally a minute, second,\n * and millisecond. If they have not been specified they default to 0.\n *\n * @param hour The hour.\n * @param minute The minute.\n * @param second The second.\n * @param millisecond The millisecond.\n */\n public constructor(hour: number, minute: number = Constants.MINUTE_MIN, second: number = Constants.SECOND_MIN, millisecond: number = Constants.MILLIS_MIN)\n {\n this.hour = hour;\n this.minute = minute;\n this.second = second;\n this.millisecond = millisecond;\n }\n\n /**\n * Formats this time into a string. The following list describes the available\n * formatting patterns:\n *\n * ### Hour\n * - H: 0-23\n * - HH: 00-23\n * - h: 12,1-12,1-11\n * - hh: 12,01-12,01-11\n * - k: 1-24\n * - kk: 01-24\n * - a: am,pm\n * - A: AM,PM\n * ### Minute\n * - m: 0-59\n * - mm: 00-59\n * ### Second\n * - s: 0-59\n * - ss: 00-59\n * ### Millisecond\n * - S: 0-9\n * - SS: 00-99\n * - SSS: 000-999\n *\n * @param format The format to output.\n * @returns The formatted time.\n */\n public format(format: string): string\n {\n let formatterEntries = Time.FORMATTERS;\n let out: string = '';\n\n for (let i = 0; i < format.length; i++)\n {\n let handled: boolean = false;\n\n for (let k = 0; k < formatterEntries.length && !handled; k++)\n {\n let entry = formatterEntries[ k ];\n let part: string = format.substring( i, i + entry.size );\n\n if (part.length === entry.size)\n {\n let formatter = entry.formats[ part ];\n\n if (formatter)\n {\n out += formatter(this);\n i += entry.size - 1;\n handled = true;\n }\n }\n }\n\n if (!handled)\n {\n out += format.charAt(i);\n }\n }\n\n return out;\n }\n\n /**\n * Determines whether this time is an exact match for the given time.\n *\n * @param time The given time to test against.\n * @returns `true` if the time matches this time, otherwise `false`.\n */\n public matches(time: Time): boolean\n {\n return this.hour === time.hour &&\n this.minute === time.minute &&\n this.second === time.second &&\n this.millisecond === time.millisecond;\n }\n\n /**\n * Determines whether this time has the same hour as the given time.\n *\n * @param time The given time to test against.\n * @returns `true` if the given hour matches this hour, otherwise `false`.\n */\n public matchesHour(time: Time): boolean\n {\n return this.hour === time.hour;\n }\n\n /**\n * Determines whether this time has the same hour and minute as the given time.\n *\n * @param time The given time to test against.\n * @returns `true` if the given hour and minute matches, otherwise `false`.\n */\n public matchesMinute(time: Time): boolean\n {\n return this.hour === time.hour &&\n this.minute === time.minute;\n }\n\n /**\n * Determines whether this time has the same hour, minute, and second as the\n * given time.\n *\n * @param time The given time to test against.\n * @returns `true` if the given hour, minute, and second matches, otherwise\n * `false`.\n */\n public matchesSecond(time: Time): boolean\n {\n return this.hour === time.hour &&\n this.minute === time.minute &&\n this.second === time.second;\n }\n\n /**\n * @returns The number of milliseconds from the start of the day until this\n * time.\n */\n public toMilliseconds(): number\n {\n return this.hour * Constants.MILLIS_IN_HOUR +\n this.minute * Constants.MILLIS_IN_MINUTE +\n this.second * Constants.MILLIS_IN_SECOND +\n this.millisecond;\n }\n\n /**\n * @returns The time formatted using the smallest format that completely\n * represents this time.\n */\n public toString(): string\n {\n if (this.millisecond) return this.format('HH:mm:ss.SSS');\n if (this.second) return this.format('HH:mm:ss');\n if (this.minute) return this.format('HH:mm');\n\n return this.format('HH');\n }\n\n /**\n * @returns A unique identifier for this time. The number returned is in the\n * following format: SSSssmmHH\n */\n public toIdentifier(): number\n {\n return this.hour +\n this.minute * 100 +\n this.second * 10000 +\n this.millisecond * 10000000;\n }\n\n /**\n * @returns An object with hour, minute, second, a millisecond properties if\n * they are non-zero on this time.\n */\n public toObject(): TimeInput\n {\n let out: TimeInput = {\n hour: this.hour\n };\n\n if (this.minute) out.minute = this.minute;\n if (this.second) out.second = this.second;\n if (this.millisecond) out.millisecond = this.millisecond;\n\n return out;\n }\n\n /**\n * Parses a value and tries to convert it to a Time instance.\n *\n * @param input The input to parse.\n * @returns The instance parsed or `null` if it was invalid.\n * @see [[Parse.time]]\n */\n public static parse(input: any): Time\n {\n return Parse.time(input);\n }\n\n /**\n * Parses a string and converts it to a Time instance. If the string is not\n * in a valid format `null` is returned.\n *\n * @param time The string to parse.\n * @returns The instance parsed or `null` if it was invalid.\n * @see [[Time.REGEX]]\n */\n public static fromString(time: string): Time\n {\n let matches: string[] = this.REGEX.exec( time );\n\n if (!matches)\n {\n return null;\n }\n\n let h: number = parseInt(matches[1]) || 0;\n let m: number = parseInt(matches[2]) || 0;\n let s: number = parseInt(matches[3]) || 0;\n let l: number = parseInt(matches[4]) || 0;\n\n return this.build(h, m, s, l);\n }\n\n /**\n * Parses a number and converts it to a Time instance. The number is assumed\n * to be in the [[Time.toIdentifier]] format.\n *\n * @param time The number to parse.\n * @returns The instance parsed.\n */\n public static fromIdentifier(time: number): Time\n {\n let h: number = time % 100;\n let m: number = Math.floor(time / 100) % 100;\n let s: number = Math.floor(time / 10000) % 100;\n let l: number = Math.floor(time / 10000000) % 1000;\n\n return this.build(h, m, s, l);\n }\n\n /**\n * Returns a new instance given an hour and optionally a minute, second,\n * and millisecond. If they have not been specified they default to 0.\n *\n * @param hour The hour.\n * @param minute The minute.\n * @param second The second.\n * @param millisecond The millisecond.\n * @returns A new instance.\n */\n public static build(hour: number, minute: number = Constants.MINUTE_MIN, second: number = Constants.SECOND_MIN, millisecond: number = Constants.MILLIS_MIN): Time\n {\n return new Time(hour, minute, second, millisecond)\n }\n\n /**\n * A set of formatting functions keyed by their format string.\n */\n public static FORMATTERS = [\n {\n size: 3,\n formats: {\n SSS: (t: Time) => fn.padNumber(t.millisecond, 3)\n }\n },\n {\n size: 2,\n formats: {\n HH: (t: Time) => fn.padNumber(t.hour, 2),\n hh: (t: Time) => fn.padNumber((t.hour % 12) || 12, 2),\n kk: (t: Time) => fn.padNumber(t.hour + 1, 2),\n mm: (t: Time) => fn.padNumber(t.minute, 2),\n ss: (t: Time) => fn.padNumber(t.second, 2),\n SS: (t: Time) => fn.padNumber(t.millisecond, 3, 2)\n }\n },\n {\n size: 1,\n formats: {\n A: (t: Time) => t.hour < 12 ? 'AM' : 'PM',\n a: (t: Time) => t.hour < 12 ? 'am' : 'pm',\n H: (t: Time) => t.hour + '',\n h: (t: Time) => ((t.hour % 12) || 12) + '',\n k: (t: Time) => (t.hour + 1) + '',\n m: (t: Time) => t.minute + '',\n s: (t: Time) => t.second + '',\n S: (t: Time) => fn.padNumber(t.millisecond, 3, 1)\n }\n }\n ];\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Time.ts","\nimport { Functions as fn } from './Functions';\nimport { FrequencyCheck } from './Frequency';\nimport { Schedule, ScheduleInput } from './Schedule';\nimport { ScheduleModifier } from './ScheduleModifier';\nimport { Constants } from './Constants';\nimport { Day, DayProperty, DayInput, DurationInput } from './Day';\nimport { Event } from './Event';\nimport { Time } from './Time';\n\n\n/**\n * The class which takes user input and parses it to specific structures.\n */\nexport class Parse\n{\n\n /**\n * Parses a value and converts it to a [[FrequencyCheck]].\n *\n * @param input The input to parse into a function.\n * @param property The [[Day]] property the frequency is for.\n * @returns A function which determines whether a value matches a frequency.\n * @see [[Schedule]]\n */\n public static frequency(input: any, property: DayProperty): FrequencyCheck\n {\n let check: FrequencyCheck = (value: number) => {\n return true;\n };\n\n check.given = false;\n\n if (fn.isFrequencyValueEvery(input))\n {\n let every: number = input.every;\n let offset: number = (input.offset || 0) % every;\n\n check = (value: number) => {\n return value % every === offset;\n };\n check.given = true;\n }\n\n if (fn.isFrequencyValueOneOf(input))\n {\n let map: object = {};\n\n for (let i = 0; i < input.length; i++) {\n map[ input[ i ] ] = true;\n }\n\n check = (value: number) => {\n return !!map[ value ];\n };\n check.given = true;\n }\n\n check.input = fn.coalesce( input, null );\n check.property = property;\n\n return check;\n }\n\n /**\n * Parses [[DayInput]] into a [[Day]] instance.\n *\n * ```typescript\n * Parse.day( 65342300 ); // UTC timestamp\n * Parse.day( '01/02/2014' ); // strings in many formats\n * Parse.day( day ); // return a passed instance\n * Parse.day( [2018, 0, 2] ); // array: 01/02/2018\n * Parse.day( {year: 2018, month: 2} ); // object: 03/01/2018\n * Parse.day( true ); // today\n * ```\n *\n * @param input The input to parse.\n * @returns The Day parsed or `null` if the value is not valid.\n */\n public static day(input: DayInput): Day\n {\n if (fn.isNumber(input))\n {\n return Day.unix( input );\n }\n else if (fn.isString(input))\n {\n return Day.fromString( input );\n }\n else if (input instanceof Day)\n {\n return input;\n }\n else if (fn.isArray( input ))\n {\n return Day.fromArray( input );\n }\n else if (fn.isObject( input ))\n {\n return Day.fromObject( input );\n }\n else if (input === true)\n {\n return Day.today();\n }\n\n return null;\n }\n\n /**\n * Parses a value and tries to convert it to a Time instance.\n *\n * ```typescript\n * Parse.time( time ); // return a passed instance\n * Parse.time( 9 ); // 09:00:00.000\n * Parse.time( 3009 ); // 09:30:00.000\n * Parse.time( 593009 ); // 09:30:59.000\n * Parsetime( '09' ); // 09:00:00.000\n * Parse.time( '9:30' ); // 09:30:00.000\n * Parse.time( '9:30:59' ); // 09:30:59.000\n * Parse.time( {hour: 2} ); // 02:00:00.000\n * ```\n *\n * @param input The input to parse.\n * @returns The instance parsed or `null` if it was invalid.\n * @see [[Time.fromIdentifier]]\n * @see [[Time.fromString]]\n */\n public static time(input: any): Time\n {\n if (input instanceof Time)\n {\n return input;\n }\n if (fn.isNumber(input))\n {\n return Time.fromIdentifier( input );\n }\n if (fn.isString(input))\n {\n return Time.fromString( input );\n }\n if (fn.isObject(input) && fn.isNumber(input.hour))\n {\n return new Time(input.hour, input.minute, input.second, input.millisecond);\n }\n\n return null;\n }\n\n /**\n * Parses a value and tries to convert it to an array of Time instances.\n * If any of the given values are not a valid time value then the resulting\n * array will not contain a time instance.\n *\n * @param input The input to parse.\n * @returns A non-null array of time instances.\n * @see [[Parse.time]]\n */\n public static times(input: any): Time[]\n {\n let times: Time[] = [];\n\n if (fn.isArray(input))\n {\n for (let timeInput of input)\n {\n let time = this.time( timeInput );\n\n if (time)\n {\n times.push( time );\n }\n }\n\n // Sort times from earliest to latest.\n times.sort((a, b) =>\n {\n return a.toMilliseconds() - b.toMilliseconds();\n });\n }\n\n return times;\n }\n\n /**\n * Parses an array of excluded days into a map of excluded days where the\n * array value and returned object key are [[Day.dayIdentifier]].\n *\n * ```typescript\n * Parse.modifier( [ 20180101, 20140506 ] ); // {'20180101': true, '20140506': true}\n * Parse.modifier( [ 20180101, Day.build(2014,4,6) ] ); // {'20180101': true, '20140506': true}\n * ```\n *\n * @param input The input to parse.\n * @param value The default value if the input given is an array of identifiers.\n * @param parseMeta A function to use to parse a modifier.\n * @param out The modifier to set the identifiers and values of and return.\n * @returns The object with identifier keys and `true` values.\n * @see [[Day.dayIdentifier]]\n */\n public static modifier(input: any, value: T,\n parseMeta: (input: any) => T = (x => x),\n out: ScheduleModifier = new ScheduleModifier()): ScheduleModifier\n {\n let map = {};\n\n if (fn.isArray(input))\n {\n for (let identifier of input)\n {\n if (identifier instanceof Day)\n {\n map[ identifier.dayIdentifier ] = value;\n }\n else if (fn.isNumber(identifier))\n {\n map[ identifier ] = value;\n }\n else if (fn.isString(identifier))\n {\n map[ identifier ] = value;\n }\n }\n }\n\n if (fn.isObject(input))\n {\n for (let identifier in input)\n {\n map[ identifier ] = parseMeta( input[ identifier ] );\n }\n }\n\n out.map = map;\n\n return out;\n }\n\n /**\n * Parses an object which specifies a schedule where events may or may not\n * repeat and they may be all day events or at specific times.\n *\n * @param input The input to parse into a schedule.\n * @param parseMeta A function to use when parsing meta input into the desired type.\n * @param out The schedule to set the values of and return.\n * @returns An instance of the parsed [[Schedule]].\n */\n public static schedule(input: ScheduleInput | Schedule,\n parseMeta: (input: any) => M = (x => x),\n out: Schedule = new Schedule()): Schedule\n {\n if (input instanceof Schedule)\n {\n return input;\n }\n\n let on: Day = this.day( input.on );\n let times: Time[] = this.times( input.times );\n let fullDay: boolean = times.length === 0;\n\n if (on)\n {\n input.start = on.start();\n input.end = on.end();\n input.year = [on.year];\n input.month = [on.month];\n input.dayOfMonth = [on.dayOfMonth];\n }\n\n out.times = times;\n out.duration = fn.coalesce( input.duration, Constants.DURATION_DEFAULT );\n out.durationUnit = fn.coalesce( input.durationUnit, Constants.DURATION_DEFAULT_UNIT( fullDay ) );\n out.start = this.day( input.start );\n out.end = this.day( input.end );\n out.exclude = this.modifier( input.exclude, true, undefined, out.exclude );\n out.include = this.modifier( input.include, true, undefined, out.include );\n out.cancel = this.modifier( input.cancel, true, undefined, out.cancel );\n out.meta = this.modifier( input.meta, null, parseMeta, out.meta );\n out.year = this.frequency( input.year, 'year' );\n out.month = this.frequency( input.month, 'month' );\n out.week = this.frequency( input.week, 'week' );\n out.weekOfYear = this.frequency( input.weekOfYear, 'weekOfYear' );\n out.weekspanOfYear = this.frequency( input.weekspanOfYear, 'weekspanOfYear' );\n out.fullWeekOfYear = this.frequency( input.fullWeekOfYear, 'fullWeekOfYear' );\n out.lastWeekspanOfYear = this.frequency( input.lastWeekspanOfYear, 'lastWeekspanOfYear' );\n out.lastFullWeekOfYear = this.frequency( input.lastFullWeekOfYear, 'lastFullWeekOfYear' );\n out.weekOfMonth = this.frequency( input.weekOfMonth, 'weekOfMonth' );\n out.weekspanOfMonth = this.frequency( input.weekspanOfMonth, 'weekspanOfMonth' );\n out.fullWeekOfMonth = this.frequency( input.fullWeekOfMonth, 'fullWeekOfMonth' );\n out.lastWeekspanOfMonth = this.frequency( input.lastWeekspanOfMonth, 'lastWeekspanOfMonth' );\n out.lastFullWeekOfMonth = this.frequency( input.lastFullWeekOfMonth, 'lastFullWeekOfMonth' );\n out.dayOfWeek = this.frequency( input.dayOfWeek, 'dayOfWeek' );\n out.dayOfMonth = this.frequency( input.dayOfMonth, 'dayOfMonth' );\n out.lastDayOfMonth = this.frequency( input.lastDayOfMonth, 'lastDayOfMonth' );\n out.dayOfYear = this.frequency( input.dayOfYear, 'dayOfYear' );\n out.updateDurationInDays();\n out.updateChecks();\n\n return out;\n }\n\n /**\n * Parses an array of [[FrequencyCheck]] functions and returns an array of\n * functions for only the checks that were specified by the user.\n *\n * @param checks The array of check functions to filter through.\n * @returns The array of user specified checks.\n */\n public static givenFrequency(checks: FrequencyCheck[]): FrequencyCheck[]\n {\n let out: FrequencyCheck[] = [];\n\n for (let check of checks)\n {\n if (check.given)\n {\n out.push( check );\n }\n }\n\n return out;\n }\n\n /**\n * Parses [[EventInput]] and returns an [[Event]].\n *\n * @param input The input to parse.\n * @param parseData A function to use when parsing data input into the desired type.\n * @param parseMeta A function to use when parsing meta input into the desired type.\n * @returns The parsed value.\n */\n public static event(input: any,\n parseData: (input: any) => T = (x => x),\n parseMeta: (input: any) => M = (x => x)): Event\n {\n if (input instanceof Event)\n {\n return input;\n }\n\n if (!input.schedule)\n {\n return null;\n }\n\n let schedule: Schedule = this.schedule( input.schedule, parseMeta );\n\n return new Event( schedule, parseData( input.data ), input.id, input.visible );\n }\n\n /**\n * Parses a schedule from a CRON pattern. TODO\n */\n public static cron(pattern: string, out: Schedule = new Schedule()): Schedule\n {\n return out;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Parse.ts","\nimport { Identifier, IdentifierInput } from './Identifier';\nimport { Constants } from './Constants';\nimport { Op, operate } from './Operation';\nimport { Parse } from './Parse';\nimport { Time } from './Time';\n\n// @ts-ignore\nimport * as moment from 'moment';\n\n\n/**\n * Valid durations that can be specified.\n */\nexport type DurationInput = moment.unitOfTime.DurationConstructor;\n\n/**\n * All valid types which may be converted to a [[Day]] instance.\n *\n * - `number`: A UNIX timestamp.\n * - `string`: A string representation of a date.\n * - `Day`: An existing [[Day]] instance.\n * - `number[]`: An array of numbers specifying any of: [year, month, dayOfMonth, hour, minute, second, millisecond].\n * - `object`: An object with any of the following properties: year, month, dayOfMonth, hour, minute, second, millisecond.\n * - `true`: This will be interpreted as [[Day.today]]\n */\nexport type DayInput = number | string | Day | number[] | object | true;\n\n/**\n * One of the properties on the [[Day]] object.\n */\nexport type DayProperty = keyof Day;\n\n/**\n * A class which represents a point in time as\n */\nexport class Day\n{\n\n /**\n *\n */\n public readonly date: moment.Moment;\n\n /**\n *\n */\n public readonly time: number;\n\n /**\n *\n */\n public readonly millis: number;\n\n /**\n *\n */\n public readonly seconds: number;\n\n /**\n *\n */\n public readonly minute: number;\n\n /**\n *\n */\n public readonly hour: number;\n\n /**\n *\n */\n public readonly month: number;\n\n /**\n *\n */\n public readonly year: number;\n\n /**\n *\n */\n public readonly quarter: number;\n\n\n /**\n *\n */\n public readonly dayOfWeek: number;\n\n /**\n *\n */\n public readonly dayOfMonth: number;\n\n /**\n *\n */\n public readonly lastDayOfMonth: number;\n\n /**\n *\n */\n public readonly dayOfYear: number;\n\n\n /**\n *\n */\n public readonly week: number;\n\n /**\n *\n */\n public readonly weekOfYear: number;\n\n /**\n *\n */\n public readonly weekspanOfYear: number;\n\n /**\n *\n */\n public readonly fullWeekOfYear: number;\n\n /**\n *\n */\n public readonly lastWeekspanOfYear: number;\n\n /**\n *\n */\n public readonly lastFullWeekOfYear: number;\n\n\n /**\n *\n */\n public readonly weekOfMonth: number;\n\n /**\n *\n */\n public readonly weekspanOfMonth: number;\n\n /**\n *\n */\n public readonly fullWeekOfMonth: number;\n\n /**\n *\n */\n public readonly lastWeekspanOfMonth: number;\n\n /**\n *\n */\n public readonly lastFullWeekOfMonth: number;\n\n\n /**\n *\n */\n public readonly timeIdentifier: IdentifierInput;\n\n /**\n *\n */\n public readonly dayIdentifier: IdentifierInput;\n\n /**\n *\n */\n public readonly weekIdentifier: IdentifierInput;\n\n /**\n *\n */\n public readonly monthIdentifier: IdentifierInput;\n\n /**\n *\n */\n public readonly quarterIdentifier: IdentifierInput;\n\n\n\n /**\n *\n */\n public constructor(date: moment.Moment)\n {\n this.date = date;\n this.time = date.valueOf();\n this.millis = date.millisecond();\n this.seconds = date.second();\n this.minute = date.minute();\n this.hour = date.hour();\n this.month = date.month();\n this.year = date.year();\n this.quarter = date.quarter();\n this.dayOfWeek = date.day();\n this.dayOfMonth = date.date();\n this.dayOfYear = date.dayOfYear();\n this.week = date.week();\n\n this.lastDayOfMonth = Day.getLastDayOfMonth( date );\n this.weekOfYear = Day.getWeekOfYear( date );\n this.weekspanOfYear = Day.getWeekspanOfYear( date );\n this.fullWeekOfYear = Day.getFullWeekOfYear( date );\n this.lastWeekspanOfYear = Day.getLastWeekspanOfYear( date );\n this.lastFullWeekOfYear = Day.getLastFullWeekOfYear( date );\n\n this.weekOfMonth = Day.getWeekOfMonth( date );\n this.weekspanOfMonth = Day.getWeekspanOfMonth( date );\n this.fullWeekOfMonth = Day.getFullWeekOfMonth( date );\n this.lastWeekspanOfMonth = Day.getLastWeekspanOfMonth( date );\n this.lastFullWeekOfMonth = Day.getLastFullWeekOfMonth( date );\n\n this.timeIdentifier = Identifier.Time.get( this );\n this.dayIdentifier = Identifier.Day.get( this);\n this.weekIdentifier = Identifier.Week.get( this);\n this.monthIdentifier = Identifier.Month.get( this);\n this.quarterIdentifier = Identifier.Quarter.get( this );\n }\n\n // Same\n\n /**\n *\n */\n public sameDay(day: Day): boolean\n {\n return this.dayIdentifier === day.dayIdentifier;\n }\n\n /**\n *\n */\n public sameMonth(day: Day): boolean\n {\n return this.monthIdentifier === day.monthIdentifier;\n }\n\n /**\n *\n */\n public sameWeek(day: Day): boolean\n {\n return this.weekIdentifier === day.weekIdentifier;\n }\n\n /**\n *\n */\n public sameYear(day: Day): boolean\n {\n return this.year === day.year;\n }\n\n /**\n *\n */\n public sameQuarter(day: Day): boolean\n {\n return this.quarterIdentifier === day.quarterIdentifier;\n }\n\n /**\n *\n */\n public sameHour(day: Day): boolean {\n return this.dayIdentifier === day.dayIdentifier && this.hour === day.hour;\n }\n\n /**\n *\n */\n public sameMinute(day: Day): boolean {\n return this.timeIdentifier === day.timeIdentifier;\n }\n\n /**\n *\n */\n public sameTime(time: Time): boolean {\n return this.hour === time.hour && this.minute === time.minute && this.seconds === time.second && this.millis === time.millisecond;\n }\n\n // Comparison\n\n /**\n *\n */\n public isBefore(day: Day, precision?: moment.unitOfTime.StartOf): boolean {\n return this.date.isBefore( day.date, precision );\n }\n\n /**\n *\n */\n public isSameOrBefore(day: Day, precision?: moment.unitOfTime.StartOf): boolean {\n return this.date.isSameOrBefore( day.date, precision );\n }\n\n /**\n *\n */\n public isAfter(day: Day, precision?: moment.unitOfTime.StartOf): boolean {\n return this.date.isAfter( day.date, precision );\n }\n\n /**\n *\n */\n public isSameOrAfter(day: Day, precision?: moment.unitOfTime.StartOf): boolean {\n return this.date.isSameOrAfter( day.date, precision );\n }\n\n /**\n *\n */\n public max(day: Day): Day {\n return this.date.isAfter( day.date ) ? this : day;\n }\n\n /**\n *\n */\n public min(day: Day): Day {\n return this.date.isBefore( day.date ) ? this : day;\n }\n\n // Between\n\n public millisBetween(day: Day, op: Op = Op.DOWN, absolute: boolean = true): number {\n return operate( this.date.diff( day.date, 'milliseconds', true ), op, absolute );\n }\n\n public secondsBetween(day: Day, op: Op = Op.DOWN, absolute: boolean = true): number {\n return operate( this.date.diff( day.date, 'seconds', true ), op, absolute );\n }\n\n public minutesBetween(day: Day, op: Op = Op.DOWN, absolute: boolean = true): number {\n return operate( this.date.diff( day.date, 'minutes', true ), op, absolute );\n }\n\n public hoursBetween(day: Day, op: Op = Op.DOWN, absolute: boolean = true): number {\n return operate( this.date.diff( day.date, 'hours', true ), op, absolute );\n }\n\n public daysBetween(day: Day, op: Op = Op.DOWN, absolute: boolean = true): number {\n return operate( this.date.diff( day.date, 'days', true ), op, absolute );\n }\n\n public weeksBetween(day: Day, op: Op = Op.DOWN, absolute: boolean = true): number {\n return operate( this.date.diff( day.date, 'weeks', true ), op, absolute );\n }\n\n public monthsBetween(day: Day, op: Op = Op.DOWN, absolute: boolean = true): number {\n return operate( this.date.diff( day.date, 'months', true ), op, absolute );\n }\n\n public yearsBetween(day: Day, op: Op = Op.DOWN, absolute: boolean = true): number {\n return operate( this.date.diff( day.date, 'years', true ), op, absolute );\n }\n\n public isBetween(start: Day, end: Day, inclusive: boolean = true): boolean {\n return this.date.isBetween(start.date, end.date, null, inclusive ? '[]' : '[)');\n }\n\n public mutate(mutator: (date: moment.Moment) => void): Day {\n var d = this.toMoment();\n mutator( d );\n return new Day( d );\n }\n\n public add(amount: number, unit: string): Day {\n return this.mutate(d => d.add(amount, unit));\n }\n\n public relative(millis: number): Day {\n return this.mutate(d => d.add(millis, 'milliseconds'));\n }\n\n // Days\n\n public relativeDays(days: number): Day {\n return this.mutate(d => d.add(days, 'days'));\n }\n\n public prev(days: number = 1): Day {\n return this.relativeDays( -days );\n }\n\n public next(days: number = 1): Day {\n return this.relativeDays( days );\n }\n\n public withDayOfMonth(day: number): Day {\n return this.mutate(d => d.date(day));\n }\n\n public withDayOfWeek(dayOfWeek: number): Day {\n return this.mutate(d => d.day(dayOfWeek));\n }\n\n public withDayOfYear(dayOfYear: number): Day {\n return this.mutate(d => d.dayOfYear(dayOfYear));\n }\n\n // Month\n\n public withMonth(month: number): Day {\n return this.mutate(d => d.month(month));\n }\n\n public relativeMonths(months: number): Day {\n return this.mutate(d => d.add(months, 'months'));\n }\n\n public prevMonth(months: number = 1): Day {\n return this.relativeMonths( -months );\n }\n\n public nextMonth(months: number = 1): Day {\n return this.relativeMonths( months );\n }\n\n // Week Of Year\n\n public withWeek(week: number, relativeWeek: number = this.week): Day {\n return this.mutate(d => d.add((week - relativeWeek) * Constants.DAYS_IN_WEEK, 'days'));\n }\n\n public withWeekOfYear(week: number): Day {\n return this.withWeek(week, this.weekOfYear);\n }\n\n public withFullWeekOfYear(week: number): Day {\n return this.withWeek(week, this.fullWeekOfYear);\n }\n\n public withWeekspanOfYear(week: number): Day {\n return this.withWeek(week, this.weekspanOfYear);\n }\n\n public withWeekOfMonth(week: number): Day {\n return this.withWeek(week, this.weekOfMonth);\n }\n\n public withWeekspanOfMonth(week: number): Day {\n return this.withWeek(week, this.weekspanOfMonth);\n }\n\n public withFullWeekOfMonth(week: number): Day {\n return this.withWeek(week, this.fullWeekOfMonth);\n }\n\n public relativeWeeks(weeks: number): Day {\n return this.mutate(d => d.add(weeks, 'weeks'));\n }\n\n public prevWeek(weeks: number = 1): Day {\n return this.relativeWeeks( -weeks );\n }\n\n public nextWeek(weeks: number = 1): Day {\n return this.relativeWeeks( weeks );\n }\n\n // Year\n\n public withYear(year: number): Day {\n return this.mutate(d => d.year(year));\n }\n\n public relativeYears(years: number): Day {\n return this.mutate(d => d.add(years, 'year'));\n }\n\n public prevYear(years: number = 1): Day {\n return this.relativeYears( -years );\n }\n\n public nextYear(years: number = 1): Day {\n return this.relativeYears( years );\n }\n\n // Hour\n\n public withHour(hour: number): Day {\n return this.mutate(d => d.hour(hour));\n }\n\n public relativeHours(hours: number): Day {\n return this.mutate(d => d.add(hours, 'hours'));\n }\n\n public prevHour(hours: number = 1): Day {\n return this.relativeHours( -hours );\n }\n\n public nextHour(hours: number = 1): Day {\n return this.relativeHours( hours );\n }\n\n // Time\n\n public withTimes(\n hour: number = Constants.HOUR_MIN,\n minute: number = Constants.MINUTE_MIN,\n second: number = Constants.SECOND_MIN,\n millisecond: number = Constants.MILLIS_MIN): Day {\n return this.mutate(d => d.set({hour, minute, second, millisecond}));\n }\n\n public withTime(time: Time): Day {\n return this.withTimes(time.hour, time.minute, time.second, time.millisecond);\n }\n\n public asTime(): Time {\n return new Time(this.hour, this.minute, this.seconds, this.millis);\n }\n\n // Start & End\n\n // Time\n\n public start(): Day {\n return this.mutate(d => d.startOf('day'));\n }\n\n public isStart(): boolean {\n return this.hour === Constants.HOUR_MIN &&\n this.minute === Constants.MINUTE_MIN &&\n this.seconds === Constants.SECOND_MIN &&\n this.millis === Constants.MILLIS_MIN;\n }\n\n public end(inclusive: boolean = true): Day {\n return inclusive ?\n this.mutate(d => d.endOf('day')) :\n this.mutate(d => d.startOf('day').add(1, 'day'));\n }\n\n public isEnd(): boolean {\n return this.hour === Constants.HOUR_MAX &&\n this.minute === Constants.MINUTE_MAX &&\n this.seconds === Constants.SECOND_MAX &&\n this.millis === Constants.MILLIS_MAX;\n }\n\n // Hour\n\n public startOfHour(): Day {\n return this.mutate(d => d.startOf('hour'));\n }\n\n public isStartOfHour(): boolean {\n return this.minute === Constants.MINUTE_MIN &&\n this.seconds === Constants.SECOND_MIN &&\n this.millis === Constants.MILLIS_MIN;\n }\n\n public endOfHour(inclusive: boolean = true): Day {\n return inclusive ?\n this.mutate(d => d.endOf('hour')) :\n this.mutate(d => d.startOf('hour').add(1, 'hour'));\n }\n\n public isEndOfHour(): boolean {\n return this.minute === Constants.MINUTE_MAX &&\n this.seconds === Constants.SECOND_MAX &&\n this.millis === Constants.MILLIS_MAX;\n }\n\n // Week\n\n public startOfWeek(): Day {\n return this.mutate(d => d.startOf('week'));\n }\n\n public isStartOfWeek(): boolean {\n return this.dayOfWeek === Constants.WEEKDAY_MIN;\n }\n\n public endOfWeek(inclusive: boolean = true): Day {\n return inclusive ?\n this.mutate(d => d.endOf('week')) :\n this.mutate(d => d.startOf('week').add(1, 'week'));\n }\n\n public isEndOfWeek(): boolean {\n return this.dayOfWeek === Constants.WEEKDAY_MAX;\n }\n\n // Month\n\n public startOfMonth(): Day {\n return this.mutate(d => d.startOf('month'));\n }\n\n public isStartOfMonth(): boolean {\n return this.dayOfMonth === Constants.DAY_MIN;\n }\n\n public endOfMonth(inclusive: boolean = true): Day {\n return inclusive ?\n this.mutate(d => d.endOf('month')) :\n this.mutate(d => d.startOf('month').add(1, 'month'));\n }\n\n public isEndOfMonth(): boolean {\n return this.dayOfMonth === this.daysInMonth();\n }\n\n // Year\n\n public startOfYear(): Day {\n return this.mutate(d => d.startOf('year'));\n }\n\n public isStartOfYear(): boolean {\n return this.month === Constants.MONTH_MIN && this.dayOfMonth === Constants.DAY_MIN;\n }\n\n public endOfYear(inclusive: boolean = true): Day {\n return inclusive ?\n this.mutate(d => d.endOf('year')) :\n this.mutate(d => d.startOf('year').add(1, 'year'));\n }\n\n public isEndOfYear(): boolean {\n return this.month === Constants.MONTH_MAX && this.dayOfMonth === Constants.DAY_MAX;\n }\n\n // Days In X\n\n public daysInMonth(): number {\n return this.date.daysInMonth();\n }\n\n public daysInYear(): number {\n return this.endOfYear().dayOfYear;\n }\n\n public weeksInYear(): number {\n return this.date.weeksInYear();\n }\n\n // Display\n\n public format(format: string): string {\n return this.date.format( format );\n }\n\n public utc(keepLocalTime?: boolean): Day {\n return this.mutate(d => d.utc(keepLocalTime));\n }\n\n public toMoment(): moment.Moment {\n return this.date.clone();\n }\n\n public toDate(): Date {\n return this.date.toDate();\n }\n\n public toArray(): number[] {\n return this.date.toArray();\n }\n\n public toJSON(): string {\n return this.date.toJSON();\n }\n\n public toISOString(keepOffset: boolean = false): string {\n return this.date.toISOString( keepOffset );\n }\n\n public toObject(): object {\n return this.date.toObject();\n }\n\n public toString(): string {\n return this.date.toString();\n }\n\n // State\n\n public isDST(): boolean {\n return this.date.isDST();\n }\n\n public isLeapYear(): boolean {\n return this.date.isLeapYear();\n }\n\n // Instances\n\n public static now(): Day {\n return new Day(moment());\n }\n\n public static today(): Day {\n return this.now().start();\n }\n\n public static tomorrow(): Day {\n return this.today().next();\n }\n\n public static fromMoment(moment: moment.Moment): Day {\n return moment && moment.isValid() ? new Day( moment ) : null;\n }\n\n public static unix(millis: number): Day {\n return this.fromMoment(moment(millis));\n }\n\n public static unixSeconds(millis: number): Day {\n return this.fromMoment(moment.unix(millis));\n }\n\n public static parse(input: DayInput): Day {\n return Parse.day(input);\n }\n\n public static fromString(input: string): Day {\n return this.fromMoment(moment(input));\n }\n\n public static fromFormat(input: string, formats: string | string[]): Day {\n return this.fromMoment(moment(input, formats));\n }\n\n public static fromObject(input: object): Day {\n return this.fromMoment(moment(input));\n }\n\n public static fromDate(input: Date): Day {\n return this.fromMoment(moment(input));\n }\n\n public static fromArray(input: number[]): Day {\n return this.fromMoment(moment(input));\n }\n\n public static fromDayIdentifier(id: number): Day {\n let date: number = id % 100;\n let month: number = (Math.floor(id / 100) % 100) - 1;\n let year: number = Math.floor(id / 10000);\n\n return this.build(year, month, date);\n }\n\n public static build(year: number, month: number,\n date: number = Constants.DAY_MIN,\n hour: number = Constants.HOUR_MIN,\n minute: number = Constants.MINUTE_MIN,\n second: number = Constants.SECOND_MIN,\n millisecond: number = Constants.MILLIS_MIN): Day\n {\n return new Day( moment({year, month, date, hour, minute, second, millisecond}) );\n }\n\n\n\n\n\n\n\n\n public static getWeekspanOfYear(date: moment.Moment): number\n {\n return Math.floor( (date.dayOfYear() - 1) / Constants.DAYS_IN_WEEK );\n }\n\n public static getLastWeekspanOfYear(date: moment.Moment): number\n {\n let lastOfYear = date.clone().endOf('year');\n let daysInYear: number = lastOfYear.dayOfYear();\n\n return Math.floor( (daysInYear - date.dayOfYear()) / Constants.DAYS_IN_WEEK );\n }\n\n public static getWeekOfYear(date: moment.Moment): number\n {\n let firstOfYear = date.clone().startOf('year');\n let weeks: number = date.week();\n\n return firstOfYear.day() > Constants.WEEK_OF_MONTH_MINIMUM_WEEKDAY ? weeks - 1 : weeks;\n }\n\n public static getFullWeekOfYear(date: moment.Moment): number\n {\n let firstOfYear = date.clone().startOf('year');\n let weeks: number = date.week();\n\n return firstOfYear.day() === Constants.WEEKDAY_MIN ? weeks : weeks - 1;\n }\n\n public static getLastFullWeekOfYear(date: moment.Moment): number\n {\n let firstOfYear = date.clone().startOf('year');\n let weeks: number = date.week();\n let weeksMax: number = date.weeksInYear();\n let lastWeek: number = weeksMax - weeks;\n\n return firstOfYear.day() === Constants.WEEKDAY_MIN ? lastWeek + 1 : lastWeek;\n }\n\n public static getWeekspanOfMonth(date: moment.Moment): number\n {\n return Math.floor((date.date() - 1) / Constants.DAYS_IN_WEEK);\n }\n\n public static getLastWeekspanOfMonth(date: moment.Moment): number\n {\n return Math.floor((date.daysInMonth() - date.date()) / Constants.DAYS_IN_WEEK);\n }\n\n public static getFullWeekOfMonth(date: moment.Moment): number\n {\n return Math.floor((date.date() - 1 - date.day() + Constants.DAYS_IN_WEEK) / Constants.DAYS_IN_WEEK);\n }\n\n public static getLastFullWeekOfMonth(date: moment.Moment): number\n {\n return Math.floor((date.daysInMonth() - date.date() - (Constants.WEEKDAY_MAX - date.day()) + Constants.DAYS_IN_WEEK) / Constants.DAYS_IN_WEEK);\n }\n\n public static getWeekOfMonth(date: moment.Moment): number\n {\n let dom = date.date();\n let dow = date.day();\n let sundayDate = dom - dow;\n\n return Math.floor( ( sundayDate + Constants.WEEK_OF_MONTH_MINIMUM_WEEKDAY + 5 ) / Constants.DAYS_IN_WEEK );\n }\n\n public static getLastDayOfMonth(date: moment.Moment): number\n {\n return date.daysInMonth() - date.date() + 1;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Day.ts","\nimport { Op } from './Operation';\nimport { Day } from './Day';\nimport { DaySpan } from './DaySpan';\nimport { CalendarEvent } from './CalendarEvent';\n\n\n/**\n * A day in a [[Calendar]] with extra information relative to any selection on\n * the calendar, the current date, or events on the day.\n *\n * @typeparam T The type of data stored in the [[Event]] class.\n * @typeparam M The type of metadata stored in the schedule.\n */\nexport class CalendarDay extends Day\n{\n\n /**\n * Whether this day is the current day (ex: today).\n */\n public currentDay: boolean = false;\n\n /**\n * Whether this day is on the same week as the current day (ex: today).\n */\n public currentWeek: boolean = false;\n\n /**\n * Whether this day is on the same month as the current day (ex: today).\n */\n public currentMonth: boolean = false;\n\n /**\n * Whether this day is on the same year as the current day (ex: today).\n */\n public currentYear: boolean = false;\n\n /**\n * How many days away this day is from the current day (ex: today). If this\n * day is the current day the offset is 0. If this day is before the current\n * day it will be the negative number of days away. Otherwise this will be\n * positive meaning this day is after the current day by the given days.\n */\n public currentOffset: number = 0;\n\n /**\n * Whether this day is part of a selection on the calendar.\n */\n public selectedDay: boolean = false;\n\n /**\n * Whether this day is on the same week that the calendar selection is.\n */\n public selectedWeek: boolean = false;\n\n /**\n * Whether this day is on the same month that the calendar selection is.\n */\n public selectedMonth: boolean = false;\n\n /**\n * Whether this day is on the same year that the calendar selection is.\n */\n public selectedYear: boolean = false;\n\n /**\n * Whether this day is in the current calendar or not. Some days are outside\n * the calendar span and used to fill in weeks. Month calendars will fill in\n * days so the list of days in the calendar start on Sunday and end on Saturday.\n */\n public inCalendar: boolean = false;\n\n /**\n * The list of events on this day based on the settings and schedules in the\n * calendar.\n */\n public events: CalendarEvent[] = [];\n\n\n /**\n * Updates the current flags on this day given the current day (ex: today).\n *\n * @param current The current day of the calendar.\n */\n public updateCurrent(current: Day): this\n {\n this.currentDay = this.sameDay(current);\n this.currentWeek = this.sameWeek(current);\n this.currentMonth = this.sameMonth(current);\n this.currentYear = this.sameYear(current);\n this.currentOffset = this.daysBetween(current, Op.DOWN, false);\n\n return this;\n }\n\n /**\n * Updates the selection flags on this day given the selection range on the\n * calendar.\n *\n * @param selected The span of days selected on the calendar.\n */\n public updateSelected(selected: DaySpan): this\n {\n this.selectedDay = selected.matchesDay(this);\n this.selectedWeek = selected.matchesWeek(this);\n this.selectedMonth = selected.matchesMonth(this);\n this.selectedYear = selected.matchesYear(this);\n\n return this;\n }\n\n /**\n * Clears the selection flags on this day. This is done when the selection on\n * the calendar is cleared.\n */\n public clearSelected(): this\n {\n this.selectedDay = this.selectedWeek = this.selectedMonth = this.selectedYear = false;\n\n return this;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/CalendarDay.ts","\nimport { Constants } from './Constants';\nimport { Day } from './Day';\nimport { DaySpan, DaySpanBounds } from './DaySpan';\nimport { Event } from './Event';\nimport { Identifier, IdentifierInput } from './Identifier';\nimport { Schedule } from './Schedule';\n\n\n/**\n * An instance of an [[Event]] on a given day of a [[Calendar]] generated by\n * the event's [[Schedule]].\n *\n * @typeparam T The type of data stored in the [[Event]] class.\n * @typeparam M The type of metadata stored in the schedule and in this class.\n */\nexport class CalendarEvent\n{\n\n /**\n * The relatively unique identifier of this event. It is generated based on\n * the index of the schedule in the calendar and the time of day listed in the\n * schedule. This number will no longer be unique if the schedule has more\n * than [[Constants.MAX_EVENTS_PER_DAY]] occurrences in a single day\n * (based on number of times in [[Schedule.times]]).\n */\n public id: number;\n\n /**\n * The event with the schedule.\n */\n public event: Event;\n\n /**\n * Any metadata specified for this event instance in the schedule.\n */\n public meta: M;\n\n /**\n * The day this event occurs on.\n */\n public day: Day;\n\n /**\n * The span of time this event occurs. If this is an all day event this span\n * will start at the beginning of the day and end at the beginning of the\n * next day.\n *\n * @see [[Schedule.isFullDay]]\n */\n public time: DaySpan;\n\n /**\n * Whether this event is an all day event.\n *\n * @see [[Schedule.isFullDay]]\n */\n public fullDay: boolean;\n\n /**\n * Whether this event is the first day of an occurrence. A calendar can\n * generate multiple [[CalendarEvent]] instances over each day it covers if\n * [[Calendar.repeatCovers]] is true. These instances have matching\n * [[CalendarEvent.id]] values.\n */\n public starting: boolean;\n\n /**\n * Whether this event is the last day of an occurrence. A calendar can\n * generate multiple [[CalendarEvent]] instances over each day it covers if\n * [[Calendar.repeatCovers]] is true. These instances have matching\n * [[CalendarEvent.id]] values.\n */\n public ending: boolean;\n\n /**\n * Whether this event instance was marked as cancelled in the schedule.\n */\n public cancelled: boolean;\n\n /**\n * The row this event is on in a visual calendar. An event can span multiple\n * days and it is desirable to have the occurrence on each day to line up.\n * This is only set when [[Calendar.updateRows]] is true or manually set.\n * This value makes sense for visual calendars for all day events or when the\n * visual calendar is not positioning events based on their time span.\n */\n public row: number = 0;\n\n /**\n * The column this event is on in a visual calendar. An event can have its\n * time overlap with another event displaying one of the events in another\n * column. This is only set when [[Calendar.updateColumns]] is true or\n * manually set. This value makes sense for visual calendars that are\n * displaying event occurrences at specific times positioned accordingly.\n */\n public col: number = 0;\n\n\n /**\n * Creates a new event instance given the id, the event paired with the\n * schedule, the schedule, the time span of the event, and the day on the\n * calendar the event belongs to.\n *\n * @param id The relatively unique identifier of this event.\n * @param event The event which created this instance.\n * @param time The time span of this event.\n * @param actualDay The day on the calendar this event is for.\n */\n public constructor(id: number, event: Event, time: DaySpan, actualDay: Day)\n {\n this.id = id;\n this.event = event;\n this.time = time;\n this.day = actualDay;\n this.fullDay = event.schedule.isFullDay();\n this.meta = event.schedule.getMeta( time.start );\n this.cancelled = event.schedule.isCancelled( time.start );\n this.starting = time.isPoint || time.start.sameDay( actualDay );\n this.ending = time.isPoint || time.end.relative(-1).sameDay( actualDay );\n }\n\n /**\n * The id of the schedule uniqe within the calendar which generated this event.\n */\n public get scheduleId(): number\n {\n return Math.floor( this.id / Constants.MAX_EVENTS_PER_DAY );\n }\n\n /**\n * The start timestamp of the event.\n */\n public get start(): Day\n {\n return this.time.start;\n }\n\n /**\n * The end timestamp of the event.\n */\n public get end(): Day\n {\n return this.time.end;\n }\n\n /**\n * The schedule which generated this event.\n */\n public get schedule(): Schedule\n {\n return this.event.schedule;\n }\n\n /**\n * The related event data.\n */\n public get data(): T\n {\n return this.event.data;\n }\n\n /**\n * An [[IdentifierInput]] for the start of this event.\n */\n public get identifier(): IdentifierInput\n {\n return this.identifierType.get( this.start );\n }\n\n /**\n * The [[Identifier]] for this event. Either [[Identifier.Day]] or\n * [[Identifier.Time]].\n */\n public get identifierType(): Identifier\n {\n return this.schedule.identifierType;\n }\n\n /**\n * Returns a delta value between 0 and 1 which represents where the\n * [[CalendarEvent.start]] is relative to [[CalendarEvent.day]]. The delta\n * value would be less than 0 if the start of the event is before\n * [[CalendarEvent.day]].\n */\n public get startDelta(): number\n {\n return this.time.startDelta( this.day );\n }\n\n /**\n * Returns a delta value between 0 and 1 which represents where the\n * [[CalendarEvent.end]] is relative to [[CalendarEvent.day]]. The delta value\n * would be greater than 1 if the end of the event is after\n * [[CalendarEvent.day]].\n */\n public get endDelta(): number\n {\n return this.time.endDelta( this.day );\n }\n\n /**\n * Calculates the bounds for this event if it were placed in a rectangle which\n * represents a day (24 hour period). By default the returned values are\n * between 0 and 1 and can be scaled by the proper rectangle dimensions or the\n * rectangle dimensions can be passed to this function.\n *\n * @param dayHeight The height of the rectangle of the day.\n * @param dayWidth The width of the rectangle of the day.\n * @param columnOffset The offset in the rectangle of the day to adjust this\n * event by if it intersects or is contained in a previous event. This also\n * reduces the width of the returned bounds to keep the bounds in the\n * rectangle of the day.\n * @param clip `true` if the bounds should stay in the day rectangle, `false`\n * and the bounds may go outside the rectangle of the day for multi-day\n * events.\n * @param offsetX How much to translate the left & right properties by.\n * @param offsetY How much to translate the top & bottom properties by.\n * @returns The calculated bounds for this event.\n */\n public getTimeBounds(dayHeight: number = 1, dayWidth: number = 1, columnOffset: number = 0.1, clip: boolean = true, offsetX: number = 0, offsetY: number = 0): DaySpanBounds\n {\n return this.time.getBounds( this.day, dayHeight, dayWidth, this.col * columnOffset, clip, offsetX, offsetY );\n }\n\n /**\n * Changes the cancellation status of this event. By default this cancels\n * this event - but `false` may be passed to undo a cancellation.\n *\n * @param cancelled Whether the event should be cancelled.\n */\n public cancel(cancelled: boolean = true): this\n {\n this.schedule.setCancelled( this.start, cancelled );\n this.cancelled = cancelled;\n\n return this;\n }\n\n /**\n * Changes the exclusion status of this event. By default this excludes this\n * event - but `false` may be passed to undo an exclusion.\n *\n * @param excluded Whether the event should be excluded.\n */\n public exclude(excluded: boolean = true): this\n {\n this.schedule.setExcluded( this.start, excluded );\n\n return this;\n }\n\n /**\n * Moves this event to potentially another day and time. A move is\n * accomplished by excluding the current event and adding an inclusion of the\n * new day & time. Any [[CalendarEvent.meta]] on this event will be moved to\n * the new event. If the schedule represents a single event\n * ([[Schedule.isSingleEvent]]) then the schedule frequencies are updated\n * to match the timestamp provided.\n *\n * @param toTime The timestamp to move this event to.\n * @returns Whether the event was moved to the given time.\n */\n public move(toTime: Day): boolean\n {\n return this.schedule.move( toTime, this.start, this.meta );\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/CalendarEvent.ts","\nimport { Functions as fn } from './Functions';\nimport { Day, DayInput } from './Day';\nimport { DaySpan } from './DaySpan';\nimport { Schedule } from './Schedule';\nimport { EventInput, Event } from './Event';\nimport { Op } from './Operation';\nimport { Units } from './Units';\nimport { Parse } from './Parse';\nimport { SortEvent } from './Sort';\nimport { Constants } from './Constants';\nimport { CalendarDay } from './CalendarDay';\nimport { CalendarEvent } from './CalendarEvent';\nimport { Iterator, IteratorAction } from './Iterator';\n\n\n/**\n * A function which moves a given day by some amount and some unit. This is\n * used to shift a calendar's frame via [[Calendar.next]] and [[Calendar.prev]].\n *\n * @param day The day to move.\n * @param amount The amount to move the day by.\n * @returns A new day instance moved by the given amount.\n */\nexport type CalendarMover = (day: Day, amount: number) => Day;\n\n/**\n * A definition for a given [[Units]] which informs a calendar how to setup the\n * [[Calendar.span]] and how to move with [[Calendar.move]].\n */\nexport interface CalendarTypeDefinition\n{\n getStart(around: Day, size: number, focus: number): Day;\n getEnd(start: Day, size: number, focus: number): Day;\n moveStart(day: Day, amount: number): Day;\n moveEnd(day: Day, amount: number): Day;\n defaultInput: any\n}\n\n/**\n * A map of [[CalendarTypeDefinition]] keyed by the [[Units]].\n */\nexport type CalendarTypeDefinitionMap = { [unit: number]: CalendarTypeDefinition };\n\n/**\n * Input used to initialize or mass change the properties of a [[Calendar]].\n *\n * @typeparam T The type of data stored in the [[Event]] class.\n * @typeparam M The type of metadata stored in the schedule.\n */\nexport interface CalendarInput\n{\n\n /**\n * @see [[Calendar.fill]]\n */\n fill?: boolean;\n /**\n * @see [[Calendar.minimumSize]]\n */\n minimumSize?: number;\n /**\n * @see [[Calendar.repeatCovers]]\n */\n repeatCovers?: boolean;\n /**\n * @see [[Calendar.listTimes]]\n */\n listTimes?: boolean;\n /**\n * @see [[Calendar.eventsOutside]]\n */\n eventsOutside?: boolean;\n /**\n * @see [[Calendar.updateRows]]\n */\n updateRows?: boolean;\n /**\n * @see [[Calendar.updateColumns]]\n */\n updateColumns?: boolean;\n /**\n * @see [[Calendar.eventSorter]]\n */\n eventSorter?: SortEvent;\n /**\n * @see [[Calendar.events]]\n */\n events?: EventInput[];\n /**\n * @see [[Calendar.type]]\n */\n type?: Units;\n /**\n * @see [[Calendar.size]]\n */\n size?: number; // 1\n /**\n * @see [[Calendar.parseMeta]]\n */\n parseMeta?: (input: any) => M;\n /**\n * @see [[Calendar.parseData]]\n */\n parseData?: (input: any) => T;\n /**\n * When morphing a calendar to a fewer number of days, do we want to keep\n * today in the calendar if it is already in the calendar?\n */\n preferToday?: boolean; // true\n /**\n * What day should the calendar be based around (contain)?\n */\n around?: DayInput; // null\n /**\n * When morphing a calendar and `preferToday` is false OR today is not in the\n * calendar AND `around` is not specified, we will pick a day at this number\n * in the current calendar (a value between 0 and 1 signifying the start and\n * and of the current calendar).\n */\n otherwiseFocus?: number; // 0.499999\n /**\n * When morphing or creating passing a value of `true` will avoid calling\n * [[Calendar.refresh]] as is typically done right after each of those\n * functions.\n */\n delayRefresh?: boolean; // false\n}\n\n/**\n * A collection of [[CalendarDay]]s, the events on the calendar, and all\n * [[CalendarEvent]]s generated based on the events.\n *\n * @typeparam T The type of data stored in the [[Event]] class.\n * @typeparam M The type of metadata stored in the schedule.\n */\nexport class Calendar\n{\n\n /**\n * The span of days in the calendar.\n */\n public span: DaySpan;\n\n /**\n * The full span of days represented on the calendar. This may be different\n * than the [[Calendar.span]] when [[Calendar.fill]] is `true` and the\n * calendar is representing months or years and the days need to start on\n * Sunday and end on Saturday.\n */\n public filled: DaySpan;\n\n /**\n * The number of days in the calendar specified by [[Calendar.span]].\n */\n public length: number;\n\n /**\n * The type of calendar.\n */\n public type: Units;\n\n /**\n * The size of the calendar. When the calendar type is...\n *\n * - [[Units.DAY]]: The number of days in the calendar.\n * - [[Units.WEEK]]: The number of weeks in the calendar.\n * - [[Units.MONTH]]: The number of months in the calendar.\n * - [[Units.YEAR]]: The number of years in the calendar.\n */\n public size: number;\n\n /**\n * The function used to move the start day of the calendar when functions like\n * [[Calendar.next]] or [[Calendar.prev]] are called.\n */\n public moveStart: CalendarMover;\n\n /**\n * The function used to move the end day of the calendar when functions like\n * [[Calendar.next]] or [[Calendar.prev]] are called.\n */\n public moveEnd: CalendarMover;\n\n\n /**\n * If the calendar should be filled in so the first day of the calendar is\n * Sunday and the last day is Saturday.\n */\n public fill: boolean = false;\n\n /**\n * The minimum number of days in the calendar no matter what the type or size\n * is. This can be used to display a month with a constant number of weeks -\n * because not all months contain the same number of weeks.\n */\n public minimumSize: number = 0;\n\n /**\n * When `true` a [[CalendarEvent]] instance exists on each [[CalendarDay]]\n * the event covers even if the event didn't start on that day.\n */\n public repeatCovers: boolean = true;\n\n /**\n * When `true` an event instance will be created for each time specified on\n * the schedule. If the schedule specifies an all day event then only one\n * event is added to a day. This is typically done when displaying days or\n * weeks and events can be displayed on a timeline.\n */\n public listTimes: boolean = false;\n\n /**\n * When `true` events will be added to days \"outside\" the calendar. Days\n * outside the calendar are days filled in when [[Calendar.fill]] is `true`.\n * More specifically days that are in [[Calendar.filled]] and not in\n * [[Calendar.span]].\n */\n public eventsOutside: boolean = false;\n\n /**\n * When `true` [[CalendarEvent.row]] will be set so when visually displaying\n * the event with others multi-day events will align and not overlap.\n */\n public updateRows: boolean = false;\n\n /**\n * When `true` [[CalendarEvent.col]] will be set so when visually displaying\n * the event based on start and end time any events that overlap with each\n * other will be \"indented\" to see the event below it.\n */\n public updateColumns: boolean = false;\n\n /**\n * The function (if any) which sorts the events on a calendar day.\n */\n public eventSorter: SortEvent = null;\n\n /**\n * A function to use when parsing meta input into the desired type.\n *\n * @param input The input to parse.\n * @returns The meta parsed from the given input, if any.\n */\n public parseMeta: (input: any) => M = (x => x);\n\n /**\n * A function to use when parsing meta input into the desired type.\n *\n * @param input The input to parse.\n * @returns The meta parsed from the given input, if any.\n */\n public parseData: (input: any) => T = (x => x);\n\n /**\n * A selection of days on the calendar. If no days are selected this is `null`.\n * This is merely used to keep the selection flags in [[CalendarDay]] updated\n * via [[Calendar.refreshSelection]].\n */\n public selection: DaySpan = null;\n\n /**\n * The array of days in this calendar and their events.\n */\n public days: CalendarDay[] = [];\n\n /**\n * The array of scheduled events added to the calendar.\n */\n public events: Event[] = [];\n\n /**\n * The array of visible events on the calendar. This is built based on the\n * span of the schedule in the given event and also the [[Event.visible]] flag.\n */\n public visible: Event[] = [];\n\n\n /**\n * Creates a new calendar given a span, type, size, moving functions, and\n * optionally some default properties for the calendar.\n *\n * @param start The first day on the calendar.\n * @param end The last day on the calendar.\n * @param type The calendar type used for describing the calendar and splitting it.\n * @param size The number of calendar types in this calendar.\n * @param moveStart The function to move the start day.\n * @param moveEnd The function to move the end by.\n * @param input The default properties for this calendar.\n * @see [[Calendar.start]]\n * @see [[Calendar.end]]\n * @see [[Calendar.type]]\n * @see [[Calendar.size]]\n * @see [[Calendar.moveStart]]\n * @see [[Calendar.moveEnd]]\n */\n public constructor(start: Day, end: Day, type: Units, size: number, moveStart: CalendarMover, moveEnd: CalendarMover, input?: CalendarInput)\n {\n this.span = new DaySpan(start, end);\n this.filled = new DaySpan(start, end);\n this.type = type;\n this.size = size;\n this.moveStart = moveStart;\n this.moveEnd = moveEnd;\n\n if (fn.isDefined(input))\n {\n this.set( input );\n }\n else\n {\n this.refresh();\n }\n }\n\n /**\n * Changes the calendar possibly morphing it to a different type or size if\n * specified in the given input. If the type and size are not morphed then\n * the following properties may be updated:\n *\n * - [[Calendar.fill]]\n * - [[Calendar.minimumSize]]\n * - [[Calendar.repeatCovers]]\n * - [[Calendar.listTimes]]\n * - [[Calendar.eventsOutside]]\n * - [[Calendar.updateRows]]\n * - [[Calendar.updateColumns]]\n * - [[Calendar.eventSorter]]\n * - [[Calendar.events]]\n * - [[Calendar.parseData]]\n * - [[Calendar.parseMeta]]\n *\n * If [[CalendarInput.delayRefresh]] is not given with `true` then\n * [[Calendar.refresh]] will be called once the calendar properties have been\n * updated.\n *\n * @param input The new properties for this calendar to overwrite with.\n */\n public set(input: CalendarInput): this\n {\n type CTD = CalendarTypeDefinition;\n\n let typeChange: boolean = fn.isDefined(input.type) && input.type !== this.type;\n let sizeChange: boolean = fn.isDefined(input.size) && input.size !== this.size;\n\n if (typeChange || sizeChange)\n {\n let focus: number = fn.coalesce( input.otherwiseFocus, 0.4999 );\n let prefer: boolean = fn.coalesce( input.preferToday, true );\n let size: number = fn.coalesce( input.size, this.size );\n let type: Units = fn.coalesce( input.type, this.type );\n let around: DayInput = fn.coalesce( input.around, this.days[ Math.floor( (this.days.length - 1) * focus ) ] );\n let today: Day = Day.today();\n\n if (!around || (prefer && this.span.matchesDay(today)))\n {\n around = today;\n }\n\n let meta: CTD = Calendar.TYPES[ type ];\n let start: Day = meta.getStart( Day.parse( around ), size, focus );\n let end: Day = meta.getEnd( start, size, focus );\n\n this.span.start = start;\n this.span.end = end;\n this.type = type;\n this.size = size;\n this.moveStart = meta.moveStart;\n this.moveEnd = meta.moveEnd;\n }\n else if (input.around)\n {\n let focus: number = fn.coalesce( input.otherwiseFocus, 0.4999 );\n let around: Day = Day.parse( input.around );\n let type: Units = this.type;\n let size: number = this.size;\n let meta: CTD = Calendar.TYPES[ type ];\n let start: Day = meta.getStart( around, size, focus );\n let end: Day = meta.getEnd( start, size, focus );\n\n this.span.start = start;\n this.span.end = end;\n }\n\n this.fill = fn.coalesce( input.fill, this.fill );\n this.minimumSize = fn.coalesce( input.minimumSize, this.minimumSize );\n this.repeatCovers = fn.coalesce( input.repeatCovers, this.repeatCovers );\n this.listTimes = fn.coalesce( input.listTimes, this.listTimes );\n this.eventsOutside = fn.coalesce( input.eventsOutside, this.eventsOutside );\n this.updateRows = fn.coalesce( input.updateRows, this.updateRows );\n this.updateColumns = fn.coalesce( input.updateColumns, this.updateColumns );\n this.eventSorter = fn.coalesce( input.eventSorter, this.eventSorter );\n this.parseMeta = fn.coalesce( input.parseMeta, this.parseMeta );\n this.parseData = fn.coalesce( input.parseData, this.parseData );\n\n if (fn.isArray(input.events))\n {\n this.removeEvents();\n this.addEvents(input.events, false, true);\n }\n\n if (!input.delayRefresh)\n {\n this.refresh();\n }\n\n return this;\n }\n\n /**\n * Sets the [[Calendar.minimumSize]] value and returns `this` for method\n * chaining.\n *\n * @param minimumSize The new value.\n */\n public withMinimumSize(minimumSize: number): this\n {\n this.minimumSize = minimumSize;\n this.refresh();\n\n return this;\n }\n\n /**\n * Sets the [[Calendar.repeatCovers]] value and returns `this` for method\n * chaining.\n *\n * @param repeatCovers The new value.\n */\n public withRepeatCovers(repeatCovers: boolean): this\n {\n this.repeatCovers = repeatCovers;\n this.refreshEvents();\n\n return this;\n }\n\n /**\n * Sets the [[Calendar.listTimes]] value and returns `this` for method\n * chaining.\n *\n * @param listTimes The new value.\n */\n public withListTimes(listTimes: boolean): this\n {\n this.listTimes = listTimes;\n this.refreshEvents();\n\n return this;\n }\n\n /**\n * Sets the [[Calendar.eventsOutside]] value and returns `this` for method\n * chaining.\n *\n * @param eventsOutside The new value.\n */\n public withEventsOutside(eventsOutside: boolean): this\n {\n this.eventsOutside = eventsOutside;\n this.refreshEvents();\n\n return this;\n }\n\n /**\n * Sets the [[Calendar.updateRows]] value and returns `this` for method\n * chaining.\n *\n * @param updateRows The new value.\n * @param refresh If the rows should be updated now if `updateRows` is `true`.\n */\n public withUpdateRows(updateRows: boolean, refresh: boolean = true): this\n {\n this.updateRows = updateRows;\n\n if (refresh && updateRows)\n {\n this.refreshRows();\n }\n\n return this;\n }\n\n /**\n * Sets the [[Calendar.updateColumns]] value and returns `this` for method\n * chaining.\n *\n * @param updateColumns The new value.\n * @param refresh If the columns should be updated now if `updateColumns` is\n * `true`.\n */\n public withUpdateColumns(updateColumns: boolean, refresh: boolean = true): this\n {\n this.updateColumns = updateColumns;\n\n if (refresh && updateColumns)\n {\n this.refreshColumns();\n }\n\n return this;\n }\n\n /**\n * Returns the start day of the calendar. If this calendar is filled, this\n * may not represent the very first day in the calendar.\n */\n public get start(): Day\n {\n return this.span.start;\n }\n\n /**\n * Returns the end day of the calendar. If this calendar is filled, this\n * may not represent the very last day in the calendar.\n */\n public get end(): Day\n {\n return this.span.end;\n }\n\n /**\n * Returns the summary of the span of time this calendar represents.\n *\n * @param dayOfWeek [[DaySpan.summary]]\n * @param short [[DaySpan.summary]]\n * @param repeat [[DaySpan.summary]]\n * @param contextual [[DaySpan.summary]]\n * @param delimiter [[DaySpan.summary]]\n * @see [[DaySpan.summary]]\n */\n public summary(dayOfWeek: boolean = true, short: boolean = false, repeat: boolean = false, contextual: boolean = true, delimiter: string = ' - '): string\n {\n return this.span.summary( this.type, dayOfWeek, short, repeat, contextual, delimiter );\n }\n\n /**\n * Splits up this calendar into an iterable collection of calendars. The\n * resulting iterator will return `size / by` number of calendars.\n *\n * @param by The new size of the resulting calendars. If the the size of the\n * current calendar is not divisible by this value the resulting calendars\n * may cover more or less than this calendar covers.\n * @returns An iterator for the calendars produced.\n */\n public split(by: number = 1): Iterator>\n {\n return new Iterator>(iterator =>\n {\n let start: Day = this.start;\n let end: Day = this.moveEnd( this.end, by - this.size );\n\n for (let i = 0; i < this.size; i++)\n {\n let calendar = new Calendar(start, end, this.type, by, this.moveStart, this.moveEnd, this);\n\n if (iterator.act(calendar) === IteratorAction.Stop)\n {\n return;\n }\n\n start = this.moveStart( start, by );\n end = this.moveEnd( end, by );\n }\n });\n }\n\n /**\n * Refreshes the days and events in this calendar based on the start and end\n * days, the calendar properties, and its eventss.\n *\n * @param today The current day to update the calendar days via\n * [[CalendarDay.updateCurrent]].\n */\n public refresh(today: Day = Day.today()): this\n {\n this.length = this.span.days(Op.UP, true);\n this.resetDays();\n this.refreshCurrent(today);\n this.refreshSelection();\n this.refreshVisible();\n this.refreshEvents();\n\n return this;\n }\n\n /**\n * Updates the [[Calendar.filled]] span based on [[Calendar.start]],\n * [[Calendar.end]], and [[Calendar.fill]] properties.\n */\n public resetFilled(): this\n {\n this.filled.start = this.fill ? this.start.startOfWeek() : this.start;\n this.filled.end = this.fill ? this.end.endOfWeek() : this.end;\n\n return this;\n }\n\n /**\n * Updates [[Calendar.days]] to match the span of days in the calendar.\n */\n public resetDays(): this\n {\n this.resetFilled();\n\n let days: CalendarDay[] = this.days;\n let filled: DaySpan = this.filled;\n let current: Day = filled.start;\n let daysBetween: number = filled.days(Op.UP);\n let total: number = Math.max( this.minimumSize, daysBetween );\n\n for (let i = 0; i < total; i++)\n {\n let day: CalendarDay = days[ i ];\n\n if (!day || !day.sameDay( current ))\n {\n day = new CalendarDay( current.date );\n\n if (i < days.length)\n {\n days.splice( i, 1, day );\n }\n else\n {\n days.push( day );\n }\n }\n\n day.inCalendar = this.span.contains( day );\n\n current = current.next();\n }\n\n if (days.length > total)\n {\n days.splice( total, days.length - total );\n }\n\n return this;\n }\n\n /**\n * Updates the list of visible schedules.\n */\n public refreshVisible(): this\n {\n let start: Day = this.filled.start;\n let end: Day = this.filled.end;\n\n this.visible = this.events.filter(e =>\n {\n return e.visible && e.schedule.matchesRange(start, end);\n });\n\n return this;\n }\n\n /**\n * Updates the days with the current day via [[CalendarDay.updateCurrent]].\n *\n * @param today The new current day.\n */\n public refreshCurrent(today: Day = Day.today()): this\n {\n this.iterateDays().iterate(d =>\n {\n d.updateCurrent(today);\n });\n\n return this;\n }\n\n /**\n * Updates the selection flags in [[CalendarDay]] based on the\n * [[Calendar.selection]] property.\n */\n public refreshSelection(): this\n {\n this.iterateDays().iterate(d =>\n {\n if (this.selection)\n {\n d.updateSelected( this.selection );\n }\n else\n {\n d.clearSelected();\n }\n });\n\n return this;\n }\n\n /**\n * Updates the [[CalendarDay.events]] based on the events in this calendar\n * and the following properties:\n *\n * - [[Calendar.eventsForDay]]\n * - [[Calendar.eventsOutside]]\n * - [[Calendar.listTimes]]\n * - [[Calendar.repeatCovers]]\n * - [[Calendar.updateRows]]\n * - [[Calendar.updateColumns]]\n */\n public refreshEvents(): this\n {\n this.iterateDays().iterate(d =>\n {\n if (d.inCalendar || this.eventsOutside)\n {\n d.events = this.eventsForDay(d, this.listTimes, this.repeatCovers);\n }\n });\n\n if (this.updateRows)\n {\n this.refreshRows();\n }\n\n if (this.updateColumns)\n {\n this.refreshColumns();\n }\n\n return this;\n }\n\n /**\n * Refreshes the [[CalendarEvent.row]] property as described in the link.\n */\n public refreshRows(): this\n {\n type EventToRowMap = { [id: number]: number };\n type UsedMap = { [row: number]: boolean };\n\n let eventToRow: EventToRowMap = {};\n let onlyFullDay: boolean = this.listTimes;\n\n this.iterateDays().iterate(d =>\n {\n if (d.dayOfWeek === 0)\n {\n eventToRow = {};\n }\n\n let used: UsedMap = {};\n\n for (let event of d.events)\n {\n if (onlyFullDay && !event.fullDay)\n {\n continue;\n }\n\n if (event.id in eventToRow)\n {\n used[ event.row = eventToRow[ event.id ] ] = true;\n }\n }\n\n let rowIndex: number = 0;\n\n for (let event of d.events)\n {\n if ((onlyFullDay && !event.fullDay) || event.id in eventToRow)\n {\n continue;\n }\n\n while (used[ rowIndex ])\n {\n rowIndex++;\n }\n\n eventToRow[ event.id ] = event.row = rowIndex;\n\n rowIndex++;\n }\n });\n\n return this;\n }\n\n /**\n * Refreshes the [[CalendarEvent.col]] property as described in the link.\n */\n public refreshColumns(): this\n {\n interface Marker {\n time: number,\n event: CalendarEvent,\n start: boolean,\n parent: Marker;\n }\n\n this.iterateDays().iterate(d =>\n {\n let markers: Marker[] = [];\n\n for (let event of d.events)\n {\n if (!event.fullDay)\n {\n markers.push({\n time: event.time.start.time,\n event: event,\n start: true,\n parent: null\n });\n\n markers.push({\n time: event.time.end.time - 1,\n event: event,\n start: false,\n parent: null\n });\n }\n }\n\n markers.sort((a, b) =>\n {\n return a.time - b.time;\n });\n\n let parent = null;\n\n for (let marker of markers)\n {\n if (marker.start)\n {\n marker.parent = parent;\n parent = marker;\n }\n else if (parent)\n {\n parent = parent.parent;\n }\n }\n\n for (let marker of markers)\n {\n if (marker.start)\n {\n marker.event.col = marker.parent ? marker.parent.event.col + 1 : 0;\n }\n }\n });\n\n return this;\n }\n\n /**\n * Iterates over all days in this calendar and passes each day to `iterator`.\n *\n * @param iterator The function to pass [[CalendarDay]]s to.\n */\n public iterateDays(): Iterator>\n {\n return new Iterator>(iterator =>\n {\n let days: CalendarDay[] = this.days;\n\n for (let i = 0; i < days.length; i++)\n {\n switch (iterator.act(days[ i ]))\n {\n case IteratorAction.Stop:\n return;\n }\n }\n });\n }\n\n /**\n * Returns the events for the given day optionally looking at schedule times,\n * optionally looking at events which cover multiple days, and optionally\n * sorted with the given function.\n *\n * @param day The day to find events for.\n * @param getTimes When `true` an event is added to the result for each time\n * specified in the schedule.\n * @param covers When `true` events which don't start on the given day but do\n * overlap are added to the result.\n * @param sorter The function to sort the events by, if any.\n * @returns An array of events that occurred on the given day.\n */\n public eventsForDay(day: Day, getTimes: boolean = true, covers: boolean = true, sorter: SortEvent = this.eventSorter): CalendarEvent[]\n {\n let events: CalendarEvent[] = [];\n let entries: Event[] = this.visible;\n\n for (let entryIndex = 0; entryIndex < entries.length; entryIndex++)\n {\n let entry: Event = entries[ entryIndex ];\n let schedule: Schedule = entry.schedule;\n let eventId: number = entryIndex * Constants.MAX_EVENTS_PER_DAY;\n let timeIndex: number = 0;\n\n schedule.iterateSpans( day, covers ).iterate((span, iterator) =>\n {\n events.push(new CalendarEvent(eventId + timeIndex++, entry, span, day));\n\n if (!getTimes)\n {\n iterator.stop();\n }\n });\n }\n\n if (sorter)\n {\n events.sort( sorter );\n }\n\n return events\n }\n\n /**\n * Finds the event given one of the ways to identify the event.\n *\n * @param input The value to use to search for an event.\n * @returns The refrence to the event or null if not found.\n */\n public findEvent(id: any): Event\n {\n for (let event of this.events)\n {\n if (event === id || event.schedule === id || event.data === id || event.id === id)\n {\n return event;\n }\n }\n\n return null;\n }\n\n /**\n * Removes the list of events if they exist in the calendar.\n *\n * @param events The array of events to remove if they exist. If no\n * events are passed (via `null`) then all events will be removed\n * from the calendar.\n * @param delayRefresh When `true` the [[Calendar.refreshEvents]] will not be\n * called after the events are removed.\n * @see [[Calendar.removeEvent]]\n * @see [[Calendar.refreshEvents]]\n */\n public removeEvents(events: any[] = null, delayRefresh: boolean = false): this\n {\n if (events)\n {\n for (let event of events)\n {\n this.removeEvent( event, true );\n }\n }\n else\n {\n this.events = [];\n }\n\n this.refreshVisible();\n\n if (!delayRefresh)\n {\n this.refreshEvents();\n }\n\n return this;\n }\n\n /**\n * Removes the given event if it exists on the calendar.\n *\n * @param event The event to remove if it exists.\n * @param delayRefresh When `true` the [[Calendar.refreshEvents]] will not be\n * called after the event is removed.\n * @see [[Calendar.refreshEvents]]\n */\n public removeEvent(event: any, delayRefresh: boolean = false): this\n {\n let found: Event = this.findEvent(event);\n\n if (found)\n {\n this.events.splice( this.events.indexOf(found), 1 );\n\n this.refreshVisible();\n\n if (!delayRefresh)\n {\n this.refreshEvents();\n }\n }\n\n return this;\n }\n\n /**\n * Adds the given event to this calendar if it doesn't exist already (or\n * `allowDuplicates` is `true`).\n *\n * @param event The event to add to the calendar.\n * @param allowDuplicates If an event can be added more than once.\n * @param delayRefresh When `true` the [[Calendar.refreshEvents]] will not be\n * called after the event is added.\n * @see [[Calendar.refreshEvents]]\n */\n public addEvent(event: EventInput, allowDuplicates: boolean = false, delayRefresh: boolean = false): this\n {\n let parsed: Event = Parse.event(event, this.parseData, this.parseMeta);\n\n if (!allowDuplicates)\n {\n let existing = this.findEvent(parsed);\n\n if (existing)\n {\n return this;\n }\n }\n\n this.events.push(parsed);\n\n this.refreshVisible();\n\n if (!delayRefresh)\n {\n this.refreshEvents();\n }\n\n return this;\n }\n\n /**\n * Adds the given events to this calendar if they don't exist already (or\n * `allowDuplicates` is `true`).\n *\n * @param events The events to add to the calendar.\n * @param allowDuplicates If an event can be added more than once.\n * @param delayRefresh When `true` the [[Calendar.refreshEvents]] will not be\n * called after the events are added.\n * @see [[Calendar.refreshEvents]]\n */\n public addEvents(events: EventInput[], allowDuplicates: boolean = false, delayRefresh: boolean = false): this\n {\n for (let event of events)\n {\n this.addEvent(event, allowDuplicates, true);\n }\n\n if (!delayRefresh)\n {\n this.refreshEvents();\n }\n\n return this;\n }\n\n /**\n * Sets the selection point or range of the calendar and updates the flags\n * in the days.\n *\n * @param start The start of the selection.\n * @param end The end of the selection.\n * @see [[Calendar.refreshSelection]]\n */\n public select(start: Day, end: Day = start): this\n {\n this.selection = new DaySpan( start, end );\n this.refreshSelection();\n\n return this;\n }\n\n /**\n * Sets the selection of the calendar to nothing.\n *\n * @see [[Calendar.refreshSelection]]\n */\n public unselect(): this\n {\n this.selection = null;\n this.refreshSelection();\n\n return this;\n }\n\n /**\n * Shifts the calendar days by the given amount.\n *\n * @param jump The amount to shift the calendar by.\n * @param delayRefresh When `true` [[Calendar.refresh]] will not be called\n * after calendar is moved.\n */\n public move(jump: number = this.size, delayRefresh: boolean = false): this\n {\n this.span.start = this.moveStart( this.start, jump );\n this.span.end = this.moveEnd( this.end, jump );\n\n if (!delayRefresh)\n {\n this.refresh();\n }\n\n return this;\n }\n\n /**\n * Moves the calenndar to the next set of days.\n *\n * @param jump The amount to shift the calendar by.\n * @param delayRefresh When `true` [[Calendar.refresh]] will not be called\n * after calendar is moved.\n */\n public next(jump: number = this.size, delayRefresh: boolean = false): this\n {\n return this.move( jump, delayRefresh );\n }\n\n /**\n * Moves the calenndar to the previous set of days.\n *\n * @param jump The amount to shift the calendar by.\n * @param delayRefresh When `true` [[Calendar.refresh]] will not be called\n * after calendar is moved.\n */\n public prev(jump: number = this.size, delayRefresh: boolean = false): this\n {\n return this.move( -jump, delayRefresh );\n }\n\n /**\n * Converts this calendar to input which can be used to later recreate this\n * calendar. The only properties of the calendar which will be loss is the\n * [[Calendar.eventSorter]] property because it is a function.\n *\n * @param plain If the returned input should be plain objects as opposed\n * to [[Day]] and [[Event]] instances.\n * @param plainData A function to convert [[Event.data]] to a plain object if\n * it is not already.\n * @param plainMeta A function to convert values in [[Schedule.meta]] to plain\n * objects if they are not alreday.\n * @returns The input generated from this calendar.\n */\n public toInput(plain: boolean = false,\n plainData: (data: T) => any = d => d,\n plainMeta: (meta: M) => any = m => m): CalendarInput\n {\n let out: CalendarInput = {};\n\n out.type = this.type;\n out.size = this.size;\n out.fill = this.fill;\n out.minimumSize = this.minimumSize;\n out.repeatCovers = this.repeatCovers;\n out.listTimes = this.listTimes;\n out.eventsOutside = this.eventsOutside;\n out.updateRows = this.updateRows;\n out.updateColumns = this.updateColumns;\n out.around = plain ? this.span.start.dayIdentifier : this.span.start;\n out.events = [];\n\n for (let event of this.events)\n {\n if (plain)\n {\n let plainEvent: any = {};\n\n if (fn.isDefined(event.id))\n {\n plainEvent.id = event.id;\n }\n\n if (fn.isDefined(event.data))\n {\n plainEvent.data = plainData( event.data );\n }\n\n if (!event.visible)\n {\n plainEvent.visible = event.visible;\n }\n\n plainEvent.schedule = event.schedule.toInput();\n\n let meta = plainEvent.schedule.meta;\n\n if (meta)\n {\n for (let identifier in meta)\n {\n meta[ identifier ] = plainMeta( meta[ identifier ] );\n }\n }\n\n out.events.push( plainEvent );\n }\n else\n {\n out.events.push( event );\n }\n }\n\n return out;\n }\n\n /**\n * Creates a calendar based on the given input.\n *\n * @param input The input which has at least the `type` specified.\n * @returns A new calendar instance.\n */\n public static fromInput(input: CalendarInput): Calendar\n {\n let initial: Day = Day.today();\n\n return new Calendar(initial, initial, null, 1, null, null, input);\n }\n\n /**\n * Creates a calendar based around a given unit optionally focused around a\n * given day.\n *\n * @param type The unit of the calendar.\n * @param days The number of units in the calendar.\n * @param around The day to focus the calendar on.\n * @param focus The value which describes how months are added around the given\n * day. The default value will center the calendar around the given day.\n * When the value is `0` the given day is the first day in the calendar,\n * and when the value is `1` the given day is the last day in the calendar.\n * @param input The default properties for the calendar.\n * @returns A new calendar instance.\n */\n public static forType(type: Units, size: number = 1, around: Day = Day.today(), focus: number = 0.49999, input?: CalendarInput): Calendar\n {\n let meta: CalendarTypeDefinition = this.TYPES[ type ];\n let start: Day = meta.getStart( around, size, focus );\n let end: Day = meta.getEnd( start, size, focus );\n\n return new Calendar(start, end, type, size, meta.moveStart, meta.moveEnd, input || meta.defaultInput);\n }\n\n\n /**\n * Creates a calendar based around days optionally focused around a given day.\n *\n * @param days The number of days in the calendar.\n * @param around The day to focus the calendar on.\n * @param focus The value which describes how days are added around the given\n * day. The default value will center the calendar around the given day.\n * When the value is `0` the given day is the first day in the calendar,\n * and when the value is `1` the given day is the last day in the calendar.\n * @param input The default properties for the calendar.\n * @returns A new calendar instance.\n * @see [[Calendar.forType]]\n */\n public static days(days: number = 1, around: Day = Day.today(), focus: number = 0.4999, input?: CalendarInput): Calendar\n {\n return this.forType( Units.DAY, days, around, focus, input );\n }\n\n /**\n * Creates a calendar based around weeks optionally focused around a given day.\n *\n * @param days The number of weeks in the calendar.\n * @param around The day to focus the calendar on.\n * @param focus The value which describes how weeks are added around the given\n * day. The default value will center the calendar around the given day.\n * When the value is `0` the given day is the first day in the calendar,\n * and when the value is `1` the given day is the last day in the calendar.\n * @param input The default properties for the calendar.\n * @returns A new calendar instance.\n * @see [[Calendar.forType]]\n */\n public static weeks(weeks: number = 1, around: Day = Day.today(), focus: number = 0.4999, input?: CalendarInput): Calendar\n {\n return this.forType( Units.WEEK, weeks, around, focus, input );\n }\n\n /**\n * Creates a calendar based around months optionally focused around a given day.\n *\n * @param days The number of months in the calendar.\n * @param around The day to focus the calendar on.\n * @param focus The value which describes how months are added around the given\n * day. The default value will center the calendar around the given day.\n * When the value is `0` the given day is the first day in the calendar,\n * and when the value is `1` the given day is the last day in the calendar.\n * @param input The default properties for the calendar.\n * @returns A new calendar instance.\n * @see [[Calendar.forType]]\n */\n public static months(months: number = 1, around: Day = Day.today(), focus: number = 0.4999, input?: CalendarInput): Calendar\n {\n return this.forType( Units.MONTH, months, around, focus, input );\n }\n\n /**\n * Creates a calendar based around years optionally focused around a given day.\n *\n * @param days The number of years in the calendar.\n * @param around The day to focus the calendar on.\n * @param focus The value which describes how years are added around the given\n * day. The default value will center the calendar around the given day.\n * When the value is `0` the given day is the first day in the calendar,\n * and when the value is `1` the given day is the last day in the calendar.\n * @param input The default properties for the calendar.\n * @returns A new calendar instance.\n * @see [[Calendar.forType]]\n */\n public static years(years: number = 1, around: Day = Day.today(), focus: number = 0.4999, input?: CalendarInput): Calendar\n {\n return this.forType( Units.YEAR, years, around, focus, input );\n }\n\n /**\n * A map of functions and properties by [[Units]] used to create or morph\n * Calendars.\n */\n public static TYPES: CalendarTypeDefinitionMap =\n {\n [Units.DAY]:\n {\n getStart(around: Day, size: number, focus: number): Day {\n return around.start().relativeDays( -Math.floor( size * focus ) )\n },\n getEnd(start: Day, size: number, focus: number): Day {\n return start.relativeDays( size - 1 ).end();\n },\n moveStart(day: Day, amount: number): Day {\n return day.relativeDays(amount);\n },\n moveEnd(day: Day, amount: number): Day {\n return day.relativeDays(amount);\n },\n defaultInput: undefined\n },\n [Units.WEEK]:\n {\n getStart(around: Day, size: number, focus: number): Day {\n return around.start().startOfWeek().relativeWeeks( -Math.floor( size * focus ) );\n },\n getEnd(start: Day, size: number, focus: number): Day {\n return start.relativeWeeks( size - 1 ).endOfWeek();\n },\n moveStart(day: Day, amount: number): Day {\n return day.relativeWeeks(amount);\n },\n moveEnd(day: Day, amount: number): Day {\n return day.relativeWeeks(amount);\n },\n defaultInput: undefined\n },\n [Units.MONTH]:\n {\n getStart(around: Day, size: number, focus: number): Day {\n return around.start().startOfMonth().relativeMonths( -Math.floor( size * focus ) );\n },\n getEnd(start: Day, size: number, focus: number): Day {\n return start.relativeMonths( size - 1 ).endOfMonth();\n },\n moveStart(day: Day, amount: number): Day {\n return day.relativeMonths(amount);\n },\n moveEnd(day: Day, amount: number): Day {\n return day.startOfMonth().relativeMonths(amount).endOfMonth();\n },\n defaultInput: { fill: true }\n },\n [Units.YEAR]:\n {\n getStart(around: Day, size: number, focus: number): Day {\n return around.start().startOfYear().relativeYears( -Math.floor( size * focus ) );\n },\n getEnd(start: Day, size: number, focus: number): Day {\n return start.relativeYears( size - 1 ).endOfYear();\n },\n moveStart(day: Day, amount: number): Day {\n return day.relativeYears(amount);\n },\n moveEnd(day: Day, amount: number): Day {\n return day.relativeYears(amount);\n },\n defaultInput: { fill: true }\n }\n };\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Calendar.ts","\n/**\n * The months in a year.\n */\nexport class Month\n{\n\n public static JANUARY: number = 0;\n public static FEBRUARY: number = 1;\n public static MARCH: number = 2;\n public static APRIL: number = 3;\n public static MAY: number = 4;\n public static JUNE: number = 5;\n public static JULY: number = 6;\n public static AUGUST: number = 7;\n public static SEPTEMBER: number = 8;\n public static OCTOBER: number = 9;\n public static NOVEMBER: number = 10;\n public static DECEMBER: number = 11;\n\n /**\n * The full list of months in a year.\n */\n public static LIST: number[] = [\n Month.JANUARY,\n Month.FEBRUARY,\n Month.MARCH,\n Month.APRIL,\n Month.MAY,\n Month.JUNE,\n Month.JULY,\n Month.AUGUST,\n Month.SEPTEMBER,\n Month.OCTOBER,\n Month.NOVEMBER,\n Month.DECEMBER\n ];\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Month.ts","\n\n/**\n * The days in a week.\n */\nexport class Weekday\n{\n\n public static SUNDAY: number = 0;\n public static MONDAY: number = 1;\n public static TUESDAY: number = 2;\n public static WEDNESDAY: number = 3;\n public static THURSDAY: number = 4;\n public static FRIDAY: number = 5;\n public static SATURDAY: number = 6;\n\n /**\n * The full list of days in a week.\n */\n public static LIST: number[] = [\n Weekday.SUNDAY,\n Weekday.MONDAY,\n Weekday.TUESDAY,\n Weekday.WEDNESDAY,\n Weekday.THURSDAY,\n Weekday.FRIDAY,\n Weekday.SATURDAY\n ];\n\n /**\n * The list of days starting with Monday and ending on Friday.\n */\n public static WEEK: number[] = [\n Weekday.MONDAY,\n Weekday.TUESDAY,\n Weekday.WEDNESDAY,\n Weekday.THURSDAY,\n Weekday.FRIDAY\n ];\n\n /**\n * The days on the weekend, starting with Saturday and ending with Sunday.\n */\n public static ENDS: number[] = [\n Weekday.SATURDAY,\n Weekday.SUNDAY\n ];\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Weekday.ts","\nimport { Functions as fn } from './Functions';\nimport { Day, DayProperty } from './Day';\nimport { Suffix } from './Suffix';\nimport { Weekday } from './Weekday';\nimport { FrequencyValueEvery, FrequencyValue } from './Frequency';\nimport { Schedule, ScheduleInput } from './Schedule';\n\n\n/**\n * Describes a [[Pattern]] given a [[Day]] to base it on.\n *\n * @param day The day to base the description on.\n * @returns The description of the pattern.\n */\nexport type DescribePattern = (day: Day) => string;\n\n/**\n * A rule helps parse [[ScheduleInput]] and determines whether it matches the\n * given pattern.\n *\n * - When a number is given, the input MUST be an array of the same length and contain any values.\n * - When an array of numbers is given, the input MUST be an array containing the same values.\n * - When a TRUE is given the input MUST contain that property and can be any value.\n * - When a FALSE is given the input MAY contain that property (optional).\n * - When a property is NOT specified, the input MUST NOT contain that property.\n * - When an object with every is given, the input must match the every and offset values (have the same frequency).\n */\nexport type PatternRule =\n number | // has array with this number of elements\n number[] | // is array with same values\n boolean | // is true or false\n FrequencyValueEvery; // is object with matching every and offset\n\n/**\n * The set of rules you can specify for determining if a [[ScheduleInput]]\n * matches a pattern.\n */\nexport interface PatternRules\n{\n dayOfWeek?: PatternRule;\n dayOfMonth?: PatternRule;\n lastDayOfMonth?: PatternRule;\n dayOfYear?: PatternRule;\n month?: PatternRule;\n week?: PatternRule;\n year?: PatternRule;\n weekOfYear?: PatternRule;\n weekspanOfYear?: PatternRule;\n fullWeekOfYear?: PatternRule;\n lastWeekspanOfYear?: PatternRule;\n lastFullWeekOfYear?: PatternRule;\n weekOfMonth?: PatternRule;\n weekspanOfMonth?: PatternRule;\n fullWeekOfMonth?: PatternRule;\n lastWeekspanOfMonth?: PatternRule;\n lastFullWeekOfMonth?: PatternRule;\n}\n\n\n/**\n * A class which helps describe [[ScheduleInput]] if it matches a pattern.\n */\nexport class Pattern\n{\n\n /**\n * The properties in the [[ScheduleInput]] which are compared against the\n * rules of a pattern.\n */\n public static PROPS: DayProperty[] =\n [\n 'dayOfWeek', 'dayOfMonth', 'lastDayOfMonth', 'dayOfYear',\n 'month', 'week', 'year',\n 'weekOfYear', 'weekspanOfYear', 'fullWeekOfYear', 'lastWeekspanOfYear', 'lastFullWeekOfYear',\n 'weekOfMonth', 'weekspanOfMonth', 'fullWeekOfMonth', 'lastWeekspanOfMonth', 'lastFullWeekOfMonth'\n ];\n\n /**\n * Whether this pattern should be \"listed\" or not. Visual schedulers may\n * provide a shortcut to describing and changing a [[Schedule]] through\n * patterns and any pattern where listed is `true` could be an option in a\n * list. The default patterns are all listed.\n */\n public listed: boolean;\n\n /**\n * The function which describes this pattern given a [[Day]] to base it on.\n */\n public describe: DescribePattern;\n\n /**\n * The name of this pattern. This is not typically displayed to a user, just\n * to uniquely identify a pattern.\n */\n public name: string;\n\n /**\n * The rules for matching a pattern to a [[Schedule]] or applying a pattern to\n * a schedule.\n */\n public rules: PatternRules;\n\n\n /**\n * Creates a new pattern.\n *\n * @param name The unique name of the pattern.\n * @param listed If the pattern is \"listed\" [[Pattern.listed]].\n * @param describe A function to describe the pattern given a [[Day]].\n * @param rules The rules which describe how to detect and apply the pattern\n * to schedule input.\n */\n public constructor(name: string, listed: boolean, describe: DescribePattern, rules: PatternRules)\n {\n this.name = name;\n this.listed = listed;\n this.describe = describe;\n this.rules = rules;\n }\n\n /**\n * Applies this pattern to a [[Schedule]] or [[ScheduleInput]] removing and\n * adding any necessary properties from the input to match this pattern -\n * based around the day provided.\n *\n * @param schedule The schedule to update to match this pattern.\n * @param day The day to base the schedule on.\n * @returns The reference to the input passed in.\n */\n public apply | Schedule>(schedule: I, day: Day): I\n {\n if (schedule instanceof Schedule)\n {\n this.applyGeneric(day,\n (prop, frequency) => schedule.setFrequency( prop, frequency ),\n (prop) => schedule.setFrequency( prop )\n );\n\n schedule.updateChecks();\n }\n else\n {\n this.applyGeneric(day,\n (prop, frequency) => schedule[ prop ] = frequency,\n (prop) => delete schedule[ prop ]\n );\n }\n\n return schedule;\n }\n\n /**\n * Applies this pattern to any object provided they implement the\n * `setFrequency` and `removeFrequency` functions.\n *\n * @param day The day to base the schedule on.\n * @param setFrequency The function which sets the frequency on the object.\n * @param removeFrequency The function to remove a frequency from the object.\n */\n public applyGeneric(day: Day,\n setFrequency: (property: DayProperty, frequency: any) => any,\n removeFrequency: (property: DayProperty) => any): void\n {\n for (let prop of Pattern.PROPS)\n {\n let rule = this.rules[ prop ];\n\n // Should have one value\n if (rule === 1)\n {\n setFrequency( prop, [day[ prop ]] );\n }\n\n // Can be any of the values in the array\n if (fn.isArray(rule))\n {\n setFrequency( prop, rule );\n }\n\n // Must not be present\n if (!fn.isDefined(rule))\n {\n removeFrequency( prop );\n }\n }\n }\n\n /**\n * Determines whether the given [[Schedule]] or [[ScheduleInput]] matches this\n * pattern. Optionally a day can be provided to make sure the day matches the\n * schedule and pattern together.\n *\n * @param schedule The schedule input to test.\n * @param exactlyWith A day to further validate against for matching.\n * @returns `true` if the schedule was a match to this pattern with the\n * day if one was provided, otherwise `false`.\n */\n public isMatch | Schedule>(schedule: I, exactlyWith?: Day): boolean\n {\n if (schedule instanceof Schedule)\n {\n return this.isMatchGeneric((prop) => schedule[ prop ].input, exactlyWith);\n }\n else\n {\n return this.isMatchGeneric((prop) => schedule[ prop ], exactlyWith);\n }\n }\n\n /**\n * Determines whether the given input matches this pattern. Optionally a day\n * can be provided to make sure the day matches the schedule and pattern\n * together.\n *\n * @param input The schedule input to test.\n * @param exactlyWith A day to further validate against for matching.\n * @returns `true` if the schedule input was a match to this pattern with the\n * day if one was provided, otherwise `false`.\n */\n public isMatchGeneric(getFrequency: (property: DayProperty) => FrequencyValue, exactlyWith?: Day): boolean\n {\n let exactly: boolean = fn.isDefined( exactlyWith );\n\n for (let prop of Pattern.PROPS)\n {\n let rule = this.rules[ prop ];\n let curr = getFrequency( prop );\n\n // Optional, skip it\n if (rule === false)\n {\n continue;\n }\n\n // Requires any value\n if (rule === true && !curr)\n {\n return false;\n }\n\n // Must not be present\n if (!fn.isDefined(rule) && curr)\n {\n return false;\n }\n\n // Must be an array of the same size\n if (fn.isNumber(rule))\n {\n if (fn.isArray(curr) && (curr).length === rule)\n {\n if (exactly && (curr).indexOf( exactlyWith[ prop ] ) === -1)\n {\n return false;\n }\n }\n else\n {\n return false;\n }\n }\n\n // Must be an array of the same values\n if (fn.isArray(rule))\n {\n if (!fn.isArray(curr))\n {\n return false;\n }\n\n if (rule.length !== (curr).length)\n {\n return false;\n }\n\n for (var i = 0; i < rule.length; i++)\n {\n if (rule[ i ] !== curr[ i ])\n {\n return false;\n }\n }\n\n if (exactly && rule.indexOf( exactlyWith[ prop ] ) === -1)\n {\n return false;\n }\n }\n\n // Must be an object with same over & offset.\n if (fn.isObject(rule))\n {\n if (!fn.isObject(curr))\n {\n return false;\n }\n\n var ruleOffset = rule.offset || 0;\n var currOffset = (curr).offset || 0;\n\n if (currOffset !== ruleOffset || curr.every !== rule.every)\n {\n return false;\n }\n\n if (exactly && (exactlyWith[ prop ] % rule.every) !== ruleOffset)\n {\n return false;\n }\n }\n }\n\n return true;\n }\n\n /**\n * Returns the pattern with the given name if one exists. If you add your own\n * patterns make sure to add them to [[PatternMap]].\n *\n * @param name The name of the pattern to return.\n * @return The instance to the pattern with the same name.\n */\n public static withName(name: string): Pattern\n {\n return PatternMap[ name ];\n }\n\n /**\n * Finds a matching pattern to the given input searching through [[Patterns]]\n * for matches. Optionally it will only look at patterns where listed = `true`.\n *\n * @param input The schedule input to use.\n * @param listedOnly When `true` only patterns with [[Pattern.listed]] set to\n * `true` will be looked at, otherwise all patterns are looked at.\n * @param exactlyWith A day to further validate against for matching.\n * @see [[Pattern.isMatch]]\n */\n public static findMatch | Schedule>(input: I, listedOnly: boolean = true, exactlyWith?: Day): Pattern\n {\n for (let pattern of Patterns)\n {\n if ((pattern.listed || !listedOnly) && pattern.isMatch( input, exactlyWith ))\n {\n return pattern;\n }\n }\n\n return null;\n }\n\n}\n\n\n/**\n * The list of patterns that can be searched through for matches to schedule\n * input.\n *\n * @see [[Pattern.findMatch]]\n */\nexport let Patterns: Pattern[] = [\n new Pattern(\n 'none', true,\n (day: Day) => 'Does not repeat',\n {\n year: 1,\n month: 1,\n dayOfMonth: 1\n }\n ),\n new Pattern(\n 'daily', true,\n (day: Day) => 'Daily',\n {\n\n }\n ),\n new Pattern(\n 'weekly', true,\n (day: Day) => 'Weekly on ' + day.format('dddd'),\n {\n dayOfWeek: 1\n }\n ),\n new Pattern(\n 'monthlyWeek', true,\n (day: Day) => 'Monthly on the ' + Suffix.CACHE[day.weekspanOfMonth + 1] + ' ' + day.format('dddd'),\n {\n dayOfWeek: 1,\n weekspanOfMonth: 1\n }\n ),\n new Pattern(\n 'annually', true,\n (day: Day) => 'Annually on ' + day.format('MMMM Do'),\n {\n month: 1,\n dayOfMonth: 1\n }\n ),\n new Pattern(\n 'annuallyMonthWeek', true,\n (day: Day) => 'Annually on the ' + Suffix.CACHE[day.weekspanOfMonth + 1] + ' ' + day.format('dddd') + ' of ' + day.format('MMMM'),\n {\n month: 1,\n dayOfWeek: 1,\n weekspanOfMonth: 1\n }\n ),\n new Pattern(\n 'weekday', true,\n (day: Day) => 'Every weekday (Monday to Friday)',\n {\n dayOfWeek: [Weekday.MONDAY, Weekday.TUESDAY, Weekday.WEDNESDAY, Weekday.THURSDAY, Weekday.FRIDAY]\n }\n ),\n new Pattern(\n 'monthly', true,\n (day: Day) => 'Monthly on the ' + day.format('Do') + ' day',\n {\n dayOfMonth: 1\n }\n ),\n new Pattern(\n 'custom', true,\n (day: Day) => 'Custom...',\n {\n dayOfWeek: false,\n dayOfMonth: false,\n lastDayOfMonth: false,\n dayOfYear: false,\n year: false,\n month: false,\n week: false,\n weekOfYear: false,\n weekspanOfYear: false,\n fullWeekOfYear: false,\n lastWeekspanOfYear: false,\n lastFullWeekOfYear: false,\n weekOfMonth: false,\n weekspanOfMonth: false,\n fullWeekOfMonth: false,\n lastWeekspanOfMonth: false,\n lastFullWeekOfMonth: false\n }\n )\n];\n\n/**\n * The map of patterns keyed by their name.\n *\n * @see [[Pattern.withName]]\n */\nexport let PatternMap: { [name: string]: Pattern } = {};\n\nfor (let pattern of Patterns)\n{\n PatternMap[ pattern.name ] = pattern;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Pattern.ts","\nimport { CalendarEvent } from './CalendarEvent';\nimport { Event } from './Event';\n\n\n/**\n * A function which takes two [[CalendarEvent]]s and returns a number which\n * instructs a sort which event goes before the other in a list.\n *\n * @param a The first event.\n * @param b The second event.\n * @returns When both events are considered equal `0` is returned, when the\n * first event should go before the second event a negative number is\n * returned, when the second event should go before the first event a\n * positive number is returned.\n */\nexport type SortEvent = (a: CalendarEvent, b: CalendarEvent) => number;\n\n/**\n * A class with [[SortEvent]] functions and functions which accept other\n * [[SortEvent]]s and return a new [[SortEvent]].\n *\n * ```typescript\n * // Sorts full day events first, then events in descending order based on start time.\n * Sorts.List([Sorts.FullDay, Sorts.Desc(Sorts.Start)]);\n * ```\n */\nexport class Sorts\n{\n\n /**\n * Sorts the two events by their start time - the earliest event being first\n * in order.\n *\n * @param a The first event.\n * @param b The second event.\n * @returns The difference in time between the start of `a` and `b`.\n * @see [[CalendarEvent.time]]\n */\n public static Start(a: CalendarEvent, b: CalendarEvent): number\n {\n return a.time.start.time - b.time.start.time;\n }\n\n /**\n * Sorts the two events by their end time - the earliest to end being first\n * in order.\n *\n * @param a The first event.\n * @param b The second event.\n * @returns The difference in time between the end of `a` and `b`.\n * @see [[CalendarEvent.time]]\n */\n public static End(a: CalendarEvent, b: CalendarEvent): number\n {\n return a.time.end.time - b.time.end.time;\n }\n\n /**\n * Sorts the two events placing the full day events before the timed events.\n *\n * @param a The first event.\n * @param b The second event.\n * @returns If both are timed or both are full day then `0` is returned,\n * otherwise `-1` is returned if `a` is full day and `1` is returned if\n * `b` is full day.\n * @see [[CalendarEvent.fullDay]]\n */\n public static FullDay(a: CalendarEvent, b: CalendarEvent): number\n {\n let af: number = a.fullDay ? 0 : 1;\n let bf: number = b.fullDay ? 0 : 1;\n\n return af - bf;\n }\n\n /**\n * Sorts the two events placing the shorter events before the longer events.\n * Full day or multiple day events actually take up a day and will be ordered\n * last.\n *\n * @param a The first event.\n * @param b The second event.\n * @returns The difference in milliseconds between `a` and `b`.\n * @see [[CalendarEvent.time]]\n * @see [[DaySpan.millis]]\n */\n public static Duration(a: CalendarEvent, b: CalendarEvent): number\n {\n return a.time.millis() - b.time.millis();\n }\n\n /**\n * Returns a [[SortEvent]] that effectively orders the given sorter in the\n * opposite (often descending) order.\n *\n * @param sorter The sorter to reverse.\n * @returns A new sorter which reverses the one passed in.\n */\n public static Desc(sorter: SortEvent): SortEvent\n {\n return (a, b) =>\n {\n return sorter( b, a );\n };\n }\n\n /**\n * Returns a [[SortEvent]] that orders the events based on a string in each\n * event. A function must be supplied which takes an event of type `T` and\n * returns a string.\n *\n * @param getString A function which returns a string from the event.\n * @returns A sorter which sorts strings alphabetically.\n */\n public static Alphabetical(getString: (event: Event) => string): SortEvent\n {\n return (a, b) =>\n {\n let as: string = getString( a.event ) || '';\n let bs: string = getString( b.event ) || '';\n\n return as.localeCompare( bs );\n };\n }\n\n /**\n * Returns a [[SortEvent]] that orders events based on a number in each event.\n * A function must be supplied which takes an event of type `T` and returns\n * a number.\n *\n * @param getOrder A function which returns a number from the event.\n * @returns A sorter which sorts events based on a number in ascending order.\n */\n public static Ordered(getOrder: (event: Event) => number): SortEvent\n {\n return (a, b) =>\n {\n let ao: number = getOrder( a.event );\n let bo: number = getOrder( b.event );\n\n return ao - bo;\n };\n }\n\n /**\n * Returns a [[SortEvent]] that orders events based on an array of sorters.\n * The first sorter which returns a non-zero result is used.\n *\n * @param sorters A list of sorting functions to test one at a time.\n * @returns A sorter which sorts based on a list of sorters.\n */\n public static List(sorters: SortEvent[]): SortEvent\n {\n return (a, b) =>\n {\n for (let sorter of sorters)\n {\n let compare: number = sorter(a, b);\n\n if (compare !== 0)\n {\n return compare;\n }\n }\n\n return 0;\n };\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Sort.ts","\nexport * from './Calendar';\nexport * from './CalendarDay';\nexport * from './CalendarEvent';\nexport * from './Event';\nexport * from './Constants';\nexport * from './Day';\nexport * from './DaySpan';\nexport * from './Frequency';\nexport * from './Functions';\nexport * from './Identifier';\nexport * from './Iterator';\nexport * from './Month';\nexport * from './Operation';\nexport * from './Parse';\nexport * from './Pattern';\nexport * from './Schedule';\nexport * from './ScheduleModifier';\nexport * from './Sort';\nexport * from './Suffix';\nexport * from './Time';\nexport * from './Units';\nexport * from './Weekday';\n\n\n\n// WEBPACK FOOTER //\n// ./src/index.ts"],"sourceRoot":""} \ No newline at end of file diff --git a/umd/dayspan.min.js b/umd/dayspan.min.js index 705d174..eed6842 100644 --- a/umd/dayspan.min.js +++ b/umd/dayspan.min.js @@ -1,2 +1,2 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("moment")):"function"==typeof define&&define.amd?define("ds",["moment"],e):"object"==typeof exports?exports.ds=e(require("moment")):t.ds=e(t.moment)}(this,function(t){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=1)}([function(e,n){e.exports=t},function(t,e,n){t.exports=n(2)},function(t,e,n){"use strict";function r(t,e,n){if(void 0===n&&(n=!1),isFinite(t))switch(n&&(t=Math.abs(t)),e){case i.NONE:return t;case i.FLOOR:return Math.floor(t);case i.CEIL:return Math.ceil(t);case i.ROUND:return Math.round(t);case i.TRUNCATE:case i.DOWN:return t<0?Math.ceil(t):Math.floor(t);case i.UP:return t<0?Math.floor(t):Math.ceil(t)}return t}Object.defineProperty(e,"__esModule",{value:!0});var i,o=function(){function t(){}return t.isArray=function(t){return t instanceof Array},t.isArrayEquals=function(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(var n=0;n0},t.coalesce=function(t,e,n){return this.isDefined(t)?t:this.isDefined(e)?e:n},t.pad=function(t,e,n,r){for(;t.length=this.start.time&&t.time<=this.end.time},t.prototype.compareTo=function(t){return t.timethis.end.time?1:0},t.prototype.matchesDay=function(t){return this.contains(t)||t.sameDay(this.start)||t.sameDay(this.end)},t.prototype.matchesWeek=function(t){return this.contains(t)||t.sameWeek(this.start)||t.sameWeek(this.end)},t.prototype.matchesMonth=function(t){return this.contains(t)||t.sameMonth(this.start)||t.sameMonth(this.end)},t.prototype.matchesYear=function(t){return this.contains(t)||t.sameYear(this.start)||t.sameYear(this.end)},t.prototype.millis=function(t,e){return void 0===t&&(t=i.DOWN),void 0===e&&(e=!0),this.start.millisBetween(this.end,t,e)},t.prototype.seconds=function(t,e){return void 0===t&&(t=i.DOWN),void 0===e&&(e=!0),this.start.secondsBetween(this.end,t,e)},t.prototype.minutes=function(t,e){return void 0===t&&(t=i.DOWN),void 0===e&&(e=!0),this.start.minutesBetween(this.end,t,e)},t.prototype.hours=function(t,e){return void 0===t&&(t=i.DOWN),void 0===e&&(e=!0),this.start.hoursBetween(this.end,t,e)},t.prototype.days=function(t,e){return void 0===t&&(t=i.DOWN),void 0===e&&(e=!0),this.start.daysBetween(this.end,t,e)},t.prototype.weeks=function(t,e){return void 0===t&&(t=i.DOWN),void 0===e&&(e=!0),this.start.weeksBetween(this.end,t,e)},t.prototype.months=function(t,e){return void 0===t&&(t=i.DOWN),void 0===e&&(e=!0),this.start.monthsBetween(this.end,t,e)},t.prototype.years=function(t,e){return void 0===t&&(t=i.DOWN),void 0===e&&(e=!0),this.start.yearsBetween(this.end,t,e)},t.prototype.startDelta=function(t){return(this.start.time-t.time)/a.MILLIS_IN_DAY},t.prototype.endDelta=function(t){return(this.end.time-t.time)/a.MILLIS_IN_DAY},t.prototype.getBounds=function(t,e,n,r,i,o,s){void 0===e&&(e=1),void 0===n&&(n=1),void 0===r&&(r=0),void 0===i&&(i=!0),void 0===o&&(o=0),void 0===s&&(s=0);var u=this.startDelta(t),a=this.endDelta(t),h=i?Math.max(0,u):u,f=i?Math.min(1,a):a,c=r,d=n-c,p=h*e,l=f*e;return{top:p+s,bottom:l+s,height:l-p,left:c+o,right:d+o,width:d}},t.prototype.summary=function(e,n,r,i,o,s){void 0===n&&(n=!0),void 0===r&&(r=!1),void 0===i&&(i=!1),void 0===o&&(o=!0),void 0===s&&(s=" - ");var u=t.SUMMARY_FORMATS[e],a=_.today(),h=!o||!this.start.sameYear(a),f=!o||!this.end.sameYear(a),c=this.start.format(u(r,n,h)),d=this.end.format(u(r,n,f)),p=c;return c!==d?(i||(p=this.start.format(u(r,n,!this.start.sameYear(this.end)))),p+=s,p+=d):p=c,p},t.prototype.intersects=function(t){return!(this.end.timet.end.time)},t.prototype.intersection=function(e){var n=this.start.max(e.start),r=this.end.min(e.end);return n.isAfter(r)?null:new t(n,r)},t.prototype.union=function(e){return new t(this.start.min(e.start),this.end.max(e.end))},t.point=function(e){return new t(e,e)},t.SUMMARY_FORMATS=(u={},u[s.DAY]=function(t,e,n){return(e?t?"ddd, ":"dddd, ":"")+(t?"MMM ":"MMMM ")+"Do"+(n?" YYYY":"")},u[s.WEEK]=function(t,e,n){return(e?t?"ddd, ":"dddd, ":"")+(t?"MMM ":"MMMM ")+"Do"+(n?" YYYY":"")},u[s.MONTH]=function(t,e,n){return(t?"MMM":"MMMM")+(n?" YYYY":"")},u[s.YEAR]=function(t,e,n){return n?"YYYY":""},u),t}(),f=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),c=function(){function t(){}return t.prototype.is=function(t){return(t+"").length===this.getLength()},t.prototype.compute=function(){for(var t=[],e=0;e=11&&t<=13?"th":this.MAP[t%this.MAP.length]},t.get=function(t,e){void 0===e&&(e=!1);var n=this.determine(t);return e?t+n:n},t.MAP=["th","st","nd","rd","th","th","th","th","th","th"],t._CACHE_SIZE=366,t}();!function(t){t[t.Continue=0]="Continue",t[t.Stop=1]="Stop",t[t.Remove=2]="Remove"}(O=O||(O={}));for(var E,S=function(){function t(t){this.result=void 0,this.source=t}return t.prototype.clone=function(){return new t(this.source)},t.prototype.act=function(t){return this.action=O.Continue,this.callback(t,this),this.action},t.prototype.stop=function(t){return this.result=t,this.action=O.Stop,this},t.prototype.remove=function(){return this.action=O.Remove,this},t.prototype.isEmpty=function(t){void 0===t&&(t=null);var e=!0;return this.iterate(function(n,r){t&&!t(n)||(e=!1,r.stop())}),e},t.prototype.count=function(t){void 0===t&&(t=null);var e=0;return this.iterate(function(n,r){t&&!t(n)||e++}),e},t.prototype.first=function(t){void 0===t&&(t=null);var e=null;return this.iterate(function(n,r){t&&!t(n)||(e=n,r.stop())}),e},t.prototype.list=function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=null),this.iterate(function(n,r){e&&!e(n)||t.push(n)}),t},t.prototype.object=function(t,e,n){return void 0===e&&(e={}),void 0===n&&(n=null),this.iterate(function(r,i){if(!n||n(r)){var o=t(r);e[o]=r}}),e},t.prototype.take=function(e){var n=this;return new t(function(t){n.iterate(function(n,r){switch(t.act(n)){case O.Stop:r.stop();break;case O.Remove:r.remove()}--e<=0&&r.stop()})})},t.prototype.skip=function(e){var n=this;return new t(function(t){var r=0;n.iterate(function(n,i){if(r>=e)switch(t.act(n)){case O.Stop:i.stop();break;case O.Remove:i.remove()}r++})})},t.prototype.append=function(){for(var e=[],n=0;n=0;i--){var o=n[i],s=t.act(o);if(s===O.Stop)break;s===O.Remove&&r.push(o)}r.length>0&&e.purge(function(t){return-1!==r.indexOf(t)})})},t.prototype.reduce=function(t,e,n){void 0===n&&(n=null);var r=t;return this.iterate(function(t,i){n&&!n(t)||(r=e(t,r))}),r},t.prototype.filter=function(e){var n=this;return new t(function(t){n.iterate(function(n,r){if(e(n))switch(t.act(n)){case O.Stop:r.stop();break;case O.Remove:r.remove()}})})},t.prototype.map=function(e,n){var r=this;return void 0===n&&(n=null),new t(function(t){r.iterate(function(r,i){if(!n||n(r)){var s=e(r,i);if(o.isDefined(s))switch(t.act(s)){case O.Stop:i.stop();break;case O.Remove:i.remove()}}})})},t.prototype.iterate=function(t){return this.result=void 0,this.callback=t,this.action=O.Continue,this.source(this),this.callback=null,this},t.prototype.withResult=function(t){return this.result&&t(this.result),this},t.forArray=function(e,n){return void 0===n&&(n=!1),new t(function(t){if(n)for(var r=e.length-1;r>=0;r--)switch(t.act(e[r])){case O.Stop:return;case O.Remove:e.splice(r,1)}else for(var r=0;r0)&&(t=n?t.next():t.prev()),!o.iterateSpans(t,!1).isEmpty()){var h=s.act(t);if(h===O.Stop||++u>=e)return}})},t.prototype.iterateSpans=function(t,e){var n=this;return void 0===e&&(e=!1),new S(function(r){var i=t,o=e?n.durationInDays:0;if(n.isFullDay())for(;o>=0;){if(n.matchesDay(i)){var s=n.getFullSpan(i);if(s.matchesDay(t))switch(r.act(s)){case O.Stop:return}}i=i.prev(),o--}else for(;o>=0;){if(n.matchesDay(i))for(var u=0,a=n.times;u1)&&(!!this.include.isEmpty()&&(!!this.isSingleYear()&&(!!this.isSingleDayOfYear()||(!(!this.isSingleMonth()||!this.isSingleDayOfMonth())||(!!(this.isSingleMonth()&&this.isSingleWeekOfMonth()&&this.isSingleDayOfWeek())||!(!this.isSingleWeekOfYear()||!this.isSingleDayOfWeek()))))))},t.prototype.isSingleYear=function(){return this.isSingleFrequency(this.year)},t.prototype.isSingleMonth=function(){return this.isSingleFrequency(this.month)},t.prototype.isSingleDayOfMonth=function(){return this.isSingleFrequency(this.dayOfMonth)||this.isSingleFrequency(this.lastDayOfMonth)},t.prototype.isSingleDayOfWeek=function(){return this.isSingleFrequency(this.dayOfWeek)},t.prototype.isSingleDayOfYear=function(){return this.isSingleFrequency(this.dayOfYear)},t.prototype.isSingleWeekOfMonth=function(){return this.isSingleFrequency(this.weekspanOfMonth)||this.isSingleFrequency(this.fullWeekOfMonth)||this.isSingleFrequency(this.weekOfMonth)||this.isSingleFrequency(this.lastFullWeekOfMonth)||this.isSingleFrequency(this.lastWeekspanOfMonth)},t.prototype.isSingleWeekOfYear=function(){return this.isSingleFrequency(this.weekspanOfYear)||this.isSingleFrequency(this.fullWeekOfYear)||this.isSingleFrequency(this.week)||this.isSingleFrequency(this.weekOfYear)||this.isSingleFrequency(this.lastFullWeekOfYear)||this.isSingleFrequency(this.lastWeekspanOfYear)},t.prototype.isSingleFrequency=function(t){return o.isArray(t.input)&&1===t.input.length},t.prototype.forecast=function(t,e,n,r,i,o){var s=this;void 0===e&&(e=!0),void 0===r&&(r=n),void 0===i&&(i=!1),void 0===o&&(o=366);var u=this.identifierType,a=function(t,n){for(var r=s.iterateSpans(t,e).list(),o=i?r.length:Math.min(1,r.length),a=i?0:r.length-1,h=0;h0&&(n+=" and "+e(t[r])),n},t}()),Y=function(){function t(t,e,n,r){void 0===r&&(r=!0),this.schedule=t,this.data=e,this.id=n,this.visible=r}return t}(),g=function(){function t(t,e,n,r){void 0===e&&(e=a.MINUTE_MIN),void 0===n&&(n=a.SECOND_MIN),void 0===r&&(r=a.MILLIS_MIN),this.hour=t,this.minute=e,this.second=n,this.millisecond=r}return t.prototype.format=function(e){for(var n=t.FORMATTERS,r="",i=0;ia.WEEK_OF_MONTH_MINIMUM_WEEKDAY?n-1:n},t.getFullWeekOfYear=function(t){var e=t.clone().startOf("year"),n=t.week();return e.day()===a.WEEKDAY_MIN?n:n-1},t.getLastFullWeekOfYear=function(t){var e=t.clone().startOf("year"),n=t.week(),r=t.weeksInYear(),i=r-n;return e.day()===a.WEEKDAY_MIN?i+1:i},t.getWeekspanOfMonth=function(t){return Math.floor((t.date()-1)/a.DAYS_IN_WEEK)},t.getLastWeekspanOfMonth=function(t){return Math.floor((t.daysInMonth()-t.date())/a.DAYS_IN_WEEK)},t.getFullWeekOfMonth=function(t){return Math.floor((t.date()-1-t.day()+a.DAYS_IN_WEEK)/a.DAYS_IN_WEEK)},t.getLastFullWeekOfMonth=function(t){return Math.floor((t.daysInMonth()-t.date()-(a.WEEKDAY_MAX-t.day())+a.DAYS_IN_WEEK)/a.DAYS_IN_WEEK)},t.getWeekOfMonth=function(t){var e=t.date(),n=t.day(),r=e-n;return Math.floor((r+a.WEEK_OF_MONTH_MINIMUM_WEEKDAY+5)/a.DAYS_IN_WEEK)},t.getLastDayOfMonth=function(t){return t.daysInMonth()-t.date()+1},t}()),N=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),W=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.currentDay=!1,e.currentWeek=!1,e.currentMonth=!1,e.currentYear=!1,e.currentOffset=0,e.selectedDay=!1,e.selectedWeek=!1,e.selectedMonth=!1,e.selectedYear=!1,e.inCalendar=!1,e.events=[],e}return N(e,t),e.prototype.updateCurrent=function(t){return this.currentDay=this.sameDay(t),this.currentWeek=this.sameWeek(t),this.currentMonth=this.sameMonth(t),this.currentYear=this.sameYear(t),this.currentOffset=this.daysBetween(t,i.DOWN,!1),this},e.prototype.updateSelected=function(t){return this.selectedDay=t.matchesDay(this),this.selectedWeek=t.matchesWeek(this),this.selectedMonth=t.matchesMonth(this),this.selectedYear=t.matchesYear(this),this},e.prototype.clearSelected=function(){return this.selectedDay=this.selectedWeek=this.selectedMonth=this.selectedYear=!1,this},e}(_),T=function(){function t(t,e,n,r){this.row=0,this.col=0,this.id=t,this.event=e,this.time=n,this.day=r,this.fullDay=e.schedule.isFullDay(),this.meta=e.schedule.getMeta(n.start),this.cancelled=e.schedule.isCancelled(n.start),this.starting=n.isPoint||n.start.sameDay(r),this.ending=n.isPoint||n.end.relative(-1).sameDay(r)}return Object.defineProperty(t.prototype,"scheduleId",{get:function(){return Math.floor(this.id/a.MAX_EVENTS_PER_DAY)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"start",{get:function(){return this.time.start},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"end",{get:function(){return this.time.end},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"schedule",{get:function(){return this.event.schedule},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"data",{get:function(){return this.event.data},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"identifier",{get:function(){return this.identifierType.get(this.start)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"identifierType",{get:function(){return this.schedule.identifierType},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"startDelta",{get:function(){return this.time.startDelta(this.day)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"endDelta",{get:function(){return this.time.endDelta(this.day)},enumerable:!0,configurable:!0}),t.prototype.getTimeBounds=function(t,e,n,r,i,o){return void 0===t&&(t=1),void 0===e&&(e=1),void 0===n&&(n=.1),void 0===r&&(r=!0),void 0===i&&(i=0),void 0===o&&(o=0),this.time.getBounds(this.day,t,e,this.col*n,r,i,o)},t.prototype.cancel=function(t){return void 0===t&&(t=!0),this.schedule.setCancelled(this.start,t),this.cancelled=t,this},t.prototype.exclude=function(t){return void 0===t&&(t=!0),this.schedule.setExcluded(this.start,t),this},t.prototype.move=function(t){return this.schedule.move(t,this.start,this.meta)},t}(),R=(function(){function t(t,e,n,r,i,s,u){this.fill=!1,this.minimumSize=0,this.repeatCovers=!0,this.listTimes=!1,this.eventsOutside=!1,this.updateRows=!1,this.updateColumns=!1,this.eventSorter=null,this.parseMeta=function(t){return t},this.parseData=function(t){return t},this.selection=null,this.days=[],this.events=[],this.visible=[],this.span=new h(t,e),this.filled=new h(t,e),this.type=n,this.size=r,this.moveStart=i,this.moveEnd=s,o.isDefined(u)?this.set(u):this.refresh()}return t.prototype.set=function(e){var n=o.isDefined(e.type)&&e.type!==this.type,r=o.isDefined(e.size)&&e.size!==this.size;if(n||r){var i=o.coalesce(e.otherwiseFocus,.4999),s=o.coalesce(e.preferToday,!0),u=o.coalesce(e.size,this.size),a=o.coalesce(e.type,this.type),h=o.coalesce(e.around,this.days[Math.floor((this.days.length-1)*i)]),f=_.today();(!h||s&&this.span.matchesDay(f))&&(h=f);var c=t.TYPES[a],d=c.getStart(_.parse(h),u,i),p=c.getEnd(d,u,i);this.span.start=d,this.span.end=p,this.type=a,this.size=u,this.moveStart=c.moveStart,this.moveEnd=c.moveEnd}else if(e.around){var l=o.coalesce(e.otherwiseFocus,.4999),h=_.parse(e.around),a=this.type,u=this.size,c=t.TYPES[a],d=c.getStart(h,u,l),p=c.getEnd(d,u,l);this.span.start=d,this.span.end=p}return this.fill=o.coalesce(e.fill,this.fill),this.minimumSize=o.coalesce(e.minimumSize,this.minimumSize),this.repeatCovers=o.coalesce(e.repeatCovers,this.repeatCovers),this.listTimes=o.coalesce(e.listTimes,this.listTimes),this.eventsOutside=o.coalesce(e.eventsOutside,this.eventsOutside),this.updateRows=o.coalesce(e.updateRows,this.updateRows),this.updateColumns=o.coalesce(e.updateColumns,this.updateColumns),this.eventSorter=o.coalesce(e.eventSorter,this.eventSorter),this.parseMeta=o.coalesce(e.parseMeta,this.parseMeta),this.parseData=o.coalesce(e.parseData,this.parseData),o.isArray(e.events)&&(this.removeEvents(),this.addEvents(e.events,!1,!0)),e.delayRefresh||this.refresh(),this},t.prototype.withMinimumSize=function(t){return this.minimumSize=t,this.refresh(),this},t.prototype.withRepeatCovers=function(t){return this.repeatCovers=t,this.refreshEvents(),this},t.prototype.withListTimes=function(t){return this.listTimes=t,this.refreshEvents(),this},t.prototype.withEventsOutside=function(t){return this.eventsOutside=t,this.refreshEvents(),this},t.prototype.withUpdateRows=function(t,e){return void 0===e&&(e=!0),this.updateRows=t,e&&t&&this.refreshRows(),this},t.prototype.withUpdateColumns=function(t,e){return void 0===e&&(e=!0),this.updateColumns=t,e&&t&&this.refreshColumns(),this},Object.defineProperty(t.prototype,"start",{get:function(){return this.span.start},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"end",{get:function(){return this.span.end},enumerable:!0,configurable:!0}),t.prototype.summary=function(t,e,n,r,i){return void 0===t&&(t=!0),void 0===e&&(e=!1),void 0===n&&(n=!1),void 0===r&&(r=!0),void 0===i&&(i=" - "),this.span.summary(this.type,t,e,n,r,i)},t.prototype.split=function(e){var n=this;return void 0===e&&(e=1),new S(function(r){for(var i=n.start,o=n.moveEnd(n.end,e-n.size),s=0;so&&t.splice(o,t.length-o),this},t.prototype.refreshVisible=function(){var t=this.filled.start,e=this.filled.end;return this.visible=this.events.filter(function(n){return n.visible&&n.schedule.matchesRange(t,e)}),this},t.prototype.refreshCurrent=function(t){return void 0===t&&(t=_.today()),this.iterateDays().iterate(function(e){e.updateCurrent(t)}),this},t.prototype.refreshSelection=function(){var t=this;return this.iterateDays().iterate(function(e){t.selection?e.updateSelected(t.selection):e.clearSelected()}),this},t.prototype.refreshEvents=function(){var t=this;return this.iterateDays().iterate(function(e){(e.inCalendar||t.eventsOutside)&&(e.events=t.eventsForDay(e,t.listTimes,t.repeatCovers))}),this.updateRows&&this.refreshRows(),this.updateColumns&&this.refreshColumns(),this},t.prototype.refreshRows=function(){var t={},e=this.listTimes;return this.iterateDays().iterate(function(n){0===n.dayOfWeek&&(t={});for(var r={},i=0,o=n.events;i0},t.coalesce=function(t,e,n){return this.isDefined(t)?t:this.isDefined(e)?e:n},t.extend=function(t,e){for(var n in e)t[n]=e[n];return t},t.pad=function(t,e,n,i){for(;t.length=this.start.time&&t.time<=this.end.time},t.prototype.compareTo=function(t){return t.timethis.end.time?1:0},t.prototype.matchesDay=function(t){return this.contains(t)||t.sameDay(this.start)||t.sameDay(this.end)},t.prototype.matchesWeek=function(t){return this.contains(t)||t.sameWeek(this.start)||t.sameWeek(this.end)},t.prototype.matchesMonth=function(t){return this.contains(t)||t.sameMonth(this.start)||t.sameMonth(this.end)},t.prototype.matchesYear=function(t){return this.contains(t)||t.sameYear(this.start)||t.sameYear(this.end)},t.prototype.millis=function(t,e){return void 0===t&&(t=r.DOWN),void 0===e&&(e=!0),this.start.millisBetween(this.end,t,e)},t.prototype.seconds=function(t,e){return void 0===t&&(t=r.DOWN),void 0===e&&(e=!0),this.start.secondsBetween(this.end,t,e)},t.prototype.minutes=function(t,e){return void 0===t&&(t=r.DOWN),void 0===e&&(e=!0),this.start.minutesBetween(this.end,t,e)},t.prototype.hours=function(t,e){return void 0===t&&(t=r.DOWN),void 0===e&&(e=!0),this.start.hoursBetween(this.end,t,e)},t.prototype.days=function(t,e){return void 0===t&&(t=r.DOWN),void 0===e&&(e=!0),this.start.daysBetween(this.end,t,e)},t.prototype.weeks=function(t,e){return void 0===t&&(t=r.DOWN),void 0===e&&(e=!0),this.start.weeksBetween(this.end,t,e)},t.prototype.months=function(t,e){return void 0===t&&(t=r.DOWN),void 0===e&&(e=!0),this.start.monthsBetween(this.end,t,e)},t.prototype.years=function(t,e){return void 0===t&&(t=r.DOWN),void 0===e&&(e=!0),this.start.yearsBetween(this.end,t,e)},t.prototype.startDelta=function(t){return(this.start.time-t.time)/a.MILLIS_IN_DAY},t.prototype.endDelta=function(t){return(this.end.time-t.time)/a.MILLIS_IN_DAY},t.prototype.getBounds=function(t,e,n,i,r,o,s){void 0===e&&(e=1),void 0===n&&(n=1),void 0===i&&(i=0),void 0===r&&(r=!0),void 0===o&&(o=0),void 0===s&&(s=0);var u=this.startDelta(t),a=this.endDelta(t),h=r?Math.max(0,u):u,f=r?Math.min(1,a):a,c=i,d=n-c,p=h*e,l=f*e;return{top:p+s,bottom:l+s,height:l-p,left:c+o,right:d+o,width:d}},t.prototype.summary=function(e,n,i,r,o,s){void 0===n&&(n=!0),void 0===i&&(i=!1),void 0===r&&(r=!1),void 0===o&&(o=!0),void 0===s&&(s=" - ");var u=t.SUMMARY_FORMATS[e],a=_.today(),h=!o||!this.start.sameYear(a),f=!o||!this.end.sameYear(a),c=this.start.format(u(i,n,h)),d=this.end.format(u(i,n,f)),p=c;return c!==d?(r||(p=this.start.format(u(i,n,!this.start.sameYear(this.end)))),p+=s,p+=d):p=c,p},t.prototype.intersects=function(t){return!(this.end.timet.end.time)},t.prototype.intersection=function(e){var n=this.start.max(e.start),i=this.end.min(e.end);return n.isAfter(i)?null:new t(n,i)},t.prototype.union=function(e){return new t(this.start.min(e.start),this.end.max(e.end))},t.point=function(e){return new t(e,e)},t.SUMMARY_FORMATS=(u={},u[s.DAY]=function(t,e,n){return(e?t?"ddd, ":"dddd, ":"")+(t?"MMM ":"MMMM ")+"Do"+(n?" YYYY":"")},u[s.WEEK]=function(t,e,n){return(e?t?"ddd, ":"dddd, ":"")+(t?"MMM ":"MMMM ")+"Do"+(n?" YYYY":"")},u[s.MONTH]=function(t,e,n){return(t?"MMM":"MMMM")+(n?" YYYY":"")},u[s.YEAR]=function(t,e,n){return n?"YYYY":""},u),t}(),f=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),c=function(){function t(){}return t.prototype.is=function(t){return(t+"").length===this.getLength()},t.prototype.compute=function(){for(var t=[],e=0;e=11&&t<=13?"th":this.MAP[t%this.MAP.length]},t.get=function(t,e){void 0===e&&(e=!1);var n=this.determine(t);return e?t+n:n},t.MAP=["th","st","nd","rd","th","th","th","th","th","th"],t._CACHE_SIZE=366,t}();!function(t){t[t.Continue=0]="Continue",t[t.Stop=1]="Stop",t[t.Remove=2]="Remove"}(O=O||(O={}));for(var S,E=function(){function t(t){this.result=null,this.source=t}return t.prototype.clone=function(){return new t(this.source)},t.prototype.act=function(t){return this.action=O.Continue,this.callback(t,this),this.action},t.prototype.stop=function(t){return this.result=t,this.action=O.Stop,this},t.prototype.remove=function(){return this.action=O.Remove,this},t.prototype.isEmpty=function(t){void 0===t&&(t=null);var e=!0;return this.iterate(function(n,i){t&&!t(n)||(e=!1,i.stop())}),e},t.prototype.count=function(t){void 0===t&&(t=null);var e=0;return this.iterate(function(n,i){t&&!t(n)||e++}),e},t.prototype.first=function(t){void 0===t&&(t=null);var e=null;return this.iterate(function(n,i){t&&!t(n)||(e=n,i.stop())}),e},t.prototype.list=function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=null),this.iterate(function(n,i){e&&!e(n)||t.push(n)}),t},t.prototype.object=function(t,e,n){return void 0===e&&(e={}),void 0===n&&(n=null),this.iterate(function(i,r){if(!n||n(i)){var o=t(i);e[o]=i}}),e},t.prototype.take=function(e){var n=this;return new t(function(t){n.iterate(function(n,i){switch(t.act(n)){case O.Stop:i.stop();break;case O.Remove:i.remove()}--e<=0&&i.stop()})})},t.prototype.skip=function(e){var n=this;return new t(function(t){var i=0;n.iterate(function(n,r){if(i>=e)switch(t.act(n)){case O.Stop:r.stop();break;case O.Remove:r.remove()}i++})})},t.prototype.append=function(){for(var e=[],n=0;n=0;r--){var o=n[r],s=t.act(o);if(s===O.Stop)break;s===O.Remove&&i.push(o)}i.length>0&&e.purge(function(t){return-1!==i.indexOf(t)})})},t.prototype.reduce=function(t,e,n){void 0===n&&(n=null);var i=t;return this.iterate(function(t,r){n&&!n(t)||(i=e(t,i))}),i},t.prototype.filter=function(e){var n=this;return new t(function(t){n.iterate(function(n,i){if(e(n))switch(t.act(n)){case O.Stop:i.stop();break;case O.Remove:i.remove()}})})},t.prototype.map=function(e,n){var i=this;return void 0===n&&(n=null),new t(function(t){i.iterate(function(i,r){if(!n||n(i)){var s=e(i,r);if(o.isDefined(s))switch(t.act(s)){case O.Stop:r.stop();break;case O.Remove:r.remove()}}})})},t.prototype.iterate=function(t){return this.result=void 0,this.callback=t,this.action=O.Continue,this.source(this),this.callback=null,this},t.prototype.withResult=function(t){return this.result&&t(this.result),this},t.forArray=function(e,n){return void 0===n&&(n=!1),new t(function(t){if(n)for(var i=e.length-1;i>=0;i--)switch(t.act(e[i])){case O.Stop:return;case O.Remove:e.splice(i,1)}else for(var i=0;i0)&&(t=n?t.next():t.prev()),!o.iterateSpans(t,!1).isEmpty()){var h=s.act(t);if(h===O.Stop||++u>=e)return}})},t.prototype.iterateSpans=function(t,e){var n=this;return void 0===e&&(e=!1),new E(function(i){var r=t,o=e?n.durationInDays:0;if(n.isFullDay())for(;o>=0;){if(n.matchesDay(r)){var s=n.getFullSpan(r);if(s.matchesDay(t))switch(i.act(s)){case O.Stop:return}}r=r.prev(),o--}else for(;o>=0;){if(n.matchesDay(r))for(var u=0,a=n.times;u1)&&(!!this.include.isEmpty()&&(!!this.isSingleYear()&&(!!this.isSingleDayOfYear()||(!(!this.isSingleMonth()||!this.isSingleDayOfMonth())||(!!(this.isSingleMonth()&&this.isSingleWeekOfMonth()&&this.isSingleDayOfWeek())||!(!this.isSingleWeekOfYear()||!this.isSingleDayOfWeek()))))))},t.prototype.isSingleYear=function(){return this.isSingleFrequency(this.year)},t.prototype.isSingleMonth=function(){return this.isSingleFrequency(this.month)},t.prototype.isSingleDayOfMonth=function(){return this.isSingleFrequency(this.dayOfMonth)||this.isSingleFrequency(this.lastDayOfMonth)},t.prototype.isSingleDayOfWeek=function(){return this.isSingleFrequency(this.dayOfWeek)},t.prototype.isSingleDayOfYear=function(){return this.isSingleFrequency(this.dayOfYear)},t.prototype.isSingleWeekOfMonth=function(){return this.isSingleFrequency(this.weekspanOfMonth)||this.isSingleFrequency(this.fullWeekOfMonth)||this.isSingleFrequency(this.weekOfMonth)||this.isSingleFrequency(this.lastFullWeekOfMonth)||this.isSingleFrequency(this.lastWeekspanOfMonth)},t.prototype.isSingleWeekOfYear=function(){return this.isSingleFrequency(this.weekspanOfYear)||this.isSingleFrequency(this.fullWeekOfYear)||this.isSingleFrequency(this.week)||this.isSingleFrequency(this.weekOfYear)||this.isSingleFrequency(this.lastFullWeekOfYear)||this.isSingleFrequency(this.lastWeekspanOfYear)},t.prototype.isSingleFrequency=function(t){return o.isArray(t.input)&&1===t.input.length},t.prototype.forecast=function(t,e,n,i,r,o){var s=this;void 0===e&&(e=!0),void 0===i&&(i=n),void 0===r&&(r=!1),void 0===o&&(o=366);var u=this.identifierType,a=function(t,n){for(var i=s.iterateSpans(t,e).list(),o=r?i.length:Math.min(1,i.length),a=r?0:i.length-1,h=0;h0&&(n+=" and "+e(t[i])),n},t}()),Y=function(){function t(t,e,n,i){void 0===i&&(i=!0),this.schedule=t,this.data=e,this.id=n,this.visible=i}return t}(),g=function(){function t(t,e,n,i){void 0===e&&(e=a.MINUTE_MIN),void 0===n&&(n=a.SECOND_MIN),void 0===i&&(i=a.MILLIS_MIN),this.hour=t,this.minute=e,this.second=n,this.millisecond=i}return t.prototype.format=function(e){for(var n=t.FORMATTERS,i="",r=0;ra.WEEK_OF_MONTH_MINIMUM_WEEKDAY?n-1:n},t.getFullWeekOfYear=function(t){var e=t.clone().startOf("year"),n=t.week();return e.day()===a.WEEKDAY_MIN?n:n-1},t.getLastFullWeekOfYear=function(t){var e=t.clone().startOf("year"),n=t.week(),i=t.weeksInYear(),r=i-n;return e.day()===a.WEEKDAY_MIN?r+1:r},t.getWeekspanOfMonth=function(t){return Math.floor((t.date()-1)/a.DAYS_IN_WEEK)},t.getLastWeekspanOfMonth=function(t){return Math.floor((t.daysInMonth()-t.date())/a.DAYS_IN_WEEK)},t.getFullWeekOfMonth=function(t){return Math.floor((t.date()-1-t.day()+a.DAYS_IN_WEEK)/a.DAYS_IN_WEEK)},t.getLastFullWeekOfMonth=function(t){return Math.floor((t.daysInMonth()-t.date()-(a.WEEKDAY_MAX-t.day())+a.DAYS_IN_WEEK)/a.DAYS_IN_WEEK)},t.getWeekOfMonth=function(t){var e=t.date(),n=t.day(),i=e-n;return Math.floor((i+a.WEEK_OF_MONTH_MINIMUM_WEEKDAY+5)/a.DAYS_IN_WEEK)},t.getLastDayOfMonth=function(t){return t.daysInMonth()-t.date()+1},t}()),N=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),W=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.currentDay=!1,e.currentWeek=!1,e.currentMonth=!1,e.currentYear=!1,e.currentOffset=0,e.selectedDay=!1,e.selectedWeek=!1,e.selectedMonth=!1,e.selectedYear=!1,e.inCalendar=!1,e.events=[],e}return N(e,t),e.prototype.updateCurrent=function(t){return this.currentDay=this.sameDay(t),this.currentWeek=this.sameWeek(t),this.currentMonth=this.sameMonth(t),this.currentYear=this.sameYear(t),this.currentOffset=this.daysBetween(t,r.DOWN,!1),this},e.prototype.updateSelected=function(t){return this.selectedDay=t.matchesDay(this),this.selectedWeek=t.matchesWeek(this),this.selectedMonth=t.matchesMonth(this),this.selectedYear=t.matchesYear(this),this},e.prototype.clearSelected=function(){return this.selectedDay=this.selectedWeek=this.selectedMonth=this.selectedYear=!1,this},e}(_),T=function(){function t(t,e,n,i){this.row=0,this.col=0,this.id=t,this.event=e,this.time=n,this.day=i,this.fullDay=e.schedule.isFullDay(),this.meta=e.schedule.getMeta(n.start),this.cancelled=e.schedule.isCancelled(n.start),this.starting=n.isPoint||n.start.sameDay(i),this.ending=n.isPoint||n.end.relative(-1).sameDay(i)}return Object.defineProperty(t.prototype,"scheduleId",{get:function(){return Math.floor(this.id/a.MAX_EVENTS_PER_DAY)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"start",{get:function(){return this.time.start},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"end",{get:function(){return this.time.end},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"schedule",{get:function(){return this.event.schedule},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"data",{get:function(){return this.event.data},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"identifier",{get:function(){return this.identifierType.get(this.start)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"identifierType",{get:function(){return this.schedule.identifierType},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"startDelta",{get:function(){return this.time.startDelta(this.day)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"endDelta",{get:function(){return this.time.endDelta(this.day)},enumerable:!0,configurable:!0}),t.prototype.getTimeBounds=function(t,e,n,i,r,o){return void 0===t&&(t=1),void 0===e&&(e=1),void 0===n&&(n=.1),void 0===i&&(i=!0),void 0===r&&(r=0),void 0===o&&(o=0),this.time.getBounds(this.day,t,e,this.col*n,i,r,o)},t.prototype.cancel=function(t){return void 0===t&&(t=!0),this.schedule.setCancelled(this.start,t),this.cancelled=t,this},t.prototype.exclude=function(t){return void 0===t&&(t=!0),this.schedule.setExcluded(this.start,t),this},t.prototype.move=function(t){return this.schedule.move(t,this.start,this.meta)},t}(),R=(function(){function t(t,e,n,i,r,s,u){this.fill=!1,this.minimumSize=0,this.repeatCovers=!0,this.listTimes=!1,this.eventsOutside=!1,this.updateRows=!1,this.updateColumns=!1,this.eventSorter=null,this.parseMeta=function(t){return t},this.parseData=function(t){return t},this.selection=null,this.days=[],this.events=[],this.visible=[],this.span=new h(t,e),this.filled=new h(t,e),this.type=n,this.size=i,this.moveStart=r,this.moveEnd=s,o.isDefined(u)?this.set(u):this.refresh()}return t.prototype.set=function(e){var n=o.isDefined(e.type)&&e.type!==this.type,i=o.isDefined(e.size)&&e.size!==this.size;if(n||i){var r=o.coalesce(e.otherwiseFocus,.4999),s=o.coalesce(e.preferToday,!0),u=o.coalesce(e.size,this.size),a=o.coalesce(e.type,this.type),h=o.coalesce(e.around,this.days[Math.floor((this.days.length-1)*r)]),f=_.today();(!h||s&&this.span.matchesDay(f))&&(h=f);var c=t.TYPES[a],d=c.getStart(_.parse(h),u,r),p=c.getEnd(d,u,r);this.span.start=d,this.span.end=p,this.type=a,this.size=u,this.moveStart=c.moveStart,this.moveEnd=c.moveEnd}else if(e.around){var l=o.coalesce(e.otherwiseFocus,.4999),h=_.parse(e.around),a=this.type,u=this.size,c=t.TYPES[a],d=c.getStart(h,u,l),p=c.getEnd(d,u,l);this.span.start=d,this.span.end=p}return this.fill=o.coalesce(e.fill,this.fill),this.minimumSize=o.coalesce(e.minimumSize,this.minimumSize),this.repeatCovers=o.coalesce(e.repeatCovers,this.repeatCovers),this.listTimes=o.coalesce(e.listTimes,this.listTimes),this.eventsOutside=o.coalesce(e.eventsOutside,this.eventsOutside),this.updateRows=o.coalesce(e.updateRows,this.updateRows),this.updateColumns=o.coalesce(e.updateColumns,this.updateColumns),this.eventSorter=o.coalesce(e.eventSorter,this.eventSorter),this.parseMeta=o.coalesce(e.parseMeta,this.parseMeta),this.parseData=o.coalesce(e.parseData,this.parseData),o.isArray(e.events)&&(this.removeEvents(),this.addEvents(e.events,!1,!0)),e.delayRefresh||this.refresh(),this},t.prototype.withMinimumSize=function(t){return this.minimumSize=t,this.refresh(),this},t.prototype.withRepeatCovers=function(t){return this.repeatCovers=t,this.refreshEvents(),this},t.prototype.withListTimes=function(t){return this.listTimes=t,this.refreshEvents(),this},t.prototype.withEventsOutside=function(t){return this.eventsOutside=t,this.refreshEvents(),this},t.prototype.withUpdateRows=function(t,e){return void 0===e&&(e=!0),this.updateRows=t,e&&t&&this.refreshRows(),this},t.prototype.withUpdateColumns=function(t,e){return void 0===e&&(e=!0),this.updateColumns=t,e&&t&&this.refreshColumns(),this},Object.defineProperty(t.prototype,"start",{get:function(){return this.span.start},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"end",{get:function(){return this.span.end},enumerable:!0,configurable:!0}),t.prototype.summary=function(t,e,n,i,r){return void 0===t&&(t=!0),void 0===e&&(e=!1),void 0===n&&(n=!1),void 0===i&&(i=!0),void 0===r&&(r=" - "),this.span.summary(this.type,t,e,n,i,r)},t.prototype.split=function(e){var n=this;return void 0===e&&(e=1),new E(function(i){for(var r=n.start,o=n.moveEnd(n.end,e-n.size),s=0;so&&t.splice(o,t.length-o),this},t.prototype.refreshVisible=function(){var t=this.filled.start,e=this.filled.end;return this.visible=this.events.filter(function(n){return n.visible&&n.schedule.matchesRange(t,e)}),this},t.prototype.refreshCurrent=function(t){return void 0===t&&(t=_.today()),this.iterateDays().iterate(function(e){e.updateCurrent(t)}),this},t.prototype.refreshSelection=function(){var t=this;return this.iterateDays().iterate(function(e){t.selection?e.updateSelected(t.selection):e.clearSelected()}),this},t.prototype.refreshEvents=function(){var t=this;return this.iterateDays().iterate(function(e){(e.inCalendar||t.eventsOutside)&&(e.events=t.eventsForDay(e,t.listTimes,t.repeatCovers))}),this.updateRows&&this.refreshRows(),this.updateColumns&&this.refreshColumns(),this},t.prototype.refreshRows=function(){var t={},e=this.listTimes;return this.iterateDays().iterate(function(n){0===n.dayOfWeek&&(t={});for(var i={},r=0,o=n.events;r 0;\r\n };\r\n /**\r\n * Returns the first argument which is defined.\r\n *\r\n * ```typescript\r\n * Functions.coalesce(3, 4); // 3\r\n * Functions.coalesce(undefined, 4); // 4\r\n * Functions.coalesce(null, 4); // null\r\n * Functions.coalesce(void 0, void 0, 5); // 5\r\n * ```\r\n *\r\n * @param a The first argument to look at.\r\n * @param b The second argument to look at.\r\n * @returns The first defined argument.\r\n * @see [[Functions.isDefined]]\r\n */\r\n Functions.coalesce = function (a, b, c) {\r\n return this.isDefined(a) ? a : (this.isDefined(b) ? b : c);\r\n };\r\n /**\r\n * Pads the string `x` up to `length` characters with the given `padding`\r\n * optionally placing the `padding` `before` `x`.\r\n *\r\n * ```typescript\r\n * Functions.pad('hey', 5, '_', false); // 'hey__'\r\n * Functions.pad('hey', 5, '_', true); // '__hey'\r\n * Functions.pad('heyman', 5, '_', true); // 'heyman'\r\n * ```\r\n *\r\n * @param x The string to pad.\r\n * @param length The length to pad to.\r\n * @param padding The string to pad with.\r\n * @param before If the padding should go before the string to pad.\r\n * @returns The padded string if any padding needed be added.\r\n */\r\n Functions.pad = function (x, length, padding, before) {\r\n while (x.length < length) {\r\n before ? x = padding + x : x = x + padding;\r\n }\r\n return x;\r\n };\r\n /**\r\n * Pads the number `x` up to `length` digits where the padding is `0` and it\r\n * goes before `x`. This function will only return the first `length`\r\n * characters of the padding string representation of the number but can return\r\n * an alternative number of `first` characters.\r\n *\r\n * ```typescript\r\n * Functions.padNumber(29, 3); // '029'\r\n * Functions.padNumber(29, 3, 2); // '02'\r\n * Functions.padNumber(9573, 3); // '957'\r\n * ```\r\n *\r\n * @param x The number to pad with zeros in the beginning.\r\n * @param length The number of digits the number should be padded to.\r\n * @param first The number of digits to return from the start of the string.\r\n * @returns A padded number.\r\n */\r\n Functions.padNumber = function (x, length, first) {\r\n if (first === void 0) { first = length; }\r\n return this.pad(x + '', length, '0', true).substring(0, first);\r\n };\r\n return Functions;\r\n}());\r\n\r\n\n// CONCATENATED MODULE: ./src/Operation.ts\n\r\n/**\r\n * An operation that can be performed on a single number.\r\n */\r\nvar Op;\r\n(function (Op) {\r\n /**\r\n * The number is returned unmodified.\r\n */\r\n Op[Op[\"NONE\"] = 0] = \"NONE\";\r\n /**\r\n * The number is rounded down to the nearest whole number.\r\n */\r\n Op[Op[\"FLOOR\"] = 1] = \"FLOOR\";\r\n /**\r\n * The number is rounded up to the nearest whole number.\r\n */\r\n Op[Op[\"CEIL\"] = 2] = \"CEIL\";\r\n /**\r\n * The number is rounded up or down depending on if the fractional value is\r\n * greater than or less than 0.5 respectively.\r\n */\r\n Op[Op[\"ROUND\"] = 3] = \"ROUND\";\r\n /**\r\n * The fractional part of the number is dropped.\r\n */\r\n Op[Op[\"TRUNCATE\"] = 4] = \"TRUNCATE\";\r\n /**\r\n * The number is rounded up when positive and down when negative. This is\r\n * effectively ceiling the absolute value where the result preserves the sign.\r\n */\r\n Op[Op[\"UP\"] = 5] = \"UP\";\r\n /**\r\n * The number is rounded down when positive and up when negative. This is\r\n * effectively floor the absolute value where the result preserves the sign.\r\n */\r\n Op[Op[\"DOWN\"] = 6] = \"DOWN\";\r\n})(Op = Op || (Op = {}));\r\n/**\r\n * Performs the requested operation on the given number, optionally taking\r\n * the absolute value of the number before the operation.\r\n *\r\n * @param value The number to operate on.\r\n * @param op The operation to perform.\r\n * @param absolute If the number should be positive before the operation.\r\n * @return The operated result, or the original value if its not a valid number.\r\n */\r\nfunction operate(value, op, absolute) {\r\n if (absolute === void 0) { absolute = false; }\r\n if (isFinite(value)) {\r\n if (absolute) {\r\n value = Math.abs(value);\r\n }\r\n switch (op) {\r\n case Op.NONE:\r\n return value;\r\n case Op.FLOOR:\r\n return Math.floor(value);\r\n case Op.CEIL:\r\n return Math.ceil(value);\r\n case Op.ROUND:\r\n return Math.round(value);\r\n case Op.TRUNCATE:\r\n case Op.DOWN:\r\n return value < 0 ? Math.ceil(value) : Math.floor(value);\r\n case Op.UP:\r\n return value < 0 ? Math.floor(value) : Math.ceil(value);\r\n }\r\n }\r\n return value;\r\n}\r\n\n// CONCATENATED MODULE: ./src/Units.ts\n\r\n/**\r\n * Units of time that are compromised of 1 or more days for the [[Calendar]] class.\r\n */\r\nvar Units;\r\n(function (Units) {\r\n Units[Units[\"DAY\"] = 0] = \"DAY\";\r\n Units[Units[\"WEEK\"] = 1] = \"WEEK\";\r\n Units[Units[\"MONTH\"] = 2] = \"MONTH\";\r\n Units[Units[\"YEAR\"] = 3] = \"YEAR\";\r\n})(Units = Units || (Units = {}));\r\n\n// CONCATENATED MODULE: ./src/Constants.ts\n\r\n/**\r\n * A class that stores commonly used values.\r\n */\r\nvar Constants = (function () {\r\n function Constants() {\r\n }\r\n /**\r\n * The number of milliseconds in a second.\r\n */\r\n Constants.MILLIS_IN_SECOND = 1000;\r\n /**\r\n * The number of milliseconds in a minute.\r\n */\r\n Constants.MILLIS_IN_MINUTE = Constants.MILLIS_IN_SECOND * 60;\r\n /**\r\n * The number of milliseconds in an hour.\r\n */\r\n Constants.MILLIS_IN_HOUR = Constants.MILLIS_IN_MINUTE * 60;\r\n /**\r\n * The number of milliseconds in a day (not including DST days).\r\n */\r\n Constants.MILLIS_IN_DAY = Constants.MILLIS_IN_HOUR * 24;\r\n /**\r\n * The number of milliseconds in a week (not including ones that include DST).\r\n */\r\n Constants.MILLIS_IN_WEEK = Constants.MILLIS_IN_DAY * 7;\r\n /**\r\n * The number of days in a week.\r\n */\r\n Constants.DAYS_IN_WEEK = 7;\r\n /**\r\n * The number of months in a year.\r\n */\r\n Constants.MONTHS_IN_YEAR = 12;\r\n /**\r\n * The number of hours in a day (not including DST days).\r\n */\r\n Constants.HOURS_IN_DAY = 24;\r\n /**\r\n * The first month of the year.\r\n */\r\n Constants.MONTH_MIN = 0;\r\n /**\r\n * The last month of the year.\r\n */\r\n Constants.MONTH_MAX = 11;\r\n /**\r\n * The first day of a month.\r\n */\r\n Constants.DAY_MIN = 1;\r\n /**\r\n * The last day of the longest month.\r\n */\r\n Constants.DAY_MAX = 31;\r\n /**\r\n * The first hour of the day.\r\n */\r\n Constants.HOUR_MIN = 0;\r\n /**\r\n * The last hour of the day.\r\n */\r\n Constants.HOUR_MAX = 23;\r\n /**\r\n * The first minute of the hour.\r\n */\r\n Constants.MINUTE_MIN = 0;\r\n /**\r\n * The last minute of the hour.\r\n */\r\n Constants.MINUTE_MAX = 59;\r\n /**\r\n * The first second of the minute.\r\n */\r\n Constants.SECOND_MIN = 0;\r\n /**\r\n * The last second of the minute.\r\n */\r\n Constants.SECOND_MAX = 59;\r\n /**\r\n * The first millisecond of the second.\r\n */\r\n Constants.MILLIS_MIN = 0;\r\n /**\r\n * The last millisecond of the second.\r\n */\r\n Constants.MILLIS_MAX = 999;\r\n /**\r\n * The first day of the week.\r\n */\r\n Constants.WEEKDAY_MIN = 0;\r\n /**\r\n * The last day of the week.\r\n */\r\n Constants.WEEKDAY_MAX = 6;\r\n /**\r\n * The default duration for an event.\r\n */\r\n Constants.DURATION_DEFAULT = 1;\r\n /**\r\n * The default duration unit for an all day event.\r\n */\r\n Constants.DURATION_DEFAULT_UNIT_ALL = 'days';\r\n /**\r\n * The default duration unit for an event at a given time.\r\n */\r\n Constants.DURATION_DEFAULT_UNIT_TIMES = 'hours';\r\n /**\r\n * Computes the duration unit given its for an all day event.\r\n *\r\n * @param all If the event is all day.\r\n * @return The default unit for the event.\r\n */\r\n Constants.DURATION_DEFAULT_UNIT = function (all) { return all ? Constants.DURATION_DEFAULT_UNIT_ALL :\r\n Constants.DURATION_DEFAULT_UNIT_TIMES; };\r\n /**\r\n * The number of milliseconds for various duration units. These are worse case\r\n * scenario and do not include DST changes.\r\n */\r\n Constants.DURATION_TO_MILLIS = {\r\n minute: Constants.MILLIS_IN_MINUTE,\r\n minutes: Constants.MILLIS_IN_MINUTE,\r\n hour: Constants.MILLIS_IN_HOUR,\r\n hours: Constants.MILLIS_IN_HOUR,\r\n day: Constants.MILLIS_IN_DAY,\r\n days: Constants.MILLIS_IN_DAY,\r\n week: Constants.MILLIS_IN_WEEK,\r\n weeks: Constants.MILLIS_IN_WEEK,\r\n month: Constants.MILLIS_IN_DAY * Constants.DAY_MAX,\r\n months: Constants.MILLIS_IN_DAY * Constants.DAY_MAX\r\n };\r\n /**\r\n * The maximum estimated number of events per day. This is used to calculate\r\n * [[CalendarEvent.id]] to give each event a unique ID. If you think you will\r\n * have more events than this per day, you can enlarge the value.\r\n */\r\n Constants.MAX_EVENTS_PER_DAY = 24;\r\n /**\r\n * The day of the week which determines the first week of the year or month.\r\n * By default this day is Thursday.\r\n */\r\n Constants.WEEK_OF_MONTH_MINIMUM_WEEKDAY = 4;\r\n return Constants;\r\n}());\r\n\r\n\n// CONCATENATED MODULE: ./src/DaySpan.ts\n\r\n\r\n\r\n\r\n\r\n/**\r\n * A class for a range of time between two [[Day]] timestamps.\r\n */\r\nvar DaySpan_DaySpan = (function () {\r\n /**\r\n * Creates a new span of time.\r\n *\r\n * @param start The starting timestamp.\r\n * @param end The ending timestamp.\r\n */\r\n function DaySpan(start, end) {\r\n this.start = start;\r\n this.end = end;\r\n }\r\n Object.defineProperty(DaySpan.prototype, \"isPoint\", {\r\n /**\r\n * Whether this span starts and ends on the same timestamp.\r\n */\r\n get: function () {\r\n return this.start.time === this.end.time;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Determines whether the given timestamp lies between the start and end\r\n * timestamp.\r\n *\r\n * @param day The timestamp to test.\r\n * @returns True if the day is >= the start and <= the end of this span.\r\n */\r\n DaySpan.prototype.contains = function (day) {\r\n return day.time >= this.start.time && day.time <= this.end.time;\r\n };\r\n /**\r\n * Compares the given timestamp to this span. If the timestamp is before this\r\n * span then `-1` is returned, if the timestamp is after this span then `1`\r\n * us returned, otherwise `0` is returned when the timestamp is in this span.\r\n *\r\n * @param day The timestamp to compare to.\r\n * @returns `-1`, `0`, or `1` depending on the given timestamp relative to\r\n * this span.\r\n */\r\n DaySpan.prototype.compareTo = function (day) {\r\n return day.time < this.start.time ? -1 : (day.time > this.end.time ? 1 : 0);\r\n };\r\n /**\r\n * Determines whether the given timestamp is between the start and end\r\n * timestamp or lies on the same day as the start or end timestamp.\r\n *\r\n * @param day The timestamp to test.\r\n * @see [[Day.sameDay]]\r\n */\r\n DaySpan.prototype.matchesDay = function (day) {\r\n return this.contains(day) || day.sameDay(this.start) || day.sameDay(this.end);\r\n };\r\n /**\r\n * Determines whether the given timestamp is between the start and end\r\n * timestamp or lies on the same week as the start or end timestamp.\r\n *\r\n * @param day The timestamp to test.\r\n * @see [[Day.sameWeek]]\r\n */\r\n DaySpan.prototype.matchesWeek = function (day) {\r\n return this.contains(day) || day.sameWeek(this.start) || day.sameWeek(this.end);\r\n };\r\n /**\r\n * Determines whether the given timestamp is between the start and end\r\n * timestamp or lies on the same month as the start or end timestamp.\r\n *\r\n * @param day The timestamp to test.\r\n * @see [[Day.sameMonth]]\r\n */\r\n DaySpan.prototype.matchesMonth = function (day) {\r\n return this.contains(day) || day.sameMonth(this.start) || day.sameMonth(this.end);\r\n };\r\n /**\r\n * Determines whether the given timestamp is between the start and end\r\n * timestamp or lies on the same year as the start or end timestamp.\r\n *\r\n * @param day The timestamp to test.\r\n * @see [[Day.sameYear]]\r\n */\r\n DaySpan.prototype.matchesYear = function (day) {\r\n return this.contains(day) || day.sameYear(this.start) || day.sameYear(this.end);\r\n };\r\n /**\r\n * Calculates the number of milliseconds between the start and end timestamp.\r\n *\r\n * @param op The operation to perform on the result.\r\n * @param absolute Whether the result should always be positive.\r\n * @returns The time between the start and end timestamp.\r\n * @see [[Day.millisBetween]]\r\n */\r\n DaySpan.prototype.millis = function (op, absolute) {\r\n if (op === void 0) { op = Op.DOWN; }\r\n if (absolute === void 0) { absolute = true; }\r\n return this.start.millisBetween(this.end, op, absolute);\r\n };\r\n /**\r\n * Calculates the number of seconds between the start and end timestamp.\r\n *\r\n * @param op The operation to perform on the result.\r\n * @param absolute Whether the result should always be positive.\r\n * @returns The time between the start and end timestamp.\r\n * @see [[Day.secondsBetween]]\r\n */\r\n DaySpan.prototype.seconds = function (op, absolute) {\r\n if (op === void 0) { op = Op.DOWN; }\r\n if (absolute === void 0) { absolute = true; }\r\n return this.start.secondsBetween(this.end, op, absolute);\r\n };\r\n /**\r\n * Calculates the number of minutes between the start and end timestamp.\r\n *\r\n * @param op The operation to perform on the result.\r\n * @param absolute Whether the result should always be positive.\r\n * @returns The time between the start and end timestamp.\r\n * @see [[Day.minutesBetween]]\r\n */\r\n DaySpan.prototype.minutes = function (op, absolute) {\r\n if (op === void 0) { op = Op.DOWN; }\r\n if (absolute === void 0) { absolute = true; }\r\n return this.start.minutesBetween(this.end, op, absolute);\r\n };\r\n /**\r\n * Calculates the number of hours between the start and end timestamp.\r\n *\r\n * @param op The operation to perform on the result.\r\n * @param absolute Whether the result should always be positive.\r\n * @returns The time between the start and end timestamp.\r\n * @see [[Day.hoursBetween]]\r\n */\r\n DaySpan.prototype.hours = function (op, absolute) {\r\n if (op === void 0) { op = Op.DOWN; }\r\n if (absolute === void 0) { absolute = true; }\r\n return this.start.hoursBetween(this.end, op, absolute);\r\n };\r\n /**\r\n * Calculates the number of days between the start and end timestamp.\r\n *\r\n * @param op The operation to perform on the result.\r\n * @param absolute Whether the result should always be positive.\r\n * @returns The time between the start and end timestamp.\r\n * @see [[Day.daysBetween]]\r\n */\r\n DaySpan.prototype.days = function (op, absolute) {\r\n if (op === void 0) { op = Op.DOWN; }\r\n if (absolute === void 0) { absolute = true; }\r\n return this.start.daysBetween(this.end, op, absolute);\r\n };\r\n /**\r\n * Calculates the number of weeks between the start and end timestamp.\r\n *\r\n * @param op The operation to perform on the result.\r\n * @param absolute Whether the result should always be positive.\r\n * @returns The time between the start and end timestamp.\r\n * @see [[Day.weeksBetween]]\r\n */\r\n DaySpan.prototype.weeks = function (op, absolute) {\r\n if (op === void 0) { op = Op.DOWN; }\r\n if (absolute === void 0) { absolute = true; }\r\n return this.start.weeksBetween(this.end, op, absolute);\r\n };\r\n /**\r\n * Calculates the number of months between the start and end timestamp.\r\n *\r\n * @param op The operation to perform on the result.\r\n * @param absolute Whether the result should always be positive.\r\n * @returns The time between the start and end timestamp.\r\n * @see [[Day.monthsBetween]]\r\n */\r\n DaySpan.prototype.months = function (op, absolute) {\r\n if (op === void 0) { op = Op.DOWN; }\r\n if (absolute === void 0) { absolute = true; }\r\n return this.start.monthsBetween(this.end, op, absolute);\r\n };\r\n /**\r\n * Calculates the number of years between the start and end timestamp.\r\n *\r\n * @param op The operation to perform on the result.\r\n * @param absolute Whether the result should always be positive.\r\n * @returns The time between the start and end timestamp.\r\n * @see [[Day.yearsBetween]]\r\n */\r\n DaySpan.prototype.years = function (op, absolute) {\r\n if (op === void 0) { op = Op.DOWN; }\r\n if (absolute === void 0) { absolute = true; }\r\n return this.start.yearsBetween(this.end, op, absolute);\r\n };\r\n /**\r\n * Returns a delta value between 0 and 1 which represents where the\r\n * [[DaySpan.start]] is relative to the given day. The delta value would\r\n * be less than 0 if the start of the event is before the given day.\r\n *\r\n * @param relativeTo The day to find the start delta relative to.\r\n * @return A number between 0 and 1 if the start of this span is in the\r\n * 24-hour period starting at the given timestamp, otherwise the value\r\n * returned may be less than 0 or greater than 1.\r\n */\r\n DaySpan.prototype.startDelta = function (relativeTo) {\r\n return (this.start.time - relativeTo.time) / Constants.MILLIS_IN_DAY;\r\n };\r\n /**\r\n * Returns a delta value between 0 and 1 which represents where the\r\n * [[DaySpan.end]] is relative to the given day. The delta value would\r\n * be greater than 1 if the end of the event is after the given day.\r\n *\r\n * @param relativeTo The day to find the end delta relative to.\r\n * @return A number between 0 and 1 if the end of this span is in the\r\n * 24-hour period starting at the given timestamp, otherwise the value\r\n * returned may be less than 0 or greater than 1.\r\n */\r\n DaySpan.prototype.endDelta = function (relativeTo) {\r\n return (this.end.time - relativeTo.time) / Constants.MILLIS_IN_DAY;\r\n };\r\n /**\r\n * Calculates the bounds for span event if it were placed in a rectangle which\r\n * represents a day (24 hour period). By default the returned values are\r\n * between 0 and 1 and can be scaled by the proper rectangle dimensions or the\r\n * rectangle dimensions can be passed to this function.\r\n *\r\n * @param relativeTo The day to find the bounds relative to. If this is not the\r\n * start of the day the returned bounds is relative to the given time.\r\n * @param dayHeight The height of the rectangle of the day.\r\n * @param dayWidth The width of the rectangle of the day.\r\n * @param columnOffset The offset in the rectangle of the day to adjust this\r\n * span by. This also reduces the width of the returned bounds to keep the\r\n * bounds in the rectangle of the day.\r\n * @param clip `true` if the bounds should stay in the day rectangle, `false`\r\n * and the bounds may go outside the rectangle of the day for multi-day\r\n * spans.\r\n * @param offsetX How much to translate the left & right properties by.\r\n * @param offsetY How much to translate the top & bottom properties by.\r\n * @returns The calculated bounds for this span.\r\n */\r\n DaySpan.prototype.getBounds = function (relativeTo, dayHeight, dayWidth, columnOffset, clip, offsetX, offsetY) {\r\n if (dayHeight === void 0) { dayHeight = 1; }\r\n if (dayWidth === void 0) { dayWidth = 1; }\r\n if (columnOffset === void 0) { columnOffset = 0; }\r\n if (clip === void 0) { clip = true; }\r\n if (offsetX === void 0) { offsetX = 0; }\r\n if (offsetY === void 0) { offsetY = 0; }\r\n var startRaw = this.startDelta(relativeTo);\r\n var endRaw = this.endDelta(relativeTo);\r\n var start = clip ? Math.max(0, startRaw) : startRaw;\r\n var end = clip ? Math.min(1, endRaw) : endRaw;\r\n var left = columnOffset;\r\n var right = dayWidth - left;\r\n var top = start * dayHeight;\r\n var bottom = end * dayHeight;\r\n return {\r\n top: top + offsetY,\r\n bottom: bottom + offsetY,\r\n height: bottom - top,\r\n left: left + offsetX,\r\n right: right + offsetX,\r\n width: right\r\n };\r\n };\r\n /**\r\n * Summarizes this span given an approximate unit of time and a few other\r\n * options. If the start and end are on the same unit, a single value will\r\n * be returned. Otherwise a start and end will be returned with a `delimiter`.\r\n *\r\n * @param type The unit of time this span is for.\r\n * @param dayOfWeek When `true` the weekday of the start and end are included.\r\n * @param short When `true` the short form of weekdays and months will be used.\r\n * @param repeat When `true` the year will be repeated on the start and end\r\n * timestamp even if they are the same year.\r\n * @param contextual When `true` the year will be hidden if it's the current\r\n * year.\r\n * @param delimiter The string to separate the start and end timestamps with.\r\n * @returns The summary of this span.\r\n */\r\n DaySpan.prototype.summary = function (type, dayOfWeek, short, repeat, contextual, delimiter) {\r\n if (dayOfWeek === void 0) { dayOfWeek = true; }\r\n if (short === void 0) { short = false; }\r\n if (repeat === void 0) { repeat = false; }\r\n if (contextual === void 0) { contextual = true; }\r\n if (delimiter === void 0) { delimiter = ' - '; }\r\n var formats = DaySpan.SUMMARY_FORMATS[type];\r\n var today = Day_Day.today();\r\n var showStartYear = !contextual || !this.start.sameYear(today);\r\n var showEndYear = !contextual || !this.end.sameYear(today);\r\n var start = this.start.format(formats(short, dayOfWeek, showStartYear));\r\n var end = this.end.format(formats(short, dayOfWeek, showEndYear));\r\n var summary = start;\r\n if (start !== end) {\r\n if (!repeat) {\r\n summary = this.start.format(formats(short, dayOfWeek, !this.start.sameYear(this.end)));\r\n }\r\n summary += delimiter;\r\n summary += end;\r\n }\r\n else {\r\n summary = start;\r\n }\r\n return summary;\r\n };\r\n /**\r\n * Determines whether the gven span intersects with this span.\r\n *\r\n * @param span The span to test.\r\n * @returns `true` if the spans intersect, otherwise `false`.\r\n */\r\n DaySpan.prototype.intersects = function (span) {\r\n return !(this.end.time < span.start.time ||\r\n this.start.time > span.end.time);\r\n };\r\n /**\r\n * Calculates the intersection between this span and the given span. If there\r\n * is no intersection between the two spans then `null` is returned.\r\n *\r\n * @param span The span to calculate the intersection with.\r\n * @returns The intersection or `null` if none exists.\r\n */\r\n DaySpan.prototype.intersection = function (span) {\r\n var start = this.start.max(span.start);\r\n var end = this.end.min(span.end);\r\n return start.isAfter(end) ? null : new DaySpan(start, end);\r\n };\r\n /**\r\n * Calculates the union between this span and the given span.\r\n *\r\n * @param span The span to calculate the union with.\r\n * @returns The union of the two spans.\r\n */\r\n DaySpan.prototype.union = function (span) {\r\n var start = this.start.min(span.start);\r\n var end = this.end.max(span.end);\r\n return new DaySpan(start, end);\r\n };\r\n /**\r\n * Returns a point [[DaySpan]] with the same start and end timestamp.\r\n *\r\n * @param day The timestamp which will be the start and end.\r\n * @returns The new instance.\r\n * @see [[DaySpan.isPoint]]\r\n */\r\n DaySpan.point = function (day) {\r\n return new DaySpan(day, day);\r\n };\r\n /**\r\n * Formatting functions which assist the [[DaySpan.summary]] function.\r\n */\r\n DaySpan.SUMMARY_FORMATS = (DaySpan__a = {},\r\n DaySpan__a[Units.DAY] = function (short, dayOfWeek, year) {\r\n return (dayOfWeek ? (short ? 'ddd, ' : 'dddd, ') : '') + (short ? 'MMM ' : 'MMMM ') + 'Do' + (year ? ' YYYY' : '');\r\n },\r\n DaySpan__a[Units.WEEK] = function (short, dayOfWeek, year) {\r\n return (dayOfWeek ? (short ? 'ddd, ' : 'dddd, ') : '') + (short ? 'MMM ' : 'MMMM ') + 'Do' + (year ? ' YYYY' : '');\r\n },\r\n DaySpan__a[Units.MONTH] = function (short, dayOfWeek, year) {\r\n return (short ? 'MMM' : 'MMMM') + (year ? ' YYYY' : '');\r\n },\r\n DaySpan__a[Units.YEAR] = function (short, dayOfWeek, year) {\r\n return (year ? 'YYYY' : '');\r\n },\r\n DaySpan__a);\r\n return DaySpan;\r\n}());\r\n\r\nvar DaySpan__a;\r\n\n// CONCATENATED MODULE: ./src/Identifier.ts\n\r\nvar __extends = (this && this.__extends) || (function () {\r\n var extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return function (d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n };\r\n})();\r\n\r\n\r\n\r\n/**\r\n * A class for detecting, parsing, and building identifiers to and from days.\r\n *\r\n * An identifier is a simple value which represents a span of time. It may\r\n * represent an entire year, a quarter (3 months) of a year, a week of a year,\r\n * a month in a year, a specific day of a month of a year, or a specific hour,\r\n * minute, day, and month of a year.\r\n *\r\n * For example:\r\n * - `2018`: The year 2018\r\n * - `201801`: January 2018\r\n * - `2014023`: The 23rd week of 2014\r\n * - `20170311`: March 11th, 2017\r\n * - `201406151651`: June 15th 2016 at 4:51 pm\r\n * - `'0525'`: Year 525 of the first age, Elrond and Elros are born\r\n */\r\nvar Identifier_Identifier = (function () {\r\n function Identifier() {\r\n }\r\n /**\r\n * Determines whether the given identifier is this type.\r\n *\r\n * @param id The identifier to test.\r\n * @returns `true` if the identifier is this type, otherwise `false`.\r\n */\r\n Identifier.prototype.is = function (id) {\r\n return (id + '').length === this.getLength();\r\n };\r\n /**\r\n * Computes the identifier given values taken from a [[Day]].\r\n *\r\n * @param values The values to compute.\r\n * @returns The computed identifier.\r\n */\r\n Identifier.prototype.compute = function () {\r\n var values = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n values[_i] = arguments[_i];\r\n }\r\n var scales = this.getScales();\r\n var total = 0;\r\n for (var i = 0; i < values.length; i++) {\r\n total += values[i] * scales[i];\r\n }\r\n return this.is(total) ? total : Functions.padNumber(total, this.getLength());\r\n };\r\n /**\r\n * Decomputes the given identifier and returns values which describe a span\r\n * of time.\r\n *\r\n * @param id The identifier to decompute.\r\n * @returns The original values which computed the identifier.\r\n */\r\n Identifier.prototype.decompute = function (id) {\r\n var scales = this.getScales();\r\n var total = Functions.isNumber(id) ? id : parseInt(id);\r\n var values = [];\r\n for (var i = 0; i < scales.length - 1; i++) {\r\n var curr = scales[i + 0];\r\n var next = scales[i + 1];\r\n var mod = next / curr;\r\n var value = total % mod;\r\n values.push(value);\r\n total = Math.floor(total / mod);\r\n }\r\n values.push(total);\r\n return values;\r\n };\r\n /**\r\n * Finds which identifier type matches the given identifier, if any.\r\n *\r\n * @param id The identifier to find the type of.\r\n * @returns The found identifier type, otherwise `null` if none exists.\r\n */\r\n Identifier.find = function (id) {\r\n if (this.Time.is(id))\r\n return this.Time;\r\n if (this.Day.is(id))\r\n return this.Day;\r\n if (this.Week.is(id))\r\n return this.Week;\r\n if (this.Month.is(id))\r\n return this.Month;\r\n if (this.Year.is(id))\r\n return this.Year;\r\n return null;\r\n };\r\n /**\r\n * Determines whether the given time span `outer` contains the time span\r\n * `inner`.\r\n *\r\n * @param outer The potentially larger time span `inner` must be contained in.\r\n * @param inner The time span to test is contained inside `outer`.\r\n * @returns `true` if `inner` is equal to or contained in `outer`, otherwise\r\n * `false`.\r\n */\r\n Identifier.contains = function (outer, inner) {\r\n var outerString = outer + '';\r\n return (inner + '').substring(0, outerString.length) === outerString;\r\n };\r\n /**\r\n * The identifier type for an hour of time on a specific day.\r\n */\r\n Identifier.Time = null;\r\n /**\r\n * The identifier type for a specific day.\r\n */\r\n Identifier.Day = null;\r\n /**\r\n * The identifier type for a specific week of a year.\r\n */\r\n Identifier.Week = null;\r\n /**\r\n * The identifier type for a specific month of a year.\r\n */\r\n Identifier.Month = null;\r\n /**\r\n * The identifier type for a specific quarter of a year.\r\n */\r\n Identifier.Quarter = null;\r\n /**\r\n * The identifier type for a specific year.\r\n */\r\n Identifier.Year = null;\r\n return Identifier;\r\n}());\r\n\r\n// YYYYMMddHHmm (12)\r\nvar Identifier_IdentifierTime = (function (_super) {\r\n __extends(IdentifierTime, _super);\r\n function IdentifierTime() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n IdentifierTime.prototype.getScales = function () {\r\n return IdentifierTime.SCALES;\r\n };\r\n IdentifierTime.prototype.getLength = function () {\r\n return IdentifierTime.LENGTH;\r\n };\r\n IdentifierTime.prototype.get = function (day) {\r\n return this.compute(day.minute, day.hour, day.dayOfMonth, day.month + 1, day.year);\r\n };\r\n IdentifierTime.prototype.object = function (id) {\r\n var values = this.decompute(id);\r\n return {\r\n minute: values[0],\r\n hour: values[1],\r\n day: values[2],\r\n month: values[3] - 1,\r\n year: values[4]\r\n };\r\n };\r\n IdentifierTime.prototype.start = function (id) {\r\n var obj = this.object(id);\r\n var start = Day_Day.build(obj.year, obj.month, obj.day, obj.hour, obj.minute);\r\n return start;\r\n };\r\n IdentifierTime.prototype.span = function (id, endInclusive) {\r\n if (endInclusive === void 0) { endInclusive = false; }\r\n var start = this.start(id);\r\n var end = start.endOfHour(endInclusive);\r\n return new DaySpan_DaySpan(start, end);\r\n };\r\n IdentifierTime.prototype.describe = function (id, short) {\r\n if (short === void 0) { short = false; }\r\n var start = this.start(id);\r\n var format = short ? IdentifierTime.DESCRIBE_FORMAT_SHORT : IdentifierTime.DESCRIBE_FORMAT_LONG;\r\n return start.format(format);\r\n };\r\n IdentifierTime.prototype.matches = function (day, id) {\r\n return day.timeIdentifier === id;\r\n /*\r\n let obj: IdentifierObject = this.object(id);\r\n \n return (\r\n day.year === obj.year &&\r\n day.month === obj.month &&\r\n day.dayOfMonth === obj.day &&\r\n day.hour === obj.hour &&\r\n day.minute === obj.minute\r\n );\r\n */\r\n };\r\n IdentifierTime.DESCRIBE_FORMAT_LONG = 'LLL';\r\n IdentifierTime.DESCRIBE_FORMAT_SHORT = 'lll';\r\n IdentifierTime.SCALES = [\r\n 1 /* minute */,\r\n 100 /* hour */,\r\n 10000 /* day */,\r\n 1000000 /* month */,\r\n 100000000 /* year */\r\n ];\r\n IdentifierTime.LENGTH = 12;\r\n return IdentifierTime;\r\n}(Identifier_Identifier));\r\n// YYYYMMdd (8)\r\nvar Identifier_IdentifierDay = (function (_super) {\r\n __extends(IdentifierDay, _super);\r\n function IdentifierDay() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n IdentifierDay.prototype.getScales = function () {\r\n return IdentifierDay.SCALES;\r\n };\r\n IdentifierDay.prototype.getLength = function () {\r\n return IdentifierDay.LENGTH;\r\n };\r\n IdentifierDay.prototype.get = function (day) {\r\n return this.compute(day.dayOfMonth, day.month + 1, day.year);\r\n };\r\n IdentifierDay.prototype.object = function (id) {\r\n var values = this.decompute(id);\r\n return {\r\n day: values[0],\r\n month: values[1] - 1,\r\n year: values[2]\r\n };\r\n };\r\n IdentifierDay.prototype.start = function (id) {\r\n var obj = this.object(id);\r\n var start = Day_Day.build(obj.year, obj.month, obj.day);\r\n return start;\r\n };\r\n IdentifierDay.prototype.span = function (id, endInclusive) {\r\n if (endInclusive === void 0) { endInclusive = false; }\r\n var start = this.start(id);\r\n var end = start.end(endInclusive);\r\n return new DaySpan_DaySpan(start, end);\r\n };\r\n IdentifierDay.prototype.describe = function (id, short) {\r\n if (short === void 0) { short = false; }\r\n var start = this.start(id);\r\n var format = short ? IdentifierDay.DESCRIBE_FORMAT_SHORT : IdentifierDay.DESCRIBE_FORMAT_LONG;\r\n return start.format(format);\r\n };\r\n IdentifierDay.prototype.matches = function (day, id) {\r\n return day.dayIdentifier === id;\r\n /*\r\n let obj: IdentifierObject = this.object(id);\r\n \n return (\r\n day.year === obj.year &&\r\n day.month === obj.month &&\r\n day.dayOfMonth === obj.day\r\n );\r\n */\r\n };\r\n IdentifierDay.DESCRIBE_FORMAT_LONG = 'LL';\r\n IdentifierDay.DESCRIBE_FORMAT_SHORT = 'll';\r\n IdentifierDay.SCALES = [\r\n 1 /* day */,\r\n 100 /* month */,\r\n 10000 /* year */\r\n ];\r\n IdentifierDay.LENGTH = 8;\r\n return IdentifierDay;\r\n}(Identifier_Identifier));\r\n// YYYY0ww (7)\r\nvar Identifier_IdentifierWeek = (function (_super) {\r\n __extends(IdentifierWeek, _super);\r\n function IdentifierWeek() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n IdentifierWeek.prototype.getScales = function () {\r\n return IdentifierWeek.SCALES;\r\n };\r\n IdentifierWeek.prototype.getLength = function () {\r\n return IdentifierWeek.LENGTH;\r\n };\r\n IdentifierWeek.prototype.get = function (day) {\r\n return this.compute(day.week, day.year);\r\n };\r\n IdentifierWeek.prototype.object = function (id) {\r\n var values = this.decompute(id);\r\n return {\r\n week: values[0],\r\n year: values[1]\r\n };\r\n };\r\n IdentifierWeek.prototype.start = function (id) {\r\n var obj = this.object(id);\r\n var start = Day_Day.build(obj.year, 0).withWeek(obj.week);\r\n return start;\r\n };\r\n IdentifierWeek.prototype.span = function (id, endInclusive) {\r\n if (endInclusive === void 0) { endInclusive = false; }\r\n var start = this.start(id);\r\n var end = start.endOfWeek(endInclusive);\r\n return new DaySpan_DaySpan(start, end);\r\n };\r\n IdentifierWeek.prototype.describe = function (id, short) {\r\n if (short === void 0) { short = false; }\r\n var start = this.start(id);\r\n var format = short ? IdentifierWeek.DESCRIBE_FORMAT_SHORT : IdentifierWeek.DESCRIBE_FORMAT_LONG;\r\n return start.format(format);\r\n };\r\n IdentifierWeek.prototype.matches = function (day, id) {\r\n return day.weekIdentifier === id;\r\n /*\r\n let obj: IdentifierObject = this.object(id);\r\n \n return (\r\n day.year === obj.year &&\r\n day.week === obj.week\r\n );\r\n */\r\n };\r\n IdentifierWeek.DESCRIBE_FORMAT_LONG = 'wo [week of] YYYY';\r\n IdentifierWeek.DESCRIBE_FORMAT_SHORT = 'wo [week of] YYYY';\r\n IdentifierWeek.SCALES = [\r\n 1 /* week */,\r\n 1000 /* year */\r\n ];\r\n IdentifierWeek.LENGTH = 7;\r\n return IdentifierWeek;\r\n}(Identifier_Identifier));\r\n// YYYYMM (6)\r\nvar Identifier_IdentifierMonth = (function (_super) {\r\n __extends(IdentifierMonth, _super);\r\n function IdentifierMonth() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n IdentifierMonth.prototype.getScales = function () {\r\n return IdentifierMonth.SCALES;\r\n };\r\n IdentifierMonth.prototype.getLength = function () {\r\n return IdentifierMonth.LENGTH;\r\n };\r\n IdentifierMonth.prototype.get = function (day) {\r\n return this.compute(day.month + 1, day.year);\r\n };\r\n IdentifierMonth.prototype.object = function (id) {\r\n var values = this.decompute(id);\r\n return {\r\n month: values[0] - 1,\r\n year: values[1]\r\n };\r\n };\r\n IdentifierMonth.prototype.start = function (id) {\r\n var obj = this.object(id);\r\n var start = Day_Day.build(obj.year, obj.month);\r\n return start;\r\n };\r\n IdentifierMonth.prototype.span = function (id, endInclusive) {\r\n if (endInclusive === void 0) { endInclusive = false; }\r\n var start = this.start(id);\r\n var end = start.endOfMonth(endInclusive);\r\n return new DaySpan_DaySpan(start, end);\r\n };\r\n IdentifierMonth.prototype.describe = function (id, short) {\r\n if (short === void 0) { short = false; }\r\n var start = this.start(id);\r\n var format = short ? IdentifierMonth.DESCRIBE_FORMAT_SHORT : IdentifierMonth.DESCRIBE_FORMAT_LONG;\r\n return start.format(format);\r\n };\r\n IdentifierMonth.prototype.matches = function (day, id) {\r\n return day.monthIdentifier === id;\r\n /*\r\n let obj: IdentifierObject = this.object(id);\r\n \n return (\r\n day.year === obj.year &&\r\n day.month === obj.month\r\n );\r\n */\r\n };\r\n IdentifierMonth.DESCRIBE_FORMAT_LONG = 'MMMM YYYY';\r\n IdentifierMonth.DESCRIBE_FORMAT_SHORT = 'MMM YYYY';\r\n IdentifierMonth.SCALES = [\r\n 1 /* month */,\r\n 100 /* year */\r\n ];\r\n IdentifierMonth.LENGTH = 6;\r\n return IdentifierMonth;\r\n}(Identifier_Identifier));\r\n// YYYYQ (5)\r\nvar Identifier_IdentifierQuarter = (function (_super) {\r\n __extends(IdentifierQuarter, _super);\r\n function IdentifierQuarter() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n IdentifierQuarter.prototype.getScales = function () {\r\n return IdentifierQuarter.SCALES;\r\n };\r\n IdentifierQuarter.prototype.getLength = function () {\r\n return IdentifierQuarter.LENGTH;\r\n };\r\n IdentifierQuarter.prototype.get = function (day) {\r\n return this.compute(day.quarter, day.year);\r\n };\r\n IdentifierQuarter.prototype.object = function (id) {\r\n var values = this.decompute(id);\r\n return {\r\n quarter: values[0],\r\n year: values[1]\r\n };\r\n };\r\n IdentifierQuarter.prototype.start = function (id) {\r\n var obj = this.object(id);\r\n var start = Day_Day.build(obj.year, (obj.quarter - 1) * 3);\r\n return start;\r\n };\r\n IdentifierQuarter.prototype.span = function (id, endInclusive) {\r\n if (endInclusive === void 0) { endInclusive = false; }\r\n var start = this.start(id);\r\n var end = start.relativeMonths(3).endOfMonth(endInclusive);\r\n return new DaySpan_DaySpan(start, end);\r\n };\r\n IdentifierQuarter.prototype.describe = function (id, short) {\r\n if (short === void 0) { short = false; }\r\n var start = this.start(id);\r\n var format = short ? IdentifierQuarter.DESCRIBE_FORMAT_SHORT : IdentifierQuarter.DESCRIBE_FORMAT_LONG;\r\n return start.format(format);\r\n };\r\n IdentifierQuarter.prototype.matches = function (day, id) {\r\n return day.quarterIdentifier === id;\r\n /*\r\n let obj: IdentifierObject = this.object(id);\r\n \n return (\r\n day.year === obj.year &&\r\n day.quarter === obj.quarter\r\n );\r\n */\r\n };\r\n IdentifierQuarter.DESCRIBE_FORMAT_LONG = 'Qo [quarter] YYYY';\r\n IdentifierQuarter.DESCRIBE_FORMAT_SHORT = 'Qo [quarter] YYYY';\r\n IdentifierQuarter.SCALES = [\r\n 1 /* quarter */,\r\n 10 /* year */\r\n ];\r\n IdentifierQuarter.LENGTH = 5;\r\n return IdentifierQuarter;\r\n}(Identifier_Identifier));\r\n// YYYY (4)\r\nvar Identifier_IdentifierYear = (function (_super) {\r\n __extends(IdentifierYear, _super);\r\n function IdentifierYear() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n IdentifierYear.prototype.getScales = function () {\r\n return IdentifierYear.SCALES;\r\n };\r\n IdentifierYear.prototype.getLength = function () {\r\n return IdentifierYear.LENGTH;\r\n };\r\n IdentifierYear.prototype.get = function (day) {\r\n return this.compute(day.year);\r\n };\r\n IdentifierYear.prototype.object = function (id) {\r\n var values = this.decompute(id);\r\n return {\r\n year: values[0]\r\n };\r\n };\r\n IdentifierYear.prototype.start = function (id) {\r\n var obj = this.object(id);\r\n var start = Day_Day.build(obj.year, 0);\r\n return start;\r\n };\r\n IdentifierYear.prototype.span = function (id, endInclusive) {\r\n if (endInclusive === void 0) { endInclusive = false; }\r\n var start = this.start(id);\r\n var end = start.endOfYear(endInclusive);\r\n return new DaySpan_DaySpan(start, end);\r\n };\r\n IdentifierYear.prototype.describe = function (id, short) {\r\n if (short === void 0) { short = false; }\r\n var start = this.start(id);\r\n var format = short ? IdentifierYear.DESCRIBE_FORMAT_SHORT : IdentifierYear.DESCRIBE_FORMAT_LONG;\r\n return start.format(format);\r\n };\r\n IdentifierYear.prototype.matches = function (day, id) {\r\n return day.year === id;\r\n /*\r\n let obj: IdentifierObject = this.object(id);\r\n \n return (\r\n day.year === obj.year\r\n );\r\n */\r\n };\r\n IdentifierYear.DESCRIBE_FORMAT_LONG = 'YYYY';\r\n IdentifierYear.DESCRIBE_FORMAT_SHORT = 'YYYY';\r\n IdentifierYear.SCALES = [\r\n 1 /* year */\r\n ];\r\n IdentifierYear.LENGTH = 4;\r\n return IdentifierYear;\r\n}(Identifier_Identifier));\r\n// Sets the Identifier types\r\nIdentifier_Identifier.Time = new Identifier_IdentifierTime();\r\nIdentifier_Identifier.Day = new Identifier_IdentifierDay();\r\nIdentifier_Identifier.Week = new Identifier_IdentifierWeek();\r\nIdentifier_Identifier.Month = new Identifier_IdentifierMonth();\r\nIdentifier_Identifier.Quarter = new Identifier_IdentifierQuarter();\r\nIdentifier_Identifier.Year = new Identifier_IdentifierYear();\r\n\n// CONCATENATED MODULE: ./src/Suffix.ts\n\r\n/**\r\n * A class which takes a number and determines the suffix for that number.\r\n *\r\n * ```typescript\r\n * Suffix.CACHE[ 2 ]; // 2nd\r\n * Suffix.determine( 3 ); // rd\r\n * Suffix.get( 4 ); // th\r\n * Suffix.get( 4, true ); // 4th\r\n * ```\r\n */\r\nvar Suffix = (function () {\r\n function Suffix() {\r\n }\r\n Object.defineProperty(Suffix, \"CACHE\", {\r\n /**\r\n * The cache of number & suffix pairs.\r\n */\r\n get: function () {\r\n if (!this._CACHE) {\r\n this._CACHE = [];\r\n for (var i = 0; i <= this._CACHE_SIZE; i++) {\r\n this._CACHE[i] = this.get(i, true);\r\n }\r\n }\r\n return this._CACHE;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Determines the suffix for a given number.\r\n *\r\n * @param value The number to find the suffix for.\r\n * @returns The suffix determined.\r\n */\r\n Suffix.determine = function (value) {\r\n return value >= 11 && value <= 13 ? 'th' : this.MAP[value % this.MAP.length];\r\n };\r\n /**\r\n * Gets the suffix for a number and optionally appends it before the suffix.\r\n *\r\n * @param value The number to get the suffix for.\r\n * @param prepend When `true` the value is prepended to the suffix.\r\n * @returns The suffix or value & suffix pair determined.\r\n */\r\n Suffix.get = function (value, prepend) {\r\n if (prepend === void 0) { prepend = false; }\r\n var suffix = this.determine(value);\r\n return prepend ? value + suffix : suffix;\r\n };\r\n /**\r\n * The array of suffixes used.\r\n */\r\n Suffix.MAP = [\r\n 'th', 'st', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th'\r\n ];\r\n /**\r\n * The number of values to store in the cache (inclusive).\r\n */\r\n Suffix._CACHE_SIZE = 366;\r\n return Suffix;\r\n}());\r\n\r\n\n// CONCATENATED MODULE: ./src/Iterator.ts\n\r\n\r\n/**\r\n * An action to perform on the source as instructed by the iterator.\r\n */\r\nvar IteratorAction;\r\n(function (IteratorAction) {\r\n /**\r\n * Continue iteration.\r\n */\r\n IteratorAction[IteratorAction[\"Continue\"] = 0] = \"Continue\";\r\n /**\r\n * Stop iteration.\r\n */\r\n IteratorAction[IteratorAction[\"Stop\"] = 1] = \"Stop\";\r\n /**\r\n * Remove the current item if possible, and continue iteration.\r\n */\r\n IteratorAction[IteratorAction[\"Remove\"] = 2] = \"Remove\";\r\n})(IteratorAction = IteratorAction || (IteratorAction = {}));\r\n/**\r\n * A class that allows an iteratable source to be iterated any number of times\r\n * by providing the following functionality:\r\n *\r\n * - [[Iterator.isEmpty]]: Determines whether the source contains any items.\r\n * - [[Iterator.first]]: Gets the first item in the source.\r\n * - [[Iterator.count]]: Counds the number of items in the source.\r\n * - [[Iterator.list]]: Builds a list of the items in the source.\r\n * - [[Iterator.object]]: Builds an object of the items in the source.\r\n * - [[Iterator.reduce]]: Reduces the items in the source down to a single value.\r\n * - [[Iterator.purge]]: Removes items from the source which meet some criteria.\r\n * - [[Iterator.filter]]: Returns a subset of items that meet some criteria by\r\n * returning a new Iterator.\r\n * - [[Iterator.map]]: Maps each item in the source to another item by returning\r\n * a new Iterator.\r\n * - [[Iterator.iterate]]: Invokes a function for each item in the source.\r\n *\r\n * The following static functions exist to help iterate simple sources:\r\n *\r\n * - [[Iterator.forArray]]: Iterates an array, optionally reverse\r\n * - [[Iterator.forObject]]: Iterates the properties of an object, optionally\r\n * just the properties explicitly set on the object.\r\n *\r\n * ```typescript\r\n * let iter = object.iterateThings();\r\n * iter.isEmpty(); // no items?\r\n * iter.isEmpty(d => d.flag); // no items that meet some criteria?\r\n * iter.count(); // number of items\r\n * iter.count(d => d.flag); // number of items that meet some criteria\r\n * iter.first(); // first item\r\n * iter.first(d => d.flag); // first item that meets some criteria\r\n * iter.list(); // get all items as array\r\n * iter.list(myArray); // add all items to given array\r\n * iter.list([], d => d.flag); // get all items as array that meet some criteria\r\n * iter.object(d => d.id); // get all items as an object keyed by a value (ex: id)\r\n * iter.object(d => d.id, {},\r\n * d => d.flag); // get all items as an object keyed by a value where the item meets some criteria (ex: key id if flag is truthy)\r\n * iter.purge(d => d.flag); // remove all items from source that meet some criteria\r\n * iter.filter(d => d.flag); // returns an iterator which iterates a subset of items which meet some criteria\r\n * iter.reduce(0,\r\n * (d, t) => t + d.size); // reduces all items to a single value (ex: sums all size)\r\n * iter.reduce(0,\r\n * (d, t) => t + d.size,\r\n * d => d.flag); // reduces all items to a single value (ex: sums all size) where the item meets some criteria\r\n * iter.map(d => d.subitem); // return an iterator for subitems if they exist\r\n * iter.iterate(d => log(d)); // do something for each item\r\n * ```\r\n *\r\n * @typeparam T The type of item being iterated.\r\n */\r\nvar Iterator_Iterator = (function () {\r\n /**\r\n * Creates a new Iterator given a source.\r\n *\r\n * @param source The source of items to iterator.\r\n */\r\n function Iterator(source) {\r\n /**\r\n * A result of the iteration passed to [[Iterator.stop]].\r\n */\r\n this.result = undefined;\r\n this.source = source;\r\n }\r\n /**\r\n * Returns a clone of this iterator with the same source. This is necessary\r\n * if you want to iterate all or a portion of the source while already\r\n * iterating it (like a nested loop).\r\n */\r\n Iterator.prototype.clone = function () {\r\n return new Iterator(this.source);\r\n };\r\n /**\r\n * Passes the given item to the iterator callback and returns the action\r\n * requested at this point in iteration.\r\n *\r\n * @param item The current item being iterated.\r\n */\r\n Iterator.prototype.act = function (item) {\r\n this.action = IteratorAction.Continue;\r\n this.callback(item, this);\r\n return this.action;\r\n };\r\n /**\r\n * Stops iteration and optionally sets the result of the iteration.\r\n *\r\n * @param result The result of the iteration.\r\n */\r\n Iterator.prototype.stop = function (result) {\r\n this.result = result;\r\n this.action = IteratorAction.Stop;\r\n return this;\r\n };\r\n /**\r\n * Signals to the iterator source that the current item wants to be removed.\r\n */\r\n Iterator.prototype.remove = function () {\r\n this.action = IteratorAction.Remove;\r\n return this;\r\n };\r\n /**\r\n * Determines with this iterator is empty. A filter function can be specified\r\n * to only check for items which match certain criteria.\r\n *\r\n * @param filter A function to the checks items for certain criteria.\r\n * @returns `true` if no valid items exist in the source.\r\n */\r\n Iterator.prototype.isEmpty = function (filter) {\r\n if (filter === void 0) { filter = null; }\r\n var empty = true;\r\n this.iterate(function (item, iterator) {\r\n if (filter && !filter(item)) {\r\n return;\r\n }\r\n empty = false;\r\n iterator.stop();\r\n });\r\n return empty;\r\n };\r\n /**\r\n * Counts the number of items in the iterator. A filter function can be\r\n * specified to only count items which match certain criteria.\r\n *\r\n * @param filter A function to count items for certain criteria.\r\n * @returns The number of items in the source that optionally match the given\r\n * criteria.\r\n */\r\n Iterator.prototype.count = function (filter) {\r\n if (filter === void 0) { filter = null; }\r\n var total = 0;\r\n this.iterate(function (item, iterator) {\r\n if (filter && !filter(item)) {\r\n return;\r\n }\r\n total++;\r\n });\r\n return total;\r\n };\r\n /**\r\n * Returns the first item in the iterator. A filter function can be specified\r\n * to only return the first item which matches certain criteria.\r\n *\r\n * @param filter A function to compare items to to match certain criteria.\r\n * @returns The first item found that optonally matches the given criteria.\r\n */\r\n Iterator.prototype.first = function (filter) {\r\n if (filter === void 0) { filter = null; }\r\n var first = null;\r\n this.iterate(function (item, iterator) {\r\n if (filter && !filter(item)) {\r\n return;\r\n }\r\n first = item;\r\n iterator.stop();\r\n });\r\n return first;\r\n };\r\n /**\r\n * Builds a list of items from the source. A filter function can be specified\r\n * so the resulting list only contain items that match certain criteria.\r\n *\r\n * @param out The array to place the items in.\r\n * @param filter The function which determines which items are added to the list.\r\n * @returns The reference to `out` which has had items added to it which\r\n * optionally match the given criteria.\r\n */\r\n Iterator.prototype.list = function (out, filter) {\r\n if (out === void 0) { out = []; }\r\n if (filter === void 0) { filter = null; }\r\n this.iterate(function (item, iterator) {\r\n if (filter && !filter(item)) {\r\n return;\r\n }\r\n out.push(item);\r\n });\r\n return out;\r\n };\r\n /**\r\n * Builds an object of items from the source keyed by a result returned by\r\n * a `getKey` function.\r\n *\r\n * @param getKey The function which returns the key of the object.\r\n * @param out The object to place the items in.\r\n * @param filter The function which determines which items are set on the object.\r\n * @returns The reference to `out` which has had items set to it which\r\n * optionally match the given criteria.\r\n */\r\n Iterator.prototype.object = function (getKey, out, filter) {\r\n if (out === void 0) { out = {}; }\r\n if (filter === void 0) { filter = null; }\r\n this.iterate(function (item, iterator) {\r\n if (filter && !filter(item)) {\r\n return;\r\n }\r\n var key = getKey(item);\r\n out[key] = item;\r\n });\r\n return out;\r\n };\r\n /**\r\n * Returns a new iterator that only returns a maximum number of items.\r\n *\r\n * @param amount The maximum number of items to return.\r\n * @returns A new iterator which returns a maximum number of items.\r\n */\r\n Iterator.prototype.take = function (amount) {\r\n var _this = this;\r\n return new Iterator(function (next) {\r\n _this.iterate(function (item, prev) {\r\n switch (next.act(item)) {\r\n case IteratorAction.Stop:\r\n prev.stop();\r\n break;\r\n case IteratorAction.Remove:\r\n prev.remove();\r\n break;\r\n }\r\n if (--amount <= 0) {\r\n prev.stop();\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Returns a new iterator that skips the given number of items from the items\r\n * in this iterator.\r\n *\r\n * @param amount The number of items to skip.\r\n * @returns A new iterator which skipped the given number of items.\r\n */\r\n Iterator.prototype.skip = function (amount) {\r\n var _this = this;\r\n return new Iterator(function (next) {\r\n var skipped = 0;\r\n _this.iterate(function (item, prev) {\r\n if (skipped >= amount) {\r\n switch (next.act(item)) {\r\n case IteratorAction.Stop:\r\n prev.stop();\r\n break;\r\n case IteratorAction.Remove:\r\n prev.remove();\r\n break;\r\n }\r\n }\r\n skipped++;\r\n });\r\n });\r\n };\r\n /**\r\n * Returns a new iterator thats items are the items in this iterator followed\r\n * by the items in the given iterators.\r\n *\r\n * @param iterators The iterators to append after this one.\r\n * @returns A new iterator based on this iterator followed by the given.\r\n */\r\n Iterator.prototype.append = function () {\r\n var iterators = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n iterators[_i] = arguments[_i];\r\n }\r\n return Iterator.join.apply(Iterator, [this].concat(iterators));\r\n };\r\n /**\r\n * Returns a new iterator thats items are the items in the given iterators\r\n * followed by the items in this iterator.\r\n *\r\n * @param iterators The iterators to prepend before this one.\r\n * @returns A new iterator based on the given iterators followed by this.\r\n */\r\n Iterator.prototype.prepend = function () {\r\n var iterators = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n iterators[_i] = arguments[_i];\r\n }\r\n return Iterator.join.apply(Iterator, iterators.concat([this]));\r\n };\r\n /**\r\n * Removes items from the source that match certain criteria.\r\n *\r\n * @param filter The function which determines which items to remove.\r\n */\r\n Iterator.prototype.purge = function (filter) {\r\n this.iterate(function (item, iterator) {\r\n if (filter(item)) {\r\n iterator.remove();\r\n }\r\n });\r\n return this;\r\n };\r\n /**\r\n * Returns an iterator which takes items from this iterator and presents them\r\n * in reverse.\r\n *\r\n * @returns A new iterator with the items in this iterator in reverse.\r\n */\r\n Iterator.prototype.reverse = function () {\r\n var _this = this;\r\n return new Iterator(function (iterator) {\r\n var items = _this.list();\r\n var removed = [];\r\n for (var i = items.length - 1; i >= 0; i--) {\r\n var item = items[i];\r\n var action = iterator.act(item);\r\n if (action === IteratorAction.Stop) {\r\n break;\r\n }\r\n if (action === IteratorAction.Remove) {\r\n removed.push(item);\r\n }\r\n }\r\n if (removed.length > 0) {\r\n _this.purge(function (item) { return removed.indexOf(item) !== -1; });\r\n }\r\n });\r\n };\r\n /**\r\n * Reduces all the items in the source to a single value given the initial\r\n * value and a function to convert an item and the current reduced value\r\n */\r\n Iterator.prototype.reduce = function (initial, reducer, filter) {\r\n if (filter === void 0) { filter = null; }\r\n var reduced = initial;\r\n this.iterate(function (item, iterator) {\r\n if (filter && !filter(item)) {\r\n return;\r\n }\r\n reduced = reducer(item, reduced);\r\n });\r\n return reduced;\r\n };\r\n /**\r\n * Returns an iterator where this iterator is the source and the returned\r\n * iterator is built on a subset of items which pass a `filter` function.\r\n *\r\n * @param filter The function which determines if an item should be iterated.\r\n * @returns A new iterator for the filtered items from this iterator.\r\n */\r\n Iterator.prototype.filter = function (filter) {\r\n var _this = this;\r\n return new Iterator(function (next) {\r\n _this.iterate(function (prevItem, prev) {\r\n if (filter(prevItem)) {\r\n switch (next.act(prevItem)) {\r\n case IteratorAction.Stop:\r\n prev.stop();\r\n break;\r\n case IteratorAction.Remove:\r\n prev.remove();\r\n break;\r\n }\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Returns an iterator where this iterator is the source and the returned\r\n * iterator is built from mapped items pulled from items in the source\r\n * of this iterator. If the given callback `outerCallback` does not return\r\n * a mapped value then the returned iterator will not see the item. A filter\r\n * function can be specified to only look at mapping items which match\r\n * certain criteria.\r\n *\r\n * @param mapper The function which maps an item to another.\r\n * @param filter The function which determines if an item should be mapped.\r\n * @returns A new iterator for the mapped items from this iterator.\r\n */\r\n Iterator.prototype.map = function (mapper, filter) {\r\n var _this = this;\r\n if (filter === void 0) { filter = null; }\r\n return new Iterator(function (next) {\r\n _this.iterate(function (prevItem, prev) {\r\n if (filter && !filter(prevItem)) {\r\n return;\r\n }\r\n var nextItem = mapper(prevItem, prev);\r\n if (Functions.isDefined(nextItem)) {\r\n switch (next.act(nextItem)) {\r\n case IteratorAction.Stop:\r\n prev.stop();\r\n break;\r\n case IteratorAction.Remove:\r\n prev.remove();\r\n break;\r\n }\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Invokes the callback for each item in the source of this iterator. The\r\n * second argument in the callback is the reference to this iterator and\r\n * [[Iterator.stop]] can be called at anytime to cease iteration.\r\n *\r\n * @param callback The function to invoke for each item in this iterator.\r\n */\r\n Iterator.prototype.iterate = function (callback) {\r\n this.result = undefined;\r\n this.callback = callback;\r\n this.action = IteratorAction.Continue;\r\n this.source(this);\r\n this.callback = null;\r\n return this;\r\n };\r\n /**\r\n * Passes the result of the iteration to the given function if a truthy\r\n * result was passed to [[Iterator.stop]].\r\n *\r\n * @param getResult The function to pass the result to if it exists.\r\n */\r\n Iterator.prototype.withResult = function (getResult) {\r\n if (this.result) {\r\n getResult(this.result);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Returns an iterator for the given array optionally iterating it in reverse.\r\n *\r\n * @param items The array of items to iterate.\r\n * @param reverse If the array should be iterated in reverse.\r\n * @returns A new iterator for the given array.\r\n */\r\n Iterator.forArray = function (items, reverse) {\r\n if (reverse === void 0) { reverse = false; }\r\n return new Iterator(function (iterator) {\r\n if (reverse) {\r\n for (var i = items.length - 1; i >= 0; i--) {\r\n switch (iterator.act(items[i])) {\r\n case IteratorAction.Stop:\r\n return;\r\n case IteratorAction.Remove:\r\n items.splice(i, 1);\r\n break;\r\n }\r\n }\r\n }\r\n else {\r\n for (var i = 0; i < items.length; i++) {\r\n switch (iterator.act(items[i])) {\r\n case IteratorAction.Stop:\r\n return;\r\n case IteratorAction.Remove:\r\n items.splice(i, 1);\r\n i--;\r\n break;\r\n }\r\n }\r\n }\r\n });\r\n };\r\n /**\r\n * Returns an iterator for the given object optionally checking the\r\n * `hasOwnProperty` function on the given object.\r\n *\r\n * @param items The object to iterate.\r\n * @param hasOwnProperty If `hasOwnProperty` should be checked.\r\n * @returns A new iterator for the given object.\r\n */\r\n Iterator.forObject = function (items, hasOwnProperty) {\r\n if (hasOwnProperty === void 0) { hasOwnProperty = true; }\r\n return new Iterator(function (iterator) {\r\n for (var key in items) {\r\n if (hasOwnProperty && !items.hasOwnProperty(key)) {\r\n continue;\r\n }\r\n switch (iterator.act(items[key])) {\r\n case IteratorAction.Stop:\r\n return;\r\n case IteratorAction.Remove:\r\n delete items[key];\r\n break;\r\n }\r\n }\r\n });\r\n };\r\n /**\r\n * Joins all the given iterators into a single iterator where the items\r\n * returned are in the same order as passed to this function. If any items\r\n * are removed from the returned iterator they will be removed from the given\r\n * iterator if it supports removal.\r\n *\r\n * @param iterators The array of iterators to join as one.\r\n * @returns A new iterator for the given iterators.\r\n */\r\n Iterator.join = function () {\r\n var iterators = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n iterators[_i] = arguments[_i];\r\n }\r\n return new Iterator(function (parent) {\r\n for (var _i = 0, iterators_1 = iterators; _i < iterators_1.length; _i++) {\r\n var child = iterators_1[_i];\r\n child.iterate(function (item, childIterator) {\r\n switch (parent.act(item)) {\r\n case IteratorAction.Remove:\r\n childIterator.remove();\r\n break;\r\n case IteratorAction.Stop:\r\n childIterator.stop();\r\n break;\r\n }\r\n });\r\n if (child.action === IteratorAction.Stop) {\r\n return;\r\n }\r\n }\r\n });\r\n };\r\n /**\r\n * Returns a new iterator with no items.\r\n *\r\n * @returns A new iterator with no items.\r\n */\r\n Iterator.empty = function () {\r\n return new Iterator(function (parent) { });\r\n };\r\n return Iterator;\r\n}());\r\n\r\n\n// CONCATENATED MODULE: ./src/ScheduleModifier.ts\n\r\n\r\n\r\n/**\r\n * A class that can modify the events of a schedule by storing [[Identifier]]s\r\n * and an associated value.\r\n *\r\n * @typeparam T The type of data that modifies the schedule.\r\n */\r\nvar ScheduleModifier_ScheduleModifier = (function () {\r\n /**\r\n * Creates a new schedule modifier.\r\n */\r\n function ScheduleModifier() {\r\n this.map = {};\r\n }\r\n /**\r\n * Clears the modifier of all modifications.\r\n */\r\n ScheduleModifier.prototype.clear = function () {\r\n this.map = {};\r\n return this;\r\n };\r\n /**\r\n * Returns `true` if this modifier lacks any modifications, otherwise `false`.\r\n */\r\n ScheduleModifier.prototype.isEmpty = function () {\r\n // @ts-ignore\r\n for (var id in this.map) {\r\n return !id;\r\n }\r\n return true;\r\n };\r\n /**\r\n * Gets the most specific value in this modifier for the given day, if none\r\n * exists `otherwise` is returned. A modifier can have multiple values for a\r\n * given day because [[Identifier]]s represent a span of time.\r\n *\r\n * @param day The day to get a value for.\r\n * @param otherwise What to return if no value exists for the given day.\r\n * @param lookAtTime If the specific time of the given day should be looked at.\r\n * @returns The most specific value for the given day, or `otherwise`.\r\n */\r\n ScheduleModifier.prototype.get = function (day, otherwise, lookAtTime) {\r\n if (lookAtTime === void 0) { lookAtTime = true; }\r\n var map = this.map;\r\n return (lookAtTime && map[day.timeIdentifier]) ||\r\n map[day.dayIdentifier] ||\r\n map[day.monthIdentifier] ||\r\n map[day.weekIdentifier] ||\r\n map[day.quarterIdentifier] ||\r\n otherwise;\r\n };\r\n /**\r\n * Gets all values in this modifier for the given day. If none exist, an empty\r\n * array is returned. The values returned in the array are returned in most\r\n * specific to least specific.\r\n *\r\n * @param day The day to get the values for.\r\n * @returns An array of values (modifications) for the given day.\r\n */\r\n ScheduleModifier.prototype.getAll = function (day) {\r\n var map = this.map;\r\n var all = [];\r\n if (map[day.timeIdentifier])\r\n all.push(map[day.timeIdentifier]);\r\n if (map[day.dayIdentifier])\r\n all.push(map[day.dayIdentifier]);\r\n if (map[day.monthIdentifier])\r\n all.push(map[day.monthIdentifier]);\r\n if (map[day.weekIdentifier])\r\n all.push(map[day.weekIdentifier]);\r\n if (map[day.quarterIdentifier])\r\n all.push(map[day.quarterIdentifier]);\r\n return all;\r\n };\r\n /**\r\n * Moves the value/modification from one identifier to another.\r\n *\r\n * @param from The day to take the identifier from.\r\n * @param fromType The identifier type.\r\n * @param to The day to move the value to.\r\n * @param toType The identifier type to move the value to.\r\n */\r\n ScheduleModifier.prototype.move = function (from, fromType, to, toType) {\r\n var fromIdentifier = fromType.get(from);\r\n var toIdentifier = toType.get(to);\r\n this.map[toIdentifier] = this.map[fromIdentifier];\r\n delete this.map[fromIdentifier];\r\n return this;\r\n };\r\n /**\r\n * Sets the value/modification in this map given a day, the value, and the\r\n * identifier type.\r\n *\r\n * @param day The day to take an identifier from.\r\n * @param value The value/modification to set.\r\n * @param type The identifier type.\r\n */\r\n ScheduleModifier.prototype.set = function (day, value, type) {\r\n this.map[type.get(day)] = value;\r\n return this;\r\n };\r\n /**\r\n * Removes the value/modification from this modifier based on the identifier\r\n * pulled from the day.\r\n *\r\n * @param day The day to take an identifier from.\r\n * @param type The identifier type.\r\n */\r\n ScheduleModifier.prototype.unset = function (day, type) {\r\n delete this.map[type.get(day)];\r\n return this;\r\n };\r\n /**\r\n * Iterates through the modifiers passing the identifier and the related value.\r\n *\r\n * @returns A new instance of an [[Iterator]].\r\n */\r\n ScheduleModifier.prototype.iterate = function () {\r\n var _this = this;\r\n return new Iterator_Iterator(function (iterator) {\r\n var map = _this.map;\r\n for (var rawId in map) {\r\n var asNumber = parseInt(rawId);\r\n var validAsNumber = asNumber + '' === rawId;\r\n var id = validAsNumber ? asNumber : rawId;\r\n switch (iterator.act([id, map[rawId]])) {\r\n case IteratorAction.Stop:\r\n return;\r\n case IteratorAction.Remove:\r\n delete map[rawId];\r\n break;\r\n }\r\n }\r\n });\r\n };\r\n /**\r\n * Queries the modifier for all values/modifications which fall in the time\r\n * span that the given identifier represents. All identifiers and their value\r\n * are passed to the given callback.\r\n *\r\n * @param prefix The identifier\r\n * @returns A new instance of an [[Iterator]].\r\n */\r\n ScheduleModifier.prototype.query = function (query) {\r\n return this.iterate()\r\n .filter(function (_a) {\r\n var id = _a[0], value = _a[1];\r\n return Identifier_Identifier.contains(query, id);\r\n });\r\n ;\r\n };\r\n /**\r\n * Returns all identifiers stored in this modifier.\r\n */\r\n ScheduleModifier.prototype.identifiers = function (filter) {\r\n return this.iterate()\r\n .filter(function (_a) {\r\n var id = _a[0], value = _a[1];\r\n return !filter || filter(value, id);\r\n })\r\n .map(function (_a) {\r\n var id = _a[0];\r\n return id;\r\n });\r\n };\r\n /**\r\n * Builds a list of spans and the associated values. The spans are calculated\r\n * from the identiier key via [[Identifier.span]].\r\n *\r\n * @param endInclusive If the end date in the spans should be the last\r\n * millisecond of the timespan or the first millisecond of the next.\r\n * @returns An array of spans calculated from the identifiers with the\r\n * associated values/modifications.\r\n */\r\n ScheduleModifier.prototype.spans = function (endInclusive) {\r\n if (endInclusive === void 0) { endInclusive = false; }\r\n return this.iterate()\r\n .map(function (_a) {\r\n var id = _a[0], value = _a[1];\r\n var type = Identifier_Identifier.find(id);\r\n if (type) {\r\n var span = type.span(id, endInclusive);\r\n return { span: span, value: value };\r\n }\r\n });\r\n };\r\n /**\r\n * Builds a list of the descriptions of the identifiers in this modifier.\r\n *\r\n * @param short If the description should use shorter language or longer.\r\n * @returns The built list of descriptions.\r\n */\r\n ScheduleModifier.prototype.describe = function (short) {\r\n if (short === void 0) { short = false; }\r\n return this.iterate()\r\n .map(function (_a) {\r\n var id = _a[0];\r\n var type = Identifier_Identifier.find(id);\r\n if (type) {\r\n return type.describe(id, short);\r\n }\r\n });\r\n };\r\n /**\r\n * Builds a map of the values/modifications keyed by the descripton of the\r\n * identifier computed via [[Identifier.describe]].\r\n *\r\n * @param short If the description should use shorter language or longer.\r\n * @returns The built map of description to values/modifications.\r\n */\r\n ScheduleModifier.prototype.describeMap = function (short) {\r\n if (short === void 0) { short = false; }\r\n var map = this.map;\r\n var out = {};\r\n for (var id in map) {\r\n var type = Identifier_Identifier.find(id);\r\n if (type) {\r\n out[type.describe(id, short)] = map[id];\r\n }\r\n }\r\n return out;\r\n };\r\n return ScheduleModifier;\r\n}());\r\n\r\n\n// CONCATENATED MODULE: ./src/Schedule.ts\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10_moment__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10_moment___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_10_moment__);\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n// @ts-ignore\r\n\r\n/**\r\n * A class which describes when an event occurs over what time and if it repeats.\r\n *\r\n * @typeparam M The type of metadata stored in the schedule.\r\n */\r\nvar Schedule_Schedule = (function () {\r\n /**\r\n * Creates a schedule based on the given input.\r\n *\r\n * @param input The input which describes the schedule of events.\r\n */\r\n function Schedule(input) {\r\n this.exclude = new ScheduleModifier_ScheduleModifier();\r\n this.include = new ScheduleModifier_ScheduleModifier();\r\n this.cancel = new ScheduleModifier_ScheduleModifier();\r\n this.meta = new ScheduleModifier_ScheduleModifier();\r\n if (Functions.isDefined(input)) {\r\n this.set(input);\r\n }\r\n }\r\n /**\r\n * Sets the schedule with the given input.\r\n *\r\n * @param input The input which describes the schedule of events.\r\n * @param parseMeta A function to use when parsing meta input into the desired type.\r\n * @see [[Parse.schedule]]\r\n */\r\n Schedule.prototype.set = function (input, parseMeta) {\r\n if (parseMeta === void 0) { parseMeta = (function (x) { return x; }); }\r\n Parse_Parse.schedule(input, Functions.coalesce(input.parseMeta, parseMeta), this);\r\n return this;\r\n };\r\n Object.defineProperty(Schedule.prototype, \"lastTime\", {\r\n /**\r\n * Returns the last event time specified or `undefined` if this schedule is\r\n * for an all day event.\r\n */\r\n get: function () {\r\n return this.times[this.times.length - 1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Schedule.prototype, \"identifierType\", {\r\n /**\r\n * The [[Identifier]] for this schedule. Either [[Identifier.Day]] or\r\n * [[Identifier.Time]].\r\n */\r\n get: function () {\r\n return this.isFullDay() ? Identifier_Identifier.Day : Identifier_Identifier.Time;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Updates the [[Schedule.durationInDays]] variable based on the\r\n * [[Schedule.lastTime]] (if any), the [[Schedule.duration]] and it's\r\n * [[Schedule.durationUnit]].\r\n */\r\n Schedule.prototype.updateDurationInDays = function () {\r\n var start = this.lastTime ? this.lastTime.toMilliseconds() : 0;\r\n var duration = this.duration * (Constants.DURATION_TO_MILLIS[this.durationUnit] || 0);\r\n var exclude = Constants.MILLIS_IN_DAY;\r\n var day = Constants.MILLIS_IN_DAY;\r\n this.durationInDays = Math.max(0, Math.ceil((start + duration - exclude) / day));\r\n return this;\r\n };\r\n /**\r\n * Updates [[Schedule.checks]] based on the frequencies that were specified\r\n * in the schedule input.\r\n */\r\n Schedule.prototype.updateChecks = function () {\r\n this.checks = Parse_Parse.givenFrequency([\r\n this.year,\r\n this.month,\r\n this.week,\r\n this.weekOfYear,\r\n this.fullWeekOfYear,\r\n this.weekspanOfYear,\r\n this.lastFullWeekOfYear,\r\n this.lastWeekspanOfYear,\r\n this.weekOfMonth,\r\n this.weekspanOfMonth,\r\n this.fullWeekOfMonth,\r\n this.lastWeekspanOfMonth,\r\n this.lastFullWeekOfMonth,\r\n this.dayOfWeek,\r\n this.dayOfMonth,\r\n this.lastDayOfMonth,\r\n this.dayOfYear\r\n ]);\r\n return this;\r\n };\r\n /**\r\n * Determines whether the given day lies between the earliest and latest\r\n * valid day in the schedule.\r\n *\r\n * @param day The day to test.\r\n * @returns `true` if the day lies in the schedule, otherwise `false`.\r\n * @see [[Schedule.start]]\r\n * @see [[Schedule.end]]\r\n */\r\n Schedule.prototype.matchesSpan = function (day) {\r\n return (this.start === null || day.isSameOrAfter(this.start)) &&\r\n (this.end === null || day.isBefore(this.end));\r\n };\r\n /**\r\n * Determines whether the given range overlaps with the earliest and latest\r\n * valid days in this schedule (if any).\r\n *\r\n * @param start The first day in the range.\r\n * @param end The last day in the range.\r\n * @returns `true` if the range intersects with the schedule, otherwise `false`.\r\n * @see [[Schedule.start]]\r\n * @see [[Schedule.end]]\r\n */\r\n Schedule.prototype.matchesRange = function (start, end) {\r\n if (this.start && end.isBefore(this.start)) {\r\n return false;\r\n }\r\n if (this.end && start.isAfter(this.end)) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n /**\r\n * Determines whether the given day is explicitly excluded in the schedule.\r\n *\r\n * @param day The day to test.\r\n * @param lookAtTime lookAtTime If the specific time of the given day should\r\n * be looked at.\r\n * @returns `true` if the day was excluded, otherwise `false`.\r\n */\r\n Schedule.prototype.isExcluded = function (day, lookAtTime) {\r\n if (lookAtTime === void 0) { lookAtTime = true; }\r\n return this.exclude.get(day, false, lookAtTime);\r\n };\r\n /**\r\n * Determines whether the given day is explicitly included in the schedule.\r\n *\r\n * @param day The day to test.\r\n * @param lookAtTime lookAtTime If the specific time of the given day should\r\n * be looked at.\r\n * @returns `true` if the day is NOT explicitly included, otherwise `false`.\r\n */\r\n Schedule.prototype.isIncluded = function (day, lookAtTime) {\r\n if (lookAtTime === void 0) { lookAtTime = true; }\r\n return this.include.get(day, false, lookAtTime);\r\n };\r\n /**\r\n * Determines whether the given day is cancelled in the schedule.\r\n *\r\n * @param day The day to test.\r\n * @param lookAtTime lookAtTime If the specific time of the given day should\r\n * be looked at.\r\n * @returns `true` if the day was cancelled, otherwise `false`.\r\n */\r\n Schedule.prototype.isCancelled = function (day, lookAtTime) {\r\n if (lookAtTime === void 0) { lookAtTime = true; }\r\n return this.cancel.get(day, false, lookAtTime);\r\n };\r\n /**\r\n * Returns the metadata for the given day or `null` if there is none.\r\n *\r\n * @param day The day to return the metadata for.\r\n * @param otherwise The data to return if none exists for the given day.\r\n * @param lookAtTime lookAtTime If the specific time of the given day should\r\n * be looked at.\r\n * @returns The metadata or `null`.\r\n */\r\n Schedule.prototype.getMeta = function (day, otherwise, lookAtTime) {\r\n if (otherwise === void 0) { otherwise = null; }\r\n if (lookAtTime === void 0) { lookAtTime = true; }\r\n return this.meta.get(day, otherwise, lookAtTime);\r\n };\r\n /**\r\n * Returns all metadata for the given day or an empty array if there is none.\r\n *\r\n * @param day The day to return the metadata for.\r\n * @returns The array of metadata ordered by priority or an empty array.\r\n */\r\n Schedule.prototype.getMetas = function (day) {\r\n return this.meta.getAll(day);\r\n };\r\n /**\r\n * Returns whether the events in the schedule are all day long or start at\r\n * specific times. Full day events start at the start of the day and end at\r\n * the start of the next day (if the duration = `1` and durationUnit = 'days').\r\n * Full day events have no times specified and should have a durationUnit of\r\n * either `days` or `weeks`.\r\n */\r\n Schedule.prototype.isFullDay = function () {\r\n return this.times.length === 0;\r\n };\r\n /**\r\n * Returns a span of time for a schedule with full day events starting on the\r\n * start of the given day with the desired duration in days or weeks.\r\n *\r\n * @param day The day the span starts on.\r\n * @returns The span of time starting on the given day.\r\n */\r\n Schedule.prototype.getFullSpan = function (day) {\r\n var start = day.start();\r\n var end = start.add(this.duration, this.durationUnit);\r\n return new DaySpan_DaySpan(start, end);\r\n };\r\n /**\r\n * Returns a span of time starting on the given day at the given day with the\r\n * duration specified on this schedule.\r\n *\r\n * @param day The day the span starts on.\r\n * @param time The time of day the span starts.\r\n * @returns The span of time calculated.\r\n */\r\n Schedule.prototype.getTimeSpan = function (day, time) {\r\n var start = day.withTime(time);\r\n var end = start.add(this.duration, this.durationUnit);\r\n return new DaySpan_DaySpan(start, end);\r\n };\r\n /**\r\n * Determines whether the given day is a day on the schedule for the start\r\n * of an event. If an event is more than one day and the day given is not the\r\n * start this may return `false`. This does not test for event instances\r\n * that exist through [[Schedule.include]].\r\n *\r\n * @param day The day to test.\r\n * @returns `true` if the day marks the start of an event on the schedule.\r\n * @see [[Schedule.isIncluded]]\r\n * @see [[Schedule.isFullyExcluded]]\r\n * @see [[Schedule.matchesSpan]]\r\n */\r\n Schedule.prototype.matchesDay = function (day) {\r\n if (this.isIncluded(day, false)) {\r\n return true;\r\n }\r\n if (!this.matchesSpan(day) || this.isFullyExcluded(day)) {\r\n return false;\r\n }\r\n for (var _i = 0, _a = this.checks; _i < _a.length; _i++) {\r\n var check = _a[_i];\r\n if (!check(day[check.property])) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Determines whether the given day has events added through\r\n * [[Schedule.include]].\r\n *\r\n * @param day The day to look for included times on.\r\n * @returns `true` if there are included event instances on the given day,\r\n * otherwise `false`.\r\n */\r\n Schedule.prototype.hasIncludedTime = function (day) {\r\n return !this.iterateIncludeTimes(day).isEmpty();\r\n };\r\n /**\r\n * Determines whether the given day is fully excluded from the schedule. A\r\n * fully excluded day is one that has a day-wide exclusion, or the schedule\r\n * is not an all-day event and all times in the schedule are specifically\r\n * excluded.\r\n *\r\n * @param day The day to test.*\r\n * @returns `true` if he day is fully excluded, otherwise `false`.\r\n */\r\n Schedule.prototype.isFullyExcluded = function (day) {\r\n if (this.isExcluded(day, false)) {\r\n return true;\r\n }\r\n if (this.isFullDay()) {\r\n return false;\r\n }\r\n for (var _i = 0, _a = this.times; _i < _a.length; _i++) {\r\n var time = _a[_i];\r\n if (!this.isExcluded(day.withTime(time))) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Finds the next day an event occurs on the schedule given a day to start,\r\n * optionally including it, and a maximum number of days to look ahead.\r\n *\r\n * @param day The day to start to search from.\r\n * @param includeDay If the given day should be included in the search.\r\n * @param lookAhead The maximum number of days to look ahead from the given\r\n * day for event occurrences.\r\n * @returns The next day on the schedule or `null` if none exists.\r\n */\r\n Schedule.prototype.nextDay = function (day, includeDay, lookAhead) {\r\n if (includeDay === void 0) { includeDay = false; }\r\n if (lookAhead === void 0) { lookAhead = 366; }\r\n return this.iterateDaycast(day, 1, true, includeDay, lookAhead).first();\r\n };\r\n /**\r\n * Finds the next specified number of days that events occur on the schedule\r\n * given a day to start, optionally including it, and a maximum number of days\r\n * to look ahead.\r\n *\r\n * @param day The day to start to search from.\r\n * @param max The maximum number of days to return in the result.\r\n * @param includeDay If the given day should be included in the search.\r\n * @param lookAhead The maximum number of days to look ahead from the given\r\n * day for event occurrences.\r\n * @returns An array containing the next days on the schedule that events\r\n * start or an empty array if there are none.\r\n */\r\n Schedule.prototype.nextDays = function (day, max, includeDay, lookAhead) {\r\n if (includeDay === void 0) { includeDay = false; }\r\n if (lookAhead === void 0) { lookAhead = 366; }\r\n return this.iterateDaycast(day, max, true, includeDay, lookAhead);\r\n };\r\n /**\r\n * Finds the previous day an event occurs on the schedule given a day to start,\r\n * optionally including it, and a maximum number of days to look behind.\r\n *\r\n * @param day The day to start to search from.\r\n * @param includeDay If the given day should be included in the search.\r\n * @param lookBack The maximum number of days to look behind from the given\r\n * day for event occurrences.\r\n * @returns The previous day on the schedule or `null` if none exists.\r\n */\r\n Schedule.prototype.prevDay = function (day, includeDay, lookBack) {\r\n if (includeDay === void 0) { includeDay = false; }\r\n if (lookBack === void 0) { lookBack = 366; }\r\n return this.iterateDaycast(day, 1, false, includeDay, lookBack).first();\r\n };\r\n /**\r\n * Finds the previous specified number of days that events occur on the\r\n * schedule given a day to start, optionally including it, and a maximum\r\n * number of days to look behind.\r\n *\r\n * @param day The day to start to search from.\r\n * @param max The maximum number of days to return in the result.\r\n * @param includeDay If the given day should be included in the search.\r\n * @param lookAhead The maximum number of days to look behind from the given\r\n * day for event occurrences.\r\n * @returns An array containing the previous days on the schedule that events\r\n * start or an empty array if there are none.\r\n */\r\n Schedule.prototype.prevDays = function (day, max, includeDay, lookBack) {\r\n if (includeDay === void 0) { includeDay = false; }\r\n if (lookBack === void 0) { lookBack = 366; }\r\n return this.iterateDaycast(day, max, false, includeDay, lookBack);\r\n };\r\n /**\r\n * Iterates over days that events start in the schedule given a day to start,\r\n * a maximum number of days to find, and a direction to look.\r\n *\r\n * @param day The day to start to search from.\r\n * @param max The maximum number of days to iterate.\r\n * @param next If `true` this searches forward, otherwise `false` is backwards.\r\n * @param includeDay If the given day should be included in the search.\r\n * @param lookup The maximum number of days to look through from the given\r\n * day for event occurrences.\r\n * @returns A new Iterator for the days found in the cast.\r\n * @see [[Schedule.iterateSpans]]\r\n */\r\n Schedule.prototype.iterateDaycast = function (day, max, next, includeDay, lookup) {\r\n var _this = this;\r\n if (includeDay === void 0) { includeDay = false; }\r\n if (lookup === void 0) { lookup = 366; }\r\n return new Iterator_Iterator(function (iterator) {\r\n var iterated = 0;\r\n for (var days = 0; days < lookup; days++) {\r\n if (!includeDay || days > 0) {\r\n day = next ? day.next() : day.prev();\r\n }\r\n if (!_this.iterateSpans(day, false).isEmpty()) {\r\n var action = iterator.act(day);\r\n if (action === IteratorAction.Stop || ++iterated >= max) {\r\n return;\r\n }\r\n }\r\n }\r\n });\r\n };\r\n /**\r\n * Iterates through the spans (event instances) that start on or covers the\r\n * given day.\r\n *\r\n * @param day The day to look for spans on.\r\n * @param covers If `true` spans which span multiple days will be looked at\r\n * to see if they intersect with the given day, otherwise `false` will\r\n * only look at the given day for the start of events.\r\n * @returns A new Iterator for all the spans found.\r\n */\r\n Schedule.prototype.iterateSpans = function (day, covers) {\r\n var _this = this;\r\n if (covers === void 0) { covers = false; }\r\n return new Iterator_Iterator(function (iterator) {\r\n var current = day;\r\n var lookBehind = covers ? _this.durationInDays : 0;\r\n // If the events start at the end of the day and may last multiple days....\r\n if (_this.isFullDay()) {\r\n // If the schedule has events which span multiple days we need to look\r\n // backwards for events that overlap with the given day.\r\n while (lookBehind >= 0) {\r\n // If the current day matches the schedule rules...\r\n if (_this.matchesDay(current)) {\r\n // Build a DaySpan with the given start day and the schedules duration.\r\n var span = _this.getFullSpan(current);\r\n // If that dayspan intersects with the given day, it's a winner!\r\n if (span.matchesDay(day)) {\r\n switch (iterator.act(span)) {\r\n case IteratorAction.Stop:\r\n return;\r\n }\r\n }\r\n }\r\n current = current.prev();\r\n lookBehind--;\r\n }\r\n }\r\n else {\r\n // If the schedule has events which span multiple days we need to look\r\n // backwards for events that overlap with the given day.\r\n while (lookBehind >= 0) {\r\n // If the current day matches the schedule rules...\r\n if (_this.matchesDay(current)) {\r\n // Iterate through each daily occurrence in the schedule...\r\n for (var _i = 0, _a = _this.times; _i < _a.length; _i++) {\r\n var time = _a[_i];\r\n var span = _this.getTimeSpan(current, time);\r\n // If the event intersects with the given day and the occurrence\r\n // has not specifically been excluded...\r\n if (span.matchesDay(day) && !_this.isExcluded(span.start, true)) {\r\n switch (iterator.act(span)) {\r\n case IteratorAction.Stop:\r\n return;\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n // The current day does not match the schedule, however the schedule\r\n // might have moved/random event occurrents on the current day.\r\n // We only want the ones that overlap with the given day.\r\n _this.iterateIncludeTimes(current, day).iterate(function (span, timeIterator) {\r\n switch (iterator.act(span)) {\r\n case IteratorAction.Stop:\r\n timeIterator.stop();\r\n break;\r\n }\r\n });\r\n if (iterator.action === IteratorAction.Stop) {\r\n return;\r\n }\r\n }\r\n current = current.prev();\r\n lookBehind--;\r\n }\r\n }\r\n });\r\n };\r\n /**\r\n * Determines if the given day is on the schedule and the time specified on\r\n * the day matches one of the times on the schedule.\r\n *\r\n * @param day The day to test.\r\n * @returns `true` if the day and time match the schedule, otherwise false.\r\n */\r\n Schedule.prototype.matchesTime = function (day) {\r\n return !!this.iterateSpans(day, true).first(function (span) { return span.start.sameMinute(day); });\r\n };\r\n /**\r\n * Determines if the given day is covered by this schedule. A schedule can\r\n * specify events that span multiple days - so even though the day does not\r\n * match the starting day of a span - it can be a day that is within the\r\n * schedule.\r\n *\r\n * @param day The day to test.\r\n * @returns `true` if the day is covered by an event on this schedule,\r\n * otherwise `false`.\r\n */\r\n Schedule.prototype.coversDay = function (day) {\r\n return !this.iterateSpans(day, true).isEmpty();\r\n };\r\n /**\r\n * Determines if the given timestamp lies in an event occurrence on this\r\n * schedule.\r\n *\r\n * @param day The timestamp to test against the schedule.\r\n * @return `true` if the timestamp lies in an event occurrent start and end\r\n * timestamps, otherwise `false`.\r\n */\r\n Schedule.prototype.coversTime = function (day) {\r\n return !!this.iterateSpans(day, true).first(function (span) { return span.contains(day); });\r\n };\r\n /**\r\n * Changes the exclusion status of the event at the given time. By default\r\n * this excludes this event - but `false` may be passed to undo an exclusion.\r\n *\r\n * @param time The start time of the event occurrence to exclude or include.\r\n * @param excluded Whether the event should be excluded.\r\n */\r\n Schedule.prototype.setExcluded = function (time, excluded) {\r\n if (excluded === void 0) { excluded = true; }\r\n var type = this.identifierType;\r\n this.exclude.set(time, excluded, type);\r\n this.include.set(time, !excluded, type);\r\n return this;\r\n };\r\n /**\r\n * Changes the cancellation status of the event at the given start time. By\r\n * default this cancels the event occurrence - but `false` may be passed to\r\n * undo a cancellation.\r\n *\r\n * @param time The start time of the event occurrence to cancel or uncancel.\r\n * @param cancelled Whether the event should be cancelled.\r\n */\r\n Schedule.prototype.setCancelled = function (time, cancelled) {\r\n if (cancelled === void 0) { cancelled = true; }\r\n this.cancel.set(time, cancelled, this.identifierType);\r\n return this;\r\n };\r\n /**\r\n * Moves the event instance starting at `fromTime` to `toTime` optionally\r\n * placing `meta` in the schedules metadata for the new time `toTime`.\r\n * If this schedule has a single event ([[Schedule.isSingleEvent]]) then the\r\n * only value needed is `toTime` and not `fromTime`.\r\n *\r\n * @param toTime The timestamp of the new event.\r\n * @param fromTime The timestamp of the event on the schedule to move if this\r\n * schedule generates multiple events.\r\n * @param meta The metadata to place in the schedule for the given `toTime`.\r\n * @returns `true` if the schedule had the event moved, otherwise `false`.\r\n */\r\n Schedule.prototype.move = function (toTime, fromTime, meta) {\r\n if (!this.moveSingleEvent(toTime) && fromTime) {\r\n return this.moveInstance(fromTime, toTime, meta);\r\n }\r\n return false;\r\n };\r\n /**\r\n * Moves the event instance starting at `fromTime` to `toTime` optionally\r\n * placing `meta` in the schedules metadata for the new time `toTime`. A move\r\n * is accomplished by excluding the current event and adding an inclusion of\r\n * the new day & time.\r\n *\r\n * @param fromTime The timestamp of the event on the schedule to move.\r\n * @param toTime The timestamp of the new event.\r\n * @param meta The metadata to place in the schedule for the given `toTime`.\r\n * @returns `true`.\r\n * @see [[Schedule.move]]\r\n */\r\n Schedule.prototype.moveInstance = function (fromTime, toTime, meta) {\r\n var type = this.identifierType;\r\n this.exclude.set(fromTime, true, type);\r\n this.exclude.set(toTime, false, type);\r\n this.include.set(toTime, true, type);\r\n this.include.set(fromTime, false, type);\r\n if (Functions.isValue(meta)) {\r\n this.meta.unset(fromTime, type);\r\n this.meta.set(toTime, meta, type);\r\n }\r\n return true;\r\n };\r\n /**\r\n * Moves the single event in this schedule to the given day/time if applicable.\r\n * If this schedule is not a single event schedule then `false` is returned.\r\n * If this schedule is a timed event the time will take the time of the given\r\n * `toTime` of `takeTime` is `true`.\r\n *\r\n * @param toTime The time to move the single event to.\r\n * @param takeTime If this schedule has a single timed event, should the time\r\n * of the event be changed to the time of the given `toTime`?\r\n * @returns `true` if the schedule was adjusted, otherwise `false`.\r\n * @see [[Schedule.move]]\r\n */\r\n Schedule.prototype.moveSingleEvent = function (toTime, takeTime) {\r\n if (takeTime === void 0) { takeTime = true; }\r\n if (!this.isSingleEvent()) {\r\n return false;\r\n }\r\n for (var _i = 0, _a = this.checks; _i < _a.length; _i++) {\r\n var check = _a[_i];\r\n var prop = check.property;\r\n var value = toTime[prop];\r\n var frequency = Parse_Parse.frequency([value], prop);\r\n this[prop] = frequency;\r\n }\r\n if (this.times.length === 1 && takeTime) {\r\n this.times[0] = toTime.asTime();\r\n }\r\n this.updateChecks();\r\n var span = this.getSingleEventSpan();\r\n if (this.start) {\r\n this.start = span.start.start();\r\n }\r\n if (this.end) {\r\n this.end = span.end.end();\r\n }\r\n return true;\r\n };\r\n /**\r\n * Returns the span of the single event in this schedule if it's that type of\r\n * schedule, otherwise `null` is returned.\r\n *\r\n * @returns A span of the single event, otherwise `null`.\r\n * @see [[Schedule.isSingleEvent]]\r\n */\r\n Schedule.prototype.getSingleEventSpan = function () {\r\n if (!this.isSingleEvent()) {\r\n return null;\r\n }\r\n var startOfYear = Day_Day.build(this.year.input[0], 0, 1);\r\n var start = this.iterateDaycast(startOfYear, 1, true, true, 366).first();\r\n if (!start) {\r\n return null;\r\n }\r\n return this.isFullDay() ?\r\n this.getFullSpan(start) :\r\n this.getTimeSpan(start, this.times[0]);\r\n };\r\n /**\r\n * Determines whether this schedule produces a single event, and no more.\r\n * If this schedule has any includes, it's assumed to be a multiple event\r\n * schedule. A single event can be detected in the following scenarios where\r\n * each frequency has a single occurrence (see [[Schedule.isSingleFrequency]]).\r\n *\r\n * - year, day of year\r\n * - year, month, day of month\r\n * - year, month, week of month, day of week\r\n * - year, week of year, day of week\r\n *\r\n * @returns `true` if this schedule produces a single event, otherwise `false`.\r\n */\r\n Schedule.prototype.isSingleEvent = function () {\r\n // 0 = full day, 1 = once a day, 1+ = multiple events a day\r\n if (this.times.length > 1) {\r\n return false;\r\n }\r\n // Let's assume if there are includes, this is not a single event.\r\n if (!this.include.isEmpty()) {\r\n return false;\r\n }\r\n // If this can occur on multiple years, not a single event.\r\n if (!this.isSingleYear()) {\r\n return false;\r\n }\r\n // If this is a specific year and day of the year: single!\r\n if (this.isSingleDayOfYear()) {\r\n return true;\r\n }\r\n // If this is a specific year, month, and day of month: single!\r\n if (this.isSingleMonth() && this.isSingleDayOfMonth()) {\r\n return true;\r\n }\r\n // If this is a specific year, month, week of the month, day of the week: single!\r\n if (this.isSingleMonth() && this.isSingleWeekOfMonth() && this.isSingleDayOfWeek()) {\r\n return true;\r\n }\r\n // If this is a specific year, week of the year, day of the week: single!\r\n if (this.isSingleWeekOfYear() && this.isSingleDayOfWeek()) {\r\n return true;\r\n }\r\n // Doesn't look like a single event.\r\n return false;\r\n };\r\n /**\r\n * @returns `true` if this schedule produces events only in a specific year.\r\n * @see [[Schedule.year]]\r\n */\r\n Schedule.prototype.isSingleYear = function () {\r\n return this.isSingleFrequency(this.year);\r\n };\r\n /**\r\n * @returns `true` if this schedule produces events only in a specific month.\r\n * @see [[Schedule.month]]\r\n */\r\n Schedule.prototype.isSingleMonth = function () {\r\n return this.isSingleFrequency(this.month);\r\n };\r\n /**\r\n * @returns `true` if this schedule produces events only in a specific day of\r\n * the month.\r\n * @see [[Schedule.dayOfMonth]]\r\n * @see [[Schedule.lastDayOfMonth]]\r\n */\r\n Schedule.prototype.isSingleDayOfMonth = function () {\r\n return this.isSingleFrequency(this.dayOfMonth) ||\r\n this.isSingleFrequency(this.lastDayOfMonth);\r\n };\r\n /**\r\n * @returns `true` if this schedule produces events only in a specific day of\r\n * the week.\r\n * @see [[Schedule.dayOfWeek]]\r\n */\r\n Schedule.prototype.isSingleDayOfWeek = function () {\r\n return this.isSingleFrequency(this.dayOfWeek);\r\n };\r\n /**\r\n * @returns `true` if this schedule produces events only in a specific day of\r\n * the year.\r\n * @see [[Schedule.dayOfYear]]\r\n */\r\n Schedule.prototype.isSingleDayOfYear = function () {\r\n return this.isSingleFrequency(this.dayOfYear);\r\n };\r\n /**\r\n * @returns `true` if this schedule produces events only in a specific week of\r\n * the month.\r\n * @see [[Schedule.weekspanOfMonth]]\r\n * @see [[Schedule.fullWeekOfMonth]]\r\n * @see [[Schedule.weekOfMonth]]\r\n * @see [[Schedule.lastFullWeekOfMonth]]\r\n * @see [[Schedule.lastWeekspanOfMonth]]\r\n */\r\n Schedule.prototype.isSingleWeekOfMonth = function () {\r\n return this.isSingleFrequency(this.weekspanOfMonth) ||\r\n this.isSingleFrequency(this.fullWeekOfMonth) ||\r\n this.isSingleFrequency(this.weekOfMonth) ||\r\n this.isSingleFrequency(this.lastFullWeekOfMonth) ||\r\n this.isSingleFrequency(this.lastWeekspanOfMonth);\r\n };\r\n /**\r\n * @returns `true` if this schedule produces events only in a specific week of\r\n * the year.\r\n * @see [[Schedule.weekspanOfYear]]\r\n * @see [[Schedule.fullWeekOfYear]]\r\n * @see [[Schedule.week]]\r\n * @see [[Schedule.weekOfYear]]\r\n * @see [[Schedule.lastFullWeekOfYear]]\r\n * @see [[Schedule.lastWeekspanOfYear]]\r\n */\r\n Schedule.prototype.isSingleWeekOfYear = function () {\r\n return this.isSingleFrequency(this.weekspanOfYear) ||\r\n this.isSingleFrequency(this.fullWeekOfYear) ||\r\n this.isSingleFrequency(this.week) ||\r\n this.isSingleFrequency(this.weekOfYear) ||\r\n this.isSingleFrequency(this.lastFullWeekOfYear) ||\r\n this.isSingleFrequency(this.lastWeekspanOfYear);\r\n };\r\n /**\r\n * Determines if the given [[FrequencyCheck]] results in a single occurrence.\r\n *\r\n * @returns `true` if the frequency results in a single event, otherwise `false`.\r\n */\r\n Schedule.prototype.isSingleFrequency = function (frequency) {\r\n return Functions.isArray(frequency.input) && frequency.input.length === 1;\r\n };\r\n /**\r\n * Creates a forecast for this schedule which returns a number of event\r\n * occurrences around a given day. A single item could be returned per day, or\r\n * you could get an item for each timed event occurrence.\r\n *\r\n * @param around The day to find a forecast around.\r\n * @param covers If `true` spans which span multiple days will be looked at\r\n * to see if they intersect with the given day, otherwise `false` will\r\n * only look at the given day for the start of events.\r\n * @param daysAfter The number of events to return before the given day.\r\n * @param daysBefore The number of events to return after the given day.\r\n * @param times If timed events should be returned, or only one for each day.\r\n * @param lookAround How many days to look before and after the given day for\r\n * event occurrences.\r\n * @returns A new iterator which provides the event occurence span, the day it\r\n * starts (or is covered if `covers` is `true`), and the identifier for the\r\n * event.\r\n */\r\n Schedule.prototype.forecast = function (around, covers, daysAfter, daysBefore, times, lookAround) {\r\n var _this = this;\r\n if (covers === void 0) { covers = true; }\r\n if (daysBefore === void 0) { daysBefore = daysAfter; }\r\n if (times === void 0) { times = false; }\r\n if (lookAround === void 0) { lookAround = 366; }\r\n var type = this.identifierType;\r\n var tuplesForDay = function (day, tuples) {\r\n var spans = _this.iterateSpans(day, covers).list();\r\n var last = times ? spans.length : Math.min(1, spans.length);\r\n var offset = times ? 0 : spans.length - 1;\r\n for (var i = 0; i < last; i++) {\r\n var span = spans[i + offset];\r\n var id = type.get(span.start);\r\n if (tuples.act([span, day, id]) === IteratorAction.Stop) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n var prev = new Iterator_Iterator(function (iterator) {\r\n var curr = around;\r\n for (var i = 0; i < lookAround; i++) {\r\n if (!tuplesForDay(curr, iterator)) {\r\n break;\r\n }\r\n curr = curr.prev();\r\n }\r\n });\r\n var next = new Iterator_Iterator(function (iterator) {\r\n var curr = around;\r\n for (var i = 0; i < lookAround; i++) {\r\n curr = curr.next();\r\n if (!tuplesForDay(curr, iterator)) {\r\n break;\r\n }\r\n }\r\n });\r\n return prev.take(daysBefore + 1).reverse().append(next.take(daysAfter));\r\n };\r\n /**\r\n * Iterates timed events that were explicitly specified on the given day.\r\n * Those events could span multiple days so may be tested against another day.\r\n *\r\n * @param day The day to look for included timed events.\r\n * @param matchAgainst The day to test against the timed event.\r\n * @returns A new Iterator for all the included spans found.\r\n */\r\n Schedule.prototype.iterateIncludeTimes = function (day, matchAgainst) {\r\n var _this = this;\r\n if (matchAgainst === void 0) { matchAgainst = day; }\r\n var isIncludedTime = function (result) {\r\n var id = result[0], included = result[1];\r\n return included && Identifier_Identifier.Time.is(id);\r\n };\r\n var getSpan = function (result) {\r\n var id = result[0];\r\n var time = Identifier_Identifier.Time.start(id);\r\n var span = _this.getTimeSpan(time, time.asTime());\r\n if (span.matchesDay(matchAgainst)) {\r\n return span;\r\n }\r\n };\r\n return this.include.query(day.dayIdentifier).map(getSpan, isIncludedTime);\r\n };\r\n /**\r\n * Converts the schedule instance back into input.\r\n *\r\n * @param returnDays When `true` the start, end, and array of exclusions will\r\n * have [[Day]] instances, otherwise the UTC timestamp and dayIdentifiers\r\n * will be used when `false`.\r\n * @param returnTimes When `true` the times returned in the input will be\r\n * instances of [[Time]] otherwise the `timeFormat` is used to convert the\r\n * times to strings.\r\n * @param timeFormat The time format to use when returning the times as strings.\r\n * @param alwaysDuration If the duration values (`duration` and\r\n * `durationUnit`) should always be returned in the input.\r\n * @returns The input that describes this schedule.\r\n * @see [[Schedule.getExclusions]]\r\n * @see [[Time.format]]\r\n */\r\n Schedule.prototype.toInput = function (returnDays, returnTimes, timeFormat, alwaysDuration) {\r\n if (returnDays === void 0) { returnDays = false; }\r\n if (returnTimes === void 0) { returnTimes = false; }\r\n if (timeFormat === void 0) { timeFormat = ''; }\r\n if (alwaysDuration === void 0) { alwaysDuration = false; }\r\n var defaultUnit = Constants.DURATION_DEFAULT_UNIT(this.isFullDay());\r\n var exclusions = this.exclude.identifiers(function (v) { return v; }).list();\r\n var inclusions = this.include.identifiers(function (v) { return v; }).list();\r\n var cancels = this.cancel.identifiers(function (v) { return v; }).list();\r\n var hasMeta = !this.meta.isEmpty();\r\n var out = {};\r\n var times = [];\r\n for (var _i = 0, _a = this.times; _i < _a.length; _i++) {\r\n var time = _a[_i];\r\n times.push(returnTimes ? time : (timeFormat ? time.format(timeFormat) : time.toString()));\r\n }\r\n if (this.start)\r\n out.start = returnDays ? this.start : this.start.time;\r\n if (this.end)\r\n out.end = returnDays ? this.end : this.end.time;\r\n if (times.length)\r\n out.times = times;\r\n if (alwaysDuration || this.duration !== Constants.DURATION_DEFAULT)\r\n out.duration = this.duration;\r\n if (alwaysDuration || this.durationUnit !== defaultUnit)\r\n out.durationUnit = this.durationUnit;\r\n if (exclusions.length)\r\n out.exclude = exclusions;\r\n if (inclusions.length)\r\n out.include = inclusions;\r\n if (cancels.length)\r\n out.cancel = cancels;\r\n if (hasMeta)\r\n out.meta = this.meta.map;\r\n if (this.dayOfWeek.input)\r\n out.dayOfWeek = this.dayOfWeek.input;\r\n if (this.dayOfMonth.input)\r\n out.dayOfMonth = this.dayOfMonth.input;\r\n if (this.lastDayOfMonth.input)\r\n out.lastDayOfMonth = this.lastDayOfMonth.input;\r\n if (this.dayOfYear.input)\r\n out.dayOfYear = this.dayOfYear.input;\r\n if (this.year.input)\r\n out.year = this.year.input;\r\n if (this.month.input)\r\n out.month = this.month.input;\r\n if (this.week.input)\r\n out.week = this.week.input;\r\n if (this.weekOfYear.input)\r\n out.weekOfYear = this.weekOfYear.input;\r\n if (this.weekspanOfYear.input)\r\n out.weekspanOfYear = this.weekspanOfYear.input;\r\n if (this.fullWeekOfYear.input)\r\n out.fullWeekOfYear = this.fullWeekOfYear.input;\r\n if (this.lastWeekspanOfYear.input)\r\n out.lastWeekspanOfYear = this.lastWeekspanOfYear.input;\r\n if (this.lastFullWeekOfYear.input)\r\n out.lastFullWeekOfYear = this.lastFullWeekOfYear.input;\r\n if (this.weekOfMonth.input)\r\n out.weekOfMonth = this.weekOfMonth.input;\r\n if (this.weekspanOfMonth.input)\r\n out.weekspanOfMonth = this.weekspanOfMonth.input;\r\n if (this.fullWeekOfMonth.input)\r\n out.fullWeekOfMonth = this.fullWeekOfMonth.input;\r\n if (this.lastWeekspanOfMonth.input)\r\n out.lastWeekspanOfMonth = this.lastWeekspanOfMonth.input;\r\n if (this.lastFullWeekOfMonth.input)\r\n out.lastFullWeekOfMonth = this.lastFullWeekOfMonth.input;\r\n return out;\r\n };\r\n /**\r\n * Describes the schedule in a human friendly string taking into account all\r\n * possible values specified in this schedule.\r\n *\r\n * @param thing A brief description of the things (events) on the schedule.\r\n * @param includeRange When `true` the [[Schedule.start]] and [[Schedule.end]]\r\n * are possibly included in the description if they have values.\r\n * @param includeTimes When `true` the [[Schedule.times]] are possibly included\r\n * in the description.\r\n * @param includeDuration When `true` the [[Schedule.duration]] and\r\n * [[Schedule.durationUnit]] are added to the description if\r\n * [[Schedule.duration]] is not equal to `1`.\r\n * @param includeExcludes When `true` the [[Schedule.exclude]] are added\r\n * to the description if there are any.\r\n * @param includeIncludes When `true` the [[Schedule.include]] are added\r\n * to the description if there are any.\r\n * @param includeCancels When `true` the [[Schedule.cancel]] are added\r\n * to the description if there are any.\r\n * @returns The descroption of the schedule.\r\n */\r\n Schedule.prototype.describe = function (thing, includeRange, includeTimes, includeDuration, includeExcludes, includeIncludes, includeCancels) {\r\n if (thing === void 0) { thing = 'event'; }\r\n if (includeRange === void 0) { includeRange = true; }\r\n if (includeTimes === void 0) { includeTimes = true; }\r\n if (includeDuration === void 0) { includeDuration = false; }\r\n if (includeExcludes === void 0) { includeExcludes = false; }\r\n if (includeIncludes === void 0) { includeIncludes = false; }\r\n if (includeCancels === void 0) { includeCancels = false; }\r\n var out = '';\r\n if (includeRange) {\r\n if (this.start) {\r\n out += 'Starting on ' + this.start.format('dddd Do, YYYY');\r\n if (this.end) {\r\n out += ' and ending on ' + this.end.format('dddd Do, YYYY');\r\n }\r\n }\r\n else if (this.end) {\r\n out += 'Up until ' + this.end.format('dddd Do, YYYY');\r\n }\r\n }\r\n if (out) {\r\n out += ' the ' + thing + ' will occur';\r\n }\r\n else {\r\n out += 'The ' + thing + ' will occur';\r\n }\r\n out += this.describeRule(this.dayOfWeek.input, 'day of the week', function (x) { return __WEBPACK_IMPORTED_MODULE_10_moment__[\"weekdays\"]()[x]; }, 1, false);\r\n out += this.describeRule(this.lastDayOfMonth.input, 'last day of the month', function (x) { return Suffix.CACHE[x]; });\r\n out += this.describeRule(this.dayOfMonth.input, 'day of the month', function (x) { return Suffix.CACHE[x]; });\r\n out += this.describeRule(this.dayOfYear.input, 'day of the year', function (x) { return Suffix.CACHE[x]; }, 1);\r\n out += this.describeRule(this.year.input, 'year', function (x) { return x; }, 0, false, ' in ');\r\n out += this.describeRule(this.month.input, 'month', function (x) { return __WEBPACK_IMPORTED_MODULE_10_moment__[\"months\"]()[x]; }, 0, false, ' in ');\r\n out += this.describeRule(this.weekOfYear.input, 'week of the year', function (x) { return Suffix.CACHE[x]; });\r\n out += this.describeRule(this.weekspanOfYear.input, 'weekspan of the year', function (x) { return Suffix.CACHE[x + 1]; }, 1);\r\n out += this.describeRule(this.fullWeekOfYear.input, 'full week of the year', function (x) { return Suffix.CACHE[x]; });\r\n out += this.describeRule(this.lastWeekspanOfYear.input, 'last weekspan of the year', function (x) { return Suffix.CACHE[x + 1]; }, 1);\r\n out += this.describeRule(this.lastFullWeekOfYear.input, 'last full week of the year', function (x) { return Suffix.CACHE[x]; });\r\n out += this.describeRule(this.weekOfMonth.input, 'week of the month', function (x) { return Suffix.CACHE[x]; });\r\n out += this.describeRule(this.fullWeekOfMonth.input, 'full week of the month', function (x) { return Suffix.CACHE[x]; });\r\n out += this.describeRule(this.weekspanOfMonth.input, 'weekspan of the month', function (x) { return Suffix.CACHE[x + 1]; }, 1);\r\n out += this.describeRule(this.lastFullWeekOfMonth.input, 'last full week of the month', function (x) { return Suffix.CACHE[x]; });\r\n out += this.describeRule(this.lastWeekspanOfMonth.input, 'last weekspan of the month', function (x) { return Suffix.CACHE[x + 1]; }, 1);\r\n if (includeTimes && this.times.length) {\r\n out += ' at ';\r\n out += this.describeArray(this.times, function (x) { return x.format('hh:mm a'); });\r\n }\r\n if (includeDuration && this.duration !== Constants.DURATION_DEFAULT) {\r\n out += ' lasting ' + this.duration + ' ';\r\n if (this.durationUnit) {\r\n out += this.durationUnit + ' ';\r\n }\r\n }\r\n if (includeExcludes) {\r\n var excludes = this.exclude.spans().list();\r\n if (excludes.length) {\r\n out += ' excluding ';\r\n out += this.describeArray(excludes, function (x) { return x.span.summary(Units.DAY); });\r\n }\r\n }\r\n if (includeIncludes) {\r\n var includes = this.include.spans().list();\r\n if (includes.length) {\r\n out += ' including ';\r\n out += this.describeArray(includes, function (x) { return x.span.summary(Units.DAY); });\r\n }\r\n }\r\n if (includeCancels) {\r\n var cancels = this.cancel.spans().list();\r\n if (cancels.length) {\r\n out += ' with cancellations on ';\r\n out += this.describeArray(cancels, function (x) { return x.span.summary(Units.DAY); });\r\n }\r\n }\r\n return out;\r\n };\r\n /**\r\n * Describes the given frequency.\r\n *\r\n * @param value The frequency to describe.\r\n * @param unit The unit of the frequency.\r\n * @param map How the values in the frequency should be described.\r\n * @param everyOffset A value to add to a [[FrequencyValueEvery]] offset to\r\n * account for zero-based values that should be shifted for human\r\n * friendliness.\r\n * @param the If the word 'the' should be used to describe the unit.\r\n * @param on The word which preceeds values of the given unit.\r\n * @param required If the description should always return a non-empty string\r\n * even if the frequency was not specified in the original input.\r\n * @returns A string description of the frequency.\r\n */\r\n Schedule.prototype.describeRule = function (value, unit, map, everyOffset, the, on, required) {\r\n if (everyOffset === void 0) { everyOffset = 0; }\r\n if (the === void 0) { the = true; }\r\n if (on === void 0) { on = ' on '; }\r\n if (required === void 0) { required = false; }\r\n var out = '';\r\n var suffix = the ? ' ' + unit : '';\r\n if (Functions.isFrequencyValueEvery(value)) {\r\n var valueEvery = value;\r\n out += ' every ' + Suffix.CACHE[valueEvery.every] + ' ' + unit;\r\n if (valueEvery.offset) {\r\n out += ' starting at ' + map(valueEvery.offset + everyOffset) + suffix;\r\n }\r\n }\r\n else if (Functions.isFrequencyValueOneOf(value)) {\r\n var valueOne = value;\r\n if (valueOne.length) {\r\n out += on + (the ? 'the ' : '');\r\n out += this.describeArray(valueOne, map);\r\n out += suffix;\r\n }\r\n }\r\n else if (required) {\r\n out += on + 'any ' + unit;\r\n }\r\n return out;\r\n };\r\n /**\r\n * Describes the array by adding commas where appropriate and 'and' before the\r\n * last value of the array (if its more than `1`).\r\n *\r\n * @param array The array of items to describe.\r\n * @param map The function which converts an item to a string.\r\n * @returns The final description of the array items.\r\n */\r\n Schedule.prototype.describeArray = function (array, map) {\r\n var out = '';\r\n var last = array.length - 1;\r\n out += map(array[0]);\r\n for (var i = 1; i < last; i++) {\r\n out += ', ' + map(array[i]);\r\n }\r\n if (last > 0) {\r\n out += ' and ' + map(array[last]);\r\n }\r\n return out;\r\n };\r\n return Schedule;\r\n}());\r\n\r\n\n// CONCATENATED MODULE: ./src/Event.ts\n\r\n/**\r\n * A pairing of a user specified event object and the schedule which defines\r\n * when it occurs on a calendar.\r\n *\r\n * @typeparam T The type of data stored in the [[Event]] class.\r\n * @typeparam M The type of metadata stored in the schedule.\r\n */\r\nvar Event = (function () {\r\n /**\r\n * Creates a new event.\r\n *\r\n * @param schedule The schedule which defines when the event occurs.\r\n * @param data User specified object which describes this event.\r\n * @param id User specified ID which identifies this event.\r\n */\r\n function Event(schedule, data, id, visible) {\r\n if (visible === void 0) { visible = true; }\r\n this.schedule = schedule;\r\n this.data = data;\r\n this.id = id;\r\n this.visible = visible;\r\n }\r\n return Event;\r\n}());\r\n\r\n\n// CONCATENATED MODULE: ./src/Time.ts\n\r\n\r\n\r\n\r\n/**\r\n * A class which holds a specific time during in any day.\r\n */\r\nvar Time_Time = (function () {\r\n /**\r\n * Creates a new Time instance given an hour and optionally a minute, second,\r\n * and millisecond. If they have not been specified they default to 0.\r\n *\r\n * @param hour The hour.\r\n * @param minute The minute.\r\n * @param second The second.\r\n * @param millisecond The millisecond.\r\n */\r\n function Time(hour, minute, second, millisecond) {\r\n if (minute === void 0) { minute = Constants.MINUTE_MIN; }\r\n if (second === void 0) { second = Constants.SECOND_MIN; }\r\n if (millisecond === void 0) { millisecond = Constants.MILLIS_MIN; }\r\n this.hour = hour;\r\n this.minute = minute;\r\n this.second = second;\r\n this.millisecond = millisecond;\r\n }\r\n /**\r\n * Formats this time into a string. The following list describes the available\r\n * formatting patterns:\r\n *\r\n * ### Hour\r\n * - H: 0-23\r\n * - HH: 00-23\r\n * - h: 12,1-12,1-11\r\n * - hh: 12,01-12,01-11\r\n * - k: 1-24\r\n * - kk: 01-24\r\n * - a: am,pm\r\n * - A: AM,PM\r\n * ### Minute\r\n * - m: 0-59\r\n * - mm: 00-59\r\n * ### Second\r\n * - s: 0-59\r\n * - ss: 00-59\r\n * ### Millisecond\r\n * - S: 0-9\r\n * - SS: 00-99\r\n * - SSS: 000-999\r\n *\r\n * @param format The format to output.\r\n * @returns The formatted time.\r\n */\r\n Time.prototype.format = function (format) {\r\n var formatterEntries = Time.FORMATTERS;\r\n var out = '';\r\n for (var i = 0; i < format.length; i++) {\r\n var handled = false;\r\n for (var k = 0; k < formatterEntries.length && !handled; k++) {\r\n var entry = formatterEntries[k];\r\n var part = format.substring(i, i + entry.size);\r\n if (part.length === entry.size) {\r\n var formatter = entry.formats[part];\r\n if (formatter) {\r\n out += formatter(this);\r\n i += entry.size - 1;\r\n handled = true;\r\n }\r\n }\r\n }\r\n if (!handled) {\r\n out += format.charAt(i);\r\n }\r\n }\r\n return out;\r\n };\r\n /**\r\n * @returns The number of milliseconds from the start of the day until this\r\n * time.\r\n */\r\n Time.prototype.toMilliseconds = function () {\r\n return this.hour * Constants.MILLIS_IN_HOUR +\r\n this.minute * Constants.MILLIS_IN_MINUTE +\r\n this.second * Constants.MILLIS_IN_SECOND +\r\n this.millisecond;\r\n };\r\n /**\r\n * @returns The time formatted using the smallest format that completely\r\n * represents this time.\r\n */\r\n Time.prototype.toString = function () {\r\n if (this.millisecond)\r\n return this.format('HH:mm:ss.SSS');\r\n if (this.second)\r\n return this.format('HH:mm:ss');\r\n if (this.minute)\r\n return this.format('HH:mm');\r\n return this.format('HH');\r\n };\r\n /**\r\n * @returns A unique identifier for this time. The number returned is in the\r\n * following format: SSSssmmHH\r\n */\r\n Time.prototype.toIdentifier = function () {\r\n return this.hour +\r\n this.minute * 100 +\r\n this.second * 10000 +\r\n this.millisecond * 10000000;\r\n };\r\n /**\r\n * @returns An object with hour, minute, second, a millisecond properties if\r\n * they are non-zero on this time.\r\n */\r\n Time.prototype.toObject = function () {\r\n var out = {\r\n hour: this.hour\r\n };\r\n if (this.minute)\r\n out.minute = this.minute;\r\n if (this.second)\r\n out.second = this.second;\r\n if (this.millisecond)\r\n out.millisecond = this.millisecond;\r\n return out;\r\n };\r\n /**\r\n * Parses a value and tries to convert it to a Time instance.\r\n *\r\n * @param input The input to parse.\r\n * @returns The instance parsed or `null` if it was invalid.\r\n * @see [[Parse.time]]\r\n */\r\n Time.parse = function (input) {\r\n return Parse_Parse.time(input);\r\n };\r\n /**\r\n * Parses a string and converts it to a Time instance. If the string is not\r\n * in a valid format `null` is returned.\r\n *\r\n * @param time The string to parse.\r\n * @returns The instance parsed or `null` if it was invalid.\r\n * @see [[Time.REGEX]]\r\n */\r\n Time.fromString = function (time) {\r\n var matches = this.REGEX.exec(time);\r\n if (!matches) {\r\n return null;\r\n }\r\n var h = parseInt(matches[1]) || 0;\r\n var m = parseInt(matches[2]) || 0;\r\n var s = parseInt(matches[3]) || 0;\r\n var l = parseInt(matches[4]) || 0;\r\n return this.build(h, m, s, l);\r\n };\r\n /**\r\n * Parses a number and converts it to a Time instance. The number is assumed\r\n * to be in the [[Time.toIdentifier]] format.\r\n *\r\n * @param time The number to parse.\r\n * @returns The instance parsed.\r\n */\r\n Time.fromIdentifier = function (time) {\r\n var h = time % 100;\r\n var m = Math.floor(time / 100) % 100;\r\n var s = Math.floor(time / 10000) % 100;\r\n var l = Math.floor(time / 10000000) % 1000;\r\n return this.build(h, m, s, l);\r\n };\r\n /**\r\n * Returns a new instance given an hour and optionally a minute, second,\r\n * and millisecond. If they have not been specified they default to 0.\r\n *\r\n * @param hour The hour.\r\n * @param minute The minute.\r\n * @param second The second.\r\n * @param millisecond The millisecond.\r\n * @returns A new instance.\r\n */\r\n Time.build = function (hour, minute, second, millisecond) {\r\n if (minute === void 0) { minute = Constants.MINUTE_MIN; }\r\n if (second === void 0) { second = Constants.SECOND_MIN; }\r\n if (millisecond === void 0) { millisecond = Constants.MILLIS_MIN; }\r\n return new Time(hour, minute, second, millisecond);\r\n };\r\n /**\r\n * The regular expression used to parse a time from a string.\r\n *\r\n * - ## = hour\r\n * - ##:## = hour & minute\r\n * - ##:##:## = hour, minute, & second\r\n * - ##:##:##.### = hour, minute, second, and milliseconds\r\n */\r\n Time.REGEX = /^(\\d\\d?):?(\\d\\d)?:?(\\d\\d)?\\.?(\\d\\d\\d)?$/;\r\n /**\r\n * A set of formatting functions keyed by their format string.\r\n */\r\n Time.FORMATTERS = [\r\n {\r\n size: 3,\r\n formats: {\r\n SSS: function (t) { return Functions.padNumber(t.millisecond, 3); }\r\n }\r\n },\r\n {\r\n size: 2,\r\n formats: {\r\n HH: function (t) { return Functions.padNumber(t.hour, 2); },\r\n hh: function (t) { return Functions.padNumber((t.hour % 12) || 12, 2); },\r\n kk: function (t) { return Functions.padNumber(t.hour + 1, 2); },\r\n mm: function (t) { return Functions.padNumber(t.minute, 2); },\r\n ss: function (t) { return Functions.padNumber(t.second, 2); },\r\n SS: function (t) { return Functions.padNumber(t.millisecond, 3, 2); }\r\n }\r\n },\r\n {\r\n size: 1,\r\n formats: {\r\n A: function (t) { return t.hour < 12 ? 'AM' : 'PM'; },\r\n a: function (t) { return t.hour < 12 ? 'am' : 'pm'; },\r\n H: function (t) { return t.hour + ''; },\r\n h: function (t) { return ((t.hour % 12) || 12) + ''; },\r\n k: function (t) { return (t.hour + 1) + ''; },\r\n m: function (t) { return t.minute + ''; },\r\n s: function (t) { return t.second + ''; },\r\n S: function (t) { return Functions.padNumber(t.millisecond, 3, 1); }\r\n }\r\n }\r\n ];\r\n return Time;\r\n}());\r\n\r\n\n// CONCATENATED MODULE: ./src/Parse.ts\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * The class which takes user input and parses it to specific structures.\r\n */\r\nvar Parse_Parse = (function () {\r\n function Parse() {\r\n }\r\n /**\r\n * Parses a value and converts it to a [[FrequencyCheck]].\r\n *\r\n * @param input The input to parse into a function.\r\n * @param property The [[Day]] property the frequency is for.\r\n * @returns A function which determines whether a value matches a frequency.\r\n * @see [[Schedule]]\r\n */\r\n Parse.frequency = function (input, property) {\r\n var check = function (value) {\r\n return true;\r\n };\r\n check.given = false;\r\n if (Functions.isFrequencyValueEvery(input)) {\r\n var every_1 = input.every;\r\n var offset_1 = (input.offset || 0) % every_1;\r\n check = function (value) {\r\n return value % every_1 === offset_1;\r\n };\r\n check.given = true;\r\n }\r\n if (Functions.isFrequencyValueOneOf(input)) {\r\n var map_1 = {};\r\n for (var i = 0; i < input.length; i++) {\r\n map_1[input[i]] = true;\r\n }\r\n check = function (value) {\r\n return !!map_1[value];\r\n };\r\n check.given = true;\r\n }\r\n check.input = input;\r\n check.property = property;\r\n return check;\r\n };\r\n /**\r\n * Parses [[DayInput]] into a [[Day]] instance.\r\n *\r\n * ```typescript\r\n * Parse.day( 65342300 ); // UTC timestamp\r\n * Parse.day( '01/02/2014' ); // strings in many formats\r\n * Parse.day( day ); // return a passed instance\r\n * Parse.day( [2018, 0, 2] ); // array: 01/02/2018\r\n * Parse.day( {year: 2018, month: 2} ); // object: 03/01/2018\r\n * Parse.day( true ); // today\r\n * ```\r\n *\r\n * @param input The input to parse.\r\n * @returns The Day parsed or `null` if the value is not valid.\r\n */\r\n Parse.day = function (input) {\r\n if (Functions.isNumber(input)) {\r\n return Day_Day.unix(input);\r\n }\r\n else if (Functions.isString(input)) {\r\n return Day_Day.fromString(input);\r\n }\r\n else if (input instanceof Day_Day) {\r\n return input;\r\n }\r\n else if (Functions.isArray(input)) {\r\n return Day_Day.fromArray(input);\r\n }\r\n else if (Functions.isObject(input)) {\r\n return Day_Day.fromObject(input);\r\n }\r\n else if (input === true) {\r\n return Day_Day.today();\r\n }\r\n return null;\r\n };\r\n /**\r\n * Parses a value and tries to convert it to a Time instance.\r\n *\r\n * ```typescript\r\n * Parse.time( time ); // return a passed instance\r\n * Parse.time( 9 ); // 09:00:00.000\r\n * Parse.time( 3009 ); // 09:30:00.000\r\n * Parse.time( 593009 ); // 09:30:59.000\r\n * Parsetime( '09' ); // 09:00:00.000\r\n * Parse.time( '9:30' ); // 09:30:00.000\r\n * Parse.time( '9:30:59' ); // 09:30:59.000\r\n * Parse.time( {hour: 2} ); // 02:00:00.000\r\n * ```\r\n *\r\n * @param input The input to parse.\r\n * @returns The instance parsed or `null` if it was invalid.\r\n * @see [[Time.fromIdentifier]]\r\n * @see [[Time.fromString]]\r\n */\r\n Parse.time = function (input) {\r\n if (input instanceof Time_Time) {\r\n return input;\r\n }\r\n if (Functions.isNumber(input)) {\r\n return Time_Time.fromIdentifier(input);\r\n }\r\n if (Functions.isString(input)) {\r\n return Time_Time.fromString(input);\r\n }\r\n if (Functions.isObject(input) && Functions.isNumber(input.hour)) {\r\n return new Time_Time(input.hour, input.minute, input.second, input.millisecond);\r\n }\r\n return null;\r\n };\r\n /**\r\n * Parses a value and tries to convert it to an array of Time instances.\r\n * If any of the given values are not a valid time value then the resulting\r\n * array will not contain a time instance.\r\n *\r\n * @param input The input to parse.\r\n * @returns A non-null array of time instances.\r\n * @see [[Parse.time]]\r\n */\r\n Parse.times = function (input) {\r\n var times = [];\r\n if (Functions.isArray(input)) {\r\n for (var _i = 0, input_1 = input; _i < input_1.length; _i++) {\r\n var timeInput = input_1[_i];\r\n var time = this.time(timeInput);\r\n if (time) {\r\n times.push(time);\r\n }\r\n }\r\n // Sort times from earliest to latest.\r\n times.sort(function (a, b) {\r\n return a.toMilliseconds() - b.toMilliseconds();\r\n });\r\n }\r\n return times;\r\n };\r\n /**\r\n * Parses an array of excluded days into a map of excluded days where the\r\n * array value and returned object key are [[Day.dayIdentifier]].\r\n *\r\n * ```typescript\r\n * Parse.modifier( [ 20180101, 20140506 ] ); // {'20180101': true, '20140506': true}\r\n * Parse.modifier( [ 20180101, Day.build(2014,4,6) ] ); // {'20180101': true, '20140506': true}\r\n * ```\r\n *\r\n * @param input The input to parse.\r\n * @param value The default value if the input given is an array of identifiers.\r\n * @param parseMeta A function to use to parse a modifier.\r\n * @param out The modifier to set the identifiers and values of and return.\r\n * @returns The object with identifier keys and `true` values.\r\n * @see [[Day.dayIdentifier]]\r\n */\r\n Parse.modifier = function (input, value, parseMeta, out) {\r\n if (parseMeta === void 0) { parseMeta = (function (x) { return x; }); }\r\n if (out === void 0) { out = new ScheduleModifier_ScheduleModifier(); }\r\n var map = {};\r\n if (Functions.isArray(input)) {\r\n for (var _i = 0, input_2 = input; _i < input_2.length; _i++) {\r\n var identifier = input_2[_i];\r\n if (identifier instanceof Day_Day) {\r\n map[identifier.dayIdentifier] = value;\r\n }\r\n else if (Functions.isNumber(identifier)) {\r\n map[identifier] = value;\r\n }\r\n else if (Functions.isString(identifier)) {\r\n map[identifier] = value;\r\n }\r\n }\r\n }\r\n if (Functions.isObject(input)) {\r\n for (var identifier in input) {\r\n map[identifier] = parseMeta(input[identifier]);\r\n }\r\n }\r\n out.map = map;\r\n return out;\r\n };\r\n /**\r\n * Parses an object which specifies a schedule where events may or may not\r\n * repeat and they may be all day events or at specific times.\r\n *\r\n * @param input The input to parse into a schedule.\r\n * @param parseMeta A function to use when parsing meta input into the desired type.\r\n * @param out The schedule to set the values of and return.\r\n * @returns An instance of the parsed [[Schedule]].\r\n */\r\n Parse.schedule = function (input, parseMeta, out) {\r\n if (parseMeta === void 0) { parseMeta = (function (x) { return x; }); }\r\n if (out === void 0) { out = new Schedule_Schedule(); }\r\n if (input instanceof Schedule_Schedule) {\r\n return input;\r\n }\r\n var on = this.day(input.on);\r\n var times = this.times(input.times);\r\n var fullDay = times.length === 0;\r\n if (on) {\r\n input.start = on.start();\r\n input.end = on.end();\r\n input.year = [on.year];\r\n input.month = [on.month];\r\n input.dayOfMonth = [on.dayOfMonth];\r\n }\r\n out.times = times;\r\n out.duration = Functions.coalesce(input.duration, Constants.DURATION_DEFAULT);\r\n out.durationUnit = Functions.coalesce(input.durationUnit, Constants.DURATION_DEFAULT_UNIT(fullDay));\r\n out.start = this.day(input.start);\r\n out.end = this.day(input.end);\r\n out.exclude = this.modifier(input.exclude, true, undefined, out.exclude);\r\n out.include = this.modifier(input.include, true, undefined, out.include);\r\n out.cancel = this.modifier(input.cancel, true, undefined, out.cancel);\r\n out.meta = this.modifier(input.meta, null, parseMeta, out.meta);\r\n out.year = this.frequency(input.year, 'year');\r\n out.month = this.frequency(input.month, 'month');\r\n out.week = this.frequency(input.week, 'week');\r\n out.weekOfYear = this.frequency(input.weekOfYear, 'weekOfYear');\r\n out.weekspanOfYear = this.frequency(input.weekspanOfYear, 'weekspanOfYear');\r\n out.fullWeekOfYear = this.frequency(input.fullWeekOfYear, 'fullWeekOfYear');\r\n out.lastWeekspanOfYear = this.frequency(input.lastWeekspanOfYear, 'lastWeekspanOfYear');\r\n out.lastFullWeekOfYear = this.frequency(input.lastFullWeekOfYear, 'lastFullWeekOfYear');\r\n out.weekOfMonth = this.frequency(input.weekOfMonth, 'weekOfMonth');\r\n out.weekspanOfMonth = this.frequency(input.weekspanOfMonth, 'weekspanOfMonth');\r\n out.fullWeekOfMonth = this.frequency(input.fullWeekOfMonth, 'fullWeekOfMonth');\r\n out.lastWeekspanOfMonth = this.frequency(input.lastWeekspanOfMonth, 'lastWeekspanOfMonth');\r\n out.lastFullWeekOfMonth = this.frequency(input.lastFullWeekOfMonth, 'lastFullWeekOfMonth');\r\n out.dayOfWeek = this.frequency(input.dayOfWeek, 'dayOfWeek');\r\n out.dayOfMonth = this.frequency(input.dayOfMonth, 'dayOfMonth');\r\n out.lastDayOfMonth = this.frequency(input.lastDayOfMonth, 'lastDayOfMonth');\r\n out.dayOfYear = this.frequency(input.dayOfYear, 'dayOfYear');\r\n out.updateDurationInDays();\r\n out.updateChecks();\r\n return out;\r\n };\r\n /**\r\n * Parses an array of [[FrequencyCheck]] functions and returns an array of\r\n * functions for only the checks that were specified by the user.\r\n *\r\n * @param checks The array of check functions to filter through.\r\n * @returns The array of user specified checks.\r\n */\r\n Parse.givenFrequency = function (checks) {\r\n var out = [];\r\n for (var _i = 0, checks_1 = checks; _i < checks_1.length; _i++) {\r\n var check = checks_1[_i];\r\n if (check.given) {\r\n out.push(check);\r\n }\r\n }\r\n return out;\r\n };\r\n /**\r\n * Parses [[EventInput]] and returns an [[Event]].\r\n *\r\n * @param input The input to parse.\r\n * @param parseData A function to use when parsing data input into the desired type.\r\n * @param parseMeta A function to use when parsing meta input into the desired type.\r\n * @returns The parsed value.\r\n */\r\n Parse.event = function (input, parseData, parseMeta) {\r\n if (parseData === void 0) { parseData = (function (x) { return x; }); }\r\n if (parseMeta === void 0) { parseMeta = (function (x) { return x; }); }\r\n if (input instanceof Event) {\r\n return input;\r\n }\r\n if (!input.schedule) {\r\n return null;\r\n }\r\n var schedule = this.schedule(input.schedule, parseMeta);\r\n return new Event(schedule, parseData(input.data), input.id, input.visible);\r\n };\r\n /**\r\n * Parses a schedule from a CRON pattern. TODO\r\n */\r\n Parse.cron = function (pattern, out) {\r\n if (out === void 0) { out = new Schedule_Schedule(); }\r\n return out;\r\n };\r\n return Parse;\r\n}());\r\n\r\n\n// CONCATENATED MODULE: ./src/Day.ts\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_moment__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_moment___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_moment__);\n\r\n\r\n\r\n\r\n\r\n\r\n// @ts-ignore\r\n\r\n/**\r\n * A class which represents a point in time as\r\n */\r\nvar Day_Day = (function () {\r\n /**\r\n *\r\n */\r\n function Day(date) {\r\n this.date = date;\r\n this.time = date.valueOf();\r\n this.millis = date.millisecond();\r\n this.seconds = date.second();\r\n this.minute = date.minute();\r\n this.hour = date.hour();\r\n this.month = date.month();\r\n this.year = date.year();\r\n this.quarter = date.quarter();\r\n this.dayOfWeek = date.day();\r\n this.dayOfMonth = date.date();\r\n this.dayOfYear = date.dayOfYear();\r\n this.week = date.week();\r\n this.lastDayOfMonth = Day.getLastDayOfMonth(date);\r\n this.weekOfYear = Day.getWeekOfYear(date);\r\n this.weekspanOfYear = Day.getWeekspanOfYear(date);\r\n this.fullWeekOfYear = Day.getFullWeekOfYear(date);\r\n this.lastWeekspanOfYear = Day.getLastWeekspanOfYear(date);\r\n this.lastFullWeekOfYear = Day.getLastFullWeekOfYear(date);\r\n this.weekOfMonth = Day.getWeekOfMonth(date);\r\n this.weekspanOfMonth = Day.getWeekspanOfMonth(date);\r\n this.fullWeekOfMonth = Day.getFullWeekOfMonth(date);\r\n this.lastWeekspanOfMonth = Day.getLastWeekspanOfMonth(date);\r\n this.lastFullWeekOfMonth = Day.getLastFullWeekOfMonth(date);\r\n this.timeIdentifier = Identifier_Identifier.Time.get(this);\r\n this.dayIdentifier = Identifier_Identifier.Day.get(this);\r\n this.weekIdentifier = Identifier_Identifier.Week.get(this);\r\n this.monthIdentifier = Identifier_Identifier.Month.get(this);\r\n this.quarterIdentifier = Identifier_Identifier.Quarter.get(this);\r\n }\r\n // Same\r\n /**\r\n *\r\n */\r\n Day.prototype.sameDay = function (day) {\r\n return this.dayIdentifier === day.dayIdentifier;\r\n };\r\n /**\r\n *\r\n */\r\n Day.prototype.sameMonth = function (day) {\r\n return this.monthIdentifier === day.monthIdentifier;\r\n };\r\n /**\r\n *\r\n */\r\n Day.prototype.sameWeek = function (day) {\r\n return this.weekIdentifier === day.weekIdentifier;\r\n };\r\n /**\r\n *\r\n */\r\n Day.prototype.sameYear = function (day) {\r\n return this.year === day.year;\r\n };\r\n /**\r\n *\r\n */\r\n Day.prototype.sameQuarter = function (day) {\r\n return this.quarterIdentifier === day.quarterIdentifier;\r\n };\r\n /**\r\n *\r\n */\r\n Day.prototype.sameHour = function (day) {\r\n return this.dayIdentifier === day.dayIdentifier && this.hour === day.hour;\r\n };\r\n /**\r\n *\r\n */\r\n Day.prototype.sameMinute = function (day) {\r\n return this.timeIdentifier === day.timeIdentifier;\r\n };\r\n /**\r\n *\r\n */\r\n Day.prototype.sameTime = function (time) {\r\n return this.hour === time.hour && this.minute === time.minute && this.seconds === time.second && this.millis === time.millisecond;\r\n };\r\n // Comparison\r\n /**\r\n *\r\n */\r\n Day.prototype.isBefore = function (day, precision) {\r\n return this.date.isBefore(day.date, precision);\r\n };\r\n /**\r\n *\r\n */\r\n Day.prototype.isSameOrBefore = function (day, precision) {\r\n return this.date.isSameOrBefore(day.date, precision);\r\n };\r\n /**\r\n *\r\n */\r\n Day.prototype.isAfter = function (day, precision) {\r\n return this.date.isAfter(day.date, precision);\r\n };\r\n /**\r\n *\r\n */\r\n Day.prototype.isSameOrAfter = function (day, precision) {\r\n return this.date.isSameOrAfter(day.date, precision);\r\n };\r\n /**\r\n *\r\n */\r\n Day.prototype.max = function (day) {\r\n return this.date.isAfter(day.date) ? this : day;\r\n };\r\n /**\r\n *\r\n */\r\n Day.prototype.min = function (day) {\r\n return this.date.isBefore(day.date) ? this : day;\r\n };\r\n // Between\r\n Day.prototype.millisBetween = function (day, op, absolute) {\r\n if (op === void 0) { op = Op.DOWN; }\r\n if (absolute === void 0) { absolute = true; }\r\n return operate(this.date.diff(day.date, 'milliseconds', true), op, absolute);\r\n };\r\n Day.prototype.secondsBetween = function (day, op, absolute) {\r\n if (op === void 0) { op = Op.DOWN; }\r\n if (absolute === void 0) { absolute = true; }\r\n return operate(this.date.diff(day.date, 'seconds', true), op, absolute);\r\n };\r\n Day.prototype.minutesBetween = function (day, op, absolute) {\r\n if (op === void 0) { op = Op.DOWN; }\r\n if (absolute === void 0) { absolute = true; }\r\n return operate(this.date.diff(day.date, 'minutes', true), op, absolute);\r\n };\r\n Day.prototype.hoursBetween = function (day, op, absolute) {\r\n if (op === void 0) { op = Op.DOWN; }\r\n if (absolute === void 0) { absolute = true; }\r\n return operate(this.date.diff(day.date, 'hours', true), op, absolute);\r\n };\r\n Day.prototype.daysBetween = function (day, op, absolute) {\r\n if (op === void 0) { op = Op.DOWN; }\r\n if (absolute === void 0) { absolute = true; }\r\n return operate(this.date.diff(day.date, 'days', true), op, absolute);\r\n };\r\n Day.prototype.weeksBetween = function (day, op, absolute) {\r\n if (op === void 0) { op = Op.DOWN; }\r\n if (absolute === void 0) { absolute = true; }\r\n return operate(this.date.diff(day.date, 'weeks', true), op, absolute);\r\n };\r\n Day.prototype.monthsBetween = function (day, op, absolute) {\r\n if (op === void 0) { op = Op.DOWN; }\r\n if (absolute === void 0) { absolute = true; }\r\n return operate(this.date.diff(day.date, 'months', true), op, absolute);\r\n };\r\n Day.prototype.yearsBetween = function (day, op, absolute) {\r\n if (op === void 0) { op = Op.DOWN; }\r\n if (absolute === void 0) { absolute = true; }\r\n return operate(this.date.diff(day.date, 'years', true), op, absolute);\r\n };\r\n Day.prototype.isBetween = function (start, end, inclusive) {\r\n if (inclusive === void 0) { inclusive = true; }\r\n return this.date.isBetween(start.date, end.date, null, inclusive ? '[]' : '[)');\r\n };\r\n Day.prototype.mutate = function (mutator) {\r\n var d = this.toMoment();\r\n mutator(d);\r\n return new Day(d);\r\n };\r\n Day.prototype.add = function (amount, unit) {\r\n return this.mutate(function (d) { return d.add(amount, unit); });\r\n };\r\n Day.prototype.relative = function (millis) {\r\n return this.mutate(function (d) { return d.add(millis, 'milliseconds'); });\r\n };\r\n // Days\r\n Day.prototype.relativeDays = function (days) {\r\n return this.mutate(function (d) { return d.add(days, 'days'); });\r\n };\r\n Day.prototype.prev = function (days) {\r\n if (days === void 0) { days = 1; }\r\n return this.relativeDays(-days);\r\n };\r\n Day.prototype.next = function (days) {\r\n if (days === void 0) { days = 1; }\r\n return this.relativeDays(days);\r\n };\r\n Day.prototype.withDayOfMonth = function (day) {\r\n return this.mutate(function (d) { return d.date(day); });\r\n };\r\n Day.prototype.withDayOfWeek = function (dayOfWeek) {\r\n return this.mutate(function (d) { return d.day(dayOfWeek); });\r\n };\r\n Day.prototype.withDayOfYear = function (dayOfYear) {\r\n return this.mutate(function (d) { return d.dayOfYear(dayOfYear); });\r\n };\r\n // Month\r\n Day.prototype.withMonth = function (month) {\r\n return this.mutate(function (d) { return d.month(month); });\r\n };\r\n Day.prototype.relativeMonths = function (months) {\r\n return this.mutate(function (d) { return d.add(months, 'months'); });\r\n };\r\n Day.prototype.prevMonth = function (months) {\r\n if (months === void 0) { months = 1; }\r\n return this.relativeMonths(-months);\r\n };\r\n Day.prototype.nextMonth = function (months) {\r\n if (months === void 0) { months = 1; }\r\n return this.relativeMonths(months);\r\n };\r\n // Week Of Year\r\n Day.prototype.withWeek = function (week, relativeWeek) {\r\n if (relativeWeek === void 0) { relativeWeek = this.week; }\r\n return this.mutate(function (d) { return d.add((week - relativeWeek) * Constants.DAYS_IN_WEEK, 'days'); });\r\n };\r\n Day.prototype.withWeekOfYear = function (week) {\r\n return this.withWeek(week, this.weekOfYear);\r\n };\r\n Day.prototype.withFullWeekOfYear = function (week) {\r\n return this.withWeek(week, this.fullWeekOfYear);\r\n };\r\n Day.prototype.withWeekspanOfYear = function (week) {\r\n return this.withWeek(week, this.weekspanOfYear);\r\n };\r\n Day.prototype.withWeekOfMonth = function (week) {\r\n return this.withWeek(week, this.weekOfMonth);\r\n };\r\n Day.prototype.withWeekspanOfMonth = function (week) {\r\n return this.withWeek(week, this.weekspanOfMonth);\r\n };\r\n Day.prototype.withFullWeekOfMonth = function (week) {\r\n return this.withWeek(week, this.fullWeekOfMonth);\r\n };\r\n Day.prototype.relativeWeeks = function (weeks) {\r\n return this.mutate(function (d) { return d.add(weeks, 'weeks'); });\r\n };\r\n Day.prototype.prevWeek = function (weeks) {\r\n if (weeks === void 0) { weeks = 1; }\r\n return this.relativeWeeks(-weeks);\r\n };\r\n Day.prototype.nextWeek = function (weeks) {\r\n if (weeks === void 0) { weeks = 1; }\r\n return this.relativeWeeks(weeks);\r\n };\r\n // Year\r\n Day.prototype.withYear = function (year) {\r\n return this.mutate(function (d) { return d.year(year); });\r\n };\r\n Day.prototype.relativeYears = function (years) {\r\n return this.mutate(function (d) { return d.add(years, 'year'); });\r\n };\r\n Day.prototype.prevYear = function (years) {\r\n if (years === void 0) { years = 1; }\r\n return this.relativeYears(-years);\r\n };\r\n Day.prototype.nextYear = function (years) {\r\n if (years === void 0) { years = 1; }\r\n return this.relativeYears(years);\r\n };\r\n // Hour\r\n Day.prototype.withHour = function (hour) {\r\n return this.mutate(function (d) { return d.hour(hour); });\r\n };\r\n Day.prototype.relativeHours = function (hours) {\r\n return this.mutate(function (d) { return d.add(hours, 'hours'); });\r\n };\r\n Day.prototype.prevHour = function (hours) {\r\n if (hours === void 0) { hours = 1; }\r\n return this.relativeHours(-hours);\r\n };\r\n Day.prototype.nextHour = function (hours) {\r\n if (hours === void 0) { hours = 1; }\r\n return this.relativeHours(hours);\r\n };\r\n // Time\r\n Day.prototype.withTimes = function (hour, minute, second, millisecond) {\r\n if (hour === void 0) { hour = Constants.HOUR_MIN; }\r\n if (minute === void 0) { minute = Constants.MINUTE_MIN; }\r\n if (second === void 0) { second = Constants.SECOND_MIN; }\r\n if (millisecond === void 0) { millisecond = Constants.MILLIS_MIN; }\r\n return this.mutate(function (d) { return d.set({ hour: hour, minute: minute, second: second, millisecond: millisecond }); });\r\n };\r\n Day.prototype.withTime = function (time) {\r\n return this.withTimes(time.hour, time.minute, time.second, time.millisecond);\r\n };\r\n Day.prototype.asTime = function () {\r\n return new Time_Time(this.hour, this.minute, this.seconds, this.millis);\r\n };\r\n // Start & End\r\n // Time\r\n Day.prototype.start = function () {\r\n return this.mutate(function (d) { return d.startOf('day'); });\r\n };\r\n Day.prototype.isStart = function () {\r\n return this.hour === Constants.HOUR_MIN &&\r\n this.minute === Constants.MINUTE_MIN &&\r\n this.seconds === Constants.SECOND_MIN &&\r\n this.millis === Constants.MILLIS_MIN;\r\n };\r\n Day.prototype.end = function (inclusive) {\r\n if (inclusive === void 0) { inclusive = true; }\r\n return inclusive ?\r\n this.mutate(function (d) { return d.endOf('day'); }) :\r\n this.mutate(function (d) { return d.startOf('day').add(1, 'day'); });\r\n };\r\n Day.prototype.isEnd = function () {\r\n return this.hour === Constants.HOUR_MAX &&\r\n this.minute === Constants.MINUTE_MAX &&\r\n this.seconds === Constants.SECOND_MAX &&\r\n this.millis === Constants.MILLIS_MAX;\r\n };\r\n // Hour\r\n Day.prototype.startOfHour = function () {\r\n return this.mutate(function (d) { return d.startOf('hour'); });\r\n };\r\n Day.prototype.isStartOfHour = function () {\r\n return this.minute === Constants.MINUTE_MIN &&\r\n this.seconds === Constants.SECOND_MIN &&\r\n this.millis === Constants.MILLIS_MIN;\r\n };\r\n Day.prototype.endOfHour = function (inclusive) {\r\n if (inclusive === void 0) { inclusive = true; }\r\n return inclusive ?\r\n this.mutate(function (d) { return d.endOf('hour'); }) :\r\n this.mutate(function (d) { return d.startOf('hour').add(1, 'hour'); });\r\n };\r\n Day.prototype.isEndOfHour = function () {\r\n return this.minute === Constants.MINUTE_MAX &&\r\n this.seconds === Constants.SECOND_MAX &&\r\n this.millis === Constants.MILLIS_MAX;\r\n };\r\n // Week\r\n Day.prototype.startOfWeek = function () {\r\n return this.mutate(function (d) { return d.startOf('week'); });\r\n };\r\n Day.prototype.isStartOfWeek = function () {\r\n return this.dayOfWeek === Constants.WEEKDAY_MIN;\r\n };\r\n Day.prototype.endOfWeek = function (inclusive) {\r\n if (inclusive === void 0) { inclusive = true; }\r\n return inclusive ?\r\n this.mutate(function (d) { return d.endOf('week'); }) :\r\n this.mutate(function (d) { return d.startOf('week').add(1, 'week'); });\r\n };\r\n Day.prototype.isEndOfWeek = function () {\r\n return this.dayOfWeek === Constants.WEEKDAY_MAX;\r\n };\r\n // Month\r\n Day.prototype.startOfMonth = function () {\r\n return this.mutate(function (d) { return d.startOf('month'); });\r\n };\r\n Day.prototype.isStartOfMonth = function () {\r\n return this.dayOfMonth === Constants.DAY_MIN;\r\n };\r\n Day.prototype.endOfMonth = function (inclusive) {\r\n if (inclusive === void 0) { inclusive = true; }\r\n return inclusive ?\r\n this.mutate(function (d) { return d.endOf('month'); }) :\r\n this.mutate(function (d) { return d.startOf('month').add(1, 'month'); });\r\n };\r\n Day.prototype.isEndOfMonth = function () {\r\n return this.dayOfMonth === this.daysInMonth();\r\n };\r\n // Year\r\n Day.prototype.startOfYear = function () {\r\n return this.mutate(function (d) { return d.startOf('year'); });\r\n };\r\n Day.prototype.isStartOfYear = function () {\r\n return this.month === Constants.MONTH_MIN && this.dayOfMonth === Constants.DAY_MIN;\r\n };\r\n Day.prototype.endOfYear = function (inclusive) {\r\n if (inclusive === void 0) { inclusive = true; }\r\n return inclusive ?\r\n this.mutate(function (d) { return d.endOf('year'); }) :\r\n this.mutate(function (d) { return d.startOf('year').add(1, 'year'); });\r\n };\r\n Day.prototype.isEndOfYear = function () {\r\n return this.month === Constants.MONTH_MAX && this.dayOfMonth === Constants.DAY_MAX;\r\n };\r\n // Days In X\r\n Day.prototype.daysInMonth = function () {\r\n return this.date.daysInMonth();\r\n };\r\n Day.prototype.daysInYear = function () {\r\n return this.endOfYear().dayOfYear;\r\n };\r\n Day.prototype.weeksInYear = function () {\r\n return this.date.weeksInYear();\r\n };\r\n // Display\r\n Day.prototype.format = function (format) {\r\n return this.date.format(format);\r\n };\r\n Day.prototype.utc = function (keepLocalTime) {\r\n return this.mutate(function (d) { return d.utc(keepLocalTime); });\r\n };\r\n Day.prototype.toMoment = function () {\r\n return this.date.clone();\r\n };\r\n Day.prototype.toDate = function () {\r\n return this.date.toDate();\r\n };\r\n Day.prototype.toArray = function () {\r\n return this.date.toArray();\r\n };\r\n Day.prototype.toJSON = function () {\r\n return this.date.toJSON();\r\n };\r\n Day.prototype.toISOString = function (keepOffset) {\r\n if (keepOffset === void 0) { keepOffset = false; }\r\n return this.date.toISOString(keepOffset);\r\n };\r\n Day.prototype.toObject = function () {\r\n return this.date.toObject();\r\n };\r\n Day.prototype.toString = function () {\r\n return this.date.toString();\r\n };\r\n // State\r\n Day.prototype.isDST = function () {\r\n return this.date.isDST();\r\n };\r\n Day.prototype.isLeapYear = function () {\r\n return this.date.isLeapYear();\r\n };\r\n // Instances\r\n Day.now = function () {\r\n return new Day(__WEBPACK_IMPORTED_MODULE_5_moment__());\r\n };\r\n Day.today = function () {\r\n return this.now().start();\r\n };\r\n Day.tomorrow = function () {\r\n return this.today().next();\r\n };\r\n Day.fromMoment = function (moment) {\r\n return moment && moment.isValid() ? new Day(moment) : null;\r\n };\r\n Day.unix = function (millis) {\r\n return this.fromMoment(__WEBPACK_IMPORTED_MODULE_5_moment__(millis));\r\n };\r\n Day.unixSeconds = function (millis) {\r\n return this.fromMoment(__WEBPACK_IMPORTED_MODULE_5_moment__[\"unix\"](millis));\r\n };\r\n Day.parse = function (input) {\r\n return Parse_Parse.day(input);\r\n };\r\n Day.fromString = function (input) {\r\n return this.fromMoment(__WEBPACK_IMPORTED_MODULE_5_moment__(input));\r\n };\r\n Day.fromFormat = function (input, formats) {\r\n return this.fromMoment(__WEBPACK_IMPORTED_MODULE_5_moment__(input, formats));\r\n };\r\n Day.fromObject = function (input) {\r\n return this.fromMoment(__WEBPACK_IMPORTED_MODULE_5_moment__(input));\r\n };\r\n Day.fromDate = function (input) {\r\n return this.fromMoment(__WEBPACK_IMPORTED_MODULE_5_moment__(input));\r\n };\r\n Day.fromArray = function (input) {\r\n return this.fromMoment(__WEBPACK_IMPORTED_MODULE_5_moment__(input));\r\n };\r\n Day.fromDayIdentifier = function (id) {\r\n var date = id % 100;\r\n var month = (Math.floor(id / 100) % 100) - 1;\r\n var year = Math.floor(id / 10000);\r\n return this.build(year, month, date);\r\n };\r\n Day.build = function (year, month, date, hour, minute, second, millisecond) {\r\n if (date === void 0) { date = Constants.DAY_MIN; }\r\n if (hour === void 0) { hour = Constants.HOUR_MIN; }\r\n if (minute === void 0) { minute = Constants.MINUTE_MIN; }\r\n if (second === void 0) { second = Constants.SECOND_MIN; }\r\n if (millisecond === void 0) { millisecond = Constants.MILLIS_MIN; }\r\n return new Day(__WEBPACK_IMPORTED_MODULE_5_moment__({ year: year, month: month, date: date, hour: hour, minute: minute, second: second, millisecond: millisecond }));\r\n };\r\n Day.getWeekspanOfYear = function (date) {\r\n return Math.floor((date.dayOfYear() - 1) / Constants.DAYS_IN_WEEK);\r\n };\r\n Day.getLastWeekspanOfYear = function (date) {\r\n var lastOfYear = date.clone().endOf('year');\r\n var daysInYear = lastOfYear.dayOfYear();\r\n return Math.floor((daysInYear - date.dayOfYear()) / Constants.DAYS_IN_WEEK);\r\n };\r\n Day.getWeekOfYear = function (date) {\r\n var firstOfYear = date.clone().startOf('year');\r\n var weeks = date.week();\r\n return firstOfYear.day() > Constants.WEEK_OF_MONTH_MINIMUM_WEEKDAY ? weeks - 1 : weeks;\r\n };\r\n Day.getFullWeekOfYear = function (date) {\r\n var firstOfYear = date.clone().startOf('year');\r\n var weeks = date.week();\r\n return firstOfYear.day() === Constants.WEEKDAY_MIN ? weeks : weeks - 1;\r\n };\r\n Day.getLastFullWeekOfYear = function (date) {\r\n var firstOfYear = date.clone().startOf('year');\r\n var weeks = date.week();\r\n var weeksMax = date.weeksInYear();\r\n var lastWeek = weeksMax - weeks;\r\n return firstOfYear.day() === Constants.WEEKDAY_MIN ? lastWeek + 1 : lastWeek;\r\n };\r\n Day.getWeekspanOfMonth = function (date) {\r\n return Math.floor((date.date() - 1) / Constants.DAYS_IN_WEEK);\r\n };\r\n Day.getLastWeekspanOfMonth = function (date) {\r\n return Math.floor((date.daysInMonth() - date.date()) / Constants.DAYS_IN_WEEK);\r\n };\r\n Day.getFullWeekOfMonth = function (date) {\r\n return Math.floor((date.date() - 1 - date.day() + Constants.DAYS_IN_WEEK) / Constants.DAYS_IN_WEEK);\r\n };\r\n Day.getLastFullWeekOfMonth = function (date) {\r\n return Math.floor((date.daysInMonth() - date.date() - (Constants.WEEKDAY_MAX - date.day()) + Constants.DAYS_IN_WEEK) / Constants.DAYS_IN_WEEK);\r\n };\r\n Day.getWeekOfMonth = function (date) {\r\n var dom = date.date();\r\n var dow = date.day();\r\n var sundayDate = dom - dow;\r\n return Math.floor((sundayDate + Constants.WEEK_OF_MONTH_MINIMUM_WEEKDAY + 5) / Constants.DAYS_IN_WEEK);\r\n };\r\n Day.getLastDayOfMonth = function (date) {\r\n return date.daysInMonth() - date.date() + 1;\r\n };\r\n return Day;\r\n}());\r\n\r\n\n// CONCATENATED MODULE: ./src/CalendarDay.ts\n\r\nvar CalendarDay___extends = (this && this.__extends) || (function () {\r\n var extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return function (d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n };\r\n})();\r\n\r\n\r\n/**\r\n * A day in a [[Calendar]] with extra information relative to any selection on\r\n * the calendar, the current date, or events on the day.\r\n *\r\n * @typeparam T The type of data stored in the [[Event]] class.\r\n * @typeparam M The type of metadata stored in the schedule.\r\n */\r\nvar CalendarDay_CalendarDay = (function (_super) {\r\n CalendarDay___extends(CalendarDay, _super);\r\n function CalendarDay() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n /**\r\n * Whether this day is the current day (ex: today).\r\n */\r\n _this.currentDay = false;\r\n /**\r\n * Whether this day is on the same week as the current day (ex: today).\r\n */\r\n _this.currentWeek = false;\r\n /**\r\n * Whether this day is on the same month as the current day (ex: today).\r\n */\r\n _this.currentMonth = false;\r\n /**\r\n * Whether this day is on the same year as the current day (ex: today).\r\n */\r\n _this.currentYear = false;\r\n /**\r\n * How many days away this day is from the current day (ex: today). If this\r\n * day is the current day the offset is 0. If this day is before the current\r\n * day it will be the negative number of days away. Otherwise this will be\r\n * positive meaning this day is after the current day by the given days.\r\n */\r\n _this.currentOffset = 0;\r\n /**\r\n * Whether this day is part of a selection on the calendar.\r\n */\r\n _this.selectedDay = false;\r\n /**\r\n * Whether this day is on the same week that the calendar selection is.\r\n */\r\n _this.selectedWeek = false;\r\n /**\r\n * Whether this day is on the same month that the calendar selection is.\r\n */\r\n _this.selectedMonth = false;\r\n /**\r\n * Whether this day is on the same year that the calendar selection is.\r\n */\r\n _this.selectedYear = false;\r\n /**\r\n * Whether this day is in the current calendar or not. Some days are outside\r\n * the calendar span and used to fill in weeks. Month calendars will fill in\r\n * days so the list of days in the calendar start on Sunday and end on Saturday.\r\n */\r\n _this.inCalendar = false;\r\n /**\r\n * The list of events on this day based on the settings and schedules in the\r\n * calendar.\r\n */\r\n _this.events = [];\r\n return _this;\r\n }\r\n /**\r\n * Updates the current flags on this day given the current day (ex: today).\r\n *\r\n * @param current The current day of the calendar.\r\n */\r\n CalendarDay.prototype.updateCurrent = function (current) {\r\n this.currentDay = this.sameDay(current);\r\n this.currentWeek = this.sameWeek(current);\r\n this.currentMonth = this.sameMonth(current);\r\n this.currentYear = this.sameYear(current);\r\n this.currentOffset = this.daysBetween(current, Op.DOWN, false);\r\n return this;\r\n };\r\n /**\r\n * Updates the selection flags on this day given the selection range on the\r\n * calendar.\r\n *\r\n * @param selected The span of days selected on the calendar.\r\n */\r\n CalendarDay.prototype.updateSelected = function (selected) {\r\n this.selectedDay = selected.matchesDay(this);\r\n this.selectedWeek = selected.matchesWeek(this);\r\n this.selectedMonth = selected.matchesMonth(this);\r\n this.selectedYear = selected.matchesYear(this);\r\n return this;\r\n };\r\n /**\r\n * Clears the selection flags on this day. This is done when the selection on\r\n * the calendar is cleared.\r\n */\r\n CalendarDay.prototype.clearSelected = function () {\r\n this.selectedDay = this.selectedWeek = this.selectedMonth = this.selectedYear = false;\r\n return this;\r\n };\r\n return CalendarDay;\r\n}(Day_Day));\r\n\r\n\n// CONCATENATED MODULE: ./src/CalendarEvent.ts\n\r\n\r\n/**\r\n * An instance of an [[Event]] on a given day of a [[Calendar]] generated by\r\n * the event's [[Schedule]].\r\n *\r\n * @typeparam T The type of data stored in the [[Event]] class.\r\n * @typeparam M The type of metadata stored in the schedule and in this class.\r\n */\r\nvar CalendarEvent_CalendarEvent = (function () {\r\n /**\r\n * Creates a new event instance given the id, the event paired with the\r\n * schedule, the schedule, the time span of the event, and the day on the\r\n * calendar the event belongs to.\r\n *\r\n * @param id The relatively unique identifier of this event.\r\n * @param event The event which created this instance.\r\n * @param time The time span of this event.\r\n * @param actualDay The day on the calendar this event is for.\r\n */\r\n function CalendarEvent(id, event, time, actualDay) {\r\n /**\r\n * The row this event is on in a visual calendar. An event can span multiple\r\n * days and it is desirable to have the occurrence on each day to line up.\r\n * This is only set when [[Calendar.updateRows]] is true or manually set.\r\n * This value makes sense for visual calendars for all day events or when the\r\n * visual calendar is not positioning events based on their time span.\r\n */\r\n this.row = 0;\r\n /**\r\n * The column this event is on in a visual calendar. An event can have its\r\n * time overlap with another event displaying one of the events in another\r\n * column. This is only set when [[Calendar.updateColumns]] is true or\r\n * manually set. This value makes sense for visual calendars that are\r\n * displaying event occurrences at specific times positioned accordingly.\r\n */\r\n this.col = 0;\r\n this.id = id;\r\n this.event = event;\r\n this.time = time;\r\n this.day = actualDay;\r\n this.fullDay = event.schedule.isFullDay();\r\n this.meta = event.schedule.getMeta(time.start);\r\n this.cancelled = event.schedule.isCancelled(time.start);\r\n this.starting = time.isPoint || time.start.sameDay(actualDay);\r\n this.ending = time.isPoint || time.end.relative(-1).sameDay(actualDay);\r\n }\r\n Object.defineProperty(CalendarEvent.prototype, \"scheduleId\", {\r\n /**\r\n * The id of the schedule uniqe within the calendar which generated this event.\r\n */\r\n get: function () {\r\n return Math.floor(this.id / Constants.MAX_EVENTS_PER_DAY);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CalendarEvent.prototype, \"start\", {\r\n /**\r\n * The start timestamp of the event.\r\n */\r\n get: function () {\r\n return this.time.start;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CalendarEvent.prototype, \"end\", {\r\n /**\r\n * The end timestamp of the event.\r\n */\r\n get: function () {\r\n return this.time.end;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CalendarEvent.prototype, \"schedule\", {\r\n /**\r\n * The schedule which generated this event.\r\n */\r\n get: function () {\r\n return this.event.schedule;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CalendarEvent.prototype, \"data\", {\r\n /**\r\n * The related event data.\r\n */\r\n get: function () {\r\n return this.event.data;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CalendarEvent.prototype, \"identifier\", {\r\n /**\r\n * An [[IdentifierInput]] for the start of this event.\r\n */\r\n get: function () {\r\n return this.identifierType.get(this.start);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CalendarEvent.prototype, \"identifierType\", {\r\n /**\r\n * The [[Identifier]] for this event. Either [[Identifier.Day]] or\r\n * [[Identifier.Time]].\r\n */\r\n get: function () {\r\n return this.schedule.identifierType;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CalendarEvent.prototype, \"startDelta\", {\r\n /**\r\n * Returns a delta value between 0 and 1 which represents where the\r\n * [[CalendarEvent.start]] is relative to [[CalendarEvent.day]]. The delta\r\n * value would be less than 0 if the start of the event is before\r\n * [[CalendarEvent.day]].\r\n */\r\n get: function () {\r\n return this.time.startDelta(this.day);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CalendarEvent.prototype, \"endDelta\", {\r\n /**\r\n * Returns a delta value between 0 and 1 which represents where the\r\n * [[CalendarEvent.end]] is relative to [[CalendarEvent.day]]. The delta value\r\n * would be greater than 1 if the end of the event is after\r\n * [[CalendarEvent.day]].\r\n */\r\n get: function () {\r\n return this.time.endDelta(this.day);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Calculates the bounds for this event if it were placed in a rectangle which\r\n * represents a day (24 hour period). By default the returned values are\r\n * between 0 and 1 and can be scaled by the proper rectangle dimensions or the\r\n * rectangle dimensions can be passed to this function.\r\n *\r\n * @param dayHeight The height of the rectangle of the day.\r\n * @param dayWidth The width of the rectangle of the day.\r\n * @param columnOffset The offset in the rectangle of the day to adjust this\r\n * event by if it intersects or is contained in a previous event. This also\r\n * reduces the width of the returned bounds to keep the bounds in the\r\n * rectangle of the day.\r\n * @param clip `true` if the bounds should stay in the day rectangle, `false`\r\n * and the bounds may go outside the rectangle of the day for multi-day\r\n * events.\r\n * @param offsetX How much to translate the left & right properties by.\r\n * @param offsetY How much to translate the top & bottom properties by.\r\n * @returns The calculated bounds for this event.\r\n */\r\n CalendarEvent.prototype.getTimeBounds = function (dayHeight, dayWidth, columnOffset, clip, offsetX, offsetY) {\r\n if (dayHeight === void 0) { dayHeight = 1; }\r\n if (dayWidth === void 0) { dayWidth = 1; }\r\n if (columnOffset === void 0) { columnOffset = 0.1; }\r\n if (clip === void 0) { clip = true; }\r\n if (offsetX === void 0) { offsetX = 0; }\r\n if (offsetY === void 0) { offsetY = 0; }\r\n return this.time.getBounds(this.day, dayHeight, dayWidth, this.col * columnOffset, clip, offsetX, offsetY);\r\n };\r\n /**\r\n * Changes the cancellation status of this event. By default this cancels\r\n * this event - but `false` may be passed to undo a cancellation.\r\n *\r\n * @param cancelled Whether the event should be cancelled.\r\n */\r\n CalendarEvent.prototype.cancel = function (cancelled) {\r\n if (cancelled === void 0) { cancelled = true; }\r\n this.schedule.setCancelled(this.start, cancelled);\r\n this.cancelled = cancelled;\r\n return this;\r\n };\r\n /**\r\n * Changes the exclusion status of this event. By default this excludes this\r\n * event - but `false` may be passed to undo an exclusion.\r\n *\r\n * @param excluded Whether the event should be excluded.\r\n */\r\n CalendarEvent.prototype.exclude = function (excluded) {\r\n if (excluded === void 0) { excluded = true; }\r\n this.schedule.setExcluded(this.start, excluded);\r\n return this;\r\n };\r\n /**\r\n * Moves this event to potentially another day and time. A move is\r\n * accomplished by excluding the current event and adding an inclusion of the\r\n * new day & time. Any [[CalendarEvent.meta]] on this event will be moved to\r\n * the new event. If the schedule represents a single event\r\n * ([[Schedule.isSingleEvent]]) then the schedule frequencies are updated\r\n * to match the timestamp provided.\r\n *\r\n * @param toTime The timestamp to move this event to.\r\n * @returns Whether the event was moved to the given time.\r\n */\r\n CalendarEvent.prototype.move = function (toTime) {\r\n return this.schedule.move(toTime, this.start, this.meta);\r\n };\r\n return CalendarEvent;\r\n}());\r\n\r\n\n// CONCATENATED MODULE: ./src/Calendar.ts\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * A collection of [[CalendarDay]]s, the events on the calendar, and all\r\n * [[CalendarEvent]]s generated based on the events.\r\n *\r\n * @typeparam T The type of data stored in the [[Event]] class.\r\n * @typeparam M The type of metadata stored in the schedule.\r\n */\r\nvar Calendar_Calendar = (function () {\r\n /**\r\n * Creates a new calendar given a span, type, size, moving functions, and\r\n * optionally some default properties for the calendar.\r\n *\r\n * @param start The first day on the calendar.\r\n * @param end The last day on the calendar.\r\n * @param type The calendar type used for describing the calendar and splitting it.\r\n * @param size The number of calendar types in this calendar.\r\n * @param moveStart The function to move the start day.\r\n * @param moveEnd The function to move the end by.\r\n * @param input The default properties for this calendar.\r\n * @see [[Calendar.start]]\r\n * @see [[Calendar.end]]\r\n * @see [[Calendar.type]]\r\n * @see [[Calendar.size]]\r\n * @see [[Calendar.moveStart]]\r\n * @see [[Calendar.moveEnd]]\r\n */\r\n function Calendar(start, end, type, size, moveStart, moveEnd, input) {\r\n /**\r\n * If the calendar should be filled in so the first day of the calendar is\r\n * Sunday and the last day is Saturday.\r\n */\r\n this.fill = false;\r\n /**\r\n * The minimum number of days in the calendar no matter what the type or size\r\n * is. This can be used to display a month with a constant number of weeks -\r\n * because not all months contain the same number of weeks.\r\n */\r\n this.minimumSize = 0;\r\n /**\r\n * When `true` a [[CalendarEvent]] instance exists on each [[CalendarDay]]\r\n * the event covers even if the event didn't start on that day.\r\n */\r\n this.repeatCovers = true;\r\n /**\r\n * When `true` an event instance will be created for each time specified on\r\n * the schedule. If the schedule specifies an all day event then only one\r\n * event is added to a day. This is typically done when displaying days or\r\n * weeks and events can be displayed on a timeline.\r\n */\r\n this.listTimes = false;\r\n /**\r\n * When `true` events will be added to days \"outside\" the calendar. Days\r\n * outside the calendar are days filled in when [[Calendar.fill]] is `true`.\r\n * More specifically days that are in [[Calendar.filled]] and not in\r\n * [[Calendar.span]].\r\n */\r\n this.eventsOutside = false;\r\n /**\r\n * When `true` [[CalendarEvent.row]] will be set so when visually displaying\r\n * the event with others multi-day events will align and not overlap.\r\n */\r\n this.updateRows = false;\r\n /**\r\n * When `true` [[CalendarEvent.col]] will be set so when visually displaying\r\n * the event based on start and end time any events that overlap with each\r\n * other will be \"indented\" to see the event below it.\r\n */\r\n this.updateColumns = false;\r\n /**\r\n * The function (if any) which sorts the events on a calendar day.\r\n */\r\n this.eventSorter = null;\r\n /**\r\n * A function to use when parsing meta input into the desired type.\r\n *\r\n * @param input The input to parse.\r\n * @returns The meta parsed from the given input, if any.\r\n */\r\n this.parseMeta = (function (x) { return x; });\r\n /**\r\n * A function to use when parsing meta input into the desired type.\r\n *\r\n * @param input The input to parse.\r\n * @returns The meta parsed from the given input, if any.\r\n */\r\n this.parseData = (function (x) { return x; });\r\n /**\r\n * A selection of days on the calendar. If no days are selected this is `null`.\r\n * This is merely used to keep the selection flags in [[CalendarDay]] updated\r\n * via [[Calendar.refreshSelection]].\r\n */\r\n this.selection = null;\r\n /**\r\n * The array of days in this calendar and their events.\r\n */\r\n this.days = [];\r\n /**\r\n * The array of scheduled events added to the calendar.\r\n */\r\n this.events = [];\r\n /**\r\n * The array of visible events on the calendar. This is built based on the\r\n * span of the schedule in the given event and also the [[Event.visible]] flag.\r\n */\r\n this.visible = [];\r\n this.span = new DaySpan_DaySpan(start, end);\r\n this.filled = new DaySpan_DaySpan(start, end);\r\n this.type = type;\r\n this.size = size;\r\n this.moveStart = moveStart;\r\n this.moveEnd = moveEnd;\r\n if (Functions.isDefined(input)) {\r\n this.set(input);\r\n }\r\n else {\r\n this.refresh();\r\n }\r\n }\r\n /**\r\n * Changes the calendar possibly morphing it to a different type or size if\r\n * specified in the given input. If the type and size are not morphed then\r\n * the following properties may be updated:\r\n *\r\n * - [[Calendar.fill]]\r\n * - [[Calendar.minimumSize]]\r\n * - [[Calendar.repeatCovers]]\r\n * - [[Calendar.listTimes]]\r\n * - [[Calendar.eventsOutside]]\r\n * - [[Calendar.updateRows]]\r\n * - [[Calendar.updateColumns]]\r\n * - [[Calendar.eventSorter]]\r\n * - [[Calendar.events]]\r\n * - [[Calendar.parseData]]\r\n * - [[Calendar.parseMeta]]\r\n *\r\n * If [[CalendarInput.delayRefresh]] is not given with `true` then\r\n * [[Calendar.refresh]] will be called once the calendar properties have been\r\n * updated.\r\n *\r\n * @param input The new properties for this calendar to overwrite with.\r\n */\r\n Calendar.prototype.set = function (input) {\r\n var typeChange = Functions.isDefined(input.type) && input.type !== this.type;\r\n var sizeChange = Functions.isDefined(input.size) && input.size !== this.size;\r\n if (typeChange || sizeChange) {\r\n var focus_1 = Functions.coalesce(input.otherwiseFocus, 0.4999);\r\n var prefer = Functions.coalesce(input.preferToday, true);\r\n var size = Functions.coalesce(input.size, this.size);\r\n var type = Functions.coalesce(input.type, this.type);\r\n var around = Functions.coalesce(input.around, this.days[Math.floor((this.days.length - 1) * focus_1)]);\r\n var today = Day_Day.today();\r\n if (!around || (prefer && this.span.matchesDay(today))) {\r\n around = today;\r\n }\r\n var meta = Calendar.TYPES[type];\r\n var start = meta.getStart(Day_Day.parse(around), size, focus_1);\r\n var end = meta.getEnd(start, size, focus_1);\r\n this.span.start = start;\r\n this.span.end = end;\r\n this.type = type;\r\n this.size = size;\r\n this.moveStart = meta.moveStart;\r\n this.moveEnd = meta.moveEnd;\r\n }\r\n else if (input.around) {\r\n var focus_2 = Functions.coalesce(input.otherwiseFocus, 0.4999);\r\n var around = Day_Day.parse(input.around);\r\n var type = this.type;\r\n var size = this.size;\r\n var meta = Calendar.TYPES[type];\r\n var start = meta.getStart(around, size, focus_2);\r\n var end = meta.getEnd(start, size, focus_2);\r\n this.span.start = start;\r\n this.span.end = end;\r\n }\r\n this.fill = Functions.coalesce(input.fill, this.fill);\r\n this.minimumSize = Functions.coalesce(input.minimumSize, this.minimumSize);\r\n this.repeatCovers = Functions.coalesce(input.repeatCovers, this.repeatCovers);\r\n this.listTimes = Functions.coalesce(input.listTimes, this.listTimes);\r\n this.eventsOutside = Functions.coalesce(input.eventsOutside, this.eventsOutside);\r\n this.updateRows = Functions.coalesce(input.updateRows, this.updateRows);\r\n this.updateColumns = Functions.coalesce(input.updateColumns, this.updateColumns);\r\n this.eventSorter = Functions.coalesce(input.eventSorter, this.eventSorter);\r\n this.parseMeta = Functions.coalesce(input.parseMeta, this.parseMeta);\r\n this.parseData = Functions.coalesce(input.parseData, this.parseData);\r\n if (Functions.isArray(input.events)) {\r\n this.removeEvents();\r\n this.addEvents(input.events, false, true);\r\n }\r\n if (!input.delayRefresh) {\r\n this.refresh();\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets the [[Calendar.minimumSize]] value and returns `this` for method\r\n * chaining.\r\n *\r\n * @param minimumSize The new value.\r\n */\r\n Calendar.prototype.withMinimumSize = function (minimumSize) {\r\n this.minimumSize = minimumSize;\r\n this.refresh();\r\n return this;\r\n };\r\n /**\r\n * Sets the [[Calendar.repeatCovers]] value and returns `this` for method\r\n * chaining.\r\n *\r\n * @param repeatCovers The new value.\r\n */\r\n Calendar.prototype.withRepeatCovers = function (repeatCovers) {\r\n this.repeatCovers = repeatCovers;\r\n this.refreshEvents();\r\n return this;\r\n };\r\n /**\r\n * Sets the [[Calendar.listTimes]] value and returns `this` for method\r\n * chaining.\r\n *\r\n * @param listTimes The new value.\r\n */\r\n Calendar.prototype.withListTimes = function (listTimes) {\r\n this.listTimes = listTimes;\r\n this.refreshEvents();\r\n return this;\r\n };\r\n /**\r\n * Sets the [[Calendar.eventsOutside]] value and returns `this` for method\r\n * chaining.\r\n *\r\n * @param eventsOutside The new value.\r\n */\r\n Calendar.prototype.withEventsOutside = function (eventsOutside) {\r\n this.eventsOutside = eventsOutside;\r\n this.refreshEvents();\r\n return this;\r\n };\r\n /**\r\n * Sets the [[Calendar.updateRows]] value and returns `this` for method\r\n * chaining.\r\n *\r\n * @param updateRows The new value.\r\n * @param refresh If the rows should be updated now if `updateRows` is `true`.\r\n */\r\n Calendar.prototype.withUpdateRows = function (updateRows, refresh) {\r\n if (refresh === void 0) { refresh = true; }\r\n this.updateRows = updateRows;\r\n if (refresh && updateRows) {\r\n this.refreshRows();\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets the [[Calendar.updateColumns]] value and returns `this` for method\r\n * chaining.\r\n *\r\n * @param updateColumns The new value.\r\n * @param refresh If the columns should be updated now if `updateColumns` is\r\n * `true`.\r\n */\r\n Calendar.prototype.withUpdateColumns = function (updateColumns, refresh) {\r\n if (refresh === void 0) { refresh = true; }\r\n this.updateColumns = updateColumns;\r\n if (refresh && updateColumns) {\r\n this.refreshColumns();\r\n }\r\n return this;\r\n };\r\n Object.defineProperty(Calendar.prototype, \"start\", {\r\n /**\r\n * Returns the start day of the calendar. If this calendar is filled, this\r\n * may not represent the very first day in the calendar.\r\n */\r\n get: function () {\r\n return this.span.start;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Calendar.prototype, \"end\", {\r\n /**\r\n * Returns the end day of the calendar. If this calendar is filled, this\r\n * may not represent the very last day in the calendar.\r\n */\r\n get: function () {\r\n return this.span.end;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the summary of the span of time this calendar represents.\r\n *\r\n * @param dayOfWeek [[DaySpan.summary]]\r\n * @param short [[DaySpan.summary]]\r\n * @param repeat [[DaySpan.summary]]\r\n * @param contextual [[DaySpan.summary]]\r\n * @param delimiter [[DaySpan.summary]]\r\n * @see [[DaySpan.summary]]\r\n */\r\n Calendar.prototype.summary = function (dayOfWeek, short, repeat, contextual, delimiter) {\r\n if (dayOfWeek === void 0) { dayOfWeek = true; }\r\n if (short === void 0) { short = false; }\r\n if (repeat === void 0) { repeat = false; }\r\n if (contextual === void 0) { contextual = true; }\r\n if (delimiter === void 0) { delimiter = ' - '; }\r\n return this.span.summary(this.type, dayOfWeek, short, repeat, contextual, delimiter);\r\n };\r\n /**\r\n * Splits up this calendar into an iterable collection of calendars. The\r\n * resulting iterator will return `size / by` number of calendars.\r\n *\r\n * @param by The new size of the resulting calendars. If the the size of the\r\n * current calendar is not divisible by this value the resulting calendars\r\n * may cover more or less than this calendar covers.\r\n * @returns An iterator for the calendars produced.\r\n */\r\n Calendar.prototype.split = function (by) {\r\n var _this = this;\r\n if (by === void 0) { by = 1; }\r\n return new Iterator_Iterator(function (iterator) {\r\n var start = _this.start;\r\n var end = _this.moveEnd(_this.end, by - _this.size);\r\n for (var i = 0; i < _this.size; i++) {\r\n var calendar = new Calendar(start, end, _this.type, by, _this.moveStart, _this.moveEnd, _this);\r\n if (iterator.act(calendar) === IteratorAction.Stop) {\r\n return;\r\n }\r\n start = _this.moveStart(start, by);\r\n end = _this.moveEnd(end, by);\r\n }\r\n });\r\n };\r\n /**\r\n * Refreshes the days and events in this calendar based on the start and end\r\n * days, the calendar properties, and its eventss.\r\n *\r\n * @param today The current day to update the calendar days via\r\n * [[CalendarDay.updateCurrent]].\r\n */\r\n Calendar.prototype.refresh = function (today) {\r\n if (today === void 0) { today = Day_Day.today(); }\r\n this.length = this.span.days(Op.UP, true);\r\n this.resetDays();\r\n this.refreshCurrent(today);\r\n this.refreshSelection();\r\n this.refreshVisible();\r\n this.refreshEvents();\r\n return this;\r\n };\r\n /**\r\n * Updates the [[Calendar.filled]] span based on [[Calendar.start]],\r\n * [[Calendar.end]], and [[Calendar.fill]] properties.\r\n */\r\n Calendar.prototype.resetFilled = function () {\r\n this.filled.start = this.fill ? this.start.startOfWeek() : this.start;\r\n this.filled.end = this.fill ? this.end.endOfWeek() : this.end;\r\n return this;\r\n };\r\n /**\r\n * Updates [[Calendar.days]] to match the span of days in the calendar.\r\n */\r\n Calendar.prototype.resetDays = function () {\r\n this.resetFilled();\r\n var days = this.days;\r\n var filled = this.filled;\r\n var current = filled.start;\r\n var daysBetween = filled.days(Op.UP);\r\n var total = Math.max(this.minimumSize, daysBetween);\r\n for (var i = 0; i < total; i++) {\r\n var day = days[i];\r\n if (!day || !day.sameDay(current)) {\r\n day = new CalendarDay_CalendarDay(current.date);\r\n if (i < days.length) {\r\n days.splice(i, 1, day);\r\n }\r\n else {\r\n days.push(day);\r\n }\r\n }\r\n day.inCalendar = this.span.contains(day);\r\n current = current.next();\r\n }\r\n if (days.length > total) {\r\n days.splice(total, days.length - total);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Updates the list of visible schedules.\r\n */\r\n Calendar.prototype.refreshVisible = function () {\r\n var start = this.filled.start;\r\n var end = this.filled.end;\r\n this.visible = this.events.filter(function (e) {\r\n return e.visible && e.schedule.matchesRange(start, end);\r\n });\r\n return this;\r\n };\r\n /**\r\n * Updates the days with the current day via [[CalendarDay.updateCurrent]].\r\n *\r\n * @param today The new current day.\r\n */\r\n Calendar.prototype.refreshCurrent = function (today) {\r\n if (today === void 0) { today = Day_Day.today(); }\r\n this.iterateDays().iterate(function (d) {\r\n d.updateCurrent(today);\r\n });\r\n return this;\r\n };\r\n /**\r\n * Updates the selection flags in [[CalendarDay]] based on the\r\n * [[Calendar.selection]] property.\r\n */\r\n Calendar.prototype.refreshSelection = function () {\r\n var _this = this;\r\n this.iterateDays().iterate(function (d) {\r\n if (_this.selection) {\r\n d.updateSelected(_this.selection);\r\n }\r\n else {\r\n d.clearSelected();\r\n }\r\n });\r\n return this;\r\n };\r\n /**\r\n * Updates the [[CalendarDay.events]] based on the events in this calendar\r\n * and the following properties:\r\n *\r\n * - [[Calendar.eventsForDay]]\r\n * - [[Calendar.eventsOutside]]\r\n * - [[Calendar.listTimes]]\r\n * - [[Calendar.repeatCovers]]\r\n * - [[Calendar.updateRows]]\r\n * - [[Calendar.updateColumns]]\r\n */\r\n Calendar.prototype.refreshEvents = function () {\r\n var _this = this;\r\n this.iterateDays().iterate(function (d) {\r\n if (d.inCalendar || _this.eventsOutside) {\r\n d.events = _this.eventsForDay(d, _this.listTimes, _this.repeatCovers);\r\n }\r\n });\r\n if (this.updateRows) {\r\n this.refreshRows();\r\n }\r\n if (this.updateColumns) {\r\n this.refreshColumns();\r\n }\r\n return this;\r\n };\r\n /**\r\n * Refreshes the [[CalendarEvent.row]] property as described in the link.\r\n */\r\n Calendar.prototype.refreshRows = function () {\r\n var eventToRow = {};\r\n var onlyFullDay = this.listTimes;\r\n this.iterateDays().iterate(function (d) {\r\n if (d.dayOfWeek === 0) {\r\n eventToRow = {};\r\n }\r\n var used = {};\r\n for (var _i = 0, _a = d.events; _i < _a.length; _i++) {\r\n var event_1 = _a[_i];\r\n if (onlyFullDay && !event_1.fullDay) {\r\n continue;\r\n }\r\n if (event_1.id in eventToRow) {\r\n used[event_1.row = eventToRow[event_1.id]] = true;\r\n }\r\n }\r\n var rowIndex = 0;\r\n for (var _b = 0, _c = d.events; _b < _c.length; _b++) {\r\n var event_2 = _c[_b];\r\n if ((onlyFullDay && !event_2.fullDay) || event_2.id in eventToRow) {\r\n continue;\r\n }\r\n while (used[rowIndex]) {\r\n rowIndex++;\r\n }\r\n eventToRow[event_2.id] = event_2.row = rowIndex;\r\n rowIndex++;\r\n }\r\n });\r\n return this;\r\n };\r\n /**\r\n * Refreshes the [[CalendarEvent.col]] property as described in the link.\r\n */\r\n Calendar.prototype.refreshColumns = function () {\r\n this.iterateDays().iterate(function (d) {\r\n var markers = [];\r\n for (var _i = 0, _a = d.events; _i < _a.length; _i++) {\r\n var event_3 = _a[_i];\r\n if (!event_3.fullDay) {\r\n markers.push({\r\n time: event_3.time.start.time,\r\n event: event_3,\r\n start: true,\r\n parent: null\r\n });\r\n markers.push({\r\n time: event_3.time.end.time - 1,\r\n event: event_3,\r\n start: false,\r\n parent: null\r\n });\r\n }\r\n }\r\n markers.sort(function (a, b) {\r\n return a.time - b.time;\r\n });\r\n var parent = null;\r\n for (var _b = 0, markers_1 = markers; _b < markers_1.length; _b++) {\r\n var marker = markers_1[_b];\r\n if (marker.start) {\r\n marker.parent = parent;\r\n parent = marker;\r\n }\r\n else if (parent) {\r\n parent = parent.parent;\r\n }\r\n }\r\n for (var _c = 0, markers_2 = markers; _c < markers_2.length; _c++) {\r\n var marker = markers_2[_c];\r\n if (marker.start) {\r\n marker.event.col = marker.parent ? marker.parent.event.col + 1 : 0;\r\n }\r\n }\r\n });\r\n return this;\r\n };\r\n /**\r\n * Iterates over all days in this calendar and passes each day to `iterator`.\r\n *\r\n * @param iterator The function to pass [[CalendarDay]]s to.\r\n */\r\n Calendar.prototype.iterateDays = function () {\r\n var _this = this;\r\n return new Iterator_Iterator(function (iterator) {\r\n var days = _this.days;\r\n for (var i = 0; i < days.length; i++) {\r\n switch (iterator.act(days[i])) {\r\n case IteratorAction.Stop:\r\n return;\r\n }\r\n }\r\n });\r\n };\r\n /**\r\n * Returns the events for the given day optionally looking at schedule times,\r\n * optionally looking at events which cover multiple days, and optionally\r\n * sorted with the given function.\r\n *\r\n * @param day The day to find events for.\r\n * @param getTimes When `true` an event is added to the result for each time\r\n * specified in the schedule.\r\n * @param covers When `true` events which don't start on the given day but do\r\n * overlap are added to the result.\r\n * @param sorter The function to sort the events by, if any.\r\n * @returns An array of events that occurred on the given day.\r\n */\r\n Calendar.prototype.eventsForDay = function (day, getTimes, covers, sorter) {\r\n if (getTimes === void 0) { getTimes = true; }\r\n if (covers === void 0) { covers = true; }\r\n if (sorter === void 0) { sorter = this.eventSorter; }\r\n var events = [];\r\n var entries = this.visible;\r\n var _loop_1 = function (entryIndex) {\r\n var entry = entries[entryIndex];\r\n var schedule = entry.schedule;\r\n var eventId = entryIndex * Constants.MAX_EVENTS_PER_DAY;\r\n var timeIndex = 0;\r\n schedule.iterateSpans(day, covers).iterate(function (span, iterator) {\r\n events.push(new CalendarEvent_CalendarEvent(eventId + timeIndex++, entry, span, day));\r\n if (!getTimes) {\r\n iterator.stop();\r\n }\r\n });\r\n };\r\n for (var entryIndex = 0; entryIndex < entries.length; entryIndex++) {\r\n _loop_1(entryIndex);\r\n }\r\n if (sorter) {\r\n events.sort(sorter);\r\n }\r\n return events;\r\n };\r\n /**\r\n * Finds the event given one of the ways to identify the event.\r\n *\r\n * @param input The value to use to search for an event.\r\n * @returns The refrence to the event or null if not found.\r\n */\r\n Calendar.prototype.findEvent = function (id) {\r\n for (var _i = 0, _a = this.events; _i < _a.length; _i++) {\r\n var event_4 = _a[_i];\r\n if (event_4 === id || event_4.schedule === id || event_4.data === id || event_4.id === id) {\r\n return event_4;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Removes the list of events if they exist in the calendar.\r\n *\r\n * @param events The array of events to remove if they exist. If no\r\n * events are passed (via `null`) then all events will be removed\r\n * from the calendar.\r\n * @param delayRefresh When `true` the [[Calendar.refreshEvents]] will not be\r\n * called after the events are removed.\r\n * @see [[Calendar.removeEvent]]\r\n * @see [[Calendar.refreshEvents]]\r\n */\r\n Calendar.prototype.removeEvents = function (events, delayRefresh) {\r\n if (events === void 0) { events = null; }\r\n if (delayRefresh === void 0) { delayRefresh = false; }\r\n if (events) {\r\n for (var _i = 0, events_1 = events; _i < events_1.length; _i++) {\r\n var event_5 = events_1[_i];\r\n this.removeEvent(event_5, true);\r\n }\r\n }\r\n else {\r\n this.events = [];\r\n }\r\n this.refreshVisible();\r\n if (!delayRefresh) {\r\n this.refreshEvents();\r\n }\r\n return this;\r\n };\r\n /**\r\n * Removes the given event if it exists on the calendar.\r\n *\r\n * @param event The event to remove if it exists.\r\n * @param delayRefresh When `true` the [[Calendar.refreshEvents]] will not be\r\n * called after the event is removed.\r\n * @see [[Calendar.refreshEvents]]\r\n */\r\n Calendar.prototype.removeEvent = function (event, delayRefresh) {\r\n if (delayRefresh === void 0) { delayRefresh = false; }\r\n var found = this.findEvent(event);\r\n if (found) {\r\n this.events.splice(this.events.indexOf(found), 1);\r\n this.refreshVisible();\r\n if (!delayRefresh) {\r\n this.refreshEvents();\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Adds the given event to this calendar if it doesn't exist already (or\r\n * `allowDuplicates` is `true`).\r\n *\r\n * @param event The event to add to the calendar.\r\n * @param allowDuplicates If an event can be added more than once.\r\n * @param delayRefresh When `true` the [[Calendar.refreshEvents]] will not be\r\n * called after the event is added.\r\n * @see [[Calendar.refreshEvents]]\r\n */\r\n Calendar.prototype.addEvent = function (event, allowDuplicates, delayRefresh) {\r\n if (allowDuplicates === void 0) { allowDuplicates = false; }\r\n if (delayRefresh === void 0) { delayRefresh = false; }\r\n var parsed = Parse_Parse.event(event, this.parseData, this.parseMeta);\r\n if (!allowDuplicates) {\r\n var existing = this.findEvent(parsed);\r\n if (existing) {\r\n return this;\r\n }\r\n }\r\n this.events.push(parsed);\r\n this.refreshVisible();\r\n if (!delayRefresh) {\r\n this.refreshEvents();\r\n }\r\n return this;\r\n };\r\n /**\r\n * Adds the given events to this calendar if they don't exist already (or\r\n * `allowDuplicates` is `true`).\r\n *\r\n * @param events The events to add to the calendar.\r\n * @param allowDuplicates If an event can be added more than once.\r\n * @param delayRefresh When `true` the [[Calendar.refreshEvents]] will not be\r\n * called after the events are added.\r\n * @see [[Calendar.refreshEvents]]\r\n */\r\n Calendar.prototype.addEvents = function (events, allowDuplicates, delayRefresh) {\r\n if (allowDuplicates === void 0) { allowDuplicates = false; }\r\n if (delayRefresh === void 0) { delayRefresh = false; }\r\n for (var _i = 0, events_2 = events; _i < events_2.length; _i++) {\r\n var event_6 = events_2[_i];\r\n this.addEvent(event_6, allowDuplicates, true);\r\n }\r\n if (!delayRefresh) {\r\n this.refreshEvents();\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets the selection point or range of the calendar and updates the flags\r\n * in the days.\r\n *\r\n * @param start The start of the selection.\r\n * @param end The end of the selection.\r\n * @see [[Calendar.refreshSelection]]\r\n */\r\n Calendar.prototype.select = function (start, end) {\r\n if (end === void 0) { end = start; }\r\n this.selection = new DaySpan_DaySpan(start, end);\r\n this.refreshSelection();\r\n return this;\r\n };\r\n /**\r\n * Sets the selection of the calendar to nothing.\r\n *\r\n * @see [[Calendar.refreshSelection]]\r\n */\r\n Calendar.prototype.unselect = function () {\r\n this.selection = null;\r\n this.refreshSelection();\r\n return this;\r\n };\r\n /**\r\n * Shifts the calendar days by the given amount.\r\n *\r\n * @param jump The amount to shift the calendar by.\r\n * @param delayRefresh When `true` [[Calendar.refresh]] will not be called\r\n * after calendar is moved.\r\n */\r\n Calendar.prototype.move = function (jump, delayRefresh) {\r\n if (jump === void 0) { jump = this.size; }\r\n if (delayRefresh === void 0) { delayRefresh = false; }\r\n this.span.start = this.moveStart(this.start, jump);\r\n this.span.end = this.moveEnd(this.end, jump);\r\n if (!delayRefresh) {\r\n this.refresh();\r\n }\r\n return this;\r\n };\r\n /**\r\n * Moves the calenndar to the next set of days.\r\n *\r\n * @param jump The amount to shift the calendar by.\r\n * @param delayRefresh When `true` [[Calendar.refresh]] will not be called\r\n * after calendar is moved.\r\n */\r\n Calendar.prototype.next = function (jump, delayRefresh) {\r\n if (jump === void 0) { jump = this.size; }\r\n if (delayRefresh === void 0) { delayRefresh = false; }\r\n return this.move(jump, delayRefresh);\r\n };\r\n /**\r\n * Moves the calenndar to the previous set of days.\r\n *\r\n * @param jump The amount to shift the calendar by.\r\n * @param delayRefresh When `true` [[Calendar.refresh]] will not be called\r\n * after calendar is moved.\r\n */\r\n Calendar.prototype.prev = function (jump, delayRefresh) {\r\n if (jump === void 0) { jump = this.size; }\r\n if (delayRefresh === void 0) { delayRefresh = false; }\r\n return this.move(-jump, delayRefresh);\r\n };\r\n /**\r\n * Converts this calendar to input which can be used to later recreate this\r\n * calendar. The only properties of the calendar which will be loss is the\r\n * [[Calendar.eventSorter]] property because it is a function.\r\n *\r\n * @param plain If the returned input should be plain objects as opposed\r\n * to [[Day]] and [[Event]] instances.\r\n * @param plainData A function to convert [[Event.data]] to a plain object if\r\n * it is not already.\r\n * @param plainMeta A function to convert values in [[Schedule.meta]] to plain\r\n * objects if they are not alreday.\r\n * @returns The input generated from this calendar.\r\n */\r\n Calendar.prototype.toInput = function (plain, plainData, plainMeta) {\r\n if (plain === void 0) { plain = false; }\r\n if (plainData === void 0) { plainData = function (d) { return d; }; }\r\n if (plainMeta === void 0) { plainMeta = function (m) { return m; }; }\r\n var out = {};\r\n out.type = this.type;\r\n out.size = this.size;\r\n out.fill = this.fill;\r\n out.minimumSize = this.minimumSize;\r\n out.repeatCovers = this.repeatCovers;\r\n out.listTimes = this.listTimes;\r\n out.eventsOutside = this.eventsOutside;\r\n out.updateRows = this.updateRows;\r\n out.updateColumns = this.updateColumns;\r\n out.around = plain ? this.span.start.dayIdentifier : this.span.start;\r\n out.events = [];\r\n for (var _i = 0, _a = this.events; _i < _a.length; _i++) {\r\n var event_7 = _a[_i];\r\n if (plain) {\r\n var plainEvent = {};\r\n if (Functions.isDefined(event_7.id)) {\r\n plainEvent.id = event_7.id;\r\n }\r\n if (Functions.isDefined(event_7.data)) {\r\n plainEvent.data = plainData(event_7.data);\r\n }\r\n if (!event_7.visible) {\r\n plainEvent.visible = event_7.visible;\r\n }\r\n plainEvent.schedule = event_7.schedule.toInput();\r\n var meta = plainEvent.schedule.meta;\r\n if (meta) {\r\n for (var identifier in meta) {\r\n meta[identifier] = plainMeta(meta[identifier]);\r\n }\r\n }\r\n out.events.push(plainEvent);\r\n }\r\n else {\r\n out.events.push(event_7);\r\n }\r\n }\r\n return out;\r\n };\r\n /**\r\n * Creates a calendar based on the given input.\r\n *\r\n * @param input The input which has at least the `type` specified.\r\n * @returns A new calendar instance.\r\n */\r\n Calendar.fromInput = function (input) {\r\n var initial = Day_Day.today();\r\n return new Calendar(initial, initial, null, 1, null, null, input);\r\n };\r\n /**\r\n * Creates a calendar based around a given unit optionally focused around a\r\n * given day.\r\n *\r\n * @param type The unit of the calendar.\r\n * @param days The number of units in the calendar.\r\n * @param around The day to focus the calendar on.\r\n * @param focus The value which describes how months are added around the given\r\n * day. The default value will center the calendar around the given day.\r\n * When the value is `0` the given day is the first day in the calendar,\r\n * and when the value is `1` the given day is the last day in the calendar.\r\n * @param input The default properties for the calendar.\r\n * @returns A new calendar instance.\r\n */\r\n Calendar.forType = function (type, size, around, focus, input) {\r\n if (size === void 0) { size = 1; }\r\n if (around === void 0) { around = Day_Day.today(); }\r\n if (focus === void 0) { focus = 0.49999; }\r\n var meta = this.TYPES[type];\r\n var start = meta.getStart(around, size, focus);\r\n var end = meta.getEnd(start, size, focus);\r\n return new Calendar(start, end, type, size, meta.moveStart, meta.moveEnd, input || meta.defaultInput);\r\n };\r\n /**\r\n * Creates a calendar based around days optionally focused around a given day.\r\n *\r\n * @param days The number of days in the calendar.\r\n * @param around The day to focus the calendar on.\r\n * @param focus The value which describes how days are added around the given\r\n * day. The default value will center the calendar around the given day.\r\n * When the value is `0` the given day is the first day in the calendar,\r\n * and when the value is `1` the given day is the last day in the calendar.\r\n * @param input The default properties for the calendar.\r\n * @returns A new calendar instance.\r\n * @see [[Calendar.forType]]\r\n */\r\n Calendar.days = function (days, around, focus, input) {\r\n if (days === void 0) { days = 1; }\r\n if (around === void 0) { around = Day_Day.today(); }\r\n if (focus === void 0) { focus = 0.4999; }\r\n return this.forType(Units.DAY, days, around, focus, input);\r\n };\r\n /**\r\n * Creates a calendar based around weeks optionally focused around a given day.\r\n *\r\n * @param days The number of weeks in the calendar.\r\n * @param around The day to focus the calendar on.\r\n * @param focus The value which describes how weeks are added around the given\r\n * day. The default value will center the calendar around the given day.\r\n * When the value is `0` the given day is the first day in the calendar,\r\n * and when the value is `1` the given day is the last day in the calendar.\r\n * @param input The default properties for the calendar.\r\n * @returns A new calendar instance.\r\n * @see [[Calendar.forType]]\r\n */\r\n Calendar.weeks = function (weeks, around, focus, input) {\r\n if (weeks === void 0) { weeks = 1; }\r\n if (around === void 0) { around = Day_Day.today(); }\r\n if (focus === void 0) { focus = 0.4999; }\r\n return this.forType(Units.WEEK, weeks, around, focus, input);\r\n };\r\n /**\r\n * Creates a calendar based around months optionally focused around a given day.\r\n *\r\n * @param days The number of months in the calendar.\r\n * @param around The day to focus the calendar on.\r\n * @param focus The value which describes how months are added around the given\r\n * day. The default value will center the calendar around the given day.\r\n * When the value is `0` the given day is the first day in the calendar,\r\n * and when the value is `1` the given day is the last day in the calendar.\r\n * @param input The default properties for the calendar.\r\n * @returns A new calendar instance.\r\n * @see [[Calendar.forType]]\r\n */\r\n Calendar.months = function (months, around, focus, input) {\r\n if (months === void 0) { months = 1; }\r\n if (around === void 0) { around = Day_Day.today(); }\r\n if (focus === void 0) { focus = 0.4999; }\r\n return this.forType(Units.MONTH, months, around, focus, input);\r\n };\r\n /**\r\n * Creates a calendar based around years optionally focused around a given day.\r\n *\r\n * @param days The number of years in the calendar.\r\n * @param around The day to focus the calendar on.\r\n * @param focus The value which describes how years are added around the given\r\n * day. The default value will center the calendar around the given day.\r\n * When the value is `0` the given day is the first day in the calendar,\r\n * and when the value is `1` the given day is the last day in the calendar.\r\n * @param input The default properties for the calendar.\r\n * @returns A new calendar instance.\r\n * @see [[Calendar.forType]]\r\n */\r\n Calendar.years = function (years, around, focus, input) {\r\n if (years === void 0) { years = 1; }\r\n if (around === void 0) { around = Day_Day.today(); }\r\n if (focus === void 0) { focus = 0.4999; }\r\n return this.forType(Units.YEAR, years, around, focus, input);\r\n };\r\n /**\r\n * A map of functions and properties by [[Units]] used to create or morph\r\n * Calendars.\r\n */\r\n Calendar.TYPES = (Calendar__a = {},\r\n Calendar__a[Units.DAY] = {\r\n getStart: function (around, size, focus) {\r\n return around.start().relativeDays(-Math.floor(size * focus));\r\n },\r\n getEnd: function (start, size, focus) {\r\n return start.relativeDays(size - 1).end();\r\n },\r\n moveStart: function (day, amount) {\r\n return day.relativeDays(amount);\r\n },\r\n moveEnd: function (day, amount) {\r\n return day.relativeDays(amount);\r\n },\r\n defaultInput: undefined\r\n },\r\n Calendar__a[Units.WEEK] = {\r\n getStart: function (around, size, focus) {\r\n return around.start().startOfWeek().relativeWeeks(-Math.floor(size * focus));\r\n },\r\n getEnd: function (start, size, focus) {\r\n return start.relativeWeeks(size - 1).endOfWeek();\r\n },\r\n moveStart: function (day, amount) {\r\n return day.relativeWeeks(amount);\r\n },\r\n moveEnd: function (day, amount) {\r\n return day.relativeWeeks(amount);\r\n },\r\n defaultInput: undefined\r\n },\r\n Calendar__a[Units.MONTH] = {\r\n getStart: function (around, size, focus) {\r\n return around.start().startOfMonth().relativeMonths(-Math.floor(size * focus));\r\n },\r\n getEnd: function (start, size, focus) {\r\n return start.relativeMonths(size - 1).endOfMonth();\r\n },\r\n moveStart: function (day, amount) {\r\n return day.relativeMonths(amount);\r\n },\r\n moveEnd: function (day, amount) {\r\n return day.startOfMonth().relativeMonths(amount).endOfMonth();\r\n },\r\n defaultInput: { fill: true }\r\n },\r\n Calendar__a[Units.YEAR] = {\r\n getStart: function (around, size, focus) {\r\n return around.start().startOfYear().relativeYears(-Math.floor(size * focus));\r\n },\r\n getEnd: function (start, size, focus) {\r\n return start.relativeYears(size - 1).endOfYear();\r\n },\r\n moveStart: function (day, amount) {\r\n return day.relativeYears(amount);\r\n },\r\n moveEnd: function (day, amount) {\r\n return day.relativeYears(amount);\r\n },\r\n defaultInput: { fill: true }\r\n },\r\n Calendar__a);\r\n return Calendar;\r\n}());\r\n\r\nvar Calendar__a;\r\n\n// CONCATENATED MODULE: ./src/Month.ts\n\r\n/**\r\n * The months in a year.\r\n */\r\nvar Month = (function () {\r\n function Month() {\r\n }\r\n Month.JANUARY = 0;\r\n Month.FEBRUARY = 1;\r\n Month.MARCH = 2;\r\n Month.APRIL = 3;\r\n Month.MAY = 4;\r\n Month.JUNE = 5;\r\n Month.JULY = 6;\r\n Month.AUGUST = 7;\r\n Month.SEPTEMBER = 8;\r\n Month.OCTOBER = 9;\r\n Month.NOVEMBER = 10;\r\n Month.DECEMBER = 11;\r\n /**\r\n * The full list of months in a year.\r\n */\r\n Month.LIST = [\r\n Month.JANUARY,\r\n Month.FEBRUARY,\r\n Month.MARCH,\r\n Month.APRIL,\r\n Month.MAY,\r\n Month.JUNE,\r\n Month.JULY,\r\n Month.AUGUST,\r\n Month.SEPTEMBER,\r\n Month.OCTOBER,\r\n Month.NOVEMBER,\r\n Month.DECEMBER\r\n ];\r\n return Month;\r\n}());\r\n\r\n\n// CONCATENATED MODULE: ./src/Weekday.ts\n\r\n/**\r\n * The days in a week.\r\n */\r\nvar Weekday = (function () {\r\n function Weekday() {\r\n }\r\n Weekday.SUNDAY = 0;\r\n Weekday.MONDAY = 1;\r\n Weekday.TUESDAY = 2;\r\n Weekday.WEDNESDAY = 3;\r\n Weekday.THURSDAY = 4;\r\n Weekday.FRIDAY = 5;\r\n Weekday.SATURDAY = 6;\r\n /**\r\n * The full list of days in a week.\r\n */\r\n Weekday.LIST = [\r\n Weekday.SUNDAY,\r\n Weekday.MONDAY,\r\n Weekday.TUESDAY,\r\n Weekday.WEDNESDAY,\r\n Weekday.THURSDAY,\r\n Weekday.FRIDAY,\r\n Weekday.SATURDAY\r\n ];\r\n /**\r\n * The list of days starting with Monday and ending on Friday.\r\n */\r\n Weekday.WEEK = [\r\n Weekday.MONDAY,\r\n Weekday.TUESDAY,\r\n Weekday.WEDNESDAY,\r\n Weekday.THURSDAY,\r\n Weekday.FRIDAY\r\n ];\r\n /**\r\n * The days on the weekend, starting with Saturday and ending with Sunday.\r\n */\r\n Weekday.ENDS = [\r\n Weekday.SATURDAY,\r\n Weekday.SUNDAY\r\n ];\r\n return Weekday;\r\n}());\r\n\r\n\n// CONCATENATED MODULE: ./src/Pattern.ts\n\r\n\r\n\r\n\r\n/**\r\n * A class which helps describe [[ScheduleInput]] if it matches a pattern.\r\n */\r\nvar Pattern_Pattern = (function () {\r\n /**\r\n * Creates a new pattern.\r\n *\r\n * @param name The unique name of the pattern.\r\n * @param listed If the pattern is \"listed\" [[Pattern.listed]].\r\n * @param describe A function to describe the pattern given a [[Day]].\r\n * @param rules The rules which describe how to detect and apply the pattern\r\n * to schedule input.\r\n */\r\n function Pattern(name, listed, describe, rules) {\r\n this.name = name;\r\n this.listed = listed;\r\n this.describe = describe;\r\n this.rules = rules;\r\n }\r\n /**\r\n * Applies this pattern to schedule input removing and adding any necessary\r\n * properties from the input to match this pattern - based around the day\r\n * provided.\r\n *\r\n * @param input The input to update to match this pattern.\r\n * @param day The day to base the schedule on.\r\n * @returns The reference to the input passed in.\r\n */\r\n Pattern.prototype.apply = function (input, day) {\r\n for (var _i = 0, _a = Pattern.PROPS; _i < _a.length; _i++) {\r\n var prop = _a[_i];\r\n var rule = this.rules[prop];\r\n // Should have one value\r\n if (rule === 1) {\r\n input[prop] = [day[prop]];\r\n }\r\n // Can be any of the values in the array\r\n if (Functions.isArray(rule)) {\r\n input[prop] = rule;\r\n }\r\n // Must not be present\r\n if (!Functions.isDefined(rule)) {\r\n delete input[prop];\r\n }\r\n }\r\n return input;\r\n };\r\n /**\r\n * Determines whether the given input matches this pattern. Optionally a day\r\n * can be provided to make sure the day matches the schedule and pattern\r\n * together.\r\n *\r\n * @param input The schedule input to test.\r\n * @param exactlyWith A day to further validate against for matching.\r\n * @returns `true` if the schedule input was a match to this pattern with the\r\n * day if one was provided, otherwise `false`.\r\n */\r\n Pattern.prototype.isMatch = function (input, exactlyWith) {\r\n var exactly = Functions.isDefined(exactlyWith);\r\n for (var _i = 0, _a = Pattern.PROPS; _i < _a.length; _i++) {\r\n var prop = _a[_i];\r\n var rule = this.rules[prop];\r\n var curr = input[prop];\r\n // Optional, skip it\r\n if (rule === false) {\r\n continue;\r\n }\r\n // Requires any value\r\n if (rule === true && !curr) {\r\n return false;\r\n }\r\n // Must not be present\r\n if (!Functions.isDefined(rule) && curr) {\r\n return false;\r\n }\r\n // Must be an array of the same size\r\n if (Functions.isNumber(rule)) {\r\n if (Functions.isArray(curr) && curr.length === rule) {\r\n if (exactly && curr.indexOf(exactlyWith[prop]) === -1) {\r\n return false;\r\n }\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n // Must be an array of the same values\r\n if (Functions.isArray(rule)) {\r\n if (!Functions.isArray(curr)) {\r\n return false;\r\n }\r\n if (rule.length !== curr.length) {\r\n return false;\r\n }\r\n for (var i = 0; i < rule.length; i++) {\r\n if (rule[i] !== curr[i]) {\r\n return false;\r\n }\r\n }\r\n if (exactly && rule.indexOf(exactlyWith[prop]) === -1) {\r\n return false;\r\n }\r\n }\r\n // Must be an object with same over & offset.\r\n if (Functions.isObject(rule)) {\r\n if (!Functions.isObject(curr)) {\r\n return false;\r\n }\r\n var ruleOffset = rule.offset || 0;\r\n var currOffset = curr.offset || 0;\r\n if (currOffset !== ruleOffset || curr.every !== rule.every) {\r\n return false;\r\n }\r\n if (exactly && (exactlyWith[prop] % rule.every) !== ruleOffset) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Returns the pattern with the given name if one exists. If you add your own\r\n * patterns make sure to add them to [[PatternMap]].\r\n *\r\n * @param name The name of the pattern to return.\r\n * @return The instance to the pattern with the same name.\r\n */\r\n Pattern.withName = function (name) {\r\n return PatternMap[name];\r\n };\r\n /**\r\n * Finds a matching pattern to the given input searching through [[Patterns]]\r\n * for matches. Optionally it will only look at patterns where listed = `true`.\r\n *\r\n * @param input The schedule input to use.\r\n * @param listedOnly When `true` only patterns with [[Pattern.listed]] set to\r\n * `true` will be looked at, otherwise all patterns are looked at.\r\n * @param exactlyWith A day to further validate against for matching.\r\n * @see [[Pattern.isMatch]]\r\n */\r\n Pattern.findMatch = function (input, listedOnly, exactlyWith) {\r\n if (listedOnly === void 0) { listedOnly = true; }\r\n for (var _i = 0, Patterns_1 = Patterns; _i < Patterns_1.length; _i++) {\r\n var pattern = Patterns_1[_i];\r\n if ((pattern.listed || !listedOnly) && pattern.isMatch(input, exactlyWith)) {\r\n return pattern;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * The properties in the [[ScheduleInput]] which are compared against the\r\n * rules of a pattern.\r\n */\r\n Pattern.PROPS = [\r\n 'dayOfWeek', 'dayOfMonth', 'lastDayOfMonth', 'dayOfYear',\r\n 'month', 'week', 'year',\r\n 'weekOfYear', 'weekspanOfYear', 'fullWeekOfYear', 'lastWeekspanOfYear', 'lastFullWeekOfYear',\r\n 'weekOfMonth', 'weekspanOfMonth', 'fullWeekOfMonth', 'lastWeekspanOfMonth', 'lastFullWeekOfMonth'\r\n ];\r\n return Pattern;\r\n}());\r\n\r\n/**\r\n * The list of patterns that can be searched through for matches to schedule\r\n * input.\r\n *\r\n * @see [[Pattern.findMatch]]\r\n */\r\nvar Patterns = [\r\n new Pattern_Pattern('none', true, function (day) { return 'Does not repeat'; }, {\r\n year: 1,\r\n month: 1,\r\n dayOfMonth: 1\r\n }),\r\n new Pattern_Pattern('daily', true, function (day) { return 'Daily'; }, {}),\r\n new Pattern_Pattern('weekly', true, function (day) { return 'Weekly on ' + day.format('dddd'); }, {\r\n dayOfWeek: 1\r\n }),\r\n new Pattern_Pattern('monthlyWeek', true, function (day) { return 'Monthly on the ' + Suffix.CACHE[day.weekspanOfMonth + 1] + ' ' + day.format('dddd'); }, {\r\n dayOfWeek: 1,\r\n weekspanOfMonth: 1\r\n }),\r\n new Pattern_Pattern('annually', true, function (day) { return 'Annually on ' + day.format('MMMM Do'); }, {\r\n month: 1,\r\n dayOfMonth: 1\r\n }),\r\n new Pattern_Pattern('annuallyMonthWeek', true, function (day) { return 'Annually on the ' + Suffix.CACHE[day.weekspanOfMonth + 1] + ' ' + day.format('dddd') + ' of ' + day.format('MMMM'); }, {\r\n month: 1,\r\n dayOfWeek: 1,\r\n weekspanOfMonth: 1\r\n }),\r\n new Pattern_Pattern('weekday', true, function (day) { return 'Every weekday (Monday to Friday)'; }, {\r\n dayOfWeek: [Weekday.MONDAY, Weekday.TUESDAY, Weekday.WEDNESDAY, Weekday.THURSDAY, Weekday.FRIDAY]\r\n }),\r\n new Pattern_Pattern('monthly', true, function (day) { return 'Monthly on the ' + day.format('Do') + ' day'; }, {\r\n dayOfMonth: 1\r\n }),\r\n new Pattern_Pattern('custom', true, function (day) { return 'Custom...'; }, {\r\n dayOfWeek: false,\r\n dayOfMonth: false,\r\n lastDayOfMonth: false,\r\n dayOfYear: false,\r\n year: false,\r\n month: false,\r\n week: false,\r\n weekOfYear: false,\r\n weekspanOfYear: false,\r\n fullWeekOfYear: false,\r\n lastWeekspanOfYear: false,\r\n lastFullWeekOfYear: false,\r\n weekOfMonth: false,\r\n weekspanOfMonth: false,\r\n fullWeekOfMonth: false,\r\n lastWeekspanOfMonth: false,\r\n lastFullWeekOfMonth: false\r\n })\r\n];\r\n/**\r\n * The map of patterns keyed by their name.\r\n *\r\n * @see [[Pattern.withName]]\r\n */\r\nvar PatternMap = {};\r\nfor (var Pattern__i = 0, Patterns_2 = Patterns; Pattern__i < Patterns_2.length; Pattern__i++) {\r\n var Pattern_pattern = Patterns_2[Pattern__i];\r\n PatternMap[Pattern_pattern.name] = Pattern_pattern;\r\n}\r\n\n// CONCATENATED MODULE: ./src/Sort.ts\n\r\n/**\r\n * A class with [[SortEvent]] functions and functions which accept other\r\n * [[SortEvent]]s and return a new [[SortEvent]].\r\n *\r\n * ```typescript\r\n * // Sorts full day events first, then events in descending order based on start time.\r\n * Sorts.List([Sorts.FullDay, Sorts.Desc(Sorts.Start)]);\r\n * ```\r\n */\r\nvar Sorts = (function () {\r\n function Sorts() {\r\n }\r\n /**\r\n * Sorts the two events by their start time - the earliest event being first\r\n * in order.\r\n *\r\n * @param a The first event.\r\n * @param b The second event.\r\n * @returns The difference in time between the start of `a` and `b`.\r\n * @see [[CalendarEvent.time]]\r\n */\r\n Sorts.Start = function (a, b) {\r\n return a.time.start.time - b.time.start.time;\r\n };\r\n /**\r\n * Sorts the two events by their end time - the earliest to end being first\r\n * in order.\r\n *\r\n * @param a The first event.\r\n * @param b The second event.\r\n * @returns The difference in time between the end of `a` and `b`.\r\n * @see [[CalendarEvent.time]]\r\n */\r\n Sorts.End = function (a, b) {\r\n return a.time.end.time - b.time.end.time;\r\n };\r\n /**\r\n * Sorts the two events placing the full day events before the timed events.\r\n *\r\n * @param a The first event.\r\n * @param b The second event.\r\n * @returns If both are timed or both are full day then `0` is returned,\r\n * otherwise `-1` is returned if `a` is full day and `1` is returned if\r\n * `b` is full day.\r\n * @see [[CalendarEvent.fullDay]]\r\n */\r\n Sorts.FullDay = function (a, b) {\r\n var af = a.fullDay ? 0 : 1;\r\n var bf = b.fullDay ? 0 : 1;\r\n return af - bf;\r\n };\r\n /**\r\n * Sorts the two events placing the shorter events before the longer events.\r\n * Full day or multiple day events actually take up a day and will be ordered\r\n * last.\r\n *\r\n * @param a The first event.\r\n * @param b The second event.\r\n * @returns The difference in milliseconds between `a` and `b`.\r\n * @see [[CalendarEvent.time]]\r\n * @see [[DaySpan.millis]]\r\n */\r\n Sorts.Duration = function (a, b) {\r\n return a.time.millis() - b.time.millis();\r\n };\r\n /**\r\n * Returns a [[SortEvent]] that effectively orders the given sorter in the\r\n * opposite (often descending) order.\r\n *\r\n * @param sorter The sorter to reverse.\r\n * @returns A new sorter which reverses the one passed in.\r\n */\r\n Sorts.Desc = function (sorter) {\r\n return function (a, b) {\r\n return sorter(b, a);\r\n };\r\n };\r\n /**\r\n * Returns a [[SortEvent]] that orders the events based on a string in each\r\n * event. A function must be supplied which takes an event of type `T` and\r\n * returns a string.\r\n *\r\n * @param getString A function which returns a string from the event.\r\n * @returns A sorter which sorts strings alphabetically.\r\n */\r\n Sorts.Alphabetical = function (getString) {\r\n return function (a, b) {\r\n var as = getString(a.event) || '';\r\n var bs = getString(b.event) || '';\r\n return as.localeCompare(bs);\r\n };\r\n };\r\n /**\r\n * Returns a [[SortEvent]] that orders events based on a number in each event.\r\n * A function must be supplied which takes an event of type `T` and returns\r\n * a number.\r\n *\r\n * @param getOrder A function which returns a number from the event.\r\n * @returns A sorter which sorts events based on a number in ascending order.\r\n */\r\n Sorts.Ordered = function (getOrder) {\r\n return function (a, b) {\r\n var ao = getOrder(a.event);\r\n var bo = getOrder(b.event);\r\n return ao - bo;\r\n };\r\n };\r\n /**\r\n * Returns a [[SortEvent]] that orders events based on an array of sorters.\r\n * The first sorter which returns a non-zero result is used.\r\n *\r\n * @param sorters A list of sorting functions to test one at a time.\r\n * @returns A sorter which sorts based on a list of sorters.\r\n */\r\n Sorts.List = function (sorters) {\r\n return function (a, b) {\r\n for (var _i = 0, sorters_1 = sorters; _i < sorters_1.length; _i++) {\r\n var sorter = sorters_1[_i];\r\n var compare = sorter(a, b);\r\n if (compare !== 0) {\r\n return compare;\r\n }\r\n }\r\n return 0;\r\n };\r\n };\r\n return Sorts;\r\n}());\r\n\r\n\n// CONCATENATED MODULE: ./src/index.ts\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Calendar\", function() { return Calendar_Calendar; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"CalendarDay\", function() { return CalendarDay_CalendarDay; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"CalendarEvent\", function() { return CalendarEvent_CalendarEvent; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Event\", function() { return Event; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Constants\", function() { return Constants; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Day\", function() { return Day_Day; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"DaySpan\", function() { return DaySpan_DaySpan; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Functions\", function() { return Functions; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Identifier\", function() { return Identifier_Identifier; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"IteratorAction\", function() { return IteratorAction; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Iterator\", function() { return Iterator_Iterator; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Month\", function() { return Month; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Op\", function() { return Op; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"operate\", function() { return operate; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Parse\", function() { return Parse_Parse; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Pattern\", function() { return Pattern_Pattern; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Patterns\", function() { return Patterns; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"PatternMap\", function() { return PatternMap; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Schedule\", function() { return Schedule_Schedule; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"ScheduleModifier\", function() { return ScheduleModifier_ScheduleModifier; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Sorts\", function() { return Sorts; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Suffix\", function() { return Suffix; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Time\", function() { return Time_Time; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Units\", function() { return Units; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Weekday\", function() { return Weekday; });\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ })\n/******/ ]);\n});\n\n\n// WEBPACK FOOTER //\n// dayspan.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap b0849eab209f6c3cfbb4","module.exports = __WEBPACK_EXTERNAL_MODULE_0__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external {\"commonjs\":\"moment\",\"commonjs2\":\"moment\",\"amd\":\"moment\",\"root\":\"moment\"}\n// module id = 0\n// module chunks = 0","\n/**\n * An operation that can be performed on a single number.\n */\nexport enum Op\n{\n /**\n * The number is returned unmodified.\n */\n NONE,\n\n /**\n * The number is rounded down to the nearest whole number.\n */\n FLOOR,\n\n /**\n * The number is rounded up to the nearest whole number.\n */\n CEIL,\n\n /**\n * The number is rounded up or down depending on if the fractional value is\n * greater than or less than 0.5 respectively.\n */\n ROUND,\n\n /**\n * The fractional part of the number is dropped.\n */\n TRUNCATE,\n\n /**\n * The number is rounded up when positive and down when negative. This is\n * effectively ceiling the absolute value where the result preserves the sign.\n */\n UP,\n\n /**\n * The number is rounded down when positive and up when negative. This is\n * effectively floor the absolute value where the result preserves the sign.\n */\n DOWN\n}\n\n\n/**\n * Performs the requested operation on the given number, optionally taking\n * the absolute value of the number before the operation.\n *\n * @param value The number to operate on.\n * @param op The operation to perform.\n * @param absolute If the number should be positive before the operation.\n * @return The operated result, or the original value if its not a valid number.\n */\nexport function operate(value: number, op: Op, absolute: boolean = false)\n{\n if (isFinite(value))\n {\n if (absolute)\n {\n value = Math.abs( value );\n }\n\n switch (op)\n {\n case Op.NONE:\n return value;\n case Op.FLOOR:\n return Math.floor( value );\n case Op.CEIL:\n return Math.ceil( value );\n case Op.ROUND:\n return Math.round( value );\n case Op.TRUNCATE:\n case Op.DOWN:\n return value < 0 ? Math.ceil( value ) : Math.floor( value );\n case Op.UP:\n return value < 0 ? Math.floor( value ) : Math.ceil( value );\n }\n }\n\n return value;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Operation.ts","\n\n/**\n * The class which contains commonly used functions by the library. These\n * functions and variables exist in a class so they may be overridden if\n * desired.\n */\nexport class Functions\n{\n\n /**\n * Determines whether the given input is an array.\n *\n * @param input The variable to test.\n * @returns `true` if the variable is an array, otherwise `false`.\n */\n public static isArray(input: any): boolean\n {\n return input instanceof Array;\n }\n\n /**\n * Determines whether the two arrays given are stricly equivalent. If the\n * arrays are not the same length or contain the same values in the same order\n * then `false` is returned.\n *\n * @param x The first array to test.\n * @param y The second array to test.\n * @returns `true` if they have the same exact values, otherwise `false`.\n */\n public static isArrayEquals(x: any[], y: any[]): boolean\n {\n if (x === y) return true;\n if (x.length !== y.length) return false;\n\n for (let i = 0; i < x.length; i++)\n {\n if (x[ i ] !== y[ i ])\n {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Determines whether the given input is a string.\n *\n * @param input The variable to test.\n * @returns `true` if the variable is a string, otherwise `false`.\n */\n public static isString(input: any): boolean\n {\n return typeof(input) === 'string';\n }\n\n /**\n * Determines whether the given input is a finite number (a number which is\n * not infinite or not the result of a divide-by-zero operation).\n *\n * @param input The variable to test.\n * @returns `true` if the variable is a finite number, otherwise `false`.\n */\n public static isNumber(input: any): boolean\n {\n return isFinite(input);\n }\n\n /**\n * Determines whether the given input is an object and NOT an array.\n *\n * @param input The variable to test.\n * @returns `true` if the variable is a plain object, otherwise `false`.\n */\n public static isObject(input: any): boolean\n {\n return !this.isArray(input) && typeof(input) === 'object';\n }\n\n /**\n * Determines whether the given input is defined.\n *\n * @param input The variable to test.\n * @return `true` if the variable is defined, otherwise `false`.\n */\n public static isDefined(input: any): boolean\n {\n return typeof(input) !== 'undefined';\n }\n\n /**\n * Determines whether the given input is defined and not null.\n *\n * @param input The variable to test.\n * @return `true` if the variable is defined and not null, otherwise `false`.\n */\n public static isValue(input: any): boolean\n {\n return input !== null && typeof(input) !== 'undefined';\n }\n\n /**\n * Determines whether the given input appears to be a valid\n * [[FrequencyValueEvery]].\n *\n * ```typescript\n * Functions.isFrequencyValueEvery({}); // false\n * Functions.isFrequencyValueEvery([]); // false\n * Functions.isFrequencyValueEvery([1]); // false\n * Functions.isFrequencyValueEvery(null); // false\n * Functions.isFrequencyValueEvery({every:2}); // true\n * Functions.isFrequencyValueEvery({offset:1}); // false\n * Functions.isFrequencyValueEvery({every:2, offset:1}); // true\n * ```\n *\n * @param input The variable to test.\n * @returns `true` if the variable appears to be a [[FrequencyValueEvery]],\n * otherwise false.\n */\n public static isFrequencyValueEvery(input: any): boolean\n {\n return this.isObject( input ) && this.isNumber( input.every );\n }\n\n /**\n * Determines whether the given input appears to be a valid\n * [[FrequencyValueOneOf]].\n *\n * ```typescript\n * Functions.isFrequencyValueOneOf({}); // false\n * Functions.isFrequencyValueOneOf([]); // false\n * Functions.isFrequencyValueOneOf([1]); // true\n * Functions.isFrequencyValueOneOf(null); // false\n * ```\n *\n * @param input The variable to test.\n * @returns `true` if the variable appears to be a [[FrequencyValueOneOf]],\n * otherwise false.\n */\n public static isFrequencyValueOneOf(input: any): boolean\n {\n return this.isArray( input ) && input.length > 0;\n }\n\n /**\n * Returns the first argument which is defined.\n *\n * ```typescript\n * Functions.coalesce(3, 4); // 3\n * Functions.coalesce(undefined, 4); // 4\n * Functions.coalesce(null, 4); // null\n * Functions.coalesce(void 0, void 0, 5); // 5\n * ```\n *\n * @param a The first argument to look at.\n * @param b The second argument to look at.\n * @returns The first defined argument.\n * @see [[Functions.isDefined]]\n */\n public static coalesce(a: any, b: any, c?: any): any\n {\n return this.isDefined( a ) ? a : (this.isDefined( b ) ? b : c);\n }\n\n /**\n * Pads the string `x` up to `length` characters with the given `padding`\n * optionally placing the `padding` `before` `x`.\n *\n * ```typescript\n * Functions.pad('hey', 5, '_', false); // 'hey__'\n * Functions.pad('hey', 5, '_', true); // '__hey'\n * Functions.pad('heyman', 5, '_', true); // 'heyman'\n * ```\n *\n * @param x The string to pad.\n * @param length The length to pad to.\n * @param padding The string to pad with.\n * @param before If the padding should go before the string to pad.\n * @returns The padded string if any padding needed be added.\n */\n public static pad(x: string, length: number, padding: string, before: boolean): string\n {\n while (x.length < length)\n {\n before ? x = padding + x : x = x + padding;\n }\n\n return x;\n }\n\n /**\n * Pads the number `x` up to `length` digits where the padding is `0` and it\n * goes before `x`. This function will only return the first `length`\n * characters of the padding string representation of the number but can return\n * an alternative number of `first` characters.\n *\n * ```typescript\n * Functions.padNumber(29, 3); // '029'\n * Functions.padNumber(29, 3, 2); // '02'\n * Functions.padNumber(9573, 3); // '957'\n * ```\n *\n * @param x The number to pad with zeros in the beginning.\n * @param length The number of digits the number should be padded to.\n * @param first The number of digits to return from the start of the string.\n * @returns A padded number.\n */\n public static padNumber(x: number, length: number, first: number = length)\n {\n return this.pad(x + '', length, '0', true).substring( 0, first );\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Functions.ts","\n\n/**\n * Units of time that are compromised of 1 or more days for the [[Calendar]] class.\n */\nexport enum Units\n{\n DAY,\n WEEK,\n MONTH,\n YEAR\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Units.ts","\n\n/**\n * A class that stores commonly used values.\n */\nexport class Constants\n{\n\n /**\n * The number of milliseconds in a second.\n */\n public static MILLIS_IN_SECOND: number = 1000;\n\n /**\n * The number of milliseconds in a minute.\n */\n public static MILLIS_IN_MINUTE: number = Constants.MILLIS_IN_SECOND * 60;\n\n /**\n * The number of milliseconds in an hour.\n */\n public static MILLIS_IN_HOUR: number = Constants.MILLIS_IN_MINUTE * 60;\n\n /**\n * The number of milliseconds in a day (not including DST days).\n */\n public static MILLIS_IN_DAY: number = Constants.MILLIS_IN_HOUR * 24;\n\n /**\n * The number of milliseconds in a week (not including ones that include DST).\n */\n public static MILLIS_IN_WEEK: number = Constants.MILLIS_IN_DAY * 7;\n\n\n /**\n * The number of days in a week.\n */\n public static DAYS_IN_WEEK: number = 7;\n\n\n /**\n * The number of months in a year.\n */\n public static MONTHS_IN_YEAR: number = 12;\n\n /**\n * The number of hours in a day (not including DST days).\n */\n public static HOURS_IN_DAY: number = 24;\n\n\n /**\n * The first month of the year.\n */\n public static MONTH_MIN: number = 0;\n\n /**\n * The last month of the year.\n */\n public static MONTH_MAX: number = 11;\n\n /**\n * The first day of a month.\n */\n public static DAY_MIN: number = 1;\n\n /**\n * The last day of the longest month.\n */\n public static DAY_MAX: number = 31;\n\n /**\n * The first hour of the day.\n */\n public static HOUR_MIN: number = 0;\n\n /**\n * The last hour of the day.\n */\n public static HOUR_MAX: number = 23;\n\n /**\n * The first minute of the hour.\n */\n public static MINUTE_MIN: number = 0;\n\n /**\n * The last minute of the hour.\n */\n public static MINUTE_MAX: number = 59;\n\n /**\n * The first second of the minute.\n */\n public static SECOND_MIN: number = 0;\n\n /**\n * The last second of the minute.\n */\n public static SECOND_MAX: number = 59;\n\n /**\n * The first millisecond of the second.\n */\n public static MILLIS_MIN: number = 0;\n\n /**\n * The last millisecond of the second.\n */\n public static MILLIS_MAX: number = 999;\n\n /**\n * The first day of the week.\n */\n public static WEEKDAY_MIN: number = 0;\n\n /**\n * The last day of the week.\n */\n public static WEEKDAY_MAX: number = 6;\n\n\n /**\n * The default duration for an event.\n */\n public static DURATION_DEFAULT: number = 1;\n\n /**\n * The default duration unit for an all day event.\n */\n public static DURATION_DEFAULT_UNIT_ALL: string = 'days';\n\n /**\n * The default duration unit for an event at a given time.\n */\n public static DURATION_DEFAULT_UNIT_TIMES: string = 'hours';\n\n /**\n * Computes the duration unit given its for an all day event.\n *\n * @param all If the event is all day.\n * @return The default unit for the event.\n */\n public static DURATION_DEFAULT_UNIT: (all: boolean) => string =\n all => all ? Constants.DURATION_DEFAULT_UNIT_ALL :\n Constants.DURATION_DEFAULT_UNIT_TIMES;\n\n /**\n * The number of milliseconds for various duration units. These are worse case\n * scenario and do not include DST changes.\n */\n public static DURATION_TO_MILLIS = {\n minute: Constants.MILLIS_IN_MINUTE,\n minutes: Constants.MILLIS_IN_MINUTE,\n hour: Constants.MILLIS_IN_HOUR,\n hours: Constants.MILLIS_IN_HOUR,\n day: Constants.MILLIS_IN_DAY,\n days: Constants.MILLIS_IN_DAY,\n week: Constants.MILLIS_IN_WEEK,\n weeks: Constants.MILLIS_IN_WEEK,\n month: Constants.MILLIS_IN_DAY * Constants.DAY_MAX,\n months: Constants.MILLIS_IN_DAY * Constants.DAY_MAX\n };\n\n /**\n * The maximum estimated number of events per day. This is used to calculate\n * [[CalendarEvent.id]] to give each event a unique ID. If you think you will\n * have more events than this per day, you can enlarge the value.\n */\n public static MAX_EVENTS_PER_DAY: number = 24;\n\n /**\n * The day of the week which determines the first week of the year or month.\n * By default this day is Thursday.\n */\n public static WEEK_OF_MONTH_MINIMUM_WEEKDAY: number = 4;\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Constants.ts","\nimport { Day } from './Day';\nimport { Op } from './Operation';\nimport { Units } from './Units';\nimport { Constants } from './Constants';\n\n\n\n/**\n * The calculated bounds of a DaySpan relative to a given day.\n */\nexport interface DaySpanBounds\n{\n\n /**\n * The top of the span within the rectangle of the given day.\n */\n top: number;\n\n /**\n * The bottom of the span within the rectangle of the givne day.\n */\n bottom: number;\n\n /**\n * The height of the span within the rectangle of the given day. This is\n * equivalent by `bottom - top`.\n */\n height: number;\n\n /**\n * The left of the span within the rectangle of the given day.\n */\n left: number;\n\n /**\n * The right of the span within the rectangle of the given day.\n */\n right: number;\n\n /**\n * The width of the span within the rectangle of the given day. This is\n * equivalent by `right - left`.\n */\n width: number;\n}\n\n/**\n * A class for a range of time between two [[Day]] timestamps.\n */\nexport class DaySpan\n{\n\n\n /**\n * The starting timestamp of the span (inclusive).\n */\n public start: Day;\n\n /**\n * The endind timestamp of the span (inclusive).\n */\n public end: Day;\n\n\n /**\n * Creates a new span of time.\n *\n * @param start The starting timestamp.\n * @param end The ending timestamp.\n */\n public constructor(start: Day, end: Day)\n {\n this.start = start;\n this.end = end;\n }\n\n /**\n * Whether this span starts and ends on the same timestamp.\n */\n public get isPoint(): boolean\n {\n return this.start.time === this.end.time;\n }\n\n /**\n * Determines whether the given timestamp lies between the start and end\n * timestamp.\n *\n * @param day The timestamp to test.\n * @returns True if the day is >= the start and <= the end of this span.\n */\n public contains(day: Day): boolean\n {\n return day.time >= this.start.time && day.time <= this.end.time;\n }\n\n /**\n * Compares the given timestamp to this span. If the timestamp is before this\n * span then `-1` is returned, if the timestamp is after this span then `1`\n * us returned, otherwise `0` is returned when the timestamp is in this span.\n *\n * @param day The timestamp to compare to.\n * @returns `-1`, `0`, or `1` depending on the given timestamp relative to\n * this span.\n */\n public compareTo(day: Day): number\n {\n return day.time < this.start.time ? -1 : (day.time > this.end.time ? 1 : 0);\n }\n\n /**\n * Determines whether the given timestamp is between the start and end\n * timestamp or lies on the same day as the start or end timestamp.\n *\n * @param day The timestamp to test.\n * @see [[Day.sameDay]]\n */\n public matchesDay(day: Day): boolean\n {\n return this.contains( day ) || day.sameDay( this.start ) || day.sameDay( this.end );\n }\n\n /**\n * Determines whether the given timestamp is between the start and end\n * timestamp or lies on the same week as the start or end timestamp.\n *\n * @param day The timestamp to test.\n * @see [[Day.sameWeek]]\n */\n public matchesWeek(day: Day): boolean\n {\n return this.contains( day ) || day.sameWeek( this.start ) || day.sameWeek( this.end );\n }\n\n /**\n * Determines whether the given timestamp is between the start and end\n * timestamp or lies on the same month as the start or end timestamp.\n *\n * @param day The timestamp to test.\n * @see [[Day.sameMonth]]\n */\n public matchesMonth(day: Day): boolean\n {\n return this.contains( day ) || day.sameMonth( this.start ) || day.sameMonth( this.end );\n }\n\n /**\n * Determines whether the given timestamp is between the start and end\n * timestamp or lies on the same year as the start or end timestamp.\n *\n * @param day The timestamp to test.\n * @see [[Day.sameYear]]\n */\n public matchesYear(day: Day): boolean\n {\n return this.contains( day ) || day.sameYear( this.start ) || day.sameYear( this.end );\n }\n\n\n /**\n * Calculates the number of milliseconds between the start and end timestamp.\n *\n * @param op The operation to perform on the result.\n * @param absolute Whether the result should always be positive.\n * @returns The time between the start and end timestamp.\n * @see [[Day.millisBetween]]\n */\n public millis(op: Op = Op.DOWN, absolute: boolean = true): number\n {\n return this.start.millisBetween(this.end, op, absolute);\n }\n\n /**\n * Calculates the number of seconds between the start and end timestamp.\n *\n * @param op The operation to perform on the result.\n * @param absolute Whether the result should always be positive.\n * @returns The time between the start and end timestamp.\n * @see [[Day.secondsBetween]]\n */\n public seconds(op: Op = Op.DOWN, absolute: boolean = true): number\n {\n return this.start.secondsBetween(this.end, op, absolute);\n }\n\n /**\n * Calculates the number of minutes between the start and end timestamp.\n *\n * @param op The operation to perform on the result.\n * @param absolute Whether the result should always be positive.\n * @returns The time between the start and end timestamp.\n * @see [[Day.minutesBetween]]\n */\n public minutes(op: Op = Op.DOWN, absolute: boolean = true): number\n {\n return this.start.minutesBetween(this.end, op, absolute);\n }\n\n /**\n * Calculates the number of hours between the start and end timestamp.\n *\n * @param op The operation to perform on the result.\n * @param absolute Whether the result should always be positive.\n * @returns The time between the start and end timestamp.\n * @see [[Day.hoursBetween]]\n */\n public hours(op: Op = Op.DOWN, absolute: boolean = true): number\n {\n return this.start.hoursBetween(this.end, op, absolute);\n }\n\n /**\n * Calculates the number of days between the start and end timestamp.\n *\n * @param op The operation to perform on the result.\n * @param absolute Whether the result should always be positive.\n * @returns The time between the start and end timestamp.\n * @see [[Day.daysBetween]]\n */\n public days(op: Op = Op.DOWN, absolute: boolean = true): number\n {\n return this.start.daysBetween(this.end, op, absolute);\n }\n\n /**\n * Calculates the number of weeks between the start and end timestamp.\n *\n * @param op The operation to perform on the result.\n * @param absolute Whether the result should always be positive.\n * @returns The time between the start and end timestamp.\n * @see [[Day.weeksBetween]]\n */\n public weeks(op: Op = Op.DOWN, absolute: boolean = true): number\n {\n return this.start.weeksBetween(this.end, op, absolute);\n }\n\n /**\n * Calculates the number of months between the start and end timestamp.\n *\n * @param op The operation to perform on the result.\n * @param absolute Whether the result should always be positive.\n * @returns The time between the start and end timestamp.\n * @see [[Day.monthsBetween]]\n */\n public months(op: Op = Op.DOWN, absolute: boolean = true): number\n {\n return this.start.monthsBetween(this.end, op, absolute);\n }\n\n /**\n * Calculates the number of years between the start and end timestamp.\n *\n * @param op The operation to perform on the result.\n * @param absolute Whether the result should always be positive.\n * @returns The time between the start and end timestamp.\n * @see [[Day.yearsBetween]]\n */\n public years(op: Op = Op.DOWN, absolute: boolean = true): number\n {\n return this.start.yearsBetween(this.end, op, absolute);\n }\n\n /**\n * Returns a delta value between 0 and 1 which represents where the\n * [[DaySpan.start]] is relative to the given day. The delta value would\n * be less than 0 if the start of the event is before the given day.\n *\n * @param relativeTo The day to find the start delta relative to.\n * @return A number between 0 and 1 if the start of this span is in the\n * 24-hour period starting at the given timestamp, otherwise the value\n * returned may be less than 0 or greater than 1.\n */\n public startDelta(relativeTo: Day): number\n {\n return (this.start.time - relativeTo.time) / Constants.MILLIS_IN_DAY;\n }\n\n /**\n * Returns a delta value between 0 and 1 which represents where the\n * [[DaySpan.end]] is relative to the given day. The delta value would\n * be greater than 1 if the end of the event is after the given day.\n *\n * @param relativeTo The day to find the end delta relative to.\n * @return A number between 0 and 1 if the end of this span is in the\n * 24-hour period starting at the given timestamp, otherwise the value\n * returned may be less than 0 or greater than 1.\n */\n public endDelta(relativeTo: Day): number\n {\n return (this.end.time - relativeTo.time) / Constants.MILLIS_IN_DAY;\n }\n\n /**\n * Calculates the bounds for span event if it were placed in a rectangle which\n * represents a day (24 hour period). By default the returned values are\n * between 0 and 1 and can be scaled by the proper rectangle dimensions or the\n * rectangle dimensions can be passed to this function.\n *\n * @param relativeTo The day to find the bounds relative to. If this is not the\n * start of the day the returned bounds is relative to the given time.\n * @param dayHeight The height of the rectangle of the day.\n * @param dayWidth The width of the rectangle of the day.\n * @param columnOffset The offset in the rectangle of the day to adjust this\n * span by. This also reduces the width of the returned bounds to keep the\n * bounds in the rectangle of the day.\n * @param clip `true` if the bounds should stay in the day rectangle, `false`\n * and the bounds may go outside the rectangle of the day for multi-day\n * spans.\n * @param offsetX How much to translate the left & right properties by.\n * @param offsetY How much to translate the top & bottom properties by.\n * @returns The calculated bounds for this span.\n */\n public getBounds(relativeTo: Day, dayHeight: number = 1, dayWidth: number = 1, columnOffset: number = 0, clip: boolean = true, offsetX: number = 0, offsetY: number = 0): DaySpanBounds\n {\n let startRaw: number = this.startDelta( relativeTo );\n let endRaw: number = this.endDelta( relativeTo );\n\n let start: number = clip ? Math.max(0, startRaw) : startRaw;\n let end: number = clip ? Math.min(1, endRaw) : endRaw;\n\n let left: number = columnOffset;\n let right: number = dayWidth - left;\n\n let top: number = start * dayHeight;\n let bottom: number = end * dayHeight;\n\n return {\n top: top + offsetY,\n bottom: bottom + offsetY,\n height: bottom - top,\n left: left + offsetX,\n right: right + offsetX,\n width: right\n };\n }\n\n /**\n * Summarizes this span given an approximate unit of time and a few other\n * options. If the start and end are on the same unit, a single value will\n * be returned. Otherwise a start and end will be returned with a `delimiter`.\n *\n * @param type The unit of time this span is for.\n * @param dayOfWeek When `true` the weekday of the start and end are included.\n * @param short When `true` the short form of weekdays and months will be used.\n * @param repeat When `true` the year will be repeated on the start and end\n * timestamp even if they are the same year.\n * @param contextual When `true` the year will be hidden if it's the current\n * year.\n * @param delimiter The string to separate the start and end timestamps with.\n * @returns The summary of this span.\n */\n public summary(type: Units, dayOfWeek: boolean = true, short: boolean = false, repeat: boolean = false, contextual: boolean = true, delimiter: string = ' - '): string\n {\n let formats = DaySpan.SUMMARY_FORMATS[ type ];\n let today: Day = Day.today();\n let showStartYear: boolean = !contextual || !this.start.sameYear( today );\n let showEndYear: boolean = !contextual || !this.end.sameYear( today );\n let start: string = this.start.format( formats(short, dayOfWeek, showStartYear) );\n let end: string = this.end.format( formats(short, dayOfWeek, showEndYear) );\n let summary: string = start;\n\n if (start !== end)\n {\n if (!repeat)\n {\n summary = this.start.format( formats(short, dayOfWeek, !this.start.sameYear(this.end)) );\n }\n\n summary += delimiter;\n summary += end;\n }\n else\n {\n summary = start;\n }\n\n return summary;\n }\n\n /**\n * Determines whether the gven span intersects with this span.\n *\n * @param span The span to test.\n * @returns `true` if the spans intersect, otherwise `false`.\n */\n public intersects(span: DaySpan): boolean\n {\n return !(\n this.end.time < span.start.time ||\n this.start.time > span.end.time\n );\n }\n\n /**\n * Calculates the intersection between this span and the given span. If there\n * is no intersection between the two spans then `null` is returned.\n *\n * @param span The span to calculate the intersection with.\n * @returns The intersection or `null` if none exists.\n */\n public intersection(span: DaySpan): DaySpan\n {\n let start: Day = this.start.max( span.start );\n let end: Day = this.end.min( span.end );\n\n return start.isAfter( end ) ? null : new DaySpan(start, end);\n }\n\n /**\n * Calculates the union between this span and the given span.\n *\n * @param span The span to calculate the union with.\n * @returns The union of the two spans.\n */\n public union(span: DaySpan): DaySpan\n {\n let start: Day = this.start.min( span.start );\n let end: Day = this.end.max( span.end );\n\n return new DaySpan(start, end);\n }\n\n /**\n * Returns a point [[DaySpan]] with the same start and end timestamp.\n *\n * @param day The timestamp which will be the start and end.\n * @returns The new instance.\n * @see [[DaySpan.isPoint]]\n */\n public static point(day: Day): DaySpan\n {\n return new DaySpan( day, day );\n }\n\n\n /**\n * Formatting functions which assist the [[DaySpan.summary]] function.\n */\n public static SUMMARY_FORMATS =\n {\n [Units.DAY]: (short: boolean, dayOfWeek: boolean, year: boolean) => {\n return (dayOfWeek ? (short ? 'ddd, ' : 'dddd, ') : '') + (short ? 'MMM ' : 'MMMM ') + 'Do' + (year ? ' YYYY' : '');\n },\n [Units.WEEK]: (short: boolean, dayOfWeek: boolean, year: boolean) => {\n return (dayOfWeek ? (short ? 'ddd, ' : 'dddd, ') : '') + (short ? 'MMM ' : 'MMMM ') + 'Do' + (year ? ' YYYY' : '');\n },\n [Units.MONTH]: (short: boolean, dayOfWeek: boolean, year: boolean) => {\n return (short ? 'MMM' : 'MMMM') + (year ? ' YYYY' : '');\n },\n [Units.YEAR]: (short: boolean, dayOfWeek: boolean, year: boolean) => {\n return (year ? 'YYYY' : '');\n }\n };\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/DaySpan.ts","\nimport { Functions as fn } from './Functions';\nimport { Day } from './Day';\nimport { DaySpan } from './DaySpan';\n\n\n/**\n * The type for identifiers. Most of the time an identifier can be stored as a\n * number because the 4 digit year is first. However when the year is below\n * 1000 a string will be used with zero padding. Storing identifiers as numbers\n * enable very quick comparisons and using strings or numbers allows the\n * identifier to be used as a key to a map.\n */\nexport type IdentifierInput = number | string;\n\n/**\n * The possible properties which can be pulled from an identifier.\n */\nexport interface IdentifierObject\n{\n /**\n * The year pulled from an identifier (0-9999).\n */\n year?: number;\n /**\n * The quarter of the year pulled from an identifier (1-4)\n */\n quarter?: number;\n /**\n * The month of the year pulled from an identifier (0-11)\n */\n month?: number;\n /**\n * The week of the year pulled from an identifier (1-52)\n */\n week?: number;\n /**\n * The day of the month pulled from an identifier (1-31)\n */\n day?: number;\n /**\n * The hour of the day pulled from an identifier (0-23)\n */\n hour?: number;\n /**\n * The minute of the hour pulled from an identifier (0-59)\n */\n minute?: number;\n}\n\n\n/**\n * A class for detecting, parsing, and building identifiers to and from days.\n *\n * An identifier is a simple value which represents a span of time. It may\n * represent an entire year, a quarter (3 months) of a year, a week of a year,\n * a month in a year, a specific day of a month of a year, or a specific hour,\n * minute, day, and month of a year.\n *\n * For example:\n * - `2018`: The year 2018\n * - `201801`: January 2018\n * - `2014023`: The 23rd week of 2014\n * - `20170311`: March 11th, 2017\n * - `201406151651`: June 15th 2016 at 4:51 pm\n * - `'0525'`: Year 525 of the first age, Elrond and Elros are born\n */\nexport abstract class Identifier\n{\n\n /**\n * Determines whether the given identifier is this type.\n *\n * @param id The identifier to test.\n * @returns `true` if the identifier is this type, otherwise `false`.\n */\n public is(id: IdentifierInput): boolean\n {\n return (id + '').length === this.getLength();\n }\n\n /**\n * Returns the identifier of this type for the given day,\n *\n * @param day The day to get the identifier of.\n * @returns The identifier for the day of this type.\n */\n abstract get(day: Day): IdentifierInput;\n\n /**\n * Converts the given identifier which has passed [[Identifier.is]] to an\n * object with properties pulled from the identifier.\n *\n * @param id The identifier to parse.\n * @returns The object with properties parsed from the identifer.\n */\n abstract object(id: IdentifierInput): IdentifierObject;\n\n /**\n * Returns the start of the time span the identifier represents.\n *\n * @param id The identifier to convert to a start day.\n * @returns The start of the time span the identifier represents.\n */\n abstract start(id: IdentifierInput): Day;\n\n /**\n * Returns the span of time the identifier represents.\n *\n * @param id The identifier to convert to a span.\n * @param endInclusive When `true` the end of the span will be the very last\n * millisecond that represents the timespan, otherwise `false` the end\n * will be the start of the very next span.\n * @returns\n */\n abstract span(id: IdentifierInput, endInclusive: boolean): DaySpan;\n\n /**\n * Determines if the day matches the given identifier.\n *\n * @param day The day to test.\n * @param id The identifier to compare to.\n * @returns `true` if the day exists in the time span represented by the\n * identifier, otherwise `false`.\n */\n abstract matches(day: Day, id: IdentifierInput): boolean;\n\n /**\n * Describes the given identifier as a human friendly string.\n *\n * @param id The identifier to describe.\n * @param short If the description should use shorter language or longer.\n * @returns The human friendly string that describes the identifier.\n */\n abstract describe(id: IdentifierInput, short: boolean): string;\n\n /**\n * The scales for all the different values stored in an identifier.\n */\n protected abstract getScales(): number[];\n\n /**\n * The length of the identifier of this type in digits.\n */\n protected abstract getLength(): number;\n\n /**\n * Computes the identifier given values taken from a [[Day]].\n *\n * @param values The values to compute.\n * @returns The computed identifier.\n */\n protected compute(...values: number[]): IdentifierInput\n {\n const scales: number[] = this.getScales();\n let total: number = 0;\n\n for (let i = 0; i < values.length; i++)\n {\n total += values[ i ] * scales[ i ];\n }\n\n return this.is( total ) ? total : fn.padNumber(total, this.getLength());\n }\n\n /**\n * Decomputes the given identifier and returns values which describe a span\n * of time.\n *\n * @param id The identifier to decompute.\n * @returns The original values which computed the identifier.\n */\n protected decompute(id: IdentifierInput): number[]\n {\n const scales: number[] = this.getScales();\n let total: number = fn.isNumber(id) ? id : parseInt(id);\n let values: number[] = [];\n\n for (let i = 0; i < scales.length - 1; i++)\n {\n let curr: number = scales[ i + 0 ];\n let next: number = scales[ i + 1 ];\n let mod: number = next / curr;\n let value: number = total % mod;\n\n values.push( value );\n total = Math.floor( total / mod );\n }\n\n values.push( total );\n\n return values;\n }\n\n /**\n * The identifier type for an hour of time on a specific day.\n */\n public static Time: Identifier = null;\n\n /**\n * The identifier type for a specific day.\n */\n public static Day: Identifier = null;\n\n /**\n * The identifier type for a specific week of a year.\n */\n public static Week: Identifier = null;\n\n /**\n * The identifier type for a specific month of a year.\n */\n public static Month: Identifier = null;\n\n /**\n * The identifier type for a specific quarter of a year.\n */\n public static Quarter: Identifier = null;\n\n /**\n * The identifier type for a specific year.\n */\n public static Year: Identifier = null;\n\n\n /**\n * Finds which identifier type matches the given identifier, if any.\n *\n * @param id The identifier to find the type of.\n * @returns The found identifier type, otherwise `null` if none exists.\n */\n public static find(id: IdentifierInput): Identifier\n {\n if (this.Time.is(id)) return this.Time;\n if (this.Day.is(id)) return this.Day;\n if (this.Week.is(id)) return this.Week;\n if (this.Month.is(id)) return this.Month;\n if (this.Year.is(id)) return this.Year;\n\n return null;\n }\n\n /**\n * Determines whether the given time span `outer` contains the time span\n * `inner`.\n *\n * @param outer The potentially larger time span `inner` must be contained in.\n * @param inner The time span to test is contained inside `outer`.\n * @returns `true` if `inner` is equal to or contained in `outer`, otherwise\n * `false`.\n */\n public static contains(outer: IdentifierInput, inner: IdentifierInput): boolean\n {\n let outerString: string = outer + '';\n\n return (inner + '').substring( 0, outerString.length ) === outerString;\n }\n\n}\n\n// YYYYMMddHHmm (12)\nclass IdentifierTime extends Identifier\n{\n\n public static DESCRIBE_FORMAT_LONG: string = 'LLL';\n public static DESCRIBE_FORMAT_SHORT: string = 'lll';\n\n private static SCALES: number[] = [\n 1 /* minute */,\n 100 /* hour */,\n 10000 /* day */,\n 1000000 /* month */,\n 100000000 /* year */];\n private static LENGTH: number = 12;\n\n protected getScales(): number[]\n {\n return IdentifierTime.SCALES;\n }\n\n protected getLength(): number\n {\n return IdentifierTime.LENGTH;\n }\n\n public get(day: Day): IdentifierInput\n {\n return this.compute(day.minute, day.hour, day.dayOfMonth, day.month + 1, day.year);\n }\n\n public object(id: IdentifierInput): IdentifierObject\n {\n let values: number[] = this.decompute(id);\n\n return {\n minute: values[0],\n hour: values[1],\n day: values[2],\n month: values[3] - 1,\n year: values[4]\n };\n }\n\n public start(id: IdentifierInput): Day\n {\n let obj: IdentifierObject = this.object(id);\n let start: Day = Day.build( obj.year, obj.month, obj.day, obj.hour, obj.minute );\n\n return start;\n }\n\n public span(id: IdentifierInput, endInclusive: boolean = false): DaySpan\n {\n let start: Day = this.start( id );\n let end: Day = start.endOfHour( endInclusive );\n\n return new DaySpan(start, end);\n }\n\n public describe(id: IdentifierInput, short: boolean = false): string\n {\n let start: Day = this.start( id );\n let format: string = short ? IdentifierTime.DESCRIBE_FORMAT_SHORT : IdentifierTime.DESCRIBE_FORMAT_LONG;\n\n return start.format( format );\n }\n\n public matches(day: Day, id: IdentifierInput): boolean\n {\n return day.timeIdentifier === id;\n /*\n let obj: IdentifierObject = this.object(id);\n\n return (\n day.year === obj.year &&\n day.month === obj.month &&\n day.dayOfMonth === obj.day &&\n day.hour === obj.hour &&\n day.minute === obj.minute\n );\n */\n }\n\n}\n\n// YYYYMMdd (8)\nclass IdentifierDay extends Identifier\n{\n\n public static DESCRIBE_FORMAT_LONG: string = 'LL';\n public static DESCRIBE_FORMAT_SHORT: string = 'll';\n\n private static SCALES: number[] = [\n 1 /* day */,\n 100 /* month */,\n 10000 /* year */];\n private static LENGTH: number = 8;\n\n protected getScales(): number[]\n {\n return IdentifierDay.SCALES;\n }\n\n protected getLength(): number\n {\n return IdentifierDay.LENGTH;\n }\n\n public get(day: Day): IdentifierInput\n {\n return this.compute(day.dayOfMonth, day.month + 1, day.year);\n }\n\n public object(id: IdentifierInput): IdentifierObject\n {\n let values: number[] = this.decompute(id);\n\n return {\n day: values[0],\n month: values[1] - 1,\n year: values[2]\n };\n }\n\n public start(id: IdentifierInput): Day\n {\n let obj: IdentifierObject = this.object(id);\n let start: Day = Day.build( obj.year, obj.month, obj.day );\n\n return start;\n }\n\n public span(id: IdentifierInput, endInclusive: boolean = false): DaySpan\n {\n let start: Day = this.start( id );\n let end: Day = start.end( endInclusive );\n\n return new DaySpan(start, end);\n }\n\n public describe(id: IdentifierInput, short: boolean = false): string\n {\n let start: Day = this.start( id );\n let format: string = short ? IdentifierDay.DESCRIBE_FORMAT_SHORT : IdentifierDay.DESCRIBE_FORMAT_LONG;\n\n return start.format( format );\n }\n\n public matches(day: Day, id: IdentifierInput): boolean\n {\n return day.dayIdentifier === id;\n /*\n let obj: IdentifierObject = this.object(id);\n\n return (\n day.year === obj.year &&\n day.month === obj.month &&\n day.dayOfMonth === obj.day\n );\n */\n }\n\n}\n\n// YYYY0ww (7)\nclass IdentifierWeek extends Identifier\n{\n\n public static DESCRIBE_FORMAT_LONG: string = 'wo [week of] YYYY';\n public static DESCRIBE_FORMAT_SHORT: string = 'wo [week of] YYYY';\n\n private static SCALES: number[] = [\n 1 /* week */,\n 1000 /* year */];\n private static LENGTH: number = 7;\n\n protected getScales(): number[]\n {\n return IdentifierWeek.SCALES;\n }\n\n protected getLength(): number\n {\n return IdentifierWeek.LENGTH;\n }\n\n public get(day: Day): IdentifierInput\n {\n return this.compute(day.week, day.year);\n }\n\n public object(id: IdentifierInput): IdentifierObject\n {\n let values: number[] = this.decompute(id);\n\n return {\n week: values[0],\n year: values[1]\n };\n }\n\n public start(id: IdentifierInput): Day\n {\n let obj: IdentifierObject = this.object(id);\n let start: Day = Day.build( obj.year, 0 ).withWeek( obj.week );\n\n return start;\n }\n\n public span(id: IdentifierInput, endInclusive: boolean = false): DaySpan\n {\n let start: Day = this.start( id );\n let end: Day = start.endOfWeek( endInclusive );\n\n return new DaySpan(start, end);\n }\n\n public describe(id: IdentifierInput, short: boolean = false): string\n {\n let start: Day = this.start( id );\n let format: string = short ? IdentifierWeek.DESCRIBE_FORMAT_SHORT : IdentifierWeek.DESCRIBE_FORMAT_LONG;\n\n return start.format( format );\n }\n\n public matches(day: Day, id: IdentifierInput): boolean\n {\n return day.weekIdentifier === id;\n /*\n let obj: IdentifierObject = this.object(id);\n\n return (\n day.year === obj.year &&\n day.week === obj.week\n );\n */\n }\n\n}\n\n// YYYYMM (6)\nclass IdentifierMonth extends Identifier\n{\n\n public static DESCRIBE_FORMAT_LONG: string = 'MMMM YYYY';\n public static DESCRIBE_FORMAT_SHORT: string = 'MMM YYYY';\n\n private static SCALES: number[] = [\n 1 /* month */,\n 100 /* year */];\n private static LENGTH: number = 6;\n\n protected getScales(): number[]\n {\n return IdentifierMonth.SCALES;\n }\n\n protected getLength(): number\n {\n return IdentifierMonth.LENGTH;\n }\n\n public get(day: Day): IdentifierInput\n {\n return this.compute(day.month + 1, day.year);\n }\n\n public object(id: IdentifierInput): IdentifierObject\n {\n let values: number[] = this.decompute(id);\n\n return {\n month: values[0] - 1,\n year: values[1]\n };\n }\n\n public start(id: IdentifierInput): Day\n {\n let obj: IdentifierObject = this.object(id);\n let start: Day = Day.build( obj.year, obj.month );\n\n return start;\n }\n\n public span(id: IdentifierInput, endInclusive: boolean = false): DaySpan\n {\n let start: Day = this.start( id );\n let end: Day = start.endOfMonth( endInclusive );\n\n return new DaySpan(start, end);\n }\n\n public describe(id: IdentifierInput, short: boolean = false): string\n {\n let start: Day = this.start( id );\n let format: string = short ? IdentifierMonth.DESCRIBE_FORMAT_SHORT : IdentifierMonth.DESCRIBE_FORMAT_LONG;\n\n return start.format( format );\n }\n\n public matches(day: Day, id: IdentifierInput): boolean\n {\n return day.monthIdentifier === id;\n /*\n let obj: IdentifierObject = this.object(id);\n\n return (\n day.year === obj.year &&\n day.month === obj.month\n );\n */\n }\n\n}\n\n// YYYYQ (5)\nclass IdentifierQuarter extends Identifier\n{\n\n public static DESCRIBE_FORMAT_LONG: string = 'Qo [quarter] YYYY';\n public static DESCRIBE_FORMAT_SHORT: string = 'Qo [quarter] YYYY';\n\n private static SCALES: number[] = [\n 1 /* quarter */,\n 10 /* year */];\n private static LENGTH: number = 5;\n\n protected getScales(): number[]\n {\n return IdentifierQuarter.SCALES;\n }\n\n protected getLength(): number\n {\n return IdentifierQuarter.LENGTH;\n }\n\n public get(day: Day): IdentifierInput\n {\n return this.compute(day.quarter, day.year);\n }\n\n public object(id: IdentifierInput): IdentifierObject\n {\n let values: number[] = this.decompute(id);\n\n return {\n quarter: values[0],\n year: values[1]\n };\n }\n\n public start(id: IdentifierInput): Day\n {\n let obj: IdentifierObject = this.object(id);\n let start: Day = Day.build( obj.year, (obj.quarter - 1) * 3 );\n\n return start;\n }\n\n public span(id: IdentifierInput, endInclusive: boolean = false): DaySpan\n {\n let start: Day = this.start( id );\n let end: Day = start.relativeMonths( 3 ).endOfMonth( endInclusive );\n\n return new DaySpan(start, end);\n }\n\n public describe(id: IdentifierInput, short: boolean = false): string\n {\n let start: Day = this.start( id );\n let format: string = short ? IdentifierQuarter.DESCRIBE_FORMAT_SHORT : IdentifierQuarter.DESCRIBE_FORMAT_LONG;\n\n return start.format( format );\n }\n\n public matches(day: Day, id: IdentifierInput): boolean\n {\n return day.quarterIdentifier === id;\n /*\n let obj: IdentifierObject = this.object(id);\n\n return (\n day.year === obj.year &&\n day.quarter === obj.quarter\n );\n */\n }\n\n}\n\n// YYYY (4)\nclass IdentifierYear extends Identifier\n{\n\n public static DESCRIBE_FORMAT_LONG: string = 'YYYY';\n public static DESCRIBE_FORMAT_SHORT: string = 'YYYY';\n\n private static SCALES: number[] = [\n 1 /* year */];\n private static LENGTH: number = 4;\n\n protected getScales(): number[]\n {\n return IdentifierYear.SCALES;\n }\n\n protected getLength(): number\n {\n return IdentifierYear.LENGTH;\n }\n\n public get(day: Day): IdentifierInput\n {\n return this.compute(day.year);\n }\n\n public object(id: IdentifierInput): IdentifierObject\n {\n let values: number[] = this.decompute(id);\n\n return {\n year: values[0]\n };\n }\n\n public start(id: IdentifierInput): Day\n {\n let obj: IdentifierObject = this.object(id);\n let start: Day = Day.build( obj.year, 0 );\n\n return start;\n }\n\n public span(id: IdentifierInput, endInclusive: boolean = false): DaySpan\n {\n let start: Day = this.start( id );\n let end: Day = start.endOfYear( endInclusive );\n\n return new DaySpan(start, end);\n }\n\n public describe(id: IdentifierInput, short: boolean = false): string\n {\n let start: Day = this.start( id );\n let format: string = short ? IdentifierYear.DESCRIBE_FORMAT_SHORT : IdentifierYear.DESCRIBE_FORMAT_LONG;\n\n return start.format( format );\n }\n\n public matches(day: Day, id: IdentifierInput): boolean\n {\n return day.year === id;\n /*\n let obj: IdentifierObject = this.object(id);\n\n return (\n day.year === obj.year\n );\n */\n }\n\n}\n\n// Sets the Identifier types\nIdentifier.Time = new IdentifierTime();\nIdentifier.Day = new IdentifierDay();\nIdentifier.Week = new IdentifierWeek();\nIdentifier.Month = new IdentifierMonth();\nIdentifier.Quarter = new IdentifierQuarter();\nIdentifier.Year = new IdentifierYear();\n\n\n\n// WEBPACK FOOTER //\n// ./src/Identifier.ts","\n/**\n * A class which takes a number and determines the suffix for that number.\n *\n * ```typescript\n * Suffix.CACHE[ 2 ]; // 2nd\n * Suffix.determine( 3 ); // rd\n * Suffix.get( 4 ); // th\n * Suffix.get( 4, true ); // 4th\n * ```\n */\nexport class Suffix\n{\n\n /**\n * The array of suffixes used.\n */\n public static MAP: string[] = [\n 'th', 'st', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th'\n ];\n\n /**\n * An internal cache of [[Suffix._CACHE_SIZE]] suffixes.\n */\n private static _CACHE: string[];\n\n /**\n * The number of values to store in the cache (inclusive).\n */\n private static _CACHE_SIZE: number = 366;\n\n\n /**\n * The cache of number & suffix pairs.\n */\n public static get CACHE(): string[]\n {\n if (!this._CACHE)\n {\n this._CACHE = [];\n\n for (let i = 0; i <= this._CACHE_SIZE; i++)\n {\n this._CACHE[ i ] = this.get( i, true );\n }\n }\n\n return this._CACHE;\n }\n\n /**\n * Determines the suffix for a given number.\n *\n * @param value The number to find the suffix for.\n * @returns The suffix determined.\n */\n public static determine(value: number): string\n {\n return value >= 11 && value <= 13 ? 'th' : this.MAP[ value % this.MAP.length ];\n }\n\n /**\n * Gets the suffix for a number and optionally appends it before the suffix.\n *\n * @param value The number to get the suffix for.\n * @param prepend When `true` the value is prepended to the suffix.\n * @returns The suffix or value & suffix pair determined.\n */\n public static get(value: number, prepend: boolean = false): string\n {\n let suffix: string = this.determine(value);\n\n return prepend ? value + suffix : suffix;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Suffix.ts","\nimport { Functions as fn } from './Functions';\n\n\n/**\n * The callback which is invoked for each item in the Iterator. The callback\n * can call [[Iterator.stop]] at anytime to stop iteration.\n *\n * @param item The item found in the iterator.\n * @param iterator The iterator with the item.\n * @returns The result of the callback.\n */\nexport type IteratorCallback = (item: T, iterator: Iterator) => R;\n\n/**\n * An [[Iterator]] source which handles iterating over items and calls\n * `callback` for each item, checking [[Iterator.iterating]] after each\n * invokation to stop iteration as early as possible.\n *\n * @param callback The function to invoke for each item.\n * @param iterator The iterator to check for early exists.\n */\nexport type IteratorSource = (iterator: Iterator) => any;\n\n/**\n * A filter to apply duration iteration to only look at certain items when this\n * function returns `true`.\n *\n * @param item The item being iterated.\n * @returns `true` if the item should be iterated, otherwise `false`.\n */\nexport type IteratorFilter = (item: T) => boolean;\n\n/**\n * An action to perform on the source as instructed by the iterator.\n */\nexport enum IteratorAction\n{\n /**\n * Continue iteration.\n */\n Continue,\n\n /**\n * Stop iteration.\n */\n Stop,\n\n /**\n * Remove the current item if possible, and continue iteration.\n */\n Remove\n}\n\n/**\n * A class that allows an iteratable source to be iterated any number of times\n * by providing the following functionality:\n *\n * - [[Iterator.isEmpty]]: Determines whether the source contains any items.\n * - [[Iterator.first]]: Gets the first item in the source.\n * - [[Iterator.count]]: Counds the number of items in the source.\n * - [[Iterator.list]]: Builds a list of the items in the source.\n * - [[Iterator.object]]: Builds an object of the items in the source.\n * - [[Iterator.reduce]]: Reduces the items in the source down to a single value.\n * - [[Iterator.purge]]: Removes items from the source which meet some criteria.\n * - [[Iterator.filter]]: Returns a subset of items that meet some criteria by\n * returning a new Iterator.\n * - [[Iterator.map]]: Maps each item in the source to another item by returning\n * a new Iterator.\n * - [[Iterator.iterate]]: Invokes a function for each item in the source.\n *\n * The following static functions exist to help iterate simple sources:\n *\n * - [[Iterator.forArray]]: Iterates an array, optionally reverse\n * - [[Iterator.forObject]]: Iterates the properties of an object, optionally\n * just the properties explicitly set on the object.\n *\n * ```typescript\n * let iter = object.iterateThings();\n * iter.isEmpty(); // no items?\n * iter.isEmpty(d => d.flag); // no items that meet some criteria?\n * iter.count(); // number of items\n * iter.count(d => d.flag); // number of items that meet some criteria\n * iter.first(); // first item\n * iter.first(d => d.flag); // first item that meets some criteria\n * iter.list(); // get all items as array\n * iter.list(myArray); // add all items to given array\n * iter.list([], d => d.flag); // get all items as array that meet some criteria\n * iter.object(d => d.id); // get all items as an object keyed by a value (ex: id)\n * iter.object(d => d.id, {},\n * d => d.flag); // get all items as an object keyed by a value where the item meets some criteria (ex: key id if flag is truthy)\n * iter.purge(d => d.flag); // remove all items from source that meet some criteria\n * iter.filter(d => d.flag); // returns an iterator which iterates a subset of items which meet some criteria\n * iter.reduce(0,\n * (d, t) => t + d.size); // reduces all items to a single value (ex: sums all size)\n * iter.reduce(0,\n * (d, t) => t + d.size,\n * d => d.flag); // reduces all items to a single value (ex: sums all size) where the item meets some criteria\n * iter.map(d => d.subitem); // return an iterator for subitems if they exist\n * iter.iterate(d => log(d)); // do something for each item\n * ```\n *\n * @typeparam T The type of item being iterated.\n */\nexport class Iterator\n{\n\n /**\n * A result of the iteration passed to [[Iterator.stop]].\n */\n public result: any = undefined;\n\n /**\n * The last action (if any) called on this iterator.\n */\n public action: IteratorAction;\n\n /**\n * The current callback passed to the iterator.\n */\n public callback: IteratorCallback;\n\n /**\n * The source of iterable items. This allows the iteration over any type of\n * structure. The source must call the callback for each item and its\n * recommended that the source checks the [[Iterator.iterating]] flag after\n * each callback invokation.\n */\n private source: IteratorSource;\n\n /**\n * Creates a new Iterator given a source.\n *\n * @param source The source of items to iterator.\n */\n public constructor(source: IteratorSource)\n {\n this.source = source;\n }\n\n /**\n * Returns a clone of this iterator with the same source. This is necessary\n * if you want to iterate all or a portion of the source while already\n * iterating it (like a nested loop).\n */\n public clone(): Iterator\n {\n return new Iterator( this.source );\n }\n\n /**\n * Passes the given item to the iterator callback and returns the action\n * requested at this point in iteration.\n *\n * @param item The current item being iterated.\n */\n public act(item: T): IteratorAction\n {\n this.action = IteratorAction.Continue;\n\n this.callback( item, this );\n\n return this.action;\n }\n\n /**\n * Stops iteration and optionally sets the result of the iteration.\n *\n * @param result The result of the iteration.\n */\n public stop(result?: any): this\n {\n this.result = result;\n this.action = IteratorAction.Stop;\n\n return this;\n }\n\n /**\n * Signals to the iterator source that the current item wants to be removed.\n */\n public remove(): this\n {\n this.action = IteratorAction.Remove;\n\n return this;\n }\n\n /**\n * Determines with this iterator is empty. A filter function can be specified\n * to only check for items which match certain criteria.\n *\n * @param filter A function to the checks items for certain criteria.\n * @returns `true` if no valid items exist in the source.\n */\n public isEmpty(filter: IteratorFilter = null): boolean\n {\n let empty: boolean = true;\n\n this.iterate((item, iterator) =>\n {\n if (filter && !filter( item ))\n {\n return;\n }\n\n empty = false;\n iterator.stop();\n });\n\n return empty;\n }\n\n /**\n * Counts the number of items in the iterator. A filter function can be\n * specified to only count items which match certain criteria.\n *\n * @param filter A function to count items for certain criteria.\n * @returns The number of items in the source that optionally match the given\n * criteria.\n */\n public count(filter: IteratorFilter = null): number\n {\n let total: number = 0;\n\n this.iterate((item, iterator) =>\n {\n if (filter && !filter( item ))\n {\n return;\n }\n\n total++;\n });\n\n return total;\n }\n\n /**\n * Returns the first item in the iterator. A filter function can be specified\n * to only return the first item which matches certain criteria.\n *\n * @param filter A function to compare items to to match certain criteria.\n * @returns The first item found that optonally matches the given criteria.\n */\n public first(filter: IteratorFilter = null): T\n {\n let first: T = null;\n\n this.iterate((item, iterator) =>\n {\n if (filter && !filter( item ))\n {\n return;\n }\n\n first = item;\n iterator.stop();\n });\n\n return first;\n }\n\n /**\n * Builds a list of items from the source. A filter function can be specified\n * so the resulting list only contain items that match certain criteria.\n *\n * @param out The array to place the items in.\n * @param filter The function which determines which items are added to the list.\n * @returns The reference to `out` which has had items added to it which\n * optionally match the given criteria.\n */\n public list(out: T[] = [], filter: IteratorFilter = null): T[]\n {\n this.iterate((item, iterator) =>\n {\n if (filter && !filter( item ))\n {\n return;\n }\n\n out.push( item );\n });\n\n return out;\n }\n\n /**\n * Builds an object of items from the source keyed by a result returned by\n * a `getKey` function.\n *\n * @param getKey The function which returns the key of the object.\n * @param out The object to place the items in.\n * @param filter The function which determines which items are set on the object.\n * @returns The reference to `out` which has had items set to it which\n * optionally match the given criteria.\n */\n public object(getKey: (item: T) => any, out: any = {}, filter: IteratorFilter = null): any\n {\n this.iterate((item, iterator) =>\n {\n if (filter && !filter( item ))\n {\n return;\n }\n\n let key = getKey( item );\n\n out[ key ] = item;\n });\n\n return out;\n }\n\n /**\n * Returns a new iterator that only returns a maximum number of items.\n *\n * @param amount The maximum number of items to return.\n * @returns A new iterator which returns a maximum number of items.\n */\n public take(amount: number): Iterator\n {\n return new Iterator(next =>\n {\n this.iterate((item, prev) =>\n {\n switch (next.act( item ))\n {\n case IteratorAction.Stop:\n prev.stop();\n break;\n case IteratorAction.Remove:\n prev.remove();\n break;\n }\n\n if (--amount <= 0)\n {\n prev.stop();\n }\n });\n });\n }\n\n /**\n * Returns a new iterator that skips the given number of items from the items\n * in this iterator.\n *\n * @param amount The number of items to skip.\n * @returns A new iterator which skipped the given number of items.\n */\n public skip(amount: number): Iterator\n {\n return new Iterator(next =>\n {\n let skipped: number = 0;\n\n this.iterate((item, prev) =>\n {\n if (skipped >= amount)\n {\n switch (next.act( item ))\n {\n case IteratorAction.Stop:\n prev.stop();\n break;\n case IteratorAction.Remove:\n prev.remove();\n break;\n }\n }\n\n skipped++;\n });\n });\n }\n\n /**\n * Returns a new iterator thats items are the items in this iterator followed\n * by the items in the given iterators.\n *\n * @param iterators The iterators to append after this one.\n * @returns A new iterator based on this iterator followed by the given.\n */\n public append(...iterators: Iterator[]): Iterator\n {\n return Iterator.join( this, ...iterators );\n }\n\n /**\n * Returns a new iterator thats items are the items in the given iterators\n * followed by the items in this iterator.\n *\n * @param iterators The iterators to prepend before this one.\n * @returns A new iterator based on the given iterators followed by this.\n */\n public prepend(...iterators: Iterator[]): Iterator\n {\n return Iterator.join( ...iterators, this );\n }\n\n /**\n * Removes items from the source that match certain criteria.\n *\n * @param filter The function which determines which items to remove.\n */\n public purge(filter: IteratorFilter): this\n {\n this.iterate((item, iterator) =>\n {\n if (filter(item))\n {\n iterator.remove();\n }\n });\n\n return this;\n }\n\n /**\n * Returns an iterator which takes items from this iterator and presents them\n * in reverse.\n *\n * @returns A new iterator with the items in this iterator in reverse.\n */\n public reverse(): Iterator\n {\n return new Iterator(iterator =>\n {\n let items: T[] = this.list();\n let removed: T[] = [];\n\n for (let i = items.length - 1; i >= 0; i--)\n {\n let item: T = items[ i ];\n let action: IteratorAction = iterator.act( item );\n\n if (action === IteratorAction.Stop)\n {\n break;\n }\n\n if (action === IteratorAction.Remove)\n {\n removed.push( item );\n }\n }\n\n if (removed.length > 0)\n {\n this.purge(item => removed.indexOf( item ) !== -1);\n }\n });\n }\n\n /**\n * Reduces all the items in the source to a single value given the initial\n * value and a function to convert an item and the current reduced value\n */\n public reduce(initial: R, reducer: (item: T, reduced: R) => R, filter: IteratorFilter = null): R\n {\n let reduced: R = initial;\n\n this.iterate((item, iterator) =>\n {\n if (filter && !filter( item ))\n {\n return;\n }\n\n reduced = reducer( item, reduced );\n });\n\n return reduced;\n }\n\n /**\n * Returns an iterator where this iterator is the source and the returned\n * iterator is built on a subset of items which pass a `filter` function.\n *\n * @param filter The function which determines if an item should be iterated.\n * @returns A new iterator for the filtered items from this iterator.\n */\n public filter(filter: IteratorFilter): Iterator\n {\n return new Iterator(next =>\n {\n this.iterate((prevItem, prev) =>\n {\n if (filter(prevItem))\n {\n switch (next.act( prevItem ))\n {\n case IteratorAction.Stop:\n prev.stop();\n break;\n\n case IteratorAction.Remove:\n prev.remove();\n break;\n }\n }\n });\n });\n }\n\n /**\n * Returns an iterator where this iterator is the source and the returned\n * iterator is built from mapped items pulled from items in the source\n * of this iterator. If the given callback `outerCallback` does not return\n * a mapped value then the returned iterator will not see the item. A filter\n * function can be specified to only look at mapping items which match\n * certain criteria.\n *\n * @param mapper The function which maps an item to another.\n * @param filter The function which determines if an item should be mapped.\n * @returns A new iterator for the mapped items from this iterator.\n */\n public map(mapper: IteratorCallback, filter: IteratorFilter = null): Iterator\n {\n return new Iterator(next =>\n {\n this.iterate((prevItem, prev) =>\n {\n if (filter && !filter( prevItem ))\n {\n return;\n }\n\n let nextItem: W = mapper( prevItem, prev );\n\n if (fn.isDefined( nextItem ))\n {\n switch (next.act( nextItem ))\n {\n case IteratorAction.Stop:\n prev.stop();\n break;\n\n case IteratorAction.Remove:\n prev.remove();\n break;\n }\n }\n });\n });\n }\n\n /**\n * Invokes the callback for each item in the source of this iterator. The\n * second argument in the callback is the reference to this iterator and\n * [[Iterator.stop]] can be called at anytime to cease iteration.\n *\n * @param callback The function to invoke for each item in this iterator.\n */\n public iterate(callback: IteratorCallback): this\n {\n this.result = undefined;\n this.callback = callback;\n this.action = IteratorAction.Continue;\n this.source( this );\n this.callback = null;\n\n return this;\n }\n\n /**\n * Passes the result of the iteration to the given function if a truthy\n * result was passed to [[Iterator.stop]].\n *\n * @param getResult The function to pass the result to if it exists.\n */\n public withResult(getResult: (result: any) => any): this\n {\n if (this.result)\n {\n getResult( this.result );\n }\n\n return this;\n }\n\n /**\n * Returns an iterator for the given array optionally iterating it in reverse.\n *\n * @param items The array of items to iterate.\n * @param reverse If the array should be iterated in reverse.\n * @returns A new iterator for the given array.\n */\n public static forArray(items: T[], reverse: boolean = false): Iterator\n {\n return new Iterator(iterator =>\n {\n if (reverse)\n {\n for (let i = items.length - 1; i >= 0; i--)\n {\n switch (iterator.act(items[ i ]))\n {\n case IteratorAction.Stop:\n return;\n case IteratorAction.Remove:\n items.splice(i, 1);\n break;\n }\n }\n }\n else\n {\n for (let i = 0; i < items.length; i++)\n {\n switch (iterator.act(items[ i ]))\n {\n case IteratorAction.Stop:\n return;\n case IteratorAction.Remove:\n items.splice(i, 1);\n i--;\n break;\n }\n }\n }\n });\n }\n\n /**\n * Returns an iterator for the given object optionally checking the\n * `hasOwnProperty` function on the given object.\n *\n * @param items The object to iterate.\n * @param hasOwnProperty If `hasOwnProperty` should be checked.\n * @returns A new iterator for the given object.\n */\n public static forObject(items: { [key: string]: T }, hasOwnProperty: boolean = true): Iterator\n {\n return new Iterator(iterator =>\n {\n for (let key in items)\n {\n if (hasOwnProperty && !items.hasOwnProperty( key ))\n {\n continue;\n }\n\n switch (iterator.act(items[ key ]))\n {\n case IteratorAction.Stop:\n return;\n case IteratorAction.Remove:\n delete items[ key ];\n break;\n }\n }\n });\n }\n\n /**\n * Joins all the given iterators into a single iterator where the items\n * returned are in the same order as passed to this function. If any items\n * are removed from the returned iterator they will be removed from the given\n * iterator if it supports removal.\n *\n * @param iterators The array of iterators to join as one.\n * @returns A new iterator for the given iterators.\n */\n public static join(...iterators: Iterator[]): Iterator\n {\n return new Iterator(parent =>\n {\n for (let child of iterators)\n {\n child.iterate((item, childIterator) =>\n {\n switch (parent.act( item ))\n {\n case IteratorAction.Remove:\n childIterator.remove();\n break;\n case IteratorAction.Stop:\n childIterator.stop();\n break;\n }\n });\n\n if (child.action === IteratorAction.Stop)\n {\n return;\n }\n }\n });\n }\n\n /**\n * Returns a new iterator with no items.\n *\n * @returns A new iterator with no items.\n */\n public static empty(): Iterator\n {\n return new Iterator(parent => {});\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Iterator.ts","\nimport { Functions as fn } from './Functions';\nimport { Day, DayProperty } from './Day';\nimport { Suffix } from './Suffix';\nimport { Weekday } from './Weekday';\nimport { FrequencyValueEvery } from './Frequency';\nimport { ScheduleInput } from './Schedule';\n\n\n/**\n * Describes a [[Pattern]] given a [[Day]] to base it on.\n *\n * @param day The day to base the description on.\n * @returns The description of the pattern.\n */\nexport type DescribePattern = (day: Day) => string;\n\n/**\n * A rule helps parse [[ScheduleInput]] and determines whether it matches the\n * given pattern.\n *\n * - When a number is given, the input MUST be an array of the same length and contain any values.\n * - When an array of numbers is given, the input MUST be an array containing the same values.\n * - When a TRUE is given the input MUST contain that property and can be any value.\n * - When a FALSE is given the input MAY contain that property (optional).\n * - When a property is NOT specified, the input MUST NOT contain that property.\n * - When an object with every is given, the input must match the every and offset values (have the same frequency).\n */\nexport type PatternRule =\n number | // has array with this number of elements\n number[] | // is array with same values\n boolean | // is true or false\n FrequencyValueEvery; // is object with matching every and offset\n\n/**\n * The set of rules you can specify for determining if a [[ScheduleInput]]\n * matches a pattern.\n */\nexport interface PatternRules\n{\n dayOfWeek?: PatternRule;\n dayOfMonth?: PatternRule;\n lastDayOfMonth?: PatternRule;\n dayOfYear?: PatternRule;\n month?: PatternRule;\n week?: PatternRule;\n year?: PatternRule;\n weekOfYear?: PatternRule;\n weekspanOfYear?: PatternRule;\n fullWeekOfYear?: PatternRule;\n lastWeekspanOfYear?: PatternRule;\n lastFullWeekOfYear?: PatternRule;\n weekOfMonth?: PatternRule;\n weekspanOfMonth?: PatternRule;\n fullWeekOfMonth?: PatternRule;\n lastWeekspanOfMonth?: PatternRule;\n lastFullWeekOfMonth?: PatternRule;\n}\n\n\n/**\n * A class which helps describe [[ScheduleInput]] if it matches a pattern.\n */\nexport class Pattern\n{\n\n /**\n * The properties in the [[ScheduleInput]] which are compared against the\n * rules of a pattern.\n */\n public static PROPS: DayProperty[] =\n [\n 'dayOfWeek', 'dayOfMonth', 'lastDayOfMonth', 'dayOfYear',\n 'month', 'week', 'year',\n 'weekOfYear', 'weekspanOfYear', 'fullWeekOfYear', 'lastWeekspanOfYear', 'lastFullWeekOfYear',\n 'weekOfMonth', 'weekspanOfMonth', 'fullWeekOfMonth', 'lastWeekspanOfMonth', 'lastFullWeekOfMonth'\n ];\n\n /**\n * Whether this pattern should be \"listed\" or not. Visual schedulers may\n * provide a shortcut to describing and changing a [[Schedule]] through\n * patterns and any pattern where listed is `true` could be an option in a\n * list. The default patterns are all listed.\n */\n public listed: boolean;\n\n /**\n * The function which describes this pattern given a [[Day]] to base it on.\n */\n public describe: DescribePattern;\n\n /**\n * The name of this pattern. This is not typically displayed to a user, just\n * to uniquely identify a pattern.\n */\n public name: string;\n\n /**\n * The rules for matching a pattern to a [[Schedule]] or applying a pattern to\n * a schedule.\n */\n public rules: PatternRules;\n\n\n /**\n * Creates a new pattern.\n *\n * @param name The unique name of the pattern.\n * @param listed If the pattern is \"listed\" [[Pattern.listed]].\n * @param describe A function to describe the pattern given a [[Day]].\n * @param rules The rules which describe how to detect and apply the pattern\n * to schedule input.\n */\n public constructor(name: string, listed: boolean, describe: DescribePattern, rules: PatternRules)\n {\n this.name = name;\n this.listed = listed;\n this.describe = describe;\n this.rules = rules;\n }\n\n /**\n * Applies this pattern to schedule input removing and adding any necessary\n * properties from the input to match this pattern - based around the day\n * provided.\n *\n * @param input The input to update to match this pattern.\n * @param day The day to base the schedule on.\n * @returns The reference to the input passed in.\n */\n public apply(input: ScheduleInput, day: Day): ScheduleInput\n {\n for (let prop of Pattern.PROPS)\n {\n let rule = this.rules[ prop ];\n\n // Should have one value\n if (rule === 1)\n {\n input[ prop ] = [day[ prop ]];\n }\n\n // Can be any of the values in the array\n if (fn.isArray(rule))\n {\n input[ prop ] = rule;\n }\n\n // Must not be present\n if (!fn.isDefined(rule))\n {\n delete input[ prop ];\n }\n }\n\n return input;\n }\n\n /**\n * Determines whether the given input matches this pattern. Optionally a day\n * can be provided to make sure the day matches the schedule and pattern\n * together.\n *\n * @param input The schedule input to test.\n * @param exactlyWith A day to further validate against for matching.\n * @returns `true` if the schedule input was a match to this pattern with the\n * day if one was provided, otherwise `false`.\n */\n public isMatch(input: ScheduleInput, exactlyWith?: Day): boolean\n {\n let exactly: boolean = fn.isDefined( exactlyWith );\n\n for (let prop of Pattern.PROPS)\n {\n let rule = this.rules[ prop ];\n let curr = input[ prop ];\n\n // Optional, skip it\n if (rule === false)\n {\n continue;\n }\n\n // Requires any value\n if (rule === true && !curr)\n {\n return false;\n }\n\n // Must not be present\n if (!fn.isDefined(rule) && curr)\n {\n return false;\n }\n\n // Must be an array of the same size\n if (fn.isNumber(rule))\n {\n if (fn.isArray(curr) && curr.length === rule)\n {\n if (exactly && curr.indexOf( exactlyWith[ prop ] ) === -1)\n {\n return false;\n }\n }\n else\n {\n return false;\n }\n }\n\n // Must be an array of the same values\n if (fn.isArray(rule))\n {\n if (!fn.isArray(curr))\n {\n return false;\n }\n\n if (rule.length !== curr.length)\n {\n return false;\n }\n\n for (var i = 0; i < rule.length; i++)\n {\n if (rule[ i ] !== curr[ i ])\n {\n return false;\n }\n }\n\n if (exactly && rule.indexOf( exactlyWith[ prop ] ) === -1)\n {\n return false;\n }\n }\n\n // Must be an object with same over & offset.\n if (fn.isObject(rule))\n {\n if (!fn.isObject(curr))\n {\n return false;\n }\n\n var ruleOffset = rule.offset || 0;\n var currOffset = curr.offset || 0;\n\n if (currOffset !== ruleOffset || curr.every !== rule.every)\n {\n return false;\n }\n\n if (exactly && (exactlyWith[ prop ] % rule.every) !== ruleOffset)\n {\n return false;\n }\n }\n }\n\n return true;\n }\n\n /**\n * Returns the pattern with the given name if one exists. If you add your own\n * patterns make sure to add them to [[PatternMap]].\n *\n * @param name The name of the pattern to return.\n * @return The instance to the pattern with the same name.\n */\n public static withName(name: string): Pattern\n {\n return PatternMap[ name ];\n }\n\n /**\n * Finds a matching pattern to the given input searching through [[Patterns]]\n * for matches. Optionally it will only look at patterns where listed = `true`.\n *\n * @param input The schedule input to use.\n * @param listedOnly When `true` only patterns with [[Pattern.listed]] set to\n * `true` will be looked at, otherwise all patterns are looked at.\n * @param exactlyWith A day to further validate against for matching.\n * @see [[Pattern.isMatch]]\n */\n public static findMatch(input: ScheduleInput, listedOnly: boolean = true, exactlyWith?: Day): Pattern\n {\n for (let pattern of Patterns)\n {\n if ((pattern.listed || !listedOnly) && pattern.isMatch( input, exactlyWith ))\n {\n return pattern;\n }\n }\n\n return null;\n }\n\n}\n\n\n/**\n * The list of patterns that can be searched through for matches to schedule\n * input.\n *\n * @see [[Pattern.findMatch]]\n */\nexport let Patterns: Pattern[] = [\n new Pattern(\n 'none', true,\n (day: Day) => 'Does not repeat',\n {\n year: 1,\n month: 1,\n dayOfMonth: 1\n }\n ),\n new Pattern(\n 'daily', true,\n (day: Day) => 'Daily',\n {\n\n }\n ),\n new Pattern(\n 'weekly', true,\n (day: Day) => 'Weekly on ' + day.format('dddd'),\n {\n dayOfWeek: 1\n }\n ),\n new Pattern(\n 'monthlyWeek', true,\n (day: Day) => 'Monthly on the ' + Suffix.CACHE[day.weekspanOfMonth + 1] + ' ' + day.format('dddd'),\n {\n dayOfWeek: 1,\n weekspanOfMonth: 1\n }\n ),\n new Pattern(\n 'annually', true,\n (day: Day) => 'Annually on ' + day.format('MMMM Do'),\n {\n month: 1,\n dayOfMonth: 1\n }\n ),\n new Pattern(\n 'annuallyMonthWeek', true,\n (day: Day) => 'Annually on the ' + Suffix.CACHE[day.weekspanOfMonth + 1] + ' ' + day.format('dddd') + ' of ' + day.format('MMMM'),\n {\n month: 1,\n dayOfWeek: 1,\n weekspanOfMonth: 1\n }\n ),\n new Pattern(\n 'weekday', true,\n (day: Day) => 'Every weekday (Monday to Friday)',\n {\n dayOfWeek: [Weekday.MONDAY, Weekday.TUESDAY, Weekday.WEDNESDAY, Weekday.THURSDAY, Weekday.FRIDAY]\n }\n ),\n new Pattern(\n 'monthly', true,\n (day: Day) => 'Monthly on the ' + day.format('Do') + ' day',\n {\n dayOfMonth: 1\n }\n ),\n new Pattern(\n 'custom', true,\n (day: Day) => 'Custom...',\n {\n dayOfWeek: false,\n dayOfMonth: false,\n lastDayOfMonth: false,\n dayOfYear: false,\n year: false,\n month: false,\n week: false,\n weekOfYear: false,\n weekspanOfYear: false,\n fullWeekOfYear: false,\n lastWeekspanOfYear: false,\n lastFullWeekOfYear: false,\n weekOfMonth: false,\n weekspanOfMonth: false,\n fullWeekOfMonth: false,\n lastWeekspanOfMonth: false,\n lastFullWeekOfMonth: false\n }\n )\n];\n\n/**\n * The map of patterns keyed by their name.\n *\n * @see [[Pattern.withName]]\n */\nexport let PatternMap: { [name: string]: Pattern } = {};\n\nfor (let pattern of Patterns)\n{\n PatternMap[ pattern.name ] = pattern;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Pattern.ts","\nimport { Identifier, IdentifierInput } from './Identifier';\nimport { Day } from './Day';\nimport { DaySpan } from './DaySpan';\nimport { Iterator, IteratorAction } from './Iterator';\n\n\n/**\n * A map of values in the [[ScheduleModifier]] keyed by the descriptions of the\n * identifiers.\n */\nexport interface ScheduleModifierDescription\n{\n [description: string]: T\n}\n\n/**\n * An object which carries the span taken from an identifier and the value\n * mapped to it in a [[ScheduleModifier]].\n */\nexport interface ScheduleModifierSpan\n{\n span: DaySpan,\n value: T\n}\n\n/**\n * A class that can modify the events of a schedule by storing [[Identifier]]s\n * and an associated value.\n *\n * @typeparam T The type of data that modifies the schedule.\n */\nexport class ScheduleModifier\n{\n\n /**\n * The map of values mapped by their [[Identifier]]s.\n */\n public map: { [id: string]: T };\n\n\n /**\n * Creates a new schedule modifier.\n */\n public constructor()\n {\n this.map = {};\n }\n\n /**\n * Clears the modifier of all modifications.\n */\n public clear(): this\n {\n this.map = {};\n\n return this;\n }\n\n /**\n * Returns `true` if this modifier lacks any modifications, otherwise `false`.\n */\n public isEmpty(): boolean\n {\n // @ts-ignore\n for (let id in this.map)\n {\n return !id;\n }\n\n return true;\n }\n\n /**\n * Gets the most specific value in this modifier for the given day, if none\n * exists `otherwise` is returned. A modifier can have multiple values for a\n * given day because [[Identifier]]s represent a span of time.\n *\n * @param day The day to get a value for.\n * @param otherwise What to return if no value exists for the given day.\n * @param lookAtTime If the specific time of the given day should be looked at.\n * @returns The most specific value for the given day, or `otherwise`.\n */\n public get(day: Day, otherwise: T, lookAtTime: boolean = true): T\n {\n let map = this.map;\n\n return (lookAtTime && map[ day.timeIdentifier ]) ||\n map[ day.dayIdentifier ] ||\n map[ day.monthIdentifier ] ||\n map[ day.weekIdentifier ] ||\n map[ day.quarterIdentifier ] ||\n otherwise;\n }\n\n /**\n * Gets all values in this modifier for the given day. If none exist, an empty\n * array is returned. The values returned in the array are returned in most\n * specific to least specific.\n *\n * @param day The day to get the values for.\n * @returns An array of values (modifications) for the given day.\n */\n public getAll(day: Day): T[]\n {\n let map = this.map;\n let all: T[] = [];\n\n if (map[ day.timeIdentifier ]) all.push( map[ day.timeIdentifier ] );\n if (map[ day.dayIdentifier ]) all.push( map[ day.dayIdentifier ] );\n if (map[ day.monthIdentifier ]) all.push( map[ day.monthIdentifier ] );\n if (map[ day.weekIdentifier ]) all.push( map[ day.weekIdentifier ] );\n if (map[ day.quarterIdentifier ]) all.push( map[ day.quarterIdentifier ] );\n\n return all;\n }\n\n /**\n * Moves the value/modification from one identifier to another.\n *\n * @param from The day to take the identifier from.\n * @param fromType The identifier type.\n * @param to The day to move the value to.\n * @param toType The identifier type to move the value to.\n */\n public move(from: Day, fromType: Identifier, to: Day, toType: Identifier): this\n {\n let fromIdentifier = fromType.get( from );\n let toIdentifier = toType.get( to );\n\n this.map[ toIdentifier ] = this.map[ fromIdentifier ];\n\n delete this.map[ fromIdentifier ];\n\n return this;\n }\n\n /**\n * Sets the value/modification in this map given a day, the value, and the\n * identifier type.\n *\n * @param day The day to take an identifier from.\n * @param value The value/modification to set.\n * @param type The identifier type.\n */\n public set(day: Day, value: T, type: Identifier): this\n {\n this.map[ type.get( day ) ] = value;\n\n return this;\n }\n\n /**\n * Removes the value/modification from this modifier based on the identifier\n * pulled from the day.\n *\n * @param day The day to take an identifier from.\n * @param type The identifier type.\n */\n public unset(day: Day, type: Identifier): this\n {\n delete this.map[ type.get( day ) ];\n\n return this;\n }\n\n /**\n * Iterates through the modifiers passing the identifier and the related value.\n *\n * @returns A new instance of an [[Iterator]].\n */\n public iterate(): Iterator<[IdentifierInput, T]>\n {\n return new Iterator<[IdentifierInput, T]>(iterator =>\n {\n let map = this.map;\n\n for (let rawId in map)\n {\n let asNumber: number = parseInt( rawId );\n let validAsNumber: boolean = asNumber + '' === rawId;\n let id: IdentifierInput = validAsNumber ? asNumber : rawId;\n\n switch (iterator.act([id, map[ rawId ]]))\n {\n case IteratorAction.Stop:\n return;\n case IteratorAction.Remove:\n delete map[ rawId ];\n break;\n }\n }\n });\n }\n\n /**\n * Queries the modifier for all values/modifications which fall in the time\n * span that the given identifier represents. All identifiers and their value\n * are passed to the given callback.\n *\n * @param prefix The identifier\n * @returns A new instance of an [[Iterator]].\n */\n public query(query: IdentifierInput): Iterator<[IdentifierInput, T]>\n {\n return this.iterate()\n .filter(([id, value]) => Identifier.contains( query, id ));\n ;\n }\n\n /**\n * Returns all identifiers stored in this modifier.\n */\n public identifiers(filter?: (value: T, id: IdentifierInput) => boolean): Iterator\n {\n return this.iterate()\n .filter(([id, value]) => !filter || filter( value, id ))\n .map(([id, ]) => id)\n ;\n }\n\n /**\n * Builds a list of spans and the associated values. The spans are calculated\n * from the identiier key via [[Identifier.span]].\n *\n * @param endInclusive If the end date in the spans should be the last\n * millisecond of the timespan or the first millisecond of the next.\n * @returns An array of spans calculated from the identifiers with the\n * associated values/modifications.\n */\n public spans(endInclusive: boolean = false): Iterator>\n {\n return this.iterate()\n .map(([id, value]) =>\n {\n let type: Identifier = Identifier.find(id);\n\n if (type)\n {\n let span = type.span( id, endInclusive);\n\n return { span, value };\n }\n })\n ;\n }\n\n /**\n * Builds a list of the descriptions of the identifiers in this modifier.\n *\n * @param short If the description should use shorter language or longer.\n * @returns The built list of descriptions.\n */\n public describe(short: boolean = false): Iterator\n {\n return this.iterate()\n .map( ([id, ]) =>\n {\n let type: Identifier = Identifier.find( id );\n\n if (type)\n {\n return type.describe( id, short );\n }\n })\n ;\n }\n\n /**\n * Builds a map of the values/modifications keyed by the descripton of the\n * identifier computed via [[Identifier.describe]].\n *\n * @param short If the description should use shorter language or longer.\n * @returns The built map of description to values/modifications.\n */\n public describeMap(short: boolean = false): ScheduleModifierDescription\n {\n let map = this.map;\n let out: ScheduleModifierDescription = {};\n\n for (let id in map)\n {\n let type: Identifier = Identifier.find(id);\n\n if (type)\n {\n out[ type.describe( id, short ) ] = map[ id ];\n }\n }\n\n return out;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/ScheduleModifier.ts","\nimport { Functions as fn } from './Functions';\nimport { FrequencyValue, FrequencyCheck, FrequencyValueEvery, FrequencyValueOneOf } from './Frequency';\nimport { Day, DayInput, DurationInput, DayProperty } from './Day';\nimport { Identifier, IdentifierInput } from './Identifier';\nimport { DaySpan } from './DaySpan';\nimport { Constants } from './Constants';\nimport { Parse } from './Parse';\nimport { Time, TimeInput } from './Time';\nimport { Suffix } from './Suffix';\nimport { ScheduleModifier, ScheduleModifierSpan } from './ScheduleModifier';\nimport { Units } from './Units';\nimport { Iterator, IteratorAction } from './Iterator';\n\n// @ts-ignore\nimport * as moment from 'moment';\n\n\n/**\n * A tuple which identifies an event on the schedule. The tuple contains the\n * total span of the event occurrence, the day of the event (could be the start\n * day, end day, or any days in between for multi-day events) as well as the\n * identifier for the event.\n */\nexport type ScheduleEventTuple = [DaySpan, Day, IdentifierInput];\n\n/**\n * Input given by a user which describes an event schedule.\n *\n * @typeparam M The type of metadata stored in the schedule.\n */\nexport interface ScheduleInput\n{\n\n /**\n * @see [[Schedule.start]]\n */\n start?: DayInput;\n\n /**\n * @see [[Schedule.end]]\n */\n end?: DayInput;\n\n /**\n * A shortcut to setting the [[Schedule.start]], [[Schedule.end]],\n * [[Schedule.year]], [[Schedule.month]], and [[Schedule.dayOfMonth]].\n */\n on?: DayInput;\n\n /**\n * @see [[Schedule.times]]\n */\n times?: TimeInput[];\n\n /**\n * @see [[Schedule.duration]]\n */\n duration?: number;\n\n /**\n * @see [[Schedule.durationUnit]]\n */\n durationUnit?: DurationInput;\n\n /**\n * An array of days or identifiers which should be excluded from the schedule.\n *\n * @see [[Schedule.exclude]]\n */\n exclude?: (Day | IdentifierInput)[];\n\n /**\n * An array of days or identifiers which should be included in the schedule.\n *\n * @see [[Schedule.include]]\n */\n include?: (Day | IdentifierInput)[];\n\n /**\n * An array of days or identifiers which should be canceled in the schedule.\n *\n * @see [[Schedule.cancel]]\n */\n cancel?: (Day | IdentifierInput)[];\n\n /**\n * @see [[Schedule.meta]]\n */\n meta?: { [identifier: string]: M };\n\n /**\n * @see [[Schedule.month]]\n */\n month?: FrequencyValue;\n\n /**\n * @see [[Schedule.year]]\n */\n year?: FrequencyValue;\n\n /**\n * @see [[Schedule.week]]\n */\n week?: FrequencyValue;\n\n /**\n * @see [[Schedule.dayOfWeek]]\n */\n dayOfWeek?: FrequencyValue;\n\n /**\n * @see [[Schedule.dayOfMonth]]\n */\n dayOfMonth?: FrequencyValue;\n\n /**\n * @see [[Schedule.lastDayOfMonth]]\n */\n lastDayOfMonth?: FrequencyValue;\n\n /**\n * @see [[Schedule.dayOfYear]]\n */\n dayOfYear?: FrequencyValue;\n\n /**\n * @see [[Schedule.weekOfYear]]\n */\n weekOfYear?: FrequencyValue;\n\n /**\n * @see [[Schedule.weekspanOfYear]]\n */\n weekspanOfYear?: FrequencyValue;\n\n /**\n * @see [[Schedule.fullWeekOfYear]]\n */\n fullWeekOfYear?: FrequencyValue;\n\n /**\n * @see [[Schedule.lastWeekspanOfYear]]\n */\n lastWeekspanOfYear?: FrequencyValue;\n\n /**\n * @see [[Schedule.lastFullWeekOfYear]]\n */\n lastFullWeekOfYear?: FrequencyValue;\n\n /**\n * @see [[Schedule.weekOfMonth]]\n */\n weekOfMonth?: FrequencyValue;\n\n /**\n * @see [[Schedule.weekspanOfMonth]]\n */\n weekspanOfMonth?: FrequencyValue;\n\n /**\n * @see [[Schedule.fullWeekOfMonth]]\n */\n fullWeekOfMonth?: FrequencyValue;\n\n /**\n * @see [[Schedule.lastWeekspanOfMonth]]\n */\n lastWeekspanOfMonth?: FrequencyValue;\n\n /**\n * @see [[Schedule.lastFullWeekOfMonth]]\n */\n lastFullWeekOfMonth?: FrequencyValue;\n\n /**\n * The function to parse metadata with.\n */\n parseMeta?: (input: any) => M;\n}\n\n\n/**\n * A class which describes when an event occurs over what time and if it repeats.\n *\n * @typeparam M The type of metadata stored in the schedule.\n */\nexport class Schedule\n{\n\n /**\n * The earliest an event can occur in the schedule, or `null` if there are no\n * restrictions when the earliest event can occur. This day is inclusive.\n */\n public start: Day;\n\n /**\n * The latest an event can occur in the schedule, or `null` if there are no\n * restrictions when the latest event can occur. This day is inclusive.\n */\n public end: Day;\n\n /**\n * The length of events in this schedule.\n */\n public duration: number;\n\n /**\n * The unit which describes the duration of the event.\n */\n public durationUnit: DurationInput;\n\n /**\n * The times at which the events occur on the days they should. If there are\n * no times specified its assumed to be an all day event - potentially over\n * multiple days or weeks based on [[Schedule.duration]] and\n * [[Schedule.durationUnit]].\n */\n public times: Time[];\n\n /**\n * The number of days an event in this schedule lasts PAST the starting day.\n * If this is a full day event with a duration greater than zero this value\n * will be greater than one. If this event occurs at a specific time with a\n * given duration that is taken into account and if it passes over into the\n * next day this value will be greater than one. This value is used to look\n * back in time when trying to figure out what events start or overlap on a\n * given day.\n */\n public durationInDays: number;\n\n /**\n * A set of identifiers which mark what days or times are excluded on the\n * schedule. This typically represents the set of event occurrences removed.\n */\n public exclude: ScheduleModifier;\n\n /**\n * A set of identifiers which mark what days or times are included outside\n * the normal series of days on the schedule. This typically represents\n * an event occurrence which is moved so its added to the exclude and include\n * sets.\n */\n public include: ScheduleModifier;\n\n /**\n * A set of identifiers which mark what days, times, weeks, months, etc that\n * should have all event occurrences cancelled.\n */\n public cancel: ScheduleModifier;\n\n /**\n * A map of metadata keyed by an identifier. The metadata is placed in\n * [[CalendarEvent]].\n */\n public meta: ScheduleModifier;\n\n /**\n * How frequent the event occurs based on [[Day.dayOfWeek]].\n */\n public dayOfWeek: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.dayOfMonth]].\n */\n public dayOfMonth: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.lastDayOfMonth]].\n */\n public lastDayOfMonth: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.dayOfYear]].\n */\n public dayOfYear: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.month]].\n */\n public month: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.week]].\n */\n public week: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.weekOfYear]].\n */\n public weekOfYear: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.weekspanOfYear]].\n */\n public weekspanOfYear: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.fullWeekOfYear]].\n */\n public fullWeekOfYear: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.lastWeekspanOfYear]].\n */\n public lastWeekspanOfYear: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.lastFullWeekOfYear]].\n */\n public lastFullWeekOfYear: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.weekOfMonth]].\n */\n public weekOfMonth: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.weekspanOfMonth]].\n */\n public weekspanOfMonth: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.fullWeekOfMonth]].\n */\n public fullWeekOfMonth: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.lastWeekspanOfMonth]].\n */\n public lastWeekspanOfMonth: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.lastFullWeekOfMonth]].\n */\n public lastFullWeekOfMonth: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.year]].\n */\n public year: FrequencyCheck;\n\n /**\n * The array of frequency functions which had valid frequencies.\n *\n * @see [[FrequencyCheck.given]]\n */\n public checks: FrequencyCheck[];\n\n\n /**\n * Creates a schedule based on the given input.\n *\n * @param input The input which describes the schedule of events.\n */\n public constructor(input?: ScheduleInput)\n {\n this.exclude = new ScheduleModifier();\n this.include = new ScheduleModifier();\n this.cancel = new ScheduleModifier();\n this.meta = new ScheduleModifier();\n\n if (fn.isDefined(input))\n {\n this.set(input);\n }\n }\n\n /**\n * Sets the schedule with the given input.\n *\n * @param input The input which describes the schedule of events.\n * @param parseMeta A function to use when parsing meta input into the desired type.\n * @see [[Parse.schedule]]\n */\n public set(input: ScheduleInput,\n parseMeta: (input: any) => M = (x => x)): this\n {\n Parse.schedule(input, fn.coalesce( input.parseMeta, parseMeta ), this);\n\n return this;\n }\n\n /**\n * Returns the last event time specified or `undefined` if this schedule is\n * for an all day event.\n */\n public get lastTime(): Time\n {\n return this.times[ this.times.length - 1 ];\n }\n\n /**\n * The [[Identifier]] for this schedule. Either [[Identifier.Day]] or\n * [[Identifier.Time]].\n */\n public get identifierType(): Identifier\n {\n return this.isFullDay() ? Identifier.Day : Identifier.Time;\n }\n\n /**\n * Updates the [[Schedule.durationInDays]] variable based on the\n * [[Schedule.lastTime]] (if any), the [[Schedule.duration]] and it's\n * [[Schedule.durationUnit]].\n */\n public updateDurationInDays(): this\n {\n let start: number = this.lastTime ? this.lastTime.toMilliseconds() : 0;\n let duration: number = this.duration * (Constants.DURATION_TO_MILLIS[ this.durationUnit ] || 0);\n let exclude: number = Constants.MILLIS_IN_DAY;\n let day: number = Constants.MILLIS_IN_DAY;\n\n this.durationInDays = Math.max(0, Math.ceil((start + duration - exclude) / day));\n\n return this;\n }\n\n /**\n * Updates [[Schedule.checks]] based on the frequencies that were specified\n * in the schedule input.\n */\n public updateChecks(): this\n {\n this.checks = Parse.givenFrequency([\n this.year,\n this.month,\n this.week,\n this.weekOfYear,\n this.fullWeekOfYear,\n this.weekspanOfYear,\n this.lastFullWeekOfYear,\n this.lastWeekspanOfYear,\n this.weekOfMonth,\n this.weekspanOfMonth,\n this.fullWeekOfMonth,\n this.lastWeekspanOfMonth,\n this.lastFullWeekOfMonth,\n this.dayOfWeek,\n this.dayOfMonth,\n this.lastDayOfMonth,\n this.dayOfYear\n ]);\n\n return this;\n }\n\n /**\n * Determines whether the given day lies between the earliest and latest\n * valid day in the schedule.\n *\n * @param day The day to test.\n * @returns `true` if the day lies in the schedule, otherwise `false`.\n * @see [[Schedule.start]]\n * @see [[Schedule.end]]\n */\n public matchesSpan(day: Day): boolean\n {\n return (this.start === null || day.isSameOrAfter(this.start)) &&\n (this.end === null || day.isBefore(this.end));\n }\n\n /**\n * Determines whether the given range overlaps with the earliest and latest\n * valid days in this schedule (if any).\n *\n * @param start The first day in the range.\n * @param end The last day in the range.\n * @returns `true` if the range intersects with the schedule, otherwise `false`.\n * @see [[Schedule.start]]\n * @see [[Schedule.end]]\n */\n public matchesRange(start: Day, end: Day): boolean\n {\n if (this.start && end.isBefore(this.start))\n {\n return false;\n }\n\n if (this.end && start.isAfter(this.end))\n {\n return false;\n }\n\n return true;\n }\n\n /**\n * Determines whether the given day is explicitly excluded in the schedule.\n *\n * @param day The day to test.\n * @param lookAtTime lookAtTime If the specific time of the given day should\n * be looked at.\n * @returns `true` if the day was excluded, otherwise `false`.\n */\n public isExcluded(day: Day, lookAtTime: boolean = true): boolean\n {\n return this.exclude.get( day, false, lookAtTime );\n }\n\n /**\n * Determines whether the given day is explicitly included in the schedule.\n *\n * @param day The day to test.\n * @param lookAtTime lookAtTime If the specific time of the given day should\n * be looked at.\n * @returns `true` if the day is NOT explicitly included, otherwise `false`.\n */\n public isIncluded(day: Day, lookAtTime: boolean = true): boolean\n {\n return this.include.get( day, false, lookAtTime );\n }\n\n /**\n * Determines whether the given day is cancelled in the schedule.\n *\n * @param day The day to test.\n * @param lookAtTime lookAtTime If the specific time of the given day should\n * be looked at.\n * @returns `true` if the day was cancelled, otherwise `false`.\n */\n public isCancelled(day: Day, lookAtTime: boolean = true): boolean\n {\n return this.cancel.get( day, false, lookAtTime );\n }\n\n /**\n * Returns the metadata for the given day or `null` if there is none.\n *\n * @param day The day to return the metadata for.\n * @param otherwise The data to return if none exists for the given day.\n * @param lookAtTime lookAtTime If the specific time of the given day should\n * be looked at.\n * @returns The metadata or `null`.\n */\n public getMeta(day: Day, otherwise: M = null, lookAtTime: boolean = true): M\n {\n return this.meta.get( day, otherwise, lookAtTime );\n }\n\n /**\n * Returns all metadata for the given day or an empty array if there is none.\n *\n * @param day The day to return the metadata for.\n * @returns The array of metadata ordered by priority or an empty array.\n */\n public getMetas(day: Day): M[]\n {\n return this.meta.getAll( day );\n }\n\n /**\n * Returns whether the events in the schedule are all day long or start at\n * specific times. Full day events start at the start of the day and end at\n * the start of the next day (if the duration = `1` and durationUnit = 'days').\n * Full day events have no times specified and should have a durationUnit of\n * either `days` or `weeks`.\n */\n public isFullDay(): boolean\n {\n return this.times.length === 0;\n }\n\n /**\n * Returns a span of time for a schedule with full day events starting on the\n * start of the given day with the desired duration in days or weeks.\n *\n * @param day The day the span starts on.\n * @returns The span of time starting on the given day.\n */\n public getFullSpan(day: Day): DaySpan\n {\n let start: Day = day.start();\n let end: Day = start.add( this.duration, this.durationUnit );\n\n return new DaySpan( start, end );\n }\n\n /**\n * Returns a span of time starting on the given day at the given day with the\n * duration specified on this schedule.\n *\n * @param day The day the span starts on.\n * @param time The time of day the span starts.\n * @returns The span of time calculated.\n */\n public getTimeSpan(day: Day, time: Time): DaySpan\n {\n let start: Day = day.withTime( time );\n let end: Day = start.add( this.duration, this.durationUnit );\n\n return new DaySpan( start, end );\n }\n\n /**\n * Determines whether the given day is a day on the schedule for the start\n * of an event. If an event is more than one day and the day given is not the\n * start this may return `false`. This does not test for event instances\n * that exist through [[Schedule.include]].\n *\n * @param day The day to test.\n * @returns `true` if the day marks the start of an event on the schedule.\n * @see [[Schedule.isIncluded]]\n * @see [[Schedule.isFullyExcluded]]\n * @see [[Schedule.matchesSpan]]\n */\n public matchesDay(day: Day): boolean\n {\n if (this.isIncluded( day, false ))\n {\n return true;\n }\n\n if (!this.matchesSpan( day ) || this.isFullyExcluded( day ))\n {\n return false;\n }\n\n for (let check of this.checks)\n {\n if (!check( day[ check.property ] ))\n {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Determines whether the given day has events added through\n * [[Schedule.include]].\n *\n * @param day The day to look for included times on.\n * @returns `true` if there are included event instances on the given day,\n * otherwise `false`.\n */\n public hasIncludedTime(day: Day): boolean\n {\n return !this.iterateIncludeTimes( day ).isEmpty();\n }\n\n /**\n * Determines whether the given day is fully excluded from the schedule. A\n * fully excluded day is one that has a day-wide exclusion, or the schedule\n * is not an all-day event and all times in the schedule are specifically\n * excluded.\n *\n * @param day The day to test.*\n * @returns `true` if he day is fully excluded, otherwise `false`.\n */\n public isFullyExcluded(day: Day): boolean\n {\n if (this.isExcluded(day, false))\n {\n return true;\n }\n\n if (this.isFullDay())\n {\n return false;\n }\n\n for (let time of this.times)\n {\n if (!this.isExcluded( day.withTime( time ) ))\n {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Finds the next day an event occurs on the schedule given a day to start,\n * optionally including it, and a maximum number of days to look ahead.\n *\n * @param day The day to start to search from.\n * @param includeDay If the given day should be included in the search.\n * @param lookAhead The maximum number of days to look ahead from the given\n * day for event occurrences.\n * @returns The next day on the schedule or `null` if none exists.\n */\n public nextDay(day: Day, includeDay: boolean = false, lookAhead: number = 366): Day\n {\n return this.iterateDaycast(day, 1, true, includeDay, lookAhead).first();\n }\n\n /**\n * Finds the next specified number of days that events occur on the schedule\n * given a day to start, optionally including it, and a maximum number of days\n * to look ahead.\n *\n * @param day The day to start to search from.\n * @param max The maximum number of days to return in the result.\n * @param includeDay If the given day should be included in the search.\n * @param lookAhead The maximum number of days to look ahead from the given\n * day for event occurrences.\n * @returns An array containing the next days on the schedule that events\n * start or an empty array if there are none.\n */\n public nextDays(day: Day, max: number, includeDay: boolean = false, lookAhead: number = 366): Iterator\n {\n return this.iterateDaycast(day, max, true, includeDay, lookAhead);\n }\n\n /**\n * Finds the previous day an event occurs on the schedule given a day to start,\n * optionally including it, and a maximum number of days to look behind.\n *\n * @param day The day to start to search from.\n * @param includeDay If the given day should be included in the search.\n * @param lookBack The maximum number of days to look behind from the given\n * day for event occurrences.\n * @returns The previous day on the schedule or `null` if none exists.\n */\n public prevDay(day: Day, includeDay: boolean = false, lookBack: number = 366): Day\n {\n return this.iterateDaycast(day, 1, false, includeDay, lookBack).first();\n }\n\n /**\n * Finds the previous specified number of days that events occur on the\n * schedule given a day to start, optionally including it, and a maximum\n * number of days to look behind.\n *\n * @param day The day to start to search from.\n * @param max The maximum number of days to return in the result.\n * @param includeDay If the given day should be included in the search.\n * @param lookAhead The maximum number of days to look behind from the given\n * day for event occurrences.\n * @returns An array containing the previous days on the schedule that events\n * start or an empty array if there are none.\n */\n public prevDays(day: Day, max: number, includeDay: boolean = false, lookBack: number = 366): Iterator\n {\n return this.iterateDaycast(day, max, false, includeDay, lookBack);\n }\n\n /**\n * Iterates over days that events start in the schedule given a day to start,\n * a maximum number of days to find, and a direction to look.\n *\n * @param day The day to start to search from.\n * @param max The maximum number of days to iterate.\n * @param next If `true` this searches forward, otherwise `false` is backwards.\n * @param includeDay If the given day should be included in the search.\n * @param lookup The maximum number of days to look through from the given\n * day for event occurrences.\n * @returns A new Iterator for the days found in the cast.\n * @see [[Schedule.iterateSpans]]\n */\n public iterateDaycast(day: Day, max: number, next: boolean, includeDay: boolean = false, lookup: number = 366): Iterator\n {\n return new Iterator(iterator =>\n {\n let iterated: number = 0;\n\n for (let days = 0; days < lookup; days++)\n {\n if (!includeDay || days > 0)\n {\n day = next ? day.next() : day.prev();\n }\n\n if (!this.iterateSpans( day, false ).isEmpty())\n {\n let action: IteratorAction = iterator.act( day );\n\n if (action === IteratorAction.Stop || ++iterated >= max)\n {\n return;\n }\n }\n }\n });\n }\n\n /**\n * Iterates through the spans (event instances) that start on or covers the\n * given day.\n *\n * @param day The day to look for spans on.\n * @param covers If `true` spans which span multiple days will be looked at\n * to see if they intersect with the given day, otherwise `false` will\n * only look at the given day for the start of events.\n * @returns A new Iterator for all the spans found.\n */\n public iterateSpans(day: Day, covers: boolean = false): Iterator\n {\n return new Iterator(iterator =>\n {\n let current: Day = day;\n let lookBehind: number = covers ? this.durationInDays : 0;\n\n // If the events start at the end of the day and may last multiple days....\n if (this.isFullDay())\n {\n // If the schedule has events which span multiple days we need to look\n // backwards for events that overlap with the given day.\n while (lookBehind >= 0)\n {\n // If the current day matches the schedule rules...\n if (this.matchesDay( current ))\n {\n // Build a DaySpan with the given start day and the schedules duration.\n let span: DaySpan = this.getFullSpan( current );\n\n // If that dayspan intersects with the given day, it's a winner!\n if (span.matchesDay( day ))\n {\n switch (iterator.act( span ))\n {\n case IteratorAction.Stop:\n return;\n }\n }\n }\n\n current = current.prev();\n lookBehind--;\n }\n }\n // This schedule has events which start at certain times\n else\n {\n // If the schedule has events which span multiple days we need to look\n // backwards for events that overlap with the given day.\n while (lookBehind >= 0)\n {\n // If the current day matches the schedule rules...\n if (this.matchesDay( current ))\n {\n // Iterate through each daily occurrence in the schedule...\n for (let time of this.times)\n {\n let span: DaySpan = this.getTimeSpan( current, time );\n\n // If the event intersects with the given day and the occurrence\n // has not specifically been excluded...\n if (span.matchesDay( day ) && !this.isExcluded( span.start, true ))\n {\n switch (iterator.act( span ))\n {\n case IteratorAction.Stop:\n return;\n }\n }\n }\n }\n else\n {\n // The current day does not match the schedule, however the schedule\n // might have moved/random event occurrents on the current day.\n // We only want the ones that overlap with the given day.\n this.iterateIncludeTimes(current, day).iterate((span, timeIterator) =>\n {\n switch (iterator.act( span ))\n {\n case IteratorAction.Stop:\n timeIterator.stop();\n break;\n }\n })\n\n if (iterator.action === IteratorAction.Stop)\n {\n return;\n }\n }\n\n current = current.prev();\n lookBehind--;\n }\n }\n });\n }\n\n /**\n * Determines if the given day is on the schedule and the time specified on\n * the day matches one of the times on the schedule.\n *\n * @param day The day to test.\n * @returns `true` if the day and time match the schedule, otherwise false.\n */\n public matchesTime(day: Day): boolean\n {\n return !!this.iterateSpans( day, true ).first( span => span.start.sameMinute( day ) );\n }\n\n /**\n * Determines if the given day is covered by this schedule. A schedule can\n * specify events that span multiple days - so even though the day does not\n * match the starting day of a span - it can be a day that is within the\n * schedule.\n *\n * @param day The day to test.\n * @returns `true` if the day is covered by an event on this schedule,\n * otherwise `false`.\n */\n public coversDay(day: Day): boolean\n {\n return !this.iterateSpans( day, true ).isEmpty();\n }\n\n /**\n * Determines if the given timestamp lies in an event occurrence on this\n * schedule.\n *\n * @param day The timestamp to test against the schedule.\n * @return `true` if the timestamp lies in an event occurrent start and end\n * timestamps, otherwise `false`.\n */\n public coversTime(day: Day): boolean\n {\n return !!this.iterateSpans( day, true ).first( span => span.contains( day ) );\n }\n\n /**\n * Changes the exclusion status of the event at the given time. By default\n * this excludes this event - but `false` may be passed to undo an exclusion.\n *\n * @param time The start time of the event occurrence to exclude or include.\n * @param excluded Whether the event should be excluded.\n */\n public setExcluded(time: Day, excluded: boolean = true): this\n {\n let type: Identifier = this.identifierType;\n\n this.exclude.set( time, excluded, type );\n this.include.set( time, !excluded, type );\n\n return this;\n }\n\n /**\n * Changes the cancellation status of the event at the given start time. By\n * default this cancels the event occurrence - but `false` may be passed to\n * undo a cancellation.\n *\n * @param time The start time of the event occurrence to cancel or uncancel.\n * @param cancelled Whether the event should be cancelled.\n */\n public setCancelled(time: Day, cancelled: boolean = true): this\n {\n this.cancel.set( time, cancelled, this.identifierType );\n\n return this;\n }\n\n /**\n * Moves the event instance starting at `fromTime` to `toTime` optionally\n * placing `meta` in the schedules metadata for the new time `toTime`.\n * If this schedule has a single event ([[Schedule.isSingleEvent]]) then the\n * only value needed is `toTime` and not `fromTime`.\n *\n * @param toTime The timestamp of the new event.\n * @param fromTime The timestamp of the event on the schedule to move if this\n * schedule generates multiple events.\n * @param meta The metadata to place in the schedule for the given `toTime`.\n * @returns `true` if the schedule had the event moved, otherwise `false`.\n */\n public move(toTime: Day, fromTime?: Day, meta?: M): boolean\n {\n if (!this.moveSingleEvent( toTime ) && fromTime)\n {\n return this.moveInstance( fromTime, toTime, meta );\n }\n\n return false;\n }\n\n /**\n * Moves the event instance starting at `fromTime` to `toTime` optionally\n * placing `meta` in the schedules metadata for the new time `toTime`. A move\n * is accomplished by excluding the current event and adding an inclusion of\n * the new day & time.\n *\n * @param fromTime The timestamp of the event on the schedule to move.\n * @param toTime The timestamp of the new event.\n * @param meta The metadata to place in the schedule for the given `toTime`.\n * @returns `true`.\n * @see [[Schedule.move]]\n */\n public moveInstance(fromTime: Day, toTime: Day, meta?: M): boolean\n {\n let type: Identifier = this.identifierType;\n\n this.exclude.set( fromTime, true, type );\n this.exclude.set( toTime, false, type );\n\n this.include.set( toTime, true, type );\n this.include.set( fromTime, false, type );\n\n if (fn.isValue( meta ))\n {\n this.meta.unset( fromTime, type );\n this.meta.set( toTime, meta, type );\n }\n\n return true;\n }\n\n /**\n * Moves the single event in this schedule to the given day/time if applicable.\n * If this schedule is not a single event schedule then `false` is returned.\n * If this schedule is a timed event the time will take the time of the given\n * `toTime` of `takeTime` is `true`.\n *\n * @param toTime The time to move the single event to.\n * @param takeTime If this schedule has a single timed event, should the time\n * of the event be changed to the time of the given `toTime`?\n * @returns `true` if the schedule was adjusted, otherwise `false`.\n * @see [[Schedule.move]]\n */\n public moveSingleEvent(toTime: Day, takeTime: boolean = true): boolean\n {\n if (!this.isSingleEvent())\n {\n return false;\n }\n\n for (let check of this.checks)\n {\n let prop: DayProperty = check.property;\n let value = toTime[ prop ];\n let frequency: FrequencyCheck = Parse.frequency( [value], prop );\n\n this[ prop ] = frequency;\n }\n\n if (this.times.length === 1 && takeTime)\n {\n this.times[ 0 ] = toTime.asTime();\n }\n\n this.updateChecks();\n\n let span: DaySpan = this.getSingleEventSpan();\n\n if (this.start)\n {\n this.start = span.start.start();\n }\n\n if (this.end)\n {\n this.end = span.end.end();\n }\n\n return true;\n }\n\n /**\n * Returns the span of the single event in this schedule if it's that type of\n * schedule, otherwise `null` is returned.\n *\n * @returns A span of the single event, otherwise `null`.\n * @see [[Schedule.isSingleEvent]]\n */\n public getSingleEventSpan(): DaySpan\n {\n if (!this.isSingleEvent())\n {\n return null;\n }\n\n let startOfYear: Day = Day.build( this.year.input[0], 0, 1 );\n let start: Day = this.iterateDaycast( startOfYear, 1, true, true, 366 ).first();\n\n if (!start)\n {\n return null;\n }\n\n return this.isFullDay() ?\n this.getFullSpan( start ) :\n this.getTimeSpan( start, this.times[ 0 ] );\n }\n\n /**\n * Determines whether this schedule produces a single event, and no more.\n * If this schedule has any includes, it's assumed to be a multiple event\n * schedule. A single event can be detected in the following scenarios where\n * each frequency has a single occurrence (see [[Schedule.isSingleFrequency]]).\n *\n * - year, day of year\n * - year, month, day of month\n * - year, month, week of month, day of week\n * - year, week of year, day of week\n *\n * @returns `true` if this schedule produces a single event, otherwise `false`.\n */\n public isSingleEvent(): boolean\n {\n // 0 = full day, 1 = once a day, 1+ = multiple events a day\n if (this.times.length > 1)\n {\n return false;\n }\n\n // Let's assume if there are includes, this is not a single event.\n if (!this.include.isEmpty())\n {\n return false;\n }\n\n // If this can occur on multiple years, not a single event.\n if (!this.isSingleYear())\n {\n return false;\n }\n\n // If this is a specific year and day of the year: single!\n if (this.isSingleDayOfYear())\n {\n return true;\n }\n\n // If this is a specific year, month, and day of month: single!\n if (this.isSingleMonth() && this.isSingleDayOfMonth())\n {\n return true;\n }\n\n // If this is a specific year, month, week of the month, day of the week: single!\n if (this.isSingleMonth() && this.isSingleWeekOfMonth() && this.isSingleDayOfWeek())\n {\n return true;\n }\n\n // If this is a specific year, week of the year, day of the week: single!\n if (this.isSingleWeekOfYear() && this.isSingleDayOfWeek())\n {\n return true;\n }\n\n // Doesn't look like a single event.\n return false;\n }\n\n /**\n * @returns `true` if this schedule produces events only in a specific year.\n * @see [[Schedule.year]]\n */\n public isSingleYear(): boolean\n {\n return this.isSingleFrequency( this.year );\n }\n\n /**\n * @returns `true` if this schedule produces events only in a specific month.\n * @see [[Schedule.month]]\n */\n public isSingleMonth(): boolean\n {\n return this.isSingleFrequency( this.month );\n }\n\n /**\n * @returns `true` if this schedule produces events only in a specific day of\n * the month.\n * @see [[Schedule.dayOfMonth]]\n * @see [[Schedule.lastDayOfMonth]]\n */\n public isSingleDayOfMonth(): boolean\n {\n return this.isSingleFrequency( this.dayOfMonth ) ||\n this.isSingleFrequency( this.lastDayOfMonth );\n }\n\n /**\n * @returns `true` if this schedule produces events only in a specific day of\n * the week.\n * @see [[Schedule.dayOfWeek]]\n */\n public isSingleDayOfWeek(): boolean\n {\n return this.isSingleFrequency( this.dayOfWeek );\n }\n\n /**\n * @returns `true` if this schedule produces events only in a specific day of\n * the year.\n * @see [[Schedule.dayOfYear]]\n */\n public isSingleDayOfYear(): boolean\n {\n return this.isSingleFrequency( this.dayOfYear );\n }\n\n /**\n * @returns `true` if this schedule produces events only in a specific week of\n * the month.\n * @see [[Schedule.weekspanOfMonth]]\n * @see [[Schedule.fullWeekOfMonth]]\n * @see [[Schedule.weekOfMonth]]\n * @see [[Schedule.lastFullWeekOfMonth]]\n * @see [[Schedule.lastWeekspanOfMonth]]\n */\n public isSingleWeekOfMonth(): boolean\n {\n return this.isSingleFrequency( this.weekspanOfMonth ) ||\n this.isSingleFrequency( this.fullWeekOfMonth ) ||\n this.isSingleFrequency( this.weekOfMonth ) ||\n this.isSingleFrequency( this.lastFullWeekOfMonth ) ||\n this.isSingleFrequency( this.lastWeekspanOfMonth );\n }\n\n /**\n * @returns `true` if this schedule produces events only in a specific week of\n * the year.\n * @see [[Schedule.weekspanOfYear]]\n * @see [[Schedule.fullWeekOfYear]]\n * @see [[Schedule.week]]\n * @see [[Schedule.weekOfYear]]\n * @see [[Schedule.lastFullWeekOfYear]]\n * @see [[Schedule.lastWeekspanOfYear]]\n */\n public isSingleWeekOfYear(): boolean\n {\n return this.isSingleFrequency( this.weekspanOfYear ) ||\n this.isSingleFrequency( this.fullWeekOfYear ) ||\n this.isSingleFrequency( this.week ) ||\n this.isSingleFrequency( this.weekOfYear ) ||\n this.isSingleFrequency( this.lastFullWeekOfYear ) ||\n this.isSingleFrequency( this.lastWeekspanOfYear );\n }\n\n /**\n * Determines if the given [[FrequencyCheck]] results in a single occurrence.\n *\n * @returns `true` if the frequency results in a single event, otherwise `false`.\n */\n public isSingleFrequency(frequency: FrequencyCheck): boolean\n {\n return fn.isArray( frequency.input ) && (frequency.input).length === 1;\n }\n\n /**\n * Creates a forecast for this schedule which returns a number of event\n * occurrences around a given day. A single item could be returned per day, or\n * you could get an item for each timed event occurrence.\n *\n * @param around The day to find a forecast around.\n * @param covers If `true` spans which span multiple days will be looked at\n * to see if they intersect with the given day, otherwise `false` will\n * only look at the given day for the start of events.\n * @param daysAfter The number of events to return before the given day.\n * @param daysBefore The number of events to return after the given day.\n * @param times If timed events should be returned, or only one for each day.\n * @param lookAround How many days to look before and after the given day for\n * event occurrences.\n * @returns A new iterator which provides the event occurence span, the day it\n * starts (or is covered if `covers` is `true`), and the identifier for the\n * event.\n */\n public forecast(around: Day,\n covers: boolean = true,\n daysAfter: number,\n daysBefore: number = daysAfter,\n times: boolean = false,\n lookAround: number = 366): Iterator\n {\n let type: Identifier = this.identifierType;\n\n let tuplesForDay = (day: Day, tuples: Iterator): boolean =>\n {\n let spans: DaySpan[] = this.iterateSpans( day, covers ).list();\n let last: number = times ? spans.length : Math.min( 1, spans.length );\n let offset: number = times ? 0 : spans.length - 1;\n\n for (let i = 0; i < last; i++)\n {\n let span: DaySpan = spans[ i + offset ];\n let id: IdentifierInput = type.get( span.start );\n\n if (tuples.act( [ span, day, id ] ) === IteratorAction.Stop)\n {\n return false;\n }\n }\n\n return true;\n };\n\n let prev = new Iterator(iterator =>\n {\n let curr: Day = around;\n\n for (let i = 0; i < lookAround; i++)\n {\n if (!tuplesForDay( curr, iterator ))\n {\n break;\n }\n\n curr = curr.prev();\n }\n });\n\n let next = new Iterator(iterator =>\n {\n let curr: Day = around;\n\n for (let i = 0; i < lookAround; i++)\n {\n curr = curr.next();\n\n if (!tuplesForDay( curr, iterator ))\n {\n break;\n }\n }\n });\n\n return prev.take( daysBefore + 1 ).reverse().append( next.take( daysAfter ) );\n }\n\n /**\n * Iterates timed events that were explicitly specified on the given day.\n * Those events could span multiple days so may be tested against another day.\n *\n * @param day The day to look for included timed events.\n * @param matchAgainst The day to test against the timed event.\n * @returns A new Iterator for all the included spans found.\n */\n public iterateIncludeTimes(day: Day, matchAgainst: Day = day): Iterator\n {\n let isIncludedTime = (result: [IdentifierInput, boolean]) =>\n {\n let [id, included] = result;\n\n return included && Identifier.Time.is( id );\n };\n\n let getSpan = (result: [IdentifierInput, boolean]) =>\n {\n let [id] = result;\n let time: Day = Identifier.Time.start( id );\n let span: DaySpan = this.getTimeSpan( time, time.asTime() );\n\n if (span.matchesDay( matchAgainst ))\n {\n return span;\n }\n };\n\n return this.include.query( day.dayIdentifier ).map( getSpan, isIncludedTime );\n }\n\n /**\n * Converts the schedule instance back into input.\n *\n * @param returnDays When `true` the start, end, and array of exclusions will\n * have [[Day]] instances, otherwise the UTC timestamp and dayIdentifiers\n * will be used when `false`.\n * @param returnTimes When `true` the times returned in the input will be\n * instances of [[Time]] otherwise the `timeFormat` is used to convert the\n * times to strings.\n * @param timeFormat The time format to use when returning the times as strings.\n * @param alwaysDuration If the duration values (`duration` and\n * `durationUnit`) should always be returned in the input.\n * @returns The input that describes this schedule.\n * @see [[Schedule.getExclusions]]\n * @see [[Time.format]]\n */\n public toInput(returnDays: boolean = false, returnTimes: boolean = false, timeFormat: string = '', alwaysDuration: boolean = false): ScheduleInput\n {\n let defaultUnit: string = Constants.DURATION_DEFAULT_UNIT( this.isFullDay() );\n let exclusions: IdentifierInput[] = this.exclude.identifiers(v => v).list();\n let inclusions: IdentifierInput[] = this.include.identifiers(v => v).list();\n let cancels: IdentifierInput[] = this.cancel.identifiers(v => v).list();\n let hasMeta: boolean = !this.meta.isEmpty();\n let out: ScheduleInput = {};\n let times: TimeInput[] = [];\n\n for (let time of this.times)\n {\n times.push( returnTimes ? time : (timeFormat ? time.format( timeFormat ) : time.toString()) );\n }\n\n if (this.start) out.start = returnDays ? this.start : this.start.time;\n if (this.end) out.end = returnDays ? this.end : this.end.time;\n if (times.length) out.times = times;\n if (alwaysDuration || this.duration !== Constants.DURATION_DEFAULT) out.duration = this.duration;\n if (alwaysDuration || this.durationUnit !== defaultUnit) out.durationUnit = this.durationUnit;\n if (exclusions.length) out.exclude = exclusions;\n if (inclusions.length) out.include = inclusions;\n if (cancels.length) out.cancel = cancels;\n if (hasMeta) out.meta = this.meta.map;\n if (this.dayOfWeek.input) out.dayOfWeek = this.dayOfWeek.input;\n if (this.dayOfMonth.input) out.dayOfMonth = this.dayOfMonth.input;\n if (this.lastDayOfMonth.input) out.lastDayOfMonth = this.lastDayOfMonth.input;\n if (this.dayOfYear.input) out.dayOfYear = this.dayOfYear.input;\n if (this.year.input) out.year = this.year.input;\n if (this.month.input) out.month = this.month.input;\n if (this.week.input) out.week = this.week.input;\n if (this.weekOfYear.input) out.weekOfYear = this.weekOfYear.input;\n if (this.weekspanOfYear.input) out.weekspanOfYear = this.weekspanOfYear.input;\n if (this.fullWeekOfYear.input) out.fullWeekOfYear = this.fullWeekOfYear.input;\n if (this.lastWeekspanOfYear.input) out.lastWeekspanOfYear = this.lastWeekspanOfYear.input;\n if (this.lastFullWeekOfYear.input) out.lastFullWeekOfYear = this.lastFullWeekOfYear.input;\n if (this.weekOfMonth.input) out.weekOfMonth = this.weekOfMonth.input;\n if (this.weekspanOfMonth.input) out.weekspanOfMonth = this.weekspanOfMonth.input;\n if (this.fullWeekOfMonth.input) out.fullWeekOfMonth = this.fullWeekOfMonth.input;\n if (this.lastWeekspanOfMonth.input) out.lastWeekspanOfMonth = this.lastWeekspanOfMonth.input;\n if (this.lastFullWeekOfMonth.input) out.lastFullWeekOfMonth = this.lastFullWeekOfMonth.input;\n\n return out;\n }\n\n /**\n * Describes the schedule in a human friendly string taking into account all\n * possible values specified in this schedule.\n *\n * @param thing A brief description of the things (events) on the schedule.\n * @param includeRange When `true` the [[Schedule.start]] and [[Schedule.end]]\n * are possibly included in the description if they have values.\n * @param includeTimes When `true` the [[Schedule.times]] are possibly included\n * in the description.\n * @param includeDuration When `true` the [[Schedule.duration]] and\n * [[Schedule.durationUnit]] are added to the description if\n * [[Schedule.duration]] is not equal to `1`.\n * @param includeExcludes When `true` the [[Schedule.exclude]] are added\n * to the description if there are any.\n * @param includeIncludes When `true` the [[Schedule.include]] are added\n * to the description if there are any.\n * @param includeCancels When `true` the [[Schedule.cancel]] are added\n * to the description if there are any.\n * @returns The descroption of the schedule.\n */\n public describe(thing: string = 'event',\n includeRange: boolean = true,\n includeTimes: boolean = true,\n includeDuration: boolean = false,\n includeExcludes: boolean = false,\n includeIncludes: boolean = false,\n includeCancels: boolean = false): string\n {\n let out: string = '';\n\n if (includeRange)\n {\n if (this.start)\n {\n out += 'Starting on ' + this.start.format('dddd Do, YYYY');\n\n if (this.end)\n {\n out += ' and ending on ' + this.end.format('dddd Do, YYYY');\n }\n }\n else if (this.end)\n {\n out += 'Up until ' + this.end.format('dddd Do, YYYY');\n }\n }\n\n if (out)\n {\n out += ' the ' + thing + ' will occur';\n }\n else\n {\n out += 'The ' + thing + ' will occur';\n }\n\n out += this.describeRule( this.dayOfWeek.input, 'day of the week', x => moment.weekdays()[x], 1, false);\n out += this.describeRule( this.lastDayOfMonth.input, 'last day of the month', x => Suffix.CACHE[x] );\n out += this.describeRule( this.dayOfMonth.input, 'day of the month', x => Suffix.CACHE[x] );\n out += this.describeRule( this.dayOfYear.input, 'day of the year', x => Suffix.CACHE[x], 1 );\n out += this.describeRule( this.year.input, 'year', x => x, 0, false, ' in ' );\n out += this.describeRule( this.month.input, 'month', x => moment.months()[x], 0, false, ' in ' );\n out += this.describeRule( this.weekOfYear.input, 'week of the year', x => Suffix.CACHE[x] );\n out += this.describeRule( this.weekspanOfYear.input, 'weekspan of the year', x => Suffix.CACHE[x + 1], 1 );\n out += this.describeRule( this.fullWeekOfYear.input, 'full week of the year', x => Suffix.CACHE[x] );\n out += this.describeRule( this.lastWeekspanOfYear.input, 'last weekspan of the year', x => Suffix.CACHE[x + 1], 1 );\n out += this.describeRule( this.lastFullWeekOfYear.input, 'last full week of the year', x => Suffix.CACHE[x] );\n out += this.describeRule( this.weekOfMonth.input, 'week of the month', x => Suffix.CACHE[x] );\n out += this.describeRule( this.fullWeekOfMonth.input, 'full week of the month', x => Suffix.CACHE[x] );\n out += this.describeRule( this.weekspanOfMonth.input, 'weekspan of the month', x => Suffix.CACHE[x + 1], 1 );\n out += this.describeRule( this.lastFullWeekOfMonth.input, 'last full week of the month', x => Suffix.CACHE[x] );\n out += this.describeRule( this.lastWeekspanOfMonth.input, 'last weekspan of the month', x => Suffix.CACHE[x + 1], 1 );\n\n if (includeTimes && this.times.length)\n {\n out += ' at ';\n out += this.describeArray( this.times, x => x.format('hh:mm a') );\n }\n\n if (includeDuration && this.duration !== Constants.DURATION_DEFAULT)\n {\n out += ' lasting ' + this.duration + ' ';\n\n if (this.durationUnit)\n {\n out += this.durationUnit + ' ';\n }\n }\n\n if (includeExcludes)\n {\n let excludes: ScheduleModifierSpan[] = this.exclude.spans().list();\n\n if (excludes.length)\n {\n out += ' excluding ';\n out += this.describeArray( excludes, x => x.span.summary(Units.DAY) );\n }\n }\n\n if (includeIncludes)\n {\n let includes: ScheduleModifierSpan[] = this.include.spans().list();\n\n if (includes.length)\n {\n out += ' including ';\n out += this.describeArray( includes, x => x.span.summary(Units.DAY) );\n }\n }\n\n if (includeCancels)\n {\n let cancels: ScheduleModifierSpan[] = this.cancel.spans().list();\n\n if (cancels.length)\n {\n out += ' with cancellations on ';\n out += this.describeArray( cancels, x => x.span.summary(Units.DAY) );\n }\n }\n\n return out;\n }\n\n /**\n * Describes the given frequency.\n *\n * @param value The frequency to describe.\n * @param unit The unit of the frequency.\n * @param map How the values in the frequency should be described.\n * @param everyOffset A value to add to a [[FrequencyValueEvery]] offset to\n * account for zero-based values that should be shifted for human\n * friendliness.\n * @param the If the word 'the' should be used to describe the unit.\n * @param on The word which preceeds values of the given unit.\n * @param required If the description should always return a non-empty string\n * even if the frequency was not specified in the original input.\n * @returns A string description of the frequency.\n */\n private describeRule(value: FrequencyValue, unit: string, map: (x: number) => any, everyOffset: number = 0, the: boolean = true, on: string = ' on ', required: boolean = false): string\n {\n let out: string = '';\n let suffix: string = the ? ' ' + unit : '';\n\n if (fn.isFrequencyValueEvery(value))\n {\n let valueEvery: FrequencyValueEvery = value;\n\n out += ' every ' + Suffix.CACHE[ valueEvery.every ] + ' ' + unit;\n\n if (valueEvery.offset)\n {\n out += ' starting at ' + map( valueEvery.offset + everyOffset ) + suffix;\n }\n }\n else if (fn.isFrequencyValueOneOf(value))\n {\n let valueOne: FrequencyValueOneOf = value;\n\n if (valueOne.length)\n {\n out += on + (the ? 'the ' : '');\n out += this.describeArray( valueOne, map );\n out += suffix;\n }\n }\n else if (required)\n {\n out += on + 'any ' + unit;\n }\n\n return out;\n }\n\n /**\n * Describes the array by adding commas where appropriate and 'and' before the\n * last value of the array (if its more than `1`).\n *\n * @param array The array of items to describe.\n * @param map The function which converts an item to a string.\n * @returns The final description of the array items.\n */\n private describeArray(array: T[], map: (item: T) => string): string\n {\n let out: string = '';\n let last: number = array.length - 1;\n\n out += map( array[ 0 ] );\n\n for (let i = 1; i < last; i++)\n {\n out += ', ' + map( array[ i ] );\n }\n\n if (last > 0)\n {\n out += ' and ' + map( array[ last ] );\n }\n\n return out;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Schedule.ts","\nimport { Schedule, ScheduleInput } from './Schedule';\n\n/**\n * The input which can be passed to the calendar when adding a schedule and event.\n *\n * @typeparam T The type of data stored in the [[Event]] class.\n * @typeparam M The type of metadata stored in the schedule.\n */\nexport interface EventInput\n{\n id?: any;\n data?: T;\n schedule: ScheduleInput | Schedule;\n}\n\n/**\n * A pairing of a user specified event object and the schedule which defines\n * when it occurs on a calendar.\n *\n * @typeparam T The type of data stored in the [[Event]] class.\n * @typeparam M The type of metadata stored in the schedule.\n */\nexport class Event\n{\n\n /**\n * User specified ID which can be used to find or remove this event from a\n * Calendar.\n */\n public id: any;\n\n /**\n * User specified object which describes this event.\n */\n public data: T;\n\n /**\n * The schedule which defines when this event occurs.\n */\n public schedule: Schedule;\n\n /**\n * If the event is visible on the calendar.\n */\n public visible: boolean;\n\n /**\n * Creates a new event.\n *\n * @param schedule The schedule which defines when the event occurs.\n * @param data User specified object which describes this event.\n * @param id User specified ID which identifies this event.\n */\n public constructor(schedule: Schedule, data?: T, id?: any, visible: boolean = true)\n {\n this.schedule = schedule;\n this.data = data;\n this.id = id;\n this.visible = visible;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Event.ts","\nimport { Functions as fn } from './Functions';\nimport { Constants } from './Constants';\nimport { Parse } from './Parse';\n\n\n/**\n * A value that can possibly be parsed into a Time instance.\n *\n * @see [[Time.parse]]\n */\nexport type TimeInput = Time | number | string | {hour: number, minute?: number, second?: number, millisecond?: number};\n\n/**\n * A class which holds a specific time during in any day.\n */\nexport class Time\n{\n\n /**\n * The regular expression used to parse a time from a string.\n *\n * - ## = hour\n * - ##:## = hour & minute\n * - ##:##:## = hour, minute, & second\n * - ##:##:##.### = hour, minute, second, and milliseconds\n */\n public static REGEX = /^(\\d\\d?):?(\\d\\d)?:?(\\d\\d)?\\.?(\\d\\d\\d)?$/;\n\n /**\n * The hour between 0 and 23\n */\n public hour: number;\n\n /**\n * The minute between 0 and 59\n */\n public minute: number;\n\n /**\n * The second between 0 and 59\n */\n public second: number;\n\n /**\n * The millisecond between 0 and 999\n */\n public millisecond: number;\n\n\n /**\n * Creates a new Time instance given an hour and optionally a minute, second,\n * and millisecond. If they have not been specified they default to 0.\n *\n * @param hour The hour.\n * @param minute The minute.\n * @param second The second.\n * @param millisecond The millisecond.\n */\n public constructor(hour: number, minute: number = Constants.MINUTE_MIN, second: number = Constants.SECOND_MIN, millisecond: number = Constants.MILLIS_MIN)\n {\n this.hour = hour;\n this.minute = minute;\n this.second = second;\n this.millisecond = millisecond;\n }\n\n /**\n * Formats this time into a string. The following list describes the available\n * formatting patterns:\n *\n * ### Hour\n * - H: 0-23\n * - HH: 00-23\n * - h: 12,1-12,1-11\n * - hh: 12,01-12,01-11\n * - k: 1-24\n * - kk: 01-24\n * - a: am,pm\n * - A: AM,PM\n * ### Minute\n * - m: 0-59\n * - mm: 00-59\n * ### Second\n * - s: 0-59\n * - ss: 00-59\n * ### Millisecond\n * - S: 0-9\n * - SS: 00-99\n * - SSS: 000-999\n *\n * @param format The format to output.\n * @returns The formatted time.\n */\n public format(format: string): string\n {\n let formatterEntries = Time.FORMATTERS;\n let out: string = '';\n\n for (let i = 0; i < format.length; i++)\n {\n let handled: boolean = false;\n\n for (let k = 0; k < formatterEntries.length && !handled; k++)\n {\n let entry = formatterEntries[ k ];\n let part: string = format.substring( i, i + entry.size );\n\n if (part.length === entry.size)\n {\n let formatter = entry.formats[ part ];\n\n if (formatter)\n {\n out += formatter(this);\n i += entry.size - 1;\n handled = true;\n }\n }\n }\n\n if (!handled)\n {\n out += format.charAt(i);\n }\n }\n\n return out;\n }\n\n /**\n * @returns The number of milliseconds from the start of the day until this\n * time.\n */\n public toMilliseconds(): number\n {\n return this.hour * Constants.MILLIS_IN_HOUR +\n this.minute * Constants.MILLIS_IN_MINUTE +\n this.second * Constants.MILLIS_IN_SECOND +\n this.millisecond;\n }\n\n /**\n * @returns The time formatted using the smallest format that completely\n * represents this time.\n */\n public toString(): string\n {\n if (this.millisecond) return this.format('HH:mm:ss.SSS');\n if (this.second) return this.format('HH:mm:ss');\n if (this.minute) return this.format('HH:mm');\n\n return this.format('HH');\n }\n\n /**\n * @returns A unique identifier for this time. The number returned is in the\n * following format: SSSssmmHH\n */\n public toIdentifier(): number\n {\n return this.hour +\n this.minute * 100 +\n this.second * 10000 +\n this.millisecond * 10000000;\n }\n\n /**\n * @returns An object with hour, minute, second, a millisecond properties if\n * they are non-zero on this time.\n */\n public toObject(): TimeInput\n {\n let out: TimeInput = {\n hour: this.hour\n };\n\n if (this.minute) out.minute = this.minute;\n if (this.second) out.second = this.second;\n if (this.millisecond) out.millisecond = this.millisecond;\n\n return out;\n }\n\n /**\n * Parses a value and tries to convert it to a Time instance.\n *\n * @param input The input to parse.\n * @returns The instance parsed or `null` if it was invalid.\n * @see [[Parse.time]]\n */\n public static parse(input: any): Time\n {\n return Parse.time(input);\n }\n\n /**\n * Parses a string and converts it to a Time instance. If the string is not\n * in a valid format `null` is returned.\n *\n * @param time The string to parse.\n * @returns The instance parsed or `null` if it was invalid.\n * @see [[Time.REGEX]]\n */\n public static fromString(time: string): Time\n {\n let matches: string[] = this.REGEX.exec( time );\n\n if (!matches)\n {\n return null;\n }\n\n let h: number = parseInt(matches[1]) || 0;\n let m: number = parseInt(matches[2]) || 0;\n let s: number = parseInt(matches[3]) || 0;\n let l: number = parseInt(matches[4]) || 0;\n\n return this.build(h, m, s, l);\n }\n\n /**\n * Parses a number and converts it to a Time instance. The number is assumed\n * to be in the [[Time.toIdentifier]] format.\n *\n * @param time The number to parse.\n * @returns The instance parsed.\n */\n public static fromIdentifier(time: number): Time\n {\n let h: number = time % 100;\n let m: number = Math.floor(time / 100) % 100;\n let s: number = Math.floor(time / 10000) % 100;\n let l: number = Math.floor(time / 10000000) % 1000;\n\n return this.build(h, m, s, l);\n }\n\n /**\n * Returns a new instance given an hour and optionally a minute, second,\n * and millisecond. If they have not been specified they default to 0.\n *\n * @param hour The hour.\n * @param minute The minute.\n * @param second The second.\n * @param millisecond The millisecond.\n * @returns A new instance.\n */\n public static build(hour: number, minute: number = Constants.MINUTE_MIN, second: number = Constants.SECOND_MIN, millisecond: number = Constants.MILLIS_MIN): Time\n {\n return new Time(hour, minute, second, millisecond)\n }\n\n /**\n * A set of formatting functions keyed by their format string.\n */\n public static FORMATTERS = [\n {\n size: 3,\n formats: {\n SSS: (t: Time) => fn.padNumber(t.millisecond, 3)\n }\n },\n {\n size: 2,\n formats: {\n HH: (t: Time) => fn.padNumber(t.hour, 2),\n hh: (t: Time) => fn.padNumber((t.hour % 12) || 12, 2),\n kk: (t: Time) => fn.padNumber(t.hour + 1, 2),\n mm: (t: Time) => fn.padNumber(t.minute, 2),\n ss: (t: Time) => fn.padNumber(t.second, 2),\n SS: (t: Time) => fn.padNumber(t.millisecond, 3, 2)\n }\n },\n {\n size: 1,\n formats: {\n A: (t: Time) => t.hour < 12 ? 'AM' : 'PM',\n a: (t: Time) => t.hour < 12 ? 'am' : 'pm',\n H: (t: Time) => t.hour + '',\n h: (t: Time) => ((t.hour % 12) || 12) + '',\n k: (t: Time) => (t.hour + 1) + '',\n m: (t: Time) => t.minute + '',\n s: (t: Time) => t.second + '',\n S: (t: Time) => fn.padNumber(t.millisecond, 3, 1)\n }\n }\n ];\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Time.ts","\nimport { Functions as fn } from './Functions';\nimport { FrequencyCheck } from './Frequency';\nimport { Schedule, ScheduleInput } from './Schedule';\nimport { ScheduleModifier } from './ScheduleModifier';\nimport { Constants } from './Constants';\nimport { Day, DayProperty, DayInput, DurationInput } from './Day';\nimport { Event } from './Event';\nimport { Time } from './Time';\n\n\n/**\n * The class which takes user input and parses it to specific structures.\n */\nexport class Parse\n{\n\n /**\n * Parses a value and converts it to a [[FrequencyCheck]].\n *\n * @param input The input to parse into a function.\n * @param property The [[Day]] property the frequency is for.\n * @returns A function which determines whether a value matches a frequency.\n * @see [[Schedule]]\n */\n public static frequency(input: any, property: DayProperty): FrequencyCheck\n {\n let check: FrequencyCheck = (value: number) => {\n return true;\n };\n\n check.given = false;\n\n if (fn.isFrequencyValueEvery(input))\n {\n let every: number = input.every;\n let offset: number = (input.offset || 0) % every;\n\n check = (value: number) => {\n return value % every === offset;\n };\n check.given = true;\n }\n\n if (fn.isFrequencyValueOneOf(input))\n {\n let map: object = {};\n\n for (let i = 0; i < input.length; i++) {\n map[ input[ i ] ] = true;\n }\n\n check = (value: number) => {\n return !!map[ value ];\n };\n check.given = true;\n }\n\n check.input = input;\n check.property = property;\n\n return check;\n }\n\n /**\n * Parses [[DayInput]] into a [[Day]] instance.\n *\n * ```typescript\n * Parse.day( 65342300 ); // UTC timestamp\n * Parse.day( '01/02/2014' ); // strings in many formats\n * Parse.day( day ); // return a passed instance\n * Parse.day( [2018, 0, 2] ); // array: 01/02/2018\n * Parse.day( {year: 2018, month: 2} ); // object: 03/01/2018\n * Parse.day( true ); // today\n * ```\n *\n * @param input The input to parse.\n * @returns The Day parsed or `null` if the value is not valid.\n */\n public static day(input: DayInput): Day\n {\n if (fn.isNumber(input))\n {\n return Day.unix( input );\n }\n else if (fn.isString(input))\n {\n return Day.fromString( input );\n }\n else if (input instanceof Day)\n {\n return input;\n }\n else if (fn.isArray( input ))\n {\n return Day.fromArray( input );\n }\n else if (fn.isObject( input ))\n {\n return Day.fromObject( input );\n }\n else if (input === true)\n {\n return Day.today();\n }\n\n return null;\n }\n\n /**\n * Parses a value and tries to convert it to a Time instance.\n *\n * ```typescript\n * Parse.time( time ); // return a passed instance\n * Parse.time( 9 ); // 09:00:00.000\n * Parse.time( 3009 ); // 09:30:00.000\n * Parse.time( 593009 ); // 09:30:59.000\n * Parsetime( '09' ); // 09:00:00.000\n * Parse.time( '9:30' ); // 09:30:00.000\n * Parse.time( '9:30:59' ); // 09:30:59.000\n * Parse.time( {hour: 2} ); // 02:00:00.000\n * ```\n *\n * @param input The input to parse.\n * @returns The instance parsed or `null` if it was invalid.\n * @see [[Time.fromIdentifier]]\n * @see [[Time.fromString]]\n */\n public static time(input: any): Time\n {\n if (input instanceof Time)\n {\n return input;\n }\n if (fn.isNumber(input))\n {\n return Time.fromIdentifier( input );\n }\n if (fn.isString(input))\n {\n return Time.fromString( input );\n }\n if (fn.isObject(input) && fn.isNumber(input.hour))\n {\n return new Time(input.hour, input.minute, input.second, input.millisecond);\n }\n\n return null;\n }\n\n /**\n * Parses a value and tries to convert it to an array of Time instances.\n * If any of the given values are not a valid time value then the resulting\n * array will not contain a time instance.\n *\n * @param input The input to parse.\n * @returns A non-null array of time instances.\n * @see [[Parse.time]]\n */\n public static times(input: any): Time[]\n {\n let times: Time[] = [];\n\n if (fn.isArray(input))\n {\n for (let timeInput of input)\n {\n let time = this.time( timeInput );\n\n if (time)\n {\n times.push( time );\n }\n }\n\n // Sort times from earliest to latest.\n times.sort((a, b) =>\n {\n return a.toMilliseconds() - b.toMilliseconds();\n });\n }\n\n return times;\n }\n\n /**\n * Parses an array of excluded days into a map of excluded days where the\n * array value and returned object key are [[Day.dayIdentifier]].\n *\n * ```typescript\n * Parse.modifier( [ 20180101, 20140506 ] ); // {'20180101': true, '20140506': true}\n * Parse.modifier( [ 20180101, Day.build(2014,4,6) ] ); // {'20180101': true, '20140506': true}\n * ```\n *\n * @param input The input to parse.\n * @param value The default value if the input given is an array of identifiers.\n * @param parseMeta A function to use to parse a modifier.\n * @param out The modifier to set the identifiers and values of and return.\n * @returns The object with identifier keys and `true` values.\n * @see [[Day.dayIdentifier]]\n */\n public static modifier(input: any, value: T,\n parseMeta: (input: any) => T = (x => x),\n out: ScheduleModifier = new ScheduleModifier()): ScheduleModifier\n {\n let map = {};\n\n if (fn.isArray(input))\n {\n for (let identifier of input)\n {\n if (identifier instanceof Day)\n {\n map[ identifier.dayIdentifier ] = value;\n }\n else if (fn.isNumber(identifier))\n {\n map[ identifier ] = value;\n }\n else if (fn.isString(identifier))\n {\n map[ identifier ] = value;\n }\n }\n }\n\n if (fn.isObject(input))\n {\n for (let identifier in input)\n {\n map[ identifier ] = parseMeta( input[ identifier ] );\n }\n }\n\n out.map = map;\n\n return out;\n }\n\n /**\n * Parses an object which specifies a schedule where events may or may not\n * repeat and they may be all day events or at specific times.\n *\n * @param input The input to parse into a schedule.\n * @param parseMeta A function to use when parsing meta input into the desired type.\n * @param out The schedule to set the values of and return.\n * @returns An instance of the parsed [[Schedule]].\n */\n public static schedule(input: ScheduleInput | Schedule,\n parseMeta: (input: any) => M = (x => x),\n out: Schedule = new Schedule()): Schedule\n {\n if (input instanceof Schedule)\n {\n return input;\n }\n\n let on: Day = this.day( input.on );\n let times: Time[] = this.times( input.times );\n let fullDay: boolean = times.length === 0;\n\n if (on)\n {\n input.start = on.start();\n input.end = on.end();\n input.year = [on.year];\n input.month = [on.month];\n input.dayOfMonth = [on.dayOfMonth];\n }\n\n out.times = times;\n out.duration = fn.coalesce( input.duration, Constants.DURATION_DEFAULT );\n out.durationUnit = fn.coalesce( input.durationUnit, Constants.DURATION_DEFAULT_UNIT( fullDay ) );\n out.start = this.day( input.start );\n out.end = this.day( input.end );\n out.exclude = this.modifier( input.exclude, true, undefined, out.exclude );\n out.include = this.modifier( input.include, true, undefined, out.include );\n out.cancel = this.modifier( input.cancel, true, undefined, out.cancel );\n out.meta = this.modifier( input.meta, null, parseMeta, out.meta );\n out.year = this.frequency( input.year, 'year' );\n out.month = this.frequency( input.month, 'month' );\n out.week = this.frequency( input.week, 'week' );\n out.weekOfYear = this.frequency( input.weekOfYear, 'weekOfYear' );\n out.weekspanOfYear = this.frequency( input.weekspanOfYear, 'weekspanOfYear' );\n out.fullWeekOfYear = this.frequency( input.fullWeekOfYear, 'fullWeekOfYear' );\n out.lastWeekspanOfYear = this.frequency( input.lastWeekspanOfYear, 'lastWeekspanOfYear' );\n out.lastFullWeekOfYear = this.frequency( input.lastFullWeekOfYear, 'lastFullWeekOfYear' );\n out.weekOfMonth = this.frequency( input.weekOfMonth, 'weekOfMonth' );\n out.weekspanOfMonth = this.frequency( input.weekspanOfMonth, 'weekspanOfMonth' );\n out.fullWeekOfMonth = this.frequency( input.fullWeekOfMonth, 'fullWeekOfMonth' );\n out.lastWeekspanOfMonth = this.frequency( input.lastWeekspanOfMonth, 'lastWeekspanOfMonth' );\n out.lastFullWeekOfMonth = this.frequency( input.lastFullWeekOfMonth, 'lastFullWeekOfMonth' );\n out.dayOfWeek = this.frequency( input.dayOfWeek, 'dayOfWeek' );\n out.dayOfMonth = this.frequency( input.dayOfMonth, 'dayOfMonth' );\n out.lastDayOfMonth = this.frequency( input.lastDayOfMonth, 'lastDayOfMonth' );\n out.dayOfYear = this.frequency( input.dayOfYear, 'dayOfYear' );\n out.updateDurationInDays();\n out.updateChecks();\n\n return out;\n }\n\n /**\n * Parses an array of [[FrequencyCheck]] functions and returns an array of\n * functions for only the checks that were specified by the user.\n *\n * @param checks The array of check functions to filter through.\n * @returns The array of user specified checks.\n */\n public static givenFrequency(checks: FrequencyCheck[]): FrequencyCheck[]\n {\n let out: FrequencyCheck[] = [];\n\n for (let check of checks)\n {\n if (check.given)\n {\n out.push( check );\n }\n }\n\n return out;\n }\n\n /**\n * Parses [[EventInput]] and returns an [[Event]].\n *\n * @param input The input to parse.\n * @param parseData A function to use when parsing data input into the desired type.\n * @param parseMeta A function to use when parsing meta input into the desired type.\n * @returns The parsed value.\n */\n public static event(input: any,\n parseData: (input: any) => T = (x => x),\n parseMeta: (input: any) => M = (x => x)): Event\n {\n if (input instanceof Event)\n {\n return input;\n }\n\n if (!input.schedule)\n {\n return null;\n }\n\n let schedule: Schedule = this.schedule( input.schedule, parseMeta );\n\n return new Event( schedule, parseData( input.data ), input.id, input.visible );\n }\n\n /**\n * Parses a schedule from a CRON pattern. TODO\n */\n public static cron(pattern: string, out: Schedule = new Schedule()): Schedule\n {\n return out;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Parse.ts","\nimport { Identifier, IdentifierInput } from './Identifier';\nimport { Constants } from './Constants';\nimport { Op, operate } from './Operation';\nimport { Parse } from './Parse';\nimport { Time } from './Time';\n\n// @ts-ignore\nimport * as moment from 'moment';\n\n\n/**\n * Valid durations that can be specified.\n */\nexport type DurationInput = moment.unitOfTime.DurationConstructor;\n\n/**\n * All valid types which may be converted to a [[Day]] instance.\n *\n * - `number`: A UNIX timestamp.\n * - `string`: A string representation of a date.\n * - `Day`: An existing [[Day]] instance.\n * - `number[]`: An array of numbers specifying any of: [year, month, dayOfMonth, hour, minute, second, millisecond].\n * - `object`: An object with any of the following properties: year, month, dayOfMonth, hour, minute, second, millisecond.\n * - `true`: This will be interpreted as [[Day.today]]\n */\nexport type DayInput = number | string | Day | number[] | object | true;\n\n/**\n * One of the properties on the [[Day]] object.\n */\nexport type DayProperty = keyof Day;\n\n/**\n * A class which represents a point in time as\n */\nexport class Day\n{\n\n /**\n *\n */\n public readonly date: moment.Moment;\n\n /**\n *\n */\n public readonly time: number;\n\n /**\n *\n */\n public readonly millis: number;\n\n /**\n *\n */\n public readonly seconds: number;\n\n /**\n *\n */\n public readonly minute: number;\n\n /**\n *\n */\n public readonly hour: number;\n\n /**\n *\n */\n public readonly month: number;\n\n /**\n *\n */\n public readonly year: number;\n\n /**\n *\n */\n public readonly quarter: number;\n\n\n /**\n *\n */\n public readonly dayOfWeek: number;\n\n /**\n *\n */\n public readonly dayOfMonth: number;\n\n /**\n *\n */\n public readonly lastDayOfMonth: number;\n\n /**\n *\n */\n public readonly dayOfYear: number;\n\n\n /**\n *\n */\n public readonly week: number;\n\n /**\n *\n */\n public readonly weekOfYear: number;\n\n /**\n *\n */\n public readonly weekspanOfYear: number;\n\n /**\n *\n */\n public readonly fullWeekOfYear: number;\n\n /**\n *\n */\n public readonly lastWeekspanOfYear: number;\n\n /**\n *\n */\n public readonly lastFullWeekOfYear: number;\n\n\n /**\n *\n */\n public readonly weekOfMonth: number;\n\n /**\n *\n */\n public readonly weekspanOfMonth: number;\n\n /**\n *\n */\n public readonly fullWeekOfMonth: number;\n\n /**\n *\n */\n public readonly lastWeekspanOfMonth: number;\n\n /**\n *\n */\n public readonly lastFullWeekOfMonth: number;\n\n\n /**\n *\n */\n public readonly timeIdentifier: IdentifierInput;\n\n /**\n *\n */\n public readonly dayIdentifier: IdentifierInput;\n\n /**\n *\n */\n public readonly weekIdentifier: IdentifierInput;\n\n /**\n *\n */\n public readonly monthIdentifier: IdentifierInput;\n\n /**\n *\n */\n public readonly quarterIdentifier: IdentifierInput;\n\n\n\n /**\n *\n */\n public constructor(date: moment.Moment)\n {\n this.date = date;\n this.time = date.valueOf();\n this.millis = date.millisecond();\n this.seconds = date.second();\n this.minute = date.minute();\n this.hour = date.hour();\n this.month = date.month();\n this.year = date.year();\n this.quarter = date.quarter();\n this.dayOfWeek = date.day();\n this.dayOfMonth = date.date();\n this.dayOfYear = date.dayOfYear();\n this.week = date.week();\n\n this.lastDayOfMonth = Day.getLastDayOfMonth( date );\n this.weekOfYear = Day.getWeekOfYear( date );\n this.weekspanOfYear = Day.getWeekspanOfYear( date );\n this.fullWeekOfYear = Day.getFullWeekOfYear( date );\n this.lastWeekspanOfYear = Day.getLastWeekspanOfYear( date );\n this.lastFullWeekOfYear = Day.getLastFullWeekOfYear( date );\n\n this.weekOfMonth = Day.getWeekOfMonth( date );\n this.weekspanOfMonth = Day.getWeekspanOfMonth( date );\n this.fullWeekOfMonth = Day.getFullWeekOfMonth( date );\n this.lastWeekspanOfMonth = Day.getLastWeekspanOfMonth( date );\n this.lastFullWeekOfMonth = Day.getLastFullWeekOfMonth( date );\n\n this.timeIdentifier = Identifier.Time.get( this );\n this.dayIdentifier = Identifier.Day.get( this);\n this.weekIdentifier = Identifier.Week.get( this);\n this.monthIdentifier = Identifier.Month.get( this);\n this.quarterIdentifier = Identifier.Quarter.get( this );\n }\n\n // Same\n\n /**\n *\n */\n public sameDay(day: Day): boolean\n {\n return this.dayIdentifier === day.dayIdentifier;\n }\n\n /**\n *\n */\n public sameMonth(day: Day): boolean\n {\n return this.monthIdentifier === day.monthIdentifier;\n }\n\n /**\n *\n */\n public sameWeek(day: Day): boolean\n {\n return this.weekIdentifier === day.weekIdentifier;\n }\n\n /**\n *\n */\n public sameYear(day: Day): boolean\n {\n return this.year === day.year;\n }\n\n /**\n *\n */\n public sameQuarter(day: Day): boolean\n {\n return this.quarterIdentifier === day.quarterIdentifier;\n }\n\n /**\n *\n */\n public sameHour(day: Day): boolean {\n return this.dayIdentifier === day.dayIdentifier && this.hour === day.hour;\n }\n\n /**\n *\n */\n public sameMinute(day: Day): boolean {\n return this.timeIdentifier === day.timeIdentifier;\n }\n\n /**\n *\n */\n public sameTime(time: Time): boolean {\n return this.hour === time.hour && this.minute === time.minute && this.seconds === time.second && this.millis === time.millisecond;\n }\n\n // Comparison\n\n /**\n *\n */\n public isBefore(day: Day, precision?: moment.unitOfTime.StartOf): boolean {\n return this.date.isBefore( day.date, precision );\n }\n\n /**\n *\n */\n public isSameOrBefore(day: Day, precision?: moment.unitOfTime.StartOf): boolean {\n return this.date.isSameOrBefore( day.date, precision );\n }\n\n /**\n *\n */\n public isAfter(day: Day, precision?: moment.unitOfTime.StartOf): boolean {\n return this.date.isAfter( day.date, precision );\n }\n\n /**\n *\n */\n public isSameOrAfter(day: Day, precision?: moment.unitOfTime.StartOf): boolean {\n return this.date.isSameOrAfter( day.date, precision );\n }\n\n /**\n *\n */\n public max(day: Day): Day {\n return this.date.isAfter( day.date ) ? this : day;\n }\n\n /**\n *\n */\n public min(day: Day): Day {\n return this.date.isBefore( day.date ) ? this : day;\n }\n\n // Between\n\n public millisBetween(day: Day, op: Op = Op.DOWN, absolute: boolean = true): number {\n return operate( this.date.diff( day.date, 'milliseconds', true ), op, absolute );\n }\n\n public secondsBetween(day: Day, op: Op = Op.DOWN, absolute: boolean = true): number {\n return operate( this.date.diff( day.date, 'seconds', true ), op, absolute );\n }\n\n public minutesBetween(day: Day, op: Op = Op.DOWN, absolute: boolean = true): number {\n return operate( this.date.diff( day.date, 'minutes', true ), op, absolute );\n }\n\n public hoursBetween(day: Day, op: Op = Op.DOWN, absolute: boolean = true): number {\n return operate( this.date.diff( day.date, 'hours', true ), op, absolute );\n }\n\n public daysBetween(day: Day, op: Op = Op.DOWN, absolute: boolean = true): number {\n return operate( this.date.diff( day.date, 'days', true ), op, absolute );\n }\n\n public weeksBetween(day: Day, op: Op = Op.DOWN, absolute: boolean = true): number {\n return operate( this.date.diff( day.date, 'weeks', true ), op, absolute );\n }\n\n public monthsBetween(day: Day, op: Op = Op.DOWN, absolute: boolean = true): number {\n return operate( this.date.diff( day.date, 'months', true ), op, absolute );\n }\n\n public yearsBetween(day: Day, op: Op = Op.DOWN, absolute: boolean = true): number {\n return operate( this.date.diff( day.date, 'years', true ), op, absolute );\n }\n\n public isBetween(start: Day, end: Day, inclusive: boolean = true): boolean {\n return this.date.isBetween(start.date, end.date, null, inclusive ? '[]' : '[)');\n }\n\n public mutate(mutator: (date: moment.Moment) => void): Day {\n var d = this.toMoment();\n mutator( d );\n return new Day( d );\n }\n\n public add(amount: number, unit: string): Day {\n return this.mutate(d => d.add(amount, unit));\n }\n\n public relative(millis: number): Day {\n return this.mutate(d => d.add(millis, 'milliseconds'));\n }\n\n // Days\n\n public relativeDays(days: number): Day {\n return this.mutate(d => d.add(days, 'days'));\n }\n\n public prev(days: number = 1): Day {\n return this.relativeDays( -days );\n }\n\n public next(days: number = 1): Day {\n return this.relativeDays( days );\n }\n\n public withDayOfMonth(day: number): Day {\n return this.mutate(d => d.date(day));\n }\n\n public withDayOfWeek(dayOfWeek: number): Day {\n return this.mutate(d => d.day(dayOfWeek));\n }\n\n public withDayOfYear(dayOfYear: number): Day {\n return this.mutate(d => d.dayOfYear(dayOfYear));\n }\n\n // Month\n\n public withMonth(month: number): Day {\n return this.mutate(d => d.month(month));\n }\n\n public relativeMonths(months: number): Day {\n return this.mutate(d => d.add(months, 'months'));\n }\n\n public prevMonth(months: number = 1): Day {\n return this.relativeMonths( -months );\n }\n\n public nextMonth(months: number = 1): Day {\n return this.relativeMonths( months );\n }\n\n // Week Of Year\n\n public withWeek(week: number, relativeWeek: number = this.week): Day {\n return this.mutate(d => d.add((week - relativeWeek) * Constants.DAYS_IN_WEEK, 'days'));\n }\n\n public withWeekOfYear(week: number): Day {\n return this.withWeek(week, this.weekOfYear);\n }\n\n public withFullWeekOfYear(week: number): Day {\n return this.withWeek(week, this.fullWeekOfYear);\n }\n\n public withWeekspanOfYear(week: number): Day {\n return this.withWeek(week, this.weekspanOfYear);\n }\n\n public withWeekOfMonth(week: number): Day {\n return this.withWeek(week, this.weekOfMonth);\n }\n\n public withWeekspanOfMonth(week: number): Day {\n return this.withWeek(week, this.weekspanOfMonth);\n }\n\n public withFullWeekOfMonth(week: number): Day {\n return this.withWeek(week, this.fullWeekOfMonth);\n }\n\n public relativeWeeks(weeks: number): Day {\n return this.mutate(d => d.add(weeks, 'weeks'));\n }\n\n public prevWeek(weeks: number = 1): Day {\n return this.relativeWeeks( -weeks );\n }\n\n public nextWeek(weeks: number = 1): Day {\n return this.relativeWeeks( weeks );\n }\n\n // Year\n\n public withYear(year: number): Day {\n return this.mutate(d => d.year(year));\n }\n\n public relativeYears(years: number): Day {\n return this.mutate(d => d.add(years, 'year'));\n }\n\n public prevYear(years: number = 1): Day {\n return this.relativeYears( -years );\n }\n\n public nextYear(years: number = 1): Day {\n return this.relativeYears( years );\n }\n\n // Hour\n\n public withHour(hour: number): Day {\n return this.mutate(d => d.hour(hour));\n }\n\n public relativeHours(hours: number): Day {\n return this.mutate(d => d.add(hours, 'hours'));\n }\n\n public prevHour(hours: number = 1): Day {\n return this.relativeHours( -hours );\n }\n\n public nextHour(hours: number = 1): Day {\n return this.relativeHours( hours );\n }\n\n // Time\n\n public withTimes(\n hour: number = Constants.HOUR_MIN,\n minute: number = Constants.MINUTE_MIN,\n second: number = Constants.SECOND_MIN,\n millisecond: number = Constants.MILLIS_MIN): Day {\n return this.mutate(d => d.set({hour, minute, second, millisecond}));\n }\n\n public withTime(time: Time): Day {\n return this.withTimes(time.hour, time.minute, time.second, time.millisecond);\n }\n\n public asTime(): Time {\n return new Time(this.hour, this.minute, this.seconds, this.millis);\n }\n\n // Start & End\n\n // Time\n\n public start(): Day {\n return this.mutate(d => d.startOf('day'));\n }\n\n public isStart(): boolean {\n return this.hour === Constants.HOUR_MIN &&\n this.minute === Constants.MINUTE_MIN &&\n this.seconds === Constants.SECOND_MIN &&\n this.millis === Constants.MILLIS_MIN;\n }\n\n public end(inclusive: boolean = true): Day {\n return inclusive ?\n this.mutate(d => d.endOf('day')) :\n this.mutate(d => d.startOf('day').add(1, 'day'));\n }\n\n public isEnd(): boolean {\n return this.hour === Constants.HOUR_MAX &&\n this.minute === Constants.MINUTE_MAX &&\n this.seconds === Constants.SECOND_MAX &&\n this.millis === Constants.MILLIS_MAX;\n }\n\n // Hour\n\n public startOfHour(): Day {\n return this.mutate(d => d.startOf('hour'));\n }\n\n public isStartOfHour(): boolean {\n return this.minute === Constants.MINUTE_MIN &&\n this.seconds === Constants.SECOND_MIN &&\n this.millis === Constants.MILLIS_MIN;\n }\n\n public endOfHour(inclusive: boolean = true): Day {\n return inclusive ?\n this.mutate(d => d.endOf('hour')) :\n this.mutate(d => d.startOf('hour').add(1, 'hour'));\n }\n\n public isEndOfHour(): boolean {\n return this.minute === Constants.MINUTE_MAX &&\n this.seconds === Constants.SECOND_MAX &&\n this.millis === Constants.MILLIS_MAX;\n }\n\n // Week\n\n public startOfWeek(): Day {\n return this.mutate(d => d.startOf('week'));\n }\n\n public isStartOfWeek(): boolean {\n return this.dayOfWeek === Constants.WEEKDAY_MIN;\n }\n\n public endOfWeek(inclusive: boolean = true): Day {\n return inclusive ?\n this.mutate(d => d.endOf('week')) :\n this.mutate(d => d.startOf('week').add(1, 'week'));\n }\n\n public isEndOfWeek(): boolean {\n return this.dayOfWeek === Constants.WEEKDAY_MAX;\n }\n\n // Month\n\n public startOfMonth(): Day {\n return this.mutate(d => d.startOf('month'));\n }\n\n public isStartOfMonth(): boolean {\n return this.dayOfMonth === Constants.DAY_MIN;\n }\n\n public endOfMonth(inclusive: boolean = true): Day {\n return inclusive ?\n this.mutate(d => d.endOf('month')) :\n this.mutate(d => d.startOf('month').add(1, 'month'));\n }\n\n public isEndOfMonth(): boolean {\n return this.dayOfMonth === this.daysInMonth();\n }\n\n // Year\n\n public startOfYear(): Day {\n return this.mutate(d => d.startOf('year'));\n }\n\n public isStartOfYear(): boolean {\n return this.month === Constants.MONTH_MIN && this.dayOfMonth === Constants.DAY_MIN;\n }\n\n public endOfYear(inclusive: boolean = true): Day {\n return inclusive ?\n this.mutate(d => d.endOf('year')) :\n this.mutate(d => d.startOf('year').add(1, 'year'));\n }\n\n public isEndOfYear(): boolean {\n return this.month === Constants.MONTH_MAX && this.dayOfMonth === Constants.DAY_MAX;\n }\n\n // Days In X\n\n public daysInMonth(): number {\n return this.date.daysInMonth();\n }\n\n public daysInYear(): number {\n return this.endOfYear().dayOfYear;\n }\n\n public weeksInYear(): number {\n return this.date.weeksInYear();\n }\n\n // Display\n\n public format(format: string): string {\n return this.date.format( format );\n }\n\n public utc(keepLocalTime?: boolean): Day {\n return this.mutate(d => d.utc(keepLocalTime));\n }\n\n public toMoment(): moment.Moment {\n return this.date.clone();\n }\n\n public toDate(): Date {\n return this.date.toDate();\n }\n\n public toArray(): number[] {\n return this.date.toArray();\n }\n\n public toJSON(): string {\n return this.date.toJSON();\n }\n\n public toISOString(keepOffset: boolean = false): string {\n return this.date.toISOString( keepOffset );\n }\n\n public toObject(): object {\n return this.date.toObject();\n }\n\n public toString(): string {\n return this.date.toString();\n }\n\n // State\n\n public isDST(): boolean {\n return this.date.isDST();\n }\n\n public isLeapYear(): boolean {\n return this.date.isLeapYear();\n }\n\n // Instances\n\n public static now(): Day {\n return new Day(moment());\n }\n\n public static today(): Day {\n return this.now().start();\n }\n\n public static tomorrow(): Day {\n return this.today().next();\n }\n\n public static fromMoment(moment: moment.Moment): Day {\n return moment && moment.isValid() ? new Day( moment ) : null;\n }\n\n public static unix(millis: number): Day {\n return this.fromMoment(moment(millis));\n }\n\n public static unixSeconds(millis: number): Day {\n return this.fromMoment(moment.unix(millis));\n }\n\n public static parse(input: DayInput): Day {\n return Parse.day(input);\n }\n\n public static fromString(input: string): Day {\n return this.fromMoment(moment(input));\n }\n\n public static fromFormat(input: string, formats: string | string[]): Day {\n return this.fromMoment(moment(input, formats));\n }\n\n public static fromObject(input: object): Day {\n return this.fromMoment(moment(input));\n }\n\n public static fromDate(input: Date): Day {\n return this.fromMoment(moment(input));\n }\n\n public static fromArray(input: number[]): Day {\n return this.fromMoment(moment(input));\n }\n\n public static fromDayIdentifier(id: number): Day {\n let date: number = id % 100;\n let month: number = (Math.floor(id / 100) % 100) - 1;\n let year: number = Math.floor(id / 10000);\n\n return this.build(year, month, date);\n }\n\n public static build(year: number, month: number,\n date: number = Constants.DAY_MIN,\n hour: number = Constants.HOUR_MIN,\n minute: number = Constants.MINUTE_MIN,\n second: number = Constants.SECOND_MIN,\n millisecond: number = Constants.MILLIS_MIN): Day\n {\n return new Day( moment({year, month, date, hour, minute, second, millisecond}) );\n }\n\n\n\n\n\n\n\n\n public static getWeekspanOfYear(date: moment.Moment): number\n {\n return Math.floor( (date.dayOfYear() - 1) / Constants.DAYS_IN_WEEK );\n }\n\n public static getLastWeekspanOfYear(date: moment.Moment): number\n {\n let lastOfYear = date.clone().endOf('year');\n let daysInYear: number = lastOfYear.dayOfYear();\n\n return Math.floor( (daysInYear - date.dayOfYear()) / Constants.DAYS_IN_WEEK );\n }\n\n public static getWeekOfYear(date: moment.Moment): number\n {\n let firstOfYear = date.clone().startOf('year');\n let weeks: number = date.week();\n\n return firstOfYear.day() > Constants.WEEK_OF_MONTH_MINIMUM_WEEKDAY ? weeks - 1 : weeks;\n }\n\n public static getFullWeekOfYear(date: moment.Moment): number\n {\n let firstOfYear = date.clone().startOf('year');\n let weeks: number = date.week();\n\n return firstOfYear.day() === Constants.WEEKDAY_MIN ? weeks : weeks - 1;\n }\n\n public static getLastFullWeekOfYear(date: moment.Moment): number\n {\n let firstOfYear = date.clone().startOf('year');\n let weeks: number = date.week();\n let weeksMax: number = date.weeksInYear();\n let lastWeek: number = weeksMax - weeks;\n\n return firstOfYear.day() === Constants.WEEKDAY_MIN ? lastWeek + 1 : lastWeek;\n }\n\n public static getWeekspanOfMonth(date: moment.Moment): number\n {\n return Math.floor((date.date() - 1) / Constants.DAYS_IN_WEEK);\n }\n\n public static getLastWeekspanOfMonth(date: moment.Moment): number\n {\n return Math.floor((date.daysInMonth() - date.date()) / Constants.DAYS_IN_WEEK);\n }\n\n public static getFullWeekOfMonth(date: moment.Moment): number\n {\n return Math.floor((date.date() - 1 - date.day() + Constants.DAYS_IN_WEEK) / Constants.DAYS_IN_WEEK);\n }\n\n public static getLastFullWeekOfMonth(date: moment.Moment): number\n {\n return Math.floor((date.daysInMonth() - date.date() - (Constants.WEEKDAY_MAX - date.day()) + Constants.DAYS_IN_WEEK) / Constants.DAYS_IN_WEEK);\n }\n\n public static getWeekOfMonth(date: moment.Moment): number\n {\n let dom = date.date();\n let dow = date.day();\n let sundayDate = dom - dow;\n\n return Math.floor( ( sundayDate + Constants.WEEK_OF_MONTH_MINIMUM_WEEKDAY + 5 ) / Constants.DAYS_IN_WEEK );\n }\n\n public static getLastDayOfMonth(date: moment.Moment): number\n {\n return date.daysInMonth() - date.date() + 1;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Day.ts","\nimport { Op } from './Operation';\nimport { Day } from './Day';\nimport { DaySpan } from './DaySpan';\nimport { CalendarEvent } from './CalendarEvent';\n\n\n/**\n * A day in a [[Calendar]] with extra information relative to any selection on\n * the calendar, the current date, or events on the day.\n *\n * @typeparam T The type of data stored in the [[Event]] class.\n * @typeparam M The type of metadata stored in the schedule.\n */\nexport class CalendarDay extends Day\n{\n\n /**\n * Whether this day is the current day (ex: today).\n */\n public currentDay: boolean = false;\n\n /**\n * Whether this day is on the same week as the current day (ex: today).\n */\n public currentWeek: boolean = false;\n\n /**\n * Whether this day is on the same month as the current day (ex: today).\n */\n public currentMonth: boolean = false;\n\n /**\n * Whether this day is on the same year as the current day (ex: today).\n */\n public currentYear: boolean = false;\n\n /**\n * How many days away this day is from the current day (ex: today). If this\n * day is the current day the offset is 0. If this day is before the current\n * day it will be the negative number of days away. Otherwise this will be\n * positive meaning this day is after the current day by the given days.\n */\n public currentOffset: number = 0;\n\n /**\n * Whether this day is part of a selection on the calendar.\n */\n public selectedDay: boolean = false;\n\n /**\n * Whether this day is on the same week that the calendar selection is.\n */\n public selectedWeek: boolean = false;\n\n /**\n * Whether this day is on the same month that the calendar selection is.\n */\n public selectedMonth: boolean = false;\n\n /**\n * Whether this day is on the same year that the calendar selection is.\n */\n public selectedYear: boolean = false;\n\n /**\n * Whether this day is in the current calendar or not. Some days are outside\n * the calendar span and used to fill in weeks. Month calendars will fill in\n * days so the list of days in the calendar start on Sunday and end on Saturday.\n */\n public inCalendar: boolean = false;\n\n /**\n * The list of events on this day based on the settings and schedules in the\n * calendar.\n */\n public events: CalendarEvent[] = [];\n\n\n /**\n * Updates the current flags on this day given the current day (ex: today).\n *\n * @param current The current day of the calendar.\n */\n public updateCurrent(current: Day): this\n {\n this.currentDay = this.sameDay(current);\n this.currentWeek = this.sameWeek(current);\n this.currentMonth = this.sameMonth(current);\n this.currentYear = this.sameYear(current);\n this.currentOffset = this.daysBetween(current, Op.DOWN, false);\n\n return this;\n }\n\n /**\n * Updates the selection flags on this day given the selection range on the\n * calendar.\n *\n * @param selected The span of days selected on the calendar.\n */\n public updateSelected(selected: DaySpan): this\n {\n this.selectedDay = selected.matchesDay(this);\n this.selectedWeek = selected.matchesWeek(this);\n this.selectedMonth = selected.matchesMonth(this);\n this.selectedYear = selected.matchesYear(this);\n\n return this;\n }\n\n /**\n * Clears the selection flags on this day. This is done when the selection on\n * the calendar is cleared.\n */\n public clearSelected(): this\n {\n this.selectedDay = this.selectedWeek = this.selectedMonth = this.selectedYear = false;\n\n return this;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/CalendarDay.ts","\nimport { Constants } from './Constants';\nimport { Day } from './Day';\nimport { DaySpan, DaySpanBounds } from './DaySpan';\nimport { Event } from './Event';\nimport { Identifier, IdentifierInput } from './Identifier';\nimport { Schedule } from './Schedule';\n\n\n/**\n * An instance of an [[Event]] on a given day of a [[Calendar]] generated by\n * the event's [[Schedule]].\n *\n * @typeparam T The type of data stored in the [[Event]] class.\n * @typeparam M The type of metadata stored in the schedule and in this class.\n */\nexport class CalendarEvent\n{\n\n /**\n * The relatively unique identifier of this event. It is generated based on\n * the index of the schedule in the calendar and the time of day listed in the\n * schedule. This number will no longer be unique if the schedule has more\n * than [[Constants.MAX_EVENTS_PER_DAY]] occurrences in a single day\n * (based on number of times in [[Schedule.times]]).\n */\n public id: number;\n\n /**\n * The event with the schedule.\n */\n public event: Event;\n\n /**\n * Any metadata specified for this event instance in the schedule.\n */\n public meta: M;\n\n /**\n * The day this event occurs on.\n */\n public day: Day;\n\n /**\n * The span of time this event occurs. If this is an all day event this span\n * will start at the beginning of the day and end at the beginning of the\n * next day.\n *\n * @see [[Schedule.isFullDay]]\n */\n public time: DaySpan;\n\n /**\n * Whether this event is an all day event.\n *\n * @see [[Schedule.isFullDay]]\n */\n public fullDay: boolean;\n\n /**\n * Whether this event is the first day of an occurrence. A calendar can\n * generate multiple [[CalendarEvent]] instances over each day it covers if\n * [[Calendar.repeatCovers]] is true. These instances have matching\n * [[CalendarEvent.id]] values.\n */\n public starting: boolean;\n\n /**\n * Whether this event is the last day of an occurrence. A calendar can\n * generate multiple [[CalendarEvent]] instances over each day it covers if\n * [[Calendar.repeatCovers]] is true. These instances have matching\n * [[CalendarEvent.id]] values.\n */\n public ending: boolean;\n\n /**\n * Whether this event instance was marked as cancelled in the schedule.\n */\n public cancelled: boolean;\n\n /**\n * The row this event is on in a visual calendar. An event can span multiple\n * days and it is desirable to have the occurrence on each day to line up.\n * This is only set when [[Calendar.updateRows]] is true or manually set.\n * This value makes sense for visual calendars for all day events or when the\n * visual calendar is not positioning events based on their time span.\n */\n public row: number = 0;\n\n /**\n * The column this event is on in a visual calendar. An event can have its\n * time overlap with another event displaying one of the events in another\n * column. This is only set when [[Calendar.updateColumns]] is true or\n * manually set. This value makes sense for visual calendars that are\n * displaying event occurrences at specific times positioned accordingly.\n */\n public col: number = 0;\n\n\n /**\n * Creates a new event instance given the id, the event paired with the\n * schedule, the schedule, the time span of the event, and the day on the\n * calendar the event belongs to.\n *\n * @param id The relatively unique identifier of this event.\n * @param event The event which created this instance.\n * @param time The time span of this event.\n * @param actualDay The day on the calendar this event is for.\n */\n public constructor(id: number, event: Event, time: DaySpan, actualDay: Day)\n {\n this.id = id;\n this.event = event;\n this.time = time;\n this.day = actualDay;\n this.fullDay = event.schedule.isFullDay();\n this.meta = event.schedule.getMeta( time.start );\n this.cancelled = event.schedule.isCancelled( time.start );\n this.starting = time.isPoint || time.start.sameDay( actualDay );\n this.ending = time.isPoint || time.end.relative(-1).sameDay( actualDay );\n }\n\n /**\n * The id of the schedule uniqe within the calendar which generated this event.\n */\n public get scheduleId(): number\n {\n return Math.floor( this.id / Constants.MAX_EVENTS_PER_DAY );\n }\n\n /**\n * The start timestamp of the event.\n */\n public get start(): Day\n {\n return this.time.start;\n }\n\n /**\n * The end timestamp of the event.\n */\n public get end(): Day\n {\n return this.time.end;\n }\n\n /**\n * The schedule which generated this event.\n */\n public get schedule(): Schedule\n {\n return this.event.schedule;\n }\n\n /**\n * The related event data.\n */\n public get data(): T\n {\n return this.event.data;\n }\n\n /**\n * An [[IdentifierInput]] for the start of this event.\n */\n public get identifier(): IdentifierInput\n {\n return this.identifierType.get( this.start );\n }\n\n /**\n * The [[Identifier]] for this event. Either [[Identifier.Day]] or\n * [[Identifier.Time]].\n */\n public get identifierType(): Identifier\n {\n return this.schedule.identifierType;\n }\n\n /**\n * Returns a delta value between 0 and 1 which represents where the\n * [[CalendarEvent.start]] is relative to [[CalendarEvent.day]]. The delta\n * value would be less than 0 if the start of the event is before\n * [[CalendarEvent.day]].\n */\n public get startDelta(): number\n {\n return this.time.startDelta( this.day );\n }\n\n /**\n * Returns a delta value between 0 and 1 which represents where the\n * [[CalendarEvent.end]] is relative to [[CalendarEvent.day]]. The delta value\n * would be greater than 1 if the end of the event is after\n * [[CalendarEvent.day]].\n */\n public get endDelta(): number\n {\n return this.time.endDelta( this.day );\n }\n\n /**\n * Calculates the bounds for this event if it were placed in a rectangle which\n * represents a day (24 hour period). By default the returned values are\n * between 0 and 1 and can be scaled by the proper rectangle dimensions or the\n * rectangle dimensions can be passed to this function.\n *\n * @param dayHeight The height of the rectangle of the day.\n * @param dayWidth The width of the rectangle of the day.\n * @param columnOffset The offset in the rectangle of the day to adjust this\n * event by if it intersects or is contained in a previous event. This also\n * reduces the width of the returned bounds to keep the bounds in the\n * rectangle of the day.\n * @param clip `true` if the bounds should stay in the day rectangle, `false`\n * and the bounds may go outside the rectangle of the day for multi-day\n * events.\n * @param offsetX How much to translate the left & right properties by.\n * @param offsetY How much to translate the top & bottom properties by.\n * @returns The calculated bounds for this event.\n */\n public getTimeBounds(dayHeight: number = 1, dayWidth: number = 1, columnOffset: number = 0.1, clip: boolean = true, offsetX: number = 0, offsetY: number = 0): DaySpanBounds\n {\n return this.time.getBounds( this.day, dayHeight, dayWidth, this.col * columnOffset, clip, offsetX, offsetY );\n }\n\n /**\n * Changes the cancellation status of this event. By default this cancels\n * this event - but `false` may be passed to undo a cancellation.\n *\n * @param cancelled Whether the event should be cancelled.\n */\n public cancel(cancelled: boolean = true): this\n {\n this.schedule.setCancelled( this.start, cancelled );\n this.cancelled = cancelled;\n\n return this;\n }\n\n /**\n * Changes the exclusion status of this event. By default this excludes this\n * event - but `false` may be passed to undo an exclusion.\n *\n * @param excluded Whether the event should be excluded.\n */\n public exclude(excluded: boolean = true): this\n {\n this.schedule.setExcluded( this.start, excluded );\n\n return this;\n }\n\n /**\n * Moves this event to potentially another day and time. A move is\n * accomplished by excluding the current event and adding an inclusion of the\n * new day & time. Any [[CalendarEvent.meta]] on this event will be moved to\n * the new event. If the schedule represents a single event\n * ([[Schedule.isSingleEvent]]) then the schedule frequencies are updated\n * to match the timestamp provided.\n *\n * @param toTime The timestamp to move this event to.\n * @returns Whether the event was moved to the given time.\n */\n public move(toTime: Day): boolean\n {\n return this.schedule.move( toTime, this.start, this.meta );\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/CalendarEvent.ts","\nimport { Functions as fn } from './Functions';\nimport { Day, DayInput } from './Day';\nimport { DaySpan } from './DaySpan';\nimport { Schedule } from './Schedule';\nimport { EventInput, Event } from './Event';\nimport { Op } from './Operation';\nimport { Units } from './Units';\nimport { Parse } from './Parse';\nimport { SortEvent } from './Sort';\nimport { Constants } from './Constants';\nimport { CalendarDay } from './CalendarDay';\nimport { CalendarEvent } from './CalendarEvent';\nimport { Iterator, IteratorAction } from './Iterator';\n\n\n/**\n * A function which moves a given day by some amount and some unit. This is\n * used to shift a calendar's frame via [[Calendar.next]] and [[Calendar.prev]].\n *\n * @param day The day to move.\n * @param amount The amount to move the day by.\n * @returns A new day instance moved by the given amount.\n */\nexport type CalendarMover = (day: Day, amount: number) => Day;\n\n/**\n * A definition for a given [[Units]] which informs a calendar how to setup the\n * [[Calendar.span]] and how to move with [[Calendar.move]].\n */\nexport interface CalendarTypeDefinition\n{\n getStart(around: Day, size: number, focus: number): Day;\n getEnd(start: Day, size: number, focus: number): Day;\n moveStart(day: Day, amount: number): Day;\n moveEnd(day: Day, amount: number): Day;\n defaultInput: any\n}\n\n/**\n * A map of [[CalendarTypeDefinition]] keyed by the [[Units]].\n */\nexport type CalendarTypeDefinitionMap = { [unit: number]: CalendarTypeDefinition };\n\n/**\n * Input used to initialize or mass change the properties of a [[Calendar]].\n *\n * @typeparam T The type of data stored in the [[Event]] class.\n * @typeparam M The type of metadata stored in the schedule.\n */\nexport interface CalendarInput\n{\n\n /**\n * @see [[Calendar.fill]]\n */\n fill?: boolean;\n /**\n * @see [[Calendar.minimumSize]]\n */\n minimumSize?: number;\n /**\n * @see [[Calendar.repeatCovers]]\n */\n repeatCovers?: boolean;\n /**\n * @see [[Calendar.listTimes]]\n */\n listTimes?: boolean;\n /**\n * @see [[Calendar.eventsOutside]]\n */\n eventsOutside?: boolean;\n /**\n * @see [[Calendar.updateRows]]\n */\n updateRows?: boolean;\n /**\n * @see [[Calendar.updateColumns]]\n */\n updateColumns?: boolean;\n /**\n * @see [[Calendar.eventSorter]]\n */\n eventSorter?: SortEvent;\n /**\n * @see [[Calendar.events]]\n */\n events?: EventInput[];\n /**\n * @see [[Calendar.type]]\n */\n type?: Units;\n /**\n * @see [[Calendar.size]]\n */\n size?: number; // 1\n /**\n * @see [[Calendar.parseMeta]]\n */\n parseMeta?: (input: any) => M;\n /**\n * @see [[Calendar.parseData]]\n */\n parseData?: (input: any) => T;\n /**\n * When morphing a calendar to a fewer number of days, do we want to keep\n * today in the calendar if it is already in the calendar?\n */\n preferToday?: boolean; // true\n /**\n * What day should the calendar be based around (contain)?\n */\n around?: DayInput; // null\n /**\n * When morphing a calendar and `preferToday` is false OR today is not in the\n * calendar AND `around` is not specified, we will pick a day at this number\n * in the current calendar (a value between 0 and 1 signifying the start and\n * and of the current calendar).\n */\n otherwiseFocus?: number; // 0.499999\n /**\n * When morphing or creating passing a value of `true` will avoid calling\n * [[Calendar.refresh]] as is typically done right after each of those\n * functions.\n */\n delayRefresh?: boolean; // false\n}\n\n/**\n * A collection of [[CalendarDay]]s, the events on the calendar, and all\n * [[CalendarEvent]]s generated based on the events.\n *\n * @typeparam T The type of data stored in the [[Event]] class.\n * @typeparam M The type of metadata stored in the schedule.\n */\nexport class Calendar\n{\n\n /**\n * The span of days in the calendar.\n */\n public span: DaySpan;\n\n /**\n * The full span of days represented on the calendar. This may be different\n * than the [[Calendar.span]] when [[Calendar.fill]] is `true` and the\n * calendar is representing months or years and the days need to start on\n * Sunday and end on Saturday.\n */\n public filled: DaySpan;\n\n /**\n * The number of days in the calendar specified by [[Calendar.span]].\n */\n public length: number;\n\n /**\n * The type of calendar.\n */\n public type: Units;\n\n /**\n * The size of the calendar. When the calendar type is...\n *\n * - [[Units.DAY]]: The number of days in the calendar.\n * - [[Units.WEEK]]: The number of weeks in the calendar.\n * - [[Units.MONTH]]: The number of months in the calendar.\n * - [[Units.YEAR]]: The number of years in the calendar.\n */\n public size: number;\n\n /**\n * The function used to move the start day of the calendar when functions like\n * [[Calendar.next]] or [[Calendar.prev]] are called.\n */\n public moveStart: CalendarMover;\n\n /**\n * The function used to move the end day of the calendar when functions like\n * [[Calendar.next]] or [[Calendar.prev]] are called.\n */\n public moveEnd: CalendarMover;\n\n\n /**\n * If the calendar should be filled in so the first day of the calendar is\n * Sunday and the last day is Saturday.\n */\n public fill: boolean = false;\n\n /**\n * The minimum number of days in the calendar no matter what the type or size\n * is. This can be used to display a month with a constant number of weeks -\n * because not all months contain the same number of weeks.\n */\n public minimumSize: number = 0;\n\n /**\n * When `true` a [[CalendarEvent]] instance exists on each [[CalendarDay]]\n * the event covers even if the event didn't start on that day.\n */\n public repeatCovers: boolean = true;\n\n /**\n * When `true` an event instance will be created for each time specified on\n * the schedule. If the schedule specifies an all day event then only one\n * event is added to a day. This is typically done when displaying days or\n * weeks and events can be displayed on a timeline.\n */\n public listTimes: boolean = false;\n\n /**\n * When `true` events will be added to days \"outside\" the calendar. Days\n * outside the calendar are days filled in when [[Calendar.fill]] is `true`.\n * More specifically days that are in [[Calendar.filled]] and not in\n * [[Calendar.span]].\n */\n public eventsOutside: boolean = false;\n\n /**\n * When `true` [[CalendarEvent.row]] will be set so when visually displaying\n * the event with others multi-day events will align and not overlap.\n */\n public updateRows: boolean = false;\n\n /**\n * When `true` [[CalendarEvent.col]] will be set so when visually displaying\n * the event based on start and end time any events that overlap with each\n * other will be \"indented\" to see the event below it.\n */\n public updateColumns: boolean = false;\n\n /**\n * The function (if any) which sorts the events on a calendar day.\n */\n public eventSorter: SortEvent = null;\n\n /**\n * A function to use when parsing meta input into the desired type.\n *\n * @param input The input to parse.\n * @returns The meta parsed from the given input, if any.\n */\n public parseMeta: (input: any) => M = (x => x);\n\n /**\n * A function to use when parsing meta input into the desired type.\n *\n * @param input The input to parse.\n * @returns The meta parsed from the given input, if any.\n */\n public parseData: (input: any) => T = (x => x);\n\n /**\n * A selection of days on the calendar. If no days are selected this is `null`.\n * This is merely used to keep the selection flags in [[CalendarDay]] updated\n * via [[Calendar.refreshSelection]].\n */\n public selection: DaySpan = null;\n\n /**\n * The array of days in this calendar and their events.\n */\n public days: CalendarDay[] = [];\n\n /**\n * The array of scheduled events added to the calendar.\n */\n public events: Event[] = [];\n\n /**\n * The array of visible events on the calendar. This is built based on the\n * span of the schedule in the given event and also the [[Event.visible]] flag.\n */\n public visible: Event[] = [];\n\n\n /**\n * Creates a new calendar given a span, type, size, moving functions, and\n * optionally some default properties for the calendar.\n *\n * @param start The first day on the calendar.\n * @param end The last day on the calendar.\n * @param type The calendar type used for describing the calendar and splitting it.\n * @param size The number of calendar types in this calendar.\n * @param moveStart The function to move the start day.\n * @param moveEnd The function to move the end by.\n * @param input The default properties for this calendar.\n * @see [[Calendar.start]]\n * @see [[Calendar.end]]\n * @see [[Calendar.type]]\n * @see [[Calendar.size]]\n * @see [[Calendar.moveStart]]\n * @see [[Calendar.moveEnd]]\n */\n public constructor(start: Day, end: Day, type: Units, size: number, moveStart: CalendarMover, moveEnd: CalendarMover, input?: CalendarInput)\n {\n this.span = new DaySpan(start, end);\n this.filled = new DaySpan(start, end);\n this.type = type;\n this.size = size;\n this.moveStart = moveStart;\n this.moveEnd = moveEnd;\n\n if (fn.isDefined(input))\n {\n this.set( input );\n }\n else\n {\n this.refresh();\n }\n }\n\n /**\n * Changes the calendar possibly morphing it to a different type or size if\n * specified in the given input. If the type and size are not morphed then\n * the following properties may be updated:\n *\n * - [[Calendar.fill]]\n * - [[Calendar.minimumSize]]\n * - [[Calendar.repeatCovers]]\n * - [[Calendar.listTimes]]\n * - [[Calendar.eventsOutside]]\n * - [[Calendar.updateRows]]\n * - [[Calendar.updateColumns]]\n * - [[Calendar.eventSorter]]\n * - [[Calendar.events]]\n * - [[Calendar.parseData]]\n * - [[Calendar.parseMeta]]\n *\n * If [[CalendarInput.delayRefresh]] is not given with `true` then\n * [[Calendar.refresh]] will be called once the calendar properties have been\n * updated.\n *\n * @param input The new properties for this calendar to overwrite with.\n */\n public set(input: CalendarInput): this\n {\n type CTD = CalendarTypeDefinition;\n\n let typeChange: boolean = fn.isDefined(input.type) && input.type !== this.type;\n let sizeChange: boolean = fn.isDefined(input.size) && input.size !== this.size;\n\n if (typeChange || sizeChange)\n {\n let focus: number = fn.coalesce( input.otherwiseFocus, 0.4999 );\n let prefer: boolean = fn.coalesce( input.preferToday, true );\n let size: number = fn.coalesce( input.size, this.size );\n let type: Units = fn.coalesce( input.type, this.type );\n let around: DayInput = fn.coalesce( input.around, this.days[ Math.floor( (this.days.length - 1) * focus ) ] );\n let today: Day = Day.today();\n\n if (!around || (prefer && this.span.matchesDay(today)))\n {\n around = today;\n }\n\n let meta: CTD = Calendar.TYPES[ type ];\n let start: Day = meta.getStart( Day.parse( around ), size, focus );\n let end: Day = meta.getEnd( start, size, focus );\n\n this.span.start = start;\n this.span.end = end;\n this.type = type;\n this.size = size;\n this.moveStart = meta.moveStart;\n this.moveEnd = meta.moveEnd;\n }\n else if (input.around)\n {\n let focus: number = fn.coalesce( input.otherwiseFocus, 0.4999 );\n let around: Day = Day.parse( input.around );\n let type: Units = this.type;\n let size: number = this.size;\n let meta: CTD = Calendar.TYPES[ type ];\n let start: Day = meta.getStart( around, size, focus );\n let end: Day = meta.getEnd( start, size, focus );\n\n this.span.start = start;\n this.span.end = end;\n }\n\n this.fill = fn.coalesce( input.fill, this.fill );\n this.minimumSize = fn.coalesce( input.minimumSize, this.minimumSize );\n this.repeatCovers = fn.coalesce( input.repeatCovers, this.repeatCovers );\n this.listTimes = fn.coalesce( input.listTimes, this.listTimes );\n this.eventsOutside = fn.coalesce( input.eventsOutside, this.eventsOutside );\n this.updateRows = fn.coalesce( input.updateRows, this.updateRows );\n this.updateColumns = fn.coalesce( input.updateColumns, this.updateColumns );\n this.eventSorter = fn.coalesce( input.eventSorter, this.eventSorter );\n this.parseMeta = fn.coalesce( input.parseMeta, this.parseMeta );\n this.parseData = fn.coalesce( input.parseData, this.parseData );\n\n if (fn.isArray(input.events))\n {\n this.removeEvents();\n this.addEvents(input.events, false, true);\n }\n\n if (!input.delayRefresh)\n {\n this.refresh();\n }\n\n return this;\n }\n\n /**\n * Sets the [[Calendar.minimumSize]] value and returns `this` for method\n * chaining.\n *\n * @param minimumSize The new value.\n */\n public withMinimumSize(minimumSize: number): this\n {\n this.minimumSize = minimumSize;\n this.refresh();\n\n return this;\n }\n\n /**\n * Sets the [[Calendar.repeatCovers]] value and returns `this` for method\n * chaining.\n *\n * @param repeatCovers The new value.\n */\n public withRepeatCovers(repeatCovers: boolean): this\n {\n this.repeatCovers = repeatCovers;\n this.refreshEvents();\n\n return this;\n }\n\n /**\n * Sets the [[Calendar.listTimes]] value and returns `this` for method\n * chaining.\n *\n * @param listTimes The new value.\n */\n public withListTimes(listTimes: boolean): this\n {\n this.listTimes = listTimes;\n this.refreshEvents();\n\n return this;\n }\n\n /**\n * Sets the [[Calendar.eventsOutside]] value and returns `this` for method\n * chaining.\n *\n * @param eventsOutside The new value.\n */\n public withEventsOutside(eventsOutside: boolean): this\n {\n this.eventsOutside = eventsOutside;\n this.refreshEvents();\n\n return this;\n }\n\n /**\n * Sets the [[Calendar.updateRows]] value and returns `this` for method\n * chaining.\n *\n * @param updateRows The new value.\n * @param refresh If the rows should be updated now if `updateRows` is `true`.\n */\n public withUpdateRows(updateRows: boolean, refresh: boolean = true): this\n {\n this.updateRows = updateRows;\n\n if (refresh && updateRows)\n {\n this.refreshRows();\n }\n\n return this;\n }\n\n /**\n * Sets the [[Calendar.updateColumns]] value and returns `this` for method\n * chaining.\n *\n * @param updateColumns The new value.\n * @param refresh If the columns should be updated now if `updateColumns` is\n * `true`.\n */\n public withUpdateColumns(updateColumns: boolean, refresh: boolean = true): this\n {\n this.updateColumns = updateColumns;\n\n if (refresh && updateColumns)\n {\n this.refreshColumns();\n }\n\n return this;\n }\n\n /**\n * Returns the start day of the calendar. If this calendar is filled, this\n * may not represent the very first day in the calendar.\n */\n public get start(): Day\n {\n return this.span.start;\n }\n\n /**\n * Returns the end day of the calendar. If this calendar is filled, this\n * may not represent the very last day in the calendar.\n */\n public get end(): Day\n {\n return this.span.end;\n }\n\n /**\n * Returns the summary of the span of time this calendar represents.\n *\n * @param dayOfWeek [[DaySpan.summary]]\n * @param short [[DaySpan.summary]]\n * @param repeat [[DaySpan.summary]]\n * @param contextual [[DaySpan.summary]]\n * @param delimiter [[DaySpan.summary]]\n * @see [[DaySpan.summary]]\n */\n public summary(dayOfWeek: boolean = true, short: boolean = false, repeat: boolean = false, contextual: boolean = true, delimiter: string = ' - '): string\n {\n return this.span.summary( this.type, dayOfWeek, short, repeat, contextual, delimiter );\n }\n\n /**\n * Splits up this calendar into an iterable collection of calendars. The\n * resulting iterator will return `size / by` number of calendars.\n *\n * @param by The new size of the resulting calendars. If the the size of the\n * current calendar is not divisible by this value the resulting calendars\n * may cover more or less than this calendar covers.\n * @returns An iterator for the calendars produced.\n */\n public split(by: number = 1): Iterator>\n {\n return new Iterator>(iterator =>\n {\n let start: Day = this.start;\n let end: Day = this.moveEnd( this.end, by - this.size );\n\n for (let i = 0; i < this.size; i++)\n {\n let calendar = new Calendar(start, end, this.type, by, this.moveStart, this.moveEnd, this);\n\n if (iterator.act(calendar) === IteratorAction.Stop)\n {\n return;\n }\n\n start = this.moveStart( start, by );\n end = this.moveEnd( end, by );\n }\n });\n }\n\n /**\n * Refreshes the days and events in this calendar based on the start and end\n * days, the calendar properties, and its eventss.\n *\n * @param today The current day to update the calendar days via\n * [[CalendarDay.updateCurrent]].\n */\n public refresh(today: Day = Day.today()): this\n {\n this.length = this.span.days(Op.UP, true);\n this.resetDays();\n this.refreshCurrent(today);\n this.refreshSelection();\n this.refreshVisible();\n this.refreshEvents();\n\n return this;\n }\n\n /**\n * Updates the [[Calendar.filled]] span based on [[Calendar.start]],\n * [[Calendar.end]], and [[Calendar.fill]] properties.\n */\n public resetFilled(): this\n {\n this.filled.start = this.fill ? this.start.startOfWeek() : this.start;\n this.filled.end = this.fill ? this.end.endOfWeek() : this.end;\n\n return this;\n }\n\n /**\n * Updates [[Calendar.days]] to match the span of days in the calendar.\n */\n public resetDays(): this\n {\n this.resetFilled();\n\n let days: CalendarDay[] = this.days;\n let filled: DaySpan = this.filled;\n let current: Day = filled.start;\n let daysBetween: number = filled.days(Op.UP);\n let total: number = Math.max( this.minimumSize, daysBetween );\n\n for (let i = 0; i < total; i++)\n {\n let day: CalendarDay = days[ i ];\n\n if (!day || !day.sameDay( current ))\n {\n day = new CalendarDay( current.date );\n\n if (i < days.length)\n {\n days.splice( i, 1, day );\n }\n else\n {\n days.push( day );\n }\n }\n\n day.inCalendar = this.span.contains( day );\n\n current = current.next();\n }\n\n if (days.length > total)\n {\n days.splice( total, days.length - total );\n }\n\n return this;\n }\n\n /**\n * Updates the list of visible schedules.\n */\n public refreshVisible(): this\n {\n let start: Day = this.filled.start;\n let end: Day = this.filled.end;\n\n this.visible = this.events.filter(e =>\n {\n return e.visible && e.schedule.matchesRange(start, end);\n });\n\n return this;\n }\n\n /**\n * Updates the days with the current day via [[CalendarDay.updateCurrent]].\n *\n * @param today The new current day.\n */\n public refreshCurrent(today: Day = Day.today()): this\n {\n this.iterateDays().iterate(d =>\n {\n d.updateCurrent(today);\n });\n\n return this;\n }\n\n /**\n * Updates the selection flags in [[CalendarDay]] based on the\n * [[Calendar.selection]] property.\n */\n public refreshSelection(): this\n {\n this.iterateDays().iterate(d =>\n {\n if (this.selection)\n {\n d.updateSelected( this.selection );\n }\n else\n {\n d.clearSelected();\n }\n });\n\n return this;\n }\n\n /**\n * Updates the [[CalendarDay.events]] based on the events in this calendar\n * and the following properties:\n *\n * - [[Calendar.eventsForDay]]\n * - [[Calendar.eventsOutside]]\n * - [[Calendar.listTimes]]\n * - [[Calendar.repeatCovers]]\n * - [[Calendar.updateRows]]\n * - [[Calendar.updateColumns]]\n */\n public refreshEvents(): this\n {\n this.iterateDays().iterate(d =>\n {\n if (d.inCalendar || this.eventsOutside)\n {\n d.events = this.eventsForDay(d, this.listTimes, this.repeatCovers);\n }\n });\n\n if (this.updateRows)\n {\n this.refreshRows();\n }\n\n if (this.updateColumns)\n {\n this.refreshColumns();\n }\n\n return this;\n }\n\n /**\n * Refreshes the [[CalendarEvent.row]] property as described in the link.\n */\n public refreshRows(): this\n {\n type EventToRowMap = { [id: number]: number };\n type UsedMap = { [row: number]: boolean };\n\n let eventToRow: EventToRowMap = {};\n let onlyFullDay: boolean = this.listTimes;\n\n this.iterateDays().iterate(d =>\n {\n if (d.dayOfWeek === 0)\n {\n eventToRow = {};\n }\n\n let used: UsedMap = {};\n\n for (let event of d.events)\n {\n if (onlyFullDay && !event.fullDay)\n {\n continue;\n }\n\n if (event.id in eventToRow)\n {\n used[ event.row = eventToRow[ event.id ] ] = true;\n }\n }\n\n let rowIndex: number = 0;\n\n for (let event of d.events)\n {\n if ((onlyFullDay && !event.fullDay) || event.id in eventToRow)\n {\n continue;\n }\n\n while (used[ rowIndex ])\n {\n rowIndex++;\n }\n\n eventToRow[ event.id ] = event.row = rowIndex;\n\n rowIndex++;\n }\n });\n\n return this;\n }\n\n /**\n * Refreshes the [[CalendarEvent.col]] property as described in the link.\n */\n public refreshColumns(): this\n {\n interface Marker {\n time: number,\n event: CalendarEvent,\n start: boolean,\n parent: Marker;\n }\n\n this.iterateDays().iterate(d =>\n {\n let markers: Marker[] = [];\n\n for (let event of d.events)\n {\n if (!event.fullDay)\n {\n markers.push({\n time: event.time.start.time,\n event: event,\n start: true,\n parent: null\n });\n\n markers.push({\n time: event.time.end.time - 1,\n event: event,\n start: false,\n parent: null\n });\n }\n }\n\n markers.sort((a, b) =>\n {\n return a.time - b.time;\n });\n\n let parent = null;\n\n for (let marker of markers)\n {\n if (marker.start)\n {\n marker.parent = parent;\n parent = marker;\n }\n else if (parent)\n {\n parent = parent.parent;\n }\n }\n\n for (let marker of markers)\n {\n if (marker.start)\n {\n marker.event.col = marker.parent ? marker.parent.event.col + 1 : 0;\n }\n }\n });\n\n return this;\n }\n\n /**\n * Iterates over all days in this calendar and passes each day to `iterator`.\n *\n * @param iterator The function to pass [[CalendarDay]]s to.\n */\n public iterateDays(): Iterator>\n {\n return new Iterator>(iterator =>\n {\n let days: CalendarDay[] = this.days;\n\n for (let i = 0; i < days.length; i++)\n {\n switch (iterator.act(days[ i ]))\n {\n case IteratorAction.Stop:\n return;\n }\n }\n });\n }\n\n /**\n * Returns the events for the given day optionally looking at schedule times,\n * optionally looking at events which cover multiple days, and optionally\n * sorted with the given function.\n *\n * @param day The day to find events for.\n * @param getTimes When `true` an event is added to the result for each time\n * specified in the schedule.\n * @param covers When `true` events which don't start on the given day but do\n * overlap are added to the result.\n * @param sorter The function to sort the events by, if any.\n * @returns An array of events that occurred on the given day.\n */\n public eventsForDay(day: Day, getTimes: boolean = true, covers: boolean = true, sorter: SortEvent = this.eventSorter): CalendarEvent[]\n {\n let events: CalendarEvent[] = [];\n let entries: Event[] = this.visible;\n\n for (let entryIndex = 0; entryIndex < entries.length; entryIndex++)\n {\n let entry: Event = entries[ entryIndex ];\n let schedule: Schedule = entry.schedule;\n let eventId: number = entryIndex * Constants.MAX_EVENTS_PER_DAY;\n let timeIndex: number = 0;\n\n schedule.iterateSpans( day, covers ).iterate((span, iterator) =>\n {\n events.push(new CalendarEvent(eventId + timeIndex++, entry, span, day));\n\n if (!getTimes)\n {\n iterator.stop();\n }\n });\n }\n\n if (sorter)\n {\n events.sort( sorter );\n }\n\n return events\n }\n\n /**\n * Finds the event given one of the ways to identify the event.\n *\n * @param input The value to use to search for an event.\n * @returns The refrence to the event or null if not found.\n */\n public findEvent(id: any): Event\n {\n for (let event of this.events)\n {\n if (event === id || event.schedule === id || event.data === id || event.id === id)\n {\n return event;\n }\n }\n\n return null;\n }\n\n /**\n * Removes the list of events if they exist in the calendar.\n *\n * @param events The array of events to remove if they exist. If no\n * events are passed (via `null`) then all events will be removed\n * from the calendar.\n * @param delayRefresh When `true` the [[Calendar.refreshEvents]] will not be\n * called after the events are removed.\n * @see [[Calendar.removeEvent]]\n * @see [[Calendar.refreshEvents]]\n */\n public removeEvents(events: any[] = null, delayRefresh: boolean = false): this\n {\n if (events)\n {\n for (let event of events)\n {\n this.removeEvent( event, true );\n }\n }\n else\n {\n this.events = [];\n }\n\n this.refreshVisible();\n\n if (!delayRefresh)\n {\n this.refreshEvents();\n }\n\n return this;\n }\n\n /**\n * Removes the given event if it exists on the calendar.\n *\n * @param event The event to remove if it exists.\n * @param delayRefresh When `true` the [[Calendar.refreshEvents]] will not be\n * called after the event is removed.\n * @see [[Calendar.refreshEvents]]\n */\n public removeEvent(event: any, delayRefresh: boolean = false): this\n {\n let found: Event = this.findEvent(event);\n\n if (found)\n {\n this.events.splice( this.events.indexOf(found), 1 );\n\n this.refreshVisible();\n\n if (!delayRefresh)\n {\n this.refreshEvents();\n }\n }\n\n return this;\n }\n\n /**\n * Adds the given event to this calendar if it doesn't exist already (or\n * `allowDuplicates` is `true`).\n *\n * @param event The event to add to the calendar.\n * @param allowDuplicates If an event can be added more than once.\n * @param delayRefresh When `true` the [[Calendar.refreshEvents]] will not be\n * called after the event is added.\n * @see [[Calendar.refreshEvents]]\n */\n public addEvent(event: EventInput, allowDuplicates: boolean = false, delayRefresh: boolean = false): this\n {\n let parsed: Event = Parse.event(event, this.parseData, this.parseMeta);\n\n if (!allowDuplicates)\n {\n let existing = this.findEvent(parsed);\n\n if (existing)\n {\n return this;\n }\n }\n\n this.events.push(parsed);\n\n this.refreshVisible();\n\n if (!delayRefresh)\n {\n this.refreshEvents();\n }\n\n return this;\n }\n\n /**\n * Adds the given events to this calendar if they don't exist already (or\n * `allowDuplicates` is `true`).\n *\n * @param events The events to add to the calendar.\n * @param allowDuplicates If an event can be added more than once.\n * @param delayRefresh When `true` the [[Calendar.refreshEvents]] will not be\n * called after the events are added.\n * @see [[Calendar.refreshEvents]]\n */\n public addEvents(events: EventInput[], allowDuplicates: boolean = false, delayRefresh: boolean = false): this\n {\n for (let event of events)\n {\n this.addEvent(event, allowDuplicates, true);\n }\n\n if (!delayRefresh)\n {\n this.refreshEvents();\n }\n\n return this;\n }\n\n /**\n * Sets the selection point or range of the calendar and updates the flags\n * in the days.\n *\n * @param start The start of the selection.\n * @param end The end of the selection.\n * @see [[Calendar.refreshSelection]]\n */\n public select(start: Day, end: Day = start): this\n {\n this.selection = new DaySpan( start, end );\n this.refreshSelection();\n\n return this;\n }\n\n /**\n * Sets the selection of the calendar to nothing.\n *\n * @see [[Calendar.refreshSelection]]\n */\n public unselect(): this\n {\n this.selection = null;\n this.refreshSelection();\n\n return this;\n }\n\n /**\n * Shifts the calendar days by the given amount.\n *\n * @param jump The amount to shift the calendar by.\n * @param delayRefresh When `true` [[Calendar.refresh]] will not be called\n * after calendar is moved.\n */\n public move(jump: number = this.size, delayRefresh: boolean = false): this\n {\n this.span.start = this.moveStart( this.start, jump );\n this.span.end = this.moveEnd( this.end, jump );\n\n if (!delayRefresh)\n {\n this.refresh();\n }\n\n return this;\n }\n\n /**\n * Moves the calenndar to the next set of days.\n *\n * @param jump The amount to shift the calendar by.\n * @param delayRefresh When `true` [[Calendar.refresh]] will not be called\n * after calendar is moved.\n */\n public next(jump: number = this.size, delayRefresh: boolean = false): this\n {\n return this.move( jump, delayRefresh );\n }\n\n /**\n * Moves the calenndar to the previous set of days.\n *\n * @param jump The amount to shift the calendar by.\n * @param delayRefresh When `true` [[Calendar.refresh]] will not be called\n * after calendar is moved.\n */\n public prev(jump: number = this.size, delayRefresh: boolean = false): this\n {\n return this.move( -jump, delayRefresh );\n }\n\n /**\n * Converts this calendar to input which can be used to later recreate this\n * calendar. The only properties of the calendar which will be loss is the\n * [[Calendar.eventSorter]] property because it is a function.\n *\n * @param plain If the returned input should be plain objects as opposed\n * to [[Day]] and [[Event]] instances.\n * @param plainData A function to convert [[Event.data]] to a plain object if\n * it is not already.\n * @param plainMeta A function to convert values in [[Schedule.meta]] to plain\n * objects if they are not alreday.\n * @returns The input generated from this calendar.\n */\n public toInput(plain: boolean = false,\n plainData: (data: T) => any = d => d,\n plainMeta: (meta: M) => any = m => m): CalendarInput\n {\n let out: CalendarInput = {};\n\n out.type = this.type;\n out.size = this.size;\n out.fill = this.fill;\n out.minimumSize = this.minimumSize;\n out.repeatCovers = this.repeatCovers;\n out.listTimes = this.listTimes;\n out.eventsOutside = this.eventsOutside;\n out.updateRows = this.updateRows;\n out.updateColumns = this.updateColumns;\n out.around = plain ? this.span.start.dayIdentifier : this.span.start;\n out.events = [];\n\n for (let event of this.events)\n {\n if (plain)\n {\n let plainEvent: any = {};\n\n if (fn.isDefined(event.id))\n {\n plainEvent.id = event.id;\n }\n\n if (fn.isDefined(event.data))\n {\n plainEvent.data = plainData( event.data );\n }\n\n if (!event.visible)\n {\n plainEvent.visible = event.visible;\n }\n\n plainEvent.schedule = event.schedule.toInput();\n\n let meta = plainEvent.schedule.meta;\n\n if (meta)\n {\n for (let identifier in meta)\n {\n meta[ identifier ] = plainMeta( meta[ identifier ] );\n }\n }\n\n out.events.push( plainEvent );\n }\n else\n {\n out.events.push( event );\n }\n }\n\n return out;\n }\n\n /**\n * Creates a calendar based on the given input.\n *\n * @param input The input which has at least the `type` specified.\n * @returns A new calendar instance.\n */\n public static fromInput(input: CalendarInput): Calendar\n {\n let initial: Day = Day.today();\n\n return new Calendar(initial, initial, null, 1, null, null, input);\n }\n\n /**\n * Creates a calendar based around a given unit optionally focused around a\n * given day.\n *\n * @param type The unit of the calendar.\n * @param days The number of units in the calendar.\n * @param around The day to focus the calendar on.\n * @param focus The value which describes how months are added around the given\n * day. The default value will center the calendar around the given day.\n * When the value is `0` the given day is the first day in the calendar,\n * and when the value is `1` the given day is the last day in the calendar.\n * @param input The default properties for the calendar.\n * @returns A new calendar instance.\n */\n public static forType(type: Units, size: number = 1, around: Day = Day.today(), focus: number = 0.49999, input?: CalendarInput): Calendar\n {\n let meta: CalendarTypeDefinition = this.TYPES[ type ];\n let start: Day = meta.getStart( around, size, focus );\n let end: Day = meta.getEnd( start, size, focus );\n\n return new Calendar(start, end, type, size, meta.moveStart, meta.moveEnd, input || meta.defaultInput);\n }\n\n\n /**\n * Creates a calendar based around days optionally focused around a given day.\n *\n * @param days The number of days in the calendar.\n * @param around The day to focus the calendar on.\n * @param focus The value which describes how days are added around the given\n * day. The default value will center the calendar around the given day.\n * When the value is `0` the given day is the first day in the calendar,\n * and when the value is `1` the given day is the last day in the calendar.\n * @param input The default properties for the calendar.\n * @returns A new calendar instance.\n * @see [[Calendar.forType]]\n */\n public static days(days: number = 1, around: Day = Day.today(), focus: number = 0.4999, input?: CalendarInput): Calendar\n {\n return this.forType( Units.DAY, days, around, focus, input );\n }\n\n /**\n * Creates a calendar based around weeks optionally focused around a given day.\n *\n * @param days The number of weeks in the calendar.\n * @param around The day to focus the calendar on.\n * @param focus The value which describes how weeks are added around the given\n * day. The default value will center the calendar around the given day.\n * When the value is `0` the given day is the first day in the calendar,\n * and when the value is `1` the given day is the last day in the calendar.\n * @param input The default properties for the calendar.\n * @returns A new calendar instance.\n * @see [[Calendar.forType]]\n */\n public static weeks(weeks: number = 1, around: Day = Day.today(), focus: number = 0.4999, input?: CalendarInput): Calendar\n {\n return this.forType( Units.WEEK, weeks, around, focus, input );\n }\n\n /**\n * Creates a calendar based around months optionally focused around a given day.\n *\n * @param days The number of months in the calendar.\n * @param around The day to focus the calendar on.\n * @param focus The value which describes how months are added around the given\n * day. The default value will center the calendar around the given day.\n * When the value is `0` the given day is the first day in the calendar,\n * and when the value is `1` the given day is the last day in the calendar.\n * @param input The default properties for the calendar.\n * @returns A new calendar instance.\n * @see [[Calendar.forType]]\n */\n public static months(months: number = 1, around: Day = Day.today(), focus: number = 0.4999, input?: CalendarInput): Calendar\n {\n return this.forType( Units.MONTH, months, around, focus, input );\n }\n\n /**\n * Creates a calendar based around years optionally focused around a given day.\n *\n * @param days The number of years in the calendar.\n * @param around The day to focus the calendar on.\n * @param focus The value which describes how years are added around the given\n * day. The default value will center the calendar around the given day.\n * When the value is `0` the given day is the first day in the calendar,\n * and when the value is `1` the given day is the last day in the calendar.\n * @param input The default properties for the calendar.\n * @returns A new calendar instance.\n * @see [[Calendar.forType]]\n */\n public static years(years: number = 1, around: Day = Day.today(), focus: number = 0.4999, input?: CalendarInput): Calendar\n {\n return this.forType( Units.YEAR, years, around, focus, input );\n }\n\n /**\n * A map of functions and properties by [[Units]] used to create or morph\n * Calendars.\n */\n public static TYPES: CalendarTypeDefinitionMap =\n {\n [Units.DAY]:\n {\n getStart(around: Day, size: number, focus: number): Day {\n return around.start().relativeDays( -Math.floor( size * focus ) )\n },\n getEnd(start: Day, size: number, focus: number): Day {\n return start.relativeDays( size - 1 ).end();\n },\n moveStart(day: Day, amount: number): Day {\n return day.relativeDays(amount);\n },\n moveEnd(day: Day, amount: number): Day {\n return day.relativeDays(amount);\n },\n defaultInput: undefined\n },\n [Units.WEEK]:\n {\n getStart(around: Day, size: number, focus: number): Day {\n return around.start().startOfWeek().relativeWeeks( -Math.floor( size * focus ) );\n },\n getEnd(start: Day, size: number, focus: number): Day {\n return start.relativeWeeks( size - 1 ).endOfWeek();\n },\n moveStart(day: Day, amount: number): Day {\n return day.relativeWeeks(amount);\n },\n moveEnd(day: Day, amount: number): Day {\n return day.relativeWeeks(amount);\n },\n defaultInput: undefined\n },\n [Units.MONTH]:\n {\n getStart(around: Day, size: number, focus: number): Day {\n return around.start().startOfMonth().relativeMonths( -Math.floor( size * focus ) );\n },\n getEnd(start: Day, size: number, focus: number): Day {\n return start.relativeMonths( size - 1 ).endOfMonth();\n },\n moveStart(day: Day, amount: number): Day {\n return day.relativeMonths(amount);\n },\n moveEnd(day: Day, amount: number): Day {\n return day.startOfMonth().relativeMonths(amount).endOfMonth();\n },\n defaultInput: { fill: true }\n },\n [Units.YEAR]:\n {\n getStart(around: Day, size: number, focus: number): Day {\n return around.start().startOfYear().relativeYears( -Math.floor( size * focus ) );\n },\n getEnd(start: Day, size: number, focus: number): Day {\n return start.relativeYears( size - 1 ).endOfYear();\n },\n moveStart(day: Day, amount: number): Day {\n return day.relativeYears(amount);\n },\n moveEnd(day: Day, amount: number): Day {\n return day.relativeYears(amount);\n },\n defaultInput: { fill: true }\n }\n };\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Calendar.ts","\n/**\n * The months in a year.\n */\nexport class Month\n{\n\n public static JANUARY: number = 0;\n public static FEBRUARY: number = 1;\n public static MARCH: number = 2;\n public static APRIL: number = 3;\n public static MAY: number = 4;\n public static JUNE: number = 5;\n public static JULY: number = 6;\n public static AUGUST: number = 7;\n public static SEPTEMBER: number = 8;\n public static OCTOBER: number = 9;\n public static NOVEMBER: number = 10;\n public static DECEMBER: number = 11;\n\n /**\n * The full list of months in a year.\n */\n public static LIST: number[] = [\n Month.JANUARY,\n Month.FEBRUARY,\n Month.MARCH,\n Month.APRIL,\n Month.MAY,\n Month.JUNE,\n Month.JULY,\n Month.AUGUST,\n Month.SEPTEMBER,\n Month.OCTOBER,\n Month.NOVEMBER,\n Month.DECEMBER\n ];\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Month.ts","\n\n/**\n * The days in a week.\n */\nexport class Weekday\n{\n\n public static SUNDAY: number = 0;\n public static MONDAY: number = 1;\n public static TUESDAY: number = 2;\n public static WEDNESDAY: number = 3;\n public static THURSDAY: number = 4;\n public static FRIDAY: number = 5;\n public static SATURDAY: number = 6;\n\n /**\n * The full list of days in a week.\n */\n public static LIST: number[] = [\n Weekday.SUNDAY,\n Weekday.MONDAY,\n Weekday.TUESDAY,\n Weekday.WEDNESDAY,\n Weekday.THURSDAY,\n Weekday.FRIDAY,\n Weekday.SATURDAY\n ];\n\n /**\n * The list of days starting with Monday and ending on Friday.\n */\n public static WEEK: number[] = [\n Weekday.MONDAY,\n Weekday.TUESDAY,\n Weekday.WEDNESDAY,\n Weekday.THURSDAY,\n Weekday.FRIDAY\n ];\n\n /**\n * The days on the weekend, starting with Saturday and ending with Sunday.\n */\n public static ENDS: number[] = [\n Weekday.SATURDAY,\n Weekday.SUNDAY\n ];\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Weekday.ts","\nimport { CalendarEvent } from './CalendarEvent';\nimport { Event } from './Event';\n\n\n/**\n * A function which takes two [[CalendarEvent]]s and returns a number which\n * instructs a sort which event goes before the other in a list.\n *\n * @param a The first event.\n * @param b The second event.\n * @returns When both events are considered equal `0` is returned, when the\n * first event should go before the second event a negative number is\n * returned, when the second event should go before the first event a\n * positive number is returned.\n */\nexport type SortEvent = (a: CalendarEvent, b: CalendarEvent) => number;\n\n/**\n * A class with [[SortEvent]] functions and functions which accept other\n * [[SortEvent]]s and return a new [[SortEvent]].\n *\n * ```typescript\n * // Sorts full day events first, then events in descending order based on start time.\n * Sorts.List([Sorts.FullDay, Sorts.Desc(Sorts.Start)]);\n * ```\n */\nexport class Sorts\n{\n\n /**\n * Sorts the two events by their start time - the earliest event being first\n * in order.\n *\n * @param a The first event.\n * @param b The second event.\n * @returns The difference in time between the start of `a` and `b`.\n * @see [[CalendarEvent.time]]\n */\n public static Start(a: CalendarEvent, b: CalendarEvent): number\n {\n return a.time.start.time - b.time.start.time;\n }\n\n /**\n * Sorts the two events by their end time - the earliest to end being first\n * in order.\n *\n * @param a The first event.\n * @param b The second event.\n * @returns The difference in time between the end of `a` and `b`.\n * @see [[CalendarEvent.time]]\n */\n public static End(a: CalendarEvent, b: CalendarEvent): number\n {\n return a.time.end.time - b.time.end.time;\n }\n\n /**\n * Sorts the two events placing the full day events before the timed events.\n *\n * @param a The first event.\n * @param b The second event.\n * @returns If both are timed or both are full day then `0` is returned,\n * otherwise `-1` is returned if `a` is full day and `1` is returned if\n * `b` is full day.\n * @see [[CalendarEvent.fullDay]]\n */\n public static FullDay(a: CalendarEvent, b: CalendarEvent): number\n {\n let af: number = a.fullDay ? 0 : 1;\n let bf: number = b.fullDay ? 0 : 1;\n\n return af - bf;\n }\n\n /**\n * Sorts the two events placing the shorter events before the longer events.\n * Full day or multiple day events actually take up a day and will be ordered\n * last.\n *\n * @param a The first event.\n * @param b The second event.\n * @returns The difference in milliseconds between `a` and `b`.\n * @see [[CalendarEvent.time]]\n * @see [[DaySpan.millis]]\n */\n public static Duration(a: CalendarEvent, b: CalendarEvent): number\n {\n return a.time.millis() - b.time.millis();\n }\n\n /**\n * Returns a [[SortEvent]] that effectively orders the given sorter in the\n * opposite (often descending) order.\n *\n * @param sorter The sorter to reverse.\n * @returns A new sorter which reverses the one passed in.\n */\n public static Desc(sorter: SortEvent): SortEvent\n {\n return (a, b) =>\n {\n return sorter( b, a );\n };\n }\n\n /**\n * Returns a [[SortEvent]] that orders the events based on a string in each\n * event. A function must be supplied which takes an event of type `T` and\n * returns a string.\n *\n * @param getString A function which returns a string from the event.\n * @returns A sorter which sorts strings alphabetically.\n */\n public static Alphabetical(getString: (event: Event) => string): SortEvent\n {\n return (a, b) =>\n {\n let as: string = getString( a.event ) || '';\n let bs: string = getString( b.event ) || '';\n\n return as.localeCompare( bs );\n };\n }\n\n /**\n * Returns a [[SortEvent]] that orders events based on a number in each event.\n * A function must be supplied which takes an event of type `T` and returns\n * a number.\n *\n * @param getOrder A function which returns a number from the event.\n * @returns A sorter which sorts events based on a number in ascending order.\n */\n public static Ordered(getOrder: (event: Event) => number): SortEvent\n {\n return (a, b) =>\n {\n let ao: number = getOrder( a.event );\n let bo: number = getOrder( b.event );\n\n return ao - bo;\n };\n }\n\n /**\n * Returns a [[SortEvent]] that orders events based on an array of sorters.\n * The first sorter which returns a non-zero result is used.\n *\n * @param sorters A list of sorting functions to test one at a time.\n * @returns A sorter which sorts based on a list of sorters.\n */\n public static List(sorters: SortEvent[]): SortEvent\n {\n return (a, b) =>\n {\n for (let sorter of sorters)\n {\n let compare: number = sorter(a, b);\n\n if (compare !== 0)\n {\n return compare;\n }\n }\n\n return 0;\n };\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Sort.ts"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///dayspan.min.js","webpack:///webpack/bootstrap c5a06ab01e1bacc5f64e","webpack:///external {\"commonjs\":\"moment\",\"commonjs2\":\"moment\",\"amd\":\"moment\",\"root\":\"moment\"}","webpack:///./src/Operation.ts","webpack:///./src/Functions.ts","webpack:///./src/Units.ts","webpack:///./src/Constants.ts","webpack:///./src/DaySpan.ts","webpack:///./src/Identifier.ts","webpack:///./src/Suffix.ts","webpack:///./src/Iterator.ts","webpack:///./src/Pattern.ts","webpack:///./src/ScheduleModifier.ts","webpack:///./src/Schedule.ts","webpack:///./src/Event.ts","webpack:///./src/Time.ts","webpack:///./src/Parse.ts","webpack:///./src/Day.ts","webpack:///./src/CalendarDay.ts","webpack:///./src/CalendarEvent.ts","webpack:///./src/Calendar.ts","webpack:///./src/Month.ts","webpack:///./src/Weekday.ts","webpack:///./src/Sort.ts"],"names":["root","factory","exports","module","require","define","amd","this","__WEBPACK_EXTERNAL_MODULE_0__","modules","__webpack_require__","moduleId","installedModules","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","__webpack_exports__","operate","value","op","absolute","isFinite","Math","abs","Op","NONE","FLOOR","floor","CEIL","ceil","ROUND","round","TRUNCATE","DOWN","UP","Functions","isArray","input","Array","isArrayEquals","x","y","length","isString","isNumber","isObject","isDefined","isValue","isFrequencyValueEvery","every","isFrequencyValueOneOf","coalesce","a","b","extend","target","from","prop","pad","padding","before","padNumber","first","substring","Units","DaySpan__a","Constants","MILLIS_IN_SECOND","MILLIS_IN_MINUTE","MILLIS_IN_HOUR","MILLIS_IN_DAY","MILLIS_IN_WEEK","DAYS_IN_WEEK","MONTHS_IN_YEAR","HOURS_IN_DAY","MONTH_MIN","MONTH_MAX","DAY_MIN","DAY_MAX","HOUR_MIN","HOUR_MAX","MINUTE_MIN","MINUTE_MAX","SECOND_MIN","SECOND_MAX","MILLIS_MIN","MILLIS_MAX","WEEKDAY_MIN","WEEKDAY_MAX","DURATION_DEFAULT","DURATION_DEFAULT_UNIT_ALL","DURATION_DEFAULT_UNIT_TIMES","DURATION_DEFAULT_UNIT","all","DURATION_TO_MILLIS","minute","minutes","hour","hours","day","days","week","weeks","month","months","MAX_EVENTS_PER_DAY","WEEK_OF_MONTH_MINIMUM_WEEKDAY","DaySpan_DaySpan","DaySpan","start","end","time","contains","compareTo","matchesDay","sameDay","matchesWeek","sameWeek","matchesMonth","sameMonth","matchesYear","sameYear","millis","millisBetween","seconds","secondsBetween","minutesBetween","hoursBetween","daysBetween","weeksBetween","monthsBetween","years","yearsBetween","startDelta","relativeTo","endDelta","getBounds","dayHeight","dayWidth","columnOffset","clip","offsetX","offsetY","startRaw","endRaw","max","min","left","right","top","bottom","height","width","summary","type","dayOfWeek","short","repeat","contextual","delimiter","formats","SUMMARY_FORMATS","today","Day_Day","showStartYear","showEndYear","format","intersects","span","intersection","isAfter","union","point","DAY","year","WEEK","MONTH","YEAR","__extends","extendStatics","setPrototypeOf","__proto__","__","constructor","create","Identifier_Identifier","Identifier","is","id","getLength","compute","values","_i","arguments","scales","getScales","total","decompute","parseInt","curr","next","mod","push","find","Time","Day","Week","Month","Year","outer","inner","outerString","Quarter","Identifier_IdentifierTime","_super","IdentifierTime","apply","SCALES","LENGTH","dayOfMonth","obj","build","endInclusive","endOfHour","describe","DESCRIBE_FORMAT_SHORT","DESCRIBE_FORMAT_LONG","matches","timeIdentifier","Identifier_IdentifierDay","IdentifierDay","dayIdentifier","Identifier_IdentifierWeek","IdentifierWeek","withWeek","endOfWeek","weekIdentifier","Identifier_IdentifierMonth","IdentifierMonth","endOfMonth","monthIdentifier","Identifier_IdentifierQuarter","IdentifierQuarter","quarter","relativeMonths","quarterIdentifier","Identifier_IdentifierYear","IdentifierYear","endOfYear","IteratorAction","Suffix","_CACHE","_CACHE_SIZE","determine","MAP","prepend","suffix","Calendar__a","Iterator_Iterator","Iterator","source","result","clone","act","item","action","Continue","callback","stop","Stop","remove","Remove","isEmpty","filter","empty","iterate","iterator","count","list","out","getKey","key","take","amount","_this","prev","skip","skipped","append","iterators","join","concat","purge","reverse","items","removed","indexOf","reduce","initial","reducer","reduced","prevItem","map","mapper","nextItem","undefined","withResult","getResult","forArray","splice","forObject","parent","iterators_1","child","childIterator","ScheduleModifier_ScheduleModifier","ScheduleModifier","clear","otherwise","lookAtTime","getAll","move","fromType","to","toType","fromIdentifier","toIdentifier","moveTime","fromTime","toTime","moveIds","_a","sameTime","moved","moveIds_1","newStart","withTime","newId","set","unset","rawId","asNumber","validAsNumber","query","identifiers","spans","describeMap","__WEBPACK_IMPORTED_MODULE_10_moment__","Schedule_Schedule","Schedule","exclude","include","cancel","meta","parseMeta","Parse_Parse","schedule","times","isFullDay","updateDurationInDays","lastTime","toMilliseconds","duration","durationUnit","durationInDays","updateChecks","checks","givenFrequency","weekOfYear","fullWeekOfYear","weekspanOfYear","lastFullWeekOfYear","lastWeekspanOfYear","weekOfMonth","weekspanOfMonth","fullWeekOfMonth","lastWeekspanOfMonth","lastFullWeekOfMonth","lastDayOfMonth","dayOfYear","matchesSpan","isSameOrAfter","isBefore","matchesRange","isExcluded","isIncluded","isCancelled","getMeta","getMetas","setFullDay","fullDay","defaultTime","adjustDefinedSpan","addSpan","single","getSingleEventSpan","getFullSpan","add","getTimeSpan","isFullyExcluded","check","hasIncludedTime","iterateIncludeTimes","nextDay","includeDay","lookAhead","iterateDaycast","nextDays","prevDay","lookBack","prevDays","lookup","iterated","iterateSpans","covers","current","lookBehind","timeIterator","matchesTime","sameMinute","coversDay","coversTime","setFrequency","frequency","setExcluded","excluded","identifierType","setCancelled","cancelled","moveSingleEvent","moveInstance","found","takeTime","isSingleEvent","asTime","startOfYear","isSingleYear","isSingleDayOfYear","isSingleMonth","isSingleDayOfMonth","isSingleWeekOfMonth","isSingleDayOfWeek","isSingleWeekOfYear","isSingleFrequency","forecast","around","daysAfter","daysBefore","lookAround","tuplesForDay","tuples","last","offset","matchAgainst","isIncludedTime","getSpan","toInput","returnDays","returnTimes","timeFormat","alwaysDuration","defaultUnit","exclusions","v","inclusions","cancels","hasMeta","toString","thing","includeRange","includeTimes","includeDuration","includeExcludes","includeIncludes","includeCancels","describeRule","CACHE","describeArray","excludes","includes","unit","everyOffset","the","on","required","valueEvery","valueOne","array","Event","data","visible","Time_Time","second","millisecond","formatterEntries","FORMATTERS","handled","k","entry","part","size","formatter","charAt","matchesHour","matchesMinute","matchesSecond","toObject","parse","fromString","REGEX","exec","h","SSS","t","HH","hh","kk","mm","ss","SS","A","H","S","Parse","given","every_1","offset_1","map_1","unix","fromArray","fromObject","input_1","timeInput","sort","modifier","input_2","identifier","checks_1","event","parseData","cron","pattern","__WEBPACK_IMPORTED_MODULE_5_moment__","date","valueOf","getLastDayOfMonth","getWeekOfYear","getWeekspanOfYear","getFullWeekOfYear","getLastWeekspanOfYear","getLastFullWeekOfYear","getWeekOfMonth","getWeekspanOfMonth","getFullWeekOfMonth","getLastWeekspanOfMonth","getLastFullWeekOfMonth","sameQuarter","sameHour","precision","isSameOrBefore","diff","isBetween","inclusive","mutate","mutator","toMoment","relative","relativeDays","withDayOfMonth","withDayOfWeek","withDayOfYear","withMonth","prevMonth","nextMonth","relativeWeek","withWeekOfYear","withFullWeekOfYear","withWeekspanOfYear","withWeekOfMonth","withWeekspanOfMonth","withFullWeekOfMonth","relativeWeeks","prevWeek","nextWeek","withYear","relativeYears","prevYear","nextYear","withHour","relativeHours","prevHour","nextHour","withTimes","startOf","isStart","endOf","isEnd","startOfHour","isStartOfHour","isEndOfHour","startOfWeek","isStartOfWeek","isEndOfWeek","startOfMonth","isStartOfMonth","isEndOfMonth","daysInMonth","isStartOfYear","isEndOfYear","daysInYear","weeksInYear","utc","keepLocalTime","toDate","toArray","toJSON","toISOString","keepOffset","isDST","isLeapYear","now","tomorrow","fromMoment","moment","isValid","unixSeconds","fromFormat","fromDate","fromDayIdentifier","lastOfYear","firstOfYear","weeksMax","lastWeek","dom","dow","sundayDate","CalendarDay___extends","CalendarDay_CalendarDay","CalendarDay","currentDay","currentWeek","currentMonth","currentYear","currentOffset","selectedDay","selectedWeek","selectedMonth","selectedYear","inCalendar","events","updateCurrent","updateSelected","selected","clearSelected","CalendarEvent_CalendarEvent","CalendarEvent","actualDay","row","col","starting","isPoint","ending","getTimeBounds","Calendar_Calendar","Calendar","moveStart","moveEnd","fill","minimumSize","repeatCovers","listTimes","eventsOutside","updateRows","updateColumns","eventSorter","selection","filled","refresh","typeChange","sizeChange","focus_1","otherwiseFocus","prefer","preferToday","TYPES","getStart","getEnd","focus_2","removeEvents","addEvents","delayRefresh","withMinimumSize","withRepeatCovers","refreshEvents","withListTimes","withEventsOutside","withUpdateRows","refreshRows","withUpdateColumns","refreshColumns","split","by","calendar","resetDays","refreshCurrent","refreshSelection","refreshVisible","resetFilled","e","iterateDays","eventsForDay","eventToRow","onlyFullDay","used","event_1","rowIndex","_b","_c","event_2","markers","event_3","markers_1","marker","markers_2","getTimes","sorter","entries","entryIndex","eventId","timeIndex","findEvent","event_4","events_1","event_5","removeEvent","addEvent","allowDuplicates","parsed","events_2","event_6","select","unselect","jump","plain","plainData","plainMeta","event_7","plainEvent","fromInput","forType","focus","defaultInput","JANUARY","FEBRUARY","MARCH","APRIL","MAY","JUNE","JULY","AUGUST","SEPTEMBER","OCTOBER","NOVEMBER","DECEMBER","LIST","Weekday","SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY","ENDS","Pattern_Pattern","Pattern","listed","rules","applyGeneric","removeFrequency","PROPS","rule","isMatch","exactlyWith","isMatchGeneric","getFrequency","exactly","ruleOffset","withName","PatternMap","findMatch","listedOnly","Patterns_1","Patterns","Pattern__i","Patterns_2","Pattern_pattern","Sorts","Start","End","FullDay","Duration","Desc","Alphabetical","getString","as","bs","localeCompare","Ordered","getOrder","List","sorters","sorters_1","compare"],"mappings":"CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,EAAAG,QAAA,WACA,kBAAAC,gBAAAC,IACAD,OAAA,gBAAAJ,GACA,gBAAAC,SACAA,QAAA,GAAAD,EAAAG,QAAA,WAEAJ,EAAA,GAAAC,EAAAD,EAAA,SACCO,KAAA,SAAAC,GACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAT,OAGA,IAAAC,GAAAS,EAAAD,IACAE,EAAAF,EACAG,GAAA,EACAZ,WAUA,OANAO,GAAAE,GAAAI,KAAAZ,EAAAD,QAAAC,IAAAD,QAAAQ,GAGAP,EAAAW,GAAA,EAGAX,EAAAD,QAvBA,GAAAU,KA4DA,OAhCAF,GAAAM,EAAAP,EAGAC,EAAAO,EAAAL,EAGAF,EAAAQ,EAAA,SAAAhB,EAAAiB,EAAAC,GACAV,EAAAW,EAAAnB,EAAAiB,I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xExN,EAAoBQ,EAAEiB,EAAqB,KAAM,WAAa,MAAOQ,KACrEjC,EAAoBQ,EAAEiB,EAAqB,UAAW,WAAa,MAAOC,KAC1E1B,EAAoBQ,EAAEiB,EAAqB,QAAS,WAAa,MAAOmV,KACxE5W,EAAoBQ,EAAEiB,EAAqB,UAAW,WAAa,MAAOsvB,KAC1E/wB,EAAoBQ,EAAEiB,EAAqB,WAAY,WAAa,MAAOywB,KAC3ElyB,EAAoBQ,EAAEiB,EAAqB,aAAc,WAAa,MAAOqwB,KAC7E9xB,EAAoBQ,EAAEiB,EAAqB,WAAY,WAAa,MAAO4U,KAC3ErW,EAAoBQ,EAAEiB,EAAqB,mBAAoB,WAAa,MAAO2S,KACnFpU,EAAoBQ,EAAEiB,EAAqB,QAAS,WAAa,MAAO6wB,KACxEtyB,EAAoBQ,EAAEiB,EAAqB,SAAU,WAAa,MAAO0O,KACzEnQ,EAAoBQ,EAAEiB,EAAqB,OAAQ,WAAa,MAAO2d,KACvEpf,EAAoBQ,EAAEiB,EAAqB,QAAS,WAAa,MAAOgD,KACxEzE,EAAoBQ,EAAEiB,EAAqB,UAAW,WAAa,MAAO6uB","file":"dayspan.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"moment\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"ds\", [\"moment\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"ds\"] = factory(require(\"moment\"));\n\telse\n\t\troot[\"ds\"] = factory(root[\"moment\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_0__) {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"moment\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"ds\", [\"moment\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"ds\"] = factory(require(\"moment\"));\n\telse\n\t\troot[\"ds\"] = factory(root[\"moment\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_0__) {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 1);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports) {\n\nmodule.exports = __WEBPACK_EXTERNAL_MODULE_0__;\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\nmodule.exports = __webpack_require__(2);\n\n\n/***/ }),\n/* 2 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nObject.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n\n// CONCATENATED MODULE: ./src/Functions.ts\n\r\n/**\r\n * The class which contains commonly used functions by the library. These\r\n * functions and variables exist in a class so they may be overridden if\r\n * desired.\r\n */\r\nvar Functions = (function () {\r\n function Functions() {\r\n }\r\n /**\r\n * Determines whether the given input is an array.\r\n *\r\n * @param input The variable to test.\r\n * @returns `true` if the variable is an array, otherwise `false`.\r\n */\r\n Functions.isArray = function (input) {\r\n return input instanceof Array;\r\n };\r\n /**\r\n * Determines whether the two arrays given are stricly equivalent. If the\r\n * arrays are not the same length or contain the same values in the same order\r\n * then `false` is returned.\r\n *\r\n * @param x The first array to test.\r\n * @param y The second array to test.\r\n * @returns `true` if they have the same exact values, otherwise `false`.\r\n */\r\n Functions.isArrayEquals = function (x, y) {\r\n if (x === y)\r\n return true;\r\n if (x.length !== y.length)\r\n return false;\r\n for (var i = 0; i < x.length; i++) {\r\n if (x[i] !== y[i]) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Determines whether the given input is a string.\r\n *\r\n * @param input The variable to test.\r\n * @returns `true` if the variable is a string, otherwise `false`.\r\n */\r\n Functions.isString = function (input) {\r\n return typeof (input) === 'string';\r\n };\r\n /**\r\n * Determines whether the given input is a finite number (a number which is\r\n * not infinite or not the result of a divide-by-zero operation).\r\n *\r\n * @param input The variable to test.\r\n * @returns `true` if the variable is a finite number, otherwise `false`.\r\n */\r\n Functions.isNumber = function (input) {\r\n return isFinite(input);\r\n };\r\n /**\r\n * Determines whether the given input is an object and NOT an array.\r\n *\r\n * @param input The variable to test.\r\n * @returns `true` if the variable is a plain object, otherwise `false`.\r\n */\r\n Functions.isObject = function (input) {\r\n return !this.isArray(input) && typeof (input) === 'object';\r\n };\r\n /**\r\n * Determines whether the given input is defined.\r\n *\r\n * @param input The variable to test.\r\n * @return `true` if the variable is defined, otherwise `false`.\r\n */\r\n Functions.isDefined = function (input) {\r\n return typeof (input) !== 'undefined';\r\n };\r\n /**\r\n * Determines whether the given input is defined and not null.\r\n *\r\n * @param input The variable to test.\r\n * @return `true` if the variable is defined and not null, otherwise `false`.\r\n */\r\n Functions.isValue = function (input) {\r\n return input !== null && typeof (input) !== 'undefined';\r\n };\r\n /**\r\n * Determines whether the given input appears to be a valid\r\n * [[FrequencyValueEvery]].\r\n *\r\n * ```typescript\r\n * Functions.isFrequencyValueEvery({}); // false\r\n * Functions.isFrequencyValueEvery([]); // false\r\n * Functions.isFrequencyValueEvery([1]); // false\r\n * Functions.isFrequencyValueEvery(null); // false\r\n * Functions.isFrequencyValueEvery({every:2}); // true\r\n * Functions.isFrequencyValueEvery({offset:1}); // false\r\n * Functions.isFrequencyValueEvery({every:2, offset:1}); // true\r\n * ```\r\n *\r\n * @param input The variable to test.\r\n * @returns `true` if the variable appears to be a [[FrequencyValueEvery]],\r\n * otherwise false.\r\n */\r\n Functions.isFrequencyValueEvery = function (input) {\r\n return this.isObject(input) && this.isNumber(input.every);\r\n };\r\n /**\r\n * Determines whether the given input appears to be a valid\r\n * [[FrequencyValueOneOf]].\r\n *\r\n * ```typescript\r\n * Functions.isFrequencyValueOneOf({}); // false\r\n * Functions.isFrequencyValueOneOf([]); // false\r\n * Functions.isFrequencyValueOneOf([1]); // true\r\n * Functions.isFrequencyValueOneOf(null); // false\r\n * ```\r\n *\r\n * @param input The variable to test.\r\n * @returns `true` if the variable appears to be a [[FrequencyValueOneOf]],\r\n * otherwise false.\r\n */\r\n Functions.isFrequencyValueOneOf = function (input) {\r\n return this.isArray(input) && input.length > 0;\r\n };\r\n /**\r\n * Returns the first argument which is defined.\r\n *\r\n * ```typescript\r\n * Functions.coalesce(3, 4); // 3\r\n * Functions.coalesce(undefined, 4); // 4\r\n * Functions.coalesce(null, 4); // null\r\n * Functions.coalesce(void 0, void 0, 5); // 5\r\n * ```\r\n *\r\n * @param a The first argument to look at.\r\n * @param b The second argument to look at.\r\n * @returns The first defined argument.\r\n * @see [[Functions.isDefined]]\r\n */\r\n Functions.coalesce = function (a, b, c) {\r\n return this.isDefined(a) ? a : (this.isDefined(b) ? b : c);\r\n };\r\n /**\r\n * Copies values from `from` object and sets them to the `target` object.\r\n *\r\n * @param target The object to set values to.\r\n * @param from The object to copy value references from.\r\n * @returns The reference to `target`.\r\n */\r\n Functions.extend = function (target, from) {\r\n for (var prop in from) {\r\n target[prop] = from[prop];\r\n }\r\n return target;\r\n };\r\n /**\r\n * Pads the string `x` up to `length` characters with the given `padding`\r\n * optionally placing the `padding` `before` `x`.\r\n *\r\n * ```typescript\r\n * Functions.pad('hey', 5, '_', false); // 'hey__'\r\n * Functions.pad('hey', 5, '_', true); // '__hey'\r\n * Functions.pad('heyman', 5, '_', true); // 'heyman'\r\n * ```\r\n *\r\n * @param x The string to pad.\r\n * @param length The length to pad to.\r\n * @param padding The string to pad with.\r\n * @param before If the padding should go before the string to pad.\r\n * @returns The padded string if any padding needed be added.\r\n */\r\n Functions.pad = function (x, length, padding, before) {\r\n while (x.length < length) {\r\n before ? x = padding + x : x = x + padding;\r\n }\r\n return x;\r\n };\r\n /**\r\n * Pads the number `x` up to `length` digits where the padding is `0` and it\r\n * goes before `x`. This function will only return the first `length`\r\n * characters of the padding string representation of the number but can return\r\n * an alternative number of `first` characters.\r\n *\r\n * ```typescript\r\n * Functions.padNumber(29, 3); // '029'\r\n * Functions.padNumber(29, 3, 2); // '02'\r\n * Functions.padNumber(9573, 3); // '957'\r\n * ```\r\n *\r\n * @param x The number to pad with zeros in the beginning.\r\n * @param length The number of digits the number should be padded to.\r\n * @param first The number of digits to return from the start of the string.\r\n * @returns A padded number.\r\n */\r\n Functions.padNumber = function (x, length, first) {\r\n if (first === void 0) { first = length; }\r\n return this.pad(x + '', length, '0', true).substring(0, first);\r\n };\r\n return Functions;\r\n}());\r\n\r\n\n// CONCATENATED MODULE: ./src/Operation.ts\n\r\n/**\r\n * An operation that can be performed on a single number.\r\n */\r\nvar Op;\r\n(function (Op) {\r\n /**\r\n * The number is returned unmodified.\r\n */\r\n Op[Op[\"NONE\"] = 0] = \"NONE\";\r\n /**\r\n * The number is rounded down to the nearest whole number.\r\n */\r\n Op[Op[\"FLOOR\"] = 1] = \"FLOOR\";\r\n /**\r\n * The number is rounded up to the nearest whole number.\r\n */\r\n Op[Op[\"CEIL\"] = 2] = \"CEIL\";\r\n /**\r\n * The number is rounded up or down depending on if the fractional value is\r\n * greater than or less than 0.5 respectively.\r\n */\r\n Op[Op[\"ROUND\"] = 3] = \"ROUND\";\r\n /**\r\n * The fractional part of the number is dropped.\r\n */\r\n Op[Op[\"TRUNCATE\"] = 4] = \"TRUNCATE\";\r\n /**\r\n * The number is rounded up when positive and down when negative. This is\r\n * effectively ceiling the absolute value where the result preserves the sign.\r\n */\r\n Op[Op[\"UP\"] = 5] = \"UP\";\r\n /**\r\n * The number is rounded down when positive and up when negative. This is\r\n * effectively floor the absolute value where the result preserves the sign.\r\n */\r\n Op[Op[\"DOWN\"] = 6] = \"DOWN\";\r\n})(Op = Op || (Op = {}));\r\n/**\r\n * Performs the requested operation on the given number, optionally taking\r\n * the absolute value of the number before the operation.\r\n *\r\n * @param value The number to operate on.\r\n * @param op The operation to perform.\r\n * @param absolute If the number should be positive before the operation.\r\n * @return The operated result, or the original value if its not a valid number.\r\n */\r\nfunction operate(value, op, absolute) {\r\n if (absolute === void 0) { absolute = false; }\r\n if (isFinite(value)) {\r\n if (absolute) {\r\n value = Math.abs(value);\r\n }\r\n switch (op) {\r\n case Op.NONE:\r\n return value;\r\n case Op.FLOOR:\r\n return Math.floor(value);\r\n case Op.CEIL:\r\n return Math.ceil(value);\r\n case Op.ROUND:\r\n return Math.round(value);\r\n case Op.TRUNCATE:\r\n case Op.DOWN:\r\n return value < 0 ? Math.ceil(value) : Math.floor(value);\r\n case Op.UP:\r\n return value < 0 ? Math.floor(value) : Math.ceil(value);\r\n }\r\n }\r\n return value;\r\n}\r\n\n// CONCATENATED MODULE: ./src/Units.ts\n\r\n/**\r\n * Units of time that are compromised of 1 or more days for the [[Calendar]] class.\r\n */\r\nvar Units;\r\n(function (Units) {\r\n Units[Units[\"DAY\"] = 0] = \"DAY\";\r\n Units[Units[\"WEEK\"] = 1] = \"WEEK\";\r\n Units[Units[\"MONTH\"] = 2] = \"MONTH\";\r\n Units[Units[\"YEAR\"] = 3] = \"YEAR\";\r\n})(Units = Units || (Units = {}));\r\n\n// CONCATENATED MODULE: ./src/Constants.ts\n\r\n/**\r\n * A class that stores commonly used values.\r\n */\r\nvar Constants = (function () {\r\n function Constants() {\r\n }\r\n /**\r\n * The number of milliseconds in a second.\r\n */\r\n Constants.MILLIS_IN_SECOND = 1000;\r\n /**\r\n * The number of milliseconds in a minute.\r\n */\r\n Constants.MILLIS_IN_MINUTE = Constants.MILLIS_IN_SECOND * 60;\r\n /**\r\n * The number of milliseconds in an hour.\r\n */\r\n Constants.MILLIS_IN_HOUR = Constants.MILLIS_IN_MINUTE * 60;\r\n /**\r\n * The number of milliseconds in a day (not including DST days).\r\n */\r\n Constants.MILLIS_IN_DAY = Constants.MILLIS_IN_HOUR * 24;\r\n /**\r\n * The number of milliseconds in a week (not including ones that include DST).\r\n */\r\n Constants.MILLIS_IN_WEEK = Constants.MILLIS_IN_DAY * 7;\r\n /**\r\n * The number of days in a week.\r\n */\r\n Constants.DAYS_IN_WEEK = 7;\r\n /**\r\n * The number of months in a year.\r\n */\r\n Constants.MONTHS_IN_YEAR = 12;\r\n /**\r\n * The number of hours in a day (not including DST days).\r\n */\r\n Constants.HOURS_IN_DAY = 24;\r\n /**\r\n * The first month of the year.\r\n */\r\n Constants.MONTH_MIN = 0;\r\n /**\r\n * The last month of the year.\r\n */\r\n Constants.MONTH_MAX = 11;\r\n /**\r\n * The first day of a month.\r\n */\r\n Constants.DAY_MIN = 1;\r\n /**\r\n * The last day of the longest month.\r\n */\r\n Constants.DAY_MAX = 31;\r\n /**\r\n * The first hour of the day.\r\n */\r\n Constants.HOUR_MIN = 0;\r\n /**\r\n * The last hour of the day.\r\n */\r\n Constants.HOUR_MAX = 23;\r\n /**\r\n * The first minute of the hour.\r\n */\r\n Constants.MINUTE_MIN = 0;\r\n /**\r\n * The last minute of the hour.\r\n */\r\n Constants.MINUTE_MAX = 59;\r\n /**\r\n * The first second of the minute.\r\n */\r\n Constants.SECOND_MIN = 0;\r\n /**\r\n * The last second of the minute.\r\n */\r\n Constants.SECOND_MAX = 59;\r\n /**\r\n * The first millisecond of the second.\r\n */\r\n Constants.MILLIS_MIN = 0;\r\n /**\r\n * The last millisecond of the second.\r\n */\r\n Constants.MILLIS_MAX = 999;\r\n /**\r\n * The first day of the week.\r\n */\r\n Constants.WEEKDAY_MIN = 0;\r\n /**\r\n * The last day of the week.\r\n */\r\n Constants.WEEKDAY_MAX = 6;\r\n /**\r\n * The default duration for an event.\r\n */\r\n Constants.DURATION_DEFAULT = 1;\r\n /**\r\n * The default duration unit for an all day event.\r\n */\r\n Constants.DURATION_DEFAULT_UNIT_ALL = 'days';\r\n /**\r\n * The default duration unit for an event at a given time.\r\n */\r\n Constants.DURATION_DEFAULT_UNIT_TIMES = 'hours';\r\n /**\r\n * Computes the duration unit given its for an all day event.\r\n *\r\n * @param all If the event is all day.\r\n * @return The default unit for the event.\r\n */\r\n Constants.DURATION_DEFAULT_UNIT = function (all) { return all ? Constants.DURATION_DEFAULT_UNIT_ALL :\r\n Constants.DURATION_DEFAULT_UNIT_TIMES; };\r\n /**\r\n * The number of milliseconds for various duration units. These are worse case\r\n * scenario and do not include DST changes.\r\n */\r\n Constants.DURATION_TO_MILLIS = {\r\n minute: Constants.MILLIS_IN_MINUTE,\r\n minutes: Constants.MILLIS_IN_MINUTE,\r\n hour: Constants.MILLIS_IN_HOUR,\r\n hours: Constants.MILLIS_IN_HOUR,\r\n day: Constants.MILLIS_IN_DAY,\r\n days: Constants.MILLIS_IN_DAY,\r\n week: Constants.MILLIS_IN_WEEK,\r\n weeks: Constants.MILLIS_IN_WEEK,\r\n month: Constants.MILLIS_IN_DAY * Constants.DAY_MAX,\r\n months: Constants.MILLIS_IN_DAY * Constants.DAY_MAX\r\n };\r\n /**\r\n * The maximum estimated number of events per day. This is used to calculate\r\n * [[CalendarEvent.id]] to give each event a unique ID. If you think you will\r\n * have more events than this per day, you can enlarge the value.\r\n */\r\n Constants.MAX_EVENTS_PER_DAY = 24;\r\n /**\r\n * The day of the week which determines the first week of the year or month.\r\n * By default this day is Thursday.\r\n */\r\n Constants.WEEK_OF_MONTH_MINIMUM_WEEKDAY = 4;\r\n return Constants;\r\n}());\r\n\r\n\n// CONCATENATED MODULE: ./src/DaySpan.ts\n\r\n\r\n\r\n\r\n\r\n/**\r\n * A class for a range of time between two [[Day]] timestamps.\r\n */\r\nvar DaySpan_DaySpan = (function () {\r\n /**\r\n * Creates a new span of time.\r\n *\r\n * @param start The starting timestamp.\r\n * @param end The ending timestamp.\r\n */\r\n function DaySpan(start, end) {\r\n this.start = start;\r\n this.end = end;\r\n }\r\n Object.defineProperty(DaySpan.prototype, \"isPoint\", {\r\n /**\r\n * Whether this span starts and ends on the same timestamp.\r\n */\r\n get: function () {\r\n return this.start.time === this.end.time;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Determines whether the given timestamp lies between the start and end\r\n * timestamp.\r\n *\r\n * @param day The timestamp to test.\r\n * @returns True if the day is >= the start and <= the end of this span.\r\n */\r\n DaySpan.prototype.contains = function (day) {\r\n return day.time >= this.start.time && day.time <= this.end.time;\r\n };\r\n /**\r\n * Compares the given timestamp to this span. If the timestamp is before this\r\n * span then `-1` is returned, if the timestamp is after this span then `1`\r\n * us returned, otherwise `0` is returned when the timestamp is in this span.\r\n *\r\n * @param day The timestamp to compare to.\r\n * @returns `-1`, `0`, or `1` depending on the given timestamp relative to\r\n * this span.\r\n */\r\n DaySpan.prototype.compareTo = function (day) {\r\n return day.time < this.start.time ? -1 : (day.time > this.end.time ? 1 : 0);\r\n };\r\n /**\r\n * Determines whether the given timestamp is between the start and end\r\n * timestamp or lies on the same day as the start or end timestamp.\r\n *\r\n * @param day The timestamp to test.\r\n * @see [[Day.sameDay]]\r\n */\r\n DaySpan.prototype.matchesDay = function (day) {\r\n return this.contains(day) || day.sameDay(this.start) || day.sameDay(this.end);\r\n };\r\n /**\r\n * Determines whether the given timestamp is between the start and end\r\n * timestamp or lies on the same week as the start or end timestamp.\r\n *\r\n * @param day The timestamp to test.\r\n * @see [[Day.sameWeek]]\r\n */\r\n DaySpan.prototype.matchesWeek = function (day) {\r\n return this.contains(day) || day.sameWeek(this.start) || day.sameWeek(this.end);\r\n };\r\n /**\r\n * Determines whether the given timestamp is between the start and end\r\n * timestamp or lies on the same month as the start or end timestamp.\r\n *\r\n * @param day The timestamp to test.\r\n * @see [[Day.sameMonth]]\r\n */\r\n DaySpan.prototype.matchesMonth = function (day) {\r\n return this.contains(day) || day.sameMonth(this.start) || day.sameMonth(this.end);\r\n };\r\n /**\r\n * Determines whether the given timestamp is between the start and end\r\n * timestamp or lies on the same year as the start or end timestamp.\r\n *\r\n * @param day The timestamp to test.\r\n * @see [[Day.sameYear]]\r\n */\r\n DaySpan.prototype.matchesYear = function (day) {\r\n return this.contains(day) || day.sameYear(this.start) || day.sameYear(this.end);\r\n };\r\n /**\r\n * Calculates the number of milliseconds between the start and end timestamp.\r\n *\r\n * @param op The operation to perform on the result.\r\n * @param absolute Whether the result should always be positive.\r\n * @returns The time between the start and end timestamp.\r\n * @see [[Day.millisBetween]]\r\n */\r\n DaySpan.prototype.millis = function (op, absolute) {\r\n if (op === void 0) { op = Op.DOWN; }\r\n if (absolute === void 0) { absolute = true; }\r\n return this.start.millisBetween(this.end, op, absolute);\r\n };\r\n /**\r\n * Calculates the number of seconds between the start and end timestamp.\r\n *\r\n * @param op The operation to perform on the result.\r\n * @param absolute Whether the result should always be positive.\r\n * @returns The time between the start and end timestamp.\r\n * @see [[Day.secondsBetween]]\r\n */\r\n DaySpan.prototype.seconds = function (op, absolute) {\r\n if (op === void 0) { op = Op.DOWN; }\r\n if (absolute === void 0) { absolute = true; }\r\n return this.start.secondsBetween(this.end, op, absolute);\r\n };\r\n /**\r\n * Calculates the number of minutes between the start and end timestamp.\r\n *\r\n * @param op The operation to perform on the result.\r\n * @param absolute Whether the result should always be positive.\r\n * @returns The time between the start and end timestamp.\r\n * @see [[Day.minutesBetween]]\r\n */\r\n DaySpan.prototype.minutes = function (op, absolute) {\r\n if (op === void 0) { op = Op.DOWN; }\r\n if (absolute === void 0) { absolute = true; }\r\n return this.start.minutesBetween(this.end, op, absolute);\r\n };\r\n /**\r\n * Calculates the number of hours between the start and end timestamp.\r\n *\r\n * @param op The operation to perform on the result.\r\n * @param absolute Whether the result should always be positive.\r\n * @returns The time between the start and end timestamp.\r\n * @see [[Day.hoursBetween]]\r\n */\r\n DaySpan.prototype.hours = function (op, absolute) {\r\n if (op === void 0) { op = Op.DOWN; }\r\n if (absolute === void 0) { absolute = true; }\r\n return this.start.hoursBetween(this.end, op, absolute);\r\n };\r\n /**\r\n * Calculates the number of days between the start and end timestamp.\r\n *\r\n * @param op The operation to perform on the result.\r\n * @param absolute Whether the result should always be positive.\r\n * @returns The time between the start and end timestamp.\r\n * @see [[Day.daysBetween]]\r\n */\r\n DaySpan.prototype.days = function (op, absolute) {\r\n if (op === void 0) { op = Op.DOWN; }\r\n if (absolute === void 0) { absolute = true; }\r\n return this.start.daysBetween(this.end, op, absolute);\r\n };\r\n /**\r\n * Calculates the number of weeks between the start and end timestamp.\r\n *\r\n * @param op The operation to perform on the result.\r\n * @param absolute Whether the result should always be positive.\r\n * @returns The time between the start and end timestamp.\r\n * @see [[Day.weeksBetween]]\r\n */\r\n DaySpan.prototype.weeks = function (op, absolute) {\r\n if (op === void 0) { op = Op.DOWN; }\r\n if (absolute === void 0) { absolute = true; }\r\n return this.start.weeksBetween(this.end, op, absolute);\r\n };\r\n /**\r\n * Calculates the number of months between the start and end timestamp.\r\n *\r\n * @param op The operation to perform on the result.\r\n * @param absolute Whether the result should always be positive.\r\n * @returns The time between the start and end timestamp.\r\n * @see [[Day.monthsBetween]]\r\n */\r\n DaySpan.prototype.months = function (op, absolute) {\r\n if (op === void 0) { op = Op.DOWN; }\r\n if (absolute === void 0) { absolute = true; }\r\n return this.start.monthsBetween(this.end, op, absolute);\r\n };\r\n /**\r\n * Calculates the number of years between the start and end timestamp.\r\n *\r\n * @param op The operation to perform on the result.\r\n * @param absolute Whether the result should always be positive.\r\n * @returns The time between the start and end timestamp.\r\n * @see [[Day.yearsBetween]]\r\n */\r\n DaySpan.prototype.years = function (op, absolute) {\r\n if (op === void 0) { op = Op.DOWN; }\r\n if (absolute === void 0) { absolute = true; }\r\n return this.start.yearsBetween(this.end, op, absolute);\r\n };\r\n /**\r\n * Returns a delta value between 0 and 1 which represents where the\r\n * [[DaySpan.start]] is relative to the given day. The delta value would\r\n * be less than 0 if the start of the event is before the given day.\r\n *\r\n * @param relativeTo The day to find the start delta relative to.\r\n * @return A number between 0 and 1 if the start of this span is in the\r\n * 24-hour period starting at the given timestamp, otherwise the value\r\n * returned may be less than 0 or greater than 1.\r\n */\r\n DaySpan.prototype.startDelta = function (relativeTo) {\r\n return (this.start.time - relativeTo.time) / Constants.MILLIS_IN_DAY;\r\n };\r\n /**\r\n * Returns a delta value between 0 and 1 which represents where the\r\n * [[DaySpan.end]] is relative to the given day. The delta value would\r\n * be greater than 1 if the end of the event is after the given day.\r\n *\r\n * @param relativeTo The day to find the end delta relative to.\r\n * @return A number between 0 and 1 if the end of this span is in the\r\n * 24-hour period starting at the given timestamp, otherwise the value\r\n * returned may be less than 0 or greater than 1.\r\n */\r\n DaySpan.prototype.endDelta = function (relativeTo) {\r\n return (this.end.time - relativeTo.time) / Constants.MILLIS_IN_DAY;\r\n };\r\n /**\r\n * Calculates the bounds for span event if it were placed in a rectangle which\r\n * represents a day (24 hour period). By default the returned values are\r\n * between 0 and 1 and can be scaled by the proper rectangle dimensions or the\r\n * rectangle dimensions can be passed to this function.\r\n *\r\n * @param relativeTo The day to find the bounds relative to. If this is not the\r\n * start of the day the returned bounds is relative to the given time.\r\n * @param dayHeight The height of the rectangle of the day.\r\n * @param dayWidth The width of the rectangle of the day.\r\n * @param columnOffset The offset in the rectangle of the day to adjust this\r\n * span by. This also reduces the width of the returned bounds to keep the\r\n * bounds in the rectangle of the day.\r\n * @param clip `true` if the bounds should stay in the day rectangle, `false`\r\n * and the bounds may go outside the rectangle of the day for multi-day\r\n * spans.\r\n * @param offsetX How much to translate the left & right properties by.\r\n * @param offsetY How much to translate the top & bottom properties by.\r\n * @returns The calculated bounds for this span.\r\n */\r\n DaySpan.prototype.getBounds = function (relativeTo, dayHeight, dayWidth, columnOffset, clip, offsetX, offsetY) {\r\n if (dayHeight === void 0) { dayHeight = 1; }\r\n if (dayWidth === void 0) { dayWidth = 1; }\r\n if (columnOffset === void 0) { columnOffset = 0; }\r\n if (clip === void 0) { clip = true; }\r\n if (offsetX === void 0) { offsetX = 0; }\r\n if (offsetY === void 0) { offsetY = 0; }\r\n var startRaw = this.startDelta(relativeTo);\r\n var endRaw = this.endDelta(relativeTo);\r\n var start = clip ? Math.max(0, startRaw) : startRaw;\r\n var end = clip ? Math.min(1, endRaw) : endRaw;\r\n var left = columnOffset;\r\n var right = dayWidth - left;\r\n var top = start * dayHeight;\r\n var bottom = end * dayHeight;\r\n return {\r\n top: top + offsetY,\r\n bottom: bottom + offsetY,\r\n height: bottom - top,\r\n left: left + offsetX,\r\n right: right + offsetX,\r\n width: right\r\n };\r\n };\r\n /**\r\n * Summarizes this span given an approximate unit of time and a few other\r\n * options. If the start and end are on the same unit, a single value will\r\n * be returned. Otherwise a start and end will be returned with a `delimiter`.\r\n *\r\n * @param type The unit of time this span is for.\r\n * @param dayOfWeek When `true` the weekday of the start and end are included.\r\n * @param short When `true` the short form of weekdays and months will be used.\r\n * @param repeat When `true` the year will be repeated on the start and end\r\n * timestamp even if they are the same year.\r\n * @param contextual When `true` the year will be hidden if it's the current\r\n * year.\r\n * @param delimiter The string to separate the start and end timestamps with.\r\n * @returns The summary of this span.\r\n */\r\n DaySpan.prototype.summary = function (type, dayOfWeek, short, repeat, contextual, delimiter) {\r\n if (dayOfWeek === void 0) { dayOfWeek = true; }\r\n if (short === void 0) { short = false; }\r\n if (repeat === void 0) { repeat = false; }\r\n if (contextual === void 0) { contextual = true; }\r\n if (delimiter === void 0) { delimiter = ' - '; }\r\n var formats = DaySpan.SUMMARY_FORMATS[type];\r\n var today = Day_Day.today();\r\n var showStartYear = !contextual || !this.start.sameYear(today);\r\n var showEndYear = !contextual || !this.end.sameYear(today);\r\n var start = this.start.format(formats(short, dayOfWeek, showStartYear));\r\n var end = this.end.format(formats(short, dayOfWeek, showEndYear));\r\n var summary = start;\r\n if (start !== end) {\r\n if (!repeat) {\r\n summary = this.start.format(formats(short, dayOfWeek, !this.start.sameYear(this.end)));\r\n }\r\n summary += delimiter;\r\n summary += end;\r\n }\r\n else {\r\n summary = start;\r\n }\r\n return summary;\r\n };\r\n /**\r\n * Determines whether the gven span intersects with this span.\r\n *\r\n * @param span The span to test.\r\n * @returns `true` if the spans intersect, otherwise `false`.\r\n */\r\n DaySpan.prototype.intersects = function (span) {\r\n return !(this.end.time < span.start.time ||\r\n this.start.time > span.end.time);\r\n };\r\n /**\r\n * Calculates the intersection between this span and the given span. If there\r\n * is no intersection between the two spans then `null` is returned.\r\n *\r\n * @param span The span to calculate the intersection with.\r\n * @returns The intersection or `null` if none exists.\r\n */\r\n DaySpan.prototype.intersection = function (span) {\r\n var start = this.start.max(span.start);\r\n var end = this.end.min(span.end);\r\n return start.isAfter(end) ? null : new DaySpan(start, end);\r\n };\r\n /**\r\n * Calculates the union between this span and the given span.\r\n *\r\n * @param span The span to calculate the union with.\r\n * @returns The union of the two spans.\r\n */\r\n DaySpan.prototype.union = function (span) {\r\n var start = this.start.min(span.start);\r\n var end = this.end.max(span.end);\r\n return new DaySpan(start, end);\r\n };\r\n /**\r\n * Returns a point [[DaySpan]] with the same start and end timestamp.\r\n *\r\n * @param day The timestamp which will be the start and end.\r\n * @returns The new instance.\r\n * @see [[DaySpan.isPoint]]\r\n */\r\n DaySpan.point = function (day) {\r\n return new DaySpan(day, day);\r\n };\r\n /**\r\n * Formatting functions which assist the [[DaySpan.summary]] function.\r\n */\r\n DaySpan.SUMMARY_FORMATS = (DaySpan__a = {},\r\n DaySpan__a[Units.DAY] = function (short, dayOfWeek, year) {\r\n return (dayOfWeek ? (short ? 'ddd, ' : 'dddd, ') : '') + (short ? 'MMM ' : 'MMMM ') + 'Do' + (year ? ' YYYY' : '');\r\n },\r\n DaySpan__a[Units.WEEK] = function (short, dayOfWeek, year) {\r\n return (dayOfWeek ? (short ? 'ddd, ' : 'dddd, ') : '') + (short ? 'MMM ' : 'MMMM ') + 'Do' + (year ? ' YYYY' : '');\r\n },\r\n DaySpan__a[Units.MONTH] = function (short, dayOfWeek, year) {\r\n return (short ? 'MMM' : 'MMMM') + (year ? ' YYYY' : '');\r\n },\r\n DaySpan__a[Units.YEAR] = function (short, dayOfWeek, year) {\r\n return (year ? 'YYYY' : '');\r\n },\r\n DaySpan__a);\r\n return DaySpan;\r\n}());\r\n\r\nvar DaySpan__a;\r\n\n// CONCATENATED MODULE: ./src/Identifier.ts\n\r\nvar __extends = (this && this.__extends) || (function () {\r\n var extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return function (d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n };\r\n})();\r\n\r\n\r\n\r\n/**\r\n * A class for detecting, parsing, and building identifiers to and from days.\r\n *\r\n * An identifier is a simple value which represents a span of time. It may\r\n * represent an entire year, a quarter (3 months) of a year, a week of a year,\r\n * a month in a year, a specific day of a month of a year, or a specific hour,\r\n * minute, day, and month of a year.\r\n *\r\n * For example:\r\n * - `2018`: The year 2018\r\n * - `201801`: January 2018\r\n * - `2014023`: The 23rd week of 2014\r\n * - `20170311`: March 11th, 2017\r\n * - `201406151651`: June 15th 2016 at 4:51 pm\r\n * - `'0525'`: Year 525 of the first age, Elrond and Elros are born\r\n */\r\nvar Identifier_Identifier = (function () {\r\n function Identifier() {\r\n }\r\n /**\r\n * Determines whether the given identifier is this type.\r\n *\r\n * @param id The identifier to test.\r\n * @returns `true` if the identifier is this type, otherwise `false`.\r\n */\r\n Identifier.prototype.is = function (id) {\r\n return (id + '').length === this.getLength();\r\n };\r\n /**\r\n * Computes the identifier given values taken from a [[Day]].\r\n *\r\n * @param values The values to compute.\r\n * @returns The computed identifier.\r\n */\r\n Identifier.prototype.compute = function () {\r\n var values = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n values[_i] = arguments[_i];\r\n }\r\n var scales = this.getScales();\r\n var total = 0;\r\n for (var i = 0; i < values.length; i++) {\r\n total += values[i] * scales[i];\r\n }\r\n return this.is(total) ? total : Functions.padNumber(total, this.getLength());\r\n };\r\n /**\r\n * Decomputes the given identifier and returns values which describe a span\r\n * of time.\r\n *\r\n * @param id The identifier to decompute.\r\n * @returns The original values which computed the identifier.\r\n */\r\n Identifier.prototype.decompute = function (id) {\r\n var scales = this.getScales();\r\n var total = Functions.isNumber(id) ? id : parseInt(id);\r\n var values = [];\r\n for (var i = 0; i < scales.length - 1; i++) {\r\n var curr = scales[i + 0];\r\n var next = scales[i + 1];\r\n var mod = next / curr;\r\n var value = total % mod;\r\n values.push(value);\r\n total = Math.floor(total / mod);\r\n }\r\n values.push(total);\r\n return values;\r\n };\r\n /**\r\n * Finds which identifier type matches the given identifier, if any.\r\n *\r\n * @param id The identifier to find the type of.\r\n * @returns The found identifier type, otherwise `null` if none exists.\r\n */\r\n Identifier.find = function (id) {\r\n if (this.Time.is(id))\r\n return this.Time;\r\n if (this.Day.is(id))\r\n return this.Day;\r\n if (this.Week.is(id))\r\n return this.Week;\r\n if (this.Month.is(id))\r\n return this.Month;\r\n if (this.Year.is(id))\r\n return this.Year;\r\n return null;\r\n };\r\n /**\r\n * Determines whether the given time span `outer` contains the time span\r\n * `inner`.\r\n *\r\n * @param outer The potentially larger time span `inner` must be contained in.\r\n * @param inner The time span to test is contained inside `outer`.\r\n * @returns `true` if `inner` is equal to or contained in `outer`, otherwise\r\n * `false`.\r\n */\r\n Identifier.contains = function (outer, inner) {\r\n var outerString = outer + '';\r\n return (inner + '').substring(0, outerString.length) === outerString;\r\n };\r\n /**\r\n * The identifier type for an hour of time on a specific day.\r\n */\r\n Identifier.Time = null;\r\n /**\r\n * The identifier type for a specific day.\r\n */\r\n Identifier.Day = null;\r\n /**\r\n * The identifier type for a specific week of a year.\r\n */\r\n Identifier.Week = null;\r\n /**\r\n * The identifier type for a specific month of a year.\r\n */\r\n Identifier.Month = null;\r\n /**\r\n * The identifier type for a specific quarter of a year.\r\n */\r\n Identifier.Quarter = null;\r\n /**\r\n * The identifier type for a specific year.\r\n */\r\n Identifier.Year = null;\r\n return Identifier;\r\n}());\r\n\r\n// YYYYMMddHHmm (12)\r\nvar Identifier_IdentifierTime = (function (_super) {\r\n __extends(IdentifierTime, _super);\r\n function IdentifierTime() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n IdentifierTime.prototype.getScales = function () {\r\n return IdentifierTime.SCALES;\r\n };\r\n IdentifierTime.prototype.getLength = function () {\r\n return IdentifierTime.LENGTH;\r\n };\r\n IdentifierTime.prototype.get = function (day) {\r\n return this.compute(day.minute, day.hour, day.dayOfMonth, day.month + 1, day.year);\r\n };\r\n IdentifierTime.prototype.object = function (id) {\r\n var values = this.decompute(id);\r\n return {\r\n minute: values[0],\r\n hour: values[1],\r\n day: values[2],\r\n month: values[3] - 1,\r\n year: values[4]\r\n };\r\n };\r\n IdentifierTime.prototype.start = function (id) {\r\n var obj = this.object(id);\r\n var start = Day_Day.build(obj.year, obj.month, obj.day, obj.hour, obj.minute);\r\n return start;\r\n };\r\n IdentifierTime.prototype.span = function (id, endInclusive) {\r\n if (endInclusive === void 0) { endInclusive = false; }\r\n var start = this.start(id);\r\n var end = start.endOfHour(endInclusive);\r\n return new DaySpan_DaySpan(start, end);\r\n };\r\n IdentifierTime.prototype.describe = function (id, short) {\r\n if (short === void 0) { short = false; }\r\n var start = this.start(id);\r\n var format = short ? IdentifierTime.DESCRIBE_FORMAT_SHORT : IdentifierTime.DESCRIBE_FORMAT_LONG;\r\n return start.format(format);\r\n };\r\n IdentifierTime.prototype.matches = function (day, id) {\r\n return day.timeIdentifier === id;\r\n /*\r\n let obj: IdentifierObject = this.object(id);\r\n \n return (\r\n day.year === obj.year &&\r\n day.month === obj.month &&\r\n day.dayOfMonth === obj.day &&\r\n day.hour === obj.hour &&\r\n day.minute === obj.minute\r\n );\r\n */\r\n };\r\n IdentifierTime.DESCRIBE_FORMAT_LONG = 'LLL';\r\n IdentifierTime.DESCRIBE_FORMAT_SHORT = 'lll';\r\n IdentifierTime.SCALES = [\r\n 1 /* minute */,\r\n 100 /* hour */,\r\n 10000 /* day */,\r\n 1000000 /* month */,\r\n 100000000 /* year */\r\n ];\r\n IdentifierTime.LENGTH = 12;\r\n return IdentifierTime;\r\n}(Identifier_Identifier));\r\n// YYYYMMdd (8)\r\nvar Identifier_IdentifierDay = (function (_super) {\r\n __extends(IdentifierDay, _super);\r\n function IdentifierDay() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n IdentifierDay.prototype.getScales = function () {\r\n return IdentifierDay.SCALES;\r\n };\r\n IdentifierDay.prototype.getLength = function () {\r\n return IdentifierDay.LENGTH;\r\n };\r\n IdentifierDay.prototype.get = function (day) {\r\n return this.compute(day.dayOfMonth, day.month + 1, day.year);\r\n };\r\n IdentifierDay.prototype.object = function (id) {\r\n var values = this.decompute(id);\r\n return {\r\n day: values[0],\r\n month: values[1] - 1,\r\n year: values[2]\r\n };\r\n };\r\n IdentifierDay.prototype.start = function (id) {\r\n var obj = this.object(id);\r\n var start = Day_Day.build(obj.year, obj.month, obj.day);\r\n return start;\r\n };\r\n IdentifierDay.prototype.span = function (id, endInclusive) {\r\n if (endInclusive === void 0) { endInclusive = false; }\r\n var start = this.start(id);\r\n var end = start.end(endInclusive);\r\n return new DaySpan_DaySpan(start, end);\r\n };\r\n IdentifierDay.prototype.describe = function (id, short) {\r\n if (short === void 0) { short = false; }\r\n var start = this.start(id);\r\n var format = short ? IdentifierDay.DESCRIBE_FORMAT_SHORT : IdentifierDay.DESCRIBE_FORMAT_LONG;\r\n return start.format(format);\r\n };\r\n IdentifierDay.prototype.matches = function (day, id) {\r\n return day.dayIdentifier === id;\r\n /*\r\n let obj: IdentifierObject = this.object(id);\r\n \n return (\r\n day.year === obj.year &&\r\n day.month === obj.month &&\r\n day.dayOfMonth === obj.day\r\n );\r\n */\r\n };\r\n IdentifierDay.DESCRIBE_FORMAT_LONG = 'LL';\r\n IdentifierDay.DESCRIBE_FORMAT_SHORT = 'll';\r\n IdentifierDay.SCALES = [\r\n 1 /* day */,\r\n 100 /* month */,\r\n 10000 /* year */\r\n ];\r\n IdentifierDay.LENGTH = 8;\r\n return IdentifierDay;\r\n}(Identifier_Identifier));\r\n// YYYY0ww (7)\r\nvar Identifier_IdentifierWeek = (function (_super) {\r\n __extends(IdentifierWeek, _super);\r\n function IdentifierWeek() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n IdentifierWeek.prototype.getScales = function () {\r\n return IdentifierWeek.SCALES;\r\n };\r\n IdentifierWeek.prototype.getLength = function () {\r\n return IdentifierWeek.LENGTH;\r\n };\r\n IdentifierWeek.prototype.get = function (day) {\r\n return this.compute(day.week, day.year);\r\n };\r\n IdentifierWeek.prototype.object = function (id) {\r\n var values = this.decompute(id);\r\n return {\r\n week: values[0],\r\n year: values[1]\r\n };\r\n };\r\n IdentifierWeek.prototype.start = function (id) {\r\n var obj = this.object(id);\r\n var start = Day_Day.build(obj.year, 0).withWeek(obj.week);\r\n return start;\r\n };\r\n IdentifierWeek.prototype.span = function (id, endInclusive) {\r\n if (endInclusive === void 0) { endInclusive = false; }\r\n var start = this.start(id);\r\n var end = start.endOfWeek(endInclusive);\r\n return new DaySpan_DaySpan(start, end);\r\n };\r\n IdentifierWeek.prototype.describe = function (id, short) {\r\n if (short === void 0) { short = false; }\r\n var start = this.start(id);\r\n var format = short ? IdentifierWeek.DESCRIBE_FORMAT_SHORT : IdentifierWeek.DESCRIBE_FORMAT_LONG;\r\n return start.format(format);\r\n };\r\n IdentifierWeek.prototype.matches = function (day, id) {\r\n return day.weekIdentifier === id;\r\n /*\r\n let obj: IdentifierObject = this.object(id);\r\n \n return (\r\n day.year === obj.year &&\r\n day.week === obj.week\r\n );\r\n */\r\n };\r\n IdentifierWeek.DESCRIBE_FORMAT_LONG = 'wo [week of] YYYY';\r\n IdentifierWeek.DESCRIBE_FORMAT_SHORT = 'wo [week of] YYYY';\r\n IdentifierWeek.SCALES = [\r\n 1 /* week */,\r\n 1000 /* year */\r\n ];\r\n IdentifierWeek.LENGTH = 7;\r\n return IdentifierWeek;\r\n}(Identifier_Identifier));\r\n// YYYYMM (6)\r\nvar Identifier_IdentifierMonth = (function (_super) {\r\n __extends(IdentifierMonth, _super);\r\n function IdentifierMonth() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n IdentifierMonth.prototype.getScales = function () {\r\n return IdentifierMonth.SCALES;\r\n };\r\n IdentifierMonth.prototype.getLength = function () {\r\n return IdentifierMonth.LENGTH;\r\n };\r\n IdentifierMonth.prototype.get = function (day) {\r\n return this.compute(day.month + 1, day.year);\r\n };\r\n IdentifierMonth.prototype.object = function (id) {\r\n var values = this.decompute(id);\r\n return {\r\n month: values[0] - 1,\r\n year: values[1]\r\n };\r\n };\r\n IdentifierMonth.prototype.start = function (id) {\r\n var obj = this.object(id);\r\n var start = Day_Day.build(obj.year, obj.month);\r\n return start;\r\n };\r\n IdentifierMonth.prototype.span = function (id, endInclusive) {\r\n if (endInclusive === void 0) { endInclusive = false; }\r\n var start = this.start(id);\r\n var end = start.endOfMonth(endInclusive);\r\n return new DaySpan_DaySpan(start, end);\r\n };\r\n IdentifierMonth.prototype.describe = function (id, short) {\r\n if (short === void 0) { short = false; }\r\n var start = this.start(id);\r\n var format = short ? IdentifierMonth.DESCRIBE_FORMAT_SHORT : IdentifierMonth.DESCRIBE_FORMAT_LONG;\r\n return start.format(format);\r\n };\r\n IdentifierMonth.prototype.matches = function (day, id) {\r\n return day.monthIdentifier === id;\r\n /*\r\n let obj: IdentifierObject = this.object(id);\r\n \n return (\r\n day.year === obj.year &&\r\n day.month === obj.month\r\n );\r\n */\r\n };\r\n IdentifierMonth.DESCRIBE_FORMAT_LONG = 'MMMM YYYY';\r\n IdentifierMonth.DESCRIBE_FORMAT_SHORT = 'MMM YYYY';\r\n IdentifierMonth.SCALES = [\r\n 1 /* month */,\r\n 100 /* year */\r\n ];\r\n IdentifierMonth.LENGTH = 6;\r\n return IdentifierMonth;\r\n}(Identifier_Identifier));\r\n// YYYYQ (5)\r\nvar Identifier_IdentifierQuarter = (function (_super) {\r\n __extends(IdentifierQuarter, _super);\r\n function IdentifierQuarter() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n IdentifierQuarter.prototype.getScales = function () {\r\n return IdentifierQuarter.SCALES;\r\n };\r\n IdentifierQuarter.prototype.getLength = function () {\r\n return IdentifierQuarter.LENGTH;\r\n };\r\n IdentifierQuarter.prototype.get = function (day) {\r\n return this.compute(day.quarter, day.year);\r\n };\r\n IdentifierQuarter.prototype.object = function (id) {\r\n var values = this.decompute(id);\r\n return {\r\n quarter: values[0],\r\n year: values[1]\r\n };\r\n };\r\n IdentifierQuarter.prototype.start = function (id) {\r\n var obj = this.object(id);\r\n var start = Day_Day.build(obj.year, (obj.quarter - 1) * 3);\r\n return start;\r\n };\r\n IdentifierQuarter.prototype.span = function (id, endInclusive) {\r\n if (endInclusive === void 0) { endInclusive = false; }\r\n var start = this.start(id);\r\n var end = start.relativeMonths(3).endOfMonth(endInclusive);\r\n return new DaySpan_DaySpan(start, end);\r\n };\r\n IdentifierQuarter.prototype.describe = function (id, short) {\r\n if (short === void 0) { short = false; }\r\n var start = this.start(id);\r\n var format = short ? IdentifierQuarter.DESCRIBE_FORMAT_SHORT : IdentifierQuarter.DESCRIBE_FORMAT_LONG;\r\n return start.format(format);\r\n };\r\n IdentifierQuarter.prototype.matches = function (day, id) {\r\n return day.quarterIdentifier === id;\r\n /*\r\n let obj: IdentifierObject = this.object(id);\r\n \n return (\r\n day.year === obj.year &&\r\n day.quarter === obj.quarter\r\n );\r\n */\r\n };\r\n IdentifierQuarter.DESCRIBE_FORMAT_LONG = 'Qo [quarter] YYYY';\r\n IdentifierQuarter.DESCRIBE_FORMAT_SHORT = 'Qo [quarter] YYYY';\r\n IdentifierQuarter.SCALES = [\r\n 1 /* quarter */,\r\n 10 /* year */\r\n ];\r\n IdentifierQuarter.LENGTH = 5;\r\n return IdentifierQuarter;\r\n}(Identifier_Identifier));\r\n// YYYY (4)\r\nvar Identifier_IdentifierYear = (function (_super) {\r\n __extends(IdentifierYear, _super);\r\n function IdentifierYear() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n IdentifierYear.prototype.getScales = function () {\r\n return IdentifierYear.SCALES;\r\n };\r\n IdentifierYear.prototype.getLength = function () {\r\n return IdentifierYear.LENGTH;\r\n };\r\n IdentifierYear.prototype.get = function (day) {\r\n return this.compute(day.year);\r\n };\r\n IdentifierYear.prototype.object = function (id) {\r\n var values = this.decompute(id);\r\n return {\r\n year: values[0]\r\n };\r\n };\r\n IdentifierYear.prototype.start = function (id) {\r\n var obj = this.object(id);\r\n var start = Day_Day.build(obj.year, 0);\r\n return start;\r\n };\r\n IdentifierYear.prototype.span = function (id, endInclusive) {\r\n if (endInclusive === void 0) { endInclusive = false; }\r\n var start = this.start(id);\r\n var end = start.endOfYear(endInclusive);\r\n return new DaySpan_DaySpan(start, end);\r\n };\r\n IdentifierYear.prototype.describe = function (id, short) {\r\n if (short === void 0) { short = false; }\r\n var start = this.start(id);\r\n var format = short ? IdentifierYear.DESCRIBE_FORMAT_SHORT : IdentifierYear.DESCRIBE_FORMAT_LONG;\r\n return start.format(format);\r\n };\r\n IdentifierYear.prototype.matches = function (day, id) {\r\n return day.year === id;\r\n /*\r\n let obj: IdentifierObject = this.object(id);\r\n \n return (\r\n day.year === obj.year\r\n );\r\n */\r\n };\r\n IdentifierYear.DESCRIBE_FORMAT_LONG = 'YYYY';\r\n IdentifierYear.DESCRIBE_FORMAT_SHORT = 'YYYY';\r\n IdentifierYear.SCALES = [\r\n 1 /* year */\r\n ];\r\n IdentifierYear.LENGTH = 4;\r\n return IdentifierYear;\r\n}(Identifier_Identifier));\r\n// Sets the Identifier types\r\nIdentifier_Identifier.Time = new Identifier_IdentifierTime();\r\nIdentifier_Identifier.Day = new Identifier_IdentifierDay();\r\nIdentifier_Identifier.Week = new Identifier_IdentifierWeek();\r\nIdentifier_Identifier.Month = new Identifier_IdentifierMonth();\r\nIdentifier_Identifier.Quarter = new Identifier_IdentifierQuarter();\r\nIdentifier_Identifier.Year = new Identifier_IdentifierYear();\r\n\n// CONCATENATED MODULE: ./src/Suffix.ts\n\r\n/**\r\n * A class which takes a number and determines the suffix for that number.\r\n *\r\n * ```typescript\r\n * Suffix.CACHE[ 2 ]; // 2nd\r\n * Suffix.determine( 3 ); // rd\r\n * Suffix.get( 4 ); // th\r\n * Suffix.get( 4, true ); // 4th\r\n * ```\r\n */\r\nvar Suffix = (function () {\r\n function Suffix() {\r\n }\r\n Object.defineProperty(Suffix, \"CACHE\", {\r\n /**\r\n * The cache of number & suffix pairs.\r\n */\r\n get: function () {\r\n if (!this._CACHE) {\r\n this._CACHE = [];\r\n for (var i = 0; i <= this._CACHE_SIZE; i++) {\r\n this._CACHE[i] = this.get(i, true);\r\n }\r\n }\r\n return this._CACHE;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Determines the suffix for a given number.\r\n *\r\n * @param value The number to find the suffix for.\r\n * @returns The suffix determined.\r\n */\r\n Suffix.determine = function (value) {\r\n return value >= 11 && value <= 13 ? 'th' : this.MAP[value % this.MAP.length];\r\n };\r\n /**\r\n * Gets the suffix for a number and optionally appends it before the suffix.\r\n *\r\n * @param value The number to get the suffix for.\r\n * @param prepend When `true` the value is prepended to the suffix.\r\n * @returns The suffix or value & suffix pair determined.\r\n */\r\n Suffix.get = function (value, prepend) {\r\n if (prepend === void 0) { prepend = false; }\r\n var suffix = this.determine(value);\r\n return prepend ? value + suffix : suffix;\r\n };\r\n /**\r\n * The array of suffixes used.\r\n */\r\n Suffix.MAP = [\r\n 'th', 'st', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th'\r\n ];\r\n /**\r\n * The number of values to store in the cache (inclusive).\r\n */\r\n Suffix._CACHE_SIZE = 366;\r\n return Suffix;\r\n}());\r\n\r\n\n// CONCATENATED MODULE: ./src/Iterator.ts\n\r\n\r\n/**\r\n * An action to perform on the source as instructed by the iterator.\r\n */\r\nvar IteratorAction;\r\n(function (IteratorAction) {\r\n /**\r\n * Continue iteration.\r\n */\r\n IteratorAction[IteratorAction[\"Continue\"] = 0] = \"Continue\";\r\n /**\r\n * Stop iteration.\r\n */\r\n IteratorAction[IteratorAction[\"Stop\"] = 1] = \"Stop\";\r\n /**\r\n * Remove the current item if possible, and continue iteration.\r\n */\r\n IteratorAction[IteratorAction[\"Remove\"] = 2] = \"Remove\";\r\n})(IteratorAction = IteratorAction || (IteratorAction = {}));\r\n/**\r\n * A class that allows an iteratable source to be iterated any number of times\r\n * by providing the following functionality:\r\n *\r\n * - [[Iterator.isEmpty]]: Determines whether the source contains any items.\r\n * - [[Iterator.first]]: Gets the first item in the source.\r\n * - [[Iterator.count]]: Counds the number of items in the source.\r\n * - [[Iterator.list]]: Builds a list of the items in the source.\r\n * - [[Iterator.object]]: Builds an object of the items in the source.\r\n * - [[Iterator.reduce]]: Reduces the items in the source down to a single value.\r\n * - [[Iterator.purge]]: Removes items from the source which meet some criteria.\r\n * - [[Iterator.filter]]: Returns a subset of items that meet some criteria by\r\n * returning a new Iterator.\r\n * - [[Iterator.map]]: Maps each item in the source to another item by returning\r\n * a new Iterator.\r\n * - [[Iterator.iterate]]: Invokes a function for each item in the source.\r\n *\r\n * The following static functions exist to help iterate simple sources:\r\n *\r\n * - [[Iterator.forArray]]: Iterates an array, optionally reverse\r\n * - [[Iterator.forObject]]: Iterates the properties of an object, optionally\r\n * just the properties explicitly set on the object.\r\n *\r\n * ```typescript\r\n * let iter = object.iterateThings();\r\n * iter.isEmpty(); // no items?\r\n * iter.isEmpty(d => d.flag); // no items that meet some criteria?\r\n * iter.count(); // number of items\r\n * iter.count(d => d.flag); // number of items that meet some criteria\r\n * iter.first(); // first item\r\n * iter.first(d => d.flag); // first item that meets some criteria\r\n * iter.list(); // get all items as array\r\n * iter.list(myArray); // add all items to given array\r\n * iter.list([], d => d.flag); // get all items as array that meet some criteria\r\n * iter.object(d => d.id); // get all items as an object keyed by a value (ex: id)\r\n * iter.object(d => d.id, {},\r\n * d => d.flag); // get all items as an object keyed by a value where the item meets some criteria (ex: key id if flag is truthy)\r\n * iter.purge(d => d.flag); // remove all items from source that meet some criteria\r\n * iter.filter(d => d.flag); // returns an iterator which iterates a subset of items which meet some criteria\r\n * iter.reduce(0,\r\n * (d, t) => t + d.size); // reduces all items to a single value (ex: sums all size)\r\n * iter.reduce(0,\r\n * (d, t) => t + d.size,\r\n * d => d.flag); // reduces all items to a single value (ex: sums all size) where the item meets some criteria\r\n * iter.map(d => d.subitem); // return an iterator for subitems if they exist\r\n * iter.iterate(d => log(d)); // do something for each item\r\n * ```\r\n *\r\n * @typeparam T The type of item being iterated.\r\n */\r\nvar Iterator_Iterator = (function () {\r\n /**\r\n * Creates a new Iterator given a source.\r\n *\r\n * @param source The source of items to iterator.\r\n */\r\n function Iterator(source) {\r\n /**\r\n * A result of the iteration passed to [[Iterator.stop]].\r\n */\r\n this.result = null;\r\n this.source = source;\r\n }\r\n /**\r\n * Returns a clone of this iterator with the same source. This is necessary\r\n * if you want to iterate all or a portion of the source while already\r\n * iterating it (like a nested loop).\r\n */\r\n Iterator.prototype.clone = function () {\r\n return new Iterator(this.source);\r\n };\r\n /**\r\n * Passes the given item to the iterator callback and returns the action\r\n * requested at this point in iteration.\r\n *\r\n * @param item The current item being iterated.\r\n */\r\n Iterator.prototype.act = function (item) {\r\n this.action = IteratorAction.Continue;\r\n this.callback(item, this);\r\n return this.action;\r\n };\r\n /**\r\n * Stops iteration and optionally sets the result of the iteration.\r\n *\r\n * @param result The result of the iteration.\r\n */\r\n Iterator.prototype.stop = function (result) {\r\n this.result = result;\r\n this.action = IteratorAction.Stop;\r\n return this;\r\n };\r\n /**\r\n * Signals to the iterator source that the current item wants to be removed.\r\n */\r\n Iterator.prototype.remove = function () {\r\n this.action = IteratorAction.Remove;\r\n return this;\r\n };\r\n /**\r\n * Determines with this iterator is empty. A filter function can be specified\r\n * to only check for items which match certain criteria.\r\n *\r\n * @param filter A function to the checks items for certain criteria.\r\n * @returns `true` if no valid items exist in the source.\r\n */\r\n Iterator.prototype.isEmpty = function (filter) {\r\n if (filter === void 0) { filter = null; }\r\n var empty = true;\r\n this.iterate(function (item, iterator) {\r\n if (filter && !filter(item)) {\r\n return;\r\n }\r\n empty = false;\r\n iterator.stop();\r\n });\r\n return empty;\r\n };\r\n /**\r\n * Counts the number of items in the iterator. A filter function can be\r\n * specified to only count items which match certain criteria.\r\n *\r\n * @param filter A function to count items for certain criteria.\r\n * @returns The number of items in the source that optionally match the given\r\n * criteria.\r\n */\r\n Iterator.prototype.count = function (filter) {\r\n if (filter === void 0) { filter = null; }\r\n var total = 0;\r\n this.iterate(function (item, iterator) {\r\n if (filter && !filter(item)) {\r\n return;\r\n }\r\n total++;\r\n });\r\n return total;\r\n };\r\n /**\r\n * Returns the first item in the iterator. A filter function can be specified\r\n * to only return the first item which matches certain criteria.\r\n *\r\n * @param filter A function to compare items to to match certain criteria.\r\n * @returns The first item found that optonally matches the given criteria.\r\n */\r\n Iterator.prototype.first = function (filter) {\r\n if (filter === void 0) { filter = null; }\r\n var first = null;\r\n this.iterate(function (item, iterator) {\r\n if (filter && !filter(item)) {\r\n return;\r\n }\r\n first = item;\r\n iterator.stop();\r\n });\r\n return first;\r\n };\r\n /**\r\n * Builds a list of items from the source. A filter function can be specified\r\n * so the resulting list only contain items that match certain criteria.\r\n *\r\n * @param out The array to place the items in.\r\n * @param filter The function which determines which items are added to the list.\r\n * @returns The reference to `out` which has had items added to it which\r\n * optionally match the given criteria.\r\n */\r\n Iterator.prototype.list = function (out, filter) {\r\n if (out === void 0) { out = []; }\r\n if (filter === void 0) { filter = null; }\r\n this.iterate(function (item, iterator) {\r\n if (filter && !filter(item)) {\r\n return;\r\n }\r\n out.push(item);\r\n });\r\n return out;\r\n };\r\n /**\r\n * Builds an object of items from the source keyed by a result returned by\r\n * a `getKey` function.\r\n *\r\n * @param getKey The function which returns the key of the object.\r\n * @param out The object to place the items in.\r\n * @param filter The function which determines which items are set on the object.\r\n * @returns The reference to `out` which has had items set to it which\r\n * optionally match the given criteria.\r\n */\r\n Iterator.prototype.object = function (getKey, out, filter) {\r\n if (out === void 0) { out = {}; }\r\n if (filter === void 0) { filter = null; }\r\n this.iterate(function (item, iterator) {\r\n if (filter && !filter(item)) {\r\n return;\r\n }\r\n var key = getKey(item);\r\n out[key] = item;\r\n });\r\n return out;\r\n };\r\n /**\r\n * Returns a new iterator that only returns a maximum number of items.\r\n *\r\n * @param amount The maximum number of items to return.\r\n * @returns A new iterator which returns a maximum number of items.\r\n */\r\n Iterator.prototype.take = function (amount) {\r\n var _this = this;\r\n return new Iterator(function (next) {\r\n _this.iterate(function (item, prev) {\r\n switch (next.act(item)) {\r\n case IteratorAction.Stop:\r\n prev.stop();\r\n break;\r\n case IteratorAction.Remove:\r\n prev.remove();\r\n break;\r\n }\r\n if (--amount <= 0) {\r\n prev.stop();\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Returns a new iterator that skips the given number of items from the items\r\n * in this iterator.\r\n *\r\n * @param amount The number of items to skip.\r\n * @returns A new iterator which skipped the given number of items.\r\n */\r\n Iterator.prototype.skip = function (amount) {\r\n var _this = this;\r\n return new Iterator(function (next) {\r\n var skipped = 0;\r\n _this.iterate(function (item, prev) {\r\n if (skipped >= amount) {\r\n switch (next.act(item)) {\r\n case IteratorAction.Stop:\r\n prev.stop();\r\n break;\r\n case IteratorAction.Remove:\r\n prev.remove();\r\n break;\r\n }\r\n }\r\n skipped++;\r\n });\r\n });\r\n };\r\n /**\r\n * Returns a new iterator thats items are the items in this iterator followed\r\n * by the items in the given iterators.\r\n *\r\n * @param iterators The iterators to append after this one.\r\n * @returns A new iterator based on this iterator followed by the given.\r\n */\r\n Iterator.prototype.append = function () {\r\n var iterators = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n iterators[_i] = arguments[_i];\r\n }\r\n return Iterator.join.apply(Iterator, [this].concat(iterators));\r\n };\r\n /**\r\n * Returns a new iterator thats items are the items in the given iterators\r\n * followed by the items in this iterator.\r\n *\r\n * @param iterators The iterators to prepend before this one.\r\n * @returns A new iterator based on the given iterators followed by this.\r\n */\r\n Iterator.prototype.prepend = function () {\r\n var iterators = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n iterators[_i] = arguments[_i];\r\n }\r\n return Iterator.join.apply(Iterator, iterators.concat([this]));\r\n };\r\n /**\r\n * Removes items from the source that match certain criteria.\r\n *\r\n * @param filter The function which determines which items to remove.\r\n */\r\n Iterator.prototype.purge = function (filter) {\r\n this.iterate(function (item, iterator) {\r\n if (filter(item)) {\r\n iterator.remove();\r\n }\r\n });\r\n return this;\r\n };\r\n /**\r\n * Returns an iterator which takes items from this iterator and presents them\r\n * in reverse.\r\n *\r\n * @returns A new iterator with the items in this iterator in reverse.\r\n */\r\n Iterator.prototype.reverse = function () {\r\n var _this = this;\r\n return new Iterator(function (iterator) {\r\n var items = _this.list();\r\n var removed = [];\r\n for (var i = items.length - 1; i >= 0; i--) {\r\n var item = items[i];\r\n var action = iterator.act(item);\r\n if (action === IteratorAction.Stop) {\r\n break;\r\n }\r\n if (action === IteratorAction.Remove) {\r\n removed.push(item);\r\n }\r\n }\r\n if (removed.length > 0) {\r\n _this.purge(function (item) { return removed.indexOf(item) !== -1; });\r\n }\r\n });\r\n };\r\n /**\r\n * Reduces all the items in the source to a single value given the initial\r\n * value and a function to convert an item and the current reduced value\r\n */\r\n Iterator.prototype.reduce = function (initial, reducer, filter) {\r\n if (filter === void 0) { filter = null; }\r\n var reduced = initial;\r\n this.iterate(function (item, iterator) {\r\n if (filter && !filter(item)) {\r\n return;\r\n }\r\n reduced = reducer(item, reduced);\r\n });\r\n return reduced;\r\n };\r\n /**\r\n * Returns an iterator where this iterator is the source and the returned\r\n * iterator is built on a subset of items which pass a `filter` function.\r\n *\r\n * @param filter The function which determines if an item should be iterated.\r\n * @returns A new iterator for the filtered items from this iterator.\r\n */\r\n Iterator.prototype.filter = function (filter) {\r\n var _this = this;\r\n return new Iterator(function (next) {\r\n _this.iterate(function (prevItem, prev) {\r\n if (filter(prevItem)) {\r\n switch (next.act(prevItem)) {\r\n case IteratorAction.Stop:\r\n prev.stop();\r\n break;\r\n case IteratorAction.Remove:\r\n prev.remove();\r\n break;\r\n }\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Returns an iterator where this iterator is the source and the returned\r\n * iterator is built from mapped items pulled from items in the source\r\n * of this iterator. If the given callback `outerCallback` does not return\r\n * a mapped value then the returned iterator will not see the item. A filter\r\n * function can be specified to only look at mapping items which match\r\n * certain criteria.\r\n *\r\n * @param mapper The function which maps an item to another.\r\n * @param filter The function which determines if an item should be mapped.\r\n * @returns A new iterator for the mapped items from this iterator.\r\n */\r\n Iterator.prototype.map = function (mapper, filter) {\r\n var _this = this;\r\n if (filter === void 0) { filter = null; }\r\n return new Iterator(function (next) {\r\n _this.iterate(function (prevItem, prev) {\r\n if (filter && !filter(prevItem)) {\r\n return;\r\n }\r\n var nextItem = mapper(prevItem, prev);\r\n if (Functions.isDefined(nextItem)) {\r\n switch (next.act(nextItem)) {\r\n case IteratorAction.Stop:\r\n prev.stop();\r\n break;\r\n case IteratorAction.Remove:\r\n prev.remove();\r\n break;\r\n }\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Invokes the callback for each item in the source of this iterator. The\r\n * second argument in the callback is the reference to this iterator and\r\n * [[Iterator.stop]] can be called at anytime to cease iteration.\r\n *\r\n * @param callback The function to invoke for each item in this iterator.\r\n */\r\n Iterator.prototype.iterate = function (callback) {\r\n this.result = undefined;\r\n this.callback = callback;\r\n this.action = IteratorAction.Continue;\r\n this.source(this);\r\n this.callback = null;\r\n return this;\r\n };\r\n /**\r\n * Passes the result of the iteration to the given function if a truthy\r\n * result was passed to [[Iterator.stop]].\r\n *\r\n * @param getResult The function to pass the result to if it exists.\r\n */\r\n Iterator.prototype.withResult = function (getResult) {\r\n if (this.result) {\r\n getResult(this.result);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Returns an iterator for the given array optionally iterating it in reverse.\r\n *\r\n * @param items The array of items to iterate.\r\n * @param reverse If the array should be iterated in reverse.\r\n * @returns A new iterator for the given array.\r\n */\r\n Iterator.forArray = function (items, reverse) {\r\n if (reverse === void 0) { reverse = false; }\r\n return new Iterator(function (iterator) {\r\n if (reverse) {\r\n for (var i = items.length - 1; i >= 0; i--) {\r\n switch (iterator.act(items[i])) {\r\n case IteratorAction.Stop:\r\n return;\r\n case IteratorAction.Remove:\r\n items.splice(i, 1);\r\n break;\r\n }\r\n }\r\n }\r\n else {\r\n for (var i = 0; i < items.length; i++) {\r\n switch (iterator.act(items[i])) {\r\n case IteratorAction.Stop:\r\n return;\r\n case IteratorAction.Remove:\r\n items.splice(i, 1);\r\n i--;\r\n break;\r\n }\r\n }\r\n }\r\n });\r\n };\r\n /**\r\n * Returns an iterator for the given object optionally checking the\r\n * `hasOwnProperty` function on the given object.\r\n *\r\n * @param items The object to iterate.\r\n * @param hasOwnProperty If `hasOwnProperty` should be checked.\r\n * @returns A new iterator for the given object.\r\n */\r\n Iterator.forObject = function (items, hasOwnProperty) {\r\n if (hasOwnProperty === void 0) { hasOwnProperty = true; }\r\n return new Iterator(function (iterator) {\r\n for (var key in items) {\r\n if (hasOwnProperty && !items.hasOwnProperty(key)) {\r\n continue;\r\n }\r\n switch (iterator.act(items[key])) {\r\n case IteratorAction.Stop:\r\n return;\r\n case IteratorAction.Remove:\r\n delete items[key];\r\n break;\r\n }\r\n }\r\n });\r\n };\r\n /**\r\n * Joins all the given iterators into a single iterator where the items\r\n * returned are in the same order as passed to this function. If any items\r\n * are removed from the returned iterator they will be removed from the given\r\n * iterator if it supports removal.\r\n *\r\n * @param iterators The array of iterators to join as one.\r\n * @returns A new iterator for the given iterators.\r\n */\r\n Iterator.join = function () {\r\n var iterators = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n iterators[_i] = arguments[_i];\r\n }\r\n return new Iterator(function (parent) {\r\n for (var _i = 0, iterators_1 = iterators; _i < iterators_1.length; _i++) {\r\n var child = iterators_1[_i];\r\n child.iterate(function (item, childIterator) {\r\n switch (parent.act(item)) {\r\n case IteratorAction.Remove:\r\n childIterator.remove();\r\n break;\r\n case IteratorAction.Stop:\r\n childIterator.stop();\r\n break;\r\n }\r\n });\r\n if (child.action === IteratorAction.Stop) {\r\n return;\r\n }\r\n }\r\n });\r\n };\r\n /**\r\n * Returns a new iterator with no items.\r\n *\r\n * @returns A new iterator with no items.\r\n */\r\n Iterator.empty = function () {\r\n return new Iterator(function (parent) { });\r\n };\r\n return Iterator;\r\n}());\r\n\r\n\n// CONCATENATED MODULE: ./src/ScheduleModifier.ts\n\r\n\r\n\r\n/**\r\n * A class that can modify the events of a schedule by storing [[Identifier]]s\r\n * and an associated value.\r\n *\r\n * @typeparam T The type of data that modifies the schedule.\r\n */\r\nvar ScheduleModifier_ScheduleModifier = (function () {\r\n /**\r\n * Creates a new schedule modifier.\r\n */\r\n function ScheduleModifier() {\r\n this.map = {};\r\n }\r\n /**\r\n * Clears the modifier of all modifications.\r\n */\r\n ScheduleModifier.prototype.clear = function () {\r\n this.map = {};\r\n return this;\r\n };\r\n /**\r\n * Returns `true` if this modifier lacks any modifications, otherwise `false`.\r\n */\r\n ScheduleModifier.prototype.isEmpty = function () {\r\n // @ts-ignore\r\n for (var id in this.map) {\r\n return !id;\r\n }\r\n return true;\r\n };\r\n /**\r\n * Gets the most specific value in this modifier for the given day, if none\r\n * exists `otherwise` is returned. A modifier can have multiple values for a\r\n * given day because [[Identifier]]s represent a span of time.\r\n *\r\n * @param day The day to get a value for.\r\n * @param otherwise What to return if no value exists for the given day.\r\n * @param lookAtTime If the specific time of the given day should be looked at.\r\n * @returns The most specific value for the given day, or `otherwise`.\r\n */\r\n ScheduleModifier.prototype.get = function (day, otherwise, lookAtTime) {\r\n if (lookAtTime === void 0) { lookAtTime = true; }\r\n var map = this.map;\r\n return (lookAtTime && map[day.timeIdentifier]) ||\r\n map[day.dayIdentifier] ||\r\n map[day.monthIdentifier] ||\r\n map[day.weekIdentifier] ||\r\n map[day.quarterIdentifier] ||\r\n otherwise;\r\n };\r\n /**\r\n * Gets all values in this modifier for the given day. If none exist, an empty\r\n * array is returned. The values returned in the array are returned in most\r\n * specific to least specific.\r\n *\r\n * @param day The day to get the values for.\r\n * @returns An array of values (modifications) for the given day.\r\n */\r\n ScheduleModifier.prototype.getAll = function (day) {\r\n var map = this.map;\r\n var all = [];\r\n if (map[day.timeIdentifier])\r\n all.push(map[day.timeIdentifier]);\r\n if (map[day.dayIdentifier])\r\n all.push(map[day.dayIdentifier]);\r\n if (map[day.monthIdentifier])\r\n all.push(map[day.monthIdentifier]);\r\n if (map[day.weekIdentifier])\r\n all.push(map[day.weekIdentifier]);\r\n if (map[day.quarterIdentifier])\r\n all.push(map[day.quarterIdentifier]);\r\n return all;\r\n };\r\n /**\r\n * Moves the value/modification from one identifier to another.\r\n *\r\n * @param from The day to take the identifier from.\r\n * @param fromType The identifier type.\r\n * @param to The day to move the value to.\r\n * @param toType The identifier type to move the value to.\r\n */\r\n ScheduleModifier.prototype.move = function (from, fromType, to, toType) {\r\n var fromIdentifier = fromType.get(from);\r\n var toIdentifier = toType.get(to);\r\n this.map[toIdentifier] = this.map[fromIdentifier];\r\n delete this.map[fromIdentifier];\r\n return this;\r\n };\r\n /**\r\n * Moves any identifiers with the matching time `fromTime` to `toTime` and\r\n * returns the number of moves.\r\n *\r\n * @param fromTime The time to move from.\r\n * @param toTime The time to move to.\r\n * @returns The number of modifiers moved.\r\n */\r\n ScheduleModifier.prototype.moveTime = function (fromTime, toTime) {\r\n var type = Identifier_Identifier.Time;\r\n var moveIds = [];\r\n this.iterate().iterate(function (_a) {\r\n var id = _a[0], value = _a[1];\r\n if (type.is(id)) {\r\n var start = type.start(id);\r\n if (start.sameTime(fromTime)) {\r\n moveIds.push(id);\r\n }\r\n }\r\n });\r\n var moved = 0;\r\n for (var _i = 0, moveIds_1 = moveIds; _i < moveIds_1.length; _i++) {\r\n var id = moveIds_1[_i];\r\n var value = this.map[id];\r\n var start = type.start(id);\r\n var newStart = start.withTime(toTime);\r\n var newId = type.get(newStart);\r\n if (!this.map[newId]) {\r\n this.map[newId] = value;\r\n delete this.map[id];\r\n moved++;\r\n }\r\n }\r\n return moved;\r\n };\r\n /**\r\n * Sets the value/modification in this map given a day, the value, and the\r\n * identifier type.\r\n *\r\n * @param day The day to take an identifier from.\r\n * @param value The value/modification to set.\r\n * @param type The identifier type.\r\n */\r\n ScheduleModifier.prototype.set = function (day, value, type) {\r\n this.map[type.get(day)] = value;\r\n return this;\r\n };\r\n /**\r\n * Removes the value/modification from this modifier based on the identifier\r\n * pulled from the day.\r\n *\r\n * @param day The day to take an identifier from.\r\n * @param type The identifier type.\r\n */\r\n ScheduleModifier.prototype.unset = function (day, type) {\r\n delete this.map[type.get(day)];\r\n return this;\r\n };\r\n /**\r\n * Iterates through the modifiers passing the identifier and the related value.\r\n *\r\n * @returns A new instance of an [[Iterator]].\r\n */\r\n ScheduleModifier.prototype.iterate = function () {\r\n var _this = this;\r\n return new Iterator_Iterator(function (iterator) {\r\n var map = _this.map;\r\n for (var rawId in map) {\r\n var asNumber = parseInt(rawId);\r\n var validAsNumber = asNumber + '' === rawId;\r\n var id = validAsNumber ? asNumber : rawId;\r\n switch (iterator.act([id, map[rawId]])) {\r\n case IteratorAction.Stop:\r\n return;\r\n case IteratorAction.Remove:\r\n delete map[rawId];\r\n break;\r\n }\r\n }\r\n });\r\n };\r\n /**\r\n * Queries the modifier for all values/modifications which fall in the time\r\n * span that the given identifier represents. All identifiers and their value\r\n * are passed to the given callback.\r\n *\r\n * @param prefix The identifier\r\n * @returns A new instance of an [[Iterator]].\r\n */\r\n ScheduleModifier.prototype.query = function (query) {\r\n return this.iterate()\r\n .filter(function (_a) {\r\n var id = _a[0], value = _a[1];\r\n return Identifier_Identifier.contains(query, id);\r\n });\r\n ;\r\n };\r\n /**\r\n * Returns all identifiers stored in this modifier.\r\n */\r\n ScheduleModifier.prototype.identifiers = function (filter) {\r\n return this.iterate()\r\n .filter(function (_a) {\r\n var id = _a[0], value = _a[1];\r\n return !filter || filter(value, id);\r\n })\r\n .map(function (_a) {\r\n var id = _a[0];\r\n return id;\r\n });\r\n };\r\n /**\r\n * Builds a list of spans and the associated values. The spans are calculated\r\n * from the identiier key via [[Identifier.span]].\r\n *\r\n * @param endInclusive If the end date in the spans should be the last\r\n * millisecond of the timespan or the first millisecond of the next.\r\n * @returns An array of spans calculated from the identifiers with the\r\n * associated values/modifications.\r\n */\r\n ScheduleModifier.prototype.spans = function (endInclusive) {\r\n if (endInclusive === void 0) { endInclusive = false; }\r\n return this.iterate()\r\n .map(function (_a) {\r\n var id = _a[0], value = _a[1];\r\n var type = Identifier_Identifier.find(id);\r\n if (type) {\r\n var span = type.span(id, endInclusive);\r\n return { span: span, value: value };\r\n }\r\n });\r\n };\r\n /**\r\n * Builds a list of the descriptions of the identifiers in this modifier.\r\n *\r\n * @param short If the description should use shorter language or longer.\r\n * @returns The built list of descriptions.\r\n */\r\n ScheduleModifier.prototype.describe = function (short) {\r\n if (short === void 0) { short = false; }\r\n return this.iterate()\r\n .map(function (_a) {\r\n var id = _a[0];\r\n var type = Identifier_Identifier.find(id);\r\n if (type) {\r\n return type.describe(id, short);\r\n }\r\n });\r\n };\r\n /**\r\n * Builds a map of the values/modifications keyed by the descripton of the\r\n * identifier computed via [[Identifier.describe]].\r\n *\r\n * @param short If the description should use shorter language or longer.\r\n * @returns The built map of description to values/modifications.\r\n */\r\n ScheduleModifier.prototype.describeMap = function (short) {\r\n if (short === void 0) { short = false; }\r\n var map = this.map;\r\n var out = {};\r\n for (var id in map) {\r\n var type = Identifier_Identifier.find(id);\r\n if (type) {\r\n out[type.describe(id, short)] = map[id];\r\n }\r\n }\r\n return out;\r\n };\r\n return ScheduleModifier;\r\n}());\r\n\r\n\n// CONCATENATED MODULE: ./src/Schedule.ts\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10_moment__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10_moment___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_10_moment__);\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n// @ts-ignore\r\n\r\n/**\r\n * A class which describes when an event occurs over what time and if it repeats.\r\n *\r\n * @typeparam M The type of metadata stored in the schedule.\r\n */\r\nvar Schedule_Schedule = (function () {\r\n /**\r\n * Creates a schedule based on the given input.\r\n *\r\n * @param input The input which describes the schedule of events.\r\n */\r\n function Schedule(input) {\r\n this.exclude = new ScheduleModifier_ScheduleModifier();\r\n this.include = new ScheduleModifier_ScheduleModifier();\r\n this.cancel = new ScheduleModifier_ScheduleModifier();\r\n this.meta = new ScheduleModifier_ScheduleModifier();\r\n if (Functions.isDefined(input)) {\r\n this.set(input);\r\n }\r\n }\r\n /**\r\n * Sets the schedule with the given input.\r\n *\r\n * @param input The input which describes the schedule of events.\r\n * @param parseMeta A function to use when parsing meta input into the desired type.\r\n * @see [[Parse.schedule]]\r\n */\r\n Schedule.prototype.set = function (input, parseMeta) {\r\n if (parseMeta === void 0) { parseMeta = (function (x) { return x; }); }\r\n Parse_Parse.schedule(input, Functions.coalesce(input.parseMeta, parseMeta), this);\r\n return this;\r\n };\r\n Object.defineProperty(Schedule.prototype, \"lastTime\", {\r\n /**\r\n * Returns the last event time specified or `undefined` if this schedule is\r\n * for an all day event.\r\n */\r\n get: function () {\r\n return this.times[this.times.length - 1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Schedule.prototype, \"identifierType\", {\r\n /**\r\n * The [[Identifier]] for this schedule. Either [[Identifier.Day]] or\r\n * [[Identifier.Time]].\r\n */\r\n get: function () {\r\n return this.isFullDay() ? Identifier_Identifier.Day : Identifier_Identifier.Time;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Updates the [[Schedule.durationInDays]] variable based on the\r\n * [[Schedule.lastTime]] (if any), the [[Schedule.duration]] and it's\r\n * [[Schedule.durationUnit]].\r\n */\r\n Schedule.prototype.updateDurationInDays = function () {\r\n var start = this.lastTime ? this.lastTime.toMilliseconds() : 0;\r\n var duration = this.duration * (Constants.DURATION_TO_MILLIS[this.durationUnit] || 0);\r\n var exclude = Constants.MILLIS_IN_DAY;\r\n var day = Constants.MILLIS_IN_DAY;\r\n this.durationInDays = Math.max(0, Math.ceil((start + duration - exclude) / day));\r\n return this;\r\n };\r\n /**\r\n * Updates [[Schedule.checks]] based on the frequencies that were specified\r\n * in the schedule input.\r\n */\r\n Schedule.prototype.updateChecks = function () {\r\n this.checks = Parse_Parse.givenFrequency([\r\n this.year,\r\n this.month,\r\n this.week,\r\n this.weekOfYear,\r\n this.fullWeekOfYear,\r\n this.weekspanOfYear,\r\n this.lastFullWeekOfYear,\r\n this.lastWeekspanOfYear,\r\n this.weekOfMonth,\r\n this.weekspanOfMonth,\r\n this.fullWeekOfMonth,\r\n this.lastWeekspanOfMonth,\r\n this.lastFullWeekOfMonth,\r\n this.dayOfWeek,\r\n this.dayOfMonth,\r\n this.lastDayOfMonth,\r\n this.dayOfYear\r\n ]);\r\n return this;\r\n };\r\n /**\r\n * Determines whether the given day lies between the earliest and latest\r\n * valid day in the schedule.\r\n *\r\n * @param day The day to test.\r\n * @returns `true` if the day lies in the schedule, otherwise `false`.\r\n * @see [[Schedule.start]]\r\n * @see [[Schedule.end]]\r\n */\r\n Schedule.prototype.matchesSpan = function (day) {\r\n return (this.start === null || day.isSameOrAfter(this.start)) &&\r\n (this.end === null || day.isBefore(this.end));\r\n };\r\n /**\r\n * Determines whether the given range overlaps with the earliest and latest\r\n * valid days in this schedule (if any).\r\n *\r\n * @param start The first day in the range.\r\n * @param end The last day in the range.\r\n * @returns `true` if the range intersects with the schedule, otherwise `false`.\r\n * @see [[Schedule.start]]\r\n * @see [[Schedule.end]]\r\n */\r\n Schedule.prototype.matchesRange = function (start, end) {\r\n if (this.start && end.isBefore(this.start)) {\r\n return false;\r\n }\r\n if (this.end && start.isAfter(this.end)) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n /**\r\n * Determines whether the given day is explicitly excluded in the schedule.\r\n *\r\n * @param day The day to test.\r\n * @param lookAtTime lookAtTime If the specific time of the given day should\r\n * be looked at.\r\n * @returns `true` if the day was excluded, otherwise `false`.\r\n */\r\n Schedule.prototype.isExcluded = function (day, lookAtTime) {\r\n if (lookAtTime === void 0) { lookAtTime = true; }\r\n return this.exclude.get(day, false, lookAtTime);\r\n };\r\n /**\r\n * Determines whether the given day is explicitly included in the schedule.\r\n *\r\n * @param day The day to test.\r\n * @param lookAtTime lookAtTime If the specific time of the given day should\r\n * be looked at.\r\n * @returns `true` if the day is NOT explicitly included, otherwise `false`.\r\n */\r\n Schedule.prototype.isIncluded = function (day, lookAtTime) {\r\n if (lookAtTime === void 0) { lookAtTime = true; }\r\n return this.include.get(day, false, lookAtTime);\r\n };\r\n /**\r\n * Determines whether the given day is cancelled in the schedule.\r\n *\r\n * @param day The day to test.\r\n * @param lookAtTime lookAtTime If the specific time of the given day should\r\n * be looked at.\r\n * @returns `true` if the day was cancelled, otherwise `false`.\r\n */\r\n Schedule.prototype.isCancelled = function (day, lookAtTime) {\r\n if (lookAtTime === void 0) { lookAtTime = true; }\r\n return this.cancel.get(day, false, lookAtTime);\r\n };\r\n /**\r\n * Returns the metadata for the given day or `null` if there is none.\r\n *\r\n * @param day The day to return the metadata for.\r\n * @param otherwise The data to return if none exists for the given day.\r\n * @param lookAtTime lookAtTime If the specific time of the given day should\r\n * be looked at.\r\n * @returns The metadata or `null`.\r\n */\r\n Schedule.prototype.getMeta = function (day, otherwise, lookAtTime) {\r\n if (otherwise === void 0) { otherwise = null; }\r\n if (lookAtTime === void 0) { lookAtTime = true; }\r\n return this.meta.get(day, otherwise, lookAtTime);\r\n };\r\n /**\r\n * Returns all metadata for the given day or an empty array if there is none.\r\n *\r\n * @param day The day to return the metadata for.\r\n * @returns The array of metadata ordered by priority or an empty array.\r\n */\r\n Schedule.prototype.getMetas = function (day) {\r\n return this.meta.getAll(day);\r\n };\r\n /**\r\n * Returns whether the events in the schedule are all day long or start at\r\n * specific times. Full day events start at the start of the day and end at\r\n * the start of the next day (if the duration = `1` and durationUnit = 'days').\r\n * Full day events have no times specified and should have a durationUnit of\r\n * either `days` or `weeks`.\r\n */\r\n Schedule.prototype.isFullDay = function () {\r\n return this.times.length === 0;\r\n };\r\n /**\r\n * Sets whether this schedule is a full day event if it is not already. If\r\n * this schedule is a full day event and `false` is passed to this function\r\n * a single timed event will be added based on `defaultTime`. If this schedule\r\n * has timed events and `true` is passed to make the schedule full day, the\r\n * timed events are removed from this schedule. If the durationUnit is not the\r\n * expected unit based on the new full day flag - the duration is reset to 1\r\n * and the duration unit is set to the expected unit.\r\n *\r\n * @param fullDay Whether this schedule should represent a full day event or\r\n * timed events.\r\n * @param defaultTime If `fullDay` is `false` and this schedule is currently\r\n * a full day event - this time will be used as the time of the first event.\r\n */\r\n Schedule.prototype.setFullDay = function (fullDay, defaultTime) {\r\n if (fullDay === void 0) { fullDay = true; }\r\n if (defaultTime === void 0) { defaultTime = '08:00'; }\r\n if (fullDay !== this.isFullDay()) {\r\n if (fullDay) {\r\n this.times = [];\r\n if (this.durationUnit !== 'days' && this.durationUnit !== 'day') {\r\n this.duration = 1;\r\n this.durationUnit = 'days';\r\n }\r\n }\r\n else {\r\n this.times = [Parse_Parse.time(defaultTime)];\r\n if (this.durationUnit !== 'hours' && this.durationUnit !== 'hour') {\r\n this.duration = 1;\r\n this.durationUnit = 'hours';\r\n }\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Adjusts the [[Schedule.start]] and [[Schedule.end]] dates specified on this\r\n * schedule if this schedule represents a single event and the `start` and\r\n * `end` are already set or `addSpan` is `true`.\r\n *\r\n * @param addSpan If `true`, the `start` and `end` dates will always be\r\n * adjusted if this schedule is a single event.\r\n */\r\n Schedule.prototype.adjustDefinedSpan = function (addSpan) {\r\n if (addSpan === void 0) { addSpan = false; }\r\n var single = this.getSingleEventSpan();\r\n if (single && (addSpan || (this.start && this.end))) {\r\n this.start = single.start.start();\r\n this.end = single.end.end();\r\n }\r\n return this;\r\n };\r\n /**\r\n * Returns a span of time for a schedule with full day events starting on the\r\n * start of the given day with the desired duration in days or weeks.\r\n *\r\n * @param day The day the span starts on.\r\n * @returns The span of time starting on the given day.\r\n */\r\n Schedule.prototype.getFullSpan = function (day) {\r\n var start = day.start();\r\n var end = start.add(this.duration, this.durationUnit);\r\n return new DaySpan_DaySpan(start, end);\r\n };\r\n /**\r\n * Returns a span of time starting on the given day at the given day with the\r\n * duration specified on this schedule.\r\n *\r\n * @param day The day the span starts on.\r\n * @param time The time of day the span starts.\r\n * @returns The span of time calculated.\r\n */\r\n Schedule.prototype.getTimeSpan = function (day, time) {\r\n var start = day.withTime(time);\r\n var end = start.add(this.duration, this.durationUnit);\r\n return new DaySpan_DaySpan(start, end);\r\n };\r\n /**\r\n * Determines whether the given day is a day on the schedule for the start\r\n * of an event. If an event is more than one day and the day given is not the\r\n * start this may return `false`. This does not test for event instances\r\n * that exist through [[Schedule.include]].\r\n *\r\n * @param day The day to test.\r\n * @returns `true` if the day marks the start of an event on the schedule.\r\n * @see [[Schedule.isIncluded]]\r\n * @see [[Schedule.isFullyExcluded]]\r\n * @see [[Schedule.matchesSpan]]\r\n */\r\n Schedule.prototype.matchesDay = function (day) {\r\n if (this.isIncluded(day, false)) {\r\n return true;\r\n }\r\n if (!this.matchesSpan(day) || this.isFullyExcluded(day)) {\r\n return false;\r\n }\r\n for (var _i = 0, _a = this.checks; _i < _a.length; _i++) {\r\n var check = _a[_i];\r\n if (!check(day[check.property])) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Determines whether the given day has events added through\r\n * [[Schedule.include]].\r\n *\r\n * @param day The day to look for included times on.\r\n * @returns `true` if there are included event instances on the given day,\r\n * otherwise `false`.\r\n */\r\n Schedule.prototype.hasIncludedTime = function (day) {\r\n return !this.iterateIncludeTimes(day).isEmpty();\r\n };\r\n /**\r\n * Determines whether the given day is fully excluded from the schedule. A\r\n * fully excluded day is one that has a day-wide exclusion, or the schedule\r\n * is not an all-day event and all times in the schedule are specifically\r\n * excluded.\r\n *\r\n * @param day The day to test.*\r\n * @returns `true` if he day is fully excluded, otherwise `false`.\r\n */\r\n Schedule.prototype.isFullyExcluded = function (day) {\r\n if (this.isExcluded(day, false)) {\r\n return true;\r\n }\r\n if (this.isFullDay()) {\r\n return false;\r\n }\r\n for (var _i = 0, _a = this.times; _i < _a.length; _i++) {\r\n var time = _a[_i];\r\n if (!this.isExcluded(day.withTime(time))) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Finds the next day an event occurs on the schedule given a day to start,\r\n * optionally including it, and a maximum number of days to look ahead.\r\n *\r\n * @param day The day to start to search from.\r\n * @param includeDay If the given day should be included in the search.\r\n * @param lookAhead The maximum number of days to look ahead from the given\r\n * day for event occurrences.\r\n * @returns The next day on the schedule or `null` if none exists.\r\n */\r\n Schedule.prototype.nextDay = function (day, includeDay, lookAhead) {\r\n if (includeDay === void 0) { includeDay = false; }\r\n if (lookAhead === void 0) { lookAhead = 366; }\r\n return this.iterateDaycast(day, 1, true, includeDay, lookAhead).first();\r\n };\r\n /**\r\n * Finds the next specified number of days that events occur on the schedule\r\n * given a day to start, optionally including it, and a maximum number of days\r\n * to look ahead.\r\n *\r\n * @param day The day to start to search from.\r\n * @param max The maximum number of days to return in the result.\r\n * @param includeDay If the given day should be included in the search.\r\n * @param lookAhead The maximum number of days to look ahead from the given\r\n * day for event occurrences.\r\n * @returns An array containing the next days on the schedule that events\r\n * start or an empty array if there are none.\r\n */\r\n Schedule.prototype.nextDays = function (day, max, includeDay, lookAhead) {\r\n if (includeDay === void 0) { includeDay = false; }\r\n if (lookAhead === void 0) { lookAhead = 366; }\r\n return this.iterateDaycast(day, max, true, includeDay, lookAhead);\r\n };\r\n /**\r\n * Finds the previous day an event occurs on the schedule given a day to start,\r\n * optionally including it, and a maximum number of days to look behind.\r\n *\r\n * @param day The day to start to search from.\r\n * @param includeDay If the given day should be included in the search.\r\n * @param lookBack The maximum number of days to look behind from the given\r\n * day for event occurrences.\r\n * @returns The previous day on the schedule or `null` if none exists.\r\n */\r\n Schedule.prototype.prevDay = function (day, includeDay, lookBack) {\r\n if (includeDay === void 0) { includeDay = false; }\r\n if (lookBack === void 0) { lookBack = 366; }\r\n return this.iterateDaycast(day, 1, false, includeDay, lookBack).first();\r\n };\r\n /**\r\n * Finds the previous specified number of days that events occur on the\r\n * schedule given a day to start, optionally including it, and a maximum\r\n * number of days to look behind.\r\n *\r\n * @param day The day to start to search from.\r\n * @param max The maximum number of days to return in the result.\r\n * @param includeDay If the given day should be included in the search.\r\n * @param lookAhead The maximum number of days to look behind from the given\r\n * day for event occurrences.\r\n * @returns An array containing the previous days on the schedule that events\r\n * start or an empty array if there are none.\r\n */\r\n Schedule.prototype.prevDays = function (day, max, includeDay, lookBack) {\r\n if (includeDay === void 0) { includeDay = false; }\r\n if (lookBack === void 0) { lookBack = 366; }\r\n return this.iterateDaycast(day, max, false, includeDay, lookBack);\r\n };\r\n /**\r\n * Iterates over days that events start in the schedule given a day to start,\r\n * a maximum number of days to find, and a direction to look.\r\n *\r\n * @param day The day to start to search from.\r\n * @param max The maximum number of days to iterate.\r\n * @param next If `true` this searches forward, otherwise `false` is backwards.\r\n * @param includeDay If the given day should be included in the search.\r\n * @param lookup The maximum number of days to look through from the given\r\n * day for event occurrences.\r\n * @returns A new Iterator for the days found in the cast.\r\n * @see [[Schedule.iterateSpans]]\r\n */\r\n Schedule.prototype.iterateDaycast = function (day, max, next, includeDay, lookup) {\r\n var _this = this;\r\n if (includeDay === void 0) { includeDay = false; }\r\n if (lookup === void 0) { lookup = 366; }\r\n return new Iterator_Iterator(function (iterator) {\r\n var iterated = 0;\r\n for (var days = 0; days < lookup; days++) {\r\n if (!includeDay || days > 0) {\r\n day = next ? day.next() : day.prev();\r\n }\r\n if (!_this.iterateSpans(day, false).isEmpty()) {\r\n var action = iterator.act(day);\r\n if (action === IteratorAction.Stop || ++iterated >= max) {\r\n return;\r\n }\r\n }\r\n }\r\n });\r\n };\r\n /**\r\n * Iterates through the spans (event instances) that start on or covers the\r\n * given day.\r\n *\r\n * @param day The day to look for spans on.\r\n * @param covers If `true` spans which span multiple days will be looked at\r\n * to see if they intersect with the given day, otherwise `false` will\r\n * only look at the given day for the start of events.\r\n * @returns A new Iterator for all the spans found.\r\n */\r\n Schedule.prototype.iterateSpans = function (day, covers) {\r\n var _this = this;\r\n if (covers === void 0) { covers = false; }\r\n return new Iterator_Iterator(function (iterator) {\r\n var current = day;\r\n var lookBehind = covers ? _this.durationInDays : 0;\r\n // If the events start at the end of the day and may last multiple days....\r\n if (_this.isFullDay()) {\r\n // If the schedule has events which span multiple days we need to look\r\n // backwards for events that overlap with the given day.\r\n while (lookBehind >= 0) {\r\n // If the current day matches the schedule rules...\r\n if (_this.matchesDay(current)) {\r\n // Build a DaySpan with the given start day and the schedules duration.\r\n var span = _this.getFullSpan(current);\r\n // If that dayspan intersects with the given day, it's a winner!\r\n if (span.matchesDay(day)) {\r\n switch (iterator.act(span)) {\r\n case IteratorAction.Stop:\r\n return;\r\n }\r\n }\r\n }\r\n current = current.prev();\r\n lookBehind--;\r\n }\r\n }\r\n else {\r\n // If the schedule has events which span multiple days we need to look\r\n // backwards for events that overlap with the given day.\r\n while (lookBehind >= 0) {\r\n // If the current day matches the schedule rules...\r\n if (_this.matchesDay(current)) {\r\n // Iterate through each daily occurrence in the schedule...\r\n for (var _i = 0, _a = _this.times; _i < _a.length; _i++) {\r\n var time = _a[_i];\r\n var span = _this.getTimeSpan(current, time);\r\n // If the event intersects with the given day and the occurrence\r\n // has not specifically been excluded...\r\n if (span.matchesDay(day) && !_this.isExcluded(span.start, true)) {\r\n switch (iterator.act(span)) {\r\n case IteratorAction.Stop:\r\n return;\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n // The current day does not match the schedule, however the schedule\r\n // might have moved/random event occurrents on the current day.\r\n // We only want the ones that overlap with the given day.\r\n _this.iterateIncludeTimes(current, day).iterate(function (span, timeIterator) {\r\n switch (iterator.act(span)) {\r\n case IteratorAction.Stop:\r\n timeIterator.stop();\r\n break;\r\n }\r\n });\r\n if (iterator.action === IteratorAction.Stop) {\r\n return;\r\n }\r\n }\r\n current = current.prev();\r\n lookBehind--;\r\n }\r\n }\r\n });\r\n };\r\n /**\r\n * Determines if the given day is on the schedule and the time specified on\r\n * the day matches one of the times on the schedule.\r\n *\r\n * @param day The day to test.\r\n * @returns `true` if the day and time match the schedule, otherwise false.\r\n */\r\n Schedule.prototype.matchesTime = function (day) {\r\n return !!this.iterateSpans(day, true).first(function (span) { return span.start.sameMinute(day); });\r\n };\r\n /**\r\n * Determines if the given day is covered by this schedule. A schedule can\r\n * specify events that span multiple days - so even though the day does not\r\n * match the starting day of a span - it can be a day that is within the\r\n * schedule.\r\n *\r\n * @param day The day to test.\r\n * @returns `true` if the day is covered by an event on this schedule,\r\n * otherwise `false`.\r\n */\r\n Schedule.prototype.coversDay = function (day) {\r\n return !this.iterateSpans(day, true).isEmpty();\r\n };\r\n /**\r\n * Determines if the given timestamp lies in an event occurrence on this\r\n * schedule.\r\n *\r\n * @param day The timestamp to test against the schedule.\r\n * @return `true` if the timestamp lies in an event occurrent start and end\r\n * timestamps, otherwise `false`.\r\n */\r\n Schedule.prototype.coversTime = function (day) {\r\n return !!this.iterateSpans(day, true).first(function (span) { return span.contains(day); });\r\n };\r\n /**\r\n * Sets the frequency for the given property. This does not update the\r\n * [[Schedule.checks]] array, the [[Schedule.updateChecks]] function needs\r\n * to be called.\r\n *\r\n * @param property The frequency to update.\r\n * @param frequency The new frequency.\r\n */\r\n Schedule.prototype.setFrequency = function (property, frequency) {\r\n this[property] = Parse_Parse.frequency(frequency, property);\r\n return this;\r\n };\r\n /**\r\n * Changes the exclusion status of the event at the given time. By default\r\n * this excludes this event - but `false` may be passed to undo an exclusion.\r\n *\r\n * @param time The start time of the event occurrence to exclude or include.\r\n * @param excluded Whether the event should be excluded.\r\n */\r\n Schedule.prototype.setExcluded = function (time, excluded) {\r\n if (excluded === void 0) { excluded = true; }\r\n var type = this.identifierType;\r\n this.exclude.set(time, excluded, type);\r\n this.include.set(time, !excluded, type);\r\n return this;\r\n };\r\n /**\r\n * Changes the cancellation status of the event at the given start time. By\r\n * default this cancels the event occurrence - but `false` may be passed to\r\n * undo a cancellation.\r\n *\r\n * @param time The start time of the event occurrence to cancel or uncancel.\r\n * @param cancelled Whether the event should be cancelled.\r\n */\r\n Schedule.prototype.setCancelled = function (time, cancelled) {\r\n if (cancelled === void 0) { cancelled = true; }\r\n this.cancel.set(time, cancelled, this.identifierType);\r\n return this;\r\n };\r\n /**\r\n * Moves the event instance starting at `fromTime` to `toTime` optionally\r\n * placing `meta` in the schedules metadata for the new time `toTime`.\r\n * If this schedule has a single event ([[Schedule.isSingleEvent]]) then the\r\n * only value needed is `toTime` and not `fromTime`.\r\n *\r\n * @param toTime The timestamp of the new event.\r\n * @param fromTime The timestamp of the event on the schedule to move if this\r\n * schedule generates multiple events.\r\n * @param meta The metadata to place in the schedule for the given `toTime`.\r\n * @returns `true` if the schedule had the event moved, otherwise `false`.\r\n */\r\n Schedule.prototype.move = function (toTime, fromTime, meta) {\r\n if (!this.moveSingleEvent(toTime) && fromTime) {\r\n return this.moveInstance(fromTime, toTime, meta);\r\n }\r\n return false;\r\n };\r\n /**\r\n * Moves a time specified in this schedule to the given time, adjusting\r\n * any cancelled event instances, metadata, and any excluded and included\r\n * event instances.\r\n *\r\n * @param fromTime The time to move.\r\n * @param toTime The new time in the schedule.\r\n * @returns `true` if time was moved, otherwise `false`.\r\n */\r\n Schedule.prototype.moveTime = function (fromTime, toTime) {\r\n var found = false;\r\n for (var i = 0; i < this.times.length && !found; i++) {\r\n if (found = fromTime.matches(this.times[i])) {\r\n this.times.splice(i, 1, toTime);\r\n }\r\n }\r\n if (found) {\r\n this.include.moveTime(fromTime, toTime);\r\n this.exclude.moveTime(fromTime, toTime);\r\n this.cancel.moveTime(fromTime, toTime);\r\n this.meta.moveTime(fromTime, toTime);\r\n this.adjustDefinedSpan(false);\r\n }\r\n return found;\r\n };\r\n /**\r\n * Moves the event instance starting at `fromTime` to `toTime` optionally\r\n * placing `meta` in the schedules metadata for the new time `toTime`. A move\r\n * is accomplished by excluding the current event and adding an inclusion of\r\n * the new day & time.\r\n *\r\n * @param fromTime The timestamp of the event on the schedule to move.\r\n * @param toTime The timestamp of the new event.\r\n * @param meta The metadata to place in the schedule for the given `toTime`.\r\n * @returns `true`.\r\n * @see [[Schedule.move]]\r\n */\r\n Schedule.prototype.moveInstance = function (fromTime, toTime, meta) {\r\n var type = this.identifierType;\r\n this.exclude.set(fromTime, true, type);\r\n this.exclude.set(toTime, false, type);\r\n this.include.set(toTime, true, type);\r\n this.include.set(fromTime, false, type);\r\n if (Functions.isValue(meta)) {\r\n this.meta.unset(fromTime, type);\r\n this.meta.set(toTime, meta, type);\r\n }\r\n return true;\r\n };\r\n /**\r\n * Moves the single event in this schedule to the given day/time if applicable.\r\n * If this schedule is not a single event schedule then `false` is returned.\r\n * If this schedule is a timed event the time will take the time of the given\r\n * `toTime` of `takeTime` is `true`.\r\n *\r\n * @param toTime The time to move the single event to.\r\n * @param takeTime If this schedule has a single timed event, should the time\r\n * of the event be changed to the time of the given `toTime`?\r\n * @returns `true` if the schedule was adjusted, otherwise `false`.\r\n * @see [[Schedule.move]]\r\n */\r\n Schedule.prototype.moveSingleEvent = function (toTime, takeTime) {\r\n if (takeTime === void 0) { takeTime = true; }\r\n if (!this.isSingleEvent()) {\r\n return false;\r\n }\r\n for (var _i = 0, _a = this.checks; _i < _a.length; _i++) {\r\n var check = _a[_i];\r\n var prop = check.property;\r\n var value = toTime[prop];\r\n var frequency = Parse_Parse.frequency([value], prop);\r\n this[prop] = frequency;\r\n }\r\n if (this.times.length === 1 && takeTime) {\r\n this.times = [toTime.asTime()];\r\n }\r\n this.updateChecks();\r\n var span = this.getSingleEventSpan();\r\n if (this.start) {\r\n this.start = span.start.start();\r\n }\r\n if (this.end) {\r\n this.end = span.end.end();\r\n }\r\n return true;\r\n };\r\n /**\r\n * Returns the span of the single event in this schedule if it's that type of\r\n * schedule, otherwise `null` is returned.\r\n *\r\n * @returns A span of the single event, otherwise `null`.\r\n * @see [[Schedule.isSingleEvent]]\r\n */\r\n Schedule.prototype.getSingleEventSpan = function () {\r\n if (!this.isSingleEvent()) {\r\n return null;\r\n }\r\n var startOfYear = Day_Day.build(this.year.input[0], 0, 1);\r\n var start = this.iterateDaycast(startOfYear, 1, true, true, 366).first();\r\n if (!start) {\r\n return null;\r\n }\r\n return this.isFullDay() ?\r\n this.getFullSpan(start) :\r\n this.getTimeSpan(start, this.times[0]);\r\n };\r\n /**\r\n * Determines whether this schedule produces a single event, and no more.\r\n * If this schedule has any includes, it's assumed to be a multiple event\r\n * schedule. A single event can be detected in the following scenarios where\r\n * each frequency has a single occurrence (see [[Schedule.isSingleFrequency]]).\r\n *\r\n * - year, day of year\r\n * - year, month, day of month\r\n * - year, month, week of month, day of week\r\n * - year, week of year, day of week\r\n *\r\n * @returns `true` if this schedule produces a single event, otherwise `false`.\r\n */\r\n Schedule.prototype.isSingleEvent = function () {\r\n // 0 = full day, 1 = once a day, 1+ = multiple events a day\r\n if (this.times.length > 1) {\r\n return false;\r\n }\r\n // Let's assume if there are includes, this is not a single event.\r\n if (!this.include.isEmpty()) {\r\n return false;\r\n }\r\n // If this can occur on multiple years, not a single event.\r\n if (!this.isSingleYear()) {\r\n return false;\r\n }\r\n // If this is a specific year and day of the year: single!\r\n if (this.isSingleDayOfYear()) {\r\n return true;\r\n }\r\n // If this is a specific year, month, and day of month: single!\r\n if (this.isSingleMonth() && this.isSingleDayOfMonth()) {\r\n return true;\r\n }\r\n // If this is a specific year, month, week of the month, day of the week: single!\r\n if (this.isSingleMonth() && this.isSingleWeekOfMonth() && this.isSingleDayOfWeek()) {\r\n return true;\r\n }\r\n // If this is a specific year, week of the year, day of the week: single!\r\n if (this.isSingleWeekOfYear() && this.isSingleDayOfWeek()) {\r\n return true;\r\n }\r\n // Doesn't look like a single event.\r\n return false;\r\n };\r\n /**\r\n * @returns `true` if this schedule produces events only in a specific year.\r\n * @see [[Schedule.year]]\r\n */\r\n Schedule.prototype.isSingleYear = function () {\r\n return this.isSingleFrequency(this.year);\r\n };\r\n /**\r\n * @returns `true` if this schedule produces events only in a specific month.\r\n * @see [[Schedule.month]]\r\n */\r\n Schedule.prototype.isSingleMonth = function () {\r\n return this.isSingleFrequency(this.month);\r\n };\r\n /**\r\n * @returns `true` if this schedule produces events only in a specific day of\r\n * the month.\r\n * @see [[Schedule.dayOfMonth]]\r\n * @see [[Schedule.lastDayOfMonth]]\r\n */\r\n Schedule.prototype.isSingleDayOfMonth = function () {\r\n return this.isSingleFrequency(this.dayOfMonth) ||\r\n this.isSingleFrequency(this.lastDayOfMonth);\r\n };\r\n /**\r\n * @returns `true` if this schedule produces events only in a specific day of\r\n * the week.\r\n * @see [[Schedule.dayOfWeek]]\r\n */\r\n Schedule.prototype.isSingleDayOfWeek = function () {\r\n return this.isSingleFrequency(this.dayOfWeek);\r\n };\r\n /**\r\n * @returns `true` if this schedule produces events only in a specific day of\r\n * the year.\r\n * @see [[Schedule.dayOfYear]]\r\n */\r\n Schedule.prototype.isSingleDayOfYear = function () {\r\n return this.isSingleFrequency(this.dayOfYear);\r\n };\r\n /**\r\n * @returns `true` if this schedule produces events only in a specific week of\r\n * the month.\r\n * @see [[Schedule.weekspanOfMonth]]\r\n * @see [[Schedule.fullWeekOfMonth]]\r\n * @see [[Schedule.weekOfMonth]]\r\n * @see [[Schedule.lastFullWeekOfMonth]]\r\n * @see [[Schedule.lastWeekspanOfMonth]]\r\n */\r\n Schedule.prototype.isSingleWeekOfMonth = function () {\r\n return this.isSingleFrequency(this.weekspanOfMonth) ||\r\n this.isSingleFrequency(this.fullWeekOfMonth) ||\r\n this.isSingleFrequency(this.weekOfMonth) ||\r\n this.isSingleFrequency(this.lastFullWeekOfMonth) ||\r\n this.isSingleFrequency(this.lastWeekspanOfMonth);\r\n };\r\n /**\r\n * @returns `true` if this schedule produces events only in a specific week of\r\n * the year.\r\n * @see [[Schedule.weekspanOfYear]]\r\n * @see [[Schedule.fullWeekOfYear]]\r\n * @see [[Schedule.week]]\r\n * @see [[Schedule.weekOfYear]]\r\n * @see [[Schedule.lastFullWeekOfYear]]\r\n * @see [[Schedule.lastWeekspanOfYear]]\r\n */\r\n Schedule.prototype.isSingleWeekOfYear = function () {\r\n return this.isSingleFrequency(this.weekspanOfYear) ||\r\n this.isSingleFrequency(this.fullWeekOfYear) ||\r\n this.isSingleFrequency(this.week) ||\r\n this.isSingleFrequency(this.weekOfYear) ||\r\n this.isSingleFrequency(this.lastFullWeekOfYear) ||\r\n this.isSingleFrequency(this.lastWeekspanOfYear);\r\n };\r\n /**\r\n * Determines if the given [[FrequencyCheck]] results in a single occurrence.\r\n *\r\n * @returns `true` if the frequency results in a single event, otherwise `false`.\r\n */\r\n Schedule.prototype.isSingleFrequency = function (frequency) {\r\n return Functions.isArray(frequency.input) && frequency.input.length === 1;\r\n };\r\n /**\r\n * Creates a forecast for this schedule which returns a number of event\r\n * occurrences around a given day. A single item could be returned per day, or\r\n * you could get an item for each timed event occurrence.\r\n *\r\n * @param around The day to find a forecast around.\r\n * @param covers If `true` spans which span multiple days will be looked at\r\n * to see if they intersect with the given day, otherwise `false` will\r\n * only look at the given day for the start of events.\r\n * @param daysAfter The number of events to return before the given day.\r\n * @param daysBefore The number of events to return after the given day.\r\n * @param times If timed events should be returned, or only one for each day.\r\n * @param lookAround How many days to look before and after the given day for\r\n * event occurrences.\r\n * @returns A new iterator which provides the event occurence span, the day it\r\n * starts (or is covered if `covers` is `true`), and the identifier for the\r\n * event.\r\n */\r\n Schedule.prototype.forecast = function (around, covers, daysAfter, daysBefore, times, lookAround) {\r\n var _this = this;\r\n if (covers === void 0) { covers = true; }\r\n if (daysBefore === void 0) { daysBefore = daysAfter; }\r\n if (times === void 0) { times = false; }\r\n if (lookAround === void 0) { lookAround = 366; }\r\n var type = this.identifierType;\r\n var tuplesForDay = function (day, tuples) {\r\n var spans = _this.iterateSpans(day, covers).list();\r\n var last = times ? spans.length : Math.min(1, spans.length);\r\n var offset = times ? 0 : spans.length - 1;\r\n for (var i = 0; i < last; i++) {\r\n var span = spans[i + offset];\r\n var id = type.get(span.start);\r\n if (tuples.act([span, day, id]) === IteratorAction.Stop) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n var prev = new Iterator_Iterator(function (iterator) {\r\n var curr = around;\r\n for (var i = 0; i < lookAround; i++) {\r\n if (!tuplesForDay(curr, iterator)) {\r\n break;\r\n }\r\n curr = curr.prev();\r\n }\r\n });\r\n var next = new Iterator_Iterator(function (iterator) {\r\n var curr = around;\r\n for (var i = 0; i < lookAround; i++) {\r\n curr = curr.next();\r\n if (!tuplesForDay(curr, iterator)) {\r\n break;\r\n }\r\n }\r\n });\r\n return prev.take(daysBefore + 1).reverse().append(next.take(daysAfter));\r\n };\r\n /**\r\n * Iterates timed events that were explicitly specified on the given day.\r\n * Those events could span multiple days so may be tested against another day.\r\n *\r\n * @param day The day to look for included timed events.\r\n * @param matchAgainst The day to test against the timed event.\r\n * @returns A new Iterator for all the included spans found.\r\n */\r\n Schedule.prototype.iterateIncludeTimes = function (day, matchAgainst) {\r\n var _this = this;\r\n if (matchAgainst === void 0) { matchAgainst = day; }\r\n var isIncludedTime = function (result) {\r\n var id = result[0], included = result[1];\r\n return included && Identifier_Identifier.Time.is(id);\r\n };\r\n var getSpan = function (result) {\r\n var id = result[0];\r\n var time = Identifier_Identifier.Time.start(id);\r\n var span = _this.getTimeSpan(time, time.asTime());\r\n if (span.matchesDay(matchAgainst)) {\r\n return span;\r\n }\r\n };\r\n return this.include.query(day.dayIdentifier).map(getSpan, isIncludedTime);\r\n };\r\n /**\r\n * Converts the schedule instance back into input.\r\n *\r\n * @param returnDays When `true` the start, end, and array of exclusions will\r\n * have [[Day]] instances, otherwise the UTC timestamp and dayIdentifiers\r\n * will be used when `false`.\r\n * @param returnTimes When `true` the times returned in the input will be\r\n * instances of [[Time]] otherwise the `timeFormat` is used to convert the\r\n * times to strings.\r\n * @param timeFormat The time format to use when returning the times as strings.\r\n * @param alwaysDuration If the duration values (`duration` and\r\n * `durationUnit`) should always be returned in the input.\r\n * @returns The input that describes this schedule.\r\n * @see [[Time.format]]\r\n */\r\n Schedule.prototype.toInput = function (returnDays, returnTimes, timeFormat, alwaysDuration) {\r\n if (returnDays === void 0) { returnDays = false; }\r\n if (returnTimes === void 0) { returnTimes = false; }\r\n if (timeFormat === void 0) { timeFormat = ''; }\r\n if (alwaysDuration === void 0) { alwaysDuration = false; }\r\n var defaultUnit = Constants.DURATION_DEFAULT_UNIT(this.isFullDay());\r\n var exclusions = this.exclude.identifiers(function (v) { return v; }).list();\r\n var inclusions = this.include.identifiers(function (v) { return v; }).list();\r\n var cancels = this.cancel.identifiers(function (v) { return v; }).list();\r\n var hasMeta = !this.meta.isEmpty();\r\n var out = {};\r\n var times = [];\r\n for (var _i = 0, _a = this.times; _i < _a.length; _i++) {\r\n var time = _a[_i];\r\n times.push(returnTimes ? time : (timeFormat ? time.format(timeFormat) : time.toString()));\r\n }\r\n if (this.start)\r\n out.start = returnDays ? this.start : this.start.time;\r\n if (this.end)\r\n out.end = returnDays ? this.end : this.end.time;\r\n if (times.length)\r\n out.times = times;\r\n if (alwaysDuration || this.duration !== Constants.DURATION_DEFAULT)\r\n out.duration = this.duration;\r\n if (alwaysDuration || this.durationUnit !== defaultUnit)\r\n out.durationUnit = this.durationUnit;\r\n if (exclusions.length)\r\n out.exclude = exclusions;\r\n if (inclusions.length)\r\n out.include = inclusions;\r\n if (cancels.length)\r\n out.cancel = cancels;\r\n if (hasMeta)\r\n out.meta = Functions.extend({}, this.meta.map);\r\n if (this.dayOfWeek.input)\r\n out.dayOfWeek = this.dayOfWeek.input;\r\n if (this.dayOfMonth.input)\r\n out.dayOfMonth = this.dayOfMonth.input;\r\n if (this.lastDayOfMonth.input)\r\n out.lastDayOfMonth = this.lastDayOfMonth.input;\r\n if (this.dayOfYear.input)\r\n out.dayOfYear = this.dayOfYear.input;\r\n if (this.year.input)\r\n out.year = this.year.input;\r\n if (this.month.input)\r\n out.month = this.month.input;\r\n if (this.week.input)\r\n out.week = this.week.input;\r\n if (this.weekOfYear.input)\r\n out.weekOfYear = this.weekOfYear.input;\r\n if (this.weekspanOfYear.input)\r\n out.weekspanOfYear = this.weekspanOfYear.input;\r\n if (this.fullWeekOfYear.input)\r\n out.fullWeekOfYear = this.fullWeekOfYear.input;\r\n if (this.lastWeekspanOfYear.input)\r\n out.lastWeekspanOfYear = this.lastWeekspanOfYear.input;\r\n if (this.lastFullWeekOfYear.input)\r\n out.lastFullWeekOfYear = this.lastFullWeekOfYear.input;\r\n if (this.weekOfMonth.input)\r\n out.weekOfMonth = this.weekOfMonth.input;\r\n if (this.weekspanOfMonth.input)\r\n out.weekspanOfMonth = this.weekspanOfMonth.input;\r\n if (this.fullWeekOfMonth.input)\r\n out.fullWeekOfMonth = this.fullWeekOfMonth.input;\r\n if (this.lastWeekspanOfMonth.input)\r\n out.lastWeekspanOfMonth = this.lastWeekspanOfMonth.input;\r\n if (this.lastFullWeekOfMonth.input)\r\n out.lastFullWeekOfMonth = this.lastFullWeekOfMonth.input;\r\n return out;\r\n };\r\n /**\r\n * Describes the schedule in a human friendly string taking into account all\r\n * possible values specified in this schedule.\r\n *\r\n * @param thing A brief description of the things (events) on the schedule.\r\n * @param includeRange When `true` the [[Schedule.start]] and [[Schedule.end]]\r\n * are possibly included in the description if they have values.\r\n * @param includeTimes When `true` the [[Schedule.times]] are possibly included\r\n * in the description.\r\n * @param includeDuration When `true` the [[Schedule.duration]] and\r\n * [[Schedule.durationUnit]] are added to the description if\r\n * [[Schedule.duration]] is not equal to `1`.\r\n * @param includeExcludes When `true` the [[Schedule.exclude]] are added\r\n * to the description if there are any.\r\n * @param includeIncludes When `true` the [[Schedule.include]] are added\r\n * to the description if there are any.\r\n * @param includeCancels When `true` the [[Schedule.cancel]] are added\r\n * to the description if there are any.\r\n * @returns The descroption of the schedule.\r\n */\r\n Schedule.prototype.describe = function (thing, includeRange, includeTimes, includeDuration, includeExcludes, includeIncludes, includeCancels) {\r\n if (thing === void 0) { thing = 'event'; }\r\n if (includeRange === void 0) { includeRange = true; }\r\n if (includeTimes === void 0) { includeTimes = true; }\r\n if (includeDuration === void 0) { includeDuration = false; }\r\n if (includeExcludes === void 0) { includeExcludes = false; }\r\n if (includeIncludes === void 0) { includeIncludes = false; }\r\n if (includeCancels === void 0) { includeCancels = false; }\r\n var out = '';\r\n if (includeRange) {\r\n if (this.start) {\r\n out += 'Starting on ' + this.start.format('dddd Do, YYYY');\r\n if (this.end) {\r\n out += ' and ending on ' + this.end.format('dddd Do, YYYY');\r\n }\r\n }\r\n else if (this.end) {\r\n out += 'Up until ' + this.end.format('dddd Do, YYYY');\r\n }\r\n }\r\n if (out) {\r\n out += ' the ' + thing + ' will occur';\r\n }\r\n else {\r\n out += 'The ' + thing + ' will occur';\r\n }\r\n out += this.describeRule(this.dayOfWeek.input, 'day of the week', function (x) { return __WEBPACK_IMPORTED_MODULE_10_moment__[\"weekdays\"]()[x]; }, 1, false);\r\n out += this.describeRule(this.lastDayOfMonth.input, 'last day of the month', function (x) { return Suffix.CACHE[x]; });\r\n out += this.describeRule(this.dayOfMonth.input, 'day of the month', function (x) { return Suffix.CACHE[x]; });\r\n out += this.describeRule(this.dayOfYear.input, 'day of the year', function (x) { return Suffix.CACHE[x]; }, 1);\r\n out += this.describeRule(this.year.input, 'year', function (x) { return x; }, 0, false, ' in ');\r\n out += this.describeRule(this.month.input, 'month', function (x) { return __WEBPACK_IMPORTED_MODULE_10_moment__[\"months\"]()[x]; }, 0, false, ' in ');\r\n out += this.describeRule(this.weekOfYear.input, 'week of the year', function (x) { return Suffix.CACHE[x]; });\r\n out += this.describeRule(this.weekspanOfYear.input, 'weekspan of the year', function (x) { return Suffix.CACHE[x + 1]; }, 1);\r\n out += this.describeRule(this.fullWeekOfYear.input, 'full week of the year', function (x) { return Suffix.CACHE[x]; });\r\n out += this.describeRule(this.lastWeekspanOfYear.input, 'last weekspan of the year', function (x) { return Suffix.CACHE[x + 1]; }, 1);\r\n out += this.describeRule(this.lastFullWeekOfYear.input, 'last full week of the year', function (x) { return Suffix.CACHE[x]; });\r\n out += this.describeRule(this.weekOfMonth.input, 'week of the month', function (x) { return Suffix.CACHE[x]; });\r\n out += this.describeRule(this.fullWeekOfMonth.input, 'full week of the month', function (x) { return Suffix.CACHE[x]; });\r\n out += this.describeRule(this.weekspanOfMonth.input, 'weekspan of the month', function (x) { return Suffix.CACHE[x + 1]; }, 1);\r\n out += this.describeRule(this.lastFullWeekOfMonth.input, 'last full week of the month', function (x) { return Suffix.CACHE[x]; });\r\n out += this.describeRule(this.lastWeekspanOfMonth.input, 'last weekspan of the month', function (x) { return Suffix.CACHE[x + 1]; }, 1);\r\n if (includeTimes && this.times.length) {\r\n out += ' at ';\r\n out += this.describeArray(this.times, function (x) { return x.format('hh:mm a'); });\r\n }\r\n if (includeDuration && this.duration !== Constants.DURATION_DEFAULT) {\r\n out += ' lasting ' + this.duration + ' ';\r\n if (this.durationUnit) {\r\n out += this.durationUnit + ' ';\r\n }\r\n }\r\n if (includeExcludes) {\r\n var excludes = this.exclude.spans().list();\r\n if (excludes.length) {\r\n out += ' excluding ';\r\n out += this.describeArray(excludes, function (x) { return x.span.summary(Units.DAY); });\r\n }\r\n }\r\n if (includeIncludes) {\r\n var includes = this.include.spans().list();\r\n if (includes.length) {\r\n out += ' including ';\r\n out += this.describeArray(includes, function (x) { return x.span.summary(Units.DAY); });\r\n }\r\n }\r\n if (includeCancels) {\r\n var cancels = this.cancel.spans().list();\r\n if (cancels.length) {\r\n out += ' with cancellations on ';\r\n out += this.describeArray(cancels, function (x) { return x.span.summary(Units.DAY); });\r\n }\r\n }\r\n return out;\r\n };\r\n /**\r\n * Describes the given frequency.\r\n *\r\n * @param value The frequency to describe.\r\n * @param unit The unit of the frequency.\r\n * @param map How the values in the frequency should be described.\r\n * @param everyOffset A value to add to a [[FrequencyValueEvery]] offset to\r\n * account for zero-based values that should be shifted for human\r\n * friendliness.\r\n * @param the If the word 'the' should be used to describe the unit.\r\n * @param on The word which preceeds values of the given unit.\r\n * @param required If the description should always return a non-empty string\r\n * even if the frequency was not specified in the original input.\r\n * @returns A string description of the frequency.\r\n */\r\n Schedule.prototype.describeRule = function (value, unit, map, everyOffset, the, on, required) {\r\n if (everyOffset === void 0) { everyOffset = 0; }\r\n if (the === void 0) { the = true; }\r\n if (on === void 0) { on = ' on '; }\r\n if (required === void 0) { required = false; }\r\n var out = '';\r\n var suffix = the ? ' ' + unit : '';\r\n if (Functions.isFrequencyValueEvery(value)) {\r\n var valueEvery = value;\r\n out += ' every ' + Suffix.CACHE[valueEvery.every] + ' ' + unit;\r\n if (valueEvery.offset) {\r\n out += ' starting at ' + map(valueEvery.offset + everyOffset) + suffix;\r\n }\r\n }\r\n else if (Functions.isFrequencyValueOneOf(value)) {\r\n var valueOne = value;\r\n if (valueOne.length) {\r\n out += on + (the ? 'the ' : '');\r\n out += this.describeArray(valueOne, map);\r\n out += suffix;\r\n }\r\n }\r\n else if (required) {\r\n out += on + 'any ' + unit;\r\n }\r\n return out;\r\n };\r\n /**\r\n * Describes the array by adding commas where appropriate and 'and' before the\r\n * last value of the array (if its more than `1`).\r\n *\r\n * @param array The array of items to describe.\r\n * @param map The function which converts an item to a string.\r\n * @returns The final description of the array items.\r\n */\r\n Schedule.prototype.describeArray = function (array, map) {\r\n var out = '';\r\n var last = array.length - 1;\r\n out += map(array[0]);\r\n for (var i = 1; i < last; i++) {\r\n out += ', ' + map(array[i]);\r\n }\r\n if (last > 0) {\r\n out += ' and ' + map(array[last]);\r\n }\r\n return out;\r\n };\r\n return Schedule;\r\n}());\r\n\r\n\n// CONCATENATED MODULE: ./src/Event.ts\n\r\n/**\r\n * A pairing of a user specified event object and the schedule which defines\r\n * when it occurs on a calendar.\r\n *\r\n * @typeparam T The type of data stored in the [[Event]] class.\r\n * @typeparam M The type of metadata stored in the schedule.\r\n */\r\nvar Event = (function () {\r\n /**\r\n * Creates a new event.\r\n *\r\n * @param schedule The schedule which defines when the event occurs.\r\n * @param data User specified object which describes this event.\r\n * @param id User specified ID which identifies this event.\r\n */\r\n function Event(schedule, data, id, visible) {\r\n if (visible === void 0) { visible = true; }\r\n this.schedule = schedule;\r\n this.data = data;\r\n this.id = id;\r\n this.visible = visible;\r\n }\r\n return Event;\r\n}());\r\n\r\n\n// CONCATENATED MODULE: ./src/Time.ts\n\r\n\r\n\r\n\r\n/**\r\n * A class which holds a specific time during in any day.\r\n */\r\nvar Time_Time = (function () {\r\n /**\r\n * Creates a new Time instance given an hour and optionally a minute, second,\r\n * and millisecond. If they have not been specified they default to 0.\r\n *\r\n * @param hour The hour.\r\n * @param minute The minute.\r\n * @param second The second.\r\n * @param millisecond The millisecond.\r\n */\r\n function Time(hour, minute, second, millisecond) {\r\n if (minute === void 0) { minute = Constants.MINUTE_MIN; }\r\n if (second === void 0) { second = Constants.SECOND_MIN; }\r\n if (millisecond === void 0) { millisecond = Constants.MILLIS_MIN; }\r\n this.hour = hour;\r\n this.minute = minute;\r\n this.second = second;\r\n this.millisecond = millisecond;\r\n }\r\n /**\r\n * Formats this time into a string. The following list describes the available\r\n * formatting patterns:\r\n *\r\n * ### Hour\r\n * - H: 0-23\r\n * - HH: 00-23\r\n * - h: 12,1-12,1-11\r\n * - hh: 12,01-12,01-11\r\n * - k: 1-24\r\n * - kk: 01-24\r\n * - a: am,pm\r\n * - A: AM,PM\r\n * ### Minute\r\n * - m: 0-59\r\n * - mm: 00-59\r\n * ### Second\r\n * - s: 0-59\r\n * - ss: 00-59\r\n * ### Millisecond\r\n * - S: 0-9\r\n * - SS: 00-99\r\n * - SSS: 000-999\r\n *\r\n * @param format The format to output.\r\n * @returns The formatted time.\r\n */\r\n Time.prototype.format = function (format) {\r\n var formatterEntries = Time.FORMATTERS;\r\n var out = '';\r\n for (var i = 0; i < format.length; i++) {\r\n var handled = false;\r\n for (var k = 0; k < formatterEntries.length && !handled; k++) {\r\n var entry = formatterEntries[k];\r\n var part = format.substring(i, i + entry.size);\r\n if (part.length === entry.size) {\r\n var formatter = entry.formats[part];\r\n if (formatter) {\r\n out += formatter(this);\r\n i += entry.size - 1;\r\n handled = true;\r\n }\r\n }\r\n }\r\n if (!handled) {\r\n out += format.charAt(i);\r\n }\r\n }\r\n return out;\r\n };\r\n /**\r\n * Determines whether this time is an exact match for the given time.\r\n *\r\n * @param time The given time to test against.\r\n * @returns `true` if the time matches this time, otherwise `false`.\r\n */\r\n Time.prototype.matches = function (time) {\r\n return this.hour === time.hour &&\r\n this.minute === time.minute &&\r\n this.second === time.second &&\r\n this.millisecond === time.millisecond;\r\n };\r\n /**\r\n * Determines whether this time has the same hour as the given time.\r\n *\r\n * @param time The given time to test against.\r\n * @returns `true` if the given hour matches this hour, otherwise `false`.\r\n */\r\n Time.prototype.matchesHour = function (time) {\r\n return this.hour === time.hour;\r\n };\r\n /**\r\n * Determines whether this time has the same hour and minute as the given time.\r\n *\r\n * @param time The given time to test against.\r\n * @returns `true` if the given hour and minute matches, otherwise `false`.\r\n */\r\n Time.prototype.matchesMinute = function (time) {\r\n return this.hour === time.hour &&\r\n this.minute === time.minute;\r\n };\r\n /**\r\n * Determines whether this time has the same hour, minute, and second as the\r\n * given time.\r\n *\r\n * @param time The given time to test against.\r\n * @returns `true` if the given hour, minute, and second matches, otherwise\r\n * `false`.\r\n */\r\n Time.prototype.matchesSecond = function (time) {\r\n return this.hour === time.hour &&\r\n this.minute === time.minute &&\r\n this.second === time.second;\r\n };\r\n /**\r\n * @returns The number of milliseconds from the start of the day until this\r\n * time.\r\n */\r\n Time.prototype.toMilliseconds = function () {\r\n return this.hour * Constants.MILLIS_IN_HOUR +\r\n this.minute * Constants.MILLIS_IN_MINUTE +\r\n this.second * Constants.MILLIS_IN_SECOND +\r\n this.millisecond;\r\n };\r\n /**\r\n * @returns The time formatted using the smallest format that completely\r\n * represents this time.\r\n */\r\n Time.prototype.toString = function () {\r\n if (this.millisecond)\r\n return this.format('HH:mm:ss.SSS');\r\n if (this.second)\r\n return this.format('HH:mm:ss');\r\n if (this.minute)\r\n return this.format('HH:mm');\r\n return this.format('HH');\r\n };\r\n /**\r\n * @returns A unique identifier for this time. The number returned is in the\r\n * following format: SSSssmmHH\r\n */\r\n Time.prototype.toIdentifier = function () {\r\n return this.hour +\r\n this.minute * 100 +\r\n this.second * 10000 +\r\n this.millisecond * 10000000;\r\n };\r\n /**\r\n * @returns An object with hour, minute, second, a millisecond properties if\r\n * they are non-zero on this time.\r\n */\r\n Time.prototype.toObject = function () {\r\n var out = {\r\n hour: this.hour\r\n };\r\n if (this.minute)\r\n out.minute = this.minute;\r\n if (this.second)\r\n out.second = this.second;\r\n if (this.millisecond)\r\n out.millisecond = this.millisecond;\r\n return out;\r\n };\r\n /**\r\n * Parses a value and tries to convert it to a Time instance.\r\n *\r\n * @param input The input to parse.\r\n * @returns The instance parsed or `null` if it was invalid.\r\n * @see [[Parse.time]]\r\n */\r\n Time.parse = function (input) {\r\n return Parse_Parse.time(input);\r\n };\r\n /**\r\n * Parses a string and converts it to a Time instance. If the string is not\r\n * in a valid format `null` is returned.\r\n *\r\n * @param time The string to parse.\r\n * @returns The instance parsed or `null` if it was invalid.\r\n * @see [[Time.REGEX]]\r\n */\r\n Time.fromString = function (time) {\r\n var matches = this.REGEX.exec(time);\r\n if (!matches) {\r\n return null;\r\n }\r\n var h = parseInt(matches[1]) || 0;\r\n var m = parseInt(matches[2]) || 0;\r\n var s = parseInt(matches[3]) || 0;\r\n var l = parseInt(matches[4]) || 0;\r\n return this.build(h, m, s, l);\r\n };\r\n /**\r\n * Parses a number and converts it to a Time instance. The number is assumed\r\n * to be in the [[Time.toIdentifier]] format.\r\n *\r\n * @param time The number to parse.\r\n * @returns The instance parsed.\r\n */\r\n Time.fromIdentifier = function (time) {\r\n var h = time % 100;\r\n var m = Math.floor(time / 100) % 100;\r\n var s = Math.floor(time / 10000) % 100;\r\n var l = Math.floor(time / 10000000) % 1000;\r\n return this.build(h, m, s, l);\r\n };\r\n /**\r\n * Returns a new instance given an hour and optionally a minute, second,\r\n * and millisecond. If they have not been specified they default to 0.\r\n *\r\n * @param hour The hour.\r\n * @param minute The minute.\r\n * @param second The second.\r\n * @param millisecond The millisecond.\r\n * @returns A new instance.\r\n */\r\n Time.build = function (hour, minute, second, millisecond) {\r\n if (minute === void 0) { minute = Constants.MINUTE_MIN; }\r\n if (second === void 0) { second = Constants.SECOND_MIN; }\r\n if (millisecond === void 0) { millisecond = Constants.MILLIS_MIN; }\r\n return new Time(hour, minute, second, millisecond);\r\n };\r\n /**\r\n * The regular expression used to parse a time from a string.\r\n *\r\n * - ## = hour\r\n * - ##:## = hour & minute\r\n * - ##:##:## = hour, minute, & second\r\n * - ##:##:##.### = hour, minute, second, and milliseconds\r\n */\r\n Time.REGEX = /^(\\d\\d?):?(\\d\\d)?:?(\\d\\d)?\\.?(\\d\\d\\d)?$/;\r\n /**\r\n * A set of formatting functions keyed by their format string.\r\n */\r\n Time.FORMATTERS = [\r\n {\r\n size: 3,\r\n formats: {\r\n SSS: function (t) { return Functions.padNumber(t.millisecond, 3); }\r\n }\r\n },\r\n {\r\n size: 2,\r\n formats: {\r\n HH: function (t) { return Functions.padNumber(t.hour, 2); },\r\n hh: function (t) { return Functions.padNumber((t.hour % 12) || 12, 2); },\r\n kk: function (t) { return Functions.padNumber(t.hour + 1, 2); },\r\n mm: function (t) { return Functions.padNumber(t.minute, 2); },\r\n ss: function (t) { return Functions.padNumber(t.second, 2); },\r\n SS: function (t) { return Functions.padNumber(t.millisecond, 3, 2); }\r\n }\r\n },\r\n {\r\n size: 1,\r\n formats: {\r\n A: function (t) { return t.hour < 12 ? 'AM' : 'PM'; },\r\n a: function (t) { return t.hour < 12 ? 'am' : 'pm'; },\r\n H: function (t) { return t.hour + ''; },\r\n h: function (t) { return ((t.hour % 12) || 12) + ''; },\r\n k: function (t) { return (t.hour + 1) + ''; },\r\n m: function (t) { return t.minute + ''; },\r\n s: function (t) { return t.second + ''; },\r\n S: function (t) { return Functions.padNumber(t.millisecond, 3, 1); }\r\n }\r\n }\r\n ];\r\n return Time;\r\n}());\r\n\r\n\n// CONCATENATED MODULE: ./src/Parse.ts\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * The class which takes user input and parses it to specific structures.\r\n */\r\nvar Parse_Parse = (function () {\r\n function Parse() {\r\n }\r\n /**\r\n * Parses a value and converts it to a [[FrequencyCheck]].\r\n *\r\n * @param input The input to parse into a function.\r\n * @param property The [[Day]] property the frequency is for.\r\n * @returns A function which determines whether a value matches a frequency.\r\n * @see [[Schedule]]\r\n */\r\n Parse.frequency = function (input, property) {\r\n var check = function (value) {\r\n return true;\r\n };\r\n check.given = false;\r\n if (Functions.isFrequencyValueEvery(input)) {\r\n var every_1 = input.every;\r\n var offset_1 = (input.offset || 0) % every_1;\r\n check = function (value) {\r\n return value % every_1 === offset_1;\r\n };\r\n check.given = true;\r\n }\r\n if (Functions.isFrequencyValueOneOf(input)) {\r\n var map_1 = {};\r\n for (var i = 0; i < input.length; i++) {\r\n map_1[input[i]] = true;\r\n }\r\n check = function (value) {\r\n return !!map_1[value];\r\n };\r\n check.given = true;\r\n }\r\n check.input = Functions.coalesce(input, null);\r\n check.property = property;\r\n return check;\r\n };\r\n /**\r\n * Parses [[DayInput]] into a [[Day]] instance.\r\n *\r\n * ```typescript\r\n * Parse.day( 65342300 ); // UTC timestamp\r\n * Parse.day( '01/02/2014' ); // strings in many formats\r\n * Parse.day( day ); // return a passed instance\r\n * Parse.day( [2018, 0, 2] ); // array: 01/02/2018\r\n * Parse.day( {year: 2018, month: 2} ); // object: 03/01/2018\r\n * Parse.day( true ); // today\r\n * ```\r\n *\r\n * @param input The input to parse.\r\n * @returns The Day parsed or `null` if the value is not valid.\r\n */\r\n Parse.day = function (input) {\r\n if (Functions.isNumber(input)) {\r\n return Day_Day.unix(input);\r\n }\r\n else if (Functions.isString(input)) {\r\n return Day_Day.fromString(input);\r\n }\r\n else if (input instanceof Day_Day) {\r\n return input;\r\n }\r\n else if (Functions.isArray(input)) {\r\n return Day_Day.fromArray(input);\r\n }\r\n else if (Functions.isObject(input)) {\r\n return Day_Day.fromObject(input);\r\n }\r\n else if (input === true) {\r\n return Day_Day.today();\r\n }\r\n return null;\r\n };\r\n /**\r\n * Parses a value and tries to convert it to a Time instance.\r\n *\r\n * ```typescript\r\n * Parse.time( time ); // return a passed instance\r\n * Parse.time( 9 ); // 09:00:00.000\r\n * Parse.time( 3009 ); // 09:30:00.000\r\n * Parse.time( 593009 ); // 09:30:59.000\r\n * Parsetime( '09' ); // 09:00:00.000\r\n * Parse.time( '9:30' ); // 09:30:00.000\r\n * Parse.time( '9:30:59' ); // 09:30:59.000\r\n * Parse.time( {hour: 2} ); // 02:00:00.000\r\n * ```\r\n *\r\n * @param input The input to parse.\r\n * @returns The instance parsed or `null` if it was invalid.\r\n * @see [[Time.fromIdentifier]]\r\n * @see [[Time.fromString]]\r\n */\r\n Parse.time = function (input) {\r\n if (input instanceof Time_Time) {\r\n return input;\r\n }\r\n if (Functions.isNumber(input)) {\r\n return Time_Time.fromIdentifier(input);\r\n }\r\n if (Functions.isString(input)) {\r\n return Time_Time.fromString(input);\r\n }\r\n if (Functions.isObject(input) && Functions.isNumber(input.hour)) {\r\n return new Time_Time(input.hour, input.minute, input.second, input.millisecond);\r\n }\r\n return null;\r\n };\r\n /**\r\n * Parses a value and tries to convert it to an array of Time instances.\r\n * If any of the given values are not a valid time value then the resulting\r\n * array will not contain a time instance.\r\n *\r\n * @param input The input to parse.\r\n * @returns A non-null array of time instances.\r\n * @see [[Parse.time]]\r\n */\r\n Parse.times = function (input) {\r\n var times = [];\r\n if (Functions.isArray(input)) {\r\n for (var _i = 0, input_1 = input; _i < input_1.length; _i++) {\r\n var timeInput = input_1[_i];\r\n var time = this.time(timeInput);\r\n if (time) {\r\n times.push(time);\r\n }\r\n }\r\n // Sort times from earliest to latest.\r\n times.sort(function (a, b) {\r\n return a.toMilliseconds() - b.toMilliseconds();\r\n });\r\n }\r\n return times;\r\n };\r\n /**\r\n * Parses an array of excluded days into a map of excluded days where the\r\n * array value and returned object key are [[Day.dayIdentifier]].\r\n *\r\n * ```typescript\r\n * Parse.modifier( [ 20180101, 20140506 ] ); // {'20180101': true, '20140506': true}\r\n * Parse.modifier( [ 20180101, Day.build(2014,4,6) ] ); // {'20180101': true, '20140506': true}\r\n * ```\r\n *\r\n * @param input The input to parse.\r\n * @param value The default value if the input given is an array of identifiers.\r\n * @param parseMeta A function to use to parse a modifier.\r\n * @param out The modifier to set the identifiers and values of and return.\r\n * @returns The object with identifier keys and `true` values.\r\n * @see [[Day.dayIdentifier]]\r\n */\r\n Parse.modifier = function (input, value, parseMeta, out) {\r\n if (parseMeta === void 0) { parseMeta = (function (x) { return x; }); }\r\n if (out === void 0) { out = new ScheduleModifier_ScheduleModifier(); }\r\n var map = {};\r\n if (Functions.isArray(input)) {\r\n for (var _i = 0, input_2 = input; _i < input_2.length; _i++) {\r\n var identifier = input_2[_i];\r\n if (identifier instanceof Day_Day) {\r\n map[identifier.dayIdentifier] = value;\r\n }\r\n else if (Functions.isNumber(identifier)) {\r\n map[identifier] = value;\r\n }\r\n else if (Functions.isString(identifier)) {\r\n map[identifier] = value;\r\n }\r\n }\r\n }\r\n if (Functions.isObject(input)) {\r\n for (var identifier in input) {\r\n map[identifier] = parseMeta(input[identifier]);\r\n }\r\n }\r\n out.map = map;\r\n return out;\r\n };\r\n /**\r\n * Parses an object which specifies a schedule where events may or may not\r\n * repeat and they may be all day events or at specific times.\r\n *\r\n * @param input The input to parse into a schedule.\r\n * @param parseMeta A function to use when parsing meta input into the desired type.\r\n * @param out The schedule to set the values of and return.\r\n * @returns An instance of the parsed [[Schedule]].\r\n */\r\n Parse.schedule = function (input, parseMeta, out) {\r\n if (parseMeta === void 0) { parseMeta = (function (x) { return x; }); }\r\n if (out === void 0) { out = new Schedule_Schedule(); }\r\n if (input instanceof Schedule_Schedule) {\r\n return input;\r\n }\r\n var on = this.day(input.on);\r\n var times = this.times(input.times);\r\n var fullDay = times.length === 0;\r\n if (on) {\r\n input.start = on.start();\r\n input.end = on.end();\r\n input.year = [on.year];\r\n input.month = [on.month];\r\n input.dayOfMonth = [on.dayOfMonth];\r\n }\r\n out.times = times;\r\n out.duration = Functions.coalesce(input.duration, Constants.DURATION_DEFAULT);\r\n out.durationUnit = Functions.coalesce(input.durationUnit, Constants.DURATION_DEFAULT_UNIT(fullDay));\r\n out.start = this.day(input.start);\r\n out.end = this.day(input.end);\r\n out.exclude = this.modifier(input.exclude, true, undefined, out.exclude);\r\n out.include = this.modifier(input.include, true, undefined, out.include);\r\n out.cancel = this.modifier(input.cancel, true, undefined, out.cancel);\r\n out.meta = this.modifier(input.meta, null, parseMeta, out.meta);\r\n out.year = this.frequency(input.year, 'year');\r\n out.month = this.frequency(input.month, 'month');\r\n out.week = this.frequency(input.week, 'week');\r\n out.weekOfYear = this.frequency(input.weekOfYear, 'weekOfYear');\r\n out.weekspanOfYear = this.frequency(input.weekspanOfYear, 'weekspanOfYear');\r\n out.fullWeekOfYear = this.frequency(input.fullWeekOfYear, 'fullWeekOfYear');\r\n out.lastWeekspanOfYear = this.frequency(input.lastWeekspanOfYear, 'lastWeekspanOfYear');\r\n out.lastFullWeekOfYear = this.frequency(input.lastFullWeekOfYear, 'lastFullWeekOfYear');\r\n out.weekOfMonth = this.frequency(input.weekOfMonth, 'weekOfMonth');\r\n out.weekspanOfMonth = this.frequency(input.weekspanOfMonth, 'weekspanOfMonth');\r\n out.fullWeekOfMonth = this.frequency(input.fullWeekOfMonth, 'fullWeekOfMonth');\r\n out.lastWeekspanOfMonth = this.frequency(input.lastWeekspanOfMonth, 'lastWeekspanOfMonth');\r\n out.lastFullWeekOfMonth = this.frequency(input.lastFullWeekOfMonth, 'lastFullWeekOfMonth');\r\n out.dayOfWeek = this.frequency(input.dayOfWeek, 'dayOfWeek');\r\n out.dayOfMonth = this.frequency(input.dayOfMonth, 'dayOfMonth');\r\n out.lastDayOfMonth = this.frequency(input.lastDayOfMonth, 'lastDayOfMonth');\r\n out.dayOfYear = this.frequency(input.dayOfYear, 'dayOfYear');\r\n out.updateDurationInDays();\r\n out.updateChecks();\r\n return out;\r\n };\r\n /**\r\n * Parses an array of [[FrequencyCheck]] functions and returns an array of\r\n * functions for only the checks that were specified by the user.\r\n *\r\n * @param checks The array of check functions to filter through.\r\n * @returns The array of user specified checks.\r\n */\r\n Parse.givenFrequency = function (checks) {\r\n var out = [];\r\n for (var _i = 0, checks_1 = checks; _i < checks_1.length; _i++) {\r\n var check = checks_1[_i];\r\n if (check.given) {\r\n out.push(check);\r\n }\r\n }\r\n return out;\r\n };\r\n /**\r\n * Parses [[EventInput]] and returns an [[Event]].\r\n *\r\n * @param input The input to parse.\r\n * @param parseData A function to use when parsing data input into the desired type.\r\n * @param parseMeta A function to use when parsing meta input into the desired type.\r\n * @returns The parsed value.\r\n */\r\n Parse.event = function (input, parseData, parseMeta) {\r\n if (parseData === void 0) { parseData = (function (x) { return x; }); }\r\n if (parseMeta === void 0) { parseMeta = (function (x) { return x; }); }\r\n if (input instanceof Event) {\r\n return input;\r\n }\r\n if (!input.schedule) {\r\n return null;\r\n }\r\n var schedule = this.schedule(input.schedule, parseMeta);\r\n return new Event(schedule, parseData(input.data), input.id, input.visible);\r\n };\r\n /**\r\n * Parses a schedule from a CRON pattern. TODO\r\n */\r\n Parse.cron = function (pattern, out) {\r\n if (out === void 0) { out = new Schedule_Schedule(); }\r\n return out;\r\n };\r\n return Parse;\r\n}());\r\n\r\n\n// CONCATENATED MODULE: ./src/Day.ts\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_moment__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_moment___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_moment__);\n\r\n\r\n\r\n\r\n\r\n\r\n// @ts-ignore\r\n\r\n/**\r\n * A class which represents a point in time as\r\n */\r\nvar Day_Day = (function () {\r\n /**\r\n *\r\n */\r\n function Day(date) {\r\n this.date = date;\r\n this.time = date.valueOf();\r\n this.millis = date.millisecond();\r\n this.seconds = date.second();\r\n this.minute = date.minute();\r\n this.hour = date.hour();\r\n this.month = date.month();\r\n this.year = date.year();\r\n this.quarter = date.quarter();\r\n this.dayOfWeek = date.day();\r\n this.dayOfMonth = date.date();\r\n this.dayOfYear = date.dayOfYear();\r\n this.week = date.week();\r\n this.lastDayOfMonth = Day.getLastDayOfMonth(date);\r\n this.weekOfYear = Day.getWeekOfYear(date);\r\n this.weekspanOfYear = Day.getWeekspanOfYear(date);\r\n this.fullWeekOfYear = Day.getFullWeekOfYear(date);\r\n this.lastWeekspanOfYear = Day.getLastWeekspanOfYear(date);\r\n this.lastFullWeekOfYear = Day.getLastFullWeekOfYear(date);\r\n this.weekOfMonth = Day.getWeekOfMonth(date);\r\n this.weekspanOfMonth = Day.getWeekspanOfMonth(date);\r\n this.fullWeekOfMonth = Day.getFullWeekOfMonth(date);\r\n this.lastWeekspanOfMonth = Day.getLastWeekspanOfMonth(date);\r\n this.lastFullWeekOfMonth = Day.getLastFullWeekOfMonth(date);\r\n this.timeIdentifier = Identifier_Identifier.Time.get(this);\r\n this.dayIdentifier = Identifier_Identifier.Day.get(this);\r\n this.weekIdentifier = Identifier_Identifier.Week.get(this);\r\n this.monthIdentifier = Identifier_Identifier.Month.get(this);\r\n this.quarterIdentifier = Identifier_Identifier.Quarter.get(this);\r\n }\r\n // Same\r\n /**\r\n *\r\n */\r\n Day.prototype.sameDay = function (day) {\r\n return this.dayIdentifier === day.dayIdentifier;\r\n };\r\n /**\r\n *\r\n */\r\n Day.prototype.sameMonth = function (day) {\r\n return this.monthIdentifier === day.monthIdentifier;\r\n };\r\n /**\r\n *\r\n */\r\n Day.prototype.sameWeek = function (day) {\r\n return this.weekIdentifier === day.weekIdentifier;\r\n };\r\n /**\r\n *\r\n */\r\n Day.prototype.sameYear = function (day) {\r\n return this.year === day.year;\r\n };\r\n /**\r\n *\r\n */\r\n Day.prototype.sameQuarter = function (day) {\r\n return this.quarterIdentifier === day.quarterIdentifier;\r\n };\r\n /**\r\n *\r\n */\r\n Day.prototype.sameHour = function (day) {\r\n return this.dayIdentifier === day.dayIdentifier && this.hour === day.hour;\r\n };\r\n /**\r\n *\r\n */\r\n Day.prototype.sameMinute = function (day) {\r\n return this.timeIdentifier === day.timeIdentifier;\r\n };\r\n /**\r\n *\r\n */\r\n Day.prototype.sameTime = function (time) {\r\n return this.hour === time.hour && this.minute === time.minute && this.seconds === time.second && this.millis === time.millisecond;\r\n };\r\n // Comparison\r\n /**\r\n *\r\n */\r\n Day.prototype.isBefore = function (day, precision) {\r\n return this.date.isBefore(day.date, precision);\r\n };\r\n /**\r\n *\r\n */\r\n Day.prototype.isSameOrBefore = function (day, precision) {\r\n return this.date.isSameOrBefore(day.date, precision);\r\n };\r\n /**\r\n *\r\n */\r\n Day.prototype.isAfter = function (day, precision) {\r\n return this.date.isAfter(day.date, precision);\r\n };\r\n /**\r\n *\r\n */\r\n Day.prototype.isSameOrAfter = function (day, precision) {\r\n return this.date.isSameOrAfter(day.date, precision);\r\n };\r\n /**\r\n *\r\n */\r\n Day.prototype.max = function (day) {\r\n return this.date.isAfter(day.date) ? this : day;\r\n };\r\n /**\r\n *\r\n */\r\n Day.prototype.min = function (day) {\r\n return this.date.isBefore(day.date) ? this : day;\r\n };\r\n // Between\r\n Day.prototype.millisBetween = function (day, op, absolute) {\r\n if (op === void 0) { op = Op.DOWN; }\r\n if (absolute === void 0) { absolute = true; }\r\n return operate(this.date.diff(day.date, 'milliseconds', true), op, absolute);\r\n };\r\n Day.prototype.secondsBetween = function (day, op, absolute) {\r\n if (op === void 0) { op = Op.DOWN; }\r\n if (absolute === void 0) { absolute = true; }\r\n return operate(this.date.diff(day.date, 'seconds', true), op, absolute);\r\n };\r\n Day.prototype.minutesBetween = function (day, op, absolute) {\r\n if (op === void 0) { op = Op.DOWN; }\r\n if (absolute === void 0) { absolute = true; }\r\n return operate(this.date.diff(day.date, 'minutes', true), op, absolute);\r\n };\r\n Day.prototype.hoursBetween = function (day, op, absolute) {\r\n if (op === void 0) { op = Op.DOWN; }\r\n if (absolute === void 0) { absolute = true; }\r\n return operate(this.date.diff(day.date, 'hours', true), op, absolute);\r\n };\r\n Day.prototype.daysBetween = function (day, op, absolute) {\r\n if (op === void 0) { op = Op.DOWN; }\r\n if (absolute === void 0) { absolute = true; }\r\n return operate(this.date.diff(day.date, 'days', true), op, absolute);\r\n };\r\n Day.prototype.weeksBetween = function (day, op, absolute) {\r\n if (op === void 0) { op = Op.DOWN; }\r\n if (absolute === void 0) { absolute = true; }\r\n return operate(this.date.diff(day.date, 'weeks', true), op, absolute);\r\n };\r\n Day.prototype.monthsBetween = function (day, op, absolute) {\r\n if (op === void 0) { op = Op.DOWN; }\r\n if (absolute === void 0) { absolute = true; }\r\n return operate(this.date.diff(day.date, 'months', true), op, absolute);\r\n };\r\n Day.prototype.yearsBetween = function (day, op, absolute) {\r\n if (op === void 0) { op = Op.DOWN; }\r\n if (absolute === void 0) { absolute = true; }\r\n return operate(this.date.diff(day.date, 'years', true), op, absolute);\r\n };\r\n Day.prototype.isBetween = function (start, end, inclusive) {\r\n if (inclusive === void 0) { inclusive = true; }\r\n return this.date.isBetween(start.date, end.date, null, inclusive ? '[]' : '[)');\r\n };\r\n Day.prototype.mutate = function (mutator) {\r\n var d = this.toMoment();\r\n mutator(d);\r\n return new Day(d);\r\n };\r\n Day.prototype.add = function (amount, unit) {\r\n return this.mutate(function (d) { return d.add(amount, unit); });\r\n };\r\n Day.prototype.relative = function (millis) {\r\n return this.mutate(function (d) { return d.add(millis, 'milliseconds'); });\r\n };\r\n // Days\r\n Day.prototype.relativeDays = function (days) {\r\n return this.mutate(function (d) { return d.add(days, 'days'); });\r\n };\r\n Day.prototype.prev = function (days) {\r\n if (days === void 0) { days = 1; }\r\n return this.relativeDays(-days);\r\n };\r\n Day.prototype.next = function (days) {\r\n if (days === void 0) { days = 1; }\r\n return this.relativeDays(days);\r\n };\r\n Day.prototype.withDayOfMonth = function (day) {\r\n return this.mutate(function (d) { return d.date(day); });\r\n };\r\n Day.prototype.withDayOfWeek = function (dayOfWeek) {\r\n return this.mutate(function (d) { return d.day(dayOfWeek); });\r\n };\r\n Day.prototype.withDayOfYear = function (dayOfYear) {\r\n return this.mutate(function (d) { return d.dayOfYear(dayOfYear); });\r\n };\r\n // Month\r\n Day.prototype.withMonth = function (month) {\r\n return this.mutate(function (d) { return d.month(month); });\r\n };\r\n Day.prototype.relativeMonths = function (months) {\r\n return this.mutate(function (d) { return d.add(months, 'months'); });\r\n };\r\n Day.prototype.prevMonth = function (months) {\r\n if (months === void 0) { months = 1; }\r\n return this.relativeMonths(-months);\r\n };\r\n Day.prototype.nextMonth = function (months) {\r\n if (months === void 0) { months = 1; }\r\n return this.relativeMonths(months);\r\n };\r\n // Week Of Year\r\n Day.prototype.withWeek = function (week, relativeWeek) {\r\n if (relativeWeek === void 0) { relativeWeek = this.week; }\r\n return this.mutate(function (d) { return d.add((week - relativeWeek) * Constants.DAYS_IN_WEEK, 'days'); });\r\n };\r\n Day.prototype.withWeekOfYear = function (week) {\r\n return this.withWeek(week, this.weekOfYear);\r\n };\r\n Day.prototype.withFullWeekOfYear = function (week) {\r\n return this.withWeek(week, this.fullWeekOfYear);\r\n };\r\n Day.prototype.withWeekspanOfYear = function (week) {\r\n return this.withWeek(week, this.weekspanOfYear);\r\n };\r\n Day.prototype.withWeekOfMonth = function (week) {\r\n return this.withWeek(week, this.weekOfMonth);\r\n };\r\n Day.prototype.withWeekspanOfMonth = function (week) {\r\n return this.withWeek(week, this.weekspanOfMonth);\r\n };\r\n Day.prototype.withFullWeekOfMonth = function (week) {\r\n return this.withWeek(week, this.fullWeekOfMonth);\r\n };\r\n Day.prototype.relativeWeeks = function (weeks) {\r\n return this.mutate(function (d) { return d.add(weeks, 'weeks'); });\r\n };\r\n Day.prototype.prevWeek = function (weeks) {\r\n if (weeks === void 0) { weeks = 1; }\r\n return this.relativeWeeks(-weeks);\r\n };\r\n Day.prototype.nextWeek = function (weeks) {\r\n if (weeks === void 0) { weeks = 1; }\r\n return this.relativeWeeks(weeks);\r\n };\r\n // Year\r\n Day.prototype.withYear = function (year) {\r\n return this.mutate(function (d) { return d.year(year); });\r\n };\r\n Day.prototype.relativeYears = function (years) {\r\n return this.mutate(function (d) { return d.add(years, 'year'); });\r\n };\r\n Day.prototype.prevYear = function (years) {\r\n if (years === void 0) { years = 1; }\r\n return this.relativeYears(-years);\r\n };\r\n Day.prototype.nextYear = function (years) {\r\n if (years === void 0) { years = 1; }\r\n return this.relativeYears(years);\r\n };\r\n // Hour\r\n Day.prototype.withHour = function (hour) {\r\n return this.mutate(function (d) { return d.hour(hour); });\r\n };\r\n Day.prototype.relativeHours = function (hours) {\r\n return this.mutate(function (d) { return d.add(hours, 'hours'); });\r\n };\r\n Day.prototype.prevHour = function (hours) {\r\n if (hours === void 0) { hours = 1; }\r\n return this.relativeHours(-hours);\r\n };\r\n Day.prototype.nextHour = function (hours) {\r\n if (hours === void 0) { hours = 1; }\r\n return this.relativeHours(hours);\r\n };\r\n // Time\r\n Day.prototype.withTimes = function (hour, minute, second, millisecond) {\r\n if (hour === void 0) { hour = Constants.HOUR_MIN; }\r\n if (minute === void 0) { minute = Constants.MINUTE_MIN; }\r\n if (second === void 0) { second = Constants.SECOND_MIN; }\r\n if (millisecond === void 0) { millisecond = Constants.MILLIS_MIN; }\r\n return this.mutate(function (d) { return d.set({ hour: hour, minute: minute, second: second, millisecond: millisecond }); });\r\n };\r\n Day.prototype.withTime = function (time) {\r\n return this.withTimes(time.hour, time.minute, time.second, time.millisecond);\r\n };\r\n Day.prototype.asTime = function () {\r\n return new Time_Time(this.hour, this.minute, this.seconds, this.millis);\r\n };\r\n // Start & End\r\n // Time\r\n Day.prototype.start = function () {\r\n return this.mutate(function (d) { return d.startOf('day'); });\r\n };\r\n Day.prototype.isStart = function () {\r\n return this.hour === Constants.HOUR_MIN &&\r\n this.minute === Constants.MINUTE_MIN &&\r\n this.seconds === Constants.SECOND_MIN &&\r\n this.millis === Constants.MILLIS_MIN;\r\n };\r\n Day.prototype.end = function (inclusive) {\r\n if (inclusive === void 0) { inclusive = true; }\r\n return inclusive ?\r\n this.mutate(function (d) { return d.endOf('day'); }) :\r\n this.mutate(function (d) { return d.startOf('day').add(1, 'day'); });\r\n };\r\n Day.prototype.isEnd = function () {\r\n return this.hour === Constants.HOUR_MAX &&\r\n this.minute === Constants.MINUTE_MAX &&\r\n this.seconds === Constants.SECOND_MAX &&\r\n this.millis === Constants.MILLIS_MAX;\r\n };\r\n // Hour\r\n Day.prototype.startOfHour = function () {\r\n return this.mutate(function (d) { return d.startOf('hour'); });\r\n };\r\n Day.prototype.isStartOfHour = function () {\r\n return this.minute === Constants.MINUTE_MIN &&\r\n this.seconds === Constants.SECOND_MIN &&\r\n this.millis === Constants.MILLIS_MIN;\r\n };\r\n Day.prototype.endOfHour = function (inclusive) {\r\n if (inclusive === void 0) { inclusive = true; }\r\n return inclusive ?\r\n this.mutate(function (d) { return d.endOf('hour'); }) :\r\n this.mutate(function (d) { return d.startOf('hour').add(1, 'hour'); });\r\n };\r\n Day.prototype.isEndOfHour = function () {\r\n return this.minute === Constants.MINUTE_MAX &&\r\n this.seconds === Constants.SECOND_MAX &&\r\n this.millis === Constants.MILLIS_MAX;\r\n };\r\n // Week\r\n Day.prototype.startOfWeek = function () {\r\n return this.mutate(function (d) { return d.startOf('week'); });\r\n };\r\n Day.prototype.isStartOfWeek = function () {\r\n return this.dayOfWeek === Constants.WEEKDAY_MIN;\r\n };\r\n Day.prototype.endOfWeek = function (inclusive) {\r\n if (inclusive === void 0) { inclusive = true; }\r\n return inclusive ?\r\n this.mutate(function (d) { return d.endOf('week'); }) :\r\n this.mutate(function (d) { return d.startOf('week').add(1, 'week'); });\r\n };\r\n Day.prototype.isEndOfWeek = function () {\r\n return this.dayOfWeek === Constants.WEEKDAY_MAX;\r\n };\r\n // Month\r\n Day.prototype.startOfMonth = function () {\r\n return this.mutate(function (d) { return d.startOf('month'); });\r\n };\r\n Day.prototype.isStartOfMonth = function () {\r\n return this.dayOfMonth === Constants.DAY_MIN;\r\n };\r\n Day.prototype.endOfMonth = function (inclusive) {\r\n if (inclusive === void 0) { inclusive = true; }\r\n return inclusive ?\r\n this.mutate(function (d) { return d.endOf('month'); }) :\r\n this.mutate(function (d) { return d.startOf('month').add(1, 'month'); });\r\n };\r\n Day.prototype.isEndOfMonth = function () {\r\n return this.dayOfMonth === this.daysInMonth();\r\n };\r\n // Year\r\n Day.prototype.startOfYear = function () {\r\n return this.mutate(function (d) { return d.startOf('year'); });\r\n };\r\n Day.prototype.isStartOfYear = function () {\r\n return this.month === Constants.MONTH_MIN && this.dayOfMonth === Constants.DAY_MIN;\r\n };\r\n Day.prototype.endOfYear = function (inclusive) {\r\n if (inclusive === void 0) { inclusive = true; }\r\n return inclusive ?\r\n this.mutate(function (d) { return d.endOf('year'); }) :\r\n this.mutate(function (d) { return d.startOf('year').add(1, 'year'); });\r\n };\r\n Day.prototype.isEndOfYear = function () {\r\n return this.month === Constants.MONTH_MAX && this.dayOfMonth === Constants.DAY_MAX;\r\n };\r\n // Days In X\r\n Day.prototype.daysInMonth = function () {\r\n return this.date.daysInMonth();\r\n };\r\n Day.prototype.daysInYear = function () {\r\n return this.endOfYear().dayOfYear;\r\n };\r\n Day.prototype.weeksInYear = function () {\r\n return this.date.weeksInYear();\r\n };\r\n // Display\r\n Day.prototype.format = function (format) {\r\n return this.date.format(format);\r\n };\r\n Day.prototype.utc = function (keepLocalTime) {\r\n return this.mutate(function (d) { return d.utc(keepLocalTime); });\r\n };\r\n Day.prototype.toMoment = function () {\r\n return this.date.clone();\r\n };\r\n Day.prototype.toDate = function () {\r\n return this.date.toDate();\r\n };\r\n Day.prototype.toArray = function () {\r\n return this.date.toArray();\r\n };\r\n Day.prototype.toJSON = function () {\r\n return this.date.toJSON();\r\n };\r\n Day.prototype.toISOString = function (keepOffset) {\r\n if (keepOffset === void 0) { keepOffset = false; }\r\n return this.date.toISOString(keepOffset);\r\n };\r\n Day.prototype.toObject = function () {\r\n return this.date.toObject();\r\n };\r\n Day.prototype.toString = function () {\r\n return this.date.toString();\r\n };\r\n // State\r\n Day.prototype.isDST = function () {\r\n return this.date.isDST();\r\n };\r\n Day.prototype.isLeapYear = function () {\r\n return this.date.isLeapYear();\r\n };\r\n // Instances\r\n Day.now = function () {\r\n return new Day(__WEBPACK_IMPORTED_MODULE_5_moment__());\r\n };\r\n Day.today = function () {\r\n return this.now().start();\r\n };\r\n Day.tomorrow = function () {\r\n return this.today().next();\r\n };\r\n Day.fromMoment = function (moment) {\r\n return moment && moment.isValid() ? new Day(moment) : null;\r\n };\r\n Day.unix = function (millis) {\r\n return this.fromMoment(__WEBPACK_IMPORTED_MODULE_5_moment__(millis));\r\n };\r\n Day.unixSeconds = function (millis) {\r\n return this.fromMoment(__WEBPACK_IMPORTED_MODULE_5_moment__[\"unix\"](millis));\r\n };\r\n Day.parse = function (input) {\r\n return Parse_Parse.day(input);\r\n };\r\n Day.fromString = function (input) {\r\n return this.fromMoment(__WEBPACK_IMPORTED_MODULE_5_moment__(input));\r\n };\r\n Day.fromFormat = function (input, formats) {\r\n return this.fromMoment(__WEBPACK_IMPORTED_MODULE_5_moment__(input, formats));\r\n };\r\n Day.fromObject = function (input) {\r\n return this.fromMoment(__WEBPACK_IMPORTED_MODULE_5_moment__(input));\r\n };\r\n Day.fromDate = function (input) {\r\n return this.fromMoment(__WEBPACK_IMPORTED_MODULE_5_moment__(input));\r\n };\r\n Day.fromArray = function (input) {\r\n return this.fromMoment(__WEBPACK_IMPORTED_MODULE_5_moment__(input));\r\n };\r\n Day.fromDayIdentifier = function (id) {\r\n var date = id % 100;\r\n var month = (Math.floor(id / 100) % 100) - 1;\r\n var year = Math.floor(id / 10000);\r\n return this.build(year, month, date);\r\n };\r\n Day.build = function (year, month, date, hour, minute, second, millisecond) {\r\n if (date === void 0) { date = Constants.DAY_MIN; }\r\n if (hour === void 0) { hour = Constants.HOUR_MIN; }\r\n if (minute === void 0) { minute = Constants.MINUTE_MIN; }\r\n if (second === void 0) { second = Constants.SECOND_MIN; }\r\n if (millisecond === void 0) { millisecond = Constants.MILLIS_MIN; }\r\n return new Day(__WEBPACK_IMPORTED_MODULE_5_moment__({ year: year, month: month, date: date, hour: hour, minute: minute, second: second, millisecond: millisecond }));\r\n };\r\n Day.getWeekspanOfYear = function (date) {\r\n return Math.floor((date.dayOfYear() - 1) / Constants.DAYS_IN_WEEK);\r\n };\r\n Day.getLastWeekspanOfYear = function (date) {\r\n var lastOfYear = date.clone().endOf('year');\r\n var daysInYear = lastOfYear.dayOfYear();\r\n return Math.floor((daysInYear - date.dayOfYear()) / Constants.DAYS_IN_WEEK);\r\n };\r\n Day.getWeekOfYear = function (date) {\r\n var firstOfYear = date.clone().startOf('year');\r\n var weeks = date.week();\r\n return firstOfYear.day() > Constants.WEEK_OF_MONTH_MINIMUM_WEEKDAY ? weeks - 1 : weeks;\r\n };\r\n Day.getFullWeekOfYear = function (date) {\r\n var firstOfYear = date.clone().startOf('year');\r\n var weeks = date.week();\r\n return firstOfYear.day() === Constants.WEEKDAY_MIN ? weeks : weeks - 1;\r\n };\r\n Day.getLastFullWeekOfYear = function (date) {\r\n var firstOfYear = date.clone().startOf('year');\r\n var weeks = date.week();\r\n var weeksMax = date.weeksInYear();\r\n var lastWeek = weeksMax - weeks;\r\n return firstOfYear.day() === Constants.WEEKDAY_MIN ? lastWeek + 1 : lastWeek;\r\n };\r\n Day.getWeekspanOfMonth = function (date) {\r\n return Math.floor((date.date() - 1) / Constants.DAYS_IN_WEEK);\r\n };\r\n Day.getLastWeekspanOfMonth = function (date) {\r\n return Math.floor((date.daysInMonth() - date.date()) / Constants.DAYS_IN_WEEK);\r\n };\r\n Day.getFullWeekOfMonth = function (date) {\r\n return Math.floor((date.date() - 1 - date.day() + Constants.DAYS_IN_WEEK) / Constants.DAYS_IN_WEEK);\r\n };\r\n Day.getLastFullWeekOfMonth = function (date) {\r\n return Math.floor((date.daysInMonth() - date.date() - (Constants.WEEKDAY_MAX - date.day()) + Constants.DAYS_IN_WEEK) / Constants.DAYS_IN_WEEK);\r\n };\r\n Day.getWeekOfMonth = function (date) {\r\n var dom = date.date();\r\n var dow = date.day();\r\n var sundayDate = dom - dow;\r\n return Math.floor((sundayDate + Constants.WEEK_OF_MONTH_MINIMUM_WEEKDAY + 5) / Constants.DAYS_IN_WEEK);\r\n };\r\n Day.getLastDayOfMonth = function (date) {\r\n return date.daysInMonth() - date.date() + 1;\r\n };\r\n return Day;\r\n}());\r\n\r\n\n// CONCATENATED MODULE: ./src/CalendarDay.ts\n\r\nvar CalendarDay___extends = (this && this.__extends) || (function () {\r\n var extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return function (d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n };\r\n})();\r\n\r\n\r\n/**\r\n * A day in a [[Calendar]] with extra information relative to any selection on\r\n * the calendar, the current date, or events on the day.\r\n *\r\n * @typeparam T The type of data stored in the [[Event]] class.\r\n * @typeparam M The type of metadata stored in the schedule.\r\n */\r\nvar CalendarDay_CalendarDay = (function (_super) {\r\n CalendarDay___extends(CalendarDay, _super);\r\n function CalendarDay() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n /**\r\n * Whether this day is the current day (ex: today).\r\n */\r\n _this.currentDay = false;\r\n /**\r\n * Whether this day is on the same week as the current day (ex: today).\r\n */\r\n _this.currentWeek = false;\r\n /**\r\n * Whether this day is on the same month as the current day (ex: today).\r\n */\r\n _this.currentMonth = false;\r\n /**\r\n * Whether this day is on the same year as the current day (ex: today).\r\n */\r\n _this.currentYear = false;\r\n /**\r\n * How many days away this day is from the current day (ex: today). If this\r\n * day is the current day the offset is 0. If this day is before the current\r\n * day it will be the negative number of days away. Otherwise this will be\r\n * positive meaning this day is after the current day by the given days.\r\n */\r\n _this.currentOffset = 0;\r\n /**\r\n * Whether this day is part of a selection on the calendar.\r\n */\r\n _this.selectedDay = false;\r\n /**\r\n * Whether this day is on the same week that the calendar selection is.\r\n */\r\n _this.selectedWeek = false;\r\n /**\r\n * Whether this day is on the same month that the calendar selection is.\r\n */\r\n _this.selectedMonth = false;\r\n /**\r\n * Whether this day is on the same year that the calendar selection is.\r\n */\r\n _this.selectedYear = false;\r\n /**\r\n * Whether this day is in the current calendar or not. Some days are outside\r\n * the calendar span and used to fill in weeks. Month calendars will fill in\r\n * days so the list of days in the calendar start on Sunday and end on Saturday.\r\n */\r\n _this.inCalendar = false;\r\n /**\r\n * The list of events on this day based on the settings and schedules in the\r\n * calendar.\r\n */\r\n _this.events = [];\r\n return _this;\r\n }\r\n /**\r\n * Updates the current flags on this day given the current day (ex: today).\r\n *\r\n * @param current The current day of the calendar.\r\n */\r\n CalendarDay.prototype.updateCurrent = function (current) {\r\n this.currentDay = this.sameDay(current);\r\n this.currentWeek = this.sameWeek(current);\r\n this.currentMonth = this.sameMonth(current);\r\n this.currentYear = this.sameYear(current);\r\n this.currentOffset = this.daysBetween(current, Op.DOWN, false);\r\n return this;\r\n };\r\n /**\r\n * Updates the selection flags on this day given the selection range on the\r\n * calendar.\r\n *\r\n * @param selected The span of days selected on the calendar.\r\n */\r\n CalendarDay.prototype.updateSelected = function (selected) {\r\n this.selectedDay = selected.matchesDay(this);\r\n this.selectedWeek = selected.matchesWeek(this);\r\n this.selectedMonth = selected.matchesMonth(this);\r\n this.selectedYear = selected.matchesYear(this);\r\n return this;\r\n };\r\n /**\r\n * Clears the selection flags on this day. This is done when the selection on\r\n * the calendar is cleared.\r\n */\r\n CalendarDay.prototype.clearSelected = function () {\r\n this.selectedDay = this.selectedWeek = this.selectedMonth = this.selectedYear = false;\r\n return this;\r\n };\r\n return CalendarDay;\r\n}(Day_Day));\r\n\r\n\n// CONCATENATED MODULE: ./src/CalendarEvent.ts\n\r\n\r\n/**\r\n * An instance of an [[Event]] on a given day of a [[Calendar]] generated by\r\n * the event's [[Schedule]].\r\n *\r\n * @typeparam T The type of data stored in the [[Event]] class.\r\n * @typeparam M The type of metadata stored in the schedule and in this class.\r\n */\r\nvar CalendarEvent_CalendarEvent = (function () {\r\n /**\r\n * Creates a new event instance given the id, the event paired with the\r\n * schedule, the schedule, the time span of the event, and the day on the\r\n * calendar the event belongs to.\r\n *\r\n * @param id The relatively unique identifier of this event.\r\n * @param event The event which created this instance.\r\n * @param time The time span of this event.\r\n * @param actualDay The day on the calendar this event is for.\r\n */\r\n function CalendarEvent(id, event, time, actualDay) {\r\n /**\r\n * The row this event is on in a visual calendar. An event can span multiple\r\n * days and it is desirable to have the occurrence on each day to line up.\r\n * This is only set when [[Calendar.updateRows]] is true or manually set.\r\n * This value makes sense for visual calendars for all day events or when the\r\n * visual calendar is not positioning events based on their time span.\r\n */\r\n this.row = 0;\r\n /**\r\n * The column this event is on in a visual calendar. An event can have its\r\n * time overlap with another event displaying one of the events in another\r\n * column. This is only set when [[Calendar.updateColumns]] is true or\r\n * manually set. This value makes sense for visual calendars that are\r\n * displaying event occurrences at specific times positioned accordingly.\r\n */\r\n this.col = 0;\r\n this.id = id;\r\n this.event = event;\r\n this.time = time;\r\n this.day = actualDay;\r\n this.fullDay = event.schedule.isFullDay();\r\n this.meta = event.schedule.getMeta(time.start);\r\n this.cancelled = event.schedule.isCancelled(time.start);\r\n this.starting = time.isPoint || time.start.sameDay(actualDay);\r\n this.ending = time.isPoint || time.end.relative(-1).sameDay(actualDay);\r\n }\r\n Object.defineProperty(CalendarEvent.prototype, \"scheduleId\", {\r\n /**\r\n * The id of the schedule uniqe within the calendar which generated this event.\r\n */\r\n get: function () {\r\n return Math.floor(this.id / Constants.MAX_EVENTS_PER_DAY);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CalendarEvent.prototype, \"start\", {\r\n /**\r\n * The start timestamp of the event.\r\n */\r\n get: function () {\r\n return this.time.start;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CalendarEvent.prototype, \"end\", {\r\n /**\r\n * The end timestamp of the event.\r\n */\r\n get: function () {\r\n return this.time.end;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CalendarEvent.prototype, \"schedule\", {\r\n /**\r\n * The schedule which generated this event.\r\n */\r\n get: function () {\r\n return this.event.schedule;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CalendarEvent.prototype, \"data\", {\r\n /**\r\n * The related event data.\r\n */\r\n get: function () {\r\n return this.event.data;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CalendarEvent.prototype, \"identifier\", {\r\n /**\r\n * An [[IdentifierInput]] for the start of this event.\r\n */\r\n get: function () {\r\n return this.identifierType.get(this.start);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CalendarEvent.prototype, \"identifierType\", {\r\n /**\r\n * The [[Identifier]] for this event. Either [[Identifier.Day]] or\r\n * [[Identifier.Time]].\r\n */\r\n get: function () {\r\n return this.schedule.identifierType;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CalendarEvent.prototype, \"startDelta\", {\r\n /**\r\n * Returns a delta value between 0 and 1 which represents where the\r\n * [[CalendarEvent.start]] is relative to [[CalendarEvent.day]]. The delta\r\n * value would be less than 0 if the start of the event is before\r\n * [[CalendarEvent.day]].\r\n */\r\n get: function () {\r\n return this.time.startDelta(this.day);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CalendarEvent.prototype, \"endDelta\", {\r\n /**\r\n * Returns a delta value between 0 and 1 which represents where the\r\n * [[CalendarEvent.end]] is relative to [[CalendarEvent.day]]. The delta value\r\n * would be greater than 1 if the end of the event is after\r\n * [[CalendarEvent.day]].\r\n */\r\n get: function () {\r\n return this.time.endDelta(this.day);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Calculates the bounds for this event if it were placed in a rectangle which\r\n * represents a day (24 hour period). By default the returned values are\r\n * between 0 and 1 and can be scaled by the proper rectangle dimensions or the\r\n * rectangle dimensions can be passed to this function.\r\n *\r\n * @param dayHeight The height of the rectangle of the day.\r\n * @param dayWidth The width of the rectangle of the day.\r\n * @param columnOffset The offset in the rectangle of the day to adjust this\r\n * event by if it intersects or is contained in a previous event. This also\r\n * reduces the width of the returned bounds to keep the bounds in the\r\n * rectangle of the day.\r\n * @param clip `true` if the bounds should stay in the day rectangle, `false`\r\n * and the bounds may go outside the rectangle of the day for multi-day\r\n * events.\r\n * @param offsetX How much to translate the left & right properties by.\r\n * @param offsetY How much to translate the top & bottom properties by.\r\n * @returns The calculated bounds for this event.\r\n */\r\n CalendarEvent.prototype.getTimeBounds = function (dayHeight, dayWidth, columnOffset, clip, offsetX, offsetY) {\r\n if (dayHeight === void 0) { dayHeight = 1; }\r\n if (dayWidth === void 0) { dayWidth = 1; }\r\n if (columnOffset === void 0) { columnOffset = 0.1; }\r\n if (clip === void 0) { clip = true; }\r\n if (offsetX === void 0) { offsetX = 0; }\r\n if (offsetY === void 0) { offsetY = 0; }\r\n return this.time.getBounds(this.day, dayHeight, dayWidth, this.col * columnOffset, clip, offsetX, offsetY);\r\n };\r\n /**\r\n * Changes the cancellation status of this event. By default this cancels\r\n * this event - but `false` may be passed to undo a cancellation.\r\n *\r\n * @param cancelled Whether the event should be cancelled.\r\n */\r\n CalendarEvent.prototype.cancel = function (cancelled) {\r\n if (cancelled === void 0) { cancelled = true; }\r\n this.schedule.setCancelled(this.start, cancelled);\r\n this.cancelled = cancelled;\r\n return this;\r\n };\r\n /**\r\n * Changes the exclusion status of this event. By default this excludes this\r\n * event - but `false` may be passed to undo an exclusion.\r\n *\r\n * @param excluded Whether the event should be excluded.\r\n */\r\n CalendarEvent.prototype.exclude = function (excluded) {\r\n if (excluded === void 0) { excluded = true; }\r\n this.schedule.setExcluded(this.start, excluded);\r\n return this;\r\n };\r\n /**\r\n * Moves this event to potentially another day and time. A move is\r\n * accomplished by excluding the current event and adding an inclusion of the\r\n * new day & time. Any [[CalendarEvent.meta]] on this event will be moved to\r\n * the new event. If the schedule represents a single event\r\n * ([[Schedule.isSingleEvent]]) then the schedule frequencies are updated\r\n * to match the timestamp provided.\r\n *\r\n * @param toTime The timestamp to move this event to.\r\n * @returns Whether the event was moved to the given time.\r\n */\r\n CalendarEvent.prototype.move = function (toTime) {\r\n return this.schedule.move(toTime, this.start, this.meta);\r\n };\r\n return CalendarEvent;\r\n}());\r\n\r\n\n// CONCATENATED MODULE: ./src/Calendar.ts\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * A collection of [[CalendarDay]]s, the events on the calendar, and all\r\n * [[CalendarEvent]]s generated based on the events.\r\n *\r\n * @typeparam T The type of data stored in the [[Event]] class.\r\n * @typeparam M The type of metadata stored in the schedule.\r\n */\r\nvar Calendar_Calendar = (function () {\r\n /**\r\n * Creates a new calendar given a span, type, size, moving functions, and\r\n * optionally some default properties for the calendar.\r\n *\r\n * @param start The first day on the calendar.\r\n * @param end The last day on the calendar.\r\n * @param type The calendar type used for describing the calendar and splitting it.\r\n * @param size The number of calendar types in this calendar.\r\n * @param moveStart The function to move the start day.\r\n * @param moveEnd The function to move the end by.\r\n * @param input The default properties for this calendar.\r\n * @see [[Calendar.start]]\r\n * @see [[Calendar.end]]\r\n * @see [[Calendar.type]]\r\n * @see [[Calendar.size]]\r\n * @see [[Calendar.moveStart]]\r\n * @see [[Calendar.moveEnd]]\r\n */\r\n function Calendar(start, end, type, size, moveStart, moveEnd, input) {\r\n /**\r\n * If the calendar should be filled in so the first day of the calendar is\r\n * Sunday and the last day is Saturday.\r\n */\r\n this.fill = false;\r\n /**\r\n * The minimum number of days in the calendar no matter what the type or size\r\n * is. This can be used to display a month with a constant number of weeks -\r\n * because not all months contain the same number of weeks.\r\n */\r\n this.minimumSize = 0;\r\n /**\r\n * When `true` a [[CalendarEvent]] instance exists on each [[CalendarDay]]\r\n * the event covers even if the event didn't start on that day.\r\n */\r\n this.repeatCovers = true;\r\n /**\r\n * When `true` an event instance will be created for each time specified on\r\n * the schedule. If the schedule specifies an all day event then only one\r\n * event is added to a day. This is typically done when displaying days or\r\n * weeks and events can be displayed on a timeline.\r\n */\r\n this.listTimes = false;\r\n /**\r\n * When `true` events will be added to days \"outside\" the calendar. Days\r\n * outside the calendar are days filled in when [[Calendar.fill]] is `true`.\r\n * More specifically days that are in [[Calendar.filled]] and not in\r\n * [[Calendar.span]].\r\n */\r\n this.eventsOutside = false;\r\n /**\r\n * When `true` [[CalendarEvent.row]] will be set so when visually displaying\r\n * the event with others multi-day events will align and not overlap.\r\n */\r\n this.updateRows = false;\r\n /**\r\n * When `true` [[CalendarEvent.col]] will be set so when visually displaying\r\n * the event based on start and end time any events that overlap with each\r\n * other will be \"indented\" to see the event below it.\r\n */\r\n this.updateColumns = false;\r\n /**\r\n * The function (if any) which sorts the events on a calendar day.\r\n */\r\n this.eventSorter = null;\r\n /**\r\n * A function to use when parsing meta input into the desired type.\r\n *\r\n * @param input The input to parse.\r\n * @returns The meta parsed from the given input, if any.\r\n */\r\n this.parseMeta = (function (x) { return x; });\r\n /**\r\n * A function to use when parsing meta input into the desired type.\r\n *\r\n * @param input The input to parse.\r\n * @returns The meta parsed from the given input, if any.\r\n */\r\n this.parseData = (function (x) { return x; });\r\n /**\r\n * A selection of days on the calendar. If no days are selected this is `null`.\r\n * This is merely used to keep the selection flags in [[CalendarDay]] updated\r\n * via [[Calendar.refreshSelection]].\r\n */\r\n this.selection = null;\r\n /**\r\n * The array of days in this calendar and their events.\r\n */\r\n this.days = [];\r\n /**\r\n * The array of scheduled events added to the calendar.\r\n */\r\n this.events = [];\r\n /**\r\n * The array of visible events on the calendar. This is built based on the\r\n * span of the schedule in the given event and also the [[Event.visible]] flag.\r\n */\r\n this.visible = [];\r\n this.span = new DaySpan_DaySpan(start, end);\r\n this.filled = new DaySpan_DaySpan(start, end);\r\n this.type = type;\r\n this.size = size;\r\n this.moveStart = moveStart;\r\n this.moveEnd = moveEnd;\r\n if (Functions.isDefined(input)) {\r\n this.set(input);\r\n }\r\n else {\r\n this.refresh();\r\n }\r\n }\r\n /**\r\n * Changes the calendar possibly morphing it to a different type or size if\r\n * specified in the given input. If the type and size are not morphed then\r\n * the following properties may be updated:\r\n *\r\n * - [[Calendar.fill]]\r\n * - [[Calendar.minimumSize]]\r\n * - [[Calendar.repeatCovers]]\r\n * - [[Calendar.listTimes]]\r\n * - [[Calendar.eventsOutside]]\r\n * - [[Calendar.updateRows]]\r\n * - [[Calendar.updateColumns]]\r\n * - [[Calendar.eventSorter]]\r\n * - [[Calendar.events]]\r\n * - [[Calendar.parseData]]\r\n * - [[Calendar.parseMeta]]\r\n *\r\n * If [[CalendarInput.delayRefresh]] is not given with `true` then\r\n * [[Calendar.refresh]] will be called once the calendar properties have been\r\n * updated.\r\n *\r\n * @param input The new properties for this calendar to overwrite with.\r\n */\r\n Calendar.prototype.set = function (input) {\r\n var typeChange = Functions.isDefined(input.type) && input.type !== this.type;\r\n var sizeChange = Functions.isDefined(input.size) && input.size !== this.size;\r\n if (typeChange || sizeChange) {\r\n var focus_1 = Functions.coalesce(input.otherwiseFocus, 0.4999);\r\n var prefer = Functions.coalesce(input.preferToday, true);\r\n var size = Functions.coalesce(input.size, this.size);\r\n var type = Functions.coalesce(input.type, this.type);\r\n var around = Functions.coalesce(input.around, this.days[Math.floor((this.days.length - 1) * focus_1)]);\r\n var today = Day_Day.today();\r\n if (!around || (prefer && this.span.matchesDay(today))) {\r\n around = today;\r\n }\r\n var meta = Calendar.TYPES[type];\r\n var start = meta.getStart(Day_Day.parse(around), size, focus_1);\r\n var end = meta.getEnd(start, size, focus_1);\r\n this.span.start = start;\r\n this.span.end = end;\r\n this.type = type;\r\n this.size = size;\r\n this.moveStart = meta.moveStart;\r\n this.moveEnd = meta.moveEnd;\r\n }\r\n else if (input.around) {\r\n var focus_2 = Functions.coalesce(input.otherwiseFocus, 0.4999);\r\n var around = Day_Day.parse(input.around);\r\n var type = this.type;\r\n var size = this.size;\r\n var meta = Calendar.TYPES[type];\r\n var start = meta.getStart(around, size, focus_2);\r\n var end = meta.getEnd(start, size, focus_2);\r\n this.span.start = start;\r\n this.span.end = end;\r\n }\r\n this.fill = Functions.coalesce(input.fill, this.fill);\r\n this.minimumSize = Functions.coalesce(input.minimumSize, this.minimumSize);\r\n this.repeatCovers = Functions.coalesce(input.repeatCovers, this.repeatCovers);\r\n this.listTimes = Functions.coalesce(input.listTimes, this.listTimes);\r\n this.eventsOutside = Functions.coalesce(input.eventsOutside, this.eventsOutside);\r\n this.updateRows = Functions.coalesce(input.updateRows, this.updateRows);\r\n this.updateColumns = Functions.coalesce(input.updateColumns, this.updateColumns);\r\n this.eventSorter = Functions.coalesce(input.eventSorter, this.eventSorter);\r\n this.parseMeta = Functions.coalesce(input.parseMeta, this.parseMeta);\r\n this.parseData = Functions.coalesce(input.parseData, this.parseData);\r\n if (Functions.isArray(input.events)) {\r\n this.removeEvents();\r\n this.addEvents(input.events, false, true);\r\n }\r\n if (!input.delayRefresh) {\r\n this.refresh();\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets the [[Calendar.minimumSize]] value and returns `this` for method\r\n * chaining.\r\n *\r\n * @param minimumSize The new value.\r\n */\r\n Calendar.prototype.withMinimumSize = function (minimumSize) {\r\n this.minimumSize = minimumSize;\r\n this.refresh();\r\n return this;\r\n };\r\n /**\r\n * Sets the [[Calendar.repeatCovers]] value and returns `this` for method\r\n * chaining.\r\n *\r\n * @param repeatCovers The new value.\r\n */\r\n Calendar.prototype.withRepeatCovers = function (repeatCovers) {\r\n this.repeatCovers = repeatCovers;\r\n this.refreshEvents();\r\n return this;\r\n };\r\n /**\r\n * Sets the [[Calendar.listTimes]] value and returns `this` for method\r\n * chaining.\r\n *\r\n * @param listTimes The new value.\r\n */\r\n Calendar.prototype.withListTimes = function (listTimes) {\r\n this.listTimes = listTimes;\r\n this.refreshEvents();\r\n return this;\r\n };\r\n /**\r\n * Sets the [[Calendar.eventsOutside]] value and returns `this` for method\r\n * chaining.\r\n *\r\n * @param eventsOutside The new value.\r\n */\r\n Calendar.prototype.withEventsOutside = function (eventsOutside) {\r\n this.eventsOutside = eventsOutside;\r\n this.refreshEvents();\r\n return this;\r\n };\r\n /**\r\n * Sets the [[Calendar.updateRows]] value and returns `this` for method\r\n * chaining.\r\n *\r\n * @param updateRows The new value.\r\n * @param refresh If the rows should be updated now if `updateRows` is `true`.\r\n */\r\n Calendar.prototype.withUpdateRows = function (updateRows, refresh) {\r\n if (refresh === void 0) { refresh = true; }\r\n this.updateRows = updateRows;\r\n if (refresh && updateRows) {\r\n this.refreshRows();\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets the [[Calendar.updateColumns]] value and returns `this` for method\r\n * chaining.\r\n *\r\n * @param updateColumns The new value.\r\n * @param refresh If the columns should be updated now if `updateColumns` is\r\n * `true`.\r\n */\r\n Calendar.prototype.withUpdateColumns = function (updateColumns, refresh) {\r\n if (refresh === void 0) { refresh = true; }\r\n this.updateColumns = updateColumns;\r\n if (refresh && updateColumns) {\r\n this.refreshColumns();\r\n }\r\n return this;\r\n };\r\n Object.defineProperty(Calendar.prototype, \"start\", {\r\n /**\r\n * Returns the start day of the calendar. If this calendar is filled, this\r\n * may not represent the very first day in the calendar.\r\n */\r\n get: function () {\r\n return this.span.start;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Calendar.prototype, \"end\", {\r\n /**\r\n * Returns the end day of the calendar. If this calendar is filled, this\r\n * may not represent the very last day in the calendar.\r\n */\r\n get: function () {\r\n return this.span.end;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the summary of the span of time this calendar represents.\r\n *\r\n * @param dayOfWeek [[DaySpan.summary]]\r\n * @param short [[DaySpan.summary]]\r\n * @param repeat [[DaySpan.summary]]\r\n * @param contextual [[DaySpan.summary]]\r\n * @param delimiter [[DaySpan.summary]]\r\n * @see [[DaySpan.summary]]\r\n */\r\n Calendar.prototype.summary = function (dayOfWeek, short, repeat, contextual, delimiter) {\r\n if (dayOfWeek === void 0) { dayOfWeek = true; }\r\n if (short === void 0) { short = false; }\r\n if (repeat === void 0) { repeat = false; }\r\n if (contextual === void 0) { contextual = true; }\r\n if (delimiter === void 0) { delimiter = ' - '; }\r\n return this.span.summary(this.type, dayOfWeek, short, repeat, contextual, delimiter);\r\n };\r\n /**\r\n * Splits up this calendar into an iterable collection of calendars. The\r\n * resulting iterator will return `size / by` number of calendars.\r\n *\r\n * @param by The new size of the resulting calendars. If the the size of the\r\n * current calendar is not divisible by this value the resulting calendars\r\n * may cover more or less than this calendar covers.\r\n * @returns An iterator for the calendars produced.\r\n */\r\n Calendar.prototype.split = function (by) {\r\n var _this = this;\r\n if (by === void 0) { by = 1; }\r\n return new Iterator_Iterator(function (iterator) {\r\n var start = _this.start;\r\n var end = _this.moveEnd(_this.end, by - _this.size);\r\n for (var i = 0; i < _this.size; i++) {\r\n var calendar = new Calendar(start, end, _this.type, by, _this.moveStart, _this.moveEnd, _this);\r\n if (iterator.act(calendar) === IteratorAction.Stop) {\r\n return;\r\n }\r\n start = _this.moveStart(start, by);\r\n end = _this.moveEnd(end, by);\r\n }\r\n });\r\n };\r\n /**\r\n * Refreshes the days and events in this calendar based on the start and end\r\n * days, the calendar properties, and its eventss.\r\n *\r\n * @param today The current day to update the calendar days via\r\n * [[CalendarDay.updateCurrent]].\r\n */\r\n Calendar.prototype.refresh = function (today) {\r\n if (today === void 0) { today = Day_Day.today(); }\r\n this.length = this.span.days(Op.UP, true);\r\n this.resetDays();\r\n this.refreshCurrent(today);\r\n this.refreshSelection();\r\n this.refreshVisible();\r\n this.refreshEvents();\r\n return this;\r\n };\r\n /**\r\n * Updates the [[Calendar.filled]] span based on [[Calendar.start]],\r\n * [[Calendar.end]], and [[Calendar.fill]] properties.\r\n */\r\n Calendar.prototype.resetFilled = function () {\r\n this.filled.start = this.fill ? this.start.startOfWeek() : this.start;\r\n this.filled.end = this.fill ? this.end.endOfWeek() : this.end;\r\n return this;\r\n };\r\n /**\r\n * Updates [[Calendar.days]] to match the span of days in the calendar.\r\n */\r\n Calendar.prototype.resetDays = function () {\r\n this.resetFilled();\r\n var days = this.days;\r\n var filled = this.filled;\r\n var current = filled.start;\r\n var daysBetween = filled.days(Op.UP);\r\n var total = Math.max(this.minimumSize, daysBetween);\r\n for (var i = 0; i < total; i++) {\r\n var day = days[i];\r\n if (!day || !day.sameDay(current)) {\r\n day = new CalendarDay_CalendarDay(current.date);\r\n if (i < days.length) {\r\n days.splice(i, 1, day);\r\n }\r\n else {\r\n days.push(day);\r\n }\r\n }\r\n day.inCalendar = this.span.contains(day);\r\n current = current.next();\r\n }\r\n if (days.length > total) {\r\n days.splice(total, days.length - total);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Updates the list of visible schedules.\r\n */\r\n Calendar.prototype.refreshVisible = function () {\r\n var start = this.filled.start;\r\n var end = this.filled.end;\r\n this.visible = this.events.filter(function (e) {\r\n return e.visible && e.schedule.matchesRange(start, end);\r\n });\r\n return this;\r\n };\r\n /**\r\n * Updates the days with the current day via [[CalendarDay.updateCurrent]].\r\n *\r\n * @param today The new current day.\r\n */\r\n Calendar.prototype.refreshCurrent = function (today) {\r\n if (today === void 0) { today = Day_Day.today(); }\r\n this.iterateDays().iterate(function (d) {\r\n d.updateCurrent(today);\r\n });\r\n return this;\r\n };\r\n /**\r\n * Updates the selection flags in [[CalendarDay]] based on the\r\n * [[Calendar.selection]] property.\r\n */\r\n Calendar.prototype.refreshSelection = function () {\r\n var _this = this;\r\n this.iterateDays().iterate(function (d) {\r\n if (_this.selection) {\r\n d.updateSelected(_this.selection);\r\n }\r\n else {\r\n d.clearSelected();\r\n }\r\n });\r\n return this;\r\n };\r\n /**\r\n * Updates the [[CalendarDay.events]] based on the events in this calendar\r\n * and the following properties:\r\n *\r\n * - [[Calendar.eventsForDay]]\r\n * - [[Calendar.eventsOutside]]\r\n * - [[Calendar.listTimes]]\r\n * - [[Calendar.repeatCovers]]\r\n * - [[Calendar.updateRows]]\r\n * - [[Calendar.updateColumns]]\r\n */\r\n Calendar.prototype.refreshEvents = function () {\r\n var _this = this;\r\n this.iterateDays().iterate(function (d) {\r\n if (d.inCalendar || _this.eventsOutside) {\r\n d.events = _this.eventsForDay(d, _this.listTimes, _this.repeatCovers);\r\n }\r\n });\r\n if (this.updateRows) {\r\n this.refreshRows();\r\n }\r\n if (this.updateColumns) {\r\n this.refreshColumns();\r\n }\r\n return this;\r\n };\r\n /**\r\n * Refreshes the [[CalendarEvent.row]] property as described in the link.\r\n */\r\n Calendar.prototype.refreshRows = function () {\r\n var eventToRow = {};\r\n var onlyFullDay = this.listTimes;\r\n this.iterateDays().iterate(function (d) {\r\n if (d.dayOfWeek === 0) {\r\n eventToRow = {};\r\n }\r\n var used = {};\r\n for (var _i = 0, _a = d.events; _i < _a.length; _i++) {\r\n var event_1 = _a[_i];\r\n if (onlyFullDay && !event_1.fullDay) {\r\n continue;\r\n }\r\n if (event_1.id in eventToRow) {\r\n used[event_1.row = eventToRow[event_1.id]] = true;\r\n }\r\n }\r\n var rowIndex = 0;\r\n for (var _b = 0, _c = d.events; _b < _c.length; _b++) {\r\n var event_2 = _c[_b];\r\n if ((onlyFullDay && !event_2.fullDay) || event_2.id in eventToRow) {\r\n continue;\r\n }\r\n while (used[rowIndex]) {\r\n rowIndex++;\r\n }\r\n eventToRow[event_2.id] = event_2.row = rowIndex;\r\n rowIndex++;\r\n }\r\n });\r\n return this;\r\n };\r\n /**\r\n * Refreshes the [[CalendarEvent.col]] property as described in the link.\r\n */\r\n Calendar.prototype.refreshColumns = function () {\r\n this.iterateDays().iterate(function (d) {\r\n var markers = [];\r\n for (var _i = 0, _a = d.events; _i < _a.length; _i++) {\r\n var event_3 = _a[_i];\r\n if (!event_3.fullDay) {\r\n markers.push({\r\n time: event_3.time.start.time,\r\n event: event_3,\r\n start: true,\r\n parent: null\r\n });\r\n markers.push({\r\n time: event_3.time.end.time - 1,\r\n event: event_3,\r\n start: false,\r\n parent: null\r\n });\r\n }\r\n }\r\n markers.sort(function (a, b) {\r\n return a.time - b.time;\r\n });\r\n var parent = null;\r\n for (var _b = 0, markers_1 = markers; _b < markers_1.length; _b++) {\r\n var marker = markers_1[_b];\r\n if (marker.start) {\r\n marker.parent = parent;\r\n parent = marker;\r\n }\r\n else if (parent) {\r\n parent = parent.parent;\r\n }\r\n }\r\n for (var _c = 0, markers_2 = markers; _c < markers_2.length; _c++) {\r\n var marker = markers_2[_c];\r\n if (marker.start) {\r\n marker.event.col = marker.parent ? marker.parent.event.col + 1 : 0;\r\n }\r\n }\r\n });\r\n return this;\r\n };\r\n /**\r\n * Iterates over all days in this calendar and passes each day to `iterator`.\r\n *\r\n * @param iterator The function to pass [[CalendarDay]]s to.\r\n */\r\n Calendar.prototype.iterateDays = function () {\r\n var _this = this;\r\n return new Iterator_Iterator(function (iterator) {\r\n var days = _this.days;\r\n for (var i = 0; i < days.length; i++) {\r\n switch (iterator.act(days[i])) {\r\n case IteratorAction.Stop:\r\n return;\r\n }\r\n }\r\n });\r\n };\r\n /**\r\n * Returns the events for the given day optionally looking at schedule times,\r\n * optionally looking at events which cover multiple days, and optionally\r\n * sorted with the given function.\r\n *\r\n * @param day The day to find events for.\r\n * @param getTimes When `true` an event is added to the result for each time\r\n * specified in the schedule.\r\n * @param covers When `true` events which don't start on the given day but do\r\n * overlap are added to the result.\r\n * @param sorter The function to sort the events by, if any.\r\n * @returns An array of events that occurred on the given day.\r\n */\r\n Calendar.prototype.eventsForDay = function (day, getTimes, covers, sorter) {\r\n if (getTimes === void 0) { getTimes = true; }\r\n if (covers === void 0) { covers = true; }\r\n if (sorter === void 0) { sorter = this.eventSorter; }\r\n var events = [];\r\n var entries = this.visible;\r\n var _loop_1 = function (entryIndex) {\r\n var entry = entries[entryIndex];\r\n var schedule = entry.schedule;\r\n var eventId = entryIndex * Constants.MAX_EVENTS_PER_DAY;\r\n var timeIndex = 0;\r\n schedule.iterateSpans(day, covers).iterate(function (span, iterator) {\r\n events.push(new CalendarEvent_CalendarEvent(eventId + timeIndex++, entry, span, day));\r\n if (!getTimes) {\r\n iterator.stop();\r\n }\r\n });\r\n };\r\n for (var entryIndex = 0; entryIndex < entries.length; entryIndex++) {\r\n _loop_1(entryIndex);\r\n }\r\n if (sorter) {\r\n events.sort(sorter);\r\n }\r\n return events;\r\n };\r\n /**\r\n * Finds the event given one of the ways to identify the event.\r\n *\r\n * @param input The value to use to search for an event.\r\n * @returns The refrence to the event or null if not found.\r\n */\r\n Calendar.prototype.findEvent = function (id) {\r\n for (var _i = 0, _a = this.events; _i < _a.length; _i++) {\r\n var event_4 = _a[_i];\r\n if (event_4 === id || event_4.schedule === id || event_4.data === id || event_4.id === id) {\r\n return event_4;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Removes the list of events if they exist in the calendar.\r\n *\r\n * @param events The array of events to remove if they exist. If no\r\n * events are passed (via `null`) then all events will be removed\r\n * from the calendar.\r\n * @param delayRefresh When `true` the [[Calendar.refreshEvents]] will not be\r\n * called after the events are removed.\r\n * @see [[Calendar.removeEvent]]\r\n * @see [[Calendar.refreshEvents]]\r\n */\r\n Calendar.prototype.removeEvents = function (events, delayRefresh) {\r\n if (events === void 0) { events = null; }\r\n if (delayRefresh === void 0) { delayRefresh = false; }\r\n if (events) {\r\n for (var _i = 0, events_1 = events; _i < events_1.length; _i++) {\r\n var event_5 = events_1[_i];\r\n this.removeEvent(event_5, true);\r\n }\r\n }\r\n else {\r\n this.events = [];\r\n }\r\n this.refreshVisible();\r\n if (!delayRefresh) {\r\n this.refreshEvents();\r\n }\r\n return this;\r\n };\r\n /**\r\n * Removes the given event if it exists on the calendar.\r\n *\r\n * @param event The event to remove if it exists.\r\n * @param delayRefresh When `true` the [[Calendar.refreshEvents]] will not be\r\n * called after the event is removed.\r\n * @see [[Calendar.refreshEvents]]\r\n */\r\n Calendar.prototype.removeEvent = function (event, delayRefresh) {\r\n if (delayRefresh === void 0) { delayRefresh = false; }\r\n var found = this.findEvent(event);\r\n if (found) {\r\n this.events.splice(this.events.indexOf(found), 1);\r\n this.refreshVisible();\r\n if (!delayRefresh) {\r\n this.refreshEvents();\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Adds the given event to this calendar if it doesn't exist already (or\r\n * `allowDuplicates` is `true`).\r\n *\r\n * @param event The event to add to the calendar.\r\n * @param allowDuplicates If an event can be added more than once.\r\n * @param delayRefresh When `true` the [[Calendar.refreshEvents]] will not be\r\n * called after the event is added.\r\n * @see [[Calendar.refreshEvents]]\r\n */\r\n Calendar.prototype.addEvent = function (event, allowDuplicates, delayRefresh) {\r\n if (allowDuplicates === void 0) { allowDuplicates = false; }\r\n if (delayRefresh === void 0) { delayRefresh = false; }\r\n var parsed = Parse_Parse.event(event, this.parseData, this.parseMeta);\r\n if (!allowDuplicates) {\r\n var existing = this.findEvent(parsed);\r\n if (existing) {\r\n return this;\r\n }\r\n }\r\n this.events.push(parsed);\r\n this.refreshVisible();\r\n if (!delayRefresh) {\r\n this.refreshEvents();\r\n }\r\n return this;\r\n };\r\n /**\r\n * Adds the given events to this calendar if they don't exist already (or\r\n * `allowDuplicates` is `true`).\r\n *\r\n * @param events The events to add to the calendar.\r\n * @param allowDuplicates If an event can be added more than once.\r\n * @param delayRefresh When `true` the [[Calendar.refreshEvents]] will not be\r\n * called after the events are added.\r\n * @see [[Calendar.refreshEvents]]\r\n */\r\n Calendar.prototype.addEvents = function (events, allowDuplicates, delayRefresh) {\r\n if (allowDuplicates === void 0) { allowDuplicates = false; }\r\n if (delayRefresh === void 0) { delayRefresh = false; }\r\n for (var _i = 0, events_2 = events; _i < events_2.length; _i++) {\r\n var event_6 = events_2[_i];\r\n this.addEvent(event_6, allowDuplicates, true);\r\n }\r\n if (!delayRefresh) {\r\n this.refreshEvents();\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets the selection point or range of the calendar and updates the flags\r\n * in the days.\r\n *\r\n * @param start The start of the selection.\r\n * @param end The end of the selection.\r\n * @see [[Calendar.refreshSelection]]\r\n */\r\n Calendar.prototype.select = function (start, end) {\r\n if (end === void 0) { end = start; }\r\n this.selection = new DaySpan_DaySpan(start, end);\r\n this.refreshSelection();\r\n return this;\r\n };\r\n /**\r\n * Sets the selection of the calendar to nothing.\r\n *\r\n * @see [[Calendar.refreshSelection]]\r\n */\r\n Calendar.prototype.unselect = function () {\r\n this.selection = null;\r\n this.refreshSelection();\r\n return this;\r\n };\r\n /**\r\n * Shifts the calendar days by the given amount.\r\n *\r\n * @param jump The amount to shift the calendar by.\r\n * @param delayRefresh When `true` [[Calendar.refresh]] will not be called\r\n * after calendar is moved.\r\n */\r\n Calendar.prototype.move = function (jump, delayRefresh) {\r\n if (jump === void 0) { jump = this.size; }\r\n if (delayRefresh === void 0) { delayRefresh = false; }\r\n this.span.start = this.moveStart(this.start, jump);\r\n this.span.end = this.moveEnd(this.end, jump);\r\n if (!delayRefresh) {\r\n this.refresh();\r\n }\r\n return this;\r\n };\r\n /**\r\n * Moves the calenndar to the next set of days.\r\n *\r\n * @param jump The amount to shift the calendar by.\r\n * @param delayRefresh When `true` [[Calendar.refresh]] will not be called\r\n * after calendar is moved.\r\n */\r\n Calendar.prototype.next = function (jump, delayRefresh) {\r\n if (jump === void 0) { jump = this.size; }\r\n if (delayRefresh === void 0) { delayRefresh = false; }\r\n return this.move(jump, delayRefresh);\r\n };\r\n /**\r\n * Moves the calenndar to the previous set of days.\r\n *\r\n * @param jump The amount to shift the calendar by.\r\n * @param delayRefresh When `true` [[Calendar.refresh]] will not be called\r\n * after calendar is moved.\r\n */\r\n Calendar.prototype.prev = function (jump, delayRefresh) {\r\n if (jump === void 0) { jump = this.size; }\r\n if (delayRefresh === void 0) { delayRefresh = false; }\r\n return this.move(-jump, delayRefresh);\r\n };\r\n /**\r\n * Converts this calendar to input which can be used to later recreate this\r\n * calendar. The only properties of the calendar which will be loss is the\r\n * [[Calendar.eventSorter]] property because it is a function.\r\n *\r\n * @param plain If the returned input should be plain objects as opposed\r\n * to [[Day]] and [[Event]] instances.\r\n * @param plainData A function to convert [[Event.data]] to a plain object if\r\n * it is not already.\r\n * @param plainMeta A function to convert values in [[Schedule.meta]] to plain\r\n * objects if they are not alreday.\r\n * @returns The input generated from this calendar.\r\n */\r\n Calendar.prototype.toInput = function (plain, plainData, plainMeta) {\r\n if (plain === void 0) { plain = false; }\r\n if (plainData === void 0) { plainData = function (d) { return d; }; }\r\n if (plainMeta === void 0) { plainMeta = function (m) { return m; }; }\r\n var out = {};\r\n out.type = this.type;\r\n out.size = this.size;\r\n out.fill = this.fill;\r\n out.minimumSize = this.minimumSize;\r\n out.repeatCovers = this.repeatCovers;\r\n out.listTimes = this.listTimes;\r\n out.eventsOutside = this.eventsOutside;\r\n out.updateRows = this.updateRows;\r\n out.updateColumns = this.updateColumns;\r\n out.around = plain ? this.span.start.dayIdentifier : this.span.start;\r\n out.events = [];\r\n for (var _i = 0, _a = this.events; _i < _a.length; _i++) {\r\n var event_7 = _a[_i];\r\n if (plain) {\r\n var plainEvent = {};\r\n if (Functions.isDefined(event_7.id)) {\r\n plainEvent.id = event_7.id;\r\n }\r\n if (Functions.isDefined(event_7.data)) {\r\n plainEvent.data = plainData(event_7.data);\r\n }\r\n if (!event_7.visible) {\r\n plainEvent.visible = event_7.visible;\r\n }\r\n plainEvent.schedule = event_7.schedule.toInput();\r\n var meta = plainEvent.schedule.meta;\r\n if (meta) {\r\n for (var identifier in meta) {\r\n meta[identifier] = plainMeta(meta[identifier]);\r\n }\r\n }\r\n out.events.push(plainEvent);\r\n }\r\n else {\r\n out.events.push(event_7);\r\n }\r\n }\r\n return out;\r\n };\r\n /**\r\n * Creates a calendar based on the given input.\r\n *\r\n * @param input The input which has at least the `type` specified.\r\n * @returns A new calendar instance.\r\n */\r\n Calendar.fromInput = function (input) {\r\n var initial = Day_Day.today();\r\n return new Calendar(initial, initial, null, 1, null, null, input);\r\n };\r\n /**\r\n * Creates a calendar based around a given unit optionally focused around a\r\n * given day.\r\n *\r\n * @param type The unit of the calendar.\r\n * @param days The number of units in the calendar.\r\n * @param around The day to focus the calendar on.\r\n * @param focus The value which describes how months are added around the given\r\n * day. The default value will center the calendar around the given day.\r\n * When the value is `0` the given day is the first day in the calendar,\r\n * and when the value is `1` the given day is the last day in the calendar.\r\n * @param input The default properties for the calendar.\r\n * @returns A new calendar instance.\r\n */\r\n Calendar.forType = function (type, size, around, focus, input) {\r\n if (size === void 0) { size = 1; }\r\n if (around === void 0) { around = Day_Day.today(); }\r\n if (focus === void 0) { focus = 0.49999; }\r\n var meta = this.TYPES[type];\r\n var start = meta.getStart(around, size, focus);\r\n var end = meta.getEnd(start, size, focus);\r\n return new Calendar(start, end, type, size, meta.moveStart, meta.moveEnd, input || meta.defaultInput);\r\n };\r\n /**\r\n * Creates a calendar based around days optionally focused around a given day.\r\n *\r\n * @param days The number of days in the calendar.\r\n * @param around The day to focus the calendar on.\r\n * @param focus The value which describes how days are added around the given\r\n * day. The default value will center the calendar around the given day.\r\n * When the value is `0` the given day is the first day in the calendar,\r\n * and when the value is `1` the given day is the last day in the calendar.\r\n * @param input The default properties for the calendar.\r\n * @returns A new calendar instance.\r\n * @see [[Calendar.forType]]\r\n */\r\n Calendar.days = function (days, around, focus, input) {\r\n if (days === void 0) { days = 1; }\r\n if (around === void 0) { around = Day_Day.today(); }\r\n if (focus === void 0) { focus = 0.4999; }\r\n return this.forType(Units.DAY, days, around, focus, input);\r\n };\r\n /**\r\n * Creates a calendar based around weeks optionally focused around a given day.\r\n *\r\n * @param days The number of weeks in the calendar.\r\n * @param around The day to focus the calendar on.\r\n * @param focus The value which describes how weeks are added around the given\r\n * day. The default value will center the calendar around the given day.\r\n * When the value is `0` the given day is the first day in the calendar,\r\n * and when the value is `1` the given day is the last day in the calendar.\r\n * @param input The default properties for the calendar.\r\n * @returns A new calendar instance.\r\n * @see [[Calendar.forType]]\r\n */\r\n Calendar.weeks = function (weeks, around, focus, input) {\r\n if (weeks === void 0) { weeks = 1; }\r\n if (around === void 0) { around = Day_Day.today(); }\r\n if (focus === void 0) { focus = 0.4999; }\r\n return this.forType(Units.WEEK, weeks, around, focus, input);\r\n };\r\n /**\r\n * Creates a calendar based around months optionally focused around a given day.\r\n *\r\n * @param days The number of months in the calendar.\r\n * @param around The day to focus the calendar on.\r\n * @param focus The value which describes how months are added around the given\r\n * day. The default value will center the calendar around the given day.\r\n * When the value is `0` the given day is the first day in the calendar,\r\n * and when the value is `1` the given day is the last day in the calendar.\r\n * @param input The default properties for the calendar.\r\n * @returns A new calendar instance.\r\n * @see [[Calendar.forType]]\r\n */\r\n Calendar.months = function (months, around, focus, input) {\r\n if (months === void 0) { months = 1; }\r\n if (around === void 0) { around = Day_Day.today(); }\r\n if (focus === void 0) { focus = 0.4999; }\r\n return this.forType(Units.MONTH, months, around, focus, input);\r\n };\r\n /**\r\n * Creates a calendar based around years optionally focused around a given day.\r\n *\r\n * @param days The number of years in the calendar.\r\n * @param around The day to focus the calendar on.\r\n * @param focus The value which describes how years are added around the given\r\n * day. The default value will center the calendar around the given day.\r\n * When the value is `0` the given day is the first day in the calendar,\r\n * and when the value is `1` the given day is the last day in the calendar.\r\n * @param input The default properties for the calendar.\r\n * @returns A new calendar instance.\r\n * @see [[Calendar.forType]]\r\n */\r\n Calendar.years = function (years, around, focus, input) {\r\n if (years === void 0) { years = 1; }\r\n if (around === void 0) { around = Day_Day.today(); }\r\n if (focus === void 0) { focus = 0.4999; }\r\n return this.forType(Units.YEAR, years, around, focus, input);\r\n };\r\n /**\r\n * A map of functions and properties by [[Units]] used to create or morph\r\n * Calendars.\r\n */\r\n Calendar.TYPES = (Calendar__a = {},\r\n Calendar__a[Units.DAY] = {\r\n getStart: function (around, size, focus) {\r\n return around.start().relativeDays(-Math.floor(size * focus));\r\n },\r\n getEnd: function (start, size, focus) {\r\n return start.relativeDays(size - 1).end();\r\n },\r\n moveStart: function (day, amount) {\r\n return day.relativeDays(amount);\r\n },\r\n moveEnd: function (day, amount) {\r\n return day.relativeDays(amount);\r\n },\r\n defaultInput: undefined\r\n },\r\n Calendar__a[Units.WEEK] = {\r\n getStart: function (around, size, focus) {\r\n return around.start().startOfWeek().relativeWeeks(-Math.floor(size * focus));\r\n },\r\n getEnd: function (start, size, focus) {\r\n return start.relativeWeeks(size - 1).endOfWeek();\r\n },\r\n moveStart: function (day, amount) {\r\n return day.relativeWeeks(amount);\r\n },\r\n moveEnd: function (day, amount) {\r\n return day.relativeWeeks(amount);\r\n },\r\n defaultInput: undefined\r\n },\r\n Calendar__a[Units.MONTH] = {\r\n getStart: function (around, size, focus) {\r\n return around.start().startOfMonth().relativeMonths(-Math.floor(size * focus));\r\n },\r\n getEnd: function (start, size, focus) {\r\n return start.relativeMonths(size - 1).endOfMonth();\r\n },\r\n moveStart: function (day, amount) {\r\n return day.relativeMonths(amount);\r\n },\r\n moveEnd: function (day, amount) {\r\n return day.startOfMonth().relativeMonths(amount).endOfMonth();\r\n },\r\n defaultInput: { fill: true }\r\n },\r\n Calendar__a[Units.YEAR] = {\r\n getStart: function (around, size, focus) {\r\n return around.start().startOfYear().relativeYears(-Math.floor(size * focus));\r\n },\r\n getEnd: function (start, size, focus) {\r\n return start.relativeYears(size - 1).endOfYear();\r\n },\r\n moveStart: function (day, amount) {\r\n return day.relativeYears(amount);\r\n },\r\n moveEnd: function (day, amount) {\r\n return day.relativeYears(amount);\r\n },\r\n defaultInput: { fill: true }\r\n },\r\n Calendar__a);\r\n return Calendar;\r\n}());\r\n\r\nvar Calendar__a;\r\n\n// CONCATENATED MODULE: ./src/Month.ts\n\r\n/**\r\n * The months in a year.\r\n */\r\nvar Month = (function () {\r\n function Month() {\r\n }\r\n Month.JANUARY = 0;\r\n Month.FEBRUARY = 1;\r\n Month.MARCH = 2;\r\n Month.APRIL = 3;\r\n Month.MAY = 4;\r\n Month.JUNE = 5;\r\n Month.JULY = 6;\r\n Month.AUGUST = 7;\r\n Month.SEPTEMBER = 8;\r\n Month.OCTOBER = 9;\r\n Month.NOVEMBER = 10;\r\n Month.DECEMBER = 11;\r\n /**\r\n * The full list of months in a year.\r\n */\r\n Month.LIST = [\r\n Month.JANUARY,\r\n Month.FEBRUARY,\r\n Month.MARCH,\r\n Month.APRIL,\r\n Month.MAY,\r\n Month.JUNE,\r\n Month.JULY,\r\n Month.AUGUST,\r\n Month.SEPTEMBER,\r\n Month.OCTOBER,\r\n Month.NOVEMBER,\r\n Month.DECEMBER\r\n ];\r\n return Month;\r\n}());\r\n\r\n\n// CONCATENATED MODULE: ./src/Weekday.ts\n\r\n/**\r\n * The days in a week.\r\n */\r\nvar Weekday = (function () {\r\n function Weekday() {\r\n }\r\n Weekday.SUNDAY = 0;\r\n Weekday.MONDAY = 1;\r\n Weekday.TUESDAY = 2;\r\n Weekday.WEDNESDAY = 3;\r\n Weekday.THURSDAY = 4;\r\n Weekday.FRIDAY = 5;\r\n Weekday.SATURDAY = 6;\r\n /**\r\n * The full list of days in a week.\r\n */\r\n Weekday.LIST = [\r\n Weekday.SUNDAY,\r\n Weekday.MONDAY,\r\n Weekday.TUESDAY,\r\n Weekday.WEDNESDAY,\r\n Weekday.THURSDAY,\r\n Weekday.FRIDAY,\r\n Weekday.SATURDAY\r\n ];\r\n /**\r\n * The list of days starting with Monday and ending on Friday.\r\n */\r\n Weekday.WEEK = [\r\n Weekday.MONDAY,\r\n Weekday.TUESDAY,\r\n Weekday.WEDNESDAY,\r\n Weekday.THURSDAY,\r\n Weekday.FRIDAY\r\n ];\r\n /**\r\n * The days on the weekend, starting with Saturday and ending with Sunday.\r\n */\r\n Weekday.ENDS = [\r\n Weekday.SATURDAY,\r\n Weekday.SUNDAY\r\n ];\r\n return Weekday;\r\n}());\r\n\r\n\n// CONCATENATED MODULE: ./src/Pattern.ts\n\r\n\r\n\r\n\r\n\r\n/**\r\n * A class which helps describe [[ScheduleInput]] if it matches a pattern.\r\n */\r\nvar Pattern_Pattern = (function () {\r\n /**\r\n * Creates a new pattern.\r\n *\r\n * @param name The unique name of the pattern.\r\n * @param listed If the pattern is \"listed\" [[Pattern.listed]].\r\n * @param describe A function to describe the pattern given a [[Day]].\r\n * @param rules The rules which describe how to detect and apply the pattern\r\n * to schedule input.\r\n */\r\n function Pattern(name, listed, describe, rules) {\r\n this.name = name;\r\n this.listed = listed;\r\n this.describe = describe;\r\n this.rules = rules;\r\n }\r\n /**\r\n * Applies this pattern to a [[Schedule]] or [[ScheduleInput]] removing and\r\n * adding any necessary properties from the input to match this pattern -\r\n * based around the day provided.\r\n *\r\n * @param schedule The schedule to update to match this pattern.\r\n * @param day The day to base the schedule on.\r\n * @returns The reference to the input passed in.\r\n */\r\n Pattern.prototype.apply = function (schedule, day) {\r\n if (schedule instanceof Schedule_Schedule) {\r\n this.applyGeneric(day, function (prop, frequency) { return schedule.setFrequency(prop, frequency); }, function (prop) { return schedule.setFrequency(prop); });\r\n schedule.updateChecks();\r\n }\r\n else {\r\n this.applyGeneric(day, function (prop, frequency) { return schedule[prop] = frequency; }, function (prop) { return delete schedule[prop]; });\r\n }\r\n return schedule;\r\n };\r\n /**\r\n * Applies this pattern to any object provided they implement the\r\n * `setFrequency` and `removeFrequency` functions.\r\n *\r\n * @param day The day to base the schedule on.\r\n * @param setFrequency The function which sets the frequency on the object.\r\n * @param removeFrequency The function to remove a frequency from the object.\r\n */\r\n Pattern.prototype.applyGeneric = function (day, setFrequency, removeFrequency) {\r\n for (var _i = 0, _a = Pattern.PROPS; _i < _a.length; _i++) {\r\n var prop = _a[_i];\r\n var rule = this.rules[prop];\r\n // Should have one value\r\n if (rule === 1) {\r\n setFrequency(prop, [day[prop]]);\r\n }\r\n // Can be any of the values in the array\r\n if (Functions.isArray(rule)) {\r\n setFrequency(prop, rule);\r\n }\r\n // Must not be present\r\n if (!Functions.isDefined(rule)) {\r\n removeFrequency(prop);\r\n }\r\n }\r\n };\r\n /**\r\n * Determines whether the given [[Schedule]] or [[ScheduleInput]] matches this\r\n * pattern. Optionally a day can be provided to make sure the day matches the\r\n * schedule and pattern together.\r\n *\r\n * @param schedule The schedule input to test.\r\n * @param exactlyWith A day to further validate against for matching.\r\n * @returns `true` if the schedule was a match to this pattern with the\r\n * day if one was provided, otherwise `false`.\r\n */\r\n Pattern.prototype.isMatch = function (schedule, exactlyWith) {\r\n if (schedule instanceof Schedule_Schedule) {\r\n return this.isMatchGeneric(function (prop) { return schedule[prop].input; }, exactlyWith);\r\n }\r\n else {\r\n return this.isMatchGeneric(function (prop) { return schedule[prop]; }, exactlyWith);\r\n }\r\n };\r\n /**\r\n * Determines whether the given input matches this pattern. Optionally a day\r\n * can be provided to make sure the day matches the schedule and pattern\r\n * together.\r\n *\r\n * @param input The schedule input to test.\r\n * @param exactlyWith A day to further validate against for matching.\r\n * @returns `true` if the schedule input was a match to this pattern with the\r\n * day if one was provided, otherwise `false`.\r\n */\r\n Pattern.prototype.isMatchGeneric = function (getFrequency, exactlyWith) {\r\n var exactly = Functions.isDefined(exactlyWith);\r\n for (var _i = 0, _a = Pattern.PROPS; _i < _a.length; _i++) {\r\n var prop = _a[_i];\r\n var rule = this.rules[prop];\r\n var curr = getFrequency(prop);\r\n // Optional, skip it\r\n if (rule === false) {\r\n continue;\r\n }\r\n // Requires any value\r\n if (rule === true && !curr) {\r\n return false;\r\n }\r\n // Must not be present\r\n if (!Functions.isDefined(rule) && curr) {\r\n return false;\r\n }\r\n // Must be an array of the same size\r\n if (Functions.isNumber(rule)) {\r\n if (Functions.isArray(curr) && curr.length === rule) {\r\n if (exactly && curr.indexOf(exactlyWith[prop]) === -1) {\r\n return false;\r\n }\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n // Must be an array of the same values\r\n if (Functions.isArray(rule)) {\r\n if (!Functions.isArray(curr)) {\r\n return false;\r\n }\r\n if (rule.length !== curr.length) {\r\n return false;\r\n }\r\n for (var i = 0; i < rule.length; i++) {\r\n if (rule[i] !== curr[i]) {\r\n return false;\r\n }\r\n }\r\n if (exactly && rule.indexOf(exactlyWith[prop]) === -1) {\r\n return false;\r\n }\r\n }\r\n // Must be an object with same over & offset.\r\n if (Functions.isObject(rule)) {\r\n if (!Functions.isObject(curr)) {\r\n return false;\r\n }\r\n var ruleOffset = rule.offset || 0;\r\n var currOffset = curr.offset || 0;\r\n if (currOffset !== ruleOffset || curr.every !== rule.every) {\r\n return false;\r\n }\r\n if (exactly && (exactlyWith[prop] % rule.every) !== ruleOffset) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Returns the pattern with the given name if one exists. If you add your own\r\n * patterns make sure to add them to [[PatternMap]].\r\n *\r\n * @param name The name of the pattern to return.\r\n * @return The instance to the pattern with the same name.\r\n */\r\n Pattern.withName = function (name) {\r\n return PatternMap[name];\r\n };\r\n /**\r\n * Finds a matching pattern to the given input searching through [[Patterns]]\r\n * for matches. Optionally it will only look at patterns where listed = `true`.\r\n *\r\n * @param input The schedule input to use.\r\n * @param listedOnly When `true` only patterns with [[Pattern.listed]] set to\r\n * `true` will be looked at, otherwise all patterns are looked at.\r\n * @param exactlyWith A day to further validate against for matching.\r\n * @see [[Pattern.isMatch]]\r\n */\r\n Pattern.findMatch = function (input, listedOnly, exactlyWith) {\r\n if (listedOnly === void 0) { listedOnly = true; }\r\n for (var _i = 0, Patterns_1 = Patterns; _i < Patterns_1.length; _i++) {\r\n var pattern = Patterns_1[_i];\r\n if ((pattern.listed || !listedOnly) && pattern.isMatch(input, exactlyWith)) {\r\n return pattern;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * The properties in the [[ScheduleInput]] which are compared against the\r\n * rules of a pattern.\r\n */\r\n Pattern.PROPS = [\r\n 'dayOfWeek', 'dayOfMonth', 'lastDayOfMonth', 'dayOfYear',\r\n 'month', 'week', 'year',\r\n 'weekOfYear', 'weekspanOfYear', 'fullWeekOfYear', 'lastWeekspanOfYear', 'lastFullWeekOfYear',\r\n 'weekOfMonth', 'weekspanOfMonth', 'fullWeekOfMonth', 'lastWeekspanOfMonth', 'lastFullWeekOfMonth'\r\n ];\r\n return Pattern;\r\n}());\r\n\r\n/**\r\n * The list of patterns that can be searched through for matches to schedule\r\n * input.\r\n *\r\n * @see [[Pattern.findMatch]]\r\n */\r\nvar Patterns = [\r\n new Pattern_Pattern('none', true, function (day) { return 'Does not repeat'; }, {\r\n year: 1,\r\n month: 1,\r\n dayOfMonth: 1\r\n }),\r\n new Pattern_Pattern('daily', true, function (day) { return 'Daily'; }, {}),\r\n new Pattern_Pattern('weekly', true, function (day) { return 'Weekly on ' + day.format('dddd'); }, {\r\n dayOfWeek: 1\r\n }),\r\n new Pattern_Pattern('monthlyWeek', true, function (day) { return 'Monthly on the ' + Suffix.CACHE[day.weekspanOfMonth + 1] + ' ' + day.format('dddd'); }, {\r\n dayOfWeek: 1,\r\n weekspanOfMonth: 1\r\n }),\r\n new Pattern_Pattern('annually', true, function (day) { return 'Annually on ' + day.format('MMMM Do'); }, {\r\n month: 1,\r\n dayOfMonth: 1\r\n }),\r\n new Pattern_Pattern('annuallyMonthWeek', true, function (day) { return 'Annually on the ' + Suffix.CACHE[day.weekspanOfMonth + 1] + ' ' + day.format('dddd') + ' of ' + day.format('MMMM'); }, {\r\n month: 1,\r\n dayOfWeek: 1,\r\n weekspanOfMonth: 1\r\n }),\r\n new Pattern_Pattern('weekday', true, function (day) { return 'Every weekday (Monday to Friday)'; }, {\r\n dayOfWeek: [Weekday.MONDAY, Weekday.TUESDAY, Weekday.WEDNESDAY, Weekday.THURSDAY, Weekday.FRIDAY]\r\n }),\r\n new Pattern_Pattern('monthly', true, function (day) { return 'Monthly on the ' + day.format('Do') + ' day'; }, {\r\n dayOfMonth: 1\r\n }),\r\n new Pattern_Pattern('custom', true, function (day) { return 'Custom...'; }, {\r\n dayOfWeek: false,\r\n dayOfMonth: false,\r\n lastDayOfMonth: false,\r\n dayOfYear: false,\r\n year: false,\r\n month: false,\r\n week: false,\r\n weekOfYear: false,\r\n weekspanOfYear: false,\r\n fullWeekOfYear: false,\r\n lastWeekspanOfYear: false,\r\n lastFullWeekOfYear: false,\r\n weekOfMonth: false,\r\n weekspanOfMonth: false,\r\n fullWeekOfMonth: false,\r\n lastWeekspanOfMonth: false,\r\n lastFullWeekOfMonth: false\r\n })\r\n];\r\n/**\r\n * The map of patterns keyed by their name.\r\n *\r\n * @see [[Pattern.withName]]\r\n */\r\nvar PatternMap = {};\r\nfor (var Pattern__i = 0, Patterns_2 = Patterns; Pattern__i < Patterns_2.length; Pattern__i++) {\r\n var Pattern_pattern = Patterns_2[Pattern__i];\r\n PatternMap[Pattern_pattern.name] = Pattern_pattern;\r\n}\r\n\n// CONCATENATED MODULE: ./src/Sort.ts\n\r\n/**\r\n * A class with [[SortEvent]] functions and functions which accept other\r\n * [[SortEvent]]s and return a new [[SortEvent]].\r\n *\r\n * ```typescript\r\n * // Sorts full day events first, then events in descending order based on start time.\r\n * Sorts.List([Sorts.FullDay, Sorts.Desc(Sorts.Start)]);\r\n * ```\r\n */\r\nvar Sorts = (function () {\r\n function Sorts() {\r\n }\r\n /**\r\n * Sorts the two events by their start time - the earliest event being first\r\n * in order.\r\n *\r\n * @param a The first event.\r\n * @param b The second event.\r\n * @returns The difference in time between the start of `a` and `b`.\r\n * @see [[CalendarEvent.time]]\r\n */\r\n Sorts.Start = function (a, b) {\r\n return a.time.start.time - b.time.start.time;\r\n };\r\n /**\r\n * Sorts the two events by their end time - the earliest to end being first\r\n * in order.\r\n *\r\n * @param a The first event.\r\n * @param b The second event.\r\n * @returns The difference in time between the end of `a` and `b`.\r\n * @see [[CalendarEvent.time]]\r\n */\r\n Sorts.End = function (a, b) {\r\n return a.time.end.time - b.time.end.time;\r\n };\r\n /**\r\n * Sorts the two events placing the full day events before the timed events.\r\n *\r\n * @param a The first event.\r\n * @param b The second event.\r\n * @returns If both are timed or both are full day then `0` is returned,\r\n * otherwise `-1` is returned if `a` is full day and `1` is returned if\r\n * `b` is full day.\r\n * @see [[CalendarEvent.fullDay]]\r\n */\r\n Sorts.FullDay = function (a, b) {\r\n var af = a.fullDay ? 0 : 1;\r\n var bf = b.fullDay ? 0 : 1;\r\n return af - bf;\r\n };\r\n /**\r\n * Sorts the two events placing the shorter events before the longer events.\r\n * Full day or multiple day events actually take up a day and will be ordered\r\n * last.\r\n *\r\n * @param a The first event.\r\n * @param b The second event.\r\n * @returns The difference in milliseconds between `a` and `b`.\r\n * @see [[CalendarEvent.time]]\r\n * @see [[DaySpan.millis]]\r\n */\r\n Sorts.Duration = function (a, b) {\r\n return a.time.millis() - b.time.millis();\r\n };\r\n /**\r\n * Returns a [[SortEvent]] that effectively orders the given sorter in the\r\n * opposite (often descending) order.\r\n *\r\n * @param sorter The sorter to reverse.\r\n * @returns A new sorter which reverses the one passed in.\r\n */\r\n Sorts.Desc = function (sorter) {\r\n return function (a, b) {\r\n return sorter(b, a);\r\n };\r\n };\r\n /**\r\n * Returns a [[SortEvent]] that orders the events based on a string in each\r\n * event. A function must be supplied which takes an event of type `T` and\r\n * returns a string.\r\n *\r\n * @param getString A function which returns a string from the event.\r\n * @returns A sorter which sorts strings alphabetically.\r\n */\r\n Sorts.Alphabetical = function (getString) {\r\n return function (a, b) {\r\n var as = getString(a.event) || '';\r\n var bs = getString(b.event) || '';\r\n return as.localeCompare(bs);\r\n };\r\n };\r\n /**\r\n * Returns a [[SortEvent]] that orders events based on a number in each event.\r\n * A function must be supplied which takes an event of type `T` and returns\r\n * a number.\r\n *\r\n * @param getOrder A function which returns a number from the event.\r\n * @returns A sorter which sorts events based on a number in ascending order.\r\n */\r\n Sorts.Ordered = function (getOrder) {\r\n return function (a, b) {\r\n var ao = getOrder(a.event);\r\n var bo = getOrder(b.event);\r\n return ao - bo;\r\n };\r\n };\r\n /**\r\n * Returns a [[SortEvent]] that orders events based on an array of sorters.\r\n * The first sorter which returns a non-zero result is used.\r\n *\r\n * @param sorters A list of sorting functions to test one at a time.\r\n * @returns A sorter which sorts based on a list of sorters.\r\n */\r\n Sorts.List = function (sorters) {\r\n return function (a, b) {\r\n for (var _i = 0, sorters_1 = sorters; _i < sorters_1.length; _i++) {\r\n var sorter = sorters_1[_i];\r\n var compare = sorter(a, b);\r\n if (compare !== 0) {\r\n return compare;\r\n }\r\n }\r\n return 0;\r\n };\r\n };\r\n return Sorts;\r\n}());\r\n\r\n\n// CONCATENATED MODULE: ./src/index.ts\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Calendar\", function() { return Calendar_Calendar; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"CalendarDay\", function() { return CalendarDay_CalendarDay; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"CalendarEvent\", function() { return CalendarEvent_CalendarEvent; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Event\", function() { return Event; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Constants\", function() { return Constants; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Day\", function() { return Day_Day; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"DaySpan\", function() { return DaySpan_DaySpan; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Functions\", function() { return Functions; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Identifier\", function() { return Identifier_Identifier; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"IteratorAction\", function() { return IteratorAction; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Iterator\", function() { return Iterator_Iterator; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Month\", function() { return Month; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Op\", function() { return Op; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"operate\", function() { return operate; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Parse\", function() { return Parse_Parse; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Pattern\", function() { return Pattern_Pattern; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Patterns\", function() { return Patterns; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"PatternMap\", function() { return PatternMap; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Schedule\", function() { return Schedule_Schedule; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"ScheduleModifier\", function() { return ScheduleModifier_ScheduleModifier; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Sorts\", function() { return Sorts; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Suffix\", function() { return Suffix; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Time\", function() { return Time_Time; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Units\", function() { return Units; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Weekday\", function() { return Weekday; });\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ })\n/******/ ]);\n});\n\n\n// WEBPACK FOOTER //\n// dayspan.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap c5a06ab01e1bacc5f64e","module.exports = __WEBPACK_EXTERNAL_MODULE_0__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external {\"commonjs\":\"moment\",\"commonjs2\":\"moment\",\"amd\":\"moment\",\"root\":\"moment\"}\n// module id = 0\n// module chunks = 0","\n/**\n * An operation that can be performed on a single number.\n */\nexport enum Op\n{\n /**\n * The number is returned unmodified.\n */\n NONE,\n\n /**\n * The number is rounded down to the nearest whole number.\n */\n FLOOR,\n\n /**\n * The number is rounded up to the nearest whole number.\n */\n CEIL,\n\n /**\n * The number is rounded up or down depending on if the fractional value is\n * greater than or less than 0.5 respectively.\n */\n ROUND,\n\n /**\n * The fractional part of the number is dropped.\n */\n TRUNCATE,\n\n /**\n * The number is rounded up when positive and down when negative. This is\n * effectively ceiling the absolute value where the result preserves the sign.\n */\n UP,\n\n /**\n * The number is rounded down when positive and up when negative. This is\n * effectively floor the absolute value where the result preserves the sign.\n */\n DOWN\n}\n\n\n/**\n * Performs the requested operation on the given number, optionally taking\n * the absolute value of the number before the operation.\n *\n * @param value The number to operate on.\n * @param op The operation to perform.\n * @param absolute If the number should be positive before the operation.\n * @return The operated result, or the original value if its not a valid number.\n */\nexport function operate(value: number, op: Op, absolute: boolean = false)\n{\n if (isFinite(value))\n {\n if (absolute)\n {\n value = Math.abs( value );\n }\n\n switch (op)\n {\n case Op.NONE:\n return value;\n case Op.FLOOR:\n return Math.floor( value );\n case Op.CEIL:\n return Math.ceil( value );\n case Op.ROUND:\n return Math.round( value );\n case Op.TRUNCATE:\n case Op.DOWN:\n return value < 0 ? Math.ceil( value ) : Math.floor( value );\n case Op.UP:\n return value < 0 ? Math.floor( value ) : Math.ceil( value );\n }\n }\n\n return value;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Operation.ts","\n\n/**\n * The class which contains commonly used functions by the library. These\n * functions and variables exist in a class so they may be overridden if\n * desired.\n */\nexport class Functions\n{\n\n /**\n * Determines whether the given input is an array.\n *\n * @param input The variable to test.\n * @returns `true` if the variable is an array, otherwise `false`.\n */\n public static isArray(input: any): boolean\n {\n return input instanceof Array;\n }\n\n /**\n * Determines whether the two arrays given are stricly equivalent. If the\n * arrays are not the same length or contain the same values in the same order\n * then `false` is returned.\n *\n * @param x The first array to test.\n * @param y The second array to test.\n * @returns `true` if they have the same exact values, otherwise `false`.\n */\n public static isArrayEquals(x: any[], y: any[]): boolean\n {\n if (x === y) return true;\n if (x.length !== y.length) return false;\n\n for (let i = 0; i < x.length; i++)\n {\n if (x[ i ] !== y[ i ])\n {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Determines whether the given input is a string.\n *\n * @param input The variable to test.\n * @returns `true` if the variable is a string, otherwise `false`.\n */\n public static isString(input: any): boolean\n {\n return typeof(input) === 'string';\n }\n\n /**\n * Determines whether the given input is a finite number (a number which is\n * not infinite or not the result of a divide-by-zero operation).\n *\n * @param input The variable to test.\n * @returns `true` if the variable is a finite number, otherwise `false`.\n */\n public static isNumber(input: any): boolean\n {\n return isFinite(input);\n }\n\n /**\n * Determines whether the given input is an object and NOT an array.\n *\n * @param input The variable to test.\n * @returns `true` if the variable is a plain object, otherwise `false`.\n */\n public static isObject(input: any): boolean\n {\n return !this.isArray(input) && typeof(input) === 'object';\n }\n\n /**\n * Determines whether the given input is defined.\n *\n * @param input The variable to test.\n * @return `true` if the variable is defined, otherwise `false`.\n */\n public static isDefined(input: any): boolean\n {\n return typeof(input) !== 'undefined';\n }\n\n /**\n * Determines whether the given input is defined and not null.\n *\n * @param input The variable to test.\n * @return `true` if the variable is defined and not null, otherwise `false`.\n */\n public static isValue(input: any): boolean\n {\n return input !== null && typeof(input) !== 'undefined';\n }\n\n /**\n * Determines whether the given input appears to be a valid\n * [[FrequencyValueEvery]].\n *\n * ```typescript\n * Functions.isFrequencyValueEvery({}); // false\n * Functions.isFrequencyValueEvery([]); // false\n * Functions.isFrequencyValueEvery([1]); // false\n * Functions.isFrequencyValueEvery(null); // false\n * Functions.isFrequencyValueEvery({every:2}); // true\n * Functions.isFrequencyValueEvery({offset:1}); // false\n * Functions.isFrequencyValueEvery({every:2, offset:1}); // true\n * ```\n *\n * @param input The variable to test.\n * @returns `true` if the variable appears to be a [[FrequencyValueEvery]],\n * otherwise false.\n */\n public static isFrequencyValueEvery(input: any): boolean\n {\n return this.isObject( input ) && this.isNumber( input.every );\n }\n\n /**\n * Determines whether the given input appears to be a valid\n * [[FrequencyValueOneOf]].\n *\n * ```typescript\n * Functions.isFrequencyValueOneOf({}); // false\n * Functions.isFrequencyValueOneOf([]); // false\n * Functions.isFrequencyValueOneOf([1]); // true\n * Functions.isFrequencyValueOneOf(null); // false\n * ```\n *\n * @param input The variable to test.\n * @returns `true` if the variable appears to be a [[FrequencyValueOneOf]],\n * otherwise false.\n */\n public static isFrequencyValueOneOf(input: any): boolean\n {\n return this.isArray( input ) && input.length > 0;\n }\n\n /**\n * Returns the first argument which is defined.\n *\n * ```typescript\n * Functions.coalesce(3, 4); // 3\n * Functions.coalesce(undefined, 4); // 4\n * Functions.coalesce(null, 4); // null\n * Functions.coalesce(void 0, void 0, 5); // 5\n * ```\n *\n * @param a The first argument to look at.\n * @param b The second argument to look at.\n * @returns The first defined argument.\n * @see [[Functions.isDefined]]\n */\n public static coalesce(a: any, b: any, c?: any): any\n {\n return this.isDefined( a ) ? a : (this.isDefined( b ) ? b : c);\n }\n\n /**\n * Copies values from `from` object and sets them to the `target` object.\n *\n * @param target The object to set values to.\n * @param from The object to copy value references from.\n * @returns The reference to `target`.\n */\n public static extend(target: any, from: any): any\n {\n for (let prop in from)\n {\n target[ prop ] = from[ prop ];\n }\n\n return target;\n }\n\n /**\n * Pads the string `x` up to `length` characters with the given `padding`\n * optionally placing the `padding` `before` `x`.\n *\n * ```typescript\n * Functions.pad('hey', 5, '_', false); // 'hey__'\n * Functions.pad('hey', 5, '_', true); // '__hey'\n * Functions.pad('heyman', 5, '_', true); // 'heyman'\n * ```\n *\n * @param x The string to pad.\n * @param length The length to pad to.\n * @param padding The string to pad with.\n * @param before If the padding should go before the string to pad.\n * @returns The padded string if any padding needed be added.\n */\n public static pad(x: string, length: number, padding: string, before: boolean): string\n {\n while (x.length < length)\n {\n before ? x = padding + x : x = x + padding;\n }\n\n return x;\n }\n\n /**\n * Pads the number `x` up to `length` digits where the padding is `0` and it\n * goes before `x`. This function will only return the first `length`\n * characters of the padding string representation of the number but can return\n * an alternative number of `first` characters.\n *\n * ```typescript\n * Functions.padNumber(29, 3); // '029'\n * Functions.padNumber(29, 3, 2); // '02'\n * Functions.padNumber(9573, 3); // '957'\n * ```\n *\n * @param x The number to pad with zeros in the beginning.\n * @param length The number of digits the number should be padded to.\n * @param first The number of digits to return from the start of the string.\n * @returns A padded number.\n */\n public static padNumber(x: number, length: number, first: number = length)\n {\n return this.pad(x + '', length, '0', true).substring( 0, first );\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Functions.ts","\n\n/**\n * Units of time that are compromised of 1 or more days for the [[Calendar]] class.\n */\nexport enum Units\n{\n DAY,\n WEEK,\n MONTH,\n YEAR\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Units.ts","\n\n/**\n * A class that stores commonly used values.\n */\nexport class Constants\n{\n\n /**\n * The number of milliseconds in a second.\n */\n public static MILLIS_IN_SECOND: number = 1000;\n\n /**\n * The number of milliseconds in a minute.\n */\n public static MILLIS_IN_MINUTE: number = Constants.MILLIS_IN_SECOND * 60;\n\n /**\n * The number of milliseconds in an hour.\n */\n public static MILLIS_IN_HOUR: number = Constants.MILLIS_IN_MINUTE * 60;\n\n /**\n * The number of milliseconds in a day (not including DST days).\n */\n public static MILLIS_IN_DAY: number = Constants.MILLIS_IN_HOUR * 24;\n\n /**\n * The number of milliseconds in a week (not including ones that include DST).\n */\n public static MILLIS_IN_WEEK: number = Constants.MILLIS_IN_DAY * 7;\n\n\n /**\n * The number of days in a week.\n */\n public static DAYS_IN_WEEK: number = 7;\n\n\n /**\n * The number of months in a year.\n */\n public static MONTHS_IN_YEAR: number = 12;\n\n /**\n * The number of hours in a day (not including DST days).\n */\n public static HOURS_IN_DAY: number = 24;\n\n\n /**\n * The first month of the year.\n */\n public static MONTH_MIN: number = 0;\n\n /**\n * The last month of the year.\n */\n public static MONTH_MAX: number = 11;\n\n /**\n * The first day of a month.\n */\n public static DAY_MIN: number = 1;\n\n /**\n * The last day of the longest month.\n */\n public static DAY_MAX: number = 31;\n\n /**\n * The first hour of the day.\n */\n public static HOUR_MIN: number = 0;\n\n /**\n * The last hour of the day.\n */\n public static HOUR_MAX: number = 23;\n\n /**\n * The first minute of the hour.\n */\n public static MINUTE_MIN: number = 0;\n\n /**\n * The last minute of the hour.\n */\n public static MINUTE_MAX: number = 59;\n\n /**\n * The first second of the minute.\n */\n public static SECOND_MIN: number = 0;\n\n /**\n * The last second of the minute.\n */\n public static SECOND_MAX: number = 59;\n\n /**\n * The first millisecond of the second.\n */\n public static MILLIS_MIN: number = 0;\n\n /**\n * The last millisecond of the second.\n */\n public static MILLIS_MAX: number = 999;\n\n /**\n * The first day of the week.\n */\n public static WEEKDAY_MIN: number = 0;\n\n /**\n * The last day of the week.\n */\n public static WEEKDAY_MAX: number = 6;\n\n\n /**\n * The default duration for an event.\n */\n public static DURATION_DEFAULT: number = 1;\n\n /**\n * The default duration unit for an all day event.\n */\n public static DURATION_DEFAULT_UNIT_ALL: string = 'days';\n\n /**\n * The default duration unit for an event at a given time.\n */\n public static DURATION_DEFAULT_UNIT_TIMES: string = 'hours';\n\n /**\n * Computes the duration unit given its for an all day event.\n *\n * @param all If the event is all day.\n * @return The default unit for the event.\n */\n public static DURATION_DEFAULT_UNIT: (all: boolean) => string =\n all => all ? Constants.DURATION_DEFAULT_UNIT_ALL :\n Constants.DURATION_DEFAULT_UNIT_TIMES;\n\n /**\n * The number of milliseconds for various duration units. These are worse case\n * scenario and do not include DST changes.\n */\n public static DURATION_TO_MILLIS = {\n minute: Constants.MILLIS_IN_MINUTE,\n minutes: Constants.MILLIS_IN_MINUTE,\n hour: Constants.MILLIS_IN_HOUR,\n hours: Constants.MILLIS_IN_HOUR,\n day: Constants.MILLIS_IN_DAY,\n days: Constants.MILLIS_IN_DAY,\n week: Constants.MILLIS_IN_WEEK,\n weeks: Constants.MILLIS_IN_WEEK,\n month: Constants.MILLIS_IN_DAY * Constants.DAY_MAX,\n months: Constants.MILLIS_IN_DAY * Constants.DAY_MAX\n };\n\n /**\n * The maximum estimated number of events per day. This is used to calculate\n * [[CalendarEvent.id]] to give each event a unique ID. If you think you will\n * have more events than this per day, you can enlarge the value.\n */\n public static MAX_EVENTS_PER_DAY: number = 24;\n\n /**\n * The day of the week which determines the first week of the year or month.\n * By default this day is Thursday.\n */\n public static WEEK_OF_MONTH_MINIMUM_WEEKDAY: number = 4;\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Constants.ts","\nimport { Day } from './Day';\nimport { Op } from './Operation';\nimport { Units } from './Units';\nimport { Constants } from './Constants';\n\n\n\n/**\n * The calculated bounds of a DaySpan relative to a given day.\n */\nexport interface DaySpanBounds\n{\n\n /**\n * The top of the span within the rectangle of the given day.\n */\n top: number;\n\n /**\n * The bottom of the span within the rectangle of the givne day.\n */\n bottom: number;\n\n /**\n * The height of the span within the rectangle of the given day. This is\n * equivalent by `bottom - top`.\n */\n height: number;\n\n /**\n * The left of the span within the rectangle of the given day.\n */\n left: number;\n\n /**\n * The right of the span within the rectangle of the given day.\n */\n right: number;\n\n /**\n * The width of the span within the rectangle of the given day. This is\n * equivalent by `right - left`.\n */\n width: number;\n}\n\n/**\n * A class for a range of time between two [[Day]] timestamps.\n */\nexport class DaySpan\n{\n\n\n /**\n * The starting timestamp of the span (inclusive).\n */\n public start: Day;\n\n /**\n * The endind timestamp of the span (inclusive).\n */\n public end: Day;\n\n\n /**\n * Creates a new span of time.\n *\n * @param start The starting timestamp.\n * @param end The ending timestamp.\n */\n public constructor(start: Day, end: Day)\n {\n this.start = start;\n this.end = end;\n }\n\n /**\n * Whether this span starts and ends on the same timestamp.\n */\n public get isPoint(): boolean\n {\n return this.start.time === this.end.time;\n }\n\n /**\n * Determines whether the given timestamp lies between the start and end\n * timestamp.\n *\n * @param day The timestamp to test.\n * @returns True if the day is >= the start and <= the end of this span.\n */\n public contains(day: Day): boolean\n {\n return day.time >= this.start.time && day.time <= this.end.time;\n }\n\n /**\n * Compares the given timestamp to this span. If the timestamp is before this\n * span then `-1` is returned, if the timestamp is after this span then `1`\n * us returned, otherwise `0` is returned when the timestamp is in this span.\n *\n * @param day The timestamp to compare to.\n * @returns `-1`, `0`, or `1` depending on the given timestamp relative to\n * this span.\n */\n public compareTo(day: Day): number\n {\n return day.time < this.start.time ? -1 : (day.time > this.end.time ? 1 : 0);\n }\n\n /**\n * Determines whether the given timestamp is between the start and end\n * timestamp or lies on the same day as the start or end timestamp.\n *\n * @param day The timestamp to test.\n * @see [[Day.sameDay]]\n */\n public matchesDay(day: Day): boolean\n {\n return this.contains( day ) || day.sameDay( this.start ) || day.sameDay( this.end );\n }\n\n /**\n * Determines whether the given timestamp is between the start and end\n * timestamp or lies on the same week as the start or end timestamp.\n *\n * @param day The timestamp to test.\n * @see [[Day.sameWeek]]\n */\n public matchesWeek(day: Day): boolean\n {\n return this.contains( day ) || day.sameWeek( this.start ) || day.sameWeek( this.end );\n }\n\n /**\n * Determines whether the given timestamp is between the start and end\n * timestamp or lies on the same month as the start or end timestamp.\n *\n * @param day The timestamp to test.\n * @see [[Day.sameMonth]]\n */\n public matchesMonth(day: Day): boolean\n {\n return this.contains( day ) || day.sameMonth( this.start ) || day.sameMonth( this.end );\n }\n\n /**\n * Determines whether the given timestamp is between the start and end\n * timestamp or lies on the same year as the start or end timestamp.\n *\n * @param day The timestamp to test.\n * @see [[Day.sameYear]]\n */\n public matchesYear(day: Day): boolean\n {\n return this.contains( day ) || day.sameYear( this.start ) || day.sameYear( this.end );\n }\n\n\n /**\n * Calculates the number of milliseconds between the start and end timestamp.\n *\n * @param op The operation to perform on the result.\n * @param absolute Whether the result should always be positive.\n * @returns The time between the start and end timestamp.\n * @see [[Day.millisBetween]]\n */\n public millis(op: Op = Op.DOWN, absolute: boolean = true): number\n {\n return this.start.millisBetween(this.end, op, absolute);\n }\n\n /**\n * Calculates the number of seconds between the start and end timestamp.\n *\n * @param op The operation to perform on the result.\n * @param absolute Whether the result should always be positive.\n * @returns The time between the start and end timestamp.\n * @see [[Day.secondsBetween]]\n */\n public seconds(op: Op = Op.DOWN, absolute: boolean = true): number\n {\n return this.start.secondsBetween(this.end, op, absolute);\n }\n\n /**\n * Calculates the number of minutes between the start and end timestamp.\n *\n * @param op The operation to perform on the result.\n * @param absolute Whether the result should always be positive.\n * @returns The time between the start and end timestamp.\n * @see [[Day.minutesBetween]]\n */\n public minutes(op: Op = Op.DOWN, absolute: boolean = true): number\n {\n return this.start.minutesBetween(this.end, op, absolute);\n }\n\n /**\n * Calculates the number of hours between the start and end timestamp.\n *\n * @param op The operation to perform on the result.\n * @param absolute Whether the result should always be positive.\n * @returns The time between the start and end timestamp.\n * @see [[Day.hoursBetween]]\n */\n public hours(op: Op = Op.DOWN, absolute: boolean = true): number\n {\n return this.start.hoursBetween(this.end, op, absolute);\n }\n\n /**\n * Calculates the number of days between the start and end timestamp.\n *\n * @param op The operation to perform on the result.\n * @param absolute Whether the result should always be positive.\n * @returns The time between the start and end timestamp.\n * @see [[Day.daysBetween]]\n */\n public days(op: Op = Op.DOWN, absolute: boolean = true): number\n {\n return this.start.daysBetween(this.end, op, absolute);\n }\n\n /**\n * Calculates the number of weeks between the start and end timestamp.\n *\n * @param op The operation to perform on the result.\n * @param absolute Whether the result should always be positive.\n * @returns The time between the start and end timestamp.\n * @see [[Day.weeksBetween]]\n */\n public weeks(op: Op = Op.DOWN, absolute: boolean = true): number\n {\n return this.start.weeksBetween(this.end, op, absolute);\n }\n\n /**\n * Calculates the number of months between the start and end timestamp.\n *\n * @param op The operation to perform on the result.\n * @param absolute Whether the result should always be positive.\n * @returns The time between the start and end timestamp.\n * @see [[Day.monthsBetween]]\n */\n public months(op: Op = Op.DOWN, absolute: boolean = true): number\n {\n return this.start.monthsBetween(this.end, op, absolute);\n }\n\n /**\n * Calculates the number of years between the start and end timestamp.\n *\n * @param op The operation to perform on the result.\n * @param absolute Whether the result should always be positive.\n * @returns The time between the start and end timestamp.\n * @see [[Day.yearsBetween]]\n */\n public years(op: Op = Op.DOWN, absolute: boolean = true): number\n {\n return this.start.yearsBetween(this.end, op, absolute);\n }\n\n /**\n * Returns a delta value between 0 and 1 which represents where the\n * [[DaySpan.start]] is relative to the given day. The delta value would\n * be less than 0 if the start of the event is before the given day.\n *\n * @param relativeTo The day to find the start delta relative to.\n * @return A number between 0 and 1 if the start of this span is in the\n * 24-hour period starting at the given timestamp, otherwise the value\n * returned may be less than 0 or greater than 1.\n */\n public startDelta(relativeTo: Day): number\n {\n return (this.start.time - relativeTo.time) / Constants.MILLIS_IN_DAY;\n }\n\n /**\n * Returns a delta value between 0 and 1 which represents where the\n * [[DaySpan.end]] is relative to the given day. The delta value would\n * be greater than 1 if the end of the event is after the given day.\n *\n * @param relativeTo The day to find the end delta relative to.\n * @return A number between 0 and 1 if the end of this span is in the\n * 24-hour period starting at the given timestamp, otherwise the value\n * returned may be less than 0 or greater than 1.\n */\n public endDelta(relativeTo: Day): number\n {\n return (this.end.time - relativeTo.time) / Constants.MILLIS_IN_DAY;\n }\n\n /**\n * Calculates the bounds for span event if it were placed in a rectangle which\n * represents a day (24 hour period). By default the returned values are\n * between 0 and 1 and can be scaled by the proper rectangle dimensions or the\n * rectangle dimensions can be passed to this function.\n *\n * @param relativeTo The day to find the bounds relative to. If this is not the\n * start of the day the returned bounds is relative to the given time.\n * @param dayHeight The height of the rectangle of the day.\n * @param dayWidth The width of the rectangle of the day.\n * @param columnOffset The offset in the rectangle of the day to adjust this\n * span by. This also reduces the width of the returned bounds to keep the\n * bounds in the rectangle of the day.\n * @param clip `true` if the bounds should stay in the day rectangle, `false`\n * and the bounds may go outside the rectangle of the day for multi-day\n * spans.\n * @param offsetX How much to translate the left & right properties by.\n * @param offsetY How much to translate the top & bottom properties by.\n * @returns The calculated bounds for this span.\n */\n public getBounds(relativeTo: Day, dayHeight: number = 1, dayWidth: number = 1, columnOffset: number = 0, clip: boolean = true, offsetX: number = 0, offsetY: number = 0): DaySpanBounds\n {\n let startRaw: number = this.startDelta( relativeTo );\n let endRaw: number = this.endDelta( relativeTo );\n\n let start: number = clip ? Math.max(0, startRaw) : startRaw;\n let end: number = clip ? Math.min(1, endRaw) : endRaw;\n\n let left: number = columnOffset;\n let right: number = dayWidth - left;\n\n let top: number = start * dayHeight;\n let bottom: number = end * dayHeight;\n\n return {\n top: top + offsetY,\n bottom: bottom + offsetY,\n height: bottom - top,\n left: left + offsetX,\n right: right + offsetX,\n width: right\n };\n }\n\n /**\n * Summarizes this span given an approximate unit of time and a few other\n * options. If the start and end are on the same unit, a single value will\n * be returned. Otherwise a start and end will be returned with a `delimiter`.\n *\n * @param type The unit of time this span is for.\n * @param dayOfWeek When `true` the weekday of the start and end are included.\n * @param short When `true` the short form of weekdays and months will be used.\n * @param repeat When `true` the year will be repeated on the start and end\n * timestamp even if they are the same year.\n * @param contextual When `true` the year will be hidden if it's the current\n * year.\n * @param delimiter The string to separate the start and end timestamps with.\n * @returns The summary of this span.\n */\n public summary(type: Units, dayOfWeek: boolean = true, short: boolean = false, repeat: boolean = false, contextual: boolean = true, delimiter: string = ' - '): string\n {\n let formats = DaySpan.SUMMARY_FORMATS[ type ];\n let today: Day = Day.today();\n let showStartYear: boolean = !contextual || !this.start.sameYear( today );\n let showEndYear: boolean = !contextual || !this.end.sameYear( today );\n let start: string = this.start.format( formats(short, dayOfWeek, showStartYear) );\n let end: string = this.end.format( formats(short, dayOfWeek, showEndYear) );\n let summary: string = start;\n\n if (start !== end)\n {\n if (!repeat)\n {\n summary = this.start.format( formats(short, dayOfWeek, !this.start.sameYear(this.end)) );\n }\n\n summary += delimiter;\n summary += end;\n }\n else\n {\n summary = start;\n }\n\n return summary;\n }\n\n /**\n * Determines whether the gven span intersects with this span.\n *\n * @param span The span to test.\n * @returns `true` if the spans intersect, otherwise `false`.\n */\n public intersects(span: DaySpan): boolean\n {\n return !(\n this.end.time < span.start.time ||\n this.start.time > span.end.time\n );\n }\n\n /**\n * Calculates the intersection between this span and the given span. If there\n * is no intersection between the two spans then `null` is returned.\n *\n * @param span The span to calculate the intersection with.\n * @returns The intersection or `null` if none exists.\n */\n public intersection(span: DaySpan): DaySpan\n {\n let start: Day = this.start.max( span.start );\n let end: Day = this.end.min( span.end );\n\n return start.isAfter( end ) ? null : new DaySpan(start, end);\n }\n\n /**\n * Calculates the union between this span and the given span.\n *\n * @param span The span to calculate the union with.\n * @returns The union of the two spans.\n */\n public union(span: DaySpan): DaySpan\n {\n let start: Day = this.start.min( span.start );\n let end: Day = this.end.max( span.end );\n\n return new DaySpan(start, end);\n }\n\n /**\n * Returns a point [[DaySpan]] with the same start and end timestamp.\n *\n * @param day The timestamp which will be the start and end.\n * @returns The new instance.\n * @see [[DaySpan.isPoint]]\n */\n public static point(day: Day): DaySpan\n {\n return new DaySpan( day, day );\n }\n\n\n /**\n * Formatting functions which assist the [[DaySpan.summary]] function.\n */\n public static SUMMARY_FORMATS =\n {\n [Units.DAY]: (short: boolean, dayOfWeek: boolean, year: boolean) => {\n return (dayOfWeek ? (short ? 'ddd, ' : 'dddd, ') : '') + (short ? 'MMM ' : 'MMMM ') + 'Do' + (year ? ' YYYY' : '');\n },\n [Units.WEEK]: (short: boolean, dayOfWeek: boolean, year: boolean) => {\n return (dayOfWeek ? (short ? 'ddd, ' : 'dddd, ') : '') + (short ? 'MMM ' : 'MMMM ') + 'Do' + (year ? ' YYYY' : '');\n },\n [Units.MONTH]: (short: boolean, dayOfWeek: boolean, year: boolean) => {\n return (short ? 'MMM' : 'MMMM') + (year ? ' YYYY' : '');\n },\n [Units.YEAR]: (short: boolean, dayOfWeek: boolean, year: boolean) => {\n return (year ? 'YYYY' : '');\n }\n };\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/DaySpan.ts","\nimport { Functions as fn } from './Functions';\nimport { Day } from './Day';\nimport { DaySpan } from './DaySpan';\n\n\n/**\n * The type for identifiers. Most of the time an identifier can be stored as a\n * number because the 4 digit year is first. However when the year is below\n * 1000 a string will be used with zero padding. Storing identifiers as numbers\n * enable very quick comparisons and using strings or numbers allows the\n * identifier to be used as a key to a map.\n */\nexport type IdentifierInput = number | string;\n\n/**\n * The possible properties which can be pulled from an identifier.\n */\nexport interface IdentifierObject\n{\n /**\n * The year pulled from an identifier (0-9999).\n */\n year?: number;\n /**\n * The quarter of the year pulled from an identifier (1-4)\n */\n quarter?: number;\n /**\n * The month of the year pulled from an identifier (0-11)\n */\n month?: number;\n /**\n * The week of the year pulled from an identifier (1-52)\n */\n week?: number;\n /**\n * The day of the month pulled from an identifier (1-31)\n */\n day?: number;\n /**\n * The hour of the day pulled from an identifier (0-23)\n */\n hour?: number;\n /**\n * The minute of the hour pulled from an identifier (0-59)\n */\n minute?: number;\n}\n\n\n/**\n * A class for detecting, parsing, and building identifiers to and from days.\n *\n * An identifier is a simple value which represents a span of time. It may\n * represent an entire year, a quarter (3 months) of a year, a week of a year,\n * a month in a year, a specific day of a month of a year, or a specific hour,\n * minute, day, and month of a year.\n *\n * For example:\n * - `2018`: The year 2018\n * - `201801`: January 2018\n * - `2014023`: The 23rd week of 2014\n * - `20170311`: March 11th, 2017\n * - `201406151651`: June 15th 2016 at 4:51 pm\n * - `'0525'`: Year 525 of the first age, Elrond and Elros are born\n */\nexport abstract class Identifier\n{\n\n /**\n * Determines whether the given identifier is this type.\n *\n * @param id The identifier to test.\n * @returns `true` if the identifier is this type, otherwise `false`.\n */\n public is(id: IdentifierInput): boolean\n {\n return (id + '').length === this.getLength();\n }\n\n /**\n * Returns the identifier of this type for the given day,\n *\n * @param day The day to get the identifier of.\n * @returns The identifier for the day of this type.\n */\n abstract get(day: Day): IdentifierInput;\n\n /**\n * Converts the given identifier which has passed [[Identifier.is]] to an\n * object with properties pulled from the identifier.\n *\n * @param id The identifier to parse.\n * @returns The object with properties parsed from the identifer.\n */\n abstract object(id: IdentifierInput): IdentifierObject;\n\n /**\n * Returns the start of the time span the identifier represents.\n *\n * @param id The identifier to convert to a start day.\n * @returns The start of the time span the identifier represents.\n */\n abstract start(id: IdentifierInput): Day;\n\n /**\n * Returns the span of time the identifier represents.\n *\n * @param id The identifier to convert to a span.\n * @param endInclusive When `true` the end of the span will be the very last\n * millisecond that represents the timespan, otherwise `false` the end\n * will be the start of the very next span.\n * @returns\n */\n abstract span(id: IdentifierInput, endInclusive: boolean): DaySpan;\n\n /**\n * Determines if the day matches the given identifier.\n *\n * @param day The day to test.\n * @param id The identifier to compare to.\n * @returns `true` if the day exists in the time span represented by the\n * identifier, otherwise `false`.\n */\n abstract matches(day: Day, id: IdentifierInput): boolean;\n\n /**\n * Describes the given identifier as a human friendly string.\n *\n * @param id The identifier to describe.\n * @param short If the description should use shorter language or longer.\n * @returns The human friendly string that describes the identifier.\n */\n abstract describe(id: IdentifierInput, short: boolean): string;\n\n /**\n * The scales for all the different values stored in an identifier.\n */\n protected abstract getScales(): number[];\n\n /**\n * The length of the identifier of this type in digits.\n */\n protected abstract getLength(): number;\n\n /**\n * Computes the identifier given values taken from a [[Day]].\n *\n * @param values The values to compute.\n * @returns The computed identifier.\n */\n protected compute(...values: number[]): IdentifierInput\n {\n const scales: number[] = this.getScales();\n let total: number = 0;\n\n for (let i = 0; i < values.length; i++)\n {\n total += values[ i ] * scales[ i ];\n }\n\n return this.is( total ) ? total : fn.padNumber(total, this.getLength());\n }\n\n /**\n * Decomputes the given identifier and returns values which describe a span\n * of time.\n *\n * @param id The identifier to decompute.\n * @returns The original values which computed the identifier.\n */\n protected decompute(id: IdentifierInput): number[]\n {\n const scales: number[] = this.getScales();\n let total: number = fn.isNumber(id) ? id : parseInt(id);\n let values: number[] = [];\n\n for (let i = 0; i < scales.length - 1; i++)\n {\n let curr: number = scales[ i + 0 ];\n let next: number = scales[ i + 1 ];\n let mod: number = next / curr;\n let value: number = total % mod;\n\n values.push( value );\n total = Math.floor( total / mod );\n }\n\n values.push( total );\n\n return values;\n }\n\n /**\n * The identifier type for an hour of time on a specific day.\n */\n public static Time: Identifier = null;\n\n /**\n * The identifier type for a specific day.\n */\n public static Day: Identifier = null;\n\n /**\n * The identifier type for a specific week of a year.\n */\n public static Week: Identifier = null;\n\n /**\n * The identifier type for a specific month of a year.\n */\n public static Month: Identifier = null;\n\n /**\n * The identifier type for a specific quarter of a year.\n */\n public static Quarter: Identifier = null;\n\n /**\n * The identifier type for a specific year.\n */\n public static Year: Identifier = null;\n\n\n /**\n * Finds which identifier type matches the given identifier, if any.\n *\n * @param id The identifier to find the type of.\n * @returns The found identifier type, otherwise `null` if none exists.\n */\n public static find(id: IdentifierInput): Identifier\n {\n if (this.Time.is(id)) return this.Time;\n if (this.Day.is(id)) return this.Day;\n if (this.Week.is(id)) return this.Week;\n if (this.Month.is(id)) return this.Month;\n if (this.Year.is(id)) return this.Year;\n\n return null;\n }\n\n /**\n * Determines whether the given time span `outer` contains the time span\n * `inner`.\n *\n * @param outer The potentially larger time span `inner` must be contained in.\n * @param inner The time span to test is contained inside `outer`.\n * @returns `true` if `inner` is equal to or contained in `outer`, otherwise\n * `false`.\n */\n public static contains(outer: IdentifierInput, inner: IdentifierInput): boolean\n {\n let outerString: string = outer + '';\n\n return (inner + '').substring( 0, outerString.length ) === outerString;\n }\n\n}\n\n// YYYYMMddHHmm (12)\nclass IdentifierTime extends Identifier\n{\n\n public static DESCRIBE_FORMAT_LONG: string = 'LLL';\n public static DESCRIBE_FORMAT_SHORT: string = 'lll';\n\n private static SCALES: number[] = [\n 1 /* minute */,\n 100 /* hour */,\n 10000 /* day */,\n 1000000 /* month */,\n 100000000 /* year */];\n private static LENGTH: number = 12;\n\n protected getScales(): number[]\n {\n return IdentifierTime.SCALES;\n }\n\n protected getLength(): number\n {\n return IdentifierTime.LENGTH;\n }\n\n public get(day: Day): IdentifierInput\n {\n return this.compute(day.minute, day.hour, day.dayOfMonth, day.month + 1, day.year);\n }\n\n public object(id: IdentifierInput): IdentifierObject\n {\n let values: number[] = this.decompute(id);\n\n return {\n minute: values[0],\n hour: values[1],\n day: values[2],\n month: values[3] - 1,\n year: values[4]\n };\n }\n\n public start(id: IdentifierInput): Day\n {\n let obj: IdentifierObject = this.object(id);\n let start: Day = Day.build( obj.year, obj.month, obj.day, obj.hour, obj.minute );\n\n return start;\n }\n\n public span(id: IdentifierInput, endInclusive: boolean = false): DaySpan\n {\n let start: Day = this.start( id );\n let end: Day = start.endOfHour( endInclusive );\n\n return new DaySpan(start, end);\n }\n\n public describe(id: IdentifierInput, short: boolean = false): string\n {\n let start: Day = this.start( id );\n let format: string = short ? IdentifierTime.DESCRIBE_FORMAT_SHORT : IdentifierTime.DESCRIBE_FORMAT_LONG;\n\n return start.format( format );\n }\n\n public matches(day: Day, id: IdentifierInput): boolean\n {\n return day.timeIdentifier === id;\n /*\n let obj: IdentifierObject = this.object(id);\n\n return (\n day.year === obj.year &&\n day.month === obj.month &&\n day.dayOfMonth === obj.day &&\n day.hour === obj.hour &&\n day.minute === obj.minute\n );\n */\n }\n\n}\n\n// YYYYMMdd (8)\nclass IdentifierDay extends Identifier\n{\n\n public static DESCRIBE_FORMAT_LONG: string = 'LL';\n public static DESCRIBE_FORMAT_SHORT: string = 'll';\n\n private static SCALES: number[] = [\n 1 /* day */,\n 100 /* month */,\n 10000 /* year */];\n private static LENGTH: number = 8;\n\n protected getScales(): number[]\n {\n return IdentifierDay.SCALES;\n }\n\n protected getLength(): number\n {\n return IdentifierDay.LENGTH;\n }\n\n public get(day: Day): IdentifierInput\n {\n return this.compute(day.dayOfMonth, day.month + 1, day.year);\n }\n\n public object(id: IdentifierInput): IdentifierObject\n {\n let values: number[] = this.decompute(id);\n\n return {\n day: values[0],\n month: values[1] - 1,\n year: values[2]\n };\n }\n\n public start(id: IdentifierInput): Day\n {\n let obj: IdentifierObject = this.object(id);\n let start: Day = Day.build( obj.year, obj.month, obj.day );\n\n return start;\n }\n\n public span(id: IdentifierInput, endInclusive: boolean = false): DaySpan\n {\n let start: Day = this.start( id );\n let end: Day = start.end( endInclusive );\n\n return new DaySpan(start, end);\n }\n\n public describe(id: IdentifierInput, short: boolean = false): string\n {\n let start: Day = this.start( id );\n let format: string = short ? IdentifierDay.DESCRIBE_FORMAT_SHORT : IdentifierDay.DESCRIBE_FORMAT_LONG;\n\n return start.format( format );\n }\n\n public matches(day: Day, id: IdentifierInput): boolean\n {\n return day.dayIdentifier === id;\n /*\n let obj: IdentifierObject = this.object(id);\n\n return (\n day.year === obj.year &&\n day.month === obj.month &&\n day.dayOfMonth === obj.day\n );\n */\n }\n\n}\n\n// YYYY0ww (7)\nclass IdentifierWeek extends Identifier\n{\n\n public static DESCRIBE_FORMAT_LONG: string = 'wo [week of] YYYY';\n public static DESCRIBE_FORMAT_SHORT: string = 'wo [week of] YYYY';\n\n private static SCALES: number[] = [\n 1 /* week */,\n 1000 /* year */];\n private static LENGTH: number = 7;\n\n protected getScales(): number[]\n {\n return IdentifierWeek.SCALES;\n }\n\n protected getLength(): number\n {\n return IdentifierWeek.LENGTH;\n }\n\n public get(day: Day): IdentifierInput\n {\n return this.compute(day.week, day.year);\n }\n\n public object(id: IdentifierInput): IdentifierObject\n {\n let values: number[] = this.decompute(id);\n\n return {\n week: values[0],\n year: values[1]\n };\n }\n\n public start(id: IdentifierInput): Day\n {\n let obj: IdentifierObject = this.object(id);\n let start: Day = Day.build( obj.year, 0 ).withWeek( obj.week );\n\n return start;\n }\n\n public span(id: IdentifierInput, endInclusive: boolean = false): DaySpan\n {\n let start: Day = this.start( id );\n let end: Day = start.endOfWeek( endInclusive );\n\n return new DaySpan(start, end);\n }\n\n public describe(id: IdentifierInput, short: boolean = false): string\n {\n let start: Day = this.start( id );\n let format: string = short ? IdentifierWeek.DESCRIBE_FORMAT_SHORT : IdentifierWeek.DESCRIBE_FORMAT_LONG;\n\n return start.format( format );\n }\n\n public matches(day: Day, id: IdentifierInput): boolean\n {\n return day.weekIdentifier === id;\n /*\n let obj: IdentifierObject = this.object(id);\n\n return (\n day.year === obj.year &&\n day.week === obj.week\n );\n */\n }\n\n}\n\n// YYYYMM (6)\nclass IdentifierMonth extends Identifier\n{\n\n public static DESCRIBE_FORMAT_LONG: string = 'MMMM YYYY';\n public static DESCRIBE_FORMAT_SHORT: string = 'MMM YYYY';\n\n private static SCALES: number[] = [\n 1 /* month */,\n 100 /* year */];\n private static LENGTH: number = 6;\n\n protected getScales(): number[]\n {\n return IdentifierMonth.SCALES;\n }\n\n protected getLength(): number\n {\n return IdentifierMonth.LENGTH;\n }\n\n public get(day: Day): IdentifierInput\n {\n return this.compute(day.month + 1, day.year);\n }\n\n public object(id: IdentifierInput): IdentifierObject\n {\n let values: number[] = this.decompute(id);\n\n return {\n month: values[0] - 1,\n year: values[1]\n };\n }\n\n public start(id: IdentifierInput): Day\n {\n let obj: IdentifierObject = this.object(id);\n let start: Day = Day.build( obj.year, obj.month );\n\n return start;\n }\n\n public span(id: IdentifierInput, endInclusive: boolean = false): DaySpan\n {\n let start: Day = this.start( id );\n let end: Day = start.endOfMonth( endInclusive );\n\n return new DaySpan(start, end);\n }\n\n public describe(id: IdentifierInput, short: boolean = false): string\n {\n let start: Day = this.start( id );\n let format: string = short ? IdentifierMonth.DESCRIBE_FORMAT_SHORT : IdentifierMonth.DESCRIBE_FORMAT_LONG;\n\n return start.format( format );\n }\n\n public matches(day: Day, id: IdentifierInput): boolean\n {\n return day.monthIdentifier === id;\n /*\n let obj: IdentifierObject = this.object(id);\n\n return (\n day.year === obj.year &&\n day.month === obj.month\n );\n */\n }\n\n}\n\n// YYYYQ (5)\nclass IdentifierQuarter extends Identifier\n{\n\n public static DESCRIBE_FORMAT_LONG: string = 'Qo [quarter] YYYY';\n public static DESCRIBE_FORMAT_SHORT: string = 'Qo [quarter] YYYY';\n\n private static SCALES: number[] = [\n 1 /* quarter */,\n 10 /* year */];\n private static LENGTH: number = 5;\n\n protected getScales(): number[]\n {\n return IdentifierQuarter.SCALES;\n }\n\n protected getLength(): number\n {\n return IdentifierQuarter.LENGTH;\n }\n\n public get(day: Day): IdentifierInput\n {\n return this.compute(day.quarter, day.year);\n }\n\n public object(id: IdentifierInput): IdentifierObject\n {\n let values: number[] = this.decompute(id);\n\n return {\n quarter: values[0],\n year: values[1]\n };\n }\n\n public start(id: IdentifierInput): Day\n {\n let obj: IdentifierObject = this.object(id);\n let start: Day = Day.build( obj.year, (obj.quarter - 1) * 3 );\n\n return start;\n }\n\n public span(id: IdentifierInput, endInclusive: boolean = false): DaySpan\n {\n let start: Day = this.start( id );\n let end: Day = start.relativeMonths( 3 ).endOfMonth( endInclusive );\n\n return new DaySpan(start, end);\n }\n\n public describe(id: IdentifierInput, short: boolean = false): string\n {\n let start: Day = this.start( id );\n let format: string = short ? IdentifierQuarter.DESCRIBE_FORMAT_SHORT : IdentifierQuarter.DESCRIBE_FORMAT_LONG;\n\n return start.format( format );\n }\n\n public matches(day: Day, id: IdentifierInput): boolean\n {\n return day.quarterIdentifier === id;\n /*\n let obj: IdentifierObject = this.object(id);\n\n return (\n day.year === obj.year &&\n day.quarter === obj.quarter\n );\n */\n }\n\n}\n\n// YYYY (4)\nclass IdentifierYear extends Identifier\n{\n\n public static DESCRIBE_FORMAT_LONG: string = 'YYYY';\n public static DESCRIBE_FORMAT_SHORT: string = 'YYYY';\n\n private static SCALES: number[] = [\n 1 /* year */];\n private static LENGTH: number = 4;\n\n protected getScales(): number[]\n {\n return IdentifierYear.SCALES;\n }\n\n protected getLength(): number\n {\n return IdentifierYear.LENGTH;\n }\n\n public get(day: Day): IdentifierInput\n {\n return this.compute(day.year);\n }\n\n public object(id: IdentifierInput): IdentifierObject\n {\n let values: number[] = this.decompute(id);\n\n return {\n year: values[0]\n };\n }\n\n public start(id: IdentifierInput): Day\n {\n let obj: IdentifierObject = this.object(id);\n let start: Day = Day.build( obj.year, 0 );\n\n return start;\n }\n\n public span(id: IdentifierInput, endInclusive: boolean = false): DaySpan\n {\n let start: Day = this.start( id );\n let end: Day = start.endOfYear( endInclusive );\n\n return new DaySpan(start, end);\n }\n\n public describe(id: IdentifierInput, short: boolean = false): string\n {\n let start: Day = this.start( id );\n let format: string = short ? IdentifierYear.DESCRIBE_FORMAT_SHORT : IdentifierYear.DESCRIBE_FORMAT_LONG;\n\n return start.format( format );\n }\n\n public matches(day: Day, id: IdentifierInput): boolean\n {\n return day.year === id;\n /*\n let obj: IdentifierObject = this.object(id);\n\n return (\n day.year === obj.year\n );\n */\n }\n\n}\n\n// Sets the Identifier types\nIdentifier.Time = new IdentifierTime();\nIdentifier.Day = new IdentifierDay();\nIdentifier.Week = new IdentifierWeek();\nIdentifier.Month = new IdentifierMonth();\nIdentifier.Quarter = new IdentifierQuarter();\nIdentifier.Year = new IdentifierYear();\n\n\n\n// WEBPACK FOOTER //\n// ./src/Identifier.ts","\n/**\n * A class which takes a number and determines the suffix for that number.\n *\n * ```typescript\n * Suffix.CACHE[ 2 ]; // 2nd\n * Suffix.determine( 3 ); // rd\n * Suffix.get( 4 ); // th\n * Suffix.get( 4, true ); // 4th\n * ```\n */\nexport class Suffix\n{\n\n /**\n * The array of suffixes used.\n */\n public static MAP: string[] = [\n 'th', 'st', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th'\n ];\n\n /**\n * An internal cache of [[Suffix._CACHE_SIZE]] suffixes.\n */\n private static _CACHE: string[];\n\n /**\n * The number of values to store in the cache (inclusive).\n */\n private static _CACHE_SIZE: number = 366;\n\n\n /**\n * The cache of number & suffix pairs.\n */\n public static get CACHE(): string[]\n {\n if (!this._CACHE)\n {\n this._CACHE = [];\n\n for (let i = 0; i <= this._CACHE_SIZE; i++)\n {\n this._CACHE[ i ] = this.get( i, true );\n }\n }\n\n return this._CACHE;\n }\n\n /**\n * Determines the suffix for a given number.\n *\n * @param value The number to find the suffix for.\n * @returns The suffix determined.\n */\n public static determine(value: number): string\n {\n return value >= 11 && value <= 13 ? 'th' : this.MAP[ value % this.MAP.length ];\n }\n\n /**\n * Gets the suffix for a number and optionally appends it before the suffix.\n *\n * @param value The number to get the suffix for.\n * @param prepend When `true` the value is prepended to the suffix.\n * @returns The suffix or value & suffix pair determined.\n */\n public static get(value: number, prepend: boolean = false): string\n {\n let suffix: string = this.determine(value);\n\n return prepend ? value + suffix : suffix;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Suffix.ts","\nimport { Functions as fn } from './Functions';\n\n\n/**\n * The callback which is invoked for each item in the Iterator. The callback\n * can call [[Iterator.stop]] at anytime to stop iteration.\n *\n * @param item The item found in the iterator.\n * @param iterator The iterator with the item.\n * @returns The result of the callback.\n */\nexport type IteratorCallback = (item: T, iterator: Iterator) => R;\n\n/**\n * An [[Iterator]] source which handles iterating over items and calls\n * `callback` for each item, checking [[Iterator.iterating]] after each\n * invokation to stop iteration as early as possible.\n *\n * @param callback The function to invoke for each item.\n * @param iterator The iterator to check for early exists.\n */\nexport type IteratorSource = (iterator: Iterator) => any;\n\n/**\n * A filter to apply duration iteration to only look at certain items when this\n * function returns `true`.\n *\n * @param item The item being iterated.\n * @returns `true` if the item should be iterated, otherwise `false`.\n */\nexport type IteratorFilter = (item: T) => boolean;\n\n/**\n * An action to perform on the source as instructed by the iterator.\n */\nexport enum IteratorAction\n{\n /**\n * Continue iteration.\n */\n Continue,\n\n /**\n * Stop iteration.\n */\n Stop,\n\n /**\n * Remove the current item if possible, and continue iteration.\n */\n Remove\n}\n\n/**\n * A class that allows an iteratable source to be iterated any number of times\n * by providing the following functionality:\n *\n * - [[Iterator.isEmpty]]: Determines whether the source contains any items.\n * - [[Iterator.first]]: Gets the first item in the source.\n * - [[Iterator.count]]: Counds the number of items in the source.\n * - [[Iterator.list]]: Builds a list of the items in the source.\n * - [[Iterator.object]]: Builds an object of the items in the source.\n * - [[Iterator.reduce]]: Reduces the items in the source down to a single value.\n * - [[Iterator.purge]]: Removes items from the source which meet some criteria.\n * - [[Iterator.filter]]: Returns a subset of items that meet some criteria by\n * returning a new Iterator.\n * - [[Iterator.map]]: Maps each item in the source to another item by returning\n * a new Iterator.\n * - [[Iterator.iterate]]: Invokes a function for each item in the source.\n *\n * The following static functions exist to help iterate simple sources:\n *\n * - [[Iterator.forArray]]: Iterates an array, optionally reverse\n * - [[Iterator.forObject]]: Iterates the properties of an object, optionally\n * just the properties explicitly set on the object.\n *\n * ```typescript\n * let iter = object.iterateThings();\n * iter.isEmpty(); // no items?\n * iter.isEmpty(d => d.flag); // no items that meet some criteria?\n * iter.count(); // number of items\n * iter.count(d => d.flag); // number of items that meet some criteria\n * iter.first(); // first item\n * iter.first(d => d.flag); // first item that meets some criteria\n * iter.list(); // get all items as array\n * iter.list(myArray); // add all items to given array\n * iter.list([], d => d.flag); // get all items as array that meet some criteria\n * iter.object(d => d.id); // get all items as an object keyed by a value (ex: id)\n * iter.object(d => d.id, {},\n * d => d.flag); // get all items as an object keyed by a value where the item meets some criteria (ex: key id if flag is truthy)\n * iter.purge(d => d.flag); // remove all items from source that meet some criteria\n * iter.filter(d => d.flag); // returns an iterator which iterates a subset of items which meet some criteria\n * iter.reduce(0,\n * (d, t) => t + d.size); // reduces all items to a single value (ex: sums all size)\n * iter.reduce(0,\n * (d, t) => t + d.size,\n * d => d.flag); // reduces all items to a single value (ex: sums all size) where the item meets some criteria\n * iter.map(d => d.subitem); // return an iterator for subitems if they exist\n * iter.iterate(d => log(d)); // do something for each item\n * ```\n *\n * @typeparam T The type of item being iterated.\n */\nexport class Iterator\n{\n\n /**\n * A result of the iteration passed to [[Iterator.stop]].\n */\n public result: any = null;\n\n /**\n * The last action (if any) called on this iterator.\n */\n public action: IteratorAction;\n\n /**\n * The current callback passed to the iterator.\n */\n public callback: IteratorCallback;\n\n /**\n * The source of iterable items. This allows the iteration over any type of\n * structure. The source must call the callback for each item and its\n * recommended that the source checks the [[Iterator.iterating]] flag after\n * each callback invokation.\n */\n private source: IteratorSource;\n\n /**\n * Creates a new Iterator given a source.\n *\n * @param source The source of items to iterator.\n */\n public constructor(source: IteratorSource)\n {\n this.source = source;\n }\n\n /**\n * Returns a clone of this iterator with the same source. This is necessary\n * if you want to iterate all or a portion of the source while already\n * iterating it (like a nested loop).\n */\n public clone(): Iterator\n {\n return new Iterator( this.source );\n }\n\n /**\n * Passes the given item to the iterator callback and returns the action\n * requested at this point in iteration.\n *\n * @param item The current item being iterated.\n */\n public act(item: T): IteratorAction\n {\n this.action = IteratorAction.Continue;\n\n this.callback( item, this );\n\n return this.action;\n }\n\n /**\n * Stops iteration and optionally sets the result of the iteration.\n *\n * @param result The result of the iteration.\n */\n public stop(result?: any): this\n {\n this.result = result;\n this.action = IteratorAction.Stop;\n\n return this;\n }\n\n /**\n * Signals to the iterator source that the current item wants to be removed.\n */\n public remove(): this\n {\n this.action = IteratorAction.Remove;\n\n return this;\n }\n\n /**\n * Determines with this iterator is empty. A filter function can be specified\n * to only check for items which match certain criteria.\n *\n * @param filter A function to the checks items for certain criteria.\n * @returns `true` if no valid items exist in the source.\n */\n public isEmpty(filter: IteratorFilter = null): boolean\n {\n let empty: boolean = true;\n\n this.iterate((item, iterator) =>\n {\n if (filter && !filter( item ))\n {\n return;\n }\n\n empty = false;\n iterator.stop();\n });\n\n return empty;\n }\n\n /**\n * Counts the number of items in the iterator. A filter function can be\n * specified to only count items which match certain criteria.\n *\n * @param filter A function to count items for certain criteria.\n * @returns The number of items in the source that optionally match the given\n * criteria.\n */\n public count(filter: IteratorFilter = null): number\n {\n let total: number = 0;\n\n this.iterate((item, iterator) =>\n {\n if (filter && !filter( item ))\n {\n return;\n }\n\n total++;\n });\n\n return total;\n }\n\n /**\n * Returns the first item in the iterator. A filter function can be specified\n * to only return the first item which matches certain criteria.\n *\n * @param filter A function to compare items to to match certain criteria.\n * @returns The first item found that optonally matches the given criteria.\n */\n public first(filter: IteratorFilter = null): T\n {\n let first: T = null;\n\n this.iterate((item, iterator) =>\n {\n if (filter && !filter( item ))\n {\n return;\n }\n\n first = item;\n iterator.stop();\n });\n\n return first;\n }\n\n /**\n * Builds a list of items from the source. A filter function can be specified\n * so the resulting list only contain items that match certain criteria.\n *\n * @param out The array to place the items in.\n * @param filter The function which determines which items are added to the list.\n * @returns The reference to `out` which has had items added to it which\n * optionally match the given criteria.\n */\n public list(out: T[] = [], filter: IteratorFilter = null): T[]\n {\n this.iterate((item, iterator) =>\n {\n if (filter && !filter( item ))\n {\n return;\n }\n\n out.push( item );\n });\n\n return out;\n }\n\n /**\n * Builds an object of items from the source keyed by a result returned by\n * a `getKey` function.\n *\n * @param getKey The function which returns the key of the object.\n * @param out The object to place the items in.\n * @param filter The function which determines which items are set on the object.\n * @returns The reference to `out` which has had items set to it which\n * optionally match the given criteria.\n */\n public object(getKey: (item: T) => any, out: any = {}, filter: IteratorFilter = null): any\n {\n this.iterate((item, iterator) =>\n {\n if (filter && !filter( item ))\n {\n return;\n }\n\n let key = getKey( item );\n\n out[ key ] = item;\n });\n\n return out;\n }\n\n /**\n * Returns a new iterator that only returns a maximum number of items.\n *\n * @param amount The maximum number of items to return.\n * @returns A new iterator which returns a maximum number of items.\n */\n public take(amount: number): Iterator\n {\n return new Iterator(next =>\n {\n this.iterate((item, prev) =>\n {\n switch (next.act( item ))\n {\n case IteratorAction.Stop:\n prev.stop();\n break;\n case IteratorAction.Remove:\n prev.remove();\n break;\n }\n\n if (--amount <= 0)\n {\n prev.stop();\n }\n });\n });\n }\n\n /**\n * Returns a new iterator that skips the given number of items from the items\n * in this iterator.\n *\n * @param amount The number of items to skip.\n * @returns A new iterator which skipped the given number of items.\n */\n public skip(amount: number): Iterator\n {\n return new Iterator(next =>\n {\n let skipped: number = 0;\n\n this.iterate((item, prev) =>\n {\n if (skipped >= amount)\n {\n switch (next.act( item ))\n {\n case IteratorAction.Stop:\n prev.stop();\n break;\n case IteratorAction.Remove:\n prev.remove();\n break;\n }\n }\n\n skipped++;\n });\n });\n }\n\n /**\n * Returns a new iterator thats items are the items in this iterator followed\n * by the items in the given iterators.\n *\n * @param iterators The iterators to append after this one.\n * @returns A new iterator based on this iterator followed by the given.\n */\n public append(...iterators: Iterator[]): Iterator\n {\n return Iterator.join( this, ...iterators );\n }\n\n /**\n * Returns a new iterator thats items are the items in the given iterators\n * followed by the items in this iterator.\n *\n * @param iterators The iterators to prepend before this one.\n * @returns A new iterator based on the given iterators followed by this.\n */\n public prepend(...iterators: Iterator[]): Iterator\n {\n return Iterator.join( ...iterators, this );\n }\n\n /**\n * Removes items from the source that match certain criteria.\n *\n * @param filter The function which determines which items to remove.\n */\n public purge(filter: IteratorFilter): this\n {\n this.iterate((item, iterator) =>\n {\n if (filter(item))\n {\n iterator.remove();\n }\n });\n\n return this;\n }\n\n /**\n * Returns an iterator which takes items from this iterator and presents them\n * in reverse.\n *\n * @returns A new iterator with the items in this iterator in reverse.\n */\n public reverse(): Iterator\n {\n return new Iterator(iterator =>\n {\n let items: T[] = this.list();\n let removed: T[] = [];\n\n for (let i = items.length - 1; i >= 0; i--)\n {\n let item: T = items[ i ];\n let action: IteratorAction = iterator.act( item );\n\n if (action === IteratorAction.Stop)\n {\n break;\n }\n\n if (action === IteratorAction.Remove)\n {\n removed.push( item );\n }\n }\n\n if (removed.length > 0)\n {\n this.purge(item => removed.indexOf( item ) !== -1);\n }\n });\n }\n\n /**\n * Reduces all the items in the source to a single value given the initial\n * value and a function to convert an item and the current reduced value\n */\n public reduce(initial: R, reducer: (item: T, reduced: R) => R, filter: IteratorFilter = null): R\n {\n let reduced: R = initial;\n\n this.iterate((item, iterator) =>\n {\n if (filter && !filter( item ))\n {\n return;\n }\n\n reduced = reducer( item, reduced );\n });\n\n return reduced;\n }\n\n /**\n * Returns an iterator where this iterator is the source and the returned\n * iterator is built on a subset of items which pass a `filter` function.\n *\n * @param filter The function which determines if an item should be iterated.\n * @returns A new iterator for the filtered items from this iterator.\n */\n public filter(filter: IteratorFilter): Iterator\n {\n return new Iterator(next =>\n {\n this.iterate((prevItem, prev) =>\n {\n if (filter(prevItem))\n {\n switch (next.act( prevItem ))\n {\n case IteratorAction.Stop:\n prev.stop();\n break;\n\n case IteratorAction.Remove:\n prev.remove();\n break;\n }\n }\n });\n });\n }\n\n /**\n * Returns an iterator where this iterator is the source and the returned\n * iterator is built from mapped items pulled from items in the source\n * of this iterator. If the given callback `outerCallback` does not return\n * a mapped value then the returned iterator will not see the item. A filter\n * function can be specified to only look at mapping items which match\n * certain criteria.\n *\n * @param mapper The function which maps an item to another.\n * @param filter The function which determines if an item should be mapped.\n * @returns A new iterator for the mapped items from this iterator.\n */\n public map(mapper: IteratorCallback, filter: IteratorFilter = null): Iterator\n {\n return new Iterator(next =>\n {\n this.iterate((prevItem, prev) =>\n {\n if (filter && !filter( prevItem ))\n {\n return;\n }\n\n let nextItem: W = mapper( prevItem, prev );\n\n if (fn.isDefined( nextItem ))\n {\n switch (next.act( nextItem ))\n {\n case IteratorAction.Stop:\n prev.stop();\n break;\n\n case IteratorAction.Remove:\n prev.remove();\n break;\n }\n }\n });\n });\n }\n\n /**\n * Invokes the callback for each item in the source of this iterator. The\n * second argument in the callback is the reference to this iterator and\n * [[Iterator.stop]] can be called at anytime to cease iteration.\n *\n * @param callback The function to invoke for each item in this iterator.\n */\n public iterate(callback: IteratorCallback): this\n {\n this.result = undefined;\n this.callback = callback;\n this.action = IteratorAction.Continue;\n this.source( this );\n this.callback = null;\n\n return this;\n }\n\n /**\n * Passes the result of the iteration to the given function if a truthy\n * result was passed to [[Iterator.stop]].\n *\n * @param getResult The function to pass the result to if it exists.\n */\n public withResult(getResult: (result: any) => any): this\n {\n if (this.result)\n {\n getResult( this.result );\n }\n\n return this;\n }\n\n /**\n * Returns an iterator for the given array optionally iterating it in reverse.\n *\n * @param items The array of items to iterate.\n * @param reverse If the array should be iterated in reverse.\n * @returns A new iterator for the given array.\n */\n public static forArray(items: T[], reverse: boolean = false): Iterator\n {\n return new Iterator(iterator =>\n {\n if (reverse)\n {\n for (let i = items.length - 1; i >= 0; i--)\n {\n switch (iterator.act(items[ i ]))\n {\n case IteratorAction.Stop:\n return;\n case IteratorAction.Remove:\n items.splice(i, 1);\n break;\n }\n }\n }\n else\n {\n for (let i = 0; i < items.length; i++)\n {\n switch (iterator.act(items[ i ]))\n {\n case IteratorAction.Stop:\n return;\n case IteratorAction.Remove:\n items.splice(i, 1);\n i--;\n break;\n }\n }\n }\n });\n }\n\n /**\n * Returns an iterator for the given object optionally checking the\n * `hasOwnProperty` function on the given object.\n *\n * @param items The object to iterate.\n * @param hasOwnProperty If `hasOwnProperty` should be checked.\n * @returns A new iterator for the given object.\n */\n public static forObject(items: { [key: string]: T }, hasOwnProperty: boolean = true): Iterator\n {\n return new Iterator(iterator =>\n {\n for (let key in items)\n {\n if (hasOwnProperty && !items.hasOwnProperty( key ))\n {\n continue;\n }\n\n switch (iterator.act(items[ key ]))\n {\n case IteratorAction.Stop:\n return;\n case IteratorAction.Remove:\n delete items[ key ];\n break;\n }\n }\n });\n }\n\n /**\n * Joins all the given iterators into a single iterator where the items\n * returned are in the same order as passed to this function. If any items\n * are removed from the returned iterator they will be removed from the given\n * iterator if it supports removal.\n *\n * @param iterators The array of iterators to join as one.\n * @returns A new iterator for the given iterators.\n */\n public static join(...iterators: Iterator[]): Iterator\n {\n return new Iterator(parent =>\n {\n for (let child of iterators)\n {\n child.iterate((item, childIterator) =>\n {\n switch (parent.act( item ))\n {\n case IteratorAction.Remove:\n childIterator.remove();\n break;\n case IteratorAction.Stop:\n childIterator.stop();\n break;\n }\n });\n\n if (child.action === IteratorAction.Stop)\n {\n return;\n }\n }\n });\n }\n\n /**\n * Returns a new iterator with no items.\n *\n * @returns A new iterator with no items.\n */\n public static empty(): Iterator\n {\n return new Iterator(parent => {});\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Iterator.ts","\nimport { Functions as fn } from './Functions';\nimport { Day, DayProperty } from './Day';\nimport { Suffix } from './Suffix';\nimport { Weekday } from './Weekday';\nimport { FrequencyValueEvery, FrequencyValue } from './Frequency';\nimport { Schedule, ScheduleInput } from './Schedule';\n\n\n/**\n * Describes a [[Pattern]] given a [[Day]] to base it on.\n *\n * @param day The day to base the description on.\n * @returns The description of the pattern.\n */\nexport type DescribePattern = (day: Day) => string;\n\n/**\n * A rule helps parse [[ScheduleInput]] and determines whether it matches the\n * given pattern.\n *\n * - When a number is given, the input MUST be an array of the same length and contain any values.\n * - When an array of numbers is given, the input MUST be an array containing the same values.\n * - When a TRUE is given the input MUST contain that property and can be any value.\n * - When a FALSE is given the input MAY contain that property (optional).\n * - When a property is NOT specified, the input MUST NOT contain that property.\n * - When an object with every is given, the input must match the every and offset values (have the same frequency).\n */\nexport type PatternRule =\n number | // has array with this number of elements\n number[] | // is array with same values\n boolean | // is true or false\n FrequencyValueEvery; // is object with matching every and offset\n\n/**\n * The set of rules you can specify for determining if a [[ScheduleInput]]\n * matches a pattern.\n */\nexport interface PatternRules\n{\n dayOfWeek?: PatternRule;\n dayOfMonth?: PatternRule;\n lastDayOfMonth?: PatternRule;\n dayOfYear?: PatternRule;\n month?: PatternRule;\n week?: PatternRule;\n year?: PatternRule;\n weekOfYear?: PatternRule;\n weekspanOfYear?: PatternRule;\n fullWeekOfYear?: PatternRule;\n lastWeekspanOfYear?: PatternRule;\n lastFullWeekOfYear?: PatternRule;\n weekOfMonth?: PatternRule;\n weekspanOfMonth?: PatternRule;\n fullWeekOfMonth?: PatternRule;\n lastWeekspanOfMonth?: PatternRule;\n lastFullWeekOfMonth?: PatternRule;\n}\n\n\n/**\n * A class which helps describe [[ScheduleInput]] if it matches a pattern.\n */\nexport class Pattern\n{\n\n /**\n * The properties in the [[ScheduleInput]] which are compared against the\n * rules of a pattern.\n */\n public static PROPS: DayProperty[] =\n [\n 'dayOfWeek', 'dayOfMonth', 'lastDayOfMonth', 'dayOfYear',\n 'month', 'week', 'year',\n 'weekOfYear', 'weekspanOfYear', 'fullWeekOfYear', 'lastWeekspanOfYear', 'lastFullWeekOfYear',\n 'weekOfMonth', 'weekspanOfMonth', 'fullWeekOfMonth', 'lastWeekspanOfMonth', 'lastFullWeekOfMonth'\n ];\n\n /**\n * Whether this pattern should be \"listed\" or not. Visual schedulers may\n * provide a shortcut to describing and changing a [[Schedule]] through\n * patterns and any pattern where listed is `true` could be an option in a\n * list. The default patterns are all listed.\n */\n public listed: boolean;\n\n /**\n * The function which describes this pattern given a [[Day]] to base it on.\n */\n public describe: DescribePattern;\n\n /**\n * The name of this pattern. This is not typically displayed to a user, just\n * to uniquely identify a pattern.\n */\n public name: string;\n\n /**\n * The rules for matching a pattern to a [[Schedule]] or applying a pattern to\n * a schedule.\n */\n public rules: PatternRules;\n\n\n /**\n * Creates a new pattern.\n *\n * @param name The unique name of the pattern.\n * @param listed If the pattern is \"listed\" [[Pattern.listed]].\n * @param describe A function to describe the pattern given a [[Day]].\n * @param rules The rules which describe how to detect and apply the pattern\n * to schedule input.\n */\n public constructor(name: string, listed: boolean, describe: DescribePattern, rules: PatternRules)\n {\n this.name = name;\n this.listed = listed;\n this.describe = describe;\n this.rules = rules;\n }\n\n /**\n * Applies this pattern to a [[Schedule]] or [[ScheduleInput]] removing and\n * adding any necessary properties from the input to match this pattern -\n * based around the day provided.\n *\n * @param schedule The schedule to update to match this pattern.\n * @param day The day to base the schedule on.\n * @returns The reference to the input passed in.\n */\n public apply | Schedule>(schedule: I, day: Day): I\n {\n if (schedule instanceof Schedule)\n {\n this.applyGeneric(day,\n (prop, frequency) => schedule.setFrequency( prop, frequency ),\n (prop) => schedule.setFrequency( prop )\n );\n\n schedule.updateChecks();\n }\n else\n {\n this.applyGeneric(day,\n (prop, frequency) => schedule[ prop ] = frequency,\n (prop) => delete schedule[ prop ]\n );\n }\n\n return schedule;\n }\n\n /**\n * Applies this pattern to any object provided they implement the\n * `setFrequency` and `removeFrequency` functions.\n *\n * @param day The day to base the schedule on.\n * @param setFrequency The function which sets the frequency on the object.\n * @param removeFrequency The function to remove a frequency from the object.\n */\n public applyGeneric(day: Day,\n setFrequency: (property: DayProperty, frequency: any) => any,\n removeFrequency: (property: DayProperty) => any): void\n {\n for (let prop of Pattern.PROPS)\n {\n let rule = this.rules[ prop ];\n\n // Should have one value\n if (rule === 1)\n {\n setFrequency( prop, [day[ prop ]] );\n }\n\n // Can be any of the values in the array\n if (fn.isArray(rule))\n {\n setFrequency( prop, rule );\n }\n\n // Must not be present\n if (!fn.isDefined(rule))\n {\n removeFrequency( prop );\n }\n }\n }\n\n /**\n * Determines whether the given [[Schedule]] or [[ScheduleInput]] matches this\n * pattern. Optionally a day can be provided to make sure the day matches the\n * schedule and pattern together.\n *\n * @param schedule The schedule input to test.\n * @param exactlyWith A day to further validate against for matching.\n * @returns `true` if the schedule was a match to this pattern with the\n * day if one was provided, otherwise `false`.\n */\n public isMatch | Schedule>(schedule: I, exactlyWith?: Day): boolean\n {\n if (schedule instanceof Schedule)\n {\n return this.isMatchGeneric((prop) => schedule[ prop ].input, exactlyWith);\n }\n else\n {\n return this.isMatchGeneric((prop) => schedule[ prop ], exactlyWith);\n }\n }\n\n /**\n * Determines whether the given input matches this pattern. Optionally a day\n * can be provided to make sure the day matches the schedule and pattern\n * together.\n *\n * @param input The schedule input to test.\n * @param exactlyWith A day to further validate against for matching.\n * @returns `true` if the schedule input was a match to this pattern with the\n * day if one was provided, otherwise `false`.\n */\n public isMatchGeneric(getFrequency: (property: DayProperty) => FrequencyValue, exactlyWith?: Day): boolean\n {\n let exactly: boolean = fn.isDefined( exactlyWith );\n\n for (let prop of Pattern.PROPS)\n {\n let rule = this.rules[ prop ];\n let curr = getFrequency( prop );\n\n // Optional, skip it\n if (rule === false)\n {\n continue;\n }\n\n // Requires any value\n if (rule === true && !curr)\n {\n return false;\n }\n\n // Must not be present\n if (!fn.isDefined(rule) && curr)\n {\n return false;\n }\n\n // Must be an array of the same size\n if (fn.isNumber(rule))\n {\n if (fn.isArray(curr) && (curr).length === rule)\n {\n if (exactly && (curr).indexOf( exactlyWith[ prop ] ) === -1)\n {\n return false;\n }\n }\n else\n {\n return false;\n }\n }\n\n // Must be an array of the same values\n if (fn.isArray(rule))\n {\n if (!fn.isArray(curr))\n {\n return false;\n }\n\n if (rule.length !== (curr).length)\n {\n return false;\n }\n\n for (var i = 0; i < rule.length; i++)\n {\n if (rule[ i ] !== curr[ i ])\n {\n return false;\n }\n }\n\n if (exactly && rule.indexOf( exactlyWith[ prop ] ) === -1)\n {\n return false;\n }\n }\n\n // Must be an object with same over & offset.\n if (fn.isObject(rule))\n {\n if (!fn.isObject(curr))\n {\n return false;\n }\n\n var ruleOffset = rule.offset || 0;\n var currOffset = (curr).offset || 0;\n\n if (currOffset !== ruleOffset || curr.every !== rule.every)\n {\n return false;\n }\n\n if (exactly && (exactlyWith[ prop ] % rule.every) !== ruleOffset)\n {\n return false;\n }\n }\n }\n\n return true;\n }\n\n /**\n * Returns the pattern with the given name if one exists. If you add your own\n * patterns make sure to add them to [[PatternMap]].\n *\n * @param name The name of the pattern to return.\n * @return The instance to the pattern with the same name.\n */\n public static withName(name: string): Pattern\n {\n return PatternMap[ name ];\n }\n\n /**\n * Finds a matching pattern to the given input searching through [[Patterns]]\n * for matches. Optionally it will only look at patterns where listed = `true`.\n *\n * @param input The schedule input to use.\n * @param listedOnly When `true` only patterns with [[Pattern.listed]] set to\n * `true` will be looked at, otherwise all patterns are looked at.\n * @param exactlyWith A day to further validate against for matching.\n * @see [[Pattern.isMatch]]\n */\n public static findMatch | Schedule>(input: I, listedOnly: boolean = true, exactlyWith?: Day): Pattern\n {\n for (let pattern of Patterns)\n {\n if ((pattern.listed || !listedOnly) && pattern.isMatch( input, exactlyWith ))\n {\n return pattern;\n }\n }\n\n return null;\n }\n\n}\n\n\n/**\n * The list of patterns that can be searched through for matches to schedule\n * input.\n *\n * @see [[Pattern.findMatch]]\n */\nexport let Patterns: Pattern[] = [\n new Pattern(\n 'none', true,\n (day: Day) => 'Does not repeat',\n {\n year: 1,\n month: 1,\n dayOfMonth: 1\n }\n ),\n new Pattern(\n 'daily', true,\n (day: Day) => 'Daily',\n {\n\n }\n ),\n new Pattern(\n 'weekly', true,\n (day: Day) => 'Weekly on ' + day.format('dddd'),\n {\n dayOfWeek: 1\n }\n ),\n new Pattern(\n 'monthlyWeek', true,\n (day: Day) => 'Monthly on the ' + Suffix.CACHE[day.weekspanOfMonth + 1] + ' ' + day.format('dddd'),\n {\n dayOfWeek: 1,\n weekspanOfMonth: 1\n }\n ),\n new Pattern(\n 'annually', true,\n (day: Day) => 'Annually on ' + day.format('MMMM Do'),\n {\n month: 1,\n dayOfMonth: 1\n }\n ),\n new Pattern(\n 'annuallyMonthWeek', true,\n (day: Day) => 'Annually on the ' + Suffix.CACHE[day.weekspanOfMonth + 1] + ' ' + day.format('dddd') + ' of ' + day.format('MMMM'),\n {\n month: 1,\n dayOfWeek: 1,\n weekspanOfMonth: 1\n }\n ),\n new Pattern(\n 'weekday', true,\n (day: Day) => 'Every weekday (Monday to Friday)',\n {\n dayOfWeek: [Weekday.MONDAY, Weekday.TUESDAY, Weekday.WEDNESDAY, Weekday.THURSDAY, Weekday.FRIDAY]\n }\n ),\n new Pattern(\n 'monthly', true,\n (day: Day) => 'Monthly on the ' + day.format('Do') + ' day',\n {\n dayOfMonth: 1\n }\n ),\n new Pattern(\n 'custom', true,\n (day: Day) => 'Custom...',\n {\n dayOfWeek: false,\n dayOfMonth: false,\n lastDayOfMonth: false,\n dayOfYear: false,\n year: false,\n month: false,\n week: false,\n weekOfYear: false,\n weekspanOfYear: false,\n fullWeekOfYear: false,\n lastWeekspanOfYear: false,\n lastFullWeekOfYear: false,\n weekOfMonth: false,\n weekspanOfMonth: false,\n fullWeekOfMonth: false,\n lastWeekspanOfMonth: false,\n lastFullWeekOfMonth: false\n }\n )\n];\n\n/**\n * The map of patterns keyed by their name.\n *\n * @see [[Pattern.withName]]\n */\nexport let PatternMap: { [name: string]: Pattern } = {};\n\nfor (let pattern of Patterns)\n{\n PatternMap[ pattern.name ] = pattern;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Pattern.ts","\nimport { Identifier, IdentifierInput } from './Identifier';\nimport { Day } from './Day';\nimport { Time } from './Time';\nimport { DaySpan } from './DaySpan';\nimport { Iterator, IteratorAction } from './Iterator';\n\n\n/**\n * A map of values in the [[ScheduleModifier]] keyed by the descriptions of the\n * identifiers.\n */\nexport interface ScheduleModifierDescription\n{\n [description: string]: T\n}\n\n/**\n * An object which carries the span taken from an identifier and the value\n * mapped to it in a [[ScheduleModifier]].\n */\nexport interface ScheduleModifierSpan\n{\n span: DaySpan,\n value: T\n}\n\n/**\n * A class that can modify the events of a schedule by storing [[Identifier]]s\n * and an associated value.\n *\n * @typeparam T The type of data that modifies the schedule.\n */\nexport class ScheduleModifier\n{\n\n /**\n * The map of values mapped by their [[Identifier]]s.\n */\n public map: { [id: string]: T };\n\n\n /**\n * Creates a new schedule modifier.\n */\n public constructor()\n {\n this.map = {};\n }\n\n /**\n * Clears the modifier of all modifications.\n */\n public clear(): this\n {\n this.map = {};\n\n return this;\n }\n\n /**\n * Returns `true` if this modifier lacks any modifications, otherwise `false`.\n */\n public isEmpty(): boolean\n {\n // @ts-ignore\n for (let id in this.map)\n {\n return !id;\n }\n\n return true;\n }\n\n /**\n * Gets the most specific value in this modifier for the given day, if none\n * exists `otherwise` is returned. A modifier can have multiple values for a\n * given day because [[Identifier]]s represent a span of time.\n *\n * @param day The day to get a value for.\n * @param otherwise What to return if no value exists for the given day.\n * @param lookAtTime If the specific time of the given day should be looked at.\n * @returns The most specific value for the given day, or `otherwise`.\n */\n public get(day: Day, otherwise: T, lookAtTime: boolean = true): T\n {\n let map = this.map;\n\n return (lookAtTime && map[ day.timeIdentifier ]) ||\n map[ day.dayIdentifier ] ||\n map[ day.monthIdentifier ] ||\n map[ day.weekIdentifier ] ||\n map[ day.quarterIdentifier ] ||\n otherwise;\n }\n\n /**\n * Gets all values in this modifier for the given day. If none exist, an empty\n * array is returned. The values returned in the array are returned in most\n * specific to least specific.\n *\n * @param day The day to get the values for.\n * @returns An array of values (modifications) for the given day.\n */\n public getAll(day: Day): T[]\n {\n let map = this.map;\n let all: T[] = [];\n\n if (map[ day.timeIdentifier ]) all.push( map[ day.timeIdentifier ] );\n if (map[ day.dayIdentifier ]) all.push( map[ day.dayIdentifier ] );\n if (map[ day.monthIdentifier ]) all.push( map[ day.monthIdentifier ] );\n if (map[ day.weekIdentifier ]) all.push( map[ day.weekIdentifier ] );\n if (map[ day.quarterIdentifier ]) all.push( map[ day.quarterIdentifier ] );\n\n return all;\n }\n\n /**\n * Moves the value/modification from one identifier to another.\n *\n * @param from The day to take the identifier from.\n * @param fromType The identifier type.\n * @param to The day to move the value to.\n * @param toType The identifier type to move the value to.\n */\n public move(from: Day, fromType: Identifier, to: Day, toType: Identifier): this\n {\n let fromIdentifier = fromType.get( from );\n let toIdentifier = toType.get( to );\n\n this.map[ toIdentifier ] = this.map[ fromIdentifier ];\n\n delete this.map[ fromIdentifier ];\n\n return this;\n }\n\n /**\n * Moves any identifiers with the matching time `fromTime` to `toTime` and\n * returns the number of moves.\n *\n * @param fromTime The time to move from.\n * @param toTime The time to move to.\n * @returns The number of modifiers moved.\n */\n public moveTime(fromTime: Time, toTime: Time): number\n {\n let type: Identifier = Identifier.Time;\n let moveIds: IdentifierInput[] = [];\n\n this.iterate().iterate(([id, value]) =>\n {\n if (type.is( id ))\n {\n let start: Day = type.start( id );\n\n if (start.sameTime( fromTime ))\n {\n moveIds.push( id );\n }\n }\n });\n\n let moved: number = 0;\n\n for (let id of moveIds)\n {\n let value: T = this.map[ id ];\n let start: Day = type.start( id );\n let newStart: Day = start.withTime( toTime );\n let newId: IdentifierInput = type.get( newStart );\n\n if (!this.map[ newId ])\n {\n this.map[ newId ] = value;\n delete this.map[ id ];\n moved++;\n }\n }\n\n return moved;\n }\n\n /**\n * Sets the value/modification in this map given a day, the value, and the\n * identifier type.\n *\n * @param day The day to take an identifier from.\n * @param value The value/modification to set.\n * @param type The identifier type.\n */\n public set(day: Day, value: T, type: Identifier): this\n {\n this.map[ type.get( day ) ] = value;\n\n return this;\n }\n\n /**\n * Removes the value/modification from this modifier based on the identifier\n * pulled from the day.\n *\n * @param day The day to take an identifier from.\n * @param type The identifier type.\n */\n public unset(day: Day, type: Identifier): this\n {\n delete this.map[ type.get( day ) ];\n\n return this;\n }\n\n /**\n * Iterates through the modifiers passing the identifier and the related value.\n *\n * @returns A new instance of an [[Iterator]].\n */\n public iterate(): Iterator<[IdentifierInput, T]>\n {\n return new Iterator<[IdentifierInput, T]>(iterator =>\n {\n let map = this.map;\n\n for (let rawId in map)\n {\n let asNumber: number = parseInt( rawId );\n let validAsNumber: boolean = asNumber + '' === rawId;\n let id: IdentifierInput = validAsNumber ? asNumber : rawId;\n\n switch (iterator.act([id, map[ rawId ]]))\n {\n case IteratorAction.Stop:\n return;\n case IteratorAction.Remove:\n delete map[ rawId ];\n break;\n }\n }\n });\n }\n\n /**\n * Queries the modifier for all values/modifications which fall in the time\n * span that the given identifier represents. All identifiers and their value\n * are passed to the given callback.\n *\n * @param prefix The identifier\n * @returns A new instance of an [[Iterator]].\n */\n public query(query: IdentifierInput): Iterator<[IdentifierInput, T]>\n {\n return this.iterate()\n .filter(([id, value]) => Identifier.contains( query, id ));\n ;\n }\n\n /**\n * Returns all identifiers stored in this modifier.\n */\n public identifiers(filter?: (value: T, id: IdentifierInput) => boolean): Iterator\n {\n return this.iterate()\n .filter(([id, value]) => !filter || filter( value, id ))\n .map(([id, ]) => id)\n ;\n }\n\n /**\n * Builds a list of spans and the associated values. The spans are calculated\n * from the identiier key via [[Identifier.span]].\n *\n * @param endInclusive If the end date in the spans should be the last\n * millisecond of the timespan or the first millisecond of the next.\n * @returns An array of spans calculated from the identifiers with the\n * associated values/modifications.\n */\n public spans(endInclusive: boolean = false): Iterator>\n {\n return this.iterate()\n .map(([id, value]) =>\n {\n let type: Identifier = Identifier.find(id);\n\n if (type)\n {\n let span = type.span( id, endInclusive );\n\n return { span, value };\n }\n })\n ;\n }\n\n /**\n * Builds a list of the descriptions of the identifiers in this modifier.\n *\n * @param short If the description should use shorter language or longer.\n * @returns The built list of descriptions.\n */\n public describe(short: boolean = false): Iterator\n {\n return this.iterate()\n .map( ([id, ]) =>\n {\n let type: Identifier = Identifier.find( id );\n\n if (type)\n {\n return type.describe( id, short );\n }\n })\n ;\n }\n\n /**\n * Builds a map of the values/modifications keyed by the descripton of the\n * identifier computed via [[Identifier.describe]].\n *\n * @param short If the description should use shorter language or longer.\n * @returns The built map of description to values/modifications.\n */\n public describeMap(short: boolean = false): ScheduleModifierDescription\n {\n let map = this.map;\n let out: ScheduleModifierDescription = {};\n\n for (let id in map)\n {\n let type: Identifier = Identifier.find(id);\n\n if (type)\n {\n out[ type.describe( id, short ) ] = map[ id ];\n }\n }\n\n return out;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/ScheduleModifier.ts","\nimport { Functions as fn } from './Functions';\nimport { FrequencyValue, FrequencyCheck, FrequencyValueEvery, FrequencyValueOneOf } from './Frequency';\nimport { Day, DayInput, DurationInput, DayProperty } from './Day';\nimport { Identifier, IdentifierInput } from './Identifier';\nimport { DaySpan } from './DaySpan';\nimport { Constants } from './Constants';\nimport { Parse } from './Parse';\nimport { Time, TimeInput } from './Time';\nimport { Suffix } from './Suffix';\nimport { ScheduleModifier, ScheduleModifierSpan } from './ScheduleModifier';\nimport { Units } from './Units';\nimport { Iterator, IteratorAction } from './Iterator';\n\n// @ts-ignore\nimport * as moment from 'moment';\n\n\n/**\n * A tuple which identifies an event on the schedule. The tuple contains the\n * total span of the event occurrence, the day of the event (could be the start\n * day, end day, or any days in between for multi-day events) as well as the\n * identifier for the event.\n */\nexport type ScheduleEventTuple = [DaySpan, Day, IdentifierInput];\n\n/**\n * Input given by a user which describes an event schedule.\n *\n * @typeparam M The type of metadata stored in the schedule.\n */\nexport interface ScheduleInput\n{\n\n /**\n * @see [[Schedule.start]]\n */\n start?: DayInput;\n\n /**\n * @see [[Schedule.end]]\n */\n end?: DayInput;\n\n /**\n * A shortcut to setting the [[Schedule.start]], [[Schedule.end]],\n * [[Schedule.year]], [[Schedule.month]], and [[Schedule.dayOfMonth]].\n */\n on?: DayInput;\n\n /**\n * @see [[Schedule.times]]\n */\n times?: TimeInput[];\n\n /**\n * @see [[Schedule.duration]]\n */\n duration?: number;\n\n /**\n * @see [[Schedule.durationUnit]]\n */\n durationUnit?: DurationInput;\n\n /**\n * An array of days or identifiers which should be excluded from the schedule.\n *\n * @see [[Schedule.exclude]]\n */\n exclude?: (Day | IdentifierInput)[];\n\n /**\n * An array of days or identifiers which should be included in the schedule.\n *\n * @see [[Schedule.include]]\n */\n include?: (Day | IdentifierInput)[];\n\n /**\n * An array of days or identifiers which should be canceled in the schedule.\n *\n * @see [[Schedule.cancel]]\n */\n cancel?: (Day | IdentifierInput)[];\n\n /**\n * @see [[Schedule.meta]]\n */\n meta?: { [identifier: string]: M };\n\n /**\n * @see [[Schedule.month]]\n */\n month?: FrequencyValue;\n\n /**\n * @see [[Schedule.year]]\n */\n year?: FrequencyValue;\n\n /**\n * @see [[Schedule.week]]\n */\n week?: FrequencyValue;\n\n /**\n * @see [[Schedule.dayOfWeek]]\n */\n dayOfWeek?: FrequencyValue;\n\n /**\n * @see [[Schedule.dayOfMonth]]\n */\n dayOfMonth?: FrequencyValue;\n\n /**\n * @see [[Schedule.lastDayOfMonth]]\n */\n lastDayOfMonth?: FrequencyValue;\n\n /**\n * @see [[Schedule.dayOfYear]]\n */\n dayOfYear?: FrequencyValue;\n\n /**\n * @see [[Schedule.weekOfYear]]\n */\n weekOfYear?: FrequencyValue;\n\n /**\n * @see [[Schedule.weekspanOfYear]]\n */\n weekspanOfYear?: FrequencyValue;\n\n /**\n * @see [[Schedule.fullWeekOfYear]]\n */\n fullWeekOfYear?: FrequencyValue;\n\n /**\n * @see [[Schedule.lastWeekspanOfYear]]\n */\n lastWeekspanOfYear?: FrequencyValue;\n\n /**\n * @see [[Schedule.lastFullWeekOfYear]]\n */\n lastFullWeekOfYear?: FrequencyValue;\n\n /**\n * @see [[Schedule.weekOfMonth]]\n */\n weekOfMonth?: FrequencyValue;\n\n /**\n * @see [[Schedule.weekspanOfMonth]]\n */\n weekspanOfMonth?: FrequencyValue;\n\n /**\n * @see [[Schedule.fullWeekOfMonth]]\n */\n fullWeekOfMonth?: FrequencyValue;\n\n /**\n * @see [[Schedule.lastWeekspanOfMonth]]\n */\n lastWeekspanOfMonth?: FrequencyValue;\n\n /**\n * @see [[Schedule.lastFullWeekOfMonth]]\n */\n lastFullWeekOfMonth?: FrequencyValue;\n\n /**\n * The function to parse metadata with.\n */\n parseMeta?: (input: any) => M;\n}\n\n\n/**\n * A class which describes when an event occurs over what time and if it repeats.\n *\n * @typeparam M The type of metadata stored in the schedule.\n */\nexport class Schedule\n{\n\n /**\n * The earliest an event can occur in the schedule, or `null` if there are no\n * restrictions when the earliest event can occur. This day is inclusive.\n */\n public start: Day;\n\n /**\n * The latest an event can occur in the schedule, or `null` if there are no\n * restrictions when the latest event can occur. This day is inclusive.\n */\n public end: Day;\n\n /**\n * The length of events in this schedule.\n */\n public duration: number;\n\n /**\n * The unit which describes the duration of the event.\n */\n public durationUnit: DurationInput;\n\n /**\n * The times at which the events occur on the days they should. If there are\n * no times specified its assumed to be an all day event - potentially over\n * multiple days or weeks based on [[Schedule.duration]] and\n * [[Schedule.durationUnit]].\n */\n public times: Time[];\n\n /**\n * The number of days an event in this schedule lasts PAST the starting day.\n * If this is a full day event with a duration greater than zero this value\n * will be greater than one. If this event occurs at a specific time with a\n * given duration that is taken into account and if it passes over into the\n * next day this value will be greater than one. This value is used to look\n * back in time when trying to figure out what events start or overlap on a\n * given day.\n */\n public durationInDays: number;\n\n /**\n * A set of identifiers which mark what days or times are excluded on the\n * schedule. This typically represents the set of event occurrences removed.\n */\n public exclude: ScheduleModifier;\n\n /**\n * A set of identifiers which mark what days or times are included outside\n * the normal series of days on the schedule. This typically represents\n * an event occurrence which is moved so its added to the exclude and include\n * sets.\n */\n public include: ScheduleModifier;\n\n /**\n * A set of identifiers which mark what days, times, weeks, months, etc that\n * should have all event occurrences cancelled.\n */\n public cancel: ScheduleModifier;\n\n /**\n * A map of metadata keyed by an identifier. The metadata is placed in\n * [[CalendarEvent]].\n */\n public meta: ScheduleModifier;\n\n /**\n * How frequent the event occurs based on [[Day.dayOfWeek]].\n */\n public dayOfWeek: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.dayOfMonth]].\n */\n public dayOfMonth: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.lastDayOfMonth]].\n */\n public lastDayOfMonth: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.dayOfYear]].\n */\n public dayOfYear: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.month]].\n */\n public month: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.week]].\n */\n public week: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.weekOfYear]].\n */\n public weekOfYear: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.weekspanOfYear]].\n */\n public weekspanOfYear: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.fullWeekOfYear]].\n */\n public fullWeekOfYear: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.lastWeekspanOfYear]].\n */\n public lastWeekspanOfYear: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.lastFullWeekOfYear]].\n */\n public lastFullWeekOfYear: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.weekOfMonth]].\n */\n public weekOfMonth: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.weekspanOfMonth]].\n */\n public weekspanOfMonth: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.fullWeekOfMonth]].\n */\n public fullWeekOfMonth: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.lastWeekspanOfMonth]].\n */\n public lastWeekspanOfMonth: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.lastFullWeekOfMonth]].\n */\n public lastFullWeekOfMonth: FrequencyCheck;\n\n /**\n * How frequent the event occurs based on [[Day.year]].\n */\n public year: FrequencyCheck;\n\n /**\n * The array of frequency functions which had valid frequencies.\n *\n * @see [[FrequencyCheck.given]]\n */\n public checks: FrequencyCheck[];\n\n\n /**\n * Creates a schedule based on the given input.\n *\n * @param input The input which describes the schedule of events.\n */\n public constructor(input?: ScheduleInput)\n {\n this.exclude = new ScheduleModifier();\n this.include = new ScheduleModifier();\n this.cancel = new ScheduleModifier();\n this.meta = new ScheduleModifier();\n\n if (fn.isDefined(input))\n {\n this.set(input);\n }\n }\n\n /**\n * Sets the schedule with the given input.\n *\n * @param input The input which describes the schedule of events.\n * @param parseMeta A function to use when parsing meta input into the desired type.\n * @see [[Parse.schedule]]\n */\n public set(input: ScheduleInput,\n parseMeta: (input: any) => M = (x => x)): this\n {\n Parse.schedule(input, fn.coalesce( input.parseMeta, parseMeta ), this);\n\n return this;\n }\n\n /**\n * Returns the last event time specified or `undefined` if this schedule is\n * for an all day event.\n */\n public get lastTime(): Time\n {\n return this.times[ this.times.length - 1 ];\n }\n\n /**\n * The [[Identifier]] for this schedule. Either [[Identifier.Day]] or\n * [[Identifier.Time]].\n */\n public get identifierType(): Identifier\n {\n return this.isFullDay() ? Identifier.Day : Identifier.Time;\n }\n\n /**\n * Updates the [[Schedule.durationInDays]] variable based on the\n * [[Schedule.lastTime]] (if any), the [[Schedule.duration]] and it's\n * [[Schedule.durationUnit]].\n */\n public updateDurationInDays(): this\n {\n let start: number = this.lastTime ? this.lastTime.toMilliseconds() : 0;\n let duration: number = this.duration * (Constants.DURATION_TO_MILLIS[ this.durationUnit ] || 0);\n let exclude: number = Constants.MILLIS_IN_DAY;\n let day: number = Constants.MILLIS_IN_DAY;\n\n this.durationInDays = Math.max(0, Math.ceil((start + duration - exclude) / day));\n\n return this;\n }\n\n /**\n * Updates [[Schedule.checks]] based on the frequencies that were specified\n * in the schedule input.\n */\n public updateChecks(): this\n {\n this.checks = Parse.givenFrequency([\n this.year,\n this.month,\n this.week,\n this.weekOfYear,\n this.fullWeekOfYear,\n this.weekspanOfYear,\n this.lastFullWeekOfYear,\n this.lastWeekspanOfYear,\n this.weekOfMonth,\n this.weekspanOfMonth,\n this.fullWeekOfMonth,\n this.lastWeekspanOfMonth,\n this.lastFullWeekOfMonth,\n this.dayOfWeek,\n this.dayOfMonth,\n this.lastDayOfMonth,\n this.dayOfYear\n ]);\n\n return this;\n }\n\n /**\n * Determines whether the given day lies between the earliest and latest\n * valid day in the schedule.\n *\n * @param day The day to test.\n * @returns `true` if the day lies in the schedule, otherwise `false`.\n * @see [[Schedule.start]]\n * @see [[Schedule.end]]\n */\n public matchesSpan(day: Day): boolean\n {\n return (this.start === null || day.isSameOrAfter(this.start)) &&\n (this.end === null || day.isBefore(this.end));\n }\n\n /**\n * Determines whether the given range overlaps with the earliest and latest\n * valid days in this schedule (if any).\n *\n * @param start The first day in the range.\n * @param end The last day in the range.\n * @returns `true` if the range intersects with the schedule, otherwise `false`.\n * @see [[Schedule.start]]\n * @see [[Schedule.end]]\n */\n public matchesRange(start: Day, end: Day): boolean\n {\n if (this.start && end.isBefore(this.start))\n {\n return false;\n }\n\n if (this.end && start.isAfter(this.end))\n {\n return false;\n }\n\n return true;\n }\n\n /**\n * Determines whether the given day is explicitly excluded in the schedule.\n *\n * @param day The day to test.\n * @param lookAtTime lookAtTime If the specific time of the given day should\n * be looked at.\n * @returns `true` if the day was excluded, otherwise `false`.\n */\n public isExcluded(day: Day, lookAtTime: boolean = true): boolean\n {\n return this.exclude.get( day, false, lookAtTime );\n }\n\n /**\n * Determines whether the given day is explicitly included in the schedule.\n *\n * @param day The day to test.\n * @param lookAtTime lookAtTime If the specific time of the given day should\n * be looked at.\n * @returns `true` if the day is NOT explicitly included, otherwise `false`.\n */\n public isIncluded(day: Day, lookAtTime: boolean = true): boolean\n {\n return this.include.get( day, false, lookAtTime );\n }\n\n /**\n * Determines whether the given day is cancelled in the schedule.\n *\n * @param day The day to test.\n * @param lookAtTime lookAtTime If the specific time of the given day should\n * be looked at.\n * @returns `true` if the day was cancelled, otherwise `false`.\n */\n public isCancelled(day: Day, lookAtTime: boolean = true): boolean\n {\n return this.cancel.get( day, false, lookAtTime );\n }\n\n /**\n * Returns the metadata for the given day or `null` if there is none.\n *\n * @param day The day to return the metadata for.\n * @param otherwise The data to return if none exists for the given day.\n * @param lookAtTime lookAtTime If the specific time of the given day should\n * be looked at.\n * @returns The metadata or `null`.\n */\n public getMeta(day: Day, otherwise: M = null, lookAtTime: boolean = true): M\n {\n return this.meta.get( day, otherwise, lookAtTime );\n }\n\n /**\n * Returns all metadata for the given day or an empty array if there is none.\n *\n * @param day The day to return the metadata for.\n * @returns The array of metadata ordered by priority or an empty array.\n */\n public getMetas(day: Day): M[]\n {\n return this.meta.getAll( day );\n }\n\n /**\n * Returns whether the events in the schedule are all day long or start at\n * specific times. Full day events start at the start of the day and end at\n * the start of the next day (if the duration = `1` and durationUnit = 'days').\n * Full day events have no times specified and should have a durationUnit of\n * either `days` or `weeks`.\n */\n public isFullDay(): boolean\n {\n return this.times.length === 0;\n }\n\n /**\n * Sets whether this schedule is a full day event if it is not already. If\n * this schedule is a full day event and `false` is passed to this function\n * a single timed event will be added based on `defaultTime`. If this schedule\n * has timed events and `true` is passed to make the schedule full day, the\n * timed events are removed from this schedule. If the durationUnit is not the\n * expected unit based on the new full day flag - the duration is reset to 1\n * and the duration unit is set to the expected unit.\n *\n * @param fullDay Whether this schedule should represent a full day event or\n * timed events.\n * @param defaultTime If `fullDay` is `false` and this schedule is currently\n * a full day event - this time will be used as the time of the first event.\n */\n public setFullDay(fullDay: boolean = true, defaultTime: TimeInput = '08:00'): this\n {\n if (fullDay !== this.isFullDay())\n {\n if (fullDay)\n {\n this.times = [];\n\n if (this.durationUnit !== 'days' && this.durationUnit !== 'day')\n {\n this.duration = 1;\n this.durationUnit = 'days';\n }\n }\n else\n {\n this.times = [Parse.time( defaultTime )];\n\n if (this.durationUnit !== 'hours' && this.durationUnit !== 'hour')\n {\n this.duration = 1;\n this.durationUnit = 'hours';\n }\n }\n }\n\n return this;\n }\n\n /**\n * Adjusts the [[Schedule.start]] and [[Schedule.end]] dates specified on this\n * schedule if this schedule represents a single event and the `start` and\n * `end` are already set or `addSpan` is `true`.\n *\n * @param addSpan If `true`, the `start` and `end` dates will always be\n * adjusted if this schedule is a single event.\n */\n public adjustDefinedSpan(addSpan: boolean = false): this\n {\n let single: DaySpan = this.getSingleEventSpan();\n\n if (single && (addSpan || (this.start && this.end)))\n {\n this.start = single.start.start();\n this.end = single.end.end();\n }\n\n return this;\n }\n\n /**\n * Returns a span of time for a schedule with full day events starting on the\n * start of the given day with the desired duration in days or weeks.\n *\n * @param day The day the span starts on.\n * @returns The span of time starting on the given day.\n */\n public getFullSpan(day: Day): DaySpan\n {\n let start: Day = day.start();\n let end: Day = start.add( this.duration, this.durationUnit );\n\n return new DaySpan( start, end );\n }\n\n /**\n * Returns a span of time starting on the given day at the given day with the\n * duration specified on this schedule.\n *\n * @param day The day the span starts on.\n * @param time The time of day the span starts.\n * @returns The span of time calculated.\n */\n public getTimeSpan(day: Day, time: Time): DaySpan\n {\n let start: Day = day.withTime( time );\n let end: Day = start.add( this.duration, this.durationUnit );\n\n return new DaySpan( start, end );\n }\n\n /**\n * Determines whether the given day is a day on the schedule for the start\n * of an event. If an event is more than one day and the day given is not the\n * start this may return `false`. This does not test for event instances\n * that exist through [[Schedule.include]].\n *\n * @param day The day to test.\n * @returns `true` if the day marks the start of an event on the schedule.\n * @see [[Schedule.isIncluded]]\n * @see [[Schedule.isFullyExcluded]]\n * @see [[Schedule.matchesSpan]]\n */\n public matchesDay(day: Day): boolean\n {\n if (this.isIncluded( day, false ))\n {\n return true;\n }\n\n if (!this.matchesSpan( day ) || this.isFullyExcluded( day ))\n {\n return false;\n }\n\n for (let check of this.checks)\n {\n if (!check( day[ check.property ] ))\n {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Determines whether the given day has events added through\n * [[Schedule.include]].\n *\n * @param day The day to look for included times on.\n * @returns `true` if there are included event instances on the given day,\n * otherwise `false`.\n */\n public hasIncludedTime(day: Day): boolean\n {\n return !this.iterateIncludeTimes( day ).isEmpty();\n }\n\n /**\n * Determines whether the given day is fully excluded from the schedule. A\n * fully excluded day is one that has a day-wide exclusion, or the schedule\n * is not an all-day event and all times in the schedule are specifically\n * excluded.\n *\n * @param day The day to test.*\n * @returns `true` if he day is fully excluded, otherwise `false`.\n */\n public isFullyExcluded(day: Day): boolean\n {\n if (this.isExcluded(day, false))\n {\n return true;\n }\n\n if (this.isFullDay())\n {\n return false;\n }\n\n for (let time of this.times)\n {\n if (!this.isExcluded( day.withTime( time ) ))\n {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Finds the next day an event occurs on the schedule given a day to start,\n * optionally including it, and a maximum number of days to look ahead.\n *\n * @param day The day to start to search from.\n * @param includeDay If the given day should be included in the search.\n * @param lookAhead The maximum number of days to look ahead from the given\n * day for event occurrences.\n * @returns The next day on the schedule or `null` if none exists.\n */\n public nextDay(day: Day, includeDay: boolean = false, lookAhead: number = 366): Day\n {\n return this.iterateDaycast(day, 1, true, includeDay, lookAhead).first();\n }\n\n /**\n * Finds the next specified number of days that events occur on the schedule\n * given a day to start, optionally including it, and a maximum number of days\n * to look ahead.\n *\n * @param day The day to start to search from.\n * @param max The maximum number of days to return in the result.\n * @param includeDay If the given day should be included in the search.\n * @param lookAhead The maximum number of days to look ahead from the given\n * day for event occurrences.\n * @returns An array containing the next days on the schedule that events\n * start or an empty array if there are none.\n */\n public nextDays(day: Day, max: number, includeDay: boolean = false, lookAhead: number = 366): Iterator\n {\n return this.iterateDaycast(day, max, true, includeDay, lookAhead);\n }\n\n /**\n * Finds the previous day an event occurs on the schedule given a day to start,\n * optionally including it, and a maximum number of days to look behind.\n *\n * @param day The day to start to search from.\n * @param includeDay If the given day should be included in the search.\n * @param lookBack The maximum number of days to look behind from the given\n * day for event occurrences.\n * @returns The previous day on the schedule or `null` if none exists.\n */\n public prevDay(day: Day, includeDay: boolean = false, lookBack: number = 366): Day\n {\n return this.iterateDaycast(day, 1, false, includeDay, lookBack).first();\n }\n\n /**\n * Finds the previous specified number of days that events occur on the\n * schedule given a day to start, optionally including it, and a maximum\n * number of days to look behind.\n *\n * @param day The day to start to search from.\n * @param max The maximum number of days to return in the result.\n * @param includeDay If the given day should be included in the search.\n * @param lookAhead The maximum number of days to look behind from the given\n * day for event occurrences.\n * @returns An array containing the previous days on the schedule that events\n * start or an empty array if there are none.\n */\n public prevDays(day: Day, max: number, includeDay: boolean = false, lookBack: number = 366): Iterator\n {\n return this.iterateDaycast(day, max, false, includeDay, lookBack);\n }\n\n /**\n * Iterates over days that events start in the schedule given a day to start,\n * a maximum number of days to find, and a direction to look.\n *\n * @param day The day to start to search from.\n * @param max The maximum number of days to iterate.\n * @param next If `true` this searches forward, otherwise `false` is backwards.\n * @param includeDay If the given day should be included in the search.\n * @param lookup The maximum number of days to look through from the given\n * day for event occurrences.\n * @returns A new Iterator for the days found in the cast.\n * @see [[Schedule.iterateSpans]]\n */\n public iterateDaycast(day: Day, max: number, next: boolean, includeDay: boolean = false, lookup: number = 366): Iterator\n {\n return new Iterator(iterator =>\n {\n let iterated: number = 0;\n\n for (let days = 0; days < lookup; days++)\n {\n if (!includeDay || days > 0)\n {\n day = next ? day.next() : day.prev();\n }\n\n if (!this.iterateSpans( day, false ).isEmpty())\n {\n let action: IteratorAction = iterator.act( day );\n\n if (action === IteratorAction.Stop || ++iterated >= max)\n {\n return;\n }\n }\n }\n });\n }\n\n /**\n * Iterates through the spans (event instances) that start on or covers the\n * given day.\n *\n * @param day The day to look for spans on.\n * @param covers If `true` spans which span multiple days will be looked at\n * to see if they intersect with the given day, otherwise `false` will\n * only look at the given day for the start of events.\n * @returns A new Iterator for all the spans found.\n */\n public iterateSpans(day: Day, covers: boolean = false): Iterator\n {\n return new Iterator(iterator =>\n {\n let current: Day = day;\n let lookBehind: number = covers ? this.durationInDays : 0;\n\n // If the events start at the end of the day and may last multiple days....\n if (this.isFullDay())\n {\n // If the schedule has events which span multiple days we need to look\n // backwards for events that overlap with the given day.\n while (lookBehind >= 0)\n {\n // If the current day matches the schedule rules...\n if (this.matchesDay( current ))\n {\n // Build a DaySpan with the given start day and the schedules duration.\n let span: DaySpan = this.getFullSpan( current );\n\n // If that dayspan intersects with the given day, it's a winner!\n if (span.matchesDay( day ))\n {\n switch (iterator.act( span ))\n {\n case IteratorAction.Stop:\n return;\n }\n }\n }\n\n current = current.prev();\n lookBehind--;\n }\n }\n // This schedule has events which start at certain times\n else\n {\n // If the schedule has events which span multiple days we need to look\n // backwards for events that overlap with the given day.\n while (lookBehind >= 0)\n {\n // If the current day matches the schedule rules...\n if (this.matchesDay( current ))\n {\n // Iterate through each daily occurrence in the schedule...\n for (let time of this.times)\n {\n let span: DaySpan = this.getTimeSpan( current, time );\n\n // If the event intersects with the given day and the occurrence\n // has not specifically been excluded...\n if (span.matchesDay( day ) && !this.isExcluded( span.start, true ))\n {\n switch (iterator.act( span ))\n {\n case IteratorAction.Stop:\n return;\n }\n }\n }\n }\n else\n {\n // The current day does not match the schedule, however the schedule\n // might have moved/random event occurrents on the current day.\n // We only want the ones that overlap with the given day.\n this.iterateIncludeTimes(current, day).iterate((span, timeIterator) =>\n {\n switch (iterator.act( span ))\n {\n case IteratorAction.Stop:\n timeIterator.stop();\n break;\n }\n })\n\n if (iterator.action === IteratorAction.Stop)\n {\n return;\n }\n }\n\n current = current.prev();\n lookBehind--;\n }\n }\n });\n }\n\n /**\n * Determines if the given day is on the schedule and the time specified on\n * the day matches one of the times on the schedule.\n *\n * @param day The day to test.\n * @returns `true` if the day and time match the schedule, otherwise false.\n */\n public matchesTime(day: Day): boolean\n {\n return !!this.iterateSpans( day, true ).first( span => span.start.sameMinute( day ) );\n }\n\n /**\n * Determines if the given day is covered by this schedule. A schedule can\n * specify events that span multiple days - so even though the day does not\n * match the starting day of a span - it can be a day that is within the\n * schedule.\n *\n * @param day The day to test.\n * @returns `true` if the day is covered by an event on this schedule,\n * otherwise `false`.\n */\n public coversDay(day: Day): boolean\n {\n return !this.iterateSpans( day, true ).isEmpty();\n }\n\n /**\n * Determines if the given timestamp lies in an event occurrence on this\n * schedule.\n *\n * @param day The timestamp to test against the schedule.\n * @return `true` if the timestamp lies in an event occurrent start and end\n * timestamps, otherwise `false`.\n */\n public coversTime(day: Day): boolean\n {\n return !!this.iterateSpans( day, true ).first( span => span.contains( day ) );\n }\n\n /**\n * Sets the frequency for the given property. This does not update the\n * [[Schedule.checks]] array, the [[Schedule.updateChecks]] function needs\n * to be called.\n *\n * @param property The frequency to update.\n * @param frequency The new frequency.\n */\n public setFrequency(property: DayProperty, frequency?: FrequencyValue): this\n {\n this[ property ] = Parse.frequency( frequency, property );\n\n return this;\n }\n\n /**\n * Changes the exclusion status of the event at the given time. By default\n * this excludes this event - but `false` may be passed to undo an exclusion.\n *\n * @param time The start time of the event occurrence to exclude or include.\n * @param excluded Whether the event should be excluded.\n */\n public setExcluded(time: Day, excluded: boolean = true): this\n {\n let type: Identifier = this.identifierType;\n\n this.exclude.set( time, excluded, type );\n this.include.set( time, !excluded, type );\n\n return this;\n }\n\n /**\n * Changes the cancellation status of the event at the given start time. By\n * default this cancels the event occurrence - but `false` may be passed to\n * undo a cancellation.\n *\n * @param time The start time of the event occurrence to cancel or uncancel.\n * @param cancelled Whether the event should be cancelled.\n */\n public setCancelled(time: Day, cancelled: boolean = true): this\n {\n this.cancel.set( time, cancelled, this.identifierType );\n\n return this;\n }\n\n /**\n * Moves the event instance starting at `fromTime` to `toTime` optionally\n * placing `meta` in the schedules metadata for the new time `toTime`.\n * If this schedule has a single event ([[Schedule.isSingleEvent]]) then the\n * only value needed is `toTime` and not `fromTime`.\n *\n * @param toTime The timestamp of the new event.\n * @param fromTime The timestamp of the event on the schedule to move if this\n * schedule generates multiple events.\n * @param meta The metadata to place in the schedule for the given `toTime`.\n * @returns `true` if the schedule had the event moved, otherwise `false`.\n */\n public move(toTime: Day, fromTime?: Day, meta?: M): boolean\n {\n if (!this.moveSingleEvent( toTime ) && fromTime)\n {\n return this.moveInstance( fromTime, toTime, meta );\n }\n\n return false;\n }\n\n /**\n * Moves a time specified in this schedule to the given time, adjusting\n * any cancelled event instances, metadata, and any excluded and included\n * event instances.\n *\n * @param fromTime The time to move.\n * @param toTime The new time in the schedule.\n * @returns `true` if time was moved, otherwise `false`.\n */\n public moveTime(fromTime: Time, toTime: Time): boolean\n {\n let found: boolean = false;\n\n for (let i = 0; i < this.times.length && !found; i++)\n {\n if (found = fromTime.matches( this.times[ i ] ))\n {\n this.times.splice( i, 1, toTime );\n }\n }\n\n if (found)\n {\n this.include.moveTime( fromTime, toTime );\n this.exclude.moveTime( fromTime, toTime );\n this.cancel.moveTime( fromTime, toTime );\n this.meta.moveTime( fromTime, toTime );\n\n this.adjustDefinedSpan( false );\n }\n\n return found;\n }\n\n /**\n * Moves the event instance starting at `fromTime` to `toTime` optionally\n * placing `meta` in the schedules metadata for the new time `toTime`. A move\n * is accomplished by excluding the current event and adding an inclusion of\n * the new day & time.\n *\n * @param fromTime The timestamp of the event on the schedule to move.\n * @param toTime The timestamp of the new event.\n * @param meta The metadata to place in the schedule for the given `toTime`.\n * @returns `true`.\n * @see [[Schedule.move]]\n */\n public moveInstance(fromTime: Day, toTime: Day, meta?: M): boolean\n {\n let type: Identifier = this.identifierType;\n\n this.exclude.set( fromTime, true, type );\n this.exclude.set( toTime, false, type );\n\n this.include.set( toTime, true, type );\n this.include.set( fromTime, false, type );\n\n if (fn.isValue( meta ))\n {\n this.meta.unset( fromTime, type );\n this.meta.set( toTime, meta, type );\n }\n\n return true;\n }\n\n /**\n * Moves the single event in this schedule to the given day/time if applicable.\n * If this schedule is not a single event schedule then `false` is returned.\n * If this schedule is a timed event the time will take the time of the given\n * `toTime` of `takeTime` is `true`.\n *\n * @param toTime The time to move the single event to.\n * @param takeTime If this schedule has a single timed event, should the time\n * of the event be changed to the time of the given `toTime`?\n * @returns `true` if the schedule was adjusted, otherwise `false`.\n * @see [[Schedule.move]]\n */\n public moveSingleEvent(toTime: Day, takeTime: boolean = true): boolean\n {\n if (!this.isSingleEvent())\n {\n return false;\n }\n\n for (let check of this.checks)\n {\n let prop: DayProperty = check.property;\n let value = toTime[ prop ];\n let frequency: FrequencyCheck = Parse.frequency( [value], prop );\n\n this[ prop ] = frequency;\n }\n\n if (this.times.length === 1 && takeTime)\n {\n this.times = [toTime.asTime()];\n }\n\n this.updateChecks();\n\n let span: DaySpan = this.getSingleEventSpan();\n\n if (this.start)\n {\n this.start = span.start.start();\n }\n\n if (this.end)\n {\n this.end = span.end.end();\n }\n\n return true;\n }\n\n /**\n * Returns the span of the single event in this schedule if it's that type of\n * schedule, otherwise `null` is returned.\n *\n * @returns A span of the single event, otherwise `null`.\n * @see [[Schedule.isSingleEvent]]\n */\n public getSingleEventSpan(): DaySpan\n {\n if (!this.isSingleEvent())\n {\n return null;\n }\n\n let startOfYear: Day = Day.build( this.year.input[0], 0, 1 );\n let start: Day = this.iterateDaycast( startOfYear, 1, true, true, 366 ).first();\n\n if (!start)\n {\n return null;\n }\n\n return this.isFullDay() ?\n this.getFullSpan( start ) :\n this.getTimeSpan( start, this.times[ 0 ] );\n }\n\n /**\n * Determines whether this schedule produces a single event, and no more.\n * If this schedule has any includes, it's assumed to be a multiple event\n * schedule. A single event can be detected in the following scenarios where\n * each frequency has a single occurrence (see [[Schedule.isSingleFrequency]]).\n *\n * - year, day of year\n * - year, month, day of month\n * - year, month, week of month, day of week\n * - year, week of year, day of week\n *\n * @returns `true` if this schedule produces a single event, otherwise `false`.\n */\n public isSingleEvent(): boolean\n {\n // 0 = full day, 1 = once a day, 1+ = multiple events a day\n if (this.times.length > 1)\n {\n return false;\n }\n\n // Let's assume if there are includes, this is not a single event.\n if (!this.include.isEmpty())\n {\n return false;\n }\n\n // If this can occur on multiple years, not a single event.\n if (!this.isSingleYear())\n {\n return false;\n }\n\n // If this is a specific year and day of the year: single!\n if (this.isSingleDayOfYear())\n {\n return true;\n }\n\n // If this is a specific year, month, and day of month: single!\n if (this.isSingleMonth() && this.isSingleDayOfMonth())\n {\n return true;\n }\n\n // If this is a specific year, month, week of the month, day of the week: single!\n if (this.isSingleMonth() && this.isSingleWeekOfMonth() && this.isSingleDayOfWeek())\n {\n return true;\n }\n\n // If this is a specific year, week of the year, day of the week: single!\n if (this.isSingleWeekOfYear() && this.isSingleDayOfWeek())\n {\n return true;\n }\n\n // Doesn't look like a single event.\n return false;\n }\n\n /**\n * @returns `true` if this schedule produces events only in a specific year.\n * @see [[Schedule.year]]\n */\n public isSingleYear(): boolean\n {\n return this.isSingleFrequency( this.year );\n }\n\n /**\n * @returns `true` if this schedule produces events only in a specific month.\n * @see [[Schedule.month]]\n */\n public isSingleMonth(): boolean\n {\n return this.isSingleFrequency( this.month );\n }\n\n /**\n * @returns `true` if this schedule produces events only in a specific day of\n * the month.\n * @see [[Schedule.dayOfMonth]]\n * @see [[Schedule.lastDayOfMonth]]\n */\n public isSingleDayOfMonth(): boolean\n {\n return this.isSingleFrequency( this.dayOfMonth ) ||\n this.isSingleFrequency( this.lastDayOfMonth );\n }\n\n /**\n * @returns `true` if this schedule produces events only in a specific day of\n * the week.\n * @see [[Schedule.dayOfWeek]]\n */\n public isSingleDayOfWeek(): boolean\n {\n return this.isSingleFrequency( this.dayOfWeek );\n }\n\n /**\n * @returns `true` if this schedule produces events only in a specific day of\n * the year.\n * @see [[Schedule.dayOfYear]]\n */\n public isSingleDayOfYear(): boolean\n {\n return this.isSingleFrequency( this.dayOfYear );\n }\n\n /**\n * @returns `true` if this schedule produces events only in a specific week of\n * the month.\n * @see [[Schedule.weekspanOfMonth]]\n * @see [[Schedule.fullWeekOfMonth]]\n * @see [[Schedule.weekOfMonth]]\n * @see [[Schedule.lastFullWeekOfMonth]]\n * @see [[Schedule.lastWeekspanOfMonth]]\n */\n public isSingleWeekOfMonth(): boolean\n {\n return this.isSingleFrequency( this.weekspanOfMonth ) ||\n this.isSingleFrequency( this.fullWeekOfMonth ) ||\n this.isSingleFrequency( this.weekOfMonth ) ||\n this.isSingleFrequency( this.lastFullWeekOfMonth ) ||\n this.isSingleFrequency( this.lastWeekspanOfMonth );\n }\n\n /**\n * @returns `true` if this schedule produces events only in a specific week of\n * the year.\n * @see [[Schedule.weekspanOfYear]]\n * @see [[Schedule.fullWeekOfYear]]\n * @see [[Schedule.week]]\n * @see [[Schedule.weekOfYear]]\n * @see [[Schedule.lastFullWeekOfYear]]\n * @see [[Schedule.lastWeekspanOfYear]]\n */\n public isSingleWeekOfYear(): boolean\n {\n return this.isSingleFrequency( this.weekspanOfYear ) ||\n this.isSingleFrequency( this.fullWeekOfYear ) ||\n this.isSingleFrequency( this.week ) ||\n this.isSingleFrequency( this.weekOfYear ) ||\n this.isSingleFrequency( this.lastFullWeekOfYear ) ||\n this.isSingleFrequency( this.lastWeekspanOfYear );\n }\n\n /**\n * Determines if the given [[FrequencyCheck]] results in a single occurrence.\n *\n * @returns `true` if the frequency results in a single event, otherwise `false`.\n */\n public isSingleFrequency(frequency: FrequencyCheck): boolean\n {\n return fn.isArray( frequency.input ) && (frequency.input).length === 1;\n }\n\n /**\n * Creates a forecast for this schedule which returns a number of event\n * occurrences around a given day. A single item could be returned per day, or\n * you could get an item for each timed event occurrence.\n *\n * @param around The day to find a forecast around.\n * @param covers If `true` spans which span multiple days will be looked at\n * to see if they intersect with the given day, otherwise `false` will\n * only look at the given day for the start of events.\n * @param daysAfter The number of events to return before the given day.\n * @param daysBefore The number of events to return after the given day.\n * @param times If timed events should be returned, or only one for each day.\n * @param lookAround How many days to look before and after the given day for\n * event occurrences.\n * @returns A new iterator which provides the event occurence span, the day it\n * starts (or is covered if `covers` is `true`), and the identifier for the\n * event.\n */\n public forecast(around: Day,\n covers: boolean = true,\n daysAfter: number,\n daysBefore: number = daysAfter,\n times: boolean = false,\n lookAround: number = 366): Iterator\n {\n let type: Identifier = this.identifierType;\n\n let tuplesForDay = (day: Day, tuples: Iterator): boolean =>\n {\n let spans: DaySpan[] = this.iterateSpans( day, covers ).list();\n let last: number = times ? spans.length : Math.min( 1, spans.length );\n let offset: number = times ? 0 : spans.length - 1;\n\n for (let i = 0; i < last; i++)\n {\n let span: DaySpan = spans[ i + offset ];\n let id: IdentifierInput = type.get( span.start );\n\n if (tuples.act( [ span, day, id ] ) === IteratorAction.Stop)\n {\n return false;\n }\n }\n\n return true;\n };\n\n let prev = new Iterator(iterator =>\n {\n let curr: Day = around;\n\n for (let i = 0; i < lookAround; i++)\n {\n if (!tuplesForDay( curr, iterator ))\n {\n break;\n }\n\n curr = curr.prev();\n }\n });\n\n let next = new Iterator(iterator =>\n {\n let curr: Day = around;\n\n for (let i = 0; i < lookAround; i++)\n {\n curr = curr.next();\n\n if (!tuplesForDay( curr, iterator ))\n {\n break;\n }\n }\n });\n\n return prev.take( daysBefore + 1 ).reverse().append( next.take( daysAfter ) );\n }\n\n /**\n * Iterates timed events that were explicitly specified on the given day.\n * Those events could span multiple days so may be tested against another day.\n *\n * @param day The day to look for included timed events.\n * @param matchAgainst The day to test against the timed event.\n * @returns A new Iterator for all the included spans found.\n */\n public iterateIncludeTimes(day: Day, matchAgainst: Day = day): Iterator\n {\n let isIncludedTime = (result: [IdentifierInput, boolean]) =>\n {\n let [id, included] = result;\n\n return included && Identifier.Time.is( id );\n };\n\n let getSpan = (result: [IdentifierInput, boolean]) =>\n {\n let [id] = result;\n let time: Day = Identifier.Time.start( id );\n let span: DaySpan = this.getTimeSpan( time, time.asTime() );\n\n if (span.matchesDay( matchAgainst ))\n {\n return span;\n }\n };\n\n return this.include.query( day.dayIdentifier ).map( getSpan, isIncludedTime );\n }\n\n /**\n * Converts the schedule instance back into input.\n *\n * @param returnDays When `true` the start, end, and array of exclusions will\n * have [[Day]] instances, otherwise the UTC timestamp and dayIdentifiers\n * will be used when `false`.\n * @param returnTimes When `true` the times returned in the input will be\n * instances of [[Time]] otherwise the `timeFormat` is used to convert the\n * times to strings.\n * @param timeFormat The time format to use when returning the times as strings.\n * @param alwaysDuration If the duration values (`duration` and\n * `durationUnit`) should always be returned in the input.\n * @returns The input that describes this schedule.\n * @see [[Time.format]]\n */\n public toInput(returnDays: boolean = false, returnTimes: boolean = false, timeFormat: string = '', alwaysDuration: boolean = false): ScheduleInput\n {\n let defaultUnit: string = Constants.DURATION_DEFAULT_UNIT( this.isFullDay() );\n let exclusions: IdentifierInput[] = this.exclude.identifiers(v => v).list();\n let inclusions: IdentifierInput[] = this.include.identifiers(v => v).list();\n let cancels: IdentifierInput[] = this.cancel.identifiers(v => v).list();\n let hasMeta: boolean = !this.meta.isEmpty();\n let out: ScheduleInput = {};\n let times: TimeInput[] = [];\n\n for (let time of this.times)\n {\n times.push( returnTimes ? time : (timeFormat ? time.format( timeFormat ) : time.toString()) );\n }\n\n if (this.start) out.start = returnDays ? this.start : this.start.time;\n if (this.end) out.end = returnDays ? this.end : this.end.time;\n if (times.length) out.times = times;\n if (alwaysDuration || this.duration !== Constants.DURATION_DEFAULT) out.duration = this.duration;\n if (alwaysDuration || this.durationUnit !== defaultUnit) out.durationUnit = this.durationUnit;\n if (exclusions.length) out.exclude = exclusions;\n if (inclusions.length) out.include = inclusions;\n if (cancels.length) out.cancel = cancels;\n if (hasMeta) out.meta = fn.extend( {}, this.meta.map );\n if (this.dayOfWeek.input) out.dayOfWeek = this.dayOfWeek.input;\n if (this.dayOfMonth.input) out.dayOfMonth = this.dayOfMonth.input;\n if (this.lastDayOfMonth.input) out.lastDayOfMonth = this.lastDayOfMonth.input;\n if (this.dayOfYear.input) out.dayOfYear = this.dayOfYear.input;\n if (this.year.input) out.year = this.year.input;\n if (this.month.input) out.month = this.month.input;\n if (this.week.input) out.week = this.week.input;\n if (this.weekOfYear.input) out.weekOfYear = this.weekOfYear.input;\n if (this.weekspanOfYear.input) out.weekspanOfYear = this.weekspanOfYear.input;\n if (this.fullWeekOfYear.input) out.fullWeekOfYear = this.fullWeekOfYear.input;\n if (this.lastWeekspanOfYear.input) out.lastWeekspanOfYear = this.lastWeekspanOfYear.input;\n if (this.lastFullWeekOfYear.input) out.lastFullWeekOfYear = this.lastFullWeekOfYear.input;\n if (this.weekOfMonth.input) out.weekOfMonth = this.weekOfMonth.input;\n if (this.weekspanOfMonth.input) out.weekspanOfMonth = this.weekspanOfMonth.input;\n if (this.fullWeekOfMonth.input) out.fullWeekOfMonth = this.fullWeekOfMonth.input;\n if (this.lastWeekspanOfMonth.input) out.lastWeekspanOfMonth = this.lastWeekspanOfMonth.input;\n if (this.lastFullWeekOfMonth.input) out.lastFullWeekOfMonth = this.lastFullWeekOfMonth.input;\n\n return out;\n }\n\n /**\n * Describes the schedule in a human friendly string taking into account all\n * possible values specified in this schedule.\n *\n * @param thing A brief description of the things (events) on the schedule.\n * @param includeRange When `true` the [[Schedule.start]] and [[Schedule.end]]\n * are possibly included in the description if they have values.\n * @param includeTimes When `true` the [[Schedule.times]] are possibly included\n * in the description.\n * @param includeDuration When `true` the [[Schedule.duration]] and\n * [[Schedule.durationUnit]] are added to the description if\n * [[Schedule.duration]] is not equal to `1`.\n * @param includeExcludes When `true` the [[Schedule.exclude]] are added\n * to the description if there are any.\n * @param includeIncludes When `true` the [[Schedule.include]] are added\n * to the description if there are any.\n * @param includeCancels When `true` the [[Schedule.cancel]] are added\n * to the description if there are any.\n * @returns The descroption of the schedule.\n */\n public describe(thing: string = 'event',\n includeRange: boolean = true,\n includeTimes: boolean = true,\n includeDuration: boolean = false,\n includeExcludes: boolean = false,\n includeIncludes: boolean = false,\n includeCancels: boolean = false): string\n {\n let out: string = '';\n\n if (includeRange)\n {\n if (this.start)\n {\n out += 'Starting on ' + this.start.format('dddd Do, YYYY');\n\n if (this.end)\n {\n out += ' and ending on ' + this.end.format('dddd Do, YYYY');\n }\n }\n else if (this.end)\n {\n out += 'Up until ' + this.end.format('dddd Do, YYYY');\n }\n }\n\n if (out)\n {\n out += ' the ' + thing + ' will occur';\n }\n else\n {\n out += 'The ' + thing + ' will occur';\n }\n\n out += this.describeRule( this.dayOfWeek.input, 'day of the week', x => moment.weekdays()[x], 1, false);\n out += this.describeRule( this.lastDayOfMonth.input, 'last day of the month', x => Suffix.CACHE[x] );\n out += this.describeRule( this.dayOfMonth.input, 'day of the month', x => Suffix.CACHE[x] );\n out += this.describeRule( this.dayOfYear.input, 'day of the year', x => Suffix.CACHE[x], 1 );\n out += this.describeRule( this.year.input, 'year', x => x, 0, false, ' in ' );\n out += this.describeRule( this.month.input, 'month', x => moment.months()[x], 0, false, ' in ' );\n out += this.describeRule( this.weekOfYear.input, 'week of the year', x => Suffix.CACHE[x] );\n out += this.describeRule( this.weekspanOfYear.input, 'weekspan of the year', x => Suffix.CACHE[x + 1], 1 );\n out += this.describeRule( this.fullWeekOfYear.input, 'full week of the year', x => Suffix.CACHE[x] );\n out += this.describeRule( this.lastWeekspanOfYear.input, 'last weekspan of the year', x => Suffix.CACHE[x + 1], 1 );\n out += this.describeRule( this.lastFullWeekOfYear.input, 'last full week of the year', x => Suffix.CACHE[x] );\n out += this.describeRule( this.weekOfMonth.input, 'week of the month', x => Suffix.CACHE[x] );\n out += this.describeRule( this.fullWeekOfMonth.input, 'full week of the month', x => Suffix.CACHE[x] );\n out += this.describeRule( this.weekspanOfMonth.input, 'weekspan of the month', x => Suffix.CACHE[x + 1], 1 );\n out += this.describeRule( this.lastFullWeekOfMonth.input, 'last full week of the month', x => Suffix.CACHE[x] );\n out += this.describeRule( this.lastWeekspanOfMonth.input, 'last weekspan of the month', x => Suffix.CACHE[x + 1], 1 );\n\n if (includeTimes && this.times.length)\n {\n out += ' at ';\n out += this.describeArray( this.times, x => x.format('hh:mm a') );\n }\n\n if (includeDuration && this.duration !== Constants.DURATION_DEFAULT)\n {\n out += ' lasting ' + this.duration + ' ';\n\n if (this.durationUnit)\n {\n out += this.durationUnit + ' ';\n }\n }\n\n if (includeExcludes)\n {\n let excludes: ScheduleModifierSpan[] = this.exclude.spans().list();\n\n if (excludes.length)\n {\n out += ' excluding ';\n out += this.describeArray( excludes, x => x.span.summary(Units.DAY) );\n }\n }\n\n if (includeIncludes)\n {\n let includes: ScheduleModifierSpan[] = this.include.spans().list();\n\n if (includes.length)\n {\n out += ' including ';\n out += this.describeArray( includes, x => x.span.summary(Units.DAY) );\n }\n }\n\n if (includeCancels)\n {\n let cancels: ScheduleModifierSpan[] = this.cancel.spans().list();\n\n if (cancels.length)\n {\n out += ' with cancellations on ';\n out += this.describeArray( cancels, x => x.span.summary(Units.DAY) );\n }\n }\n\n return out;\n }\n\n /**\n * Describes the given frequency.\n *\n * @param value The frequency to describe.\n * @param unit The unit of the frequency.\n * @param map How the values in the frequency should be described.\n * @param everyOffset A value to add to a [[FrequencyValueEvery]] offset to\n * account for zero-based values that should be shifted for human\n * friendliness.\n * @param the If the word 'the' should be used to describe the unit.\n * @param on The word which preceeds values of the given unit.\n * @param required If the description should always return a non-empty string\n * even if the frequency was not specified in the original input.\n * @returns A string description of the frequency.\n */\n private describeRule(value: FrequencyValue, unit: string, map: (x: number) => any, everyOffset: number = 0, the: boolean = true, on: string = ' on ', required: boolean = false): string\n {\n let out: string = '';\n let suffix: string = the ? ' ' + unit : '';\n\n if (fn.isFrequencyValueEvery(value))\n {\n let valueEvery: FrequencyValueEvery = value;\n\n out += ' every ' + Suffix.CACHE[ valueEvery.every ] + ' ' + unit;\n\n if (valueEvery.offset)\n {\n out += ' starting at ' + map( valueEvery.offset + everyOffset ) + suffix;\n }\n }\n else if (fn.isFrequencyValueOneOf(value))\n {\n let valueOne: FrequencyValueOneOf = value;\n\n if (valueOne.length)\n {\n out += on + (the ? 'the ' : '');\n out += this.describeArray( valueOne, map );\n out += suffix;\n }\n }\n else if (required)\n {\n out += on + 'any ' + unit;\n }\n\n return out;\n }\n\n /**\n * Describes the array by adding commas where appropriate and 'and' before the\n * last value of the array (if its more than `1`).\n *\n * @param array The array of items to describe.\n * @param map The function which converts an item to a string.\n * @returns The final description of the array items.\n */\n private describeArray(array: T[], map: (item: T) => string): string\n {\n let out: string = '';\n let last: number = array.length - 1;\n\n out += map( array[ 0 ] );\n\n for (let i = 1; i < last; i++)\n {\n out += ', ' + map( array[ i ] );\n }\n\n if (last > 0)\n {\n out += ' and ' + map( array[ last ] );\n }\n\n return out;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Schedule.ts","\nimport { Schedule, ScheduleInput } from './Schedule';\n\n/**\n * The input which can be passed to the calendar when adding a schedule and event.\n *\n * @typeparam T The type of data stored in the [[Event]] class.\n * @typeparam M The type of metadata stored in the schedule.\n */\nexport interface EventInput\n{\n id?: any;\n data?: T;\n schedule: ScheduleInput | Schedule;\n}\n\n/**\n * A pairing of a user specified event object and the schedule which defines\n * when it occurs on a calendar.\n *\n * @typeparam T The type of data stored in the [[Event]] class.\n * @typeparam M The type of metadata stored in the schedule.\n */\nexport class Event\n{\n\n /**\n * User specified ID which can be used to find or remove this event from a\n * Calendar.\n */\n public id: any;\n\n /**\n * User specified object which describes this event.\n */\n public data: T;\n\n /**\n * The schedule which defines when this event occurs.\n */\n public schedule: Schedule;\n\n /**\n * If the event is visible on the calendar.\n */\n public visible: boolean;\n\n /**\n * Creates a new event.\n *\n * @param schedule The schedule which defines when the event occurs.\n * @param data User specified object which describes this event.\n * @param id User specified ID which identifies this event.\n */\n public constructor(schedule: Schedule, data?: T, id?: any, visible: boolean = true)\n {\n this.schedule = schedule;\n this.data = data;\n this.id = id;\n this.visible = visible;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Event.ts","\nimport { Functions as fn } from './Functions';\nimport { Constants } from './Constants';\nimport { Parse } from './Parse';\n\n\n/**\n * A value that can possibly be parsed into a Time instance.\n *\n * @see [[Time.parse]]\n */\nexport type TimeInput = Time | number | string | {hour: number, minute?: number, second?: number, millisecond?: number};\n\n/**\n * A class which holds a specific time during in any day.\n */\nexport class Time\n{\n\n /**\n * The regular expression used to parse a time from a string.\n *\n * - ## = hour\n * - ##:## = hour & minute\n * - ##:##:## = hour, minute, & second\n * - ##:##:##.### = hour, minute, second, and milliseconds\n */\n public static REGEX = /^(\\d\\d?):?(\\d\\d)?:?(\\d\\d)?\\.?(\\d\\d\\d)?$/;\n\n /**\n * The hour between 0 and 23\n */\n public hour: number;\n\n /**\n * The minute between 0 and 59\n */\n public minute: number;\n\n /**\n * The second between 0 and 59\n */\n public second: number;\n\n /**\n * The millisecond between 0 and 999\n */\n public millisecond: number;\n\n\n /**\n * Creates a new Time instance given an hour and optionally a minute, second,\n * and millisecond. If they have not been specified they default to 0.\n *\n * @param hour The hour.\n * @param minute The minute.\n * @param second The second.\n * @param millisecond The millisecond.\n */\n public constructor(hour: number, minute: number = Constants.MINUTE_MIN, second: number = Constants.SECOND_MIN, millisecond: number = Constants.MILLIS_MIN)\n {\n this.hour = hour;\n this.minute = minute;\n this.second = second;\n this.millisecond = millisecond;\n }\n\n /**\n * Formats this time into a string. The following list describes the available\n * formatting patterns:\n *\n * ### Hour\n * - H: 0-23\n * - HH: 00-23\n * - h: 12,1-12,1-11\n * - hh: 12,01-12,01-11\n * - k: 1-24\n * - kk: 01-24\n * - a: am,pm\n * - A: AM,PM\n * ### Minute\n * - m: 0-59\n * - mm: 00-59\n * ### Second\n * - s: 0-59\n * - ss: 00-59\n * ### Millisecond\n * - S: 0-9\n * - SS: 00-99\n * - SSS: 000-999\n *\n * @param format The format to output.\n * @returns The formatted time.\n */\n public format(format: string): string\n {\n let formatterEntries = Time.FORMATTERS;\n let out: string = '';\n\n for (let i = 0; i < format.length; i++)\n {\n let handled: boolean = false;\n\n for (let k = 0; k < formatterEntries.length && !handled; k++)\n {\n let entry = formatterEntries[ k ];\n let part: string = format.substring( i, i + entry.size );\n\n if (part.length === entry.size)\n {\n let formatter = entry.formats[ part ];\n\n if (formatter)\n {\n out += formatter(this);\n i += entry.size - 1;\n handled = true;\n }\n }\n }\n\n if (!handled)\n {\n out += format.charAt(i);\n }\n }\n\n return out;\n }\n\n /**\n * Determines whether this time is an exact match for the given time.\n *\n * @param time The given time to test against.\n * @returns `true` if the time matches this time, otherwise `false`.\n */\n public matches(time: Time): boolean\n {\n return this.hour === time.hour &&\n this.minute === time.minute &&\n this.second === time.second &&\n this.millisecond === time.millisecond;\n }\n\n /**\n * Determines whether this time has the same hour as the given time.\n *\n * @param time The given time to test against.\n * @returns `true` if the given hour matches this hour, otherwise `false`.\n */\n public matchesHour(time: Time): boolean\n {\n return this.hour === time.hour;\n }\n\n /**\n * Determines whether this time has the same hour and minute as the given time.\n *\n * @param time The given time to test against.\n * @returns `true` if the given hour and minute matches, otherwise `false`.\n */\n public matchesMinute(time: Time): boolean\n {\n return this.hour === time.hour &&\n this.minute === time.minute;\n }\n\n /**\n * Determines whether this time has the same hour, minute, and second as the\n * given time.\n *\n * @param time The given time to test against.\n * @returns `true` if the given hour, minute, and second matches, otherwise\n * `false`.\n */\n public matchesSecond(time: Time): boolean\n {\n return this.hour === time.hour &&\n this.minute === time.minute &&\n this.second === time.second;\n }\n\n /**\n * @returns The number of milliseconds from the start of the day until this\n * time.\n */\n public toMilliseconds(): number\n {\n return this.hour * Constants.MILLIS_IN_HOUR +\n this.minute * Constants.MILLIS_IN_MINUTE +\n this.second * Constants.MILLIS_IN_SECOND +\n this.millisecond;\n }\n\n /**\n * @returns The time formatted using the smallest format that completely\n * represents this time.\n */\n public toString(): string\n {\n if (this.millisecond) return this.format('HH:mm:ss.SSS');\n if (this.second) return this.format('HH:mm:ss');\n if (this.minute) return this.format('HH:mm');\n\n return this.format('HH');\n }\n\n /**\n * @returns A unique identifier for this time. The number returned is in the\n * following format: SSSssmmHH\n */\n public toIdentifier(): number\n {\n return this.hour +\n this.minute * 100 +\n this.second * 10000 +\n this.millisecond * 10000000;\n }\n\n /**\n * @returns An object with hour, minute, second, a millisecond properties if\n * they are non-zero on this time.\n */\n public toObject(): TimeInput\n {\n let out: TimeInput = {\n hour: this.hour\n };\n\n if (this.minute) out.minute = this.minute;\n if (this.second) out.second = this.second;\n if (this.millisecond) out.millisecond = this.millisecond;\n\n return out;\n }\n\n /**\n * Parses a value and tries to convert it to a Time instance.\n *\n * @param input The input to parse.\n * @returns The instance parsed or `null` if it was invalid.\n * @see [[Parse.time]]\n */\n public static parse(input: any): Time\n {\n return Parse.time(input);\n }\n\n /**\n * Parses a string and converts it to a Time instance. If the string is not\n * in a valid format `null` is returned.\n *\n * @param time The string to parse.\n * @returns The instance parsed or `null` if it was invalid.\n * @see [[Time.REGEX]]\n */\n public static fromString(time: string): Time\n {\n let matches: string[] = this.REGEX.exec( time );\n\n if (!matches)\n {\n return null;\n }\n\n let h: number = parseInt(matches[1]) || 0;\n let m: number = parseInt(matches[2]) || 0;\n let s: number = parseInt(matches[3]) || 0;\n let l: number = parseInt(matches[4]) || 0;\n\n return this.build(h, m, s, l);\n }\n\n /**\n * Parses a number and converts it to a Time instance. The number is assumed\n * to be in the [[Time.toIdentifier]] format.\n *\n * @param time The number to parse.\n * @returns The instance parsed.\n */\n public static fromIdentifier(time: number): Time\n {\n let h: number = time % 100;\n let m: number = Math.floor(time / 100) % 100;\n let s: number = Math.floor(time / 10000) % 100;\n let l: number = Math.floor(time / 10000000) % 1000;\n\n return this.build(h, m, s, l);\n }\n\n /**\n * Returns a new instance given an hour and optionally a minute, second,\n * and millisecond. If they have not been specified they default to 0.\n *\n * @param hour The hour.\n * @param minute The minute.\n * @param second The second.\n * @param millisecond The millisecond.\n * @returns A new instance.\n */\n public static build(hour: number, minute: number = Constants.MINUTE_MIN, second: number = Constants.SECOND_MIN, millisecond: number = Constants.MILLIS_MIN): Time\n {\n return new Time(hour, minute, second, millisecond)\n }\n\n /**\n * A set of formatting functions keyed by their format string.\n */\n public static FORMATTERS = [\n {\n size: 3,\n formats: {\n SSS: (t: Time) => fn.padNumber(t.millisecond, 3)\n }\n },\n {\n size: 2,\n formats: {\n HH: (t: Time) => fn.padNumber(t.hour, 2),\n hh: (t: Time) => fn.padNumber((t.hour % 12) || 12, 2),\n kk: (t: Time) => fn.padNumber(t.hour + 1, 2),\n mm: (t: Time) => fn.padNumber(t.minute, 2),\n ss: (t: Time) => fn.padNumber(t.second, 2),\n SS: (t: Time) => fn.padNumber(t.millisecond, 3, 2)\n }\n },\n {\n size: 1,\n formats: {\n A: (t: Time) => t.hour < 12 ? 'AM' : 'PM',\n a: (t: Time) => t.hour < 12 ? 'am' : 'pm',\n H: (t: Time) => t.hour + '',\n h: (t: Time) => ((t.hour % 12) || 12) + '',\n k: (t: Time) => (t.hour + 1) + '',\n m: (t: Time) => t.minute + '',\n s: (t: Time) => t.second + '',\n S: (t: Time) => fn.padNumber(t.millisecond, 3, 1)\n }\n }\n ];\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Time.ts","\nimport { Functions as fn } from './Functions';\nimport { FrequencyCheck } from './Frequency';\nimport { Schedule, ScheduleInput } from './Schedule';\nimport { ScheduleModifier } from './ScheduleModifier';\nimport { Constants } from './Constants';\nimport { Day, DayProperty, DayInput, DurationInput } from './Day';\nimport { Event } from './Event';\nimport { Time } from './Time';\n\n\n/**\n * The class which takes user input and parses it to specific structures.\n */\nexport class Parse\n{\n\n /**\n * Parses a value and converts it to a [[FrequencyCheck]].\n *\n * @param input The input to parse into a function.\n * @param property The [[Day]] property the frequency is for.\n * @returns A function which determines whether a value matches a frequency.\n * @see [[Schedule]]\n */\n public static frequency(input: any, property: DayProperty): FrequencyCheck\n {\n let check: FrequencyCheck = (value: number) => {\n return true;\n };\n\n check.given = false;\n\n if (fn.isFrequencyValueEvery(input))\n {\n let every: number = input.every;\n let offset: number = (input.offset || 0) % every;\n\n check = (value: number) => {\n return value % every === offset;\n };\n check.given = true;\n }\n\n if (fn.isFrequencyValueOneOf(input))\n {\n let map: object = {};\n\n for (let i = 0; i < input.length; i++) {\n map[ input[ i ] ] = true;\n }\n\n check = (value: number) => {\n return !!map[ value ];\n };\n check.given = true;\n }\n\n check.input = fn.coalesce( input, null );\n check.property = property;\n\n return check;\n }\n\n /**\n * Parses [[DayInput]] into a [[Day]] instance.\n *\n * ```typescript\n * Parse.day( 65342300 ); // UTC timestamp\n * Parse.day( '01/02/2014' ); // strings in many formats\n * Parse.day( day ); // return a passed instance\n * Parse.day( [2018, 0, 2] ); // array: 01/02/2018\n * Parse.day( {year: 2018, month: 2} ); // object: 03/01/2018\n * Parse.day( true ); // today\n * ```\n *\n * @param input The input to parse.\n * @returns The Day parsed or `null` if the value is not valid.\n */\n public static day(input: DayInput): Day\n {\n if (fn.isNumber(input))\n {\n return Day.unix( input );\n }\n else if (fn.isString(input))\n {\n return Day.fromString( input );\n }\n else if (input instanceof Day)\n {\n return input;\n }\n else if (fn.isArray( input ))\n {\n return Day.fromArray( input );\n }\n else if (fn.isObject( input ))\n {\n return Day.fromObject( input );\n }\n else if (input === true)\n {\n return Day.today();\n }\n\n return null;\n }\n\n /**\n * Parses a value and tries to convert it to a Time instance.\n *\n * ```typescript\n * Parse.time( time ); // return a passed instance\n * Parse.time( 9 ); // 09:00:00.000\n * Parse.time( 3009 ); // 09:30:00.000\n * Parse.time( 593009 ); // 09:30:59.000\n * Parsetime( '09' ); // 09:00:00.000\n * Parse.time( '9:30' ); // 09:30:00.000\n * Parse.time( '9:30:59' ); // 09:30:59.000\n * Parse.time( {hour: 2} ); // 02:00:00.000\n * ```\n *\n * @param input The input to parse.\n * @returns The instance parsed or `null` if it was invalid.\n * @see [[Time.fromIdentifier]]\n * @see [[Time.fromString]]\n */\n public static time(input: any): Time\n {\n if (input instanceof Time)\n {\n return input;\n }\n if (fn.isNumber(input))\n {\n return Time.fromIdentifier( input );\n }\n if (fn.isString(input))\n {\n return Time.fromString( input );\n }\n if (fn.isObject(input) && fn.isNumber(input.hour))\n {\n return new Time(input.hour, input.minute, input.second, input.millisecond);\n }\n\n return null;\n }\n\n /**\n * Parses a value and tries to convert it to an array of Time instances.\n * If any of the given values are not a valid time value then the resulting\n * array will not contain a time instance.\n *\n * @param input The input to parse.\n * @returns A non-null array of time instances.\n * @see [[Parse.time]]\n */\n public static times(input: any): Time[]\n {\n let times: Time[] = [];\n\n if (fn.isArray(input))\n {\n for (let timeInput of input)\n {\n let time = this.time( timeInput );\n\n if (time)\n {\n times.push( time );\n }\n }\n\n // Sort times from earliest to latest.\n times.sort((a, b) =>\n {\n return a.toMilliseconds() - b.toMilliseconds();\n });\n }\n\n return times;\n }\n\n /**\n * Parses an array of excluded days into a map of excluded days where the\n * array value and returned object key are [[Day.dayIdentifier]].\n *\n * ```typescript\n * Parse.modifier( [ 20180101, 20140506 ] ); // {'20180101': true, '20140506': true}\n * Parse.modifier( [ 20180101, Day.build(2014,4,6) ] ); // {'20180101': true, '20140506': true}\n * ```\n *\n * @param input The input to parse.\n * @param value The default value if the input given is an array of identifiers.\n * @param parseMeta A function to use to parse a modifier.\n * @param out The modifier to set the identifiers and values of and return.\n * @returns The object with identifier keys and `true` values.\n * @see [[Day.dayIdentifier]]\n */\n public static modifier(input: any, value: T,\n parseMeta: (input: any) => T = (x => x),\n out: ScheduleModifier = new ScheduleModifier()): ScheduleModifier\n {\n let map = {};\n\n if (fn.isArray(input))\n {\n for (let identifier of input)\n {\n if (identifier instanceof Day)\n {\n map[ identifier.dayIdentifier ] = value;\n }\n else if (fn.isNumber(identifier))\n {\n map[ identifier ] = value;\n }\n else if (fn.isString(identifier))\n {\n map[ identifier ] = value;\n }\n }\n }\n\n if (fn.isObject(input))\n {\n for (let identifier in input)\n {\n map[ identifier ] = parseMeta( input[ identifier ] );\n }\n }\n\n out.map = map;\n\n return out;\n }\n\n /**\n * Parses an object which specifies a schedule where events may or may not\n * repeat and they may be all day events or at specific times.\n *\n * @param input The input to parse into a schedule.\n * @param parseMeta A function to use when parsing meta input into the desired type.\n * @param out The schedule to set the values of and return.\n * @returns An instance of the parsed [[Schedule]].\n */\n public static schedule(input: ScheduleInput | Schedule,\n parseMeta: (input: any) => M = (x => x),\n out: Schedule = new Schedule()): Schedule\n {\n if (input instanceof Schedule)\n {\n return input;\n }\n\n let on: Day = this.day( input.on );\n let times: Time[] = this.times( input.times );\n let fullDay: boolean = times.length === 0;\n\n if (on)\n {\n input.start = on.start();\n input.end = on.end();\n input.year = [on.year];\n input.month = [on.month];\n input.dayOfMonth = [on.dayOfMonth];\n }\n\n out.times = times;\n out.duration = fn.coalesce( input.duration, Constants.DURATION_DEFAULT );\n out.durationUnit = fn.coalesce( input.durationUnit, Constants.DURATION_DEFAULT_UNIT( fullDay ) );\n out.start = this.day( input.start );\n out.end = this.day( input.end );\n out.exclude = this.modifier( input.exclude, true, undefined, out.exclude );\n out.include = this.modifier( input.include, true, undefined, out.include );\n out.cancel = this.modifier( input.cancel, true, undefined, out.cancel );\n out.meta = this.modifier( input.meta, null, parseMeta, out.meta );\n out.year = this.frequency( input.year, 'year' );\n out.month = this.frequency( input.month, 'month' );\n out.week = this.frequency( input.week, 'week' );\n out.weekOfYear = this.frequency( input.weekOfYear, 'weekOfYear' );\n out.weekspanOfYear = this.frequency( input.weekspanOfYear, 'weekspanOfYear' );\n out.fullWeekOfYear = this.frequency( input.fullWeekOfYear, 'fullWeekOfYear' );\n out.lastWeekspanOfYear = this.frequency( input.lastWeekspanOfYear, 'lastWeekspanOfYear' );\n out.lastFullWeekOfYear = this.frequency( input.lastFullWeekOfYear, 'lastFullWeekOfYear' );\n out.weekOfMonth = this.frequency( input.weekOfMonth, 'weekOfMonth' );\n out.weekspanOfMonth = this.frequency( input.weekspanOfMonth, 'weekspanOfMonth' );\n out.fullWeekOfMonth = this.frequency( input.fullWeekOfMonth, 'fullWeekOfMonth' );\n out.lastWeekspanOfMonth = this.frequency( input.lastWeekspanOfMonth, 'lastWeekspanOfMonth' );\n out.lastFullWeekOfMonth = this.frequency( input.lastFullWeekOfMonth, 'lastFullWeekOfMonth' );\n out.dayOfWeek = this.frequency( input.dayOfWeek, 'dayOfWeek' );\n out.dayOfMonth = this.frequency( input.dayOfMonth, 'dayOfMonth' );\n out.lastDayOfMonth = this.frequency( input.lastDayOfMonth, 'lastDayOfMonth' );\n out.dayOfYear = this.frequency( input.dayOfYear, 'dayOfYear' );\n out.updateDurationInDays();\n out.updateChecks();\n\n return out;\n }\n\n /**\n * Parses an array of [[FrequencyCheck]] functions and returns an array of\n * functions for only the checks that were specified by the user.\n *\n * @param checks The array of check functions to filter through.\n * @returns The array of user specified checks.\n */\n public static givenFrequency(checks: FrequencyCheck[]): FrequencyCheck[]\n {\n let out: FrequencyCheck[] = [];\n\n for (let check of checks)\n {\n if (check.given)\n {\n out.push( check );\n }\n }\n\n return out;\n }\n\n /**\n * Parses [[EventInput]] and returns an [[Event]].\n *\n * @param input The input to parse.\n * @param parseData A function to use when parsing data input into the desired type.\n * @param parseMeta A function to use when parsing meta input into the desired type.\n * @returns The parsed value.\n */\n public static event(input: any,\n parseData: (input: any) => T = (x => x),\n parseMeta: (input: any) => M = (x => x)): Event\n {\n if (input instanceof Event)\n {\n return input;\n }\n\n if (!input.schedule)\n {\n return null;\n }\n\n let schedule: Schedule = this.schedule( input.schedule, parseMeta );\n\n return new Event( schedule, parseData( input.data ), input.id, input.visible );\n }\n\n /**\n * Parses a schedule from a CRON pattern. TODO\n */\n public static cron(pattern: string, out: Schedule = new Schedule()): Schedule\n {\n return out;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Parse.ts","\nimport { Identifier, IdentifierInput } from './Identifier';\nimport { Constants } from './Constants';\nimport { Op, operate } from './Operation';\nimport { Parse } from './Parse';\nimport { Time } from './Time';\n\n// @ts-ignore\nimport * as moment from 'moment';\n\n\n/**\n * Valid durations that can be specified.\n */\nexport type DurationInput = moment.unitOfTime.DurationConstructor;\n\n/**\n * All valid types which may be converted to a [[Day]] instance.\n *\n * - `number`: A UNIX timestamp.\n * - `string`: A string representation of a date.\n * - `Day`: An existing [[Day]] instance.\n * - `number[]`: An array of numbers specifying any of: [year, month, dayOfMonth, hour, minute, second, millisecond].\n * - `object`: An object with any of the following properties: year, month, dayOfMonth, hour, minute, second, millisecond.\n * - `true`: This will be interpreted as [[Day.today]]\n */\nexport type DayInput = number | string | Day | number[] | object | true;\n\n/**\n * One of the properties on the [[Day]] object.\n */\nexport type DayProperty = keyof Day;\n\n/**\n * A class which represents a point in time as\n */\nexport class Day\n{\n\n /**\n *\n */\n public readonly date: moment.Moment;\n\n /**\n *\n */\n public readonly time: number;\n\n /**\n *\n */\n public readonly millis: number;\n\n /**\n *\n */\n public readonly seconds: number;\n\n /**\n *\n */\n public readonly minute: number;\n\n /**\n *\n */\n public readonly hour: number;\n\n /**\n *\n */\n public readonly month: number;\n\n /**\n *\n */\n public readonly year: number;\n\n /**\n *\n */\n public readonly quarter: number;\n\n\n /**\n *\n */\n public readonly dayOfWeek: number;\n\n /**\n *\n */\n public readonly dayOfMonth: number;\n\n /**\n *\n */\n public readonly lastDayOfMonth: number;\n\n /**\n *\n */\n public readonly dayOfYear: number;\n\n\n /**\n *\n */\n public readonly week: number;\n\n /**\n *\n */\n public readonly weekOfYear: number;\n\n /**\n *\n */\n public readonly weekspanOfYear: number;\n\n /**\n *\n */\n public readonly fullWeekOfYear: number;\n\n /**\n *\n */\n public readonly lastWeekspanOfYear: number;\n\n /**\n *\n */\n public readonly lastFullWeekOfYear: number;\n\n\n /**\n *\n */\n public readonly weekOfMonth: number;\n\n /**\n *\n */\n public readonly weekspanOfMonth: number;\n\n /**\n *\n */\n public readonly fullWeekOfMonth: number;\n\n /**\n *\n */\n public readonly lastWeekspanOfMonth: number;\n\n /**\n *\n */\n public readonly lastFullWeekOfMonth: number;\n\n\n /**\n *\n */\n public readonly timeIdentifier: IdentifierInput;\n\n /**\n *\n */\n public readonly dayIdentifier: IdentifierInput;\n\n /**\n *\n */\n public readonly weekIdentifier: IdentifierInput;\n\n /**\n *\n */\n public readonly monthIdentifier: IdentifierInput;\n\n /**\n *\n */\n public readonly quarterIdentifier: IdentifierInput;\n\n\n\n /**\n *\n */\n public constructor(date: moment.Moment)\n {\n this.date = date;\n this.time = date.valueOf();\n this.millis = date.millisecond();\n this.seconds = date.second();\n this.minute = date.minute();\n this.hour = date.hour();\n this.month = date.month();\n this.year = date.year();\n this.quarter = date.quarter();\n this.dayOfWeek = date.day();\n this.dayOfMonth = date.date();\n this.dayOfYear = date.dayOfYear();\n this.week = date.week();\n\n this.lastDayOfMonth = Day.getLastDayOfMonth( date );\n this.weekOfYear = Day.getWeekOfYear( date );\n this.weekspanOfYear = Day.getWeekspanOfYear( date );\n this.fullWeekOfYear = Day.getFullWeekOfYear( date );\n this.lastWeekspanOfYear = Day.getLastWeekspanOfYear( date );\n this.lastFullWeekOfYear = Day.getLastFullWeekOfYear( date );\n\n this.weekOfMonth = Day.getWeekOfMonth( date );\n this.weekspanOfMonth = Day.getWeekspanOfMonth( date );\n this.fullWeekOfMonth = Day.getFullWeekOfMonth( date );\n this.lastWeekspanOfMonth = Day.getLastWeekspanOfMonth( date );\n this.lastFullWeekOfMonth = Day.getLastFullWeekOfMonth( date );\n\n this.timeIdentifier = Identifier.Time.get( this );\n this.dayIdentifier = Identifier.Day.get( this);\n this.weekIdentifier = Identifier.Week.get( this);\n this.monthIdentifier = Identifier.Month.get( this);\n this.quarterIdentifier = Identifier.Quarter.get( this );\n }\n\n // Same\n\n /**\n *\n */\n public sameDay(day: Day): boolean\n {\n return this.dayIdentifier === day.dayIdentifier;\n }\n\n /**\n *\n */\n public sameMonth(day: Day): boolean\n {\n return this.monthIdentifier === day.monthIdentifier;\n }\n\n /**\n *\n */\n public sameWeek(day: Day): boolean\n {\n return this.weekIdentifier === day.weekIdentifier;\n }\n\n /**\n *\n */\n public sameYear(day: Day): boolean\n {\n return this.year === day.year;\n }\n\n /**\n *\n */\n public sameQuarter(day: Day): boolean\n {\n return this.quarterIdentifier === day.quarterIdentifier;\n }\n\n /**\n *\n */\n public sameHour(day: Day): boolean {\n return this.dayIdentifier === day.dayIdentifier && this.hour === day.hour;\n }\n\n /**\n *\n */\n public sameMinute(day: Day): boolean {\n return this.timeIdentifier === day.timeIdentifier;\n }\n\n /**\n *\n */\n public sameTime(time: Time): boolean {\n return this.hour === time.hour && this.minute === time.minute && this.seconds === time.second && this.millis === time.millisecond;\n }\n\n // Comparison\n\n /**\n *\n */\n public isBefore(day: Day, precision?: moment.unitOfTime.StartOf): boolean {\n return this.date.isBefore( day.date, precision );\n }\n\n /**\n *\n */\n public isSameOrBefore(day: Day, precision?: moment.unitOfTime.StartOf): boolean {\n return this.date.isSameOrBefore( day.date, precision );\n }\n\n /**\n *\n */\n public isAfter(day: Day, precision?: moment.unitOfTime.StartOf): boolean {\n return this.date.isAfter( day.date, precision );\n }\n\n /**\n *\n */\n public isSameOrAfter(day: Day, precision?: moment.unitOfTime.StartOf): boolean {\n return this.date.isSameOrAfter( day.date, precision );\n }\n\n /**\n *\n */\n public max(day: Day): Day {\n return this.date.isAfter( day.date ) ? this : day;\n }\n\n /**\n *\n */\n public min(day: Day): Day {\n return this.date.isBefore( day.date ) ? this : day;\n }\n\n // Between\n\n public millisBetween(day: Day, op: Op = Op.DOWN, absolute: boolean = true): number {\n return operate( this.date.diff( day.date, 'milliseconds', true ), op, absolute );\n }\n\n public secondsBetween(day: Day, op: Op = Op.DOWN, absolute: boolean = true): number {\n return operate( this.date.diff( day.date, 'seconds', true ), op, absolute );\n }\n\n public minutesBetween(day: Day, op: Op = Op.DOWN, absolute: boolean = true): number {\n return operate( this.date.diff( day.date, 'minutes', true ), op, absolute );\n }\n\n public hoursBetween(day: Day, op: Op = Op.DOWN, absolute: boolean = true): number {\n return operate( this.date.diff( day.date, 'hours', true ), op, absolute );\n }\n\n public daysBetween(day: Day, op: Op = Op.DOWN, absolute: boolean = true): number {\n return operate( this.date.diff( day.date, 'days', true ), op, absolute );\n }\n\n public weeksBetween(day: Day, op: Op = Op.DOWN, absolute: boolean = true): number {\n return operate( this.date.diff( day.date, 'weeks', true ), op, absolute );\n }\n\n public monthsBetween(day: Day, op: Op = Op.DOWN, absolute: boolean = true): number {\n return operate( this.date.diff( day.date, 'months', true ), op, absolute );\n }\n\n public yearsBetween(day: Day, op: Op = Op.DOWN, absolute: boolean = true): number {\n return operate( this.date.diff( day.date, 'years', true ), op, absolute );\n }\n\n public isBetween(start: Day, end: Day, inclusive: boolean = true): boolean {\n return this.date.isBetween(start.date, end.date, null, inclusive ? '[]' : '[)');\n }\n\n public mutate(mutator: (date: moment.Moment) => void): Day {\n var d = this.toMoment();\n mutator( d );\n return new Day( d );\n }\n\n public add(amount: number, unit: string): Day {\n return this.mutate(d => d.add(amount, unit));\n }\n\n public relative(millis: number): Day {\n return this.mutate(d => d.add(millis, 'milliseconds'));\n }\n\n // Days\n\n public relativeDays(days: number): Day {\n return this.mutate(d => d.add(days, 'days'));\n }\n\n public prev(days: number = 1): Day {\n return this.relativeDays( -days );\n }\n\n public next(days: number = 1): Day {\n return this.relativeDays( days );\n }\n\n public withDayOfMonth(day: number): Day {\n return this.mutate(d => d.date(day));\n }\n\n public withDayOfWeek(dayOfWeek: number): Day {\n return this.mutate(d => d.day(dayOfWeek));\n }\n\n public withDayOfYear(dayOfYear: number): Day {\n return this.mutate(d => d.dayOfYear(dayOfYear));\n }\n\n // Month\n\n public withMonth(month: number): Day {\n return this.mutate(d => d.month(month));\n }\n\n public relativeMonths(months: number): Day {\n return this.mutate(d => d.add(months, 'months'));\n }\n\n public prevMonth(months: number = 1): Day {\n return this.relativeMonths( -months );\n }\n\n public nextMonth(months: number = 1): Day {\n return this.relativeMonths( months );\n }\n\n // Week Of Year\n\n public withWeek(week: number, relativeWeek: number = this.week): Day {\n return this.mutate(d => d.add((week - relativeWeek) * Constants.DAYS_IN_WEEK, 'days'));\n }\n\n public withWeekOfYear(week: number): Day {\n return this.withWeek(week, this.weekOfYear);\n }\n\n public withFullWeekOfYear(week: number): Day {\n return this.withWeek(week, this.fullWeekOfYear);\n }\n\n public withWeekspanOfYear(week: number): Day {\n return this.withWeek(week, this.weekspanOfYear);\n }\n\n public withWeekOfMonth(week: number): Day {\n return this.withWeek(week, this.weekOfMonth);\n }\n\n public withWeekspanOfMonth(week: number): Day {\n return this.withWeek(week, this.weekspanOfMonth);\n }\n\n public withFullWeekOfMonth(week: number): Day {\n return this.withWeek(week, this.fullWeekOfMonth);\n }\n\n public relativeWeeks(weeks: number): Day {\n return this.mutate(d => d.add(weeks, 'weeks'));\n }\n\n public prevWeek(weeks: number = 1): Day {\n return this.relativeWeeks( -weeks );\n }\n\n public nextWeek(weeks: number = 1): Day {\n return this.relativeWeeks( weeks );\n }\n\n // Year\n\n public withYear(year: number): Day {\n return this.mutate(d => d.year(year));\n }\n\n public relativeYears(years: number): Day {\n return this.mutate(d => d.add(years, 'year'));\n }\n\n public prevYear(years: number = 1): Day {\n return this.relativeYears( -years );\n }\n\n public nextYear(years: number = 1): Day {\n return this.relativeYears( years );\n }\n\n // Hour\n\n public withHour(hour: number): Day {\n return this.mutate(d => d.hour(hour));\n }\n\n public relativeHours(hours: number): Day {\n return this.mutate(d => d.add(hours, 'hours'));\n }\n\n public prevHour(hours: number = 1): Day {\n return this.relativeHours( -hours );\n }\n\n public nextHour(hours: number = 1): Day {\n return this.relativeHours( hours );\n }\n\n // Time\n\n public withTimes(\n hour: number = Constants.HOUR_MIN,\n minute: number = Constants.MINUTE_MIN,\n second: number = Constants.SECOND_MIN,\n millisecond: number = Constants.MILLIS_MIN): Day {\n return this.mutate(d => d.set({hour, minute, second, millisecond}));\n }\n\n public withTime(time: Time): Day {\n return this.withTimes(time.hour, time.minute, time.second, time.millisecond);\n }\n\n public asTime(): Time {\n return new Time(this.hour, this.minute, this.seconds, this.millis);\n }\n\n // Start & End\n\n // Time\n\n public start(): Day {\n return this.mutate(d => d.startOf('day'));\n }\n\n public isStart(): boolean {\n return this.hour === Constants.HOUR_MIN &&\n this.minute === Constants.MINUTE_MIN &&\n this.seconds === Constants.SECOND_MIN &&\n this.millis === Constants.MILLIS_MIN;\n }\n\n public end(inclusive: boolean = true): Day {\n return inclusive ?\n this.mutate(d => d.endOf('day')) :\n this.mutate(d => d.startOf('day').add(1, 'day'));\n }\n\n public isEnd(): boolean {\n return this.hour === Constants.HOUR_MAX &&\n this.minute === Constants.MINUTE_MAX &&\n this.seconds === Constants.SECOND_MAX &&\n this.millis === Constants.MILLIS_MAX;\n }\n\n // Hour\n\n public startOfHour(): Day {\n return this.mutate(d => d.startOf('hour'));\n }\n\n public isStartOfHour(): boolean {\n return this.minute === Constants.MINUTE_MIN &&\n this.seconds === Constants.SECOND_MIN &&\n this.millis === Constants.MILLIS_MIN;\n }\n\n public endOfHour(inclusive: boolean = true): Day {\n return inclusive ?\n this.mutate(d => d.endOf('hour')) :\n this.mutate(d => d.startOf('hour').add(1, 'hour'));\n }\n\n public isEndOfHour(): boolean {\n return this.minute === Constants.MINUTE_MAX &&\n this.seconds === Constants.SECOND_MAX &&\n this.millis === Constants.MILLIS_MAX;\n }\n\n // Week\n\n public startOfWeek(): Day {\n return this.mutate(d => d.startOf('week'));\n }\n\n public isStartOfWeek(): boolean {\n return this.dayOfWeek === Constants.WEEKDAY_MIN;\n }\n\n public endOfWeek(inclusive: boolean = true): Day {\n return inclusive ?\n this.mutate(d => d.endOf('week')) :\n this.mutate(d => d.startOf('week').add(1, 'week'));\n }\n\n public isEndOfWeek(): boolean {\n return this.dayOfWeek === Constants.WEEKDAY_MAX;\n }\n\n // Month\n\n public startOfMonth(): Day {\n return this.mutate(d => d.startOf('month'));\n }\n\n public isStartOfMonth(): boolean {\n return this.dayOfMonth === Constants.DAY_MIN;\n }\n\n public endOfMonth(inclusive: boolean = true): Day {\n return inclusive ?\n this.mutate(d => d.endOf('month')) :\n this.mutate(d => d.startOf('month').add(1, 'month'));\n }\n\n public isEndOfMonth(): boolean {\n return this.dayOfMonth === this.daysInMonth();\n }\n\n // Year\n\n public startOfYear(): Day {\n return this.mutate(d => d.startOf('year'));\n }\n\n public isStartOfYear(): boolean {\n return this.month === Constants.MONTH_MIN && this.dayOfMonth === Constants.DAY_MIN;\n }\n\n public endOfYear(inclusive: boolean = true): Day {\n return inclusive ?\n this.mutate(d => d.endOf('year')) :\n this.mutate(d => d.startOf('year').add(1, 'year'));\n }\n\n public isEndOfYear(): boolean {\n return this.month === Constants.MONTH_MAX && this.dayOfMonth === Constants.DAY_MAX;\n }\n\n // Days In X\n\n public daysInMonth(): number {\n return this.date.daysInMonth();\n }\n\n public daysInYear(): number {\n return this.endOfYear().dayOfYear;\n }\n\n public weeksInYear(): number {\n return this.date.weeksInYear();\n }\n\n // Display\n\n public format(format: string): string {\n return this.date.format( format );\n }\n\n public utc(keepLocalTime?: boolean): Day {\n return this.mutate(d => d.utc(keepLocalTime));\n }\n\n public toMoment(): moment.Moment {\n return this.date.clone();\n }\n\n public toDate(): Date {\n return this.date.toDate();\n }\n\n public toArray(): number[] {\n return this.date.toArray();\n }\n\n public toJSON(): string {\n return this.date.toJSON();\n }\n\n public toISOString(keepOffset: boolean = false): string {\n return this.date.toISOString( keepOffset );\n }\n\n public toObject(): object {\n return this.date.toObject();\n }\n\n public toString(): string {\n return this.date.toString();\n }\n\n // State\n\n public isDST(): boolean {\n return this.date.isDST();\n }\n\n public isLeapYear(): boolean {\n return this.date.isLeapYear();\n }\n\n // Instances\n\n public static now(): Day {\n return new Day(moment());\n }\n\n public static today(): Day {\n return this.now().start();\n }\n\n public static tomorrow(): Day {\n return this.today().next();\n }\n\n public static fromMoment(moment: moment.Moment): Day {\n return moment && moment.isValid() ? new Day( moment ) : null;\n }\n\n public static unix(millis: number): Day {\n return this.fromMoment(moment(millis));\n }\n\n public static unixSeconds(millis: number): Day {\n return this.fromMoment(moment.unix(millis));\n }\n\n public static parse(input: DayInput): Day {\n return Parse.day(input);\n }\n\n public static fromString(input: string): Day {\n return this.fromMoment(moment(input));\n }\n\n public static fromFormat(input: string, formats: string | string[]): Day {\n return this.fromMoment(moment(input, formats));\n }\n\n public static fromObject(input: object): Day {\n return this.fromMoment(moment(input));\n }\n\n public static fromDate(input: Date): Day {\n return this.fromMoment(moment(input));\n }\n\n public static fromArray(input: number[]): Day {\n return this.fromMoment(moment(input));\n }\n\n public static fromDayIdentifier(id: number): Day {\n let date: number = id % 100;\n let month: number = (Math.floor(id / 100) % 100) - 1;\n let year: number = Math.floor(id / 10000);\n\n return this.build(year, month, date);\n }\n\n public static build(year: number, month: number,\n date: number = Constants.DAY_MIN,\n hour: number = Constants.HOUR_MIN,\n minute: number = Constants.MINUTE_MIN,\n second: number = Constants.SECOND_MIN,\n millisecond: number = Constants.MILLIS_MIN): Day\n {\n return new Day( moment({year, month, date, hour, minute, second, millisecond}) );\n }\n\n\n\n\n\n\n\n\n public static getWeekspanOfYear(date: moment.Moment): number\n {\n return Math.floor( (date.dayOfYear() - 1) / Constants.DAYS_IN_WEEK );\n }\n\n public static getLastWeekspanOfYear(date: moment.Moment): number\n {\n let lastOfYear = date.clone().endOf('year');\n let daysInYear: number = lastOfYear.dayOfYear();\n\n return Math.floor( (daysInYear - date.dayOfYear()) / Constants.DAYS_IN_WEEK );\n }\n\n public static getWeekOfYear(date: moment.Moment): number\n {\n let firstOfYear = date.clone().startOf('year');\n let weeks: number = date.week();\n\n return firstOfYear.day() > Constants.WEEK_OF_MONTH_MINIMUM_WEEKDAY ? weeks - 1 : weeks;\n }\n\n public static getFullWeekOfYear(date: moment.Moment): number\n {\n let firstOfYear = date.clone().startOf('year');\n let weeks: number = date.week();\n\n return firstOfYear.day() === Constants.WEEKDAY_MIN ? weeks : weeks - 1;\n }\n\n public static getLastFullWeekOfYear(date: moment.Moment): number\n {\n let firstOfYear = date.clone().startOf('year');\n let weeks: number = date.week();\n let weeksMax: number = date.weeksInYear();\n let lastWeek: number = weeksMax - weeks;\n\n return firstOfYear.day() === Constants.WEEKDAY_MIN ? lastWeek + 1 : lastWeek;\n }\n\n public static getWeekspanOfMonth(date: moment.Moment): number\n {\n return Math.floor((date.date() - 1) / Constants.DAYS_IN_WEEK);\n }\n\n public static getLastWeekspanOfMonth(date: moment.Moment): number\n {\n return Math.floor((date.daysInMonth() - date.date()) / Constants.DAYS_IN_WEEK);\n }\n\n public static getFullWeekOfMonth(date: moment.Moment): number\n {\n return Math.floor((date.date() - 1 - date.day() + Constants.DAYS_IN_WEEK) / Constants.DAYS_IN_WEEK);\n }\n\n public static getLastFullWeekOfMonth(date: moment.Moment): number\n {\n return Math.floor((date.daysInMonth() - date.date() - (Constants.WEEKDAY_MAX - date.day()) + Constants.DAYS_IN_WEEK) / Constants.DAYS_IN_WEEK);\n }\n\n public static getWeekOfMonth(date: moment.Moment): number\n {\n let dom = date.date();\n let dow = date.day();\n let sundayDate = dom - dow;\n\n return Math.floor( ( sundayDate + Constants.WEEK_OF_MONTH_MINIMUM_WEEKDAY + 5 ) / Constants.DAYS_IN_WEEK );\n }\n\n public static getLastDayOfMonth(date: moment.Moment): number\n {\n return date.daysInMonth() - date.date() + 1;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Day.ts","\nimport { Op } from './Operation';\nimport { Day } from './Day';\nimport { DaySpan } from './DaySpan';\nimport { CalendarEvent } from './CalendarEvent';\n\n\n/**\n * A day in a [[Calendar]] with extra information relative to any selection on\n * the calendar, the current date, or events on the day.\n *\n * @typeparam T The type of data stored in the [[Event]] class.\n * @typeparam M The type of metadata stored in the schedule.\n */\nexport class CalendarDay extends Day\n{\n\n /**\n * Whether this day is the current day (ex: today).\n */\n public currentDay: boolean = false;\n\n /**\n * Whether this day is on the same week as the current day (ex: today).\n */\n public currentWeek: boolean = false;\n\n /**\n * Whether this day is on the same month as the current day (ex: today).\n */\n public currentMonth: boolean = false;\n\n /**\n * Whether this day is on the same year as the current day (ex: today).\n */\n public currentYear: boolean = false;\n\n /**\n * How many days away this day is from the current day (ex: today). If this\n * day is the current day the offset is 0. If this day is before the current\n * day it will be the negative number of days away. Otherwise this will be\n * positive meaning this day is after the current day by the given days.\n */\n public currentOffset: number = 0;\n\n /**\n * Whether this day is part of a selection on the calendar.\n */\n public selectedDay: boolean = false;\n\n /**\n * Whether this day is on the same week that the calendar selection is.\n */\n public selectedWeek: boolean = false;\n\n /**\n * Whether this day is on the same month that the calendar selection is.\n */\n public selectedMonth: boolean = false;\n\n /**\n * Whether this day is on the same year that the calendar selection is.\n */\n public selectedYear: boolean = false;\n\n /**\n * Whether this day is in the current calendar or not. Some days are outside\n * the calendar span and used to fill in weeks. Month calendars will fill in\n * days so the list of days in the calendar start on Sunday and end on Saturday.\n */\n public inCalendar: boolean = false;\n\n /**\n * The list of events on this day based on the settings and schedules in the\n * calendar.\n */\n public events: CalendarEvent[] = [];\n\n\n /**\n * Updates the current flags on this day given the current day (ex: today).\n *\n * @param current The current day of the calendar.\n */\n public updateCurrent(current: Day): this\n {\n this.currentDay = this.sameDay(current);\n this.currentWeek = this.sameWeek(current);\n this.currentMonth = this.sameMonth(current);\n this.currentYear = this.sameYear(current);\n this.currentOffset = this.daysBetween(current, Op.DOWN, false);\n\n return this;\n }\n\n /**\n * Updates the selection flags on this day given the selection range on the\n * calendar.\n *\n * @param selected The span of days selected on the calendar.\n */\n public updateSelected(selected: DaySpan): this\n {\n this.selectedDay = selected.matchesDay(this);\n this.selectedWeek = selected.matchesWeek(this);\n this.selectedMonth = selected.matchesMonth(this);\n this.selectedYear = selected.matchesYear(this);\n\n return this;\n }\n\n /**\n * Clears the selection flags on this day. This is done when the selection on\n * the calendar is cleared.\n */\n public clearSelected(): this\n {\n this.selectedDay = this.selectedWeek = this.selectedMonth = this.selectedYear = false;\n\n return this;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/CalendarDay.ts","\nimport { Constants } from './Constants';\nimport { Day } from './Day';\nimport { DaySpan, DaySpanBounds } from './DaySpan';\nimport { Event } from './Event';\nimport { Identifier, IdentifierInput } from './Identifier';\nimport { Schedule } from './Schedule';\n\n\n/**\n * An instance of an [[Event]] on a given day of a [[Calendar]] generated by\n * the event's [[Schedule]].\n *\n * @typeparam T The type of data stored in the [[Event]] class.\n * @typeparam M The type of metadata stored in the schedule and in this class.\n */\nexport class CalendarEvent\n{\n\n /**\n * The relatively unique identifier of this event. It is generated based on\n * the index of the schedule in the calendar and the time of day listed in the\n * schedule. This number will no longer be unique if the schedule has more\n * than [[Constants.MAX_EVENTS_PER_DAY]] occurrences in a single day\n * (based on number of times in [[Schedule.times]]).\n */\n public id: number;\n\n /**\n * The event with the schedule.\n */\n public event: Event;\n\n /**\n * Any metadata specified for this event instance in the schedule.\n */\n public meta: M;\n\n /**\n * The day this event occurs on.\n */\n public day: Day;\n\n /**\n * The span of time this event occurs. If this is an all day event this span\n * will start at the beginning of the day and end at the beginning of the\n * next day.\n *\n * @see [[Schedule.isFullDay]]\n */\n public time: DaySpan;\n\n /**\n * Whether this event is an all day event.\n *\n * @see [[Schedule.isFullDay]]\n */\n public fullDay: boolean;\n\n /**\n * Whether this event is the first day of an occurrence. A calendar can\n * generate multiple [[CalendarEvent]] instances over each day it covers if\n * [[Calendar.repeatCovers]] is true. These instances have matching\n * [[CalendarEvent.id]] values.\n */\n public starting: boolean;\n\n /**\n * Whether this event is the last day of an occurrence. A calendar can\n * generate multiple [[CalendarEvent]] instances over each day it covers if\n * [[Calendar.repeatCovers]] is true. These instances have matching\n * [[CalendarEvent.id]] values.\n */\n public ending: boolean;\n\n /**\n * Whether this event instance was marked as cancelled in the schedule.\n */\n public cancelled: boolean;\n\n /**\n * The row this event is on in a visual calendar. An event can span multiple\n * days and it is desirable to have the occurrence on each day to line up.\n * This is only set when [[Calendar.updateRows]] is true or manually set.\n * This value makes sense for visual calendars for all day events or when the\n * visual calendar is not positioning events based on their time span.\n */\n public row: number = 0;\n\n /**\n * The column this event is on in a visual calendar. An event can have its\n * time overlap with another event displaying one of the events in another\n * column. This is only set when [[Calendar.updateColumns]] is true or\n * manually set. This value makes sense for visual calendars that are\n * displaying event occurrences at specific times positioned accordingly.\n */\n public col: number = 0;\n\n\n /**\n * Creates a new event instance given the id, the event paired with the\n * schedule, the schedule, the time span of the event, and the day on the\n * calendar the event belongs to.\n *\n * @param id The relatively unique identifier of this event.\n * @param event The event which created this instance.\n * @param time The time span of this event.\n * @param actualDay The day on the calendar this event is for.\n */\n public constructor(id: number, event: Event, time: DaySpan, actualDay: Day)\n {\n this.id = id;\n this.event = event;\n this.time = time;\n this.day = actualDay;\n this.fullDay = event.schedule.isFullDay();\n this.meta = event.schedule.getMeta( time.start );\n this.cancelled = event.schedule.isCancelled( time.start );\n this.starting = time.isPoint || time.start.sameDay( actualDay );\n this.ending = time.isPoint || time.end.relative(-1).sameDay( actualDay );\n }\n\n /**\n * The id of the schedule uniqe within the calendar which generated this event.\n */\n public get scheduleId(): number\n {\n return Math.floor( this.id / Constants.MAX_EVENTS_PER_DAY );\n }\n\n /**\n * The start timestamp of the event.\n */\n public get start(): Day\n {\n return this.time.start;\n }\n\n /**\n * The end timestamp of the event.\n */\n public get end(): Day\n {\n return this.time.end;\n }\n\n /**\n * The schedule which generated this event.\n */\n public get schedule(): Schedule\n {\n return this.event.schedule;\n }\n\n /**\n * The related event data.\n */\n public get data(): T\n {\n return this.event.data;\n }\n\n /**\n * An [[IdentifierInput]] for the start of this event.\n */\n public get identifier(): IdentifierInput\n {\n return this.identifierType.get( this.start );\n }\n\n /**\n * The [[Identifier]] for this event. Either [[Identifier.Day]] or\n * [[Identifier.Time]].\n */\n public get identifierType(): Identifier\n {\n return this.schedule.identifierType;\n }\n\n /**\n * Returns a delta value between 0 and 1 which represents where the\n * [[CalendarEvent.start]] is relative to [[CalendarEvent.day]]. The delta\n * value would be less than 0 if the start of the event is before\n * [[CalendarEvent.day]].\n */\n public get startDelta(): number\n {\n return this.time.startDelta( this.day );\n }\n\n /**\n * Returns a delta value between 0 and 1 which represents where the\n * [[CalendarEvent.end]] is relative to [[CalendarEvent.day]]. The delta value\n * would be greater than 1 if the end of the event is after\n * [[CalendarEvent.day]].\n */\n public get endDelta(): number\n {\n return this.time.endDelta( this.day );\n }\n\n /**\n * Calculates the bounds for this event if it were placed in a rectangle which\n * represents a day (24 hour period). By default the returned values are\n * between 0 and 1 and can be scaled by the proper rectangle dimensions or the\n * rectangle dimensions can be passed to this function.\n *\n * @param dayHeight The height of the rectangle of the day.\n * @param dayWidth The width of the rectangle of the day.\n * @param columnOffset The offset in the rectangle of the day to adjust this\n * event by if it intersects or is contained in a previous event. This also\n * reduces the width of the returned bounds to keep the bounds in the\n * rectangle of the day.\n * @param clip `true` if the bounds should stay in the day rectangle, `false`\n * and the bounds may go outside the rectangle of the day for multi-day\n * events.\n * @param offsetX How much to translate the left & right properties by.\n * @param offsetY How much to translate the top & bottom properties by.\n * @returns The calculated bounds for this event.\n */\n public getTimeBounds(dayHeight: number = 1, dayWidth: number = 1, columnOffset: number = 0.1, clip: boolean = true, offsetX: number = 0, offsetY: number = 0): DaySpanBounds\n {\n return this.time.getBounds( this.day, dayHeight, dayWidth, this.col * columnOffset, clip, offsetX, offsetY );\n }\n\n /**\n * Changes the cancellation status of this event. By default this cancels\n * this event - but `false` may be passed to undo a cancellation.\n *\n * @param cancelled Whether the event should be cancelled.\n */\n public cancel(cancelled: boolean = true): this\n {\n this.schedule.setCancelled( this.start, cancelled );\n this.cancelled = cancelled;\n\n return this;\n }\n\n /**\n * Changes the exclusion status of this event. By default this excludes this\n * event - but `false` may be passed to undo an exclusion.\n *\n * @param excluded Whether the event should be excluded.\n */\n public exclude(excluded: boolean = true): this\n {\n this.schedule.setExcluded( this.start, excluded );\n\n return this;\n }\n\n /**\n * Moves this event to potentially another day and time. A move is\n * accomplished by excluding the current event and adding an inclusion of the\n * new day & time. Any [[CalendarEvent.meta]] on this event will be moved to\n * the new event. If the schedule represents a single event\n * ([[Schedule.isSingleEvent]]) then the schedule frequencies are updated\n * to match the timestamp provided.\n *\n * @param toTime The timestamp to move this event to.\n * @returns Whether the event was moved to the given time.\n */\n public move(toTime: Day): boolean\n {\n return this.schedule.move( toTime, this.start, this.meta );\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/CalendarEvent.ts","\nimport { Functions as fn } from './Functions';\nimport { Day, DayInput } from './Day';\nimport { DaySpan } from './DaySpan';\nimport { Schedule } from './Schedule';\nimport { EventInput, Event } from './Event';\nimport { Op } from './Operation';\nimport { Units } from './Units';\nimport { Parse } from './Parse';\nimport { SortEvent } from './Sort';\nimport { Constants } from './Constants';\nimport { CalendarDay } from './CalendarDay';\nimport { CalendarEvent } from './CalendarEvent';\nimport { Iterator, IteratorAction } from './Iterator';\n\n\n/**\n * A function which moves a given day by some amount and some unit. This is\n * used to shift a calendar's frame via [[Calendar.next]] and [[Calendar.prev]].\n *\n * @param day The day to move.\n * @param amount The amount to move the day by.\n * @returns A new day instance moved by the given amount.\n */\nexport type CalendarMover = (day: Day, amount: number) => Day;\n\n/**\n * A definition for a given [[Units]] which informs a calendar how to setup the\n * [[Calendar.span]] and how to move with [[Calendar.move]].\n */\nexport interface CalendarTypeDefinition\n{\n getStart(around: Day, size: number, focus: number): Day;\n getEnd(start: Day, size: number, focus: number): Day;\n moveStart(day: Day, amount: number): Day;\n moveEnd(day: Day, amount: number): Day;\n defaultInput: any\n}\n\n/**\n * A map of [[CalendarTypeDefinition]] keyed by the [[Units]].\n */\nexport type CalendarTypeDefinitionMap = { [unit: number]: CalendarTypeDefinition };\n\n/**\n * Input used to initialize or mass change the properties of a [[Calendar]].\n *\n * @typeparam T The type of data stored in the [[Event]] class.\n * @typeparam M The type of metadata stored in the schedule.\n */\nexport interface CalendarInput\n{\n\n /**\n * @see [[Calendar.fill]]\n */\n fill?: boolean;\n /**\n * @see [[Calendar.minimumSize]]\n */\n minimumSize?: number;\n /**\n * @see [[Calendar.repeatCovers]]\n */\n repeatCovers?: boolean;\n /**\n * @see [[Calendar.listTimes]]\n */\n listTimes?: boolean;\n /**\n * @see [[Calendar.eventsOutside]]\n */\n eventsOutside?: boolean;\n /**\n * @see [[Calendar.updateRows]]\n */\n updateRows?: boolean;\n /**\n * @see [[Calendar.updateColumns]]\n */\n updateColumns?: boolean;\n /**\n * @see [[Calendar.eventSorter]]\n */\n eventSorter?: SortEvent;\n /**\n * @see [[Calendar.events]]\n */\n events?: EventInput[];\n /**\n * @see [[Calendar.type]]\n */\n type?: Units;\n /**\n * @see [[Calendar.size]]\n */\n size?: number; // 1\n /**\n * @see [[Calendar.parseMeta]]\n */\n parseMeta?: (input: any) => M;\n /**\n * @see [[Calendar.parseData]]\n */\n parseData?: (input: any) => T;\n /**\n * When morphing a calendar to a fewer number of days, do we want to keep\n * today in the calendar if it is already in the calendar?\n */\n preferToday?: boolean; // true\n /**\n * What day should the calendar be based around (contain)?\n */\n around?: DayInput; // null\n /**\n * When morphing a calendar and `preferToday` is false OR today is not in the\n * calendar AND `around` is not specified, we will pick a day at this number\n * in the current calendar (a value between 0 and 1 signifying the start and\n * and of the current calendar).\n */\n otherwiseFocus?: number; // 0.499999\n /**\n * When morphing or creating passing a value of `true` will avoid calling\n * [[Calendar.refresh]] as is typically done right after each of those\n * functions.\n */\n delayRefresh?: boolean; // false\n}\n\n/**\n * A collection of [[CalendarDay]]s, the events on the calendar, and all\n * [[CalendarEvent]]s generated based on the events.\n *\n * @typeparam T The type of data stored in the [[Event]] class.\n * @typeparam M The type of metadata stored in the schedule.\n */\nexport class Calendar\n{\n\n /**\n * The span of days in the calendar.\n */\n public span: DaySpan;\n\n /**\n * The full span of days represented on the calendar. This may be different\n * than the [[Calendar.span]] when [[Calendar.fill]] is `true` and the\n * calendar is representing months or years and the days need to start on\n * Sunday and end on Saturday.\n */\n public filled: DaySpan;\n\n /**\n * The number of days in the calendar specified by [[Calendar.span]].\n */\n public length: number;\n\n /**\n * The type of calendar.\n */\n public type: Units;\n\n /**\n * The size of the calendar. When the calendar type is...\n *\n * - [[Units.DAY]]: The number of days in the calendar.\n * - [[Units.WEEK]]: The number of weeks in the calendar.\n * - [[Units.MONTH]]: The number of months in the calendar.\n * - [[Units.YEAR]]: The number of years in the calendar.\n */\n public size: number;\n\n /**\n * The function used to move the start day of the calendar when functions like\n * [[Calendar.next]] or [[Calendar.prev]] are called.\n */\n public moveStart: CalendarMover;\n\n /**\n * The function used to move the end day of the calendar when functions like\n * [[Calendar.next]] or [[Calendar.prev]] are called.\n */\n public moveEnd: CalendarMover;\n\n\n /**\n * If the calendar should be filled in so the first day of the calendar is\n * Sunday and the last day is Saturday.\n */\n public fill: boolean = false;\n\n /**\n * The minimum number of days in the calendar no matter what the type or size\n * is. This can be used to display a month with a constant number of weeks -\n * because not all months contain the same number of weeks.\n */\n public minimumSize: number = 0;\n\n /**\n * When `true` a [[CalendarEvent]] instance exists on each [[CalendarDay]]\n * the event covers even if the event didn't start on that day.\n */\n public repeatCovers: boolean = true;\n\n /**\n * When `true` an event instance will be created for each time specified on\n * the schedule. If the schedule specifies an all day event then only one\n * event is added to a day. This is typically done when displaying days or\n * weeks and events can be displayed on a timeline.\n */\n public listTimes: boolean = false;\n\n /**\n * When `true` events will be added to days \"outside\" the calendar. Days\n * outside the calendar are days filled in when [[Calendar.fill]] is `true`.\n * More specifically days that are in [[Calendar.filled]] and not in\n * [[Calendar.span]].\n */\n public eventsOutside: boolean = false;\n\n /**\n * When `true` [[CalendarEvent.row]] will be set so when visually displaying\n * the event with others multi-day events will align and not overlap.\n */\n public updateRows: boolean = false;\n\n /**\n * When `true` [[CalendarEvent.col]] will be set so when visually displaying\n * the event based on start and end time any events that overlap with each\n * other will be \"indented\" to see the event below it.\n */\n public updateColumns: boolean = false;\n\n /**\n * The function (if any) which sorts the events on a calendar day.\n */\n public eventSorter: SortEvent = null;\n\n /**\n * A function to use when parsing meta input into the desired type.\n *\n * @param input The input to parse.\n * @returns The meta parsed from the given input, if any.\n */\n public parseMeta: (input: any) => M = (x => x);\n\n /**\n * A function to use when parsing meta input into the desired type.\n *\n * @param input The input to parse.\n * @returns The meta parsed from the given input, if any.\n */\n public parseData: (input: any) => T = (x => x);\n\n /**\n * A selection of days on the calendar. If no days are selected this is `null`.\n * This is merely used to keep the selection flags in [[CalendarDay]] updated\n * via [[Calendar.refreshSelection]].\n */\n public selection: DaySpan = null;\n\n /**\n * The array of days in this calendar and their events.\n */\n public days: CalendarDay[] = [];\n\n /**\n * The array of scheduled events added to the calendar.\n */\n public events: Event[] = [];\n\n /**\n * The array of visible events on the calendar. This is built based on the\n * span of the schedule in the given event and also the [[Event.visible]] flag.\n */\n public visible: Event[] = [];\n\n\n /**\n * Creates a new calendar given a span, type, size, moving functions, and\n * optionally some default properties for the calendar.\n *\n * @param start The first day on the calendar.\n * @param end The last day on the calendar.\n * @param type The calendar type used for describing the calendar and splitting it.\n * @param size The number of calendar types in this calendar.\n * @param moveStart The function to move the start day.\n * @param moveEnd The function to move the end by.\n * @param input The default properties for this calendar.\n * @see [[Calendar.start]]\n * @see [[Calendar.end]]\n * @see [[Calendar.type]]\n * @see [[Calendar.size]]\n * @see [[Calendar.moveStart]]\n * @see [[Calendar.moveEnd]]\n */\n public constructor(start: Day, end: Day, type: Units, size: number, moveStart: CalendarMover, moveEnd: CalendarMover, input?: CalendarInput)\n {\n this.span = new DaySpan(start, end);\n this.filled = new DaySpan(start, end);\n this.type = type;\n this.size = size;\n this.moveStart = moveStart;\n this.moveEnd = moveEnd;\n\n if (fn.isDefined(input))\n {\n this.set( input );\n }\n else\n {\n this.refresh();\n }\n }\n\n /**\n * Changes the calendar possibly morphing it to a different type or size if\n * specified in the given input. If the type and size are not morphed then\n * the following properties may be updated:\n *\n * - [[Calendar.fill]]\n * - [[Calendar.minimumSize]]\n * - [[Calendar.repeatCovers]]\n * - [[Calendar.listTimes]]\n * - [[Calendar.eventsOutside]]\n * - [[Calendar.updateRows]]\n * - [[Calendar.updateColumns]]\n * - [[Calendar.eventSorter]]\n * - [[Calendar.events]]\n * - [[Calendar.parseData]]\n * - [[Calendar.parseMeta]]\n *\n * If [[CalendarInput.delayRefresh]] is not given with `true` then\n * [[Calendar.refresh]] will be called once the calendar properties have been\n * updated.\n *\n * @param input The new properties for this calendar to overwrite with.\n */\n public set(input: CalendarInput): this\n {\n type CTD = CalendarTypeDefinition;\n\n let typeChange: boolean = fn.isDefined(input.type) && input.type !== this.type;\n let sizeChange: boolean = fn.isDefined(input.size) && input.size !== this.size;\n\n if (typeChange || sizeChange)\n {\n let focus: number = fn.coalesce( input.otherwiseFocus, 0.4999 );\n let prefer: boolean = fn.coalesce( input.preferToday, true );\n let size: number = fn.coalesce( input.size, this.size );\n let type: Units = fn.coalesce( input.type, this.type );\n let around: DayInput = fn.coalesce( input.around, this.days[ Math.floor( (this.days.length - 1) * focus ) ] );\n let today: Day = Day.today();\n\n if (!around || (prefer && this.span.matchesDay(today)))\n {\n around = today;\n }\n\n let meta: CTD = Calendar.TYPES[ type ];\n let start: Day = meta.getStart( Day.parse( around ), size, focus );\n let end: Day = meta.getEnd( start, size, focus );\n\n this.span.start = start;\n this.span.end = end;\n this.type = type;\n this.size = size;\n this.moveStart = meta.moveStart;\n this.moveEnd = meta.moveEnd;\n }\n else if (input.around)\n {\n let focus: number = fn.coalesce( input.otherwiseFocus, 0.4999 );\n let around: Day = Day.parse( input.around );\n let type: Units = this.type;\n let size: number = this.size;\n let meta: CTD = Calendar.TYPES[ type ];\n let start: Day = meta.getStart( around, size, focus );\n let end: Day = meta.getEnd( start, size, focus );\n\n this.span.start = start;\n this.span.end = end;\n }\n\n this.fill = fn.coalesce( input.fill, this.fill );\n this.minimumSize = fn.coalesce( input.minimumSize, this.minimumSize );\n this.repeatCovers = fn.coalesce( input.repeatCovers, this.repeatCovers );\n this.listTimes = fn.coalesce( input.listTimes, this.listTimes );\n this.eventsOutside = fn.coalesce( input.eventsOutside, this.eventsOutside );\n this.updateRows = fn.coalesce( input.updateRows, this.updateRows );\n this.updateColumns = fn.coalesce( input.updateColumns, this.updateColumns );\n this.eventSorter = fn.coalesce( input.eventSorter, this.eventSorter );\n this.parseMeta = fn.coalesce( input.parseMeta, this.parseMeta );\n this.parseData = fn.coalesce( input.parseData, this.parseData );\n\n if (fn.isArray(input.events))\n {\n this.removeEvents();\n this.addEvents(input.events, false, true);\n }\n\n if (!input.delayRefresh)\n {\n this.refresh();\n }\n\n return this;\n }\n\n /**\n * Sets the [[Calendar.minimumSize]] value and returns `this` for method\n * chaining.\n *\n * @param minimumSize The new value.\n */\n public withMinimumSize(minimumSize: number): this\n {\n this.minimumSize = minimumSize;\n this.refresh();\n\n return this;\n }\n\n /**\n * Sets the [[Calendar.repeatCovers]] value and returns `this` for method\n * chaining.\n *\n * @param repeatCovers The new value.\n */\n public withRepeatCovers(repeatCovers: boolean): this\n {\n this.repeatCovers = repeatCovers;\n this.refreshEvents();\n\n return this;\n }\n\n /**\n * Sets the [[Calendar.listTimes]] value and returns `this` for method\n * chaining.\n *\n * @param listTimes The new value.\n */\n public withListTimes(listTimes: boolean): this\n {\n this.listTimes = listTimes;\n this.refreshEvents();\n\n return this;\n }\n\n /**\n * Sets the [[Calendar.eventsOutside]] value and returns `this` for method\n * chaining.\n *\n * @param eventsOutside The new value.\n */\n public withEventsOutside(eventsOutside: boolean): this\n {\n this.eventsOutside = eventsOutside;\n this.refreshEvents();\n\n return this;\n }\n\n /**\n * Sets the [[Calendar.updateRows]] value and returns `this` for method\n * chaining.\n *\n * @param updateRows The new value.\n * @param refresh If the rows should be updated now if `updateRows` is `true`.\n */\n public withUpdateRows(updateRows: boolean, refresh: boolean = true): this\n {\n this.updateRows = updateRows;\n\n if (refresh && updateRows)\n {\n this.refreshRows();\n }\n\n return this;\n }\n\n /**\n * Sets the [[Calendar.updateColumns]] value and returns `this` for method\n * chaining.\n *\n * @param updateColumns The new value.\n * @param refresh If the columns should be updated now if `updateColumns` is\n * `true`.\n */\n public withUpdateColumns(updateColumns: boolean, refresh: boolean = true): this\n {\n this.updateColumns = updateColumns;\n\n if (refresh && updateColumns)\n {\n this.refreshColumns();\n }\n\n return this;\n }\n\n /**\n * Returns the start day of the calendar. If this calendar is filled, this\n * may not represent the very first day in the calendar.\n */\n public get start(): Day\n {\n return this.span.start;\n }\n\n /**\n * Returns the end day of the calendar. If this calendar is filled, this\n * may not represent the very last day in the calendar.\n */\n public get end(): Day\n {\n return this.span.end;\n }\n\n /**\n * Returns the summary of the span of time this calendar represents.\n *\n * @param dayOfWeek [[DaySpan.summary]]\n * @param short [[DaySpan.summary]]\n * @param repeat [[DaySpan.summary]]\n * @param contextual [[DaySpan.summary]]\n * @param delimiter [[DaySpan.summary]]\n * @see [[DaySpan.summary]]\n */\n public summary(dayOfWeek: boolean = true, short: boolean = false, repeat: boolean = false, contextual: boolean = true, delimiter: string = ' - '): string\n {\n return this.span.summary( this.type, dayOfWeek, short, repeat, contextual, delimiter );\n }\n\n /**\n * Splits up this calendar into an iterable collection of calendars. The\n * resulting iterator will return `size / by` number of calendars.\n *\n * @param by The new size of the resulting calendars. If the the size of the\n * current calendar is not divisible by this value the resulting calendars\n * may cover more or less than this calendar covers.\n * @returns An iterator for the calendars produced.\n */\n public split(by: number = 1): Iterator>\n {\n return new Iterator>(iterator =>\n {\n let start: Day = this.start;\n let end: Day = this.moveEnd( this.end, by - this.size );\n\n for (let i = 0; i < this.size; i++)\n {\n let calendar = new Calendar(start, end, this.type, by, this.moveStart, this.moveEnd, this);\n\n if (iterator.act(calendar) === IteratorAction.Stop)\n {\n return;\n }\n\n start = this.moveStart( start, by );\n end = this.moveEnd( end, by );\n }\n });\n }\n\n /**\n * Refreshes the days and events in this calendar based on the start and end\n * days, the calendar properties, and its eventss.\n *\n * @param today The current day to update the calendar days via\n * [[CalendarDay.updateCurrent]].\n */\n public refresh(today: Day = Day.today()): this\n {\n this.length = this.span.days(Op.UP, true);\n this.resetDays();\n this.refreshCurrent(today);\n this.refreshSelection();\n this.refreshVisible();\n this.refreshEvents();\n\n return this;\n }\n\n /**\n * Updates the [[Calendar.filled]] span based on [[Calendar.start]],\n * [[Calendar.end]], and [[Calendar.fill]] properties.\n */\n public resetFilled(): this\n {\n this.filled.start = this.fill ? this.start.startOfWeek() : this.start;\n this.filled.end = this.fill ? this.end.endOfWeek() : this.end;\n\n return this;\n }\n\n /**\n * Updates [[Calendar.days]] to match the span of days in the calendar.\n */\n public resetDays(): this\n {\n this.resetFilled();\n\n let days: CalendarDay[] = this.days;\n let filled: DaySpan = this.filled;\n let current: Day = filled.start;\n let daysBetween: number = filled.days(Op.UP);\n let total: number = Math.max( this.minimumSize, daysBetween );\n\n for (let i = 0; i < total; i++)\n {\n let day: CalendarDay = days[ i ];\n\n if (!day || !day.sameDay( current ))\n {\n day = new CalendarDay( current.date );\n\n if (i < days.length)\n {\n days.splice( i, 1, day );\n }\n else\n {\n days.push( day );\n }\n }\n\n day.inCalendar = this.span.contains( day );\n\n current = current.next();\n }\n\n if (days.length > total)\n {\n days.splice( total, days.length - total );\n }\n\n return this;\n }\n\n /**\n * Updates the list of visible schedules.\n */\n public refreshVisible(): this\n {\n let start: Day = this.filled.start;\n let end: Day = this.filled.end;\n\n this.visible = this.events.filter(e =>\n {\n return e.visible && e.schedule.matchesRange(start, end);\n });\n\n return this;\n }\n\n /**\n * Updates the days with the current day via [[CalendarDay.updateCurrent]].\n *\n * @param today The new current day.\n */\n public refreshCurrent(today: Day = Day.today()): this\n {\n this.iterateDays().iterate(d =>\n {\n d.updateCurrent(today);\n });\n\n return this;\n }\n\n /**\n * Updates the selection flags in [[CalendarDay]] based on the\n * [[Calendar.selection]] property.\n */\n public refreshSelection(): this\n {\n this.iterateDays().iterate(d =>\n {\n if (this.selection)\n {\n d.updateSelected( this.selection );\n }\n else\n {\n d.clearSelected();\n }\n });\n\n return this;\n }\n\n /**\n * Updates the [[CalendarDay.events]] based on the events in this calendar\n * and the following properties:\n *\n * - [[Calendar.eventsForDay]]\n * - [[Calendar.eventsOutside]]\n * - [[Calendar.listTimes]]\n * - [[Calendar.repeatCovers]]\n * - [[Calendar.updateRows]]\n * - [[Calendar.updateColumns]]\n */\n public refreshEvents(): this\n {\n this.iterateDays().iterate(d =>\n {\n if (d.inCalendar || this.eventsOutside)\n {\n d.events = this.eventsForDay(d, this.listTimes, this.repeatCovers);\n }\n });\n\n if (this.updateRows)\n {\n this.refreshRows();\n }\n\n if (this.updateColumns)\n {\n this.refreshColumns();\n }\n\n return this;\n }\n\n /**\n * Refreshes the [[CalendarEvent.row]] property as described in the link.\n */\n public refreshRows(): this\n {\n type EventToRowMap = { [id: number]: number };\n type UsedMap = { [row: number]: boolean };\n\n let eventToRow: EventToRowMap = {};\n let onlyFullDay: boolean = this.listTimes;\n\n this.iterateDays().iterate(d =>\n {\n if (d.dayOfWeek === 0)\n {\n eventToRow = {};\n }\n\n let used: UsedMap = {};\n\n for (let event of d.events)\n {\n if (onlyFullDay && !event.fullDay)\n {\n continue;\n }\n\n if (event.id in eventToRow)\n {\n used[ event.row = eventToRow[ event.id ] ] = true;\n }\n }\n\n let rowIndex: number = 0;\n\n for (let event of d.events)\n {\n if ((onlyFullDay && !event.fullDay) || event.id in eventToRow)\n {\n continue;\n }\n\n while (used[ rowIndex ])\n {\n rowIndex++;\n }\n\n eventToRow[ event.id ] = event.row = rowIndex;\n\n rowIndex++;\n }\n });\n\n return this;\n }\n\n /**\n * Refreshes the [[CalendarEvent.col]] property as described in the link.\n */\n public refreshColumns(): this\n {\n interface Marker {\n time: number,\n event: CalendarEvent,\n start: boolean,\n parent: Marker;\n }\n\n this.iterateDays().iterate(d =>\n {\n let markers: Marker[] = [];\n\n for (let event of d.events)\n {\n if (!event.fullDay)\n {\n markers.push({\n time: event.time.start.time,\n event: event,\n start: true,\n parent: null\n });\n\n markers.push({\n time: event.time.end.time - 1,\n event: event,\n start: false,\n parent: null\n });\n }\n }\n\n markers.sort((a, b) =>\n {\n return a.time - b.time;\n });\n\n let parent = null;\n\n for (let marker of markers)\n {\n if (marker.start)\n {\n marker.parent = parent;\n parent = marker;\n }\n else if (parent)\n {\n parent = parent.parent;\n }\n }\n\n for (let marker of markers)\n {\n if (marker.start)\n {\n marker.event.col = marker.parent ? marker.parent.event.col + 1 : 0;\n }\n }\n });\n\n return this;\n }\n\n /**\n * Iterates over all days in this calendar and passes each day to `iterator`.\n *\n * @param iterator The function to pass [[CalendarDay]]s to.\n */\n public iterateDays(): Iterator>\n {\n return new Iterator>(iterator =>\n {\n let days: CalendarDay[] = this.days;\n\n for (let i = 0; i < days.length; i++)\n {\n switch (iterator.act(days[ i ]))\n {\n case IteratorAction.Stop:\n return;\n }\n }\n });\n }\n\n /**\n * Returns the events for the given day optionally looking at schedule times,\n * optionally looking at events which cover multiple days, and optionally\n * sorted with the given function.\n *\n * @param day The day to find events for.\n * @param getTimes When `true` an event is added to the result for each time\n * specified in the schedule.\n * @param covers When `true` events which don't start on the given day but do\n * overlap are added to the result.\n * @param sorter The function to sort the events by, if any.\n * @returns An array of events that occurred on the given day.\n */\n public eventsForDay(day: Day, getTimes: boolean = true, covers: boolean = true, sorter: SortEvent = this.eventSorter): CalendarEvent[]\n {\n let events: CalendarEvent[] = [];\n let entries: Event[] = this.visible;\n\n for (let entryIndex = 0; entryIndex < entries.length; entryIndex++)\n {\n let entry: Event = entries[ entryIndex ];\n let schedule: Schedule = entry.schedule;\n let eventId: number = entryIndex * Constants.MAX_EVENTS_PER_DAY;\n let timeIndex: number = 0;\n\n schedule.iterateSpans( day, covers ).iterate((span, iterator) =>\n {\n events.push(new CalendarEvent(eventId + timeIndex++, entry, span, day));\n\n if (!getTimes)\n {\n iterator.stop();\n }\n });\n }\n\n if (sorter)\n {\n events.sort( sorter );\n }\n\n return events\n }\n\n /**\n * Finds the event given one of the ways to identify the event.\n *\n * @param input The value to use to search for an event.\n * @returns The refrence to the event or null if not found.\n */\n public findEvent(id: any): Event\n {\n for (let event of this.events)\n {\n if (event === id || event.schedule === id || event.data === id || event.id === id)\n {\n return event;\n }\n }\n\n return null;\n }\n\n /**\n * Removes the list of events if they exist in the calendar.\n *\n * @param events The array of events to remove if they exist. If no\n * events are passed (via `null`) then all events will be removed\n * from the calendar.\n * @param delayRefresh When `true` the [[Calendar.refreshEvents]] will not be\n * called after the events are removed.\n * @see [[Calendar.removeEvent]]\n * @see [[Calendar.refreshEvents]]\n */\n public removeEvents(events: any[] = null, delayRefresh: boolean = false): this\n {\n if (events)\n {\n for (let event of events)\n {\n this.removeEvent( event, true );\n }\n }\n else\n {\n this.events = [];\n }\n\n this.refreshVisible();\n\n if (!delayRefresh)\n {\n this.refreshEvents();\n }\n\n return this;\n }\n\n /**\n * Removes the given event if it exists on the calendar.\n *\n * @param event The event to remove if it exists.\n * @param delayRefresh When `true` the [[Calendar.refreshEvents]] will not be\n * called after the event is removed.\n * @see [[Calendar.refreshEvents]]\n */\n public removeEvent(event: any, delayRefresh: boolean = false): this\n {\n let found: Event = this.findEvent(event);\n\n if (found)\n {\n this.events.splice( this.events.indexOf(found), 1 );\n\n this.refreshVisible();\n\n if (!delayRefresh)\n {\n this.refreshEvents();\n }\n }\n\n return this;\n }\n\n /**\n * Adds the given event to this calendar if it doesn't exist already (or\n * `allowDuplicates` is `true`).\n *\n * @param event The event to add to the calendar.\n * @param allowDuplicates If an event can be added more than once.\n * @param delayRefresh When `true` the [[Calendar.refreshEvents]] will not be\n * called after the event is added.\n * @see [[Calendar.refreshEvents]]\n */\n public addEvent(event: EventInput, allowDuplicates: boolean = false, delayRefresh: boolean = false): this\n {\n let parsed: Event = Parse.event(event, this.parseData, this.parseMeta);\n\n if (!allowDuplicates)\n {\n let existing = this.findEvent(parsed);\n\n if (existing)\n {\n return this;\n }\n }\n\n this.events.push(parsed);\n\n this.refreshVisible();\n\n if (!delayRefresh)\n {\n this.refreshEvents();\n }\n\n return this;\n }\n\n /**\n * Adds the given events to this calendar if they don't exist already (or\n * `allowDuplicates` is `true`).\n *\n * @param events The events to add to the calendar.\n * @param allowDuplicates If an event can be added more than once.\n * @param delayRefresh When `true` the [[Calendar.refreshEvents]] will not be\n * called after the events are added.\n * @see [[Calendar.refreshEvents]]\n */\n public addEvents(events: EventInput[], allowDuplicates: boolean = false, delayRefresh: boolean = false): this\n {\n for (let event of events)\n {\n this.addEvent(event, allowDuplicates, true);\n }\n\n if (!delayRefresh)\n {\n this.refreshEvents();\n }\n\n return this;\n }\n\n /**\n * Sets the selection point or range of the calendar and updates the flags\n * in the days.\n *\n * @param start The start of the selection.\n * @param end The end of the selection.\n * @see [[Calendar.refreshSelection]]\n */\n public select(start: Day, end: Day = start): this\n {\n this.selection = new DaySpan( start, end );\n this.refreshSelection();\n\n return this;\n }\n\n /**\n * Sets the selection of the calendar to nothing.\n *\n * @see [[Calendar.refreshSelection]]\n */\n public unselect(): this\n {\n this.selection = null;\n this.refreshSelection();\n\n return this;\n }\n\n /**\n * Shifts the calendar days by the given amount.\n *\n * @param jump The amount to shift the calendar by.\n * @param delayRefresh When `true` [[Calendar.refresh]] will not be called\n * after calendar is moved.\n */\n public move(jump: number = this.size, delayRefresh: boolean = false): this\n {\n this.span.start = this.moveStart( this.start, jump );\n this.span.end = this.moveEnd( this.end, jump );\n\n if (!delayRefresh)\n {\n this.refresh();\n }\n\n return this;\n }\n\n /**\n * Moves the calenndar to the next set of days.\n *\n * @param jump The amount to shift the calendar by.\n * @param delayRefresh When `true` [[Calendar.refresh]] will not be called\n * after calendar is moved.\n */\n public next(jump: number = this.size, delayRefresh: boolean = false): this\n {\n return this.move( jump, delayRefresh );\n }\n\n /**\n * Moves the calenndar to the previous set of days.\n *\n * @param jump The amount to shift the calendar by.\n * @param delayRefresh When `true` [[Calendar.refresh]] will not be called\n * after calendar is moved.\n */\n public prev(jump: number = this.size, delayRefresh: boolean = false): this\n {\n return this.move( -jump, delayRefresh );\n }\n\n /**\n * Converts this calendar to input which can be used to later recreate this\n * calendar. The only properties of the calendar which will be loss is the\n * [[Calendar.eventSorter]] property because it is a function.\n *\n * @param plain If the returned input should be plain objects as opposed\n * to [[Day]] and [[Event]] instances.\n * @param plainData A function to convert [[Event.data]] to a plain object if\n * it is not already.\n * @param plainMeta A function to convert values in [[Schedule.meta]] to plain\n * objects if they are not alreday.\n * @returns The input generated from this calendar.\n */\n public toInput(plain: boolean = false,\n plainData: (data: T) => any = d => d,\n plainMeta: (meta: M) => any = m => m): CalendarInput\n {\n let out: CalendarInput = {};\n\n out.type = this.type;\n out.size = this.size;\n out.fill = this.fill;\n out.minimumSize = this.minimumSize;\n out.repeatCovers = this.repeatCovers;\n out.listTimes = this.listTimes;\n out.eventsOutside = this.eventsOutside;\n out.updateRows = this.updateRows;\n out.updateColumns = this.updateColumns;\n out.around = plain ? this.span.start.dayIdentifier : this.span.start;\n out.events = [];\n\n for (let event of this.events)\n {\n if (plain)\n {\n let plainEvent: any = {};\n\n if (fn.isDefined(event.id))\n {\n plainEvent.id = event.id;\n }\n\n if (fn.isDefined(event.data))\n {\n plainEvent.data = plainData( event.data );\n }\n\n if (!event.visible)\n {\n plainEvent.visible = event.visible;\n }\n\n plainEvent.schedule = event.schedule.toInput();\n\n let meta = plainEvent.schedule.meta;\n\n if (meta)\n {\n for (let identifier in meta)\n {\n meta[ identifier ] = plainMeta( meta[ identifier ] );\n }\n }\n\n out.events.push( plainEvent );\n }\n else\n {\n out.events.push( event );\n }\n }\n\n return out;\n }\n\n /**\n * Creates a calendar based on the given input.\n *\n * @param input The input which has at least the `type` specified.\n * @returns A new calendar instance.\n */\n public static fromInput(input: CalendarInput): Calendar\n {\n let initial: Day = Day.today();\n\n return new Calendar(initial, initial, null, 1, null, null, input);\n }\n\n /**\n * Creates a calendar based around a given unit optionally focused around a\n * given day.\n *\n * @param type The unit of the calendar.\n * @param days The number of units in the calendar.\n * @param around The day to focus the calendar on.\n * @param focus The value which describes how months are added around the given\n * day. The default value will center the calendar around the given day.\n * When the value is `0` the given day is the first day in the calendar,\n * and when the value is `1` the given day is the last day in the calendar.\n * @param input The default properties for the calendar.\n * @returns A new calendar instance.\n */\n public static forType(type: Units, size: number = 1, around: Day = Day.today(), focus: number = 0.49999, input?: CalendarInput): Calendar\n {\n let meta: CalendarTypeDefinition = this.TYPES[ type ];\n let start: Day = meta.getStart( around, size, focus );\n let end: Day = meta.getEnd( start, size, focus );\n\n return new Calendar(start, end, type, size, meta.moveStart, meta.moveEnd, input || meta.defaultInput);\n }\n\n\n /**\n * Creates a calendar based around days optionally focused around a given day.\n *\n * @param days The number of days in the calendar.\n * @param around The day to focus the calendar on.\n * @param focus The value which describes how days are added around the given\n * day. The default value will center the calendar around the given day.\n * When the value is `0` the given day is the first day in the calendar,\n * and when the value is `1` the given day is the last day in the calendar.\n * @param input The default properties for the calendar.\n * @returns A new calendar instance.\n * @see [[Calendar.forType]]\n */\n public static days(days: number = 1, around: Day = Day.today(), focus: number = 0.4999, input?: CalendarInput): Calendar\n {\n return this.forType( Units.DAY, days, around, focus, input );\n }\n\n /**\n * Creates a calendar based around weeks optionally focused around a given day.\n *\n * @param days The number of weeks in the calendar.\n * @param around The day to focus the calendar on.\n * @param focus The value which describes how weeks are added around the given\n * day. The default value will center the calendar around the given day.\n * When the value is `0` the given day is the first day in the calendar,\n * and when the value is `1` the given day is the last day in the calendar.\n * @param input The default properties for the calendar.\n * @returns A new calendar instance.\n * @see [[Calendar.forType]]\n */\n public static weeks(weeks: number = 1, around: Day = Day.today(), focus: number = 0.4999, input?: CalendarInput): Calendar\n {\n return this.forType( Units.WEEK, weeks, around, focus, input );\n }\n\n /**\n * Creates a calendar based around months optionally focused around a given day.\n *\n * @param days The number of months in the calendar.\n * @param around The day to focus the calendar on.\n * @param focus The value which describes how months are added around the given\n * day. The default value will center the calendar around the given day.\n * When the value is `0` the given day is the first day in the calendar,\n * and when the value is `1` the given day is the last day in the calendar.\n * @param input The default properties for the calendar.\n * @returns A new calendar instance.\n * @see [[Calendar.forType]]\n */\n public static months(months: number = 1, around: Day = Day.today(), focus: number = 0.4999, input?: CalendarInput): Calendar\n {\n return this.forType( Units.MONTH, months, around, focus, input );\n }\n\n /**\n * Creates a calendar based around years optionally focused around a given day.\n *\n * @param days The number of years in the calendar.\n * @param around The day to focus the calendar on.\n * @param focus The value which describes how years are added around the given\n * day. The default value will center the calendar around the given day.\n * When the value is `0` the given day is the first day in the calendar,\n * and when the value is `1` the given day is the last day in the calendar.\n * @param input The default properties for the calendar.\n * @returns A new calendar instance.\n * @see [[Calendar.forType]]\n */\n public static years(years: number = 1, around: Day = Day.today(), focus: number = 0.4999, input?: CalendarInput): Calendar\n {\n return this.forType( Units.YEAR, years, around, focus, input );\n }\n\n /**\n * A map of functions and properties by [[Units]] used to create or morph\n * Calendars.\n */\n public static TYPES: CalendarTypeDefinitionMap =\n {\n [Units.DAY]:\n {\n getStart(around: Day, size: number, focus: number): Day {\n return around.start().relativeDays( -Math.floor( size * focus ) )\n },\n getEnd(start: Day, size: number, focus: number): Day {\n return start.relativeDays( size - 1 ).end();\n },\n moveStart(day: Day, amount: number): Day {\n return day.relativeDays(amount);\n },\n moveEnd(day: Day, amount: number): Day {\n return day.relativeDays(amount);\n },\n defaultInput: undefined\n },\n [Units.WEEK]:\n {\n getStart(around: Day, size: number, focus: number): Day {\n return around.start().startOfWeek().relativeWeeks( -Math.floor( size * focus ) );\n },\n getEnd(start: Day, size: number, focus: number): Day {\n return start.relativeWeeks( size - 1 ).endOfWeek();\n },\n moveStart(day: Day, amount: number): Day {\n return day.relativeWeeks(amount);\n },\n moveEnd(day: Day, amount: number): Day {\n return day.relativeWeeks(amount);\n },\n defaultInput: undefined\n },\n [Units.MONTH]:\n {\n getStart(around: Day, size: number, focus: number): Day {\n return around.start().startOfMonth().relativeMonths( -Math.floor( size * focus ) );\n },\n getEnd(start: Day, size: number, focus: number): Day {\n return start.relativeMonths( size - 1 ).endOfMonth();\n },\n moveStart(day: Day, amount: number): Day {\n return day.relativeMonths(amount);\n },\n moveEnd(day: Day, amount: number): Day {\n return day.startOfMonth().relativeMonths(amount).endOfMonth();\n },\n defaultInput: { fill: true }\n },\n [Units.YEAR]:\n {\n getStart(around: Day, size: number, focus: number): Day {\n return around.start().startOfYear().relativeYears( -Math.floor( size * focus ) );\n },\n getEnd(start: Day, size: number, focus: number): Day {\n return start.relativeYears( size - 1 ).endOfYear();\n },\n moveStart(day: Day, amount: number): Day {\n return day.relativeYears(amount);\n },\n moveEnd(day: Day, amount: number): Day {\n return day.relativeYears(amount);\n },\n defaultInput: { fill: true }\n }\n };\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Calendar.ts","\n/**\n * The months in a year.\n */\nexport class Month\n{\n\n public static JANUARY: number = 0;\n public static FEBRUARY: number = 1;\n public static MARCH: number = 2;\n public static APRIL: number = 3;\n public static MAY: number = 4;\n public static JUNE: number = 5;\n public static JULY: number = 6;\n public static AUGUST: number = 7;\n public static SEPTEMBER: number = 8;\n public static OCTOBER: number = 9;\n public static NOVEMBER: number = 10;\n public static DECEMBER: number = 11;\n\n /**\n * The full list of months in a year.\n */\n public static LIST: number[] = [\n Month.JANUARY,\n Month.FEBRUARY,\n Month.MARCH,\n Month.APRIL,\n Month.MAY,\n Month.JUNE,\n Month.JULY,\n Month.AUGUST,\n Month.SEPTEMBER,\n Month.OCTOBER,\n Month.NOVEMBER,\n Month.DECEMBER\n ];\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Month.ts","\n\n/**\n * The days in a week.\n */\nexport class Weekday\n{\n\n public static SUNDAY: number = 0;\n public static MONDAY: number = 1;\n public static TUESDAY: number = 2;\n public static WEDNESDAY: number = 3;\n public static THURSDAY: number = 4;\n public static FRIDAY: number = 5;\n public static SATURDAY: number = 6;\n\n /**\n * The full list of days in a week.\n */\n public static LIST: number[] = [\n Weekday.SUNDAY,\n Weekday.MONDAY,\n Weekday.TUESDAY,\n Weekday.WEDNESDAY,\n Weekday.THURSDAY,\n Weekday.FRIDAY,\n Weekday.SATURDAY\n ];\n\n /**\n * The list of days starting with Monday and ending on Friday.\n */\n public static WEEK: number[] = [\n Weekday.MONDAY,\n Weekday.TUESDAY,\n Weekday.WEDNESDAY,\n Weekday.THURSDAY,\n Weekday.FRIDAY\n ];\n\n /**\n * The days on the weekend, starting with Saturday and ending with Sunday.\n */\n public static ENDS: number[] = [\n Weekday.SATURDAY,\n Weekday.SUNDAY\n ];\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Weekday.ts","\nimport { CalendarEvent } from './CalendarEvent';\nimport { Event } from './Event';\n\n\n/**\n * A function which takes two [[CalendarEvent]]s and returns a number which\n * instructs a sort which event goes before the other in a list.\n *\n * @param a The first event.\n * @param b The second event.\n * @returns When both events are considered equal `0` is returned, when the\n * first event should go before the second event a negative number is\n * returned, when the second event should go before the first event a\n * positive number is returned.\n */\nexport type SortEvent = (a: CalendarEvent, b: CalendarEvent) => number;\n\n/**\n * A class with [[SortEvent]] functions and functions which accept other\n * [[SortEvent]]s and return a new [[SortEvent]].\n *\n * ```typescript\n * // Sorts full day events first, then events in descending order based on start time.\n * Sorts.List([Sorts.FullDay, Sorts.Desc(Sorts.Start)]);\n * ```\n */\nexport class Sorts\n{\n\n /**\n * Sorts the two events by their start time - the earliest event being first\n * in order.\n *\n * @param a The first event.\n * @param b The second event.\n * @returns The difference in time between the start of `a` and `b`.\n * @see [[CalendarEvent.time]]\n */\n public static Start(a: CalendarEvent, b: CalendarEvent): number\n {\n return a.time.start.time - b.time.start.time;\n }\n\n /**\n * Sorts the two events by their end time - the earliest to end being first\n * in order.\n *\n * @param a The first event.\n * @param b The second event.\n * @returns The difference in time between the end of `a` and `b`.\n * @see [[CalendarEvent.time]]\n */\n public static End(a: CalendarEvent, b: CalendarEvent): number\n {\n return a.time.end.time - b.time.end.time;\n }\n\n /**\n * Sorts the two events placing the full day events before the timed events.\n *\n * @param a The first event.\n * @param b The second event.\n * @returns If both are timed or both are full day then `0` is returned,\n * otherwise `-1` is returned if `a` is full day and `1` is returned if\n * `b` is full day.\n * @see [[CalendarEvent.fullDay]]\n */\n public static FullDay(a: CalendarEvent, b: CalendarEvent): number\n {\n let af: number = a.fullDay ? 0 : 1;\n let bf: number = b.fullDay ? 0 : 1;\n\n return af - bf;\n }\n\n /**\n * Sorts the two events placing the shorter events before the longer events.\n * Full day or multiple day events actually take up a day and will be ordered\n * last.\n *\n * @param a The first event.\n * @param b The second event.\n * @returns The difference in milliseconds between `a` and `b`.\n * @see [[CalendarEvent.time]]\n * @see [[DaySpan.millis]]\n */\n public static Duration(a: CalendarEvent, b: CalendarEvent): number\n {\n return a.time.millis() - b.time.millis();\n }\n\n /**\n * Returns a [[SortEvent]] that effectively orders the given sorter in the\n * opposite (often descending) order.\n *\n * @param sorter The sorter to reverse.\n * @returns A new sorter which reverses the one passed in.\n */\n public static Desc(sorter: SortEvent): SortEvent\n {\n return (a, b) =>\n {\n return sorter( b, a );\n };\n }\n\n /**\n * Returns a [[SortEvent]] that orders the events based on a string in each\n * event. A function must be supplied which takes an event of type `T` and\n * returns a string.\n *\n * @param getString A function which returns a string from the event.\n * @returns A sorter which sorts strings alphabetically.\n */\n public static Alphabetical(getString: (event: Event) => string): SortEvent\n {\n return (a, b) =>\n {\n let as: string = getString( a.event ) || '';\n let bs: string = getString( b.event ) || '';\n\n return as.localeCompare( bs );\n };\n }\n\n /**\n * Returns a [[SortEvent]] that orders events based on a number in each event.\n * A function must be supplied which takes an event of type `T` and returns\n * a number.\n *\n * @param getOrder A function which returns a number from the event.\n * @returns A sorter which sorts events based on a number in ascending order.\n */\n public static Ordered(getOrder: (event: Event) => number): SortEvent\n {\n return (a, b) =>\n {\n let ao: number = getOrder( a.event );\n let bo: number = getOrder( b.event );\n\n return ao - bo;\n };\n }\n\n /**\n * Returns a [[SortEvent]] that orders events based on an array of sorters.\n * The first sorter which returns a non-zero result is used.\n *\n * @param sorters A list of sorting functions to test one at a time.\n * @returns A sorter which sorts based on a list of sorters.\n */\n public static List(sorters: SortEvent[]): SortEvent\n {\n return (a, b) =>\n {\n for (let sorter of sorters)\n {\n let compare: number = sorter(a, b);\n\n if (compare !== 0)\n {\n return compare;\n }\n }\n\n return 0;\n };\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/Sort.ts"],"sourceRoot":""} \ No newline at end of file