window.TrNumberConverter=function(a,b,d,e,g,h,k,m,n,o,q,s){this._pattern=a;this._type=b;this._locale=d;this._messages=e;this._currencyCode=k;this._currencySymbol=m;this._maxFractionDigits=n;this._maxIntegerDigits=o;this._minFractionDigits=q;this._minIntegerDigits=s;this._integerOnly=void 0!==g?g:!1;this._groupingUsed=void 0!==h?h:!0;this._initNumberFormat(d);this._class="TrNumberConverter"};TrNumberConverter.prototype=new TrConverter;
TrNumberConverter.prototype.setCurrencyCode=function(a){this._currencyCode=a};TrNumberConverter.prototype.getCurrencyCode=function(){return this._currencyCode};TrNumberConverter.prototype.setCurrencySymbol=function(a){this._currencySymbol=a};TrNumberConverter.prototype.getCurrencySymbol=function(){return this._currencySymbol};TrNumberConverter.prototype.setMaxFractionDigits=function(a){this._maxFractionDigits=a};TrNumberConverter.prototype.getMaxFractionDigits=function(){return this._maxFractionDigits};
TrNumberConverter.prototype.setMaxIntegerDigits=function(a){this._maxIntegerDigits=a};TrNumberConverter.prototype.getMaxIntegerDigits=function(){return this._maxIntegerDigits};TrNumberConverter.prototype.setMinFractionDigits=function(a){this._minFractionDigits=a};TrNumberConverter.prototype.getMinFractionDigits=function(){return this._minFractionDigits};TrNumberConverter.prototype.setMinIntegerDigits=function(a){this._minIntegerDigits=a};TrNumberConverter.prototype.getMinIntegerDigits=function(){return this._minIntegerDigits};
TrNumberConverter.prototype.setGroupingUsed=function(a){this._groupingUsed=a};TrNumberConverter.prototype.isGroupingUsed=function(){return this._groupingUsed};TrNumberConverter.prototype.setIntegerOnly=function(a){this._integerOnly=a};TrNumberConverter.prototype.isIntegerOnly=function(){return this._integerOnly};
TrNumberConverter.prototype.getFormatHint=function(){return this._messages&&this._messages.hintPattern?TrMessageFactory.createCustomMessage(this._messages.hintPattern,this._pattern):this._pattern?TrMessageFactory.createMessage("org.apache.myfaces.trinidad.convert.NumberConverter.FORMAT_HINT",this._pattern):null};
TrNumberConverter.prototype.getAsString=function(a){if(this._isConvertible())return"percent"==this._type||"currency"==this._type?(a=this._numberFormat.format(a),"currency"==this._type&&(this._currencyCode?a=a.replace(getLocaleSymbols().getCurrencyCode(),this._currencyCode):this._currencySymbol&&(a=a.replace(getLocaleSymbols().getCurrencySymbol(),this._currencySymbol))),a):"string"===typeof a?this._numberFormat.format(parseFloat(a)):this._numberFormat.format(parseFloat(a.toFixed(this._numberFormat.getMaximumFractionDigits())))};
TrNumberConverter.prototype.getAsObject=function(a,b){a=TrFormatUtils.trim(a);if(this._isConvertible(a)){if(null==a||0==a.length)return null;var d;if("percent"==this._type||"currency"==this._type){d=getLocaleSymbols(this._locale);var e=d.getGroupingSeparator();"\u00a0"==e&&(a=a.replace(RegExp("\\ ","g"),"\u00a0"));a=a.replace(RegExp("\\"+e,"g"),"");d=d.getDecimalSeparator();a=a.replace(RegExp("\\"+d,"g"),".");try{a=this._numberFormat.parse(a)+""}catch(g){try{a=TrNumberFormat.getNumberInstance().parse(a)+
""}catch(h){throw d=this._numberFormat.format(this._example),e="org.apache.myfaces.trinidad.convert.NumberConverter.CONVERT_"+this._type.toUpperCase(),d=this._messages&&this._messages[this._type]?_createCustomFacesMessage(TrMessageFactory.getSummaryString(e),this._messages[this._type],b,a,d):_createFacesMessage(e,b,a,d),new TrConverterException(d);}}a=a.replace(RegExp("\\.","g"),getLocaleSymbols().getDecimalSeparator())}d=_decimalParse(a,this._messages,"org.apache.myfaces.trinidad.convert.NumberConverter",
null,null,null,null,b,!this.isIntegerOnly());d=parseFloat(d.toFixed(this._numberFormat.getMaximumFractionDigits()));"percent"==this._type&&(d/=100);return d}};TrNumberConverter.prototype._isConvertible=function(a){return null!=this._pattern?!1:TrFormatUtils.isNumberConvertible(a)};
TrNumberConverter.prototype._initNumberFormat=function(a){"percent"==this._type?(this._example=0.3423,this._numberFormat=TrNumberFormat.getPercentInstance(a)):"currency"==this._type?(this._example=10250,this._numberFormat=TrNumberFormat.getCurrencyInstance(a)):"number"==this._type&&(this._numberFormat=TrNumberFormat.getNumberInstance(a));this._numberFormat.setGroupingUsed(this.isGroupingUsed());this._numberFormat.setMaximumFractionDigits(this.getMaxFractionDigits());this._numberFormat.setMaximumIntegerDigits(this.getMaxIntegerDigits());
this._numberFormat.setMinimumFractionDigits(this.getMinFractionDigits());this._numberFormat.setMinimumIntegerDigits(this.getMinIntegerDigits())};