import{cL as x,i as P,cM as I,cN as F,cO as N,cP as V,v as z,cQ as S,o as M,d as T,bu as O,b as j,cR as A,cS as C,A as R,q as u,cT as k}from"./stepForm-ea4a5b69.js";var L=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}=C(),{sanitizePhoneNumber:y}=k(),{results:o,selectedCountry:s}=F("mazInputPhoneNumberData"),n=N(e,"modelValue"),t=R(!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}=V();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});z(()=>{e.example&&b()});let g=S("input");return c({focus:()=>{g.value?.$el.querySelector("input")?.focus()}}),(l,a)=>(M(),T(A,O({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{L as default};
