import{cH as x,i as P,cI as I,cJ as F,cK as N,cL as z,s as V,cM as S,o as M,d as O,bp as T,b as j,cN as C,cO as k,z as A,p as u,cP as E}from"./stepForm-f8dd96bd.js";var R=x(P({__name:"PhoneInput",props:I({style:{type:[Boolean,null,String,Object,Array]},class:{type:[Boolean,null,String,Object,Array]},placeholder:{},label:{},topLabel:{},assistiveText:{},color:{},type:{},required:{type:Boolean},disabled:{type:Boolean},readonly:{type:Boolean},id:{},error:{type:Boolean},success:{type:Boolean},warning:{type:Boolean},hint:{},inputClasses:{},border:{type:Boolean},inputmode:{},size:{},debounce:{type:[Boolean,Number]},autoFocus:{type:Boolean},borderActive:{type:Boolean},leftIcon:{type:[String,Function,Object]},rightIcon:{type:[String,Function,Object]},roundedSize:{},block:{type:Boolean},name:{},autocomplete:{},loading:{type:Boolean},locales:{},example:{type:Boolean},hasRadius:{type:Boolean},autoFormat:{type:[String,Boolean]}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e,{expose:c}){let{getPhoneNumberExample:m,getAsYouTypeFormat:p,loadExamples:b}=k(),{sanitizePhoneNumber:y}=E(),{results:o,selectedCountry:s}=F("mazInputPhoneNumberData"),n=N(e,"modelValue"),t=A(!1),v=u(()=>{let l=o.value.isValid?o.value.formatNational:n.value;return p(s.value,l)||l}),d=u({get:()=>!t.value&&e.autoFormat==="blur"||e.autoFormat==="typing"?v.value:n.value,set:l=>{n.value=y(l)}}),{t:h}=z();function f(l){let a=m(l);if(a)return e.locales.example?e.locales.example.replace("{example}",a):h("inputPhoneNumber.phoneInput.example",{example:a})}let i=u(()=>{if(e.label||e.placeholder)return e.label||e.placeholder;let l=e.locales.placeholder;if(!e.example||!t.value)return l;{let a=f(s.value);return o.value?.isValid||!a?l:a}}),B=u(()=>e.placeholder?{placeholder:i.value}:{label:i.value});V(()=>{e.example&&b()});let g=S("input");return c({focus:()=>{g.value?.$el.querySelector("input")?.focus()}}),(l,a)=>(M(),O(C,T({id:e.id},{...l.$attrs,...B.value},{ref:"input",modelValue:d.value,"onUpdate:modelValue":a[0]||=r=>d.value=r,disabled:e.disabled,color:e.color,error:e.error,size:e.size,success:e.success,block:"",name:e.name,inputmode:e.inputmode,autocomplete:e.autocomplete,class:["m-phone-input",[{"--border-radius":e.hasRadius,"--error":e.error||!j(o).isValid,"--focused":t.value}]],onFocus:a[1]||=r=>t.value=!0,onBlur:a[2]||=r=>t.value=!1}),null,16,["id","modelValue","disabled","color","error","size","success","name","inputmode","autocomplete","class"]))}}),[["__scopeId","data-v-3c3b2d61"]]);export{R as default};
