1 ?\n ' colspan=\"' + colspan + '\"' :\n '') +\n (otherAttrs ?\n ' ' + otherAttrs :\n '') +\n '>' +\n (isDateValid ?\n // don't make a link if the heading could represent multiple days, or if there's only one day (forceOff)\n buildGotoAnchorHtml(options, dateEnv, { date: dateMarker, forceOff: !datesRepDistinctDays || colCnt === 1 }, innerHtml) :\n // if not valid, display text, but no link\n innerHtml) +\n '
';\n}\n\nvar DayHeader = /** @class */ (function (_super) {\n __extends(DayHeader, _super);\n function DayHeader(parentEl) {\n var _this = _super.call(this) || this;\n _this.renderSkeleton = memoizeRendering(_this._renderSkeleton, _this._unrenderSkeleton);\n _this.parentEl = parentEl;\n return _this;\n }\n DayHeader.prototype.render = function (props, context) {\n var dates = props.dates, datesRepDistinctDays = props.datesRepDistinctDays;\n var parts = [];\n this.renderSkeleton(context);\n if (props.renderIntroHtml) {\n parts.push(props.renderIntroHtml());\n }\n var colHeadFormat = createFormatter(context.options.columnHeaderFormat ||\n computeFallbackHeaderFormat(datesRepDistinctDays, dates.length));\n for (var _i = 0, dates_1 = dates; _i < dates_1.length; _i++) {\n var date = dates_1[_i];\n parts.push(renderDateCell(date, props.dateProfile, datesRepDistinctDays, dates.length, colHeadFormat, context));\n }\n if (context.isRtl) {\n parts.reverse();\n }\n this.thead.innerHTML = '
' + parts.join('') + '
';\n };\n DayHeader.prototype.destroy = function () {\n _super.prototype.destroy.call(this);\n this.renderSkeleton.unrender();\n };\n DayHeader.prototype._renderSkeleton = function (context) {\n var theme = context.theme;\n var parentEl = this.parentEl;\n parentEl.innerHTML = ''; // because might be nbsp\n parentEl.appendChild(this.el = htmlToElement('
' +\n '
' +\n '' +\n '
' +\n '
'));\n this.thead = this.el.querySelector('thead');\n };\n DayHeader.prototype._unrenderSkeleton = function () {\n removeElement(this.el);\n };\n return DayHeader;\n}(Component));\n\nvar DaySeries = /** @class */ (function () {\n function DaySeries(range, dateProfileGenerator) {\n var date = range.start;\n var end = range.end;\n var indices = [];\n var dates = [];\n var dayIndex = -1;\n while (date < end) { // loop each day from start to end\n if (dateProfileGenerator.isHiddenDay(date)) {\n indices.push(dayIndex + 0.5); // mark that it's between indices\n }\n else {\n dayIndex++;\n indices.push(dayIndex);\n dates.push(date);\n }\n date = addDays(date, 1);\n }\n this.dates = dates;\n this.indices = indices;\n this.cnt = dates.length;\n }\n DaySeries.prototype.sliceRange = function (range) {\n var firstIndex = this.getDateDayIndex(range.start); // inclusive first index\n var lastIndex = this.getDateDayIndex(addDays(range.end, -1)); // inclusive last index\n var clippedFirstIndex = Math.max(0, firstIndex);\n var clippedLastIndex = Math.min(this.cnt - 1, lastIndex);\n // deal with in-between indices\n clippedFirstIndex = Math.ceil(clippedFirstIndex); // in-between starts round to next cell\n clippedLastIndex = Math.floor(clippedLastIndex); // in-between ends round to prev cell\n if (clippedFirstIndex <= clippedLastIndex) {\n return {\n firstIndex: clippedFirstIndex,\n lastIndex: clippedLastIndex,\n isStart: firstIndex === clippedFirstIndex,\n isEnd: lastIndex === clippedLastIndex\n };\n }\n else {\n return null;\n }\n };\n // Given a date, returns its chronolocial cell-index from the first cell of the grid.\n // If the date lies between cells (because of hiddenDays), returns a floating-point value between offsets.\n // If before the first offset, returns a negative number.\n // If after the last offset, returns an offset past the last cell offset.\n // Only works for *start* dates of cells. Will not work for exclusive end dates for cells.\n DaySeries.prototype.getDateDayIndex = function (date) {\n var indices = this.indices;\n var dayOffset = Math.floor(diffDays(this.dates[0], date));\n if (dayOffset < 0) {\n return indices[0] - 1;\n }\n else if (dayOffset >= indices.length) {\n return indices[indices.length - 1] + 1;\n }\n else {\n return indices[dayOffset];\n }\n };\n return DaySeries;\n}());\n\nvar DayTable = /** @class */ (function () {\n function DayTable(daySeries, breakOnWeeks) {\n var dates = daySeries.dates;\n var daysPerRow;\n var firstDay;\n var rowCnt;\n if (breakOnWeeks) {\n // count columns until the day-of-week repeats\n firstDay = dates[0].getUTCDay();\n for (daysPerRow = 1; daysPerRow < dates.length; daysPerRow++) {\n if (dates[daysPerRow].getUTCDay() === firstDay) {\n break;\n }\n }\n rowCnt = Math.ceil(dates.length / daysPerRow);\n }\n else {\n rowCnt = 1;\n daysPerRow = dates.length;\n }\n this.rowCnt = rowCnt;\n this.colCnt = daysPerRow;\n this.daySeries = daySeries;\n this.cells = this.buildCells();\n this.headerDates = this.buildHeaderDates();\n }\n DayTable.prototype.buildCells = function () {\n var rows = [];\n for (var row = 0; row < this.rowCnt; row++) {\n var cells = [];\n for (var col = 0; col < this.colCnt; col++) {\n cells.push(this.buildCell(row, col));\n }\n rows.push(cells);\n }\n return rows;\n };\n DayTable.prototype.buildCell = function (row, col) {\n return {\n date: this.daySeries.dates[row * this.colCnt + col]\n };\n };\n DayTable.prototype.buildHeaderDates = function () {\n var dates = [];\n for (var col = 0; col < this.colCnt; col++) {\n dates.push(this.cells[0][col].date);\n }\n return dates;\n };\n DayTable.prototype.sliceRange = function (range) {\n var colCnt = this.colCnt;\n var seriesSeg = this.daySeries.sliceRange(range);\n var segs = [];\n if (seriesSeg) {\n var firstIndex = seriesSeg.firstIndex, lastIndex = seriesSeg.lastIndex;\n var index = firstIndex;\n while (index <= lastIndex) {\n var row = Math.floor(index / colCnt);\n var nextIndex = Math.min((row + 1) * colCnt, lastIndex + 1);\n segs.push({\n row: row,\n firstCol: index % colCnt,\n lastCol: (nextIndex - 1) % colCnt,\n isStart: seriesSeg.isStart && index === firstIndex,\n isEnd: seriesSeg.isEnd && (nextIndex - 1) === lastIndex\n });\n index = nextIndex;\n }\n }\n return segs;\n };\n return DayTable;\n}());\n\nvar Slicer = /** @class */ (function () {\n function Slicer() {\n this.sliceBusinessHours = memoize(this._sliceBusinessHours);\n this.sliceDateSelection = memoize(this._sliceDateSpan);\n this.sliceEventStore = memoize(this._sliceEventStore);\n this.sliceEventDrag = memoize(this._sliceInteraction);\n this.sliceEventResize = memoize(this._sliceInteraction);\n }\n Slicer.prototype.sliceProps = function (props, dateProfile, nextDayThreshold, calendar, component) {\n var extraArgs = [];\n for (var _i = 5; _i < arguments.length; _i++) {\n extraArgs[_i - 5] = arguments[_i];\n }\n var eventUiBases = props.eventUiBases;\n var eventSegs = this.sliceEventStore.apply(this, [props.eventStore, eventUiBases, dateProfile, nextDayThreshold, component].concat(extraArgs));\n return {\n dateSelectionSegs: this.sliceDateSelection.apply(this, [props.dateSelection, eventUiBases, component].concat(extraArgs)),\n businessHourSegs: this.sliceBusinessHours.apply(this, [props.businessHours, dateProfile, nextDayThreshold, calendar, component].concat(extraArgs)),\n fgEventSegs: eventSegs.fg,\n bgEventSegs: eventSegs.bg,\n eventDrag: this.sliceEventDrag.apply(this, [props.eventDrag, eventUiBases, dateProfile, nextDayThreshold, component].concat(extraArgs)),\n eventResize: this.sliceEventResize.apply(this, [props.eventResize, eventUiBases, dateProfile, nextDayThreshold, component].concat(extraArgs)),\n eventSelection: props.eventSelection\n }; // TODO: give interactionSegs?\n };\n Slicer.prototype.sliceNowDate = function (// does not memoize\n date, component) {\n var extraArgs = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n extraArgs[_i - 2] = arguments[_i];\n }\n return this._sliceDateSpan.apply(this, [{ range: { start: date, end: addMs(date, 1) }, allDay: false },\n {},\n component].concat(extraArgs));\n };\n Slicer.prototype._sliceBusinessHours = function (businessHours, dateProfile, nextDayThreshold, calendar, component) {\n var extraArgs = [];\n for (var _i = 5; _i < arguments.length; _i++) {\n extraArgs[_i - 5] = arguments[_i];\n }\n if (!businessHours) {\n return [];\n }\n return this._sliceEventStore.apply(this, [expandRecurring(businessHours, computeActiveRange(dateProfile, Boolean(nextDayThreshold)), calendar),\n {},\n dateProfile,\n nextDayThreshold,\n component].concat(extraArgs)).bg;\n };\n Slicer.prototype._sliceEventStore = function (eventStore, eventUiBases, dateProfile, nextDayThreshold, component) {\n var extraArgs = [];\n for (var _i = 5; _i < arguments.length; _i++) {\n extraArgs[_i - 5] = arguments[_i];\n }\n if (eventStore) {\n var rangeRes = sliceEventStore(eventStore, eventUiBases, computeActiveRange(dateProfile, Boolean(nextDayThreshold)), nextDayThreshold);\n return {\n bg: this.sliceEventRanges(rangeRes.bg, component, extraArgs),\n fg: this.sliceEventRanges(rangeRes.fg, component, extraArgs)\n };\n }\n else {\n return { bg: [], fg: [] };\n }\n };\n Slicer.prototype._sliceInteraction = function (interaction, eventUiBases, dateProfile, nextDayThreshold, component) {\n var extraArgs = [];\n for (var _i = 5; _i < arguments.length; _i++) {\n extraArgs[_i - 5] = arguments[_i];\n }\n if (!interaction) {\n return null;\n }\n var rangeRes = sliceEventStore(interaction.mutatedEvents, eventUiBases, computeActiveRange(dateProfile, Boolean(nextDayThreshold)), nextDayThreshold);\n return {\n segs: this.sliceEventRanges(rangeRes.fg, component, extraArgs),\n affectedInstances: interaction.affectedEvents.instances,\n isEvent: interaction.isEvent,\n sourceSeg: interaction.origSeg\n };\n };\n Slicer.prototype._sliceDateSpan = function (dateSpan, eventUiBases, component) {\n var extraArgs = [];\n for (var _i = 3; _i < arguments.length; _i++) {\n extraArgs[_i - 3] = arguments[_i];\n }\n if (!dateSpan) {\n return [];\n }\n var eventRange = fabricateEventRange(dateSpan, eventUiBases, component.context.calendar);\n var segs = this.sliceRange.apply(this, [dateSpan.range].concat(extraArgs));\n for (var _a = 0, segs_1 = segs; _a < segs_1.length; _a++) {\n var seg = segs_1[_a];\n seg.component = component;\n seg.eventRange = eventRange;\n }\n return segs;\n };\n /*\n \"complete\" seg means it has component and eventRange\n */\n Slicer.prototype.sliceEventRanges = function (eventRanges, component, // TODO: kill\n extraArgs) {\n var segs = [];\n for (var _i = 0, eventRanges_1 = eventRanges; _i < eventRanges_1.length; _i++) {\n var eventRange = eventRanges_1[_i];\n segs.push.apply(segs, this.sliceEventRange(eventRange, component, extraArgs));\n }\n return segs;\n };\n /*\n \"complete\" seg means it has component and eventRange\n */\n Slicer.prototype.sliceEventRange = function (eventRange, component, // TODO: kill\n extraArgs) {\n var segs = this.sliceRange.apply(this, [eventRange.range].concat(extraArgs));\n for (var _i = 0, segs_2 = segs; _i < segs_2.length; _i++) {\n var seg = segs_2[_i];\n seg.component = component;\n seg.eventRange = eventRange;\n seg.isStart = eventRange.isStart && seg.isStart;\n seg.isEnd = eventRange.isEnd && seg.isEnd;\n }\n return segs;\n };\n return Slicer;\n}());\n/*\nfor incorporating minTime/maxTime if appropriate\nTODO: should be part of DateProfile!\nTimelineDateProfile already does this btw\n*/\nfunction computeActiveRange(dateProfile, isComponentAllDay) {\n var range = dateProfile.activeRange;\n if (isComponentAllDay) {\n return range;\n }\n return {\n start: addMs(range.start, dateProfile.minTime.milliseconds),\n end: addMs(range.end, dateProfile.maxTime.milliseconds - 864e5) // 864e5 = ms in a day\n };\n}\n\n// exports\n// --------------------------------------------------------------------------------------------------\nvar version = '4.4.2';\n\nexport { Calendar, Component, ComponentContext, DateComponent, DateEnv, DateProfileGenerator, DayHeader, DaySeries, DayTable, ElementDragging, ElementScrollController, EmitterMixin, EventApi, FgEventRenderer, FillRenderer, Interaction, Mixin, NamedTimeZoneImpl, PositionCache, ScrollComponent, ScrollController, Slicer, Splitter, Theme, View, WindowScrollController, addDays, addDurations, addMs, addWeeks, allowContextMenu, allowSelection, appendToElement, applyAll, applyMutationToEventStore, applyStyle, applyStyleProp, asRoughMinutes, asRoughMs, asRoughSeconds, buildGotoAnchorHtml, buildSegCompareObj, capitaliseFirstLetter, combineEventUis, compareByFieldSpec, compareByFieldSpecs, compareNumbers, compensateScroll, computeClippingRect, computeEdges, computeEventDraggable, computeEventEndResizable, computeEventStartResizable, computeFallbackHeaderFormat, computeHeightAndMargins, computeInnerRect, computeRect, computeVisibleDayRange, config, constrainPoint, createDuration, createElement, createEmptyEventStore, createEventInstance, createFormatter, createPlugin, cssToStr, debounce, diffDates, diffDayAndTime, diffDays, diffPoints, diffWeeks, diffWholeDays, diffWholeWeeks, disableCursor, distributeHeight, elementClosest, elementMatches, enableCursor, eventTupleToStore, filterEventStoreDefs, filterHash, findChildren, findElements, flexibleCompare, forceClassName, formatDate, formatIsoTimeString, formatRange, getAllDayHtml, getClippingParents, getDayClasses, getElSeg, getRectCenter, getRelevantEvents, globalDefaults, greatestDurationDenominator, hasBgRendering, htmlEscape, htmlToElement, insertAfterElement, interactionSettingsStore, interactionSettingsToStore, intersectRanges, intersectRects, isArraysEqual, isDateSpansEqual, isInt, isInteractionValid, isMultiDayRange, isPropsEqual, isPropsValid, isSingleDay, isValidDate, listenBySelector, mapHash, matchCellWidths, memoize, memoizeOutput, memoizeRendering, mergeEventStores, multiplyDuration, padStart, parseBusinessHours, parseDragMeta, parseEventDef, parseFieldSpecs, parse as parseMarker, pointInsideRect, prependToElement, preventContextMenu, preventDefault, preventSelection, processScopedUiProps, rangeContainsMarker, rangeContainsRange, rangesEqual, rangesIntersect, refineProps, removeElement, removeExact, renderDateCell, requestJson, sliceEventStore, startOfDay, subtractInnerElHeight, translateRect, uncompensateScroll, undistributeHeight, unpromisify, version, whenTransitionDone, wholeDivideDurations };\n","/*!\nFullCalendar Day Grid Plugin v4.4.2\nDocs & License: https://fullcalendar.io/\n(c) 2019 Adam Shaw\n*/\n\nimport { addWeeks, diffWeeks, DateProfileGenerator, createElement, listenBySelector, removeElement, computeRect, computeClippingRect, applyStyle, computeEventDraggable, computeEventStartResizable, computeEventEndResizable, cssToStr, htmlEscape, FgEventRenderer, appendToElement, prependToElement, htmlToElement, FillRenderer, memoizeRendering, createFormatter, addDays, DateComponent, rangeContainsMarker, getDayClasses, findElements, PositionCache, buildGotoAnchorHtml, findChildren, insertAfterElement, intersectRanges, memoize, ScrollComponent, matchCellWidths, uncompensateScroll, compensateScroll, subtractInnerElHeight, distributeHeight, undistributeHeight, View, Slicer, DayHeader, DaySeries, DayTable, createPlugin } from '@fullcalendar/core';\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n 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 extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(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\nvar __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n };\r\n return __assign.apply(this, arguments);\r\n};\n\nvar DayGridDateProfileGenerator = /** @class */ (function (_super) {\n __extends(DayGridDateProfileGenerator, _super);\n function DayGridDateProfileGenerator() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n // Computes the date range that will be rendered.\n DayGridDateProfileGenerator.prototype.buildRenderRange = function (currentRange, currentRangeUnit, isRangeAllDay) {\n var dateEnv = this.dateEnv;\n var renderRange = _super.prototype.buildRenderRange.call(this, currentRange, currentRangeUnit, isRangeAllDay);\n var start = renderRange.start;\n var end = renderRange.end;\n var endOfWeek;\n // year and month views should be aligned with weeks. this is already done for week\n if (/^(year|month)$/.test(currentRangeUnit)) {\n start = dateEnv.startOfWeek(start);\n // make end-of-week if not already\n endOfWeek = dateEnv.startOfWeek(end);\n if (endOfWeek.valueOf() !== end.valueOf()) {\n end = addWeeks(endOfWeek, 1);\n }\n }\n // ensure 6 weeks\n if (this.options.monthMode &&\n this.options.fixedWeekCount) {\n var rowCnt = Math.ceil(// could be partial weeks due to hiddenDays\n diffWeeks(start, end));\n end = addWeeks(end, 6 - rowCnt);\n }\n return { start: start, end: end };\n };\n return DayGridDateProfileGenerator;\n}(DateProfileGenerator));\n\n/* A rectangular panel that is absolutely positioned over other content\n------------------------------------------------------------------------------------------------------------------------\nOptions:\n - className (string)\n - content (HTML string, element, or element array)\n - parentEl\n - top\n - left\n - right (the x coord of where the right edge should be. not a \"CSS\" right)\n - autoHide (boolean)\n - show (callback)\n - hide (callback)\n*/\nvar Popover = /** @class */ (function () {\n function Popover(options) {\n var _this = this;\n this.isHidden = true;\n this.margin = 10; // the space required between the popover and the edges of the scroll container\n // Triggered when the user clicks *anywhere* in the document, for the autoHide feature\n this.documentMousedown = function (ev) {\n // only hide the popover if the click happened outside the popover\n if (_this.el && !_this.el.contains(ev.target)) {\n _this.hide();\n }\n };\n this.options = options;\n }\n // Shows the popover on the specified position. Renders it if not already\n Popover.prototype.show = function () {\n if (this.isHidden) {\n if (!this.el) {\n this.render();\n }\n this.el.style.display = '';\n this.position();\n this.isHidden = false;\n this.trigger('show');\n }\n };\n // Hides the popover, through CSS, but does not remove it from the DOM\n Popover.prototype.hide = function () {\n if (!this.isHidden) {\n this.el.style.display = 'none';\n this.isHidden = true;\n this.trigger('hide');\n }\n };\n // Creates `this.el` and renders content inside of it\n Popover.prototype.render = function () {\n var _this = this;\n var options = this.options;\n var el = this.el = createElement('div', {\n className: 'fc-popover ' + (options.className || ''),\n style: {\n top: '0',\n left: '0'\n }\n });\n if (typeof options.content === 'function') {\n options.content(el);\n }\n options.parentEl.appendChild(el);\n // when a click happens on anything inside with a 'fc-close' className, hide the popover\n listenBySelector(el, 'click', '.fc-close', function (ev) {\n _this.hide();\n });\n if (options.autoHide) {\n document.addEventListener('mousedown', this.documentMousedown);\n }\n };\n // Hides and unregisters any handlers\n Popover.prototype.destroy = function () {\n this.hide();\n if (this.el) {\n removeElement(this.el);\n this.el = null;\n }\n document.removeEventListener('mousedown', this.documentMousedown);\n };\n // Positions the popover optimally, using the top/left/right options\n Popover.prototype.position = function () {\n var options = this.options;\n var el = this.el;\n var elDims = el.getBoundingClientRect(); // only used for width,height\n var origin = computeRect(el.offsetParent);\n var clippingRect = computeClippingRect(options.parentEl);\n var top; // the \"position\" (not \"offset\") values for the popover\n var left; //\n // compute top and left\n top = options.top || 0;\n if (options.left !== undefined) {\n left = options.left;\n }\n else if (options.right !== undefined) {\n left = options.right - elDims.width; // derive the left value from the right value\n }\n else {\n left = 0;\n }\n // constrain to the view port. if constrained by two edges, give precedence to top/left\n top = Math.min(top, clippingRect.bottom - elDims.height - this.margin);\n top = Math.max(top, clippingRect.top + this.margin);\n left = Math.min(left, clippingRect.right - elDims.width - this.margin);\n left = Math.max(left, clippingRect.left + this.margin);\n applyStyle(el, {\n top: top - origin.top,\n left: left - origin.left\n });\n };\n // Triggers a callback. Calls a function in the option hash of the same name.\n // Arguments beyond the first `name` are forwarded on.\n // TODO: better code reuse for this. Repeat code\n // can kill this???\n Popover.prototype.trigger = function (name) {\n if (this.options[name]) {\n this.options[name].apply(this, Array.prototype.slice.call(arguments, 1));\n }\n };\n return Popover;\n}());\n\n/* Event-rendering methods for the DayGrid class\n----------------------------------------------------------------------------------------------------------------------*/\n// \"Simple\" is bad a name. has nothing to do with SimpleDayGrid\nvar SimpleDayGridEventRenderer = /** @class */ (function (_super) {\n __extends(SimpleDayGridEventRenderer, _super);\n function SimpleDayGridEventRenderer() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n // Builds the HTML to be used for the default element for an individual segment\n SimpleDayGridEventRenderer.prototype.renderSegHtml = function (seg, mirrorInfo) {\n var context = this.context;\n var eventRange = seg.eventRange;\n var eventDef = eventRange.def;\n var eventUi = eventRange.ui;\n var allDay = eventDef.allDay;\n var isDraggable = computeEventDraggable(context, eventDef, eventUi);\n var isResizableFromStart = allDay && seg.isStart && computeEventStartResizable(context, eventDef, eventUi);\n var isResizableFromEnd = allDay && seg.isEnd && computeEventEndResizable(context, eventDef, eventUi);\n var classes = this.getSegClasses(seg, isDraggable, isResizableFromStart || isResizableFromEnd, mirrorInfo);\n var skinCss = cssToStr(this.getSkinCss(eventUi));\n var timeHtml = '';\n var timeText;\n var titleHtml;\n classes.unshift('fc-day-grid-event', 'fc-h-event');\n // Only display a timed events time if it is the starting segment\n if (seg.isStart) {\n timeText = this.getTimeText(eventRange);\n if (timeText) {\n timeHtml = '' + htmlEscape(timeText) + '';\n }\n }\n titleHtml =\n '' +\n (htmlEscape(eventDef.title || '') || ' ') + // we always want one line of height\n '';\n return '' +\n '
' +\n (isResizableFromStart ?\n '' :\n '') +\n (isResizableFromEnd ?\n '' :\n '') +\n '';\n };\n // Computes a default event time formatting string if `eventTimeFormat` is not explicitly defined\n SimpleDayGridEventRenderer.prototype.computeEventTimeFormat = function () {\n return {\n hour: 'numeric',\n minute: '2-digit',\n omitZeroMinute: true,\n meridiem: 'narrow'\n };\n };\n SimpleDayGridEventRenderer.prototype.computeDisplayEventEnd = function () {\n return false; // TODO: somehow consider the originating DayGrid's column count\n };\n return SimpleDayGridEventRenderer;\n}(FgEventRenderer));\n\n/* Event-rendering methods for the DayGrid class\n----------------------------------------------------------------------------------------------------------------------*/\nvar DayGridEventRenderer = /** @class */ (function (_super) {\n __extends(DayGridEventRenderer, _super);\n function DayGridEventRenderer(dayGrid) {\n var _this = _super.call(this) || this;\n _this.dayGrid = dayGrid;\n return _this;\n }\n // Renders the given foreground event segments onto the grid\n DayGridEventRenderer.prototype.attachSegs = function (segs, mirrorInfo) {\n var rowStructs = this.rowStructs = this.renderSegRows(segs);\n // append to each row's content skeleton\n this.dayGrid.rowEls.forEach(function (rowNode, i) {\n rowNode.querySelector('.fc-content-skeleton > table').appendChild(rowStructs[i].tbodyEl);\n });\n // removes the \"more..\" events popover\n if (!mirrorInfo) {\n this.dayGrid.removeSegPopover();\n }\n };\n // Unrenders all currently rendered foreground event segments\n DayGridEventRenderer.prototype.detachSegs = function () {\n var rowStructs = this.rowStructs || [];\n var rowStruct;\n while ((rowStruct = rowStructs.pop())) {\n removeElement(rowStruct.tbodyEl);\n }\n this.rowStructs = null;\n };\n // Uses the given events array to generate elements that should be appended to each row's content skeleton.\n // Returns an array of rowStruct objects (see the bottom of `renderSegRow`).\n // PRECONDITION: each segment shoud already have a rendered and assigned `.el`\n DayGridEventRenderer.prototype.renderSegRows = function (segs) {\n var rowStructs = [];\n var segRows;\n var row;\n segRows = this.groupSegRows(segs); // group into nested arrays\n // iterate each row of segment groupings\n for (row = 0; row < segRows.length; row++) {\n rowStructs.push(this.renderSegRow(row, segRows[row]));\n }\n return rowStructs;\n };\n // Given a row # and an array of segments all in the same row, render a element, a skeleton that contains\n // the segments. Returns object with a bunch of internal data about how the render was calculated.\n // NOTE: modifies rowSegs\n DayGridEventRenderer.prototype.renderSegRow = function (row, rowSegs) {\n var isRtl = this.context.isRtl;\n var dayGrid = this.dayGrid;\n var colCnt = dayGrid.colCnt;\n var segLevels = this.buildSegLevels(rowSegs); // group into sub-arrays of levels\n var levelCnt = Math.max(1, segLevels.length); // ensure at least one level\n var tbody = document.createElement('tbody');\n var segMatrix = []; // lookup for which segments are rendered into which level+col cells\n var cellMatrix = []; // lookup for all
elements of the level+col matrix\n var loneCellMatrix = []; // lookup for
elements that only take up a single column\n var i;\n var levelSegs;\n var col;\n var tr;\n var j;\n var seg;\n var td;\n // populates empty cells from the current column (`col`) to `endCol`\n function emptyCellsUntil(endCol) {\n while (col < endCol) {\n // try to grab a cell from the level above and extend its rowspan. otherwise, create a fresh cell\n td = (loneCellMatrix[i - 1] || [])[col];\n if (td) {\n td.rowSpan = (td.rowSpan || 1) + 1;\n }\n else {\n td = document.createElement('td');\n tr.appendChild(td);\n }\n cellMatrix[i][col] = td;\n loneCellMatrix[i][col] = td;\n col++;\n }\n }\n for (i = 0; i < levelCnt; i++) { // iterate through all levels\n levelSegs = segLevels[i];\n col = 0;\n tr = document.createElement('tr');\n segMatrix.push([]);\n cellMatrix.push([]);\n loneCellMatrix.push([]);\n // levelCnt might be 1 even though there are no actual levels. protect against this.\n // this single empty row is useful for styling.\n if (levelSegs) {\n for (j = 0; j < levelSegs.length; j++) { // iterate through segments in level\n seg = levelSegs[j];\n var leftCol = isRtl ? (colCnt - 1 - seg.lastCol) : seg.firstCol;\n var rightCol = isRtl ? (colCnt - 1 - seg.firstCol) : seg.lastCol;\n emptyCellsUntil(leftCol);\n // create a container that occupies or more columns. append the event element.\n td = createElement('td', { className: 'fc-event-container' }, seg.el);\n if (leftCol !== rightCol) {\n td.colSpan = rightCol - leftCol + 1;\n }\n else { // a single-column segment\n loneCellMatrix[i][col] = td;\n }\n while (col <= rightCol) {\n cellMatrix[i][col] = td;\n segMatrix[i][col] = seg;\n col++;\n }\n tr.appendChild(td);\n }\n }\n emptyCellsUntil(colCnt); // finish off the row\n var introHtml = dayGrid.renderProps.renderIntroHtml();\n if (introHtml) {\n if (isRtl) {\n appendToElement(tr, introHtml);\n }\n else {\n prependToElement(tr, introHtml);\n }\n }\n tbody.appendChild(tr);\n }\n return {\n row: row,\n tbodyEl: tbody,\n cellMatrix: cellMatrix,\n segMatrix: segMatrix,\n segLevels: segLevels,\n segs: rowSegs\n };\n };\n // Stacks a flat array of segments, which are all assumed to be in the same row, into subarrays of vertical levels.\n // NOTE: modifies segs\n DayGridEventRenderer.prototype.buildSegLevels = function (segs) {\n var isRtl = this.context.isRtl;\n var colCnt = this.dayGrid.colCnt;\n var levels = [];\n var i;\n var seg;\n var j;\n // Give preference to elements with certain criteria, so they have\n // a chance to be closer to the top.\n segs = this.sortEventSegs(segs);\n for (i = 0; i < segs.length; i++) {\n seg = segs[i];\n // loop through levels, starting with the topmost, until the segment doesn't collide with other segments\n for (j = 0; j < levels.length; j++) {\n if (!isDaySegCollision(seg, levels[j])) {\n break;\n }\n }\n // `j` now holds the desired subrow index\n seg.level = j;\n seg.leftCol = isRtl ? (colCnt - 1 - seg.lastCol) : seg.firstCol; // for sorting only\n seg.rightCol = isRtl ? (colCnt - 1 - seg.firstCol) : seg.lastCol // for sorting only\n ;\n (levels[j] || (levels[j] = [])).push(seg);\n }\n // order segments left-to-right. very important if calendar is RTL\n for (j = 0; j < levels.length; j++) {\n levels[j].sort(compareDaySegCols);\n }\n return levels;\n };\n // Given a flat array of segments, return an array of sub-arrays, grouped by each segment's row\n DayGridEventRenderer.prototype.groupSegRows = function (segs) {\n var segRows = [];\n var i;\n for (i = 0; i < this.dayGrid.rowCnt; i++) {\n segRows.push([]);\n }\n for (i = 0; i < segs.length; i++) {\n segRows[segs[i].row].push(segs[i]);\n }\n return segRows;\n };\n // Computes a default `displayEventEnd` value if one is not expliclty defined\n DayGridEventRenderer.prototype.computeDisplayEventEnd = function () {\n return this.dayGrid.colCnt === 1; // we'll likely have space if there's only one day\n };\n return DayGridEventRenderer;\n}(SimpleDayGridEventRenderer));\n// Computes whether two segments' columns collide. They are assumed to be in the same row.\nfunction isDaySegCollision(seg, otherSegs) {\n var i;\n var otherSeg;\n for (i = 0; i < otherSegs.length; i++) {\n otherSeg = otherSegs[i];\n if (otherSeg.firstCol <= seg.lastCol &&\n otherSeg.lastCol >= seg.firstCol) {\n return true;\n }\n }\n return false;\n}\n// A cmp function for determining the leftmost event\nfunction compareDaySegCols(a, b) {\n return a.leftCol - b.leftCol;\n}\n\nvar DayGridMirrorRenderer = /** @class */ (function (_super) {\n __extends(DayGridMirrorRenderer, _super);\n function DayGridMirrorRenderer() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n DayGridMirrorRenderer.prototype.attachSegs = function (segs, mirrorInfo) {\n var sourceSeg = mirrorInfo.sourceSeg;\n var rowStructs = this.rowStructs = this.renderSegRows(segs);\n // inject each new event skeleton into each associated row\n this.dayGrid.rowEls.forEach(function (rowNode, row) {\n var skeletonEl = htmlToElement('
'); // will be absolutely positioned\n var skeletonTopEl;\n var skeletonTop;\n // If there is an original segment, match the top position. Otherwise, put it at the row's top level\n if (sourceSeg && sourceSeg.row === row) {\n skeletonTopEl = sourceSeg.el;\n }\n else {\n skeletonTopEl = rowNode.querySelector('.fc-content-skeleton tbody');\n if (!skeletonTopEl) { // when no events\n skeletonTopEl = rowNode.querySelector('.fc-content-skeleton table');\n }\n }\n skeletonTop = skeletonTopEl.getBoundingClientRect().top -\n rowNode.getBoundingClientRect().top; // the offsetParent origin\n skeletonEl.style.top = skeletonTop + 'px';\n skeletonEl.querySelector('table').appendChild(rowStructs[row].tbodyEl);\n rowNode.appendChild(skeletonEl);\n });\n };\n return DayGridMirrorRenderer;\n}(DayGridEventRenderer));\n\nvar EMPTY_CELL_HTML = '
';\nvar DayGridFillRenderer = /** @class */ (function (_super) {\n __extends(DayGridFillRenderer, _super);\n function DayGridFillRenderer(dayGrid) {\n var _this = _super.call(this) || this;\n _this.fillSegTag = 'td'; // override the default tag name\n _this.dayGrid = dayGrid;\n return _this;\n }\n DayGridFillRenderer.prototype.renderSegs = function (type, context, segs) {\n // don't render timed background events\n if (type === 'bgEvent') {\n segs = segs.filter(function (seg) {\n return seg.eventRange.def.allDay;\n });\n }\n _super.prototype.renderSegs.call(this, type, context, segs);\n };\n DayGridFillRenderer.prototype.attachSegs = function (type, segs) {\n var els = [];\n var i;\n var seg;\n var skeletonEl;\n for (i = 0; i < segs.length; i++) {\n seg = segs[i];\n skeletonEl = this.renderFillRow(type, seg);\n this.dayGrid.rowEls[seg.row].appendChild(skeletonEl);\n els.push(skeletonEl);\n }\n return els;\n };\n // Generates the HTML needed for one row of a fill. Requires the seg's el to be rendered.\n DayGridFillRenderer.prototype.renderFillRow = function (type, seg) {\n var dayGrid = this.dayGrid;\n var isRtl = this.context.isRtl;\n var colCnt = dayGrid.colCnt;\n var leftCol = isRtl ? (colCnt - 1 - seg.lastCol) : seg.firstCol;\n var rightCol = isRtl ? (colCnt - 1 - seg.firstCol) : seg.lastCol;\n var startCol = leftCol;\n var endCol = rightCol + 1;\n var className;\n var skeletonEl;\n var trEl;\n if (type === 'businessHours') {\n className = 'bgevent';\n }\n else {\n className = type.toLowerCase();\n }\n skeletonEl = htmlToElement('
' +\n '
' +\n '
');\n trEl = skeletonEl.getElementsByTagName('tr')[0];\n if (startCol > 0) {\n appendToElement(trEl, \n // will create (startCol + 1) td's\n new Array(startCol + 1).join(EMPTY_CELL_HTML));\n }\n seg.el.colSpan = endCol - startCol;\n trEl.appendChild(seg.el);\n if (endCol < colCnt) {\n appendToElement(trEl, \n // will create (colCnt - endCol) td's\n new Array(colCnt - endCol + 1).join(EMPTY_CELL_HTML));\n }\n var introHtml = dayGrid.renderProps.renderIntroHtml();\n if (introHtml) {\n if (isRtl) {\n appendToElement(trEl, introHtml);\n }\n else {\n prependToElement(trEl, introHtml);\n }\n }\n return skeletonEl;\n };\n return DayGridFillRenderer;\n}(FillRenderer));\n\nvar DayTile = /** @class */ (function (_super) {\n __extends(DayTile, _super);\n function DayTile(el) {\n var _this = _super.call(this, el) || this;\n var eventRenderer = _this.eventRenderer = new DayTileEventRenderer(_this);\n var renderFrame = _this.renderFrame = memoizeRendering(_this._renderFrame);\n _this.renderFgEvents = memoizeRendering(eventRenderer.renderSegs.bind(eventRenderer), eventRenderer.unrender.bind(eventRenderer), [renderFrame]);\n _this.renderEventSelection = memoizeRendering(eventRenderer.selectByInstanceId.bind(eventRenderer), eventRenderer.unselectByInstanceId.bind(eventRenderer), [_this.renderFgEvents]);\n _this.renderEventDrag = memoizeRendering(eventRenderer.hideByHash.bind(eventRenderer), eventRenderer.showByHash.bind(eventRenderer), [renderFrame]);\n _this.renderEventResize = memoizeRendering(eventRenderer.hideByHash.bind(eventRenderer), eventRenderer.showByHash.bind(eventRenderer), [renderFrame]);\n return _this;\n }\n DayTile.prototype.firstContext = function (context) {\n context.calendar.registerInteractiveComponent(this, {\n el: this.el,\n useEventCenter: false\n });\n };\n DayTile.prototype.render = function (props, context) {\n this.renderFrame(props.date);\n this.renderFgEvents(context, props.fgSegs);\n this.renderEventSelection(props.eventSelection);\n this.renderEventDrag(props.eventDragInstances);\n this.renderEventResize(props.eventResizeInstances);\n };\n DayTile.prototype.destroy = function () {\n _super.prototype.destroy.call(this);\n this.renderFrame.unrender(); // should unrender everything else\n this.context.calendar.unregisterInteractiveComponent(this);\n };\n DayTile.prototype._renderFrame = function (date) {\n var _a = this.context, theme = _a.theme, dateEnv = _a.dateEnv, options = _a.options;\n var title = dateEnv.format(date, createFormatter(options.dayPopoverFormat) // TODO: cache\n );\n this.el.innerHTML =\n '
';\n };\n DayGrid.prototype.renderNumberCellsHtml = function (row) {\n var htmls = [];\n var col;\n var date;\n for (col = 0; col < this.colCnt; col++) {\n date = this.props.cells[row][col].date;\n htmls.push(this.renderNumberCellHtml(date));\n }\n if (this.context.isRtl) {\n htmls.reverse();\n }\n return htmls.join('');\n };\n // Generates the HTML for the
s of the \"number\" row in the DayGrid's content skeleton.\n // The number row will only exist if either day numbers or week numbers are turned on.\n DayGrid.prototype.renderNumberCellHtml = function (date) {\n var _a = this.context, dateEnv = _a.dateEnv, options = _a.options;\n var html = '';\n var isDateValid = rangeContainsMarker(this.props.dateProfile.activeRange, date); // TODO: called too frequently. cache somehow.\n var isDayNumberVisible = this.getIsDayNumbersVisible() && isDateValid;\n var classes;\n var weekCalcFirstDow;\n if (!isDayNumberVisible && !this.renderProps.cellWeekNumbersVisible) {\n // no numbers in day cell (week number must be along the side)\n return '
'; // will create an empty space above events :(\n }\n classes = getDayClasses(date, this.props.dateProfile, this.context);\n classes.unshift('fc-day-top');\n if (this.renderProps.cellWeekNumbersVisible) {\n weekCalcFirstDow = dateEnv.weekDow;\n }\n html += '
';\n return html;\n };\n /* Sizing\n ------------------------------------------------------------------------------------------------------------------*/\n DayGrid.prototype.updateSize = function (isResize) {\n var calendar = this.context.calendar;\n var _a = this, fillRenderer = _a.fillRenderer, eventRenderer = _a.eventRenderer, mirrorRenderer = _a.mirrorRenderer;\n if (isResize ||\n this.isCellSizesDirty ||\n calendar.isEventsUpdated // hack\n ) {\n this.buildPositionCaches();\n this.isCellSizesDirty = false;\n }\n fillRenderer.computeSizes(isResize);\n eventRenderer.computeSizes(isResize);\n mirrorRenderer.computeSizes(isResize);\n fillRenderer.assignSizes(isResize);\n eventRenderer.assignSizes(isResize);\n mirrorRenderer.assignSizes(isResize);\n };\n DayGrid.prototype.buildPositionCaches = function () {\n this.buildColPositions();\n this.buildRowPositions();\n };\n DayGrid.prototype.buildColPositions = function () {\n this.colPositions.build();\n };\n DayGrid.prototype.buildRowPositions = function () {\n this.rowPositions.build();\n this.rowPositions.bottoms[this.rowCnt - 1] += this.bottomCoordPadding; // hack\n };\n /* Hit System\n ------------------------------------------------------------------------------------------------------------------*/\n DayGrid.prototype.positionToHit = function (leftPosition, topPosition) {\n var _a = this, colPositions = _a.colPositions, rowPositions = _a.rowPositions;\n var col = colPositions.leftToIndex(leftPosition);\n var row = rowPositions.topToIndex(topPosition);\n if (row != null && col != null) {\n return {\n row: row,\n col: col,\n dateSpan: {\n range: this.getCellRange(row, col),\n allDay: true\n },\n dayEl: this.getCellEl(row, col),\n relativeRect: {\n left: colPositions.lefts[col],\n right: colPositions.rights[col],\n top: rowPositions.tops[row],\n bottom: rowPositions.bottoms[row]\n }\n };\n }\n };\n /* Cell System\n ------------------------------------------------------------------------------------------------------------------*/\n // FYI: the first column is the leftmost column, regardless of date\n DayGrid.prototype.getCellEl = function (row, col) {\n return this.cellEls[row * this.colCnt + col];\n };\n /* Event Drag Visualization\n ------------------------------------------------------------------------------------------------------------------*/\n DayGrid.prototype._renderEventDrag = function (state) {\n if (state) {\n this.eventRenderer.hideByHash(state.affectedInstances);\n this.fillRenderer.renderSegs('highlight', this.context, state.segs);\n }\n };\n DayGrid.prototype._unrenderEventDrag = function (state) {\n if (state) {\n this.eventRenderer.showByHash(state.affectedInstances);\n this.fillRenderer.unrender('highlight', this.context);\n }\n };\n /* Event Resize Visualization\n ------------------------------------------------------------------------------------------------------------------*/\n DayGrid.prototype._renderEventResize = function (state) {\n if (state) {\n this.eventRenderer.hideByHash(state.affectedInstances);\n this.fillRenderer.renderSegs('highlight', this.context, state.segs);\n this.mirrorRenderer.renderSegs(this.context, state.segs, { isResizing: true, sourceSeg: state.sourceSeg });\n }\n };\n DayGrid.prototype._unrenderEventResize = function (state) {\n if (state) {\n this.eventRenderer.showByHash(state.affectedInstances);\n this.fillRenderer.unrender('highlight', this.context);\n this.mirrorRenderer.unrender(this.context, state.segs, { isResizing: true, sourceSeg: state.sourceSeg });\n }\n };\n /* More+ Link Popover\n ------------------------------------------------------------------------------------------------------------------*/\n DayGrid.prototype.removeSegPopover = function () {\n if (this.segPopover) {\n this.segPopover.hide(); // in handler, will call segPopover's removeElement\n }\n };\n // Limits the number of \"levels\" (vertically stacking layers of events) for each row of the grid.\n // `levelLimit` can be false (don't limit), a number, or true (should be computed).\n DayGrid.prototype.limitRows = function (levelLimit) {\n var rowStructs = this.eventRenderer.rowStructs || [];\n var row; // row #\n var rowLevelLimit;\n for (row = 0; row < rowStructs.length; row++) {\n this.unlimitRow(row);\n if (!levelLimit) {\n rowLevelLimit = false;\n }\n else if (typeof levelLimit === 'number') {\n rowLevelLimit = levelLimit;\n }\n else {\n rowLevelLimit = this.computeRowLevelLimit(row);\n }\n if (rowLevelLimit !== false) {\n this.limitRow(row, rowLevelLimit);\n }\n }\n };\n // Computes the number of levels a row will accomodate without going outside its bounds.\n // Assumes the row is \"rigid\" (maintains a constant height regardless of what is inside).\n // `row` is the row number.\n DayGrid.prototype.computeRowLevelLimit = function (row) {\n var rowEl = this.rowEls[row]; // the containing \"fake\" row div\n var rowBottom = rowEl.getBoundingClientRect().bottom; // relative to viewport!\n var trEls = findChildren(this.eventRenderer.rowStructs[row].tbodyEl);\n var i;\n var trEl;\n // Reveal one level
at a time and stop when we find one out of bounds\n for (i = 0; i < trEls.length; i++) {\n trEl = trEls[i];\n trEl.classList.remove('fc-limited'); // reset to original state (reveal)\n if (trEl.getBoundingClientRect().bottom > rowBottom) {\n return i;\n }\n }\n return false; // should not limit at all\n };\n // Limits the given grid row to the maximum number of levels and injects \"more\" links if necessary.\n // `row` is the row number.\n // `levelLimit` is a number for the maximum (inclusive) number of levels allowed.\n DayGrid.prototype.limitRow = function (row, levelLimit) {\n var _this = this;\n var colCnt = this.colCnt;\n var isRtl = this.context.isRtl;\n var rowStruct = this.eventRenderer.rowStructs[row];\n var moreNodes = []; // array of \"more\" links and
DOM nodes\n var col = 0; // col #, left-to-right (not chronologically)\n var levelSegs; // array of segment objects in the last allowable level, ordered left-to-right\n var cellMatrix; // a matrix (by level, then column) of all
elements in the row\n var limitedNodes; // array of temporarily hidden level
and segment
DOM nodes\n var i;\n var seg;\n var segsBelow; // array of segment objects below `seg` in the current `col`\n var totalSegsBelow; // total number of segments below `seg` in any of the columns `seg` occupies\n var colSegsBelow; // array of segment arrays, below seg, one for each column (offset from segs's first column)\n var td;\n var rowSpan;\n var segMoreNodes; // array of \"more\"
cells that will stand-in for the current seg's cell\n var j;\n var moreTd;\n var moreWrap;\n var moreLink;\n // Iterates through empty level cells and places \"more\" links inside if need be\n var emptyCellsUntil = function (endCol) {\n while (col < endCol) {\n segsBelow = _this.getCellSegs(row, col, levelLimit);\n if (segsBelow.length) {\n td = cellMatrix[levelLimit - 1][col];\n moreLink = _this.renderMoreLink(row, col, segsBelow);\n moreWrap = createElement('div', null, moreLink);\n td.appendChild(moreWrap);\n moreNodes.push(moreWrap);\n }\n col++;\n }\n };\n if (levelLimit && levelLimit < rowStruct.segLevels.length) { // is it actually over the limit?\n levelSegs = rowStruct.segLevels[levelLimit - 1];\n cellMatrix = rowStruct.cellMatrix;\n limitedNodes = findChildren(rowStruct.tbodyEl).slice(levelLimit); // get level
elements past the limit\n limitedNodes.forEach(function (node) {\n node.classList.add('fc-limited'); // hide elements and get a simple DOM-nodes array\n });\n // iterate though segments in the last allowable level\n for (i = 0; i < levelSegs.length; i++) {\n seg = levelSegs[i];\n var leftCol = isRtl ? (colCnt - 1 - seg.lastCol) : seg.firstCol;\n var rightCol = isRtl ? (colCnt - 1 - seg.firstCol) : seg.lastCol;\n emptyCellsUntil(leftCol); // process empty cells before the segment\n // determine *all* segments below `seg` that occupy the same columns\n colSegsBelow = [];\n totalSegsBelow = 0;\n while (col <= rightCol) {\n segsBelow = this.getCellSegs(row, col, levelLimit);\n colSegsBelow.push(segsBelow);\n totalSegsBelow += segsBelow.length;\n col++;\n }\n if (totalSegsBelow) { // do we need to replace this segment with one or many \"more\" links?\n td = cellMatrix[levelLimit - 1][leftCol]; // the segment's parent cell\n rowSpan = td.rowSpan || 1;\n segMoreNodes = [];\n // make a replacement
to avoid border confusion.\n if (isRtl) {\n options.right = computeRect(moreWrap).right + 1; // +1 to be over cell border\n }\n else {\n options.left = computeRect(moreWrap).left - 1; // -1 to be over cell border\n }\n this.segPopover = new Popover(options);\n this.segPopover.show();\n calendar.releaseAfterSizingTriggers(); // hack for eventPositioned\n };\n // Given the events within an array of segment objects, reslice them to be in a single day\n DayGrid.prototype.resliceDaySegs = function (segs, dayDate) {\n var dayStart = dayDate;\n var dayEnd = addDays(dayStart, 1);\n var dayRange = { start: dayStart, end: dayEnd };\n var newSegs = [];\n for (var _i = 0, segs_1 = segs; _i < segs_1.length; _i++) {\n var seg = segs_1[_i];\n var eventRange = seg.eventRange;\n var origRange = eventRange.range;\n var slicedRange = intersectRanges(origRange, dayRange);\n if (slicedRange) {\n newSegs.push(__assign({}, seg, { eventRange: {\n def: eventRange.def,\n ui: __assign({}, eventRange.ui, { durationEditable: false }),\n instance: eventRange.instance,\n range: slicedRange\n }, isStart: seg.isStart && slicedRange.start.valueOf() === origRange.start.valueOf(), isEnd: seg.isEnd && slicedRange.end.valueOf() === origRange.end.valueOf() }));\n }\n }\n return newSegs;\n };\n // Generates the text that should be inside a \"more\" link, given the number of events it represents\n DayGrid.prototype.getMoreLinkText = function (num) {\n var opt = this.context.options.eventLimitText;\n if (typeof opt === 'function') {\n return opt(num);\n }\n else {\n return '+' + num + ' ' + opt;\n }\n };\n // Returns segments within a given cell.\n // If `startLevel` is specified, returns only events including and below that level. Otherwise returns all segs.\n DayGrid.prototype.getCellSegs = function (row, col, startLevel) {\n var segMatrix = this.eventRenderer.rowStructs[row].segMatrix;\n var level = startLevel || 0;\n var segs = [];\n var seg;\n while (level < segMatrix.length) {\n seg = segMatrix[level][col];\n if (seg) {\n segs.push(seg);\n }\n level++;\n }\n return segs;\n };\n return DayGrid;\n}(DateComponent));\n\nvar WEEK_NUM_FORMAT$1 = createFormatter({ week: 'numeric' });\n/* An abstract class for the daygrid views, as well as month view. Renders one or more rows of day cells.\n----------------------------------------------------------------------------------------------------------------------*/\n// It is a manager for a DayGrid subcomponent, which does most of the heavy lifting.\n// It is responsible for managing width/height.\nvar AbstractDayGridView = /** @class */ (function (_super) {\n __extends(AbstractDayGridView, _super);\n function AbstractDayGridView() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.processOptions = memoize(_this._processOptions);\n _this.renderSkeleton = memoizeRendering(_this._renderSkeleton, _this._unrenderSkeleton);\n /* Header Rendering\n ------------------------------------------------------------------------------------------------------------------*/\n // Generates the HTML that will go before the day-of week header cells\n _this.renderHeadIntroHtml = function () {\n var _a = _this.context, theme = _a.theme, options = _a.options;\n if (_this.colWeekNumbersVisible) {\n return '' +\n '
';\n }\n return '';\n };\n /* Day Grid Rendering\n ------------------------------------------------------------------------------------------------------------------*/\n // Generates the HTML that will go before content-skeleton cells that display the day/week numbers\n _this.renderDayGridNumberIntroHtml = function (row, dayGrid) {\n var _a = _this.context, options = _a.options, dateEnv = _a.dateEnv;\n var weekStart = dayGrid.props.cells[row][0].date;\n if (_this.colWeekNumbersVisible) {\n return '' +\n '
' +\n buildGotoAnchorHtml(// aside from link, important for matchCellWidths\n options, dateEnv, { date: weekStart, type: 'week', forceOff: dayGrid.colCnt === 1 }, dateEnv.format(weekStart, WEEK_NUM_FORMAT$1) // inner HTML\n ) +\n '
';\n }\n return '';\n };\n // Generates the HTML that goes before the day bg cells for each day-row\n _this.renderDayGridBgIntroHtml = function () {\n var theme = _this.context.theme;\n if (_this.colWeekNumbersVisible) {\n return '
';\n }\n return '';\n };\n // Generates the HTML that goes before every other type of row generated by DayGrid.\n // Affects mirror-skeleton and highlight-skeleton rows.\n _this.renderDayGridIntroHtml = function () {\n if (_this.colWeekNumbersVisible) {\n return '
';\n }\n return '';\n };\n return _this;\n }\n AbstractDayGridView.prototype._processOptions = function (options) {\n if (options.weekNumbers) {\n if (options.weekNumbersWithinDays) {\n this.cellWeekNumbersVisible = true;\n this.colWeekNumbersVisible = false;\n }\n else {\n this.cellWeekNumbersVisible = false;\n this.colWeekNumbersVisible = true;\n }\n }\n else {\n this.colWeekNumbersVisible = false;\n this.cellWeekNumbersVisible = false;\n }\n };\n AbstractDayGridView.prototype.render = function (props, context) {\n _super.prototype.render.call(this, props, context);\n this.processOptions(context.options);\n this.renderSkeleton(context);\n };\n AbstractDayGridView.prototype.destroy = function () {\n _super.prototype.destroy.call(this);\n this.renderSkeleton.unrender();\n };\n AbstractDayGridView.prototype._renderSkeleton = function (context) {\n this.el.classList.add('fc-dayGrid-view');\n this.el.innerHTML = this.renderSkeletonHtml();\n this.scroller = new ScrollComponent('hidden', // overflow x\n 'auto' // overflow y\n );\n var dayGridContainerEl = this.scroller.el;\n this.el.querySelector('.fc-body > tr > td').appendChild(dayGridContainerEl);\n dayGridContainerEl.classList.add('fc-day-grid-container');\n var dayGridEl = createElement('div', { className: 'fc-day-grid' });\n dayGridContainerEl.appendChild(dayGridEl);\n this.dayGrid = new DayGrid(dayGridEl, {\n renderNumberIntroHtml: this.renderDayGridNumberIntroHtml,\n renderBgIntroHtml: this.renderDayGridBgIntroHtml,\n renderIntroHtml: this.renderDayGridIntroHtml,\n colWeekNumbersVisible: this.colWeekNumbersVisible,\n cellWeekNumbersVisible: this.cellWeekNumbersVisible\n });\n };\n AbstractDayGridView.prototype._unrenderSkeleton = function () {\n this.el.classList.remove('fc-dayGrid-view');\n this.dayGrid.destroy();\n this.scroller.destroy();\n };\n // Builds the HTML skeleton for the view.\n // The day-grid component will render inside of a container defined by this HTML.\n AbstractDayGridView.prototype.renderSkeletonHtml = function () {\n var _a = this.context, theme = _a.theme, options = _a.options;\n return '' +\n '
' +\n (options.columnHeader ?\n '' +\n '
' +\n '
' +\n '
' +\n '' :\n '') +\n '' +\n '
' +\n '
' +\n '
' +\n '' +\n '
';\n };\n // Generates an HTML attribute string for setting the width of the week number column, if it is known\n AbstractDayGridView.prototype.weekNumberStyleAttr = function () {\n if (this.weekNumberWidth != null) {\n return 'style=\"width:' + this.weekNumberWidth + 'px\"';\n }\n return '';\n };\n // Determines whether each row should have a constant height\n AbstractDayGridView.prototype.hasRigidRows = function () {\n var eventLimit = this.context.options.eventLimit;\n return eventLimit && typeof eventLimit !== 'number';\n };\n /* Dimensions\n ------------------------------------------------------------------------------------------------------------------*/\n AbstractDayGridView.prototype.updateSize = function (isResize, viewHeight, isAuto) {\n _super.prototype.updateSize.call(this, isResize, viewHeight, isAuto); // will call updateBaseSize. important that executes first\n this.dayGrid.updateSize(isResize);\n };\n // Refreshes the horizontal dimensions of the view\n AbstractDayGridView.prototype.updateBaseSize = function (isResize, viewHeight, isAuto) {\n var dayGrid = this.dayGrid;\n var eventLimit = this.context.options.eventLimit;\n var headRowEl = this.header ? this.header.el : null; // HACK\n var scrollerHeight;\n var scrollbarWidths;\n // hack to give the view some height prior to dayGrid's columns being rendered\n // TODO: separate setting height from scroller VS dayGrid.\n if (!dayGrid.rowEls) {\n if (!isAuto) {\n scrollerHeight = this.computeScrollerHeight(viewHeight);\n this.scroller.setHeight(scrollerHeight);\n }\n return;\n }\n if (this.colWeekNumbersVisible) {\n // Make sure all week number cells running down the side have the same width.\n this.weekNumberWidth = matchCellWidths(findElements(this.el, '.fc-week-number'));\n }\n // reset all heights to be natural\n this.scroller.clear();\n if (headRowEl) {\n uncompensateScroll(headRowEl);\n }\n dayGrid.removeSegPopover(); // kill the \"more\" popover if displayed\n // is the event limit a constant level number?\n if (eventLimit && typeof eventLimit === 'number') {\n dayGrid.limitRows(eventLimit); // limit the levels first so the height can redistribute after\n }\n // distribute the height to the rows\n // (viewHeight is a \"recommended\" value if isAuto)\n scrollerHeight = this.computeScrollerHeight(viewHeight);\n this.setGridHeight(scrollerHeight, isAuto);\n // is the event limit dynamically calculated?\n if (eventLimit && typeof eventLimit !== 'number') {\n dayGrid.limitRows(eventLimit); // limit the levels after the grid's row heights have been set\n }\n if (!isAuto) { // should we force dimensions of the scroll container?\n this.scroller.setHeight(scrollerHeight);\n scrollbarWidths = this.scroller.getScrollbarWidths();\n if (scrollbarWidths.left || scrollbarWidths.right) { // using scrollbars?\n if (headRowEl) {\n compensateScroll(headRowEl, scrollbarWidths);\n }\n // doing the scrollbar compensation might have created text overflow which created more height. redo\n scrollerHeight = this.computeScrollerHeight(viewHeight);\n this.scroller.setHeight(scrollerHeight);\n }\n // guarantees the same scrollbar widths\n this.scroller.lockOverflow(scrollbarWidths);\n }\n };\n // given a desired total height of the view, returns what the height of the scroller should be\n AbstractDayGridView.prototype.computeScrollerHeight = function (viewHeight) {\n return viewHeight -\n subtractInnerElHeight(this.el, this.scroller.el); // everything that's NOT the scroller\n };\n // Sets the height of just the DayGrid component in this view\n AbstractDayGridView.prototype.setGridHeight = function (height, isAuto) {\n if (this.context.options.monthMode) {\n // if auto, make the height of each row the height that it would be if there were 6 weeks\n if (isAuto) {\n height *= this.dayGrid.rowCnt / 6;\n }\n distributeHeight(this.dayGrid.rowEls, height, !isAuto); // if auto, don't compensate for height-hogging rows\n }\n else {\n if (isAuto) {\n undistributeHeight(this.dayGrid.rowEls); // let the rows be their natural height with no expanding\n }\n else {\n distributeHeight(this.dayGrid.rowEls, height, true); // true = compensate for height-hogging rows\n }\n }\n };\n /* Scroll\n ------------------------------------------------------------------------------------------------------------------*/\n AbstractDayGridView.prototype.computeDateScroll = function (duration) {\n return { top: 0 };\n };\n AbstractDayGridView.prototype.queryDateScroll = function () {\n return { top: this.scroller.getScrollTop() };\n };\n AbstractDayGridView.prototype.applyDateScroll = function (scroll) {\n if (scroll.top !== undefined) {\n this.scroller.setScrollTop(scroll.top);\n }\n };\n return AbstractDayGridView;\n}(View));\nAbstractDayGridView.prototype.dateProfileGeneratorClass = DayGridDateProfileGenerator;\n\nvar SimpleDayGrid = /** @class */ (function (_super) {\n __extends(SimpleDayGrid, _super);\n function SimpleDayGrid(dayGrid) {\n var _this = _super.call(this, dayGrid.el) || this;\n _this.slicer = new DayGridSlicer();\n _this.dayGrid = dayGrid;\n return _this;\n }\n SimpleDayGrid.prototype.firstContext = function (context) {\n context.calendar.registerInteractiveComponent(this, { el: this.dayGrid.el });\n };\n SimpleDayGrid.prototype.destroy = function () {\n _super.prototype.destroy.call(this);\n this.context.calendar.unregisterInteractiveComponent(this);\n };\n SimpleDayGrid.prototype.render = function (props, context) {\n var dayGrid = this.dayGrid;\n var dateProfile = props.dateProfile, dayTable = props.dayTable;\n dayGrid.receiveContext(context); // hack because context is used in sliceProps\n dayGrid.receiveProps(__assign({}, this.slicer.sliceProps(props, dateProfile, props.nextDayThreshold, context.calendar, dayGrid, dayTable), { dateProfile: dateProfile, cells: dayTable.cells, isRigid: props.isRigid }), context);\n };\n SimpleDayGrid.prototype.buildPositionCaches = function () {\n this.dayGrid.buildPositionCaches();\n };\n SimpleDayGrid.prototype.queryHit = function (positionLeft, positionTop) {\n var rawHit = this.dayGrid.positionToHit(positionLeft, positionTop);\n if (rawHit) {\n return {\n component: this.dayGrid,\n dateSpan: rawHit.dateSpan,\n dayEl: rawHit.dayEl,\n rect: {\n left: rawHit.relativeRect.left,\n right: rawHit.relativeRect.right,\n top: rawHit.relativeRect.top,\n bottom: rawHit.relativeRect.bottom\n },\n layer: 0\n };\n }\n };\n return SimpleDayGrid;\n}(DateComponent));\nvar DayGridSlicer = /** @class */ (function (_super) {\n __extends(DayGridSlicer, _super);\n function DayGridSlicer() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n DayGridSlicer.prototype.sliceRange = function (dateRange, dayTable) {\n return dayTable.sliceRange(dateRange);\n };\n return DayGridSlicer;\n}(Slicer));\n\nvar DayGridView = /** @class */ (function (_super) {\n __extends(DayGridView, _super);\n function DayGridView() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.buildDayTable = memoize(buildDayTable);\n return _this;\n }\n DayGridView.prototype.render = function (props, context) {\n _super.prototype.render.call(this, props, context); // will call _renderSkeleton/_unrenderSkeleton\n var dateProfile = this.props.dateProfile;\n var dayTable = this.dayTable =\n this.buildDayTable(dateProfile, props.dateProfileGenerator);\n if (this.header) {\n this.header.receiveProps({\n dateProfile: dateProfile,\n dates: dayTable.headerDates,\n datesRepDistinctDays: dayTable.rowCnt === 1,\n renderIntroHtml: this.renderHeadIntroHtml\n }, context);\n }\n this.simpleDayGrid.receiveProps({\n dateProfile: dateProfile,\n dayTable: dayTable,\n businessHours: props.businessHours,\n dateSelection: props.dateSelection,\n eventStore: props.eventStore,\n eventUiBases: props.eventUiBases,\n eventSelection: props.eventSelection,\n eventDrag: props.eventDrag,\n eventResize: props.eventResize,\n isRigid: this.hasRigidRows(),\n nextDayThreshold: this.context.nextDayThreshold\n }, context);\n };\n DayGridView.prototype._renderSkeleton = function (context) {\n _super.prototype._renderSkeleton.call(this, context);\n if (context.options.columnHeader) {\n this.header = new DayHeader(this.el.querySelector('.fc-head-container'));\n }\n this.simpleDayGrid = new SimpleDayGrid(this.dayGrid);\n };\n DayGridView.prototype._unrenderSkeleton = function () {\n _super.prototype._unrenderSkeleton.call(this);\n if (this.header) {\n this.header.destroy();\n }\n this.simpleDayGrid.destroy();\n };\n return DayGridView;\n}(AbstractDayGridView));\nfunction buildDayTable(dateProfile, dateProfileGenerator) {\n var daySeries = new DaySeries(dateProfile.renderRange, dateProfileGenerator);\n return new DayTable(daySeries, /year|month|week/.test(dateProfile.currentRangeUnit));\n}\n\nvar main = createPlugin({\n defaultView: 'dayGridMonth',\n views: {\n dayGrid: DayGridView,\n dayGridDay: {\n type: 'dayGrid',\n duration: { days: 1 }\n },\n dayGridWeek: {\n type: 'dayGrid',\n duration: { weeks: 1 }\n },\n dayGridMonth: {\n type: 'dayGrid',\n duration: { months: 1 },\n monthMode: true,\n fixedWeekCount: true\n }\n }\n});\n\nexport default main;\nexport { AbstractDayGridView, DayBgRow, DayGrid, DayGridSlicer, DayGridView, SimpleDayGrid, buildDayTable as buildBasicDayTable };\n","/*!\nFullCalendar Interaction Plugin v4.4.2\nDocs & License: https://fullcalendar.io/\n(c) 2019 Adam Shaw\n*/\n\nimport { config, elementClosest, EmitterMixin, applyStyle, whenTransitionDone, removeElement, ScrollController, ElementScrollController, computeInnerRect, WindowScrollController, preventSelection, preventContextMenu, allowSelection, allowContextMenu, ElementDragging, computeRect, getClippingParents, pointInsideRect, isDateSpansEqual, constrainPoint, intersectRects, getRectCenter, diffPoints, mapHash, rangeContainsRange, interactionSettingsToStore, Interaction, enableCursor, disableCursor, compareNumbers, getElSeg, getRelevantEvents, EventApi, createEmptyEventStore, applyMutationToEventStore, interactionSettingsStore, startOfDay, diffDates, createDuration, eventTupleToStore, isInteractionValid, parseDragMeta, elementMatches, parseEventDef, createEventInstance, globalDefaults, createPlugin } from '@fullcalendar/core';\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n 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 extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(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\nvar __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n };\r\n return __assign.apply(this, arguments);\r\n};\n\nconfig.touchMouseIgnoreWait = 500;\nvar ignoreMouseDepth = 0;\nvar listenerCnt = 0;\nvar isWindowTouchMoveCancelled = false;\n/*\nUses a \"pointer\" abstraction, which monitors UI events for both mouse and touch.\nTracks when the pointer \"drags\" on a certain element, meaning down+move+up.\n\nAlso, tracks if there was touch-scrolling.\nAlso, can prevent touch-scrolling from happening.\nAlso, can fire pointermove events when scrolling happens underneath, even when no real pointer movement.\n\nemits:\n- pointerdown\n- pointermove\n- pointerup\n*/\nvar PointerDragging = /** @class */ (function () {\n function PointerDragging(containerEl) {\n var _this = this;\n this.subjectEl = null;\n this.downEl = null;\n // options that can be directly assigned by caller\n this.selector = ''; // will cause subjectEl in all emitted events to be this element\n this.handleSelector = '';\n this.shouldIgnoreMove = false;\n this.shouldWatchScroll = true; // for simulating pointermove on scroll\n // internal states\n this.isDragging = false;\n this.isTouchDragging = false;\n this.wasTouchScroll = false;\n // Mouse\n // ----------------------------------------------------------------------------------------------------\n this.handleMouseDown = function (ev) {\n if (!_this.shouldIgnoreMouse() &&\n isPrimaryMouseButton(ev) &&\n _this.tryStart(ev)) {\n var pev = _this.createEventFromMouse(ev, true);\n _this.emitter.trigger('pointerdown', pev);\n _this.initScrollWatch(pev);\n if (!_this.shouldIgnoreMove) {\n document.addEventListener('mousemove', _this.handleMouseMove);\n }\n document.addEventListener('mouseup', _this.handleMouseUp);\n }\n };\n this.handleMouseMove = function (ev) {\n var pev = _this.createEventFromMouse(ev);\n _this.recordCoords(pev);\n _this.emitter.trigger('pointermove', pev);\n };\n this.handleMouseUp = function (ev) {\n document.removeEventListener('mousemove', _this.handleMouseMove);\n document.removeEventListener('mouseup', _this.handleMouseUp);\n _this.emitter.trigger('pointerup', _this.createEventFromMouse(ev));\n _this.cleanup(); // call last so that pointerup has access to props\n };\n // Touch\n // ----------------------------------------------------------------------------------------------------\n this.handleTouchStart = function (ev) {\n if (_this.tryStart(ev)) {\n _this.isTouchDragging = true;\n var pev = _this.createEventFromTouch(ev, true);\n _this.emitter.trigger('pointerdown', pev);\n _this.initScrollWatch(pev);\n // unlike mouse, need to attach to target, not document\n // https://stackoverflow.com/a/45760014\n var target = ev.target;\n if (!_this.shouldIgnoreMove) {\n target.addEventListener('touchmove', _this.handleTouchMove);\n }\n target.addEventListener('touchend', _this.handleTouchEnd);\n target.addEventListener('touchcancel', _this.handleTouchEnd); // treat it as a touch end\n // attach a handler to get called when ANY scroll action happens on the page.\n // this was impossible to do with normal on/off because 'scroll' doesn't bubble.\n // http://stackoverflow.com/a/32954565/96342\n window.addEventListener('scroll', _this.handleTouchScroll, true // useCapture\n );\n }\n };\n this.handleTouchMove = function (ev) {\n var pev = _this.createEventFromTouch(ev);\n _this.recordCoords(pev);\n _this.emitter.trigger('pointermove', pev);\n };\n this.handleTouchEnd = function (ev) {\n if (_this.isDragging) { // done to guard against touchend followed by touchcancel\n var target = ev.target;\n target.removeEventListener('touchmove', _this.handleTouchMove);\n target.removeEventListener('touchend', _this.handleTouchEnd);\n target.removeEventListener('touchcancel', _this.handleTouchEnd);\n window.removeEventListener('scroll', _this.handleTouchScroll, true); // useCaptured=true\n _this.emitter.trigger('pointerup', _this.createEventFromTouch(ev));\n _this.cleanup(); // call last so that pointerup has access to props\n _this.isTouchDragging = false;\n startIgnoringMouse();\n }\n };\n this.handleTouchScroll = function () {\n _this.wasTouchScroll = true;\n };\n this.handleScroll = function (ev) {\n if (!_this.shouldIgnoreMove) {\n var pageX = (window.pageXOffset - _this.prevScrollX) + _this.prevPageX;\n var pageY = (window.pageYOffset - _this.prevScrollY) + _this.prevPageY;\n _this.emitter.trigger('pointermove', {\n origEvent: ev,\n isTouch: _this.isTouchDragging,\n subjectEl: _this.subjectEl,\n pageX: pageX,\n pageY: pageY,\n deltaX: pageX - _this.origPageX,\n deltaY: pageY - _this.origPageY\n });\n }\n };\n this.containerEl = containerEl;\n this.emitter = new EmitterMixin();\n containerEl.addEventListener('mousedown', this.handleMouseDown);\n containerEl.addEventListener('touchstart', this.handleTouchStart, { passive: true });\n listenerCreated();\n }\n PointerDragging.prototype.destroy = function () {\n this.containerEl.removeEventListener('mousedown', this.handleMouseDown);\n this.containerEl.removeEventListener('touchstart', this.handleTouchStart, { passive: true });\n listenerDestroyed();\n };\n PointerDragging.prototype.tryStart = function (ev) {\n var subjectEl = this.querySubjectEl(ev);\n var downEl = ev.target;\n if (subjectEl &&\n (!this.handleSelector || elementClosest(downEl, this.handleSelector))) {\n this.subjectEl = subjectEl;\n this.downEl = downEl;\n this.isDragging = true; // do this first so cancelTouchScroll will work\n this.wasTouchScroll = false;\n return true;\n }\n return false;\n };\n PointerDragging.prototype.cleanup = function () {\n isWindowTouchMoveCancelled = false;\n this.isDragging = false;\n this.subjectEl = null;\n this.downEl = null;\n // keep wasTouchScroll around for later access\n this.destroyScrollWatch();\n };\n PointerDragging.prototype.querySubjectEl = function (ev) {\n if (this.selector) {\n return elementClosest(ev.target, this.selector);\n }\n else {\n return this.containerEl;\n }\n };\n PointerDragging.prototype.shouldIgnoreMouse = function () {\n return ignoreMouseDepth || this.isTouchDragging;\n };\n // can be called by user of this class, to cancel touch-based scrolling for the current drag\n PointerDragging.prototype.cancelTouchScroll = function () {\n if (this.isDragging) {\n isWindowTouchMoveCancelled = true;\n }\n };\n // Scrolling that simulates pointermoves\n // ----------------------------------------------------------------------------------------------------\n PointerDragging.prototype.initScrollWatch = function (ev) {\n if (this.shouldWatchScroll) {\n this.recordCoords(ev);\n window.addEventListener('scroll', this.handleScroll, true); // useCapture=true\n }\n };\n PointerDragging.prototype.recordCoords = function (ev) {\n if (this.shouldWatchScroll) {\n this.prevPageX = ev.pageX;\n this.prevPageY = ev.pageY;\n this.prevScrollX = window.pageXOffset;\n this.prevScrollY = window.pageYOffset;\n }\n };\n PointerDragging.prototype.destroyScrollWatch = function () {\n if (this.shouldWatchScroll) {\n window.removeEventListener('scroll', this.handleScroll, true); // useCaptured=true\n }\n };\n // Event Normalization\n // ----------------------------------------------------------------------------------------------------\n PointerDragging.prototype.createEventFromMouse = function (ev, isFirst) {\n var deltaX = 0;\n var deltaY = 0;\n // TODO: repeat code\n if (isFirst) {\n this.origPageX = ev.pageX;\n this.origPageY = ev.pageY;\n }\n else {\n deltaX = ev.pageX - this.origPageX;\n deltaY = ev.pageY - this.origPageY;\n }\n return {\n origEvent: ev,\n isTouch: false,\n subjectEl: this.subjectEl,\n pageX: ev.pageX,\n pageY: ev.pageY,\n deltaX: deltaX,\n deltaY: deltaY\n };\n };\n PointerDragging.prototype.createEventFromTouch = function (ev, isFirst) {\n var touches = ev.touches;\n var pageX;\n var pageY;\n var deltaX = 0;\n var deltaY = 0;\n // if touch coords available, prefer,\n // because FF would give bad ev.pageX ev.pageY\n if (touches && touches.length) {\n pageX = touches[0].pageX;\n pageY = touches[0].pageY;\n }\n else {\n pageX = ev.pageX;\n pageY = ev.pageY;\n }\n // TODO: repeat code\n if (isFirst) {\n this.origPageX = pageX;\n this.origPageY = pageY;\n }\n else {\n deltaX = pageX - this.origPageX;\n deltaY = pageY - this.origPageY;\n }\n return {\n origEvent: ev,\n isTouch: true,\n subjectEl: this.subjectEl,\n pageX: pageX,\n pageY: pageY,\n deltaX: deltaX,\n deltaY: deltaY\n };\n };\n return PointerDragging;\n}());\n// Returns a boolean whether this was a left mouse click and no ctrl key (which means right click on Mac)\nfunction isPrimaryMouseButton(ev) {\n return ev.button === 0 && !ev.ctrlKey;\n}\n// Ignoring fake mouse events generated by touch\n// ----------------------------------------------------------------------------------------------------\nfunction startIgnoringMouse() {\n ignoreMouseDepth++;\n setTimeout(function () {\n ignoreMouseDepth--;\n }, config.touchMouseIgnoreWait);\n}\n// We want to attach touchmove as early as possible for Safari\n// ----------------------------------------------------------------------------------------------------\nfunction listenerCreated() {\n if (!(listenerCnt++)) {\n window.addEventListener('touchmove', onWindowTouchMove, { passive: false });\n }\n}\nfunction listenerDestroyed() {\n if (!(--listenerCnt)) {\n window.removeEventListener('touchmove', onWindowTouchMove, { passive: false });\n }\n}\nfunction onWindowTouchMove(ev) {\n if (isWindowTouchMoveCancelled) {\n ev.preventDefault();\n }\n}\n\n/*\nAn effect in which an element follows the movement of a pointer across the screen.\nThe moving element is a clone of some other element.\nMust call start + handleMove + stop.\n*/\nvar ElementMirror = /** @class */ (function () {\n function ElementMirror() {\n this.isVisible = false; // must be explicitly enabled\n this.sourceEl = null;\n this.mirrorEl = null;\n this.sourceElRect = null; // screen coords relative to viewport\n // options that can be set directly by caller\n this.parentNode = document.body;\n this.zIndex = 9999;\n this.revertDuration = 0;\n }\n ElementMirror.prototype.start = function (sourceEl, pageX, pageY) {\n this.sourceEl = sourceEl;\n this.sourceElRect = this.sourceEl.getBoundingClientRect();\n this.origScreenX = pageX - window.pageXOffset;\n this.origScreenY = pageY - window.pageYOffset;\n this.deltaX = 0;\n this.deltaY = 0;\n this.updateElPosition();\n };\n ElementMirror.prototype.handleMove = function (pageX, pageY) {\n this.deltaX = (pageX - window.pageXOffset) - this.origScreenX;\n this.deltaY = (pageY - window.pageYOffset) - this.origScreenY;\n this.updateElPosition();\n };\n // can be called before start\n ElementMirror.prototype.setIsVisible = function (bool) {\n if (bool) {\n if (!this.isVisible) {\n if (this.mirrorEl) {\n this.mirrorEl.style.display = '';\n }\n this.isVisible = bool; // needs to happen before updateElPosition\n this.updateElPosition(); // because was not updating the position while invisible\n }\n }\n else {\n if (this.isVisible) {\n if (this.mirrorEl) {\n this.mirrorEl.style.display = 'none';\n }\n this.isVisible = bool;\n }\n }\n };\n // always async\n ElementMirror.prototype.stop = function (needsRevertAnimation, callback) {\n var _this = this;\n var done = function () {\n _this.cleanup();\n callback();\n };\n if (needsRevertAnimation &&\n this.mirrorEl &&\n this.isVisible &&\n this.revertDuration && // if 0, transition won't work\n (this.deltaX || this.deltaY) // if same coords, transition won't work\n ) {\n this.doRevertAnimation(done, this.revertDuration);\n }\n else {\n setTimeout(done, 0);\n }\n };\n ElementMirror.prototype.doRevertAnimation = function (callback, revertDuration) {\n var mirrorEl = this.mirrorEl;\n var finalSourceElRect = this.sourceEl.getBoundingClientRect(); // because autoscrolling might have happened\n mirrorEl.style.transition =\n 'top ' + revertDuration + 'ms,' +\n 'left ' + revertDuration + 'ms';\n applyStyle(mirrorEl, {\n left: finalSourceElRect.left,\n top: finalSourceElRect.top\n });\n whenTransitionDone(mirrorEl, function () {\n mirrorEl.style.transition = '';\n callback();\n });\n };\n ElementMirror.prototype.cleanup = function () {\n if (this.mirrorEl) {\n removeElement(this.mirrorEl);\n this.mirrorEl = null;\n }\n this.sourceEl = null;\n };\n ElementMirror.prototype.updateElPosition = function () {\n if (this.sourceEl && this.isVisible) {\n applyStyle(this.getMirrorEl(), {\n left: this.sourceElRect.left + this.deltaX,\n top: this.sourceElRect.top + this.deltaY\n });\n }\n };\n ElementMirror.prototype.getMirrorEl = function () {\n var sourceElRect = this.sourceElRect;\n var mirrorEl = this.mirrorEl;\n if (!mirrorEl) {\n mirrorEl = this.mirrorEl = this.sourceEl.cloneNode(true); // cloneChildren=true\n // we don't want long taps or any mouse interaction causing selection/menus.\n // would use preventSelection(), but that prevents selectstart, causing problems.\n mirrorEl.classList.add('fc-unselectable');\n mirrorEl.classList.add('fc-dragging');\n applyStyle(mirrorEl, {\n position: 'fixed',\n zIndex: this.zIndex,\n visibility: '',\n boxSizing: 'border-box',\n width: sourceElRect.right - sourceElRect.left,\n height: sourceElRect.bottom - sourceElRect.top,\n right: 'auto',\n bottom: 'auto',\n margin: 0\n });\n this.parentNode.appendChild(mirrorEl);\n }\n return mirrorEl;\n };\n return ElementMirror;\n}());\n\n/*\nIs a cache for a given element's scroll information (all the info that ScrollController stores)\nin addition the \"client rectangle\" of the element.. the area within the scrollbars.\n\nThe cache can be in one of two modes:\n- doesListening:false - ignores when the container is scrolled by someone else\n- doesListening:true - watch for scrolling and update the cache\n*/\nvar ScrollGeomCache = /** @class */ (function (_super) {\n __extends(ScrollGeomCache, _super);\n function ScrollGeomCache(scrollController, doesListening) {\n var _this = _super.call(this) || this;\n _this.handleScroll = function () {\n _this.scrollTop = _this.scrollController.getScrollTop();\n _this.scrollLeft = _this.scrollController.getScrollLeft();\n _this.handleScrollChange();\n };\n _this.scrollController = scrollController;\n _this.doesListening = doesListening;\n _this.scrollTop = _this.origScrollTop = scrollController.getScrollTop();\n _this.scrollLeft = _this.origScrollLeft = scrollController.getScrollLeft();\n _this.scrollWidth = scrollController.getScrollWidth();\n _this.scrollHeight = scrollController.getScrollHeight();\n _this.clientWidth = scrollController.getClientWidth();\n _this.clientHeight = scrollController.getClientHeight();\n _this.clientRect = _this.computeClientRect(); // do last in case it needs cached values\n if (_this.doesListening) {\n _this.getEventTarget().addEventListener('scroll', _this.handleScroll);\n }\n return _this;\n }\n ScrollGeomCache.prototype.destroy = function () {\n if (this.doesListening) {\n this.getEventTarget().removeEventListener('scroll', this.handleScroll);\n }\n };\n ScrollGeomCache.prototype.getScrollTop = function () {\n return this.scrollTop;\n };\n ScrollGeomCache.prototype.getScrollLeft = function () {\n return this.scrollLeft;\n };\n ScrollGeomCache.prototype.setScrollTop = function (top) {\n this.scrollController.setScrollTop(top);\n if (!this.doesListening) {\n // we are not relying on the element to normalize out-of-bounds scroll values\n // so we need to sanitize ourselves\n this.scrollTop = Math.max(Math.min(top, this.getMaxScrollTop()), 0);\n this.handleScrollChange();\n }\n };\n ScrollGeomCache.prototype.setScrollLeft = function (top) {\n this.scrollController.setScrollLeft(top);\n if (!this.doesListening) {\n // we are not relying on the element to normalize out-of-bounds scroll values\n // so we need to sanitize ourselves\n this.scrollLeft = Math.max(Math.min(top, this.getMaxScrollLeft()), 0);\n this.handleScrollChange();\n }\n };\n ScrollGeomCache.prototype.getClientWidth = function () {\n return this.clientWidth;\n };\n ScrollGeomCache.prototype.getClientHeight = function () {\n return this.clientHeight;\n };\n ScrollGeomCache.prototype.getScrollWidth = function () {\n return this.scrollWidth;\n };\n ScrollGeomCache.prototype.getScrollHeight = function () {\n return this.scrollHeight;\n };\n ScrollGeomCache.prototype.handleScrollChange = function () {\n };\n return ScrollGeomCache;\n}(ScrollController));\nvar ElementScrollGeomCache = /** @class */ (function (_super) {\n __extends(ElementScrollGeomCache, _super);\n function ElementScrollGeomCache(el, doesListening) {\n return _super.call(this, new ElementScrollController(el), doesListening) || this;\n }\n ElementScrollGeomCache.prototype.getEventTarget = function () {\n return this.scrollController.el;\n };\n ElementScrollGeomCache.prototype.computeClientRect = function () {\n return computeInnerRect(this.scrollController.el);\n };\n return ElementScrollGeomCache;\n}(ScrollGeomCache));\nvar WindowScrollGeomCache = /** @class */ (function (_super) {\n __extends(WindowScrollGeomCache, _super);\n function WindowScrollGeomCache(doesListening) {\n return _super.call(this, new WindowScrollController(), doesListening) || this;\n }\n WindowScrollGeomCache.prototype.getEventTarget = function () {\n return window;\n };\n WindowScrollGeomCache.prototype.computeClientRect = function () {\n return {\n left: this.scrollLeft,\n right: this.scrollLeft + this.clientWidth,\n top: this.scrollTop,\n bottom: this.scrollTop + this.clientHeight\n };\n };\n // the window is the only scroll object that changes it's rectangle relative\n // to the document's topleft as it scrolls\n WindowScrollGeomCache.prototype.handleScrollChange = function () {\n this.clientRect = this.computeClientRect();\n };\n return WindowScrollGeomCache;\n}(ScrollGeomCache));\n\n// If available we are using native \"performance\" API instead of \"Date\"\n// Read more about it on MDN:\n// https://developer.mozilla.org/en-US/docs/Web/API/Performance\nvar getTime = typeof performance === 'function' ? performance.now : Date.now;\n/*\nFor a pointer interaction, automatically scrolls certain scroll containers when the pointer\napproaches the edge.\n\nThe caller must call start + handleMove + stop.\n*/\nvar AutoScroller = /** @class */ (function () {\n function AutoScroller() {\n var _this = this;\n // options that can be set by caller\n this.isEnabled = true;\n this.scrollQuery = [window, '.fc-scroller'];\n this.edgeThreshold = 50; // pixels\n this.maxVelocity = 300; // pixels per second\n // internal state\n this.pointerScreenX = null;\n this.pointerScreenY = null;\n this.isAnimating = false;\n this.scrollCaches = null;\n // protect against the initial pointerdown being too close to an edge and starting the scroll\n this.everMovedUp = false;\n this.everMovedDown = false;\n this.everMovedLeft = false;\n this.everMovedRight = false;\n this.animate = function () {\n if (_this.isAnimating) { // wasn't cancelled between animation calls\n var edge = _this.computeBestEdge(_this.pointerScreenX + window.pageXOffset, _this.pointerScreenY + window.pageYOffset);\n if (edge) {\n var now = getTime();\n _this.handleSide(edge, (now - _this.msSinceRequest) / 1000);\n _this.requestAnimation(now);\n }\n else {\n _this.isAnimating = false; // will stop animation\n }\n }\n };\n }\n AutoScroller.prototype.start = function (pageX, pageY) {\n if (this.isEnabled) {\n this.scrollCaches = this.buildCaches();\n this.pointerScreenX = null;\n this.pointerScreenY = null;\n this.everMovedUp = false;\n this.everMovedDown = false;\n this.everMovedLeft = false;\n this.everMovedRight = false;\n this.handleMove(pageX, pageY);\n }\n };\n AutoScroller.prototype.handleMove = function (pageX, pageY) {\n if (this.isEnabled) {\n var pointerScreenX = pageX - window.pageXOffset;\n var pointerScreenY = pageY - window.pageYOffset;\n var yDelta = this.pointerScreenY === null ? 0 : pointerScreenY - this.pointerScreenY;\n var xDelta = this.pointerScreenX === null ? 0 : pointerScreenX - this.pointerScreenX;\n if (yDelta < 0) {\n this.everMovedUp = true;\n }\n else if (yDelta > 0) {\n this.everMovedDown = true;\n }\n if (xDelta < 0) {\n this.everMovedLeft = true;\n }\n else if (xDelta > 0) {\n this.everMovedRight = true;\n }\n this.pointerScreenX = pointerScreenX;\n this.pointerScreenY = pointerScreenY;\n if (!this.isAnimating) {\n this.isAnimating = true;\n this.requestAnimation(getTime());\n }\n }\n };\n AutoScroller.prototype.stop = function () {\n if (this.isEnabled) {\n this.isAnimating = false; // will stop animation\n for (var _i = 0, _a = this.scrollCaches; _i < _a.length; _i++) {\n var scrollCache = _a[_i];\n scrollCache.destroy();\n }\n this.scrollCaches = null;\n }\n };\n AutoScroller.prototype.requestAnimation = function (now) {\n this.msSinceRequest = now;\n requestAnimationFrame(this.animate);\n };\n AutoScroller.prototype.handleSide = function (edge, seconds) {\n var scrollCache = edge.scrollCache;\n var edgeThreshold = this.edgeThreshold;\n var invDistance = edgeThreshold - edge.distance;\n var velocity = // the closer to the edge, the faster we scroll\n (invDistance * invDistance) / (edgeThreshold * edgeThreshold) * // quadratic\n this.maxVelocity * seconds;\n var sign = 1;\n switch (edge.name) {\n case 'left':\n sign = -1;\n // falls through\n case 'right':\n scrollCache.setScrollLeft(scrollCache.getScrollLeft() + velocity * sign);\n break;\n case 'top':\n sign = -1;\n // falls through\n case 'bottom':\n scrollCache.setScrollTop(scrollCache.getScrollTop() + velocity * sign);\n break;\n }\n };\n // left/top are relative to document topleft\n AutoScroller.prototype.computeBestEdge = function (left, top) {\n var edgeThreshold = this.edgeThreshold;\n var bestSide = null;\n for (var _i = 0, _a = this.scrollCaches; _i < _a.length; _i++) {\n var scrollCache = _a[_i];\n var rect = scrollCache.clientRect;\n var leftDist = left - rect.left;\n var rightDist = rect.right - left;\n var topDist = top - rect.top;\n var bottomDist = rect.bottom - top;\n // completely within the rect?\n if (leftDist >= 0 && rightDist >= 0 && topDist >= 0 && bottomDist >= 0) {\n if (topDist <= edgeThreshold && this.everMovedUp && scrollCache.canScrollUp() &&\n (!bestSide || bestSide.distance > topDist)) {\n bestSide = { scrollCache: scrollCache, name: 'top', distance: topDist };\n }\n if (bottomDist <= edgeThreshold && this.everMovedDown && scrollCache.canScrollDown() &&\n (!bestSide || bestSide.distance > bottomDist)) {\n bestSide = { scrollCache: scrollCache, name: 'bottom', distance: bottomDist };\n }\n if (leftDist <= edgeThreshold && this.everMovedLeft && scrollCache.canScrollLeft() &&\n (!bestSide || bestSide.distance > leftDist)) {\n bestSide = { scrollCache: scrollCache, name: 'left', distance: leftDist };\n }\n if (rightDist <= edgeThreshold && this.everMovedRight && scrollCache.canScrollRight() &&\n (!bestSide || bestSide.distance > rightDist)) {\n bestSide = { scrollCache: scrollCache, name: 'right', distance: rightDist };\n }\n }\n }\n return bestSide;\n };\n AutoScroller.prototype.buildCaches = function () {\n return this.queryScrollEls().map(function (el) {\n if (el === window) {\n return new WindowScrollGeomCache(false); // false = don't listen to user-generated scrolls\n }\n else {\n return new ElementScrollGeomCache(el, false); // false = don't listen to user-generated scrolls\n }\n });\n };\n AutoScroller.prototype.queryScrollEls = function () {\n var els = [];\n for (var _i = 0, _a = this.scrollQuery; _i < _a.length; _i++) {\n var query = _a[_i];\n if (typeof query === 'object') {\n els.push(query);\n }\n else {\n els.push.apply(els, Array.prototype.slice.call(document.querySelectorAll(query)));\n }\n }\n return els;\n };\n return AutoScroller;\n}());\n\n/*\nMonitors dragging on an element. Has a number of high-level features:\n- minimum distance required before dragging\n- minimum wait time (\"delay\") before dragging\n- a mirror element that follows the pointer\n*/\nvar FeaturefulElementDragging = /** @class */ (function (_super) {\n __extends(FeaturefulElementDragging, _super);\n function FeaturefulElementDragging(containerEl) {\n var _this = _super.call(this, containerEl) || this;\n // options that can be directly set by caller\n // the caller can also set the PointerDragging's options as well\n _this.delay = null;\n _this.minDistance = 0;\n _this.touchScrollAllowed = true; // prevents drag from starting and blocks scrolling during drag\n _this.mirrorNeedsRevert = false;\n _this.isInteracting = false; // is the user validly moving the pointer? lasts until pointerup\n _this.isDragging = false; // is it INTENTFULLY dragging? lasts until after revert animation\n _this.isDelayEnded = false;\n _this.isDistanceSurpassed = false;\n _this.delayTimeoutId = null;\n _this.onPointerDown = function (ev) {\n if (!_this.isDragging) { // so new drag doesn't happen while revert animation is going\n _this.isInteracting = true;\n _this.isDelayEnded = false;\n _this.isDistanceSurpassed = false;\n preventSelection(document.body);\n preventContextMenu(document.body);\n // prevent links from being visited if there's an eventual drag.\n // also prevents selection in older browsers (maybe?).\n // not necessary for touch, besides, browser would complain about passiveness.\n if (!ev.isTouch) {\n ev.origEvent.preventDefault();\n }\n _this.emitter.trigger('pointerdown', ev);\n if (!_this.pointer.shouldIgnoreMove) {\n // actions related to initiating dragstart+dragmove+dragend...\n _this.mirror.setIsVisible(false); // reset. caller must set-visible\n _this.mirror.start(ev.subjectEl, ev.pageX, ev.pageY); // must happen on first pointer down\n _this.startDelay(ev);\n if (!_this.minDistance) {\n _this.handleDistanceSurpassed(ev);\n }\n }\n }\n };\n _this.onPointerMove = function (ev) {\n if (_this.isInteracting) { // if false, still waiting for previous drag's revert\n _this.emitter.trigger('pointermove', ev);\n if (!_this.isDistanceSurpassed) {\n var minDistance = _this.minDistance;\n var distanceSq = void 0; // current distance from the origin, squared\n var deltaX = ev.deltaX, deltaY = ev.deltaY;\n distanceSq = deltaX * deltaX + deltaY * deltaY;\n if (distanceSq >= minDistance * minDistance) { // use pythagorean theorem\n _this.handleDistanceSurpassed(ev);\n }\n }\n if (_this.isDragging) {\n // a real pointer move? (not one simulated by scrolling)\n if (ev.origEvent.type !== 'scroll') {\n _this.mirror.handleMove(ev.pageX, ev.pageY);\n _this.autoScroller.handleMove(ev.pageX, ev.pageY);\n }\n _this.emitter.trigger('dragmove', ev);\n }\n }\n };\n _this.onPointerUp = function (ev) {\n if (_this.isInteracting) { // if false, still waiting for previous drag's revert\n _this.isInteracting = false;\n allowSelection(document.body);\n allowContextMenu(document.body);\n _this.emitter.trigger('pointerup', ev); // can potentially set mirrorNeedsRevert\n if (_this.isDragging) {\n _this.autoScroller.stop();\n _this.tryStopDrag(ev); // which will stop the mirror\n }\n if (_this.delayTimeoutId) {\n clearTimeout(_this.delayTimeoutId);\n _this.delayTimeoutId = null;\n }\n }\n };\n var pointer = _this.pointer = new PointerDragging(containerEl);\n pointer.emitter.on('pointerdown', _this.onPointerDown);\n pointer.emitter.on('pointermove', _this.onPointerMove);\n pointer.emitter.on('pointerup', _this.onPointerUp);\n _this.mirror = new ElementMirror();\n _this.autoScroller = new AutoScroller();\n return _this;\n }\n FeaturefulElementDragging.prototype.destroy = function () {\n this.pointer.destroy();\n };\n FeaturefulElementDragging.prototype.startDelay = function (ev) {\n var _this = this;\n if (typeof this.delay === 'number') {\n this.delayTimeoutId = setTimeout(function () {\n _this.delayTimeoutId = null;\n _this.handleDelayEnd(ev);\n }, this.delay); // not assignable to number!\n }\n else {\n this.handleDelayEnd(ev);\n }\n };\n FeaturefulElementDragging.prototype.handleDelayEnd = function (ev) {\n this.isDelayEnded = true;\n this.tryStartDrag(ev);\n };\n FeaturefulElementDragging.prototype.handleDistanceSurpassed = function (ev) {\n this.isDistanceSurpassed = true;\n this.tryStartDrag(ev);\n };\n FeaturefulElementDragging.prototype.tryStartDrag = function (ev) {\n if (this.isDelayEnded && this.isDistanceSurpassed) {\n if (!this.pointer.wasTouchScroll || this.touchScrollAllowed) {\n this.isDragging = true;\n this.mirrorNeedsRevert = false;\n this.autoScroller.start(ev.pageX, ev.pageY);\n this.emitter.trigger('dragstart', ev);\n if (this.touchScrollAllowed === false) {\n this.pointer.cancelTouchScroll();\n }\n }\n }\n };\n FeaturefulElementDragging.prototype.tryStopDrag = function (ev) {\n // .stop() is ALWAYS asynchronous, which we NEED because we want all pointerup events\n // that come from the document to fire beforehand. much more convenient this way.\n this.mirror.stop(this.mirrorNeedsRevert, this.stopDrag.bind(this, ev) // bound with args\n );\n };\n FeaturefulElementDragging.prototype.stopDrag = function (ev) {\n this.isDragging = false;\n this.emitter.trigger('dragend', ev);\n };\n // fill in the implementations...\n FeaturefulElementDragging.prototype.setIgnoreMove = function (bool) {\n this.pointer.shouldIgnoreMove = bool;\n };\n FeaturefulElementDragging.prototype.setMirrorIsVisible = function (bool) {\n this.mirror.setIsVisible(bool);\n };\n FeaturefulElementDragging.prototype.setMirrorNeedsRevert = function (bool) {\n this.mirrorNeedsRevert = bool;\n };\n FeaturefulElementDragging.prototype.setAutoScrollEnabled = function (bool) {\n this.autoScroller.isEnabled = bool;\n };\n return FeaturefulElementDragging;\n}(ElementDragging));\n\n/*\nWhen this class is instantiated, it records the offset of an element (relative to the document topleft),\nand continues to monitor scrolling, updating the cached coordinates if it needs to.\nDoes not access the DOM after instantiation, so highly performant.\n\nAlso keeps track of all scrolling/overflow:hidden containers that are parents of the given element\nand an determine if a given point is inside the combined clipping rectangle.\n*/\nvar OffsetTracker = /** @class */ (function () {\n function OffsetTracker(el) {\n this.origRect = computeRect(el);\n // will work fine for divs that have overflow:hidden\n this.scrollCaches = getClippingParents(el).map(function (el) {\n return new ElementScrollGeomCache(el, true); // listen=true\n });\n }\n OffsetTracker.prototype.destroy = function () {\n for (var _i = 0, _a = this.scrollCaches; _i < _a.length; _i++) {\n var scrollCache = _a[_i];\n scrollCache.destroy();\n }\n };\n OffsetTracker.prototype.computeLeft = function () {\n var left = this.origRect.left;\n for (var _i = 0, _a = this.scrollCaches; _i < _a.length; _i++) {\n var scrollCache = _a[_i];\n left += scrollCache.origScrollLeft - scrollCache.getScrollLeft();\n }\n return left;\n };\n OffsetTracker.prototype.computeTop = function () {\n var top = this.origRect.top;\n for (var _i = 0, _a = this.scrollCaches; _i < _a.length; _i++) {\n var scrollCache = _a[_i];\n top += scrollCache.origScrollTop - scrollCache.getScrollTop();\n }\n return top;\n };\n OffsetTracker.prototype.isWithinClipping = function (pageX, pageY) {\n var point = { left: pageX, top: pageY };\n for (var _i = 0, _a = this.scrollCaches; _i < _a.length; _i++) {\n var scrollCache = _a[_i];\n if (!isIgnoredClipping(scrollCache.getEventTarget()) &&\n !pointInsideRect(point, scrollCache.clientRect)) {\n return false;\n }\n }\n return true;\n };\n return OffsetTracker;\n}());\n// certain clipping containers should never constrain interactions, like and \n// https://github.com/fullcalendar/fullcalendar/issues/3615\nfunction isIgnoredClipping(node) {\n var tagName = node.tagName;\n return tagName === 'HTML' || tagName === 'BODY';\n}\n\n/*\nTracks movement over multiple droppable areas (aka \"hits\")\nthat exist in one or more DateComponents.\nRelies on an existing draggable.\n\nemits:\n- pointerdown\n- dragstart\n- hitchange - fires initially, even if not over a hit\n- pointerup\n- (hitchange - again, to null, if ended over a hit)\n- dragend\n*/\nvar HitDragging = /** @class */ (function () {\n function HitDragging(dragging, droppableStore) {\n var _this = this;\n // options that can be set by caller\n this.useSubjectCenter = false;\n this.requireInitial = true; // if doesn't start out on a hit, won't emit any events\n this.initialHit = null;\n this.movingHit = null;\n this.finalHit = null; // won't ever be populated if shouldIgnoreMove\n this.handlePointerDown = function (ev) {\n var dragging = _this.dragging;\n _this.initialHit = null;\n _this.movingHit = null;\n _this.finalHit = null;\n _this.prepareHits();\n _this.processFirstCoord(ev);\n if (_this.initialHit || !_this.requireInitial) {\n dragging.setIgnoreMove(false);\n _this.emitter.trigger('pointerdown', ev); // TODO: fire this before computing processFirstCoord, so listeners can cancel. this gets fired by almost every handler :(\n }\n else {\n dragging.setIgnoreMove(true);\n }\n };\n this.handleDragStart = function (ev) {\n _this.emitter.trigger('dragstart', ev);\n _this.handleMove(ev, true); // force = fire even if initially null\n };\n this.handleDragMove = function (ev) {\n _this.emitter.trigger('dragmove', ev);\n _this.handleMove(ev);\n };\n this.handlePointerUp = function (ev) {\n _this.releaseHits();\n _this.emitter.trigger('pointerup', ev);\n };\n this.handleDragEnd = function (ev) {\n if (_this.movingHit) {\n _this.emitter.trigger('hitupdate', null, true, ev);\n }\n _this.finalHit = _this.movingHit;\n _this.movingHit = null;\n _this.emitter.trigger('dragend', ev);\n };\n this.droppableStore = droppableStore;\n dragging.emitter.on('pointerdown', this.handlePointerDown);\n dragging.emitter.on('dragstart', this.handleDragStart);\n dragging.emitter.on('dragmove', this.handleDragMove);\n dragging.emitter.on('pointerup', this.handlePointerUp);\n dragging.emitter.on('dragend', this.handleDragEnd);\n this.dragging = dragging;\n this.emitter = new EmitterMixin();\n }\n // sets initialHit\n // sets coordAdjust\n HitDragging.prototype.processFirstCoord = function (ev) {\n var origPoint = { left: ev.pageX, top: ev.pageY };\n var adjustedPoint = origPoint;\n var subjectEl = ev.subjectEl;\n var subjectRect;\n if (subjectEl !== document) {\n subjectRect = computeRect(subjectEl);\n adjustedPoint = constrainPoint(adjustedPoint, subjectRect);\n }\n var initialHit = this.initialHit = this.queryHitForOffset(adjustedPoint.left, adjustedPoint.top);\n if (initialHit) {\n if (this.useSubjectCenter && subjectRect) {\n var slicedSubjectRect = intersectRects(subjectRect, initialHit.rect);\n if (slicedSubjectRect) {\n adjustedPoint = getRectCenter(slicedSubjectRect);\n }\n }\n this.coordAdjust = diffPoints(adjustedPoint, origPoint);\n }\n else {\n this.coordAdjust = { left: 0, top: 0 };\n }\n };\n HitDragging.prototype.handleMove = function (ev, forceHandle) {\n var hit = this.queryHitForOffset(ev.pageX + this.coordAdjust.left, ev.pageY + this.coordAdjust.top);\n if (forceHandle || !isHitsEqual(this.movingHit, hit)) {\n this.movingHit = hit;\n this.emitter.trigger('hitupdate', hit, false, ev);\n }\n };\n HitDragging.prototype.prepareHits = function () {\n this.offsetTrackers = mapHash(this.droppableStore, function (interactionSettings) {\n interactionSettings.component.buildPositionCaches();\n return new OffsetTracker(interactionSettings.el);\n });\n };\n HitDragging.prototype.releaseHits = function () {\n var offsetTrackers = this.offsetTrackers;\n for (var id in offsetTrackers) {\n offsetTrackers[id].destroy();\n }\n this.offsetTrackers = {};\n };\n HitDragging.prototype.queryHitForOffset = function (offsetLeft, offsetTop) {\n var _a = this, droppableStore = _a.droppableStore, offsetTrackers = _a.offsetTrackers;\n var bestHit = null;\n for (var id in droppableStore) {\n var component = droppableStore[id].component;\n var offsetTracker = offsetTrackers[id];\n if (offsetTracker.isWithinClipping(offsetLeft, offsetTop)) {\n var originLeft = offsetTracker.computeLeft();\n var originTop = offsetTracker.computeTop();\n var positionLeft = offsetLeft - originLeft;\n var positionTop = offsetTop - originTop;\n var origRect = offsetTracker.origRect;\n var width = origRect.right - origRect.left;\n var height = origRect.bottom - origRect.top;\n if (\n // must be within the element's bounds\n positionLeft >= 0 && positionLeft < width &&\n positionTop >= 0 && positionTop < height) {\n var hit = component.queryHit(positionLeft, positionTop, width, height);\n if (hit &&\n (\n // make sure the hit is within activeRange, meaning it's not a deal cell\n !component.props.dateProfile || // hack for DayTile\n rangeContainsRange(component.props.dateProfile.activeRange, hit.dateSpan.range)) &&\n (!bestHit || hit.layer > bestHit.layer)) {\n // TODO: better way to re-orient rectangle\n hit.rect.left += originLeft;\n hit.rect.right += originLeft;\n hit.rect.top += originTop;\n hit.rect.bottom += originTop;\n bestHit = hit;\n }\n }\n }\n }\n return bestHit;\n };\n return HitDragging;\n}());\nfunction isHitsEqual(hit0, hit1) {\n if (!hit0 && !hit1) {\n return true;\n }\n if (Boolean(hit0) !== Boolean(hit1)) {\n return false;\n }\n return isDateSpansEqual(hit0.dateSpan, hit1.dateSpan);\n}\n\n/*\nMonitors when the user clicks on a specific date/time of a component.\nA pointerdown+pointerup on the same \"hit\" constitutes a click.\n*/\nvar DateClicking = /** @class */ (function (_super) {\n __extends(DateClicking, _super);\n function DateClicking(settings) {\n var _this = _super.call(this, settings) || this;\n _this.handlePointerDown = function (ev) {\n var dragging = _this.dragging;\n // do this in pointerdown (not dragend) because DOM might be mutated by the time dragend is fired\n dragging.setIgnoreMove(!_this.component.isValidDateDownEl(dragging.pointer.downEl));\n };\n // won't even fire if moving was ignored\n _this.handleDragEnd = function (ev) {\n var component = _this.component;\n var _a = component.context, calendar = _a.calendar, view = _a.view;\n var pointer = _this.dragging.pointer;\n if (!pointer.wasTouchScroll) {\n var _b = _this.hitDragging, initialHit = _b.initialHit, finalHit = _b.finalHit;\n if (initialHit && finalHit && isHitsEqual(initialHit, finalHit)) {\n calendar.triggerDateClick(initialHit.dateSpan, initialHit.dayEl, view, ev.origEvent);\n }\n }\n };\n var component = settings.component;\n // we DO want to watch pointer moves because otherwise finalHit won't get populated\n _this.dragging = new FeaturefulElementDragging(component.el);\n _this.dragging.autoScroller.isEnabled = false;\n var hitDragging = _this.hitDragging = new HitDragging(_this.dragging, interactionSettingsToStore(settings));\n hitDragging.emitter.on('pointerdown', _this.handlePointerDown);\n hitDragging.emitter.on('dragend', _this.handleDragEnd);\n return _this;\n }\n DateClicking.prototype.destroy = function () {\n this.dragging.destroy();\n };\n return DateClicking;\n}(Interaction));\n\n/*\nTracks when the user selects a portion of time of a component,\nconstituted by a drag over date cells, with a possible delay at the beginning of the drag.\n*/\nvar DateSelecting = /** @class */ (function (_super) {\n __extends(DateSelecting, _super);\n function DateSelecting(settings) {\n var _this = _super.call(this, settings) || this;\n _this.dragSelection = null;\n _this.handlePointerDown = function (ev) {\n var _a = _this, component = _a.component, dragging = _a.dragging;\n var options = component.context.options;\n var canSelect = options.selectable &&\n component.isValidDateDownEl(ev.origEvent.target);\n // don't bother to watch expensive moves if component won't do selection\n dragging.setIgnoreMove(!canSelect);\n // if touch, require user to hold down\n dragging.delay = ev.isTouch ? getComponentTouchDelay(component) : null;\n };\n _this.handleDragStart = function (ev) {\n _this.component.context.calendar.unselect(ev); // unselect previous selections\n };\n _this.handleHitUpdate = function (hit, isFinal) {\n var calendar = _this.component.context.calendar;\n var dragSelection = null;\n var isInvalid = false;\n if (hit) {\n dragSelection = joinHitsIntoSelection(_this.hitDragging.initialHit, hit, calendar.pluginSystem.hooks.dateSelectionTransformers);\n if (!dragSelection || !_this.component.isDateSelectionValid(dragSelection)) {\n isInvalid = true;\n dragSelection = null;\n }\n }\n if (dragSelection) {\n calendar.dispatch({ type: 'SELECT_DATES', selection: dragSelection });\n }\n else if (!isFinal) { // only unselect if moved away while dragging\n calendar.dispatch({ type: 'UNSELECT_DATES' });\n }\n if (!isInvalid) {\n enableCursor();\n }\n else {\n disableCursor();\n }\n if (!isFinal) {\n _this.dragSelection = dragSelection; // only clear if moved away from all hits while dragging\n }\n };\n _this.handlePointerUp = function (pev) {\n if (_this.dragSelection) {\n // selection is already rendered, so just need to report selection\n _this.component.context.calendar.triggerDateSelect(_this.dragSelection, pev);\n _this.dragSelection = null;\n }\n };\n var component = settings.component;\n var options = component.context.options;\n var dragging = _this.dragging = new FeaturefulElementDragging(component.el);\n dragging.touchScrollAllowed = false;\n dragging.minDistance = options.selectMinDistance || 0;\n dragging.autoScroller.isEnabled = options.dragScroll;\n var hitDragging = _this.hitDragging = new HitDragging(_this.dragging, interactionSettingsToStore(settings));\n hitDragging.emitter.on('pointerdown', _this.handlePointerDown);\n hitDragging.emitter.on('dragstart', _this.handleDragStart);\n hitDragging.emitter.on('hitupdate', _this.handleHitUpdate);\n hitDragging.emitter.on('pointerup', _this.handlePointerUp);\n return _this;\n }\n DateSelecting.prototype.destroy = function () {\n this.dragging.destroy();\n };\n return DateSelecting;\n}(Interaction));\nfunction getComponentTouchDelay(component) {\n var options = component.context.options;\n var delay = options.selectLongPressDelay;\n if (delay == null) {\n delay = options.longPressDelay;\n }\n return delay;\n}\nfunction joinHitsIntoSelection(hit0, hit1, dateSelectionTransformers) {\n var dateSpan0 = hit0.dateSpan;\n var dateSpan1 = hit1.dateSpan;\n var ms = [\n dateSpan0.range.start,\n dateSpan0.range.end,\n dateSpan1.range.start,\n dateSpan1.range.end\n ];\n ms.sort(compareNumbers);\n var props = {};\n for (var _i = 0, dateSelectionTransformers_1 = dateSelectionTransformers; _i < dateSelectionTransformers_1.length; _i++) {\n var transformer = dateSelectionTransformers_1[_i];\n var res = transformer(hit0, hit1);\n if (res === false) {\n return null;\n }\n else if (res) {\n __assign(props, res);\n }\n }\n props.range = { start: ms[0], end: ms[3] };\n props.allDay = dateSpan0.allDay;\n return props;\n}\n\nvar EventDragging = /** @class */ (function (_super) {\n __extends(EventDragging, _super);\n function EventDragging(settings) {\n var _this = _super.call(this, settings) || this;\n // internal state\n _this.subjectSeg = null; // the seg being selected/dragged\n _this.isDragging = false;\n _this.eventRange = null;\n _this.relevantEvents = null; // the events being dragged\n _this.receivingCalendar = null;\n _this.validMutation = null;\n _this.mutatedRelevantEvents = null;\n _this.handlePointerDown = function (ev) {\n var origTarget = ev.origEvent.target;\n var _a = _this, component = _a.component, dragging = _a.dragging;\n var mirror = dragging.mirror;\n var options = component.context.options;\n var initialCalendar = component.context.calendar;\n var subjectSeg = _this.subjectSeg = getElSeg(ev.subjectEl);\n var eventRange = _this.eventRange = subjectSeg.eventRange;\n var eventInstanceId = eventRange.instance.instanceId;\n _this.relevantEvents = getRelevantEvents(initialCalendar.state.eventStore, eventInstanceId);\n dragging.minDistance = ev.isTouch ? 0 : options.eventDragMinDistance;\n dragging.delay =\n // only do a touch delay if touch and this event hasn't been selected yet\n (ev.isTouch && eventInstanceId !== component.props.eventSelection) ?\n getComponentTouchDelay$1(component) :\n null;\n mirror.parentNode = initialCalendar.el;\n mirror.revertDuration = options.dragRevertDuration;\n var isValid = component.isValidSegDownEl(origTarget) &&\n !elementClosest(origTarget, '.fc-resizer'); // NOT on a resizer\n dragging.setIgnoreMove(!isValid);\n // disable dragging for elements that are resizable (ie, selectable)\n // but are not draggable\n _this.isDragging = isValid &&\n ev.subjectEl.classList.contains('fc-draggable');\n };\n _this.handleDragStart = function (ev) {\n var context = _this.component.context;\n var initialCalendar = context.calendar;\n var eventRange = _this.eventRange;\n var eventInstanceId = eventRange.instance.instanceId;\n if (ev.isTouch) {\n // need to select a different event?\n if (eventInstanceId !== _this.component.props.eventSelection) {\n initialCalendar.dispatch({ type: 'SELECT_EVENT', eventInstanceId: eventInstanceId });\n }\n }\n else {\n // if now using mouse, but was previous touch interaction, clear selected event\n initialCalendar.dispatch({ type: 'UNSELECT_EVENT' });\n }\n if (_this.isDragging) {\n initialCalendar.unselect(ev); // unselect *date* selection\n initialCalendar.publiclyTrigger('eventDragStart', [\n {\n el: _this.subjectSeg.el,\n event: new EventApi(initialCalendar, eventRange.def, eventRange.instance),\n jsEvent: ev.origEvent,\n view: context.view\n }\n ]);\n }\n };\n _this.handleHitUpdate = function (hit, isFinal) {\n if (!_this.isDragging) {\n return;\n }\n var relevantEvents = _this.relevantEvents;\n var initialHit = _this.hitDragging.initialHit;\n var initialCalendar = _this.component.context.calendar;\n // states based on new hit\n var receivingCalendar = null;\n var mutation = null;\n var mutatedRelevantEvents = null;\n var isInvalid = false;\n var interaction = {\n affectedEvents: relevantEvents,\n mutatedEvents: createEmptyEventStore(),\n isEvent: true,\n origSeg: _this.subjectSeg\n };\n if (hit) {\n var receivingComponent = hit.component;\n receivingCalendar = receivingComponent.context.calendar;\n var receivingOptions = receivingComponent.context.options;\n if (initialCalendar === receivingCalendar ||\n receivingOptions.editable && receivingOptions.droppable) {\n mutation = computeEventMutation(initialHit, hit, receivingCalendar.pluginSystem.hooks.eventDragMutationMassagers);\n if (mutation) {\n mutatedRelevantEvents = applyMutationToEventStore(relevantEvents, receivingCalendar.eventUiBases, mutation, receivingCalendar);\n interaction.mutatedEvents = mutatedRelevantEvents;\n if (!receivingComponent.isInteractionValid(interaction)) {\n isInvalid = true;\n mutation = null;\n mutatedRelevantEvents = null;\n interaction.mutatedEvents = createEmptyEventStore();\n }\n }\n }\n else {\n receivingCalendar = null;\n }\n }\n _this.displayDrag(receivingCalendar, interaction);\n if (!isInvalid) {\n enableCursor();\n }\n else {\n disableCursor();\n }\n if (!isFinal) {\n if (initialCalendar === receivingCalendar && // TODO: write test for this\n isHitsEqual(initialHit, hit)) {\n mutation = null;\n }\n _this.dragging.setMirrorNeedsRevert(!mutation);\n // render the mirror if no already-rendered mirror\n // TODO: wish we could somehow wait for dispatch to guarantee render\n _this.dragging.setMirrorIsVisible(!hit || !document.querySelector('.fc-mirror'));\n // assign states based on new hit\n _this.receivingCalendar = receivingCalendar;\n _this.validMutation = mutation;\n _this.mutatedRelevantEvents = mutatedRelevantEvents;\n }\n };\n _this.handlePointerUp = function () {\n if (!_this.isDragging) {\n _this.cleanup(); // because handleDragEnd won't fire\n }\n };\n _this.handleDragEnd = function (ev) {\n if (_this.isDragging) {\n var context = _this.component.context;\n var initialCalendar_1 = context.calendar;\n var initialView = context.view;\n var _a = _this, receivingCalendar = _a.receivingCalendar, validMutation = _a.validMutation;\n var eventDef = _this.eventRange.def;\n var eventInstance = _this.eventRange.instance;\n var eventApi = new EventApi(initialCalendar_1, eventDef, eventInstance);\n var relevantEvents_1 = _this.relevantEvents;\n var mutatedRelevantEvents = _this.mutatedRelevantEvents;\n var finalHit = _this.hitDragging.finalHit;\n _this.clearDrag(); // must happen after revert animation\n initialCalendar_1.publiclyTrigger('eventDragStop', [\n {\n el: _this.subjectSeg.el,\n event: eventApi,\n jsEvent: ev.origEvent,\n view: initialView\n }\n ]);\n if (validMutation) {\n // dropped within same calendar\n if (receivingCalendar === initialCalendar_1) {\n initialCalendar_1.dispatch({\n type: 'MERGE_EVENTS',\n eventStore: mutatedRelevantEvents\n });\n var transformed = {};\n for (var _i = 0, _b = initialCalendar_1.pluginSystem.hooks.eventDropTransformers; _i < _b.length; _i++) {\n var transformer = _b[_i];\n __assign(transformed, transformer(validMutation, initialCalendar_1));\n }\n var eventDropArg = __assign({}, transformed, { el: ev.subjectEl, delta: validMutation.datesDelta, oldEvent: eventApi, event: new EventApi(// the data AFTER the mutation\n initialCalendar_1, mutatedRelevantEvents.defs[eventDef.defId], eventInstance ? mutatedRelevantEvents.instances[eventInstance.instanceId] : null), revert: function () {\n initialCalendar_1.dispatch({\n type: 'MERGE_EVENTS',\n eventStore: relevantEvents_1\n });\n }, jsEvent: ev.origEvent, view: initialView });\n initialCalendar_1.publiclyTrigger('eventDrop', [eventDropArg]);\n // dropped in different calendar\n }\n else if (receivingCalendar) {\n initialCalendar_1.publiclyTrigger('eventLeave', [\n {\n draggedEl: ev.subjectEl,\n event: eventApi,\n view: initialView\n }\n ]);\n initialCalendar_1.dispatch({\n type: 'REMOVE_EVENT_INSTANCES',\n instances: _this.mutatedRelevantEvents.instances\n });\n receivingCalendar.dispatch({\n type: 'MERGE_EVENTS',\n eventStore: _this.mutatedRelevantEvents\n });\n if (ev.isTouch) {\n receivingCalendar.dispatch({\n type: 'SELECT_EVENT',\n eventInstanceId: eventInstance.instanceId\n });\n }\n var dropArg = __assign({}, receivingCalendar.buildDatePointApi(finalHit.dateSpan), { draggedEl: ev.subjectEl, jsEvent: ev.origEvent, view: finalHit.component // should this be finalHit.component.view? See #4644\n });\n receivingCalendar.publiclyTrigger('drop', [dropArg]);\n receivingCalendar.publiclyTrigger('eventReceive', [\n {\n draggedEl: ev.subjectEl,\n event: new EventApi(// the data AFTER the mutation\n receivingCalendar, mutatedRelevantEvents.defs[eventDef.defId], mutatedRelevantEvents.instances[eventInstance.instanceId]),\n view: finalHit.component // should this be finalHit.component.view? See #4644\n }\n ]);\n }\n }\n else {\n initialCalendar_1.publiclyTrigger('_noEventDrop');\n }\n }\n _this.cleanup();\n };\n var component = _this.component;\n var options = component.context.options;\n var dragging = _this.dragging = new FeaturefulElementDragging(component.el);\n dragging.pointer.selector = EventDragging.SELECTOR;\n dragging.touchScrollAllowed = false;\n dragging.autoScroller.isEnabled = options.dragScroll;\n var hitDragging = _this.hitDragging = new HitDragging(_this.dragging, interactionSettingsStore);\n hitDragging.useSubjectCenter = settings.useEventCenter;\n hitDragging.emitter.on('pointerdown', _this.handlePointerDown);\n hitDragging.emitter.on('dragstart', _this.handleDragStart);\n hitDragging.emitter.on('hitupdate', _this.handleHitUpdate);\n hitDragging.emitter.on('pointerup', _this.handlePointerUp);\n hitDragging.emitter.on('dragend', _this.handleDragEnd);\n return _this;\n }\n EventDragging.prototype.destroy = function () {\n this.dragging.destroy();\n };\n // render a drag state on the next receivingCalendar\n EventDragging.prototype.displayDrag = function (nextCalendar, state) {\n var initialCalendar = this.component.context.calendar;\n var prevCalendar = this.receivingCalendar;\n // does the previous calendar need to be cleared?\n if (prevCalendar && prevCalendar !== nextCalendar) {\n // does the initial calendar need to be cleared?\n // if so, don't clear all the way. we still need to to hide the affectedEvents\n if (prevCalendar === initialCalendar) {\n prevCalendar.dispatch({\n type: 'SET_EVENT_DRAG',\n state: {\n affectedEvents: state.affectedEvents,\n mutatedEvents: createEmptyEventStore(),\n isEvent: true,\n origSeg: state.origSeg\n }\n });\n // completely clear the old calendar if it wasn't the initial\n }\n else {\n prevCalendar.dispatch({ type: 'UNSET_EVENT_DRAG' });\n }\n }\n if (nextCalendar) {\n nextCalendar.dispatch({ type: 'SET_EVENT_DRAG', state: state });\n }\n };\n EventDragging.prototype.clearDrag = function () {\n var initialCalendar = this.component.context.calendar;\n var receivingCalendar = this.receivingCalendar;\n if (receivingCalendar) {\n receivingCalendar.dispatch({ type: 'UNSET_EVENT_DRAG' });\n }\n // the initial calendar might have an dummy drag state from displayDrag\n if (initialCalendar !== receivingCalendar) {\n initialCalendar.dispatch({ type: 'UNSET_EVENT_DRAG' });\n }\n };\n EventDragging.prototype.cleanup = function () {\n this.subjectSeg = null;\n this.isDragging = false;\n this.eventRange = null;\n this.relevantEvents = null;\n this.receivingCalendar = null;\n this.validMutation = null;\n this.mutatedRelevantEvents = null;\n };\n EventDragging.SELECTOR = '.fc-draggable, .fc-resizable'; // TODO: test this in IE11\n return EventDragging;\n}(Interaction));\nfunction computeEventMutation(hit0, hit1, massagers) {\n var dateSpan0 = hit0.dateSpan;\n var dateSpan1 = hit1.dateSpan;\n var date0 = dateSpan0.range.start;\n var date1 = dateSpan1.range.start;\n var standardProps = {};\n if (dateSpan0.allDay !== dateSpan1.allDay) {\n standardProps.allDay = dateSpan1.allDay;\n standardProps.hasEnd = hit1.component.context.options.allDayMaintainDuration;\n if (dateSpan1.allDay) {\n // means date1 is already start-of-day,\n // but date0 needs to be converted\n date0 = startOfDay(date0);\n }\n }\n var delta = diffDates(date0, date1, hit0.component.context.dateEnv, hit0.component === hit1.component ?\n hit0.component.largeUnit :\n null);\n if (delta.milliseconds) { // has hours/minutes/seconds\n standardProps.allDay = false;\n }\n var mutation = {\n datesDelta: delta,\n standardProps: standardProps\n };\n for (var _i = 0, massagers_1 = massagers; _i < massagers_1.length; _i++) {\n var massager = massagers_1[_i];\n massager(mutation, hit0, hit1);\n }\n return mutation;\n}\nfunction getComponentTouchDelay$1(component) {\n var options = component.context.options;\n var delay = options.eventLongPressDelay;\n if (delay == null) {\n delay = options.longPressDelay;\n }\n return delay;\n}\n\nvar EventDragging$1 = /** @class */ (function (_super) {\n __extends(EventDragging, _super);\n function EventDragging(settings) {\n var _this = _super.call(this, settings) || this;\n // internal state\n _this.draggingSeg = null; // TODO: rename to resizingSeg? subjectSeg?\n _this.eventRange = null;\n _this.relevantEvents = null;\n _this.validMutation = null;\n _this.mutatedRelevantEvents = null;\n _this.handlePointerDown = function (ev) {\n var component = _this.component;\n var seg = _this.querySeg(ev);\n var eventRange = _this.eventRange = seg.eventRange;\n _this.dragging.minDistance = component.context.options.eventDragMinDistance;\n // if touch, need to be working with a selected event\n _this.dragging.setIgnoreMove(!_this.component.isValidSegDownEl(ev.origEvent.target) ||\n (ev.isTouch && _this.component.props.eventSelection !== eventRange.instance.instanceId));\n };\n _this.handleDragStart = function (ev) {\n var _a = _this.component.context, calendar = _a.calendar, view = _a.view;\n var eventRange = _this.eventRange;\n _this.relevantEvents = getRelevantEvents(calendar.state.eventStore, _this.eventRange.instance.instanceId);\n _this.draggingSeg = _this.querySeg(ev);\n calendar.unselect();\n calendar.publiclyTrigger('eventResizeStart', [\n {\n el: _this.draggingSeg.el,\n event: new EventApi(calendar, eventRange.def, eventRange.instance),\n jsEvent: ev.origEvent,\n view: view\n }\n ]);\n };\n _this.handleHitUpdate = function (hit, isFinal, ev) {\n var calendar = _this.component.context.calendar;\n var relevantEvents = _this.relevantEvents;\n var initialHit = _this.hitDragging.initialHit;\n var eventInstance = _this.eventRange.instance;\n var mutation = null;\n var mutatedRelevantEvents = null;\n var isInvalid = false;\n var interaction = {\n affectedEvents: relevantEvents,\n mutatedEvents: createEmptyEventStore(),\n isEvent: true,\n origSeg: _this.draggingSeg\n };\n if (hit) {\n mutation = computeMutation(initialHit, hit, ev.subjectEl.classList.contains('fc-start-resizer'), eventInstance.range, calendar.pluginSystem.hooks.eventResizeJoinTransforms);\n }\n if (mutation) {\n mutatedRelevantEvents = applyMutationToEventStore(relevantEvents, calendar.eventUiBases, mutation, calendar);\n interaction.mutatedEvents = mutatedRelevantEvents;\n if (!_this.component.isInteractionValid(interaction)) {\n isInvalid = true;\n mutation = null;\n mutatedRelevantEvents = null;\n interaction.mutatedEvents = null;\n }\n }\n if (mutatedRelevantEvents) {\n calendar.dispatch({\n type: 'SET_EVENT_RESIZE',\n state: interaction\n });\n }\n else {\n calendar.dispatch({ type: 'UNSET_EVENT_RESIZE' });\n }\n if (!isInvalid) {\n enableCursor();\n }\n else {\n disableCursor();\n }\n if (!isFinal) {\n if (mutation && isHitsEqual(initialHit, hit)) {\n mutation = null;\n }\n _this.validMutation = mutation;\n _this.mutatedRelevantEvents = mutatedRelevantEvents;\n }\n };\n _this.handleDragEnd = function (ev) {\n var _a = _this.component.context, calendar = _a.calendar, view = _a.view;\n var eventDef = _this.eventRange.def;\n var eventInstance = _this.eventRange.instance;\n var eventApi = new EventApi(calendar, eventDef, eventInstance);\n var relevantEvents = _this.relevantEvents;\n var mutatedRelevantEvents = _this.mutatedRelevantEvents;\n calendar.publiclyTrigger('eventResizeStop', [\n {\n el: _this.draggingSeg.el,\n event: eventApi,\n jsEvent: ev.origEvent,\n view: view\n }\n ]);\n if (_this.validMutation) {\n calendar.dispatch({\n type: 'MERGE_EVENTS',\n eventStore: mutatedRelevantEvents\n });\n calendar.publiclyTrigger('eventResize', [\n {\n el: _this.draggingSeg.el,\n startDelta: _this.validMutation.startDelta || createDuration(0),\n endDelta: _this.validMutation.endDelta || createDuration(0),\n prevEvent: eventApi,\n event: new EventApi(// the data AFTER the mutation\n calendar, mutatedRelevantEvents.defs[eventDef.defId], eventInstance ? mutatedRelevantEvents.instances[eventInstance.instanceId] : null),\n revert: function () {\n calendar.dispatch({\n type: 'MERGE_EVENTS',\n eventStore: relevantEvents\n });\n },\n jsEvent: ev.origEvent,\n view: view\n }\n ]);\n }\n else {\n calendar.publiclyTrigger('_noEventResize');\n }\n // reset all internal state\n _this.draggingSeg = null;\n _this.relevantEvents = null;\n _this.validMutation = null;\n // okay to keep eventInstance around. useful to set it in handlePointerDown\n };\n var component = settings.component;\n var dragging = _this.dragging = new FeaturefulElementDragging(component.el);\n dragging.pointer.selector = '.fc-resizer';\n dragging.touchScrollAllowed = false;\n dragging.autoScroller.isEnabled = component.context.options.dragScroll;\n var hitDragging = _this.hitDragging = new HitDragging(_this.dragging, interactionSettingsToStore(settings));\n hitDragging.emitter.on('pointerdown', _this.handlePointerDown);\n hitDragging.emitter.on('dragstart', _this.handleDragStart);\n hitDragging.emitter.on('hitupdate', _this.handleHitUpdate);\n hitDragging.emitter.on('dragend', _this.handleDragEnd);\n return _this;\n }\n EventDragging.prototype.destroy = function () {\n this.dragging.destroy();\n };\n EventDragging.prototype.querySeg = function (ev) {\n return getElSeg(elementClosest(ev.subjectEl, this.component.fgSegSelector));\n };\n return EventDragging;\n}(Interaction));\nfunction computeMutation(hit0, hit1, isFromStart, instanceRange, transforms) {\n var dateEnv = hit0.component.context.dateEnv;\n var date0 = hit0.dateSpan.range.start;\n var date1 = hit1.dateSpan.range.start;\n var delta = diffDates(date0, date1, dateEnv, hit0.component.largeUnit);\n var props = {};\n for (var _i = 0, transforms_1 = transforms; _i < transforms_1.length; _i++) {\n var transform = transforms_1[_i];\n var res = transform(hit0, hit1);\n if (res === false) {\n return null;\n }\n else if (res) {\n __assign(props, res);\n }\n }\n if (isFromStart) {\n if (dateEnv.add(instanceRange.start, delta) < instanceRange.end) {\n props.startDelta = delta;\n return props;\n }\n }\n else {\n if (dateEnv.add(instanceRange.end, delta) > instanceRange.start) {\n props.endDelta = delta;\n return props;\n }\n }\n return null;\n}\n\nvar UnselectAuto = /** @class */ (function () {\n function UnselectAuto(calendar) {\n var _this = this;\n this.isRecentPointerDateSelect = false; // wish we could use a selector to detect date selection, but uses hit system\n this.onSelect = function (selectInfo) {\n if (selectInfo.jsEvent) {\n _this.isRecentPointerDateSelect = true;\n }\n };\n this.onDocumentPointerUp = function (pev) {\n var _a = _this, calendar = _a.calendar, documentPointer = _a.documentPointer;\n var state = calendar.state;\n // touch-scrolling should never unfocus any type of selection\n if (!documentPointer.wasTouchScroll) {\n if (state.dateSelection && // an existing date selection?\n !_this.isRecentPointerDateSelect // a new pointer-initiated date selection since last onDocumentPointerUp?\n ) {\n var unselectAuto = calendar.viewOpt('unselectAuto');\n var unselectCancel = calendar.viewOpt('unselectCancel');\n if (unselectAuto && (!unselectAuto || !elementClosest(documentPointer.downEl, unselectCancel))) {\n calendar.unselect(pev);\n }\n }\n if (state.eventSelection && // an existing event selected?\n !elementClosest(documentPointer.downEl, EventDragging.SELECTOR) // interaction DIDN'T start on an event\n ) {\n calendar.dispatch({ type: 'UNSELECT_EVENT' });\n }\n }\n _this.isRecentPointerDateSelect = false;\n };\n this.calendar = calendar;\n var documentPointer = this.documentPointer = new PointerDragging(document);\n documentPointer.shouldIgnoreMove = true;\n documentPointer.shouldWatchScroll = false;\n documentPointer.emitter.on('pointerup', this.onDocumentPointerUp);\n /*\n TODO: better way to know about whether there was a selection with the pointer\n */\n calendar.on('select', this.onSelect);\n }\n UnselectAuto.prototype.destroy = function () {\n this.calendar.off('select', this.onSelect);\n this.documentPointer.destroy();\n };\n return UnselectAuto;\n}());\n\n/*\nGiven an already instantiated draggable object for one-or-more elements,\nInterprets any dragging as an attempt to drag an events that lives outside\nof a calendar onto a calendar.\n*/\nvar ExternalElementDragging = /** @class */ (function () {\n function ExternalElementDragging(dragging, suppliedDragMeta) {\n var _this = this;\n this.receivingCalendar = null;\n this.droppableEvent = null; // will exist for all drags, even if create:false\n this.suppliedDragMeta = null;\n this.dragMeta = null;\n this.handleDragStart = function (ev) {\n _this.dragMeta = _this.buildDragMeta(ev.subjectEl);\n };\n this.handleHitUpdate = function (hit, isFinal, ev) {\n var dragging = _this.hitDragging.dragging;\n var receivingCalendar = null;\n var droppableEvent = null;\n var isInvalid = false;\n var interaction = {\n affectedEvents: createEmptyEventStore(),\n mutatedEvents: createEmptyEventStore(),\n isEvent: _this.dragMeta.create,\n origSeg: null\n };\n if (hit) {\n receivingCalendar = hit.component.context.calendar;\n if (_this.canDropElOnCalendar(ev.subjectEl, receivingCalendar)) {\n droppableEvent = computeEventForDateSpan(hit.dateSpan, _this.dragMeta, receivingCalendar);\n interaction.mutatedEvents = eventTupleToStore(droppableEvent);\n isInvalid = !isInteractionValid(interaction, receivingCalendar);\n if (isInvalid) {\n interaction.mutatedEvents = createEmptyEventStore();\n droppableEvent = null;\n }\n }\n }\n _this.displayDrag(receivingCalendar, interaction);\n // show mirror if no already-rendered mirror element OR if we are shutting down the mirror (?)\n // TODO: wish we could somehow wait for dispatch to guarantee render\n dragging.setMirrorIsVisible(isFinal || !droppableEvent || !document.querySelector('.fc-mirror'));\n if (!isInvalid) {\n enableCursor();\n }\n else {\n disableCursor();\n }\n if (!isFinal) {\n dragging.setMirrorNeedsRevert(!droppableEvent);\n _this.receivingCalendar = receivingCalendar;\n _this.droppableEvent = droppableEvent;\n }\n };\n this.handleDragEnd = function (pev) {\n var _a = _this, receivingCalendar = _a.receivingCalendar, droppableEvent = _a.droppableEvent;\n _this.clearDrag();\n if (receivingCalendar && droppableEvent) {\n var finalHit = _this.hitDragging.finalHit;\n var finalView = finalHit.component.context.view;\n var dragMeta = _this.dragMeta;\n var arg = __assign({}, receivingCalendar.buildDatePointApi(finalHit.dateSpan), { draggedEl: pev.subjectEl, jsEvent: pev.origEvent, view: finalView });\n receivingCalendar.publiclyTrigger('drop', [arg]);\n if (dragMeta.create) {\n receivingCalendar.dispatch({\n type: 'MERGE_EVENTS',\n eventStore: eventTupleToStore(droppableEvent)\n });\n if (pev.isTouch) {\n receivingCalendar.dispatch({\n type: 'SELECT_EVENT',\n eventInstanceId: droppableEvent.instance.instanceId\n });\n }\n // signal that an external event landed\n receivingCalendar.publiclyTrigger('eventReceive', [\n {\n draggedEl: pev.subjectEl,\n event: new EventApi(receivingCalendar, droppableEvent.def, droppableEvent.instance),\n view: finalView\n }\n ]);\n }\n }\n _this.receivingCalendar = null;\n _this.droppableEvent = null;\n };\n var hitDragging = this.hitDragging = new HitDragging(dragging, interactionSettingsStore);\n hitDragging.requireInitial = false; // will start outside of a component\n hitDragging.emitter.on('dragstart', this.handleDragStart);\n hitDragging.emitter.on('hitupdate', this.handleHitUpdate);\n hitDragging.emitter.on('dragend', this.handleDragEnd);\n this.suppliedDragMeta = suppliedDragMeta;\n }\n ExternalElementDragging.prototype.buildDragMeta = function (subjectEl) {\n if (typeof this.suppliedDragMeta === 'object') {\n return parseDragMeta(this.suppliedDragMeta);\n }\n else if (typeof this.suppliedDragMeta === 'function') {\n return parseDragMeta(this.suppliedDragMeta(subjectEl));\n }\n else {\n return getDragMetaFromEl(subjectEl);\n }\n };\n ExternalElementDragging.prototype.displayDrag = function (nextCalendar, state) {\n var prevCalendar = this.receivingCalendar;\n if (prevCalendar && prevCalendar !== nextCalendar) {\n prevCalendar.dispatch({ type: 'UNSET_EVENT_DRAG' });\n }\n if (nextCalendar) {\n nextCalendar.dispatch({ type: 'SET_EVENT_DRAG', state: state });\n }\n };\n ExternalElementDragging.prototype.clearDrag = function () {\n if (this.receivingCalendar) {\n this.receivingCalendar.dispatch({ type: 'UNSET_EVENT_DRAG' });\n }\n };\n ExternalElementDragging.prototype.canDropElOnCalendar = function (el, receivingCalendar) {\n var dropAccept = receivingCalendar.opt('dropAccept');\n if (typeof dropAccept === 'function') {\n return dropAccept(el);\n }\n else if (typeof dropAccept === 'string' && dropAccept) {\n return Boolean(elementMatches(el, dropAccept));\n }\n return true;\n };\n return ExternalElementDragging;\n}());\n// Utils for computing event store from the DragMeta\n// ----------------------------------------------------------------------------------------------------\nfunction computeEventForDateSpan(dateSpan, dragMeta, calendar) {\n var defProps = __assign({}, dragMeta.leftoverProps);\n for (var _i = 0, _a = calendar.pluginSystem.hooks.externalDefTransforms; _i < _a.length; _i++) {\n var transform = _a[_i];\n __assign(defProps, transform(dateSpan, dragMeta));\n }\n var def = parseEventDef(defProps, dragMeta.sourceId, dateSpan.allDay, calendar.opt('forceEventDuration') || Boolean(dragMeta.duration), // hasEnd\n calendar);\n var start = dateSpan.range.start;\n // only rely on time info if drop zone is all-day,\n // otherwise, we already know the time\n if (dateSpan.allDay && dragMeta.startTime) {\n start = calendar.dateEnv.add(start, dragMeta.startTime);\n }\n var end = dragMeta.duration ?\n calendar.dateEnv.add(start, dragMeta.duration) :\n calendar.getDefaultEventEnd(dateSpan.allDay, start);\n var instance = createEventInstance(def.defId, { start: start, end: end });\n return { def: def, instance: instance };\n}\n// Utils for extracting data from element\n// ----------------------------------------------------------------------------------------------------\nfunction getDragMetaFromEl(el) {\n var str = getEmbeddedElData(el, 'event');\n var obj = str ?\n JSON.parse(str) :\n { create: false }; // if no embedded data, assume no event creation\n return parseDragMeta(obj);\n}\nconfig.dataAttrPrefix = '';\nfunction getEmbeddedElData(el, name) {\n var prefix = config.dataAttrPrefix;\n var prefixedName = (prefix ? prefix + '-' : '') + name;\n return el.getAttribute('data-' + prefixedName) || '';\n}\n\n/*\nMakes an element (that is *external* to any calendar) draggable.\nCan pass in data that determines how an event will be created when dropped onto a calendar.\nLeverages FullCalendar's internal drag-n-drop functionality WITHOUT a third-party drag system.\n*/\nvar ExternalDraggable = /** @class */ (function () {\n function ExternalDraggable(el, settings) {\n var _this = this;\n if (settings === void 0) { settings = {}; }\n this.handlePointerDown = function (ev) {\n var dragging = _this.dragging;\n var _a = _this.settings, minDistance = _a.minDistance, longPressDelay = _a.longPressDelay;\n dragging.minDistance =\n minDistance != null ?\n minDistance :\n (ev.isTouch ? 0 : globalDefaults.eventDragMinDistance);\n dragging.delay =\n ev.isTouch ? // TODO: eventually read eventLongPressDelay instead vvv\n (longPressDelay != null ? longPressDelay : globalDefaults.longPressDelay) :\n 0;\n };\n this.handleDragStart = function (ev) {\n if (ev.isTouch &&\n _this.dragging.delay &&\n ev.subjectEl.classList.contains('fc-event')) {\n _this.dragging.mirror.getMirrorEl().classList.add('fc-selected');\n }\n };\n this.settings = settings;\n var dragging = this.dragging = new FeaturefulElementDragging(el);\n dragging.touchScrollAllowed = false;\n if (settings.itemSelector != null) {\n dragging.pointer.selector = settings.itemSelector;\n }\n if (settings.appendTo != null) {\n dragging.mirror.parentNode = settings.appendTo; // TODO: write tests\n }\n dragging.emitter.on('pointerdown', this.handlePointerDown);\n dragging.emitter.on('dragstart', this.handleDragStart);\n new ExternalElementDragging(dragging, settings.eventData);\n }\n ExternalDraggable.prototype.destroy = function () {\n this.dragging.destroy();\n };\n return ExternalDraggable;\n}());\n\n/*\nDetects when a *THIRD-PARTY* drag-n-drop system interacts with elements.\nThe third-party system is responsible for drawing the visuals effects of the drag.\nThis class simply monitors for pointer movements and fires events.\nIt also has the ability to hide the moving element (the \"mirror\") during the drag.\n*/\nvar InferredElementDragging = /** @class */ (function (_super) {\n __extends(InferredElementDragging, _super);\n function InferredElementDragging(containerEl) {\n var _this = _super.call(this, containerEl) || this;\n _this.shouldIgnoreMove = false;\n _this.mirrorSelector = '';\n _this.currentMirrorEl = null;\n _this.handlePointerDown = function (ev) {\n _this.emitter.trigger('pointerdown', ev);\n if (!_this.shouldIgnoreMove) {\n // fire dragstart right away. does not support delay or min-distance\n _this.emitter.trigger('dragstart', ev);\n }\n };\n _this.handlePointerMove = function (ev) {\n if (!_this.shouldIgnoreMove) {\n _this.emitter.trigger('dragmove', ev);\n }\n };\n _this.handlePointerUp = function (ev) {\n _this.emitter.trigger('pointerup', ev);\n if (!_this.shouldIgnoreMove) {\n // fire dragend right away. does not support a revert animation\n _this.emitter.trigger('dragend', ev);\n }\n };\n var pointer = _this.pointer = new PointerDragging(containerEl);\n pointer.emitter.on('pointerdown', _this.handlePointerDown);\n pointer.emitter.on('pointermove', _this.handlePointerMove);\n pointer.emitter.on('pointerup', _this.handlePointerUp);\n return _this;\n }\n InferredElementDragging.prototype.destroy = function () {\n this.pointer.destroy();\n };\n InferredElementDragging.prototype.setIgnoreMove = function (bool) {\n this.shouldIgnoreMove = bool;\n };\n InferredElementDragging.prototype.setMirrorIsVisible = function (bool) {\n if (bool) {\n // restore a previously hidden element.\n // use the reference in case the selector class has already been removed.\n if (this.currentMirrorEl) {\n this.currentMirrorEl.style.visibility = '';\n this.currentMirrorEl = null;\n }\n }\n else {\n var mirrorEl = this.mirrorSelector ?\n document.querySelector(this.mirrorSelector) :\n null;\n if (mirrorEl) {\n this.currentMirrorEl = mirrorEl;\n mirrorEl.style.visibility = 'hidden';\n }\n }\n };\n return InferredElementDragging;\n}(ElementDragging));\n\n/*\nBridges third-party drag-n-drop systems with FullCalendar.\nMust be instantiated and destroyed by caller.\n*/\nvar ThirdPartyDraggable = /** @class */ (function () {\n function ThirdPartyDraggable(containerOrSettings, settings) {\n var containerEl = document;\n if (\n // wish we could just test instanceof EventTarget, but doesn't work in IE11\n containerOrSettings === document ||\n containerOrSettings instanceof Element) {\n containerEl = containerOrSettings;\n settings = settings || {};\n }\n else {\n settings = (containerOrSettings || {});\n }\n var dragging = this.dragging = new InferredElementDragging(containerEl);\n if (typeof settings.itemSelector === 'string') {\n dragging.pointer.selector = settings.itemSelector;\n }\n else if (containerEl === document) {\n dragging.pointer.selector = '[data-event]';\n }\n if (typeof settings.mirrorSelector === 'string') {\n dragging.mirrorSelector = settings.mirrorSelector;\n }\n new ExternalElementDragging(dragging, settings.eventData);\n }\n ThirdPartyDraggable.prototype.destroy = function () {\n this.dragging.destroy();\n };\n return ThirdPartyDraggable;\n}());\n\nvar main = createPlugin({\n componentInteractions: [DateClicking, DateSelecting, EventDragging, EventDragging$1],\n calendarInteractions: [UnselectAuto],\n elementDraggingImpl: FeaturefulElementDragging\n});\n\nexport default main;\nexport { ExternalDraggable as Draggable, FeaturefulElementDragging, PointerDragging, ThirdPartyDraggable };\n","/*!\nFullCalendar Time Grid Plugin v4.4.2\nDocs & License: https://fullcalendar.io/\n(c) 2019 Adam Shaw\n*/\n\nimport { createFormatter, removeElement, computeEventDraggable, computeEventStartResizable, computeEventEndResizable, cssToStr, isMultiDayRange, htmlEscape, compareByFieldSpecs, applyStyle, FgEventRenderer, buildSegCompareObj, FillRenderer, memoize, memoizeRendering, createDuration, wholeDivideDurations, findElements, PositionCache, startOfDay, asRoughMs, formatIsoTimeString, addDurations, htmlToElement, createElement, multiplyDuration, DateComponent, hasBgRendering, Splitter, diffDays, buildGotoAnchorHtml, getAllDayHtml, ScrollComponent, matchCellWidths, uncompensateScroll, compensateScroll, subtractInnerElHeight, View, intersectRanges, Slicer, DayHeader, DaySeries, DayTable, createPlugin } from '@fullcalendar/core';\nimport { DayBgRow, DayGrid, SimpleDayGrid } from '@fullcalendar/daygrid';\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n 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 extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(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\nvar __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n };\r\n return __assign.apply(this, arguments);\r\n};\n\n/*\nOnly handles foreground segs.\nDoes not own rendering. Use for low-level util methods by TimeGrid.\n*/\nvar TimeGridEventRenderer = /** @class */ (function (_super) {\n __extends(TimeGridEventRenderer, _super);\n function TimeGridEventRenderer(timeGrid) {\n var _this = _super.call(this) || this;\n _this.timeGrid = timeGrid;\n return _this;\n }\n TimeGridEventRenderer.prototype.renderSegs = function (context, segs, mirrorInfo) {\n _super.prototype.renderSegs.call(this, context, segs, mirrorInfo);\n // TODO: dont do every time. memoize\n this.fullTimeFormat = createFormatter({\n hour: 'numeric',\n minute: '2-digit',\n separator: this.context.options.defaultRangeSeparator\n });\n };\n // Given an array of foreground segments, render a DOM element for each, computes position,\n // and attaches to the column inner-container elements.\n TimeGridEventRenderer.prototype.attachSegs = function (segs, mirrorInfo) {\n var segsByCol = this.timeGrid.groupSegsByCol(segs);\n // order the segs within each column\n // TODO: have groupSegsByCol do this?\n for (var col = 0; col < segsByCol.length; col++) {\n segsByCol[col] = this.sortEventSegs(segsByCol[col]);\n }\n this.segsByCol = segsByCol;\n this.timeGrid.attachSegsByCol(segsByCol, this.timeGrid.fgContainerEls);\n };\n TimeGridEventRenderer.prototype.detachSegs = function (segs) {\n segs.forEach(function (seg) {\n removeElement(seg.el);\n });\n this.segsByCol = null;\n };\n TimeGridEventRenderer.prototype.computeSegSizes = function (allSegs) {\n var _a = this, timeGrid = _a.timeGrid, segsByCol = _a.segsByCol;\n var colCnt = timeGrid.colCnt;\n timeGrid.computeSegVerticals(allSegs); // horizontals relies on this\n if (segsByCol) {\n for (var col = 0; col < colCnt; col++) {\n this.computeSegHorizontals(segsByCol[col]); // compute horizontal coordinates, z-index's, and reorder the array\n }\n }\n };\n TimeGridEventRenderer.prototype.assignSegSizes = function (allSegs) {\n var _a = this, timeGrid = _a.timeGrid, segsByCol = _a.segsByCol;\n var colCnt = timeGrid.colCnt;\n timeGrid.assignSegVerticals(allSegs); // horizontals relies on this\n if (segsByCol) {\n for (var col = 0; col < colCnt; col++) {\n this.assignSegCss(segsByCol[col]);\n }\n }\n };\n // Computes a default event time formatting string if `eventTimeFormat` is not explicitly defined\n TimeGridEventRenderer.prototype.computeEventTimeFormat = function () {\n return {\n hour: 'numeric',\n minute: '2-digit',\n meridiem: false\n };\n };\n // Computes a default `displayEventEnd` value if one is not expliclty defined\n TimeGridEventRenderer.prototype.computeDisplayEventEnd = function () {\n return true;\n };\n // Renders the HTML for a single event segment's default rendering\n TimeGridEventRenderer.prototype.renderSegHtml = function (seg, mirrorInfo) {\n var eventRange = seg.eventRange;\n var eventDef = eventRange.def;\n var eventUi = eventRange.ui;\n var allDay = eventDef.allDay;\n var isDraggable = computeEventDraggable(this.context, eventDef, eventUi);\n var isResizableFromStart = seg.isStart && computeEventStartResizable(this.context, eventDef, eventUi);\n var isResizableFromEnd = seg.isEnd && computeEventEndResizable(this.context, eventDef, eventUi);\n var classes = this.getSegClasses(seg, isDraggable, isResizableFromStart || isResizableFromEnd, mirrorInfo);\n var skinCss = cssToStr(this.getSkinCss(eventUi));\n var timeText;\n var fullTimeText; // more verbose time text. for the print stylesheet\n var startTimeText; // just the start time text\n classes.unshift('fc-time-grid-event');\n // if the event appears to span more than one day...\n if (isMultiDayRange(eventRange.range)) {\n // Don't display time text on segments that run entirely through a day.\n // That would appear as midnight-midnight and would look dumb.\n // Otherwise, display the time text for the *segment's* times (like 6pm-midnight or midnight-10am)\n if (seg.isStart || seg.isEnd) {\n var unzonedStart = seg.start;\n var unzonedEnd = seg.end;\n timeText = this._getTimeText(unzonedStart, unzonedEnd, allDay); // TODO: give the timezones\n fullTimeText = this._getTimeText(unzonedStart, unzonedEnd, allDay, this.fullTimeFormat);\n startTimeText = this._getTimeText(unzonedStart, unzonedEnd, allDay, null, false); // displayEnd=false\n }\n }\n else {\n // Display the normal time text for the *event's* times\n timeText = this.getTimeText(eventRange);\n fullTimeText = this.getTimeText(eventRange, this.fullTimeFormat);\n startTimeText = this.getTimeText(eventRange, null, false); // displayEnd=false\n }\n return '' +\n '
' +\n /* TODO: write CSS for this\n (isResizableFromStart ?\n '' :\n ''\n ) +\n */\n (isResizableFromEnd ?\n '' :\n '') +\n '';\n };\n // Given an array of segments that are all in the same column, sets the backwardCoord and forwardCoord on each.\n // Assumed the segs are already ordered.\n // NOTE: Also reorders the given array by date!\n TimeGridEventRenderer.prototype.computeSegHorizontals = function (segs) {\n var levels;\n var level0;\n var i;\n levels = buildSlotSegLevels(segs);\n computeForwardSlotSegs(levels);\n if ((level0 = levels[0])) {\n for (i = 0; i < level0.length; i++) {\n computeSlotSegPressures(level0[i]);\n }\n for (i = 0; i < level0.length; i++) {\n this.computeSegForwardBack(level0[i], 0, 0);\n }\n }\n };\n // Calculate seg.forwardCoord and seg.backwardCoord for the segment, where both values range\n // from 0 to 1. If the calendar is left-to-right, the seg.backwardCoord maps to \"left\" and\n // seg.forwardCoord maps to \"right\" (via percentage). Vice-versa if the calendar is right-to-left.\n //\n // The segment might be part of a \"series\", which means consecutive segments with the same pressure\n // who's width is unknown until an edge has been hit. `seriesBackwardPressure` is the number of\n // segments behind this one in the current series, and `seriesBackwardCoord` is the starting\n // coordinate of the first segment in the series.\n TimeGridEventRenderer.prototype.computeSegForwardBack = function (seg, seriesBackwardPressure, seriesBackwardCoord) {\n var forwardSegs = seg.forwardSegs;\n var i;\n if (seg.forwardCoord === undefined) { // not already computed\n if (!forwardSegs.length) {\n // if there are no forward segments, this segment should butt up against the edge\n seg.forwardCoord = 1;\n }\n else {\n // sort highest pressure first\n this.sortForwardSegs(forwardSegs);\n // this segment's forwardCoord will be calculated from the backwardCoord of the\n // highest-pressure forward segment.\n this.computeSegForwardBack(forwardSegs[0], seriesBackwardPressure + 1, seriesBackwardCoord);\n seg.forwardCoord = forwardSegs[0].backwardCoord;\n }\n // calculate the backwardCoord from the forwardCoord. consider the series\n seg.backwardCoord = seg.forwardCoord -\n (seg.forwardCoord - seriesBackwardCoord) / // available width for series\n (seriesBackwardPressure + 1); // # of segments in the series\n // use this segment's coordinates to computed the coordinates of the less-pressurized\n // forward segments\n for (i = 0; i < forwardSegs.length; i++) {\n this.computeSegForwardBack(forwardSegs[i], 0, seg.forwardCoord);\n }\n }\n };\n TimeGridEventRenderer.prototype.sortForwardSegs = function (forwardSegs) {\n var objs = forwardSegs.map(buildTimeGridSegCompareObj);\n var specs = [\n // put higher-pressure first\n { field: 'forwardPressure', order: -1 },\n // put segments that are closer to initial edge first (and favor ones with no coords yet)\n { field: 'backwardCoord', order: 1 }\n ].concat(this.context.eventOrderSpecs);\n objs.sort(function (obj0, obj1) {\n return compareByFieldSpecs(obj0, obj1, specs);\n });\n return objs.map(function (c) {\n return c._seg;\n });\n };\n // Given foreground event segments that have already had their position coordinates computed,\n // assigns position-related CSS values to their elements.\n TimeGridEventRenderer.prototype.assignSegCss = function (segs) {\n for (var _i = 0, segs_1 = segs; _i < segs_1.length; _i++) {\n var seg = segs_1[_i];\n applyStyle(seg.el, this.generateSegCss(seg));\n if (seg.level > 0) {\n seg.el.classList.add('fc-time-grid-event-inset');\n }\n // if the event is short that the title will be cut off,\n // attach a className that condenses the title into the time area.\n if (seg.eventRange.def.title && seg.bottom - seg.top < 30) {\n seg.el.classList.add('fc-short'); // TODO: \"condensed\" is a better name\n }\n }\n };\n // Generates an object with CSS properties/values that should be applied to an event segment element.\n // Contains important positioning-related properties that should be applied to any event element, customized or not.\n TimeGridEventRenderer.prototype.generateSegCss = function (seg) {\n var shouldOverlap = this.context.options.slotEventOverlap;\n var backwardCoord = seg.backwardCoord; // the left side if LTR. the right side if RTL. floating-point\n var forwardCoord = seg.forwardCoord; // the right side if LTR. the left side if RTL. floating-point\n var props = this.timeGrid.generateSegVerticalCss(seg); // get top/bottom first\n var isRtl = this.context.isRtl;\n var left; // amount of space from left edge, a fraction of the total width\n var right; // amount of space from right edge, a fraction of the total width\n if (shouldOverlap) {\n // double the width, but don't go beyond the maximum forward coordinate (1.0)\n forwardCoord = Math.min(1, backwardCoord + (forwardCoord - backwardCoord) * 2);\n }\n if (isRtl) {\n left = 1 - forwardCoord;\n right = backwardCoord;\n }\n else {\n left = backwardCoord;\n right = 1 - forwardCoord;\n }\n props.zIndex = seg.level + 1; // convert from 0-base to 1-based\n props.left = left * 100 + '%';\n props.right = right * 100 + '%';\n if (shouldOverlap && seg.forwardPressure) {\n // add padding to the edge so that forward stacked events don't cover the resizer's icon\n props[isRtl ? 'marginLeft' : 'marginRight'] = 10 * 2; // 10 is a guesstimate of the icon's width\n }\n return props;\n };\n return TimeGridEventRenderer;\n}(FgEventRenderer));\n// Builds an array of segments \"levels\". The first level will be the leftmost tier of segments if the calendar is\n// left-to-right, or the rightmost if the calendar is right-to-left. Assumes the segments are already ordered by date.\nfunction buildSlotSegLevels(segs) {\n var levels = [];\n var i;\n var seg;\n var j;\n for (i = 0; i < segs.length; i++) {\n seg = segs[i];\n // go through all the levels and stop on the first level where there are no collisions\n for (j = 0; j < levels.length; j++) {\n if (!computeSlotSegCollisions(seg, levels[j]).length) {\n break;\n }\n }\n seg.level = j;\n (levels[j] || (levels[j] = [])).push(seg);\n }\n return levels;\n}\n// For every segment, figure out the other segments that are in subsequent\n// levels that also occupy the same vertical space. Accumulate in seg.forwardSegs\nfunction computeForwardSlotSegs(levels) {\n var i;\n var level;\n var j;\n var seg;\n var k;\n for (i = 0; i < levels.length; i++) {\n level = levels[i];\n for (j = 0; j < level.length; j++) {\n seg = level[j];\n seg.forwardSegs = [];\n for (k = i + 1; k < levels.length; k++) {\n computeSlotSegCollisions(seg, levels[k], seg.forwardSegs);\n }\n }\n }\n}\n// Figure out which path forward (via seg.forwardSegs) results in the longest path until\n// the furthest edge is reached. The number of segments in this path will be seg.forwardPressure\nfunction computeSlotSegPressures(seg) {\n var forwardSegs = seg.forwardSegs;\n var forwardPressure = 0;\n var i;\n var forwardSeg;\n if (seg.forwardPressure === undefined) { // not already computed\n for (i = 0; i < forwardSegs.length; i++) {\n forwardSeg = forwardSegs[i];\n // figure out the child's maximum forward path\n computeSlotSegPressures(forwardSeg);\n // either use the existing maximum, or use the child's forward pressure\n // plus one (for the forwardSeg itself)\n forwardPressure = Math.max(forwardPressure, 1 + forwardSeg.forwardPressure);\n }\n seg.forwardPressure = forwardPressure;\n }\n}\n// Find all the segments in `otherSegs` that vertically collide with `seg`.\n// Append into an optionally-supplied `results` array and return.\nfunction computeSlotSegCollisions(seg, otherSegs, results) {\n if (results === void 0) { results = []; }\n for (var i = 0; i < otherSegs.length; i++) {\n if (isSlotSegCollision(seg, otherSegs[i])) {\n results.push(otherSegs[i]);\n }\n }\n return results;\n}\n// Do these segments occupy the same vertical space?\nfunction isSlotSegCollision(seg1, seg2) {\n return seg1.bottom > seg2.top && seg1.top < seg2.bottom;\n}\nfunction buildTimeGridSegCompareObj(seg) {\n var obj = buildSegCompareObj(seg);\n obj.forwardPressure = seg.forwardPressure;\n obj.backwardCoord = seg.backwardCoord;\n return obj;\n}\n\nvar TimeGridMirrorRenderer = /** @class */ (function (_super) {\n __extends(TimeGridMirrorRenderer, _super);\n function TimeGridMirrorRenderer() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n TimeGridMirrorRenderer.prototype.attachSegs = function (segs, mirrorInfo) {\n this.segsByCol = this.timeGrid.groupSegsByCol(segs);\n this.timeGrid.attachSegsByCol(this.segsByCol, this.timeGrid.mirrorContainerEls);\n this.sourceSeg = mirrorInfo.sourceSeg;\n };\n TimeGridMirrorRenderer.prototype.generateSegCss = function (seg) {\n var props = _super.prototype.generateSegCss.call(this, seg);\n var sourceSeg = this.sourceSeg;\n if (sourceSeg && sourceSeg.col === seg.col) {\n var sourceSegProps = _super.prototype.generateSegCss.call(this, sourceSeg);\n props.left = sourceSegProps.left;\n props.right = sourceSegProps.right;\n props.marginLeft = sourceSegProps.marginLeft;\n props.marginRight = sourceSegProps.marginRight;\n }\n return props;\n };\n return TimeGridMirrorRenderer;\n}(TimeGridEventRenderer));\n\nvar TimeGridFillRenderer = /** @class */ (function (_super) {\n __extends(TimeGridFillRenderer, _super);\n function TimeGridFillRenderer(timeGrid) {\n var _this = _super.call(this) || this;\n _this.timeGrid = timeGrid;\n return _this;\n }\n TimeGridFillRenderer.prototype.attachSegs = function (type, segs) {\n var timeGrid = this.timeGrid;\n var containerEls;\n // TODO: more efficient lookup\n if (type === 'bgEvent') {\n containerEls = timeGrid.bgContainerEls;\n }\n else if (type === 'businessHours') {\n containerEls = timeGrid.businessContainerEls;\n }\n else if (type === 'highlight') {\n containerEls = timeGrid.highlightContainerEls;\n }\n timeGrid.attachSegsByCol(timeGrid.groupSegsByCol(segs), containerEls);\n return segs.map(function (seg) {\n return seg.el;\n });\n };\n TimeGridFillRenderer.prototype.computeSegSizes = function (segs) {\n this.timeGrid.computeSegVerticals(segs);\n };\n TimeGridFillRenderer.prototype.assignSegSizes = function (segs) {\n this.timeGrid.assignSegVerticals(segs);\n };\n return TimeGridFillRenderer;\n}(FillRenderer));\n\n/* A component that renders one or more columns of vertical time slots\n----------------------------------------------------------------------------------------------------------------------*/\n// potential nice values for the slot-duration and interval-duration\n// from largest to smallest\nvar AGENDA_STOCK_SUB_DURATIONS = [\n { hours: 1 },\n { minutes: 30 },\n { minutes: 15 },\n { seconds: 30 },\n { seconds: 15 }\n];\nvar TimeGrid = /** @class */ (function (_super) {\n __extends(TimeGrid, _super);\n function TimeGrid(el, renderProps) {\n var _this = _super.call(this, el) || this;\n _this.isSlatSizesDirty = false;\n _this.isColSizesDirty = false;\n _this.processOptions = memoize(_this._processOptions);\n _this.renderSkeleton = memoizeRendering(_this._renderSkeleton);\n _this.renderSlats = memoizeRendering(_this._renderSlats, null, [_this.renderSkeleton]);\n _this.renderColumns = memoizeRendering(_this._renderColumns, _this._unrenderColumns, [_this.renderSkeleton]);\n _this.renderProps = renderProps;\n var renderColumns = _this.renderColumns;\n var eventRenderer = _this.eventRenderer = new TimeGridEventRenderer(_this);\n var fillRenderer = _this.fillRenderer = new TimeGridFillRenderer(_this);\n _this.mirrorRenderer = new TimeGridMirrorRenderer(_this);\n _this.renderBusinessHours = memoizeRendering(fillRenderer.renderSegs.bind(fillRenderer, 'businessHours'), fillRenderer.unrender.bind(fillRenderer, 'businessHours'), [renderColumns]);\n _this.renderDateSelection = memoizeRendering(_this._renderDateSelection, _this._unrenderDateSelection, [renderColumns]);\n _this.renderFgEvents = memoizeRendering(eventRenderer.renderSegs.bind(eventRenderer), eventRenderer.unrender.bind(eventRenderer), [renderColumns]);\n _this.renderBgEvents = memoizeRendering(fillRenderer.renderSegs.bind(fillRenderer, 'bgEvent'), fillRenderer.unrender.bind(fillRenderer, 'bgEvent'), [renderColumns]);\n _this.renderEventSelection = memoizeRendering(eventRenderer.selectByInstanceId.bind(eventRenderer), eventRenderer.unselectByInstanceId.bind(eventRenderer), [_this.renderFgEvents]);\n _this.renderEventDrag = memoizeRendering(_this._renderEventDrag, _this._unrenderEventDrag, [renderColumns]);\n _this.renderEventResize = memoizeRendering(_this._renderEventResize, _this._unrenderEventResize, [renderColumns]);\n return _this;\n }\n /* Options\n ------------------------------------------------------------------------------------------------------------------*/\n // Parses various options into properties of this object\n // MUST have context already set\n TimeGrid.prototype._processOptions = function (options) {\n var slotDuration = options.slotDuration, snapDuration = options.snapDuration;\n var snapsPerSlot;\n var input;\n slotDuration = createDuration(slotDuration);\n snapDuration = snapDuration ? createDuration(snapDuration) : slotDuration;\n snapsPerSlot = wholeDivideDurations(slotDuration, snapDuration);\n if (snapsPerSlot === null) {\n snapDuration = slotDuration;\n snapsPerSlot = 1;\n // TODO: say warning?\n }\n this.slotDuration = slotDuration;\n this.snapDuration = snapDuration;\n this.snapsPerSlot = snapsPerSlot;\n // might be an array value (for TimelineView).\n // if so, getting the most granular entry (the last one probably).\n input = options.slotLabelFormat;\n if (Array.isArray(input)) {\n input = input[input.length - 1];\n }\n this.labelFormat = createFormatter(input || {\n hour: 'numeric',\n minute: '2-digit',\n omitZeroMinute: true,\n meridiem: 'short'\n });\n input = options.slotLabelInterval;\n this.labelInterval = input ?\n createDuration(input) :\n this.computeLabelInterval(slotDuration);\n };\n // Computes an automatic value for slotLabelInterval\n TimeGrid.prototype.computeLabelInterval = function (slotDuration) {\n var i;\n var labelInterval;\n var slotsPerLabel;\n // find the smallest stock label interval that results in more than one slots-per-label\n for (i = AGENDA_STOCK_SUB_DURATIONS.length - 1; i >= 0; i--) {\n labelInterval = createDuration(AGENDA_STOCK_SUB_DURATIONS[i]);\n slotsPerLabel = wholeDivideDurations(labelInterval, slotDuration);\n if (slotsPerLabel !== null && slotsPerLabel > 1) {\n return labelInterval;\n }\n }\n return slotDuration; // fall back\n };\n /* Rendering\n ------------------------------------------------------------------------------------------------------------------*/\n TimeGrid.prototype.render = function (props, context) {\n this.processOptions(context.options);\n var cells = props.cells;\n this.colCnt = cells.length;\n this.renderSkeleton(context.theme);\n this.renderSlats(props.dateProfile);\n this.renderColumns(props.cells, props.dateProfile);\n this.renderBusinessHours(context, props.businessHourSegs);\n this.renderDateSelection(props.dateSelectionSegs);\n this.renderFgEvents(context, props.fgEventSegs);\n this.renderBgEvents(context, props.bgEventSegs);\n this.renderEventSelection(props.eventSelection);\n this.renderEventDrag(props.eventDrag);\n this.renderEventResize(props.eventResize);\n };\n TimeGrid.prototype.destroy = function () {\n _super.prototype.destroy.call(this);\n // should unrender everything else too\n this.renderSlats.unrender();\n this.renderColumns.unrender();\n this.renderSkeleton.unrender();\n };\n TimeGrid.prototype.updateSize = function (isResize) {\n var _a = this, fillRenderer = _a.fillRenderer, eventRenderer = _a.eventRenderer, mirrorRenderer = _a.mirrorRenderer;\n if (isResize || this.isSlatSizesDirty) {\n this.buildSlatPositions();\n this.isSlatSizesDirty = false;\n }\n if (isResize || this.isColSizesDirty) {\n this.buildColPositions();\n this.isColSizesDirty = false;\n }\n fillRenderer.computeSizes(isResize);\n eventRenderer.computeSizes(isResize);\n mirrorRenderer.computeSizes(isResize);\n fillRenderer.assignSizes(isResize);\n eventRenderer.assignSizes(isResize);\n mirrorRenderer.assignSizes(isResize);\n };\n TimeGrid.prototype._renderSkeleton = function (theme) {\n var el = this.el;\n el.innerHTML =\n '' +\n '' +\n '';\n this.rootBgContainerEl = el.querySelector('.fc-bg');\n this.slatContainerEl = el.querySelector('.fc-slats');\n this.bottomRuleEl = el.querySelector('.fc-divider');\n };\n TimeGrid.prototype._renderSlats = function (dateProfile) {\n var theme = this.context.theme;\n this.slatContainerEl.innerHTML =\n '
' +\n this.renderSlatRowHtml(dateProfile) +\n '
';\n this.slatEls = findElements(this.slatContainerEl, 'tr');\n this.slatPositions = new PositionCache(this.el, this.slatEls, false, true // vertical\n );\n this.isSlatSizesDirty = true;\n };\n // Generates the HTML for the horizontal \"slats\" that run width-wise. Has a time axis on a side. Depends on RTL.\n TimeGrid.prototype.renderSlatRowHtml = function (dateProfile) {\n var _a = this.context, dateEnv = _a.dateEnv, theme = _a.theme, isRtl = _a.isRtl;\n var html = '';\n var dayStart = startOfDay(dateProfile.renderRange.start);\n var slotTime = dateProfile.minTime;\n var slotIterator = createDuration(0);\n var slotDate; // will be on the view's first day, but we only care about its time\n var isLabeled;\n var axisHtml;\n // Calculate the time for each slot\n while (asRoughMs(slotTime) < asRoughMs(dateProfile.maxTime)) {\n slotDate = dateEnv.add(dayStart, slotTime);\n isLabeled = wholeDivideDurations(slotIterator, this.labelInterval) !== null;\n axisHtml =\n '
';\n this.colEls = findElements(this.el, '.fc-day, .fc-disabled-day');\n for (var col = 0; col < this.colCnt; col++) {\n calendar.publiclyTrigger('dayRender', [\n {\n date: dateEnv.toDate(cells[col].date),\n el: this.colEls[col],\n view: view\n }\n ]);\n }\n if (isRtl) {\n this.colEls.reverse();\n }\n this.colPositions = new PositionCache(this.el, this.colEls, true, // horizontal\n false);\n this.renderContentSkeleton();\n this.isColSizesDirty = true;\n };\n TimeGrid.prototype._unrenderColumns = function () {\n this.unrenderContentSkeleton();\n };\n /* Content Skeleton\n ------------------------------------------------------------------------------------------------------------------*/\n // Renders the DOM that the view's content will live in\n TimeGrid.prototype.renderContentSkeleton = function () {\n var isRtl = this.context.isRtl;\n var parts = [];\n var skeletonEl;\n parts.push(this.renderProps.renderIntroHtml());\n for (var i = 0; i < this.colCnt; i++) {\n parts.push('
');\n this.colContainerEls = findElements(skeletonEl, '.fc-content-col');\n this.mirrorContainerEls = findElements(skeletonEl, '.fc-mirror-container');\n this.fgContainerEls = findElements(skeletonEl, '.fc-event-container:not(.fc-mirror-container)');\n this.bgContainerEls = findElements(skeletonEl, '.fc-bgevent-container');\n this.highlightContainerEls = findElements(skeletonEl, '.fc-highlight-container');\n this.businessContainerEls = findElements(skeletonEl, '.fc-business-container');\n if (isRtl) {\n this.colContainerEls.reverse();\n this.mirrorContainerEls.reverse();\n this.fgContainerEls.reverse();\n this.bgContainerEls.reverse();\n this.highlightContainerEls.reverse();\n this.businessContainerEls.reverse();\n }\n this.el.appendChild(skeletonEl);\n };\n TimeGrid.prototype.unrenderContentSkeleton = function () {\n removeElement(this.contentSkeletonEl);\n };\n // Given a flat array of segments, return an array of sub-arrays, grouped by each segment's col\n TimeGrid.prototype.groupSegsByCol = function (segs) {\n var segsByCol = [];\n var i;\n for (i = 0; i < this.colCnt; i++) {\n segsByCol.push([]);\n }\n for (i = 0; i < segs.length; i++) {\n segsByCol[segs[i].col].push(segs[i]);\n }\n return segsByCol;\n };\n // Given segments grouped by column, insert the segments' elements into a parallel array of container\n // elements, each living within a column.\n TimeGrid.prototype.attachSegsByCol = function (segsByCol, containerEls) {\n var col;\n var segs;\n var i;\n for (col = 0; col < this.colCnt; col++) { // iterate each column grouping\n segs = segsByCol[col];\n for (i = 0; i < segs.length; i++) {\n containerEls[col].appendChild(segs[i].el);\n }\n }\n };\n /* Now Indicator\n ------------------------------------------------------------------------------------------------------------------*/\n TimeGrid.prototype.getNowIndicatorUnit = function () {\n return 'minute'; // will refresh on the minute\n };\n TimeGrid.prototype.renderNowIndicator = function (segs, date) {\n // HACK: if date columns not ready for some reason (scheduler)\n if (!this.colContainerEls) {\n return;\n }\n var top = this.computeDateTop(date);\n var nodes = [];\n var i;\n // render lines within the columns\n for (i = 0; i < segs.length; i++) {\n var lineEl = createElement('div', { className: 'fc-now-indicator fc-now-indicator-line' });\n lineEl.style.top = top + 'px';\n this.colContainerEls[segs[i].col].appendChild(lineEl);\n nodes.push(lineEl);\n }\n // render an arrow over the axis\n if (segs.length > 0) { // is the current time in view?\n var arrowEl = createElement('div', { className: 'fc-now-indicator fc-now-indicator-arrow' });\n arrowEl.style.top = top + 'px';\n this.contentSkeletonEl.appendChild(arrowEl);\n nodes.push(arrowEl);\n }\n this.nowIndicatorEls = nodes;\n };\n TimeGrid.prototype.unrenderNowIndicator = function () {\n if (this.nowIndicatorEls) {\n this.nowIndicatorEls.forEach(removeElement);\n this.nowIndicatorEls = null;\n }\n };\n /* Coordinates\n ------------------------------------------------------------------------------------------------------------------*/\n TimeGrid.prototype.getTotalSlatHeight = function () {\n return this.slatContainerEl.getBoundingClientRect().height;\n };\n // Computes the top coordinate, relative to the bounds of the grid, of the given date.\n // A `startOfDayDate` must be given for avoiding ambiguity over how to treat midnight.\n TimeGrid.prototype.computeDateTop = function (when, startOfDayDate) {\n if (!startOfDayDate) {\n startOfDayDate = startOfDay(when);\n }\n return this.computeTimeTop(createDuration(when.valueOf() - startOfDayDate.valueOf()));\n };\n // Computes the top coordinate, relative to the bounds of the grid, of the given time (a Duration).\n TimeGrid.prototype.computeTimeTop = function (duration) {\n var len = this.slatEls.length;\n var dateProfile = this.props.dateProfile;\n var slatCoverage = (duration.milliseconds - asRoughMs(dateProfile.minTime)) / asRoughMs(this.slotDuration); // floating-point value of # of slots covered\n var slatIndex;\n var slatRemainder;\n // compute a floating-point number for how many slats should be progressed through.\n // from 0 to number of slats (inclusive)\n // constrained because minTime/maxTime might be customized.\n slatCoverage = Math.max(0, slatCoverage);\n slatCoverage = Math.min(len, slatCoverage);\n // an integer index of the furthest whole slat\n // from 0 to number slats (*exclusive*, so len-1)\n slatIndex = Math.floor(slatCoverage);\n slatIndex = Math.min(slatIndex, len - 1);\n // how much further through the slatIndex slat (from 0.0-1.0) must be covered in addition.\n // could be 1.0 if slatCoverage is covering *all* the slots\n slatRemainder = slatCoverage - slatIndex;\n return this.slatPositions.tops[slatIndex] +\n this.slatPositions.getHeight(slatIndex) * slatRemainder;\n };\n // For each segment in an array, computes and assigns its top and bottom properties\n TimeGrid.prototype.computeSegVerticals = function (segs) {\n var options = this.context.options;\n var eventMinHeight = options.timeGridEventMinHeight;\n var i;\n var seg;\n var dayDate;\n for (i = 0; i < segs.length; i++) {\n seg = segs[i];\n dayDate = this.props.cells[seg.col].date;\n seg.top = this.computeDateTop(seg.start, dayDate);\n seg.bottom = Math.max(seg.top + eventMinHeight, this.computeDateTop(seg.end, dayDate));\n }\n };\n // Given segments that already have their top/bottom properties computed, applies those values to\n // the segments' elements.\n TimeGrid.prototype.assignSegVerticals = function (segs) {\n var i;\n var seg;\n for (i = 0; i < segs.length; i++) {\n seg = segs[i];\n applyStyle(seg.el, this.generateSegVerticalCss(seg));\n }\n };\n // Generates an object with CSS properties for the top/bottom coordinates of a segment element\n TimeGrid.prototype.generateSegVerticalCss = function (seg) {\n return {\n top: seg.top,\n bottom: -seg.bottom // flipped because needs to be space beyond bottom edge of event container\n };\n };\n /* Sizing\n ------------------------------------------------------------------------------------------------------------------*/\n TimeGrid.prototype.buildPositionCaches = function () {\n this.buildColPositions();\n this.buildSlatPositions();\n };\n TimeGrid.prototype.buildColPositions = function () {\n this.colPositions.build();\n };\n TimeGrid.prototype.buildSlatPositions = function () {\n this.slatPositions.build();\n };\n /* Hit System\n ------------------------------------------------------------------------------------------------------------------*/\n TimeGrid.prototype.positionToHit = function (positionLeft, positionTop) {\n var dateEnv = this.context.dateEnv;\n var _a = this, snapsPerSlot = _a.snapsPerSlot, slatPositions = _a.slatPositions, colPositions = _a.colPositions;\n var colIndex = colPositions.leftToIndex(positionLeft);\n var slatIndex = slatPositions.topToIndex(positionTop);\n if (colIndex != null && slatIndex != null) {\n var slatTop = slatPositions.tops[slatIndex];\n var slatHeight = slatPositions.getHeight(slatIndex);\n var partial = (positionTop - slatTop) / slatHeight; // floating point number between 0 and 1\n var localSnapIndex = Math.floor(partial * snapsPerSlot); // the snap # relative to start of slat\n var snapIndex = slatIndex * snapsPerSlot + localSnapIndex;\n var dayDate = this.props.cells[colIndex].date;\n var time = addDurations(this.props.dateProfile.minTime, multiplyDuration(this.snapDuration, snapIndex));\n var start = dateEnv.add(dayDate, time);\n var end = dateEnv.add(start, this.snapDuration);\n return {\n col: colIndex,\n dateSpan: {\n range: { start: start, end: end },\n allDay: false\n },\n dayEl: this.colEls[colIndex],\n relativeRect: {\n left: colPositions.lefts[colIndex],\n right: colPositions.rights[colIndex],\n top: slatTop,\n bottom: slatTop + slatHeight\n }\n };\n }\n };\n /* Event Drag Visualization\n ------------------------------------------------------------------------------------------------------------------*/\n TimeGrid.prototype._renderEventDrag = function (state) {\n if (state) {\n this.eventRenderer.hideByHash(state.affectedInstances);\n if (state.isEvent) {\n this.mirrorRenderer.renderSegs(this.context, state.segs, { isDragging: true, sourceSeg: state.sourceSeg });\n }\n else {\n this.fillRenderer.renderSegs('highlight', this.context, state.segs);\n }\n }\n };\n TimeGrid.prototype._unrenderEventDrag = function (state) {\n if (state) {\n this.eventRenderer.showByHash(state.affectedInstances);\n if (state.isEvent) {\n this.mirrorRenderer.unrender(this.context, state.segs, { isDragging: true, sourceSeg: state.sourceSeg });\n }\n else {\n this.fillRenderer.unrender('highlight', this.context);\n }\n }\n };\n /* Event Resize Visualization\n ------------------------------------------------------------------------------------------------------------------*/\n TimeGrid.prototype._renderEventResize = function (state) {\n if (state) {\n this.eventRenderer.hideByHash(state.affectedInstances);\n this.mirrorRenderer.renderSegs(this.context, state.segs, { isResizing: true, sourceSeg: state.sourceSeg });\n }\n };\n TimeGrid.prototype._unrenderEventResize = function (state) {\n if (state) {\n this.eventRenderer.showByHash(state.affectedInstances);\n this.mirrorRenderer.unrender(this.context, state.segs, { isResizing: true, sourceSeg: state.sourceSeg });\n }\n };\n /* Selection\n ------------------------------------------------------------------------------------------------------------------*/\n // Renders a visual indication of a selection. Overrides the default, which was to simply render a highlight.\n TimeGrid.prototype._renderDateSelection = function (segs) {\n if (segs) {\n if (this.context.options.selectMirror) {\n this.mirrorRenderer.renderSegs(this.context, segs, { isSelecting: true });\n }\n else {\n this.fillRenderer.renderSegs('highlight', this.context, segs);\n }\n }\n };\n TimeGrid.prototype._unrenderDateSelection = function (segs) {\n if (segs) {\n if (this.context.options.selectMirror) {\n this.mirrorRenderer.unrender(this.context, segs, { isSelecting: true });\n }\n else {\n this.fillRenderer.unrender('highlight', this.context);\n }\n }\n };\n return TimeGrid;\n}(DateComponent));\n\nvar AllDaySplitter = /** @class */ (function (_super) {\n __extends(AllDaySplitter, _super);\n function AllDaySplitter() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n AllDaySplitter.prototype.getKeyInfo = function () {\n return {\n allDay: {},\n timed: {}\n };\n };\n AllDaySplitter.prototype.getKeysForDateSpan = function (dateSpan) {\n if (dateSpan.allDay) {\n return ['allDay'];\n }\n else {\n return ['timed'];\n }\n };\n AllDaySplitter.prototype.getKeysForEventDef = function (eventDef) {\n if (!eventDef.allDay) {\n return ['timed'];\n }\n else if (hasBgRendering(eventDef)) {\n return ['timed', 'allDay'];\n }\n else {\n return ['allDay'];\n }\n };\n return AllDaySplitter;\n}(Splitter));\n\nvar TIMEGRID_ALL_DAY_EVENT_LIMIT = 5;\nvar WEEK_HEADER_FORMAT = createFormatter({ week: 'short' });\n/* An abstract class for all timegrid-related views. Displays one more columns with time slots running vertically.\n----------------------------------------------------------------------------------------------------------------------*/\n// Is a manager for the TimeGrid subcomponent and possibly the DayGrid subcomponent (if allDaySlot is on).\n// Responsible for managing width/height.\nvar AbstractTimeGridView = /** @class */ (function (_super) {\n __extends(AbstractTimeGridView, _super);\n function AbstractTimeGridView() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.splitter = new AllDaySplitter();\n _this.renderSkeleton = memoizeRendering(_this._renderSkeleton, _this._unrenderSkeleton);\n /* Header Render Methods\n ------------------------------------------------------------------------------------------------------------------*/\n // Generates the HTML that will go before the day-of week header cells\n _this.renderHeadIntroHtml = function () {\n var _a = _this.context, theme = _a.theme, dateEnv = _a.dateEnv, options = _a.options;\n var range = _this.props.dateProfile.renderRange;\n var dayCnt = diffDays(range.start, range.end);\n var weekText;\n if (options.weekNumbers) {\n weekText = dateEnv.format(range.start, WEEK_HEADER_FORMAT);\n return '' +\n '
' +\n buildGotoAnchorHtml(// aside from link, important for matchCellWidths\n options, dateEnv, { date: range.start, type: 'week', forceOff: dayCnt > 1 }, htmlEscape(weekText) // inner HTML\n ) +\n '
';\n }\n else {\n return '
';\n }\n };\n /* Time Grid Render Methods\n ------------------------------------------------------------------------------------------------------------------*/\n // Generates the HTML that goes before the bg of the TimeGrid slot area. Long vertical column.\n _this.renderTimeGridBgIntroHtml = function () {\n var theme = _this.context.theme;\n return '
';\n };\n // Generates the HTML that goes before all other types of cells.\n // Affects content-skeleton, mirror-skeleton, highlight-skeleton for both the time-grid and day-grid.\n _this.renderTimeGridIntroHtml = function () {\n return '
';\n };\n /* Day Grid Render Methods\n ------------------------------------------------------------------------------------------------------------------*/\n // Generates the HTML that goes before the all-day cells\n _this.renderDayGridBgIntroHtml = function () {\n var _a = _this.context, theme = _a.theme, options = _a.options;\n return '' +\n '
';\n };\n // Generates the HTML that goes before all other types of cells.\n // Affects content-skeleton, mirror-skeleton, highlight-skeleton for both the time-grid and day-grid.\n _this.renderDayGridIntroHtml = function () {\n return '
';\n };\n return _this;\n }\n AbstractTimeGridView.prototype.render = function (props, context) {\n _super.prototype.render.call(this, props, context);\n this.renderSkeleton(context);\n };\n AbstractTimeGridView.prototype.destroy = function () {\n _super.prototype.destroy.call(this);\n this.renderSkeleton.unrender();\n };\n AbstractTimeGridView.prototype._renderSkeleton = function (context) {\n this.el.classList.add('fc-timeGrid-view');\n this.el.innerHTML = this.renderSkeletonHtml();\n this.scroller = new ScrollComponent('hidden', // overflow x\n 'auto' // overflow y\n );\n var timeGridWrapEl = this.scroller.el;\n this.el.querySelector('.fc-body > tr > td').appendChild(timeGridWrapEl);\n timeGridWrapEl.classList.add('fc-time-grid-container');\n var timeGridEl = createElement('div', { className: 'fc-time-grid' });\n timeGridWrapEl.appendChild(timeGridEl);\n this.timeGrid = new TimeGrid(timeGridEl, {\n renderBgIntroHtml: this.renderTimeGridBgIntroHtml,\n renderIntroHtml: this.renderTimeGridIntroHtml\n });\n if (context.options.allDaySlot) { // should we display the \"all-day\" area?\n this.dayGrid = new DayGrid(// the all-day subcomponent of this view\n this.el.querySelector('.fc-day-grid'), {\n renderNumberIntroHtml: this.renderDayGridIntroHtml,\n renderBgIntroHtml: this.renderDayGridBgIntroHtml,\n renderIntroHtml: this.renderDayGridIntroHtml,\n colWeekNumbersVisible: false,\n cellWeekNumbersVisible: false\n });\n // have the day-grid extend it's coordinate area over the dividing the two grids\n var dividerEl = this.el.querySelector('.fc-divider');\n this.dayGrid.bottomCoordPadding = dividerEl.getBoundingClientRect().height;\n }\n };\n AbstractTimeGridView.prototype._unrenderSkeleton = function () {\n this.el.classList.remove('fc-timeGrid-view');\n this.timeGrid.destroy();\n if (this.dayGrid) {\n this.dayGrid.destroy();\n }\n this.scroller.destroy();\n };\n /* Rendering\n ------------------------------------------------------------------------------------------------------------------*/\n // Builds the HTML skeleton for the view.\n // The day-grid and time-grid components will render inside containers defined by this HTML.\n AbstractTimeGridView.prototype.renderSkeletonHtml = function () {\n var _a = this.context, theme = _a.theme, options = _a.options;\n return '' +\n '