"use strict";(globalThis["webpackChunk_[name]"]=globalThis["webpackChunk_[name]"]||[]).push([[215],{215(e,t,o){o.r(t),o.d(t,{default:()=>C});var n=o(609),u=o(428),r=o.n(u);var s=o(38);const a=!0===window?.elementorFrontend?.isEditMode(),l=function(e){if("fulfilled"===e.status)return e.value;throw"rejected"===e.status?e.reason:("pending"===e.status||(e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t})),e)},i=new Map,c="hulk_affef_telephone_utils",d=new Map,f="hulk_affef_telephone_geoIpLookup";const h=function(){return d.has(f)||d.set(f,async function(){return async function(){const e=await fetch("https://ipapi.co/json");if(!e.ok)throw e;const t=await e.json();return t?.country_code||""}().then(e=>e).catch(()=>async function(){const e=await fetch("https://get.geojs.io/v1/ip/country.json");if(!e.ok)throw e;const t=await e.json();return t?.country||""}()).then(e=>e).catch(()=>"us")}()),d.get(f)};var p=o(790);const C=e=>{const t=(0,n.useRef)(null),u=(0,n.useRef)(null),[d,f]=(0,n.useState)(e.value),[C,y]=(0,n.useState)(!1),[m,w]=(0,n.useState)(null),[_,g]=(0,n.useState)("");!function(e,t,o){(0,n.useEffect)(()=>{if(!e.current)return;const o=r()(e.current).closest(".elementor-form");return o.on("submit_success.hulk_affef",t),()=>{o.off("submit_success.hulk_affef",t)}},o)}(t,()=>{f(e.value)},[e.value]);const k=l((i.has(c)||i.set(c,async function(){return(await o.e(183).then(o.bind(o,183))).default}()),i.get(c))),b=(0,n.useMemo)(()=>e.autoCountry?l(h()):"",[e.autoCountry]),j=(0,n.useCallback)(t=>e.autoCountry&&b?t(b):null,[b,e.autoCountry]),M=(0,n.useMemo)(()=>e.autoCountry?e.excludeCountries.filter(e=>e.toLowerCase()!==b.toLowerCase()):e.excludeCountries,[b,e.autoCountry,e.excludeCountries]),v=(0,n.useMemo)(()=>(e.autoCountry&&e.onlyCountries.length>0&&(e.onlyCountries.some(e=>e.toLowerCase()===b.toLowerCase())||e.onlyCountries.push(b)),e.onlyCountries),[b,e.autoCountry,e.onlyCountries]),x=(0,n.useRef)(null);return(0,n.useEffect)(()=>{e.fullPhone&&(0,n.startTransition)(()=>{x.current||(x.current=u.current?.getInstance()),x.current&&g(x.current.getNumber())})},[e.fullPhone,d]),(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(s.A,{ref:u,initialValue:d,onChangeNumber:f,onChangeValidity:y,onChangeErrorCode:w,inputProps:{...e.attrs,id:`${e.attrs.id}-telephone`},initOptions:{initialCountry:e.autoCountry?"auto":e.initialCountry,strictMode:e.strictMode,countryOrder:e.countryOrder,excludeCountries:M,onlyCountries:v,nationalMode:e.nationalMode,showFlags:e.showFlags,separateDialCode:e.separateDialCode,countrySearch:!0,allowDropdown:!0,fixDropdownWidth:!0,allowedNumberTypes:["MOBILE"],placeholderNumberType:"MOBILE",dropdownContainer:document.querySelector("body"),...e.placeholder&&{customPlaceholder:t=>e.placeholder.replace("{{country}}",t)},...a&&{useFullscreenPopup:!1},...e.autoCountry&&b&&{geoIpLookup:j},loadUtils:()=>Promise.resolve({default:k}),containerClass:"hulk-telephone"}}),(0,p.jsx)("input",{ref:t,type:"hidden",name:`form_fields[${e.custom_id}_fullPhone]`,defaultValue:_}),(0,p.jsx)("input",{type:"hidden",name:`form_fields[${e.custom_id}_isValid]`,defaultValue:String(C)}),(0,p.jsx)("input",{type:"hidden",name:`form_fields[${e.custom_id}_errorCode]`,defaultValue:m||0}),(0,p.jsx)("div",{id:e.attrs.id})]})}}}]);