diff --git a/dist/fullcalendar.css b/dist/fullcalendar.css index a31ce83..4a65f08 100644 --- a/dist/fullcalendar.css +++ b/dist/fullcalendar.css @@ -1,7 +1,7 @@ /*! * FullCalendar v2.0.2 Stylesheet * Docs & License: http://arshaw.com/fullcalendar/ - * (c) 2013 Adam Shaw + * (c) 2014 Adam Shaw, Sean Kenny */ diff --git a/dist/fullcalendar.js b/dist/fullcalendar.js index 44acf51..951887d 100644 --- a/dist/fullcalendar.js +++ b/dist/fullcalendar.js @@ -1,7 +1,7 @@ /*! * FullCalendar v2.0.2 * Docs & License: http://arshaw.com/fullcalendar/ - * (c) 2013 Adam Shaw + * (c) 2014 Adam Shaw, Sean Kenny */ (function(factory) { @@ -549,6 +549,7 @@ function Calendar(element, instanceOptions) { EventManager.call(t, options); + ResourceManager.call(t, options); var isFetchNeeded = t.isFetchNeeded; var fetchEvents = t.fetchEvents; @@ -1766,6 +1767,14 @@ function EventManager(options) { // assumed to be a calendar else { out.className = []; } + + if (out.resources) { + if (typeof out.resources == 'string') { + out.resources = out.resources.split(/\s+/); + } + }else{ + out.resources = []; + } out.allDay = allDay; out.start = start; @@ -1964,6 +1973,141 @@ function backupEventDates(event) { event._end = event.end ? event.end.clone() : null; } +;; +function ResourceManager(options) { + var t = this; + // exports + t.fetchResources = fetchResources; + t.setResources = setResources; + + // locals + var resourceSources = []; + var cache; + // initialize the resources. + setResources(options.resources); + // add the resource sources + + function setResources(sources) { + resourceSources = []; + var resource; + if ($.isFunction(sources)) { + // is it a function? + resource = { + resources: sources + }; + resourceSources.push(resource); + cache = undefined; + } else if (typeof sources == 'string') { + // is it a URL string? + resource = { + url: sources + }; + resourceSources.push(resource); + cache = undefined; + } else if (typeof sources == 'object' && sources != null) { + // is it json object? + for (var i = 0; i < sources.length; i++) { + var s = sources[i]; + normalizeSource(s); + resource = { + resources: s + }; + resourceSources.push(resource); + } + cache = undefined; + } + } + /** + * ---------------------------------------------------------------- + * Fetch resources from source array + * ---------------------------------------------------------------- + */ + + function fetchResources(useCache, currentView) { + // if useCache is not defined, default to true + useCache = (typeof useCache !== 'undefined' ? useCache : true); + if (cache !== undefined && useCache) { + // get from cache + return cache; + } else { + // do a fetch resource from source, rebuild cache + cache = []; + var len = resourceSources.length; + for (var i = 0; i < len; i++) { + var resources = fetchResourceSource(resourceSources[i], currentView); + cache = cache.concat(resources); + } + return cache; + } + } + + /** + * ---------------------------------------------------------------- + * Fetch resources from each source. If source is a function, call + * the function and return the resource. If source is a URL, get + * the data via synchronized ajax call. If the source is an + * object, return it as is. + * ---------------------------------------------------------------- + */ + + function fetchResourceSource(source, currentView) { + var resources = source.resources; + if (resources) { + if ($.isFunction(resources)) { + return resources(); + } + } else { + var url = source.url; + if (url) { + var data = {}; + if (typeof currentView === 'object') { + var startParam = options.startParam; + var endParam = options.endParam; + if (startParam) { + data[startParam] = Math.round(+currentView.intervalStart / 1000); + } + if (endParam) { + data[endParam] = Math.round(+currentView.intervalEnd / 1000); + } + } + $.ajax($.extend({}, ajaxDefaults, source, { + data: data, + dataType: 'json', + cache: false, + success: function(res) { + res = res || []; + resources = res; + }, + error: function() { + // TODO - need to rewrite callbacks, etc. + //alert("ajax error getting json from " + url); + }, + async: false // too much work coordinating callbacks so dumb it down + })); + } + } + return resources; + } + /** + * ---------------------------------------------------------------- + * normalize the source object + * ---------------------------------------------------------------- + */ + + function normalizeSource(source) { + if (source.className) { + if (typeof source.className == 'string') { + source.className = source.className.split(/\s+/); + } + } else { + source.className = []; + } + var normalizers = fc.sourceNormalizers; + for (var i = 0; i < normalizers.length; i++) { + normalizers[i](source); + } + } +} ;; fc.applyAll = applyAll; @@ -5499,6 +5643,2161 @@ function compareSlotSegs(seg1, seg2) { } +;; + +fcViews.resourceDay = ResourceDayView; + +function ResourceDayView(element, calendar) { // TODO: make a DayView mixin + var t = this; + + + // exports + t.incrementDate = incrementDate; + t.render = render; + + + // imports + ResourceView.call(t, element, calendar, 'resourceDay'); + var getResources = t.getResources; + + function incrementDate(date, delta) { + var out = date.clone().stripTime().add('days', delta); + out = t.skipHiddenDays(out, delta < 0 ? -1 : 1); + return out; + } + + + function render(date) { + + t.start = t.intervalStart = date.clone().stripTime(); + t.end = t.intervalEnd = t.start.clone().add('days', 1); + + t.title = calendar.formatDate(t.start, t.opt('titleFormat')); + + t.renderResource(getResources().length); + } + + +} +;; +// setDefaults({ +// allDaySlot: true, +// allDayText: 'all-day', +// firstHour: 6, +// slotMinutes: 30, +// defaultEventMinutes: 120, +// axisFormat: 'h(:mm)tt', +// timeFormat: { +// agenda: 'h:mm{ - h:mm}' +// }, +// dragOpacity: { +// agenda: .5 +// }, +// minTime: 0, +// maxTime: 24 +// }); + + +setDefaults({ + allDaySlot: true, + allDayText: 'all-day', + + scrollTime: '06:00:00', + + slotMinutes: 30, + slotDuration: '00:30:00', + + // axisFormat: generateAgendaAxisFormat, + // timeFormat: { + // agenda: generateAgendaTimeFormat + // }, + + dragOpacity: { + agenda: .5 + }, + minTime: '00:00:00', + maxTime: '24:00:00', + slotEventOverlap: true +}); + + +// TODO: make it work in quirks mode (event corners, all-day height) +// TODO: test liquid width, especially in IE6 + +function ResourceView(element, calendar, viewName) { + var t = this; + + + // exports + // t.renderResource = renderResource; + // t.setWidth = setWidth; + // t.setHeight = setHeight; + // t.afterRender = afterRender; + // t.computeDateTop = computeDateTop; + // //t.defaultEventEnd = defaultEventEnd; + // //t.timePosition = timePosition; + // t.getIsCellAllDay = getIsCellAllDay; + // t.allDayRow = function() { return allDayRow; }; // badly named + // //t.allDayRow = getAllDayRow; + // t.getCoordinateGrid = function() { return coordinateGrid; }; // specifically for AgendaEventRenderer + // t.getHoverListener = function() { return hoverListener; }; + // t.colLeft = colLeft; + // t.colRight = colRight; + // t.colContentLeft = colContentLeft; + // t.colContentRight = colContentRight; + // t.getDaySegmentContainer = function() { return daySegmentContainer; }; + // t.getSlotSegmentContainer = function() { return slotSegmentContainer; }; + // // t.getMinMinute = function() { return minMinute; }; + // // t.getMaxMinute = function() { return maxMinute; }; + // t.getMinTime = function() { return minTime; }; + // t.getMaxTime = function() { return maxTime; }; + + // t.getSlotContainer = function() { return slotContainer; }; + // t.getRowCnt = function() { return 1; }; + // t.getColCnt = function() { return colCnt; }; + // t.getColWidth = function() { return colWidth; }; + // t.getSnapHeight = function() { return snapHeight; }; + // t.getSnapMinutes = function() { return snapMinutes; }; + // t.defaultSelectionEnd = defaultSelectionEnd; + // t.renderDayOverlay = renderDayOverlay; + // t.renderSelection = renderSelection; + // t.clearSelection = clearSelection; + // t.reportDayClick = reportDayClick; // selection mousedown hack + // t.dragStart = dragStart; + // t.dragStop = dragStop; + //t.renderAgenda = renderAgenda; + t.renderResource = renderResource; + t.setWidth = setWidth; + t.setHeight = setHeight; + t.afterRender = afterRender; + t.computeDateTop = computeDateTop; + t.getIsCellAllDay = getIsCellAllDay; + t.allDayRow = function() { return allDayRow; }; // badly named + t.getCoordinateGrid = function() { return coordinateGrid; }; // specifically for AgendaEventRenderer + t.getHoverListener = function() { return hoverListener; }; + t.colLeft = colLeft; + t.colRight = colRight; + t.colContentLeft = colContentLeft; + t.colContentRight = colContentRight; + t.getDaySegmentContainer = function() { return daySegmentContainer; }; + t.getSlotSegmentContainer = function() { return slotSegmentContainer; }; + t.getSlotContainer = function() { return slotContainer; }; + t.getRowCnt = function() { return 1; }; + t.getColCnt = function() { return colCnt; }; + t.getColWidth = function() { return colWidth; }; + t.getSnapHeight = function() { return snapHeight; }; + t.getSnapDuration = function() { return snapDuration; }; + t.getSlotHeight = function() { return slotHeight; }; + t.getSlotDuration = function() { return slotDuration; }; + t.getMinTime = function() { return minTime; }; + t.getMaxTime = function() { return maxTime; }; + t.defaultSelectionEnd = defaultSelectionEnd; + t.renderDayOverlay = renderDayOverlay; + t.renderSelection = renderSelection; + t.clearSelection = clearSelection; + t.reportDayClick = reportDayClick; // selection mousedown hack + t.dragStart = dragStart; + t.dragStop = dragStop; + t.getResources = calendar.fetchResources; + + // imports + View.call(t, element, calendar, viewName); + OverlayManager.call(t); + SelectionManager.call(t); + ResourceEventRenderer.call(t); + var opt = t.opt; + var trigger = t.trigger; + var renderOverlay = t.renderOverlay; + var clearOverlays = t.clearOverlays; + var reportSelection = t.reportSelection; + var unselect = t.unselect; + //var daySelectionMousedown = t.daySelectionMousedown; // overridden + var slotSegHtml = t.slotSegHtml; + var cellToDate = t.cellToDate; + var dateToCell = t.dateToCell; + var rangeToSegments = t.rangeToSegments; + var formatDate = calendar.formatDate; + var calculateWeekNumber = calendar.calculateWeekNumber; + + // View.call(t, element, calendar, viewName); + // OverlayManager.call(t); + // SelectionManager.call(t); + // ResourceEventRenderer.call(t); + // var opt = t.opt; + // var trigger = t.trigger; + // var renderOverlay = t.renderOverlay; + // var clearOverlays = t.clearOverlays; + // var reportSelection = t.reportSelection; + // var unselect = t.unselect; + // var slotSegHtml = t.slotSegHtml; + // var cellToDate = t.cellToDate; + // var dateToCell = t.dateToCell; + // // var rangeToSegments = t.rangeToSegments; + // var formatDate = calendar.formatDate; + + + // locals + + var dayTable; + var dayHead; + var dayHeadCells; + var dayBody; + var dayBodyCells; + var dayBodyCellInners; + var dayBodyCellContentInners; + var dayBodyFirstCell; + var dayBodyFirstCellStretcher; + var slotLayer; + var daySegmentContainer; + var allDayTable; + var allDayRow; + var slotScroller; + var slotContainer; + var slotSegmentContainer; + var slotTable; + var selectionHelper; + + var viewWidth; + var viewHeight; + var axisWidth; + var colWidth; + var gutterWidth; + + var slotDuration; + var slotHeight; // TODO: what if slotHeight changes? (see issue 650) + + var snapDuration; + var snapRatio; // ratio of number of "selection" slots to normal slots. (ex: 1, 2, 4) + var snapHeight; // holds the pixel hight of a "selection" slot + + var colCnt; + var slotCnt; + var coordinateGrid; + var hoverListener; + var colPositions; + var colContentPositions; + var slotTopCache = {}; + + var tm; + var rtl; + var minTime; + var maxTime; + var colFormat; + var resources = t.getResources; + // var dayTable; + // var dayHead; + // var dayHeadCells; + // var dayBody; + // var dayBodyCells; + // var dayBodyCellInners; + // var dayBodyCellContentInners; + // var dayBodyFirstCell; + // var dayBodyFirstCellStretcher; + // var slotLayer; + // var daySegmentContainer; + // var allDayTable; + // var allDayRow; + // var slotScroller; + // var slotContainer; + // var slotSegmentContainer; + // var slotTable; + // var slotTableFirstInner; + // var selectionHelper; + + // var viewWidth; + // var viewHeight; + // var axisWidth; + // var colWidth; + // var gutterWidth; + // var slotHeight; // TODO: what if slotHeight changes? (see issue 650) + + // var snapMinutes; + // var snapRatio; // ratio of number of "selection" slots to normal slots. (ex: 1, 2, 4) + // var snapHeight; // holds the pixel hight of a "selection" slot + + // var colCnt; + // var slotCnt; + // var coordinateGrid; + // var hoverListener; + // var colPositions; + // var colContentPositions; + // var slotTopCache = {}; + // var slotDuration; + // var tm; + // var rtl; + // var minMinute, maxMinute; + // var colFormat; + // var showWeekNumbers; + // var weekNumberTitle; + // var weekNumberFormat; + // var resources = t.getResources; + // var minTime; + // var maxTime; + + /* Rendering + -----------------------------------------------------------------------------*/ + + + disableTextSelection(element.addClass('fc-agenda')); + + + function renderResource(resourceColumnsCnt) { + colCnt = resourceColumnsCnt; + updateOptions(); + + if (!dayTable) { // first time rendering? + buildSkeleton(); // builds day table, slot area, events containers + } + else { + buildDayTable(); // rebuilds day table + } + } + + function updateOptions() { + + tm = opt('theme') ? 'ui' : 'fc'; + rtl = opt('isRTL'); + colFormat = opt('columnFormat'); + + minTime = moment.duration(opt('minTime')); + maxTime = moment.duration(opt('maxTime')); + + slotDuration = moment.duration(opt('slotDuration')); + snapDuration = opt('snapDuration'); + snapDuration = snapDuration ? moment.duration(snapDuration) : slotDuration; + } + + + + /* Build DOM + -----------------------------------------------------------------------*/ + + + function buildSkeleton() { + var s; + var headerClass = tm + "-widget-header"; + var contentClass = tm + "-widget-content"; + var slotTime; + var slotDate; + var minutes; + var slotNormal = slotDuration.asMinutes() % 15 === 0; + + buildDayTable(); + + slotLayer = + $("
") + .appendTo(element); + + if (opt('allDaySlot')) { + + daySegmentContainer = + $("
") + .appendTo(slotLayer); + + s = + "" + + "" + + "" + + "" + + "" + + "" + + "
" + + ( + opt('allDayHTML') || + htmlEscape(opt('allDayText')) + ) + + "" + + "
" + + "
 
"; + allDayTable = $(s).appendTo(slotLayer); + allDayRow = allDayTable.find('tr'); + + dayBind(allDayRow.find('td')); + + slotLayer.append( + "
" + + "
" + + "
" + ); + + }else{ + + daySegmentContainer = $([]); // in jQuery 1.4, we can just do $() + + } + + slotScroller = + $("
") + .appendTo(slotLayer); + + slotContainer = + $("
") + .appendTo(slotScroller); + + slotSegmentContainer = + $("
") + .appendTo(slotContainer); + + s = + "" + + ""; + + slotTime = moment.duration(+minTime); // i wish there was .clone() for durations + slotCnt = 0; + while (slotTime < maxTime) { + slotDate = t.start.clone().time(slotTime); // will be in UTC but that's good. to avoid DST issues + minutes = slotDate.minutes(); + s += + "" + + "" + + "" + + ""; + slotTime.add(slotDuration); + slotCnt++; + } + + s += + "" + + "
" + + ((!slotNormal || !minutes) ? + htmlEscape(formatDate(slotDate, opt('axisFormat'))) : + ' ' + ) + + "" + + "
 
" + + "
"; + // slotTable = $(s).appendTo(slotContainer); + // slotTableFirstInner = slotTable.find('div:first'); + slotTable = $(s).appendTo(slotContainer); + + slotBind(slotTable.find('td')); + } + + + + /* Build Day Table + -----------------------------------------------------------------------*/ + + + function buildDayTable() { + var html = buildDayTableHTML(); + + if (dayTable) { + dayTable.remove(); + } + dayTable = $(html).appendTo(element); + + dayHead = dayTable.find('thead'); + dayHeadCells = dayHead.find('th').slice(1, -1); // exclude gutter + dayBody = dayTable.find('tbody'); + dayBodyCells = dayBody.find('td').slice(0, -1); // exclude gutter + dayBodyCellInners = dayBodyCells.find('> div'); + dayBodyCellContentInners = dayBodyCells.find('.fc-day-content > div'); + + dayBodyFirstCell = dayBodyCells.eq(0); + dayBodyFirstCellStretcher = dayBodyCellInners.eq(0); + + markFirstLast(dayHead.add(dayHead.find('tr'))); + markFirstLast(dayBody.add(dayBody.find('tr'))); + + // TODO: now that we rebuild the cells every time, we should call dayRender + } + + + function buildDayTableHTML() { + var html = + "" + + buildDayTableHeadHTML() + + buildDayTableBodyHTML() + + "
"; + + return html; + } + + + function buildDayTableHeadHTML() { + var headerClass = tm + "-widget-header"; + var date; + var html = ''; + var weekText; + var col; + + html += + "" + + ""; + + if (opt('weekNumbers')) { + date = cellToDate(0, 0); + weekText = calculateWeekNumber(date); + if (rtl) { + weekText += opt('weekNumberTitle'); + } + else { + weekText = opt('weekNumberTitle') + weekText; + } + html += + "" + + htmlEscape(weekText) + + ""; + } + else { + html += " "; + } + + for (col=0; col" + + htmlEscape(resource.name) + + ""; + } + + html += + " " + + "" + + ""; + + return html; + } + + + function buildDayTableBodyHTML() { + var headerClass = tm + "-widget-header"; // TODO: make these when updateOptions() called + var contentClass = tm + "-widget-content"; + var date; + var today = makeMoment(new Date()).stripTime(); + var col; + var cellsHTML; + var cellHTML; + var classNames; + var html = ''; + + html += + "" + + "" + + " "; + + cellsHTML = ''; + + for (col=0; col" + + "
" + + "
" + + "
 
" + + "
" + + "
" + + ""; + + cellsHTML += cellHTML; + } + + html += cellsHTML; + html += + " " + + "" + + ""; + + return html; + } + + + // TODO: data-date on the cells + + + + /* Dimensions + -----------------------------------------------------------------------*/ + + + function setHeight(height) { + if (height === undefined) { + height = viewHeight; + } + viewHeight = height; + slotTopCache = {}; + + var headHeight = dayBody.position().top; + var allDayHeight = slotScroller.position().top; // including divider + var bodyHeight = Math.min( // total body height, including borders + height - headHeight, // when scrollbars + slotTable.height() + allDayHeight + 1 // when no scrollbars. +1 for bottom border + ); + + dayBodyFirstCellStretcher + .height(bodyHeight - vsides(dayBodyFirstCell)); + + slotLayer.css('top', headHeight); + + slotScroller.height(bodyHeight - allDayHeight - 1); + + // the stylesheet guarantees that the first row has no border. + // this allows .height() to work well cross-browser. + var slotHeight0 = slotTable.find('tr:first').height() + 1; // +1 for bottom border + var slotHeight1 = slotTable.find('tr:eq(1)').height(); + // HACK: i forget why we do this, but i think a cross-browser issue + slotHeight = (slotHeight0 + slotHeight1) / 2; + + snapRatio = slotDuration / snapDuration; + snapHeight = slotHeight / snapRatio; + + // slotHeight = slotTableFirstInner.height() + 1; // +1 for border + + // snapRatio = opt('slotMinutes') / snapMinutes; + // snapHeight = slotHeight / snapRatio; + } + + + function setWidth(width) { + viewWidth = width; + colPositions.clear(); + colContentPositions.clear(); + + var axisFirstCells = dayHead.find('th:first'); + if (allDayTable) { + axisFirstCells = axisFirstCells.add(allDayTable.find('th:first')); + } + axisFirstCells = axisFirstCells.add(slotTable.find('th:first')); + + axisWidth = 0; + setOuterWidth( + axisFirstCells + .width('') + .each(function(i, _cell) { + axisWidth = Math.max(axisWidth, $(_cell).outerWidth()); + }), + axisWidth + ); + + var gutterCells = dayTable.find('.fc-agenda-gutter'); + if (allDayTable) { + gutterCells = gutterCells.add(allDayTable.find('th.fc-agenda-gutter')); + } + + var slotTableWidth = slotScroller[0].clientWidth; // needs to be done after axisWidth (for IE7) + + gutterWidth = slotScroller.width() - slotTableWidth; + if (gutterWidth) { + setOuterWidth(gutterCells, gutterWidth); + gutterCells + .show() + .prev() + .removeClass('fc-last'); + }else{ + gutterCells + .hide() + .prev() + .addClass('fc-last'); + } + + colWidth = Math.floor((slotTableWidth - axisWidth) / colCnt); + setOuterWidth(dayHeadCells.slice(0, -1), colWidth); + } + + + + /* Scrolling + -----------------------------------------------------------------------*/ + + + function resetScroll() { + var top = computeTimeTop( + moment.duration(opt('scrollTime')) + ) + 1; // +1 for the border + + function scroll() { + slotScroller.scrollTop(top); + } + + scroll(); + setTimeout(scroll, 0); // overrides any previous scroll state made by the browser + } + + + function afterRender() { // after the view has been freshly rendered and sized + resetScroll(); + } + + + + /* Slot/Day clicking and binding + -----------------------------------------------------------------------*/ + + + function dayBind(cells) { + cells.click(slotClick) + .mousedown(daySelectionMousedown); + } + + + function slotBind(cells) { + cells.click(slotClick) + .mousedown(slotSelectionMousedown); + } + + function slotClick(ev) { + if (!opt('selectable')) { // if selectable, SelectionManager will worry about dayClick + var col = Math.min(colCnt-1, Math.floor((ev.pageX - dayTable.offset().left - axisWidth) / colWidth)); + var date = cellToDate(0, col); + var match = this.parentNode.className.match(/fc-slot(\d+)/); // TODO: maybe use data + + ev.data = resources()[col]; // added + + if (match) { + var slotIndex = parseInt(match[1], 10); + date.add(minTime + slotIndex * slotDuration); + date = calendar.rezoneDate(date); + trigger( + 'dayClick', + dayBodyCells[col], + date, + ev + ); + }else{ + trigger( + 'dayClick', + dayBodyCells[col], + date, + ev + ); + } + } + } + + + + /* Semi-transparent Overlay Helpers + -----------------------------------------------------*/ + // TODO: should be consolidated with BasicView's methods + + + function renderDayOverlay(overlayStart, overlayEnd, refreshCoordinateGrid, col) { // overlayEnd is exclusive + if (refreshCoordinateGrid) { + coordinateGrid.build(); + } + + var segments = rangeToSegments(overlayStart, overlayEnd); + + for (var i=0; i= 0) { + date.time(moment.duration(minTime + snapIndex * snapDuration)); + date = calendar.rezoneDate(date); + } + + return date; + } + + + function computeDateTop(date, startOfDayDate) { + return computeTimeTop( + moment.duration( + date.clone().stripZone() - startOfDayDate.clone().stripTime() + ) + ); + } + + + function computeTimeTop(time) { // time is a duration + + if (time < minTime) { + return 0; + } + if (time >= maxTime) { + return slotTable.height(); + } + + var slots = (time - minTime) / slotDuration; + var slotIndex = Math.floor(slots); + var slotPartial = slots - slotIndex; + var slotTop = slotTopCache[slotIndex]; + + // find the position of the corresponding + // need to use this tecnhique because not all rows are rendered at same height sometimes. + if (slotTop === undefined) { + slotTop = slotTopCache[slotIndex] = + slotTable.find('tr').eq(slotIndex).find('td div')[0].offsetTop; + // .eq() is faster than ":eq()" selector + // [0].offsetTop is faster than .position().top (do we really need this optimization?) + // a better optimization would be to cache all these divs + } + + var top = + slotTop - 1 + // because first row doesn't have a top border + slotPartial * slotHeight; // part-way through the row + + top = Math.max(top, 0); + + return top; + } + + // // get the Y coordinate of the given time on the given day (both Date objects) + // function timePosition(day, time) { // both date objects. day holds 00:00 of current day + // day = day.clone().stripTime(); + // if (time < day.clone().add('m', minMinute)) { + // return 0; + // } + // if (time >= day.clone().add('m', maxMinute)) { + // return slotTable.height(); + // } + // var slotMinutes = opt('slotMinutes'), + // minutes = time.getHours()*60 + time.getMinutes() - minMinute, + // slotI = Math.floor(minutes / slotMinutes), + // slotTop = slotTopCache[slotI]; + // if (slotTop === undefined) { + // slotTop = slotTopCache[slotI] = + // slotTable.find('tr').eq(slotI).find('td div')[0].offsetTop; + // // .eq() is faster than ":eq()" selector + // // [0].offsetTop is faster than .position().top (do we really need this optimization?) + // // a better optimization would be to cache all these divs + // } + // return Math.max(0, Math.round( + // slotTop - 1 + slotHeight * ((minutes % slotMinutes) / slotMinutes) + // )); + // } + + + // function getAllDayRow(index) { + // return allDayRow; + // } + + + // function defaultEventEnd(event) { + // var start = event.start.clone(); + // if (event.allDay) { + // return start; + // } + // return start.add('m', opt('defaultEventMinutes')); + // } + + + + /* Selection + ---------------------------------------------------------------------------------*/ + + + function defaultSelectionEnd(startDate, allDay) { + if (allDay) { + return startDate.clone(); + } + return startDate.clone().add('m', opt('slotMinutes')); + } + + + function renderSelection(startDate, endDate, allDay, col) { // only for all-day + if (allDay) { + if (opt('allDaySlot')) { + renderDayOverlay(startDate, endDate, true, col); + } + }else{ + renderSlotSelection(startDate, endDate); + } + } + + + function renderSlotSelection(startDate, endDate, col) { + var helperOption = opt('selectHelper'); + coordinateGrid.build(); + if (helperOption) { + col = col || dateToCell(startDate).col; + if (col >= 0 && col < colCnt) { // only works when times are on same day + var rect = coordinateGrid.rect(0, col, 0, col, slotContainer); // only for horizontal coords + var top = computeDateTop(startDate, startDate); + var bottom = computeDateTop(startDate, endDate); + if (bottom > top) { // protect against selections that are entirely before or after visible range + rect.top = top; + rect.height = bottom - top; + rect.left += 2; + rect.width -= 5; + if ($.isFunction(helperOption)) { + var helperRes = helperOption(startDate, endDate); + if (helperRes) { + rect.position = 'absolute'; + selectionHelper = $(helperRes) + .css(rect) + .appendTo(slotContainer); + } + }else{ + rect.isStart = true; // conside rect a "seg" now + rect.isEnd = true; // + selectionHelper = $(slotSegHtml( + { + title: '', + start: startDate, + end: endDate, + className: ['fc-select-helper'], + editable: false + }, + rect + )); + selectionHelper.css('opacity', opt('dragOpacity')); + } + if (selectionHelper) { + slotBind(selectionHelper); + slotContainer.append(selectionHelper); + setOuterWidth(selectionHelper, rect.width, true); // needs to be after appended + setOuterHeight(selectionHelper, rect.height, true); + } + } + } + }else{ + renderSlotOverlay(startDate, endDate, col); + } + } + + + function clearSelection() { + clearOverlays(); + if (selectionHelper) { + selectionHelper.remove(); + selectionHelper = null; + } + } + + function daySelectionMousedown(ev) { + // var cellToDate = t.cellToDate; + var getIsCellAllDay = t.getIsCellAllDay; + var hoverListener = t.getHoverListener(); + var reportDayClick = t.reportDayClick; // this is hacky and sort of weird + var col; + if (ev.which == 1 && opt('selectable')) { // which==1 means left mouse button + unselect(ev); + // var _mousedownElement = this; + var dates; + hoverListener.start(function(cell, origCell) { // TODO: maybe put cellToDate/getIsCellAllDay info in cell + clearSelection(); + if (cell && getIsCellAllDay(cell)) { + col = cell.col; + dates = [ realCellToDate(origCell), realCellToDate(cell) ].sort(dateCompare); + renderSelection(dates[0], dates[1], true, col); + }else{ + dates = null; + } + }, ev); + $(document).one('mouseup', function(ev) { + hoverListener.stop(); + if (dates) { + if (+dates[0] == +dates[1]) { + reportDayClick(dates[0], true, ev); + } + ev.data = resources()[col]; + reportSelection(dates[0], dates[1], true, ev); + } + }); + } + } + + // select on the calendar somewhere + function slotSelectionMousedown(ev) { + if (ev.which == 1 && opt('selectable')) { // ev.which==1 means left mouse button + unselect(ev); + var dates; + var col; + hoverListener.start(function(cell, origCell) { + clearSelection(); + if (cell && cell.col == origCell.col && !getIsCellAllDay(cell)) { + col = cell.col; + var d1 = realCellToDate(origCell); + var d2 = realCellToDate(cell); + dates = [ + d1, + d1.clone().add(snapDuration), // calculate minutes depending on selection slot minutes + d2, + d2.clone().add(snapDuration) + ].sort(dateCompare); + renderSlotSelection(dates[0], dates[3], cell.col); // updated + }else{ + dates = null; + } + }, ev); + $(document).one('mouseup', function(ev) { + hoverListener.stop(); + if (dates) { + if (+dates[0] == +dates[1]) { + reportDayClick(dates[0], false, ev); + } + ev.data = resources()[col]; // added + reportSelection(dates[0], dates[3], false, ev); + } + }); + } + } + + + function reportDayClick(date, allDay, ev) { + trigger('dayClick', dayBodyCells[dateToCell(date).col], date, allDay, ev); + } + + + + /* External Dragging + --------------------------------------------------------------------------------*/ + + + function dragStart(_dragElement, ev, ui) { + hoverListener.start(function(cell) { + clearOverlays(); + if (cell) { + if (getIsCellAllDay(cell)) { + renderCellOverlay(cell.row, cell.col, cell.row, cell.col); + }else{ + var d1 = realCellToDate(cell); + var d2 = d1.clone().add('m', opt('defaultEventMinutes')); + renderSlotOverlay(d1, d2, cell.col); + } + } + }, ev); + } + + + function dragStop(_dragElement, ev, ui) { + var cell = hoverListener.stop(); + clearOverlays(); + if (cell) { + ev.data = resources()[cell.col]; + trigger('drop', _dragElement, realCellToDate(cell), getIsCellAllDay(cell), ev, ui); + } + } + + +} + +;; + +function ResourceEventRenderer() { + var t = this; + + + // exports + t.renderEvents = renderEvents; + t.clearEvents = clearEvents; + t.slotSegHtml = slotSegHtml; + + + // imports + DayEventRenderer.call(t); + var opt = t.opt; + var trigger = t.trigger; + var isEventDraggable = t.isEventDraggable; + var isEventResizable = t.isEventResizable; + var eventElementHandlers = t.eventElementHandlers; + var setHeight = t.setHeight; + var getDaySegmentContainer = t.getDaySegmentContainer; + var getSlotSegmentContainer = t.getSlotSegmentContainer; + var getHoverListener = t.getHoverListener; + var computeDateTop = t.computeDateTop; + var getIsCellAllDay = t.getIsCellAllDay; + var colContentLeft = t.colContentLeft; + var colContentRight = t.colContentRight; + var cellToDate = t.cellToDate; + var getColCnt = t.getColCnt; + var getColWidth = t.getColWidth; + var getSnapHeight = t.getSnapHeight; + var getSnapDuration = t.getSnapDuration; + var getSlotHeight = t.getSlotHeight; + var getSlotDuration = t.getSlotDuration; + var getSlotContainer = t.getSlotContainer; + var reportEventElement = t.reportEventElement; + var showEvents = t.showEvents; + var hideEvents = t.hideEvents; + var eventDrop = t.eventDrop; + var eventResize = t.eventResize; + var renderDayOverlay = t.renderDayOverlay; + var clearOverlays = t.clearOverlays; + var renderDayEvents = t.renderDayEvents; + var getMinTime = t.getMinTime; + var getMaxTime = t.getMaxTime; + var calendar = t.calendar; + var formatDate = calendar.formatDate; + var getEventEnd = calendar.getEventEnd; + var resources = t.getResources; + + + // overrides + t.draggableDayEvent = draggableDayEvent; + + + + /* Rendering + ----------------------------------------------------------------------------*/ + + + function renderEvents(events, modifiedEventId) { + var i, len=events.length, + dayEvents=[], + slotEvents=[]; + for (i=0; i rangeStart && eventStart < rangeEnd) { + + if (eventStart < rangeStart) { + segStart = rangeStart.clone(); + isStart = false; + } + else { + segStart = eventStart; + isStart = true; + } + + if (eventEnd > rangeEnd) { + segEnd = rangeEnd.clone(); + isEnd = false; + } + else { + segEnd = eventEnd; + isEnd = true; + } + + segs.push({ + event: event, + start: segStart, + end: segEnd, + isStart: isStart, + isEnd: isEnd + }); + } + } + + return segs.sort(compareSlotSegs); + } + + function eventsForResource(resource, events) { + var resourceEvents = []; + for (var i = 0; i < events.length; i++) { + if (events[i].resources && $.inArray(resource.id, events[i].resources) >= 0) { + resourceEvents.push(events[i]); + } + } + return resourceEvents; + } + + // function slotEventEnd(event) { + // if (event.end) { + // return event.end.clone(); + // }else{ + // return event.start.clone().add('m', opt('defaultEventMinutes')); + // } + // } + + + // renders events in the 'time slots' at the bottom + // TODO: when we refactor this, when user returns `false` eventRender, don't have empty space + // TODO: refactor will include using pixels to detect collisions instead of dates (handy for seg cmp) + + function renderSlotSegs(segs, modifiedEventId) { + + var i, segCnt=segs.length, seg, + event, + top, + bottom, + columnLeft, + columnRight, + columnWidth, + width, + left, + right, + html = '', + eventElements, + eventElement, + triggerRes, + titleElement, + height, + slotSegmentContainer = getSlotSegmentContainer(), + isRTL = opt('isRTL'); + + // calculate position/dimensions, create html + for (i=0; i" + + "
" + + "
" + + htmlEscape(t.getEventTimeText(event)) + + "
" + + "
" + + htmlEscape(event.title || '') + + "
" + + "
" + + "
"; + if (seg.isEnd && isEventResizable(event)) { + html += + "
=
"; + } + html += + ""; + return html; + } + + + function bindSlotSeg(event, eventElement, seg) { + var timeElement = eventElement.find('div.fc-event-time'); + if (isEventDraggable(event)) { + draggableSlotEvent(event, eventElement, timeElement); + } + if (seg.isEnd && isEventResizable(event)) { + resizableSlotEvent(event, eventElement, timeElement); + } + eventElementHandlers(event, eventElement); + } + + + + /* Dragging + -----------------------------------------------------------------------------------*/ + + + // when event starts out FULL-DAY + // overrides DayEventRenderer's version because it needs to account for dragging elements + // to and from the slot area. + + function draggableDayEvent(event, eventElement, seg) { + var isStart = seg.isStart; + var origWidth; + var revert; + var allDay = true; + var dayDelta; + + var hoverListener = getHoverListener(); + var colWidth = getColWidth(); + var minTime = getMinTime(); + var slotDuration = getSlotDuration(); + var slotHeight = getSlotHeight(); + var snapDuration = getSnapDuration(); + var snapHeight = getSnapHeight(); + + eventElement.draggable({ + opacity: opt('dragOpacity', 'month'), // use whatever the month view was using + revertDuration: opt('dragRevertDuration'), + start: function(ev, ui) { + + trigger('eventDragStart', eventElement[0], event, ev, ui); + hideEvents(event, eventElement); + origWidth = eventElement.width(); + + hoverListener.start(function(cell, origCell) { + clearOverlays(); + if (cell) { + revert = false; + + var origDate = cellToDate(0, origCell.col); + var date = cellToDate(0, cell.col); + dayDelta = date.diff(origDate, 'days'); + + if (!cell.row) { // on full-days + + renderDayOverlay( + event.start.clone().add('days', dayDelta), + getEventEnd(event).add('days', dayDelta) + ); + + resetElement(); + } + else { // mouse is over bottom slots + + if (isStart) { + if (allDay) { + // convert event to temporary slot-event + eventElement.width(colWidth - 10); // don't use entire width + setOuterHeight(eventElement, calendar.defaultTimedEventDuration / slotDuration * slotHeight); // the default height + eventElement.draggable('option', 'grid', [ colWidth, 1 ]); + allDay = false; + } + } + else { + revert = true; + } + } + + revert = revert || (allDay && !dayDelta); + } + else { + resetElement(); + revert = true; + } + + eventElement.draggable('option', 'revert', revert); + + }, ev, 'drag'); + }, + stop: function(ev, ui) { + hoverListener.stop(); + clearOverlays(); + trigger('eventDragStop', eventElement[0], event, ev, ui); + + if (revert) { // hasn't moved or is out of bounds (draggable has already reverted) + + resetElement(); + eventElement.css('filter', ''); // clear IE opacity side-effects + showEvents(event, eventElement); + } + else { // changed! + + var eventStart = event.start.clone().add('days', dayDelta); // already assumed to have a stripped time + var snapTime; + var snapIndex; + if (!allDay) { + snapIndex = Math.round((eventElement.offset().top - getSlotContainer().offset().top) / snapHeight); // why not use ui.offset.top? + snapTime = moment.duration(minTime + snapIndex * snapDuration); + eventStart = calendar.rezoneDate(eventStart.clone().time(snapTime)); + } + + eventDrop( + eventElement[0], + event, + eventStart, + ev, + ui + ); + } + } + }); + function resetElement() { + if (!allDay) { + eventElement + .width(origWidth) + .height('') + .draggable('option', 'grid', null); + allDay = true; + } + } + } + + + // when event starts out IN TIMESLOTS + + function draggableSlotEvent(event, eventElement, timeElement) { + var coordinateGrid = t.getCoordinateGrid(); + var colCnt = getColCnt(); + var colWidth = getColWidth(); + var snapHeight = getSnapHeight(); + var snapDuration = getSnapDuration(); + + // states + var origPosition; // original position of the element, not the mouse + var origCell; + var isInBounds, prevIsInBounds; + var isAllDay, prevIsAllDay; + var colDelta, prevColDelta; + var dayDelta; // derived from colDelta + var resourceDelta; // derived from colDelta + var snapDelta, prevSnapDelta; // the number of snaps away from the original position + + // newly computed + var eventStart, eventEnd; + + eventElement.draggable({ + scroll: false, + grid: [ colWidth, snapHeight ], + axis: colCnt==1 ? 'y' : false, + opacity: opt('dragOpacity'), + revertDuration: opt('dragRevertDuration'), + start: function(ev, ui) { + + trigger('eventDragStart', eventElement[0], event, ev, ui); + hideEvents(event, eventElement); + + coordinateGrid.build(); + + // initialize states + origPosition = eventElement.position(); + origCell = coordinateGrid.cell(ev.pageX, ev.pageY); + isInBounds = prevIsInBounds = true; + isAllDay = prevIsAllDay = getIsCellAllDay(origCell); + colDelta = prevColDelta = 0; + dayDelta = 0; + resourceDelta = 0; + snapDelta = prevSnapDelta = 0; + + eventStart = null; + eventEnd = null; + }, + drag: function(ev, ui) { + + // NOTE: this `cell` value is only useful for determining in-bounds and all-day. + // Bad for anything else due to the discrepancy between the mouse position and the + // element position while snapping. (problem revealed in PR #55) + // + // PS- the problem exists for draggableDayEvent() when dragging an all-day event to a slot event. + // We should overhaul the dragging system and stop relying on jQuery UI. + var cell = coordinateGrid.cell(ev.pageX, ev.pageY); + + // update states + isInBounds = !!cell; + if (isInBounds) { + isAllDay = getIsCellAllDay(cell); + + // calculate column delta + colDelta = Math.round((ui.position.left - origPosition.left) / colWidth); + if (colDelta != prevColDelta) { + // calculate the day delta based off of the original clicked column and the column delta + //var origDate = cellToDate(0, origCell.col); + //var col = origCell.col + colDelta; + //col = Math.max(0, col); + //col = Math.min(colCnt-1, col); + //dayDelta = 0; //dayDiff(date, origDate); + resourceDelta = colDelta; + } + + // calculate minute delta (only if over slots) + if (!isAllDay) { + snapDelta = Math.round((ui.position.top - origPosition.top) / snapHeight); + } + } + + // any state changes? + if ( + isInBounds != prevIsInBounds || + isAllDay != prevIsAllDay || + colDelta != prevColDelta || + snapDelta != prevSnapDelta + ) { + + // compute new dates + if (isAllDay) { + eventStart = event.start.clone().stripTime().add('days', dayDelta); + eventEnd = eventStart.clone().add(calendar.defaultAllDayEventDuration); + } + else { + eventStart = event.start.clone().add(snapDelta * snapDuration).add('days', dayDelta); + eventEnd = getEventEnd(event).add(snapDelta * snapDuration).add('days', dayDelta); + } + + updateUI(); + + // update previous states for next time + prevIsInBounds = isInBounds; + prevIsAllDay = isAllDay; + prevColDelta = colDelta; + prevSnapDelta = snapDelta; + } + + // if out-of-bounds, revert when done, and vice versa. + eventElement.draggable('option', 'revert', !isInBounds); + + }, + stop: function(ev, ui) { + + clearOverlays(); + trigger('eventDragStop', eventElement, event, ev, ui); + + if (isInBounds && (isAllDay || resourceDelta || snapDelta)) { // changed! + event.resources = [ resources()[origCell.col + resourceDelta].id ]; + eventDrop( + eventElement[0], + event, + eventStart, + ev, + ui + ); + } + else { // either no change or out-of-bounds (draggable has already reverted) + + // reset states for next time, and for updateUI() + isInBounds = true; + isAllDay = false; + colDelta = 0; + dayDelta = 0; + snapDelta = 0; + + updateUI(); + eventElement.css('filter', ''); // clear IE opacity side-effects + + // sometimes fast drags make event revert to wrong position, so reset. + // also, if we dragged the element out of the area because of snapping, + // but the *mouse* is still in bounds, we need to reset the position. + eventElement.css(origPosition); + + showEvents(event, eventElement); + } + } + }); + + function updateUI() { + clearOverlays(); + if (isInBounds) { + if (isAllDay) { + timeElement.hide(); + eventElement.draggable('option', 'grid', null); // disable grid snapping + renderDayOverlay(eventStart, eventEnd); + } + else { + updateTimeText(); + timeElement.css('display', ''); // show() was causing display=inline + eventElement.draggable('option', 'grid', [colWidth, snapHeight]); // re-enable grid snapping + } + } + } + + function updateTimeText() { + if (eventStart) { // must of had a state change + timeElement.text( + t.getEventTimeText(eventStart, event.end ? eventEnd : null) + // ^ + // only display the new end if there was an old end + ); + } + } + + } + + + + /* Resizing + --------------------------------------------------------------------------------------*/ + + + function resizableSlotEvent(event, eventElement, timeElement) { + var snapDelta, prevSnapDelta; + var snapHeight = getSnapHeight(); + var snapDuration = getSnapDuration(); + var eventEnd; + + eventElement.resizable({ + handles: { + s: '.ui-resizable-handle' + }, + grid: snapHeight, + start: function(ev, ui) { + snapDelta = prevSnapDelta = 0; + hideEvents(event, eventElement); + trigger('eventResizeStart', eventElement[0], event, ev, ui); + }, + resize: function(ev, ui) { + // don't rely on ui.size.height, doesn't take grid into account + snapDelta = Math.round((Math.max(snapHeight, eventElement.height()) - ui.originalSize.height) / snapHeight); + if (snapDelta != prevSnapDelta) { + eventEnd = getEventEnd(event).add(snapDuration * snapDelta); + var text; + if (snapDelta) { // has there been a change? + text = t.getEventTimeText(event.start, eventEnd); + } + else { + text = t.getEventTimeText(event); // the original time text + } + timeElement.text(text); + prevSnapDelta = snapDelta; + } + }, + stop: function(ev, ui) { + trigger('eventResizeStop', this, event, ev, ui); + if (snapDelta) { + eventResize( + eventElement[0], + event, + eventEnd, + ev, + ui + ); + } + else { + showEvents(event, eventElement); + // BUG: if event was really short, need to put title back in span + } + } + }); + } + + +} + + + +// /* Agenda Event Segment Utilities +// -----------------------------------------------------------------------------*/ +// // Sets the seg.backwardCoord and seg.forwardCoord on each segment and returns a new +// // list in the order they should be placed into the DOM (an implicit z-index). +// function placeSlotSegs(segs) { +// var levels = buildSlotSegLevels(segs); +// var level0 = levels[0]; +// var i; + +// computeForwardSlotSegs(levels); + +// if (level0) { + +// for (i=0; i seg2.start && seg1.start < seg2.end; +// } + + +// // A cmp function for determining which forward segment to rely on more when computing coordinates. +// function compareForwardSlotSegs(seg1, seg2) { +// // put higher-pressure first +// return seg2.forwardPressure - seg1.forwardPressure || +// // put segments that are closer to initial edge first (and favor ones with no coords yet) +// (seg1.backwardCoord || 0) - (seg2.backwardCoord || 0) || +// // do normal sorting... +// compareSlotSegs(seg1, seg2); +// } + + +// // A cmp function for determining which segment should be closer to the initial edge +// // (the left edge on a left-to-right calendar). +// function compareSlotSegs(seg1, seg2) { +// return seg1.start - seg2.start || // earlier start time goes first +// (seg2.end - seg2.start) - (seg1.end - seg1.start) || // tie? longer-duration goes first +// (seg1.event.title || '').localeCompare(seg2.event.title); // tie? alphabetically by title +// } + ;; @@ -6178,21 +8477,49 @@ function DayEventRenderer() { // Generate an array of "segments" for all events. function buildSegments(events) { + var resources = t.getResources; var segments = []; - for (var i=0; i= 0) { + resourceEvents.push(events[i]); + } + } + return resourceEvents; + } + // Generate an array of segments for a single event. // A "segment" is the same data structure that View.rangeToSegments produces, // with the addition of the `event` property being set to reference the original event. - function buildSegmentsForEvent(event) { + function buildSegmentsForEvent(event, resourceCol) { var segments = rangeToSegments(event.start, getEventEnd(event)); for (var i=0; ir;r++)t.each(arguments[r],n);return e}function i(t){return/(Time|Duration)$/.test(t)}function s(n,r){function a(t){se?f()&&(b(),m(t)):i()}function i(){le=ne.theme?"ui":"fc",n.addClass("fc"),ne.isRTL?n.addClass("fc-rtl"):n.addClass("fc-ltr"),ne.theme&&n.addClass("ui-widget"),se=t("
").prependTo(n),oe=new l(te,ne),ie=oe.render(),ie&&n.prepend(ie),h(ne.defaultView),ne.handleWindowResize&&t(window).resize(w),v()||s()}function s(){setTimeout(function(){!ce.start&&v()&&g()},0)}function d(){ce&&(Q("viewDestroy",ce,ce,ce.element),ce.triggerEventDestroy()),t(window).unbind("resize",w),ne.droppable&&t(document).off("dragstart",J).off("dragstop",K),ce.selectionManagerDestroy&&ce.selectionManagerDestroy(),oe.destroy(),se.remove(),n.removeClass("fc fc-ltr fc-rtl ui-widget")}function f(){return n.is(":visible")}function v(){return t("body").is(":visible")}function h(t){ce&&t==ce.name||p(t)}function p(e){ye++,ce&&(Q("viewDestroy",ce,ce,ce.element),N(),ce.triggerEventDestroy(),$(),ce.element.remove(),oe.deactivateButton(ce.name)),oe.activateButton(e),ce=new _e[e](t("
").appendTo(se),te),g(),V(),ye--}function g(t){ce.start&&!t&&fe.isWithin(ce.intervalStart,ce.intervalEnd)||f()&&m(t)}function m(t){ye++,ce.start&&(Q("viewDestroy",ce,ce,ce.element),N(),x()),$(),t&&(fe=ce.incrementDate(fe,t)),ce.render(fe.clone()),D(),V(),(ce.afterRender||k)(),H(),F(),Q("viewRender",ce,ce,ce.element),ye--,M()}function y(){f()&&(N(),x(),b(),D(),S())}function b(){ue=ne.contentHeight?ne.contentHeight:ne.height?ne.height-(ie?ie.height():0)-T(se):Math.round(se.width()/Math.max(ne.aspectRatio,.5))}function D(){void 0===ue&&b(),ye++,ce.setHeight(ue),ce.setWidth(se.width()),ye--,de=n.outerWidth()}function w(t){if(!ye&&t.target===window)if(ce.start){var e=++me;setTimeout(function(){e==me&&!ye&&f()&&de!=(de=n.outerWidth())&&(ye++,y(),ce.trigger("windowResize",ge),ye--)},ne.windowResizeDelay)}else s()}function C(){x(),z()}function E(t){x(),S(t)}function S(t){f()&&(ce.renderEvents(be,t),ce.trigger("eventAfterAllRender"))}function x(){ce.triggerEventDestroy(),ce.clearEvents(),ce.clearEventData()}function M(){!ne.lazyFetching||he(ce.start,ce.end)?z():S()}function z(){pe(ce.start,ce.end)}function R(t){be=t,S()}function _(t){E(t)}function H(){oe.updateTitle(ce.title)}function F(){var t=te.getNow();t.isWithin(ce.intervalStart,ce.intervalEnd)?oe.disableButton("today"):oe.enableButton("today")}function A(t,e){ce.select(t,e)}function N(){ce&&ce.unselect()}function Y(){g(-1)}function O(){g(1)}function W(){fe.add("years",-1),g()}function L(){fe.add("years",1),g()}function Z(){fe=te.getNow(),g()}function P(t){fe=te.moment(t),g()}function j(t){fe.add(e.duration(t)),g()}function q(){return fe.clone()}function $(){se.css({width:"100%",height:se.height(),overflow:"hidden"})}function V(){se.css({width:"",height:"",overflow:""})}function X(){return te}function U(){return ce}function G(t,e){return void 0===e?ne[t]:(("height"==t||"contentHeight"==t||"aspectRatio"==t)&&(ne[t]=e,y()),void 0)}function Q(t,e){return ne[t]?ne[t].apply(e||ge,Array.prototype.slice.call(arguments,2)):void 0}function J(e,n){var r=e.target,a=t(r);if(!a.parents(".fc").length){var o=ne.dropAccept;(t.isFunction(o)?o.call(r,a):a.is(o))&&(ve=r,ce.dragStart(ve,e,n))}}function K(t,e){ve&&(ce.dragStop(ve,t,e),ve=null)}var te=this;r=r||{};var ee,ne=o({},xe,r);ee=ne.lang in Me?Me[ne.lang]:Me[xe.lang],ee&&(ne=o({},xe,ee,r)),ne.isRTL&&(ne=o({},xe,ze,ee||{},r)),te.options=ne,te.render=a,te.destroy=d,te.refetchEvents=C,te.reportEvents=R,te.reportEventChange=_,te.rerenderEvents=E,te.changeView=h,te.select=A,te.unselect=N,te.prev=Y,te.next=O,te.prevYear=W,te.nextYear=L,te.today=Z,te.gotoDate=P,te.incrementDate=j,te.getDate=q,te.getCalendar=X,te.getView=U,te.option=G,te.trigger=Q;var re=u(e.langData(ne.lang));if(ne.monthNames&&(re._months=ne.monthNames),ne.monthNamesShort&&(re._monthsShort=ne.monthNamesShort),ne.dayNames&&(re._weekdays=ne.dayNames),ne.dayNamesShort&&(re._weekdaysShort=ne.dayNamesShort),null!=ne.firstDay){var ae=u(re._week);ae.dow=ne.firstDay,re._week=ae}te.defaultAllDayEventDuration=e.duration(ne.defaultAllDayEventDuration),te.defaultTimedEventDuration=e.duration(ne.defaultTimedEventDuration),te.moment=function(){var t;return"local"===ne.timezone?(t=Re.moment.apply(null,arguments),t.hasTime()&&t.local()):t="UTC"===ne.timezone?Re.moment.utc.apply(null,arguments):Re.moment.parseZone.apply(null,arguments),t._lang=re,t},te.getIsAmbigTimezone=function(){return"local"!==ne.timezone&&"UTC"!==ne.timezone},te.rezoneDate=function(t){return te.moment(t.toArray())},te.getNow=function(){var t=ne.now;return"function"==typeof t&&(t=t()),te.moment(t)},te.calculateWeekNumber=function(t){var e=ne.weekNumberCalculation;return"function"==typeof e?e(t):"local"===e?t.week():"ISO"===e.toUpperCase()?t.isoWeek():void 0},te.getEventEnd=function(t){return t.end?t.end.clone():te.getDefaultEventEnd(t.allDay,t.start)},te.getDefaultEventEnd=function(t,e){var n=e.clone();return t?n.stripTime().add(te.defaultAllDayEventDuration):n.add(te.defaultTimedEventDuration),te.getIsAmbigTimezone()&&n.stripZone(),n},te.formatRange=function(t,e,n){return"function"==typeof n&&(n=n.call(te,ne,re)),I(t,e,n,null,ne.isRTL)},te.formatDate=function(t,e){return"function"==typeof e&&(e=e.call(te,ne,re)),B(t,e)},c.call(te,ne);var oe,ie,se,le,ce,de,ue,fe,ve,he=te.isFetchNeeded,pe=te.fetchEvents,ge=n[0],me=0,ye=0,be=[];fe=null!=ne.defaultDate?te.moment(ne.defaultDate):te.getNow(),ne.droppable&&t(document).on("dragstart",J).on("dragstop",K)}function l(e,n){function r(){f=n.theme?"ui":"fc";var e=n.header;return e?v=t("").append(t("").append(o("left")).append(o("center")).append(o("right"))):void 0}function a(){v.remove()}function o(r){var a=t("",oe&&(r+=""),t=0;G>t;t++)e=ue(0,t),r+="";return r+=""}function d(){var t,e,n,r=re+"-widget-content",a="";for(a+="",t=0;U>t;t++){for(a+="",oe&&(n=ue(t,0),a+=""),e=0;G>e;e++)n=ue(t,e),a+=u(n);a+=""}return a+=""}function u(t){var e=A.intervalStart.month(),r=n.getNow().stripTime(),a="",o=re+"-widget-content",i=["fc-day","fc-"+Ae[t.day()],o];return t.month()!=e&&i.push("fc-other-month"),t.isSame(r,"day")?i.push("fc-today",re+"-state-highlight"):r>t?i.push("fc-past"):i.push("fc-future"),a+=""}function f(e){$=e;var n,r,a,o=Math.max($-Y.height(),0);"variable"==ie("weekMode")?n=r=Math.floor(o/(1==U?2:6)):(n=Math.floor(o/U),r=o-n*(U-1)),B.each(function(e,o){U>e&&(a=t(o),a.find("> div").css("min-height",(e==U-1?r:n)-T(a)))})}function v(t){q=t,ee.clear(),ne.clear(),X=0,oe&&(X=Y.find("th.fc-week-number").outerWidth()),V=Math.floor((q-X)/G),g(O.slice(0,-1),V)}function h(t){t.click(p).mousedown(de)}function p(e){if(!ie("selectable")){var r=n.moment(t(this).data("date"));se("dayClick",this,r,e)}}function m(t,e,n){n&&J.build();for(var r=ve(t,e),a=0;r.length>a;a++){var o=r[a];h(y(o.row,o.leftCol,o.row,o.rightCol))}}function y(t,n,r,a){var o=J.rect(t,n,r,a,e);return le(o,e)}function b(t){return t.clone().stripTime().add("days",1)}function D(t,e){m(t,e,!0)}function w(){ce()}function C(t,e){var n=fe(t),r=Z[n.row*G+n.col];se("dayClick",r,t,e)}function E(t,e){te.start(function(t){if(ce(),t){var e=ue(t),r=e.clone().add(n.defaultAllDayEventDuration);m(e,r)}},e)}function S(t,e,n){var r=te.stop();ce(),r&&se("drop",t,ue(r),e,n)}function k(t){return ee.left(t)}function x(t){return ee.right(t)}function M(t){return ne.left(t)}function z(t){return ne.right(t)}function _(t){return L.eq(t)}var A=this;A.renderBasic=a,A.setHeight=f,A.setWidth=v,A.renderDayOverlay=m,A.defaultSelectionEnd=b,A.renderSelection=D,A.clearSelection=w,A.reportDayClick=C,A.dragStart=E,A.dragStop=S,A.getHoverListener=function(){return te},A.colLeft=k,A.colRight=x,A.colContentLeft=M,A.colContentRight=z,A.getIsCellAllDay=function(){return!0},A.allDayRow=_,A.getRowCnt=function(){return U},A.getColCnt=function(){return G},A.getColWidth=function(){return V},A.getDaySegmentContainer=function(){return I},ge.call(A,e,n,r),Te.call(A),we.call(A),K.call(A);var N,Y,O,W,L,Z,B,P,j,I,q,$,V,X,U,G,Q,J,te,ee,ne,re,ae,oe,ie=A.opt,se=A.trigger,le=A.renderOverlay,ce=A.clearOverlays,de=A.daySelectionMousedown,ue=A.cellToDate,fe=A.dateToCell,ve=A.rangeToSegments,he=n.formatDate,pe=n.calculateWeekNumber;H(e.addClass("fc-grid")),J=new Ce(function(e,n){var r,a,o;O.each(function(e,i){r=t(i),a=r.offset().left,e&&(o[1]=a),o=[a],n[e]=o}),o[1]=a+r.outerWidth(),L.each(function(n,i){U>n&&(r=t(i),a=r.offset().top,n&&(o[1]=a),o=[a],e[n]=o)}),o[1]=a+r.outerHeight()}),te=new Ee(J),ee=new ke(function(t){return P.eq(t)}),ne=new ke(function(t){return j.eq(t)})}function K(){function t(t,e){n.renderDayEvents(t,e)}function e(){n.getDaySegmentContainer().empty()}var n=this;n.renderEvents=t,n.clearEvents=e,me.call(n)}function te(t,e){function n(t,e){return t.clone().stripTime().add("weeks",e).startOf("week")}function r(t){a.intervalStart=t.clone().stripTime().startOf("week"),a.intervalEnd=a.intervalStart.clone().add("weeks",1),a.start=a.skipHiddenDays(a.intervalStart),a.end=a.skipHiddenDays(a.intervalEnd,-1,!0),a.title=e.formatRange(a.start,a.end.clone().subtract(1),a.opt("titleFormat")," — "),a.renderAgenda(a.getCellsPerWeek())}var a=this;a.incrementDate=n,a.render=r,ae.call(a,t,e,"agendaWeek")}function ee(t,e){function n(t,e){var n=t.clone().stripTime().add("days",e);return n=a.skipHiddenDays(n,0>e?-1:1)}function r(t){a.start=a.intervalStart=t.clone().stripTime(),a.end=a.intervalEnd=a.start.clone().add("days",1),a.title=e.formatDate(a.start,a.opt("titleFormat")),a.renderAgenda(1)}var a=this;a.incrementDate=n,a.render=r,ae.call(a,t,e,"agendaDay")}function ne(t,e){return e.longDateFormat("LT").replace(":mm","(:mm)").replace(/(\Wmm)$/,"($1)").replace(/\s*a$/i,"a")}function re(t,e){return e.longDateFormat("LT").replace(/\s*a$/i,"")}function ae(n,r,a){function o(t){xe=t,i(),$?l():s()}function i(){Fe=Le("theme")?"ui":"fc",Ne=Le("isRTL"),We=Le("columnFormat"),Ye=e.duration(Le("minTime")),Oe=e.duration(Le("maxTime")),me=e.duration(Le("slotDuration")),be=Le("snapDuration"),be=be?e.duration(be):me}function s(){var r,a,o,i,s=Fe+"-widget-header",c=Fe+"-widget-content",d=0===me.asMinutes()%15;for(l(),ee=t("
").appendTo(n),Le("allDaySlot")?(ne=t("
").appendTo(ee),r="
"),o=n.header[r];return o&&t.each(o.split(" "),function(r){r>0&&a.append("");var o;t.each(this.split(","),function(r,i){if("title"==i)a.append("

 

"),o&&o.addClass(f+"-corner-right"),o=null;else{var s;if(e[i]?s=e[i]:_e[i]&&(s=function(){h.removeClass(f+"-state-hover"),e.changeView(i)}),s){var l,c=z(n.themeButtonIcons,i),d=z(n.buttonIcons,i),u=z(n.defaultButtonText,i),v=z(n.buttonText,i);l=v?R(v):c&&n.theme?"":d&&!n.theme?"":R(u||i);var h=t(""+l+"").click(function(){h.hasClass(f+"-state-disabled")||s()}).mousedown(function(){h.not("."+f+"-state-active").not("."+f+"-state-disabled").addClass(f+"-state-down")}).mouseup(function(){h.removeClass(f+"-state-down")}).hover(function(){h.not("."+f+"-state-active").not("."+f+"-state-disabled").addClass(f+"-state-hover")},function(){h.removeClass(f+"-state-hover").removeClass(f+"-state-down")}).appendTo(a);H(h),o||h.addClass(f+"-corner-left"),o=h}}}),o&&o.addClass(f+"-corner-right")}),a}function i(t){v.find("h2").html(t)}function s(t){v.find("span.fc-button-"+t).addClass(f+"-state-active")}function l(t){v.find("span.fc-button-"+t).removeClass(f+"-state-active")}function c(t){v.find("span.fc-button-"+t).addClass(f+"-state-disabled")}function d(t){v.find("span.fc-button-"+t).removeClass(f+"-state-disabled")}var u=this;u.render=r,u.destroy=a,u.updateTitle=i,u.activateButton=s,u.deactivateButton=l,u.disableButton=c,u.enableButton=d;var f,v=t([])}function c(e){function n(t,e){return!E||t.clone().stripZone()S.clone().stripZone()}function r(t,e){E=t,S=e,O=[];var n=++H,r=_.length;F=r;for(var o=0;r>o;o++)a(_[o],n)}function a(e,n){o(e,function(r){var a,o,i=t.isArray(e.events);if(n==H){if(r)for(a=0;r.length>a;a++)o=r[a],i||(o=D(o,e)),o&&O.push(o);F--,F||M(O)}})}function o(n,r){var a,i,s=Re.sourceFetchers;for(a=0;s.length>a;a++){if(i=s[a].call(C,n,E.clone(),S.clone(),e.timezone,r),i===!0)return;if("object"==typeof i)return o(i,r),void 0}var l=n.events;if(l)t.isFunction(l)?(y(),l.call(C,E.clone(),S.clone(),e.timezone,function(t){r(t),b()})):t.isArray(l)?r(l):r();else{var c=n.url;if(c){var d,u=n.success,f=n.error,v=n.complete;d=t.isFunction(n.data)?n.data():n.data;var h=t.extend({},d||{}),p=Y(n.startParam,e.startParam),g=Y(n.endParam,e.endParam),m=Y(n.timezoneParam,e.timezoneParam);p&&(h[p]=E.format()),g&&(h[g]=S.format()),e.timezone&&"local"!=e.timezone&&(h[m]=e.timezone),y(),t.ajax(t.extend({},He,n,{data:h,success:function(e){e=e||[];var n=N(u,this,arguments);t.isArray(n)&&(e=n),r(e)},error:function(){N(f,this,arguments),r()},complete:function(){N(v,this,arguments),b()}}))}else r()}}function i(t){var e=s(t);e&&(_.push(e),F++,a(e,H))}function s(e){var n,r,a=Re.sourceNormalizers;if(t.isFunction(e)||t.isArray(e)?n={events:e}:"string"==typeof e?n={url:e}:"object"==typeof e&&(n=t.extend({},e),"string"==typeof n.className&&(n.className=n.className.split(/\s+/))),n){for(t.isArray(n.events)&&(n.events=t.map(n.events,function(t){return D(t,n)})),r=0;a.length>r;r++)a[r].call(C,n);return n}}function l(e){_=t.grep(_,function(t){return!c(t,e)}),O=t.grep(O,function(t){return!c(t.source,e)}),M(O)}function c(t,e){return t&&e&&u(t)==u(e)}function u(t){return("object"==typeof t?t.events||t.url:"")||t}function f(t){t.start=C.moment(t.start),t.end&&(t.end=C.moment(t.end)),w(t),h(t),M(O)}function h(t){var e,n,r,a;for(e=0;O.length>e;e++)if(n=O[e],n._id==t._id&&n!==t)for(r=0;W.length>r;r++)a=W[r],void 0!==t[a]&&(n[a]=t[a])}function p(t,e){var n=D(t);n&&(n.source||(e&&(R.events.push(n),n.source=R),O.push(n)),M(O))}function g(e){var n,r;for(null==e?e=function(){return!0}:t.isFunction(e)||(n=e+"",e=function(t){return t._id==n}),O=t.grep(O,e,!0),r=0;_.length>r;r++)t.isArray(_[r].events)&&(_[r].events=t.grep(_[r].events,e,!0));M(O)}function m(e){return t.isFunction(e)?t.grep(O,e):null!=e?(e+="",t.grep(O,function(t){return t._id==e})):O}function y(){A++||k("loading",null,!0,x())}function b(){--A||k("loading",null,!1,x())}function D(n,r){var a,o,i,s,l={};return e.eventDataTransform&&(n=e.eventDataTransform(n)),r&&r.eventDataTransform&&(n=r.eventDataTransform(n)),a=C.moment(n.start||n.date),a.isValid()&&(o=null,!n.end||(o=C.moment(n.end),o.isValid()))?(i=n.allDay,void 0===i&&(s=Y(r?r.allDayDefault:void 0,e.allDayDefault),i=void 0!==s?s:!(a.hasTime()||o&&o.hasTime())),i?(a.hasTime()&&a.stripTime(),o&&o.hasTime()&&o.stripTime()):(a.hasTime()||(a=C.rezoneDate(a)),o&&!o.hasTime()&&(o=C.rezoneDate(o))),t.extend(l,n),r&&(l.source=r),l._id=n._id||(void 0===n.id?"_fc"+Fe++:n.id+""),l.className=n.className?"string"==typeof n.className?n.className.split(/\s+/):n.className:[],l.allDay=i,l.start=a,l.end=o,e.forceEventDuration&&!l.end&&(l.end=z(l)),d(l),l):void 0}function w(t,e,n){var r,a,o,i,s=t._allDay,l=t._start,c=t._end,d=!1;return e||n||(e=t.start,n=t.end),r=t.allDay!=s?t.allDay:!(e||n).hasTime(),r&&(e&&(e=e.clone().stripTime()),n&&(n=n.clone().stripTime())),e&&(a=r?v(e,l.clone().stripTime()):v(e,l)),r!=s?d=!0:n&&(o=v(n||C.getDefaultEventEnd(r,e||l),e||l).subtract(v(c||C.getDefaultEventEnd(s,l),l))),i=T(m(t._id),d,r,a,o),{dateDelta:a,durationDelta:o,undo:i}}function T(n,r,a,o,i){var s=C.getIsAmbigTimezone(),l=[];return t.each(n,function(t,n){var c=n._allDay,u=n._start,f=n._end,v=null!=a?a:c,h=u.clone(),p=!r&&f?f.clone():null;v?(h.stripTime(),p&&p.stripTime()):(h.hasTime()||(h=C.rezoneDate(h)),p&&!p.hasTime()&&(p=C.rezoneDate(p))),p||!e.forceEventDuration&&!+i||(p=C.getDefaultEventEnd(v,h)),h.add(o),p&&p.add(o).add(i),s&&(+o||+i)&&(h.stripZone(),p&&p.stripZone()),n.allDay=v,n.start=h,n.end=p,d(n),l.push(function(){n.allDay=c,n.start=u,n.end=f,d(n)})}),function(){for(var t=0;l.length>t;t++)l[t]()}}var C=this;C.isFetchNeeded=n,C.fetchEvents=r,C.addEventSource=i,C.removeEventSource=l,C.updateEvent=f,C.renderEvent=p,C.removeEvents=g,C.clientEvents=m,C.mutateEvent=w;var E,S,k=C.trigger,x=C.getView,M=C.reportEvents,z=C.getEventEnd,R={events:[]},_=[R],H=0,F=0,A=0,O=[];t.each((e.events?[e.events]:[]).concat(e.eventSources||[]),function(t,e){var n=s(e);n&&_.push(n)});var W=["title","url","allDay","className","editable","color","backgroundColor","borderColor","textColor"]}function d(t){t._allDay=t.allDay,t._start=t.start.clone(),t._end=t.end?t.end.clone():null}function u(t){var e=function(){};return e.prototype=t,new e}function f(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])}function v(t,n){return e.duration({days:t.clone().stripTime().diff(n.clone().stripTime(),"days"),ms:t.time()-n.time()})}function h(t){return"[object Date]"===Object.prototype.toString.call(t)||t instanceof Date}function p(e,n,r){e.unbind("mouseover").mouseover(function(e){for(var a,o,i,s=e.target;s!=this;)a=s,s=s.parentNode;void 0!==(o=a._fci)&&(a._fci=void 0,i=n[o],r(i.event,i.element,i),t(e.target).trigger(e)),e.stopPropagation()})}function g(e,n,r){for(var a,o=0;e.length>o;o++)a=t(e[o]),a.width(Math.max(0,n-y(a,r)))}function m(e,n,r){for(var a,o=0;e.length>o;o++)a=t(e[o]),a.height(Math.max(0,n-T(a,r)))}function y(t,e){return b(t)+w(t)+(e?D(t):0)}function b(e){return(parseFloat(t.css(e[0],"paddingLeft",!0))||0)+(parseFloat(t.css(e[0],"paddingRight",!0))||0)}function D(e){return(parseFloat(t.css(e[0],"marginLeft",!0))||0)+(parseFloat(t.css(e[0],"marginRight",!0))||0)}function w(e){return(parseFloat(t.css(e[0],"borderLeftWidth",!0))||0)+(parseFloat(t.css(e[0],"borderRightWidth",!0))||0)}function T(t,e){return C(t)+S(t)+(e?E(t):0)}function C(e){return(parseFloat(t.css(e[0],"paddingTop",!0))||0)+(parseFloat(t.css(e[0],"paddingBottom",!0))||0)}function E(e){return(parseFloat(t.css(e[0],"marginTop",!0))||0)+(parseFloat(t.css(e[0],"marginBottom",!0))||0)}function S(e){return(parseFloat(t.css(e[0],"borderTopWidth",!0))||0)+(parseFloat(t.css(e[0],"borderBottomWidth",!0))||0)}function k(){}function x(t,e){return t-e}function M(t){return Math.max.apply(Math,t)}function z(t,e){if(t=t||{},void 0!==t[e])return t[e];for(var n,r=e.split(/(?=[A-Z])/),a=r.length-1;a>=0;a--)if(n=t[r[a].toLowerCase()],void 0!==n)return n;return t["default"]}function R(t){return(t+"").replace(/&/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""").replace(/\n/g,"
")}function _(t){return t.replace(/&.*?;/g,"")}function H(t){t.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return!1})}function F(t){t.children().removeClass("fc-first fc-last").filter(":first-child").addClass("fc-first").end().filter(":last-child").addClass("fc-last")}function A(t,e){var n=t.source||{},r=t.color,a=n.color,o=e("eventColor"),i=t.backgroundColor||r||n.backgroundColor||a||e("eventBackgroundColor")||o,s=t.borderColor||r||n.borderColor||a||e("eventBorderColor")||o,l=t.textColor||n.textColor||e("eventTextColor"),c=[];return i&&c.push("background-color:"+i),s&&c.push("border-color:"+s),l&&c.push("color:"+l),c.join(";")}function N(e,n,r){if(t.isFunction(e)&&(e=[e]),e){var a,o;for(a=0;e.length>a;a++)o=e[a].apply(n,r)||o;return o}}function Y(){for(var t=0;arguments.length>t;t++)if(void 0!==arguments[t])return arguments[t]}function O(n,r,a){var o,i,s,l,c=n[0],d=1==n.length&&"string"==typeof c;return e.isMoment(c)?(l=e.apply(null,n),c._ambigTime&&(l._ambigTime=!0),c._ambigZone&&(l._ambigZone=!0)):h(c)||void 0===c?l=e.apply(null,n):(o=!1,i=!1,d?Ne.test(c)?(c+="-01",n=[c],o=!0,i=!0):(s=Ye.exec(c))&&(o=!s[5],i=!0):t.isArray(c)&&(i=!0),l=r?e.utc.apply(e,n):e.apply(null,n),o?(l._ambigTime=!0,l._ambigZone=!0):a&&(i?l._ambigZone=!0:d&&l.zone(c))),new W(l)}function W(t){f(this,t)}function L(t){var e,n=[],r=!1,a=!1;for(e=0;t.length>e;e++)n.push(Re.moment(t[e])),r=r||n[e]._ambigTime,a=a||n[e]._ambigZone;for(e=0;n.length>e;e++)r?n[e].stripTime():a&&n[e].stripZone();return n}function Z(t,n){return e.fn.format.call(t,n)}function B(t,e){return P(t,V(e))}function P(t,e){var n,r="";for(n=0;e.length>n;n++)r+=j(t,e[n]);return r}function j(t,e){var n,r;return"string"==typeof e?e:(n=e.token)?Oe[n]?Oe[n](t):Z(t,n):e.maybe&&(r=P(t,e.maybe),r.match(/[1-9]/))?r:""}function I(t,e,n,r,a){return t=Re.moment.parseZone(t),e=Re.moment.parseZone(e),n=t.lang().longDateFormat(n)||n,r=r||" - ",q(t,e,V(n),r,a)}function q(t,e,n,r,a){var o,i,s,l,c="",d="",u="",f="",v="";for(i=0;n.length>i&&(o=$(t,e,n[i]),o!==!1);i++)c+=o;for(s=n.length-1;s>i&&(o=$(t,e,n[s]),o!==!1);s--)d=o+d;for(l=i;s>=l;l++)u+=j(t,n[l]),f+=j(e,n[l]);return(u||f)&&(v=a?f+r+u:u+r+f),c+v+d}function $(t,e,n){var r,a;return"string"==typeof n?n:(r=n.token)&&(a=We[r.charAt(0)],a&&t.isSame(e,a))?Z(t,r):!1}function V(t){return t in Le?Le[t]:Le[t]=X(t)}function X(t){for(var e,n=[],r=/\[([^\]]*)\]|\(([^\)]*)\)|(LT|(\w)\4*o?)|([^\w\[\(]+)/g;e=r.exec(t);)e[1]?n.push(e[1]):e[2]?n.push({maybe:X(e[2])}):e[3]?n.push({token:e[3]}):e[5]&&n.push(e[5]);return n}function U(t,e){function n(t,e){return t.clone().stripTime().add("months",e).startOf("month")}function r(t){a.intervalStart=t.clone().stripTime().startOf("month"),a.intervalEnd=a.intervalStart.clone().add("months",1),a.start=a.intervalStart.clone(),a.start=a.skipHiddenDays(a.start),a.start.startOf("week"),a.start=a.skipHiddenDays(a.start),a.end=a.intervalEnd.clone(),a.end=a.skipHiddenDays(a.end,-1,!0),a.end.add("days",(7-a.end.weekday())%7),a.end=a.skipHiddenDays(a.end,-1,!0);var n=Math.ceil(a.end.diff(a.start,"weeks",!0));"fixed"==a.opt("weekMode")&&(a.end.add("weeks",6-n),n=6),a.title=e.formatDate(a.intervalStart,a.opt("titleFormat")),a.renderBasic(n,a.getCellsPerWeek(),!0)}var a=this;a.incrementDate=n,a.render=r,J.call(a,t,e,"month")}function G(t,e){function n(t,e){return t.clone().stripTime().add("weeks",e).startOf("week")}function r(t){a.intervalStart=t.clone().stripTime().startOf("week"),a.intervalEnd=a.intervalStart.clone().add("weeks",1),a.start=a.skipHiddenDays(a.intervalStart),a.end=a.skipHiddenDays(a.intervalEnd,-1,!0),a.title=e.formatRange(a.start,a.end.clone().subtract(1),a.opt("titleFormat")," — "),a.renderBasic(1,a.getCellsPerWeek(),!1)}var a=this;a.incrementDate=n,a.render=r,J.call(a,t,e,"basicWeek")}function Q(t,e){function n(t,e){var n=t.clone().stripTime().add("days",e);return n=a.skipHiddenDays(n,0>e?-1:1)}function r(t){a.start=a.intervalStart=t.clone().stripTime(),a.end=a.intervalEnd=a.start.clone().add("days",1),a.title=e.formatDate(a.start,a.opt("titleFormat")),a.renderBasic(1,1,!1)}var a=this;a.incrementDate=n,a.render=r,J.call(a,t,e,"basicDay")}function J(e,n,r){function a(t,e,n){U=t,G=e,Q=n,o(),W||i(),s()}function o(){re=ie("theme")?"ui":"fc",ae=ie("columnFormat"),oe=ie("weekNumbers")}function i(){I=t("
").appendTo(e)}function s(){var n=l();N&&N.remove(),N=t(n).appendTo(e),Y=N.find("thead"),O=Y.find(".fc-day-header"),W=N.find("tbody"),L=W.find("tr"),Z=W.find(".fc-day"),B=L.find("td:first-child"),P=L.eq(0).find(".fc-day > div"),j=L.eq(0).find(".fc-day-content > div"),F(Y.add(Y.find("tr"))),F(L),L.eq(0).addClass("fc-first"),L.filter(":last").addClass("fc-last"),Z.each(function(e,n){var r=ue(Math.floor(e/G),e%G);se("dayRender",A,r,t(n))}),h(Z)}function l(){var t=""+c()+d()+"
";return t}function c(){var t,e,n=re+"-widget-header",r="";for(r+="
"+R(ie("weekNumberTitle"))+""+R(he(e,ae))+"
"+"
"+R(pe(n))+"
"+"
"+"
",Q&&(a+="
"+t.date()+"
"),a+="
 
"+""+""+""+"
"+(Le("allDayHTML")||R(Le("allDayText")))+""+"
"+"
 
",re=t(r).appendTo(ee),ae=re.find("tr"),y(ae.find("td")),ee.append("
"+"
"+"
")):ne=t([]),ie=t("
").appendTo(ee),se=t("
").appendTo(ie),le=t("
").appendTo(se),r="",a=e.duration(+Ye),Me=0;Oe>a;)o=q.start.clone().time(a),i=o.minutes(),r+=""+""+""+"",a.add(me),Me++;r+="
"+(d&&i?" ":R(Ge(o,Le("axisFormat"))))+""+"
 
"+"
",ce=t(r).appendTo(se),b(ce.find("td"))}function l(){var e=c();$&&$.remove(),$=t(e).appendTo(n),V=$.find("thead"),X=V.find("th").slice(1,-1),U=$.find("tbody"),G=U.find("td").slice(0,-1),Q=G.find("> div"),J=G.find(".fc-day-content > div"),K=G.eq(0),te=Q.eq(0),F(V.add(V.find("tr"))),F(U.add(U.find("tr")))}function c(){var t=""+d()+u()+"
";return t}function d(){var t,e,n,r=Fe+"-widget-header",a="";for(a+="",Le("weekNumbers")?(t=Ve(0,0),e=Qe(t),Ne?e+=Le("weekNumberTitle"):e=Le("weekNumberTitle")+e,a+=""+R(e)+""):a+=" ",n=0;xe>n;n++)t=Ve(0,n),a+=""+R(Ge(t,We))+"";return a+=" "+""+""}function u(){var t,e,n,a,o,i=Fe+"-widget-header",s=Fe+"-widget-content",l=r.getNow().stripTime(),c="";for(c+=" ",n="",e=0;xe>e;e++)t=Ve(0,e),o=["fc-col"+e,"fc-"+Ae[t.day()],s],t.isSame(l,"day")?o.push(Fe+"-state-highlight","fc-today"):l>t?o.push("fc-past"):o.push("fc-future"),a=""+"
"+"
"+"
 
"+"
"+"
"+"",n+=a;return c+=n,c+=" "+""+""}function f(t){void 0===t&&(t=fe),fe=t,Je={};var e=U.position().top,n=ie.position().top,r=Math.min(t-e,ce.height()+n+1);te.height(r-T(K)),ee.css("top",e),ie.height(r-n-1);var a=ce.find("tr:first").height()+1,o=ce.find("tr:eq(1)").height();ye=(a+o)/2,De=me/be,Se=ye/De}function v(e){ue=e,_e.clear(),He.clear();var n=V.find("th:first");re&&(n=n.add(re.find("th:first"))),n=n.add(ce.find("th:first")),ve=0,g(n.width("").each(function(e,n){ve=Math.max(ve,t(n).outerWidth())}),ve);var r=$.find(".fc-agenda-gutter");re&&(r=r.add(re.find("th.fc-agenda-gutter")));var a=ie[0].clientWidth;pe=ie.width()-a,pe?(g(r,pe),r.show().prev().removeClass("fc-last")):r.hide().prev().addClass("fc-last"),he=Math.floor((a-ve)/xe),g(X.slice(0,-1),he)}function h(){function t(){ie.scrollTop(n)}var n=Y(e.duration(Le("scrollTime")))+1;t(),setTimeout(t,0)}function p(){h()}function y(t){t.click(D).mousedown(qe)}function b(t){t.click(D).mousedown(B)}function D(t){if(!Le("selectable")){var e=Math.min(xe-1,Math.floor((t.pageX-$.offset().left-ve)/he)),n=Ve(0,e),a=this.parentNode.className.match(/fc-slot(\d+)/);if(a){var o=parseInt(a[1],10);n.add(Ye+o*me),n=r.rezoneDate(n),Ze("dayClick",G[e],n,t)}else Ze("dayClick",G[e],n,t)}}function w(t,e,n){n&&ze.build();for(var r=Ue(t,e),a=0;r.length>a;a++){var o=r[a];y(C(o.row,o.leftCol,o.row,o.rightCol))}}function C(t,e,n,r){var a=ze.rect(t,e,n,r,ee);return Be(a,ee)}function E(t,e){t=t.clone().stripZone(),e=e.clone().stripZone();for(var n=0;xe>n;n++){var r=Ve(0,n),a=r.clone().add("days",1),o=t>r?t:r,i=e>a?a:e;if(i>o){var s=ze.rect(0,n,0,n,se),l=N(o,r),c=N(i,r);s.top=l,s.height=c-l,b(Be(s,se))}}}function S(t){return _e.left(t)}function k(t){return He.left(t)}function M(t){return _e.right(t)}function z(t){return He.right(t)}function _(t){return Le("allDaySlot")&&!t.row}function A(t){var n=Ve(0,t.col),a=t.row;return Le("allDaySlot")&&a--,a>=0&&(n.time(e.duration(Ye+a*be)),n=r.rezoneDate(n)),n}function N(t,n){return Y(e.duration(t.clone().stripZone()-n.clone().stripTime()))}function Y(t){if(Ye>t)return 0;if(t>=Oe)return ce.height();var e=(t-Ye)/me,n=Math.floor(e),r=e-n,a=Je[n];void 0===a&&(a=Je[n]=ce.find("tr").eq(n).find("td div")[0].offsetTop);var o=a-1+r*ye;return o=Math.max(o,0)}function O(t){return t.hasTime()?t.clone().add(me):t.clone().add("days",1)}function W(t,e){t.hasTime()||e.hasTime()?L(t,e):Le("allDaySlot")&&w(t,e,!0)}function L(e,n){var r=Le("selectHelper");if(ze.build(),r){var a=Xe(e).col;if(a>=0&&xe>a){var o=ze.rect(0,a,0,a,se),i=N(e,e),s=N(n,e);if(s>i){if(o.top=i,o.height=s-i,o.left+=2,o.width-=5,t.isFunction(r)){var l=r(e,n);l&&(o.position="absolute",de=t(l).css(o).appendTo(se))}else o.isStart=!0,o.isEnd=!0,de=t($e({title:"",start:e,end:n,className:["fc-select-helper"],editable:!1},o)),de.css("opacity",Le("dragOpacity"));de&&(b(de),se.append(de),g(de,o.width,!0),m(de,o.height,!0))}}}else E(e,n)}function Z(){Pe(),de&&(de.remove(),de=null)}function B(e){if(1==e.which&&Le("selectable")){Ie(e);var n;Re.start(function(t,e){if(Z(),t&&t.col==e.col&&!_(t)){var r=A(e),a=A(t);n=[r,r.clone().add(be),a,a.clone().add(be)].sort(x),L(n[0],n[3])}else n=null},e),t(document).one("mouseup",function(t){Re.stop(),n&&(+n[0]==+n[1]&&P(n[0],t),je(n[0],n[3],t))})}}function P(t,e){Ze("dayClick",G[Xe(t).col],t,e)}function j(t,e){Re.start(function(t){if(Pe(),t){var e=A(t),n=e.clone();e.hasTime()?(n.add(r.defaultTimedEventDuration),E(e,n)):(n.add(r.defaultAllDayEventDuration),w(e,n))}},e)}function I(t,e,n){var r=Re.stop();Pe(),r&&Ze("drop",t,A(r),e,n)}var q=this;q.renderAgenda=o,q.setWidth=v,q.setHeight=f,q.afterRender=p,q.computeDateTop=N,q.getIsCellAllDay=_,q.allDayRow=function(){return ae},q.getCoordinateGrid=function(){return ze},q.getHoverListener=function(){return Re},q.colLeft=S,q.colRight=M,q.colContentLeft=k,q.colContentRight=z,q.getDaySegmentContainer=function(){return ne},q.getSlotSegmentContainer=function(){return le},q.getSlotContainer=function(){return se},q.getRowCnt=function(){return 1},q.getColCnt=function(){return xe},q.getColWidth=function(){return he},q.getSnapHeight=function(){return Se},q.getSnapDuration=function(){return be},q.getSlotHeight=function(){return ye},q.getSlotDuration=function(){return me},q.getMinTime=function(){return Ye},q.getMaxTime=function(){return Oe},q.defaultSelectionEnd=O,q.renderDayOverlay=w,q.renderSelection=W,q.clearSelection=Z,q.reportDayClick=P,q.dragStart=j,q.dragStop=I,ge.call(q,n,r,a),Te.call(q),we.call(q),oe.call(q);var $,V,X,U,G,Q,J,K,te,ee,ne,re,ae,ie,se,le,ce,de,ue,fe,ve,he,pe,me,ye,be,De,Se,xe,Me,ze,Re,_e,He,Fe,Ne,Ye,Oe,We,Le=q.opt,Ze=q.trigger,Be=q.renderOverlay,Pe=q.clearOverlays,je=q.reportSelection,Ie=q.unselect,qe=q.daySelectionMousedown,$e=q.slotSegHtml,Ve=q.cellToDate,Xe=q.dateToCell,Ue=q.rangeToSegments,Ge=r.formatDate,Qe=r.calculateWeekNumber,Je={}; -H(n.addClass("fc-agenda")),ze=new Ce(function(e,n){function r(t){return Math.max(l,Math.min(c,t))}var a,o,i;X.each(function(e,r){a=t(r),o=a.offset().left,e&&(i[1]=o),i=[o],n[e]=i}),i[1]=o+a.outerWidth(),Le("allDaySlot")&&(a=ae,o=a.offset().top,e[0]=[o,o+a.outerHeight()]);for(var s=se.offset().top,l=ie.offset().top,c=l+ie.outerHeight(),d=0;Me*De>d;d++)e.push([r(s+Se*d),r(s+Se*(d+1))])}),Re=new Ee(ze),_e=new ke(function(t){return Q.eq(t)}),He=new ke(function(t){return J.eq(t)})}function oe(){function n(t,e){var n,r=t.length,o=[],s=[];for(n=0;r>n;n++)t[n].allDay?o.push(t[n]):s.push(t[n]);v("allDaySlot")&&(V(o,e),w()),i(a(s),e)}function r(){C().empty(),E().empty()}function a(t){var e,n,r,a,i,s=H(),l=X(),c=U(),d=[];for(n=0;s>n;n++)for(e=_(0,n),i=o(t,e.clone().time(l),e.clone().time(c)),i=ie(i),r=0;i.length>r;r++)a=i[r],a.col=n,d.push(a);return d}function o(t,e,n){e=e.clone().stripZone(),n=n.clone().stripZone();var r,a,o,i,s,l,c,d,u=[],f=t.length;for(r=0;f>r;r++)a=t[r],o=a.start.clone().stripZone(),i=J(a).stripZone(),i>e&&n>o&&(e>o?(s=e.clone(),c=!1):(s=o,c=!0),i>n?(l=n.clone(),d=!1):(l=i,d=!0),u.push({event:a,start:s,end:l,isStart:c,isEnd:d}));return u.sort(pe)}function i(e,n){var r,a,o,i,c,d,u,f,g,m,b,D,w,C,S,x,R=e.length,_="",H=E(),F=v("isRTL");for(r=0;R>r;r++)a=e[r],o=a.event,i=k(a.start,a.start),c=k(a.end,a.start),d=M(a.col),u=z(a.col),f=u-d,u-=.025*f,f=u-d,g=f*(a.forwardCoord-a.backwardCoord),v("slotEventOverlap")&&(g=Math.max(2*(g-10),g)),F?(b=u-a.backwardCoord*f,m=b-g):(m=d+a.backwardCoord*f,b=m+g),m=Math.max(m,d),b=Math.min(b,u),g=b-m,a.top=i,a.left=m,a.outerWidth=g,a.outerHeight=c-i,_+=s(o,a);for(H[0].innerHTML=_,D=H.children(),r=0;R>r;r++)a=e[r],o=a.event,w=t(D[r]),C=h("eventRender",o,o,w),C===!1?w.remove():(C&&C!==!0&&(w.remove(),w=t(C).css({position:"absolute",top:a.top,left:a.left}).appendTo(H)),a.element=w,o._id===n?l(o,w,a):w[0]._fci=r,Z(o,w));for(p(H,e,l),r=0;R>r;r++)a=e[r],(w=a.element)&&(a.vsides=T(w,!0),a.hsides=y(w,!0),S=w.find(".fc-event-title"),S.length&&(a.contentTop=S[0].offsetTop));for(r=0;R>r;r++)a=e[r],(w=a.element)&&(w[0].style.width=Math.max(0,a.outerWidth-a.hsides)+"px",x=Math.max(0,a.outerHeight-a.vsides),w[0].style.height=x+"px",o=a.event,void 0!==a.contentTop&&10>x-a.contentTop&&(w.find("div.fc-event-time").text(Q(o.start,v("timeFormat"))+" - "+o.title),w.find("div.fc-event-title").remove()),h("eventAfterRender",o,o,w))}function s(t,e){var n="<",r=t.url,a=A(t,v),o=["fc-event","fc-event-vert"];return g(t)&&o.push("fc-event-draggable"),e.isStart&&o.push("fc-event-start"),e.isEnd&&o.push("fc-event-end"),o=o.concat(t.className),t.source&&(o=o.concat(t.source.className||[])),n+=r?"a href='"+R(t.url)+"'":"div",n+=" class='"+o.join(" ")+"'"+" style="+"'"+"position:absolute;"+"top:"+e.top+"px;"+"left:"+e.left+"px;"+a+"'"+">"+"
"+"
"+R(f.getEventTimeText(t))+"
"+"
"+R(t.title||"")+"
"+"
"+"
",e.isEnd&&b(t)&&(n+="
=
"),n+=""}function l(t,e,n){var r=e.find("div.fc-event-time");g(t)&&d(t,e,r),n.isEnd&&b(t)&&u(t,e,r),D(t,e)}function c(t,n,r){function a(){c||(n.width(o).height("").draggable("option","grid",null),c=!0)}var o,i,s,l=r.isStart,c=!0,d=S(),u=F(),f=X(),p=W(),g=O(),y=Y(),b=N();n.draggable({opacity:v("dragOpacity","month"),revertDuration:v("dragRevertDuration"),start:function(e,r){h("eventDragStart",n[0],t,e,r),P(t,n),o=n.width(),d.start(function(e,r){if($(),e){i=!1;var o=_(0,r.col),d=_(0,e.col);s=d.diff(o,"days"),e.row?l?c&&(n.width(u-10),m(n,G.defaultTimedEventDuration/p*g),n.draggable("option","grid",[u,1]),c=!1):i=!0:(q(t.start.clone().add("days",s),J(t).add("days",s)),a()),i=i||c&&!s}else a(),i=!0;n.draggable("option","revert",i)},e,"drag")},stop:function(r,o){if(d.stop(),$(),h("eventDragStop",n[0],t,r,o),i)a(),n.css("filter",""),B(t,n);else{var l,u,v=t.start.clone().add("days",s);c||(u=Math.round((n.offset().top-L().offset().top)/b),l=e.duration(f+u*y),v=G.rezoneDate(v.clone().time(l))),j(n[0],t,v,r,o)}}})}function d(t,e,n){function r(){$(),s&&(c?(n.hide(),e.draggable("option","grid",null),q(b,D)):(a(),n.css("display",""),e.draggable("option","grid",[C,E])))}function a(){b&&n.text(f.getEventTimeText(b,t.end?D:null))}var o,i,s,l,c,d,u,p,g,m,y,b,D,w=f.getCoordinateGrid(),T=H(),C=F(),E=N(),S=Y();e.draggable({scroll:!1,grid:[C,E],axis:1==T?"y":!1,opacity:v("dragOpacity"),revertDuration:v("dragRevertDuration"),start:function(n,r){h("eventDragStart",e[0],t,n,r),P(t,e),w.build(),o=e.position(),i=w.cell(n.pageX,n.pageY),s=l=!0,c=d=x(i),u=p=0,g=0,m=y=0,b=null,D=null},drag:function(n,a){var f=w.cell(n.pageX,n.pageY);if(s=!!f){if(c=x(f),u=Math.round((a.position.left-o.left)/C),u!=p){var v=_(0,i.col),h=i.col+u;h=Math.max(0,h),h=Math.min(T-1,h);var k=_(0,h);g=k.diff(v,"days")}c||(m=Math.round((a.position.top-o.top)/E))}(s!=l||c!=d||u!=p||m!=y)&&(c?(b=t.start.clone().stripTime().add("days",g),D=b.clone().add(G.defaultAllDayEventDuration)):(b=t.start.clone().add(m*S).add("days",g),D=J(t).add(m*S).add("days",g)),r(),l=s,d=c,p=u,y=m),e.draggable("option","revert",!s)},stop:function(n,a){$(),h("eventDragStop",e[0],t,n,a),s&&(c||g||m)?j(e[0],t,b,n,a):(s=!0,c=!1,u=0,g=0,m=0,r(),e.css("filter",""),e.css(o),B(t,e))}})}function u(t,e,n){var r,a,o,i=N(),s=Y();e.resizable({handles:{s:".ui-resizable-handle"},grid:i,start:function(n,o){r=a=0,P(t,e),h("eventResizeStart",e[0],t,n,o)},resize:function(l,c){if(r=Math.round((Math.max(i,e.height())-c.originalSize.height)/i),r!=a){o=J(t).add(s*r);var d;d=r?f.getEventTimeText(t.start,o):f.getEventTimeText(t),n.text(d),a=r}},stop:function(n,a){h("eventResizeStop",e[0],t,n,a),r?I(e[0],t,o,n,a):B(t,e)}})}var f=this;f.renderEvents=n,f.clearEvents=r,f.slotSegHtml=s,me.call(f);var v=f.opt,h=f.trigger,g=f.isEventDraggable,b=f.isEventResizable,D=f.eventElementHandlers,w=f.setHeight,C=f.getDaySegmentContainer,E=f.getSlotSegmentContainer,S=f.getHoverListener,k=f.computeDateTop,x=f.getIsCellAllDay,M=f.colContentLeft,z=f.colContentRight,_=f.cellToDate,H=f.getColCnt,F=f.getColWidth,N=f.getSnapHeight,Y=f.getSnapDuration,O=f.getSlotHeight,W=f.getSlotDuration,L=f.getSlotContainer,Z=f.reportEventElement,B=f.showEvents,P=f.hideEvents,j=f.eventDrop,I=f.eventResize,q=f.renderDayOverlay,$=f.clearOverlays,V=f.renderDayEvents,X=f.getMinTime,U=f.getMaxTime,G=f.calendar,Q=G.formatDate,J=G.getEventEnd;f.draggableDayEvent=c}function ie(t){var e,n=se(t),r=n[0];if(le(n),r){for(e=0;r.length>e;e++)ce(r[e]);for(e=0;r.length>e;e++)de(r[e],0,0)}return ue(n)}function se(t){var e,n,r,a=[];for(e=0;t.length>e;e++){for(n=t[e],r=0;a.length>r&&fe(n,a[r]).length;r++);(a[r]||(a[r]=[])).push(n)}return a}function le(t){var e,n,r,a,o;for(e=0;t.length>e;e++)for(n=t[e],r=0;n.length>r;r++)for(a=n[r],a.forwardSegs=[],o=e+1;t.length>o;o++)fe(a,t[o],a.forwardSegs)}function ce(t){var e,n,r=t.forwardSegs,a=0;if(void 0===t.forwardPressure){for(e=0;r.length>e;e++)n=r[e],ce(n),a=Math.max(a,1+n.forwardPressure);t.forwardPressure=a}}function de(t,e,n){var r,a=t.forwardSegs;if(void 0===t.forwardCoord)for(a.length?(a.sort(he),de(a[0],e+1,n),t.forwardCoord=a[0].backwardCoord):t.forwardCoord=1,t.backwardCoord=t.forwardCoord-(t.forwardCoord-n)/(e+1),r=0;a.length>r;r++)de(a[r],0,t.forwardCoord)}function ue(t){var e,n,r,a=[];for(e=0;t.length>e;e++)for(n=t[e],r=0;n.length>r;r++)a.push(n[r]);return a}function fe(t,e,n){n=n||[];for(var r=0;e.length>r;r++)ve(t,e[r])&&n.push(e[r]);return n}function ve(t,e){return t.end>e.start&&t.startr;r++)e&&a[r][0]==e[0]||a[r][n]()}function m(t,e,n,a,o){var i=r.mutateEvent(e,n,null);s("eventDrop",t,e,i.dateDelta,function(){i.undo(),F(e._id)},a,o),F(e._id)}function y(t,e,n,a,o){var i=r.mutateEvent(e,null,n);s("eventResize",t,e,i.durationDelta,function(){i.undo(),F(e._id)},a,o),F(e._id)}function b(t){return e.isMoment(t)&&(t=t.day()),B[t]}function D(){return L}function w(t,e,n){var r=t.clone();for(e=e||1;B[(r.day()+(n?e:0)+7)%7];)r.add("days",e);return r}function T(){var t=C.apply(null,arguments),e=E(t),n=S(e);return n}function C(t,e){var n=H.getColCnt(),r=I?-1:1,a=I?n-1:0;"object"==typeof t&&(e=t.col,t=t.row);var o=t*n+(e*r+a);return o}function E(t){var e=H.start.day();return t+=P[e],7*Math.floor(t/L)+j[(t%L+L)%L]-e}function S(t){return H.start.clone().add("days",t)}function k(t){var e=x(t),n=M(e),r=R(n);return r}function x(t){return t.clone().stripTime().diff(H.start,"days")}function M(t){var e=H.start.day();return t+=e,Math.floor(t/7)*L+P[(t%7+7)%7]-P[e]}function R(t){var e=H.getColCnt(),n=I?-1:1,r=I?e-1:0,a=Math.floor(t/e),o=(t%e+e)%e*n+r;return{row:a,col:o}}function _(t,e){var n=H.getRowCnt(),r=H.getColCnt(),a=[],o=x(t),i=x(e),s=+e.time();s&&s>=W&&i++,i=Math.max(i,o+1);for(var l=M(o),c=M(i)-1,d=0;n>d;d++){var u=d*r,f=u+r-1,v=Math.max(l,u),h=Math.min(c,f);if(h>=v){var p=R(v),g=R(h),m=[p.col,g.col].sort(),y=E(v)==o,b=E(h)+1==i;a.push({row:d,leftCol:m[0],rightCol:m[1],isStart:y,isEnd:b})}}return a}var H=this;H.element=n,H.calendar=r,H.name=a,H.opt=o,H.trigger=s,H.isEventDraggable=l,H.isEventResizable=c,H.clearEventData=d,H.reportEventElement=u,H.triggerEventDestroy=f,H.eventElementHandlers=v,H.showEvents=h,H.hideEvents=p,H.eventDrop=m,H.eventResize=y;var F=r.reportEventChange,A={},N=[],O=r.options,W=e.duration(O.nextDayThreshold);H.getEventTimeText=function(t){var e,n;return 2===arguments.length?(e=arguments[0],n=arguments[1]):(e=t.start,n=t.end),n&&o("displayEventEnd")?r.formatRange(e,n,o("timeFormat")):r.formatDate(e,o("timeFormat"))},H.isHiddenDay=b,H.skipHiddenDays=w,H.getCellsPerWeek=D,H.dateToCell=k,H.dateToDayOffset=x,H.dayOffsetToCellOffset=M,H.cellOffsetToCell=R,H.cellToDate=T,H.cellToCellOffset=C,H.cellOffsetToDayOffset=E,H.dayOffsetToDate=S,H.rangeToSegments=_;var L,Z=o("hiddenDays")||[],B=[],P=[],j=[],I=o("isRTL");(function(){o("weekends")===!1&&Z.push(0,6);for(var e=0,n=0;7>e;e++)P[e]=n,B[e]=-1!=t.inArray(e,Z),B[e]||(j[n]=e,n++);if(L=n,!L)throw"invalid hiddenDays"})()}function me(){function e(t,e){var n=r(t,!1,!0);be(n,function(t,e){x(t.event,e)}),m(n,e),be(n,function(t,e){E("eventAfterRender",t.event,t.event,e)})}function n(t,e,n){var a=r([t],!0,!1),o=[];return be(a,function(t,r){t.row===e&&r.css("top",n),o.push(r[0])}),o}function r(e,n,r){var o,l,u=I(),f=n?t("
"):u,v=a(e);return i(v),o=s(v),f[0].innerHTML=o,l=f.children(),n&&u.append(l),c(v,l),be(v,function(t,e){t.hsides=y(e,!0)}),be(v,function(t,e){e.width(Math.max(0,t.outerWidth-t.hsides))}),be(v,function(t,e){t.outerHeight=e.outerHeight(!0)}),d(v,r),v}function a(t){for(var e=[],n=0;t.length>n;n++){var r=o(t[n]);e.push.apply(e,r)}return e}function o(t){for(var e=U(t.start,ne(t)),n=0;e.length>n;n++)e[n].event=t;return e}function i(t){for(var e=C("isRTL"),n=0;t.length>n;n++){var r=t[n],a=(e?r.isEnd:r.isStart)?P:Z,o=(e?r.isStart:r.isEnd)?j:B,i=a(r.leftCol),s=o(r.rightCol);r.left=i,r.outerWidth=s-i}}function s(t){for(var e="",n=0;t.length>n;n++)e+=l(t[n]);return e}function l(t){var e="",n=C("isRTL"),r=t.event,a=r.url,o=["fc-event","fc-event-hori"];S(r)&&o.push("fc-event-draggable"),t.isStart&&o.push("fc-event-start"),t.isEnd&&o.push("fc-event-end"),o=o.concat(r.className),r.source&&(o=o.concat(r.source.className||[]));var i=A(r,C);return e+=a?""+"
",!r.allDay&&t.isStart&&(e+=""+R(T.getEventTimeText(r))+""),e+=""+R(r.title||"")+""+"
",r.allDay&&t.isEnd&&k(r)&&(e+="
"+"   "+"
"),e+=""}function c(e,n){for(var r=0;e.length>r;r++){var a=e[r],o=a.event,i=n.eq(r),s=E("eventRender",o,o,i);s===!1?i.remove():(s&&s!==!0&&(s=t(s).css({position:"absolute",left:a.left}),i.replaceWith(s),i=s),a.element=i)}}function d(t,e){var n,r=u(t),a=g(),o=[];if(e)for(n=0;a.length>n;n++)a[n].height(r[n]);for(n=0;a.length>n;n++)o.push(a[n].position().top);be(t,function(t,e){e.css("top",o[t.row]+t.top)})}function u(t){for(var e,n=O(),r=W(),a=[],o=f(t),i=0;n>i;i++){var s=o[i],l=[];for(e=0;r>e;e++)l.push(0);for(var c=0;s.length>c;c++){var d=s[c];for(d.top=M(l.slice(d.leftCol,d.rightCol+1)),e=d.leftCol;d.rightCol>=e;e++)l[e]=d.top+d.outerHeight}a.push(M(l))}return a}function f(t){var e,n,r,a=O(),o=[];for(e=0;t.length>e;e++)n=t[e],r=n.row,n.element&&(o[r]?o[r].push(n):o[r]=[n]);for(r=0;a>r;r++)o[r]=v(o[r]||[]);return o}function v(t){for(var e=[],n=h(t),r=0;n.length>r;r++)e.push.apply(e,n[r]);return e}function h(t){t.sort(De);for(var e=[],n=0;t.length>n;n++){for(var r=t[n],a=0;e.length>a&&ye(r,e[a]);a++);e[a]?e[a].push(r):e[a]=[r]}return e}function g(){var t,e=O(),n=[];for(t=0;e>t;t++)n[t]=L(t).find("div.fc-day-content > div");return n}function m(t,e){var n=I();be(t,function(t,n,r){var a=t.event;a._id===e?b(a,n,t):n[0]._fci=r}),p(n,t,b)}function b(t,e,n){S(t)&&T.draggableDayEvent(t,e,n),t.allDay&&n.isEnd&&k(t)&&T.resizableDayEvent(t,e,n),z(t,e)}function D(t,e){var n,r,a=X();e.draggable({delay:50,opacity:C("dragOpacity"),revertDuration:C("dragRevertDuration"),start:function(o,i){E("eventDragStart",e[0],t,o,i),F(t,e),a.start(function(a,o,i,s){if(e.draggable("option","revert",!a||!i&&!s),$(),a){var l=G(o),c=G(a);n=c.diff(l,"days"),r=t.start.clone().add("days",n),q(r,ne(t).add("days",n))}else n=0},o,"drag")},stop:function(o,i){a.stop(),$(),E("eventDragStop",e[0],t,o,i),n?N(e[0],t,r,o,i):(e.css("filter",""),_(t,e))}})}function w(e,r,a){var o=C("isRTL"),i=o?"w":"e",s=r.find(".ui-resizable-"+i),l=!1;H(r),r.mousedown(function(t){t.preventDefault()}).click(function(t){l&&(t.preventDefault(),t.stopImmediatePropagation())}),s.mousedown(function(o){function s(n){E("eventResizeStop",r[0],e,n,{}),t("body").css("cursor",""),f.stop(),$(),c&&Y(r[0],e,d,n,{}),setTimeout(function(){l=!1},0)}if(1==o.which){l=!0;var c,d,u,f=X(),v=r.css("top"),h=t.extend({},e),p=te(K(e.start));V(),t("body").css("cursor",i+"-resize").one("mouseup",s),E("eventResizeStart",r[0],e,o,{}),f.start(function(r,o){if(r){var s=Q(o),l=Q(r);if(l=Math.max(l,p),c=J(l)-J(s),d=ne(e).add("days",c),c){h.end=d;var f=u;u=n(h,a.row,v),u=t(u),u.find("*").css("cursor",i+"-resize"),f&&f.remove(),F(e)}else u&&(_(e),u.remove(),u=null);$(),q(e.start,d)}},o)}})}var T=this;T.renderDayEvents=e,T.draggableDayEvent=D,T.resizableDayEvent=w;var C=T.opt,E=T.trigger,S=T.isEventDraggable,k=T.isEventResizable,x=T.reportEventElement,z=T.eventElementHandlers,_=T.showEvents,F=T.hideEvents,N=T.eventDrop,Y=T.eventResize,O=T.getRowCnt,W=T.getColCnt,L=T.allDayRow,Z=T.colLeft,B=T.colRight,P=T.colContentLeft,j=T.colContentRight,I=T.getDaySegmentContainer,q=T.renderDayOverlay,$=T.clearOverlays,V=T.clearSelection,X=T.getHoverListener,U=T.rangeToSegments,G=T.cellToDate,Q=T.cellToCellOffset,J=T.cellOffsetToDayOffset,K=T.dateToDayOffset,te=T.dayOffsetToCellOffset,ee=T.calendar,ne=ee.getEventEnd}function ye(t,e){for(var n=0;e.length>n;n++){var r=e[n];if(r.leftCol<=t.rightCol&&r.rightCol>=t.leftCol)return!0}return!1}function be(t,e){for(var n=0;t.length>n;n++){var r=t[n],a=r.element;a&&e(r,a,n)}}function De(t,e){return e.rightCol-e.leftCol-(t.rightCol-t.leftCol)||e.event.allDay-t.event.allDay||t.event.start-e.event.start||(t.event.title||"").localeCompare(e.event.title)}function we(){function e(e){var n=c("unselectCancel");n&&t(e.target).parents(n).length||r(e)}function n(t,e){r(),t=l.moment(t),e=e?l.moment(e):u(t),f(t,e),a(t,e)}function r(t){h&&(h=!1,v(),d("unselect",null,t))}function a(t,e,n){h=!0,d("select",null,t,e,n)}function o(e){var n=s.cellToDate,o=s.getIsCellAllDay,i=s.getHoverListener(),l=s.reportDayClick;if(1==e.which&&c("selectable")){r(e);var d;i.start(function(t,e){v(),t&&o(t)?(d=[n(e),n(t)].sort(x),f(d[0],d[1].clone().add("days",1))):d=null},e),t(document).one("mouseup",function(t){i.stop(),d&&(+d[0]==+d[1]&&l(d[0],t),a(d[0],d[1].clone().add("days",1),t))})}}function i(){t(document).off("mousedown",e)}var s=this;s.select=n,s.unselect=r,s.reportSelection=a,s.daySelectionMousedown=o,s.selectionManagerDestroy=i;var l=s.calendar,c=s.opt,d=s.trigger,u=s.defaultSelectionEnd,f=s.renderSelection,v=s.clearSelection,h=!1;c("selectable")&&c("unselectAuto")&&t(document).on("mousedown",e)}function Te(){function e(e,n){var r=o.shift();return r||(r=t("
")),r[0].parentNode!=n[0]&&r.appendTo(n),a.push(r.css(e).show()),r}function n(){for(var t;t=a.shift();)o.push(t.hide().unbind())}var r=this;r.renderOverlay=e,r.clearOverlays=n;var a=[],o=[]}function Ce(t){var e,n,r=this;r.build=function(){e=[],n=[],t(e,n)},r.cell=function(t,r){var a,o=e.length,i=n.length,s=-1,l=-1;for(a=0;o>a;a++)if(r>=e[a][0]&&e[a][1]>r){s=a;break}for(a=0;i>a;a++)if(t>=n[a][0]&&n[a][1]>t){l=a;break}return s>=0&&l>=0?{row:s,col:l}:null},r.rect=function(t,r,a,o,i){var s=i.offset();return{top:e[t][0]-s.top,left:n[r][0]-s.left,width:n[o][1]-n[r][0],height:e[a][1]-e[t][0]}}}function Ee(e){function n(t){Se(t);var n=e.cell(t.pageX,t.pageY);(Boolean(n)!==Boolean(i)||n&&(n.row!=i.row||n.col!=i.col))&&(n?(o||(o=n),a(n,o,n.row-o.row,n.col-o.col)):a(n,o),i=n)}var r,a,o,i,s=this;s.start=function(s,l,c){a=s,o=i=null,e.build(),n(l),r=c||"mousemove",t(document).bind(r,n)},s.stop=function(){return t(document).unbind(r,n),i}}function Se(t){void 0===t.pageX&&(t.pageX=t.originalEvent.pageX,t.pageY=t.originalEvent.pageY)}function ke(t){function e(e){return r[e]=r[e]||t(e)}var n=this,r={},a={},o={};n.left=function(t){return a[t]=void 0===a[t]?e(t).position().left:a[t]},n.right=function(t){return o[t]=void 0===o[t]?n.left(t)+e(t).width():o[t]},n.clear=function(){r={},a={},o={}}}var xe={lang:"en",defaultTimedEventDuration:"02:00:00",defaultAllDayEventDuration:{days:1},forceEventDuration:!1,nextDayThreshold:"09:00:00",defaultView:"month",aspectRatio:1.35,header:{left:"title",center:"",right:"today prev,next"},weekends:!0,weekNumbers:!1,weekNumberTitle:"W",weekNumberCalculation:"local",lazyFetching:!0,startParam:"start",endParam:"end",timezoneParam:"timezone",timezone:!1,titleFormat:{month:"MMMM YYYY",week:"ll",day:"LL"},columnFormat:{month:"ddd",week:r,day:"dddd"},timeFormat:{"default":n},displayEventEnd:{month:!1,basicWeek:!1,"default":!0},isRTL:!1,defaultButtonText:{prev:"prev",next:"next",prevYear:"prev year",nextYear:"next year",today:"today",month:"month",week:"week",day:"day"},buttonIcons:{prev:"left-single-arrow",next:"right-single-arrow",prevYear:"left-double-arrow",nextYear:"right-double-arrow"},theme:!1,themeButtonIcons:{prev:"circle-triangle-w",next:"circle-triangle-e",prevYear:"seek-prev",nextYear:"seek-next"},unselectAuto:!0,dropAccept:"*",handleWindowResize:!0,windowResizeDelay:200},Me={en:{columnFormat:{week:"ddd M/D"}}},ze={header:{left:"next,prev today",center:"",right:"title"},buttonIcons:{prev:"right-single-arrow",next:"left-single-arrow",prevYear:"right-double-arrow",nextYear:"left-double-arrow"},themeButtonIcons:{prev:"circle-triangle-e",next:"circle-triangle-w",nextYear:"seek-prev",prevYear:"seek-next"}},Re=t.fullCalendar={version:"2.0.2"},_e=Re.views={};t.fn.fullCalendar=function(e){var n=Array.prototype.slice.call(arguments,1),r=this;return this.each(function(a,o){var i,l=t(o),c=l.data("fullCalendar");"string"==typeof e?c&&t.isFunction(c[e])&&(i=c[e].apply(c,n),a||(r=i),"destroy"===e&&l.removeData("fullCalendar")):c||(c=new s(l,e),l.data("fullCalendar",c),c.render())}),r},Re.langs=Me,Re.datepickerLang=function(e,n,r){var a=Me[e];a||(a=Me[e]={}),o(a,{isRTL:r.isRTL,weekNumberTitle:r.weekHeader,titleFormat:{month:r.showMonthAfterYear?"YYYY["+r.yearSuffix+"] MMMM":"MMMM YYYY["+r.yearSuffix+"]"},defaultButtonText:{prev:_(r.prevText),next:_(r.nextText),today:_(r.currentText)}}),t.datepicker&&(t.datepicker.regional[n]=t.datepicker.regional[e]=r,t.datepicker.regional.en=t.datepicker.regional[""],t.datepicker.setDefaults(r))},Re.lang=function(t,e){var n;e&&(n=Me[t],n||(n=Me[t]={}),o(n,e||{})),xe.lang=t},Re.sourceNormalizers=[],Re.sourceFetchers=[];var He={dataType:"json",cache:!1},Fe=1;Re.applyAll=N;var Ae=["sun","mon","tue","wed","thu","fri","sat"],Ne=/^\s*\d{4}-\d\d$/,Ye=/^\s*\d{4}-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?)?$/;Re.moment=function(){return O(arguments)},Re.moment.utc=function(){var t=O(arguments,!0);return t.hasTime()&&t.utc(),t},Re.moment.parseZone=function(){return O(arguments,!0,!0)},W.prototype=u(e.fn),W.prototype.clone=function(){return O([this])},W.prototype.time=function(t){if(null==t)return e.duration({hours:this.hours(),minutes:this.minutes(),seconds:this.seconds(),milliseconds:this.milliseconds()});delete this._ambigTime,e.isDuration(t)||e.isMoment(t)||(t=e.duration(t));var n=0;return e.isDuration(t)&&(n=24*Math.floor(t.asDays())),this.hours(n+t.hours()).minutes(t.minutes()).seconds(t.seconds()).milliseconds(t.milliseconds())},W.prototype.stripTime=function(){var t=this.toArray();return e.fn.utc.call(this),this.year(t[0]).month(t[1]).date(t[2]).hours(0).minutes(0).seconds(0).milliseconds(0),this._ambigTime=!0,this._ambigZone=!0,this},W.prototype.hasTime=function(){return!this._ambigTime},W.prototype.stripZone=function(){var t=this.toArray(),n=this._ambigTime;return e.fn.utc.call(this),this.year(t[0]).month(t[1]).date(t[2]).hours(t[3]).minutes(t[4]).seconds(t[5]).milliseconds(t[6]),n&&(this._ambigTime=!0),this._ambigZone=!0,this},W.prototype.hasZone=function(){return!this._ambigZone},W.prototype.zone=function(t){return null!=t&&(delete this._ambigTime,delete this._ambigZone),e.fn.zone.apply(this,arguments)},W.prototype.local=function(){var t=this.toArray(),n=this._ambigZone;return delete this._ambigTime,delete this._ambigZone,e.fn.local.apply(this,arguments),n&&this.year(t[0]).month(t[1]).date(t[2]).hours(t[3]).minutes(t[4]).seconds(t[5]).milliseconds(t[6]),this},W.prototype.utc=function(){return delete this._ambigTime,delete this._ambigZone,e.fn.utc.apply(this,arguments)},W.prototype.format=function(){return arguments[0]?B(this,arguments[0]):this._ambigTime?Z(this,"YYYY-MM-DD"):this._ambigZone?Z(this,"YYYY-MM-DD[T]HH:mm:ss"):Z(this)},W.prototype.toISOString=function(){return this._ambigTime?Z(this,"YYYY-MM-DD"):this._ambigZone?Z(this,"YYYY-MM-DD[T]HH:mm:ss"):e.fn.toISOString.apply(this,arguments)},W.prototype.isWithin=function(t,e){var n=L([this,t,e]);return n[0]>=n[1]&&n[0]r;r++)t.each(arguments[r],n);return e}function i(t){return/(Time|Duration)$/.test(t)}function s(n,r){function a(t){le?v()&&(D(),y(t)):i()}function i(){ce=re.theme?"ui":"fc",n.addClass("fc"),re.isRTL?n.addClass("fc-rtl"):n.addClass("fc-ltr"),re.theme&&n.addClass("ui-widget"),le=t("
").prependTo(n),ie=new l(ee,re),se=ie.render(),se&&n.prepend(se),p(re.defaultView),re.handleWindowResize&&t(window).resize(T),h()||s()}function s(){setTimeout(function(){!de.start&&h()&&m()},0)}function d(){de&&(J("viewDestroy",de,de,de.element),de.triggerEventDestroy()),t(window).unbind("resize",T),re.droppable&&t(document).off("dragstart",K).off("dragstop",te),de.selectionManagerDestroy&&de.selectionManagerDestroy(),ie.destroy(),le.remove(),n.removeClass("fc fc-ltr fc-rtl ui-widget")}function v(){return n.is(":visible")}function h(){return t("body").is(":visible")}function p(t){de&&t==de.name||g(t)}function g(e){be++,de&&(J("viewDestroy",de,de,de.element),A(),de.triggerEventDestroy(),X(),de.element.remove(),ie.deactivateButton(de.name)),ie.activateButton(e),de=new Fe[e](t("
").appendTo(le),ee),m(),V(),be--}function m(t){de.start&&!t&&ve.isWithin(de.intervalStart,de.intervalEnd)||v()&&y(t)}function y(t){be++,de.start&&(J("viewDestroy",de,de,de.element),A(),M()),X(),t&&(ve=de.incrementDate(ve,t)),de.render(ve.clone()),w(),V(),(de.afterRender||k)(),N(),O(),J("viewRender",de,de,de.element),be--,R()}function b(){v()&&(A(),M(),D(),w(),x())}function D(){fe=re.contentHeight?re.contentHeight:re.height?re.height-(se?se.height():0)-C(le):Math.round(le.width()/Math.max(re.aspectRatio,.5))}function w(){void 0===fe&&D(),be++,de.setHeight(fe),de.setWidth(le.width()),be--,ue=n.outerWidth()}function T(t){if(!be&&t.target===window)if(de.start){var e=++ye;setTimeout(function(){e==ye&&!be&&v()&&ue!=(ue=n.outerWidth())&&(be++,b(),de.trigger("windowResize",me),be--)},re.windowResizeDelay)}else s()}function E(){M(),z()}function S(t){M(),x(t)}function x(t){v()&&(de.renderEvents(De,t),de.trigger("eventAfterAllRender"))}function M(){de.triggerEventDestroy(),de.clearEvents(),de.clearEventData()}function R(){!re.lazyFetching||pe(de.start,de.end)?z():x()}function z(){ge(de.start,de.end)}function H(t){De=t,x()}function _(t){S(t)}function N(){ie.updateTitle(de.title)}function O(){var t=ee.getNow();t.isWithin(de.intervalStart,de.intervalEnd)?ie.disableButton("today"):ie.enableButton("today")}function F(t,e){de.select(t,e)}function A(){de&&de.unselect()}function W(){m(-1)}function Y(){m(1)}function L(){ve.add("years",-1),m()}function Z(){ve.add("years",1),m()}function B(){ve=ee.getNow(),m()}function j(t){ve=ee.moment(t),m()}function I(t){ve.add(e.duration(t)),m()}function $(){return ve.clone()}function X(){le.css({width:"100%",height:le.height(),overflow:"hidden"})}function V(){le.css({width:"",height:"",overflow:""})}function G(){return ee}function U(){return de}function Q(t,e){return void 0===e?re[t]:(("height"==t||"contentHeight"==t||"aspectRatio"==t)&&(re[t]=e,b()),void 0)}function J(t,e){return re[t]?re[t].apply(e||me,Array.prototype.slice.call(arguments,2)):void 0}function K(e,n){var r=e.target,a=t(r);if(!a.parents(".fc").length){var o=re.dropAccept;(t.isFunction(o)?o.call(r,a):a.is(o))&&(he=r,de.dragStart(he,e,n))}}function te(t,e){he&&(de.dragStop(he,t,e),he=null)}var ee=this;r=r||{};var ne,re=o({},He,r);ne=re.lang in _e?_e[re.lang]:_e[He.lang],ne&&(re=o({},He,ne,r)),re.isRTL&&(re=o({},He,Ne,ne||{},r)),ee.options=re,ee.render=a,ee.destroy=d,ee.refetchEvents=E,ee.reportEvents=H,ee.reportEventChange=_,ee.rerenderEvents=S,ee.changeView=p,ee.select=F,ee.unselect=A,ee.prev=W,ee.next=Y,ee.prevYear=L,ee.nextYear=Z,ee.today=B,ee.gotoDate=j,ee.incrementDate=I,ee.getDate=$,ee.getCalendar=G,ee.getView=U,ee.option=Q,ee.trigger=J;var ae=f(e.langData(re.lang));if(re.monthNames&&(ae._months=re.monthNames),re.monthNamesShort&&(ae._monthsShort=re.monthNamesShort),re.dayNames&&(ae._weekdays=re.dayNames),re.dayNamesShort&&(ae._weekdaysShort=re.dayNamesShort),null!=re.firstDay){var oe=f(ae._week);oe.dow=re.firstDay,ae._week=oe}ee.defaultAllDayEventDuration=e.duration(re.defaultAllDayEventDuration),ee.defaultTimedEventDuration=e.duration(re.defaultTimedEventDuration),ee.moment=function(){var t;return"local"===re.timezone?(t=Oe.moment.apply(null,arguments),t.hasTime()&&t.local()):t="UTC"===re.timezone?Oe.moment.utc.apply(null,arguments):Oe.moment.parseZone.apply(null,arguments),t._lang=ae,t},ee.getIsAmbigTimezone=function(){return"local"!==re.timezone&&"UTC"!==re.timezone},ee.rezoneDate=function(t){return ee.moment(t.toArray())},ee.getNow=function(){var t=re.now;return"function"==typeof t&&(t=t()),ee.moment(t)},ee.calculateWeekNumber=function(t){var e=re.weekNumberCalculation;return"function"==typeof e?e(t):"local"===e?t.week():"ISO"===e.toUpperCase()?t.isoWeek():void 0},ee.getEventEnd=function(t){return t.end?t.end.clone():ee.getDefaultEventEnd(t.allDay,t.start)},ee.getDefaultEventEnd=function(t,e){var n=e.clone();return t?n.stripTime().add(ee.defaultAllDayEventDuration):n.add(ee.defaultTimedEventDuration),ee.getIsAmbigTimezone()&&n.stripZone(),n},ee.formatRange=function(t,e,n){return"function"==typeof n&&(n=n.call(ee,re,ae)),q(t,e,n,null,re.isRTL)},ee.formatDate=function(t,e){return"function"==typeof e&&(e=e.call(ee,re,ae)),P(t,e)},c.call(ee,re),u.call(ee,re);var ie,se,le,ce,de,ue,fe,ve,he,pe=ee.isFetchNeeded,ge=ee.fetchEvents,me=n[0],ye=0,be=0,De=[];ve=null!=re.defaultDate?ee.moment(re.defaultDate):ee.getNow(),re.droppable&&t(document).on("dragstart",K).on("dragstop",te)}function l(e,n){function r(){f=n.theme?"ui":"fc";var e=n.header;return e?v=t("").append(t("").append(o("left")).append(o("center")).append(o("right"))):void 0}function a(){v.remove()}function o(r){var a=t("",oe&&(r+=""),t=0;U>t;t++)e=ue(0,t),r+="";return r+=""}function d(){var t,e,n,r=re+"-widget-content",a="";for(a+="",t=0;G>t;t++){for(a+="",oe&&(n=ue(t,0),a+=""),e=0;U>e;e++)n=ue(t,e),a+=u(n);a+=""}return a+=""}function u(t){var e=_.intervalStart.month(),r=n.getNow().stripTime(),a="",o=re+"-widget-content",i=["fc-day","fc-"+Ye[t.day()],o];return t.month()!=e&&i.push("fc-other-month"),t.isSame(r,"day")?i.push("fc-today",re+"-state-highlight"):r>t?i.push("fc-past"):i.push("fc-future"),a+=""}function f(e){$=e;var n,r,a,o=Math.max($-A.height(),0);"variable"==ie("weekMode")?n=r=Math.floor(o/(1==G?2:6)):(n=Math.floor(o/G),r=o-n*(G-1)),B.each(function(e,o){G>e&&(a=t(o),a.find("> div").css("min-height",(e==G-1?r:n)-C(a)))})}function v(t){q=t,ee.clear(),ne.clear(),V=0,oe&&(V=A.find("th.fc-week-number").outerWidth()),X=Math.floor((q-V)/U),m(W.slice(0,-1),X)}function h(t){t.click(p).mousedown(de)}function p(e){if(!ie("selectable")){var r=n.moment(t(this).data("date"));se("dayClick",this,r,e)}}function g(t,e,n){n&&J.build();for(var r=ve(t,e),a=0;r.length>a;a++){var o=r[a];h(y(o.row,o.leftCol,o.row,o.rightCol))}}function y(t,n,r,a){var o=J.rect(t,n,r,a,e);return le(o,e)}function b(t){return t.clone().stripTime().add("days",1)}function D(t,e){g(t,e,!0)}function w(){ce()}function T(t,e){var n=fe(t),r=Z[n.row*U+n.col];se("dayClick",r,t,e)}function E(t,e){K.start(function(t){if(ce(),t){var e=ue(t),r=e.clone().add(n.defaultAllDayEventDuration);g(e,r)}},e)}function S(t,e,n){var r=K.stop();ce(),r&&se("drop",t,ue(r),e,n)}function x(t){return ee.left(t)}function k(t){return ee.right(t)}function M(t){return ne.left(t)}function R(t){return ne.right(t)}function z(t){return L.eq(t)}var _=this;_.renderBasic=a,_.setHeight=f,_.setWidth=v,_.renderDayOverlay=g,_.defaultSelectionEnd=b,_.renderSelection=D,_.clearSelection=w,_.reportDayClick=T,_.dragStart=E,_.dragStop=S,_.getHoverListener=function(){return K},_.colLeft=x,_.colRight=k,_.colContentLeft=M,_.colContentRight=R,_.getIsCellAllDay=function(){return!0},_.allDayRow=z,_.getRowCnt=function(){return G},_.getColCnt=function(){return U},_.getColWidth=function(){return X},_.getDaySegmentContainer=function(){return I},De.call(_,e,n,r),xe.call(_),Se.call(_),te.call(_);var F,A,W,Y,L,Z,B,P,j,I,q,$,X,V,G,U,Q,J,K,ee,ne,re,ae,oe,ie=_.opt,se=_.trigger,le=_.renderOverlay,ce=_.clearOverlays,de=_.daySelectionMousedown,ue=_.cellToDate,fe=_.dateToCell,ve=_.rangeToSegments,he=n.formatDate,pe=n.calculateWeekNumber;N(e.addClass("fc-grid")),J=new ke(function(e,n){var r,a,o;W.each(function(e,i){r=t(i),a=r.offset().left,e&&(o[1]=a),o=[a],n[e]=o}),o[1]=a+r.outerWidth(),L.each(function(n,i){G>n&&(r=t(i),a=r.offset().top,n&&(o[1]=a),o=[a],e[n]=o)}),o[1]=a+r.outerHeight()}),K=new Me(J),ee=new ze(function(t){return P.eq(t)}),ne=new ze(function(t){return j.eq(t)})}function te(){function t(t,e){n.renderDayEvents(t,e)}function e(){n.getDaySegmentContainer().empty()}var n=this;n.renderEvents=t,n.clearEvents=e,we.call(n)}function ee(t,e){function n(t,e){return t.clone().stripTime().add("weeks",e).startOf("week")}function r(t){a.intervalStart=t.clone().stripTime().startOf("week"),a.intervalEnd=a.intervalStart.clone().add("weeks",1),a.start=a.skipHiddenDays(a.intervalStart),a.end=a.skipHiddenDays(a.intervalEnd,-1,!0),a.title=e.formatRange(a.start,a.end.clone().subtract(1),a.opt("titleFormat")," — "),a.renderAgenda(a.getCellsPerWeek())}var a=this;a.incrementDate=n,a.render=r,oe.call(a,t,e,"agendaWeek")}function ne(t,e){function n(t,e){var n=t.clone().stripTime().add("days",e);return n=a.skipHiddenDays(n,0>e?-1:1)}function r(t){a.start=a.intervalStart=t.clone().stripTime(),a.end=a.intervalEnd=a.start.clone().add("days",1),a.title=e.formatDate(a.start,a.opt("titleFormat")),a.renderAgenda(1)}var a=this;a.incrementDate=n,a.render=r,oe.call(a,t,e,"agendaDay")}function re(t,e){return e.longDateFormat("LT").replace(":mm","(:mm)").replace(/(\Wmm)$/,"($1)").replace(/\s*a$/i,"a")}function ae(t,e){return e.longDateFormat("LT").replace(/\s*a$/i,"")}function oe(n,r,a){function o(t){Te=t,i(),$?l():s()}function i(){Ne=Le("theme")?"ui":"fc",Oe=Le("isRTL"),We=Le("columnFormat"),Fe=e.duration(Le("minTime")),Ae=e.duration(Le("maxTime")),ge=e.duration(Le("slotDuration")),ye=Le("snapDuration"),ye=ye?e.duration(ye):ge}function s(){var r,a,o,i,s=Ne+"-widget-header",c=Ne+"-widget-content",d=0===ge.asMinutes()%15;for(l(),ee=t("
").appendTo(n),Le("allDaySlot")?(ne=t("
").appendTo(ee),r="
"),o=n.header[r];return o&&t.each(o.split(" "),function(r){r>0&&a.append("");var o;t.each(this.split(","),function(r,i){if("title"==i)a.append("

 

"),o&&o.addClass(f+"-corner-right"),o=null;else{var s;if(e[i]?s=e[i]:Fe[i]&&(s=function(){h.removeClass(f+"-state-hover"),e.changeView(i)}),s){var l,c=z(n.themeButtonIcons,i),d=z(n.buttonIcons,i),u=z(n.defaultButtonText,i),v=z(n.buttonText,i);l=v?H(v):c&&n.theme?"":d&&!n.theme?"":H(u||i);var h=t(""+l+"").click(function(){h.hasClass(f+"-state-disabled")||s()}).mousedown(function(){h.not("."+f+"-state-active").not("."+f+"-state-disabled").addClass(f+"-state-down")}).mouseup(function(){h.removeClass(f+"-state-down")}).hover(function(){h.not("."+f+"-state-active").not("."+f+"-state-disabled").addClass(f+"-state-hover")},function(){h.removeClass(f+"-state-hover").removeClass(f+"-state-down")}).appendTo(a);N(h),o||h.addClass(f+"-corner-left"),o=h}}}),o&&o.addClass(f+"-corner-right")}),a}function i(t){v.find("h2").html(t)}function s(t){v.find("span.fc-button-"+t).addClass(f+"-state-active")}function l(t){v.find("span.fc-button-"+t).removeClass(f+"-state-active")}function c(t){v.find("span.fc-button-"+t).addClass(f+"-state-disabled")}function d(t){v.find("span.fc-button-"+t).removeClass(f+"-state-disabled")}var u=this;u.render=r,u.destroy=a,u.updateTitle=i,u.activateButton=s,u.deactivateButton=l,u.disableButton=c,u.enableButton=d;var f,v=t([])}function c(e){function n(t,e){return!E||t.clone().stripZone()S.clone().stripZone()}function r(t,e){E=t,S=e,F=[];var n=++_,r=H.length;N=r;for(var o=0;r>o;o++)a(H[o],n)}function a(e,n){o(e,function(r){var a,o,i=t.isArray(e.events);if(n==_){if(r)for(a=0;r.length>a;a++)o=r[a],i||(o=D(o,e)),o&&F.push(o);N--,N||M(F)}})}function o(n,r){var a,i,s=Oe.sourceFetchers;for(a=0;s.length>a;a++){if(i=s[a].call(C,n,E.clone(),S.clone(),e.timezone,r),i===!0)return;if("object"==typeof i)return o(i,r),void 0}var l=n.events;if(l)t.isFunction(l)?(y(),l.call(C,E.clone(),S.clone(),e.timezone,function(t){r(t),b()})):t.isArray(l)?r(l):r();else{var c=n.url;if(c){var d,u=n.success,f=n.error,v=n.complete;d=t.isFunction(n.data)?n.data():n.data;var h=t.extend({},d||{}),p=W(n.startParam,e.startParam),g=W(n.endParam,e.endParam),m=W(n.timezoneParam,e.timezoneParam);p&&(h[p]=E.format()),g&&(h[g]=S.format()),e.timezone&&"local"!=e.timezone&&(h[m]=e.timezone),y(),t.ajax(t.extend({},Ae,n,{data:h,success:function(e){e=e||[];var n=A(u,this,arguments);t.isArray(n)&&(e=n),r(e)},error:function(){A(f,this,arguments),r()},complete:function(){A(v,this,arguments),b()}}))}else r()}}function i(t){var e=s(t);e&&(H.push(e),N++,a(e,_))}function s(e){var n,r,a=Oe.sourceNormalizers;if(t.isFunction(e)||t.isArray(e)?n={events:e}:"string"==typeof e?n={url:e}:"object"==typeof e&&(n=t.extend({},e),"string"==typeof n.className&&(n.className=n.className.split(/\s+/))),n){for(t.isArray(n.events)&&(n.events=t.map(n.events,function(t){return D(t,n)})),r=0;a.length>r;r++)a[r].call(C,n);return n}}function l(e){H=t.grep(H,function(t){return!c(t,e)}),F=t.grep(F,function(t){return!c(t.source,e)}),M(F)}function c(t,e){return t&&e&&u(t)==u(e)}function u(t){return("object"==typeof t?t.events||t.url:"")||t}function f(t){t.start=C.moment(t.start),t.end&&(t.end=C.moment(t.end)),w(t),v(t),M(F)}function v(t){var e,n,r,a;for(e=0;F.length>e;e++)if(n=F[e],n._id==t._id&&n!==t)for(r=0;Y.length>r;r++)a=Y[r],void 0!==t[a]&&(n[a]=t[a])}function p(t,e){var n=D(t);n&&(n.source||(e&&(z.events.push(n),n.source=z),F.push(n)),M(F))}function g(e){var n,r;for(null==e?e=function(){return!0}:t.isFunction(e)||(n=e+"",e=function(t){return t._id==n}),F=t.grep(F,e,!0),r=0;H.length>r;r++)t.isArray(H[r].events)&&(H[r].events=t.grep(H[r].events,e,!0));M(F)}function m(e){return t.isFunction(e)?t.grep(F,e):null!=e?(e+="",t.grep(F,function(t){return t._id==e})):F}function y(){O++||x("loading",null,!0,k())}function b(){--O||x("loading",null,!1,k())}function D(n,r){var a,o,i,s,l={};return e.eventDataTransform&&(n=e.eventDataTransform(n)),r&&r.eventDataTransform&&(n=r.eventDataTransform(n)),a=C.moment(n.start||n.date),a.isValid()&&(o=null,!n.end||(o=C.moment(n.end),o.isValid()))?(i=n.allDay,void 0===i&&(s=W(r?r.allDayDefault:void 0,e.allDayDefault),i=void 0!==s?s:!(a.hasTime()||o&&o.hasTime())),i?(a.hasTime()&&a.stripTime(),o&&o.hasTime()&&o.stripTime()):(a.hasTime()||(a=C.rezoneDate(a)),o&&!o.hasTime()&&(o=C.rezoneDate(o))),t.extend(l,n),r&&(l.source=r),l._id=n._id||(void 0===n.id?"_fc"+We++:n.id+""),l.className=n.className?"string"==typeof n.className?n.className.split(/\s+/):n.className:[],l.resources?"string"==typeof l.resources&&(l.resources=l.resources.split(/\s+/)):l.resources=[],l.allDay=i,l.start=a,l.end=o,e.forceEventDuration&&!l.end&&(l.end=R(l)),d(l),l):void 0}function w(t,e,n){var r,a,o,i,s=t._allDay,l=t._start,c=t._end,d=!1;return e||n||(e=t.start,n=t.end),r=t.allDay!=s?t.allDay:!(e||n).hasTime(),r&&(e&&(e=e.clone().stripTime()),n&&(n=n.clone().stripTime())),e&&(a=r?h(e,l.clone().stripTime()):h(e,l)),r!=s?d=!0:n&&(o=h(n||C.getDefaultEventEnd(r,e||l),e||l).subtract(h(c||C.getDefaultEventEnd(s,l),l))),i=T(m(t._id),d,r,a,o),{dateDelta:a,durationDelta:o,undo:i}}function T(n,r,a,o,i){var s=C.getIsAmbigTimezone(),l=[];return t.each(n,function(t,n){var c=n._allDay,u=n._start,f=n._end,v=null!=a?a:c,h=u.clone(),p=!r&&f?f.clone():null;v?(h.stripTime(),p&&p.stripTime()):(h.hasTime()||(h=C.rezoneDate(h)),p&&!p.hasTime()&&(p=C.rezoneDate(p))),p||!e.forceEventDuration&&!+i||(p=C.getDefaultEventEnd(v,h)),h.add(o),p&&p.add(o).add(i),s&&(+o||+i)&&(h.stripZone(),p&&p.stripZone()),n.allDay=v,n.start=h,n.end=p,d(n),l.push(function(){n.allDay=c,n.start=u,n.end=f,d(n)})}),function(){for(var t=0;l.length>t;t++)l[t]()}}var C=this;C.isFetchNeeded=n,C.fetchEvents=r,C.addEventSource=i,C.removeEventSource=l,C.updateEvent=f,C.renderEvent=p,C.removeEvents=g,C.clientEvents=m,C.mutateEvent=w;var E,S,x=C.trigger,k=C.getView,M=C.reportEvents,R=C.getEventEnd,z={events:[]},H=[z],_=0,N=0,O=0,F=[];t.each((e.events?[e.events]:[]).concat(e.eventSources||[]),function(t,e){var n=s(e);n&&H.push(n)});var Y=["title","url","allDay","className","editable","color","backgroundColor","borderColor","textColor"]}function d(t){t._allDay=t.allDay,t._start=t.start.clone(),t._end=t.end?t.end.clone():null}function u(e){function n(e){l=[];var n;if(t.isFunction(e))n={resources:e},l.push(n),s=void 0;else if("string"==typeof e)n={url:e},l.push(n),s=void 0;else if("object"==typeof e&&null!=e){for(var r=0;e.length>r;r++){var a=e[r];o(a),n={resources:a},l.push(n)}s=void 0}}function r(t,e){if(t=t!==void 0?t:!0,void 0!==s&&t)return s;s=[];for(var n=l.length,r=0;n>r;r++){var o=a(l[r],e);s=s.concat(o)}return s}function a(n,r){var a=n.resources;if(a){if(t.isFunction(a))return a()}else{var o=n.url;if(o){var i={};if("object"==typeof r){var s=e.startParam,l=e.endParam;s&&(i[s]=Math.round(+r.intervalStart/1e3)),l&&(i[l]=Math.round(+r.intervalEnd/1e3))}t.ajax(t.extend({},Ae,n,{data:i,dataType:"json",cache:!1,success:function(t){t=t||[],a=t},error:function(){},async:!1}))}}return a}function o(t){t.className?"string"==typeof t.className&&(t.className=t.className.split(/\s+/)):t.className=[];for(var e=Oe.sourceNormalizers,n=0;e.length>n;n++)e[n](t)}var i=this;i.fetchResources=r,i.setResources=n;var s,l=[];n(e.resources)}function f(t){var e=function(){};return e.prototype=t,new e}function v(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])}function h(t,n){return e.duration({days:t.clone().stripTime().diff(n.clone().stripTime(),"days"),ms:t.time()-n.time()})}function p(t){return"[object Date]"===Object.prototype.toString.call(t)||t instanceof Date}function g(e,n,r){e.unbind("mouseover").mouseover(function(e){for(var a,o,i,s=e.target;s!=this;)a=s,s=s.parentNode;void 0!==(o=a._fci)&&(a._fci=void 0,i=n[o],r(i.event,i.element,i),t(e.target).trigger(e)),e.stopPropagation()})}function m(e,n,r){for(var a,o=0;e.length>o;o++)a=t(e[o]),a.width(Math.max(0,n-b(a,r)))}function y(e,n,r){for(var a,o=0;e.length>o;o++)a=t(e[o]),a.height(Math.max(0,n-C(a,r)))}function b(t,e){return D(t)+T(t)+(e?w(t):0)}function D(e){return(parseFloat(t.css(e[0],"paddingLeft",!0))||0)+(parseFloat(t.css(e[0],"paddingRight",!0))||0)}function w(e){return(parseFloat(t.css(e[0],"marginLeft",!0))||0)+(parseFloat(t.css(e[0],"marginRight",!0))||0)}function T(e){return(parseFloat(t.css(e[0],"borderLeftWidth",!0))||0)+(parseFloat(t.css(e[0],"borderRightWidth",!0))||0)}function C(t,e){return E(t)+x(t)+(e?S(t):0)}function E(e){return(parseFloat(t.css(e[0],"paddingTop",!0))||0)+(parseFloat(t.css(e[0],"paddingBottom",!0))||0)}function S(e){return(parseFloat(t.css(e[0],"marginTop",!0))||0)+(parseFloat(t.css(e[0],"marginBottom",!0))||0)}function x(e){return(parseFloat(t.css(e[0],"borderTopWidth",!0))||0)+(parseFloat(t.css(e[0],"borderBottomWidth",!0))||0)}function k(){}function M(t,e){return t-e}function R(t){return Math.max.apply(Math,t)}function z(t,e){if(t=t||{},void 0!==t[e])return t[e];for(var n,r=e.split(/(?=[A-Z])/),a=r.length-1;a>=0;a--)if(n=t[r[a].toLowerCase()],void 0!==n)return n;return t["default"]}function H(t){return(t+"").replace(/&/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""").replace(/\n/g,"
")}function _(t){return t.replace(/&.*?;/g,"")}function N(t){t.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return!1})}function O(t){t.children().removeClass("fc-first fc-last").filter(":first-child").addClass("fc-first").end().filter(":last-child").addClass("fc-last")}function F(t,e){var n=t.source||{},r=t.color,a=n.color,o=e("eventColor"),i=t.backgroundColor||r||n.backgroundColor||a||e("eventBackgroundColor")||o,s=t.borderColor||r||n.borderColor||a||e("eventBorderColor")||o,l=t.textColor||n.textColor||e("eventTextColor"),c=[];return i&&c.push("background-color:"+i),s&&c.push("border-color:"+s),l&&c.push("color:"+l),c.join(";")}function A(e,n,r){if(t.isFunction(e)&&(e=[e]),e){var a,o;for(a=0;e.length>a;a++)o=e[a].apply(n,r)||o;return o}}function W(){for(var t=0;arguments.length>t;t++)if(void 0!==arguments[t])return arguments[t]}function Y(n,r,a){var o,i,s,l,c=n[0],d=1==n.length&&"string"==typeof c;return e.isMoment(c)?(l=e.apply(null,n),c._ambigTime&&(l._ambigTime=!0),c._ambigZone&&(l._ambigZone=!0)):p(c)||void 0===c?l=e.apply(null,n):(o=!1,i=!1,d?Le.test(c)?(c+="-01",n=[c],o=!0,i=!0):(s=Ze.exec(c))&&(o=!s[5],i=!0):t.isArray(c)&&(i=!0),l=r?e.utc.apply(e,n):e.apply(null,n),o?(l._ambigTime=!0,l._ambigZone=!0):a&&(i?l._ambigZone=!0:d&&l.zone(c))),new L(l)}function L(t){v(this,t)}function Z(t){var e,n=[],r=!1,a=!1;for(e=0;t.length>e;e++)n.push(Oe.moment(t[e])),r=r||n[e]._ambigTime,a=a||n[e]._ambigZone;for(e=0;n.length>e;e++)r?n[e].stripTime():a&&n[e].stripZone();return n}function B(t,n){return e.fn.format.call(t,n)}function P(t,e){return j(t,V(e))}function j(t,e){var n,r="";for(n=0;e.length>n;n++)r+=I(t,e[n]);return r}function I(t,e){var n,r;return"string"==typeof e?e:(n=e.token)?Be[n]?Be[n](t):B(t,n):e.maybe&&(r=j(t,e.maybe),r.match(/[1-9]/))?r:""}function q(t,e,n,r,a){return t=Oe.moment.parseZone(t),e=Oe.moment.parseZone(e),n=t.lang().longDateFormat(n)||n,r=r||" - ",$(t,e,V(n),r,a)}function $(t,e,n,r,a){var o,i,s,l,c="",d="",u="",f="",v="";for(i=0;n.length>i&&(o=X(t,e,n[i]),o!==!1);i++)c+=o;for(s=n.length-1;s>i&&(o=X(t,e,n[s]),o!==!1);s--)d=o+d;for(l=i;s>=l;l++)u+=I(t,n[l]),f+=I(e,n[l]);return(u||f)&&(v=a?f+r+u:u+r+f),c+v+d}function X(t,e,n){var r,a;return"string"==typeof n?n:(r=n.token)&&(a=Pe[r.charAt(0)],a&&t.isSame(e,a))?B(t,r):!1}function V(t){return t in je?je[t]:je[t]=G(t)}function G(t){for(var e,n=[],r=/\[([^\]]*)\]|\(([^\)]*)\)|(LT|(\w)\4*o?)|([^\w\[\(]+)/g;e=r.exec(t);)e[1]?n.push(e[1]):e[2]?n.push({maybe:G(e[2])}):e[3]?n.push({token:e[3]}):e[5]&&n.push(e[5]);return n}function U(t,e){function n(t,e){return t.clone().stripTime().add("months",e).startOf("month")}function r(t){a.intervalStart=t.clone().stripTime().startOf("month"),a.intervalEnd=a.intervalStart.clone().add("months",1),a.start=a.intervalStart.clone(),a.start=a.skipHiddenDays(a.start),a.start.startOf("week"),a.start=a.skipHiddenDays(a.start),a.end=a.intervalEnd.clone(),a.end=a.skipHiddenDays(a.end,-1,!0),a.end.add("days",(7-a.end.weekday())%7),a.end=a.skipHiddenDays(a.end,-1,!0);var n=Math.ceil(a.end.diff(a.start,"weeks",!0));"fixed"==a.opt("weekMode")&&(a.end.add("weeks",6-n),n=6),a.title=e.formatDate(a.intervalStart,a.opt("titleFormat")),a.renderBasic(n,a.getCellsPerWeek(),!0)}var a=this;a.incrementDate=n,a.render=r,K.call(a,t,e,"month")}function Q(t,e){function n(t,e){return t.clone().stripTime().add("weeks",e).startOf("week")}function r(t){a.intervalStart=t.clone().stripTime().startOf("week"),a.intervalEnd=a.intervalStart.clone().add("weeks",1),a.start=a.skipHiddenDays(a.intervalStart),a.end=a.skipHiddenDays(a.intervalEnd,-1,!0),a.title=e.formatRange(a.start,a.end.clone().subtract(1),a.opt("titleFormat")," — "),a.renderBasic(1,a.getCellsPerWeek(),!1)}var a=this;a.incrementDate=n,a.render=r,K.call(a,t,e,"basicWeek")}function J(t,e){function n(t,e){var n=t.clone().stripTime().add("days",e);return n=a.skipHiddenDays(n,0>e?-1:1)}function r(t){a.start=a.intervalStart=t.clone().stripTime(),a.end=a.intervalEnd=a.start.clone().add("days",1),a.title=e.formatDate(a.start,a.opt("titleFormat")),a.renderBasic(1,1,!1)}var a=this;a.incrementDate=n,a.render=r,K.call(a,t,e,"basicDay")}function K(e,n,r){function a(t,e,n){G=t,U=e,Q=n,o(),Y||i(),s()}function o(){re=ie("theme")?"ui":"fc",ae=ie("columnFormat"),oe=ie("weekNumbers")}function i(){I=t("
").appendTo(e)}function s(){var n=l();F&&F.remove(),F=t(n).appendTo(e),A=F.find("thead"),W=A.find(".fc-day-header"),Y=F.find("tbody"),L=Y.find("tr"),Z=Y.find(".fc-day"),B=L.find("td:first-child"),P=L.eq(0).find(".fc-day > div"),j=L.eq(0).find(".fc-day-content > div"),O(A.add(A.find("tr"))),O(L),L.eq(0).addClass("fc-first"),L.filter(":last").addClass("fc-last"),Z.each(function(e,n){var r=ue(Math.floor(e/U),e%U);se("dayRender",_,r,t(n))}),h(Z)}function l(){var t=""+c()+d()+"
";return t}function c(){var t,e,n=re+"-widget-header",r="";for(r+="
"+H(ie("weekNumberTitle"))+""+H(he(e,ae))+"
"+"
"+H(pe(n))+"
"+"
"+"
",Q&&(a+="
"+t.date()+"
"),a+="
 
"+""+""+""+"
"+(Le("allDayHTML")||H(Le("allDayText")))+""+"
"+"
 
",re=t(r).appendTo(ee),ae=re.find("tr"),g(ae.find("td")),ee.append("
"+"
"+"
")):ne=t([]),oe=t("
").appendTo(ee),se=t("
").appendTo(oe),le=t("
").appendTo(se),r="",a=e.duration(+Fe),Ce=0;Ae>a;)o=q.start.clone().time(a),i=o.minutes(),r+=""+""+""+"",a.add(ge),Ce++;r+="
"+(d&&i?" ":H(Ue(o,Le("axisFormat"))))+""+"
 
"+"
",ce=t(r).appendTo(se),b(ce.find("td"))}function l(){var e=c();$&&$.remove(),$=t(e).appendTo(n),X=$.find("thead"),V=X.find("th").slice(1,-1),G=$.find("tbody"),U=G.find("td").slice(0,-1),Q=U.find("> div"),J=U.find(".fc-day-content > div"),K=U.eq(0),te=Q.eq(0),O(X.add(X.find("tr"))),O(G.add(G.find("tr")))}function c(){var t=""+d()+u()+"
";return t}function d(){var t,e,n,r=Ne+"-widget-header",a="";for(a+="",Le("weekNumbers")?(t=Xe(0,0),e=Qe(t),Oe?e+=Le("weekNumberTitle"):e=Le("weekNumberTitle")+e,a+=""+H(e)+""):a+=" ",n=0;Te>n;n++)t=Xe(0,n),a+=""+H(Ue(t,We))+"";return a+=" "+""+""}function u(){var t,e,n,a,o,i=Ne+"-widget-header",s=Ne+"-widget-content",l=r.getNow().stripTime(),c="";for(c+=" ",n="",e=0;Te>e;e++)t=Xe(0,e),o=["fc-col"+e,"fc-"+Ye[t.day()],s],t.isSame(l,"day")?o.push(Ne+"-state-highlight","fc-today"):l>t?o.push("fc-past"):o.push("fc-future"),a=""+"
"+"
"+"
 
"+"
"+"
"+"",n+=a;return c+=n,c+=" "+""+""}function f(t){void 0===t&&(t=fe),fe=t,Je={};var e=G.position().top,n=oe.position().top,r=Math.min(t-e,ce.height()+n+1);te.height(r-C(K)),ee.css("top",e),oe.height(r-n-1);var a=ce.find("tr:first").height()+1,o=ce.find("tr:eq(1)").height();me=(a+o)/2,be=ge/ye,we=me/be}function v(e){ue=e,He.clear(),_e.clear();var n=X.find("th:first");re&&(n=n.add(re.find("th:first"))),n=n.add(ce.find("th:first")),ve=0,m(n.width("").each(function(e,n){ve=Math.max(ve,t(n).outerWidth())}),ve);var r=$.find(".fc-agenda-gutter");re&&(r=r.add(re.find("th.fc-agenda-gutter")));var a=oe[0].clientWidth;pe=oe.width()-a,pe?(m(r,pe),r.show().prev().removeClass("fc-last")):r.hide().prev().addClass("fc-last"),he=Math.floor((a-ve)/Te),m(V.slice(0,-1),he)}function h(){function t(){oe.scrollTop(n)}var n=A(e.duration(Le("scrollTime")))+1;t(),setTimeout(t,0)}function p(){h()}function g(t){t.click(D).mousedown(qe)}function b(t){t.click(D).mousedown(B)}function D(t){if(!Le("selectable")){var e=Math.min(Te-1,Math.floor((t.pageX-$.offset().left-ve)/he)),n=Xe(0,e),a=this.parentNode.className.match(/fc-slot(\d+)/);if(a){var o=parseInt(a[1],10);n.add(Fe+o*ge),n=r.rezoneDate(n),Ze("dayClick",U[e],n,t)}else Ze("dayClick",U[e],n,t)}}function w(t,e,n){n&&Ee.build();for(var r=Ge(t,e),a=0;r.length>a;a++){var o=r[a];g(T(o.row,o.leftCol,o.row,o.rightCol))}}function T(t,e,n,r){var a=Ee.rect(t,e,n,r,ee);return Be(a,ee)}function E(t,e){t=t.clone().stripZone(),e=e.clone().stripZone();for(var n=0;Te>n;n++){var r=Xe(0,n),a=r.clone().add("days",1),o=t>r?t:r,i=e>a?a:e;if(i>o){var s=Ee.rect(0,n,0,n,se),l=F(o,r),c=F(i,r);s.top=l,s.height=c-l,b(Be(s,se))}}}function S(t){return He.left(t)}function x(t){return _e.left(t)}function k(t){return He.right(t)}function R(t){return _e.right(t)}function z(t){return Le("allDaySlot")&&!t.row}function _(t){var n=Xe(0,t.col),a=t.row;return Le("allDaySlot")&&a--,a>=0&&(n.time(e.duration(Fe+a*ye)),n=r.rezoneDate(n)),n}function F(t,n){return A(e.duration(t.clone().stripZone()-n.clone().stripTime()))}function A(t){if(Fe>t)return 0;if(t>=Ae)return ce.height();var e=(t-Fe)/ge,n=Math.floor(e),r=e-n,a=Je[n];void 0===a&&(a=Je[n]=ce.find("tr").eq(n).find("td div")[0].offsetTop);var o=a-1+r*me;return o=Math.max(o,0)}function W(t){return t.hasTime()?t.clone().add(ge):t.clone().add("days",1)}function Y(t,e){t.hasTime()||e.hasTime()?L(t,e):Le("allDaySlot")&&w(t,e,!0)}function L(e,n){var r=Le("selectHelper");if(Ee.build(),r){var a=Ve(e).col;if(a>=0&&Te>a){var o=Ee.rect(0,a,0,a,se),i=F(e,e),s=F(n,e);if(s>i){if(o.top=i,o.height=s-i,o.left+=2,o.width-=5,t.isFunction(r)){var l=r(e,n);l&&(o.position="absolute",de=t(l).css(o).appendTo(se))}else o.isStart=!0,o.isEnd=!0,de=t($e({title:"",start:e,end:n,className:["fc-select-helper"],editable:!1},o)),de.css("opacity",Le("dragOpacity"));de&&(b(de),se.append(de),m(de,o.width,!0),y(de,o.height,!0))}}}else E(e,n)}function Z(){Pe(),de&&(de.remove(),de=null)}function B(e){if(1==e.which&&Le("selectable")){Ie(e);var n;Re.start(function(t,e){if(Z(),t&&t.col==e.col&&!z(t)){var r=_(e),a=_(t);n=[r,r.clone().add(ye),a,a.clone().add(ye)].sort(M),L(n[0],n[3])}else n=null},e),t(document).one("mouseup",function(t){Re.stop(),n&&(+n[0]==+n[1]&&P(n[0],t),je(n[0],n[3],t))})}}function P(t,e){Ze("dayClick",U[Ve(t).col],t,e)}function j(t,e){Re.start(function(t){if(Pe(),t){var e=_(t),n=e.clone();e.hasTime()?(n.add(r.defaultTimedEventDuration),E(e,n)):(n.add(r.defaultAllDayEventDuration),w(e,n))}},e)}function I(t,e,n){var r=Re.stop(); +Pe(),r&&Ze("drop",t,_(r),e,n)}var q=this;q.renderAgenda=o,q.setWidth=v,q.setHeight=f,q.afterRender=p,q.computeDateTop=F,q.getIsCellAllDay=z,q.allDayRow=function(){return ae},q.getCoordinateGrid=function(){return Ee},q.getHoverListener=function(){return Re},q.colLeft=S,q.colRight=k,q.colContentLeft=x,q.colContentRight=R,q.getDaySegmentContainer=function(){return ne},q.getSlotSegmentContainer=function(){return le},q.getSlotContainer=function(){return se},q.getRowCnt=function(){return 1},q.getColCnt=function(){return Te},q.getColWidth=function(){return he},q.getSnapHeight=function(){return we},q.getSnapDuration=function(){return ye},q.getSlotHeight=function(){return me},q.getSlotDuration=function(){return ge},q.getMinTime=function(){return Fe},q.getMaxTime=function(){return Ae},q.defaultSelectionEnd=W,q.renderDayOverlay=w,q.renderSelection=Y,q.clearSelection=Z,q.reportDayClick=P,q.dragStart=j,q.dragStop=I,De.call(q,n,r,a),xe.call(q),Se.call(q),ie.call(q);var $,X,V,G,U,Q,J,K,te,ee,ne,re,ae,oe,se,le,ce,de,ue,fe,ve,he,pe,ge,me,ye,be,we,Te,Ce,Ee,Re,He,_e,Ne,Oe,Fe,Ae,We,Le=q.opt,Ze=q.trigger,Be=q.renderOverlay,Pe=q.clearOverlays,je=q.reportSelection,Ie=q.unselect,qe=q.daySelectionMousedown,$e=q.slotSegHtml,Xe=q.cellToDate,Ve=q.dateToCell,Ge=q.rangeToSegments,Ue=r.formatDate,Qe=r.calculateWeekNumber,Je={};N(n.addClass("fc-agenda")),Ee=new ke(function(e,n){function r(t){return Math.max(l,Math.min(c,t))}var a,o,i;V.each(function(e,r){a=t(r),o=a.offset().left,e&&(i[1]=o),i=[o],n[e]=i}),i[1]=o+a.outerWidth(),Le("allDaySlot")&&(a=ae,o=a.offset().top,e[0]=[o,o+a.outerHeight()]);for(var s=se.offset().top,l=oe.offset().top,c=l+oe.outerHeight(),d=0;Ce*be>d;d++)e.push([r(s+we*d),r(s+we*(d+1))])}),Re=new Me(Ee),He=new ze(function(t){return Q.eq(t)}),_e=new ze(function(t){return J.eq(t)})}function ie(){function n(t,e){var n,r=t.length,o=[],s=[];for(n=0;r>n;n++)t[n].allDay?o.push(t[n]):s.push(t[n]);v("allDaySlot")&&(X(o,e),w()),i(a(s),e)}function r(){T().empty(),E().empty()}function a(t){var e,n,r,a,i,s=_(),l=V(),c=G(),d=[];for(n=0;s>n;n++)for(e=z(0,n),i=o(t,e.clone().time(l),e.clone().time(c)),i=se(i),r=0;i.length>r;r++)a=i[r],a.col=n,d.push(a);return d}function o(t,e,n){e=e.clone().stripZone(),n=n.clone().stripZone();var r,a,o,i,s,l,c,d,u=[],f=t.length;for(r=0;f>r;r++)a=t[r],o=a.start.clone().stripZone(),i=J(a).stripZone(),i>e&&n>o&&(e>o?(s=e.clone(),c=!1):(s=o,c=!0),i>n?(l=n.clone(),d=!1):(l=i,d=!0),u.push({event:a,start:s,end:l,isStart:c,isEnd:d}));return u.sort(ge)}function i(e,n){var r,a,o,i,c,d,u,f,p,m,y,D,w,T,S,k,z=e.length,H="",_=E(),N=v("isRTL");for(r=0;z>r;r++)a=e[r],o=a.event,i=x(a.start,a.start),c=x(a.end,a.start),d=M(a.col),u=R(a.col),f=u-d,u-=.025*f,f=u-d,p=f*(a.forwardCoord-a.backwardCoord),v("slotEventOverlap")&&(p=Math.max(2*(p-10),p)),N?(y=u-a.backwardCoord*f,m=y-p):(m=d+a.backwardCoord*f,y=m+p),m=Math.max(m,d),y=Math.min(y,u),p=y-m,a.top=i,a.left=m,a.outerWidth=p,a.outerHeight=c-i,H+=s(o,a);for(_[0].innerHTML=H,D=_.children(),r=0;z>r;r++)a=e[r],o=a.event,w=t(D[r]),T=h("eventRender",o,o,w),T===!1?w.remove():(T&&T!==!0&&(w.remove(),w=t(T).css({position:"absolute",top:a.top,left:a.left}).appendTo(_)),a.element=w,o._id===n?l(o,w,a):w[0]._fci=r,Z(o,w));for(g(_,e,l),r=0;z>r;r++)a=e[r],(w=a.element)&&(a.vsides=C(w,!0),a.hsides=b(w,!0),S=w.find(".fc-event-title"),S.length&&(a.contentTop=S[0].offsetTop));for(r=0;z>r;r++)a=e[r],(w=a.element)&&(w[0].style.width=Math.max(0,a.outerWidth-a.hsides)+"px",k=Math.max(0,a.outerHeight-a.vsides),w[0].style.height=k+"px",o=a.event,void 0!==a.contentTop&&10>k-a.contentTop&&(w.find("div.fc-event-time").text(Q(o.start,v("timeFormat"))+" - "+o.title),w.find("div.fc-event-title").remove()),h("eventAfterRender",o,o,w))}function s(t,e){var n="<",r=t.url,a=F(t,v),o=["fc-event","fc-event-vert"];return p(t)&&o.push("fc-event-draggable"),e.isStart&&o.push("fc-event-start"),e.isEnd&&o.push("fc-event-end"),o=o.concat(t.className),t.source&&(o=o.concat(t.source.className||[])),n+=r?"a href='"+H(t.url)+"'":"div",n+=" class='"+o.join(" ")+"'"+" style="+"'"+"position:absolute;"+"top:"+e.top+"px;"+"left:"+e.left+"px;"+a+"'"+">"+"
"+"
"+H(f.getEventTimeText(t))+"
"+"
"+H(t.title||"")+"
"+"
"+"
",e.isEnd&&m(t)&&(n+="
=
"),n+=""}function l(t,e,n){var r=e.find("div.fc-event-time");p(t)&&d(t,e,r),n.isEnd&&m(t)&&u(t,e,r),D(t,e)}function c(t,n,r){function a(){c||(n.width(o).height("").draggable("option","grid",null),c=!0)}var o,i,s,l=r.isStart,c=!0,d=S(),u=N(),f=V(),p=Y(),g=W(),m=A(),b=O();n.draggable({opacity:v("dragOpacity","month"),revertDuration:v("dragRevertDuration"),start:function(e,r){h("eventDragStart",n[0],t,e,r),P(t,n),o=n.width(),d.start(function(e,r){if($(),e){i=!1;var o=z(0,r.col),d=z(0,e.col);s=d.diff(o,"days"),e.row?l?c&&(n.width(u-10),y(n,U.defaultTimedEventDuration/p*g),n.draggable("option","grid",[u,1]),c=!1):i=!0:(q(t.start.clone().add("days",s),J(t).add("days",s)),a()),i=i||c&&!s}else a(),i=!0;n.draggable("option","revert",i)},e,"drag")},stop:function(r,o){if(d.stop(),$(),h("eventDragStop",n[0],t,r,o),i)a(),n.css("filter",""),B(t,n);else{var l,u,v=t.start.clone().add("days",s);c||(u=Math.round((n.offset().top-L().offset().top)/b),l=e.duration(f+u*m),v=U.rezoneDate(v.clone().time(l))),j(n[0],t,v,r,o)}}})}function d(t,e,n){function r(){$(),s&&(c?(n.hide(),e.draggable("option","grid",null),q(b,D)):(a(),n.css("display",""),e.draggable("option","grid",[C,E])))}function a(){b&&n.text(f.getEventTimeText(b,t.end?D:null))}var o,i,s,l,c,d,u,p,g,m,y,b,D,w=f.getCoordinateGrid(),T=_(),C=N(),E=O(),S=A();e.draggable({scroll:!1,grid:[C,E],axis:1==T?"y":!1,opacity:v("dragOpacity"),revertDuration:v("dragRevertDuration"),start:function(n,r){h("eventDragStart",e[0],t,n,r),P(t,e),w.build(),o=e.position(),i=w.cell(n.pageX,n.pageY),s=l=!0,c=d=k(i),u=p=0,g=0,m=y=0,b=null,D=null},drag:function(n,a){var f=w.cell(n.pageX,n.pageY);if(s=!!f){if(c=k(f),u=Math.round((a.position.left-o.left)/C),u!=p){var v=z(0,i.col),h=i.col+u;h=Math.max(0,h),h=Math.min(T-1,h);var x=z(0,h);g=x.diff(v,"days")}c||(m=Math.round((a.position.top-o.top)/E))}(s!=l||c!=d||u!=p||m!=y)&&(c?(b=t.start.clone().stripTime().add("days",g),D=b.clone().add(U.defaultAllDayEventDuration)):(b=t.start.clone().add(m*S).add("days",g),D=J(t).add(m*S).add("days",g)),r(),l=s,d=c,p=u,y=m),e.draggable("option","revert",!s)},stop:function(n,a){$(),h("eventDragStop",e[0],t,n,a),s&&(c||g||m)?j(e[0],t,b,n,a):(s=!0,c=!1,u=0,g=0,m=0,r(),e.css("filter",""),e.css(o),B(t,e))}})}function u(t,e,n){var r,a,o,i=O(),s=A();e.resizable({handles:{s:".ui-resizable-handle"},grid:i,start:function(n,o){r=a=0,P(t,e),h("eventResizeStart",e[0],t,n,o)},resize:function(l,c){if(r=Math.round((Math.max(i,e.height())-c.originalSize.height)/i),r!=a){o=J(t).add(s*r);var d;d=r?f.getEventTimeText(t.start,o):f.getEventTimeText(t),n.text(d),a=r}},stop:function(n,a){h("eventResizeStop",e[0],t,n,a),r?I(e[0],t,o,n,a):B(t,e)}})}var f=this;f.renderEvents=n,f.clearEvents=r,f.slotSegHtml=s,we.call(f);var v=f.opt,h=f.trigger,p=f.isEventDraggable,m=f.isEventResizable,D=f.eventElementHandlers,w=f.setHeight,T=f.getDaySegmentContainer,E=f.getSlotSegmentContainer,S=f.getHoverListener,x=f.computeDateTop,k=f.getIsCellAllDay,M=f.colContentLeft,R=f.colContentRight,z=f.cellToDate,_=f.getColCnt,N=f.getColWidth,O=f.getSnapHeight,A=f.getSnapDuration,W=f.getSlotHeight,Y=f.getSlotDuration,L=f.getSlotContainer,Z=f.reportEventElement,B=f.showEvents,P=f.hideEvents,j=f.eventDrop,I=f.eventResize,q=f.renderDayOverlay,$=f.clearOverlays,X=f.renderDayEvents,V=f.getMinTime,G=f.getMaxTime,U=f.calendar,Q=U.formatDate,J=U.getEventEnd;f.draggableDayEvent=c}function se(t){var e,n=le(t),r=n[0];if(ce(n),r){for(e=0;r.length>e;e++)de(r[e]);for(e=0;r.length>e;e++)ue(r[e],0,0)}return fe(n)}function le(t){var e,n,r,a=[];for(e=0;t.length>e;e++){for(n=t[e],r=0;a.length>r&&ve(n,a[r]).length;r++);(a[r]||(a[r]=[])).push(n)}return a}function ce(t){var e,n,r,a,o;for(e=0;t.length>e;e++)for(n=t[e],r=0;n.length>r;r++)for(a=n[r],a.forwardSegs=[],o=e+1;t.length>o;o++)ve(a,t[o],a.forwardSegs)}function de(t){var e,n,r=t.forwardSegs,a=0;if(void 0===t.forwardPressure){for(e=0;r.length>e;e++)n=r[e],de(n),a=Math.max(a,1+n.forwardPressure);t.forwardPressure=a}}function ue(t,e,n){var r,a=t.forwardSegs;if(void 0===t.forwardCoord)for(a.length?(a.sort(pe),ue(a[0],e+1,n),t.forwardCoord=a[0].backwardCoord):t.forwardCoord=1,t.backwardCoord=t.forwardCoord-(t.forwardCoord-n)/(e+1),r=0;a.length>r;r++)ue(a[r],0,t.forwardCoord)}function fe(t){var e,n,r,a=[];for(e=0;t.length>e;e++)for(n=t[e],r=0;n.length>r;r++)a.push(n[r]);return a}function ve(t,e,n){n=n||[];for(var r=0;e.length>r;r++)he(t,e[r])&&n.push(e[r]);return n}function he(t,e){return t.end>e.start&&t.starte?-1:1)}function r(t){a.start=a.intervalStart=t.clone().stripTime(),a.end=a.intervalEnd=a.start.clone().add("days",1),a.title=e.formatDate(a.start,a.opt("titleFormat")),a.renderResource(o().length)}var a=this;a.incrementDate=n,a.render=r,ye.call(a,t,e,"resourceDay");var o=a.getResources}function ye(n,r,a){function o(t){Ee=t,i(),V?l():s()}function i(){Fe=Ze("theme")?"ui":"fc",Ae=Ze("isRTL"),Le=Ze("columnFormat"),We=e.duration(Ze("minTime")),Ye=e.duration(Ze("maxTime")),me=e.duration(Ze("slotDuration")),we=Ze("snapDuration"),we=we?e.duration(we):me}function s(){var r,a,o,i,s=Fe+"-widget-header",c=Fe+"-widget-content",d=0===me.asMinutes()%15;for(l(),re=t("
").appendTo(n),Ze("allDaySlot")?(ae=t("
").appendTo(re),r=""+""+""+""+"
"+(Ze("allDayHTML")||H(Ze("allDayText")))+""+"
"+"
 
",oe=t(r).appendTo(re),ie=oe.find("tr"),g(ie.find("td")),re.append("
"+"
"+"
")):ae=t([]),se=t("
").appendTo(re),le=t("
").appendTo(se),ce=t("
").appendTo(le),r="",a=e.duration(+We),Re=0;Ye>a;)o=X.start.clone().time(a),i=o.minutes(),r+=""+""+""+"",a.add(me),Re++;r+="
"+(d&&i?" ":H(Ue(o,Ze("axisFormat"))))+""+"
 
"+"
",de=t(r).appendTo(le),b(de.find("td"))}function l(){var e=c();V&&V.remove(),V=t(e).appendTo(n),G=V.find("thead"),U=G.find("th").slice(1,-1),Q=V.find("tbody"),J=Q.find("td").slice(0,-1),K=J.find("> div"),te=J.find(".fc-day-content > div"),ee=J.eq(0),ne=K.eq(0),O(G.add(G.find("tr"))),O(Q.add(Q.find("tr")))}function c(){var t=""+d()+u()+"
";return t}function d(){var t,e,n,r=Fe+"-widget-header",a="";for(a+="",Ze("weekNumbers")?(t=Xe(0,0),e=Qe(t),Ae?e+=Ze("weekNumberTitle"):e=Ze("weekNumberTitle")+e,a+=""+H(e)+""):a+=" ",n=0;Ee>n;n++){var o=Ke()[n],i=["fc-col"+n,o.className,r];a+=""+H(o.name)+""}return a+=" "+""+""}function u(){var t,e,n,r,a,o=Fe+"-widget-header",i=Fe+"-widget-content",s=Y(new Date).stripTime(),l="";for(l+=" ",n="",e=0;Ee>e;e++){var c=Ke()[e];t=X.intervalStart.clone(),a=["fc-col"+e,c.className,i],+t==+s?a.push(Fe+"-state-highlight","fc-today"):s>t?a.push("fc-past"):a.push("fc-future"),r=""+"
"+"
"+"
 
"+"
"+"
"+"",n+=r}return l+=n,l+=" "+""+""}function f(t){void 0===t&&(t=ve),ve=t,Je={};var e=Q.position().top,n=se.position().top,r=Math.min(t-e,de.height()+n+1);ne.height(r-C(ee)),re.css("top",e),se.height(r-n-1);var a=de.find("tr:first").height()+1,o=de.find("tr:eq(1)").height();ye=(a+o)/2,Te=me/we,Ce=ye/Te}function v(e){fe=e,Ne.clear(),Oe.clear();var n=G.find("th:first");oe&&(n=n.add(oe.find("th:first"))),n=n.add(de.find("th:first")),he=0,m(n.width("").each(function(e,n){he=Math.max(he,t(n).outerWidth())}),he);var r=V.find(".fc-agenda-gutter");oe&&(r=r.add(oe.find("th.fc-agenda-gutter")));var a=se[0].clientWidth;ge=se.width()-a,ge?(m(r,ge),r.show().prev().removeClass("fc-last")):r.hide().prev().addClass("fc-last"),pe=Math.floor((a-he)/Ee),m(U.slice(0,-1),pe)}function h(){function t(){se.scrollTop(n)}var n=A(e.duration(Ze("scrollTime")))+1;t(),setTimeout(t,0)}function p(){h()}function g(t){t.click(D).mousedown(P)}function b(t){t.click(D).mousedown(j)}function D(t){if(!Ze("selectable")){var e=Math.min(Ee-1,Math.floor((t.pageX-V.offset().left-he)/pe)),n=Xe(0,e),a=this.parentNode.className.match(/fc-slot(\d+)/);if(t.data=Ke()[e],a){var o=parseInt(a[1],10);n.add(We+o*me),n=r.rezoneDate(n),Be("dayClick",J[e],n,t)}else Be("dayClick",J[e],n,t)}}function w(t,e,n,r){n&&He.build();for(var a=Ge(t,e),o=0;a.length>o;o++){var i=a[o];g(T(i.row,r,i.row,r))}}function T(t,e,n,r){var a=He.rect(t,e,n,r,re);return Pe(a,re)}function E(t,e,n){t=t.clone().stripZone(),e=e.clone().stripZone();var r=Xe(0,0),a=r.clone().add("days",1),o=t>r?t:r,i=e>a?a:e;if(i>o){var s=He.rect(0,n,0,n,le),l=F(o,r),c=F(i,r);s.top=l,s.height=c-l,b(Pe(s,le))}}function S(t){return Ne.left(t)}function x(t){return Oe.left(t)}function k(t){return Ne.right(t)}function R(t){return Oe.right(t)}function z(t){return Ze("allDaySlot")&&!t.row}function _(t){var n=Xe(0,0),a=t.row;return Ze("allDaySlot")&&a--,a>=0&&(n.time(e.duration(We+a*we)),n=r.rezoneDate(n)),n}function F(t,n){return A(e.duration(t.clone().stripZone()-n.clone().stripTime()))}function A(t){if(We>t)return 0;if(t>=Ye)return de.height();var e=(t-We)/me,n=Math.floor(e),r=e-n,a=Je[n];void 0===a&&(a=Je[n]=de.find("tr").eq(n).find("td div")[0].offsetTop);var o=a-1+r*ye;return o=Math.max(o,0)}function W(t,e){return e?t.clone():t.clone().add("m",Ze("slotMinutes"))}function L(t,e,n,r){n?Ze("allDaySlot")&&w(t,e,!0,r):Z(t,e)}function Z(e,n,r){var a=Ze("selectHelper");if(He.build(),a){if(r=r||Ve(e).col,r>=0&&Ee>r){var o=He.rect(0,r,0,r,le),i=F(e,e),s=F(e,n);if(s>i){if(o.top=i,o.height=s-i,o.left+=2,o.width-=5,t.isFunction(a)){var l=a(e,n);l&&(o.position="absolute",ue=t(l).css(o).appendTo(le))}else o.isStart=!0,o.isEnd=!0,ue=t($e({title:"",start:e,end:n,className:["fc-select-helper"],editable:!1},o)),ue.css("opacity",Ze("dragOpacity"));ue&&(b(ue),le.append(ue),m(ue,o.width,!0),y(ue,o.height,!0))}}}else E(e,n,r)}function B(){je(),ue&&(ue.remove(),ue=null)}function P(e){var n,r=X.getIsCellAllDay,a=X.getHoverListener(),o=X.reportDayClick;if(1==e.which&&Ze("selectable")){qe(e);var i;a.start(function(t,e){B(),t&&r(t)?(n=t.col,i=[_(e),_(t)].sort(M),L(i[0],i[1],!0,n)):i=null},e),t(document).one("mouseup",function(t){a.stop(),i&&(+i[0]==+i[1]&&o(i[0],!0,t),t.data=Ke()[n],Ie(i[0],i[1],!0,t))})}}function j(e){if(1==e.which&&Ze("selectable")){qe(e);var n,r;_e.start(function(t,e){if(B(),t&&t.col==e.col&&!z(t)){r=t.col;var a=_(e),o=_(t);n=[a,a.clone().add(we),o,o.clone().add(we)].sort(M),Z(n[0],n[3],t.col)}else n=null},e),t(document).one("mouseup",function(t){_e.stop(),n&&(+n[0]==+n[1]&&I(n[0],!1,t),t.data=Ke()[r],Ie(n[0],n[3],!1,t))})}}function I(t,e,n){Be("dayClick",J[Ve(t).col],t,e,n)}function q(t,e){_e.start(function(t){if(je(),t)if(z(t))T(t.row,t.col,t.row,t.col);else{var e=_(t),n=e.clone().add("m",Ze("defaultEventMinutes"));E(e,n,t.col)}},e)}function $(t,e,n){var r=_e.stop();je(),r&&(e.data=Ke()[r.col],Be("drop",t,_(r),z(r),e,n))}var X=this;X.renderResource=o,X.setWidth=v,X.setHeight=f,X.afterRender=p,X.computeDateTop=F,X.getIsCellAllDay=z,X.allDayRow=function(){return ie},X.getCoordinateGrid=function(){return He},X.getHoverListener=function(){return _e},X.colLeft=S,X.colRight=k,X.colContentLeft=x,X.colContentRight=R,X.getDaySegmentContainer=function(){return ae},X.getSlotSegmentContainer=function(){return ce},X.getSlotContainer=function(){return le},X.getRowCnt=function(){return 1},X.getColCnt=function(){return Ee},X.getColWidth=function(){return pe},X.getSnapHeight=function(){return Ce},X.getSnapDuration=function(){return we},X.getSlotHeight=function(){return ye},X.getSlotDuration=function(){return me},X.getMinTime=function(){return We},X.getMaxTime=function(){return Ye},X.defaultSelectionEnd=W,X.renderDayOverlay=w,X.renderSelection=L,X.clearSelection=B,X.reportDayClick=I,X.dragStart=q,X.dragStop=$,X.getResources=r.fetchResources,De.call(X,n,r,a),xe.call(X),Se.call(X),be.call(X);var V,G,U,Q,J,K,te,ee,ne,re,ae,oe,ie,se,le,ce,de,ue,fe,ve,he,pe,ge,me,ye,we,Te,Ce,Ee,Re,He,_e,Ne,Oe,Fe,Ae,We,Ye,Le,Ze=X.opt,Be=X.trigger,Pe=X.renderOverlay,je=X.clearOverlays,Ie=X.reportSelection,qe=X.unselect,$e=X.slotSegHtml,Xe=X.cellToDate,Ve=X.dateToCell,Ge=X.rangeToSegments,Ue=r.formatDate,Qe=r.calculateWeekNumber,Je={},Ke=X.getResources;N(n.addClass("fc-agenda")),He=new ke(function(e,n){function r(t){return Math.max(l,Math.min(c,t))}var a,o,i;U.each(function(e,r){a=t(r),o=a.offset().left,e&&(i[1]=o),i=[o],n[e]=i}),i[1]=o+a.outerWidth(),Ze("allDaySlot")&&(a=ie,o=a.offset().top,e[0]=[o,o+a.outerHeight()]);for(var s=le.offset().top,l=se.offset().top,c=l+se.outerHeight(),d=0;Re*Te>d;d++)e.push([r(s+Ce*d),r(s+Ce*(d+1))])}),_e=new Me(He),Ne=new ze(function(t){return K.eq(t)}),Oe=new ze(function(t){return te.eq(t)})}function be(){function n(t,e){var n,r=t.length,o=[],i=[];for(n=0;r>n;n++)t[n].allDay?o.push(t[n]):i.push(t[n]);h("allDaySlot")&&(V(o,e),T()),s(a(i),e)}function r(){E().empty(),S().empty()}function a(t){var e,n,r,a,s,l=N(),c=G(),d=U(),u=[];for(n=0;l>n;n++){e=_(0,0);var f=i(te()[n],t);for(s=o(f,e.clone().time(c),e.clone().time(d)),s=se(s),r=0;s.length>r;r++)a=s[r],a.col=n,u.push(a)}return u}function o(t,e,n){e=e.clone().stripZone(),n=n.clone().stripZone();var r,a,o,i,s,l,c,d,u=[],f=t.length;for(r=0;f>r;r++)a=t[r],o=a.start.clone().stripZone(),i=K(a).stripZone(),i>e&&n>o&&(e>o?(s=e.clone(),c=!1):(s=o,c=!0),i>n?(l=n.clone(),d=!1):(l=i,d=!0),u.push({event:a,start:s,end:l,isStart:c,isEnd:d}));return u.sort(ge)}function i(e,n){for(var r=[],a=0;n.length>a;a++)n[a].resources&&t.inArray(e.id,n[a].resources)>=0&&r.push(n[a]);return r}function s(e,n){var r,a,o,i,s,d,u,f,v,m,y,D,w,T,E,x,M=e.length,H="",_=S(),N=h("isRTL");for(r=0;M>r;r++)a=e[r],o=a.event,i=k(a.start,a.start),s=k(a.end,a.start),d=R(a.col),u=z(a.col),f=u-d,u-=.025*f,f=u-d,v=f*(a.forwardCoord-a.backwardCoord),h("slotEventOverlap")&&(v=Math.max(2*(v-10),v)),N?(y=u-a.backwardCoord*f,m=y-v):(m=d+a.backwardCoord*f,y=m+v),m=Math.max(m,d),y=Math.min(y,u),v=y-m,a.top=i,a.left=m,a.outerWidth=v,a.outerHeight=s-i,H+=l(o,a);for(_[0].innerHTML=H,D=_.children(),r=0;M>r;r++)a=e[r],o=a.event,w=t(D[r]),T=p("eventRender",o,o,w),T===!1?w.remove():(T&&T!==!0&&(w.remove(),w=t(T).css({position:"absolute",top:a.top,left:a.left}).appendTo(_)),a.element=w,o._id===n?c(o,w,a):w[0]._fci=r,B(o,w));for(g(_,e,c),r=0;M>r;r++)a=e[r],(w=a.element)&&(a.vsides=C(w,!0),a.hsides=b(w,!0),E=w.find(".fc-event-title"),E.length&&(a.contentTop=E[0].offsetTop));for(r=0;M>r;r++)a=e[r],(w=a.element)&&(w[0].style.width=Math.max(0,a.outerWidth-a.hsides)+"px",x=Math.max(0,a.outerHeight-a.vsides),w[0].style.height=x+"px",o=a.event,void 0!==a.contentTop&&10>x-a.contentTop&&(w.find("div.fc-event-time").text(J(o.start,h("timeFormat"))+" - "+o.title),w.find("div.fc-event-title").remove()),p("eventAfterRender",o,o,w))}function l(t,e){var n="<",r=t.url,a=F(t,h),o=["fc-event","fc-event-vert"];return m(t)&&o.push("fc-event-draggable"),e.isStart&&o.push("fc-event-start"),e.isEnd&&o.push("fc-event-end"),o=o.concat(t.className),t.source&&(o=o.concat(t.source.className||[])),n+=r?"a href='"+H(t.url)+"'":"div",n+=" class='"+o.join(" ")+"'"+" style="+"'"+"position:absolute;"+"top:"+e.top+"px;"+"left:"+e.left+"px;"+a+"'"+">"+"
"+"
"+H(v.getEventTimeText(t))+"
"+"
"+H(t.title||"")+"
"+"
"+"
",e.isEnd&&D(t)&&(n+="
=
"),n+=""}function c(t,e,n){var r=e.find("div.fc-event-time");m(t)&&u(t,e,r),n.isEnd&&D(t)&&f(t,e,r),w(t,e)}function d(t,n,r){function a(){c||(n.width(o).height("").draggable("option","grid",null),c=!0)}var o,i,s,l=r.isStart,c=!0,d=x(),u=O(),f=G(),v=L(),g=Y(),m=W(),b=A();n.draggable({opacity:h("dragOpacity","month"),revertDuration:h("dragRevertDuration"),start:function(e,r){p("eventDragStart",n[0],t,e,r),j(t,n),o=n.width(),d.start(function(e,r){if(X(),e){i=!1;var o=_(0,r.col),d=_(0,e.col);s=d.diff(o,"days"),e.row?l?c&&(n.width(u-10),y(n,Q.defaultTimedEventDuration/v*g),n.draggable("option","grid",[u,1]),c=!1):i=!0:($(t.start.clone().add("days",s),K(t).add("days",s)),a()),i=i||c&&!s}else a(),i=!0;n.draggable("option","revert",i)},e,"drag")},stop:function(r,o){if(d.stop(),X(),p("eventDragStop",n[0],t,r,o),i)a(),n.css("filter",""),P(t,n);else{var l,u,v=t.start.clone().add("days",s);c||(u=Math.round((n.offset().top-Z().offset().top)/b),l=e.duration(f+u*m),v=Q.rezoneDate(v.clone().time(l))),I(n[0],t,v,r,o)}}})}function u(t,e,n){function r(){X(),s&&(c?(n.hide(),e.draggable("option","grid",null),$(D,w)):(a(),n.css("display",""),e.draggable("option","grid",[E,S])))}function a(){D&&n.text(v.getEventTimeText(D,t.end?w:null))}var o,i,s,l,c,d,u,f,g,m,y,b,D,w,T=v.getCoordinateGrid(),C=N(),E=O(),S=A(),x=W();e.draggable({scroll:!1,grid:[E,S],axis:1==C?"y":!1,opacity:h("dragOpacity"),revertDuration:h("dragRevertDuration"),start:function(n,r){p("eventDragStart",e[0],t,n,r),j(t,e),T.build(),o=e.position(),i=T.cell(n.pageX,n.pageY),s=l=!0,c=d=M(i),u=f=0,g=0,m=0,y=b=0,D=null,w=null},drag:function(n,a){var i=T.cell(n.pageX,n.pageY);s=!!i,s&&(c=M(i),u=Math.round((a.position.left-o.left)/E),u!=f&&(m=u),c||(y=Math.round((a.position.top-o.top)/S))),(s!=l||c!=d||u!=f||y!=b)&&(c?(D=t.start.clone().stripTime().add("days",g),w=D.clone().add(Q.defaultAllDayEventDuration)):(D=t.start.clone().add(y*x).add("days",g),w=K(t).add(y*x).add("days",g)),r(),l=s,d=c,f=u,b=y),e.draggable("option","revert",!s)},stop:function(n,a){X(),p("eventDragStop",e,t,n,a),s&&(c||m||y)?(t.resources=[te()[i.col+m].id],I(e[0],t,D,n,a)):(s=!0,c=!1,u=0,g=0,y=0,r(),e.css("filter",""),e.css(o),P(t,e))}})}function f(t,e,n){var r,a,o,i=A(),s=W();e.resizable({handles:{s:".ui-resizable-handle"},grid:i,start:function(n,o){r=a=0,j(t,e),p("eventResizeStart",e[0],t,n,o)},resize:function(l,c){if(r=Math.round((Math.max(i,e.height())-c.originalSize.height)/i),r!=a){o=K(t).add(s*r);var d;d=r?v.getEventTimeText(t.start,o):v.getEventTimeText(t),n.text(d),a=r}},stop:function(n,a){p("eventResizeStop",this,t,n,a),r?q(e[0],t,o,n,a):P(t,e)}})}var v=this;v.renderEvents=n,v.clearEvents=r,v.slotSegHtml=l,we.call(v);var h=v.opt,p=v.trigger,m=v.isEventDraggable,D=v.isEventResizable,w=v.eventElementHandlers,T=v.setHeight,E=v.getDaySegmentContainer,S=v.getSlotSegmentContainer,x=v.getHoverListener,k=v.computeDateTop,M=v.getIsCellAllDay,R=v.colContentLeft,z=v.colContentRight,_=v.cellToDate,N=v.getColCnt,O=v.getColWidth,A=v.getSnapHeight,W=v.getSnapDuration,Y=v.getSlotHeight,L=v.getSlotDuration,Z=v.getSlotContainer,B=v.reportEventElement,P=v.showEvents,j=v.hideEvents,I=v.eventDrop,q=v.eventResize,$=v.renderDayOverlay,X=v.clearOverlays,V=v.renderDayEvents,G=v.getMinTime,U=v.getMaxTime,Q=v.calendar,J=Q.formatDate,K=Q.getEventEnd,te=v.getResources;v.draggableDayEvent=d}function De(n,r,a){function o(e,n){var r=A[e];return t.isPlainObject(r)&&!i(e)?z(r,n||a):r}function s(t,e){return r.trigger.apply(r,[t,e||_].concat(Array.prototype.slice.call(arguments,2),[_]))}function l(t){var e=t.source||{};return W(t.startEditable,e.startEditable,o("eventStartEditable"),t.editable,e.editable,o("editable"))}function c(t){var e=t.source||{};return W(t.durationEditable,e.durationEditable,o("eventDurationEditable"),t.editable,e.editable,o("editable"))}function d(){O={},F=[]}function u(t,e){F.push({event:t,element:e}),O[t._id]?O[t._id].push(e):O[t._id]=[e]}function f(){t.each(F,function(t,e){_.trigger("eventDestroy",e.event,e.event,e.element)})}function v(t,e){e.click(function(n){return e.hasClass("ui-draggable-dragging")||e.hasClass("ui-resizable-resizing")?void 0:s("eventClick",this,t,n)}).hover(function(e){s("eventMouseover",this,t,e)},function(e){s("eventMouseout",this,t,e)})}function h(t,e){g(t,e,"show")}function p(t,e){g(t,e,"hide")}function g(t,e,n){var r,a=O[t._id],o=a.length;for(r=0;o>r;r++)e&&a[r][0]==e[0]||a[r][n]()}function m(t,e,n,a,o){var i=r.mutateEvent(e,n,null);s("eventDrop",t,e,i.dateDelta,function(){i.undo(),N(e._id)},a,o),N(e._id)}function y(t,e,n,a,o){var i=r.mutateEvent(e,null,n);s("eventResize",t,e,i.durationDelta,function(){i.undo(),N(e._id)},a,o),N(e._id)}function b(t){return e.isMoment(t)&&(t=t.day()),B[t]}function D(){return L}function w(t,e,n){var r=t.clone();for(e=e||1;B[(r.day()+(n?e:0)+7)%7];)r.add("days",e);return r}function T(){var t=C.apply(null,arguments),e=E(t),n=S(e);return n}function C(t,e){var n=_.getColCnt(),r=I?-1:1,a=I?n-1:0;"object"==typeof t&&(e=t.col,t=t.row);var o=t*n+(e*r+a);return o}function E(t){var e=_.start.day();return t+=P[e],7*Math.floor(t/L)+j[(t%L+L)%L]-e}function S(t){return _.start.clone().add("days",t)}function x(t){var e=k(t),n=M(e),r=R(n);return r}function k(t){return t.clone().stripTime().diff(_.start,"days")}function M(t){var e=_.start.day();return t+=e,Math.floor(t/7)*L+P[(t%7+7)%7]-P[e]}function R(t){var e=_.getColCnt(),n=I?-1:1,r=I?e-1:0,a=Math.floor(t/e),o=(t%e+e)%e*n+r;return{row:a,col:o}}function H(t,e){var n=_.getRowCnt(),r=_.getColCnt(),a=[],o=k(t),i=k(e),s=+e.time();s&&s>=Y&&i++,i=Math.max(i,o+1);for(var l=M(o),c=M(i)-1,d=0;n>d;d++){var u=d*r,f=u+r-1,v=Math.max(l,u),h=Math.min(c,f);if(h>=v){var p=R(v),g=R(h),m=[p.col,g.col].sort(),y=E(v)==o,b=E(h)+1==i;a.push({row:d,leftCol:m[0],rightCol:m[1],isStart:y,isEnd:b})}}return a}var _=this;_.element=n,_.calendar=r,_.name=a,_.opt=o,_.trigger=s,_.isEventDraggable=l,_.isEventResizable=c,_.clearEventData=d,_.reportEventElement=u,_.triggerEventDestroy=f,_.eventElementHandlers=v,_.showEvents=h,_.hideEvents=p,_.eventDrop=m,_.eventResize=y;var N=r.reportEventChange,O={},F=[],A=r.options,Y=e.duration(A.nextDayThreshold);_.getEventTimeText=function(t){var e,n;return 2===arguments.length?(e=arguments[0],n=arguments[1]):(e=t.start,n=t.end),n&&o("displayEventEnd")?r.formatRange(e,n,o("timeFormat")):r.formatDate(e,o("timeFormat"))},_.isHiddenDay=b,_.skipHiddenDays=w,_.getCellsPerWeek=D,_.dateToCell=x,_.dateToDayOffset=k,_.dayOffsetToCellOffset=M,_.cellOffsetToCell=R,_.cellToDate=T,_.cellToCellOffset=C,_.cellOffsetToDayOffset=E,_.dayOffsetToDate=S,_.rangeToSegments=H;var L,Z=o("hiddenDays")||[],B=[],P=[],j=[],I=o("isRTL");(function(){o("weekends")===!1&&Z.push(0,6);for(var e=0,n=0;7>e;e++)P[e]=n,B[e]=-1!=t.inArray(e,Z),B[e]||(j[n]=e,n++);if(L=n,!L)throw"invalid hiddenDays"})()}function we(){function e(t,e){var n=r(t,!1,!0);Ce(n,function(t,e){M(t.event,e)}),y(n,e),Ce(n,function(t,e){S("eventAfterRender",t.event,t.event,e)})}function n(t,e,n){var a=r([t],!0,!1),o=[];return Ce(a,function(t,r){t.row===e&&r.css("top",n),o.push(r[0])}),o}function r(e,n,r){var o,i,c=q(),f=n?t("
"):c,v=a(e);return s(v),o=l(v),f[0].innerHTML=o,i=f.children(),n&&c.append(i),d(v,i),Ce(v,function(t,e){t.hsides=b(e,!0)}),Ce(v,function(t,e){e.width(Math.max(0,t.outerWidth-t.hsides))}),Ce(v,function(t,e){t.outerHeight=e.outerHeight(!0)}),u(v,r),v}function a(t){var e,n,r=C.getResources,a=[];if(r===void 0)for(e=0;t.length>e;e++)n=i(t[e]),a.push.apply(a,n);else for(e=0;r().length>e;e++)for(var s=o(r()[e],t),l=0;s.length>l;l++)n=i(s[l],e),a.push.apply(a,n);return a}function o(e,n){for(var r=[],a=0;n.length>a;a++)n[a].resources&&t.inArray(e.id,n[a].resources)>=0&&r.push(n[a]);return r}function i(t,e){for(var n=U(t.start,re(t)),r=0;n.length>r;r++)e!==void 0&&(n[r].leftCol=e,n[r].rightCol=e),n[r].event=t;return n}function s(t){for(var e=E("isRTL"),n=0;t.length>n;n++){var r=t[n],a=(e?r.isEnd:r.isStart)?j:B,o=(e?r.isStart:r.isEnd)?I:P,i=a(r.leftCol),s=o(r.rightCol);r.left=i,r.outerWidth=s-i}}function l(t){for(var e="",n=0;t.length>n;n++)e+=c(t[n]);return e}function c(t){var e="",n=E("isRTL"),r=t.event,a=r.url,o=["fc-event","fc-event-hori"];x(r)&&o.push("fc-event-draggable"),t.isStart&&o.push("fc-event-start"),t.isEnd&&o.push("fc-event-end"),o=o.concat(r.className),r.source&&(o=o.concat(r.source.className||[]));var i=F(r,E);return e+=a?""+"
",!r.allDay&&t.isStart&&(e+=""+H(C.getEventTimeText(r))+""),e+=""+H(r.title||"")+""+"
",r.allDay&&t.isEnd&&k(r)&&(e+="
"+"   "+"
"),e+=""}function d(e,n){for(var r=0;e.length>r;r++){var a=e[r],o=a.event,i=n.eq(r),s=S("eventRender",o,o,i);s===!1?i.remove():(s&&s!==!0&&(s=t(s).css({position:"absolute",left:a.left}),i.replaceWith(s),i=s),a.element=i)}}function u(t,e){var n,r=f(t),a=m(),o=[];if(e)for(n=0;a.length>n;n++)a[n].height(r[n]);for(n=0;a.length>n;n++)o.push(a[n].position().top);Ce(t,function(t,e){e.css("top",o[t.row]+t.top)})}function f(t){for(var e,n=Y(),r=L(),a=[],o=v(t),i=0;n>i;i++){var s=o[i],l=[];for(e=0;r>e;e++)l.push(0);for(var c=0;s.length>c;c++){var d=s[c];for(d.top=R(l.slice(d.leftCol,d.rightCol+1)),e=d.leftCol;d.rightCol>=e;e++)l[e]=d.top+d.outerHeight}a.push(R(l))}return a}function v(t){var e,n,r,a=Y(),o=[];for(e=0;t.length>e;e++)n=t[e],r=n.row,n.element&&(o[r]?o[r].push(n):o[r]=[n]);for(r=0;a>r;r++)o[r]=h(o[r]||[]);return o}function h(t){for(var e=[],n=p(t),r=0;n.length>r;r++)e.push.apply(e,n[r]);return e}function p(t){t.sort(Ee);for(var e=[],n=0;t.length>n;n++){for(var r=t[n],a=0;e.length>a&&Te(r,e[a]);a++);e[a]?e[a].push(r):e[a]=[r]}return e}function m(){var t,e=Y(),n=[];for(t=0;e>t;t++)n[t]=Z(t).find("div.fc-day-content > div");return n}function y(t,e){var n=q();Ce(t,function(t,n,r){var a=t.event;a._id===e?D(a,n,t):n[0]._fci=r}),g(n,t,D)}function D(t,e,n){x(t)&&C.draggableDayEvent(t,e,n),t.allDay&&n.isEnd&&k(t)&&C.resizableDayEvent(t,e,n),z(t,e)}function w(t,e){var n,r,a=G();e.draggable({delay:50,opacity:E("dragOpacity"),revertDuration:E("dragRevertDuration"),start:function(o,i){S("eventDragStart",e[0],t,o,i),O(t,e),a.start(function(a,o,i,s){if(e.draggable("option","revert",!a||!i&&!s),X(),a){var l=Q(o),c=Q(a);n=c.diff(l,"days"),r=t.start.clone().add("days",n),$(r,re(t).add("days",n))}else n=0},o,"drag")},stop:function(o,i){a.stop(),X(),S("eventDragStop",e[0],t,o,i),n?A(e[0],t,r,o,i):(e.css("filter",""),_(t,e))}})}function T(e,r,a){var o=E("isRTL"),i=o?"w":"e",s=r.find(".ui-resizable-"+i),l=!1;N(r),r.mousedown(function(t){t.preventDefault()}).click(function(t){l&&(t.preventDefault(),t.stopImmediatePropagation())}),s.mousedown(function(o){function s(n){S("eventResizeStop",r[0],e,n,{}),t("body").css("cursor",""),f.stop(),X(),c&&W(r[0],e,d,n,{}),setTimeout(function(){l=!1 +},0)}if(1==o.which){l=!0;var c,d,u,f=G(),v=r.css("top"),h=t.extend({},e),p=ee(te(e.start));V(),t("body").css("cursor",i+"-resize").one("mouseup",s),S("eventResizeStart",r[0],e,o,{}),f.start(function(r,o){if(r){var s=J(o),l=J(r);if(l=Math.max(l,p),c=K(l)-K(s),d=re(e).add("days",c),c){h.end=d;var f=u;u=n(h,a.row,v),u=t(u),u.find("*").css("cursor",i+"-resize"),f&&f.remove(),O(e)}else u&&(_(e),u.remove(),u=null);X(),$(e.start,d)}},o)}})}var C=this;C.renderDayEvents=e,C.draggableDayEvent=w,C.resizableDayEvent=T;var E=C.opt,S=C.trigger,x=C.isEventDraggable,k=C.isEventResizable,M=C.reportEventElement,z=C.eventElementHandlers,_=C.showEvents,O=C.hideEvents,A=C.eventDrop,W=C.eventResize,Y=C.getRowCnt,L=C.getColCnt,Z=C.allDayRow,B=C.colLeft,P=C.colRight,j=C.colContentLeft,I=C.colContentRight,q=C.getDaySegmentContainer,$=C.renderDayOverlay,X=C.clearOverlays,V=C.clearSelection,G=C.getHoverListener,U=C.rangeToSegments,Q=C.cellToDate,J=C.cellToCellOffset,K=C.cellOffsetToDayOffset,te=C.dateToDayOffset,ee=C.dayOffsetToCellOffset,ne=C.calendar,re=ne.getEventEnd}function Te(t,e){for(var n=0;e.length>n;n++){var r=e[n];if(r.leftCol<=t.rightCol&&r.rightCol>=t.leftCol)return!0}return!1}function Ce(t,e){for(var n=0;t.length>n;n++){var r=t[n],a=r.element;a&&e(r,a,n)}}function Ee(t,e){return e.rightCol-e.leftCol-(t.rightCol-t.leftCol)||e.event.allDay-t.event.allDay||t.event.start-e.event.start||(t.event.title||"").localeCompare(e.event.title)}function Se(){function e(e){var n=c("unselectCancel");n&&t(e.target).parents(n).length||r(e)}function n(t,e){r(),t=l.moment(t),e=e?l.moment(e):u(t),f(t,e),a(t,e)}function r(t){h&&(h=!1,v(),d("unselect",null,t))}function a(t,e,n){h=!0,d("select",null,t,e,n)}function o(e){var n=s.cellToDate,o=s.getIsCellAllDay,i=s.getHoverListener(),l=s.reportDayClick;if(1==e.which&&c("selectable")){r(e);var d;i.start(function(t,e){v(),t&&o(t)?(d=[n(e),n(t)].sort(M),f(d[0],d[1].clone().add("days",1))):d=null},e),t(document).one("mouseup",function(t){i.stop(),d&&(+d[0]==+d[1]&&l(d[0],t),a(d[0],d[1].clone().add("days",1),t))})}}function i(){t(document).off("mousedown",e)}var s=this;s.select=n,s.unselect=r,s.reportSelection=a,s.daySelectionMousedown=o,s.selectionManagerDestroy=i;var l=s.calendar,c=s.opt,d=s.trigger,u=s.defaultSelectionEnd,f=s.renderSelection,v=s.clearSelection,h=!1;c("selectable")&&c("unselectAuto")&&t(document).on("mousedown",e)}function xe(){function e(e,n){var r=o.shift();return r||(r=t("
")),r[0].parentNode!=n[0]&&r.appendTo(n),a.push(r.css(e).show()),r}function n(){for(var t;t=a.shift();)o.push(t.hide().unbind())}var r=this;r.renderOverlay=e,r.clearOverlays=n;var a=[],o=[]}function ke(t){var e,n,r=this;r.build=function(){e=[],n=[],t(e,n)},r.cell=function(t,r){var a,o=e.length,i=n.length,s=-1,l=-1;for(a=0;o>a;a++)if(r>=e[a][0]&&e[a][1]>r){s=a;break}for(a=0;i>a;a++)if(t>=n[a][0]&&n[a][1]>t){l=a;break}return s>=0&&l>=0?{row:s,col:l}:null},r.rect=function(t,r,a,o,i){var s=i.offset();return{top:e[t][0]-s.top,left:n[r][0]-s.left,width:n[o][1]-n[r][0],height:e[a][1]-e[t][0]}}}function Me(e){function n(t){Re(t);var n=e.cell(t.pageX,t.pageY);(Boolean(n)!==Boolean(i)||n&&(n.row!=i.row||n.col!=i.col))&&(n?(o||(o=n),a(n,o,n.row-o.row,n.col-o.col)):a(n,o),i=n)}var r,a,o,i,s=this;s.start=function(s,l,c){a=s,o=i=null,e.build(),n(l),r=c||"mousemove",t(document).bind(r,n)},s.stop=function(){return t(document).unbind(r,n),i}}function Re(t){void 0===t.pageX&&(t.pageX=t.originalEvent.pageX,t.pageY=t.originalEvent.pageY)}function ze(t){function e(e){return r[e]=r[e]||t(e)}var n=this,r={},a={},o={};n.left=function(t){return a[t]=void 0===a[t]?e(t).position().left:a[t]},n.right=function(t){return o[t]=void 0===o[t]?n.left(t)+e(t).width():o[t]},n.clear=function(){r={},a={},o={}}}var He={lang:"en",defaultTimedEventDuration:"02:00:00",defaultAllDayEventDuration:{days:1},forceEventDuration:!1,nextDayThreshold:"09:00:00",defaultView:"month",aspectRatio:1.35,header:{left:"title",center:"",right:"today prev,next"},weekends:!0,weekNumbers:!1,weekNumberTitle:"W",weekNumberCalculation:"local",lazyFetching:!0,startParam:"start",endParam:"end",timezoneParam:"timezone",timezone:!1,titleFormat:{month:"MMMM YYYY",week:"ll",day:"LL"},columnFormat:{month:"ddd",week:r,day:"dddd"},timeFormat:{"default":n},displayEventEnd:{month:!1,basicWeek:!1,"default":!0},isRTL:!1,defaultButtonText:{prev:"prev",next:"next",prevYear:"prev year",nextYear:"next year",today:"today",month:"month",week:"week",day:"day"},buttonIcons:{prev:"left-single-arrow",next:"right-single-arrow",prevYear:"left-double-arrow",nextYear:"right-double-arrow"},theme:!1,themeButtonIcons:{prev:"circle-triangle-w",next:"circle-triangle-e",prevYear:"seek-prev",nextYear:"seek-next"},unselectAuto:!0,dropAccept:"*",handleWindowResize:!0,windowResizeDelay:200},_e={en:{columnFormat:{week:"ddd M/D"}}},Ne={header:{left:"next,prev today",center:"",right:"title"},buttonIcons:{prev:"right-single-arrow",next:"left-single-arrow",prevYear:"right-double-arrow",nextYear:"left-double-arrow"},themeButtonIcons:{prev:"circle-triangle-e",next:"circle-triangle-w",nextYear:"seek-prev",prevYear:"seek-next"}},Oe=t.fullCalendar={version:"2.0.2"},Fe=Oe.views={};t.fn.fullCalendar=function(e){var n=Array.prototype.slice.call(arguments,1),r=this;return this.each(function(a,o){var i,l=t(o),c=l.data("fullCalendar");"string"==typeof e?c&&t.isFunction(c[e])&&(i=c[e].apply(c,n),a||(r=i),"destroy"===e&&l.removeData("fullCalendar")):c||(c=new s(l,e),l.data("fullCalendar",c),c.render())}),r},Oe.langs=_e,Oe.datepickerLang=function(e,n,r){var a=_e[e];a||(a=_e[e]={}),o(a,{isRTL:r.isRTL,weekNumberTitle:r.weekHeader,titleFormat:{month:r.showMonthAfterYear?"YYYY["+r.yearSuffix+"] MMMM":"MMMM YYYY["+r.yearSuffix+"]"},defaultButtonText:{prev:_(r.prevText),next:_(r.nextText),today:_(r.currentText)}}),t.datepicker&&(t.datepicker.regional[n]=t.datepicker.regional[e]=r,t.datepicker.regional.en=t.datepicker.regional[""],t.datepicker.setDefaults(r))},Oe.lang=function(t,e){var n;e&&(n=_e[t],n||(n=_e[t]={}),o(n,e||{})),He.lang=t},Oe.sourceNormalizers=[],Oe.sourceFetchers=[];var Ae={dataType:"json",cache:!1},We=1;Oe.applyAll=A;var Ye=["sun","mon","tue","wed","thu","fri","sat"],Le=/^\s*\d{4}-\d\d$/,Ze=/^\s*\d{4}-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?)?$/;Oe.moment=function(){return Y(arguments)},Oe.moment.utc=function(){var t=Y(arguments,!0);return t.hasTime()&&t.utc(),t},Oe.moment.parseZone=function(){return Y(arguments,!0,!0)},L.prototype=f(e.fn),L.prototype.clone=function(){return Y([this])},L.prototype.time=function(t){if(null==t)return e.duration({hours:this.hours(),minutes:this.minutes(),seconds:this.seconds(),milliseconds:this.milliseconds()});delete this._ambigTime,e.isDuration(t)||e.isMoment(t)||(t=e.duration(t));var n=0;return e.isDuration(t)&&(n=24*Math.floor(t.asDays())),this.hours(n+t.hours()).minutes(t.minutes()).seconds(t.seconds()).milliseconds(t.milliseconds())},L.prototype.stripTime=function(){var t=this.toArray();return e.fn.utc.call(this),this.year(t[0]).month(t[1]).date(t[2]).hours(0).minutes(0).seconds(0).milliseconds(0),this._ambigTime=!0,this._ambigZone=!0,this},L.prototype.hasTime=function(){return!this._ambigTime},L.prototype.stripZone=function(){var t=this.toArray(),n=this._ambigTime;return e.fn.utc.call(this),this.year(t[0]).month(t[1]).date(t[2]).hours(t[3]).minutes(t[4]).seconds(t[5]).milliseconds(t[6]),n&&(this._ambigTime=!0),this._ambigZone=!0,this},L.prototype.hasZone=function(){return!this._ambigZone},L.prototype.zone=function(t){return null!=t&&(delete this._ambigTime,delete this._ambigZone),e.fn.zone.apply(this,arguments)},L.prototype.local=function(){var t=this.toArray(),n=this._ambigZone;return delete this._ambigTime,delete this._ambigZone,e.fn.local.apply(this,arguments),n&&this.year(t[0]).month(t[1]).date(t[2]).hours(t[3]).minutes(t[4]).seconds(t[5]).milliseconds(t[6]),this},L.prototype.utc=function(){return delete this._ambigTime,delete this._ambigZone,e.fn.utc.apply(this,arguments)},L.prototype.format=function(){return arguments[0]?P(this,arguments[0]):this._ambigTime?B(this,"YYYY-MM-DD"):this._ambigZone?B(this,"YYYY-MM-DD[T]HH:mm:ss"):B(this)},L.prototype.toISOString=function(){return this._ambigTime?B(this,"YYYY-MM-DD"):this._ambigZone?B(this,"YYYY-MM-DD[T]HH:mm:ss"):e.fn.toISOString.apply(this,arguments)},L.prototype.isWithin=function(t,e){var n=Z([this,t,e]);return n[0]>=n[1]&&n[0]