/* * * GrapeCity InputMan Library 1.0.0 * http://grapecity.com/ * * Copyright(c) GrapeCity, Inc. All rights reserved. * **/ var __extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)},GCIM;(function(n){var r=function(r){function u(n,t){r.call(this,n,t,!0)}return __extends(u,r),u.prototype._getComponentType=function(){return n.IMControlType.Calculator},u.prototype._beginInit=function(){r.prototype._beginInit.call(this),this.OutputText="0.",this.Text=this.OutputText,this.Result="",this.X=0,this.Y=0,this.Operation=null,this.Token=0,this.Count=0,this.MemoryNumber=null,this.IsBSCanUse=!1,this.IsEqualClicked=!1,this.IsOperationInvalid=!1,this.LastOperation=null,this.ActiveButtonBackColor=null,this.ParamString=null,this.ShowOutput=!0,this.Shortcuts=""},u.prototype._createUIProcess=function(){this._uIProcess=new n.CalculatorUIProcess(this.Result,this.X,this.Y,this.Operation,this.Token,this.Count,this.MemoryNumber,this.IsBSCanUse,this.IsEqualClicked,this.IsOperationInvalid,this.LastOperation)},u.prototype._createUIRender=function(){this._render=new n.CalculatorRender(this)},u.prototype._renderHtmlElement=function(){var n=this._render.CreateCalculatorFrame();this._getContainer().appendChild(n),this._initDefaultValue(),this._buttonTexts=new i},u.prototype._endInit=function(){r.prototype._endInit.call(this);var t=this._getDefaultSize();this.SetWidth(t.Width),this.SetHeight(t.Height),n.Utility.IsIE&&this.SetHideText(this.ParamString),this.SetInvalidStatus(this.IsOperationInvalid),this.SetMemoryStatus(this.MemoryNumber),n.Utility.DisabledHoldVisual(this._render._outDivContainer)},u.prototype._setAccessKey=function(n){this._getControlContainer().setAttribute("accessKey",n)},u.prototype._setFocusBorder=function(){n.Control.GetEnableChromeThemeOutline()&&!this.GetEnablejQueryTheme()&&n.Utility.chrome&&(this._getControlContainer().style.outline="-webkit-focus-ring-color auto 5px")},u.prototype._restoreFocusBorder=function(){n.Control.GetEnableChromeThemeOutline()&&!this.GetEnablejQueryTheme()&&n.Utility.chrome&&(this._getControlContainer().style.outline="none")},u.prototype._registEvent=function(){var t=this;r.prototype._registEvent.call(this);var i=this._getControlContainer(),f=function(n){var f=n.srcElement||n.target,e,r;f.id&&(e=f.id.substring(t._getId().length+5,f.id.length),r=u.ConvertButtonTextToInt(e),i.focus(),r!==-1&&t.Click(r))},h=function(i){var r,e,f;if(n.Utility.IsPad())return;r=i.srcElement||i.target,r.id&&(e=r.id.substring(t._getId().length+5,r.id.length),f=u.ConvertButtonTextToInt(e),t.ButtonMouseOver(f))},c=function(i){var r,e,f;if(n.Utility.IsPad())return;r=i.srcElement||i.target,r.id&&(e=r.id.substring(t._getId().length+5,r.id.length),f=u.ConvertButtonTextToInt(e),t.ButtonMouseOut(f))},l=function(r){var e=r.srcElement||r.target,o,f;e.id&&(o=e.id.substring(t._getId().length+5,e.id.length),f=u.ConvertButtonTextToInt(o),f==-1?(i.focus(),n.Utility.PreventDefault(r)):t.ButtonMouseDown(f))},e=function(n){var i=n.srcElement||n.target,f,r;i.id&&(f=i.id.substring(t._getId().length+5,i.id.length),r=u.ConvertButtonTextToInt(f),t.ButtonMouseUp(r))},o=function(i){t.KeyDown(i)!==!0?n.Utility.PreventDefault(i):n.Utility.chrome&&(delete t.LastMouseDownOnSelf,t._restoreFocusBorder())},s=function(n){t._setFocusBorder()};this.documentMouseDownHandler=function(r){if(!t.GetEnabled())return;var u=r.srcElement||r.target;if(n.Control.GetEnableChromeThemeOutline())if(n.Utility.chrome&&!t.GetEnablejQueryTheme()&&(t.LastMouseDownOnSelf===undefined||t.LastMouseDownOnSelf!==i.contains(u))){if(n.DropDownCalculator&&t instanceof n.DropDownCalculator)return;i.contains(u)?t._setFocusBorder():t._restoreFocusBorder()}t.LastMouseDownOnSelf=i.contains(u)},this.documentKeyDownHandler=function(i){if(!t.GetEnabled())return;var r=i.srcElement||i.target;r===document.body&&t.LastMouseDownOnSelf&&(t.KeyDown(i),n.Utility.PreventDefault(i))},n.Utility.IsPad()?n.Utility.AttachEvent(i,"touchstart",f):n.Utility.AttachEvent(i,"click",f),n.Utility.AttachEvent(i,"mouseover",h),n.Utility.AttachEvent(i,"mouseout",c),n.Utility.AttachEvent(i,"mousedown",l),n.Utility.AttachEvent(i,"mouseup",e),n.Utility.AttachEvent(i,"keydown",o),n.Utility.chrome&&n.Utility.AttachEvent(i,"focus",s),n.Utility.AttachEvent(i,"contextmenu",function(t){n.Utility.PreventDefault(t)}),n.Utility.AttachEvent(document,"mousedown",this.documentMouseDownHandler),n.Utility.AttachEvent(document,"keydown",this.documentKeyDownHandler),n.Utility.AttachEvent(this._render._output,"selectstart",function(t){n.Utility.PreventDefault(t)})},u.prototype._dispose=function(){r.prototype._dispose.call(this),n.Utility.DetachEvent(document,"mousedown",this.documentMouseDownHandler),n.Utility.DetachEvent(document,"keydown",this.documentKeyDownHandler)},u.prototype._updateLayout=function(){},u.prototype._getDefaultSize=function(){return{Width:184,Height:184}},u.prototype._onControlEffectChanged=function(t,i){i===n.ControlEffect.JQueryUI?this.SetFlatStyle(n.InternalFlatStyle.JQueryUI):this._restoreFlatStyle()},u.prototype._updateParamString=function(){var i=document.getElementById(n.Utility.GetHelperId(this._getId())),t;i!==null&&(t=i.value.split(","),t.length<8||(this.MemoryNumber=t[7]==="null"||t[7]===""?null:t[7],this.SetMemoryStatus(this.MemoryNumber)))},u.prototype._initWithServerData=function(n){var t,i;r.prototype._initWithServerData.call(this,n),this._updateParamString(),t="undefined",typeof n.EnablejQueryTheme!==t&&this.SetEnablejQueryTheme(n.EnablejQueryTheme),typeof n.AutoSize!==t&&this.SetAutoSize(n.AutoSize),typeof n.BackColor!==t&&this.SetBackColor(n.BackColor),typeof n.BorderColor!==t&&this.SetBorderColor(n.BorderColor),typeof n.BorderStyle!==t&&this.SetBorderStyle(n.BorderStyle),typeof n.BorderWidth!==t&&this.SetBorderWidth(n.BorderWidth);if(typeof n.ButtonText!==t)for(this.ClearButtonTexts(),i=0;i0?!0:!1,this.IsEqualClicked=!1,this.IsOperationInvalid=!1,this.LastOperation=null}catch(u){this.Text=t.InvalidInputInfo,this.Result="",this.X=null,this.Y=null,this.IsOperationInvalid=!0}this.SetInvalidStatus(this.IsOperationInvalid),this._render.SetText(this.Text);var r={};return r.outputText=this.Text,r.result=this.Result,r.x=this.X,r.y=this.Y,r.operation=this.Operation,r.token=this.Token,r.count=this.Count,r.memoryNumber=this.MemoryNumber,r.isBSCanUse=this.IsBSCanUse,r.isEqualClicked=this.IsEqualClicked,r.isOperationInvalid=this.IsOperationInvalid,r.lastOperation=this.LastOperation,this.SetHideText(this.GetRetInfoString(r)),this._uIProcess=new n.CalculatorUIProcess(this.Result,this.X,this.Y,this.Operation,this.Token,this.Count,this.MemoryNumber,this.IsBSCanUse,this.IsEqualClicked,this.IsOperationInvalid,this.LastOperation),this},u.prototype.GetTextHAlign=function(){return this.TextHAlign},u.prototype.SetTextHAlign=function(t){t=n.Utility.CheckEnum(n.HorizontalAlignment,t),t!==this.TextHAlign&&(this.TextHAlign=t,t==n.HorizontalAlignment.NotSet&&(t=n.HorizontalAlignment.Right),this._render._tdOutput.align=t.toString())},u.prototype.GetTextVAlign=function(){return this.TextVAlign},u.prototype.SetTextVAlign=function(t){t=n.Utility.CheckEnum(n.VerticalAlignment,t),t!==this.TextVAlign&&(this.TextVAlign=t,t==n.VerticalAlignment.NotSet&&(t=n.VerticalAlignment.Top),this._render._tdOutput.vAlign=t.toString())},u.prototype.GetToolTip=function(){return this._getControlContainer().getAttribute("title")||""},u.prototype.SetToolTip=function(t){t=n.Utility.CheckString(t),n.Utility.SetToolTip(this._getControlContainer(),t)},u.prototype.GetValue=function(){return t.IsErrorText(this.Text)?0:parseFloat(this.Text)},u.prototype.GetButtonTextsCount=function(){return this._buttonTexts.GetCount()},u.prototype.GetButtonText=function(t){var i=this._buttonTexts;return typeof t=="string"?i.GetValue(t):(t=n.Utility.CheckInt(t,0),i.GetValue(i.GetKey(t)))},u.prototype.GetButtonTextIndex=function(n){if(typeof n=="string")return this._buttonTexts.GetKeys().indexOf(n)},u.prototype.AddButtonText=function(n,t){if(!this.IsValidKey(n))throw"Invalid key.";this._buttonTexts.Add(n,t),this._render._allBtns[u.DefaultButtonKeys.indexOf(n)].value=t},u.prototype.ClearButtonTexts=function(){var n,t;for(this._buttonTexts.Clear(),n=0;n=0&&n999999999999999)throw"InvalidInput";else{if(r==999999999999999)if(f==0)return r;else throw"InvalidInput";return e=r==0?15:15-r.toString().length,f=Math.round(f*Math.pow(10,e))/Math.pow(10,e),i=n.MathOperation.GetDotPosition(f.toString()),u=(r*Math.pow(10,i)+f*Math.pow(10,i))/Math.pow(10,i),r=Math.floor(u),i=n.MathOperation.GetDotPosition(u.toString()),f=(u*Math.pow(10,i)-r*Math.pow(10,i))/Math.pow(10,i),f==0&&(u=r),o?"-"+u:""+u}},u.prototype.GetFormatedText=function(n){var t=n.toString();return t==""&&(t="0."),t.indexOf(".")==-1&&(t=t+"."),t},u.prototype.GetNumberLength=function(t){var r=Math.abs(t),u=Math.floor(r),i=n.MathOperation.GetDotPosition(r.toString()),o=(r*Math.pow(10,i)-u*Math.pow(10,i))/Math.pow(10,i),e=u==0?0:u.toString().length,f=o==0?0:i;return e+f},u.prototype.SetHideText=function(n){},u.prototype.SetInvalidStatus=function(n){for(var t=0;t<25;t++)this._render.SetButtonEnableStatus(t,n)},u.prototype.SetMemoryStatus=function(n){n==null?this._render.SetButtonValue(27,""):this._render.SetButtonValue(27,"M")},u.prototype.GetRetInfoString=function(n){var t="";return t+="'"+n.outputText+"',",t+="'"+n.result+"',",t+=n.x+",",t+=n.y+",",t+=n.operation+",",t+=n.token+",",t+=n.count+",",t+=n.memoryNumber+",",t+=n.isBSCanUse+",",t+=n.isEqualClicked+",",t+=n.isOperationInvalid+",",t+="'"+n.lastOperation+"'"},u.ConvertButtonTextToInt=function(n){var t=-1;switch(n){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":t=parseInt(n,10);break;case"+/-":t=10;break;case".":t=11;break;case"+":t=12;break;case"-":t=13;break;case"*":t=14;break;case"/":t=15;break;case"\u221a":t=16;break;case"%":t=17;break;case"1/x":t=18;break;case"=":t=19;break;case"MC":t=20;break;case"MR":t=21;break;case"MS":t=22;break;case"M+":t=23;break;case"BS":t=24;break;case"CE":t=25;break;case"C":t=26;break;default:t=-1}return t},u.prototype.ResetData=function(n){this.SetText(n.ResetData)},u.prototype.MoveControl=function(n,t){},u.prototype.Click=function(n){if(!this.GetEnabled())return;var t=this._uIProcess.Click(n);if(t!=null)this.SetHideText(this.GetRetInfoString(t));else return;t.result!=null&&(this.Result=t.result),t.outputText!=null&&(this.OutputText=t.outputText,this.Text=this.OutputText,this.ShowOutput&&this._render.SetText(this.OutputText)),t.isOperationInvalid!=null&&t.isOperationInvalid!=this.IsOperationInvalid&&(this.IsOperationInvalid=t.isOperationInvalid,this.SetInvalidStatus(this.IsOperationInvalid),this.IsOperationInvalid&&this._render.SetButtonBackColor(n,this.ActiveButtonBackColor)),t.memoryNumber!=this.MemoryNumber&&(this.MemoryNumber=t.memoryNumber,this.SetMemoryStatus(this.MemoryNumber)),t.lastOperation!=this.LastOperation&&(this.LastOperation=t.lastOperation),this._getAutoPostBack()&&window.__doPostBack(this._getServerUniqueId(),"")},u.prototype.ButtonMouseOut=function(t){if(!this.GetEnabled()||t==-1)return;this._isMouseOverring=!1,this.GetFlatStyle()===n.FlatStyle.Flat?this._render.SetButtonBackColor(this._currentHoverBtnIndex,this.ActiveButtonBackColor):this.GetEnablejQueryTheme()&&(this._render._allBtns[this._currentHoverBtnIndex].className="ui-button ui-state-default ui-corner-all")},u.prototype.ButtonMouseOver=function(t){if(!this.GetEnabled()||t==-1||this._render.GetButtonEnableStatus(t))return;if(this._isMouseOverring)return;this._isMouseOverring=!0,this._currentHoverBtnIndex=t,this.ActiveButtonBackColor=this._render.GetButtonBackColor(t),this.GetFlatStyle()===n.FlatStyle.Flat?this._render.SetButtonBackColor(t,"gray"):this.GetEnablejQueryTheme()&&(this._render._allBtns[t].className="ui-button ui-state-default ui-corner-all ui-state-hover")},u.prototype.ButtonMouseDown=function(t){var i=this;if(!this.GetEnabled()||t==-1||this._render.GetButtonEnableStatus(t)||t==27)return;this.GetEnablejQueryTheme()&&(this._render._allBtns[t].className="ui-button ui-state-default ui-corner-all ui-state-active",n.Utility.IPad&&setTimeout(function(){i._render._allBtns[t].className="ui-button ui-state-default ui-corner-all"},100))},u.prototype.ButtonMouseUp=function(n){if(!this.GetEnabled()||n==-1||this._render.GetButtonEnableStatus(n))return;this.GetEnablejQueryTheme()&&(this._render._allBtns[n].className="ui-button ui-state-default ui-corner-all ui-state-hover")},u.prototype.KeyDown=function(n){var i,t;if(!this.GetEnabled())return;i=this._uIProcess.KeyDown(n);if(i==null)return!0;else if(i==-1){t=this._getShortcutObj();if(t!==null){t._uiProcess.ProcessGcCaculatorAction(this,n),t._uiProcess.ProcessTriggerAll(this,n);return}return!1}else this.Click(i)},u.prototype._getCSSBorderWidth=function(){var n=this.GetBorderWidth();return n===""||n===null?1:r.prototype._getCSSBorderWidth.call(this)},u.DefaultButtonTexts=["0","1","2","3","4","5","6","7","8","9","+/-",".","+","-","*","/","\u221a","%","1/x","=","MC","MR","MS","M+","BS","CE","C"],u.DefaultButtonKeys=["0","1","2","3","4","5","6","7","8","9","+/-",".","+","-","*","/","SQRT","%","1/x","=","MC","MR","MS","M+","BS","CE","C"],u}(n.Control),t,i;n.GcCalculator=r,t=function(){function t(){}return t.IsErrorText=function(n){return n===t.DivideByZeroInfo||n===t.InvalidInputInfo||n===t.SqrtParameterException||n===t.OverFlowInfo},t.DivideByZeroInfo=n.Localization.GetString("Calculator.DivideByZeroInfo"),t.InvalidInputInfo=n.Localization.GetString("Calculator.InvalidInputInfo"),t.SqrtParameterException=n.Localization.GetString("Calculator.SqrtParameterException"),t.OverFlowInfo=n.Localization.GetString("Calculator.OverFlowInfo"),t}(),n.CalculatorErrorInfo=t,i=function(n){function t(t){n.call(this,String),this.Owner=t}return __extends(t,n),t}(n.BaseKeyCollection),n.ButtonTextCollection=i})(GCIM||(GCIM={}));var GCIM;(function(n){var t=function(){function t(n){this._calculator=n,this._outDivContainer=null,this._mathButtons=[],this._memoryButtons=[],this._memoryStatus,this._numericButtons=[],this._resetButtons=[],this._firstLineBtns=[],this._othertLineBtns=[],this._allBtns=[],this._hideContentByWidth=!1,this._hideContentByHeight=!1,this._cellBorder=1,this._outputElementBorder=1,this._innerTableCellSpacing=1,this._outterTableCellSpacing=1,this._isDropDownCalculator=!1;var t=n._getId();this._flatOutputStyleBorderName=t+"_flat_output_border",this._flatEditBtnStyleBorderName=t+"_flat_editbtn_border",this._flatMathBtnStyleBorderName=t+"_flat_mathbtn_border",this._flatMemBtnStyleBorderName=t+"_flat_membtn_border",this._flatNumBtnStyleBorderName=t+"_flat_numbtn_border",this._flatResBtnStyleBorderName=t+"_flat_resbtn_border"}return t.prototype.CreateCalculatorFrame=function(){var h=this._calculator._getId(),e=n.Utility.CreateElement("tbody"),u=t.InnerTable(),c=t.InnerDiv(),i=t.InnerDiv();u.cellSpacing="0px",u.id=h+"_OutTable",i.id=h+"_OutContainer",i.tabIndex=0,i.setAttribute(n.Utility.IMControlIDAttribute,h),i.setAttribute("iMControlType","Calculator"),i.style.overflow="hidden",i.style.outlineStyle="none",this._calculator.GetEnablejQueryTheme()||(n.Utility.chrome?(i.style.border="1px solid rgb(169,169,169)",i.style.outline="",i.style.borderRadius=""):n.Utility.IPad&&(i.style.border="1px solid rgb(76,76,76)",i.style.borderRadius="5px"));var f=n.Utility.CreateInnerTableRow(),a=f.cloneNode(),l=f.cloneNode(),r=n.Utility.CreateInnerTableCell(),s=r.cloneNode(),o=r.cloneNode();return r.style.padding="0px",s.style.padding="0px",o.style.padding="0px",r.appendChild(this.CreateOutput()),s.appendChild(this.CreateFirstLineButtons()),o.appendChild(this.CreateOtherLineButtons()),f.appendChild(r),a.appendChild(s),l.appendChild(o),e.appendChild(f),e.appendChild(a),e.appendChild(l),u.appendChild(e),c.appendChild(u),i.appendChild(c),this.OtherLineButtonsData(this._othertLineBtns),this.CategoryButtons(),this._output=r,this._outTable=u,this._visibleRegionDiv=c,this._outDivContainer=i},t.prototype.CreateOutput=function(){var r=t.InnerDiv(),u=t.InnerTable(),e=n.Utility.CreateElement("tbody"),f=t.InnerTableRow(),i=t.InnerTableCell(),o=t.InnerTextNode("0.");return u.style.height="100%",u.style.width="100%",u.cellSpacing="0",i.id=this._calculator._getId()+n.Utility.EditFieldSuffix,i.setAttribute(n.Utility.IMControlIDAttribute,this._calculator._getId()),i.setAttribute("vAlign","top"),i.setAttribute("align","right"),i.style.paddingLeft="1px",i.style.paddingRight="1px",r.style.overflow="hidden",r.style.paddingTop=r.style.paddingBottom="1px",i.appendChild(o),f.appendChild(i),e.appendChild(f),u.appendChild(e),r.appendChild(u),this._tdOutput=i,r},t.prototype.CreateFirstLineButtons=function(){var i=t.InnerTable(),e=n.Utility.CreateElement("tbody"),f=t.InnerTableRow(),r,u;for(i.id=this._calculator._getId()+"_FirstLineButtonTable",i.cellSpacing="1px",i.style.width="100%",i.style.height="100%",i.style.tableLayout="fixed",i.style.paddingTop="1px",r=0;r<4;r++)u=t.InnerTableCell(),r==0&&(u.style.padding="0px"),u.style.overflow="hidden",f.appendChild(u),this._firstLineBtns[r]=u;return this.FirstLineButtonsData(this._firstLineBtns),e.appendChild(f),i.appendChild(e),i},t.prototype.CreateOtherLineButtons=function(){var e=t.InnerTable(),s=n.Utility.CreateElement("tbody"),o,f,i,r,u;for(e.cellSpacing="1",o=0,f=0;f<4;f++){for(i=t.InnerTableRow(),r=0;r<6;r++)u=t.InnerTableCell(),i.appendChild(u),this._othertLineBtns[o]=u,o++;s.appendChild(i)}return e.appendChild(s),e},t.prototype.CategoryButtons=function(){var e,o,r,s,t,h,i,f,u,n;for(this._memoryStatus=this._firstLineBtns[0],this._editButtons=this._firstLineBtns[1],this._resetButtons[0]=this._firstLineBtns[2],this._resetButtons[1]=this._firstLineBtns[3],e=[4,5,10,11,16,17,22,23],n=0;n<8;n++)this._mathButtons[n]=this._othertLineBtns[e[n]];for(o=[0,6,12,18],r=0;r<4;r++)this._memoryButtons[r]=this._othertLineBtns[o[r]];for(s=[1,2,3,7,8,9,13,14,15,19,20,21],t=0;t<12;t++)this._numericButtons[t]=this._othertLineBtns[s[t]];for(h=[24,25,26],i=1;i26||(this._allBtns[n].style.backgroundColor=t)},t.prototype.GetButtonBackColor=function(n){if(n>=0&&n<=26)return this._allBtns[n].style.backgroundColor},t.prototype.SetButtonValue=function(n,t){this._allBtns[n].value=t},t.prototype.SetButtonEnableStatus=function(n,t){this._allBtns[n].disabled=t,t?(this._allBtns[n]._oldColor=this._allBtns[n].style.color,this._allBtns[n].style.color="graytext"):this._allBtns[n]._oldColor!=null&&(this._allBtns[n].style.color=this._allBtns[n]._oldColor)},t.prototype.GetButtonEnableStatus=function(n){return this._allBtns[n].disabled},t.prototype.HideOrDisplayContent=function(n,t){if(n=="")if(this._hideContentByWidth||this._hideContentByHeight)return;for(var i=t;i0){this._hideContentByWidth=!1,this.HideOrDisplayContent("",0);var y=6,w=this._innerTableCellSpacing*7,i=Math.max(Math.floor((e-w)/y),2),u=Math.max(e-w-i*y,0),p=this._innerTableCellSpacing*5,c=Math.max(Math.floor((e-p-(i+u))/3),2),v=Math.max(Math.floor(e-p-(i+u)-c*2),2);for(this._output.children[0].style.width=Math.max(e-this._outputElementBorder*2,0)+"px",this._firstLineBtns[0].children[0].style.width=i+u+"px",this._firstLineBtns[0].style.width=i+u+"px",this._calculator.GetFlatStyle()===n.FlatStyle.Standard&&n.Utility.IPad&&this._calculator._getDefaultSize().Width===this._calculator.GetWidth()&&(i=i-5),s=1;s0&&Math.floor(o/6)*6===o){r.children[0].style.width=i+u+"px",r.style.width=i+u+"px";continue}r.children[0].style.width=i+"px",r.style.width=i+"px"}this._isDropDownCalculator&&(this._okBtn.style.width=i*2+"px")}else this._hideContentByWidth=!0,this.HideOrDisplayContent("none",0),f>this._calculator.Margins.Left?(h=this._calculator.Margins.Left,a=f-this._calculator.Margins.Left):f>this._calculator.Margins.Right&&(h=f,a=0),this._outDivContainer.style.paddingLeft=h+"px",this._outDivContainer.style.paddingRight=a+"px"},t.prototype.AdjustHeight=function(){var i=parseInt(this._calculator._getCSSHeight().toString(),10),r=i-this._calculator.Margins.Top-this._calculator.Margins.Bottom,y=Math.max(i-this._calculator.Margins.Top-this._calculator.Margins.Bottom,0),s,c,t,f,e,a,l,u;this._outDivContainer.style.height=this._visibleRegionDiv.style.height=y+"px";if(r>0){this._output.style.display=="none"?t=0:this._calculator.GetAutoSize()||this._calculator.GetOutputHeight()===0?(f=n.Utility.MeasureText(this._calculator.GetText(),this._tdOutput),t=f.Height+this._outputElementBorder*2+parseInt(this._output.children[0].style.paddingTop,10)+parseInt(this._output.children[0].style.paddingBottom,10)):t=parseInt(this._calculator.GetOutputHeight().toString(),10)+this._outputElementBorder*2+parseInt(this._output.children[0].style.paddingTop,10)+parseInt(this._output.children[0].style.paddingBottom,10),isNaN(t)&&(f=n.Utility.MeasureText(this._calculator.GetText(),this._tdOutput),t=f.Height+this._outputElementBorder*2+parseInt(this._output.children[0].style.paddingTop,10)+parseInt(this._output.children[0].style.paddingBottom,10));if(r>t){var h=this._isDropDownCalculator?6:5,v=this._innerTableCellSpacing*2+1+this._innerTableCellSpacing*h,o=Math.floor((r-v-t)/h);for(o<2&&(o=2),this._outDivContainer.style.paddingBottom=this._calculator.Margins.Bottom+"px",this._hideContentByHeight=!1,this.HideOrDisplayContent("",0),e=0;ethis._calculator.Margins.Top?(s=this._calculator.Margins.Top,c=i-this._calculator.Margins.Top):i>this._calculator.Margins.Bottom&&(s=i,c=0),this._outDivContainer.style.paddingTop=s+"px",this._outDivContainer.style.paddingBottom=c+"px"},t.prototype._updateWebAppearance=function(t){var r,f,e,i,u;switch(t){case n.FlatStyle.Flat:case n.InternalFlatStyle.JQueryUI:for(r=0;r11||this.isOperationInvalid||(this.NumericButton_OnClick(t),t!=10&&(this.lastOperation="ClickNumericButton")),t<12||t>19||this.isOperationInvalid||(this.MathButton_OnClick(t),this.lastOperation="ClickMathButton"),t<20||t>23||this.isOperationInvalid||(this.MemoryButton_OnClick(t),this.lastOperation="ClickMemoryButton"),t!=24||this.isOperationInvalid||this.EditButton_OnClick(),(t==25||t==26)&&(this.ResetButton_OnClick(t),this.isOperationInvalid=!1);if(this.isOperationInvalid)return null;else{var i={};return i.outputText=this.GetOutputText(),n.CalculatorErrorInfo.IsErrorText(this.result)&&(this.isOperationInvalid=!0),i.result=this.result==null?"":this.result,i.x=this.x,i.y=this.y,i.operation=this.operation,i.token=this.token,i.count=this.count,i.memoryNumber=this.memoryNumber,i.isBSCanUse=this.isBSCanUse,i.isEqualClicked=this.isEqualClicked,i.isOperationInvalid=this.isOperationInvalid,i.lastOperation=this.lastOperation,i}},t.prototype.NumericButton_OnClick=function(t){this.result==null&&(this.result="");if(this.count>14&&t!=10)return;t!=11&&t!=10&&(t!=0||this.result+""!="0"&&this.result!="")&&this.count++,t!=10&&(this.isBSCanUse=!0);switch(this.token){case 0:t<0||t>9||(this.lastOperation!="ClickNumericButton"&&this.lastOperation!=null&&(this.result="0"),this.result=="0"&&t!=0?this.result=""+t:this.result!="0"&&(this.result=this.result+""+t)),t==10&&(this.result.toString().indexOf("e")==-1?this.result!=""&&this.result!="0"&&(this.result=this.result.toString().indexOf("-")==-1?"-"+this.result:this.result.toString().substring(1,this.result.toString().length)):this.result=this.result-0>0?"-"+this.result:this.result.substring(1,this.result.length)),t==11&&(this.lastOperation!="ClickNumericButton"&&this.lastOperation!=null&&(this.result="0."),this.result==""||n.MathOperation.IsDotContained(this.result)?this.result!=""&&n.MathOperation.IsDotContained(this.result)||(this.result="0."):this.result=this.result+"."),this.token=1;break;case 1:t<0||t>9||(this.lastOperation!="ClickNumericButton"&&this.lastOperation!=null&&(this.result="0"),(this.result!="0"||t!=0)&&(this.result=this.result=="0"&&t!=0?""+t:this.result+""+t)),t==10&&(this.result.toString().indexOf("e")==-1?this.result!=""&&this.result!="0"&&(this.result=this.result.toString().indexOf("-")==-1?"-"+this.result:this.result.toString().substring(1,this.result.toString().length)):this.result=this.result-0>0?"-"+this.result:this.result.substring(1,this.result.length)),t==11&&(this.lastOperation!="ClickNumericButton"&&this.lastOperation!=null?this.result="0.":n.MathOperation.IsDotContained(this.result)||(this.result=this.result==""?"0.":this.result+".")),this.isEqualClicked||(this.y=this.result);break;case 2:t<0||t>9||(this.result="",this.result=this.result+t),t==11&&(this.result="0."),t==10&&(this.result="0"),this.token=3,this.y=this.result;break;case 3:t<0||t>9||(this.lastOperation!="ClickNumericButton"&&this.lastOperation!=null&&(this.result="0"),(this.result!="0"||t!=0)&&(this.result=this.result=="0"&&t!=0?""+t:this.result+""+t)),t==10&&(this.result.toString().indexOf("e")==-1?this.result!=""&&this.result!="0"&&(this.result=this.result.toString().indexOf("-")==-1?"-"+this.result:this.result.toString().substring(1,this.result.toString().length)):this.result=this.result-0>0?"-"+this.result:this.result.substring(1,this.result.length)),t==11&&(this.lastOperation!="ClickNumericButton"&&this.lastOperation!=null?this.result="0.":n.MathOperation.IsDotContained(this.result)||(this.result=this.result==""?"0.":this.result+".")),this.y=this.result;break}},t.prototype.MathButton_OnClick=function(t){this.count=0,this.isBSCanUse=!1,this.isEqualClicked&&(this.isEqualClicked=!1),this.result=n.MathOperation.FormatOutput(this.result);switch(this.token){case 0:this.result==""&&(this.result=0),t<16||t>18||t==17||(this.result=n.MathOperation.SingleMathOperation(this.result,this._buttonKeys[t]).toString(),n.CalculatorErrorInfo.IsErrorText(this.result)||(this.x=this.result),this.token=1),t<12||t>15||(this.operation=t,this.x=this.result,this.token=2),t==17&&this.Initial();break;case 1:t<16||t>18||t==17||(this.result=n.MathOperation.SingleMathOperation(this.result,this._buttonKeys[t]).toString(),n.CalculatorErrorInfo.IsErrorText(this.result)||(this.operation!=null&&this.y!=null?this.y=this.result:this.x=this.result)),t==19&&(this.operation!=null&&this.y!=null?(this.result=n.MathOperation.DoubleMathOperation(this.x.toString(),this.y.toString(),this._buttonKeys[this.operation]).toString(),n.CalculatorErrorInfo.IsErrorText(this.result)||(this.x=this.result)):this.result=="-0."&&(this.result="0."),this.isEqualClicked=!0,this.isBSCanUse=!1),t<12||t>15||(this.operation=t,this.x=this.result,this.token=2),t==17&&(this.operation!=null?(this.y=this.result,this.result=n.MathOperation.DoubleMathOperation(this.x.toString(),this.y.toString(),this._buttonKeys[17]).toString(),this.y=this.result):this.Initial());break;case 2:t<16||t>18||t==17||(this.result=n.MathOperation.SingleMathOperation(this.result,this._buttonKeys[t]).toString(),n.CalculatorErrorInfo.IsErrorText(this.result)||(this.token=3,this.y=this.result)),t==19&&(this.y=this.x,this.result=n.MathOperation.DoubleMathOperation(this.x.toString(),this.x.toString(),this._buttonKeys[this.operation]).toString(),n.CalculatorErrorInfo.IsErrorText(this.result)||(this.x=this.result,this.token=1,this.isBSCanUse=!1),this.isEqualClicked=!0),t<12||t>15||(this.operation=t,this.y=this.result),t==17&&(this.result=n.MathOperation.DoubleMathOperation(this.x.toString(),this.x.toString(),this._buttonKeys[17]),n.CalculatorErrorInfo.IsErrorText(this.result)||(this.y=this.result,this.token=3));break;case 3:t<16||t>18||t==17||(this.result=n.MathOperation.SingleMathOperation(this.result,this._buttonKeys[t]).toString(),n.CalculatorErrorInfo.IsErrorText(this.result)||(this.y=this.result)),t<12||t>15||(this.y=this.result,this.result=n.MathOperation.DoubleMathOperation(this.x.toString(),this.y.toString(),this._buttonKeys[this.operation]).toString(),n.CalculatorErrorInfo.IsErrorText(this.result)||(this.x=this.result,this.y=null,this.operation=t,this.token=2)),t==17&&(this.result=n.MathOperation.DoubleMathOperation(this.x.toString(),this.y.toString(),this._buttonKeys[17]),n.CalculatorErrorInfo.IsErrorText(this.result)||(this.y=this.result)),t==19&&(this.y=this.result,this.result=n.MathOperation.DoubleMathOperation(this.x.toString(),this.y.toString(),this._buttonKeys[this.operation]).toString(),n.CalculatorErrorInfo.IsErrorText(this.result)||(this.x=this.result,this.token=1,this.isBSCanUse=!1),this.isEqualClicked=!0);break}this.result+=""},t.prototype.MemoryButton_OnClick=function(t){var r,u,i;this.count=0,this.isBSCanUse=!1,t==20&&(this.memoryNumber=null);if(t==21)if(this.memoryNumber!=null){this.result=this.memoryNumber+"";switch(this.token){case 0:this.x=this.result;break;case 1:break;case 2:this.y=this.result,this.token=3;break;case 3:this.y=this.result;break}}else this.result="0",this.isBSCanUse=!1;t==22&&(this.result!=""?this.result-0==0?(this.result-=0,this.memoryNumber=null):this.memoryNumber=this.result:this.memoryNumber=null),t==23&&this.result!=""&&(this.result-0==0?this.result-=0:(this.memoryNumber==null&&(this.memoryNumber=0),this.result-=0,this.memoryNumber-=0,r=0,u=0,n.MathOperation.IsDotContained(this.result)&&(r=n.MathOperation.GetDotPosition(this.result)),n.MathOperation.IsDotContained(this.memoryNumber.toString())&&(u=n.MathOperation.GetDotPosition(this.memoryNumber.toString())),i=Math.max(r,u),this.memoryNumber=(this.result*Math.pow(10,i)+this.memoryNumber*Math.pow(10,i))/Math.pow(10,i)));return},t.prototype.EditButton_OnClick=function(){this.count>0&&this.count--;if((this.token==0||this.token==1||this.token==3)&&this.isBSCanUse==!0){this.result+="";var t=0,n=this.result.length;n>0&&(this.result=this.result.substring(t,n-1)),this.result=="-0"&&(this.result="0"),this.result=="-"&&(this.result=""),this.result==""&&(this.isBSCanUse=!1);switch(this.token){case 0:this.x=this.result;break;case 1:this.x=this.result;break;case 3:this.y=this.result;break}}return},t.prototype.ResetButton_OnClick=function(n){this.count=0,this.isBSCanUse=!1,this.result="",n==25&&(this.token==1&&(this.operation==null||this.isEqualClicked||(this.y=0)),this.token==2&&(this.token=3),this.token==3),n==26&&this.Initial();return},t.prototype.GetOutputText=function(){var t="";return t=this.result==""||this.result==null?"0.":n.MathOperation.IsDotContained(this.result)||(this.result+"").indexOf("e")!=-1||n.CalculatorErrorInfo.IsErrorText(this.result)?this.result:this.result+"."},t.prototype.KeyDown=function(t){var i=t.keyCode;t.shiftKey&&(i|=65536),t.ctrlKey&&(i|=131072),t.altKey&&(i|=262144);switch(i){case 131138:case 131140:case 131141:case 131144:case 131145:case 131148:case 131150:case 131154:case 131159:case 131188:case 262181:case 262183:case n.Key.F6:case 65657:case 131081:case 196617:case n.Key.Tab:case 65545:case n.Key.F10:case n.Key.F12:return null;break;case n.Key.D0:case n.Key.NumPad0:return 0;case n.Key.D1:case n.Key.NumPad1:return 1;case n.Key.D2:case n.Key.NumPad2:return 2;case n.Key.D3:case n.Key.NumPad3:return 3;case n.Key.D4:case n.Key.NumPad4:return 4;case n.Key.D5:case n.Key.NumPad5:return 5;case n.Key.D6:case n.Key.NumPad6:return 6;case n.Key.D7:case n.Key.NumPad7:return 7;case n.Key.D8:case n.Key.NumPad8:return 8;case n.Key.D9:case n.Key.NumPad9:return 9;case 120:return 10;case 190:case 188:case n.Key.Decimal:return 11;case 65723:case n.Key.Add:return 12;case 65643:if(!n.Utility.IsIE)return 12;case 189:case n.Key.Subtract:return 13;case 65592:case n.Key.Multiply:case 65722:return 14;case 191:case n.Key.Divide:return 15;case 65586:case 192:return 16;case 65589:return 17;case 82:return 18;case n.Key.Return:return 19;case 393292:return 20;case 393298:return 21;case 393293:return 22;case 393296:return 23;case 8:return 24;case 46:return 25;case 27:case 131118:return 26;default:return i==61&&n.Utility.firefox||i==187&&!n.Utility.firefox?19:-1}},t.prototype.IndexOfButtonKeys=function(n){for(var t=0;t<27;t++)if(this._buttonKeys[t]==n)return t;return-1},t.prototype.GetButtonIndex=function(t){for(var r=n.GcCalculator.DefaultButtonKeys,i=0;i0;t--){if(r.substring(t-1,t)==".")return i;i++}return t===0?0:i},t.FormatOutput=function(n){if(n==null)return null;var i=n+"",u=0,r=i.length;if(t.IsDotContained(i))while(i.substring(r-1,r)=="0"&&i!=""&&i.indexOf("e")==-1)i=i.substring(u,r-1),r--;return i},t.FormatResult=function(i){var r=i+"",h="",u,e;i<0&&(h="-",r=r.substring(1,r.length));var f=r.length,s="",o=r.indexOf("e");return o!=-1&&(s=r.substring(o,f),r=r.substring(0,o),f=r.length),t.IsDotContained(r)&&f>16&&(u=0,parseFloat(r)>1?(u=t.GetDotPosition(r)-(f-16),r=r.toString().substring(0,17)):(u=t.GetDotPosition(r)-(f-17),r=r.toString().substring(0,18)),r=u>0?(Math.round(parseFloat(r)*Math.pow(10,u))/Math.pow(10,u)).toString():Math.round(parseFloat(r)).toString()),f=r.length,!t.IsDotContained(r)&&f>15&&(u=f-15,r=(Math.round(parseFloat(r)/Math.pow(10,u))*Math.pow(10,u)).toString()),r=h+r+s,e=parseFloat(r),t.IsOverFlow(e.toString())?n.CalculatorErrorInfo.OverFlowInfo:e},t.SingleMathOperation=function(i,r){var u=parseFloat(i),f;isNaN(u)&&(u=0);if(r=="SQRT")if(u<0)return n.CalculatorErrorInfo.SqrtParameterException;else u=Math.sqrt(u);if(r=="1/x")if(u==0)return n.CalculatorErrorInfo.DivideByZeroInfo;else f=t.GetDotPosition(u.toString()),u=Math.pow(10,f)/(Math.pow(10,f)*u);return t.FormatResult(u)},t.DoubleMathOperation=function(i,r,u){var e=parseFloat(i),f=parseFloat(r),o,h,c,s;if(t.IsDotContained(e.toString())||t.IsDotContained(f.toString())){h=0,c=0,t.IsDotContained(e.toString())&&(h=t.GetDotPosition(e.toString())),t.IsDotContained(f.toString())&&(c=t.GetDotPosition(f.toString())),s=Math.max(h,c),u=="+"&&(e=e*Math.pow(10,s),f=f*Math.pow(10,s),o=(e+f)/Math.pow(10,s)),u=="-"&&(e=e*Math.pow(10,s),f=f*Math.pow(10,s),o=(e-f)/Math.pow(10,s)),u=="*"&&(e=e*Math.pow(10,h),f=f*Math.pow(10,c),o=e*f/Math.pow(10,h+c));if(u=="/"){e=e*Math.pow(10,s),f=f*Math.pow(10,s);if(f==0)return n.CalculatorErrorInfo.DivideByZeroInfo;else o=e/f}u=="%"&&(e=e*Math.pow(10,h),f=f*Math.pow(10,c),o=e*f/Math.pow(10,h+c+2))}else{u=="+"&&(o=e+f),u=="-"&&(o=e-f),u=="*"&&(o=e*f);if(u=="/")if(f==0)return n.CalculatorErrorInfo.DivideByZeroInfo;else o=e/f;u=="%"&&(o=e*f/100)}return t.FormatResult(o)},t.IsOverFlow=function(n){var t=parseFloat(n);if(t!=0){if(t>79e27)return!0;if(t<1e-28&&t>-1e-28)return!0;if(t<-79e27)return!0}return!1},t}();n.MathOperation=t})(GCIM||(GCIM={})) if(typeof(Sys)!='undefined' && typeof(Sys.Application) != 'undefined'){Sys.Application.notifyScriptLoaded();};