@mescius/wijmo.input 5.20261.45-nightly.d20251218.t163151 → 5.20261.45-nightly.d20260105.t014601
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/es2015-commonjs.js +2 -2
- package/es2015-esm.js +2 -2
- package/es5-esm.js +2 -2
- package/index.d.ts +17 -17
- package/index.js +2 -2
- package/package.json +2 -2
package/es5-esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
*
|
|
3
|
-
* Wijmo Library 5.20261.45-nightly.
|
|
3
|
+
* Wijmo Library 5.20261.45-nightly.d20260105.t014601
|
|
4
4
|
* https://developer.mescius.com/wijmo
|
|
5
5
|
*
|
|
6
6
|
* Copyright(c) MESCIUS inc. All rights reserved.
|
|
@@ -11,4 +11,4 @@
|
|
|
11
11
|
*
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
var __extends=this&&this.__extends||function(){var extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};return function(e,t){extendStatics(e,t);function __(){this.constructor=e}e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e}).apply(this,arguments)};import{_getModule,_addCultureInfo,culture,setAriaLabel,disableAutoComplete,isIE,isIE9,asBoolean,asString,asEnum,setSelectionRange,contains,getActiveElement,setAttribute,showPopup,hidePopup,hasClass,addClass,removeClass,toggleClass,removeChild,Control,Key,Event,EventArgs,CancelEventArgs,ControlStateClsNames,GlyphClsNames,ControlClsNames,InputFormElementsClsNames,isNullOrUndefined,tryCast,createElement,hasItems,isObject,isString,asArray,asFunction,asNumber,asType,asCollectionView,closest,escapeHtml,toPlainText,setCss,Binding,Rect,DateTime,assert,isFirefox,_CLS_STATE_DISABLED,UtilitesClsNames,_setAriaLabelBy,setInnerHTMLSafe,getUniqueId,isNumber,enable,isFunction,escapeRegExp,isSafari,setText,isDate,isBoolean,asDate,asInt,Globalize,_ClickRepeater,CollectionView,format,uidGenerator,moveFocus,_isMacOS,clamp,Color,roundTo,_getFocusableElements,_MaskProvider,getSpecialCharsRegex,isEmpty,isEdge,isMobile,setChecked,Point,isArray,getElementRect,getSafeUniqueId,PopupPosition,getElement,isUndefined,isiOS,_registerModule}from"@mescius/wijmo";import*as selfModule from"@mescius/wijmo.input";export var AutoCompleteClsNames={hostElement:"wj-autocomplete"};export var CalendarClsNames={buttonsOutside:"wj-btns-outside",calendarHeader:"wj-calendar-header",calendarMonth:"wj-calendar-month",calendarMultiMonth:"wj-calendar-multimonth",calendarOuter:"wj-calendar-outer",calendarYear:"wj-calendar-year",dayOtherMonth:"wj-day-othermonth",dayToday:"wj-day-today",dayWeekend:"wj-day-weekend",header:"wj-header",hostElement:"wj-calendar",monthSelect:"wj-month-select",weekAfter:"wj-week-after",weekBefore:"wj-week-before",yearPicker:"wj-yearpicker",focused:"wj-state-focus",selectedYear:"wj-select-year",confirmationButtonContainer:"wj-calendar-confirmation-button-container",button:"wj-calendar-button"};export var CollectionViewNavigatorClsNames={hostElement:"wj-collectionview-navigator",pager:"wj-pager"};export var ColorPickerClsNames={colorBox:"wj-colorbox",hostElement:"wj-colorpicker"};export var ComboBoxClsNames={hostElement:"wj-combobox",stateMatch:"wj-state-match"};export var DropDownClsNames={dropDownPanel:"wj-dropdown-panel",hostElement:"wj-dropdown"};export var InputClsNames={input:"wj-input",inputBtnVisible:"wj-input-btn-visible",inputGroup:"wj-input-group",inputGroupBtn:"wj-input-group-btn"};export var InputColorClsNames={hostElement:"wj-inputcolor",inputColorBox:"wj-inputcolorbox"};export var InputDateClsNames={hostElement:"wj-inputdate",inputDateDropDown:"wj-inputdate-dropdown",inputDateDropDownContainer:"wj-inputdate-dropdown-container"};export var InputDateRangeClsNames={hostElement:"wj-inputdaterange"};export var InputDateTimeClsNames={hostElement:"wj-inputdatetime",showDropDownButton:"wj-show-dropdown-button"};export var InputMaskClsNames={hostElement:"wj-inputmask"};export var InputNumberClsNames={hostElement:"wj-inputnumber",numeric:"wj-numeric",showSpinner:"wj-input-show-spinner"};export var InputTimeClsNames={hostElement:"wj-inputtime"};export var ListBoxClsNames={header:"wj-header",hostElement:"wj-listbox",listBoxItem:"wj-listbox-item"};export var MenuClsNames={hostElement:"wj-menu",menuItems:"wj-menu-items",subItems:"wj-subitems"};export var MultiAutoCompleteClsNames={hostElement:"wj-multi-autocomplete",token:"wj-token",tokenActive:"wj-token-active",tokenClose:"wj-token-close",tokenHelper:"wj-token-helper",tokenLabel:"wj-token-label",screenReaderOnly:"wj-sr-only"};export var MultiSelectClsNames={hostElement:"wj-multiselect"};export var MultiSelectListBoxClsNames={header:"wj-header",hostElement:"wj-multiselectlistbox",selectAll:"wj-select-all"};export var PopupClsNames={dialogHeader:"wj-dialog-header",hostElement:"wj-popup",popupBackDrop:"wj-popup-backdrop",dialogBody:"wj-dialog-body",dialogFooter:"wj-dialog-footer"};_addCultureInfo("InputNumber",{ariaLabels:{incVal:"Increase Value",decVal:"Decrease Value",inputNumberInput:"InputNumber Input",inputNumber:"Input Number"}});var InputNumber=function(e){__extends(InputNumber,e);function InputNumber(t,i){var n=e.call(this,t)||this;n._value=null;n._min=null;n._max=null;n._format="";n._step=null;n._showBtn=!0;n._readOnly=!1;n._handleWheel=!0;n._oldText="";n._fromKb=!0;n._inputElementAriaLabel=culture.InputNumber.ariaLabels.inputNumberInput;n._ariaLabelledby=null;n.textChanged=new Event;n.valueChanged=new Event;var o=n.getTemplate();n.applyTemplate(ControlClsNames.hostElement+" "+ControlClsNames.content+" "+InputNumberClsNames.hostElement,o,{_tbx:"input",_btnUp:"btn-inc",_btnDn:"btn-dec"},"input");var s=n.inputElement;n.hostElement;setAttribute(s,"role","spinbutton",!0);n._updateInputAriaLabel();var r=culture.InputNumber.ariaLabels;setAriaLabel(n._btnUp.querySelector("button"),r.incVal);setAriaLabel(n._btnDn.querySelector("button"),r.decVal);n._tbx.type.match(/number/i)&&(n.inputType="");var a=n._tbx;a.autocomplete="off";a.spellcheck=!1;n._updateSymbols();var l=n.addEventListener.bind(n);l(a,"keypress",n._keypress.bind(n));l(a,"keydown",n._keydown.bind(n));l(a,"input",n._input.bind(n));isMobile()&&l(a,"beforeinput",n._beforeinput.bind(n));l(a,"blur",(function(){n.text!=n._oldText&&n._setText(n.text)}));l(a,"paste",(function(){n._fromKb=!1}));l(a,"compositionstart",(function(){n._composing=!0}));l(a,"compositionend",(function(){n._composing=!1;setTimeout((function(){var e=n.text,t=n._oldText,i=n._chrPct;t&&t.indexOf(i)>-1&&e.indexOf(i)<0&&(e+=i);n._setText(e)}))}));var h=n._clickSpinner.bind(n);l(n._btnUp,"click",h);l(n._btnDn,"click",h);n._rptUp=new _ClickRepeater(n._btnUp.querySelector("button"));n._rptDn=new _ClickRepeater(n._btnDn.querySelector("button"));l(a,"wheel",(function(e){if(n.handleWheel&&!e.defaultPrevented&&!e.ctrlKey&&n._isEditable()&&n.containsFocus()){var t=clamp(-e.deltaY,-1,1);n._increment((n.step||1)*t);setTimeout((function(){return n.selectAll()}));e.preventDefault()}}));n.value=0;n.isRequired=!0;n.initialize(i);return n}Object.defineProperty(InputNumber,"controlTemplate",{get:function(){InputNumber._ctrlTemplate||(InputNumber._ctrlTemplate='<div class="'+ControlClsNames.template+'"><div class="'+InputClsNames.input+'"><div class="'+InputClsNames.inputGroup+'"><span wj-part="btn-dec" class="'+InputClsNames.inputGroupBtn+'" tabindex="-1"><button class="'+InputFormElementsClsNames.btn+" "+InputFormElementsClsNames.btnDefault+'" tabindex="-1">-</button></span><input type="tel" wj-part="input" class="'+InputFormElementsClsNames.formControl+" "+InputNumberClsNames.numeric+'"/><span wj-part="btn-inc" class="'+InputClsNames.inputGroupBtn+'" tabindex="-1"><button class="'+InputFormElementsClsNames.btn+" "+InputFormElementsClsNames.btnDefault+'" tabindex="-1">+</button></span></div></div></div>');return InputNumber._ctrlTemplate},set:function(e){InputNumber._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"inputElement",{get:function(){return this._tbx},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"inputType",{get:function(){return this._tbx.type},set:function(e){this._tbx.type=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"value",{get:function(){return this._value},set:function(e){if(e!=this._value)if(null==(e=asNumber(e,!this.isRequired||null==e&&null==this._value)))this._setText("");else if(!isNaN(e)){var t=Globalize.format(e,this.format);this._setText(t)}},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"isRequired",{get:function(){return this._tbx.required},set:function(e){this._tbx.required=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"isReadOnly",{get:function(){return this._readOnly},set:function(e){this._readOnly=asBoolean(e);this.inputElement.readOnly=this._readOnly;toggleClass(this.hostElement,ControlStateClsNames.readOnly,this.isReadOnly)},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"handleWheel",{get:function(){return this._handleWheel},set:function(e){this._handleWheel=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"min",{get:function(){return this._min},set:function(e){if(e!=this._min){this._min=asNumber(e,!0);this._updateAria()}},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"max",{get:function(){return this._max},set:function(e){if(e!=this._max){this._max=asNumber(e,!0);this._updateAria()}},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"step",{get:function(){return this._step},set:function(e){this._step=asNumber(e,!0);this._updateBtn()},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"format",{get:function(){return this._format},set:function(e){if(e!=this.format){this._format=asString(e);this.refresh()}},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"text",{get:function(){return this._tbx.value},set:function(e){if(e!=this.text){this._oldText=this.text;this._setText(e)}},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"placeholder",{get:function(){return this._tbx.placeholder},set:function(e){this._tbx.placeholder=e},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"showSpinner",{get:function(){return this._showBtn},set:function(e){this._showBtn=asBoolean(e);this._updateBtn()},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"repeatButtons",{get:function(){return!this._rptUp.disabled},set:function(e){this._rptUp.disabled=this._rptDn.disabled=!asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"ariaLabelledBy",{get:function(){return this._ariaLabelledby},set:function(e){_setAriaLabelBy(this,this._tbx,e,this._updateInputAriaLabel.bind(this))},enumerable:!0,configurable:!0});InputNumber.prototype.selectAll=function(){var e=this._tbx;setSelectionRange(e,0,e.value.length)};InputNumber.prototype.clamp=function(e){return clamp(e,this.min,this.max)};InputNumber.prototype.onTextChanged=function(e){this.textChanged.raise(this,e);this._updateState()};InputNumber.prototype.onValueChanged=function(e){this._updateAria();this.valueChanged.raise(this,e)};InputNumber.prototype.dispose=function(){this._rptUp.element=null;this._rptDn.element=null;e.prototype.dispose.call(this)};InputNumber.prototype.onGotFocus=function(t){this._oldValue=this.value;if(!this.isTouching){this._tbx.focus();this.selectAll()}e.prototype.onGotFocus.call(this,t)};InputNumber.prototype.onLostFocus=function(t){if(this._composing){this._composing=!1;this._setText(this.text)}if(this._isEditable()){var i=this.clamp(this.value);if(i==this.value||this.onInvalidInput(new CancelEventArgs)){var n=Globalize.format(i,this.format);this._setText(n)}}e.prototype.onLostFocus.call(this,t)};InputNumber.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);if(this.hostElement){this._updateSymbols();var i=Globalize.format(this.value,this.format);this._setText(i)}};InputNumber.prototype._isEditable=function(){return!this.isReadOnly&&!this.isDisabled};InputNumber.prototype._updateSymbols=function(){var e=culture.Globalize.numberFormat,t=Globalize._parseNumericFormat(this.format);this._chrDec=e["."]||".";this._chrTho=e[","]||",";this._chrNeg=e["-"]||"-";this._chrPls=e["+"]||"+";this._chrPct=e["%"]||"%";this._chrCur=t.curr||e.currency.symbol||"$";this._fmtSpc=t.spec;this._fmtPrc=t.prec;this._rxSym=new RegExp("^[%+\\-() \\"+this._chrDec+"\\"+this._chrCur+"\\"+this._chrNeg+"\\"+this._chrPls+"\\"+this._chrPct+"]*$");this._rxNeg=new RegExp("^\\s*(\\-|\\"+this._chrNeg+")|([^e](\\-|\\"+this._chrNeg+")|\\()")};InputNumber.prototype._isNumeric=function(e,t){var i=e==this._chrDec||e>="0"&&e<="9",n="x"==this._fmtSpc;!i&&n&&(i=e>="a"&&e<="f"||e>="A"&&e<="F");i||t||n||(i=e==this._chrPls||e==this._chrNeg||"("==e||")"==e);return i};InputNumber.prototype._getInputRange=function(e){for(var t=[0,0],i=this.text,n=!1,o=0;o<i.length;o++)if(this._isNumeric(i[o],e)){if(!n){t[0]=o;n=!0}t[1]=o+1}return t};InputNumber.prototype._flipSign=function(){var e=this._getSelStartDigits();this.value*=-1;this._setSelStartDigits(e)};InputNumber.prototype._getSelStartDigits=function(){for(var e=0,t=this._tbx.selectionStart,i=this._tbx.value,n=0;n<i.length&&n<t;n++)this._isNumeric(i[n],!0)&&e++;return e};InputNumber.prototype._setSelStartDigits=function(e){for(var t=this._tbx.value,i=0;i<t.length&&e>=0;i++)if(this._isNumeric(t[i],!0)){if(!e){setSelectionRange(this._tbx,i);break}e--}else if(!e){setSelectionRange(this._tbx,i);break}};InputNumber.prototype._increment=function(e){if(e){var t=this.clamp(isNumber(this.value)?this.value+e:0),i=Globalize.format(t,this.format,!1,!1);this._setText(i)}};InputNumber.prototype._updateBtn=function(){var e=this.showSpinner&&!!this.step,t=e;setCss([this._btnUp,this._btnDn],{display:e?"":"none"});toggleClass(this.hostElement,InputNumberClsNames.showSpinner,e);enable(this._btnUp,t);enable(this._btnDn,t);this._updateAria()};InputNumber.prototype._setText=function(e,t,i){void 0===t&&(t=!1);void 0===i&&(i=!1);if(!this._composing){var n=this._tbx,o=this._chrDec,s=this._rxNeg.test(e),r=this._delKey,a=this.containsFocus();e&&this._rxSym.test(e)&&a&&(e=this.isRequired||!r?(s?"-0":"0")+(e.indexOf(o)>-1?o:""):"");this._delKey=!1;r&&0==this.value&&!this.isRequired&&(e="");if(!e){if(!this.isRequired||i){n.value="";if(this._oldText){this._oldText=e;this.onTextChanged()}if(null!=this._value){this._value=null;this.onValueChanged()}this._updateBtn();return}e="0"}var l=e.indexOf(o),h=this._format||(l>-1?"n2":"n0"),u=Globalize.parseFloat(e,h);isFinite(u)||(u=this.clamp(u));if(isNaN(u))if(this.onInvalidInput(new CancelEventArgs))n.value=this._oldText;else{n.value=e;this.focus()}else{var c=a&&l>-1?2:null,p=Globalize.format(u,h,!1,t,c);s&&u>=0&&!r&&(p=this._chrNeg+p);a&&l>-1&&"g"==this._fmtSpc&&0!=this._fmtPrc&&(p=e).indexOf(o)<0&&(p+=o);if(n.value!=p){n.value=p;u=Globalize.parseFloat(p,h)}if(this.text!=this._oldText){this._oldText=this.text;this.onTextChanged()}if(u!=this._value){this._value=u;this.onValueChanged()}this._updateBtn();this._updateState()}}};InputNumber.prototype._handleDecimalInput=function(e){if(0===this._fmtPrc){e.preventDefault();return!0}var t=this._tbx,i=t.value.indexOf(this._chrDec);if(i>-1){e.preventDefault();var n=t.selectionStart<=i?i+1:i;setSelectionRange(t,n);return!0}return!1};InputNumber.prototype._beforeinput=function(e){if(!e.defaultPrevented&&!this._composing&&this._isEditable()){switch(e.data){case".":case this._chrDec:this._handleDecimalInput(e);return;case"+":case this._chrPls:this._handlePlusSign();e.preventDefault();return;case"-":case this._chrNeg:this._handleMinusSign();e.preventDefault();return}}};InputNumber.prototype._keypress=function(e){if(!e.defaultPrevented&&!this._composing&&this._isEditable()&&e.charCode&&!e.ctrlKey&&!e.metaKey&&e.keyCode!=Key.Enter){var t=this._tbx,i=String.fromCharCode(e.charCode);if(this._isNumeric(i,!1)){var n=t.maxLength;if(n>-1&&t.value.length>=n&&t.selectionEnd==t.selectionStart){e.preventDefault();return}var o=this._getInputRange(!0),s=t.selectionStart,r=t.selectionEnd;if(s<o[0]&&r<t.value.length){r=Math.max(r,o[0]);setSelectionRange(t,o[0],r)}if(s>=o[1]){var a=null!=this._fmtPrc?this._fmtPrc:2,l=t.value.indexOf(this._chrDec);l>-1&&s-l>a&&e.preventDefault()}}else e.preventDefault();switch(i){case"-":case this._chrNeg:this._handleMinusSign();e.preventDefault();break;case"+":case this._chrPls:this._handlePlusSign();e.preventDefault();break;case".":case this._chrDec:this._handleDecimalInput(e)}if(!e.defaultPrevented&&isIE()){var h=t.value;if((s=t.selectionStart)==(r=t.selectionEnd)){t.value=h.substr(0,s)+i+h.substr(r);setSelectionRange(t,s+1);e.preventDefault();this._input()}}}};InputNumber.prototype._handlePlusSign=function(){var e=this._tbx;(this.value<0||this._rxNeg.test(e.value))&&this._flipSign()};InputNumber.prototype._handleMinusSign=function(){var e=this._tbx;if(this.clamp(-1)>=0)this.value<0&&this._flipSign();else if(this.value&&e.selectionStart===e.selectionEnd)this._flipSign();else if(this.clamp(-1)<0){e.value=this._chrNeg;setSelectionRange(e,1)}};InputNumber.prototype._keydown=function(e){var t=this;this._delKey=!1;if(!e.defaultPrevented&&!this._composing){var i=hasClass(this._tbx,"wj-grid-ime");if(!i||e.keyCode==Key.Back||e.keyCode==Key.Delete){var n=this._tbx,o=n.value,s=n.selectionStart,r=n.selectionEnd;switch(e.keyCode){case 65:if(e.ctrlKey){setTimeout((function(){t.selectAll()}));e.preventDefault()}break;case Key.Up:case Key.Down:if(this.step&&this._isEditable()){this._increment(this.step*(e.keyCode==Key.Up?1:-1));setTimeout((function(){t.selectAll()}));e.preventDefault()}break;case Key.Back:this._delKey=!0;if(r-s<2&&this._isEditable()){var a=o[r-1];if(a==this._chrDec||a==this._chrPct||a==this._chrTho||")"==a){setTimeout((function(){r=a==t._chrPct?t._getInputRange(!0)[1]:r-1;setSelectionRange(n,r)}));e.preventDefault()}}break;case Key.Delete:this._delKey=!0;if(r-s<2&&this._isEditable())if("0"==o&&1==s)setSelectionRange(n,0);else{var l=o[s];if(l==this._chrDec||l==this._chrPct){setTimeout((function(){setSelectionRange(n,s+1)}));e.preventDefault()}}break;case Key.Escape:this.value=this._oldValue;this.selectAll()}i&&this._delKey&&this._isEditable()&&this._setText(null,!1,!0)}}};InputNumber.prototype._input=function(){var e=this;this._composing?this._fromKb=!0:setTimeout((function(){var t=e._tbx,i=t.value,n=i.indexOf(e._chrDec),o=t.selectionStart,s=e._getSelStartDigits();"p"==e._fmtSpc&&i.length&&i.indexOf(e._chrPct)<0&&(i+=e._chrPct);e._setText(i,e._fromKb);e._fromKb=!0;if(e.containsFocus()){var r=t.value,a=r.indexOf(e._chrDec),l=e._getInputRange(!0);if(i==e._chrNeg+e._chrDec&&a>-1){setSelectionRange(t,a+1);return}if(i[0]==e._chrNeg&&r[0]!=e._chrNeg){if(1==r.length)setSelectionRange(t,1);else{"c"===e._fmtSpc&&e._isNegativeCurrencyByParenthesis(i)&&(s-=1);e._setSelStartDigits(s)}return}i?i==e._chrDec&&a>-1?o=a+1:o<=n&&a>-1||n<0&&a<0?o+=r.length-i.length:n<0&&a>-1&&(o=a):o=a>-1?a:l[1];o=clamp(o,l[0],l[1]);setSelectionRange(t,o)}}))};InputNumber.prototype._isNegativeCurrencyByParenthesis=function(e){return e.length>1&&e[1]===this._chrCur};InputNumber.prototype._clickSpinner=function(e){var t=this;if(!e.defaultPrevented&&this._isEditable()&&this.step){this._increment(this.step*(contains(this._btnUp,e.target)?1:-1));if(!this.isTouching){Control.sharedState.InvalidScroll=isEdge();setTimeout((function(){return t.selectAll()}))}}};InputNumber.prototype._updateAria=function(){var e=this.inputElement;if(this.hostElement){setAttribute(e,"aria-valuemin",this.min);setAttribute(e,"aria-valuemax",this.max);setAttribute(e,"aria-valuenow",this.value);setAttribute(e,"aria-valuetext",this.text);setAttribute(e,"step",this.step);enable(this._btnDn,null==this.min||this.value>this.min);enable(this._btnUp,null==this.max||this.value<this.max)}};InputNumber.prototype._updateInputAriaLabel=function(){var e=this.inputElement;this._ariaLabelledby?setAttribute(e,"aria-label",null):setAttribute(e,"aria-label",this._inputElementAriaLabel)};InputNumber.prototype.getAriaLabelForScreenReader=function(){return culture.InputNumber.ariaLabels.inputNumber};InputNumber._ctrlTemplate="";return InputNumber}(Control);export{InputNumber};_addCultureInfo("InputMask",{ariaLabels:{inputMaskInput:"InputMask Input",inputMask:"Input Mask"}});var InputMask=function(e){__extends(InputMask,e);function InputMask(t,i){var n=e.call(this,t)||this;n._fullEdit=!1;n._inputElementAriaLabel=culture.InputMask.ariaLabels.inputMaskInput;n._ariaLabelledby=null;n.valueChanged=new Event;var o=n.getTemplate();n.applyTemplate(ControlClsNames.hostElement+" "+ControlClsNames.content+" "+InputMaskClsNames.hostElement,o,{_tbx:"input"},"input");if("INPUT"==n._orgTag){var s=n._tbx.getAttribute("value");s&&(n.value=s)}n._msk=new _MaskProvider(n._tbx);n.isRequired=!0;n.initialize(i);n.addEventListener(n._tbx,"input",(function(){n.onValueChanged()}));n.addEventListener(n._tbx,"blur",n._commitText.bind(n));n.addEventListener(n._tbx,"keydown",(function(e){e.keyCode==Key.Enter&&n._commitText()}));n._updateInputAriaLabel();return n}Object.defineProperty(InputMask,"controlTemplate",{get:function(){InputMask._ctrlTemplate||(InputMask._ctrlTemplate='<div class="'+InputClsNames.input+'"><div class="'+InputClsNames.inputGroup+'"><input wj-part="input" class="'+InputFormElementsClsNames.formControl+'"/></div></div>');return InputMask._ctrlTemplate},set:function(e){InputMask._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"inputElement",{get:function(){return this._tbx},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"inputType",{get:function(){return this._tbx.type},set:function(e){this._tbx.type=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"value",{get:function(){return this._tbx.value},set:function(e){if(e!=this.value){this._tbx.value=asString(e);e=this._msk._applyMask();this._tbx.value=e;this.onValueChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"rawValue",{get:function(){return this._msk.getRawValue()},set:function(e){e!=this.rawValue&&(this.value=asString(e))},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"mask",{get:function(){return this._msk.mask||""},set:function(e){var t=this.value;this._msk.mask=asString(e);this.value!=t&&this.onValueChanged()},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"promptChar",{get:function(){return this._msk.promptChar},set:function(e){var t=this.value;this._msk.promptChar=e;this.value!=t&&this.onValueChanged()},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"overwriteMode",{get:function(){return this._msk.overwriteMode},set:function(e){this._msk.overwriteMode=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"placeholder",{get:function(){return this._tbx.placeholder},set:function(e){this._tbx.placeholder=e},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"maskFull",{get:function(){return this._msk.maskFull},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"isRequired",{get:function(){return this._tbx.required},set:function(e){this._tbx.required=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"isReadOnly",{get:function(){return this._tbx.readOnly},set:function(e){this._tbx.readOnly=asBoolean(e);toggleClass(this.hostElement,ControlStateClsNames.readOnly,this.isReadOnly)},enumerable:!0,configurable:!0});InputMask.prototype.selectAll=function(){var e=this._msk.getMaskRange();setSelectionRange(this._tbx,e[0],e[1]+1)};InputMask.prototype.onValueChanged=function(e){if(this.value!=this._oldValue){this._oldValue=this.value;this.valueChanged.raise(this,e)}this._updateState()};InputMask.prototype._commitText=function(){(this.rawValue||this.isRequired)&&(this.maskFull||this.onInvalidInput(new CancelEventArgs));this._updateState()};InputMask.prototype.dispose=function(){this._msk.input=null;e.prototype.dispose.call(this)};InputMask.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);this.hostElement&&this._msk.refresh()};InputMask.prototype.onGotFocus=function(t){this.selectAll();e.prototype.onGotFocus.call(this,t)};Object.defineProperty(InputMask.prototype,"ariaLabelledBy",{get:function(){return this._ariaLabelledby},set:function(e){_setAriaLabelBy(this,this._tbx,e,this._updateInputAriaLabel.bind(this))},enumerable:!0,configurable:!0});InputMask.prototype._updateInputAriaLabel=function(){var e=this.inputElement;!e||e.id||this._ariaLabelledby?setAttribute(e,"aria-label",null):setAttribute(e,"aria-label",this._inputElementAriaLabel)};InputMask.prototype.getAriaLabelForScreenReader=function(){return culture.InputMask.ariaLabels.inputMask};InputMask._ctrlTemplate="";return InputMask}(Control);export{InputMask};_addCultureInfo("ColorPicker",{ariaLabels:{colorPicker:"Color Picker",satAndBrightnessPanel:"Color saturation and brightness panel",huePanel:"Color hue panel",opacityPanel:"Color opacity panel",palettePanel:"Color palette panel",saturation:"Saturation:",hue:"Hue:",opacity:"Opacity:",degrees:"degrees",brightness:"Brightness:",baseColor:"Base color:",shadeColor:"Shade color:"}});export var ColorPickerTabKeyAction;!function(e){e[e.None=0]="None";e[e.All=1]="All"}(ColorPickerTabKeyAction||(ColorPickerTabKeyAction={}));var ColorPicker=function(e){__extends(ColorPicker,e);function ColorPicker(t,i){var n=e.call(this,t)||this;n._hsb=[.5,1,1];n._alpha=1;n._ariaLabel=culture.ColorPicker.ariaLabels.colorPicker;n.valueChanged=new Event;n.hostElement.setAttribute("role","application");n.hostElement.setAttribute("aria-label",culture.ColorPicker.ariaLabels.colorPicker);var o=n.getTemplate();n.applyTemplate(ControlClsNames.hostElement+" "+ControlClsNames.content+" "+ColorPickerClsNames.hostElement,o,{_eSB:"div-sb",_eHue:"div-hue",_eAlpha:"div-alpha",_ePreview:"div-pv",_ePal:"div-pal",_eText:"div-text"});n._palette="#FFF,#000,#F00,#FFC000,#FFFF00,#92D050,#00B050,#00B0F0,#0070C0,#7030A0".split(",");n._updatePalette();n._eHue.style.backgroundImage="url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAD4CAIAAACi6hsPAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAYdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuM4zml1AAAAGvSURBVDhPXdBPaM9xHMfxz4pWaxcmtoOhpdXSVpiyHWxqmVpDjaU5rK34XfypjTJ/p+ZPay6jhsOsRrKwaJElf9IQq03WIkv4FeMwMq221tfje1ByeFzfvd7PEKWGEKWTQRZLySWfVRRTQjmVbKWGOhLsZT+HaeY0bbTTQSfdXOcWffTzmAFeMcwoYyT5ygS/mA5hNgphip98J8kHRnnNSwZ4yH1uc4OrdHGR87RximYO0cgedlLLdqqoYAPrWMtKVrCcJSxiPmnMJUQp/Bsyk2xyyKOAQooopYwKtlDNDur5G7SBJo7RQiv/B+2hl3s84CkvGGKEOOYnxolj/mYmhBmDJ5ngCx95xxsGecYj4pB3iENeoZMO2mmlhaMcpIE4ZII6aqhmM3HMMkooopB88sghm0wySCeVlCjMCVFIYx4LWUwOeRSwhmLWU84mqqihll3sppEmjnOSs5zjEl1c4yZ99POE5wwxwns+840fTDFLFKaZZIJxkozxlmEGGSC+GF++Sy89dHOZC8Rr4lVnOMERDrCPBPXEX22jko2UEn+/mnxyWUYWC0gnNUQh/AEc0HJs6cex0gAAAABJRU5ErkJggg==)";n._eHue.style.backgroundSize="contain";if(navigator.appVersion.indexOf("MSIE 9")>-1){n._eSB.children[0].style.filter="progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffffffff,endColorstr=#00ffffff,GradientType=1)";n._eSB.children[1].style.filter="progid:DXImageTransform.Microsoft.gradient(startColorstr=#00000000,endColorstr=#ff000000,GradientType=0)"}o=ColorPicker._tplCursor;n._cSB=createElement(o);n._cHue=createElement(o);n._cHue.style.width="100%";n._cAlpha=createElement(o);n._cAlpha.style.height="100%";n._eSB.appendChild(n._cSB);n._eHue.appendChild(n._cHue);n._eAlpha.appendChild(n._cAlpha);n._keyActionTab=ColorPickerTabKeyAction.None;var s=n.addEventListener.bind(n),r=n.removeEventListener.bind(n),a=document;s(n.hostElement,"mousedown",(function(e){s(a,"mousemove",mouseMove);s(a,"mouseup",mouseUp);n._mouseDown(e)}));s(n.hostElement,"touchstart",(function(e){s(a,"touchmove",mouseMove);s(a,"touchend",mouseUp);n._mouseDown(e)}));var mouseMove=function(e){n._mouseMove(e)},mouseUp=function(e){r(a,"mousemove",mouseMove);r(a,"mouseup",mouseUp);r(a,"touchmove",mouseMove);r(a,"touchend",mouseUp);n._mouseUp(e)};s(n.hostElement,"click",(function(e){if(!n.isDisabled){var t=e.target;if(t&&"DIV"==t.tagName&&contains(n._ePal,t)){var i=t.style.backgroundColor;i&&(n.value=new Color(i).toString());t.focus()}}}));s(n.hostElement,"keydown",(function(e){n.isDisabled||n._keydown(e)}));n.value="#ffffff";n.initialize(i);n._updatePanels();n._eSB.setAttribute("role","slider");n._eSB.setAttribute("aria-label",culture.ColorPicker.ariaLabels.satAndBrightnessPanel);n._eSB.setAttribute("aria-valuemin","0");n._eSB.setAttribute("aria-valuemax","100");n._eHue.setAttribute("role","slider");n._eHue.setAttribute("aria-label",culture.ColorPicker.ariaLabels.huePanel);n._eHue.setAttribute("aria-valuemin","0");n._eHue.setAttribute("aria-valuemax","360");n._eAlpha.setAttribute("role","slider");n._eAlpha.setAttribute("aria-label",culture.ColorPicker.ariaLabels.opacityPanel);n._eAlpha.setAttribute("aria-valuemin","0");n._eAlpha.setAttribute("aria-valuemax","100");n._ePal.setAttribute("role","grid");n._ePal.setAttribute("aria-label",culture.ColorPicker.ariaLabels.palettePanel);n._updateTabIndex();return n}Object.defineProperty(ColorPicker,"controlTemplate",{get:function(){ColorPicker._ctrlTemplate||(ColorPicker._ctrlTemplate='<div style="position:relative;width:100%;height:100%"><div style="float:left;width:50%;height:100%;box-sizing:border-box;padding:2px"><div wj-part="div-pal"><div style="float:left;width:10%;box-sizing:border-box;padding:2px"><div style="background-color:black;width:100%"></div><div style="height:6px"></div></div></div><div wj-part="div-text" style="position:absolute;bottom:0px;display:none"></div></div><div style="float:left;width:50%;height:100%;box-sizing:border-box;padding:2px"><div wj-part="div-sb" class="'+ColorPickerClsNames.colorBox+'" style="float:left;width:89%;height:89%"><div style="position:absolute;width:100%;height:100%;background:linear-gradient(to right, white 0%,transparent 100%)"></div><div style="position:absolute;width:100%;height:100%;background:linear-gradient(to top, black 0%,transparent 100%)"></div></div><div style="float:left;width:1%;height:89%"></div><div style="float:left;width:10%;height:89%"><div wj-part="div-hue" class="'+ColorPickerClsNames.colorBox+'"></div></div><div style="float:left;width:89%;height:1%"></div><div style="float:left;width:89%;height:10%"><div style="width:100%;height:100%;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAIAAABLbSncAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAYdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuM4zml1AAAAAcSURBVBhXY/iPBBYgAWpKQGkwgMqDAdUk/v8HAM7Mm6GatDUYAAAAAElFTkSuQmCC)"><div wj-part="div-alpha" class="'+ColorPickerClsNames.colorBox+'"></div></div></div><div style="float:left;width:1%;height:10%"></div><div style="float:left;width:10%;height:10%"><div wj-part="div-pv" class="'+ColorPickerClsNames.colorBox+'" style="position:static"></div></div></div></div>');return ColorPicker._ctrlTemplate},set:function(e){ColorPicker._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(ColorPicker.prototype,"showAlphaChannel",{get:function(){return"none"!=this._eAlpha.parentElement.style.display},set:function(e){this._eAlpha.parentElement.style.display=asBoolean(e)?"":"none"},enumerable:!0,configurable:!0});Object.defineProperty(ColorPicker.prototype,"showColorString",{get:function(){return"none"!=this._eText.style.display},set:function(e){this._eText.style.display=asBoolean(e)?"":"none";if(asBoolean(e)){this._eText.setAttribute("role","status");this._eText.setAttribute("aria-live","polite")}},enumerable:!0,configurable:!0});Object.defineProperty(ColorPicker.prototype,"value",{get:function(){return this._value},set:function(e){if(e!=this.value){var t=this.value,i=(e=asString(e)).trim(),n=Color.fromString(i);if(n){var o=n.getHsb();this._value=i;this._eText.innerText=i;if(this._hsb[0]!=o[0]||this._hsb[1]!=o[1]||this._hsb[2]!=o[2]||this._alpha!=n.a){if(0==o[2]){o[0]=this._hsb[0];o[1]=this._hsb[1]}else 0==o[1]&&(o[0]=this._hsb[0]);this._hsb=o;this._alpha=n.a;this.onValueChanged()}else""===t&&this.onValueChanged()}else if(""===i){var s=new Color(e);this._hsb=s.getHsb();this._alpha=s.a;this._value=e;this._eText.innerText=i;this.onValueChanged()}}},enumerable:!0,configurable:!0});Object.defineProperty(ColorPicker.prototype,"palette",{get:function(){return this._palette},set:function(e){if((e=(e=asArray(e)).slice(0,10)).every((function(e){return null!=Color.fromString(e)}))){this._palette=e;this._updatePalette()}},enumerable:!0,configurable:!0});Object.defineProperty(ColorPicker.prototype,"ariaLabel",{get:function(){return this._ariaLabel},set:function(e){if(e!=this._ariaLabel){this._ariaLabel=e;setAttribute(this.hostElement,"aria-label",this._ariaLabel)}},enumerable:!0,configurable:!0});Object.defineProperty(ColorPicker.prototype,"keyActionTab",{get:function(){return this._keyActionTab},set:function(e){this._keyActionTab=e;if(e==ColorPickerTabKeyAction.All){this.tabOrder=0;this.hostElement.setAttribute("tabindex","-1")}this._updateTabIndex()},enumerable:!0,configurable:!0});ColorPicker.prototype._setTabOrder=function(t){e.prototype._setTabOrder.call(this,t);this.isDisabled||this._updateTabIndex()};ColorPicker.prototype.onValueChanged=function(e){this._refreshSelection();this.valueChanged.raise(this,e)};ColorPicker.prototype._mouseDown=function(e){this._htDown=this._getTargetPanel(e);if(this._htDown){e.preventDefault();this._htDown.focus();this._mouseMove(e)}};ColorPicker.prototype._mouseMove=function(e){if(!this.isDisabled){var t=e.touches?e.touches[0]:e,i=this._htDown;if(i){var n=i.getBoundingClientRect(),o=this._hsb.slice(),s=this._alpha;if(i==this._eHue)o[0]=clamp((t.clientY-n.top)/n.height,0,.99);else if(i==this._eSB){o[1]=clamp((t.clientX-n.left)/n.width,0,1);o[2]=clamp(1-(t.clientY-n.top)/n.height,0,1)}else i==this._eAlpha&&(s=clamp((t.clientX-n.left)/n.width,0,1));this._updateColor(o,s)}}};ColorPicker.prototype._mouseUp=function(e){this._htDown=null};ColorPicker.prototype._updateColor=function(e,t){void 0===e&&(e=this._hsb);void 0===t&&(t=this._alpha);var i=this._hsb[0]!==e[0]||this._hsb[1]!==e[1]||this._hsb[2]!==e[2],n=this._alpha!==t;if(i||n){this._hsb=e;this._alpha=t;var o=Color.fromHsb(e[0],e[1],e[2],t);this._value=o.toString();this._eText.innerText=this._value;this.onValueChanged()}};ColorPicker.prototype._updatePalette=function(){var e=this,t=new Color("#fff"),i=new Color("#000");this._ePal.innerHTML="";this._ePal.className="palette-grid";for(var n=Array.from({length:6},(function(){var e=document.createElement("div");e.className="palette-row";e.setAttribute("role","row");return e})),o=this.getActualTabIndex(),s=0;s<this._palette.length;s++){var r=new Color(this._palette[s]),a=r.getHsb(),l=this._makePalEntry(r);l.innerHTML="​";l.setAttribute("role","columnheader");l.setAttribute("aria-label",culture.ColorPicker.ariaLabels.baseColor+" "+r.toString());if(0===s){this._ePalMainFirst=l;this._ePalMainFirst.setAttribute("tabindex",o)}else l.setAttribute("tabindex","-1");n[0].appendChild(l);for(var h=0;h<5;h++){var u=0===a[1]?Color.interpolate(t,i,.1*h+(a[2]>.5?.05:.55)):Color.fromHsb(a[0],.1+.2*h,1-.1*h),c=this._makePalEntry(u);c.setAttribute("role","gridcell");c.setAttribute("aria-label",culture.ColorPicker.ariaLabels.shadeColor+" "+u.toString());if(0===s&&0===h){this._ePalShadeFirst=c;this._ePalShadeFirst.setAttribute("tabindex",o)}else setAttribute(c,"tabindex","-1");n[h+1].appendChild(c)}}n.forEach((function(t){return e._ePal.appendChild(t)}))};ColorPicker.prototype._makePalEntry=function(e){var t=document.createElement("div");t.className="palette-gridcell";setCss(t,{backgroundColor:e.toString()});return t};ColorPicker.prototype._updatePanels=function(){var e=Color.fromHsb(this._hsb[0],1,1,1),t=Color.fromHsb(this._hsb[0],this._hsb[1],this._hsb[2],1);this._eSB.style.backgroundColor=e.toString();this._eAlpha.style.background="linear-gradient(to right, transparent 0%, "+t.toString()+" 100%)";navigator.appVersion.indexOf("MSIE 9")>-1&&(this._eAlpha.style.filter="progid:DXImageTransform.Microsoft.gradient(startColorstr=#00000000,endColorstr="+t.toString()+", GradientType = 1)");var i=this.value.trim();this._ePreview.style.backgroundColor=i;this._cHue.style.top=(100*this._hsb[0]).toFixed(0)+"%";this._cSB.style.left=(100*this._hsb[1]).toFixed(0)+"%";this._cSB.style.top=(100-100*this._hsb[2]).toFixed(0)+"%";this._cAlpha.style.left=(100*this._alpha).toFixed(0)+"%";var n=this.getColorsDiv(),o=getActiveElement();if(this.keyActionTab===ColorPickerTabKeyAction.All&&!this.hostElement.contains(o)){if(this.isDisabled)return;for(var s=!1,r=0;r<n.length;r++){var a=n[r].style.backgroundColor;if(Color.fromString(i).equals(Color.fromString(a))){n[r].focus();s=!0;break}}s||n[0].focus()}};ColorPicker.prototype.getColorsDiv=function(){var e=Array.from(this._ePal.querySelectorAll('[role="columnheader"]')),t=Array.from(this._ePal.querySelectorAll('[role="gridcell"]'));return e.concat(t)};ColorPicker.prototype._getTargetPanel=function(e){var t=e.target;return contains(this._eSB,t)?this._eSB:contains(this._eHue,t)?this._eHue:contains(this._eAlpha,t)?this._eAlpha:null};ColorPicker.prototype.getActualTabIndex=function(){var e=this.tabOrder.toString();return this.keyActionTab===ColorPickerTabKeyAction.All&&!0!==this.isDisabled?e:"-1"};ColorPicker.prototype._updateTabIndex=function(){var e=this.getActualTabIndex();this._eSB.setAttribute("tabindex",e);this._eHue.setAttribute("tabindex",e);this._eAlpha.setAttribute("tabindex",e);this._ePalMainFirst.setAttribute("tabindex",e);this._ePalShadeFirst.setAttribute("tabindex",e)};ColorPicker.prototype._setIsDisabled=function(t){e.prototype._setIsDisabled.call(this,t);this._updateTabIndex()};ColorPicker.prototype._updateAriaValues=function(){var e=this._hsb;this._eSB.setAttribute("aria-valuenow",(100*e[1]).toString());this._eSB.setAttribute("aria-valuetext",culture.ColorPicker.ariaLabels.saturation+" "+Math.round(100*e[1])+"%, "+culture.ColorPicker.ariaLabels.brightness+" "+Math.round(100*e[2])+"%");this._eHue.setAttribute("aria-valuenow",(360*e[0]).toString());this._eHue.setAttribute("aria-valuetext",culture.ColorPicker.ariaLabels.hue+" "+Math.round(360*e[0])+" "+culture.ColorPicker.ariaLabels.degrees);this._eAlpha.setAttribute("aria-valuenow",(100*this._alpha).toString());this._eAlpha.setAttribute("aria-valuetext",culture.ColorPicker.ariaLabels.opacity+" "+Math.round(100*this._alpha)+"%")};ColorPicker.prototype._keydown=function(e){var t=e.target;this._isInColorPalette(t)?this._handleColorNavigation(e,t):t!==this._eSB?t!==this._eHue?t!==this._eAlpha||this._handleAlphaNavigation(e):this._handleHSBNavigation(e,"hue"):this._handleHSBNavigation(e,"sb")};ColorPicker.prototype._isInColorPalette=function(e){return e&&"DIV"===e.tagName&&contains(this._ePal,e)};ColorPicker.prototype._handleColorNavigation=function(e,t){var i=this.getColorsDiv(),n=this.palette.length,o=i.findIndex((function(e){return e===t})),s=null;switch(e.key){case"ArrowDown":o<i.length-1&&(s=i[o+n]);break;case"ArrowUp":o>0&&(s=i[o-n]);break;case"ArrowRight":var r=o+1;r<i.length&&(s=i[r]);break;case"ArrowLeft":var a=o-1;a>=0&&(s=i[a])}if(s){var l=s.style.backgroundColor;l&&(this.value=new Color(l).toString());s.focus();e.preventDefault()}};ColorPicker.prototype._handleHSBNavigation=function(e,t){var i=this._hsb.slice();i=i.map((function(e){return roundTo(e,2)}));var adjust=function(e,t,n){var o=Math.round(100*i[e]);i[e]=clamp((o+t)/100,0,n)};switch(e.key){case"ArrowLeft":"sb"===t&&adjust(1,-1,1);break;case"ArrowRight":"sb"===t&&adjust(1,1,1);break;case"ArrowUp":"sb"===t?adjust(2,1,1):adjust(0,-1,.99);break;case"ArrowDown":"sb"===t?adjust(2,-1,1):adjust(0,1,.99)}if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(e.key)){this._updateColor(i,void 0);e.preventDefault()}};ColorPicker.prototype._refreshSelection=function(){this._updatePanels();this._updateAriaValues()};ColorPicker.prototype._handleAlphaNavigation=function(e){var t=this._alpha;switch(e.key){case"ArrowLeft":t=clamp(t-.01,0,1);break;case"ArrowRight":t=clamp(t+.01,0,1);break;default:return}this._updateColor(void 0,t);e.preventDefault()};ColorPicker._ctrlTemplate="";ColorPicker._tplCursor='<div class="wj-colorpicker-cursor"></div>';return ColorPicker}(Control);export{ColorPicker};_addCultureInfo("CollectionViewNavigator",{ariaLabels:{byPage:{btnFirst:"Navigate to first page",btnPrev:"Navigate to previous page",btnNext:"Navigate to next page",btnLast:"Navigate to last page"},byItem:{btnFirst:"Navigate to first item",btnPrev:"Navigate to previous item",btnNext:"Navigate to next item",btnLast:"Navigate to last item"}}});var CollectionViewNavigator=function(e){__extends(CollectionViewNavigator,e);function CollectionViewNavigator(t,i){var n=e.call(this,t)||this;n._view=null;n._byPage=!1;n._fmt="{current:n0} / {count:n0}";n._liveRegionON=!1;n._ariaLabel="";var o=n.getTemplate();n.applyTemplate(ControlClsNames.hostElement+" "+ControlClsNames.content+" "+CollectionViewNavigatorClsNames.pager+" "+CollectionViewNavigatorClsNames.hostElement,o,{_btnFirst:"btn-first",_btnPrev:"btn-prev",_txtCurr:"txt-curr",_btnNext:"btn-next",_btnLast:"btn-last"},"input");n.hostElement.tabIndex=-1;n._updateAriaLabels();var s=uidGenerator();n._txtCurr.id=s;[n._btnFirst,n._btnPrev,n._btnNext,n._btnLast].forEach((function(e){setAttribute(e.firstElementChild,"aria-controls",n._txtCurr.id)}));setAttribute(n.hostElement.firstElementChild,"role","group");setAttribute(n._txtCurr,"role","status");n._rptNext=new _ClickRepeater(n._btnNext.querySelector("button"));n._rptPrev=new _ClickRepeater(n._btnPrev.querySelector("button"));n.addEventListener(n.hostElement,"click",n._click.bind(n));n.addEventListener(n.hostElement,"keydown",n._keydown.bind(n));setAttribute(n.hostElement,"role","navigation");n._addA11yRelatedHandlers();n.initialize(i);n._update();return n}Object.defineProperty(CollectionViewNavigator,"controlTemplate",{get:function(){CollectionViewNavigator._ctrlTemplate||(CollectionViewNavigator._ctrlTemplate='<div class="'+InputClsNames.inputGroup+'"><span wj-part="btn-first" class="'+InputClsNames.inputGroupBtn+'"><button class="'+InputFormElementsClsNames.btn+" "+InputFormElementsClsNames.btnDefault+'"><span class="'+GlyphClsNames.stepBackward+'"></span></button></span><span wj-part="btn-prev" class="'+InputClsNames.inputGroupBtn+'"> <button class="'+InputFormElementsClsNames.btn+" "+InputFormElementsClsNames.btnDefault+'"><span class="'+GlyphClsNames.left+'"></span> </button></span><span wj-part="txt-curr" tabIndex="0"></span><span wj-part="btn-next" class="'+InputClsNames.inputGroupBtn+'"><button class="'+InputFormElementsClsNames.btn+" "+InputFormElementsClsNames.btnDefault+'"><span class="'+GlyphClsNames.right+'"></span></button></span><span wj-part="btn-last" class="'+InputClsNames.inputGroupBtn+'"><button class="'+InputFormElementsClsNames.btn+" "+InputFormElementsClsNames.btnDefault+'"><span class="'+GlyphClsNames.stepForward+'"></span></button></span></div>');return CollectionViewNavigator._ctrlTemplate},set:function(e){CollectionViewNavigator._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(CollectionViewNavigator.prototype,"cv",{get:function(){return this._view},set:function(e){if(e!=this._view){var t=this._view;if(t){t.collectionChanged.removeHandler(this._collectionChanged);t.currentChanged.removeHandler(this._currentChanged)}t=this._view=asType(e,"ICollectionView",!0);this._update();if(t){t.collectionChanged.addHandler(this._collectionChanged,this);t.currentChanged.addHandler(this._currentChanged,this)}}},enumerable:!0,configurable:!0});Object.defineProperty(CollectionViewNavigator.prototype,"byPage",{get:function(){return this._byPage},set:function(e){if(e!=this._byPage){this._byPage=asBoolean(e);this._update();this._updateAriaLabels()}},enumerable:!0,configurable:!0});Object.defineProperty(CollectionViewNavigator.prototype,"headerFormat",{get:function(){return this._fmt},set:function(e){if(e!=this._fmt){this._fmt=asString(e);this._update()}},enumerable:!0,configurable:!0});Object.defineProperty(CollectionViewNavigator.prototype,"repeatButtons",{get:function(){return!this._rptNext.disabled},set:function(e){this._rptNext.disabled=this._rptPrev.disabled=!asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(CollectionViewNavigator.prototype,"ariaLabel",{get:function(){if(this.hostElement){var e=this.hostElement.getAttribute("aria-label");if(e)return e}return this._ariaLabel},set:function(e){if(this.ariaLabel!==e){this._ariaLabel=e;this.hostElement&&setAttribute(this.hostElement,"aria-label",e)}},enumerable:!0,configurable:!0});Object.defineProperty(CollectionViewNavigator.prototype,"isDisabled",{get:function(){return this._isDisabled},set:function(e){this._setIsDisabled(e)},enumerable:!0,configurable:!0});CollectionViewNavigator.prototype.focus=function(){var e=this._e;e&&e.offsetHeight&&(this.isDisabled||moveFocus(e,0)||this._txtCurr.tabIndex>=0&&this._txtCurr.focus())};CollectionViewNavigator.prototype._update=function(){var e=this._view,t=this._byPage,i=e?t?e.pageIndex:e.currentPosition:0,n=e?t?e.pageCount:e.itemCount:0;if(this.isDisabled)[this._btnFirst,this._btnPrev,this._btnNext,this._btnLast].forEach((function(e){enable(e,!1)}));else{enable(this._btnFirst,e&&i>0);enable(this._btnPrev,e&&i>0);enable(this._txtCurr,null!=e);enable(this._btnNext,e&&i<n-1);enable(this._btnLast,e&&i<n-1)}this._updateTabIndex();this._txtCurr.textContent=format(this._fmt,{current:e?i+1:0,count:e?n:0,currentItem:e?e.currentPosition+1:0,itemCount:e?e.itemCount:0,currentPage:e?e.pageIndex+1:0,pageCount:e?e.pageCount:0})};CollectionViewNavigator.prototype._currentChanged=function(){this._update()};CollectionViewNavigator.prototype._collectionChanged=function(){this._update()};CollectionViewNavigator.prototype._click=function(e){var t=e.target,i=this._view,n=this._byPage;if(i){contains(this._btnFirst,t)?n?i.moveToFirstPage():i.moveCurrentToFirst():contains(this._btnPrev,t)?n?i.moveToPreviousPage():i.moveCurrentToPrevious():contains(this._btnNext,t)?n?i.moveToNextPage():i.moveCurrentToNext():contains(this._btnLast,t)&&(n?i.moveToLastPage():i.moveCurrentToLast());(this.byPage?i.pageIndex>=i.pageCount-1||i.pageIndex<=0:i.currentPosition>=i.itemCount-1||i.currentPosition<=0)&&!this.isDisabled&&this._txtCurr.tabIndex>=0&&this._txtCurr.focus();e.preventDefault()}};CollectionViewNavigator.prototype._updateAriaLabels=function(){var e=culture.CollectionViewNavigator.ariaLabels[this._byPage?"byPage":"byItem"];setAttribute(this._btnFirst.firstElementChild,"aria-label",e.btnFirst);setAttribute(this._btnPrev.firstElementChild,"aria-label",e.btnPrev);setAttribute(this._btnNext.firstElementChild,"aria-label",e.btnNext);setAttribute(this._btnLast.firstElementChild,"aria-label",e.btnLast)};CollectionViewNavigator.prototype._addA11yRelatedHandlers=function(){var e=this;this.addEventListener(this._txtCurr,"focus",(function(t){if(e._txtCurr===document.activeElement){setAttribute(e._txtCurr,"aria-live","off");setAttribute(e._txtCurr,"aria-label",e._txtCurr.textContent);e._liveRegionON=!1}}));this.addEventListener(this._txtCurr,"blur",(function(t){e._txtCurr!==document.activeElement&&e._txtCurr.removeAttribute("aria-label")}));[this._btnFirst.firstElementChild,this._btnPrev.firstElementChild,this._btnNext.firstElementChild,this._btnLast.firstElementChild].forEach((function(t){e.addEventListener(t,"focus",(function(t){setTimeout((function(){if(!e._liveRegionON){var t=_isMacOS()?"polite":"assertive";setAttribute(e._txtCurr,"aria-live",t);e._liveRegionON=!0}}))}))}))};CollectionViewNavigator.prototype._setTabOrder=function(e){var t=this._e,i=null!=this._txtCurr.getAttribute("disabled");this._orgTabIndex=e;if(this.isDisabled||i){t.tabIndex=-1;this._txtCurr.tabIndex=-1}else i||(this._txtCurr.tabIndex=this._orgTabIndex)};CollectionViewNavigator.prototype._keydown=function(e){if(contains(this._txtCurr,e.target)&&(e.ctrlKey||e.metaKey)&&("A"===e.key||"a"===e.key)){e.preventDefault();var t=document.createRange();t.selectNodeContents(this._txtCurr);var i=window.getSelection();i.removeAllRanges();i.addRange(t)}};CollectionViewNavigator.prototype._setIsDisabled=function(e){if((e=!!asBoolean(e,!0))!=this.isDisabled){var t=this._e;if(t){this._isDisabled=e;toggleClass(t,ControlStateClsNames.disabled,e);this._update();this._txtCurr.tabIndex=e?-1:this._orgTabIndex}}};CollectionViewNavigator.prototype._updateTabIndex=function(){var e=this;[this._btnFirst,this._btnPrev,this._btnNext,this._btnLast].forEach((function(t){if(e._isDisabled)t.firstElementChild.setAttribute("tabindex","-1");else{t.firstElementChild.disabled?t.firstElementChild.setAttribute("tabindex","-1"):t.firstElementChild.setAttribute("tabindex",e._orgTabIndex.toString())}}))};CollectionViewNavigator._ctrlTemplate="";return CollectionViewNavigator}(Control);export{CollectionViewNavigator};_addCultureInfo("Listbox",{ariaLabels:{listBox:"list box"}});var ListBox=function(e){__extends(ListBox,e);function ListBox(t,i){var n=e.call(this,t,null,!0)||this;n._cv=null;n._itemFormatter=null;n._pathDisplay=new Binding("");n._pathValue=new Binding("");n._pathChecked=new Binding("");n._html=!1;n._shGroups=!1;n._checkedItems=[];n._itemRole="option";n._caseSensitive=!1;n._addMode=!1;n._isShiftDown=!1;n._shouldClearOnShift=!0;n._vThreshold=ListBox._VTHRESH;n._isVirtual=!1;n._children=[];n._ignoreItemFormatterTextArray=[];n._itemFormatterHelper=document.createElement("div");n._clientHeight=-1;n._itemHeight=30;n._itemsAbove=-1;n._itemsBelow=-1;n._eSizer=document.createElement("div");n._ePadTop=document.createElement("div");n._ePadBot=document.createElement("div");n._checking=!1;n._ignoredItemChangedEvents=!1;n._search="";n._fmtItemHandlers=0;n._itemCount=0;n._oldSel=null;n._container=null;n._oldSelectedIndex=-1;n._ariaLabel=culture.Listbox.ariaLabels.listBox;n._isNeedUpdateBnd=!0;n.selectedIndexChanged=new Event;n.itemsChanged=new Event;n.loadingItems=new Event;n.loadedItems=new Event;n.itemChecked=new Event;n.checkedItemsChanged=new Event;n.formatItem=new Event((function(){n.invalidate()}));n._handleKeyUp=function(e){if("Shift"===e.key){n._isShiftDown=!1;n._shouldClearOnShift=!0}};n.applyTemplate(ControlClsNames.hostElement+" "+ControlClsNames.content+" "+ListBoxClsNames.hostElement,null,null);var o=n.hostElement;setAttribute(o,"role","listbox",!0);n._updateAriaLabel();"SELECT"==n._orgTag&&n._initFromSelect(n.hostElement);n.addEventListener(o,"click",n._click.bind(n));n.addEventListener(o,"keydown",n._keydown.bind(n));n.addEventListener(o,"keypress",n._keypress.bind(n));n.addEventListener(o,"keyup",n._handleKeyUp.bind(n));n.addEventListener(o,"wheel",(function(e){if(o.scrollHeight>o.offsetHeight&&(e.deltaY<0&&0==o.scrollTop||e.deltaY>0&&o.scrollTop+o.offsetHeight>=o.scrollHeight)){e.preventDefault();e.stopPropagation();e.stopImmediatePropagation()}}));[n._eSizer,n._ePadTop,n._ePadBot].forEach((function(e){e.tabIndex=-1;setAttribute(e,"aria-hidden",!0);setCss(e,{pointerEvents:"none",opacity:"0"})}));n.initialize(i);n._updateViewRange();n.addEventListener(n.hostElement,"scroll",(function(e){n._updateViewRange()}));return n}Object.defineProperty(ListBox.prototype,"ariaLabelledBy",{get:function(){return this.hostElement.getAttribute("aria-labelledby")},set:function(e){_setAriaLabelBy(this,this.hostElement,e,this._updateAriaLabel.bind(this))},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"itemsSource",{get:function(){return this._items},set:function(e){if(this._items!=e){if(this._cv){this._cv.currentChanged.removeHandler(this._cvCurrentChanged,this);this._cv.collectionChanged.removeHandler(this._cvCollectionChanged,this);this._cv=null}this._items=e;this._cv=asCollectionView(e);if(null!=this._cv){this._cv.currentChanged.addHandler(this._cvCurrentChanged,this);this._cv.collectionChanged.addHandler(this._cvCollectionChanged,this)}this._populateList();this.onItemsChanged();this.onSelectedIndexChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"collectionView",{get:function(){return this._cv},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"virtualizationThreshold",{get:function(){return this._vThreshold},set:function(e){if(e!=this._vThreshold){var t=this._getVirtual();this._vThreshold=asNumber(e,!1,!0);t!=this._getVirtual()&&this._populateList()}},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"showGroups",{get:function(){return this._shGroups},set:function(e){if(e!=this._shGroups){this._shGroups=asBoolean(e);this._populateList()}},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"isContentHtml",{get:function(){return this._html},set:function(e){if(e!=this._html){this._html=asBoolean(e);this._populateList()}},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"itemFormatter",{get:function(){return this._itemFormatter},set:function(e){if(e!=this._itemFormatter){this._itemFormatter=asFunction(e);this._populateList()}},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"displayMemberPath",{get:function(){return this._pathDisplay.path},set:function(e){if(e!=this.displayMemberPath){this._pathDisplay.path=asString(e);this._populateList()}},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"selectedValuePath",{get:function(){return this._pathValue.path},set:function(e){this._pathValue.path=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"checkedMemberPath",{get:function(){return this._pathChecked.path},set:function(e){if(e!=this.checkedMemberPath){this._pathChecked.path=asString(e);setAttribute(this.hostElement,"aria-multiselectable",""!==this.checkedMemberPath?"true":"false");this._populateList()}},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"caseSensitiveSearch",{get:function(){return this._caseSensitive},set:function(e){this._caseSensitive=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"itemRole",{get:function(){return this._itemRole},set:function(e){if(e!=this.itemRole){this._itemRole=asString(e);this._populateList()}},enumerable:!0,configurable:!0});ListBox.prototype.getDisplayValue=function(e,t){var i=null;if(e>-1&&hasItems(this._cv)){i=this._cv.items[e];this.displayMemberPath&&(i=this._pathDisplay.getValue(i))}var n=null!=i?i.toString():"";this._itemFormatter&&!t&&(n=this._itemFormatter(e,n));return n};ListBox.prototype.getDisplayText=function(e){return this._getDisplayText(e)};ListBox.prototype._getDisplayText=function(e,t){if(t&&this._ignoreItemFormatterTextArray[e])return this._ignoreItemFormatterTextArray[e];var i=this._getChild(e);return null!=i?i.textContent:""};ListBox.prototype.isItemEnabled=function(e){var t=this._getChild(e);return null!=t&&!t.hasAttribute("disabled")&&!hasClass(t,ControlStateClsNames.disabled)&&!hasClass(t,UtilitesClsNames.separator)};Object.defineProperty(ListBox.prototype,"selectedIndex",{get:function(){return this._cv?this._cv.currentPosition:-1},set:function(e){if(this._cv){this._oldSelectedIndex=this._cv.currentPosition;this._cv.moveCurrentToPosition(asNumber(e))}},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"selectedItem",{get:function(){return this._cv?this._cv.currentItem:null},set:function(e){this._cv&&this._cv.moveCurrentTo(e)},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"selectedValue",{get:function(){var e=this.selectedItem;e&&this.selectedValuePath&&(e=this._pathValue.getValue(e));return e},set:function(e){var t=this._cv,i=t?t.items:null,n=this.selectedValuePath,o=-1;if(i){for(var s=0;s<i.length;s++){var r=i[s],a=n?this._pathValue.getValue(r):r;if(a===e||DateTime.equals(a,e)){o=s;break}if(this.isContentHtml&&isString(a)&&a.indexOf("<")>-1&&toPlainText(a)===e){o=s;break}}this.selectedIndex=o}},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"maxHeight",{get:function(){var e=this.hostElement,t=e?parseFloat(e.style.maxHeight):null;return isNaN(t)?null:t},set:function(e){var t=this.hostElement;if(t){e=asNumber(e,!0);t.style.maxHeight=null==e?"":e+"px"}},enumerable:!0,configurable:!0});ListBox.prototype.showSelection=function(e){void 0===e&&(e=this.containsFocus());var t=this.hostElement,i=this._children,n=this._getSelectedElement(!1),o=new Rect(0,0,0,0);if(n!=this._oldSel){this._updateItemAttributes(n,!0);this._updateItemAttributes(this._oldSel,!1);this._oldSel=n}n instanceof HTMLElement?o=this._getBoundingClientRect(n):this._children.length>0&&(o=this._getBoundingClientRect(this._getChild(0)));var s=this._getBoundingClientRect(t),r=0;if(this._shGroups){r=this._itemHeight;if(!this._isVirtual){var a=i[0];a&&a.offsetHeight&&hasClass(a,ListBoxClsNames.header)&&(r=a.offsetHeight)}}o.bottom>s.bottom?t.scrollTop+=o.bottom-s.bottom:o.top<s.top+r&&(t.scrollTop-=s.top+r-o.top);this._updateViewRange();n=this._getSelectedElement(!0);setAttribute(t,"aria-activedescendant",n?n.id:null);if(e){(n&&!contains(n,getActiveElement())?n:t).focus()}t.tabIndex=n?-1:this._orgTabIndex};ListBox.prototype.loadList=function(){this._populateList()};ListBox.prototype.getItemChecked=function(e){var t=this._cv.items[e],i=this._pathChecked;return isObject(t)&&i.path?i.getValue(t):this._getCheckboxState(e)};ListBox.prototype.setItemChecked=function(e,t){this._setItemChecked(e,t,!0)};ListBox.prototype.toggleItemChecked=function(e){this.setItemChecked(e,!this.getItemChecked(e))};Object.defineProperty(ListBox.prototype,"checkedItems",{get:function(){return this._checkedItems},set:function(e){e=Array.from(new Set(e));var t=asArray(e,!1);if(!this._arrayEquals(t,this._checkedItems)){this._updateCheckedList(t);if(!this._arrayEquals(t,this._checkedItems)){this._checkedItems=t;this.onCheckedItemsChanged()}}},enumerable:!0,configurable:!0});ListBox.prototype.indexOf=function(e){return(e=closest(e,"."+ListBoxClsNames.listBoxItem))?e[ListBox._DIDX_KEY]:-1};ListBox.prototype.onSelectedIndexChanged=function(e){this.selectedIndexChanged.raise(this,e)};ListBox.prototype.onItemsChanged=function(e){this.itemsChanged.raise(this,e)};ListBox.prototype.onLoadingItems=function(e){this.loadingItems.raise(this,e)};ListBox.prototype.onLoadedItems=function(e){this.loadedItems.raise(this,e)};ListBox.prototype.onItemChecked=function(e){this.itemChecked.raise(this,e)};ListBox.prototype.onCheckedItemsChanged=function(e){this.checkedItemsChanged.raise(this,e)};ListBox.prototype.onFormatItem=function(e){this.formatItem.raise(this,e)};ListBox.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);if(this.hostElement){var i=this._cv?this._cv.items.length:0,n=this.formatItem.handlerCount;if(i!=this._itemCount||n!=this._fmtItemHandlers){this._fmtItemHandlers=n;this._populateList()}else this._updateViewRange()}};ListBox.prototype._updateAriaLabel=function(){this.hostElement&&(this.ariaLabelledBy?setAriaLabel(this.hostElement,null):setAriaLabel(this.hostElement,this._ariaLabel))};ListBox.prototype._updateCheckedList=function(e){var t=this,i=this._cv,n=this._pathChecked,o=new Map;if(n&&i){var s=i.sourceCollection;if(s&&s.length){isObject(s[0])||(n=null);e.forEach((function(e){return o.set(e,!0)}));this._checking=!0;var r=[];s.forEach((function(e){var i=o.has(e);i&&r.push(e);n&&t._isNeedUpdateBnd&&n.setValue(e,i)}));this._checking=!1;e=r}i.items.forEach((function(e,i){t._setItemChecked(i,o.has(e),!1)}))}};ListBox.prototype._getBoundingClientRect=function(e){if(!e.offsetHeight){var t=this.indexOf(e),i=this.hostElement;if(t>-1&&i){t=this._getElementIndex(t);var n=i.getBoundingClientRect();return new Rect(0,n.top-i.scrollTop+t*this._itemHeight,n.width,this._itemHeight)}}return Rect.fromBoundingRect(e.getBoundingClientRect())};ListBox.prototype._updateItemAttributes=function(e,t){if(e){var i=this.checkedMemberPath?"true"===e.getAttribute("aria-selected"):null;toggleClass(e,ControlStateClsNames.selected,t);this._isMenuItem()||setAttribute(e,"aria-selected",this._getAriaSelected(t,i));e.tabIndex=t?this._orgTabIndex:-1}};ListBox.prototype._getCheckedItems=function(){var e=this,t=this._cv,i=this._pathChecked,n=[];t&&i&&i.path&&(n=t.sourceCollection.filter((function(n,o){if(t.filter&&!t.filter(n))return!!e._addMode&&i.getValue(n);if(isObject(n))return i.getValue(n);var s=t.items[o]==n?o:t.items.indexOf(n);return e.getItemChecked(s)})));return n};ListBox.prototype._arrayEquals=function(e,t){if(e==t)return!0;if(!e||!t||e.length!=t.length)return!1;for(var i=0;i<e.length;i++)if(!this._isEqual(e[i],t[i]))return!1;return!0};ListBox.prototype._getChild=function(e){e=this._getElementIndex(e);return this._children[e]};ListBox.prototype._getElementIndex=function(e){if(this._shGroups)for(var t=this._children,i=0;i<=e&&i<t.length;i++){var n=t[i];hasClass(n,ListBoxClsNames.header)&&e++}return e};ListBox.prototype._setItemChecked=function(e,t,i){void 0===i&&(i=!0);var n=this._cv.items[e],o=this._pathChecked,s=!1,r=this.selectedIndex,a=this._checking;if(isObject(n)&&o.path){if(!!o.getValue(n)!=t){var l=tryCast(this._cv,"IEditableCollectionView");s=!0;this._checking=!0;if(l){l.editItem(n);o.setValue(n,t);l.commitEdit()}else{o.setValue(n,t);l.refresh()}this._checking=a}}else if(i){var h=this._findArrayItem(this._checkedItems,n);(t&&h<0||!t&&h>=0)&&(s=!0)}this._setCheckboxState(e,t);if(i){if(s){this._checkedItems=this._checkedItemsUpdate(n,t);this.onItemChecked();this.onCheckedItemsChanged()}r!=this.selectedIndex&&this.onSelectedIndexChanged()}return s};ListBox.prototype._checkedItemsUpdate=function(e,t){var i=this._cv.sourceCollection,n=this._checkedItems,o=0;if(t){for(var s=0;s<i.length;s++){var r=i[s];if(o<n.length&&this._isEqual(r,n[o]))o++;else if(this._isEqual(r,e))return n.slice(0,o).concat([e]).concat(n.slice(o))}return n}var a=this._findArrayItem(n,e);return n.slice(0,a).concat(n.slice(a+1))};ListBox.prototype._isEqual=function(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)};ListBox.prototype._findArrayItem=function(e,t){if(!Number.isNaN(t))return e.indexOf(t);for(var i=0;i<e.length;i++)if(Number.isNaN(e[i]))return i;return-1};ListBox.prototype._cvCollectionChanged=function(){if(!this._checking){this._populateList();this.onItemsChanged()}};ListBox.prototype._cvCurrentChanged=function(){if(!this._checking){this.showSelection();this._ignoredItemChangedEvents||this.onSelectedIndexChanged()}};ListBox.prototype._populateList=function(){var e=this.hostElement,t=this._cv;this._itemCount=t?t.items.length:0;this._isVirtual=this._getVirtual();this._oldSel=null;this._itemsAbove=-1;this._itemsBelow=-1;if(e){var i=this.containsFocus(),n=void 0;this.onLoadingItems();var o=this._children=[];e.textContent="";if(t){var s=0,r=void 0,a=[];this._ignoreItemFormatterTextArray=[];if(this._shGroups&&t.groups&&t.groups.length){n={};for(var l=0;l<t.groups.length;l++){var h=t.groups[l];n[s]=h;r=this._createHeaderItem(h,l);a.push(r);for(var u=0;u<h.items.length;u++,s++){r=this._createItem(s,l);a.push(r)}}}else for(u=0;u<t.items.length;u++,s++){r=this._createItem(s);a.push(r)}var c=this._isVirtual?document.createElement("div"):e,p=0;setInnerHTMLSafe(c,a.join(""));for(u=0;u<c.children.length;u++){var d=c.children[u];p==t.currentPosition&&(this._oldSel=d);d[ListBox._DIDX_KEY]=d.className.indexOf(ListBoxClsNames.header)<0?p++:-1;o.push(d)}}if(this.formatItem.hasHandlers&&t){s=0;var m=t.items;for(d=new FormatItemEventArgs(0,null,null),u=0;u<o.length;u++){d._item=o[u];if(this._shGroups&&hasClass(d._item,ListBoxClsNames.header)){d._index=-1;d._data=n[s]}else{d._index=s;d._data=m[s++]}this.onFormatItem(d)}}if(this._isVirtual){var _=this._getCanvasContext(),f=null,b=0;for(u=0;u<o.length;u++){r=o[u];var g=_.measureText(r.textContent);if(g.width>b){f=r;b=g.width}}if(f){var y=!1,v=e.style.display,C=e.style.position;if(!e.parentElement){y=!0;(this._container||document.body).appendChild(e);setCss(e,{display:"",position:"absolute"})}e.appendChild(f);var x=f.style.whiteSpace;f.style.whiteSpace="nowrap";this._ePadTop.style.width=f.offsetWidth+"px";this._itemHeight=f.offsetHeight||this._itemHeight;f.style.whiteSpace=x;this._eSizer.style.height=o.length*this._itemHeight+"px";e.appendChild(this._eSizer);this._clientHeight=e.clientHeight;removeChild(this._eSizer);if(y){removeChild(e);setCss(e,{display:v,position:C})}removeChild(f)}else this._ePadTop.style.width="";this._updateViewRange()}this.checkedItems=this._getCheckedItems();var D=this._getSelectedElement(!0);if(i){(D||e).focus()}else D&&this.showSelection();e.tabIndex=D?-1:this._orgTabIndex;this.onLoadedItems()}};ListBox.prototype._getCanvasContext=function(){var e=document.createElement("canvas").getContext("2d"),t=getComputedStyle(this.hostElement);t.fontSize&&t.fontFamily&&(e.font=t.fontSize+" "+t.fontFamily.split(",")[0]);return e};ListBox.prototype._getVirtual=function(){if(this._itemCount<=this._vThreshold)return!1;var e=this.hostElement;if(e){var t=getComputedStyle(e);if(parseInt(t.columnCount)>1||t.display.indexOf("flex")>-1||t.display.indexOf("grid")>-1)return!1}return!0};ListBox.prototype._getMaxSupportedCssHeight=function(){var e=265e5;isIE()?e=15e5:isFirefox()&&(e=175e5);return e};ListBox.prototype._updateViewRange=function(){var e=this.hostElement,t=this._itemHeight,i=this._children;if(!(e&&e.parentElement&&this._isVirtual&&i))return!1;var n=e.scrollTop;assert(t*i.length<this._getMaxSupportedCssHeight(),"The number of items ("+i.length+") exceeds the maximum number of items ("+Math.floor(this._getMaxSupportedCssHeight()/t)+") allowed for this browser.");var o=Math.max(e.clientHeight,this._clientHeight),s=Math.floor(n/t),r=Math.min(i.length,Math.ceil((n+o)/t)-s),a=Math.max(0,i.length-s-r);if(s==this._itemsAbove&&a==this._itemsBelow)return!1;this._itemsAbove=s;this._itemsBelow=a;var l=document.createDocumentFragment(),h=this.containsFocus();this._ePadTop.style.height=s*t+"px";l.appendChild(this._ePadTop);if(this.showGroups&&!hasClass(i[s],ListBoxClsNames.header))for(var u=s;u>=0;u--)if(hasClass(i[u],ListBoxClsNames.header)){l.appendChild(i[u]);break}for(u=s;u<=s+r&&u<i.length;u++)l.appendChild(i[u]);this._ePadBot.style.height=a*t+"px";l.appendChild(this._ePadBot);e.textContent="";e.appendChild(l);var c=(s+r+a)*t-e.scrollHeight;this._ePadBot.style.height=this._ePadBot.offsetHeight-c+"px";var p=this._getSelectedElement(!0);if(h){(p||e).focus({preventScroll:!0})}e.tabIndex=p?-1:this._orgTabIndex;return!0};ListBox.prototype._getSelectedElement=function(e){var t=this.selectedIndex,i=this._getElementIndex(t),n=i>-1?this._children[i]:null;e&&n&&!n.offsetHeight&&(n=null);return n};ListBox.prototype._handleResize=function(){this._updateViewRange()};ListBox.prototype._createItem=function(e,t){var i=this._cv.items[e],n=e==this._cv.currentPosition,o=this.getDisplayValue(e),s=this.getDisplayValue(e,void 0!==this.itemFormatter);if(1!=this._html){o=escapeHtml(o);s=escapeHtml(s)}s=s.replace(/\bstyle\s*=/gi,"data-style=");this._itemFormatterHelper.innerHTML=s;s=this._itemFormatterHelper.textContent;this._ignoreItemFormatterTextArray.push(s);var r=null;if(this.checkedMemberPath){r=!1;isObject(i)?r=!!this._pathChecked.getValue(i):this._checkedItems&&(r=this._checkedItems.indexOf(i)>-1);o='<label class="wj-checklist-item"><span class="wj-checklist-base" role="checkbox" aria-hidden="true"><span class="wj-checklist-mark"></span></span><span class="wj-checklist-caption">'+o+"</span></label>"}var a=ListBoxClsNames.listBoxItem;n&&(a+=" "+ControlStateClsNames.selected);r&&(a+=" "+ControlStateClsNames.checked);if(this._html){var l=[UtilitesClsNames.separator,ControlStateClsNames.disabled];if(o.indexOf(l[0])>-1||o.indexOf(l[1])>-1){var h=createElement(o);l.forEach((function(e){hasClass(h,e)&&(a+=" "+e)}))}}var u="aria-describedby = listGroup-"+t;return'<div id="'+("listitem-"+e)+'" class="'+a+'" \n role="'+this.itemRole+'" \n '+(void 0!==t?u:"")+"\n "+(this._getAriaSelected(n,r)&&!this._isMenuItem()?'aria-selected="true"':"")+' \n tabindex="'+(n&&!this.isDisabled?this._orgTabIndex:-1)+'">'+o+"</div>"};ListBox.prototype._getAriaSelected=function(e,t){return!!(null!=t?t:e)||null};ListBox.prototype._createHeaderItem=function(e,t){var i=escapeHtml(e.name);return'<div id="listGroup-'+t+'" class="'+ListBoxClsNames.listBoxItem+" "+ListBoxClsNames.header+" "+ControlStateClsNames.disabled+'" role="group" tabindex="-1">'+i+"</div>"};ListBox.prototype._click=function(e){if(0==e.button&&!e.defaultPrevented){var t=this.indexOf(e.target);if(t>-1){this.selectedIndex=t;if(this.checkedMemberPath){var i=this._getCheckbox(t);if(i){var n=closest(i,".wj-listbox-item");if(e.target==i||e.target==n){n.focus({preventScroll:!0});this.setItemChecked(t,i.checked)}}else{var o=this._children[this._getElementIndex(t)];if(o){o.focus({preventScroll:!0});this.setItemChecked(t,"true"!==o.getAttribute("aria-selected"))}}}else{(n=closest(e.target,"."+ListBoxClsNames.listBoxItem)).focus({preventScroll:!0})}}}};ListBox.prototype._keydown=function(e){var t=this.selectedIndex;if(!e.defaultPrevented){if(65==e.keyCode&&(e.ctrlKey||e.metaKey)){var i=this.collectionView;if(this.checkedMemberPath&&hasItems(i)){for(var n=this._children,o=[],s=!0,r=0;r<n.length;r++)if(!hasClass(n[r],_CLS_STATE_DISABLED)){var a=i.items[r];o.push(a);s&&!this.checkedItems.includes(a)&&(s=!1)}o.length!==i.items.length?this.checkedItems=s?this.checkedItems.filter((function(e){return!o.includes(e)})):this.checkedItems.concat(o):this.checkedItems=this.checkedItems.length!=i.items.length?i.items:[];e.preventDefault();return}}if(!e.altKey&&!e.metaKey){e.shiftKey&&(this._isShiftDown=!0);switch(e.keyCode){case Key.Down:e.preventDefault();this._selectNext(e.shiftKey);break;case Key.Up:e.preventDefault();this._selectPrev(e.shiftKey);break;case Key.Home:e.preventDefault();e.ctrlKey&&e.shiftKey?this._selectRange(0):this._selectFirst();break;case Key.End:e.preventDefault();e.ctrlKey&&e.shiftKey?this._selectRange(this._children.length-1):this._selectLast();break;case Key.PageDown:e.preventDefault();this._selectNextPage();break;case Key.PageUp:e.preventDefault();this._selectPrevPage();break;case Key.Space:if(this.checkedMemberPath&&t>-1){var l=this._children[this._getElementIndex(t)];if(l&&this.isItemEnabled(t)&&!l.hasAttribute("disabled")){var h="true"===l.getAttribute("aria-selected");this.setItemChecked(t,!h);e.preventDefault()}}}}}};ListBox.prototype._getCheckboxState=function(e){var t=this._children[this._getElementIndex(e)];if(t)return"true"===t.getAttribute("aria-selected")};ListBox.prototype._setCheckboxState=function(e,t){var i=this._getElementIndex(e),n=this._children[i];if(n){if(n.querySelector(".wj-checklist-mark")){n.setAttribute("aria-selected",t.toString());toggleClass(n,ControlStateClsNames.checked,t)}else{var o=this._getCheckbox(i);if(o){o.checked=t;var s=closest(o,"."+ListBoxClsNames.listBoxItem);if(s){toggleClass(s,ControlStateClsNames.checked,t);setAttribute(s,"aria-selected",!!t||null)}}}}};ListBox.prototype._getCheckbox=function(e){var t=this._children;return this.hostElement&&e>-1&&e<t.length?t[e].querySelector("input[type=checkbox]"):null};ListBox.prototype._keypress=function(e){var t=this;if(!e.defaultPrevented&&!(e.target instanceof HTMLInputElement)&&(e.charCode>32||32==e.charCode&&this._search)){e.preventDefault();this._search+=String.fromCharCode(e.charCode);this._toSearch&&clearTimeout(this._toSearch);this._toSearch=setTimeout((function(){t._toSearch=null;t._search=""}),Control._SEARCH_DELAY);var i=this._findNext();if(i<0&&this._search.length>1){this._search=this._search[this._search.length-1];i=this._findNext()}i>-1&&(this.selectedIndex=i)}};ListBox.prototype._selectNext=function(e){void 0===e&&(e=!1);var t=this.selectedIndex,i=this._findNextEnabled(t+1);if(i>-1){e&&this._selectRange(i);this.selectedIndex=i}return i>-1};ListBox.prototype._selectPrev=function(e){void 0===e&&(e=!1);var t=this.selectedIndex,i=this._findPrevEnabled(t-1);if(i>-1){e&&this._selectRange(i);this.selectedIndex=i}return i>-1};ListBox.prototype._findNextEnabled=function(e){for(var t=e;t<this._children.length;t++)if(this.isItemEnabled(t))return t;return-1};ListBox.prototype._findPrevEnabled=function(e){for(var t=e;t>=0;t--)if(this.isItemEnabled(t))return t;return-1};ListBox.prototype._selectFirst=function(){for(var e=0;e<this._children.length;e++)if(this.isItemEnabled(e)){this.selectedIndex=e;return!0}return!1};ListBox.prototype._selectLast=function(){for(var e=this._children.length-1;e>=0;e--)if(this.isItemEnabled(e)){this.selectedIndex=e;return!0}return!1};ListBox.prototype._selectNextPage=function(){var e=this.hostElement.offsetHeight,t=this._children,i=this._cv?this._cv.items.length:0,n=0;if(e>0)for(var o=this.selectedIndex+1;o<i;o++){var s=t[o].scrollHeight||this._itemHeight;if(n+s>e&&this.isItemEnabled(o)){this.selectedIndex=o;return!0}n+=s}return this._selectLast()};ListBox.prototype._selectPrevPage=function(){var e=this.hostElement.offsetHeight,t=this._children,i=0;if(e>0)for(var n=this.selectedIndex-1;n>0;n--){var o=t[n].scrollHeight||this._itemHeight;if(i+o>e&&this.isItemEnabled(n)){this.selectedIndex=n;return!0}i+=o}return this._selectFirst()};ListBox.prototype._findNext=function(){if(this.hostElement){var e=this._children.length,t=this.selectedIndex;(t<0||1==this._search.length)&&t++;var i=this._search,n=this.caseSensitiveSearch;n||(i=i.toLowerCase());for(var o=0;o<e;o++){var s=(t+o)%e;if(this.isItemEnabled(s)){var r=this.getDisplayText(s).trim();n||(r=r.toLowerCase());if(0==r.indexOf(i))return s}}}return-1};ListBox.prototype._initFromSelect=function(e){for(var t=e.children,i=[],n=-1,o=0;o<t.length;o++){var s=t[o];if("OPTION"==s.tagName){s.hasAttribute("selected")&&(n=i.length);s.innerHTML?i.push({hdr:s.innerHTML,val:s.getAttribute("value"),cmdParam:s.getAttribute("cmd-param")}):i.push({hdr:'<div class="'+UtilitesClsNames.separator+'"></div>'});e.removeChild(s);o--}}if(i){this.displayMemberPath="hdr";this.selectedValuePath="val";this.itemsSource=i;this.selectedIndex=n}};ListBox.prototype._setIsDisabled=function(t){e.prototype._setIsDisabled.call(this,t);this._updateTabIndex()};ListBox.prototype._setTabOrder=function(t){e.prototype._setTabOrder.call(this,t);this.isDisabled||this._updateTabIndex()};ListBox.prototype._isMenuItem=function(){return"menuitem"===this.itemRole||"menuitemcheckbox"===this.itemRole||"menuitemradio"===this.itemRole};ListBox.prototype._updateTabIndex=function(){var e=this.hostElement,t=this._getSelectedElement(!0);if(t){t.tabIndex=this.isDisabled?-1:this._orgTabIndex;e.tabIndex=-1}else e.tabIndex=this.isDisabled?-1:this._orgTabIndex};ListBox.prototype._selectRange=function(e){if(-1!==this.selectedIndex){if(this._shouldClearOnShift&&this._isShiftDown){this.checkedItems=[];this._shouldClearOnShift=!1}var t=Math.min(this.selectedIndex,e),i=Math.max(this.selectedIndex,e),n=this.collectionView.items.slice(t,i+1);this.checkedItems=Array.from(new Set(this.checkedItems.concat(n)))}};ListBox.prototype.dispose=function(){if(this._cv){this._cv.collectionChanged.removeHandler(this._cvCollectionChanged,this);this._cv.currentChanged.removeHandler(this._cvCurrentChanged,this);this._cv=null}this._items=null;if(this._toSearch){clearTimeout(this._toSearch);this._toSearch=null}this._children=null;this._eSizer=null;this._ePadTop=null;this._ePadBot=null;this._itemFormatterHelper=null;this._ignoreItemFormatterTextArray=null;this._checkedItems=null;e.prototype.dispose.call(this)};ListBox._DIDX_KEY="$WJ-DIDX";ListBox._VTHRESH=Number.MAX_VALUE/2;return ListBox}(Control);export{ListBox};var FormatItemEventArgs=function(e){__extends(FormatItemEventArgs,e);function FormatItemEventArgs(t,i,n){var o=e.call(this)||this;o._index=asNumber(t);o._data=i;o._item=asType(n,HTMLElement,!0);return o}Object.defineProperty(FormatItemEventArgs.prototype,"index",{get:function(){return this._index},enumerable:!0,configurable:!0});Object.defineProperty(FormatItemEventArgs.prototype,"data",{get:function(){return this._data},enumerable:!0,configurable:!0});Object.defineProperty(FormatItemEventArgs.prototype,"item",{get:function(){return this._item},enumerable:!0,configurable:!0});return FormatItemEventArgs}(EventArgs);export{FormatItemEventArgs};_addCultureInfo("MultiSelectListBox",{filterPlaceholder:"Filter",selectAll:"Select All",ariaLabels:{multiSelectListBox:"Multi select list box"}});var MultiSelectListBox=function(e){__extends(MultiSelectListBox,e);function MultiSelectListBox(t,i){var n=e.call(this,t)||this;n._ariaLabel=culture.MultiSelectListBox.ariaLabels.multiSelectListBox;n._selectAllLabel=null;n._filterPlaceholder=null;n._filterText="";n._checkOnFilter=!0;n._delay=Control._SEARCH_DELAY;n.checkedItemsChanged=new Event;n.selectedIndexChanged=new Event;var o=n.getTemplate();n.applyTemplate(ControlClsNames.hostElement+" "+ControlClsNames.content+" "+MultiSelectListBoxClsNames.hostElement,o,{_selectAll:"select-all",_filter:"filter",_lbHost:"list-box"});n._selectAll.style.display="none";n._filter.style.display="none";n._lbx=new ListBox(n._lbHost,{checkedMemberPath:MultiSelectListBox._DEF_CHECKED_PATH,loadedItems:function(){return n._updateCheckAllCheckbox()},checkedItemsChanged:function(e){return n.onCheckedItemsChanged(e)},selectedIndexChanged:function(){return n.onSelectedIndexChanged()}});n._cbSelectAll=n._selectAll.querySelector("input[type=checkbox]");n._spSelectAll=n._selectAll.querySelector("label>span");var s=culture.MultiSelectListBox;setText(n._spSelectAll,s.selectAll);n._filter.placeholder=s.filterPlaceholder;n.initialize(i);n.addEventListener(n._filter,"input",(function(){if(n._filter.value!=n._filterText){n._filterText=n._filter.value;n._toSearch&&clearTimeout(n._toSearch);n._toSearch=setTimeout((function(){n._toSearch=null;n._applyFilter()}),n.delay)}}));n.addEventListener(n._cbSelectAll,"click",(function(e){var t=n._lbx.collectionView;hasItems(t)&&(n.checkedItems=e.target.checked?t.items:[])}));n.addEventListener(n.hostElement,"keydown",(function(e){var t=n.showFilterInput?n._filter:null,i=n._lbx;if(t&&e.keyCode==Key.F3){setSelectionRange(t,0,t.value.length);e.preventDefault()}if(getActiveElement()==t){var o=!e.altKey;switch(e.keyCode){case Key.Escape:case Key.F4:case Key.Tab:o=!1}o&&e.stopPropagation()}if(!i.containsFocus())switch(e.keyCode){case Key.Up:case Key.Down:n._lbx.focus();if(!e.altKey){var s=i.selectedIndex+(e.keyCode==Key.Up?-1:1);i.selectedIndex=Math.max(0,s)}e.preventDefault()}}),!0);n.hostElement.tabIndex=-1;n._lbx.tabOrder=n._orgTabIndex;n._updateAriaLabel();return n}Object.defineProperty(MultiSelectListBox,"controlTemplate",{get:function(){MultiSelectListBox._ctrlTemplate||(MultiSelectListBox._ctrlTemplate='<div class="'+ControlClsNames.template+" "+ListBoxClsNames.hostElement+'"><input wj-part="filter" class="'+InputFormElementsClsNames.formControl+'" tabindex="-1"><div wj-part="select-all" class="'+MultiSelectListBoxClsNames.header+" "+MultiSelectListBoxClsNames.selectAll+" "+ListBoxClsNames.listBoxItem+'"><label><input type="checkbox" tabindex="-1"> <span></span></label></div><div wj-part="list-box"/></div>');return MultiSelectListBox._ctrlTemplate},set:function(e){MultiSelectListBox._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"itemsSource",{get:function(){return this._lbx.itemsSource},set:function(e){this._lbx.itemsSource=e},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"collectionView",{get:function(){return this._lbx.collectionView},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"virtualizationThreshold",{get:function(){return this._lbx.virtualizationThreshold},set:function(e){this._lbx.virtualizationThreshold=e},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"displayMemberPath",{get:function(){return this._lbx.displayMemberPath},set:function(e){this._lbx.displayMemberPath=e},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"isContentHtml",{get:function(){return this._lbx.isContentHtml},set:function(e){this._lbx.isContentHtml=e},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"caseSensitiveSearch",{get:function(){return this._lbx.caseSensitiveSearch},set:function(e){this._lbx.caseSensitiveSearch=e},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"delay",{get:function(){return this._delay},set:function(e){this._delay=asNumber(e,!1,!0)},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"showGroups",{get:function(){return this._lbx.showGroups},set:function(e){this._lbx.showGroups=e},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"checkOnFilter",{get:function(){return this._checkOnFilter},set:function(e){if(e!=this.checkOnFilter){this._checkOnFilter=asBoolean(e);this.checkedItems=[]}},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"selectedIndex",{get:function(){return this._lbx.selectedIndex},set:function(e){this._lbx.selectedIndex=e},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"listBox",{get:function(){return this._lbx},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"showFilterInput",{get:function(){return""==this._filter.style.display},set:function(e){if(e!=this.showFilterInput){this._filter.style.display=asBoolean(e)?"":"none";if(!this.showFilterInput){this._filter.value="";this._applyFilter()}}},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"filterInputPlaceholder",{get:function(){return this._filterPlaceholder},set:function(e){if(e!=this._filterPlaceholder){this._filterPlaceholder=asString(e);this.refresh()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"showSelectAllCheckbox",{get:function(){return""==this._selectAll.style.display},set:function(e){this._selectAll.style.display=asBoolean(e)?"":"none"},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"selectAllLabel",{get:function(){return this._selectAllLabel},set:function(e){if(e!=this._selectAllLabel){this._selectAllLabel=asString(e);this.refresh()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"checkedMemberPath",{get:function(){var e=this.listBox.checkedMemberPath;return e!=MultiSelectListBox._DEF_CHECKED_PATH?e:null},set:function(e){e=asString(e);this.listBox.checkedMemberPath=e||MultiSelectListBox._DEF_CHECKED_PATH},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"checkedItems",{get:function(){return this.listBox.checkedItems},set:function(e){this.listBox.checkedItems=asArray(e)},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"ariaLabelledBy",{get:function(){return this.hostElement.getAttribute("aria-labelledby")},set:function(e){_setAriaLabelBy(this,this.hostElement,e,this._updateAriaLabel.bind(this))},enumerable:!0,configurable:!0});MultiSelectListBox.prototype._updateAriaLabel=function(){var e=culture.MultiSelectListBox;setAriaLabel(this._selectAll,e.selectAll);setAriaLabel(this._filter,e.filterPlaceholder);this.hostElement&&(this.ariaLabelledBy?setAriaLabel(this.hostElement,null):setAriaLabel(this.hostElement,this._ariaLabel))};MultiSelectListBox.prototype.onCheckedItemsChanged=function(e){var t=this;this._updateCheckAllCheckbox();this.checkedItemsChanged.raise(this,e);e._items&&"object"==typeof e._items[0]&&(this.checkedMemberPath||MultiSelectListBox._DEF_CHECKED_PATH)in e._items[0]&&setTimeout((function(){t._lbx._updateCheckedList(t.checkedItems)}),0)};MultiSelectListBox.prototype.onSelectedIndexChanged=function(e){this.selectedIndexChanged.raise(this,e)};MultiSelectListBox.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);if(this.hostElement){var i=culture.MultiSelectListBox;this._filter.placeholder=null!=this._filterPlaceholder?this._filterPlaceholder:i.filterPlaceholder;this._spSelectAll&&setText(this._spSelectAll,null!=this._selectAllLabel?this._selectAllLabel:i.selectAll);this._updateCheckAllCheckbox()}};MultiSelectListBox.prototype.dispose=function(){this.listBox.dispose();e.prototype.dispose.call(this)};MultiSelectListBox.prototype._applyFilter=function(){var e=this,t=this._lbx,i=t.collectionView,n=this._filter.value,o=n?new RegExp(escapeRegExp(n),t.caseSensitiveSearch?"":"i"):null,s=this.displayMemberPath,r=s?new Binding(s):null,a=this.checkOnFilter?null:this.checkedItems;i.filter=function(t){if(null!=o){if(a&&a.indexOf(t)>-1)return!0;r&&(t=r.getValue(t));e.isContentHtml&&(t=toPlainText(t));return null!=t&&o.test(t.toString())}return!0};t.selectedIndex=Math.max(0,t.selectedIndex);this._checkOnFilter&&(this.checkedItems=o?i.items:[])};MultiSelectListBox.prototype._updateCheckAllCheckbox=function(){var e=this._lbx.collectionView,t=this._cbSelectAll;if(hasItems(e)){var i=e.items.length,n=this.checkedItems.length;setChecked(t,n==i||0!=n&&null);t.disabled=!1}else{setChecked(t,!1);t.checked=!1;t.disabled=!0}};MultiSelectListBox.prototype._setIsDisabled=function(t){e.prototype._setIsDisabled.call(this,t);this.hostElement.tabIndex=-1;this.isDisabled?this._lbx.tabOrder=-1:this._lbx.tabOrder=this._orgTabIndex};MultiSelectListBox.prototype._setTabOrder=function(e){this._orgTabIndex=e;this._lbx.tabOrder=e};MultiSelectListBox.prototype.tryForceClearDelayAndFilter=function(){var e=this;if(this._toSearch){var t=this._delay;this._filterText=this._filter.value;this._toSearch&&clearTimeout(this._toSearch);this._toSearch=setTimeout((function(){e._toSearch=null;e._applyFilter()}),0);this._delay=t}};MultiSelectListBox.prototype.onLostFocus=function(){this.tryForceClearDelayAndFilter();e.prototype.onLostFocus.call(this)};MultiSelectListBox._DEF_CHECKED_PATH="$checked";MultiSelectListBox._ctrlTemplate="";return MultiSelectListBox}(Control);export{MultiSelectListBox};_addCultureInfo("Calendar",{ariaLabels:{calendar:"Calendar",chooseDate:"Choose Date",chooseMonth:"Choose Month",monthView:"Month View",yearView:"Year View",selectYear:"Select Year",prvMo:"Previous Month",today:"Select Today",nxtMo:"Next Month",prvYr:"Previous Year",currMo:"Current Month",nxtYr:"Next Year"},buttons:{ok:"OK",cancel:"Cancel"}});export var DateSelectionMode;!function(e){e[e.None=0]="None";e[e.Day=1]="Day";e[e.Month=2]="Month";e[e.Range=3]="Range"}(DateSelectionMode||(DateSelectionMode={}));export var ShowMonthPicker;!function(e){e[e.None=0]="None";e[e.FirstMonth=1]="FirstMonth";e[e.LastMonth=2]="LastMonth";e[e.FirstAndLastMonths=3]="FirstAndLastMonths";e[e.AllMonths=4]="AllMonths";e[e.Outside=5]="Outside"}(ShowMonthPicker||(ShowMonthPicker={}));export var CalendarTabKeyAction;!function(e){e[e.None=0]="None";e[e.All=1]="All"}(CalendarTabKeyAction||(CalendarTabKeyAction={}));var Calendar=function(e){__extends(Calendar,e);function Calendar(t,i){var n=e.call(this,t)||this;n._yrPicker=!0;n._mtPicker=ShowMonthPicker.FirstMonth;n._wksBefore=0;n._wksAfter=0;n._rngMin=0;n._rngMax=0;n._min=null;n._max=null;n._readOnly=!1;n._handleWheel=!0;n._fdw=null;n._selMode=DateSelectionMode.Day;n._ariaLabel=culture.Calendar.ariaLabels.calendar;n._tmYrHidden=0;n._fmtYrMo="y";n._fmtYr="yyyy";n._fmtDayHdr="ddd";n._fmtDay="d ";n._fmtMonths="MMM";n._fmtDayTitle="dddd";n.valueChanged=new Event;n.rangeEndChanged=new Event;n.rangeChanged=new Event;n.displayMonthChanged=new Event;n.formatItem=new Event((function(){n.invalidate()}));n._updateCellFocus=function(e,t){toggleClass(e,CalendarClsNames.focused,t);setAttribute(e,"tabIndex",t?"0":"-1");t&&n.containsFocus()&&!n._isButtonFocused()&&e.focus()};n.cancelButtonClicked=new Event;n.OKButtonClicked=new Event;n._enterKeyDownToSetValue=new Event;n._value=n._rngEnd=DateTime.newDate();n._month=n._getMonth(n._value);n._cals=[n];n._createChildren();n._createYearPicker();var o=n.hostElement,s=n.addEventListener.bind(n);s(o,"keydown",n._keydown.bind(n));s(o,"click",n._click.bind(n));n._focusValue=DateTime.newDate();setAttribute(o,"role","application");setAttribute(n.hostElement,"aria-label",n._ariaLabel);n._keyActionTab=CalendarTabKeyAction.None;n._rptUp=new _ClickRepeater(n._btnPrv);n._rptDn=new _ClickRepeater(n._btnNxt);n.addEventListener(o,"wheel",(function(e){if(n.handleWheel&&!e.defaultPrevented&&!n.isReadOnly&&n.containsFocus()){e.deltaY<0?n._btnPrv.click():n._btnNxt.click();e.preventDefault()}}));n.initialize(i);n.refresh(!0);return n}Object.defineProperty(Calendar,"controlTemplate",{get:function(){Calendar._ctrlTemplate||(Calendar._ctrlTemplate='<div class="'+ControlClsNames.content+" "+CalendarClsNames.calendarOuter+'"><div wj-part="tbl-header" class='+CalendarClsNames.calendarHeader+'><div wj-part="btn-month" class='+CalendarClsNames.monthSelect+' role="button" aria-live="polite"><span wj-part="span-month"></span> <span class='+GlyphClsNames.down+'></span></div><div class="'+InputFormElementsClsNames.btnGroup+'"><button wj-part="btn-prev" class="'+InputFormElementsClsNames.btn+" "+InputFormElementsClsNames.btnDefault+'" tabindex="-1"><span class='+GlyphClsNames.left+'></span></button><button wj-part="btn-today" class="'+InputFormElementsClsNames.btn+" "+InputFormElementsClsNames.btnDefault+'" tabindex="-1"><span class='+GlyphClsNames.circle+'></span></button><button wj-part="btn-next" class="'+InputFormElementsClsNames.btn+" "+InputFormElementsClsNames.btnDefault+'" tabindex="-1"><span class='+GlyphClsNames.right+'></span></button></div></div><table wj-part="tbl-month" class='+CalendarClsNames.calendarMonth+' role="grid"></table><table wj-part="tbl-year" class='+CalendarClsNames.calendarYear+' role="grid"></table>');return Calendar._ctrlTemplate},set:function(e){Calendar._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"value",{get:function(){return this._value},set:function(e){if((!DateTime.sameDate(e,this._value)||!DateTime.sameTime(e,this._value))&&(!(this.showConfirmationButtons&&DateTime.sameDate(e,this.rangeEnd)&&DateTime.sameTime(e,this.rangeEnd))||this._isSpaceDownForSetValue)){this._clearingRangeEnd=!DateTime.equals(this._value,e);this.rangeEnd=null;this._clearingRangeEnd=!1;e=asDate(e,!0);e=this._clamp(e);if(this._valid(e)||null==e){this.ensureVisible(e||new Date);if(!DateTime.equals(this._value,e)){this._value=e;this.focusMode&&(this._focusValue=e);this.invalidate(!1);this.onValueChanged()}}if(!this.value){var t=this.min,i=this.max,n=this.displayMonth;i&&i<n?this.ensureVisible(i):t&&t>n&&this.ensureVisible(t)}}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"focusValue",{get:function(){return this._focusValue},set:function(e){e=asDate(e,!0);e=this._clamp(e);if(this._valid(e)||null==e){this.ensureVisible(e||new Date);this._focusValue=e;this._getCalendars().forEach((function(t){t._focusValue=e}));this.invalidate(!1)}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"rangeEnd",{get:function(){return this._rngEnd},set:function(e){e=asDate(e,!0);if((e=this._clamp(e))&&this._value&&this._rngMode()){e<this._value&&(e=this._value);var t=this._rngMin,i=this._rngMax;if(t&&t>0||i&&i>0){var n=this._value,o=Math.ceil((e.getTime()-n.getTime())/864e5)+1;t&&t>0&&o<t&&(e=DateTime.addDays(n,t-1));i&&i>0&&o>i&&(e=DateTime.addDays(n,i-1))}}if((this._valid(e)||null==e)&&!DateTime.equals(this._rngEnd,e)){this._rngEnd=e;this.ensureVisible(e);this.invalidate(!1);this._clearingRangeEnd||this.onRangeEndChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"rangeMin",{get:function(){return this._rngMin},set:function(e){if((e=asNumber(e,!0,!0))!=this._rngMin){this._rngMin=e;this._syncProp(this,"rangeMin");this._rngMode()&&this._rngEnd&&(this.rangeEnd=this._rngEnd)}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"rangeMax",{get:function(){return this._rngMax},set:function(e){if((e=asNumber(e,!0,!0))!=this._rngMax){this._rngMax=e;this._syncProp(this,"rangeMax");this._rngMode()&&this._rngEnd&&(this.rangeEnd=this._rngEnd)}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"min",{get:function(){return this._min},set:function(e){if((e=asDate(e,!0))!=this.min){this._min=e;this._syncProp(this,"min");this.refresh();!this.value&&e&&e>this.displayMonth&&this.ensureVisible(e)}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"max",{get:function(){return this._max},set:function(e){if((e=asDate(e,!0))!=this.max){this._max=e;this._syncProp(this,"max");this.refresh();!this.value&&e&&e<this.displayMonth&&this.ensureVisible(e)}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"selectionMode",{get:function(){return this._selMode},set:function(e){var t=DateSelectionMode;if((e=asEnum(e,t))!=this._selMode){this._selMode=e;this._mthMode()&&(this.monthView=!1);e!=t.Range||this._rngEnd||(this._rngEnd=this._value);this.refresh();this._syncProp(this,"selectionMode")}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"isReadOnly",{get:function(){return this._readOnly},set:function(e){this._readOnly=asBoolean(e);toggleClass(this.hostElement,ControlStateClsNames.readOnly,this.isReadOnly);this._syncProp(this,"isReadOnly")},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"handleWheel",{get:function(){return this._handleWheel},set:function(e){if(this._handleWheel!=e){this._handleWheel=asBoolean(e);this._syncProp(this,"handleWheel")}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"repeatButtons",{get:function(){return!this._rptUp.disabled},set:function(e){this._rptUp.disabled=this._rptDn.disabled=!asBoolean(e);this._syncProp(this,"repeatButtons")},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"showYearPicker",{get:function(){return this._yrPicker},set:function(e){if(e!=this._yrPicker){this._yrPicker=asBoolean(e);this._syncProp(this,"showYearPicker")}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"showMonthPicker",{get:function(){return this._mtPicker},set:function(e){if(e!=this._mtPicker){var t=ShowMonthPicker;isBoolean(e)&&(e=e?t.FirstMonth:t.None);this._mtPicker=asEnum(e,t);toggleClass(this.hostElement,InputFormElementsClsNames.btnsOutside,this._getShowMonthPicker()==t.Outside);this.refresh();this._syncProp(this,"showMonthPicker")}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"firstDayOfWeek",{get:function(){return this._fdw},set:function(e){if(e!=this._fdw){if((e=asNumber(e,!0))&&(e>6||e<0))throw"firstDayOfWeek must be between 0 and 6 (Sunday to Saturday).";this._fdw=e;this.refresh();this._syncProp(this,"firstDayOfWeek")}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"displayMonth",{get:function(){return this._month},set:function(e){e=asDate(e);e=this._getMonth(e);var t=this._getDisplayMonthRange();t.to&&e>t.to&&(e=t.to);t.from&&e<t.from&&(e=t.from);if(!DateTime.equals(this.displayMonth,e)){this._month=e;this.invalidate(!0);this.onDisplayMonthChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"monthCount",{get:function(){var e=this.hostElement;return e?e.querySelectorAll("."+CalendarClsNames.hostElement).length+1:0},set:function(e){var t=this,i=this.hostElement;if(e!=this.monthCount&&i){var n=i.querySelectorAll("."+CalendarClsNames.hostElement);e=asInt(e,!1);assert(e>0,"monthCount must be >= 1.");assert(1==e||!closest(i.parentElement,"."+CalendarClsNames.hostElement),"Only top-level calendars can set monthCount.");for(var o=0;o<n.length;o++){var s=n[o];removeChild(s);this._getCalendar(s).dispose()}this._cals=[this];for(o=1;o<e;o++){(s=new Calendar(document.createElement("div"),{itemFormatter:this.itemFormatter,itemValidator:this.itemValidator,formatItem:function(e,i){return t.onFormatItem(i)}}))._selMode=this._selMode;s._value=this._value;s._rngEnd=this._rngEnd;for(var r in this)if(!/^(_.*|constructor|displayMonth|monthCount|hostElement|rightToLeft|isUpdating|isTouching|keyActionTab)$/.test(r)){var a=this[r];isFunction(a)||a instanceof Event||(s[r]=a)}this._cals.push(s);i.appendChild(s.hostElement)}this.updateCalendarsTabindex();toggleClass(i,CalendarClsNames.calendarMultiMonth,e>1);this._syncProp(this,"displayMonth")}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"formatYearMonth",{get:function(){return this._fmtYrMo},set:function(e){if(e!=this._fmtYrMo){this._fmtYrMo=asString(e);this._syncProp(this,"formatYearMonth");this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"formatDayHeaders",{get:function(){return this._fmtDayHdr},set:function(e){if(e!=this._fmtDayHdr){this._fmtDayHdr=asString(e);this._syncProp(this,"formatDayHeaders");this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"formatDays",{get:function(){return this._fmtDay},set:function(e){if(e!=this._fmtDay){this._fmtDay=asString(e);this._syncProp(this,"formatDays");this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"formatYear",{get:function(){return this._fmtYr},set:function(e){if(e!=this._fmtYr){this._fmtYr=asString(e);this._syncProp(this,"formatYear");this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"formatMonths",{get:function(){return this._fmtMonths},set:function(e){if(e!=this._fmtMonths){this._fmtMonths=asString(e);this._syncProp(this,"formatMonths");this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"showHeader",{get:function(){return"none"!=this._tbHdr.style.display},set:function(e){if(e!=this.showHeader){this._tbHdr.style.display=asBoolean(e)?"":"none";this._syncProp(this,"showHeader")}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"monthView",{get:function(){return"none"!=this._tbMth.style.display},set:function(e){if(e!=this.monthView){this._tbMth.style.display=e?"":"none";this._tbYr.style.display=e?"none":"";if(!e&&this.isThisMainCalendar()){var t=this.focusValue.getDate(),i=DateTime.clone(this.displayMonth);i.setDate(t);this.focusValue=i}this.refresh();var n=culture.Calendar.ariaLabels;setAriaLabel(this._btnPrv,e?n.prvMo:n.prvYr);setAriaLabel(this._btnTdy,e?n.today:n.currMo);setAriaLabel(this._btnNxt,e?n.nxtMo:n.nxtYr);setAriaLabel(this._btnMth,e?n.monthView:n.yearView);this._updateMonthButtonAria();this._syncProp(this,"monthView")}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"weeksBefore",{get:function(){return this._wksBefore},set:function(e){if(e!=this._wksBefore){this._wksBefore=Math.floor(asNumber(e,!1,!0));this._syncProp(this,"weeksBefore");this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"weeksAfter",{get:function(){return this._wksAfter},set:function(e){if(e!=this._wksAfter){this._wksAfter=Math.floor(asNumber(e,!1,!0));this._syncProp(this,"weeksAfter");this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"itemFormatter",{get:function(){return this._itemFormatter},set:function(e){if(e!=this._itemFormatter){this._itemFormatter=asFunction(e);this._syncProp(this,"itemFormatter");this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"itemValidator",{get:function(){return this._itemValidator},set:function(e){if(e!=this._itemValidator){this._itemValidator=asFunction(e);this._syncProp(this,"itemValidator");this.invalidate()}},enumerable:!0,configurable:!0});Calendar.prototype.hitTest=function(e){var t=e instanceof MouseEvent?e.target:e instanceof Element?e:null;assert(null!=t,"MouseEvent or Element expected");return t?t[Calendar._DATE_KEY]:null};Calendar.prototype.ensureVisible=function(e){if(null!=e){var t=this._getCalendars(),i=t.indexOf(this),n=t[0],o=t[t.length-1];e<n.displayMonth||!this.monthView&&this.focusMode?this.displayMonth=DateTime.addMonths(this._getMonth(e),i):e>o.displayMonth&&(this.displayMonth=DateTime.addMonths(this._getMonth(e),i-t.length+1))}};Calendar.prototype.onValueChanged=function(e){this.valueChanged.raise(this,e);this._syncProp(this,"value")};Calendar.prototype.onRangeEndChanged=function(e){this.rangeEndChanged.raise(this,e);this._syncProp(this,"rangeEnd");this._value&&this._rngEnd&&this.onRangeChanged(e)};Calendar.prototype.onRangeChanged=function(e){this.rangeChanged.raise(this,e)};Calendar.prototype.onDisplayMonthChanged=function(e){this.displayMonthChanged.raise(this,e);this._syncProp(this,"displayMonth")};Calendar.prototype.onFormatItem=function(e){this.formatItem.raise(this,e)};Calendar.prototype._containsFocusImpl=function(t){return e.prototype._containsFocusImpl.call(this,t)||this._lbYears._containsFocusImpl(t)};Calendar.prototype.dispose=function(){this._rptUp.element=null;this._rptDn.element=null;this._lbYears.dispose();e.prototype.dispose.call(this)};Calendar.prototype.refresh=function(t){void 0===t&&(t=!0);var i=this.hostElement,n=this.containsFocus();if(i){e.prototype.refresh.call(this,t);t&&this._updateContent();this._updateSelection();var o=this._getDisplayMonthRange(),s=this.displayMonth,r=null==o.from||s>o.from,a=null==o.to||s<o.to;enable(this._btnPrv,r);enable(this._btnNxt,a);r&&a||this.containsFocus()||this.focus();var l=!0,h=DateTime.newDate(),u=this._min&&this._min>h,c=this._max&&this._max<h;(u||c)&&(l=!1);enable(this._btnTdy,l);if(n&&!this._isButtonFocused()){var p=(this.monthView?this._tbMth:this._tbYr).querySelector("td."+ControlStateClsNames.selected)||i;p&&!this.focusMode&&p.focus()}var d=this._getCalendars();d.length>1&&this.isThisMainCalendar()&&d.forEach((function(e,i){i>0&&e.refresh(t)}))}};Calendar.prototype._getShowMonthPicker=function(){var e=ShowMonthPicker,t=this._getCalendars(),i=t.indexOf(this),n=this.showMonthPicker;switch(n){case e.FirstMonth:case e.Outside:return 0==i?n:0;case e.LastMonth:return i==t.length-1?n:0;case e.FirstAndLastMonths:return 0==i||i==t.length-1?n:0;case e.AllMonths:return n}return 0};Calendar.prototype._getDisplayMonthRange=function(){var e={from:null,to:null};if(this.min||this.max){var t=this._getCalendars(),i=t.indexOf(this),n=this._mthMode()?DateTime.addYears:DateTime.addMonths;this.min&&(e.from=n(this._getMonth(this.min),i));this.max&&(e.to=n(this._getMonth(this.max),i-t.length+1))}return e};Calendar.prototype._getCalendar=function(e){return Control.getControl(e)};Calendar.prototype._getCalendars=function(){var e=closest(this.hostElement,"."+CalendarClsNames.calendarMultiMonth);return(e?this._getCalendar(e):this)._cals};Calendar.prototype._syncProp=function(e,t){var i=this;if(!this._syncing){var n=this._getCalendars();if(n&&n.length>1){var o=e[t],s=this._mthMode()?DateTime.addYears:DateTime.addMonths;"displayMonth"==t&&(o=s(o,-n.indexOf(e)));n[0].deferUpdate((function(){i._syncing=!0;n.forEach((function(n,r){if(n!=e){var a=n.displayMonth;n[t]="displayMonth"==t?s(o,r):o;if("value"==t){n.displayMonth=a;i._rngMode()&&(n.rangeEnd=null)}}}));i._syncing=!1}))}}};Calendar.prototype._updateContent=function(){var e=this.displayMonth,t=Globalize.format,i=DateTime,n=this._getShowMonthPicker();setText(this._spMth,t(e,this._fmtYrMo));var o=this._btnMth.querySelector("."+GlyphClsNames.down);o&&(o.style.display=this._mthMode()||!n?"none":"");var s=closest(this._btnTdy,"."+InputFormElementsClsNames.btnGroup);s&&(s.style.display=n?"":"none");var r=null!=this._fdw?this._fdw:Globalize.getFirstDayOfWeek(),a=i.addDays(e,-(e.getDay()-r+7)%7),l=i.monthLast(e),h=this._tbMth.querySelectorAll("th");this._updateMonthButtonAria();for(var u=0;u<7&&u<h.length;u++){var c=i.addDays(a,u);setText(h[u],t(c,this._fmtDayHdr));setAttribute(h[u],"tabIndex","-1");setAttribute(h[u],"abbr",t(c,this._fmtDayTitle))}var p=!1;this._dateViewContainsFocus()&&(p=!0);var d=this._tbMth.querySelectorAll("tr");for(u=1;u<d.length;u++)removeChild(d[u]);p&&this.focus();var m=i.addDays(a,-7*this._wksBefore);for(u=0;u<this._wksBefore;u++)m=this._addWeek(m,CalendarClsNames.weekBefore);for(;m<=l;)m=this._addWeek(m);for(u=0;u<this._wksAfter;u++)m=this._addWeek(m,CalendarClsNames.weekAfter);h=this._tbYr.querySelectorAll("td");var _=this._tbYr.querySelectorAll("th");_.length&&setText(_[0],t(e,this._fmtYr));for(u=0;u<h.length;u++){m=i.newDate(e.getFullYear(),u,1);var f=h[u],b=!this._monthInValidRange(m);f[Calendar._DATE_KEY]=m;var g=Globalize.format(m,"MMMM yyyy");setText(f,t(m,this._fmtMonths));toggleClass(f,ControlStateClsNames.disabled,b);setAriaLabel(f,g);setAttribute(f,"tabIndex","-1");setAttribute(f,"abbr",g)}this._confirmationButtonContainer&&(this._confirmationButtonContainer.style.display=this.showConfirmationButtons?"":"none");this._updateButtonTabIndex()};Calendar.prototype._updateSelection=function(){for(var e=Calendar._DATE_KEY,t=DateTime,i=this._tbMth.querySelectorAll("td"),n=0;n<i.length;n++){var o=this.rangeEnd;this._rngMode()||(o=null);var s=(u=i[n])[e],r=this.value,a=this._selMode&&null!=r&&t.sameDate(s,r),l=this._selMode&&null!=r&&t.sameDate(s,o),h=this._selMode&&null!=r&&s>r&&null!=o&&s<=o;toggleClass(u,ControlStateClsNames.selected,a);toggleClass(u,ControlStateClsNames.multiSelected,h);toggleClass(u,ControlStateClsNames.lastSelected,l);setAttribute(u,"aria-selected",!!a||null);this._customizeCell(n,s,u)}i=this._tbYr.querySelectorAll("td");for(n=0;n<i.length;n++){var u;s=(u=i[n])[e],a=this._sameMonth(s,this.value);toggleClass(u,ControlStateClsNames.selected,a);setAttribute(u,"aria-selected",!!a||null)}this.focusMode&&!0!==this.isDisabled&&-1!==this.tabOrder&&this._updateFocusInAccessibilityMode()};Calendar.prototype._updateFocusInAccessibilityMode=function(){for(var e=Calendar._DATE_KEY,t=DateTime,i=this._getCalendars(),n=0;n<i.length;n++)for(var o=i[n]._tbMth.querySelectorAll("td"),s=0;s<o.length;s++){var r=(h=o[s])[e],a=this._selMode&&null!=this.focusValue&&t.sameDate(r,this.focusValue)&&!hasClass(h,CalendarClsNames.dayOtherMonth);this._updateCellFocus(h,a)}var l=i[0]._tbYr.querySelectorAll("td");for(s=0;s<l.length;s++){var h;r=(h=l[s])[e],a=null!=this.focusValue&&this._sameMonth(r,this.focusValue);this._updateCellFocus(h,a)}};Calendar.prototype._addWeek=function(e,t){for(var i=this._createElement("tr",this._tbMth,t),n=DateTime,o=0;o<7;o++){var s=this._createElement("td",i),r=n.addDays(e,o);s[Calendar._DATE_KEY]=r;setText(s,Globalize.format(r,this._fmtDay));setAriaLabel(s,Globalize.format(r,"D"));var a=!this._valid(r),l=r.getDay(),h=r.getMonth()!=this.displayMonth.getMonth();toggleClass(s,CalendarClsNames.dayToday,n.sameDate(r,n.newDate()));toggleClass(s,CalendarClsNames.dayWeekend,0==l||6==l);toggleClass(s,CalendarClsNames.dayOtherMonth,h);toggleClass(s,ControlStateClsNames.invalid,a||!this._inValidRange(r));setAttribute(s,"aria-disabled",a||!this._inValidRange(r))}return n.addDays(e,7)};Calendar.prototype._customizeCell=function(e,t,i){isFunction(this.itemFormatter)&&this.itemFormatter(t,i);if(this.formatItem.hasHandlers){var n=new FormatItemEventArgs(e,t,i);this.onFormatItem(n)}};Calendar.prototype._canChangeValue=function(){return!this._readOnly&&this._selMode!=DateSelectionMode.None};Calendar.prototype._valid=function(e){return!(!isDate(e)||!DateTime.sameDate(e,this._clamp(e)))&&(!isFunction(this.itemValidator)||this.itemValidator(e))};Calendar.prototype._inValidRange=function(e){var t=DateTime.fromDateTime;return!(this.min&&e<t(this.min,e))&&!(this.max&&e>t(this.max,e))};Calendar.prototype._monthInValidRange=function(e){if(this.min||this.max){var t=e.getFullYear(),i=e.getMonth(),n=DateTime,o=n.newDate(t,i,1),s=n.newDate(t,i+1,0);if(this.min&&this.min>s)return!1;if(this.max&&this.max<o)return!1}return!0};Calendar.prototype._sameMonth=function(e,t){return isDate(e)&&isDate(t)&&e.getMonth()==t.getMonth()&&e.getFullYear()==t.getFullYear()};Calendar.prototype._getValidDate=function(e,t){if(isDate(e))for(var i=e.getFullYear(),n=e.getMonth()+(t?0:1),o=t?1:0,s=DateTime,r=s.newDate(i,n,o),a=t?1:-1,l=0;l<31;l++){if(this._valid(r))return r;r=s.addDays(r,a)}return null};Calendar.prototype._clamp=function(e){if(e){var t=DateTime.fromDateTime;if(this.min){var i=t(this.min,e);e<i&&(e=i)}if(this.max){var n=t(this.max,e);e>n&&(e=n)}}return e};Calendar.prototype._createChildren=function(){var e=this.getTemplate();this.applyTemplate(ControlClsNames.hostElement+" "+CalendarClsNames.hostElement,e,{_tbHdr:"tbl-header",_btnMth:"btn-month",_spMth:"span-month",_btnPrv:"btn-prev",_btnTdy:"btn-today",_btnNxt:"btn-next",_tbMth:"tbl-month",_tbYr:"tbl-year"});this._tbYr.style.display="none";var t=culture.Calendar.ariaLabels;setAriaLabel(this._tbMth,t.chooseDate);setAriaLabel(this._tbYr,t.chooseMonth);setAriaLabel(this._btnPrv,t.calendar);setAriaLabel(this._btnMth,t.monthView);setAriaLabel(this._btnPrv,t.prvMo);setAriaLabel(this._btnTdy,t.today);setAriaLabel(this._btnNxt,t.nxtMo);for(var i=this._createElement("tr",this._tbMth,CalendarClsNames.header),n=0;n<7;n++){this._createElement("th",i).setAttribute("scope","col")}i=this._createElement("tr",this._tbYr,CalendarClsNames.header);this._showYearListBoxButton=this._createElement("th",i);this._showYearListBoxButton.setAttribute("colspan","4");this._showYearListBoxButton.setAttribute("scope","col");setAriaLabel(this._showYearListBoxButton,t.selectYear);toggleClass(this._showYearListBoxButton,CalendarClsNames.selectedYear);this._showYearListBoxButton.setAttribute("role","button");this._showYearListBoxButton.setAttribute("tabIndex","-1");for(var o=0;o<3;o++){i=this._createElement("tr",this._tbYr);for(var s=0;s<4;s++)this._createElement("td",i)}};Calendar.prototype._createYearPicker=function(){var e=this,t=this.hostElement,i=this._createElement("div",null,DropDownClsNames.dropDownPanel+" "+CalendarClsNames.yearPicker);i.tabIndex=this._orgTabIndex;this._lbYears=new ListBox(i,{lostFocus:function(t){hidePopup(i);e._tmYrHidden=Date.now();e.removeEventListener(window,"touchstart");if(t.selectedIndex>-1){var n=DateTime.clone(e.displayMonth);n.setFullYear(t.selectedIndex+t.itemsSource[0]);e.displayMonth=n;e.focusMode&&(e.focusValue=n)}e.keyActionTab===CalendarTabKeyAction.All&&e._showYearListBoxButton.focus()}});setAriaLabel(this._lbYears.hostElement,culture.Calendar.ariaLabels.selectYear);this.addEventListener(i,"keydown",(function(i){switch(i.keyCode){case Key.Enter:t.focus();break;case Key.Space:t.focus();i.preventDefault();break;case Key.Escape:e._lbYears.selectedIndex=-1;t.focus()}i.defaultPrevented&&i.stopPropagation()}));this.addEventListener(i,"click",(function(e){t.focus()}))};Calendar.prototype._createElement=function(e,t,i){var n=document.createElement(e);i&&addClass(n,i);t&&t.appendChild(n);return n};Calendar.prototype._click=function(e){if(!e.defaultPrevented&&0==e.button){var t=!1,i=e.target;if(contains(this._btnMth,i)&&!this._mthMode()&&this._getShowMonthPicker()){this.monthView=!this.monthView;t=!0}else if(contains(this._btnPrv,i)){this._navigate(-1);if(this.focusMode){var n=DateTime.addMonths(this.focusValue,-1);this.focusValue=n}t=!0}else if(contains(this._btnNxt,i)){this._navigate(1);if(this.focusMode){n=DateTime.addMonths(this.focusValue,1);this.focusValue=n}t=!0}else if(contains(this._btnTdy,i)){this._navigate(0);this.focusMode&&(this.focusValue=this.value);t=!0}if(i&&!t&&this._yrPicker&&contains(this._tbYr,i)&&closest(i,"."+CalendarClsNames.header)){this._showYearPickerAction(e);return}if(i&&!t){var o=closest(i,"td");if(o){var s=this.hitTest(o),r=DateTime.fromDateTime;if(this.monthView){if(s&&this._canChangeValue()){var a=r(s,this._value);this._inValidRange(a)&&this._valid(a)&&(this._rngMode()&&this.value&&!this.rangeEnd&&a>=this.value?this.rangeEnd=a:this.value=a);t=!0}}else if(s){this.displayMonth=s;if(this._mthMode()){if(this._canChangeValue()){a=r(this.displayMonth,this.value);this._inValidRange(a)&&(this.value=a)}}else this.monthView=!0;t=!0}}}if(t){e.preventDefault();this.focusMode||0===e.detail||this.focus()}}};Calendar.prototype._keydown=function(e){this._isSpaceDownForSetValue=!1;if(!e.defaultPrevented){if(e.altKey)switch(e.keyCode){case Key.Up:case Key.Down:return;case Key.End:this._navigate(0);e.preventDefault();return}var t=e.target;if(("Enter"===e.key||"Space"===e.code)&&t&&this.keyActionTab===CalendarTabKeyAction.All){if(contains(this._btnMth,t)&&!this._mthMode()&&this._getShowMonthPicker()){this.monthView=!this.monthView;"Space"===e.code&&e.preventDefault();return}if(this._yrPicker&&contains(this._tbYr,t)&&closest(t,"."+CalendarClsNames.header)){this._showYearPickerAction(e);return}}if(this.focusMode){if(("Enter"===e.key||"Space"===e.code)&&t.classList.contains(CalendarClsNames.focused)){var i=closest(t,"td");if(i){var n=this.hitTest(i);this._isSpaceDownForSetValue="Space"===e.code;this.setFocusModeValue(n,e)}"Space"===e.code&&e.preventDefault();return}if(!contains(this._tbMth,e.target)&&(!contains(this._tbYr,e.target)||contains(this._tbYr.firstElementChild,e.target)))return;if("Tab"===e.key&&this.monthView){var o=this._getCalendars();if(this!==o[e.shiftKey?0:o.length-1]){var s=DateTime.addMonths(this.focusValue,e.shiftKey?-1:1);this.focusValue=s;e.preventDefault()}}}if(!(e.ctrlKey||e.metaKey||e.shiftKey&&!this._rngMode())){var r=this._getKeyCode(e),a=0,l=0,h=!0;if(this.monthView)switch(r){case Key.Left:a=-1;break;case Key.Right:a=1;break;case Key.Up:a=-7;break;case Key.Down:a=7;break;case Key.PageDown:l=e.altKey?12:1;break;case Key.PageUp:l=e.altKey?-12:-1;break;case Key.Home:case Key.End:if(this._canChangeValue()&&!e.shiftKey){var u=this.value||this.displayMonth;if(p=this._getValidDate(u,r==Key.Home)){this.value=DateTime.fromDateTime(p,this.value);this._rngEnd=null}}break;default:h=!1}else switch(r){case Key.Left:l=-1;break;case Key.Right:l=1;break;case Key.Up:l=-4;break;case Key.Down:l=4;break;case Key.PageDown:l=e.altKey?120:12;break;case Key.PageUp:l=e.altKey?-120:-12;break;case Key.Home:l=this.value?-this.value.getMonth():0;break;case Key.End:l=this.value?11-this.value.getMonth():0;break;case Key.Enter:this._mthMode()?h=!1:this.monthView=!0;break;default:h=!1}if(this._canChangeValue()&&(a||l)){var c=e.shiftKey&&null!=this.rangeEnd?this.rangeEnd:this.focusMode?this.focusValue:this.value,p=DateTime;if(c){c=p.addDays(c,a);c=p.addMonths(c,l)}else c=this._getValidDate(new Date,!0);if(l&&!this._valid(c)){u=c.getMonth();for(var d=1;d<31&&!this._valid(c);d++){var m=p.addDays(c,+d),_=p.addDays(c,-d);this._valid(m)&&m.getMonth()==u?c=m:this._valid(_)&&_.getMonth()==u&&(c=_)}}for(d=0;d<31&&!this._valid(c);d++)c=p.addDays(c,a>0||l>0?1:-1);e.shiftKey&&this._rngMode()&&c>this.value?this.rangeEnd=c:this.focusMode?this.focusValue=c:this.value=c}h&&e.preventDefault()}}};Calendar.prototype._getMonth=function(e){var t=DateTime;e=e||t.newDate();return t.newDate(e.getFullYear(),e.getMonth(),1)};Calendar.prototype._mthMode=function(){return this.selectionMode==DateSelectionMode.Month};Calendar.prototype._rngMode=function(){return this.selectionMode==DateSelectionMode.Range};Calendar.prototype._navigate=function(e){var t=this.monthView,i=this.displayMonth,n=DateTime;switch(e){case 0:var o=n.newDate();this._canChangeValue()&&(this.value=t?n.fromDateTime(o,this.value):this._getMonth(o));i=this._getMonth(o);break;case 1:i=n.addMonths(i,t?1:12);break;case-1:i=n.addMonths(i,t?-1:-12)}this.displayMonth=i};Calendar.prototype._setTabOrder=function(t){e.prototype._setTabOrder.call(this,t);this._lbYears.tabOrder=this._orgTabIndex;this._getCalendars().forEach((function(e){e.tabOrder!=t&&(e.tabOrder=t)}));this.updateCalendarsTabindex()};Calendar.prototype._showYearPickerAction=function(e){var t=this,i=e.target;if(Date.now()-this._tmYrHidden<600)e.preventDefault();else{for(var n=this.displayMonth.getFullYear(),o=this.min?this.min.getFullYear():n-100,s=this.max?this.max.getFullYear():n+100,r=[],a=o;a<=s;a++)r.push(a);var l=this._lbYears,h=l.hostElement,u=closest(i,"."+CalendarClsNames.header),c=this.hostElement,p=closest(c,"."+InputDateClsNames.inputDateDropDown)||c;l.itemsSource=r;l.selectedIndex=n-r[0];setAttribute(h,"dir",this.rightToLeft?"rtl":null);setCss(h,{minWidth:"",width:u.offsetWidth});showPopup(h,u,!1,!1,p);requestAnimationFrame((function(){l.showSelection(!0)}));this.addEventListener(window,"touchstart",(function(e){if(!contains(h,e.target)){hidePopup(h);t._tmYrHidden=Date.now();t.removeEventListener(window,"touchstart")}}));e.preventDefault()}};Object.defineProperty(Calendar.prototype,"focusMode",{get:function(){return this._focusMode},set:function(e){this._focusMode=e;this._getCalendars().forEach((function(t){t.focusMode!==e&&(t.focusMode=e)}));this.updateCalendarsTabindex();this.invalidate()},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"keyActionTab",{get:function(){return this._keyActionTab},set:function(e){this._keyActionTab=e;this._updateButtonTabIndex()},enumerable:!0,configurable:!0});Calendar.prototype._isButtonFocused=function(){var e=getActiveElement();if(!e)return!1;var t=e.getAttribute("role"),i=e.type;return t&&"button"===t.toLowerCase()||i&&"button"===i.toLowerCase()};Calendar.prototype._isSameMonth=function(e,t){return e.getMonth()===t.getMonth()};Calendar.prototype._dateViewContainsFocus=function(){var e=this._tbYr.querySelectorAll("td"),t=Array.from(e).find((function(e){return e===getActiveElement()}));return this._tbMth.contains(getActiveElement())||void 0!==t};Calendar.prototype._updateMonthButtonAria=function(){var e=culture.Calendar.ariaLabels,t=this.monthView?e.monthView:e.yearView;setAriaLabel(this._btnMth,t+", "+Globalize.format(this.displayMonth,this._fmtYrMo))};Calendar.prototype._isDayValid=function(e){return this._valid(e)&&this._inValidRange(e)};Calendar.prototype.cancelButtonClick=function(e){this.cancelButtonClicked.raise(this,e)};Calendar.prototype.oneCancelButtonClick=function(e){this.cancelButtonClick(e)};Calendar.prototype.OKButtonClick=function(e){this.OKButtonClicked.raise(this,e)};Calendar.prototype.onOkButtonClick=function(e){this.OKButtonClick(e);this.setFocusModeValue(this.focusValue)};Object.defineProperty(Calendar.prototype,"ariaLabel",{get:function(){return this._ariaLabel},set:function(e){if(this.ariaLabel!==e&&this.hostElement){this._ariaLabel=e;setAttribute(this.hostElement,"aria-label",e)}},enumerable:!0,configurable:!0});Calendar.prototype._updateButtonTabIndex=function(){var e=this.tabOrder.toString();if(this.keyActionTab===CalendarTabKeyAction.All&&!0!==this.isDisabled){setAttribute(this._btnMth,"tabindex",e);setAttribute(this._btnPrv,"tabindex",e);setAttribute(this._btnTdy,"tabindex",e);setAttribute(this._btnNxt,"tabindex",e);setAttribute(this._showYearListBoxButton,"tabindex",e)}else{setAttribute(this._btnMth,"tabindex","-1");setAttribute(this._btnPrv,"tabindex","-1");setAttribute(this._btnTdy,"tabindex","-1");setAttribute(this._btnNxt,"tabindex","-1");setAttribute(this._showYearListBoxButton,"tabindex","-1")}setAttribute(this._btnOK,"tabindex",e);setAttribute(this._btnCancel,"tabindex",e)};Calendar.prototype._onEnterKeyDownToSetValue=function(e){this._enterKeyDownToSetValue.raise(this,e)};Object.defineProperty(Calendar.prototype,"showConfirmationButtons",{get:function(){return this._showConfirmationButtons},set:function(e){this._showConfirmationButtons=e;this._getCalendars().forEach((function(t){t._showConfirmationButtons=e}))},enumerable:!0,configurable:!0});Calendar.prototype._setIsDisabled=function(t){e.prototype._setIsDisabled.call(this,t);this._updateButtonTabIndex()};Calendar.prototype.updateCalendarsTabindex=function(){var e=this.focusMode||-1===this.tabOrder?-1:0;this._getCalendarsHostElements().forEach((function(t){t.tabIndex=e}))};Calendar.prototype.setFocusModeValue=function(e,t){var i=DateTime.fromDateTime;if(this.monthView){if(e&&this._canChangeValue()){var n=i(e,this._value);if(this._inValidRange(n)&&this._valid(n))if(this._rngMode()&&this.value&&!this.rangeEnd&&n>=this.value)this.rangeEnd=n;else{t&&this._enterKeyDownToSetValue.raise(this,t);this.value=n}}}else if(e){this.displayMonth=e;if(this._mthMode()){if(this._canChangeValue()){n=i(this.displayMonth,this.value);this._inValidRange(n)&&(this.value=n)}}else this.monthView=!0}};Calendar.prototype._getCalendarsHostElements=function(){return this._getCalendars().filter((function(e,t){return t>0})).map((function(e){return e.hostElement}))};Calendar.prototype.updateConfirmationButtons=function(e){if(!this._confirmationButtonContainer){var t='<div class="'+CalendarClsNames.confirmationButtonContainer+'"></div>';this._confirmationButtonContainer=createElement(t);this._btnOK=createElement('<button wj-part="btn-ok" class="'+InputFormElementsClsNames.btn+" "+CalendarClsNames.button+'"></button>');this._btnCancel=createElement('<button wj-part="btn-cancel" class="'+InputFormElementsClsNames.btn+" "+CalendarClsNames.button+'"></button>');var i=culture.Calendar.buttons;setText(this._btnOK,i.ok);setText(this._btnCancel,i.cancel);var n=this.addEventListener.bind(this);n(this._btnCancel,"click",this.oneCancelButtonClick.bind(this));n(this._btnOK,"click",this.onOkButtonClick.bind(this));this._confirmationButtonContainer.appendChild(this._btnOK);this._confirmationButtonContainer.appendChild(this._btnCancel);e.appendChild(this._confirmationButtonContainer)}};Calendar.prototype.setFocusValueToFirstOrLastCalendar=function(e){var t,i=this._getCalendars();t=this.monthView?e?i[0].displayMonth:i[i.length-1].displayMonth:i[0].displayMonth;var n=this.focusValue.getDate(),o=new Date(t.getFullYear(),t.getMonth()+1,0).getDate(),s=new Date(t.getFullYear(),t.getMonth(),Math.min(n,o));this.focusValue=s};Calendar.prototype.isCalendarDateCell=function(e){return!isNullOrUndefined(e[Calendar._DATE_KEY])&&"td"===e.tagName.toLowerCase()};Calendar.prototype.isThisMainCalendar=function(){return this==this._getCalendars()[0]};Calendar._DATE_KEY="$WJ-DATE";Calendar._ctrlTemplate="";return Calendar}(Control);export{Calendar};export function softTouch(){return _getModule("wijmo.touch")}export function getDragDropTouch(){var e=softTouch();return e&&e.DragDropTouch&&e.DragDropTouch.getInstance?e.DragDropTouch.getInstance():null}_addCultureInfo("DropDown",{ariaLabels:{tgl:"Toggle Dropdown"}});export var ClickAction;!function(e){e[e.Select=0]="Select";e[e.Open=1]="Open";e[e.Toggle=2]="Toggle"}(ClickAction||(ClickAction={}));export var KeyAction;!function(e){e[e.ChangeSelectionOnly=0]="ChangeSelectionOnly";e[e.OpenDropdown=1]="OpenDropdown"}(KeyAction||(KeyAction={}));export var TabKeyAction;!function(e){e[e.CloseAndKeepFocus=0]="CloseAndKeepFocus";e[e.CloseAndMoveFocus=1]="CloseAndMoveFocus"}(TabKeyAction||(TabKeyAction={}));var _Edges,DropDown=function(e){__extends(DropDown,e);function DropDown(t,i){var n=e.call(this,t)||this;n._clickAction=ClickAction.Select;n._showBtn=!0;n._autoExpand=!0;n._animate=!1;n._internalSettingText=!1;n._oldText="";n._keyActionDownArrow=KeyAction.ChangeSelectionOnly;n._keyActionUpArrow=KeyAction.ChangeSelectionOnly;n._keyActionTab=TabKeyAction.CloseAndMoveFocus;n._touchMove=!1;n._isDropdownOpened=!1;n.textChanged=new Event;n.isDroppedDownChanging=new Event;n.isDroppedDownChanged=new Event;var o,s=n.getTemplate();n.applyTemplate(ControlClsNames.hostElement+" "+ControlClsNames.content+" "+DropDownClsNames.hostElement,s,{_tbx:"input",_btn:"btn",_dropDown:"dropdown"},"input");n.hostElement&&n.hostElement.id&&(o=n.hostElement.id);o&&n._dropDown&&n._dropDown.setAttribute("dropdown-id",o);n._dropDown.style.display="none";var r=culture.DropDown.ariaLabels;setAriaLabel(n._btn.querySelector("button"),r.tgl);var a=n._elRef=n._tbx;disableAutoComplete(a);n._createDropDown();n._updateTbxAriaHaspopup();n._updateBtn();n._updateTbx();var l=n.hostElement;addClass(l,ControlStateClsNames.collapsed);n.addEventListener(window,"resize",(function(){n.isDroppedDown&&n.invalidate()}));var h=n.dropDown,u=n.addEventListener.bind(n),c=n._updateFocusState.bind(n);u(h,"blur",c,!0);u(h,"focus",c);var p=n._keydown.bind(n);u(l,"keydown",p);u(h,"keydown",p);var d=n._keypress.bind(n);u(l,"keypress",d,!0);u(h,"keypress",d,!0);var m=n._input.bind(n);u(a,"input",m);u(a,"beforeinput",(function(e){"historyUndo"!==e.inputType&&"historyRedo"!==e.inputType||e.preventDefault()}));u(a,"blur",(function(){n._commitText(!0,!1)}),!0);u(a,"click",(function(){n._autoExpand&&n._expandSelection()}));u(a,"touchstart",(function(){n.isTouching&&"none"===a.getAttribute("inputmode")&&a.removeAttribute("inputmode")}));u(a,"mousedown",(function(e){if(n._isTouchMoved())e.preventDefault();else switch(n._clickAction){case ClickAction.Open:if(!n.isDroppedDown){e.preventDefault();n.focus();n.isDroppedDown=!0}break;case ClickAction.Toggle:e.preventDefault();n.focus();n.isDroppedDown=!n.isDroppedDown}}));u(n._btn,"mousedown",(function(e){n._isTouchMoved()||n._btnclick(e)}));removeChild(h);isIE()&&n._elRef==n._tbx&&u(l,"mouseup",(function(e){if(!e.defaultPrevented&&0==e.button&&hasClass(e.target,InputFormElementsClsNames.btn)){var t=getActiveElement();t&&t!=e.target&&setTimeout((function(){t.focus()}))}}));isIE9()&&u(a,"keyup",(function(){n._setText(n.text,!1)}));u(h,"click",n._dropDownClick.bind(n));return n}Object.defineProperty(DropDown,"controlTemplate",{get:function(){DropDown._ctrlTemplate||(DropDown._ctrlTemplate='<div class="'+ControlClsNames.template+'"><div class="'+InputClsNames.input+'"><div class="'+InputClsNames.inputGroup+" "+InputClsNames.inputBtnVisible+'"><input wj-part="input" type="text" class="'+InputFormElementsClsNames.formControl+'"><span wj-part="btn" class="'+InputClsNames.inputGroupBtn+'"><button class="'+InputFormElementsClsNames.btn+" "+InputFormElementsClsNames.btnDefault+'" tabindex="-1"><span class='+GlyphClsNames.down+'></span></button></span></div></div><div wj-part="dropdown" class="'+ControlClsNames.content+" "+DropDownClsNames.dropDownPanel+'"></div></div>');return DropDown._ctrlTemplate},set:function(e){DropDown._ctrlTemplate=e},enumerable:!0,configurable:!0});DropDown.prototype._isTouchMoved=function(){var e=getDragDropTouch();return e&&e.isDragging};Object.defineProperty(DropDown.prototype,"text",{get:function(){return this._tbx.value},set:function(e){if(e!=this.text){this._setText(e,!0);this._commitText()}},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"inputElement",{get:function(){return this._tbx},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"inputType",{get:function(){return this._tbx.type},set:function(e){this._tbx.type=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"isReadOnly",{get:function(){return this._tbx.readOnly},set:function(e){this._tbx.readOnly=asBoolean(e);toggleClass(this.hostElement,ControlStateClsNames.readOnly,this.isReadOnly);this.isReadOnly&&this._toggleDropDown(!1)},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"isRequired",{get:function(){return this._tbx.required},set:function(e){this._tbx.required=asBoolean("boolean"==typeof e?e:this.isRequired)},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"placeholder",{get:function(){return this._tbx.placeholder},set:function(e){this._tbx.placeholder=e},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"clickAction",{get:function(){return this._clickAction},set:function(e){this._clickAction=asEnum(e,ClickAction)},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"isDroppedDown",{get:function(){var e=this._dropDown;return e&&"none"!=e.style.display},set:function(e){var t=this.hostElement,i=this._dropDown,n=this.containsFocus(),o=new Set(["InputDateTime","WjInputDateTime"]);if(t&&i){var s=!this.isReadOnly;this.isTouching&&(s=!0);e=asBoolean(e)&&!this.isDisabled&&s&&t.offsetWidth>0;this.isDroppedDown&&!e&&this.isDisabled&&(e=this.isDroppedDown);if(e||"INPUT"!=getActiveElement().tagName||this.inputElement===getActiveElement()||!this._isInvalidInputCancelled){if(e!=this.isDroppedDown&&(o.has(this.constructor.name)||!this._isInvalidInputCancelled||!this.isDroppedDown&&this._isInvalidInputCancelled)&&this.onIsDroppedDownChanging(new CancelEventArgs)){this._toggleDropDown(e);n&&(this.isTouching&&this.showDropDownButton?t.focus():this.selectAll());this._updateFocusState();this._updateBtn();this._updateTbx();toggleClass(t,ControlStateClsNames.collapsed,!this.isDroppedDown);this.onIsDroppedDownChanged()}}else{this._isDropdownOpened=this.isDroppedDown;this._toggleDropDown(e)}}},enumerable:!0,configurable:!0});DropDown.prototype._toggleDropDown=function(e){var t=this,i=this.hostElement,n=this._dropDown;if(e){this._minWidthDropdown=n.style.minWidth;n.style.display="";this._updateDropDown();this.addEventListener(window,"touchstart",(function(e){for(var n=Control._touching,o=e.target;o;){if(o==i)return;o=o[Control._OWNR_KEY]||o.parentNode}Control._touching=!0;t.isDroppedDown=!1;Control._touching=n}))}else{this.removeEventListener(window,"touchstart");hidePopup(n);n.style.minWidth=this._minWidthDropdown}};Object.defineProperty(DropDown.prototype,"dropDown",{get:function(){return this._dropDown},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"dropDownCssClass",{get:function(){return this._cssClass},set:function(e){if(e!=this._cssClass){removeClass(this._dropDown,this._cssClass);this._cssClass=asString(e);addClass(this._dropDown,this._cssClass)}},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"showDropDownButton",{get:function(){return this._showBtn},set:function(e){this._showBtn=asBoolean(e);this._updateBtn()},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"autoExpandSelection",{get:function(){return this._autoExpand},set:function(e){this._autoExpand=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"isAnimated",{get:function(){return this._animate},set:function(e){this._animate=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"keyActionDownArrow",{get:function(){return this._keyActionDownArrow},set:function(e){this._keyActionDownArrow=asEnum(e,KeyAction)},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"keyActionUpArrow",{get:function(){return this._keyActionUpArrow},set:function(e){this._keyActionUpArrow=asEnum(e,KeyAction)},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"keyActionTab",{get:function(){return this._keyActionTab},set:function(e){this._keyActionTab=asEnum(e,TabKeyAction)},enumerable:!0,configurable:!0});DropDown.prototype.selectAll=function(){var e=this._tbx;this._elRef==e&&setSelectionRange(e,0,this.text.length);this.containsFocus()||this.focus()};DropDown.prototype.onTextChanged=function(e){this.textChanged.raise(this,e);this._updateState()};DropDown.prototype.onIsDroppedDownChanging=function(e){this.isDroppedDownChanging.raise(this,e);return!e.cancel};DropDown.prototype.onIsDroppedDownChanged=function(e){this.isDroppedDownChanged.raise(this,e)};DropDown.prototype.onGotFocus=function(t){this.isTouching||contains(this._dropDown,getActiveElement())||this.selectAll();e.prototype.onGotFocus.call(this,t)};DropDown.prototype.onLostFocus=function(t){this._commitText();this.isDroppedDown=!1;e.prototype.onLostFocus.call(this,t)};DropDown.prototype._containsFocusImpl=function(t){return e.prototype._containsFocusImpl.call(this,t)||this.isDroppedDown&&contains(this._dropDown,t)};DropDown.prototype.dispose=function(){this.isDroppedDown=!1;var t=this._dropDown;if(t){this._dropDown=null;removeChild(t);var i=Control.getControl(t);i&&i.dispose()}e.prototype.dispose.call(this)};DropDown.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);var i=this.hostElement;if(i&&i.offsetHeight&&this.isDroppedDown){var n=getActiveElement();this.isAnimated&&""!=this._dropDown.style.opacity||showPopup(this._dropDown,i,!1,!1,null==this.dropDownCssClass);n instanceof HTMLElement&&n!=getActiveElement()&&n.focus()}};DropDown.prototype._handleResize=function(){this.isDroppedDown&&this.refresh()};DropDown.prototype._dropDownClick=function(e){e.stopPropagation()};DropDown.prototype._expandSelection=function(){var e=this._tbx,t=e.value,i=e.selectionStart,n=e.selectionEnd;if(t&&i==n){var o=this._getCharType(t,i);if(o>-1){for(;n<t.length&&this._getCharType(t,n)==o;n++);for(;i>0&&this._getCharType(t,i-1)==o;i--);i!=n&&setSelectionRange(e,i,n)}}};DropDown.prototype._getCharType=function(e,t){var i=e[t];return i>="0"&&i<="9"?0:i>="a"&&i<="z"||i>="A"&&i<="Z"?1:-1};DropDown.prototype._keydown=function(e){if(!e.defaultPrevented&&!this._isHiddenEditor()){switch(e.keyCode){case Key.Escape:case Key.Enter:if(this.isDroppedDown){this.isDroppedDown=!1;this.containsFocus()||this.focus();e.preventDefault()}break;case Key.F4:this.toggleDropDown(e);break;case Key.Up:this.handleUpArrowKey(e);break;case Key.Down:this.handleDownArrowKey(e)}if(!e.defaultPrevented&&e.keyCode==Key.Escape&&isIE()){var t=this._tbx;if(e.target==t){var i=t.value;t.value=i+" ";t.value=i}}}};DropDown.prototype.toggleDropDown=function(e){if(this.isHostVisible()){this.isDroppedDown=!this.isDroppedDown;e.preventDefault()}};DropDown.prototype.handleUpArrowKey=function(e){e.altKey?this.toggleDropDown(e):this.keyActionUpArrow!==KeyAction.OpenDropdown||this.isDroppedDown||this.openDropDown(e)};DropDown.prototype.handleDownArrowKey=function(e){if(e.altKey)this.toggleDropDown(e);else if(this.keyActionDownArrow===KeyAction.OpenDropdown&&!this.isDroppedDown){this.openDropDown(e);this._afterOpenDropdownByDownArrow()}};DropDown.prototype._afterOpenDropdownByDownArrow=function(){};DropDown.prototype.openDropDown=function(e){if(this.isHostVisible()){this.isDroppedDown=!0;e.preventDefault()}};DropDown.prototype.isHostVisible=function(){var e=this.hostElement;return!(!e||!e.offsetHeight)};DropDown.prototype._isHiddenEditor=function(){return hasClass(this._tbx,"wj-grid-ime")};DropDown.prototype._keypress=function(e){"AltLeft"!=e.code&&"AltRight"!=e.code||e.preventDefault()};DropDown.prototype._input=function(e){this._setText(this.text,!1)};DropDown.prototype._btnclick=function(e){if(!e.defaultPrevented&&0==e.button){this._isInvalidInputCancelled=!1;e.preventDefault();if(this.isTouching){this._tbx.getAttribute("inputmode");this._tbx.setAttribute("inputmode","none");this.isDroppedDown=!this.isDroppedDown;this.selectAll()}else{this.focus();this.isDroppedDown=!this.isDroppedDown}}};DropDown.prototype._setText=function(e,t,i,n){var o=!1;if((e=(e||"").toString())!=this._tbx.value){this._tbx.value=e;if(i||!e){this.onTextChanged();o=!0}}if(e!=this._oldText){this._oldText=e;this._internalSettingText||o||this.onTextChanged()}n&&(this._tbx.value=this._tbx.value.trim());this._updateState()};DropDown.prototype._updateBtn=function(){this._btn.style.display=this._showBtn?"":"none";this._updateBtnAria()};DropDown.prototype._updateBtnAria=function(){var e=this._btn.querySelector("button"),t=this.isDroppedDown,i=this.dropDown?this.dropDown.id:null;setAttribute(e,"aria-expanded",!!t);setAttribute(e,"aria-controls",t?i:null)};DropDown.prototype._updateTbx=function(){this._updateTbxAria()};DropDown.prototype._updateTbxAria=function(){var e=this._tbx,t=this.isDroppedDown,i=this.dropDown?this.dropDown.id:null;setAttribute(e,"aria-controls",t?i:null);setAttribute(e,"aria-expanded",t)};DropDown.prototype._updateTbxAriaHaspopup=function(){var e=this._tbx,t=this.dropDown&&this.dropDown.getAttribute("role");setAttribute(e,"aria-haspopup",t)};DropDown.prototype._createDropDown=function(){};DropDown.prototype._commitText=function(e,t){};DropDown.prototype._updateDropDown=function(){if(this.isDroppedDown){this._commitText();var e=this.dropDown;setAttribute(e,"dir",this.rightToLeft?"rtl":null);showPopup(e,this.hostElement,!1,this._animate,null==this.dropDownCssClass)}};DropDown.prototype._shouldRaiseInvalidInput=function(e){return isNullOrUndefined(e)?!this._containsFocus():e};DropDown._ctrlTemplate="";return DropDown}(Control);export{DropDown};_addCultureInfo("Popup",{ariaLabels:{close:"close",backdrop:"backdrop",isDraggable:"draggable",isResizable:"resizable",popupVisible:"visible",popupHide:"hidden",popup:"popup"}});export var PopupTrigger;!function(e){e[e.None=0]="None";e[e.ClickOwner=1]="ClickOwner";e[e.ClickPopup=2]="ClickPopup";e[e.Click=3]="Click";e[e.BlurOwner=4]="BlurOwner";e[e.BlurPopup=8]="BlurPopup";e[e.Blur=12]="Blur";e[e.ClickOrBlur=15]="ClickOrBlur";e[e.DownOwner=16]="DownOwner";e[e.DownPopup=32]="DownPopup";e[e.Down=48]="Down";e[e.EnterOwner=64]="EnterOwner";e[e.EnterPopup=128]="EnterPopup";e[e.Enter=192]="Enter";e[e.LeaveOwner=256]="LeaveOwner";e[e.LeavePopup=512]="LeavePopup";e[e.Leave=768]="Leave"}(PopupTrigger||(PopupTrigger={}));!function(e){e[e.None=0]="None";e[e.Left=1]="Left";e[e.Top=2]="Top";e[e.Right=4]="Right";e[e.Bottom=8]="Bottom";e[e.LeftTop=3]="LeftTop";e[e.RightTop=6]="RightTop";e[e.RightBottom=12]="RightBottom";e[e.LeftBottom=9]="LeftBottom"}(_Edges||(_Edges={}));var Popup=function(e){__extends(Popup,e);function Popup(t,i){var n=e.call(this,t)||this;n._owner=null;n._ariaLabel=culture.Popup.ariaLabels.popup;n._modal=!1;n._position=PopupPosition.BelowLeft;n._showTrigger=PopupTrigger.ClickOwner;n._hideTrigger=PopupTrigger.Blur;n._hideAnim=[];n._fadeIn=!0;n._fadeOut=!0;n._removeOnHide=!0;n._draggable=!1;n._resizable=!1;n._result=null;n._resultEnter=null;n._resultSubmit=null;n._callback=null;n._visible=!1;n._ownerClickBnd=n._ownerClick.bind(n);n._ownerDownBnd=n._ownerDown.bind(n);n._ownerBlurBnd=n._ownerBlur.bind(n);n._ownerEnterBnd=n._ownerEnter.bind(n);n._ownerLeaveBnd=n._ownerLeave.bind(n);n._mousedownBnd=n._mousedown.bind(n);n._mousemoveBnd=n._mousemove.bind(n);n._mousedragBnd=n._mousedrag.bind(n);n._mouseupBnd=n._mouseup.bind(n);n._hideBnd=n.hide.bind(n);n._lastShow=0;n._initialOwner=null;n._activeEdge=_Edges.None;n.showing=new Event;n.shown=new Event;n.hiding=new Event;n.hidden=new Event;n.resizing=new Event;n.resized=new Event;n.dragging=new Event;n.dragged=new Event;n.sizeChanging=new Event;n.sizeChanged=new Event;n.positionChanging=new Event;n.positionChanged=new Event;var o=n.hostElement;Popup._PopupInstanceCount++;addClass(o,ControlClsNames.hostElement+" "+ControlClsNames.content+" "+PopupClsNames.hostElement);if(n.hostElement){n._initialOwner=n.hostElement.parentElement;setAttribute(n.hostElement,"role","dialog")}o.getAttribute("tabindex")||(o.tabIndex=0);hidePopup(o,!1);var s=n.addEventListener.bind(n);s(o,"compositionstart",(function(){n._composing=!0}));s(o,"compositionend",(function(){n._composing=!1}));s(window,"resize",(function(){!n.isVisible||n._dragged||n.isTouching||n.invalidate()}));s(o,"keydown",(function(e){if(!e.defaultPrevented){var t=e.ctrlKey&&e.altKey&&!e.shiftKey,i=e.ctrlKey&&e.shiftKey&&!e.altKey;if(t||i){var s=n.hostElement.getBoundingClientRect(),r=Rect.fromBoundingRect(s);if(t&&n.isDraggable){e.preventDefault();switch(e.keyCode){case Key.Left:r.left=Math.max(0,r.left-10);break;case Key.Right:r.left=Math.min(window.innerWidth-r.width,r.left+10);break;case Key.Up:r.top=Math.max(0,r.top-10);break;case Key.Down:r.top=Math.min(window.innerHeight-r.height,r.top+10)}var a=new PopupBoundsChangingEventArgs(r);if(n.onPositionChanging(a)){setCss(n.hostElement,{left:r.left+window.scrollX,top:r.top+window.scrollY,transform:"none"});n.onPositionChanged()}}else if(i&&n.isResizable){e.preventDefault();var l=window.getComputedStyle(n.hostElement),h=Math.max(parseInt(l.minWidth)||0,Popup._SZ_MIN),u=Math.max(parseInt(l.minHeight)||0,Popup._SZ_MIN);if(n._activeEdge===_Edges.None)switch(e.keyCode){case Key.Up:n._activeEdge=_Edges.Top;break;case Key.Down:n._activeEdge=_Edges.Bottom;break;case Key.Left:n._activeEdge=_Edges.Left;break;case Key.Right:n._activeEdge=_Edges.Right}var c=n._activeEdge===_Edges.Top||n._activeEdge===_Edges.Bottom,p=n._activeEdge===_Edges.Left||n._activeEdge===_Edges.Right;if(c&&![Key.Up,Key.Down].includes(e.keyCode)||p&&![Key.Left,Key.Right].includes(e.keyCode))return;if(n._activeEdge!==_Edges.None){var d=0;switch(e.keyCode){case Key.Up:case Key.Left:d=-10;break;case Key.Down:case Key.Right:d=10}switch(n._activeEdge){case _Edges.Top:var m=Math.min(Math.max(r.top+d,0),r.bottom-u);r.height=r.bottom-m;r.top=m;break;case _Edges.Bottom:var _=Math.min(Math.max(r.bottom+d,r.top+u),window.innerHeight);r.height=_-r.top;break;case _Edges.Left:var f=Math.min(Math.max(r.left+d,0),r.right-h);r.width=r.right-f;r.left=f;break;case _Edges.Right:var b=Math.min(Math.max(r.right+d,r.left+h),window.innerWidth);r.width=b-r.left}r.left=Math.max(0,Math.min(r.left,window.innerWidth-r.width));r.top=Math.max(0,Math.min(r.top,window.innerHeight-r.height));var g=new PopupBoundsChangingEventArgs(r);if(n.onSizeChanging(g)){setCss(n.hostElement,{left:r.left+window.scrollX,top:r.top+window.scrollY,width:r.width,height:r.height,transform:"none"});n.onSizeChanged()}}}}if(e.keyCode==Key.Escape&&!n._composing){e.preventDefault();n.hide()}if(e.keyCode==Key.Enter&&!n._composing){var y=n.dialogResultEnter;if(y){e.preventDefault();n._validateAndHide(y)}}if(e.keyCode==Key.Tab&&n.modal){e.preventDefault();moveFocus(o,e.shiftKey?-1:1)}}}));s(document,"keyup",(function(e){e.ctrlKey||e.shiftKey||n._activeEdge===_Edges.None||(n._activeEdge=_Edges.None)}));s(o,"click",(function(e){var t=e.target;if(t instanceof HTMLElement){if(t instanceof HTMLButtonElement&&"submit"==t.type){var i=n.hostElement,o=n.dialogResultSubmit;if(i instanceof HTMLFormElement&&o&&i.reportValidity()){e.preventDefault();n.hide(o)}}var s=t.className.match(/\bwj-hide[\S]*\b/);if(s&&s.length>0){e.preventDefault();e.stopPropagation();n.hide(s[0])}}}));var r=n._toggle.bind(n),a=PopupTrigger;n.addEventListener(o,"click",(function(e){n._ignoreClick||r(e,a.ClickPopup)}),!0);n.addEventListener(o,"mousedown",(function(e){n._ignoreClick=!1;r(e,a.DownPopup)}),!0);n.addEventListener(o,"mouseenter",(function(e){e.target==o&&r(e,a.EnterPopup)}),!0);n.addEventListener(o,"mouseleave",(function(e){e.target==o&&r(e,a.LeavePopup)}),!0);n.addEventListener(o,"blur",(function(e){n.containsFocus()||r(e,a.BlurPopup)}),!0);s(document,"wheel",(function(e){if(n.isVisible&&n._modal){for(var t=e.target;t&&t!=document.body;t=t.parentElement)if(t.scrollHeight>t.clientHeight)return;e.preventDefault()}}));n.initialize(i);n._updateAriaLabel();return n}Object.defineProperty(Popup.prototype,"ariaLabelledBy",{get:function(){return this.hostElement.getAttribute("aria-labelledby")},set:function(e){_setAriaLabelBy(this,this.hostElement,e,this._updateAriaLabel.bind(this))},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"owner",{get:function(){return this._owner},set:function(e){var t=this._owner;if(t){this.removeEventListener(t,"click");this.removeEventListener(t,"mousedown");this.removeEventListener(t,"mouseenter");this.removeEventListener(t,"mouseleave");this.removeEventListener(t,"blur")}if(t=this._owner=null!=e?getElement(e):null){this.addEventListener(t,"click",this._ownerClickBnd,!0);this.addEventListener(t,"mousedown",this._ownerDownBnd,!0);this.addEventListener(t,"mouseenter",this._ownerEnterBnd,!0);this.addEventListener(t,"mouseleave",this._ownerLeaveBnd,!0);this.addEventListener(t,"blur",this._ownerBlurBnd,!0)}},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"position",{get:function(){return this._position},set:function(e){this._position=asEnum(e,PopupPosition)},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"content",{get:function(){return this.hostElement.firstElementChild},set:function(e){if(e!=this.content){this.hostElement.innerHTML="";e instanceof HTMLElement&&this.hostElement.appendChild(e)}},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"showTrigger",{get:function(){return this._showTrigger},set:function(e){this._showTrigger=asEnum(e,PopupTrigger)},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"hideTrigger",{get:function(){return this._hideTrigger},set:function(e){this._hideTrigger=asEnum(e,PopupTrigger)},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"fadeIn",{get:function(){return this._fadeIn},set:function(e){this._fadeIn=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"fadeOut",{get:function(){return this._fadeOut},set:function(e){this._fadeOut=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"removeOnHide",{get:function(){return this._removeOnHide},set:function(e){if((e=asBoolean(e))!=this.removeOnHide){this._removeOnHide=e;if(!this.isVisible){var t=this.hostElement;if(e)removeChild(t);else if(t&&document.body){t.style.display="none";document.body.appendChild(t)}}}},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"modal",{get:function(){return this._modal},set:function(e){this._modal=asBoolean(e);setAttribute(this.hostElement,"aria-modal",e?"true":null)},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"isDraggable",{get:function(){return this._draggable},set:function(e){this._draggable=asBoolean(e);this._updateAriaLabel()},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"isResizable",{get:function(){return this._resizable},set:function(e){this._resizable=asBoolean(e);this._updateAriaLabel()},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"dialogResult",{get:function(){return this._result},set:function(e){this._result=e},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"dialogResultEnter",{get:function(){return this._resultEnter},set:function(e){this._resultEnter=e},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"dialogResultSubmit",{get:function(){return this._resultSubmit},set:function(e){this._resultSubmit=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"isVisible",{get:function(){var e=this.hostElement;return this._visible&&null!=e&&e.offsetHeight>0},enumerable:!0,configurable:!0});Popup.prototype.show=function(e,t){var i=this;this._lastShow=Date.now();if(!this.isVisible){var n=this.hostElement;this.dialogResult=null;this._callback=null;this._oldFocus=null;this._myFocus=null;this._hideAnim.forEach((function(e){clearInterval(e)}));if(this._hideAnim.length>0){this._hideAnim.length=0;if(this._bkDrop){hidePopup(this._bkDrop,this.removeOnHide);this._bkDrop.style.opacity=""}hidePopup(n,this.removeOnHide);n.style.opacity=""}var o=new CancelEventArgs;if(this.onShowing(o)){null!=e&&(this.modal=asBoolean(e));null!=t&&(this._callback=asFunction(t));this._oldFocus=getActiveElement();showPopup(n,this._owner,this._position,this._fadeIn,!1,this._hideBnd);this._modal&&this._showBackdrop();setAttribute(this._oldFocus,"aria-expanded","true");this._composing=!1;this._visible=!0;this.onShown(o);this._updateAriaLabel();this._clearTimeouts();if(this.modal){this.addEventListener(window,"focus",(function(){if(!i.containsFocus()){var e=i._myFocus;e&&e.offsetHeight?e.focus():moveFocus(n,0)}}));this.addEventListener(n,"focusin",(function(){var e=getActiveElement();e&&contains(n,e)&&(e.tabIndex>-1||!i._myFocus)&&(i._myFocus=e)}))}this._resized=this._dragged=this._ignoreClick=!1;this._handleDragResize(!0);this.addEventListener(window,"touchstart",(function(e){i._hideTrigger&PopupTrigger.Blur&&!contains(n,e.target,!0)&&i.hide()}));this._toHidePopupTimer=setTimeout((function(){i.addEventListener(window,"click",(function(e){i._hideTrigger&PopupTrigger.BlurPopup&&i.isDisabled&&!contains(n,e.target,!0)&&i.hide()}))}));this._toGetFocusTimer=setTimeout((function(){if(!i.isDisabled&&!i.containsFocus()&&!i.isTouching){var e=n.querySelector("[autofocus]");if(e&&e.clientHeight>0&&!e.disabled&&e.tabIndex>-1&&!closest(e,"[disabled],."+ControlStateClsNames.disabled)){e.focus();isFunction(e.select)&&e.select()}else moveFocus(n,0)}if(!i.isDisabled&&!i.containsFocus()){n.tabIndex=0;n.focus()}}),100)}}};Popup.prototype.hide=function(e){var t=this;this.removeEventListener(window,"touchstart");this.removeEventListener(window,"click");if(this.isVisible){isUndefined(e)||(this.dialogResult=e);var i=new CancelEventArgs,n=this.hostElement;if(this.onHiding(i)){this._handleDragResize(!1);for(var o=this.containsFocus()?this._oldFocus:null,s=n.querySelectorAll("."+ControlClsNames.hostElement+"."+DropDownClsNames.hostElement),r=0;r<s.length;r++){var a=Control.getControl(s[r]);a instanceof DropDown&&(a.isDroppedDown=!1)}var l=this.removeOnHide,h=this.fadeOut;this._hideTimer=setTimeout((function(){t._updateState();t.onHidden(i);t._callback&&t._callback(t);if(t.hideTrigger&PopupTrigger.LeavePopup){var e=Control.getControl(closest(t.owner,"."+PopupClsNames.hostElement));if(e instanceof Popup&&0!=(e.hideTrigger&PopupTrigger.Leave)){var n=Popup._evtHover,o=n?document.elementFromPoint(n.clientX,n.clientY):null,s=Control.getControl(closest(o,"."+PopupClsNames.hostElement));s instanceof Popup&&!s.isVisible&&(o=null);o&&contains(e.hostElement,o,!0)||e.hide()}}}),Control._FOCUS_INTERVAL+50);this._bkDrop&&this._hideAnim.push(hidePopup(this._bkDrop,l,h));this._hideAnim.push(hidePopup(n,l,h));setAttribute(this._oldFocus,"aria-expanded","false");this._visible=!1;this._oldFocus=null;this._myFocus=null;this._updateAriaLabel();this.removeEventListener(window,"focus");this.removeEventListener(n,"focusin");this.containsFocus()&&getActiveElement().blur();this._clearTimeouts();!this.isVisible&&o&&o.offsetHeight&&o.focus()}}};Popup.prototype.onShowing=function(e){this.showing.raise(this,e);return!e.cancel};Popup.prototype.onShown=function(e){this.shown.raise(this,e)};Popup.prototype.onHiding=function(e){this.hiding.raise(this,e);return!e.cancel};Popup.prototype.onHidden=function(e){this._wasVisible=!1;this.hidden.raise(this,e)};Popup.prototype.onResizing=function(e){this.resizing.raise(this,e);return!e.cancel};Popup.prototype.onResized=function(e){this.resized.raise(this,e)};Popup.prototype.onDragging=function(e){this.dragging.raise(this,e);return!e.cancel};Popup.prototype.onDragged=function(e){this.dragged.raise(this,e)};Popup.prototype.onSizeChanging=function(e){this.sizeChanging.raise(this,e);return!e.cancel};Popup.prototype.onSizeChanged=function(e){this.sizeChanged.raise(this,e)};Popup.prototype.onPositionChanging=function(e){this.positionChanging.raise(this,e);return!e.cancel};Popup.prototype.onPositionChanged=function(e){this.positionChanged.raise(this,e)};Popup.prototype.onLostFocus=function(t){e.prototype.onLostFocus.call(this,t);if(this._hideTrigger&PopupTrigger.BlurPopup&&!this.containsFocus()){var i=document.createEvent("Event");i.initEvent("blur",!0,!0);this._toggle(i,PopupTrigger.BlurPopup)}};Popup.prototype.refresh=function(t){void 0===t&&(t=!0);var i=this.hostElement;e.prototype.refresh.call(this,t);if(this.isVisible&&!this._refreshing&&i){this._refreshing=!0;for(var n=getActiveElement(),o=this._owner?this._owner.getBoundingClientRect():null,s=[],r=i.querySelectorAll("."+DropDownClsNames.hostElement),a=0;a<r.length;a++){var l=Control.getControl(r[a]);if(l instanceof DropDown&&l.isDroppedDown){s.push(l);l.dropDown.style.display="none"}}showPopup(i,o,this._position);s.forEach((function(e){e.dropDown.style.display="";e._updateDropDown()}));this._modal&&n instanceof HTMLElement&&n!=getActiveElement()&&n.focus();this._refreshing=!1}};Popup.prototype._clearTimeouts=function(){if(this._toShow){clearTimeout(this._toShow);this._toShow=null}if(this._toHideLeave){clearTimeout(this._toHideLeave);this._toHideLeave=null}if(this._toHideBlur){clearTimeout(this._toHideBlur);this._toHideBlur=null}};Popup.prototype._handleDragResize=function(e){var t=this.hostElement,i=this._draggable?this._getHeaderElement():null,n=this.addEventListener.bind(this),o=this.removeEventListener.bind(this),s=this._mousemoveBnd,r=this._mousedownBnd;if(e){n(t,"mousemove",s);n(t,"mousedown",r);n(t,"touchstart",r);i&&(i.style.touchAction="none")}else{this._mousedownEvt=null;this._rcBounds=null;o(t,"mousemove",s);o(t,"mousedown",r);o(t,"touchstart",r);o(document,"mousemove",this._mousedragBnd);o(document,"mouseup",this._mouseupBnd);i&&(i.style.touchAction="")}};Popup.prototype._mousemove=function(e){if(!this._mousedownEvt){var t=this.hostElement,i=this._getEdges(t,e),n="",o=_Edges;this._edges=i;this._resizable&&(i==o.LeftTop||i==o.RightBottom?n="nwse-resize":i==o.LeftBottom||i==o.RightTop?n="nesw-resize":i==o.Left||i==o.Right?n="ew-resize":i!=o.Top&&i!=o.Bottom||(n="ns-resize"));this._draggable&&!n&&this._getClosestHeader(e.target)&&(n="move");t.style.cursor=n}};Popup.prototype._mousedown=function(e){if(!e.defaultPrevented){var t=e.touches&&e.touches.length>0?e.touches[0]:e;this._edges=this._getEdges(this.hostElement,t);if(this._edges||this._draggable&&this._getClosestHeader(e.target)){var i=new CancelEventArgs;if(this._edges?this.onResizing(i):this.onDragging(i)){this._mousedownEvt=t;this._rcBounds=this.hostElement.getBoundingClientRect();var n=this.addEventListener.bind(this),o=document,s=this._mousedragBnd,r=this._mouseupBnd;n(o,"mousemove",s);n(o,"touchmove",s);n(o,"mouseup",r);n(o,"touchend",r)}}this._ignoreClick=!1}};Popup.prototype._mouseup=function(){this._mousedownEvt=null;this._rcBounds=null;this._activeEdge=_Edges.None;var e=this.removeEventListener.bind(this),t=document,i=this._mousedragBnd,n=this._mouseupBnd;e(t,"mousemove",i);e(t,"touchmove",i);e(t,"mouseup",n);e(t,"touchend",n);this._resized?this.onResized():this._dragged&&this.onDragged();this._resized=this._dragged=this._ignoreClick=!1};Popup.prototype._mousedrag=function(e){if(!e.defaultPrevented){var t=this.hostElement,i=this._mousedownEvt,n=e.touches&&e.touches.length>0?e.touches[0]:e,o=n.clientX-i.clientX,s=n.clientY-i.clientY,r=this._rcBounds,a=this._edges,l=Popup._SZ_MIN,h=Rect.fromBoundingRect(r);if(a){var u=window.getComputedStyle(t),c=parseInt(u.getPropertyValue("min-width"))||l,p=parseInt(u.getPropertyValue("min-height"))||l;if(a&_Edges.Left){var d=h.right-c;h.left=Math.min(h.left+o,d);h.width=Math.max(h.width-o,c)}else a&_Edges.Right&&(h.width=Math.max(h.width+o,c));if(a&_Edges.Top){var m=h.bottom-p;h.top=Math.min(h.top+s,m);h.height=Math.max(h.height-s,p)}else a&_Edges.Bottom&&(h.height=Math.max(h.height+s,p));if(this.onSizeChanging(new PopupBoundsChangingEventArgs(h))){setCss(t,{left:h.left+window.scrollX,top:h.top+window.scrollY,width:h.width,height:h.height,transform:"none"});this._resized=this._dragged=this._ignoreClick=!0;this.onSizeChanged()}if(!window.ResizeObserver)for(var _=this.hostElement.children,f=0;f<_.length;f++)Control.invalidateAll(_[f])}else if(this._draggable){"touchmove"===e.type&&isiOS()&&e.preventDefault();if(this._dragged||Math.abs(o)+Math.abs(s)>Popup._DRAG_THRESHOLD){h.left=Math.max(r.left+o+(n.pageX-n.clientX),50-r.width);h.top=Math.max(r.top+s+(n.pageY-n.clientY),0);if(this.onPositionChanging(new PopupBoundsChangingEventArgs(h))){setCss(t,{left:h.left,top:h.top,width:h.width,height:h.height,transform:"none"});this._dragged=this._ignoreClick=!0;this.onPositionChanged()}}}}};Popup.prototype._getEdges=function(e,t){var i=0;if(this._resizable){var n=e.getBoundingClientRect(),o=Popup._SZ_EDGE;t.clientX-n.left<o&&(i|=_Edges.Left);t.clientY-n.top<o&&(i|=_Edges.Top);n.right-t.clientX<o&&(i|=_Edges.Right);n.bottom-t.clientY<o&&(i|=_Edges.Bottom)}return i};Popup.prototype._ownerClick=function(e){this._toggle(e,PopupTrigger.ClickOwner)};Popup.prototype._ownerDown=function(e){this._wasVisible=this.isVisible;this._toggle(e,PopupTrigger.DownOwner)};Popup.prototype._ownerBlur=function(e){contains(this._owner,getActiveElement())||this._toggle(e,PopupTrigger.BlurOwner)};Popup.prototype._ownerEnter=function(e){e.target==this._owner&&this._toggle(e,PopupTrigger.EnterOwner)};Popup.prototype._ownerLeave=function(e){e.target==this._owner&&this._toggle(e,PopupTrigger.LeaveOwner)};Popup.prototype._toggle=function(e,t){var i=this;e instanceof MouseEvent&&(Popup._evtHover=e);if(!("mouseenter"==e.type&&Date.now()-this._lastShow<300||e.defaultPrevented)){var n=0!=(this._hideTrigger&t),o=0!=(this._showTrigger&t),s=PopupTrigger;(n||o)&&this._clearTimeouts();n&&this.isVisible&&(t&s.Leave?this._toHideLeave=setTimeout((function(){var e=Popup._evtHover,t=e?document.elementFromPoint(e.clientX,e.clientY):null;t&&contains(i.hostElement,t,!0)||i.hide()}),Control._LEAVE_DELAY):t&s.Blur?this._toHideBlur=setTimeout((function(){i.containsFocus()||contains(i._owner,getActiveElement())||i.hide()}),Control._FOCUS_INTERVAL+50):this.hide());o&&t!=s.ClickPopup&&(this._wasVisible||(t&s.Enter?this._toShow=setTimeout((function(){i.show()}),Control._HOVER_DELAY):this.show()))}};Popup.prototype._getHeaderElement=function(){var e=this.hostElement;return e.querySelector("."+PopupClsNames.dialogHeader)||e.querySelector(".modal-header")};Popup.prototype._getClosestHeader=function(e){return closest(e,"."+PopupClsNames.dialogHeader)||closest(e,".modal-header")};Popup.prototype._showBackdrop=function(){var e=this;if(!this._bkDrop){this._bkDrop=document.createElement("div");this._bkDrop.tabIndex=-1;setAttribute(this._bkDrop,"role","presentation");setAttribute(this._bkDrop,"aria-hidden","true");setAttribute(this._bkDrop,"aria-label",culture.Popup.ariaLabels.backdrop);addClass(this._bkDrop,PopupClsNames.popupBackDrop);this.addEventListener(this._bkDrop,"mousedown",(function(t){t.preventDefault();t.stopPropagation();e.hostElement.focus();e.hideTrigger&PopupTrigger.Blur&&e.hide()}))}setCss(this._bkDrop,{zIndex:Control._POPUP_ZINDEX,display:""});var t=this.hostElement;t.parentElement.insertBefore(this._bkDrop,t)};Popup.prototype._validateAndHide=function(e){var t=this.hostElement;if(t instanceof HTMLFormElement)t.reportValidity()&&this.hide(e);else{var i=this.hostElement.querySelector(":invalid");i?i.focus():this.hide(e)}};Popup.prototype._updateAriaLabel=function(){this.hostElement&&(this.ariaLabelledBy?this._updateAriaLabelImp(""):this._updateAriaLabelImp(this._ariaLabel))};Popup.prototype._updateAriaLabelImp=function(e){var t=[];this.isDraggable&&t.push(culture.Popup.ariaLabels.isDraggable);this.isResizable&&t.push(culture.Popup.ariaLabels.isResizable);this.isVisible?t.push(culture.Popup.ariaLabels.popupVisible):t.push(culture.Popup.ariaLabels.popupHide);var i=t.join(",");setAttribute(this.hostElement,"aria-label",e?e+" "+i:i)};Popup.prototype.dispose=function(){Popup._PopupInstanceCount--;0===Popup._PopupInstanceCount&&Popup._evtHover&&(Popup._evtHover=null);this._clearTimeouts();if(this._toHidePopupTimer){clearTimeout(this._toHidePopupTimer);this._toHidePopupTimer=null}if(this._toGetFocusTimer){clearTimeout(this._toGetFocusTimer);this._toGetFocusTimer=null}if(this._hideTimer){clearTimeout(this._hideTimer);this._hideTimer=null}this._hideAnim.forEach((function(e){return clearInterval(e)}));this._hideAnim=[];var t=this.hostElement;if(t)for(var i=t.querySelectorAll("."+DropDownClsNames.hostElement),n=0;n<i.length;n++){var o=Control.getControl(i[n]);o&&o instanceof DropDown&&o.dispose()}if(this._initialOwner){this._initialOwner.appendChild(this.hostElement);this._initialOwner=null}this.owner=null;if(this._bkDrop){this._bkDrop.remove();this._bkDrop=null}this._callback=null;e.prototype.dispose.call(this)};Popup._DRAG_THRESHOLD=6;Popup._SZ_EDGE=10;Popup._SZ_MIN=40;Popup._PopupInstanceCount=0;return Popup}(Control);export{Popup};var PopupBoundsChangingEventArgs=function(e){__extends(PopupBoundsChangingEventArgs,e);function PopupBoundsChangingEventArgs(t){var i=e.call(this)||this;i._rc=t;return i}Object.defineProperty(PopupBoundsChangingEventArgs.prototype,"bounds",{get:function(){return this._rc},enumerable:!0,configurable:!0});return PopupBoundsChangingEventArgs}(CancelEventArgs);export{PopupBoundsChangingEventArgs};_addCultureInfo("InputDate",{ariaLabels:{inputDateInput:"InputDate Input",inputDate:"Input Date",button:"Choose Date",dialog:"Calendar"}});var InputDateEventArgs=function(e){__extends(InputDateEventArgs,e);function InputDateEventArgs(t){var i=e.call(this)||this;i._isUserInput=t;return i}Object.defineProperty(InputDateEventArgs.prototype,"isUserInput",{get:function(){return this._isUserInput},enumerable:!0,configurable:!0});return InputDateEventArgs}(CancelEventArgs);export{InputDateEventArgs};var InputDate=function(e){__extends(InputDate,e);function InputDate(t,i){var n=e.call(this,t)||this;n._fmt=Globalize.DefaultDateFormat;n._sep=" - ";n._rngs=null;n._showCal=!1;n._clsOnSel=!0;n._handleWheel=!0;n._preserveCalendarNavigation=!0;n._isTriggered=!1;n._rangeChanged=!1;n._textInitialized=!1;n._previousText="";n._keepInvalidText=!1;n._inputAriaLabel=culture.InputDate.ariaLabels.inputDateInput;n._currentInput="";n._ariaLabelledby=null;n.valueChanged=new Event;n.rangeEndChanged=new Event;n.rangeChanged=new Event;addClass(n.hostElement,InputDateClsNames.hostElement);var o=culture.InputDate.ariaLabels;setAttribute(n._btn.querySelector("button"),"aria-haspopup","dialog");setAttribute(n._dropDown,"role","dialog");setAriaLabel(n._dropDown,o.dialog);setAttribute(n._dropDown,"aria-modal",!0);setAttribute(n._tbx,"role","combobox");setAttribute(n._tbx,"aria-haspopup","dialog");setAriaLabel(n._btn.querySelector("button"),o.button);n.dropDown.id=getUniqueId(n.hostElement.id+"_dropdown");n._msk=new _MaskProvider(n._tbx);var s=n.addEventListener.bind(n);isIE9()||(n.inputType="tel");n._tbx.type.match(/^(tel|text|)$/i)||(n.inputType="text");var r=n._mouseWheel.bind(n);s(n.hostElement,"wheel",r);var a=n._lbx=new ListBox(document.createElement("div"),{displayMemberPath:"name",selectedIndexChanged:function(e){var t=e.selectedItem,i=DateTime.fromDateTime,o=DateTime.sameDate;if(t&&t.from&&t.to){if(!o(t.from,n.value)||!o(t.to,n.rangeEnd)){var s=n.value;n.value=i(t.from,s);n.rangeEnd=i(t.to,s)}n._selectAll()}else n._cal.hostElement.style.display=""}}),l=n._cal=new Calendar(document.createElement("div")),h=n._dropDown;addClass(h,InputDateClsNames.inputDateDropDown);var u=document.createElement("div");addClass(u,InputDateClsNames.inputDateDropDownContainer);u.appendChild(a.hostElement);u.appendChild(l.hostElement);h.appendChild(u);n.addEventListener(h,"click",(function(){n._isTriggered=!0;setTimeout((function(){n._isTriggered=!1}),50)}),!0);n.addEventListener(h,"keydown",(function(e){if("Enter"===e.key){n._isTriggered=!0;setTimeout((function(){n._isTriggered=!1}),50)}}),!0);if("INPUT"==n._orgTag){var c=n._tbx.getAttribute("value");c&&(l.value=l.rangeEnd=Globalize.parseDate(c,"yyyy-MM-dd"))}n.isRequired=!0;n._tbx.value=n._oldText=n._getText();n.initialize(i);var p=isNullOrUndefined(n.tabOrder)?0:n.tabOrder;l.tabOrder=-1!==p&&n.showConfirmationButtons?p:-1;a.tabOrder=p;if(n._textInitialized||n._tbx.value!==n._oldText){n._oldText=n._tbx.value;n._currentInput="text";n._textInitialized=!0;n._commitText();n.onTextChanged()}n._updateState();l.valueChanged.addHandler((function(e,t){n._refreshText();n.onValueChanged(t)}));l.rangeEndChanged.addHandler((function(e,t){if(l._rngMode()){n.onRangeEndChanged(t);n._closeOnChange();l._clearingRangeEnd||n._refreshText()}}));l.cancelButtonClicked.addHandler((function(e,t){n.isDroppedDown=!1}));l.OKButtonClicked.addHandler((function(e,t){n._closeOnChange();n._refreshText()}));l._enterKeyDownToSetValue.addHandler((function(e,t){n._closeOnChange()}));l.addEventListener(l.hostElement,"click",(function(e){if(l.selectionMode&&!l._rngMode()){var t=e.target,i=l.hitTest(t);if(DateTime.sameDate(n.value,i)||closest(t,"[wj-part=btn-today]")){n._closeOnChange();n._refreshText()}}}));n._updateInputAriaLabel();return n}Object.defineProperty(InputDate,"controlTemplate",{get:function(){InputDate._ctrlTemplate||(InputDate._ctrlTemplate=DropDown.controlTemplate);return InputDate._ctrlTemplate},set:function(e){InputDate._ctrlTemplate=e},enumerable:!0,configurable:!0});InputDate.prototype._mouseWheel=function(e){if(this.handleWheel&&!e.defaultPrevented&&!this.isDroppedDown&&this.containsFocus()&&null!=this.value&&this._canChangeValue()){var t=this._tbx,i=t.selectionStart,n=t.selectionEnd,o=clamp(-e.deltaY,-1,1),s=this.value,r=Globalize.getFullFormat(this.format||Globalize.DefaultDateFormat);null==r&&(r=this.format);var a=r.match(getSpecialCharsRegex());if(n-i===t.value.length&&null!=a||this.selectionMode==DateSelectionMode.Range){for(var l=1;;l++){s=this.selectionMode==DateSelectionMode.Month?DateTime.addMonths(this.value,l*o):DateTime.addDays(this.value,l*o);if(this._isValidDate(s)||!(null===this.max||s<this.max)||!(null===this.min||s>this.min))break}this.value=s;var h=this._getText();setSelectionRange(t,0,h.length)}else this._updateDateTimeValue(o,a,r);e.preventDefault()}};Object.defineProperty(InputDate.prototype,"value",{get:function(){return this._cal.value},set:function(e){this._cal.value=e;(this.text||this.isRequired)&&this._refreshText()},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"rangeEnd",{get:function(){return this._cal.rangeEnd},set:function(e){this._cal.rangeEnd=e;(this.text||this.isRequired)&&this._refreshText()},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"rangeMin",{get:function(){return this._cal.rangeMin},set:function(e){this._cal.rangeMin=e},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"rangeMax",{get:function(){return this._cal.rangeMax},set:function(e){this._cal.rangeMax=e},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"keepInvalidText",{get:function(){return this._keepInvalidText},set:function(e){if(new Set(["InputDateTime","WjInputDateTime"]).has(this.constructor.name)){this._keepInvalidText=!1;throw"keepInvalidText property cannot be used with InputDateTime control"}this._keepInvalidText=e},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"text",{get:function(){return this._tbx.value},set:function(e){var t=(e||"").toString();if(t!=this.text){t!=this._tbx.value&&(this._tbx.value=t);if(t!=this._oldText){this._oldText=t;this._previousText=t}if(isEmpty(this._currentInput)){this._textInitialized=!0;this._currentInput="text";this._commitText()}this.onTextChanged();this._currentInput=""}},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"format",{get:function(){return this._fmt},set:function(e){if(e!=this.format){this._fmt=asString(e);this._refreshText()}},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"separator",{get:function(){return this._sep},set:function(e){if(e!=this._sep){this._sep=asString(e,!1);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"mask",{get:function(){return this._msk.mask},set:function(e){this._msk.mask=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"closeOnSelection",{get:function(){return this._clsOnSel},set:function(e){this._clsOnSel=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"handleWheel",{get:function(){return this._handleWheel},set:function(e){e=asBoolean(e);this._handleWheel=e;e||(this.calendar.handleWheel=e)},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"predefinedRanges",{get:function(){return this._rngs},set:function(e){if(this._rngs!=e){assert(null==e||isObject(e),"Object expected");this._rngs=e;this._lbx.itemsSource=this._getRanges(e);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"alwaysShowCalendar",{get:function(){return this._showCal},set:function(e){this._showCal=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"min",{get:function(){return this._cal.min},set:function(e){this._cal.min=asDate(e,!0)},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"max",{get:function(){return this._cal.max},set:function(e){this._cal.max=asDate(e,!0)},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"repeatButtons",{get:function(){return this._cal.repeatButtons},set:function(e){this._cal.repeatButtons=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"showYearPicker",{get:function(){return this._cal.showYearPicker},set:function(e){this._cal.showYearPicker=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"showMonthPicker",{get:function(){return this._cal.showMonthPicker},set:function(e){this._cal.showMonthPicker=e},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"showHeader",{get:function(){return this._cal.showHeader},set:function(e){this._cal.showHeader=e},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"weeksBefore",{get:function(){return this._cal.weeksBefore},set:function(e){this._cal.weeksBefore=e},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"weeksAfter",{get:function(){return this._cal.weeksAfter},set:function(e){this._cal.weeksAfter=e},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"selectionMode",{get:function(){return this._cal.selectionMode},set:function(e){if(e!=this.selectionMode){this._cal.selectionMode=e;this._refreshText()}},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"monthCount",{get:function(){return this._cal.monthCount},set:function(e){this._cal.monthCount=e},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"calendar",{get:function(){return this._cal},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"inputElement",{get:function(){return this._tbx},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"inputType",{get:function(){return this._tbx.type},set:function(e){e.match(/^(tel|text|)$/i)?this._tbx.type=asString(e):console.warn("invalid input type '"+e+"', don't use any input types other than 'tel' or 'text'")},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"preserveCalendarNavigation",{get:function(){return this._preserveCalendarNavigation},set:function(e){this._preserveCalendarNavigation=e},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"itemValidator",{get:function(){return this._cal.itemValidator},set:function(e){if(e!=this.itemValidator){this._cal.itemValidator=asFunction(e);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"itemFormatter",{get:function(){return this._cal.itemFormatter},set:function(e){this._cal.itemFormatter=asFunction(e)},enumerable:!0,configurable:!0});InputDate.prototype.onValueChanged=function(e){this.valueChanged.raise(this,e)};InputDate.prototype.onRangeEndChanged=function(e){this.rangeEndChanged.raise(this,e);this.rangeEnd&&(this.isDroppedDown?this._rangeChanged=!0:this.onRangeChanged(e))};InputDate.prototype.onRangeChanged=function(e){this._rangeChanged=!1;this.rangeChanged.raise(this,e)};InputDate.prototype._getParsedValue=function(){var e=this._tbx.value,t=this._fmt,i=(0,Globalize.parseDate)(e,t,this.value);if(i&&DateTime.sameDate(i,this._clamp(i)))return this._fromDateTime(i)};InputDate.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);if(this.hostElement){this._msk&&this._msk.refresh();this._cal&&this._cal.refresh();this._refreshText()}};InputDate.prototype.onIsDroppedDownChanging=function(t){if(this.isDroppedDown);else{var i=this._lbx,n=this._cal,o=i.collectionView,s=i.hostElement.style,r=n.hostElement.style;if(n._rngMode()&&hasItems(o)){var a=this._updateRangeSelection();s.display="";r.display=!this._showCal&&a&&a.from&&o.items.some((function(e){return!e.to}))?"none":""}else{s.display="none";r.display=""}n._mthMode()||(n.monthView=!0);n.value&&!this.preserveCalendarNavigation&&(n.displayMonth=n.value);this.showConfirmationButtons&&(n.focusValue=n.value)}return e.prototype.onIsDroppedDownChanging.call(this,t)};InputDate.prototype.onIsDroppedDownChanged=function(t){e.prototype.onIsDroppedDownChanged.call(this,t);var i=this.containsFocus();if(this.isDroppedDown){i&&(this._tryFocus(this._cal)||this._tryFocus(this._lbx)||this.dropDown.focus());this._lbx.showSelection();this._cal.refresh()}else{this._commitText();this._rangeChanged&&this.onRangeChanged()}};InputDate.prototype._updateDropDown=function(){this._commitText();var t=getComputedStyle(this.hostElement);this._dropDown.style.minWidth=18*parseFloat(t.fontSize)+"px";this._cal.refresh();e.prototype._updateDropDown.call(this)};InputDate.prototype.onGotFocus=function(e){var t=this._tbx;this._elRef==t&&(this.isDroppedDown?this.dropDown.focus():this.selectAll());this.containsFocus()||this.focus();this.gotFocus.raise(this,e)};InputDate.prototype._keydown=function(t){if(!(t.defaultPrevented||t.altKey||t.ctrlKey||t.metaKey)){this._isInvalidInputCancelled=!1;if(this._isHiddenEditor())return;var i=getActiveElement();switch(t.keyCode){case Key.Enter:if(this.showConfirmationButtons&&i!==this._tbx)return;this._currentInput="user";this._textInitialized=!1;this._commitText(!1,!0);break;case Key.Escape:this.text=this._getText();this.selectAll();break;case Key.Tab:if(this.showConfirmationButtons&&i!==this._tbx){var n=_getFocusableElements(this._dropDown).filter((function(e){return!(e.classList.contains("wj-control")&&e.classList.contains("wj-calendar"))})),o=n[0],s=n[n.length-1],r=n.indexOf(t.target),a=n[t.shiftKey?(r-1+n.length)%n.length:(r+1)%n.length],l=!1;a&&(l=this.calendar.isCalendarDateCell(a));if(l){t.preventDefault();this.calendar.focus();this.calendar.setFocusValueToFirstOrLastCalendar(!t.shiftKey)}else if(t.shiftKey){if(i===o){t.preventDefault();s.focus()}}else if(i===s){t.preventDefault();o.focus()}}else if(this.isDroppedDown){this.isDroppedDown=!1;this.containsFocus()||this.focus();this.keyActionTab===TabKeyAction.CloseAndKeepFocus&&t.preventDefault()}this._currentInput="user";this._textInitialized=!1;this._commitText(!0);break;case Key.Up:case Key.Down:if(t.keyCode===Key.Up&&this.keyActionUpArrow===KeyAction.OpenDropdown||t.keyCode===Key.Down&&this.keyActionDownArrow===KeyAction.OpenDropdown)break;if(!this.isDroppedDown&&this.value&&this._canChangeValue()){this._currentInput="user";this._textInitialized=!1;var h=this._tbx,u=h.selectionStart,c=h.selectionEnd,p=(h.value,t.keyCode==Key.Up?1:-1),d=this.value,m=Globalize.getFullFormat(this.format||Globalize.DefaultDateFormat);if("g"==this.format&&m.includes("г")){m=m.replace(/\"г.\" /,"")}null==m&&(m=this.format);var _=m.match(getSpecialCharsRegex());if(c-u===h.value.length&&null!=_||this.selectionMode==DateSelectionMode.Range){for(var f=1;;f++){d=this.selectionMode==DateSelectionMode.Month?DateTime.addMonths(this.value,f*p):DateTime.addDays(this.value,f*p);if(this._isValidDate(d)||!(null===this.max||d<this.max)||!(null===this.min||d>this.min))break}this.value=d;var b=this._getText();setSelectionRange(h,0,b.length)}else this._updateDateTimeValue(p,_,m);t.preventDefault()}}}e.prototype._keydown.call(this,t)};InputDate.prototype._expandSelection=function(){if(this._cal._rngMode()){var t=this._tbx,i=t.value,n=t.selectionStart,o=t.selectionEnd,s=this._sep,r=i.indexOf(s);r>-1&&n==o&&(o<=r?setSelectionRange(t,0,r):n>=r+s.length&&setSelectionRange(t,r+s.length,t.value.length))}else e.prototype._expandSelection.call(this)};InputDate.prototype._updateDateTimeValue=function(e,t,i){var n=this._tbx,o=n.selectionStart,s=n.value,r=this.value,a={},l={},h=0,u=0,c=0,p=[],d=[],m=n.value.match(getSpecialCharsRegex());if(null==t||null==m){p=[this.format];d=["0"];t=[""]}else{t.forEach((function(e,n){var o=e.replaceAll('"',""),r=i.substring(h),c=s.substring(u),p=r.indexOf(e),d=c.indexOf(o);if(-1==d){var _=m[n];d=c.indexOf(_)}var f=r.substring(0,p);if(""!=f){a[f]=h;l[f]=u}h=h+p+e.length;u=u+d+o.length;if(n==t.length-1){f=i.substring(h);a[f]=h;l[f]=u}}));p=Object.keys(a);d=Object.values(l)}var _=d.filter((function(e){return o>=parseInt(e.toString())}));_.length>0&&(c=_.length-1);for(var f=p[c],b=1;;b++){-1!=f.indexOf("d")?r=DateTime.addDays(this.value,b*e):-1!=f.indexOf("M")?r=DateTime.addMonths(this.value,b*e):-1!=f.indexOf("y")&&(r=DateTime.addYears(this.value,b*e));if(this._isValidDate(r)||!(null===this.max||r<this.max)||!(null===this.min||r>this.min))break}this.value=r;this._reselectText(t,c)};InputDate.prototype._reselectText=function(e,t){var i=this._getText(),n=this._tbx,o=0,s=-1,r=-1;if(1==e.length&&""==e[0]){s=0;r=i.length}else{var a=n.value.match(getSpecialCharsRegex());e.forEach((function(e,n){var l=e.replaceAll('"',""),h=i.substring(o);if(h.startsWith("г.")){h=h.replace("г. ","");o+="г. ".length}var u=h.indexOf(l);0==u&&t++;if(-1==u){var c=a[n];u=h.indexOf(c)}var p=-1===u?h:h.substring(0,u);n==t&&-1==s&&(r=(s=o)+p.length);o=o+u+l.length}))}if(-1==s){s=o;r=n.value.length}setSelectionRange(n,s,r)};InputDate.prototype._refreshText=function(){var e=this._getText();if(e!=this.text||e!==this._oldText){this._tbx.value=this._oldText=this._previousText=e;this.onTextChanged()}};InputDate.prototype._selectAll=function(){this.isDroppedDown||!this.containsFocus()||this.isTouching||this.selectAll()};InputDate.prototype._closeOnChange=function(){var e=this;if(this._clsOnSel&&this._isTriggered){var t=this._cal;(!t._rngMode()||t.value&&t.rangeEnd)&&setTimeout((function(){e._isInvalidInputCancelled=!1;e.isDroppedDown=!1}))}};InputDate.prototype._tryFocus=function(e){var t=e.hostElement;if(t&&t.offsetHeight){t.focus();return!0}return!1};InputDate.prototype._clamp=function(e){return this._cal._clamp(e)};InputDate.prototype._getText=function(){var e=Globalize.format,t=this._fmt,i=e(this.value,t);this._cal._rngMode()&&i&&(this.rightToLeft?i=e(this.rangeEnd,t)+this._sep+i:i+=this._sep+e(this.rangeEnd,t));return i};InputDate.prototype._commitText=function(e,t){var i=this._tbx.value;this._isInvalidInputCancelled=!1;if(isEmpty(this._currentInput)){this._textInitialized=!1;this._currentInput="user"}var n=!1,o=this._fmt,s=this._cal,r=Globalize.parseDate,a=new InputDateEventArgs(!this._textInitialized);if(i)if(s._rngMode()){var l=i.split(this._sep),h=this.rightToLeft?l[1]:l[0];if(2==l.length&&h){if(c=r(h,o,this.value)){var u=r(this.rightToLeft?l[0]:l[1],o,this.value);if(DateTime.sameDate(c,this._clamp(c)))n=!0;else if(this._shouldRaiseInvalidInput(t)&&this.onInvalidInput(a))this._textInitialized&&this._keepInvalidText||(n=!0);else{this._selectAll();n=!1}if(n)if(u){s.value=this._fromDateTime(c);if(DateTime.sameDate(u,this._clamp(u))){s.rangeEnd=u&&u>=c?this._fromDateTime(u):c;this.text=this._getText()}else this._triggerInvalidInputEvent(a,c,u,t)}else if(this._shouldRaiseInvalidInput(t)&&this.onInvalidInput(a)){if(!this._textInitialized||!this._keepInvalidText){s.value=this._fromDateTime(c);s.rangeEnd=c;this.text=this._getText()}}else{this._isInvalidInputCancelled=!0;this._selectAll()}}else this._nullValueInvalidInput(a,t)}else this._nullValueInvalidInput(a,t)}else{(c=r(i,o,this.value))?DateTime.sameDate(c,this._clamp(c))?this.value=this._fromDateTime(c):this._triggerInvalidInputEvent(a,c,null,t):this._nullValueInvalidInput(a,t)}else if(this.isRequired){var c;(c=r(i,o,this.value))?this.value=this._fromDateTime(c):this.containsFocus()||(this.text=this._getText())}else this.value=this.rangeEnd=null;this._currentInput="";e||this._selectAll()};InputDate.prototype._triggerInvalidInputEvent=function(e,t,i,n){if(this._shouldRaiseInvalidInput(n)&&this.onInvalidInput(e)){if(!this._textInitialized||!this._keepInvalidText){this.value=this._fromDateTime(t);this.calendar._rngMode()&&(this.calendar.rangeEnd=i&&i>=t?this._fromDateTime(i):t)}}else{this.isDroppedDown||!this.containsFocus()||this.isTouching||this.focus();this._isInvalidInputCancelled=!0;this._selectAll()}};InputDate.prototype._nullValueInvalidInput=function(e,t){if(this._shouldRaiseInvalidInput(t)&&this.onInvalidInput(e))this._textInitialized&&this._keepInvalidText||(this.text=this._getText());else{this.isDroppedDown||!this.containsFocus()||this.isTouching||this.focus();this._isInvalidInputCancelled=!0;this._selectAll()}};InputDate.prototype._fromDateTime=function(e){return DateTime.fromDateTime(e,this.value)};InputDate.prototype._canChangeValue=function(){return!this.isReadOnly&&!this.isDisabled&&this.selectionMode!=DateSelectionMode.None};InputDate.prototype._isValidDate=function(e){if(e){if(this._clamp(e)!=e)return!1;if(this.itemValidator&&!this.itemValidator(e))return!1}return!0};InputDate.prototype._getRanges=function(e){var t=[];if(isObject(e))for(var i in e){var n=e[i];t.push({name:i,from:n?n[0]:null,to:n?n[1]:null})}return new CollectionView(t,{currentItem:null})};InputDate.prototype._updateRangeSelection=function(){var e=this._lbx,t=-1;if(hasItems(e.collectionView))for(var i=this._lbx.collectionView.items,n=DateTime.sameDate,o=0;o<i.length;o++){var s=i[o];if(s.from){if(n(s.from,this.value)&&n(s.to,this.rangeEnd)){t=o;break}}else t=o}e.selectedIndex=t;return e.selectedItem};InputDate.prototype._copy=function(e,t){if("text"===e){var i=(t||"").toString();if(i!==this.text){this._tbx.value=i;this._textInitialized=!0}return!0}return!1};Object.defineProperty(InputDate.prototype,"showConfirmationButtons",{get:function(){return this._showConfirmationButtons},set:function(e){this._showConfirmationButtons=e;this._cal.focusMode=e;this._cal.showConfirmationButtons=e;this._cal.updateConfirmationButtons(this.dropDown);var t=isNullOrUndefined(this.tabOrder)?0:this.tabOrder;this._cal.tabOrder=e?t:-1;this._cal.keyActionTab=e?CalendarTabKeyAction.All:CalendarTabKeyAction.None},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"ariaLabelledBy",{get:function(){return this._ariaLabelledby},set:function(e){_setAriaLabelBy(this,this._tbx,e,this._updateInputAriaLabel.bind(this))},enumerable:!0,configurable:!0});InputDate.prototype._updateInputAriaLabel=function(){this._tbx&&(this._tbx.id||this.ariaLabelledBy?setAriaLabel(this._tbx,null):setAriaLabel(this._tbx,this._inputAriaLabel))};InputDate.prototype.getAriaLabelForScreenReader=function(){return culture.InputDate.ariaLabels.inputDate};InputDate._ctrlTemplate="";return InputDate}(DropDown);export{InputDate};_addCultureInfo("InputDateRange",{ariaLabels:{inputDateRangeInput:"InputDateRange Input"}});var InputDateRange=function(e){__extends(InputDateRange,e);function InputDateRange(t,i){var n=e.call(this,t,__assign({selectionMode:DateSelectionMode.Range,showMonthPicker:"Outside",monthCount:2},getInputDateOptions(i)))||this;n._inputAriaLabel=culture.InputDateRange.ariaLabels.inputDateRangeInput;addClass(n.hostElement,InputDateRangeClsNames.hostElement);n._tbx.value=n._oldText=n._getText();n.initialize(i);if(n._tbx.value!==n._oldText){n._oldText=n._tbx.value;n._currentInput="text";n._commitText()}n._updateInputAriaLabel();return n}Object.defineProperty(InputDateRange,"controlTemplate",{get:function(){InputDateRange._ctrlTemplate||(InputDateRange._ctrlTemplate=InputDate.controlTemplate);return InputDateRange._ctrlTemplate},set:function(e){InputDateRange._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(InputDateRange.prototype,"selectionMode",{get:function(){return this.calendar.selectionMode},set:function(e){e=asEnum(e,DateSelectionMode);assert(e==DateSelectionMode.Range,'InputDateRange.selectionMode must be "Range"');this.calendar.selectionMode=e},enumerable:!0,configurable:!0});InputDateRange.prototype._mouseWheel=function(e){if(!e.defaultPrevented&&!this.isDroppedDown&&this.containsFocus()&&null!=this.value&&this._canChangeValue()){var t=clamp(-e.deltaY,-1,1),i=this.value;this.value=this.selectionMode==DateSelectionMode.Month?DateTime.addMonths(i,t):DateTime.addDays(i,t);this.selectAll();e.preventDefault()}};InputDateRange.prototype.onGotFocus=function(e){var t=this._tbx;this._elRef!=t||this.isDroppedDown||this.selectAll();this.containsFocus()||this.focus();this.gotFocus.raise(this,e)};InputDateRange.prototype._keydown=function(t){if(!(t.defaultPrevented||t.altKey||t.ctrlKey||t.metaKey)){this._isInvalidInputCancelled=!1;if(this._isHiddenEditor())return;switch(t.keyCode){case Key.Up:case Key.Down:if(t.keyCode===Key.Up&&this.keyActionUpArrow===KeyAction.OpenDropdown||t.keyCode===Key.Down&&this.keyActionDownArrow===KeyAction.OpenDropdown)break;if(!this.isDroppedDown&&this.value&&this._canChangeValue()){var i=t.keyCode==Key.Up?1:-1,n=this.selectionMode==DateSelectionMode.Month?DateTime.addMonths(this.value,i):DateTime.addDays(this.value,i);this.value=this._fromDateTime(n);this.selectAll();t.preventDefault()}}}e.prototype._keydown.call(this,t)};InputDateRange._ctrlTemplate="";return InputDateRange}(InputDate);export{InputDateRange};function getInputDateOptions(e){var t={};if(!isNullOrUndefined(e)){isNullOrUndefined(e.showConfirmationButtons)||(t.showConfirmationButtons=e.showConfirmationButtons);isNullOrUndefined(e.tabOrder)||(t.tabOrder=e.tabOrder)}return t}_addCultureInfo("InputColor",{ariaLabels:{inputColor:"Input Color",inputColorInput:"InputColor Input",button:"Choose Color",dialog:"ColorPicker"}});var InputColor=function(e){__extends(InputColor,e);function InputColor(t,i){var n=e.call(this,t)||this;n._textInitialized=!1;n._ariaLabelledby=null;n._inputAriaLabel=culture.InputColor.ariaLabels.inputColorInput;n.valueChanged=new Event;addClass(n.hostElement,InputColorClsNames.hostElement);setAttribute(n._dropDown,"role","dialog");setAriaLabel(n._dropDown,culture.InputColor.ariaLabels.dialog);setAttribute(n._dropDown,"aria-modal",!0);setAttribute(n._tbx,"role","combobox");setAttribute(n._tbx,"aria-haspopup","dialog");setAttribute(n._btn.querySelector("button"),"aria-haspopup","dialog");setAriaLabel(n._btn.querySelector("button"),culture.InputColor.ariaLabels.button);n.dropDown.id=getUniqueId(n.hostElement.id+"_dropdown");var o='<div class="'+InputColorClsNames.inputColorBox+'"></div>';n._ePreview=createElement(o,n.hostElement.firstElementChild);if("INPUT"==n._orgTag){n._tbx.type="";n._commitText()}n.value="#ffffff";n.isRequired=!0;n._tbx.value=n._oldText=n.value;n.initialize(i);if(n._textInitialized&&n._tbx.value!==n._oldText){n._oldText=n._tbx.value;n.onTextChanged();n._commitText();n._textInitialized=!1}n.addEventListener(n._colorPicker.hostElement,"click",(function(e){var t=e.target;if(t&&"DIV"==t.tagName&&(closest(t,'[wj-part="div-pal"]')||closest(t,'[wj-part="div-pv"]'))){t.style.backgroundColor&&(n.isDroppedDown=!1)}}));var s=!i||-1!==i.tabOrder&&i.colorPickerKeyActionTab!==ColorPickerTabKeyAction.None?0:-1;n._colorPicker.tabOrder=s;n._updateInputAriaLabel();return n}Object.defineProperty(InputColor,"controlTemplate",{get:function(){InputColor._ctrlTemplate||(InputColor._ctrlTemplate=DropDown.controlTemplate);return InputColor._ctrlTemplate},set:function(e){InputColor._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(InputColor.prototype,"value",{get:function(){return this._value},set:function(e){this.text=e},enumerable:!0,configurable:!0});Object.defineProperty(InputColor.prototype,"text",{get:function(){return this._tbx.value},set:function(e){if((e=asString(e))!=this.text&&(e||!this.isRequired)&&(!e||Color.fromString(e.replace(/\s+/g,"")))){this._setText(e,!0);this._commitText()}},enumerable:!0,configurable:!0});Object.defineProperty(InputColor.prototype,"inputType",{get:function(){return this._tbx.type},set:function(e){e.match(/^(tel|text|)$/i)?this._tbx.type=asString(e):console.warn("invalid input type '"+e+"', don't use any input types other than 'tel' or 'text'")},enumerable:!0,configurable:!0});Object.defineProperty(InputColor.prototype,"showAlphaChannel",{get:function(){return this._colorPicker.showAlphaChannel},set:function(e){this._colorPicker.showAlphaChannel=e},enumerable:!0,configurable:!0});Object.defineProperty(InputColor.prototype,"showColorString",{get:function(){return this._colorPicker.showColorString},set:function(e){this._colorPicker.showColorString=e},enumerable:!0,configurable:!0});Object.defineProperty(InputColor.prototype,"palette",{get:function(){return this._colorPicker.palette},set:function(e){this._colorPicker.palette=e},enumerable:!0,configurable:!0});Object.defineProperty(InputColor.prototype,"colorPicker",{get:function(){return this._colorPicker},enumerable:!0,configurable:!0});Object.defineProperty(InputColor.prototype,"ariaLabelledBy",{get:function(){return this._ariaLabelledby},set:function(e){_setAriaLabelBy(this,this._tbx,e,this._updateInputAriaLabel.bind(this))},enumerable:!0,configurable:!0});Object.defineProperty(InputColor.prototype,"colorPickerKeyActionTab",{get:function(){return this.colorPicker.keyActionTab},set:function(e){this.colorPicker.keyActionTab=e},enumerable:!0,configurable:!0});InputColor.prototype.onValueChanged=function(e){this.valueChanged.raise(this,e)};InputColor.prototype.onIsDroppedDownChanged=function(t){e.prototype.onIsDroppedDownChanged.call(this,t);if(this.isDroppedDown&&!this.isTouching){this.colorPicker._refreshSelection();var i=this._tbx;this._elRef==i&&setSelectionRange(i,0,this.text.length,!1);this.containsFocus()||this.focus()}};InputColor.prototype._createDropDown=function(){var e=this;this._colorPicker=new ColorPicker(this._dropDown);setCss(this._dropDown,{minWidth:420,minHeight:200});this._colorPicker.valueChanged.addHandler((function(){e.value=e._colorPicker.value}))};InputColor.prototype._keydown=function(t){if(!t.defaultPrevented)switch(t.keyCode){case Key.Enter:this._commitText();this.selectAll();break;case Key.Escape:this.text=this.value;this.selectAll();break;case Key.Tab:var i=getActiveElement();if(this.colorPicker.keyActionTab===ColorPickerTabKeyAction.All&&i!==this._tbx){var n=_getFocusableElements(this.colorPicker.hostElement),o=n[0],s=n[n.length-1];if(t.shiftKey){if(i===o){t.preventDefault();s.focus()}}else if(i===s){t.preventDefault();o.focus()}}else if(this.isDroppedDown){this.isDroppedDown=!1;this.containsFocus()||this.focus();this.keyActionTab===TabKeyAction.CloseAndKeepFocus&&t.preventDefault()}}e.prototype._keydown.call(this,t)};InputColor.prototype._commitText=function(){if(this._value!=this.text){var e=!this.text||!this.text.trim();if(!this.isRequired&&e){this._changeAllValue();this._ePreview.style.backgroundColor="";return}if(Color.fromString(this.text.replace(/\s+/g,""))){if(this.text&&this.text!==this.text.replace(/\s+/g,"")){this.text=this.text.replace(/\s+/g,"");return}this._changeAllValue()}else this.onInvalidInput(new CancelEventArgs)&&(this.text=this._value?this._value:"")}};InputColor.prototype._changeAllValue=function(){var e=this._colorPicker;e.value=this.text;this._value=e.value;this._ePreview.style.backgroundColor=this.value;this.onValueChanged()};InputColor.prototype._copy=function(e,t){if("text"===e){var i=(t||"").toString();if(i!==this.text){this._tbx.value=i;this._textInitialized=!0}return!0}return!1};InputColor.prototype.getAriaLabelForScreenReader=function(){return culture.InputColor.ariaLabels.inputColor};InputColor.prototype._updateInputAriaLabel=function(){this._tbx&&(this._tbx.id||this.ariaLabelledBy?setAriaLabel(this._tbx,null):setAriaLabel(this._tbx,this._inputAriaLabel))};InputColor._ctrlTemplate="";return InputColor}(DropDown);export{InputColor};_addCultureInfo("ComboBox",{ariaLabels:{comboBoxInput:"ComboBox Input",comboBox:"Combo Box"}});var ComboBox=function(e){__extends(ComboBox,e);function ComboBox(t,i){var n=e.call(this,t)||this;n._editable=!1;n._trimText=!0;n._handleWheel=!0;n._delKey=0;n._draggingText=!1;n._textIsComposing="";n._pathHdr=new Binding(null);n._bsCollapse=!0;n._fmtItemHandlers=0;n._emptyValueAction=!1;n._oldIndexToBeRestoredOnBlur=null;n._restoreComboboxTbxVal=!1;n._isWheel=!1;n._selItems=null;n._oldFilter=null;n._keyActionPrintCharacters=KeyAction.OpenDropdown;n._inputElementAriaLabel=culture.ComboBox.ariaLabels.comboBoxInput;n._ariaLabelledby=null;n.itemsSourceChanged=new Event;n.selectedIndexChanged=new Event;var o=n.hostElement;addClass(o,ComboBoxClsNames.hostElement);n.dropDown.id=getUniqueId(o.id+"_dropdown");n.autoExpandSelection=!1;var s=n._tbx;n.addEventListener(s,"compositionstart",(function(){n._composing=!0}));n.addEventListener(s,"compositionend",(function(){n._textIsComposing=n.text;n._composing=!1;n._setText(n._textIsComposing,!0);if(!n._textIsComposing&&n.isRequired){n._oldText="";n._oldIndexToBeRestoredOnBlur=null}setTimeout((function(){n._textIsComposing=""}))}));n.addEventListener(s,"drag",(function(){n._draggingText=!0}));n.addEventListener(o,"wheel",n._wheel.bind(n));"SELECT"==n._orgTag&&n._lbx._initFromSelect(o);var r=n._lbx;r.loadedItems.addHandler((function(e){n.selectedIndex>-1&&(n.selectedIndex=r.selectedIndex)}));r.tabOrder=-1;n.isRequired=!0;n.initialize(i);n._updateTbxAriaHaspopup();n._updateInputAriaLabel();return n}Object.defineProperty(ComboBox,"controlTemplate",{get:function(){ComboBox._ctrlTemplate||(ComboBox._ctrlTemplate=DropDown.controlTemplate);return ComboBox._ctrlTemplate},set:function(e){ComboBox._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"itemsSource",{get:function(){return this._lbx.itemsSource},set:function(e){if(this._lbx.itemsSource!=e){this._lbx.itemsSource=e;this.onItemsSourceChanged()}this._updateBtn()},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"collectionView",{get:function(){return this._lbx.collectionView},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"virtualizationThreshold",{get:function(){return this._lbx.virtualizationThreshold},set:function(e){this._lbx.virtualizationThreshold=e},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"showGroups",{get:function(){return this._lbx.showGroups},set:function(e){this._lbx.showGroups=e},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"displayMemberPath",{get:function(){return this._lbx.displayMemberPath},set:function(e){if(this.displayMemberPath!==e){this._lbx.displayMemberPath=e;var t=this._getDisplayText(void 0,void 0,!0);this.text!=t&&this._setText(t,!0)}},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"headerPath",{get:function(){return this._pathHdr.path},set:function(e){this._pathHdr.path=asString(e);var t=this._getDisplayText(void 0,void 0,!0);this.text!=t&&this._setText(t,!0)},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"selectedValuePath",{get:function(){return this._lbx.selectedValuePath},set:function(e){this._lbx.selectedValuePath=e},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"isContentHtml",{get:function(){return this._lbx.isContentHtml},set:function(e){if(e!=this.isContentHtml){this._lbx.isContentHtml=asBoolean(e);var t=this._getDisplayText(void 0,void 0,!0);this.text!=t&&this._setText(t,!0)}},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"caseSensitiveSearch",{get:function(){return this._lbx.caseSensitiveSearch},set:function(e){this._lbx.caseSensitiveSearch=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"trimText",{get:function(){return this._trimText},set:function(e){if(e!=this._trimText){this._trimText=asBoolean(e);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"itemFormatter",{get:function(){return this._lbx.itemFormatter},set:function(e){this._lbx.itemFormatter=asFunction(e);this.selectedIndex=this._lbx.selectedIndex},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"formatItem",{get:function(){return this._lbx.formatItem},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"selectedIndex",{get:function(){return this._lbx.selectedIndex},set:function(e){e!=this.selectedIndex&&isNumber(e)&&(this._lbx.selectedIndex=e);var t=this._lbx._oldSelectedIndex!=this.selectedIndex;e=this.selectedIndex;var i=this._getDisplayText(e,void 0,!0);if(this.text!=i||t){var n=this._internalSettingText;this._internalSettingText=this._lbx._ignoredItemChangedEvents;this._setText(i,!0);""!=this.text&&(this._emptyValueAction=!1);this._internalSettingText=n}},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"selectedItem",{get:function(){return this._lbx.selectedItem},set:function(e){this._lbx.selectedItem=e},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"selectedValue",{get:function(){return this.collectionView?this._lbx.selectedValue:this.text},set:function(e){this.collectionView?this._lbx.selectedValue=e:null!=e&&(this.text=e.toString())},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"isEditable",{get:function(){return this._editable},set:function(e){this._editable=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"handleWheel",{get:function(){return this._handleWheel},set:function(e){this._handleWheel=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"maxDropDownHeight",{get:function(){return this._lbx.maxHeight},set:function(e){this._lbx.maxHeight=e},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"maxDropDownWidth",{get:function(){var e=this._dropDown,t=e?parseInt(e.style.maxWidth):null;return isNaN(t)?null:t},set:function(e){var t=this._dropDown.style;e=asNumber(e,!0);t.maxWidth=null==e?"":e+"px";t.minWidth=""},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"keyActionPrintCharacters",{get:function(){return this._keyActionPrintCharacters},set:function(e){this._keyActionPrintCharacters=asEnum(e,KeyAction)},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"ariaLabelledBy",{get:function(){return this._ariaLabelledby},set:function(e){_setAriaLabelBy(this,this._tbx,e,this._updateInputAndListBoxAriaLabel.bind(this))},enumerable:!0,configurable:!0});ComboBox.prototype._updateInputAndListBoxAriaLabel=function(){this._updateInputAriaLabel()};ComboBox.prototype.getDisplayText=function(e,t){void 0===e&&(e=this.selectedIndex);void 0===t&&(t=this._trimText);return this._getDisplayText(e,t)};ComboBox.prototype._getDisplayText=function(e,t,i){void 0===e&&(e=this.selectedIndex);void 0===t&&(t=this._trimText);var n,o=this.collectionView;if(this.headerPath&&e>-1&&hasItems(o)){var s=o.items[e];n=null!=(n=s?this._pathHdr.getValue(s):null)?n.toString():"";this.isContentHtml&&(n=toPlainText(n))}else n=this._lbx._getDisplayText(e,i&&void 0!==this.itemFormatter&&!this._hasCustomFormatItem());return t?n.trim():n};ComboBox.prototype._hasCustomFormatItem=function(){return this.formatItem.hasHandlers};ComboBox.prototype.indexOf=function(e,t,i){void 0===i&&(i=!1);var n=this.collectionView,o=this.caseSensitiveSearch;if(hasItems(n)&&null!=e){e=e.toString();o||(e=e.toLowerCase());if(this._trimText&&!i){-1!==this.indexOf(e,!1,!0)||(e=e.trim())}var s=this.selectedIndex,r=this._getDisplayText(s,void 0,!0);if(t){o||(r=r.toLowerCase());if(e==r)return s}else if(!e&&""==r)return s;for(var a=0;a<n.items.length;a++)if(this._lbx.isItemEnabled(a)){r=this._getDisplayText(a,void 0,!0);this.trimText&&(r=r.trim());o||(r=r.toLowerCase());if(t){if(r==e&&!1===this._emptyValueAction)return a}else if(e&&0==r.indexOf(e)||!e&&""==r&&!1===this._emptyValueAction)return a}}return-1};Object.defineProperty(ComboBox.prototype,"listBox",{get:function(){return this._lbx},enumerable:!0,configurable:!0});ComboBox.prototype.onItemsSourceChanged=function(e){this.itemsSourceChanged.raise(this,e)};ComboBox.prototype.onSelectedIndexChanged=function(e){this._updateBtn();this.selectedIndexChanged.raise(this,e)};ComboBox.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);if(this.hostElement&&hasItems(this.collectionView)){this._lbx.refresh();this.selectedIndex>-1&&(this.selectedIndex=this._lbx.selectedIndex)}};ComboBox.prototype.onLostFocus=function(t,i,n){this._trimText&&(this.text=this.text.trim());if(this._composing){this._composing=!1;if(!this.text&&this.isRequired){this._oldText="";this._oldIndexToBeRestoredOnBlur=null}this._setText(this.text,!0)}if((!this.text&&this.isRequired&&!(Array.isArray(this._selItems)&&this._selItems.length>0)||n)&&hasItems(this.collectionView)&&!(this.isRequired&&!this.isEditable&&this.text&&this.indexOf(this.text,!1)>-1&&this.indexOf(this.text,!0)<0)){void 0!==i&&(this.selectedIndex=-1!==i?i:0);null!==this._oldIndexToBeRestoredOnBlur?this.selectedIndex=-1!==this._oldIndexToBeRestoredOnBlur?this._oldIndexToBeRestoredOnBlur:0:null==this.collectionView.currentItem&&(this.selectedIndex=0)}var o=this.text,s=this.collectionView?this.collectionView.items.length:0,r=this.selectedIndex;e.prototype.onLostFocus.call(this,t);var a=this.collectionView?this.collectionView.items.length:0,l=this.selectedIndex,h=this.text,u=this._oldFilter;this._oldFilter=null;if(r===l&&o===h){u&&(this.collectionView.filter=u);this._trySelectionUpdateOnItemsSourceChanged(a!==s,o)}};ComboBox.prototype.onIsDroppedDownChanging=function(t){if(!this.isDroppedDown&&!this._hasItems()){t.cancel=!0;return!1}return e.prototype.onIsDroppedDownChanging.call(this,t)};ComboBox.prototype.onIsDroppedDownChanged=function(t){e.prototype.onIsDroppedDownChanged.call(this,t);if(this.isDroppedDown){this._fmtItemHandlers=this.formatItem.handlerCount;this._lbx.showSelection()}this._updateTbxAria()};ComboBox.prototype._trySelectionUpdateOnItemsSourceChanged=function(e,t){if(e&&t){var i=this.indexOf(t,!0);i<0&&(i=this.indexOf(t,!1));this.selectedIndex=i}};ComboBox.prototype._setIsDisabled=function(t){e.prototype._setIsDisabled.call(this,t);this._updateBtn()};ComboBox.prototype._updateBtn=function(){var t=this.collectionView,i=this._tbx,n=this._hasItems();e.prototype._updateBtn.call(this);this._btn.style.display=this._showBtn&&null!=t?"":"none";enable(this._btn,n&&!this.isDisabled);setAttribute(i,"role",n?"combobox":null);setAttribute(i,"aria-autocomplete",n?"both":null);this._updateTbxAria()};ComboBox.prototype._hasItems=function(){return hasItems(this.collectionView)};ComboBox.prototype._updateTbxAria=function(){e.prototype._updateTbxAria.call(this);var t=this._tbx,i=this.isDroppedDown,n=this.dropDown?this.dropDown.id:null,o=n&&hasItems(this.collectionView),s=this._lbx,r=s.selectedIndex,a=s.hostElement?s.hostElement.children:null,l=s._getElementIndex(r),h=l>-1&&a&&l<a.length?a[l].id:null;setAttribute(t,"aria-controls",o&&i?n:null);setAttribute(t,"aria-expanded",o?i:null);setAttribute(t,"aria-activedescendant",this.isDroppedDown&&h&&h.length?h:null)};ComboBox.prototype._updateInputAriaLabel=function(){var e=this._tbx;e&&(e.id||this._ariaLabelledby?setAttribute(e,"aria-label",null):setAttribute(e,"aria-label",this._inputElementAriaLabel))};ComboBox.prototype._createDropDown=function(){var e=this;if(!this._lbx){this._lbx=new ListBox(this._dropDown);this._lbx._container=this.hostElement}this._lbx.maxHeight=200;this._lbx.selectedIndexChanged.addHandler((function(){e._updateBtn();var t=e._lbx.selectedIndex;e.selectedIndex=t;e.onSelectedIndexChanged()}));this._lbx.itemsChanged.addHandler((function(){e._updateBtn()}))};ComboBox.prototype._wheel=function(e){this._isWheel=!0;if(this.handleWheel&&!e.defaultPrevented&&!this.isDroppedDown&&!this.isReadOnly&&this.containsFocus()&&this.selectedIndex>-1){var t=this._findNext("",e.deltaY>0?1:-1);t>-1&&(this.selectedIndex=t);e.preventDefault()}this._isWheel=!1};ComboBox.prototype._dropDownClick=function(t){t.defaultPrevented||t.target!=this._dropDown&&(this.isDroppedDown=!1);this._restoreComboboxTbxVal&&(this._tbx.value=this._getDisplayText(this.selectedIndex,void 0,!0));e.prototype._dropDownClick.call(this,t)};ComboBox.prototype._setText=function(t,i,n){void 0===n&&(n=!1);if(!this._composing&&!this._settingText){this._settingText=!0;if(this.containsFocus()){var o=this.formatItem.handlerCount;if(this._fmtItemHandlers!=o){this._fmtItemHandlers=o;this._lbx.loadList()}}t=[null,void 0,NaN].includes(t)?"":t.toString();var s=this.selectedIndex,r=this.collectionView,a=this._getSelStart(),l=-1,h=!0;if(this.isEditable&&(this._delKey||this._getSelEnd()<t.length||!this.containsFocus())){i=!0;h=!1}s=this.indexOf(t,i);if(h){s<0&&i&&(s=this.indexOf(t,!1));s<0&&a>0&&!n&&(s=this.indexOf(t.substr(0,a),!1));if(!i){var u=this.indexOf(t,!0);u>-1&&s>-1&&u!=s&&(s=u)}}s<0&&this._delKey&&(s=this.indexOf(t,i));if(s<0&&!this.isEditable&&hasItems(r)&&(t&&this.isRequired||this.containsFocus()&&(t||this.isRequired))){var c=this._oldText||"";s=Math.max(0,this.indexOf(c,!1));a=0;for(var p=0;p<t.length&&p<c.length;p++)if(t[p]!=c[p]){a=p;break}}if((!this._delKey||!this.isEditable||this._delKey&&this.isEditable&&t==this._getDisplayText(s,void 0,!0))&&(!this._pristine||this._pristine&&!this.isEditable)||this._isWheel||this._delKey&&""==t&&s>-1){if(s>-1){l=a;t=this._getDisplayText(s,void 0,!0)}var d=this._tbx;t!=d.value&&(d.value=t);l>-1&&this.containsFocus()&&!this.isTouching&&this._updateInputSelection(l)}if(r){if(!t||this.trimText&&""==t.trim()&&!this.containsFocus()&&this.isEditable)if(s>-1)this._oldIndexToBeRestoredOnBlur=s;else{this._oldIndexToBeRestoredOnBlur=this.indexOf(this._oldText,!0);this._oldIndexToBeRestoredOnBlur=this._oldIndexToBeRestoredOnBlur<0?this.indexOf(this._oldText,!1):this._oldIndexToBeRestoredOnBlur}this._restoreComboboxTbxVal=t&&s>-1;r.moveCurrentToPosition(s)}this.containsFocus()||this.isEditable||this.isRequired||t!=t.trim()||!this.trimText||(this._tbx.value=this._getDisplayText(s,this.trimText,!0));!this.containsFocus()&&s>-1&&this.isEditable&&(t=this._getDisplayText(s,this.trimText,!0));!this.containsFocus()&&this._hasItems()&&s<0&&!this.isEditable&&!this.isRequired&&(t="");var m=!1;!t&&s<0&&this.isRequired&&!this.containsFocus()&&(m=!0);this.trimText&&!this.containsFocus()&&this.isEditable&&(this.isRequired&&""==t.trim()?m=!0:t=t.trim());if(m){this.selectedIndex=this._oldIndexToBeRestoredOnBlur;this.selectedIndex<0&&(this.selectedIndex=0)}var _=!this.containsFocus()&&!this.isEditable&&this.trimText;_&&(this._tbx.value=this._getDisplayText(s,!0,!0));this._delKey=0;this._settingText=!1;e.prototype._setText.call(this,m?this._getDisplayText(this.selectedIndex,void 0,!0):t,i,m,_)}};ComboBox.prototype._findNext=function(e,t,i){void 0===i&&(i=this.selectedIndex);var n=this.collectionView,o=n?n.items.length:0,s=this._lbx,r=this.caseSensitiveSearch;if(n&&o&&t){r||(e=e.toLowerCase());this.trimText&&(e=e.trim());for(var a=i+t;a>-1&&a<o;a+=t){var l=this._getDisplayText(a,void 0,!0);r||(l=l.toLowerCase());if(0==l.indexOf(e)){if(!this.dropDown.children[a]||s.isItemEnabled(a))return a}}}return i};ComboBox.prototype._findNextWhenIsEditableFalse=function(e,t,i){void 0===i&&(i=this.selectedIndex);var n=this._findNext(e,t,i);return n!==i?n:-1};ComboBox.prototype._keydown=function(t){e.prototype._keydown.call(this,t);if(!t.defaultPrevented&&!this.isReadOnly&&!t.altKey&&hasItems(this.collectionView)&&this._elRef==this._tbx&&!this._isHiddenEditor()){this._delKey=0;var i=this._getSelStart(),n=this._getSelEnd();switch(t.keyCode){case Key.Tab:if(this.isDroppedDown){this.isDroppedDown=!1;this.keyActionTab===TabKeyAction.CloseAndKeepFocus&&t.preventDefault()}break;case Key.Back:case Key.Delete:case 88:if(!t.ctrlKey&&!t.metaKey&&88==t.keyCode)break;if(this._bsCollapse&&!this.isEditable&&i>0&&n==this._tbx.value.length&&hasItems(this.collectionView)){this._setSelRange(i-1,n);i-=1}this._delKey=t.keyCode;break;case Key.Up:case Key.Down:i==this.text.length&&(i=0);this.selectedIndex=this._findNext(this.text.substr(0,i),t.keyCode==Key.Up?-1:1);this._setSelRange(i,this.text.length);t.preventDefault();break;case Key.PageUp:this._lbx._selectPrevPage();this.selectAll();t.preventDefault();break;case Key.PageDown:this._lbx._selectNextPage();this.selectAll();t.preventDefault();break;case Key.Home:case Key.End:var o=this._tbx;setAttribute(o,"aria-activedescendant",null)}this.text.length>0&&["Backspace","Delete","x"].includes(t.key)&&0===i&&n===this.text.length||this._delKey&&1===this.text.length?this._emptyValueAction=!0:this._composing||(this._emptyValueAction=!1)}};ComboBox.prototype._afterOpenDropdownByDownArrow=function(){if(-1===this.selectedIndex){this.selectedIndex=0;this.selectAll()}};ComboBox.prototype._input=function(e){this._handleDragTextState();this._updateDropDownWhenInput();this._updateComponentText();this._updateEmptyValueFlag();this._resetDragState()};ComboBox.prototype._handleDragTextState=function(){this._draggingText&&(this._emptyValueAction=""===this.text)};ComboBox.prototype._shouldOpenDropdown=function(){return this.keyActionPrintCharacters===KeyAction.OpenDropdown};ComboBox.prototype._handleIsEditableFalseInput=function(){var e=this.text,t=this.text.length,i=this._findNextWhenIsEditableFalse(e,1,this.selectedIndex-1);if(-1===i&&-1===(i=this._findNextWhenIsEditableFalse(e,1,-1))){var n=e[e.length-1];t=1;-1===(i=this._findNextWhenIsEditableFalse(n,1))&&(i=this._findNextWhenIsEditableFalse(n,1,-1))}-1!==i?this._updateSelection(i,t):this._updateComponentText()};ComboBox.prototype._updateSelection=function(e,t){this._tbx.value=this._getDisplayText(e,void 0,!0);this._updateInputSelection(t);var i=this.collectionView;i&&i.moveCurrentToPosition(e)};ComboBox.prototype._updateComponentText=function(){var e=this._textIsComposing||this.text;this._setText(e,!1)};ComboBox.prototype._updateEmptyValueFlag=function(){this.text&&(this._emptyValueAction=!1)};ComboBox.prototype._controlDropdownVisibility=function(){this.text&&!this.isDroppedDown&&(this.isDroppedDown=!0)};ComboBox.prototype._resetDragState=function(){this._draggingText=!1};ComboBox.prototype._updateInputSelection=function(e){var t=this._tbx;this._elRef==t&&this._setSelRange(e,t.value.length)};ComboBox.prototype._getSelStart=function(){var e=this._tbx;return e&&e.value?e.selectionStart:0};ComboBox.prototype._getSelEnd=function(){var e=this._tbx;return e&&e.value?e.selectionEnd:0};ComboBox.prototype._setSelRange=function(e,t){var i=this._tbx;this._elRef!=i||i.readOnly||setSelectionRange(i,e,t)};ComboBox.prototype.getAriaLabelForScreenReader=function(){return culture.ComboBox.ariaLabels.comboBox};ComboBox.prototype._updateDropDownWhenInput=function(){if(this._shouldOpenDropdown()){var e=this._getSelStart(),t=this._getSelEnd(),i=this._delKey,n=this.text;this._controlDropdownVisibility();this._tbx.value=n;this._setSelRange(e,t);this._delKey=i}};ComboBox._ctrlTemplate="";return ComboBox}(DropDown);export{ComboBox};_addCultureInfo("MultiSelect",{itemsSelected:"{count:n0} items selected",selectAll:"Select All",ariaLabels:{multiSelectInput:"MultiSelect Input",multiSelect:"Multi Select"}});var MultiSelect=function(e){__extends(MultiSelect,e);function MultiSelect(t,i){var n=e.call(this,t)||this;n._maxHdrItems=2;n._readOnly=!1;n._hdrFmt=null;n._inputElementAriaLabel=culture.MultiSelect.ariaLabels.multiSelectInput;n.checkedItemsChanged=new Event;addClass(n.hostElement,MultiSelectClsNames.hostElement);n._tbx.readOnly=!0;n.checkedMemberPath=null;n.removeEventListener(n.dropDown,"click");n._lbx.itemsChanged.addHandler((function(){n._updateHeader(!1)}));n._lbx.checkedItemsChanged.addHandler((function(){n._updateHeader(!1);n.onCheckedItemsChanged()}));n.clickAction=ClickAction.Toggle;n.initialize(i);n._updateInputAriaLabel();return n}Object.defineProperty(MultiSelect,"controlTemplate",{get:function(){MultiSelect._ctrlTemplate||(MultiSelect._ctrlTemplate=ComboBox.controlTemplate);return MultiSelect._ctrlTemplate},set:function(e){MultiSelect._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelect.prototype,"showSelectAllCheckbox",{get:function(){return this._msLbx.showSelectAllCheckbox},set:function(e){this._msLbx.showSelectAllCheckbox=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelect.prototype,"showFilterInput",{get:function(){return this._msLbx.showFilterInput},set:function(e){this._msLbx.showFilterInput=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelect.prototype,"delay",{get:function(){return this._msLbx.delay},set:function(e){this._msLbx.delay=e},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelect.prototype,"caseSensitiveSearch",{get:function(){return this._msLbx.caseSensitiveSearch},set:function(e){this._msLbx.caseSensitiveSearch=e},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelect.prototype,"filterInputPlaceholder",{get:function(){return this._msLbx.filterInputPlaceholder},set:function(e){this._msLbx.filterInputPlaceholder=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelect.prototype,"checkOnFilter",{get:function(){return this._msLbx.checkOnFilter},set:function(e){if(e!=this.checkOnFilter){this._msLbx.checkOnFilter=asBoolean(e);this.checkedItems=[]}},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelect.prototype,"selectAllLabel",{get:function(){return this._msLbx.selectAllLabel},set:function(e){this._msLbx.selectAllLabel=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelect.prototype,"checkedMemberPath",{get:function(){return this._msLbx.checkedMemberPath},set:function(e){this._msLbx.checkedMemberPath=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelect.prototype,"maxHeaderItems",{get:function(){return this._maxHdrItems},set:function(e){if(this._maxHdrItems!=e){this._maxHdrItems=asNumber(e);this._updateHeader()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelect.prototype,"headerFormat",{get:function(){return this._hdrFmt},set:function(e){if(e!=this._hdrFmt){this._hdrFmt=asString(e);this._updateHeader()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelect.prototype,"headerFormatter",{get:function(){return this._hdrFormatter},set:function(e){if(e!=this._hdrFormatter){this._hdrFormatter=asFunction(e);this._updateHeader()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelect.prototype,"checkedItems",{get:function(){return this._msLbx.checkedItems},set:function(e){this._msLbx.checkedItems=null==e?[]:asArray(e);this._updateHeader()},enumerable:!0,configurable:!0});MultiSelect.prototype.onCheckedItemsChanged=function(e){this.checkedItemsChanged.raise(this,e)};MultiSelect.prototype.dispose=function(){this._lbx.dispose();e.prototype.dispose.call(this)};MultiSelect.prototype.onIsDroppedDownChanged=function(t){var i=this;e.prototype.onIsDroppedDownChanged.call(this,t);setTimeout((function(){if(i.isDroppedDown&&i.containsFocus())if(i.showFilterInput&&!i.isTouching)i._msLbx._filter.focus();else{var e=i.listBox;if(e.selectedIndex<0){var t=0,n=e.checkedItems;n.length&&(t=e.collectionView.items.indexOf(n[0]));e.selectedIndex=Math.max(0,t)}e.showSelection(!0);e.focus()}}))};MultiSelect.prototype.onLostFocus=function(){this._msLbx.onLostFocus();this.isDroppedDown=!1;e.prototype.onLostFocus.call(this)};MultiSelect.prototype._createDropDown=function(){var t=this,i=createElement("<div></div>",this._dropDown);this._msLbx=new MultiSelectListBox(i);this._lbx=this._msLbx.listBox;var n=this.hostElement;this._lbx.hostElement.id=getUniqueId(n.id+"_listbox");this._lbx.itemsChanged.addHandler((function(){t.isDroppedDown&&t.refresh()}));e.prototype._createDropDown.call(this)};MultiSelect.prototype._updateBtnAria=function(){var e=this._btn.querySelector("button"),t=this.isDroppedDown,i=this._lbx?this._lbx.hostElement:null,n=i?i.id:null;setAttribute(e,"aria-expanded",t);setAttribute(e,"aria-controls",t?n:null)};MultiSelect.prototype._updateTbxAria=function(){var e=this._tbx,t=this.isDroppedDown,i=this._lbx?this._lbx.hostElement:null,n=i?i.id:null;setAttribute(e,"aria-expanded",t);setAttribute(e,"aria-controls",t?n:null)};Object.defineProperty(MultiSelect.prototype,"isReadOnly",{get:function(){return this._readOnly},set:function(e){this._readOnly=asBoolean(e);toggleClass(this.hostElement,ControlStateClsNames.readOnly,this.isReadOnly)},enumerable:!0,configurable:!0});MultiSelect.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);this.hostElement&&this._updateHeader()};MultiSelect.prototype._setText=function(e,t){};MultiSelect.prototype._keydown=function(t){var i=t.altKey&&(38===t.keyCode||40===t.keyCode);if(this.isDroppedDown&&i&&this.showFilterInput){this.isDroppedDown=!1;t.preventDefault()}else{e.prototype._keydown.call(this,t);hasClass(this._tbx,"wj-grid-ime")||!t.defaultPrevented&&hasItems(this.collectionView)&&t.keyCode>32&&123!==t.keyCode&&(this.isDroppedDown=!0)}};MultiSelect.prototype._hasItems=function(){var e=this.collectionView,t=e?e.sourceCollection:null;return hasItems(e)||t&&t.length&&this.showFilterInput};MultiSelect.prototype._updateHeader=function(e,t){void 0===e&&(e=!0);void 0===t&&(t=!0);var i="";if(isFunction(this._hdrFormatter))i=this._hdrFormatter(this);else{var n=this.checkedItems,o=[];if(this.displayMemberPath){var s=new Binding(this.displayMemberPath);o=n.reduce((function(e,t){(t.binding?e.find((function(e){return e.binding===t.binding})):e.find((function(e){return s.getValue(e)===s.getValue(t)})))||e.push(t);return e}),[]);n=o}if(n.length>0)if(n.length<=this._maxHdrItems){if(this.headerPath){var r=new Binding(this.headerPath);n=n.map((function(e){return r.getValue(e)}))}else if(this.displayMemberPath){var a=new Binding(this.displayMemberPath);n=n.map((function(e){return a.getValue(e)}))}this.isContentHtml&&(n=n.map((function(e){return toPlainText(e)})));this.trimText&&(n=n.map((function(e){return e?e.toString().trim():""})));i=n.join(", ")}else i=format(this.headerFormat||culture.MultiSelect.itemsSelected,{count:n.length})}var l=this.inputElement;if(i!=l.value){l.value=i;this.onTextChanged()}e&&this._lbx._updateCheckedList(this.checkedItems);this._updateState()};MultiSelect.prototype.getAriaLabelForScreenReader=function(){return culture.MultiSelect.ariaLabels.multiSelect};MultiSelect._DEF_CHECKED_PATH="$checked";MultiSelect._ctrlTemplate="";return MultiSelect}(ComboBox);export{MultiSelect};_addCultureInfo("Menu",{ariaLabels:{menuButton:"Menu"}});var Menu=function(e){__extends(Menu,e);function Menu(t,i){var n=e.call(this,t)||this;n._closing=!1;n._cmd=null;n._cmdPath=null;n._cmdParamPath=null;n._subPath=null;n._owner=null;n._isButton=!1;n._keepOpen=!1;n._openOnHover=!1;n._closeOnLeave=!0;n._subMenu=null;n._hoverEnterBnd=n._hoverEnter.bind(n);n._hoverLeaveBnd=n._hoverLeave.bind(n);n._hoverOverBnd=n._hoverOver.bind(n);n._ariaLabel=culture.Menu.ariaLabels.menuButton;n._aFEnabledItem=!1;n._parentMenu=null;n.itemClicked=new Event;Menu._MenuInstanceCount++;var o=n.hostElement,s=n._tbx,r=n._lbx,a=n.dropDown;addClass(o,MenuClsNames.hostElement);s.style.display="none";var l='<div wj-part="header" class="'+InputFormElementsClsNames.formControl+'"/>';n._hdr=n._elRef=createElement(l);s.parentElement.insertBefore(n._hdr,s);removeChild(s);n.isRequired=!1;if("SELECT"==n._orgTag){n.header=o.getAttribute("header");n._lbx.itemsSource&&(n.commandParameterPath="cmdParam")}n.isContentHtml=!0;n.maxDropDownHeight=500;n.addEventListener(n._hdr,"click",(function(e){if(!e.defaultPrevented){n._clearHover(e);if(n._isButton){n.isDroppedDown=!1;n._raiseCommand()}else n.isDroppedDown=!n.isDroppedDown}}));n.addEventListener(n._hdr,"mousedown",(function(e){e.defaultPrevented||n._clearHover(e)}));r.lostFocus.addHandler((function(){n.containsFocus()||(n.isDroppedDown=!1)}));addClass(a,MenuClsNames.menuItems);r.formatItem.addHandler(n._formatMenuItem.bind(n));n.initialize(i);setAttribute(a,"role","menu");n._updateBtnAria();n._updateHdrAria();r.tabOrder=0;n._updateLbxAria();return n}Object.defineProperty(Menu,"controlTemplate",{get:function(){Menu._ctrlTemplate||(Menu._ctrlTemplate=ComboBox.controlTemplate);return Menu._ctrlTemplate},set:function(e){Menu._ctrlTemplate=e},enumerable:!0,configurable:!0});Menu.prototype._updateBtnAria=function(){var e=this._btn.querySelector("button"),t=this.dropDown;setAttribute(e,"aria-expanded",this.isDroppedDown);setAttribute(e,"aria-haspopup","menu");setAttribute(e,"aria-owns",t.id);setAttribute(e,"aria-controls",t.id)};Menu.prototype._updateHdrAria=function(){var e=this.dropDown,t=this.isDisabled?-1:this._orgTabIndex;setAttribute(this._hdr,"role","button");setAttribute(this._hdr,"tabindex",t);setAttribute(this._hdr,"aria-label",this._ariaLabel);if(this.isButton){setAttribute(this._hdr,"aria-expanded");setAttribute(this._hdr,"aria-haspopup");setAttribute(this._hdr,"aria-owns");setAttribute(this._hdr,"aria-controls")}else{setAttribute(this._hdr,"aria-expanded",this.isDroppedDown);setAttribute(this._hdr,"aria-haspopup","menu");setAttribute(this._hdr,"aria-owns",e.id);setAttribute(this._hdr,"aria-controls",e.id)}};Menu.prototype._updateLbxAria=function(){var e=this._lbx,t=this.isDisabled?-1:e.tabOrder;e.itemRole="menuitem";e.tabOrder=t};Object.defineProperty(Menu.prototype,"ariaLabel",{get:function(){return this._ariaLabel},set:function(e){if(e!=this._ariaLabel){this._ariaLabel=e;setAttribute(this._hdr,"aria-label",this._ariaLabel)}},enumerable:!0,configurable:!0});Object.defineProperty(Menu.prototype,"autoSelectOnFocus",{get:function(){return this._aFEnabledItem},set:function(e){this._aFEnabledItem=e},enumerable:!0,configurable:!0});Object.defineProperty(Menu.prototype,"header",{get:function(){return this._hdr.innerHTML},set:function(e){this._hdr.innerHTML=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(Menu.prototype,"command",{get:function(){return this._cmd},set:function(e){this._cmd=e},enumerable:!0,configurable:!0});Object.defineProperty(Menu.prototype,"commandPath",{get:function(){return this._cmdPath},set:function(e){this._cmdPath=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(Menu.prototype,"commandParameterPath",{get:function(){return this._cmdParamPath},set:function(e){this._cmdParamPath=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(Menu.prototype,"subItemsPath",{get:function(){return this._subPath},set:function(e){if(e!=this._subPath){this._subPath=e;this.refresh(!0)}},enumerable:!0,configurable:!0});Object.defineProperty(Menu.prototype,"openOnHover",{get:function(){return this._openOnHover},set:function(e){this._openOnHover=asBoolean(e);this._updateHoverEvents()},enumerable:!0,configurable:!0});Object.defineProperty(Menu.prototype,"closeOnLeave",{get:function(){return this._closeOnLeave},set:function(e){this._closeOnLeave=asBoolean(e);this._updateHoverEvents()},enumerable:!0,configurable:!0});Object.defineProperty(Menu.prototype,"isButton",{get:function(){return this._isButton},set:function(e){this._isButton=asBoolean(e);this._updateHdrAria()},enumerable:!0,configurable:!0});Object.defineProperty(Menu.prototype,"keepOpen",{get:function(){return this._keepOpen},set:function(e){this._keepOpen=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(Menu.prototype,"owner",{get:function(){return this._owner},set:function(e){this._owner=asType(e,HTMLElement,!0);this._enableDisableItems()},enumerable:!0,configurable:!0});Menu.prototype.show=function(e){if(!this.isDroppedDown){var t=this._lbx._ignoredItemChangedEvents;this._lbx._ignoredItemChangedEvents=!0;this.selectedIndex=-1;this._lbx._ignoredItemChangedEvents=t;if(this.onIsDroppedDownChanging(new CancelEventArgs)){var i=this.dropDown,n=this.owner;!n&&e instanceof MouseEvent&&(n=e.target);n instanceof HTMLElement&&(i[Control._OWNR_KEY]=n);if(e instanceof MouseEvent&&this.openOnHover&&this.closeOnLeave){e=new Point(e.pageX-pageXOffset-2,e.pageY-pageYOffset-2)}showPopup(i,e,!1,this.isAnimated);this.onIsDroppedDownChanged()}}};Menu.prototype.hide=function(){if(this.isDroppedDown&&this.onIsDroppedDownChanging(new CancelEventArgs)){hidePopup(this.dropDown);this.onIsDroppedDownChanged()}};Menu.prototype.onItemClicked=function(e){this.itemClicked.raise(this,e)};Menu.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);this.hostElement&&this._enableDisableItems()};Menu.prototype.onIsDroppedDownChanged=function(t){e.prototype.onIsDroppedDownChanged.call(this,t);this._updateBtnAria();this._updateHdrAria();if(this.isDroppedDown){this._closing=!0;var i=this._lbx._ignoredItemChangedEvents;this._lbx._ignoredItemChangedEvents=!0;this._defaultItem=this.selectedItem;this.isRequired=!1;this.selectedIndex=-1;this._enableDisableItems();this._closing=!1;this._lbx._ignoredItemChangedEvents=i;if(this._aFEnabledItem){for(var n=this.dropDown.children,o=0;o<n.length;o++)if(!n[o].classList.contains(ControlStateClsNames.disabled)){this.selectedIndex=o;n[o].focus();break}}else this.dropDown.focus()}else{this._restoreSelectedItem();var s=this._subMenu;s&&(s.isDroppedDown=!1)}};Menu.prototype._restoreSelectedItem=function(){if(!this.selectedItem){var e=this._lbx._checking;this._lbx._checking=!0;this.selectedItem=this._defaultItem;this._lbx._checking=e}};Menu.prototype._updateHoverEvents=function(){var e=this.hostElement,t=this.dropDown,i=this.addEventListener.bind(this),n=this.removeEventListener.bind(this),o="mouseleave";n(e,"mouseenter",this._hoverEnterBnd);n(e,o,this._hoverLeaveBnd);n(t,"mouseover",this._hoverOverBnd);n(t,o,this._hoverLeaveBnd);if(this._openOnHover){i(e,"mouseenter",this._hoverEnterBnd);i(t,"mouseover",this._hoverOverBnd);if(this._closeOnLeave){i(e,o,this._hoverLeaveBnd);i(t,o,this._hoverLeaveBnd)}}};Menu.prototype._getSubItems=function(e){var t=this.subItemsPath,i=e&&t?e[t]:null;return isArray(i)&&i.length?i:null};Menu.prototype._formatMenuItem=function(e,t){var i=t.item;if(this._getSubItems(t.data)){addClass(i,MenuClsNames.subItems);setAttribute(i,"aria-expanded",!1)}else if("-"==i.innerHTML){i.innerHTML="";addClass(i,UtilitesClsNames.separator);setAttribute(i,"role","separator");setAttribute(i,"tabindex")}};Menu.prototype._keydown=function(t){if(!t.defaultPrevented){var i=this._getKeyCode(t);if(this.isDroppedDown)switch(i){case Key.Tab:this.isDroppedDown=!1;this._parentMenu&&this._parentMenu.focus();this.keyActionTab===TabKeyAction.CloseAndKeepFocus&&t.preventDefault();break;case Key.Enter:case Key.Right:if(this._showSubMenu()){t.preventDefault();return}break;case Key.Left:if(this._closeSubMenuAndFocusOwner()){t.preventDefault();return}break;case Key.Escape:this.isDroppedDown=!1;this.focus();this._focusMenuOwner();if(this._parentMenu){this._parentMenu.focus();this._parentMenu.isDroppedDown=!1}t.preventDefault()}if(i==Key.Enter){if(this._isButton){this._restoreSelectedItem();this._raiseCommand();t.preventDefault();return}if(this.isDroppedDown){if(this.selectedIndex>-1){this._raiseCommand();if(this.keepOpen){t.preventDefault();return}}if(this.keepOpen&&this._closeSubMenuAndFocusOwner()){t.preventDefault();return}}else{this.isDroppedDown=!0;t.preventDefault()}}}e.prototype._keydown.call(this,t)};Menu.prototype._afterOpenDropdownByDownArrow=function(){};Menu.prototype._dropDownClick=function(t){if(!t.defaultPrevented&&t.target!=this.dropDown){this._clearHover(t);if(this._showSubMenu()){t.preventDefault();return}if(this.selectedIndex>-1){this._raiseCommand();if(this.keepOpen){t.preventDefault();return}}}e.prototype._dropDownClick.call(this,t)};Menu.prototype._closeSubMenuAndFocusOwner=function(){var e=Control.getControl(this.owner);if(!(e instanceof Menu))return!1;var t=e.dropDown,i=e.selectedIndex,n=i>-1?t.children[i]:t;setAttribute(n,"aria-expanded",!1);setAttribute(n,"aria-owns");n.focus();return!0};Menu.prototype._showSubMenu=function(){var e=this,t=this._getSubItems(this.selectedItem);if(!t)return null;var i=this.dropDown.children[this.selectedIndex],n=i.getBoundingClientRect(),o=new Point(n.right,n.top);if(0==n.height)return null;var s=this.rightToLeft||"rtl"==this.dropDown.getAttribute("dir");s&&(o.x=n.left);var r=this._subMenu;r&&(r.isDroppedDown=!1);(r=new Menu(document.createElement("div"),{owner:this.hostElement,itemsSource:t,autoSelectOnFocus:this._aFEnabledItem,keepOpen:this.keepOpen,itemClicked:function(t,i){e.itemClicked.raise(t,i)},formatItem:function(t,i){e.formatItem.raise(t,i)}}))._parentMenu=this._parentMenu||this;if(i){setAttribute(i,"aria-expanded",!0);setAttribute(i,"aria-owns",r.dropDown.id)}var a=this.collectionView,l=r.collectionView;a&&a.filter&&l&&!l.filter&&(l.filter=a.filter);"displayMemberPath,selectedValuePath,isContentHtml,command,commandPath,commandParameterPath,maxDropDownWidth,maxDropDownHeight,dropDownCssClass,isAnimated,subItemsPath,openOnHover,closeOnLeave".split(",").forEach((function(t){r[t]=e[t]}));var h=r.dropDown;setAttribute(h,"dir",s?"rtl":null);r.show(o);r._rtlDir=s;h[Control._OWNR_KEY]=this.dropDown;return r};Menu.prototype._raiseCommand=function(e){var t=this.selectedItem,i=this._getSubItems(t),n=this._getCommand(t);if(n&&!i){var o=this._getCommandParm(t);if(!this._canExecuteCommand(n,o))return;this._executeCommand(n,o)}var s=this.headerPath;if(s){var r=new Binding(s).getValue(t);r=null==r?"":r.toString();this.header=this.isContentHtml?r:escapeHtml(r)}this.onItemClicked(e);if(this.containsFocus()){for(var a=this;a&&a.owner;){var l=Control.getControl(a.owner);if(!(l instanceof Menu))break;a=l}if(this.keepOpen){this._enableDisableItems();this._lbx.focus()}else{a.isDroppedDown=!1;a.focus();this._focusMenuOwner()}}};Menu.prototype._focusMenuOwner=function(){var e=this.owner;!e&&this.dropDown&&(e=this.dropDown[Control._OWNR_KEY]);if(!this.containsFocus()&&e instanceof HTMLElement&&e.offsetHeight)if(isIE){var t=document.documentElement,i=t.scrollLeft,n=t.scrollTop;e.focus();t.scrollLeft=i,t.scrollTop=n}else e.focus()};Menu.prototype._getCommand=function(e){var t=e&&this._cmdPath?e[this._cmdPath]:null;return t||this._cmd};Menu.prototype._getCommandParm=function(e){var t=this._cmdParamPath;return e&&t?e[t]:e};Menu.prototype._executeCommand=function(e,t){e&&!isFunction(e)&&(e=e.executeCommand);isFunction(e)&&e(t)};Menu.prototype._canExecuteCommand=function(e,t){if(e){var i=e.canExecuteCommand;if(isFunction(i))return i(t)}return!0};Menu.prototype._enableDisableItems=function(){if(this.collectionView&&(this._cmd||this._cmdPath))for(var e=this.collectionView.items,t=0;t<e.length;t++){var i=e[t],n=this._getCommand(i);if(n){var o=this._lbx.hostElement.children[t],s=this._getCommandParm(i);toggleClass(o,ControlStateClsNames.disabled,!this._canExecuteCommand(n,s))}}};Menu.prototype._clearHover=function(e){this._toHover&&clearTimeout(this._toHover);this._toHover=null;Menu._evtHover=e};Menu.prototype._isTargetDisabled=function(e){return hasClass(e.target,ControlStateClsNames.disabled)};Menu.prototype._hoverEnter=function(e){var t=this;this._clearHover(e);this._toHover=setTimeout((function(){t._toHover=null;t.isDroppedDown=!0}),Control._HOVER_DELAY)};Menu.prototype._hoverOver=function(e){var t=this;this._clearHover(e);this._toHover=setTimeout((function(){t._toHover=null;var i=t.listBox.indexOf(e.target);if(i>-1&&!hasClass(e.target,ControlStateClsNames.disabled)){t.selectedIndex=i;t._subMenu=t._showSubMenu()}}),Control._HOVER_DELAY)};Menu.prototype._hoverLeave=function(e){var t=this;this._clearHover(e);this.isDroppedDown&&(this._toHover=setTimeout((function(){var i=(e=Menu._evtHover)?document.elementFromPoint(e.clientX,e.clientY):null,n=closest(i,"."+ListBoxClsNames.hostElement+"."+MenuClsNames.menuItems),o=t._subMenu;if(!n&&!contains(t.hostElement,i,!0)){t.isDroppedDown=!1;o&&(o.isDroppedDown=!1)}}),Control._LEAVE_DELAY))};Menu.prototype._setIsDisabled=function(t){e.prototype._setIsDisabled.call(this,t);setAttribute(this.hostElement,"tabindex",-1);this._updateHdrAria();this._updateLbxAria()};Menu.prototype._setTabOrder=function(t){e.prototype._setTabOrder.call(this,t);setAttribute(this.hostElement,"tabindex",-1);this._updateHdrAria();this._updateLbxAria()};Menu.prototype._getRtlStates=function(){var t=this.hostElement;return t&&t.isConnected?e.prototype._getRtlStates.call(this):null!=this._rtlDir&&this._rtlDir};Menu.prototype.dispose=function(){var t=this;if(this._subMenu){this._subMenu.dispose();this._subMenu=null}Menu._MenuInstanceCount--;0===Menu._MenuInstanceCount&&Menu._evtHover&&(Menu._evtHover=null);var i=this._lbx;if(i){i.lostFocus.removeHandler((function(){t.containsFocus()||(t.isDroppedDown=!1)}));i.formatItem&&i.formatItem.removeHandler(this._formatMenuItem)}if(this._toHover){clearTimeout(this._toHover);this._toHover=null}this._cmd=null;this._owner=null;this._defaultItem=null;this._hoverEnterBnd=null;this._hoverLeaveBnd=null;this._hoverOverBnd=null;e.prototype.dispose.call(this)};Menu._MenuInstanceCount=0;Menu._ctrlTemplate="";return Menu}(ComboBox);export{Menu};_addCultureInfo("InputTime",{ariaLabels:{inputTime:"Input Time",inputTimeInput:"InputTime Input"}});var InputTime=function(e){__extends(InputTime,e);function InputTime(t,i){var n=e.call(this,t)||this;n._format="t";n._inputElementAriaLabel=culture.InputTime.ariaLabels.inputTimeInput;n.valueChanged=new Event;addClass(n.hostElement,InputTimeClsNames.hostElement);n.isEditable=!0;n._value=DateTime.newDate();n._min=n._max=null;n._msk=new _MaskProvider(n._tbx);isIE9()||(n._tbx.type="tel");if("INPUT"==n._orgTag){var o=n._tbx.getAttribute("value");o&&(n.value=Globalize.parseDate(o,"HH:mm:ss"))}n.step=15;n.autoExpandSelection=!0;n.initialize(i);n._commitText();n._updateInputAriaLabel();return n}Object.defineProperty(InputTime,"controlTemplate",{get:function(){InputTime._ctrlTemplate||(InputTime._ctrlTemplate=ComboBox.controlTemplate);return InputTime._ctrlTemplate},set:function(e){InputTime._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(InputTime.prototype,"inputElement",{get:function(){return this._tbx},enumerable:!0,configurable:!0});Object.defineProperty(InputTime.prototype,"inputType",{get:function(){return this._tbx.type},set:function(e){this._tbx.type=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputTime.prototype,"value",{get:function(){return this._value},set:function(e){(e=asDate(e,!this.isRequired))&&(e=this._clamp(e));this._setText(e?Globalize.format(e,this.format):"",!0,!0);this.selectedItem&&this.selectedItem.value&&(e=DateTime.fromDateTime(e,this.selectedItem.value));if(e!=this._value&&!DateTime.equals(e,this._value)){this._value=e;this.onValueChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(InputTime.prototype,"text",{get:function(){return this._tbx.value},set:function(e){if(e!=this.text&&(this.text||!this.isRequired)){this._setText(e,!0);this._commitText()}!this.text&&this.isRequired&&(this.selectedIndex=this._oldIndexToBeRestoredOnBlur<0?0:this._oldIndexToBeRestoredOnBlur)},enumerable:!0,configurable:!0});Object.defineProperty(InputTime.prototype,"min",{get:function(){return this._min},set:function(e){this._min=asDate(e,!0);this.isDroppedDown=!1;this._updateItems()},enumerable:!0,configurable:!0});Object.defineProperty(InputTime.prototype,"max",{get:function(){return this._max},set:function(e){this._max=asDate(e,!0);this.isDroppedDown=!1;this._updateItems()},enumerable:!0,configurable:!0});Object.defineProperty(InputTime.prototype,"step",{get:function(){return this._step},set:function(e){if(e!=this.step){this._step=asNumber(e,!0);this.isDroppedDown=!1;this._updateItems()}},enumerable:!0,configurable:!0});Object.defineProperty(InputTime.prototype,"format",{get:function(){return this._format},set:function(e){if(e!=this.format){this._format=asString(e);this._tbx.value=Globalize.format(this.value,this.format);hasItems(this.collectionView)&&this._updateItems()}},enumerable:!0,configurable:!0});Object.defineProperty(InputTime.prototype,"mask",{get:function(){return this._msk.mask},set:function(e){this._msk.mask=asString(e)},enumerable:!0,configurable:!0});InputTime.prototype.onLostFocus=function(){e.prototype.onLostFocus.call(this)};InputTime.prototype.onValueChanged=function(e){this.valueChanged.raise(this,e)};InputTime.prototype.onItemsSourceChanged=function(t){e.prototype.onItemsSourceChanged.call(this,t);this._hasCustomItems=null!=this.itemsSource};InputTime.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);if(this.hostElement){this._msk.refresh();this._tbx.value=Globalize.format(this.value,this.format);this._updateItems()}};InputTime.prototype.onSelectedIndexChanged=function(t){if(this.selectedIndex>-1&&!this._settingText){var i=this.value?this.value:DateTime.newDate(),n=null!=this.selectedItem.value?this.selectedItem.value:Globalize.parseDate(this.text,this.format,this.value);this.value=DateTime.fromDateTime(i,n)}e.prototype.onSelectedIndexChanged.call(this,t)};InputTime.prototype._clamp=function(e){null!=this._min&&this._getTime(e)<this._getTime(this._min)&&(e=DateTime.fromDateTime(e,this._min));null!=this._max&&this._getTime(e)>this._getTime(this._max)&&(e=DateTime.fromDateTime(e,this._max));return e};InputTime.prototype._wheel=function(t){if(this.handleWheel&&!t.defaultPrevented&&!this.isDroppedDown&&this.value&&this._canChangeValue()&&this.containsFocus()&&this.isEditable){var i=this._tbx,n=i.selectionStart,o=i.selectionEnd,s=clamp(-t.deltaY,-1,1),r=(this.value,culture.Globalize.calendar.patterns[this.format]);null==r&&(r=this.format);var a=r.match(getSpecialCharsRegex());if(o-n===i.value.length&&isNumber(this.step)&&this.step>0){var l=DateTime.addMinutes(this.value,this.step*-s);l=this._clamp(l);this.value=l;this.selectAll()}else this._updateTimeValue(s,a,r);t.preventDefault()}e.prototype._wheel.call(this,t)};InputTime.prototype._updateInputSelection=function(t){if(this._delKey)e.prototype._updateInputSelection.call(this,t);else{for(var i=this._tbx.value;t<i.length&&!i[t].match(/[a-z0-9]/i);)t++;setSelectionRange(this._tbx,t,this._tbx.value.length)}};InputTime.prototype._updateItems=function(){if(!this._hasCustomItems){var e=[],t=new Date,i=new Date(t.getFullYear(),t.getMonth(),t.getDate()),n=new Date(t.getFullYear(),t.getMonth(),t.getDate(),23,59,59),o=this.step;this.min&&i.setHours(this.min.getHours(),this.min.getMinutes(),this.min.getSeconds());this.max&&n.setHours(this.max.getHours(),this.max.getMinutes(),this.max.getSeconds());if(isNumber(o)&&o>=1)for(var s=i;s<=n;s=DateTime.addMinutes(s,o))e.push({value:s,text:Globalize.format(s,this.format)});var r=this.value;this._settingText=!0;this.displayMemberPath="text";this.selectedValuePath="text";this.itemsSource=e;this._hasCustomItems=!1;this._settingText=!1;!r&&this.isRequired||(this.value=r)}};InputTime.prototype._getTime=function(e){return 3600*e.getHours()+60*e.getMinutes()+e.getSeconds()};InputTime.prototype._getText=function(){var e=Globalize.format,t=this._format;return e(this.value,t)};InputTime.prototype._canChangeValue=function(){return!this.isReadOnly&&!this.isDisabled};InputTime.prototype.getSeconds=function(e){return 3600*e.getHours()+60*e.getMinutes()+e.getSeconds()};InputTime.prototype._keydown=function(t){if(!(t.defaultPrevented||t.altKey||t.ctrlKey||t.metaKey)){if(this._isHiddenEditor())return;switch(t.keyCode){case Key.Enter:this._commitText(void 0,!0);this.selectAll();break;case Key.Escape:this.text=Globalize.format(this.value,this.format);this.selectAll();break;case Key.Up:case Key.Down:if(!this.isDroppedDown&&this.value&&this._canChangeValue()&&this.isEditable){var i=this._tbx,n=i.selectionStart,o=i.selectionEnd,s=t.keyCode==Key.Up?1:-1,r=culture.Globalize.calendar.patterns[this.format];null==r&&(r=this.format);var a=r.match(getSpecialCharsRegex());if(o-n==i.value.length)e.prototype._keydown.call(this,t);else{if(!(1==s&&(null===this.max||this.getSeconds(this.value)<this.getSeconds(this.max))||-1==s&&(null===this.min||this.getSeconds(this.value)>this.getSeconds(this.min))))return;this._updateTimeValue(s,a,r)}t.preventDefault()}}}e.prototype._keydown.call(this,t)};InputTime.prototype._updateTimeValue=function(e,t,i){var n=this._tbx,o=n.selectionStart,s=n.value,r=this.value,a={},l={},h=0,u=0,c=0,p=[],d=[],m=n.value.match(getSpecialCharsRegex());if(null==t||null==m){p=[this.format];d=["0"];t=[""]}else{t.forEach((function(e,n){var o=e.replaceAll('"',""),r=i.substring(h),c=s.substring(u),p=r.indexOf(e),d=c.indexOf(o),m=r.substring(0,p);a[m]=h;l[m]=u;h=h+p+e.length;u=u+d+o.length;if(n==t.length-1&&-1!=d){m=i.substring(h);a[m]=h;l[m]=u}}));p=Object.keys(a);d=Object.values(l)}var _=d.filter((function(e){return o>=parseInt(e.toString())}));_.length>0&&(c=_.length-1);var f=p[c];-1!=f.indexOf("h")||-1!=f.indexOf("H")?r=DateTime.addHours(this.value,e):-1!=f.indexOf("m")?r=DateTime.addMinutes(this.value,e):-1!=f.indexOf("s")?r=DateTime.addSeconds(this.value,e):-1!=f.indexOf("t")&&(r=this.value.getHours()>=12?DateTime.addHours(this.value,-12):DateTime.addHours(this.value,12));r.getDate()!=(new Date).getDate()&&(r=DateTime.fromDateTime(new Date,r));this.value=r;this._reselectText(t,c)};InputTime.prototype._reselectText=function(e,t){var i=this._getText(),n=this._tbx,o=0,s=-1,r=-1;e.forEach((function(e,n){var a=e.replaceAll('"',""),l=i.substring(o),h=l.indexOf(a),u=l.substring(0,h),c=""==u?l.length:u.length;n==t&&-1==s&&(r=(s=o)+c);o=o+h+a.length}));if(-1==s){s=o;r=n.value.length}setSelectionRange(n,s,r)};InputTime.prototype._commitText=function(e,t){if(this.text||this.isRequired){var i=this.value?Globalize.format(this.value,this.format):"";if(this.text!=i){var n=this.selectedItem&&this.selectedItem.value?this.selectedItem.value:Globalize.parseDate(this.text,this.format,this.value),o=this._shouldRaiseInvalidInput(t);if(n){!DateTime.sameTime(n,this._clamp(n))?o&&this.onInvalidInput(new CancelEventArgs)&&(this.value=DateTime.fromDateTime(this.value,n)):this.value=DateTime.fromDateTime(this.value,n)}else o&&this.onInvalidInput(new CancelEventArgs)&&(this.text=i)}}else this.value=null};InputTime.prototype._copy=function(e,t){if("text"===e){(t||"").toString()!==this.text&&this._setText(t,!0);return!0}return!1};InputTime.prototype.getAriaLabelForScreenReader=function(){return culture.InputTime.ariaLabels.inputTime};InputTime.prototype._input=function(e){this._draggingText&&(""===this.text?this._emptyValueAction=!0:this._emptyValueAction=!1);this._updateDropDownWhenInput();this._setText(""!=this._textIsComposing?this._textIsComposing:this.text,!1);""!=this.text&&(this._emptyValueAction=!1);this._draggingText=!1};InputTime._ctrlTemplate="";return InputTime}(ComboBox);export{InputTime};_addCultureInfo("InputDateTime",{ariaLabels:{inputDateTimeInput:"InputDateTime Input",tglDate:"Toggle Calendar",tglTime:"Toggle Time List"}});var InputDateTime=function(e){__extends(InputDateTime,e);function InputDateTime(t,i){var n=e.call(this,t)||this;n._inputAriaLabel=culture.InputDateTime.ariaLabels.inputDateTimeInput;addClass(n.hostElement,InputDateTimeClsNames.hostElement);var o=culture.InputDateTime.ariaLabels;setAriaLabel(n._btn,o.tglDate);setAttribute(n._btn,"aria-haspopup","dialog");setAttribute(n._btn,"aria-expanded",!1);n._updateInputAriaLabel();n.value=new Date;n.format="g";n.isDroppedDownChanged.addHandler(n.inputDateTimeIsDroppedDownChanged,n);n._inputTime=new InputTime(document.createElement("div"),{valueChanged:function(e){var t=n.rangeEnd;n.value=DateTime.fromDateTime(n.value,e.value);n.calendar._rngMode()&&t&&(n.rangeEnd=DateTime.fromDateTime(t,e.value))},isDroppedDownChanged:function(e){e.listBox.containsFocus()&&n.inputElement.focus();n._selectAll();n._updateTbxAria();n.inputDateTimeIsDroppedDownChanged()},keyActionPrintCharacters:0,keyActionTab:0});n._inputTime.dropDown.id=getUniqueId(n.hostElement.id+"_dropdown");var s=n.addEventListener.bind(n);n._btnTm=n.hostElement.querySelector('[wj-part="btn-tm"]');s(n._btnTm,"mousedown",(function(e){n._isTouchMoved()||n._btnclick(e)}));setAriaLabel(n._btnTm,o.tglTime);setAttribute(n._btnTm,"aria-haspopup","listbox");setAttribute(n._btnTm,"aria-expanded",!1);n._ddDate=n._dropDown;var r=n._ddTime=n._inputTime.dropDown;s(r,"keydown",n._keydown.bind(n),!0);s(r,"blur",(function(){n._updateFocusState()}),!0);s(r,"click",(function(e){e.defaultPrevented||e.target!=r&&n.hostElement.focus()}),!0);n.initialize(i);n._tbx.value!==n._oldText&&n._commitText();return n}Object.defineProperty(InputDateTime,"controlTemplate",{get:function(){InputDateTime._ctrlTemplate||(InputDateTime._ctrlTemplate='<div class="'+ControlClsNames.template+'"><div class="'+InputClsNames.input+'"><div class="'+InputClsNames.inputGroup+" "+InputClsNames.inputBtnVisible+'"><input wj-part="input" type="text" class="'+InputFormElementsClsNames.formControl+'"/><span class="'+InputClsNames.inputGroupBtn+'"><button wj-part="btn" class="'+InputFormElementsClsNames.btn+" "+InputFormElementsClsNames.btnDefault+'" tabindex="-1"><span class='+GlyphClsNames.calendar+'></span></button><button wj-part="btn-tm" class="'+InputFormElementsClsNames.btn+" "+InputFormElementsClsNames.btnDefault+'" tabindex="-1"><span class='+GlyphClsNames.clock+'></span></button></span></div></div><div wj-part="dropdown" class="'+ControlClsNames.content+" "+DropDownClsNames.dropDownPanel+'"></div></div>');return InputDateTime._ctrlTemplate},set:function(e){InputDateTime._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(InputDateTime.prototype,"timeMin",{get:function(){return this._inputTime.min},set:function(e){this._inputTime.min=e},enumerable:!0,configurable:!0});Object.defineProperty(InputDateTime.prototype,"timeMax",{get:function(){return this._inputTime.max},set:function(e){this._inputTime.max=e},enumerable:!0,configurable:!0});Object.defineProperty(InputDateTime.prototype,"timeFormat",{get:function(){return this._inputTime.format},set:function(e){this._inputTime.format=e},enumerable:!0,configurable:!0});Object.defineProperty(InputDateTime.prototype,"timeStep",{get:function(){return this._inputTime.step},set:function(e){this._inputTime.step=e;this._btnTm.style.display=isNumber(e)&&e>0?"":"none"},enumerable:!0,configurable:!0});Object.defineProperty(InputDateTime.prototype,"inputTime",{get:function(){return this._inputTime},enumerable:!0,configurable:!0});InputDateTime.prototype._fromDateTime=function(e){return e};InputDateTime.prototype._btnclick=function(t){this._setDropDownByEvent(t);e.prototype._btnclick.call(this,t)};InputDateTime.prototype.dispose=function(){this._setDropdown(this._ddDate);e.prototype.dispose.call(this);this._inputTime.dispose()};InputDateTime.prototype.refresh=function(t){void 0===t&&(t=!0);this._inputTime.refresh();e.prototype.refresh.call(this,t)};InputDateTime.prototype._updateBtn=function(){e.prototype._updateBtn.call(this);if(this._btnTm){this._btnTm.tabIndex=this._btn.tabIndex;this._btnTm.parentElement.style.display=this._btn.style.display}};InputDateTime.prototype._setDropdown=function(e){if(this._dropDown==e)return!1;this.isDroppedDown&&(this.isDroppedDown=!1);var t=this.dropDownCssClass;this.dropDownCssClass="";this._dropDown=e;this.dropDownCssClass=t;return!0};InputDateTime.prototype._updateDropDown=function(){var t=this._inputTime;if(this._dropDown==t.dropDown){this._commitText();e.prototype._updateDropDown.call(this);t.isRequired=this.isRequired&&null!=this.value;t.value=this.value;this.isDroppedDown&&t.listBox.showSelection()}else e.prototype._updateDropDown.call(this)};InputDateTime.prototype._mouseWheel=function(e){if(this.handleWheel&&!e.defaultPrevented&&!this.isDroppedDown&&this.containsFocus()&&null!=this.value&&this._canChangeValue()){var t=this._tbx,i=t.selectionStart,n=t.selectionEnd,o=clamp(-e.deltaY,-1,1),s=this.value,r=Globalize.getFullFormat(this.format||Globalize.DefaultDateFormat);null==r&&(r=this.format);var a=r.match(getSpecialCharsRegex());if(n-i===t.value.length&&null!=a||this.selectionMode==DateSelectionMode.Range){s=this.selectionMode==DateSelectionMode.Month?DateTime.addMonths(this.value,o):DateTime.addDays(this.value,o);this.value=s;var l=this._getText();setSelectionRange(t,0,l.length)}else(1==o&&(null===this.max||this.value<this.max)||-1==o&&(null===this.min||this.value>this.min))&&this._updateDateTimeValue(o,a,r);e.preventDefault()}};InputDateTime.prototype._keydown=function(t){if(!(t.defaultPrevented||t.altKey||t.ctrlKey||t.metaKey)){if(this._isHiddenEditor())return;switch(t.keyCode){case Key.Up:case Key.Down:if(t.keyCode===Key.Up&&this.keyActionUpArrow===KeyAction.OpenDropdown||t.keyCode===Key.Down&&this.keyActionDownArrow===KeyAction.OpenDropdown)break;if(!this.isDroppedDown&&this.value&&this._canChangeValue()){var i=this._tbx,n=i.selectionStart,o=i.selectionEnd,s=(i.value,t.keyCode==Key.Up?1:-1),r=this.value,a=Globalize.getFullFormat(this.format||Globalize.DefaultDateFormat);if("g"==this.format&&a.includes("г")){a=a.replace(/\"г.\" /,"")}null==a&&(a=this.format);var l=a.match(getSpecialCharsRegex());if(o-n===i.value.length&&null!=l||this.selectionMode==DateSelectionMode.Range){r=this.selectionMode==DateSelectionMode.Month?DateTime.addMonths(this.value,s):DateTime.addDays(this.value,s);this.value=r;var h=this._getText();setSelectionRange(i,0,h.length)}else(1==s&&(null===this.max||this.value<this.max)||-1==s&&(null===this.min||this.value>this.min))&&this._updateDateTimeValue(s,l,a);t.preventDefault()}break;case Key.Enter:case Key.Space:var u=t.target;if(u===this._btn||u===this._btnTm){this._setDropDownByEvent(t);this.isDroppedDown=!0;t.preventDefault()}}}if(!t.defaultPrevented&&t.altKey&&this.isDroppedDown&&("ArrowUp"===t.key||"ArrowDown"===t.key)){var c=this.dropDown===this._ddDate?this._ddTime:this._ddDate;this._setDropdown(c);this.isDroppedDown=!0;t.preventDefault()}e.prototype._keydown.call(this,t)};InputDateTime.prototype._updateDateTimeValue=function(e,t,i){var n=this._tbx,o=n.selectionStart,s=n.value,r=this.value,a={},l={},h=0,u=0,c=0,p=[],d=[],m=n.value.match(getSpecialCharsRegex());if(null==t||null==m){p=[this.format];d=["0"];t=[""]}else{t.forEach((function(e,n){var o=e.replaceAll('"',""),r=i.substring(h),c=s.substring(u);if(c.startsWith("г.")){c=c.replace("г. ","");u+="г. ".length}var p=r.indexOf(e),d=c.indexOf(o);if(-1==d){var _=m[n];d=c.indexOf(_)}var f=r.substring(0,p);if(""!=f){a[f]=h;l[f]=u}h=h+p+e.length;u=u+d+o.length;if(n==t.length-1&&-1!==d){f=i.substring(h);a[f]=h;l[f]=u}}));p=Object.keys(a);d=Object.values(l)}var _=d.filter((function(e){return o>=parseInt(e.toString())}));_.length>0&&(c=_.length-1);var f=new Date,b=new Date;null!==this.timeMax&&(f=new Date(this.value.getFullYear(),this.value.getMonth(),this.value.getDate(),this.timeMax.getHours(),this.timeMax.getMinutes(),this.timeMax.getSeconds()));null!==this.timeMin&&(b=new Date(this.value.getFullYear(),this.value.getMonth(),this.value.getDate(),this.timeMin.getHours(),this.timeMin.getMinutes(),this.timeMin.getSeconds()));var g=p[c];if(-1!=g.indexOf("d"))r=DateTime.addDays(this.value,e);else if(-1!=g.indexOf("M"))r=DateTime.addMonths(this.value,e);else if(-1!=g.indexOf("y"))r=DateTime.addYears(this.value,e);else if(1==e&&(null===this.timeMax||this.value<f)||-1==e&&(null===this.timeMin||this.value>b)){-1!=g.indexOf("h")||-1!=g.indexOf("H")?r=DateTime.addHours(this.value,e):-1!=g.indexOf("m")?r=DateTime.addMinutes(this.value,e):-1!=g.indexOf("s")?r=DateTime.addSeconds(this.value,e):-1!=g.indexOf("t")&&(r=this.value.getHours()>=12?DateTime.addHours(this.value,-12):DateTime.addHours(this.value,12));(this.timeMax&&r>f||this.timeMin&&r<b)&&(r=this.value)}this.value=r;this._reselectText(t,c)};InputDateTime.prototype._commitText=function(t,i){var n=this._tbx.value,o=Globalize.parseDate(n,this.format,this.value),s=new Date,r=new Date;if(o){null!==this.timeMax&&(s=new Date(o.getFullYear(),o.getMonth(),o.getDate(),this.timeMax.getHours(),this.timeMax.getMinutes(),this.timeMax.getSeconds()));null!==this.timeMin&&(r=new Date(o.getFullYear(),o.getMonth(),o.getDate(),this.timeMin.getHours(),this.timeMin.getMinutes(),this.timeMin.getSeconds()));(this.timeMax&&o>s||this.timeMin&&o<r)&&(this.value=DateTime.fromDateTime(o,this.value));e.prototype._commitText.call(this,t,i)}else e.prototype._commitText.call(this,t,i)};InputDateTime.prototype._updateTbxAria=function(){e.prototype._updateTbxAria.call(this);if(this._inputTime){var t=this._tbx,i=this._inputTime._lbx,n=i.selectedIndex,o=i.hostElement?i.hostElement.children:null,s=n>-1&&n<o.length?o[n].id:null;setAttribute(t,"aria-activedescendant",this.isDroppedDown&&this.dropDown===this._ddTime&&s&&s.length?s:null);setAttribute(t,"aria-haspopup",this.inputTime.isDroppedDown?"listbox":"dialog")}};Object.defineProperty(InputDateTime.prototype,"keyActionTab",{get:function(){return this._keyActionTab},set:function(e){var t=asEnum(e,TabKeyAction);this._keyActionTab=t;this.inputTime.keyActionTab=t},enumerable:!0,configurable:!0});InputDateTime.prototype._setDropDownByEvent=function(e){var t=closest(e.target,"button")==this._btn?this._ddDate:this._ddTime;this._setDropdown(t)};InputDateTime.prototype._updateBtnAria=function(){var e=this._btn,t=this.isDroppedDown,i=this.dropDown?this.dropDown.id:null,n=this._btnTm,o=t&&this.dropDown===this._ddDate,s=t&&this.dropDown===this._ddTime;setAttribute(e,"aria-expanded",!!o);setAttribute(e,"aria-controls",o?i:null);setAttribute(n,"aria-expanded",!!s);setAttribute(n,"aria-controls",s?i:null)};InputDateTime.prototype.inputDateTimeIsDroppedDownChanged=function(){var e=this.dropDown===this._ddDate?this._btn:this._btnTm;toggleClass(e,InputDateTimeClsNames.showDropDownButton,this.isDroppedDown)};InputDateTime._ctrlTemplate="";return InputDateTime}(InputDate);export{InputDateTime};_addCultureInfo("AutoComplete",{ariaLabels:{autoCompleteInput:"AutoComplete Input",autoComplete:"Auto Complete"}});var AutoComplete=function(e){__extends(AutoComplete,e);function AutoComplete(t,i){var n=e.call(this,t)||this;n._cssMatch=ComboBoxClsNames.stateMatch;n._minLength=2;n._maxItems=6;n._itemCount=0;n._beginsWith=!1;n._delay=Control._SEARCH_DELAY;n._selItems=null;n._query="";n._inCallback=!1;n._srchProps=[];n._oldSelectedIndex=-1;n._inputElementAriaLabel=culture.AutoComplete.ariaLabels.autoCompleteInput;n._isBlurInput=!1;addClass(n.hostElement,AutoCompleteClsNames.hostElement);n._bsCollapse=!1;n.isEditable=!0;n.isRequired=!1;n.listBox.formatItem.addHandler(n._formatListItem,n);n._itemsSourceFnCallbackBnd=n._itemSourceFunctionCallback.bind(n);n.initialize(i);n._updateInputAriaLabel();return n}Object.defineProperty(AutoComplete,"controlTemplate",{get:function(){AutoComplete._ctrlTemplate||(AutoComplete._ctrlTemplate=ComboBox.controlTemplate);return AutoComplete._ctrlTemplate},set:function(e){AutoComplete._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(AutoComplete.prototype,"minLength",{get:function(){return this._minLength},set:function(e){this._minLength=asNumber(e,!1,!0)},enumerable:!0,configurable:!0});Object.defineProperty(AutoComplete.prototype,"beginsWithSearch",{get:function(){return this._beginsWith},set:function(e){this._beginsWith=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(AutoComplete.prototype,"maxItems",{get:function(){return this._maxItems},set:function(e){this._maxItems=asNumber(e,!1,!0)},enumerable:!0,configurable:!0});Object.defineProperty(AutoComplete.prototype,"delay",{get:function(){return this._delay},set:function(e){this._delay=asNumber(e,!1,!0)},enumerable:!0,configurable:!0});Object.defineProperty(AutoComplete.prototype,"searchMemberPath",{get:function(){return this._srchProp},set:function(e){this._srchProp=asString(e);this._srchProps=e?e.trim().split(/\s*,\s*/):[]},enumerable:!0,configurable:!0});Object.defineProperty(AutoComplete.prototype,"itemsSourceFunction",{get:function(){return this._itemsSourceFn},set:function(e){if(this._itemsSourceFn!==e){this._itemsSourceFn=asFunction(e);isFunction(this._itemsSourceFn)&&this.itemsSourceFunction(this.text,this.maxItems,this._itemsSourceFnCallbackBnd)}},enumerable:!0,configurable:!0});Object.defineProperty(AutoComplete.prototype,"cssMatch",{get:function(){return this._cssMatch},set:function(e){this._cssMatch=asString(e)},enumerable:!0,configurable:!0});AutoComplete.prototype.onSelectedIndexChanged=function(t){this._settingText||e.prototype.onSelectedIndexChanged.call(this,t)};AutoComplete.prototype._updateTbxAria=function(){e.prototype._updateTbxAria.call(this);var t=this._tbx;setAttribute(t,"aria-autocomplete","list")};AutoComplete.prototype._keydown=function(t){if(!this._isHiddenEditor()){if(!t.defaultPrevented&&this.isDroppedDown)switch(t.keyCode){case Key.Up:case Key.Down:this.selectAll()}e.prototype._keydown.call(this,t)}};AutoComplete.prototype._input=function(e){this._handleDragTextState();this._updateComponentText();this._updateEmptyValueFlag();this._resetDragState()};AutoComplete.prototype._commitText=function(e){var t=this;if(e&&this._composing&&this.isDroppedDown&&!isFirefox()&&!isSafari()&&""==this._textIsComposing){this._isBlurInput=!0;this.isDroppedDown=!1;setTimeout((function(){t.onLostFocus()}),this.delay+1)}e&&!this._composing&&(isFirefox()||isSafari())&&getActiveElement()==this.inputElement&&this.onLostFocus()};AutoComplete.prototype._setText=function(e){var t=this;if(this._isBlurInput&&0==this.text.length){this._tbx.value=e;this._isBlurInput=!1}this.trimText&&!this.containsFocus()&&"string"==typeof e&&(e=e.trim());if(this._composing&&e!=this._oldText){this._oldText=e;this.onTextChanged()}if(!(this._inCallback||this._settingText||(isFirefox()||isSafari())&&this._composing)){this._toSearch||(this._oldSelectedIndex=this.selectedIndex);if(this.selectedIndex>-1&&this._getDisplayText(void 0,void 0,!0)!=e){this._settingText=!0;this.selectedIndex=-1;this._settingText=!1}this._toSearch&&clearTimeout(this._toSearch);if(e!=this._oldText||e!=this.text){"string"!=typeof e&&(e="");var i=this._tbx,n=this._tbx.selectionStart;i.value!=e&&(i.value=e);this._isWheel&&this.containsFocus()&&this._updateInputSelection(n);this._oldText=e;this.onTextChanged();var o=this.collectionView;if(!e&&o){(this._query||this.selectedIndex<0)&&(this.isDroppedDown=!1);this._query=this._rxHighlight=null;o.filter=null;var s=this.itemsSourceFunction;if(isFunction(s)){this.isDroppedDown=!1;s(this._query,this.maxItems,this._itemsSourceFnCallbackBnd)}if(this.isRequired&&!this.containsFocus()&&!Array.isArray(this._selItems)){var r=this._oldSelectedIndex>-1?this._oldSelectedIndex:0;this.selectedIndex=r}-1==this.selectedIndex&&-1!=this._oldSelectedIndex&&this.onSelectedIndexChanged();return}}if(e!=this._getDisplayText(void 0,void 0,!0)){if(!this.containsFocus()&&this.trimText)if(this.isRequired&&!this.text.trim().length){r=this._oldSelectedIndex>-1?this._oldSelectedIndex:0;this.selectedIndex=r}else this._tbx.value=this._tbx.value.trim();var a=!this.containsFocus()&&e.length<this.minLength;this.collectionView&&!this.containsFocus()&&(this.collectionView.filter=null);var l=this.indexOf(e,!0),h=this.indexOf(e,!1);if(a)return;if(!this.containsFocus()&&(!e||this.trimText&&!this.text.trim().length||null!=this.collectionView&&l<0&&h<0)&&this.isRequired&&!this.isEditable){(r=this._oldSelectedIndex>-1?this._oldSelectedIndex:hasItems(this.collectionView)?0:-1)!=this.selectedIndex&&(this.selectedIndex=r)}else if((Array.isArray(this.itemsSource)||"function"==typeof this.itemsSourceFunction)&&!this.containsFocus()&&e&&l<0&&(h<0||h!=l)&&!this.isRequired&&!this.isEditable){this._tbx.value="";this.selectedIndex=-1;this.onSelectedIndexChanged()}else{var u=this._delay>0?setTimeout:function(e,t){return e()};this._pendingSearchFn=function(){t._toSearch=null;var i=t.text;if(!t._composing&&i.trim().length>=t._minLength&&i!=t._query){t._query=i.trim();i=escapeRegExp(i);var n=escapeHtml(i.trim()),o=t.caseSensitiveSearch?"":"i";t._beginsWith||(o+="g");t._rxSrch=t._beginsWith?new RegExp("^"+i+".*",o):new RegExp("(?=.*"+i.replace(/ /g,")(?=.*")+")",o);t._rxHighlight=t._beginsWith?new RegExp("^"+i,o):new RegExp("("+n.replace(/\s+/g,"|")+")",o);var s=t.itemsSourceFunction;isFunction(s)?s(t._query,t.maxItems,t._itemsSourceFnCallbackBnd):t._updateItems()}!e.trim().length&&!t.isEditable&&t.indexOf(e,!0)<0&&(t.selectedIndex=-1);-1==t.selectedIndex&&-1!=t._oldSelectedIndex&&t.onSelectedIndexChanged()};this._toSearch=u(this._pendingSearchFn,this._delay)}}else""===this._tbx.value&&e&&(this._tbx.value=e)}};AutoComplete.prototype.onLostFocus=function(t){var i=!1;if(this.isRequired&&!this.isEditable&&this.text&&this.text.length>=this.minLength){i=!0;var n=this.indexOf(this.text,!0);n<0&&(n=this.indexOf(this.text,!1));n>-1&&(this._oldSelectedIndex=n);n<0&&(this._oldSelectedIndex=0)}if(this._toSearch){clearTimeout(this._toSearch);this.text!==this._getDisplayText(void 0,void 0,!0)&&this._pendingSearchFn&&this._pendingSearchFn();i=!1}var o=this.collectionView;if(o&&0===o.items.length){this._oldFilter=o.filter;o.filter=null}e.prototype.onLostFocus.call(this,t,this._oldSelectedIndex,i)};AutoComplete.prototype.onGotFocus=function(t){this._toSearch||(this._oldSelectedIndex=this.selectedIndex);e.prototype.onGotFocus.call(this,t)};AutoComplete.prototype.reset=function(){this._oldSelectedIndex=-1};AutoComplete.prototype._itemSourceFunctionCallback=function(e){this._inCallback=!0;var t=asCollectionView(e||[]);t.moveCurrentToPosition(-1);this.itemsSource=t;this._inCallback=!1;if(this.containsFocus()){var i=this._tbx,n=i.selectionStart,o=i.selectionEnd,s=this.collectionView;this.isDroppedDown=null!=s&&s.items.length>0;setSelectionRange(i,n,o);this.refresh()}};AutoComplete.prototype.onIsDroppedDownChanged=function(t){e.prototype.onIsDroppedDownChanged.call(this,t);if(this.containsFocus()&&!this.isTouching){var i=this.collectionView;if(this.selectedIndex<0&&i){var n=i.items,o=this.text;1==n.length&&n[0]==o?this.selectedIndex=0:setSelectionRange(this._tbx,o.length)}}this._query=""};AutoComplete.prototype._updateItems=function(){var e=this.collectionView;if(e){this._inCallback=!0;e.beginUpdate();this._itemCount=0;e.filter=this._filter.bind(this);e.moveCurrentToPosition(-1);e.endUpdate();this._inCallback=!1;var t=e.items.length,i=this._tbx,n=i.selectionStart,o=i.selectionEnd;this.text.trim()||(t=0);this.isDroppedDown=t>0&&this.containsFocus();t||this.isEditable||(this.selectedIndex=-1);if(1==t&&this.selectedIndex<0){var s=this._getItemText(e.items[0],!1),r=i.value;if(!this.caseSensitiveSearch){s=s.toLowerCase();r=r.toLowerCase()}(s==r||this.trimText&&s.trim()==r)&&(this.selectedIndex=0)}this.isDroppedDown&&setSelectionRange(i,n,o);this.refresh()}};AutoComplete.prototype._filter=function(e){if(this._itemCount>=this._maxItems&&this._query)return!1;var t=[this._getItemText(e,!1)];this._srchProps&&this._srchProps.forEach((function(i){var n=e[i];null!=n&&t.push(n)}));this.isContentHtml&&(t=t.map((function(e){return e.replace(/(<[^>]*>|&[^;]*;)/g,"")})));for(var i=0;i<t.length;i++)if(this._rxSrch.test(t[i])){this._itemCount++;return!0}return!1};AutoComplete.prototype._getItemText=function(e,t){var i=e?e.toString():"",n=t&&this.headerPath?this._pathHdr:this._lbx._pathDisplay;n&&(i=null!=(i=n.getValue(e))?i.toString():"");return i};AutoComplete.prototype._formatListItem=function(e,t){var i=this;this._cssMatch&&this._rxHighlight&&this._query&&(t.item.innerHTML=t.item.innerHTML.replace(this._rxHighlight,(function(e,t,n,o){return i._enclosed(o,n,"<",">")||i._enclosed(o,n,"&",";")?e:'<span class="'+i._cssMatch+'">'+e+"</span>"})))};AutoComplete.prototype._enclosed=function(e,t,i,n){for(var o=t;o>=0&&e[o]!=n;o--)if(e[o]==i)for(var s=t;s<e.length&&e[s]!=i;s++)if(e[s]==n)return!0;return!1};AutoComplete.prototype._wheel=function(t){e.prototype._wheel.call(this,t)};AutoComplete.prototype.getAriaLabelForScreenReader=function(){return culture.AutoComplete.ariaLabels.autoComplete};AutoComplete.prototype._hasCustomFormatItem=function(){return this.formatItem.getHandler.length>1};AutoComplete._ctrlTemplate="";return AutoComplete}(ComboBox);export{AutoComplete};_addCultureInfo("MultiAutoComplete",{ariaLabels:{multiAutoCompleteInput:"MultiAutoComplete Input",multiAutoComplete:"MultiAutoComplete",multiAutoCompleteHelperInput:"MultiAutoComplete Helper Input",remove:"Remove"}});var MultiAutoComplete=function(e){__extends(MultiAutoComplete,e);function MultiAutoComplete(t,i){var n=e.call(this,t)||this;n._maxSelItems=null;n._lastInputValue="";n._selPath=new Binding(null);n._notAddItm=!1;n._inputElementAriaLabel=culture.MultiAutoComplete.ariaLabels.multiAutoCompleteInput;n._helperInputElementAriaLabel=culture.MultiAutoComplete.ariaLabels.multiAutoCompleteHelperInput;n._ariaLabelledby=null;n.selectedItemsChanged=new Event;addClass(n.hostElement,MultiAutoCompleteClsNames.hostElement);n._wjTpl=n.hostElement.querySelector("."+ControlClsNames.template);n._wjInput=n.hostElement.querySelector("."+InputClsNames.input);n.showDropDownButton=!1;n._selItems=[];n.initialize(i);n.addEventListener(n.hostElement,"keyup",n._keyup.bind(n),!0);n.addEventListener(window,"resize",n._adjustInputWidth.bind(n));n.addEventListener(n._tbx,"focus",(function(){n._itemOff()}));n._addHelperInput();n._addScreenReaderHelper();n._initSeltems();n.listBox.itemsChanged.addHandler((function(){if(-1!==n.selectedIndex){var e=n.collectionView;(e&&("CollectionView"==e.constructor.name||"ODataVirtualCollectionView"==e.constructor.name)||e.virtualization)&&(n.selectedIndex=-1)}}));n._refreshHeader();n._updateTabIndex();n._updateInputAriaLabel();return n}Object.defineProperty(MultiAutoComplete,"controlTemplate",{get:function(){MultiAutoComplete._ctrlTemplate||(MultiAutoComplete._ctrlTemplate=AutoComplete.controlTemplate);return MultiAutoComplete._ctrlTemplate},set:function(e){MultiAutoComplete._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(MultiAutoComplete.prototype,"showDropDownButton",{set:function(e){this._showBtn=!1},enumerable:!0,configurable:!0});Object.defineProperty(MultiAutoComplete.prototype,"maxSelectedItems",{get:function(){return this._maxSelItems},set:function(e){if(this._maxSelItems!=e){this._maxSelItems=asNumber(e,!0);this._updateMaxItems();this._refreshHeader();this._clearSelIndex()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiAutoComplete.prototype,"selectedMemberPath",{get:function(){return this._selPath.path},set:function(e){if((e=asString(e))!==this.selectedMemberPath){this._selPath.path=e;this._initSeltems();this._refreshHeader();this.onSelectedItemsChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiAutoComplete.prototype,"selectedItems",{get:function(){return this._selItems},set:function(e){e=Array.from(new Set(e));var t=this._selItems===e;t||null==this._selItems||null==e||this._selItems.length!==e.length||(t=this._selItems.every((function(t,i){return t===e[i]})));this._selItems=asArray(e);if(!t){if(this.selectedMemberPath&&""!==this.selectedMemberPath&&this._selItems)for(var i=0;i<this._selItems.length;i++){var n=this._selItems[i];this._setSelItem(n,!1)}this._updateMaxItems();this.onSelectedItemsChanged();this._refreshHeader();this._clearSelIndex()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiAutoComplete.prototype,"ariaLabelledBy",{get:function(){return this._ariaLabelledby},set:function(e){_setAriaLabelBy(this,this._tbx,e,this._updateInputAndListBoxAriaLabel.bind(this))},enumerable:!0,configurable:!0});MultiAutoComplete.prototype.onSelectedItemsChanged=function(e){this.selectedItemsChanged.raise(this,e)};MultiAutoComplete.prototype.onIsDroppedDownChanged=function(t){!this.isDroppedDown&&this.selectedIndex>-1&&!this._notAddItm&&this._addItem(!0);this._notAddItm=!1;e.prototype.onIsDroppedDownChanged.call(this,t)};MultiAutoComplete.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);if(this.hostElement){this._initSeltems();this.isDroppedDown||this._refreshHeader()}};MultiAutoComplete.prototype._keydown=function(t){if(!this.isReadOnly){if(!t.defaultPrevented)switch(t.keyCode){case Key.Back:this._lastInputValue=this._tbx.value;break;case Key.Enter:this._itemOff();this._addItem(!0);isIE()&&setSelectionRange(this._tbx,this._tbx.textContent.length,this._tbx.textContent.length);break;case Key.Tab:if(this.isDroppedDown){this._addItem(!1);this._tbx.value="";this._lbx.selectedIndex=-1;this.isDroppedDown=!1;this.containsFocus()||this.focus();t.preventDefault()}else this._updateFocus();break;case Key.Space:if(""!==this._tbx.value)return;if(!this.isDroppedDown&&!this._tbx.disabled){this.isDroppedDown=!0;this._clearSelIndex()}break;case Key.Escape:this.isDroppedDown&&(this._notAddItm=!0);break;case Key.Left:this._itemOn(!this.rightToLeft);break;case Key.Right:this._itemOn(!!this.rightToLeft);break;case Key.Up:case Key.Down:var i=getActiveElement();if(t.altKey){if(this._tbx==i){this.isDroppedDown=!this.isDroppedDown;this.isDroppedDown||this._tbx.focus();t.preventDefault();return}}else if(this._tbx!==i)return;default:if(t.keyCode===Key.Back||t.keyCode===Key.Delete)return;this._itemOff();null!=this._maxSelItems&&this._selItems.length>=this._maxSelItems&&t.preventDefault()}this._tbx.disabled||e.prototype._keydown.call(this,t)}};MultiAutoComplete.prototype._updateState=function(){e.prototype._updateState.call(this);this._wjTpl&&(hasClass(this.hostElement,ControlStateClsNames.focused)||this._itemOff())};MultiAutoComplete.prototype._keyup=function(e){if(!this.isReadOnly&&!e.defaultPrevented)switch(e.keyCode){case Key.Back:0===this._tbx.value.length&&0===this._lastInputValue.length&&this._delItem(!1);break;case Key.Delete:this._delItem(!0)}};MultiAutoComplete.prototype._addHelperInput=function(){var e=document.createElement("input");e.type="text";e.tabIndex=-1;e.className=MultiAutoCompleteClsNames.tokenHelper;e.readOnly=!0;setAttribute(e,"aria-label",this._helperInputElementAriaLabel);setAttribute(e,"role","textbox");this._wjTpl.insertBefore(e,this._wjInput);this._helperInput=e};MultiAutoComplete.prototype._addScreenReaderHelper=function(){var e=document.createElement("div");e.tabIndex=-1;e.className=MultiAutoCompleteClsNames.screenReaderOnly;setAttribute(e,"aria-live","polite");this._wjTpl.insertBefore(e,this._wjInput);this._screenReaderHelper=e};MultiAutoComplete.prototype._refreshHeader=function(){for(var e=this.hostElement.querySelectorAll("."+MultiAutoCompleteClsNames.token),t=0;t<e.length;t++)this._wjTpl.removeChild(e[t]);var i=this.selectedItems;if(i&&0!==i.length){for(t=0;t<i.length;t++)this._insertToken(i[t]);this._wjInput.style.cssFloat=this.rightToLeft?"right":"left";this._adjustInputWidth()}else{this._wjInput.style.cssFloat=this.rightToLeft?"right":"left";this._adjustInputWidth()}};MultiAutoComplete.prototype._insertToken=function(e){var t=this._getItemText(e,!0);this.isContentHtml||(t=escapeHtml(t));this._wjTpl.insertBefore(this._createItem(t),this._wjInput)};MultiAutoComplete.prototype._updateMaxItems=function(){null!=this._maxSelItems&&this._selItems&&this._selItems.length>this._maxSelItems&&(this._selItems=this._selItems.slice(0,this._maxSelItems))};MultiAutoComplete.prototype._updateFocus=function(){var e=this,t=this._wjTpl.querySelector("."+MultiAutoComplete._clsActive);if(t){removeClass(t,MultiAutoComplete._clsActive);setTimeout((function(){e._tbx.focus()}))}else this._clearSelIndex()};MultiAutoComplete.prototype._addItem=function(e){if(this.selectedItems.indexOf(this.selectedItem)>-1)this._clearSelIndex();else if(this.selectedIndex>-1){this._updateSelItems(this.selectedItem,!0);this._refreshHeader();e&&this._clearSelIndex();this._disableInput(!0)}};MultiAutoComplete.prototype._delItem=function(e){var t,i,n=this._wjTpl.querySelector("."+MultiAutoComplete._clsActive),o=!1;if(!e||n){if(n){if((i=this._getItemIndex(n))>-1){t=this._selItems[i];o=!0}}else if(this._selItems.length>0){t=this._selItems[this._selItems.length-1];o=!0}var s=this._getItemText(t,!0),r=culture.MultiAutoComplete.ariaLabels.remove;this._screenReaderHelper.textContent=r+" "+s;if(o){this._updateSelItems(t,!1);this._refreshHeader();this._clearSelIndex();this._disableInput(!1)}this._tbx.focus()}};MultiAutoComplete.prototype._updateSelItems=function(e,t){if(t){this._selItems&&0!==this._selItems.length||(this._selItems=[]);if(null!=this._maxSelItems&&this._selItems.length>=this._maxSelItems)return;this._selItems.push(e)}else{var i=this._selItems.indexOf(e);this._selItems.splice(i,1)}this._hasSelectedMemeberPath()&&this._setSelItem(e,t);this.onSelectedItemsChanged()};MultiAutoComplete.prototype._createItem=function(e){var t=this,i=document.createElement("div"),n=document.createElement("span"),o=document.createElement("span");i.appendChild(n);i.appendChild(o);i.id=getSafeUniqueId(e);setAttribute(i,"aria-label",e);setAttribute(i,"role","button");i.className=MultiAutoCompleteClsNames.token;n.className=MultiAutoCompleteClsNames.tokenLabel;n.innerHTML=e;o.className=MultiAutoCompleteClsNames.tokenClose;o.tabIndex=-1;o.innerHTML="×";i.style.cssFloat=this.rightToLeft?"right":"left";this.addEventListener(i,"click",(function(e){t._helperInput.focus();setAttribute(t._helperInput,"aria-activedescendant",i.id);var n=t._wjTpl.querySelector("."+MultiAutoComplete._clsActive);n&&removeClass(n,MultiAutoComplete._clsActive);addClass(i,MultiAutoComplete._clsActive);e.stopPropagation();e.preventDefault()}));this.addEventListener(o,"click",(function(e){if(!t.isReadOnly){var n=t._getItemIndex(i);if(n>-1){var o=t._selItems[n];t._updateSelItems(o,!1)}t._wjTpl.removeChild(i);t._adjustInputWidth();t._disableInput(!1);t._tbx.focus();e.stopPropagation()}}));return i};MultiAutoComplete.prototype._itemOn=function(e){var t,i,n,o=getActiveElement();if((this._tbx!=o||0===this._tbx.value.length)&&0!==(t=this._wjTpl.querySelectorAll("."+MultiAutoCompleteClsNames.token)).length){i=this._wjTpl.querySelector("."+MultiAutoComplete._clsActive);n=this._getItemIndex(i);if(e){if(0===n)return;if(-1===n){addClass(t[t.length-1],MultiAutoComplete._clsActive);this._helperInput.focus();setAttribute(this._helperInput,"aria-activedescendant",t[t.length-1].id)}else{removeClass(i,MultiAutoComplete._clsActive);addClass(t[n-1],MultiAutoComplete._clsActive);this._helperInput.focus();setAttribute(this._helperInput,"aria-activedescendant",t[n-1].id)}}else if(!e){if(-1===n)return;if(n!==t.length-1){removeClass(i,MultiAutoComplete._clsActive);addClass(t[n+1],MultiAutoComplete._clsActive);this._helperInput.focus();setAttribute(this._helperInput,"aria-activedescendant",t[n+1].id)}else{removeClass(i,MultiAutoComplete._clsActive);this._tbx.focus();setAttribute(this._helperInput,"aria-activedescendant")}}}};MultiAutoComplete.prototype._itemOff=function(){var e=this._wjTpl.querySelector("."+MultiAutoComplete._clsActive);e&&removeClass(e,MultiAutoComplete._clsActive)};MultiAutoComplete.prototype._initSeltems=function(){if(this.selectedMemberPath){this._selItems.splice(0,this._selItems.length);var e=this.collectionView;if(e)for(var t=0;t<e.sourceCollection.length;t++)this._getSelItem(t)&&this._selItems.push(e.sourceCollection[t])}};MultiAutoComplete.prototype._getSelItem=function(e){var t=this.collectionView,i=t?t.sourceCollection[e]:null;return!(!isObject(i)||!this.selectedMemberPath)&&this._selPath.getValue(i)};MultiAutoComplete.prototype._setSelItem=function(e,t){this.itemsSource;isObject(e)&&this._selPath.getValue(e)!=t&&this._selPath.setValue(e,t)};MultiAutoComplete.prototype._clearSelIndex=function(){this.selectedIndex=-1};MultiAutoComplete.prototype._hasSelectedMemeberPath=function(){return this.selectedMemberPath&&""!==this.selectedMemberPath};MultiAutoComplete.prototype._disableInput=function(e){if(null!=this._maxSelItems)if(this._selItems.length<this._maxSelItems){this._tbx.disabled=!1;this._tbx.focus()}else{this._tbx.disabled=!0;this.hostElement.focus()}};MultiAutoComplete.prototype._adjustInputWidth=function(){this._tbx.style.width="60px";var e,t=getElementRect(this.hostElement),i=getElementRect(this._tbx),n=getComputedStyle(this._tbx),o=parseInt(n.paddingLeft,10),s=parseInt(n.paddingRight,10);e=this.rightToLeft?i.left+i.width-t.left-o-s-8:t.left+t.width-i.left-o-s-8;this._tbx.style.width=e+"px";this._tbx.placeholder?this._tbx.style.minWidth="max-content":this._tbx.style.minWidth=""};MultiAutoComplete.prototype._getItemIndex=function(e){for(var t=this.hostElement.querySelectorAll("."+MultiAutoCompleteClsNames.token),i=0;i<t.length;i++)if(e===t[i])return i;return-1};MultiAutoComplete.prototype._setIsDisabled=function(t){e.prototype._setIsDisabled.call(this,t);this._updateTabIndex()};MultiAutoComplete.prototype._setTabOrder=function(e){this._orgTabIndex=e;this._updateTabIndex()};MultiAutoComplete.prototype._updateTabIndex=function(){var e=this.hostElement;this._tbx.tabIndex=this.isDisabled?-1:this._orgTabIndex;e.tabIndex=-1};MultiAutoComplete._clsActive=MultiAutoCompleteClsNames.tokenActive;MultiAutoComplete._ctrlTemplate="";return MultiAutoComplete}(AutoComplete);export{MultiAutoComplete};_registerModule("wijmo.input",selfModule);
|
|
14
|
+
var __extends=this&&this.__extends||function(){var extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};return function(e,t){extendStatics(e,t);function __(){this.constructor=e}e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e}).apply(this,arguments)};import{_getModule,_addCultureInfo,culture,setAriaLabel,disableAutoComplete,isIE,isIE9,asBoolean,asString,asEnum,setSelectionRange,contains,getActiveElement,setAttribute,showPopup,hidePopup,hasClass,addClass,removeClass,toggleClass,removeChild,Control,Key,Event,EventArgs,CancelEventArgs,ControlStateClsNames,GlyphClsNames,ControlClsNames,InputFormElementsClsNames,isNullOrUndefined,tryCast,createElement,hasItems,isObject,isString,asArray,asFunction,asNumber,asType,asCollectionView,closest,escapeHtml,toPlainText,setCss,Binding,Rect,DateTime,assert,isFirefox,_CLS_STATE_DISABLED,UtilitesClsNames,_setAriaLabelBy,setInnerHTMLSafe,getUniqueId,isNumber,enable,isFunction,escapeRegExp,isSafari,setText,isDate,isBoolean,asDate,asInt,Globalize,_ClickRepeater,CollectionView,format,uidGenerator,moveFocus,_isMacOS,clamp,Color,roundTo,_getFocusableElements,_MaskProvider,getSpecialCharsRegex,isEmpty,isEdge,isMobile,setChecked,Point,isArray,getElementRect,getSafeUniqueId,PopupPosition,getElement,isUndefined,isiOS,_registerModule}from"@mescius/wijmo";import*as selfModule from"@mescius/wijmo.input";export var AutoCompleteClsNames={hostElement:"wj-autocomplete"};export var CalendarClsNames={buttonsOutside:"wj-btns-outside",calendarHeader:"wj-calendar-header",calendarMonth:"wj-calendar-month",calendarMultiMonth:"wj-calendar-multimonth",calendarOuter:"wj-calendar-outer",calendarYear:"wj-calendar-year",dayOtherMonth:"wj-day-othermonth",dayToday:"wj-day-today",dayWeekend:"wj-day-weekend",header:"wj-header",hostElement:"wj-calendar",monthSelect:"wj-month-select",weekAfter:"wj-week-after",weekBefore:"wj-week-before",yearPicker:"wj-yearpicker",focused:"wj-state-focus",selectedYear:"wj-select-year",confirmationButtonContainer:"wj-calendar-confirmation-button-container",button:"wj-calendar-button"};export var CollectionViewNavigatorClsNames={hostElement:"wj-collectionview-navigator",pager:"wj-pager"};export var ColorPickerClsNames={colorBox:"wj-colorbox",hostElement:"wj-colorpicker"};export var ComboBoxClsNames={hostElement:"wj-combobox",stateMatch:"wj-state-match"};export var DropDownClsNames={dropDownPanel:"wj-dropdown-panel",hostElement:"wj-dropdown"};export var InputClsNames={input:"wj-input",inputBtnVisible:"wj-input-btn-visible",inputGroup:"wj-input-group",inputGroupBtn:"wj-input-group-btn"};export var InputColorClsNames={hostElement:"wj-inputcolor",inputColorBox:"wj-inputcolorbox"};export var InputDateClsNames={hostElement:"wj-inputdate",inputDateDropDown:"wj-inputdate-dropdown",inputDateDropDownContainer:"wj-inputdate-dropdown-container"};export var InputDateRangeClsNames={hostElement:"wj-inputdaterange"};export var InputDateTimeClsNames={hostElement:"wj-inputdatetime",showDropDownButton:"wj-show-dropdown-button"};export var InputMaskClsNames={hostElement:"wj-inputmask"};export var InputNumberClsNames={hostElement:"wj-inputnumber",numeric:"wj-numeric",showSpinner:"wj-input-show-spinner"};export var InputTimeClsNames={hostElement:"wj-inputtime"};export var ListBoxClsNames={header:"wj-header",hostElement:"wj-listbox",listBoxItem:"wj-listbox-item"};export var MenuClsNames={hostElement:"wj-menu",menuItems:"wj-menu-items",subItems:"wj-subitems"};export var MultiAutoCompleteClsNames={hostElement:"wj-multi-autocomplete",token:"wj-token",tokenActive:"wj-token-active",tokenClose:"wj-token-close",tokenHelper:"wj-token-helper",tokenLabel:"wj-token-label",screenReaderOnly:"wj-sr-only"};export var MultiSelectClsNames={hostElement:"wj-multiselect"};export var MultiSelectListBoxClsNames={header:"wj-header",hostElement:"wj-multiselectlistbox",selectAll:"wj-select-all"};export var PopupClsNames={dialogHeader:"wj-dialog-header",hostElement:"wj-popup",popupBackDrop:"wj-popup-backdrop",dialogBody:"wj-dialog-body",dialogFooter:"wj-dialog-footer"};_addCultureInfo("InputNumber",{ariaLabels:{incVal:"Increase Value",decVal:"Decrease Value",inputNumberInput:"InputNumber Input",inputNumber:"Input Number"}});var InputNumber=function(e){__extends(InputNumber,e);function InputNumber(t,i){var n=e.call(this,t)||this;n._value=null;n._min=null;n._max=null;n._format="";n._step=null;n._showBtn=!0;n._readOnly=!1;n._handleWheel=!0;n._oldText="";n._fromKb=!0;n._inputElementAriaLabel=culture.InputNumber.ariaLabels.inputNumberInput;n._ariaLabelledby=null;n.textChanged=new Event;n.valueChanged=new Event;var o=n.getTemplate();n.applyTemplate(ControlClsNames.hostElement+" "+ControlClsNames.content+" "+InputNumberClsNames.hostElement,o,{_tbx:"input",_btnUp:"btn-inc",_btnDn:"btn-dec"},"input");var s=n.inputElement;n.hostElement;setAttribute(s,"role","spinbutton",!0);n._updateInputAriaLabel();var r=culture.InputNumber.ariaLabels;setAriaLabel(n._btnUp.querySelector("button"),r.incVal);setAriaLabel(n._btnDn.querySelector("button"),r.decVal);n._tbx.type.match(/number/i)&&(n.inputType="");var a=n._tbx;a.autocomplete="off";a.spellcheck=!1;n._updateSymbols();var l=n.addEventListener.bind(n);l(a,"keypress",n._keypress.bind(n));l(a,"keydown",n._keydown.bind(n));l(a,"input",n._input.bind(n));isMobile()&&l(a,"beforeinput",n._beforeinput.bind(n));l(a,"blur",(function(){n.text!=n._oldText&&n._setText(n.text)}));l(a,"paste",(function(){n._fromKb=!1}));l(a,"compositionstart",(function(){n._composing=!0}));l(a,"compositionend",(function(){n._composing=!1;setTimeout((function(){var e=n.text,t=n._oldText,i=n._chrPct;t&&t.indexOf(i)>-1&&e.indexOf(i)<0&&(e+=i);n._setText(e)}))}));var h=n._clickSpinner.bind(n);l(n._btnUp,"click",h);l(n._btnDn,"click",h);n._rptUp=new _ClickRepeater(n._btnUp.querySelector("button"));n._rptDn=new _ClickRepeater(n._btnDn.querySelector("button"));l(a,"wheel",(function(e){if(n.handleWheel&&!e.defaultPrevented&&!e.ctrlKey&&n._isEditable()&&n.containsFocus()){var t=clamp(-e.deltaY,-1,1);n._increment((n.step||1)*t);setTimeout((function(){return n.selectAll()}));e.preventDefault()}}));n.value=0;n.isRequired=!0;n.initialize(i);return n}Object.defineProperty(InputNumber,"controlTemplate",{get:function(){InputNumber._ctrlTemplate||(InputNumber._ctrlTemplate='<div class="'+ControlClsNames.template+'"><div class="'+InputClsNames.input+'"><div class="'+InputClsNames.inputGroup+'"><span wj-part="btn-dec" class="'+InputClsNames.inputGroupBtn+'" tabindex="-1"><button class="'+InputFormElementsClsNames.btn+" "+InputFormElementsClsNames.btnDefault+'" tabindex="-1">-</button></span><input type="tel" wj-part="input" class="'+InputFormElementsClsNames.formControl+" "+InputNumberClsNames.numeric+'"/><span wj-part="btn-inc" class="'+InputClsNames.inputGroupBtn+'" tabindex="-1"><button class="'+InputFormElementsClsNames.btn+" "+InputFormElementsClsNames.btnDefault+'" tabindex="-1">+</button></span></div></div></div>');return InputNumber._ctrlTemplate},set:function(e){InputNumber._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"inputElement",{get:function(){return this._tbx},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"inputType",{get:function(){return this._tbx.type},set:function(e){this._tbx.type=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"value",{get:function(){return this._value},set:function(e){if(e!=this._value)if(null==(e=asNumber(e,!this.isRequired||null==e&&null==this._value)))this._setText("");else if(!isNaN(e)){var t=Globalize.format(e,this.format);this._setText(t)}},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"isRequired",{get:function(){return this._tbx.required},set:function(e){this._tbx.required=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"isReadOnly",{get:function(){return this._readOnly},set:function(e){this._readOnly=asBoolean(e);this.inputElement.readOnly=this._readOnly;toggleClass(this.hostElement,ControlStateClsNames.readOnly,this.isReadOnly)},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"handleWheel",{get:function(){return this._handleWheel},set:function(e){this._handleWheel=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"min",{get:function(){return this._min},set:function(e){if(e!=this._min){this._min=asNumber(e,!0);this._updateAria()}},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"max",{get:function(){return this._max},set:function(e){if(e!=this._max){this._max=asNumber(e,!0);this._updateAria()}},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"step",{get:function(){return this._step},set:function(e){this._step=asNumber(e,!0);this._updateBtn()},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"format",{get:function(){return this._format},set:function(e){if(e!=this.format){this._format=asString(e);this.refresh()}},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"text",{get:function(){return this._tbx.value},set:function(e){if(e!=this.text){this._oldText=this.text;this._setText(e)}},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"placeholder",{get:function(){return this._tbx.placeholder},set:function(e){this._tbx.placeholder=e},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"showSpinner",{get:function(){return this._showBtn},set:function(e){this._showBtn=asBoolean(e);this._updateBtn()},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"repeatButtons",{get:function(){return!this._rptUp.disabled},set:function(e){this._rptUp.disabled=this._rptDn.disabled=!asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"ariaLabelledBy",{get:function(){return this._ariaLabelledby},set:function(e){_setAriaLabelBy(this,this._tbx,e,this._updateInputAriaLabel.bind(this))},enumerable:!0,configurable:!0});InputNumber.prototype.selectAll=function(){var e=this._tbx;setSelectionRange(e,0,e.value.length)};InputNumber.prototype.clamp=function(e){return clamp(e,this.min,this.max)};InputNumber.prototype.onTextChanged=function(e){this.textChanged.raise(this,e);this._updateState()};InputNumber.prototype.onValueChanged=function(e){this._updateAria();this.valueChanged.raise(this,e)};InputNumber.prototype.dispose=function(){this._rptUp.element=null;this._rptDn.element=null;e.prototype.dispose.call(this)};InputNumber.prototype.onGotFocus=function(t){this._oldValue=this.value;if(!this.isTouching){this._tbx.focus();this.selectAll()}e.prototype.onGotFocus.call(this,t)};InputNumber.prototype.onLostFocus=function(t){if(this._composing){this._composing=!1;this._setText(this.text)}if(this._isEditable()){var i=this.clamp(this.value);if(i==this.value||this.onInvalidInput(new CancelEventArgs)){var n=Globalize.format(i,this.format);this._setText(n)}}e.prototype.onLostFocus.call(this,t)};InputNumber.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);if(this.hostElement){this._updateSymbols();var i=Globalize.format(this.value,this.format);this._setText(i)}};InputNumber.prototype._isEditable=function(){return!this.isReadOnly&&!this.isDisabled};InputNumber.prototype._updateSymbols=function(){var e=culture.Globalize.numberFormat,t=Globalize._parseNumericFormat(this.format);this._chrDec=e["."]||".";this._chrTho=e[","]||",";this._chrNeg=e["-"]||"-";this._chrPls=e["+"]||"+";this._chrPct=e["%"]||"%";this._chrCur=t.curr||e.currency.symbol||"$";this._fmtSpc=t.spec;this._fmtPrc=t.prec;this._rxSym=new RegExp("^[%+\\-() \\"+this._chrDec+"\\"+this._chrCur+"\\"+this._chrNeg+"\\"+this._chrPls+"\\"+this._chrPct+"]*$");this._rxNeg=new RegExp("^\\s*(\\-|\\"+this._chrNeg+")|([^e](\\-|\\"+this._chrNeg+")|\\()")};InputNumber.prototype._isNumeric=function(e,t){var i=e==this._chrDec||e>="0"&&e<="9",n="x"==this._fmtSpc;!i&&n&&(i=e>="a"&&e<="f"||e>="A"&&e<="F");i||t||n||(i=e==this._chrPls||e==this._chrNeg||"("==e||")"==e);return i};InputNumber.prototype._getInputRange=function(e){for(var t=[0,0],i=this.text,n=!1,o=0;o<i.length;o++)if(this._isNumeric(i[o],e)){if(!n){t[0]=o;n=!0}t[1]=o+1}return t};InputNumber.prototype._flipSign=function(){var e=this._getSelStartDigits();this.value*=-1;this._setSelStartDigits(e)};InputNumber.prototype._getSelStartDigits=function(){for(var e=0,t=this._tbx.selectionStart,i=this._tbx.value,n=0;n<i.length&&n<t;n++)this._isNumeric(i[n],!0)&&e++;return e};InputNumber.prototype._setSelStartDigits=function(e){for(var t=this._tbx.value,i=0;i<t.length&&e>=0;i++)if(this._isNumeric(t[i],!0)){if(!e){setSelectionRange(this._tbx,i);break}e--}else if(!e){setSelectionRange(this._tbx,i);break}};InputNumber.prototype._increment=function(e){if(e){var t=this.clamp(isNumber(this.value)?this.value+e:0),i=Globalize.format(t,this.format,!1,!1);this._setText(i)}};InputNumber.prototype._updateBtn=function(){var e=this.showSpinner&&!!this.step,t=e;setCss([this._btnUp,this._btnDn],{display:e?"":"none"});toggleClass(this.hostElement,InputNumberClsNames.showSpinner,e);enable(this._btnUp,t);enable(this._btnDn,t);this._updateAria()};InputNumber.prototype._setText=function(e,t,i){void 0===t&&(t=!1);void 0===i&&(i=!1);if(!this._composing){var n=this._tbx,o=this._chrDec,s=this._rxNeg.test(e),r=this._delKey,a=this.containsFocus();e&&this._rxSym.test(e)&&a&&(e=this.isRequired||!r?(s?"-0":"0")+(e.indexOf(o)>-1?o:""):"");this._delKey=!1;r&&0==this.value&&!this.isRequired&&(e="");if(!e){if(!this.isRequired||i){n.value="";if(this._oldText){this._oldText=e;this.onTextChanged()}if(null!=this._value){this._value=null;this.onValueChanged()}this._updateBtn();return}e="0"}var l=e.indexOf(o),h=this._format||(l>-1?"n2":"n0"),u=Globalize.parseFloat(e,h);isFinite(u)||(u=this.clamp(u));if(isNaN(u))if(this.onInvalidInput(new CancelEventArgs))n.value=this._oldText;else{n.value=e;this.focus()}else{var c=a&&l>-1?2:null,p=Globalize.format(u,h,!1,t,c);s&&u>=0&&!r&&(p=this._chrNeg+p);a&&l>-1&&"g"==this._fmtSpc&&0!=this._fmtPrc&&(p=e).indexOf(o)<0&&(p+=o);if(n.value!=p){n.value=p;u=Globalize.parseFloat(p,h)}if(this.text!=this._oldText){this._oldText=this.text;this.onTextChanged()}if(u!=this._value){this._value=u;this.onValueChanged()}this._updateBtn();this._updateState()}}};InputNumber.prototype._handleDecimalInput=function(e){if(0===this._fmtPrc){e.preventDefault();return!0}var t=this._tbx,i=t.value.indexOf(this._chrDec);if(i>-1){e.preventDefault();var n=t.selectionStart<=i?i+1:i;setSelectionRange(t,n);return!0}return!1};InputNumber.prototype._beforeinput=function(e){if(!e.defaultPrevented&&!this._composing&&this._isEditable()){switch(e.data){case".":case this._chrDec:this._handleDecimalInput(e);return;case"+":case this._chrPls:this._handlePlusSign();e.preventDefault();return;case"-":case this._chrNeg:this._handleMinusSign();e.preventDefault();return}}};InputNumber.prototype._keypress=function(e){if(!e.defaultPrevented&&!this._composing&&this._isEditable()&&e.charCode&&!e.ctrlKey&&!e.metaKey&&e.keyCode!=Key.Enter){var t=this._tbx,i=String.fromCharCode(e.charCode);if(this._isNumeric(i,!1)){var n=t.maxLength;if(n>-1&&t.value.length>=n&&t.selectionEnd==t.selectionStart){e.preventDefault();return}var o=this._getInputRange(!0),s=t.selectionStart,r=t.selectionEnd;if(s<o[0]&&r<t.value.length){r=Math.max(r,o[0]);setSelectionRange(t,o[0],r)}if(s>=o[1]){var a=null!=this._fmtPrc?this._fmtPrc:2,l=t.value.indexOf(this._chrDec);l>-1&&s-l>a&&e.preventDefault()}}else e.preventDefault();switch(i){case"-":case this._chrNeg:this._handleMinusSign();e.preventDefault();break;case"+":case this._chrPls:this._handlePlusSign();e.preventDefault();break;case".":case this._chrDec:this._handleDecimalInput(e)}if(!e.defaultPrevented&&isIE()){var h=t.value;if((s=t.selectionStart)==(r=t.selectionEnd)){t.value=h.substr(0,s)+i+h.substr(r);setSelectionRange(t,s+1);e.preventDefault();this._input()}}}};InputNumber.prototype._handlePlusSign=function(){var e=this._tbx;(this.value<0||this._rxNeg.test(e.value))&&this._flipSign()};InputNumber.prototype._handleMinusSign=function(){var e=this._tbx;if(this.clamp(-1)>=0)this.value<0&&this._flipSign();else if(this.value&&e.selectionStart===e.selectionEnd)this._flipSign();else if(this.clamp(-1)<0){e.value=this._chrNeg;setSelectionRange(e,1)}};InputNumber.prototype._keydown=function(e){var t=this;this._delKey=!1;if(!e.defaultPrevented&&!this._composing){var i=hasClass(this._tbx,"wj-grid-ime");if(!i||e.keyCode==Key.Back||e.keyCode==Key.Delete){var n=this._tbx,o=n.value,s=n.selectionStart,r=n.selectionEnd;switch(e.keyCode){case 65:if(e.ctrlKey){setTimeout((function(){t.selectAll()}));e.preventDefault()}break;case Key.Up:case Key.Down:if(this.step&&this._isEditable()){this._increment(this.step*(e.keyCode==Key.Up?1:-1));setTimeout((function(){t.selectAll()}));e.preventDefault()}break;case Key.Back:this._delKey=!0;if(r-s<2&&this._isEditable()){var a=o[r-1];if(a==this._chrDec||a==this._chrPct||a==this._chrTho||")"==a){setTimeout((function(){r=a==t._chrPct?t._getInputRange(!0)[1]:r-1;setSelectionRange(n,r)}));e.preventDefault()}}break;case Key.Delete:this._delKey=!0;if(r-s<2&&this._isEditable())if("0"==o&&1==s)setSelectionRange(n,0);else{var l=o[s];if(l==this._chrDec||l==this._chrPct){setTimeout((function(){setSelectionRange(n,s+1)}));e.preventDefault()}}break;case Key.Escape:this.value=this._oldValue;this.selectAll()}i&&this._delKey&&this._isEditable()&&this._setText(null,!1,!0)}}};InputNumber.prototype._input=function(){var e=this;this._composing?this._fromKb=!0:setTimeout((function(){var t=e._tbx,i=t.value,n=i.indexOf(e._chrDec),o=t.selectionStart,s=e._getSelStartDigits();"p"==e._fmtSpc&&i.length&&i.indexOf(e._chrPct)<0&&(i+=e._chrPct);e._setText(i,e._fromKb);e._fromKb=!0;if(e.containsFocus()){var r=t.value,a=r.indexOf(e._chrDec),l=e._getInputRange(!0);if(i==e._chrNeg+e._chrDec&&a>-1){setSelectionRange(t,a+1);return}if(i[0]==e._chrNeg&&r[0]!=e._chrNeg){if(1==r.length)setSelectionRange(t,1);else{"c"===e._fmtSpc&&e._isNegativeCurrencyByParenthesis(i)&&(s-=1);e._setSelStartDigits(s)}return}i?i==e._chrDec&&a>-1?o=a+1:o<=n&&a>-1||n<0&&a<0?o+=r.length-i.length:n<0&&a>-1&&(o=a):o=a>-1?a:l[1];o=clamp(o,l[0],l[1]);setSelectionRange(t,o)}}))};InputNumber.prototype._isNegativeCurrencyByParenthesis=function(e){return e.length>1&&e[1]===this._chrCur};InputNumber.prototype._clickSpinner=function(e){var t=this;if(!e.defaultPrevented&&this._isEditable()&&this.step){this._increment(this.step*(contains(this._btnUp,e.target)?1:-1));if(!this.isTouching){Control.sharedState.InvalidScroll=isEdge();setTimeout((function(){return t.selectAll()}))}}};InputNumber.prototype._updateAria=function(){var e=this.inputElement;if(this.hostElement){setAttribute(e,"aria-valuemin",this.min);setAttribute(e,"aria-valuemax",this.max);setAttribute(e,"aria-valuenow",this.value);setAttribute(e,"aria-valuetext",this.text);setAttribute(e,"step",this.step);enable(this._btnDn,null==this.min||this.value>this.min);enable(this._btnUp,null==this.max||this.value<this.max)}};InputNumber.prototype._updateInputAriaLabel=function(){var e=this.inputElement;this._ariaLabelledby?setAttribute(e,"aria-label",null):setAttribute(e,"aria-label",this._inputElementAriaLabel)};InputNumber.prototype.getAriaLabelForScreenReader=function(){return culture.InputNumber.ariaLabels.inputNumber};InputNumber._ctrlTemplate="";return InputNumber}(Control);export{InputNumber};_addCultureInfo("InputMask",{ariaLabels:{inputMaskInput:"InputMask Input",inputMask:"Input Mask"}});var InputMask=function(e){__extends(InputMask,e);function InputMask(t,i){var n=e.call(this,t)||this;n._fullEdit=!1;n._inputElementAriaLabel=culture.InputMask.ariaLabels.inputMaskInput;n._ariaLabelledby=null;n.valueChanged=new Event;var o=n.getTemplate();n.applyTemplate(ControlClsNames.hostElement+" "+ControlClsNames.content+" "+InputMaskClsNames.hostElement,o,{_tbx:"input"},"input");if("INPUT"==n._orgTag){var s=n._tbx.getAttribute("value");s&&(n.value=s)}n._msk=new _MaskProvider(n._tbx);n.isRequired=!0;n.initialize(i);n.addEventListener(n._tbx,"input",(function(){n.onValueChanged()}));n.addEventListener(n._tbx,"blur",n._commitText.bind(n));n.addEventListener(n._tbx,"keydown",(function(e){e.keyCode==Key.Enter&&n._commitText()}));n._updateInputAriaLabel();return n}Object.defineProperty(InputMask,"controlTemplate",{get:function(){InputMask._ctrlTemplate||(InputMask._ctrlTemplate='<div class="'+InputClsNames.input+'"><div class="'+InputClsNames.inputGroup+'"><input wj-part="input" class="'+InputFormElementsClsNames.formControl+'"/></div></div>');return InputMask._ctrlTemplate},set:function(e){InputMask._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"inputElement",{get:function(){return this._tbx},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"inputType",{get:function(){return this._tbx.type},set:function(e){this._tbx.type=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"value",{get:function(){return this._tbx.value},set:function(e){if(e!=this.value){this._tbx.value=asString(e);e=this._msk._applyMask();this._tbx.value=e;this.onValueChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"rawValue",{get:function(){return this._msk.getRawValue()},set:function(e){e!=this.rawValue&&(this.value=asString(e))},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"mask",{get:function(){return this._msk.mask||""},set:function(e){var t=this.value;this._msk.mask=asString(e);this.value!=t&&this.onValueChanged()},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"promptChar",{get:function(){return this._msk.promptChar},set:function(e){var t=this.value;this._msk.promptChar=e;this.value!=t&&this.onValueChanged()},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"overwriteMode",{get:function(){return this._msk.overwriteMode},set:function(e){this._msk.overwriteMode=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"placeholder",{get:function(){return this._tbx.placeholder},set:function(e){this._tbx.placeholder=e},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"maskFull",{get:function(){return this._msk.maskFull},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"isRequired",{get:function(){return this._tbx.required},set:function(e){this._tbx.required=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"isReadOnly",{get:function(){return this._tbx.readOnly},set:function(e){this._tbx.readOnly=asBoolean(e);toggleClass(this.hostElement,ControlStateClsNames.readOnly,this.isReadOnly)},enumerable:!0,configurable:!0});InputMask.prototype.selectAll=function(){var e=this._msk.getMaskRange();setSelectionRange(this._tbx,e[0],e[1]+1)};InputMask.prototype.onValueChanged=function(e){if(this.value!=this._oldValue){this._oldValue=this.value;this.valueChanged.raise(this,e)}this._updateState()};InputMask.prototype._commitText=function(){(this.rawValue||this.isRequired)&&(this.maskFull||this.onInvalidInput(new CancelEventArgs));this._updateState()};InputMask.prototype.dispose=function(){this._msk.input=null;e.prototype.dispose.call(this)};InputMask.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);this.hostElement&&this._msk.refresh()};InputMask.prototype.onGotFocus=function(t){this.selectAll();e.prototype.onGotFocus.call(this,t)};Object.defineProperty(InputMask.prototype,"ariaLabelledBy",{get:function(){return this._ariaLabelledby},set:function(e){_setAriaLabelBy(this,this._tbx,e,this._updateInputAriaLabel.bind(this))},enumerable:!0,configurable:!0});InputMask.prototype._updateInputAriaLabel=function(){var e=this.inputElement;!e||e.id||this._ariaLabelledby?setAttribute(e,"aria-label",null):setAttribute(e,"aria-label",this._inputElementAriaLabel)};InputMask.prototype.getAriaLabelForScreenReader=function(){return culture.InputMask.ariaLabels.inputMask};InputMask._ctrlTemplate="";return InputMask}(Control);export{InputMask};_addCultureInfo("ColorPicker",{ariaLabels:{colorPicker:"Color Picker",satAndBrightnessPanel:"Color saturation and brightness panel",huePanel:"Color hue panel",opacityPanel:"Color opacity panel",palettePanel:"Color palette panel",saturation:"Saturation:",hue:"Hue:",opacity:"Opacity:",degrees:"degrees",brightness:"Brightness:",baseColor:"Base color:",shadeColor:"Shade color:"}});export var ColorPickerTabKeyAction;!function(e){e[e.None=0]="None";e[e.All=1]="All"}(ColorPickerTabKeyAction||(ColorPickerTabKeyAction={}));var ColorPicker=function(e){__extends(ColorPicker,e);function ColorPicker(t,i){var n=e.call(this,t)||this;n._hsb=[.5,1,1];n._alpha=1;n._ariaLabel=culture.ColorPicker.ariaLabels.colorPicker;n.valueChanged=new Event;n.hostElement.setAttribute("role","application");n.hostElement.setAttribute("aria-label",culture.ColorPicker.ariaLabels.colorPicker);var o=n.getTemplate();n.applyTemplate(ControlClsNames.hostElement+" "+ControlClsNames.content+" "+ColorPickerClsNames.hostElement,o,{_eSB:"div-sb",_eHue:"div-hue",_eAlpha:"div-alpha",_ePreview:"div-pv",_ePal:"div-pal",_eText:"div-text"});n._palette="#FFF,#000,#F00,#FFC000,#FFFF00,#92D050,#00B050,#00B0F0,#0070C0,#7030A0".split(",");n._updatePalette();n._eHue.style.backgroundImage="url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAD4CAIAAACi6hsPAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAYdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuM4zml1AAAAGvSURBVDhPXdBPaM9xHMfxz4pWaxcmtoOhpdXSVpiyHWxqmVpDjaU5rK34XfypjTJ/p+ZPay6jhsOsRrKwaJElf9IQq03WIkv4FeMwMq221tfje1ByeFzfvd7PEKWGEKWTQRZLySWfVRRTQjmVbKWGOhLsZT+HaeY0bbTTQSfdXOcWffTzmAFeMcwoYyT5ygS/mA5hNgphip98J8kHRnnNSwZ4yH1uc4OrdHGR87RximYO0cgedlLLdqqoYAPrWMtKVrCcJSxiPmnMJUQp/Bsyk2xyyKOAQooopYwKtlDNDur5G7SBJo7RQiv/B+2hl3s84CkvGGKEOOYnxolj/mYmhBmDJ5ngCx95xxsGecYj4pB3iENeoZMO2mmlhaMcpIE4ZII6aqhmM3HMMkooopB88sghm0wySCeVlCjMCVFIYx4LWUwOeRSwhmLWU84mqqihll3sppEmjnOSs5zjEl1c4yZ99POE5wwxwns+840fTDFLFKaZZIJxkozxlmEGGSC+GF++Sy89dHOZC8Rr4lVnOMERDrCPBPXEX22jko2UEn+/mnxyWUYWC0gnNUQh/AEc0HJs6cex0gAAAABJRU5ErkJggg==)";n._eHue.style.backgroundSize="contain";if(navigator.appVersion.indexOf("MSIE 9")>-1){n._eSB.children[0].style.filter="progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffffffff,endColorstr=#00ffffff,GradientType=1)";n._eSB.children[1].style.filter="progid:DXImageTransform.Microsoft.gradient(startColorstr=#00000000,endColorstr=#ff000000,GradientType=0)"}o=ColorPicker._tplCursor;n._cSB=createElement(o);n._cHue=createElement(o);n._cHue.style.width="100%";n._cAlpha=createElement(o);n._cAlpha.style.height="100%";n._eSB.appendChild(n._cSB);n._eHue.appendChild(n._cHue);n._eAlpha.appendChild(n._cAlpha);n._keyActionTab=ColorPickerTabKeyAction.None;var s=n.addEventListener.bind(n),r=n.removeEventListener.bind(n),a=document;s(n.hostElement,"mousedown",(function(e){s(a,"mousemove",mouseMove);s(a,"mouseup",mouseUp);n._mouseDown(e)}));s(n.hostElement,"touchstart",(function(e){s(a,"touchmove",mouseMove);s(a,"touchend",mouseUp);n._mouseDown(e)}));var mouseMove=function(e){n._mouseMove(e)},mouseUp=function(e){r(a,"mousemove",mouseMove);r(a,"mouseup",mouseUp);r(a,"touchmove",mouseMove);r(a,"touchend",mouseUp);n._mouseUp(e)};s(n.hostElement,"click",(function(e){if(!n.isDisabled){var t=e.target;if(t&&"DIV"==t.tagName&&contains(n._ePal,t)){var i=t.style.backgroundColor;i&&(n.value=new Color(i).toString());t.focus()}}}));s(n.hostElement,"keydown",(function(e){n.isDisabled||n._keydown(e)}));n.value="#ffffff";n.initialize(i);n._updatePanels();n._eSB.setAttribute("role","slider");n._eSB.setAttribute("aria-label",culture.ColorPicker.ariaLabels.satAndBrightnessPanel);n._eSB.setAttribute("aria-valuemin","0");n._eSB.setAttribute("aria-valuemax","100");n._eHue.setAttribute("role","slider");n._eHue.setAttribute("aria-label",culture.ColorPicker.ariaLabels.huePanel);n._eHue.setAttribute("aria-valuemin","0");n._eHue.setAttribute("aria-valuemax","360");n._eAlpha.setAttribute("role","slider");n._eAlpha.setAttribute("aria-label",culture.ColorPicker.ariaLabels.opacityPanel);n._eAlpha.setAttribute("aria-valuemin","0");n._eAlpha.setAttribute("aria-valuemax","100");n._ePal.setAttribute("role","grid");n._ePal.setAttribute("aria-label",culture.ColorPicker.ariaLabels.palettePanel);n._updateTabIndex();return n}Object.defineProperty(ColorPicker,"controlTemplate",{get:function(){ColorPicker._ctrlTemplate||(ColorPicker._ctrlTemplate='<div style="position:relative;width:100%;height:100%"><div style="float:left;width:50%;height:100%;box-sizing:border-box;padding:2px"><div wj-part="div-pal"><div style="float:left;width:10%;box-sizing:border-box;padding:2px"><div style="background-color:black;width:100%"></div><div style="height:6px"></div></div></div><div wj-part="div-text" style="position:absolute;bottom:0px;display:none"></div></div><div style="float:left;width:50%;height:100%;box-sizing:border-box;padding:2px"><div wj-part="div-sb" class="'+ColorPickerClsNames.colorBox+'" style="float:left;width:89%;height:89%"><div style="position:absolute;width:100%;height:100%;background:linear-gradient(to right, white 0%,transparent 100%)"></div><div style="position:absolute;width:100%;height:100%;background:linear-gradient(to top, black 0%,transparent 100%)"></div></div><div style="float:left;width:1%;height:89%"></div><div style="float:left;width:10%;height:89%"><div wj-part="div-hue" class="'+ColorPickerClsNames.colorBox+'"></div></div><div style="float:left;width:89%;height:1%"></div><div style="float:left;width:89%;height:10%"><div style="width:100%;height:100%;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAIAAABLbSncAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAYdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuM4zml1AAAAAcSURBVBhXY/iPBBYgAWpKQGkwgMqDAdUk/v8HAM7Mm6GatDUYAAAAAElFTkSuQmCC)"><div wj-part="div-alpha" class="'+ColorPickerClsNames.colorBox+'"></div></div></div><div style="float:left;width:1%;height:10%"></div><div style="float:left;width:10%;height:10%"><div wj-part="div-pv" class="'+ColorPickerClsNames.colorBox+'" style="position:static"></div></div></div></div>');return ColorPicker._ctrlTemplate},set:function(e){ColorPicker._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(ColorPicker.prototype,"showAlphaChannel",{get:function(){return"none"!=this._eAlpha.parentElement.style.display},set:function(e){this._eAlpha.parentElement.style.display=asBoolean(e)?"":"none"},enumerable:!0,configurable:!0});Object.defineProperty(ColorPicker.prototype,"showColorString",{get:function(){return"none"!=this._eText.style.display},set:function(e){this._eText.style.display=asBoolean(e)?"":"none";if(asBoolean(e)){this._eText.setAttribute("role","status");this._eText.setAttribute("aria-live","polite")}},enumerable:!0,configurable:!0});Object.defineProperty(ColorPicker.prototype,"value",{get:function(){return this._value},set:function(e){if(e!=this.value){var t=this.value,i=(e=asString(e)).trim(),n=Color.fromString(i);if(n){var o=n.getHsb();this._value=i;this._eText.innerText=i;if(this._hsb[0]!=o[0]||this._hsb[1]!=o[1]||this._hsb[2]!=o[2]||this._alpha!=n.a){if(0==o[2]){o[0]=this._hsb[0];o[1]=this._hsb[1]}else 0==o[1]&&(o[0]=this._hsb[0]);this._hsb=o;this._alpha=n.a;this.onValueChanged()}else""===t&&this.onValueChanged()}else if(""===i){var s=new Color(e);this._hsb=s.getHsb();this._alpha=s.a;this._value=e;this._eText.innerText=i;this.onValueChanged()}}},enumerable:!0,configurable:!0});Object.defineProperty(ColorPicker.prototype,"palette",{get:function(){return this._palette},set:function(e){if((e=(e=asArray(e)).slice(0,10)).every((function(e){return null!=Color.fromString(e)}))){this._palette=e;this._updatePalette()}},enumerable:!0,configurable:!0});Object.defineProperty(ColorPicker.prototype,"ariaLabel",{get:function(){return this._ariaLabel},set:function(e){if(e!=this._ariaLabel){this._ariaLabel=e;setAttribute(this.hostElement,"aria-label",this._ariaLabel)}},enumerable:!0,configurable:!0});Object.defineProperty(ColorPicker.prototype,"keyActionTab",{get:function(){return this._keyActionTab},set:function(e){this._keyActionTab=e;if(e==ColorPickerTabKeyAction.All){this.tabOrder=0;this.hostElement.setAttribute("tabindex","-1")}this._updateTabIndex()},enumerable:!0,configurable:!0});ColorPicker.prototype._setTabOrder=function(t){e.prototype._setTabOrder.call(this,t);this.isDisabled||this._updateTabIndex()};ColorPicker.prototype.onValueChanged=function(e){this._refreshSelection();this.valueChanged.raise(this,e)};ColorPicker.prototype._mouseDown=function(e){this._htDown=this._getTargetPanel(e);if(this._htDown){e.preventDefault();this._htDown.focus();this._mouseMove(e)}};ColorPicker.prototype._mouseMove=function(e){if(!this.isDisabled){var t=e.touches?e.touches[0]:e,i=this._htDown;if(i){var n=i.getBoundingClientRect(),o=this._hsb.slice(),s=this._alpha;if(i==this._eHue)o[0]=clamp((t.clientY-n.top)/n.height,0,.99);else if(i==this._eSB){o[1]=clamp((t.clientX-n.left)/n.width,0,1);o[2]=clamp(1-(t.clientY-n.top)/n.height,0,1)}else i==this._eAlpha&&(s=clamp((t.clientX-n.left)/n.width,0,1));this._updateColor(o,s)}}};ColorPicker.prototype._mouseUp=function(e){this._htDown=null};ColorPicker.prototype._updateColor=function(e,t){void 0===e&&(e=this._hsb);void 0===t&&(t=this._alpha);var i=this._hsb[0]!==e[0]||this._hsb[1]!==e[1]||this._hsb[2]!==e[2],n=this._alpha!==t;if(i||n){this._hsb=e;this._alpha=t;var o=Color.fromHsb(e[0],e[1],e[2],t);this._value=o.toString();this._eText.innerText=this._value;this.onValueChanged()}};ColorPicker.prototype._updatePalette=function(){var e=this,t=new Color("#fff"),i=new Color("#000");this._ePal.innerHTML="";this._ePal.className="palette-grid";for(var n=Array.from({length:6},(function(){var e=document.createElement("div");e.className="palette-row";e.setAttribute("role","row");return e})),o=this.getActualTabIndex(),s=0;s<this._palette.length;s++){var r=new Color(this._palette[s]),a=r.getHsb(),l=this._makePalEntry(r);l.innerHTML="​";l.setAttribute("role","columnheader");l.setAttribute("aria-label",culture.ColorPicker.ariaLabels.baseColor+" "+r.toString());if(0===s){this._ePalMainFirst=l;this._ePalMainFirst.setAttribute("tabindex",o)}else l.setAttribute("tabindex","-1");n[0].appendChild(l);for(var h=0;h<5;h++){var u=0===a[1]?Color.interpolate(t,i,.1*h+(a[2]>.5?.05:.55)):Color.fromHsb(a[0],.1+.2*h,1-.1*h),c=this._makePalEntry(u);c.setAttribute("role","gridcell");c.setAttribute("aria-label",culture.ColorPicker.ariaLabels.shadeColor+" "+u.toString());if(0===s&&0===h){this._ePalShadeFirst=c;this._ePalShadeFirst.setAttribute("tabindex",o)}else setAttribute(c,"tabindex","-1");n[h+1].appendChild(c)}}n.forEach((function(t){e._ePal.appendChild(t)}))};ColorPicker.prototype._makePalEntry=function(e){var t=document.createElement("div");t.className="palette-gridcell";setCss(t,{backgroundColor:e.toString()});return t};ColorPicker.prototype._updatePanels=function(){var e=Color.fromHsb(this._hsb[0],1,1,1),t=Color.fromHsb(this._hsb[0],this._hsb[1],this._hsb[2],1);this._eSB.style.backgroundColor=e.toString();this._eAlpha.style.background="linear-gradient(to right, transparent 0%, "+t.toString()+" 100%)";navigator.appVersion.indexOf("MSIE 9")>-1&&(this._eAlpha.style.filter="progid:DXImageTransform.Microsoft.gradient(startColorstr=#00000000,endColorstr="+t.toString()+", GradientType = 1)");var i=this.value.trim();this._ePreview.style.backgroundColor=i;this._cHue.style.top=(100*this._hsb[0]).toFixed(0)+"%";this._cSB.style.left=(100*this._hsb[1]).toFixed(0)+"%";this._cSB.style.top=(100-100*this._hsb[2]).toFixed(0)+"%";this._cAlpha.style.left=(100*this._alpha).toFixed(0)+"%";var n=this.getColorsDiv(),o=getActiveElement();if(this.keyActionTab===ColorPickerTabKeyAction.All&&!this.hostElement.contains(o)){if(this.isDisabled)return;for(var s=!1,r=0;r<n.length;r++){var a=n[r].style.backgroundColor;if(Color.fromString(i).equals(Color.fromString(a))){n[r].focus();s=!0;break}}s||n[0].focus()}};ColorPicker.prototype.getColorsDiv=function(){var e=Array.from(this._ePal.querySelectorAll('[role="columnheader"]')),t=Array.from(this._ePal.querySelectorAll('[role="gridcell"]'));return e.concat(t)};ColorPicker.prototype._getTargetPanel=function(e){var t=e.target;return contains(this._eSB,t)?this._eSB:contains(this._eHue,t)?this._eHue:contains(this._eAlpha,t)?this._eAlpha:null};ColorPicker.prototype.getActualTabIndex=function(){var e=this.tabOrder.toString();return this.keyActionTab===ColorPickerTabKeyAction.All&&!0!==this.isDisabled?e:"-1"};ColorPicker.prototype._updateTabIndex=function(){var e=this.getActualTabIndex();this._eSB.setAttribute("tabindex",e);this._eHue.setAttribute("tabindex",e);this._eAlpha.setAttribute("tabindex",e);this._ePalMainFirst.setAttribute("tabindex",e);this._ePalShadeFirst.setAttribute("tabindex",e)};ColorPicker.prototype._setIsDisabled=function(t){e.prototype._setIsDisabled.call(this,t);this._updateTabIndex()};ColorPicker.prototype._updateAriaValues=function(){var e=this._hsb;this._eSB.setAttribute("aria-valuenow",(100*e[1]).toString());this._eSB.setAttribute("aria-valuetext",culture.ColorPicker.ariaLabels.saturation+" "+Math.round(100*e[1])+"%, "+culture.ColorPicker.ariaLabels.brightness+" "+Math.round(100*e[2])+"%");this._eHue.setAttribute("aria-valuenow",(360*e[0]).toString());this._eHue.setAttribute("aria-valuetext",culture.ColorPicker.ariaLabels.hue+" "+Math.round(360*e[0])+" "+culture.ColorPicker.ariaLabels.degrees);this._eAlpha.setAttribute("aria-valuenow",(100*this._alpha).toString());this._eAlpha.setAttribute("aria-valuetext",culture.ColorPicker.ariaLabels.opacity+" "+Math.round(100*this._alpha)+"%")};ColorPicker.prototype._keydown=function(e){var t=e.target;this._isInColorPalette(t)?this._handleColorNavigation(e,t):t!==this._eSB?t!==this._eHue?t!==this._eAlpha||this._handleAlphaNavigation(e):this._handleHSBNavigation(e,"hue"):this._handleHSBNavigation(e,"sb")};ColorPicker.prototype._isInColorPalette=function(e){return e&&"DIV"===e.tagName&&contains(this._ePal,e)};ColorPicker.prototype._handleColorNavigation=function(e,t){var i=this.getColorsDiv(),n=this.palette.length,o=i.findIndex((function(e){return e===t})),s=null;switch(e.key){case"ArrowDown":o<i.length-1&&(s=i[o+n]);break;case"ArrowUp":o>0&&(s=i[o-n]);break;case"ArrowRight":var r=o+1;r<i.length&&(s=i[r]);break;case"ArrowLeft":var a=o-1;a>=0&&(s=i[a])}if(s){var l=s.style.backgroundColor;l&&(this.value=new Color(l).toString());s.focus();e.preventDefault()}};ColorPicker.prototype._handleHSBNavigation=function(e,t){var i=this._hsb.slice();i=i.map((function(e){return roundTo(e,2)}));var adjust=function(e,t,n){var o=Math.round(100*i[e]);i[e]=clamp((o+t)/100,0,n)};switch(e.key){case"ArrowLeft":"sb"===t&&adjust(1,-1,1);break;case"ArrowRight":"sb"===t&&adjust(1,1,1);break;case"ArrowUp":"sb"===t?adjust(2,1,1):adjust(0,-1,.99);break;case"ArrowDown":"sb"===t?adjust(2,-1,1):adjust(0,1,.99)}if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(e.key)){this._updateColor(i,void 0);e.preventDefault()}};ColorPicker.prototype._refreshSelection=function(){this._updatePanels();this._updateAriaValues()};ColorPicker.prototype._handleAlphaNavigation=function(e){var t=this._alpha;switch(e.key){case"ArrowLeft":t=clamp(t-.01,0,1);break;case"ArrowRight":t=clamp(t+.01,0,1);break;default:return}this._updateColor(void 0,t);e.preventDefault()};ColorPicker._ctrlTemplate="";ColorPicker._tplCursor='<div class="wj-colorpicker-cursor"></div>';return ColorPicker}(Control);export{ColorPicker};_addCultureInfo("CollectionViewNavigator",{ariaLabels:{byPage:{btnFirst:"Navigate to first page",btnPrev:"Navigate to previous page",btnNext:"Navigate to next page",btnLast:"Navigate to last page"},byItem:{btnFirst:"Navigate to first item",btnPrev:"Navigate to previous item",btnNext:"Navigate to next item",btnLast:"Navigate to last item"}}});var CollectionViewNavigator=function(e){__extends(CollectionViewNavigator,e);function CollectionViewNavigator(t,i){var n=e.call(this,t)||this;n._view=null;n._byPage=!1;n._fmt="{current:n0} / {count:n0}";n._liveRegionON=!1;n._ariaLabel="";var o=n.getTemplate();n.applyTemplate(ControlClsNames.hostElement+" "+ControlClsNames.content+" "+CollectionViewNavigatorClsNames.pager+" "+CollectionViewNavigatorClsNames.hostElement,o,{_btnFirst:"btn-first",_btnPrev:"btn-prev",_txtCurr:"txt-curr",_btnNext:"btn-next",_btnLast:"btn-last"},"input");n.hostElement.tabIndex=-1;n._updateAriaLabels();var s=uidGenerator();n._txtCurr.id=s;[n._btnFirst,n._btnPrev,n._btnNext,n._btnLast].forEach((function(e){setAttribute(e.firstElementChild,"aria-controls",n._txtCurr.id)}));setAttribute(n.hostElement.firstElementChild,"role","group");setAttribute(n._txtCurr,"role","status");n._rptNext=new _ClickRepeater(n._btnNext.querySelector("button"));n._rptPrev=new _ClickRepeater(n._btnPrev.querySelector("button"));n.addEventListener(n.hostElement,"click",n._click.bind(n));n.addEventListener(n.hostElement,"keydown",n._keydown.bind(n));setAttribute(n.hostElement,"role","navigation");n._addA11yRelatedHandlers();n.initialize(i);n._update();return n}Object.defineProperty(CollectionViewNavigator,"controlTemplate",{get:function(){CollectionViewNavigator._ctrlTemplate||(CollectionViewNavigator._ctrlTemplate='<div class="'+InputClsNames.inputGroup+'"><span wj-part="btn-first" class="'+InputClsNames.inputGroupBtn+'"><button class="'+InputFormElementsClsNames.btn+" "+InputFormElementsClsNames.btnDefault+'"><span class="'+GlyphClsNames.stepBackward+'"></span></button></span><span wj-part="btn-prev" class="'+InputClsNames.inputGroupBtn+'"> <button class="'+InputFormElementsClsNames.btn+" "+InputFormElementsClsNames.btnDefault+'"><span class="'+GlyphClsNames.left+'"></span> </button></span><span wj-part="txt-curr" tabIndex="0"></span><span wj-part="btn-next" class="'+InputClsNames.inputGroupBtn+'"><button class="'+InputFormElementsClsNames.btn+" "+InputFormElementsClsNames.btnDefault+'"><span class="'+GlyphClsNames.right+'"></span></button></span><span wj-part="btn-last" class="'+InputClsNames.inputGroupBtn+'"><button class="'+InputFormElementsClsNames.btn+" "+InputFormElementsClsNames.btnDefault+'"><span class="'+GlyphClsNames.stepForward+'"></span></button></span></div>');return CollectionViewNavigator._ctrlTemplate},set:function(e){CollectionViewNavigator._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(CollectionViewNavigator.prototype,"cv",{get:function(){return this._view},set:function(e){if(e!=this._view){var t=this._view;if(t){t.collectionChanged.removeHandler(this._collectionChanged);t.currentChanged.removeHandler(this._currentChanged)}t=this._view=asType(e,"ICollectionView",!0);this._update();if(t){t.collectionChanged.addHandler(this._collectionChanged,this);t.currentChanged.addHandler(this._currentChanged,this)}}},enumerable:!0,configurable:!0});Object.defineProperty(CollectionViewNavigator.prototype,"byPage",{get:function(){return this._byPage},set:function(e){if(e!=this._byPage){this._byPage=asBoolean(e);this._update();this._updateAriaLabels()}},enumerable:!0,configurable:!0});Object.defineProperty(CollectionViewNavigator.prototype,"headerFormat",{get:function(){return this._fmt},set:function(e){if(e!=this._fmt){this._fmt=asString(e);this._update()}},enumerable:!0,configurable:!0});Object.defineProperty(CollectionViewNavigator.prototype,"repeatButtons",{get:function(){return!this._rptNext.disabled},set:function(e){this._rptNext.disabled=this._rptPrev.disabled=!asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(CollectionViewNavigator.prototype,"ariaLabel",{get:function(){if(this.hostElement){var e=this.hostElement.getAttribute("aria-label");if(e)return e}return this._ariaLabel},set:function(e){if(this.ariaLabel!==e){this._ariaLabel=e;this.hostElement&&setAttribute(this.hostElement,"aria-label",e)}},enumerable:!0,configurable:!0});Object.defineProperty(CollectionViewNavigator.prototype,"isDisabled",{get:function(){return this._isDisabled},set:function(e){this._setIsDisabled(e)},enumerable:!0,configurable:!0});CollectionViewNavigator.prototype.focus=function(){var e=this._e;e&&e.offsetHeight&&(this.isDisabled||moveFocus(e,0)||this._txtCurr.tabIndex>=0&&this._txtCurr.focus())};CollectionViewNavigator.prototype._update=function(){var e=this._view,t=this._byPage,i=e?t?e.pageIndex:e.currentPosition:0,n=e?t?e.pageCount:e.itemCount:0;if(this.isDisabled)[this._btnFirst,this._btnPrev,this._btnNext,this._btnLast].forEach((function(e){enable(e,!1)}));else{enable(this._btnFirst,e&&i>0);enable(this._btnPrev,e&&i>0);enable(this._txtCurr,null!=e);enable(this._btnNext,e&&i<n-1);enable(this._btnLast,e&&i<n-1)}this._updateTabIndex();this._txtCurr.textContent=format(this._fmt,{current:e?i+1:0,count:e?n:0,currentItem:e?e.currentPosition+1:0,itemCount:e?e.itemCount:0,currentPage:e?e.pageIndex+1:0,pageCount:e?e.pageCount:0})};CollectionViewNavigator.prototype._currentChanged=function(){this._update()};CollectionViewNavigator.prototype._collectionChanged=function(){this._update()};CollectionViewNavigator.prototype._click=function(e){var t=e.target,i=this._view,n=this._byPage;if(i){contains(this._btnFirst,t)?n?i.moveToFirstPage():i.moveCurrentToFirst():contains(this._btnPrev,t)?n?i.moveToPreviousPage():i.moveCurrentToPrevious():contains(this._btnNext,t)?n?i.moveToNextPage():i.moveCurrentToNext():contains(this._btnLast,t)&&(n?i.moveToLastPage():i.moveCurrentToLast());(this.byPage?i.pageIndex>=i.pageCount-1||i.pageIndex<=0:i.currentPosition>=i.itemCount-1||i.currentPosition<=0)&&!this.isDisabled&&this._txtCurr.tabIndex>=0&&this._txtCurr.focus();e.preventDefault()}};CollectionViewNavigator.prototype._updateAriaLabels=function(){var e=culture.CollectionViewNavigator.ariaLabels[this._byPage?"byPage":"byItem"];setAttribute(this._btnFirst.firstElementChild,"aria-label",e.btnFirst);setAttribute(this._btnPrev.firstElementChild,"aria-label",e.btnPrev);setAttribute(this._btnNext.firstElementChild,"aria-label",e.btnNext);setAttribute(this._btnLast.firstElementChild,"aria-label",e.btnLast)};CollectionViewNavigator.prototype._addA11yRelatedHandlers=function(){var e=this;this.addEventListener(this._txtCurr,"focus",(function(t){if(e._txtCurr===document.activeElement){setAttribute(e._txtCurr,"aria-live","off");setAttribute(e._txtCurr,"aria-label",e._txtCurr.textContent);e._liveRegionON=!1}}));this.addEventListener(this._txtCurr,"blur",(function(t){e._txtCurr!==document.activeElement&&e._txtCurr.removeAttribute("aria-label")}));[this._btnFirst.firstElementChild,this._btnPrev.firstElementChild,this._btnNext.firstElementChild,this._btnLast.firstElementChild].forEach((function(t){e.addEventListener(t,"focus",(function(t){setTimeout((function(){if(!e._liveRegionON){var t=_isMacOS()?"polite":"assertive";setAttribute(e._txtCurr,"aria-live",t);e._liveRegionON=!0}}))}))}))};CollectionViewNavigator.prototype._setTabOrder=function(e){var t=this._e,i=null!=this._txtCurr.getAttribute("disabled");this._orgTabIndex=e;if(this.isDisabled||i){t.tabIndex=-1;this._txtCurr.tabIndex=-1}else i||(this._txtCurr.tabIndex=this._orgTabIndex)};CollectionViewNavigator.prototype._keydown=function(e){if(contains(this._txtCurr,e.target)&&(e.ctrlKey||e.metaKey)&&("A"===e.key||"a"===e.key)){e.preventDefault();var t=document.createRange();t.selectNodeContents(this._txtCurr);var i=window.getSelection();i.removeAllRanges();i.addRange(t)}};CollectionViewNavigator.prototype._setIsDisabled=function(e){if((e=!!asBoolean(e,!0))!=this.isDisabled){var t=this._e;if(t){this._isDisabled=e;toggleClass(t,ControlStateClsNames.disabled,e);this._update();this._txtCurr.tabIndex=e?-1:this._orgTabIndex}}};CollectionViewNavigator.prototype._updateTabIndex=function(){var e=this;[this._btnFirst,this._btnPrev,this._btnNext,this._btnLast].forEach((function(t){if(e._isDisabled)t.firstElementChild.setAttribute("tabindex","-1");else{t.firstElementChild.disabled?t.firstElementChild.setAttribute("tabindex","-1"):t.firstElementChild.setAttribute("tabindex",e._orgTabIndex.toString())}}))};CollectionViewNavigator._ctrlTemplate="";return CollectionViewNavigator}(Control);export{CollectionViewNavigator};_addCultureInfo("Listbox",{ariaLabels:{listBox:"list box"}});var ListBox=function(e){__extends(ListBox,e);function ListBox(t,i){var n=e.call(this,t,null,!0)||this;n._cv=null;n._itemFormatter=null;n._pathDisplay=new Binding("");n._pathValue=new Binding("");n._pathChecked=new Binding("");n._html=!1;n._shGroups=!1;n._checkedItems=[];n._itemRole="option";n._caseSensitive=!1;n._addMode=!1;n._isShiftDown=!1;n._shouldClearOnShift=!0;n._vThreshold=ListBox._VTHRESH;n._isVirtual=!1;n._children=[];n._ignoreItemFormatterTextArray=[];n._itemFormatterHelper=document.createElement("div");n._clientHeight=-1;n._itemHeight=30;n._itemsAbove=-1;n._itemsBelow=-1;n._eSizer=document.createElement("div");n._ePadTop=document.createElement("div");n._ePadBot=document.createElement("div");n._checking=!1;n._ignoredItemChangedEvents=!1;n._search="";n._fmtItemHandlers=0;n._itemCount=0;n._oldSel=null;n._container=null;n._oldSelectedIndex=-1;n._ariaLabel=culture.Listbox.ariaLabels.listBox;n._isNeedUpdateBnd=!0;n.selectedIndexChanged=new Event;n.itemsChanged=new Event;n.loadingItems=new Event;n.loadedItems=new Event;n.itemChecked=new Event;n.checkedItemsChanged=new Event;n.formatItem=new Event((function(){n.invalidate()}));n._handleKeyUp=function(e){if("Shift"===e.key){n._isShiftDown=!1;n._shouldClearOnShift=!0}};n.applyTemplate(ControlClsNames.hostElement+" "+ControlClsNames.content+" "+ListBoxClsNames.hostElement,null,null);var o=n.hostElement;setAttribute(o,"role","listbox",!0);n._updateAriaLabel();"SELECT"==n._orgTag&&n._initFromSelect(n.hostElement);n.addEventListener(o,"click",n._click.bind(n));n.addEventListener(o,"keydown",n._keydown.bind(n));n.addEventListener(o,"keypress",n._keypress.bind(n));n.addEventListener(o,"keyup",n._handleKeyUp.bind(n));n.addEventListener(o,"wheel",(function(e){if(o.scrollHeight>o.offsetHeight&&(e.deltaY<0&&0==o.scrollTop||e.deltaY>0&&o.scrollTop+o.offsetHeight>=o.scrollHeight)){e.preventDefault();e.stopPropagation();e.stopImmediatePropagation()}}));[n._eSizer,n._ePadTop,n._ePadBot].forEach((function(e){e.tabIndex=-1;setAttribute(e,"aria-hidden",!0);setCss(e,{pointerEvents:"none",opacity:"0"})}));n.initialize(i);n._updateViewRange();n.addEventListener(n.hostElement,"scroll",(function(e){n._updateViewRange()}));return n}Object.defineProperty(ListBox.prototype,"ariaLabelledBy",{get:function(){return this.hostElement.getAttribute("aria-labelledby")},set:function(e){_setAriaLabelBy(this,this.hostElement,e,this._updateAriaLabel.bind(this))},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"itemsSource",{get:function(){return this._items},set:function(e){if(this._items!=e){if(this._cv){this._cv.currentChanged.removeHandler(this._cvCurrentChanged,this);this._cv.collectionChanged.removeHandler(this._cvCollectionChanged,this);this._cv=null}this._items=e;this._cv=asCollectionView(e);if(null!=this._cv){this._cv.currentChanged.addHandler(this._cvCurrentChanged,this);this._cv.collectionChanged.addHandler(this._cvCollectionChanged,this)}this._populateList();this.onItemsChanged();this.onSelectedIndexChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"collectionView",{get:function(){return this._cv},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"virtualizationThreshold",{get:function(){return this._vThreshold},set:function(e){if(e!=this._vThreshold){var t=this._getVirtual();this._vThreshold=asNumber(e,!1,!0);t!=this._getVirtual()&&this._populateList()}},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"showGroups",{get:function(){return this._shGroups},set:function(e){if(e!=this._shGroups){this._shGroups=asBoolean(e);this._populateList()}},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"isContentHtml",{get:function(){return this._html},set:function(e){if(e!=this._html){this._html=asBoolean(e);this._populateList()}},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"itemFormatter",{get:function(){return this._itemFormatter},set:function(e){if(e!=this._itemFormatter){this._itemFormatter=asFunction(e);this._populateList()}},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"displayMemberPath",{get:function(){return this._pathDisplay.path},set:function(e){if(e!=this.displayMemberPath){this._pathDisplay.path=asString(e);this._populateList()}},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"selectedValuePath",{get:function(){return this._pathValue.path},set:function(e){this._pathValue.path=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"checkedMemberPath",{get:function(){return this._pathChecked.path},set:function(e){if(e!=this.checkedMemberPath){this._pathChecked.path=asString(e);setAttribute(this.hostElement,"aria-multiselectable",""!==this.checkedMemberPath?"true":"false");this._populateList()}},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"caseSensitiveSearch",{get:function(){return this._caseSensitive},set:function(e){this._caseSensitive=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"itemRole",{get:function(){return this._itemRole},set:function(e){if(e!=this.itemRole){this._itemRole=asString(e);this._populateList()}},enumerable:!0,configurable:!0});ListBox.prototype.getDisplayValue=function(e,t){var i=null;if(e>-1&&hasItems(this._cv)){i=this._cv.items[e];this.displayMemberPath&&(i=this._pathDisplay.getValue(i))}var n=null!=i?i.toString():"";this._itemFormatter&&!t&&(n=this._itemFormatter(e,n));return n};ListBox.prototype.getDisplayText=function(e){return this._getDisplayText(e)};ListBox.prototype._getDisplayText=function(e,t){if(t&&this._ignoreItemFormatterTextArray[e])return this._ignoreItemFormatterTextArray[e];var i=this._getChild(e);return null!=i?i.textContent:""};ListBox.prototype.isItemEnabled=function(e){var t=this._getChild(e);return null!=t&&!t.hasAttribute("disabled")&&!hasClass(t,ControlStateClsNames.disabled)&&!hasClass(t,UtilitesClsNames.separator)};Object.defineProperty(ListBox.prototype,"selectedIndex",{get:function(){return this._cv?this._cv.currentPosition:-1},set:function(e){if(this._cv){this._oldSelectedIndex=this._cv.currentPosition;this._cv.moveCurrentToPosition(asNumber(e))}},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"selectedItem",{get:function(){return this._cv?this._cv.currentItem:null},set:function(e){this._cv&&this._cv.moveCurrentTo(e)},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"selectedValue",{get:function(){var e=this.selectedItem;e&&this.selectedValuePath&&(e=this._pathValue.getValue(e));return e},set:function(e){var t=this._cv,i=t?t.items:null,n=this.selectedValuePath,o=-1;if(i){for(var s=0;s<i.length;s++){var r=i[s],a=n?this._pathValue.getValue(r):r;if(a===e||DateTime.equals(a,e)){o=s;break}if(this.isContentHtml&&isString(a)&&a.indexOf("<")>-1&&toPlainText(a)===e){o=s;break}}this.selectedIndex=o}},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"maxHeight",{get:function(){var e=this.hostElement,t=e?parseFloat(e.style.maxHeight):null;return isNaN(t)?null:t},set:function(e){var t=this.hostElement;if(t){e=asNumber(e,!0);t.style.maxHeight=null==e?"":e+"px"}},enumerable:!0,configurable:!0});ListBox.prototype.showSelection=function(e){void 0===e&&(e=this.containsFocus());var t=this.hostElement,i=this._children,n=this._getSelectedElement(!1),o=new Rect(0,0,0,0);if(n!=this._oldSel){this._updateItemAttributes(n,!0);this._updateItemAttributes(this._oldSel,!1);this._oldSel=n}n instanceof HTMLElement?o=this._getBoundingClientRect(n):this._children.length>0&&(o=this._getBoundingClientRect(this._getChild(0)));var s=this._getBoundingClientRect(t),r=0;if(this._shGroups){r=this._itemHeight;if(!this._isVirtual){var a=i[0];a&&a.offsetHeight&&hasClass(a,ListBoxClsNames.header)&&(r=a.offsetHeight)}}o.bottom>s.bottom?t.scrollTop+=o.bottom-s.bottom:o.top<s.top+r&&(t.scrollTop-=s.top+r-o.top);this._updateViewRange();n=this._getSelectedElement(!0);setAttribute(t,"aria-activedescendant",n?n.id:null);if(e){(n&&!contains(n,getActiveElement())?n:t).focus()}t.tabIndex=n?-1:this._orgTabIndex};ListBox.prototype.loadList=function(){this._populateList()};ListBox.prototype.getItemChecked=function(e){var t=this._cv.items[e],i=this._pathChecked;return isObject(t)&&i.path?i.getValue(t):this._getCheckboxState(e)};ListBox.prototype.setItemChecked=function(e,t){this._setItemChecked(e,t,!0)};ListBox.prototype.toggleItemChecked=function(e){this.setItemChecked(e,!this.getItemChecked(e))};Object.defineProperty(ListBox.prototype,"checkedItems",{get:function(){return this._checkedItems},set:function(e){e=Array.from(new Set(e));var t=asArray(e,!1);if(!this._arrayEquals(t,this._checkedItems)){this._updateCheckedList(t);if(!this._arrayEquals(t,this._checkedItems)){this._checkedItems=t;this.onCheckedItemsChanged()}}},enumerable:!0,configurable:!0});ListBox.prototype.indexOf=function(e){return(e=closest(e,"."+ListBoxClsNames.listBoxItem))?e[ListBox._DIDX_KEY]:-1};ListBox.prototype.onSelectedIndexChanged=function(e){this.selectedIndexChanged.raise(this,e)};ListBox.prototype.onItemsChanged=function(e){this.itemsChanged.raise(this,e)};ListBox.prototype.onLoadingItems=function(e){this.loadingItems.raise(this,e)};ListBox.prototype.onLoadedItems=function(e){this.loadedItems.raise(this,e)};ListBox.prototype.onItemChecked=function(e){this.itemChecked.raise(this,e)};ListBox.prototype.onCheckedItemsChanged=function(e){this.checkedItemsChanged.raise(this,e)};ListBox.prototype.onFormatItem=function(e){this.formatItem.raise(this,e)};ListBox.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);if(this.hostElement){var i=this._cv?this._cv.items.length:0,n=this.formatItem.handlerCount;if(i!=this._itemCount||n!=this._fmtItemHandlers){this._fmtItemHandlers=n;this._populateList()}else this._updateViewRange()}};ListBox.prototype._updateAriaLabel=function(){this.hostElement&&(this.ariaLabelledBy?setAriaLabel(this.hostElement,null):setAriaLabel(this.hostElement,this._ariaLabel))};ListBox.prototype._updateCheckedList=function(e){var t=this,i=this._cv,n=this._pathChecked,o=new Map;if(n&&i){var s=i.sourceCollection;if(s&&s.length){isObject(s[0])||(n=null);e.forEach((function(e){o.set(e,!0)}));this._checking=!0;var r=[];s.forEach((function(e){var i=o.has(e);i&&r.push(e);n&&t._isNeedUpdateBnd&&n.setValue(e,i)}));this._checking=!1;e=r}i.items.forEach((function(e,i){t._setItemChecked(i,o.has(e),!1)}))}};ListBox.prototype._getBoundingClientRect=function(e){if(!e.offsetHeight){var t=this.indexOf(e),i=this.hostElement;if(t>-1&&i){t=this._getElementIndex(t);var n=i.getBoundingClientRect();return new Rect(0,n.top-i.scrollTop+t*this._itemHeight,n.width,this._itemHeight)}}return Rect.fromBoundingRect(e.getBoundingClientRect())};ListBox.prototype._updateItemAttributes=function(e,t){if(e){var i=this.checkedMemberPath?"true"===e.getAttribute("aria-selected"):null;toggleClass(e,ControlStateClsNames.selected,t);this._isMenuItem()||setAttribute(e,"aria-selected",this._getAriaSelected(t,i));e.tabIndex=t?this._orgTabIndex:-1}};ListBox.prototype._getCheckedItems=function(){var e=this,t=this._cv,i=this._pathChecked,n=[];t&&i&&i.path&&(n=t.sourceCollection.filter((function(n,o){if(t.filter&&!t.filter(n))return!!e._addMode&&i.getValue(n);if(isObject(n))return i.getValue(n);var s=t.items[o]==n?o:t.items.indexOf(n);return e.getItemChecked(s)})));return n};ListBox.prototype._arrayEquals=function(e,t){if(e==t)return!0;if(!e||!t||e.length!=t.length)return!1;for(var i=0;i<e.length;i++)if(!this._isEqual(e[i],t[i]))return!1;return!0};ListBox.prototype._getChild=function(e){e=this._getElementIndex(e);return this._children[e]};ListBox.prototype._getElementIndex=function(e){if(this._shGroups)for(var t=this._children,i=0;i<=e&&i<t.length;i++){var n=t[i];hasClass(n,ListBoxClsNames.header)&&e++}return e};ListBox.prototype._setItemChecked=function(e,t,i){void 0===i&&(i=!0);var n=this._cv.items[e],o=this._pathChecked,s=!1,r=this.selectedIndex,a=this._checking;if(isObject(n)&&o.path){if(!!o.getValue(n)!=t){var l=tryCast(this._cv,"IEditableCollectionView");s=!0;this._checking=!0;if(l){l.editItem(n);o.setValue(n,t);l.commitEdit()}else{o.setValue(n,t);l.refresh()}this._checking=a}}else if(i){var h=this._findArrayItem(this._checkedItems,n);(t&&h<0||!t&&h>=0)&&(s=!0)}this._setCheckboxState(e,t);if(i){if(s){this._checkedItems=this._checkedItemsUpdate(n,t);this.onItemChecked();this.onCheckedItemsChanged()}r!=this.selectedIndex&&this.onSelectedIndexChanged()}return s};ListBox.prototype._checkedItemsUpdate=function(e,t){var i=this._cv.sourceCollection,n=this._checkedItems,o=0;if(t){for(var s=0;s<i.length;s++){var r=i[s];if(o<n.length&&this._isEqual(r,n[o]))o++;else if(this._isEqual(r,e))return n.slice(0,o).concat([e]).concat(n.slice(o))}return n}var a=this._findArrayItem(n,e);return n.slice(0,a).concat(n.slice(a+1))};ListBox.prototype._isEqual=function(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)};ListBox.prototype._findArrayItem=function(e,t){if(!Number.isNaN(t))return e.indexOf(t);for(var i=0;i<e.length;i++)if(Number.isNaN(e[i]))return i;return-1};ListBox.prototype._cvCollectionChanged=function(){if(!this._checking){this._populateList();this.onItemsChanged()}};ListBox.prototype._cvCurrentChanged=function(){if(!this._checking){this.showSelection();this._ignoredItemChangedEvents||this.onSelectedIndexChanged()}};ListBox.prototype._populateList=function(){var e=this.hostElement,t=this._cv;this._itemCount=t?t.items.length:0;this._isVirtual=this._getVirtual();this._oldSel=null;this._itemsAbove=-1;this._itemsBelow=-1;if(e){var i=this.containsFocus(),n=void 0;this.onLoadingItems();this._children=[];var o=this._children;e.textContent="";if(t){var s=0,r=void 0,a=[];this._ignoreItemFormatterTextArray=[];if(this._shGroups&&t.groups&&t.groups.length){n={};for(var l=0;l<t.groups.length;l++){var h=t.groups[l];n[s]=h;r=this._createHeaderItem(h,l);a.push(r);for(var u=0;u<h.items.length;u++,s++){r=this._createItem(s,l);a.push(r)}}}else for(u=0;u<t.items.length;u++,s++){r=this._createItem(s);a.push(r)}var c=this._isVirtual?document.createElement("div"):e,p=0;setInnerHTMLSafe(c,a.join(""));for(u=0;u<c.children.length;u++){var d=c.children[u];p==t.currentPosition&&(this._oldSel=d);d[ListBox._DIDX_KEY]=d.className.indexOf(ListBoxClsNames.header)<0?p++:-1;o.push(d)}}if(this.formatItem.hasHandlers&&t){s=0;var m=t.items;for(d=new FormatItemEventArgs(0,null,null),u=0;u<o.length;u++){d._item=o[u];if(this._shGroups&&hasClass(d._item,ListBoxClsNames.header)){d._index=-1;d._data=n[s]}else{d._index=s;d._data=m[s++]}this.onFormatItem(d)}}if(this._isVirtual){var _=this._getCanvasContext(),f=null,b=0;for(u=0;u<o.length;u++){r=o[u];var g=_.measureText(r.textContent);if(g.width>b){f=r;b=g.width}}if(f){var y=!1,v=e.style.display,C=e.style.position;if(!e.parentElement){y=!0;(this._container||document.body).appendChild(e);setCss(e,{display:"",position:"absolute"})}e.appendChild(f);var x=f.style.whiteSpace;f.style.whiteSpace="nowrap";this._ePadTop.style.width=f.offsetWidth+"px";this._itemHeight=f.offsetHeight||this._itemHeight;f.style.whiteSpace=x;this._eSizer.style.height=o.length*this._itemHeight+"px";e.appendChild(this._eSizer);this._clientHeight=e.clientHeight;removeChild(this._eSizer);if(y){removeChild(e);setCss(e,{display:v,position:C})}removeChild(f)}else this._ePadTop.style.width="";this._updateViewRange()}this.checkedItems=this._getCheckedItems();var D=this._getSelectedElement(!0);if(i){(D||e).focus()}else D&&this.showSelection();e.tabIndex=D?-1:this._orgTabIndex;this.onLoadedItems()}};ListBox.prototype._getCanvasContext=function(){var e=document.createElement("canvas").getContext("2d"),t=getComputedStyle(this.hostElement);t.fontSize&&t.fontFamily&&(e.font=t.fontSize+" "+t.fontFamily.split(",")[0]);return e};ListBox.prototype._getVirtual=function(){if(this._itemCount<=this._vThreshold)return!1;var e=this.hostElement;if(e){var t=getComputedStyle(e);if(parseInt(t.columnCount)>1||t.display.indexOf("flex")>-1||t.display.indexOf("grid")>-1)return!1}return!0};ListBox.prototype._getMaxSupportedCssHeight=function(){var e=265e5;isIE()?e=15e5:isFirefox()&&(e=175e5);return e};ListBox.prototype._updateViewRange=function(){var e=this.hostElement,t=this._itemHeight,i=this._children;if(!(e&&e.parentElement&&this._isVirtual&&i))return!1;var n=e.scrollTop;assert(t*i.length<this._getMaxSupportedCssHeight(),"The number of items ("+i.length+") exceeds the maximum number of items ("+Math.floor(this._getMaxSupportedCssHeight()/t)+") allowed for this browser.");var o=Math.max(e.clientHeight,this._clientHeight),s=Math.floor(n/t),r=Math.min(i.length,Math.ceil((n+o)/t)-s),a=Math.max(0,i.length-s-r);if(s==this._itemsAbove&&a==this._itemsBelow)return!1;this._itemsAbove=s;this._itemsBelow=a;var l=document.createDocumentFragment(),h=this.containsFocus();this._ePadTop.style.height=s*t+"px";l.appendChild(this._ePadTop);if(this.showGroups&&!hasClass(i[s],ListBoxClsNames.header))for(var u=s;u>=0;u--)if(hasClass(i[u],ListBoxClsNames.header)){l.appendChild(i[u]);break}for(u=s;u<=s+r&&u<i.length;u++)l.appendChild(i[u]);this._ePadBot.style.height=a*t+"px";l.appendChild(this._ePadBot);e.textContent="";e.appendChild(l);var c=(s+r+a)*t-e.scrollHeight;this._ePadBot.style.height=this._ePadBot.offsetHeight-c+"px";var p=this._getSelectedElement(!0);if(h){(p||e).focus({preventScroll:!0})}e.tabIndex=p?-1:this._orgTabIndex;return!0};ListBox.prototype._getSelectedElement=function(e){var t=this.selectedIndex,i=this._getElementIndex(t),n=i>-1?this._children[i]:null;e&&n&&!n.offsetHeight&&(n=null);return n};ListBox.prototype._handleResize=function(){this._updateViewRange()};ListBox.prototype._createItem=function(e,t){var i=this._cv.items[e],n=e==this._cv.currentPosition,o=this.getDisplayValue(e),s=this.getDisplayValue(e,void 0!==this.itemFormatter);if(1!=this._html){o=escapeHtml(o);s=escapeHtml(s)}s=s.replace(/\bstyle\s*=/gi,"data-style=");this._itemFormatterHelper.innerHTML=s;s=this._itemFormatterHelper.textContent;this._ignoreItemFormatterTextArray.push(s);var r=null;if(this.checkedMemberPath){r=!1;isObject(i)?r=!!this._pathChecked.getValue(i):this._checkedItems&&(r=this._checkedItems.indexOf(i)>-1);o='<label class="wj-checklist-item"><span class="wj-checklist-base" role="checkbox" aria-hidden="true"><span class="wj-checklist-mark"></span></span><span class="wj-checklist-caption">'+o+"</span></label>"}var a=ListBoxClsNames.listBoxItem;n&&(a+=" "+ControlStateClsNames.selected);r&&(a+=" "+ControlStateClsNames.checked);if(this._html){var l=[UtilitesClsNames.separator,ControlStateClsNames.disabled];if(o.indexOf(l[0])>-1||o.indexOf(l[1])>-1){var h=createElement(o);l.forEach((function(e){hasClass(h,e)&&(a+=" "+e)}))}}var u="aria-describedby = listGroup-"+t;return'<div id="'+("listitem-"+e)+'" class="'+a+'" \n role="'+this.itemRole+'" \n '+(void 0!==t?u:"")+"\n "+(this._getAriaSelected(n,r)&&!this._isMenuItem()?'aria-selected="true"':"")+' \n tabindex="'+(n&&!this.isDisabled?this._orgTabIndex:-1)+'">'+o+"</div>"};ListBox.prototype._getAriaSelected=function(e,t){return!!(null!=t?t:e)||null};ListBox.prototype._createHeaderItem=function(e,t){var i=escapeHtml(e.name);return'<div id="listGroup-'+t+'" class="'+ListBoxClsNames.listBoxItem+" "+ListBoxClsNames.header+" "+ControlStateClsNames.disabled+'" role="group" tabindex="-1">'+i+"</div>"};ListBox.prototype._click=function(e){if(0==e.button&&!e.defaultPrevented){var t=this.indexOf(e.target);if(t>-1){this.selectedIndex=t;if(this.checkedMemberPath){var i=this._getCheckbox(t);if(i){var n=closest(i,".wj-listbox-item");if(e.target==i||e.target==n){n.focus({preventScroll:!0});this.setItemChecked(t,i.checked)}}else{var o=this._children[this._getElementIndex(t)];if(o){o.focus({preventScroll:!0});this.setItemChecked(t,"true"!==o.getAttribute("aria-selected"))}}}else{(n=closest(e.target,"."+ListBoxClsNames.listBoxItem)).focus({preventScroll:!0})}}}};ListBox.prototype._keydown=function(e){var t=this.selectedIndex;if(!e.defaultPrevented){if(65==e.keyCode&&(e.ctrlKey||e.metaKey)){var i=this.collectionView;if(this.checkedMemberPath&&hasItems(i)){for(var n=this._children,o=[],s=!0,r=0;r<n.length;r++)if(!hasClass(n[r],_CLS_STATE_DISABLED)){var a=i.items[r];o.push(a);s&&!this.checkedItems.includes(a)&&(s=!1)}o.length!==i.items.length?this.checkedItems=s?this.checkedItems.filter((function(e){return!o.includes(e)})):this.checkedItems.concat(o):this.checkedItems=this.checkedItems.length!=i.items.length?i.items:[];e.preventDefault();return}}if(!e.altKey&&!e.metaKey){e.shiftKey&&(this._isShiftDown=!0);switch(e.keyCode){case Key.Down:e.preventDefault();this._selectNext(e.shiftKey);break;case Key.Up:e.preventDefault();this._selectPrev(e.shiftKey);break;case Key.Home:e.preventDefault();e.ctrlKey&&e.shiftKey?this._selectRange(0):this._selectFirst();break;case Key.End:e.preventDefault();e.ctrlKey&&e.shiftKey?this._selectRange(this._children.length-1):this._selectLast();break;case Key.PageDown:e.preventDefault();this._selectNextPage();break;case Key.PageUp:e.preventDefault();this._selectPrevPage();break;case Key.Space:if(this.checkedMemberPath&&t>-1){var l=this._children[this._getElementIndex(t)];if(l&&this.isItemEnabled(t)&&!l.hasAttribute("disabled")){var h="true"===l.getAttribute("aria-selected");this.setItemChecked(t,!h);e.preventDefault()}}}}}};ListBox.prototype._getCheckboxState=function(e){var t=this._children[this._getElementIndex(e)];if(t)return"true"===t.getAttribute("aria-selected")};ListBox.prototype._setCheckboxState=function(e,t){var i=this._getElementIndex(e),n=this._children[i];if(n){if(n.querySelector(".wj-checklist-mark")){n.setAttribute("aria-selected",t.toString());toggleClass(n,ControlStateClsNames.checked,t)}else{var o=this._getCheckbox(i);if(o){o.checked=t;var s=closest(o,"."+ListBoxClsNames.listBoxItem);if(s){toggleClass(s,ControlStateClsNames.checked,t);setAttribute(s,"aria-selected",!!t||null)}}}}};ListBox.prototype._getCheckbox=function(e){var t=this._children;return this.hostElement&&e>-1&&e<t.length?t[e].querySelector("input[type=checkbox]"):null};ListBox.prototype._keypress=function(e){var t=this;if(!e.defaultPrevented&&!(e.target instanceof HTMLInputElement)&&(e.charCode>32||32==e.charCode&&this._search)){e.preventDefault();this._search+=String.fromCharCode(e.charCode);this._toSearch&&clearTimeout(this._toSearch);this._toSearch=setTimeout((function(){t._toSearch=null;t._search=""}),Control._SEARCH_DELAY);var i=this._findNext();if(i<0&&this._search.length>1){this._search=this._search[this._search.length-1];i=this._findNext()}i>-1&&(this.selectedIndex=i)}};ListBox.prototype._selectNext=function(e){void 0===e&&(e=!1);var t=this.selectedIndex,i=this._findNextEnabled(t+1);if(i>-1){e&&this._selectRange(i);this.selectedIndex=i}return i>-1};ListBox.prototype._selectPrev=function(e){void 0===e&&(e=!1);var t=this.selectedIndex,i=this._findPrevEnabled(t-1);if(i>-1){e&&this._selectRange(i);this.selectedIndex=i}return i>-1};ListBox.prototype._findNextEnabled=function(e){for(var t=e;t<this._children.length;t++)if(this.isItemEnabled(t))return t;return-1};ListBox.prototype._findPrevEnabled=function(e){for(var t=e;t>=0;t--)if(this.isItemEnabled(t))return t;return-1};ListBox.prototype._selectFirst=function(){for(var e=0;e<this._children.length;e++)if(this.isItemEnabled(e)){this.selectedIndex=e;return!0}return!1};ListBox.prototype._selectLast=function(){for(var e=this._children.length-1;e>=0;e--)if(this.isItemEnabled(e)){this.selectedIndex=e;return!0}return!1};ListBox.prototype._selectNextPage=function(){var e=this.hostElement.offsetHeight,t=this._children,i=this._cv?this._cv.items.length:0,n=0;if(e>0)for(var o=this.selectedIndex+1;o<i;o++){var s=t[o].scrollHeight||this._itemHeight;if(n+s>e&&this.isItemEnabled(o)){this.selectedIndex=o;return!0}n+=s}return this._selectLast()};ListBox.prototype._selectPrevPage=function(){var e=this.hostElement.offsetHeight,t=this._children,i=0;if(e>0)for(var n=this.selectedIndex-1;n>0;n--){var o=t[n].scrollHeight||this._itemHeight;if(i+o>e&&this.isItemEnabled(n)){this.selectedIndex=n;return!0}i+=o}return this._selectFirst()};ListBox.prototype._findNext=function(){if(this.hostElement){var e=this._children.length,t=this.selectedIndex;(t<0||1==this._search.length)&&t++;var i=this._search,n=this.caseSensitiveSearch;n||(i=i.toLowerCase());for(var o=0;o<e;o++){var s=(t+o)%e;if(this.isItemEnabled(s)){var r=this.getDisplayText(s).trim();n||(r=r.toLowerCase());if(0==r.indexOf(i))return s}}}return-1};ListBox.prototype._initFromSelect=function(e){for(var t=e.children,i=[],n=-1,o=0;o<t.length;o++){var s=t[o];if("OPTION"==s.tagName){s.hasAttribute("selected")&&(n=i.length);s.innerHTML?i.push({hdr:s.innerHTML,val:s.getAttribute("value"),cmdParam:s.getAttribute("cmd-param")}):i.push({hdr:'<div class="'+UtilitesClsNames.separator+'"></div>'});e.removeChild(s);o--}}if(i){this.displayMemberPath="hdr";this.selectedValuePath="val";this.itemsSource=i;this.selectedIndex=n}};ListBox.prototype._setIsDisabled=function(t){e.prototype._setIsDisabled.call(this,t);this._updateTabIndex()};ListBox.prototype._setTabOrder=function(t){e.prototype._setTabOrder.call(this,t);this.isDisabled||this._updateTabIndex()};ListBox.prototype._isMenuItem=function(){return"menuitem"===this.itemRole||"menuitemcheckbox"===this.itemRole||"menuitemradio"===this.itemRole};ListBox.prototype._updateTabIndex=function(){var e=this.hostElement,t=this._getSelectedElement(!0);if(t){t.tabIndex=this.isDisabled?-1:this._orgTabIndex;e.tabIndex=-1}else e.tabIndex=this.isDisabled?-1:this._orgTabIndex};ListBox.prototype._selectRange=function(e){if(-1!==this.selectedIndex){if(this._shouldClearOnShift&&this._isShiftDown){this.checkedItems=[];this._shouldClearOnShift=!1}var t=Math.min(this.selectedIndex,e),i=Math.max(this.selectedIndex,e),n=this.collectionView.items.slice(t,i+1);this.checkedItems=Array.from(new Set(this.checkedItems.concat(n)))}};ListBox.prototype.dispose=function(){if(this._cv){this._cv.collectionChanged.removeHandler(this._cvCollectionChanged,this);this._cv.currentChanged.removeHandler(this._cvCurrentChanged,this);this._cv=null}this._items=null;if(this._toSearch){clearTimeout(this._toSearch);this._toSearch=null}this._children=null;this._eSizer=null;this._ePadTop=null;this._ePadBot=null;this._itemFormatterHelper=null;this._ignoreItemFormatterTextArray=null;this._checkedItems=null;e.prototype.dispose.call(this)};ListBox._DIDX_KEY="$WJ-DIDX";ListBox._VTHRESH=Number.MAX_VALUE/2;return ListBox}(Control);export{ListBox};var FormatItemEventArgs=function(e){__extends(FormatItemEventArgs,e);function FormatItemEventArgs(t,i,n){var o=e.call(this)||this;o._index=asNumber(t);o._data=i;o._item=asType(n,HTMLElement,!0);return o}Object.defineProperty(FormatItemEventArgs.prototype,"index",{get:function(){return this._index},enumerable:!0,configurable:!0});Object.defineProperty(FormatItemEventArgs.prototype,"data",{get:function(){return this._data},enumerable:!0,configurable:!0});Object.defineProperty(FormatItemEventArgs.prototype,"item",{get:function(){return this._item},enumerable:!0,configurable:!0});return FormatItemEventArgs}(EventArgs);export{FormatItemEventArgs};_addCultureInfo("MultiSelectListBox",{filterPlaceholder:"Filter",selectAll:"Select All",ariaLabels:{multiSelectListBox:"Multi select list box"}});var MultiSelectListBox=function(e){__extends(MultiSelectListBox,e);function MultiSelectListBox(t,i){var n=e.call(this,t)||this;n._ariaLabel=culture.MultiSelectListBox.ariaLabels.multiSelectListBox;n._selectAllLabel=null;n._filterPlaceholder=null;n._filterText="";n._checkOnFilter=!0;n._delay=Control._SEARCH_DELAY;n.checkedItemsChanged=new Event;n.selectedIndexChanged=new Event;var o=n.getTemplate();n.applyTemplate(ControlClsNames.hostElement+" "+ControlClsNames.content+" "+MultiSelectListBoxClsNames.hostElement,o,{_selectAll:"select-all",_filter:"filter",_lbHost:"list-box"});n._selectAll.style.display="none";n._filter.style.display="none";n._lbx=new ListBox(n._lbHost,{checkedMemberPath:MultiSelectListBox._DEF_CHECKED_PATH,loadedItems:function(){return n._updateCheckAllCheckbox()},checkedItemsChanged:function(e){return n.onCheckedItemsChanged(e)},selectedIndexChanged:function(){return n.onSelectedIndexChanged()}});n._cbSelectAll=n._selectAll.querySelector("input[type=checkbox]");n._spSelectAll=n._selectAll.querySelector("label>span");var s=culture.MultiSelectListBox;setText(n._spSelectAll,s.selectAll);n._filter.placeholder=s.filterPlaceholder;n.initialize(i);n.addEventListener(n._filter,"input",(function(){if(n._filter.value!=n._filterText){n._filterText=n._filter.value;n._toSearch&&clearTimeout(n._toSearch);n._toSearch=setTimeout((function(){n._toSearch=null;n._applyFilter()}),n.delay)}}));n.addEventListener(n._cbSelectAll,"click",(function(e){var t=n._lbx.collectionView;hasItems(t)&&(n.checkedItems=e.target.checked?t.items:[])}));n.addEventListener(n.hostElement,"keydown",(function(e){var t=n.showFilterInput?n._filter:null,i=n._lbx;if(t&&e.keyCode==Key.F3){setSelectionRange(t,0,t.value.length);e.preventDefault()}if(getActiveElement()==t){var o=!e.altKey;switch(e.keyCode){case Key.Escape:case Key.F4:case Key.Tab:o=!1}o&&e.stopPropagation()}if(!i.containsFocus())switch(e.keyCode){case Key.Up:case Key.Down:n._lbx.focus();if(!e.altKey){var s=i.selectedIndex+(e.keyCode==Key.Up?-1:1);i.selectedIndex=Math.max(0,s)}e.preventDefault()}}),!0);n.hostElement.tabIndex=-1;n._lbx.tabOrder=n._orgTabIndex;n._updateAriaLabel();return n}Object.defineProperty(MultiSelectListBox,"controlTemplate",{get:function(){MultiSelectListBox._ctrlTemplate||(MultiSelectListBox._ctrlTemplate='<div class="'+ControlClsNames.template+" "+ListBoxClsNames.hostElement+'"><input wj-part="filter" class="'+InputFormElementsClsNames.formControl+'" tabindex="-1"><div wj-part="select-all" class="'+MultiSelectListBoxClsNames.header+" "+MultiSelectListBoxClsNames.selectAll+" "+ListBoxClsNames.listBoxItem+'"><label><input type="checkbox" tabindex="-1"> <span></span></label></div><div wj-part="list-box"/></div>');return MultiSelectListBox._ctrlTemplate},set:function(e){MultiSelectListBox._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"itemsSource",{get:function(){return this._lbx.itemsSource},set:function(e){this._lbx.itemsSource=e},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"collectionView",{get:function(){return this._lbx.collectionView},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"virtualizationThreshold",{get:function(){return this._lbx.virtualizationThreshold},set:function(e){this._lbx.virtualizationThreshold=e},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"displayMemberPath",{get:function(){return this._lbx.displayMemberPath},set:function(e){this._lbx.displayMemberPath=e},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"isContentHtml",{get:function(){return this._lbx.isContentHtml},set:function(e){this._lbx.isContentHtml=e},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"caseSensitiveSearch",{get:function(){return this._lbx.caseSensitiveSearch},set:function(e){this._lbx.caseSensitiveSearch=e},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"delay",{get:function(){return this._delay},set:function(e){this._delay=asNumber(e,!1,!0)},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"showGroups",{get:function(){return this._lbx.showGroups},set:function(e){this._lbx.showGroups=e},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"checkOnFilter",{get:function(){return this._checkOnFilter},set:function(e){if(e!=this.checkOnFilter){this._checkOnFilter=asBoolean(e);this.checkedItems=[]}},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"selectedIndex",{get:function(){return this._lbx.selectedIndex},set:function(e){this._lbx.selectedIndex=e},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"listBox",{get:function(){return this._lbx},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"showFilterInput",{get:function(){return""==this._filter.style.display},set:function(e){if(e!=this.showFilterInput){this._filter.style.display=asBoolean(e)?"":"none";if(!this.showFilterInput){this._filter.value="";this._applyFilter()}}},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"filterInputPlaceholder",{get:function(){return this._filterPlaceholder},set:function(e){if(e!=this._filterPlaceholder){this._filterPlaceholder=asString(e);this.refresh()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"showSelectAllCheckbox",{get:function(){return""==this._selectAll.style.display},set:function(e){this._selectAll.style.display=asBoolean(e)?"":"none"},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"selectAllLabel",{get:function(){return this._selectAllLabel},set:function(e){if(e!=this._selectAllLabel){this._selectAllLabel=asString(e);this.refresh()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"checkedMemberPath",{get:function(){var e=this.listBox.checkedMemberPath;return e!=MultiSelectListBox._DEF_CHECKED_PATH?e:null},set:function(e){e=asString(e);this.listBox.checkedMemberPath=e||MultiSelectListBox._DEF_CHECKED_PATH},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"checkedItems",{get:function(){return this.listBox.checkedItems},set:function(e){this.listBox.checkedItems=asArray(e)},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"ariaLabelledBy",{get:function(){return this.hostElement.getAttribute("aria-labelledby")},set:function(e){_setAriaLabelBy(this,this.hostElement,e,this._updateAriaLabel.bind(this))},enumerable:!0,configurable:!0});MultiSelectListBox.prototype._updateAriaLabel=function(){var e=culture.MultiSelectListBox;setAriaLabel(this._selectAll,e.selectAll);setAriaLabel(this._filter,e.filterPlaceholder);this.hostElement&&(this.ariaLabelledBy?setAriaLabel(this.hostElement,null):setAriaLabel(this.hostElement,this._ariaLabel))};MultiSelectListBox.prototype.onCheckedItemsChanged=function(e){var t=this;this._updateCheckAllCheckbox();this.checkedItemsChanged.raise(this,e);e._items&&"object"==typeof e._items[0]&&(this.checkedMemberPath||MultiSelectListBox._DEF_CHECKED_PATH)in e._items[0]&&setTimeout((function(){t._lbx._updateCheckedList(t.checkedItems)}),0)};MultiSelectListBox.prototype.onSelectedIndexChanged=function(e){this.selectedIndexChanged.raise(this,e)};MultiSelectListBox.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);if(this.hostElement){var i=culture.MultiSelectListBox;this._filter.placeholder=null!=this._filterPlaceholder?this._filterPlaceholder:i.filterPlaceholder;this._spSelectAll&&setText(this._spSelectAll,null!=this._selectAllLabel?this._selectAllLabel:i.selectAll);this._updateCheckAllCheckbox()}};MultiSelectListBox.prototype.dispose=function(){this.listBox.dispose();e.prototype.dispose.call(this)};MultiSelectListBox.prototype._applyFilter=function(){var e=this,t=this._lbx,i=t.collectionView,n=this._filter.value,o=n?new RegExp(escapeRegExp(n),t.caseSensitiveSearch?"":"i"):null,s=this.displayMemberPath,r=s?new Binding(s):null,a=this.checkOnFilter?null:this.checkedItems;i.filter=function(t){if(null!=o){if(a&&a.indexOf(t)>-1)return!0;r&&(t=r.getValue(t));e.isContentHtml&&(t=toPlainText(t));return null!=t&&o.test(t.toString())}return!0};t.selectedIndex=Math.max(0,t.selectedIndex);this._checkOnFilter&&(this.checkedItems=o?i.items:[])};MultiSelectListBox.prototype._updateCheckAllCheckbox=function(){var e=this._lbx.collectionView,t=this._cbSelectAll;if(hasItems(e)){var i=e.items.length,n=this.checkedItems.length;setChecked(t,n==i||0!=n&&null);t.disabled=!1}else{setChecked(t,!1);t.checked=!1;t.disabled=!0}};MultiSelectListBox.prototype._setIsDisabled=function(t){e.prototype._setIsDisabled.call(this,t);this.hostElement.tabIndex=-1;this.isDisabled?this._lbx.tabOrder=-1:this._lbx.tabOrder=this._orgTabIndex};MultiSelectListBox.prototype._setTabOrder=function(e){this._orgTabIndex=e;this._lbx.tabOrder=e};MultiSelectListBox.prototype.tryForceClearDelayAndFilter=function(){var e=this;if(this._toSearch){var t=this._delay;this._filterText=this._filter.value;this._toSearch&&clearTimeout(this._toSearch);this._toSearch=setTimeout((function(){e._toSearch=null;e._applyFilter()}),0);this._delay=t}};MultiSelectListBox.prototype.onLostFocus=function(){this.tryForceClearDelayAndFilter();e.prototype.onLostFocus.call(this)};MultiSelectListBox._DEF_CHECKED_PATH="$checked";MultiSelectListBox._ctrlTemplate="";return MultiSelectListBox}(Control);export{MultiSelectListBox};_addCultureInfo("Calendar",{ariaLabels:{calendar:"Calendar",chooseDate:"Choose Date",chooseMonth:"Choose Month",monthView:"Month View",yearView:"Year View",selectYear:"Select Year",prvMo:"Previous Month",today:"Select Today",nxtMo:"Next Month",prvYr:"Previous Year",currMo:"Current Month",nxtYr:"Next Year"},buttons:{ok:"OK",cancel:"Cancel"}});export var DateSelectionMode;!function(e){e[e.None=0]="None";e[e.Day=1]="Day";e[e.Month=2]="Month";e[e.Range=3]="Range"}(DateSelectionMode||(DateSelectionMode={}));export var ShowMonthPicker;!function(e){e[e.None=0]="None";e[e.FirstMonth=1]="FirstMonth";e[e.LastMonth=2]="LastMonth";e[e.FirstAndLastMonths=3]="FirstAndLastMonths";e[e.AllMonths=4]="AllMonths";e[e.Outside=5]="Outside"}(ShowMonthPicker||(ShowMonthPicker={}));export var CalendarTabKeyAction;!function(e){e[e.None=0]="None";e[e.All=1]="All"}(CalendarTabKeyAction||(CalendarTabKeyAction={}));var Calendar=function(e){__extends(Calendar,e);function Calendar(t,i){var n=e.call(this,t)||this;n._yrPicker=!0;n._mtPicker=ShowMonthPicker.FirstMonth;n._wksBefore=0;n._wksAfter=0;n._rngMin=0;n._rngMax=0;n._min=null;n._max=null;n._readOnly=!1;n._handleWheel=!0;n._fdw=null;n._selMode=DateSelectionMode.Day;n._ariaLabel=culture.Calendar.ariaLabels.calendar;n._tmYrHidden=0;n._fmtYrMo="y";n._fmtYr="yyyy";n._fmtDayHdr="ddd";n._fmtDay="d ";n._fmtMonths="MMM";n._fmtDayTitle="dddd";n.valueChanged=new Event;n.rangeEndChanged=new Event;n.rangeChanged=new Event;n.displayMonthChanged=new Event;n.formatItem=new Event((function(){n.invalidate()}));n._updateCellFocus=function(e,t){toggleClass(e,CalendarClsNames.focused,t);setAttribute(e,"tabIndex",t?"0":"-1");t&&n.containsFocus()&&!n._isButtonFocused()&&e.focus()};n.cancelButtonClicked=new Event;n.OKButtonClicked=new Event;n._enterKeyDownToSetValue=new Event;n._value=n._rngEnd=DateTime.newDate();n._month=n._getMonth(n._value);n._cals=[n];n._createChildren();n._createYearPicker();var o=n.hostElement,s=n.addEventListener.bind(n);s(o,"keydown",n._keydown.bind(n));s(o,"click",n._click.bind(n));n._focusValue=DateTime.newDate();setAttribute(o,"role","application");setAttribute(n.hostElement,"aria-label",n._ariaLabel);n._keyActionTab=CalendarTabKeyAction.None;n._rptUp=new _ClickRepeater(n._btnPrv);n._rptDn=new _ClickRepeater(n._btnNxt);n.addEventListener(o,"wheel",(function(e){if(n.handleWheel&&!e.defaultPrevented&&!n.isReadOnly&&n.containsFocus()){e.deltaY<0?n._btnPrv.click():n._btnNxt.click();e.preventDefault()}}));n.initialize(i);n.refresh(!0);return n}Object.defineProperty(Calendar,"controlTemplate",{get:function(){Calendar._ctrlTemplate||(Calendar._ctrlTemplate='<div class="'+ControlClsNames.content+" "+CalendarClsNames.calendarOuter+'"><div wj-part="tbl-header" class='+CalendarClsNames.calendarHeader+'><div wj-part="btn-month" class='+CalendarClsNames.monthSelect+' role="button" aria-live="polite"><span wj-part="span-month"></span> <span class='+GlyphClsNames.down+'></span></div><div class="'+InputFormElementsClsNames.btnGroup+'"><button wj-part="btn-prev" class="'+InputFormElementsClsNames.btn+" "+InputFormElementsClsNames.btnDefault+'" tabindex="-1"><span class='+GlyphClsNames.left+'></span></button><button wj-part="btn-today" class="'+InputFormElementsClsNames.btn+" "+InputFormElementsClsNames.btnDefault+'" tabindex="-1"><span class='+GlyphClsNames.circle+'></span></button><button wj-part="btn-next" class="'+InputFormElementsClsNames.btn+" "+InputFormElementsClsNames.btnDefault+'" tabindex="-1"><span class='+GlyphClsNames.right+'></span></button></div></div><table wj-part="tbl-month" class='+CalendarClsNames.calendarMonth+' role="grid"></table><table wj-part="tbl-year" class='+CalendarClsNames.calendarYear+' role="grid"></table></div>');return Calendar._ctrlTemplate},set:function(e){Calendar._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"value",{get:function(){return this._value},set:function(e){if((!DateTime.sameDate(e,this._value)||!DateTime.sameTime(e,this._value))&&(!(this.showConfirmationButtons&&DateTime.sameDate(e,this.rangeEnd)&&DateTime.sameTime(e,this.rangeEnd))||this._isSpaceDownForSetValue)){this._clearingRangeEnd=!DateTime.equals(this._value,e);this.rangeEnd=null;this._clearingRangeEnd=!1;e=asDate(e,!0);e=this._clamp(e);if(this._valid(e)||null==e){this.ensureVisible(e||new Date);if(!DateTime.equals(this._value,e)){this._value=e;this.focusMode&&(this._focusValue=e);this.invalidate(!1);this.onValueChanged()}}if(!this.value){var t=this.min,i=this.max,n=this.displayMonth;i&&i<n?this.ensureVisible(i):t&&t>n&&this.ensureVisible(t)}}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"focusValue",{get:function(){return this._focusValue},set:function(e){e=asDate(e,!0);e=this._clamp(e);if(this._valid(e)||null==e){this.ensureVisible(e||new Date);this._focusValue=e;this._getCalendars().forEach((function(t){t._focusValue=e}));this.invalidate(!1)}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"rangeEnd",{get:function(){return this._rngEnd},set:function(e){e=asDate(e,!0);if((e=this._clamp(e))&&this._value&&this._rngMode()){e<this._value&&(e=this._value);var t=this._rngMin,i=this._rngMax;if(t&&t>0||i&&i>0){var n=this._value,o=Math.ceil((e.getTime()-n.getTime())/864e5)+1;t&&t>0&&o<t&&(e=DateTime.addDays(n,t-1));i&&i>0&&o>i&&(e=DateTime.addDays(n,i-1))}}if((this._valid(e)||null==e)&&!DateTime.equals(this._rngEnd,e)){this._rngEnd=e;this.ensureVisible(e);this.invalidate(!1);this._clearingRangeEnd||this.onRangeEndChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"rangeMin",{get:function(){return this._rngMin},set:function(e){if((e=asNumber(e,!0,!0))!=this._rngMin){this._rngMin=e;this._syncProp(this,"rangeMin");this._rngMode()&&this._rngEnd&&(this.rangeEnd=this._rngEnd)}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"rangeMax",{get:function(){return this._rngMax},set:function(e){if((e=asNumber(e,!0,!0))!=this._rngMax){this._rngMax=e;this._syncProp(this,"rangeMax");this._rngMode()&&this._rngEnd&&(this.rangeEnd=this._rngEnd)}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"min",{get:function(){return this._min},set:function(e){if((e=asDate(e,!0))!=this.min){this._min=e;this._syncProp(this,"min");this.refresh();!this.value&&e&&e>this.displayMonth&&this.ensureVisible(e)}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"max",{get:function(){return this._max},set:function(e){if((e=asDate(e,!0))!=this.max){this._max=e;this._syncProp(this,"max");this.refresh();!this.value&&e&&e<this.displayMonth&&this.ensureVisible(e)}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"selectionMode",{get:function(){return this._selMode},set:function(e){var t=DateSelectionMode;if((e=asEnum(e,t))!=this._selMode){this._selMode=e;this._mthMode()&&(this.monthView=!1);e!=t.Range||this._rngEnd||(this._rngEnd=this._value);this.refresh();this._syncProp(this,"selectionMode")}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"isReadOnly",{get:function(){return this._readOnly},set:function(e){this._readOnly=asBoolean(e);toggleClass(this.hostElement,ControlStateClsNames.readOnly,this.isReadOnly);this._syncProp(this,"isReadOnly")},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"handleWheel",{get:function(){return this._handleWheel},set:function(e){if(this._handleWheel!=e){this._handleWheel=asBoolean(e);this._syncProp(this,"handleWheel")}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"repeatButtons",{get:function(){return!this._rptUp.disabled},set:function(e){this._rptUp.disabled=this._rptDn.disabled=!asBoolean(e);this._syncProp(this,"repeatButtons")},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"showYearPicker",{get:function(){return this._yrPicker},set:function(e){if(e!=this._yrPicker){this._yrPicker=asBoolean(e);this._syncProp(this,"showYearPicker")}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"showMonthPicker",{get:function(){return this._mtPicker},set:function(e){if(e!=this._mtPicker){var t=ShowMonthPicker;isBoolean(e)&&(e=e?t.FirstMonth:t.None);this._mtPicker=asEnum(e,t);toggleClass(this.hostElement,InputFormElementsClsNames.btnsOutside,this._getShowMonthPicker()==t.Outside);this.refresh();this._syncProp(this,"showMonthPicker")}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"firstDayOfWeek",{get:function(){return this._fdw},set:function(e){if(e!=this._fdw){if((e=asNumber(e,!0))&&(e>6||e<0))throw"firstDayOfWeek must be between 0 and 6 (Sunday to Saturday).";this._fdw=e;this.refresh();this._syncProp(this,"firstDayOfWeek")}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"displayMonth",{get:function(){return this._month},set:function(e){e=asDate(e);e=this._getMonth(e);var t=this._getDisplayMonthRange();t.to&&e>t.to&&(e=t.to);t.from&&e<t.from&&(e=t.from);if(!DateTime.equals(this.displayMonth,e)){this._month=e;this.invalidate(!0);this.onDisplayMonthChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"monthCount",{get:function(){var e=this.hostElement;return e?e.querySelectorAll("."+CalendarClsNames.hostElement).length+1:0},set:function(e){var t=this,i=this.hostElement;if(e!=this.monthCount&&i){var n=i.querySelectorAll("."+CalendarClsNames.hostElement);e=asInt(e,!1);assert(e>0,"monthCount must be >= 1.");assert(1==e||!closest(i.parentElement,"."+CalendarClsNames.hostElement),"Only top-level calendars can set monthCount.");for(var o=0;o<n.length;o++){var s=n[o];removeChild(s);this._getCalendar(s).dispose()}this._cals=[this];for(o=1;o<e;o++){(s=new Calendar(document.createElement("div"),{itemFormatter:this.itemFormatter,itemValidator:this.itemValidator,formatItem:function(e,i){return t.onFormatItem(i)}}))._selMode=this._selMode;s._value=this._value;s._rngEnd=this._rngEnd;for(var r in this)if(!/^(_.*|constructor|displayMonth|monthCount|hostElement|rightToLeft|isUpdating|isTouching|keyActionTab)$/.test(r)){var a=this[r];isFunction(a)||a instanceof Event||(s[r]=a)}this._cals.push(s);i.appendChild(s.hostElement)}this.updateCalendarsTabindex();toggleClass(i,CalendarClsNames.calendarMultiMonth,e>1);this._syncProp(this,"displayMonth")}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"formatYearMonth",{get:function(){return this._fmtYrMo},set:function(e){if(e!=this._fmtYrMo){this._fmtYrMo=asString(e);this._syncProp(this,"formatYearMonth");this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"formatDayHeaders",{get:function(){return this._fmtDayHdr},set:function(e){if(e!=this._fmtDayHdr){this._fmtDayHdr=asString(e);this._syncProp(this,"formatDayHeaders");this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"formatDays",{get:function(){return this._fmtDay},set:function(e){if(e!=this._fmtDay){this._fmtDay=asString(e);this._syncProp(this,"formatDays");this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"formatYear",{get:function(){return this._fmtYr},set:function(e){if(e!=this._fmtYr){this._fmtYr=asString(e);this._syncProp(this,"formatYear");this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"formatMonths",{get:function(){return this._fmtMonths},set:function(e){if(e!=this._fmtMonths){this._fmtMonths=asString(e);this._syncProp(this,"formatMonths");this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"showHeader",{get:function(){return"none"!=this._tbHdr.style.display},set:function(e){if(e!=this.showHeader){this._tbHdr.style.display=asBoolean(e)?"":"none";this._syncProp(this,"showHeader")}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"monthView",{get:function(){return"none"!=this._tbMth.style.display},set:function(e){if(e!=this.monthView){this._tbMth.style.display=e?"":"none";this._tbYr.style.display=e?"none":"";if(!e&&this.isThisMainCalendar()){var t=this.focusValue.getDate(),i=DateTime.clone(this.displayMonth);i.setDate(t);this.focusValue=i}this.refresh();var n=culture.Calendar.ariaLabels;setAriaLabel(this._btnPrv,e?n.prvMo:n.prvYr);setAriaLabel(this._btnTdy,e?n.today:n.currMo);setAriaLabel(this._btnNxt,e?n.nxtMo:n.nxtYr);setAriaLabel(this._btnMth,e?n.monthView:n.yearView);this._updateMonthButtonAria();this._syncProp(this,"monthView")}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"weeksBefore",{get:function(){return this._wksBefore},set:function(e){if(e!=this._wksBefore){this._wksBefore=Math.floor(asNumber(e,!1,!0));this._syncProp(this,"weeksBefore");this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"weeksAfter",{get:function(){return this._wksAfter},set:function(e){if(e!=this._wksAfter){this._wksAfter=Math.floor(asNumber(e,!1,!0));this._syncProp(this,"weeksAfter");this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"itemFormatter",{get:function(){return this._itemFormatter},set:function(e){if(e!=this._itemFormatter){this._itemFormatter=asFunction(e);this._syncProp(this,"itemFormatter");this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"itemValidator",{get:function(){return this._itemValidator},set:function(e){if(e!=this._itemValidator){this._itemValidator=asFunction(e);this._syncProp(this,"itemValidator");this.invalidate()}},enumerable:!0,configurable:!0});Calendar.prototype.hitTest=function(e){var t=e instanceof MouseEvent?e.target:e instanceof Element?e:null;assert(null!=t,"MouseEvent or Element expected");return t?t[Calendar._DATE_KEY]:null};Calendar.prototype.ensureVisible=function(e){if(null!=e){var t=this._getCalendars(),i=t.indexOf(this),n=t[0],o=t[t.length-1];e<n.displayMonth||!this.monthView&&this.focusMode?this.displayMonth=DateTime.addMonths(this._getMonth(e),i):e>o.displayMonth&&(this.displayMonth=DateTime.addMonths(this._getMonth(e),i-t.length+1))}};Calendar.prototype.onValueChanged=function(e){this.valueChanged.raise(this,e);this._syncProp(this,"value")};Calendar.prototype.onRangeEndChanged=function(e){this.rangeEndChanged.raise(this,e);this._syncProp(this,"rangeEnd");this._value&&this._rngEnd&&this.onRangeChanged(e)};Calendar.prototype.onRangeChanged=function(e){this.rangeChanged.raise(this,e)};Calendar.prototype.onDisplayMonthChanged=function(e){this.displayMonthChanged.raise(this,e);this._syncProp(this,"displayMonth")};Calendar.prototype.onFormatItem=function(e){this.formatItem.raise(this,e)};Calendar.prototype._containsFocusImpl=function(t){return e.prototype._containsFocusImpl.call(this,t)||this._lbYears._containsFocusImpl(t)};Calendar.prototype.dispose=function(){this._rptUp.element=null;this._rptDn.element=null;this._lbYears.dispose();e.prototype.dispose.call(this)};Calendar.prototype.refresh=function(t){void 0===t&&(t=!0);var i=this.hostElement,n=this.containsFocus();if(i){e.prototype.refresh.call(this,t);t&&this._updateContent();this._updateSelection();var o=this._getDisplayMonthRange(),s=this.displayMonth,r=null==o.from||s>o.from,a=null==o.to||s<o.to;enable(this._btnPrv,r);enable(this._btnNxt,a);r&&a||this.containsFocus()||this.focus();var l=!0,h=DateTime.newDate(),u=this._min&&this._min>h,c=this._max&&this._max<h;(u||c)&&(l=!1);enable(this._btnTdy,l);if(n&&!this._isButtonFocused()){var p=(this.monthView?this._tbMth:this._tbYr).querySelector("td."+ControlStateClsNames.selected)||i;p&&!this.focusMode&&p.focus()}var d=this._getCalendars();d.length>1&&this.isThisMainCalendar()&&d.forEach((function(e,i){i>0&&e.refresh(t)}))}};Calendar.prototype._getShowMonthPicker=function(){var e=ShowMonthPicker,t=this._getCalendars(),i=t.indexOf(this),n=this.showMonthPicker;switch(n){case e.FirstMonth:case e.Outside:return 0==i?n:0;case e.LastMonth:return i==t.length-1?n:0;case e.FirstAndLastMonths:return 0==i||i==t.length-1?n:0;case e.AllMonths:return n}return 0};Calendar.prototype._getDisplayMonthRange=function(){var e={from:null,to:null};if(this.min||this.max){var t=this._getCalendars(),i=t.indexOf(this),n=this._mthMode()?DateTime.addYears:DateTime.addMonths;this.min&&(e.from=n(this._getMonth(this.min),i));this.max&&(e.to=n(this._getMonth(this.max),i-t.length+1))}return e};Calendar.prototype._getCalendar=function(e){return Control.getControl(e)};Calendar.prototype._getCalendars=function(){var e=closest(this.hostElement,"."+CalendarClsNames.calendarMultiMonth);return(e?this._getCalendar(e):this)._cals};Calendar.prototype._syncProp=function(e,t){var i=this;if(!this._syncing){var n=this._getCalendars();if(n&&n.length>1){var o=e[t],s=this._mthMode()?DateTime.addYears:DateTime.addMonths;"displayMonth"==t&&(o=s(o,-n.indexOf(e)));n[0].deferUpdate((function(){i._syncing=!0;n.forEach((function(n,r){if(n!=e){var a=n.displayMonth;n[t]="displayMonth"==t?s(o,r):o;if("value"==t){n.displayMonth=a;i._rngMode()&&(n.rangeEnd=null)}}}));i._syncing=!1}))}}};Calendar.prototype._updateContent=function(){var e=this.displayMonth,t=Globalize.format,i=DateTime,n=this._getShowMonthPicker();setText(this._spMth,t(e,this._fmtYrMo));var o=this._btnMth.querySelector("."+GlyphClsNames.down);o&&(o.style.display=this._mthMode()||!n?"none":"");var s=closest(this._btnTdy,"."+InputFormElementsClsNames.btnGroup);s&&(s.style.display=n?"":"none");var r=null!=this._fdw?this._fdw:Globalize.getFirstDayOfWeek(),a=i.addDays(e,-(e.getDay()-r+7)%7),l=i.monthLast(e),h=this._tbMth.querySelectorAll("th");this._updateMonthButtonAria();for(var u=0;u<7&&u<h.length;u++){var c=i.addDays(a,u);setText(h[u],t(c,this._fmtDayHdr));setAttribute(h[u],"tabIndex","-1");setAttribute(h[u],"abbr",t(c,this._fmtDayTitle))}var p=!1;this._dateViewContainsFocus()&&(p=!0);var d=this._tbMth.querySelectorAll("tr");for(u=1;u<d.length;u++)removeChild(d[u]);p&&this.focus();var m=i.addDays(a,-7*this._wksBefore);for(u=0;u<this._wksBefore;u++)m=this._addWeek(m,CalendarClsNames.weekBefore);for(;m<=l;)m=this._addWeek(m);for(u=0;u<this._wksAfter;u++)m=this._addWeek(m,CalendarClsNames.weekAfter);h=this._tbYr.querySelectorAll("td");var _=this._tbYr.querySelectorAll("th");_.length&&setText(_[0],t(e,this._fmtYr));for(u=0;u<h.length;u++){m=i.newDate(e.getFullYear(),u,1);var f=h[u],b=!this._monthInValidRange(m);f[Calendar._DATE_KEY]=m;var g=Globalize.format(m,"MMMM yyyy");setText(f,t(m,this._fmtMonths));toggleClass(f,ControlStateClsNames.disabled,b);setAriaLabel(f,g);setAttribute(f,"tabIndex","-1");setAttribute(f,"abbr",g)}this._confirmationButtonContainer&&(this._confirmationButtonContainer.style.display=this.showConfirmationButtons?"":"none");this._updateButtonTabIndex()};Calendar.prototype._updateSelection=function(){for(var e=Calendar._DATE_KEY,t=DateTime,i=this._tbMth.querySelectorAll("td"),n=0;n<i.length;n++){var o=this.rangeEnd;this._rngMode()||(o=null);var s=(u=i[n])[e],r=this.value,a=this._selMode&&null!=r&&t.sameDate(s,r),l=this._selMode&&null!=r&&t.sameDate(s,o),h=this._selMode&&null!=r&&s>r&&null!=o&&s<=o;toggleClass(u,ControlStateClsNames.selected,a);toggleClass(u,ControlStateClsNames.multiSelected,h);toggleClass(u,ControlStateClsNames.lastSelected,l);setAttribute(u,"aria-selected",!!a||null);this._customizeCell(n,s,u)}i=this._tbYr.querySelectorAll("td");for(n=0;n<i.length;n++){var u;s=(u=i[n])[e],a=this._sameMonth(s,this.value);toggleClass(u,ControlStateClsNames.selected,a);setAttribute(u,"aria-selected",!!a||null)}this.focusMode&&!0!==this.isDisabled&&-1!==this.tabOrder&&this._updateFocusInAccessibilityMode()};Calendar.prototype._updateFocusInAccessibilityMode=function(){for(var e=Calendar._DATE_KEY,t=DateTime,i=this._getCalendars(),n=0;n<i.length;n++)for(var o=i[n]._tbMth.querySelectorAll("td"),s=0;s<o.length;s++){var r=(h=o[s])[e],a=this._selMode&&null!=this.focusValue&&t.sameDate(r,this.focusValue)&&!hasClass(h,CalendarClsNames.dayOtherMonth);this._updateCellFocus(h,a)}var l=i[0]._tbYr.querySelectorAll("td");for(s=0;s<l.length;s++){var h;r=(h=l[s])[e],a=null!=this.focusValue&&this._sameMonth(r,this.focusValue);this._updateCellFocus(h,a)}};Calendar.prototype._addWeek=function(e,t){for(var i=this._createElement("tr",this._tbMth,t),n=DateTime,o=0;o<7;o++){var s=this._createElement("td",i),r=n.addDays(e,o);s[Calendar._DATE_KEY]=r;setText(s,Globalize.format(r,this._fmtDay));setAriaLabel(s,Globalize.format(r,"D"));var a=!this._valid(r),l=r.getDay(),h=r.getMonth()!=this.displayMonth.getMonth();toggleClass(s,CalendarClsNames.dayToday,n.sameDate(r,n.newDate()));toggleClass(s,CalendarClsNames.dayWeekend,0==l||6==l);toggleClass(s,CalendarClsNames.dayOtherMonth,h);toggleClass(s,ControlStateClsNames.invalid,a||!this._inValidRange(r));setAttribute(s,"aria-disabled",a||!this._inValidRange(r))}return n.addDays(e,7)};Calendar.prototype._customizeCell=function(e,t,i){isFunction(this.itemFormatter)&&this.itemFormatter(t,i);if(this.formatItem.hasHandlers){var n=new FormatItemEventArgs(e,t,i);this.onFormatItem(n)}};Calendar.prototype._canChangeValue=function(){return!this._readOnly&&this._selMode!=DateSelectionMode.None};Calendar.prototype._valid=function(e){return!(!isDate(e)||!DateTime.sameDate(e,this._clamp(e)))&&(!isFunction(this.itemValidator)||this.itemValidator(e))};Calendar.prototype._inValidRange=function(e){var t=DateTime.fromDateTime;return!(this.min&&e<t(this.min,e))&&!(this.max&&e>t(this.max,e))};Calendar.prototype._monthInValidRange=function(e){if(this.min||this.max){var t=e.getFullYear(),i=e.getMonth(),n=DateTime,o=n.newDate(t,i,1),s=n.newDate(t,i+1,0);if(this.min&&this.min>s)return!1;if(this.max&&this.max<o)return!1}return!0};Calendar.prototype._sameMonth=function(e,t){return isDate(e)&&isDate(t)&&e.getMonth()==t.getMonth()&&e.getFullYear()==t.getFullYear()};Calendar.prototype._getValidDate=function(e,t){if(isDate(e))for(var i=e.getFullYear(),n=e.getMonth()+(t?0:1),o=t?1:0,s=DateTime,r=s.newDate(i,n,o),a=t?1:-1,l=0;l<31;l++){if(this._valid(r))return r;r=s.addDays(r,a)}return null};Calendar.prototype._clamp=function(e){if(e){var t=DateTime.fromDateTime;if(this.min){var i=t(this.min,e);e<i&&(e=i)}if(this.max){var n=t(this.max,e);e>n&&(e=n)}}return e};Calendar.prototype._createChildren=function(){var e=this.getTemplate();this.applyTemplate(ControlClsNames.hostElement+" "+CalendarClsNames.hostElement,e,{_tbHdr:"tbl-header",_btnMth:"btn-month",_spMth:"span-month",_btnPrv:"btn-prev",_btnTdy:"btn-today",_btnNxt:"btn-next",_tbMth:"tbl-month",_tbYr:"tbl-year"});this._tbYr.style.display="none";var t=culture.Calendar.ariaLabels;setAriaLabel(this._tbMth,t.chooseDate);setAriaLabel(this._tbYr,t.chooseMonth);setAriaLabel(this._btnPrv,t.calendar);setAriaLabel(this._btnMth,t.monthView);setAriaLabel(this._btnPrv,t.prvMo);setAriaLabel(this._btnTdy,t.today);setAriaLabel(this._btnNxt,t.nxtMo);for(var i=this._createElement("tr",this._tbMth,CalendarClsNames.header),n=0;n<7;n++){this._createElement("th",i).setAttribute("scope","col")}i=this._createElement("tr",this._tbYr,CalendarClsNames.header);this._showYearListBoxButton=this._createElement("th",i);this._showYearListBoxButton.setAttribute("colspan","4");this._showYearListBoxButton.setAttribute("scope","col");setAriaLabel(this._showYearListBoxButton,t.selectYear);toggleClass(this._showYearListBoxButton,CalendarClsNames.selectedYear);this._showYearListBoxButton.setAttribute("role","button");this._showYearListBoxButton.setAttribute("tabIndex","-1");for(var o=0;o<3;o++){i=this._createElement("tr",this._tbYr);for(var s=0;s<4;s++)this._createElement("td",i)}};Calendar.prototype._createYearPicker=function(){var e=this,t=this.hostElement,i=this._createElement("div",null,DropDownClsNames.dropDownPanel+" "+CalendarClsNames.yearPicker);i.tabIndex=this._orgTabIndex;this._lbYears=new ListBox(i,{lostFocus:function(t){hidePopup(i);e._tmYrHidden=Date.now();e.removeEventListener(window,"touchstart");if(t.selectedIndex>-1){var n=DateTime.clone(e.displayMonth);n.setFullYear(t.selectedIndex+t.itemsSource[0]);e.displayMonth=n;e.focusMode&&(e.focusValue=n)}e.keyActionTab===CalendarTabKeyAction.All&&e._showYearListBoxButton.focus()}});setAriaLabel(this._lbYears.hostElement,culture.Calendar.ariaLabels.selectYear);this.addEventListener(i,"keydown",(function(i){switch(i.keyCode){case Key.Enter:t.focus();break;case Key.Space:t.focus();i.preventDefault();break;case Key.Escape:e._lbYears.selectedIndex=-1;t.focus()}i.defaultPrevented&&i.stopPropagation()}));this.addEventListener(i,"click",(function(e){t.focus()}))};Calendar.prototype._createElement=function(e,t,i){var n=document.createElement(e);i&&addClass(n,i);t&&t.appendChild(n);return n};Calendar.prototype._click=function(e){if(!e.defaultPrevented&&0==e.button){var t=!1,i=e.target;if(contains(this._btnMth,i)&&!this._mthMode()&&this._getShowMonthPicker()){this.monthView=!this.monthView;t=!0}else if(contains(this._btnPrv,i)){this._navigate(-1);if(this.focusMode){var n=DateTime.addMonths(this.focusValue,-1);this.focusValue=n}t=!0}else if(contains(this._btnNxt,i)){this._navigate(1);if(this.focusMode){n=DateTime.addMonths(this.focusValue,1);this.focusValue=n}t=!0}else if(contains(this._btnTdy,i)){this._navigate(0);this.focusMode&&(this.focusValue=this.value);t=!0}if(i&&!t&&this._yrPicker&&contains(this._tbYr,i)&&closest(i,"."+CalendarClsNames.header)){this._showYearPickerAction(e);return}if(i&&!t){var o=closest(i,"td");if(o){var s=this.hitTest(o),r=DateTime.fromDateTime;if(this.monthView){if(s&&this._canChangeValue()){var a=r(s,this._value);this._inValidRange(a)&&this._valid(a)&&(this._rngMode()&&this.value&&!this.rangeEnd&&a>=this.value?this.rangeEnd=a:this.value=a);t=!0}}else if(s){this.displayMonth=s;if(this._mthMode()){if(this._canChangeValue()){a=r(this.displayMonth,this.value);this._inValidRange(a)&&(this.value=a)}}else this.monthView=!0;t=!0}}}if(t){e.preventDefault();this.focusMode||0===e.detail||this.focus()}}};Calendar.prototype._keydown=function(e){this._isSpaceDownForSetValue=!1;if(!e.defaultPrevented){if(e.altKey)switch(e.keyCode){case Key.Up:case Key.Down:return;case Key.End:this._navigate(0);e.preventDefault();return}var t=e.target;if(("Enter"===e.key||"Space"===e.code)&&t&&this.keyActionTab===CalendarTabKeyAction.All){if(contains(this._btnMth,t)&&!this._mthMode()&&this._getShowMonthPicker()){this.monthView=!this.monthView;"Space"===e.code&&e.preventDefault();return}if(this._yrPicker&&contains(this._tbYr,t)&&closest(t,"."+CalendarClsNames.header)){this._showYearPickerAction(e);return}}if(this.focusMode){if(("Enter"===e.key||"Space"===e.code)&&t.classList.contains(CalendarClsNames.focused)){var i=closest(t,"td");if(i){var n=this.hitTest(i);this._isSpaceDownForSetValue="Space"===e.code;this.setFocusModeValue(n,e)}"Space"===e.code&&e.preventDefault();return}if(!contains(this._tbMth,e.target)&&(!contains(this._tbYr,e.target)||contains(this._tbYr.firstElementChild,e.target)))return;if("Tab"===e.key&&this.monthView){var o=this._getCalendars();if(this!==o[e.shiftKey?0:o.length-1]){var s=DateTime.addMonths(this.focusValue,e.shiftKey?-1:1);this.focusValue=s;e.preventDefault()}}}if(!(e.ctrlKey||e.metaKey||e.shiftKey&&!this._rngMode())){var r=this._getKeyCode(e),a=0,l=0,h=!0;if(this.monthView)switch(r){case Key.Left:a=-1;break;case Key.Right:a=1;break;case Key.Up:a=-7;break;case Key.Down:a=7;break;case Key.PageDown:l=e.altKey?12:1;break;case Key.PageUp:l=e.altKey?-12:-1;break;case Key.Home:case Key.End:if(this._canChangeValue()&&!e.shiftKey){var u=this.value||this.displayMonth;if(p=this._getValidDate(u,r==Key.Home)){this.value=DateTime.fromDateTime(p,this.value);this._rngEnd=null}}break;default:h=!1}else switch(r){case Key.Left:l=-1;break;case Key.Right:l=1;break;case Key.Up:l=-4;break;case Key.Down:l=4;break;case Key.PageDown:l=e.altKey?120:12;break;case Key.PageUp:l=e.altKey?-120:-12;break;case Key.Home:l=this.value?-this.value.getMonth():0;break;case Key.End:l=this.value?11-this.value.getMonth():0;break;case Key.Enter:this._mthMode()?h=!1:this.monthView=!0;break;default:h=!1}if(this._canChangeValue()&&(a||l)){var c=e.shiftKey&&null!=this.rangeEnd?this.rangeEnd:this.focusMode?this.focusValue:this.value,p=DateTime;if(c){c=p.addDays(c,a);c=p.addMonths(c,l)}else c=this._getValidDate(new Date,!0);if(l&&!this._valid(c)){u=c.getMonth();for(var d=1;d<31&&!this._valid(c);d++){var m=p.addDays(c,+d),_=p.addDays(c,-d);this._valid(m)&&m.getMonth()==u?c=m:this._valid(_)&&_.getMonth()==u&&(c=_)}}for(d=0;d<31&&!this._valid(c);d++)c=p.addDays(c,a>0||l>0?1:-1);e.shiftKey&&this._rngMode()&&c>this.value?this.rangeEnd=c:this.focusMode?this.focusValue=c:this.value=c}h&&e.preventDefault()}}};Calendar.prototype._getMonth=function(e){var t=DateTime;e=e||t.newDate();return t.newDate(e.getFullYear(),e.getMonth(),1)};Calendar.prototype._mthMode=function(){return this.selectionMode==DateSelectionMode.Month};Calendar.prototype._rngMode=function(){return this.selectionMode==DateSelectionMode.Range};Calendar.prototype._navigate=function(e){var t=this.monthView,i=this.displayMonth,n=DateTime;switch(e){case 0:var o=n.newDate();this._canChangeValue()&&(this.value=t?n.fromDateTime(o,this.value):this._getMonth(o));i=this._getMonth(o);break;case 1:i=n.addMonths(i,t?1:12);break;case-1:i=n.addMonths(i,t?-1:-12)}this.displayMonth=i};Calendar.prototype._setTabOrder=function(t){e.prototype._setTabOrder.call(this,t);this._lbYears.tabOrder=this._orgTabIndex;this._getCalendars().forEach((function(e){e.tabOrder!=t&&(e.tabOrder=t)}));this.updateCalendarsTabindex()};Calendar.prototype._showYearPickerAction=function(e){var t=this,i=e.target;if(Date.now()-this._tmYrHidden<600)e.preventDefault();else{for(var n=this.displayMonth.getFullYear(),o=this.min?this.min.getFullYear():n-100,s=this.max?this.max.getFullYear():n+100,r=[],a=o;a<=s;a++)r.push(a);var l=this._lbYears,h=l.hostElement,u=closest(i,"."+CalendarClsNames.header),c=this.hostElement,p=closest(c,"."+InputDateClsNames.inputDateDropDown)||c;l.itemsSource=r;l.selectedIndex=n-r[0];setAttribute(h,"dir",this.rightToLeft?"rtl":null);setCss(h,{minWidth:"",width:u.offsetWidth});showPopup(h,u,!1,!1,p);requestAnimationFrame((function(){l.showSelection(!0)}));this.addEventListener(window,"touchstart",(function(e){if(!contains(h,e.target)){hidePopup(h);t._tmYrHidden=Date.now();t.removeEventListener(window,"touchstart")}}));e.preventDefault()}};Object.defineProperty(Calendar.prototype,"focusMode",{get:function(){return this._focusMode},set:function(e){this._focusMode=e;this._getCalendars().forEach((function(t){t.focusMode!==e&&(t.focusMode=e)}));this.updateCalendarsTabindex();this.invalidate()},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"keyActionTab",{get:function(){return this._keyActionTab},set:function(e){this._keyActionTab=e;this._updateButtonTabIndex()},enumerable:!0,configurable:!0});Calendar.prototype._isButtonFocused=function(){var e=getActiveElement();if(!e)return!1;var t=e.getAttribute("role"),i=e.type;return t&&"button"===t.toLowerCase()||i&&"button"===i.toLowerCase()};Calendar.prototype._isSameMonth=function(e,t){return e.getMonth()===t.getMonth()};Calendar.prototype._dateViewContainsFocus=function(){var e=this._tbYr.querySelectorAll("td"),t=Array.from(e).find((function(e){return e===getActiveElement()}));return this._tbMth.contains(getActiveElement())||void 0!==t};Calendar.prototype._updateMonthButtonAria=function(){var e=culture.Calendar.ariaLabels,t=this.monthView?e.monthView:e.yearView;setAriaLabel(this._btnMth,t+", "+Globalize.format(this.displayMonth,this._fmtYrMo))};Calendar.prototype._isDayValid=function(e){return this._valid(e)&&this._inValidRange(e)};Calendar.prototype.cancelButtonClick=function(e){this.cancelButtonClicked.raise(this,e)};Calendar.prototype.oneCancelButtonClick=function(e){this.cancelButtonClick(e)};Calendar.prototype.OKButtonClick=function(e){this.OKButtonClicked.raise(this,e)};Calendar.prototype.onOkButtonClick=function(e){this.OKButtonClick(e);this.setFocusModeValue(this.focusValue)};Object.defineProperty(Calendar.prototype,"ariaLabel",{get:function(){return this._ariaLabel},set:function(e){if(this.ariaLabel!==e&&this.hostElement){this._ariaLabel=e;setAttribute(this.hostElement,"aria-label",e)}},enumerable:!0,configurable:!0});Calendar.prototype._updateButtonTabIndex=function(){var e=this.tabOrder.toString();if(this.keyActionTab===CalendarTabKeyAction.All&&!0!==this.isDisabled){setAttribute(this._btnMth,"tabindex",e);setAttribute(this._btnPrv,"tabindex",e);setAttribute(this._btnTdy,"tabindex",e);setAttribute(this._btnNxt,"tabindex",e);setAttribute(this._showYearListBoxButton,"tabindex",e)}else{setAttribute(this._btnMth,"tabindex","-1");setAttribute(this._btnPrv,"tabindex","-1");setAttribute(this._btnTdy,"tabindex","-1");setAttribute(this._btnNxt,"tabindex","-1");setAttribute(this._showYearListBoxButton,"tabindex","-1")}setAttribute(this._btnOK,"tabindex",e);setAttribute(this._btnCancel,"tabindex",e)};Calendar.prototype._onEnterKeyDownToSetValue=function(e){this._enterKeyDownToSetValue.raise(this,e)};Object.defineProperty(Calendar.prototype,"showConfirmationButtons",{get:function(){return this._showConfirmationButtons},set:function(e){this._showConfirmationButtons=e;this._getCalendars().forEach((function(t){t._showConfirmationButtons=e}))},enumerable:!0,configurable:!0});Calendar.prototype._setIsDisabled=function(t){e.prototype._setIsDisabled.call(this,t);this._updateButtonTabIndex()};Calendar.prototype.updateCalendarsTabindex=function(){var e=this.focusMode||-1===this.tabOrder?-1:0;this._getCalendarsHostElements().forEach((function(t){t.tabIndex=e}))};Calendar.prototype.setFocusModeValue=function(e,t){var i=DateTime.fromDateTime;if(this.monthView){if(e&&this._canChangeValue()){var n=i(e,this._value);if(this._inValidRange(n)&&this._valid(n))if(this._rngMode()&&this.value&&!this.rangeEnd&&n>=this.value)this.rangeEnd=n;else{t&&this._enterKeyDownToSetValue.raise(this,t);this.value=n}}}else if(e){this.displayMonth=e;if(this._mthMode()){if(this._canChangeValue()){n=i(this.displayMonth,this.value);this._inValidRange(n)&&(this.value=n)}}else this.monthView=!0}};Calendar.prototype._getCalendarsHostElements=function(){return this._getCalendars().filter((function(e,t){return t>0})).map((function(e){return e.hostElement}))};Calendar.prototype.updateConfirmationButtons=function(e){if(!this._confirmationButtonContainer){var t='<div class="'+CalendarClsNames.confirmationButtonContainer+'"></div>';this._confirmationButtonContainer=createElement(t);this._btnOK=createElement('<button wj-part="btn-ok" class="'+InputFormElementsClsNames.btn+" "+CalendarClsNames.button+'"></button>');this._btnCancel=createElement('<button wj-part="btn-cancel" class="'+InputFormElementsClsNames.btn+" "+CalendarClsNames.button+'"></button>');var i=culture.Calendar.buttons;setText(this._btnOK,i.ok);setText(this._btnCancel,i.cancel);var n=this.addEventListener.bind(this);n(this._btnCancel,"click",this.oneCancelButtonClick.bind(this));n(this._btnOK,"click",this.onOkButtonClick.bind(this));this._confirmationButtonContainer.appendChild(this._btnOK);this._confirmationButtonContainer.appendChild(this._btnCancel);e.appendChild(this._confirmationButtonContainer)}};Calendar.prototype.setFocusValueToFirstOrLastCalendar=function(e){var t,i=this._getCalendars();t=this.monthView?e?i[0].displayMonth:i[i.length-1].displayMonth:i[0].displayMonth;var n=this.focusValue.getDate(),o=new Date(t.getFullYear(),t.getMonth()+1,0).getDate(),s=new Date(t.getFullYear(),t.getMonth(),Math.min(n,o));this.focusValue=s};Calendar.prototype.isCalendarDateCell=function(e){return!isNullOrUndefined(e[Calendar._DATE_KEY])&&"td"===e.tagName.toLowerCase()};Calendar.prototype.isThisMainCalendar=function(){return this==this._getCalendars()[0]};Calendar._DATE_KEY="$WJ-DATE";Calendar._ctrlTemplate="";return Calendar}(Control);export{Calendar};export function softTouch(){return _getModule("wijmo.touch")}export function getDragDropTouch(){var e=softTouch();return e&&e.DragDropTouch&&e.DragDropTouch.getInstance?e.DragDropTouch.getInstance():null}_addCultureInfo("DropDown",{ariaLabels:{tgl:"Toggle Dropdown"}});export var ClickAction;!function(e){e[e.Select=0]="Select";e[e.Open=1]="Open";e[e.Toggle=2]="Toggle"}(ClickAction||(ClickAction={}));export var KeyAction;!function(e){e[e.ChangeSelectionOnly=0]="ChangeSelectionOnly";e[e.OpenDropdown=1]="OpenDropdown"}(KeyAction||(KeyAction={}));export var TabKeyAction;!function(e){e[e.CloseAndKeepFocus=0]="CloseAndKeepFocus";e[e.CloseAndMoveFocus=1]="CloseAndMoveFocus"}(TabKeyAction||(TabKeyAction={}));var _Edges,DropDown=function(e){__extends(DropDown,e);function DropDown(t,i){var n=e.call(this,t)||this;n._clickAction=ClickAction.Select;n._showBtn=!0;n._autoExpand=!0;n._animate=!1;n._internalSettingText=!1;n._oldText="";n._keyActionDownArrow=KeyAction.ChangeSelectionOnly;n._keyActionUpArrow=KeyAction.ChangeSelectionOnly;n._keyActionTab=TabKeyAction.CloseAndMoveFocus;n._touchMove=!1;n._isDropdownOpened=!1;n.textChanged=new Event;n.isDroppedDownChanging=new Event;n.isDroppedDownChanged=new Event;var o,s=n.getTemplate();n.applyTemplate(ControlClsNames.hostElement+" "+ControlClsNames.content+" "+DropDownClsNames.hostElement,s,{_tbx:"input",_btn:"btn",_dropDown:"dropdown"},"input");n.hostElement&&n.hostElement.id&&(o=n.hostElement.id);o&&n._dropDown&&n._dropDown.setAttribute("dropdown-id",o);n._dropDown.style.display="none";var r=culture.DropDown.ariaLabels;setAriaLabel(n._btn.querySelector("button"),r.tgl);n._elRef=n._tbx;var a=n._tbx;disableAutoComplete(a);n._createDropDown();n._updateTbxAriaHaspopup();n._updateBtn();n._updateTbx();var l=n.hostElement;addClass(l,ControlStateClsNames.collapsed);n.addEventListener(window,"resize",(function(){n.isDroppedDown&&n.invalidate()}));var h=n.dropDown,u=n.addEventListener.bind(n),c=n._updateFocusState.bind(n);u(h,"blur",c,!0);u(h,"focus",c);var p=n._keydown.bind(n);u(l,"keydown",p);u(h,"keydown",p);var d=n._keypress.bind(n);u(l,"keypress",d,!0);u(h,"keypress",d,!0);var m=n._input.bind(n);u(a,"input",m);u(a,"beforeinput",(function(e){"historyUndo"!==e.inputType&&"historyRedo"!==e.inputType||e.preventDefault()}));u(a,"blur",(function(){n._commitText(!0,!1)}),!0);u(a,"click",(function(){n._autoExpand&&n._expandSelection()}));u(a,"touchstart",(function(){n.isTouching&&"none"===a.getAttribute("inputmode")&&a.removeAttribute("inputmode")}));u(a,"mousedown",(function(e){if(n._isTouchMoved())e.preventDefault();else switch(n._clickAction){case ClickAction.Open:if(!n.isDroppedDown){e.preventDefault();n.focus();n.isDroppedDown=!0}break;case ClickAction.Toggle:e.preventDefault();n.focus();n.isDroppedDown=!n.isDroppedDown}}));u(n._btn,"mousedown",(function(e){n._isTouchMoved()||n._btnclick(e)}));removeChild(h);isIE()&&n._elRef==n._tbx&&u(l,"mouseup",(function(e){if(!e.defaultPrevented&&0==e.button&&hasClass(e.target,InputFormElementsClsNames.btn)){var t=getActiveElement();t&&t!=e.target&&setTimeout((function(){t.focus()}))}}));isIE9()&&u(a,"keyup",(function(){n._setText(n.text,!1)}));u(h,"click",n._dropDownClick.bind(n));return n}Object.defineProperty(DropDown,"controlTemplate",{get:function(){DropDown._ctrlTemplate||(DropDown._ctrlTemplate='<div class="'+ControlClsNames.template+'"><div class="'+InputClsNames.input+'"><div class="'+InputClsNames.inputGroup+" "+InputClsNames.inputBtnVisible+'"><input wj-part="input" type="text" class="'+InputFormElementsClsNames.formControl+'"><span wj-part="btn" class="'+InputClsNames.inputGroupBtn+'"><button class="'+InputFormElementsClsNames.btn+" "+InputFormElementsClsNames.btnDefault+'" tabindex="-1"><span class='+GlyphClsNames.down+'></span></button></span></div></div><div wj-part="dropdown" class="'+ControlClsNames.content+" "+DropDownClsNames.dropDownPanel+'"></div></div>');return DropDown._ctrlTemplate},set:function(e){DropDown._ctrlTemplate=e},enumerable:!0,configurable:!0});DropDown.prototype._isTouchMoved=function(){var e=getDragDropTouch();return e&&e.isDragging};Object.defineProperty(DropDown.prototype,"text",{get:function(){return this._tbx.value},set:function(e){if(e!=this.text){this._setText(e,!0);this._commitText()}},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"inputElement",{get:function(){return this._tbx},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"inputType",{get:function(){return this._tbx.type},set:function(e){this._tbx.type=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"isReadOnly",{get:function(){return this._tbx.readOnly},set:function(e){this._tbx.readOnly=asBoolean(e);toggleClass(this.hostElement,ControlStateClsNames.readOnly,this.isReadOnly);this.isReadOnly&&this._toggleDropDown(!1)},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"isRequired",{get:function(){return this._tbx.required},set:function(e){this._tbx.required=asBoolean("boolean"==typeof e?e:this.isRequired)},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"placeholder",{get:function(){return this._tbx.placeholder},set:function(e){this._tbx.placeholder=e},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"clickAction",{get:function(){return this._clickAction},set:function(e){this._clickAction=asEnum(e,ClickAction)},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"isDroppedDown",{get:function(){var e=this._dropDown;return e&&"none"!=e.style.display},set:function(e){var t=this.hostElement,i=this._dropDown,n=this.containsFocus(),o=new Set(["InputDateTime","WjInputDateTime"]);if(t&&i){var s=!this.isReadOnly;this.isTouching&&(s=!0);e=asBoolean(e)&&!this.isDisabled&&s&&t.offsetWidth>0;this.isDroppedDown&&!e&&this.isDisabled&&(e=this.isDroppedDown);if(e||"INPUT"!=getActiveElement().tagName||this.inputElement===getActiveElement()||!this._isInvalidInputCancelled){if(e!=this.isDroppedDown&&(o.has(this.constructor.name)||!this._isInvalidInputCancelled||!this.isDroppedDown&&this._isInvalidInputCancelled)&&this.onIsDroppedDownChanging(new CancelEventArgs)){this._toggleDropDown(e);n&&(this.isTouching&&this.showDropDownButton?t.focus():this.selectAll());this._updateFocusState();this._updateBtn();this._updateTbx();toggleClass(t,ControlStateClsNames.collapsed,!this.isDroppedDown);this.onIsDroppedDownChanged()}}else{this._isDropdownOpened=this.isDroppedDown;this._toggleDropDown(e)}}},enumerable:!0,configurable:!0});DropDown.prototype._toggleDropDown=function(e){var t=this,i=this.hostElement,n=this._dropDown;if(e){this._minWidthDropdown=n.style.minWidth;n.style.display="";this._updateDropDown();this.addEventListener(window,"touchstart",(function(e){for(var n=Control._touching,o=e.target;o;){if(o==i)return;o=o[Control._OWNR_KEY]||o.parentNode}Control._touching=!0;t.isDroppedDown=!1;Control._touching=n}))}else{this.removeEventListener(window,"touchstart");hidePopup(n);n.style.minWidth=this._minWidthDropdown}};Object.defineProperty(DropDown.prototype,"dropDown",{get:function(){return this._dropDown},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"dropDownCssClass",{get:function(){return this._cssClass},set:function(e){if(e!=this._cssClass){removeClass(this._dropDown,this._cssClass);this._cssClass=asString(e);addClass(this._dropDown,this._cssClass)}},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"showDropDownButton",{get:function(){return this._showBtn},set:function(e){this._showBtn=asBoolean(e);this._updateBtn()},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"autoExpandSelection",{get:function(){return this._autoExpand},set:function(e){this._autoExpand=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"isAnimated",{get:function(){return this._animate},set:function(e){this._animate=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"keyActionDownArrow",{get:function(){return this._keyActionDownArrow},set:function(e){this._keyActionDownArrow=asEnum(e,KeyAction)},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"keyActionUpArrow",{get:function(){return this._keyActionUpArrow},set:function(e){this._keyActionUpArrow=asEnum(e,KeyAction)},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"keyActionTab",{get:function(){return this._keyActionTab},set:function(e){this._keyActionTab=asEnum(e,TabKeyAction)},enumerable:!0,configurable:!0});DropDown.prototype.selectAll=function(){var e=this._tbx;this._elRef==e&&setSelectionRange(e,0,this.text.length);this.containsFocus()||this.focus()};DropDown.prototype.onTextChanged=function(e){this.textChanged.raise(this,e);this._updateState()};DropDown.prototype.onIsDroppedDownChanging=function(e){this.isDroppedDownChanging.raise(this,e);return!e.cancel};DropDown.prototype.onIsDroppedDownChanged=function(e){this.isDroppedDownChanged.raise(this,e)};DropDown.prototype.onGotFocus=function(t){this.isTouching||contains(this._dropDown,getActiveElement())||this.selectAll();e.prototype.onGotFocus.call(this,t)};DropDown.prototype.onLostFocus=function(t){this._commitText();this.isDroppedDown=!1;e.prototype.onLostFocus.call(this,t)};DropDown.prototype._containsFocusImpl=function(t){return e.prototype._containsFocusImpl.call(this,t)||this.isDroppedDown&&contains(this._dropDown,t)};DropDown.prototype.dispose=function(){this.isDroppedDown=!1;var t=this._dropDown;if(t){this._dropDown=null;removeChild(t);var i=Control.getControl(t);i&&i.dispose()}e.prototype.dispose.call(this)};DropDown.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);var i=this.hostElement;if(i&&i.offsetHeight&&this.isDroppedDown){var n=getActiveElement();this.isAnimated&&""!=this._dropDown.style.opacity||showPopup(this._dropDown,i,!1,!1,null==this.dropDownCssClass);n instanceof HTMLElement&&n!=getActiveElement()&&n.focus()}};DropDown.prototype._handleResize=function(){this.isDroppedDown&&this.refresh()};DropDown.prototype._dropDownClick=function(e){e.stopPropagation()};DropDown.prototype._expandSelection=function(){var e=this._tbx,t=e.value,i=e.selectionStart,n=e.selectionEnd;if(t&&i==n){var o=this._getCharType(t,i);if(o>-1){for(;n<t.length&&this._getCharType(t,n)==o;n++);for(;i>0&&this._getCharType(t,i-1)==o;i--);i!=n&&setSelectionRange(e,i,n)}}};DropDown.prototype._getCharType=function(e,t){var i=e[t];return i>="0"&&i<="9"?0:i>="a"&&i<="z"||i>="A"&&i<="Z"?1:-1};DropDown.prototype._keydown=function(e){if(!e.defaultPrevented&&!this._isHiddenEditor()){switch(e.keyCode){case Key.Escape:case Key.Enter:if(this.isDroppedDown){this.isDroppedDown=!1;this.containsFocus()||this.focus();e.preventDefault()}break;case Key.F4:this.toggleDropDown(e);break;case Key.Up:this.handleUpArrowKey(e);break;case Key.Down:this.handleDownArrowKey(e)}if(!e.defaultPrevented&&e.keyCode==Key.Escape&&isIE()){var t=this._tbx;if(e.target==t){var i=t.value;t.value=i+" ";t.value=i}}}};DropDown.prototype.toggleDropDown=function(e){if(this.isHostVisible()){this.isDroppedDown=!this.isDroppedDown;e.preventDefault()}};DropDown.prototype.handleUpArrowKey=function(e){e.altKey?this.toggleDropDown(e):this.keyActionUpArrow!==KeyAction.OpenDropdown||this.isDroppedDown||this.openDropDown(e)};DropDown.prototype.handleDownArrowKey=function(e){if(e.altKey)this.toggleDropDown(e);else if(this.keyActionDownArrow===KeyAction.OpenDropdown&&!this.isDroppedDown){this.openDropDown(e);this._afterOpenDropdownByDownArrow()}};DropDown.prototype._afterOpenDropdownByDownArrow=function(){};DropDown.prototype.openDropDown=function(e){if(this.isHostVisible()){this.isDroppedDown=!0;e.preventDefault()}};DropDown.prototype.isHostVisible=function(){var e=this.hostElement;return!(!e||!e.offsetHeight)};DropDown.prototype._isHiddenEditor=function(){return hasClass(this._tbx,"wj-grid-ime")};DropDown.prototype._keypress=function(e){"AltLeft"!=e.code&&"AltRight"!=e.code||e.preventDefault()};DropDown.prototype._input=function(e){this._setText(this.text,!1)};DropDown.prototype._btnclick=function(e){if(!e.defaultPrevented&&0==e.button){this._isInvalidInputCancelled=!1;e.preventDefault();if(this.isTouching){this._tbx.getAttribute("inputmode");this._tbx.setAttribute("inputmode","none");this.isDroppedDown=!this.isDroppedDown;this.selectAll()}else{this.focus();this.isDroppedDown=!this.isDroppedDown}}};DropDown.prototype._setText=function(e,t,i,n){var o=!1;if((e=(e||"").toString())!=this._tbx.value){this._tbx.value=e;if(i||!e){this.onTextChanged();o=!0}}if(e!=this._oldText){this._oldText=e;this._internalSettingText||o||this.onTextChanged()}n&&(this._tbx.value=this._tbx.value.trim());this._updateState()};DropDown.prototype._updateBtn=function(){this._btn.style.display=this._showBtn?"":"none";this._updateBtnAria()};DropDown.prototype._updateBtnAria=function(){var e=this._btn.querySelector("button"),t=this.isDroppedDown,i=this.dropDown?this.dropDown.id:null;setAttribute(e,"aria-expanded",!!t);setAttribute(e,"aria-controls",t?i:null)};DropDown.prototype._updateTbx=function(){this._updateTbxAria()};DropDown.prototype._updateTbxAria=function(){var e=this._tbx,t=this.isDroppedDown,i=this.dropDown?this.dropDown.id:null;setAttribute(e,"aria-controls",t?i:null);setAttribute(e,"aria-expanded",t)};DropDown.prototype._updateTbxAriaHaspopup=function(){var e=this._tbx,t=this.dropDown&&this.dropDown.getAttribute("role");setAttribute(e,"aria-haspopup",t)};DropDown.prototype._createDropDown=function(){};DropDown.prototype._commitText=function(e,t){};DropDown.prototype._updateDropDown=function(){if(this.isDroppedDown){this._commitText();var e=this.dropDown;setAttribute(e,"dir",this.rightToLeft?"rtl":null);showPopup(e,this.hostElement,!1,this._animate,null==this.dropDownCssClass)}};DropDown.prototype._shouldRaiseInvalidInput=function(e){return isNullOrUndefined(e)?!this._containsFocus():e};DropDown._ctrlTemplate="";return DropDown}(Control);export{DropDown};_addCultureInfo("Popup",{ariaLabels:{close:"close",backdrop:"backdrop",isDraggable:"draggable",isResizable:"resizable",popupVisible:"visible",popupHide:"hidden",popup:"popup"}});export var PopupTrigger;!function(e){e[e.None=0]="None";e[e.ClickOwner=1]="ClickOwner";e[e.ClickPopup=2]="ClickPopup";e[e.Click=3]="Click";e[e.BlurOwner=4]="BlurOwner";e[e.BlurPopup=8]="BlurPopup";e[e.Blur=12]="Blur";e[e.ClickOrBlur=15]="ClickOrBlur";e[e.DownOwner=16]="DownOwner";e[e.DownPopup=32]="DownPopup";e[e.Down=48]="Down";e[e.EnterOwner=64]="EnterOwner";e[e.EnterPopup=128]="EnterPopup";e[e.Enter=192]="Enter";e[e.LeaveOwner=256]="LeaveOwner";e[e.LeavePopup=512]="LeavePopup";e[e.Leave=768]="Leave"}(PopupTrigger||(PopupTrigger={}));!function(e){e[e.None=0]="None";e[e.Left=1]="Left";e[e.Top=2]="Top";e[e.Right=4]="Right";e[e.Bottom=8]="Bottom";e[e.LeftTop=3]="LeftTop";e[e.RightTop=6]="RightTop";e[e.RightBottom=12]="RightBottom";e[e.LeftBottom=9]="LeftBottom"}(_Edges||(_Edges={}));var Popup=function(e){__extends(Popup,e);function Popup(t,i){var n=e.call(this,t)||this;n._owner=null;n._ariaLabel=culture.Popup.ariaLabels.popup;n._modal=!1;n._position=PopupPosition.BelowLeft;n._showTrigger=PopupTrigger.ClickOwner;n._hideTrigger=PopupTrigger.Blur;n._hideAnim=[];n._fadeIn=!0;n._fadeOut=!0;n._removeOnHide=!0;n._draggable=!1;n._resizable=!1;n._result=null;n._resultEnter=null;n._resultSubmit=null;n._callback=null;n._visible=!1;n._ownerClickBnd=n._ownerClick.bind(n);n._ownerDownBnd=n._ownerDown.bind(n);n._ownerBlurBnd=n._ownerBlur.bind(n);n._ownerEnterBnd=n._ownerEnter.bind(n);n._ownerLeaveBnd=n._ownerLeave.bind(n);n._mousedownBnd=n._mousedown.bind(n);n._mousemoveBnd=n._mousemove.bind(n);n._mousedragBnd=n._mousedrag.bind(n);n._mouseupBnd=n._mouseup.bind(n);n._hideBnd=n.hide.bind(n);n._lastShow=0;n._initialOwner=null;n._activeEdge=_Edges.None;n.showing=new Event;n.shown=new Event;n.hiding=new Event;n.hidden=new Event;n.resizing=new Event;n.resized=new Event;n.dragging=new Event;n.dragged=new Event;n.sizeChanging=new Event;n.sizeChanged=new Event;n.positionChanging=new Event;n.positionChanged=new Event;var o=n.hostElement;Popup._PopupInstanceCount++;addClass(o,ControlClsNames.hostElement+" "+ControlClsNames.content+" "+PopupClsNames.hostElement);if(n.hostElement){n._initialOwner=n.hostElement.parentElement;setAttribute(n.hostElement,"role","dialog")}o.getAttribute("tabindex")||(o.tabIndex=0);hidePopup(o,!1);var s=n.addEventListener.bind(n);s(o,"compositionstart",(function(){n._composing=!0}));s(o,"compositionend",(function(){n._composing=!1}));s(window,"resize",(function(){!n.isVisible||n._dragged||n.isTouching||n.invalidate()}));s(o,"keydown",(function(e){if(!e.defaultPrevented){var t=e.ctrlKey&&e.altKey&&!e.shiftKey,i=e.ctrlKey&&e.shiftKey&&!e.altKey;if(t||i){var s=n.hostElement.getBoundingClientRect(),r=Rect.fromBoundingRect(s);if(t&&n.isDraggable){e.preventDefault();switch(e.keyCode){case Key.Left:r.left=Math.max(0,r.left-10);break;case Key.Right:r.left=Math.min(window.innerWidth-r.width,r.left+10);break;case Key.Up:r.top=Math.max(0,r.top-10);break;case Key.Down:r.top=Math.min(window.innerHeight-r.height,r.top+10)}var a=new PopupBoundsChangingEventArgs(r);if(n.onPositionChanging(a)){setCss(n.hostElement,{left:r.left+window.scrollX,top:r.top+window.scrollY,transform:"none"});n.onPositionChanged()}}else if(i&&n.isResizable){e.preventDefault();var l=window.getComputedStyle(n.hostElement),h=Math.max(parseInt(l.minWidth)||0,Popup._SZ_MIN),u=Math.max(parseInt(l.minHeight)||0,Popup._SZ_MIN);if(n._activeEdge===_Edges.None)switch(e.keyCode){case Key.Up:n._activeEdge=_Edges.Top;break;case Key.Down:n._activeEdge=_Edges.Bottom;break;case Key.Left:n._activeEdge=_Edges.Left;break;case Key.Right:n._activeEdge=_Edges.Right}var c=n._activeEdge===_Edges.Top||n._activeEdge===_Edges.Bottom,p=n._activeEdge===_Edges.Left||n._activeEdge===_Edges.Right;if(c&&![Key.Up,Key.Down].includes(e.keyCode)||p&&![Key.Left,Key.Right].includes(e.keyCode))return;if(n._activeEdge!==_Edges.None){var d=0;switch(e.keyCode){case Key.Up:case Key.Left:d=-10;break;case Key.Down:case Key.Right:d=10}switch(n._activeEdge){case _Edges.Top:var m=Math.min(Math.max(r.top+d,0),r.bottom-u);r.height=r.bottom-m;r.top=m;break;case _Edges.Bottom:var _=Math.min(Math.max(r.bottom+d,r.top+u),window.innerHeight);r.height=_-r.top;break;case _Edges.Left:var f=Math.min(Math.max(r.left+d,0),r.right-h);r.width=r.right-f;r.left=f;break;case _Edges.Right:var b=Math.min(Math.max(r.right+d,r.left+h),window.innerWidth);r.width=b-r.left}r.left=Math.max(0,Math.min(r.left,window.innerWidth-r.width));r.top=Math.max(0,Math.min(r.top,window.innerHeight-r.height));var g=new PopupBoundsChangingEventArgs(r);if(n.onSizeChanging(g)){setCss(n.hostElement,{left:r.left+window.scrollX,top:r.top+window.scrollY,width:r.width,height:r.height,transform:"none"});n.onSizeChanged()}}}}if(e.keyCode==Key.Escape&&!n._composing){e.preventDefault();n.hide()}if(e.keyCode==Key.Enter&&!n._composing){var y=n.dialogResultEnter;if(y){e.preventDefault();n._validateAndHide(y)}}if(e.keyCode==Key.Tab&&n.modal){e.preventDefault();moveFocus(o,e.shiftKey?-1:1)}}}));s(document,"keyup",(function(e){e.ctrlKey||e.shiftKey||n._activeEdge===_Edges.None||(n._activeEdge=_Edges.None)}));s(o,"click",(function(e){var t=e.target;if(t instanceof HTMLElement){if(t instanceof HTMLButtonElement&&"submit"==t.type){var i=n.hostElement,o=n.dialogResultSubmit;if(i instanceof HTMLFormElement&&o&&i.reportValidity()){e.preventDefault();n.hide(o)}}var s=t.className.match(/\bwj-hide[\S]*\b/);if(s&&s.length>0){e.preventDefault();e.stopPropagation();n.hide(s[0])}}}));var r=n._toggle.bind(n),a=PopupTrigger;n.addEventListener(o,"click",(function(e){n._ignoreClick||r(e,a.ClickPopup)}),!0);n.addEventListener(o,"mousedown",(function(e){n._ignoreClick=!1;r(e,a.DownPopup)}),!0);n.addEventListener(o,"mouseenter",(function(e){e.target==o&&r(e,a.EnterPopup)}),!0);n.addEventListener(o,"mouseleave",(function(e){e.target==o&&r(e,a.LeavePopup)}),!0);n.addEventListener(o,"blur",(function(e){n.containsFocus()||r(e,a.BlurPopup)}),!0);s(document,"wheel",(function(e){if(n.isVisible&&n._modal){for(var t=e.target;t&&t!=document.body;t=t.parentElement)if(t.scrollHeight>t.clientHeight)return;e.preventDefault()}}));n.initialize(i);n._updateAriaLabel();return n}Object.defineProperty(Popup.prototype,"ariaLabelledBy",{get:function(){return this.hostElement.getAttribute("aria-labelledby")},set:function(e){_setAriaLabelBy(this,this.hostElement,e,this._updateAriaLabel.bind(this))},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"owner",{get:function(){return this._owner},set:function(e){var t=this._owner;if(t){this.removeEventListener(t,"click");this.removeEventListener(t,"mousedown");this.removeEventListener(t,"mouseenter");this.removeEventListener(t,"mouseleave");this.removeEventListener(t,"blur")}if(t=this._owner=null!=e?getElement(e):null){this.addEventListener(t,"click",this._ownerClickBnd,!0);this.addEventListener(t,"mousedown",this._ownerDownBnd,!0);this.addEventListener(t,"mouseenter",this._ownerEnterBnd,!0);this.addEventListener(t,"mouseleave",this._ownerLeaveBnd,!0);this.addEventListener(t,"blur",this._ownerBlurBnd,!0)}},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"position",{get:function(){return this._position},set:function(e){this._position=asEnum(e,PopupPosition)},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"content",{get:function(){return this.hostElement.firstElementChild},set:function(e){if(e!=this.content){this.hostElement.innerHTML="";e instanceof HTMLElement&&this.hostElement.appendChild(e)}},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"showTrigger",{get:function(){return this._showTrigger},set:function(e){this._showTrigger=asEnum(e,PopupTrigger)},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"hideTrigger",{get:function(){return this._hideTrigger},set:function(e){this._hideTrigger=asEnum(e,PopupTrigger)},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"fadeIn",{get:function(){return this._fadeIn},set:function(e){this._fadeIn=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"fadeOut",{get:function(){return this._fadeOut},set:function(e){this._fadeOut=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"removeOnHide",{get:function(){return this._removeOnHide},set:function(e){if((e=asBoolean(e))!=this.removeOnHide){this._removeOnHide=e;if(!this.isVisible){var t=this.hostElement;if(e)removeChild(t);else if(t&&document.body){t.style.display="none";document.body.appendChild(t)}}}},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"modal",{get:function(){return this._modal},set:function(e){this._modal=asBoolean(e);setAttribute(this.hostElement,"aria-modal",e?"true":null)},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"isDraggable",{get:function(){return this._draggable},set:function(e){this._draggable=asBoolean(e);this._updateAriaLabel()},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"isResizable",{get:function(){return this._resizable},set:function(e){this._resizable=asBoolean(e);this._updateAriaLabel()},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"dialogResult",{get:function(){return this._result},set:function(e){this._result=e},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"dialogResultEnter",{get:function(){return this._resultEnter},set:function(e){this._resultEnter=e},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"dialogResultSubmit",{get:function(){return this._resultSubmit},set:function(e){this._resultSubmit=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"isVisible",{get:function(){var e=this.hostElement;return this._visible&&null!=e&&e.offsetHeight>0},enumerable:!0,configurable:!0});Popup.prototype.show=function(e,t){var i=this;this._lastShow=Date.now();if(!this.isVisible){var n=this.hostElement;this.dialogResult=null;this._callback=null;this._oldFocus=null;this._myFocus=null;this._hideAnim.forEach((function(e){clearInterval(e)}));if(this._hideAnim.length>0){this._hideAnim.length=0;if(this._bkDrop){hidePopup(this._bkDrop,this.removeOnHide);this._bkDrop.style.opacity=""}hidePopup(n,this.removeOnHide);n.style.opacity=""}var o=new CancelEventArgs;if(this.onShowing(o)){null!=e&&(this.modal=asBoolean(e));null!=t&&(this._callback=asFunction(t));this._oldFocus=getActiveElement();showPopup(n,this._owner,this._position,this._fadeIn,!1,this._hideBnd);this._modal&&this._showBackdrop();setAttribute(this._oldFocus,"aria-expanded","true");this._composing=!1;this._visible=!0;this.onShown(o);this._updateAriaLabel();this._clearTimeouts();if(this.modal){this.addEventListener(window,"focus",(function(){if(!i.containsFocus()){var e=i._myFocus;e&&e.offsetHeight?e.focus():moveFocus(n,0)}}));this.addEventListener(n,"focusin",(function(){var e=getActiveElement();e&&contains(n,e)&&(e.tabIndex>-1||!i._myFocus)&&(i._myFocus=e)}))}this._resized=this._dragged=this._ignoreClick=!1;this._handleDragResize(!0);this.addEventListener(window,"touchstart",(function(e){i._hideTrigger&PopupTrigger.Blur&&!contains(n,e.target,!0)&&i.hide()}));this._toHidePopupTimer=setTimeout((function(){i.addEventListener(window,"click",(function(e){i._hideTrigger&PopupTrigger.BlurPopup&&i.isDisabled&&!contains(n,e.target,!0)&&i.hide()}))}));this._toGetFocusTimer=setTimeout((function(){if(!i.isDisabled&&!i.containsFocus()&&!i.isTouching){var e=n.querySelector("[autofocus]");if(e&&e.clientHeight>0&&!e.disabled&&e.tabIndex>-1&&!closest(e,"[disabled],."+ControlStateClsNames.disabled)){e.focus();isFunction(e.select)&&e.select()}else moveFocus(n,0)}if(!i.isDisabled&&!i.containsFocus()){n.tabIndex=0;n.focus()}}),100)}}};Popup.prototype.hide=function(e){var t=this;this.removeEventListener(window,"touchstart");this.removeEventListener(window,"click");if(this.isVisible){isUndefined(e)||(this.dialogResult=e);var i=new CancelEventArgs,n=this.hostElement;if(this.onHiding(i)){this._handleDragResize(!1);for(var o=this.containsFocus()?this._oldFocus:null,s=n.querySelectorAll("."+ControlClsNames.hostElement+"."+DropDownClsNames.hostElement),r=0;r<s.length;r++){var a=Control.getControl(s[r]);a instanceof DropDown&&(a.isDroppedDown=!1)}var l=this.removeOnHide,h=this.fadeOut;this._hideTimer=setTimeout((function(){t._updateState();t.onHidden(i);t._callback&&t._callback(t);if(t.hideTrigger&PopupTrigger.LeavePopup){var e=Control.getControl(closest(t.owner,"."+PopupClsNames.hostElement));if(e instanceof Popup&&0!=(e.hideTrigger&PopupTrigger.Leave)){var n=Popup._evtHover,o=n?document.elementFromPoint(n.clientX,n.clientY):null,s=Control.getControl(closest(o,"."+PopupClsNames.hostElement));s instanceof Popup&&!s.isVisible&&(o=null);o&&contains(e.hostElement,o,!0)||e.hide()}}}),Control._FOCUS_INTERVAL+50);this._bkDrop&&this._hideAnim.push(hidePopup(this._bkDrop,l,h));this._hideAnim.push(hidePopup(n,l,h));setAttribute(this._oldFocus,"aria-expanded","false");this._visible=!1;this._oldFocus=null;this._myFocus=null;this._updateAriaLabel();this.removeEventListener(window,"focus");this.removeEventListener(n,"focusin");this.containsFocus()&&getActiveElement().blur();this._clearTimeouts();!this.isVisible&&o&&o.offsetHeight&&o.focus()}}};Popup.prototype.onShowing=function(e){this.showing.raise(this,e);return!e.cancel};Popup.prototype.onShown=function(e){this.shown.raise(this,e)};Popup.prototype.onHiding=function(e){this.hiding.raise(this,e);return!e.cancel};Popup.prototype.onHidden=function(e){this._wasVisible=!1;this.hidden.raise(this,e)};Popup.prototype.onResizing=function(e){this.resizing.raise(this,e);return!e.cancel};Popup.prototype.onResized=function(e){this.resized.raise(this,e)};Popup.prototype.onDragging=function(e){this.dragging.raise(this,e);return!e.cancel};Popup.prototype.onDragged=function(e){this.dragged.raise(this,e)};Popup.prototype.onSizeChanging=function(e){this.sizeChanging.raise(this,e);return!e.cancel};Popup.prototype.onSizeChanged=function(e){this.sizeChanged.raise(this,e)};Popup.prototype.onPositionChanging=function(e){this.positionChanging.raise(this,e);return!e.cancel};Popup.prototype.onPositionChanged=function(e){this.positionChanged.raise(this,e)};Popup.prototype.onLostFocus=function(t){e.prototype.onLostFocus.call(this,t);if(this._hideTrigger&PopupTrigger.BlurPopup&&!this.containsFocus()){var i=document.createEvent("Event");i.initEvent("blur",!0,!0);this._toggle(i,PopupTrigger.BlurPopup)}};Popup.prototype.refresh=function(t){void 0===t&&(t=!0);var i=this.hostElement;e.prototype.refresh.call(this,t);if(this.isVisible&&!this._refreshing&&i){this._refreshing=!0;for(var n=getActiveElement(),o=this._owner?this._owner.getBoundingClientRect():null,s=[],r=i.querySelectorAll("."+DropDownClsNames.hostElement),a=0;a<r.length;a++){var l=Control.getControl(r[a]);if(l instanceof DropDown&&l.isDroppedDown){s.push(l);l.dropDown.style.display="none"}}showPopup(i,o,this._position);s.forEach((function(e){e.dropDown.style.display="";e._updateDropDown()}));this._modal&&n instanceof HTMLElement&&n!=getActiveElement()&&n.focus();this._refreshing=!1}};Popup.prototype._clearTimeouts=function(){if(this._toShow){clearTimeout(this._toShow);this._toShow=null}if(this._toHideLeave){clearTimeout(this._toHideLeave);this._toHideLeave=null}if(this._toHideBlur){clearTimeout(this._toHideBlur);this._toHideBlur=null}};Popup.prototype._handleDragResize=function(e){var t=this.hostElement,i=this._draggable?this._getHeaderElement():null,n=this.addEventListener.bind(this),o=this.removeEventListener.bind(this),s=this._mousemoveBnd,r=this._mousedownBnd;if(e){n(t,"mousemove",s);n(t,"mousedown",r);n(t,"touchstart",r);i&&(i.style.touchAction="none")}else{this._mousedownEvt=null;this._rcBounds=null;o(t,"mousemove",s);o(t,"mousedown",r);o(t,"touchstart",r);o(document,"mousemove",this._mousedragBnd);o(document,"mouseup",this._mouseupBnd);i&&(i.style.touchAction="")}};Popup.prototype._mousemove=function(e){if(!this._mousedownEvt){var t=this.hostElement,i=this._getEdges(t,e),n="",o=_Edges;this._edges=i;this._resizable&&(i==o.LeftTop||i==o.RightBottom?n="nwse-resize":i==o.LeftBottom||i==o.RightTop?n="nesw-resize":i==o.Left||i==o.Right?n="ew-resize":i!=o.Top&&i!=o.Bottom||(n="ns-resize"));this._draggable&&!n&&this._getClosestHeader(e.target)&&(n="move");t.style.cursor=n}};Popup.prototype._mousedown=function(e){if(!e.defaultPrevented){var t=e.touches&&e.touches.length>0?e.touches[0]:e;this._edges=this._getEdges(this.hostElement,t);if(this._edges||this._draggable&&this._getClosestHeader(e.target)){var i=new CancelEventArgs;if(this._edges?this.onResizing(i):this.onDragging(i)){this._mousedownEvt=t;this._rcBounds=this.hostElement.getBoundingClientRect();var n=this.addEventListener.bind(this),o=document,s=this._mousedragBnd,r=this._mouseupBnd;n(o,"mousemove",s);n(o,"touchmove",s);n(o,"mouseup",r);n(o,"touchend",r)}}this._ignoreClick=!1}};Popup.prototype._mouseup=function(){this._mousedownEvt=null;this._rcBounds=null;this._activeEdge=_Edges.None;var e=this.removeEventListener.bind(this),t=document,i=this._mousedragBnd,n=this._mouseupBnd;e(t,"mousemove",i);e(t,"touchmove",i);e(t,"mouseup",n);e(t,"touchend",n);this._resized?this.onResized():this._dragged&&this.onDragged();this._resized=this._dragged=this._ignoreClick=!1};Popup.prototype._mousedrag=function(e){if(!e.defaultPrevented){var t=this.hostElement,i=this._mousedownEvt,n=e.touches&&e.touches.length>0?e.touches[0]:e,o=n.clientX-i.clientX,s=n.clientY-i.clientY,r=this._rcBounds,a=this._edges,l=Popup._SZ_MIN,h=Rect.fromBoundingRect(r);if(a){var u=window.getComputedStyle(t),c=parseInt(u.getPropertyValue("min-width"))||l,p=parseInt(u.getPropertyValue("min-height"))||l;if(a&_Edges.Left){var d=h.right-c;h.left=Math.min(h.left+o,d);h.width=Math.max(h.width-o,c)}else a&_Edges.Right&&(h.width=Math.max(h.width+o,c));if(a&_Edges.Top){var m=h.bottom-p;h.top=Math.min(h.top+s,m);h.height=Math.max(h.height-s,p)}else a&_Edges.Bottom&&(h.height=Math.max(h.height+s,p));if(this.onSizeChanging(new PopupBoundsChangingEventArgs(h))){setCss(t,{left:h.left+window.scrollX,top:h.top+window.scrollY,width:h.width,height:h.height,transform:"none"});this._resized=this._dragged=this._ignoreClick=!0;this.onSizeChanged()}if(!window.ResizeObserver)for(var _=this.hostElement.children,f=0;f<_.length;f++)Control.invalidateAll(_[f])}else if(this._draggable){"touchmove"===e.type&&isiOS()&&e.preventDefault();if(this._dragged||Math.abs(o)+Math.abs(s)>Popup._DRAG_THRESHOLD){h.left=Math.max(r.left+o+(n.pageX-n.clientX),50-r.width);h.top=Math.max(r.top+s+(n.pageY-n.clientY),0);if(this.onPositionChanging(new PopupBoundsChangingEventArgs(h))){setCss(t,{left:h.left,top:h.top,width:h.width,height:h.height,transform:"none"});this._dragged=this._ignoreClick=!0;this.onPositionChanged()}}}}};Popup.prototype._getEdges=function(e,t){var i=0;if(this._resizable){var n=e.getBoundingClientRect(),o=Popup._SZ_EDGE;t.clientX-n.left<o&&(i|=_Edges.Left);t.clientY-n.top<o&&(i|=_Edges.Top);n.right-t.clientX<o&&(i|=_Edges.Right);n.bottom-t.clientY<o&&(i|=_Edges.Bottom)}return i};Popup.prototype._ownerClick=function(e){this._toggle(e,PopupTrigger.ClickOwner)};Popup.prototype._ownerDown=function(e){this._wasVisible=this.isVisible;this._toggle(e,PopupTrigger.DownOwner)};Popup.prototype._ownerBlur=function(e){contains(this._owner,getActiveElement())||this._toggle(e,PopupTrigger.BlurOwner)};Popup.prototype._ownerEnter=function(e){e.target==this._owner&&this._toggle(e,PopupTrigger.EnterOwner)};Popup.prototype._ownerLeave=function(e){e.target==this._owner&&this._toggle(e,PopupTrigger.LeaveOwner)};Popup.prototype._toggle=function(e,t){var i=this;e instanceof MouseEvent&&(Popup._evtHover=e);if(!("mouseenter"==e.type&&Date.now()-this._lastShow<300||e.defaultPrevented)){var n=0!=(this._hideTrigger&t),o=0!=(this._showTrigger&t),s=PopupTrigger;(n||o)&&this._clearTimeouts();n&&this.isVisible&&(t&s.Leave?this._toHideLeave=setTimeout((function(){var e=Popup._evtHover,t=e?document.elementFromPoint(e.clientX,e.clientY):null;t&&contains(i.hostElement,t,!0)||i.hide()}),Control._LEAVE_DELAY):t&s.Blur?this._toHideBlur=setTimeout((function(){i.containsFocus()||contains(i._owner,getActiveElement())||i.hide()}),Control._FOCUS_INTERVAL+50):this.hide());o&&t!=s.ClickPopup&&(this._wasVisible||(t&s.Enter?this._toShow=setTimeout((function(){i.show()}),Control._HOVER_DELAY):this.show()))}};Popup.prototype._getHeaderElement=function(){var e=this.hostElement;return e.querySelector("."+PopupClsNames.dialogHeader)||e.querySelector(".modal-header")};Popup.prototype._getClosestHeader=function(e){return closest(e,"."+PopupClsNames.dialogHeader)||closest(e,".modal-header")};Popup.prototype._showBackdrop=function(){var e=this;if(!this._bkDrop){this._bkDrop=document.createElement("div");this._bkDrop.tabIndex=-1;setAttribute(this._bkDrop,"role","presentation");setAttribute(this._bkDrop,"aria-hidden","true");setAttribute(this._bkDrop,"aria-label",culture.Popup.ariaLabels.backdrop);addClass(this._bkDrop,PopupClsNames.popupBackDrop);this.addEventListener(this._bkDrop,"mousedown",(function(t){t.preventDefault();t.stopPropagation();e.hostElement.focus();e.hideTrigger&PopupTrigger.Blur&&e.hide()}))}setCss(this._bkDrop,{zIndex:Control._POPUP_ZINDEX,display:""});var t=this.hostElement;t.parentElement.insertBefore(this._bkDrop,t)};Popup.prototype._validateAndHide=function(e){var t=this.hostElement;if(t instanceof HTMLFormElement)t.reportValidity()&&this.hide(e);else{var i=this.hostElement.querySelector(":invalid");i?i.focus():this.hide(e)}};Popup.prototype._updateAriaLabel=function(){this.hostElement&&(this.ariaLabelledBy?this._updateAriaLabelImp(""):this._updateAriaLabelImp(this._ariaLabel))};Popup.prototype._updateAriaLabelImp=function(e){var t=[];this.isDraggable&&t.push(culture.Popup.ariaLabels.isDraggable);this.isResizable&&t.push(culture.Popup.ariaLabels.isResizable);this.isVisible?t.push(culture.Popup.ariaLabels.popupVisible):t.push(culture.Popup.ariaLabels.popupHide);var i=t.join(",");setAttribute(this.hostElement,"aria-label",e?e+" "+i:i)};Popup.prototype.dispose=function(){Popup._PopupInstanceCount--;0===Popup._PopupInstanceCount&&Popup._evtHover&&(Popup._evtHover=null);this._clearTimeouts();if(this._toHidePopupTimer){clearTimeout(this._toHidePopupTimer);this._toHidePopupTimer=null}if(this._toGetFocusTimer){clearTimeout(this._toGetFocusTimer);this._toGetFocusTimer=null}if(this._hideTimer){clearTimeout(this._hideTimer);this._hideTimer=null}this._hideAnim.forEach((function(e){clearInterval(e)}));this._hideAnim=[];var t=this.hostElement;if(t)for(var i=t.querySelectorAll("."+DropDownClsNames.hostElement),n=0;n<i.length;n++){var o=Control.getControl(i[n]);o&&o instanceof DropDown&&o.dispose()}if(this._initialOwner){this._initialOwner.appendChild(this.hostElement);this._initialOwner=null}this.owner=null;if(this._bkDrop){this._bkDrop.remove();this._bkDrop=null}this._callback=null;e.prototype.dispose.call(this)};Popup._DRAG_THRESHOLD=6;Popup._SZ_EDGE=10;Popup._SZ_MIN=40;Popup._PopupInstanceCount=0;return Popup}(Control);export{Popup};var PopupBoundsChangingEventArgs=function(e){__extends(PopupBoundsChangingEventArgs,e);function PopupBoundsChangingEventArgs(t){var i=e.call(this)||this;i._rc=t;return i}Object.defineProperty(PopupBoundsChangingEventArgs.prototype,"bounds",{get:function(){return this._rc},enumerable:!0,configurable:!0});return PopupBoundsChangingEventArgs}(CancelEventArgs);export{PopupBoundsChangingEventArgs};_addCultureInfo("InputDate",{ariaLabels:{inputDateInput:"InputDate Input",inputDate:"Input Date",button:"Choose Date",dialog:"Calendar"}});var InputDateEventArgs=function(e){__extends(InputDateEventArgs,e);function InputDateEventArgs(t){var i=e.call(this)||this;i._isUserInput=t;return i}Object.defineProperty(InputDateEventArgs.prototype,"isUserInput",{get:function(){return this._isUserInput},enumerable:!0,configurable:!0});return InputDateEventArgs}(CancelEventArgs);export{InputDateEventArgs};var InputDate=function(e){__extends(InputDate,e);function InputDate(t,i){var n=e.call(this,t)||this;n._fmt=Globalize.DefaultDateFormat;n._sep=" - ";n._rngs=null;n._showCal=!1;n._clsOnSel=!0;n._handleWheel=!0;n._preserveCalendarNavigation=!0;n._isTriggered=!1;n._rangeChanged=!1;n._textInitialized=!1;n._previousText="";n._keepInvalidText=!1;n._inputAriaLabel=culture.InputDate.ariaLabels.inputDateInput;n._currentInput="";n._ariaLabelledby=null;n.valueChanged=new Event;n.rangeEndChanged=new Event;n.rangeChanged=new Event;addClass(n.hostElement,InputDateClsNames.hostElement);var o=culture.InputDate.ariaLabels;setAttribute(n._btn.querySelector("button"),"aria-haspopup","dialog");setAttribute(n._dropDown,"role","dialog");setAriaLabel(n._dropDown,o.dialog);setAttribute(n._dropDown,"aria-modal",!0);setAttribute(n._tbx,"role","combobox");setAttribute(n._tbx,"aria-haspopup","dialog");setAriaLabel(n._btn.querySelector("button"),o.button);n.dropDown.id=getUniqueId(n.hostElement.id+"_dropdown");n._msk=new _MaskProvider(n._tbx);var s=n.addEventListener.bind(n);isIE9()||(n.inputType="tel");n._tbx.type.match(/^(tel|text|)$/i)||(n.inputType="text");var r=n._mouseWheel.bind(n);s(n.hostElement,"wheel",r);n._lbx=new ListBox(document.createElement("div"),{displayMemberPath:"name",selectedIndexChanged:function(e){var t=e.selectedItem,i=DateTime.fromDateTime,o=DateTime.sameDate;if(t&&t.from&&t.to){if(!o(t.from,n.value)||!o(t.to,n.rangeEnd)){var s=n.value;n.value=i(t.from,s);n.rangeEnd=i(t.to,s)}n._selectAll()}else n._cal.hostElement.style.display=""}});var a=n._lbx;n._cal=new Calendar(document.createElement("div"));var l=n._cal,h=n._dropDown;addClass(h,InputDateClsNames.inputDateDropDown);var u=document.createElement("div");addClass(u,InputDateClsNames.inputDateDropDownContainer);u.appendChild(a.hostElement);u.appendChild(l.hostElement);h.appendChild(u);n.addEventListener(h,"click",(function(){n._isTriggered=!0;setTimeout((function(){n._isTriggered=!1}),50)}),!0);n.addEventListener(h,"keydown",(function(e){if("Enter"===e.key){n._isTriggered=!0;setTimeout((function(){n._isTriggered=!1}),50)}}),!0);if("INPUT"==n._orgTag){var c=n._tbx.getAttribute("value");c&&(l.value=l.rangeEnd=Globalize.parseDate(c,"yyyy-MM-dd"))}n.isRequired=!0;n._tbx.value=n._oldText=n._getText();n.initialize(i);var p=isNullOrUndefined(n.tabOrder)?0:n.tabOrder;l.tabOrder=-1!==p&&n.showConfirmationButtons?p:-1;a.tabOrder=p;if(n._textInitialized||n._tbx.value!==n._oldText){n._oldText=n._tbx.value;n._currentInput="text";n._textInitialized=!0;n._commitText();n.onTextChanged()}n._updateState();l.valueChanged.addHandler((function(e,t){n._refreshText();n.onValueChanged(t)}));l.rangeEndChanged.addHandler((function(e,t){if(l._rngMode()){n.onRangeEndChanged(t);n._closeOnChange();l._clearingRangeEnd||n._refreshText()}}));l.cancelButtonClicked.addHandler((function(e,t){n.isDroppedDown=!1}));l.OKButtonClicked.addHandler((function(e,t){n._closeOnChange();n._refreshText()}));l._enterKeyDownToSetValue.addHandler((function(e,t){n._closeOnChange()}));l.addEventListener(l.hostElement,"click",(function(e){if(l.selectionMode&&!l._rngMode()){var t=e.target,i=l.hitTest(t);if(DateTime.sameDate(n.value,i)||closest(t,"[wj-part=btn-today]")){n._closeOnChange();n._refreshText()}}}));n._updateInputAriaLabel();return n}Object.defineProperty(InputDate,"controlTemplate",{get:function(){InputDate._ctrlTemplate||(InputDate._ctrlTemplate=DropDown.controlTemplate);return InputDate._ctrlTemplate},set:function(e){InputDate._ctrlTemplate=e},enumerable:!0,configurable:!0});InputDate.prototype._mouseWheel=function(e){if(this.handleWheel&&!e.defaultPrevented&&!this.isDroppedDown&&this.containsFocus()&&null!=this.value&&this._canChangeValue()){var t=this._tbx,i=t.selectionStart,n=t.selectionEnd,o=clamp(-e.deltaY,-1,1),s=this.value,r=Globalize.getFullFormat(this.format||Globalize.DefaultDateFormat);null==r&&(r=this.format);var a=r.match(getSpecialCharsRegex());if(n-i===t.value.length&&null!=a||this.selectionMode==DateSelectionMode.Range){for(var l=1;;l++){s=this.selectionMode==DateSelectionMode.Month?DateTime.addMonths(this.value,l*o):DateTime.addDays(this.value,l*o);if(this._isValidDate(s)||!(null===this.max||s<this.max)||!(null===this.min||s>this.min))break}this.value=s;var h=this._getText();setSelectionRange(t,0,h.length)}else this._updateDateTimeValue(o,a,r);e.preventDefault()}};Object.defineProperty(InputDate.prototype,"value",{get:function(){return this._cal.value},set:function(e){this._cal.value=e;(this.text||this.isRequired)&&this._refreshText()},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"rangeEnd",{get:function(){return this._cal.rangeEnd},set:function(e){this._cal.rangeEnd=e;(this.text||this.isRequired)&&this._refreshText()},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"rangeMin",{get:function(){return this._cal.rangeMin},set:function(e){this._cal.rangeMin=e},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"rangeMax",{get:function(){return this._cal.rangeMax},set:function(e){this._cal.rangeMax=e},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"keepInvalidText",{get:function(){return this._keepInvalidText},set:function(e){if(new Set(["InputDateTime","WjInputDateTime"]).has(this.constructor.name)){this._keepInvalidText=!1;throw"keepInvalidText property cannot be used with InputDateTime control"}this._keepInvalidText=e},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"text",{get:function(){return this._tbx.value},set:function(e){var t=(e||"").toString();if(t!=this.text){t!=this._tbx.value&&(this._tbx.value=t);if(t!=this._oldText){this._oldText=t;this._previousText=t}if(isEmpty(this._currentInput)){this._textInitialized=!0;this._currentInput="text";this._commitText()}this.onTextChanged();this._currentInput=""}},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"format",{get:function(){return this._fmt},set:function(e){if(e!=this.format){this._fmt=asString(e);this._refreshText()}},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"separator",{get:function(){return this._sep},set:function(e){if(e!=this._sep){this._sep=asString(e,!1);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"mask",{get:function(){return this._msk.mask},set:function(e){this._msk.mask=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"closeOnSelection",{get:function(){return this._clsOnSel},set:function(e){this._clsOnSel=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"handleWheel",{get:function(){return this._handleWheel},set:function(e){e=asBoolean(e);this._handleWheel=e;e||(this.calendar.handleWheel=e)},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"predefinedRanges",{get:function(){return this._rngs},set:function(e){if(this._rngs!=e){assert(null==e||isObject(e),"Object expected");this._rngs=e;this._lbx.itemsSource=this._getRanges(e);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"alwaysShowCalendar",{get:function(){return this._showCal},set:function(e){this._showCal=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"min",{get:function(){return this._cal.min},set:function(e){this._cal.min=asDate(e,!0)},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"max",{get:function(){return this._cal.max},set:function(e){this._cal.max=asDate(e,!0)},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"repeatButtons",{get:function(){return this._cal.repeatButtons},set:function(e){this._cal.repeatButtons=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"showYearPicker",{get:function(){return this._cal.showYearPicker},set:function(e){this._cal.showYearPicker=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"showMonthPicker",{get:function(){return this._cal.showMonthPicker},set:function(e){this._cal.showMonthPicker=e},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"showHeader",{get:function(){return this._cal.showHeader},set:function(e){this._cal.showHeader=e},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"weeksBefore",{get:function(){return this._cal.weeksBefore},set:function(e){this._cal.weeksBefore=e},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"weeksAfter",{get:function(){return this._cal.weeksAfter},set:function(e){this._cal.weeksAfter=e},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"selectionMode",{get:function(){return this._cal.selectionMode},set:function(e){if(e!=this.selectionMode){this._cal.selectionMode=e;this._refreshText()}},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"monthCount",{get:function(){return this._cal.monthCount},set:function(e){this._cal.monthCount=e},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"calendar",{get:function(){return this._cal},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"inputElement",{get:function(){return this._tbx},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"inputType",{get:function(){return this._tbx.type},set:function(e){e.match(/^(tel|text|)$/i)?this._tbx.type=asString(e):console.warn("invalid input type '"+e+"', don't use any input types other than 'tel' or 'text'")},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"preserveCalendarNavigation",{get:function(){return this._preserveCalendarNavigation},set:function(e){this._preserveCalendarNavigation=e},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"itemValidator",{get:function(){return this._cal.itemValidator},set:function(e){if(e!=this.itemValidator){this._cal.itemValidator=asFunction(e);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"itemFormatter",{get:function(){return this._cal.itemFormatter},set:function(e){this._cal.itemFormatter=asFunction(e)},enumerable:!0,configurable:!0});InputDate.prototype.onValueChanged=function(e){this.valueChanged.raise(this,e)};InputDate.prototype.onRangeEndChanged=function(e){this.rangeEndChanged.raise(this,e);this.rangeEnd&&(this.isDroppedDown?this._rangeChanged=!0:this.onRangeChanged(e))};InputDate.prototype.onRangeChanged=function(e){this._rangeChanged=!1;this.rangeChanged.raise(this,e)};InputDate.prototype._getParsedValue=function(){var e=this._tbx.value,t=this._fmt,i=(0,Globalize.parseDate)(e,t,this.value);if(i&&DateTime.sameDate(i,this._clamp(i)))return this._fromDateTime(i)};InputDate.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);if(this.hostElement){this._msk&&this._msk.refresh();this._cal&&this._cal.refresh();this._refreshText()}};InputDate.prototype.onIsDroppedDownChanging=function(t){if(this.isDroppedDown);else{var i=this._lbx,n=this._cal,o=i.collectionView,s=i.hostElement.style,r=n.hostElement.style;if(n._rngMode()&&hasItems(o)){var a=this._updateRangeSelection();s.display="";r.display=!this._showCal&&a&&a.from&&o.items.some((function(e){return!e.to}))?"none":""}else{s.display="none";r.display=""}n._mthMode()||(n.monthView=!0);n.value&&!this.preserveCalendarNavigation&&(n.displayMonth=n.value);this.showConfirmationButtons&&(n.focusValue=n.value)}return e.prototype.onIsDroppedDownChanging.call(this,t)};InputDate.prototype.onIsDroppedDownChanged=function(t){e.prototype.onIsDroppedDownChanged.call(this,t);var i=this.containsFocus();if(this.isDroppedDown){i&&(this._tryFocus(this._cal)||this._tryFocus(this._lbx)||this.dropDown.focus());this._lbx.showSelection();this._cal.refresh()}else{this._commitText();this._rangeChanged&&this.onRangeChanged()}};InputDate.prototype._updateDropDown=function(){this._commitText();var t=getComputedStyle(this.hostElement);this._dropDown.style.minWidth=18*parseFloat(t.fontSize)+"px";this._cal.refresh();e.prototype._updateDropDown.call(this)};InputDate.prototype.onGotFocus=function(e){var t=this._tbx;this._elRef==t&&(this.isDroppedDown?this.dropDown.focus():this.selectAll());this.containsFocus()||this.focus();this.gotFocus.raise(this,e)};InputDate.prototype._keydown=function(t){if(!(t.defaultPrevented||t.altKey||t.ctrlKey||t.metaKey)){this._isInvalidInputCancelled=!1;if(this._isHiddenEditor())return;var i=getActiveElement();switch(t.keyCode){case Key.Enter:if(this.showConfirmationButtons&&i!==this._tbx)return;this._currentInput="user";this._textInitialized=!1;this._commitText(!1,!0);break;case Key.Escape:this.text=this._getText();this.selectAll();break;case Key.Tab:if(this.showConfirmationButtons&&i!==this._tbx){var n=_getFocusableElements(this._dropDown).filter((function(e){return!(e.classList.contains("wj-control")&&e.classList.contains("wj-calendar"))})),o=n[0],s=n[n.length-1],r=n.indexOf(t.target),a=n[t.shiftKey?(r-1+n.length)%n.length:(r+1)%n.length],l=!1;a&&(l=this.calendar.isCalendarDateCell(a));if(l){t.preventDefault();this.calendar.focus();this.calendar.setFocusValueToFirstOrLastCalendar(!t.shiftKey)}else if(t.shiftKey){if(i===o){t.preventDefault();s.focus()}}else if(i===s){t.preventDefault();o.focus()}}else if(this.isDroppedDown){this.isDroppedDown=!1;this.containsFocus()||this.focus();this.keyActionTab===TabKeyAction.CloseAndKeepFocus&&t.preventDefault()}this._currentInput="user";this._textInitialized=!1;this._commitText(!0);break;case Key.Up:case Key.Down:if(t.keyCode===Key.Up&&this.keyActionUpArrow===KeyAction.OpenDropdown||t.keyCode===Key.Down&&this.keyActionDownArrow===KeyAction.OpenDropdown)break;if(!this.isDroppedDown&&this.value&&this._canChangeValue()){this._currentInput="user";this._textInitialized=!1;var h=this._tbx,u=h.selectionStart,c=h.selectionEnd,p=(h.value,t.keyCode==Key.Up?1:-1),d=this.value,m=Globalize.getFullFormat(this.format||Globalize.DefaultDateFormat);if("g"==this.format&&m.includes("г")){m=m.replace(/"г." /,"")}null==m&&(m=this.format);var _=m.match(getSpecialCharsRegex());if(c-u===h.value.length&&null!=_||this.selectionMode==DateSelectionMode.Range){for(var f=1;;f++){d=this.selectionMode==DateSelectionMode.Month?DateTime.addMonths(this.value,f*p):DateTime.addDays(this.value,f*p);if(this._isValidDate(d)||!(null===this.max||d<this.max)||!(null===this.min||d>this.min))break}this.value=d;var b=this._getText();setSelectionRange(h,0,b.length)}else this._updateDateTimeValue(p,_,m);t.preventDefault()}}}e.prototype._keydown.call(this,t)};InputDate.prototype._expandSelection=function(){if(this._cal._rngMode()){var t=this._tbx,i=t.value,n=t.selectionStart,o=t.selectionEnd,s=this._sep,r=i.indexOf(s);r>-1&&n==o&&(o<=r?setSelectionRange(t,0,r):n>=r+s.length&&setSelectionRange(t,r+s.length,t.value.length))}else e.prototype._expandSelection.call(this)};InputDate.prototype._updateDateTimeValue=function(e,t,i){var n=this._tbx,o=n.selectionStart,s=n.value,r=this.value,a={},l={},h=0,u=0,c=0,p=[],d=[],m=n.value.match(getSpecialCharsRegex());if(null==t||null==m){p=[this.format];d=["0"];t=[""]}else{t.forEach((function(e,n){var o=e.replaceAll('"',""),r=i.substring(h),c=s.substring(u),p=r.indexOf(e),d=c.indexOf(o);if(-1==d){var _=m[n];d=c.indexOf(_)}var f=r.substring(0,p);if(""!=f){a[f]=h;l[f]=u}h=h+p+e.length;u=u+d+o.length;if(n==t.length-1){f=i.substring(h);a[f]=h;l[f]=u}}));p=Object.keys(a);d=Object.values(l)}var _=d.filter((function(e){return o>=parseInt(e.toString())}));_.length>0&&(c=_.length-1);for(var f=p[c],b=1;;b++){-1!=f.indexOf("d")?r=DateTime.addDays(this.value,b*e):-1!=f.indexOf("M")?r=DateTime.addMonths(this.value,b*e):-1!=f.indexOf("y")&&(r=DateTime.addYears(this.value,b*e));if(this._isValidDate(r)||!(null===this.max||r<this.max)||!(null===this.min||r>this.min))break}this.value=r;this._reselectText(t,c)};InputDate.prototype._reselectText=function(e,t){var i=this._getText(),n=this._tbx,o=0,s=-1,r=-1;if(1==e.length&&""==e[0]){s=0;r=i.length}else{var a=n.value.match(getSpecialCharsRegex());e.forEach((function(e,n){var l=e.replaceAll('"',""),h=i.substring(o);if(h.startsWith("г.")){h=h.replace("г. ","");o+="г. ".length}var u=h.indexOf(l);0==u&&t++;if(-1==u){var c=a[n];u=h.indexOf(c)}var p=-1===u?h:h.substring(0,u);n==t&&-1==s&&(r=(s=o)+p.length);o=o+u+l.length}))}if(-1==s){s=o;r=n.value.length}setSelectionRange(n,s,r)};InputDate.prototype._refreshText=function(){var e=this._getText();if(e!=this.text||e!==this._oldText){this._tbx.value=this._oldText=this._previousText=e;this.onTextChanged()}};InputDate.prototype._selectAll=function(){this.isDroppedDown||!this.containsFocus()||this.isTouching||this.selectAll()};InputDate.prototype._closeOnChange=function(){var e=this;if(this._clsOnSel&&this._isTriggered){var t=this._cal;(!t._rngMode()||t.value&&t.rangeEnd)&&setTimeout((function(){e._isInvalidInputCancelled=!1;e.isDroppedDown=!1}))}};InputDate.prototype._tryFocus=function(e){var t=e.hostElement;if(t&&t.offsetHeight){t.focus();return!0}return!1};InputDate.prototype._clamp=function(e){return this._cal._clamp(e)};InputDate.prototype._getText=function(){var e=Globalize.format,t=this._fmt,i=e(this.value,t);this._cal._rngMode()&&i&&(this.rightToLeft?i=e(this.rangeEnd,t)+this._sep+i:i+=this._sep+e(this.rangeEnd,t));return i};InputDate.prototype._commitText=function(e,t){var i=this._tbx.value;this._isInvalidInputCancelled=!1;if(isEmpty(this._currentInput)){this._textInitialized=!1;this._currentInput="user"}var n=!1,o=this._fmt,s=this._cal,r=Globalize.parseDate,a=new InputDateEventArgs(!this._textInitialized);if(i)if(s._rngMode()){var l=i.split(this._sep),h=this.rightToLeft?l[1]:l[0];if(2==l.length&&h){if(c=r(h,o,this.value)){var u=r(this.rightToLeft?l[0]:l[1],o,this.value);if(DateTime.sameDate(c,this._clamp(c)))n=!0;else if(this._shouldRaiseInvalidInput(t)&&this.onInvalidInput(a))this._textInitialized&&this._keepInvalidText||(n=!0);else{this._selectAll();n=!1}if(n)if(u){s.value=this._fromDateTime(c);if(DateTime.sameDate(u,this._clamp(u))){s.rangeEnd=u&&u>=c?this._fromDateTime(u):c;this.text=this._getText()}else this._triggerInvalidInputEvent(a,c,u,t)}else if(this._shouldRaiseInvalidInput(t)&&this.onInvalidInput(a)){if(!this._textInitialized||!this._keepInvalidText){s.value=this._fromDateTime(c);s.rangeEnd=c;this.text=this._getText()}}else{this._isInvalidInputCancelled=!0;this._selectAll()}}else this._nullValueInvalidInput(a,t)}else this._nullValueInvalidInput(a,t)}else{(c=r(i,o,this.value))?DateTime.sameDate(c,this._clamp(c))?this.value=this._fromDateTime(c):this._triggerInvalidInputEvent(a,c,null,t):this._nullValueInvalidInput(a,t)}else if(this.isRequired){var c;(c=r(i,o,this.value))?this.value=this._fromDateTime(c):this.containsFocus()||(this.text=this._getText())}else this.value=this.rangeEnd=null;this._currentInput="";e||this._selectAll()};InputDate.prototype._triggerInvalidInputEvent=function(e,t,i,n){if(this._shouldRaiseInvalidInput(n)&&this.onInvalidInput(e)){if(!this._textInitialized||!this._keepInvalidText){this.value=this._fromDateTime(t);this.calendar._rngMode()&&(this.calendar.rangeEnd=i&&i>=t?this._fromDateTime(i):t)}}else{this.isDroppedDown||!this.containsFocus()||this.isTouching||this.focus();this._isInvalidInputCancelled=!0;this._selectAll()}};InputDate.prototype._nullValueInvalidInput=function(e,t){if(this._shouldRaiseInvalidInput(t)&&this.onInvalidInput(e))this._textInitialized&&this._keepInvalidText||(this.text=this._getText());else{this.isDroppedDown||!this.containsFocus()||this.isTouching||this.focus();this._isInvalidInputCancelled=!0;this._selectAll()}};InputDate.prototype._fromDateTime=function(e){return DateTime.fromDateTime(e,this.value)};InputDate.prototype._canChangeValue=function(){return!this.isReadOnly&&!this.isDisabled&&this.selectionMode!=DateSelectionMode.None};InputDate.prototype._isValidDate=function(e){if(e){if(this._clamp(e)!=e)return!1;if(this.itemValidator&&!this.itemValidator(e))return!1}return!0};InputDate.prototype._getRanges=function(e){var t=[];if(isObject(e))for(var i in e){var n=e[i];t.push({name:i,from:n?n[0]:null,to:n?n[1]:null})}return new CollectionView(t,{currentItem:null})};InputDate.prototype._updateRangeSelection=function(){var e=this._lbx,t=-1;if(hasItems(e.collectionView))for(var i=this._lbx.collectionView.items,n=DateTime.sameDate,o=0;o<i.length;o++){var s=i[o];if(s.from){if(n(s.from,this.value)&&n(s.to,this.rangeEnd)){t=o;break}}else t=o}e.selectedIndex=t;return e.selectedItem};InputDate.prototype._copy=function(e,t){if("text"===e){var i=(t||"").toString();if(i!==this.text){this._tbx.value=i;this._textInitialized=!0}return!0}return!1};Object.defineProperty(InputDate.prototype,"showConfirmationButtons",{get:function(){return this._showConfirmationButtons},set:function(e){this._showConfirmationButtons=e;this._cal.focusMode=e;this._cal.showConfirmationButtons=e;this._cal.updateConfirmationButtons(this.dropDown);var t=isNullOrUndefined(this.tabOrder)?0:this.tabOrder;this._cal.tabOrder=e?t:-1;this._cal.keyActionTab=e?CalendarTabKeyAction.All:CalendarTabKeyAction.None},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"ariaLabelledBy",{get:function(){return this._ariaLabelledby},set:function(e){_setAriaLabelBy(this,this._tbx,e,this._updateInputAriaLabel.bind(this))},enumerable:!0,configurable:!0});InputDate.prototype._updateInputAriaLabel=function(){this._tbx&&(this._tbx.id||this.ariaLabelledBy?setAriaLabel(this._tbx,null):setAriaLabel(this._tbx,this._inputAriaLabel))};InputDate.prototype.getAriaLabelForScreenReader=function(){return culture.InputDate.ariaLabels.inputDate};InputDate._ctrlTemplate="";return InputDate}(DropDown);export{InputDate};_addCultureInfo("InputDateRange",{ariaLabels:{inputDateRangeInput:"InputDateRange Input"}});var InputDateRange=function(e){__extends(InputDateRange,e);function InputDateRange(t,i){var n=e.call(this,t,__assign({selectionMode:DateSelectionMode.Range,showMonthPicker:"Outside",monthCount:2},getInputDateOptions(i)))||this;n._inputAriaLabel=culture.InputDateRange.ariaLabels.inputDateRangeInput;addClass(n.hostElement,InputDateRangeClsNames.hostElement);n._tbx.value=n._oldText=n._getText();n.initialize(i);if(n._tbx.value!==n._oldText){n._oldText=n._tbx.value;n._currentInput="text";n._commitText()}n._updateInputAriaLabel();return n}Object.defineProperty(InputDateRange,"controlTemplate",{get:function(){InputDateRange._ctrlTemplate||(InputDateRange._ctrlTemplate=InputDate.controlTemplate);return InputDateRange._ctrlTemplate},set:function(e){InputDateRange._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(InputDateRange.prototype,"selectionMode",{get:function(){return this.calendar.selectionMode},set:function(e){e=asEnum(e,DateSelectionMode);assert(e==DateSelectionMode.Range,'InputDateRange.selectionMode must be "Range"');this.calendar.selectionMode=e},enumerable:!0,configurable:!0});InputDateRange.prototype._mouseWheel=function(e){if(!e.defaultPrevented&&!this.isDroppedDown&&this.containsFocus()&&null!=this.value&&this._canChangeValue()){var t=clamp(-e.deltaY,-1,1),i=this.value;this.value=this.selectionMode==DateSelectionMode.Month?DateTime.addMonths(i,t):DateTime.addDays(i,t);this.selectAll();e.preventDefault()}};InputDateRange.prototype.onGotFocus=function(e){var t=this._tbx;this._elRef!=t||this.isDroppedDown||this.selectAll();this.containsFocus()||this.focus();this.gotFocus.raise(this,e)};InputDateRange.prototype._keydown=function(t){if(!(t.defaultPrevented||t.altKey||t.ctrlKey||t.metaKey)){this._isInvalidInputCancelled=!1;if(this._isHiddenEditor())return;switch(t.keyCode){case Key.Up:case Key.Down:if(t.keyCode===Key.Up&&this.keyActionUpArrow===KeyAction.OpenDropdown||t.keyCode===Key.Down&&this.keyActionDownArrow===KeyAction.OpenDropdown)break;if(!this.isDroppedDown&&this.value&&this._canChangeValue()){var i=t.keyCode==Key.Up?1:-1,n=this.selectionMode==DateSelectionMode.Month?DateTime.addMonths(this.value,i):DateTime.addDays(this.value,i);this.value=this._fromDateTime(n);this.selectAll();t.preventDefault()}}}e.prototype._keydown.call(this,t)};InputDateRange._ctrlTemplate="";return InputDateRange}(InputDate);export{InputDateRange};function getInputDateOptions(e){var t={};if(!isNullOrUndefined(e)){isNullOrUndefined(e.showConfirmationButtons)||(t.showConfirmationButtons=e.showConfirmationButtons);isNullOrUndefined(e.tabOrder)||(t.tabOrder=e.tabOrder)}return t}_addCultureInfo("InputColor",{ariaLabels:{inputColor:"Input Color",inputColorInput:"InputColor Input",button:"Choose Color",dialog:"ColorPicker"}});var InputColor=function(e){__extends(InputColor,e);function InputColor(t,i){var n=e.call(this,t)||this;n._textInitialized=!1;n._ariaLabelledby=null;n._inputAriaLabel=culture.InputColor.ariaLabels.inputColorInput;n.valueChanged=new Event;addClass(n.hostElement,InputColorClsNames.hostElement);setAttribute(n._dropDown,"role","dialog");setAriaLabel(n._dropDown,culture.InputColor.ariaLabels.dialog);setAttribute(n._dropDown,"aria-modal",!0);setAttribute(n._tbx,"role","combobox");setAttribute(n._tbx,"aria-haspopup","dialog");setAttribute(n._btn.querySelector("button"),"aria-haspopup","dialog");setAriaLabel(n._btn.querySelector("button"),culture.InputColor.ariaLabels.button);n.dropDown.id=getUniqueId(n.hostElement.id+"_dropdown");var o='<div class="'+InputColorClsNames.inputColorBox+'"></div>';n._ePreview=createElement(o,n.hostElement.firstElementChild);if("INPUT"==n._orgTag){n._tbx.type="";n._commitText()}n.value="#ffffff";n.isRequired=!0;n._tbx.value=n._oldText=n.value;n.initialize(i);if(n._textInitialized&&n._tbx.value!==n._oldText){n._oldText=n._tbx.value;n.onTextChanged();n._commitText();n._textInitialized=!1}n.addEventListener(n._colorPicker.hostElement,"click",(function(e){var t=e.target;if(t&&"DIV"==t.tagName&&(closest(t,'[wj-part="div-pal"]')||closest(t,'[wj-part="div-pv"]'))){t.style.backgroundColor&&(n.isDroppedDown=!1)}}));var s=!i||-1!==i.tabOrder&&i.colorPickerKeyActionTab!==ColorPickerTabKeyAction.None?0:-1;n._colorPicker.tabOrder=s;n._updateInputAriaLabel();return n}Object.defineProperty(InputColor,"controlTemplate",{get:function(){InputColor._ctrlTemplate||(InputColor._ctrlTemplate=DropDown.controlTemplate);return InputColor._ctrlTemplate},set:function(e){InputColor._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(InputColor.prototype,"value",{get:function(){return this._value},set:function(e){this.text=e},enumerable:!0,configurable:!0});Object.defineProperty(InputColor.prototype,"text",{get:function(){return this._tbx.value},set:function(e){if((e=asString(e))!=this.text&&(e||!this.isRequired)&&(!e||Color.fromString(e.replace(/\s+/g,"")))){this._setText(e,!0);this._commitText()}},enumerable:!0,configurable:!0});Object.defineProperty(InputColor.prototype,"inputType",{get:function(){return this._tbx.type},set:function(e){e.match(/^(tel|text|)$/i)?this._tbx.type=asString(e):console.warn("invalid input type '"+e+"', don't use any input types other than 'tel' or 'text'")},enumerable:!0,configurable:!0});Object.defineProperty(InputColor.prototype,"showAlphaChannel",{get:function(){return this._colorPicker.showAlphaChannel},set:function(e){this._colorPicker.showAlphaChannel=e},enumerable:!0,configurable:!0});Object.defineProperty(InputColor.prototype,"showColorString",{get:function(){return this._colorPicker.showColorString},set:function(e){this._colorPicker.showColorString=e},enumerable:!0,configurable:!0});Object.defineProperty(InputColor.prototype,"palette",{get:function(){return this._colorPicker.palette},set:function(e){this._colorPicker.palette=e},enumerable:!0,configurable:!0});Object.defineProperty(InputColor.prototype,"colorPicker",{get:function(){return this._colorPicker},enumerable:!0,configurable:!0});Object.defineProperty(InputColor.prototype,"ariaLabelledBy",{get:function(){return this._ariaLabelledby},set:function(e){_setAriaLabelBy(this,this._tbx,e,this._updateInputAriaLabel.bind(this))},enumerable:!0,configurable:!0});Object.defineProperty(InputColor.prototype,"colorPickerKeyActionTab",{get:function(){return this.colorPicker.keyActionTab},set:function(e){this.colorPicker.keyActionTab=e},enumerable:!0,configurable:!0});InputColor.prototype.onValueChanged=function(e){this.valueChanged.raise(this,e)};InputColor.prototype.onIsDroppedDownChanged=function(t){e.prototype.onIsDroppedDownChanged.call(this,t);if(this.isDroppedDown&&!this.isTouching){this.colorPicker._refreshSelection();var i=this._tbx;this._elRef==i&&setSelectionRange(i,0,this.text.length,!1);this.containsFocus()||this.focus()}};InputColor.prototype._createDropDown=function(){var e=this;this._colorPicker=new ColorPicker(this._dropDown);setCss(this._dropDown,{minWidth:420,minHeight:200});this._colorPicker.valueChanged.addHandler((function(){e.value=e._colorPicker.value}))};InputColor.prototype._keydown=function(t){if(!t.defaultPrevented)switch(t.keyCode){case Key.Enter:this._commitText();this.selectAll();break;case Key.Escape:this.text=this.value;this.selectAll();break;case Key.Tab:var i=getActiveElement();if(this.colorPicker.keyActionTab===ColorPickerTabKeyAction.All&&i!==this._tbx){var n=_getFocusableElements(this.colorPicker.hostElement),o=n[0],s=n[n.length-1];if(t.shiftKey){if(i===o){t.preventDefault();s.focus()}}else if(i===s){t.preventDefault();o.focus()}}else if(this.isDroppedDown){this.isDroppedDown=!1;this.containsFocus()||this.focus();this.keyActionTab===TabKeyAction.CloseAndKeepFocus&&t.preventDefault()}}e.prototype._keydown.call(this,t)};InputColor.prototype._commitText=function(){if(this._value!=this.text){var e=!this.text||!this.text.trim();if(!this.isRequired&&e){this._changeAllValue();this._ePreview.style.backgroundColor="";return}if(Color.fromString(this.text.replace(/\s+/g,""))){if(this.text&&this.text!==this.text.replace(/\s+/g,"")){this.text=this.text.replace(/\s+/g,"");return}this._changeAllValue()}else this.onInvalidInput(new CancelEventArgs)&&(this.text=this._value?this._value:"")}};InputColor.prototype._changeAllValue=function(){var e=this._colorPicker;e.value=this.text;this._value=e.value;this._ePreview.style.backgroundColor=this.value;this.onValueChanged()};InputColor.prototype._copy=function(e,t){if("text"===e){var i=(t||"").toString();if(i!==this.text){this._tbx.value=i;this._textInitialized=!0}return!0}return!1};InputColor.prototype.getAriaLabelForScreenReader=function(){return culture.InputColor.ariaLabels.inputColor};InputColor.prototype._updateInputAriaLabel=function(){this._tbx&&(this._tbx.id||this.ariaLabelledBy?setAriaLabel(this._tbx,null):setAriaLabel(this._tbx,this._inputAriaLabel))};InputColor._ctrlTemplate="";return InputColor}(DropDown);export{InputColor};_addCultureInfo("ComboBox",{ariaLabels:{comboBoxInput:"ComboBox Input",comboBox:"Combo Box"}});var ComboBox=function(e){__extends(ComboBox,e);function ComboBox(t,i){var n=e.call(this,t)||this;n._editable=!1;n._trimText=!0;n._handleWheel=!0;n._delKey=0;n._draggingText=!1;n._textIsComposing="";n._pathHdr=new Binding(null);n._bsCollapse=!0;n._fmtItemHandlers=0;n._emptyValueAction=!1;n._oldIndexToBeRestoredOnBlur=null;n._restoreComboboxTbxVal=!1;n._isWheel=!1;n._selItems=null;n._oldFilter=null;n._keyActionPrintCharacters=KeyAction.OpenDropdown;n._inputElementAriaLabel=culture.ComboBox.ariaLabels.comboBoxInput;n._ariaLabelledby=null;n.itemsSourceChanged=new Event;n.selectedIndexChanged=new Event;var o=n.hostElement;addClass(o,ComboBoxClsNames.hostElement);n.dropDown.id=getUniqueId(o.id+"_dropdown");n.autoExpandSelection=!1;var s=n._tbx;n.addEventListener(s,"compositionstart",(function(){n._composing=!0}));n.addEventListener(s,"compositionend",(function(){n._textIsComposing=n.text;n._composing=!1;n._setText(n._textIsComposing,!0);if(!n._textIsComposing&&n.isRequired){n._oldText="";n._oldIndexToBeRestoredOnBlur=null}setTimeout((function(){n._textIsComposing=""}))}));n.addEventListener(s,"drag",(function(){n._draggingText=!0}));n.addEventListener(o,"wheel",n._wheel.bind(n));"SELECT"==n._orgTag&&n._lbx._initFromSelect(o);var r=n._lbx;r.loadedItems.addHandler((function(e){n.selectedIndex>-1&&(n.selectedIndex=r.selectedIndex)}));r.tabOrder=-1;n.isRequired=!0;n.initialize(i);n._updateTbxAriaHaspopup();n._updateInputAriaLabel();return n}Object.defineProperty(ComboBox,"controlTemplate",{get:function(){ComboBox._ctrlTemplate||(ComboBox._ctrlTemplate=DropDown.controlTemplate);return ComboBox._ctrlTemplate},set:function(e){ComboBox._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"itemsSource",{get:function(){return this._lbx.itemsSource},set:function(e){if(this._lbx.itemsSource!=e){this._lbx.itemsSource=e;this.onItemsSourceChanged()}this._updateBtn()},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"collectionView",{get:function(){return this._lbx.collectionView},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"virtualizationThreshold",{get:function(){return this._lbx.virtualizationThreshold},set:function(e){this._lbx.virtualizationThreshold=e},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"showGroups",{get:function(){return this._lbx.showGroups},set:function(e){this._lbx.showGroups=e},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"displayMemberPath",{get:function(){return this._lbx.displayMemberPath},set:function(e){if(this.displayMemberPath!==e){this._lbx.displayMemberPath=e;var t=this._getDisplayText(void 0,void 0,!0);this.text!=t&&this._setText(t,!0)}},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"headerPath",{get:function(){return this._pathHdr.path},set:function(e){this._pathHdr.path=asString(e);var t=this._getDisplayText(void 0,void 0,!0);this.text!=t&&this._setText(t,!0)},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"selectedValuePath",{get:function(){return this._lbx.selectedValuePath},set:function(e){this._lbx.selectedValuePath=e},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"isContentHtml",{get:function(){return this._lbx.isContentHtml},set:function(e){if(e!=this.isContentHtml){this._lbx.isContentHtml=asBoolean(e);var t=this._getDisplayText(void 0,void 0,!0);this.text!=t&&this._setText(t,!0)}},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"caseSensitiveSearch",{get:function(){return this._lbx.caseSensitiveSearch},set:function(e){this._lbx.caseSensitiveSearch=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"trimText",{get:function(){return this._trimText},set:function(e){if(e!=this._trimText){this._trimText=asBoolean(e);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"itemFormatter",{get:function(){return this._lbx.itemFormatter},set:function(e){this._lbx.itemFormatter=asFunction(e);this.selectedIndex=this._lbx.selectedIndex},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"formatItem",{get:function(){return this._lbx.formatItem},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"selectedIndex",{get:function(){return this._lbx.selectedIndex},set:function(e){e!=this.selectedIndex&&isNumber(e)&&(this._lbx.selectedIndex=e);var t=this._lbx._oldSelectedIndex!=this.selectedIndex;e=this.selectedIndex;var i=this._getDisplayText(e,void 0,!0);if(this.text!=i||t){var n=this._internalSettingText;this._internalSettingText=this._lbx._ignoredItemChangedEvents;this._setText(i,!0);""!=this.text&&(this._emptyValueAction=!1);this._internalSettingText=n}},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"selectedItem",{get:function(){return this._lbx.selectedItem},set:function(e){this._lbx.selectedItem=e},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"selectedValue",{get:function(){return this.collectionView?this._lbx.selectedValue:this.text},set:function(e){this.collectionView?this._lbx.selectedValue=e:null!=e&&(this.text=e.toString())},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"isEditable",{get:function(){return this._editable},set:function(e){this._editable=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"handleWheel",{get:function(){return this._handleWheel},set:function(e){this._handleWheel=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"maxDropDownHeight",{get:function(){return this._lbx.maxHeight},set:function(e){this._lbx.maxHeight=e},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"maxDropDownWidth",{get:function(){var e=this._dropDown,t=e?parseInt(e.style.maxWidth):null;return isNaN(t)?null:t},set:function(e){var t=this._dropDown.style;e=asNumber(e,!0);t.maxWidth=null==e?"":e+"px";t.minWidth=""},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"keyActionPrintCharacters",{get:function(){return this._keyActionPrintCharacters},set:function(e){this._keyActionPrintCharacters=asEnum(e,KeyAction)},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"ariaLabelledBy",{get:function(){return this._ariaLabelledby},set:function(e){_setAriaLabelBy(this,this._tbx,e,this._updateInputAndListBoxAriaLabel.bind(this))},enumerable:!0,configurable:!0});ComboBox.prototype._updateInputAndListBoxAriaLabel=function(){this._updateInputAriaLabel()};ComboBox.prototype.getDisplayText=function(e,t){void 0===e&&(e=this.selectedIndex);void 0===t&&(t=this._trimText);return this._getDisplayText(e,t)};ComboBox.prototype._getDisplayText=function(e,t,i){void 0===e&&(e=this.selectedIndex);void 0===t&&(t=this._trimText);var n,o=this.collectionView;if(this.headerPath&&e>-1&&hasItems(o)){var s=o.items[e];n=null!=(n=s?this._pathHdr.getValue(s):null)?n.toString():"";this.isContentHtml&&(n=toPlainText(n))}else n=this._lbx._getDisplayText(e,i&&void 0!==this.itemFormatter&&!this._hasCustomFormatItem());return t?n.trim():n};ComboBox.prototype._hasCustomFormatItem=function(){return this.formatItem.hasHandlers};ComboBox.prototype.indexOf=function(e,t,i){void 0===i&&(i=!1);var n=this.collectionView,o=this.caseSensitiveSearch;if(hasItems(n)&&null!=e){e=e.toString();o||(e=e.toLowerCase());if(this._trimText&&!i){-1!==this.indexOf(e,!1,!0)||(e=e.trim())}var s=this.selectedIndex,r=this._getDisplayText(s,void 0,!0);if(t){o||(r=r.toLowerCase());if(e==r)return s}else if(!e&&""==r)return s;for(var a=0;a<n.items.length;a++)if(this._lbx.isItemEnabled(a)){r=this._getDisplayText(a,void 0,!0);this.trimText&&(r=r.trim());o||(r=r.toLowerCase());if(t){if(r==e&&!1===this._emptyValueAction)return a}else if(e&&0==r.indexOf(e)||!e&&""==r&&!1===this._emptyValueAction)return a}}return-1};Object.defineProperty(ComboBox.prototype,"listBox",{get:function(){return this._lbx},enumerable:!0,configurable:!0});ComboBox.prototype.onItemsSourceChanged=function(e){this.itemsSourceChanged.raise(this,e)};ComboBox.prototype.onSelectedIndexChanged=function(e){this._updateBtn();this.selectedIndexChanged.raise(this,e)};ComboBox.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);if(this.hostElement&&hasItems(this.collectionView)){this._lbx.refresh();this.selectedIndex>-1&&(this.selectedIndex=this._lbx.selectedIndex)}};ComboBox.prototype.onLostFocus=function(t,i,n){this._trimText&&(this.text=this.text.trim());if(this._composing){this._composing=!1;if(!this.text&&this.isRequired){this._oldText="";this._oldIndexToBeRestoredOnBlur=null}this._setText(this.text,!0)}if((!this.text&&this.isRequired&&!(Array.isArray(this._selItems)&&this._selItems.length>0)||n)&&hasItems(this.collectionView)&&!(this.isRequired&&!this.isEditable&&this.text&&this.indexOf(this.text,!1)>-1&&this.indexOf(this.text,!0)<0)){void 0!==i&&(this.selectedIndex=-1!==i?i:0);null!==this._oldIndexToBeRestoredOnBlur?this.selectedIndex=-1!==this._oldIndexToBeRestoredOnBlur?this._oldIndexToBeRestoredOnBlur:0:null==this.collectionView.currentItem&&(this.selectedIndex=0)}var o=this.text,s=this.collectionView?this.collectionView.items.length:0,r=this.selectedIndex;e.prototype.onLostFocus.call(this,t);var a=this.collectionView?this.collectionView.items.length:0,l=this.selectedIndex,h=this.text,u=this._oldFilter;this._oldFilter=null;if(r===l&&o===h){u&&(this.collectionView.filter=u);this._trySelectionUpdateOnItemsSourceChanged(a!==s,o)}};ComboBox.prototype.onIsDroppedDownChanging=function(t){if(!this.isDroppedDown&&!this._hasItems()){t.cancel=!0;return!1}return e.prototype.onIsDroppedDownChanging.call(this,t)};ComboBox.prototype.onIsDroppedDownChanged=function(t){e.prototype.onIsDroppedDownChanged.call(this,t);if(this.isDroppedDown){this._fmtItemHandlers=this.formatItem.handlerCount;this._lbx.showSelection()}this._updateTbxAria()};ComboBox.prototype._trySelectionUpdateOnItemsSourceChanged=function(e,t){if(e&&t){var i=this.indexOf(t,!0);i<0&&(i=this.indexOf(t,!1));this.selectedIndex=i}};ComboBox.prototype._setIsDisabled=function(t){e.prototype._setIsDisabled.call(this,t);this._updateBtn()};ComboBox.prototype._updateBtn=function(){var t=this.collectionView,i=this._tbx,n=this._hasItems();e.prototype._updateBtn.call(this);this._btn.style.display=this._showBtn&&null!=t?"":"none";enable(this._btn,n&&!this.isDisabled);setAttribute(i,"role",n?"combobox":null);setAttribute(i,"aria-autocomplete",n?"both":null);this._updateTbxAria()};ComboBox.prototype._hasItems=function(){return hasItems(this.collectionView)};ComboBox.prototype._updateTbxAria=function(){e.prototype._updateTbxAria.call(this);var t=this._tbx,i=this.isDroppedDown,n=this.dropDown?this.dropDown.id:null,o=n&&hasItems(this.collectionView),s=this._lbx,r=s.selectedIndex,a=s.hostElement?s.hostElement.children:null,l=s._getElementIndex(r),h=l>-1&&a&&l<a.length?a[l].id:null;setAttribute(t,"aria-controls",o&&i?n:null);setAttribute(t,"aria-expanded",o?i:null);setAttribute(t,"aria-activedescendant",this.isDroppedDown&&h&&h.length?h:null)};ComboBox.prototype._updateInputAriaLabel=function(){var e=this._tbx;e&&(e.id||this._ariaLabelledby?setAttribute(e,"aria-label",null):setAttribute(e,"aria-label",this._inputElementAriaLabel))};ComboBox.prototype._createDropDown=function(){var e=this;if(!this._lbx){this._lbx=new ListBox(this._dropDown);this._lbx._container=this.hostElement}this._lbx.maxHeight=200;this._lbx.selectedIndexChanged.addHandler((function(){e._updateBtn();var t=e._lbx.selectedIndex;e.selectedIndex=t;e.onSelectedIndexChanged()}));this._lbx.itemsChanged.addHandler((function(){e._updateBtn()}))};ComboBox.prototype._wheel=function(e){this._isWheel=!0;if(this.handleWheel&&!e.defaultPrevented&&!this.isDroppedDown&&!this.isReadOnly&&this.containsFocus()&&this.selectedIndex>-1){var t=this._findNext("",e.deltaY>0?1:-1);t>-1&&(this.selectedIndex=t);e.preventDefault()}this._isWheel=!1};ComboBox.prototype._dropDownClick=function(t){t.defaultPrevented||t.target!=this._dropDown&&(this.isDroppedDown=!1);this._restoreComboboxTbxVal&&(this._tbx.value=this._getDisplayText(this.selectedIndex,void 0,!0));e.prototype._dropDownClick.call(this,t)};ComboBox.prototype._setText=function(t,i,n){void 0===n&&(n=!1);if(!this._composing&&!this._settingText){this._settingText=!0;if(this.containsFocus()){var o=this.formatItem.handlerCount;if(this._fmtItemHandlers!=o){this._fmtItemHandlers=o;this._lbx.loadList()}}t=[null,void 0,NaN].includes(t)?"":t.toString();var s=this.selectedIndex,r=this.collectionView,a=this._getSelStart(),l=-1,h=!0;if(this.isEditable&&(this._delKey||this._getSelEnd()<t.length||!this.containsFocus())){i=!0;h=!1}s=this.indexOf(t,i);if(h){s<0&&i&&(s=this.indexOf(t,!1));s<0&&a>0&&!n&&(s=this.indexOf(t.substr(0,a),!1));if(!i){var u=this.indexOf(t,!0);u>-1&&s>-1&&u!=s&&(s=u)}}s<0&&this._delKey&&(s=this.indexOf(t,i));if(s<0&&!this.isEditable&&hasItems(r)&&(t&&this.isRequired||this.containsFocus()&&(t||this.isRequired))){var c=this._oldText||"";s=Math.max(0,this.indexOf(c,!1));a=0;for(var p=0;p<t.length&&p<c.length;p++)if(t[p]!=c[p]){a=p;break}}if((!this._delKey||!this.isEditable||this._delKey&&this.isEditable&&t==this._getDisplayText(s,void 0,!0))&&(!this._pristine||this._pristine&&!this.isEditable)||this._isWheel||this._delKey&&""==t&&s>-1){if(s>-1){l=a;t=this._getDisplayText(s,void 0,!0)}var d=this._tbx;t!=d.value&&(d.value=t);l>-1&&this.containsFocus()&&!this.isTouching&&this._updateInputSelection(l)}if(r){if(!t||this.trimText&&""==t.trim()&&!this.containsFocus()&&this.isEditable)if(s>-1)this._oldIndexToBeRestoredOnBlur=s;else{this._oldIndexToBeRestoredOnBlur=this.indexOf(this._oldText,!0);this._oldIndexToBeRestoredOnBlur=this._oldIndexToBeRestoredOnBlur<0?this.indexOf(this._oldText,!1):this._oldIndexToBeRestoredOnBlur}this._restoreComboboxTbxVal=t&&s>-1;r.moveCurrentToPosition(s)}this.containsFocus()||this.isEditable||this.isRequired||t!=t.trim()||!this.trimText||(this._tbx.value=this._getDisplayText(s,this.trimText,!0));!this.containsFocus()&&s>-1&&this.isEditable&&(t=this._getDisplayText(s,this.trimText,!0));!this.containsFocus()&&this._hasItems()&&s<0&&!this.isEditable&&!this.isRequired&&(t="");var m=!1;!t&&s<0&&this.isRequired&&!this.containsFocus()&&(m=!0);this.trimText&&!this.containsFocus()&&this.isEditable&&(this.isRequired&&""==t.trim()?m=!0:t=t.trim());if(m){this.selectedIndex=this._oldIndexToBeRestoredOnBlur;this.selectedIndex<0&&(this.selectedIndex=0)}var _=!this.containsFocus()&&!this.isEditable&&this.trimText;_&&(this._tbx.value=this._getDisplayText(s,!0,!0));this._delKey=0;this._settingText=!1;e.prototype._setText.call(this,m?this._getDisplayText(this.selectedIndex,void 0,!0):t,i,m,_)}};ComboBox.prototype._findNext=function(e,t,i){void 0===i&&(i=this.selectedIndex);var n=this.collectionView,o=n?n.items.length:0,s=this._lbx,r=this.caseSensitiveSearch;if(n&&o&&t){r||(e=e.toLowerCase());this.trimText&&(e=e.trim());for(var a=i+t;a>-1&&a<o;a+=t){var l=this._getDisplayText(a,void 0,!0);r||(l=l.toLowerCase());if(0==l.indexOf(e)){if(!this.dropDown.children[a]||s.isItemEnabled(a))return a}}}return i};ComboBox.prototype._findNextWhenIsEditableFalse=function(e,t,i){void 0===i&&(i=this.selectedIndex);var n=this._findNext(e,t,i);return n!==i?n:-1};ComboBox.prototype._keydown=function(t){e.prototype._keydown.call(this,t);if(!t.defaultPrevented&&!this.isReadOnly&&!t.altKey&&hasItems(this.collectionView)&&this._elRef==this._tbx&&!this._isHiddenEditor()){this._delKey=0;var i=this._getSelStart(),n=this._getSelEnd();switch(t.keyCode){case Key.Tab:if(this.isDroppedDown){this.isDroppedDown=!1;this.keyActionTab===TabKeyAction.CloseAndKeepFocus&&t.preventDefault()}break;case Key.Back:case Key.Delete:case 88:if(!t.ctrlKey&&!t.metaKey&&88==t.keyCode)break;if(this._bsCollapse&&!this.isEditable&&i>0&&n==this._tbx.value.length&&hasItems(this.collectionView)){this._setSelRange(i-1,n);i-=1}this._delKey=t.keyCode;break;case Key.Up:case Key.Down:i==this.text.length&&(i=0);this.selectedIndex=this._findNext(this.text.substr(0,i),t.keyCode==Key.Up?-1:1);this._setSelRange(i,this.text.length);t.preventDefault();break;case Key.PageUp:this._lbx._selectPrevPage();this.selectAll();t.preventDefault();break;case Key.PageDown:this._lbx._selectNextPage();this.selectAll();t.preventDefault();break;case Key.Home:case Key.End:var o=this._tbx;setAttribute(o,"aria-activedescendant",null)}this.text.length>0&&["Backspace","Delete","x"].includes(t.key)&&0===i&&n===this.text.length||this._delKey&&1===this.text.length?this._emptyValueAction=!0:this._composing||(this._emptyValueAction=!1)}};ComboBox.prototype._afterOpenDropdownByDownArrow=function(){if(-1===this.selectedIndex){this.selectedIndex=0;this.selectAll()}};ComboBox.prototype._input=function(e){this._handleDragTextState();this._updateDropDownWhenInput();this._updateComponentText();this._updateEmptyValueFlag();this._resetDragState()};ComboBox.prototype._handleDragTextState=function(){this._draggingText&&(this._emptyValueAction=""===this.text)};ComboBox.prototype._shouldOpenDropdown=function(){return this.keyActionPrintCharacters===KeyAction.OpenDropdown};ComboBox.prototype._handleIsEditableFalseInput=function(){var e=this.text,t=this.text.length,i=this._findNextWhenIsEditableFalse(e,1,this.selectedIndex-1);if(-1===i&&-1===(i=this._findNextWhenIsEditableFalse(e,1,-1))){var n=e[e.length-1];t=1;-1===(i=this._findNextWhenIsEditableFalse(n,1))&&(i=this._findNextWhenIsEditableFalse(n,1,-1))}-1!==i?this._updateSelection(i,t):this._updateComponentText()};ComboBox.prototype._updateSelection=function(e,t){this._tbx.value=this._getDisplayText(e,void 0,!0);this._updateInputSelection(t);var i=this.collectionView;i&&i.moveCurrentToPosition(e)};ComboBox.prototype._updateComponentText=function(){var e=this._textIsComposing||this.text;this._setText(e,!1)};ComboBox.prototype._updateEmptyValueFlag=function(){this.text&&(this._emptyValueAction=!1)};ComboBox.prototype._controlDropdownVisibility=function(){this.text&&!this.isDroppedDown&&(this.isDroppedDown=!0)};ComboBox.prototype._resetDragState=function(){this._draggingText=!1};ComboBox.prototype._updateInputSelection=function(e){var t=this._tbx;this._elRef==t&&this._setSelRange(e,t.value.length)};ComboBox.prototype._getSelStart=function(){var e=this._tbx;return e&&e.value?e.selectionStart:0};ComboBox.prototype._getSelEnd=function(){var e=this._tbx;return e&&e.value?e.selectionEnd:0};ComboBox.prototype._setSelRange=function(e,t){var i=this._tbx;this._elRef!=i||i.readOnly||setSelectionRange(i,e,t)};ComboBox.prototype.getAriaLabelForScreenReader=function(){return culture.ComboBox.ariaLabels.comboBox};ComboBox.prototype._updateDropDownWhenInput=function(){if(this._shouldOpenDropdown()){var e=this._getSelStart(),t=this._getSelEnd(),i=this._delKey,n=this.text;this._controlDropdownVisibility();this._tbx.value=n;this._setSelRange(e,t);this._delKey=i}};ComboBox._ctrlTemplate="";return ComboBox}(DropDown);export{ComboBox};_addCultureInfo("MultiSelect",{itemsSelected:"{count:n0} items selected",selectAll:"Select All",ariaLabels:{multiSelectInput:"MultiSelect Input",multiSelect:"Multi Select"}});var MultiSelect=function(e){__extends(MultiSelect,e);function MultiSelect(t,i){var n=e.call(this,t)||this;n._maxHdrItems=2;n._readOnly=!1;n._hdrFmt=null;n._inputElementAriaLabel=culture.MultiSelect.ariaLabels.multiSelectInput;n.checkedItemsChanged=new Event;addClass(n.hostElement,MultiSelectClsNames.hostElement);n._tbx.readOnly=!0;n.checkedMemberPath=null;n.removeEventListener(n.dropDown,"click");n._lbx.itemsChanged.addHandler((function(){n._updateHeader(!1)}));n._lbx.checkedItemsChanged.addHandler((function(){n._updateHeader(!1);n.onCheckedItemsChanged()}));n.clickAction=ClickAction.Toggle;n.initialize(i);n._updateInputAriaLabel();return n}Object.defineProperty(MultiSelect,"controlTemplate",{get:function(){MultiSelect._ctrlTemplate||(MultiSelect._ctrlTemplate=ComboBox.controlTemplate);return MultiSelect._ctrlTemplate},set:function(e){MultiSelect._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelect.prototype,"showSelectAllCheckbox",{get:function(){return this._msLbx.showSelectAllCheckbox},set:function(e){this._msLbx.showSelectAllCheckbox=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelect.prototype,"showFilterInput",{get:function(){return this._msLbx.showFilterInput},set:function(e){this._msLbx.showFilterInput=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelect.prototype,"delay",{get:function(){return this._msLbx.delay},set:function(e){this._msLbx.delay=e},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelect.prototype,"caseSensitiveSearch",{get:function(){return this._msLbx.caseSensitiveSearch},set:function(e){this._msLbx.caseSensitiveSearch=e},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelect.prototype,"filterInputPlaceholder",{get:function(){return this._msLbx.filterInputPlaceholder},set:function(e){this._msLbx.filterInputPlaceholder=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelect.prototype,"checkOnFilter",{get:function(){return this._msLbx.checkOnFilter},set:function(e){if(e!=this.checkOnFilter){this._msLbx.checkOnFilter=asBoolean(e);this.checkedItems=[]}},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelect.prototype,"selectAllLabel",{get:function(){return this._msLbx.selectAllLabel},set:function(e){this._msLbx.selectAllLabel=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelect.prototype,"checkedMemberPath",{get:function(){return this._msLbx.checkedMemberPath},set:function(e){this._msLbx.checkedMemberPath=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelect.prototype,"maxHeaderItems",{get:function(){return this._maxHdrItems},set:function(e){if(this._maxHdrItems!=e){this._maxHdrItems=asNumber(e);this._updateHeader()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelect.prototype,"headerFormat",{get:function(){return this._hdrFmt},set:function(e){if(e!=this._hdrFmt){this._hdrFmt=asString(e);this._updateHeader()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelect.prototype,"headerFormatter",{get:function(){return this._hdrFormatter},set:function(e){if(e!=this._hdrFormatter){this._hdrFormatter=asFunction(e);this._updateHeader()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelect.prototype,"checkedItems",{get:function(){return this._msLbx.checkedItems},set:function(e){this._msLbx.checkedItems=null==e?[]:asArray(e);this._updateHeader()},enumerable:!0,configurable:!0});MultiSelect.prototype.onCheckedItemsChanged=function(e){this.checkedItemsChanged.raise(this,e)};MultiSelect.prototype.dispose=function(){this._lbx.dispose();e.prototype.dispose.call(this)};MultiSelect.prototype.onIsDroppedDownChanged=function(t){var i=this;e.prototype.onIsDroppedDownChanged.call(this,t);setTimeout((function(){if(i.isDroppedDown&&i.containsFocus())if(i.showFilterInput&&!i.isTouching)i._msLbx._filter.focus();else{var e=i.listBox;if(e.selectedIndex<0){var t=0,n=e.checkedItems;n.length&&(t=e.collectionView.items.indexOf(n[0]));e.selectedIndex=Math.max(0,t)}e.showSelection(!0);e.focus()}}))};MultiSelect.prototype.onLostFocus=function(){this._msLbx.onLostFocus();this.isDroppedDown=!1;e.prototype.onLostFocus.call(this)};MultiSelect.prototype._createDropDown=function(){var t=this,i=createElement("<div></div>",this._dropDown);this._msLbx=new MultiSelectListBox(i);this._lbx=this._msLbx.listBox;var n=this.hostElement;this._lbx.hostElement.id=getUniqueId(n.id+"_listbox");this._lbx.itemsChanged.addHandler((function(){t.isDroppedDown&&t.refresh()}));e.prototype._createDropDown.call(this)};MultiSelect.prototype._updateBtnAria=function(){var e=this._btn.querySelector("button"),t=this.isDroppedDown,i=this._lbx?this._lbx.hostElement:null,n=i?i.id:null;setAttribute(e,"aria-expanded",t);setAttribute(e,"aria-controls",t?n:null)};MultiSelect.prototype._updateTbxAria=function(){var e=this._tbx,t=this.isDroppedDown,i=this._lbx?this._lbx.hostElement:null,n=i?i.id:null;setAttribute(e,"aria-expanded",t);setAttribute(e,"aria-controls",t?n:null)};Object.defineProperty(MultiSelect.prototype,"isReadOnly",{get:function(){return this._readOnly},set:function(e){this._readOnly=asBoolean(e);toggleClass(this.hostElement,ControlStateClsNames.readOnly,this.isReadOnly)},enumerable:!0,configurable:!0});MultiSelect.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);this.hostElement&&this._updateHeader()};MultiSelect.prototype._setText=function(e,t){};MultiSelect.prototype._keydown=function(t){var i=t.altKey&&(38===t.keyCode||40===t.keyCode);if(this.isDroppedDown&&i&&this.showFilterInput){this.isDroppedDown=!1;t.preventDefault()}else{e.prototype._keydown.call(this,t);hasClass(this._tbx,"wj-grid-ime")||!t.defaultPrevented&&hasItems(this.collectionView)&&t.keyCode>32&&123!==t.keyCode&&(this.isDroppedDown=!0)}};MultiSelect.prototype._hasItems=function(){var e=this.collectionView,t=e?e.sourceCollection:null;return hasItems(e)||t&&t.length&&this.showFilterInput};MultiSelect.prototype._updateHeader=function(e,t){void 0===e&&(e=!0);void 0===t&&(t=!0);var i="";if(isFunction(this._hdrFormatter))i=this._hdrFormatter(this);else{var n=this.checkedItems,o=[];if(this.displayMemberPath){var s=new Binding(this.displayMemberPath);o=n.reduce((function(e,t){(t.binding?e.find((function(e){return e.binding===t.binding})):e.find((function(e){return s.getValue(e)===s.getValue(t)})))||e.push(t);return e}),[]);n=o}if(n.length>0)if(n.length<=this._maxHdrItems){if(this.headerPath){var r=new Binding(this.headerPath);n=n.map((function(e){return r.getValue(e)}))}else if(this.displayMemberPath){var a=new Binding(this.displayMemberPath);n=n.map((function(e){return a.getValue(e)}))}this.isContentHtml&&(n=n.map((function(e){return toPlainText(e)})));this.trimText&&(n=n.map((function(e){return e?e.toString().trim():""})));i=n.join(", ")}else i=format(this.headerFormat||culture.MultiSelect.itemsSelected,{count:n.length})}var l=this.inputElement;if(i!=l.value){l.value=i;this.onTextChanged()}e&&this._lbx._updateCheckedList(this.checkedItems);this._updateState()};MultiSelect.prototype.getAriaLabelForScreenReader=function(){return culture.MultiSelect.ariaLabels.multiSelect};MultiSelect._DEF_CHECKED_PATH="$checked";MultiSelect._ctrlTemplate="";return MultiSelect}(ComboBox);export{MultiSelect};_addCultureInfo("Menu",{ariaLabels:{menuButton:"Menu"}});var Menu=function(e){__extends(Menu,e);function Menu(t,i){var n=e.call(this,t)||this;n._closing=!1;n._cmd=null;n._cmdPath=null;n._cmdParamPath=null;n._subPath=null;n._owner=null;n._isButton=!1;n._keepOpen=!1;n._openOnHover=!1;n._closeOnLeave=!0;n._subMenu=null;n._hoverEnterBnd=n._hoverEnter.bind(n);n._hoverLeaveBnd=n._hoverLeave.bind(n);n._hoverOverBnd=n._hoverOver.bind(n);n._ariaLabel=culture.Menu.ariaLabels.menuButton;n._aFEnabledItem=!1;n._parentMenu=null;n.itemClicked=new Event;Menu._MenuInstanceCount++;var o=n.hostElement,s=n._tbx,r=n._lbx,a=n.dropDown;addClass(o,MenuClsNames.hostElement);s.style.display="none";var l='<div wj-part="header" class="'+InputFormElementsClsNames.formControl+'"/>';n._hdr=n._elRef=createElement(l);s.parentElement.insertBefore(n._hdr,s);removeChild(s);n.isRequired=!1;if("SELECT"==n._orgTag){n.header=o.getAttribute("header");n._lbx.itemsSource&&(n.commandParameterPath="cmdParam")}n.isContentHtml=!0;n.maxDropDownHeight=500;n.addEventListener(n._hdr,"click",(function(e){if(!e.defaultPrevented){n._clearHover(e);if(n._isButton){n.isDroppedDown=!1;n._raiseCommand()}else n.isDroppedDown=!n.isDroppedDown}}));n.addEventListener(n._hdr,"mousedown",(function(e){e.defaultPrevented||n._clearHover(e)}));r.lostFocus.addHandler((function(){n.containsFocus()||(n.isDroppedDown=!1)}));addClass(a,MenuClsNames.menuItems);r.formatItem.addHandler(n._formatMenuItem.bind(n));n.initialize(i);setAttribute(a,"role","menu");n._updateBtnAria();n._updateHdrAria();r.tabOrder=0;n._updateLbxAria();return n}Object.defineProperty(Menu,"controlTemplate",{get:function(){Menu._ctrlTemplate||(Menu._ctrlTemplate=ComboBox.controlTemplate);return Menu._ctrlTemplate},set:function(e){Menu._ctrlTemplate=e},enumerable:!0,configurable:!0});Menu.prototype._updateBtnAria=function(){var e=this._btn.querySelector("button"),t=this.dropDown;setAttribute(e,"aria-expanded",this.isDroppedDown);setAttribute(e,"aria-haspopup","menu");setAttribute(e,"aria-owns",t.id);setAttribute(e,"aria-controls",t.id)};Menu.prototype._updateHdrAria=function(){var e=this.dropDown,t=this.isDisabled?-1:this._orgTabIndex;setAttribute(this._hdr,"role","button");setAttribute(this._hdr,"tabindex",t);setAttribute(this._hdr,"aria-label",this._ariaLabel);if(this.isButton){setAttribute(this._hdr,"aria-expanded");setAttribute(this._hdr,"aria-haspopup");setAttribute(this._hdr,"aria-owns");setAttribute(this._hdr,"aria-controls")}else{setAttribute(this._hdr,"aria-expanded",this.isDroppedDown);setAttribute(this._hdr,"aria-haspopup","menu");setAttribute(this._hdr,"aria-owns",e.id);setAttribute(this._hdr,"aria-controls",e.id)}};Menu.prototype._updateLbxAria=function(){var e=this._lbx,t=this.isDisabled?-1:e.tabOrder;e.itemRole="menuitem";e.tabOrder=t};Object.defineProperty(Menu.prototype,"ariaLabel",{get:function(){return this._ariaLabel},set:function(e){if(e!=this._ariaLabel){this._ariaLabel=e;setAttribute(this._hdr,"aria-label",this._ariaLabel)}},enumerable:!0,configurable:!0});Object.defineProperty(Menu.prototype,"autoSelectOnFocus",{get:function(){return this._aFEnabledItem},set:function(e){this._aFEnabledItem=e},enumerable:!0,configurable:!0});Object.defineProperty(Menu.prototype,"header",{get:function(){return this._hdr.innerHTML},set:function(e){this._hdr.innerHTML=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(Menu.prototype,"command",{get:function(){return this._cmd},set:function(e){this._cmd=e},enumerable:!0,configurable:!0});Object.defineProperty(Menu.prototype,"commandPath",{get:function(){return this._cmdPath},set:function(e){this._cmdPath=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(Menu.prototype,"commandParameterPath",{get:function(){return this._cmdParamPath},set:function(e){this._cmdParamPath=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(Menu.prototype,"subItemsPath",{get:function(){return this._subPath},set:function(e){if(e!=this._subPath){this._subPath=e;this.refresh(!0)}},enumerable:!0,configurable:!0});Object.defineProperty(Menu.prototype,"openOnHover",{get:function(){return this._openOnHover},set:function(e){this._openOnHover=asBoolean(e);this._updateHoverEvents()},enumerable:!0,configurable:!0});Object.defineProperty(Menu.prototype,"closeOnLeave",{get:function(){return this._closeOnLeave},set:function(e){this._closeOnLeave=asBoolean(e);this._updateHoverEvents()},enumerable:!0,configurable:!0});Object.defineProperty(Menu.prototype,"isButton",{get:function(){return this._isButton},set:function(e){this._isButton=asBoolean(e);this._updateHdrAria()},enumerable:!0,configurable:!0});Object.defineProperty(Menu.prototype,"keepOpen",{get:function(){return this._keepOpen},set:function(e){this._keepOpen=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(Menu.prototype,"owner",{get:function(){return this._owner},set:function(e){this._owner=asType(e,HTMLElement,!0);this._enableDisableItems()},enumerable:!0,configurable:!0});Menu.prototype.show=function(e){if(!this.isDroppedDown){var t=this._lbx._ignoredItemChangedEvents;this._lbx._ignoredItemChangedEvents=!0;this.selectedIndex=-1;this._lbx._ignoredItemChangedEvents=t;if(this.onIsDroppedDownChanging(new CancelEventArgs)){var i=this.dropDown,n=this.owner;!n&&e instanceof MouseEvent&&(n=e.target);n instanceof HTMLElement&&(i[Control._OWNR_KEY]=n);if(e instanceof MouseEvent&&this.openOnHover&&this.closeOnLeave){e=new Point(e.pageX-pageXOffset-2,e.pageY-pageYOffset-2)}showPopup(i,e,!1,this.isAnimated);this.onIsDroppedDownChanged()}}};Menu.prototype.hide=function(){if(this.isDroppedDown&&this.onIsDroppedDownChanging(new CancelEventArgs)){hidePopup(this.dropDown);this.onIsDroppedDownChanged()}};Menu.prototype.onItemClicked=function(e){this.itemClicked.raise(this,e)};Menu.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);this.hostElement&&this._enableDisableItems()};Menu.prototype.onIsDroppedDownChanged=function(t){e.prototype.onIsDroppedDownChanged.call(this,t);this._updateBtnAria();this._updateHdrAria();if(this.isDroppedDown){this._closing=!0;var i=this._lbx._ignoredItemChangedEvents;this._lbx._ignoredItemChangedEvents=!0;this._defaultItem=this.selectedItem;this.isRequired=!1;this.selectedIndex=-1;this._enableDisableItems();this._closing=!1;this._lbx._ignoredItemChangedEvents=i;if(this._aFEnabledItem){for(var n=this.dropDown.children,o=0;o<n.length;o++)if(!n[o].classList.contains(ControlStateClsNames.disabled)){this.selectedIndex=o;n[o].focus();break}}else this.dropDown.focus()}else{this._restoreSelectedItem();var s=this._subMenu;s&&(s.isDroppedDown=!1)}};Menu.prototype._restoreSelectedItem=function(){if(!this.selectedItem){var e=this._lbx._checking;this._lbx._checking=!0;this.selectedItem=this._defaultItem;this._lbx._checking=e}};Menu.prototype._updateHoverEvents=function(){var e=this.hostElement,t=this.dropDown,i=this.addEventListener.bind(this),n=this.removeEventListener.bind(this),o="mouseleave";n(e,"mouseenter",this._hoverEnterBnd);n(e,o,this._hoverLeaveBnd);n(t,"mouseover",this._hoverOverBnd);n(t,o,this._hoverLeaveBnd);if(this._openOnHover){i(e,"mouseenter",this._hoverEnterBnd);i(t,"mouseover",this._hoverOverBnd);if(this._closeOnLeave){i(e,o,this._hoverLeaveBnd);i(t,o,this._hoverLeaveBnd)}}};Menu.prototype._getSubItems=function(e){var t=this.subItemsPath,i=e&&t?e[t]:null;return isArray(i)&&i.length?i:null};Menu.prototype._formatMenuItem=function(e,t){var i=t.item;if(this._getSubItems(t.data)){addClass(i,MenuClsNames.subItems);setAttribute(i,"aria-expanded",!1)}else if("-"==i.innerHTML){i.innerHTML="";addClass(i,UtilitesClsNames.separator);setAttribute(i,"role","separator");setAttribute(i,"tabindex")}};Menu.prototype._keydown=function(t){if(!t.defaultPrevented){var i=this._getKeyCode(t);if(this.isDroppedDown)switch(i){case Key.Tab:this.isDroppedDown=!1;this._parentMenu&&this._parentMenu.focus();this.keyActionTab===TabKeyAction.CloseAndKeepFocus&&t.preventDefault();break;case Key.Enter:case Key.Right:if(this._showSubMenu()){t.preventDefault();return}break;case Key.Left:if(this._closeSubMenuAndFocusOwner()){t.preventDefault();return}break;case Key.Escape:this.isDroppedDown=!1;this.focus();this._focusMenuOwner();if(this._parentMenu){this._parentMenu.focus();this._parentMenu.isDroppedDown=!1}t.preventDefault()}if(i==Key.Enter){if(this._isButton){this._restoreSelectedItem();this._raiseCommand();t.preventDefault();return}if(this.isDroppedDown){if(this.selectedIndex>-1){this._raiseCommand();if(this.keepOpen){t.preventDefault();return}}if(this.keepOpen&&this._closeSubMenuAndFocusOwner()){t.preventDefault();return}}else{this.isDroppedDown=!0;t.preventDefault()}}}e.prototype._keydown.call(this,t)};Menu.prototype._afterOpenDropdownByDownArrow=function(){};Menu.prototype._dropDownClick=function(t){if(!t.defaultPrevented&&t.target!=this.dropDown){this._clearHover(t);if(this._showSubMenu()){t.preventDefault();return}if(this.selectedIndex>-1){this._raiseCommand();if(this.keepOpen){t.preventDefault();return}}}e.prototype._dropDownClick.call(this,t)};Menu.prototype._closeSubMenuAndFocusOwner=function(){var e=Control.getControl(this.owner);if(!(e instanceof Menu))return!1;var t=e.dropDown,i=e.selectedIndex,n=i>-1?t.children[i]:t;setAttribute(n,"aria-expanded",!1);setAttribute(n,"aria-owns");n.focus();return!0};Menu.prototype._showSubMenu=function(){var e=this,t=this._getSubItems(this.selectedItem);if(!t)return null;var i=this.dropDown.children[this.selectedIndex],n=i.getBoundingClientRect(),o=new Point(n.right,n.top);if(0==n.height)return null;var s=this.rightToLeft||"rtl"==this.dropDown.getAttribute("dir");s&&(o.x=n.left);var r=this._subMenu;r&&(r.isDroppedDown=!1);(r=new Menu(document.createElement("div"),{owner:this.hostElement,itemsSource:t,autoSelectOnFocus:this._aFEnabledItem,keepOpen:this.keepOpen,itemClicked:function(t,i){e.itemClicked.raise(t,i)},formatItem:function(t,i){e.formatItem.raise(t,i)}}))._parentMenu=this._parentMenu||this;if(i){setAttribute(i,"aria-expanded",!0);setAttribute(i,"aria-owns",r.dropDown.id)}var a=this.collectionView,l=r.collectionView;a&&a.filter&&l&&!l.filter&&(l.filter=a.filter);"displayMemberPath,selectedValuePath,isContentHtml,command,commandPath,commandParameterPath,maxDropDownWidth,maxDropDownHeight,dropDownCssClass,isAnimated,subItemsPath,openOnHover,closeOnLeave".split(",").forEach((function(t){r[t]=e[t]}));var h=r.dropDown;setAttribute(h,"dir",s?"rtl":null);r.show(o);r._rtlDir=s;h[Control._OWNR_KEY]=this.dropDown;return r};Menu.prototype._raiseCommand=function(e){var t=this.selectedItem,i=this._getSubItems(t),n=this._getCommand(t);if(n&&!i){var o=this._getCommandParm(t);if(!this._canExecuteCommand(n,o))return;this._executeCommand(n,o)}var s=this.headerPath;if(s){var r=new Binding(s).getValue(t);r=null==r?"":r.toString();this.header=this.isContentHtml?r:escapeHtml(r)}this.onItemClicked(e);if(this.containsFocus()){for(var a=this;a&&a.owner;){var l=Control.getControl(a.owner);if(!(l instanceof Menu))break;a=l}if(this.keepOpen){this._enableDisableItems();this._lbx.focus()}else{a.isDroppedDown=!1;a.focus();this._focusMenuOwner()}}};Menu.prototype._focusMenuOwner=function(){var e=this.owner;!e&&this.dropDown&&(e=this.dropDown[Control._OWNR_KEY]);if(!this.containsFocus()&&e instanceof HTMLElement&&e.offsetHeight)if(isIE){var t=document.documentElement,i=t.scrollLeft,n=t.scrollTop;e.focus();t.scrollLeft=i;t.scrollTop=n}else e.focus()};Menu.prototype._getCommand=function(e){var t=e&&this._cmdPath?e[this._cmdPath]:null;return t||this._cmd};Menu.prototype._getCommandParm=function(e){var t=this._cmdParamPath;return e&&t?e[t]:e};Menu.prototype._executeCommand=function(e,t){e&&!isFunction(e)&&(e=e.executeCommand);isFunction(e)&&e(t)};Menu.prototype._canExecuteCommand=function(e,t){if(e){var i=e.canExecuteCommand;if(isFunction(i))return i(t)}return!0};Menu.prototype._enableDisableItems=function(){if(this.collectionView&&(this._cmd||this._cmdPath))for(var e=this.collectionView.items,t=0;t<e.length;t++){var i=e[t],n=this._getCommand(i);if(n){var o=this._lbx.hostElement.children[t],s=this._getCommandParm(i);toggleClass(o,ControlStateClsNames.disabled,!this._canExecuteCommand(n,s))}}};Menu.prototype._clearHover=function(e){this._toHover&&clearTimeout(this._toHover);this._toHover=null;Menu._evtHover=e};Menu.prototype._isTargetDisabled=function(e){return hasClass(e.target,ControlStateClsNames.disabled)};Menu.prototype._hoverEnter=function(e){var t=this;this._clearHover(e);this._toHover=setTimeout((function(){t._toHover=null;t.isDroppedDown=!0}),Control._HOVER_DELAY)};Menu.prototype._hoverOver=function(e){var t=this;this._clearHover(e);this._toHover=setTimeout((function(){t._toHover=null;var i=t.listBox.indexOf(e.target);if(i>-1&&!hasClass(e.target,ControlStateClsNames.disabled)){t.selectedIndex=i;t._subMenu=t._showSubMenu()}}),Control._HOVER_DELAY)};Menu.prototype._hoverLeave=function(e){var t=this;this._clearHover(e);this.isDroppedDown&&(this._toHover=setTimeout((function(){var i=(e=Menu._evtHover)?document.elementFromPoint(e.clientX,e.clientY):null,n=closest(i,"."+ListBoxClsNames.hostElement+"."+MenuClsNames.menuItems),o=t._subMenu;if(!n&&!contains(t.hostElement,i,!0)){t.isDroppedDown=!1;o&&(o.isDroppedDown=!1)}}),Control._LEAVE_DELAY))};Menu.prototype._setIsDisabled=function(t){e.prototype._setIsDisabled.call(this,t);setAttribute(this.hostElement,"tabindex",-1);this._updateHdrAria();this._updateLbxAria()};Menu.prototype._setTabOrder=function(t){e.prototype._setTabOrder.call(this,t);setAttribute(this.hostElement,"tabindex",-1);this._updateHdrAria();this._updateLbxAria()};Menu.prototype._getRtlStates=function(){var t=this.hostElement;return t&&t.isConnected?e.prototype._getRtlStates.call(this):null!=this._rtlDir&&this._rtlDir};Menu.prototype.dispose=function(){var t=this;if(this._subMenu){this._subMenu.dispose();this._subMenu=null}Menu._MenuInstanceCount--;0===Menu._MenuInstanceCount&&Menu._evtHover&&(Menu._evtHover=null);var i=this._lbx;if(i){i.lostFocus.removeHandler((function(){t.containsFocus()||(t.isDroppedDown=!1)}));i.formatItem&&i.formatItem.removeHandler(this._formatMenuItem)}if(this._toHover){clearTimeout(this._toHover);this._toHover=null}this._cmd=null;this._owner=null;this._defaultItem=null;this._hoverEnterBnd=null;this._hoverLeaveBnd=null;this._hoverOverBnd=null;e.prototype.dispose.call(this)};Menu._MenuInstanceCount=0;Menu._ctrlTemplate="";return Menu}(ComboBox);export{Menu};_addCultureInfo("InputTime",{ariaLabels:{inputTime:"Input Time",inputTimeInput:"InputTime Input"}});var InputTime=function(e){__extends(InputTime,e);function InputTime(t,i){var n=e.call(this,t)||this;n._format="t";n._inputElementAriaLabel=culture.InputTime.ariaLabels.inputTimeInput;n.valueChanged=new Event;addClass(n.hostElement,InputTimeClsNames.hostElement);n.isEditable=!0;n._value=DateTime.newDate();n._min=n._max=null;n._msk=new _MaskProvider(n._tbx);isIE9()||(n._tbx.type="tel");if("INPUT"==n._orgTag){var o=n._tbx.getAttribute("value");o&&(n.value=Globalize.parseDate(o,"HH:mm:ss"))}n.step=15;n.autoExpandSelection=!0;n.initialize(i);n._commitText();n._updateInputAriaLabel();return n}Object.defineProperty(InputTime,"controlTemplate",{get:function(){InputTime._ctrlTemplate||(InputTime._ctrlTemplate=ComboBox.controlTemplate);return InputTime._ctrlTemplate},set:function(e){InputTime._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(InputTime.prototype,"inputElement",{get:function(){return this._tbx},enumerable:!0,configurable:!0});Object.defineProperty(InputTime.prototype,"inputType",{get:function(){return this._tbx.type},set:function(e){this._tbx.type=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputTime.prototype,"value",{get:function(){return this._value},set:function(e){(e=asDate(e,!this.isRequired))&&(e=this._clamp(e));this._setText(e?Globalize.format(e,this.format):"",!0,!0);this.selectedItem&&this.selectedItem.value&&(e=DateTime.fromDateTime(e,this.selectedItem.value));if(e!=this._value&&!DateTime.equals(e,this._value)){this._value=e;this.onValueChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(InputTime.prototype,"text",{get:function(){return this._tbx.value},set:function(e){if(e!=this.text&&(this.text||!this.isRequired)){this._setText(e,!0);this._commitText()}!this.text&&this.isRequired&&(this.selectedIndex=this._oldIndexToBeRestoredOnBlur<0?0:this._oldIndexToBeRestoredOnBlur)},enumerable:!0,configurable:!0});Object.defineProperty(InputTime.prototype,"min",{get:function(){return this._min},set:function(e){this._min=asDate(e,!0);this.isDroppedDown=!1;this._updateItems()},enumerable:!0,configurable:!0});Object.defineProperty(InputTime.prototype,"max",{get:function(){return this._max},set:function(e){this._max=asDate(e,!0);this.isDroppedDown=!1;this._updateItems()},enumerable:!0,configurable:!0});Object.defineProperty(InputTime.prototype,"step",{get:function(){return this._step},set:function(e){if(e!=this.step){this._step=asNumber(e,!0);this.isDroppedDown=!1;this._updateItems()}},enumerable:!0,configurable:!0});Object.defineProperty(InputTime.prototype,"format",{get:function(){return this._format},set:function(e){if(e!=this.format){this._format=asString(e);this._tbx.value=Globalize.format(this.value,this.format);hasItems(this.collectionView)&&this._updateItems()}},enumerable:!0,configurable:!0});Object.defineProperty(InputTime.prototype,"mask",{get:function(){return this._msk.mask},set:function(e){this._msk.mask=asString(e)},enumerable:!0,configurable:!0});InputTime.prototype.onLostFocus=function(){e.prototype.onLostFocus.call(this)};InputTime.prototype.onValueChanged=function(e){this.valueChanged.raise(this,e)};InputTime.prototype.onItemsSourceChanged=function(t){e.prototype.onItemsSourceChanged.call(this,t);this._hasCustomItems=null!=this.itemsSource};InputTime.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);if(this.hostElement){this._msk.refresh();this._tbx.value=Globalize.format(this.value,this.format);this._updateItems()}};InputTime.prototype.onSelectedIndexChanged=function(t){if(this.selectedIndex>-1&&!this._settingText){var i=this.value?this.value:DateTime.newDate(),n=null!=this.selectedItem.value?this.selectedItem.value:Globalize.parseDate(this.text,this.format,this.value);this.value=DateTime.fromDateTime(i,n)}e.prototype.onSelectedIndexChanged.call(this,t)};InputTime.prototype._clamp=function(e){null!=this._min&&this._getTime(e)<this._getTime(this._min)&&(e=DateTime.fromDateTime(e,this._min));null!=this._max&&this._getTime(e)>this._getTime(this._max)&&(e=DateTime.fromDateTime(e,this._max));return e};InputTime.prototype._wheel=function(t){if(this.handleWheel&&!t.defaultPrevented&&!this.isDroppedDown&&this.value&&this._canChangeValue()&&this.containsFocus()&&this.isEditable){var i=this._tbx,n=i.selectionStart,o=i.selectionEnd,s=clamp(-t.deltaY,-1,1),r=(this.value,culture.Globalize.calendar.patterns[this.format]);null==r&&(r=this.format);var a=r.match(getSpecialCharsRegex());if(o-n===i.value.length&&isNumber(this.step)&&this.step>0){var l=DateTime.addMinutes(this.value,this.step*-s);l=this._clamp(l);this.value=l;this.selectAll()}else this._updateTimeValue(s,a,r);t.preventDefault()}e.prototype._wheel.call(this,t)};InputTime.prototype._updateInputSelection=function(t){if(this._delKey)e.prototype._updateInputSelection.call(this,t);else{for(var i=this._tbx.value;t<i.length&&!i[t].match(/[a-z0-9]/i);)t++;setSelectionRange(this._tbx,t,this._tbx.value.length)}};InputTime.prototype._updateItems=function(){if(!this._hasCustomItems){var e=[],t=new Date,i=new Date(t.getFullYear(),t.getMonth(),t.getDate()),n=new Date(t.getFullYear(),t.getMonth(),t.getDate(),23,59,59),o=this.step;this.min&&i.setHours(this.min.getHours(),this.min.getMinutes(),this.min.getSeconds());this.max&&n.setHours(this.max.getHours(),this.max.getMinutes(),this.max.getSeconds());if(isNumber(o)&&o>=1)for(var s=i;s<=n;s=DateTime.addMinutes(s,o))e.push({value:s,text:Globalize.format(s,this.format)});var r=this.value;this._settingText=!0;this.displayMemberPath="text";this.selectedValuePath="text";this.itemsSource=e;this._hasCustomItems=!1;this._settingText=!1;!r&&this.isRequired||(this.value=r)}};InputTime.prototype._getTime=function(e){return 3600*e.getHours()+60*e.getMinutes()+e.getSeconds()};InputTime.prototype._getText=function(){var e=Globalize.format,t=this._format;return e(this.value,t)};InputTime.prototype._canChangeValue=function(){return!this.isReadOnly&&!this.isDisabled};InputTime.prototype.getSeconds=function(e){return 3600*e.getHours()+60*e.getMinutes()+e.getSeconds()};InputTime.prototype._keydown=function(t){if(!(t.defaultPrevented||t.altKey||t.ctrlKey||t.metaKey)){if(this._isHiddenEditor())return;switch(t.keyCode){case Key.Enter:this._commitText(void 0,!0);this.selectAll();break;case Key.Escape:this.text=Globalize.format(this.value,this.format);this.selectAll();break;case Key.Up:case Key.Down:if(!this.isDroppedDown&&this.value&&this._canChangeValue()&&this.isEditable){var i=this._tbx,n=i.selectionStart,o=i.selectionEnd,s=t.keyCode==Key.Up?1:-1,r=culture.Globalize.calendar.patterns[this.format];null==r&&(r=this.format);var a=r.match(getSpecialCharsRegex());if(o-n==i.value.length)e.prototype._keydown.call(this,t);else{if(!(1==s&&(null===this.max||this.getSeconds(this.value)<this.getSeconds(this.max))||-1==s&&(null===this.min||this.getSeconds(this.value)>this.getSeconds(this.min))))return;this._updateTimeValue(s,a,r)}t.preventDefault()}}}e.prototype._keydown.call(this,t)};InputTime.prototype._updateTimeValue=function(e,t,i){var n=this._tbx,o=n.selectionStart,s=n.value,r=this.value,a={},l={},h=0,u=0,c=0,p=[],d=[],m=n.value.match(getSpecialCharsRegex());if(null==t||null==m){p=[this.format];d=["0"];t=[""]}else{t.forEach((function(e,n){var o=e.replaceAll('"',""),r=i.substring(h),c=s.substring(u),p=r.indexOf(e),d=c.indexOf(o),m=r.substring(0,p);a[m]=h;l[m]=u;h=h+p+e.length;u=u+d+o.length;if(n==t.length-1&&-1!=d){m=i.substring(h);a[m]=h;l[m]=u}}));p=Object.keys(a);d=Object.values(l)}var _=d.filter((function(e){return o>=parseInt(e.toString())}));_.length>0&&(c=_.length-1);var f=p[c];-1!=f.indexOf("h")||-1!=f.indexOf("H")?r=DateTime.addHours(this.value,e):-1!=f.indexOf("m")?r=DateTime.addMinutes(this.value,e):-1!=f.indexOf("s")?r=DateTime.addSeconds(this.value,e):-1!=f.indexOf("t")&&(r=this.value.getHours()>=12?DateTime.addHours(this.value,-12):DateTime.addHours(this.value,12));r.getDate()!=(new Date).getDate()&&(r=DateTime.fromDateTime(new Date,r));this.value=r;this._reselectText(t,c)};InputTime.prototype._reselectText=function(e,t){var i=this._getText(),n=this._tbx,o=0,s=-1,r=-1;e.forEach((function(e,n){var a=e.replaceAll('"',""),l=i.substring(o),h=l.indexOf(a),u=l.substring(0,h),c=""==u?l.length:u.length;n==t&&-1==s&&(r=(s=o)+c);o=o+h+a.length}));if(-1==s){s=o;r=n.value.length}setSelectionRange(n,s,r)};InputTime.prototype._commitText=function(e,t){if(this.text||this.isRequired){var i=this.value?Globalize.format(this.value,this.format):"";if(this.text!=i){var n=this.selectedItem&&this.selectedItem.value?this.selectedItem.value:Globalize.parseDate(this.text,this.format,this.value),o=this._shouldRaiseInvalidInput(t);if(n){!DateTime.sameTime(n,this._clamp(n))?o&&this.onInvalidInput(new CancelEventArgs)&&(this.value=DateTime.fromDateTime(this.value,n)):this.value=DateTime.fromDateTime(this.value,n)}else o&&this.onInvalidInput(new CancelEventArgs)&&(this.text=i)}}else this.value=null};InputTime.prototype._copy=function(e,t){if("text"===e){(t||"").toString()!==this.text&&this._setText(t,!0);return!0}return!1};InputTime.prototype.getAriaLabelForScreenReader=function(){return culture.InputTime.ariaLabels.inputTime};InputTime.prototype._input=function(e){this._draggingText&&(""===this.text?this._emptyValueAction=!0:this._emptyValueAction=!1);this._updateDropDownWhenInput();this._setText(""!=this._textIsComposing?this._textIsComposing:this.text,!1);""!=this.text&&(this._emptyValueAction=!1);this._draggingText=!1};InputTime._ctrlTemplate="";return InputTime}(ComboBox);export{InputTime};_addCultureInfo("InputDateTime",{ariaLabels:{inputDateTimeInput:"InputDateTime Input",tglDate:"Toggle Calendar",tglTime:"Toggle Time List"}});var InputDateTime=function(e){__extends(InputDateTime,e);function InputDateTime(t,i){var n=e.call(this,t)||this;n._inputAriaLabel=culture.InputDateTime.ariaLabels.inputDateTimeInput;addClass(n.hostElement,InputDateTimeClsNames.hostElement);var o=culture.InputDateTime.ariaLabels;setAriaLabel(n._btn,o.tglDate);setAttribute(n._btn,"aria-haspopup","dialog");setAttribute(n._btn,"aria-expanded",!1);n._updateInputAriaLabel();n.value=new Date;n.format="g";n.isDroppedDownChanged.addHandler(n.inputDateTimeIsDroppedDownChanged,n);n._inputTime=new InputTime(document.createElement("div"),{valueChanged:function(e){var t=n.rangeEnd;n.value=DateTime.fromDateTime(n.value,e.value);n.calendar._rngMode()&&t&&(n.rangeEnd=DateTime.fromDateTime(t,e.value))},isDroppedDownChanged:function(e){e.listBox.containsFocus()&&n.inputElement.focus();n._selectAll();n._updateTbxAria();n.inputDateTimeIsDroppedDownChanged()},keyActionPrintCharacters:0,keyActionTab:0});n._inputTime.dropDown.id=getUniqueId(n.hostElement.id+"_dropdown");var s=n.addEventListener.bind(n);n._btnTm=n.hostElement.querySelector('[wj-part="btn-tm"]');s(n._btnTm,"mousedown",(function(e){n._isTouchMoved()||n._btnclick(e)}));setAriaLabel(n._btnTm,o.tglTime);setAttribute(n._btnTm,"aria-haspopup","listbox");setAttribute(n._btnTm,"aria-expanded",!1);n._ddDate=n._dropDown;n._ddTime=n._inputTime.dropDown;var r=n._ddTime;s(r,"keydown",n._keydown.bind(n),!0);s(r,"blur",(function(){n._updateFocusState()}),!0);s(r,"click",(function(e){e.defaultPrevented||e.target!=r&&n.hostElement.focus()}),!0);n.initialize(i);n._tbx.value!==n._oldText&&n._commitText();return n}Object.defineProperty(InputDateTime,"controlTemplate",{get:function(){InputDateTime._ctrlTemplate||(InputDateTime._ctrlTemplate='<div class="'+ControlClsNames.template+'"><div class="'+InputClsNames.input+'"><div class="'+InputClsNames.inputGroup+" "+InputClsNames.inputBtnVisible+'"><input wj-part="input" type="text" class="'+InputFormElementsClsNames.formControl+'"/><span class="'+InputClsNames.inputGroupBtn+'"><button wj-part="btn" class="'+InputFormElementsClsNames.btn+" "+InputFormElementsClsNames.btnDefault+'" tabindex="-1"><span class='+GlyphClsNames.calendar+'></span></button><button wj-part="btn-tm" class="'+InputFormElementsClsNames.btn+" "+InputFormElementsClsNames.btnDefault+'" tabindex="-1"><span class='+GlyphClsNames.clock+'></span></button></span></div></div><div wj-part="dropdown" class="'+ControlClsNames.content+" "+DropDownClsNames.dropDownPanel+'"></div></div>');return InputDateTime._ctrlTemplate},set:function(e){InputDateTime._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(InputDateTime.prototype,"timeMin",{get:function(){return this._inputTime.min},set:function(e){this._inputTime.min=e},enumerable:!0,configurable:!0});Object.defineProperty(InputDateTime.prototype,"timeMax",{get:function(){return this._inputTime.max},set:function(e){this._inputTime.max=e},enumerable:!0,configurable:!0});Object.defineProperty(InputDateTime.prototype,"timeFormat",{get:function(){return this._inputTime.format},set:function(e){this._inputTime.format=e},enumerable:!0,configurable:!0});Object.defineProperty(InputDateTime.prototype,"timeStep",{get:function(){return this._inputTime.step},set:function(e){this._inputTime.step=e;this._btnTm.style.display=isNumber(e)&&e>0?"":"none"},enumerable:!0,configurable:!0});Object.defineProperty(InputDateTime.prototype,"inputTime",{get:function(){return this._inputTime},enumerable:!0,configurable:!0});InputDateTime.prototype._fromDateTime=function(e){return e};InputDateTime.prototype._btnclick=function(t){this._setDropDownByEvent(t);e.prototype._btnclick.call(this,t)};InputDateTime.prototype.dispose=function(){this._setDropdown(this._ddDate);e.prototype.dispose.call(this);this._inputTime.dispose()};InputDateTime.prototype.refresh=function(t){void 0===t&&(t=!0);this._inputTime.refresh();e.prototype.refresh.call(this,t)};InputDateTime.prototype._updateBtn=function(){e.prototype._updateBtn.call(this);if(this._btnTm){this._btnTm.tabIndex=this._btn.tabIndex;this._btnTm.parentElement.style.display=this._btn.style.display}};InputDateTime.prototype._setDropdown=function(e){if(this._dropDown==e)return!1;this.isDroppedDown&&(this.isDroppedDown=!1);var t=this.dropDownCssClass;this.dropDownCssClass="";this._dropDown=e;this.dropDownCssClass=t;return!0};InputDateTime.prototype._updateDropDown=function(){var t=this._inputTime;if(this._dropDown==t.dropDown){this._commitText();e.prototype._updateDropDown.call(this);t.isRequired=this.isRequired&&null!=this.value;t.value=this.value;this.isDroppedDown&&t.listBox.showSelection()}else e.prototype._updateDropDown.call(this)};InputDateTime.prototype._mouseWheel=function(e){if(this.handleWheel&&!e.defaultPrevented&&!this.isDroppedDown&&this.containsFocus()&&null!=this.value&&this._canChangeValue()){var t=this._tbx,i=t.selectionStart,n=t.selectionEnd,o=clamp(-e.deltaY,-1,1),s=this.value,r=Globalize.getFullFormat(this.format||Globalize.DefaultDateFormat);null==r&&(r=this.format);var a=r.match(getSpecialCharsRegex());if(n-i===t.value.length&&null!=a||this.selectionMode==DateSelectionMode.Range){s=this.selectionMode==DateSelectionMode.Month?DateTime.addMonths(this.value,o):DateTime.addDays(this.value,o);this.value=s;var l=this._getText();setSelectionRange(t,0,l.length)}else(1==o&&(null===this.max||this.value<this.max)||-1==o&&(null===this.min||this.value>this.min))&&this._updateDateTimeValue(o,a,r);e.preventDefault()}};InputDateTime.prototype._keydown=function(t){if(!(t.defaultPrevented||t.altKey||t.ctrlKey||t.metaKey)){if(this._isHiddenEditor())return;switch(t.keyCode){case Key.Up:case Key.Down:if(t.keyCode===Key.Up&&this.keyActionUpArrow===KeyAction.OpenDropdown||t.keyCode===Key.Down&&this.keyActionDownArrow===KeyAction.OpenDropdown)break;if(!this.isDroppedDown&&this.value&&this._canChangeValue()){var i=this._tbx,n=i.selectionStart,o=i.selectionEnd,s=(i.value,t.keyCode==Key.Up?1:-1),r=this.value,a=Globalize.getFullFormat(this.format||Globalize.DefaultDateFormat);if("g"==this.format&&a.includes("г")){a=a.replace(/"г." /,"")}null==a&&(a=this.format);var l=a.match(getSpecialCharsRegex());if(o-n===i.value.length&&null!=l||this.selectionMode==DateSelectionMode.Range){r=this.selectionMode==DateSelectionMode.Month?DateTime.addMonths(this.value,s):DateTime.addDays(this.value,s);this.value=r;var h=this._getText();setSelectionRange(i,0,h.length)}else(1==s&&(null===this.max||this.value<this.max)||-1==s&&(null===this.min||this.value>this.min))&&this._updateDateTimeValue(s,l,a);t.preventDefault()}break;case Key.Enter:case Key.Space:var u=t.target;if(u===this._btn||u===this._btnTm){this._setDropDownByEvent(t);this.isDroppedDown=!0;t.preventDefault()}}}if(!t.defaultPrevented&&t.altKey&&this.isDroppedDown&&("ArrowUp"===t.key||"ArrowDown"===t.key)){var c=this.dropDown===this._ddDate?this._ddTime:this._ddDate;this._setDropdown(c);this.isDroppedDown=!0;t.preventDefault()}e.prototype._keydown.call(this,t)};InputDateTime.prototype._updateDateTimeValue=function(e,t,i){var n=this._tbx,o=n.selectionStart,s=n.value,r=this.value,a={},l={},h=0,u=0,c=0,p=[],d=[],m=n.value.match(getSpecialCharsRegex());if(null==t||null==m){p=[this.format];d=["0"];t=[""]}else{t.forEach((function(e,n){var o=e.replaceAll('"',""),r=i.substring(h),c=s.substring(u);if(c.startsWith("г.")){c=c.replace("г. ","");u+="г. ".length}var p=r.indexOf(e),d=c.indexOf(o);if(-1==d){var _=m[n];d=c.indexOf(_)}var f=r.substring(0,p);if(""!=f){a[f]=h;l[f]=u}h=h+p+e.length;u=u+d+o.length;if(n==t.length-1&&-1!==d){f=i.substring(h);a[f]=h;l[f]=u}}));p=Object.keys(a);d=Object.values(l)}var _=d.filter((function(e){return o>=parseInt(e.toString())}));_.length>0&&(c=_.length-1);var f=new Date,b=new Date;null!==this.timeMax&&(f=new Date(this.value.getFullYear(),this.value.getMonth(),this.value.getDate(),this.timeMax.getHours(),this.timeMax.getMinutes(),this.timeMax.getSeconds()));null!==this.timeMin&&(b=new Date(this.value.getFullYear(),this.value.getMonth(),this.value.getDate(),this.timeMin.getHours(),this.timeMin.getMinutes(),this.timeMin.getSeconds()));var g=p[c];if(-1!=g.indexOf("d"))r=DateTime.addDays(this.value,e);else if(-1!=g.indexOf("M"))r=DateTime.addMonths(this.value,e);else if(-1!=g.indexOf("y"))r=DateTime.addYears(this.value,e);else if(1==e&&(null===this.timeMax||this.value<f)||-1==e&&(null===this.timeMin||this.value>b)){-1!=g.indexOf("h")||-1!=g.indexOf("H")?r=DateTime.addHours(this.value,e):-1!=g.indexOf("m")?r=DateTime.addMinutes(this.value,e):-1!=g.indexOf("s")?r=DateTime.addSeconds(this.value,e):-1!=g.indexOf("t")&&(r=this.value.getHours()>=12?DateTime.addHours(this.value,-12):DateTime.addHours(this.value,12));(this.timeMax&&r>f||this.timeMin&&r<b)&&(r=this.value)}this.value=r;this._reselectText(t,c)};InputDateTime.prototype._commitText=function(t,i){var n=this._tbx.value,o=Globalize.parseDate(n,this.format,this.value),s=new Date,r=new Date;if(o){null!==this.timeMax&&(s=new Date(o.getFullYear(),o.getMonth(),o.getDate(),this.timeMax.getHours(),this.timeMax.getMinutes(),this.timeMax.getSeconds()));null!==this.timeMin&&(r=new Date(o.getFullYear(),o.getMonth(),o.getDate(),this.timeMin.getHours(),this.timeMin.getMinutes(),this.timeMin.getSeconds()));(this.timeMax&&o>s||this.timeMin&&o<r)&&(this.value=DateTime.fromDateTime(o,this.value));e.prototype._commitText.call(this,t,i)}else e.prototype._commitText.call(this,t,i)};InputDateTime.prototype._updateTbxAria=function(){e.prototype._updateTbxAria.call(this);if(this._inputTime){var t=this._tbx,i=this._inputTime._lbx,n=i.selectedIndex,o=i.hostElement?i.hostElement.children:null,s=n>-1&&n<o.length?o[n].id:null;setAttribute(t,"aria-activedescendant",this.isDroppedDown&&this.dropDown===this._ddTime&&s&&s.length?s:null);setAttribute(t,"aria-haspopup",this.inputTime.isDroppedDown?"listbox":"dialog")}};Object.defineProperty(InputDateTime.prototype,"keyActionTab",{get:function(){return this._keyActionTab},set:function(e){var t=asEnum(e,TabKeyAction);this._keyActionTab=t;this.inputTime.keyActionTab=t},enumerable:!0,configurable:!0});InputDateTime.prototype._setDropDownByEvent=function(e){var t=closest(e.target,"button")==this._btn?this._ddDate:this._ddTime;this._setDropdown(t)};InputDateTime.prototype._updateBtnAria=function(){var e=this._btn,t=this.isDroppedDown,i=this.dropDown?this.dropDown.id:null,n=this._btnTm,o=t&&this.dropDown===this._ddDate,s=t&&this.dropDown===this._ddTime;setAttribute(e,"aria-expanded",!!o);setAttribute(e,"aria-controls",o?i:null);setAttribute(n,"aria-expanded",!!s);setAttribute(n,"aria-controls",s?i:null)};InputDateTime.prototype.inputDateTimeIsDroppedDownChanged=function(){var e=this.dropDown===this._ddDate?this._btn:this._btnTm;toggleClass(e,InputDateTimeClsNames.showDropDownButton,this.isDroppedDown)};InputDateTime._ctrlTemplate="";return InputDateTime}(InputDate);export{InputDateTime};_addCultureInfo("AutoComplete",{ariaLabels:{autoCompleteInput:"AutoComplete Input",autoComplete:"Auto Complete"}});var AutoComplete=function(e){__extends(AutoComplete,e);function AutoComplete(t,i){var n=e.call(this,t)||this;n._cssMatch=ComboBoxClsNames.stateMatch;n._minLength=2;n._maxItems=6;n._itemCount=0;n._beginsWith=!1;n._delay=Control._SEARCH_DELAY;n._selItems=null;n._query="";n._inCallback=!1;n._srchProps=[];n._oldSelectedIndex=-1;n._inputElementAriaLabel=culture.AutoComplete.ariaLabels.autoCompleteInput;n._isBlurInput=!1;addClass(n.hostElement,AutoCompleteClsNames.hostElement);n._bsCollapse=!1;n.isEditable=!0;n.isRequired=!1;n.listBox.formatItem.addHandler(n._formatListItem,n);n._itemsSourceFnCallbackBnd=n._itemSourceFunctionCallback.bind(n);n.initialize(i);n._updateInputAriaLabel();return n}Object.defineProperty(AutoComplete,"controlTemplate",{get:function(){AutoComplete._ctrlTemplate||(AutoComplete._ctrlTemplate=ComboBox.controlTemplate);return AutoComplete._ctrlTemplate},set:function(e){AutoComplete._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(AutoComplete.prototype,"minLength",{get:function(){return this._minLength},set:function(e){this._minLength=asNumber(e,!1,!0)},enumerable:!0,configurable:!0});Object.defineProperty(AutoComplete.prototype,"beginsWithSearch",{get:function(){return this._beginsWith},set:function(e){this._beginsWith=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(AutoComplete.prototype,"maxItems",{get:function(){return this._maxItems},set:function(e){this._maxItems=asNumber(e,!1,!0)},enumerable:!0,configurable:!0});Object.defineProperty(AutoComplete.prototype,"delay",{get:function(){return this._delay},set:function(e){this._delay=asNumber(e,!1,!0)},enumerable:!0,configurable:!0});Object.defineProperty(AutoComplete.prototype,"searchMemberPath",{get:function(){return this._srchProp},set:function(e){this._srchProp=asString(e);this._srchProps=e?e.trim().split(/\s*,\s*/):[]},enumerable:!0,configurable:!0});Object.defineProperty(AutoComplete.prototype,"itemsSourceFunction",{get:function(){return this._itemsSourceFn},set:function(e){if(this._itemsSourceFn!==e){this._itemsSourceFn=asFunction(e);isFunction(this._itemsSourceFn)&&this.itemsSourceFunction(this.text,this.maxItems,this._itemsSourceFnCallbackBnd)}},enumerable:!0,configurable:!0});Object.defineProperty(AutoComplete.prototype,"cssMatch",{get:function(){return this._cssMatch},set:function(e){this._cssMatch=asString(e)},enumerable:!0,configurable:!0});AutoComplete.prototype.onSelectedIndexChanged=function(t){this._settingText||e.prototype.onSelectedIndexChanged.call(this,t)};AutoComplete.prototype._updateTbxAria=function(){e.prototype._updateTbxAria.call(this);var t=this._tbx;setAttribute(t,"aria-autocomplete","list")};AutoComplete.prototype._keydown=function(t){if(!this._isHiddenEditor()){if(!t.defaultPrevented&&this.isDroppedDown)switch(t.keyCode){case Key.Up:case Key.Down:this.selectAll()}e.prototype._keydown.call(this,t)}};AutoComplete.prototype._input=function(e){this._handleDragTextState();this._updateComponentText();this._updateEmptyValueFlag();this._resetDragState()};AutoComplete.prototype._commitText=function(e){var t=this;if(e&&this._composing&&this.isDroppedDown&&!isFirefox()&&!isSafari()&&""==this._textIsComposing){this._isBlurInput=!0;this.isDroppedDown=!1;setTimeout((function(){t.onLostFocus()}),this.delay+1)}e&&!this._composing&&(isFirefox()||isSafari())&&getActiveElement()==this.inputElement&&this.onLostFocus()};AutoComplete.prototype._setText=function(e){var t=this;if(this._isBlurInput&&0==this.text.length){this._tbx.value=e;this._isBlurInput=!1}this.trimText&&!this.containsFocus()&&"string"==typeof e&&(e=e.trim());if(this._composing&&e!=this._oldText){this._oldText=e;this.onTextChanged()}if(!(this._inCallback||this._settingText||(isFirefox()||isSafari())&&this._composing)){this._toSearch||(this._oldSelectedIndex=this.selectedIndex);if(this.selectedIndex>-1&&this._getDisplayText(void 0,void 0,!0)!=e){this._settingText=!0;this.selectedIndex=-1;this._settingText=!1}this._toSearch&&clearTimeout(this._toSearch);if(e!=this._oldText||e!=this.text){"string"!=typeof e&&(e="");var i=this._tbx,n=this._tbx.selectionStart;i.value!=e&&(i.value=e);this._isWheel&&this.containsFocus()&&this._updateInputSelection(n);this._oldText=e;this.onTextChanged();var o=this.collectionView;if(!e&&o){(this._query||this.selectedIndex<0)&&(this.isDroppedDown=!1);this._query=this._rxHighlight=null;o.filter=null;var s=this.itemsSourceFunction;if(isFunction(s)){this.isDroppedDown=!1;s(this._query,this.maxItems,this._itemsSourceFnCallbackBnd)}if(this.isRequired&&!this.containsFocus()&&!Array.isArray(this._selItems)){var r=this._oldSelectedIndex>-1?this._oldSelectedIndex:0;this.selectedIndex=r}-1==this.selectedIndex&&-1!=this._oldSelectedIndex&&this.onSelectedIndexChanged();return}}if(e!=this._getDisplayText(void 0,void 0,!0)){if(!this.containsFocus()&&this.trimText)if(this.isRequired&&!this.text.trim().length){r=this._oldSelectedIndex>-1?this._oldSelectedIndex:0;this.selectedIndex=r}else this._tbx.value=this._tbx.value.trim();var a=!this.containsFocus()&&e.length<this.minLength;this.collectionView&&!this.containsFocus()&&(this.collectionView.filter=null);var l=this.indexOf(e,!0),h=this.indexOf(e,!1);if(a)return;if(!this.containsFocus()&&(!e||this.trimText&&!this.text.trim().length||null!=this.collectionView&&l<0&&h<0)&&this.isRequired&&!this.isEditable){(r=this._oldSelectedIndex>-1?this._oldSelectedIndex:hasItems(this.collectionView)?0:-1)!=this.selectedIndex&&(this.selectedIndex=r)}else if((Array.isArray(this.itemsSource)||"function"==typeof this.itemsSourceFunction)&&!this.containsFocus()&&e&&l<0&&(h<0||h!=l)&&!this.isRequired&&!this.isEditable){this._tbx.value="";this.selectedIndex=-1;this.onSelectedIndexChanged()}else{var u=this._delay>0?setTimeout:function(e,t){return e()};this._pendingSearchFn=function(){t._toSearch=null;var i=t.text;if(!t._composing&&i.trim().length>=t._minLength&&i!=t._query){t._query=i.trim();i=escapeRegExp(i);var n=escapeHtml(i.trim()),o=t.caseSensitiveSearch?"":"i";t._beginsWith||(o+="g");t._rxSrch=t._beginsWith?new RegExp("^"+i+".*",o):new RegExp("(?=.*"+i.replace(/ /g,")(?=.*")+")",o);t._rxHighlight=t._beginsWith?new RegExp("^"+i,o):new RegExp("("+n.replace(/\s+/g,"|")+")",o);var s=t.itemsSourceFunction;isFunction(s)?s(t._query,t.maxItems,t._itemsSourceFnCallbackBnd):t._updateItems()}!e.trim().length&&!t.isEditable&&t.indexOf(e,!0)<0&&(t.selectedIndex=-1);-1==t.selectedIndex&&-1!=t._oldSelectedIndex&&t.onSelectedIndexChanged()};this._toSearch=u(this._pendingSearchFn,this._delay)}}else""===this._tbx.value&&e&&(this._tbx.value=e)}};AutoComplete.prototype.onLostFocus=function(t){var i=!1;if(this.isRequired&&!this.isEditable&&this.text&&this.text.length>=this.minLength){i=!0;var n=this.indexOf(this.text,!0);n<0&&(n=this.indexOf(this.text,!1));n>-1&&(this._oldSelectedIndex=n);n<0&&(this._oldSelectedIndex=0)}if(this._toSearch){clearTimeout(this._toSearch);this.text!==this._getDisplayText(void 0,void 0,!0)&&this._pendingSearchFn&&this._pendingSearchFn();i=!1}var o=this.collectionView;if(o&&0===o.items.length){this._oldFilter=o.filter;o.filter=null}e.prototype.onLostFocus.call(this,t,this._oldSelectedIndex,i)};AutoComplete.prototype.onGotFocus=function(t){this._toSearch||(this._oldSelectedIndex=this.selectedIndex);e.prototype.onGotFocus.call(this,t)};AutoComplete.prototype.reset=function(){this._oldSelectedIndex=-1};AutoComplete.prototype._itemSourceFunctionCallback=function(e){this._inCallback=!0;var t=asCollectionView(e||[]);t.moveCurrentToPosition(-1);this.itemsSource=t;this._inCallback=!1;if(this.containsFocus()){var i=this._tbx,n=i.selectionStart,o=i.selectionEnd,s=this.collectionView;this.isDroppedDown=null!=s&&s.items.length>0;setSelectionRange(i,n,o);this.refresh()}};AutoComplete.prototype.onIsDroppedDownChanged=function(t){e.prototype.onIsDroppedDownChanged.call(this,t);if(this.containsFocus()&&!this.isTouching){var i=this.collectionView;if(this.selectedIndex<0&&i){var n=i.items,o=this.text;1==n.length&&n[0]==o?this.selectedIndex=0:setSelectionRange(this._tbx,o.length)}}this._query=""};AutoComplete.prototype._updateItems=function(){var e=this.collectionView;if(e){this._inCallback=!0;e.beginUpdate();this._itemCount=0;e.filter=this._filter.bind(this);e.moveCurrentToPosition(-1);e.endUpdate();this._inCallback=!1;var t=e.items.length,i=this._tbx,n=i.selectionStart,o=i.selectionEnd;this.text.trim()||(t=0);this.isDroppedDown=t>0&&this.containsFocus();t||this.isEditable||(this.selectedIndex=-1);if(1==t&&this.selectedIndex<0){var s=this._getItemText(e.items[0],!1),r=i.value;if(!this.caseSensitiveSearch){s=s.toLowerCase();r=r.toLowerCase()}(s==r||this.trimText&&s.trim()==r)&&(this.selectedIndex=0)}this.isDroppedDown&&setSelectionRange(i,n,o);this.refresh()}};AutoComplete.prototype._filter=function(e){if(this._itemCount>=this._maxItems&&this._query)return!1;var t=[this._getItemText(e,!1)];this._srchProps&&this._srchProps.forEach((function(i){var n=e[i];null!=n&&t.push(n)}));this.isContentHtml&&(t=t.map((function(e){return e.replace(/(<[^>]*>|&[^;]*;)/g,"")})));for(var i=0;i<t.length;i++)if(this._rxSrch.test(t[i])){this._itemCount++;return!0}return!1};AutoComplete.prototype._getItemText=function(e,t){var i=e?e.toString():"",n=t&&this.headerPath?this._pathHdr:this._lbx._pathDisplay;n&&(i=null!=(i=n.getValue(e))?i.toString():"");return i};AutoComplete.prototype._formatListItem=function(e,t){var i=this;this._cssMatch&&this._rxHighlight&&this._query&&(t.item.innerHTML=t.item.innerHTML.replace(this._rxHighlight,(function(e,t,n,o){return i._enclosed(o,n,"<",">")||i._enclosed(o,n,"&",";")?e:'<spanclass="'+i._cssMatch+'">'+e+"</span>"})))};AutoComplete.prototype._enclosed=function(e,t,i,n){for(var o=t;o>=0&&e[o]!=n;o--)if(e[o]==i)for(var s=t;s<e.length&&e[s]!=i;s++)if(e[s]==n)return!0;return!1};AutoComplete.prototype._wheel=function(t){e.prototype._wheel.call(this,t)};AutoComplete.prototype.getAriaLabelForScreenReader=function(){return culture.AutoComplete.ariaLabels.autoComplete};AutoComplete.prototype._hasCustomFormatItem=function(){return this.formatItem.getHandler.length>1};AutoComplete._ctrlTemplate="";return AutoComplete}(ComboBox);export{AutoComplete};_addCultureInfo("MultiAutoComplete",{ariaLabels:{multiAutoCompleteInput:"MultiAutoComplete Input",multiAutoComplete:"MultiAutoComplete",multiAutoCompleteHelperInput:"MultiAutoComplete Helper Input",remove:"Remove"}});var MultiAutoComplete=function(e){__extends(MultiAutoComplete,e);function MultiAutoComplete(t,i){var n=e.call(this,t)||this;n._maxSelItems=null;n._lastInputValue="";n._selPath=new Binding(null);n._notAddItm=!1;n._inputElementAriaLabel=culture.MultiAutoComplete.ariaLabels.multiAutoCompleteInput;n._helperInputElementAriaLabel=culture.MultiAutoComplete.ariaLabels.multiAutoCompleteHelperInput;n._ariaLabelledby=null;n.selectedItemsChanged=new Event;addClass(n.hostElement,MultiAutoCompleteClsNames.hostElement);n._wjTpl=n.hostElement.querySelector("."+ControlClsNames.template);n._wjInput=n.hostElement.querySelector("."+InputClsNames.input);n.showDropDownButton=!1;n._selItems=[];n.initialize(i);n.addEventListener(n.hostElement,"keyup",n._keyup.bind(n),!0);n.addEventListener(window,"resize",n._adjustInputWidth.bind(n));n.addEventListener(n._tbx,"focus",(function(){n._itemOff()}));n._addHelperInput();n._addScreenReaderHelper();n._initSeltems();n.listBox.itemsChanged.addHandler((function(){if(-1!==n.selectedIndex){var e=n.collectionView;(e&&("CollectionView"==e.constructor.name||"ODataVirtualCollectionView"==e.constructor.name)||e.virtualization)&&(n.selectedIndex=-1)}}));n._refreshHeader();n._updateTabIndex();n._updateInputAriaLabel();return n}Object.defineProperty(MultiAutoComplete,"controlTemplate",{get:function(){MultiAutoComplete._ctrlTemplate||(MultiAutoComplete._ctrlTemplate=AutoComplete.controlTemplate);return MultiAutoComplete._ctrlTemplate},set:function(e){MultiAutoComplete._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(MultiAutoComplete.prototype,"showDropDownButton",{set:function(e){this._showBtn=!1},enumerable:!0,configurable:!0});Object.defineProperty(MultiAutoComplete.prototype,"maxSelectedItems",{get:function(){return this._maxSelItems},set:function(e){if(this._maxSelItems!=e){this._maxSelItems=asNumber(e,!0);this._updateMaxItems();this._refreshHeader();this._clearSelIndex()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiAutoComplete.prototype,"selectedMemberPath",{get:function(){return this._selPath.path},set:function(e){if((e=asString(e))!==this.selectedMemberPath){this._selPath.path=e;this._initSeltems();this._refreshHeader();this.onSelectedItemsChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiAutoComplete.prototype,"selectedItems",{get:function(){return this._selItems},set:function(e){e=Array.from(new Set(e));var t=this._selItems===e;t||null==this._selItems||null==e||this._selItems.length!==e.length||(t=this._selItems.every((function(t,i){return t===e[i]})));this._selItems=asArray(e);if(!t){if(this.selectedMemberPath&&""!==this.selectedMemberPath&&this._selItems)for(var i=0;i<this._selItems.length;i++){var n=this._selItems[i];this._setSelItem(n,!1)}this._updateMaxItems();this.onSelectedItemsChanged();this._refreshHeader();this._clearSelIndex()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiAutoComplete.prototype,"ariaLabelledBy",{get:function(){return this._ariaLabelledby},set:function(e){_setAriaLabelBy(this,this._tbx,e,this._updateInputAndListBoxAriaLabel.bind(this))},enumerable:!0,configurable:!0});MultiAutoComplete.prototype.onSelectedItemsChanged=function(e){this.selectedItemsChanged.raise(this,e)};MultiAutoComplete.prototype.onIsDroppedDownChanged=function(t){!this.isDroppedDown&&this.selectedIndex>-1&&!this._notAddItm&&this._addItem(!0);this._notAddItm=!1;e.prototype.onIsDroppedDownChanged.call(this,t)};MultiAutoComplete.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);if(this.hostElement){this._initSeltems();this.isDroppedDown||this._refreshHeader()}};MultiAutoComplete.prototype._keydown=function(t){if(!this.isReadOnly){if(!t.defaultPrevented)switch(t.keyCode){case Key.Back:this._lastInputValue=this._tbx.value;break;case Key.Enter:this._itemOff();this._addItem(!0);isIE()&&setSelectionRange(this._tbx,this._tbx.textContent.length,this._tbx.textContent.length);break;case Key.Tab:if(this.isDroppedDown){this._addItem(!1);this._tbx.value="";this._lbx.selectedIndex=-1;this.isDroppedDown=!1;this.containsFocus()||this.focus();t.preventDefault()}else this._updateFocus();break;case Key.Space:if(""!==this._tbx.value)return;if(!this.isDroppedDown&&!this._tbx.disabled){this.isDroppedDown=!0;this._clearSelIndex()}break;case Key.Escape:this.isDroppedDown&&(this._notAddItm=!0);break;case Key.Left:this._itemOn(!this.rightToLeft);break;case Key.Right:this._itemOn(!!this.rightToLeft);break;case Key.Up:case Key.Down:var i=getActiveElement();if(t.altKey){if(this._tbx==i){this.isDroppedDown=!this.isDroppedDown;this.isDroppedDown||this._tbx.focus();t.preventDefault();return}}else if(this._tbx!==i)return;default:if(t.keyCode===Key.Back||t.keyCode===Key.Delete)return;this._itemOff();null!=this._maxSelItems&&this._selItems.length>=this._maxSelItems&&t.preventDefault()}this._tbx.disabled||e.prototype._keydown.call(this,t)}};MultiAutoComplete.prototype._updateState=function(){e.prototype._updateState.call(this);this._wjTpl&&(hasClass(this.hostElement,ControlStateClsNames.focused)||this._itemOff())};MultiAutoComplete.prototype._keyup=function(e){if(!this.isReadOnly&&!e.defaultPrevented)switch(e.keyCode){case Key.Back:0===this._tbx.value.length&&0===this._lastInputValue.length&&this._delItem(!1);break;case Key.Delete:this._delItem(!0)}};MultiAutoComplete.prototype._addHelperInput=function(){var e=document.createElement("input");e.type="text";e.tabIndex=-1;e.className=MultiAutoCompleteClsNames.tokenHelper;e.readOnly=!0;setAttribute(e,"aria-label",this._helperInputElementAriaLabel);setAttribute(e,"role","textbox");this._wjTpl.insertBefore(e,this._wjInput);this._helperInput=e};MultiAutoComplete.prototype._addScreenReaderHelper=function(){var e=document.createElement("div");e.tabIndex=-1;e.className=MultiAutoCompleteClsNames.screenReaderOnly;setAttribute(e,"aria-live","polite");this._wjTpl.insertBefore(e,this._wjInput);this._screenReaderHelper=e};MultiAutoComplete.prototype._refreshHeader=function(){for(var e=this.hostElement.querySelectorAll("."+MultiAutoCompleteClsNames.token),t=0;t<e.length;t++)this._wjTpl.removeChild(e[t]);var i=this.selectedItems;if(i&&0!==i.length){for(t=0;t<i.length;t++)this._insertToken(i[t]);this._wjInput.style.cssFloat=this.rightToLeft?"right":"left";this._adjustInputWidth()}else{this._wjInput.style.cssFloat=this.rightToLeft?"right":"left";this._adjustInputWidth()}};MultiAutoComplete.prototype._insertToken=function(e){var t=this._getItemText(e,!0);this.isContentHtml||(t=escapeHtml(t));this._wjTpl.insertBefore(this._createItem(t),this._wjInput)};MultiAutoComplete.prototype._updateMaxItems=function(){null!=this._maxSelItems&&this._selItems&&this._selItems.length>this._maxSelItems&&(this._selItems=this._selItems.slice(0,this._maxSelItems))};MultiAutoComplete.prototype._updateFocus=function(){var e=this,t=this._wjTpl.querySelector("."+MultiAutoComplete._clsActive);if(t){removeClass(t,MultiAutoComplete._clsActive);setTimeout((function(){e._tbx.focus()}))}else this._clearSelIndex()};MultiAutoComplete.prototype._addItem=function(e){if(this.selectedItems.indexOf(this.selectedItem)>-1)this._clearSelIndex();else if(this.selectedIndex>-1){this._updateSelItems(this.selectedItem,!0);this._refreshHeader();e&&this._clearSelIndex();this._disableInput(!0)}};MultiAutoComplete.prototype._delItem=function(e){var t,i,n=this._wjTpl.querySelector("."+MultiAutoComplete._clsActive),o=!1;if(!e||n){if(n){if((i=this._getItemIndex(n))>-1){t=this._selItems[i];o=!0}}else if(this._selItems.length>0){t=this._selItems[this._selItems.length-1];o=!0}var s=this._getItemText(t,!0),r=culture.MultiAutoComplete.ariaLabels.remove;this._screenReaderHelper.textContent=r+" "+s;if(o){this._updateSelItems(t,!1);this._refreshHeader();this._clearSelIndex();this._disableInput(!1)}this._tbx.focus()}};MultiAutoComplete.prototype._updateSelItems=function(e,t){if(t){this._selItems&&0!==this._selItems.length||(this._selItems=[]);if(null!=this._maxSelItems&&this._selItems.length>=this._maxSelItems)return;this._selItems.push(e)}else{var i=this._selItems.indexOf(e);this._selItems.splice(i,1)}this._hasSelectedMemeberPath()&&this._setSelItem(e,t);this.onSelectedItemsChanged()};MultiAutoComplete.prototype._createItem=function(e){var t=this,i=document.createElement("div"),n=document.createElement("span"),o=document.createElement("span");i.appendChild(n);i.appendChild(o);i.id=getSafeUniqueId(e);setAttribute(i,"aria-label",e);setAttribute(i,"role","button");i.className=MultiAutoCompleteClsNames.token;n.className=MultiAutoCompleteClsNames.tokenLabel;n.innerHTML=e;o.className=MultiAutoCompleteClsNames.tokenClose;o.tabIndex=-1;o.innerHTML="×";i.style.cssFloat=this.rightToLeft?"right":"left";this.addEventListener(i,"click",(function(e){t._helperInput.focus();setAttribute(t._helperInput,"aria-activedescendant",i.id);var n=t._wjTpl.querySelector("."+MultiAutoComplete._clsActive);n&&removeClass(n,MultiAutoComplete._clsActive);addClass(i,MultiAutoComplete._clsActive);e.stopPropagation();e.preventDefault()}));this.addEventListener(o,"click",(function(e){if(!t.isReadOnly){var n=t._getItemIndex(i);if(n>-1){var o=t._selItems[n];t._updateSelItems(o,!1)}t._wjTpl.removeChild(i);t._adjustInputWidth();t._disableInput(!1);t._tbx.focus();e.stopPropagation()}}));return i};MultiAutoComplete.prototype._itemOn=function(e){var t,i,n,o=getActiveElement();if((this._tbx!=o||0===this._tbx.value.length)&&0!==(t=this._wjTpl.querySelectorAll("."+MultiAutoCompleteClsNames.token)).length){i=this._wjTpl.querySelector("."+MultiAutoComplete._clsActive);n=this._getItemIndex(i);if(e){if(0===n)return;if(-1===n){addClass(t[t.length-1],MultiAutoComplete._clsActive);this._helperInput.focus();setAttribute(this._helperInput,"aria-activedescendant",t[t.length-1].id)}else{removeClass(i,MultiAutoComplete._clsActive);addClass(t[n-1],MultiAutoComplete._clsActive);this._helperInput.focus();setAttribute(this._helperInput,"aria-activedescendant",t[n-1].id)}}else if(!e){if(-1===n)return;if(n!==t.length-1){removeClass(i,MultiAutoComplete._clsActive);addClass(t[n+1],MultiAutoComplete._clsActive);this._helperInput.focus();setAttribute(this._helperInput,"aria-activedescendant",t[n+1].id)}else{removeClass(i,MultiAutoComplete._clsActive);this._tbx.focus();setAttribute(this._helperInput,"aria-activedescendant")}}}};MultiAutoComplete.prototype._itemOff=function(){var e=this._wjTpl.querySelector("."+MultiAutoComplete._clsActive);e&&removeClass(e,MultiAutoComplete._clsActive)};MultiAutoComplete.prototype._initSeltems=function(){if(this.selectedMemberPath){this._selItems.splice(0,this._selItems.length);var e=this.collectionView;if(e)for(var t=0;t<e.sourceCollection.length;t++)this._getSelItem(t)&&this._selItems.push(e.sourceCollection[t])}};MultiAutoComplete.prototype._getSelItem=function(e){var t=this.collectionView,i=t?t.sourceCollection[e]:null;return!(!isObject(i)||!this.selectedMemberPath)&&this._selPath.getValue(i)};MultiAutoComplete.prototype._setSelItem=function(e,t){this.itemsSource;isObject(e)&&this._selPath.getValue(e)!=t&&this._selPath.setValue(e,t)};MultiAutoComplete.prototype._clearSelIndex=function(){this.selectedIndex=-1};MultiAutoComplete.prototype._hasSelectedMemeberPath=function(){return this.selectedMemberPath&&""!==this.selectedMemberPath};MultiAutoComplete.prototype._disableInput=function(e){if(null!=this._maxSelItems)if(this._selItems.length<this._maxSelItems){this._tbx.disabled=!1;this._tbx.focus()}else{this._tbx.disabled=!0;this.hostElement.focus()}};MultiAutoComplete.prototype._adjustInputWidth=function(){this._tbx.style.width="60px";var e,t=getElementRect(this.hostElement),i=getElementRect(this._tbx),n=getComputedStyle(this._tbx),o=parseInt(n.paddingLeft,10),s=parseInt(n.paddingRight,10);e=this.rightToLeft?i.left+i.width-t.left-o-s-8:t.left+t.width-i.left-o-s-8;this._tbx.style.width=e+"px";this._tbx.placeholder?this._tbx.style.minWidth="max-content":this._tbx.style.minWidth=""};MultiAutoComplete.prototype._getItemIndex=function(e){for(var t=this.hostElement.querySelectorAll("."+MultiAutoCompleteClsNames.token),i=0;i<t.length;i++)if(e===t[i])return i;return-1};MultiAutoComplete.prototype._setIsDisabled=function(t){e.prototype._setIsDisabled.call(this,t);this._updateTabIndex()};MultiAutoComplete.prototype._setTabOrder=function(e){this._orgTabIndex=e;this._updateTabIndex()};MultiAutoComplete.prototype._updateTabIndex=function(){var e=this.hostElement;this._tbx.tabIndex=this.isDisabled?-1:this._orgTabIndex;e.tabIndex=-1};MultiAutoComplete._clsActive=MultiAutoCompleteClsNames.tokenActive;MultiAutoComplete._ctrlTemplate="";return MultiAutoComplete}(AutoComplete);export{MultiAutoComplete};_registerModule("wijmo.input",selfModule);
|