wishthis/node_modules/fomantic-ui/dist/components/calendar.min.js
2022-05-29 11:24:36 +02:00

11 lines
No EOL
26 KiB
JavaScript

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