Comparing version 10.0.3 to 10.0.4
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/forms"),require("@angular/common")):"function"==typeof define&&define.amd?define("ngx-mask",["exports","@angular/core","@angular/forms","@angular/common"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["ngx-mask"]={},e.ng.core,e.ng.forms,e.ng.common)}(this,(function(e,t,i,r){"use strict";var s=new t.InjectionToken("config"),a=new t.InjectionToken("NEW_CONFIG"),n=new t.InjectionToken("INITIAL_CONFIG"),l={suffix:"",prefix:"",thousandSeparator:" ",decimalMarker:".",clearIfNotMatch:!1,showTemplate:!1,showMaskTyped:!1,placeHolderCharacter:"_",dropSpecialCharacters:!0,hiddenInput:void 0,shownMaskExpression:"",separatorLimit:"",allowNegativeNumbers:!1,validation:!0,specialCharacters:["-","/","(",")",".",":"," ","+",",","@","[","]",'"',"'"],patterns:{0:{pattern:new RegExp("\\d")},9:{pattern:new RegExp("\\d"),optional:!0},X:{pattern:new RegExp("\\d"),symbol:"*"},A:{pattern:new RegExp("[a-zA-Z0-9]")},S:{pattern:new RegExp("[a-zA-Z]")},d:{pattern:new RegExp("\\d")},m:{pattern:new RegExp("\\d")},M:{pattern:new RegExp("\\d")},H:{pattern:new RegExp("\\d")},h:{pattern:new RegExp("\\d")},s:{pattern:new RegExp("\\d")}}},h=["Hh:m0:s0","Hh:m0","m0:s0"],o=["percent","Hh","s0","m0","separator","d0/M0/0000","d0/M0","d0","M0"],c=function(e,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])})(e,t)};function u(e,t,i,r){return new(i||(i=Promise))((function(s,a){function n(e){try{h(r.next(e))}catch(e){a(e)}}function l(e){try{h(r.throw(e))}catch(e){a(e)}}function h(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(n,l)}h((r=r.apply(e,t||[])).next())}))}function p(e,t){var i,r,s,a,n={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(i)throw new TypeError("Generator is already executing.");for(;n;)try{if(i=1,r&&(s=2&a[0]?r.return:a[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,a[1])).done)return s;switch(r=0,s&&(a=[2&a[0],s.value]),a[0]){case 0:case 1:s=a;break;case 4:return n.label++,{value:a[1],done:!1};case 5:n.label++,r=a[1],a=[0];continue;case 7:a=n.ops.pop(),n.trys.pop();continue;default:if(!(s=n.trys,(s=s.length>0&&s[s.length-1])||6!==a[0]&&2!==a[0])){n=0;continue}if(3===a[0]&&(!s||a[1]>s[0]&&a[1]<s[3])){n.label=a[1];break}if(6===a[0]&&n.label<s[1]){n.label=s[1],s=a;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(a);break}s[2]&&n.ops.pop(),n.trys.pop();continue}a=t.call(e,n)}catch(e){a=[6,e],r=0}finally{i=s=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}Object.create;function f(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var r,s,a=i.call(e),n=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)n.push(r.value)}catch(e){s={error:e}}finally{try{r&&!r.done&&(i=a.return)&&i.call(a)}finally{if(s)throw s.error}}return n}Object.create;var m=function(){function e(e){var t=this;this._config=e,this.maskExpression="",this.actualValue="",this.shownMaskExpression="",this._formatWithSeparators=function(e,i,r,s){var a=e.split(r),n=a.length>1?""+r+a[1]:"",l=a[0],h=t.separatorLimit.replace(/\s/g,"");h&&+h&&(l="-"===l[0]?"-"+l.slice(1,l.length).slice(0,h.length):l.slice(0,h.length));for(var o=/(\d+)(\d{3})/;i&&o.test(l);)l=l.replace(o,"$1"+i+"$2");return void 0===s?l+n:0===s?l:l+n.substr(0,s+1)},this.percentage=function(e){return Number(e)>=0&&Number(e)<=100},this.getPrecision=function(e){var t=e.split(".");return t.length>1?Number(t[t.length-1]):1/0},this.checkInputPrecision=function(e,i,r){if(i<1/0){var s=new RegExp(t._charToRegExpExpression(r)+"\\d{"+i+"}.*$"),a=e.match(s);if(a&&a[0].length-1>i){var n=a[0].length-1-i;e=e.substring(0,e.length-n)}0===i&&e.endsWith(r)&&(e=e.substring(0,e.length-1))}return e},this._shift=new Set,this.clearIfNotMatch=this._config.clearIfNotMatch,this.dropSpecialCharacters=this._config.dropSpecialCharacters,this.maskSpecialCharacters=this._config.specialCharacters,this.maskAvailablePatterns=this._config.patterns,this.prefix=this._config.prefix,this.suffix=this._config.suffix,this.thousandSeparator=this._config.thousandSeparator,this.decimalMarker=this._config.decimalMarker,this.hiddenInput=this._config.hiddenInput,this.showMaskTyped=this._config.showMaskTyped,this.placeHolderCharacter=this._config.placeHolderCharacter,this.validation=this._config.validation,this.separatorLimit=this._config.separatorLimit,this.allowNegativeNumbers=this._config.allowNegativeNumbers}return e.prototype.applyMaskWithPattern=function(e,t){var i=f(t,2),r=i[0],s=i[1];return this.customPattern=s,this.applyMask(e,r)},e.prototype.applyMask=function(e,t,i,r){if(void 0===i&&(i=0),void 0===r&&(r=function(){}),null==e||void 0===t)return"";var s=0,a="",n=!1,l=!1,h=1,o=!1;e.slice(0,this.prefix.length)===this.prefix&&(e=e.slice(this.prefix.length,e.length)),this.suffix&&e.endsWith(this.suffix)&&(e=e.slice(0,e.length-this.suffix.length));var c=e.toString().split("");"IP"===t&&(this.ipError=!!(c.filter((function(e){return"."===e})).length<3&&c.length<7),t="099.099.099.099");for(var u=[],p=0;p<e.length;p++)e[p].match("\\d")&&u.push(e[p]);if("CPF_CNPJ"===t&&(this.cpfCnpjError=!(11===u.length||14===u.length),t=u.length>11?"00.000.000/0000-00":"000.000.000-00"),t.startsWith("percent")){if(e.match("[a-z]|[A-Z]")||e.match(/[-!$%^&*()_+|~=`{}\[\]:";'<>?,\/.]/)){e=this._stripToDecimal(e);var f=this.getPrecision(t);e=this.checkInputPrecision(e,f,this.decimalMarker)}if(e.indexOf(".")>0&&!this.percentage(e.substring(0,e.indexOf(".")))){var m=e.substring(0,e.indexOf(".")-1);e=""+m+e.substring(e.indexOf("."),e.length)}a=this.percentage(e)?e:e.substring(0,e.length-1)}else if(t.startsWith("separator")){(e.match("[wа-яА-Я]")||e.match("[ЁёА-я]")||e.match("[a-z]|[A-Z]")||e.match(/[-@#!$%\\^&*()_£¬'+|~=`{}\[\]:";<>.?\/]/)||e.match("[^A-Za-z0-9,]"))&&(e=this._stripToDecimal(e)),e=e.length>1&&"0"===e[0]&&e[1]!==this.decimalMarker?e.slice(1,e.length):e;var k=this._charToRegExpExpression(this.thousandSeparator),d=this._charToRegExpExpression(this.decimalMarker),g='@#!$%^&*()_+|~=`{}\\[\\]:\\s,\\.";<>?\\/'.replace(k,"").replace(d,""),_=new RegExp("["+g+"]");e.match(_)&&(e=e.substring(0,e.length-1));f=this.getPrecision(t);var v=(e=this.checkInputPrecision(e,f,this.decimalMarker)).replace(new RegExp(k,"g"),""),S=(a=this._formatWithSeparators(v,this.thousandSeparator,this.decimalMarker,f)).indexOf(",")-e.indexOf(",");if((C=a.length-e.length)>0&&","!==a[i]){l=!0;var y=0;do{this._shift.add(i+y),y++}while(y<C)}else 0!==S&&i>0&&!(a.indexOf(",")>=i&&i>3)||!(a.indexOf(".")>=i&&i>3)&&C<=0?(this._shift.clear(),l=!0,h=C,i+=C,this._shift.add(i)):this._shift.clear()}else{p=0;for(var x=c[0];p<c.length&&s!==t.length;x=c[++p])if(this._checkSymbolMask(x,t[s])&&"?"===t[s+1])a+=x,s+=2;else if("*"===t[s+1]&&n&&this._checkSymbolMask(x,t[s+2]))a+=x,s+=3,n=!1;else if(this._checkSymbolMask(x,t[s])&&"*"===t[s+1])a+=x,n=!0;else if("?"===t[s+1]&&this._checkSymbolMask(x,t[s+2]))a+=x,s+=3;else if(this._checkSymbolMask(x,t[s])||this.hiddenInput&&this.maskAvailablePatterns[t[s]]&&this.maskAvailablePatterns[t[s]].symbol===x){if("H"===t[s]&&Number(x)>2){s+=1;var C=/[*?]/g.test(t.slice(0,s))?c.length:s;this._shift.add(C+this.prefix.length||0),p--;continue}if("h"===t[s]&&"2"===a&&Number(x)>3){s+=1,p--;continue}if("m"===t[s]&&Number(x)>5){s+=1;C=/[*?]/g.test(t.slice(0,s))?c.length:s;this._shift.add(C+this.prefix.length||0),p--;continue}if("s"===t[s]&&Number(x)>5){s+=1;C=/[*?]/g.test(t.slice(0,s))?c.length:s;this._shift.add(C+this.prefix.length||0),p--;continue}if("d"===t[s]&&(Number(e.slice(s,s+2))>31||"/"===e[s+1])){s+=1;C=/[*?]/g.test(t.slice(0,s))?c.length:s;this._shift.add(C+this.prefix.length||0),p--;continue}if("M"===t[s]){var E=12,b=0===s&&(Number(x)>2||Number(e.slice(s,s+2))>E||"/"===e[s+1]),M=e.slice(s-3,s-1).includes("/")&&("/"===e[s-2]&&Number(e.slice(s-1,s+1))>E&&"/"!==e[s]||"/"===e[s]||"/"===e[s-3]&&Number(e.slice(s-2,s))>E&&"/"!==e[s-1]||"/"===e[s-1]),V=Number(e.slice(s-3,s-1))<=31&&!e.slice(s-3,s-1).includes("/")&&"/"===e[s-1]&&(Number(e.slice(s,s+2))>E||"/"===e[s+1]),w=Number(e.slice(s-3,s-1))>31&&!e.slice(s-3,s-1).includes("/")&&!e.slice(s-2,s).includes("/")&&Number(e.slice(s-2,s))>E,I=Number(e.slice(s-3,s-1))<=31&&!e.slice(s-3,s-1).includes("/")&&"/"!==e[s-1]&&Number(e.slice(s-1,s+1))>E;if(b||M||V||w||I){s+=1;C=/[*?]/g.test(t.slice(0,s))?c.length:s;this._shift.add(C+this.prefix.length||0),p--;continue}}a+=x,s++}else if(-1!==this.maskSpecialCharacters.indexOf(t[s])){a+=t[s],s++;C=/[*?]/g.test(t.slice(0,s))?c.length:s;this._shift.add(C+this.prefix.length||0),p--}else this.maskSpecialCharacters.indexOf(x)>-1&&this.maskAvailablePatterns[t[s]]&&this.maskAvailablePatterns[t[s]].optional?(c[s]&&"099.099.099.099"!==t&&"000.000.000-00"!==t&&"00.000.000/0000-00"!==t&&(a+=c[s]),s++,p--):"*"===this.maskExpression[s+1]&&this._findSpecialChar(this.maskExpression[s+2])&&this._findSpecialChar(x)===this.maskExpression[s+2]&&n||"?"===this.maskExpression[s+1]&&this._findSpecialChar(this.maskExpression[s+2])&&this._findSpecialChar(x)===this.maskExpression[s+2]&&n?(s+=3,a+=x):this.showMaskTyped&&this.maskSpecialCharacters.indexOf(x)<0&&x!==this.placeHolderCharacter&&(o=!0)}a.length+1===t.length&&-1!==this.maskSpecialCharacters.indexOf(t[t.length-1])&&(a+=t[t.length-1]);for(var N=i+1;this._shift.has(N);)h++,N++;var P=this._shift.has(i)?h:0;o&&P--,r(P,l),h<0&&this._shift.clear();var A=""+this.prefix+a+this.suffix;return 0===a.length&&(A=""+this.prefix+a),A},e.prototype._findSpecialChar=function(e){return this.maskSpecialCharacters.find((function(t){return t===e}))},e.prototype._checkSymbolMask=function(e,t){return this.maskAvailablePatterns=this.customPattern?this.customPattern:this.maskAvailablePatterns,this.maskAvailablePatterns[t]&&this.maskAvailablePatterns[t].pattern&&this.maskAvailablePatterns[t].pattern.test(e)},e.prototype._stripToDecimal=function(e){var t=this;return e.split("").filter((function(e,i){return e.match("^-?\\d")||e.match("\\s")||"."===e||","===e||"-"===e&&0===i&&t.allowNegativeNumbers})).join("")},e.prototype._charToRegExpExpression=function(e){if(e){return" "===e?"\\s":"[\\^$.|?*+()".indexOf(e)>=0?"\\"+e:e}return e},e}();m.decorators=[{type:t.Injectable}],m.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[s]}]}]};var k=function(e){function t(t,i,r,s){var a=e.call(this,i)||this;return a.document=t,a._config=i,a._elementRef=r,a._renderer=s,a.maskExpression="",a.isNumberValue=!1,a.placeHolderCharacter="_",a.maskIsShown="",a.selStart=null,a.selEnd=null,a.writingValue=!1,a.onChange=function(e){},a._formElement=a._elementRef.nativeElement,a}return function(e,t){function i(){this.constructor=e}c(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}(t,e),t.prototype.applyMask=function(t,i,r,s){var a=this;if(void 0===r&&(r=0),void 0===s&&(s=function(){}),!i)return t;if(this.maskIsShown=this.showMaskTyped?this.showMaskInInput():"","IP"===this.maskExpression&&this.showMaskTyped&&(this.maskIsShown=this.showMaskInInput(t||"#")),"CPF_CNPJ"===this.maskExpression&&this.showMaskTyped&&(this.maskIsShown=this.showMaskInInput(t||"#")),!t&&this.showMaskTyped)return this.formControlResult(this.prefix),this.prefix+this.maskIsShown;var n=t&&"number"==typeof this.selStart?t[this.selStart]:"",l="";if(void 0!==this.hiddenInput){var h=this.actualValue.split("");""!==t&&h.length?"number"==typeof this.selStart&&"number"==typeof this.selEnd&&(t.length>h.length?h.splice(this.selStart,0,n):t.length<h.length&&(h.length-t.length==1?h.splice(this.selStart-1,1):h.splice(this.selStart,this.selEnd-this.selStart))):h=[],l=this.actualValue.length?this.shiftTypedSymbols(h.join("")):t}l=Boolean(l)&&l.length?l:t;var o=e.prototype.applyMask.call(this,l,i,r,s);if(this.actualValue=this.getActualValue(o),"."===this.thousandSeparator&&"."===this.decimalMarker&&(this.decimalMarker=","),this.maskExpression.startsWith("separator")&&!0===this.dropSpecialCharacters&&(this.maskSpecialCharacters=this.maskSpecialCharacters.filter((function(e){return e!==a.decimalMarker}))),this.formControlResult(o),!this.showMaskTyped)return this.hiddenInput&&o&&o.length?this.hideInput(o,this.maskExpression):o;var c=o.length,u=this.prefix+this.maskIsShown;if(this.maskExpression.includes("H")){var p=this._numberSkipedSymbols(o);return o+u.slice(c+p)}return"IP"===this.maskExpression||"CPF_CNPJ"===this.maskExpression?o+u:o+u.slice(c)},t.prototype._numberSkipedSymbols=function(e){for(var t=/(^|\D)(\d\D)/g,i=t.exec(e),r=0;null!=i;)r+=1,i=t.exec(e);return r},t.prototype.applyValueChanges=function(e,t){void 0===e&&(e=0),void 0===t&&(t=function(){}),this._formElement.value=this.applyMask(this._formElement.value,this.maskExpression,e,t),this._formElement!==this.document.activeElement&&this.clearIfNotMatchFn()},t.prototype.hideInput=function(e,t){var i=this;return e.split("").map((function(e,r){return i.maskAvailablePatterns&&i.maskAvailablePatterns[t[r]]&&i.maskAvailablePatterns[t[r]].symbol?i.maskAvailablePatterns[t[r]].symbol:e})).join("")},t.prototype.getActualValue=function(e){var t=this,i=e.split("").filter((function(e,i){return t._checkSymbolMask(e,t.maskExpression[i])||t.maskSpecialCharacters.includes(t.maskExpression[i])&&e===t.maskExpression[i]}));return i.join("")===e?i.join(""):e},t.prototype.shiftTypedSymbols=function(e){var t=this,i="";return(e&&e.split("").map((function(r,s){if(t.maskSpecialCharacters.includes(e[s+1])&&e[s+1]!==t.maskExpression[s+1])return i=r,e[s+1];if(i.length){var a=i;return i="",a}return r}))||[]).join("")},t.prototype.showMaskInInput=function(e){if(this.showMaskTyped&&this.shownMaskExpression){if(this.maskExpression.length!==this.shownMaskExpression.length)throw new Error("Mask expression must match mask placeholder length");return this.shownMaskExpression}if(this.showMaskTyped){if(e){if("IP"===this.maskExpression)return this._checkForIp(e);if("CPF_CNPJ"===this.maskExpression)return this._checkForCpfCnpj(e)}return this.maskExpression.replace(/\w/g,this.placeHolderCharacter)}return""},t.prototype.clearIfNotMatchFn=function(){this.clearIfNotMatch&&this.prefix.length+this.maskExpression.length+this.suffix.length!==this._formElement.value.replace(/_/g,"").length&&(this.formElementProperty=["value",""],this.applyMask(this._formElement.value,this.maskExpression))},Object.defineProperty(t.prototype,"formElementProperty",{set:function(e){var t=f(e,2),i=t[0],r=t[1];this._renderer.setProperty(this._formElement,i,r)},enumerable:!1,configurable:!0}),t.prototype.checkSpecialCharAmount=function(e){var t=this;return e.split("").filter((function(e){return t._findSpecialChar(e)})).length},t.prototype.removeMask=function(e){return this._removeMask(this._removeSuffix(this._removePrefix(e)),this.maskSpecialCharacters.concat("_").concat(this.placeHolderCharacter))},t.prototype._checkForIp=function(e){if("#"===e)return this.placeHolderCharacter+"."+this.placeHolderCharacter+"."+this.placeHolderCharacter+"."+this.placeHolderCharacter;for(var t=[],i=0;i<e.length;i++)e[i].match("\\d")&&t.push(e[i]);return t.length<=3?this.placeHolderCharacter+"."+this.placeHolderCharacter+"."+this.placeHolderCharacter:t.length>3&&t.length<=6?this.placeHolderCharacter+"."+this.placeHolderCharacter:t.length>6&&t.length<=9?this.placeHolderCharacter:(t.length>9&&t.length,"")},t.prototype._checkForCpfCnpj=function(e){var t=""+this.placeHolderCharacter+this.placeHolderCharacter+this.placeHolderCharacter+"."+this.placeHolderCharacter+this.placeHolderCharacter+this.placeHolderCharacter+"."+this.placeHolderCharacter+this.placeHolderCharacter+this.placeHolderCharacter+"-"+this.placeHolderCharacter+this.placeHolderCharacter,i=""+this.placeHolderCharacter+this.placeHolderCharacter+"."+this.placeHolderCharacter+this.placeHolderCharacter+this.placeHolderCharacter+"."+this.placeHolderCharacter+this.placeHolderCharacter+this.placeHolderCharacter+"/"+this.placeHolderCharacter+this.placeHolderCharacter+this.placeHolderCharacter+this.placeHolderCharacter+"-"+this.placeHolderCharacter+this.placeHolderCharacter;if("#"===e)return t;for(var r=[],s=0;s<e.length;s++)e[s].match("\\d")&&r.push(e[s]);return r.length<=3?t.slice(r.length,t.length):r.length>3&&r.length<=6?t.slice(r.length+1,t.length):r.length>6&&r.length<=9?t.slice(r.length+2,t.length):r.length>9&&r.length<11?t.slice(r.length+3,t.length):11===r.length?"":12===r.length?17===e.length?i.slice(16,i.length):i.slice(15,i.length):r.length>12&&r.length<=14?i.slice(r.length+4,i.length):""},t.prototype.formControlResult=function(e){this.writingValue||(Array.isArray(this.dropSpecialCharacters)?this.onChange(this._removeMask(this._removeSuffix(this._removePrefix(e)),this.dropSpecialCharacters)):this.dropSpecialCharacters?this.onChange(this._checkSymbols(e)):this.onChange(this._removeSuffix(this._removePrefix(e))))},t.prototype._removeMask=function(e,t){return e?e.replace(this._regExpForRemove(t),""):e},t.prototype._removePrefix=function(e){return this.prefix&&e?e.replace(this.prefix,""):e},t.prototype._removeSuffix=function(e){return this.suffix&&e?e.replace(this.suffix,""):e},t.prototype._retrieveSeparatorValue=function(e){return this._removeMask(this._removeSuffix(this._removePrefix(e)),this.maskSpecialCharacters)},t.prototype._regExpForRemove=function(e){return new RegExp(e.map((function(e){return"\\"+e})).join("|"),"gi")},t.prototype._checkSymbols=function(e){if(""===e)return e;var t=this._retrieveSeparatorPrecision(this.maskExpression),i=this._retrieveSeparatorValue(e);return"."!==this.decimalMarker&&(i=i.replace(this.decimalMarker,".")),this.isNumberValue?t?e===this.decimalMarker?null:this._checkPrecision(this.maskExpression,i):Number(i):i},t.prototype._retrieveSeparatorPrecision=function(e){var t=e.match(new RegExp("^separator\\.([^d]*)"));return t?Number(t[1]):null},t.prototype._checkPrecision=function(e,t){return e.indexOf("2")>0?Number(t).toFixed(2):Number(t)},t}(m);k.decorators=[{type:t.Injectable}],k.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[r.DOCUMENT]}]},{type:void 0,decorators:[{type:t.Inject,args:[s]}]},{type:t.ElementRef},{type:t.Renderer2}]};var d=function(){function e(e,t,i){this.document=e,this._maskService=t,this._config=i,this.maskExpression="",this.specialCharacters=[],this.patterns={},this.prefix="",this.suffix="",this.thousandSeparator=" ",this.decimalMarker=".",this.dropSpecialCharacters=null,this.hiddenInput=null,this.showMaskTyped=null,this.placeHolderCharacter=null,this.shownMaskExpression=null,this.showTemplate=null,this.clearIfNotMatch=null,this.validation=null,this.separatorLimit=null,this.allowNegativeNumbers=null,this._maskValue="",this._position=null,this._maskExpressionArray=[],this.onChange=function(e){},this.onTouch=function(){}}return e.prototype.ngOnChanges=function(e){var t=e.maskExpression,i=e.specialCharacters,r=e.patterns,s=e.prefix,a=e.suffix,n=e.thousandSeparator,l=e.decimalMarker,h=e.dropSpecialCharacters,o=e.hiddenInput,c=e.showMaskTyped,u=e.placeHolderCharacter,p=e.shownMaskExpression,f=e.showTemplate,m=e.clearIfNotMatch,k=e.validation,d=e.separatorLimit,g=e.allowNegativeNumbers;if(t&&(this._maskValue=t.currentValue||"",t.currentValue&&t.currentValue.split("||").length>1&&(this._maskExpressionArray=t.currentValue.split("||").sort((function(e,t){return e.length-t.length})),this._maskValue=this._maskExpressionArray[0],this.maskExpression=this._maskExpressionArray[0],this._maskService.maskExpression=this._maskExpressionArray[0])),i){if(!i.currentValue||!Array.isArray(i.currentValue))return;this._maskService.maskSpecialCharacters=i.currentValue||[]}r&&r.currentValue&&(this._maskService.maskAvailablePatterns=r.currentValue),s&&(this._maskService.prefix=s.currentValue),a&&(this._maskService.suffix=a.currentValue),n&&(this._maskService.thousandSeparator=n.currentValue),l&&(this._maskService.decimalMarker=l.currentValue),h&&(this._maskService.dropSpecialCharacters=h.currentValue),o&&(this._maskService.hiddenInput=o.currentValue),c&&(this._maskService.showMaskTyped=c.currentValue),u&&(this._maskService.placeHolderCharacter=u.currentValue),p&&(this._maskService.shownMaskExpression=p.currentValue),f&&(this._maskService.showTemplate=f.currentValue),m&&(this._maskService.clearIfNotMatch=m.currentValue),k&&(this._maskService.validation=k.currentValue),d&&(this._maskService.separatorLimit=d.currentValue),g&&(this._maskService.allowNegativeNumbers=g.currentValue,this._maskService.allowNegativeNumbers&&(this._maskService.maskSpecialCharacters=this._maskService.maskSpecialCharacters.filter((function(e){return"-"!==e})))),this._applyMask()},e.prototype.validate=function(e){var t=e.value;if(!this._maskService.validation||!this._maskValue)return null;if(this._maskService.ipError)return this._createValidationError(t);if(this._maskService.cpfCnpjError)return this._createValidationError(t);if(this._maskValue.startsWith("separator"))return null;if(o.includes(this._maskValue))return null;if(this._maskService.clearIfNotMatch)return null;if(h.includes(this._maskValue))return this._validateTime(t);if(t&&t.toString().length>=1){var i=0,r=function(e){if(s._maskService.maskAvailablePatterns[e].optional&&!0===s._maskService.maskAvailablePatterns[e].optional){if(s._maskValue.indexOf(e)!==s._maskValue.lastIndexOf(e)){var r=s._maskValue.split("").filter((function(t){return t===e})).join("");i+=r.length}else-1!==s._maskValue.indexOf(e)&&i++;if(-1!==s._maskValue.indexOf(e)&&t.toString().length>=s._maskValue.indexOf(e))return{value:null};if(i===s._maskValue.length)return{value:null}}},s=this;for(var a in this._maskService.maskAvailablePatterns){var n=r(a);if("object"==typeof n)return n.value}if(1===this._maskValue.indexOf("{")&&t.toString().length===this._maskValue.length+Number(this._maskValue.split("{")[1].split("}")[0])-4)return null;if(1===this._maskValue.indexOf("*")||1===this._maskValue.indexOf("?"))return null;if(this._maskValue.indexOf("*")>1&&t.toString().length<this._maskValue.indexOf("*")||this._maskValue.indexOf("?")>1&&t.toString().length<this._maskValue.indexOf("?")||1===this._maskValue.indexOf("{"))return this._createValidationError(t);if(-1===this._maskValue.indexOf("*")||-1===this._maskValue.indexOf("?")){var l=this._maskService.dropSpecialCharacters?this._maskValue.length-this._maskService.checkSpecialCharAmount(this._maskValue)-i:this._maskValue.length-i;if(t.toString().length<l)return this._createValidationError(t)}}return null},e.prototype.onInput=function(e){var t=e.target;if(this._inputValue=t.value,this._setMask(),this._maskValue){var i=1===t.selectionStart?t.selectionStart+this._maskService.prefix.length:t.selectionStart,r=0,s=!1;if(this._maskService.applyValueChanges(i,(function(e,t){r=e,s=t})),this.document.activeElement===t){this._position=1===this._position&&1===this._inputValue.length?null:this._position;var a=this._position?this._inputValue.length+i+r:i+("Backspace"!==this._code||s?r:0);a>this._getActualInputLength()&&(a=this._getActualInputLength()),t.setSelectionRange(a,a),this._position=null}}else this.onChange(t.value)},e.prototype.onBlur=function(){this._maskValue&&this._maskService.clearIfNotMatchFn(),this.onTouch()},e.prototype.onFocus=function(e){if(this._maskValue){var t=e.target;null!==t&&null!==t.selectionStart&&t.selectionStart===t.selectionEnd&&t.selectionStart>this._maskService.prefix.length&&38!==e.keyCode&&this._maskService.showMaskTyped&&(this._maskService.maskIsShown=this._maskService.showMaskInInput(),t.setSelectionRange&&this._maskService.prefix+this._maskService.maskIsShown===t.value?(t.focus(),t.setSelectionRange(0,0)):t.selectionStart>this._maskService.actualValue.length&&t.setSelectionRange(this._maskService.actualValue.length,this._maskService.actualValue.length));var i=t.value&&t.value!==this._maskService.prefix?t.value:this._maskService.prefix+this._maskService.maskIsShown;t.value!==i&&(t.value=i),(t.selectionStart||t.selectionEnd)<=this._maskService.prefix.length?t.selectionStart=this._maskService.prefix.length:t.selectionEnd>this._getActualInputLength()&&(t.selectionEnd=this._getActualInputLength())}},e.prototype.onKeyDown=function(e){var t;if(this._maskValue){this._code=e.code?e.code:e.key;var i=e.target;if(this._inputValue=i.value,this._setMask(),38===e.keyCode&&e.preventDefault(),37===e.keyCode||8===e.keyCode||46===e.keyCode){if(8===e.keyCode&&0===i.value.length&&(i.selectionStart=i.selectionEnd),8===e.keyCode&&0!==i.selectionStart)if(this.specialCharacters=(null===(t=this.specialCharacters)||void 0===t?void 0:t.length)?this.specialCharacters:this._config.specialCharacters,this.prefix.length>1&&i.selectionStart<=this.prefix.length)i.setSelectionRange(this.prefix.length,this.prefix.length);else{if(this._inputValue.length!==i.selectionStart&&1!==i.selectionStart)for(;this.specialCharacters.includes(this._inputValue[i.selectionStart-1].toString())&&(this.prefix.length>=1&&i.selectionStart>this.prefix.length||0===this.prefix.length);)i.setSelectionRange(i.selectionStart-1,i.selectionStart-1);this.suffixCheckOnPressDelete(e.keyCode,i)}this.suffixCheckOnPressDelete(e.keyCode,i),this._maskService.prefix.length&&i.selectionStart<=this._maskService.prefix.length&&i.selectionEnd<=this._maskService.prefix.length&&e.preventDefault();var r=i.selectionStart;8!==e.keyCode||i.readOnly||0!==r||i.selectionEnd!==i.value.length||0===i.value.length||(this._position=this._maskService.prefix?this._maskService.prefix.length:0,this._maskService.applyMask(this._maskService.prefix,this._maskService.maskExpression,this._position))}this.suffix&&this.suffix.length>1&&this._inputValue.length-this.suffix.length<i.selectionStart?i.setSelectionRange(this._inputValue.length-this.suffix.length,this._inputValue.length):(65===e.keyCode&&!0===e.ctrlKey||65===e.keyCode&&!0===e.metaKey)&&(i.setSelectionRange(0,this._getActualInputLength()),e.preventDefault()),this._maskService.selStart=i.selectionStart,this._maskService.selEnd=i.selectionEnd}},e.prototype.writeValue=function(e){return u(this,void 0,void 0,(function(){return p(this,(function(t){return void 0===e&&(e=""),"number"==typeof e&&(e=String(e),e="."!==this.decimalMarker?e.replace(".",this.decimalMarker):e,this._maskService.isNumberValue=!0),e&&this._maskService.maskExpression||this._maskService.maskExpression&&(this._maskService.prefix||this._maskService.showMaskTyped)?(this._maskService.writingValue=!0,this._maskService.formElementProperty=["value",this._maskService.applyMask(e,this._maskService.maskExpression)],this._maskService.writingValue=!1):this._maskService.formElementProperty=["value",e],this._inputValue=e,[2]}))}))},e.prototype.registerOnChange=function(e){this.onChange=e,this._maskService.onChange=this.onChange},e.prototype.registerOnTouched=function(e){this.onTouch=e},e.prototype.suffixCheckOnPressDelete=function(e,t){46===e&&this.suffix.length>0&&this._inputValue.length-this.suffix.length<=t.selectionStart&&t.setSelectionRange(this._inputValue.length-this.suffix.length,this._inputValue.length),8===e&&(this.suffix.length>1&&this._inputValue.length-this.suffix.length<t.selectionStart&&t.setSelectionRange(this._inputValue.length-this.suffix.length,this._inputValue.length),1===this.suffix.length&&this._inputValue.length===t.selectionStart&&t.setSelectionRange(t.selectionStart-1,t.selectionStart-1))},e.prototype.setDisabledState=function(e){this._maskService.formElementProperty=["disabled",e]},e.prototype.onModelChange=function(e){e||(this._maskService.actualValue="")},e.prototype._repeatPatternSymbols=function(e){var t=this;return e.match(/{[0-9]+}/)&&e.split("").reduce((function(i,r,s){if(t._start="{"===r?s:t._start,"}"!==r)return t._maskService._findSpecialChar(r)?i+r:i;t._end=s;var a=Number(e.slice(t._start+1,t._end));return i+new Array(a+1).join(e[t._start-1])}),"")||e},e.prototype._applyMask=function(){this._maskService.maskExpression=this._repeatPatternSymbols(this._maskValue||""),this._maskService.formElementProperty=["value",this._maskService.applyMask(this._inputValue,this._maskService.maskExpression)]},e.prototype._validateTime=function(e){var t=this._maskValue.split("").filter((function(e){return":"!==e})).length;return null===e||0===e.length?null:0==+e[e.length-1]&&e.length<t||e.length<=t-2?this._createValidationError(e):null},e.prototype._getActualInputLength=function(){return this._maskService.actualValue.length||this._maskService.actualValue.length+this._maskService.prefix.length},e.prototype._createValidationError=function(e){return{mask:{requiredMask:this._maskValue,actualValue:e}}},e.prototype._setMask=function(){var e=this;this._maskExpressionArray.length>0&&this._maskExpressionArray.some((function(t){var i=e._maskService.removeMask(e._inputValue).length<=e._maskService.removeMask(t).length;if(e._inputValue&&i)return e._maskValue=t,e.maskExpression=t,e._maskService.maskExpression=t,i;e._maskValue=e._maskExpressionArray[e._maskExpressionArray.length-1],e.maskExpression=e._maskExpressionArray[e._maskExpressionArray.length-1],e._maskService.maskExpression=e._maskExpressionArray[e._maskExpressionArray.length-1]}))},e}();d.decorators=[{type:t.Directive,args:[{selector:"input[mask], textarea[mask]",providers:[{provide:i.NG_VALUE_ACCESSOR,useExisting:t.forwardRef((function(){return d})),multi:!0},{provide:i.NG_VALIDATORS,useExisting:t.forwardRef((function(){return d})),multi:!0},k]}]}],d.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[r.DOCUMENT]}]},{type:k},{type:void 0,decorators:[{type:t.Inject,args:[s]}]}]},d.propDecorators={maskExpression:[{type:t.Input,args:["mask"]}],specialCharacters:[{type:t.Input}],patterns:[{type:t.Input}],prefix:[{type:t.Input}],suffix:[{type:t.Input}],thousandSeparator:[{type:t.Input}],decimalMarker:[{type:t.Input}],dropSpecialCharacters:[{type:t.Input}],hiddenInput:[{type:t.Input}],showMaskTyped:[{type:t.Input}],placeHolderCharacter:[{type:t.Input}],shownMaskExpression:[{type:t.Input}],showTemplate:[{type:t.Input}],clearIfNotMatch:[{type:t.Input}],validation:[{type:t.Input}],separatorLimit:[{type:t.Input}],allowNegativeNumbers:[{type:t.Input}],onInput:[{type:t.HostListener,args:["input",["$event"]]}],onBlur:[{type:t.HostListener,args:["blur"]}],onFocus:[{type:t.HostListener,args:["click",["$event"]]}],onKeyDown:[{type:t.HostListener,args:["keydown",["$event"]]}],onModelChange:[{type:t.HostListener,args:["ngModelChange",["$event"]]}]};var g=function(){function e(e){this._maskService=e}return e.prototype.transform=function(e,t,i){return void 0===i&&(i=null),e||"number"==typeof e?(i&&(this._maskService.thousandSeparator=i),"string"==typeof t?this._maskService.applyMask(""+e,t):this._maskService.applyMaskWithPattern(""+e,t)):""},e}();g.decorators=[{type:t.Pipe,args:[{name:"mask",pure:!0}]}],g.ctorParameters=function(){return[{type:m}]};var _=function(){function e(){}return e.forRoot=function(t){return{ngModule:e,providers:[{provide:a,useValue:t},{provide:n,useValue:l},{provide:s,useFactory:v,deps:[n,a]},m]}},e.forChild=function(){return{ngModule:e}},e}();function v(e,t){return t instanceof Function?Object.assign(Object.assign({},e),t()):Object.assign(Object.assign({},e),t)}_.decorators=[{type:t.NgModule,args:[{exports:[d,g],declarations:[d,g]}]}],global.KeyboardEvent||(global.KeyboardEvent=function(e,t){}),e.INITIAL_CONFIG=n,e.MaskApplierService=m,e.MaskDirective=d,e.MaskPipe=g,e.MaskService=k,e.NEW_CONFIG=a,e.NgxMaskModule=_,e._configFactory=v,e.config=s,e.initialConfig=l,e.timeMasks=h,e.withoutValidation=o,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/forms"),require("@angular/common")):"function"==typeof define&&define.amd?define("ngx-mask",["exports","@angular/core","@angular/forms","@angular/common"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["ngx-mask"]={},e.ng.core,e.ng.forms,e.ng.common)}(this,(function(e,t,i,s){"use strict";var r=new t.InjectionToken("config"),a=new t.InjectionToken("NEW_CONFIG"),n=new t.InjectionToken("INITIAL_CONFIG"),l={suffix:"",prefix:"",thousandSeparator:" ",decimalMarker:".",clearIfNotMatch:!1,showTemplate:!1,showMaskTyped:!1,placeHolderCharacter:"_",dropSpecialCharacters:!0,hiddenInput:void 0,shownMaskExpression:"",separatorLimit:"",allowNegativeNumbers:!1,validation:!0,specialCharacters:["-","/","(",")",".",":"," ","+",",","@","[","]",'"',"'"],patterns:{0:{pattern:new RegExp("\\d")},9:{pattern:new RegExp("\\d"),optional:!0},X:{pattern:new RegExp("\\d"),symbol:"*"},A:{pattern:new RegExp("[a-zA-Z0-9]")},S:{pattern:new RegExp("[a-zA-Z]")},d:{pattern:new RegExp("\\d")},m:{pattern:new RegExp("\\d")},M:{pattern:new RegExp("\\d")},H:{pattern:new RegExp("\\d")},h:{pattern:new RegExp("\\d")},s:{pattern:new RegExp("\\d")}}},h=["Hh:m0:s0","Hh:m0","m0:s0"],o=["percent","Hh","s0","m0","separator","d0/M0/0000","d0/M0","d0","M0"],c=function(e,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])})(e,t)};function u(e,t,i,s){return new(i||(i=Promise))((function(r,a){function n(e){try{h(s.next(e))}catch(e){a(e)}}function l(e){try{h(s.throw(e))}catch(e){a(e)}}function h(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(n,l)}h((s=s.apply(e,t||[])).next())}))}function p(e,t){var i,s,r,a,n={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(i)throw new TypeError("Generator is already executing.");for(;n;)try{if(i=1,s&&(r=2&a[0]?s.return:a[0]?s.throw||((r=s.return)&&r.call(s),0):s.next)&&!(r=r.call(s,a[1])).done)return r;switch(s=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return n.label++,{value:a[1],done:!1};case 5:n.label++,s=a[1],a=[0];continue;case 7:a=n.ops.pop(),n.trys.pop();continue;default:if(!(r=n.trys,(r=r.length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){n=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){n.label=a[1];break}if(6===a[0]&&n.label<r[1]){n.label=r[1],r=a;break}if(r&&n.label<r[2]){n.label=r[2],n.ops.push(a);break}r[2]&&n.ops.pop(),n.trys.pop();continue}a=t.call(e,n)}catch(e){a=[6,e],s=0}finally{i=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}Object.create;function f(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var s,r,a=i.call(e),n=[];try{for(;(void 0===t||t-- >0)&&!(s=a.next()).done;)n.push(s.value)}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return n}Object.create;var m=function(){function e(e){var t=this;this._config=e,this.maskExpression="",this.actualValue="",this.shownMaskExpression="",this._formatWithSeparators=function(e,i,s,r){var a=e.split(s),n=a.length>1?""+s+a[1]:"",l=a[0],h=t.separatorLimit.replace(/\s/g,"");h&&+h&&(l="-"===l[0]?"-"+l.slice(1,l.length).slice(0,h.length):l.slice(0,h.length));for(var o=/(\d+)(\d{3})/;i&&o.test(l);)l=l.replace(o,"$1"+i+"$2");return void 0===r?l+n:0===r?l:l+n.substr(0,r+1)},this.percentage=function(e){return Number(e)>=0&&Number(e)<=100},this.getPrecision=function(e){var t=e.split(".");return t.length>1?Number(t[t.length-1]):1/0},this.checkInputPrecision=function(e,i,s){if(i<1/0){var r=new RegExp(t._charToRegExpExpression(s)+"\\d{"+i+"}.*$"),a=e.match(r);if(a&&a[0].length-1>i){var n=a[0].length-1-i;e=e.substring(0,e.length-n)}0===i&&e.endsWith(s)&&(e=e.substring(0,e.length-1))}return e},this._shift=new Set,this.clearIfNotMatch=this._config.clearIfNotMatch,this.dropSpecialCharacters=this._config.dropSpecialCharacters,this.maskSpecialCharacters=this._config.specialCharacters,this.maskAvailablePatterns=this._config.patterns,this.prefix=this._config.prefix,this.suffix=this._config.suffix,this.thousandSeparator=this._config.thousandSeparator,this.decimalMarker=this._config.decimalMarker,this.hiddenInput=this._config.hiddenInput,this.showMaskTyped=this._config.showMaskTyped,this.placeHolderCharacter=this._config.placeHolderCharacter,this.validation=this._config.validation,this.separatorLimit=this._config.separatorLimit,this.allowNegativeNumbers=this._config.allowNegativeNumbers}return e.prototype.applyMaskWithPattern=function(e,t){var i=f(t,2),s=i[0],r=i[1];return this.customPattern=r,this.applyMask(e,s)},e.prototype.applyMask=function(e,t,i,s){if(void 0===i&&(i=0),void 0===s&&(s=function(){}),null==e||void 0===t)return"";var r=0,a="",n=!1,l=!1,h=1,o=!1;e.slice(0,this.prefix.length)===this.prefix&&(e=e.slice(this.prefix.length,e.length)),this.suffix&&e.endsWith(this.suffix)&&(e=e.slice(0,e.length-this.suffix.length));var c=e.toString().split("");"IP"===t&&(this.ipError=!!(c.filter((function(e){return"."===e})).length<3&&c.length<7),t="099.099.099.099");for(var u=[],p=0;p<e.length;p++)e[p].match("\\d")&&u.push(e[p]);if("CPF_CNPJ"===t&&(this.cpfCnpjError=!(11===u.length||14===u.length),t=u.length>11?"00.000.000/0000-00":"000.000.000-00"),t.startsWith("percent")){if(e.match("[a-z]|[A-Z]")||e.match(/[-!$%^&*()_+|~=`{}\[\]:";'<>?,\/.]/)){e=this._stripToDecimal(e);var f=this.getPrecision(t);e=this.checkInputPrecision(e,f,this.decimalMarker)}if(e.indexOf(".")>0&&!this.percentage(e.substring(0,e.indexOf(".")))){var m=e.substring(0,e.indexOf(".")-1);e=""+m+e.substring(e.indexOf("."),e.length)}a=this.percentage(e)?e:e.substring(0,e.length-1)}else if(t.startsWith("separator")){(e.match("[wа-яА-Я]")||e.match("[ЁёА-я]")||e.match("[a-z]|[A-Z]")||e.match(/[-@#!$%\\^&*()_£¬'+|~=`{}\[\]:";<>.?\/]/)||e.match("[^A-Za-z0-9,]"))&&(e=this._stripToDecimal(e)),e=e.length>1&&"0"===e[0]&&e[1]!==this.decimalMarker?e.slice(1,e.length):e;var d=this._charToRegExpExpression(this.thousandSeparator),k=this._charToRegExpExpression(this.decimalMarker),g='@#!$%^&*()_+|~=`{}\\[\\]:\\s,\\.";<>?\\/'.replace(d,"").replace(k,""),_=new RegExp("["+g+"]");e.match(_)&&(e=e.substring(0,e.length-1));f=this.getPrecision(t);var v=(e=this.checkInputPrecision(e,f,this.decimalMarker)).replace(new RegExp(d,"g"),""),S=(a=this._formatWithSeparators(v,this.thousandSeparator,this.decimalMarker,f)).indexOf(",")-e.indexOf(",");if((C=a.length-e.length)>0&&","!==a[i]){l=!0;var y=0;do{this._shift.add(i+y),y++}while(y<C)}else 0!==S&&i>0&&!(a.indexOf(",")>=i&&i>3)||!(a.indexOf(".")>=i&&i>3)&&C<=0?(this._shift.clear(),l=!0,h=C,i+=C,this._shift.add(i)):this._shift.clear()}else{p=0;for(var x=c[0];p<c.length&&r!==t.length;x=c[++p])if(this._checkSymbolMask(x,t[r])&&"?"===t[r+1])a+=x,r+=2;else if("*"===t[r+1]&&n&&this._checkSymbolMask(x,t[r+2]))a+=x,r+=3,n=!1;else if(this._checkSymbolMask(x,t[r])&&"*"===t[r+1])a+=x,n=!0;else if("?"===t[r+1]&&this._checkSymbolMask(x,t[r+2]))a+=x,r+=3;else if(this._checkSymbolMask(x,t[r])||this.hiddenInput&&this.maskAvailablePatterns[t[r]]&&this.maskAvailablePatterns[t[r]].symbol===x){if("H"===t[r]&&Number(x)>2){r+=1;var C=/[*?]/g.test(t.slice(0,r))?c.length:r;this._shift.add(C+this.prefix.length||0),p--;continue}if("h"===t[r]&&"2"===a&&Number(x)>3){r+=1,p--;continue}if("m"===t[r]&&Number(x)>5){r+=1;C=/[*?]/g.test(t.slice(0,r))?c.length:r;this._shift.add(C+this.prefix.length||0),p--;continue}if("s"===t[r]&&Number(x)>5){r+=1;C=/[*?]/g.test(t.slice(0,r))?c.length:r;this._shift.add(C+this.prefix.length||0),p--;continue}if("d"===t[r]&&(Number(e.slice(r,r+2))>31||"/"===e[r+1])){r+=1;C=/[*?]/g.test(t.slice(0,r))?c.length:r;this._shift.add(C+this.prefix.length||0),p--;continue}if("M"===t[r]){var E=12,b=0===r&&(Number(x)>2||Number(e.slice(r,r+2))>E||"/"===e[r+1]),M=e.slice(r-3,r-1).includes("/")&&("/"===e[r-2]&&Number(e.slice(r-1,r+1))>E&&"/"!==e[r]||"/"===e[r]||"/"===e[r-3]&&Number(e.slice(r-2,r))>E&&"/"!==e[r-1]||"/"===e[r-1]),V=Number(e.slice(r-3,r-1))<=31&&!e.slice(r-3,r-1).includes("/")&&"/"===e[r-1]&&(Number(e.slice(r,r+2))>E||"/"===e[r+1]),w=Number(e.slice(r-3,r-1))>31&&!e.slice(r-3,r-1).includes("/")&&!e.slice(r-2,r).includes("/")&&Number(e.slice(r-2,r))>E,I=Number(e.slice(r-3,r-1))<=31&&!e.slice(r-3,r-1).includes("/")&&"/"!==e[r-1]&&Number(e.slice(r-1,r+1))>E;if(b||M||V||w||I){r+=1;C=/[*?]/g.test(t.slice(0,r))?c.length:r;this._shift.add(C+this.prefix.length||0),p--;continue}}a+=x,r++}else if(-1!==this.maskSpecialCharacters.indexOf(t[r])){a+=t[r],r++;C=/[*?]/g.test(t.slice(0,r))?c.length:r;this._shift.add(C+this.prefix.length||0),p--}else this.maskSpecialCharacters.indexOf(x)>-1&&this.maskAvailablePatterns[t[r]]&&this.maskAvailablePatterns[t[r]].optional?(c[r]&&"099.099.099.099"!==t&&"000.000.000-00"!==t&&"00.000.000/0000-00"!==t&&(a+=c[r]),r++,p--):"*"===this.maskExpression[r+1]&&this._findSpecialChar(this.maskExpression[r+2])&&this._findSpecialChar(x)===this.maskExpression[r+2]&&n||"?"===this.maskExpression[r+1]&&this._findSpecialChar(this.maskExpression[r+2])&&this._findSpecialChar(x)===this.maskExpression[r+2]&&n?(r+=3,a+=x):this.showMaskTyped&&this.maskSpecialCharacters.indexOf(x)<0&&x!==this.placeHolderCharacter&&(o=!0)}a.length+1===t.length&&-1!==this.maskSpecialCharacters.indexOf(t[t.length-1])&&(a+=t[t.length-1]);for(var N=i+1;this._shift.has(N);)h++,N++;var P=this._shift.has(i)?h:0;o&&P--,s(P,l),h<0&&this._shift.clear();var A=""+this.prefix+a+this.suffix;return 0===a.length&&(A=""+this.prefix+a),A},e.prototype._findSpecialChar=function(e){return this.maskSpecialCharacters.find((function(t){return t===e}))},e.prototype._checkSymbolMask=function(e,t){return this.maskAvailablePatterns=this.customPattern?this.customPattern:this.maskAvailablePatterns,this.maskAvailablePatterns[t]&&this.maskAvailablePatterns[t].pattern&&this.maskAvailablePatterns[t].pattern.test(e)},e.prototype._stripToDecimal=function(e){var t=this;return e.split("").filter((function(e,i){return e.match("^-?\\d")||e.match("\\s")||"."===e||","===e||"-"===e&&0===i&&t.allowNegativeNumbers})).join("")},e.prototype._charToRegExpExpression=function(e){if(e){return" "===e?"\\s":"[\\^$.|?*+()".indexOf(e)>=0?"\\"+e:e}return e},e}();m.decorators=[{type:t.Injectable}],m.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[r]}]}]};var d=function(e){function t(t,i,s,r){var a=e.call(this,i)||this;return a.document=t,a._config=i,a._elementRef=s,a._renderer=r,a.maskExpression="",a.isNumberValue=!1,a.placeHolderCharacter="_",a.maskIsShown="",a.selStart=null,a.selEnd=null,a.writingValue=!1,a.onChange=function(e){},a._formElement=a._elementRef.nativeElement,a}return function(e,t){function i(){this.constructor=e}c(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}(t,e),t.prototype.applyMask=function(t,i,s,r){var a=this;if(void 0===s&&(s=0),void 0===r&&(r=function(){}),!i)return t;if(this.maskIsShown=this.showMaskTyped?this.showMaskInInput():"","IP"===this.maskExpression&&this.showMaskTyped&&(this.maskIsShown=this.showMaskInInput(t||"#")),"CPF_CNPJ"===this.maskExpression&&this.showMaskTyped&&(this.maskIsShown=this.showMaskInInput(t||"#")),!t&&this.showMaskTyped)return this.formControlResult(this.prefix),this.prefix+this.maskIsShown;var n=t&&"number"==typeof this.selStart?t[this.selStart]:"",l="";if(void 0!==this.hiddenInput){var h=this.actualValue.split("");""!==t&&h.length?"number"==typeof this.selStart&&"number"==typeof this.selEnd&&(t.length>h.length?h.splice(this.selStart,0,n):t.length<h.length&&(h.length-t.length==1?h.splice(this.selStart-1,1):h.splice(this.selStart,this.selEnd-this.selStart))):h=[],l=this.actualValue.length?this.shiftTypedSymbols(h.join("")):t}l=Boolean(l)&&l.length?l:t;var o=e.prototype.applyMask.call(this,l,i,s,r);if(this.actualValue=this.getActualValue(o),"."===this.thousandSeparator&&"."===this.decimalMarker&&(this.decimalMarker=","),this.maskExpression.startsWith("separator")&&!0===this.dropSpecialCharacters&&(this.maskSpecialCharacters=this.maskSpecialCharacters.filter((function(e){return e!==a.decimalMarker}))),this.formControlResult(o),!this.showMaskTyped)return this.hiddenInput&&o&&o.length?this.hideInput(o,this.maskExpression):o;var c=o.length,u=this.prefix+this.maskIsShown;if(this.maskExpression.includes("H")){var p=this._numberSkipedSymbols(o);return o+u.slice(c+p)}return"IP"===this.maskExpression||"CPF_CNPJ"===this.maskExpression?o+u:o+u.slice(c)},t.prototype._numberSkipedSymbols=function(e){for(var t=/(^|\D)(\d\D)/g,i=t.exec(e),s=0;null!=i;)s+=1,i=t.exec(e);return s},t.prototype.applyValueChanges=function(e,t){void 0===e&&(e=0),void 0===t&&(t=function(){}),this._formElement.value=this.applyMask(this._formElement.value,this.maskExpression,e,t),this._formElement!==this.document.activeElement&&this.clearIfNotMatchFn()},t.prototype.hideInput=function(e,t){var i=this;return e.split("").map((function(e,s){return i.maskAvailablePatterns&&i.maskAvailablePatterns[t[s]]&&i.maskAvailablePatterns[t[s]].symbol?i.maskAvailablePatterns[t[s]].symbol:e})).join("")},t.prototype.getActualValue=function(e){var t=this,i=e.split("").filter((function(e,i){return t._checkSymbolMask(e,t.maskExpression[i])||t.maskSpecialCharacters.includes(t.maskExpression[i])&&e===t.maskExpression[i]}));return i.join("")===e?i.join(""):e},t.prototype.shiftTypedSymbols=function(e){var t=this,i="";return(e&&e.split("").map((function(s,r){if(t.maskSpecialCharacters.includes(e[r+1])&&e[r+1]!==t.maskExpression[r+1])return i=s,e[r+1];if(i.length){var a=i;return i="",a}return s}))||[]).join("")},t.prototype.showMaskInInput=function(e){if(this.showMaskTyped&&this.shownMaskExpression){if(this.maskExpression.length!==this.shownMaskExpression.length)throw new Error("Mask expression must match mask placeholder length");return this.shownMaskExpression}if(this.showMaskTyped){if(e){if("IP"===this.maskExpression)return this._checkForIp(e);if("CPF_CNPJ"===this.maskExpression)return this._checkForCpfCnpj(e)}return this.maskExpression.replace(/\w/g,this.placeHolderCharacter)}return""},t.prototype.clearIfNotMatchFn=function(){this.clearIfNotMatch&&this.prefix.length+this.maskExpression.length+this.suffix.length!==this._formElement.value.replace(/_/g,"").length&&(this.formElementProperty=["value",""],this.applyMask(this._formElement.value,this.maskExpression))},Object.defineProperty(t.prototype,"formElementProperty",{set:function(e){var t=f(e,2),i=t[0],s=t[1];this._renderer.setProperty(this._formElement,i,s)},enumerable:!1,configurable:!0}),t.prototype.checkSpecialCharAmount=function(e){var t=this;return e.split("").filter((function(e){return t._findSpecialChar(e)})).length},t.prototype.removeMask=function(e){return this._removeMask(this._removeSuffix(this._removePrefix(e)),this.maskSpecialCharacters.concat("_").concat(this.placeHolderCharacter))},t.prototype._checkForIp=function(e){if("#"===e)return this.placeHolderCharacter+"."+this.placeHolderCharacter+"."+this.placeHolderCharacter+"."+this.placeHolderCharacter;for(var t=[],i=0;i<e.length;i++)e[i].match("\\d")&&t.push(e[i]);return t.length<=3?this.placeHolderCharacter+"."+this.placeHolderCharacter+"."+this.placeHolderCharacter:t.length>3&&t.length<=6?this.placeHolderCharacter+"."+this.placeHolderCharacter:t.length>6&&t.length<=9?this.placeHolderCharacter:(t.length>9&&t.length,"")},t.prototype._checkForCpfCnpj=function(e){var t=""+this.placeHolderCharacter+this.placeHolderCharacter+this.placeHolderCharacter+"."+this.placeHolderCharacter+this.placeHolderCharacter+this.placeHolderCharacter+"."+this.placeHolderCharacter+this.placeHolderCharacter+this.placeHolderCharacter+"-"+this.placeHolderCharacter+this.placeHolderCharacter,i=""+this.placeHolderCharacter+this.placeHolderCharacter+"."+this.placeHolderCharacter+this.placeHolderCharacter+this.placeHolderCharacter+"."+this.placeHolderCharacter+this.placeHolderCharacter+this.placeHolderCharacter+"/"+this.placeHolderCharacter+this.placeHolderCharacter+this.placeHolderCharacter+this.placeHolderCharacter+"-"+this.placeHolderCharacter+this.placeHolderCharacter;if("#"===e)return t;for(var s=[],r=0;r<e.length;r++)e[r].match("\\d")&&s.push(e[r]);return s.length<=3?t.slice(s.length,t.length):s.length>3&&s.length<=6?t.slice(s.length+1,t.length):s.length>6&&s.length<=9?t.slice(s.length+2,t.length):s.length>9&&s.length<11?t.slice(s.length+3,t.length):11===s.length?"":12===s.length?17===e.length?i.slice(16,i.length):i.slice(15,i.length):s.length>12&&s.length<=14?i.slice(s.length+4,i.length):""},t.prototype.formControlResult=function(e){this.writingValue||(Array.isArray(this.dropSpecialCharacters)?this.onChange(this._removeMask(this._removeSuffix(this._removePrefix(e)),this.dropSpecialCharacters)):this.dropSpecialCharacters?this.onChange(this._checkSymbols(e)):this.onChange(this._removeSuffix(this._removePrefix(e))))},t.prototype._removeMask=function(e,t){return e?e.replace(this._regExpForRemove(t),""):e},t.prototype._removePrefix=function(e){return this.prefix&&e?e.replace(this.prefix,""):e},t.prototype._removeSuffix=function(e){return this.suffix&&e?e.replace(this.suffix,""):e},t.prototype._retrieveSeparatorValue=function(e){return this._removeMask(this._removeSuffix(this._removePrefix(e)),this.maskSpecialCharacters)},t.prototype._regExpForRemove=function(e){return new RegExp(e.map((function(e){return"\\"+e})).join("|"),"gi")},t.prototype._checkSymbols=function(e){if(""===e)return e;var t=this._retrieveSeparatorPrecision(this.maskExpression),i=this._retrieveSeparatorValue(e);return"."!==this.decimalMarker&&(i=i.replace(this.decimalMarker,".")),this.isNumberValue?t?e===this.decimalMarker?null:this._checkPrecision(this.maskExpression,i):Number(i):i},t.prototype._retrieveSeparatorPrecision=function(e){var t=e.match(new RegExp("^separator\\.([^d]*)"));return t?Number(t[1]):null},t.prototype._checkPrecision=function(e,t){return e.indexOf("2")>0?Number(t).toFixed(2):Number(t)},t}(m);d.decorators=[{type:t.Injectable}],d.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[s.DOCUMENT]}]},{type:void 0,decorators:[{type:t.Inject,args:[r]}]},{type:t.ElementRef},{type:t.Renderer2}]};var k=function(){function e(e,t,i){this.document=e,this._maskService=t,this._config=i,this.maskExpression="",this.specialCharacters=[],this.patterns={},this.prefix="",this.suffix="",this.thousandSeparator=" ",this.decimalMarker=".",this.dropSpecialCharacters=null,this.hiddenInput=null,this.showMaskTyped=null,this.placeHolderCharacter=null,this.shownMaskExpression=null,this.showTemplate=null,this.clearIfNotMatch=null,this.validation=null,this.separatorLimit=null,this.allowNegativeNumbers=null,this._maskValue="",this._position=null,this._maskExpressionArray=[],this.onChange=function(e){},this.onTouch=function(){}}return e.prototype.ngOnChanges=function(e){var t=e.maskExpression,i=e.specialCharacters,s=e.patterns,r=e.prefix,a=e.suffix,n=e.thousandSeparator,l=e.decimalMarker,h=e.dropSpecialCharacters,o=e.hiddenInput,c=e.showMaskTyped,u=e.placeHolderCharacter,p=e.shownMaskExpression,f=e.showTemplate,m=e.clearIfNotMatch,d=e.validation,k=e.separatorLimit,g=e.allowNegativeNumbers;if(t&&(this._maskValue=t.currentValue||"",t.currentValue&&t.currentValue.split("||").length>1&&(this._maskExpressionArray=t.currentValue.split("||").sort((function(e,t){return e.length-t.length})),this._maskValue=this._maskExpressionArray[0],this.maskExpression=this._maskExpressionArray[0],this._maskService.maskExpression=this._maskExpressionArray[0])),i){if(!i.currentValue||!Array.isArray(i.currentValue))return;this._maskService.maskSpecialCharacters=i.currentValue||[]}s&&s.currentValue&&(this._maskService.maskAvailablePatterns=s.currentValue),r&&(this._maskService.prefix=r.currentValue),a&&(this._maskService.suffix=a.currentValue),n&&(this._maskService.thousandSeparator=n.currentValue),l&&(this._maskService.decimalMarker=l.currentValue),h&&(this._maskService.dropSpecialCharacters=h.currentValue),o&&(this._maskService.hiddenInput=o.currentValue),c&&(this._maskService.showMaskTyped=c.currentValue),u&&(this._maskService.placeHolderCharacter=u.currentValue),p&&(this._maskService.shownMaskExpression=p.currentValue),f&&(this._maskService.showTemplate=f.currentValue),m&&(this._maskService.clearIfNotMatch=m.currentValue),d&&(this._maskService.validation=d.currentValue),k&&(this._maskService.separatorLimit=k.currentValue),g&&(this._maskService.allowNegativeNumbers=g.currentValue,this._maskService.allowNegativeNumbers&&(this._maskService.maskSpecialCharacters=this._maskService.maskSpecialCharacters.filter((function(e){return"-"!==e})))),this._applyMask()},e.prototype.validate=function(e){var t=e.value;if(!this._maskService.validation||!this._maskValue)return null;if(this._maskService.ipError)return this._createValidationError(t);if(this._maskService.cpfCnpjError)return this._createValidationError(t);if(this._maskValue.startsWith("separator"))return null;if(o.includes(this._maskValue))return null;if(this._maskService.clearIfNotMatch)return null;if(h.includes(this._maskValue))return this._validateTime(t);if(t&&t.toString().length>=1){var i=0,s=function(e){if(r._maskService.maskAvailablePatterns[e].optional&&!0===r._maskService.maskAvailablePatterns[e].optional){if(r._maskValue.indexOf(e)!==r._maskValue.lastIndexOf(e)){var s=r._maskValue.split("").filter((function(t){return t===e})).join("");i+=s.length}else-1!==r._maskValue.indexOf(e)&&i++;if(-1!==r._maskValue.indexOf(e)&&t.toString().length>=r._maskValue.indexOf(e))return{value:null};if(i===r._maskValue.length)return{value:null}}},r=this;for(var a in this._maskService.maskAvailablePatterns){var n=s(a);if("object"==typeof n)return n.value}if(1===this._maskValue.indexOf("{")&&t.toString().length===this._maskValue.length+Number(this._maskValue.split("{")[1].split("}")[0])-4)return null;if(1===this._maskValue.indexOf("*")||1===this._maskValue.indexOf("?"))return null;if(this._maskValue.indexOf("*")>1&&t.toString().length<this._maskValue.indexOf("*")||this._maskValue.indexOf("?")>1&&t.toString().length<this._maskValue.indexOf("?")||1===this._maskValue.indexOf("{"))return this._createValidationError(t);if(-1===this._maskValue.indexOf("*")||-1===this._maskValue.indexOf("?")){var l=this._maskService.dropSpecialCharacters?this._maskValue.length-this._maskService.checkSpecialCharAmount(this._maskValue)-i:this._maskValue.length-i;if(t.toString().length<l)return this._createValidationError(t)}}return null},e.prototype.onInput=function(e){var t=e.target;if(this._inputValue=t.value,this._setMask(),this._maskValue){var i=1===t.selectionStart?t.selectionStart+this._maskService.prefix.length:t.selectionStart,s=0,r=!1;if(this._maskService.applyValueChanges(i,(function(e,t){s=e,r=t})),this.document.activeElement===t){this._position=1===this._position&&1===this._inputValue.length?null:this._position;var a=this._position?this._inputValue.length+i+s:i+("Backspace"!==this._code||r?s:0);a>this._getActualInputLength()&&(a=this._getActualInputLength()),t.setSelectionRange(a,a),this._position=null}}else this.onChange(t.value)},e.prototype.onBlur=function(){this._maskValue&&this._maskService.clearIfNotMatchFn(),this.onTouch()},e.prototype.onFocus=function(e){if(this._maskValue){var t=e.target;null!==t&&null!==t.selectionStart&&t.selectionStart===t.selectionEnd&&t.selectionStart>this._maskService.prefix.length&&38!==e.keyCode&&this._maskService.showMaskTyped&&(this._maskService.maskIsShown=this._maskService.showMaskInInput(),t.setSelectionRange&&this._maskService.prefix+this._maskService.maskIsShown===t.value?(t.focus(),t.setSelectionRange(0,0)):t.selectionStart>this._maskService.actualValue.length&&t.setSelectionRange(this._maskService.actualValue.length,this._maskService.actualValue.length));var i=t.value&&t.value!==this._maskService.prefix?t.value:this._maskService.prefix+this._maskService.maskIsShown;t.value!==i&&(t.value=i),(t.selectionStart||t.selectionEnd)<=this._maskService.prefix.length?t.selectionStart=this._maskService.prefix.length:t.selectionEnd>this._getActualInputLength()&&(t.selectionEnd=this._getActualInputLength())}},e.prototype.onKeyDown=function(e){var t;if(this._maskValue){this._code=e.code?e.code:e.key;var i=e.target;if(this._inputValue=i.value,this._setMask(),38===e.keyCode&&e.preventDefault(),37===e.keyCode||8===e.keyCode||46===e.keyCode){if(8===e.keyCode&&0===i.value.length&&(i.selectionStart=i.selectionEnd),8===e.keyCode&&0!==i.selectionStart)if(this.specialCharacters=(null===(t=this.specialCharacters)||void 0===t?void 0:t.length)?this.specialCharacters:this._config.specialCharacters,this.prefix.length>1&&i.selectionStart<=this.prefix.length)i.setSelectionRange(this.prefix.length,this.prefix.length);else{if(this._inputValue.length!==i.selectionStart&&1!==i.selectionStart)for(;this.specialCharacters.includes(this._inputValue[i.selectionStart-1].toString())&&(this.prefix.length>=1&&i.selectionStart>this.prefix.length||0===this.prefix.length);)i.setSelectionRange(i.selectionStart-1,i.selectionStart-1);this.suffixCheckOnPressDelete(e.keyCode,i)}this.suffixCheckOnPressDelete(e.keyCode,i),this._maskService.prefix.length&&i.selectionStart<=this._maskService.prefix.length&&i.selectionEnd<=this._maskService.prefix.length&&e.preventDefault();var s=i.selectionStart;8!==e.keyCode||i.readOnly||0!==s||i.selectionEnd!==i.value.length||0===i.value.length||(this._position=this._maskService.prefix?this._maskService.prefix.length:0,this._maskService.applyMask(this._maskService.prefix,this._maskService.maskExpression,this._position))}this.suffix&&this.suffix.length>1&&this._inputValue.length-this.suffix.length<i.selectionStart?i.setSelectionRange(this._inputValue.length-this.suffix.length,this._inputValue.length):(65===e.keyCode&&!0===e.ctrlKey||65===e.keyCode&&!0===e.metaKey)&&(i.setSelectionRange(0,this._getActualInputLength()),e.preventDefault()),this._maskService.selStart=i.selectionStart,this._maskService.selEnd=i.selectionEnd}},e.prototype.writeValue=function(e){return u(this,void 0,void 0,(function(){return p(this,(function(t){return void 0===e&&(e=""),"number"==typeof e&&(e=String(e),e="."!==this.decimalMarker?e.replace(".",this.decimalMarker):e,this._maskService.isNumberValue=!0),e&&this._maskService.maskExpression||this._maskService.maskExpression&&(this._maskService.prefix||this._maskService.showMaskTyped)?(this._maskService.writingValue=!0,this._maskService.formElementProperty=["value",this._maskService.applyMask(e,this._maskService.maskExpression)],this._maskService.writingValue=!1):this._maskService.formElementProperty=["value",e],this._inputValue=e,[2]}))}))},e.prototype.registerOnChange=function(e){this.onChange=e,this._maskService.onChange=this.onChange},e.prototype.registerOnTouched=function(e){this.onTouch=e},e.prototype.suffixCheckOnPressDelete=function(e,t){46===e&&this.suffix.length>0&&this._inputValue.length-this.suffix.length<=t.selectionStart&&t.setSelectionRange(this._inputValue.length-this.suffix.length,this._inputValue.length),8===e&&(this.suffix.length>1&&this._inputValue.length-this.suffix.length<t.selectionStart&&t.setSelectionRange(this._inputValue.length-this.suffix.length,this._inputValue.length),1===this.suffix.length&&this._inputValue.length===t.selectionStart&&t.setSelectionRange(t.selectionStart-1,t.selectionStart-1))},e.prototype.setDisabledState=function(e){this._maskService.formElementProperty=["disabled",e]},e.prototype.onModelChange=function(e){e||(this._maskService.actualValue="")},e.prototype._repeatPatternSymbols=function(e){var t=this;return e.match(/{[0-9]+}/)&&e.split("").reduce((function(i,s,r){if(t._start="{"===s?r:t._start,"}"!==s)return t._maskService._findSpecialChar(s)?i+s:i;t._end=r;var a=Number(e.slice(t._start+1,t._end));return i+new Array(a+1).join(e[t._start-1])}),"")||e},e.prototype._applyMask=function(){this._maskService.maskExpression=this._repeatPatternSymbols(this._maskValue||""),this._maskService.formElementProperty=["value",this._maskService.applyMask(this._inputValue,this._maskService.maskExpression)]},e.prototype._validateTime=function(e){var t=this._maskValue.split("").filter((function(e){return":"!==e})).length;return null===e||0===e.length?null:0==+e[e.length-1]&&e.length<t||e.length<=t-2?this._createValidationError(e):null},e.prototype._getActualInputLength=function(){return this._maskService.actualValue.length||this._maskService.actualValue.length+this._maskService.prefix.length},e.prototype._createValidationError=function(e){return{mask:{requiredMask:this._maskValue,actualValue:e}}},e.prototype._setMask=function(){var e=this;this._maskExpressionArray.length>0&&this._maskExpressionArray.some((function(t){var i=e._maskService.removeMask(e._inputValue).length<=e._maskService.removeMask(t).length;if(e._inputValue&&i)return e._maskValue=t,e.maskExpression=t,e._maskService.maskExpression=t,i;e._maskValue=e._maskExpressionArray[e._maskExpressionArray.length-1],e.maskExpression=e._maskExpressionArray[e._maskExpressionArray.length-1],e._maskService.maskExpression=e._maskExpressionArray[e._maskExpressionArray.length-1]}))},e}();k.decorators=[{type:t.Directive,args:[{selector:"input[mask], textarea[mask]",providers:[{provide:i.NG_VALUE_ACCESSOR,useExisting:t.forwardRef((function(){return k})),multi:!0},{provide:i.NG_VALIDATORS,useExisting:t.forwardRef((function(){return k})),multi:!0},d]}]}],k.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[s.DOCUMENT]}]},{type:d},{type:void 0,decorators:[{type:t.Inject,args:[r]}]}]},k.propDecorators={maskExpression:[{type:t.Input,args:["mask"]}],specialCharacters:[{type:t.Input}],patterns:[{type:t.Input}],prefix:[{type:t.Input}],suffix:[{type:t.Input}],thousandSeparator:[{type:t.Input}],decimalMarker:[{type:t.Input}],dropSpecialCharacters:[{type:t.Input}],hiddenInput:[{type:t.Input}],showMaskTyped:[{type:t.Input}],placeHolderCharacter:[{type:t.Input}],shownMaskExpression:[{type:t.Input}],showTemplate:[{type:t.Input}],clearIfNotMatch:[{type:t.Input}],validation:[{type:t.Input}],separatorLimit:[{type:t.Input}],allowNegativeNumbers:[{type:t.Input}],onInput:[{type:t.HostListener,args:["input",["$event"]]}],onBlur:[{type:t.HostListener,args:["blur"]}],onFocus:[{type:t.HostListener,args:["click",["$event"]]}],onKeyDown:[{type:t.HostListener,args:["keydown",["$event"]]}],onModelChange:[{type:t.HostListener,args:["ngModelChange",["$event"]]}]};var g=function(){function e(e){this._maskService=e}return e.prototype.transform=function(e,t,i){return void 0===i&&(i=null),e||"number"==typeof e?(i&&(this._maskService.thousandSeparator=i),"string"==typeof t?this._maskService.applyMask(""+e,t):this._maskService.applyMaskWithPattern(""+e,t)):""},e}();g.decorators=[{type:t.Pipe,args:[{name:"mask",pure:!0}]}],g.ctorParameters=function(){return[{type:m}]};var _=function(){function e(){}return e.forRoot=function(t){return{ngModule:e,providers:[{provide:a,useValue:t},{provide:n,useValue:l},{provide:r,useFactory:v,deps:[n,a]},m]}},e.forChild=function(){return{ngModule:e}},e}();function v(e,t){return t instanceof Function?Object.assign(Object.assign({},e),t()):Object.assign(Object.assign({},e),t)}_.decorators=[{type:t.NgModule,args:[{exports:[k,g],declarations:[k,g]}]}];var S="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};S.KeyboardEvent||(S.KeyboardEvent=function(e,t){}),e.INITIAL_CONFIG=n,e.MaskApplierService=m,e.MaskDirective=k,e.MaskPipe=g,e.MaskService=d,e.NEW_CONFIG=a,e.NgxMaskModule=_,e._configFactory=v,e.config=r,e.initialConfig=l,e.timeMasks=h,e.withoutValidation=o,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=ngx-mask.umd.min.js.map |
@@ -0,7 +1,12 @@ | ||
const commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : | ||
typeof window !== 'undefined' ? window : | ||
typeof global !== 'undefined' ? global : | ||
typeof self !== 'undefined' ? self : | ||
{}; | ||
(function () { | ||
if (!global.KeyboardEvent) { | ||
global.KeyboardEvent = function (_eventType, _init) { }; | ||
if (!commonjsGlobal.KeyboardEvent) { | ||
commonjsGlobal.KeyboardEvent = function (_eventType, _init) { }; | ||
} | ||
})(); | ||
export {}; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3VzdG9tLWtleWJvYXJkLWV2ZW50LmpzIiwic291cmNlUm9vdCI6Ii9Vc2Vycy9pZ29ybmVwaXBlbmtvL3dvcmsvb3RoZXIvbmd4LW1hc2svcHJvamVjdHMvbmd4LW1hc2stbGliL3NyYy8iLCJzb3VyY2VzIjpbImxpYi9jdXN0b20ta2V5Ym9hcmQtZXZlbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBR0EsQ0FBQztJQUNDLElBQUksQ0FBQyxNQUFNLENBQUMsYUFBYSxFQUFFO1FBQ3pCLE1BQU0sQ0FBQyxhQUFhLEdBQUcsVUFBVSxVQUFlLEVBQUUsS0FBVSxJQUFHLENBQUMsQ0FBQztLQUNsRTtBQUNILENBQUMsQ0FBQyxFQUFFLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvLyB0c2xpbnQ6ZGlzYWJsZTogbm8tYW55IHR5cGVkZWZcbmRlY2xhcmUgdmFyIGdsb2JhbDogYW55O1xuXG4oZnVuY3Rpb24gKCkge1xuICBpZiAoIWdsb2JhbC5LZXlib2FyZEV2ZW50KSB7XG4gICAgZ2xvYmFsLktleWJvYXJkRXZlbnQgPSBmdW5jdGlvbiAoX2V2ZW50VHlwZTogYW55LCBfaW5pdDogYW55KSB7fTtcbiAgfVxufSkoKTtcblxuZXhwb3J0IHR5cGUgQ3VzdG9tS2V5Ym9hcmRFdmVudCA9IEtleWJvYXJkRXZlbnQ7XG4iXX0= | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3VzdG9tLWtleWJvYXJkLWV2ZW50LmpzIiwic291cmNlUm9vdCI6Ii9Vc2Vycy9pZ29ybmVwaXBlbmtvL3dvcmsvb3RoZXIvbmd4LW1hc2svcHJvamVjdHMvbmd4LW1hc2stbGliL3NyYy8iLCJzb3VyY2VzIjpbImxpYi9jdXN0b20ta2V5Ym9hcmQtZXZlbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBR0EsTUFBTSxjQUFjLEdBQ2hCLE9BQU8sVUFBVSxLQUFLLFdBQVcsQ0FBQyxDQUFDLENBQUMsVUFBVSxDQUFDLENBQUM7SUFDNUMsT0FBTyxNQUFNLEtBQUssV0FBVyxDQUFDLENBQUMsQ0FBQyxNQUFNLENBQUMsQ0FBQztRQUNwQyxPQUFPLE1BQU0sS0FBSyxXQUFXLENBQUMsQ0FBQyxDQUFDLE1BQU0sQ0FBQyxDQUFDO1lBQ3BDLE9BQU8sSUFBSSxLQUFLLFdBQVcsQ0FBQyxDQUFDLENBQUMsSUFBSSxDQUFDLENBQUM7Z0JBQ2hDLEVBQUUsQ0FBQztBQUV2QixDQUFDO0lBQ0csSUFBSSxDQUFDLGNBQWMsQ0FBQyxhQUFhLEVBQUU7UUFDL0IsY0FBYyxDQUFDLGFBQWEsR0FBRyxVQUFTLFVBQWUsRUFBRSxLQUFVLElBQUksQ0FBQyxDQUFDO0tBQzVFO0FBQ0wsQ0FBQyxDQUFDLEVBQUUsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8vIHRzbGludDpkaXNhYmxlOiBuby1hbnkgdHlwZWRlZlxuZGVjbGFyZSB2YXIgZ2xvYmFsOiBhbnk7XG5cbmNvbnN0IGNvbW1vbmpzR2xvYmFsID1cbiAgICB0eXBlb2YgZ2xvYmFsVGhpcyAhPT0gJ3VuZGVmaW5lZCcgPyBnbG9iYWxUaGlzIDpcbiAgICAgICAgdHlwZW9mIHdpbmRvdyAhPT0gJ3VuZGVmaW5lZCcgPyB3aW5kb3cgOlxuICAgICAgICAgICAgdHlwZW9mIGdsb2JhbCAhPT0gJ3VuZGVmaW5lZCcgPyBnbG9iYWwgOlxuICAgICAgICAgICAgICAgIHR5cGVvZiBzZWxmICE9PSAndW5kZWZpbmVkJyA/IHNlbGYgOlxuICAgICAgICAgICAgICAgICAgICB7fTtcblxuKGZ1bmN0aW9uKCkge1xuICAgIGlmICghY29tbW9uanNHbG9iYWwuS2V5Ym9hcmRFdmVudCkge1xuICAgICAgICBjb21tb25qc0dsb2JhbC5LZXlib2FyZEV2ZW50ID0gZnVuY3Rpb24oX2V2ZW50VHlwZTogYW55LCBfaW5pdDogYW55KSB7IH07XG4gICAgfVxufSkoKTtcblxuZXhwb3J0IHR5cGUgQ3VzdG9tS2V5Ym9hcmRFdmVudCA9IEtleWJvYXJkRXZlbnQ7XG4iXX0= |
@@ -1372,5 +1372,10 @@ import { InjectionToken, Injectable, Inject, ElementRef, Renderer2, Directive, forwardRef, Input, HostListener, Pipe, NgModule } from '@angular/core'; | ||
const commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : | ||
typeof window !== 'undefined' ? window : | ||
typeof global !== 'undefined' ? global : | ||
typeof self !== 'undefined' ? self : | ||
{}; | ||
(function () { | ||
if (!global.KeyboardEvent) { | ||
global.KeyboardEvent = function (_eventType, _init) { }; | ||
if (!commonjsGlobal.KeyboardEvent) { | ||
commonjsGlobal.KeyboardEvent = function (_eventType, _init) { }; | ||
} | ||
@@ -1377,0 +1382,0 @@ })(); |
{ | ||
"name": "ngx-mask", | ||
"version": "10.0.3", | ||
"version": "10.0.4", | ||
"description": "awesome ngx mask", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
777802
4848
0