wishthis/node_modules/fomantic-ui/dist/components/calendar.min.js
2022-06-16 13:46:53 +02:00

11 lines
No EOL
28 KiB
JavaScript

/*
* # Fomantic UI - 2.9.0-beta.294+786baef
* 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,Y,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 y,e=re(this),D=e.selector||"",v=(new Date).getTime(),b=[],M=g,C="string"==typeof M,w=[].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,e,z=re.isPlainObject(g)?re.extend(!0,{},re.fn.calendar.settings,g):re.extend({},re.fn.calendar.settings),Q=z.className,t=z.namespace,a=z.selector,Z=z.formatter,n=z.parser,X=z.metadata,_=x[z.minTimeGap],s=z.error,r="."+t,o="module-"+t,i=re(this),l=i.find(a.input),ee=i.find(a.popup),d=i.find(a.activator),u=this,p=i.data(o),f=!1,te=i.hasClass(Q.inverted),h=!1,m=!1,ae={initialize:function(){ae.debug("Initializing calendar for",u,i),c=ae.get.isTouch(),ae.setup.config(),ae.setup.popup(),ae.setup.inline(),ae.setup.input(),ae.setup.date(),ae.create.calendar(),ae.bind.events(),ae.observeChanges(),ae.instantiate()},instantiate:function(){ae.verbose("Storing instance of calendar"),p=ae,i.data(o,p)},destroy:function(){ae.verbose("Destroying previous calendar for",u),i.removeData(o),ae.unbind.events(),ae.disconnect.classObserver()},setup:{config:function(){null!==ae.get.minDate()&&ae.set.minDate(i.data(X.minDate)),null!==ae.get.maxDate()&&ae.set.maxDate(i.data(X.maxDate)),ae.setting("type",ae.get.type()),ae.setting("on",z.on||"click")},popup:function(){var e,t;z.inline||(d.length||(d=i.children().first()).length)&&(re.fn.popup===oe?ae.error(s.popup):(ee.length||(e=0!==(t=d.parent()).closest(a.append).length?"appendTo":"prependTo",ee=re("<div/>").addClass(Q.popup)[e](t)),ee.addClass(Q.calendar),te&&ee.addClass(Q.inverted),e=function(){return ae.refreshTooltips(),z.onVisible.apply(ee,arguments)},l.length||(ee.attr("tabindex","0"),e=function(){return ae.refreshTooltips(),ae.focus(),z.onVisible.apply(ee,arguments)}),t=ae.setting("on"),t=re.extend({},z.popupOptions,{popup:ee,on:t,hoverable:"hover"===t,closable:"click"===t,onShow:function(){return ae.set.focusDate(ae.get.date()),ae.set.mode(ae.get.validatedMode(z.startMode)),z.onShow.apply(ee,arguments)},onVisible:e,onHide:z.onHide,onHidden:function(){return ae.blur(),z.onHidden.apply(ee,arguments)}}),ae.popup(t)))},inline:function(){d.length&&!z.inline||(z.inline=!0,ee=re("<div/>").addClass(Q.calendar).appendTo(i),l.length||ee.attr("tabindex","0"))},input:function(){z.touchReadonly&&l.length&&c&&l.prop("readonly",!0),ae.check.disabled()},date:function(){var e;z.initialDate?e=n.date(z.initialDate,z):i.data(X.date)!==oe?e=n.date(i.data(X.date),z):l.length&&(e=n.date(l.val(),z)),ae.set.date(e,z.formatInput,!1),ae.set.mode(ae.get.mode(),!1)}},trigger:{change:function(){var e,t=l[0];t&&(e=Y.createEvent("HTMLEvents"),ae.verbose("Triggering native change event"),e.initEvent("change",!0,!1),t.dispatchEvent(e))}},create:{calendar:function(){var e,t,j,a=ae.get.mode(),n=new Date,q=ae.get.date(),r=ae.get.focusDate(),o=ae.helper.dateInRange(r||q||z.initialDate||n),i=(r||ae.set.focusDate(r=o,!1,!1),"year"===a),s="month"===a,l="day"===a,d="hour"===a,u="minute"===a,W="time"===z.type,R=Math.max(z.multiMonth,1),V=l?ae.get.monthOffset():0,c=o.getMinutes(),p=o.getHours(),f=o.getDate(),G=o.getMonth()+V,h=o.getFullYear(),m=l?z.showWeekNumbers?8:7:d?4:_.column,P=l||d?6:_.row,g=l?R:1,y=(D=ee).hasClass("left")?"right center":"left center";for(D.empty(),1<g&&(j=re("<div/>").addClass(Q.grid).appendTo(D)),t=0;t<g;t++){1<g&&(D=re("<div/>").addClass(Q.column).appendTo(j));var D,v=G+t,B=(new Date(h,v,1).getDay()-z.firstDayOfWeek%7+7)%7,b=(!z.constantHeight&&l&&(b=new Date(h,v+1,0).getDate()+B,P=Math.ceil(b/7)),i?10:s?1:0),M=l?1:0,C=d||u?1:0,w=d||u?f:1,x=new Date(h-b,v-M,w-C,p),M=new Date(h+b,v+M,w+C,p),w=i?new Date(10*Math.ceil(h/10)-9,0,0):s?new Date(h,0,0):l?new Date(h,v,0):new Date(h,v,f,-1),C=i?new Date(10*Math.ceil(h/10)+1,0,1):s?new Date(h+1,0,1):l?new Date(h,v+1,1):new Date(h,v,f+1),T=a,T=(l&&z.showWeekNumbers&&(T+=" andweek"),re("<table/>").addClass(Q.table).addClass(T).addClass(ne[m]+" column").appendTo(D)),K=(te&&T.addClass(Q.inverted),m);if(!W){var U=re("<thead/>").appendTo(T),Y=re("<tr/>").appendTo(U),O=re("<th/>").attr("colspan",""+m).appendTo(Y),k=i||s?new Date(h,0,1):l?new Date(h,v,1):new Date(h,v,f,p,c),A=re("<span/>").addClass(Q.link).appendTo(O),k=(A.text(ae.helper.dateFormat(Z[a+"Header"],k)),s?z.disableYear?"day":"year":l?z.disableMonth?"year":"month":"day");if(A.data(X.mode,k),0===t&&((A=re("<span/>").addClass(Q.prev).appendTo(O)).data(X.focusDate,x),A.toggleClass(Q.disabledCell,!ae.helper.isDateInRange(w,a)),re("<i/>").addClass(Q.prevIcon).appendTo(A)),t===g-1&&((k=re("<span/>").addClass(Q.next).appendTo(O)).data(X.focusDate,M),k.toggleClass(Q.disabledCell,!ae.helper.isDateInRange(C,a)),re("<i/>").addClass(Q.nextIcon).appendTo(k)),l)for(Y=re("<tr/>").appendTo(U),z.showWeekNumbers&&((O=re("<th/>").appendTo(Y)).text(z.text.weekNo),O.addClass(Q.weekCell),K--),F=0;F<K;F++)(O=re("<th/>").appendTo(Y)).text(Z.dayColumnHeader((F+z.firstDayOfWeek)%7,z))}for(var J=re("<tbody/>").appendTo(T),F=i?10*Math.ceil(h/10)-9:l?1-B:0,L=0;L<P;L++)for(Y=re("<tr/>").appendTo(J),l&&z.showWeekNumbers&&((O=re("<th/>").appendTo(Y)).text(ae.get.weekOfYear(h,v,F+1-z.firstDayOfWeek)),O.addClass(Q.weekCell)),e=0;e<K;e++,F++){var N,H=i?new Date(F,v,1,p,c):s?new Date(h,F,1,p,c):l?new Date(h,v,F,p,c):d?new Date(h,v,f,F):new Date(h,v,f,p,F*z.minTimeGap),E=i?F:s?z.text.monthsShort[F]:l?H.getDate():ae.helper.dateFormat(Z.cellTime,H),E=((O=re("<td/>").addClass(Q.cell).appendTo(Y)).text(E),O.data(X.date,H),l&&H.getMonth()!==(v+12)%12),S=!z.selectAdjacentDays&&E||!ae.helper.isDateInRange(H,a)||z.isDisabled(H,a)||ae.helper.isDisabled(H,a)||!ae.helper.isEnabled(H,a),I=(S?(null!==(I=ae.helper.findDayAsObject(H,a,z.disabledDates))&&I[X.message]&&(O.attr("data-tooltip",I[X.message]),O.attr("data-position",I[X.position]||y),(I[X.inverted]||te&&I[X.inverted]===oe)&&O.attr("data-inverted",""),I[X.variation]&&O.attr("data-variation",I[X.variation])),"hour"===a&&null!==(I=ae.helper.findHourAsObject(H,a,z.disabledHours))&&I[X.message]&&(O.attr("data-tooltip",I[X.message]),O.attr("data-position",I[X.position]||y),(I[X.inverted]||te&&I[X.inverted]===oe)&&O.attr("data-inverted",""),I[X.variation]&&O.attr("data-variation",I[X.variation]))):null!==(N=ae.helper.findDayAsObject(H,a,z.eventDates))&&(O.addClass(N[X.class]||z.eventClass),N[X.message]&&(O.attr("data-tooltip",N[X.message]),O.attr("data-position",N[X.position]||y),(N[X.inverted]||te&&N[X.inverted]===oe)&&O.attr("data-inverted",""),N[X.variation]&&O.attr("data-variation",N[X.variation]))),ae.helper.dateEqual(H,q,a)),$=ae.helper.dateEqual(H,n,a),E=(O.toggleClass(Q.adjacentCell,E&&!N),O.toggleClass(Q.disabledCell,S),O.toggleClass(Q.activeCell,I&&!(E&&S)),d||u||O.toggleClass(Q.todayCell,!E&&$),{mode:a,adjacent:E,disabled:S,active:I,today:$});Z.cell(O,H,E),ae.helper.dateEqual(H,r,a)&&ae.set.focusDate(H,!1,!1)}z.today&&(x=re("<tr/>").appendTo(J),(w=re("<td/>").attr("colspan",""+m).addClass(Q.today).appendTo(x)).text(Z.today(z)),w.data(X.date,n)),ae.update.focus(!1,T),z.inline&&ae.refreshTooltips()}}},update:{focus:function(e,t){t=t||ee;var i=ae.get.mode(),a=ae.get.date(),s=ae.get.focusDate(),l=ae.get.startDate(),d=ae.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=ae.helper.dateEqual(o,s,i),o=!!u&&(!!l&&ae.helper.isDateInRange(o,i,l,u)||!!d&&ae.helper.isDateInRange(o,i,u,d)),r.toggleClass(Q.focusCell,n&&(!c||f)&&(!a||z.selectAdjacentDays&&a)&&!e),ae.helper.isTodayButton(r)||r.toggleClass(Q.rangeCell,o&&!t&&!e))})}},refresh:function(){ae.create.calendar()},refreshTooltips:function(){var n=re(T).width();ee.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(){ae.debug("Binding events"),ee.on("mousedown"+r,ae.event.mousedown),ee.on("touchstart"+r,ae.event.mousedown),ee.on("mouseup"+r,ae.event.mouseup),ee.on("touchend"+r,ae.event.mouseup),ee.on("mouseover"+r,ae.event.mouseover),l.length?(l.on("input"+r,ae.event.inputChange),l.on("focus"+r,ae.event.inputFocus),l.on("blur"+r,ae.event.inputBlur),l.on("keydown"+r,ae.event.keydown)):ee.on("keydown"+r,ae.event.keydown)}},unbind:{events:function(){ae.debug("Unbinding events"),ee.off(r),l.length&&l.off(r)}},event:{mouseover:function(e){var t=re(e.target).data(X.date),e=1===e.buttons;t&&ae.set.focusDate(t,!1,!0,e)},mousedown:function(e){l.length&&e.preventDefault(),f=0<=e.type.indexOf("touch");e=re(e.target).data(X.date);e&&ae.set.focusDate(e,!1,!0,!0)},mouseup:function(e){ae.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!==z.onSelect.call(u,t,ae.get.mode())?(e=e.hasClass(Q.today),ae.selectDate(t,e)):a?ae.set.focusDate(a):n&&ae.set.mode(n))},keydown:function(e){var t,a,n,r,o,i,s,l=e.which;27!==l&&9!==l||ae.popup("hide"),ae.popup("is visible")&&(37===l||38===l||39===l||40===l?(r="day"===(i=ae.get.mode())?7:"hour"===i?4:"minute"===i?_.column:3,r=37===l?-1:38===l?-r:39==l?1:r,r*="minute"===i?z.minTimeGap:1,o=(t=ae.get.focusDate()||ae.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"===z.type&&(o=ae.helper.mergeDateTime(t,o)),ae.helper.isDateInRange(o,i)&&ae.set.focusDate(o)):13===l&&(i=ae.get.mode(),(s=ae.get.focusDate())&&!z.isDisabled(s,i)&&!ae.helper.isDisabled(s,i)&&ae.helper.isEnabled(s,i)&&!1!==z.onSelect.call(u,s,ae.get.mode())&&ae.selectDate(s),e.preventDefault(),e.stopPropagation())),38!==l&&40!==l||(e.preventDefault(),ae.popup("show"))},inputChange:function(){var e=l.val(),e=n.date(e,z);ae.set.date(e,!1)},inputFocus:function(){ee.addClass(Q.active)},inputBlur:function(){var e;ee.removeClass(Q.active),z.formatInput&&(e=ae.get.date(),e=ae.helper.dateFormat(Z[z.type],e),l.val(e)),m&&(ae.trigger.change(),m=!1)},class:{mutation:function(e){e.forEach(function(e){"class"===e.attributeName&&ae.check.disabled()})}}},observeChanges:function(){"MutationObserver"in T&&(e=new MutationObserver(ae.event.class.mutation),ae.debug("Setting up mutation observer",e),ae.observe.class())},disconnect:{classObserver:function(){l.length&&e&&e.disconnect()}},observe:{class:function(){l.length&&e&&e.observe(i[0],{attributes:!0})}},is:{disabled:function(){return i.hasClass(Q.disabled)}},check:{disabled:function(){l.attr("tabindex",ae.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},formattedDate:function(e,t){return ae.helper.dateFormat(e||Z[z.type],t||ae.get.date())},date:function(){return ae.helper.sanitiseDate(i.data(X.date))||null},inputDate:function(){return l.val()},focusDate:function(){return i.data(X.focusDate)||null},startDate:function(){var e=ae.get.calendarModule(z.startCalendar);return(e?e.get.date():i.data(X.startDate))||null},endDate:function(){var e=ae.get.calendarModule(z.endCalendar);return(e?e.get.date():i.data(X.endDate))||null},minDate:function(){return i.data(X.minDate)||null},maxDate:function(){return i.data(X.maxDate)||null},monthOffset:function(){return i.data(X.monthOffset)||z.monthOffset||0},mode:function(){var e=i.data(X.mode)||z.startMode;return ae.get.validatedMode(e)},validatedMode:function(e){var t=ae.get.validModes();return 0<=re.inArray(e,t)?e:"time"===z.type?"hour":"month"===z.type?"month":"year"===z.type?"year":"day"},type:function(){return i.data(X.type)||z.type},validModes:function(){var e=[];return"time"!==z.type&&(z.disableYear&&"year"!==z.type||e.push("year"),(z.disableMonth||"year"===z.type)&&"month"!==z.type||e.push("month"),0<=z.type.indexOf("date")&&e.push("day")),0<=z.type.indexOf("time")&&(e.push("hour"),z.disableMinute||e.push("minute")),e},isTouch:function(){try{return Y.createEvent("TouchEvent"),!0}catch(e){return!1}},calendarModule:function(e){return e?(e=e instanceof re?e:re(Y).find(e).first()).data(o):null}},set:{date:function(e,t,a){t=!1!==t,a=!1!==a,e=ae.helper.sanitiseDate(e),e=ae.helper.dateInRange(e);var n=ae.get.mode(),r=ae.helper.dateFormat(Z[z.type],e);if(a&&!1===z.onBeforeChange.call(u,e,r,n))return!1;if(ae.set.focusDate(e),z.isDisabled(e,n))return!1;var o=ae.get.endDate();o&&e&&o<e&&ae.set.endDate(oe),ae.set.dataKeyValue(X.date,e),t&&l.length&&l.val(r),a&&z.onChange.call(u,e,r,n)},startDate:function(e,t){e=ae.helper.sanitiseDate(e);var a=ae.get.calendarModule(z.startCalendar);a&&a.set.date(e),ae.set.dataKeyValue(X.startDate,e,t)},endDate:function(e,t){e=ae.helper.sanitiseDate(e);var a=ae.get.calendarModule(z.endCalendar);a&&a.set.date(e),ae.set.dataKeyValue(X.endDate,e,t)},focusDate:function(e,t,a,n){e=ae.helper.sanitiseDate(e),e=ae.helper.dateInRange(e);var r="day"===ae.get.mode(),o=ae.get.focusDate(),r=(r&&e&&o&&((r=12*(e.getFullYear()-o.getFullYear())+e.getMonth()-o.getMonth())&&(o=ae.get.monthOffset()-r,ae.set.monthOffset(o,!1))),ae.set.dataKeyValue(X.focusDate,e,!!e&&t));a=!1!==a&&r&&!1===t||h!=n,h=n,a&&ae.update.focus(n)},minDate:function(e){e=ae.helper.sanitiseDate(e),null!==z.maxDate&&z.maxDate<=e?ae.verbose("Unable to set minDate variable bigger that maxDate variable",e,z.maxDate):(ae.setting("minDate",e),ae.set.dataKeyValue(X.minDate,e))},maxDate:function(e){e=ae.helper.sanitiseDate(e),null!==z.minDate&&z.minDate>=e?ae.verbose("Unable to set maxDate variable lower that minDate variable",e,z.minDate):(ae.setting("maxDate",e),ae.set.dataKeyValue(X.maxDate,e))},monthOffset:function(e,t){var a=Math.max(z.multiMonth,1);e=Math.max(1-a,Math.min(0,e)),ae.set.dataKeyValue(X.monthOffset,e,t)},mode:function(e,t){ae.set.dataKeyValue(X.mode,e,t)},dataKeyValue:function(e,t,a){var n=i.data(e),n=n===t||n<=t&&t<=n;return t?i.data(e,t):i.removeData(e),(a=!1!==a&&!n)&&ae.refresh(),!n}},selectDate:function(e,t){ae.verbose("New date selection",e);var a=ae.get.mode();t||"minute"===a||z.disableMinute&&"hour"===a||"date"===z.type&&"day"===a||"month"===z.type&&"month"===a||"year"===z.type&&"year"===a?!1!==ae.set.date(e)&&(m=!0,z.closable&&(ae.popup("hide"),(t=ae.get.calendarModule(z.endCalendar))&&(t.refresh(),"focus"!==t.setting("on")&&t.popup("show"),t.focus()))):(t="year"===a?z.disableMonth?"day":"month":"month"===a?"day":"day"===a?"hour":"minute",ae.set.mode(t),"hour"===a||"day"===a&&ae.get.date()?ae.set.date(e,!0,!1):ae.set.focusDate(e))},changeDate:function(e){ae.set.date(e)},clear:function(){ae.set.date(oe)},popup:function(){return d.popup.apply(d,arguments)},focus:function(){(l.length?l:ee).focus()},blur:function(){(l.length?l:ee).blur()},helper:{dateFormat:function(e,t){if(!(t instanceof Date))return"";if("function"==typeof e)return e.call(ae,t,z);var a=t.getDate(),n=t.getMonth(),r=t.getFullYear(),o=t.getDay(),i=t.getHours(),s=t.getMinutes(),t=t.getSeconds(),l=ae.get.weekOfYear(r,n,a+1-z.firstDayOfWeek),d=i%12||12,u=(i<12?z.text.am:z.text.pm).toLowerCase(),c={D:a,DD:("0"+a).slice(-2),M:n+1,MM:("0"+(n+1)).slice(-2),MMM:z.text.monthsShort[n],MMMM:z.text.months[n],Y:r,YY:String(r).slice(2),YYYY:r,d:o,dd:z.text.dayNamesShort[o].slice(0,2),ddd:z.text.dayNamesShort[o],dddd:z.text.dayNames[o],h:d,hh:("0"+d).slice(-2),H:i,HH:("0"+i).slice(-2),m:s,mm:("0"+s).slice(-2),s:t,ss:("0"+t).slice(-2),a:u,A:u.toUpperCase(),S:["th","st","nd","rd"][3<a%10?0:(a%100-a%10!=10)*a%10],w:l,ww:("0"+l).slice(-2)};return e.replace(z.regExp.token,function(e){return e in c?c[e]:e.slice(1,e.length-1)})},isDisabled:function(a,n){return("day"===n||"month"===n||"year"===n||"hour"===n)&&("day"===n&&-1!==z.disabledDaysOfWeek.indexOf(a.getDay())||z.disabledDates.some(function(e){return(e="string"==typeof e?ae.helper.sanitiseDate(e):e)instanceof Date?ae.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=ae.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?ae.helper.dateEqual(a,ae.helper.sanitiseDate(e[X.date]),n):Array.isArray(e[X.date])?e[X.date].some(function(e){return ae.helper.dateEqual(a,e,n)}):void 0:void 0:void 0;var t})||"hour"===n&&z.disabledHours.some(function(e){if((e="string"==typeof e?ae.helper.sanitiseDate(e):e)instanceof Date)return ae.helper.dateEqual(a,e,n);if("number"==typeof e)return a.getHours()===e;if(null!==e&&"object"==typeof e){var t=!0;if(e[X.date])if(e[X.date]instanceof Date)t=ae.helper.dateEqual(a,ae.helper.sanitiseDate(e[X.date]));else if(Array.isArray(e[X.date]))return e[X.date].some(function(e){t=ae.helper.dateEqual(a,e,n)});if(e[X.days]&&("number"==typeof e[X.days]?t=a.getDay()==e[X.days]:Array.isArray(e[X.days])&&(t=-1<e[X.days].indexOf(a.getDay()))),e[X.hours])return"number"==typeof e[X.hours]?t&&a.getHours()==e[X.hours]:Array.isArray(e[X.hours])?t&&-1<e[X.hours].indexOf(a.getHours()):void 0}}))},isEnabled:function(t,a){return"day"!==a||(0===z.enabledDates.length||z.enabledDates.some(function(e){return(e="string"==typeof e?ae.helper.sanitiseDate(e):e)instanceof Date?ae.helper.dateEqual(t,e,a):null!==e&&"object"==typeof e&&e[X.date]?ae.helper.dateEqual(t,ae.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])?ae.helper.sanitiseDate(n):n)instanceof Date&&ae.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=ae.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&&ae.helper.dateEqual(t,ae.helper.sanitiseDate(n[X.date]),a))return n;if(Array.isArray(n[X.date])&&n[X.date].some(function(e){return ae.helper.dateEqual(t,e,a)}))return n}}return null},findHourAsObject:function(t,a,e){if("hour"===a)for(var n,r=function(e,t){if(t[X.hours])return"number"==typeof t[X.hours]&&e.getHours()==t[X.hours]||Array.isArray(t[X.hours])&&-1<t[X.hours].indexOf(e.getHours())?t:void 0},o=0;o<e.length;o++){if("number"==typeof(n=e[o])&&t.getHours()==n)return null;if(null!==n&&"object"==typeof n)if(n[X.days]&&r(t,n)){if("number"==typeof n[X.days]&&t.getDay()==n[X.days])return n;if(Array.isArray(n[X.days])&&-1<n[X.days].indexOf(t.getDay()))return n}else if(n[X.date]&&r(t,n)){if(n[X.date]instanceof Date&&ae.helper.dateEqual(t,ae.helper.sanitiseDate(n[X.date])))return n;if(Array.isArray(n[X.date])&&n[X.date].some(function(e){return ae.helper.dateEqual(t,e,a)}))return n}else if(r(t,n))return n}return null},sanitiseDate:function(e){return!(e=e instanceof Date?e:n.date(""+e,z))||isNaN(e.getTime())?null:e},dateDiff:function(e,t,a){var n="time"===z.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?z.minTimeGap*Math.floor(e.getMinutes()/z.minTimeGap):0),(t=new Date(n?2e3:t.getFullYear(),n||r?0:t.getMonth(),n||o?1:t.getDate(),a?t.getHours():0,i?z.minTimeGap*Math.floor(t.getMinutes()/z.minTimeGap):0)).getTime()-e.getTime()},dateEqual:function(e,t,a){return!!e&&!!t&&0===ae.helper.dateDiff(e,t,a)},isDateInRange:function(e,t,a,n){var r;return a||n||(a=(r=ae.get.startDate())&&z.minDate?new Date(Math.max(r,z.minDate)):r||z.minDate,n=z.maxDate),a=a&&new Date(a.getFullYear(),a.getMonth(),a.getDate(),a.getHours(),z.minTimeGap*Math.ceil(a.getMinutes()/z.minTimeGap)),!(!e||a&&0<ae.helper.dateDiff(e,a,t)||n&&0<ae.helper.dateDiff(n,e,t))},dateInRange:function(e,t,a){t||a||(t=(n=ae.get.startDate())&&z.minDate?new Date(Math.max(n,z.minDate)):n||z.minDate,a=z.maxDate),t=t&&new Date(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),z.minTimeGap*Math.ceil(t.getMinutes()/z.minTimeGap));var n="time"===z.type;return e&&(t&&0<ae.helper.dateDiff(e,t,"minute")?n?ae.helper.mergeDateTime(e,t):t:a&&0<ae.helper.dateDiff(a,e,"minute")?n?ae.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()===z.text.today}},setting:function(e,t){if(ae.debug("Changing setting",e,t),re.isPlainObject(e))re.extend(!0,z,e);else{if(t===oe)return z[e];re.isPlainObject(z[e])?re.extend(!0,z[e],t):z[e]=t}},internal:function(e,t){if(re.isPlainObject(e))re.extend(!0,ae,e);else{if(t===oe)return ae[e];ae[e]=t}},debug:function(){!z.silent&&z.debug&&(z.performance?ae.performance.log(arguments):(ae.debug=Function.prototype.bind.call(console.info,console,z.name+":"),ae.debug.apply(console,arguments)))},verbose:function(){!z.silent&&z.verbose&&z.debug&&(z.performance?ae.performance.log(arguments):(ae.verbose=Function.prototype.bind.call(console.info,console,z.name+":"),ae.verbose.apply(console,arguments)))},error:function(){z.silent||(ae.error=Function.prototype.bind.call(console.error,console,z.name+":"),ae.error.apply(console,arguments))},performance:{log:function(e){var t,a;z.performance&&(a=(t=(new Date).getTime())-(v||t),v=t,b.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:u,"Execution Time":a})),clearTimeout(ae.performance.timer),ae.performance.timer=setTimeout(ae.performance.display,500)},display:function(){var e=z.name+":",a=0;v=!1,clearTimeout(ae.performance.timer),re.each(b,function(e,t){a+=t["Execution Time"]}),e+=" "+a+"ms",D&&(e+=" '"+D+"'"),(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||w,t=u||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]:ae.error(s.method,n),!1;i=i[t]}}})),re.isFunction(o)?a=o.apply(t,e):o!==oe&&(a=o),Array.isArray(y)?y.push(a):y!==oe?y=[y,a]:a!==oe&&(y=a),o}};C?(p===oe&&ae.initialize(),ae.invoke(M)):(p!==oe&&p.invoke("destroy"),ae.initialize())}),y!==oe?y: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,disableYear:!1,disableMonth:!1,disableMinute:!1,formatInput:!0,startCalendar:null,endCalendar:null,multiMonth:1,monthOffset:0,minTimeGap:5,showWeekNumbers:!1,disabledHours:[],disabledDates:[],disabledDaysOfWeek:[],enabledDates:[],eventDates:[],centuryBreak:60,currentCentury:2e3,selectAdjacentDays:!1,popupOptions:{position:"bottom left",lastResort:"bottom left",prefer:"opposite",observeChanges:!1,hideOnScroll:!1},text:{days:["S","M","T","W","T","F","S"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],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:{yearHeader:function(e,t){e=10*Math.ceil(e.getFullYear()/10);return e-9+" - "+(2+e)},monthHeader:"YYYY",dayHeader:"MMMM YYYY",hourHeader:"MMMM D, YYYY",minuteHeader:"MMMM D, YYYY",dayColumnHeader:function(e,t){return t.text.days[e]},datetime:"MMMM D, YYYY h:mm A",date:"MMMM D, YYYY",time:"h:mm A",cellTime:"h:mm A",month:"MMMM YYYY",year:"YYYY",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().replace(/([.:\/\-])\s+/g,"$1").replace(/\s+([.:\/-])/g,"$1").replace(/\s+/g," ")).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,o=new Date(e);if(!(null!==e.match(/^[0-9]+$/))&&!isNaN(o.getDate()))return o;e=e.toLowerCase();var i,s,l,d=-1,u=-1,c=-1,p=-1,f=-1,o=oe,h="time"===t.type,m=t.type.indexOf("time")<0,g=e.split(t.regExp.dateWords),y=e.split(t.regExp.dateNumbers);if(!m)for(o=0<=re.inArray(t.text.am.toLowerCase(),g)||!(0<=re.inArray(t.text.pm.toLowerCase(),g))&&oe,a=0;a<y.length;a++)if(0<=(s=y[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;y.splice(a,1)}if(!h){for(a=0;a<g.length;a++)if(!((i=g[a]).length<=0)){for(n=0;n<t.text.months.length;n++)if(t.text.months[n].substring(0,i.length).toLowerCase()===i){p=n+1;break}if(0<=p)break}for(a=0;a<y.length;a++)if(n=parseInt(y[a]),!isNaN(n)&&n>=t.centuryBreak&&a===y.length-1){n<=99&&(n+=t.currentCentury-100),f=n,y.splice(a,1);break}if(p<0)for(a=0;a<y.length;a++)if(r=1<a||t.monthFirst?a:1===a?0:1,n=parseInt(y[r]),!isNaN(n)&&1<=n&&n<=12){p=n,y.splice(r,1);break}for(a=0;a<y.length;a++)if(n=parseInt(y[a]),!isNaN(n)&&1<=n&&n<=31){c=n,y.splice(a,1);break}if(f<0)for(a=y.length-1;0<=a;a--)if(n=parseInt(y[a]),!isNaN(n)){n<=99&&(n+=t.currentCentury),f=n,y.splice(a,1);break}}if(!m){if(u<0)for(a=0;a<y.length;a++)if(n=parseInt(y[a]),!isNaN(n)&&0<=n&&n<=23){u=n,y.splice(a,1);break}if(d<0)for(a=0;a<y.length;a++)if(n=parseInt(y[a]),!isNaN(n)&&0<=n&&n<=59){d=n,y.splice(a,1);break}}if(d<0&&u<0&&c<0&&p<0&&f<0)return null;d<0&&(d=0),u<0&&(u=0),c<0&&(c=1),p<0&&(p=1),f<0&&(f=(new Date).getFullYear()),o!==oe&&(o?12===u&&(u=0):u<12&&(u+=12));e=new Date(f,p-1,c,u,d);return e.getMonth()===p-1&&e.getFullYear()===f||(e=new Date(f,p,0,u,d)),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,token:/d{1,4}|D{1,2}|M{1,4}|YY(?:YY)?|([Hhmsw])\1?|[SAaY]|"[^"]*"|'[^']*'/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",hours:"hours",days:"days"},eventClass:"blue"}}(jQuery,window,document);