import{a as ie,c as ce}from"./chunk-UGQXGBKF.js";import{E as le,a as Z}from"./chunk-TCUK52QT.js";import{a as ee,c as pe}from"./chunk-DCQJQBJ7.js";import{d as X,da as te,e as ue,i as Y,j as he,na as de}from"./chunk-VYRWAFSM.js";import{Ha as W,I as T,Ia as b,L as J,La as oe,xa as re}from"./chunk-2XIOYYFS.js";import{D as G,F as M,K as H,m as Q,p as z,s as U,t as $}from"./chunk-UOI75ONS.js";import{Ab as d,Ac as D,Cc as v,Gc as _,Hc as f,Ja as o,Ka as u,Kd as r,Ld as j,Na as I,Qb as F,Qc as V,Rb as N,Rc as L,Rd as O,Sc as w,Ta as h,Tc as y,Ub as R,Wb as c,ic as g,jc as p,jd as K,nc as A,ra as B,sa as P,ta as x,wc as k,xc as C,ya as S,zc as q}from"./chunk-4HFZZ7HS.js";import{e as ae}from"./chunk-SZAW6ZBW.js";function ge(s,m){if(s&1){let t=v();k(0,"TimesIcon",5),_("click",function(){o(t);let e=f(2);return u(e.clear())}),C()}s&2&&(p("styleClass","p-inputmask-clear-icon"),g("data-pc-section","clearIcon"))}function ke(s,m){}function Ce(s,m){s&1&&c(0,ke,0,0,"ng-template")}function ve(s,m){if(s&1){let t=v();k(0,"span",6),_("click",function(){o(t);let e=f(2);return u(e.clear())}),c(1,Ce,1,0,null,7),C()}if(s&2){let t=f(2);g("data-pc-section","clearIcon"),d(),p("ngTemplateOutlet",t.clearIconTemplate||t._clearIconTemplate)}}function _e(s,m){if(s&1&&(q(0),c(1,ge,1,2,"TimesIcon",3)(2,ve,2,2,"span",4),D()),s&2){let t=f();d(),p("ngIf",!t.clearIconTemplate&&!t._clearIconTemplate),d(),p("ngIf",t.clearIconTemplate||t._clearIconTemplate)}}var fe,me,we,ye,ne,be,se,He,Ie=ae(()=>{H();H();O();O();le();re();oe();pe();he();de();ce();ue();fe=["clearicon"],me=["input"];we=({dt:s})=>`
p-inputmask {
    position: relative;
}

.p-inputmask-clear-icon {
    position: absolute;
    top: 50%;
    margin-top: -0.5rem;
    cursor: pointer;
    inset-inline-end: ${s("form.field.padding.x")};
    color: ${s("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: ${s("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: ${s("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: ${s("inputtext.invalid.placeholder.color")};
}
`,ye={root:({instance:s})=>({"p-inputmask":!0,"p-filled":s.variant?s.variant==="filled":s.config.inputStyle()==="filled"})},ne=(()=>{class s extends X{name="inputmask";theme=we;classes=ye;static \u0275fac=(()=>{let t;return function(e){return(t||(t=I(s)))(e||s)}})();static \u0275prov=P({token:s,factory:s.\u0275fac})}return s})(),be={provide:Z,useExisting:B(()=>se),multi:!0},se=(()=>{class s 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 h;onFocus=new h;onBlur=new h;onInput=new h;onKeydown=new h;onClear=new h;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=S(ne);ngOnInit(){if(super.ngOnInit(),M(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,a;if(!(!this.inputViewChild?.nativeElement.offsetParent||this.inputViewChild.nativeElement!==this.inputViewChild.nativeElement.ownerDocument.activeElement))if(typeof t=="number")n=t,a=typeof i=="number"?i:n,this.inputViewChild.nativeElement.setSelectionRange?this.inputViewChild.nativeElement.setSelectionRange(n,a):this.inputViewChild.nativeElement.createTextRange&&(e=this.inputViewChild.nativeElement.createTextRange(),e.collapse(!0),e.moveEnd("character",a),e.moveStart("character",n),e.select());else return this.inputViewChild.nativeElement.setSelectionRange?(n=this.inputViewChild.nativeElement.selectionStart,a=this.inputViewChild.nativeElement.selectionEnd):this.document&&this.document.selection.createRange&&(e=this.document.createRange(),n=0-e.duplicate().moveStart("character",-1e5),a=n+e.text.length),{begin:n,end:a}}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,a;for(i=t,e=this.getPlaceholder(t);i<this.len;i++)if(this.tests[i])if(n=this.seekNext(i),a=this.buffer[i],this.buffer[i]=e,n<this.len&&this.tests[n].test(a))e=a;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,a,l;M(this.platformId)&&(l=/iphone/i.test(T())),this.oldVal=this.inputViewChild?.nativeElement.value,this.onKeydown.emit(t),i===8||i===46||l&&i===127?(e=this.caret(),n=e.begin,a=e.end,a-n===0&&(n=i!==46?this.seekPrev(n):a=this.seekNext(n-1),a=i===46?this.seekNext(a):a),this.clearBuffer(n,a),this.keepBuffer?this.shiftL(n,a-2):this.shiftL(n,a-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,a,l,E;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&&(a=String.fromCharCode(i),this.tests[n].test(a)&&(this.shiftR(n),this.buffer[n]=a,this.writeBuffer(),l=this.seekNext(n),J()&&/android/i.test(T())?setTimeout(()=>{this.caret(l)},0):this.caret(l),e.begin<=this.lastRequiredNonMaskPos&&(E=this.isCompleted()),this.onInput.emit(t))),t.preventDefault()),this.updateModel(t),this.updateFilledState(),E&&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,a,l;for(n=0,l=0;n<this.len;n++)if(this.tests[n]){for(this.buffer[n]=this.getPlaceholder(n);l++<i.length;)if(a=i.charAt(l-1),this.tests[n].test(a)){this.keepBuffer||(this.buffer[n]=a),e=n;break}if(l>i.length){this.clearBuffer(n+1,this.len);break}}else this.buffer[n]===i.charAt(l)&&l++,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()}static \u0275fac=(()=>{let t;return function(e){return(t||(t=I(s)))(e||s)}})();static \u0275cmp=F({type:s,selectors:[["p-inputmask"],["p-inputMask"],["p-input-mask"]],contentQueries:function(i,e,n){if(i&1&&(V(n,fe,4),V(n,W,4)),i&2){let a;w(a=y())&&(e.clearIconTemplate=a.first),w(a=y())&&(e.templates=a)}},viewQuery:function(i,e){if(i&1&&L(me,7),i&2){let n;w(n=y())&&(e.inputViewChild=n.first)}},inputs:{type:"type",slotChar:"slotChar",autoClear:[2,"autoClear","autoClear",r],showClear:[2,"showClear","showClear",r],style:"style",inputId:"inputId",styleClass:"styleClass",placeholder:"placeholder",size:"size",maxlength:[2,"maxlength","maxlength",j],tabindex:"tabindex",title:"title",variant:"variant",ariaLabel:"ariaLabel",ariaLabelledBy:"ariaLabelledBy",ariaRequired:[2,"ariaRequired","ariaRequired",r],disabled:[2,"disabled","disabled",r],readonly:[2,"readonly","readonly",r],unmask:[2,"unmask","unmask",r],name:"name",required:[2,"required","required",r],characterPattern:"characterPattern",autofocus:[2,"autofocus","autofocus",r],autoFocus:[2,"autoFocus","autoFocus",r],autocomplete:"autocomplete",keepBuffer:[2,"keepBuffer","keepBuffer",r],mask:"mask"},outputs:{onComplete:"onComplete",onFocus:"onFocus",onBlur:"onBlur",onInput:"onInput",onKeydown:"onKeydown",onClear:"onClear"},features:[K([be,ne]),R],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=v();k(0,"input",1,0),_("focus",function(l){return o(n),u(e.onInputFocus(l))})("blur",function(l){return o(n),u(e.onInputBlur(l))})("keydown",function(l){return o(n),u(e.onInputKeydown(l))})("keypress",function(l){return o(n),u(e.onKeyPress(l))})("input",function(l){return o(n),u(e.onInputChange(l))})("paste",function(l){return o(n),u(e.handleInputChange(l))}),C(),c(2,_e,3,2,"ng-container",2)}i&2&&(A(e.styleClass),p("ngClass",e.inputClass)("ngStyle",e.style)("pSize",e.size)("disabled",e.disabled)("readonly",e.readonly)("variant",e.variant)("pAutoFocus",e.autofocus),g("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"),d(2),p("ngIf",e.value!=null&&e.filled&&e.showClear&&!e.disabled))},dependencies:[G,Q,z,$,U,ie,ee,te,b],encapsulation:2,changeDetection:0})}return s})(),He=(()=>{class s{static \u0275fac=function(i){return new(i||s)};static \u0275mod=N({type:s});static \u0275inj=x({imports:[se,b,b]})}return s})()});export{se as a,He as b,Ie as c};
