@progress/kendo-ui
Version:
This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.
2 lines • 54.6 kB
JavaScript
/* @license */
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`kendo.core.min.js`),require(`kendo.label.min.js`),require(`kendo.icons.min.js`)):typeof define==`function`&&define.amd?define([`exports`,`kendo.core.min`,`kendo.label.min`,`kendo.icons.min`],t):(e=typeof globalThis<`u`?globalThis:e||self,t((e.kendo=e.kendo||{},e.kendo._globals=e.kendo._globals||{},e.kendo._globals.Dateinput={}),e.kendo._globals.Core,e.kendo._globals.Label,e.kendo._globals.Icons))})(this,function(e,t,n,r){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});let i=e=>e?new Date(e.getTime()):null,a=(e,t)=>{let n=i(e);return t===0&&n.getHours()===23&&n.setHours(n.getHours()+2),n},o=(e,t)=>{let n=i(e);return n.setDate(n.getDate()+t),a(n,e.getHours())},s=(e,t,n,r=0,i=0,o=0,s=0)=>{let c=new Date(e,t,n,r,i,o,s);return e>-1&&e<100&&c.setFullYear(c.getFullYear()-1900),a(c,r)},c=e=>o(s(e.getFullYear(),e.getMonth()+1,1,e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),-1),l=(e,t)=>e.getMonth()===t?e:c(u(e,-1)),u=(e,t)=>{let n=i(e),r=(12+(n.getMonth()+t)%12)%12;return n.setMonth(n.getMonth()+t),l(a(n,e.getHours()),r)};var d;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(d||={});var f;(function(e){e[e.Sunday=0]=`Sunday`,e[e.Monday=1]=`Monday`,e[e.Tuesday=2]=`Tuesday`,e[e.Wednesday=3]=`Wednesday`,e[e.Thursday=4]=`Thursday`,e[e.Friday=5]=`Friday`,e[e.Saturday=6]=`Saturday`})(f||={});let p=e=>s(e.getFullYear(),e.getMonth(),e.getDate(),0,0,0),m=(e,t)=>!e&&!t?!0:e&&t&&e.getTime()===t.getTime();new Date().getTime(),Symbol.toPrimitive;var h=class{constructor(){this.symbols=``,this.partMap=[]}};let g={formatSeparator:`_`,twoDigitYearMax:68,defaultDateFormat:`d`,defaultLocaleId:`en`},_={DELETE:`Delete`,BACKSPACE:`Backspace`,TAB:`Tab`,ENTER:`Enter`,ESCAPE:`Escape`,ARROW_LEFT:`ArrowLeft`,ARROW_UP:`ArrowUp`,ARROW_RIGHT:`ArrowRight`,ARROW_DOWN:`ArrowDown`,SPACE:` `,END:`End`,HOME:`Home`,PAGE_UP:`PageUp`,PAGE_DOWN:`PageDown`},v=e=>Array(Math.max(e,0)).fill(`0`).join(``),y=e=>e.replace(/^0*/,``),b=({oldText:e,newText:t,formatPattern:n,selectionStart:r,isInCaretMode:i,keyEvent:a})=>{let o=r+e.length-t.length,s=e[o],c=e.substring(0,o),l=t.substring(0,r),u=[];if(c===l&&r>0)return u.push([n[r-1],l[r-1]]),u;if(c.indexOf(l)===0&&i&&(a.key===_.DELETE||a.key===_.BACKSPACE)||c.indexOf(l)===0&&!i&&(l.length===0||n[l.length-1]!==n[l.length])){let e=``;!i&&l.length===1&&u.push([n[0],l[0]]);for(let t=l.length;t<c.length;t++)n[t]!==e&&n[t]!==g.formatSeparator&&(e=n[t],u.push([e,``]));return u}if(i&&(l.indexOf(c)===0||n[r-1]===g.formatSeparator)||!i&&(l.indexOf(c)===0||n[r-1]===g.formatSeparator)){let e=n[0];for(let t=Math.max(0,c.length-1);t<n.length;t++)if(n[t]!==g.formatSeparator){e=n[t];break}return[[e,l[r-1]]]}return l[l.length-1]===` `||l[l.length-1]===s&&n[o]===`_`?[[n[r-1],g.formatSeparator]]:[[n[r-1],l[r-1]]]},x=(e,t)=>(e[t.pattern[0]]=t.type,e),S=e=>e&&typeof e==`object`&&!Array.isArray(e),C=e=>e instanceof HTMLElement,w=e=>(t,n)=>{let r=i(t);return r[e](n),r},T=e=>e!=null,E=()=>!!document,D=e=>T(e)&&typeof e==`number`&&!Number.isNaN(e),O=e=>parseInt(e,10),k=e=>D(O(e))&&/^[0-9]+$/.test(e),A=(e,t,n)=>Math.min(n,Math.max(t,e)),j=(...e)=>Object.assign(...e),M=(e,...t)=>{if(!t.length)return e;let n=t.shift();if(S(e)&&S(n))for(let t in n)!Object.prototype.hasOwnProperty.call(n,t)||t===`__proto__`||t===`constructor`||t===`prototype`||(C(n[t])?e[t]=n[t]:S(n[t])&&!(n[t]instanceof Date)?((!e[t]||!S(e[t]))&&j(e,{[t]:{}}),M(e[t],n[t])):j(e,{[t]:n[t]}));return M(e,...t)},N=e=>typeof e==`function`,P=e=>!T(e)||isNaN(e.getTime())?0:Number(e.getFullYear().toString().slice(-2)),F=w(`setFullYear`),I=e=>{let t=e&&e.match(/S+(\1)/);return t?t[0].length:0},L=e=>10**(3-e),R=(e,t,n,r,i,a,o,s)=>!!(e&&e.getFullYear()===t&&e.getMonth()===n&&e.getDate()===r&&e.getHours()===i&&e.getMinutes()===a&&e.getSeconds()===o&&e.getMilliseconds()===s),z=e=>T(e)&&e.getTime&&D(e.getTime()),B=()=>/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/Macintosh/i.test(navigator.userAgent),V=2e3,H=/d|M|H|h|m|s/;var ee=class{set value(e){e&&!(e instanceof Date)||(this._value=e,this.resetInvalidDate())}get value(){return this._value}get localeId(){let e=g.defaultLocaleId,t=Object.keys(this.intl.cldr);for(let n=0;n<t.length;n++){let r=t[n],i=this.intl.cldr[r];if(i.name&&i.calendar&&i.numbers&&i.name!==g.defaultLocaleId){e=i.name;break}}return e}constructor({intlService:e,formatPlaceholder:t,format:n,cycleTime:r=!1,twoDigitYearMax:a=g.twoDigitYearMax,value:o=null,autoCorrectParts:s=!0,toggleDayPeriod:c=!1,autoSwitchParts:l=!0}){if(this.year=!0,this.month=!0,this.date=!0,this.hours=!0,this.minutes=!0,this.seconds=!0,this.milliseconds=!0,this.dayperiod=!0,this.leadingZero=null,this.typedMonthPart=``,this.knownParts=`adHhmMsEyS`,this.symbols={E:`E`,H:`H`,M:`M`,a:`a`,d:`d`,h:`h`,m:`m`,s:`s`,y:`y`,S:`S`},this._value=this.getDefaultDate(),this.cycleTime=!1,this._partiallyInvalidDate={startDate:null,invalidDateParts:{E:{value:null,date:null,startDateOffset:0},H:{value:null,date:null,startDateOffset:0},M:{value:null,date:null,startDateOffset:0},a:{value:null,date:null,startDateOffset:0},d:{value:null,date:null,startDateOffset:0},h:{value:null,date:null,startDateOffset:0},m:{value:null,date:null,startDateOffset:0},s:{value:null,date:null,startDateOffset:0},y:{value:null,date:null,startDateOffset:0},S:{value:null,date:null,startDateOffset:0}}},this.setOptions({intlService:e,formatPlaceholder:t,format:n,cycleTime:r,twoDigitYearMax:a,value:o,autoCorrectParts:s,toggleDayPeriod:c,autoSwitchParts:l}),o)this._value=i(o);else{this._value=this.getDefaultDate();let e=this.dateFormatString(this.value,this.format).symbols;for(let t=0;t<e.length;t++)this.setExisting(e[t],!1)}}setOptions(e){this.intl=e.intlService,this.formatPlaceholder=e.formatPlaceholder||`wide`,this.format=e.format,this.cycleTime=e.cycleTime,this.monthNames=this.allFormattedMonths(this.localeId),this.dayPeriods=this.allDayPeriods(this.localeId),this.twoDigitYearMax=e.twoDigitYearMax,this.autoCorrectParts=e.autoCorrectParts,this.toggleDayPeriod=e.toggleDayPeriod,this.autoSwitchParts=e.autoSwitchParts}setValue(e){e?m(e,this._value)?m(e,this._value)&&this.dayPeriods&&this.setExisting(`a`,!0):(this._value=i(e),this.modifyExisting(!0)):(this._value=this.getDefaultDate(),this.modifyExisting(!1)),this.resetInvalidDate()}hasValue(){return this.intl.splitDateFormat(this.format,this.localeId).reduce((e,t)=>e||t.type!==`literal`&&t.type!==`dayperiod`&&this.getExisting(t.pattern[0]),!1)}getValue(){for(let e=0;e<this.knownParts.length;e++)if(!this.getExisting(this.knownParts[e]))return null;return i(this.value)}createDefaultDate(){return s(V,0,31)}getDefaultDate(){return p(this.createDefaultDate())}getFormattedDate(e){return this.intl.formatDate(this.getValue(),e,this.localeId)}getTextAndFormat(e=``){let t=e||this.format,n=this.intl.formatDate(this.value,t,this.localeId),r=this.dateFormatString(this.value,t);if(!this.autoCorrectParts&&this._partiallyInvalidDate.startDate){let e=``,i=this.intl.formatDate(this.value,t,this.localeId),a=this.getFormattedInvalidDates(t);for(let t=0;t<i.length;t++){let i=r.symbols[t];if(r.partMap[t].type===`literal`)e+=n[t];else if(this.getInvalidDatePartValue(i)){let n=this.getPartsForSegment(r,t);if(i===`M`){let r=(O(this.getInvalidDatePartValue(i))+1).toString();if(n.length>2)e+=a[i][t];else if(this.getInvalidDatePartValue(i)){let i=v(n.length-r.length)+r;e+=i,t+=n.length-1}else e+=a[i][t]}else if(this.getInvalidDatePartValue(i)){let r=this.getInvalidDatePartValue(i).toString(),a=v(n.length-r.length)+r;e+=a,t+=n.length-1}else e+=a[i][t]}else e+=n[t]}n=e}return this.merge(n,r)}getFormattedInvalidDates(e=``){let t=e||this.format,n={E:``,H:``,M:``,a:``,d:``,h:``,m:``,s:``,y:``,S:``};return Object.keys(this._partiallyInvalidDate.invalidDateParts).forEach(e=>{let r=this.getInvalidDatePart(e).date;r&&(n[e]=this.intl.formatDate(r,t,this.localeId))}),n}modifyExisting(e){let t=this.dateFormatString(this.value,this.format).symbols;for(let n=0;n<t.length;n++)this.setExisting(t[n],e)}getExisting(e){switch(e){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`t`:case`a`:return this.dayperiod;case`m`:return this.minutes;case`s`:return this.seconds;case`S`:return this.milliseconds;default:return!0}}setExisting(e,t){switch(e){case`y`:this.year=t,t===!1&&this._value.setFullYear(V);break;case`M`:this.month=t,t===!1&&this.autoCorrectParts&&this._value.setMonth(0);break;case`d`:this.date=t;break;case`h`:case`H`:this.hours=t;break;case`t`:case`a`:this.dayperiod=t;break;case`m`:this.minutes=t;break;case`s`:this.seconds=t;break;case`S`:this.milliseconds=t;break;default:break}this.getValue()&&this.resetInvalidDate()}modifyPart(e,t){if(!T(e)||!T(t)||t===0)return;let n=i(this.value),r=!1,a,o=e===`M`,c=e===`d`||e===`E`,l=this.getExisting(e);if(!this.autoCorrectParts&&(c||o)){let r=this._partiallyInvalidDate.invalidDateParts||{},u=this.getInvalidDatePartValue(e),d=r.y.value||n.getFullYear(),f=r.M.value||n.getMonth(),p=r.d.value||r.E.value||n.getDate(),m=r.h.value||r.H.value||n.getHours(),h=r.m.value||n.getMinutes(),g=r.s.value||n.getSeconds(),_=r.S.value||n.getMilliseconds();switch(e){case`y`:d+=t;break;case`M`:f+=t;break;case`d`:case`E`:p+=t;break;default:break}if(e===`M`){if((f<0||f>11)&&l){this.setExisting(e,!1),this.resetInvalidDateSymbol(e);return}l||(f=A(f<0?11+(f%11+1):T(u)?f:(t-1)%12,0,11),f=A(f,0,11)),f=A(f,0,11)}else if(e===`d`){if(l){if(p<=0||p>31){this.setExisting(e,!1),this.resetInvalidDateSymbol(e);return}}else if(!l){if(T(u)&&(p<=0||p>31)){this.setExisting(e,!1),this.resetInvalidDateSymbol(e);return}p=A(t<0?T(u)?p:1+(31-Math.abs(t%31)):T(u)?p:t%31,1,31),p=A(p,1,31)}}let v=s(d,f,p,m,h,g,_),y=o||c?this.modifyDateSymbolWithValue(n,e,o?f:p):null,b=R(v,d,f,p,m,h,g,_);this.getValue()&&R(v,d,f,p,m,h,g,_)?(n=i(v),this.markDatePartsAsExisting()):o&&y?y.getMonth()===f?this.getExisting(`d`)?b?(n=i(v),this.resetInvalidDateSymbol(e)):(a=!0,this.setInvalidDatePart(e,{value:f,date:i(y),startDateOffset:t,startDate:i(this.value)}),this.setExisting(e,!1)):b?(this.resetInvalidDateSymbol(e),n=i(v),this.getExisting(`M`)&&this.getExisting(`y`)&&(this.setExisting(`d`,!0),this.resetInvalidDateSymbol(`d`))):(this.resetInvalidDateSymbol(e),n=i(y)):(a=!0,this.setInvalidDatePart(e,{value:f,date:i(y),startDateOffset:t,startDate:i(this.value)}),this.setExisting(e,!1)):c&&y&&(y.getDate()===p?this.getExisting(`M`)?b?(n=i(v),this.resetInvalidDateSymbol(e)):(a=!0,this.setInvalidDatePart(e,{value:p,date:i(y),startDateOffset:t,startDate:i(this.value)}),this.setExisting(e,!1)):b?(n=i(v),this.resetInvalidDateSymbol(e),this.getExisting(`d`)&&this.getExisting(`y`)&&(this.setExisting(`M`,!0),this.resetInvalidDateSymbol(`M`))):(this.resetInvalidDateSymbol(e),n=i(y)):(a=!0,this.setInvalidDatePart(e,{value:p,date:i(this.value),startDateOffset:t,startDate:i(this.value)}),this.setExisting(e,!1)))}else{let i=n.getHours();switch(e){case`y`:n.setFullYear(n.getFullYear()+t);break;case`M`:n=u(this.value,t);break;case`d`:case`E`:n.setDate(n.getDate()+t);break;case`h`:case`H`:n.setHours(n.getHours()+t),r=!0;break;case`m`:n.setMinutes(n.getMinutes()+t),r=!0;break;case`s`:n.setSeconds(n.getSeconds()+t),r=!0;break;case`S`:n.setMilliseconds(n.getMilliseconds()+t);break;case`a`:this.toggleDayPeriod?n.setHours(i>=12?i-12:i+12):n.setHours(n.getHours()+12*t),r=!0;break;default:break}}this.shouldNormalizeCentury()&&(n=this.normalizeCentury(n)),r&&!this.cycleTime&&(n.getDate(),this._value.getDate()),a||(this.setExisting(e,!0),this._value=n,this.getValue()&&this.resetInvalidDate())}parsePart({symbol:e,currentChar:t,resetSegmentValue:n,cycleSegmentValue:r,rawTextValue:a,isDeleting:o,originalFormat:l}){let d=!r,f=this.dateFormatString(this.value,this.format),p=f.partMap.filter(e=>e.type===`literal`).map((e,t)=>({datePartIndex:t,type:e.type,pattern:e.pattern,literal:``})),m=f.partMap.map(e=>({type:e.type,pattern:e.pattern,text:``}));for(let e=0;e<p.length;e++){let t=p[e];for(let n=0;n<t.pattern.length;n++)p[e+n]&&(p[e+n].literal=t.pattern[n]);e+=t.pattern.length-1}for(let e=0;e<m.length;e++){let t=m[e];for(let n=0;n<t.pattern.length;n++)m[e+n]&&(m[e+n].text=t.pattern[n]);e+=t.pattern.length-1}let h={value:null,switchToNext:!1,resetPart:d&&e===`M`&&f.partMap.filter(e=>e.type===`month`).some(e=>e.pattern.length>2),hasInvalidDatePart:!1};if(!t)if(d)for(let t=0;t<p.length;t++){let n=p[t].literal,r=a.startsWith(n),i=a.endsWith(n),o=a.indexOf(n+n)>=0;if(r||i||o)return this.resetLeadingZero(),this.setExisting(e,!1),this.resetInvalidDateSymbol(e),j(h,{value:null,switchToNext:!1})}else return this.resetLeadingZero(),this.setExisting(e,!1),this.resetInvalidDateSymbol(e),j(h,{value:null,switchToNext:!1});let g=this.intl.formatDate(this.value,this.format,this.localeId),_=f.symbols,b=!1,x=``,S=``,C=``,w=``,E=``,A=``,M=``;for(let e=0;e<m.length;e++)M+=m[e].text;let N=this.format===_||this.format===M||this.format===l||this.format.length===l.length,P=(N?M:l).indexOf(e),F=(N?M:l).lastIndexOf(e)-P+1,I=l.length-a.length;if(d||!d&&!this.autoCorrectParts){let n=0;for(let t=0;t<g.length;t++)if(_[t]===e){let r=this.getExisting(e);if(e===`y`)if(!this.hasInvalidDatePart()&&this.getExisting(`y`))S+=g[t];else{let i=this.getInvalidDatePartValue(e);T(i)?(S+=(i||``).toString()[n]||``,n++):S+=r?g[t]:`0`}else S+=r?g[t]:`0`;I>0?C.length+I<F&&(C+=a[t]||``):C+=a[t]||``,b=!0}else b?(A+=g[t],E+=g[t]):(x+=g[t],w+=g[t]);if(N&&(M.length<a.length?C+=t:!o&&(l.length,a.length),C.length>F))return j(h,{value:null,switchToNext:!1});if(!N||N&&!this.autoCorrectParts){S=``,C=``,x=``,A=``,b=!1;let n=0;for(let t=0;t<l.length;t++)if(l[t]===e){let r=this.getExisting(e);if(e===`y`)if(!this.hasInvalidDatePart()&&this.getExisting(`y`))S+=g[t];else{let i=this.getInvalidDatePartValue(e);T(i)?(S+=(i||``).toString()[n]||``,n++):S+=r?g[t]:`0`}else S+=r?g[t]||``:`0`;I>0?C.length+I<F&&(C+=a[t]||``):C+=a[t]||``,b=!0}else b?A+=a[t-I]||``:x+=a[t]||``;l.length<a.length&&(C+=t)}}if(!d)if(this.autoCorrectParts){S=``,C=``,x=``,A=``,b=!1;for(let t=0;t<g.length;t++)if(_[t]===e){let n=this.getExisting(e);S+=n?g[t]:`0`,b=!0}else b?A+=g[t]:x+=g[t]}else S=n?C:S;let L=null,{monthName:B,matchesCount:V}=this.matchMonth(t),H=this.matchDayPeriod(t,e),ee=t===`0`,U=this.leadingZero||{};ee?(C===`0`&&(C=S),O(n?t:(d?C:S)+t)===0&&!this.isAbbrMonth(f.partMap,e)&&e!==`a`&&this.incrementLeadingZero(e)):this.resetLeadingZero();let te=this.partPattern(f.partMap,e),W=te?te.pattern:null,G=this.patternLength(W)||(W?W.length:0);if(d&&o&&!C)return this.setExisting(e,!1),j(h,{value:null,switchToNext:!1});let ne=S.length-3,K=!0,q=d?C:S;for(let r=Math.max(0,ne);r<=S.length&&K;r++){q=n?t:d?C:S.substring(r)+t,this.autoSwitchParts&&e===`h`&&S.substring(r)===`12`&&(q=q.replace(`12`,`0`)),(d||!this.autoCorrectParts)&&(K=!1,q=y(q),q=v(G-q.length)+q);let a=parseInt(q,10),l=x+q+A;L=this.intl.parseDate(l,this.format,this.localeId),L&&this.value&&f.partMap.every(e=>e.type!==`year`&&e.type!==`month`&&e.type!=`day`)&&(L.setFullYear(this.value.getFullYear()),L.setMonth(this.value.getMonth()),L.setDate(this.value.getDate()));let p=!1;d&&!z(L)&&this.autoCorrectParts&&(L=this.intl.parseDate(w+q+E,this.format,this.localeId),p=!0);let m=!isNaN(parseInt(t,10))||d&&o&&t===``;if(!L&&!isNaN(a)&&m&&this.autoCorrectParts){if(e===`M`&&!B){let e=a-1;e>-1&&e<12&&(L=i(this.value),L.setMonth(e),L.getMonth()!==e&&(L=c(u(L,-1))))}e===`y`&&(L=s(parseInt(q,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),(d&&z(L)||!d&&L)&&this.date&&L.getDate()!==this.value.getDate()&&(L=c(u(L,-1))))}if(d&&z(L)||!d&&L){let t=this.isPeekDateOverflowingDatePart({useBasePrefixAndSuffix:p,middle:q,patternValue:W,basePrefix:w,baseSuffix:E,prefix:x,suffix:A,symbol:e,patternLength:G,leadingZero:U}),n=t.switchToNext;return this.shouldNormalizeCentury()&&(L=this.normalizeCentury(L)),e===`H`&&L.getHours()>=12&&this.setExisting(`a`,!0),this._value=L,this.setExisting(e,!0),this.resetInvalidDateSymbol(e),this.autoCorrectParts||(e===`M`?this.getExisting(`M`)&&this.getExisting(`y`)&&(this.setExisting(`d`,!0),this.resetInvalidDateSymbol(`d`)):e===`d`?this.getExisting(`d`)&&this.getExisting(`y`)&&(this.setExisting(`M`,!0),this.resetInvalidDateSymbol(`M`)):e===`y`&&this.markDatePartsAsExisting(),this.hasInvalidDatePart()||(this.markDatePartsAsExisting(),!t.peekedDate&&t.switchToNext&&!this.autoCorrectParts&&(e===`M`||e===`d`&&t.parsedPeekedValue===30&&this.value.getMonth()===1&&(n=!1)))),j(h,{value:this.value,switchToNext:n})}}if(B&&(L=this.intl.parseDate(x+B+A,this.format,this.localeId),L))return this._value=L,this.setExisting(e,!0),j(h,{value:this.value,switchToNext:V===1});if(H&&(L=this.intl.parseDate(x+H+A,this.format)||this.intl.parseDate(w+H+E,this.format),L))return this._value=L,this.setExisting(e,!0),j(h,{value:this.value,switchToNext:!0});if(ee&&e!==`a`&&this.setExisting(e,!1),!this.autoCorrectParts){let n,r=d?C:q,a=O(r);if(D(a)&&k(r)){if(e===`d`&&(a<=0||a>31)||e===`M`&&(a<=0||a>11)){if(d)return j(h,{value:null,switchToNext:!1});r=t,a=O(r)}if(!D(a)||!k(r))return j(h,{value:null,switchToNext:!1});n=e===`M`?a-1:a;let o=e===`y`,c=e===`M`,l=e===`d`,u=i(this._value),f=this._partiallyInvalidDate.invalidDateParts||{},p=o?n:f.y.value||u.getFullYear(),m=c?n:f.M.value||u.getMonth(),g=l?n:f.d.value||f.E.value||u.getDate(),_=f.h.value||f.H.value||u.getHours(),v=f.m.value||u.getMinutes(),y=f.s.value||u.getSeconds(),b=f.S.value||u.getMilliseconds(),S=s(p,m,g,_,v,y,b),C=R(S,p,m,g,_,v,y,b),T=o||c||l?this.modifyDateSymbolWithValue(u,e,o?p:c?m:g):null,M=!1;if(c&&T?T.getMonth()===m?this.getExisting(`d`)?C?(u=i(S),this.resetInvalidDateSymbol(e)):(M=!0,this.setInvalidDatePart(e,{value:m,date:i(T),startDate:i(this.value)}),this.setExisting(e,!1)):C?(this.resetInvalidDateSymbol(e),u=i(S),this.getExisting(`M`)&&this.getExisting(`y`)&&(this.setExisting(`d`,!0),this.resetInvalidDateSymbol(`d`))):(this.resetInvalidDateSymbol(e),u=i(T)):(M=!0,this.setInvalidDatePart(e,{value:m,date:i(T),startDate:i(this.value)}),this.setExisting(e,!1)):l&&T?T.getDate()===g?this.getExisting(`M`)?C?(u=i(S),this.resetInvalidDateSymbol(e)):(M=!0,this.setInvalidDatePart(e,{value:g,date:i(T),startDate:i(this.value)}),this.setExisting(e,!1)):C?(u=i(S),this.resetInvalidDateSymbol(e),this.getExisting(`d`)&&this.getExisting(`y`)&&(this.setExisting(`M`,!0),this.resetInvalidDateSymbol(`M`))):(this.resetInvalidDateSymbol(e),u=i(T)):(M=!0,this.setInvalidDatePart(e,{value:g,date:i(this.value),startDate:i(this.value)}),this.setExisting(e,!1)):o&&T&&(T.getFullYear()===p?this.getExisting(`d`)&&this.getExisting(`M`)?C?(u=i(S),this.resetInvalidDateSymbol(e)):(M=!0,this.setInvalidDatePart(e,{value:p,date:i(T),startDate:i(this.value)}),this.setExisting(e,!1)):C?(this.resetInvalidDateSymbol(e),u=i(S),this.getExisting(`M`)&&this.getExisting(`d`)&&(this.setExisting(`y`,!0),this.resetInvalidDateSymbol(`y`))):(this.resetInvalidDateSymbol(e),u=i(T)):(M=!0,this.setInvalidDatePart(e,{value:p,date:i(T),startDate:i(this.value)}),this.setExisting(e,!1))),!M){if(this.setExisting(e,!0),d&&!z(L)){let e=this.intl.parseDate(w+q+E,this.format,this.localeId);z(e)&&(this._value=e)}else this._value=u;this.getValue()&&this.resetInvalidDate()}let P=!1;return P=e===`M`?a>=2||r.length>=2:N?this.isPeekDateOverflowingDatePart({useBasePrefixAndSuffix:!this.autoCorrectParts,middle:q,patternValue:W,basePrefix:w,baseSuffix:E,prefix:x,suffix:A,symbol:e,patternLength:G,leadingZero:U}).switchToNext:r.length>F,j(h,{value:null,switchToNext:P,hasInvalidDatePart:M})}}return j(h,{value:null,switchToNext:!1})}symbolMap(e){return this.intl.splitDateFormat(this.format,this.localeId).reduce(x,{})[e]}resetLeadingZero(){let e=this.leadingZero!==null;return this.setLeadingZero(null),e}setLeadingZero(e){this.leadingZero=e}getLeadingZero(){return this.leadingZero||{}}normalizeCentury(e){if(!T(e))return e;let t=P(e);return F(e,this.getNormalizedCenturyBase(t)+t)}incrementLeadingZero(e){let t=this.leadingZero||{};t[e]=(t[e]||0)+1,this.leadingZero=t}isAbbrMonth(e,t){let n=this.partPattern(e,t);return n.type===`month`&&n.names}partPattern(e,t){return e.filter(e=>e.pattern.indexOf(t)!==-1)[0]}peek(e,t){if(!t)return e;let n=e.replace(/^0*/,``)+`0`;return v(t.length-n.length)+n}matchMonth(e){if(this.typedMonthPart+=e.toLowerCase(),this.monthNames.length===0)return{monthName:``,matchesCount:0};for(;this.typedMonthPart.length>0;){let e=[];for(let t=0;t<this.monthNames.length;t++)this.monthNames[t].toLowerCase().startsWith(this.typedMonthPart)&&e.push(this.monthNames[t]);if(e.length>0)return{monthName:e[0],matchesCount:e.length};let t=parseInt(this.typedMonthPart,10);if(t>=1&&t<=12&&t.toString().startsWith(this.typedMonthPart)){let e=[1,2,3,4,5,6,7,8,9,10,11,12].reduce((e,t)=>t.toString().startsWith(this.typedMonthPart)?e+1:e,0);return{monthName:this.monthNames[t-1],matchesCount:e}}this.typedMonthPart=this.typedMonthPart.substring(1,this.typedMonthPart.length)}return{monthName:``,matchesCount:0}}matchDayPeriod(e,t){let n=e.toLowerCase();if(t===`a`&&this.dayPeriods){if(this.dayPeriods.am.toLowerCase().startsWith(n))return this.dayPeriods.am;if(this.dayPeriods.pm.toLowerCase().startsWith(n))return this.dayPeriods.pm}return``}allFormattedMonths(e=`en`){let t=this.intl.splitDateFormat(this.format,this.localeId);for(let n=0;n<t.length;n++)if(t[n].type===`month`&&t[n].names)return this.intl.dateFormatNames(e,t[n].names);return[]}allDayPeriods(e=`en`){let t=this.intl.splitDateFormat(this.format);for(let n=0;n<t.length;n++)if(t[n].type===`dayperiod`&&t[n].names)return this.intl.dateFormatNames(e,t[n].names);return null}patternLength(e){return e?e[0]===`y`?4:H.test(e)?2:0:0}dateFormatString(e,t){let n=this.intl.splitDateFormat(t,this.localeId),r=[],i=[];for(let t=0;t<n.length;t++){let a=this.intl.formatDate(e,{pattern:n[t].pattern},this.localeId).length;for(;a>0;)r.push(this.symbols[n[t].pattern[0]]||g.formatSeparator),i.push(n[t]),a--}let a=new h;return a.symbols=r.join(``),a.partMap=i,a}merge(e,t){let n=``,r=``,i=t.symbols,a=!1,o=0,s=this.getFormattedInvalidDates(i);for(let c=i.length-1;c>=0;c--){let l=this.getPartsForSegment(t,c);if(this.knownParts.indexOf(i[c])===-1||this.getExisting(i[c]))this.autoCorrectParts||e.length===i.length||a?n=e[c]+n:o>0?(n=e[c]+n,o--,o<=0&&(a=!0)):n=(e[c+e.length-i.length]||``)+n,r=i[c]+r;else{let a=i[c],u=0;if(this.autoCorrectParts||!this.autoCorrectParts&&!this.getInvalidDatePartValue(a)){for(;c>=0&&a===i[c];)c--;c++}if(this.leadingZero&&this.leadingZero[a])n=`0`+n;else if(!this.autoCorrectParts&&this.getInvalidDatePartValue(a)){let e=this.getInvalidDatePartValue(a).toString();a===`M`?(e=(O(this.getInvalidDatePartValue(a))+1).toString(),l.length>2?n=s[a][c]+n:(e=(O(this.getInvalidDatePartValue(a))+1).toString(),n=v(l.length-e.length)+e+n,u=l.length-1,o=e.length-l.length)):(n=v(l.length-e.length)+e+n,u=l.length-1,o=e.length-l.length)}else n=this.dateFieldName(t.partMap[c])+n;for(;r.length<n.length;)r=i[c]+r;u!==0&&(c=c-u+(e.length-i.length))}}return{text:n,format:r}}dateFieldName(e){let t=this.formatPlaceholder||`wide`;return t[e.type]?t[e.type]:t===`formatPattern`?e.pattern:this.intl.dateFieldName(Object.assign(e,{nameType:t}))}getNormalizedCenturyBase(e){return e>this.twoDigitYearMax?1900:2e3}shouldNormalizeCentury(){return this.intl.splitDateFormat(this.format).some(e=>e.pattern===`yy`)}resetInvalidDate(){this._partiallyInvalidDate.startDate=null,Object.keys(this._partiallyInvalidDate.invalidDateParts).forEach(e=>{this.resetInvalidDatePart(e)})}resetInvalidDateSymbol(e){this.resetInvalidDatePart(e);let t=!0;Object.keys(this._partiallyInvalidDate.invalidDateParts).forEach(e=>{this._partiallyInvalidDate.invalidDateParts[e]&&T(this._partiallyInvalidDate.invalidDateParts[e].value)&&(t=!1)}),t&&this.resetInvalidDate()}resetInvalidDatePart(e){this._partiallyInvalidDate.invalidDateParts[e]&&(this._partiallyInvalidDate.invalidDateParts[e]={value:null,date:null,startDateOffset:0})}getInvalidDatePart(e){return this._partiallyInvalidDate.invalidDateParts[e]||{}}getInvalidDatePartValue(e){return(this._partiallyInvalidDate.invalidDateParts[e]||{}).value}setInvalidDatePart(e,{value:t=null,date:n=null,startDateOffset:r=0,startDate:i=null}){this._partiallyInvalidDate.invalidDateParts[e]&&(this._partiallyInvalidDate.invalidDateParts[e].value=t,this._partiallyInvalidDate.invalidDateParts[e].date=n,this._partiallyInvalidDate.invalidDateParts[e].startDateOffset=r,this._partiallyInvalidDate.startDate=i)}hasInvalidDatePart(){let e=!1;return Object.keys(this._partiallyInvalidDate.invalidDateParts).forEach(t=>{this._partiallyInvalidDate.invalidDateParts[t]&&T(this._partiallyInvalidDate.invalidDateParts[t].value)&&(e=!0)}),e}modifyDateSymbolWithOffset(e,t,n){let r=i(e),a=!1;switch(t){case`y`:r.setFullYear(r.getFullYear()+n);break;case`M`:r=u(this.value,n);break;case`d`:case`E`:r.setDate(r.getDate()+n);break;case`h`:case`H`:r.setHours(r.getHours()+n),a=!0;break;case`m`:r.setMinutes(r.getMinutes()+n),a=!0;break;case`s`:r.setSeconds(r.getSeconds()+n),a=!0;break;case`S`:r.setMilliseconds(r.getMilliseconds()+n);break;case`a`:r.setHours(r.getHours()+12*n),a=!0;break;default:break}return{date:r,timeModified:a}}modifyDateSymbolWithValue(e,t,n){let r=i(e);switch(t){case`y`:r.setFullYear(n);break;case`M`:r=u(e,n-e.getMonth());break;case`d`:case`E`:r.setDate(n);break;case`h`:case`H`:r.setHours(n);break;case`m`:r.setMinutes(n);break;case`s`:r.setSeconds(n);break;case`S`:r.setMilliseconds(n);break;case`a`:r.setHours(n);break;default:break}return r}markDatePartsAsExisting(){this.modifyExisting(!0)}getPartsForSegment(e,t){let n=e.partMap[t],r=[];for(let i=t;i<e.partMap.length;i++){let t=e.partMap[i];if(n.type===t.type&&n.pattern===t.pattern)r.push(t);else break}for(let i=t-1;i>=0;i--){let t=e.partMap[i];if(n.type===t.type&&n.pattern===t.pattern)r.unshift(t);else break}return r}isPeekDateOverflowingDatePart({useBasePrefixAndSuffix:e,middle:t,patternValue:n,basePrefix:r,baseSuffix:i,prefix:a,suffix:o,symbol:s,patternLength:c,leadingZero:l}){let u=this.peek(t,n),d=e?`${r}${u}${i}`:`${a}${u}${o}`,f=this.intl.parseDate(d,this.format,this.localeId),p=((this.leadingZero||{})[s]||0)+y(t).length>=c;return{peekedDate:f,peekedDateString:d,peekedValue:u,parsedPeekedValue:O(u),switchToNext:f===null||(l[s]?n.length<=t.length:p)}}};let U={BACKSPACE:8,DELETE:46,TAB:9,ENTER:13,ESCAPE:27,ARROW_LEFT:37,ARROW_UP:38,ARROW_RIGHT:39,ARROW_DOWN:40,SPACE:32,END:35,HOME:36,PAGE_UP:33,PAGE_DOWN:34},te={events:{}};var W=class{constructor(e){this.options=j({},te,e)}destroy(){this.options={}}trigger(e,t={}){let n={defaultPrevented:!1,preventDefault:()=>{n.defaultPrevented=!0}};return N(this.options.events[e])?(this.options.events[e](j(n,t,{sender:this})),n.defaultPrevented):!1}},G;(function(e){e.None=`none`,e.Caret=`caret`,e.Selection=`selection`})(G||={});let ne=`dragStart`,K=`drop`,q=`touchstart`,re=`mousedown`,ie=`mouseup`,ae=`click`,J=`input`,Y=`keydown`,X=`focus`,Z=`blur`,oe=`paste`,se=`DOMMouseScroll`,Q=`mousewheel`,ce=`valueChange`,le=`inputEnd`,ue=`blurEnd`,de=`focusEnd`,$=`change`,fe={format:`d`,hasPlaceholder:!1,placeholder:null,cycleTime:!0,locale:null,steps:{millisecond:1,second:1,minute:1,hour:1,day:1,month:1,year:1},formatPlaceholder:null,events:{[ce]:null,[J]:null,[le]:null,[X]:null,[de]:null,[Z]:null,[ue]:null,[Y]:null,[Q]:null,[$]:null},selectNearestSegmentOnFocus:!1,selectPreviousSegmentOnBackspace:!1,enableMouseWheel:!1,allowCaretMode:!1,autoSwitchParts:!0,autoSwitchKeys:[],twoDigitYearMax:g.twoDigitYearMax,autoCorrectParts:!0,autoFill:!1,toggleDayPeriod:!1};var pe=class extends W{get value(){return this.dateObject&&this.dateObject.getValue()}constructor(e,t){super(t),this.dateObject=null,this.currentText=``,this.currentFormat=``,this.interactionMode=G.None,this.previousElementSelection={start:0,end:0},this.init(e,t)}init(e,t){let n=z(this.options.value)?i(this.options.value):new Date(t.formattedValue);z(n)||(n=null),this.element=e,this.options=j({},fe,t,{steps:Object.assign(Object.assign({},fe.steps),t.steps)}),this.intl=this.options.intlService,this.dateObject=this.createDateObject(),this.dateObject.setValue(n),this.setTextAndFormat(),this.bindEvents(),this.resetSegmentValue=!0,this.interactionMode=G.None,this.forceUpdate()}destroy(){this.unbindEvents(),this.dateObject=null,super.destroy()}bindEvents(){this.onElementDragStart=this.onElementDragStart.bind(this),this.element.addEventListener(ne,this.onElementDragStart),this.onElementDrop=this.onElementDrop.bind(this),this.element.addEventListener(K,this.onElementDrop),this.onElementClick=this.onElementClick.bind(this),this.element.addEventListener(ae,this.onElementClick),this.onElementMouseDown=this.onElementMouseDown.bind(this),this.element.addEventListener(re,this.onElementMouseDown),this.element.addEventListener(q,this.onElementMouseDown),this.onElementMouseUp=this.onElementMouseUp.bind(this),this.element.addEventListener(ie,this.onElementMouseUp),this.onElementInput=this.onElementInput.bind(this),this.element.addEventListener(J,this.onElementInput),this.onElementKeyDown=this.onElementKeyDown.bind(this),this.element.addEventListener(Y,this.onElementKeyDown),this.onElementFocus=this.onElementFocus.bind(this),this.element.addEventListener(X,this.onElementFocus),this.onElementBlur=this.onElementBlur.bind(this),this.element.addEventListener(Z,this.onElementBlur),this.onElementChange=this.onElementChange.bind(this),this.element.addEventListener($,this.onElementChange),this.onElementPaste=this.onElementPaste.bind(this),this.element.addEventListener(oe,this.onElementPaste),this.onElementMouseWheel=this.onElementMouseWheel.bind(this),this.element.addEventListener(se,this.onElementMouseWheel),this.element.addEventListener(Q,this.onElementMouseWheel)}unbindEvents(){this.element.removeEventListener(ne,this.onElementDragStart),this.element.removeEventListener(K,this.onElementDrop),this.element.removeEventListener(q,this.onElementMouseDown),this.element.removeEventListener(re,this.onElementMouseDown),this.element.removeEventListener(ie,this.onElementMouseUp),this.element.removeEventListener(ae,this.onElementClick),this.element.removeEventListener(J,this.onElementInput),this.element.removeEventListener(Y,this.onElementKeyDown),this.element.removeEventListener(X,this.onElementFocus),this.element.removeEventListener(Z,this.onElementBlur),this.element.removeEventListener($,this.onElementChange),this.element.removeEventListener(oe,this.onElementPaste),this.element.removeEventListener(se,this.onElementMouseWheel),this.element.removeEventListener(Q,this.onElementMouseWheel)}setOptions(e,t=!1){this.options=j({},this.options,e,{steps:Object.assign(Object.assign({},fe.steps),e.steps)}),this.setDateObjectOptions(),t&&(this.unbindEvents(),this.init(this.element,this.options))}setDateObjectOptions(){if(this.dateObject){let e=this.getDateObjectOptions();this.dateObject.setOptions(e)}}resetLocale(){this.unbindEvents(),this.init(this.element,this.options)}isInCaretMode(){return this.interactionMode===G.Caret}focus(){this.element.focus(),this.options.selectNearestSegmentOnFocus&&this.selectNearestSegment(0)}onElementDragStart(e){e.preventDefault()}onElementDrop(e){e.preventDefault()}onElementMouseDown(){this.mouseDownStarted=!0,this.focusedPriorToMouseDown=this.isActive}onElementMouseUp(e){this.mouseDownStarted=!1,e.preventDefault()}onElementClick(e){this.mouseDownStarted=!1,this.switchedPartOnPreviousKeyAction=!1;let t=this.selection;if(this.isInCaretMode()&&this.forceUpdate(),e.detail!==3)if(this.isActive&&this.options.selectNearestSegmentOnFocus){let e=this.element.selectionStart!==this.element.selectionEnd,t=T(this.options.placeholder)&&!this.dateObject.hasValue()&&!this.focusedPriorToMouseDown,n=!e&&t?0:this.caret()[0];this.selectNearestSegment(n)}else this.setSelection(this.selectionByIndex(t.start))}onElementInput(e){this.triggerInput({event:e});let t=this.elementValue;if(!this.element||!this.dateObject)return;let n=this.switchedPartOnPreviousKeyAction;if(this.isPasteInProgress){this.options.allowCaretMode&&(this.resetSegmentValue=!1),this.updateOnPaste(e),this.isPasteInProgress=!1;return}let r=this.keyDownEvent||{},i=r.keyCode===U.BACKSPACE||r.key===_.BACKSPACE,a=r.keyCode===U.DELETE||r.key===_.DELETE,o=this.interactionMode;this.options.allowCaretMode&&o!==G.Caret&&!a&&!i&&(this.resetSegmentValue=!0),this.options.allowCaretMode?this.interactionMode=G.Caret:this.interactionMode=G.Selection;let s=this.isInCaretMode();if(s&&this.keyDownEvent.key===_.SPACE){this.restorePreviousInputEventState();return}let c=this.dateObject&&this.dateObject.getValue(),l=this.dateObject?this.dateObject.value:null,{text:u,format:d}=this.dateObject.getTextAndFormat();this.currentFormat=d;let f=``;f=s&&(i||a||o===G.Caret)?this.previousElementValue:u;let p=this.elementValue,h=b({oldText:f,newText:p,formatPattern:this.currentFormat,selectionStart:this.selection.start,isInCaretMode:s,keyEvent:this.keyDownEvent});if(h&&h.length&&h[0]&&h[0][1]!==g.formatSeparator&&(this.switchedPartOnPreviousKeyAction=!1),s&&(!h||h.length===0)){this.restorePreviousInputEventState();return}else if(s&&h.length===1){if(!h[0]||!h[0][0]){this.restorePreviousInputEventState();return}else if(s&&h[0]&&(h[0][0]===g.formatSeparator||h[0][1]===g.formatSeparator)){this.restorePreviousInputEventState();return}}let v=h.length===1&&h[0][1]===g.formatSeparator,y=[],x=!1,S=null;if(!v)for(let e=0;e<h.length;e++){let t=this.dateObject.parsePart({symbol:h[e][0],currentChar:h[e][1],resetSegmentValue:this.resetSegmentValue,cycleSegmentValue:!this.isInCaretMode(),rawTextValue:this.element.value,isDeleting:i||a,originalFormat:this.currentFormat});y.push(t),t.value||(S={type:`parse`}),x=t.switchToNext}this.options.autoSwitchParts||(x=!1),this.resetSegmentValue=!1;let C=this.options.format===this.currentFormat||T(this.options.format)&&this.options.format.length>1,w=y[y.length-1],E=w&&!T(w.value),D=s&&(i||a)&&E,O=w?w.resetPart:!1,k=this.dateObject.getValue(),A=!m(c,k),j=this.dateObject.value,M,N=this.selection;if(s){let t=h&&h.length>0?h[0][0]:null,n=this.dateObject.getLeadingZero()[t];h.length&&h[0][0]!==g.formatSeparator?x?(this.forceUpdateWithSelection(),this.switchDateSegment(1)):O?(M=this.currentFormat[N.start],M?(this.forceUpdate(),this.setSelection(this.selectionBySymbol(M))):this.restorePreviousInputEventState()):D?(this.forceUpdate(),h.length&&h[0][0]!==g.formatSeparator&&this.setSelection(this.selectionBySymbol(h[0][0]))):E?e.data===`0`&&n||(T(c)&&!T(k)?this.restorePreviousInputEventState():!T(c)&&T(k)?this.forceUpdateWithSelection():T(c)&&T(k)?A?this.forceUpdateWithSelection():this.restorePreviousInputEventState():!T(c)&&!T(k)?this.forceUpdateWithSelection():l!==j||this.restorePreviousInputEventState()):E||C||this.forceUpdateWithSelection():!this.options.autoSwitchParts&&h[0][1]===g.formatSeparator||this.setSelection(this.selectionBySymbol(h[0][0]))}else s||(this.forceUpdate(),h.length&&h[0][0]!==g.formatSeparator&&this.setSelection(this.selectionBySymbol(h[0][0])),this.options.autoSwitchParts?v?(this.resetSegmentValue=!0,n||this.switchDateSegment(1),this.switchedPartOnPreviousKeyAction=!0):x&&(this.switchDateSegment(1),this.switchedPartOnPreviousKeyAction=!0):w&&w.switchToNext?this.resetSegmentValue=!0:v&&(this.resetSegmentValue=!0,n||this.switchDateSegment(1),this.switchedPartOnPreviousKeyAction=!0),i&&this.options.selectPreviousSegmentOnBackspace&&this.switchDateSegment(-1));this.tryTriggerValueChange({oldValue:c,event:e}),this.triggerInputEnd({event:e,error:S,oldElementValue:t,newElementValue:this.elementValue}),s&&this.setTextAndFormat()}onElementFocus(e){this.triggerFocus({event:e})||(this.isActive=!0,this.interactionMode=G.None,this.switchedPartOnPreviousKeyAction=!1,this.refreshElementValue(),this.mouseDownStarted||this.caret(0,this.elementValue.length),this.mouseDownStarted=!1,this.triggerFocusEnd({event:e}))}onElementBlur(e){this.resetSegmentValue=!0,this.isActive=!1,!this.triggerBlur({event:e})&&(this.options.autoFill&&this.autoFill(),this.interactionMode=G.None,this.switchedPartOnPreviousKeyAction=!1,this.refreshElementValue(),this.triggerBlurEnd({event:e}))}onElementChange(e){this.triggerChange({event:e})}onElementKeyDown(e){if(this.triggerKeyDown({event:e}))return;let{start:t,end:n}=this.selection,r=e;if(this.keyDownEvent=e,this.previousElementValue=this.element.value,this.previousElementSelection={start:t,end:n},this.keyEventMatchesAutoSwitchKeys(e)){let t=e.keyCode===U.TAB;if(t){let{start:n,end:r}=this.selection;if(e.shiftKey&&t?this.switchDateSegment(-1):this.switchDateSegment(1),n!==this.selection.start||r!==this.selection.end){e.preventDefault();return}}else{e.preventDefault(),this.switchDateSegment(1);return}}let i=this.currentFormat[this.selection.start],a=this.getStepFromSymbol(i),o=!1,s=this.elementValue;if(!(e.altKey||e.ctrlKey||e.metaKey||e.keyCode===U.TAB)){switch(e.keyCode){case U.ARROW_LEFT:this.switchDateSegment(-1),o=!0,this.switchedPartOnPreviousKeyAction=!1;break;case U.ARROW_UP:this.modifyDateSegmentValue(a,i,r),s!==this.elementValue&&this.triggerInputEnd({event:e,error:null,newElementValue:this.elementValue,oldElementValue:s}),o=!0,this.switchedPartOnPreviousKeyAction=!1;break;case U.ARROW_RIGHT:this.switchDateSegment(1),o=!0,this.switchedPartOnPreviousKeyAction=!1;break;case U.ARROW_DOWN:this.modifyDateSegmentValue(-a,i,r),s!==this.elementValue&&this.triggerInputEnd({event:e,error:null,newElementValue:this.elementValue,oldElementValue:s}),o=!0,this.switchedPartOnPreviousKeyAction=!1;break;case U.ENTER:break;case U.HOME:this.selectNearestSegment(0),o=!0,this.switchedPartOnPreviousKeyAction=!1,this.resetSegmentValue=!0;break;case U.END:this.selectNearestSegment(this.elementValue.length),o=!0,this.switchedPartOnPreviousKeyAction=!1,this.resetSegmentValue=!0;break;default:return}o&&e.preventDefault()}}onElementPaste(){this.isPasteInProgress=!0}onElementMouseWheel(e){let t=this.elementValue;if(!this.options.enableMouseWheel||this.triggerMouseWheel({event:e})||!this.isActive)return;let n=e;n.shiftKey?this.switchDateSegment((n.wheelDelta||-n.detail)>0?-1:1):this.modifyDateSegmentValue((n.wheelDelta||-n.detail)>0?1:-1),n.returnValue=!1,n.preventDefault&&n.preventDefault(),t!==this.elementValue&&this.triggerInputEnd({event:e,error:null,newElementValue:this.elementValue,oldElementValue:t})}updateOnPaste(e){let t=this.intl.parseDate(this.elementValue,this.inputFormat)||this.value;T(t)&&this.dateObject.shouldNormalizeCentury()&&(t=this.dateObject.normalizeCentury(t));let n=this.dateObject&&this.dateObject.getValue();this.writeValue(t),this.tryTriggerValueChange({oldValue:n,event:e})}get elementValue(){return(this.element||{}).value||``}get inputFormat(){return this.options.format?typeof this.options.format==`string`?this.options.format:this.options.format.inputFormat:g.defaultDateFormat}get displayFormat(){return this.options.format?typeof this.options.format==`string`?this.options.format:this.options.format.displayFormat:g.defaultDateFormat}get selection(){let e={start:0,end:0};return this.element!==null&&this.element.selectionStart!==void 0&&(e={start:this.element.selectionStart,end:this.element.selectionEnd}),e}setSelection(e){this.element&&document.activeElement===this.element&&(this.element.setSelectionRange(e.start,e.end),E()&&B()&&this.element.scrollIntoView({block:`nearest`,inline:`nearest`}),e.start!==e.end&&(this.interactionMode=G.Selection))}selectionBySymbol(e){let t=-1,n=0;for(let r=0;r<this.currentFormat.length;r++)this.currentFormat[r]===e&&(n=r+1,t===-1&&(t=r));return t<0&&(t=0),!this.options.autoCorrectParts&&this.currentFormat.length!==this.currentText.length&&(this.currentFormat.length<this.currentText.length?n+=this.currentText.length-this.currentFormat.length:n=Math.max(0,n-(this.currentFormat.length-this.currentText.length))),{start:t,end:n}}selectionByIndex(e){let t={start:e,end:e};for(let n=e,r=e-1;n<this.currentFormat.length||r>=0;n++,r--){if(n<this.currentFormat.length&&this.currentFormat[n]!==g.formatSeparator){t=this.selectionBySymbol(this.currentFormat[n]);break}if(r>=0&&this.currentFormat[r]!==g.formatSeparator){t=this.selectionBySymbol(this.currentFormat[r]);break}}return t}switchDateSegment(e){let t=this.selection;if(this.isInCaretMode()){let n=t.start,r=this.currentFormat[n-1],i=``,a=``;if(e<0){for(let t=n+e;t>=0;t--)if(a=this.currentFormat[t],a!==g.formatSeparator&&a!==r){n=t,i=a;break}}else for(let t=n+e;t<this.currentFormat.length;t++)if(a=this.currentFormat[t],a!==g.formatSeparator&&a!==r){n=t,i=a;break}if(i){this.forceUpdate(),this.setSelection(this.selectionBySymbol(i)),this.interactionMode=G.Selection;return}}this.interactionMode=G.None;let{start:n,end:r}=this.selection;if(n<r&&this.currentFormat[n]!==this.currentFormat[r-1]){this.setSelection(this.selectionByIndex(e>0?n:r-1)),this.resetSegmentValue=!0,this.interactionMode=G.None;return}let i=this.currentFormat[n],a=n+e;for(;a>0&&a<this.currentFormat.length&&!(this.currentFormat[a]!==i&&this.currentFormat[a]!==g.formatSeparator);)a+=e;if(this.currentFormat[a]===g.formatSeparator)return;let o=a;for(;o>=0&&o<this.currentFormat.length&&this.currentFormat[o]===this.currentFormat[a];)o+=e;a>o&&(o+1!==n||a+1!==r)?(this.setSelection({start:o+1,end:a+1}),this.resetSegmentValue=!0):a<o&&(a!==n||o!==r)&&(this.setSelection({start:a,end:o}),this.resetSegmentValue=!0),this.interactionMode=G.None}modifyDateSegmentValue(e,t=``,n={}){if(!this.dateObject||this.options.readonly)return;let r=this.value,i=1,a=this.caret();t||=this.currentFormat[a[0]],t===`S`&&(!this.options.steps.millisecond||this.options.steps.millisecond===1)&&(i=L(I(this.inputFormat))),this.dateObject.modifyPart(t,i*e),this.tryTriggerValueChange({oldValue:r,event:n}),this.forceUpdate(),this.setSelection(this.selectionBySymbol(t))}tryTriggerValueChange(e={oldValue:null,event:{}}){if(!m(this.value,e.oldValue))return this.triggerValueChange(e)}triggerValueChange(e={oldValue:null,event:{}}){return this.trigger(ce,j(e,{value:this.value}))}triggerInput(e={event:{}}){return this.trigger(J,j(e,{value:this.value}))}triggerInputEnd(e={event:{},error:null,oldElementValue:``,newElementValue:``}){return this.trigger(le,j(e,{value:this.value}))}triggerFocus(e={event:{}}){return this.trigger(X,j({},e))}triggerFocusEnd(e={event:{}}){return this.trigger(de,j({},e))}triggerBlur(e={event:{}}){return this.trigger(Z,j({},e))}triggerBlurEnd(e={event:{}}){return this.trigger(ue,j({},e))}triggerChange(e={event:{}}){return this.trigger($,j(e,{value:this.value}))}triggerKeyDown(e={event:{}}){return this.trigger(Y,j({},e))}triggerMouseWheel(e={event:{}}){return this.trigger(Q,j({},e))}forceUpdate(){this.setTextAndFormat(),this.refreshElementValue()}forceUpdateWithSelection(){let{start:e,end:t}=this.selection,n=this.elementValue.length;this.forceUpdate();let r=this.elementValue.length-n;this.setSelection({start:e+r,end:t+r})}setTextAndFormat(){let{text:e,format:t}=this.dateObject.getTextAndFormat();this.currentFormat=t,this.currentText=e}setElementValue(e){this.element.value=e}getStepFromSymbol(e){switch(e){case`S`:return Number(this.options.steps.millisecond);case`s`:return Number(this.options.steps.second);case`m`:return Number(this.options.steps.minute);case`h`:case`H`:return Number(this.options.steps.hour);case`M`:return Number(this.options.steps.month);case`d`:case`E`:return Number(this.options.steps.day);case`y`:return Number(this.options.steps.year);default:return 1}}restorePreviousInputEventState(){this.restorePreviousElementValue(),this.restorePreviousElementSelection()}restorePreviousElementValue(){this.setElementValue(this.previousElementValue||``)}restorePreviousElementSelection(){let{start:e,end:t}=this.previousElementSelection;this.setSelection({start:e||0,end:t||0})}writeValue(e){this.verifyValue(e),this.dateObject=this.getDateObject(e),this.refreshElementValue()}verifyValue(e){if(e&&!z(e))throw Error(`The 'value' should be a valid JavaScript Date instance.`)}refreshElementValue(){let e=this.element,t=this.isActive?this.inputFormat:this.displayFormat,{text:n,format:r}=this.dateObject.getTextAndFormat(t);this.currentFormat=r,this.currentText=n;let i=this.options.hasPlaceholder||T(this.options.placeholder),a=!this.isActive&&i&&!this.dateObject.hasValue();i&&T(this.options.placeholder)&&(e.placeholder=this.options.placeholder);let o=a?``:n;this.previousElementValue=this.elementValue,this.setElementValue(o)}caret(e,t=e){let n=e!==void 0,r=[e,e],i=this.element;if(!(n&&(this.options.disabled||this.options.readonly))){try{i.selectionStart!==void 0&&(n&&(E()&&document.activeElement!==i&&i.focus(),i.setSelectionRange(e,t)),r=[i.selectionStart,i.selectionEnd])}catch{r=[]}return r}}selectNearestSegment(e){for(let t=e,n=e-1;t<this.currentFormat.length||n>=0;t++,n--){if(t<this.currentFormat.length&&this.currentFormat[t]!==`_`){this.selectDateSegment(this.currentFormat[t]);return}if(n>=0&&this.currentFormat[n]!==`_`){this.selectDateSegment(this.currentFormat[n]);return}}}selectDateSegment(e){let t=-1,n=0;for(let r=0;r<this.currentFormat.length;r++)this.currentFormat[r]===e&&(n=r+1,t===-1&&(t=r));t<0&&(t=0),this.caret(0,0),this.caret(t,n)}getDateObject(e){let{leadingZero:t}=this.dateObject||{};this.options.value=e;let n=this.createDateObject();return n.setLeadingZero(this.isActive?t:null),n}createDateObject(){return new ee(j({},this.getDateObjectOptions()))}getDateObjectOptions(){return{intlService:this.options.intlService,formatPlaceholder:this.options.formatPlaceholder?this.options.formatPlaceholder:`formatPattern`,format:this.inputFormat,cycleTime:this.options.cycleTime,twoDigitYearMax:this.options.twoDigitYearMax,autoCorrectParts:this.options.autoCorrectParts,value:this.options.value,toggleDayPeriod:this.options.toggleDayPeriod,autoSwitchParts:this.options.autoSwitchParts}}keyEventMatchesAutoSwitchKeys(e){let t=(this.options.autoSwitchKeys||[]).map(e=>e.toString().toLowerCase().trim());return t.indexOf(e.keyCode.toString())>=0||t.indexOf(e.keyCode)>=0||t.indexOf(e.key.toLowerCase().trim())>=0}autoFill(){let e=this.dateObject,t=new Date,n,r,i,a,o,s;(e.date||e.month||e.year||e.hours||e.minutes||e.seconds)&&(i=e.year?e.value.getFullYear():t.getFullYear(),r=e.month?e.value.getMonth():t.getMonth(),n=e.date?e.value.getDate():t.getDate(),a=e.hours?e.value.getHours():t.getHours(),o=e.minutes?e.value.getMinutes():t.getMinutes(),s=e.seconds?e.value.getSeconds():t.getSeconds(),e.setValue(new Date(i,r,n,a,o,s)),this.refreshElementValue(),this.triggerValueChange())}};let me={id:`dateinput`,name:`DateInput`,category:`web`,description:`The DateInput widget allows to edit date by typing.`,depends:[`core`,`label`]};(function(e,t){var n=window.kendo,r=n.ui,i=r.Widget,a=`.kendoDateInput`,o={}.toString,s=e.isPlainObject,c=`k-focus`,l=`k-disabled`,u=`k-invalid`,d=`disabled`,f=`readonly`,p=`change`,m=n.Class.extend({init:function(e){let t=e.culture?n.getCulture(e.culture):n.culture();this.messages=e.messages,this.cldr={},this.cldr[t.name]={name:t.name,calendar:t.calendar||{},numbers:t.numberFormat}},parseDate:function(e,t,r){return n.parseDate(e,t,r,!0)},formatDate:function(e,t,r){return n.toString(e,t,r)},splitDateFormat:function(e){return n.date.splitDateFormat(e)},dateFormatNames:function(e,t){return n.date.dateFormatNames(t)},dateFieldName:function(e){return this.messages[e.type]||{}}});function h(){let e=n.culture(),t=[];return t.push(e.calendars.standard[`/`]),t.push(e.calendars.standard[`:`]),t}function g(e,t){return e&&n.getCulture(e).calendars.standard.patterns[t]||t}var _=i.extend({init:function(t,r){var o=this;i.fn.init.call(o,t,r),t=o.element,r=o.options,r.format=n._extractFormat(r.format||n.getCulture(r.culture).calendars.standard.patterns.d),r.min=n.parseDate(t.attr(`min`))||n.parseDate(r.min),r.max=n.parseDate(t.attr(`max`))||n.parseDate(r.max),r.inputMode=r.inputMode||t.attr(`inputmode`)||`text`;var s=t.parent().attr(`class`)||``,l=s.indexOf(`picker`)>=0&&s.indexOf(`rangepicker`)<0,u=o.options.value||t.val();l?o.wrapper=o.element.parent():(o.wrapper=t.wrap(`<span class='k-dateinput k-input'></span>`).parent(),o.wrapper.addClass(t[0].className).removeClass(`input-validation-error`)),o.wrapper[0].style.cssText=t[0].style.cssText,t.css({height:t[0].style.height}),o._validationIcon=e(n.ui.icon({icon:`exclamation-circle`,iconClass:`k-input-validation-icon k-hidden`})).insertAfter(t),o._form(),o.dateInputInstance=new pe(t[0],{format:g(r.culture,r.format),autoCorrectParts:r.autoCorrectParts,autoSwitchKeys:r.autoSwitchKeys.length?r.autoSwitchKeys:h(),enableMouseWheel:r.enableMouseWheel,twoDigitYearMax:r.twoDigitYearMax,steps:r.steps,formatPlaceholder:r.messages,events:{inputEnd:function(e){e.error&&o._blinkInvalidState()},keydown:function(e){if(!e.event.keyCode){e.preventDefault();return}(e.event.keyCode==n.keys.UP||e.event.keyCode==n.keys.DOWN)&&setTimeout(function(){o.element.trigger(p)})},blur:function(e){o._change(),e.preventDefault()}},intlService:new m({culture:r.culture,messages:o.options.messages}),autoSwitchParts:r.autoSwitchParts,autoFill:r.autoFill,toggleDayPeriod:r.toggleDayPeriod}),o._emptyMask=this.element.val(),r.value&&o.value(r.value),o.element.addClass(`k-input-inner`).attr(`autocomplete`,`off`).attr(`inputmode`,r.inputMode).on(`focus`+a,function(){o.wrapper.addClass(c)}).on(`focusout`+a,function(){o.wrapper.removeClass(c)});try{t[0].setAttribute(`type`,`text`)}catch{t[0].type=`text`}t.is(`[disabled]`)||e(o.element).parents(`fieldset`).is(`:disabled`)?o.enable(!1):o.readonly(t.is(`[readonly]`)),o.value(u),l||o._applyCssClasses(),r.label&&o._label(),o.element.removeAttr(`style`),n.notify(o)},options:{name:`DateInput`,autoAdjust:!0,autoCorrectParts:!0,autoSwitchKeys:[],autoSwitchParts:!1,enableMouseWheel:!0,culture:``,value:``,format:``,min:new Date(1900,0,1),max:new Date(2099,11,31),mess