wishthis/semantic/dist/components/calendar.min.js
2022-02-23 22:46:34 +01:00

11 lines
No EOL
26 KiB
JavaScript

/*
* # Fomantic UI - 2.8.8
* https://github.com/fomantic/Fomantic-UI
* http://fomantic-ui.com/
*
* Copyright 2022 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
!function(re,T,k,oe){"use strict";re.isFunction=re.isFunction||function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},T=void 0!==T&&T.Math==Math?T:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),re.fn.calendar=function(g){var D,e=re(this),y=e.selector||"",v=(new Date).getTime(),b=[],C=g,w="string"==typeof C,M=[].slice.call(arguments,1),x={5:{row:4,column:3},10:{row:3,column:2},15:{row:2,column:2},20:{row:3,column:1},30:{row:2,column:1}},ne=["","one","two","three","four","five","six","seven","eight"];return e.each(function(){var c,t,$=re.isPlainObject(g)?re.extend(!0,{},re.fn.calendar.settings,g):re.extend({},re.fn.calendar.settings),Q=$.className,a=$.namespace,n=$.selector,Z=$.formatter,o=$.parser,X=$.metadata,te=x[$.minTimeGap],l=$.error,e="."+a,d="module-"+a,r=re(this),i=r.find(n.input),_=r.find(n.popup),u=r.find(n.activator),s=this,p=r.data(d),f=!1,ae=r.hasClass(Q.inverted),m=!1,h=!1,ee={initialize:function(){ee.debug("Initializing calendar for",s,r),c=ee.get.isTouch(),ee.setup.config(),ee.setup.popup(),ee.setup.inline(),ee.setup.input(),ee.setup.date(),ee.create.calendar(),ee.bind.events(),ee.observeChanges(),ee.instantiate()},instantiate:function(){ee.verbose("Storing instance of calendar"),p=ee,r.data(d,p)},destroy:function(){ee.verbose("Destroying previous calendar for",s),r.removeData(d),ee.unbind.events(),ee.disconnect.classObserver()},setup:{config:function(){null!==ee.get.minDate()&&ee.set.minDate(r.data(X.minDate)),null!==ee.get.maxDate()&&ee.set.maxDate(r.data(X.maxDate)),ee.setting("type",ee.get.type()),ee.setting("on",$.on||(i.length?"focus":"click"))},popup:function(){var e,t,a;$.inline||(u.length||(u=r.children().first()).length)&&(re.fn.popup!==oe?(_.length||(e=0!==(t=u.parent()).closest(n.append).length?"appendTo":"prependTo",_=re("<div/>").addClass(Q.popup)[e](t)),_.addClass(Q.calendar),ae&&_.addClass(Q.inverted),e=function(){return ee.refreshTooltips(),$.onVisible.apply(_,arguments)},t=$.onHidden,i.length||(_.attr("tabindex","0"),e=function(){return ee.refreshTooltips(),ee.focus(),$.onVisible.apply(_,arguments)},t=function(){return ee.blur(),$.onHidden.apply(_,arguments)}),a=ee.setting("on"),a=re.extend({},$.popupOptions,{popup:_,on:a,hoverable:"hover"===a,closable:"click"===a,onShow:function(){return ee.set.focusDate(ee.get.date()),ee.set.mode(ee.get.validatedMode($.startMode)),$.onShow.apply(_,arguments)},onVisible:e,onHide:$.onHide,onHidden:t}),ee.popup(a)):ee.error(l.popup))},inline:function(){u.length&&!$.inline||($.inline=!0,_=re("<div/>").addClass(Q.calendar).appendTo(r),i.length||_.attr("tabindex","0"))},input:function(){$.touchReadonly&&i.length&&c&&i.prop("readonly",!0),ee.check.disabled()},date:function(){var e;$.initialDate?e=o.date($.initialDate,$):r.data(X.date)!==oe?e=o.date(r.data(X.date),$):i.length&&(e=o.date(i.val(),$)),ee.set.date(e,$.formatInput,!1),ee.set.mode(ee.get.mode(),!1)}},trigger:{change:function(){var e,t=i[0];t&&(e=k.createEvent("HTMLEvents"),ee.verbose("Triggering native change event"),e.initEvent("change",!0,!1),t.dispatchEvent(e))}},create:{calendar:function(){var u,c,p,e=ee.get.mode(),f=new Date,m=ee.get.date(),h=ee.get.focusDate(),g=ee.helper.dateInRange(h||m||$.initialDate||f),t=(h||ee.set.focusDate(h=g,!1,!1),"year"===e),D="month"===e,a="day"===e,y="hour"===e,v="minute"===e,b="time"===$.type,C=Math.max($.multiMonth,1),w=a?ee.get.monthOffset():0,M=g.getMinutes(),x=g.getHours(),T=g.getDate(),k=g.getMonth()+w,n=g.getFullYear(),O=a?$.showWeekNumbers?8:7:y?4:te.column,F=a||y?6:te.row,N=a?C:1,A=(E=_).hasClass("left")?"right center":"left center";for(E.empty(),1<N&&(p=re("<div/>").addClass(Q.grid).appendTo(E)),c=0;c<N;c++){1<N&&(E=re("<div/>").addClass(Q.column).appendTo(p));var E,r=k+c,H=(new Date(n,r,1).getDay()-$.firstDayOfWeek%7+7)%7,Y=(!$.constantHeight&&a&&(Y=new Date(n,r+1,0).getDate()+H,F=Math.ceil(Y/7)),t?10:D?1:0),I=a?1:0,j=y||v?1:0,S=y||v?T:1,q=new Date(n-Y,r-I,S-j,x),I=new Date(n+Y,r+I,S+j,x),S=t?new Date(10*Math.ceil(n/10)-9,0,0):D?new Date(n,0,0):a?new Date(n,r,0):new Date(n,r,T,-1),j=t?new Date(10*Math.ceil(n/10)+1,0,1):D?new Date(n+1,0,1):a?new Date(n,r+1,1):new Date(n,r,T+1),W=e,W=(a&&$.showWeekNumbers&&(W+=" andweek"),re("<table/>").addClass(Q.table).addClass(W).addClass(ne[O]+" column").appendTo(E)),R=(ae&&W.addClass(Q.inverted),O);if(!b){var V=re("<thead/>").appendTo(W),G=re("<tr/>").appendTo(V),o=re("<th/>").attr("colspan",""+O).appendTo(G),P=t||D?new Date(n,0,1):a?new Date(n,r,1):new Date(n,r,T,x,M),B=re("<span/>").addClass(Q.link).appendTo(o),P=(B.text(Z.header(P,e,$)),D?$.disableYear?"day":"year":a?$.disableMonth?"year":"month":"day");if(B.data(X.mode,P),0===c&&((B=re("<span/>").addClass(Q.prev).appendTo(o)).data(X.focusDate,q),B.toggleClass(Q.disabledCell,!ee.helper.isDateInRange(S,e)),re("<i/>").addClass(Q.prevIcon).appendTo(B)),c===N-1&&((P=re("<span/>").addClass(Q.next).appendTo(o)).data(X.focusDate,I),P.toggleClass(Q.disabledCell,!ee.helper.isDateInRange(j,e)),re("<i/>").addClass(Q.nextIcon).appendTo(P)),a)for(G=re("<tr/>").appendTo(V),$.showWeekNumbers&&((o=re("<th/>").appendTo(G)).text($.text.weekNo),o.addClass(Q.weekCell),R--),i=0;i<R;i++)(o=re("<th/>").appendTo(G)).text(Z.dayColumnHeader((i+$.firstDayOfWeek)%7,$))}for(var K=re("<tbody/>").appendTo(W),i=t?10*Math.ceil(n/10)-9:a?1-H:0,U=0;U<F;U++)for(G=re("<tr/>").appendTo(K),a&&$.showWeekNumbers&&((o=re("<th/>").appendTo(G)).text(ee.get.weekOfYear(n,r,i+1-$.firstDayOfWeek)),o.addClass(Q.weekCell)),u=0;u<R;u++,i++){var s,l=t?new Date(i,r,1,x,M):D?new Date(n,i,1,x,M):a?new Date(n,r,i,x,M):y?new Date(n,r,T,i):new Date(n,r,T,x,i*$.minTimeGap),J=t?i:D?$.text.monthsShort[i]:a?l.getDate():Z.time(l,$,!0),J=((o=re("<td/>").addClass(Q.cell).appendTo(G)).text(J),o.data(X.date,l),a&&l.getMonth()!==(r+12)%12),z=!$.selectAdjacentDays&&J||!ee.helper.isDateInRange(l,e)||$.isDisabled(l,e)||ee.helper.isDisabled(l,e)||!ee.helper.isEnabled(l,e),d=(z?null!==(d=ee.helper.findDayAsObject(l,e,$.disabledDates))&&d[X.message]&&(o.attr("data-tooltip",d[X.message]),o.attr("data-position",d[X.position]||A),(d[X.inverted]||ae&&d[X.inverted]===oe)&&o.attr("data-inverted",""),d[X.variation]&&o.attr("data-variation",d[X.variation])):null!==(s=ee.helper.findDayAsObject(l,e,$.eventDates))&&(o.addClass(s[X.class]||$.eventClass),s[X.message]&&(o.attr("data-tooltip",s[X.message]),o.attr("data-position",s[X.position]||A),(s[X.inverted]||ae&&s[X.inverted]===oe)&&o.attr("data-inverted",""),s[X.variation]&&o.attr("data-variation",s[X.variation]))),ee.helper.dateEqual(l,m,e)),L=ee.helper.dateEqual(l,f,e),J=(o.toggleClass(Q.adjacentCell,J&&!s),o.toggleClass(Q.disabledCell,z),o.toggleClass(Q.activeCell,d&&!(J&&z)),y||v||o.toggleClass(Q.todayCell,!J&&L),{mode:e,adjacent:J,disabled:z,active:d,today:L});Z.cell(o,l,J),ee.helper.dateEqual(l,h,e)&&ee.set.focusDate(l,!1,!1)}$.today&&(q=re("<tr/>").appendTo(K),(S=re("<td/>").attr("colspan",""+O).addClass(Q.today).appendTo(q)).text(Z.today($)),S.data(X.date,f)),ee.update.focus(!1,W),$.inline&&ee.refreshTooltips()}}},update:{focus:function(e,t){t=t||_;var i=ee.get.mode(),a=ee.get.date(),s=ee.get.focusDate(),l=ee.get.startDate(),d=ee.get.endDate(),u=(e?s:null)||a||(c?null:s);t.find("td").each(function(){var e,t,a,n,r=re(this),o=r.data(X.date);o&&(e=r.hasClass(Q.disabledCell),t=r.hasClass(Q.activeCell),a=r.hasClass(Q.adjacentCell),n=ee.helper.dateEqual(o,s,i),o=!!u&&(!!l&&ee.helper.isDateInRange(o,i,l,u)||!!d&&ee.helper.isDateInRange(o,i,u,d)),r.toggleClass(Q.focusCell,n&&(!c||f)&&(!a||$.selectAdjacentDays&&a)&&!e),ee.helper.isTodayButton(r)||r.toggleClass(Q.rangeCell,o&&!t&&!e))})}},refresh:function(){ee.create.calendar()},refreshTooltips:function(){var n=re(T).width();_.find("td[data-position]").each(function(){var e=re(this),t=T.getComputedStyle(e[0],":after").width.replace(/[^0-9\.]/g,""),a=e.attr("data-position"),t=n-e.width()-(parseInt(t,10)||250)>e.offset().left?"right":"left";-1===a.indexOf(t)&&e.attr("data-position",a.replace(/(left|right)/,t))})},bind:{events:function(){ee.debug("Binding events"),_.on("mousedown"+e,ee.event.mousedown),_.on("touchstart"+e,ee.event.mousedown),_.on("mouseup"+e,ee.event.mouseup),_.on("touchend"+e,ee.event.mouseup),_.on("mouseover"+e,ee.event.mouseover),i.length?(i.on("input"+e,ee.event.inputChange),i.on("focus"+e,ee.event.inputFocus),i.on("blur"+e,ee.event.inputBlur),i.on("keydown"+e,ee.event.keydown)):_.on("keydown"+e,ee.event.keydown)}},unbind:{events:function(){ee.debug("Unbinding events"),_.off(e),i.length&&i.off(e)}},event:{mouseover:function(e){var t=re(e.target).data(X.date),e=1===e.buttons;t&&ee.set.focusDate(t,!1,!0,e)},mousedown:function(e){i.length&&e.preventDefault(),f=0<=e.type.indexOf("touch");e=re(e.target).data(X.date);e&&ee.set.focusDate(e,!1,!0,!0)},mouseup:function(e){ee.focus(),e.preventDefault(),e.stopPropagation(),f=!1;var t,a,n,e=re(e.target);e.hasClass("disabled")||(t=(e=(t=e.parent()).data(X.date)||t.data(X.focusDate)||t.data(X.mode)?t:e).data(X.date),a=e.data(X.focusDate),n=e.data(X.mode),t&&!1!==$.onSelect.call(s,t,ee.get.mode())?(e=e.hasClass(Q.today),ee.selectDate(t,e)):a?ee.set.focusDate(a):n&&ee.set.mode(n))},keydown:function(e){var t,a,n,r,o,i,s,l=e.which;27!==l&&9!==l||ee.popup("hide"),ee.popup("is visible")&&(37===l||38===l||39===l||40===l?(r="day"===(i=ee.get.mode())?7:"hour"===i?4:"minute"===i?te.column:3,r=37===l?-1:38===l?-r:39==l?1:r,r*="minute"===i?$.minTimeGap:1,o=(t=ee.get.focusDate()||ee.get.date()||new Date).getFullYear()+("year"===i?r:0),s=t.getMonth()+("month"===i?r:0),a=t.getDate()+("day"===i?r:0),n=t.getHours()+("hour"===i?r:0),r=t.getMinutes()+("minute"===i?r:0),o=new Date(o,s,a,n,r),"time"===$.type&&(o=ee.helper.mergeDateTime(t,o)),ee.helper.isDateInRange(o,i)&&ee.set.focusDate(o)):13===l&&(i=ee.get.mode(),(s=ee.get.focusDate())&&!$.isDisabled(s,i)&&!ee.helper.isDisabled(s,i)&&ee.helper.isEnabled(s,i)&&ee.selectDate(s),e.preventDefault(),e.stopPropagation())),38!==l&&40!==l||(e.preventDefault(),ee.popup("show"))},inputChange:function(){var e=i.val(),e=o.date(e,$);ee.set.date(e,!1)},inputFocus:function(){_.addClass(Q.active)},inputBlur:function(){var e;_.removeClass(Q.active),$.formatInput&&(e=ee.get.date(),e=Z.datetime(e,$),i.val(e)),h&&(ee.trigger.change(),h=!1)},class:{mutation:function(e){e.forEach(function(e){"class"===e.attributeName&&ee.check.disabled()})}}},observeChanges:function(){"MutationObserver"in T&&(t=new MutationObserver(ee.event.class.mutation),ee.debug("Setting up mutation observer",t),ee.observe.class())},disconnect:{classObserver:function(){i.length&&t&&t.disconnect()}},observe:{class:function(){i.length&&t&&t.observe(r[0],{attributes:!0})}},is:{disabled:function(){return r.hasClass(Q.disabled)}},check:{disabled:function(){i.attr("tabindex",ee.is.disabled()?-1:0)}},get:{weekOfYear:function(e,t,a){return e=Date.UTC(e,t,a+3)/864e5,e=Math.floor(e/7),t=new Date(6048e5*e).getUTCFullYear(),e-Math.floor(Date.UTC(t,0,7)/6048e5)+1},date:function(){return ee.helper.sanitiseDate(r.data(X.date))||null},inputDate:function(){return i.val()},focusDate:function(){return r.data(X.focusDate)||null},startDate:function(){var e=ee.get.calendarModule($.startCalendar);return(e?e.get.date():r.data(X.startDate))||null},endDate:function(){var e=ee.get.calendarModule($.endCalendar);return(e?e.get.date():r.data(X.endDate))||null},minDate:function(){return r.data(X.minDate)||null},maxDate:function(){return r.data(X.maxDate)||null},monthOffset:function(){return r.data(X.monthOffset)||0},mode:function(){var e=r.data(X.mode)||$.startMode;return ee.get.validatedMode(e)},validatedMode:function(e){var t=ee.get.validModes();return 0<=re.inArray(e,t)?e:"time"===$.type?"hour":"month"===$.type?"month":"year"===$.type?"year":"day"},type:function(){return r.data(X.type)||$.type},validModes:function(){var e=[];return"time"!==$.type&&($.disableYear&&"year"!==$.type||e.push("year"),($.disableMonth||"year"===$.type)&&"month"!==$.type||e.push("month"),0<=$.type.indexOf("date")&&e.push("day")),0<=$.type.indexOf("time")&&(e.push("hour"),$.disableMinute||e.push("minute")),e},isTouch:function(){try{return k.createEvent("TouchEvent"),!0}catch(e){return!1}},calendarModule:function(e){return e?(e=e instanceof re?e:re(e).first()).data(d):null}},set:{date:function(e,t,a){t=!1!==t,a=!1!==a,e=ee.helper.sanitiseDate(e),e=ee.helper.dateInRange(e);var n=ee.get.mode(),r=Z.datetime(e,$);if(a&&!1===$.onBeforeChange.call(s,e,r,n))return!1;if(ee.set.focusDate(e),$.isDisabled(e,n))return!1;var o=ee.get.endDate();o&&e&&o<e&&ee.set.endDate(oe),ee.set.dataKeyValue(X.date,e),t&&i.length&&i.val(r),a&&$.onChange.call(s,e,r,n)},startDate:function(e,t){e=ee.helper.sanitiseDate(e);var a=ee.get.calendarModule($.startCalendar);a&&a.set.date(e),ee.set.dataKeyValue(X.startDate,e,t)},endDate:function(e,t){e=ee.helper.sanitiseDate(e);var a=ee.get.calendarModule($.endCalendar);a&&a.set.date(e),ee.set.dataKeyValue(X.endDate,e,t)},focusDate:function(e,t,a,n){e=ee.helper.sanitiseDate(e),e=ee.helper.dateInRange(e);var r="day"===ee.get.mode(),o=ee.get.focusDate(),r=(r&&e&&o&&((r=12*(e.getFullYear()-o.getFullYear())+e.getMonth()-o.getMonth())&&(o=ee.get.monthOffset()-r,ee.set.monthOffset(o,!1))),ee.set.dataKeyValue(X.focusDate,e,!!e&&t));a=!1!==a&&r&&!1===t||m!=n,m=n,a&&ee.update.focus(n)},minDate:function(e){e=ee.helper.sanitiseDate(e),null!==$.maxDate&&$.maxDate<=e?ee.verbose("Unable to set minDate variable bigger that maxDate variable",e,$.maxDate):(ee.setting("minDate",e),ee.set.dataKeyValue(X.minDate,e))},maxDate:function(e){e=ee.helper.sanitiseDate(e),null!==$.minDate&&$.minDate>=e?ee.verbose("Unable to set maxDate variable lower that minDate variable",e,$.minDate):(ee.setting("maxDate",e),ee.set.dataKeyValue(X.maxDate,e))},monthOffset:function(e,t){var a=Math.max($.multiMonth,1);e=Math.max(1-a,Math.min(0,e)),ee.set.dataKeyValue(X.monthOffset,e,t)},mode:function(e,t){ee.set.dataKeyValue(X.mode,e,t)},dataKeyValue:function(e,t,a){var n=r.data(e),n=n===t||n<=t&&t<=n;return t?r.data(e,t):r.removeData(e),(a=!1!==a&&!n)&&ee.refresh(),!n}},selectDate:function(e,t){ee.verbose("New date selection",e);var a=ee.get.mode();t||"minute"===a||$.disableMinute&&"hour"===a||"date"===$.type&&"day"===a||"month"===$.type&&"month"===a||"year"===$.type&&"year"===a?!1===ee.set.date(e)||(h=!0,$.closable&&(ee.popup("hide"),(t=ee.get.calendarModule($.endCalendar))&&("focus"!==t.setting("on")&&t.popup("show"),t.focus()))):(t="year"===a?$.disableMonth?"day":"month":"month"===a?"day":"day"===a?"hour":"minute",ee.set.mode(t),"hour"===a||"day"===a&&ee.get.date()?ee.set.date(e,!0,!1):ee.set.focusDate(e))},changeDate:function(e){ee.set.date(e)},clear:function(){ee.set.date(oe)},popup:function(){return u.popup.apply(u,arguments)},focus:function(){(i.length?i:_).focus()},blur:function(){(i.length?i:_).blur()},helper:{isDisabled:function(a,n){return("day"===n||"month"===n||"year"===n)&&("day"===n&&-1!==$.disabledDaysOfWeek.indexOf(a.getDay())||$.disabledDates.some(function(e){return(e="string"==typeof e?ee.helper.sanitiseDate(e):e)instanceof Date?ee.helper.dateEqual(a,e,n):null!==e&&"object"==typeof e?e[X.year]?"number"==typeof e[X.year]?a.getFullYear()==e[X.year]:Array.isArray(e[X.year])?-1<e[X.year].indexOf(a.getFullYear()):void 0:e[X.month]?"number"==typeof e[X.month]?a.getMonth()==e[X.month]:Array.isArray(e[X.month])?-1<e[X.month].indexOf(a.getMonth()):e[X.month]instanceof Date?(t=ee.helper.sanitiseDate(e[X.month]),a.getMonth()==t.getMonth()&&a.getFullYear()==t.getFullYear()):void 0:e[X.date]&&"day"===n?e[X.date]instanceof Date?ee.helper.dateEqual(a,ee.helper.sanitiseDate(e[X.date]),n):Array.isArray(e[X.date])?e[X.date].some(function(e){return ee.helper.dateEqual(a,e,n)}):void 0:void 0:void 0;var t}))},isEnabled:function(t,a){return"day"!==a||(0===$.enabledDates.length||$.enabledDates.some(function(e){return(e="string"==typeof e?ee.helper.sanitiseDate(e):e)instanceof Date?ee.helper.dateEqual(t,e,a):null!==e&&"object"==typeof e&&e[X.date]?ee.helper.dateEqual(t,ee.helper.sanitiseDate(e[X.date]),a):void 0}))},findDayAsObject:function(t,a,e){if("day"===a||"month"===a||"year"===a)for(var n,r=0;r<e.length;r++){if((n="string"==typeof(n=e[r])?ee.helper.sanitiseDate(n):n)instanceof Date&&ee.helper.dateEqual(t,n,a))return(o={})[X.date]=n,o;if(null!==n&&"object"==typeof n)if(n[X.year]){if("number"==typeof n[X.year]&&t.getFullYear()==n[X.year])return n;if(Array.isArray(n[X.year])&&-1<n[X.year].indexOf(t.getFullYear()))return n}else if(n[X.month]){if("number"==typeof n[X.month]&&t.getMonth()==n[X.month])return n;if(Array.isArray(n[X.month])){if(-1<n[X.month].indexOf(t.getMonth()))return n}else if(n[X.month]instanceof Date){var o=ee.helper.sanitiseDate(n[X.month]);if(t.getMonth()==o.getMonth()&&t.getFullYear()==o.getFullYear())return n}}else if(n[X.date]&&"day"===a){if(n[X.date]instanceof Date&&ee.helper.dateEqual(t,ee.helper.sanitiseDate(n[X.date]),a))return n;if(Array.isArray(n[X.date])&&n[X.date].some(function(e){return ee.helper.dateEqual(t,e,a)}))return n}}return null},sanitiseDate:function(e){return!(e=e instanceof Date?e:o.date(""+e,$))||isNaN(e.getTime())?null:e},dateDiff:function(e,t,a){var n="time"===$.type,r="year"===(a=a||"day"),o=r||"month"===a,i="minute"===a,a=i||"hour"===a;return e=new Date(n?2e3:e.getFullYear(),n||r?0:e.getMonth(),n||o?1:e.getDate(),a?e.getHours():0,i?$.minTimeGap*Math.floor(e.getMinutes()/$.minTimeGap):0),(t=new Date(n?2e3:t.getFullYear(),n||r?0:t.getMonth(),n||o?1:t.getDate(),a?t.getHours():0,i?$.minTimeGap*Math.floor(t.getMinutes()/$.minTimeGap):0)).getTime()-e.getTime()},dateEqual:function(e,t,a){return!!e&&!!t&&0===ee.helper.dateDiff(e,t,a)},isDateInRange:function(e,t,a,n){var r;return a||n||(a=(r=ee.get.startDate())&&$.minDate?new Date(Math.max(r,$.minDate)):r||$.minDate,n=$.maxDate),a=a&&new Date(a.getFullYear(),a.getMonth(),a.getDate(),a.getHours(),$.minTimeGap*Math.ceil(a.getMinutes()/$.minTimeGap)),!(!e||a&&0<ee.helper.dateDiff(e,a,t)||n&&0<ee.helper.dateDiff(n,e,t))},dateInRange:function(e,t,a){t||a||(t=(n=ee.get.startDate())&&$.minDate?new Date(Math.max(n,$.minDate)):n||$.minDate,a=$.maxDate),t=t&&new Date(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),$.minTimeGap*Math.ceil(t.getMinutes()/$.minTimeGap));var n="time"===$.type;return e&&(t&&0<ee.helper.dateDiff(e,t,"minute")?n?ee.helper.mergeDateTime(e,t):t:a&&0<ee.helper.dateDiff(a,e,"minute")?n?ee.helper.mergeDateTime(e,a):a:e)},mergeDateTime:function(e,t){return e&&t?new Date(e.getFullYear(),e.getMonth(),e.getDate(),t.getHours(),t.getMinutes()):t},isTodayButton:function(e){return e.text()===$.text.today}},setting:function(e,t){if(ee.debug("Changing setting",e,t),re.isPlainObject(e))re.extend(!0,$,e);else{if(t===oe)return $[e];re.isPlainObject($[e])?re.extend(!0,$[e],t):$[e]=t}},internal:function(e,t){if(re.isPlainObject(e))re.extend(!0,ee,e);else{if(t===oe)return ee[e];ee[e]=t}},debug:function(){!$.silent&&$.debug&&($.performance?ee.performance.log(arguments):(ee.debug=Function.prototype.bind.call(console.info,console,$.name+":"),ee.debug.apply(console,arguments)))},verbose:function(){!$.silent&&$.verbose&&$.debug&&($.performance?ee.performance.log(arguments):(ee.verbose=Function.prototype.bind.call(console.info,console,$.name+":"),ee.verbose.apply(console,arguments)))},error:function(){$.silent||(ee.error=Function.prototype.bind.call(console.error,console,$.name+":"),ee.error.apply(console,arguments))},performance:{log:function(e){var t,a;$.performance&&(a=(t=(new Date).getTime())-(v||t),v=t,b.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:s,"Execution Time":a})),clearTimeout(ee.performance.timer),ee.performance.timer=setTimeout(ee.performance.display,500)},display:function(){var e=$.name+":",a=0;v=!1,clearTimeout(ee.performance.timer),re.each(b,function(e,t){a+=t["Execution Time"]}),e+=" "+a+"ms",y&&(e+=" '"+y+"'"),(console.group!==oe||console.table!==oe)&&0<b.length&&(console.groupCollapsed(e),console.table?console.table(b):re.each(b,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),b=[]}},invoke:function(n,e,t){var r,o,a,i=p;return e=e||M,t=s||t,"string"==typeof n&&i!==oe&&(n=n.split(/[\. ]/),r=n.length-1,re.each(n,function(e,t){var a=e!=r?t+n[e+1].charAt(0).toUpperCase()+n[e+1].slice(1):n;if(re.isPlainObject(i[a])&&e!=r)i=i[a];else{if(i[a]!==oe)return o=i[a],!1;{if(!re.isPlainObject(i[t])||e==r)return i[t]!==oe?o=i[t]:ee.error(l.method,n),!1;i=i[t]}}})),re.isFunction(o)?a=o.apply(t,e):o!==oe&&(a=o),Array.isArray(D)?D.push(a):D!==oe?D=[D,a]:a!==oe&&(D=a),o}};w?(p===oe&&ee.initialize(),ee.invoke(C)):(p!==oe&&p.invoke("destroy"),ee.initialize())}),D!==oe?D:this},re.fn.calendar.settings={name:"Calendar",namespace:"calendar",silent:!1,debug:!1,verbose:!1,performance:!1,type:"datetime",firstDayOfWeek:0,constantHeight:!0,today:!1,closable:!0,monthFirst:!0,touchReadonly:!0,inline:!1,on:null,initialDate:null,startMode:!1,minDate:null,maxDate:null,ampm:!0,disableYear:!1,disableMonth:!1,disableMinute:!1,formatInput:!0,startCalendar:null,endCalendar:null,multiMonth:1,minTimeGap:5,showWeekNumbers:null,disabledDates:[],disabledDaysOfWeek:[],enabledDates:[],eventDates:[],centuryBreak:60,currentCentury:2e3,selectAdjacentDays:!1,popupOptions:{position:"bottom left",lastResort:"bottom left",prefer:"opposite",hideOnScroll:!1},text:{days:["S","M","T","W","T","F","S"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],today:"Today",now:"Now",am:"AM",pm:"PM",weekNo:"Week"},formatter:{header:function(e,t,a){return"year"===t?a.formatter.yearHeader(e,a):"month"===t?a.formatter.monthHeader(e,a):"day"===t?a.formatter.dayHeader(e,a):"hour"===t?a.formatter.hourHeader(e,a):a.formatter.minuteHeader(e,a)},yearHeader:function(e,t){e=10*Math.ceil(e.getFullYear()/10);return e-9+" - "+(2+e)},monthHeader:function(e,t){return e.getFullYear()},dayHeader:function(e,t){return t.text.months[e.getMonth()]+" "+e.getFullYear()},hourHeader:function(e,t){return t.formatter.date(e,t)},minuteHeader:function(e,t){return t.formatter.date(e,t)},dayColumnHeader:function(e,t){return t.text.days[e]},datetime:function(e,t){if(!e)return"";var a="time"===t.type?"":t.formatter.date(e,t),e=t.type.indexOf("time")<0?"":t.formatter.time(e,t,!1);return a+("datetime"===t.type?" ":"")+e},date:function(e,t){if(!e)return"";var a=e.getDate(),n=t.text.months[e.getMonth()],e=e.getFullYear();return"year"===t.type?e:"month"===t.type?n+" "+e:(t.monthFirst?n+" "+a:a+" "+n)+", "+e},time:function(e,t,a){if(!e)return"";var n=e.getHours(),e=e.getMinutes(),r="";return t.ampm&&(r=" "+(n<12?t.text.am:t.text.pm),n=0===n?12:12<n?n-12:n),n+":"+(e<10?"0":"")+e+r},today:function(e){return"date"===e.type?e.text.today:e.text.now},cell:function(e,t,a){}},parser:{date:function(e,t){if(e instanceof Date)return e;if(!e)return null;if(0===(e=String(e).trim()).length)return null;e.match(/^[0-9]{4}[\/\-\.][0-9]{1,2}[\/\-\.][0-9]{1,2}$/)&&(e=e.replace(/[\/\-\.]/g,"/")+" 00:00:00"),e=t.monthFirst||!e.match(/^[0-9]{1,2}[\/\-\.]/)?e:e.replace(/[\/\-\.]/g,"/").replace(/([0-9]+)\/([0-9]+)/,"$2/$1");var a,n,r,u=new Date(e);if(!(null!==e.match(/^[0-9]+$/))&&!isNaN(u.getDate()))return u;e=e.toLowerCase();var c,p,f,o=-1,i=-1,m=-1,s=-1,l=-1,u=oe,h="time"===t.type,g=t.type.indexOf("time")<0,D=e.split(t.regExp.dateWords),d=e.split(t.regExp.dateNumbers);if(!g)for(u=0<=re.inArray(t.text.am.toLowerCase(),D)||!(0<=re.inArray(t.text.pm.toLowerCase(),D))&&oe,a=0;a<d.length;a++)if(0<=(p=d[a]).indexOf(":")){if(i<0||o<0)for(f=p.split(":"),r=0;r<Math.min(2,f.length);r++)n=parseInt(f[r]),isNaN(n)&&(n=0),0===r?i=n%24:o=n%60;d.splice(a,1)}if(!h){for(a=0;a<D.length;a++)if(!((c=D[a]).length<=0)){for(n=0;n<t.text.months.length;n++)if(t.text.months[n].substring(0,c.length).toLowerCase()===c){s=n+1;break}if(0<=s)break}for(a=0;a<d.length;a++)if(n=parseInt(d[a]),!isNaN(n)&&n>=t.centuryBreak&&a===d.length-1){n<=99&&(n+=t.currentCentury-100),l=n,d.splice(a,1);break}if(s<0)for(a=0;a<d.length;a++)if(r=1<a||t.monthFirst?a:1===a?0:1,n=parseInt(d[r]),!isNaN(n)&&1<=n&&n<=12){s=n,d.splice(r,1);break}for(a=0;a<d.length;a++)if(n=parseInt(d[a]),!isNaN(n)&&1<=n&&n<=31){m=n,d.splice(a,1);break}if(l<0)for(a=d.length-1;0<=a;a--)if(n=parseInt(d[a]),!isNaN(n)){n<=99&&(n+=t.currentCentury),l=n,d.splice(a,1);break}}if(!g){if(i<0)for(a=0;a<d.length;a++)if(n=parseInt(d[a]),!isNaN(n)&&0<=n&&n<=23){i=n,d.splice(a,1);break}if(o<0)for(a=0;a<d.length;a++)if(n=parseInt(d[a]),!isNaN(n)&&0<=n&&n<=59){o=n,d.splice(a,1);break}}if(o<0&&i<0&&m<0&&s<0&&l<0)return null;o<0&&(o=0),i<0&&(i=0),m<0&&(m=1),s<0&&(s=1),l<0&&(l=(new Date).getFullYear()),u!==oe&&(u?12===i&&(i=0):i<12&&(i+=12));e=new Date(l,s-1,m,i,o);return e.getMonth()===s-1&&e.getFullYear()===l||(e=new Date(l,s,0,i,o)),isNaN(e.getTime())?null:e}},onBeforeChange:function(e,t,a){return!0},onChange:function(e,t,a){},onShow:function(){},onVisible:function(){},onHide:function(){},onHidden:function(){},onSelect:function(e,t){},isDisabled:function(e,t){return!1},selector:{popup:".ui.popup",input:"input",activator:"input",append:".inline.field,.inline.fields"},regExp:{dateWords:/[^A-Za-z\u00C0-\u024F]+/g,dateNumbers:/[^\d:]+/g},error:{popup:"UI Popup, a required component is not included in this page",method:"The method you called is not defined."},className:{calendar:"calendar",active:"active",popup:"ui popup",grid:"ui equal width grid",column:"column",table:"ui celled center aligned unstackable table",inverted:"inverted",prev:"prev link",next:"next link",prevIcon:"chevron left icon",nextIcon:"chevron right icon",link:"link",cell:"link",disabledCell:"disabled",weekCell:"disabled",adjacentCell:"adjacent",activeCell:"active",rangeCell:"range",focusCell:"focus",todayCell:"today",today:"today link",disabled:"disabled"},metadata:{date:"date",focusDate:"focusDate",startDate:"startDate",endDate:"endDate",minDate:"minDate",maxDate:"maxDate",mode:"mode",type:"type",monthOffset:"monthOffset",message:"message",class:"class",inverted:"inverted",variation:"variation",position:"position",month:"month",year:"year"},eventClass:"blue"}}(jQuery,window,document);