@progress/kendo-dateinputs-common 0.2.0-dev.202301161405 → 0.2.0-dev.202301231327

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/main.js CHANGED
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@progress/kendo-date-math"),require("tslib")):"function"==typeof define&&define.amd?define([,],e):"object"==typeof exports?exports.KendoDateinputsCommon=e(require("@progress/kendo-date-math"),require("tslib")):t.KendoDateinputsCommon=e(t.KendoDateMath,t.self)}(window,(function(t,e){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=5)}([function(e,n){e.exports=t},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Constants={formatSeparator:"_",twoDigitYearMax:68,defaultDateFormat:"d",defaultLocaleId:"en"}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,r=n(0),s=function(t){return t&&"object"==typeof t&&!Array.isArray(t)},a=function(t){return t instanceof HTMLElement};e.isPresent=function(t){return null!=t},e.isDocumentAvailable=function(){return!!document},e.isNumber=function(t){return e.isPresent(t)&&"number"==typeof t&&!Number.isNaN(t)},e.parseToInt=function(t){return parseInt(t,10)},e.clamp=function(t,e,n){return Math.min(n,Math.max(e,t))},e.extend=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Object.assign.apply(Object,t)},e.deepExtend=function(t){for(var n,i,r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];if(!r.length)return t;var l=r.shift();if(s(t)&&s(l))for(var h in l)a(l[h])?t[h]=l[h]:s(l[h])?(t[h]||e.extend(t,((n={})[h]={},n)),e.deepExtend(t[h],l[h])):e.extend(t,((i={})[h]=l[h],i));return e.deepExtend.apply(void 0,[t].concat(r))},e.noop=function(){},e.isFunction=function(t){return"function"==typeof t},e.cropTwoDigitYear=function(t){return!e.isPresent(t)||isNaN(t.getTime())?0:Number(t.getFullYear().toString().slice(-2))},e.setYears=(i="setFullYear",function(t,e){var n=r.cloneDate(t);return n[i](e),n}),e.millisecondDigitsInFormat=function(t){var e=t&&t.match(/S+(\1)/);return e?e[0].length:0},e.millisecondStepFor=function(t){return Math.pow(10,3-t)},e.areDatePartsEqualTo=function(t,e,n,i,r,s,a,o){return!(!t||t.getFullYear()!==e||t.getMonth()!==n||t.getDate()!==i||t.getHours()!==r||t.getMinutes()!==s||t.getSeconds()!==a||t.getMilliseconds()!==o)},e.isValidDate=function(t){return e.isPresent(t)&&t.getTime&&e.isNumber(t.getTime())}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),r=n(4);e.padZero=function(t){return new Array(Math.max(t,0)).fill("0").join("")},e.unpadZero=function(t){return t.replace(/^0*/,"")},e.approximateStringMatching=function(t){var e=t.oldText,n=t.newText,s=t.formatPattern,a=t.selectionStart,o=t.isInCaretMode,l=t.keyEvent,h=e[a+e.length-n.length],u=e.substring(0,a+e.length-n.length),c=n.substring(0,a),d=[];if(u===c&&a>0)return d.push([s[a-1],c[a-1]]),d;if(0===u.indexOf(c)&&o&&(l.key===r.Key.DELETE||l.key===r.Key.BACKSPACE)||0===u.indexOf(c)&&!o&&(0===c.length||s[c.length-1]!==s[c.length])){var p="";o||1!==c.length||d.push([s[0],c[0]]);for(var m=c.length;m<u.length;m++)s[m]!==p&&s[m]!==i.Constants.formatSeparator&&(p=s[m],d.push([p,""]));return d}if(o&&(0===c.indexOf(u)||s[a-1]===i.Constants.formatSeparator)||!o&&(0===c.indexOf(u)||s[a-1]===i.Constants.formatSeparator)){var f=s[0];for(m=Math.max(0,u.length-1);m<s.length;m++)if(s[m]!==i.Constants.formatSeparator){f=s[m];break}return[[f,c[a-1]]]}return!o&&" "===c[c.length-1]||!o&&c[c.length-1]===h?[[s[a-1],i.Constants.formatSeparator]]:[[s[a-1],c[a-1]]]},e.dateSymbolMap=function(t,e){return t[e.pattern[0]]=e.type,t},e.isInRange=function(t,e,n){return null===t||!(e&&e>t||n&&n<t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Key={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"}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(6);e.DateInput=i.DateInput},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,r=n(7),s=n(8),a=n(3),o=n(10),l=n(4),h=n(2),u=n(11),c=n(12),d=n(0),p=n(1),m={format:"d",allowNulls:!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:(i={},i.valueChange=null,i.input=null,i.inputEnd=null,i.focus=null,i.focusEnd=null,i.blur=null,i.blurEnd=null,i.keydown=null,i.mousewheel=null,i.change=null,i),selectNearestSegmentOnFocus:!1,enableMouseWheel:!1,allowCaretMode:!1,autoSwitchParts:!0,autoSwitchKeys:[],twoDigitYearMax:p.Constants.twoDigitYearMax,autoCorrectParts:!0},f=function(t){function e(e,n){var i=t.call(this,n)||this;return i.dateObject=null,i.currentText="",i.currentFormat="",i.interactionMode=c.DateInputInteractionMode.None,i.previousElementSelection={start:0,end:0},i.init(e,n),i}return r.__extends(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.dateObject&&this.dateObject.getValue()},enumerable:!0,configurable:!0}),e.prototype.init=function(t,e){var n=h.isValidDate(this.options.value)?d.cloneDate(this.options.value):new Date(e.formattedValue);h.isValidDate(n)||(n=null),this.element=t,this.options=h.extend({},m,e),this.intl=this.options.intlService,this.formatPlaceholder=this.options.formatPlaceholder?this.options.formatPlaceholder:"formatPattern",this.dateObject=this.createDateObject(),this.dateObject.setValue(n),this.setTextAndFormat(),this.bindEvents(),this.resetSegmentValue=!0,this.interactionMode=c.DateInputInteractionMode.None,this.forceUpdate()},e.prototype.destroy=function(){this.unbindEvents(),this.dateObject=null,t.prototype.destroy.call(this)},e.prototype.bindEvents=function(){this.onElementDragStart=this.onElementDragStart.bind(this),this.element.addEventListener("dragStart",this.onElementDragStart),this.onElementDrop=this.onElementDrop.bind(this),this.element.addEventListener("drop",this.onElementDrop),this.onElementClick=this.onElementClick.bind(this),this.element.addEventListener("click",this.onElementClick),this.onElementMouseDown=this.onElementMouseDown.bind(this),this.element.addEventListener("mousedown",this.onElementMouseDown),this.element.addEventListener("touchstart",this.onElementMouseDown),this.onElementMouseUp=this.onElementMouseUp.bind(this),this.element.addEventListener("mouseup",this.onElementMouseUp),this.onElementInput=this.onElementInput.bind(this),this.element.addEventListener("input",this.onElementInput),this.onElementKeyDown=this.onElementKeyDown.bind(this),this.element.addEventListener("keydown",this.onElementKeyDown),this.onElementFocus=this.onElementFocus.bind(this),this.element.addEventListener("focus",this.onElementFocus),this.onElementBlur=this.onElementBlur.bind(this),this.element.addEventListener("blur",this.onElementBlur),this.onElementChange=this.onElementChange.bind(this),this.element.addEventListener("change",this.onElementChange),this.onElementPaste=this.onElementPaste.bind(this),this.element.addEventListener("paste",this.onElementPaste),this.onElementMouseWheel=this.onElementMouseWheel.bind(this),this.element.addEventListener("DOMMouseScroll",this.onElementMouseWheel),this.element.addEventListener("mousewheel",this.onElementMouseWheel)},e.prototype.unbindEvents=function(){this.element.removeEventListener("dragStart",this.onElementDragStart),this.element.removeEventListener("drop",this.onElementDrop),this.element.removeEventListener("touchstart",this.onElementMouseDown),this.element.removeEventListener("mousedown",this.onElementMouseDown),this.element.removeEventListener("mouseup",this.onElementMouseUp),this.element.removeEventListener("click",this.onElementClick),this.element.removeEventListener("input",this.onElementInput),this.element.removeEventListener("keydown",this.onElementKeyDown),this.element.removeEventListener("focus",this.onElementFocus),this.element.removeEventListener("blur",this.onElementBlur),this.element.removeEventListener("change",this.onElementChange),this.element.removeEventListener("paste",this.onElementPaste),this.element.removeEventListener("DOMMouseScroll",this.onElementMouseWheel),this.element.removeEventListener("mousewheel",this.onElementMouseWheel)},e.prototype.setOptions=function(t,e){void 0===e&&(e=!1),this.options=h.extend(this.options,t),e&&(this.unbindEvents(),this.init(this.element,this.options))},e.prototype.resetLocale=function(){this.unbindEvents(),this.init(this.element,this.options)},e.prototype.isInCaretMode=function(){return this.interactionMode===c.DateInputInteractionMode.Caret},e.prototype.focus=function(){this.element.focus(),this.options.selectNearestSegmentOnFocus&&this.selectNearestSegment(0)},e.prototype.onElementDragStart=function(t){t.preventDefault()},e.prototype.onElementDrop=function(t){t.preventDefault()},e.prototype.onElementMouseDown=function(){this.mouseDownStarted=!0,this.focusedPriorToMouseDown=this.isActive},e.prototype.onElementMouseUp=function(t){this.mouseDownStarted=!1,t.preventDefault()},e.prototype.onElementClick=function(t){this.mouseDownStarted=!1;var e=this.selection;if(this.isInCaretMode()&&this.forceUpdate(),3===t.detail);else if(this.isActive&&this.options.selectNearestSegmentOnFocus){var n=this.element.selectionStart!==this.element.selectionEnd,i=h.isPresent(this.options.placeholder)&&!this.dateObject.hasValue()&&!this.focusedPriorToMouseDown,r=!n&&i?0:this.caret()[0];this.selectNearestSegment(r)}else this.setSelection(this.selectionByIndex(e.start))},e.prototype.onElementInput=function(t){this.triggerInput({event:t});var e=this.keyDownEvent||{},n=e.keyCode===o.KeyCode.BACKSPACE||e.key===l.Key.BACKSPACE,i=e.keyCode===o.KeyCode.DELETE||e.key===l.Key.DELETE;if(this.element&&this.dateObject){if(this.isPasteInProgress)return this.options.allowCaretMode&&(this.resetSegmentValue=!1),this.updateOnPaste(t),void(this.isPasteInProgress=!1);var r=this.interactionMode;!this.options.allowCaretMode||r===c.DateInputInteractionMode.Caret||i||n||(this.resetSegmentValue=!0),this.options.allowCaretMode?this.interactionMode=c.DateInputInteractionMode.Caret:this.interactionMode=c.DateInputInteractionMode.Selection;var s=this.isInCaretMode();if(s&&this.keyDownEvent.key===l.Key.SPACE)this.restorePreviousInputEventState();else{var u=this.dateObject&&this.dateObject.getValue(),m=this.dateObject.getTextAndFormat(),f=m.text,v=m.format;this.currentFormat=v;var g="";g=s&&(n||i||r===c.DateInputInteractionMode.Caret)?this.previousElementValue:f;var y=this.elementValue,D=a.approximateStringMatching({oldText:g,newText:y,formatPattern:this.currentFormat,selectionStart:this.selection.start,isInCaretMode:s,keyEvent:this.keyDownEvent});if(!s||D&&0!==D.length){if(s&&1===D.length){if(!D[0]||!D[0][0])return void this.restorePreviousInputEventState();if(s&&D[0]&&(D[0][0]===p.Constants.formatSeparator||D[0][1]===p.Constants.formatSeparator))return void this.restorePreviousInputEventState()}var E=1===D.length&&D[0][1]===p.Constants.formatSeparator,b=[],P=!1;if(!E)for(var S=0;S<D.length;S++){var M=this.dateObject.parsePart({symbol:D[S][0],currentChar:D[S][1],resetSegmentValue:this.resetSegmentValue,cycleSegmentValue:!this.isInCaretMode(),rawTextValue:this.element.value,isDeleting:n||i,originalFormat:this.currentFormat});b.push(M),P=M.switchToNext}this.options.autoSwitchParts||(P=!1),this.resetSegmentValue=!1;var I,x=b[b.length-1],C=x&&!x.value,O=s&&(n||i)&&C,w=!!x&&x.resetPart,F=!!x&&x.hasInvalidDatePart,V=!d.isEqual(u,this.dateObject.value),k=this.selection;(!s||O||w)&&(w&&(I=this.currentFormat[k.start]),this.forceUpdate()),D.length&&D[0][0]!==p.Constants.formatSeparator&&(!s||O||w?I?this.setSelection(this.selectionBySymbol(I)):(this.options.autoSwitchParts||D[0][1]!==p.Constants.formatSeparator)&&this.setSelection(this.selectionBySymbol(D[0][0])):s&&(V&&h.isPresent(this.dateObject.getValue())||!V&&P&&h.isPresent(this.dateObject.getValue())?P&&this.switchDateSegment(1):C&&!F&&this.restorePreviousInputEventState())),P||!s||n||i||w||!C?this.options.autoSwitchParts&&(P||E)&&(s||this.switchDateSegment(1)):V?this.currentFormat.length===this.elementValue.length||r!==c.DateInputInteractionMode.Caret&&V||(r!==c.DateInputInteractionMode.Caret?(I=this.currentFormat[k.start],this.forceUpdate(),this.setSelection(this.selectionBySymbol(I))):F||this.restorePreviousInputEventState()):F||this.restorePreviousInputEventState(),this.tryTriggerValueChange({oldValue:u,event:t}),this.triggerInputEnd({event:t}),s&&this.setTextAndFormat()}else this.restorePreviousInputEventState()}}},e.prototype.onElementFocus=function(t){this.triggerFocus({event:t})||(this.isActive=!0,this.interactionMode=c.DateInputInteractionMode.None,this.refreshElementValue(),this.mouseDownStarted||this.caret(0,this.elementValue.length),this.mouseDownStarted=!1,this.triggerFocusEnd({event:t}))},e.prototype.onElementBlur=function(t){this.resetSegmentValue=!0,this.isActive=!1,this.triggerBlur({event:t})||(this.interactionMode=c.DateInputInteractionMode.None,this.refreshElementValue(),this.triggerBlurEnd({event:t}))},e.prototype.onElementChange=function(t){this.triggerChange({event:t})},e.prototype.onElementKeyDown=function(t){if(!this.triggerKeyDown({event:t})){this.keyDownEvent=t,this.previousElementValue=this.element.value;var e=this.selection,n=e.start,i=e.end;this.previousElementSelection={start:n,end:i};var r=(this.options.autoSwitchKeys||[]).map((function(t){return t.toString().toLowerCase().trim()}));if(r.indexOf(t.keyCode.toString())>=0||r.indexOf(t.keyCode)>=0||r.indexOf(t.key.toLowerCase().trim())>=0){var s=r.indexOf(l.Key.TAB.toLowerCase().trim())>=0||r.indexOf(o.KeyCode.TAB)>=0||r.indexOf(o.KeyCode.TAB.toString())>=0;if(!s)return t.preventDefault(),void this.switchDateSegment(1);var a=this.selection,h=a.start,u=a.end;if(t.shiftKey&&s?this.switchDateSegment(-1):this.switchDateSegment(1),h!==this.selection.start||u!==this.selection.end)return void t.preventDefault()}var c=this.currentFormat[this.selection.start],d=this.getStepFromSymbol(c),p=!1;if(!(t.altKey||t.ctrlKey||t.metaKey||t.keyCode===o.KeyCode.TAB)){switch(t.keyCode){case o.KeyCode.ARROW_LEFT:this.switchDateSegment(-1),p=!0;break;case o.KeyCode.ARROW_UP:this.modifyDateSegmentValue(d,c,event),p=!0;break;case o.KeyCode.ARROW_RIGHT:this.switchDateSegment(1),p=!0;break;case o.KeyCode.ARROW_DOWN:this.modifyDateSegmentValue(-d,c,event),p=!0;break;case o.KeyCode.ENTER:break;case o.KeyCode.DELETE:case o.KeyCode.BACKSPACE:if(this.options.allowNulls){var m=this.dateObject.value;this.dateObject.setValue(null),this.forceUpdate(),this.tryTriggerValueChange({oldValue:m,event:t})}return p=!0,void(t.keyCode===o.KeyCode.BACKSPACE&&((this.options.autoSwitchKeys||[]).indexOf(o.KeyCode.BACKSPACE)>=0||(this.options.autoSwitchKeys||[]).indexOf(l.Key.BACKSPACE)>=0)&&this.switchDateSegment(-1));case l.Key.HOME:this.selectNearestSegment(0);break;case l.Key.END:this.selectNearestSegment(this.elementValue.length);break;default:return}p&&t.preventDefault()}}},e.prototype.onElementPaste=function(){this.isPasteInProgress=!0},e.prototype.onElementMouseWheel=function(t){if(this.options.enableMouseWheel&&!this.triggerMouseWheel({event:t})&&this.isActive){var e=t;e.shiftKey?this.switchDateSegment((e.wheelDelta||-e.detail)>0?-1:1):this.modifyDateSegmentValue((e.wheelDelta||-e.detail)>0?1:-1),e.returnValue=!1,e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation()}},e.prototype.updateOnPaste=function(t){var e=this.intl.parseDate(this.elementValue,this.inputFormat)||this.value;h.isPresent(e)&&this.dateObject.shouldNormalizeCentury()&&(e=this.dateObject.normalizeCentury(e));var n=this.dateObject&&this.dateObject.getValue();this.writeValue(e),this.tryTriggerValueChange({oldValue:n,event:t})},Object.defineProperty(e.prototype,"elementValue",{get:function(){return(this.element||{}).value||""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"inputFormat",{get:function(){return this.options.format?"string"==typeof this.options.format?this.options.format:this.options.format.inputFormat:p.Constants.defaultDateFormat},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"displayFormat",{get:function(){return this.options.format?"string"==typeof this.options.format?this.options.format:this.options.format.displayFormat:p.Constants.defaultDateFormat},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selection",{get:function(){var t={start:0,end:0};return null!==this.element&&void 0!==this.element.selectionStart&&(t={start:this.element.selectionStart,end:this.element.selectionEnd}),t},enumerable:!0,configurable:!0}),e.prototype.setSelection=function(t){this.element&&document.activeElement===this.element&&this.element.setSelectionRange(t.start,t.end)},e.prototype.selectionBySymbol=function(t){for(var e=-1,n=0,i=0;i<this.currentFormat.length;i++)this.currentFormat[i]===t&&(n=i+1,-1===e&&(e=i));return e<0&&(e=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:e,end:n}},e.prototype.selectionByIndex=function(t){for(var e={start:t,end:t},n=t,i=t-1;n<this.currentFormat.length||i>=0;n++,i--){if(n<this.currentFormat.length&&this.currentFormat[n]!==p.Constants.formatSeparator){e=this.selectionBySymbol(this.currentFormat[n]);break}if(i>=0&&this.currentFormat[i]!==p.Constants.formatSeparator){e=this.selectionBySymbol(this.currentFormat[i]);break}}return e},e.prototype.switchDateSegment=function(t){var e=this.selection;if(this.isInCaretMode()){var n=e.start,i=this.currentFormat[n-(this.elementValue.length-this.currentFormat.length)]||this.currentFormat[n],r="",s="";if(t<0){for(var a=n+t;a>=0;a--)if((s=this.currentFormat[a])!==p.Constants.formatSeparator&&s!==i){n=a,r=s;break}}else for(a=n+t;a<this.currentFormat.length;a++)if((s=this.currentFormat[a])!==p.Constants.formatSeparator&&s!==i){n=a,r=s;break}if(r)return this.forceUpdate(),this.setSelection(this.selectionBySymbol(r)),void(this.interactionMode=c.DateInputInteractionMode.Selection)}var o=this.selection,l=o.start,h=o.end;if(l<h&&this.currentFormat[l]!==this.currentFormat[h-1])return this.setSelection(this.selectionByIndex(t>0?l:h-1)),void(this.resetSegmentValue=!0);for(var u=this.currentFormat[l],d=l+t;d>0&&d<this.currentFormat.length&&(this.currentFormat[d]===u||this.currentFormat[d]===p.Constants.formatSeparator);)d+=t;if(this.currentFormat[d]!==p.Constants.formatSeparator){for(var m=d;m>=0&&m<this.currentFormat.length&&this.currentFormat[m]===this.currentFormat[d];)m+=t;d>m&&(m+1!==l||d+1!==h)?(this.setSelection({start:m+1,end:d+1}),this.resetSegmentValue=!0):d<m&&(d!==l||m!==h)&&(this.setSelection({start:d,end:m}),this.resetSegmentValue=!0)}},e.prototype.modifyDateSegmentValue=function(t,e,n){if(void 0===e&&(e=""),void 0===n&&(n={}),this.dateObject){var i=this.value,r=1*t,s=this.caret();if("S"===(e=e||this.currentFormat[s[0]])&&!this.options.steps.millisecond){var a=h.millisecondDigitsInFormat(this.inputFormat);r=h.millisecondStepFor(a)}this.dateObject.modifyPart(e,r),this.tryTriggerValueChange({oldValue:i,event:n}),this.forceUpdate(),this.setSelection(this.selectionBySymbol(e))}},e.prototype.tryTriggerValueChange=function(t){if(void 0===t&&(t={oldValue:null,event:{}}),!d.isEqual(this.value,t.oldValue))return this.triggerValueChange(t)},e.prototype.triggerValueChange=function(t){return void 0===t&&(t={oldValue:null,event:{}}),this.trigger("valueChange",h.extend(t,{value:this.value}))},e.prototype.triggerInput=function(t){return void 0===t&&(t={event:{}}),this.trigger("input",h.extend(t,{value:this.value}))},e.prototype.triggerInputEnd=function(t){return void 0===t&&(t={event:{}}),this.trigger("inputEnd",h.extend(t,{value:this.value}))},e.prototype.triggerFocus=function(t){return void 0===t&&(t={event:{}}),this.trigger("focus",h.extend({},t))},e.prototype.triggerFocusEnd=function(t){return void 0===t&&(t={event:{}}),this.trigger("focusEnd",h.extend({},t))},e.prototype.triggerBlur=function(t){return void 0===t&&(t={event:{}}),this.trigger("blur",h.extend({},t))},e.prototype.triggerBlurEnd=function(t){return void 0===t&&(t={event:{}}),this.trigger("blurEnd",h.extend({},t))},e.prototype.triggerChange=function(t){return void 0===t&&(t={event:{}}),this.trigger("change",h.extend(t,{value:this.value}))},e.prototype.triggerKeyDown=function(t){return void 0===t&&(t={event:{}}),this.trigger("keydown",h.extend({},t))},e.prototype.triggerMouseWheel=function(t){return void 0===t&&(t={event:{}}),this.trigger("mousewheel",h.extend({},t))},e.prototype.forceUpdate=function(){this.setTextAndFormat(),this.refreshElementValue()},e.prototype.setTextAndFormat=function(){var t=this.dateObject.getTextAndFormat(),e=t.text,n=t.format;this.currentFormat=n,this.currentText=e},e.prototype.setElementValue=function(t){this.element.value=t},e.prototype.getStepFromSymbol=function(t){switch(t){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}},e.prototype.restorePreviousInputEventState=function(){this.restorePreviousElementValue(),this.restorePreviousElementSelection()},e.prototype.restorePreviousElementValue=function(){this.setElementValue(this.previousElementValue||"")},e.prototype.restorePreviousElementSelection=function(){var t=this.previousElementSelection,e=t.start,n=t.end;this.setSelection({start:e||0,end:n||0})},e.prototype.writeValue=function(t){this.verifyValue(t),this.dateObject=this.getDateObject(t),this.refreshElementValue()},e.prototype.verifyValue=function(t){if(t&&!h.isValidDate(t))throw new Error("The 'value' should be a valid JavaScript Date instance.")},e.prototype.refreshElementValue=function(){var t=this.caret()[0],e=this.element,n=this.isActive?this.inputFormat:this.displayFormat,i=this.dateObject.getTextAndFormat(n),r=i.text,s=i.format;this.currentFormat=s,this.currentText=r;var a=!this.isActive&&h.isPresent(this.options.placeholder)&&!this.dateObject.hasValue();h.isPresent(this.options.placeholder)&&(e.placeholder=this.options.placeholder);var o=a?"":r;this.previousElementValue=this.elementValue,this.setElementValue(o),this.isActive&&!this.options.allowCaretMode&&this.options.selectNearestSegmentOnFocus&&this.selectNearestSegment(t)},e.prototype.caret=function(t,e){void 0===e&&(e=t);var n=void 0!==t,i=[t,t],r=this.element;if(!n||!this.options.disabled&&!this.options.readonly){try{void 0!==r.selectionStart&&(n&&(h.isDocumentAvailable()&&document.activeElement!==r&&r.focus(),r.setSelectionRange(t,e)),i=[r.selectionStart,r.selectionEnd])}catch(t){i=[]}return i}},e.prototype.selectNearestSegment=function(t){for(var e=t,n=t-1;e<this.currentFormat.length||n>=0;e++,n--){if(e<this.currentFormat.length&&"_"!==this.currentFormat[e])return void this.selectDateSegment(this.currentFormat[e]);if(n>=0&&"_"!==this.currentFormat[n])return void this.selectDateSegment(this.currentFormat[n])}},e.prototype.selectDateSegment=function(t){for(var e=-1,n=0,i=0;i<this.currentFormat.length;i++)this.currentFormat[i]===t&&(n=i+1,-1===e&&(e=i));e<0&&(e=0),this.caret(0,0),this.caret(e,n)},e.prototype.getDateObject=function(t){var e=(this.dateObject||{}||null).leadingZero,n=this.createDateObject({value:t});return n.setLeadingZero(this.isActive?e:null),n},e.prototype.createDateObject=function(t){return void 0===t&&(t={}),new s.DateObject(h.extend({intlService:this.intl,formatPlaceholder:this.formatPlaceholder,format:this.inputFormat,cycleTime:this.options.cycleTime,twoDigitYearMax:this.options.twoDigitYearMax,autoCorrectParts:this.options.autoCorrectParts,value:this.options.value},t))},e}(u.Observable);e.DateInput=f},function(t,n){t.exports=e},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),r=n(9),s=n(3),a=n(2),o=n(1),l=/d|M|H|h|m|s/,h=function(){function t(t){var e=t.intlService,n=t.formatPlaceholder,r=t.format,s=t.cycleTime,a=void 0!==s&&s,l=t.twoDigitYearMax,h=void 0===l?o.Constants.twoDigitYearMax:l,u=t.value,c=void 0===u?null:u,d=t.autoCorrectParts,p=void 0===d||d;if(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="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=i.getDate(new Date),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.intl=e,this.formatPlaceholder=n||"wide",this.format=r,this.cycleTime=a,this.monthNames=this.allFormattedMonths(this.localeId),this.dayPeriods=this.allDayPeriods(this.localeId),this.twoDigitYearMax=h,this.autoCorrectParts=p,c)this._value=i.cloneDate(c);else{this._value=i.getDate(new Date);for(var m=this.dateFormatString(this.value,this.format).symbols,f=0;f<m.length;f++)this.setExisting(m[f],!1)}}return Object.defineProperty(t.prototype,"value",{get:function(){return this._value},set:function(t){(!t||t instanceof Date)&&(this._value=t,this.resetInvalidDate())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"localeId",{get:function(){for(var t=o.Constants.defaultLocaleId,e=Object.keys(this.intl.cldr),n=0;n<e.length;n++){var i=e[n],r=this.intl.cldr[i];if(r.name&&r.calendar&&r.numbers&&r.name!==o.Constants.defaultLocaleId){t=r.name;break}}return t},enumerable:!0,configurable:!0}),t.prototype.setValue=function(t){t?i.isEqual(t,this._value)||(this._value=i.cloneDate(t),this.modifyExisting(!0)):(this._value=i.getDate(new Date),this.modifyExisting(!1)),this.resetInvalidDate()},t.prototype.hasValue=function(){var t=this;return this.intl.splitDateFormat(this.format,this.localeId).reduce((function(e,n){return e||"literal"!==n.type&&"dayperiod"!==n.type&&t.getExisting(n.pattern[0])}),!1)},t.prototype.getValue=function(){for(var t=0;t<this.knownParts.length;t++)if(!this.getExisting(this.knownParts[t]))return null;return i.cloneDate(this.value)},t.prototype.getFormattedDate=function(t){return this.intl.formatDate(this.getValue(),t,this.localeId)},t.prototype.getTextAndFormat=function(t){void 0===t&&(t="");var e=t||this.format,n=this.intl.formatDate(this.value,e,this.localeId),i=this.dateFormatString(this.value,e);if(!this.autoCorrectParts&&this._partiallyInvalidDate.startDate){for(var r="",o=this.intl.formatDate(this.value,e,this.localeId),l=this.getFormattedInvalidDates(e),h=0;h<o.length;h++){var u=i.symbols[h];if("literal"===i.partMap[h].type)r+=n[h];else if(this.getInvalidDatePartValue(u)){var c=this.getPartsForSegment(i,h);if("M"===u){var d=(a.parseToInt(this.getInvalidDatePartValue(u))+1).toString();if(c.length>2)r+=l[u][h];else if(this.getInvalidDatePartValue(u))r+=s.padZero(c.length-d.length)+d,h+=c.length-1;else r+=l[u][h]}else if(this.getInvalidDatePartValue(u)){d=this.getInvalidDatePartValue(u).toString();r+=s.padZero(c.length-d.length)+d,h+=c.length-1}else r+=l[u][h]}else r+=n[h]}n=r}return this.merge(n,i)},t.prototype.getFormattedInvalidDates=function(t){var e=this;void 0===t&&(t="");var n=t||this.format,i={E:"",H:"",M:"",a:"",d:"",h:"",m:"",s:"",y:"",S:""};return Object.keys(this._partiallyInvalidDate.invalidDateParts).forEach((function(t){var r=e.getInvalidDatePart(t).date;if(r){var s=e.intl.formatDate(r,n,e.localeId);i[t]=s}})),i},t.prototype.modifyExisting=function(t){for(var e=this.dateFormatString(this.value,this.format).symbols,n=0;n<e.length;n++)this.setExisting(e[n],t)},t.prototype.getExisting=function(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;case"S":return this.milliseconds;default:return!0}},t.prototype.setExisting=function(t,e){switch(t){case"y":this.year=e,!1===e&&this._value.setFullYear(2e3);break;case"M":this.month=e,!1===e&&this.autoCorrectParts&&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;case"S":this.milliseconds=e}this.getValue()&&this.resetInvalidDate()},t.prototype.modifyPart=function(t,e){if(a.isPresent(t)&&a.isPresent(e)&&0!==e){var n,r=i.cloneDate(this.value),s=!1,o="M"===t,l="d"===t||"E"===t,h=this.getExisting(t);if(this.autoCorrectParts||!l&&!o)switch(t){case"y":r.setFullYear(r.getFullYear()+e);break;case"M":r=i.addMonths(this.value,e);break;case"d":case"E":r.setDate(r.getDate()+e);break;case"h":case"H":r.setHours(r.getHours()+e),s=!0;break;case"m":r.setMinutes(r.getMinutes()+e),s=!0;break;case"s":r.setSeconds(r.getSeconds()+e),s=!0;break;case"S":r.setMilliseconds(r.getMilliseconds()+e);break;case"a":r.setHours(r.getHours()+12*e),s=!0}else{var u=this._partiallyInvalidDate.invalidDateParts||{},c=this.getInvalidDatePartValue(t),d=u.y.value||r.getFullYear(),p=u.M.value||r.getMonth(),m=u.d.value||u.E.value||r.getDate(),f=u.h.value||u.H.value||r.getHours(),v=u.m.value||r.getMinutes(),g=u.s.value||r.getSeconds(),y=u.S.value||r.getMilliseconds();switch(t){case"y":d+=e;break;case"M":p+=e;break;case"d":case"E":m+=e}if("M"===t){if((p<0||p>11)&&h)return this.setExisting(t,!1),void this.resetInvalidDateSymbol(t);if(!h){if(p<0)p=a.clamp(p%11+1+11,0,11);else{var D=a.isPresent(c)?p:(e-1)%12;p=a.clamp(D,0,11)}p=a.clamp(p,0,11)}p=a.clamp(p,0,11)}else if("d"===t)if(h){if(m<=0||m>31)return this.setExisting(t,!1),void this.resetInvalidDateSymbol(t)}else if(!h){if(a.isPresent(c)&&(m<=0||m>31))return this.setExisting(t,!1),void this.resetInvalidDateSymbol(t);if(e<0){var E=a.isPresent(c)?m:31-Math.abs(e%31)+1;m=a.clamp(E,1,31)}else{E=a.isPresent(c)?m:e%31;m=a.clamp(E,1,31)}m=a.clamp(m,1,31)}var b=i.createDate(d,p,m,f,v,g,y),P=o||l?this.modifyDateSymbolWithValue(r,t,o?p:m):null,S=a.areDatePartsEqualTo(b,d,p,m,f,v,g,y);this.getValue()&&a.areDatePartsEqualTo(b,d,p,m,f,v,g,y)?(r=i.cloneDate(b),this.markDatePartsAsExisting()):o&&P?P.getMonth()===p?this.getExisting("d")?S?(r=i.cloneDate(b),this.resetInvalidDateSymbol(t)):(n=!0,this.setInvalidDatePart(t,{value:p,date:i.cloneDate(P),startDateOffset:e,startDate:i.cloneDate(this.value)}),this.setExisting(t,!1)):S?(this.resetInvalidDateSymbol(t),r=i.cloneDate(b),this.getExisting("M")&&this.getExisting("y")&&(this.setExisting("d",!0),this.resetInvalidDateSymbol("d"))):(this.resetInvalidDateSymbol(t),r=i.cloneDate(P)):(n=!0,this.setInvalidDatePart(t,{value:p,date:i.cloneDate(P),startDateOffset:e,startDate:i.cloneDate(this.value)}),this.setExisting(t,!1)):l&&P&&(P.getDate()===m?this.getExisting("M")?S?(r=i.cloneDate(b),this.resetInvalidDateSymbol(t)):(n=!0,this.setInvalidDatePart(t,{value:m,date:i.cloneDate(P),startDateOffset:e,startDate:i.cloneDate(this.value)}),this.setExisting(t,!1)):S?(r=i.cloneDate(b),this.resetInvalidDateSymbol(t),this.getExisting("d")&&this.getExisting("y")&&(this.setExisting("M",!0),this.resetInvalidDateSymbol("M"))):(this.resetInvalidDateSymbol(t),r=i.cloneDate(P)):(n=!0,this.setInvalidDatePart(t,{value:m,date:i.cloneDate(this.value),startDateOffset:e,startDate:i.cloneDate(this.value)}),this.setExisting(t,!1)))}this.shouldNormalizeCentury()&&(r=this.normalizeCentury(r)),s&&!this.cycleTime&&(r.getDate(),this._value.getDate()),n||(this.setExisting(t,!0),this._value=r,this.getValue()&&this.resetInvalidDate())}},t.prototype.parsePart=function(t){for(var e,n=t.symbol,r=t.currentChar,o=t.resetSegmentValue,l=t.cycleSegmentValue,h=t.rawTextValue,u=t.isDeleting,c=t.originalFormat,d=!l,p=this.dateFormatString(this.value,this.format),m=p.partMap.filter((function(t){return"literal"===t.type})).map((function(t,e){return{datePartIndex:e,type:t.type,pattern:t.pattern,literal:""}})),f=0;f<m.length;f++){for(var v=m[f],g=0;g<v.pattern.length;g++)m[f+g]&&(m[f+g].literal=v.pattern[g]);f+=v.pattern.length-1}var y={value:null,switchPart:!1,resetPart:d&&"M"===n&&p.partMap.filter((function(t){return"month"===t.type})).some((function(t){return t.pattern.length>2}))};if(!r){if(!d)return this.resetLeadingZero(),this.setExisting(n,!1),this.resetInvalidDateSymbol(n),{value:null,switchToNext:!1};for(f=0;f<m.length;f++){var D=m[f].literal,E=h.startsWith(D),b=h.endsWith(D),P=h.indexOf(D+D)>=0;if(E||b||P)return this.resetLeadingZero(),this.setExisting(n,!1),this.resetInvalidDateSymbol(n),a.extend(y,{value:null,switchToNext:!1})}}var S=this.intl.formatDate(this.value,this.format,this.localeId),M=p.symbols,I=!1,x="",C="",O="",w="",F="",V="",k=c.indexOf(n),T=c.lastIndexOf(n)-k+1,_=this.format===M||this.format===c||this.format.length===c.length,A=0;if(d||!d&&!this.autoCorrectParts){for(f=0;f<S.length;f++){if(M[f]===n)C+=this.getExisting(n)?S[f]:"0",u?(A<T-1&&(O+=h[f]||""),A++):O+=h[f]||"",I=!0;else I?(V+=S[f],F+=S[f]):(x+=S[f],w+=S[f])}if(_&&this.autoCorrectParts){if(c.length<h.length)O+=r;else if(!u&&c.length>h.length){var N=c.length-h.length;(j=O.substring(0,O.length-N))&&j.length>0&&(O=j)}if(O.length>T)return a.extend(y,{value:null,switchToNext:!1})}else{A=0,C="",O="",x="",V="",I=!1;for(f=0;f<c.length;f++){if(c[f]===n)C+=this.getExisting(n)?S[f]||"":"0",u?(A<T-1&&(O+=h[f]||""),A++):O+=h[f]||"",I=!0;else I?V+=h[f]||"":x+=h[f]||""}if(c.length<h.length)O+=r;else if(!u&&c.length>h.length){var j;N=c.length-h.length;if((j=O.substring(0,O.length-N))&&j.length>0){var L=O;x+(O=j)+V!==h&&(V=L.substring(O.length)+V)}}}}if(!d)if(this.autoCorrectParts){A=0,C="",O="",x="",V="",I=!1;for(f=0;f<S.length;f++){if(M[f]===n)C+=this.getExisting(n)?S[f]:"0",I=!0;else I?V+=S[f]:x+=S[f]}}else C=o?O:C;var K=null,B=this.matchMonth(r),W=this.matchDayPeriod(r,n),H="0"===r,R=this.leadingZero||{};H&&!d?0!==parseInt(o?r:C+r,10)||this.isAbbrMonth(p.partMap,n)||this.incrementLeadingZero(n):this.resetLeadingZero();var Z=this.partPattern(p.partMap,n),Y=Z?Z.pattern:null;if(d&&u&&!O)return this.setExisting(n,!1),a.extend(y,{value:null,switchToNext:!1});var U=C.length-3,q=!0,z=d?O:C;for(f=Math.max(0,U);f<=C.length&&q;f++){z=o?r:d?O:C.substring(f)+r,this.autoCorrectParts||(q=!1,d||(z=s.unpadZero(z),z=s.padZero(T-z.length)+z)),d&&(q=!1,z=s.unpadZero(z));var G=parseInt(z,10),J=x+z+V;K=this.intl.parseDate(J,this.format,this.localeId),!d||_||a.isValidDate(K)||this.autoCorrectParts&&(K=this.intl.parseDate(w+z+F,this.format,this.localeId),O=z);var Q=!isNaN(parseInt(r,10))||d&&u&&""===r;if(!K&&!isNaN(G)&&Q&&this.autoCorrectParts){if("M"===n&&!B){var X=G-1;X>-1&&X<12&&((K=i.cloneDate(this.value)).setMonth(X),K.getMonth()!==X&&(K=i.lastDayOfMonth(i.addMonths(K,-1))))}"y"===n&&(K=i.createDate(parseInt(z,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&&a.isValidDate(K)||!d&&K)&&this.date&&K.getDate()!==this.value.getDate()&&(K=i.lastDayOfMonth(i.addMonths(K,-1))))}if(d&&a.isValidDate(K)||!d&&K){var $=this.intl.parseDate(""+x+this.peek(z,Y)+V,this.format,this.localeId),tt=this.patternLength(Y)||Y.length,et=((this.leadingZero||{})[n]||0)+(s.unpadZero(z)||r).length>=tt,nt=null===$||R[n]&&Y.length<=z.length||et;if(this.shouldNormalizeCentury()&&(K=this.normalizeCentury(K)),this._value=K,this.setExisting(n,!0),this.resetInvalidDateSymbol(n),this.autoCorrectParts||("M"===n?this.getExisting("M")&&this.getExisting("y")&&(this.setExisting("d",!0),this.resetInvalidDateSymbol("d")):"d"===n&&this.getExisting("d")&&this.getExisting("y")&&(this.setExisting("M",!0),this.resetInvalidDateSymbol("M")),this.hasInvalidDatePart()||this.markDatePartsAsExisting()),d&&nt)if("M"===n){if(T<=2)nt=(it=a.parseToInt(O))>=2}else nt=nt?_?O.length===T:O.length>T:nt;return a.extend(y,{value:this.value,switchToNext:nt})}}if(B&&(K=this.intl.parseDate(x+B+V,this.format,this.localeId)))return this._value=K,this.setExisting(n,!0),a.extend(y,{value:this.value,switchToNext:!1});if(W&&(K=this.intl.parseDate(x+W+V,this.format)))return this._value=K,a.extend(y,{value:this.value,switchToNext:!0});if(H&&(this.leadingZero=this.isAbbrMonth(p.partMap,n)?null:((e={})[n]=!0,e),this.setExisting(n,!1)),d&&O.length>T)return a.extend(y,{value:null,switchToNext:!1});if(!this.autoCorrectParts){var it=void 0,rt=d?O:z,st=a.parseToInt(rt);if(a.isNumber(st))return"d"===n&&(st<=0||st>31)||"M"===n&&(st<0||st>11)?a.extend(y,{value:null,switchToNext:!1}):(it="M"===n?a.clamp(st-1,0,11):st,this.setExisting(n,!1),this.setInvalidDatePart(n,{value:it,date:i.cloneDate(this.value),startDate:this._partiallyInvalidDate.startDate||i.cloneDate(this.value)}),a.extend(y,{value:null,switchToNext:!1,hasInvalidDatePart:!0}))}return a.extend(y,{value:null,switchToNext:!1})},t.prototype.symbolMap=function(t){return this.intl.splitDateFormat(this.format,this.localeId).reduce(s.dateSymbolMap,{})[t]},t.prototype.resetLeadingZero=function(){var t=null!==this.leadingZero;return this.setLeadingZero(null),t},t.prototype.setLeadingZero=function(t){this.leadingZero=t},t.prototype.normalizeCentury=function(t){if(!a.isPresent(t))return t;var e=a.cropTwoDigitYear(t),n=this.getNormalizedCenturyBase(e);return a.setYears(t,n+e)},t.prototype.incrementLeadingZero=function(t){var e=this.leadingZero||{};e[t]=(e[t]||0)+1,this.leadingZero=e},t.prototype.isAbbrMonth=function(t,e){var n=this.partPattern(t,e);return"month"===n.type&&n.names},t.prototype.partPattern=function(t,e){return t.filter((function(t){return-1!==t.pattern.indexOf(e)}))[0]},t.prototype.peek=function(t,e){var n=t.replace(/^0*/,"")+"0";return s.padZero(e.length-n.length)+n},t.prototype.matchMonth=function(t){if(this.typedMonthPart+=t.toLowerCase(),0===this.monthNames.length)return"";for(;this.typedMonthPart.length>0;){for(var e=0;e<this.monthNames.length;e++)if(0===this.monthNames[e].toLowerCase().indexOf(this.typedMonthPart))return this.monthNames[e];var n=parseInt(this.typedMonthPart,10);if(n>=1&&n<=12&&n.toString()===this.typedMonthPart)return this.monthNames[n-1];this.typedMonthPart=this.typedMonthPart.substring(1,this.typedMonthPart.length)}return""},t.prototype.matchDayPeriod=function(t,e){var n=t.toLowerCase();if("a"===e&&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""},t.prototype.allFormattedMonths=function(t){void 0===t&&(t="en");for(var e=this.intl.splitDateFormat(this.format,this.localeId),n=0;n<e.length;n++)if("month"===e[n].type&&e[n].names)return this.intl.dateFormatNames(t,e[n].names);return[]},t.prototype.allDayPeriods=function(t){void 0===t&&(t="en");for(var e=this.intl.splitDateFormat(this.format),n=0;n<e.length;n++)if("dayperiod"===e[n].type&&e[n].names)return this.intl.dateFormatNames(t,e[n].names);return null},t.prototype.patternLength=function(t){return"y"===t[0]?4:l.test(t)?2:0},t.prototype.dateFormatString=function(t,e){for(var n=this.intl.splitDateFormat(e,this.localeId),i=[],s=[],a=0;a<n.length;a++)for(var l=this.intl.formatDate(t,{pattern:n[a].pattern},this.localeId).length;l>0;)i.push(this.symbols[n[a].pattern[0]]||o.Constants.formatSeparator),s.push(n[a]),l--;var h=new r.Mask;return h.symbols=i.join(""),h.partMap=s,h},t.prototype.merge=function(t,e){for(var n="",i="",r=e.symbols,o=!1,l=0,h=this.getFormattedInvalidDates(r),u=r.length-1;u>=0;u--){var c=this.getPartsForSegment(e,u);if(-1===this.knownParts.indexOf(r[u])||this.getExisting(r[u]))this.autoCorrectParts?n=t[u]+n:t.length!==r.length?o?n=t[u]+n:l>0?(n=t[u]+n,--l<=0&&(o=!0)):n=(t[u+t.length-r.length]||"")+n:n=t[u]+n,i=r[u]+i;else{var d=r[u],p=0;if(this.autoCorrectParts||!this.autoCorrectParts&&!this.getInvalidDatePartValue(d)){for(;u>=0&&d===r[u];)u--;u++}if(this.leadingZero&&this.leadingZero[d])n="0"+n;else if(!this.autoCorrectParts&&this.getInvalidDatePartValue(d)){var m=this.getInvalidDatePartValue(d).toString();if("M"===d)if(m=(a.parseToInt(this.getInvalidDatePartValue(d))+1).toString(),c.length>2)n=h[d][u]+n;else m=(a.parseToInt(this.getInvalidDatePartValue(d))+1).toString(),n=s.padZero(c.length-m.length)+m+n,p=c.length-1,l=m.length-c.length;else n=s.padZero(c.length-m.length)+m+n,p=c.length-1,l=m.length-c.length}else n=this.dateFieldName(e.partMap[u])+n;for(;i.length<n.length;)i=r[u]+i;0!==p&&(u=u-p+(t.length-r.length))}}return{text:n,format:i}},t.prototype.dateFieldName=function(t){var e=this.formatPlaceholder||"wide";return e[t.type]?e[t.type]:"formatPattern"===e?t.pattern:this.intl.dateFieldName(Object.assign(t,{nameType:e}))},t.prototype.getNormalizedCenturyBase=function(t){return t>this.twoDigitYearMax?1900:2e3},t.prototype.shouldNormalizeCentury=function(){return this.intl.splitDateFormat(this.format).some((function(t){return"yy"===t.pattern}))},t.prototype.resetInvalidDate=function(){var t=this;this._partiallyInvalidDate.startDate=null,Object.keys(this._partiallyInvalidDate.invalidDateParts).forEach((function(e){t.resetInvalidDatePart(e)}))},t.prototype.resetInvalidDateSymbol=function(t){var e=this;this.resetInvalidDatePart(t);var n=!0;Object.keys(this._partiallyInvalidDate.invalidDateParts).forEach((function(t){e._partiallyInvalidDate.invalidDateParts[t]&&a.isPresent(e._partiallyInvalidDate.invalidDateParts[t].value)&&(n=!1)})),n&&this.resetInvalidDate()},t.prototype.resetInvalidDatePart=function(t){this._partiallyInvalidDate.invalidDateParts[t]&&(this._partiallyInvalidDate.invalidDateParts[t]={value:null,date:null,startDateOffset:0})},t.prototype.getInvalidDatePart=function(t){return this._partiallyInvalidDate.invalidDateParts[t]||{}},t.prototype.getInvalidDatePartValue=function(t){return(this._partiallyInvalidDate.invalidDateParts[t]||{}).value},t.prototype.setInvalidDatePart=function(t,e){var n=e.value,i=void 0===n?null:n,r=e.date,s=void 0===r?null:r,o=e.startDateOffset,l=void 0===o?0:o,h=e.startDate,u=void 0===h?null:h,c=i;"d"===t?c=a.clamp(a.isPresent(i)?i:1,1,31):"M"===t&&(c=a.clamp(a.isPresent(i)?i:0,0,11)),this._partiallyInvalidDate.invalidDateParts[t]&&(this._partiallyInvalidDate.invalidDateParts[t].value=c,this._partiallyInvalidDate.invalidDateParts[t].date=s,this._partiallyInvalidDate.invalidDateParts[t].startDateOffset=l,this._partiallyInvalidDate.startDate=u)},t.prototype.hasInvalidDatePart=function(){var t=this,e=!1;return Object.keys(this._partiallyInvalidDate.invalidDateParts).forEach((function(n){t._partiallyInvalidDate.invalidDateParts[n]&&a.isPresent(t._partiallyInvalidDate.invalidDateParts[n].value)&&(e=!0)})),e},t.prototype.modifyDateSymbolWithOffset=function(t,e,n){var r=i.cloneDate(t),s=!1;switch(e){case"y":r.setFullYear(r.getFullYear()+n);break;case"M":r=i.addMonths(this.value,n);break;case"d":case"E":r.setDate(r.getDate()+n);break;case"h":case"H":r.setHours(r.getHours()+n),s=!0;break;case"m":r.setMinutes(r.getMinutes()+n),s=!0;break;case"s":r.setSeconds(r.getSeconds()+n),s=!0;break;case"S":r.setMilliseconds(r.getMilliseconds()+n);break;case"a":r.setHours(r.getHours()+12*n),s=!0}return{date:r,timeModified:s}},t.prototype.modifyDateSymbolWithValue=function(t,e,n){var r=i.cloneDate(t);switch(e){case"y":r.setFullYear(n);break;case"M":r=i.addMonths(t,n-t.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)}return r},t.prototype.markDatePartsAsExisting=function(){this.modifyExisting(!0)},t.prototype.getPartsForSegment=function(t,e){for(var n=t.partMap[e],i=[],r=e;r<t.partMap.length;r++){var s=t.partMap[r];if(n.type!==s.type||n.pattern!==s.pattern)break;i.push(s)}for(r=e-1;r>=0;r--){s=t.partMap[r];if(n.type!==s.type||n.pattern!==s.pattern)break;i.unshift(s)}return i},t}();e.DateObject=h},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){this.symbols="",this.partMap=[]};e.Mask=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.KeyCode={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}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),r={events:{}},s=function(){function t(t){this.options=i.extend({},r,t)}return t.prototype.destroy=function(){},t.prototype.trigger=function(t,e){void 0===e&&(e={});var n={defaultPrevented:!1,preventDefault:function(){n.defaultPrevented=!0}};return!!i.isFunction(this.options.events[t])&&(this.options.events[t](i.extend(n,e,{sender:this})),n.defaultPrevented)},t}();e.Observable=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.None="none",t.Caret="caret",t.Selection="selection"}(e.DateInputInteractionMode||(e.DateInputInteractionMode={}))}])}));
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@progress/kendo-date-math"),require("tslib")):"function"==typeof define&&define.amd?define([,],e):"object"==typeof exports?exports.KendoDateinputsCommon=e(require("@progress/kendo-date-math"),require("tslib")):t.KendoDateinputsCommon=e(t.KendoDateMath,t.self)}(window,(function(t,e){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var a=e[i]={i:i,l:!1,exports:{}};return t[i].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)n.d(i,a,function(e){return t[e]}.bind(null,a));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=5)}([function(e,n){e.exports=t},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Constants={formatSeparator:"_",twoDigitYearMax:68,defaultDateFormat:"d",defaultLocaleId:"en"}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,a=n(0),s=function(t){return t&&"object"==typeof t&&!Array.isArray(t)},r=function(t){return t instanceof HTMLElement};e.isPresent=function(t){return null!=t},e.isDocumentAvailable=function(){return!!document},e.isNumber=function(t){return e.isPresent(t)&&"number"==typeof t&&!Number.isNaN(t)},e.parseToInt=function(t){return parseInt(t,10)},e.clamp=function(t,e,n){return Math.min(n,Math.max(e,t))},e.extend=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Object.assign.apply(Object,t)},e.deepExtend=function(t){for(var n,i,a=[],o=1;o<arguments.length;o++)a[o-1]=arguments[o];if(!a.length)return t;var l=a.shift();if(s(t)&&s(l))for(var h in l)r(l[h])?t[h]=l[h]:s(l[h])?(t[h]||e.extend(t,((n={})[h]={},n)),e.deepExtend(t[h],l[h])):e.extend(t,((i={})[h]=l[h],i));return e.deepExtend.apply(void 0,[t].concat(a))},e.noop=function(){},e.isFunction=function(t){return"function"==typeof t},e.cropTwoDigitYear=function(t){return!e.isPresent(t)||isNaN(t.getTime())?0:Number(t.getFullYear().toString().slice(-2))},e.setYears=(i="setFullYear",function(t,e){var n=a.cloneDate(t);return n[i](e),n}),e.millisecondDigitsInFormat=function(t){var e=t&&t.match(/S+(\1)/);return e?e[0].length:0},e.millisecondStepFor=function(t){return Math.pow(10,3-t)},e.areDatePartsEqualTo=function(t,e,n,i,a,s,r,o){return!(!t||t.getFullYear()!==e||t.getMonth()!==n||t.getDate()!==i||t.getHours()!==a||t.getMinutes()!==s||t.getSeconds()!==r||t.getMilliseconds()!==o)},e.isValidDate=function(t){return e.isPresent(t)&&t.getTime&&e.isNumber(t.getTime())}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),a=n(4);e.padZero=function(t){return new Array(Math.max(t,0)).fill("0").join("")},e.unpadZero=function(t){return t.replace(/^0*/,"")},e.approximateStringMatching=function(t){var e=t.oldText,n=t.newText,s=t.formatPattern,r=t.selectionStart,o=t.isInCaretMode,l=t.keyEvent,h=e[r+e.length-n.length],u=e.substring(0,r+e.length-n.length),c=n.substring(0,r),d=[];if(u===c&&r>0)return d.push([s[r-1],c[r-1]]),d;if(0===u.indexOf(c)&&o&&(l.key===a.Key.DELETE||l.key===a.Key.BACKSPACE)||0===u.indexOf(c)&&!o&&(0===c.length||s[c.length-1]!==s[c.length])){var p="";o||1!==c.length||d.push([s[0],c[0]]);for(var m=c.length;m<u.length;m++)s[m]!==p&&s[m]!==i.Constants.formatSeparator&&(p=s[m],d.push([p,""]));return d}if(o&&(0===c.indexOf(u)||s[r-1]===i.Constants.formatSeparator)||!o&&(0===c.indexOf(u)||s[r-1]===i.Constants.formatSeparator)){var f=s[0];for(m=Math.max(0,u.length-1);m<s.length;m++)if(s[m]!==i.Constants.formatSeparator){f=s[m];break}return[[f,c[r-1]]]}return!o&&" "===c[c.length-1]||!o&&c[c.length-1]===h?[[s[r-1],i.Constants.formatSeparator]]:[[s[r-1],c[r-1]]]},e.dateSymbolMap=function(t,e){return t[e.pattern[0]]=e.type,t},e.isInRange=function(t,e,n){return null===t||!(e&&e>t||n&&n<t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Key={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"}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(6);e.DateInput=i.DateInput},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,a=n(7),s=n(8),r=n(3),o=n(10),l=n(4),h=n(2),u=n(11),c=n(12),d=n(0),p=n(1),m={format:"d",allowNulls:!1,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:(i={},i.valueChange=null,i.input=null,i.inputEnd=null,i.focus=null,i.focusEnd=null,i.blur=null,i.blurEnd=null,i.keydown=null,i.mousewheel=null,i.change=null,i),selectNearestSegmentOnFocus:!1,enableMouseWheel:!1,allowCaretMode:!1,autoSwitchParts:!0,autoSwitchKeys:[],twoDigitYearMax:p.Constants.twoDigitYearMax,autoCorrectParts:!0},f=function(t){function e(e,n){var i=t.call(this,n)||this;return i.dateObject=null,i.currentText="",i.currentFormat="",i.interactionMode=c.DateInputInteractionMode.None,i.previousElementSelection={start:0,end:0},i.init(e,n),i}return a.__extends(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.dateObject&&this.dateObject.getValue()},enumerable:!0,configurable:!0}),e.prototype.init=function(t,e){var n=h.isValidDate(this.options.value)?d.cloneDate(this.options.value):new Date(e.formattedValue);h.isValidDate(n)||(n=null),this.element=t,this.options=h.extend({},m,e),this.intl=this.options.intlService,this.formatPlaceholder=this.options.formatPlaceholder?this.options.formatPlaceholder:"formatPattern",this.dateObject=this.createDateObject(),this.dateObject.setValue(n),this.setTextAndFormat(),this.bindEvents(),this.resetSegmentValue=!0,this.interactionMode=c.DateInputInteractionMode.None,this.forceUpdate()},e.prototype.destroy=function(){this.unbindEvents(),this.dateObject=null,t.prototype.destroy.call(this)},e.prototype.bindEvents=function(){this.onElementDragStart=this.onElementDragStart.bind(this),this.element.addEventListener("dragStart",this.onElementDragStart),this.onElementDrop=this.onElementDrop.bind(this),this.element.addEventListener("drop",this.onElementDrop),this.onElementClick=this.onElementClick.bind(this),this.element.addEventListener("click",this.onElementClick),this.onElementMouseDown=this.onElementMouseDown.bind(this),this.element.addEventListener("mousedown",this.onElementMouseDown),this.element.addEventListener("touchstart",this.onElementMouseDown),this.onElementMouseUp=this.onElementMouseUp.bind(this),this.element.addEventListener("mouseup",this.onElementMouseUp),this.onElementInput=this.onElementInput.bind(this),this.element.addEventListener("input",this.onElementInput),this.onElementKeyDown=this.onElementKeyDown.bind(this),this.element.addEventListener("keydown",this.onElementKeyDown),this.onElementFocus=this.onElementFocus.bind(this),this.element.addEventListener("focus",this.onElementFocus),this.onElementBlur=this.onElementBlur.bind(this),this.element.addEventListener("blur",this.onElementBlur),this.onElementChange=this.onElementChange.bind(this),this.element.addEventListener("change",this.onElementChange),this.onElementPaste=this.onElementPaste.bind(this),this.element.addEventListener("paste",this.onElementPaste),this.onElementMouseWheel=this.onElementMouseWheel.bind(this),this.element.addEventListener("DOMMouseScroll",this.onElementMouseWheel),this.element.addEventListener("mousewheel",this.onElementMouseWheel)},e.prototype.unbindEvents=function(){this.element.removeEventListener("dragStart",this.onElementDragStart),this.element.removeEventListener("drop",this.onElementDrop),this.element.removeEventListener("touchstart",this.onElementMouseDown),this.element.removeEventListener("mousedown",this.onElementMouseDown),this.element.removeEventListener("mouseup",this.onElementMouseUp),this.element.removeEventListener("click",this.onElementClick),this.element.removeEventListener("input",this.onElementInput),this.element.removeEventListener("keydown",this.onElementKeyDown),this.element.removeEventListener("focus",this.onElementFocus),this.element.removeEventListener("blur",this.onElementBlur),this.element.removeEventListener("change",this.onElementChange),this.element.removeEventListener("paste",this.onElementPaste),this.element.removeEventListener("DOMMouseScroll",this.onElementMouseWheel),this.element.removeEventListener("mousewheel",this.onElementMouseWheel)},e.prototype.setOptions=function(t,e){void 0===e&&(e=!1),this.options=h.extend(this.options,t),e&&(this.unbindEvents(),this.init(this.element,this.options))},e.prototype.resetLocale=function(){this.unbindEvents(),this.init(this.element,this.options)},e.prototype.isInCaretMode=function(){return this.interactionMode===c.DateInputInteractionMode.Caret},e.prototype.focus=function(){this.element.focus(),this.options.selectNearestSegmentOnFocus&&this.selectNearestSegment(0)},e.prototype.onElementDragStart=function(t){t.preventDefault()},e.prototype.onElementDrop=function(t){t.preventDefault()},e.prototype.onElementMouseDown=function(){this.mouseDownStarted=!0,this.focusedPriorToMouseDown=this.isActive},e.prototype.onElementMouseUp=function(t){this.mouseDownStarted=!1,t.preventDefault()},e.prototype.onElementClick=function(t){this.mouseDownStarted=!1;var e=this.selection;if(this.isInCaretMode()&&this.forceUpdate(),3===t.detail);else if(this.isActive&&this.options.selectNearestSegmentOnFocus){var n=this.element.selectionStart!==this.element.selectionEnd,i=h.isPresent(this.options.placeholder)&&!this.dateObject.hasValue()&&!this.focusedPriorToMouseDown,a=!n&&i?0:this.caret()[0];this.selectNearestSegment(a)}else this.setSelection(this.selectionByIndex(e.start))},e.prototype.onElementInput=function(t){this.triggerInput({event:t});var e=this.keyDownEvent||{},n=e.keyCode===o.KeyCode.BACKSPACE||e.key===l.Key.BACKSPACE,i=e.keyCode===o.KeyCode.DELETE||e.key===l.Key.DELETE;if(this.element&&this.dateObject){if(this.isPasteInProgress)return this.options.allowCaretMode&&(this.resetSegmentValue=!1),this.updateOnPaste(t),void(this.isPasteInProgress=!1);var a=this.interactionMode;!this.options.allowCaretMode||a===c.DateInputInteractionMode.Caret||i||n||(this.resetSegmentValue=!0),this.options.allowCaretMode?this.interactionMode=c.DateInputInteractionMode.Caret:this.interactionMode=c.DateInputInteractionMode.Selection;var s=this.isInCaretMode();if(s&&this.keyDownEvent.key===l.Key.SPACE)this.restorePreviousInputEventState();else{var u=this.dateObject&&this.dateObject.getValue(),m=this.dateObject.getTextAndFormat(),f=m.text,v=m.format;this.currentFormat=v;var g="";g=s&&(n||i||a===c.DateInputInteractionMode.Caret)?this.previousElementValue:f;var y=this.elementValue,D=r.approximateStringMatching({oldText:g,newText:y,formatPattern:this.currentFormat,selectionStart:this.selection.start,isInCaretMode:s,keyEvent:this.keyDownEvent}),E=this.formatStateOnKeyDown.format[this.formatStateOnKeyDown.selectionStart]||"";if(this.options.allowCaretMode&&s&&this.currentFormat.length!==this.elementValue.length&&E&&E.length>0&&E!==p.Constants.formatSeparator&&(D&&0!==D.length?D[0]&&D[0][0]!==p.Constants.formatSeparator&&D[0][0]!==E&&(D[0][0]=E,D[0][1]=t.data||""):((D=[])[0][0]=E,D[0][1]=t.data||"")),!s||D&&0!==D.length){if(s&&1===D.length){if(!D[0]||!D[0][0])return void this.restorePreviousInputEventState();if(s&&D[0]&&(D[0][0]===p.Constants.formatSeparator||D[0][1]===p.Constants.formatSeparator))return void this.restorePreviousInputEventState()}var b=1===D.length&&D[0][1]===p.Constants.formatSeparator,S=[],P=!1;if(!b)for(var M=0;M<D.length;M++){var I=this.dateObject.parsePart({symbol:D[M][0],currentChar:D[M][1],resetSegmentValue:this.resetSegmentValue,cycleSegmentValue:!this.isInCaretMode(),rawTextValue:this.element.value,isDeleting:n||i,originalFormat:this.currentFormat});S.push(I),P=I.switchToNext}this.options.autoSwitchParts||(P=!1),this.resetSegmentValue=!1;var x,C=S[S.length-1],O=C&&!C.value,w=s&&(n||i)&&O,F=!!C&&C.resetPart,V=!!C&&C.hasInvalidDatePart,k=!d.isEqual(u,this.dateObject.value),T=this.selection;if((!s||w||F)&&(F&&(x=this.currentFormat[T.start]),this.forceUpdate()),D.length&&D[0][0]!==p.Constants.formatSeparator)if(!s||w||F)x?this.setSelection(this.selectionBySymbol(x)):(this.options.autoSwitchParts||D[0][1]!==p.Constants.formatSeparator)&&this.setSelection(this.selectionBySymbol(D[0][0]));else if(s)if(k&&h.isPresent(this.dateObject.getValue())||!k&&P&&h.isPresent(this.dateObject.getValue())){if(P)this.switchDateSegment(1);else if(this.options.format.length!==this.currentFormat.length&&E&&"y"!==E){var _=this.elementValue.length;this.forceUpdate();var N=this.elementValue.length-_;this.setSelection({start:T.start+N,end:T.start+N})}}else if(O){var A=this.dateObject.getLeadingZero()[E];P?this.switchDateSegment(1):"0"===t.data&&A||this.restorePreviousInputEventState()}if(P||!s||n||i||F||!O)this.options.autoSwitchParts&&(P||b)&&(s||this.switchDateSegment(1));else if(k)this.currentFormat.length===this.elementValue.length||a!==c.DateInputInteractionMode.Caret&&k||(a!==c.DateInputInteractionMode.Caret?(x=this.currentFormat[T.start],this.forceUpdate(),this.setSelection(this.selectionBySymbol(x))):V||this.restorePreviousInputEventState());else{A=this.dateObject.getLeadingZero()[E];"0"===t.data&&A||V||this.restorePreviousInputEventState()}this.tryTriggerValueChange({oldValue:u,event:t}),this.triggerInputEnd({event:t}),s&&this.setTextAndFormat()}else this.restorePreviousInputEventState()}}},e.prototype.onElementFocus=function(t){this.triggerFocus({event:t})||(this.isActive=!0,this.interactionMode=c.DateInputInteractionMode.None,this.refreshElementValue(),this.mouseDownStarted||this.caret(0,this.elementValue.length),this.mouseDownStarted=!1,this.triggerFocusEnd({event:t}))},e.prototype.onElementBlur=function(t){this.resetSegmentValue=!0,this.isActive=!1,this.triggerBlur({event:t})||(this.interactionMode=c.DateInputInteractionMode.None,this.refreshElementValue(),this.triggerBlurEnd({event:t}))},e.prototype.onElementChange=function(t){this.triggerChange({event:t})},e.prototype.onElementKeyDown=function(t){if(!this.triggerKeyDown({event:t})){var e=this.selection,n=e.start,i=e.end;this.keyDownEvent=t,this.previousElementValue=this.element.value,this.formatStateOnKeyDown={format:this.currentFormat,selectionStart:n,selectionEnd:i},this.previousElementSelection={start:n,end:i};var a=(this.options.autoSwitchKeys||[]).map((function(t){return t.toString().toLowerCase().trim()}));if(a.indexOf(t.keyCode.toString())>=0||a.indexOf(t.keyCode)>=0||a.indexOf(t.key.toLowerCase().trim())>=0){var s=a.indexOf(l.Key.TAB.toLowerCase().trim())>=0||a.indexOf(o.KeyCode.TAB)>=0||a.indexOf(o.KeyCode.TAB.toString())>=0;if(!s)return t.preventDefault(),void this.switchDateSegment(1);var r=this.selection,h=r.start,u=r.end;if(t.shiftKey&&s?this.switchDateSegment(-1):this.switchDateSegment(1),h!==this.selection.start||u!==this.selection.end)return void t.preventDefault()}var c=this.currentFormat[this.selection.start],d=this.getStepFromSymbol(c),p=!1;if(!(t.altKey||t.ctrlKey||t.metaKey||t.keyCode===o.KeyCode.TAB)){switch(t.keyCode){case o.KeyCode.ARROW_LEFT:this.switchDateSegment(-1),p=!0;break;case o.KeyCode.ARROW_UP:this.modifyDateSegmentValue(d,c,event),p=!0;break;case o.KeyCode.ARROW_RIGHT:this.switchDateSegment(1),p=!0;break;case o.KeyCode.ARROW_DOWN:this.modifyDateSegmentValue(-d,c,event),p=!0;break;case o.KeyCode.ENTER:break;case o.KeyCode.DELETE:case o.KeyCode.BACKSPACE:if(this.options.allowNulls){var m=this.dateObject.value;this.dateObject.setValue(null),this.forceUpdate(),this.tryTriggerValueChange({oldValue:m,event:t})}return p=!0,void(t.keyCode===o.KeyCode.BACKSPACE&&((this.options.autoSwitchKeys||[]).indexOf(o.KeyCode.BACKSPACE)>=0||(this.options.autoSwitchKeys||[]).indexOf(l.Key.BACKSPACE)>=0)&&this.switchDateSegment(-1));case l.Key.HOME:this.selectNearestSegment(0);break;case l.Key.END:this.selectNearestSegment(this.elementValue.length);break;default:return}p&&t.preventDefault()}}},e.prototype.onElementPaste=function(){this.isPasteInProgress=!0},e.prototype.onElementMouseWheel=function(t){if(this.options.enableMouseWheel&&!this.triggerMouseWheel({event:t})&&this.isActive){var e=t;e.shiftKey?this.switchDateSegment((e.wheelDelta||-e.detail)>0?-1:1):this.modifyDateSegmentValue((e.wheelDelta||-e.detail)>0?1:-1),e.returnValue=!1,e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation()}},e.prototype.updateOnPaste=function(t){var e=this.intl.parseDate(this.elementValue,this.inputFormat)||this.value;h.isPresent(e)&&this.dateObject.shouldNormalizeCentury()&&(e=this.dateObject.normalizeCentury(e));var n=this.dateObject&&this.dateObject.getValue();this.writeValue(e),this.tryTriggerValueChange({oldValue:n,event:t})},Object.defineProperty(e.prototype,"elementValue",{get:function(){return(this.element||{}).value||""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"inputFormat",{get:function(){return this.options.format?"string"==typeof this.options.format?this.options.format:this.options.format.inputFormat:p.Constants.defaultDateFormat},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"displayFormat",{get:function(){return this.options.format?"string"==typeof this.options.format?this.options.format:this.options.format.displayFormat:p.Constants.defaultDateFormat},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selection",{get:function(){var t={start:0,end:0};return null!==this.element&&void 0!==this.element.selectionStart&&(t={start:this.element.selectionStart,end:this.element.selectionEnd}),t},enumerable:!0,configurable:!0}),e.prototype.setSelection=function(t){this.element&&document.activeElement===this.element&&this.element.setSelectionRange(t.start,t.end)},e.prototype.selectionBySymbol=function(t){for(var e=-1,n=0,i=0;i<this.currentFormat.length;i++)this.currentFormat[i]===t&&(n=i+1,-1===e&&(e=i));return e<0&&(e=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:e,end:n}},e.prototype.selectionByIndex=function(t){for(var e={start:t,end:t},n=t,i=t-1;n<this.currentFormat.length||i>=0;n++,i--){if(n<this.currentFormat.length&&this.currentFormat[n]!==p.Constants.formatSeparator){e=this.selectionBySymbol(this.currentFormat[n]);break}if(i>=0&&this.currentFormat[i]!==p.Constants.formatSeparator){e=this.selectionBySymbol(this.currentFormat[i]);break}}return e},e.prototype.switchDateSegment=function(t){var e=this.selection;if(this.isInCaretMode()){var n=e.start,i=this.currentFormat[n-(this.elementValue.length-this.currentFormat.length)]||this.currentFormat[n],a="",s="";if(t<0){for(var r=n+t;r>=0;r--)if((s=this.currentFormat[r])!==p.Constants.formatSeparator&&s!==i){n=r,a=s;break}}else for(r=n+t;r<this.currentFormat.length;r++)if((s=this.currentFormat[r])!==p.Constants.formatSeparator&&s!==i){n=r,a=s;break}if(a)return this.forceUpdate(),this.setSelection(this.selectionBySymbol(a)),void(this.interactionMode=c.DateInputInteractionMode.Selection)}this.interactionMode=c.DateInputInteractionMode.None;var o=this.selection,l=o.start,h=o.end;if(l<h&&this.currentFormat[l]!==this.currentFormat[h-1])return this.setSelection(this.selectionByIndex(t>0?l:h-1)),this.resetSegmentValue=!0,void(this.interactionMode=c.DateInputInteractionMode.None);for(var u=this.currentFormat[l],d=l+t;d>0&&d<this.currentFormat.length&&(this.currentFormat[d]===u||this.currentFormat[d]===p.Constants.formatSeparator);)d+=t;if(this.currentFormat[d]!==p.Constants.formatSeparator){for(var m=d;m>=0&&m<this.currentFormat.length&&this.currentFormat[m]===this.currentFormat[d];)m+=t;d>m&&(m+1!==l||d+1!==h)?(this.setSelection({start:m+1,end:d+1}),this.resetSegmentValue=!0):d<m&&(d!==l||m!==h)&&(this.setSelection({start:d,end:m}),this.resetSegmentValue=!0),this.interactionMode=c.DateInputInteractionMode.None}},e.prototype.modifyDateSegmentValue=function(t,e,n){if(void 0===e&&(e=""),void 0===n&&(n={}),this.dateObject){var i=this.value,a=1*t,s=this.caret();if("S"===(e=e||this.currentFormat[s[0]])&&!this.options.steps.millisecond){var r=h.millisecondDigitsInFormat(this.inputFormat);a=h.millisecondStepFor(r)}this.dateObject.modifyPart(e,a),this.tryTriggerValueChange({oldValue:i,event:n}),this.forceUpdate(),this.setSelection(this.selectionBySymbol(e))}},e.prototype.tryTriggerValueChange=function(t){if(void 0===t&&(t={oldValue:null,event:{}}),!d.isEqual(this.value,t.oldValue))return this.triggerValueChange(t)},e.prototype.triggerValueChange=function(t){return void 0===t&&(t={oldValue:null,event:{}}),this.trigger("valueChange",h.extend(t,{value:this.value}))},e.prototype.triggerInput=function(t){return void 0===t&&(t={event:{}}),this.trigger("input",h.extend(t,{value:this.value}))},e.prototype.triggerInputEnd=function(t){return void 0===t&&(t={event:{}}),this.trigger("inputEnd",h.extend(t,{value:this.value}))},e.prototype.triggerFocus=function(t){return void 0===t&&(t={event:{}}),this.trigger("focus",h.extend({},t))},e.prototype.triggerFocusEnd=function(t){return void 0===t&&(t={event:{}}),this.trigger("focusEnd",h.extend({},t))},e.prototype.triggerBlur=function(t){return void 0===t&&(t={event:{}}),this.trigger("blur",h.extend({},t))},e.prototype.triggerBlurEnd=function(t){return void 0===t&&(t={event:{}}),this.trigger("blurEnd",h.extend({},t))},e.prototype.triggerChange=function(t){return void 0===t&&(t={event:{}}),this.trigger("change",h.extend(t,{value:this.value}))},e.prototype.triggerKeyDown=function(t){return void 0===t&&(t={event:{}}),this.trigger("keydown",h.extend({},t))},e.prototype.triggerMouseWheel=function(t){return void 0===t&&(t={event:{}}),this.trigger("mousewheel",h.extend({},t))},e.prototype.forceUpdate=function(){this.setTextAndFormat(),this.refreshElementValue()},e.prototype.setTextAndFormat=function(){var t=this.dateObject.getTextAndFormat(),e=t.text,n=t.format;this.currentFormat=n,this.currentText=e},e.prototype.setElementValue=function(t){this.element.value=t},e.prototype.getStepFromSymbol=function(t){switch(t){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}},e.prototype.restorePreviousInputEventState=function(){this.restorePreviousElementValue(),this.restorePreviousElementSelection()},e.prototype.restorePreviousElementValue=function(){this.setElementValue(this.previousElementValue||"")},e.prototype.restorePreviousElementSelection=function(){var t=this.previousElementSelection,e=t.start,n=t.end;this.setSelection({start:e||0,end:n||0})},e.prototype.writeValue=function(t){this.verifyValue(t),this.dateObject=this.getDateObject(t),this.refreshElementValue()},e.prototype.verifyValue=function(t){if(t&&!h.isValidDate(t))throw new Error("The 'value' should be a valid JavaScript Date instance.")},e.prototype.refreshElementValue=function(){var t=this.caret()[0],e=this.element,n=this.isActive?this.inputFormat:this.displayFormat,i=this.dateObject.getTextAndFormat(n),a=i.text,s=i.format;this.currentFormat=s,this.currentText=a;var r=this.options.hasPlaceholder||h.isPresent(this.options.placeholder),o=!this.isActive&&r&&!this.dateObject.hasValue();r&&h.isPresent(this.options.placeholder)&&(e.placeholder=this.options.placeholder);var l=o?"":a;this.previousElementValue=this.elementValue,this.setElementValue(l),this.isActive&&!this.options.allowCaretMode&&this.options.selectNearestSegmentOnFocus&&this.selectNearestSegment(t)},e.prototype.caret=function(t,e){void 0===e&&(e=t);var n=void 0!==t,i=[t,t],a=this.element;if(!n||!this.options.disabled&&!this.options.readonly){try{void 0!==a.selectionStart&&(n&&(h.isDocumentAvailable()&&document.activeElement!==a&&a.focus(),a.setSelectionRange(t,e)),i=[a.selectionStart,a.selectionEnd])}catch(t){i=[]}return i}},e.prototype.selectNearestSegment=function(t){for(var e=t,n=t-1;e<this.currentFormat.length||n>=0;e++,n--){if(e<this.currentFormat.length&&"_"!==this.currentFormat[e])return void this.selectDateSegment(this.currentFormat[e]);if(n>=0&&"_"!==this.currentFormat[n])return void this.selectDateSegment(this.currentFormat[n])}},e.prototype.selectDateSegment=function(t){for(var e=-1,n=0,i=0;i<this.currentFormat.length;i++)this.currentFormat[i]===t&&(n=i+1,-1===e&&(e=i));e<0&&(e=0),this.caret(0,0),this.caret(e,n)},e.prototype.getDateObject=function(t){var e=(this.dateObject||{}||null).leadingZero,n=this.createDateObject({value:t});return n.setLeadingZero(this.isActive?e:null),n},e.prototype.createDateObject=function(t){return void 0===t&&(t={}),new s.DateObject(h.extend({intlService:this.intl,formatPlaceholder:this.formatPlaceholder,format:this.inputFormat,cycleTime:this.options.cycleTime,twoDigitYearMax:this.options.twoDigitYearMax,autoCorrectParts:this.options.autoCorrectParts,value:this.options.value},t))},e}(u.Observable);e.DateInput=f},function(t,n){t.exports=e},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=n(9),s=n(3),r=n(2),o=n(1),l=/d|M|H|h|m|s/,h=function(){function t(t){var e=t.intlService,n=t.formatPlaceholder,a=t.format,s=t.cycleTime,r=void 0!==s&&s,l=t.twoDigitYearMax,h=void 0===l?o.Constants.twoDigitYearMax:l,u=t.value,c=void 0===u?null:u,d=t.autoCorrectParts,p=void 0===d||d;if(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="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=i.getDate(new Date),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.intl=e,this.formatPlaceholder=n||"wide",this.format=a,this.cycleTime=r,this.monthNames=this.allFormattedMonths(this.localeId),this.dayPeriods=this.allDayPeriods(this.localeId),this.twoDigitYearMax=h,this.autoCorrectParts=p,c)this._value=i.cloneDate(c);else{this._value=i.getDate(new Date);for(var m=this.dateFormatString(this.value,this.format).symbols,f=0;f<m.length;f++)this.setExisting(m[f],!1)}}return Object.defineProperty(t.prototype,"value",{get:function(){return this._value},set:function(t){(!t||t instanceof Date)&&(this._value=t,this.resetInvalidDate())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"localeId",{get:function(){for(var t=o.Constants.defaultLocaleId,e=Object.keys(this.intl.cldr),n=0;n<e.length;n++){var i=e[n],a=this.intl.cldr[i];if(a.name&&a.calendar&&a.numbers&&a.name!==o.Constants.defaultLocaleId){t=a.name;break}}return t},enumerable:!0,configurable:!0}),t.prototype.setValue=function(t){t?i.isEqual(t,this._value)||(this._value=i.cloneDate(t),this.modifyExisting(!0)):(this._value=i.getDate(new Date),this.modifyExisting(!1)),this.resetInvalidDate()},t.prototype.hasValue=function(){var t=this;return this.intl.splitDateFormat(this.format,this.localeId).reduce((function(e,n){return e||"literal"!==n.type&&"dayperiod"!==n.type&&t.getExisting(n.pattern[0])}),!1)},t.prototype.getValue=function(){for(var t=0;t<this.knownParts.length;t++)if(!this.getExisting(this.knownParts[t]))return null;return i.cloneDate(this.value)},t.prototype.getFormattedDate=function(t){return this.intl.formatDate(this.getValue(),t,this.localeId)},t.prototype.getTextAndFormat=function(t){void 0===t&&(t="");var e=t||this.format,n=this.intl.formatDate(this.value,e,this.localeId),i=this.dateFormatString(this.value,e);if(!this.autoCorrectParts&&this._partiallyInvalidDate.startDate){for(var a="",o=this.intl.formatDate(this.value,e,this.localeId),l=this.getFormattedInvalidDates(e),h=0;h<o.length;h++){var u=i.symbols[h];if("literal"===i.partMap[h].type)a+=n[h];else if(this.getInvalidDatePartValue(u)){var c=this.getPartsForSegment(i,h);if("M"===u){var d=(r.parseToInt(this.getInvalidDatePartValue(u))+1).toString();if(c.length>2)a+=l[u][h];else if(this.getInvalidDatePartValue(u))a+=s.padZero(c.length-d.length)+d,h+=c.length-1;else a+=l[u][h]}else if(this.getInvalidDatePartValue(u)){d=this.getInvalidDatePartValue(u).toString();a+=s.padZero(c.length-d.length)+d,h+=c.length-1}else a+=l[u][h]}else a+=n[h]}n=a}return this.merge(n,i)},t.prototype.getFormattedInvalidDates=function(t){var e=this;void 0===t&&(t="");var n=t||this.format,i={E:"",H:"",M:"",a:"",d:"",h:"",m:"",s:"",y:"",S:""};return Object.keys(this._partiallyInvalidDate.invalidDateParts).forEach((function(t){var a=e.getInvalidDatePart(t).date;if(a){var s=e.intl.formatDate(a,n,e.localeId);i[t]=s}})),i},t.prototype.modifyExisting=function(t){for(var e=this.dateFormatString(this.value,this.format).symbols,n=0;n<e.length;n++)this.setExisting(e[n],t)},t.prototype.getExisting=function(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;case"S":return this.milliseconds;default:return!0}},t.prototype.setExisting=function(t,e){switch(t){case"y":this.year=e,!1===e&&this._value.setFullYear(2e3);break;case"M":this.month=e,!1===e&&this.autoCorrectParts&&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;case"S":this.milliseconds=e}this.getValue()&&this.resetInvalidDate()},t.prototype.modifyPart=function(t,e){if(r.isPresent(t)&&r.isPresent(e)&&0!==e){var n,a=i.cloneDate(this.value),s=!1,o="M"===t,l="d"===t||"E"===t,h=this.getExisting(t);if(this.autoCorrectParts||!l&&!o)switch(t){case"y":a.setFullYear(a.getFullYear()+e);break;case"M":a=i.addMonths(this.value,e);break;case"d":case"E":a.setDate(a.getDate()+e);break;case"h":case"H":a.setHours(a.getHours()+e),s=!0;break;case"m":a.setMinutes(a.getMinutes()+e),s=!0;break;case"s":a.setSeconds(a.getSeconds()+e),s=!0;break;case"S":a.setMilliseconds(a.getMilliseconds()+e);break;case"a":a.setHours(a.getHours()+12*e),s=!0}else{var u=this._partiallyInvalidDate.invalidDateParts||{},c=this.getInvalidDatePartValue(t),d=u.y.value||a.getFullYear(),p=u.M.value||a.getMonth(),m=u.d.value||u.E.value||a.getDate(),f=u.h.value||u.H.value||a.getHours(),v=u.m.value||a.getMinutes(),g=u.s.value||a.getSeconds(),y=u.S.value||a.getMilliseconds();switch(t){case"y":d+=e;break;case"M":p+=e;break;case"d":case"E":m+=e}if("M"===t){if((p<0||p>11)&&h)return this.setExisting(t,!1),void this.resetInvalidDateSymbol(t);if(!h){if(p<0)p=r.clamp(p%11+1+11,0,11);else{var D=r.isPresent(c)?p:(e-1)%12;p=r.clamp(D,0,11)}p=r.clamp(p,0,11)}p=r.clamp(p,0,11)}else if("d"===t)if(h){if(m<=0||m>31)return this.setExisting(t,!1),void this.resetInvalidDateSymbol(t)}else if(!h){if(r.isPresent(c)&&(m<=0||m>31))return this.setExisting(t,!1),void this.resetInvalidDateSymbol(t);if(e<0){var E=r.isPresent(c)?m:31-Math.abs(e%31)+1;m=r.clamp(E,1,31)}else{E=r.isPresent(c)?m:e%31;m=r.clamp(E,1,31)}m=r.clamp(m,1,31)}var b=i.createDate(d,p,m,f,v,g,y),S=o||l?this.modifyDateSymbolWithValue(a,t,o?p:m):null,P=r.areDatePartsEqualTo(b,d,p,m,f,v,g,y);this.getValue()&&r.areDatePartsEqualTo(b,d,p,m,f,v,g,y)?(a=i.cloneDate(b),this.markDatePartsAsExisting()):o&&S?S.getMonth()===p?this.getExisting("d")?P?(a=i.cloneDate(b),this.resetInvalidDateSymbol(t)):(n=!0,this.setInvalidDatePart(t,{value:p,date:i.cloneDate(S),startDateOffset:e,startDate:i.cloneDate(this.value)}),this.setExisting(t,!1)):P?(this.resetInvalidDateSymbol(t),a=i.cloneDate(b),this.getExisting("M")&&this.getExisting("y")&&(this.setExisting("d",!0),this.resetInvalidDateSymbol("d"))):(this.resetInvalidDateSymbol(t),a=i.cloneDate(S)):(n=!0,this.setInvalidDatePart(t,{value:p,date:i.cloneDate(S),startDateOffset:e,startDate:i.cloneDate(this.value)}),this.setExisting(t,!1)):l&&S&&(S.getDate()===m?this.getExisting("M")?P?(a=i.cloneDate(b),this.resetInvalidDateSymbol(t)):(n=!0,this.setInvalidDatePart(t,{value:m,date:i.cloneDate(S),startDateOffset:e,startDate:i.cloneDate(this.value)}),this.setExisting(t,!1)):P?(a=i.cloneDate(b),this.resetInvalidDateSymbol(t),this.getExisting("d")&&this.getExisting("y")&&(this.setExisting("M",!0),this.resetInvalidDateSymbol("M"))):(this.resetInvalidDateSymbol(t),a=i.cloneDate(S)):(n=!0,this.setInvalidDatePart(t,{value:m,date:i.cloneDate(this.value),startDateOffset:e,startDate:i.cloneDate(this.value)}),this.setExisting(t,!1)))}this.shouldNormalizeCentury()&&(a=this.normalizeCentury(a)),s&&!this.cycleTime&&(a.getDate(),this._value.getDate()),n||(this.setExisting(t,!0),this._value=a,this.getValue()&&this.resetInvalidDate())}},t.prototype.parsePart=function(t){for(var e,n=t.symbol,a=t.currentChar,o=t.resetSegmentValue,l=t.cycleSegmentValue,h=t.rawTextValue,u=t.isDeleting,c=t.originalFormat,d=!l,p=this.dateFormatString(this.value,this.format),m=p.partMap.filter((function(t){return"literal"===t.type})).map((function(t,e){return{datePartIndex:e,type:t.type,pattern:t.pattern,literal:""}})),f=p.partMap.map((function(t){return{type:t.type,pattern:t.pattern,text:""}})),v=0;v<m.length;v++){for(var g=m[v],y=0;y<g.pattern.length;y++)m[v+y]&&(m[v+y].literal=g.pattern[y]);v+=g.pattern.length-1}for(v=0;v<f.length;v++){for(g=f[v],y=0;y<g.pattern.length;y++)f[v+y]&&(f[v+y].text=g.pattern[y]);v+=g.pattern.length-1}var D={value:null,switchPart:!1,resetPart:d&&"M"===n&&p.partMap.filter((function(t){return"month"===t.type})).some((function(t){return t.pattern.length>2})),hasInvalidDatePart:!1};if(!a){if(!d)return this.resetLeadingZero(),this.setExisting(n,!1),this.resetInvalidDateSymbol(n),{value:null,switchToNext:!1};for(v=0;v<m.length;v++){var E=m[v].literal,b=h.startsWith(E),S=h.endsWith(E),P=h.indexOf(E+E)>=0;if(b||S||P)return this.resetLeadingZero(),this.setExisting(n,!1),this.resetInvalidDateSymbol(n),r.extend(D,{value:null,switchToNext:!1})}}var M=this.intl.formatDate(this.value,this.format,this.localeId),I=p.symbols,x=!1,C="",O="",w="",F="",V="",k="",T="";for(v=0;v<f.length;v++)T+=f[v].text;var _=this.format===I||this.format===T||this.format===c||this.format.length===c.length,N=(_?T:c).indexOf(n),A=(_?T:c).lastIndexOf(n)-N+1,j=0,L=c.length-h.length;if(d||!d&&!this.autoCorrectParts){for(v=0;v<M.length;v++){if(I[v]===n)O+=this.getExisting(n)?M[v]:"0",u?(j<A-1&&(w+=h[v]||""),j++):L>0?w.length+L<A&&(w+=h[v]||""):w+=h[v]||"",x=!0;else x?(k+=M[v],V+=M[v]):(C+=M[v],F+=M[v])}if(_){if(T.length<h.length)w+=a;else if(!u&&c.length>h.length){var K=c.length-h.length,B=w.substr(0,w.length-K);B&&B.length>0&&(w=B)}if(w.length>A)return r.extend(D,{value:null,switchToNext:!1})}if(!_||_&&!this.autoCorrectParts){j=0,O="",w="",C="",k="",x=!1;for(v=0;v<c.length;v++){if(c[v]===n)O+=this.getExisting(n)?M[v]||"":"0",u?(j<A-1&&(w+=h[v]||""),j++):L>0?w.length+L<A&&(w+=h[v]||""):w+=h[v]||"",x=!0;else x?k+=h[v-L]||"":C+=h[v]||""}c.length<h.length&&(w+=a)}}if(!d)if(this.autoCorrectParts){j=0,O="",w="",C="",k="",x=!1;for(v=0;v<M.length;v++){if(I[v]===n)O+=this.getExisting(n)?M[v]:"0",x=!0;else x?k+=M[v]:C+=M[v]}}else O=o?w:O;var H=null,W=this.matchMonth(a),R=this.matchDayPeriod(a,n),Z="0"===a,Y=this.leadingZero||{};Z?("0"===w&&(w=O),0!==r.parseToInt(o?a:(d?w:O)+a)||this.isAbbrMonth(p.partMap,n)||this.incrementLeadingZero(n)):this.resetLeadingZero();var U=this.partPattern(p.partMap,n),q=U?U.pattern:null;if(d&&u&&!w)return this.setExisting(n,!1),r.extend(D,{value:null,switchToNext:!1});var z=O.length-3,G=!0,J=d?w:O;for(v=Math.max(0,z);v<=O.length&&G;v++){J=o?a:d?w:O.substring(v)+a,!d&&this.autoCorrectParts||(G=!1,J=s.unpadZero(J),J=s.padZero(A-J.length)+J);var Q=parseInt(J,10),X=C+J+k;H=this.intl.parseDate(X,this.format,this.localeId),d&&!r.isValidDate(H)&&this.autoCorrectParts&&(H=this.intl.parseDate(F+J+V,this.format,this.localeId));var $=!isNaN(parseInt(a,10))||d&&u&&""===a;if(!H&&!isNaN(Q)&&$&&this.autoCorrectParts){if("M"===n&&!W){var tt=Q-1;tt>-1&&tt<12&&((H=i.cloneDate(this.value)).setMonth(tt),H.getMonth()!==tt&&(H=i.lastDayOfMonth(i.addMonths(H,-1))))}"y"===n&&(H=i.createDate(parseInt(J,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&&r.isValidDate(H)||!d&&H)&&this.date&&H.getDate()!==this.value.getDate()&&(H=i.lastDayOfMonth(i.addMonths(H,-1))))}if(d&&r.isValidDate(H)||!d&&H){var et=""+C+this.peek(J,q)+k,nt=null===this.intl.parseDate(et,this.format,this.localeId)||Y[n]&&q.length<=J.length||!1;if(this.shouldNormalizeCentury()&&(H=this.normalizeCentury(H)),this._value=H,this.setExisting(n,!0),this.resetInvalidDateSymbol(n),this.autoCorrectParts||("M"===n?this.getExisting("M")&&this.getExisting("y")&&(this.setExisting("d",!0),this.resetInvalidDateSymbol("d")):"d"===n&&this.getExisting("d")&&this.getExisting("y")&&(this.setExisting("M",!0),this.resetInvalidDateSymbol("M")),this.hasInvalidDatePart()||this.markDatePartsAsExisting()),d&&nt)if("M"===n)nt=(it=r.parseToInt(w))>=2||w.length>=2;else nt=nt?_?w.length===A:w.length>A:nt;return r.extend(D,{value:this.value,switchToNext:nt})}}if(W&&(H=this.intl.parseDate(C+W+k,this.format,this.localeId)))return this._value=H,this.setExisting(n,!0),r.extend(D,{value:this.value,switchToNext:!1});if(R&&(H=this.intl.parseDate(C+R+k,this.format)))return this._value=H,r.extend(D,{value:this.value,switchToNext:!0});if(Z&&(this.leadingZero=this.isAbbrMonth(p.partMap,n)?null:((e={})[n]=!0,e),this.setExisting(n,!1)),!this.autoCorrectParts){var it=void 0,at=d?w:J,st=r.parseToInt(at);if(r.isNumber(st)){if("d"===n&&(st<=0||st>31)||"M"===n&&(st<0||st>11))return r.extend(D,{value:null,switchToNext:!1});it="M"===n?st-1:st;var rt="M"===n,ot="d"===n,lt=i.cloneDate(this._value),ht=this._partiallyInvalidDate.invalidDateParts||{},ut=ht.y.value||lt.getFullYear(),ct=rt?it:ht.M.value||lt.getMonth(),dt=ot?it:ht.d.value||ht.E.value||lt.getDate(),pt=ht.h.value||ht.H.value||lt.getHours(),mt=ht.m.value||lt.getMinutes(),ft=ht.s.value||lt.getSeconds(),vt=ht.S.value||lt.getMilliseconds(),gt=i.createDate(ut,ct,dt,pt,mt,ft,vt),yt=r.areDatePartsEqualTo(gt,ut,ct,dt,pt,mt,ft,vt),Dt=rt||ot?this.modifyDateSymbolWithValue(lt,n,rt?ct:dt):null,Et=!1;if(rt&&Dt?Dt.getMonth()===ct?this.getExisting("d")?yt?(lt=i.cloneDate(gt),this.resetInvalidDateSymbol(n)):(Et=!0,this.setInvalidDatePart(n,{value:ct,date:i.cloneDate(Dt),startDate:i.cloneDate(this.value)}),this.setExisting(n,!1)):yt?(this.resetInvalidDateSymbol(n),lt=i.cloneDate(gt),this.getExisting("M")&&this.getExisting("y")&&(this.setExisting("d",!0),this.resetInvalidDateSymbol("d"))):(this.resetInvalidDateSymbol(n),lt=i.cloneDate(Dt)):(Et=!0,this.setInvalidDatePart(n,{value:ct,date:i.cloneDate(Dt),startDate:i.cloneDate(this.value)}),this.setExisting(n,!1)):ot&&Dt&&(Dt.getDate()===dt?this.getExisting("M")?yt?(lt=i.cloneDate(gt),this.resetInvalidDateSymbol(n)):(Et=!0,this.setInvalidDatePart(n,{value:dt,date:i.cloneDate(Dt),startDate:i.cloneDate(this.value)}),this.setExisting(n,!1)):yt?(lt=i.cloneDate(gt),this.resetInvalidDateSymbol(n),this.getExisting("d")&&this.getExisting("y")&&(this.setExisting("M",!0),this.resetInvalidDateSymbol("M"))):(this.resetInvalidDateSymbol(n),lt=i.cloneDate(Dt)):(Et=!0,this.setInvalidDatePart(n,{value:dt,date:i.cloneDate(this.value),startDate:i.cloneDate(this.value)}),this.setExisting(n,!1))),!Et){if(this.setExisting(n,!0),d&&!r.isValidDate(H)){var bt=this.intl.parseDate(F+J+V,this.format,this.localeId);r.isValidDate(bt)&&(this._value=bt)}else this._value=lt;this.getValue()&&this.resetInvalidDate()}nt=!1;return nt="M"===n?st>=2||at.length>=2:_?at.length===A:at.length>A,r.extend(D,{value:null,switchToNext:nt,hasInvalidDatePart:Et})}}return r.extend(D,{value:null,switchToNext:!1})},t.prototype.symbolMap=function(t){return this.intl.splitDateFormat(this.format,this.localeId).reduce(s.dateSymbolMap,{})[t]},t.prototype.resetLeadingZero=function(){var t=null!==this.leadingZero;return this.setLeadingZero(null),t},t.prototype.setLeadingZero=function(t){this.leadingZero=t},t.prototype.getLeadingZero=function(){return this.leadingZero||{}},t.prototype.normalizeCentury=function(t){if(!r.isPresent(t))return t;var e=r.cropTwoDigitYear(t),n=this.getNormalizedCenturyBase(e);return r.setYears(t,n+e)},t.prototype.incrementLeadingZero=function(t){var e=this.leadingZero||{};e[t]=(e[t]||0)+1,this.leadingZero=e},t.prototype.isAbbrMonth=function(t,e){var n=this.partPattern(t,e);return"month"===n.type&&n.names},t.prototype.partPattern=function(t,e){return t.filter((function(t){return-1!==t.pattern.indexOf(e)}))[0]},t.prototype.peek=function(t,e){var n=t.replace(/^0*/,"")+"0";return s.padZero(e.length-n.length)+n},t.prototype.matchMonth=function(t){if(this.typedMonthPart+=t.toLowerCase(),0===this.monthNames.length)return"";for(;this.typedMonthPart.length>0;){for(var e=0;e<this.monthNames.length;e++)if(0===this.monthNames[e].toLowerCase().indexOf(this.typedMonthPart))return this.monthNames[e];var n=parseInt(this.typedMonthPart,10);if(n>=1&&n<=12&&n.toString()===this.typedMonthPart)return this.monthNames[n-1];this.typedMonthPart=this.typedMonthPart.substring(1,this.typedMonthPart.length)}return""},t.prototype.matchDayPeriod=function(t,e){var n=t.toLowerCase();if("a"===e&&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""},t.prototype.allFormattedMonths=function(t){void 0===t&&(t="en");for(var e=this.intl.splitDateFormat(this.format,this.localeId),n=0;n<e.length;n++)if("month"===e[n].type&&e[n].names)return this.intl.dateFormatNames(t,e[n].names);return[]},t.prototype.allDayPeriods=function(t){void 0===t&&(t="en");for(var e=this.intl.splitDateFormat(this.format),n=0;n<e.length;n++)if("dayperiod"===e[n].type&&e[n].names)return this.intl.dateFormatNames(t,e[n].names);return null},t.prototype.patternLength=function(t){return"y"===t[0]?4:l.test(t)?2:0},t.prototype.dateFormatString=function(t,e){for(var n=this.intl.splitDateFormat(e,this.localeId),i=[],s=[],r=0;r<n.length;r++)for(var l=this.intl.formatDate(t,{pattern:n[r].pattern},this.localeId).length;l>0;)i.push(this.symbols[n[r].pattern[0]]||o.Constants.formatSeparator),s.push(n[r]),l--;var h=new a.Mask;return h.symbols=i.join(""),h.partMap=s,h},t.prototype.merge=function(t,e){for(var n="",i="",a=e.symbols,o=!1,l=0,h=this.getFormattedInvalidDates(a),u=a.length-1;u>=0;u--){var c=this.getPartsForSegment(e,u);if(-1===this.knownParts.indexOf(a[u])||this.getExisting(a[u]))this.autoCorrectParts?n=t[u]+n:t.length!==a.length?o?n=t[u]+n:l>0?(n=t[u]+n,--l<=0&&(o=!0)):n=(t[u+t.length-a.length]||"")+n:n=t[u]+n,i=a[u]+i;else{var d=a[u],p=0;if(this.autoCorrectParts||!this.autoCorrectParts&&!this.getInvalidDatePartValue(d)){for(;u>=0&&d===a[u];)u--;u++}if(this.leadingZero&&this.leadingZero[d])n="0"+n;else if(!this.autoCorrectParts&&this.getInvalidDatePartValue(d)){var m=this.getInvalidDatePartValue(d).toString();if("M"===d)if(m=(r.parseToInt(this.getInvalidDatePartValue(d))+1).toString(),c.length>2)n=h[d][u]+n;else m=(r.parseToInt(this.getInvalidDatePartValue(d))+1).toString(),n=s.padZero(c.length-m.length)+m+n,p=c.length-1,l=m.length-c.length;else n=s.padZero(c.length-m.length)+m+n,p=c.length-1,l=m.length-c.length}else n=this.dateFieldName(e.partMap[u])+n;for(;i.length<n.length;)i=a[u]+i;0!==p&&(u=u-p+(t.length-a.length))}}return{text:n,format:i}},t.prototype.dateFieldName=function(t){var e=this.formatPlaceholder||"wide";return e[t.type]?e[t.type]:"formatPattern"===e?t.pattern:this.intl.dateFieldName(Object.assign(t,{nameType:e}))},t.prototype.getNormalizedCenturyBase=function(t){return t>this.twoDigitYearMax?1900:2e3},t.prototype.shouldNormalizeCentury=function(){return this.intl.splitDateFormat(this.format).some((function(t){return"yy"===t.pattern}))},t.prototype.resetInvalidDate=function(){var t=this;this._partiallyInvalidDate.startDate=null,Object.keys(this._partiallyInvalidDate.invalidDateParts).forEach((function(e){t.resetInvalidDatePart(e)}))},t.prototype.resetInvalidDateSymbol=function(t){var e=this;this.resetInvalidDatePart(t);var n=!0;Object.keys(this._partiallyInvalidDate.invalidDateParts).forEach((function(t){e._partiallyInvalidDate.invalidDateParts[t]&&r.isPresent(e._partiallyInvalidDate.invalidDateParts[t].value)&&(n=!1)})),n&&this.resetInvalidDate()},t.prototype.resetInvalidDatePart=function(t){this._partiallyInvalidDate.invalidDateParts[t]&&(this._partiallyInvalidDate.invalidDateParts[t]={value:null,date:null,startDateOffset:0})},t.prototype.getInvalidDatePart=function(t){return this._partiallyInvalidDate.invalidDateParts[t]||{}},t.prototype.getInvalidDatePartValue=function(t){return(this._partiallyInvalidDate.invalidDateParts[t]||{}).value},t.prototype.setInvalidDatePart=function(t,e){var n=e.value,i=void 0===n?null:n,a=e.date,s=void 0===a?null:a,r=e.startDateOffset,o=void 0===r?0:r,l=e.startDate,h=void 0===l?null:l;this._partiallyInvalidDate.invalidDateParts[t]&&(this._partiallyInvalidDate.invalidDateParts[t].value=i,this._partiallyInvalidDate.invalidDateParts[t].date=s,this._partiallyInvalidDate.invalidDateParts[t].startDateOffset=o,this._partiallyInvalidDate.startDate=h)},t.prototype.hasInvalidDatePart=function(){var t=this,e=!1;return Object.keys(this._partiallyInvalidDate.invalidDateParts).forEach((function(n){t._partiallyInvalidDate.invalidDateParts[n]&&r.isPresent(t._partiallyInvalidDate.invalidDateParts[n].value)&&(e=!0)})),e},t.prototype.modifyDateSymbolWithOffset=function(t,e,n){var a=i.cloneDate(t),s=!1;switch(e){case"y":a.setFullYear(a.getFullYear()+n);break;case"M":a=i.addMonths(this.value,n);break;case"d":case"E":a.setDate(a.getDate()+n);break;case"h":case"H":a.setHours(a.getHours()+n),s=!0;break;case"m":a.setMinutes(a.getMinutes()+n),s=!0;break;case"s":a.setSeconds(a.getSeconds()+n),s=!0;break;case"S":a.setMilliseconds(a.getMilliseconds()+n);break;case"a":a.setHours(a.getHours()+12*n),s=!0}return{date:a,timeModified:s}},t.prototype.modifyDateSymbolWithValue=function(t,e,n){var a=i.cloneDate(t);switch(e){case"y":a.setFullYear(n);break;case"M":a=i.addMonths(t,n-t.getMonth());break;case"d":case"E":a.setDate(n);break;case"h":case"H":a.setHours(n);break;case"m":a.setMinutes(n);break;case"s":a.setSeconds(n);break;case"S":a.setMilliseconds(n);break;case"a":a.setHours(n)}return a},t.prototype.markDatePartsAsExisting=function(){this.modifyExisting(!0)},t.prototype.getPartsForSegment=function(t,e){for(var n=t.partMap[e],i=[],a=e;a<t.partMap.length;a++){var s=t.partMap[a];if(n.type!==s.type||n.pattern!==s.pattern)break;i.push(s)}for(a=e-1;a>=0;a--){s=t.partMap[a];if(n.type!==s.type||n.pattern!==s.pattern)break;i.unshift(s)}return i},t}();e.DateObject=h},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){this.symbols="",this.partMap=[]};e.Mask=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.KeyCode={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}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),a={events:{}},s=function(){function t(t){this.options=i.extend({},a,t)}return t.prototype.destroy=function(){},t.prototype.trigger=function(t,e){void 0===e&&(e={});var n={defaultPrevented:!1,preventDefault:function(){n.defaultPrevented=!0}};return!!i.isFunction(this.options.events[t])&&(this.options.events[t](i.extend(n,e,{sender:this})),n.defaultPrevented)},t}();e.Observable=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.None="none",t.Caret="caret",t.Selection="selection"}(e.DateInputInteractionMode||(e.DateInputInteractionMode={}))}])}));