@progress/kendo-react-dateinputs
Version:
React DateInput is a perfect input component for handling quick and efficient date values. KendoReact Date Inputs package
15 lines • 159 kB
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("prop-types"),require("@progress/kendo-react-common"),require("@progress/kendo-date-math"),require("@progress/kendo-react-intl"),require("@progress/kendo-react-buttons"),require("@progress/kendo-svg-icons"),require("@progress/kendo-react-labels"),require("@progress/kendo-dateinputs-common"),require("@progress/kendo-intl"),require("@progress/kendo-react-popup"),require("@progress/kendo-react-layout")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","@progress/kendo-react-common","@progress/kendo-date-math","@progress/kendo-react-intl","@progress/kendo-react-buttons","@progress/kendo-svg-icons","@progress/kendo-react-labels","@progress/kendo-dateinputs-common","@progress/kendo-intl","@progress/kendo-react-popup","@progress/kendo-react-layout"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoReactDateinputs={},e.React,e.PropTypes,e.KendoReactCommon,e.KendoDateMath,e.KendoReactIntl,e.KendoReactButtons,e.KendoSvgIcons,e.KendoReactLabels,e.KendoDateinputsCommon,e.KendoIntl,e.KendoReactPopup,e.KendoReactLayout)}(this,(function(e,t,i,s,a,n,o,r,l,h,c,u,d){"use strict";function p(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(i){if("default"!==i){var s=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:function(){return e[i]}})}})),t.default=e,Object.freeze(t)}var m=p(t);const g=e=>Math.max(e,0);let v=class{constructor(e){this.offset=e}},f=class{constructor(e){this.skip=e}},w=class{constructor(e,t){this.onScrollAction=e,this.onPageAction=t,this.direction="vertical",this.firstLoaded=0,this.lastLoaded=0,this.lastScrollTop=0,this.take=0,this.total=0,this.rowHeightService=null,this.bottomOffset=0,this.topOffset=0}create(e,t,i,s,a=0,n=0,o="vertical"){this.rowHeightService=e,this.firstLoaded=t,this.lastLoaded=t+i,this.take=i,this.total=s,this.lastScrollTop=0,this.topOffset=a,this.bottomOffset=n,this.direction=o;const r=this.rowsForHeight(a),l=g(t-r);this.onScrollAction(new v(this.rowOffset(l))),this.onPageAction(new f(l))}onScroll({scrollLeft:e,scrollTop:t,offsetHeight:i,offsetWidth:s}){const a="vertical"===this.direction?t:e,n="vertical"===this.direction?i:s;if(this.lastScrollTop===a||!this.rowHeightService)return;const o=this.lastScrollTop>=a;this.lastScrollTop=a;const r=this.rowHeightService.index(g(a-this.topOffset)),l=this.rowHeightService.index(g(a+n-this.bottomOffset));if(!o&&l>=this.lastLoaded&&this.lastLoaded<this.total&&(this.firstLoaded=r,this.onScrollAction(new v(this.rowOffset(r))),this.lastLoaded=Math.min(this.firstLoaded+this.take,this.total),this.onPageAction(new f(this.firstLoaded))),o&&r<=this.firstLoaded){const e=Math.floor(.3*this.take);this.firstLoaded=g(r-e),this.onScrollAction(new v(this.rowOffset(this.firstLoaded))),this.lastLoaded=Math.min(this.firstLoaded+this.take,this.total),this.onPageAction(new f(this.firstLoaded))}}rowOffset(e){return this.rowHeightService?this.rowHeightService.offset(e)+this.topOffset:0}rowsForHeight(e){return this.rowHeightService?Math.ceil(e/this.rowHeightService.height(0)):0}};const b={1:e=>t=>t+e,0:e=>t=>t-e},D={1:e=>t=>Math.min(t,e),0:e=>t=>Math.max(t,e)},y={1:e=>t=>t<e,0:e=>t=>t>e},S=class e extends m.Component{constructor(t){super(t),this.rowHeightService=null,this.scrollContainer=null,this.lastDirection=null,this.lastTotal=0,this.lastTake=0,this.animationInProgress=!1,this.restrictScroll=!1,this.scrollTo=e=>{const t="vertical"===this.direction?"scrollTop":"scrollLeft";if(!this.scrollContainer)return;const i=this.scrollContainer[t];this.restrictScroll&&"scrollTop"===t&&(!Number.isInteger(i)||!Number.isInteger(e))&&Math.abs(i-e)<10||(this.scrollContainer[t]=e)},this.scrollToIndex=e=>{this.animationInProgress=!1,this.rowHeightService&&this.scrollTo(this.rowHeightService.offset(e))},this.animateToIndex=e=>{if(!this.rowHeightService||!window)return;window.cancelAnimationFrame(this.cancelAnimation);const t=this.rowHeightService.offset(e),i=this.getContainerScrollDirection(t),{start:s,end:a}=this.scrollRange(t,i);if(s===a)return;const n=this.scrollStep(s,a),o=b[i](n),r=D[i](a),l=y[i](o(a)),h=e=>{this.animationInProgress=!0;const t=o(e);this.scrollTo(r(t)),l(t)?this.cancelAnimation=window.requestAnimationFrame((()=>{h(t)})):this.animationInProgress=!1};this.cancelAnimation=window.requestAnimationFrame((()=>{h(s)}))},this.scrollToBottom=()=>{this.rowHeightService&&this.scrollTo(this.rowHeightService.totalHeight()+this.props.bottomOffset)},this.scrollStep=(t,i)=>{const s=this.props.scrollDuration||e.defaultProps.scrollDuration;return Math.abs(i-t)/(s/17)},this.scrollRange=(e,t)=>{const i=this.containerScrollPosition;if(parseInt(`${e}`,10)===parseInt(`${i}`,10))return{start:e,end:e};const s=this.containerMaxScroll(),a=0===t?1:-1,n=((e,t,i)=>Math.min(Math.abs(t-e),i))(i,e,this.props.maxScrollDifference||0),o=Math.min(e,s);return{start:Math.min(Math.max(o+a*n,0),s),end:o}},this.containerMaxScroll=()=>this.containerScrollSize-this.containerOffsetSize,this.getContainerScrollDirection=e=>e<this.containerScrollPosition?0:1,this.initServices=(e=this.props)=>{const t="vertical"===this.direction?e.itemHeight:e.itemWidth;void 0!==t&&(this.rowHeightService=new s.RowHeightService(e.total,t),this.scrollerService.create(this.rowHeightService,e.skip,e.take,e.total,e.topOffset,this.scrollOffsetSize,this.direction))},this.getContainerProperty=e=>this.scrollContainer?this.scrollContainer[e]:0,this.handleScroll=e=>{if(!this.scrollContainer||!this.rowHeightService)return;const t=e.target;this.scrollerService.onScroll({scrollLeft:t.scrollLeft,scrollTop:t.scrollTop,offsetHeight:t.offsetHeight,offsetWidth:t.offsetWidth});const i=this.rowHeightService.index(this.containerScrollPosition-this.props.topOffset),{onScrollAction:s}=this.props,a={index:i,target:t,scrollAction:this.scrollAction,pageAction:this.pageAction,animationInProgress:this.animationInProgress};this.props.onScroll&&this.props.onScroll.call(void 0,e),s&&s.call(void 0,a),this.scrollAction=void 0,this.pageAction=void 0},this.handleScrollAction=e=>{this.scrollAction=e},this.handlePageAction=e=>{this.pageAction=e},this.scrollerService=new w(this.handleScrollAction,this.handlePageAction),this.restrictScroll=Number.parseFloat(m.version)>17}get element(){return this.scrollContainer}get containerOffsetSize(){return this.getContainerProperty("vertical"===this.direction?"offsetHeight":"offsetWidth")}get containerScrollSize(){return this.getContainerProperty("vertical"===this.direction?"scrollHeight":"scrollWidth")}get containerScrollPosition(){return this.getContainerProperty("vertical"===this.direction?"scrollTop":"scrollLeft")}get direction(){return void 0!==this.props.direction?this.props.direction:e.defaultProps.direction}get scrollOffsetSize(){return void 0!==this.props.scrollOffsetSize?this.props.scrollOffsetSize:e.defaultProps.scrollOffsetSize}activeIndex(){return this.itemIndex(Math.ceil(this.containerScrollPosition))}itemIndex(e){return this.rowHeightService?this.rowHeightService.index(e):0}itemOffset(e){return this.rowHeightService?this.rowHeightService.offset(e):0}isIndexVisible(e){if(!this.rowHeightService)return!1;const t=this.containerScrollPosition,i=t+this.containerOffsetSize,s=this.rowHeightService.offset(e),a=s+this.rowHeightService.height(e);return s>=t&&a<=i}isListScrolled(e){return!!this.rowHeightService&&this.containerScrollPosition!==this.rowHeightService.offset(e)}componentDidMount(){const{onMount:e}=this.props;e&&e.call(void 0,this)}render(){const{total:e,take:t,bottomOffset:i,className:a,tabIndex:n,role:o,children:r,unstyled:l}=this.props,h=l&&l.uCalendar;(this.lastTotal!==e||this.lastDirection!==this.direction||this.lastTake!==t)&&(this.initServices(),this.lastTotal=e,this.lastDirection=this.direction,this.lastTake=t);const c=`${(this.rowHeightService?this.rowHeightService.totalHeight():0)+i}`,u="vertical"===this.direction?{height:`${c}px`}:{width:`${c}px`},d=s.classNames(s.uCalendar.scrollableSelector({c:h}),s.uCalendar.scrollable({c:h,horizontal:"horizontal"===this.direction}),a),p=s.classNames(s.uCalendar.scrollablePlaceholder({c:h,horizontal:"horizontal"===this.direction}));return m.createElement("div",{ref:e=>{this.scrollContainer=e},onScroll:this.handleScroll,className:d,tabIndex:n,role:o},r,m.createElement("div",{style:u,className:p}))}};S.propTypes={bottomOffset:i.number.isRequired,className:i.string,direction:i.oneOf(["horizontal","vertical"]),forceScroll:i.bool,itemHeight:i.number,itemWidth:i.number,maxScrollDifference:i.number,onScroll:i.func,onScrollAction:i.func,scrollDuration:i.number,scrollOffsetSize:i.number,skip:i.number.isRequired,tabIndex:i.number,take:i.number.isRequired,topOffset:i.number.isRequired,total:i.number.isRequired,role:i.string},S.defaultProps={direction:"vertical",forceScroll:!1,scrollOffsetSize:0,maxScrollDifference:100,scrollDuration:100};let C=S;let k=class extends m.Component{constructor(){super(...arguments),this.handleClick=e=>{const{onClick:t,value:i}=this.props;t&&t.call(void 0,i,e)},this.handleMouseEnter=()=>{const{onMouseEnter:e,value:t}=this.props;e&&e.call(void 0,t)},this.handleMouseLeave=()=>{const{onMouseLeave:e,value:t}=this.props;e&&e.call(void 0,t)}}shouldComponentUpdate(e){const{value:t,...i}=this.props,{value:s,...a}=e;return!((!t||!s||t.getTime()===s.getTime())&&((e,t)=>{const i=Object.getOwnPropertyNames(e),s=Object.getOwnPropertyNames(t);if(i.length!==s.length)return!1;for(let s=0;s<i.length;s++){const a=i[s];if(e[a]!==t[a])return!1}return!0})(i,a))}render(){const{className:e,formattedValue:t,isWeekend:i,isFocused:a,isInRange:n,isSelected:o,isRangeStart:r,isRangeMid:l,isRangeEnd:h,isRangeSplitStart:c,isRangeSplitEnd:u,isToday:d,isDisabled:p,view:g,value:v,isOtherMonth:f,showOtherMonthDays:w,allowReverse:b,unstyled:D,...y}=this.props,S="end"===this.props.activeRangeEnd&&h,C="start"===this.props.activeRangeEnd&&r,k=D&&D.uCalendar,x=s.classNames(s.uCalendar.td({c:k,rangeStart:!f&&!b&&r,rangeEnd:!f&&!b&&h,rangeMid:!f&&l,rangeSplitEnd:!f&&u,rangeSplitStart:!f&&c,active:C||S,focused:a,selected:!f&&(o||r||h),today:!f&&d,weekend:i,disabled:p,isOtherMonth:f,isEmpty:!w&&f}),e);return!w&&f?m.createElement("td",{role:"gridcell",className:x}):m.createElement("td",{...y,className:x,onClick:this.handleClick,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave},m.createElement("span",{className:s.classNames(s.uCalendar.link({c:k}))},this.props.children))}};const x=e=>{const{className:t,firstDate:i,weekDays:a,...n}=e,o=s.useUnstyled(),r=o&&o.uCalendar;return m.createElement("td",{className:s.classNames(s.uCalendar.td({c:r,isWeek:!0}),t),...n,onClick:t=>{const{onClick:s}=e;s&&t&&s.call(void 0,i,a||[],t)}},e.children)};var I=(e=>(e[e.month=0]="month",e[e.year=1]="year",e[e.decade=2]="decade",e[e.century=3]="century",e))(I||{});const M={start:null,end:null};function T(e){const t=(t,i,s,...a)=>null===i[s]?null:(t?e.isRequired:e)(i,s,...a),i=t.bind(null,!1);return i.isRequired=t.bind(null,!0),i}const O=(e,t,i)=>void 0===t||void 0===i||t<=e&&e<=i?e:e<t?t:i,E=new Date(1980,0,1),V=new Date(1900,0,1),N=new Date(2099,11,31),R=new Date(1980,0,1),P=new Date(1980,0,1,23,59,59),F=(e,t)=>{const i=a.cloneDate(e);return i.setHours(t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()),i},L=()=>a.getDate(new Date),B=(e,t,i)=>!e||!(t&&t>e||i&&i<e),A=(e,t,i)=>null===e||!(t&&a.getDate(t)>a.getDate(e)||i&&a.getDate(i)<a.getDate(e)),z=(e,t)=>{const{start:i,end:s}=t||M;return!(!i||!s)&&(i<e&&e<s)},H=(e,t,i=1)=>{const s=[];for(let a=e;a<t;a+=i)s.push(a);return s},_=(e,t,i)=>t.getTime()<=e.getTime()&&e.getTime()<=i.getTime(),q=(e,t,i)=>e&&(t&&e<t?a.cloneDate(t):i&&e>i?a.cloneDate(i):e),W=e=>(t,i="",s={})=>{const a=document.createElement(e);return a.className=i,Object.keys(s).forEach((e=>{a.style[e]=s[e]})),"string"==typeof t?a.innerHTML=t||"":(t||[]).forEach((e=>e&&a.appendChild(e))),a};function K(e,t,i={}){let s,a,n,o,r;i.maxWait;const l=window,h=!1,c=!1,u=!t&&0!==t&&"function"==typeof l.requestAnimationFrame;if("function"!=typeof e)throw new TypeError("Expected a function");function d(t){const i=s,o=a;return s=a=void 0,n=e.apply(o,i),n}function p(e,t){return u?(l.cancelAnimationFrame(o),l.requestAnimationFrame(e)):setTimeout(e,t)}function m(e){const i=e-r;return void 0===r||i>=t||i<0||c}function g(){const e=Date.now();if(m(e))return v();o=p(g,function(e){return t-(e-r)}(e))}function v(e){return o=void 0,s?d():(s=a=void 0,n)}function f(...e){const i=Date.now(),l=m(i);return s=e,a=this,r=i,l&&void 0===o?(o=p(g,t),h?d():n):(void 0===o&&(o=p(g,t)),n)}return t=+t||0,f.cancel=function(){void 0!==o&&function(e){if(u)return l.cancelAnimationFrame(e);clearTimeout(e)}(o),s=r=a=o=void 0},f.flush=function(){return void 0===o?n:v()},f.pending=function(){return void 0!==o},f}let U=class{constructor(e){this.intl=e}getWeekNames(e=!1,t){const i=((e,t)=>e.slice(t).concat(e.slice(0,t)))(this.intl.dateFormatNames({nameType:null!=t?t:"short",type:"days"}),this.intl.firstDay());return e?[""].concat(i):i}};const Y=(e,t)=>{const i=t;return m.createElement("td",{key:e,role:"gridcell",className:s.classNames(s.uCalendar.td({c:i,isEmpty:!0}))}," ")},$=class e extends m.Component{constructor(){super(...arguments),this.intl=null,this.weekService=null,this.buildWeekNumber=(e,t)=>{if(!this.firstDate(e))return Y(`week-cell-${t}`);const i=this.firstDate(e),s=this.getWeekNumber(i),a=`kendo-react-calendar-week-cell-${s}`,n={value:s,firstDate:i,weekDays:e,unstyled:this.props.unstyled,onClick:this.handleWeekCellClick};return this.props.weekCell?m.createElement(this.props.weekCell,{...n,key:a},s):m.createElement(x,{...n,key:a},s)},this.buildRow=e=>e.map(((e,t)=>{if(!e)return Y(t);const i={"aria-selected":e.isSelected},s=`kendo-react-calendar-cell-${e.value.getTime()}`,a={...i,...e,isDisabled:!e.isInRange,view:this.props.activeView,showOtherMonthDays:this.props.showOtherMonthDays,allowReverse:this.props.allowReverse,unstyled:this.props.unstyled,onClick:this.handleClick,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave};return this.props.cell?m.createElement(this.props.cell,{...a,key:s},e.formattedValue):m.createElement(k,{...a,key:s},e.formattedValue)})),this.firstDate=e=>{const t=this.firstWeekDateContext(e);return t?t.value:null},this.firstWeekDateContext=e=>{if(!this.weekNumber)return null;let t=0,i=e[t];for(;!i&&t<e.length;)i=e[++t];return i},this.handleClick=(e,t)=>{const{onChange:i}=this.props;if(i&&t){const s={value:a.cloneDate(e),target:this,nativeEvent:t&&t.nativeEvent,syntheticEvent:t};i.call(void 0,s)}},this.handleWeekCellClick=(e,t,i)=>{const{onWeekSelect:s}=this.props,a=t.findIndex((t=>t&&t.value===e));s&&i&&s.call(void 0,e,a,i)},this.handleMouseEnter=e=>{const{onCellEnter:t}=this.props;t&&t.call(void 0,a.cloneDate(e))},this.handleMouseLeave=e=>{const{onCellLeave:t}=this.props;t&&t.call(void 0,a.cloneDate(e))}}get min(){return this.props.min}get max(){return this.props.max}get isHorizontal(){return"horizontal"===this.props.direction}get isMonthView(){return this.props.activeView===I.month}get weekNumber(){return!(!this.props.showWeekNumbers||this.props.activeView!==I.month)}get selectedDate(){return void 0!==this.props.selectedDate?this.props.selectedDate:e.defaultProps.selectedDate}render(){const{service:e,weekDaysFormat:t,cellUID:i,focusedDate:a,bus:o,activeView:r,selectionRange:l,unstyled:h}=this.props,c=h&&h.uCalendar;this.intl=n.provideIntlService(this),this.weekService=new U(this.intl);const u=this.weekService.getWeekNames(this.weekNumber,t),d=e.rowLength(this.weekNumber),p=e.title(this.props.viewDate),g=L(),v=F(this.props.viewDate,g),f=e.data({cellUID:i,min:this.min,max:this.max,focusedDate:a,isActiveView:!o.canMoveDown(r),selectedDate:this.selectedDate,selectionRange:l,viewDate:v});return m.createElement(m.Fragment,null,this.isMonthView&&this.isHorizontal&&m.createElement("thead",{role:"rowgroup",className:s.classNames(s.uCalendar.thead({c:c}))},m.createElement("tr",{role:"row",className:s.classNames(s.uCalendar.tr({c:c}))},u.map(((e,t)=>m.createElement("th",{key:t,className:s.classNames(s.uCalendar.th({c:c}))},e))))),m.createElement("tbody",{role:"rowgroup",className:s.classNames(s.uCalendar.tbody({c:c}))},!this.isHorizontal&&m.createElement("tr",{role:"presentation",className:s.classNames(s.uCalendar.tr({c:c}))},m.createElement("th",{scope:"col",colSpan:d,className:s.classNames(s.uCalendar.caption({c:c}))},p)),f.map(((e,t)=>m.createElement("tr",{role:"row",className:s.classNames(s.uCalendar.tr({c:c})),key:t},this.weekNumber&&this.buildWeekNumber(e,t),this.buildRow(e))))))}getWeekNumber(e){return this.weekNumber&&this.intl?a.weekInYear(e,this.intl.firstDay()):null}};$.propTypes={activeRangeEnd:i.oneOf(["start","end",null]),activeView:i.number.isRequired,cellUID:i.string.isRequired,direction:i.oneOf(["horizontal","vertical"]),focusedDate:i.instanceOf(Date).isRequired,max:i.instanceOf(Date).isRequired,min:i.instanceOf(Date).isRequired,onChange:i.func,selectedDate:i.oneOfType([i.instanceOf(Date),i.arrayOf(i.instanceOf(Date))]),showWeekNumbers:i.bool,showOtherMonthDays:i.bool,viewDate:i.instanceOf(Date).isRequired},$.defaultProps={direction:"vertical",selectedDate:L(),showWeekNumbers:!1};let j=$;n.registerForIntl(j);const Z=e=>{const{view:t,...i}=e;return m.createElement(o.Button,{type:"button",fillMode:"flat",themeColor:"primary",...i},e.children)},J=class e extends m.Component{constructor(){super(...arguments),this.getTitle=()=>{if(!this.props.currentDate)return"";const e=this.rangeLength-1,t=this.props.service.title(this.props.currentDate),i=this.props.service.addToDate(this.props.currentDate,e);return e<1||!this.props.service.isInRange(i,this.min,this.max)?t:`${t} - ${this.props.service.title(i)}`},this.handleTitleClick=e=>{this.canMoveUp&&this.props.bus.moveUp(this.props.activeView,e)}}get min(){return void 0!==this.props.min?this.props.min:e.defaultProps.min}get max(){return void 0!==this.props.max?this.props.max:e.defaultProps.max}get rangeLength(){return void 0!==this.props.rangeLength?this.props.rangeLength:e.defaultProps.rangeLength}get canMoveUp(){return this.props.bus.canMoveUp(this.props.activeView)}render(){const{activeView:e,commands:t,unstyled:i}=this.props,a=i&&i.uCalendar,n=this.getTitle(),o={children:n,value:n,view:e,className:s.classNames(s.uCalendar.title({c:a})),onClick:this.handleTitleClick,disabled:!this.canMoveUp},r={headerTitleProps:o,commands:t},l=this.props.headerTitle?m.createElement(this.props.headerTitle,{...o},n):m.createElement(Z,{...o},n),h=this.props.header?m.createElement(this.props.header,{...r}):m.createElement(m.Fragment,null,l,m.createElement("span",{className:s.classNames(s.uCalendar.spacer({c:a}))}),m.createElement("span",{className:s.classNames(s.uCalendar.nav({c:a}))},this.props.commands));return m.createElement("div",{className:s.classNames(s.uCalendar.header({c:a,vertical:this.props.verticalView}))},h)}};J.propTypes={activeView:i.number.isRequired,currentDate:i.instanceOf(Date).isRequired,max:i.instanceOf(Date).isRequired,min:i.instanceOf(Date).isRequired,rangeLength:i.number},J.defaultProps={rangeLength:1,min:V,max:N};let G=J;n.registerForLocalization(G);const X="multiviewcalendar.prevView",Q="multiviewcalendar.nextView",ee="dateinput.increment",te="dateinput.decrement",ie="dateinput.clear",se="calendar.today",ae="datepicker.toggleCalendar",ne="daterangepicker.swapStartEnd",oe="daterangepicker.start",re="daterangepicker.end",le="daterangepicker.separator",he="datetimepicker.toggleDateTimeSelector",ce="timepicker.now",ue="timepicker.selectNow",de="timepicker.cancel",pe="timepicker.set",me="timepicker.toggleTimeSelector",ge="timepicker.toggleClock",ve="datetimepicker.date",fe="datetimepicker.time",we="datetimepicker.cancel",be="datetimepicker.set",De="daterangepicker.cancel",ye="daterangepicker.set",Se={[se]:"Today",[ce]:"NOW",[pe]:"Set",[de]:"Cancel",[ve]:"Date",[fe]:"Time",[we]:"Cancel",[be]:"Set",[De]:"Cancel",[ye]:"Set",[oe]:"Start",[re]:"End",[le]:" ",[ue]:"Select Now",[me]:"Toggle TimeSelector",[ge]:"Toggle Clock",[ee]:"Increase value",[te]:"Decrease value",[ie]:"clear",[ae]:"Toggle calendar",[X]:"Navigate to previous view",[Q]:"Navigate to next view",[ne]:"Swap start and end values",[he]:"Toggle date-time selector"},Ce=class e extends m.Component{constructor(){super(...arguments),this.localization=null,this.handleClick=e=>{if(this.todayIsInRange&&this.props.onClick){const t={syntheticEvent:e,nativeEvent:e.nativeEvent,value:q(L(),this.min,this.max),target:this,isTodayClick:!0};this.props.onClick.call(void 0,t)}}}get min(){return void 0!==this.props.min?this.props.min:e.defaultProps.min}get max(){return void 0!==this.props.max?this.props.max:e.defaultProps.max}get todayIsInRange(){return B(L(),a.getDate(this.min),a.getDate(this.max))}render(){const{disabled:e,tabIndex:t,unstyled:i}=this.props,a=i&&i.uCalendar;this.localization=n.provideLocalizationService(this);const r=this.localization.toLanguageString(se,Se[se]),l=s.classNames(s.uCalendar.today({c:a,disabled:e}));return m.createElement(o.Button,{className:l,onClick:this.handleClick,tabIndex:t,fillMode:"flat",themeColor:"base",role:"link"},r)}};Ce.propTypes={max:i.instanceOf(Date).isRequired,min:i.instanceOf(Date).isRequired,onClick:i.func,disabled:i.bool},Ce.defaultProps={min:V,max:N};let ke=Ce;n.registerForLocalization(ke);const xe=class e extends m.Component{constructor(e){super(e),this.virtualization=null,this.calendarView=null,this.table=null,this.intl=null,this.bottomOffset=0,this.viewOffset=0,this.viewHeight=0,this._element=null,this.isActive=!1,this.animateToIndex=!0,this.shouldScroll=!1,this.weekService=null,this.focusActiveDate=()=>{if(!this._element)return;const e=this._element.querySelector("td.k-focus"),t=this._element.querySelector(".k-state-pending-focus");e&&e[0]&&e[0].classList.remove("k-focus"),t&&t.classList.add("k-focus"),this.isActive=!0},this.blurActiveDate=()=>{if(!this._element)return;const e=this._element.querySelector("td.k-focus");e&&e.classList.remove("k-focus"),this.isActive=!1},this.handleVirtualizationMount=e=>{if(this.virtualization=e,this.virtualization&&this.table){this.table.style.transform=`translateY(${this.viewOffset}px)`;const e=q(this.props.focusedDate,this.props.min,this.props.max),t=this.props.service.skip(e,this.props.min);this.virtualization.scrollToIndex(t)}},this.buildMonthView=(e,t)=>{const{unstyled:i}=this.props,a=i&&i.uCalendar;return m.createElement("table",{key:"calendar-view-list-weekdays",className:s.classNames(s.uCalendar.table({c:a,weekdays:!0})),role:"grid",tabIndex:this.props.tabIndex},m.createElement("colgroup",null,e.map(((e,t)=>m.createElement("col",{key:t})))),m.createElement("thead",{className:s.classNames(s.uCalendar.thead({c:a}))},m.createElement("tr",{className:s.classNames(s.uCalendar.tr({c:a}))},t.map(((e,t)=>m.createElement("th",{key:t,className:s.classNames(s.uCalendar.th({c:a}))},e))))))},this.buildDates=(e,t)=>{const i=this.props.cellUID,{unstyled:a}=this.props,n=a&&a.uCalendar;return m.createElement("table",{className:s.classNames(s.uCalendar.table({c:n})),ref:e=>{this.table=e},role:"grid",tabIndex:this.props.tabIndex,"aria-activedescendant":i+this.props.focusedDate.getTime()},m.createElement("colgroup",null,e.map(((e,t)=>m.createElement("col",{key:t})))),t.map((e=>m.createElement(j,{ref:e=>{this.calendarView||(this.calendarView=e)},key:e.getTime(),activeView:this.props.activeView,viewDate:e,min:this.props.min,max:this.props.max,cellUID:i,focusedDate:this.props.focusedDate,cell:this.props.cell,selectedDate:this.props.value,showWeekNumbers:this.weekNumber,onChange:this.handleDateChange,bus:this.props.bus,service:this.props.service,weekCell:this.props.weekCell,showOtherMonthDays:this.props.showOtherMonthDays,unstyled:a}))))},this.calculateHeights=()=>{if(!this.props.dom)return;const e=this.props.activeView===I.month?this.props.dom.scrollableContentHeight:this.props.dom.scrollableYearContentHeight;this.bottomOffset=e-this.props.dom.viewHeight(this.props.activeView),this.viewOffset=-1*this.props.dom.headerHeight,this.viewHeight=this.props.dom.viewHeight(this.props.activeView)||1},this.getTake=(e,t)=>Math.min(t-e,this.take),this.handleScrollAction=({index:e,scrollAction:t,pageAction:i})=>{const s=i?i.skip:this.state.skip;if((this.state.index!==e||this.state.skip!==s)&&this.setState({index:e,skip:s}),this.table&&t){const e=`translateY(${t.offset}px)`;this.table.style.transform=e}},this.handleTodayClick=e=>{this.shouldScroll=!0,this.handleDateChange.call(void 0,e,!0)},this.handleDateChange=(e,t=!1)=>{const{onChange:i}=this.props;if(i){const s={syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,value:a.cloneDate(e.value),target:this,isTodayClick:t};i.call(void 0,s)}},this.lastView=this.props.activeView,this.lastFocus=this.props.focusedDate,this.state={skip:this.props.service.skip(this.props.focusedDate,this.props.min),index:this.props.service.skip(this.props.focusedDate,this.props.min)}}get element(){return this._element}get weekNames(){return this.intl=n.provideIntlService(this),this.weekService=new U(this.intl),this.weekService.getWeekNames(this.weekNumber,this.props.weekDaysFormat)}get weekNumber(){return!(!this.props.showWeekNumbers||this.props.activeView!==I.month)}get take(){return void 0!==this.props.take?this.props.take:e.defaultProps.take}get animate(){return!(!this.props.smoothScroll||!this.animateToIndex)}get todayIsInRange(){return B(L(),a.getDate(this.props.min),a.getDate(this.props.max))}componentDidUpdate(e,t){this.shouldScroll=!1,void 0!==this.indexToScroll&&this.virtualization&&this.virtualization[this.animate?"animateToIndex":"scrollToIndex"](this.indexToScroll),this.isActive&&this.focusActiveDate(),this.lastView=this.props.activeView,this.indexToScroll=void 0}render(){const{activeView:e,min:t,max:i,service:n,unstyled:o}=this.props,r=o&&o.uCalendar;this.calculateHeights();const l=this.lastView!==e,h=q(this.props.focusedDate,t,i),c=l?n.skip(h,t):this.state.skip,u=n.total(t,i),d=this.getTake(c,u),p=n.addToDate(t,c),g=n.addToDate(t,this.state.index),v=new Array(n.rowLength(this.weekNumber)).fill(""),f=e!==this.lastView;this.animateToIndex=!f,(f||!a.isEqualDate(this.lastFocus,h)||this.shouldScroll||!this.props.shouldScroll||this.props.shouldScroll())&&(this.indexToScroll=this.props.service.skip(h,this.props.min)),this.lastFocus=h;const w=s.classNames(s.uCalendar.view({c:r,month:e===I.month,year:e===I.year,decade:e===I.decade,century:e===I.century})),b=this.buildDates(v,n.datesList(p,d)),D=m.createElement(m.Fragment,null,m.createElement(G,{key:"calendar-view-list-header",currentDate:g,min:this.props.min,max:this.props.max,activeView:this.props.activeView,bus:this.props.bus,service:this.props.service,headerTitle:this.props.headerTitle,header:this.props.header,unstyled:o,commands:m.createElement(ke,{min:this.props.min,max:this.props.max,onClick:this.handleTodayClick,disabled:!this.todayIsInRange,tabIndex:this.props.tabIndex,unstyled:o})}),this.props.activeView===I.month&&this.buildMonthView(v,this.weekNames),m.createElement(C,{key:"calendar-view-list-content",skip:c,take:this.take,total:u,itemHeight:this.viewHeight,topOffset:this.viewOffset,bottomOffset:this.bottomOffset,scrollOffsetSize:this.viewOffset,maxScrollDifference:this.viewHeight,onScroll:this.props.onScroll,onScrollAction:this.handleScrollAction,onMount:e=>!this.virtualization&&this.handleVirtualizationMount(e),children:b,tabIndex:this.props.tabIndex,unstyled:o}));return m.createElement("div",{ref:e=>{this._element=e},className:w},this.props.dom.didCalculate?D:null)}};xe.propTypes={activeView:i.number.isRequired,bottomOffset:i.number,cellUID:i.string.isRequired,focusedDate:i.instanceOf(Date).isRequired,max:i.instanceOf(Date).isRequired,min:i.instanceOf(Date).isRequired,onChange:i.func,showWeekNumbers:i.bool,smoothScroll:i.bool,take:i.number,value:i.instanceOf(Date),viewHeight:i.number,viewOffset:i.number,weekDaysFormat:i.oneOf(["short","abbreviated","narrow"]),tabIndex:i.number},xe.defaultProps={take:5,showWeekNumbers:!1,weekDaysFormat:"short",smoothScroll:!0};let Ie=xe;n.registerForIntl(Ie);const Me=e=>{const{className:t,isRangeStart:i,value:a,text:n,view:o,...r}=e,l=s.useUnstyled(),h=l&&l.uCalendar;return m.createElement("li",{...r,onClick:t=>{var i;null==(i=e.onClick)||i.call(e,a,t)},className:s.classNames(s.uCalendar.li({c:h}),t)},m.createElement("span",{className:s.classNames(s.uCalendar.navigationMarker({c:h,isRangeStart:i}))},e.children))},Te=class e extends m.Component{constructor(e){super(e),this.virtualization=null,this.list=null,this.itemHeight=0,this.topOffset=0,this.maxViewHeight=0,this.bottomOffset=0,this.handleVirtualizationMount=e=>{if(this.virtualization=e,this.virtualization&&this.list){this.list.style.transform=`translateY(${this.topOffset}px)`;const e=q(this.props.focusedDate,this.props.min,this.props.max),t=this.props.service.skip(e,this.props.min);this.virtualization.scrollToIndex(t)}},this.buildNavigationItem=e=>{const t=this.props.service.navigationTitle(e),i=this.props.service.isRangeStart(e),s=`kendo-react-calendar-nav-item-${e.getTime()}`,a={text:t,value:e,isRangeStart:i,view:this.props.activeView,onClick:this.handleDateChange};return this.props.navigationItem?m.createElement(this.props.navigationItem,{...a,key:s},t):m.createElement(Me,{...a,key:s},t)},this.calculateHeights=()=>{const e=this.props.dom.calendarHeight;this.itemHeight=this.props.dom.navigationItemHeight||1,this.maxViewHeight=this.props.dom.monthViewHeight,this.topOffset=(e-this.itemHeight)/2,this.bottomOffset=e-this.itemHeight},this.handleDateChange=(e,t)=>{const{onChange:i}=this.props;if(i&&t){const s={value:a.cloneDate(e),target:this,nativeEvent:t&&t.nativeEvent,syntheticEvent:t};i.call(void 0,s)}},this.handleScrollAction=({scrollAction:e,pageAction:t})=>{const i=t?t.skip:this.state.skip;if(this.state.skip!==i&&this.setState({skip:i}),this.list&&e){const t=`translateY(${e.offset}px)`;this.list.style.transform=t}},this.lastView=this.props.activeView,this.lastFocus=this.props.focusedDate;const t=this.props.service.skip(this.props.focusedDate,this.props.min),i=this.props.service.total(this.props.min,this.props.max);this.state={skip:t-this.getTake(t,i)>0?t:0}}get take(){return void 0!==this.props.take?this.props.take:e.defaultProps.take}componentDidUpdate(e,t){void 0!==this.indexToScroll&&this.virtualization&&this.virtualization.scrollToIndex(this.indexToScroll),this.lastView=this.props.activeView,this.lastFocus=this.props.focusedDate,this.indexToScroll=void 0}render(){const{activeView:e,min:t,max:i,service:n,unstyled:o}=this.props;this.calculateHeights();const r=o&&o.uCalendar,l=this.lastView!==e,h=q(this.props.focusedDate,t,i),c=l?n.skip(h,t):this.state.skip,u=n.total(t,i),d=this.getTake(c,u),p=n.addToDate(t,c),g=n.datesList(p,d);(e!==this.lastView||!a.isEqual(h,this.lastFocus))&&(this.indexToScroll=n.skip(h,t));const v=m.createElement(C,{skip:c,take:this.take,total:u,itemHeight:this.itemHeight,topOffset:this.topOffset,bottomOffset:this.bottomOffset,onScroll:this.props.onScroll,maxScrollDifference:this.maxViewHeight,onScrollAction:this.handleScrollAction,onMount:e=>!this.virtualization&&this.handleVirtualizationMount(e),tabIndex:this.props.tabIndex,unstyled:o},m.createElement("ul",{ref:e=>{this.list=e},className:s.classNames(s.uCalendar.ul({c:r}))},g.map((e=>this.buildNavigationItem(e)))));return m.createElement("div",{className:s.classNames(s.uCalendar.navigation({c:r}))},m.createElement("span",{className:s.classNames(s.uCalendar.navigationHighlight({c:r}))}),this.props.dom.didCalculate?v:null)}getTake(e,t){return Math.min(t-e,this.take)}};Te.propTypes={activeView:i.number.isRequired,focusedDate:i.instanceOf(Date).isRequired,max:i.instanceOf(Date).isRequired,min:i.instanceOf(Date).isRequired,onChange:i.func,take:i.number,tabIndex:i.number},Te.defaultProps={take:30};let Oe=Te;var Ee=(e=>(e[e.Left=0]="Left",e[e.Right=1]="Right",e[e.Up=2]="Up",e[e.Down=3]="Down",e[e.PrevView=4]="PrevView",e[e.NextView=5]="NextView",e[e.FirstInView=6]="FirstInView",e[e.LastInView=7]="LastInView",e[e.LowerView=8]="LowerView",e[e.UpperView=9]="UpperView",e))(Ee||{});const Ve=[[]],Ne={[Ee.Left]:e=>a.addDecades(e,-1),[Ee.Up]:e=>a.addDecades(e,-5),[Ee.Right]:e=>a.addDecades(e,1),[Ee.Down]:e=>a.addDecades(e,5),[Ee.PrevView]:e=>a.addCenturies(e,-1),[Ee.NextView]:e=>a.addCenturies(e,1),[Ee.FirstInView]:e=>a.firstDecadeOfCentury(e),[Ee.LastInView]:e=>a.lastDecadeOfCentury(e)};class Re{addToDate(e,t){return a.addCenturies(e,t)}datesList(e,t){return H(0,t).map((t=>a.addCenturies(e,t)))}data(e){const{cellUID:t,focusedDate:i,isActiveView:s,max:n,min:o,selectedDate:r,selectionRange:l=M,viewDate:h}=e;if(!h)return Ve;const c=H(0,4),u=a.firstDecadeOfCentury(h),d=a.lastDecadeOfCentury(h),p=L();return H(0,3).map((e=>{const h=a.addDecades(u,4*e);return c.map((e=>{const c=this.normalize(a.addDecades(h,e),o,n),m=this.isEqual(c,l.start),g=this.isEqual(c,l.end),v=!m&&!g&&z(c,l),f=s&&(Array.isArray(r)?this.isSelectedFromArray(c,r,o,n):B(r,o,n)&&this.isEqual(c,r));return _(c,u,d)?{formattedValue:this.value(c),id:`${t}${c.getTime()}`,isFocused:this.isEqual(c,i),isSelected:f,isWeekend:!1,isInRange:B(c,o,n),isRangeStart:m,isRangeMid:v,isRangeEnd:g,isRangeSplitEnd:v&&this.isEqual(c,d),isRangeSplitStart:v&&this.isEqual(c,u),isToday:this.isEqual(c,p),title:this.cellTitle(c),value:c}:null}))}))}isSelectedFromArray(e,t,i,s){let a=!1;return t.forEach((t=>{B(e,i,s)&&this.isEqual(e,t)&&(a=!0)})),a}isEqual(e,t){return!(!e||!t)&&a.firstYearOfDecade(e).getFullYear()===a.firstYearOfDecade(t).getFullYear()}isInArray(e,t){if(!t.length)return!1;const i=e.getFullYear();return t[0].getFullYear()<=i&&i<=t[t.length-1].getFullYear()+99}isInRange(e,t,i){const s=a.firstYearOfDecade(e).getFullYear(),n=!t||a.firstYearOfDecade(t).getFullYear()<=s,o=!i||s<=a.firstYearOfDecade(i).getFullYear();return n&&o}isInSameView(e,t){return 0===a.durationInCenturies(e,t)}isRangeStart(e){return e.getFullYear()%1e3==0}move(e,t){const i=Ne[t];return i?i(e):e}cellTitle(e){return a.firstYearOfDecade(e).getFullYear().toString()}navigationTitle(e){return e?a.firstDecadeOfCentury(e).getFullYear().toString():""}title(e){return e?`${a.firstDecadeOfCentury(e).getFullYear()} - ${a.lastDecadeOfCentury(e).getFullYear()}`:""}rowLength(e){return 4}skip(e,t){return a.durationInCenturies(t,e)}total(e,t){return a.durationInCenturies(e,t)+1}value(e){return e?a.firstYearOfDecade(e).getFullYear().toString():""}viewDate(e,t,i=1){return a.durationInCenturies(e,t)<i?a.addCenturies(e,-1):e}normalize(e,t,i){return e<t&&this.isEqual(e,t)?a.cloneDate(t):e>i&&this.isEqual(e,i)?a.cloneDate(i):e}}const Pe=[[]],Fe={[Ee.Left]:e=>a.addYears(e,-1),[Ee.Up]:e=>a.addYears(e,-5),[Ee.Right]:e=>a.addYears(e,1),[Ee.Down]:e=>a.addYears(e,5),[Ee.PrevView]:e=>a.addDecades(e,-1),[Ee.NextView]:e=>a.addDecades(e,1),[Ee.FirstInView]:e=>a.firstYearOfDecade(e),[Ee.LastInView]:e=>a.lastYearOfDecade(e)};let Le=class{addToDate(e,t){return a.addDecades(e,t)}datesList(e,t){return H(0,t).map((t=>a.addDecades(e,t)))}data(e){const{cellUID:t,focusedDate:i,isActiveView:s,max:n,min:o,selectedDate:r,selectionRange:l=M,viewDate:h}=e;if(!h)return Pe;const c=H(0,4),u=a.firstYearOfDecade(h),d=a.lastYearOfDecade(h),p=L();return H(0,3).map((e=>{const h=a.addYears(u,4*e);return c.map((e=>{const c=this.normalize(a.addYears(h,e),o,n),m=this.isEqual(c,l.start),g=this.isEqual(c,l.end),v=!m&&!g&&z(c,l),f=s&&(Array.isArray(r)?this.isSelectedFromArray(c,r,o,n):B(r,o,n)&&this.isEqual(c,r));return _(c,u,d)?{formattedValue:this.value(c),id:`${t}${c.getTime()}`,isFocused:this.isEqual(c,i),isSelected:f,isWeekend:!1,isInRange:B(c,o,n),isRangeStart:m,isRangeMid:v,isRangeEnd:g,isRangeSplitEnd:v&&this.isEqual(c,d),isRangeSplitStart:v&&this.isEqual(c,u),isToday:this.isEqual(c,p),title:this.cellTitle(c),value:c}:null}))}))}isSelectedFromArray(e,t,i,s){let a=!1;return t.forEach((t=>{B(e,i,s)&&this.isEqual(e,t)&&(a=!0)})),a}isEqual(e,t){return!(!e||!t)&&e.getFullYear()===t.getFullYear()}isInArray(e,t){if(!t.length)return!1;const i=e.getFullYear();return t[0].getFullYear()<=i&&i<=t[t.length-1].getFullYear()+9}isInRange(e,t,i){const s=e.getFullYear(),a=!t||t.getFullYear()<=s,n=!i||s<=i.getFullYear();return a&&n}isRangeStart(e){return e.getFullYear()%100==0}isInSameView(e,t){return 0===a.durationInDecades(e,t)}move(e,t){const i=Fe[t];return i?i(e):e}cellTitle(e){return e.getFullYear().toString()}navigationTitle(e){return e?a.firstYearOfDecade(e).getFullYear().toString():""}title(e){return e?`${a.firstYearOfDecade(e).getFullYear()} - ${a.lastYearOfDecade(e).getFullYear()}`:""}rowLength(e){return 4}skip(e,t){return a.durationInDecades(t,e)}total(e,t){return a.durationInDecades(e,t)+1}value(e){return e?e.getFullYear().toString():""}viewDate(e,t,i=1){return a.durationInDecades(e,t)<i?a.addDecades(e,-1):e}normalize(e,t,i){return e<t&&this.isEqual(e,t)?a.cloneDate(t):e>i&&this.isEqual(e,i)?a.cloneDate(i):e}};const Be=[[]],Ae={[Ee.Left]:e=>a.addDays(e,-1),[Ee.Up]:e=>a.addWeeks(e,-1),[Ee.Right]:e=>a.addDays(e,1),[Ee.Down]:e=>a.addWeeks(e,1),[Ee.PrevView]:e=>a.addMonths(e,-1),[Ee.NextView]:e=>a.addMonths(e,1),[Ee.FirstInView]:e=>a.firstDayOfMonth(e),[Ee.LastInView]:e=>a.lastDayOfMonth(e)};let ze=class{constructor(e){this.intl=e}addToDate(e,t){return a.addMonths(e,t)}datesList(e,t){return H(0,t).map((t=>a.addMonths(e,t)))}data(e){const{cellUID:t,focusedDate:i,isActiveView:s,max:n,min:o,selectedDate:r,selectionRange:l=M,viewDate:h}=e;if(!h)return Be;const c=a.firstDayOfMonth(h),u=a.lastDayOfMonth(h),d=a.dayOfWeek(c,this.intl.firstDay(),-1),p=H(0,7),m=L();return H(0,6).map((e=>{const h=a.addDays(d,7*e);return p.map((e=>{const d=this.normalize(a.addDays(h,e),o,n),p=d<c||d>u,g=this.isEqual(d,l.start),v=this.isEqual(d,l.end),f=!g&&!v&&z(d,l),w=s&&(Array.isArray(r)?this.isSelectedFromArray(d,r,o,n):B(r,o,n)&&this.isEqual(d,r));return{formattedValue:this.value(d),id:`${t}${d.getTime()}`,isFocused:this.isEqual(d,i),isSelected:w,isInRange:B(d,o,n),isWeekend:this.isWeekend(d),isRangeStart:g,isRangeMid:f,isRangeEnd:v,isRangeSplitStart:f&&this.isEqual(d,c),isRangeSplitEnd:f&&this.isEqual(d,u),isToday:this.isEqual(d,m),title:this.cellTitle(d),value:d,isOtherMonth:p}}))}))}isEqual(e,t){return!(!e||!t)&&a.getDate(e).getTime()===a.getDate(t).getTime()}isSelectedFromArray(e,t,i,s){let a=!1;return t.forEach((t=>{B(e,i,s)&&this.isEqual(e,t)&&(a=!0)})),a}isInArray(e,t){return!!t.length&&a.firstDayOfMonth(t[0])<=e&&e<=a.lastDayOfMonth(t[t.length-1])}isInRange(e,t,i){const s=a.getDate(e),n=!t||a.getDate(t)<=s,o=!i||s<=a.getDate(i);return n&&o}isInSameView(e,t){return 0===a.durationInMonths(e,t)}isRangeStart(e){return!e.getMonth()}move(e,t){const i=Ae[t];return i?i(e):e}cellTitle(e){return this.intl.formatDate(e,"D")}navigationTitle(e){return e?this.isRangeStart(e)?e.getFullYear().toString():this.abbrMonthNames()[e.getMonth()]:""}title(e){return`${this.wideMonthNames()[e.getMonth()]} ${e.getFullYear()}`}rowLength(e){return 7+(e?1:0)}skip(e,t){return a.durationInMonths(t,e)}total(e,t){return a.durationInMonths(e,t)+1}value(e){return e?e.getDate().toString():""}viewDate(e,t,i=1){return a.durationInMonths(e,t)<i?a.addMonths(e,-1):e}isWeekend(e){const t=e.getDay();return 6===t||0===t}abbrMonthNames(){return this.intl.dateFormatNames({nameType:"abbreviated",type:"months"})}normalize(e,t,i){return e<t&&this.isEqual(e,t)?a.getDate(t):e>i&&this.isEqual(e,i)?a.getDate(i):e}wideMonthNames(){return this.intl.dateFormatNames({nameType:"wide",type:"months",standAlone:!0})}};const He=[[]],_e={[Ee.Left]:e=>a.addMonths(e,-1),[Ee.Up]:e=>a.addMonths(e,(e=>e>4?-5:e<2?-2:-7)(e.getMonth())),[Ee.Right]:e=>a.addMonths(e,1),[Ee.Down]:e=>a.addMonths(e,(e=>e<7?5:e<10?7:2)(e.getMonth())),[Ee.PrevView]:e=>a.addYears(e,-1),[Ee.NextView]:e=>a.addYears(e,1),[Ee.FirstInView]:e=>a.firstMonthOfYear(e),[Ee.LastInView]:e=>a.lastMonthOfYear(e)};let qe=class{constructor(e){this._intl=e}addToDate(e,t){return a.addYears(e,t)}datesList(e,t){return H(0,t).map((t=>a.addYears(e,t)))}data(e){const{cellUID:t,focusedDate:i,isActiveView:s,max:n,min:o,selectedDate:r,selectionRange:l=M,viewDate:h}=e;if(!h)return He;const c=this.abbrMonthNames(),u=a.firstMonthOfYear(h),d=a.lastMonthOfYear(h),p=u.getFullYear(),m=H(0,4),g=L();return H(0,3).map((e=>{const h=a.addMonths(u,4*e);return m.map((e=>{const m=this.normalize(a.addMonths(h,e),o,n);if(p<m.getFullYear())return null;const v=this.isEqual(m,l.start),f=this.isEqual(m,l.end),w=!v&&!f&&z(m,l),b=s&&(Array.isArray(r)?this.isSelectedFromArray(m,r,o,n):B(r,o,n)&&this.isEqual(m,r));return{formattedValue:c[m.getMonth()],id:`${t}${m.getTime()}`,isFocused:this.isEqual(m,i),isSelected:b,isInRange:B(m,o,n),isWeekend:!1,isRangeStart:v,isRangeMid:w,isRangeEnd:f,isRangeSplitEnd:w&&this.isEqual(m,d),isRangeSplitStart:w&&this.isEqual(m,u),isToday:this.isEqual(m,g),title:this.cellTitle(m),value:m}}))}))}isSelectedFromArray(e,t,i,s){let a=!1;return t.forEach((t=>{B(e,i,s)&&this.isEqual(e,t)&&(a=!0)})),a}isEqual(e,t){return!(!e||!t)&&(e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth())}isInArray(e,t){if(!t.length)return!1;const i=e.getFullYear();return t[0].getFullYear()<=i&&i<=t[t.length-1].getFullYear()}isInRange(e,t,i){const s=a.createDate(e.getFullYear(),e.getMonth(),1),n=!t||a.createDate(t.getFullYear(),t.getMonth(),1)<=s,o=!i||s<=a.createDate(i.getFullYear(),i.getMonth(),1);return n&&o}isInSameView(e,t){return 0===a.durationInYears(e,t)}isRangeStart(e){return e.getFullYear()%10==0}move(e,t){const i=_e[t];return i?i(e):e}cellTitle(e){return`${e.getFullYear()} ${this.value(e)}`}navigationTitle(e){return this.title(e)}title(e){return e?e.getFullYear().toString():""}rowLength(e){return 4}skip(e,t){return a.durationInYears(t,e)}total(e,t){return a.durationInYears(e,t)+1}value(e){return e?this.abbrMonthNames()[e.getMonth()]:""}viewDate(e,t,i=1){return a.durationInYears(e,t)<i?a.addYears(e,-1):e}abbrMonthNames(){return this._intl.dateFormatNames({nameType:"abbreviated",type:"months"})}normalize(e,t,i){return e<t&&this.isEqual(e,t)?a.cloneDate(t):e>i&&this.isEqual(e,i)?a.cloneDate(i):e}};const We={[I.month]:ze,[I.year]:qe,[I.decade]:Le,[I.century]:Re};let Ke=class{constructor(e){this.bottom=I.month,this.top=I.century,this.onViewChanged=e}configure(e,t){this.bottom=e,this.top=t}service(e,t){return new We[`${e}`](t)}moveDown(e,t){this.move(e,-1,t)}moveUp(e,t){this.move(e,1,t)}moveToBottom(e){e!==this.bottom&&this.onViewChanged({view:this.bottom})}canMoveDown(e){return this.bottom<e}canMoveUp(e){return e<this.top}clamp(e){return e<this.bottom?this.bottom:e>this.top?this.top:e}move(e,t,i){const s=this.clamp(((e,t)=>{const i=I[I[e+t]];return void 0!==i?i:e})(e,t));s!==e&&this.onViewChanged({view:s},i)}};class Ue{constructor(){this.calendarHeight=0,this.headerHeight=0,this.monthViewHeight=0,this.yearViewHeight=0,this.decadeViewHeight=0,this.centuryViewHeight=0,this.navigationItemHeight=0,this.scrollableContentHeight=0,this.scrollableYearContentHeight=0,this.calendarWidth=0,this.monthViewWidth=0,this.yearViewWidth=0,this.decadeViewWidth=0,this.centuryViewWidth=0,this.scrollableContentWidth=0,this.didCalculate=!1,this.hostContainer=null}ensureHeights(){void 0===this.calendarHeight&&this.calculateHeights()}calculateHeights(e,t){if(!s.canUseDOM)return;const i=W("div"),a=W("ul"),n=W("li"),o=W("td"),r=W("th"),l=W("tr"),h=W("tbody"),c=W("thead"),u=W("table"),d=t&&t.uCalendar,p=t&&t.uButton,m=s.strippedClassNames(s.uButton.wrapper({c:p,fillMode:"flat",size:"medium",rounded:"medium",themeColor:"primary"}),s.uCalendar.title({c:d})),g=()=>i(`\n <span class="${m}">\n <span class="${s.strippedClassNames(s.uButton.text({c:p}))}">March 2017</span>\n </span>\n <span class="${s.strippedClassNames(s.uCalendar.spacer({c:d}))}"></span>\n <span class="${s.strippedClassNames(s.uCalendar.nav({c:d}))}"><button class="${s.strippedClassNames(s.uCalendar.today({c:d}))}">TODAY</button></span>\n `,s.strippedClassNames(s.uCalendar.header({c:d,vertical:!0}))),v=(e,t)=>new Array(e).fill("1").map(t),f=e=>i(e,s.strippedClassNames(s.uCalendar.scrollableSelector({c:d}),s.uCalendar.scrollable({c:d,horizontal:!0}))),w=(()=>{let e;return()=>s.canUseDOM?(e||(e=i([f([a([n("<span>FEB</span>")])])],s.strippedClassNames(s.uCalendar.navigation({c:d})),{left:"0px",position:"absolute"})),e):null})(),b=({cells:e,rows:t},a,n)=>{let p;return()=>s.canUseDOM?(p||(p=((e,t,a)=>i(a?[g(),u([c([l([r("MO",s.strippedClassNames(s.uCalendar.th({c:d})))],s.strippedClassNames(s.uCalendar.tr({c:d})))],s.strippedClassNames(s.uCalendar.thead({c:d})))],s.strippedClassNames(s.uCalendar.table({c:d,weekdays:!0}))),f([e,e])]:[g(),f([e,e])],t,{left:"-10000px",position:"absolute"}))(((e,t=1)=>u([h([l([o("1",s.strippedClassNames(s.uCalendar.td({c:d,isWeek:!0})))])].concat(v(e,(()=>l(v(t,(e=>o(`<span class="${s.strippedClassNames(s.uCalendar.link({c:d}))}">${e}</span>`,s.strippedClassNames(s.uCalendar.td({c:d}))))),s.strippedClassNames(s.uCalendar.tr({c:d})))))),s.strippedClassNames(s.uCalendar.tbody({c:d})))],s.strippedClassNames(s.uCalendar.table({c:d}))))(t,e),a,n)),p):null},D=e=>e.querySelector(`.${s.strippedClassNames(s.uCalendar.scrollableSelector({c:d}))}`),y=e=>{const t=D(e);return t.className=`${t.className} scrollable-horizontal`,e},S=b({cells:7,rows:6},s.strippedClassNames(s.uCalendar.view({c:d,month:!0})),!0),C=b({cells:5,rows:3},s.strippedClassNames(s.uCalendar.view({c:d,year:!0})),!1),k=b({cells:5,rows:2},s.strippedClassNames(s.uCalendar.view({c:d,decade:!0})),!1),x=e=>parseFloat(window.getComputedStyle(e).height)||e.offsetHeight,I=e=>{const t=window.getComputedStyle(e);return parseFloat(t.width)+parseFloat(t.paddingLeft)+parseFloat(t.paddingRight)||e.offsetWidth},M=e=>e.querySelector("tbody");this.didCalculate=!0,e&&(this.hostContainer=e),this.batch(S(),(e=>{const t=M(e);this.calendarHeight=x(e),this.monthViewHeight=x(t),this.headerHeight=x(t.children[0]),this.scrollableContentHeight=x(D(e))})),this.batch(y(S()),(e=>{const t=M(e);this.calendarWidth=I(e),this.monthViewWidth=I(t),this.scrollableContentWidth=I(D(e))})),this.batch(C(),(e=>{this.yearViewHeight=x(M(e)),this.scrollableYearContentHeight=x(D(e))})),this.batch(y(C()),(e=>{this.yearViewWidth=I(M(e))})),this.batch(k(),(e=>{this.decadeViewHeight=x(M(e)),this.centuryViewHeight=this.decadeViewHeight})),this.batch(y(k()),(e=>{this.decadeViewWidth=I(M(e)),this.centuryViewWidth=this.decadeViewWidth})),this.batch(w(),(e=>{this.navigationItemHeight=x(e.querySelector("li"))}))}viewHeight(e){return this.viewDimension(e,"height")}viewWidth(e){return this.viewDimension(e,"width")}viewDimension(e,t){const i="height"===t?"ViewHeight":"ViewWidth";switch(e){case I.month:return this[`month${i}`];case I.year:return this[`year${i}`];case I.decade:return this[`decade${i}`];case I.century:return this[`century${i}`];default:return 1}}batch(e,t){const i=this.hostContainer||document.body,s=i.appendChild(e);t(s),i.removeChild(s)}}const Ye={33:Ee.PrevView,34:Ee.NextView,35:Ee.LastInView,36:Ee.FirstInView,37:Ee.Left,38:Ee.Up,39:Ee.Right,40:Ee.Down,"meta+38":Ee.UpperView,"meta+40":Ee.LowerView};let $e=class{constructor(e){this.bus=e}action(e){const t=`${e.ctrlKey||e.metaKey?"meta+":""}${e.keyCode}`;return Ye[t]}move(e,t,i,s,a){return s?t===Ee.UpperView&&this.bus.canMoveUp(i)?(this.bus.moveUp(i,a),e):t===Ee.LowerView&&this.bus.canMoveDown(i)?(this.bus.moveDown(i,a),e):s.move(e,t):e}};class je{constructor(e){this.dom=e,this.divideByMagnitude=null,this.powerByMagnitude=null,this.navigator=null,this.view=null,this.monthScrolled=!1,this.navScrolled=!1}configure(e){const t=Math.max(this.dom.viewHeight(e)/this.dom.navigationItemHeight,1);this.divideByMagnitude=(e=>t=>Math.floor(t/e))(t),this.powerByMagnitude=(e=>t=>t*e)(t)}sync(e,t,i){if(e&&t){if(this.navigator=e,this.view=t,i.target===this.navigator.element){if(this.monthScrolled)return void(this.monthScrolled=!1);this.navScrolled=!0,this.scrollSiblingOf(this.navigator.element)}if(i.target===this.view.element){if(this.navScrolled)return void(this.navScrolled=!1);this.monthScrolled=!0,this.scrollSiblingOf(this.view.element)}}}scrollSiblingOf(e){const t=this.siblingComponent(e),i=this.calculateScroll(t,e.scrollTop);t.scrollTo(i)}siblingComponent(e){return this.navigator.element===e?this.view:this.navigator}calculateScroll(e,t){const i=e===this.navigator?this.divideByMagnitude:this.powerByMagnitude;return i?i(t):0}}const Ze=e=>e?e.virtualization:null,Je=(e=Xe.defaultProps.min,t=Xe.defaultProps.max,i,s)=>void 0!==s?null!==s&&B(a.getDate(s),e,t)?s:null:null!==i&&B(a.getDate(i),e,t)?i:null,Ge=class e extends m.Component{constructor(t){super(t),this.scrollSyncService=null,this.focusedDate=null,this.Navigation=null,this.calendarViewList=null,this._element=null,this.intl=null,this.service=null,this.isActive=!1,this.didNavigationChange=!1,this.focus=()=>{this._element&&this._element.focus()},this.shouldScroll=()=>this.didNavigationChange,this.handleScroll=e=>{this.scrollSyncService&&this.scrollSyncService.sync(Ze(this.Navigation),Ze(this.calendarViewList),e)},this.handleNavigationChange=e=>{if(this.props.disabled)return;this.didNavigationChange=!0;const t=a.cloneDate(e.value);this.setState({focusedDate:t})},this.handleViewChange=({view:e})=>{this.scrollSyncService&&t