@progress/kendo-react-dateinputs 7.1.0-develop.1 → 7.1.0-develop.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/js/kendo-react-dateinputs.js +4 -4
- package/index.js +4 -4
- package/index.mjs +42 -42
- package/package.json +7 -7
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
(function(p,Ft){typeof exports=="object"&&typeof module!="undefined"?Ft(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-react-popup"),require("@progress/kendo-react-layout")):typeof define=="function"&&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-react-popup","@progress/kendo-react-layout"],Ft):(p=typeof globalThis!="undefined"?globalThis:p||self,Ft(p.KendoReactDateinputs={},p.React,p.PropTypes,p.KendoReactCommon,p.KendoDateMath,p.KendoReactIntl,p.KendoReactButtons,p.KendoSvgIcons,p.KendoReactLabels,p.KendoReactPopup,p.KendoReactLayout))})(this,function(p,Ft,n,d,l,x,L,J,Ye,Wt,ht){"use strict";"use client";function Ti(i){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const e in i)if(e!=="default"){const s=Object.getOwnPropertyDescriptor(i,e);Object.defineProperty(t,e,s.get?s:{enumerable:!0,get:()=>i[e]})}}return t.default=i,Object.freeze(t)}const o=Ti(Ft),ft={name:"@progress/kendo-react-dateinputs",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:1617189075,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning"},ji=(i,t,e)=>[...i.slice(0,t+1),...i.slice(t+1).map(s=>s+e)];class Zi{constructor(t=0,e,s){this.total=t,this.rowHeight=e,this.detailRowHeight=s,this.offsets=[],this.heights=[];let a=0;for(let r=0;r<t;r++)this.offsets.push(a),a+=e,this.heights.push(e)}height(t){return this.heights[t]}expandDetail(t){this.height(t)===this.rowHeight&&this.updateRowHeight(t,this.detailRowHeight)}collapseDetail(t){this.height(t)>this.rowHeight&&this.updateRowHeight(t,this.detailRowHeight*-1)}index(t){for(let e=0;e<this.offsets.length;e++){if(t===this.offsets[e])return e;if(t<this.offsets[e])return e-1}return this.total-1}offset(t){return this.offsets[t]}totalHeight(){return this.heights.reduce((t,e)=>t+e,0)}updateRowHeight(t,e){this.heights[t]+=e,this.offsets=ji(this.offsets,t,e)}}const Kt=i=>Math.max(i,0);class re{constructor(t){this.offset=t}}class le{constructor(t){this.skip=t}}class Gi{constructor(t,e){this.onScrollAction=t,this.onPageAction=e,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(t,e,s,a,r=0,h=0,u="vertical"){this.rowHeightService=t,this.firstLoaded=e,this.lastLoaded=e+s,this.take=s,this.total=a,this.lastScrollTop=0,this.topOffset=r,this.bottomOffset=h,this.direction=u;const c=this.rowsForHeight(r),m=Kt(e-c);this.onScrollAction(new re(this.rowOffset(m))),this.onPageAction(new le(m))}onScroll({scrollLeft:t,scrollTop:e,offsetHeight:s,offsetWidth:a}){const r=this.direction==="vertical"?e:t,h=this.direction==="vertical"?s:a;if(this.lastScrollTop===r||!this.rowHeightService)return;const u=this.lastScrollTop>=r;this.lastScrollTop=r;const c=this.rowHeightService.index(Kt(r-this.topOffset)),m=this.rowHeightService.index(Kt(r+h-this.bottomOffset));if(!u&&m>=this.lastLoaded&&this.lastLoaded<this.total&&(this.firstLoaded=c,this.onScrollAction(new re(this.rowOffset(c))),this.lastLoaded=Math.min(this.firstLoaded+this.take,this.total),this.onPageAction(new le(this.firstLoaded))),u&&c<=this.firstLoaded){const f=Math.floor(this.take*.3);this.firstLoaded=Kt(c-f),this.onScrollAction(new re(this.rowOffset(this.firstLoaded))),this.lastLoaded=Math.min(this.firstLoaded+this.take,this.total),this.onPageAction(new le(this.firstLoaded))}}rowOffset(t){return this.rowHeightService?this.rowHeightService.offset(t)+this.topOffset:0}rowsForHeight(t){return this.rowHeightService?Math.ceil(t/this.rowHeightService.height(0)):0}}const Xi=(i,t,e)=>Math.min(Math.abs(t-i),e),Ji=17,Qi=10,Pi={[1]:i=>t=>t+i,[0]:i=>t=>t-i},ts={[1]:i=>t=>Math.min(t,i),[0]:i=>t=>Math.max(t,i)},es={[1]:i=>t=>t<i,[0]:i=>t=>t>i},Ut=class extends o.Component{constructor(i){super(i),this.rowHeightService=null,this.scrollContainer=null,this.lastDirection=null,this.lastTotal=0,this.lastTake=0,this.animationInProgress=!1,this.restrictScroll=!1,this.scrollTo=t=>{const e=this.direction==="vertical"?"scrollTop":"scrollLeft";if(!this.scrollContainer)return;const s=this.scrollContainer[e];this.restrictScroll&&e==="scrollTop"&&(!Number.isInteger(s)||!Number.isInteger(t))&&Math.abs(s-t)<Qi||(this.scrollContainer[e]=t)},this.scrollToIndex=t=>{this.animationInProgress=!1,this.rowHeightService&&this.scrollTo(this.rowHeightService.offset(t))},this.animateToIndex=t=>{if(!this.rowHeightService||!window)return;window.cancelAnimationFrame(this.cancelAnimation);const e=this.rowHeightService.offset(t),s=this.getContainerScrollDirection(e);let{start:a,end:r}=this.scrollRange(e,s);if(a===r)return;const h=this.scrollStep(a,r),u=Pi[s](h),c=ts[s](r),m=es[s](u(r)),f=g=>{this.animationInProgress=!0;const w=u(g);this.scrollTo(c(w)),m(w)?this.cancelAnimation=window.requestAnimationFrame(()=>{f(w)}):this.animationInProgress=!1};this.cancelAnimation=window.requestAnimationFrame(()=>{f(a)})},this.scrollToBottom=()=>{this.rowHeightService&&this.scrollTo(this.rowHeightService.totalHeight()+this.props.bottomOffset)},this.scrollStep=(t,e)=>{const s=this.props.scrollDuration||Ut.defaultProps.scrollDuration;return Math.abs(e-t)/(s/Ji)},this.scrollRange=(t,e)=>{const s=this.containerScrollPosition;if(parseInt(`${t}`,10)===parseInt(`${s}`,10))return{start:t,end:t};const a=this.containerMaxScroll(),r=e===0?1:-1,h=Xi(s,t,this.props.maxScrollDifference||0),u=Math.min(t,a);return{start:Math.min(Math.max(u+r*h,0),a),end:u}},this.containerMaxScroll=()=>this.containerScrollSize-this.containerOffsetSize,this.getContainerScrollDirection=t=>t<this.containerScrollPosition?0:1,this.initServices=(t=this.props)=>{const e=this.direction==="vertical"?t.itemHeight:t.itemWidth;e!==void 0&&(this.rowHeightService=new Zi(t.total,e,0),this.scrollerService.create(this.rowHeightService,t.skip,t.take,t.total,t.topOffset,this.scrollOffsetSize,this.direction))},this.getContainerProperty=t=>this.scrollContainer?this.scrollContainer[t]:0,this.handleScroll=t=>{if(!this.scrollContainer||!this.rowHeightService)return;const e=t.target;this.scrollerService.onScroll({scrollLeft:e.scrollLeft,scrollTop:e.scrollTop,offsetHeight:e.offsetHeight,offsetWidth:e.offsetWidth});const s=this.rowHeightService.index(this.containerScrollPosition-this.props.topOffset),{onScrollAction:a}=this.props,r={index:s,target:e,scrollAction:this.scrollAction,pageAction:this.pageAction,animationInProgress:this.animationInProgress};this.props.onScroll&&this.props.onScroll.call(void 0,t),a&&a.call(void 0,r),this.scrollAction=void 0,this.pageAction=void 0},this.handleScrollAction=t=>{this.scrollAction=t},this.handlePageAction=t=>{this.pageAction=t},this.scrollerService=new Gi(this.handleScrollAction,this.handlePageAction),this.restrictScroll=Number.parseFloat(o.version)>17}get element(){return this.scrollContainer}get containerOffsetSize(){return this.getContainerProperty(this.direction==="vertical"?"offsetHeight":"offsetWidth")}get containerScrollSize(){return this.getContainerProperty(this.direction==="vertical"?"scrollHeight":"scrollWidth")}get containerScrollPosition(){return this.getContainerProperty(this.direction==="vertical"?"scrollTop":"scrollLeft")}get direction(){return this.props.direction!==void 0?this.props.direction:Ut.defaultProps.direction}get scrollOffsetSize(){return this.props.scrollOffsetSize!==void 0?this.props.scrollOffsetSize:Ut.defaultProps.scrollOffsetSize}activeIndex(){return this.itemIndex(Math.ceil(this.containerScrollPosition))}itemIndex(i){return this.rowHeightService?this.rowHeightService.index(i):0}itemOffset(i){return this.rowHeightService?this.rowHeightService.offset(i):0}isIndexVisible(i){if(!this.rowHeightService)return!1;const t=this.containerScrollPosition,e=t+this.containerOffsetSize,s=this.rowHeightService.offset(i),a=s+this.rowHeightService.height(i);return s>=t&&a<=e}isListScrolled(i){return this.rowHeightService?this.containerScrollPosition!==this.rowHeightService.offset(i):!1}componentDidMount(){const{onMount:i}=this.props;i&&i.call(void 0,this)}render(){(this.lastTotal!==this.props.total||this.lastDirection!==this.direction||this.lastTake!==this.props.take)&&(this.initServices(),this.lastTotal=this.props.total,this.lastDirection=this.direction,this.lastTake=this.props.take);const i=`${(this.rowHeightService?this.rowHeightService.totalHeight():0)+this.props.bottomOffset}`,t=this.direction==="vertical"?{height:`${i}px`}:{width:`${i}px`},e=d.classNames("k-content k-scrollable",{"k-scrollable-horizontal":this.direction==="horizontal"},this.props.className),s=d.classNames("k-scrollable-placeholder",{"k-scrollable-horizontal-placeholder":this.direction==="horizontal"});return o.createElement("div",{ref:a=>{this.scrollContainer=a},onScroll:this.handleScroll,className:e,tabIndex:this.props.tabIndex,role:this.props.role},this.props.children,o.createElement("div",{style:t,className:s}))}};let gt=Ut;gt.propTypes={bottomOffset:n.number.isRequired,className:n.string,direction:n.oneOf(["horizontal","vertical"]),forceScroll:n.bool,itemHeight:n.number,itemWidth:n.number,maxScrollDifference:n.number,onScroll:n.func,onScrollAction:n.func,scrollDuration:n.number,scrollOffsetSize:n.number,skip:n.number.isRequired,tabIndex:n.number,take:n.number.isRequired,topOffset:n.number.isRequired,total:n.number.isRequired,role:n.string},gt.defaultProps={direction:"vertical",forceScroll:!1,scrollOffsetSize:0,maxScrollDifference:100,scrollDuration:100};const is=(i,t)=>{const e=Object.getOwnPropertyNames(i),s=Object.getOwnPropertyNames(t);if(e.length!==s.length)return!1;for(let a=0;a<e.length;a++){const r=e[a];if(i[r]!==t[r])return!1}return!0};class $e extends o.Component{constructor(){super(...arguments),this.handleClick=t=>{const{onClick:e,value:s}=this.props;e&&e.call(void 0,s,t)},this.handleMouseEnter=()=>{const{onMouseEnter:t,value:e}=this.props;t&&t.call(void 0,e)},this.handleMouseLeave=()=>{const{onMouseLeave:t,value:e}=this.props;t&&t.call(void 0,e)}}shouldComponentUpdate(t){const{value:e,...s}=this.props,{value:a,...r}=t;return!((!(e&&a)||e.getTime()===a.getTime())&&is(s,r))}render(){const{className:t,formattedValue:e,isWeekend:s,isFocused:a,isInRange:r,isSelected:h,isRangeStart:u,isRangeMid:c,isRangeEnd:m,isRangeSplitStart:f,isRangeSplitEnd:g,isToday:w,isDisabled:v,view:E,value:V,...N}=this.props,S=this.props.activeRangeEnd==="end"&&m,y=this.props.activeRangeEnd==="start"&&u,b=d.classNames("k-calendar-td",{"k-range-end":m,"k-range-mid":c,"k-range-split-end":g,"k-range-split-start":f,"k-range-start":u,"k-active":y||S,"k-state-pending-focus":a,"k-selected":h||u||m,"k-today":w,"k-weekend":s,"k-disabled":v},t);return o.createElement("td",{...N,className:b,onClick:this.handleClick,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave},o.createElement("span",{className:"k-link"},this.props.children))}}class Te extends o.Component{render(){const{className:t,firstDate:e,...s}=this.props;return o.createElement("td",{className:d.classNames("k-calendar-td",t),...s},this.props.children)}}var D=(i=>(i[i.Left=0]="Left",i[i.Right=1]="Right",i[i.Up=2]="Up",i[i.Down=3]="Down",i[i.PrevView=4]="PrevView",i[i.NextView=5]="NextView",i[i.FirstInView=6]="FirstInView",i[i.LastInView=7]="LastInView",i[i.LowerView=8]="LowerView",i[i.UpperView=9]="UpperView",i))(D||{}),C=(i=>(i[i.month=0]="month",i[i.year=1]="year",i[i.decade=2]="decade",i[i.century=3]="century",i))(C||{});const q={start:null,end:null};function et(i){const t=(s,a,r,...h)=>a[r]===null?null:(s?i.isRequired:i)(a,r,...h),e=t.bind(null,!1);return e.isRequired=t.bind(null,!0),e}const Yt=(i,t,e)=>t===void 0||e===void 0||t<=i&&i<=e?i:i<t?t:e,B=new Date(1980,0,1),it=new Date(1900,0,1),st=new Date(2099,11,31),ct=new Date(1980,0,1),nt=new Date(1980,0,1,23,59,59),R=(i,t)=>{const e=l.cloneDate(i);return e.setHours(t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()),e},z=()=>l.getDate(new Date),A=(i,t,e)=>!i||!(t&&t>i||e&&e<i),je=(i,t,e)=>i===null||!(t&&l.getDate(t)>l.getDate(i)||e&&l.getDate(e)<l.getDate(i)),$t=(i,t)=>{const{start:e,end:s}=t||q;return!e||!s?!1:e<i&&i<s},T=(i,t,e=1)=>{const s=[];for(let a=i;a<t;a=a+e)s.push(a);return s},Ze=(i,t,e)=>t.getTime()<=i.getTime()&&i.getTime()<=e.getTime(),Ge=(i,t)=>i.slice(t).concat(i.slice(0,t)),Y=(i,t,e)=>i&&(t&&i<t?l.cloneDate(t):e&&i>e?l.cloneDate(e):i),$=i=>(t,e="",s={})=>{const a=document.createElement(i);return a.className=e,Object.keys(s).map(r=>a.style[r]=s[r]),typeof t=="string"?a.innerHTML=t||"":(t||[]).forEach(r=>r&&a.appendChild(r)),a};function ss(i,t,e={}){let s,a;e.maxWait;let r,h,u;const c=window;let m=!1,f=!1;const g=!t&&t!==0&&typeof c.requestAnimationFrame=="function";if(typeof i!="function")throw new TypeError("Expected a function");t=+t||0;function w(O){const _=s,tt=a;return s=a=void 0,r=i.apply(tt,_),r}function v(O,_){return g?(c.cancelAnimationFrame(h),c.requestAnimationFrame(O)):setTimeout(O,_)}function E(O){if(g)return c.cancelAnimationFrame(O);clearTimeout(O)}function V(O){return h=v(y,t),m?w():r}function N(O){const _=O-u;return t-_}function S(O){const _=O-u;return u===void 0||_>=t||_<0||f}function y(){const O=Date.now();if(S(O))return b();h=v(y,N(O))}function b(O){return h=void 0,s?w():(s=a=void 0,r)}function K(){h!==void 0&&E(h),s=u=a=h=void 0}function M(){return h===void 0?r:b()}function F(){return h!==void 0}function U(...O){const _=Date.now(),tt=S(_);return s=O,a=this,u=_,tt&&h===void 0?V():(h===void 0&&(h=v(y,t)),r)}return U.cancel=K,U.flush=M,U.pending=F,U}const ns=[[]],oe=4,as=3,rs={[D.Left]:i=>l.addDecades(i,-1),[D.Up]:i=>l.addDecades(i,-5),[D.Right]:i=>l.addDecades(i,1),[D.Down]:i=>l.addDecades(i,5),[D.PrevView]:i=>l.addCenturies(i,-1),[D.NextView]:i=>l.addCenturies(i,1),[D.FirstInView]:i=>l.firstDecadeOfCentury(i),[D.LastInView]:i=>l.lastDecadeOfCentury(i)};class Xe{addToDate(t,e){return l.addCenturies(t,e)}datesList(t,e){return T(0,e).map(s=>l.addCenturies(t,s))}data(t){const{cellUID:e,focusedDate:s,isActiveView:a,max:r,min:h,selectedDate:u,selectionRange:c=q,viewDate:m}=t;if(!m)return ns;const f=T(0,oe),g=l.firstDecadeOfCentury(m),w=l.lastDecadeOfCentury(m),v=z();return T(0,as).map(E=>{const V=l.addDecades(g,E*oe);return f.map(N=>{const S=this.normalize(l.addDecades(V,N),h,r),y=this.isEqual(S,c.start),b=this.isEqual(S,c.end),M=!y&&!b&&$t(S,c),F=a&&(Array.isArray(u)?this.isSelectedFromArray(S,u,h,r):A(u,h,r)&&this.isEqual(S,u));return Ze(S,g,w)?{formattedValue:this.value(S),id:`${e}${S.getTime()}`,isFocused:this.isEqual(S,s),isSelected:F,isWeekend:!1,isInRange:A(S,h,r),isRangeStart:y,isRangeMid:M,isRangeEnd:b,isRangeSplitEnd:M&&this.isEqual(S,w),isRangeSplitStart:M&&this.isEqual(S,g),isToday:this.isEqual(S,v),title:this.cellTitle(S),value:S}:null})})}isSelectedFromArray(t,e,s,a){let r=!1;return e.forEach(h=>{A(t,s,a)&&this.isEqual(t,h)&&(r=!0)}),r}isEqual(t,e){return!t||!e?!1:l.firstYearOfDecade(t).getFullYear()===l.firstYearOfDecade(e).getFullYear()}isInArray(t,e){if(!e.length)return!1;const s=t.getFullYear();return e[0].getFullYear()<=s&&s<=e[e.length-1].getFullYear()+99}isInRange(t,e,s){const a=l.firstYearOfDecade(t).getFullYear(),r=!e||l.firstYearOfDecade(e).getFullYear()<=a,h=!s||a<=l.firstYearOfDecade(s).getFullYear();return r&&h}isInSameView(t,e){return l.durationInCenturies(t,e)===0}isRangeStart(t){return t.getFullYear()%1e3===0}move(t,e){const s=rs[e];return s?s(t):t}cellTitle(t){return l.firstYearOfDecade(t).getFullYear().toString()}navigationTitle(t){return t?l.firstDecadeOfCentury(t).getFullYear().toString():""}title(t){return t?`${l.firstDecadeOfCentury(t).getFullYear()} - ${l.lastDecadeOfCentury(t).getFullYear()}`:""}rowLength(t){return oe}skip(t,e){return l.durationInCenturies(e,t)}total(t,e){return l.durationInCenturies(t,e)+1}value(t){return t?l.firstYearOfDecade(t).getFullYear().toString():""}viewDate(t,e,s=1){return l.durationInCenturies(t,e)<s?l.addCenturies(t,-1):t}normalize(t,e,s){return t<e&&this.isEqual(t,e)?l.cloneDate(e):t>s&&this.isEqual(t,s)?l.cloneDate(s):t}}const ls=[[]],he=4,os=3,hs={[D.Left]:i=>l.addYears(i,-1),[D.Up]:i=>l.addYears(i,-5),[D.Right]:i=>l.addYears(i,1),[D.Down]:i=>l.addYears(i,5),[D.PrevView]:i=>l.addDecades(i,-1),[D.NextView]:i=>l.addDecades(i,1),[D.FirstInView]:i=>l.firstYearOfDecade(i),[D.LastInView]:i=>l.lastYearOfDecade(i)};class Je{addToDate(t,e){return l.addDecades(t,e)}datesList(t,e){return T(0,e).map(s=>l.addDecades(t,s))}data(t){const{cellUID:e,focusedDate:s,isActiveView:a,max:r,min:h,selectedDate:u,selectionRange:c=q,viewDate:m}=t;if(!m)return ls;const f=T(0,he),g=l.firstYearOfDecade(m),w=l.lastYearOfDecade(m),v=z();return T(0,os).map(E=>{const V=l.addYears(g,E*he);return f.map(N=>{const S=this.normalize(l.addYears(V,N),h,r),y=this.isEqual(S,c.start),b=this.isEqual(S,c.end),M=!y&&!b&&$t(S,c),F=a&&(Array.isArray(u)?this.isSelectedFromArray(S,u,h,r):A(u,h,r)&&this.isEqual(S,u));return Ze(S,g,w)?{formattedValue:this.value(S),id:`${e}${S.getTime()}`,isFocused:this.isEqual(S,s),isSelected:F,isWeekend:!1,isInRange:A(S,h,r),isRangeStart:y,isRangeMid:M,isRangeEnd:b,isRangeSplitEnd:M&&this.isEqual(S,w),isRangeSplitStart:M&&this.isEqual(S,g),isToday:this.isEqual(S,v),title:this.cellTitle(S),value:S}:null})})}isSelectedFromArray(t,e,s,a){let r=!1;return e.forEach(h=>{A(t,s,a)&&this.isEqual(t,h)&&(r=!0)}),r}isEqual(t,e){return!t||!e?!1:t.getFullYear()===e.getFullYear()}isInArray(t,e){if(!e.length)return!1;const s=t.getFullYear();return e[0].getFullYear()<=s&&s<=e[e.length-1].getFullYear()+9}isInRange(t,e,s){const a=t.getFullYear(),r=!e||e.getFullYear()<=a,h=!s||a<=s.getFullYear();return r&&h}isRangeStart(t){return t.getFullYear()%100===0}isInSameView(t,e){return l.durationInDecades(t,e)===0}move(t,e){const s=hs[e];return s?s(t):t}cellTitle(t){return t.getFullYear().toString()}navigationTitle(t){return t?l.firstYearOfDecade(t).getFullYear().toString():""}title(t){return t?`${l.firstYearOfDecade(t).getFullYear()} - ${l.lastYearOfDecade(t).getFullYear()}`:""}rowLength(t){return he}skip(t,e){return l.durationInDecades(e,t)}total(t,e){return l.durationInDecades(t,e)+1}value(t){return t?t.getFullYear().toString():""}viewDate(t,e,s=1){return l.durationInDecades(t,e)<s?l.addDecades(t,-1):t}normalize(t,e,s){return t<e&&this.isEqual(t,e)?l.cloneDate(e):t>s&&this.isEqual(t,s)?l.cloneDate(s):t}}const cs=[[]],ce=7,us=6,ds=6,ms=0,ps={[D.Left]:i=>l.addDays(i,-1),[D.Up]:i=>l.addWeeks(i,-1),[D.Right]:i=>l.addDays(i,1),[D.Down]:i=>l.addWeeks(i,1),[D.PrevView]:i=>l.addMonths(i,-1),[D.NextView]:i=>l.addMonths(i,1),[D.FirstInView]:i=>l.firstDayOfMonth(i),[D.LastInView]:i=>l.lastDayOfMonth(i)};class Qe{constructor(t){this.intl=t}addToDate(t,e){return l.addMonths(t,e)}datesList(t,e){return T(0,e).map(s=>l.addMonths(t,s))}data(t){const{cellUID:e,focusedDate:s,isActiveView:a,max:r,min:h,selectedDate:u,selectionRange:c=q,viewDate:m}=t;if(!m)return cs;const f=l.firstDayOfMonth(m),g=l.lastDayOfMonth(m),w=-1,v=l.dayOfWeek(f,this.intl.firstDay(),w),E=T(0,ce),V=z();return T(0,us).map(N=>{const S=l.addDays(v,N*ce);return E.map(y=>{const b=this.normalize(l.addDays(S,y),h,r);if(b<f||b>g)return null;const M=this.isEqual(b,c.start),F=this.isEqual(b,c.end),O=!M&&!F&&$t(b,c),_=a&&(Array.isArray(u)?this.isSelectedFromArray(b,u,h,r):A(u,h,r)&&this.isEqual(b,u));return{formattedValue:this.value(b),id:`${e}${b.getTime()}`,isFocused:this.isEqual(b,s),isSelected:_,isInRange:A(b,h,r),isWeekend:this.isWeekend(b),isRangeStart:M,isRangeMid:O,isRangeEnd:F,isRangeSplitStart:O&&this.isEqual(b,f),isRangeSplitEnd:O&&this.isEqual(b,g),isToday:this.isEqual(b,V),title:this.cellTitle(b),value:b}})})}isEqual(t,e){return!t||!e?!1:l.getDate(t).getTime()===l.getDate(e).getTime()}isSelectedFromArray(t,e,s,a){let r=!1;return e.forEach(h=>{A(t,s,a)&&this.isEqual(t,h)&&(r=!0)}),r}isInArray(t,e){return!!e.length&&l.firstDayOfMonth(e[0])<=t&&t<=l.lastDayOfMonth(e[e.length-1])}isInRange(t,e,s){const a=l.getDate(t),r=!e||l.getDate(e)<=a,h=!s||a<=l.getDate(s);return r&&h}isInSameView(t,e){return l.durationInMonths(t,e)===0}isRangeStart(t){return!t.getMonth()}move(t,e){const s=ps[e];return s?s(t):t}cellTitle(t){return this.intl.formatDate(t,"D")}navigationTitle(t){return t?this.isRangeStart(t)?t.getFullYear().toString():this.abbrMonthNames()[t.getMonth()]:""}title(t){return`${this.wideMonthNames()[t.getMonth()]} ${t.getFullYear()}`}rowLength(t){return ce+(t?1:0)}skip(t,e){return l.durationInMonths(e,t)}total(t,e){return l.durationInMonths(t,e)+1}value(t){return t?t.getDate().toString():""}viewDate(t,e,s=1){return l.durationInMonths(t,e)<s?l.addMonths(t,-1):t}isWeekend(t){const e=t.getDay();return e===ds||e===ms}abbrMonthNames(){return this.intl.dateFormatNames({nameType:"abbreviated",type:"months"})}normalize(t,e,s){return t<e&&this.isEqual(t,e)?l.getDate(e):t>s&&this.isEqual(t,s)?l.getDate(s):t}wideMonthNames(){return this.intl.dateFormatNames({nameType:"wide",type:"months",standAlone:!0})}}const fs=[[]],ue=4,gs=3,vs=i=>i>4?-5:i<2?-2:-7,ws=i=>i<7?5:i<10?7:2,bs={[D.Left]:i=>l.addMonths(i,-1),[D.Up]:i=>l.addMonths(i,vs(i.getMonth())),[D.Right]:i=>l.addMonths(i,1),[D.Down]:i=>l.addMonths(i,ws(i.getMonth())),[D.PrevView]:i=>l.addYears(i,-1),[D.NextView]:i=>l.addYears(i,1),[D.FirstInView]:i=>l.firstMonthOfYear(i),[D.LastInView]:i=>l.lastMonthOfYear(i)};class Pe{constructor(t){this._intl=t}addToDate(t,e){return l.addYears(t,e)}datesList(t,e){return T(0,e).map(s=>l.addYears(t,s))}data(t){const{cellUID:e,focusedDate:s,isActiveView:a,max:r,min:h,selectedDate:u,selectionRange:c=q,viewDate:m}=t;if(!m)return fs;const f=this.abbrMonthNames(),g=l.firstMonthOfYear(m),w=l.lastMonthOfYear(m),v=g.getFullYear(),E=T(0,ue),V=z();return T(0,gs).map(N=>{const S=l.addMonths(g,N*ue);return E.map(y=>{const b=this.normalize(l.addMonths(S,y),h,r);if(v<b.getFullYear())return null;const M=this.isEqual(b,c.start),F=this.isEqual(b,c.end),O=!M&&!F&&$t(b,c),_=a&&(Array.isArray(u)?this.isSelectedFromArray(b,u,h,r):A(u,h,r)&&this.isEqual(b,u));return{formattedValue:f[b.getMonth()],id:`${e}${b.getTime()}`,isFocused:this.isEqual(b,s),isSelected:_,isInRange:A(b,h,r),isWeekend:!1,isRangeStart:M,isRangeMid:O,isRangeEnd:F,isRangeSplitEnd:O&&this.isEqual(b,w),isRangeSplitStart:O&&this.isEqual(b,g),isToday:this.isEqual(b,V),title:this.cellTitle(b),value:b}})})}isSelectedFromArray(t,e,s,a){let r=!1;return e.forEach(h=>{A(t,s,a)&&this.isEqual(t,h)&&(r=!0)}),r}isEqual(t,e){return!t||!e?!1:t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()}isInArray(t,e){if(!e.length)return!1;const s=t.getFullYear();return e[0].getFullYear()<=s&&s<=e[e.length-1].getFullYear()}isInRange(t,e,s){const a=l.createDate(t.getFullYear(),t.getMonth(),1),r=!e||l.createDate(e.getFullYear(),e.getMonth(),1)<=a,h=!s||a<=l.createDate(s.getFullYear(),s.getMonth(),1);return r&&h}isInSameView(t,e){return l.durationInYears(t,e)===0}isRangeStart(t){return t.getFullYear()%10===0}move(t,e){const s=bs[e];return s?s(t):t}cellTitle(t){return`${t.getFullYear()} ${this.value(t)}`}navigationTitle(t){return this.title(t)}title(t){return t?t.getFullYear().toString():""}rowLength(t){return ue}skip(t,e){return l.durationInYears(e,t)}total(t,e){return l.durationInYears(t,e)+1}value(t){return t?this.abbrMonthNames()[t.getMonth()]:""}viewDate(t,e,s=1){return l.durationInYears(t,e)<s?l.addYears(t,-1):t}abbrMonthNames(){return this._intl.dateFormatNames({nameType:"abbreviated",type:"months"})}normalize(t,e,s){return t<e&&this.isEqual(t,e)?l.cloneDate(e):t>s&&this.isEqual(t,s)?l.cloneDate(s):t}}const Ss={[C.month]:Qe,[C.year]:Pe,[C.decade]:Je,[C.century]:Xe},Ds=(i,t)=>{const e=C[C[i+t]];return e!==void 0?e:i};class de{constructor(t){this.bottom=C.month,this.top=C.century,this.onViewChanged=t}configure(t,e){this.bottom=t,this.top=e}service(t,e){return new Ss[`${t}`](e)}moveDown(t,e){this.move(t,-1,e)}moveUp(t,e){this.move(t,1,e)}moveToBottom(t){t!==this.bottom&&this.onViewChanged({view:this.bottom})}canMoveDown(t){return this.bottom<t}canMoveUp(t){return t<this.top}clamp(t){return t<this.bottom?this.bottom:t>this.top?this.top:t}move(t,e,s){const a=this.clamp(Ds(t,e));a!==t&&this.onViewChanged({view:a},s)}}let ti=class{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(){this.calendarHeight===void 0&&this.calculateHeights()}calculateHeights(t){if(!d.canUseDOM)return;const e=$("div"),s=$("ul"),a=$("li"),r=$("td"),h=$("th"),u=$("tr"),c=$("tbody"),m=$("thead"),f=$("table"),g=()=>e(`
|
|
5
|
+
(function(p,Ft){typeof exports=="object"&&typeof module!="undefined"?Ft(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-react-popup"),require("@progress/kendo-react-layout")):typeof define=="function"&&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-react-popup","@progress/kendo-react-layout"],Ft):(p=typeof globalThis!="undefined"?globalThis:p||self,Ft(p.KendoReactDateinputs={},p.React,p.PropTypes,p.KendoReactCommon,p.KendoDateMath,p.KendoReactIntl,p.KendoReactButtons,p.KendoSvgIcons,p.KendoReactLabels,p.KendoReactPopup,p.KendoReactLayout))})(this,function(p,Ft,n,d,l,x,L,J,Ye,Wt,ht){"use strict";"use client";function Ti(i){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const e in i)if(e!=="default"){const s=Object.getOwnPropertyDescriptor(i,e);Object.defineProperty(t,e,s.get?s:{enumerable:!0,get:()=>i[e]})}}return t.default=i,Object.freeze(t)}const o=Ti(Ft),ft={name:"@progress/kendo-react-dateinputs",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:1617189075,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning"},ji=(i,t,e)=>[...i.slice(0,t+1),...i.slice(t+1).map(s=>s+e)];class Zi{constructor(t=0,e,s){this.total=t,this.rowHeight=e,this.detailRowHeight=s,this.offsets=[],this.heights=[];let a=0;for(let r=0;r<t;r++)this.offsets.push(a),a+=e,this.heights.push(e)}height(t){return this.heights[t]}expandDetail(t){this.height(t)===this.rowHeight&&this.updateRowHeight(t,this.detailRowHeight)}collapseDetail(t){this.height(t)>this.rowHeight&&this.updateRowHeight(t,this.detailRowHeight*-1)}index(t){for(let e=0;e<this.offsets.length;e++){if(t===this.offsets[e])return e;if(t<this.offsets[e])return e-1}return this.total-1}offset(t){return this.offsets[t]}totalHeight(){return this.heights.reduce((t,e)=>t+e,0)}updateRowHeight(t,e){this.heights[t]+=e,this.offsets=ji(this.offsets,t,e)}}const Kt=i=>Math.max(i,0);class re{constructor(t){this.offset=t}}class le{constructor(t){this.skip=t}}class Gi{constructor(t,e){this.onScrollAction=t,this.onPageAction=e,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(t,e,s,a,r=0,h=0,u="vertical"){this.rowHeightService=t,this.firstLoaded=e,this.lastLoaded=e+s,this.take=s,this.total=a,this.lastScrollTop=0,this.topOffset=r,this.bottomOffset=h,this.direction=u;const c=this.rowsForHeight(r),m=Kt(e-c);this.onScrollAction(new re(this.rowOffset(m))),this.onPageAction(new le(m))}onScroll({scrollLeft:t,scrollTop:e,offsetHeight:s,offsetWidth:a}){const r=this.direction==="vertical"?e:t,h=this.direction==="vertical"?s:a;if(this.lastScrollTop===r||!this.rowHeightService)return;const u=this.lastScrollTop>=r;this.lastScrollTop=r;const c=this.rowHeightService.index(Kt(r-this.topOffset)),m=this.rowHeightService.index(Kt(r+h-this.bottomOffset));if(!u&&m>=this.lastLoaded&&this.lastLoaded<this.total&&(this.firstLoaded=c,this.onScrollAction(new re(this.rowOffset(c))),this.lastLoaded=Math.min(this.firstLoaded+this.take,this.total),this.onPageAction(new le(this.firstLoaded))),u&&c<=this.firstLoaded){const f=Math.floor(this.take*.3);this.firstLoaded=Kt(c-f),this.onScrollAction(new re(this.rowOffset(this.firstLoaded))),this.lastLoaded=Math.min(this.firstLoaded+this.take,this.total),this.onPageAction(new le(this.firstLoaded))}}rowOffset(t){return this.rowHeightService?this.rowHeightService.offset(t)+this.topOffset:0}rowsForHeight(t){return this.rowHeightService?Math.ceil(t/this.rowHeightService.height(0)):0}}const Xi=(i,t,e)=>Math.min(Math.abs(t-i),e),Ji=17,Qi=10,Pi={[1]:i=>t=>t+i,[0]:i=>t=>t-i},ts={[1]:i=>t=>Math.min(t,i),[0]:i=>t=>Math.max(t,i)},es={[1]:i=>t=>t<i,[0]:i=>t=>t>i},Ut=class extends o.Component{constructor(i){super(i),this.rowHeightService=null,this.scrollContainer=null,this.lastDirection=null,this.lastTotal=0,this.lastTake=0,this.animationInProgress=!1,this.restrictScroll=!1,this.scrollTo=t=>{const e=this.direction==="vertical"?"scrollTop":"scrollLeft";if(!this.scrollContainer)return;const s=this.scrollContainer[e];this.restrictScroll&&e==="scrollTop"&&(!Number.isInteger(s)||!Number.isInteger(t))&&Math.abs(s-t)<Qi||(this.scrollContainer[e]=t)},this.scrollToIndex=t=>{this.animationInProgress=!1,this.rowHeightService&&this.scrollTo(this.rowHeightService.offset(t))},this.animateToIndex=t=>{if(!this.rowHeightService||!window)return;window.cancelAnimationFrame(this.cancelAnimation);const e=this.rowHeightService.offset(t),s=this.getContainerScrollDirection(e);let{start:a,end:r}=this.scrollRange(e,s);if(a===r)return;const h=this.scrollStep(a,r),u=Pi[s](h),c=ts[s](r),m=es[s](u(r)),f=g=>{this.animationInProgress=!0;const w=u(g);this.scrollTo(c(w)),m(w)?this.cancelAnimation=window.requestAnimationFrame(()=>{f(w)}):this.animationInProgress=!1};this.cancelAnimation=window.requestAnimationFrame(()=>{f(a)})},this.scrollToBottom=()=>{this.rowHeightService&&this.scrollTo(this.rowHeightService.totalHeight()+this.props.bottomOffset)},this.scrollStep=(t,e)=>{const s=this.props.scrollDuration||Ut.defaultProps.scrollDuration;return Math.abs(e-t)/(s/Ji)},this.scrollRange=(t,e)=>{const s=this.containerScrollPosition;if(parseInt(`${t}`,10)===parseInt(`${s}`,10))return{start:t,end:t};const a=this.containerMaxScroll(),r=e===0?1:-1,h=Xi(s,t,this.props.maxScrollDifference||0),u=Math.min(t,a);return{start:Math.min(Math.max(u+r*h,0),a),end:u}},this.containerMaxScroll=()=>this.containerScrollSize-this.containerOffsetSize,this.getContainerScrollDirection=t=>t<this.containerScrollPosition?0:1,this.initServices=(t=this.props)=>{const e=this.direction==="vertical"?t.itemHeight:t.itemWidth;e!==void 0&&(this.rowHeightService=new Zi(t.total,e,0),this.scrollerService.create(this.rowHeightService,t.skip,t.take,t.total,t.topOffset,this.scrollOffsetSize,this.direction))},this.getContainerProperty=t=>this.scrollContainer?this.scrollContainer[t]:0,this.handleScroll=t=>{if(!this.scrollContainer||!this.rowHeightService)return;const e=t.target;this.scrollerService.onScroll({scrollLeft:e.scrollLeft,scrollTop:e.scrollTop,offsetHeight:e.offsetHeight,offsetWidth:e.offsetWidth});const s=this.rowHeightService.index(this.containerScrollPosition-this.props.topOffset),{onScrollAction:a}=this.props,r={index:s,target:e,scrollAction:this.scrollAction,pageAction:this.pageAction,animationInProgress:this.animationInProgress};this.props.onScroll&&this.props.onScroll.call(void 0,t),a&&a.call(void 0,r),this.scrollAction=void 0,this.pageAction=void 0},this.handleScrollAction=t=>{this.scrollAction=t},this.handlePageAction=t=>{this.pageAction=t},this.scrollerService=new Gi(this.handleScrollAction,this.handlePageAction),this.restrictScroll=Number.parseFloat(o.version)>17}get element(){return this.scrollContainer}get containerOffsetSize(){return this.getContainerProperty(this.direction==="vertical"?"offsetHeight":"offsetWidth")}get containerScrollSize(){return this.getContainerProperty(this.direction==="vertical"?"scrollHeight":"scrollWidth")}get containerScrollPosition(){return this.getContainerProperty(this.direction==="vertical"?"scrollTop":"scrollLeft")}get direction(){return this.props.direction!==void 0?this.props.direction:Ut.defaultProps.direction}get scrollOffsetSize(){return this.props.scrollOffsetSize!==void 0?this.props.scrollOffsetSize:Ut.defaultProps.scrollOffsetSize}activeIndex(){return this.itemIndex(Math.ceil(this.containerScrollPosition))}itemIndex(i){return this.rowHeightService?this.rowHeightService.index(i):0}itemOffset(i){return this.rowHeightService?this.rowHeightService.offset(i):0}isIndexVisible(i){if(!this.rowHeightService)return!1;const t=this.containerScrollPosition,e=t+this.containerOffsetSize,s=this.rowHeightService.offset(i),a=s+this.rowHeightService.height(i);return s>=t&&a<=e}isListScrolled(i){return this.rowHeightService?this.containerScrollPosition!==this.rowHeightService.offset(i):!1}componentDidMount(){const{onMount:i}=this.props;i&&i.call(void 0,this)}render(){(this.lastTotal!==this.props.total||this.lastDirection!==this.direction||this.lastTake!==this.props.take)&&(this.initServices(),this.lastTotal=this.props.total,this.lastDirection=this.direction,this.lastTake=this.props.take);const i=`${(this.rowHeightService?this.rowHeightService.totalHeight():0)+this.props.bottomOffset}`,t=this.direction==="vertical"?{height:`${i}px`}:{width:`${i}px`},e=d.classNames("k-content k-scrollable",{"k-scrollable-horizontal":this.direction==="horizontal"},this.props.className),s=d.classNames("k-scrollable-placeholder",{"k-scrollable-horizontal-placeholder":this.direction==="horizontal"});return o.createElement("div",{ref:a=>{this.scrollContainer=a},onScroll:this.handleScroll,className:e,tabIndex:this.props.tabIndex,role:this.props.role},this.props.children,o.createElement("div",{style:t,className:s}))}};let gt=Ut;gt.propTypes={bottomOffset:n.number.isRequired,className:n.string,direction:n.oneOf(["horizontal","vertical"]),forceScroll:n.bool,itemHeight:n.number,itemWidth:n.number,maxScrollDifference:n.number,onScroll:n.func,onScrollAction:n.func,scrollDuration:n.number,scrollOffsetSize:n.number,skip:n.number.isRequired,tabIndex:n.number,take:n.number.isRequired,topOffset:n.number.isRequired,total:n.number.isRequired,role:n.string},gt.defaultProps={direction:"vertical",forceScroll:!1,scrollOffsetSize:0,maxScrollDifference:100,scrollDuration:100};const is=(i,t)=>{const e=Object.getOwnPropertyNames(i),s=Object.getOwnPropertyNames(t);if(e.length!==s.length)return!1;for(let a=0;a<e.length;a++){const r=e[a];if(i[r]!==t[r])return!1}return!0};class $e extends o.Component{constructor(){super(...arguments),this.handleClick=t=>{const{onClick:e,value:s}=this.props;e&&e.call(void 0,s,t)},this.handleMouseEnter=()=>{const{onMouseEnter:t,value:e}=this.props;t&&t.call(void 0,e)},this.handleMouseLeave=()=>{const{onMouseLeave:t,value:e}=this.props;t&&t.call(void 0,e)}}shouldComponentUpdate(t){const{value:e,...s}=this.props,{value:a,...r}=t;return!((!(e&&a)||e.getTime()===a.getTime())&&is(s,r))}render(){const{className:t,formattedValue:e,isWeekend:s,isFocused:a,isInRange:r,isSelected:h,isRangeStart:u,isRangeMid:c,isRangeEnd:m,isRangeSplitStart:f,isRangeSplitEnd:g,isToday:w,isDisabled:v,view:E,value:O,...N}=this.props,S=this.props.activeRangeEnd==="end"&&m,y=this.props.activeRangeEnd==="start"&&u,b=d.classNames("k-calendar-td",{"k-range-end":m,"k-range-mid":c,"k-range-split-end":g,"k-range-split-start":f,"k-range-start":u,"k-active":y||S,"k-state-pending-focus":a,"k-selected":h||u||m,"k-today":w,"k-weekend":s,"k-disabled":v},t);return o.createElement("td",{...N,className:b,onClick:this.handleClick,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave},o.createElement("span",{className:"k-link"},this.props.children))}}class Te extends o.Component{render(){const{className:t,firstDate:e,...s}=this.props;return o.createElement("td",{className:d.classNames("k-calendar-td",t),...s},this.props.children)}}var D=(i=>(i[i.Left=0]="Left",i[i.Right=1]="Right",i[i.Up=2]="Up",i[i.Down=3]="Down",i[i.PrevView=4]="PrevView",i[i.NextView=5]="NextView",i[i.FirstInView=6]="FirstInView",i[i.LastInView=7]="LastInView",i[i.LowerView=8]="LowerView",i[i.UpperView=9]="UpperView",i))(D||{}),C=(i=>(i[i.month=0]="month",i[i.year=1]="year",i[i.decade=2]="decade",i[i.century=3]="century",i))(C||{});const q={start:null,end:null};function et(i){const t=(s,a,r,...h)=>a[r]===null?null:(s?i.isRequired:i)(a,r,...h),e=t.bind(null,!1);return e.isRequired=t.bind(null,!0),e}const Yt=(i,t,e)=>t===void 0||e===void 0||t<=i&&i<=e?i:i<t?t:e,B=new Date(1980,0,1),it=new Date(1900,0,1),st=new Date(2099,11,31),ct=new Date(1980,0,1),nt=new Date(1980,0,1,23,59,59),R=(i,t)=>{const e=l.cloneDate(i);return e.setHours(t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()),e},z=()=>l.getDate(new Date),A=(i,t,e)=>!i||!(t&&t>i||e&&e<i),je=(i,t,e)=>i===null||!(t&&l.getDate(t)>l.getDate(i)||e&&l.getDate(e)<l.getDate(i)),$t=(i,t)=>{const{start:e,end:s}=t||q;return!e||!s?!1:e<i&&i<s},T=(i,t,e=1)=>{const s=[];for(let a=i;a<t;a=a+e)s.push(a);return s},Ze=(i,t,e)=>t.getTime()<=i.getTime()&&i.getTime()<=e.getTime(),Ge=(i,t)=>i.slice(t).concat(i.slice(0,t)),Y=(i,t,e)=>i&&(t&&i<t?l.cloneDate(t):e&&i>e?l.cloneDate(e):i),$=i=>(t,e="",s={})=>{const a=document.createElement(i);return a.className=e,Object.keys(s).map(r=>a.style[r]=s[r]),typeof t=="string"?a.innerHTML=t||"":(t||[]).forEach(r=>r&&a.appendChild(r)),a};function ss(i,t,e={}){let s,a;e.maxWait;let r,h,u;const c=window;let m=!1,f=!1;const g=!t&&t!==0&&typeof c.requestAnimationFrame=="function";if(typeof i!="function")throw new TypeError("Expected a function");t=+t||0;function w(V){const _=s,tt=a;return s=a=void 0,r=i.apply(tt,_),r}function v(V,_){return g?(c.cancelAnimationFrame(h),c.requestAnimationFrame(V)):setTimeout(V,_)}function E(V){if(g)return c.cancelAnimationFrame(V);clearTimeout(V)}function O(V){return h=v(y,t),m?w():r}function N(V){const _=V-u;return t-_}function S(V){const _=V-u;return u===void 0||_>=t||_<0||f}function y(){const V=Date.now();if(S(V))return b();h=v(y,N(V))}function b(V){return h=void 0,s?w():(s=a=void 0,r)}function K(){h!==void 0&&E(h),s=u=a=h=void 0}function M(){return h===void 0?r:b()}function F(){return h!==void 0}function U(...V){const _=Date.now(),tt=S(_);return s=V,a=this,u=_,tt&&h===void 0?O():(h===void 0&&(h=v(y,t)),r)}return U.cancel=K,U.flush=M,U.pending=F,U}const ns=[[]],oe=4,as=3,rs={[D.Left]:i=>l.addDecades(i,-1),[D.Up]:i=>l.addDecades(i,-5),[D.Right]:i=>l.addDecades(i,1),[D.Down]:i=>l.addDecades(i,5),[D.PrevView]:i=>l.addCenturies(i,-1),[D.NextView]:i=>l.addCenturies(i,1),[D.FirstInView]:i=>l.firstDecadeOfCentury(i),[D.LastInView]:i=>l.lastDecadeOfCentury(i)};class Xe{addToDate(t,e){return l.addCenturies(t,e)}datesList(t,e){return T(0,e).map(s=>l.addCenturies(t,s))}data(t){const{cellUID:e,focusedDate:s,isActiveView:a,max:r,min:h,selectedDate:u,selectionRange:c=q,viewDate:m}=t;if(!m)return ns;const f=T(0,oe),g=l.firstDecadeOfCentury(m),w=l.lastDecadeOfCentury(m),v=z();return T(0,as).map(E=>{const O=l.addDecades(g,E*oe);return f.map(N=>{const S=this.normalize(l.addDecades(O,N),h,r),y=this.isEqual(S,c.start),b=this.isEqual(S,c.end),M=!y&&!b&&$t(S,c),F=a&&(Array.isArray(u)?this.isSelectedFromArray(S,u,h,r):A(u,h,r)&&this.isEqual(S,u));return Ze(S,g,w)?{formattedValue:this.value(S),id:`${e}${S.getTime()}`,isFocused:this.isEqual(S,s),isSelected:F,isWeekend:!1,isInRange:A(S,h,r),isRangeStart:y,isRangeMid:M,isRangeEnd:b,isRangeSplitEnd:M&&this.isEqual(S,w),isRangeSplitStart:M&&this.isEqual(S,g),isToday:this.isEqual(S,v),title:this.cellTitle(S),value:S}:null})})}isSelectedFromArray(t,e,s,a){let r=!1;return e.forEach(h=>{A(t,s,a)&&this.isEqual(t,h)&&(r=!0)}),r}isEqual(t,e){return!t||!e?!1:l.firstYearOfDecade(t).getFullYear()===l.firstYearOfDecade(e).getFullYear()}isInArray(t,e){if(!e.length)return!1;const s=t.getFullYear();return e[0].getFullYear()<=s&&s<=e[e.length-1].getFullYear()+99}isInRange(t,e,s){const a=l.firstYearOfDecade(t).getFullYear(),r=!e||l.firstYearOfDecade(e).getFullYear()<=a,h=!s||a<=l.firstYearOfDecade(s).getFullYear();return r&&h}isInSameView(t,e){return l.durationInCenturies(t,e)===0}isRangeStart(t){return t.getFullYear()%1e3===0}move(t,e){const s=rs[e];return s?s(t):t}cellTitle(t){return l.firstYearOfDecade(t).getFullYear().toString()}navigationTitle(t){return t?l.firstDecadeOfCentury(t).getFullYear().toString():""}title(t){return t?`${l.firstDecadeOfCentury(t).getFullYear()} - ${l.lastDecadeOfCentury(t).getFullYear()}`:""}rowLength(t){return oe}skip(t,e){return l.durationInCenturies(e,t)}total(t,e){return l.durationInCenturies(t,e)+1}value(t){return t?l.firstYearOfDecade(t).getFullYear().toString():""}viewDate(t,e,s=1){return l.durationInCenturies(t,e)<s?l.addCenturies(t,-1):t}normalize(t,e,s){return t<e&&this.isEqual(t,e)?l.cloneDate(e):t>s&&this.isEqual(t,s)?l.cloneDate(s):t}}const ls=[[]],he=4,os=3,hs={[D.Left]:i=>l.addYears(i,-1),[D.Up]:i=>l.addYears(i,-5),[D.Right]:i=>l.addYears(i,1),[D.Down]:i=>l.addYears(i,5),[D.PrevView]:i=>l.addDecades(i,-1),[D.NextView]:i=>l.addDecades(i,1),[D.FirstInView]:i=>l.firstYearOfDecade(i),[D.LastInView]:i=>l.lastYearOfDecade(i)};class Je{addToDate(t,e){return l.addDecades(t,e)}datesList(t,e){return T(0,e).map(s=>l.addDecades(t,s))}data(t){const{cellUID:e,focusedDate:s,isActiveView:a,max:r,min:h,selectedDate:u,selectionRange:c=q,viewDate:m}=t;if(!m)return ls;const f=T(0,he),g=l.firstYearOfDecade(m),w=l.lastYearOfDecade(m),v=z();return T(0,os).map(E=>{const O=l.addYears(g,E*he);return f.map(N=>{const S=this.normalize(l.addYears(O,N),h,r),y=this.isEqual(S,c.start),b=this.isEqual(S,c.end),M=!y&&!b&&$t(S,c),F=a&&(Array.isArray(u)?this.isSelectedFromArray(S,u,h,r):A(u,h,r)&&this.isEqual(S,u));return Ze(S,g,w)?{formattedValue:this.value(S),id:`${e}${S.getTime()}`,isFocused:this.isEqual(S,s),isSelected:F,isWeekend:!1,isInRange:A(S,h,r),isRangeStart:y,isRangeMid:M,isRangeEnd:b,isRangeSplitEnd:M&&this.isEqual(S,w),isRangeSplitStart:M&&this.isEqual(S,g),isToday:this.isEqual(S,v),title:this.cellTitle(S),value:S}:null})})}isSelectedFromArray(t,e,s,a){let r=!1;return e.forEach(h=>{A(t,s,a)&&this.isEqual(t,h)&&(r=!0)}),r}isEqual(t,e){return!t||!e?!1:t.getFullYear()===e.getFullYear()}isInArray(t,e){if(!e.length)return!1;const s=t.getFullYear();return e[0].getFullYear()<=s&&s<=e[e.length-1].getFullYear()+9}isInRange(t,e,s){const a=t.getFullYear(),r=!e||e.getFullYear()<=a,h=!s||a<=s.getFullYear();return r&&h}isRangeStart(t){return t.getFullYear()%100===0}isInSameView(t,e){return l.durationInDecades(t,e)===0}move(t,e){const s=hs[e];return s?s(t):t}cellTitle(t){return t.getFullYear().toString()}navigationTitle(t){return t?l.firstYearOfDecade(t).getFullYear().toString():""}title(t){return t?`${l.firstYearOfDecade(t).getFullYear()} - ${l.lastYearOfDecade(t).getFullYear()}`:""}rowLength(t){return he}skip(t,e){return l.durationInDecades(e,t)}total(t,e){return l.durationInDecades(t,e)+1}value(t){return t?t.getFullYear().toString():""}viewDate(t,e,s=1){return l.durationInDecades(t,e)<s?l.addDecades(t,-1):t}normalize(t,e,s){return t<e&&this.isEqual(t,e)?l.cloneDate(e):t>s&&this.isEqual(t,s)?l.cloneDate(s):t}}const cs=[[]],ce=7,us=6,ds=6,ms=0,ps={[D.Left]:i=>l.addDays(i,-1),[D.Up]:i=>l.addWeeks(i,-1),[D.Right]:i=>l.addDays(i,1),[D.Down]:i=>l.addWeeks(i,1),[D.PrevView]:i=>l.addMonths(i,-1),[D.NextView]:i=>l.addMonths(i,1),[D.FirstInView]:i=>l.firstDayOfMonth(i),[D.LastInView]:i=>l.lastDayOfMonth(i)};class Qe{constructor(t){this.intl=t}addToDate(t,e){return l.addMonths(t,e)}datesList(t,e){return T(0,e).map(s=>l.addMonths(t,s))}data(t){const{cellUID:e,focusedDate:s,isActiveView:a,max:r,min:h,selectedDate:u,selectionRange:c=q,viewDate:m}=t;if(!m)return cs;const f=l.firstDayOfMonth(m),g=l.lastDayOfMonth(m),w=-1,v=l.dayOfWeek(f,this.intl.firstDay(),w),E=T(0,ce),O=z();return T(0,us).map(N=>{const S=l.addDays(v,N*ce);return E.map(y=>{const b=this.normalize(l.addDays(S,y),h,r);if(b<f||b>g)return null;const M=this.isEqual(b,c.start),F=this.isEqual(b,c.end),V=!M&&!F&&$t(b,c),_=a&&(Array.isArray(u)?this.isSelectedFromArray(b,u,h,r):A(u,h,r)&&this.isEqual(b,u));return{formattedValue:this.value(b),id:`${e}${b.getTime()}`,isFocused:this.isEqual(b,s),isSelected:_,isInRange:A(b,h,r),isWeekend:this.isWeekend(b),isRangeStart:M,isRangeMid:V,isRangeEnd:F,isRangeSplitStart:V&&this.isEqual(b,f),isRangeSplitEnd:V&&this.isEqual(b,g),isToday:this.isEqual(b,O),title:this.cellTitle(b),value:b}})})}isEqual(t,e){return!t||!e?!1:l.getDate(t).getTime()===l.getDate(e).getTime()}isSelectedFromArray(t,e,s,a){let r=!1;return e.forEach(h=>{A(t,s,a)&&this.isEqual(t,h)&&(r=!0)}),r}isInArray(t,e){return!!e.length&&l.firstDayOfMonth(e[0])<=t&&t<=l.lastDayOfMonth(e[e.length-1])}isInRange(t,e,s){const a=l.getDate(t),r=!e||l.getDate(e)<=a,h=!s||a<=l.getDate(s);return r&&h}isInSameView(t,e){return l.durationInMonths(t,e)===0}isRangeStart(t){return!t.getMonth()}move(t,e){const s=ps[e];return s?s(t):t}cellTitle(t){return this.intl.formatDate(t,"D")}navigationTitle(t){return t?this.isRangeStart(t)?t.getFullYear().toString():this.abbrMonthNames()[t.getMonth()]:""}title(t){return`${this.wideMonthNames()[t.getMonth()]} ${t.getFullYear()}`}rowLength(t){return ce+(t?1:0)}skip(t,e){return l.durationInMonths(e,t)}total(t,e){return l.durationInMonths(t,e)+1}value(t){return t?t.getDate().toString():""}viewDate(t,e,s=1){return l.durationInMonths(t,e)<s?l.addMonths(t,-1):t}isWeekend(t){const e=t.getDay();return e===ds||e===ms}abbrMonthNames(){return this.intl.dateFormatNames({nameType:"abbreviated",type:"months"})}normalize(t,e,s){return t<e&&this.isEqual(t,e)?l.getDate(e):t>s&&this.isEqual(t,s)?l.getDate(s):t}wideMonthNames(){return this.intl.dateFormatNames({nameType:"wide",type:"months",standAlone:!0})}}const fs=[[]],ue=4,gs=3,vs=i=>i>4?-5:i<2?-2:-7,ws=i=>i<7?5:i<10?7:2,bs={[D.Left]:i=>l.addMonths(i,-1),[D.Up]:i=>l.addMonths(i,vs(i.getMonth())),[D.Right]:i=>l.addMonths(i,1),[D.Down]:i=>l.addMonths(i,ws(i.getMonth())),[D.PrevView]:i=>l.addYears(i,-1),[D.NextView]:i=>l.addYears(i,1),[D.FirstInView]:i=>l.firstMonthOfYear(i),[D.LastInView]:i=>l.lastMonthOfYear(i)};class Pe{constructor(t){this._intl=t}addToDate(t,e){return l.addYears(t,e)}datesList(t,e){return T(0,e).map(s=>l.addYears(t,s))}data(t){const{cellUID:e,focusedDate:s,isActiveView:a,max:r,min:h,selectedDate:u,selectionRange:c=q,viewDate:m}=t;if(!m)return fs;const f=this.abbrMonthNames(),g=l.firstMonthOfYear(m),w=l.lastMonthOfYear(m),v=g.getFullYear(),E=T(0,ue),O=z();return T(0,gs).map(N=>{const S=l.addMonths(g,N*ue);return E.map(y=>{const b=this.normalize(l.addMonths(S,y),h,r);if(v<b.getFullYear())return null;const M=this.isEqual(b,c.start),F=this.isEqual(b,c.end),V=!M&&!F&&$t(b,c),_=a&&(Array.isArray(u)?this.isSelectedFromArray(b,u,h,r):A(u,h,r)&&this.isEqual(b,u));return{formattedValue:f[b.getMonth()],id:`${e}${b.getTime()}`,isFocused:this.isEqual(b,s),isSelected:_,isInRange:A(b,h,r),isWeekend:!1,isRangeStart:M,isRangeMid:V,isRangeEnd:F,isRangeSplitEnd:V&&this.isEqual(b,w),isRangeSplitStart:V&&this.isEqual(b,g),isToday:this.isEqual(b,O),title:this.cellTitle(b),value:b}})})}isSelectedFromArray(t,e,s,a){let r=!1;return e.forEach(h=>{A(t,s,a)&&this.isEqual(t,h)&&(r=!0)}),r}isEqual(t,e){return!t||!e?!1:t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()}isInArray(t,e){if(!e.length)return!1;const s=t.getFullYear();return e[0].getFullYear()<=s&&s<=e[e.length-1].getFullYear()}isInRange(t,e,s){const a=l.createDate(t.getFullYear(),t.getMonth(),1),r=!e||l.createDate(e.getFullYear(),e.getMonth(),1)<=a,h=!s||a<=l.createDate(s.getFullYear(),s.getMonth(),1);return r&&h}isInSameView(t,e){return l.durationInYears(t,e)===0}isRangeStart(t){return t.getFullYear()%10===0}move(t,e){const s=bs[e];return s?s(t):t}cellTitle(t){return`${t.getFullYear()} ${this.value(t)}`}navigationTitle(t){return this.title(t)}title(t){return t?t.getFullYear().toString():""}rowLength(t){return ue}skip(t,e){return l.durationInYears(e,t)}total(t,e){return l.durationInYears(t,e)+1}value(t){return t?this.abbrMonthNames()[t.getMonth()]:""}viewDate(t,e,s=1){return l.durationInYears(t,e)<s?l.addYears(t,-1):t}abbrMonthNames(){return this._intl.dateFormatNames({nameType:"abbreviated",type:"months"})}normalize(t,e,s){return t<e&&this.isEqual(t,e)?l.cloneDate(e):t>s&&this.isEqual(t,s)?l.cloneDate(s):t}}const Ss={[C.month]:Qe,[C.year]:Pe,[C.decade]:Je,[C.century]:Xe},Ds=(i,t)=>{const e=C[C[i+t]];return e!==void 0?e:i};class de{constructor(t){this.bottom=C.month,this.top=C.century,this.onViewChanged=t}configure(t,e){this.bottom=t,this.top=e}service(t,e){return new Ss[`${t}`](e)}moveDown(t,e){this.move(t,-1,e)}moveUp(t,e){this.move(t,1,e)}moveToBottom(t){t!==this.bottom&&this.onViewChanged({view:this.bottom})}canMoveDown(t){return this.bottom<t}canMoveUp(t){return t<this.top}clamp(t){return t<this.bottom?this.bottom:t>this.top?this.top:t}move(t,e,s){const a=this.clamp(Ds(t,e));a!==t&&this.onViewChanged({view:a},s)}}let ti=class{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(){this.calendarHeight===void 0&&this.calculateHeights()}calculateHeights(t){if(!d.canUseDOM)return;const e=$("div"),s=$("ul"),a=$("li"),r=$("td"),h=$("th"),u=$("tr"),c=$("tbody"),m=$("thead"),f=$("table"),g=()=>e(`
|
|
6
6
|
<span class="k-button k-button-md k-button-rectangle k-button-solid k-button-solid-base k-button-flat k-calendar-title">
|
|
7
7
|
<span className="k-button-text">March 2017</span>
|
|
8
8
|
</span>
|
|
9
9
|
<span class="k-spacer"></span>
|
|
10
10
|
<span class="k-calendar-nav k-hstack"><button class="k-calendar-nav-today">TODAY</button></span>
|
|
11
|
-
`,"k-calendar-header k-hstack"),w=()=>f([m([u([h("MO","k-calendar-th")],"k-calendar-tr")],"k-calendar-thead")],"k-calendar-table k-calendar-weekdays"),v=(I,H)=>new Array(I).fill("1").map(H),E=(I,H=1)=>f([c([u([r("1","k-calendar-td k-alt")])].concat(v(I,()=>u(v(H,_t=>r(`<span class="k-link">${_t}</span>`,"k-calendar-td")),"k-calendar-tr"))),"k-calendar-tbody")],"k-calendar-table"),V=I=>e(I,"k-content k-scrollable"),N=(I,H,_t)=>e(_t?[g(),w(),V([I,I])]:[g(),V([I,I])],H,{left:"-10000px",position:"absolute"}),S=(()=>{let I;return()=>d.canUseDOM?(I||(I=e([V([s([a("<span>FEB</span>")])])],"k-calendar-navigation",{left:"0px",position:"absolute"})),I):null})(),y=({cells:I,rows:H},_t,fn)=>{let Ue;return()=>d.canUseDOM?(Ue||(Ue=N(E(H,I),_t,fn)),Ue):null},b=I=>I.querySelector(".k-scrollable"),K=I=>{const H=b(I);return H.className=`${H.className} k-scrollable-horizontal`,I},M=y({cells:7,rows:6},"k-calendar-view k-calendar-monthview k-vstack",!0),F=y({cells:5,rows:3},"k-calendar-view k-calendar-yearview",!1),U=y({cells:5,rows:2},"k-calendar-view k-calendar-decadeview",!1),O=()=>K(M()),_=()=>K(F()),tt=()=>K(U()),X=I=>parseFloat(window.getComputedStyle(I).height)||I.offsetHeight,pt=I=>{const H=window.getComputedStyle(I);return parseFloat(H.width)+parseFloat(H.paddingLeft)+parseFloat(H.paddingRight)||I.offsetWidth},Mt=I=>I.querySelector("tbody");this.didCalculate=!0,t&&(this.hostContainer=t),this.batch(M(),I=>{const H=Mt(I);this.calendarHeight=X(I),this.monthViewHeight=X(H),this.headerHeight=X(H.children[0]),this.scrollableContentHeight=X(b(I))}),this.batch(O(),I=>{const H=Mt(I);this.calendarWidth=pt(I),this.monthViewWidth=pt(H),this.scrollableContentWidth=pt(b(I))}),this.batch(F(),I=>{this.yearViewHeight=X(Mt(I)),this.scrollableYearContentHeight=X(b(I))}),this.batch(_(),I=>{this.yearViewWidth=pt(Mt(I))}),this.batch(U(),I=>{this.decadeViewHeight=X(Mt(I)),this.centuryViewHeight=this.decadeViewHeight}),this.batch(tt(),I=>{this.decadeViewWidth=pt(Mt(I)),this.centuryViewWidth=this.decadeViewWidth}),this.batch(S(),I=>{this.navigationItemHeight=X(I.querySelector("li"))})}viewHeight(t){return this.viewDimension(t,"height")}viewWidth(t){return this.viewDimension(t,"width")}viewDimension(t,e){const s=e==="height"?"ViewHeight":"ViewWidth";switch(t){case C.month:return this[`month${s}`];case C.year:return this[`year${s}`];case C.decade:return this[`decade${s}`];case C.century:return this[`century${s}`];default:return 1}}batch(t,e){const s=this.hostContainer||document.body,a=s.appendChild(t);e(a),s.removeChild(a)}};const Is={33:D.PrevView,34:D.NextView,35:D.LastInView,36:D.FirstInView,37:D.Left,38:D.Up,39:D.Right,40:D.Down,"meta+38":D.UpperView,"meta+40":D.LowerView};class me{constructor(t){this.bus=t}action(t){const e=`${t.ctrlKey||t.metaKey?"meta+":""}${t.keyCode}`;return Is[e]}move(t,e,s,a,r){return a?e===D.UpperView&&this.bus.canMoveUp(s)?(this.bus.moveUp(s,r),t):e===D.LowerView&&this.bus.canMoveDown(s)?(this.bus.moveDown(s,r),t):a.move(t,e):t}}const xs=i=>t=>Math.floor(t/i),Cs=i=>t=>t*i;class ei{constructor(t){this.dom=t,this.divideByMagnitude=null,this.powerByMagnitude=null,this.navigator=null,this.view=null,this.monthScrolled=!1,this.navScrolled=!1}configure(t){const e=Math.max(this.dom.viewHeight(t)/this.dom.navigationItemHeight,1);this.divideByMagnitude=xs(e),this.powerByMagnitude=Cs(e)}sync(t,e,s){if(!(!t||!e)){if(this.navigator=t,this.view=e,s.target===this.navigator.element){if(this.monthScrolled){this.monthScrolled=!1;return}this.navScrolled=!0,this.scrollSiblingOf(this.navigator.element)}if(s.target===this.view.element){if(this.navScrolled){this.navScrolled=!1;return}this.monthScrolled=!0,this.scrollSiblingOf(this.view.element)}}}scrollSiblingOf(t){const e=this.siblingComponent(t),s=this.calculateScroll(e,t.scrollTop);e.scrollTo(s)}siblingComponent(t){return this.navigator.element===t?this.view:this.navigator}calculateScroll(t,e){const s=t===this.navigator?this.divideByMagnitude:this.powerByMagnitude;return s?s(e):0}}class ii{constructor(t){this.intl=t}getWeekNames(t=!1){const e=Ge(this.intl.dateFormatNames({nameType:"short",type:"days"}),this.intl.firstDay());return t?[""].concat(e):e}}const si=i=>o.createElement("td",{key:i,className:"k-calendar-td"}," "),ni=class extends o.Component{constructor(){super(...arguments),this.intl=null,this.weekService=null,this.buildWeekNumber=(i,t)=>{if(!this.firstDate(i))return si(`week-cell-${t}`);const s=this.firstDate(i),a=this.getWeekNumber(s),r=`kendo-react-calendar-week-cell-${a}`,h={className:"k-alt",value:a,firstDate:s};return this.props.weekCell?o.createElement(this.props.weekCell,{...h,key:r},a):o.createElement(Te,{...h,key:r},a)},this.buildRow=i=>i.map((t,e)=>{if(!t)return si(e);const s={"aria-selected":t.isSelected},a=`kendo-react-calendar-cell-${t.value.getTime()}`,r={...s,...t,isDisabled:!t.isInRange,view:this.props.activeView,onClick:this.handleClick,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave};return this.props.cell?o.createElement(this.props.cell,{...r,key:a},t.formattedValue):o.createElement($e,{...r,key:a},t.formattedValue)}),this.firstDate=i=>{const t=this.firstWeekDateContext(i);return t?t.value:null},this.firstWeekDateContext=i=>{if(!this.weekNumber)return null;let t=0,e=i[t];for(;!e&&t<i.length;)e=i[++t];return e},this.handleClick=(i,t)=>{const{onChange:e}=this.props;if(e&&t){const s={value:l.cloneDate(i),target:this,nativeEvent:t&&t.nativeEvent,syntheticEvent:t};e.call(void 0,s)}},this.handleMouseEnter=i=>{const{onCellEnter:t}=this.props;t&&t.call(void 0,l.cloneDate(i))},this.handleMouseLeave=i=>{const{onCellLeave:t}=this.props;t&&t.call(void 0,l.cloneDate(i))}}get min(){return this.props.min}get max(){return this.props.max}get isHorizontal(){return this.props.direction==="horizontal"}get isMonthView(){return this.props.activeView===C.month}get weekNumber(){return!!(this.props.showWeekNumbers&&this.props.activeView===C.month)}get selectedDate(){return this.props.selectedDate!==void 0?this.props.selectedDate:ni.defaultProps.selectedDate}render(){this.intl=x.provideIntlService(this),this.weekService=new ii(this.intl);const i=this.weekService.getWeekNames(this.weekNumber),t=this.props.service.rowLength(this.weekNumber),e=this.props.service.title(this.props.viewDate),s=z(),a=R(this.props.viewDate,s),r=this.props.service.data({cellUID:this.props.cellUID,min:this.min,max:this.max,focusedDate:this.props.focusedDate,isActiveView:!this.props.bus.canMoveDown(this.props.activeView),selectedDate:this.selectedDate,selectionRange:this.props.selectionRange,viewDate:a});return o.createElement(o.Fragment,null,this.isMonthView&&this.isHorizontal&&o.createElement("thead",{role:"rowgroup",className:"k-calendar-thead"},o.createElement("tr",{role:"row",className:"k-calendar-tr"},i.map((h,u)=>o.createElement("th",{key:u,className:"k-calendar-th"},h)))),o.createElement("tbody",{role:"rowgroup",className:"k-calendar-tbody"},!this.isHorizontal&&o.createElement("tr",{role:"presentation",className:"k-calendar-tr"},o.createElement("th",{scope:"col",colSpan:t,className:"k-calendar-caption"},e)),r.map((h,u)=>o.createElement("tr",{role:"row",className:"k-calendar-tr",key:u},this.weekNumber&&this.buildWeekNumber(h,u),this.buildRow(h)))))}getWeekNumber(i){return!this.weekNumber||!this.intl?null:l.weekInYear(i,this.intl.firstDay())}};let Lt=ni;Lt.propTypes={activeRangeEnd:n.oneOf(["start","end",null]),activeView:n.number.isRequired,cellUID:n.string.isRequired,direction:n.oneOf(["horizontal","vertical"]),focusedDate:n.instanceOf(Date).isRequired,max:n.instanceOf(Date).isRequired,min:n.instanceOf(Date).isRequired,onChange:n.func,selectedDate:n.oneOfType([n.instanceOf(Date),n.arrayOf(n.instanceOf(Date))]),showWeekNumbers:n.bool,viewDate:n.instanceOf(Date).isRequired},Lt.defaultProps={direction:"vertical",selectedDate:z(),showWeekNumbers:!1},x.registerForIntl(Lt);class ai extends o.PureComponent{render(){const{view:t,...e}=this.props;return o.createElement(L.Button,{type:"button",fillMode:"flat",...e},this.props.children)}}const Tt=class extends o.Component{constructor(){super(...arguments),this.getTitle=()=>{if(!this.props.currentDate)return"";const i=this.rangeLength-1,t=this.props.service.title(this.props.currentDate),e=this.props.service.addToDate(this.props.currentDate,i);return i<1||!this.props.service.isInRange(e,this.min,this.max)?t:`${t} - ${this.props.service.title(e)}`},this.handleTitleClick=i=>{this.canMoveUp&&this.props.bus.moveUp(this.props.activeView,i)}}get min(){return this.props.min!==void 0?this.props.min:Tt.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:Tt.defaultProps.max}get rangeLength(){return this.props.rangeLength!==void 0?this.props.rangeLength:Tt.defaultProps.rangeLength}get canMoveUp(){return this.props.bus.canMoveUp(this.props.activeView)}render(){const i=this.getTitle(),t=d.classNames("k-calendar-title"),e={children:i,value:i,view:this.props.activeView,className:t,onClick:this.handleTitleClick,disabled:!this.canMoveUp},s=this.props.headerTitle?o.createElement(this.props.headerTitle,{...e},i):o.createElement(ai,{...e},i);return o.createElement("div",{className:d.classNames("k-calendar-header",{"k-vstack":this.props.verticalView,"k-hstack":!this.props.verticalView})},s,o.createElement("span",{className:"k-spacer"}),o.createElement("span",{className:"k-calendar-nav k-hstack"},this.props.commands))}};let vt=Tt;vt.propTypes={activeView:n.number.isRequired,currentDate:n.instanceOf(Date).isRequired,max:n.instanceOf(Date).isRequired,min:n.instanceOf(Date).isRequired,rangeLength:n.number},vt.defaultProps={rangeLength:1,min:it,max:st},x.registerForLocalization(vt);const pe="multiviewcalendar.prevView",fe="multiviewcalendar.nextView",wt="dateinput.increment",bt="dateinput.decrement",jt="calendar.today",Zt="datepicker.toggleCalendar",St="daterangepicker.swapStartEnd",Gt="daterangepicker.start",Xt="daterangepicker.end",Jt="daterangepicker.separator",Dt="datetimepicker.toggleDateTimeSelector",ge="timepicker.now",ve="timepicker.selectNow",Qt="timepicker.cancel",At="timepicker.set",we="timepicker.toggleTimeSelector",Pt="timepicker.toggleClock",be="datetimepicker.date",Se="datetimepicker.time",Ht="datetimepicker.cancel",Bt="datetimepicker.set",De="daterangepicker.cancel",Ie="daterangepicker.set",k={[jt]:"TODAY",[ge]:"NOW",[At]:"Set",[Qt]:"Cancel",[be]:"Date",[Se]:"Time",[Ht]:"Cancel",[Bt]:"Set",[De]:"Cancel",[Ie]:"Set",[Gt]:"Start",[Xt]:"End",[Jt]:" ",[ve]:"Select Now",[we]:"Toggle TimeSelector",[Pt]:"Toggle Clock",[wt]:"Increase value",[bt]:"Decrease value",[Zt]:"Toggle calendar",[pe]:"Navigate to previous view",[fe]:"Navigate to next view",[St]:"Swap start and end values",[Dt]:"Toggle date-time selector"},xe=class extends o.Component{constructor(){super(...arguments),this.localization=null,this.handleClick=i=>{if(this.todayIsInRange&&this.props.onClick){const t={syntheticEvent:i,nativeEvent:i.nativeEvent,value:Y(z(),this.min,this.max),target:this,isTodayClick:!0};this.props.onClick.call(void 0,t)}}}get min(){return this.props.min!==void 0?this.props.min:xe.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:xe.defaultProps.max}get todayIsInRange(){return A(z(),l.getDate(this.min),l.getDate(this.max))}render(){this.localization=x.provideLocalizationService(this);const i=this.localization.toLanguageString(jt,k[jt]),t=d.classNames("k-calendar-nav-today",{"k-disabled":this.props.disabled});return o.createElement(L.Button,{className:t,onClick:this.handleClick,tabIndex:this.props.tabIndex,fillMode:"flat"},i)}};let It=xe;It.propTypes={max:n.instanceOf(Date).isRequired,min:n.instanceOf(Date).isRequired,onClick:n.func,disabled:n.bool},It.defaultProps={min:it,max:st},x.registerForLocalization(It);const Es=5,ri=class extends o.Component{constructor(i){super(i),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.focusActiveDate=()=>{if(!this._element)return;const t=this._element.querySelector("td.k-focus"),e=this._element.querySelector(".k-state-pending-focus");t&&t[0]&&t[0].classList.remove("k-focus"),e&&e.classList.add("k-focus"),this.isActive=!0},this.blurActiveDate=()=>{if(!this._element)return;const t=this._element.querySelector("td.k-focus");t&&t.classList.remove("k-focus"),this.isActive=!1},this.handleVirtualizationMount=t=>{if(this.virtualization=t,this.virtualization&&this.table){this.table.style.transform=`translateY(${this.viewOffset}px)`;const e=Y(this.props.focusedDate,this.props.min,this.props.max),s=this.props.service.skip(e,this.props.min);this.virtualization.scrollToIndex(s)}},this.buildMonthView=(t,e)=>o.createElement("table",{key:"calendar-view-list-weekdays",className:"k-calendar-table k-calendar-weekdays",role:"grid",tabIndex:this.props.tabIndex},o.createElement("colgroup",null,t.map((s,a)=>o.createElement("col",{key:a}))),o.createElement("thead",{className:"k-calendar-thead"},o.createElement("tr",{className:"k-calendar-tr"},e.map((s,a)=>o.createElement("th",{key:a,className:"k-calendar-th"},s))))),this.buildDates=(t,e)=>{const s=this.props.cellUID;return o.createElement("table",{className:"k-calendar-table",ref:a=>this.table=a,role:"grid",tabIndex:this.props.tabIndex,"aria-activedescendant":s+this.props.focusedDate.getTime()},o.createElement("colgroup",null,t.map((a,r)=>o.createElement("col",{key:r}))),e.map(a=>o.createElement(Lt,{ref:r=>{this.calendarView||(this.calendarView=r)},key:a.getTime(),activeView:this.props.activeView,viewDate:a,min:this.props.min,max:this.props.max,cellUID:s,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})))},this.calculateHeights=()=>{if(!this.props.dom)return;const t=this.props.activeView===C.month?this.props.dom.scrollableContentHeight:this.props.dom.scrollableYearContentHeight;this.bottomOffset=t-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=(t,e)=>Math.min(e-t,this.take),this.handleScrollAction=({index:t,scrollAction:e,pageAction:s})=>{const a=s?s.skip:this.state.skip;if((this.state.index!==t||this.state.skip!==a)&&this.setState({index:t,skip:a}),this.table&&e){const r=`translateY(${e.offset}px)`;this.table.style.transform=r}},this.handleTodayClick=t=>{this.shouldScroll=!0,this.handleDateChange.call(void 0,t,!0)},this.handleDateChange=(t,e=!1)=>{const{onChange:s}=this.props;if(s){const a={syntheticEvent:t.syntheticEvent,nativeEvent:t.nativeEvent,value:l.cloneDate(t.value),target:this,isTodayClick:e};s.call(void 0,a)}},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(){this.intl=x.provideIntlService(this);const i=Ge(this.intl.dateFormatNames({nameType:"short",type:"days"}),this.intl.firstDay());return this.weekNumber?[""].concat(i):i}get weekNumber(){return!!(this.props.showWeekNumbers&&this.props.activeView===C.month)}get take(){return this.props.take!==void 0?this.props.take:ri.defaultProps.take}get animate(){return!!(this.props.smoothScroll&&this.animateToIndex)}get todayIsInRange(){return A(z(),l.getDate(this.props.min),l.getDate(this.props.max))}componentDidUpdate(i,t){this.shouldScroll=!1,this.indexToScroll!==void 0&&this.virtualization&&this.virtualization[this.animate?"animateToIndex":"scrollToIndex"](this.indexToScroll),this.isActive&&this.focusActiveDate(),this.lastView=this.props.activeView,this.indexToScroll=void 0}render(){this.calculateHeights();const i=this.lastView!==this.props.activeView,t=Y(this.props.focusedDate,this.props.min,this.props.max),e=i?this.props.service.skip(t,this.props.min):this.state.skip,s=this.props.service.total(this.props.min,this.props.max),a=this.getTake(e,s),r=this.props.service.addToDate(this.props.min,e),h=this.props.service.addToDate(this.props.min,this.state.index),u=new Array(this.props.service.rowLength(this.weekNumber)).fill(""),c=this.props.activeView!==this.lastView;this.animateToIndex=!c,(c||!l.isEqualDate(this.lastFocus,t)||this.shouldScroll||!this.props.shouldScroll||this.props.shouldScroll())&&(this.indexToScroll=this.props.service.skip(t,this.props.min)),this.lastFocus=t;const m=d.classNames("k-calendar-view k-vstack",{"k-calendar-monthview":this.props.activeView===C.month,"k-calendar-yearview":this.props.activeView===C.year,"k-calendar-decadeview":this.props.activeView===C.decade,"k-calendar-centuryview":this.props.activeView===C.century}),f=this.buildDates(u,this.props.service.datesList(r,a)),g=o.createElement(o.Fragment,null,o.createElement(vt,{key:"calendar-view-list-header",currentDate:h,min:this.props.min,max:this.props.max,activeView:this.props.activeView,bus:this.props.bus,service:this.props.service,headerTitle:this.props.headerTitle,commands:o.createElement(o.Fragment,null,o.createElement(It,{min:this.props.min,max:this.props.max,onClick:this.handleTodayClick,disabled:!this.todayIsInRange,tabIndex:this.props.tabIndex}))}),this.props.activeView===C.month&&this.buildMonthView(u,this.weekNames),o.createElement(gt,{key:"calendar-view-list-content",skip:e,take:this.take,total:s,itemHeight:this.viewHeight,topOffset:this.viewOffset,bottomOffset:this.bottomOffset,scrollOffsetSize:this.viewOffset,maxScrollDifference:this.viewHeight,onScroll:this.props.onScroll,onScrollAction:this.handleScrollAction,onMount:this.handleVirtualizationMount,children:f,tabIndex:this.props.tabIndex}));return o.createElement("div",{ref:w=>{this._element=w},className:m},this.props.dom.didCalculate?g:null)}};let zt=ri;zt.propTypes={activeView:n.number.isRequired,bottomOffset:n.number,cellUID:n.string.isRequired,focusedDate:n.instanceOf(Date).isRequired,max:n.instanceOf(Date).isRequired,min:n.instanceOf(Date).isRequired,onChange:n.func,showWeekNumbers:n.bool,smoothScroll:n.bool,take:n.number,value:n.instanceOf(Date),viewHeight:n.number,viewOffset:n.number,tabIndex:n.number},zt.defaultProps={take:Es,showWeekNumbers:!1,smoothScroll:!0},x.registerForIntl(zt);class li extends o.Component{constructor(){super(...arguments),this.handleClick=t=>{const{onClick:e,value:s}=this.props;e&&e.call(void 0,s,t)}}render(){const{isRangeStart:t,value:e,text:s,...a}=this.props;return o.createElement("li",{...a,onClick:this.handleClick},o.createElement("span",{className:d.classNames({"k-calendar-navigation-marker":t})},this.props.children))}}const Os=30,oi=class extends o.Component{constructor(i){super(i),this.virtualization=null,this.list=null,this.itemHeight=0,this.topOffset=0,this.maxViewHeight=0,this.bottomOffset=0,this.handleVirtualizationMount=s=>{if(this.virtualization=s,this.virtualization&&this.list){this.list.style.transform=`translateY(${this.topOffset}px)`;const a=Y(this.props.focusedDate,this.props.min,this.props.max),r=this.props.service.skip(a,this.props.min);this.virtualization.scrollToIndex(r)}},this.buildNavigationItem=s=>{const a=this.props.service.navigationTitle(s),r=this.props.service.isRangeStart(s),h=`kendo-react-calendar-nav-item-${s.getTime()}`,u={text:a,value:s,isRangeStart:r,view:this.props.activeView,onClick:this.handleDateChange};return this.props.navigationItem?o.createElement(this.props.navigationItem,{...u,key:h},a):o.createElement(li,{...u,key:h},a)},this.calculateHeights=()=>{const s=this.props.dom.calendarHeight;this.itemHeight=this.props.dom.navigationItemHeight||1,this.maxViewHeight=this.props.dom.monthViewHeight,this.topOffset=(s-this.itemHeight)/2,this.bottomOffset=s-this.itemHeight},this.handleDateChange=(s,a)=>{const{onChange:r}=this.props;if(r&&a){const h={value:l.cloneDate(s),target:this,nativeEvent:a&&a.nativeEvent,syntheticEvent:a};r.call(void 0,h)}},this.handleScrollAction=({scrollAction:s,pageAction:a})=>{const r=a?a.skip:this.state.skip;if(this.state.skip!==r&&this.setState({skip:r}),this.list&&s){const h=`translateY(${s.offset}px)`;this.list.style.transform=h}},this.lastView=this.props.activeView,this.lastFocus=this.props.focusedDate;const t=this.props.service.skip(this.props.focusedDate,this.props.min),e=this.props.service.total(this.props.min,this.props.max);this.state={skip:t-this.getTake(t,e)>0?t:0}}get take(){return this.props.take!==void 0?this.props.take:oi.defaultProps.take}componentDidUpdate(i,t){this.indexToScroll!==void 0&&this.virtualization&&this.virtualization.scrollToIndex(this.indexToScroll),this.lastView=this.props.activeView,this.lastFocus=this.props.focusedDate,this.indexToScroll=void 0}render(){this.calculateHeights();const i=this.lastView!==this.props.activeView,t=Y(this.props.focusedDate,this.props.min,this.props.max),e=i?this.props.service.skip(t,this.props.min):this.state.skip,s=this.props.service.total(this.props.min,this.props.max),a=this.getTake(e,s),r=this.props.service.addToDate(this.props.min,e),h=this.props.service.datesList(r,a);(this.props.activeView!==this.lastView||!l.isEqual(t,this.lastFocus))&&(this.indexToScroll=this.props.service.skip(t,this.props.min));const u=o.createElement(gt,{skip:e,take:this.take,total:s,itemHeight:this.itemHeight,topOffset:this.topOffset,bottomOffset:this.bottomOffset,onScroll:this.props.onScroll,maxScrollDifference:this.maxViewHeight,onScrollAction:this.handleScrollAction,onMount:this.handleVirtualizationMount,tabIndex:this.props.tabIndex},o.createElement("ul",{ref:c=>{this.list=c},className:"k-reset"},h.map(c=>this.buildNavigationItem(c))));return o.createElement("div",{className:"k-calendar-navigation"},o.createElement("span",{className:"k-calendar-navigation-highlight"}),this.props.dom.didCalculate?u:null)}getTake(i,t){return Math.min(t-i,this.take)}};let Ce=oi;Ce.propTypes={activeView:n.number.isRequired,focusedDate:n.instanceOf(Date).isRequired,max:n.instanceOf(Date).isRequired,min:n.instanceOf(Date).isRequired,onChange:n.func,take:n.number,tabIndex:n.number},Ce.defaultProps={take:Os};const Ee=i=>i?i.virtualization:null,hi=(i=rt.defaultProps.min,t=rt.defaultProps.max,e,s)=>s!==void 0?s!==null&&A(l.getDate(s),i,t)?s:null:e!==null&&A(l.getDate(e),i,t)?e:null,at=class extends o.Component{constructor(i){super(i),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(Ee(this.Navigation),Ee(this.calendarViewList),e)},this.handleNavigationChange=e=>{if(this.props.disabled)return;this.didNavigationChange=!0;const s=l.cloneDate(e.value);this.setState({focusedDate:s})},this.handleViewChange=({view:e})=>{this.scrollSyncService&&this.scrollSyncService.configure(e),this.setState({activeView:e})},this.handleDateChange=e=>{const s=l.cloneDate(e.value),a=l.cloneDate(e.value),r=this.bus.canMoveDown(this.state.activeView);if(this.props.disabled)return;if(r)if(e.isTodayClick)this.bus.moveToBottom(this.state.activeView);else{this.bus.moveDown(this.state.activeView,e.syntheticEvent),this.setState({focusedDate:a});return}this.setState({value:s,focusedDate:a}),this.valueDuringOnChange=s;const{onChange:h}=this.props;if(h){const u={syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,value:s,target:this};h.call(void 0,u)}this.valueDuringOnChange=void 0},this.handleFocus=e=>{if(this.isActive=!0,!this.calendarViewList)return;this.calendarViewList.focusActiveDate();const{onFocus:s}=this.props;s&&s.call(void 0,e)},this.handleBlur=e=>{if(this.isActive=!1,!this.calendarViewList)return;this.calendarViewList.blurActiveDate();const{onBlur:s}=this.props;s&&s.call(void 0,e)},this.handleKeyDown=e=>{const{keyCode:a,ctrlKey:r,metaKey:h}=e;if(!(!this.focusedDate||!this.service)){if(a===84&&this.setState({focusedDate:z()}),(r||h)&&(a===d.Keys.left||a===d.Keys.right)){if(this.props.disabled)return;this.didNavigationChange=!0,this.focusedDate.getDate()===31&&this.focusedDate.setDate(30);const u=a===d.Keys.left?this.focusedDate.getMonth()-1:this.focusedDate.getMonth()+1,c=new Date(this.focusedDate.setMonth(u)),m=l.cloneDate(c);this.setState({focusedDate:m})}if(a===d.Keys.enter){if(this.value!==null&&l.isEqualDate(this.focusedDate,this.value)){const c=Y(this.focusedDate,this.min,this.max);Ee(this.calendarViewList).scrollToIndex(this.service.skip(c,this.min))}const u={syntheticEvent:e,nativeEvent:e.nativeEvent,value:this.focusedDate,target:this};this.handleDateChange(u)}else{const u=Y(this.navigation.move(this.focusedDate,this.navigation.action(e),this.state.activeView,this.service,e),this.min,this.max);if(l.isEqualDate(this.focusedDate,u))return;this.setState({focusedDate:u})}e.preventDefault()}},this.handleMouseDown=e=>{e.preventDefault()},this.handleClick=e=>{this._element&&this._element.focus({preventScroll:!0})},d.validatePackage(ft);const t=hi(this.min,this.max,this.props.defaultValue||at.defaultProps.defaultValue,this.props.value);this.state={value:t,activeView:Yt(C[i.defaultActiveView],this.bottomView,this.topView),focusedDate:Y(i.focusedDate||t||z(),this.min,this.max)},this.dom=new ti,this.bus=new de(this.handleViewChange),this.navigation=new me(this.bus),this.oldValue=t}get cellUID(){return this.props.id+"-cell-uid"}get id(){return this.props.id+"-id"}get element(){return this._element}get value(){return this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value}get min(){return l.getDate(this.props.min!==void 0?this.props.min:at.defaultProps.min)}get max(){return l.getDate(this.props.max!==void 0?this.props.max:at.defaultProps.max)}get bottomView(){return C[this.props.bottomView!==void 0?this.props.bottomView:at.defaultProps.bottomView]}get topView(){return C[this.props.topView!==void 0?this.props.topView:at.defaultProps.topView]}componentDidMount(){Promise.resolve().then(()=>{d.setScrollbarWidth(),this._element&&(this.dom.calculateHeights(this._element),this.scrollSyncService=new ei(this.dom),this.scrollSyncService.configure(this.state.activeView),this.forceUpdate())})}componentDidUpdate(i,t){d.setScrollbarWidth(),t.activeView!==this.state.activeView&&this.scrollSyncService&&this.scrollSyncService.configure(this.state.activeView),this.calendarViewList&&(this.isActive?this.calendarViewList.focusActiveDate:this.calendarViewList.blurActiveDate)(),this.didNavigationChange=!1,this.isActive&&(this.oldValue=this.value)}render(){this.props._ref&&this.props._ref(this);const i=this.value!==null&&this.oldValue!==null?!l.isEqualDate(this.value,this.oldValue):this.value!==this.oldValue,t=Yt(this.state.activeView,C[this.props.bottomView!==void 0?this.props.bottomView:at.defaultProps.bottomView],C[this.props.topView!==void 0?this.props.topView:at.defaultProps.topView]),e=hi(this.min,this.max,this.value,this.value),s=e?l.getDate(e):null;this.focusedDate=l.getDate(Y(i&&e!==null?e:this.state.focusedDate,this.min,this.max)),this.intl=x.provideIntlService(this),this.bus.configure(this.bottomView,this.topView),this.service=this.bus.service(t,this.intl);const{smoothScroll:a=Number.parseFloat(o.version)<18}=this.props,r=d.classNames("k-widget k-calendar k-calendar-infinite",{"k-disabled":this.props.disabled,"k-week-number":this.props.weekNumber,"k-calendar-lg":this.props.mobileMode},this.props.className),h=[this.props.navigation&&o.createElement(Ce,{key:0,ref:u=>{this.Navigation=u},activeView:this.state.activeView,focusedDate:this.focusedDate,min:this.min,max:this.max,onScroll:this.handleScroll,onChange:this.handleNavigationChange,service:this.service,dom:this.dom,navigationItem:this.props.navigationItem,tabIndex:this.props.tabIndex}),o.createElement(zt,{key:1,ref:u=>{this.calendarViewList=u},activeView:this.state.activeView,focusedDate:this.focusedDate,min:this.min,max:this.max,bus:this.bus,shouldScroll:this.shouldScroll,onScroll:this.handleScroll,service:this.service,cell:this.props.cell,weekCell:this.props.weekCell,dom:this.dom,smoothScroll:a,showWeekNumbers:this.props.weekNumber,onChange:this.handleDateChange,value:s,cellUID:this.cellUID,headerTitle:this.props.headerTitle,tabIndex:this.props.tabIndex})];return o.createElement("div",{ref:u=>{this._element=u},className:r,id:this.props.id||this.id,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,"aria-disabled":this.props.disabled,tabIndex:this.props.disabled?void 0:this.props.tabIndex||0,onFocus:this.handleFocus,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,onMouseDown:this.handleMouseDown,onClick:this.handleClick},h)}};let rt=at;rt.displayName="Calendar",rt.propTypes={className:n.string,defaultActiveView:n.oneOf(["month","year","decade","century"]),defaultValue:n.instanceOf(Date),disabled:n.bool,focusedDate:n.instanceOf(Date),id:n.string,ariaLabelledBy:n.string,ariaDescribedBy:n.string,max:n.instanceOf(Date),min:n.instanceOf(Date),navigation:n.bool,smoothScroll:n.bool,onBlur:n.func,onChange:n.func,onFocus:n.func,tabIndex:n.number,value:n.instanceOf(Date),weekNumber:n.bool,topView:(i,t,e)=>{const s=i[t],a=i.bottomView;return s&&a&&C[s]<C[a]?new Error(`Invalid prop + ${t} suplied to ${e}.
|
|
11
|
+
`,"k-calendar-header k-hstack"),w=()=>f([m([u([h("MO","k-calendar-th")],"k-calendar-tr")],"k-calendar-thead")],"k-calendar-table k-calendar-weekdays"),v=(I,H)=>new Array(I).fill("1").map(H),E=(I,H=1)=>f([c([u([r("1","k-calendar-td k-alt")])].concat(v(I,()=>u(v(H,_t=>r(`<span class="k-link">${_t}</span>`,"k-calendar-td")),"k-calendar-tr"))),"k-calendar-tbody")],"k-calendar-table"),O=I=>e(I,"k-content k-scrollable"),N=(I,H,_t)=>e(_t?[g(),w(),O([I,I])]:[g(),O([I,I])],H,{left:"-10000px",position:"absolute"}),S=(()=>{let I;return()=>d.canUseDOM?(I||(I=e([O([s([a("<span>FEB</span>")])])],"k-calendar-navigation",{left:"0px",position:"absolute"})),I):null})(),y=({cells:I,rows:H},_t,fn)=>{let Ue;return()=>d.canUseDOM?(Ue||(Ue=N(E(H,I),_t,fn)),Ue):null},b=I=>I.querySelector(".k-scrollable"),K=I=>{const H=b(I);return H.className=`${H.className} k-scrollable-horizontal`,I},M=y({cells:7,rows:6},"k-calendar-view k-calendar-monthview k-vstack",!0),F=y({cells:5,rows:3},"k-calendar-view k-calendar-yearview",!1),U=y({cells:5,rows:2},"k-calendar-view k-calendar-decadeview",!1),V=()=>K(M()),_=()=>K(F()),tt=()=>K(U()),X=I=>parseFloat(window.getComputedStyle(I).height)||I.offsetHeight,pt=I=>{const H=window.getComputedStyle(I);return parseFloat(H.width)+parseFloat(H.paddingLeft)+parseFloat(H.paddingRight)||I.offsetWidth},Mt=I=>I.querySelector("tbody");this.didCalculate=!0,t&&(this.hostContainer=t),this.batch(M(),I=>{const H=Mt(I);this.calendarHeight=X(I),this.monthViewHeight=X(H),this.headerHeight=X(H.children[0]),this.scrollableContentHeight=X(b(I))}),this.batch(V(),I=>{const H=Mt(I);this.calendarWidth=pt(I),this.monthViewWidth=pt(H),this.scrollableContentWidth=pt(b(I))}),this.batch(F(),I=>{this.yearViewHeight=X(Mt(I)),this.scrollableYearContentHeight=X(b(I))}),this.batch(_(),I=>{this.yearViewWidth=pt(Mt(I))}),this.batch(U(),I=>{this.decadeViewHeight=X(Mt(I)),this.centuryViewHeight=this.decadeViewHeight}),this.batch(tt(),I=>{this.decadeViewWidth=pt(Mt(I)),this.centuryViewWidth=this.decadeViewWidth}),this.batch(S(),I=>{this.navigationItemHeight=X(I.querySelector("li"))})}viewHeight(t){return this.viewDimension(t,"height")}viewWidth(t){return this.viewDimension(t,"width")}viewDimension(t,e){const s=e==="height"?"ViewHeight":"ViewWidth";switch(t){case C.month:return this[`month${s}`];case C.year:return this[`year${s}`];case C.decade:return this[`decade${s}`];case C.century:return this[`century${s}`];default:return 1}}batch(t,e){const s=this.hostContainer||document.body,a=s.appendChild(t);e(a),s.removeChild(a)}};const Is={33:D.PrevView,34:D.NextView,35:D.LastInView,36:D.FirstInView,37:D.Left,38:D.Up,39:D.Right,40:D.Down,"meta+38":D.UpperView,"meta+40":D.LowerView};class me{constructor(t){this.bus=t}action(t){const e=`${t.ctrlKey||t.metaKey?"meta+":""}${t.keyCode}`;return Is[e]}move(t,e,s,a,r){return a?e===D.UpperView&&this.bus.canMoveUp(s)?(this.bus.moveUp(s,r),t):e===D.LowerView&&this.bus.canMoveDown(s)?(this.bus.moveDown(s,r),t):a.move(t,e):t}}const xs=i=>t=>Math.floor(t/i),Cs=i=>t=>t*i;class ei{constructor(t){this.dom=t,this.divideByMagnitude=null,this.powerByMagnitude=null,this.navigator=null,this.view=null,this.monthScrolled=!1,this.navScrolled=!1}configure(t){const e=Math.max(this.dom.viewHeight(t)/this.dom.navigationItemHeight,1);this.divideByMagnitude=xs(e),this.powerByMagnitude=Cs(e)}sync(t,e,s){if(!(!t||!e)){if(this.navigator=t,this.view=e,s.target===this.navigator.element){if(this.monthScrolled){this.monthScrolled=!1;return}this.navScrolled=!0,this.scrollSiblingOf(this.navigator.element)}if(s.target===this.view.element){if(this.navScrolled){this.navScrolled=!1;return}this.monthScrolled=!0,this.scrollSiblingOf(this.view.element)}}}scrollSiblingOf(t){const e=this.siblingComponent(t),s=this.calculateScroll(e,t.scrollTop);e.scrollTo(s)}siblingComponent(t){return this.navigator.element===t?this.view:this.navigator}calculateScroll(t,e){const s=t===this.navigator?this.divideByMagnitude:this.powerByMagnitude;return s?s(e):0}}class ii{constructor(t){this.intl=t}getWeekNames(t=!1){const e=Ge(this.intl.dateFormatNames({nameType:"short",type:"days"}),this.intl.firstDay());return t?[""].concat(e):e}}const si=i=>o.createElement("td",{key:i,className:"k-calendar-td"}," "),ni=class extends o.Component{constructor(){super(...arguments),this.intl=null,this.weekService=null,this.buildWeekNumber=(i,t)=>{if(!this.firstDate(i))return si(`week-cell-${t}`);const s=this.firstDate(i),a=this.getWeekNumber(s),r=`kendo-react-calendar-week-cell-${a}`,h={className:"k-alt",value:a,firstDate:s};return this.props.weekCell?o.createElement(this.props.weekCell,{...h,key:r},a):o.createElement(Te,{...h,key:r},a)},this.buildRow=i=>i.map((t,e)=>{if(!t)return si(e);const s={"aria-selected":t.isSelected},a=`kendo-react-calendar-cell-${t.value.getTime()}`,r={...s,...t,isDisabled:!t.isInRange,view:this.props.activeView,onClick:this.handleClick,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave};return this.props.cell?o.createElement(this.props.cell,{...r,key:a},t.formattedValue):o.createElement($e,{...r,key:a},t.formattedValue)}),this.firstDate=i=>{const t=this.firstWeekDateContext(i);return t?t.value:null},this.firstWeekDateContext=i=>{if(!this.weekNumber)return null;let t=0,e=i[t];for(;!e&&t<i.length;)e=i[++t];return e},this.handleClick=(i,t)=>{const{onChange:e}=this.props;if(e&&t){const s={value:l.cloneDate(i),target:this,nativeEvent:t&&t.nativeEvent,syntheticEvent:t};e.call(void 0,s)}},this.handleMouseEnter=i=>{const{onCellEnter:t}=this.props;t&&t.call(void 0,l.cloneDate(i))},this.handleMouseLeave=i=>{const{onCellLeave:t}=this.props;t&&t.call(void 0,l.cloneDate(i))}}get min(){return this.props.min}get max(){return this.props.max}get isHorizontal(){return this.props.direction==="horizontal"}get isMonthView(){return this.props.activeView===C.month}get weekNumber(){return!!(this.props.showWeekNumbers&&this.props.activeView===C.month)}get selectedDate(){return this.props.selectedDate!==void 0?this.props.selectedDate:ni.defaultProps.selectedDate}render(){this.intl=x.provideIntlService(this),this.weekService=new ii(this.intl);const i=this.weekService.getWeekNames(this.weekNumber),t=this.props.service.rowLength(this.weekNumber),e=this.props.service.title(this.props.viewDate),s=z(),a=R(this.props.viewDate,s),r=this.props.service.data({cellUID:this.props.cellUID,min:this.min,max:this.max,focusedDate:this.props.focusedDate,isActiveView:!this.props.bus.canMoveDown(this.props.activeView),selectedDate:this.selectedDate,selectionRange:this.props.selectionRange,viewDate:a});return o.createElement(o.Fragment,null,this.isMonthView&&this.isHorizontal&&o.createElement("thead",{role:"rowgroup",className:"k-calendar-thead"},o.createElement("tr",{role:"row",className:"k-calendar-tr"},i.map((h,u)=>o.createElement("th",{key:u,className:"k-calendar-th"},h)))),o.createElement("tbody",{role:"rowgroup",className:"k-calendar-tbody"},!this.isHorizontal&&o.createElement("tr",{role:"presentation",className:"k-calendar-tr"},o.createElement("th",{scope:"col",colSpan:t,className:"k-calendar-caption"},e)),r.map((h,u)=>o.createElement("tr",{role:"row",className:"k-calendar-tr",key:u},this.weekNumber&&this.buildWeekNumber(h,u),this.buildRow(h)))))}getWeekNumber(i){return!this.weekNumber||!this.intl?null:l.weekInYear(i,this.intl.firstDay())}};let Lt=ni;Lt.propTypes={activeRangeEnd:n.oneOf(["start","end",null]),activeView:n.number.isRequired,cellUID:n.string.isRequired,direction:n.oneOf(["horizontal","vertical"]),focusedDate:n.instanceOf(Date).isRequired,max:n.instanceOf(Date).isRequired,min:n.instanceOf(Date).isRequired,onChange:n.func,selectedDate:n.oneOfType([n.instanceOf(Date),n.arrayOf(n.instanceOf(Date))]),showWeekNumbers:n.bool,viewDate:n.instanceOf(Date).isRequired},Lt.defaultProps={direction:"vertical",selectedDate:z(),showWeekNumbers:!1},x.registerForIntl(Lt);class ai extends o.PureComponent{render(){const{view:t,...e}=this.props;return o.createElement(L.Button,{type:"button",fillMode:"flat",...e},this.props.children)}}const Tt=class extends o.Component{constructor(){super(...arguments),this.getTitle=()=>{if(!this.props.currentDate)return"";const i=this.rangeLength-1,t=this.props.service.title(this.props.currentDate),e=this.props.service.addToDate(this.props.currentDate,i);return i<1||!this.props.service.isInRange(e,this.min,this.max)?t:`${t} - ${this.props.service.title(e)}`},this.handleTitleClick=i=>{this.canMoveUp&&this.props.bus.moveUp(this.props.activeView,i)}}get min(){return this.props.min!==void 0?this.props.min:Tt.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:Tt.defaultProps.max}get rangeLength(){return this.props.rangeLength!==void 0?this.props.rangeLength:Tt.defaultProps.rangeLength}get canMoveUp(){return this.props.bus.canMoveUp(this.props.activeView)}render(){const i=this.getTitle(),t=d.classNames("k-calendar-title"),e={children:i,value:i,view:this.props.activeView,className:t,onClick:this.handleTitleClick,disabled:!this.canMoveUp},s=this.props.headerTitle?o.createElement(this.props.headerTitle,{...e},i):o.createElement(ai,{...e},i);return o.createElement("div",{className:d.classNames("k-calendar-header",{"k-vstack":this.props.verticalView,"k-hstack":!this.props.verticalView})},s,o.createElement("span",{className:"k-spacer"}),o.createElement("span",{className:"k-calendar-nav k-hstack"},this.props.commands))}};let vt=Tt;vt.propTypes={activeView:n.number.isRequired,currentDate:n.instanceOf(Date).isRequired,max:n.instanceOf(Date).isRequired,min:n.instanceOf(Date).isRequired,rangeLength:n.number},vt.defaultProps={rangeLength:1,min:it,max:st},x.registerForLocalization(vt);const pe="multiviewcalendar.prevView",fe="multiviewcalendar.nextView",wt="dateinput.increment",bt="dateinput.decrement",jt="calendar.today",Zt="datepicker.toggleCalendar",St="daterangepicker.swapStartEnd",Gt="daterangepicker.start",Xt="daterangepicker.end",Jt="daterangepicker.separator",Dt="datetimepicker.toggleDateTimeSelector",ge="timepicker.now",ve="timepicker.selectNow",Qt="timepicker.cancel",At="timepicker.set",we="timepicker.toggleTimeSelector",Pt="timepicker.toggleClock",be="datetimepicker.date",Se="datetimepicker.time",Ht="datetimepicker.cancel",Bt="datetimepicker.set",De="daterangepicker.cancel",Ie="daterangepicker.set",k={[jt]:"TODAY",[ge]:"NOW",[At]:"Set",[Qt]:"Cancel",[be]:"Date",[Se]:"Time",[Ht]:"Cancel",[Bt]:"Set",[De]:"Cancel",[Ie]:"Set",[Gt]:"Start",[Xt]:"End",[Jt]:" ",[ve]:"Select Now",[we]:"Toggle TimeSelector",[Pt]:"Toggle Clock",[wt]:"Increase value",[bt]:"Decrease value",[Zt]:"Toggle calendar",[pe]:"Navigate to previous view",[fe]:"Navigate to next view",[St]:"Swap start and end values",[Dt]:"Toggle date-time selector"},xe=class extends o.Component{constructor(){super(...arguments),this.localization=null,this.handleClick=i=>{if(this.todayIsInRange&&this.props.onClick){const t={syntheticEvent:i,nativeEvent:i.nativeEvent,value:Y(z(),this.min,this.max),target:this,isTodayClick:!0};this.props.onClick.call(void 0,t)}}}get min(){return this.props.min!==void 0?this.props.min:xe.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:xe.defaultProps.max}get todayIsInRange(){return A(z(),l.getDate(this.min),l.getDate(this.max))}render(){this.localization=x.provideLocalizationService(this);const i=this.localization.toLanguageString(jt,k[jt]),t=d.classNames("k-calendar-nav-today",{"k-disabled":this.props.disabled});return o.createElement(L.Button,{className:t,onClick:this.handleClick,tabIndex:this.props.tabIndex,fillMode:"flat"},i)}};let It=xe;It.propTypes={max:n.instanceOf(Date).isRequired,min:n.instanceOf(Date).isRequired,onClick:n.func,disabled:n.bool},It.defaultProps={min:it,max:st},x.registerForLocalization(It);const Es=5,ri=class extends o.Component{constructor(i){super(i),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.focusActiveDate=()=>{if(!this._element)return;const t=this._element.querySelector("td.k-focus"),e=this._element.querySelector(".k-state-pending-focus");t&&t[0]&&t[0].classList.remove("k-focus"),e&&e.classList.add("k-focus"),this.isActive=!0},this.blurActiveDate=()=>{if(!this._element)return;const t=this._element.querySelector("td.k-focus");t&&t.classList.remove("k-focus"),this.isActive=!1},this.handleVirtualizationMount=t=>{if(this.virtualization=t,this.virtualization&&this.table){this.table.style.transform=`translateY(${this.viewOffset}px)`;const e=Y(this.props.focusedDate,this.props.min,this.props.max),s=this.props.service.skip(e,this.props.min);this.virtualization.scrollToIndex(s)}},this.buildMonthView=(t,e)=>o.createElement("table",{key:"calendar-view-list-weekdays",className:"k-calendar-table k-calendar-weekdays",role:"grid",tabIndex:this.props.tabIndex},o.createElement("colgroup",null,t.map((s,a)=>o.createElement("col",{key:a}))),o.createElement("thead",{className:"k-calendar-thead"},o.createElement("tr",{className:"k-calendar-tr"},e.map((s,a)=>o.createElement("th",{key:a,className:"k-calendar-th"},s))))),this.buildDates=(t,e)=>{const s=this.props.cellUID;return o.createElement("table",{className:"k-calendar-table",ref:a=>this.table=a,role:"grid",tabIndex:this.props.tabIndex,"aria-activedescendant":s+this.props.focusedDate.getTime()},o.createElement("colgroup",null,t.map((a,r)=>o.createElement("col",{key:r}))),e.map(a=>o.createElement(Lt,{ref:r=>{this.calendarView||(this.calendarView=r)},key:a.getTime(),activeView:this.props.activeView,viewDate:a,min:this.props.min,max:this.props.max,cellUID:s,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})))},this.calculateHeights=()=>{if(!this.props.dom)return;const t=this.props.activeView===C.month?this.props.dom.scrollableContentHeight:this.props.dom.scrollableYearContentHeight;this.bottomOffset=t-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=(t,e)=>Math.min(e-t,this.take),this.handleScrollAction=({index:t,scrollAction:e,pageAction:s})=>{const a=s?s.skip:this.state.skip;if((this.state.index!==t||this.state.skip!==a)&&this.setState({index:t,skip:a}),this.table&&e){const r=`translateY(${e.offset}px)`;this.table.style.transform=r}},this.handleTodayClick=t=>{this.shouldScroll=!0,this.handleDateChange.call(void 0,t,!0)},this.handleDateChange=(t,e=!1)=>{const{onChange:s}=this.props;if(s){const a={syntheticEvent:t.syntheticEvent,nativeEvent:t.nativeEvent,value:l.cloneDate(t.value),target:this,isTodayClick:e};s.call(void 0,a)}},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(){this.intl=x.provideIntlService(this);const i=Ge(this.intl.dateFormatNames({nameType:"short",type:"days"}),this.intl.firstDay());return this.weekNumber?[""].concat(i):i}get weekNumber(){return!!(this.props.showWeekNumbers&&this.props.activeView===C.month)}get take(){return this.props.take!==void 0?this.props.take:ri.defaultProps.take}get animate(){return!!(this.props.smoothScroll&&this.animateToIndex)}get todayIsInRange(){return A(z(),l.getDate(this.props.min),l.getDate(this.props.max))}componentDidUpdate(i,t){this.shouldScroll=!1,this.indexToScroll!==void 0&&this.virtualization&&this.virtualization[this.animate?"animateToIndex":"scrollToIndex"](this.indexToScroll),this.isActive&&this.focusActiveDate(),this.lastView=this.props.activeView,this.indexToScroll=void 0}render(){this.calculateHeights();const i=this.lastView!==this.props.activeView,t=Y(this.props.focusedDate,this.props.min,this.props.max),e=i?this.props.service.skip(t,this.props.min):this.state.skip,s=this.props.service.total(this.props.min,this.props.max),a=this.getTake(e,s),r=this.props.service.addToDate(this.props.min,e),h=this.props.service.addToDate(this.props.min,this.state.index),u=new Array(this.props.service.rowLength(this.weekNumber)).fill(""),c=this.props.activeView!==this.lastView;this.animateToIndex=!c,(c||!l.isEqualDate(this.lastFocus,t)||this.shouldScroll||!this.props.shouldScroll||this.props.shouldScroll())&&(this.indexToScroll=this.props.service.skip(t,this.props.min)),this.lastFocus=t;const m=d.classNames("k-calendar-view k-vstack",{"k-calendar-monthview":this.props.activeView===C.month,"k-calendar-yearview":this.props.activeView===C.year,"k-calendar-decadeview":this.props.activeView===C.decade,"k-calendar-centuryview":this.props.activeView===C.century}),f=this.buildDates(u,this.props.service.datesList(r,a)),g=o.createElement(o.Fragment,null,o.createElement(vt,{key:"calendar-view-list-header",currentDate:h,min:this.props.min,max:this.props.max,activeView:this.props.activeView,bus:this.props.bus,service:this.props.service,headerTitle:this.props.headerTitle,commands:o.createElement(o.Fragment,null,o.createElement(It,{min:this.props.min,max:this.props.max,onClick:this.handleTodayClick,disabled:!this.todayIsInRange,tabIndex:this.props.tabIndex}))}),this.props.activeView===C.month&&this.buildMonthView(u,this.weekNames),o.createElement(gt,{key:"calendar-view-list-content",skip:e,take:this.take,total:s,itemHeight:this.viewHeight,topOffset:this.viewOffset,bottomOffset:this.bottomOffset,scrollOffsetSize:this.viewOffset,maxScrollDifference:this.viewHeight,onScroll:this.props.onScroll,onScrollAction:this.handleScrollAction,onMount:this.handleVirtualizationMount,children:f,tabIndex:this.props.tabIndex}));return o.createElement("div",{ref:w=>{this._element=w},className:m},this.props.dom.didCalculate?g:null)}};let zt=ri;zt.propTypes={activeView:n.number.isRequired,bottomOffset:n.number,cellUID:n.string.isRequired,focusedDate:n.instanceOf(Date).isRequired,max:n.instanceOf(Date).isRequired,min:n.instanceOf(Date).isRequired,onChange:n.func,showWeekNumbers:n.bool,smoothScroll:n.bool,take:n.number,value:n.instanceOf(Date),viewHeight:n.number,viewOffset:n.number,tabIndex:n.number},zt.defaultProps={take:Es,showWeekNumbers:!1,smoothScroll:!0},x.registerForIntl(zt);class li extends o.Component{constructor(){super(...arguments),this.handleClick=t=>{const{onClick:e,value:s}=this.props;e&&e.call(void 0,s,t)}}render(){const{isRangeStart:t,value:e,text:s,...a}=this.props;return o.createElement("li",{...a,onClick:this.handleClick},o.createElement("span",{className:d.classNames({"k-calendar-navigation-marker":t})},this.props.children))}}const Vs=30,oi=class extends o.Component{constructor(i){super(i),this.virtualization=null,this.list=null,this.itemHeight=0,this.topOffset=0,this.maxViewHeight=0,this.bottomOffset=0,this.handleVirtualizationMount=s=>{if(this.virtualization=s,this.virtualization&&this.list){this.list.style.transform=`translateY(${this.topOffset}px)`;const a=Y(this.props.focusedDate,this.props.min,this.props.max),r=this.props.service.skip(a,this.props.min);this.virtualization.scrollToIndex(r)}},this.buildNavigationItem=s=>{const a=this.props.service.navigationTitle(s),r=this.props.service.isRangeStart(s),h=`kendo-react-calendar-nav-item-${s.getTime()}`,u={text:a,value:s,isRangeStart:r,view:this.props.activeView,onClick:this.handleDateChange};return this.props.navigationItem?o.createElement(this.props.navigationItem,{...u,key:h},a):o.createElement(li,{...u,key:h},a)},this.calculateHeights=()=>{const s=this.props.dom.calendarHeight;this.itemHeight=this.props.dom.navigationItemHeight||1,this.maxViewHeight=this.props.dom.monthViewHeight,this.topOffset=(s-this.itemHeight)/2,this.bottomOffset=s-this.itemHeight},this.handleDateChange=(s,a)=>{const{onChange:r}=this.props;if(r&&a){const h={value:l.cloneDate(s),target:this,nativeEvent:a&&a.nativeEvent,syntheticEvent:a};r.call(void 0,h)}},this.handleScrollAction=({scrollAction:s,pageAction:a})=>{const r=a?a.skip:this.state.skip;if(this.state.skip!==r&&this.setState({skip:r}),this.list&&s){const h=`translateY(${s.offset}px)`;this.list.style.transform=h}},this.lastView=this.props.activeView,this.lastFocus=this.props.focusedDate;const t=this.props.service.skip(this.props.focusedDate,this.props.min),e=this.props.service.total(this.props.min,this.props.max);this.state={skip:t-this.getTake(t,e)>0?t:0}}get take(){return this.props.take!==void 0?this.props.take:oi.defaultProps.take}componentDidUpdate(i,t){this.indexToScroll!==void 0&&this.virtualization&&this.virtualization.scrollToIndex(this.indexToScroll),this.lastView=this.props.activeView,this.lastFocus=this.props.focusedDate,this.indexToScroll=void 0}render(){this.calculateHeights();const i=this.lastView!==this.props.activeView,t=Y(this.props.focusedDate,this.props.min,this.props.max),e=i?this.props.service.skip(t,this.props.min):this.state.skip,s=this.props.service.total(this.props.min,this.props.max),a=this.getTake(e,s),r=this.props.service.addToDate(this.props.min,e),h=this.props.service.datesList(r,a);(this.props.activeView!==this.lastView||!l.isEqual(t,this.lastFocus))&&(this.indexToScroll=this.props.service.skip(t,this.props.min));const u=o.createElement(gt,{skip:e,take:this.take,total:s,itemHeight:this.itemHeight,topOffset:this.topOffset,bottomOffset:this.bottomOffset,onScroll:this.props.onScroll,maxScrollDifference:this.maxViewHeight,onScrollAction:this.handleScrollAction,onMount:this.handleVirtualizationMount,tabIndex:this.props.tabIndex},o.createElement("ul",{ref:c=>{this.list=c},className:"k-reset"},h.map(c=>this.buildNavigationItem(c))));return o.createElement("div",{className:"k-calendar-navigation"},o.createElement("span",{className:"k-calendar-navigation-highlight"}),this.props.dom.didCalculate?u:null)}getTake(i,t){return Math.min(t-i,this.take)}};let Ce=oi;Ce.propTypes={activeView:n.number.isRequired,focusedDate:n.instanceOf(Date).isRequired,max:n.instanceOf(Date).isRequired,min:n.instanceOf(Date).isRequired,onChange:n.func,take:n.number,tabIndex:n.number},Ce.defaultProps={take:Vs};const Ee=i=>i?i.virtualization:null,hi=(i=rt.defaultProps.min,t=rt.defaultProps.max,e,s)=>s!==void 0?s!==null&&A(l.getDate(s),i,t)?s:null:e!==null&&A(l.getDate(e),i,t)?e:null,at=class extends o.Component{constructor(i){super(i),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(Ee(this.Navigation),Ee(this.calendarViewList),e)},this.handleNavigationChange=e=>{if(this.props.disabled)return;this.didNavigationChange=!0;const s=l.cloneDate(e.value);this.setState({focusedDate:s})},this.handleViewChange=({view:e})=>{this.scrollSyncService&&this.scrollSyncService.configure(e),this.setState({activeView:e})},this.handleDateChange=e=>{const s=l.cloneDate(e.value),a=l.cloneDate(e.value),r=this.bus.canMoveDown(this.state.activeView);if(this.props.disabled)return;if(r)if(e.isTodayClick)this.bus.moveToBottom(this.state.activeView);else{this.bus.moveDown(this.state.activeView,e.syntheticEvent),this.setState({focusedDate:a});return}this.setState({value:s,focusedDate:a}),this.valueDuringOnChange=s;const{onChange:h}=this.props;if(h){const u={syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,value:s,target:this};h.call(void 0,u)}this.valueDuringOnChange=void 0},this.handleFocus=e=>{if(this.isActive=!0,!this.calendarViewList)return;this.calendarViewList.focusActiveDate();const{onFocus:s}=this.props;s&&s.call(void 0,e)},this.handleBlur=e=>{if(this.isActive=!1,!this.calendarViewList)return;this.calendarViewList.blurActiveDate();const{onBlur:s}=this.props;s&&s.call(void 0,e)},this.handleKeyDown=e=>{const{keyCode:a,ctrlKey:r,metaKey:h}=e;if(!(!this.focusedDate||!this.service)){if(a===84&&this.setState({focusedDate:z()}),(r||h)&&(a===d.Keys.left||a===d.Keys.right)){if(this.props.disabled)return;this.didNavigationChange=!0,this.focusedDate.getDate()===31&&this.focusedDate.setDate(30);const u=a===d.Keys.left?this.focusedDate.getMonth()-1:this.focusedDate.getMonth()+1,c=new Date(this.focusedDate.setMonth(u)),m=l.cloneDate(c);this.setState({focusedDate:m})}if(a===d.Keys.enter){if(this.value!==null&&l.isEqualDate(this.focusedDate,this.value)){const c=Y(this.focusedDate,this.min,this.max);Ee(this.calendarViewList).scrollToIndex(this.service.skip(c,this.min))}const u={syntheticEvent:e,nativeEvent:e.nativeEvent,value:this.focusedDate,target:this};this.handleDateChange(u)}else{const u=Y(this.navigation.move(this.focusedDate,this.navigation.action(e),this.state.activeView,this.service,e),this.min,this.max);if(l.isEqualDate(this.focusedDate,u))return;this.setState({focusedDate:u})}e.preventDefault()}},this.handleMouseDown=e=>{e.preventDefault()},this.handleClick=e=>{this._element&&this._element.focus({preventScroll:!0})},d.validatePackage(ft);const t=hi(this.min,this.max,this.props.defaultValue||at.defaultProps.defaultValue,this.props.value);this.state={value:t,activeView:Yt(C[i.defaultActiveView],this.bottomView,this.topView),focusedDate:Y(i.focusedDate||t||z(),this.min,this.max)},this.dom=new ti,this.bus=new de(this.handleViewChange),this.navigation=new me(this.bus),this.oldValue=t}get cellUID(){return this.props.id+"-cell-uid"}get id(){return this.props.id+"-id"}get element(){return this._element}get value(){return this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value}get min(){return l.getDate(this.props.min!==void 0?this.props.min:at.defaultProps.min)}get max(){return l.getDate(this.props.max!==void 0?this.props.max:at.defaultProps.max)}get bottomView(){return C[this.props.bottomView!==void 0?this.props.bottomView:at.defaultProps.bottomView]}get topView(){return C[this.props.topView!==void 0?this.props.topView:at.defaultProps.topView]}componentDidMount(){Promise.resolve().then(()=>{d.setScrollbarWidth(),this._element&&(this.dom.calculateHeights(this._element),this.scrollSyncService=new ei(this.dom),this.scrollSyncService.configure(this.state.activeView),this.forceUpdate())})}componentDidUpdate(i,t){d.setScrollbarWidth(),t.activeView!==this.state.activeView&&this.scrollSyncService&&this.scrollSyncService.configure(this.state.activeView),this.calendarViewList&&(this.isActive?this.calendarViewList.focusActiveDate:this.calendarViewList.blurActiveDate)(),this.didNavigationChange=!1,this.isActive&&(this.oldValue=this.value)}render(){this.props._ref&&this.props._ref(this);const i=this.value!==null&&this.oldValue!==null?!l.isEqualDate(this.value,this.oldValue):this.value!==this.oldValue,t=Yt(this.state.activeView,C[this.props.bottomView!==void 0?this.props.bottomView:at.defaultProps.bottomView],C[this.props.topView!==void 0?this.props.topView:at.defaultProps.topView]),e=hi(this.min,this.max,this.value,this.value),s=e?l.getDate(e):null;this.focusedDate=l.getDate(Y(i&&e!==null?e:this.state.focusedDate,this.min,this.max)),this.intl=x.provideIntlService(this),this.bus.configure(this.bottomView,this.topView),this.service=this.bus.service(t,this.intl);const{smoothScroll:a=Number.parseFloat(o.version)<18}=this.props,r=d.classNames("k-widget k-calendar k-calendar-infinite",{"k-disabled":this.props.disabled,"k-week-number":this.props.weekNumber,"k-calendar-lg":this.props.mobileMode},this.props.className),h=[this.props.navigation&&o.createElement(Ce,{key:0,ref:u=>{this.Navigation=u},activeView:this.state.activeView,focusedDate:this.focusedDate,min:this.min,max:this.max,onScroll:this.handleScroll,onChange:this.handleNavigationChange,service:this.service,dom:this.dom,navigationItem:this.props.navigationItem,tabIndex:this.props.tabIndex}),o.createElement(zt,{key:1,ref:u=>{this.calendarViewList=u},activeView:this.state.activeView,focusedDate:this.focusedDate,min:this.min,max:this.max,bus:this.bus,shouldScroll:this.shouldScroll,onScroll:this.handleScroll,service:this.service,cell:this.props.cell,weekCell:this.props.weekCell,dom:this.dom,smoothScroll:a,showWeekNumbers:this.props.weekNumber,onChange:this.handleDateChange,value:s,cellUID:this.cellUID,headerTitle:this.props.headerTitle,tabIndex:this.props.tabIndex})];return o.createElement("div",{ref:u=>{this._element=u},className:r,id:this.props.id||this.id,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,"aria-disabled":this.props.disabled,tabIndex:this.props.disabled?void 0:this.props.tabIndex||0,onFocus:this.handleFocus,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,onMouseDown:this.handleMouseDown,onClick:this.handleClick},h)}};let rt=at;rt.displayName="Calendar",rt.propTypes={className:n.string,defaultActiveView:n.oneOf(["month","year","decade","century"]),defaultValue:n.instanceOf(Date),disabled:n.bool,focusedDate:n.instanceOf(Date),id:n.string,ariaLabelledBy:n.string,ariaDescribedBy:n.string,max:n.instanceOf(Date),min:n.instanceOf(Date),navigation:n.bool,smoothScroll:n.bool,onBlur:n.func,onChange:n.func,onFocus:n.func,tabIndex:n.number,value:n.instanceOf(Date),weekNumber:n.bool,topView:(i,t,e)=>{const s=i[t],a=i.bottomView;return s&&a&&C[s]<C[a]?new Error(`Invalid prop + ${t} suplied to ${e}.
|
|
12
12
|
${t} can not be smaller than bottomView.
|
|
13
13
|
`):null},bottomView:(i,t,e)=>{const s=i[t],a=i.topView;return s&&a&&C[s]>C[a]?new Error(`Invalid prop + ${t} suplied to ${e}.
|
|
14
14
|
${t} can not be bigger than topView.
|
|
15
|
-
`):null}},rt.defaultProps={disabled:!1,min:it,max:st,navigation:!0,defaultActiveView:"month",defaultValue:null,topView:"century",bottomView:"month"};const ci=d.createPropsContext(),te=d.withIdHOC(d.withPropsContext(ci,rt));te.displayName="KendoReactCalendar",x.registerForIntl(rt);class Vs{constructor(){this.symbols="",this.partMap=[]}}const ks="d",Ns="wide",ys=(i,t,e,s)=>{const a=i[s+i.length-e.length],r=i.substring(0,s+i.length-e.length),h=e.substring(0,s),u=[];if(r===h&&s>0)return u.push([t[s-1],h[s-1]]),u;if(r.indexOf(h)===0&&(h.length===0||t[h.length-1]!==t[h.length])){let c="";h.length===1&&u.push([t[0],h[0]]);for(let m=h.length;m<r.length;m++)t[m]!==c&&t[m]!=="_"&&(c=t[m],u.push([c,""]));return u}if(h.indexOf(r)===0||t[s-1]==="_"){let c=t[0];for(let m=Math.max(0,r.length-1);m<t.length;m++)if(t[m]!=="_"){c=t[m];break}return[[c,h[s-1]]]}return h[h.length-1]===" "||h[h.length-1]===a?[[t[s-1],"_"]]:[[t[s-1],h[s-1]]]},Ms=(i,t)=>(i[t.pattern[0]]=t.type,i),_s=(i,t,e)=>i===null||!(t&&t>i||e&&e<i),Fs=["k-widget","k-dateinput"];class Ls{constructor(t,e,s){this.year=!0,this.month=!0,this.date=!0,this.hours=!0,this.minutes=!0,this.seconds=!0,this.milliseconds=!0,this.leadingZero=null,this.typedMonthPart="",this.knownParts="adHhmMsEy",this.symbols={E:"E",H:"H",M:"M",a:"a",d:"d",h:"h",m:"m",s:"s",y:"y"},this._value=l.getDate(new Date),this.intlProvider=t,this.formatPlaceholder=e,this.format=s,this.monthNames=this.allFormatedMonths()}get intl(){return this.intlProvider()}get value(){return this._value}setValue(t){t?l.isEqual(t,this._value)||(this._value=l.cloneDate(t),this.modifyExisting(!0)):(this._value=l.getDate(new Date),this.modifyExisting(!1))}hasValue(){const t=(e,s)=>e||s.type!=="literal"&&s.type!=="dayperiod"&&this.getExisting(s.pattern[0]);return this.intl.splitDateFormat(this.format).reduce(t,!1)}getDateObject(){for(let t=0;t<this.knownParts.length;t++)if(!this.getExisting(this.knownParts[t]))return null;return l.cloneDate(this.value)}getTextAndFormat(){return this.merge(this.intl.formatDate(this.value,this.format),this.dateFormatString(this.value,this.format))}modifyExisting(t){const e=this.dateFormatString(this.value,this.format).symbols;for(let s=0;s<e.length;s++)this.setExisting(e[s],t)}getExisting(t){switch(t){case"y":return this.year;case"M":case"L":return this.month;case"d":return this.date;case"E":return this.date&&this.month&&this.year;case"h":case"H":return this.hours;case"m":return this.minutes;case"s":return this.seconds;default:return!0}}setExisting(t,e){switch(t){case"y":this.year=e,e===!1&&this._value.setFullYear(2e3);break;case"M":this.month=e,e===!1&&this._value.setMonth(0);break;case"d":this.date=e;break;case"h":case"H":this.hours=e;break;case"m":this.minutes=e;break;case"s":this.seconds=e;break;default:return}}modifyPart(t,e){let s=l.cloneDate(this.value);switch(t){case"y":s.setFullYear(s.getFullYear()+e);break;case"M":s=l.addMonths(this.value,e);break;case"d":case"E":s.setDate(s.getDate()+e);break;case"h":case"H":s.setHours(s.getHours()+e);break;case"m":s.setMinutes(s.getMinutes()+e);break;case"s":s.setSeconds(s.getSeconds()+e);break;case"a":s.setHours(s.getHours()+12*e);break}this.setExisting(t,!0),this._value=s}parsePart(t,e){if(this.resetLeadingZero(),!e)return this.setExisting(t,!1),{value:null};const s=this.intl.formatDate(this.value,this.format),a=this.dateFormatString(this.value,this.format),r=a.symbols;let h=!1,u="",c="",m="";for(let w=0;w<s.length;w++)r[w]===t?(c+=this.getExisting(t)?s[w]:"0",h=!0):h?m+=s[w]:u+=s[w];let f=null;const g=this.matchMonth(e);for(;c.length>0&&c.charAt(0)==="0";)c=c.slice(1);c.length>=4&&(c="");for(let w=0;w<2;w++){let v=c+e,E=parseInt(v,10);if(f=this.intl.parseDate(u+v+m,this.format),!f&&!isNaN(E)&&!isNaN(parseInt(e,10))){if(t==="M"&&!g){const V=E-1;V>-1&&V<12&&(f=l.cloneDate(this.value),f.setMonth(V),f.getMonth()!==V&&(f=l.lastDayOfMonth(l.addMonths(f,-1))))}t==="y"&&(f=l.createDate(parseInt(v,10),this.month?this.value.getMonth():0,this.date?this.value.getDate():1,this.hours?this.value.getHours():0,this.minutes?this.value.getMinutes():0,this.seconds?this.value.getSeconds():0,this.milliseconds?this.value.getMilliseconds():0),this.date&&f.getDate()!==this.value.getDate()&&(f=l.lastDayOfMonth(l.addMonths(f,-1))))}if(f)return this._value=f,this.setExisting(t,!0),{value:this.value};c=""}return g&&(f=this.intl.parseDate(u+g+m,this.format),f)?(this._value=f,this.setExisting(t,!0),{value:this.value}):(e==="0"&&(this.leadingZero=this.isAbbrMonth(a.partMap,t)?null:{[t]:!0},this.setExisting(t,!1)),{value:null})}symbolMap(t){return this.intl.splitDateFormat(this.format).reduce(Ms,{})[t]}resetLeadingZero(){const t=this.leadingZero!==null;return this.leadingZero=null,t}isAbbrMonth(t,e){const s=this.partPattern(t,e);return s.type==="month"&&s.names}partPattern(t,e){return t.filter(s=>s.pattern.indexOf(e)!==-1)[0]}matchMonth(t){if(this.typedMonthPart+=t.toLowerCase(),this.monthNames.length===0)return"";for(;this.typedMonthPart.length>0;){for(let s=0;s<this.monthNames.length;s++)if(this.monthNames[s].toLowerCase().indexOf(this.typedMonthPart)===0)return this.monthNames[s];const e=parseInt(this.typedMonthPart,10);if(e>=1&&e<=12&&e.toString()===this.typedMonthPart)return this.monthNames[e-1];this.typedMonthPart=this.typedMonthPart.substring(1,this.typedMonthPart.length)}return""}allFormatedMonths(){const t=this.intl.splitDateFormat(this.format);for(let e=0;e<t.length;e++)if(t[e].type==="month"&&t[e].names)return this.intl.dateFormatNames(t[e].names);return[]}dateFormatString(t,e){const s=this.intl.splitDateFormat(e),a=[],r=[];for(let u=0;u<s.length;u++){let c=this.intl.formatDate(t,{pattern:s[u].pattern}).length;for(;c>0;)a.push(this.symbols[s[u].pattern[0]]||"_"),r.push(s[u]),c--}const h=new Vs;return h.symbols=a.join(""),h.partMap=r,h}merge(t,e){let s="",a="",r=e.symbols;for(let h=r.length-1;h>=0;h--)if(this.knownParts.indexOf(r[h])===-1||this.getExisting(r[h]))s=t[h]+s,a=r[h]+a;else{const u=r[h];for(;h>=0&&u===r[h];)h--;for(h++,this.leadingZero&&this.leadingZero[u]?s="0"+s:s=this.dateFieldName(e.partMap[h])+s;a.length<s.length;)a=r[h]+a}return{text:s,format:a}}dateFieldName(t){const e=this.formatPlaceholder||"wide";return e[t.type]?e[t.type]:e==="formatPattern"?t.pattern:this.intl.dateFieldName(Object.assign(t,{nameType:e}))}}const j={dayperiod:"dayperiod",hour:"hour",millisecond:"millisecond",minute:"minute",second:"second"},Oe=i=>(t,e)=>{const s=l.cloneDate(t);return s[i](e),s},ui=[{type:j.hour,getter:i=>i.getHours()},{type:j.minute,getter:i=>i.getMinutes()},{type:j.second,getter:i=>i.getSeconds()},{type:j.millisecond,getter:i=>i.getMilliseconds()}],As=i=>(t,e)=>i(t),Hs=i=>(t,e)=>i(e),Bs=i=>i.reduce((t,e)=>(t[e.type]=e.type,t),{}),zs=i=>t=>i[t.type]?Hs(t.getter):As(t.getter),qs=i=>t=>i.map(zs(Bs(t))),Rs=(i,t,e,s)=>a=>{const r=i(a),h=i(e);return s==="hour"?r-(r-h)%t:a.getTime()<=e.getTime()&&r!==0&&r<=h?Math.ceil(r/t)*t:r-r%t},Ws=i=>(t,e)=>i.map(s=>{const a=Math.floor(t[s.type]);return a?Rs(s.getter,a,e,s.type):s.getter}),Ks=qs(ui),di=Ws(ui),Us=i=>(t,e)=>(t.setHours(...i.map(s=>s(t,e))),t),mi=i=>t=>{const e=l.cloneDate(t);return e.setHours(...i.map(s=>s(e))),e},ee=Oe("setHours"),ie=Oe("setMinutes"),se=Oe("setSeconds"),ut=()=>new Date,Ve=(i,t,e=1)=>{const s=[];for(let a=i;a<t;a=a+e)s.push(a);return s},ke=(i,t,e)=>({candidateValue:R(B,i),maxValue:l.addDays(R(B,e),t.getHours()<e.getHours()?0:1),minValue:R(B,t)}),Ys=(i,t,e)=>{if(!i||!t||!e)return i;const{candidateValue:s,minValue:a,maxValue:r}=ke(i,t,e);return s<a?R(i,t):s>r?R(i,e):i},Ne=(i,t,e)=>{if(!i||!t||!e)return!0;const{candidateValue:s,minValue:a,maxValue:r}=ke(i,t,e);return a<=s&&s<=r},$s=(i,t,e)=>{if(i===null)return!0;const{candidateValue:s,minValue:a,maxValue:r}=ke(i,t,e);return a<=s&&s<=r},Ts=(i,t)=>{if(i===null||t===null)return!1;const e=R(B,i),s=R(B,t);return e.getTime()<s.getHours()},js=(i,t)=>{if(i===null||t===null)return!1;const e=R(B,i);return R(B,t).getTime()<e.getHours()},Zs="Please enter a valid value!",Z=class extends o.Component{constructor(i){super(i),this.kendoDate=null,this.currentFormat="",this.paste=!1,this._element=null,this._wrapper=null,this._lastSelectedSymbol="",this.focus=()=>{this._element&&this._element.focus()},this.setValidity=()=>{this.element&&this.element.setCustomValidity&&this.element.setCustomValidity(this.validity.valid?"":this.props.validationMessage||Z.defaultProps.validationMessage)},this.updateOnPaste=t=>{if(!this.element||!this.kendoDate)return;const e=x.provideIntlService(this).parseDate(this.element.value,this.props.format)||this.value,s=this.value;this.kendoDate.setValue(e),this.triggerChange(t,s)},this.spinnersMouseDown=t=>{t.preventDefault();const e=d.getActiveElement(document);this.element&&e!==this.element&&this.element.focus({preventScroll:!0})},this.handlePaste=()=>{this.paste=!0},this.elementChange=t=>{if(!this.element||!this.kendoDate)return;if(this.paste){this.updateOnPaste(t),this.paste=!1;return}const{text:e,format:s}=this.kendoDate.getTextAndFormat();this.currentFormat=s;const a=this.value,r=ys(e,this.currentFormat,this.element.value,this.selection.start),h=r.length===1&&r[0][1]==="_";if(!h)for(let u=0;u<r.length;u++)this.kendoDate.parsePart(r[u][0],r[u][1]);r.length&&r[0][0]!=="_"&&this.setSelection(this.selectionBySymbol(r[0][0])),h&&this.switchDateSegment(1),this.triggerChange(t,a)},this.elementClick=t=>{this.setSelection(this.selectionByIndex(this.selection.start))},this.nativeWheel=t=>{d.getActiveElement(document)===this.element&&t.preventDefault()},this.wheel=t=>{d.getActiveElement(document)===this.element&&(t.nativeEvent.deltaY<0&&this.increasePart(t),t.nativeEvent.deltaY>0&&this.decreasePart(t))},this.increasePart=t=>{this.modifyDateSegmentValue(1,t)},this.decreasePart=t=>{this.modifyDateSegmentValue(-1,t)},this.elementKeyDown=t=>{if(!t.altKey){switch(t.keyCode){case 37:this.switchDateSegment(-1);break;case 38:this.modifyDateSegmentValue(1,t);break;case 39:this.switchDateSegment(1);break;case 40:this.modifyDateSegmentValue(-1,t);break;default:return}t.preventDefault()}},this.elementOnFocus=t=>{this.wrapper&&this.wrapper.classList.add("k-focus"),this.setState({focused:!0})},this.elementOnBlur=t=>{this.wrapper&&this.wrapper.classList.remove("k-focus"),this.setState({focused:!1})},d.validatePackage(ft),this.state={focused:!1}}get _inputId(){return this.props.id+"-accessibility-id"}componentDidMount(){this.setValidity(),this.wrapper&&this.wrapper.addEventListener("wheel",this.nativeWheel,{passive:!1})}componentDidUpdate(i,t){this._lastSelectedSymbol&&t.focused===this.state.focused?this.setSelection(this.selectionBySymbol(this._lastSelectedSymbol)):this.props.placeholder!==void 0&&this.selection.start===this.selection.end&&this.setSelection({start:0,end:this.currentFormat.length}),this.setValidity()}componentWillUnmount(){this.wrapper&&this.wrapper.removeEventListener("wheel",this.nativeWheel)}render(){const{size:i=Z.defaultProps.size,fillMode:t=Z.defaultProps.fillMode,rounded:e=Z.defaultProps.rounded}=this.props;this.props._ref&&(this.props._ref.current=this);const s=x.provideLocalizationService(this),a={...Z.defaultProps,...this.props},{name:r,label:h,id:u}=a,c=this.text,m=c===this.props.placeholder?"":c,f=c===this.props.placeholder?c:void 0,g=u||this._inputId,w=!this.validityStyles||this.validity.valid;let v=[...Fs];this.props.className&&v.push(this.props.className);const E=o.createElement(d.AsyncFocusBlur,{onFocus:this.elementOnFocus,onBlur:this.elementOnBlur},({onFocus:V,onBlur:N})=>o.createElement("span",{ref:S=>{this._wrapper=S},style:h?void 0:{width:this.props.width},dir:this.props.dir,className:d.classNames("k-dateinput","k-input",{[`k-input-${d.kendoThemeMaps.sizeMap[i]||i}`]:i,[`k-input-${t}`]:t,[`k-rounded-${d.kendoThemeMaps.roundedMap[e]||e}`]:e,"k-invalid":!w,"k-required":this.required,"k-disabled":this.props.disabled},this.props.className),onFocus:V,onBlur:N},o.createElement("input",{role:this.props.ariaRole||"textbox",readOnly:this.props.readonly,tabIndex:this.props.tabIndex,disabled:this.props.disabled,title:this.props.title!==void 0?this.props.title:c,type:"text",spellCheck:!1,autoComplete:"off",autoCorrect:"off",className:"k-input-inner",id:g,"aria-label":this.props.ariaLabel,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,"aria-haspopup":this.props.ariaHasPopup,"aria-disabled":this.props.disabled,"aria-expanded":this.props.ariaExpanded,"aria-controls":this.props.ariaControls,onWheel:this.wheel,onClick:this.elementClick,onInput:this.elementChange,onPaste:this.handlePaste,onKeyDown:this.elementKeyDown,onChange:d.noop,value:m,placeholder:f,name:r,ref:S=>this._element=S}),this.props.children,this.props.spinners&&o.createElement("span",{className:"k-input-spinner k-spin-button",onMouseDown:this.spinnersMouseDown},o.createElement(L.Button,{tabIndex:-1,type:"button",rounded:null,className:"k-spinner-increase",icon:"caret-alt-up",svgIcon:J.caretAltUpIcon,"aria-label":s.toLanguageString(wt,k[wt]),title:s.toLanguageString(wt,k[wt]),onClick:this.increasePart}),o.createElement(L.Button,{tabIndex:-1,type:"button",rounded:null,className:"k-spinner-decrease",icon:"caret-alt-down",svgIcon:J.caretAltDownIcon,"aria-label":s.toLanguageString(bt,k[bt]),title:s.toLanguageString(bt,k[bt]),onClick:this.decreasePart}))));return h?o.createElement(Ye.FloatingLabel,{label:h,editorId:g,editorValue:c,editorValid:w,editorDisabled:this.props.disabled,children:E,style:{width:this.props.width}}):E}get value(){return this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.kendoDate&&this.kendoDate.getDateObject()}get name(){return this.props.name}get min(){return this.props.min!==void 0?this.props.min:Z.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:Z.defaultProps.max}get text(){const i={...ot.defaultProps,...this.props},{formatPlaceholder:t=Z.defaultProps.formatPlaceholder,format:e=Z.defaultProps.format,value:s,defaultValue:a}=i;this.kendoDate===null?(this.kendoDate=new Ls(this.intl.bind(this),t,e),this.kendoDate.setValue(s||a||null)):(this.kendoDate.format=e,this.kendoDate.formatPlaceholder=t),s!==void 0&&this.value!==s&&this.kendoDate.setValue(s);const{text:r,format:h}=this.kendoDate.getTextAndFormat();return this.currentFormat=h,i.placeholder!==null&&i.placeholder!==void 0&&!this.state.focused&&!this.kendoDate.hasValue()?i.placeholder:r}get validity(){const i=_s(this.value,this.min,this.max)&&Ne(this.value,this.props.minTime,this.props.maxTime),t=this.props.validationMessage!==void 0,e=(!this.required||this.value!==null)&&i,s=this.props.valid!==void 0?this.props.valid:e;return{customError:t,rangeOverflow:this.value&&this.max.getTime()<this.value.getTime()||!1,rangeUnderflow:this.value&&this.value.getTime()<this.min.getTime()||!1,valid:s,valueMissing:this.value===null}}get element(){return this._element}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:Z.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:Z.defaultProps.required}get wrapper(){return this._wrapper}intl(){return x.provideIntlService(this)}get selection(){let i={start:0,end:0};return this.element!==null&&this.element.selectionStart!==void 0&&(i={start:this.element.selectionStart,end:this.element.selectionEnd}),i}setSelection(i){this._lastSelectedSymbol=this.currentFormat[i.start],window.requestAnimationFrame(()=>{const t=d.getActiveElement(document);this.element&&t===this.element&&!this.props.disableSelection&&this.element.setSelectionRange(i.start,i.end)})}triggerChange(i,t){this.valueDuringOnChange=this.value,this.forceUpdate(),this.props.onChange&&!l.isEqual(t,this.value)&&this.props.onChange.call(void 0,{syntheticEvent:i,nativeEvent:i.nativeEvent,value:this.value,target:this}),this.valueDuringOnChange=void 0}selectionBySymbol(i){let t=-1,e=0;for(let s=0;s<this.currentFormat.length;s++)this.currentFormat[s]===i&&(e=s+1,t===-1&&(t=s));return t<0&&(t=0),{start:t,end:e}}selectionByIndex(i){let t={start:i,end:i};for(let e=i,s=i-1;e<this.currentFormat.length||s>=0;e++,s--){if(e<this.currentFormat.length&&this.currentFormat[e]!=="_"){t=this.selectionBySymbol(this.currentFormat[e]);break}if(s>=0&&this.currentFormat[s]!=="_"){t=this.selectionBySymbol(this.currentFormat[s]);break}}return t}switchDateSegment(i){const{start:t,end:e}=this.selection;if(t<e&&this.currentFormat[t]!==this.currentFormat[e-1]){this.setSelection(this.selectionByIndex(i>0?t:e-1));return}const s=this.currentFormat[t];let a=t+i;for(;a>0&&a<this.currentFormat.length&&!(this.currentFormat[a]!==s&&this.currentFormat[a]!=="_");)a+=i;if(this.currentFormat[a]==="_")return;let r=a;for(;r>=0&&r<this.currentFormat.length&&this.currentFormat[r]===this.currentFormat[a];)r+=i;a>r&&(r+1!==t||a+1!==e)?this.setSelection({start:r+1,end:a+1}):a<r&&(a!==t||r!==e)&&this.setSelection({start:a,end:r})}modifyDateSegmentValue(i,t){if(!this.kendoDate)return;const e=this.value,s=this.currentFormat[this.selection.start],a=this.kendoDate.symbolMap(s),r=((this.props.steps||{})[a]||1)*i;this.kendoDate.modifyPart(s,r),this.triggerChange(t,e)}};let lt=Z;lt.displayName="DateInput",lt.propTypes={value:n.instanceOf(Date),format:n.oneOfType([n.string,n.shape({skeleton:n.string,pattern:n.string,date:n.oneOf(["short","medium","long","full"]),time:n.oneOf(["short","medium","long","full"]),datetime:n.oneOf(["short","medium","long","full"]),era:n.oneOf(["narrow","short","long"]),year:n.oneOf(["numeric","2-digit"]),month:n.oneOf(["numeric","2-digit","narrow","short","long"]),day:n.oneOf(["numeric","2-digit"]),weekday:n.oneOf(["narrow","short","long"]),hour:n.oneOf(["numeric","2-digit"]),hour12:n.bool,minute:n.oneOf(["numeric","2-digit"]),second:n.oneOf(["numeric","2-digit"]),timeZoneName:n.oneOf(["short","long"])})]),formatPlaceholder:n.oneOfType([n.oneOf(["wide","narrow","short","formatPattern"]),n.shape({year:n.string,month:n.string,day:n.string,hour:n.string,minute:n.string,second:n.string})]),width:n.oneOfType([n.string,n.number]),tabIndex:n.number,title:n.string,steps:n.shape({year:n.number,month:n.number,day:n.number,hour:n.number,minute:n.number,second:n.number}),min:n.instanceOf(Date),max:n.instanceOf(Date),disabled:n.bool,spinners:n.bool,name:n.string,dir:n.string,label:n.string,id:n.string,ariaLabelledBy:n.string,ariaDescribedBy:n.string,ariaLabel:n.string,ariaRole:n.string,ariaHasPopup:n.oneOfType([n.bool,n.string]),ariaExpanded:n.oneOfType([n.bool]),onChange:n.func,validationMessage:n.string,required:n.bool,validate:n.bool,valid:n.bool,size:n.oneOf([null,"small","medium","large"]),rounded:n.oneOf([null,"small","medium","large","full"]),fillMode:n.oneOf([null,"solid","flat","outline"])},lt.defaultProps={format:ks,size:"medium",rounded:"medium",fillMode:"solid",formatPlaceholder:Ns,spinners:!1,disabled:!1,max:l.cloneDate(st),min:l.cloneDate(it),minTime:l.cloneDate(ct),maxTime:l.cloneDate(nt),required:!1,validityStyles:!0,validationMessage:Zs,placeholder:null,ariaHasPopup:"grid"};const pi=d.createPropsContext(),ot=d.withIdHOC(d.withPropsContext(pi,lt));ot.displayName="KendoReactDateInput",x.registerForIntl(lt),x.registerForLocalization(lt);const fi=L.Button,gi=o.forwardRef((i,t)=>{const{_ref:e}=i,s=o.useRef(null);o.useImperativeHandle(t,()=>s.current),o.useImperativeHandle(e,()=>s.current);const a=o.useMemo(()=>d.classNames(i.className,"k-picker-wrap"),[i.className]);return o.createElement("span",{ref:s,id:i.id,style:i.style,className:a,tabIndex:i.tabIndex},i.children)}),Gs=i=>{const[t,e]=o.useState(!1),s=()=>{i.current&&e(!!i.current.text)};return o.useEffect(s),{editorValue:t}},ye=i=>{const t=Gs(i.dateInput);return o.createElement(Ye.FloatingLabel,{...i,...t})},vi=500,ne=i=>{const{footer:t,children:e,windowWidth:s=0,navigatable:a,navigatableElements:r,expand:h,animation:u,onClose:c,adaptiveTitle:m,mobileFilter:f}=i,g={navigatable:a||!1,navigatableElements:r||[],expand:h,animation:u!==!1,onClose:c,animationStyles:s<=vi?{top:0,width:"100%",height:"100%"}:void 0,className:s<=vi?"k-adaptive-actionsheet k-actionsheet-fullscreen":"k-adaptive-actionsheet k-actionsheet-bottom"};return o.createElement(ht.ActionSheet,{...g},o.createElement(ht.ActionSheetHeader,{className:"k-text-center"},o.createElement("div",{className:"k-actionsheet-titlebar-group k-hbox"},o.createElement("div",{className:"k-actionsheet-title"},o.createElement("div",null,m)),o.createElement("div",{className:"k-actionsheet-actions"},o.createElement(L.Button,{tabIndex:0,"aria-label":"Cancel","aria-disabled":"false",type:"button",fillMode:"flat",icon:"x",svgIcon:J.xIcon,onClick:c}))),f&&o.createElement("div",{className:"k-actionsheet-titlebar-group k-actionsheet-filter"},f)),e,t&&o.createElement(ht.ActionSheetFooter,{className:"k-actions k-actions-stretched"},o.createElement(L.Button,{size:"large",tabIndex:0,"aria-label":t.cancelText,"aria-disabled":"false",type:"button",onClick:t.onCancel},t.cancelText),o.createElement(L.Button,{tabIndex:0,themeColor:"primary",size:"large","aria-label":t.applyText,"aria-disabled":"false",type:"button",onClick:t.onApply},t.applyText)))},ae=768,W=class extends o.Component{constructor(i){super(i),this._element=null,this._dateInput=o.createRef(),this._calendar=null,this.shouldFocusDateInput=!1,this.prevShow=!1,this.focus=()=>{this.dateInput&&this.dateInput.focus()},this.setCalendarRef=t=>{this._calendar=t},this.nextValue=(t,e)=>t.value!==void 0?t.value:e.value,this.nextShow=(t,e)=>t.show!==void 0?t.show:e.show,this.renderPopup=()=>{const{disabled:t,min:e,max:s,weekNumber:a,focusedDate:r}=this.props,{popupClass:h,...u}=this.props.popupSettings,c=this.show,m=this.value,f=m&&l.getDate(m),g=d.classNames("k-calendar-container k-group k-reset",h),w={popupClass:"k-datepicker-popup",show:c,anchor:this._element,className:g,id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},...u},v={disabled:t,value:f,min:e,max:s,weekNumber:a,focusedDate:r,className:this.mobileMode?"k-calendar-lg":"",navigation:!this.mobileMode,onChange:this.handleCalendarValueChange};return this.mobileMode?o.createElement(this.calendarComp,{_ref:this.setCalendarRef,...v}):o.createElement(this.popupComp,{...w},o.createElement(this.calendarComp,{_ref:this.setCalendarRef,...v}))},this.renderAdaptivePopup=()=>{const{windowWidth:t=0}=this.state,e={expand:this.show,onClose:this.handleBlur,adaptiveTitle:this.props.adaptiveTitle,windowWidth:t};return o.createElement(ne,{...e},o.createElement(ht.ActionSheetContent,{className:"!k-overflow-hidden"},this.renderPopup()))},this.handleInputValueChange=t=>{this.handleValueChange(t.value,t)},this.handleCalendarValueChange=t=>{const e=this.mergeTime(t.value);this.handleValueChange(e,t)},this.handleValueChange=(t,e)=>{this.setState({value:l.cloneDate(t||void 0)}),this.valueDuringOnChange=t,this.showDuringOnChange=!1,this.mobileMode||(this.shouldFocusDateInput=!0);const{onChange:s}=this.props;s&&s.call(void 0,{syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,value:this.value,show:this.show,target:this}),this.valueDuringOnChange=void 0,this.showDuringOnChange=void 0,this.setShow(!1)},this.handleFocus=()=>{this.setState({focused:!0})},this.handleBlur=()=>{this.setState({focused:!1}),this.setShow(!1)},this.handleIconClick=()=>{this.props.disabled||(this.shouldFocusDateInput=!0,this.setShow(!this.show))},this.handleIconMouseDown=t=>{t.preventDefault()},this.handleKeyDown=t=>{const{altKey:e,keyCode:s}=t;if(s===d.Keys.esc){this.shouldFocusDateInput=!0,this.setShow(!1);return}e&&(s===d.Keys.up||s===d.Keys.down)&&(t.preventDefault(),t.stopPropagation(),this.shouldFocusDateInput=s===d.Keys.up,this.setShow(s===d.Keys.down))},d.validatePackage(ft),this.state={value:this.props.defaultValue||W.defaultProps.defaultValue,show:this.props.defaultShow||W.defaultProps.defaultShow,focused:!1}}get _popupId(){return this.props.id+"-popup-id"}get document(){if(d.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get mobileMode(){return!!(this.state.windowWidth&&this.state.windowWidth<=ae&&this.props.adaptive)}get dateInput(){return this._dateInput.current}get calendar(){return this._calendar}get value(){const i=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value;return i!==null?l.cloneDate(i):null}get show(){return this.showDuringOnChange!==void 0?this.showDuringOnChange:this.props.show!==void 0?this.props.show:this.state.show}get name(){return this.props.name}get min(){return this.props.min!==void 0?this.props.min:W.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:W.defaultProps.max}get dateInputComp(){return this.props.dateInput||W.defaultProps.dateInput}get toggleButtonComp(){return this.props.toggleButton||W.defaultProps.toggleButton}get calendarComp(){return this.props.calendar||W.defaultProps.calendar}get popupComp(){return this.props.popup||W.defaultProps.popup}get pickerWrapComp(){return this.props.pickerWrap||W.defaultProps.pickerWrap}get validity(){const i=je(this.value,this.min,this.max),t=this.props.validationMessage!==void 0,e=(!this.required||this.value!==null)&&i,s=this.props.valid!==void 0?this.props.valid:e;return{customError:t,rangeOverflow:this.value&&this.max.getTime()<this.value.getTime()||!1,rangeUnderflow:this.value&&this.value.getTime()<this.min.getTime()||!1,valid:s,valueMissing:this.value===null}}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:W.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:W.defaultProps.required}componentDidMount(){var i;this.observerResize=d.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.show&&this.forceUpdate(),(i=this.document)!=null&&i.body&&this.observerResize&&this.observerResize.observe(this.document.body)}componentDidUpdate(){this._calendar&&this._calendar.element&&this.show&&!this.prevShow&&this._calendar.element.focus({preventScroll:!0}),this.dateInput&&this.dateInput.element&&!this.show&&this.shouldFocusDateInput&&this.dateInput.element.focus({preventScroll:!0}),this.prevShow=this.show,this.shouldFocusDateInput=!1}componentWillUnmount(){var i;clearTimeout(this.nextTickId),(i=this.document)!=null&&i.body&&this.observerResize&&this.observerResize.disconnect()}render(){const{size:i=W.defaultProps.size,rounded:t=W.defaultProps.rounded,fillMode:e=W.defaultProps.fillMode,disabled:s,tabIndex:a,title:r,id:h,format:u,formatPlaceholder:c,min:m,max:f,className:g,width:w,name:v,validationMessage:E,required:V,validityStyles:N,ariaLabelledBy:S,ariaDescribedBy:y,ariaLabel:b}=this.props,K=this.show,M=this.value,F=!this.validityStyles||this.validity.valid,U={disabled:s,format:u,formatPlaceholder:c,id:h,ariaLabelledBy:S,ariaDescribedBy:y,ariaLabel:b,max:f,min:m,name:v,onChange:this.handleInputValueChange,required:V,tabIndex:K?-1:a,title:r,valid:this.validity.valid,validationMessage:E,validityStyles:N,value:M,label:void 0,placeholder:this.state.focused?null:this.props.placeholder,ariaExpanded:this.show,size:null,fillMode:null,rounded:null},O=x.provideLocalizationService(this).toLanguageString(Zt,k[Zt]),_=o.createElement(d.AsyncFocusBlur,{onFocus:this.handleFocus,onBlur:this.mobileMode?void 0:this.handleBlur,onSyncBlur:this.props.onBlur,onSyncFocus:this.props.onFocus},({onFocus:tt,onBlur:X})=>o.createElement(o.Fragment,null,o.createElement("span",{ref:pt=>{this._element=pt},className:d.classNames("k-input","k-datepicker",{[`k-input-${d.kendoThemeMaps.sizeMap[i]||i}`]:i,[`k-rounded-${d.kendoThemeMaps.roundedMap[t]||t}`]:t,[`k-input-${e}`]:e,["k-invalid"]:!F,["k-required"]:this.required,["k-disabled"]:this.props.disabled},g),onKeyDown:this.handleKeyDown,style:{width:w},onFocus:tt,onBlur:X,onClick:this.mobileMode?this.handleIconClick:void 0},o.createElement(this.dateInputComp,{_ref:this._dateInput,ariaRole:"combobox",readonly:this.mobileMode,ariaExpanded:this.show,ariaControls:this._popupId,...U}),o.createElement(this.toggleButtonComp,{type:"button",icon:"calendar",svgIcon:J.calendarIcon,title:O,className:"k-input-button",rounded:null,onClick:this.mobileMode?void 0:this.handleIconClick,"aria-label":O,onMouseDown:this.handleIconMouseDown}),!this.mobileMode&&this.renderPopup()),this.mobileMode&&this.renderAdaptivePopup()));return this.props.label?o.createElement(ye,{dateInput:this._dateInput,label:this.props.label,editorId:h,editorValid:F,editorDisabled:this.props.disabled,children:_,style:{width:this.props.width}}):_}setShow(i){const{onOpen:t,onClose:e}=this.props;this.show!==i&&(this.setState({show:i}),i&&t&&t.call(void 0,{target:this}),!i&&e&&e.call(void 0,{target:this}))}mergeTime(i){return this.value&&i?R(i,this.value):i}nextTick(i){clearTimeout(this.nextTickId),this.nextTickId=window.setTimeout(()=>i())}calculateMedia(i){for(let t of i)this.setState({windowWidth:t.target.clientWidth})}};let xt=W;xt.displayName="DatePicker",xt.propTypes={className:n.string,defaultShow:n.bool,defaultValue:n.instanceOf(Date),disabled:n.bool,focusedDate:n.instanceOf(Date),format:n.oneOfType([n.string,n.shape({skeleton:n.string,pattern:n.string,date:n.oneOf(["short","medium","long","full"]),time:n.oneOf(["short","medium","long","full"]),datetime:n.oneOf(["short","medium","long","full"]),era:n.oneOf(["narrow","short","long"]),year:n.oneOf(["numeric","2-digit"]),month:n.oneOf(["numeric","2-digit","narrow","short","long"]),day:n.oneOf(["numeric","2-digit"]),weekday:n.oneOf(["narrow","short","long"]),hour:n.oneOf(["numeric","2-digit"]),hour12:n.bool,minute:n.oneOf(["numeric","2-digit"]),second:n.oneOf(["numeric","2-digit"]),timeZoneName:n.oneOf(["short","long"])})]),formatPlaceholder:n.oneOfType([n.oneOf(["wide","narrow","short","formatPattern"]),n.shape({year:n.string,month:n.string,day:n.string,hour:n.string,minute:n.string,second:n.string})]),id:n.string,ariaLabelledBy:n.string,ariaDescribedBy:n.string,ariaLabel:n.string,min:n.instanceOf(Date),max:n.instanceOf(Date),name:n.string,popupSettings:n.shape({animate:n.bool,appendTo:n.any,popupClass:n.string}),show:n.bool,tabIndex:n.number,title:n.string,value:n.instanceOf(Date),weekNumber:n.bool,width:n.oneOfType([n.number,n.string]),validationMessage:n.string,required:n.bool,validate:n.bool,valid:n.bool,size:n.oneOf([null,"small","medium","large"]),rounded:n.oneOf([null,"small","medium","large","full"]),fillMode:n.oneOf([null,"solid","flat","outline"]),adaptive:n.bool,adaptiveTitle:n.string},xt.defaultProps={defaultShow:!1,defaultValue:null,dateInput:ot,calendar:te,toggleButton:fi,popup:Wt.Popup,pickerWrap:gi,disabled:!1,format:"d",max:st,min:it,popupSettings:{},tabIndex:0,weekNumber:!1,required:!1,validityStyles:!0,size:"medium",rounded:"medium",fillMode:"solid"};const wi=d.createPropsContext(),bi=d.withIdHOC(d.withPropsContext(wi,xt));bi.displayName="KendoReactDatePicker",x.registerForLocalization(xt);const Me=(i,t)=>{const e=l.cloneDate(i);return e.setHours(t),e},_e=i=>i!==null&&i<12,Xs=i=>i!==null&&(!i||i>11),Js=(i,t,e)=>!t&&!e||i>=t&&i<=e,Qs=(i,t,e)=>!t&&!e||i>=t||i<=e;class Si{constructor(t){this.intl=t,this.min=null,this.max=null,this.part=null}apply(t,e){const s=t.getHours(),a=_e(s),r=_e(e.getHours());if(a&&r||!a&&!r)return t;const[h,u=24]=this.normalizedRange(),c=s+(r?-12:12);return Me(t,Math.min(Math.max(h,c),u||24))}configure(t){const{min:e=this.min,max:s=this.max,part:a=this.part}=t;this.min=e,this.max=s,this.part=a}data(t){const e=this.part&&this.part.names;if(!e||!this.min)return[];const s=[],[a,r]=this.normalizedRange(),h=this.intl.dateFormatNames(e);return _e(a)&&s.push({text:h.am,value:Me(this.min,a)}),Xs(r)&&s.push({text:h.pm,value:Me(this.min,Math.max(12,r))}),this.min.getHours()!==a?s.reverse():s}isRangeChanged(t,e){return!1}limitRange(t,e,s){return[t,e]}total(){const[t,e]=this.normalizedRange();return!t&&!e?2:t>11||e<12?1:2}selectedIndex(t){if(!this.valueInList(t)||!this.min)return-1;const e=Math.floor(t.getHours()/12);return this.min.getHours()===this.normalizedRange()[0]?e:e===0?1:0}valueInList(t){return!this.min||!this.max?!1:(this.min.getHours()!==this.normalizedRange()[0]?Qs:Js)(t.getHours(),this.min.getHours(),this.max.getHours())}normalizedRange(){const t=this.min.getHours(),e=this.max.getHours();return[Math.min(t,e),Math.max(t,e)]}}class Ps{constructor(){this.itemHeight=0,this.timeListHeight=0,this.didCalculate=!1}ensureHeights(){this.timeListHeight===void 0&&this.calculateHeights()}calculateHeights(t){if(!d.canUseDOM)return;const e=$("div"),s=$("span"),a=$("ul"),r=$("li"),h=()=>r("<span>02</span>","k-item"),u=()=>a([h()],"k-reset"),c=()=>e([u()],"k-content k-scrollable k-time-container"),f=(()=>e([s("minute","k-title"),e([c()],"k-time-list")],"k-time-list-wrapper",{left:"-10000px",position:"absolute"}))(),w=t&&t.querySelector(".k-time-container")||document.body,v=w.appendChild(f);this.timeListHeight=v.querySelector(".k-scrollable").offsetHeight,this.itemHeight=v.querySelector("li").offsetHeight,w.removeChild(v),this.didCalculate=!0}}const Fe=24,Di=(i=>t=>t%i)(Fe),tn=(i,t)=>e=>Di(i+e*t),Ii=(i,t)=>Di(Fe+i-t),xi=i=>(t,e)=>!e||l.getDate(t).getTime()===l.getDate(e).getTime()?t:ee(t,i),en=xi(0),sn=xi(Fe-1);class Ci{constructor(t){this.intl=t,this.boundRange=!1,this.insertUndividedMax=!1,this.min=null,this.max=null,this.step=0,this.toListItem=null}apply(t,e){return ee(t,e.getHours())}configure(t){const{boundRange:e=this.boundRange,insertUndividedMax:s=this.insertUndividedMax,min:a=this.min,max:r=this.max,part:h,step:u=this.step}=t;this.boundRange=e,this.insertUndividedMax=s,this.toListItem=c=>{const m=ee(B,c);return{text:this.intl.formatDate(m,h.pattern),value:m}},this.min=a,this.max=r,this.step=u}data(t){const[e]=this.range(t),s=tn(e,this.step),a=h=>this.toListItem&&this.toListItem(s(h)),r=Ve(0,this.countFromMin(t)).map(a);return this.addLast(r),t&&this.addMissing(r,t),r}isRangeChanged(t,e){return!this.min||!this.max?!1:!l.isEqual(this.min,t)||!l.isEqual(this.max,e)}limitRange(t,e,s){return this.boundRange?[en(t,s),sn(e,s)]:[t,e]}total(t){const e=this.insertUndividedMax&&this.isLastMissing(t)?1:0,s=this.isMissing(t)?1:0;return this.countFromMin(t)+s+e}selectedIndex(t){return Math.ceil(this.divideByStep(t))}valueInList(t){return t?this.insertUndividedMax&&this.lastHour(t)===t.getHours()||!this.isMissing(t):!0}addLast(t,e){return this.insertUndividedMax&&this.isLastMissing(e)&&this.toListItem&&t.push(this.toListItem(this.lastHour(e))),t}addMissing(t,e){if(this.valueInList(e))return t;if(this.toListItem){const s=this.toListItem(e.getHours());t.splice(this.selectedIndex(e),0,s)}return t}countFromMin(t){const[e,s]=this.range(t);return Math.floor(Ii(s,e)/this.step)+1}isMissing(t){return t?this.selectedIndex(t)!==this.divideByStep(t):!1}isLastMissing(t){return this.max!==null&&this.isMissing(ee(this.max,this.lastHour(t)))}divideByStep(t){return Ii(t.getHours(),this.min.getHours())/this.step}lastHour(t){return this.range(t)[1]}range(t){const[e,s]=this.limitRange(this.min,this.max,t);return[e.getHours(),s.getHours()]}}const Le=60,Ei=(i=>t=>t%i)(Le),nn=(i,t)=>e=>Ei(i+e*t),Oi=(i,t)=>Ei(Le+i-t),Vi=i=>(t,e)=>!e||t.getHours()===e.getHours()?t:ie(t,i),an=Vi(0),rn=Vi(Le-1);class ki{constructor(t){this.intl=t,this.toListItem=null,this.min=null,this.max=null,this.step=0,this.insertUndividedMax=!1}apply(t,e){return ie(t,e.getMinutes())}configure(t){const{insertUndividedMax:e=this.insertUndividedMax,min:s=this.min,max:a=this.max,part:r,step:h=this.step}=t;this.insertUndividedMax=e,this.toListItem=u=>{const c=ie(B,u);return{text:this.intl.formatDate(c,r.pattern),value:c}},this.min=s,this.max=a,this.step=h}data(t){const[e]=this.range(t),s=nn(e,this.step),a=h=>this.toListItem&&this.toListItem(s(h)),r=Ve(0,this.countFromMin(t)).map(a);return this.addLast(r),t&&this.addMissing(r,t),r}isRangeChanged(t,e){return this.min!==null&&this.max!==null&&(!l.isEqual(this.min,t)||!l.isEqual(this.max,e))}limitRange(t,e,s){return[an(t,s),rn(e,s)]}total(t){const e=this.insertUndividedMax&&this.isLastMissing(t)?1:0,s=this.isMissing(t)?1:0;return this.countFromMin(t)+s+e}selectedIndex(t){return Math.ceil(this.divideByStep(t))}valueInList(t){return t?this.insertUndividedMax&&this.lastMinute(t)===t.getMinutes()||!this.isMissing(t):!0}addLast(t,e){return this.insertUndividedMax&&this.isLastMissing(e)&&this.toListItem&&t.push(this.toListItem(this.lastMinute(e))),t}addMissing(t,e){if(this.valueInList(e))return t;if(this.toListItem){const s=this.toListItem(e.getMinutes());t.splice(this.selectedIndex(e),0,s)}return t}countFromMin(t){const[e,s]=this.range(t);return Math.floor(Oi(s,e)/this.step)+1}isMissing(t){return t?this.selectedIndex(t)!==this.divideByStep(t):!1}isLastMissing(t){return this.max!==null&&this.isMissing(ie(this.max,this.lastMinute(t)))}divideByStep(t){return Oi(t.getMinutes(),this.min.getMinutes())/this.step}lastMinute(t){return this.range(t)[1]}range(t){const[e,s]=this.limitRange(this.min,this.max,t);return[e.getMinutes(),s.getMinutes()]}}const Ae=60,Ni=(i=>t=>t%i)(Ae),ln=(i,t)=>e=>Ni(i+e*t),yi=(i,t)=>Ni(Ae+i-t),Mi=i=>(t,e)=>!e||t.getMinutes()===e.getMinutes()&&t.getHours()===e.getHours()?t:se(t,i),on=Mi(0),hn=Mi(Ae-1);class _i{constructor(t){this.intl=t,this.toListItem=null,this.min=null,this.max=null,this.step=0,this.insertUndividedMax=!1}apply(t,e){return se(t,e.getSeconds())}configure(t){const{insertUndividedMax:e=this.insertUndividedMax,min:s=this.min,max:a=this.max,part:r,step:h=this.step}=t;this.insertUndividedMax=e,this.toListItem=u=>{const c=se(B,u);return{text:this.intl.formatDate(c,r.pattern),value:c}},this.min=s,this.max=a,this.step=h}data(t){const[e]=this.range(t),s=ln(e,this.step),a=h=>this.toListItem&&this.toListItem(s(h)),r=Ve(0,this.countFromMin(t)).map(a);return this.addLast(r),t&&this.addMissing(r,t),r}isRangeChanged(t,e){return this.min!==null&&this.max!==null&&(!l.isEqual(this.min,t)||!l.isEqual(this.max,e))}limitRange(t,e,s){return[on(t,s),hn(e,s)]}total(t){const e=this.insertUndividedMax&&this.isLastMissing(t)?1:0,s=this.isMissing(t)?1:0;return this.countFromMin(t)+s+e}selectedIndex(t){return Math.ceil(this.divideByStep(t))}valueInList(t){return t?this.insertUndividedMax&&this.lastSecond(t)===t.getSeconds()||!this.isMissing(t):!0}divideByStep(t){return yi(t.getSeconds(),this.min.getSeconds())/this.step}addLast(t,e){return this.insertUndividedMax&&this.isLastMissing(e)&&this.toListItem&&t.push(this.toListItem(this.lastSecond(e))),t}addMissing(t,e){if(this.valueInList(e))return t;if(this.toListItem){const s=this.toListItem(e.getSeconds());t.splice(this.selectedIndex(e),0,s)}return t}countFromMin(t){const[e,s]=this.range(t);return Math.floor(yi(s,e)/this.step)+1}isMissing(t){return t?this.selectedIndex(t)!==this.divideByStep(t):!1}isLastMissing(t){return this.max!==null&&this.isMissing(se(this.max,this.lastSecond(t)))}lastSecond(t){return this.range(t)[1]}range(t){const[e,s]=this.limitRange(this.min,this.max,t);return[e.getSeconds(),s.getSeconds()]}}const cn=2,Fi=.05,un=100,dn=0,Li=9,mn={[d.Keys.end]:(i,t)=>i[i.length-1],[d.Keys.home]:(i,t)=>i[0],[d.Keys.up]:(i,t)=>i[t-1],[d.Keys.down]:(i,t)=>i[t+1]},He={[j.dayperiod]:Si,[j.hour]:Ci,[j.minute]:ki,[j.second]:_i},Ct=class extends o.Component{constructor(i){super(i),this.intl=null,this._element=null,this.service=null,this.virtualization=null,this.topOffset=0,this.bottomOffset=0,this.itemHeight=0,this.listHeight=0,this.topThreshold=0,this.bottomThreshold=0,this.animateToIndex=!1,this.focus=t=>{Promise.resolve().then(()=>{this.element&&this.element.focus(t)})},this.itemOffset=t=>{if(!this.virtualization||!this.service)return-1;const e=this.service.selectedIndex(this.props.value),s=this.virtualization.activeIndex(),a=this.virtualization.itemOffset(s),r=Math.abs(Math.ceil(t)-a);if(e===s&&r<cn)return a;const h=e>s;return h&&r>=this.bottomThreshold||!h&&r>this.topThreshold?this.virtualization.itemOffset(s+1):a},this.calculateHeights=()=>{this.dom.didCalculate&&(this.itemHeight=this.dom.itemHeight,this.listHeight=this.dom.timeListHeight,this.topOffset=(this.listHeight-this.itemHeight)/2,this.bottomOffset=this.listHeight-this.itemHeight,this.props.mobileMode&&(this.topOffset+=Li,this.bottomOffset+=Li*2),this.topThreshold=this.itemHeight*Fi,this.bottomThreshold=this.itemHeight*(1-Fi))},this.configureServices=({min:t,max:e,value:s}=this.props)=>{if(this.service){const[a,r]=this.service.limitRange(t||this.min,e||this.max,s||this.props.value);this.service.configure(this.serviceSettings({min:a,max:r}))}},this.serviceSettings=t=>{const e={boundRange:this.props.boundRange||Ct.defaultProps.boundRange,insertUndividedMax:!1,min:l.cloneDate(this.min),max:l.cloneDate(this.max),part:this.props.part,step:this.step},s=Object.assign({},e,t);return s.boundRange=s.part.type!=="hour"||this.props.boundRange||Ct.defaultProps.boundRange,s},this.handleScrollAction=({target:t,animationInProgress:e})=>{if(!(!this.virtualization||!this.service)&&t&&!e){this.animateToIndex=!1;const s=this.virtualization.itemIndex(this.itemOffset(t.scrollTop)),a=this.service.data(this.props.value)[s];this.handleChange(a)}},this.handleFocus=t=>{const{onFocus:e}=this.props;e&&e.call(void 0,t)},this.handleBlur=t=>{const{onBlur:e}=this.props;e&&e.call(void 0,t)},this.handleMouseOver=()=>{if(!this._element)return;const t=d.getActiveElement(document);document&&t!==this._element&&this.props.show&&this._element.focus({preventScroll:!0})},this.handleKeyDown=t=>{if(!this.service)return;const{keyCode:e}=t;(e===d.Keys.down||e===d.Keys.up||e===d.Keys.end||e===d.Keys.home)&&t.preventDefault();const a=(mn[t.keyCode]||d.noop)(this.service.data(this.props.value),this.service.selectedIndex(this.props.value));a&&this.handleChange(a)},this.handleChange=ss(t=>{if(!this.service)return;const e=this.service.apply(this.props.value,t.value);if(this.props.value.getTime()===e.getTime())return;const{onChange:s}=this.props;s&&s.call(void 0,e)},un),this.dom=new Ps}get element(){return this._element}get animate(){return!!(this.props.smoothScroll&&this.animateToIndex)}get min(){return this.props.min||Ct.defaultProps.min}get max(){return this.props.max||Ct.defaultProps.max}get step(){return this.props.step!==void 0&&this.props.step!==0?Math.floor(this.props.step):Ct.defaultProps.step}componentDidMount(){Promise.resolve().then(()=>{this._element&&(this.dom.calculateHeights(this._element),this.forceUpdate())})}componentDidUpdate(){if(!this.virtualization||!this.service)return;const i=this.service.selectedIndex(this.props.value);this.virtualization[this.animate?"animateToIndex":"scrollToIndex"](i),this.animateToIndex=!0}render(){if(!this.props.part.type||!He[this.props.part.type])return;this.calculateHeights(),this.intl=x.provideIntlService(this),this.service=new He[this.props.part.type](this.intl),this.configureServices();const i=this.service.data(this.props.value),t="translateY("+this.topOffset+"px)",e=this.service.total(this.props.value),s=o.createElement("ul",{style:{transform:t,msTransform:t},className:"k-reset"},i.map((a,r)=>o.createElement("li",{key:r,className:"k-item",onClick:()=>{this.handleChange(a)}},o.createElement("span",null,a.text))));return o.createElement("div",{className:"k-time-list",id:String(this.props.id||""),tabIndex:this.props.disabled?-1:0,ref:a=>{this._element=a},onKeyDown:this.handleKeyDown,onFocus:this.handleFocus,onBlur:this.handleBlur,onMouseOver:this.handleMouseOver},this.dom.didCalculate?o.createElement(gt,{bottomOffset:this.bottomOffset,children:s,className:"k-time-container",itemHeight:this.itemHeight,maxScrollDifference:this.listHeight,onScrollAction:this.handleScrollAction,ref:a=>{this.virtualization=a},role:"presentation",skip:dn,tabIndex:-1,take:e,topOffset:this.topOffset,total:e}):o.createElement("div",{className:"k-time-container"},s))}};let qt=Ct;qt.propTypes={id:n.number,max:n.instanceOf(Date),min:n.instanceOf(Date),part:function(i,t,e){const s=i[t];if(!s||!He[s.type])throw new Error(`
|
|
15
|
+
`):null}},rt.defaultProps={disabled:!1,min:it,max:st,navigation:!0,defaultActiveView:"month",defaultValue:null,topView:"century",bottomView:"month"};const ci=d.createPropsContext(),te=d.withIdHOC(d.withPropsContext(ci,rt));te.displayName="KendoReactCalendar",x.registerForIntl(rt);class Os{constructor(){this.symbols="",this.partMap=[]}}const ks="d",Ns="wide",ys=(i,t,e,s)=>{const a=i[s+i.length-e.length],r=i.substring(0,s+i.length-e.length),h=e.substring(0,s),u=[];if(r===h&&s>0)return u.push([t[s-1],h[s-1]]),u;if(r.indexOf(h)===0&&(h.length===0||t[h.length-1]!==t[h.length])){let c="";h.length===1&&u.push([t[0],h[0]]);for(let m=h.length;m<r.length;m++)t[m]!==c&&t[m]!=="_"&&(c=t[m],u.push([c,""]));return u}if(h.indexOf(r)===0||t[s-1]==="_"){let c=t[0];for(let m=Math.max(0,r.length-1);m<t.length;m++)if(t[m]!=="_"){c=t[m];break}return[[c,h[s-1]]]}return h[h.length-1]===" "||h[h.length-1]===a?[[t[s-1],"_"]]:[[t[s-1],h[s-1]]]},Ms=(i,t)=>(i[t.pattern[0]]=t.type,i),_s=(i,t,e)=>i===null||!(t&&t>i||e&&e<i),Fs=["k-widget","k-dateinput"];class Ls{constructor(t,e,s){this.year=!0,this.month=!0,this.date=!0,this.hours=!0,this.minutes=!0,this.seconds=!0,this.milliseconds=!0,this.leadingZero=null,this.typedMonthPart="",this.knownParts="adHhmMsEy",this.symbols={E:"E",H:"H",M:"M",a:"a",d:"d",h:"h",m:"m",s:"s",y:"y"},this._value=l.getDate(new Date),this.intlProvider=t,this.formatPlaceholder=e,this.format=s,this.monthNames=this.allFormatedMonths()}get intl(){return this.intlProvider()}get value(){return this._value}setValue(t){t?l.isEqual(t,this._value)||(this._value=l.cloneDate(t),this.modifyExisting(!0)):(this._value=l.getDate(new Date),this.modifyExisting(!1))}hasValue(){const t=(e,s)=>e||s.type!=="literal"&&s.type!=="dayperiod"&&this.getExisting(s.pattern[0]);return this.intl.splitDateFormat(this.format).reduce(t,!1)}getDateObject(){for(let t=0;t<this.knownParts.length;t++)if(!this.getExisting(this.knownParts[t]))return null;return l.cloneDate(this.value)}getTextAndFormat(){return this.merge(this.intl.formatDate(this.value,this.format),this.dateFormatString(this.value,this.format))}modifyExisting(t){const e=this.dateFormatString(this.value,this.format).symbols;for(let s=0;s<e.length;s++)this.setExisting(e[s],t)}getExisting(t){switch(t){case"y":return this.year;case"M":case"L":return this.month;case"d":return this.date;case"E":return this.date&&this.month&&this.year;case"h":case"H":return this.hours;case"m":return this.minutes;case"s":return this.seconds;default:return!0}}setExisting(t,e){switch(t){case"y":this.year=e,e===!1&&this._value.setFullYear(2e3);break;case"M":this.month=e,e===!1&&this._value.setMonth(0);break;case"d":this.date=e;break;case"h":case"H":this.hours=e;break;case"m":this.minutes=e;break;case"s":this.seconds=e;break;default:return}}modifyPart(t,e){let s=l.cloneDate(this.value);switch(t){case"y":s.setFullYear(s.getFullYear()+e);break;case"M":s=l.addMonths(this.value,e);break;case"d":case"E":s.setDate(s.getDate()+e);break;case"h":case"H":s.setHours(s.getHours()+e);break;case"m":s.setMinutes(s.getMinutes()+e);break;case"s":s.setSeconds(s.getSeconds()+e);break;case"a":s.setHours(s.getHours()+12*e);break}this.setExisting(t,!0),this._value=s}parsePart(t,e){if(this.resetLeadingZero(),!e)return this.setExisting(t,!1),{value:null};const s=this.intl.formatDate(this.value,this.format),a=this.dateFormatString(this.value,this.format),r=a.symbols;let h=!1,u="",c="",m="";for(let w=0;w<s.length;w++)r[w]===t?(c+=this.getExisting(t)?s[w]:"0",h=!0):h?m+=s[w]:u+=s[w];let f=null;const g=this.matchMonth(e);for(;c.length>0&&c.charAt(0)==="0";)c=c.slice(1);c.length>=4&&(c="");for(let w=0;w<2;w++){let v=c+e,E=parseInt(v,10);if(f=this.intl.parseDate(u+v+m,this.format),!f&&!isNaN(E)&&!isNaN(parseInt(e,10))){if(t==="M"&&!g){const O=E-1;O>-1&&O<12&&(f=l.cloneDate(this.value),f.setMonth(O),f.getMonth()!==O&&(f=l.lastDayOfMonth(l.addMonths(f,-1))))}t==="y"&&(f=l.createDate(parseInt(v,10),this.month?this.value.getMonth():0,this.date?this.value.getDate():1,this.hours?this.value.getHours():0,this.minutes?this.value.getMinutes():0,this.seconds?this.value.getSeconds():0,this.milliseconds?this.value.getMilliseconds():0),this.date&&f.getDate()!==this.value.getDate()&&(f=l.lastDayOfMonth(l.addMonths(f,-1))))}if(f)return this._value=f,this.setExisting(t,!0),{value:this.value};c=""}return g&&(f=this.intl.parseDate(u+g+m,this.format),f)?(this._value=f,this.setExisting(t,!0),{value:this.value}):(e==="0"&&(this.leadingZero=this.isAbbrMonth(a.partMap,t)?null:{[t]:!0},this.setExisting(t,!1)),{value:null})}symbolMap(t){return this.intl.splitDateFormat(this.format).reduce(Ms,{})[t]}resetLeadingZero(){const t=this.leadingZero!==null;return this.leadingZero=null,t}isAbbrMonth(t,e){const s=this.partPattern(t,e);return s.type==="month"&&s.names}partPattern(t,e){return t.filter(s=>s.pattern.indexOf(e)!==-1)[0]}matchMonth(t){if(this.typedMonthPart+=t.toLowerCase(),this.monthNames.length===0)return"";for(;this.typedMonthPart.length>0;){for(let s=0;s<this.monthNames.length;s++)if(this.monthNames[s].toLowerCase().indexOf(this.typedMonthPart)===0)return this.monthNames[s];const e=parseInt(this.typedMonthPart,10);if(e>=1&&e<=12&&e.toString()===this.typedMonthPart)return this.monthNames[e-1];this.typedMonthPart=this.typedMonthPart.substring(1,this.typedMonthPart.length)}return""}allFormatedMonths(){const t=this.intl.splitDateFormat(this.format);for(let e=0;e<t.length;e++)if(t[e].type==="month"&&t[e].names)return this.intl.dateFormatNames(t[e].names);return[]}dateFormatString(t,e){const s=this.intl.splitDateFormat(e),a=[],r=[];for(let u=0;u<s.length;u++){let c=this.intl.formatDate(t,{pattern:s[u].pattern}).length;for(;c>0;)a.push(this.symbols[s[u].pattern[0]]||"_"),r.push(s[u]),c--}const h=new Os;return h.symbols=a.join(""),h.partMap=r,h}merge(t,e){let s="",a="",r=e.symbols;for(let h=r.length-1;h>=0;h--)if(this.knownParts.indexOf(r[h])===-1||this.getExisting(r[h]))s=t[h]+s,a=r[h]+a;else{const u=r[h];for(;h>=0&&u===r[h];)h--;for(h++,this.leadingZero&&this.leadingZero[u]?s="0"+s:s=this.dateFieldName(e.partMap[h])+s;a.length<s.length;)a=r[h]+a}return{text:s,format:a}}dateFieldName(t){const e=this.formatPlaceholder||"wide";return e[t.type]?e[t.type]:e==="formatPattern"?t.pattern:this.intl.dateFieldName(Object.assign(t,{nameType:e}))}}const j={dayperiod:"dayperiod",hour:"hour",millisecond:"millisecond",minute:"minute",second:"second"},Ve=i=>(t,e)=>{const s=l.cloneDate(t);return s[i](e),s},ui=[{type:j.hour,getter:i=>i.getHours()},{type:j.minute,getter:i=>i.getMinutes()},{type:j.second,getter:i=>i.getSeconds()},{type:j.millisecond,getter:i=>i.getMilliseconds()}],As=i=>(t,e)=>i(t),Hs=i=>(t,e)=>i(e),Bs=i=>i.reduce((t,e)=>(t[e.type]=e.type,t),{}),zs=i=>t=>i[t.type]?Hs(t.getter):As(t.getter),qs=i=>t=>i.map(zs(Bs(t))),Rs=(i,t,e,s)=>a=>{const r=i(a),h=i(e);return s==="hour"?r-(r-h)%t:a.getTime()<=e.getTime()&&r!==0&&r<=h?Math.ceil(r/t)*t:r-r%t},Ws=i=>(t,e)=>i.map(s=>{const a=Math.floor(t[s.type]);return a?Rs(s.getter,a,e,s.type):s.getter}),Ks=qs(ui),di=Ws(ui),Us=i=>(t,e)=>(t.setHours(...i.map(s=>s(t,e))),t),mi=i=>t=>{const e=l.cloneDate(t);return e.setHours(...i.map(s=>s(e))),e},ee=Ve("setHours"),ie=Ve("setMinutes"),se=Ve("setSeconds"),ut=()=>new Date,Oe=(i,t,e=1)=>{const s=[];for(let a=i;a<t;a=a+e)s.push(a);return s},ke=(i,t,e)=>({candidateValue:R(B,i),maxValue:l.addDays(R(B,e),t.getHours()<e.getHours()?0:1),minValue:R(B,t)}),Ys=(i,t,e)=>{if(!i||!t||!e)return i;const{candidateValue:s,minValue:a,maxValue:r}=ke(i,t,e);return s<a?R(i,t):s>r?R(i,e):i},Ne=(i,t,e)=>{if(!i||!t||!e)return!0;const{candidateValue:s,minValue:a,maxValue:r}=ke(i,t,e);return a<=s&&s<=r},$s=(i,t,e)=>{if(i===null)return!0;const{candidateValue:s,minValue:a,maxValue:r}=ke(i,t,e);return a<=s&&s<=r},Ts=(i,t)=>{if(i===null||t===null)return!1;const e=R(B,i),s=R(B,t);return e.getTime()<s.getHours()},js=(i,t)=>{if(i===null||t===null)return!1;const e=R(B,i);return R(B,t).getTime()<e.getHours()},Zs="Please enter a valid value!",Z=class extends o.Component{constructor(i){super(i),this.kendoDate=null,this.currentFormat="",this.paste=!1,this._element=null,this._wrapper=null,this._lastSelectedSymbol="",this.focus=()=>{this._element&&this._element.focus()},this.setValidity=()=>{this.element&&this.element.setCustomValidity&&this.element.setCustomValidity(this.validity.valid?"":this.props.validationMessage||Z.defaultProps.validationMessage)},this.updateOnPaste=t=>{if(!this.element||!this.kendoDate)return;const e=x.provideIntlService(this).parseDate(this.element.value,this.props.format)||this.value,s=this.value;this.kendoDate.setValue(e),this.triggerChange(t,s)},this.spinnersMouseDown=t=>{t.preventDefault();const e=d.getActiveElement(document);this.element&&e!==this.element&&this.element.focus({preventScroll:!0})},this.handlePaste=()=>{this.paste=!0},this.elementChange=t=>{if(!this.element||!this.kendoDate)return;if(this.paste){this.updateOnPaste(t),this.paste=!1;return}const{text:e,format:s}=this.kendoDate.getTextAndFormat();this.currentFormat=s;const a=this.value,r=ys(e,this.currentFormat,this.element.value,this.selection.start),h=r.length===1&&r[0][1]==="_";if(!h)for(let u=0;u<r.length;u++)this.kendoDate.parsePart(r[u][0],r[u][1]);r.length&&r[0][0]!=="_"&&this.setSelection(this.selectionBySymbol(r[0][0])),h&&this.switchDateSegment(1),this.triggerChange(t,a)},this.elementClick=t=>{this.setSelection(this.selectionByIndex(this.selection.start))},this.nativeWheel=t=>{d.getActiveElement(document)===this.element&&t.preventDefault()},this.wheel=t=>{d.getActiveElement(document)===this.element&&(t.nativeEvent.deltaY<0&&this.increasePart(t),t.nativeEvent.deltaY>0&&this.decreasePart(t))},this.increasePart=t=>{this.modifyDateSegmentValue(1,t)},this.decreasePart=t=>{this.modifyDateSegmentValue(-1,t)},this.elementKeyDown=t=>{if(!t.altKey){switch(t.keyCode){case 37:this.switchDateSegment(-1);break;case 38:this.modifyDateSegmentValue(1,t);break;case 39:this.switchDateSegment(1);break;case 40:this.modifyDateSegmentValue(-1,t);break;default:return}t.preventDefault()}},this.elementOnFocus=t=>{this.wrapper&&this.wrapper.classList.add("k-focus"),this.setState({focused:!0})},this.elementOnBlur=t=>{this.wrapper&&this.wrapper.classList.remove("k-focus"),this.setState({focused:!1})},d.validatePackage(ft),this.state={focused:!1}}get _inputId(){return this.props.id+"-accessibility-id"}componentDidMount(){this.setValidity(),this.wrapper&&this.wrapper.addEventListener("wheel",this.nativeWheel,{passive:!1})}componentDidUpdate(i,t){this._lastSelectedSymbol&&t.focused===this.state.focused?this.setSelection(this.selectionBySymbol(this._lastSelectedSymbol)):this.props.placeholder!==void 0&&this.selection.start===this.selection.end&&this.setSelection({start:0,end:this.currentFormat.length}),this.setValidity()}componentWillUnmount(){this.wrapper&&this.wrapper.removeEventListener("wheel",this.nativeWheel)}render(){const{size:i=Z.defaultProps.size,fillMode:t=Z.defaultProps.fillMode,rounded:e=Z.defaultProps.rounded}=this.props;this.props._ref&&(this.props._ref.current=this);const s=x.provideLocalizationService(this),a={...Z.defaultProps,...this.props},{name:r,label:h,id:u}=a,c=this.text,m=c===this.props.placeholder?"":c,f=c===this.props.placeholder?c:void 0,g=u||this._inputId,w=!this.validityStyles||this.validity.valid;let v=[...Fs];this.props.className&&v.push(this.props.className);const E=o.createElement(d.AsyncFocusBlur,{onFocus:this.elementOnFocus,onBlur:this.elementOnBlur},({onFocus:O,onBlur:N})=>o.createElement("span",{ref:S=>{this._wrapper=S},style:h?void 0:{width:this.props.width},dir:this.props.dir,className:d.classNames("k-dateinput","k-input",{[`k-input-${d.kendoThemeMaps.sizeMap[i]||i}`]:i,[`k-input-${t}`]:t,[`k-rounded-${d.kendoThemeMaps.roundedMap[e]||e}`]:e,"k-invalid":!w,"k-required":this.required,"k-disabled":this.props.disabled},this.props.className),onFocus:O,onBlur:N},o.createElement("input",{role:this.props.ariaRole||"textbox",readOnly:this.props.readonly,tabIndex:this.props.tabIndex,disabled:this.props.disabled,title:this.props.title!==void 0?this.props.title:c,type:"text",spellCheck:!1,autoComplete:"off",autoCorrect:"off",className:"k-input-inner",id:g,"aria-label":this.props.ariaLabel,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,"aria-haspopup":this.props.ariaHasPopup,"aria-disabled":this.props.disabled,"aria-expanded":this.props.ariaExpanded,"aria-controls":this.props.ariaControls,onWheel:this.wheel,onClick:this.elementClick,onInput:this.elementChange,onPaste:this.handlePaste,onKeyDown:this.elementKeyDown,onChange:d.noop,value:m,placeholder:f,name:r,ref:S=>this._element=S}),this.props.children,this.props.spinners&&o.createElement("span",{className:"k-input-spinner k-spin-button",onMouseDown:this.spinnersMouseDown},o.createElement(L.Button,{tabIndex:-1,type:"button",rounded:null,className:"k-spinner-increase",icon:"caret-alt-up",svgIcon:J.caretAltUpIcon,"aria-label":s.toLanguageString(wt,k[wt]),title:s.toLanguageString(wt,k[wt]),onClick:this.increasePart}),o.createElement(L.Button,{tabIndex:-1,type:"button",rounded:null,className:"k-spinner-decrease",icon:"caret-alt-down",svgIcon:J.caretAltDownIcon,"aria-label":s.toLanguageString(bt,k[bt]),title:s.toLanguageString(bt,k[bt]),onClick:this.decreasePart}))));return h?o.createElement(Ye.FloatingLabel,{label:h,editorId:g,editorValue:c,editorValid:w,editorDisabled:this.props.disabled,children:E,style:{width:this.props.width}}):E}get value(){return this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.kendoDate&&this.kendoDate.getDateObject()}get name(){return this.props.name}get min(){return this.props.min!==void 0?this.props.min:Z.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:Z.defaultProps.max}get text(){const i={...ot.defaultProps,...this.props},{formatPlaceholder:t=Z.defaultProps.formatPlaceholder,format:e=Z.defaultProps.format,value:s,defaultValue:a}=i;this.kendoDate===null?(this.kendoDate=new Ls(this.intl.bind(this),t,e),this.kendoDate.setValue(s||a||null)):(this.kendoDate.format=e,this.kendoDate.formatPlaceholder=t),s!==void 0&&this.value!==s&&this.kendoDate.setValue(s);const{text:r,format:h}=this.kendoDate.getTextAndFormat();return this.currentFormat=h,i.placeholder!==null&&i.placeholder!==void 0&&!this.state.focused&&!this.kendoDate.hasValue()?i.placeholder:r}get validity(){const i=_s(this.value,this.min,this.max)&&Ne(this.value,this.props.minTime,this.props.maxTime),t=this.props.validationMessage!==void 0,e=(!this.required||this.value!==null)&&i,s=this.props.valid!==void 0?this.props.valid:e;return{customError:t,rangeOverflow:this.value&&this.max.getTime()<this.value.getTime()||!1,rangeUnderflow:this.value&&this.value.getTime()<this.min.getTime()||!1,valid:s,valueMissing:this.value===null}}get element(){return this._element}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:Z.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:Z.defaultProps.required}get wrapper(){return this._wrapper}intl(){return x.provideIntlService(this)}get selection(){let i={start:0,end:0};return this.element!==null&&this.element.selectionStart!==void 0&&(i={start:this.element.selectionStart,end:this.element.selectionEnd}),i}setSelection(i){this._lastSelectedSymbol=this.currentFormat[i.start],window.requestAnimationFrame(()=>{const t=d.getActiveElement(document);this.element&&t===this.element&&!this.props.disableSelection&&this.element.setSelectionRange(i.start,i.end)})}triggerChange(i,t){this.valueDuringOnChange=this.value,this.forceUpdate(),this.props.onChange&&!l.isEqual(t,this.value)&&this.props.onChange.call(void 0,{syntheticEvent:i,nativeEvent:i.nativeEvent,value:this.value,target:this}),this.valueDuringOnChange=void 0}selectionBySymbol(i){let t=-1,e=0;for(let s=0;s<this.currentFormat.length;s++)this.currentFormat[s]===i&&(e=s+1,t===-1&&(t=s));return t<0&&(t=0),{start:t,end:e}}selectionByIndex(i){let t={start:i,end:i};for(let e=i,s=i-1;e<this.currentFormat.length||s>=0;e++,s--){if(e<this.currentFormat.length&&this.currentFormat[e]!=="_"){t=this.selectionBySymbol(this.currentFormat[e]);break}if(s>=0&&this.currentFormat[s]!=="_"){t=this.selectionBySymbol(this.currentFormat[s]);break}}return t}switchDateSegment(i){const{start:t,end:e}=this.selection;if(t<e&&this.currentFormat[t]!==this.currentFormat[e-1]){this.setSelection(this.selectionByIndex(i>0?t:e-1));return}const s=this.currentFormat[t];let a=t+i;for(;a>0&&a<this.currentFormat.length&&!(this.currentFormat[a]!==s&&this.currentFormat[a]!=="_");)a+=i;if(this.currentFormat[a]==="_")return;let r=a;for(;r>=0&&r<this.currentFormat.length&&this.currentFormat[r]===this.currentFormat[a];)r+=i;a>r&&(r+1!==t||a+1!==e)?this.setSelection({start:r+1,end:a+1}):a<r&&(a!==t||r!==e)&&this.setSelection({start:a,end:r})}modifyDateSegmentValue(i,t){if(!this.kendoDate)return;const e=this.value,s=this.currentFormat[this.selection.start],a=this.kendoDate.symbolMap(s),r=((this.props.steps||{})[a]||1)*i;this.kendoDate.modifyPart(s,r),this.triggerChange(t,e)}};let lt=Z;lt.displayName="DateInput",lt.propTypes={value:n.instanceOf(Date),format:n.oneOfType([n.string,n.shape({skeleton:n.string,pattern:n.string,date:n.oneOf(["short","medium","long","full"]),time:n.oneOf(["short","medium","long","full"]),datetime:n.oneOf(["short","medium","long","full"]),era:n.oneOf(["narrow","short","long"]),year:n.oneOf(["numeric","2-digit"]),month:n.oneOf(["numeric","2-digit","narrow","short","long"]),day:n.oneOf(["numeric","2-digit"]),weekday:n.oneOf(["narrow","short","long"]),hour:n.oneOf(["numeric","2-digit"]),hour12:n.bool,minute:n.oneOf(["numeric","2-digit"]),second:n.oneOf(["numeric","2-digit"]),timeZoneName:n.oneOf(["short","long"])})]),formatPlaceholder:n.oneOfType([n.oneOf(["wide","narrow","short","formatPattern"]),n.shape({year:n.string,month:n.string,day:n.string,hour:n.string,minute:n.string,second:n.string})]),width:n.oneOfType([n.string,n.number]),tabIndex:n.number,title:n.string,steps:n.shape({year:n.number,month:n.number,day:n.number,hour:n.number,minute:n.number,second:n.number}),min:n.instanceOf(Date),max:n.instanceOf(Date),disabled:n.bool,spinners:n.bool,name:n.string,dir:n.string,label:n.string,id:n.string,ariaLabelledBy:n.string,ariaDescribedBy:n.string,ariaLabel:n.string,ariaRole:n.string,ariaHasPopup:n.oneOfType([n.bool,n.string]),ariaExpanded:n.oneOfType([n.bool]),onChange:n.func,validationMessage:n.string,required:n.bool,validate:n.bool,valid:n.bool,size:n.oneOf([null,"small","medium","large"]),rounded:n.oneOf([null,"small","medium","large","full"]),fillMode:n.oneOf([null,"solid","flat","outline"])},lt.defaultProps={format:ks,size:"medium",rounded:"medium",fillMode:"solid",formatPlaceholder:Ns,spinners:!1,disabled:!1,max:l.cloneDate(st),min:l.cloneDate(it),minTime:l.cloneDate(ct),maxTime:l.cloneDate(nt),required:!1,validityStyles:!0,validationMessage:Zs,placeholder:null,ariaHasPopup:"grid"};const pi=d.createPropsContext(),ot=d.withIdHOC(d.withPropsContext(pi,lt));ot.displayName="KendoReactDateInput",x.registerForIntl(lt),x.registerForLocalization(lt);const fi=L.Button,gi=o.forwardRef((i,t)=>{const{_ref:e}=i,s=o.useRef(null);o.useImperativeHandle(t,()=>s.current),o.useImperativeHandle(e,()=>s.current);const a=o.useMemo(()=>d.classNames(i.className,"k-picker-wrap"),[i.className]);return o.createElement("span",{ref:s,id:i.id,style:i.style,className:a,tabIndex:i.tabIndex},i.children)}),Gs=i=>{const[t,e]=o.useState(!1),s=()=>{i.current&&e(!!i.current.text)};return o.useEffect(s),{editorValue:t}},ye=i=>{const t=Gs(i.dateInput);return o.createElement(Ye.FloatingLabel,{...i,...t})},vi=500,ne=i=>{const{footer:t,children:e,windowWidth:s=0,navigatable:a,navigatableElements:r,expand:h,animation:u,onClose:c,adaptiveTitle:m,mobileFilter:f}=i,g={navigatable:a||!1,navigatableElements:r||[],expand:h,animation:u!==!1,onClose:c,animationStyles:s<=vi?{top:0,width:"100%",height:"100%"}:void 0,className:s<=vi?"k-adaptive-actionsheet k-actionsheet-fullscreen":"k-adaptive-actionsheet k-actionsheet-bottom"};return o.createElement(ht.ActionSheet,{...g},o.createElement(ht.ActionSheetHeader,{className:"k-text-center"},o.createElement("div",{className:"k-actionsheet-titlebar-group k-hbox"},o.createElement("div",{className:"k-actionsheet-title"},o.createElement("div",null,m)),o.createElement("div",{className:"k-actionsheet-actions"},o.createElement(L.Button,{tabIndex:0,"aria-label":"Cancel","aria-disabled":"false",type:"button",fillMode:"flat",icon:"x",svgIcon:J.xIcon,onClick:c}))),f&&o.createElement("div",{className:"k-actionsheet-titlebar-group k-actionsheet-filter"},f)),e,t&&o.createElement(ht.ActionSheetFooter,{className:"k-actions k-actions-stretched"},o.createElement(L.Button,{size:"large",tabIndex:0,"aria-label":t.cancelText,"aria-disabled":"false",type:"button",onClick:t.onCancel},t.cancelText),o.createElement(L.Button,{tabIndex:0,themeColor:"primary",size:"large","aria-label":t.applyText,"aria-disabled":"false",type:"button",onClick:t.onApply},t.applyText)))},ae=768,W=class extends o.Component{constructor(i){super(i),this._element=null,this._dateInput=o.createRef(),this._calendar=null,this.shouldFocusDateInput=!1,this.prevShow=!1,this.focus=()=>{this.dateInput&&this.dateInput.focus()},this.setCalendarRef=t=>{this._calendar=t},this.nextValue=(t,e)=>t.value!==void 0?t.value:e.value,this.nextShow=(t,e)=>t.show!==void 0?t.show:e.show,this.renderPopup=()=>{const{disabled:t,min:e,max:s,weekNumber:a,focusedDate:r}=this.props,{popupClass:h,...u}=this.props.popupSettings,c=this.show,m=this.value,f=m&&l.getDate(m),g=d.classNames("k-calendar-container k-group k-reset",h),w={popupClass:"k-datepicker-popup",show:c,anchor:this._element,className:g,id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},...u},v={disabled:t,value:f,min:e,max:s,weekNumber:a,focusedDate:r,className:this.mobileMode?"k-calendar-lg":"",navigation:!this.mobileMode,onChange:this.handleCalendarValueChange};return this.mobileMode?o.createElement(this.calendarComp,{_ref:this.setCalendarRef,...v}):o.createElement(this.popupComp,{...w},o.createElement(this.calendarComp,{_ref:this.setCalendarRef,...v}))},this.renderAdaptivePopup=()=>{const{windowWidth:t=0}=this.state,e={expand:this.show,onClose:this.handleBlur,adaptiveTitle:this.props.adaptiveTitle,windowWidth:t};return o.createElement(ne,{...e},o.createElement(ht.ActionSheetContent,{className:"!k-overflow-hidden"},this.renderPopup()))},this.handleInputValueChange=t=>{this.handleValueChange(t.value,t)},this.handleCalendarValueChange=t=>{const e=this.mergeTime(t.value);this.handleValueChange(e,t)},this.handleValueChange=(t,e)=>{this.setState({value:l.cloneDate(t||void 0)}),this.valueDuringOnChange=t,this.showDuringOnChange=!1,this.mobileMode||(this.shouldFocusDateInput=!0);const{onChange:s}=this.props;s&&s.call(void 0,{syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,value:this.value,show:this.show,target:this}),this.valueDuringOnChange=void 0,this.showDuringOnChange=void 0,this.setShow(!1)},this.handleFocus=()=>{this.setState({focused:!0})},this.handleBlur=()=>{this.setState({focused:!1}),this.setShow(!1)},this.handleIconClick=()=>{this.props.disabled||(this.shouldFocusDateInput=!0,this.setShow(!this.show))},this.handleIconMouseDown=t=>{t.preventDefault()},this.handleKeyDown=t=>{const{altKey:e,keyCode:s}=t;if(s===d.Keys.esc){this.shouldFocusDateInput=!0,this.setShow(!1);return}e&&(s===d.Keys.up||s===d.Keys.down)&&(t.preventDefault(),t.stopPropagation(),this.shouldFocusDateInput=s===d.Keys.up,this.setShow(s===d.Keys.down))},d.validatePackage(ft),this.state={value:this.props.defaultValue||W.defaultProps.defaultValue,show:this.props.defaultShow||W.defaultProps.defaultShow,focused:!1}}get _popupId(){return this.props.id+"-popup-id"}get document(){if(d.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get mobileMode(){return!!(this.state.windowWidth&&this.state.windowWidth<=ae&&this.props.adaptive)}get dateInput(){return this._dateInput.current}get calendar(){return this._calendar}get value(){const i=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value;return i!==null?l.cloneDate(i):null}get show(){return this.showDuringOnChange!==void 0?this.showDuringOnChange:this.props.show!==void 0?this.props.show:this.state.show}get name(){return this.props.name}get min(){return this.props.min!==void 0?this.props.min:W.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:W.defaultProps.max}get dateInputComp(){return this.props.dateInput||W.defaultProps.dateInput}get toggleButtonComp(){return this.props.toggleButton||W.defaultProps.toggleButton}get calendarComp(){return this.props.calendar||W.defaultProps.calendar}get popupComp(){return this.props.popup||W.defaultProps.popup}get pickerWrapComp(){return this.props.pickerWrap||W.defaultProps.pickerWrap}get validity(){const i=je(this.value,this.min,this.max),t=this.props.validationMessage!==void 0,e=(!this.required||this.value!==null)&&i,s=this.props.valid!==void 0?this.props.valid:e;return{customError:t,rangeOverflow:this.value&&this.max.getTime()<this.value.getTime()||!1,rangeUnderflow:this.value&&this.value.getTime()<this.min.getTime()||!1,valid:s,valueMissing:this.value===null}}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:W.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:W.defaultProps.required}componentDidMount(){var i;this.observerResize=d.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.show&&this.forceUpdate(),(i=this.document)!=null&&i.body&&this.observerResize&&this.observerResize.observe(this.document.body)}componentDidUpdate(){this._calendar&&this._calendar.element&&this.show&&!this.prevShow&&this._calendar.element.focus({preventScroll:!0}),this.dateInput&&this.dateInput.element&&!this.show&&this.shouldFocusDateInput&&this.dateInput.element.focus({preventScroll:!0}),this.prevShow=this.show,this.shouldFocusDateInput=!1}componentWillUnmount(){var i;clearTimeout(this.nextTickId),(i=this.document)!=null&&i.body&&this.observerResize&&this.observerResize.disconnect()}render(){const{size:i=W.defaultProps.size,rounded:t=W.defaultProps.rounded,fillMode:e=W.defaultProps.fillMode,disabled:s,tabIndex:a,title:r,id:h,format:u,formatPlaceholder:c,min:m,max:f,className:g,width:w,name:v,validationMessage:E,required:O,validityStyles:N,ariaLabelledBy:S,ariaDescribedBy:y,ariaLabel:b}=this.props,K=this.show,M=this.value,F=!this.validityStyles||this.validity.valid,U={disabled:s,format:u,formatPlaceholder:c,id:h,ariaLabelledBy:S,ariaDescribedBy:y,ariaLabel:b,max:f,min:m,name:v,onChange:this.handleInputValueChange,required:O,tabIndex:K?-1:a,title:r,valid:this.validity.valid,validationMessage:E,validityStyles:N,value:M,label:void 0,placeholder:this.state.focused?null:this.props.placeholder,ariaExpanded:this.show,size:null,fillMode:null,rounded:null},V=x.provideLocalizationService(this).toLanguageString(Zt,k[Zt]),_=o.createElement(d.AsyncFocusBlur,{onFocus:this.handleFocus,onBlur:this.mobileMode?void 0:this.handleBlur,onSyncBlur:this.props.onBlur,onSyncFocus:this.props.onFocus},({onFocus:tt,onBlur:X})=>o.createElement(o.Fragment,null,o.createElement("span",{ref:pt=>{this._element=pt},className:d.classNames("k-input","k-datepicker",{[`k-input-${d.kendoThemeMaps.sizeMap[i]||i}`]:i,[`k-rounded-${d.kendoThemeMaps.roundedMap[t]||t}`]:t,[`k-input-${e}`]:e,["k-invalid"]:!F,["k-required"]:this.required,["k-disabled"]:this.props.disabled},g),onKeyDown:this.handleKeyDown,style:{width:w},onFocus:tt,onBlur:X,onClick:this.mobileMode?this.handleIconClick:void 0},o.createElement(this.dateInputComp,{_ref:this._dateInput,ariaRole:"combobox",readonly:this.mobileMode,ariaExpanded:this.show,ariaControls:this._popupId,...U}),o.createElement(this.toggleButtonComp,{type:"button",icon:"calendar",svgIcon:J.calendarIcon,title:V,className:"k-input-button",rounded:null,onClick:this.mobileMode?void 0:this.handleIconClick,"aria-label":V,onMouseDown:this.handleIconMouseDown}),!this.mobileMode&&this.renderPopup()),this.mobileMode&&this.renderAdaptivePopup()));return this.props.label?o.createElement(ye,{dateInput:this._dateInput,label:this.props.label,editorId:h,editorValid:F,editorDisabled:this.props.disabled,children:_,style:{width:this.props.width}}):_}setShow(i){const{onOpen:t,onClose:e}=this.props;this.show!==i&&(this.setState({show:i}),i&&t&&t.call(void 0,{target:this}),!i&&e&&e.call(void 0,{target:this}))}mergeTime(i){return this.value&&i?R(i,this.value):i}nextTick(i){clearTimeout(this.nextTickId),this.nextTickId=window.setTimeout(()=>i())}calculateMedia(i){for(let t of i)this.setState({windowWidth:t.target.clientWidth})}};let xt=W;xt.displayName="DatePicker",xt.propTypes={className:n.string,defaultShow:n.bool,defaultValue:n.instanceOf(Date),disabled:n.bool,focusedDate:n.instanceOf(Date),format:n.oneOfType([n.string,n.shape({skeleton:n.string,pattern:n.string,date:n.oneOf(["short","medium","long","full"]),time:n.oneOf(["short","medium","long","full"]),datetime:n.oneOf(["short","medium","long","full"]),era:n.oneOf(["narrow","short","long"]),year:n.oneOf(["numeric","2-digit"]),month:n.oneOf(["numeric","2-digit","narrow","short","long"]),day:n.oneOf(["numeric","2-digit"]),weekday:n.oneOf(["narrow","short","long"]),hour:n.oneOf(["numeric","2-digit"]),hour12:n.bool,minute:n.oneOf(["numeric","2-digit"]),second:n.oneOf(["numeric","2-digit"]),timeZoneName:n.oneOf(["short","long"])})]),formatPlaceholder:n.oneOfType([n.oneOf(["wide","narrow","short","formatPattern"]),n.shape({year:n.string,month:n.string,day:n.string,hour:n.string,minute:n.string,second:n.string})]),id:n.string,ariaLabelledBy:n.string,ariaDescribedBy:n.string,ariaLabel:n.string,min:n.instanceOf(Date),max:n.instanceOf(Date),name:n.string,popupSettings:n.shape({animate:n.bool,appendTo:n.any,popupClass:n.string}),show:n.bool,tabIndex:n.number,title:n.string,value:n.instanceOf(Date),weekNumber:n.bool,width:n.oneOfType([n.number,n.string]),validationMessage:n.string,required:n.bool,validate:n.bool,valid:n.bool,size:n.oneOf([null,"small","medium","large"]),rounded:n.oneOf([null,"small","medium","large","full"]),fillMode:n.oneOf([null,"solid","flat","outline"]),adaptive:n.bool,adaptiveTitle:n.string},xt.defaultProps={defaultShow:!1,defaultValue:null,dateInput:ot,calendar:te,toggleButton:fi,popup:Wt.Popup,pickerWrap:gi,disabled:!1,format:"d",max:st,min:it,popupSettings:{},tabIndex:0,weekNumber:!1,required:!1,validityStyles:!0,size:"medium",rounded:"medium",fillMode:"solid"};const wi=d.createPropsContext(),bi=d.withIdHOC(d.withPropsContext(wi,xt));bi.displayName="KendoReactDatePicker",x.registerForLocalization(xt);const Me=(i,t)=>{const e=l.cloneDate(i);return e.setHours(t),e},_e=i=>i!==null&&i<12,Xs=i=>i!==null&&(!i||i>11),Js=(i,t,e)=>!t&&!e||i>=t&&i<=e,Qs=(i,t,e)=>!t&&!e||i>=t||i<=e;class Si{constructor(t){this.intl=t,this.min=null,this.max=null,this.part=null}apply(t,e){const s=t.getHours(),a=_e(s),r=_e(e.getHours());if(a&&r||!a&&!r)return t;const[h,u=24]=this.normalizedRange(),c=s+(r?-12:12);return Me(t,Math.min(Math.max(h,c),u||24))}configure(t){const{min:e=this.min,max:s=this.max,part:a=this.part}=t;this.min=e,this.max=s,this.part=a}data(t){const e=this.part&&this.part.names;if(!e||!this.min)return[];const s=[],[a,r]=this.normalizedRange(),h=this.intl.dateFormatNames(e);return _e(a)&&s.push({text:h.am,value:Me(this.min,a)}),Xs(r)&&s.push({text:h.pm,value:Me(this.min,Math.max(12,r))}),this.min.getHours()!==a?s.reverse():s}isRangeChanged(t,e){return!1}limitRange(t,e,s){return[t,e]}total(){const[t,e]=this.normalizedRange();return!t&&!e?2:t>11||e<12?1:2}selectedIndex(t){if(!this.valueInList(t)||!this.min)return-1;const e=Math.floor(t.getHours()/12);return this.min.getHours()===this.normalizedRange()[0]?e:e===0?1:0}valueInList(t){return!this.min||!this.max?!1:(this.min.getHours()!==this.normalizedRange()[0]?Qs:Js)(t.getHours(),this.min.getHours(),this.max.getHours())}normalizedRange(){const t=this.min.getHours(),e=this.max.getHours();return[Math.min(t,e),Math.max(t,e)]}}class Ps{constructor(){this.itemHeight=0,this.timeListHeight=0,this.didCalculate=!1}ensureHeights(){this.timeListHeight===void 0&&this.calculateHeights()}calculateHeights(t){if(!d.canUseDOM)return;const e=$("div"),s=$("span"),a=$("ul"),r=$("li"),h=()=>r("<span>02</span>","k-item"),u=()=>a([h()],"k-reset"),c=()=>e([u()],"k-content k-scrollable k-time-container"),f=(()=>e([s("minute","k-title"),e([c()],"k-time-list")],"k-time-list-wrapper",{left:"-10000px",position:"absolute"}))(),w=t&&t.querySelector(".k-time-container")||document.body,v=w.appendChild(f);this.timeListHeight=v.querySelector(".k-scrollable").offsetHeight,this.itemHeight=v.querySelector("li").offsetHeight,w.removeChild(v),this.didCalculate=!0}}const Fe=24,Di=(i=>t=>t%i)(Fe),tn=(i,t)=>e=>Di(i+e*t),Ii=(i,t)=>Di(Fe+i-t),xi=i=>(t,e)=>!e||l.getDate(t).getTime()===l.getDate(e).getTime()?t:ee(t,i),en=xi(0),sn=xi(Fe-1);class Ci{constructor(t){this.intl=t,this.boundRange=!1,this.insertUndividedMax=!1,this.min=null,this.max=null,this.step=0,this.toListItem=null}apply(t,e){return ee(t,e.getHours())}configure(t){const{boundRange:e=this.boundRange,insertUndividedMax:s=this.insertUndividedMax,min:a=this.min,max:r=this.max,part:h,step:u=this.step}=t;this.boundRange=e,this.insertUndividedMax=s,this.toListItem=c=>{const m=ee(B,c);return{text:this.intl.formatDate(m,h.pattern),value:m}},this.min=a,this.max=r,this.step=u}data(t){const[e]=this.range(t),s=tn(e,this.step),a=h=>this.toListItem&&this.toListItem(s(h)),r=Oe(0,this.countFromMin(t)).map(a);return this.addLast(r),t&&this.addMissing(r,t),r}isRangeChanged(t,e){return!this.min||!this.max?!1:!l.isEqual(this.min,t)||!l.isEqual(this.max,e)}limitRange(t,e,s){return this.boundRange?[en(t,s),sn(e,s)]:[t,e]}total(t){const e=this.insertUndividedMax&&this.isLastMissing(t)?1:0,s=this.isMissing(t)?1:0;return this.countFromMin(t)+s+e}selectedIndex(t){return Math.ceil(this.divideByStep(t))}valueInList(t){return t?this.insertUndividedMax&&this.lastHour(t)===t.getHours()||!this.isMissing(t):!0}addLast(t,e){return this.insertUndividedMax&&this.isLastMissing(e)&&this.toListItem&&t.push(this.toListItem(this.lastHour(e))),t}addMissing(t,e){if(this.valueInList(e))return t;if(this.toListItem){const s=this.toListItem(e.getHours());t.splice(this.selectedIndex(e),0,s)}return t}countFromMin(t){const[e,s]=this.range(t);return Math.floor(Ii(s,e)/this.step)+1}isMissing(t){return t?this.selectedIndex(t)!==this.divideByStep(t):!1}isLastMissing(t){return this.max!==null&&this.isMissing(ee(this.max,this.lastHour(t)))}divideByStep(t){return Ii(t.getHours(),this.min.getHours())/this.step}lastHour(t){return this.range(t)[1]}range(t){const[e,s]=this.limitRange(this.min,this.max,t);return[e.getHours(),s.getHours()]}}const Le=60,Ei=(i=>t=>t%i)(Le),nn=(i,t)=>e=>Ei(i+e*t),Vi=(i,t)=>Ei(Le+i-t),Oi=i=>(t,e)=>!e||t.getHours()===e.getHours()?t:ie(t,i),an=Oi(0),rn=Oi(Le-1);class ki{constructor(t){this.intl=t,this.toListItem=null,this.min=null,this.max=null,this.step=0,this.insertUndividedMax=!1}apply(t,e){return ie(t,e.getMinutes())}configure(t){const{insertUndividedMax:e=this.insertUndividedMax,min:s=this.min,max:a=this.max,part:r,step:h=this.step}=t;this.insertUndividedMax=e,this.toListItem=u=>{const c=ie(B,u);return{text:this.intl.formatDate(c,r.pattern),value:c}},this.min=s,this.max=a,this.step=h}data(t){const[e]=this.range(t),s=nn(e,this.step),a=h=>this.toListItem&&this.toListItem(s(h)),r=Oe(0,this.countFromMin(t)).map(a);return this.addLast(r),t&&this.addMissing(r,t),r}isRangeChanged(t,e){return this.min!==null&&this.max!==null&&(!l.isEqual(this.min,t)||!l.isEqual(this.max,e))}limitRange(t,e,s){return[an(t,s),rn(e,s)]}total(t){const e=this.insertUndividedMax&&this.isLastMissing(t)?1:0,s=this.isMissing(t)?1:0;return this.countFromMin(t)+s+e}selectedIndex(t){return Math.ceil(this.divideByStep(t))}valueInList(t){return t?this.insertUndividedMax&&this.lastMinute(t)===t.getMinutes()||!this.isMissing(t):!0}addLast(t,e){return this.insertUndividedMax&&this.isLastMissing(e)&&this.toListItem&&t.push(this.toListItem(this.lastMinute(e))),t}addMissing(t,e){if(this.valueInList(e))return t;if(this.toListItem){const s=this.toListItem(e.getMinutes());t.splice(this.selectedIndex(e),0,s)}return t}countFromMin(t){const[e,s]=this.range(t);return Math.floor(Vi(s,e)/this.step)+1}isMissing(t){return t?this.selectedIndex(t)!==this.divideByStep(t):!1}isLastMissing(t){return this.max!==null&&this.isMissing(ie(this.max,this.lastMinute(t)))}divideByStep(t){return Vi(t.getMinutes(),this.min.getMinutes())/this.step}lastMinute(t){return this.range(t)[1]}range(t){const[e,s]=this.limitRange(this.min,this.max,t);return[e.getMinutes(),s.getMinutes()]}}const Ae=60,Ni=(i=>t=>t%i)(Ae),ln=(i,t)=>e=>Ni(i+e*t),yi=(i,t)=>Ni(Ae+i-t),Mi=i=>(t,e)=>!e||t.getMinutes()===e.getMinutes()&&t.getHours()===e.getHours()?t:se(t,i),on=Mi(0),hn=Mi(Ae-1);class _i{constructor(t){this.intl=t,this.toListItem=null,this.min=null,this.max=null,this.step=0,this.insertUndividedMax=!1}apply(t,e){return se(t,e.getSeconds())}configure(t){const{insertUndividedMax:e=this.insertUndividedMax,min:s=this.min,max:a=this.max,part:r,step:h=this.step}=t;this.insertUndividedMax=e,this.toListItem=u=>{const c=se(B,u);return{text:this.intl.formatDate(c,r.pattern),value:c}},this.min=s,this.max=a,this.step=h}data(t){const[e]=this.range(t),s=ln(e,this.step),a=h=>this.toListItem&&this.toListItem(s(h)),r=Oe(0,this.countFromMin(t)).map(a);return this.addLast(r),t&&this.addMissing(r,t),r}isRangeChanged(t,e){return this.min!==null&&this.max!==null&&(!l.isEqual(this.min,t)||!l.isEqual(this.max,e))}limitRange(t,e,s){return[on(t,s),hn(e,s)]}total(t){const e=this.insertUndividedMax&&this.isLastMissing(t)?1:0,s=this.isMissing(t)?1:0;return this.countFromMin(t)+s+e}selectedIndex(t){return Math.ceil(this.divideByStep(t))}valueInList(t){return t?this.insertUndividedMax&&this.lastSecond(t)===t.getSeconds()||!this.isMissing(t):!0}divideByStep(t){return yi(t.getSeconds(),this.min.getSeconds())/this.step}addLast(t,e){return this.insertUndividedMax&&this.isLastMissing(e)&&this.toListItem&&t.push(this.toListItem(this.lastSecond(e))),t}addMissing(t,e){if(this.valueInList(e))return t;if(this.toListItem){const s=this.toListItem(e.getSeconds());t.splice(this.selectedIndex(e),0,s)}return t}countFromMin(t){const[e,s]=this.range(t);return Math.floor(yi(s,e)/this.step)+1}isMissing(t){return t?this.selectedIndex(t)!==this.divideByStep(t):!1}isLastMissing(t){return this.max!==null&&this.isMissing(se(this.max,this.lastSecond(t)))}lastSecond(t){return this.range(t)[1]}range(t){const[e,s]=this.limitRange(this.min,this.max,t);return[e.getSeconds(),s.getSeconds()]}}const cn=2,Fi=.05,un=100,dn=0,Li=9,mn={[d.Keys.end]:(i,t)=>i[i.length-1],[d.Keys.home]:(i,t)=>i[0],[d.Keys.up]:(i,t)=>i[t-1],[d.Keys.down]:(i,t)=>i[t+1]},He={[j.dayperiod]:Si,[j.hour]:Ci,[j.minute]:ki,[j.second]:_i},Ct=class extends o.Component{constructor(i){super(i),this.intl=null,this._element=null,this.service=null,this.virtualization=null,this.topOffset=0,this.bottomOffset=0,this.itemHeight=0,this.listHeight=0,this.topThreshold=0,this.bottomThreshold=0,this.animateToIndex=!1,this.focus=t=>{Promise.resolve().then(()=>{this.element&&this.element.focus(t)})},this.itemOffset=t=>{if(!this.virtualization||!this.service)return-1;const e=this.service.selectedIndex(this.props.value),s=this.virtualization.activeIndex(),a=this.virtualization.itemOffset(s),r=Math.abs(Math.ceil(t)-a);if(e===s&&r<cn)return a;const h=e>s;return h&&r>=this.bottomThreshold||!h&&r>this.topThreshold?this.virtualization.itemOffset(s+1):a},this.calculateHeights=()=>{this.dom.didCalculate&&(this.itemHeight=this.dom.itemHeight,this.listHeight=this.dom.timeListHeight,this.topOffset=(this.listHeight-this.itemHeight)/2,this.bottomOffset=this.listHeight-this.itemHeight,this.props.mobileMode&&(this.topOffset+=Li,this.bottomOffset+=Li*2),this.topThreshold=this.itemHeight*Fi,this.bottomThreshold=this.itemHeight*(1-Fi))},this.configureServices=({min:t,max:e,value:s}=this.props)=>{if(this.service){const[a,r]=this.service.limitRange(t||this.min,e||this.max,s||this.props.value);this.service.configure(this.serviceSettings({min:a,max:r}))}},this.serviceSettings=t=>{const e={boundRange:this.props.boundRange||Ct.defaultProps.boundRange,insertUndividedMax:!1,min:l.cloneDate(this.min),max:l.cloneDate(this.max),part:this.props.part,step:this.step},s=Object.assign({},e,t);return s.boundRange=s.part.type!=="hour"||this.props.boundRange||Ct.defaultProps.boundRange,s},this.handleScrollAction=({target:t,animationInProgress:e})=>{if(!(!this.virtualization||!this.service)&&t&&!e){this.animateToIndex=!1;const s=this.virtualization.itemIndex(this.itemOffset(t.scrollTop)),a=this.service.data(this.props.value)[s];this.handleChange(a)}},this.handleFocus=t=>{const{onFocus:e}=this.props;e&&e.call(void 0,t)},this.handleBlur=t=>{const{onBlur:e}=this.props;e&&e.call(void 0,t)},this.handleMouseOver=()=>{if(!this._element)return;const t=d.getActiveElement(document);document&&t!==this._element&&this.props.show&&this._element.focus({preventScroll:!0})},this.handleKeyDown=t=>{if(!this.service)return;const{keyCode:e}=t;(e===d.Keys.down||e===d.Keys.up||e===d.Keys.end||e===d.Keys.home)&&t.preventDefault();const a=(mn[t.keyCode]||d.noop)(this.service.data(this.props.value),this.service.selectedIndex(this.props.value));a&&this.handleChange(a)},this.handleChange=ss(t=>{if(!this.service)return;const e=this.service.apply(this.props.value,t.value);if(this.props.value.getTime()===e.getTime())return;const{onChange:s}=this.props;s&&s.call(void 0,e)},un),this.dom=new Ps}get element(){return this._element}get animate(){return!!(this.props.smoothScroll&&this.animateToIndex)}get min(){return this.props.min||Ct.defaultProps.min}get max(){return this.props.max||Ct.defaultProps.max}get step(){return this.props.step!==void 0&&this.props.step!==0?Math.floor(this.props.step):Ct.defaultProps.step}componentDidMount(){Promise.resolve().then(()=>{this._element&&(this.dom.calculateHeights(this._element),this.forceUpdate())})}componentDidUpdate(){if(!this.virtualization||!this.service)return;const i=this.service.selectedIndex(this.props.value);this.virtualization[this.animate?"animateToIndex":"scrollToIndex"](i),this.animateToIndex=!0}render(){if(!this.props.part.type||!He[this.props.part.type])return;this.calculateHeights(),this.intl=x.provideIntlService(this),this.service=new He[this.props.part.type](this.intl),this.configureServices();const i=this.service.data(this.props.value),t="translateY("+this.topOffset+"px)",e=this.service.total(this.props.value),s=o.createElement("ul",{style:{transform:t,msTransform:t},className:"k-reset"},i.map((a,r)=>o.createElement("li",{key:r,className:"k-item",onClick:()=>{this.handleChange(a)}},o.createElement("span",null,a.text))));return o.createElement("div",{className:"k-time-list",id:String(this.props.id||""),tabIndex:this.props.disabled?-1:0,ref:a=>{this._element=a},onKeyDown:this.handleKeyDown,onFocus:this.handleFocus,onBlur:this.handleBlur,onMouseOver:this.handleMouseOver},this.dom.didCalculate?o.createElement(gt,{bottomOffset:this.bottomOffset,children:s,className:"k-time-container",itemHeight:this.itemHeight,maxScrollDifference:this.listHeight,onScrollAction:this.handleScrollAction,ref:a=>{this.virtualization=a},role:"presentation",skip:dn,tabIndex:-1,take:e,topOffset:this.topOffset,total:e}):o.createElement("div",{className:"k-time-container"},s))}};let qt=Ct;qt.propTypes={id:n.number,max:n.instanceOf(Date),min:n.instanceOf(Date),part:function(i,t,e){const s=i[t];if(!s||!He[s.type])throw new Error(`
|
|
16
16
|
Invalid prop '${t}' supplied to ${e}.
|
|
17
17
|
Supported part types are hour|minute|second|dayperiod.
|
|
18
18
|
`);return null},step:function(i,t,e){const s=i[t];if(s!==void 0&&s<=0)throw new Error(`
|
|
19
19
|
Invalid prop '${t}' supplied to ${e}.
|
|
20
20
|
${t} cannot be less than 1.
|
|
21
|
-
`);return null},value:n.instanceOf(Date),smoothScroll:n.bool,show:n.bool},qt.defaultProps={boundRange:!1,max:nt,min:B,step:1,smoothScroll:!0},x.registerForIntl(qt);const Be=new RegExp(`${j.hour}|${j.minute}|${j.second}|${j.dayperiod}|literal`),dt=class extends o.Component{constructor(i){super(i),this._element=null,this._nowButton=null,this.dateFormatParts=[],this.timeLists=[],this.focus=(t,e)=>{Promise.resolve().then(()=>{e&&this._nowButton&&this._nowButton.element&&this._nowButton.element.focus();const s=this.timeLists[0];!e&&this.state.activeListIndex===-1&&!this.hasActiveButton()&&s&&s.element&&s.focus(t)})},this.timeFormatReducer=(t,e)=>t+e.pattern,this.timeFormatFilter=(t,e,s)=>{const a=e>=1&&s[e-1];return a&&a&&t.type==="literal"?Be.test(a.type||""):Be.test(t.type||"")},this.focusList=t=>{this.timeLists.length&&this.timeLists.reduce(this.listReducer,[]).map(e=>t===1?e.next:e.prev).map(e=>e&&e.element&&e.element.focus({preventScroll:!0}))},this.listReducer=(t,e,s,a)=>t.length||e.props.id!==this.state.activeListIndex?t:[{next:a[s+1]||e,prev:a[s-1]||e}],this.showNowButton=()=>!this.hasSteps()&&this.props.nowButton&&Ne(ut(),this.min,this.max),this.handleKeyDown=t=>{const{keyCode:e}=t;switch(e){case d.Keys.left:t.preventDefault(),this.focusList(0);return;case d.Keys.right:t.preventDefault(),this.focusList(1);return;default:return}},this.handleListBlur=()=>{this.nextTick(()=>{this.setState({activeListIndex:-1})})},this.handleListFocus=t=>{clearTimeout(this.nextTickId),this.setState({activeListIndex:t})},this.handleChange=t=>{const{onChange:e}=this.props;e&&e.call(void 0,t)},this.snapTime=mi(di(this.props.steps,this.props.min||dt.defaultProps.min)),this.state={activeListIndex:-1},this.hasActiveButton=this.hasActiveButton.bind(this)}get element(){return this._element}get value(){return Ys(this.snapTime(l.cloneDate(this.props.value||B)),this.min,this.max)}get intl(){return x.provideIntlService(this)}get min(){return this.snapTime(this.props.min||dt.defaultProps.min)}get max(){return this.snapTime(this.props.max||dt.defaultProps.max)}get steps(){return this.props.steps||dt.defaultProps.steps}get boundRange(){return this.props.boundRange!==void 0?this.props.boundRange:dt.defaultProps.boundRange}componentWillUnmount(){clearTimeout(this.nextTickId)}componentDidMount(){const{onMount:i}=this.props;i&&i.call(void 0,this.value)}render(){const{format:i,smoothScroll:t,onNowClick:e,className:s,disabled:a,mobileMode:r,show:h,onNowKeyDown:u}=this.props;this.snapTime=mi(di(this.steps,this.min)),this.dateFormatParts=this.intl.splitDateFormat(i||dt.defaultProps.format).filter(this.timeFormatFilter);const c=d.classNames({"k-disabled":a,"k-time-part":r},s);this.timeLists=[];const m=x.provideLocalizationService(this),f=m.toLanguageString(ve,k[ve]);return o.createElement("div",{className:c},o.createElement("div",{className:"k-time-header"},o.createElement("span",{className:"k-title"},this.intl.formatDate(this.value,this.dateFormatParts.reduce(this.timeFormatReducer,""))),this.showNowButton()&&o.createElement(L.Button,{type:"button",ref:g=>{this._nowButton=g},className:"k-time-now",fillMode:"flat",themeColor:"primary",title:f,onKeyDown:u,"aria-label":f,onClick:e,tabIndex:a?-1:0},m.toLanguageString(ge,k[ge]))),o.createElement("div",{className:"k-time-list-container",onKeyDown:this.handleKeyDown},o.createElement("span",{className:"k-time-highlight"}),this.dateFormatParts.map((g,w)=>g.type!=="literal"?o.createElement("div",{key:w,className:d.classNames("k-time-list-wrapper",{"k-focus":w===this.state.activeListIndex}),role:"presentation",tabIndex:-1},o.createElement("span",{className:"k-title",onMouseDown:v=>{v.preventDefault()}},this.intl.dateFieldName(g)),o.createElement(qt,{min:this.min,max:this.max,boundRange:this.boundRange,part:g,step:g.type?this.steps[g.type]:1,smoothScroll:t,ref:v=>{v&&this.timeLists.push(v)},id:w,onFocus:()=>{this.handleListFocus(w)},onBlur:this.handleListBlur,onChange:this.handleChange,value:this.value,disabled:a,show:h,mobileMode:r})):o.createElement("div",{key:w,className:"k-time-separator"},g.pattern))))}nextTick(i){clearTimeout(this.nextTickId),this.nextTickId=window.setTimeout(()=>i())}hasActiveButton(){const i=d.getActiveElement(document);return this._nowButton&&i===this._nowButton.element}hasSteps(){const i=Object.keys(this.steps);return i.length!==i.reduce((t,e)=>t+this.steps[e],0)}};let mt=dt;mt.propTypes={cancelButton:n.bool,disabled:n.bool,format:n.oneOfType([n.string,n.shape({skeleton:n.string,pattern:n.string,date:n.oneOf(["short","medium","long","full"]),time:n.oneOf(["short","medium","long","full"]),datetime:n.oneOf(["short","medium","long","full"]),era:n.oneOf(["narrow","short","long"]),year:n.oneOf(["numeric","2-digit"]),month:n.oneOf(["numeric","2-digit","narrow","short","long"]),day:n.oneOf(["numeric","2-digit"]),weekday:n.oneOf(["narrow","short","long"]),hour:n.oneOf(["numeric","2-digit"]),hour12:n.bool,minute:n.oneOf(["numeric","2-digit"]),second:n.oneOf(["numeric","2-digit"]),timeZoneName:n.oneOf(["short","long"])})]),max:n.instanceOf(Date),min:n.instanceOf(Date),nowButton:n.bool,steps:n.shape({hour:n.number,minute:n.number,second:n.number}),smoothScroll:n.bool,tabIndex:n.number,value:n.instanceOf(Date),show:n.bool},mt.defaultProps={value:null,disabled:!1,nowButton:!0,cancelButton:!0,format:"hh:mm a",min:ct,max:nt,steps:{},boundRange:!1},x.registerForIntl(mt),x.registerForLocalization(mt);const ze=class extends o.Component{constructor(i){super(i),this._element=null,this._cancelButton=null,this._acceptButton=null,this.timePart=null,this.focusActiveList=()=>{this.timePart&&this.timePart.focus({preventScroll:!0})},this.handleKeyDown=t=>{const{keyCode:e}=t;switch(e){case d.Keys.enter:this.hasActiveButton()||this.handleAccept(t);return;default:return}},this.revertToNowButton=t=>{const{keyCode:e,shiftKey:s}=t;!s&&e===d.Keys.tab&&(t.preventDefault(),this.props.nowButton!==!1?this.timePart&&this.timePart.focus({preventScroll:!0},!0):this.timePart&&this.timePart.focus({preventScroll:!0}))},this.handleNowKeyDown=t=>{var a;const{keyCode:e,shiftKey:s}=t;s&&e===d.Keys.tab?(t.preventDefault(),this._acceptButton&&((a=this._acceptButton.element)==null||a.focus({preventScroll:!0}))):e===d.Keys.enter&&(t.stopPropagation(),this.handleNowClick(t))},this.handleAccept=t=>{const e=this.mergeValue(l.cloneDate(this.value||ut()),this.timePart?this.timePart.value:this.current);this.setState({value:e}),this.valueDuringOnChange=e;const{onChange:s}=this.props;s&&s.call(void 0,{syntheticEvent:t,nativeEvent:t.nativeEvent,value:this.value,target:this}),this.valueDuringOnChange=void 0},this.handleReject=t=>{this.setState({current:this.value});const{onReject:e}=this.props;e&&e.call(void 0,t)},this.handleNowClick=t=>{const e=this.mergeValue(l.cloneDate(this.value||ut()),ut());this.setState({current:e,value:e}),this.valueDuringOnChange=e;const{onChange:s}=this.props;s&&s.call(void 0,{syntheticEvent:t,nativeEvent:t.nativeEvent,value:this.value,target:this}),this.valueDuringOnChange=void 0},this.handleChange=t=>{this.setState({current:t});const{handleTimeChange:e}=this.props;e&&e.call(void 0,{time:t})},this.dateFormatParts=this.intl.splitDateFormat(this.props.format||ze.defaultProps.format),this.mergeValue=Us(Ks(this.dateFormatParts)),this.hasActiveButton=this.hasActiveButton.bind(this),this.state={current:this.props.value||B,value:this.props.value||ze.defaultProps.value}}get element(){return this._element}get value(){const i=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value;return i!==null?l.cloneDate(i):null}get intl(){return x.provideIntlService(this)}get current(){return this.state.current!==null?l.cloneDate(this.state.current):null}componentWillUnmount(){clearTimeout(this.nextTickId)}render(){const{format:i,cancelButton:t,disabled:e,tabIndex:s,className:a,smoothScroll:r,min:h,max:u,boundRange:c,nowButton:m,steps:f,show:g,mobileMode:w}=this.props,v=x.provideLocalizationService(this),E=v.toLanguageString(Qt,k[Qt]),V=v.toLanguageString(At,k[At]);return o.createElement("div",{ref:N=>{this._element=N},tabIndex:e?void 0:s||0,className:d.classNames("k-timeselector",a,{"k-disabled":e}),onKeyDown:this.handleKeyDown},o.createElement(mt,{ref:N=>{this.timePart=N},value:this.current,onChange:this.handleChange,onNowClick:this.handleNowClick,format:i,smoothScroll:r,min:h,max:u,boundRange:c,disabled:e,nowButton:m,steps:f,show:g,mobileMode:w,onNowKeyDown:this.handleNowKeyDown}),this.props.footer&&o.createElement("div",{className:"k-time-footer k-actions k-actions-stretched"},t&&o.createElement(L.Button,{type:"button",ref:N=>{this._cancelButton=N},className:"k-time-cancel",onClick:this.handleReject,title:E,"aria-label":E},E),o.createElement(L.Button,{type:"button",ref:N=>{this._acceptButton=N},className:"k-time-accept",themeColor:"primary",onClick:this.handleAccept,onKeyDown:this.revertToNowButton,title:V,"aria-label":V},V)))}nextTick(i){clearTimeout(this.nextTickId),this.nextTickId=window.setTimeout(()=>i())}hasActiveButton(){if(!this._acceptButton||!this._acceptButton.element)return!1;const i=d.getActiveElement(document);return this._acceptButton&&i===this._acceptButton.element||this._cancelButton&&i===this._cancelButton.element}};let Et=ze;Et.propTypes={cancelButton:n.bool,className:n.string,disabled:n.bool,format:n.oneOfType([n.string,n.shape({skeleton:n.string,pattern:n.string,date:n.oneOf(["short","medium","long","full"]),time:n.oneOf(["short","medium","long","full"]),datetime:n.oneOf(["short","medium","long","full"]),era:n.oneOf(["narrow","short","long"]),year:n.oneOf(["numeric","2-digit"]),month:n.oneOf(["numeric","2-digit","narrow","short","long"]),day:n.oneOf(["numeric","2-digit"]),weekday:n.oneOf(["narrow","short","long"]),hour:n.oneOf(["numeric","2-digit"]),hour12:n.bool,minute:n.oneOf(["numeric","2-digit"]),second:n.oneOf(["numeric","2-digit"]),timeZoneName:n.oneOf(["short","long"])})]),max:n.instanceOf(Date),min:n.instanceOf(Date),nowButton:n.bool,steps:n.shape({hour:n.number,minute:n.number,second:n.number}),smoothScroll:n.bool,tabIndex:n.number,value:n.instanceOf(Date),show:n.bool},Et.defaultProps={value:null,disabled:!1,cancelButton:!0,format:"t",min:ct,max:nt,boundRange:!1,footer:!0},x.registerForIntl(Et),x.registerForLocalization(Et);const G=class extends o.Component{constructor(i){super(i),this._element=null,this._dateInput=o.createRef(),this._timeSelector=null,this.shouldFocusDateInput=!1,this.prevShow=!1,this.focus=()=>{this.dateInput&&this.dateInput.focus()},this.renderTimeSelector=()=>{const{smoothScroll:t,cancelButton:e,nowButton:s,disabled:a,format:r,steps:h}=this.props;return o.createElement(Et,{ref:this.setTimeSelectorRef,className:this.mobileMode?"k-reset k-timeselector-lg":"",mobileMode:this.mobileMode,show:this.show,cancelButton:e,disabled:a,nowButton:s,format:r,min:this.min,max:this.max,steps:h,smoothScroll:t,value:this.value,footer:!this.mobileMode,handleTimeChange:this.mobileMode&&this.handleTimeChange,onChange:this.handleValueChange,onReject:this.handleValueReject})},this.renderPopup=()=>{const{popupClass:t,...e}=this.popupSettings,s=d.classNames("k-group k-reset",t),a={popupClass:"k-timepicker-popup",show:this.show,animate:this.element!==null,anchor:this.element,className:s,id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},...e};return this.props.popup?o.createElement(this.props.popup,{...a},this.renderTimeSelector()):o.createElement(Wt.Popup,{...a},this.renderTimeSelector())},this.renderAdaptivePopup=()=>{const{windowWidth:t=0}=this.state,e={expand:this.show,onClose:this.handleBlur,adaptiveTitle:this.props.adaptiveTitle,windowWidth:t,footer:{cancelText:this.localizationService.toLanguageString(Pt,k[Qt]),onCancel:this.handleValueReject,applyText:this.localizationService.toLanguageString(At,k[At]),onApply:s=>this.handleValueChange(s)}};return o.createElement(ne,{...e},o.createElement(ht.ActionSheetContent,{className:"!k-overflow-hidden"},this.renderTimeSelector()))},this.setTimeSelectorRef=t=>{this._timeSelector=t},this.nextValue=(t,e)=>t.value!==void 0?t.value:e.value,this.nextShow=(t,e)=>t.show!==void 0?t.show:e.show,this.handleInputValueChange=t=>{const e=this.mergeTime(t.value);this.handleValueChange({...t,value:e})},this.handleTimeChange=t=>{this.setState({candidate:t.time})},this.handleValueChange=t=>{this.setState({value:l.cloneDate(t.value||this.state.candidate)}),this.valueDuringOnChange=t.value,this.showDuringOnChange=!1,this.shouldFocusDateInput=!0;const{onChange:e}=this.props,s=this.value||this.state.candidate;e&&e.call(void 0,{syntheticEvent:t.syntheticEvent,nativeEvent:t.nativeEvent,value:s,show:this.show,target:this}),this.valueDuringOnChange=void 0,this.showDuringOnChange=void 0,this.setShow(!1)},this.handleFocus=()=>{this.setState({focused:!0})},this.handleBlur=()=>{this.setState({focused:!1}),this.setShow(!1)},this.handleValueReject=t=>{this.setShow(!1)},this.handleIconClick=t=>{this.props.disabled||(this.shouldFocusDateInput=!0,this.setShow(!this.show))},this.handleIconMouseDown=t=>{t.preventDefault()},this.handleKeyDown=t=>{const{altKey:e,keyCode:s}=t;if(s===d.Keys.esc){this.shouldFocusDateInput=!0,this.setShow(!1);return}e&&(s===d.Keys.up||s===d.Keys.down)&&(t.preventDefault(),t.stopPropagation(),this.shouldFocusDateInput=s===d.Keys.up,this.setShow(s===d.Keys.down))},d.validatePackage(ft),this.state={value:this.props.defaultValue||G.defaultProps.defaultValue,show:this.props.defaultShow||G.defaultProps.defaultShow,focused:!1,candidate:null},this.normalizeTime=this.normalizeTime.bind(this),this.setShow=this.setShow.bind(this),this.mergeTime=this.mergeTime.bind(this)}get _popupId(){return this.props.id+"-popup-id"}get document(){if(d.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get dateInput(){return this._dateInput.current}get timeSelector(){return this._timeSelector}get value(){const i=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value;return i!==null?l.cloneDate(i):null}get show(){return this.showDuringOnChange!==void 0?this.showDuringOnChange:this.props.show!==void 0?this.props.show:this.state.show}get name(){return this.props.name}get validity(){const i=this.value&&this.normalizeTime(this.value),t=this.normalizeTime(this.min),e=this.normalizeTime(this.max),s=$s(i,t,e),a=this.props.validationMessage!==void 0,r=(!this.required||this.value!==null)&&s,h=this.props.valid!==void 0?this.props.valid:r;return{customError:a,rangeOverflow:js(i,e),rangeUnderflow:Ts(i,t),valid:h,valueMissing:this.value===null}}get mobileMode(){return!!(this.state.windowWidth&&this.state.windowWidth<=ae&&this.props.adaptive)}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:G.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:G.defaultProps.required}get popupSettings(){return this.props.popupSettings||G.defaultProps.popupSettings}get min(){return this.props.min!==void 0?this.props.min:G.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:G.defaultProps.max}get dateInputComp(){return this.props.dateInput||G.defaultProps.dateInput}get localizationService(){return x.provideLocalizationService(this)}componentDidMount(){var i;this.observerResize=d.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.show&&this.forceUpdate(),(i=this.document)!=null&&i.body&&this.observerResize&&this.observerResize.observe(this.document.body)}componentDidUpdate(){this._timeSelector&&this.show&&!this.prevShow?this._timeSelector.focusActiveList():this.dateInput&&this.dateInput.element&&!this.show&&this.shouldFocusDateInput&&this.dateInput.element.focus({preventScroll:!0}),this.prevShow=this.show,this.shouldFocusDateInput=!1}componentWillUnmount(){var i;(i=this.document)!=null&&i.body&&this.observerResize&&this.observerResize.disconnect()}render(){const{size:i=G.defaultProps.size,rounded:t=G.defaultProps.rounded,fillMode:e=G.defaultProps.fillMode,disabled:s,tabIndex:a,title:r,id:h,className:u,format:c,formatPlaceholder:m,width:f,name:g,steps:w,validationMessage:v,required:E,validityStyles:V,ariaLabelledBy:N,ariaDescribedBy:S}=this.props,y=!this.validityStyles||this.validity.valid,b={disabled:s,format:c,formatPlaceholder:m,id:h,ariaLabelledBy:N,ariaDescribedBy:S,max:this.normalizeTime(this.max),min:this.normalizeTime(this.min),name:g,onChange:this.handleInputValueChange,required:E,steps:w,tabIndex:this.show?-1:a,title:r,valid:this.validity.valid,validationMessage:v,validityStyles:V,value:this.value&&this.normalizeTime(this.value),label:void 0,placeholder:this.state.focused?null:this.props.placeholder,ariaHasPopup:"dialog",ariaExpanded:this.show,size:null,fillMode:null,rounded:null,readonly:this.mobileMode},K=this.localizationService.toLanguageString(Pt,k[Pt]),M=this.localizationService.toLanguageString(we,k[we]),F=o.createElement(d.AsyncFocusBlur,{onFocus:this.handleFocus,onBlur:this.mobileMode?void 0:this.handleBlur,onSyncBlur:this.props.onBlur,onSyncFocus:this.props.onFocus},({onFocus:U,onBlur:O})=>o.createElement(o.Fragment,null,o.createElement("div",{id:this.props.id,ref:_=>{this._element=_},className:d.classNames("k-input","k-timepicker",{[`k-input-${d.kendoThemeMaps.sizeMap[i]||i}`]:i,[`k-rounded-${d.kendoThemeMaps.roundedMap[t]||t}`]:t,[`k-input-${e}`]:e,["k-invalid"]:!y,["k-required"]:this.required,["k-disabled"]:this.props.disabled},u),onKeyDown:this.handleKeyDown,style:{width:f},onFocus:U,onBlur:O,onClick:this.mobileMode?this.handleIconClick:void 0},o.createElement(this.dateInputComp,{_ref:this._dateInput,ariaRole:"combobox",ariaControls:this._popupId,...b}),o.createElement(L.Button,{tabIndex:-1,type:"button",icon:"clock",svgIcon:J.clockIcon,onMouseDown:this.handleIconMouseDown,onClick:this.mobileMode?void 0:this.handleIconClick,title:M,className:"k-input-button",rounded:null,"aria-label":K}),!this.mobileMode&&this.renderPopup()),this.mobileMode&&this.renderAdaptivePopup()));return this.props.label?o.createElement(ye,{dateInput:this._dateInput,label:this.props.label,editorId:h,editorValid:y,editorDisabled:this.props.disabled,children:F,style:{width:this.props.width}}):F}normalizeTime(i){return R(B,i)}setShow(i){const{onOpen:t,onClose:e}=this.props;this.show!==i&&(this.setState({show:i}),i&&t&&t.call(void 0,{target:this}),!i&&e&&e.call(void 0,{target:this}))}mergeTime(i){return this.value&&i?R(this.value,i):i}calculateMedia(i){for(let t of i)this.setState({windowWidth:t.target.clientWidth})}};let Ot=G;Ot.displayName="TimePicker",Ot.propTypes={className:n.string,cancelButton:n.bool,nowButton:n.bool,defaultShow:n.bool,defaultValue:n.instanceOf(Date),disabled:n.bool,format:n.oneOfType([n.string,n.shape({skeleton:n.string,pattern:n.string,date:n.oneOf(["short","medium","long","full"]),time:n.oneOf(["short","medium","long","full"]),datetime:n.oneOf(["short","medium","long","full"]),era:n.oneOf(["narrow","short","long"]),year:n.oneOf(["numeric","2-digit"]),month:n.oneOf(["numeric","2-digit","narrow","short","long"]),day:n.oneOf(["numeric","2-digit"]),weekday:n.oneOf(["narrow","short","long"]),hour:n.oneOf(["numeric","2-digit"]),hour12:n.bool,minute:n.oneOf(["numeric","2-digit"]),second:n.oneOf(["numeric","2-digit"]),timeZoneName:n.oneOf(["short","long"])})]),formatPlaceholder:n.oneOfType([n.oneOf(["wide","narrow","short","formatPattern"]),n.shape({year:n.string,month:n.string,day:n.string,hour:n.string,minute:n.string,second:n.string})]),id:n.string,ariaLabelledBy:n.string,ariaDescribedBy:n.string,min:n.instanceOf(Date),max:n.instanceOf(Date),name:n.string,popupSettings:n.shape({animate:n.bool,appendTo:n.any,popupClass:n.string}),show:n.bool,steps:n.shape({hour:n.number,minute:n.number,second:n.number}),smoothScroll:n.bool,tabIndex:n.number,title:n.string,value:n.instanceOf(Date),width:n.oneOfType([n.number,n.string]),validationMessage:n.string,required:n.bool,validate:n.bool,valid:n.bool,size:n.oneOf([null,"small","medium","large"]),rounded:n.oneOf([null,"small","medium","large","full"]),fillMode:n.oneOf([null,"solid","flat","outline"])},Ot.defaultProps={defaultShow:!1,defaultValue:null,disabled:!1,format:"t",max:nt,min:ct,popupSettings:{},tabIndex:0,steps:{},required:!1,validityStyles:!0,dateInput:ot,size:"medium",rounded:"medium",fillMode:"solid"};const Ai=d.createPropsContext(),Hi=d.withIdHOC(d.withPropsContext(Ai,Ot));Hi.displayName="KendoReactTimePicker",x.registerForLocalization(Ot);const Bi=2,qe=class extends o.Component{constructor(i){super(i),this._element=null,this.isActive=!1,this.focusActiveDate=()=>{if(!this._element)return;const t=this._element.querySelector("td.k-focus"),e=this._element.querySelector(".k-state-pending-focus");t&&t[0]&&t[0].classList.remove("k-focus"),e&&e.classList.add("k-focus"),this.isActive=!0},this.blurActiveDate=()=>{if(!this._element)return;const t=this._element.querySelector("td.k-focus");t&&t.classList.remove("k-focus"),this.isActive=!1},this.rotateSelectionRange=t=>{if(t.start===null||t.end===null)return t;const e=t.end<t.start;return{start:e?t.end:t.start,end:e?t.start:t.end}},this.handleDateChange=(t,e=!1)=>{const{onChange:s}=this.props;if(s){const a={syntheticEvent:t.syntheticEvent,nativeEvent:t.nativeEvent,value:l.cloneDate(t.value),target:this,isTodayClick:e};s.call(void 0,a)}}}get element(){return this._element}get weekNumber(){return!!(this.props.showWeekNumbers&&this.props.activeView===C.month)}get min(){return this.props.min!==void 0?this.props.min:qe.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:qe.defaultProps.max}componentDidUpdate(){this.isActive&&this.focusActiveDate()}render(){const i=this.props.allowReverse?this.rotateSelectionRange(this.props.selectionRange):this.props.selectionRange,t=d.classNames("k-calendar-view k-align-items-start k-justify-content-center",{"k-vstack":this.props.verticalView,"k-hstack":!this.props.verticalView,"k-calendar-monthview":this.props.activeView===C.month,"k-calendar-yearview":this.props.activeView===C.year,"k-calendar-decadeview":this.props.activeView===C.decade,"k-calendar-centuryview":this.props.activeView===C.century});return o.createElement("div",{ref:e=>{this._element=e},className:t},this.props.dates.map(e=>o.createElement("table",{className:"k-calendar-table k-content",key:e.getTime(),role:"grid"},o.createElement(Lt,{bus:this.props.bus,service:this.props.service,key:e.getTime(),direction:"horizontal",activeView:this.props.activeView,cellUID:this.props.cellUID,viewDate:e,min:this.min,max:this.max,focusedDate:this.props.focusedDate,selectionRange:i,selectedDate:this.props.value,showWeekNumbers:this.weekNumber,onChange:this.handleDateChange,onCellEnter:this.props.onCellEnter,cell:this.props.cell,weekCell:this.props.weekCell}))))}};let Vt=qe;Vt.defaultProps={showWeekNumbers:!1,views:Bi,take:Bi,allowReverse:!0,min:it,max:st};const Re=(i=Q.defaultProps.min,t=Q.defaultProps.max,e)=>e instanceof Date&&!Array.isArray(e)&&A(l.getDate(e),i,t)?l.getDate(e):null,zi=(i=Q.defaultProps.min,t=Q.defaultProps.max,e)=>Array.isArray(e)?e.filter(s=>A(s,i,t)).map(s=>l.getDate(s)):null,qi=i=>typeof i=="object"&&!(i instanceof Date)&&i!==null&&!Array.isArray(i)?i:q,Ri=(i,t,e)=>i||t&&t[0]||e&&e.start,pn=(i,t)=>i.start===null&&t===null?"start":i.end===null?"end":"start",kt=class extends o.Component{constructor(i){super(i),this.dates=[],this.selectedDate=null,this.selectedMultiple=null,this.selectedRange=q,this._focusedDate=new Date,this.cellUID=this.props.id+"-cell-uid",this.activeRangeEnd="start",this._element=null,this.intl=null,this.localization=null,this.service=null,this.calendarViewList=null,this.isActive=!1,this.calculateFocusFromValue=!0,this.focus=()=>{this._element&&this._element.focus()},this.clampRange=c=>({start:c,end:null}),this.rangeWithFocused=(c,m)=>({start:c.start,end:c.end===null&&c.start!==null&&this.isActive?m:c.end}),this.generateRange=(c,m)=>{const{end:f,start:g}=m,w=m.start!==null&&c.getTime()<=m.start.getTime();return!this.props.allowReverse&&w?{start:c,end:this.selectedRange.start}:this.activeRange!=="end"?{start:c,end:f}:{start:g||this.selectedDate,end:c}},this.canNavigate=c=>{if(!this.service)return!1;const m=this.service.move(this.focusedDate,c);return this.min<=m&&m<=this.max||this.service.isInSameView(m,this.min)||this.service.isInSameView(m,this.max)},this.navigate=(c,m)=>{this.calculateFocusFromValue=!1;const f=this.move(c,m);this.setState({navigateDate:f,focusedDate:f})},this.move=(c,m)=>this.clampDate(this.service.move(m,c)),this.clampDate=c=>Y(c,this.min,this.max),this.shouldAutoCorrect=(c,m)=>{const{end:f,start:g}=m;return this.activeRange!=="end"?f!==null&&c>f:g!==null&&c<g},this.handleCellEnter=c=>{this.props.mode==="range"&&(this.calculateFocusFromValue=!1,this.setState({focusedDate:c}))},this.handleMouseDown=c=>{c.preventDefault()},this.handleClick=c=>{this._element&&this._element.focus({preventScroll:!0})},this.handleFocus=c=>{if(this.isActive=!0,!this.calendarViewList)return;this.calendarViewList.focusActiveDate();const{onFocus:m}=this.props;m&&m.call(void 0,c)},this.handleBlur=c=>{if(this.isActive=!1,!this.calendarViewList)return;this.calendarViewList.blurActiveDate();const{onBlur:m}=this.props;m&&m.call(void 0,c)},this.handleTodayClick=c=>{this.todayIsInRange&&this.handleDateChange(c)},this.handlePrevButtonClick=()=>{const c=D.PrevView;if(this.state.activeView>0&&this.focusedDate.getFullYear()>this.dates[0].getFullYear())this.navigate(c,this.move(c,this.focusedDate));else{const m=this.isInMonth(this.focusedDate,this.dates[1])?this.move(c,this.focusedDate):this.focusedDate;this.navigate(c,m)}},this.handleNextButtonClick=()=>{this.navigate(D.NextView,this.focusedDate)},this.handleKeyDown=c=>{const{keyCode:f,ctrlKey:g,metaKey:w}=c;if(f===84){const v=z();this.calculateFocusFromValue=!1,this.setState({focusedDate:v,navigateDate:v})}if((g||w)&&(f===d.Keys.left&&this.handlePrevButtonClick(),f===d.Keys.right&&this.handleNextButtonClick()),f===d.Keys.enter){const v={syntheticEvent:c,nativeEvent:c.nativeEvent,value:this.focusedDate,target:this};this.handleDateChange(v)}else{const v=Y(this.navigation.move(this.focusedDate,this.navigation.action(c),this.state.activeView,this.service,c),this.min,this.max);if(l.isEqualDate(this.focusedDate,v))return;this.dates&&this.service&&!this.service.isInArray(v,this.dates)&&this.setState({navigateDate:v}),this.calculateFocusFromValue=!1,this.setState({focusedDate:v})}c.preventDefault()},this.handleViewChange=({view:c})=>{this.calculateFocusFromValue=!1,this.setState(m=>({activeView:c,navigateDate:m.focusedDate}))},this.handleDateChange=c=>{const m=l.cloneDate(c.value),f=this.bus.canMoveDown(this.state.activeView);if(this.props.disabled)return;if(f)if(c.isTodayClick)this.bus.moveToBottom(this.state.activeView);else{this.bus.moveDown(this.state.activeView,c.syntheticEvent),this.setState({focusedDate:m,navigateDate:m});return}this.calculateFocusFromValue=!0;let g;switch(this.props.mode){case"single":g=l.cloneDate(c.value);break;case"multiple":if(Array.isArray(this.selectedMultiple)){const v=this.selectedMultiple.slice();let E=-1;v.forEach((V,N)=>{l.isEqualDate(V,c.value)&&(E=N)}),E!==-1?v.splice(E,1):v.push(l.cloneDate(c.value)),g=v.slice()}else this.selectedDate?g=[l.cloneDate(this.selectedDate),l.cloneDate(c.value)]:g=[l.cloneDate(c.value)];break;case"range":{g=this.selectedRange.start!==null&&this.selectedRange.end!==null&&this.activeRange==="start"?this.clampRange(c.value):this.generateRange(c.value,this.selectedRange),this.activeRangeEnd=this.activeRange!=="end"?"end":"start";break}default:g=l.cloneDate(c.value);break}this.valueDuringOnChange=g,c.isTodayClick&&this.setState({navigateDate:m}),this.setState({value:g,focusedDate:m}),this.valueDuringOnChange=g;const{onChange:w}=this.props;if(w){const v={syntheticEvent:c.syntheticEvent,nativeEvent:c.nativeEvent,value:g,target:this};w.call(void 0,v)}this.valueDuringOnChange=void 0};const t=i.value!==void 0?i.value:i.defaultValue||kt.defaultProps.defaultValue,e=Re(this.min,this.max,t),s=zi(this.min,this.max,t),a=qi(t),r=Ri(e,s,a),h=Yt(C[i.defaultActiveView],this.bottomView,this.topView),u=Y(i.focusedDate||r||z(),this.min,this.max);this.state={value:t,activeView:h,focusedDate:u,navigateDate:u},this.activeRangeEnd=pn(a,e),this.bus=new de(this.handleViewChange),this.navigation=new me(this.bus),this.calculateFocusFromValue=!1,this.lastView=h,this.lastViewsCount=this.props.views||Vt.defaultProps.views}get wrapperID(){return this.props.id+"-wrapper-id"}get isRtl(){return this.props.dir==="rtl"}get element(){return this._element}get value(){return this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value}get focusedDate(){return l.cloneDate(this._focusedDate)}get min(){return l.getDate(this.props.min!==void 0?this.props.min:kt.defaultProps.min)}get max(){return l.getDate(this.props.max!==void 0?this.props.max:kt.defaultProps.max)}get bottomView(){return C[this.props.bottomView!==void 0?this.props.bottomView:kt.defaultProps.bottomView]}get topView(){return C[this.props.topView!==void 0?this.props.topView:kt.defaultProps.topView]}get activeRange(){return this.props.activeRangeEnd!==void 0?this.props.activeRangeEnd:this.activeRangeEnd}get todayIsInRange(){return A(z(),l.getDate(this.min),l.getDate(this.max))}componentDidMount(){this.calculateFocusFromValue=!0}componentDidUpdate(){this.calendarViewList&&(this.isActive?this.calendarViewList.focusActiveDate:this.calendarViewList.blurActiveDate)();const i=Re(this.min,this.max,this.value);this.calculateFocusFromValue=!!(this.selectedDate&&i&&this.selectedDate.getTime()&&i.getTime()),this.lastView=this.state.activeView,this.lastViewsCount=this.props.views||Vt.defaultProps.views}render(){this.props._ref&&this.props._ref(this),this.intl=x.provideIntlService(this),this.localization=x.provideLocalizationService(this),this.bus.configure(this.bottomView,this.topView);const i=Yt(this.state.activeView,this.bottomView,this.topView);this.service=this.bus.service(i,this.intl),this.selectedDate=Re(this.min,this.max,this.value),this.selectedMultiple=zi(this.min,this.max,this.value),this.selectedRange=qi(this.value);const t=Ri(this.selectedDate,this.selectedMultiple,this.selectedRange);this._focusedDate=Y(this.calculateFocusFromValue&&t!==null?t:this.state.focusedDate,this.min,this.max);const e=d.classNames("k-widget k-calendar k-calendar-range",{"k-disabled":this.props.disabled},this.props.className),s=this.rangeWithFocused(this.selectedRange,this.focusedDate),a=this.localization.toLanguageString(pe,k[pe]),r=this.localization.toLanguageString(fe,k[fe]),h=!this.canNavigate(D.PrevView),u=!this.canNavigate(D.NextView),c={"aria-disabled":h},m={"aria-disabled":u},f=this.lastView!==i,g=this.dates&&this.isInMonth(this.state.navigateDate,this.dates[0]),w=this.lastViewsCount!==this.props.views;(!g||f||w)&&(this.dates=this.service.datesList(this.state.navigateDate,this.props.views||Vt.defaultProps.views));const v=l.cloneDate(this.dates&&this.dates[0]?this.dates[0]:z());return o.createElement("div",{ref:E=>{this._element=E},className:e,id:this.props.id||this.wrapperID,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,tabIndex:this.props.disabled?void 0:this.props.tabIndex,onFocus:this.handleFocus,onBlur:this.handleBlur,onMouseDown:this.handleMouseDown,onClick:this.handleClick,onKeyDown:this.handleKeyDown,"aria-disabled":this.props.disabled,dir:this.props.dir},o.createElement(vt,{key:`.kendo.calendar.header.${v.getTime()}`,activeView:i,currentDate:v,min:this.min,max:this.max,rangeLength:this.props.views,bus:this.bus,service:this.service,headerTitle:this.props.headerTitle,verticalView:this.props.mobileMode,commands:o.createElement(o.Fragment,null,o.createElement(L.Button,{type:"button",className:"k-calendar-nav-prev",icon:this.isRtl?"chevron-right":"chevron-left",svgIcon:this.isRtl?J.chevronRightIcon:J.chevronLeftIcon,fillMode:"flat",title:a,disabled:h,onClick:this.handlePrevButtonClick,...c}),o.createElement(It,{min:this.min,max:this.max,onClick:this.handleTodayClick,disabled:!this.todayIsInRange}),o.createElement(L.Button,{type:"button",className:"k-calendar-nav-next",icon:this.isRtl?"chevron-left":"chevron-right",svgIcon:this.isRtl?J.chevronLeftIcon:J.chevronRightIcon,fillMode:"flat",title:r,disabled:u,onClick:this.handleNextButtonClick,...m}))}),o.createElement(Vt,{ref:E=>{this.calendarViewList=E},dates:this.dates,activeView:i,focusedDate:this.focusedDate,min:this.min,max:this.max,bus:this.bus,service:this.service,selectionRange:s,value:this.selectedMultiple||this.selectedDate,cellUID:this.cellUID,views:this.props.views,onChange:this.handleDateChange,showWeekNumbers:this.props.weekNumber,onCellEnter:this.handleCellEnter,cell:this.props.cell,weekCell:this.props.weekCell,headerTitle:this.props.headerTitle,verticalView:this.props.mobileMode}))}isInMonth(i,t){return!!t&&l.firstDayOfMonth(t)<=i&&i<=l.lastDayOfMonth(t)}};let Q=kt;Q.displayName="MultiViewCalendar",Q.propTypes={activeRangeEnd:n.oneOf(["start","end"]),allowReverse:n.bool,bottomView:n.oneOf(["month","year","decade","century"]),className:n.string,defaultActiveView:n.oneOf(["month","year","decade","century"]),defaultValue:n.oneOfType([et(n.instanceOf(Date)),n.arrayOf(n.instanceOf(Date)),n.shape({start:et(n.instanceOf(Date)),end:et(n.instanceOf(Date))})]),disabled:n.bool,focusedDate:n.instanceOf(Date),id:n.string,ariaLabelledBy:n.string,ariaDescribedBy:n.string,max:n.instanceOf(Date),min:n.instanceOf(Date),mode:n.oneOf(["single","multiple","range"]),onBlur:n.func,onChange:n.func,onFocus:n.func,tabIndex:n.number,topView:n.oneOf(["month","year","decade","century"]),value:n.oneOfType([et(n.instanceOf(Date)),n.arrayOf(n.instanceOf(Date)),n.shape({start:et(n.instanceOf(Date).isRequired),end:et(n.instanceOf(Date).isRequired)})]),views:(i,t,e)=>{const s=i[t];return s!==void 0&&s<1?new Error(`Invalid prop '${t}' supplied to'${e}'. The '${t}' property cannot be less than 1'`):null},weekNumber:n.bool,dir:n.string},Q.defaultProps={disabled:!1,min:it,max:st,navigation:!0,defaultActiveView:"month",defaultValue:null,topView:"century",tabIndex:0,bottomView:"month",views:2,allowReverse:!1};const Wi=d.createPropsContext(),We=d.withIdHOC(d.withPropsContext(Wi,Q));We.displayName="KendoReactMultiViewCalendar",x.registerForIntl(Q),x.registerForLocalization(Q);const Rt=class extends o.Component{constructor(i){super(i),this._element=null,this._calendar=null,this._startDateInput=o.createRef(),this._endDateInput=o.createRef(),this.shouldFocusDateInput=!1,this.shouldFocusCalendar=!1,this.focus=()=>{this.startDateInput&&this.startDateInput.focus()},this.setCalendarRef=t=>{this._calendar=t},this.focusCalendarElement=()=>{this._calendar&&this._calendar.element&&this._calendar.element.focus({preventScroll:!0})},this.calculateValue=(t,e)=>(t.value!==void 0?t.value:e.value)||q,this.calculateShow=(t,e)=>t.show!==void 0?t.show:e.show,this.renderCalendar=()=>{const t=this.value||q,e={min:this.min,max:this.max,allowReverse:this.props.allowReverse,mode:"range",focusedDate:this.props.focusedDate,disabled:this.props.disabled,className:this.mobileMode?"k-calendar-lg":"",mobileMode:this.mobileMode,...this.props.calendarSettings,value:t,dir:this.props.dir,onChange:this.handleCalendarChange};return this.props.calendar?o.createElement(this.props.calendar,{...e}):o.createElement(We,{...e,ref:this.setCalendarRef})},this.renderPopup=()=>{const t={popupClass:"k-daterangepicker-popup",animate:this._element!==null,anchor:this._element,id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},...this.props.popupSettings,show:this.show};return this.props.popup?o.createElement(this.props.popup,{...t},this.renderCalendar()):o.createElement(Wt.Popup,{...t},this.renderCalendar())},this.renderAdaptivePopup=()=>{const{windowWidth:t=0}=this.state,e={expand:this.show,onClose:s=>this.handleCancel(s),adaptiveTitle:this.props.adaptiveTitle,windowWidth:t,footer:{cancelText:this.localizationService.toLanguageString(De,k[De]),onCancel:this.handleCancel,applyText:this.localizationService.toLanguageString(Ie,k[Ie]),onApply:this.handleBlur}};return o.createElement(ne,{...e},o.createElement(ht.ActionSheetContent,{className:"!k-overflow-hidden"},o.createElement("div",{className:"k-scrollable-wrap"},this.renderCalendar())))},this.handleReverseClick=t=>{const e={start:this.value.end,end:this.value.start},s={syntheticEvent:t,nativeEvent:t.nativeEvent};this.handleChange(e,s)},this.handleReverseMouseDown=t=>{t.preventDefault()},this.handleFocus=t=>{clearTimeout(this.nextTickId),this.shouldFocusDateInput||this.mobileMode&&this.setState({currentValue:this.value});const{onFocus:e}=this.props;e&&e.call(void 0,t)},this.handleClick=()=>{this.shouldFocusDateInput||this.setShow(!0)},this.handleBlur=t=>{this.nextTick(()=>{this.setShow(!1)});const{onBlur:e}=this.props;e&&e.call(void 0,t)},this.handleCancel=t=>{this.nextTick(()=>{this.setShow(!1),this.setState({currentValue:q})});const{onCancel:e}=this.props;e&&e.call(void 0,t)},this.handleEndChange=t=>{const e={start:this.value.start,end:l.cloneDate(t.value||void 0)};this.handleChange(e,t)},this.handleStartChange=t=>{const e={start:l.cloneDate(t.value||void 0),end:this.value.end};this.handleChange(e,t)},this.extractRangeFromValue=t=>{if(!Array.isArray(t.value)&&!(t.value instanceof Date))return t.value||q;const e=Array.isArray(t.value)?t.value[0]:t.value;return{start:this.value.end!==null?e:this.value.start,end:this.value.start!==null?e:this.value.end}},this.handleCalendarChange=t=>{const e=this.extractRangeFromValue(t);this.handleChange(e,t)},this.handleKeyDown=t=>{const{keyCode:e,altKey:s}=t;e===d.Keys.esc?(t.preventDefault(),this.shouldFocusDateInput=!0,this.setShow(!1)):s&&e===d.Keys.down?(t.preventDefault(),this.shouldFocusCalendar=!0,this.setShow(!0),this.focusCalendarElement()):s&&e===d.Keys.up&&(t.preventDefault(),this.shouldFocusDateInput=!0,this.setShow(!1))},this.handleChange=(t,e)=>{this.setState({value:t}),this.valueDuringOnChange=t;const{onChange:s}=this.props;if(s){const a={syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,value:this.value,show:this.show,target:this};s.call(void 0,a)}this.valueDuringOnChange=void 0},d.validatePackage(ft),this.state={show:this.props.show||this.props.defaultShow||Rt.defaultProps.defaultShow,value:this.props.value||this.props.defaultValue||Rt.defaultProps.defaultValue,currentValue:q},this.nextTick=this.nextTick.bind(this),this.setShow=this.setShow.bind(this),this.focusCalendarElement=this.focusCalendarElement.bind(this),this.focusDateInputElement=this.focusDateInputElement.bind(this)}get _popupId(){return this.props.id+"-popup-id"}get _startInputId(){return this.props.id+"-start-input-id"}get _endInputId(){return this.props.id+"-end-input-id"}get element(){return this._element}get startDateInput(){return this._startDateInput.current}get endDateInput(){return this._endDateInput.current}get calendar(){return this._calendar}get value(){return(this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value)||q}get show(){return this.showDuringOnChange!==void 0?this.showDuringOnChange:this.props.show!==void 0?this.props.show:this.state.show}get min(){return this.props.min!==void 0?this.props.min:Rt.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:Rt.defaultProps.max}get document(){if(d.canUseDOM)return this.element&&this.element.ownerDocument||document}get localizationService(){return x.provideLocalizationService(this)}get mobileMode(){return!!(this.state.windowWidth&&this.state.windowWidth<=ae&&this.props.adaptive)}componentDidMount(){var i;this.observerResize=d.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.show&&this.forceUpdate(),(i=this.document)!=null&&i.body&&this.observerResize&&this.observerResize.observe(this.document.body)}componentDidUpdate(){this.shouldFocusCalendar&&this.focusCalendarElement(),this.shouldFocusDateInput&&this.focusDateInputElement(),this.shouldFocusCalendar=!1,this.shouldFocusDateInput=!1}componentWillUnmount(){var i;clearTimeout(this.nextTickId),(i=this.document)!=null&&i.body&&this.observerResize&&this.observerResize.disconnect()}render(){const i=this.value||q,t=this.mobileMode&&this.show?this.state.currentValue:i,e=(this.props.startDateInputSettings||{}).id||this._startInputId,s=(this.props.endDateInputSettings||{}).id||this._endInputId,a=d.classNames("k-daterangepicker",{"k-disabled":this.props.disabled},this.props.className),r=this.localizationService.toLanguageString(Gt,k[Gt]),h=this.localizationService.toLanguageString(Xt,k[Xt]),u=this.localizationService.toLanguageString(Jt,k[Jt]),c={disableSelection:this.mobileMode&&!0,label:r,format:this.props.format,min:this.min,max:this.max,id:this._startInputId,disabled:this.props.disabled,valid:this.props.valid,tabIndex:this.props.tabIndex,ariaExpanded:this.show,...this.props.startDateInputSettings,value:t.start,onChange:this.handleStartChange},m={disableSelection:this.mobileMode&&!0,label:h,format:this.props.format,min:this.min,max:this.max,id:this._endInputId,disabled:this.props.disabled,valid:this.props.valid,tabIndex:this.props.tabIndex,ariaExpanded:this.show,...this.props.endDateInputSettings,value:t.end,onChange:this.handleEndChange},f=o.createElement(L.Button,{type:"button",className:"k-select",fillMode:"flat",title:x.provideLocalizationService(this).toLanguageString(St,k[St]),onMouseDown:this.handleReverseMouseDown,onClick:this.handleReverseClick,"aria-controls":e+" "+s,"aria-label":x.provideLocalizationService(this).toLanguageString(St,k[St])},o.createElement(d.IconWrap,{style:{transform:"rotate(90deg)"},name:"arrows-swap",icon:J.arrowsSwapIcon}));return o.createElement(o.Fragment,null,o.createElement("span",{ref:g=>{this._element=g},className:a,style:this.props.style,id:this.props.id,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,tabIndex:this.props.tabIndex,onFocus:this.handleFocus,onClick:this.handleClick,onKeyDown:this.handleKeyDown,onBlur:this.mobileMode?void 0:this.handleBlur,dir:this.props.dir},this.props.startDateInput?o.createElement(this.props.startDateInput,{...c}):o.createElement(ot,{...c,ref:this._startDateInput,ariaRole:"combobox",ariaControls:this._popupId,readonly:this.mobileMode}),(this.props.allowReverse||this.props.calendarSettings&&this.props.calendarSettings.allowReverse)&&this.props.swapButton?f:u,this.props.endDateInput?o.createElement(this.props.endDateInput,{...m}):o.createElement(ot,{...m,ref:this._endDateInput,ariaRole:"combobox",ariaControls:this._popupId,readonly:this.mobileMode}),!this.mobileMode&&this.renderPopup()),this.mobileMode&&this.renderAdaptivePopup())}focusDateInputElement(){if(!document||!this.startDateInput||!this.startDateInput.element||!this.endDateInput||!this.endDateInput.element)return;const i=d.getActiveElement(document);(this.value.start===null||this.value.end!==null)&&i!==this.endDateInput.element?this.startDateInput.element.focus({preventScroll:!0}):i!==this.startDateInput.element&&this.endDateInput.element.focus({preventScroll:!0})}nextTick(i){clearTimeout(this.nextTickId),this.nextTickId=window.setTimeout(()=>i())}setShow(i){const{onOpen:t,onClose:e}=this.props;this.show!==i&&(this.setState({show:i}),i&&t&&t.call(void 0,{target:this}),!i&&e&&e.call(void 0,{target:this}))}calculateMedia(i){for(let t of i)this.setState({windowWidth:t.target.clientWidth})}};let Nt=Rt;Nt.displayName="DateRangePicker",Nt.propTypes={allowReverse:n.bool,calendarSettings:n.any,className:n.string,defaultShow:n.bool,defaultValue:n.shape({start:et(n.instanceOf(Date).isRequired),end:et(n.instanceOf(Date).isRequired)}),disabled:n.bool,endDateInputSettings:n.shape(lt.propTypes),focusedDate:n.instanceOf(Date),format:n.oneOfType([n.string,n.shape({skeleton:n.string,pattern:n.string,date:n.oneOf(["short","medium","long","full"]),time:n.oneOf(["short","medium","long","full"]),datetime:n.oneOf(["short","medium","long","full"]),era:n.oneOf(["narrow","short","long"]),year:n.oneOf(["numeric","2-digit"]),month:n.oneOf(["numeric","2-digit","narrow","short","long"]),day:n.oneOf(["numeric","2-digit"]),weekday:n.oneOf(["narrow","short","long"]),hour:n.oneOf(["numeric","2-digit"]),hour12:n.bool,minute:n.oneOf(["numeric","2-digit"]),second:n.oneOf(["numeric","2-digit"]),timeZoneName:n.oneOf(["short","long"])})]),id:n.string,ariaLabelledBy:n.string,ariaDescribedBy:n.string,max:n.instanceOf(Date),min:n.instanceOf(Date),onBlur:n.func,onChange:n.func,onFocus:n.func,popupSettings:n.any,show:n.bool,startDateInputSettings:n.any,style:n.any,swapButton:n.any,tabIndex:n.number,dir:n.string,value:n.shape({start:et(n.instanceOf(Date).isRequired),end:et(n.instanceOf(Date).isRequired)})},Nt.defaultProps={allowReverse:!1,defaultShow:!1,defaultValue:q,disabled:!1,format:"d",max:st,min:it,swapButton:!1};const Ki=d.createPropsContext(),Ui=d.withIdHOC(d.withPropsContext(Ki,Nt));Ui.displayName="KendoReactDateRangePicker",x.registerForLocalization(Nt);class Ke extends o.Component{constructor(t){super(t),this._calendar=null,this._timePart=null,this._cancelButton=null,this._acceptButton=null,this._dateButtonRef=null,this._calendarWrap=null,this.shouldFocusPart=!1,this.focus=e=>{Promise.resolve().then(()=>{this.state.tab==="time"&&this._timePart&&this._timePart.focus(e);const s=this.calendarElement();this.state.tab==="date"&&s&&s.focus(e)})},this.calendarElement=()=>this._calendar&&this._calendar.element||this._calendarWrap&&this._calendarWrap.querySelector(".k-widget.k-calendar"),this.move=e=>{if(e==="right"&&this.state.tab==="time"||e==="left"&&this.state.tab==="date")return;const s=e==="left"?"date":"time";this.shouldFocusPart=!0,this.setState({tab:s})},this.dateTimeFooter=()=>{const{cancelButton:e}=this.props,s=this.localizationService.toLanguageString(Ht,k[Ht]),a=this.localizationService.toLanguageString(Bt,k[Bt]);return o.createElement("div",{className:"k-datetime-footer k-actions k-actions-stretched"},e&&o.createElement(L.Button,{type:"button",ref:r=>{this._cancelButton=r},className:"k-time-cancel",onClick:this.handleReject,onKeyDown:this.handleCancelKeyDown,title:s,"aria-label":s},s),o.createElement(L.Button,{type:"button",themeColor:"primary",ref:r=>{this._acceptButton=r},className:"k-time-accept",disabled:!this.hasDateValue,onClick:this.handleAccept,onKeyDown:this.handleSetKeyDown,title:a,"aria-label":a},a))},this.handleReject=e=>{this.setState({dateValue:this.props.value,timeValue:this.props.value||B});const s=this.mergeDate(this.props.value,this.props.value||B);if(this.props.onReject){const a={nativeEvent:e.nativeEvent,syntheticEvent:e,target:this,value:s};this.props.onReject.call(void 0,a)}},this.handleAccept=(e,s)=>{if(!this.state.dateValue||!this.state.timeValue||!this.hasDateValue)return;const a=this.mergeDate(this.state.dateValue,s||this.state.timeValue);this.props.onChange.call(void 0,{syntheticEvent:e,nativeEvent:e.nativeEvent,value:a,target:this})},this.handleNowClick=e=>{this.setState({timeValue:ut()}),this.handleAccept(e,ut())},this.handleCalendarValueChange=e=>{e.syntheticEvent.stopPropagation(),this.setState({dateValue:e.value,tab:"time"}),this.shouldFocusPart=!0},this.handleTimeListContainerChange=e=>{this.setState({timeValue:e})},this.handleDateClick=e=>{e.stopPropagation(),this.move("left")},this.handleTimeClick=e=>{e.stopPropagation(),this.move("right")},this.handleKeyDown=e=>{const{keyCode:s,altKey:a}=e;if(!this.props.disabled)switch(s){case d.Keys.enter:!this.hasActiveButton()&&this.hasDateValue&&this.handleAccept(e);return;case d.Keys.left:if(!a)return;this.move("left");return;case d.Keys.right:if(!a)return;this.move("right");return;default:return}},this.handleCancelKeyDown=e=>{const{keyCode:s}=e;s===d.Keys.tab&&this._dateButtonRef&&this._dateButtonRef.element&&!this.hasDateValue&&(e.preventDefault(),this._dateButtonRef.element.focus())},this.handleSetKeyDown=e=>{const{keyCode:s}=e;s===d.Keys.tab&&this._dateButtonRef&&this._dateButtonRef.element&&(e.preventDefault(),this._dateButtonRef.element.focus())},this.handleDateKeyDown=e=>{var r,h,u,c;const{keyCode:s,shiftKey:a}=e;a&&s===d.Keys.tab&&(e.stopPropagation(),this.hasDateValue?(c=(u=this._acceptButton)==null?void 0:u.element)==null||c.focus():(h=(r=this._cancelButton)==null?void 0:r.element)==null||h.focus()),s===d.Keys.enter&&(e.stopPropagation(),this.move("left"))},this.handleTimeKeyDown=e=>{const{keyCode:s}=e;s===d.Keys.enter&&(e.stopPropagation(),this.move("right"))},this.handleTimePartMount=e=>{this.setState({timeValue:e})},this.state={tab:"date",dateValue:this.props.value,timeValue:this.props.value||B}}get calendar(){return this._calendar}get timePart(){return this._timePart}get hasDateValue(){return this.state.dateValue!==null}get localizationService(){return x.provideLocalizationService(this)}componentDidUpdate(t,e){var s,a;this.shouldFocusPart&&this.focus({preventScroll:!0}),(((s=t.value)==null?void 0:s.getTime())!==((a=this.props.value)==null?void 0:a.getTime())||this.state.tab!==e.tab&&this.props.value)&&this.setState({dateValue:this.props.value,timeValue:this.props.value||B}),this.shouldFocusPart=!1}render(){const{disabled:t,min:e,max:s,weekNumber:a,focusedDate:r,format:h,mobileMode:u,footerActions:c}=this.props,m=d.classNames({"k-date-tab":this.state.tab==="date","k-time-tab":this.state.tab==="time","k-disabled":t},"k-datetime-wrap"),f=this.localizationService.toLanguageString(be,k[be]),g=this.localizationService.toLanguageString(Se,k[Se]),w={min:e,max:s,weekNumber:a,focusedDate:r,disabled:t||this.state.tab!=="date",value:this.state.dateValue,onChange:this.handleCalendarValueChange,navigation:!1,tabIndex:t||this.state.tab!=="date"?-1:void 0,mobileMode:u};return o.createElement("div",{onKeyDown:this.handleKeyDown,className:m,tabIndex:-1},o.createElement("div",{className:"k-datetime-buttongroup"},o.createElement(L.ButtonGroup,{width:"100%"},o.createElement(L.Button,{ref:v=>this._dateButtonRef=v,type:"button",selected:this.state.tab==="date",togglable:!0,onClick:this.handleDateClick,onKeyDown:this.handleDateKeyDown},f),o.createElement(L.Button,{type:"button",selected:this.state.tab==="time",togglable:!0,onClick:this.handleTimeClick,onKeyDown:this.handleTimeKeyDown},g))),o.createElement("div",{className:"k-datetime-selector"},o.createElement("div",{className:"k-datetime-calendar-wrap",ref:v=>this._calendarWrap=v},this.props.calendar?o.createElement(this.props.calendar,{key:this.state.tab,...w}):o.createElement(te,{key:this.state.tab,ref:v=>{this._calendar=v},...w})),o.createElement("div",{className:"k-datetime-time-wrap"},o.createElement("div",{className:u?"k-reset k-timeselector-lg k-timeselector":""},o.createElement(mt,{key:1,onNowClick:this.handleNowClick,disabled:t||this.state.tab!=="time",ref:v=>{this._timePart=v},min:this.minTime||ct,max:this.maxTime||nt,steps:this.props.steps,value:this.state.timeValue,format:h,onChange:this.handleTimeListContainerChange,onMount:this.handleTimePartMount,mobileMode:u})))),c&&this.dateTimeFooter())}get minTime(){return this.props.minTime!==void 0?this.props.minTime:this.normalizeRange(this.props.min,this.state.dateValue)}get maxTime(){return this.props.maxTime!==void 0?this.props.maxTime:this.normalizeRange(this.props.max,this.state.dateValue)}normalizeRange(t,e){return l.isEqualDate(t,e||z())?t:null}hasActiveButton(){if(!this._acceptButton)return!1;const t=d.getActiveElement(document);return this._acceptButton&&t===this._acceptButton.element||this._cancelButton&&t===this._cancelButton.element}mergeTime(t,e){return t&&e?R(e,t):e}mergeDate(t,e){return t?R(t||z(),e):e}}Ke.defaultProps={footerActions:!0},x.registerForLocalization(Ke);const P=class extends o.Component{constructor(i){super(i),this._element=null,this._dateInput=o.createRef(),this._dateTimeSelector=null,this.shouldFocusDateInput=!1,this.prevShow=!1,this.focus=()=>{const t=this.dateInputElement();t&&t.focus()},this.renderPicker=()=>{const{disabled:t,minTime:e,maxTime:s,format:a,calendar:r,cancelButton:h,weekNumber:u,focusedDate:c}=this.props;return o.createElement(Ke,{ref:m=>{this._dateTimeSelector=m},cancelButton:h,steps:this.props.steps,value:this.value,onChange:this.handleValueChange,onReject:this.handleReject,disabled:t,weekNumber:u,min:this.min,max:this.max,minTime:e,maxTime:s,focusedDate:c,format:a,calendar:r,mobileMode:this.mobileMode,footerActions:!this.mobileMode})},this.renderAdaptivePopup=()=>{const{windowWidth:t=0}=this.state,e=x.provideLocalizationService(this).toLanguageString(Ht,k[Ht]),s=x.provideLocalizationService(this).toLanguageString(Bt,k[Bt]),a={expand:this.show,onClose:this.handleBlur,adaptiveTitle:this.props.adaptiveTitle,windowWidth:t,footer:{cancelText:e,onCancel:r=>{var h;return(h=this._dateTimeSelector)==null?void 0:h.handleReject(r)},applyText:s,onApply:r=>{var h;return(h=this._dateTimeSelector)==null?void 0:h.handleAccept(r)}}};return o.createElement(ne,{...a},o.createElement(ht.ActionSheetContent,{className:"!k-overflow-hidden"},this.renderPicker()))},this.handleReject=()=>{this.shouldFocusDateInput=!0,this.setShow(!1)},this.handleValueChange=t=>{this.setState({value:l.cloneDate(t.value||void 0)}),this.valueDuringOnChange=t.value,this.showDuringOnChange=!1,this.mobileMode||(this.shouldFocusDateInput=!0);const{onChange:e}=this.props;e&&e.call(void 0,{syntheticEvent:t.syntheticEvent,nativeEvent:t.nativeEvent,value:this.value,show:this.show,target:this}),this.valueDuringOnChange=void 0,this.showDuringOnChange=void 0,this.setShow(!1)},this.handleFocus=()=>{this.setState({focused:!0})},this.handleBlur=()=>{this.setState({focused:!1}),this.setShow(!1)},this.handleDateIconClick=()=>{this.props.disabled||(this.shouldFocusDateInput=!0,this.setShow(!this.show))},this.handleIconMouseDown=t=>{t.preventDefault()},this.handleKeyDown=t=>{const{altKey:e,keyCode:s}=t;if(s===d.Keys.esc){this.shouldFocusDateInput=!0,this.setShow(!1);return}e&&(s===d.Keys.up||s===d.Keys.down)&&(t.preventDefault(),t.stopPropagation(),this.shouldFocusDateInput=s===d.Keys.up,this.setShow(s===d.Keys.down))},this.dateInputElement=()=>this.dateInput&&this.dateInput.element||this.element&&this.element.querySelector(".k-dateinput > input.k-input-inner"),d.validatePackage(ft),this.state={value:this.props.defaultValue||P.defaultProps.defaultValue,show:this.props.defaultShow||P.defaultProps.defaultShow,focused:!1}}get _popupId(){return this.props.id+"-popup-id"}get document(){if(d.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get dateInput(){return this._dateInput.current}get value(){const i=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value;return i!==null?l.cloneDate(i):null}get show(){return this.showDuringOnChange!==void 0?this.showDuringOnChange:this.props.show!==void 0?this.props.show:this.state.show}get name(){return this.props.name}get mobileMode(){return!!(this.state.windowWidth&&this.state.windowWidth<=ae&&this.props.adaptive)}get min(){return this.props.min!==void 0?this.props.min:P.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:P.defaultProps.max}get validity(){const i=je(this.value,this.min,this.max)&&Ne(this.value,this.props.minTime||ct,this.props.maxTime||nt),t=this.props.validationMessage!==void 0,e=(!this.required||this.value!==null)&&i,s=this.props.valid!==void 0?this.props.valid:e;return{customError:t,rangeOverflow:this.value&&this.max.getTime()<this.value.getTime()||!1,rangeUnderflow:this.value&&this.value.getTime()<this.min.getTime()||!1,valid:s,valueMissing:this.value===null}}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:P.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:P.defaultProps.required}get dateInputComp(){return this.props.dateInput||P.defaultProps.dateInput}componentDidMount(){var i;this.observerResize=d.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.show&&this.forceUpdate(),(i=this.document)!=null&&i.body&&this.observerResize&&this.observerResize.observe(this.document.body)}componentDidUpdate(){const i=this.dateInputElement();this._dateTimeSelector&&this.show&&!this.prevShow&&this._dateTimeSelector.focus({preventScroll:!0}),i&&!this.show&&this.shouldFocusDateInput&&i.focus({preventScroll:!0}),this.prevShow=this.show,this.shouldFocusDateInput=!1}componentWillUnmount(){var i;clearTimeout(this.nextTickId),(i=this.document)!=null&&i.body&&this.observerResize&&this.observerResize.disconnect()}render(){const{size:i=P.defaultProps.size,rounded:t=P.defaultProps.rounded,fillMode:e=P.defaultProps.fillMode,disabled:s,tabIndex:a,title:r,id:h,format:u,formatPlaceholder:c,min:m,max:f,className:g,width:w,name:v,validationMessage:E,required:V,validityStyles:N,minTime:S,maxTime:y,ariaLabelledBy:b,ariaDescribedBy:K,popup:M=Wt.Popup}=this.props,F=!this.validityStyles||this.validity.valid,U={id:h,ariaLabelledBy:b,ariaDescribedBy:K,format:u,formatPlaceholder:c,disabled:s,title:r,validityStyles:N,validationMessage:E,required:V,min:m,max:f,minTime:S,maxTime:y,name:v,tabIndex:this.show?-1:a,valid:this.validity.valid,value:this.value,onChange:this.handleValueChange,steps:this.props.steps,label:void 0,placeholder:this.state.focused?null:this.props.placeholder,ariaExpanded:this.show,size:null,fillMode:null,rounded:null},O=o.createElement(d.AsyncFocusBlur,{onFocus:this.handleFocus,onBlur:this.handleBlur,onSyncFocus:this.props.onFocus,onSyncBlur:this.props.onBlur},({onFocus:_,onBlur:tt})=>o.createElement(o.Fragment,null,o.createElement("div",{ref:X=>{this._element=X},className:d.classNames("k-input","k-datetimepicker",{[`k-input-${d.kendoThemeMaps.sizeMap[i]||i}`]:i,[`k-rounded-${d.kendoThemeMaps.roundedMap[t]||t}`]:t,[`k-input-${e}`]:e,"k-invalid":!F,"k-required":this.required,"k-disabled":this.props.disabled},g),onKeyDown:this.handleKeyDown,style:{width:w},onFocus:this.mobileMode?void 0:_,onBlur:tt,onClick:this.mobileMode?this.handleDateIconClick:void 0},o.createElement(this.dateInputComp,{_ref:this._dateInput,ariaRole:"combobox",ariaControls:this._popupId,readonly:this.mobileMode,...U}),o.createElement(L.Button,{tabIndex:-1,type:"button",icon:"calendar",svgIcon:J.calendarIcon,onMouseDown:this.handleIconMouseDown,onClick:this.mobileMode?void 0:this.handleDateIconClick,title:x.provideLocalizationService(this).toLanguageString(Dt,k[Dt]),className:"k-input-button",rounded:null,"aria-label":x.provideLocalizationService(this).toLanguageString(Dt,k[Dt])}),o.createElement(M,{show:this.show,animate:this.element!==null,anchor:this.element,popupClass:"k-datetime-container k-reset",id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"}},!this.mobileMode&&this.renderPicker())),this.mobileMode&&this.renderAdaptivePopup()));return this.props.label?o.createElement(ye,{dateInput:this._dateInput,label:this.props.label,editorId:h,editorValid:F,editorDisabled:this.props.disabled,children:O,style:{width:this.props.width}}):O}setShow(i){const{onOpen:t,onClose:e}=this.props;this.show!==i&&(this.setState({show:i}),i&&t&&t.call(void 0,{target:this}),!i&&e&&e.call(void 0,{target:this}))}nextTick(i){clearTimeout(this.nextTickId),this.nextTickId=window.setTimeout(()=>i())}calculateMedia(i){for(const t of i)this.setState({windowWidth:t.target.clientWidth})}};let yt=P;yt.displayName="DateTimePicker",yt.propTypes={className:n.string,defaultShow:n.bool,defaultValue:n.instanceOf(Date),disabled:n.bool,focusedDate:n.instanceOf(Date),format:n.oneOfType([n.string,n.shape({skeleton:n.string,pattern:n.string,date:n.oneOf(["short","medium","long","full"]),time:n.oneOf(["short","medium","long","full"]),datetime:n.oneOf(["short","medium","long","full"]),era:n.oneOf(["narrow","short","long"]),year:n.oneOf(["numeric","2-digit"]),month:n.oneOf(["numeric","2-digit","narrow","short","long"]),day:n.oneOf(["numeric","2-digit"]),weekday:n.oneOf(["narrow","short","long"]),hour:n.oneOf(["numeric","2-digit"]),hour12:n.bool,minute:n.oneOf(["numeric","2-digit"]),second:n.oneOf(["numeric","2-digit"]),timeZoneName:n.oneOf(["short","long"])})]),formatPlaceholder:n.oneOfType([n.oneOf(["wide","narrow","short","formatPattern"]),n.shape({year:n.string,month:n.string,day:n.string,hour:n.string,minute:n.string,second:n.string})]),id:n.string,ariaLabelledBy:n.string,ariaDescribedBy:n.string,min:n.instanceOf(Date),max:n.instanceOf(Date),name:n.string,popupSettings:n.shape({animate:n.bool,appendTo:n.any,popupClass:n.string}),show:n.bool,tabIndex:n.number,title:n.string,value:n.instanceOf(Date),weekNumber:n.bool,width:n.oneOfType([n.number,n.string]),validationMessage:n.string,required:n.bool,validate:n.bool,valid:n.bool,cancelButton:n.bool,size:n.oneOf([null,"small","medium","large"]),rounded:n.oneOf([null,"small","medium","large","full"]),fillMode:n.oneOf([null,"solid","flat","outline"])},yt.defaultProps={defaultShow:!1,defaultValue:null,disabled:!1,format:"g",max:st,min:it,popupSettings:{},tabIndex:0,weekNumber:!1,required:!1,validityStyles:!0,cancelButton:!0,dateInput:ot,size:"medium",rounded:"medium",fillMode:"solid"};const Yi=d.createPropsContext(),$i=d.withIdHOC(d.withPropsContext(Yi,yt));$i.displayName="KendoReactDateTimePicker",x.registerForLocalization(yt),p.Action=D,p.BusViewService=de,p.Calendar=te,p.CalendarCell=$e,p.CalendarHeaderTitle=ai,p.CalendarNavigationItem=li,p.CalendarPropsContext=ci,p.CalendarViewEnum=C,p.CalendarWeekCell=Te,p.CalendarWithoutContext=rt,p.CenturyViewService=Xe,p.DOMService=ti,p.DateInput=ot,p.DateInputPropsContext=pi,p.DateInputWithoutContext=lt,p.DatePicker=bi,p.DatePickerPropsContext=wi,p.DatePickerWithoutContext=xt,p.DateRangePicker=Ui,p.DateRangePickerPropsContext=Ki,p.DateRangePickerWithoutContext=Nt,p.DateTimePicker=$i,p.DateTimePickerPropsContext=Yi,p.DateTimePickerWithoutContext=yt,p.DayPeriodService=Si,p.DecadeViewService=Je,p.EMPTY_SELECTIONRANGE=q,p.Header=vt,p.HorizontalViewList=Vt,p.HoursService=Ci,p.MAX_DATE=st,p.MAX_TIME=nt,p.MIN_DATE=it,p.MIN_TIME=ct,p.MinutesService=ki,p.MonthViewService=Qe,p.MultiViewCalendar=We,p.MultiViewCalendarPropsContext=Wi,p.MultiViewCalendarWithoutContext=Q,p.NavigationService=me,p.PickerWrap=gi,p.ScrollSyncService=ei,p.SecondsService=_i,p.TimeList=qt,p.TimePart=mt,p.TimePicker=Hi,p.TimePickerPropsContext=Ai,p.TimePickerWithoutContext=Ot,p.TimeSelector=Et,p.TodayCommand=It,p.ToggleButton=fi,p.ViewList=zt,p.Virtualization=gt,p.WeekNamesService=ii,p.YearViewService=Pe,p.dateInputsMessages=k,p.decreaseValue=bt,p.end=Xt,p.getNow=ut,p.getToday=z,p.increaseValue=wt,p.separator=Jt,p.start=Gt,p.swapStartEnd=St,p.today=jt,p.toggleCalendar=Zt,p.toggleDateTimeSelector=Dt,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
|
|
21
|
+
`);return null},value:n.instanceOf(Date),smoothScroll:n.bool,show:n.bool},qt.defaultProps={boundRange:!1,max:nt,min:B,step:1,smoothScroll:!0},x.registerForIntl(qt);const Be=new RegExp(`${j.hour}|${j.minute}|${j.second}|${j.dayperiod}|literal`),dt=class extends o.Component{constructor(i){super(i),this._element=null,this._nowButton=null,this.dateFormatParts=[],this.timeLists=[],this.focus=(t,e)=>{Promise.resolve().then(()=>{e&&this._nowButton&&this._nowButton.element&&this._nowButton.element.focus();const s=this.timeLists[0];!e&&this.state.activeListIndex===-1&&!this.hasActiveButton()&&s&&s.element&&s.focus(t)})},this.timeFormatReducer=(t,e)=>t+e.pattern,this.timeFormatFilter=(t,e,s)=>{const a=e>=1&&s[e-1];return a&&a&&t.type==="literal"?Be.test(a.type||""):Be.test(t.type||"")},this.focusList=t=>{this.timeLists.length&&this.timeLists.reduce(this.listReducer,[]).map(e=>t===1?e.next:e.prev).map(e=>e&&e.element&&e.element.focus({preventScroll:!0}))},this.listReducer=(t,e,s,a)=>t.length||e.props.id!==this.state.activeListIndex?t:[{next:a[s+1]||e,prev:a[s-1]||e}],this.showNowButton=()=>!this.hasSteps()&&this.props.nowButton&&Ne(ut(),this.min,this.max),this.handleKeyDown=t=>{const{keyCode:e}=t;switch(e){case d.Keys.left:t.preventDefault(),this.focusList(0);return;case d.Keys.right:t.preventDefault(),this.focusList(1);return;default:return}},this.handleListBlur=()=>{this.nextTick(()=>{this.setState({activeListIndex:-1})})},this.handleListFocus=t=>{clearTimeout(this.nextTickId),this.setState({activeListIndex:t})},this.handleChange=t=>{const{onChange:e}=this.props;e&&e.call(void 0,t)},this.snapTime=mi(di(this.props.steps,this.props.min||dt.defaultProps.min)),this.state={activeListIndex:-1},this.hasActiveButton=this.hasActiveButton.bind(this)}get element(){return this._element}get value(){return Ys(this.snapTime(l.cloneDate(this.props.value||B)),this.min,this.max)}get intl(){return x.provideIntlService(this)}get min(){return this.snapTime(this.props.min||dt.defaultProps.min)}get max(){return this.snapTime(this.props.max||dt.defaultProps.max)}get steps(){return this.props.steps||dt.defaultProps.steps}get boundRange(){return this.props.boundRange!==void 0?this.props.boundRange:dt.defaultProps.boundRange}componentWillUnmount(){clearTimeout(this.nextTickId)}componentDidMount(){const{onMount:i}=this.props;i&&i.call(void 0,this.value)}render(){const{format:i,smoothScroll:t,onNowClick:e,className:s,disabled:a,mobileMode:r,show:h,onNowKeyDown:u}=this.props;this.snapTime=mi(di(this.steps,this.min)),this.dateFormatParts=this.intl.splitDateFormat(i||dt.defaultProps.format).filter(this.timeFormatFilter);const c=d.classNames({"k-disabled":a,"k-time-part":r},s);this.timeLists=[];const m=x.provideLocalizationService(this),f=m.toLanguageString(ve,k[ve]);return o.createElement("div",{className:c},o.createElement("div",{className:"k-time-header"},o.createElement("span",{className:"k-title"},this.intl.formatDate(this.value,this.dateFormatParts.reduce(this.timeFormatReducer,""))),this.showNowButton()&&o.createElement(L.Button,{type:"button",ref:g=>{this._nowButton=g},className:"k-time-now",fillMode:"flat",themeColor:"primary",title:f,onKeyDown:u,"aria-label":f,onClick:e,tabIndex:a?-1:0},m.toLanguageString(ge,k[ge]))),o.createElement("div",{className:"k-time-list-container",onKeyDown:this.handleKeyDown},o.createElement("span",{className:"k-time-highlight"}),this.dateFormatParts.map((g,w)=>g.type!=="literal"?o.createElement("div",{key:w,className:d.classNames("k-time-list-wrapper",{"k-focus":w===this.state.activeListIndex}),role:"presentation",tabIndex:-1},o.createElement("span",{className:"k-title",onMouseDown:v=>{v.preventDefault()}},this.intl.dateFieldName(g)),o.createElement(qt,{min:this.min,max:this.max,boundRange:this.boundRange,part:g,step:g.type?this.steps[g.type]:1,smoothScroll:t,ref:v=>{v&&this.timeLists.push(v)},id:w,onFocus:()=>{this.handleListFocus(w)},onBlur:this.handleListBlur,onChange:this.handleChange,value:this.value,disabled:a,show:h,mobileMode:r})):o.createElement("div",{key:w,className:"k-time-separator"},g.pattern))))}nextTick(i){clearTimeout(this.nextTickId),this.nextTickId=window.setTimeout(()=>i())}hasActiveButton(){const i=d.getActiveElement(document);return this._nowButton&&i===this._nowButton.element}hasSteps(){const i=Object.keys(this.steps);return i.length!==i.reduce((t,e)=>t+this.steps[e],0)}};let mt=dt;mt.propTypes={cancelButton:n.bool,disabled:n.bool,format:n.oneOfType([n.string,n.shape({skeleton:n.string,pattern:n.string,date:n.oneOf(["short","medium","long","full"]),time:n.oneOf(["short","medium","long","full"]),datetime:n.oneOf(["short","medium","long","full"]),era:n.oneOf(["narrow","short","long"]),year:n.oneOf(["numeric","2-digit"]),month:n.oneOf(["numeric","2-digit","narrow","short","long"]),day:n.oneOf(["numeric","2-digit"]),weekday:n.oneOf(["narrow","short","long"]),hour:n.oneOf(["numeric","2-digit"]),hour12:n.bool,minute:n.oneOf(["numeric","2-digit"]),second:n.oneOf(["numeric","2-digit"]),timeZoneName:n.oneOf(["short","long"])})]),max:n.instanceOf(Date),min:n.instanceOf(Date),nowButton:n.bool,steps:n.shape({hour:n.number,minute:n.number,second:n.number}),smoothScroll:n.bool,tabIndex:n.number,value:n.instanceOf(Date),show:n.bool},mt.defaultProps={value:null,disabled:!1,nowButton:!0,cancelButton:!0,format:"hh:mm a",min:ct,max:nt,steps:{},boundRange:!1},x.registerForIntl(mt),x.registerForLocalization(mt);const ze=class extends o.Component{constructor(i){super(i),this._element=null,this._cancelButton=null,this._acceptButton=null,this.timePart=null,this.focusActiveList=()=>{this.timePart&&this.timePart.focus({preventScroll:!0})},this.handleKeyDown=t=>{const{keyCode:e}=t;switch(e){case d.Keys.enter:this.hasActiveButton()||this.handleAccept(t);return;default:return}},this.revertToNowButton=t=>{const{keyCode:e,shiftKey:s}=t;!s&&e===d.Keys.tab&&(t.preventDefault(),this.props.nowButton!==!1?this.timePart&&this.timePart.focus({preventScroll:!0},!0):this.timePart&&this.timePart.focus({preventScroll:!0}))},this.handleNowKeyDown=t=>{var a;const{keyCode:e,shiftKey:s}=t;s&&e===d.Keys.tab?(t.preventDefault(),this._acceptButton&&((a=this._acceptButton.element)==null||a.focus({preventScroll:!0}))):e===d.Keys.enter&&(t.stopPropagation(),this.handleNowClick(t))},this.handleAccept=t=>{const e=this.mergeValue(l.cloneDate(this.value||ut()),this.timePart?this.timePart.value:this.current);this.setState({value:e}),this.valueDuringOnChange=e;const{onChange:s}=this.props;s&&s.call(void 0,{syntheticEvent:t,nativeEvent:t.nativeEvent,value:this.value,target:this}),this.valueDuringOnChange=void 0},this.handleReject=t=>{this.setState({current:this.value});const{onReject:e}=this.props;e&&e.call(void 0,t)},this.handleNowClick=t=>{const e=this.mergeValue(l.cloneDate(this.value||ut()),ut());this.setState({current:e,value:e}),this.valueDuringOnChange=e;const{onChange:s}=this.props;s&&s.call(void 0,{syntheticEvent:t,nativeEvent:t.nativeEvent,value:this.value,target:this}),this.valueDuringOnChange=void 0},this.handleChange=t=>{this.setState({current:t});const{handleTimeChange:e}=this.props;e&&e.call(void 0,{time:t})},this.dateFormatParts=this.intl.splitDateFormat(this.props.format||ze.defaultProps.format),this.mergeValue=Us(Ks(this.dateFormatParts)),this.hasActiveButton=this.hasActiveButton.bind(this),this.state={current:this.props.value||B,value:this.props.value||ze.defaultProps.value}}get element(){return this._element}get value(){const i=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value;return i!==null?l.cloneDate(i):null}get intl(){return x.provideIntlService(this)}get current(){return this.state.current!==null?l.cloneDate(this.state.current):null}componentWillUnmount(){clearTimeout(this.nextTickId)}render(){const{format:i,cancelButton:t,disabled:e,tabIndex:s,className:a,smoothScroll:r,min:h,max:u,boundRange:c,nowButton:m,steps:f,show:g,mobileMode:w}=this.props,v=x.provideLocalizationService(this),E=v.toLanguageString(Qt,k[Qt]),O=v.toLanguageString(At,k[At]);return o.createElement("div",{ref:N=>{this._element=N},tabIndex:e?void 0:s||0,className:d.classNames("k-timeselector",a,{"k-disabled":e}),onKeyDown:this.handleKeyDown},o.createElement(mt,{ref:N=>{this.timePart=N},value:this.current,onChange:this.handleChange,onNowClick:this.handleNowClick,format:i,smoothScroll:r,min:h,max:u,boundRange:c,disabled:e,nowButton:m,steps:f,show:g,mobileMode:w,onNowKeyDown:this.handleNowKeyDown}),this.props.footer&&o.createElement("div",{className:"k-time-footer k-actions k-actions-stretched"},t&&o.createElement(L.Button,{type:"button",ref:N=>{this._cancelButton=N},className:"k-time-cancel",onClick:this.handleReject,title:E,"aria-label":E},E),o.createElement(L.Button,{type:"button",ref:N=>{this._acceptButton=N},className:"k-time-accept",themeColor:"primary",onClick:this.handleAccept,onKeyDown:this.revertToNowButton,title:O,"aria-label":O},O)))}nextTick(i){clearTimeout(this.nextTickId),this.nextTickId=window.setTimeout(()=>i())}hasActiveButton(){if(!this._acceptButton||!this._acceptButton.element)return!1;const i=d.getActiveElement(document);return this._acceptButton&&i===this._acceptButton.element||this._cancelButton&&i===this._cancelButton.element}};let Et=ze;Et.propTypes={cancelButton:n.bool,className:n.string,disabled:n.bool,format:n.oneOfType([n.string,n.shape({skeleton:n.string,pattern:n.string,date:n.oneOf(["short","medium","long","full"]),time:n.oneOf(["short","medium","long","full"]),datetime:n.oneOf(["short","medium","long","full"]),era:n.oneOf(["narrow","short","long"]),year:n.oneOf(["numeric","2-digit"]),month:n.oneOf(["numeric","2-digit","narrow","short","long"]),day:n.oneOf(["numeric","2-digit"]),weekday:n.oneOf(["narrow","short","long"]),hour:n.oneOf(["numeric","2-digit"]),hour12:n.bool,minute:n.oneOf(["numeric","2-digit"]),second:n.oneOf(["numeric","2-digit"]),timeZoneName:n.oneOf(["short","long"])})]),max:n.instanceOf(Date),min:n.instanceOf(Date),nowButton:n.bool,steps:n.shape({hour:n.number,minute:n.number,second:n.number}),smoothScroll:n.bool,tabIndex:n.number,value:n.instanceOf(Date),show:n.bool},Et.defaultProps={value:null,disabled:!1,cancelButton:!0,format:"t",min:ct,max:nt,boundRange:!1,footer:!0},x.registerForIntl(Et),x.registerForLocalization(Et);const G=class extends o.Component{constructor(i){super(i),this._element=null,this._dateInput=o.createRef(),this._timeSelector=null,this.shouldFocusDateInput=!1,this.prevShow=!1,this.focus=()=>{this.dateInput&&this.dateInput.focus()},this.renderTimeSelector=()=>{const{smoothScroll:t,cancelButton:e,nowButton:s,disabled:a,format:r,steps:h}=this.props;return o.createElement(Et,{ref:this.setTimeSelectorRef,className:this.mobileMode?"k-reset k-timeselector-lg":"",mobileMode:this.mobileMode,show:this.show,cancelButton:e,disabled:a,nowButton:s,format:r,min:this.min,max:this.max,steps:h,smoothScroll:t,value:this.value,footer:!this.mobileMode,handleTimeChange:this.mobileMode&&this.handleTimeChange,onChange:this.handleValueChange,onReject:this.handleValueReject})},this.renderPopup=()=>{const{popupClass:t,...e}=this.popupSettings,s=d.classNames("k-group k-reset",t),a={popupClass:"k-timepicker-popup",show:this.show,animate:this.element!==null,anchor:this.element,className:s,id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},...e};return this.props.popup?o.createElement(this.props.popup,{...a},this.renderTimeSelector()):o.createElement(Wt.Popup,{...a},this.renderTimeSelector())},this.renderAdaptivePopup=()=>{const{windowWidth:t=0}=this.state,e={expand:this.show,onClose:this.handleBlur,adaptiveTitle:this.props.adaptiveTitle,windowWidth:t,footer:{cancelText:this.localizationService.toLanguageString(Pt,k[Qt]),onCancel:this.handleValueReject,applyText:this.localizationService.toLanguageString(At,k[At]),onApply:s=>this.handleValueChange(s)}};return o.createElement(ne,{...e},o.createElement(ht.ActionSheetContent,{className:"!k-overflow-hidden"},this.renderTimeSelector()))},this.setTimeSelectorRef=t=>{this._timeSelector=t},this.nextValue=(t,e)=>t.value!==void 0?t.value:e.value,this.nextShow=(t,e)=>t.show!==void 0?t.show:e.show,this.handleInputValueChange=t=>{const e=this.mergeTime(t.value);this.handleValueChange({...t,value:e})},this.handleTimeChange=t=>{this.setState({candidate:t.time})},this.handleValueChange=t=>{this.setState({value:l.cloneDate(t.value||this.state.candidate)}),this.valueDuringOnChange=t.value,this.showDuringOnChange=!1,this.shouldFocusDateInput=!0;const{onChange:e}=this.props,s=this.value||this.state.candidate;e&&e.call(void 0,{syntheticEvent:t.syntheticEvent,nativeEvent:t.nativeEvent,value:s,show:this.show,target:this}),this.valueDuringOnChange=void 0,this.showDuringOnChange=void 0,this.setShow(!1)},this.handleFocus=()=>{this.setState({focused:!0})},this.handleBlur=()=>{this.setState({focused:!1}),this.setShow(!1)},this.handleValueReject=t=>{this.setShow(!1)},this.handleIconClick=t=>{this.props.disabled||(this.shouldFocusDateInput=!0,this.setShow(!this.show))},this.handleIconMouseDown=t=>{t.preventDefault()},this.handleKeyDown=t=>{const{altKey:e,keyCode:s}=t;if(s===d.Keys.esc){this.shouldFocusDateInput=!0,this.setShow(!1);return}e&&(s===d.Keys.up||s===d.Keys.down)&&(t.preventDefault(),t.stopPropagation(),this.shouldFocusDateInput=s===d.Keys.up,this.setShow(s===d.Keys.down))},d.validatePackage(ft),this.state={value:this.props.defaultValue||G.defaultProps.defaultValue,show:this.props.defaultShow||G.defaultProps.defaultShow,focused:!1,candidate:null},this.normalizeTime=this.normalizeTime.bind(this),this.setShow=this.setShow.bind(this),this.mergeTime=this.mergeTime.bind(this)}get _popupId(){return this.props.id+"-popup-id"}get document(){if(d.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get dateInput(){return this._dateInput.current}get timeSelector(){return this._timeSelector}get value(){const i=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value;return i!==null?l.cloneDate(i):null}get show(){return this.showDuringOnChange!==void 0?this.showDuringOnChange:this.props.show!==void 0?this.props.show:this.state.show}get name(){return this.props.name}get validity(){const i=this.value&&this.normalizeTime(this.value),t=this.normalizeTime(this.min),e=this.normalizeTime(this.max),s=$s(i,t,e),a=this.props.validationMessage!==void 0,r=(!this.required||this.value!==null)&&s,h=this.props.valid!==void 0?this.props.valid:r;return{customError:a,rangeOverflow:js(i,e),rangeUnderflow:Ts(i,t),valid:h,valueMissing:this.value===null}}get mobileMode(){return!!(this.state.windowWidth&&this.state.windowWidth<=ae&&this.props.adaptive)}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:G.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:G.defaultProps.required}get popupSettings(){return this.props.popupSettings||G.defaultProps.popupSettings}get min(){return this.props.min!==void 0?this.props.min:G.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:G.defaultProps.max}get dateInputComp(){return this.props.dateInput||G.defaultProps.dateInput}get localizationService(){return x.provideLocalizationService(this)}componentDidMount(){var i;this.observerResize=d.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.show&&this.forceUpdate(),(i=this.document)!=null&&i.body&&this.observerResize&&this.observerResize.observe(this.document.body)}componentDidUpdate(){this._timeSelector&&this.show&&!this.prevShow?this._timeSelector.focusActiveList():this.dateInput&&this.dateInput.element&&!this.show&&this.shouldFocusDateInput&&this.dateInput.element.focus({preventScroll:!0}),this.prevShow=this.show,this.shouldFocusDateInput=!1}componentWillUnmount(){var i;(i=this.document)!=null&&i.body&&this.observerResize&&this.observerResize.disconnect()}render(){const{size:i=G.defaultProps.size,rounded:t=G.defaultProps.rounded,fillMode:e=G.defaultProps.fillMode,disabled:s,tabIndex:a,title:r,id:h,className:u,format:c,formatPlaceholder:m,width:f,name:g,steps:w,validationMessage:v,required:E,validityStyles:O,ariaLabelledBy:N,ariaDescribedBy:S}=this.props,y=!this.validityStyles||this.validity.valid,b={disabled:s,format:c,formatPlaceholder:m,id:h,ariaLabelledBy:N,ariaDescribedBy:S,max:this.normalizeTime(this.max),min:this.normalizeTime(this.min),name:g,onChange:this.handleInputValueChange,required:E,steps:w,tabIndex:this.show?-1:a,title:r,valid:this.validity.valid,validationMessage:v,validityStyles:O,value:this.value&&this.normalizeTime(this.value),label:void 0,placeholder:this.state.focused?null:this.props.placeholder,ariaHasPopup:"dialog",ariaExpanded:this.show,size:null,fillMode:null,rounded:null,readonly:this.mobileMode},K=this.localizationService.toLanguageString(Pt,k[Pt]),M=this.localizationService.toLanguageString(we,k[we]),F=o.createElement(d.AsyncFocusBlur,{onFocus:this.handleFocus,onBlur:this.mobileMode?void 0:this.handleBlur,onSyncBlur:this.props.onBlur,onSyncFocus:this.props.onFocus},({onFocus:U,onBlur:V})=>o.createElement(o.Fragment,null,o.createElement("div",{id:this.props.id,ref:_=>{this._element=_},className:d.classNames("k-input","k-timepicker",{[`k-input-${d.kendoThemeMaps.sizeMap[i]||i}`]:i,[`k-rounded-${d.kendoThemeMaps.roundedMap[t]||t}`]:t,[`k-input-${e}`]:e,["k-invalid"]:!y,["k-required"]:this.required,["k-disabled"]:this.props.disabled},u),onKeyDown:this.handleKeyDown,style:{width:f},onFocus:U,onBlur:V,onClick:this.mobileMode?this.handleIconClick:void 0},o.createElement(this.dateInputComp,{_ref:this._dateInput,ariaRole:"combobox",ariaControls:this._popupId,...b}),o.createElement(L.Button,{tabIndex:-1,type:"button",icon:"clock",svgIcon:J.clockIcon,onMouseDown:this.handleIconMouseDown,onClick:this.mobileMode?void 0:this.handleIconClick,title:M,className:"k-input-button",rounded:null,"aria-label":K}),!this.mobileMode&&this.renderPopup()),this.mobileMode&&this.renderAdaptivePopup()));return this.props.label?o.createElement(ye,{dateInput:this._dateInput,label:this.props.label,editorId:h,editorValid:y,editorDisabled:this.props.disabled,children:F,style:{width:this.props.width}}):F}normalizeTime(i){return R(B,i)}setShow(i){const{onOpen:t,onClose:e}=this.props;this.show!==i&&(this.setState({show:i}),i&&t&&t.call(void 0,{target:this}),!i&&e&&e.call(void 0,{target:this}))}mergeTime(i){return this.value&&i?R(this.value,i):i}calculateMedia(i){for(let t of i)this.setState({windowWidth:t.target.clientWidth})}};let Vt=G;Vt.displayName="TimePicker",Vt.propTypes={className:n.string,cancelButton:n.bool,nowButton:n.bool,defaultShow:n.bool,defaultValue:n.instanceOf(Date),disabled:n.bool,format:n.oneOfType([n.string,n.shape({skeleton:n.string,pattern:n.string,date:n.oneOf(["short","medium","long","full"]),time:n.oneOf(["short","medium","long","full"]),datetime:n.oneOf(["short","medium","long","full"]),era:n.oneOf(["narrow","short","long"]),year:n.oneOf(["numeric","2-digit"]),month:n.oneOf(["numeric","2-digit","narrow","short","long"]),day:n.oneOf(["numeric","2-digit"]),weekday:n.oneOf(["narrow","short","long"]),hour:n.oneOf(["numeric","2-digit"]),hour12:n.bool,minute:n.oneOf(["numeric","2-digit"]),second:n.oneOf(["numeric","2-digit"]),timeZoneName:n.oneOf(["short","long"])})]),formatPlaceholder:n.oneOfType([n.oneOf(["wide","narrow","short","formatPattern"]),n.shape({year:n.string,month:n.string,day:n.string,hour:n.string,minute:n.string,second:n.string})]),id:n.string,ariaLabelledBy:n.string,ariaDescribedBy:n.string,min:n.instanceOf(Date),max:n.instanceOf(Date),name:n.string,popupSettings:n.shape({animate:n.bool,appendTo:n.any,popupClass:n.string}),show:n.bool,steps:n.shape({hour:n.number,minute:n.number,second:n.number}),smoothScroll:n.bool,tabIndex:n.number,title:n.string,value:n.instanceOf(Date),width:n.oneOfType([n.number,n.string]),validationMessage:n.string,required:n.bool,validate:n.bool,valid:n.bool,size:n.oneOf([null,"small","medium","large"]),rounded:n.oneOf([null,"small","medium","large","full"]),fillMode:n.oneOf([null,"solid","flat","outline"])},Vt.defaultProps={defaultShow:!1,defaultValue:null,disabled:!1,format:"t",max:nt,min:ct,popupSettings:{},tabIndex:0,steps:{},required:!1,validityStyles:!0,dateInput:ot,size:"medium",rounded:"medium",fillMode:"solid"};const Ai=d.createPropsContext(),Hi=d.withIdHOC(d.withPropsContext(Ai,Vt));Hi.displayName="KendoReactTimePicker",x.registerForLocalization(Vt);const Bi=2,qe=class extends o.Component{constructor(i){super(i),this._element=null,this.isActive=!1,this.focusActiveDate=()=>{if(!this._element)return;const t=this._element.querySelector("td.k-focus"),e=this._element.querySelector(".k-state-pending-focus");t&&t[0]&&t[0].classList.remove("k-focus"),e&&e.classList.add("k-focus"),this.isActive=!0},this.blurActiveDate=()=>{if(!this._element)return;const t=this._element.querySelector("td.k-focus");t&&t.classList.remove("k-focus"),this.isActive=!1},this.rotateSelectionRange=t=>{if(t.start===null||t.end===null)return t;const e=t.end<t.start;return{start:e?t.end:t.start,end:e?t.start:t.end}},this.handleDateChange=(t,e=!1)=>{const{onChange:s}=this.props;if(s){const a={syntheticEvent:t.syntheticEvent,nativeEvent:t.nativeEvent,value:l.cloneDate(t.value),target:this,isTodayClick:e};s.call(void 0,a)}}}get element(){return this._element}get weekNumber(){return!!(this.props.showWeekNumbers&&this.props.activeView===C.month)}get min(){return this.props.min!==void 0?this.props.min:qe.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:qe.defaultProps.max}componentDidUpdate(){this.isActive&&this.focusActiveDate()}render(){const i=this.props.allowReverse?this.rotateSelectionRange(this.props.selectionRange):this.props.selectionRange,t=d.classNames("k-calendar-view k-align-items-start k-justify-content-center",{"k-vstack":this.props.verticalView,"k-hstack":!this.props.verticalView,"k-calendar-monthview":this.props.activeView===C.month,"k-calendar-yearview":this.props.activeView===C.year,"k-calendar-decadeview":this.props.activeView===C.decade,"k-calendar-centuryview":this.props.activeView===C.century});return o.createElement("div",{ref:e=>{this._element=e},className:t},this.props.dates.map(e=>o.createElement("table",{className:"k-calendar-table k-content",key:e.getTime(),role:"grid"},o.createElement(Lt,{bus:this.props.bus,service:this.props.service,key:e.getTime(),direction:"horizontal",activeView:this.props.activeView,cellUID:this.props.cellUID,viewDate:e,min:this.min,max:this.max,focusedDate:this.props.focusedDate,selectionRange:i,selectedDate:this.props.value,showWeekNumbers:this.weekNumber,onChange:this.handleDateChange,onCellEnter:this.props.onCellEnter,cell:this.props.cell,weekCell:this.props.weekCell}))))}};let Ot=qe;Ot.defaultProps={showWeekNumbers:!1,views:Bi,take:Bi,allowReverse:!0,min:it,max:st};const Re=(i=Q.defaultProps.min,t=Q.defaultProps.max,e)=>e instanceof Date&&!Array.isArray(e)&&A(l.getDate(e),i,t)?l.getDate(e):null,zi=(i=Q.defaultProps.min,t=Q.defaultProps.max,e)=>Array.isArray(e)?e.filter(s=>A(s,i,t)).map(s=>l.getDate(s)):null,qi=i=>typeof i=="object"&&!(i instanceof Date)&&i!==null&&!Array.isArray(i)?i:q,Ri=(i,t,e)=>i||t&&t[0]||e&&e.start,pn=(i,t)=>i.start===null&&t===null?"start":i.end===null?"end":"start",kt=class extends o.Component{constructor(i){super(i),this.dates=[],this.selectedDate=null,this.selectedMultiple=null,this.selectedRange=q,this._focusedDate=new Date,this.cellUID=this.props.id+"-cell-uid",this.activeRangeEnd="start",this._element=null,this.intl=null,this.localization=null,this.service=null,this.calendarViewList=null,this.isActive=!1,this.calculateFocusFromValue=!0,this.focus=()=>{this._element&&this._element.focus()},this.clampRange=c=>({start:c,end:null}),this.rangeWithFocused=(c,m)=>({start:c.start,end:c.end===null&&c.start!==null&&this.isActive?m:c.end}),this.generateRange=(c,m)=>{const{end:f,start:g}=m,w=m.start!==null&&c.getTime()<=m.start.getTime();return!this.props.allowReverse&&w?{start:c,end:this.selectedRange.start}:this.activeRange!=="end"?{start:c,end:f}:{start:g||this.selectedDate,end:c}},this.canNavigate=c=>{if(!this.service)return!1;const m=this.service.move(this.focusedDate,c);return this.min<=m&&m<=this.max||this.service.isInSameView(m,this.min)||this.service.isInSameView(m,this.max)},this.navigate=(c,m)=>{this.calculateFocusFromValue=!1;const f=this.move(c,m);this.setState({navigateDate:f,focusedDate:f})},this.move=(c,m)=>this.clampDate(this.service.move(m,c)),this.clampDate=c=>Y(c,this.min,this.max),this.shouldAutoCorrect=(c,m)=>{const{end:f,start:g}=m;return this.activeRange!=="end"?f!==null&&c>f:g!==null&&c<g},this.handleCellEnter=c=>{this.props.mode==="range"&&(this.calculateFocusFromValue=!1,this.setState({focusedDate:c}))},this.handleMouseDown=c=>{c.preventDefault()},this.handleClick=c=>{this._element&&this._element.focus({preventScroll:!0})},this.handleFocus=c=>{if(this.isActive=!0,!this.calendarViewList)return;this.calendarViewList.focusActiveDate();const{onFocus:m}=this.props;m&&m.call(void 0,c)},this.handleBlur=c=>{if(this.isActive=!1,!this.calendarViewList)return;this.calendarViewList.blurActiveDate();const{onBlur:m}=this.props;m&&m.call(void 0,c)},this.handleTodayClick=c=>{this.todayIsInRange&&this.handleDateChange(c)},this.handlePrevButtonClick=()=>{const c=D.PrevView;if(this.state.activeView>0&&this.focusedDate.getFullYear()>this.dates[0].getFullYear())this.navigate(c,this.move(c,this.focusedDate));else{const m=this.isInMonth(this.focusedDate,this.dates[1])?this.move(c,this.focusedDate):this.focusedDate;this.navigate(c,m)}},this.handleNextButtonClick=()=>{this.navigate(D.NextView,this.focusedDate)},this.handleKeyDown=c=>{const{keyCode:f,ctrlKey:g,metaKey:w}=c;if(f===84){const v=z();this.calculateFocusFromValue=!1,this.setState({focusedDate:v,navigateDate:v})}if((g||w)&&(f===d.Keys.left&&this.handlePrevButtonClick(),f===d.Keys.right&&this.handleNextButtonClick()),f===d.Keys.enter){const v={syntheticEvent:c,nativeEvent:c.nativeEvent,value:this.focusedDate,target:this};this.handleDateChange(v)}else{const v=Y(this.navigation.move(this.focusedDate,this.navigation.action(c),this.state.activeView,this.service,c),this.min,this.max);if(l.isEqualDate(this.focusedDate,v))return;this.dates&&this.service&&!this.service.isInArray(v,this.dates)&&this.setState({navigateDate:v}),this.calculateFocusFromValue=!1,this.setState({focusedDate:v})}c.preventDefault()},this.handleViewChange=({view:c})=>{this.calculateFocusFromValue=!1,this.setState(m=>({activeView:c,navigateDate:m.focusedDate}))},this.handleDateChange=c=>{const m=l.cloneDate(c.value),f=this.bus.canMoveDown(this.state.activeView);if(this.props.disabled)return;if(f)if(c.isTodayClick)this.bus.moveToBottom(this.state.activeView);else{this.bus.moveDown(this.state.activeView,c.syntheticEvent),this.setState({focusedDate:m,navigateDate:m});return}this.calculateFocusFromValue=!0;let g;switch(this.props.mode){case"single":g=l.cloneDate(c.value);break;case"multiple":if(Array.isArray(this.selectedMultiple)){const v=this.selectedMultiple.slice();let E=-1;v.forEach((O,N)=>{l.isEqualDate(O,c.value)&&(E=N)}),E!==-1?v.splice(E,1):v.push(l.cloneDate(c.value)),g=v.slice()}else this.selectedDate?g=[l.cloneDate(this.selectedDate),l.cloneDate(c.value)]:g=[l.cloneDate(c.value)];break;case"range":{g=this.selectedRange.start!==null&&this.selectedRange.end!==null&&this.activeRange==="start"?this.clampRange(c.value):this.generateRange(c.value,this.selectedRange),this.activeRangeEnd=this.activeRange!=="end"?"end":"start";break}default:g=l.cloneDate(c.value);break}this.valueDuringOnChange=g,c.isTodayClick&&this.setState({navigateDate:m}),this.setState({value:g,focusedDate:m}),this.valueDuringOnChange=g;const{onChange:w}=this.props;if(w){const v={syntheticEvent:c.syntheticEvent,nativeEvent:c.nativeEvent,value:g,target:this};w.call(void 0,v)}this.valueDuringOnChange=void 0};const t=i.value!==void 0?i.value:i.defaultValue||kt.defaultProps.defaultValue,e=Re(this.min,this.max,t),s=zi(this.min,this.max,t),a=qi(t),r=Ri(e,s,a),h=Yt(C[i.defaultActiveView],this.bottomView,this.topView),u=Y(i.focusedDate||r||z(),this.min,this.max);this.state={value:t,activeView:h,focusedDate:u,navigateDate:u},this.activeRangeEnd=pn(a,e),this.bus=new de(this.handleViewChange),this.navigation=new me(this.bus),this.calculateFocusFromValue=!1,this.lastView=h,this.lastViewsCount=this.props.views||Ot.defaultProps.views}get wrapperID(){return this.props.id+"-wrapper-id"}get isRtl(){return this.props.dir==="rtl"}get element(){return this._element}get value(){return this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value}get focusedDate(){return l.cloneDate(this._focusedDate)}get min(){return l.getDate(this.props.min!==void 0?this.props.min:kt.defaultProps.min)}get max(){return l.getDate(this.props.max!==void 0?this.props.max:kt.defaultProps.max)}get bottomView(){return C[this.props.bottomView!==void 0?this.props.bottomView:kt.defaultProps.bottomView]}get topView(){return C[this.props.topView!==void 0?this.props.topView:kt.defaultProps.topView]}get activeRange(){return this.props.activeRangeEnd!==void 0?this.props.activeRangeEnd:this.activeRangeEnd}get todayIsInRange(){return A(z(),l.getDate(this.min),l.getDate(this.max))}componentDidMount(){this.calculateFocusFromValue=!0}componentDidUpdate(){this.calendarViewList&&(this.isActive?this.calendarViewList.focusActiveDate:this.calendarViewList.blurActiveDate)();const i=Re(this.min,this.max,this.value);this.calculateFocusFromValue=!!(this.selectedDate&&i&&this.selectedDate.getTime()&&i.getTime()),this.lastView=this.state.activeView,this.lastViewsCount=this.props.views||Ot.defaultProps.views}render(){this.props._ref&&this.props._ref(this),this.intl=x.provideIntlService(this),this.localization=x.provideLocalizationService(this),this.bus.configure(this.bottomView,this.topView);const i=Yt(this.state.activeView,this.bottomView,this.topView);this.service=this.bus.service(i,this.intl),this.selectedDate=Re(this.min,this.max,this.value),this.selectedMultiple=zi(this.min,this.max,this.value),this.selectedRange=qi(this.value);const t=Ri(this.selectedDate,this.selectedMultiple,this.selectedRange);this._focusedDate=Y(this.calculateFocusFromValue&&t!==null?t:this.state.focusedDate,this.min,this.max);const e=d.classNames("k-widget k-calendar k-calendar-range",{"k-disabled":this.props.disabled},this.props.className),s=this.rangeWithFocused(this.selectedRange,this.focusedDate),a=this.localization.toLanguageString(pe,k[pe]),r=this.localization.toLanguageString(fe,k[fe]),h=!this.canNavigate(D.PrevView),u=!this.canNavigate(D.NextView),c={"aria-disabled":h},m={"aria-disabled":u},f=this.lastView!==i,g=this.dates&&this.isInMonth(this.state.navigateDate,this.dates[0]),w=this.lastViewsCount!==this.props.views;(!g||f||w)&&(this.dates=this.service.datesList(this.state.navigateDate,this.props.views||Ot.defaultProps.views));const v=l.cloneDate(this.dates&&this.dates[0]?this.dates[0]:z());return o.createElement("div",{ref:E=>{this._element=E},className:e,id:this.props.id||this.wrapperID,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,tabIndex:this.props.disabled?void 0:this.props.tabIndex,onFocus:this.handleFocus,onBlur:this.handleBlur,onMouseDown:this.handleMouseDown,onClick:this.handleClick,onKeyDown:this.handleKeyDown,"aria-disabled":this.props.disabled,dir:this.props.dir},o.createElement(vt,{key:`.kendo.calendar.header.${v.getTime()}`,activeView:i,currentDate:v,min:this.min,max:this.max,rangeLength:this.props.views,bus:this.bus,service:this.service,headerTitle:this.props.headerTitle,verticalView:this.props.mobileMode,commands:o.createElement(o.Fragment,null,o.createElement(L.Button,{type:"button",className:"k-calendar-nav-prev",icon:this.isRtl?"chevron-right":"chevron-left",svgIcon:this.isRtl?J.chevronRightIcon:J.chevronLeftIcon,fillMode:"flat",title:a,disabled:h,onClick:this.handlePrevButtonClick,...c}),o.createElement(It,{min:this.min,max:this.max,onClick:this.handleTodayClick,disabled:!this.todayIsInRange}),o.createElement(L.Button,{type:"button",className:"k-calendar-nav-next",icon:this.isRtl?"chevron-left":"chevron-right",svgIcon:this.isRtl?J.chevronLeftIcon:J.chevronRightIcon,fillMode:"flat",title:r,disabled:u,onClick:this.handleNextButtonClick,...m}))}),o.createElement(Ot,{ref:E=>{this.calendarViewList=E},dates:this.dates,activeView:i,focusedDate:this.focusedDate,min:this.min,max:this.max,bus:this.bus,service:this.service,selectionRange:s,value:this.selectedMultiple||this.selectedDate,cellUID:this.cellUID,views:this.props.views,onChange:this.handleDateChange,showWeekNumbers:this.props.weekNumber,onCellEnter:this.handleCellEnter,cell:this.props.cell,weekCell:this.props.weekCell,headerTitle:this.props.headerTitle,verticalView:this.props.mobileMode}))}isInMonth(i,t){return!!t&&l.firstDayOfMonth(t)<=i&&i<=l.lastDayOfMonth(t)}};let Q=kt;Q.displayName="MultiViewCalendar",Q.propTypes={activeRangeEnd:n.oneOf(["start","end"]),allowReverse:n.bool,bottomView:n.oneOf(["month","year","decade","century"]),className:n.string,defaultActiveView:n.oneOf(["month","year","decade","century"]),defaultValue:n.oneOfType([et(n.instanceOf(Date)),n.arrayOf(n.instanceOf(Date)),n.shape({start:et(n.instanceOf(Date)),end:et(n.instanceOf(Date))})]),disabled:n.bool,focusedDate:n.instanceOf(Date),id:n.string,ariaLabelledBy:n.string,ariaDescribedBy:n.string,max:n.instanceOf(Date),min:n.instanceOf(Date),mode:n.oneOf(["single","multiple","range"]),onBlur:n.func,onChange:n.func,onFocus:n.func,tabIndex:n.number,topView:n.oneOf(["month","year","decade","century"]),value:n.oneOfType([et(n.instanceOf(Date)),n.arrayOf(n.instanceOf(Date)),n.shape({start:et(n.instanceOf(Date).isRequired),end:et(n.instanceOf(Date).isRequired)})]),views:(i,t,e)=>{const s=i[t];return s!==void 0&&s<1?new Error(`Invalid prop '${t}' supplied to'${e}'. The '${t}' property cannot be less than 1'`):null},weekNumber:n.bool,dir:n.string},Q.defaultProps={disabled:!1,min:it,max:st,navigation:!0,defaultActiveView:"month",defaultValue:null,topView:"century",tabIndex:0,bottomView:"month",views:2,allowReverse:!1};const Wi=d.createPropsContext(),We=d.withIdHOC(d.withPropsContext(Wi,Q));We.displayName="KendoReactMultiViewCalendar",x.registerForIntl(Q),x.registerForLocalization(Q);const Rt=class extends o.Component{constructor(i){super(i),this._element=null,this._calendar=null,this._startDateInput=o.createRef(),this._endDateInput=o.createRef(),this.shouldFocusDateInput=!1,this.shouldFocusCalendar=!1,this.focus=()=>{this.startDateInput&&this.startDateInput.focus()},this.setCalendarRef=t=>{this._calendar=t},this.focusCalendarElement=()=>{this._calendar&&this._calendar.element&&this._calendar.element.focus({preventScroll:!0})},this.calculateValue=(t,e)=>(t.value!==void 0?t.value:e.value)||q,this.calculateShow=(t,e)=>t.show!==void 0?t.show:e.show,this.renderCalendar=()=>{const t=this.value||q,e={min:this.min,max:this.max,allowReverse:this.props.allowReverse,mode:"range",focusedDate:this.props.focusedDate,disabled:this.props.disabled,className:this.mobileMode?"k-calendar-lg":"",mobileMode:this.mobileMode,...this.props.calendarSettings,value:t,dir:this.props.dir,onChange:this.handleCalendarChange};return this.props.calendar?o.createElement(this.props.calendar,{...e}):o.createElement(We,{...e,ref:this.setCalendarRef})},this.renderPopup=()=>{const t={popupClass:"k-daterangepicker-popup",animate:this._element!==null,anchor:this._element,id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},...this.props.popupSettings,show:this.show};return this.props.popup?o.createElement(this.props.popup,{...t},this.renderCalendar()):o.createElement(Wt.Popup,{...t},this.renderCalendar())},this.renderAdaptivePopup=()=>{const{windowWidth:t=0}=this.state,e={expand:this.show,onClose:s=>this.handleCancel(s),adaptiveTitle:this.props.adaptiveTitle,windowWidth:t,footer:{cancelText:this.localizationService.toLanguageString(De,k[De]),onCancel:this.handleCancel,applyText:this.localizationService.toLanguageString(Ie,k[Ie]),onApply:this.handleBlur}};return o.createElement(ne,{...e},o.createElement(ht.ActionSheetContent,{className:"!k-overflow-hidden"},o.createElement("div",{className:"k-scrollable-wrap"},this.renderCalendar())))},this.handleReverseClick=t=>{const e={start:this.value.end,end:this.value.start},s={syntheticEvent:t,nativeEvent:t.nativeEvent};this.handleChange(e,s)},this.handleReverseMouseDown=t=>{t.preventDefault()},this.handleFocus=t=>{clearTimeout(this.nextTickId),this.shouldFocusDateInput||this.mobileMode&&this.setState({currentValue:this.value});const{onFocus:e}=this.props;e&&e.call(void 0,t)},this.handleClick=()=>{this.shouldFocusDateInput||this.setShow(!0)},this.handleBlur=t=>{this.nextTick(()=>{this.setShow(!1)});const{onBlur:e}=this.props;e&&e.call(void 0,t)},this.handleCancel=t=>{this.nextTick(()=>{this.setShow(!1),this.setState({currentValue:q})});const{onCancel:e}=this.props;e&&e.call(void 0,t)},this.handleEndChange=t=>{const e={start:this.value.start,end:l.cloneDate(t.value||void 0)};this.handleChange(e,t)},this.handleStartChange=t=>{const e={start:l.cloneDate(t.value||void 0),end:this.value.end};this.handleChange(e,t)},this.extractRangeFromValue=t=>{if(!Array.isArray(t.value)&&!(t.value instanceof Date))return t.value||q;const e=Array.isArray(t.value)?t.value[0]:t.value;return{start:this.value.end!==null?e:this.value.start,end:this.value.start!==null?e:this.value.end}},this.handleCalendarChange=t=>{const e=this.extractRangeFromValue(t);this.handleChange(e,t)},this.handleKeyDown=t=>{const{keyCode:e,altKey:s}=t;e===d.Keys.esc?(t.preventDefault(),this.shouldFocusDateInput=!0,this.setShow(!1)):s&&e===d.Keys.down?(t.preventDefault(),this.shouldFocusCalendar=!0,this.setShow(!0),this.focusCalendarElement()):s&&e===d.Keys.up&&(t.preventDefault(),this.shouldFocusDateInput=!0,this.setShow(!1))},this.handleChange=(t,e)=>{this.setState({value:t}),this.valueDuringOnChange=t;const{onChange:s}=this.props;if(s){const a={syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,value:this.value,show:this.show,target:this};s.call(void 0,a)}this.valueDuringOnChange=void 0},d.validatePackage(ft),this.state={show:this.props.show||this.props.defaultShow||Rt.defaultProps.defaultShow,value:this.props.value||this.props.defaultValue||Rt.defaultProps.defaultValue,currentValue:q},this.nextTick=this.nextTick.bind(this),this.setShow=this.setShow.bind(this),this.focusCalendarElement=this.focusCalendarElement.bind(this),this.focusDateInputElement=this.focusDateInputElement.bind(this)}get _popupId(){return this.props.id+"-popup-id"}get _startInputId(){return this.props.id+"-start-input-id"}get _endInputId(){return this.props.id+"-end-input-id"}get element(){return this._element}get startDateInput(){return this._startDateInput.current}get endDateInput(){return this._endDateInput.current}get calendar(){return this._calendar}get value(){return(this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value)||q}get show(){return this.showDuringOnChange!==void 0?this.showDuringOnChange:this.props.show!==void 0?this.props.show:this.state.show}get min(){return this.props.min!==void 0?this.props.min:Rt.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:Rt.defaultProps.max}get document(){if(d.canUseDOM)return this.element&&this.element.ownerDocument||document}get localizationService(){return x.provideLocalizationService(this)}get mobileMode(){return!!(this.state.windowWidth&&this.state.windowWidth<=ae&&this.props.adaptive)}componentDidMount(){var i;this.observerResize=d.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.show&&this.forceUpdate(),(i=this.document)!=null&&i.body&&this.observerResize&&this.observerResize.observe(this.document.body)}componentDidUpdate(){this.shouldFocusCalendar&&this.focusCalendarElement(),this.shouldFocusDateInput&&this.focusDateInputElement(),this.shouldFocusCalendar=!1,this.shouldFocusDateInput=!1}componentWillUnmount(){var i;clearTimeout(this.nextTickId),(i=this.document)!=null&&i.body&&this.observerResize&&this.observerResize.disconnect()}render(){const i=this.value||q,t=this.mobileMode&&this.show?this.state.currentValue:i,e=(this.props.startDateInputSettings||{}).id||this._startInputId,s=(this.props.endDateInputSettings||{}).id||this._endInputId,a=d.classNames("k-daterangepicker",{"k-disabled":this.props.disabled},this.props.className),r=this.localizationService.toLanguageString(Gt,k[Gt]),h=this.localizationService.toLanguageString(Xt,k[Xt]),u=this.localizationService.toLanguageString(Jt,k[Jt]),c={disableSelection:this.mobileMode&&!0,label:r,format:this.props.format,min:this.min,max:this.max,id:this._startInputId,disabled:this.props.disabled,valid:this.props.valid,tabIndex:this.props.tabIndex,ariaExpanded:this.show,...this.props.startDateInputSettings,value:t.start,onChange:this.handleStartChange},m={disableSelection:this.mobileMode&&!0,label:h,format:this.props.format,min:this.min,max:this.max,id:this._endInputId,disabled:this.props.disabled,valid:this.props.valid,tabIndex:this.props.tabIndex,ariaExpanded:this.show,...this.props.endDateInputSettings,value:t.end,onChange:this.handleEndChange},f=o.createElement(L.Button,{type:"button",className:"k-select",fillMode:"flat",title:x.provideLocalizationService(this).toLanguageString(St,k[St]),onMouseDown:this.handleReverseMouseDown,onClick:this.handleReverseClick,"aria-controls":e+" "+s,"aria-label":x.provideLocalizationService(this).toLanguageString(St,k[St])},o.createElement(d.IconWrap,{style:{transform:"rotate(90deg)"},name:"arrows-swap",icon:J.arrowsSwapIcon}));return o.createElement(o.Fragment,null,o.createElement("span",{ref:g=>{this._element=g},className:a,style:this.props.style,id:this.props.id,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,tabIndex:this.props.tabIndex,onFocus:this.handleFocus,onClick:this.handleClick,onKeyDown:this.handleKeyDown,onBlur:this.mobileMode?void 0:this.handleBlur,dir:this.props.dir},this.props.startDateInput?o.createElement(this.props.startDateInput,{...c}):o.createElement(ot,{...c,ref:this._startDateInput,ariaRole:"combobox",ariaControls:this._popupId,readonly:this.mobileMode}),(this.props.allowReverse||this.props.calendarSettings&&this.props.calendarSettings.allowReverse)&&this.props.swapButton?f:u,this.props.endDateInput?o.createElement(this.props.endDateInput,{...m}):o.createElement(ot,{...m,ref:this._endDateInput,ariaRole:"combobox",ariaControls:this._popupId,readonly:this.mobileMode}),!this.mobileMode&&this.renderPopup()),this.mobileMode&&this.renderAdaptivePopup())}focusDateInputElement(){if(!document||!this.startDateInput||!this.startDateInput.element||!this.endDateInput||!this.endDateInput.element)return;const i=d.getActiveElement(document);(this.value.start===null||this.value.end!==null)&&i!==this.endDateInput.element?this.startDateInput.element.focus({preventScroll:!0}):i!==this.startDateInput.element&&this.endDateInput.element.focus({preventScroll:!0})}nextTick(i){clearTimeout(this.nextTickId),this.nextTickId=window.setTimeout(()=>i())}setShow(i){const{onOpen:t,onClose:e}=this.props;this.show!==i&&(this.setState({show:i}),i&&t&&t.call(void 0,{target:this}),!i&&e&&e.call(void 0,{target:this}))}calculateMedia(i){for(let t of i)this.setState({windowWidth:t.target.clientWidth})}};let Nt=Rt;Nt.displayName="DateRangePicker",Nt.propTypes={allowReverse:n.bool,calendarSettings:n.any,className:n.string,defaultShow:n.bool,defaultValue:n.shape({start:et(n.instanceOf(Date).isRequired),end:et(n.instanceOf(Date).isRequired)}),disabled:n.bool,endDateInputSettings:n.shape(lt.propTypes),focusedDate:n.instanceOf(Date),format:n.oneOfType([n.string,n.shape({skeleton:n.string,pattern:n.string,date:n.oneOf(["short","medium","long","full"]),time:n.oneOf(["short","medium","long","full"]),datetime:n.oneOf(["short","medium","long","full"]),era:n.oneOf(["narrow","short","long"]),year:n.oneOf(["numeric","2-digit"]),month:n.oneOf(["numeric","2-digit","narrow","short","long"]),day:n.oneOf(["numeric","2-digit"]),weekday:n.oneOf(["narrow","short","long"]),hour:n.oneOf(["numeric","2-digit"]),hour12:n.bool,minute:n.oneOf(["numeric","2-digit"]),second:n.oneOf(["numeric","2-digit"]),timeZoneName:n.oneOf(["short","long"])})]),id:n.string,ariaLabelledBy:n.string,ariaDescribedBy:n.string,max:n.instanceOf(Date),min:n.instanceOf(Date),onBlur:n.func,onChange:n.func,onFocus:n.func,popupSettings:n.any,show:n.bool,startDateInputSettings:n.any,style:n.any,swapButton:n.any,tabIndex:n.number,dir:n.string,value:n.shape({start:et(n.instanceOf(Date).isRequired),end:et(n.instanceOf(Date).isRequired)})},Nt.defaultProps={allowReverse:!1,defaultShow:!1,defaultValue:q,disabled:!1,format:"d",max:st,min:it,swapButton:!1};const Ki=d.createPropsContext(),Ui=d.withIdHOC(d.withPropsContext(Ki,Nt));Ui.displayName="KendoReactDateRangePicker",x.registerForLocalization(Nt);class Ke extends o.Component{constructor(t){super(t),this._calendar=null,this._timePart=null,this._cancelButton=null,this._acceptButton=null,this._dateButtonRef=null,this._calendarWrap=null,this.shouldFocusPart=!1,this.focus=e=>{Promise.resolve().then(()=>{this.state.tab==="time"&&this._timePart&&this._timePart.focus(e);const s=this.calendarElement();this.state.tab==="date"&&s&&s.focus(e)})},this.calendarElement=()=>this._calendar&&this._calendar.element||this._calendarWrap&&this._calendarWrap.querySelector(".k-widget.k-calendar"),this.move=e=>{if(e==="right"&&this.state.tab==="time"||e==="left"&&this.state.tab==="date")return;const s=e==="left"?"date":"time";this.shouldFocusPart=!0,this.setState({tab:s})},this.dateTimeFooter=()=>{const{cancelButton:e}=this.props,s=this.localizationService.toLanguageString(Ht,k[Ht]),a=this.localizationService.toLanguageString(Bt,k[Bt]);return o.createElement("div",{className:"k-datetime-footer k-actions k-actions-stretched"},e&&o.createElement(L.Button,{type:"button",ref:r=>{this._cancelButton=r},className:"k-time-cancel",onClick:this.handleReject,onKeyDown:this.handleCancelKeyDown,title:s,"aria-label":s},s),o.createElement(L.Button,{type:"button",themeColor:"primary",ref:r=>{this._acceptButton=r},className:"k-time-accept",disabled:!this.hasDateValue,onClick:this.handleAccept,onKeyDown:this.handleSetKeyDown,title:a,"aria-label":a},a))},this.handleReject=e=>{this.setState({dateValue:this.props.value,timeValue:this.props.value||B});const s=this.mergeDate(this.props.value,this.props.value||B);if(this.props.onReject){const a={nativeEvent:e.nativeEvent,syntheticEvent:e,target:this,value:s};this.props.onReject.call(void 0,a)}},this.handleAccept=(e,s)=>{if(!this.state.dateValue||!this.state.timeValue||!this.hasDateValue)return;const a=this.mergeDate(this.state.dateValue,s||this.state.timeValue);this.props.onChange.call(void 0,{syntheticEvent:e,nativeEvent:e.nativeEvent,value:a,target:this})},this.handleNowClick=e=>{this.setState({timeValue:ut()}),this.handleAccept(e,ut())},this.handleCalendarValueChange=e=>{e.syntheticEvent.stopPropagation(),this.setState({dateValue:e.value,tab:"time"}),this.shouldFocusPart=!0},this.handleTimeListContainerChange=e=>{this.setState({timeValue:e})},this.handleDateClick=e=>{e.stopPropagation(),this.move("left")},this.handleTimeClick=e=>{e.stopPropagation(),this.move("right")},this.handleKeyDown=e=>{const{keyCode:s,altKey:a}=e;if(!this.props.disabled)switch(s){case d.Keys.enter:!this.hasActiveButton()&&this.hasDateValue&&this.handleAccept(e);return;case d.Keys.left:if(!a)return;this.move("left");return;case d.Keys.right:if(!a)return;this.move("right");return;default:return}},this.handleCancelKeyDown=e=>{const{keyCode:s}=e;s===d.Keys.tab&&this._dateButtonRef&&this._dateButtonRef.element&&!this.hasDateValue&&(e.preventDefault(),this._dateButtonRef.element.focus())},this.handleSetKeyDown=e=>{const{keyCode:s}=e;s===d.Keys.tab&&this._dateButtonRef&&this._dateButtonRef.element&&(e.preventDefault(),this._dateButtonRef.element.focus())},this.handleDateKeyDown=e=>{var r,h,u,c;const{keyCode:s,shiftKey:a}=e;a&&s===d.Keys.tab&&(e.stopPropagation(),this.hasDateValue?(c=(u=this._acceptButton)==null?void 0:u.element)==null||c.focus():(h=(r=this._cancelButton)==null?void 0:r.element)==null||h.focus()),s===d.Keys.enter&&(e.stopPropagation(),this.move("left"))},this.handleTimeKeyDown=e=>{const{keyCode:s}=e;s===d.Keys.enter&&(e.stopPropagation(),this.move("right"))},this.handleTimePartMount=e=>{this.setState({timeValue:e})},this.state={tab:"date",dateValue:this.props.value,timeValue:this.props.value||B}}get calendar(){return this._calendar}get timePart(){return this._timePart}get hasDateValue(){return this.state.dateValue!==null}get localizationService(){return x.provideLocalizationService(this)}componentDidUpdate(t,e){var s,a;this.shouldFocusPart&&this.focus({preventScroll:!0}),(((s=t.value)==null?void 0:s.getTime())!==((a=this.props.value)==null?void 0:a.getTime())||this.state.tab!==e.tab&&this.props.value)&&this.setState({dateValue:t.value&&this.props.value&&l.isEqualDate(t.value,this.props.value)?this.state.dateValue:this.props.value,timeValue:this.props.value||B}),this.shouldFocusPart=!1}render(){const{disabled:t,min:e,max:s,weekNumber:a,focusedDate:r,format:h,mobileMode:u,footerActions:c}=this.props,m=d.classNames({"k-date-tab":this.state.tab==="date","k-time-tab":this.state.tab==="time","k-disabled":t},"k-datetime-wrap"),f=this.localizationService.toLanguageString(be,k[be]),g=this.localizationService.toLanguageString(Se,k[Se]),w={min:e,max:s,weekNumber:a,focusedDate:r,disabled:t||this.state.tab!=="date",value:this.state.dateValue,onChange:this.handleCalendarValueChange,navigation:!1,tabIndex:t||this.state.tab!=="date"?-1:void 0,mobileMode:u};return o.createElement("div",{onKeyDown:this.handleKeyDown,className:m,tabIndex:-1},o.createElement("div",{className:"k-datetime-buttongroup"},o.createElement(L.ButtonGroup,{width:"100%"},o.createElement(L.Button,{ref:v=>this._dateButtonRef=v,type:"button",selected:this.state.tab==="date",togglable:!0,onClick:this.handleDateClick,onKeyDown:this.handleDateKeyDown},f),o.createElement(L.Button,{type:"button",selected:this.state.tab==="time",togglable:!0,onClick:this.handleTimeClick,onKeyDown:this.handleTimeKeyDown},g))),o.createElement("div",{className:"k-datetime-selector"},o.createElement("div",{className:"k-datetime-calendar-wrap",ref:v=>this._calendarWrap=v},this.props.calendar?o.createElement(this.props.calendar,{key:this.state.tab,...w}):o.createElement(te,{key:this.state.tab,ref:v=>{this._calendar=v},...w})),o.createElement("div",{className:"k-datetime-time-wrap"},o.createElement("div",{className:u?"k-reset k-timeselector-lg k-timeselector":""},o.createElement(mt,{key:1,onNowClick:this.handleNowClick,disabled:t||this.state.tab!=="time",ref:v=>{this._timePart=v},min:this.minTime||ct,max:this.maxTime||nt,steps:this.props.steps,value:this.state.timeValue,format:h,onChange:this.handleTimeListContainerChange,onMount:this.handleTimePartMount,mobileMode:u})))),c&&this.dateTimeFooter())}get minTime(){return this.props.minTime!==void 0?this.props.minTime:this.normalizeRange(this.props.min,this.state.dateValue)}get maxTime(){return this.props.maxTime!==void 0?this.props.maxTime:this.normalizeRange(this.props.max,this.state.dateValue)}normalizeRange(t,e){return l.isEqualDate(t,e||z())?t:null}hasActiveButton(){if(!this._acceptButton)return!1;const t=d.getActiveElement(document);return this._acceptButton&&t===this._acceptButton.element||this._cancelButton&&t===this._cancelButton.element}mergeTime(t,e){return t&&e?R(e,t):e}mergeDate(t,e){return t?R(t||z(),e):e}}Ke.defaultProps={footerActions:!0},x.registerForLocalization(Ke);const P=class extends o.Component{constructor(i){super(i),this._element=null,this._dateInput=o.createRef(),this._dateTimeSelector=null,this.shouldFocusDateInput=!1,this.prevShow=!1,this.focus=()=>{const t=this.dateInputElement();t&&t.focus()},this.renderPicker=()=>{const{disabled:t,minTime:e,maxTime:s,format:a,calendar:r,cancelButton:h,weekNumber:u,focusedDate:c}=this.props;return o.createElement(Ke,{ref:m=>{this._dateTimeSelector=m},cancelButton:h,steps:this.props.steps,value:this.value,onChange:this.handleValueChange,onReject:this.handleReject,disabled:t,weekNumber:u,min:this.min,max:this.max,minTime:e,maxTime:s,focusedDate:c,format:a,calendar:r,mobileMode:this.mobileMode,footerActions:!this.mobileMode})},this.renderAdaptivePopup=()=>{const{windowWidth:t=0}=this.state,e=x.provideLocalizationService(this).toLanguageString(Ht,k[Ht]),s=x.provideLocalizationService(this).toLanguageString(Bt,k[Bt]),a={expand:this.show,onClose:this.handleBlur,adaptiveTitle:this.props.adaptiveTitle,windowWidth:t,footer:{cancelText:e,onCancel:r=>{var h;return(h=this._dateTimeSelector)==null?void 0:h.handleReject(r)},applyText:s,onApply:r=>{var h;return(h=this._dateTimeSelector)==null?void 0:h.handleAccept(r)}}};return o.createElement(ne,{...a},o.createElement(ht.ActionSheetContent,{className:"!k-overflow-hidden"},this.renderPicker()))},this.handleReject=()=>{this.shouldFocusDateInput=!0,this.setShow(!1)},this.handleValueChange=t=>{this.setState({value:l.cloneDate(t.value||void 0)}),this.valueDuringOnChange=t.value,this.showDuringOnChange=!1,this.mobileMode||(this.shouldFocusDateInput=!0);const{onChange:e}=this.props;e&&e.call(void 0,{syntheticEvent:t.syntheticEvent,nativeEvent:t.nativeEvent,value:this.value,show:this.show,target:this}),this.valueDuringOnChange=void 0,this.showDuringOnChange=void 0,this.setShow(!1)},this.handleFocus=()=>{this.setState({focused:!0})},this.handleBlur=()=>{this.setState({focused:!1}),this.setShow(!1)},this.handleDateIconClick=()=>{this.props.disabled||(this.shouldFocusDateInput=!0,this.setShow(!this.show))},this.handleIconMouseDown=t=>{t.preventDefault()},this.handleKeyDown=t=>{const{altKey:e,keyCode:s}=t;if(s===d.Keys.esc){this.shouldFocusDateInput=!0,this.setShow(!1);return}e&&(s===d.Keys.up||s===d.Keys.down)&&(t.preventDefault(),t.stopPropagation(),this.shouldFocusDateInput=s===d.Keys.up,this.setShow(s===d.Keys.down))},this.dateInputElement=()=>this.dateInput&&this.dateInput.element||this.element&&this.element.querySelector(".k-dateinput > input.k-input-inner"),d.validatePackage(ft),this.state={value:this.props.defaultValue||P.defaultProps.defaultValue,show:this.props.defaultShow||P.defaultProps.defaultShow,focused:!1}}get _popupId(){return this.props.id+"-popup-id"}get document(){if(d.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get dateInput(){return this._dateInput.current}get value(){const i=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value;return i!==null?l.cloneDate(i):null}get show(){return this.showDuringOnChange!==void 0?this.showDuringOnChange:this.props.show!==void 0?this.props.show:this.state.show}get name(){return this.props.name}get mobileMode(){return!!(this.state.windowWidth&&this.state.windowWidth<=ae&&this.props.adaptive)}get min(){return this.props.min!==void 0?this.props.min:P.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:P.defaultProps.max}get validity(){const i=je(this.value,this.min,this.max)&&Ne(this.value,this.props.minTime||ct,this.props.maxTime||nt),t=this.props.validationMessage!==void 0,e=(!this.required||this.value!==null)&&i,s=this.props.valid!==void 0?this.props.valid:e;return{customError:t,rangeOverflow:this.value&&this.max.getTime()<this.value.getTime()||!1,rangeUnderflow:this.value&&this.value.getTime()<this.min.getTime()||!1,valid:s,valueMissing:this.value===null}}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:P.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:P.defaultProps.required}get dateInputComp(){return this.props.dateInput||P.defaultProps.dateInput}componentDidMount(){var i;this.observerResize=d.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.show&&this.forceUpdate(),(i=this.document)!=null&&i.body&&this.observerResize&&this.observerResize.observe(this.document.body)}componentDidUpdate(){const i=this.dateInputElement();this._dateTimeSelector&&this.show&&!this.prevShow&&this._dateTimeSelector.focus({preventScroll:!0}),i&&!this.show&&this.shouldFocusDateInput&&i.focus({preventScroll:!0}),this.prevShow=this.show,this.shouldFocusDateInput=!1}componentWillUnmount(){var i;clearTimeout(this.nextTickId),(i=this.document)!=null&&i.body&&this.observerResize&&this.observerResize.disconnect()}render(){const{size:i=P.defaultProps.size,rounded:t=P.defaultProps.rounded,fillMode:e=P.defaultProps.fillMode,disabled:s,tabIndex:a,title:r,id:h,format:u,formatPlaceholder:c,min:m,max:f,className:g,width:w,name:v,validationMessage:E,required:O,validityStyles:N,minTime:S,maxTime:y,ariaLabelledBy:b,ariaDescribedBy:K,popup:M=Wt.Popup}=this.props,F=!this.validityStyles||this.validity.valid,U={id:h,ariaLabelledBy:b,ariaDescribedBy:K,format:u,formatPlaceholder:c,disabled:s,title:r,validityStyles:N,validationMessage:E,required:O,min:m,max:f,minTime:S,maxTime:y,name:v,tabIndex:this.show?-1:a,valid:this.validity.valid,value:this.value,onChange:this.handleValueChange,steps:this.props.steps,label:void 0,placeholder:this.state.focused?null:this.props.placeholder,ariaExpanded:this.show,size:null,fillMode:null,rounded:null},V=o.createElement(d.AsyncFocusBlur,{onFocus:this.handleFocus,onBlur:this.handleBlur,onSyncFocus:this.props.onFocus,onSyncBlur:this.props.onBlur},({onFocus:_,onBlur:tt})=>o.createElement(o.Fragment,null,o.createElement("div",{ref:X=>{this._element=X},className:d.classNames("k-input","k-datetimepicker",{[`k-input-${d.kendoThemeMaps.sizeMap[i]||i}`]:i,[`k-rounded-${d.kendoThemeMaps.roundedMap[t]||t}`]:t,[`k-input-${e}`]:e,"k-invalid":!F,"k-required":this.required,"k-disabled":this.props.disabled},g),onKeyDown:this.handleKeyDown,style:{width:w},onFocus:this.mobileMode?void 0:_,onBlur:tt,onClick:this.mobileMode?this.handleDateIconClick:void 0},o.createElement(this.dateInputComp,{_ref:this._dateInput,ariaRole:"combobox",ariaControls:this._popupId,readonly:this.mobileMode,...U}),o.createElement(L.Button,{tabIndex:-1,type:"button",icon:"calendar",svgIcon:J.calendarIcon,onMouseDown:this.handleIconMouseDown,onClick:this.mobileMode?void 0:this.handleDateIconClick,title:x.provideLocalizationService(this).toLanguageString(Dt,k[Dt]),className:"k-input-button",rounded:null,"aria-label":x.provideLocalizationService(this).toLanguageString(Dt,k[Dt])}),o.createElement(M,{show:this.show,animate:this.element!==null,anchor:this.element,popupClass:"k-datetime-container k-reset",id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"}},!this.mobileMode&&this.renderPicker())),this.mobileMode&&this.renderAdaptivePopup()));return this.props.label?o.createElement(ye,{dateInput:this._dateInput,label:this.props.label,editorId:h,editorValid:F,editorDisabled:this.props.disabled,children:V,style:{width:this.props.width}}):V}setShow(i){const{onOpen:t,onClose:e}=this.props;this.show!==i&&(this.setState({show:i}),i&&t&&t.call(void 0,{target:this}),!i&&e&&e.call(void 0,{target:this}))}nextTick(i){clearTimeout(this.nextTickId),this.nextTickId=window.setTimeout(()=>i())}calculateMedia(i){for(const t of i)this.setState({windowWidth:t.target.clientWidth})}};let yt=P;yt.displayName="DateTimePicker",yt.propTypes={className:n.string,defaultShow:n.bool,defaultValue:n.instanceOf(Date),disabled:n.bool,focusedDate:n.instanceOf(Date),format:n.oneOfType([n.string,n.shape({skeleton:n.string,pattern:n.string,date:n.oneOf(["short","medium","long","full"]),time:n.oneOf(["short","medium","long","full"]),datetime:n.oneOf(["short","medium","long","full"]),era:n.oneOf(["narrow","short","long"]),year:n.oneOf(["numeric","2-digit"]),month:n.oneOf(["numeric","2-digit","narrow","short","long"]),day:n.oneOf(["numeric","2-digit"]),weekday:n.oneOf(["narrow","short","long"]),hour:n.oneOf(["numeric","2-digit"]),hour12:n.bool,minute:n.oneOf(["numeric","2-digit"]),second:n.oneOf(["numeric","2-digit"]),timeZoneName:n.oneOf(["short","long"])})]),formatPlaceholder:n.oneOfType([n.oneOf(["wide","narrow","short","formatPattern"]),n.shape({year:n.string,month:n.string,day:n.string,hour:n.string,minute:n.string,second:n.string})]),id:n.string,ariaLabelledBy:n.string,ariaDescribedBy:n.string,min:n.instanceOf(Date),max:n.instanceOf(Date),name:n.string,popupSettings:n.shape({animate:n.bool,appendTo:n.any,popupClass:n.string}),show:n.bool,tabIndex:n.number,title:n.string,value:n.instanceOf(Date),weekNumber:n.bool,width:n.oneOfType([n.number,n.string]),validationMessage:n.string,required:n.bool,validate:n.bool,valid:n.bool,cancelButton:n.bool,size:n.oneOf([null,"small","medium","large"]),rounded:n.oneOf([null,"small","medium","large","full"]),fillMode:n.oneOf([null,"solid","flat","outline"])},yt.defaultProps={defaultShow:!1,defaultValue:null,disabled:!1,format:"g",max:st,min:it,popupSettings:{},tabIndex:0,weekNumber:!1,required:!1,validityStyles:!0,cancelButton:!0,dateInput:ot,size:"medium",rounded:"medium",fillMode:"solid"};const Yi=d.createPropsContext(),$i=d.withIdHOC(d.withPropsContext(Yi,yt));$i.displayName="KendoReactDateTimePicker",x.registerForLocalization(yt),p.Action=D,p.BusViewService=de,p.Calendar=te,p.CalendarCell=$e,p.CalendarHeaderTitle=ai,p.CalendarNavigationItem=li,p.CalendarPropsContext=ci,p.CalendarViewEnum=C,p.CalendarWeekCell=Te,p.CalendarWithoutContext=rt,p.CenturyViewService=Xe,p.DOMService=ti,p.DateInput=ot,p.DateInputPropsContext=pi,p.DateInputWithoutContext=lt,p.DatePicker=bi,p.DatePickerPropsContext=wi,p.DatePickerWithoutContext=xt,p.DateRangePicker=Ui,p.DateRangePickerPropsContext=Ki,p.DateRangePickerWithoutContext=Nt,p.DateTimePicker=$i,p.DateTimePickerPropsContext=Yi,p.DateTimePickerWithoutContext=yt,p.DayPeriodService=Si,p.DecadeViewService=Je,p.EMPTY_SELECTIONRANGE=q,p.Header=vt,p.HorizontalViewList=Ot,p.HoursService=Ci,p.MAX_DATE=st,p.MAX_TIME=nt,p.MIN_DATE=it,p.MIN_TIME=ct,p.MinutesService=ki,p.MonthViewService=Qe,p.MultiViewCalendar=We,p.MultiViewCalendarPropsContext=Wi,p.MultiViewCalendarWithoutContext=Q,p.NavigationService=me,p.PickerWrap=gi,p.ScrollSyncService=ei,p.SecondsService=_i,p.TimeList=qt,p.TimePart=mt,p.TimePicker=Hi,p.TimePickerPropsContext=Ai,p.TimePickerWithoutContext=Vt,p.TimeSelector=Et,p.TodayCommand=It,p.ToggleButton=fi,p.ViewList=zt,p.Virtualization=gt,p.WeekNamesService=ii,p.YearViewService=Pe,p.dateInputsMessages=k,p.decreaseValue=bt,p.end=Xt,p.getNow=ut,p.getToday=z,p.increaseValue=wt,p.separator=Jt,p.start=Gt,p.swapStartEnd=St,p.today=jt,p.toggleCalendar=Zt,p.toggleDateTimeSelector=Dt,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
|