/*!@license
* Infragistics.Web.ClientUI Editors localization resources 15.2.20152.1027
*
* Copyright (c) 2011-2015 Infragistics Inc.
*
* http://www.infragistics.com/
*
*/
(function($){$.ig=$.ig||{};if(!$.ig.Editor){$.ig.Editor={locale:{spinUpperTitle:"Increment",spinLowerTitle:"Decrement",buttonTitle:"Show list",clearTitle:"Clear value",datePickerButtonTitle:"Show calendar",updateModeUnsupportedValue:'updateMode requires a different configuration. Choose a value between "onChange" and "immediate".',updateModeNotSupported:'updateMode property supports only "onchange" mode for igMaskEditor, igDateEditor and igDatePicker extensions',renderErrMsg:"A base editor cannot be instantiated directly. Try with a text, numeric, date, or other editor.",multilineErrMsg:'textArea requires a different configuration. The textMode should be set to "multiline".',targetNotSupported:"This target element is not supported.",placeHolderNotSupported:"The placeholder attribute is not supported by your browser.",allowedValuesMsg:"Pick a value from the drop-down list",maxLengthErrMsg:"Entry is too long and was trimmed to {0} symbols",maxLengthWarningMsg:"Entry reached the maximum length of {0} for this field",minLengthErrMsg:"At least {0} characters should be entered",maxValErrMsg:"Entry reached the maximum value of {0} for this field",minValErrMsg:"Entry reached the minimum value of {0} for this field",maxValExceedRevertErrMsg:"Entry exceeded the maximum value of {0} and was reverted to previous one",minValExceedRevertErrMsg:"Entry exceeded the minimum value of {0} and was reverted to previous one",maxValExceededWrappedAroundErrMsg:"Entry exceeded the maximum value of {0} and was set to minimum allowed one",minValExceededWrappedAroundErrMsg:"Entry exceeded the minimum value of {0} and was set to maximum allowed one",btnValueNotSupported:'A different button value is required. Choose a value between "dropdown", "clear" and "spin".',scientificFormatErrMsg:'A different scientificFormat is required. Choose a value between "E", "e", "E+" and "e+".',spinDeltaIsOfTypeNumber:"A different type of spinDelta is required. A positive number should be entered.",spinDeltaCouldntBeNegative:"The spinDelta option cannot be negative. A positive number should be entered.",spinDeltaContainsExceedsMaxDecimals:"Maximum allowed fractions for spinDelta are set to {0}. Either change MaxDecimals or try to shrink your value.",spinDeltaIncorrectFloatingPoint:'A floating point spinDelta requires a different configuration. Set the dataMode of the editor to either "double" or "float".',notEditableOptionByInit:"This option cannot be edited after initialization. Its value should be set during initialization.",numericEditorNoSuchMethod:"The numeric editor does not support this method.",displayFactorIsOfTypeNumber:"displayFactor requires a different value. Its value should be set to 1 or 100 as a number.",displayFactorAllowedValue:"displayFactor requires a different value. Its value should be set to 1 or 100 as a number.",instantiateCheckBoxErrMsg:"igCheckboxEditor requires a different element. Use INPUT, SPAN or DIV element.",cannotParseNonBoolValue:"igCheckboxEditor requires a different value. A boolean value should be provided.",cannotSetNonBoolValue:"igCheckboxEditor requires a different value. A boolean value should be provided.",maskEditorNoSuchMethod:"The mask editor does not support this method.",datePickerEditorNoSuchMethod:"The date editor does not support this method.",datePickerNoSuchMethodDropDownContainer:"The date editor does not support this method. Use 'getCalendar' one instead.",buttonTypeIsDropDownOnly:"Datepicker allows only dropdown and clear values for the buttonType option.",dateEditorMinValue:"MinValue option can not be set runtime.",dateEditorMaxValue:"MaxValue option can not be set runtime.",cannotSetRuntime:"This option can not be set runtime",invalidDate:"Invalid date",maskMessage:"All required positions should be filled",dateMessage:"A valid date should be entered",centuryThresholdValidValues:"centuryThreshold property shoud be between 0 and 99. The value has been reverted to defaults."}}}})(jQuery);/*!@license
 * Infragistics.Web.ClientUI CountDown 15.2.20152.1027
 *
 * Copyright (c) 2011-2015 Infragistics Inc.
 *
 * http://www.infragistics.com/
 *
 * Depends on:
 *  jquery-1.9.1.js
 *	jquery.ui-1.9.0.js
 *	infragistics.util.js
 *	infragistics.ui.popover.js
 *	infragistics.ui.notifier.js
 */
