/*
    *
    * Wijmo Library 5.20182.500
    * http://wijmo.com/
    *
    * Copyright(c) GrapeCity, Inc.  All rights reserved.
    *
    * Licensed under the GrapeCity Commercial License.
    * sales@wijmo.com
    * wijmo.com/products/wijmo-5/license/
    *
    */
var __extends=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define(["require","exports","wijmo/wijmo","wijmo/wijmo.input"],function(t,e,i,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=n||e;window.wijmo=window.wijmo||{},window.wijmo.input=s,i._addCultureInfo("DropDown",{ariaLabels:{tgl:"Toggle Dropdown"}});var o=function(t){function e(e,n){var s=t.call(this,e,null,!0)||this;s._showBtn=!0,s._autoExpand=!0,s._animate=!1,s.textChanged=new i.Event,s.isDroppedDownChanging=new i.Event,s.isDroppedDownChanged=new i.Event;var o=s.getTemplate();s.applyTemplate("wj-control wj-content wj-dropdown",o,{_tbx:"input",_btn:"btn",_dropDown:"dropdown"},"input");var r=i.culture.DropDown.ariaLabels;i.setAriaLabel(s._btn.querySelector("button"),r.tgl);var a=s._tbx;s._elRef=a,i.disableAutoComplete(a),s._createDropDown(),s._updateBtn(),i.removeChild(s._dropDown),i.addClass(s.hostElement,"wj-state-collapsed");var l=s._updateFocusState.bind(s);s.addEventListener(s.dropDown,"blur",l,!0),s.addEventListener(s.dropDown,"focus",l);var h=s._keydown.bind(s);return s.addEventListener(s.hostElement,"keydown",h),s.addEventListener(s.dropDown,"keydown",h),s.addEventListener(a,"keypress",function(t){9787==t.keyCode&&s._altDown&&t.preventDefault()}),s.addEventListener(a,"input",function(){s._setText(s.text,!1)}),s.addEventListener(a,"click",function(){s._autoExpand&&s._expandSelection()}),i.isIE9()&&s.addEventListener(a,"keyup",function(){s._setText(s.text,!1)}),s.addEventListener(s._btn,"mousedown",function(t){t.defaultPrevented||0!=t.button||setTimeout(function(){s._btnclick(t)})}),s.addEventListener(s._dropDown,"click",function(t){t.stopPropagation()}),s}return __extends(e,t),Object.defineProperty(e.prototype,"text",{get:function(){return this._tbx.value},set:function(t){t!=this.text&&this._setText(t,!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"inputElement",{get:function(){return this._tbx},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isReadOnly",{get:function(){return this._tbx.readOnly},set:function(t){this._tbx.readOnly=i.asBoolean(t),i.toggleClass(this.hostElement,"wj-state-readonly",this.isReadOnly)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isRequired",{get:function(){return this._tbx.required},set:function(t){this._tbx.required=i.asBoolean(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"placeholder",{get:function(){return this._tbx.placeholder},set:function(t){this._tbx.placeholder=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isDroppedDown",{get:function(){var t=this._dropDown;return t&&"none"!=t.style.display},set:function(t){var e=this;if((t=i.asBoolean(t)&&!this.isDisabled&&!this.isReadOnly)!=this.isDroppedDown&&this.onIsDroppedDownChanging(new i.CancelEventArgs)){var n=this.hostElement,s=this._dropDown,o=s.style;if(t)o.minWidth||(o.minWidth=n.getBoundingClientRect().width+"px"),o.display="block",this._updateDropDown(),this.addEventListener(document.body,"touchstart",function(t){i.contains(n,t.target)||i.contains(s,t.target)||(e.isDroppedDown=!1)});else{this.removeEventListener(document.body,"touchstart");var r=this.containsFocus();i.hidePopup(s),r&&(this.isTouching&&this.showDropDownButton?this.hostElement.focus():this.selectAll())}this._updateFocusState(),i.toggleClass(n,"wj-state-collapsed",!this.isDroppedDown),this.onIsDroppedDownChanged()}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dropDown",{get:function(){return this._dropDown},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dropDownCssClass",{get:function(){return this._cssClass},set:function(t){t!=this._cssClass&&(i.removeClass(this._dropDown,this._cssClass),this._cssClass=i.asString(t),i.addClass(this._dropDown,this._cssClass))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"showDropDownButton",{get:function(){return this._showBtn},set:function(t){this._showBtn=i.asBoolean(t),this._updateBtn()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"autoExpandSelection",{get:function(){return this._autoExpand},set:function(t){this._autoExpand=i.asBoolean(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isAnimated",{get:function(){return this._animate},set:function(t){this._animate=i.asBoolean(t)},enumerable:!0,configurable:!0}),e.prototype.selectAll=function(){this._elRef==this._tbx&&i.setSelectionRange(this._tbx,0,this.text.length),this.containsFocus()||this.focus()},e.prototype.onTextChanged=function(t){this.textChanged.raise(this,t),this._updateState()},e.prototype.onIsDroppedDownChanging=function(t){return this.isDroppedDownChanging.raise(this,t),!t.cancel},e.prototype.onIsDroppedDownChanged=function(t){this.isDroppedDownChanged.raise(this,t)},e.prototype.onGotFocus=function(e){this.isTouching||i.contains(this._dropDown,i.getActiveElement())||this.selectAll(),t.prototype.onGotFocus.call(this,e)},e.prototype.onLostFocus=function(e){this._commitText(),this.containsFocus()||(this.isDroppedDown=!1),t.prototype.onLostFocus.call(this,e)},e.prototype.containsFocus=function(){return t.prototype.containsFocus.call(this)||this.isDroppedDown&&i.contains(this._dropDown,i.getActiveElement())},e.prototype.dispose=function(){this.isDroppedDown=!1;var e=this.dropDown;if(e){var n=i.Control.getControl(e);n&&n.dispose(),i.removeChild(e)}t.prototype.dispose.call(this)},e.prototype.refresh=function(e){if(void 0===e&&(e=!0),t.prototype.refresh.call(this,e),this.isDroppedDown&&"none"!=getComputedStyle(this.hostElement).display){var n=i.getActiveElement();i.showPopup(this._dropDown,this.hostElement,!1,!1,null==this.dropDownCssClass),n instanceof HTMLElement&&n!=i.getActiveElement()&&n.focus()}},e.prototype._handleResize=function(){this.isDroppedDown&&this.refresh()},e.prototype._expandSelection=function(){var t=this._tbx,e=t.value,n=t.selectionStart,s=t.selectionEnd;if(e&&n==s){var o=this._getCharType(e,n);if(o>-1){for(;s<e.length&&this._getCharType(e,s)==o;s++);for(;n>0&&this._getCharType(e,n-1)==o;n--);n!=s&&i.setSelectionRange(t,n,s)}}},e.prototype._getCharType=function(t,e){var i=t[e];return i>="0"&&i<="9"?0:i>="a"&&i<="z"||i>="A"&&i<="Z"?1:-1},e.prototype._keydown=function(t){if(this._altDown=t.altKey,!t.defaultPrevented)switch(t.keyCode){case i.Key.Tab:case i.Key.Escape:case i.Key.Enter:this.isDroppedDown&&(this.isDroppedDown=!1,t.keyCode==i.Key.Tab||this.containsFocus()||this.focus(),t.preventDefault());break;case i.Key.F4:case i.Key.Up:case i.Key.Down:if((t.keyCode==i.Key.F4||t.altKey)&&i.contains(document.body,this.hostElement)){var e=this.isDroppedDown;this.isDroppedDown=!e,this.isDroppedDown==!e&&t.preventDefault()}}},e.prototype._btnclick=function(t){t.defaultPrevented||0!=t.button||(this.isDroppedDown=!this.isDroppedDown)},e.prototype._setText=function(t,e){null==t&&(t=""),(t=t.toString())!=this._tbx.value&&(this._tbx.value=t),t!=this._oldText&&(this._oldText=t,this.onTextChanged())},e.prototype._updateBtn=function(){this._btn.style.display=this._showBtn?"":"none"},e.prototype._createDropDown=function(){},e.prototype._commitText=function(){},e.prototype._updateDropDown=function(){this.isDroppedDown&&(this._commitText(),i.showPopup(this._dropDown,this.hostElement,!1,this._animate,null==this.dropDownCssClass))},e.controlTemplate='<div class="wj-template" style="position:relative"><div class="wj-input"><div class="wj-input-group wj-input-btn-visible"><input wj-part="input" type="text" class="wj-form-control"/><span wj-part="btn" class="wj-input-group-btn"><button class="wj-btn wj-btn-default" tabindex="-1"><span class="wj-glyph-down"></span></button></span></div></div><div wj-part="dropdown" class="wj-content wj-dropdown-panel" style="display:none"></div></div>',e}(i.Control);e.DropDown=o,i._addCultureInfo("Calendar",{ariaLabels:{calendar:"Calendar",monthView:"Month View",yearView:"Year View",prvMo:"Previous Month",today:"Today",nxtMo:"Next Month",prvYr:"Previous Year",currMo:"Current Month",nxtYr:"Next Year"}});var r;!function(t){t[t.None=0]="None",t[t.Day=1]="Day",t[t.Month=2]="Month"}(r=e.DateSelectionMode||(e.DateSelectionMode={}));var a=function(t){function e(e,n){var s=t.call(this,e)||this;s._readOnly=!1,s._selMode=r.Day,s._fmtYrMo="y",s._fmtYr="yyyy",s._fmtDayHdr="ddd",s._fmtDay="d ",s._fmtMonths="MMM",s.valueChanged=new i.Event,s.displayMonthChanged=new i.Event,s.formatItem=new i.Event;var o=s.hostElement;return o.tabIndex=-1,s._value=i.DateTime.newDate(),s._currMonth=s._getMonth(s._value),s._createChildren(),s.addEventListener(o,"mouseup",s._click.bind(s)),s.addEventListener(o,"keydown",s._keydown.bind(s)),s.initialize(n),s.refresh(!0),s}return __extends(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this._value},set:function(t){t=i.asDate(t,!0),t=this._clamp(t),(this._valid(t)||null==t)&&(this.displayMonth=this._getMonth(t),i.DateTime.equals(this._value,t)||(this._value=t,this.invalidate(!1),this.onValueChanged()))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"min",{get:function(){return this._min},set:function(t){t!=this.min&&(this._min=i.asDate(t,!0),this.refresh())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"max",{get:function(){return this._max},set:function(t){t!=this.max&&(this._max=i.asDate(t,!0),this.refresh())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selectionMode",{get:function(){return this._selMode},set:function(t){if((t=i.asEnum(t,r))!=this._selMode){this._selMode=t;var e=this._monthMode();e&&(this.monthView=!1);var n=this._btnMth.querySelector(".wj-glyph-down");n&&(n.style.display=e?"none":""),this.refresh()}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isReadOnly",{get:function(){return this._readOnly},set:function(t){this._readOnly=i.asBoolean(t),i.toggleClass(this.hostElement,"wj-state-readonly",this.isReadOnly)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"firstDayOfWeek",{get:function(){return this._fdw},set:function(t){if(t!=this._fdw){if((t=i.asNumber(t,!0))&&(t>6||t<0))throw"firstDayOfWeek must be between 0 and 6 (Sunday to Saturday).";this._fdw=t,this.refresh()}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"displayMonth",{get:function(){return this._currMonth},set:function(t){i.DateTime.equals(this.displayMonth,t)||(t=i.asDate(t),(this.monthView?this._monthInValidRange(t):this._yearInValidRange(t))&&(this._currMonth=this._getMonth(this._clamp(t)),this.invalidate(!0),this.onDisplayMonthChanged()))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"formatYearMonth",{get:function(){return this._fmtYrMo},set:function(t){t!=this._fmtYrMo&&(this._fmtYrMo=i.asString(t),this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"formatDayHeaders",{get:function(){return this._fmtDayHdr},set:function(t){t!=this._fmtDayHdr&&(this._fmtDayHdr=i.asString(t),this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"formatDays",{get:function(){return this._fmtDay},set:function(t){t!=this._fmtDay&&(this._fmtDay=i.asString(t),this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"formatYear",{get:function(){return this._fmtYr},set:function(t){t!=this._fmtYr&&(this._fmtYr=i.asString(t),this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"formatMonths",{get:function(){return this._fmtMonths},set:function(t){t!=this._fmtMonths&&(this._fmtMonths=i.asString(t),this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"showHeader",{get:function(){return"none"!=this._tbHdr.style.display},set:function(t){this._tbHdr.style.display=i.asBoolean(t)?"":"none"},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"monthView",{get:function(){return"none"!=this._tbMth.style.display},set:function(t){if(t!=this.monthView){this._tbMth.style.display=t?"":"none",this._tbYr.style.display=t?"none":"",this.refresh();var e=i.culture.Calendar.ariaLabels;i.setAriaLabel(this._btnPrv,t?e.prvMo:e.prvYr),i.setAriaLabel(this._btnTdy,t?e.today:e.currMo),i.setAriaLabel(this._btnNxt,t?e.nxtMo:e.nxtYr),i.setAriaLabel(this._btnMth,t?e.monthView:e.yearView)}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"itemFormatter",{get:function(){return this._itemFormatter},set:function(t){t!=this._itemFormatter&&(this._itemFormatter=i.asFunction(t),this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"itemValidator",{get:function(){return this._itemValidator},set:function(t){t!=this._itemValidator&&(this._itemValidator=i.asFunction(t),this.invalidate())},enumerable:!0,configurable:!0}),e.prototype.onValueChanged=function(t){this.valueChanged.raise(this,t)},e.prototype.onDisplayMonthChanged=function(t){this.displayMonthChanged.raise(this,t)},e.prototype.onFormatItem=function(t){this.formatItem.raise(this,t)},e.prototype.refresh=function(e){void 0===e&&(e=!0);var n,s,o,r=this.displayMonth,a=null!=this.firstDayOfWeek?this.firstDayOfWeek:i.Globalize.getFirstDayOfWeek(),l=this.hostElement,h=i.getActiveElement(),u=i.contains(l,h)?h:null;t.prototype.refresh.call(this,e),this._firstDay=i.DateTime.addDays(r,-(r.getDay()-a+7)%7),i.setText(this._spMth,i.Globalize.format(r,this._fmtYrMo)),n=this._tbMth.querySelectorAll("td");for(b=0;b<7&&b<n.length;b++)o=i.DateTime.addDays(this._firstDay,b),i.setText(n[b],i.Globalize.format(o,this._fmtDayHdr));for(b=7;b<n.length;b++){s=n[b],o=i.DateTime.addDays(this._firstDay,b-7),i.setText(s,i.Globalize.format(o,this._fmtDay));var d=!this._valid(o),p=this._selMode&&i.DateTime.sameDate(o,this.value),f=o.getDay();if(i.toggleClass(s,"wj-state-invalid",d),i.toggleClass(s,"wj-state-selected",p),i.toggleClass(s,"wj-day-weekend",0==f||6==f),i.toggleClass(s,"wj-day-today",i.DateTime.sameDate(o,i.DateTime.newDate())),i.toggleClass(s,"wj-day-othermonth",d||o.getMonth()!=r.getMonth()||!this._inValidRange(o)),i.setAttribute(s,"aria-selected",p),s.tabIndex=-1,this.itemFormatter&&this.itemFormatter(o,s),this.formatItem.hasHandlers){var m=new c(b,o,s);this.onFormatItem(m)}}var _=this._tbMth.querySelectorAll("tr");_.length&&(o=i.DateTime.addDays(this._firstDay,28),_[_.length-2].style.display=o.getMonth()==r.getMonth()?"":"none",o=i.DateTime.addDays(this._firstDay,35),_[_.length-1].style.display=o.getMonth()==r.getMonth()?"":"none"),(n=this._tbYr.querySelectorAll("td")).length&&i.setText(n[0],i.Globalize.format(r,this._fmtYr));for(var b=1;b<n.length;b++){o=i.DateTime.newDate(r.getFullYear(),b-1,1);var d=!this._monthInValidRange(o),p=this._sameMonth(o,this.value);s=n[b],i.setText(s,i.Globalize.format(o,this._fmtMonths)),i.toggleClass(s,"wj-state-disabled",d),i.toggleClass(s,"wj-state-selected",p),i.setAttribute(s,"aria-selected",p),s.tabIndex=-1}var g=(this.monthView?this._tbMth:this._tbYr).querySelector("td.wj-state-selected")||l;g.tabIndex=this._orgTabIndex,u&&u!=g&&(g.focus(),u.tabIndex=-1)},e.prototype._canChangeValue=function(){return!this._readOnly&&this._selMode!=r.None},e.prototype._valid=function(t){return!!i.isDate(t)&&(!!i.DateTime.sameDate(t,this._clamp(t))&&(!i.isFunction(this.itemValidator)||this.itemValidator(t)))},e.prototype._inValidRange=function(t){return!(this.min&&t<i.DateTime.fromDateTime(this.min,t))&&!(this.max&&t>i.DateTime.fromDateTime(this.max,t))},e.prototype._monthInValidRange=function(t){if(this.min||this.max){var e=t.getFullYear(),n=t.getMonth(),s=i.DateTime.newDate(e,n,1),o=i.DateTime.newDate(e,n+1,0);if(this.min&&this.min>o)return!1;if(this.max&&this.max<s)return!1}return!0},e.prototype._yearInValidRange=function(t){if(this.min||this.max){var e=t.getFullYear(),n=i.DateTime.newDate(e,0),s=i.DateTime.newDate(e,11,31);if(this.min&&this.min>s)return!1;if(this.max&&this.max<n)return!1}return!0},e.prototype._sameMonth=function(t,e){return i.isDate(t)&&i.isDate(e)&&t.getMonth()==e.getMonth()&&t.getFullYear()==e.getFullYear()},e.prototype._getValidDate=function(t,e){if(i.isDate(t))for(var n=t.getFullYear(),s=t.getMonth()+(e?0:1),o=e?1:0,r=i.DateTime.newDate(n,s,o),a=e?1:-1,l=0;l<31;l++){if(this._valid(r))return r;r=i.DateTime.addDays(r,a)}return null},e.prototype._clamp=function(t){if(t){if(this.min){var e=i.DateTime.fromDateTime(this.min,t);t<e&&(t=e)}if(this.max){var n=i.DateTime.fromDateTime(this.max,t);t>n&&(t=n)}}return t},e.prototype._createChildren=function(){var t=this.getTemplate();this.applyTemplate("wj-control wj-calendar",t,{_tbHdr:"tbl-header",_btnMth:"btn-month",_spMth:"span-month",_btnPrv:"btn-prev",_btnTdy:"btn-today",_btnNxt:"btn-next",_tbMth:"tbl-month",_tbYr:"tbl-year"});var e=i.culture.Calendar.ariaLabels;i.setAriaLabel(this._tbMth,e.calendar),i.setAriaLabel(this._tbYr,e.calendar),i.setAriaLabel(this._btnPrv,e.calendar),i.setAriaLabel(this._btnMth,e.monthView),i.setAriaLabel(this._btnPrv,e.prvMo),i.setAriaLabel(this._btnTdy,e.today),i.setAriaLabel(this._btnNxt,e.nxtMo);for(var n=this._createElement("tr",this._tbMth,"wj-header"),s=0;s<7;s++)this._createElement("td",n);for(var o=0;o<6;o++){n=this._createElement("tr",this._tbMth);for(s=0;s<7;s++)this._createElement("td",n)}n=this._createElement("tr",this._tbYr,"wj-header"),this._createElement("td",n).setAttribute("colspan","4");for(var r=0;r<3;r++){n=this._createElement("tr",this._tbYr);for(var a=0;a<4;a++)this._createElement("td",n)}},e.prototype._createElement=function(t,e,n){var s=document.createElement(t);if(e&&e.appendChild(s),n&&i.addClass(s,n),"TD"==s.tagName){var o=i.closest(s,".wj-header")?"columnheader":"gridcell";i.setAttribute(s,"role",o),i.setAttribute(s,"aria-selected",!1)}return s},e.prototype._click=function(t){if(!t.defaultPrevented&&0==t.button){var e=!1,n=t.target;if(i.contains(this._btnMth,n)&&!this._monthMode()?(this.monthView=!this.monthView,e=!0):i.contains(this._btnPrv,n)?(this._navigate(-1),e=!0):i.contains(this._btnNxt,n)?(this._navigate(1),e=!0):i.contains(this._btnTdy,n)&&(this._navigate(0),e=!0),n&&!e&&(n=i.closest(n,"TD")))if(this.monthView){if((s=this._getCellIndex(this._tbMth,n))>6&&this._canChangeValue()){o=i.DateTime.fromDateTime(i.DateTime.addDays(this._firstDay,s-7),this.value);this._inValidRange(o)&&this._valid(o)&&(this.value=o),e=!0}}else{var s=this._getCellIndex(this._tbYr,n);if(s>0){if(this.displayMonth=i.DateTime.newDate(this.displayMonth.getFullYear(),s-1,1),this._monthMode()){if(this._canChangeValue()){var o=i.DateTime.fromDateTime(this.displayMonth,this.value);this._inValidRange(o)&&(this.value=o)}}else this.monthView=!0;e=!0}}e&&(t.preventDefault(),this.focus())}},e.prototype._getCellIndex=function(t,e){for(var i=t.querySelectorAll("TD"),n=0;n<i.length;n++)if(i[n]==e)return n;return-1},e.prototype._keydown=function(t){if(!t.defaultPrevented){if(t.altKey)switch(t.keyCode){case i.Key.Up:case i.Key.Down:return;case i.Key.End:return this._navigate(0),void t.preventDefault()}if(!(t.ctrlKey||t.metaKey||t.shiftKey)){var e=0,n=0,s=!0;if(this.monthView)switch(t.keyCode){case i.Key.Left:e=-1;break;case i.Key.Right:e=1;break;case i.Key.Up:e=-7;break;case i.Key.Down:e=7;break;case i.Key.PageDown:n=t.altKey?12:1;break;case i.Key.PageUp:n=t.altKey?-12:-1;break;case i.Key.Home:this._canChangeValue()&&(o=this._getValidDate(this.value,!0))&&(this.value=i.DateTime.fromDateTime(o,this.value));break;case i.Key.End:this._canChangeValue()&&(o=this._getValidDate(this.value,!1))&&(this.value=i.DateTime.fromDateTime(o,this.value));break;default:s=!1}else switch(t.keyCode){case i.Key.Left:n=-1;break;case i.Key.Right:n=1;break;case i.Key.Up:n=-4;break;case i.Key.Down:n=4;break;case i.Key.PageDown:n=t.altKey?120:12;break;case i.Key.PageUp:n=t.altKey?-120:-12;break;case i.Key.Home:n=this.value?-this.value.getMonth():0;break;case i.Key.End:n=this.value?11-this.value.getMonth():0;break;case i.Key.Enter:this._monthMode()?s=!1:this.monthView=!0;break;default:s=!1}if(this._canChangeValue()&&(e||n)){var o=this.value;if(o?(o=i.DateTime.addDays(o,e),o=i.DateTime.addMonths(o,n)):o=this._getValidDate(new Date,!0),n&&!this._valid(o))for(var r=o.getMonth(),a=1;a<31&&!this._valid(o);a++){var l=i.DateTime.addDays(o,+a),h=i.DateTime.addDays(o,-a);this._valid(l)&&l.getMonth()==r?o=l:this._valid(h)&&h.getMonth()==r&&(o=h)}for(a=0;a<31&&!this._valid(o);a++)o=i.DateTime.addDays(o,e>0||n>0?1:-1);this.value=o}s&&t.preventDefault()}}},e.prototype._getMonth=function(t){return t||(t=i.DateTime.newDate()),i.DateTime.newDate(t.getFullYear(),t.getMonth(),1)},e.prototype._monthMode=function(){return this.selectionMode==r.Month},e.prototype._navigate=function(t){var e=this.monthView,n=this.displayMonth;switch(t){case 0:var s=i.DateTime.newDate();this._canChangeValue()&&(this.value=e?i.DateTime.fromDateTime(s,this.value):this._getMonth(s)),n=this._getMonth(s);break;case 1:n=i.DateTime.addMonths(n,e?1:12);break;case-1:n=i.DateTime.addMonths(n,e?-1:-12)}this.displayMonth=n},e.controlTemplate='<div class="wj-content wj-calendar-outer"><div wj-part="tbl-header" class="wj-calendar-header"><div wj-part="btn-month" class="wj-month-select" role="button"><span wj-part="span-month"></span> <span class="wj-glyph-down"></span></div><div class="wj-btn-group"><button wj-part="btn-prev" class="wj-btn wj-btn-default" tabindex="-1"><span class="wj-glyph-left"></span></button><button wj-part="btn-today" class="wj-btn wj-btn-default" tabindex="-1"><span class="wj-glyph-circle"></span></button><button wj-part="btn-next" class="wj-btn wj-btn-default" tabindex="-1"><span class="wj-glyph-right"></span></button></div></div><table wj-part="tbl-month" class="wj-calendar-month" role="grid"></table><table wj-part="tbl-year" class="wj-calendar-year" role="grid" style="display:none"></table></div>',e}(i.Control);e.Calendar=a;var l=function(t){function e(n,s){var o=t.call(this,n)||this;o._hsb=[.5,1,1],o._alpha=1,o.valueChanged=new i.Event;var r=o.getTemplate();o.applyTemplate("wj-control wj-content wj-colorpicker",r,{_eSB:"div-sb",_eHue:"div-hue",_eAlpha:"div-alpha",_ePreview:"div-pv",_ePal:"div-pal",_eText:"div-text"}),o._palette="#FFF,#000, #F00,#FFC000,#FFFF00,#92D050,#00B050,#00B0F0,#0070C0,#7030A0".split(","),o._updatePalette(),o._eHue.style.backgroundImage="url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAD4CAIAAACi6hsPAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAYdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuM4zml1AAAAGvSURBVDhPXdBPaM9xHMfxz4pWaxcmtoOhpdXSVpiyHWxqmVpDjaU5rK34XfypjTJ/p+ZPay6jhsOsRrKwaJElf9IQq03WIkv4FeMwMq221tfje1ByeFzfvd7PEKWGEKWTQRZLySWfVRRTQjmVbKWGOhLsZT+HaeY0bbTTQSfdXOcWffTzmAFeMcwoYyT5ygS/mA5hNgphip98J8kHRnnNSwZ4yH1uc4OrdHGR87RximYO0cgedlLLdqqoYAPrWMtKVrCcJSxiPmnMJUQp/Bsyk2xyyKOAQooopYwKtlDNDur5G7SBJo7RQiv/B+2hl3s84CkvGGKEOOYnxolj/mYmhBmDJ5ngCx95xxsGecYj4pB3iENeoZMO2mmlhaMcpIE4ZII6aqhmM3HMMkooopB88sghm0wySCeVlCjMCVFIYx4LWUwOeRSwhmLWU84mqqihll3sppEmjnOSs5zjEl1c4yZ99POE5wwxwns+840fTDFLFKaZZIJxkozxlmEGGSC+GF++Sy89dHOZC8Rr4lVnOMERDrCPBPXEX22jko2UEn+/mnxyWUYWC0gnNUQh/AEc0HJs6cex0gAAAABJRU5ErkJggg==)",o._eHue.style.backgroundSize="contain",navigator.appVersion.indexOf("MSIE 9")>-1&&(o._eSB.children[0].style.filter="progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffffffff,endColorstr=#00ffffff,GradientType=1)",o._eSB.children[1].style.filter="progid:DXImageTransform.Microsoft.gradient(startColorstr=#00000000,endColorstr=#ff000000,GradientType=0)"),r=e._tplCursor,o._cSB=i.createElement(r),o._cHue=i.createElement(r),o._cHue.style.width="100%",o._cAlpha=i.createElement(r),o._cAlpha.style.height="100%",o._eSB.appendChild(o._cSB),o._eHue.appendChild(o._cHue),o._eAlpha.appendChild(o._cAlpha),o.addEventListener(o.hostElement,"mousedown",function(t){document.addEventListener("mousemove",a),document.addEventListener("mouseup",l),o._mouseDown(t)});var a=function(t){o._mouseMove(t)},l=function(t){document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",l),o._mouseUp(t)};return o.addEventListener(o.hostElement,"click",function(t){var e=t.target;if(e&&"DIV"==e.tagName&&i.contains(o._ePal,e)){var n=e.style.backgroundColor;n&&(o.value=new i.Color(n).toString())}}),o.value="#ffffff",o.initialize(s),o._updatePanels(),o}return __extends(e,t),Object.defineProperty(e.prototype,"showAlphaChannel",{get:function(){return"none"!=this._eAlpha.parentElement.style.display},set:function(t){this._eAlpha.parentElement.style.display=i.asBoolean(t)?"":"none"},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"showColorString",{get:function(){return"none"!=this._eText.style.display},set:function(t){this._eText.style.display=i.asBoolean(t)?"":"none"},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this._value},set:function(t){if(t!=this.value){this._value=i.asString(t),this._eText.innerText=this._value;var e=new i.Color(this._value),n=e.getHsb();this._hsb[0]==n[0]&&this._hsb[1]==n[1]&&this._hsb[2]==n[2]&&this._alpha==e.a||(0==n[2]?(n[0]=this._hsb[0],n[1]=this._hsb[1]):0==n[1]&&(n[0]=this._hsb[0]),this._hsb=n,this._alpha=e.a,this.onValueChanged())}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"palette",{get:function(){return this._palette},set:function(t){t=i.asArray(t);for(var e=0;e<t.length&&e<this._palette.length;e++){var n=i.asString(t[e]);this._palette[e]=n}this._updatePalette()},enumerable:!0,configurable:!0}),e.prototype.onValueChanged=function(t){this._updatePanels(),this.valueChanged.raise(this,t)},e.prototype._mouseDown=function(t){this._htDown=this._getTargetPanel(t),this._htDown&&(t.preventDefault(),this.focus(),this._mouseMove(t))},e.prototype._mouseMove=function(t){if(this._htDown){var e=this._htDown.getBoundingClientRect();this._htDown==this._eHue?(this._hsb[0]=i.clamp((t.clientY-e.top)/e.height,0,.99),this._updateColor()):this._htDown==this._eSB?(this._hsb[1]=i.clamp((t.clientX-e.left)/e.width,0,1),this._hsb[2]=i.clamp(1-(t.clientY-e.top)/e.height,0,1),this._updateColor()):this._htDown==this._eAlpha&&(this._alpha=i.clamp((t.clientX-e.left)/e.width,0,1),this._updateColor())}},e.prototype._mouseUp=function(t){this._htDown=null},e.prototype._updateColor=function(){var t=i.Color.fromHsb(this._hsb[0],this._hsb[1],this._hsb[2],this._alpha);this.value=t.toString(),this._updatePanels()},e.prototype._updatePalette=function(){var t=new i.Color("#fff"),e=new i.Color("#000");this._ePal.innerHTML="";for(var n=0;n<this._palette.length;n++){var s=i.createElement('<div style="float:left;width:10%;box-sizing:border-box;padding:1px">'),o=new i.Color(this._palette[n]),r=o.getHsb();s.appendChild(this._makePalEntry(o,4));for(var a=0;a<5;a++){if(0==r[1]){var l=.1*a+(r[2]>.5?.05:.55);o=i.Color.interpolate(t,e,l)}else o=i.Color.fromHsb(r[0],.1+.2*a,1-.1*a);s.appendChild(this._makePalEntry(o,0))}this._ePal.appendChild(s)}},e.prototype._makePalEntry=function(t,e){var n=document.createElement("div");return i.setCss(n,{cursor:"pointer",backgroundColor:t.toString(),marginBottom:e||""}),n.innerHTML="&nbsp",n},e.prototype._updatePanels=function(){var t=i.Color.fromHsb(this._hsb[0],1,1,1),e=i.Color.fromHsb(this._hsb[0],this._hsb[1],this._hsb[2],1);this._eSB.style.backgroundColor=t.toString(),this._eAlpha.style.background="linear-gradient(to right, transparent 0%, "+e.toString()+" 100%)",navigator.appVersion.indexOf("MSIE 9")>-1&&(this._eAlpha.style.filter="progid:DXImageTransform.Microsoft.gradient(startColorstr=#00000000,endColorstr="+e.toString()+", GradientType = 1)"),this._ePreview.style.backgroundColor=this.value,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)+"%"},e.prototype._getTargetPanel=function(t){var e=t.target;return i.contains(this._eSB,e)?this._eSB:i.contains(this._eHue,e)?this._eHue:i.contains(this._eAlpha,e)?this._eAlpha:null},e.controlTemplate='<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%">&nbsp;</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="wj-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="wj-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="wj-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="wj-colorbox" style="position:static"></div></div></div></div>',e._tplCursor='<div style="position:absolute;left:50%;top:50%;width:7px;height:7px;transform:translate(-50%,-50%);border:2px solid #f0f0f0;border-radius:50px;box-shadow:0px 0px 4px 2px #0f0f0f"></div>',e}(i.Control);e.ColorPicker=l;var h=function(t){function e(e,n){var s=t.call(this,e)||this;s._pathDisplay=new i.Binding(null),s._pathValue=new i.Binding(null),s._pathChecked=new i.Binding(null),s._html=!1,s._checkedItems=[],s._itemRole="option",s._search="",s._fmtItemHandlers=0,s.selectedIndexChanged=new i.Event,s.itemsChanged=new i.Event,s.loadingItems=new i.Event,s.loadedItems=new i.Event,s.itemChecked=new i.Event,s.checkedItemsChanged=new i.Event,s.formatItem=new i.Event,s.applyTemplate("wj-control wj-content wj-listbox",null,null);var o=s.hostElement;return i.setAttribute(o,"role","listbox",!0),"SELECT"==s._orgTag&&s._initFromSelect(s.hostElement),s.addEventListener(o,"click",s._click.bind(s)),s.addEventListener(o,"keydown",s._keydown.bind(s)),s.addEventListener(o,"keypress",s._keypress.bind(s)),s.addEventListener(o,"wheel",function(t){o.scrollHeight>o.offsetHeight&&(t.deltaY<0&&0==o.scrollTop||t.deltaY>0&&o.scrollTop+o.offsetHeight>=o.scrollHeight)&&(t.preventDefault(),t.stopPropagation())}),s.initialize(n),s}return __extends(e,t),Object.defineProperty(e.prototype,"itemsSource",{get:function(){return this._items},set:function(t){this._items!=t&&(this._cv&&(this._cv.currentChanged.removeHandler(this._cvCurrentChanged,this),this._cv.collectionChanged.removeHandler(this._cvCollectionChanged,this),this._cv=null),this._items=t,this._cv=i.asCollectionView(t),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(e.prototype,"collectionView",{get:function(){return this._cv},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isContentHtml",{get:function(){return this._html},set:function(t){t!=this._html&&(this._html=i.asBoolean(t),this._populateList())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"itemFormatter",{get:function(){return this._itemFormatter},set:function(t){t!=this._itemFormatter&&(this._itemFormatter=i.asFunction(t),this._populateList())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"displayMemberPath",{get:function(){return this._pathDisplay.path},set:function(t){t!=this.displayMemberPath&&(this._pathDisplay.path=i.asString(t),this._populateList())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selectedValuePath",{get:function(){return this._pathValue.path},set:function(t){this._pathValue.path=i.asString(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"checkedMemberPath",{get:function(){return this._pathChecked.path},set:function(t){t!=this.checkedMemberPath&&(this._pathChecked.path=i.asString(t),this._populateList())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"itemRole",{get:function(){return this._itemRole},set:function(t){t!=this.itemRole&&(this._itemRole=i.asString(t),this._populateList())},enumerable:!0,configurable:!0}),e.prototype.getDisplayValue=function(t){var e=null;t>-1&&i.hasItems(this._cv)&&(e=this._cv.items[t],this.displayMemberPath&&(e=this._pathDisplay.getValue(e)));var n=null!=e?e.toString():"";return this.itemFormatter&&(n=this.itemFormatter(t,n)),n},e.prototype.getDisplayText=function(t){var e=this.hostElement.children,i=t>-1&&t<e.length?e[t]:null;return null!=i?i.textContent:""},e.prototype.isItemEnabled=function(t){if(!this.getDisplayText(t))return!1;var e=this.hostElement.children[t];return!(!e||e.hasAttribute("disabled")||i.hasClass(e,"wj-state-disabled"))},Object.defineProperty(e.prototype,"selectedIndex",{get:function(){return this._cv?this._cv.currentPosition:-1},set:function(t){this._cv&&this._cv.moveCurrentToPosition(i.asNumber(t))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selectedItem",{get:function(){return this._cv?this._cv.currentItem:null},set:function(t){this._cv&&this._cv.moveCurrentTo(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selectedValue",{get:function(){var t=this.selectedItem;return t&&this.selectedValuePath&&(t=this._pathValue.getValue(t)),t},set:function(t){var e=this.selectedValuePath,n=-1;if(this._cv){for(var s=0;s<this._cv.items.length;s++){var o=this._cv.items[s],r=e?this._pathValue.getValue(o):o;if(r===t||i.DateTime.equals(r,t)){n=s;break}}this.selectedIndex=n}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxHeight",{get:function(){var t=this.hostElement;return t?parseFloat(t.style.maxHeight):null},set:function(t){var e=this.hostElement;e&&(e.style.maxHeight=i.asNumber(t)+"px")},enumerable:!0,configurable:!0}),e.prototype.showSelection=function(){for(var t,e=this.selectedIndex,n=this.hostElement,s=n.children,o=0;o<s.length;o++){var r=o==e;t=s[o],i.toggleClass(t,"wj-state-selected",r),t.tabIndex=r?this._orgTabIndex:-1,i.setAttribute(t,"aria-selected",r)}if(e>-1&&e<s.length){var a=(t=s[e]).getBoundingClientRect(),l=n.getBoundingClientRect();a.bottom>l.bottom?n.scrollTop+=a.bottom-l.bottom:a.top<l.top&&(n.scrollTop-=l.top-a.top)}e>-1&&this.containsFocus()&&(t=s[e])instanceof HTMLElement&&!i.contains(t,i.getActiveElement())&&t.focus(),n.tabIndex=e<0?this._orgTabIndex:-1},e.prototype.loadList=function(){this._populateList()},e.prototype.getItemChecked=function(t){var e=this._cv.items[t];if(i.isObject(e)&&this.checkedMemberPath)return this._pathChecked.getValue(e);var n=this._getCheckbox(t);return!!n&&n.checked},e.prototype.setItemChecked=function(t,e){this._setItemChecked(t,e,!0)},e.prototype.toggleItemChecked=function(t){this.setItemChecked(t,!this.getItemChecked(t))},Object.defineProperty(e.prototype,"checkedItems",{get:function(){if(this._checkedItems.splice(0,this._checkedItems.length),this._cv)for(var t=0;t<this._cv.items.length;t++)this.getItemChecked(t)&&this._checkedItems.push(this._cv.items[t]);return this._checkedItems},set:function(t){var e=this._cv,n=this.hostElement,s=i.asArray(t,!1);if(e&&s){for(var o=e.currentPosition,r=n.scrollTop,a=0;a<e.items.length;a++){var l=e.items[a];this._setItemChecked(a,s.indexOf(l)>-1,!1)}e.moveCurrentToPosition(o),n.scrollTop=r,this.onCheckedItemsChanged()}},enumerable:!0,configurable:!0}),e.prototype.onSelectedIndexChanged=function(t){this.selectedIndexChanged.raise(this,t)},e.prototype.onItemsChanged=function(t){this.itemsChanged.raise(this,t)},e.prototype.onLoadingItems=function(t){this.loadingItems.raise(this,t)},e.prototype.onLoadedItems=function(t){this.loadedItems.raise(this,t)},e.prototype.onItemChecked=function(t){this.itemChecked.raise(this,t)},e.prototype.onCheckedItemsChanged=function(t){this.checkedItemsChanged.raise(this,t)},e.prototype.onFormatItem=function(t){this.formatItem.raise(this,t)},e.prototype.refresh=function(e){void 0===e&&(e=!0),t.prototype.refresh.call(this,e),this.formatItem.handlerCount!=this._fmtItemHandlers&&(this._e.offsetHeight||this._e.offsetWidth)&&(this._fmtItemHandlers=this.formatItem.handlerCount,this._populateList())},e.prototype._setItemChecked=function(t,e,n){void 0===n&&(n=!0);var s=this._cv.items[t];if(i.isObject(s)){var o=i.tryCast(this._cv,"IEditableCollectionView");this._pathChecked.getValue(s)!=e&&(this._checking=!0,o?(o.editItem(s),this._pathChecked.setValue(s,e),o.commitEdit()):(this._pathChecked.setValue(s,e),this._cv.refresh()),this._checking=!1)}var r=this._getCheckbox(t);if(r){r.checked=e;var a=i.closest(r,".wj-listbox-item");a&&i.toggleClass(a,"wj-state-checked",e)}n&&(this.onItemChecked(),this.onCheckedItemsChanged())},e.prototype._cvCollectionChanged=function(t,e){this._checking||(this._populateList(),this.onItemsChanged())},e.prototype._cvCurrentChanged=function(t,e){this._checking||(this.showSelection(),this.onSelectedIndexChanged())},e.prototype._populateList=function(){var t=this.hostElement;if(t){var e=this.containsFocus();if(this.onLoadingItems(),t.textContent="",this._cv){for(var n=document.createDocumentFragment(),s=0;s<this._cv.items.length;s++){var o=this.getDisplayValue(s);1!=this._html&&(o=i.escapeHtml(o));var r=!1;this.checkedMemberPath&&(o='<label><input tabindex="-1" type="checkbox"'+((r=this._pathChecked.getValue(this._cv.items[s]))?" checked":"")+"> "+o+"</label>");var a=document.createElement("div"),l="wj-listbox-item";if(a.innerHTML=o,i.hasClass(a.firstChild,"wj-separator")&&(l+=" wj-separator"),r&&(l+=" wj-state-checked"),a.className=l,this.itemRole&&i.setAttribute(a,"role",this.itemRole),i.setAttribute(a,"aria-selected",!1),this.formatItem.hasHandlers){var h=new c(s,this._cv.items[s],a);this.onFormatItem(h)}n.appendChild(a)}t.appendChild(n)}0==t.children.length&&t.appendChild(document.createElement("div")),e&&!this.containsFocus()&&this.focus(),this.showSelection(),this.onLoadedItems()}},e.prototype._click=function(t){if(0==t.button&&!t.defaultPrevented){for(var e=this.hostElement.children,n=0;n<e.length;n++)if(i.contains(e[n],t.target)){this.selectedIndex=n;break}var s=this.selectedIndex;if(this.checkedMemberPath&&s>-1){var o=this._getCheckbox(s);o==t.target&&(e[s].focus(),this.setItemChecked(s,o.checked))}}},e.prototype._keydown=function(t){var e=this.selectedIndex;this.hostElement.children;if(!t.defaultPrevented){if(65==t.keyCode&&(t.ctrlKey||t.metaKey)&&this.checkedMemberPath&&i.hasItems(this.collectionView))return this.checkedItems=this.getItemChecked(0)?[]:this.collectionView.items,void t.preventDefault();if(!(t.ctrlKey||t.shiftKey||t.altKey||t.metaKey))switch(t.keyCode){case i.Key.Down:t.preventDefault(),this._selectNext();break;case i.Key.Up:t.preventDefault(),this._selectPrev();break;case i.Key.Home:t.preventDefault(),this._selectFirst();break;case i.Key.End:t.preventDefault(),this._selectLast();break;case i.Key.PageDown:t.preventDefault(),this._selectNextPage();break;case i.Key.PageUp:t.preventDefault(),this._selectPrevPage();break;case i.Key.Space:if(this.checkedMemberPath&&e>-1){var n=this._getCheckbox(e);n&&this.isItemEnabled(e)&&(this.setItemChecked(e,!n.checked),t.preventDefault())}}}},e.prototype._keypress=function(t){var e=this;if(!t.defaultPrevented&&!(t.target instanceof HTMLInputElement)&&(t.charCode>32||32==t.charCode&&this._search)){t.preventDefault(),this._search+=String.fromCharCode(t.charCode).toLowerCase(),this._toSearch&&clearTimeout(this._toSearch),this._toSearch=setTimeout(function(){e._toSearch=null,e._search=""},i.Control._SEARCH_DELAY);var n=this._findNext();n<0&&this._search.length>1&&(this._search=this._search[this._search.length-1],n=this._findNext()),n>-1&&(this.selectedIndex=n)}},e.prototype._selectNext=function(){for(var t=this.hostElement.children.length,e=this.selectedIndex+1;e<t;e++)if(this.isItemEnabled(e))return this.selectedIndex=e,!0;return!1},e.prototype._selectPrev=function(){for(var t=this.selectedIndex-1;t>=0;t--)if(this.isItemEnabled(t))return this.selectedIndex=t,!0;return!1},e.prototype._selectFirst=function(){for(var t=this.hostElement.children.length,e=0;e<t;e++)if(this.isItemEnabled(e))return this.selectedIndex=e,!0;return!1},e.prototype._selectLast=function(){for(var t=this.hostElement.children.length-1;t>=0;t--)if(this.isItemEnabled(t))return this.selectedIndex=t,!0;return!1},e.prototype._selectNextPage=function(){for(var t=this.hostElement,e=t.offsetHeight,i=t.children,n=0,s=this.selectedIndex+1;s<this._cv.items.length;s++){var o=i[s].scrollHeight;if(n+o>e&&this.isItemEnabled(s))return this.selectedIndex=s,!0;n+=o}return this._selectLast()},e.prototype._selectPrevPage=function(){for(var t=this.hostElement,e=t.offsetHeight,i=t.children,n=0,s=this.selectedIndex-1;s>0;s--){var o=i[s].scrollHeight;if(n+o>e&&this.isItemEnabled(s))return this.selectedIndex=s,!0;n+=o}return this._selectFirst()},e.prototype._findNext=function(){if(this.hostElement){var t=this.hostElement.childElementCount,e=this.selectedIndex;(e<0||1==this._search.length)&&e++;for(var i=0;i<t;i++){var n=(e+i)%t;if(0==this.getDisplayText(n).trim().toLowerCase().indexOf(this._search)&&this.isItemEnabled(n))return n}}return-1},e.prototype._getCheckbox=function(t){var e=this.hostElement;return e&&t>-1&&t<e.children.length?e.children[t].querySelector("input[type=checkbox]"):null},e.prototype._initFromSelect=function(t){for(var e=t.children,i=[],n=-1,s=0;s<e.length;s++){var o=e[s];"OPTION"==o.tagName&&(o.hasAttribute("selected")&&(n=i.length),o.innerHTML?i.push({hdr:o.innerHTML,val:o.getAttribute("value"),cmdParam:o.getAttribute("cmd-param")}):i.push({hdr:'<div class="wj-separator"/>'}),t.removeChild(o),s--)}i&&(this.displayMemberPath="hdr",this.selectedValuePath="val",this.itemsSource=i,this.selectedIndex=n)},e}(i.Control);e.ListBox=h;var c=function(t){function e(e,n,s){var o=t.call(this)||this;return o._index=i.asNumber(e),o._data=n,o._item=i.asType(s,HTMLElement),o}return __extends(e,t),Object.defineProperty(e.prototype,"index",{get:function(){return this._index},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"data",{get:function(){return this._data},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"item",{get:function(){return this._item},enumerable:!0,configurable:!0}),e}(i.EventArgs);e.FormatItemEventArgs=c;var u=function(t){function e(e,n){var s=t.call(this,e)||this;s._editable=!1,s._delKey=0,s._composing=!1,s._pathHdr=new i.Binding(null),s._bsCollapse=!0,s.itemsSourceChanged=new i.Event,s.selectedIndexChanged=new i.Event;var o=s.hostElement;return i.addClass(o,"wj-combobox"),s.dropDown.id=i.getUniqueId(o.id+"_dropdown"),s.autoExpandSelection=!1,s.addEventListener(s._tbx,"compositionstart",function(){s._composing=!0}),s.addEventListener(s._tbx,"compositionend",function(){s._composing=!1,setTimeout(function(){s._setText(s.text,!0)})}),s.addEventListener(o,"wheel",function(t){if(!t.defaultPrevented&&!s.isDroppedDown&&!s.isReadOnly&&s.containsFocus()&&s.selectedIndex>-1){var e=i.clamp(-t.deltaY,-1,1);s.selectedIndex=i.clamp(s.selectedIndex-e,0,s.collectionView.items.length-1),t.preventDefault()}}),"SELECT"==s._orgTag&&s._lbx._initFromSelect(o),s._lbx.loadedItems.addHandler(function(t){s.selectedIndex>-1&&(s.selectedIndex=s._lbx.selectedIndex)}),s.isRequired=!0,s.initialize(n),s}return __extends(e,t),Object.defineProperty(e.prototype,"itemsSource",{get:function(){return this._lbx.itemsSource},set:function(t){this._lbx.itemsSource!=t&&(this._lbx.itemsSource=t,this.onItemsSourceChanged()),this._updateBtn()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"collectionView",{get:function(){return this._lbx.collectionView},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"displayMemberPath",{get:function(){return this._lbx.displayMemberPath},set:function(t){this._lbx.displayMemberPath=t;var e=this.getDisplayText();this.text!=e&&this._setText(e,!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"headerPath",{get:function(){return this._pathHdr.path},set:function(t){this._pathHdr.path=i.asString(t);var e=this.getDisplayText();this.text!=e&&this._setText(e,!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selectedValuePath",{get:function(){return this._lbx.selectedValuePath},set:function(t){this._lbx.selectedValuePath=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isContentHtml",{get:function(){return this._lbx.isContentHtml},set:function(t){if(t!=this.isContentHtml){this._lbx.isContentHtml=i.asBoolean(t);var e=this.getDisplayText();this.text!=e&&this._setText(e,!0)}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"itemFormatter",{get:function(){return this._lbx.itemFormatter},set:function(t){this._lbx.itemFormatter=i.asFunction(t),this.selectedIndex=this._lbx.selectedIndex},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"formatItem",{get:function(){return this.listBox.formatItem},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selectedIndex",{get:function(){return this._lbx.selectedIndex},set:function(t){t!=this.selectedIndex&&(this._lbx.selectedIndex=t),t=this.selectedIndex;var e=this.getDisplayText(t);this.text!=e&&this._setText(e,!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selectedItem",{get:function(){return this._lbx.selectedItem},set:function(t){this._lbx.selectedItem=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selectedValue",{get:function(){return this._lbx.selectedValue},set:function(t){this._lbx.selectedValue=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isEditable",{get:function(){return this._editable},set:function(t){this._editable=i.asBoolean(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxDropDownHeight",{get:function(){return this._lbx.maxHeight},set:function(t){this._lbx.maxHeight=i.asNumber(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxDropDownWidth",{get:function(){var t=this._dropDown;return parseInt(t.style.maxWidth)},set:function(t){this._dropDown.style.maxWidth=i.asNumber(t)+"px"},enumerable:!0,configurable:!0}),e.prototype.getDisplayText=function(t){if(void 0===t&&(t=this.selectedIndex),this.headerPath&&t>-1&&i.hasItems(this.collectionView)){var e=this.collectionView.items[t],n=e?this._pathHdr.getValue(e):null;return n=null!=n?n.toString():"",this.isContentHtml&&(this._cvt||(this._cvt=document.createElement("div")),this._cvt.innerHTML=n,n=this._cvt.textContent),n.trim()}return this._lbx.getDisplayText(t).trim()},e.prototype.indexOf=function(t,e){var n=this.collectionView;if(i.hasItems(n)&&null!=t){var s=this.selectedIndex;if(e&&t==this.getDisplayText(s))return s;t=t.toString().toLowerCase();for(var o=0;o<n.items.length;o++)if(this.listBox.isItemEnabled(o)){var r=this.getDisplayText(o).toLowerCase();if(e){if(r==t)return o}else if(t&&0==r.indexOf(t))return o}}return-1},Object.defineProperty(e.prototype,"listBox",{get:function(){return this._lbx},enumerable:!0,configurable:!0}),e.prototype.onItemsSourceChanged=function(t){this.itemsSourceChanged.raise(this,t)},e.prototype.onSelectedIndexChanged=function(t){this._updateBtn(),this.selectedIndexChanged.raise(this,t)},e.prototype.refresh=function(e){void 0===e&&(e=!0),t.prototype.refresh.call(this,e),i.hasItems(this.collectionView)&&(this._lbx.refresh(),this.selectedIndex>-1&&(this.selectedIndex=this._lbx.selectedIndex))},e.prototype.onLostFocus=function(e){this._composing&&(this._composing=!1,this._setText(this.text,!0)),this.isEditable&&this.isRequired&&!this.text&&i.hasItems(this.collectionView)&&(this.selectedIndex=0),t.prototype.onLostFocus.call(this,e)},e.prototype.onIsDroppedDownChanging=function(e){return this.isDroppedDown||i.hasItems(this.collectionView)?t.prototype.onIsDroppedDownChanging.call(this,e):(e.cancel=!0,!1)},e.prototype.onIsDroppedDownChanged=function(e){t.prototype.onIsDroppedDownChanged.call(this,e),this.isDroppedDown&&(this._lbx.showSelection(),this.isTouching||this.selectAll()),i.setAttribute(this.dropDown,"aria-expanded",this.isDroppedDown)},e.prototype._updateBtn=function(){var e=this.collectionView,n=this._tbx,s=this.dropDown.id,o=i.hasItems(e);t.prototype._updateBtn.call(this),this._btn.style.display=this._showBtn&&null!=e?"":"none",i.enable(this._btn,o),i.setAttribute(n,"role",o?"combobox":null),i.setAttribute(n,"aria-autocomplete",o?"both":null),i.setAttribute(n,"aria-owns",o&&this.dropDown.parentElement?s:null),i.setAttribute(this.dropDown,"aria-expanded",!o&&null)},e.prototype._btnclick=function(e){t.prototype._btnclick.call(this,e),this.isTouching||this._elRef!=this._tbx||this.selectAll()},e.prototype._createDropDown=function(){var t=this;this._lbx||(this._lbx=new h(this._dropDown)),this._lbx.maxHeight=200,this._lbx.selectedIndexChanged.addHandler(function(){t._updateBtn();var e=t._lbx.selectedIndex,n=t._lbx.hostElement.children,s=e>-1&&e<n.length?n[e].id:null;i.setAttribute(t._tbx,"aria-activedescendant",s&&s.length?s:null),t.selectedIndex=e,t.onSelectedIndexChanged()}),this._lbx.itemsChanged.addHandler(function(){t._updateBtn()}),this.addEventListener(this._dropDown,"click",this._dropDownClick.bind(this))},e.prototype._dropDownClick=function(t){t.defaultPrevented||t.target!=this._dropDown&&(this.isDroppedDown=!1)},e.prototype._setText=function(e,n){if(!this._composing&&!this._settingText){this._settingText=!0,null==e&&(e=""),e=e.toString();var s=this.selectedIndex,o=this.collectionView,r=this._getSelStart(),a=-1,l=!0;if(this.isEditable&&(!this._delKey&&this.containsFocus()||(n=!0,l=!1)),s=this.indexOf(e,n),l&&(s<0&&n&&(s=this.indexOf(e,!1)),s<0&&r>0&&(s=this.indexOf(e.substr(0,r),!1))),s<0&&!this.isEditable&&i.hasItems(o)&&(this.isRequired||e)){var h=this._oldText||"";s=Math.max(0,this.indexOf(h,!1));for(var c=0;c<e.length&&c<h.length;c++)if(e[c]!=h[c]){r=c;break}}s>-1&&(a=r,e=this.getDisplayText(s)),e!=this._tbx.value&&(this._tbx.value=e),a>-1&&this.containsFocus()&&!this.isTouching&&this._updateInputSelection(a),o&&o.moveCurrentToPosition(s),this._delKey=0,this._settingText=!1,t.prototype._setText.call(this,e,n)}},e.prototype._findNext=function(t,e){var i=this.selectedIndex,n=this.collectionView,s=n?n.items.length:0,o=this.listBox;if(n&&s&&e){t=t.toLowerCase();for(var r=i+e;r>-1&&r<s;r+=e){var a=this.getDisplayText(r).toLowerCase();if(a&&0==a.indexOf(t)&&(!this.dropDown.children[r]||o.isItemEnabled(r)))return r}}return i},e.prototype._keydown=function(e){if(t.prototype._keydown.call(this,e),!e.defaultPrevented&&!this.isReadOnly&&!e.altKey&&i.hasItems(this.collectionView)&&this._elRef==this._tbx){this._delKey=0;var n=this._getSelStart();switch(e.keyCode){case i.Key.Back:if(this._bsCollapse&&!this.isEditable){var s=this._getSelEnd();n>0&&s==this._tbx.value.length&&i.hasItems(this.collectionView)&&this._setSelRange(n-1,s)}this._delKey=e.keyCode;break;case i.Key.Delete:this._delKey=e.keyCode;break;case i.Key.Up:case i.Key.Down:n==this.text.length&&(n=0),this.selectedIndex=this._findNext(this.text.substr(0,n),e.keyCode==i.Key.Up?-1:1),this._setSelRange(n,this.text.length),e.preventDefault();break;case i.Key.PageUp:this._lbx._selectPrevPage(),e.preventDefault();break;case i.Key.PageDown:this._lbx._selectNextPage(),e.preventDefault()}}},e.prototype._updateInputSelection=function(t){this._elRef==this._tbx&&this._setSelRange(t,this._tbx.value.length)},e.prototype._getSelStart=function(){return this._tbx&&this._tbx.value?this._tbx.selectionStart:0},e.prototype._getSelEnd=function(){return this._tbx&&this._tbx.value?this._tbx.selectionEnd:0},e.prototype._setSelRange=function(t,e){var n=this._tbx;this._elRef==n&&i.setSelectionRange(n,t,e)},e}(o);e.ComboBox=u;var d=function(t){function e(e,n){var s=t.call(this,e)||this;return s._cssMatch="wj-autocomplete-match",s._minLength=2,s._maxItems=6,s._itemCount=0,s._delay=500,s._query="",s._inCallback=!1,s._srchProps=[],i.addClass(s.hostElement,"wj-autocomplete"),s._bsCollapse=!1,s.isEditable=!0,s.isRequired=!1,s.listBox.formatItem.addHandler(s._formatListItem,s),s._itemsSourceFnCallBackBnd=s._itemSourceFunctionCallback.bind(s),s.initialize(n),s}return __extends(e,t),Object.defineProperty(e.prototype,"minLength",{get:function(){return this._minLength},set:function(t){this._minLength=i.asNumber(t,!1,!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxItems",{get:function(){return this._maxItems},set:function(t){this._maxItems=i.asNumber(t,!1,!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"delay",{get:function(){return this._delay},set:function(t){this._delay=i.asNumber(t,!1,!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"searchMemberPath",{get:function(){return this._srchProp},set:function(t){this._srchProp=i.asString(t),this._srchProps=t?t.trim().split(/\s*,\s*/):[]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"itemsSourceFunction",{get:function(){return this._itemsSourceFn},set:function(t){this._itemsSourceFn=i.asFunction(t),i.isFunction(this._itemsSourceFn)&&this.itemsSourceFunction(this.text,this.maxItems,this._itemsSourceFnCallBackBnd)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cssMatch",{get:function(){return this._cssMatch},set:function(t){this._cssMatch=i.asString(t)},enumerable:!0,configurable:!0}),e.prototype._keydown=function(e){if(!e.defaultPrevented&&this.isDroppedDown)switch(e.keyCode){case i.Key.Up:case i.Key.Down:this.selectAll()}t.prototype._keydown.call(this,e)},e.prototype._setText=function(t){var e=this;if(!this._inCallback){if(!t&&this.selectedIndex>-1&&(this.selectedIndex=-1),t!=this._oldText&&(this._tbx.value!=t&&(this._tbx.value=t),this._oldText=t,this.onTextChanged(),!t&&this.collectionView))return this._rxHighlight=null,this.collectionView.filter=this._query=null,void(this.isDroppedDown=!1);this._toSearch&&clearTimeout(this._toSearch),t!=this.getDisplayText()&&(this._toSearch=setTimeout(function(){e._toSearch=null;var t=e.text.trim().toLowerCase();if(t.length>=e._minLength&&t!=e._query){e._query=t,t=t.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1");var n=i.escapeHtml(t);e._rxMatch=new RegExp("(?=.*"+t.replace(/ /g,")(?=.*")+")","ig"),e._rxHighlight=e.isContentHtml?new RegExp("("+n.replace(/ /g,"|")+")(?![^<]*>|[^<>]* </)","ig"):new RegExp("("+n.replace(/ /g,"|")+")","ig"),e.itemsSourceFunction?e.itemsSourceFunction(t,e.maxItems,e._itemsSourceFnCallBackBnd):e._updateItems()}},this._delay))}},e.prototype._itemSourceFunctionCallback=function(t){this._inCallback=!0;var e=i.asCollectionView(t);e&&e.moveCurrentToPosition(-1),this.itemsSource=e,this._inCallback=!1,this.containsFocus()&&(this.isDroppedDown=!0,this.refresh())},e.prototype.onIsDroppedDownChanged=function(t){if(this.isDroppedDownChanged.raise(this,t),this.isDroppedDown&&this._lbx.showSelection(),i.setAttribute(this.dropDown,"aria-expanded",this.isDroppedDown),this.containsFocus()&&!this.isDroppedDown&&!this.isTouching&&null==this.selectedItem){var e=this.text.length;i.setSelectionRange(this._tbx,e)}this._query=""},e.prototype._updateItems=function(){var t=this.collectionView;if(t){this._inCallback=!0,t.beginUpdate(),this._itemCount=0,t.filter=this._filter.bind(this),t.moveCurrentToPosition(-1),t.endUpdate(),this._inCallback=!1;var e=t.items.length;this.isDroppedDown=e>0&&this.containsFocus(),0!=e||this.isEditable||(this.selectedIndex=-1),this.refresh()}},e.prototype._filter=function(t){if(this._itemCount>=this._maxItems)return!1;var e=this._getItemText(t,!1);if(this._srchProps)for(var i=0;i<this._srchProps.length;i++)e+="\0"+t[this._srchProps[i]];return this.isContentHtml&&(e=e.replace(/<[^>]*>/g,"")),!!e.match(this._rxMatch)&&(this._itemCount++,!0)},e.prototype._getItemText=function(t,e){var i=t?t.toString():"",n=e&&this.headerPath?this._pathHdr:this._lbx._pathDisplay;return n&&(i=null!=(i=n.getValue(t))?i.toString():""),i},e.prototype._formatListItem=function(t,e){if(this._cssMatch&&this._rxHighlight){var i='<span class="'+this._cssMatch+'">$1</span>';e.item.innerHTML=e.item.innerHTML.replace(this._rxHighlight,i)}},e}(u);e.AutoComplete=d;var p=function(t){function e(e,n){var s=t.call(this,e)||this;s.itemClicked=new i.Event;var o=s.hostElement,r=s._tbx;i.addClass(o,"wj-menu"),r.style.display="none";s._hdr=s._elRef=i.createElement('<div wj-part="header" class="wj-form-control" style="cursor:default"/>'),r.parentElement.insertBefore(s._hdr,s._tbx);var a=s._orgOuter.match(/tabindex="?(-?\d+)"?/i);return a&&(o.tabIndex=parseInt(a[1])),s.isRequired=!1,i.setAttribute(o,"role","menubar",!0),i.setAttribute(r,"role",null),i.setAttribute(r,"aria-autocomplete",null),i.setAttribute(r,"aria-owns",null),i.setAttribute(s.dropDown,"role","menu"),s.listBox.itemRole="menuitem","SELECT"==s._orgTag&&(s.header=o.getAttribute("header"),s._lbx.itemsSource&&(s.commandParameterPath="cmdParam")),s.isContentHtml=!0,s.maxDropDownHeight=500,s.addEventListener(s._hdr,"click",function(t){t.defaultPrevented||(s._isButton?(s.isDroppedDown=!1,s._raiseCommand()):s.isDroppedDown=!s.isDroppedDown)}),s.listBox.lostFocus.addHandler(function(){s.containsFocus()||(s.isDroppedDown=!1)}),s.initialize(n),s}return __extends(e,t),Object.defineProperty(e.prototype,"header",{get:function(){return this._hdr.innerHTML},set:function(t){this._hdr.innerHTML=i.asString(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"command",{get:function(){return this._command},set:function(t){this._command=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"commandPath",{get:function(){return this._cmdPath},set:function(t){this._cmdPath=i.asString(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"commandParameterPath",{get:function(){return this._cmdParamPath},set:function(t){this._cmdParamPath=i.asString(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isButton",{get:function(){return this._isButton},set:function(t){this._isButton=i.asBoolean(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"owner",{get:function(){return this._owner},set:function(t){this._owner=i.asType(t,HTMLElement,!0),this._enableDisableItems()},enumerable:!0,configurable:!0}),e.prototype.show=function(t){if(!this.isDroppedDown){var e=this.dropDown;this.selectedIndex=-1,this.onIsDroppedDownChanging(new i.CancelEventArgs)&&(this.owner&&(e[i.Control._OWNR_KEY]=this.owner),i.showPopup(e,t),this.onIsDroppedDownChanged(),e.focus())}},e.prototype.hide=function(){this.isDroppedDown&&this.onIsDroppedDownChanging(new i.CancelEventArgs)&&(i.hidePopup(this.dropDown),this.onIsDroppedDownChanged())},e.prototype.onItemClicked=function(t){this.itemClicked.raise(this,t)},e.prototype.refresh=function(e){void 0===e&&(e=!0),t.prototype.refresh.call(this,e),this._enableDisableItems()},e.prototype.onIsDroppedDownChanged=function(e){t.prototype.onIsDroppedDownChanged.call(this,e),this.isDroppedDown?(this._closing=!0,this._defaultItem=this.selectedItem,this.isRequired=!1,this.selectedIndex=-1,this._enableDisableItems(),this._closing=!1,this.dropDown.focus()):this.selectedItem||(this.selectedItem=this._defaultItem)},e.prototype._keydown=function(e){e.defaultPrevented||e.keyCode==i.Key.Enter&&(this.isDroppedDown?this.getDisplayText(this.selectedIndex)&&this._raiseCommand():(this.isDroppedDown=!0,e.preventDefault())),t.prototype._keydown.call(this,e)},e.prototype._dropDownClick=function(e){e.defaultPrevented||e.target==this.dropDown||this.getDisplayText(this.selectedIndex)&&this._raiseCommand(),t.prototype._dropDownClick.call(this,e)},e.prototype._raiseCommand=function(t){var e=this.selectedItem,i=this._getCommand(e);if(i){var n=this._cmdParamPath?e[this._cmdParamPath]:null;if(!this._canExecuteCommand(i,n))return;this._executeCommand(i,n)}this.onItemClicked(t)},e.prototype._getCommand=function(t){var e=t&&this.commandPath?t[this.commandPath]:null;return e||this.command},e.prototype._executeCommand=function(t,e){t&&!i.isFunction(t)&&(t=t.executeCommand),i.isFunction(t)&&t(e)},e.prototype._canExecuteCommand=function(t,e){if(t){var n=t.canExecuteCommand;if(i.isFunction(n))return n(e)}return!0},e.prototype._enableDisableItems=function(){if(this.collectionView&&(this.command||this.commandPath))for(var t=this.collectionView.items,e=0;e<t.length;e++){var n=this._getCommand(t[e]),s=this.commandParameterPath?t[e][this.commandParameterPath]:null;if(n){var o=this._lbx.hostElement.children[e];i.toggleClass(o,"wj-state-disabled",!this._canExecuteCommand(n,s))}}},e}(u);e.Menu=p,i._addCultureInfo("MultiSelect",{itemsSelected:"{count:n0} items selected",selectAll:"Select All"});var f=function(t){function e(e,n){var s=t.call(this,e)||this;return s._maxHdrItems=2,s._readOnly=!1,s._hdrFmt=i.culture.MultiSelect.itemsSelected,s.checkedItemsChanged=new i.Event,i.addClass(s.hostElement,"wj-multiselect"),s._tbx.readOnly=!0,s.checkedMemberPath=null,s.addEventListener(s.inputElement,"click",function(){s.isDroppedDown=!s.isDroppedDown}),s.addEventListener(s._selectAll,"click",function(t){i.hasItems(s.collectionView)&&t.target==s._selectAllCheckbox&&(s.checkedItems=t.target.checked?s.collectionView.items:[])}),s.removeEventListener(s.dropDown,"click"),s._updateHeader(),s.listBox.itemsChanged.addHandler(function(){s._updateHeader()}),s.listBox.checkedItemsChanged.addHandler(function(){s._updateHeader(),s.onCheckedItemsChanged()}),s.initialize(n),s}return __extends(e,t),Object.defineProperty(e.prototype,"showSelectAllCheckbox",{get:function(){return""==this._selectAll.style.display},set:function(t){this._selectAll.style.display=i.asBoolean(t)?"":"none"},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selectAllLabel",{get:function(){return this._selectAllLabel},set:function(t){t!=this._selectAllLabel&&(this._selectAllLabel=i.asString(t),this.refresh())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"checkedMemberPath",{get:function(){var t=this.listBox.checkedMemberPath;return t!=e._DEF_CHECKED_PATH?t:null},set:function(t){t=i.asString(t),this.listBox.checkedMemberPath=t||e._DEF_CHECKED_PATH},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxHeaderItems",{get:function(){return this._maxHdrItems},set:function(t){this._maxHdrItems!=t&&(this._maxHdrItems=i.asNumber(t),this._updateHeader())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"headerFormat",{get:function(){return this._hdrFmt},set:function(t){t!=this._hdrFmt&&(this._hdrFmt=i.asString(t),this._updateHeader())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"headerFormatter",{get:function(){return this._hdrFormatter},set:function(t){t!=this._hdrFormatter&&(this._hdrFormatter=i.asFunction(t),this._updateHeader())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"checkedItems",{get:function(){return this.listBox.checkedItems},set:function(t){this.listBox.checkedItems=i.asArray(t)},enumerable:!0,configurable:!0}),e.prototype.onCheckedItemsChanged=function(t){this.checkedItemsChanged.raise(this,t)},e.prototype._createDropDown=function(){this._selectAll=i.createElement('<div class="wj-listbox-item wj-header wj-select-all" tabindex="0" style="display:none"><label><input type="checkbox"> <span></span></label></div>',this._dropDown),this._selectAllCheckbox=this._selectAll.querySelector("input[type=checkbox]"),this._selectAllSpan=this._selectAll.querySelector("label>span"),i.setText(this._selectAllSpan,i.culture.MultiSelect.selectAll);var e=i.createElement('<div style="width:100%;border:none"></div>',this._dropDown);this._lbx=new h(e),t.prototype._createDropDown.call(this),i.addClass(this.dropDown,"wj-control wj-listbox")},Object.defineProperty(e.prototype,"isReadOnly",{get:function(){return this._readOnly},set:function(t){this._readOnly=i.asBoolean(t),i.toggleClass(this.hostElement,"wj-state-readonly",this.isReadOnly)},enumerable:!0,configurable:!0}),e.prototype.refresh=function(e){void 0===e&&(e=!0),t.prototype.refresh.call(this,e),this._updateHeader(),this._selectAllSpan&&i.setText(this._selectAllSpan,this._selectAllLabel||i.culture.MultiSelect.selectAll)},e.prototype.onIsDroppedDownChanged=function(e){var i=this;t.prototype.onIsDroppedDownChanged.call(this,e),this.isDroppedDown&&this.containsFocus()&&setTimeout(function(){i.listBox.focus()},200)},e.prototype._setText=function(t,e){},e.prototype._keydown=function(e){t.prototype._keydown.call(this,e),!e.defaultPrevented&&i.hasItems(this.collectionView)&&e.keyCode>32&&(this.isDroppedDown=!0)},e.prototype._updateHeader=function(){var t=this.checkedItems;if(i.isFunction(this._hdrFormatter))this.inputElement.value=this._hdrFormatter();else{var e="";if(t.length>0)if(t.length<=this._maxHdrItems){if(this.displayMemberPath){var n=new i.Binding(this.displayMemberPath);t=t.map(function(t){return n.getValue(t)})}e=t.join(", ")}else e=i.format(this.headerFormat,{count:t.length});this.inputElement.value=e}var s=null,o=this.collectionView;i.hasItems(o)&&(0==t.length?s=!1:t.length==o.items.length&&(s=!0)),this._selectAllCheckbox.indeterminate=null==s,null!=s&&(this._selectAllCheckbox.checked=s),this._updateState()},e._DEF_CHECKED_PATH="$checked",e}(u);e.MultiSelect=f;var m=function(t){function e(e,n){var s=t.call(this,e)||this;return s._selItems=[],s._lastInputValue="",s._selPath=new i.Binding(null),s._notAddItm=!1,s.selectedItemsChanged=new i.Event,i.addClass(s.hostElement,"wj-multi-autocomplete"),s.showDropDownButton=!1,s.initialize(n),s._wjTpl=s.hostElement.querySelector(".wj-template"),s._wjInput=s.hostElement.querySelector(".wj-input"),s.addEventListener(s.hostElement,"keyup",s._keyup.bind(s),!0),s.addEventListener(window,"resize",s._adjustInputWidth.bind(s)),s.addEventListener(s._tbx,"focus",function(){s._itemOff()}),s._addHelperInput(),s._initSeltems(),s.listBox.itemsChanged.addHandler(function(){return s.selectedIndex=-1}),s._refreshHeader(),s}return __extends(e,t),Object.defineProperty(e.prototype,"showDropDownButton",{set:function(t){this._showBtn=!1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxSelectedItems",{get:function(){return this._maxtems},set:function(t){this._maxtems!=t&&(this._maxtems=i.asNumber(t,!0),this._updateMaxItems(),this._refreshHeader(),this._clearSelIndex())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selectedMemberPath",{get:function(){return this._selPath.path},set:function(t){(t=i.asString(t))!==this.selectedMemberPath&&(this._selPath.path=t,this._initSeltems(),this._refreshHeader(),this.onSelectedItemsChanged())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selectedItems",{get:function(){return this._selItems},set:function(t){if(this._selItems=i.asArray(t),this.selectedMemberPath&&""!==this.selectedMemberPath&&this._selItems)for(var e=0;e<this._selItems.length;e++){var n=this._selItems[e];this._setSelItem(n,!1)}this._updateMaxItems(),this.onSelectedItemsChanged(),this._refreshHeader(),this._clearSelIndex()},enumerable:!0,configurable:!0}),e.prototype.onSelectedItemsChanged=function(t){this.selectedItemsChanged.raise(this,t)},e.prototype.onIsDroppedDownChanged=function(e){!this.isDroppedDown&&this.selectedIndex>-1&&!this._notAddItm&&this._addItem(!0),this._notAddItm=!1,t.prototype.onIsDroppedDownChanged.call(this,e)},e.prototype.refresh=function(e){void 0===e&&(e=!0),t.prototype.refresh.call(this,e),this._initSeltems(),this.isDroppedDown||this._refreshHeader()},e.prototype._keydown=function(e){if(!this.isReadOnly){if(!e.defaultPrevented)switch(e.keyCode){case i.Key.Back:this._lastInputValue=this._tbx.value;break;case i.Key.Enter:this._itemOff(),this._addItem(!0),i.isIE&&i.setSelectionRange(this._tbx,0,0);break;case i.Key.Tab:this.isDroppedDown?(this._addItem(!1),this._tbx.value="",this._lbx.selectedIndex=-1,e.preventDefault()):this._updateFocus();break;case i.Key.Space:if(""!==this._tbx.value)return;this.isDroppedDown||this._tbx.disabled||(this.isDroppedDown=!0,this._clearSelIndex());break;case i.Key.Escape:this.isDroppedDown&&(this._notAddItm=!0);break;case i.Key.Left:this._itemOn(!this.rightToLeft);break;case i.Key.Right:this._itemOn(!!this.rightToLeft);break;case i.Key.Up:case i.Key.Down:var n=i.getActiveElement();if(e.altKey){if(this._tbx==n)return this.isDroppedDown=!this.isDroppedDown,this.isDroppedDown||this._tbx.focus(),void e.preventDefault()}else if(this._tbx!==n)return;default:if(e.keyCode===i.Key.Back||e.keyCode===i.Key.Delete)return;this._itemOff(),null!=this._maxtems&&this._selItems.length>=this._maxtems&&e.preventDefault()}this._tbx.disabled||t.prototype._keydown.call(this,e)}},e.prototype._updateState=function(){t.prototype._updateState.call(this),this._wjTpl&&(i.hasClass(this.hostElement,"wj-state-focused")||this._itemOff())},e.prototype._keyup=function(t){if(!this.isReadOnly&&!t.defaultPrevented)switch(t.keyCode){case i.Key.Back:0===this._tbx.value.length&&0===this._lastInputValue.length&&this._delItem(!1);break;case i.Key.Delete:this._delItem(!0)}},e.prototype._addHelperInput=function(){var t=document.createElement("input");t.type="text",t.tabIndex=-1,t.className="wj-token-helper",t.readOnly=!0,this._wjTpl.insertBefore(t,this._wjInput),this._helperInput=t},e.prototype._refreshHeader=function(){for(var t=this.hostElement.querySelectorAll(".wj-token"),e=0;e<t.length;e++)this._wjTpl.removeChild(t[e]);var i=this.selectedItems;if(i&&0!==i.length){for(e=0;e<i.length;e++)this._insertToken(i[e]);this._wjInput.style.cssFloat=this.rightToLeft?"right":"left",this._adjustInputWidth()}},e.prototype._insertToken=function(t){var e=this._getItemText(t,!0);this.isContentHtml?(this._cvt||(this._cvt=document.createElement("div")),this._cvt.innerHTML=e,e=this._cvt.textContent.trim()):e=i.escapeHtml(e),this._wjTpl.insertBefore(this._createItem(e),this._wjInput)},e.prototype._updateMaxItems=function(){null!=this._maxtems&&this._selItems&&this._selItems.length>this._maxtems&&(this._selItems=this._selItems.slice(0,this._maxtems))},e.prototype._updateFocus=function(){var t=this,n=this._wjTpl.querySelector("."+e._clsActive);n?(i.removeClass(n,e._clsActive),setTimeout(function(){t._tbx.focus()})):(this._clearSelIndex(),i.removeClass(this.hostElement,"wj-state-focused"))},e.prototype._addItem=function(t){this.selectedItems.indexOf(this.selectedItem)>-1?this._clearSelIndex():this.selectedIndex>-1&&(this._updateSelItems(this.selectedItem,!0),this._refreshHeader(),t&&this._clearSelIndex(),this._disableInput(!0))},e.prototype._delItem=function(t){var i,n,s=this._wjTpl.querySelector("."+e._clsActive),o=!1;t&&!s||(s?(n=this._getItemIndex(s))>-1&&(i=this._selItems[n],o=!0):this._selItems.length>0&&(i=this._selItems[this._selItems.length-1],o=!0),o&&(this._updateSelItems(i,!1),this._refreshHeader(),this._clearSelIndex(),this._disableInput(!1)),this._tbx.focus())},e.prototype._updateSelItems=function(t,e){if(e){if(this._selItems&&0!==this._selItems.length||(this._selItems=[]),null!=this._maxtems&&this._selItems.length>=this._maxtems)return;this._selItems.push(t)}else{var i=this._selItems.indexOf(t);this._selItems.splice(i,1)}this._hasSelectedMemeberPath()&&this._setSelItem(t,e),this.onSelectedItemsChanged()},e.prototype._createItem=function(t){var n=this,s=document.createElement("div"),o=document.createElement("span"),r=document.createElement("a");return s.appendChild(o),s.appendChild(r),s.className="wj-token",o.className="wj-token-label",o.innerHTML=t,r.className="wj-token-close",r.href="#",r.tabIndex=-1,r.text="×",s.style.cssFloat=this.rightToLeft?"right":"left",this.addEventListener(s,"click",function(t){n._helperInput.focus();var o=n._wjTpl.querySelector("."+e._clsActive);o&&i.removeClass(o,e._clsActive),i.addClass(s,e._clsActive),t.stopPropagation(),t.preventDefault()}),this.addEventListener(r,"click",function(t){if(!n.isReadOnly){var e=n._getItemIndex(s);if(e>-1){var i=n._selItems[e];n._updateSelItems(i,!1)}n._wjTpl.removeChild(s),n._adjustInputWidth(),n._disableInput(!1),n._tbx.focus(),t.stopPropagation(),t.preventDefault()}}),s},e.prototype._itemOn=function(t){var n,s,o,r=i.getActiveElement();if((this._tbx!=r||0===this._tbx.value.length)&&0!==(n=this._wjTpl.querySelectorAll(".wj-token")).length)if(s=this._wjTpl.querySelector("."+e._clsActive),o=this._getItemIndex(s),t){if(0===o)return;-1===o?(i.addClass(n[n.length-1],e._clsActive),this._helperInput.focus()):(i.removeClass(s,e._clsActive),i.addClass(n[o-1],e._clsActive),this._helperInput.focus())}else if(!t){if(-1===o)return;o!==n.length-1?(i.removeClass(s,e._clsActive),i.addClass(n[o+1],e._clsActive),this._helperInput.focus()):(i.removeClass(s,e._clsActive),this._tbx.focus())}},e.prototype._itemOff=function(){var t=this._wjTpl.querySelector("."+e._clsActive);t&&i.removeClass(t,e._clsActive)},e.prototype._initSeltems=function(){if(this.selectedMemberPath&&""!==this.selectedMemberPath){var t=this.itemsSource;if(this._selItems.splice(0,this._selItems.length),t)for(var e=0;e<t.sourceCollection.length;e++)this._getSelItem(e)&&this._selItems.push(t.sourceCollection[e])}},e.prototype._getSelItem=function(t){var e=this.itemsSource.sourceCollection[t];return!(!i.isObject(e)||!this.selectedMemberPath)&&this._selPath.getValue(e)},e.prototype._setSelItem=function(t,e){this.itemsSource;i.isObject(t)&&this._selPath.getValue(t)!=e&&this._selPath.setValue(t,e)},e.prototype._clearSelIndex=function(){this.selectedIndex=-1},e.prototype._hasSelectedMemeberPath=function(){return this.selectedMemberPath&&""!==this.selectedMemberPath},e.prototype._disableInput=function(t){null!=this._maxtems&&(this._selItems.length<this._maxtems?(this._tbx.disabled=!1,this._tbx.focus()):(this._tbx.disabled=!0,this.hostElement.focus()))},e.prototype._adjustInputWidth=function(){this._tbx.style.width="60px";var t,e=i.getElementRect(this.hostElement),n=i.getElementRect(this._tbx),s=getComputedStyle(this._tbx),o=parseInt(s.paddingLeft,10),r=parseInt(s.paddingRight,10);t=this.rightToLeft?n.left+n.width-e.left-o-r-8:e.left+e.width-n.left-o-r-8,this._tbx.style.width=t+"px"},e.prototype._getItemIndex=function(t){for(var e=this.hostElement.querySelectorAll(".wj-token"),i=0;i<e.length;i++)if(t===e[i])return i;return-1},e._clsActive="wj-token-active",e}(d);e.MultiAutoComplete=m;var _;!function(t){t[t.None=0]="None",t[t.Click=1]="Click",t[t.Blur=2]="Blur",t[t.ClickOrBlur=3]="ClickOrBlur"}(_=e.PopupTrigger||(e.PopupTrigger={}));var b=function(t){function e(e,n){var s=t.call(this,e,null,!0)||this;s._showTrigger=_.Click,s._hideTrigger=_.Blur,s._fadeIn=!0,s._fadeOut=!0,s._removeOnHide=!0,s._visible=!1,s._ownerClickBnd=s._ownerClick.bind(s),s._ownerMousedownBnd=s._ownerMouseDown.bind(s),s.showing=new i.Event,s.shown=new i.Event,s.hiding=new i.Event,s.hidden=new i.Event;var o=s.hostElement;return i.addClass(o,"wj-control wj-content wj-popup"),o.getAttribute("tabindex")||(o.tabIndex=0),i.hidePopup(o,!1),s.addEventListener(o,"compositionstart",function(t){s._composing=!0}),s.addEventListener(o,"compositionend",function(t){s._composing=!1}),s.addEventListener(o,"keydown",function(t){if(!t.defaultPrevented){if(t.keyCode!=i.Key.Escape||s._composing||(t.preventDefault(),s.hide()),t.keyCode==i.Key.Enter){var e=s.dialogResultEnter;e&&(t.preventDefault(),s._validateAndHide(e))}t.keyCode==i.Key.Tab&&s.modal&&(t.preventDefault(),i.moveFocus(o,t.shiftKey?-1:1))}}),s.addEventListener(o,"click",function(t){if(t.target instanceof HTMLElement){var e=t.target.className.match(/\bwj-hide[\S]*\b/);e&&e.length>0&&(t.preventDefault(),t.stopPropagation(),s.hide(e[0]))}}),s.addEventListener(document,"wheel",function(t){if(s.isVisible&&s._modal){for(var e=t.target;e&&e!=document.body;e=e.parentElement)if(e.scrollHeight>e.clientHeight)return;t.preventDefault(),t.stopPropagation()}}),s.initialize(n),s}return __extends(e,t),Object.defineProperty(e.prototype,"owner",{get:function(){return this._owner},set:function(t){var e=this._owner;e&&(this.removeEventListener(e,"mousedown"),this.removeEventListener(e,"click")),(e=this._owner=null!=t?i.getElement(t):null)&&(this.addEventListener(e,"mousedown",this._ownerMousedownBnd,!0),this.addEventListener(e,"click",this._ownerClickBnd,!0))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"content",{get:function(){return this.hostElement.firstElementChild},set:function(t){t!=this.content&&(this.hostElement.innerHTML="",t instanceof HTMLElement&&this.hostElement.appendChild(t))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"showTrigger",{get:function(){return this._showTrigger},set:function(t){this._showTrigger=i.asEnum(t,_)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hideTrigger",{get:function(){return this._hideTrigger},set:function(t){this._hideTrigger=i.asEnum(t,_)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fadeIn",{get:function(){return this._fadeIn},set:function(t){this._fadeIn=i.asBoolean(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fadeOut",{get:function(){return this._fadeOut},set:function(t){this._fadeOut=i.asBoolean(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"removeOnHide",{get:function(){return this._removeOnHide},set:function(t){this._removeOnHide=i.asBoolean(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"modal",{get:function(){return this._modal},set:function(t){this._modal=i.asBoolean(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isDraggable",{get:function(){return this._draggable},set:function(t){this._draggable=i.asBoolean(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dialogResult",{get:function(){return this._result},set:function(t){this._result=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dialogResultEnter",{get:function(){return this._resultEnter},set:function(t){this._resultEnter=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isVisible",{get:function(){var t=this.hostElement;return this._visible&&null!=t&&t.offsetHeight>0},enumerable:!0,configurable:!0}),e.prototype.show=function(t,e){var n=this;if(!this.isVisible){var s=this.hostElement;this.dialogResult=null,this._callback=null,this._hideAnim&&(clearInterval(this._hideAnim),this._hideAnim=null);var o=new i.CancelEventArgs;this.onShowing(o)&&(null!=t&&(this.modal=i.asBoolean(t)),null!=e&&(this._callback=i.asFunction(e)),i.showPopup(s,this._owner,!1,this._fadeIn,!1),this._modal&&this._showBackdrop(),this._composing=!1,this._visible=!0,this.onShown(o),this.modal&&this.addEventListener(window,"focus",function(){n.containsFocus()||i.moveFocus(s,0)}),this._makeDraggable(this._draggable),setTimeout(function(){if(!n.isTouching){var t=s.querySelector("input[autofocus]");t&&t.clientHeight>0&&!t.disabled&&t.tabIndex>-1&&!i.closest(t,"[disabled],.wj-state-disabled")?(t.focus(),t.select()):i.moveFocus(s,0)}n.containsFocus()||(s.tabIndex=0,s.focus())},200))}},e.prototype.hide=function(t){var e=this;if(this._makeDraggable(!1),this.isVisible){i.isUndefined(t)||(this.dialogResult=t);var n=new i.CancelEventArgs;if(this.onHiding(n)){for(var s=this.hostElement.querySelectorAll(".wj-control.wj-dropdown"),r=0;r<s.length;r++){var a=i.Control.getControl(s[r]);a instanceof o&&(a.isDroppedDown=!1)}this._bkdrop&&i.hidePopup(this._bkdrop,this.removeOnHide,this.fadeOut),this._hideAnim=i.hidePopup(this.hostElement,this.removeOnHide,this.fadeOut),this._visible=!1,this.removeEventListener(window,"focus"),this.containsFocus()&&i.getActiveElement().blur(),setTimeout(function(){e._updateState(),e.onHidden(n),e._callback&&e._callback(e)})}}},e.prototype.onShowing=function(t){return this.showing.raise(this,t),!t.cancel},e.prototype.onShown=function(t){this.shown.raise(this,t)},e.prototype.onHiding=function(t){return this.hiding.raise(this,t),!t.cancel},e.prototype.onHidden=function(t){this.hidden.raise(this,t)},e.prototype.dispose=function(){this.owner=null,t.prototype.dispose.call(this)},e.prototype.onLostFocus=function(e){this.isVisible&&this._hideTrigger&_.Blur&&(this.containsFocus()||this.hide()),t.prototype.onLostFocus.call(this,e)},e.prototype.refresh=function(e){if(void 0===e&&(e=!0),t.prototype.refresh.call(this,e),this.isVisible&&!this._refreshing){this._refreshing=!0;var n=i.getActiveElement(),s=this._owner?this._owner.getBoundingClientRect():null;i.showPopup(this.hostElement,s),this._modal&&n instanceof HTMLElement&&n!=i.getActiveElement()&&n.focus(),this._refreshing=!1}},e.prototype._makeDraggable=function(t){var e,n,s=this,o=this.hostElement,r=o?o.querySelector(".wj-dialog-header"):null,a=document,l="mouseup",h="touchend",c=function(t){o&&i.contains(r,t.target)&&(e=new i.Point(o.offsetLeft,o.offsetTop),n=i.mouseToPage(t),["mousemove",l,"touchmove",h].forEach(function(t){s.removeEventListener(a,t)}),["mousemove","touchmove"].forEach(function(t){s.addEventListener(a,t,u)}),[l,h].forEach(function(t){s.addEventListener(a,t,d)}))},u=function(t){var r=i.mouseToPage(t);i.setCss(o,{left:Math.max(e.x+(r.x-n.x),50-o.offsetWidth),top:Math.max(e.y+(r.y-n.y),0)}),s._dragged=!0},d=function(t){["mousemove",l,"touchmove",h].forEach(function(t){s.removeEventListener(a,t)})};["mousedown","touchstart"].forEach(function(t){s.removeEventListener(a,t)}),this._dragged=!1,r&&(i.setCss(r,{touchAction:t?"none":""}),t&&["mousedown","touchstart"].forEach(function(t){s.addEventListener(a,t,c)}))},e.prototype._handleResize=function(){this.isVisible&&!this._dragged&&this.refresh()},e.prototype._ownerClick=function(t){this.isVisible?this._hideTrigger&_.Click&&this.hide():this._showTrigger&_.Click&&(this._wasVisible||this.show())},e.prototype._ownerMouseDown=function(t){this._wasVisible=this.isVisible},e.prototype._showBackdrop=function(){var t=this;this._bkdrop||(this._bkdrop=document.createElement("div"),this._bkdrop.tabIndex=-1,i.addClass(this._bkdrop,"wj-popup-backdrop"),this.addEventListener(this._bkdrop,"mousedown",function(e){e.preventDefault(),e.stopPropagation(),t.hostElement.focus(),t.hideTrigger&_.Blur&&t.hide()})),i.setCss(this._bkdrop,{zIndex:i.Control._POPUP_ZINDEX,display:""});var e=this.hostElement;e.parentElement.insertBefore(this._bkdrop,e)},e.prototype._validateAndHide=function(t){var e=this.hostElement.querySelector(":invalid");e?e.focus():this.hide(t)},e}(i.Control);e.Popup=b;var g=function(t){function e(e,n){var s=t.call(this,e)||this;if(s._format="d",s.valueChanged=new i.Event,i.addClass(s.hostElement,"wj-inputdate"),s._msk=new i._MaskProvider(s._tbx),i.isIE9()||(s.inputType="tel"),s._tbx.type.match(/date/i)&&(s.inputType=""),s.addEventListener(s.hostElement,"wheel",function(t){if(!t.defaultPrevented&&!s.isDroppedDown&&s.containsFocus()&&null!=s.value&&s._canChangeValue()){var e=i.clamp(-t.deltaY,-1,1);s.value=s.selectionMode==r.Month?i.DateTime.addMonths(s.value,e):i.DateTime.addDays(s.value,e),s.selectAll(),t.preventDefault()}}),s.value=i.DateTime.newDate(),"INPUT"==s._orgTag){var o=s._tbx.getAttribute("value");o&&(s.value=i.Globalize.parseDate(o,"yyyy-MM-dd"))}return s.isRequired=!0,s.initialize(n),s}return __extends(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this._value},set:function(t){if(i.DateTime.equals(this._value,t))this._tbx.value=i.Globalize.format(t,this.format);else{var e=!this.isRequired||null==t&&null==this.value;t=i.asDate(t,e),t=this._clamp(t),this._isValidDate(t)?(this._tbx.value=t?i.Globalize.format(t,this.format):"",t==this._value||i.DateTime.equals(this._value,t)||(this._value=t,this.onValueChanged())):this._tbx.value=t?i.Globalize.format(this.value,this.format):"",this.text!=this._oldText&&(this._oldText=this.text,this.onTextChanged())}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._tbx.value},set:function(t){t!=this.text&&(this._setText(t,!0),this._commitText())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selectionMode",{get:function(){return this.calendar.selectionMode},set:function(t){this.calendar.selectionMode=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"min",{get:function(){return this._calendar.min},set:function(t){this._calendar.min=i.asDate(t,!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"max",{get:function(){return this._calendar.max},set:function(t){this._calendar.max=i.asDate(t,!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"format",{get:function(){return this._format},set:function(t){t!=this.format&&(this._format=i.asString(t),this._tbx.value=i.Globalize.format(this.value,this.format))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mask",{get:function(){return this._msk.mask},set:function(t){this._msk.mask=i.asString(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"calendar",{get:function(){return this._calendar},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"inputElement",{get:function(){return this._tbx},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"inputType",{get:function(){return this._tbx.type},set:function(t){this._tbx.type=i.asString(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"itemValidator",{get:function(){return this._calendar.itemValidator},set:function(t){t!=this.itemValidator&&(this._calendar.itemValidator=i.asFunction(t),this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"itemFormatter",{get:function(){return this.calendar.itemFormatter},set:function(t){t!=this.itemFormatter&&(this.calendar.itemFormatter=i.asFunction(t))},enumerable:!0,configurable:!0}),e.prototype.onValueChanged=function(t){this.valueChanged.raise(this,t)},e.prototype.refresh=function(e){void 0===e&&(e=!0),t.prototype.refresh.call(this,e),this.isDroppedDown=!1,this._msk&&this._msk.refresh(),this._calendar&&this._calendar.refresh(),this._tbx.value=i.Globalize.format(this.value,this.format)},e.prototype.onIsDroppedDownChanged=function(e){t.prototype.onIsDroppedDownChanged.call(this,e),this.isDroppedDown&&(this._calChanged=!1,this.dropDown.focus(),this._calendar.refresh())},e.prototype._createDropDown=function(){var t=this;this._calendar=new a(this._dropDown),this._calendar.valueChanged.addHandler(function(){t.value=i.DateTime.fromDateTime(t._calendar.value,t.value),t._calChanged=!0}),this.addEventListener(this._dropDown,"click",function(e){t._calChanged&&!i.closest(e.target,".wj-calendar-header")?t.isDroppedDown=!1:"btn-today"==e.target.getAttribute("wj-part")&&(t.isDroppedDown=!1)})},e.prototype._updateDropDown=function(){this._commitText();var e=this._calendar;e.value=this.value,e.min=this.min,e.max=this.max,this.selectionMode!=r.Month&&(e.monthView=!0);var i=getComputedStyle(this.hostElement);this._dropDown.style.minWidth=18*parseFloat(i.fontSize)+"px",this._calendar.refresh(),t.prototype._updateDropDown.call(this)},e.prototype._keydown=function(e){if(!(e.defaultPrevented||e.altKey||e.ctrlKey||e.metaKey))switch(e.keyCode){case i.Key.Enter:this._commitText(),this.selectAll();break;case i.Key.Escape:this.text=i.Globalize.format(this.value,this.format),this.selectAll();break;case i.Key.Up:case i.Key.Down:if(!this.isDroppedDown&&this.value&&this._canChangeValue()){var n=e.keyCode==i.Key.Up?1:-1,s=this.selectionMode==r.Month?i.DateTime.addMonths(this.value,n):i.DateTime.addDays(this.value,n);this.value=i.DateTime.fromDateTime(s,this.value),this.selectAll(),e.preventDefault()}}t.prototype._keydown.call(this,e)},e.prototype._canChangeValue=function(){return!this.isReadOnly&&this.selectionMode!=r.None},e.prototype._clamp=function(t){return this.calendar._clamp(t)},e.prototype._commitText=function(){var t=this._tbx.value;if(t||this.isRequired){var e=i.Globalize.parseDate(t,this.format,this.value);e?this.value=i.DateTime.fromDateTime(e,this.value):this._tbx.value=i.Globalize.format(this.value,this.format)}else this.value=null},e.prototype._isValidDate=function(t){if(t){if(this._clamp(t)!=t)return!1;if(this.itemValidator&&!this.itemValidator(t))return!1}return!0},e}(o);e.InputDate=g;var y=function(t){function e(e,n){var s=t.call(this,e)||this;if(s._format="t",s.valueChanged=new i.Event,i.addClass(s.hostElement,"wj-inputtime"),s._value=i.DateTime.newDate(),s._msk=new i._MaskProvider(s._tbx),i.isIE9()||(s._tbx.type="tel"),"INPUT"==s._orgTag){var o=s._tbx.getAttribute("value");o&&(s.value=i.Globalize.parseDate(o,"HH:mm:ss"))}return s.step=15,s.autoExpandSelection=!0,s.initialize(n),s}return __extends(e,t),Object.defineProperty(e.prototype,"inputElement",{get:function(){return this._tbx},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"inputType",{get:function(){return this._tbx.type},set:function(t){this._tbx.type=i.asString(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this._value},set:function(t){(t=i.asDate(t,!this.isRequired))&&(null!=this._min&&this._getTime(t)<this._getTime(this._min)&&(t=i.DateTime.fromDateTime(t,this._min)),null!=this._max&&this._getTime(t)>this._getTime(this._max)&&(t=i.DateTime.fromDateTime(t,this._max))),this._setText(t?i.Globalize.format(t,this.format):"",!0),this.selectedItem&&this.selectedItem.value&&(t=i.DateTime.fromDateTime(t,this.selectedItem.value)),t==this._value||i.DateTime.equals(t,this._value)||(this._value=t,this.onValueChanged())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._tbx.value},set:function(t){t!=this.text&&(this._setText(t,!0),this._commitText())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"min",{get:function(){return this._min},set:function(t){this._min=i.asDate(t,!0),this.isDroppedDown=!1,this._updateItems()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"max",{get:function(){return this._max},set:function(t){this._max=i.asDate(t,!0),this.isDroppedDown=!1,this._updateItems()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"step",{get:function(){return this._step},set:function(t){this._step=i.asNumber(t,!0),this.isDroppedDown=!1,this._updateItems()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"format",{get:function(){return this._format},set:function(t){t!=this.format&&(this._format=i.asString(t),this._tbx.value=i.Globalize.format(this.value,this.format),i.hasItems(this.collectionView)&&this._updateItems())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mask",{get:function(){return this._msk.mask},set:function(t){this._msk.mask=i.asString(t)},enumerable:!0,configurable:!0}),e.prototype.onValueChanged=function(t){this.valueChanged.raise(this,t)},e.prototype.onItemsSourceChanged=function(e){t.prototype.onItemsSourceChanged.call(this,e),this._hasCustomItems=null!=this.itemsSource},e.prototype._updateInputSelection=function(e){if(this._delKey)t.prototype._updateInputSelection.call(this,e);else{for(var n=this._tbx.value;e<n.length&&!n[e].match(/[a-z0-9]/i);)e++;i.setSelectionRange(this._tbx,e,this._tbx.value.length)}},e.prototype.refresh=function(e){void 0===e&&(e=!0),t.prototype.refresh.call(this,e),this.isDroppedDown=!1,this._msk.refresh(),this._tbx.value=i.Globalize.format(this.value,this.format),this._updateItems()},e.prototype.onSelectedIndexChanged=function(e){if(this.selectedIndex>-1&&!this._settingText){var n=this.value?this.value:i.DateTime.newDate(),s=null!=this.selectedItem.value?this.selectedItem.value:i.Globalize.parseDate(this.text,this.format,this.value);this.value=i.DateTime.fromDateTime(n,s)}t.prototype.onSelectedIndexChanged.call(this,e)},e.prototype._updateItems=function(){if(!this._hasCustomItems){var t=[],e=i.DateTime.newDate(0,0,0,0,0),n=i.DateTime.newDate(0,0,0,23,59,59);if(this.min&&e.setHours(this.min.getHours(),this.min.getMinutes(),this.min.getSeconds()),this.max&&n.setHours(this.max.getHours(),this.max.getMinutes(),this.max.getSeconds()),i.isNumber(this.step)&&this.step>0)for(var s=e;s<=n;s=i.DateTime.addMinutes(s,this.step))t.push({value:s,text:i.Globalize.format(s,this.format)});var o=this.value;this._settingText=!0,this.displayMemberPath="text",this.selectedValuePath="text",this.itemsSource=t,this._hasCustomItems=!1,this._settingText=!1,this.value=o}},e.prototype._getTime=function(t){return 3600*t.getHours()+60*t.getMinutes()+t.getSeconds()},e.prototype._keydown=function(e){if(t.prototype._keydown.call(this,e),!e.defaultPrevented)switch(e.keyCode){case i.Key.Enter:this.isDroppedDown||(this._commitText(),this.selectAll());break;case i.Key.Escape:this.text=i.Globalize.format(this.value,this.format),this.selectAll()}},e.prototype._commitText=function(){if(this.text||this.isRequired){var t=this.value?i.Globalize.format(this.value,this.format):null;if(this.text!=t){var e=this.selectedItem&&this.selectedItem.value?this.selectedItem.value:i.Globalize.parseDate(this.text,this.format,this.value);e?this.value=i.DateTime.fromDateTime(this.value,e):this.text=t}}else this.value=null},e}(u);e.InputTime=y,i._addCultureInfo("InputDateTime",{ariaLabels:{tglDate:"Toggle Calendar",tglTime:"Toggle Time List"}});var v=function(t){function e(e,n){var s=t.call(this,e)||this;i.addClass(s.hostElement,"wj-inputdatetime"),s._btnTm=s.hostElement.querySelector('[wj-part="btn-tm"]');var o=i.culture.InputDateTime.ariaLabels;i.setAriaLabel(s._btn,o.tglDate),i.setAriaLabel(s._btnTm,o.tglTime),s._format="g",s._inputTime=new y(document.createElement("div"),{isDroppedDownChanging:function(t,e){s._hadFocus=s.containsFocus()},isDroppedDownChanged:function(t,e){!t.isDroppedDown&&s._hadFocus&&s._tbx.focus()},valueChanged:function(t,e){s.value=i.DateTime.fromDateTime(s.value,t.value)}});var r=s._inputTime.dropDown,a=s._keydown.bind(s);return s.addEventListener(r,"keydown",a,!0),s.addEventListener(r,"blur",function(){s._updateFocusState()},!0),s.addEventListener(s._btn,"mousedown",function(t){s._setDropdown(s.calendar.hostElement)}),s.addEventListener(s._btnTm,"mousedown",function(t){s._inputTime.dropDownCssClass=s.dropDownCssClass,s._setDropdown(r),setTimeout(function(){s._btnclick(t)})}),s.initialize(n),s}return __extends(e,t),Object.defineProperty(e.prototype,"timeMin",{get:function(){return this._inputTime.min},set:function(t){this._inputTime.min=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"timeMax",{get:function(){return this._inputTime.max},set:function(t){this._inputTime.max=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"timeFormat",{get:function(){return this._inputTime.format},set:function(t){this._inputTime.format=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"timeStep",{get:function(){return this._inputTime.step},set:function(t){this._inputTime.step=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"inputTime",{get:function(){return this._inputTime},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this._setDropdown(this.calendar.hostElement),t.prototype.dispose.call(this),this._inputTime.dispose()},e.prototype.refresh=function(e){void 0===e&&(e=!0),this._setDropdown(this.calendar.hostElement),this._inputTime.refresh(),t.prototype.refresh.call(this,e)},e.prototype._updateBtn=function(){t.prototype._updateBtn.call(this),this._btnTm&&(this._btnTm.tabIndex=this._btn.tabIndex,this._btnTm.parentElement.style.display=this._btn.style.display)},e.prototype._clamp=function(t){return t&&(this.min&&t<this.min&&(t=this.min),this.max&&t>this.max&&(t=this.max)),t},e.prototype._commitText=function(){var t=this._tbx.value;if(t||this.isRequired){var e=i.Globalize.parseDate(t,this.format,this.value);e?this.value=e:this._tbx.value=i.Globalize.format(this.value,this.format)}else this.value=null},e.prototype._setDropdown=function(t){this._dropDown!=t&&(this.isDroppedDown&&(this.isDroppedDown=!1),this._dropDown=t)},e.prototype._updateDropDown=function(){var e=this._inputTime;this._dropDown==e.dropDown?(this._commitText(),t.prototype._updateDropDown.call(this),e.isRequired=this.isRequired,e.value=this.value,this.isDroppedDown&&e.listBox.showSelection()):t.prototype._updateDropDown.call(this)},e.controlTemplate='<div class="wj-template" style="position:relative"><div class="wj-input"><div class="wj-input-group wj-input-btn-visible"><input wj-part="input" type="text" class="wj-form-control" /><span class="wj-input-group-btn"><button wj-part="btn" class="wj-btn wj-btn-default" tabindex="-1"><span class="wj-glyph-calendar"></span></button><button wj-part="btn-tm" class="wj-btn wj-btn-default" tabindex="-1"><span class="wj-glyph-clock"></span></button></span></div></div><div wj-part="dropdown" class="wj-content wj-dropdown-panel" style="display:none"></div></div>',e}(g);e.InputDateTime=v,i._addCultureInfo("InputNumber",{ariaLabels:{incVal:"Increase Value",decVal:"Decrease Value"}});var w=function(t){function e(e,n){var s=t.call(this,e)||this;s._showBtn=!0,s._readOnly=!1,s.textChanged=new i.Event,s.valueChanged=new i.Event;var o=s.hostElement;i.setAttribute(o,"role","spinbutton",!0);var r=s.getTemplate();s.applyTemplate("wj-control wj-content wj-inputnumber",r,{_tbx:"input",_btnUp:"btn-inc",_btnDn:"btn-dec"},"input");var a=i.culture.InputNumber.ariaLabels;i.setAriaLabel(s._btnUp.querySelector("button"),a.incVal),i.setAriaLabel(s._btnDn.querySelector("button"),a.decVal),s._tbx.type.match(/number/i)&&(s.inputType="");var l=s._tbx;l.autocomplete="off",l.spellcheck=!1,s._updateSymbols(),s.addEventListener(s._tbx,"compositionstart",function(){s._composing=!0}),s.addEventListener(s._tbx,"compositionend",function(){s._composing=!1,setTimeout(function(){var t=s.text;s._oldText.indexOf(s._chrPct)>-1&&t.indexOf(s._chrPct)<0&&(t+=s._chrPct),s._setText(t)})}),s.addEventListener(l,"keypress",s._keypress.bind(s)),s.addEventListener(l,"keydown",s._keydown.bind(s)),s.addEventListener(l,"input",s._input.bind(s));var h=s._clickSpinner.bind(s);return s.addEventListener(s._btnUp,"click",h),s.addEventListener(s._btnDn,"click",h),s._rptUp=new i._ClickRepeater(s._btnUp.querySelector("button")),s._rptDn=new i._ClickRepeater(s._btnDn.querySelector("button")),s.addEventListener(o,"wheel",function(t){if(!t.defaultPrevented&&!s.isReadOnly&&s.containsFocus()){var e=i.clamp(-t.deltaY,-1,1);s._increment((s.step||1)*e),setTimeout(function(){return s.selectAll()}),t.preventDefault()}}),s.value=0,s.isRequired=!0,s.initialize(n),s}return __extends(e,t),Object.defineProperty(e.prototype,"inputElement",{get:function(){return this._tbx},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"inputType",{get:function(){return this._tbx.type},set:function(t){this._tbx.type=i.asString(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this._value},set:function(t){if(t!=this._value)if(null==(t=i.asNumber(t,!this.isRequired||null==t&&null==this._value)))this._setText("");else if(!isNaN(t)){var e=i.Globalize.format(t,this.format);this._setText(e)}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isRequired",{get:function(){return this._tbx.required},set:function(t){this._tbx.required=i.asBoolean(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isReadOnly",{get:function(){return this._readOnly},set:function(t){this._readOnly=i.asBoolean(t),this.inputElement.readOnly=this._readOnly,i.toggleClass(this.hostElement,"wj-state-readonly",this.isReadOnly)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"min",{get:function(){return this._min},set:function(t){t!=this._min&&(this._min=i.asNumber(t,!0),this._updateAria())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"max",{get:function(){return this._max},set:function(t){t!=this._max&&(this._max=i.asNumber(t,!0),this._updateAria())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"step",{get:function(){return this._step},set:function(t){this._step=i.asNumber(t,!0),this._updateBtn()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"format",{get:function(){return this._format},set:function(t){t!=this.format&&(this._format=i.asString(t),this.refresh())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._tbx.value},set:function(t){t!=this.text&&(this._oldText=null,this._setText(t))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"placeholder",{get:function(){return this._tbx.placeholder},set:function(t){this._tbx.placeholder=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"showSpinner",{get:function(){return this._showBtn},set:function(t){this._showBtn=i.asBoolean(t),this._updateBtn()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"repeatButtons",{get:function(){return!this._rptUp.disabled},set:function(t){this._rptUp.disabled=this._rptDn.disabled=!i.asBoolean(t)},enumerable:!0,configurable:!0}),e.prototype.selectAll=function(){var t=this._tbx;i.setSelectionRange(t,0,t.value.length)},e.prototype.clamp=function(t){return i.clamp(t,this.min,this.max)},e.prototype.onTextChanged=function(t){this.textChanged.raise(this,t),this._updateState()},e.prototype.onValueChanged=function(t){this._updateAria(),this.valueChanged.raise(this,t)},e.prototype.dispose=function(){this._rptUp.element=null,this._rptDn.element=null,t.prototype.dispose.call(this)},e.prototype.onGotFocus=function(e){this.isTouching||(this._tbx.focus(),this.selectAll()),t.prototype.onGotFocus.call(this,e)},e.prototype.onLostFocus=function(e){this._composing&&(this._composing=!1,this._setText(this.text));var n=this.clamp(this.value),s=i.Globalize.format(n,this.format);this._setText(s),t.prototype.onLostFocus.call(this,e)},e.prototype.refresh=function(e){void 0===e&&(e=!0),t.prototype.refresh.call(this,e),this._updateSymbols();var n=i.Globalize.format(this.value,this.format);this._setText(n)},e.prototype._updateSymbols=function(){var t=i.culture.Globalize.numberFormat,e=this.format?this.format.match(/([a-z])(\d*)(,*)(.*)/i):null;this._chrDec=t["."]||".",this._chrNeg=t["-"]||"-",this._chrPls=t["+"]||"+",this._chrPct=t["%"]||"%",this._chrCur=e&&e[4]?e[4]:t.currency.symbol||"$",this._fmtSpc=e&&e[1]?e[1].toLowerCase():"n",this._fmtPrc=e&&e[2]?parseInt(e[2]):null,this._rxSym=new RegExp("^[%+\\-() \\"+this._chrDec+"\\"+this._chrCur+"\\"+this._chrNeg+"\\"+this._chrPls+"\\"+this._chrPct+"]*$"),this._rxNeg=new RegExp("(\\-|\\(|\\"+this._chrNeg+")")},e.prototype._isNumeric=function(t,e){var i=t==this._chrDec||t>="0"&&t<="9",n="x"==this._fmtSpc;return!i&&n&&(i=t>="a"&&t<="f"||t>="A"&&t<="F"),i||e||n||(i=t==this._chrPls||t==this._chrNeg||"("==t||")"==t),i},e.prototype._getInputRange=function(t){for(var e=[0,0],i=this.text,n=!1,s=0;s<i.length;s++)this._isNumeric(i[s],t)&&(n||(e[0]=s,n=!0),e[1]=s+1);return e},e.prototype._flipSign=function(){var t=this._getSelStartDigits();this.value*=-1,this._setSelStartDigits(t)},e.prototype._getSelStartDigits=function(){for(var t=0,e=this._tbx.selectionStart,i=this._tbx.value,n=0;n<i.length&&n<e;n++)this._isNumeric(i[n],!0)&&t++;return t},e.prototype._setSelStartDigits=function(t){for(var e=this._tbx.value,n=0;n<e.length&&t>=0;n++)if(this._isNumeric(e[n],!0)){if(!t){i.setSelectionRange(this._tbx,n);break}t--}else if(!t){i.setSelectionRange(this._tbx,n);break}},e.prototype._increment=function(t){if(t){var e=this.clamp(i.isNumber(this.value)?this.value+t:0),n=i.Globalize.format(e,this.format,!1,!1);this._setText(n)}},e.prototype._updateBtn=function(){var t=this.showSpinner&&!!this.step,e=t;i.setCss([this._btnUp,this._btnDn],{display:t?"":"none"}),i.toggleClass(this.hostElement,"wj-input-show-spinner",t),i.enable(this._btnUp,e),i.enable(this._btnDn,e),this._updateAria()},e.prototype._setText=function(t){if(!this._composing){var e=this._tbx,n=this._rxNeg.test(t),s=this._delKey;if(t&&this._rxSym.test(t)&&(t=this.isRequired||!s?"0":""),this._delKey=!1,s&&0==this.value&&!this.isRequired&&(t=""),!t){if(!this.isRequired)return e.value="",null!=this._value&&(this._value=null,this.onValueChanged()),this._oldText&&(this._oldText=t,this.onTextChanged()),void this._updateBtn();t="0"}var o=this._format||(t.indexOf(this._chrDec)>-1?"n2":"n0"),r=i.Globalize.parseFloat(t,o);if(isNaN(r))e.value=this._oldText;else{var a=i.Globalize.format(r,o,!1);n&&r>=0&&!s&&(a=this._chrNeg+a),null!=this._fmtPrc&&"g"!=this._fmtSpc||!s&&e.value.match(/\.0?$/)&&(a=t+("0"==t?this._chrDec:"")),e.value!=a&&("g"==this._fmtSpc&&e.value.match(a+"0*")&&this.containsFocus()&&e.selectionStart==e.value.length&&(a=e.value),e.value=a,r=i.Globalize.parseFloat(a,this.format)),r!=this._value&&(this._value=r,this.onValueChanged()),this.text!=this._oldText&&(this._oldText=this.text,this.onTextChanged()),this._updateBtn()}}},e.prototype._keypress=function(t){if(!(t.defaultPrevented||this._composing||this.isReadOnly)&&t.charCode&&!t.ctrlKey&&!t.metaKey){var e=this._tbx,n=String.fromCharCode(t.charCode);if(this._isNumeric(n,!1)){var s=this._getInputRange(!0),o=e.selectionStart,r=e.selectionEnd;if(o<s[0]&&r<e.value.length&&(r=Math.max(r,s[0]),i.setSelectionRange(e,s[0],r)),o>=s[1]){var a=null!=this._fmtPrc?this._fmtPrc:2,l=e.value.indexOf(this._chrDec);l>-1&&o-l>a&&t.preventDefault()}}else t.preventDefault();switch(n){case"-":case this._chrNeg:this.min>=0?this.value<0&&this._flipSign():this.value&&e.selectionStart==e.selectionEnd?this._flipSign():this.clamp(-1)<0&&(e.value=this._chrNeg,i.setSelectionRange(e,1)),t.preventDefault();break;case"+":case this._chrPls:this.value<0&&this._flipSign(),t.preventDefault();break;case this._chrDec:if(0==this._fmtPrc)t.preventDefault();else{var h=e.value.indexOf(n);h>-1&&(e.selectionStart<=h&&h++,i.setSelectionRange(e,h),t.preventDefault())}}}},e.prototype._keydown=function(t){var e=this;if(this._delKey=!1,!t.defaultPrevented&&!this._composing){var n=this._tbx,s=n.value,o=n.selectionStart,r=n.selectionEnd;switch(t.keyCode){case 65:t.ctrlKey&&(setTimeout(function(){e.selectAll()}),t.preventDefault());break;case i.Key.Up:case i.Key.Down:this.step&&!this.isReadOnly&&(this._increment(this.step*(t.keyCode==i.Key.Up?1:-1)),setTimeout(function(){e.selectAll()}),t.preventDefault());break;case i.Key.Back:if(this._delKey=!0,r-o<2&&!this.isReadOnly){var a=s[r-1];a!=this._chrDec&&a!=this._chrPct&&")"!=a||(setTimeout(function(){r=a==e._chrPct?e._getInputRange(!0)[1]:r-1,i.setSelectionRange(n,r)}),t.preventDefault())}break;case i.Key.Delete:if(this._delKey=!0,r-o<2&&!this.isReadOnly)if("0"==s&&1==o)i.setSelectionRange(n,0);else{var l=s[o];l!=this._chrDec&&l!=this._chrPct||(setTimeout(function(){i.setSelectionRange(n,o+1)}),t.preventDefault())}}}},e.prototype._input=function(t){var e=this;this._composing||setTimeout(function(){var t=e._tbx,n=t.value,s=n.indexOf(e._chrDec),o=t.selectionStart,r=e._getSelStartDigits();if("p"==e._fmtSpc&&n.length&&n.indexOf(e._chrPct)<0&&(n+=e._chrPct),e._setText(n),e.containsFocus()){var a=t.value,l=a.indexOf(e._chrDec),h=e._getInputRange(!0);if(n==e._chrNeg+e._chrDec&&l>-1)return void i.setSelectionRange(t,l+1);if(n[0]==e._chrNeg&&a[0]!=e._chrNeg)return void(1==a.length?i.setSelectionRange(t,1):e._setSelStartDigits(r));n?n==e._chrDec&&l>-1?o=l+1:o<=s&&l>-1||s<0&&l<0?o+=a.length-n.length:s<0&&l>-1&&(o=l):o=l>-1?l:h[1],o=i.clamp(o,h[0],h[1]),i.setSelectionRange(t,o)}})},e.prototype._clickSpinner=function(t){var e=this;t.defaultPrevented||this.isReadOnly||!this.step||(this._increment(this.step*(i.contains(this._btnUp,t.target)?1:-1)),this.isTouching||setTimeout(function(){return e.selectAll()}))},e.prototype._updateAria=function(){var t=this.hostElement;t&&(i.setAttribute(t,"aria-valuemin",this.min),i.setAttribute(t,"aria-valuemax",this.max),i.setAttribute(t,"aria-valuenow",this.value))},e.controlTemplate='<div class="wj-input"><div class="wj-input-group"><span wj-part="btn-dec" class="wj-input-group-btn" tabindex="-1"><button class="wj-btn wj-btn-default" tabindex="-1">-</button></span><input type="tel" wj-part="input" class="wj-form-control wj-numeric"/><span wj-part="btn-inc" class="wj-input-group-btn" tabindex="-1"><button class="wj-btn wj-btn-default" tabindex="-1">+</button></span></div></div>',e}(i.Control);e.InputNumber=w;var x=function(t){function e(e,n){var s=t.call(this,e)||this;s.valueChanged=new i.Event;var o=s.getTemplate();if(s.applyTemplate("wj-control wj-content wj-inputmask",o,{_tbx:"input"},"input"),"INPUT"==s._orgTag){var r=s._tbx.getAttribute("value");r&&(s.value=r)}return s._msk=new i._MaskProvider(s._tbx),s.isRequired=!0,s.initialize(n),s.addEventListener(s._tbx,"input",function(){setTimeout(function(){s.onValueChanged()})}),s}return __extends(e,t),Object.defineProperty(e.prototype,"inputElement",{get:function(){return this._tbx},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this._tbx.value},set:function(t){t!=this.value&&(this._tbx.value=i.asString(t),t=this._msk._applyMask(),this._tbx.value=t,this.onValueChanged())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rawValue",{get:function(){return this._msk.getRawValue()},set:function(t){t!=this.rawValue&&(this.value=i.asString(t))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mask",{get:function(){return this._msk.mask},set:function(t){var e=this.value;this._msk.mask=i.asString(t),this.value!=e&&this.onValueChanged()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"promptChar",{get:function(){return this._msk.promptChar},set:function(t){var e=this.value;this._msk.promptChar=t,this.value!=e&&this.onValueChanged()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"placeholder",{get:function(){return this._tbx.placeholder},set:function(t){this._tbx.placeholder=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maskFull",{get:function(){return this._msk.maskFull},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isRequired",{get:function(){return this._tbx.required},set:function(t){this._tbx.required=i.asBoolean(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isReadOnly",{get:function(){return this._tbx.readOnly},set:function(t){this._tbx.readOnly=i.asBoolean(t),i.toggleClass(this.hostElement,"wj-state-readonly",this.isReadOnly)},enumerable:!0,configurable:!0}),e.prototype.selectAll=function(){var t=this._msk.getMaskRange();i.setSelectionRange(this._tbx,t[0],t[1]+1)},e.prototype.onValueChanged=function(t){this.value!=this._oldValue&&(this._oldValue=this.value,this.valueChanged.raise(this,t)),this._updateState()},e.prototype._updateState=function(){t.prototype._updateState.call(this);var e=!this._pristine&&this._tbx.value&&!this.maskFull;i.toggleClass(this.hostElement,"wj-state-invalid",e)},e.prototype.dispose=function(){this._msk.input=null,t.prototype.dispose.call(this)},e.prototype.refresh=function(e){void 0===e&&(e=!0),t.prototype.refresh.call(this,e),this._msk.refresh()},e.prototype.onGotFocus=function(e){t.prototype.onGotFocus.call(this,e),this.selectAll()},e.controlTemplate='<div class="wj-input"><div class="wj-input-group"><input wj-part="input" class="wj-form-control"/></div></div>',e}(i.Control);e.InputMask=x;var D=function(t){function e(e,n){var s=t.call(this,e)||this;s.valueChanged=new i.Event,i.addClass(s.hostElement,"wj-inputcolor"),s._tbx.style.paddingLeft="24px";return s._ePreview=i.createElement('<div class="wj-inputcolorbox" style="position:absolute;left:6px;top:6px;width:12px;bottom:6px;border:1px solid black"></div>',s.hostElement.firstElementChild),"INPUT"==s._orgTag&&(s._tbx.type="",s._commitText()),s.value="#ffffff",s.isRequired=!0,s.initialize(n),s.addEventListener(s._colorPicker.hostElement,"click",function(t){var e=t.target;e&&"DIV"==e.tagName&&(i.closest(e,'[wj-part="div-pal"]')||i.closest(e,'[wj-part="div-pv"]'))&&e.style.backgroundColor&&(s.isDroppedDown=!1)}),s}return __extends(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this._value},set:function(t){t!=this.value&&(!t&&this.isRequired||(this.text=i.asString(t)))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._tbx.value},set:function(t){t!=this.text&&(this._setText(i.asString(t),!0),this._commitText())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"showAlphaChannel",{get:function(){return this._colorPicker.showAlphaChannel},set:function(t){this._colorPicker.showAlphaChannel=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"palette",{get:function(){return this._colorPicker.palette},set:function(t){this._colorPicker.palette=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"colorPicker",{get:function(){return this._colorPicker},enumerable:!0,configurable:!0}),e.prototype.onValueChanged=function(t){this.valueChanged.raise(this,t)},e.prototype._createDropDown=function(){var t=this;this._colorPicker=new l(this._dropDown),i.setCss(this._dropDown,{minWidth:420,minHeight:200}),this._colorPicker.valueChanged.addHandler(function(){t.value=t._colorPicker.value})},e.prototype._keydown=function(e){if(!e.defaultPrevented)switch(e.keyCode){case i.Key.Enter:this._commitText(),this.selectAll();break;case i.Key.Escape:this.text=this.value,this.selectAll()}t.prototype._keydown.call(this,e)},e.prototype._commitText=function(){if(this.value!=this.text){if(!this.isRequired&&!this.text)return this._value=this.text,void(this._ePreview.style.backgroundColor="");i.Color.fromString(this.text)?(this._colorPicker.value=this.text,this._value=this._colorPicker.value,this._ePreview.style.backgroundColor=this.value,this.onValueChanged()):this.text=this._value?this._value:""}},e}(o);e.InputColor=D});