;(function($){"use strict";ips.controller.register('calendar.front.browse.main',{_ajaxObj:null,initialize:function(){this.on('click','[data-action="changeView"]',this.changeView);this.on(window,'historychange:calendarView',this.stateChange);this.setup();},setup(){ips.utils.history.replaceState({controller:'calendarView'},'calendarView',window.location.href);},changeView(e){e.preventDefault();const title=$(e.currentTarget).attr('title');const url=$(e.currentTarget).attr('href');ips.utils.history.pushState({controller:'calendarView'},'calendarView',url);document.title=title},stateChange(){const data=ips.utils.history.getState('calendarView')||{},url=window.location.href
if(data.controller!=='calendarView'){return;}
ips.utils.analytics.trackPageView(url);this._updateView(url)},_updateView(url){if(this._ajaxObj&&(typeof this._ajaxObj.abort==="function")){this._ajaxObj.abort();}
this._setLoading(true);this._ajaxObj=ips.getAjax()(url,{showLoading:true}).done(response=>{this.scope.html(response);$(document).trigger('contentChange',[this.scope]);}).always(()=>{this._setLoading(false);});},_setLoading(state){if(state){this.scope.animate({opacity:"0.6"},'fast');}else{this.scope.animate({opacity:"1"},'fast');}}});}(jQuery));;
;(function($){"use strict";ips.controller.register('calendar.front.browse.monthView',{_emptyEvent:"<li class='cEvents_event cEvents_empty' data-eventid='0'><span></span></a></li>",initialize:function(){this.setup();},setup:function(){this._alignEvents();},_alignEvents:function(){var days=this.scope[0].querySelectorAll('.cCalendar_date');var currentPositions=[];var self=this;days.forEach((dayEl)=>{var day=$(dayEl);var weekStart=false;if(day.closest('td').is('tr > td:first-child')){weekStart=true;}
var events=day.find('.cEvents_ranged [data-eventID]');if(!events.length){currentPositions=[];return;}
var wrapper=$("<ul/>").addClass('cEvents');var spaces=0;if(currentPositions.length){var doneEvent=false;for(var i=0;i<currentPositions.length;i++){if(events.filter('[data-eventID="'+currentPositions[i]+'"]').length){wrapper.append(events.filter('[data-eventID="'+currentPositions[i]+'"]'));doneEvent=true;}else{if(!weekStart||doneEvent){wrapper.append(self._emptyEvent);spaces++;}}}}
var remainingEvents=day.find('.cEvents_ranged [data-eventID]');if(spaces&&remainingEvents.length){var availableSpaces=wrapper.find('[data-eventID="0"]');for(var i=0;i<=spaces;i++){if(remainingEvents[i]&&availableSpaces[i]){$(availableSpaces[i]).replaceWith($(remainingEvents[i]));}}
remainingEvents=day.find('.cEvents_ranged [data-eventID]');}
wrapper.append(remainingEvents);day.find('.cEvents_ranged > .cEvents').replaceWith(wrapper);currentPositions=[];const rangedEvents=dayEl.querySelectorAll('.cEvents_ranged [data-eventID]');rangedEvents.forEach((event)=>{var eventID=parseInt(event.getAttribute('data-eventID'));if(eventID===0){currentPositions.push('-');}else if(Number.isFinite(eventID)){currentPositions.push(eventID);}});});}});}(jQuery));;