if(typeof jQuery!=="function"){throw new Error("jQuery is undefined")}(function($){$.widget("ui.igBaseEditor",{options:{width:null,height:null,value:null,tabIndex:null,allowNullValue:false,nullValue:null,inputName:null,readOnly:false,disabled:false,validatorOptions:null},css:{editor:"ui-igedit-input",container:"ui-igedit ui-igedit-container ui-widget ui-corner-all ui-state-default",hover:"ui-state-hover",active:"ui-state-active",focus:"ui-state-focus",disabled:"ui-state-disabled"},events:{rendering:"rendering",rendered:"rendered",mousedown:"mousedown",mouseup:"mouseup",mousemove:"mousemove",mouseover:"mouseover",mouseout:"mouseout",blur:"blur",focus:"focus",valueChanging:"valueChanging",valueChanged:"valueChanged"},_createWidget:function(options){this._definedOptions=options;$.Widget.prototype._createWidget.apply(this,arguments)},_create:function(){this._initialize();this._readAttributes();this._saveDOMConent();this._render()},_initialize:function(){this._timeouts=[]},_readAttributes:function(){this._saveAttributes();this._removeAttributesAndSetThemAsOptions()},_saveAttributes:function(){var i;var element=this.element[0],attr;this._initialAttributes=[];attr=element.attributes;for(i=0;i<attr.length;i++){if(attr[i].name!=="id"){this._initialAttributes.push({name:attr[i].name,attrValue:attr[i].value,propValue:element[attr[i].name]})}}},_removeAttributesAndSetThemAsOptions:function(){var element=this.element,name=element.attr("name"),value=element.attr("value"),disabled=element.attr("disabled"),readOnly=element.attr("readOnly");if(name){element.removeAttr("name");if(this.options.inputName===null){this.options.inputName=name}}if(value){element.removeAttr("value");if(this.options.value===null){this.options.value=value}}if(disabled){element.removeAttr("disabled");if(this._definedOptions===undefined||this._definedOptions.disabled===undefined){this.options.disabled=true}}if(readOnly){element.removeAttr("readonly");if(this._definedOptions===undefined||this._definedOptions.readOnly===undefined){this.options.readOnly=true}}delete this._definedOptions},_saveDOMConent:function(){if(this.element.children().length>0){this._initialDOMContent=this.element.children().clone(true);this.element.empty()}},_render:function(){throw $.ig.Editor.locale.renderErrMsg},_applyOptions:function(){if(this.options.tabIndex!==null){this._setTabIndex(this.options.tabIndex)}if(this.options.readOnly){this._setReadOnly(true)}if(this.options.disabled){this._setDisabled(true)}if(this.options.inputName){this.inputName(this.options.inputName)}if(this.options.validatorOptions){this._setupValidator()}},_attachEvents:function(){var self=this;this._editorContainer.on({"mousedown.editor":function(event){self._triggerMouseDown(event)},"mouseup.editor":function(event){self._triggerMouseUp(event)},"mousemove.editor":function(event){self._triggerMouseMove(event)},"mouseover.editor":function(event){self._triggerMouseOver(event)},"mouseout.editor":function(event){self._triggerMouseOut(event)}})},_setupValidator:function(){if(this.element.igValidator){this._validator=this.element.igValidator(this.options.validatorOptions).data("igValidator");this._validator.owner=this}},_destroyValidator:function(){if(this._validator&&this._validator.owner===this){this._validator.destroy();this._validator=null}},_applyAria:function(){var ariaLabeledBy=this.element.attr("aria-labelledby");if(ariaLabeledBy){this.element.removeAttr("aria-labelledby");this._editorInput.attr("aria-labelledby",ariaLabeledBy)}if(this._dropDownButton){this._editorInput.attr("role","combobox")}else{this._editorInput.attr("role","textbox")}},_triggerRendering:function(){var args={element:this.element,owner:this};return this._trigger(this.events.rendering,null,args)},_triggerRendered:function(){var args={element:this.element,owner:this};this._trigger(this.events.rendered,null,args)},_triggerMouseMove:function(event){var args={owner:this,element:event.target,editorInput:this._editorInput};this._trigger(this.events.mousemove,event,args)},_triggerMouseDown:function(event){this._editorContainer.addClass(this.css.active);var args={owner:this,element:event.target,editorInput:this._editorInput};return this._trigger(this.events.mousedown,event,args)},_triggerMouseUp:function(event){this._editorContainer.removeClass(this.css.active);var args={owner:this,element:event.target,editorInput:this._editorInput};this._trigger(this.events.mouseup,event,args)},_triggerMouseOver:function(event){this._editorContainer.addClass(this.css.hover);var args={originalEvent:event,owner:this,element:event.target,editorInput:this._editorInput};this._trigger(this.events.mouseover,event,args)},_triggerMouseOut:function(event){this._editorContainer.removeClass(this.css.hover);var args={originalEvent:event,owner:this,element:event.target,editorInput:this._editorInput};this._trigger(this.events.mouseout,event,args)},_triggerFocus:function(event){this._editorContainer.addClass(this.css.focus);var args={originalEvent:event,owner:this,element:event.target,editorInput:this._editorInput};this._trigger(this.events.focus,event,args)},_triggerBlur:function(event){this._editorContainer.removeClass(this.css.focus);this._clearEditorNotifier();var args={owner:this,element:event.target,editorInput:this._editorInput};this._trigger(this.events.blur,event,args)},_setOption:function(option,value){var prevValue=this.options[option];if(prevValue===value){return}$.Widget.prototype._setOption.apply(this,arguments);switch(option){case"readOnly":this._setReadOnly(value);break;case"disabled":this._setDisabled(value);break;case"width":this._setWidth(value);break;case"height":this._setHeight(value);break;case"validatorOptions":this._setupValidator();break;default:break}},_validateValue:function(val){return val?true:false},_updateValue:function(value){if(value===this.options.nullValue&&this.options.nullValue===null){this._editorInput.val("");this._valueInput.val("")}else{this._editorInput.val(value);this._valueInput.val(value)}this.options.value=value},_clearValue:function(){if(this.options.allowNullValue){this._updateValue(this.options.nullValue)}else{this._updateValue("")}},_detachEvents:function(){if(this._detachButtonsEvents){this._detachButtonsEvents()}if(this._detachListEvents){this._detachListEvents()}this._editorContainer.off("mousedown.editor mouseup.editor mouseover.editor mouseout.editor mouseout.editor")},_detachButtonsEvents:function(){if(this._dropDownList){this._detachListEvents()}if(this._dropDownButton){this._detachButtonsEvents(this._dropDownButton)}if(this._clearButton){this._detachButtonsEvents(this._clearButton)}if(this._spinUpButton){this._detachButtonsEvents(this._spinUpButton)}if(this._spinDownButton){this._detachButtonsEvents(this._spinDownButton)}},_restoreDOMStructure:function(){this._removeDOM();this._removeAttributes();this._setPropsDefaults();this._recoverInitialAttributes();this._recoverInitialDOMContent()},_removeDOM:function(){if(this._dropDownList){this._deleteList()}this._valueInput.remove();if(this.element.is("input")){this.element.unwrap().unwrap()}else if(this.element.is("div")){this.element.empty()}else if(this.element.is("span")){this.element.empty();this.element.unwrap().unwrap()}},_removeAttributes:function(){var element=this.element,attr=element[0].attributes,concatenatedAttr="",i;for(i=0;i<attr.length;i++){if(attr[i].name!=="id"){concatenatedAttr+=attr[i].name+" "}}element.removeAttr(concatenatedAttr.trim(" "))},_setPropsDefaults:function(){var element=this.element[0];element.disabled=false;element.readOnly=false;element.checked=false;element.value=null},_recoverInitialAttributes:function(){var i;if(this._initialAttributes){for(i=0;i<this._initialAttributes.length;i++){if(this._initialAttributes[i].name!=="id"){this.element.attr(this._initialAttributes[i].name,this._initialAttributes[i].attrValue);if(this._initialAttributes[i].propValue!==undefined){this.element.prop(this._initialAttributes[i].name,this._initialAttributes[i].propValue)}}}delete this._initialAttributes}},_recoverInitialDOMContent:function(){if(this._initialDOMContent){this._initialDOMContent.appendTo(this.element);delete this._initialDOMContent}},_clearStyling:function(){this._editorContainer.removeClass(this.css.container).removeClass(this.css.hover).removeClass(this.css.active);this._editorInput.removeClass(this.css.editor)},_deleteInternalProperties:function(){delete this._editorInput;delete this._editorContainer;delete this._valueInput;if(this._timeouts){delete this._timeouts}},_clearTimeouts:function(){var i,timeouts=this._timeouts;if(timeouts&&timeouts instanceof Array){for(i=0;i<timeouts.length;i++){clearTimeout(timeouts[i])}this._timeouts=[]}},_disableEditor:function(){this._editorContainer.addClass(this.css.disabled);this._detachEvents()},_setEditableMode:function(){this._editorInput.prop("readonly",false);this._valueInput.prop("readonly",false);this._editorInput.prop("disabled",false);this._valueInput.prop("disabled",false);this._editorContainer.removeClass(this.css.disabled);this._attachEvents()},_setDisabled:function(activate){if(activate){this._editorInput.prop("disabled",true);this._valueInput.prop("disabled",true);this._disableEditor()}else{this._editorInput.prop("disabled",false);this._valueInput.prop("disabled",false);if(!this.options.readOnly){this._setEditableMode()}}},_setReadOnly:function(activate){if(activate){this._editorInput.prop("readonly",true);this._valueInput.prop("readonly",true);this._disableEditor()}else{this._editorInput.prop("readonly",false);this._valueInput.prop("readonly",false);if(!this.options.disabled){this._setEditableMode()}this._editorInput.off(".readonly")}},_setWidth:function(width){if(width){this._editorContainer.css("width",this.options.width)}},_setHeight:function(height){if(height){this._editorContainer.css("height",this.options.height)}},_setTabIndex:function(index){this._editorInput.attr("tabIndex",index)},_setFocusDelay:function(delay){var self=this;if(delay){this._timeouts.push(setTimeout(function(){self._setFocus()},delay))}else{self._setFocus()}},_setFocus:function(event){this._focused=true;this._enterEditMode();if(event){this._triggerFocus(event)}},_setBlur:function(event){var newValue;if(this._cancelBlurOnInput){this._editorInput.focus();delete this._cancelBlurOnInput}else{this._triggerBlur(event);newValue=$(event.target).val();this._currentInputTextValue=this._editorInput.val();this._processValueChanging(newValue);this._processTextChanged();this._exitEditMode();if(this._dropDownList&&this._triggerDropDownClosing()){this._hideDropDownList();this._triggerDropDownClosed()}this._focused=false;this._clearTimeouts();if(this._validator){this._validator._validateInternal(this.element,event,true)}}},inputName:function(newValue){if(newValue){this.options.inputName=newValue;this._valueInput.attr("name",newValue)}else{return this.options.inputName}},value:function(newValue){if(newValue!==undefined){if(this._validateValue(newValue)){this._updateValue(newValue);this._editorInput.val(this._getDisplayValue())}else{this._clearValue()}}else{return this.options.value}},field:function(){return this._editorInput},editorContainer:function(){return this._editorContainer},hasFocus:function(){return this._focused},setFocus:function(delay){this._setFocusDelay(delay)},hide:function(){this._editorContainer.hide()},show:function(){this._editorContainer.show()},validator:function(){return this._validator},isValid:function(){this._skipMessages=true;var valid=this._validateValue(this.value());this._skipMessages=false;return valid},validate:function(){this._validateValue(this.value())},destroy:function(){this._destroyValidator();this._detachEvents();this._clearTimeouts();this._clearStyling();this._restoreDOMStructure();this._deleteInternalProperties();delete this.options;$.Widget.prototype.destroy.apply(this,arguments);return this}});$.extend($.ui.igBaseEditor,{version:"15.2.20152.1027"});$.widget("ui.igTextEditor",$.ui.igBaseEditor,{options:{buttonType:"none",listItems:null,listWidth:0,listItemHoverDuration:0,dropDownAttachedToBody:false,dropDownAnimationDuration:300,visibleItemsCount:5,includeKeys:null,excludeKeys:null,textAlign:"left",placeHolder:null,selectionOnFocus:"selectAll",textMode:"text",spinWrapAround:false,isLimitedToListValues:false,revertIfNotValid:true,preventSubmitOnEnter:false,dropDownOrientation:"auto",maxLength:null,dropDownOnReadOnly:false,toUpper:false,toLower:false,locale:null,suppressNotifications:false},css:{editorInputContainer:"ui-igeditor-input-container ui-corner-all",spinButtonUpImage:"ui-igedit-spinupperimage ui-icon-carat-1-n ui-icon ui-igedit-buttondefault ui-igedit-spinbutton ui-igedit-buttonimage",spinButtonDownImage:"ui-igedit-spinlowerimage ui-icon-carat-1-s ui-icon ui-igedit-buttondefault ui-igedit-spinbutton ui-igedit-buttonimage",dropDownImage:"ui-icon ui-icon-triangle-1-s ui-igedit-buttonimage",dropDownButton:"ui-igedit-dropdown-button ",clearButtonImage:"ui-igedit-buttonimage ui-icon-circle-close ui-icon ui-igedit-buttondefault",clearButton:"ui-igedit-cleararea ui-state-default",buttonCommon:"ui-igedit-button-common ui-unselectable ui-igedit-button-ltr ui-state-default",dropDownList:"ui-igedit-dropdown ui-widget",listItem:"ui-igedit-listitem ui-state-default",listItemHover:"ui-igedit-listitemhover ui-state-hover",listItemActive:"ui-state-active ui-igedit-listitemactive",listItemSelected:"ui-igedit-listitemselected ui-state-highlight",buttonHover:"ui-igedit-buttonhover ui-state-hover",buttonPressed:"ui-igedit-buttonpressed ui-state-highlight",placeHolder:"ui-igedit-placeholder",textArea:"ui-igedit-textarea"},events:{keydown:"keydown",keypress:"keypress",keyup:"keyup",dropDownListOpening:"dropDownListOpening",dropDownListOpened:"dropDownListOpened",dropDownListClosing:"dropDownListClosing",dropDownListClosed:"dropDownListClosed",dropDownItemSelecting:"dropDownItemSelecting",dropDownItemSelected:"dropDownItemSelected",textChanged:"textChanged"},_create:function(){$.ui.igBaseEditor.prototype._create.call(this)},_setOption:function(option,value){var prevValue=this.options[option];if(prevValue===value){return}$.Widget.prototype._setOption.apply(this,arguments);switch(option){case"value":if(this._validateValue(value)){this._updateValue(value);this._exitEditMode()}else{this._clearValue();this._exitEditMode()}break;case"placeHolder":this._applyPlaceHolder();break;case"suppressNotifications":if(value){this._clearEditorNotifier()}break;case"listItems":this._deleteList();this._createList();break;case"dropDownOnReadOnly":case"visibleItemsCount":case"buttonType":case"dropDownAttachedToBody":throw new Error($.ig.Editor.locale.cannotSetRuntime);default:this.options[option]=prevValue;this._super(option,value);break}},_updateValue:function(value){if(value!==null&&value!==undefined){value=value.toString()}this._super(value)},_applyOptions:function(){var initialValue;this._super();if(this.options.includeKeys){this._includeKeysArray=this.options.includeKeys.toString().split("")}if(this.options.excludeKeys){this._excludeKeysArray=this.options.excludeKeys.toString().split("")}if(this.options.value!==undefined){initialValue=this.options.value;if(this.options.maxLength){if(initialValue&&initialValue.toString().length>=this.options.maxLength){initialValue=initialValue.toString().substring(0,this.options.maxLength);this._sendNotification("warning",$.ig.util.stringFormat($.ig.Editor.locale.maxLengthErrMsg,this.options.maxLength))}}if(this._validateValue(initialValue)){this._setInitialValue(initialValue);this._editorInput.val(this._getDisplayValue())}}else if(this.element.val()&&this._validateValue(this.element.val())){initialValue=this.element.val();if(this.options.maxLength){if(initialValue&&initialValue.toString().length>=this.options.maxLength){initialValue=initialValue.toString().substring(0,this.options.maxLength);this._sendNotification("warning",$.ig.util.stringFormat($.ig.Editor.locale.maxLengthErrMsg,this.options.maxLength))}}if(this._validateValue(initialValue)){this._setInitialValue(initialValue);this._editorInput.val(this._getDisplayValue())}else{this._editorInput.val("")}}this._applyPlaceHolder()},_render:function(){var editorElementWrapper,editorElement;this._triggerRendering();if(this.element.is("div")||this.element.is("span")){if(this.options.textMode==="multiline"){editorElement=$("<textarea rows='4' cols='50'></textarea>");editorElement.addClass(this.css.textArea)}else if(this.options.textMode==="password"){editorElement=$("<input type='password' autocomplete='off'/>")}else{editorElement=$("<input type='text' />")}if(this.element.is("span")){editorElement=this.element.html(editorElement)}editorElementWrapper=editorElement.wrap($("<div></div>")).parent();editorElementWrapper.addClass(this.css.editorInputContainer);this._editorInputWrapper=editorElementWrapper;if(this.element.is("span")){this._editorInput=editorElement.children(0);this._editorContainer=editorElementWrapper.wrap($("<div></div>")).parent()}else{this._editorInput=editorElement;this._editorContainer=this.element}this._editorContainer.prepend(editorElementWrapper)}else if(this.element.is("input")){this._editorContainer=this.element.wrap($("<div></div>")).parent();this._editorInput=this.element;editorElementWrapper=this._editorInput.wrap($("<div></div>")).parent();editorElementWrapper.addClass(this.css.editorInputContainer);this._editorInputWrapper=editorElementWrapper}else if(this.element.is("textarea")){if(this.options.textMode!=="multiline"){throw $.ig.Editor.locale.multilineErrMsg}else{this._editorContainer=this.element.wrap($("<div></div>")).parent();this._editorInput=this.element;this._editorInput.addClass(this.css.textArea);editorElementWrapper=this._editorInput.wrap($("<div></div>")).parent();editorElementWrapper.addClass(this.css.editorInputContainer);this._editorInputWrapper=editorElementWrapper}}else{throw $.ig.Editor.locale.targetNotSupported}this._editorContainer.addClass(this.css.container);this._editorInput.addClass(this.css.editor);this._editorInput.css("height","100%");if(!$.ig.util.isIE8){if(this.options.textMode!=="multiline"){if(this.options.textMode==="password"){this._editorInput.attr("type","password");this._editorInput.attr("autocomplete","off")}else{this._editorInput.attr("type","text")}}}if(this.options.buttonType&&this.options.buttonType!=="none"&&this.options.textMode!=="multiline"&&this.options.textMode!=="password"){this._renderButtons()}if(this.options.width){this._editorContainer.css("width",this.options.width)}if(this.options.height){this._editorContainer.css("height",this.options.height)}if(this.options.textMode==="multiline"){this._valueInput=$("<textarea style='display:none'></textarea>")}else{this._valueInput=$("<input type='hidden'></input>")}this._editorInput.after(this._valueInput);this._editorInput.css("text-align",this.options.textAlign);this._createList();this._attachEvents();this._applyOptions();this._applyAria();this._triggerRendered()},_sendNotification:function(state,message){if(this.options.suppressNotifications||this._skipMessages){this._currentMessage=message;return}if(!this._editorContainer.data("igNotifier")){this._editorContainer.igNotifier()}this._editorContainer.igNotifier("notify",state,message)},_applyPlaceHolder:function(){if(this.options.placeHolder&&this.options.placeHolder!==""){this._editorInput.attr("placeholder",this.options.placeHolder);this._editorInput.addClass(this.css.placeHolder);if(this._placeHolderNotSupported()){console.log($.ig.Editor.locale.placeHolderNotSupported)}}else if(this._editorInput.attr("placeholder")){this._editorInput.removeAttr("placeholder")}},_placeHolderNotSupported:function(){return document.createElement("input").placeholder===undefined},_setInitialValue:function(value){this._updateValue(value)},_disableEditor:function(){if(this.options.dropDownOnReadOnly){this._editorInput.addClass(this.css.disabled)}else{this._editorContainer.addClass(this.css.disabled);this._detachEvents()}if(this._dropDownList&&!this.options.dropDownOnReadOnly){this._dropDownList.addClass(this.css.disabled);this._detachListEvents()}if(this._dropDownButton&&!this.options.dropDownOnReadOnly){this._dropDownButton.addClass(this.css.disabled);this._detachButtonsEvents(this._dropDownButton)}if(this._clearButton){this._clearButton.addClass(this.css.disabled);this._detachButtonsEvents(this._clearButton)}if(this._spinUpButton){this._spinUpButton.addClass(this.css.disabled);this._detachButtonsEvents(this._spinUpButton)}if(this._spinDownButton){this._spinDownButton.addClass(this.css.disabled);this._detachButtonsEvents(this._spinDownButton)}},_validateValue:function(val){var loweredItems,result;if(val===undefined){result=false}else if(val===null){if(this.options.allowNullValue){result=val===this.options.nullValue?true:false}else{result=false}}else if(this.options.isLimitedToListValues&&this._dropDownList){loweredItems=$.map(this.options.listItems,function(item){return item.toString().toLowerCase()});if($.inArray(val.toString().toLowerCase(),loweredItems)!==-1){result=true}else{this._sendNotification("warning",$.ig.Editor.locale.allowedValuesMsg);result=false}}else if(this.options.maxLength){if(val.toString().length<=this.options.maxLength){result=true}else{this._sendNotification("warning",$.ig.util.stringFormat($.ig.Editor.locale.maxLengthErrMsg,this.options.maxLength));result=false}}else{result=true}return result},_setEditableMode:function(){this._super("_setEditableMode");if(this._dropDownList&&!this.options.dropDownOnReadOnly){this._dropDownList.removeClass(this.css.disabled);this._attachListEvents()}if(this._dropDownButton&&!this.options.dropDownOnReadOnly){this._dropDownButton.removeClass(this.css.disabled);this._attachButtonsEvents("dropdown",this._dropDownButton)}if(this._clearButton){this._clearButton.removeClass(this.css.disabled);this._attachButtonsEvents("clear",this._clearButton)}if(this._spinUpButton){this._spinUpButton.removeClass(this.css.disabled);this._attachButtonsEvents("spinUp",this._spinUpButton)}if(this._spinDownButton){this._spinDownButton.removeClass(this.css.disabled);this._attachButtonsEvents("spinDown",this._spinDownButton)}},_calculateDropDownListOrientation:function(){var containerOffset=this._editorContainer.offset(),containerTop=containerOffset.top,containerHeight=parseFloat(this._editorContainer.css("height")),dropDownAndEditorHeight=parseInt(containerTop+containerHeight+this._listInitialHeight),widndowHeight=$(window).height(),orientation;if(this.options.dropDownOrientation==="auto"){if(dropDownAndEditorHeight<widndowHeight+$(window).scrollTop()){orientation="bottom"}else if(containerTop-this._listInitialHeight>0){orientation="top"}else{orientation="bottom"}}else{orientation=this.options.dropDownOrientation}return orientation},_positionDropDownList:function(){var containerOffset=this._editorContainer.offset(),containerTop=containerOffset.top,containerLeft=containerOffset.left,containerHeight=parseFloat(this._editorContainer.css("height")),orientation=this._calculateDropDownListOrientation();if(this.options.dropDownAttachedToBody){this._dropDownList.css("left",containerLeft);if(orientation==="bottom"){this._dropDownList.css("top",containerTop+containerHeight);this._dropDownListOrientation="down";this._dropDownList.removeClass("ui-igedit-dropdown-orientation-top");this._dropDownList.addClass("ui-igedit-dropdown-orientation-bottom")}else{this._dropDownList.css("top",containerTop-this._listInitialHeight);this._dropDownListOrientation="up";this._dropDownList.removeClass("ui-igedit-dropdown-orientation-bottom");this._dropDownList.addClass("ui-igedit-dropdown-orientation-top")}}else{this._dropDownList.css("left","");if(orientation==="bottom"){this._dropDownList.css("top","");this._dropDownListOrientation="down";this._dropDownList.removeClass("ui-igedit-dropdown-orientation-top");this._dropDownList.addClass("ui-igedit-dropdown-orientation-bottom")}else{this._dropDownList.css("top",-this._listInitialHeight);this._dropDownListOrientation="up";this._dropDownList.removeClass("ui-igedit-dropdown-orientation-bottom");this._dropDownList.addClass("ui-igedit-dropdown-orientation-top")}}this._setDropDownListWidth()},_createList:function(){if(this.options.textMode!=="multiline"&&this.options.textMode!=="password"&&this.options.listItems&&this.options.listItems.length>0){if(this.options.buttonType.toString().indexOf("dropdown")===-1){this._renderDropDownButton()}this._renderList();this._positionDropDownList();this._attachListEvents()}},_renderList:function(){var i,list=this.options.listItems,itemValue,currentItem,itemHeight;var dropdown=$("<div></div>)").addClass(this.css.dropDownList);for(i=0;i<list.length;i++){currentItem=$("<span></span>").addClass(this.css.listItem);itemValue=this.options.displayFactor?list[i]*this.options.displayFactor:list[i];currentItem.append(itemValue).appendTo(dropdown)}if(this.options.dropDownAttachedToBody){$(document.body).append(dropdown)}else{this._editorContainer.append(dropdown)}itemHeight=currentItem.css("height");itemHeight=parseFloat(itemHeight);if(itemHeight===0){itemHeight=23}if(list.length<this.options.visibleItemsCount){dropdown.css("height",parseFloat(itemHeight*list.length));this._listInitialHeight=parseFloat(itemHeight*list.length)}else{dropdown.css("height",parseFloat(itemHeight*this.options.visibleItemsCount)+2);this._listInitialHeight=parseFloat(itemHeight*this.options.visibleItemsCount)+2}this._dropDownList=dropdown;this._setDropDownListWidth();dropdown.hide();dropdown.visible=false},_setDropDownListWidth:function(){if(this.options.listWidth&&this.options.listWidth>0){this._dropDownList.css("width",this.options.listWidth)}else{this._dropDownList.css("width",this._editorContainer.css("width"))}},_attachListEvents:function(){var self=this;this._dropDownList.on({"mouseenter.editorList":function(event){var item=event.target;$(item).addClass(self.css.listItemHover,self.options.listItemHoverDuration);$(item).attr("data-hovered",true)},"mouseleave.editorList":function(event){var item=event.target;$(item).removeClass(self.css.listItemHover,self.options.listItemHoverDuration);$(item).removeAttr("data-hovered")},"click.editorList":function(event){self._triggerListItemClick(event.target)},"mousedown.editorList":function(event){event.preventDefault();event.stopPropagation()}},".ui-igedit-listitem");this._dropDownList.on("mousedown.editorList",function(event){if($.ig.util.isIE){self._cancelBlurOnInput=true}else{event.preventDefault();event.stopPropagation()}})},_deleteList:function(){this._detachListEvents();this._detachButtonsEvents();this._dropDownList.remove();this._dropDownButton.remove()},_detachListEvents:function(){if(this._dropDownList){this._dropDownList.off("mouseenter.editorList mouseleave.editorList click.editorList mousedown.editorList")}},_renderDropDownButton:function(){var dropDownButton=$("<div></div>"),dropDownIcon=$("<div></div>");if(this._dropDownButton){return}dropDownButton.addClass(this.css.buttonCommon);dropDownButton.attr("title",this._getLocaleOption("buttonTitle"));this._editorContainer.prepend(dropDownButton.addClass(this.css.dropDownButton).append(dropDownIcon.addClass(this.css.dropDownImage)));this._dropDownButton=dropDownButton;this._attachButtonsEvents("dropdown",dropDownButton)},_renderSpinButtons:function(){var spinButtonUp=$("<div></div>"),spinButtonUpImage=$("<div></div>"),spinButtonDown=$("<div></div>"),spinButtonDownImage=$("<div></div>");if(this._spinUpButton){return}spinButtonUp.addClass(this.css.buttonCommon).append(spinButtonUpImage.addClass(this.css.spinButtonUpImage));spinButtonDown.addClass(this.css.buttonCommon).append(spinButtonDownImage.addClass(this.css.spinButtonDownImage));spinButtonUp.attr("title",this._getLocaleOption("spinUpperTitle"));spinButtonDown.attr("title",this._getLocaleOption("spinLowerTitle"));this._editorContainer.prepend(spinButtonDown).prepend(spinButtonUp);this._attachButtonsEvents("spinDown",spinButtonDown);this._attachButtonsEvents("spinUp",spinButtonUp);this._spinUpButton=spinButtonUp;this._spinDownButton=spinButtonDown},_renderClearButton:function(){var clearButton=$("<div></div>"),buttonClearIcon=$("<div></div>");if(this._clearButton){return}clearButton.addClass(this.css.buttonCommon);clearButton.append(buttonClearIcon.addClass(this.css.clearButtonImage));clearButton.attr("title",this._getLocaleOption("clearTitle"));this._editorContainer.prepend(clearButton.addClass(this.css.clearButton));this._clearButton=clearButton;this._attachButtonsEvents("clear",clearButton)},_renderButtons:function(){var buttons=this.options.buttonType.toString().split(/[\s,]+/),buttonsCountRendered=0;if($.inArray("clear",buttons)!==-1){this._renderClearButton();buttonsCountRendered++}if($.inArray("spin",buttons)!==-1){if(this._numericType||this.options.listItems&&this.options.listItems!==null){this._renderSpinButtons();buttonsCountRendered+=2}}if($.inArray("dropdown",buttons)!==-1&&this.options.listItems&&this.options.listItems!==null){this._renderDropDownButton();buttonsCountRendered++}if(buttonsCountRendered===0){console.log($.ig.Editor.locale.btnValueNotSupported)}},_attachButtonsEvents:function(type,target){var self=this;if(!target){return}target.on({"mouseenter.button":function(){target.addClass(self.css.buttonHover)},"mouseleave.button":function(){target.removeClass(self.css.buttonHover);if(target._pressed){delete target._pressed;target.removeClass(self.css.buttonPressed)}if(target._spinTimeOut){clearTimeout(target._spinTimeOut);delete target._spinTimeOut}if(target._spinInterval){clearInterval(target._spinInterval);delete target._spinInterval}},"mousedown.button":function(event){if(event.button===0||event.button===1&&$.ig.util.isIE8){target.addClass(self.css.buttonPressed);target._pressed=true;event.preventDefault();if(type==="spinUp"||type==="spinDown"){self._handleSpinEvent(type,target)}}},"mouseup.button":function(){target.removeClass(self.css.buttonPressed);delete target._pressed;if(target._spinTimeOut){clearTimeout(target._spinTimeOut);delete target._spinTimeOut}if(target._spinInterval){clearInterval(target._spinInterval);delete target._spinInterval}},"click.button":function(event){self._triggerButtonClick(event,type)}})},_detachButtonsEvents:function(target){if(target){target.off("mouseenter.button mouseleave.button mousedown.button mouseup.button click.button")}},_attachEvents:function(){var self=this;self._super();this._editorInput.on({"focus.editor":function(event){self._setFocus(event)},"blur.editor":function(event){self._setBlur(event)},"paste.editor":function(event){self._pasteHandler(event)},"keydown.editor":function(event){self._currentInputTextValue=self._editorInput.val();self._triggerKeyDown(event)},"keyup.editor":function(event){self._triggerKeyUp(event);self._processTextChanged()},"keypress.editor":function(event){self._triggerKeyPress(event)},"compositionstart.editor":function(){self._compositionStartValue=self._editorInput.val()},"compositionend.editor":function(){setTimeout(function(){var value=self._editorInput.val(),noCancel=self._triggerValueChanging(value);if(noCancel){self._insert(value,self._compositionStartValue);self._triggerValueChanged(value)}},0)}})},_detachEvents:function(){this._super();this._editorInput.off("focus.editor blur.editor paste.editor keydown.editor keyup.editor keypress.editor compositionstart.editor compositionend.editor")},_processValueChanging:function(value){if(value!==this.value()){if(!(this.value()===null&&value==="")){this._triggerInternalValueChange(value)}}},_triggerInternalValueChange:function(value){var noCancel=this._triggerValueChanging(value);if(noCancel){this._processInternalValueChanging(value);this._triggerValueChanged(value)}},_processInternalValueChanging:function(value){if(this._validateValue(value)){this._updateValue(value)}else{if(this.options.revertIfNotValid){value=this._valueInput.val();this._updateValue(value)}else{this._clearValue();value=this._valueInput.val()}}},_triggerKeyDown:function(event){var e=event,noCancel,activeItem,args,currentInputVal,selection;args={owner:this,element:event.target,key:event.keyCode,editorInput:this._editorInput};
noCancel=this._trigger(this.events.keydown,event,args);if(noCancel){this._clearEditorNotifier();if(e.keyCode===13){if(event.altKey&&this.options.textMode==="multiline"){this._editorInput.val(this._editorInput.val()+"\n")}else{currentInputVal=this._editorInput.val();if(this._dropDownList&&this._dropDownList.is(":visible")){activeItem=this._dropDownList.children(".ui-igedit-listitem").filter("[data-active='true']");if(activeItem.length>0){this._triggerListItemClick(activeItem)}else{this._processValueChanging(currentInputVal)}}else{this._processValueChanging(currentInputVal)}}}else if(this._dropDownList){if(e.keyCode===38){if(e.altKey&&this._dropDownList.is(":visible")){this._toggleDropDown()}else if(this._dropDownList.is(":visible")){activeItem=this._dropDownList.children(".ui-igedit-listitem").filter("[data-active='true']");if(activeItem.length>0&&!activeItem.is(":first-child")){this._hoverPreviousDropDownListItem()}else{this._toggleDropDown()}}}else if(e.keyCode===40||e.keyCode===38&&e.altKey){if(!this._dropDownList.is(":visible")){this._toggleDropDown()}else{this._hoverNextDropDownListItem()}}else if(e.keyCode===27&&this._dropDownList.is(":visible")){this._toggleDropDown()}}else if(this.options.maxLength){currentInputVal=this._editorInput.val();if(currentInputVal.length===this.options.maxLength&&e.keyCode>46&&!e.altKey&&!e.ctrlKey&&!e.shiftKey){selection=this._getSelection(this._editorInput[0]);if(selection.start===selection.end){e.preventDefault();e.stopPropagation();this._sendNotification("warning",$.ig.util.stringFormat($.ig.Editor.locale.maxLengthWarningMsg,this.options.maxLength))}}}}return noCancel},_triggerKeyUp:function(event){var args={originalEvent:event,owner:this,element:event.target,editorInput:this._editorInput};this._trigger(this.events.keyup,event,args)},_validateNonCharacter:function(event){if($.ig.util.isFF){var e=event;if($.inArray(e.keyCode,[46,8,9,27,13,110,190])!==-1||e.which===97&&e.ctrlKey===true||e.which===99&&e.ctrlKey===true||e.which===120&&e.ctrlKey===true||e.which===118&&e.ctrlKey===true||e.which===122&&e.ctrlKey===true||e.which===121&&e.ctrlKey===true||e.keyCode>=35&&e.keyCode<=40){return true}}else{return false}},_triggerKeyPress:function(event){if(this._validateKey(event)||this._validateNonCharacter(event)){var args={owner:this,element:event.target,key:event.keyCode,editorInput:this._editorInput};if(this.options.preventSubmitOnEnter&&event.keyCode===13&&!event.shiftKey&&this.options.textMode!=="multiline"){event.preventDefault();event.stopPropagation()}if(this.options.toUpper||this.options.toLower){var keyCode=event.which?event.which:event.keyCode;if(keyCode){var charStr,transformedChar,key,selection,val;charStr=String.fromCharCode(keyCode);if(this.options.toUpper){transformedChar=charStr.toLocaleUpperCase()}else{transformedChar=charStr.toLocaleLowerCase()}key=transformedChar.charCodeAt(0);args.key=key;selection=this._getSelection(this._editorInput[0]);val=this._editorInput.val();this._editorInput.val(val.slice(0,selection.start)+transformedChar+val.slice(selection.end));this._setCursorPosition(selection.start+1);event.preventDefault()}}return this._trigger(this.events.keypress,event,args)}else{event.preventDefault();event.stopPropagation()}},_triggerValueChanged:function(originalValue){var args={owner:this,editorInput:this._editorInput,newValue:this.options.value};if(originalValue){args.originalValue=originalValue}this._trigger(this.events.valueChanged,null,args)},_triggerValueChanging:function(newValue){var args={owner:this,editorInput:this._editorInput,oldValue:this.value(),newValue:newValue};return this._trigger(this.events.valueChanging,null,args)},_triggerListItemClick:function(item){var noCancel;noCancel=this._triggerDropDownItemSelecting(item);if(noCancel){$(item).parent().children(".ui-igedit-listitem").removeClass(this.css.listItemSelected);$(item).addClass(this.css.listItemSelected);noCancel=this._triggerDropDownClosing();if(noCancel){this._hideDropDownList();this._triggerDropDownClosed()}this._triggerDropDownItemSelected(item);if(this.value()!==$(item).text()){this._currentInputTextValue=this._editorInput.val();this._processValueChanging($(item).text());this._processTextChanged();this._enterEditMode()}}},_triggerButtonClick:function(event,buttonType){if(buttonType){switch(buttonType){case"dropdown":{this._toggleDropDown()}break;case"clear":{this._currentInputTextValue=this._editorInput.val();this._clearValue();this._processTextChanged();if(!this._editMode){this._exitEditMode();this._triggerValueChanged()}else{this._enterEditMode()}}break}}},_triggerDropDownClosing:function(){var args={editor:this._editorContainer,owner:this,editorInput:this._editorInput,list:this._dropDownList};return this._trigger(this.events.dropDownListClosing,null,args)},_triggerDropDownClosed:function(){var args={editor:this._editorContainer,owner:this,editorInput:this._editorInput,list:this._dropDownList};this._trigger(this.events.dropDownListClosed,null,args)},_triggerDropDownOpening:function(){var args={editor:this._editorContainer,owner:this,editorInput:this._editorInput,list:this._dropDownList};return this._trigger(this.events.dropDownListOpening,null,args)},_triggerDropDownOpened:function(){var args={owner:this,editorInput:this._editorInput,list:this._dropDownList};return this._trigger(this.events.dropDownListOpened,null,args)},_triggerDropDownItemSelecting:function(item){var args={editor:this._editorContainer,owner:this,editorInput:this._editorInput,list:this._dropDownList,item:item};return this._trigger(this.events.dropDownItemSelecting,null,args)},_triggerDropDownItemSelected:function(item){var args={owner:this,editorInput:this._editorInput,list:this._dropDownList,item:item};this._trigger(this.events.dropDownItemSelected,null,args)},_processTextChanged:function(){var currentVal=this._editorInput.val(),previousVal=this._currentInputTextValue;if(previousVal===undefined){this._triggerTextChanged("",currentVal)}else if(currentVal!==previousVal){this._triggerTextChanged(previousVal,currentVal);if(this._validator){this._validator._validateInternal(this.element)}}},_triggerTextChanged:function(oldValue,newValue){var args={owner:this,text:newValue,oldText:oldValue?oldValue:""};this._trigger(this.events.textChanged,null,args)},_elementPositionInViewport:function(el){var areaTop=Math.ceil(el.parent().offset().top),elementoffset=Math.ceil(el.offset().top),elementHeight=Math.ceil(el.outerHeight()),listVisibleHeight=el.parent().outerHeight(),result;if(elementoffset-areaTop<0){result="top"}else if(elementoffset+elementHeight-areaTop<listVisibleHeight){result="inside"}else if(elementoffset+elementHeight-areaTop>listVisibleHeight){result="bottom"}return result},_hoverPreviousDropDownListItem:function(){var items=this._dropDownList.children(".ui-igedit-listitem"),newItem,currentItem;if(items&&items.length>0){if(items.filter("[data-active='true']").length>0){currentItem=items.filter("[data-active='true']");newItem=currentItem.prev();if(currentItem.is(":first-child")){if(this.options.spinWrapAround){newItem=items.last();this._dropDownList.scrollTop(this._dropDownList.scrollTop()+newItem.position().top)}else{return}}else{if(this._elementPositionInViewport(newItem)==="top"){this._dropDownList.scrollTop(this._dropDownList.scrollTop()-newItem.outerHeight())}}currentItem.removeClass(this.css.listItemActive,this.options.listItemHoverDuration);currentItem.removeAttr("data-active");newItem.addClass(this.css.listItemActive,this.options.listItemHoverDuration);newItem.attr("data-active",true)}}},_hoverNextDropDownListItem:function(){var items=this._dropDownList.children(".ui-igedit-listitem"),newItem,currentItem;if(items&&items.length>0){if(items.filter("[data-active='true']").length>0){currentItem=items.filter("[data-active='true']");newItem=currentItem.next();if(currentItem.is(":last-child")){if(this.options.spinWrapAround){newItem=items.first();this._dropDownList.scrollTop(this._dropDownList.scrollTop()+newItem.position().top)}else{return}}if(this._elementPositionInViewport(newItem)==="bottom"){this._dropDownList.scrollTop(this._dropDownList.scrollTop()+newItem.outerHeight())}currentItem.removeClass(this.css.listItemActive,this.options.listItemHoverDuration);currentItem.removeAttr("data-active")}else{newItem=items.filter(":visible").first()}newItem.addClass(this.css.listItemActive,this.options.listItemHoverDuration);newItem.attr("data-active",true)}},_pasteHandler:function(event){var self=this,previousValue=$(event.target).val(),newValue;this._currentInputTextValue=this._editorInput.val();this._timeouts.push(setTimeout(function(){newValue=$(event.target).val();self._insert(newValue,previousValue)},10))},_insertHandler:function(string){var selection=this._getSelection(this.field()[0]),previousValue,newValue;if(string){previousValue=this._editMode?this._editorInput.val():this.displayValue();newValue=this._replaceDisplayValue(selection,previousValue,string);this._insert(newValue,previousValue)}},_replaceDisplayValue:function(selection,previousValue,string){return previousValue.substring(0,selection.start)+string+previousValue.substring(selection.end,previousValue.length)},_insert:function(newValue,previousValue){var selection;if(this.options.maxLength){if(newValue&&newValue.toString().length>=this.options.maxLength){newValue=newValue.toString().substring(0,this.options.maxLength);this._sendNotification("warning",$.ig.util.stringFormat($.ig.Editor.locale.maxLengthErrMsg,this.options.maxLength))}}if(this._validateValue(newValue)){selection=this._getSelection(this._editorInput[0]);if(this.options.toUpper){if(newValue){newValue=newValue.toLocaleUpperCase()}}else if(this.options.toLower){if(newValue){newValue=newValue.toLocaleLowerCase()}}this._processValueChanging(newValue);this._processTextChanged();this._setCursorPosition(selection.start+newValue.length)}else{this._editorInput.val(previousValue)}},_clearDropDownHoverActiveItem:function(){var hoveredItem=this._dropDownList.children(".ui-igedit-listitem").filter("[data-hovered='true']"),activeItem=this._dropDownList.children(".ui-igedit-listitem").filter("[data-active='true']");if(hoveredItem.length>0){hoveredItem.removeClass(this.css.listItemHover);hoveredItem.removeAttr("data-hovered")}if(activeItem.length>0){activeItem.removeClass(this.css.listItemActive);activeItem.removeAttr("data-active")}},_showDropDownList:function(){var direction;this._positionDropDownList();if(this._dropDownListOrientation==="up"){direction="down"}else{direction="up"}try{$(this._dropDownList).show("blind",{direction:direction},this.options.dropDownAnimationDuration,$.proxy(this._triggerDropDownOpened,this))}catch(ex){$(this._dropDownList).show(this.options.dropDownAnimationDuration,$.proxy(this._triggerDropDownOpened,this))}},_hideDropDownList:function(){var direction;if(this._dropDownListOrientation==="up"){direction="down"}else{direction="up"}try{$(this._dropDownList).hide("blind",{direction:direction},this.options.dropDownAnimationDuration,$.proxy(this._triggerDropDownClosed,this))}catch(ex){$(this._dropDownList).hide(this.options.dropDownAnimationDuration,$.proxy(this._triggerDropDownClosed,this))}this._clearDropDownHoverActiveItem()},_toggleDropDown:function(){var noCancel;if(this._dropDownList.is(":visible")){noCancel=this._triggerDropDownClosing();if(noCancel){this._hideDropDownList()}}else{noCancel=this._triggerDropDownOpening();if(noCancel){this._editorInput.focus();this._showDropDownList()}}},_validateKey:function(event){var ch,result;if(this.options.excludeKeys){ch=String.fromCharCode(event.charCode||event.which);if($.inArray(ch,this._excludeKeysArray)!==-1){result=false}else{result=true}}else if(this.options.includeKeys){ch=String.fromCharCode(event.charCode||event.which);if($.inArray(ch,this._includeKeysArray)!==-1){result=true}else{result=false}}else{result=true}return result},_enterEditMode:function(){this._editMode=true;var selection=this._getSelection(this._editorInput[0]);this._positionCursor(selection.start,selection.end);this._currentInputTextValue=this._editorInput.val();this._processTextChanged()},_exitEditMode:function(){if(this.options.textMode==="text"&&!$.ig.util.isIE8){this._editorInput.attr("type","text")}this._currentInputTextValue=this._editorInput.val();this._editorInput.val(this._getDisplayValue());this._editMode=false;this._processTextChanged()},_getDisplayValue:function(){return this._valueInput.val()},_getSelectionRange:function(){var selection;if(window.getSelection){selection=window.getSelection();if(selection.rangeCount){return selection.getRangeAt(0)}}else if(document.selection){return document.selection.createRange()}},_setCursorPosition:function(positionIndex){this._setSelectionRange(this._editorInput[0],positionIndex,positionIndex)},_setSelectionRange:function(input,selectionStart,selectionEnd){if(input.setSelectionRange){input.setSelectionRange(selectionStart,selectionEnd)}else if(input.createTextRange){var range=input.createTextRange();range.collapse(true);range.moveEnd("character",selectionEnd);range.moveStart("character",selectionStart);range.select()}},_positionCursor:function(startPostion,endPosition){var currentValue=this._editorInput.val(),self=this;if(currentValue&&currentValue.length>0){switch(this.options.selectionOnFocus){case"selectAll":{if($.ig.util.isChrome||$.ig.util.isSafari){this._timeouts.push(setTimeout(function(){self._editorInput.select()},100))}else{this._editorInput.select()}}break;case"atStart":{if($.ig.util.isChrome||$.ig.util.isSafari){this._timeouts.push(setTimeout(function(){self._setSelectionRange(self._editorInput[0],0,0)},100))}else{this._setSelectionRange(this._editorInput[0],0,0)}}break;case"atEnd":{if($.ig.util.isChrome||$.ig.util.isSafari){this._timeouts.push(setTimeout(function(){self._setSelectionRange(self._editorInput[0],currentValue.length,currentValue.length)},100))}else{this._setSelectionRange(this._editorInput[0],currentValue.length,currentValue.length)}}break;case"browserDefault":{if(startPostion){if(endPosition){if(endPosition>currentValue.length-1){endPosition=currentValue.length-1}}else{endPosition=startPostion}if($.ig.util.isChrome||$.ig.util.isSafari){this._timeouts.push(setTimeout(function(){self._setSelectionRange(self._editorInput[0],startPostion,endPosition)},100))}else{this._setSelectionRange(this._editorInput[0],startPostion,endPosition)}}else{if($.ig.util.isChrome||$.ig.util.isSafari){this._timeouts.push(setTimeout(function(){self._editorInput.select()},100))}else{this._editorInput.select()}}}break;default:}}else{this._editorInput.select()}},_spinUp:function(){if(this._dropDownList&&this._dropDownList.is(":visible")){this._hoverPreviousDropDownListItem()}},_spinDown:function(){if(this._dropDownList&&this._dropDownList.is(":visible")){this._hoverNextDropDownListItem()}},_handleSpinUpEvent:function(){this._spinUp()},_handleSpinDownEvent:function(){this._spinDown()},_handleSpinEvent:function(type,target){var self=this;if(type==="spinUp"){this._handleSpinUpEvent();if(!target.attr("disabled")){target._spinTimeOut=setTimeout(function(){target._spinInterval=setInterval(function(){self._handleSpinUpEvent()},75)},300)}}else if(type==="spinDown"){this._handleSpinDownEvent();if(!target.attr("disabled")){target._spinTimeOut=setTimeout(function(){target._spinInterval=setInterval(function(){self._handleSpinDownEvent()},75)},300)}}this._timeouts.push(target._spinTimeOut)},_clearValue:function(){this._super();if(this._dropDownList&&this._dropDownList.children(".ui-igedit-listitemselected").length>0){this._dropDownList.children(".ui-igedit-listitemselected").removeClass(this.css.listItemSelected)}},_clearEditorNotifier:function(){var notifier=this._editorContainer.data("igNotifier");if(notifier&&notifier.options.state==="warning"&&notifier.isVisible()){notifier.hide()}},_getCursorPosition:function(){var selection=this._getSelection(this._editorInput[0]);if(selection.end-selection.start===this._editorInput.val().length&&this._editorInput.val().length>0){return-1}else{return selection.start}},_getSelection:function(editor){var startPostion=0,endPosition=0;if(editor.selectionStart!==undefined){startPostion=editor.selectionStart;endPosition=editor.selectionEnd}else if(document.selection){var globalSelection=document.selection.createRange(),range,rangeClone;if(globalSelection!==null){range=editor.createTextRange();rangeClone=range.duplicate();range.moveToBookmark(globalSelection.getBookmark());endPosition=range.text.length;rangeClone.setEndPoint("EndToStart",range);startPostion=rangeClone.text.length;endPosition+=startPostion}}return{start:startPostion,end:endPosition}},_getLocaleOption:function(key){var locale=this.options.locale;if(locale&&locale[key]){return locale[key]}else if($.ig&&$.ig.Editor&&$.ig.Editor.locale){return $.ig.Editor.locale[key]}else{return""}},_listItems:function(){return this._dropDownList.children(".ui-igedit-listitem")},_getListItemByIndex:function(index){return this._dropDownList.children(".ui-igedit-listitem:nth-child("+(index+1)+")")},_getSelectedItemIndex:function(){var items=this._listItems(),i;for(i=0;i<items.length;i++){if($(items[i]).hasClass(this.css.listItemSelected)){return i}}return-1},_setSelectedItemByIndex:function(index){var oldSelectedItem,newSelectedItem;if(this._getSelectedItemIndex()!==index){oldSelectedItem=this.getSelectedListItem();oldSelectedItem.removeClass(this.css.listItemSelected);oldSelectedItem.removeAttr("data-active");newSelectedItem=this._getListItemByIndex(index);newSelectedItem.addClass(this.css.listItemSelected);if(this.dropDownVisible()){newSelectedItem.attr("data-active",true)}}},displayValue:function(){return this._getDisplayValue()},dropDownContainer:function(){return this._dropDownList?this._dropDownList:null},showDropDown:function(){this._showDropDownList()},hideDropDown:function(){this._hideDropDownList()},clearButton:function(){return this._clearButton},dropDownButton:function(){return this._dropDownButton},spinUpButton:function(){return this._spinUpButton},spinDownButton:function(){return this._spinDownButton},dropDownVisible:function(){return this._dropDownList.is(":visible")},findListItemIndex:function(text,matchType){var list=this.options.listItems,matchCase="i",index=-1,regString,regExp,i;if(!list||list.length===0){return-1}switch(matchType){case"startsWith":regString="^{pattern}";break;case"endsWith":regString="{pattern}$";break;case"exact":regString="^{pattern}$";matchCase=undefined;break;default:regString="{pattern}";break}regExp=new RegExp(regString.replace("{pattern}",$.ig.util.escapeRegExp(text)),matchCase);for(i=0;i<list.length;i++){if(regExp.test(list[i])){index=i}}return index},selectedListIndex:function(index){if(index!==undefined){this._setSelectedItemByIndex(index)}else{return this._getSelectedItemIndex()}},getSelectedListItem:function(){return this._listItems().filter(".ui-igedit-listitemselected")},getSelectedText:function(){var text=this._editMode?this._editorInput.val():this.displayValue(),startIndex=this.getSelectionStart(),endIndex=this.getSelectionEnd();if(startIndex===undefined||endIndex===undefined||startIndex===null||endIndex===null||startIndex===endIndex){return""}return text.substring(startIndex,endIndex)},getSelectionStart:function(){return this._getSelection(this._editorInput[0]).start},getSelectionEnd:function(){return this._getSelection(this._editorInput[0]).end},insert:function(string){this._insertHandler(string)},select:function(start,end){this._setSelectionRange(this._editorInput[0],start,end)},spinUp:function(){this._spinUp()},spinDown:function(){this._spinDown()}});$.widget("ui.igNumericEditor",$.ui.igTextEditor,{options:{regional:null,negativeSign:null,negativePattern:null,decimalSeparator:null,groupSeparator:null,groups:null,maxDecimals:null,minDecimals:null,textAlign:"right",dataMode:"double",minValue:null,maxValue:null,allowNullValue:false,spinDelta:1,scientificFormat:null,spinWrapAround:false,maxLength:null,excludeKeys:null,includeKeys:null},events:{},css:{negative:"ui-igedit-negative"},_create:function(){$.ui.igTextEditor.prototype._create.call(this);if(!$.ig.util.isIE8){this._editorInput.attr("type","tel")}},_initialize:function(){this._super();this._applyRegionalSettings();this._applyDataModeSettings();this._setNumericType();var numericChars="0123456789",dataMode=this.options.dataMode;if(dataMode==="double"||dataMode==="float"){numericChars+=this.options.decimalSeparator;if(this.options.decimalSeparator!=="."){numericChars+="."}}if(this._getScientificFormat()){numericChars+=this._getScientificFormat()}if(dataMode==="double"||dataMode==="float"||dataMode==="long"||dataMode==="int"||dataMode==="short"||dataMode==="sbyte"){numericChars+=this.options.negativeSign}if(this.options.excludeKeys){this.options.excludeKeys=null}this.options.includeKeys=numericChars},_setNumericType:function(){this._numericType="numeric"},_getScientificFormat:function(){var result;if(this.options.scientificFormat){switch(this.options.scientificFormat){case"E":case"E+":{result="E"}break;case"e":case"e+":{result="e"}break;default:{result="e";throw $.ig.Editor.locale.scientificFormatErrMsg}}}else{result=null}return result},_applyRegionalSettings:function(){this.options.negativeSign=this._getRegionalOption("negativeSign");this.options.negativePattern=this.options.negativePattern||this._getRegionalOption("numericNegativePattern");this.options.decimalSeparator=this.options.decimalSeparator||this._getRegionalOption("numericDecimalSeparator");this.options.groupSeparator=this.options.groupSeparator||this._getRegionalOption("numericGroupSeparator");this.options.groups=this.options.groups||this._getRegionalOption("numericGroups");this.options.maxDecimals=this.options.maxDecimals===null?this._getRegionalOption("numericMaxDecimals"):this.options.maxDecimals;this.options.minDecimals=this.options.minDecimals===null?this._getRegionalOption("numericMinDecimals"):this.options.minDecimals},_applyOptions:function(){var delta,fractional;this._super();if(this.options.spinDelta!==1){delta=this.options.spinDelta;if(typeof delta!=="number"){this.options.spinDelta=1;throw new Error($.ig.Editor.locale.spinDeltaIsOfTypeNumber)}if(delta<0){this.options.spinDelta=1;throw new Error($.ig.Editor.locale.spinDeltaCouldntBeNegative)}if(this.options.dataMode==="float"||this.options.dataMode==="double"){if(delta%1!==0){fractional=delta.toString().substring(delta.toString().indexOf(".")+1);if(fractional.toString().length>this.options.maxDecimals){throw $.ig.util.stringFormat($.ig.Editor.locale.spinDeltaContainsExceedsMaxDecimals,this.options.maxDecimals)}}}else{if(delta%1!==0){throw $.ig.Editor.locale.spinDeltaIncorrectFloatingPoint}}}if(this.options.scientificFormat){this.options.spinDelta=Number(this.options.spinDelta.toExponential())}if(this.options.maxLength!==null){this.options.maxLength=null}},_setOption:function(option,value){var prevValue=this.options[option];if(prevValue===value){return}$.Widget.prototype._setOption.apply(this,arguments);switch(option){case"spinDelta":{if(typeof value!=="number"){this.options[option]=prevValue;throw new Error($.ig.Editor.locale.spinDeltaIsOfTypeNumber)}else if(value<0){this.options[option]=prevValue;throw new Error($.ig.Editor.locale.spinDeltaCouldntBeNegative)}else if(this.options.dataMode!=="float"&&this.options.dataMode!=="double"&&value%1!==0){this.options[option]=prevValue;throw new Error($.ig.Editor.locale.spinDeltaIncorrectFloatingPoint)}else if(this.options.scientificFormat){this.options[option]=Number(value.toExponential())}break}case"minDecimals","maxDecimals":value=parseFloat(value);if(isNaN(value)){this.options[option]=prevValue;throw new Error($.ig.Editor.locale.notEditableOptionByInit)}break;default:{this.options[option]=prevValue;this._super(option,value)}break}},_processValueChanging:function(value){if(typeof value==="string"||value instanceof String){value=value.trim();value=this._parseNumericValueByMode(value,this._numericType,this.options.dataMode);if(this._numericType==="percent"&&this.options.displayFactor){value/=this.options.displayFactor}}this._super(value)},_processInternalValueChanging:function(value){if(!this._validateValue(value)){value=this._parseNumericValueByMode(value,this._numericType,this.options.dataMode);if(value!==""&&!isNaN(value)){if(this.options.revertIfNotValid){value=this._valueInput.val()}else{if(value<=this.options.minValue){value=this.options.minValue}else{value=this.options.maxValue}}}else{if(this.options.allowNullValue){value=this.options.nullValue}else{if(this.options.revertIfNotValid){value=this._valueInput.val()}else{value=0;if(this.options.minValue>0){value=this.options.minValue}else if(this.options.maxValue<0){value=this.options.maxValue}else{value=0}}}}}if(value!==this.value()){this._updateValue(value)}this._setSpinButtonsState(value)},_triggerKeyDown:function(event){var e=event,noCancel,args,currentInputVal;args={owner:this,element:event.target,key:event.keyCode,editorInput:this._editorInput};noCancel=this._trigger(this.events.keydown,event,args);if(noCancel){this._clearEditorNotifier();if(e.keyCode===13){currentInputVal=this._editorInput.val();this._processValueChanging(currentInputVal)}else if(e.keyCode===38){if(e.altKey&&this._dropDownList&&this._dropDownList.is(":visible")){this._toggleDropDown()}else if(!this.options.readOnly){this._handleSpinUpEvent()}}else if(e.keyCode===40){if(e.altKey&&this._dropDownList&&!this._dropDownList.is(":visible")){this._toggleDropDown()}else if(!this.options.readOnly){this._handleSpinDownEvent()}}else if(e.keyCode===27&&this._dropDownList&&this._dropDownList.is(":visible")){this._toggleDropDown()}else if(this.options.maxLength){currentInputVal=this._editorInput.val();if(currentInputVal.length===this.options.maxLength&&e.keyCode>46&&!e.altKey&&!e.ctrlKey&&!e.shiftKey){e.preventDefault();e.stopPropagation()}}}},_applyDataModeSettings:function(){var doubleMaxDecimals=15;switch(this.options.dataMode){case"double":{this._setMinMaxValues(-Number.MAX_VALUE,Number.MAX_VALUE);this._setMinMaxDecimals(doubleMaxDecimals)}break;case"float":{var floatMaxDecimals=7,floatMinValue=-3.40282347e38,floatMaxValue=3.40282347e38;this._setMinMaxValues(floatMinValue,floatMaxValue);this._setMinMaxDecimals(floatMaxDecimals)}break;case"long":{var longMinValue=-0x8000000000000000,longMaxValue=0x8000000000000000;this._setMinMaxValues(longMinValue,longMaxValue)}break;case"ulong":{var ulongMinValue=0,ulongMaxValue=0x10000000000000000;this._setMinMaxValues(ulongMinValue,ulongMaxValue)}break;case"int":{var intMinValue=-2147483647,intMaxValue=2147483647;this._setMinMaxValues(intMinValue,intMaxValue)}break;case"uint":{var uintMinValue=0,uintMaxValue=4294967295;this._setMinMaxValues(uintMinValue,uintMaxValue)}break;case"short":{var shortMinValue=-32768,shortMaxValue=32767;this._setMinMaxValues(shortMinValue,shortMaxValue)}break;case"ushort":{var ushortMinValue=0,ushortMaxValue=65535;this._setMinMaxValues(ushortMinValue,ushortMaxValue)}break;case"sbyte":{var sbyteMinValue=-127,sbyteMaxValue=127;this._setMinMaxValues(sbyteMinValue,sbyteMaxValue)}break;case"byte":{var byteMinValue=0,byteMaxValue=256;this._setMinMaxValues(byteMinValue,byteMaxValue)}break;default:{this.options.dataMode="double";this._setMinMaxValues(Number.MIN_VALUE,Number.MAX_VALUE);this._setMinMaxDecimals(doubleMaxDecimals)}}},_setMinMaxDecimals:function(typeMaxDecimals){if(this.options.maxDecimals===null||this.options.maxDecimals>typeMaxDecimals){this.options.maxDecimals=typeMaxDecimals}if(this.options.minDecimals&&this.options.minDecimals>this.options.maxDecimals){this.options.maxDecimals=this.options.minDecimals}},_setMinMaxValues:function(typeMinValue,typeMaxValue){if(this.options.minValue===null||this.options.minValue<typeMinValue){this.options.minValue=typeMinValue}if(this.options.maxValue===null||this.options.maxValue>typeMaxValue){this.options.maxValue=typeMaxValue}},_parseNumericValueByMode:function(value,numericEditorType,dataMode){var val,stringValue,decimalSeparator,groupSeparator,minDecimals,maxDecimals;decimalSeparator=this.options.decimalSeparator;groupSeparator=this.options.groupSeparator;minDecimals=this.options.minDecimals;maxDecimals=this.options.maxDecimals;if(value===null||value===""){return value}value=value.toString().replace(new RegExp(groupSeparator,"g"),"");if(numericEditorType==="percent"){value=value.replace(this.options.percentSymbol,"").trim()}else if(numericEditorType==="currency"){value=value.replace(this.options.currencySymbol,"").trim()}if(dataMode==="double"||dataMode==="float"){stringValue=value.toString().toLowerCase();if(stringValue.indexOf("e")!==-1){val=value}else{if(stringValue.indexOf(decimalSeparator)!==-1||stringValue.indexOf(".")!==-1){var integerDigits,fractionalDigits;if(stringValue.indexOf(".")!==-1){decimalSeparator="."}fractionalDigits=stringValue.substring(stringValue.indexOf(decimalSeparator)+1);if(fractionalDigits.indexOf(decimalSeparator)>0){fractionalDigits=fractionalDigits.substring(0,fractionalDigits.indexOf(decimalSeparator))}if(fractionalDigits.length>maxDecimals){fractionalDigits=fractionalDigits.substring(0,maxDecimals)}integerDigits=stringValue.substring(0,stringValue.indexOf(decimalSeparator));val=(integerDigits+"."+fractionalDigits)/1}else{val=parseFloat(parseInt(value).toFixed(minDecimals))}}}else{if(this._numericType==="percent"&&this.options.displayFactor===100&&this.options.dateMode==="int"&&parseInt(value)!==parseInt(this._editorInput.val())){val=value}else{val=parseInt(value)}}if(this.options.scientificFormat&&val.toString().toLowerCase().indexOf("e")===-1){val=val.toExponential()}return val},_updateValue:function(value){var val,dataMode=this.options.dataMode;if(value===""&&this.options.allowNullValue){val=this.options.nullValue;this._valueInput.val("")}else if(value===this.options.nullValue&&value===null){val=value;this._valueInput.val("")}else{val=this._parseNumericValueByMode(value,this._numericType,dataMode);this._valueInput.val(val)}this.options.value=val},_validateKey:function(event){if(this._super(event)){var dataMode=this.options.dataMode,negativeSign=this.options.negativeSign,ch,val,cursorPos=this._getCursorPosition(),isDecimal=event.which?event.which===46:false;ch=String.fromCharCode(event.charCode||event.which);if(ch===negativeSign&&cursorPos>0){return false}if(dataMode==="double"||dataMode==="float"){var decimalSeparator=this.options.decimalSeparator;val=this._editorInput.val();if(decimalSeparator!=="."&&isDecimal&&(val.indexOf(".")!==-1||val.indexOf(decimalSeparator)!==-1)&&cursorPos!==-1){return false}if((ch===decimalSeparator||isDecimal)&&(val.indexOf(decimalSeparator)!==-1||val.indexOf(".")!==-1)&&cursorPos!==-1||ch===negativeSign&&val.indexOf(negativeSign)!==-1&&cursorPos!==-1){return false}else{return true}}else if(dataMode==="long"||dataMode==="int"||dataMode==="short"||dataMode==="sbyte"){val=$(event.target).val();if(ch===negativeSign&&val.indexOf(negativeSign)>0&&cursorPos!==-1){return false}else{return true}}else{return true}}else{return false}},_disableSpinButton:function(target){if(target&&!target.attr("disabled")&&!this.options.spinWrapAround){target.addClass(this.css.disabled);target.attr("disabled",true);target.removeClass(this.css.buttonHover);if(target._pressed){delete target._pressed;target.removeClass(this.css.buttonPressed)}if(target._spinTimeOut){clearTimeout(target._spinTimeOut);delete this._spinUpButton._spinTimeOut}if(target._spinInterval){clearInterval(target._spinInterval);delete target._spinInterval}this._detachButtonsEvents(target)}},_enableSpinButton:function(target,type){if(target&&target.attr("disabled")){target.removeClass(this.css.disabled);target.attr("disabled",false);this._attachButtonsEvents(type,target)}},_setSpinButtonsState:function(val){if(typeof val==="string"||val instanceof String){val=val.trim()}if(val===null){this._enableSpinButton(this._spinDownButton,"spinDown");this._enableSpinButton(this._spinUpButton,"spinUp");return}if(val!==""&&!this.options.spinWrapAround){if(val>=this.options.maxValue){this._disableSpinButton(this._spinUpButton);this._enableSpinButton(this._spinDownButton,"spinDown");
this._sendNotification("warning",$.ig.util.stringFormat($.ig.Editor.locale.maxValErrMsg,this.options.maxValue))}else if(val<=this.options.minValue){this._disableSpinButton(this._spinDownButton);this._enableSpinButton(this._spinUpButton,"spinUp");this._sendNotification("warning",$.ig.util.stringFormat($.ig.Editor.locale.minValErrMsg,this.options.minValue))}else{this._enableSpinButton(this._spinDownButton,"spinDown");this._enableSpinButton(this._spinUpButton,"spinUp")}}},_validateValue:function(val){var result;if(this._super(val)&&!isNaN(val=this._parseNumericValueByMode(val,this._numericType,this.options.dataMode))){if(val>this.options.maxValue){result=false;if(this.options.revertIfNotValid){this._sendNotification("warning",$.ig.util.stringFormat($.ig.Editor.locale.maxValExceedRevertErrMsg,this.options.maxValue))}}else if(val<this.options.minValue){result=false;if(this.options.revertIfNotValid){this._sendNotification("warning",$.ig.util.stringFormat($.ig.Editor.locale.minValExceedRevertErrMsg,this.options.minValue))}}else{result=true}}else{result=false}return result},_insert:function(newValue,previousValue){if(!isNaN(newValue=this._parseNumericValueByMode(newValue,this._numericType,this.options.dataMode))){if(this.options.maxValue&&newValue>this.options.maxValue){newValue=this.options.maxValue}else if(this.options.minValue&&newValue<this.options.minValue){newValue=this.options.minValue}if(!this._validateValue(newValue)&&this.options.revertIfNotValid){newValue=previousValue}}else if(this.options.revertIfNotValid){newValue=previousValue}else{newValue=""}this._editorInput.val(newValue);this._setSpinButtonsState(newValue);this._processTextChanged()},_clearValue:function(){if(this.options.allowNullValue){this._updateValue(this.options.nullValue);if(this.options.nullValue===null){this._editorInput.val("")}else{this._editorInput.val(this.options.nullValue)}}else{if(this.options.minValue&&this.options.minValue>0){this._updateValue(this.options.minValue);this._editorInput.val(this.options.minValue)}else if(this.options.maxValue&&this.options.maxValue<0){this._updateValue(this.options.maxValue);this._editorInput.val(this.options.maxValue)}else{if(this.value()){this._updateValue(0);this._editorInput.val(0)}}}if(this.dropDownContainer()&&this.dropDownContainer().children(".ui-igedit-listitemselected").length>0){this.dropDownContainer().children(".ui-igedit-listitemselected").removeClass(this.css.listItemSelected)}},_getRegionalOption:function(key){var regional=this.options.regional;if(this.options[key]){return this.options[key]}if(typeof regional==="string"){regional=$.ig.regional[regional]}if(regional&&regional[key]){return regional[key]}else{return $.ig.regional.defaults[key]}},_convertScientificToNumeric:function(num){var parts=num.toString().split("e+"),first,zeroes,i;first=parts[0].replace(".","");zeroes=parseInt(parts[1],10)-(first.length-1);for(i=0;i<zeroes;i++){first+="0"}return first},_getDisplayValue:function(){var value=this._valueInput.val(),decimalSeparator=this.options.decimalSeparator,decimalPoint=".",minDecimals=this.options.minDecimals,dataMode=this.options.dataMode,stringValue,displayValue,integerDigits,fractionalDigits,scientificPrecision,scientificValue,positivePattern,negativePattern,groups,groupSeparator,symbol="";if(value===this.options.nullValue||value===""||isNaN(value)){if(isNaN(value)){this._valueInput.val("");return""}else{return value}}if(this._numericType!=="numeric"){positivePattern=this.options.positivePattern;symbol=this.options[this._numericType+"Symbol"]}negativePattern=this.options.negativePattern;groups=this.options.groups;groupSeparator=this.options.groupSeparator;if(this._numericType==="percent"&&this.options.displayFactor){value*=this.options.displayFactor;value=this._parseNumericValueByMode(value,this._numericType,this.options.dataMode)}if(dataMode==="double"||dataMode==="float"){stringValue=value.toString().toLowerCase();if(this.options.scientificFormat){if(stringValue.indexOf("e")!==-1){displayValue=stringValue.replace("e",this._getScientificFormat())}else{scientificValue=(stringValue/1).toExponential();displayValue=scientificValue.toString().replace("e",this._getScientificFormat())}}else{if(stringValue.indexOf("e")!==-1){scientificPrecision=stringValue.substring(stringValue.toLowerCase().indexOf("e")+1);stringValue=stringValue/1;if(scientificPrecision>0){stringValue=this._convertScientificToNumeric(stringValue)}else{stringValue=stringValue.toFixed(Math.abs(scientificPrecision))}}if(stringValue.indexOf("e")!==-1){displayValue=stringValue}else{if(stringValue.indexOf(decimalPoint)!==-1){fractionalDigits=stringValue.substring(stringValue.indexOf(decimalPoint)+1);if(fractionalDigits.length<minDecimals){var missingDecimals=minDecimals-fractionalDigits.length;while(missingDecimals>0){fractionalDigits+="0";missingDecimals--}}integerDigits=stringValue.substring(0,stringValue.indexOf(decimalPoint))}else{integerDigits=stringValue;if(minDecimals>0){stringValue=parseInt(stringValue).toFixed(minDecimals);fractionalDigits=stringValue.substring(stringValue.indexOf(decimalPoint)+1)}}integerDigits=this._applyGroups(integerDigits,groups,groupSeparator);if(fractionalDigits&&fractionalDigits.length>0){displayValue=integerDigits+decimalSeparator+fractionalDigits}else{displayValue=integerDigits}}}}else{displayValue=this._applyGroups(value.toString(),groups,groupSeparator)}if(value<0&&(this.options.scientificFormat===null||displayValue.indexOf("e")===-1)){displayValue=displayValue.replace("-","");displayValue=negativePattern.replace("n",displayValue).replace("$",symbol)}else if(positivePattern&&(this.options.scientificFormat===null||displayValue.indexOf("e")===-1)){displayValue=positivePattern.replace("n",displayValue).replace("$",symbol)}return displayValue},_applyGroups:function(integerDigits,groups,groupSeparator){var digitsPosition=integerDigits.length-1,br=1,l=groups.length,digitsLimit=0,group;group=groups.length>0?groups[0]:0;if(group>integerDigits.length||group===0){return integerDigits}if(parseFloat(integerDigits)<0){digitsLimit=1}for(digitsPosition;digitsPosition>digitsLimit;digitsPosition--){if(--group===0){integerDigits=integerDigits.substring(0,digitsPosition)+groupSeparator+integerDigits.substring(digitsPosition);if(br===l){group=groups[--br]}else{group=groups[br];br++}}}return integerDigits},_enterEditMode:function(){var val,selection=this._getSelection(this._editorInput[0]);if(!$.ig.util.isIE8){this._editorInput.attr("type","tel")}this._currentInputTextValue=this._editorInput.val();val=this._valueInput.val();if(val<0){this._editorInput.removeClass(this.css.negative)}if(this._numericType==="percent"&&this.options.displayFactor){val=this._parseNumericValueByMode(val,this._numericType,this.options.dataMode);val*=this.options.displayFactor}if(this.options.decimalSeparator!=="."){val=val.toString().replace(".",this.options.decimalSeparator)}this._editorInput.val(val);this._editMode=true;this._positionCursor(selection.start,selection.end);this._processTextChanged()},_exitEditMode:function(){this._super();if(this.value()<0){this._editorInput.addClass(this.css.negative)}else{this._editorInput.removeClass(this.css.negative)}},_getSpinValue:function(spinType,currentValue,decimalSeparator){var fractional,scientificPrecision,spinPrecision,spinDelta,toFixedVal,precision;if(currentValue.toString().toLowerCase().indexOf("e")!==-1){currentValue=Number(currentValue);if(this.options.spinDelta.toString().toLowerCase().indexOf("e")===-1){spinDelta=Number(this.options.spinDelta.toExponential())}else{spinDelta=this.options.spinDelta}if(spinType==="spinUp"){currentValue+=spinDelta}else{currentValue-=spinDelta}}else if(currentValue.toString().indexOf(decimalSeparator)!==-1){fractional=currentValue.substring(currentValue.toString().indexOf(decimalSeparator)+1);toFixedVal=fractional.toString().length;if(decimalSeparator!=="."){currentValue.replace(decimalSeparator,".")}currentValue=currentValue/1;if((this.options.displayFactor?this.options.spinDelta*this.options.displayFactor:this.options.spinDelta)%1===0){if(spinType==="spinUp"){currentValue+=this.options.spinDelta}else{currentValue-=this.options.spinDelta}}else{if(this.options.spinDelta.toString().toLowerCase().indexOf("e")!==-1){currentValue=Number(currentValue.toExponential());scientificPrecision=this.options.spinDelta.toString().toLowerCase().substring(this.options.spinDelta.toString().toLowerCase().indexOf("e")+1);spinPrecision=Math.abs(scientificPrecision);precision=Math.pow(10,spinPrecision)}else{precision=Math.pow(10,this.options.spinDelta.toString().toLowerCase().substring(this.options.spinDelta.toString().toLowerCase().indexOf(".")+1).length)}if(spinType==="spinUp"){if(currentValue===0&&scientificPrecision){currentValue=this.options.spinDelta.toFixed(spinPrecision)}else{currentValue=(Math.round(currentValue*precision)+Math.round(this.options.spinDelta*precision))/precision}}else{if(currentValue===0&&scientificPrecision){currentValue=(-this.options.spinDelta).toFixed(spinPrecision)}else{currentValue=(Math.round(currentValue*precision)-Math.round(this.options.spinDelta*precision))/precision}}}if(currentValue.toString().substring(currentValue.toString().indexOf(".")+1).length<fractional.length){currentValue=currentValue.toFixed(toFixedVal)}if(decimalSeparator!=="."){currentValue.replace(".",decimalSeparator)}}else{currentValue=currentValue/1;if((this.options.displayFactor?this.options.spinDelta*this.options.displayFactor:this.options.spinDelta)%1===0){if(spinType==="spinUp"){currentValue+=this.options.spinDelta}else{currentValue-=this.options.spinDelta}}else{if(this.options.spinDelta.toString().toLowerCase().indexOf("e")!==-1){scientificPrecision=this.options.spinDelta.toString().toLowerCase().substring(this.options.spinDelta.toString().toLowerCase().indexOf("e")+1);spinPrecision=Math.abs(scientificPrecision);precision=Math.pow(10,spinPrecision)}else{precision=Math.pow(10,this.options.spinDelta.toString().toLowerCase().substring(this.options.spinDelta.toString().toLowerCase().indexOf(".")+1).length)}if(spinType==="spinUp"){if(currentValue===0){currentValue=this.options.spinDelta.toFixed(spinPrecision)}else{currentValue=(Math.round(currentValue*precision)+Math.round(this.options.spinDelta*precision))/precision}}else{if(currentValue===0){currentValue=(-this.options.spinDelta).toFixed(spinPrecision)}else{currentValue=(Math.round(currentValue*precision)-Math.round(this.options.spinDelta*precision))/precision}}}}return currentValue},_spinUp:function(){var currVal,decimalSeparator=this.options.decimalSeparator,noCancel;if(this._focused){currVal=this._editorInput.val()}else{if(this.value()||this.value()===0){currVal=this.value().toString()}else{currVal=""}}this._clearEditorNotifier();this._currentInputTextValue=this._editorInput.val();currVal=this._getSpinValue("spinUp",currVal,decimalSeparator);if(!this._validateValue(currVal)&&currVal>this.options.maxValue&&this.options.spinWrapAround||currVal<this.options.minValue){currVal=this.options.minValue;this._sendNotification("warning",$.ig.util.stringFormat($.ig.Editor.locale.maxValExceededWrappedAroundErrMsg,this.options.maxValue))}else if(currVal>=this.options.maxValue&&!this.options.spinWrapAround){currVal=this.options.maxValue;this._sendNotification("warning",$.ig.util.stringFormat($.ig.Editor.locale.maxValErrMsg,this.options.maxValue))}if(this._focused){if(this.options.scientificFormat){currVal=Number(currVal).toExponential().replace("e",this._getScientificFormat())}this._editorInput.val(currVal);this._processTextChanged()}else{noCancel=this._triggerValueChanging(currVal);if(noCancel){this._updateValue(currVal);this._exitEditMode();this._triggerValueChanged(currVal)}}this._setSpinButtonsState(currVal)},_spinDown:function(){var currVal,decimalSeparator=this.options.decimalSeparator,noCancel;if(this._focused){currVal=this._editorInput.val()}else{if(this.value()||this.value()===0){currVal=this.value().toString()}else{currVal=""}}this._clearEditorNotifier();this._currentInputTextValue=this._editorInput.val();currVal=this._getSpinValue("spinDown",currVal,decimalSeparator);if(!this._validateValue(currVal)&&currVal<this.options.minValue&&this.options.spinWrapAround||currVal>this.options.maxValue){currVal=this.options.maxValue;this._sendNotification("warning",$.ig.util.stringFormat($.ig.Editor.locale.minValExceededWrappedAroundErrMsg,this.options.minValue))}else if(currVal<=this.options.minValue&&!this.options.spinWrapAround){currVal=this.options.minValue;this._sendNotification("warning",$.ig.util.stringFormat($.ig.Editor.locale.minValErrMsg,this.options.minValue))}if(this._focused){this._editorInput.val(currVal);this._processTextChanged()}else{noCancel=this._triggerValueChanging(currVal);if(noCancel){this._updateValue(currVal);this._exitEditMode();this._triggerValueChanged(currVal)}}this._setSpinButtonsState(currVal)},_handleSpinUpEvent:function(){var cursorPosition=this._getCursorPosition();if(this.options.dataMode==="double"||this.options.dataMode==="float"){if(this._focused){switch(this._fractionalOrIntegerSelected(cursorPosition)){case"fractional":{this._spinUp(true);this._setSelectionRange(this._editorInput[0],cursorPosition,cursorPosition)}break;case"integer":{this._spinUp();this._setSelectionRange(this._editorInput[0],cursorPosition,cursorPosition)}break;case"all":{this._spinUp();this._editorInput.select()}break;default:this._spinUp();this._editorInput.select()}}else{this._spinUp()}}else{this._spinUp()}},_handleSpinDownEvent:function(){var cursorPosition=this._getCursorPosition();if(this.options.dataMode==="double"||this.options.dataMode==="float"){if(this._focused){switch(this._fractionalOrIntegerSelected(cursorPosition)){case"fractional":{this._spinDown(true);this._setSelectionRange(this._editorInput[0],cursorPosition,cursorPosition)}break;case"integer":{this._spinDown();this._setSelectionRange(this._editorInput[0],cursorPosition,cursorPosition)}break;case"all":{this._spinDown();this._editorInput.select()}break;default:this._spinDown();this._editorInput.select()}}else{this._spinDown()}}else{this._spinDown()}},_fractionalOrIntegerSelected:function(cursorPosition){var decimalSeparator,val;if(cursorPosition===-1){return"all"}else{decimalSeparator=this.options.decimalSeparator;val=this._editorInput.val();if(val.indexOf(decimalSeparator)<0){return"all"}else{if(cursorPosition<=val.indexOf(decimalSeparator)){return"integer"}else{return"fractional"}}}},value:function(newValue){if(newValue!==undefined){if(newValue!==null&&!isNaN(this._parseNumericValueByMode(newValue,this._numericType,this.options.dataMode))){if(this._validateValue(newValue)){this._updateValue(newValue);if(!this._focused){this._editorInput.val(this._getDisplayValue())}}else{if(newValue<this.options.minValue){newValue=this.options.minValue}else if(newValue>this.options.maxValue){newValue=this.options.maxValue}this._updateValue(newValue);if(!this._focused){this._editorInput.val(this._getDisplayValue())}}this._setSpinButtonsState(newValue)}else{if(this.options.revertIfNotValid&&!(newValue===null&&this.options.allowNullValue)){newValue=this._valueInput.val()}else{this._clearValue()}}if(newValue<0){this._editorInput.addClass(this.css.negative)}else{this._editorInput.removeClass(this.css.negative)}}else{return this.options.value}},findListItemIndex:function(number){var list=this.options.listItems,i;for(i=0;i<list.length;i++){if(this._parseNumericValueByMode(list[i],this._numericType,this.options.dataMode)===number){return i}}return-1},getSelectedText:function(){throw $.ig.Editor.locale.numericEditorNoSuchMethod},getSelectionStart:function(){throw $.ig.Editor.locale.numericEditorNoSuchMethod},getSelectionEnd:function(){throw $.ig.Editor.locale.numericEditorNoSuchMethod},spinUp:function(){this._super()},spinDown:function(){this._super()},selectListIndexUp:function(){},selectListIndexDown:function(){},getRegionalOption:function(){this._getRegionalOption()}});$.widget("ui.igCurrencyEditor",$.ui.igNumericEditor,{options:{positivePattern:null,currencySymbol:null},events:{},_create:function(){$.ui.igNumericEditor.prototype._create.call(this)},_setNumericType:function(){this._numericType="currency"},_applyRegionalSettings:function(){this.options.negativeSign=this._getRegionalOption("negativeSign");this.options.currencySymbol=this._getRegionalOption("currencySymbol");this.options.positivePattern=this.options.positivePattern||this._getRegionalOption("currencyPositivePattern");this.options.negativePattern=this.options.negativePattern||this._getRegionalOption("currencyNegativePattern");this.options.decimalSeparator=this.options.decimalSeparator||this._getRegionalOption("currencyDecimalSeparator");this.options.groupSeparator=this.options.groupSeparator||this._getRegionalOption("currencyGroupSeparator");this.options.groups=this.options.groups||this._getRegionalOption("currencyGroups");this.options.maxDecimals=this.options.maxDecimals===null?this._getRegionalOption("currencyMaxDecimals"):this.options.maxDecimals;this.options.minDecimals=this.options.minDecimals===null?this._getRegionalOption("currencyMinDecimals"):this.options.minDecimals},currencySymbol:function(symbol){if(symbol){this.options.currencySymbol=symbol}else{return this.options.currencySymbol}}});$.widget("ui.igPercentEditor",$.ui.igNumericEditor,{options:{positivePattern:null,percentSymbol:null,displayFactor:100,dataMode:"float",spinDelta:.01},events:{},_create:function(){$.ui.igNumericEditor.prototype._create.call(this)},_setNumericType:function(){this._numericType="percent"},_insert:function(newValue,previousValue){if(!isNaN(newValue=this._parseNumericValueByMode(newValue,this._numericType,this.options.dataMode))){if(this.options.maxValue&&newValue/this.options.displayFactor>this.options.maxValue){newValue=this.options.maxValue*this.options.displayFactor}else if(this.options.minValue&&newValue/this.options.displayFactor<this.options.minValue){newValue=this.options.minValue*this.options.displayFactor}if(!this._validateValue(newValue/this.options.displayFactor)&&this.options.revertIfNotValid){newValue=previousValue}}else if(this.options.revertIfNotValid){newValue=previousValue}else{newValue=""}this._editorInput.val(newValue);this._setSpinButtonsState(newValue/this.options.displayFactor);this._processTextChanged()},_applyRegionalSettings:function(){this.options.negativeSign=this.options.negativeSign||this._getRegionalOption("negativeSign");this.options.percentSymbol=this.options.percentSymbol||this._getRegionalOption("percentSymbol");this.options.positivePattern=this.options.positivePattern||this._getRegionalOption("percentPositivePattern");this.options.negativePattern=this.options.negativePattern||this._getRegionalOption("percentNegativePattern");this.options.decimalSeparator=this.options.decimalSeparator||this._getRegionalOption("percentDecimalSeparator");this.options.groupSeparator=this.options.groupSeparator||this._getRegionalOption("percentGroupSeparator");this.options.groups=this.options.groups||this._getRegionalOption("percentGroups");this.options.maxDecimals=this.options.maxDecimals===null?this._getRegionalOption("percentMaxDecimals"):this.options.maxDecimals;this.options.minDecimals=this.options.minDecimals===null?this._getRegionalOption("percentMinDecimals"):this.options.minDecimals;if(this.options.displayFactor===100){this.options.maxDecimals+=2}this.options.displayFactor=this.options.displayFactor||this._getRegionalOption("displayFactor");if(typeof this.options.displayFactor!=="number"){throw new Error($.ig.Editor.locale.displayFactorIsOfTypeNumber)}else if(this.options.displayFactor!==1&&this.options.displayFactor!==100){throw new Error($.ig.Editor.locale.displayFactorAllowedValue)}},_setOption:function(option,value){var prevValue=this.options[option];if(prevValue===value){return}$.Widget.prototype._setOption.apply(this,arguments);switch(option){case"displayFactor":{if(typeof value!=="number"){this.options[option]=prevValue;throw new Error($.ig.Editor.locale.displayFactorIsOfTypeNumber)}else if(value!==1&&value!==100){this.options[option]=prevValue;throw new Error($.ig.Editor.locale.displayFactorAllowedValue)}}break;default:{this.options[option]=prevValue;this._super(option,value)}break}},percentSymbol:function(symbol){if(symbol){this.options.percentSymbol=symbol}else{return this.options.percentSymbol}}});$.widget("ui.igMaskEditor",$.ui.igTextEditor,{options:{regional:null,inputMask:"CCCCCCCCCC",dataMode:"allText",unfilledCharsPrompt:"_",padChar:" ",emptyChar:" "},events:{},_create:function(){$.ui.igTextEditor.prototype._create.call(this)},_initialize:function(){this._super();if(this.options.maxLength){this.options.maxLength=null}if(this.options.listItems){this.options.listItems=null}if(this._maskFlagsArray){this._maskFlagsArray=$.merge(this._maskFlagsArray,["C","&","a","A","?","L","9","0","<",">"])}else{this._maskFlagsArray=["C","&","a","A","?","L","9","0","<",">"]}},_applyOptions:function(){this._super();if(this.options.value===null||this.options.value===undefined){this._setInitialValue()}},_replaceCharAt:function(stringValue,index,ch){if(stringValue!==undefined){return stringValue.substring(0,index)+ch+stringValue.substring(index+1)}},_getStringRange:function(stringValue,start,end){if(stringValue!==undefined){return stringValue.substring(start,end)}},_replaceStringRange:function(stringValue,replacementValue,indexStart,indexEnd){var i=0;while(indexStart<=indexEnd){stringValue=this._replaceCharAt(stringValue,indexStart,replacementValue.charAt(i));i++;indexStart++}return stringValue},_enterEditMode:function(){var selection=this._getSelection(this._editorInput[0]);this._editMode=true;this._currentInputTextValue=this._editorInput.val();if(this._maskedValue===""){this._editorInput.val(this._maskWithPrompts)}else{this._editorInput.val(this._maskedValue)}this._positionCursor(selection.start,selection.end);this._processTextChanged()},_insert:function(newValue){var selection=this._getSelection(this._editorInput[0]);if(this.options.toUpper){if(newValue){newValue=newValue.toLocaleUpperCase()}}else if(this.options.toLower){if(newValue){newValue=newValue.toLocaleLowerCase()}}newValue=this._parseValueByMask(newValue);this._editorInput.val(newValue);this._processTextChanged();this._setCursorPosition(selection.start+newValue.length)},_attachEvents:function(){var self=this;self._super();this._editorInput.on({"dragend.editor":function(){self._handleDeleteKey(true)},"cut.editor":function(){self._handleDeleteKey(true)}})},_detachEvents:function(){this._super();this._editorInput.off("cut.editor dragend.editor")},_getMaskLiteralsAndRequiredPositions:function(){var mask,literalIndeces=[],requiredFieldsIndeces=[],maskFlagsArray=this._maskFlagsArray,output,maskChar,unescapedMask,i,j,isToLower=false,isToUpper=false,toLowerIndeces=[],toUpperIndeces=[];output=unescapedMask=mask=this.options.inputMask;for(i=0,j=0;i<mask.length;i++,j++){maskChar=mask.charAt(i);if($.inArray(maskChar,maskFlagsArray)!==-1){if(isToLower){toLowerIndeces.push(j)}else if(isToUpper){toUpperIndeces.push(j)}if(maskChar==="&"||maskChar==="A"||maskChar==="L"||maskChar==="0"){requiredFieldsIndeces.push(j)}else if(maskChar===">"){if(!isToUpper){isToUpper=true;if(isToLower){isToLower=false;toLowerIndeces.pop()}}else{isToUpper=false;toUpperIndeces.pop()}unescapedMask=this._replaceCharAt(unescapedMask,j,"");j--}else if(maskChar==="<"){if(!isToLower){isToLower=true;if(isToUpper){isToUpper=false;toUpperIndeces.pop()}}else{isToLower=false;toLowerIndeces.pop()}unescapedMask=this._replaceCharAt(unescapedMask,j,"");j--}}else if(maskChar==="\\"){if($.inArray(mask.charAt(i+1),maskFlagsArray)!==-1){unescapedMask=this._replaceCharAt(unescapedMask,j,"");i++}literalIndeces.push(j)}else{literalIndeces.push(j)}}this._literalIndeces=literalIndeces;this._requiredIndeces=requiredFieldsIndeces;this._toLowerIndeces=toLowerIndeces;this._toUpperIndeces=toUpperIndeces;this._unescapedMask=unescapedMask},_validateValue:function(val){return this._super(val)},_parseValueByMask:function(value){var mask=this.options.inputMask,outputVal=mask,ch,maskFlagsArray=this._maskFlagsArray,length=mask.length,i,j;value=value?value.toString():"";if(length&&length>0){for(i=0,j=0;i<length;i++,j++){ch=value.charAt(j);if(this._validateCharOnPostion(ch,i)===null){if(mask.charAt(i)==="\\"){i++;j--}else if(mask.charAt(i)==="<"||mask.charAt(i)===">"){j--}}else if(this._validateCharOnPostion(ch,i)===true){outputVal=this._replaceCharAt(outputVal,i,ch)}else{outputVal=this._replaceCharAt(outputVal,i,this.options.unfilledCharsPrompt)}}for(i=0;i<outputVal.length;i++){ch=outputVal.charAt(i);if(ch==="\\"&&$.inArray(outputVal.charAt(i+1),maskFlagsArray)!==-1){outputVal=this._replaceCharAt(outputVal,i,"")}else if(ch==="<"||ch===">"){outputVal=this._replaceCharAt(outputVal,i,"");i--}else if($.inArray(i,this._toLowerIndeces)!==-1){outputVal=this._replaceCharAt(outputVal,i,outputVal.charAt(i).toLocaleLowerCase())}else if($.inArray(i,this._toUpperIndeces)!==-1){outputVal=this._replaceCharAt(outputVal,i,outputVal.charAt(i).toLocaleUpperCase())}}}return outputVal},_getValueByDataMode:function(){var dataModeValue,regExpr,i,ch,maskedVal=this._maskedValue,dataMode=this.options.dataMode;switch(dataMode){case"allText":{regExpr=new RegExp($.ig.util.escapeRegExp(this.options.unfilledCharsPrompt),"g");dataModeValue=maskedVal.replace(regExpr,this.options.emptyChar)}break;case"rawText":{dataModeValue="";for(i=0;i<maskedVal.length;i++){ch=maskedVal.charAt(i);if($.inArray(i,this._literalIndeces)===-1&&ch!==this.options.unfilledCharsPrompt){dataModeValue+=ch}}}break;case"rawTextWithRequiredPrompts":{dataModeValue="";for(i=0;i<maskedVal.length;i++){ch=maskedVal.charAt(i);if($.inArray(i,this._literalIndeces)===-1){if(ch===this.options.unfilledCharsPrompt){if($.inArray(i,this._requiredIndeces)!==-1){dataModeValue+=this.options.emptyChar}}else{dataModeValue+=ch}}}}break;case"rawTextWithAllPrompts":{dataModeValue="";for(i=0;i<maskedVal.length;i++){ch=maskedVal.charAt(i);if($.inArray(i,this._literalIndeces)===-1){if(ch===this.options.unfilledCharsPrompt){dataModeValue+=this.options.emptyChar}else{dataModeValue+=ch}}}}break;case"rawTextWithLiterals":{dataModeValue="";for(i=0;i<maskedVal.length;i++){ch=maskedVal.charAt(i);if(ch!==this.options.unfilledCharsPrompt){dataModeValue+=ch}}}break;case"rawTextWithRequiredPromptsAndLiterals":{dataModeValue="";for(i=0;i<maskedVal.length;i++){ch=maskedVal.charAt(i);if($.inArray(i,this._literalIndeces)===-1){if(ch===this.options.unfilledCharsPrompt){if($.inArray(i,this._requiredIndeces)!==-1){dataModeValue+=this.options.emptyChar}}else{dataModeValue+=ch}}else{dataModeValue+=ch}}}break;default:{regExpr=new RegExp($.ig.util.escapeRegExp(this.options.unfilledCharsPrompt),"g");dataModeValue=this._maskedValue.replace(regExpr,this.options.emptyChar)}}return dataModeValue},_updateValue:function(value){if(value===""){if(this.options.allowNullValue){if(this.options.nullValue===null){this._valueInput.val("")}else{this._valueInput.val(this.options.nullValue)}this.options.value=this.options.nullValue}else{this.options.value="";this._valueInput.val("");this._maskedValue=""}}else{this._maskedValue=value;this.options.value=this._getValueByDataMode();this._valueInput.val(this.options.value)}},_getDisplayValue:function(){var result,maskedVal=this._maskedValue,i,j,p,maskChar,inputMask=this.options.inputMask,maskFlagsArray=this._maskFlagsArray;result=maskedVal;for(i=0,j=0,p=0;i<maskedVal.length;i++,j++,p++){if(inputMask.charAt(j)==="\\"&&$.inArray(inputMask.charAt(j+1),maskFlagsArray)!==-1){j++}if(maskedVal.charAt(i)===this.options.unfilledCharsPrompt){maskChar=inputMask.charAt(j);if(maskChar==="&"||maskChar==="A"||maskChar==="L"||maskChar==="0"){result=this._replaceCharAt(result,p,this.options.padChar)}else{result=this._replaceCharAt(result,p,"");p--}}}return result},_validateValueAgainstMask:function(value){var i,length=value.length,result=true,ch;if(length&&length>0){for(i=0;i<length;i++){ch=value.charAt(i);if(this._validateCharOnPostion(ch,i)===null){if(i+1<=length){result=this._validateCharOnPostion(ch,i+1)}}}}else{result=true}},_setInitialValue:function(value){this._maskWithPrompts=this._parseValueByMask("");this._getMaskLiteralsAndRequiredPositions();if(value===null||value===""||typeof value===undefined){this._maskedValue=""}else{this._maskedValue=this._parseValueByMask(value);this._updateValue(this._maskedValue)}},_triggerInternalValueChange:function(value){if(value===this._maskWithPrompts){value=""}var noCancel=this._triggerValueChanging(value);if(noCancel){this._processInternalValueChanging(value);this._triggerValueChanged(value);if(value!==""&&!this._validateRequiredPrompts(value)){this._sendNotification("warning",$.ig.Editor.locale.maskMessage)}}},_validateRequiredPrompts:function(value){var i;if(value===""){return false}for(i=0;i<this._requiredIndeces.length;i++){var ch=value.charAt(this._requiredIndeces[i]);if(ch===this.options.unfilledCharsPrompt){return false}}return true},_processInternalValueChanging:function(value){if(this._validateValue(value)){this._updateValue(value)}else{if(this.options.revertIfNotValid){value=this._valueInput.val();this._updateValue(value)}else{this._clearValue();value=this._valueInput.val()}}},_triggerKeyDown:function(event){var key=!event.charCode?event.which:event.charCode,ch,transformedChar,cursorStartPosition=this._getSelection(this._editorInput[0]).start;this._super(event);if(key===8){this._handleBackSpaceKey();event.preventDefault()}else if(key===46){this._handleDeleteKey();event.preventDefault()}else if($.inArray(cursorStartPosition,this._toUpperIndeces)!==-1){if(!event.ctrlKey&&!event.altKey&&(key>46&&key<91||key>145)){ch=String.fromCharCode(key);transformedChar=ch.toLocaleUpperCase();this._editorInput.val(this._replaceCharAt(this._editorInput.val(),cursorStartPosition,transformedChar));this._setCursorPosition(cursorStartPosition+1);event.preventDefault()}}else if($.inArray(cursorStartPosition,this._toLowerIndeces)!==-1){if(!event.ctrlKey&&!event.altKey&&(key>46&&key<91||key>145)){ch=String.fromCharCode(key);transformedChar=ch.toLocaleLowerCase();this._editorInput.val(this._replaceCharAt(this._editorInput.val(),cursorStartPosition,transformedChar));this._setCursorPosition(cursorStartPosition+1);event.preventDefault()}}},_triggerKeyPress:function(event){this._super(event)},_validateKey:function(event){var result,ch,key,cursorPosition=this._getCursorPosition();if(this._super(event)&&this.options.inputMask){key=!event.charCode?event.which:event.charCode;if(key!==8&&key!==46){ch=String.fromCharCode(key);if(cursorPosition===-1){cursorPosition++}while($.inArray(cursorPosition,this._literalIndeces)!==-1||cursorPosition===this._maskWithPrompts.length){cursorPosition++}result=this._validateKeyCharAgainstMask(ch,cursorPosition,this._unescapedMask);if(result===true){if($.ig.util.isFF&&event.keyCode===37){this._setSelectionRange(this._editorInput[0],cursorPosition,cursorPosition-1)}else{this._setSelectionRange(this._editorInput[0],cursorPosition,cursorPosition+1)}}}}else{result=false}return result},_validateKeyCharAgainstMask:function(ch,cursorPosition,inputMask){var mask=inputMask||this.options.inputMask,isValid;if(cursorPosition>=this._maskWithPrompts.length){isValid=false}else{if(this._validateCharOnPostion(ch,cursorPosition,mask)===null){isValid=this._validateKeyCharAgainstMask(ch,cursorPosition+1)}else{isValid=this._validateCharOnPostion(ch,cursorPosition,mask)}}return isValid},_validateCharOnPostion:function(ch,position,inputMask){var maskSymbol,mask,isValid,regex,inputChar=ch,letterOrDigitRegEx="[\\dÀ-῿Ⰰ-퟿a-zA-Z]",letterRegEx="[À-῿Ⰰ-퟿a-zA-Z]",digitRegEx="[\\d]",digitSpecialRegEx="[\\d_\\+]";mask=inputMask||this.options.inputMask;maskSymbol=mask.charAt(position);switch(maskSymbol){case"C":case"&":{if(inputChar===""){isValid=false}else{isValid=true}}break;case"a":case"A":{regex=new RegExp(letterOrDigitRegEx);if(regex.test(inputChar)){isValid=true}else{isValid=false}}break;case"?":case"L":{regex=new RegExp(letterRegEx);if(regex.test(inputChar)){isValid=true
}else{isValid=false}}break;case"0":case"9":{regex=new RegExp(digitRegEx);if(regex.test(inputChar)){isValid=true}else{isValid=false}}break;case"#":{regex=new RegExp(digitSpecialRegEx);if(regex.test(inputChar)){isValid=true}else{isValid=false}}break;default:{isValid=null}}return isValid},_setOption:function(option,value){var prevValue=this.options[option];if(prevValue===value){return}$.Widget.prototype._setOption.apply(this,arguments);switch(option){case"inputMask":{throw new Error($.ig.Editor.locale.cannotSetRuntime)}break;default:{this.options[option]=prevValue;this._super(option,value)}break}},_handleBackSpaceKey:function(){var selection=this._getSelection(this._editorInput[0]),startPostion=selection.start,endPosition=selection.end,index=endPosition;if(startPostion===endPosition){startPostion--}index--;for(index;index>startPostion-1;index--){while($.inArray(index,this._literalIndeces)!==-1||index===-1){index--}if(index>-1){this._editorInput.val(this._replaceCharAt(this._editorInput.val(),index,this.options.unfilledCharsPrompt));this._setCursorPosition(index)}}},_handleDeleteKey:function(skipCursorPosition){var selection=this._getSelection(this._editorInput[0]),startPostion=selection.start,endPosition=selection.end,index=startPostion;if(startPostion===endPosition){endPosition++}for(index;index<endPosition;index++){while($.inArray(index,this._literalIndeces)!==-1&&index<=this._maskWithPrompts.length){index++}if(index!==this._maskWithPrompts.length){this._editorInput.val(this._replaceCharAt(this._editorInput.val(),index,this.options.unfilledCharsPrompt));if(!skipCursorPosition){this._setCursorPosition(index+1)}}else{if(!skipCursorPosition){this._setCursorPosition(index)}}}},value:function(newValue){if(newValue!==undefined){this._setInitialValue(newValue);this._editorInput.val(this._getDisplayValue())}else{return this.options.value}},dropDownContainer:function(){throw $.ig.Editor.locale.maskEditorNoSuchMethod},showDropDown:function(){throw $.ig.Editor.locale.maskEditorNoSuchMethod},hideDropDown:function(){throw $.ig.Editor.locale.maskEditorNoSuchMethod},dropDownButton:function(){throw $.ig.Editor.locale.maskEditorNoSuchMethod},spinUpButton:function(){throw $.ig.Editor.locale.maskEditorNoSuchMethod},spinDownButton:function(){throw $.ig.Editor.locale.maskEditorNoSuchMethod},dropDownVisible:function(){throw $.ig.Editor.locale.maskEditorNoSuchMethod},findListItemIndex:function(){throw $.ig.Editor.locale.maskEditorNoSuchMethod},selectedListIndex:function(){throw $.ig.Editor.locale.maskEditorNoSuchMethod},getSelectedListItem:function(){throw $.ig.Editor.locale.maskEditorNoSuchMethod},spinUp:function(){throw $.ig.Editor.locale.maskEditorNoSuchMethod},spinDown:function(){throw $.ig.Editor.locale.maskEditorNoSuchMethod},isValid:function(){var value,valid;value=this.field().val();this._skipMessages=true;valid=this._validateValue(value);if(value!==""&&!this._validateRequiredPrompts(this._maskedValue)){valid=false;this._sendNotification("warning",$.ig.Editor.locale.maskMessage)}this._skipMessages=false;return valid}});$.widget("ui.igDateEditor",$.ui.igMaskEditor,{options:{minValue:null,maxValue:null,dateDisplayFormat:null,dateInputFormat:null,dataMode:"date",buttonType:"none",spinDelta:1,limitSpinToCurrentField:false,enableUTCDates:false,centuryThreshold:29,yearShift:0},events:{},_create:function(){$.ui.igMaskEditor.prototype._create.call(this)},_initialize:function(){this._super();this._applyRegionalSettings();this.options.inputMask=this._convertDateMaskToDigitMask(this.options.dateInputFormat);this._setNumericType();this._mvcDateRegex=/^\/Date\((.*?)\)\/$/i},_setNumericType:function(){this._numericType="datetime"},_setOption:function(option,value){var prevValue=this.options[option];if(prevValue===value){return}$.Widget.prototype._setOption.apply(this,arguments);switch(option){case"minValue":{this.options[option]=prevValue;throw new Error($.ig.Editor.locale.dateEditorMinValue)}case"maxValue":{this.options[option]=prevValue;throw new Error($.ig.Editor.locale.dateEditorMaxValue)}break;default:{this.options[option]=prevValue;this._super(option,value)}break}},_applyRegionalSettings:function(){var format;if(this.options.dateInputFormat!==null){format=this.options.dateInputFormat;if(format==="date"||format==="dateLong"||format==="dateTime"||format==="time"||format==="timeLong"){this.options.dateInputFormat=this._getRegionalOption(format+"Pattern")}}else{this.options.dateInputFormat=this._getRegionalOption("datePattern")}if(this.options.dateDisplayFormat!==null){format=this.options.dateDisplayFormat;if(format==="date"||format==="dateLong"||format==="dateTime"||format==="time"||format==="timeLong"){this.options.dateDisplayFormat=this._getRegionalOption(format+"Pattern")}}else{this.options.dateDisplayFormat=this.options.dateInputFormat}},_setInitialValue:function(value){this._maskWithPrompts=this._parseValueByMask("");this._getMaskLiteralsAndRequiredPositions();if(value===null||value===""||typeof value===undefined){this._maskedValue=""}else{if(this._validateValue(value)){this._updateValue(this._getDateObjectFromValue(value));this._updateMaskedValue()}this._editorInput.val(this._getDisplayValue())}},_applyOptions:function(){this._super();if(this.options.centuryThreshold>99||this.options.centuryThreshold<0){this.options.centuryThreshold=29;console.log($.ig.Editor.locale.centuryThresholdValidValues)}if(this.options.minValue){if(!this._isValidDate(new Date(this.options.minValue))){throw new Error($.ig.Editor.locale.invalidDate)}}if(this.options.maxValue){if(!this._isValidDate(new Date(this.options.maxValue))){throw new Error($.ig.Editor.locale.invalidDate)}}},_triggerKeyDown:function(event){var key=!event.charCode?event.which:event.charCode;this._super(event);if(key===38&&!(this instanceof $.ui.igDatePicker)){this._spinUpEditMode()}if(key===40&&!(this instanceof $.ui.igDatePicker)){this._spinDownEditMode()}if(key===13){this._enterEditMode()}},_handleSpinUpEvent:function(){this.spinUp(1)},_handleSpinDownEvent:function(){this.spinDown(1)},_replaceDisplayValue:function(selection,previousValue,newValue){var value=previousValue,currentIndex=selection.start,currentChar,charCode,charIndex=0,newChar;newValue=newValue.toString();while(currentIndex<previousValue.length&&charIndex<newValue.length){currentChar=previousValue.charAt(currentIndex);charCode=previousValue.charCodeAt(currentIndex);newChar=newValue.charAt(charIndex);if(charCode>=48&&charCode<=57||currentChar==="_"){value=value.substring(0,currentIndex)+newChar+value.substring(currentIndex+1,previousValue.length);charIndex++}currentIndex++}return value},_getDateField:function(flag,date){var utc=this.options.enableUTCDates,shift=this.options.yearShift,year;if(!date){date=this._dateObjectValue}if(!date){return null}if(flag==="year"){year=utc?date.getUTCFullYear():date.getFullYear();if(shift){year+=shift}return year}if(flag==="month"){return utc?date.getUTCMonth():date.getMonth()}if(flag==="day"){return utc?date.getUTCDay():date.getDay()}if(flag==="date"){return utc?date.getUTCDate():date.getDate()}if(flag==="hours"){return utc?date.getUTCHours():date.getHours()}if(flag==="minutes"){return utc?date.getUTCMinutes():date.getMinutes()}if(flag==="seconds"){return utc?date.getUTCSeconds():date.getSeconds()}return utc?date.getUTCMilliseconds():date.getMilliseconds()},_setDateField:function(flag,date,newValue){var utc=this.options.enableUTCDates,shift=this.options.yearShift;if(!date){date=this._dateObjectValue}if(flag==="year"){if(shift){newValue-=shift}if(utc){date.setUTCFullYear(newValue)}else{date.setFullYear(newValue)}}if(flag==="month"){if(utc){date.setUTCMonth(newValue)}else{date.setMonth(newValue)}}if(flag==="date"){if(utc){date.setUTCDate(newValue)}else{date.setDate(newValue)}}if(flag==="hours"){if(utc){date.setUTCHours(newValue)}else{date.setHours(newValue)}}if(flag==="minutes"){if(utc){date.setUTCMinutes(newValue)}else{date.setMinutes(newValue)}}if(flag==="seconds"){if(utc){date.setUTCSeconds(newValue)}else{date.setSeconds(newValue)}}if(flag==="miliseconds"){if(utc){date.setUTCMilliseconds(newValue)}else{date.setMilliseconds(newValue)}}return date},_updateMaskedValue:function(){var currentMaskValue=this._maskWithPrompts?this._maskWithPrompts:this._parseValueByMask(""),dateObj=this._dateObjectValue,year,month,day,hours,minutes,seconds,miliseconds;if(dateObj){if(this._dateIndices.yy!==undefined){year=this._getDateField("year",dateObj).toString();if(this._dateIndices.fourDigitYear){currentMaskValue=this._replaceStringRange(currentMaskValue,year,this._dateIndices.yy,this._dateIndices.yy+3)}else{year=year.substring(2);currentMaskValue=this._replaceStringRange(currentMaskValue,year,this._dateIndices.yy,this._dateIndices.yy+1)}}if(this._dateIndices.MM!==undefined){month=this._getDateField("month",dateObj);month++;if(month<10){month="0"+month.toString()}else{month=month.toString()}currentMaskValue=this._replaceStringRange(currentMaskValue,month,this._dateIndices.MM,this._dateIndices.MM+1)}if(this._dateIndices.dd!==undefined){day=this._getDateField("date",dateObj);if(day<10){day="0"+day.toString()}else{day=day.toString()}currentMaskValue=this._replaceStringRange(currentMaskValue,day,this._dateIndices.dd,this._dateIndices.dd+1)}if(this._dateIndices.hh!==undefined){hours=this._getDateField("hours",dateObj);if(!this._dateIndices.hh24&&hours>12){hours-=12}if(hours<10){hours="0"+hours.toString()}else{hours=hours.toString()}currentMaskValue=this._replaceStringRange(currentMaskValue,hours,this._dateIndices.hh,this._dateIndices.hh+1)}if(this._dateIndices.mm!==undefined){minutes=this._getDateField("minutes",dateObj);if(minutes<10){minutes="0"+minutes.toString()}else{minutes=minutes.toString()}currentMaskValue=this._replaceStringRange(currentMaskValue,minutes,this._dateIndices.mm,this._dateIndices.mm+1)}if(this._dateIndices.ss!==undefined){seconds=this._getDateField("seconds",dateObj);if(seconds<10){seconds="0"+seconds.toString()}else{seconds=seconds.toString()}currentMaskValue=this._replaceStringRange(currentMaskValue,minutes,this._dateIndices.ss,this._dateIndices.ss+1)}if(this._dateIndices.tt!==undefined){hours=this._getDateField("hours",dateObj);if(hours>12){if(this._dateIndices._ttLength===1){currentMaskValue=this._replaceCharAt(currentMaskValue,this._dateIndices.tt,"P")}else{currentMaskValue=this._replaceStringRange(currentMaskValue,"PM",this._dateIndices.tt,this._dateIndices.tt+1)}}else{if(this._dateIndices._ttLength===1){currentMaskValue=this._replaceCharAt(currentMaskValue,this._dateIndices.tt,"A")}else{currentMaskValue=this._replaceStringRange(currentMaskValue,"AM",this._dateIndices.tt,this._dateIndices.tt+1)}}}if(this._dateIndices.ff!==undefined){miliseconds=this._getDateField("miliseconds",dateObj);if(this._dateIndices.ffLength===1){currentMaskValue=this._replaceCharAt(currentMaskValue,this._dateIndices.ff,this._getMiliseconds(miliseconds,100).toString())}else if(this._dateIndices.ffLength===2){currentMaskValue=this._replaceStringRange(currentMaskValue,this._getMiliseconds(miliseconds,10).toString(),this._dateIndices.ff,this._dateIndices.tt+1)}else{currentMaskValue=this._replaceStringRange(currentMaskValue,miliseconds.toString(),this._dateIndices.ff,this._dateIndices.tt+2)}}}this._maskedValue=currentMaskValue},_convertDateMaskToDigitMask:function(mask){var x,i,j,flag=-1,txt="",maskVal=mask;if(!maskVal){maskVal=""}maskVal=maskVal.replace("dddd","ddd").replace("ddd,","").replace("ddd ","").replace(" ddd","").replace("ddd","");this._dateIndices={};this._dateIndices.fourDigitYear=false;maskVal=maskVal.replace(/\x08/g," ").replace(/\x09/g," ");maskVal=maskVal.replace(/\\f/g,"").replace(/\\d/g,"").replace(/\\s/g,"").replace(/\\m/g,"").replace(/\\t/g,"").replace(/\\H/g,"").replace(/\\h/g,"").replace(/\\M/g,"\b").replace(/\\y/g,"	");maskVal=maskVal.replace(/9/g,"").replace(/0/g,"");maskVal=maskVal.replace("fff","24").replace("ff","23").replace("f","22");maskVal=maskVal.replace("dddd","").replace("ddd","").replace("dd","09").replace("d","08").replace("ss","19").replace("s","18").replace("mm","17").replace("m","16");maskVal=maskVal.replace("tt","15").replace("t","14").replace("HH","13").replace("H","12").replace("hh","11").replace("h","10");maskVal=maskVal.replace("MMMM","MM").replace("MMM","MM").replace("MM","05").replace("M","04");maskVal=maskVal.replace("yyyy","03").replace("yy","02").replace("y","01");maskVal=maskVal.replace(/\x01/g,"g").replace(/\x02/g,"d").replace(/\x03/g,"s").replace(/\x04/g,"m").replace(/\x05/g,"t").replace(/\x06/g,"H").replace(/\x07/g,"h").replace(/\x08/g,"M").replace(/\x09/g,"y");for(i=0,j=0;i<maskVal.length;i++,j++){x=maskVal.charCodeAt(i);if(x<48||x>57){flag=maskVal.charAt(i);if(flag==="\\"&&i+1<maskVal.length&&$.inArray(maskVal.charAt(i+1),this._maskFlagsArray)!==-1||maskVal.charAt(i+1)===""||maskVal.charAt(i+1)===""){j--}txt+=maskVal.charAt(i);continue}flag=(x-48)*10+maskVal.charCodeAt(++i)-48;if(flag===14){txt+="L"}else if(flag===15){txt+="LL"}else if(flag===22){txt+="0"}else{txt+="00";if(flag===3){txt+="00"}while(flag>=23){txt+="0";flag--}}switch(flag){case 4:case 5:case 6:case 7:{if(this._dateIndices.MM){j++;break}else{this._dateIndices.MM=j;j++}}break;case 8:case 9:case 20:case 21:{if(this._dateIndices.dd){j++;break}else{this._dateIndices.dd=j;j++}}break;case 1:case 2:{if(this._dateIndices.yy){j++;break}else{this._dateIndices.yy=j;j++;this._dateIndices.fourDigitYear=false}}break;case 3:{if(this._dateIndices.yy){j+=3;break}else{this._dateIndices.yy=j;j+=3;this._dateIndices.fourDigitYear=true}}break;case 14:{if(this._dateIndices.tt){break}else{this._dateIndices.tt=j;j++;this._dateIndices._ttLength=1}}break;case 15:{if(this._dateIndices.tt){j++;break}else{this._dateIndices.tt=j;j++;this._dateIndices._ttLength=2}}break;case 10:case 11:{if(this._dateIndices.hh){j+=2;break}else{this._dateIndices.hh=j;this._dateIndices.hh24=false;j++}}break;case 12:case 13:{if(this._dateIndices.hh){j+=2;break}else{this._dateIndices.hh=j;this._dateIndices.hh24=true;j++}}break;case 16:case 17:{if(this._dateIndices.mm){j++;break}else{this._dateIndices.mm=j;j++}}break;case 18:case 19:{if(this._dateIndices.ss){j++;break}else{this._dateIndices.ss=j;j++}}break;case 22:{if(this._dateIndices.ff){break}else{this._dateIndices.ff=j;this._dateIndices.ffLength=1}}break;case 23:{if(this._dateIndices.ff){j++;break}else{this._dateIndices.ff=j;this._dateIndices.ffLength=2;j++}}break;case 22:{if(this._dateIndices.ff){j+=2;break}else{this._dateIndices.ff=j;this._dateIndices.ffLength=3;j+=2}}break;default:}}txt=txt.replace(/\x11/g,9).replace(/\x12/g,0);return txt},_getRegionalOption:function(key){var regional=this.options.regional;if(this.options[key]){return this.options[key]}if(typeof regional==="string"){regional=$.ig.regional[regional]}if(regional&&regional[key]){return regional[key]}else{return $.ig.regional.defaults[key]}},_validateKey:function(event){var result=true,ch,key,cursorPosition;if(this._super(event)===true){cursorPosition=this._getCursorPosition();if(cursorPosition===this._dateIndices.MM||cursorPosition-1===this._dateIndices.MM){result=this._validateMonthInput(event,cursorPosition)}else if(cursorPosition===this._dateIndices.dd||cursorPosition-1===this._dateIndices.dd){result=this._validateDayInput(event,cursorPosition)}else if(cursorPosition===this._dateIndices.hh||cursorPosition-1===this._dateIndices.hh){result=this._validateHoursInput(event,cursorPosition)}else if(cursorPosition===this._dateIndices.mm||cursorPosition-1===this._dateIndices.mm){result=this._validateMinutesInput(event,cursorPosition)}else if(cursorPosition===this._dateIndices.ss||cursorPosition-1===this._dateIndices.ss){result=this._validateSecondsInput(event,cursorPosition)}else if(cursorPosition===this._dateIndices.tt||cursorPosition-1===this._dateIndices.tt){result=this._validateMidDayInput(event,cursorPosition);if(result===true){key=!event.charCode?event.which:event.charCode;ch=String.fromCharCode(key);if(ch.toLocaleLowerCase()==="a"){this._editorInput.val(this._replaceCharAt(this._editorInput.val(),cursorPosition,"A"))}else{this._editorInput.val(this._replaceCharAt(this._editorInput.val(),cursorPosition,"P"))}if(this._dateIndices._ttLength===2){this._editorInput.val(this._replaceCharAt(this._editorInput.val(),++cursorPosition,"M"))}this._setCursorPosition(++cursorPosition);event.preventDefault()}}else{result=true}if(result===null){cursorPosition++;while($.inArray(cursorPosition,this._literalIndeces)!==-1||cursorPosition===this._maskWithPrompts.length){cursorPosition++}this._setCursorPosition(cursorPosition);result=this._validateKey(event)}if(result===false){this._setCursorPosition(cursorPosition)}}else{result=false}return result},_setBlur:function(event){var newValue,oldVal,convertedDate;if(this._cancelBlurOnInput){this._editorInput.focus();delete this._cancelBlurOnInput}else{this._triggerBlur(event);newValue=$(event.target).val();oldVal=this._dateObjectValue;convertedDate=this._parseDateFromMaskedValue(newValue);if(newValue===this._maskWithPrompts){if(oldVal){this._processValueChanging(newValue)}}else if(!oldVal){this._processValueChanging(newValue)}else if(convertedDate!==""&&convertedDate-oldVal!==0){this._processValueChanging(newValue)}this._exitEditMode();if(this._dropDownList&&this._triggerDropDownClosing()){this._hideDropDownList();this._triggerDropDownClosed()}this._focused=false;this._clearTimeouts();if(this._validator){this._validator._validateInternal(this.element,event,true)}}},_validateDayInput:function(event,position){var result=false,key=!event.charCode?event.which:event.charCode,ch=String.fromCharCode(key),num=parseInt(ch),charAtCurrentPosition=parseInt(this._editorInput.val().charAt(position)),charAtPreviousPosition,charAtNextPosition;if(position===this._dateIndices.dd){if(num<4){charAtNextPosition=parseInt(this._editorInput.val().charAt(position+1));if(!isNaN(charAtNextPosition)&&charAtNextPosition>1&&num===3){result=null}else{result=true}}else{if(!isNaN(charAtCurrentPosition)&&charAtCurrentPosition===3){result=null}else{this._setSelectionRange(this._editorInput[0],position+1,position+2);result=true}}}else{charAtPreviousPosition=parseInt(this._editorInput.val().charAt(position-1));if(!isNaN(charAtPreviousPosition)&&charAtPreviousPosition===3){if(num===0||num===1){result=true}else{result=null}}else{result=true}}return result},_validateMonthInput:function(event,position){var result=false,key=!event.charCode?event.which:event.charCode,ch=String.fromCharCode(key),num=parseInt(ch),charAtCurrentPosition=parseInt(this._editorInput.val().charAt(position)),charAtPreviousPosition,charAtNextPosition;position=position?position:this._getCursorPosition();if(position===this._dateIndices.MM){if(num<2){charAtNextPosition=parseInt(this._editorInput.val().charAt(position+1));if(!isNaN(charAtNextPosition)&&charAtNextPosition>2&&num===1){result=null}else{result=true}}else{if(!isNaN(charAtCurrentPosition)&&charAtCurrentPosition===1){if(num===2){result=true}else{result=null}}else if(this._editorInput.val().charAt(position)===this.options.unfilledCharsPrompt){if(num<2){result=true}else{result=null}}else{this._setSelectionRange(this._editorInput[0],position+1,position+2);result=true}}}else{charAtPreviousPosition=parseInt(this._editorInput.val().charAt(position-1));if(!isNaN(charAtPreviousPosition)&&charAtPreviousPosition===1){if(num===0||num===1||num===2){result=true}else{result=null}}else{result=true}}return result},_validateMidDayInput:function(evnt,position){var result=false,key=!event.charCode?event.which:event.charCode,ch=String.fromCharCode(key);position=position?position:this._getCursorPosition();if(position===this._dateIndices.tt){if(ch.toString().toLocaleLowerCase()==="a"||ch.toString().toLocaleLowerCase()==="p"){result=true}else{result=false}}else{result=null}return result},_validateHoursInput:function(event,position){var result=false,key=!event.charCode?event.which:event.charCode,ch=String.fromCharCode(key),num=parseInt(ch),charAtPreviousPosition,charAtNextPosition;position=position?position:this._getCursorPosition();if(position===this._dateIndices.hh){if(this._dateIndices.hh24){if(num===0||num===1){result=true}else if(num===2){charAtNextPosition=parseInt(this._editorInput.val().charAt(position+1));if(!isNaN(charAtNextPosition)&&charAtNextPosition>4){result=null}else{result=true}}else{result=null}}else{if(num===0){result=true}else if(num===1){charAtNextPosition=parseInt(this._editorInput.val().charAt(position+1));if(!isNaN(charAtNextPosition)&&charAtNextPosition>2){result=null}else{result=true}}else{result=null}}}else{charAtPreviousPosition=parseInt(this._editorInput.val().charAt(position-1));if(this._dateIndices.hh24){if(!isNaN(charAtPreviousPosition)&&charAtPreviousPosition===2){if(num<=4){result=true}else{result=null}}else{result=true}}else{if(!isNaN(charAtPreviousPosition)&&charAtPreviousPosition===1){if(num<=2){result=true}else{result=null}}else{result=true}}}return result},_validateMinutesInput:function(event,position){var result=false,key=!event.charCode?event.which:event.charCode,ch=String.fromCharCode(key),num=parseInt(ch);position=position?position:this._getCursorPosition();if(position===this._dateIndices.mm){if(num<6){result=true}else{result=null}}else{result=true}return result},_validateSecondsInput:function(event,position){var result=false,key=!event.charCode?event.which:event.charCode,ch=String.fromCharCode(key),num=parseInt(ch);position=position?position:this._getCursorPosition();if(position===this._dateIndices.ss){if(num<6){result=true}else{result=null}}else{result=true}return result},_fillCentury:function(year){if(!isNaN(year)){if(year>0&&year<=this.options.centuryThreshold){year=2e3+year}else if(year<100){year=1900+year}}return year},_triggerKeyPress:function(event){if(event.keyCode===13){this._processInternalValueChanging(this._editorInput.val())}else{this._super(event)}},_triggerInternalValueChange:function(value){if(value===this._maskWithPrompts){value=""}var noCancel=this._triggerValueChanging(value);if(noCancel){this._processInternalValueChanging(value);this._triggerValueChanged(value)}},_processInternalValueChanging:function(value){var parsedVal;if(value===""){this._clearValue();return}if($.type(value)==="date"){parsedVal=value}else{parsedVal=this._parseDateFromMaskedValue(value)}if(this._validateValue(parsedVal)){this._updateValue(parsedVal)}else{if(this.options.revertIfNotValid){value=this._valueInput.val();this._updateValue(value)}else{this._clearValue();value=this._valueInput.val()}}},_isValidDate:function(date){date=this._getDateObjectFromValue(date);return date.getTime()===date.getTime()},_validateValue:function(val){var result,dateObj,minValue,maxValue;if(val===null||val===""){return true}dateObj=this._getDateObjectFromValue(val);minValue=this._getDateObjectFromValue(this.options.minValue);maxValue=this._getDateObjectFromValue(this.options.maxValue);if(this._super(val)&&this._isValidDate(dateObj)){if(this.options.maxValue&&this._isValidDate(maxValue)&&dateObj>maxValue){result=false;if(this.options.revertIfNotValid){this._sendNotification("warning",$.ig.util.stringFormat($.ig.Editor.locale.maxValExceedRevertErrMsg,this.options.maxValue))}}else if(this.options.minValue&&this._isValidDate(minValue)&&dateObj<minValue){result=false;if(this.options.revertIfNotValid){this._sendNotification("warning",$.ig.util.stringFormat($.ig.Editor.locale.minValExceedRevertErrMsg,this.options.minValue))}}else{result=true}}else{result=false}return result},_updateValue:function(value){if(value===null){this._maskedValue=this._maskWithPrompts;this._valueInput.val("");this.options.value=null;this._dateObjectValue=null}else if(value===""){this._maskedValue=this._maskWithPrompts;this._valueInput.val("");this.options.value="";this._dateObjectValue=null}else{this._dateObjectValue=this._getDateObjectFromValue(value);this.options.value=this._getValueByDataMode();if(this.options.value instanceof Date){this._valueInput.val(this.options.value.toLocaleString(this.options.regional?this.options.regional:"en"))}else{this._valueInput.val(this.options.value)}}this._updateMaskedValue()},_clearValue:function(){if(this.options.allowNullValue){this._updateValue(this.options.nullValue);if(this.options.nullValue===null){this._editorInput.val(this._maskWithPrompts)}}else{this._updateValue("");this._editorInput.val(this._maskWithPrompts)}if(this._editMode===false){this._exitEditMode()}},_getDateObjectFromValue:function(value){if($.type(value)==="date"){if(this.options.enableUTCDates){value=new Date(Date.UTC(value.getFullYear(),value.getMonth(),value.getDate()))}return value}else if(this._mvcDateRegex.test(value)){return new Date(parseInt(value.replace(this._mvcDateRegex,"$1"),10))}else if(typeof value==="string"){return this._parseDateFromMaskedValue(value)}else{return new Date(value)}},_getValueByDataMode:function(){var dataModeValue,maskedVal=this._maskedValue?this._maskedValue:this._maskWithPrompts,dataMode=this.options.dataMode;switch(dataMode){case"date":{dataModeValue=this._dateObjectValue}break;case"displayModeText":{dataModeValue=this._getDisplayValue()}break;case"editModeText":{dataModeValue=maskedVal}break;default:{dataModeValue=this._dateObjectValue}}return dataModeValue},_parseDateFromMaskedValue:function(value){var dateField,monthField,yearField,hourField,minutesField,secondsField,milisecondsField,midDayField,dateStartIndex=this._dateIndices.dd,regExpr,ffCount,lastDayOfMonth,monthStartIndex=this._dateIndices.MM,yearStartIndex=this._dateIndices.yy,hourStartIndex=this._dateIndices.hh,minuteStartIndex=this._dateIndices.mm,secondsStartIndex=this._dateIndices.ss,midDayStartIndex=this._dateIndices.tt,milisecondsStartIndex=this._dateIndices.ff,extractedDate="";if(value===""||value===null||value instanceof Date){return extractedDate}if(dateStartIndex!==undefined&&dateStartIndex!==null){dateField=value.substring(dateStartIndex,dateStartIndex+2);if(dateField.indexOf(this.options.unfilledCharsPrompt)!==-1){regExpr=new RegExp($.ig.util.escapeRegExp(this.options.unfilledCharsPrompt),"g");dateField=dateField.replace(regExpr,"")}if(dateField!==""){dateField=parseInt(dateField)}else{dateField=null}}if(monthStartIndex!==undefined&&monthStartIndex!==null){monthField=value.substring(monthStartIndex,monthStartIndex+2);if(monthField.indexOf(this.options.unfilledCharsPrompt)!==-1){regExpr=new RegExp($.ig.util.escapeRegExp(this.options.unfilledCharsPrompt),"g");monthField=monthField.replace(regExpr,"")}if(monthField!==""){monthField=parseInt(monthField);monthField--}else{monthField=null}}if(yearStartIndex!==undefined&&yearStartIndex!==null){if(this._dateIndices.fourDigitYear){yearField=value.substring(yearStartIndex,yearStartIndex+4)}else{yearField=value.substring(yearStartIndex,yearStartIndex+2)}if(yearField.indexOf(this.options.unfilledCharsPrompt)!==-1){regExpr=new RegExp($.ig.util.escapeRegExp(this.options.unfilledCharsPrompt),"g");yearField=yearField.replace(regExpr,"")}if(yearField!==""){yearField=parseInt(yearField);yearField=this._fillCentury(yearField)}else{yearField=null}}if(midDayStartIndex!==undefined&&midDayStartIndex!==null){midDayField=value.substring(midDayStartIndex,midDayStartIndex+1);if(midDayField===this.options.unfilledCharsPrompt){midDayField=null}else{midDayField=midDayField.toLocaleLowerCase()}}if(hourStartIndex!==undefined&&hourStartIndex!==null){hourField=value.substring(hourStartIndex,hourStartIndex+2);if(hourField.indexOf(this.options.unfilledCharsPrompt)!==-1){regExpr=new RegExp($.ig.util.escapeRegExp(this.options.unfilledCharsPrompt),"g");hourField=hourField.replace(regExpr,"")}if(hourField!==""){hourField=parseInt(hourField);if(this._dateIndices.hh24===false){if(midDayField&&midDayField==="p"){hourField+=12}}}else{hourField=null}}if(minuteStartIndex!==undefined&&minuteStartIndex!==null){minutesField=value.substring(minuteStartIndex,minuteStartIndex+2);if(minutesField.indexOf(this.options.unfilledCharsPrompt)!==-1){regExpr=new RegExp($.ig.util.escapeRegExp(this.options.unfilledCharsPrompt),"g");minutesField=minutesField.replace(regExpr,"")}if(minutesField!==""){minutesField=parseInt(minutesField)}else{minutesField=null}}if(secondsStartIndex!==undefined&&secondsStartIndex!==null){secondsField=value.substring(secondsStartIndex,secondsStartIndex+2);if(secondsField.indexOf(this.options.unfilledCharsPrompt)!==-1){regExpr=new RegExp($.ig.util.escapeRegExp(this.options.unfilledCharsPrompt),"g");secondsField=secondsField.replace(regExpr,"")}if(secondsField!==""){secondsField=parseInt(secondsField)}else{secondsField=null}}if(milisecondsStartIndex!==undefined&&milisecondsStartIndex!==null){milisecondsField=value.substring(milisecondsStartIndex,milisecondsStartIndex+this._dateIndices.ffLength);if(milisecondsField.indexOf(this.options.unfilledCharsPrompt)!==-1){regExpr=new RegExp($.ig.util.escapeRegExp(this.options.unfilledCharsPrompt),"g");milisecondsField=milisecondsField.replace(regExpr,"")}if(milisecondsField!==""){if(milisecondsField.length<this._dateIndices.ffLength){ffCount=this._dateIndices.ffLength-milisecondsField.length;milisecondsField=parseInt(milisecondsField)*Math.pow(10,ffCount)}milisecondsField=parseInt(milisecondsField);if(this._dateIndices.ffLength===2){milisecondsField*=10}else if(this._dateIndices.ffLength===1){milisecondsField*=100}}else{milisecondsField=null}}if(!this._dateObjectValue){if(yearField!==null&&yearField!==undefined&&monthField!==null&&monthField!==undefined&&dateField!==null&&dateField!==undefined){if(this.options.enableUTCDates){extractedDate=new Date(Date.UTC(yearField,monthField,dateField))}else{extractedDate=new Date(yearField,monthField,dateField)}}else{if(this.options.enableUTCDates){extractedDate=new Date(Date.UTC())}else{extractedDate=new Date}if(yearField!==null&&yearField!==undefined){extractedDate=this._setDateField("year",extractedDate,yearField)}if(monthField!==null&&monthField!==undefined){extractedDate=this._setDateField("month",extractedDate,monthField)}if(dateField!==null&&dateField!==undefined){lastDayOfMonth=this._lastDayOfMonth(this._getDateField("year",extractedDate),this._getDateField("month",extractedDate)+1);if(dateField>lastDayOfMonth){dateField=lastDayOfMonth}extractedDate=this._setDateField("date",extractedDate,dateField)}}}else{extractedDate=new Date(this._dateObjectValue)}if(yearField!==null&&yearField!==undefined){extractedDate=this._setDateField("year",extractedDate,yearField)}if(monthField!==null&&monthField!==undefined){extractedDate=this._setDateField("month",extractedDate,monthField)}if(dateField!==null&&dateField!==undefined){lastDayOfMonth=this._lastDayOfMonth(this._getDateField("year",extractedDate),this._getDateField("month",extractedDate)+1);if(dateField>lastDayOfMonth){dateField=lastDayOfMonth}extractedDate=this._setDateField("date",extractedDate,dateField)}if(hourField!==null&&hourField!==undefined){extractedDate=this._setDateField("hours",extractedDate,hourField)}if(minutesField!==null&&minutesField!==undefined){extractedDate=this._setDateField("minutes",extractedDate,minutesField)}if(secondsField!==null&&secondsField!==undefined){extractedDate=this._setDateField("seconds",extractedDate,secondsField)}if(milisecondsField!==null&&milisecondsField!==undefined){extractedDate=this._setDateField("miliseconds",extractedDate,milisecondsField)}return extractedDate},_getDisplayValue:function(){var maskVal,dateObject=this._dateObjectValue;if(!dateObject){return""}maskVal=this.options.dateDisplayFormat;maskVal=maskVal.replace(/\x08/g," ").replace(/\x09/g," ");maskVal=maskVal.replace(/\\f/g,"").replace(/\\d/g,"").replace(/\\s/g,"").replace(/\\m/g,"").replace(/\\t/g,"").replace(/\\H/g,"").replace(/\\h/g,"").replace(/\\M/g,"\b").replace(/\\y/g,"	");maskVal=maskVal.replace(/fff/g,"030").replace(/ff/g,"031").replace(/f/g,"032");maskVal=maskVal.replace(/dddd/g,"033").replace(/ddd/g,"034").replace(/dd/g,"035").replace(/d/g,"036").replace(/ss/g,"037").replace(/s/g,"038").replace(/mm/g,"039").replace(/m/g,"040");maskVal=maskVal.replace(/tt/g,"041").replace(/t/g,"042").replace(/HH/g,"043").replace(/H/g,"044").replace(/hh/g,"045").replace(/h/g,"046");
maskVal=maskVal.replace(/MMMM/g,"047").replace(/MMM/g,"048").replace(/MM/g,"049").replace(/M/g,"050");maskVal=maskVal.replace(/yyyy/g,"051").replace(/yy/g,"052").replace(/y/g,"053");maskVal=maskVal.replace(/\x10030/g,this._getMiliseconds(this._getDateField("miliseconds",dateObject),1)).replace(/\x10031/g,this._getMiliseconds(this._getDateField("miliseconds",dateObject),10)).replace(/\x10032/g,this._getMiliseconds(this._getDateField("miliseconds",dateObject),100));maskVal=maskVal.replace(/\x10033/g,this._getDay(this._getDateField("day",dateObject),"dddd")).replace(/\x10034/g,this._getDay(this._getDateField("day",dateObject),"ddd")).replace(/\x10035/g,this._getDate(this._getDateField("date",dateObject),"dd")).replace(/\x10036/g,this._getDate(this._getDateField("date",dateObject),"d")).replace(/\x10037/g,this._getSeconds(this._getDateField("seconds",dateObject),"ss")).replace(/\x10038/g,this._getSeconds(this._getDateField("seconds",dateObject),"s")).replace(/\x10039/g,this._getMinutes(this._getDateField("minutes",dateObject),"mm")).replace(/\x10040/g,this._getMinutes(this._getDateField("minutes",dateObject),"m")).replace(/\x10041/g,this._getAMorPM(this._getDateField("hours",dateObject),"tt")).replace(/\x10042/g,this._getAMorPM(this._getDateField("hours",dateObject),"t")).replace(/\x10043/g,this._getHours(this._getDateField("hours",dateObject),"HH")).replace(/\x10044/g,this._getHours(this._getDateField("hours",dateObject),"H")).replace(/\x10045/g,this._getHours(this._getDateField("hours",dateObject),"hh")).replace(/\x10046/g,this._getHours(this._getDateField("hours",dateObject),"h"));maskVal=maskVal.replace(/\x10047/g,this._getMonth(this._getDateField("month",dateObject),"MMMM")).replace(/\x10048/g,this._getMonth(this._getDateField("month",dateObject),"MMM")).replace(/\x10049/g,this._getMonth(this._getDateField("month",dateObject),"MM")).replace(/\x10050/g,this._getMonth(this._getDateField("month",dateObject),"M"));maskVal=maskVal.replace(/\x10051/g,this._getYear(this._getDateField("year",dateObject),"yyyy")).replace(/\x10052/g,this._getYear(this._getDateField("year",dateObject),"yy")).replace(/\x10053/g,this._getYear(this._getDateField("year",dateObject),"y"));maskVal=maskVal.replace(/\x01/g,"g").replace(/\x02/g,"d").replace(/\x03/g,"s").replace(/\x04/g,"m").replace(/\x05/g,"t").replace(/\x06/g,"H").replace(/\x07/g,"h").replace(/\x08/g,"M").replace(/\x09/g,"y");return maskVal},_getMiliseconds:function(miliseconds,flag){return parseInt(miliseconds/flag)},_getSeconds:function(seconds,flag){var result;if(flag==="ss"&&seconds<10){result="0"+seconds.toString()}else{result=seconds.toString()}return result},_getMinutes:function(minutes,flag){var result;if(flag==="mm"&&minutes<10){result="0"+minutes.toString()}else{result=minutes.toString()}return result},_getAMorPM:function(hours,flag){var result;if(hours>=12){result=this._getRegionalOption("pm")}else{result=this._getRegionalOption("am")}if(flag==="t"){result=result.charAt(0)}return result},_getHours:function(hours,flag){var result;switch(flag){case"h":{if(hours>12){hours-=12}result=hours.toString()}break;case"hh":{if(hours>12){hours-=12}if(hours<10){result="0"+hours.toString()}else{result=hours.toString()}}break;case"H":{result=hours.toString()}break;case"HH":{if(hours<10){result="0"+hours.toString()}else{result=hours.toString()}}break}return result},_getDate:function(date,flag){var result;switch(flag){case"dd":{if(date<10){result="0"+date.toString()}else{result=date}}break;case"d":{result=date.toString()}break}return result},_getDay:function(day,flag){var result;switch(flag){case"dddd":{result=this._getRegionalOption("dayNames")[day]}break;case"ddd":{result=this._getRegionalOption("dayNamesShort")[day]}break}return result},_getMonth:function(month,flag){var result;switch(flag){case"MMMM":{result=this._getRegionalOption("monthNames")[month]}break;case"MMM":{result=this._getRegionalOption("monthNamesShort")[month]}break;case"MM":{month++;if(month<10){result="0"+month.toString()}else{result=month}}break;case"M":{month++;result=month.toString()}break}return result},_getYear:function(year,flag){var result;if(flag==="yy"){result=year.toString().substring(2)}else if(flag==="y"){result=parseInt(year.toString().substring(2)).toString()}else{result=year.toString()}return result},_handleBackSpaceKey:function(){var cursorPosition;this._super();cursorPosition=this._getSelection(this._editorInput[0]).start;if(cursorPosition===this._dateIndices.tt||cursorPosition-1===this._dateIndices.tt){if(this._dateIndices._ttLength===2){if(cursorPosition===this._dateIndices.tt){this._setCursorPosition(cursorPosition+1);$.ui.igMaskEditor.prototype._handleDeleteKey.call(this);this._setCursorPosition(cursorPosition)}else{this._super()}}}},_handleDeleteKey:function(skipCursorPosition){var cursorPosition;this._super(skipCursorPosition);cursorPosition=this._getSelection(this._editorInput[0]).start;if(cursorPosition-2===this._dateIndices.tt||cursorPosition-1===this._dateIndices.tt){if(this._dateIndices._ttLength===2){if(cursorPosition-1===this._dateIndices.tt){this._super()}else{if(!skipCursorPosition){this._setCursorPosition(cursorPosition-1)}$.ui.igMaskEditor.prototype._handleBackSpaceKey.call(this);if(!skipCursorPosition){this._setCursorPosition(cursorPosition)}}}}},_setMillisecondsEditMode:function(mask,time,currentMilliseconds,delta){var isLimited=this.options.limitSpinToCurrentField,newMilliseconds,secondsUpdateDelta=0,currentSecond,timeSecond;if(currentMilliseconds+delta>=60){if(isLimited){newMilliseconds=currentMilliseconds}else{newMilliseconds=currentMilliseconds+delta-60;secondsUpdateDelta=1}}else if(currentMilliseconds+delta<1){if(isLimited){newMilliseconds=currentMilliseconds}else{if(currentMilliseconds+delta===0){newMilliseconds=0}else{newMilliseconds=60+(currentMilliseconds+delta);secondsUpdateDelta=-1}}}else{newMilliseconds=currentMilliseconds+delta}mask=this._setTimeEditMode(mask,time,currentMilliseconds,newMilliseconds);if(secondsUpdateDelta!==undefined&&secondsUpdateDelta!==0){timeSecond=this._createSecondsPosition();currentSecond=parseInt(this._getStringRange(mask,timeSecond.startPosition,timeSecond.endPosition),10);mask=this._setSecondsEditMode(mask,timeSecond,currentSecond,secondsUpdateDelta)}return mask},_setSecondsEditMode:function(mask,time,currentSecond,delta){var isLimited=this.options.limitSpinToCurrentField,newSecond,minuteUpdateDelta=0,currentMinute,timeMinute;if(currentSecond+delta>=60){if(isLimited){newSecond=currentSecond}else{newSecond=currentSecond+delta-60;minuteUpdateDelta=1}}else if(currentSecond+delta<1){if(isLimited){newSecond=currentSecond}else{if(currentSecond+delta===0){newSecond=0}else{newSecond=60+(currentSecond+delta);minuteUpdateDelta=-1}}}else{newSecond=currentSecond+delta}mask=this._setTimeEditMode(mask,time,currentSecond,newSecond);if(minuteUpdateDelta!==undefined&&minuteUpdateDelta!==0){timeMinute=this._createMinutesPosition();currentMinute=parseInt(this._getStringRange(mask,timeMinute.startPosition,timeMinute.endPosition),10);mask=this._setMinutesEditMode(mask,timeMinute,currentMinute,minuteUpdateDelta)}return mask},_setMinutesEditMode:function(mask,time,currentMinute,delta){var isLimited=this.options.limitSpinToCurrentField,newMinute,hourUpdateDelta=0,currentHour,timeHour;if(currentMinute+delta>=60){if(isLimited){newMinute=currentMinute}else{newMinute=currentMinute+delta-60;hourUpdateDelta=1}}else if(currentMinute+delta<1){if(isLimited){newMinute=currentMinute}else{if(currentMinute+delta===0){newMinute=0}else{newMinute=60+(currentMinute+delta);hourUpdateDelta=-1}}}else{newMinute=currentMinute+delta}mask=this._setTimeEditMode(mask,time,currentMinute,newMinute);if(hourUpdateDelta!==undefined&&hourUpdateDelta!==0){timeHour=this._createHoursPosition();currentHour=parseInt(this._getStringRange(mask,timeHour.startPosition,timeHour.endPosition),10);mask=this._setHoursEditMode(mask,timeHour,currentHour,hourUpdateDelta)}return mask},_setHoursEditMode:function(mask,time,currentHour,delta){var isLimited=this.options.limitSpinToCurrentField,newHour,dayUpdateDelta=0,currentDay,timeDay;if(currentHour+delta>=24){if(isLimited){newHour=currentHour}else{newHour=currentHour+delta-24;dayUpdateDelta=1}}else if(currentHour+delta<1){if(isLimited){newHour=currentHour}else{if(currentHour+delta===0){newHour=0}else{newHour=24+(currentHour+delta);dayUpdateDelta=-1}}}else{newHour=currentHour+delta}mask=this._setTimeEditMode(mask,time,currentHour,newHour);if(dayUpdateDelta!==undefined&&dayUpdateDelta!==0){timeDay=this._createDayPosition();currentDay=parseInt(this._getStringRange(mask,timeDay.startPosition,timeDay.endPosition),10);mask=this._setDayEditMode(mask,timeDay,currentDay,dayUpdateDelta)}return mask},_setAmOrPmEditMode:function(mask,time,currentAmOrPm){var newAmOrPm;if(currentAmOrPm.toLocaleLowerCase()==="am"){newAmOrPm="PM"}else{newAmOrPm="AM"}mask=this._setTimeEditMode(mask,time,currentAmOrPm,newAmOrPm);return mask},_lastDayOfMonth:function(year,month){var day;if(month===1||month===3||month===5||month===7||month===8||month===10||month===12){day=31}else if(month===4||month===6||month===9||month===11){day=30}else if(month===2&&year%4===0){day=29}else if(month===2&&year%4!==0){day=28}return day},_setDayEditMode:function(mask,time,currentDay,delta){var isLimited=this.options.limitSpinToCurrentField,currentYear,currentMonth,lastDayOfMonth,lastDayOfPreviousMonth,newDay,monthUpdateDelta,timeYear,timeMonth;timeYear=this._createYearPosition();currentYear=parseInt(this._getStringRange(mask,timeYear.startPosition,timeYear.endPosition),10);timeMonth=this._createMonthPosition();currentMonth=parseInt(this._getStringRange(mask,timeMonth.startPosition,timeMonth.endPosition),10);lastDayOfMonth=this._lastDayOfMonth(currentYear,currentMonth);lastDayOfPreviousMonth=this._lastDayOfMonth(currentYear,currentMonth-1!==0?currentMonth-1:12);if(currentDay+delta>lastDayOfMonth){if(isLimited){newDay=currentDay}else{newDay=currentDay+delta-lastDayOfMonth;monthUpdateDelta=1}}else if(currentDay+delta<1){if(isLimited){newDay=currentDay}else{newDay=lastDayOfPreviousMonth+(currentDay+delta);monthUpdateDelta=-1}}else{newDay=currentDay+delta}mask=this._setTimeEditMode(mask,time,currentDay,newDay);if(monthUpdateDelta!==undefined&&monthUpdateDelta!==0){mask=this._setMonthEditMode(mask,timeMonth,currentMonth,monthUpdateDelta)}return mask},_setDayDisplayMode:function(newDay){var oldDay=parseInt(this._getDateField("date"),10),date=this._dateObjectValue;if(!date){date=new Date}if(newDay!==oldDay){this._setDateField("date",date,newDay);this._triggerInternalValueChange(date);this._editorInput.val(this._getDisplayValue())}},_setMonthEditMode:function(mask,time,currentMonth,delta){var isLimited=this.options.limitSpinToCurrentField,newMonth,yearUpdateDelta=0,currentYear,timeYear;if(currentMonth+delta>12){if(isLimited){newMonth=currentMonth}else{newMonth=currentMonth+delta-12;yearUpdateDelta=1}}else if(currentMonth+delta<1){if(isLimited){newMonth=currentMonth}else{newMonth=12+(currentMonth+delta);yearUpdateDelta=-1}}else{newMonth=currentMonth+delta}mask=this._setTimeEditMode(mask,time,currentMonth,newMonth);if(yearUpdateDelta!==undefined&&yearUpdateDelta!==0){timeYear=this._createYearPosition();currentYear=parseInt(this._getStringRange(mask,timeYear.startPosition,timeYear.endPosition),10);mask=this._setYearEditMode(mask,timeYear,currentYear,yearUpdateDelta)}return mask},_setYearEditMode:function(mask,time,currentYear,delta){var newYear;if(currentYear+delta<0){newYear=currentYear}else{newYear=currentYear+delta}mask=this._setTimeEditMode(mask,time,currentYear,newYear);return mask},_setTimeEditMode:function(mask,time,currentValue,newValue){var newValueAsString;newValueAsString=newValue.toString();if(newValueAsString.length===1){newValueAsString="0"+newValueAsString}mask=this._replaceStringRange(mask,newValueAsString,time.startPosition,time.endPosition-1);return mask},_createYearPosition:function(){var time=null;if(this._dateIndices.yy!==undefined){time={};time.name="year";time.startPosition=this._dateIndices.yy;time.length=this._dateIndices.fourDigitYear?4:2;time.endPosition=time.startPosition+time.length}return time},_createMonthPosition:function(){var time=null;if(this._dateIndices.MM!==undefined){time={};time.name="month";time.startPosition=this._dateIndices.MM;time.length=2;time.endPosition=time.startPosition+time.length}return time},_createDayPosition:function(){var time=null;if(this._dateIndices.dd!==undefined){time={};time.name="day";time.startPosition=this._dateIndices.dd;time.length=2;time.endPosition=time.startPosition+time.length}return time},_createAmOrPmPosition:function(){var time=null;if(this._dateIndices.tt!==undefined){time={};time.name="amOrPm";time.startPosition=this._dateIndices.tt;time.length=2;time.endPosition=time.startPosition+time.length}return time},_createHoursPosition:function(){var time=null;if(this._dateIndices.hh!==undefined){time={};time.name="hours";time.startPosition=this._dateIndices.hh;time.length=2;time.endPosition=time.startPosition+time.length}return time},_createMinutesPosition:function(){var time=null;if(this._dateIndices.mm!==undefined){time={};time.name="minutes";time.startPosition=this._dateIndices.mm;time.length=2;time.endPosition=time.startPosition+time.length}return time},_createSecondsPosition:function(){var time=null;if(this._dateIndices.ss!==undefined){time={};time.name="seconds";time.startPosition=this._dateIndicess.ss;time.length=2;time.endPosition=time.startPosition+time.length}return time},_createMillisecondsPosition:function(){var time=null;if(this._dateIndices.ff!==undefined){time={};time.name="milliseconds";time.startPosition=this._dateIndices.ff;time.length=2;time.endPosition=time.startPosition+time.length}return time},_getTimePosition:function(){var cursorPosition=this._getCursorPosition(),indices=this._dateIndices,time=null;if(cursorPosition<0){cursorPosition=0}if(cursorPosition>=indices.yy&&(indices.fourDigitYear&&cursorPosition<=indices.yy+4||indices.fourDigitYear===undefined&&indices.yy+2)){time=this._createYearPosition()}else if(cursorPosition>=indices.MM&&cursorPosition<=indices.MM+2){time=this._createMonthPosition()}else if(cursorPosition>=indices.dd&&cursorPosition<=indices.dd+2){time=this._createDayPosition()}else if(cursorPosition>=indices.tt&&cursorPosition<=indices.tt+2){time=this._createAmOrPmPosition()}else if(cursorPosition>=indices.hh&&cursorPosition<=indices.hh+2){time=this._createHoursPosition()}else if(cursorPosition>=indices.mm&&cursorPosition<=indices.mm+2){time=this._createMinutesPosition()}else if(cursorPosition>=indices.ss&&cursorPosition<=indices.ss+2){time=this._createSecondsPosition()}else if(cursorPosition>=indices.ff&&cursorPosition<=indices.ff+2){time=this._createMillisecondsPosition()}return time},_updateTimeMask:function(mask,time,delta){var currentValue;currentValue=parseInt(this._getStringRange(mask,time.startPosition,time.endPosition),10);switch(time.name){case"year":mask=this._setYearEditMode(mask,time,currentValue,delta);break;case"month":mask=this._setMonthEditMode(mask,time,currentValue,delta);break;case"day":mask=this._setDayEditMode(mask,time,currentValue,delta);break;case"amOrPm":currentValue=this._getStringRange(mask,time.startPosition,time.endPosition);mask=this._setAmOrPmEditMode(mask,time,currentValue);break;case"hours":mask=this._setHoursEditMode(mask,time,currentValue,delta);break;case"minutes":mask=this._setMinutesEditMode(mask,time,currentValue,delta);break;case"seconds":mask=this._setSecondsEditMode(mask,time,currentValue,delta);break;case"milliseconds":mask=this._setMillisecondsEditMode(mask,time,currentValue,delta);break}return mask},_initEmptyMask:function(){var mask=this._maskWithPrompts,today=new Date,timeYear,timeMonth,timeDay,timeHours,timeAmOrPM,timeMinutes,timeSeconds,timeMilliseconds,year,month,day;timeYear=this._createYearPosition();timeMonth=this._createMonthPosition();timeDay=this._createDayPosition();timeHours=this._createHoursPosition();timeAmOrPM=this._createAmOrPmPosition;timeMinutes=this._createMinutesPosition();timeSeconds=this._createSecondsPosition();timeMilliseconds=this._createMillisecondsPosition();year=today.getFullYear();month=today.getMonth()+1;day=today.getDate();if(timeYear){mask=this._setYearEditMode(mask,timeYear,year,0)}if(timeMonth){mask=this._setMonthEditMode(mask,timeMonth,month,0)}if(timeDay){mask=this._setDayEditMode(mask,timeDay,day,0)}if(timeHours){mask=this._setHoursEditMode(mask,timeHours,0,0)}if(timeAmOrPM){mask=this._setAmOrPmEditMode(mask,timeAmOrPM,"AM",0)}if(timeMinutes){mask=this._setMinutesEditMode(mask,timeMinutes,0,0)}if(timeSeconds){mask=this._setSecondsEditMode(mask,timeSeconds,0,0)}if(timeMilliseconds){mask=this._setMillisecondsEditMode(mask,timeMilliseconds,0,0)}return mask},_spinEditMode:function(delta){var self=this,cursorPosition=this._getCursorPosition(),mask=this._editorInput.val(),time;time=this._getTimePosition();if(!time){return}if(mask===undefined){return}else if(mask===""||mask===this._maskWithPrompts){mask=this._initEmptyMask()}else{mask=this._updateTimeMask(mask,time,delta)}this._maskedValue=mask;this._editorInput.val(mask);if($.ig.util.isChrome||$.ig.util.isSafari){this._timeouts.push(setTimeout(function(){self._setCursorPosition(cursorPosition)},0))}else{self._setCursorPosition(cursorPosition)}},_spinUpEditMode:function(delta){this._spinEditMode(delta?delta:this.options.spinDelta)},_spinDownEditMode:function(delta){this._spinEditMode(delta?-delta:-this.options.spinDelta)},_spin:function(delta){var day;this._currentInputTextValue=this._editorInput.val();if(this._editMode){this._spinEditMode(delta)}else{day=this._getDateField("date");if(day===null){day=this._getDateField("date",new Date);delta=0}this._setDayDisplayMode(day+delta)}this._processTextChanged()},value:function(newValue){if(newValue!==undefined){if(this._validateValue(newValue)){this._updateValue(newValue);this._updateMaskedValue()}this._editorInput.val(this._editMode?this._maskedValue:this._getDisplayValue())}else{if(this.options.value instanceof Date){return new Date(this.options.value.getTime())}else if(this._maskedValue!==""&&this._maskedValue!==this._parseValueByMask("")){if(this.options.dataMode==="date"){return new Date(this._maskedValue)}else if(this.options.dataMode==="editModeText"){return this._maskedValue}else if(this.options.dataMode==="displayModeText"){return this._getDisplayValue()}}else{if(this.options.allowNullValue){return this.options.nullValue}else{return""}}}},getSelectedDate:function(){return this._dateObjectValue},selectDate:function(date){this._updateValue(date);this._exitEditMode()},spinUp:function(delta){this._spin(delta?delta:this.options.spinDelta)},spinDown:function(delta){this._spin(delta?-delta:-this.options.spinDelta)},isValid:function(){var value,valid;value=this.field().val();this._skipMessages=true;valid=this._validateValue(this._dateObjectValue);if(value!==""&&!valid){valid=false;this._sendNotification("warning",$.ig.Editor.locale.dateMessage)}this._skipMessages=false;return valid}});$.widget("ui.igDatePicker",$.ui.igDateEditor,{options:{regional:null,buttonType:"dropdown",datepickerOptions:null},events:{},_setDropDownListWidth:function(){},_renderList:function(){var self=this,options,regional;regional=$.extend(self.options.datepickerOptions,self._dpRegion())||{};options=$.extend(regional,{showOn:"",duration:self.options.dropDownAnimationDuration?self.options.dropDownAnimationDuration:"normal",onClose:function(val){var date;self._currentInputTextValue=self._editorInput.val();date=new Date(val);if(self.options.enableUTCDates){date=new Date(Date.UTC(date.getFullYear(),date.getMonth(),date.getDate()))}self._processValueChanging(date);self._processTextChanged();self._editorInput.focus()}});this._editorInput.datepicker(options);this._dropDownList=this._editorInput.datepicker("widget");this._dropDownList.hide()},_renderDropDownButton:function(){var dropDownButton=$("<div></div>"),dropDownIcon=$("<div></div>");if(this._dropDownButton){return}dropDownButton.addClass(this.css.buttonCommon);dropDownButton.attr("title",this._getLocaleOption("datePickerButtonTitle"));this._editorContainer.prepend(dropDownButton.addClass(this.css.dropDownButton).append(dropDownIcon.addClass(this.css.dropDownImage)));this._dropDownButton=dropDownButton;this._attachButtonsEvents("dropdown",dropDownButton)},_dpRegion:function(){var reg=this.options.regional,lastRegional,regional;regional=$.datepicker&&typeof reg==="string"?$.datepicker.regional[reg==="defaults"||reg==="en-US"?"":reg]:null;if(regional===null&&$.datepicker){for(lastRegional in $.datepicker.regional){}if($.datepicker.regional[lastRegional]){regional=$.datepicker.regional[lastRegional]}}return regional},_create:function(){$.ui.igDateEditor.prototype._create.call(this)},_initialize:function(){this._super();this.options.listItems=["datePicker"]},_applyOptions:function(){this._super();if(!this.options.minValue&&this.options.datepickerOptions&&this.options.datepickerOptions.minDate){if(this._isValidDate(this.options.datepickerOptions.minDate)){this.options.minValue=this.options.datepickerOptions.minDate}}if(!this.options.maxValue&&this.options.datepickerOptions&&this.options.datepickerOptions.maxDate){if(this._isValidDate(this.options.datepickerOptions.minDate)){this.options.maxValue=this.options.datepickerOptions.maxDate}}},_setOption:function(option,value){var prevValue=this.options[option];if(prevValue===value){return}$.Widget.prototype._setOption.apply(this,arguments);switch(option){case"buttonType":{if(value!=="dropdown"){this.options[option]=prevValue;throw new Error($.ig.Editor.locale.buttonTypeIsDropDownOnly)}}break;default:{this.options[option]=prevValue;this._super(option,value)}break}},_triggerKeyDown:function(event){if(event.keyCode===38&&!event.altKey){if(!event.ctrlKey){this._spinUpEditMode()}}else if(event.keyCode===40&&!event.altKey){if(!event.ctrlKey){this._spinDownEditMode()}}else{this._super(event)}},_triggerDropDownOpened:function(){var args={owner:this,editorInput:this._editorInput,calendar:this._dropDownList};this._trigger(this.events.dropDownListOpened,null,args)},_triggerDropDownOpeninng:function(){var args={owner:this,editorInput:this._editorInput,calendar:this._dropDownList};return this._trigger(this.events.dropDownListOpening,null,args)},_showDropDownList:function(){var self=this,direction;this._cancelBlurDatePickerOpen=true;this._positionDropDownList();if(this._dropDownListOrientation==="up"){direction="up"}else{direction="down"}if(this.value()){$(this._editorInput).datepicker("setDate",this.value())}try{this._editorInput.datepicker("option","showOptions",{direction:direction});this._editorInput.datepicker("show")}catch(ex){this._editorInput.datepicker("show")}this._dropDownList.promise().done(function(){self._triggerDropDownOpened()})},getCalendar:function(){$.ui.igTextEditor.prototype.dropDownContainer.call(this)},dropDownContainer:function(){throw $.ig.Editor.locale.datePickerNoSuchMethodDropDownContainer},showDropDown:function(){$.ui.igTextEditor.prototype.showDropDown.call(this)},hideDropDown:function(){$.ui.igTextEditor.prototype.hideDropDown.call(this)},dropDownButton:function(){$.ui.igTextEditor.prototype.dropDownButton.call(this)},dropDownVisible:function(){$.ui.igTextEditor.prototype.dropDownVisible.call(this)}});$.widget("ui.igCheckboxEditor",$.ui.igBaseEditor,{options:{checked:false,size:"normal",iconClass:"ui-icon-check",tabIndex:0},css:{container:"ui-state-default ui-corner-all ui-widget ui-checkbox-container ui-igcheckbox-normal",containerChecked:"ui-state-checkbox-checked",checkboxIcon:"ui-icon",iconCentered:"ui-icon-custom",checked:"ui-igcheckbox-normal-on",unchecked:"ui-igcheckbox-normal-off",checkboxInput:"ui-helper-hidden"},events:{keydown:"keydown",keypress:"keypress",keyup:"keyup"},_triggerKeyUp:function(event){var args={originalEvent:event,owner:this,element:event.target,editorInput:this._editorInput};this._trigger(this.events.keyup,event,args)},_triggerKeyPress:function(event){var args={originalEvent:event,owner:this,element:event.target,editorInput:this._editorInput};this._trigger(this.events.keypress,event,args)},_triggerKeyDown:function(event){var args={originalEvent:event,owner:this,element:event.target,editorInput:this._editorInput};this._trigger(this.events.keydown,event,args)},_create:function(){this._checkedClass=this.css.checked;this._uncheckedClass=this.css.unchecked;$.ui.igBaseEditor.prototype._create.call(this)},_render:function(){this._triggerRendering();if(this.element.is("div")){this._editorContainer=this.element;this._editorInput=$("<span></span>");this._valueInput=$("<input type='checkbox'></input>");this._editorContainer.prepend(this._editorInput);this._editorInput.after(this._valueInput)}else if(this.element.is("input")){this._valueInput=this.element;this._editorInput=$("<span></span>");this._editorContainer=this.element.wrap($("<div></div>")).parent();this._valueInput.before(this._editorInput)}else if(this.element.is("span")){this._editorInput=this.element;this._valueInput=$("<input type='checkbox'></input>");this._editorContainer=this.element.wrap($("<div></div>")).parent();this._editorInput.after(this._valueInput)}else{throw $.ig.Editor.locale.instantiateCheckBoxErrMsg}this._editorContainer.addClass(this.css.container).attr("role","checkbox");this._editorInput.addClass(this.css.checkboxIcon).addClass(this.options.iconClass).addClass(this.css.checked);this._valueInput.addClass(this.css.checkboxInput).attr("aria-hidden","true");if(!$.ig.util.isIE8&&this._valueInput.attr("type")!=="checkbox"){this._valueInput.attr("type","checkbox")}this._attachEvents();this._applyOptions();this._applyAria();this._triggerRendered()},_applyAria:function(){var ariaLabeledBy=this.element.attr("aria-labelledby");if(ariaLabeledBy){this.element.removeAttr("aria-labelledby");this._editorContainer.attr("aria-labelledby",ariaLabeledBy)}},_applyOptions:function(){var checked=this.options.checked;this._super();if(checked){this._initialState()}else{this.options.checked=false}if(this.options.value){this._inputValue=this.options.value;this.value(this.options.value)}this._size(this.options.size);this._setWidth(this.options.width);this._setHeight(this.options.height);this._updateState(checked&&checked!=="false"?true:false)},_setOption:function(option,value){var iconClass=this.options.iconClass;this._super(option,value);switch(option){case"checked":this._updateState(value&&value!=="false"?true:false);break;case"value":this._inputValue=value;this._updateState(this.options.checked);break;case"size":this._size(value);break;case"iconClass":this._setIconClass(iconClass,value);break;default:break}},_readAttributes:function(){var checked=this.element.attr("checked");this._super(this.element);if(checked){this.element.removeAttr("checked");this.options.checked=true}},_attachEvents:function(){var self=this;this._super();this._editorContainer.on({"click.editor":function(event){self._toggleInternal(event)},"mousedown.editor":function(event){this.focus();event.preventDefault();return false},"focus.editor":function(event){self._setFocus(event,self._cancelFocusTrigger)},"blur.editor":function(event){self._setBlur(event)},"keyup.editor":function(event){var keyCode=event.keyCode||event.which||0;self._triggerKeyUp(event);if(keyCode===32){self._toggleInternal(event);event.preventDefault()}},"keydown.editor":function(event){self._triggerKeyDown(event)},"keypress.editor":function(event){var keyCode=event.keyCode||event.which||0;self._triggerKeyPress(event);if(keyCode===32){event.preventDefault()}}})},_triggerValueChanging:function(event,newState,newValue){var args={owner:this,element:event.target,editorInput:this._editorInput,oldState:this.options.checked,newState:newState,oldValue:this.value(),newValue:newValue};return this._trigger(this.events.valueChanging,event,args)},_triggerValueChanged:function(event){var args={owner:this,element:event.target,editorInput:this._editorInput,newState:this.options.checked,newValue:this.value()};this._trigger(this.events.valueChanged,event,args);this._trigger(this.options.checked?this.events.checked:this.events.unchecked,event,args)},_triggerFocus:function(event){var args={originalEvent:event,owner:this,element:event.target,editorInput:this._editorInput};this._trigger(this.events.focus,event,args)},_triggerBlur:function(event){var args={owner:this,element:event.target,editorInput:this._editorInput};this._trigger(this.events.blur,event,args)},_updateValue:function(value){this.options.value=value;this._valueInput.val(value)},_getState:function(){var state;if(this._inputValue!==undefined){state=this._valueInput[0].checked}else{var value=this._tryParseBool(this._valueInput[0].value);if(value.ret){state=value.p1}else{throw $.ig.Editor.locale.cannotParseNonBoolValue}}return state},_tryParseBool:function(value){if(typeof value==="boolean"){return{ret:true,p1:value}}else if(typeof value==="string"){return $.ig.Boolean.prototype.tryParse(value)}},_toggleInternal:function(event){var noCancel,newState,newVal;newState=!this._getState();newVal=this.value();if(this._inputValue===undefined){newVal=newState}noCancel=this._triggerValueChanging(event,newState,newVal);if(noCancel){this._updateState(newState);this._triggerValueChanged(event);if(this._validator){this._validator._validateInternal(this.element,event)}}},_initialState:function(){this._valueInput.attr("checked","checked")},_updateState:function(value){this.options.checked=value;this._editorContainer.attr("aria-checked",value);if(value){this._editorInput.removeClass(this._uncheckedClass);this._editorContainer.addClass(this.css.containerChecked)}else{this._editorInput.addClass(this._uncheckedClass);this._editorContainer.removeClass(this.css.containerChecked)}if(this._inputValue!==undefined){this._valueInput[0].checked=value;this._valueInput[0].value=this._inputValue}else{this._valueInput[0].checked=true;this._valueInput[0].value=value}},_removeDOM:function(){if(this.element.is("div")){this.element.empty()}else if(this.element.is("input")){this._editorInput.remove();this.element.unwrap()}else if(this.element.is("span")){this._valueInput.remove();this.element.unwrap()}},_detachEvents:function(){this._editorContainer.off("click.editor mousedown.editor focus.editor blur.editor keydown.editor");this._super()},_clearStyling:function(){this._editorContainer.removeClass(this.css.checkboxContainer).removeClass(this.css.containerChecked).removeAttr("role");this._editorInput.removeClass(this._checkedClass).removeClass(this._uncheckedClass).removeClass(this.css.checkboxIcon).removeClass(this.options.iconClass);this._valueInput.removeClass(this.css.checkboxInput).removeAttr("aria-hidden");this._super()},_deleteInternalProperties:function(){delete this._checkedClass;delete this._uncheckedClass;this._super()},_size:function(size){if(size){this._editorContainer.removeClass("ui-igcheckbox-verysmall ui-igcheckbox-small ui-igcheckbox-normal ui-igcheckbox-large");this._editorContainer.addClass("ui-igcheckbox-"+size);this._editorInput.removeClass(this._checkedClass).removeClass(this._uncheckedClass);this._checkedClass="ui-igcheckbox-"+size+"-on";this._uncheckedClass="ui-igcheckbox-"+size+"-off";this._editorInput.addClass(this._checkedClass)}},_setTabIndex:function(index){this._editorContainer.attr("tabIndex",index)},_setWidth:function(width){this._super(width);if(width){this._editorInput.addClass(this.css.iconCentered)}},_setHeight:function(height){this._super(height);if(height){this._editorInput.addClass(this.css.iconCentered)}},_setIconClass:function(oldIconClass,iconClass){this._editorInput.removeClass(oldIconClass).addClass(iconClass)},_setFocus:function(event,triggerEvent){this._editorContainer.addClass(this.css.focus);if(event&&!triggerEvent){this._triggerFocus(event)}else{delete this._cancelFocusTrigger}},_setFocusDelay:function(delay){var self=this;if(delay){this._timeouts.push(setTimeout(function(){self._cancelFocusTrigger=true;self._setFocus()},delay))}else{this._cancelFocusTrigger=true;this._editorContainer.focus()
}},_setBlur:function(event){this._editorContainer.removeClass(this.css.focus);this._triggerBlur(event);if(this._validator){this._validator._validateInternal(this.element,event,true)}},isValid:function(){return true},value:function(newValue){if(newValue!==undefined){if(this._inputValue===undefined){var result=this._tryParseBool(newValue);if(result.ret){this._updateState(result.p1)}else{throw $.ig.Editor.locale.cannotSetNonBoolValue}}else{this.options.value=newValue;this._inputValue=newValue;this._updateState(this._getState())}}else{if(this._inputValue===undefined){return this._getState()}return this.options.value}},toggle:function(){if(this._getState()){this._updateState(false)}else{this._updateState(true)}}})})(jQuery);