import{a as X,d as Y,f as ee,i as te,k as ie}from"./chunk-6ZSPPAUO.js";import{a as Z}from"./chunk-Y4WF5HJS.js";import{$c as E,Aa as m,Ba as c,Bb as C,Bg as J,Eb as T,Fb as K,Fc as u,Gb as b,Gc as Q,Hb as I,Ka as R,La as A,Oa as q,Oc as z,Pb as j,Qa as g,Qc as U,Rc as $,Sc as G,X as x,Y as S,Ya as k,Z as F,Zc as H,aa as N,cc as O,eb as f,fa as h,fb as v,ga as p,gb as w,jh as W,kh as V,lb as D,mb as L,pa as M,rb as y,zb as _,zg as B}from"./chunk-R4Z6ZI3L.js";import{i as d}from"./chunk-P6NJDXIL.js";var ae=["clearicon"],le=["input"];function re(a,l){if(a&1){let o=y();v(0,"TimesIcon",5),_("click",function(){h(o);let i=C(2);return p(i.clear())}),w()}a&2&&(f("styleClass","p-inputmask-clear-icon"),k("data-pc-section","clearIcon"))}function oe(a,l){}function ue(a,l){a&1&&g(0,oe,0,0,"ng-template")}function he(a,l){if(a&1){let o=y();v(0,"span",6),_("click",function(){h(o);let i=C(2);return p(i.clear())}),g(1,ue,1,0,null,7),w()}if(a&2){let o=C(2);k("data-pc-section","clearIcon"),m(),f("ngTemplateOutlet",o.clearIconTemplate||o._clearIconTemplate)}}function pe(a,l){if(a&1&&(D(0),g(1,re,1,2,"TimesIcon",3)(2,he,2,2,"span",4),L()),a&2){let o=C();m(),f("ngIf",!o.clearIconTemplate&&!o._clearIconTemplate),m(),f("ngIf",o.clearIconTemplate||o._clearIconTemplate)}}var de=({dt:a})=>`
p-inputmask {
    position: relative;
}

.p-inputmask-clear-icon {
    position: absolute;
    top: 50%;
    margin-top: -0.5rem;
    cursor: pointer;
    inset-inline-end: ${a("form.field.padding.x")};
    color: ${a("form.field.icon.color")};
}

p-inputMask.ng-invalid.ng-dirty > .p-inputtext,
p-input-mask.ng-invalid.ng-dirty > .p-inputtext,
p-inputmask.ng-invalid.ng-dirty > .p-inputtext {
    border-color: ${a("inputtext.invalid.border.color")};
}

p-inputMask.ng-invalid.ng-dirty > .p-inputtext:enabled:focus,
p-input-mask.ng-invalid.ng-dirty > .p-inputtext:enabled:focus,
p-inputmask.ng-invalid.ng-dirty > .p-inputtext:enabled:focus {
    border-color: ${a("inputtext.focus.border.color")};
}

p-inputMask.ng-invalid.ng-dirty > .p-inputtext::placeholder,
p-input-mask.ng-invalid.ng-dirty > .p-inputtext::placeholder,
p-inputmask.ng-invalid.ng-dirty > .p-inputtext::placeholder {
    color: ${a("inputtext.invalid.placeholder.color")};
}
`,ce={root:({instance:a})=>({"p-inputmask":!0,"p-filled":a.variant?a.variant==="filled":a.config.inputStyle()==="filled"})},ne=(()=>{let l=class l extends X{name="inputmask";theme=de;classes=ce};d(l,"\u0275fac",(()=>{let t;return function(e){return(t||(t=M(l)))(e||l)}})()),d(l,"\u0275prov",S({token:l,factory:l.\u0275fac}));let a=l;return a})();var fe={provide:Z,useExisting:x(()=>se),multi:!0},se=(()=>{let l=class l extends Y{type="text";slotChar="_";autoClear=!0;showClear=!1;style;inputId;styleClass;placeholder;size;maxlength;tabindex;title;variant;ariaLabel;ariaLabelledBy;ariaRequired;disabled;readonly;unmask;name;required;characterPattern="[A-Za-z]";autofocus;set autoFocus(t){this.autofocus=t,console.log("autoFocus is deprecated. Use autofocus property instead.")}autocomplete;keepBuffer=!1;get mask(){return this._mask}set mask(t){this._mask=t,this.initMask(),this.writeValue(""),this.onModelChange(this.value)}onComplete=new c;onFocus=new c;onBlur=new c;onInput=new c;onKeydown=new c;onClear=new c;clearIconTemplate;templates;inputViewChild;value;_mask;onModelChange=()=>{};onModelTouched=()=>{};input;filled;defs;tests;partialPosition;firstNonMaskPos;lastRequiredNonMaskPos;len;oldVal;buffer;defaultBuffer;focusText;caretTimeoutId;androidChrome=!0;focused;get inputClass(){return this._componentStyle.classes.root({instance:this})}_componentStyle=N(ne);ngOnInit(){if(super.ngOnInit(),E(this.platformId)){let t=navigator.userAgent;this.androidChrome=/chrome/i.test(t)&&/android/i.test(t)}this.initMask()}_clearIconTemplate;ngAfterContentInit(){this.templates.forEach(t=>{switch(t.getType()){case"clearicon":this._clearIconTemplate=t.template;break}})}initMask(){this.tests=[],this.partialPosition=this.mask.length,this.len=this.mask.length,this.firstNonMaskPos=null,this.defs={9:"[0-9]",a:this.characterPattern,"*":`${this.characterPattern}|[0-9]`};let t=this.mask.split("");for(let i=0;i<t.length;i++){let e=t[i];e=="?"?(this.len--,this.partialPosition=i):this.defs[e]?(this.tests.push(new RegExp(this.defs[e])),this.firstNonMaskPos===null&&(this.firstNonMaskPos=this.tests.length-1),i<this.partialPosition&&(this.lastRequiredNonMaskPos=this.tests.length-1)):this.tests.push(null)}this.buffer=[];for(let i=0;i<t.length;i++){let e=t[i];e!="?"&&(this.defs[e]?this.buffer.push(this.getPlaceholder(i)):this.buffer.push(e))}this.defaultBuffer=this.buffer.join("")}writeValue(t){this.value=t,this.inputViewChild&&this.inputViewChild.nativeElement&&(this.value==null||this.value==null?this.inputViewChild.nativeElement.value="":this.inputViewChild.nativeElement.value=this.value,this.checkVal(),this.focusText=this.inputViewChild.nativeElement.value,this.updateFilledState())}registerOnChange(t){this.onModelChange=t}registerOnTouched(t){this.onModelTouched=t}setDisabledState(t){this.disabled=t,this.cd.markForCheck()}caret(t,i){let e,n,s;if(!(!this.inputViewChild?.nativeElement.offsetParent||this.inputViewChild.nativeElement!==this.inputViewChild.nativeElement.ownerDocument.activeElement))if(typeof t=="number")n=t,s=typeof i=="number"?i:n,this.inputViewChild.nativeElement.setSelectionRange?this.inputViewChild.nativeElement.setSelectionRange(n,s):this.inputViewChild.nativeElement.createTextRange&&(e=this.inputViewChild.nativeElement.createTextRange(),e.collapse(!0),e.moveEnd("character",s),e.moveStart("character",n),e.select());else return this.inputViewChild.nativeElement.setSelectionRange?(n=this.inputViewChild.nativeElement.selectionStart,s=this.inputViewChild.nativeElement.selectionEnd):this.document&&this.document.selection.createRange&&(e=this.document.createRange(),n=0-e.duplicate().moveStart("character",-1e5),s=n+e.text.length),{begin:n,end:s}}isCompleted(){let t;for(let i=this.firstNonMaskPos;i<=this.lastRequiredNonMaskPos;i++)if(this.tests[i]&&this.buffer[i]===this.getPlaceholder(i))return!1;return!0}getPlaceholder(t){return t<this.slotChar.length?this.slotChar.charAt(t):this.slotChar.charAt(0)}seekNext(t){for(;++t<this.len&&!this.tests[t];);return t}seekPrev(t){for(;--t>=0&&!this.tests[t];);return t}shiftL(t,i){let e,n;if(!(t<0)){for(e=t,n=this.seekNext(i);e<this.len;e++)if(this.tests[e]){if(n<this.len&&this.tests[e].test(this.buffer[n]))this.buffer[e]=this.buffer[n],this.buffer[n]=this.getPlaceholder(n);else break;n=this.seekNext(n)}this.writeBuffer(),this.caret(Math.max(this.firstNonMaskPos,t))}}shiftR(t){let i,e,n,s;for(i=t,e=this.getPlaceholder(t);i<this.len;i++)if(this.tests[i])if(n=this.seekNext(i),s=this.buffer[i],this.buffer[i]=e,n<this.len&&this.tests[n].test(s))e=s;else break}handleAndroidInput(t){var i=this.inputViewChild?.nativeElement.value,e=this.caret();if(this.oldVal&&this.oldVal.length&&this.oldVal.length>i.length){for(this.checkVal(!0);e.begin>0&&!this.tests[e.begin-1];)e.begin--;if(e.begin===0)for(;e.begin<this.firstNonMaskPos&&!this.tests[e.begin];)e.begin++;setTimeout(()=>{this.caret(e.begin,e.begin),this.updateModel(t),this.isCompleted()&&this.onComplete.emit()},0)}else{for(this.checkVal(!0);e.begin<this.len&&!this.tests[e.begin];)e.begin++;setTimeout(()=>{this.caret(e.begin,e.begin),this.updateModel(t),this.isCompleted()&&this.onComplete.emit()},0)}}onInputBlur(t){if(this.focused=!1,this.onModelTouched(),this.keepBuffer||this.checkVal(),this.updateFilledState(),this.onBlur.emit(t),this.inputViewChild?.nativeElement.value!=this.focusText||this.inputViewChild?.nativeElement.value!=this.value){this.updateModel(t);let i=this.document.createEvent("HTMLEvents");i.initEvent("change",!0,!1),this.inputViewChild?.nativeElement.dispatchEvent(i)}}onInputKeydown(t){if(this.readonly)return;let i=t.which||t.keyCode,e,n,s,r;E(this.platformId)&&(r=/iphone/i.test(B())),this.oldVal=this.inputViewChild?.nativeElement.value,this.onKeydown.emit(t),i===8||i===46||r&&i===127?(e=this.caret(),n=e.begin,s=e.end,s-n===0&&(n=i!==46?this.seekPrev(n):s=this.seekNext(n-1),s=i===46?this.seekNext(s):s),this.clearBuffer(n,s),this.keepBuffer?this.shiftL(n,s-2):this.shiftL(n,s-1),this.updateModel(t),this.onInput.emit(t),t.preventDefault()):i===13?(this.onInputBlur(t),this.updateModel(t)):i===27&&(this.inputViewChild.nativeElement.value=this.focusText,this.caret(0,this.checkVal()),this.updateModel(t),t.preventDefault())}onKeyPress(t){if(!this.readonly){var i=t.which||t.keyCode,e=this.caret(),n,s,r,P;t.ctrlKey||t.altKey||t.metaKey||i<32||i>34&&i<41||(i&&i!==13&&(e.end-e.begin!==0&&(this.clearBuffer(e.begin,e.end),this.shiftL(e.begin,e.end-1)),n=this.seekNext(e.begin-1),n<this.len&&(s=String.fromCharCode(i),this.tests[n].test(s)&&(this.shiftR(n),this.buffer[n]=s,this.writeBuffer(),r=this.seekNext(n),J()&&/android/i.test(B())?setTimeout(()=>{this.caret(r)},0):this.caret(r),e.begin<=this.lastRequiredNonMaskPos&&(P=this.isCompleted()),this.onInput.emit(t))),t.preventDefault()),this.updateModel(t),this.updateFilledState(),P&&this.onComplete.emit())}}clearBuffer(t,i){if(!this.keepBuffer){let e;for(e=t;e<i&&e<this.len;e++)this.tests[e]&&(this.buffer[e]=this.getPlaceholder(e))}}writeBuffer(){this.inputViewChild.nativeElement.value=this.buffer.join("")}checkVal(t){let i=this.inputViewChild?.nativeElement.value,e=-1,n,s,r;for(n=0,r=0;n<this.len;n++)if(this.tests[n]){for(this.buffer[n]=this.getPlaceholder(n);r++<i.length;)if(s=i.charAt(r-1),this.tests[n].test(s)){this.keepBuffer||(this.buffer[n]=s),e=n;break}if(r>i.length){this.clearBuffer(n+1,this.len);break}}else this.buffer[n]===i.charAt(r)&&r++,n<this.partialPosition&&(e=n);return t?this.writeBuffer():e+1<this.partialPosition?this.autoClear||this.buffer.join("")===this.defaultBuffer?(this.inputViewChild?.nativeElement.value&&(this.inputViewChild.nativeElement.value=""),this.clearBuffer(0,this.len)):this.writeBuffer():(this.writeBuffer(),this.inputViewChild.nativeElement.value=this.inputViewChild?.nativeElement.value.substring(0,e+1)),this.partialPosition?n:this.firstNonMaskPos}onInputFocus(t){if(this.readonly)return;this.focused=!0,clearTimeout(this.caretTimeoutId);let i;this.focusText=this.inputViewChild?.nativeElement.value,i=this.keepBuffer?this.inputViewChild?.nativeElement.value.length:this.checkVal(),this.caretTimeoutId=setTimeout(()=>{this.inputViewChild?.nativeElement===this.inputViewChild?.nativeElement.ownerDocument.activeElement&&(this.writeBuffer(),i==this.mask?.replace("?","").length?this.caret(0,i):this.caret(i))},10),this.onFocus.emit(t)}onInputChange(t){this.androidChrome?this.handleAndroidInput(t):this.handleInputChange(t),this.onInput.emit(t)}handleInputChange(t){this.readonly||setTimeout(()=>{var i=this.checkVal(!0);this.caret(i),this.updateModel(t),this.isCompleted()&&this.onComplete.emit()},0)}getUnmaskedValue(){let t=[];for(let i=0;i<this.buffer.length;i++){let e=this.buffer[i];this.tests[i]&&e!=this.getPlaceholder(i)&&t.push(e)}return t.join("")}updateModel(t){let i=this.unmask?this.getUnmaskedValue():t.target.value;(i!==null||i!==void 0)&&(this.value=i,this.onModelChange(this.value))}updateFilledState(){this.filled=this.inputViewChild?.nativeElement&&this.inputViewChild.nativeElement.value!="",this.cd.markForCheck()}focus(){this.inputViewChild?.nativeElement.focus()}clear(){this.inputViewChild.nativeElement.value="",this.value=null,this.onModelChange(this.value),this.onClear.emit()}};d(l,"\u0275fac",(()=>{let t;return function(e){return(t||(t=M(l)))(e||l)}})()),d(l,"\u0275cmp",R({type:l,selectors:[["p-inputmask"],["p-inputMask"],["p-input-mask"]],contentQueries:function(i,e,n){if(i&1&&(T(n,ae,4),T(n,W,4)),i&2){let s;b(s=I())&&(e.clearIconTemplate=s.first),b(s=I())&&(e.templates=s)}},viewQuery:function(i,e){if(i&1&&K(le,7),i&2){let n;b(n=I())&&(e.inputViewChild=n.first)}},inputs:{type:"type",slotChar:"slotChar",autoClear:[2,"autoClear","autoClear",u],showClear:[2,"showClear","showClear",u],style:"style",inputId:"inputId",styleClass:"styleClass",placeholder:"placeholder",size:"size",maxlength:[2,"maxlength","maxlength",Q],tabindex:"tabindex",title:"title",variant:"variant",ariaLabel:"ariaLabel",ariaLabelledBy:"ariaLabelledBy",ariaRequired:[2,"ariaRequired","ariaRequired",u],disabled:[2,"disabled","disabled",u],readonly:[2,"readonly","readonly",u],unmask:[2,"unmask","unmask",u],name:"name",required:[2,"required","required",u],characterPattern:"characterPattern",autofocus:[2,"autofocus","autofocus",u],autoFocus:[2,"autoFocus","autoFocus",u],autocomplete:"autocomplete",keepBuffer:[2,"keepBuffer","keepBuffer",u],mask:"mask"},outputs:{onComplete:"onComplete",onFocus:"onFocus",onBlur:"onBlur",onInput:"onInput",onKeydown:"onKeydown",onClear:"onClear"},features:[O([fe,ne]),q],decls:3,vars:24,consts:[["input",""],["pInputText","",3,"focus","blur","keydown","keypress","input","paste","ngClass","ngStyle","pSize","disabled","readonly","variant","pAutoFocus"],[4,"ngIf"],[3,"styleClass","click",4,"ngIf"],["class","p-inputmask-clear-icon",3,"click",4,"ngIf"],[3,"click","styleClass"],[1,"p-inputmask-clear-icon",3,"click"],[4,"ngTemplateOutlet"]],template:function(i,e){if(i&1){let n=y();v(0,"input",1,0),_("focus",function(r){return h(n),p(e.onInputFocus(r))})("blur",function(r){return h(n),p(e.onInputBlur(r))})("keydown",function(r){return h(n),p(e.onInputKeydown(r))})("keypress",function(r){return h(n),p(e.onKeyPress(r))})("input",function(r){return h(n),p(e.onInputChange(r))})("paste",function(r){return h(n),p(e.handleInputChange(r))}),w(),g(2,pe,3,2,"ng-container",2)}i&2&&(j(e.styleClass),f("ngClass",e.inputClass)("ngStyle",e.style)("pSize",e.size)("disabled",e.disabled)("readonly",e.readonly)("variant",e.variant)("pAutoFocus",e.autofocus),k("id",e.inputId)("type",e.type)("name",e.name)("placeholder",e.placeholder)("title",e.title)("autocomplete",e.autocomplete)("maxlength",e.maxlength)("tabindex",e.tabindex)("aria-label",e.ariaLabel)("aria-labelledBy",e.ariaLabelledBy)("aria-required",e.ariaRequired)("required",e.required)("data-pc-name","inputmask")("data-pc-section","root"),m(2),f("ngIf",e.value!=null&&e.filled&&e.showClear&&!e.disabled))},dependencies:[H,z,U,G,$,ie,te,ee,V],encapsulation:2,changeDetection:0}));let a=l;return a})(),De=(()=>{let l=class l{};d(l,"\u0275fac",function(i){return new(i||l)}),d(l,"\u0275mod",A({type:l})),d(l,"\u0275inj",F({imports:[se,V,V]}));let a=l;return a})();export{se as a,De as b};
/**i18n:138e9aba5923606215625ab5641fbdc103d8a34cfe13ae910386f40f27aea675*/
//# sourceMappingURL=chunk-TGJYSDH6.js.map
