{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/2PXAP9mknCJz7SQHcGUE/l2J4EfxWHaT5zbFNUkKQ/InitializePhoneInput.js"],
  "sourcesContent": ["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect}from\"react\";import{addPropertyControls,ControlType}from\"framer\";const intlTelInputCss=\"https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.8/css/intlTelInput.css\";const intlTelInputJs=\"https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.8/js/intlTelInput.min.js\";const utilsScript=\"https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.8/js/utils.js\";const countryData=[{name:\"Afghanistan\",code:\"af\",dial_code:\"+93\"}];export function InitializePhoneInput({enableGeolocation,defaultCountry}){useEffect(()=>{console.log(\"Initializing Phone Input\");// Load the intl-tel-input CSS\nconst link=document.createElement(\"link\");link.rel=\"stylesheet\";link.href=intlTelInputCss;document.head.appendChild(link);// Load the intl-tel-input JS\nconst script=document.createElement(\"script\");script.src=intlTelInputJs;document.body.appendChild(script);script.onload=()=>{const inputs=document.querySelectorAll(\"input[type='tel']\");inputs.forEach(input=>{let userSelectedCountry=false// Track if user manually selects a country\n;const iti=window.intlTelInput(input,{initialCountry:enableGeolocation?\"auto\":defaultCountry||\"us\",geoIpLookup:enableGeolocation?callback=>{fetch(\"https://ipinfo.io/json\").then(res=>res.json()).then(data=>callback(data.country||\"us\"))// Fallback if no country data\n.catch(()=>callback(\"us\"));}:undefined,utilsScript:utilsScript,separateDialCode:true,autoHideDialCode:false,dropdownContainer:document.body,customPlaceholder:placeholder=>`e.g. ${placeholder}`});iti.promise.then(()=>{const setDialCodeWithSpace=()=>{const dialCode=iti.getSelectedCountryData().dialCode;const dialCodeWithPlusAndSpace=`+${dialCode} `// Add a space after the dial code\n;input.value=dialCodeWithPlusAndSpace;};setDialCodeWithSpace();// Handle manual country selection to lock it\ninput.addEventListener(\"countrychange\",()=>{userSelectedCountry=true// User manually selected a country\n;});// Move cursor to the end of the dial code and space on focus\ninput.addEventListener(\"focus\",()=>{setTimeout(()=>{const dialCodeLength=iti.getSelectedCountryData().dialCode.length+2// +2 for '+' and the space\n;input.setSelectionRange(dialCodeLength,dialCodeLength);},0);});// Prevent cursor moving before the space after the dial code\ninput.addEventListener(\"click\",()=>{const dialCodeLength=iti.getSelectedCountryData().dialCode.length+2// +2 for '+' and the space\n;if(input.selectionStart<dialCodeLength){input.setSelectionRange(dialCodeLength,dialCodeLength);}});// Prevent removing the space after the dial code\ninput.addEventListener(\"keydown\",e=>{const dialCodeLength=iti.getSelectedCountryData().dialCode.length+2// +2 for '+' and the space\n;// Prevent Backspace or Delete from removing the space after the dial code\nif(e.key===\"Backspace\"&&input.selectionStart<=dialCodeLength||e.key===\"Delete\"&&input.selectionStart<dialCodeLength){e.preventDefault();}// Handle Cmd+Backspace or Ctrl+Backspace\nif(e.key===\"Backspace\"&&(e.metaKey||e.ctrlKey)){e.preventDefault();input.value=input.value.slice(0,dialCodeLength)// Keep only the dial code and space\n;setTimeout(()=>{input.setSelectionRange(dialCodeLength,dialCodeLength);},0);}});// Ensure the space is maintained on input\ninput.addEventListener(\"input\",()=>{const dialCodeWithPlusAndSpace=`+${iti.getSelectedCountryData().dialCode} `;if(!input.value.startsWith(dialCodeWithPlusAndSpace)){input.value=dialCodeWithPlusAndSpace+input.value.slice(dialCodeWithPlusAndSpace.length).trimStart();input.setSelectionRange(dialCodeWithPlusAndSpace.length,dialCodeWithPlusAndSpace.length);}});// Prevent reverting to geolocation after manual selection\nif(enableGeolocation){input.addEventListener(\"blur\",()=>{if(userSelectedCountry){const selectedCountry=iti.getSelectedCountryData().iso2;iti.setCountry(selectedCountry)// Lock to manually selected country\n;}});}// Append full number on form submission\nconst form=input.closest(\"form\");if(form){form.addEventListener(\"submit\",()=>{const fullNumber=iti.getNumber();input.value=fullNumber;});}});});};script.onerror=()=>console.error(\"Failed to load intl-tel-input JS\");return()=>{document.head.removeChild(link);document.body.removeChild(script);};},[enableGeolocation,defaultCountry]);const isFramerEditor=typeof window!==\"undefined\"&&window.location.href.includes(\"framer.com\");const hiddenStyle=isFramerEditor?{}:{display:\"none\",padding:0};return /*#__PURE__*/_jsxs(\"div\",{style:hiddenStyle,children:[/*#__PURE__*/_jsx(\"p\",{children:\"Phone\"}),/*#__PURE__*/_jsx(\"style\",{children:`\n                .phone-mask-form {\n                    overflow: visible !important;\n                }\n                .phone-mask-form .framer-form-input-wrapper {\n                    overflow: visible !important;\n                }\n                .intl-tel-input {\n                    width: 100%;\n                    position: relative;\n                }\n                .intl-tel-input .selected-flag {\n                    border-radius: 5px;\n                    display: flex;\n                    align-items: center;\n                    justify-content: center;\n                }\n                .intl-tel-input .selected-dial-code {\n                    display: none !important; /* Completely hides the country code */\n                }\n                .intl-tel-input input[type=\"tel\"] {\n                    border: none;\n                    background: none;\n                    position: absolute;\n                    left: 0;\n                    top: 0;\n                    width: 100%;\n                    height: 100%;\n                    opacity: 0; /* Hides the input completely but keeps it interactive */\n                    pointer-events: none; /* Prevents any interaction on the actual input field */\n                }\n                .iti__selected-dial-code {\n                    display:none;\n                }\n                /* Customizing the dropdown */\n                .iti__dropdown {\n                    background-color: #f9f9f9; /* Light background for the dropdown */\n                    border: 1px solid #ddd; /* Border around the dropdown */\n                    border-radius: 5px; /* Rounded corners */\n                    font-family: 'Arial', sans-serif; /* Custom font */\n                }\n\n                /* Customizing each list item */\n                .iti__country {\n                    padding: 10px; /* More padding for each item */\n                    color: #333; /* Custom text color */\n                }\n\n                .iti__country:hover {\n                    background-color: #EDEAFD; /* Highlight on hover */\n                    color: #0056b3; /* Change text color on hover */\n                }\n                \n                .iti__flag {\n                    border-radius: 2px; /* Rounded flags */\n                }\n                .iti__country-list {\n                    border-radius: 8px;\n                    border: 1px solid #888888;\n                }\n                .iti__country-name {\n                    font-family: 'Inter';\n                    font-size: 14px;\n                    font-weight: 500;\n                    letter-spacing: -.5px;\n                }\n                .iti__dial-code {\n                    font-size: 14px;\n                }\n            `})]});}addPropertyControls(InitializePhoneInput,{enableGeolocation:{type:ControlType.Boolean,title:\"IP Detect\",defaultValue:true},defaultCountry:{type:ControlType.Enum,title:\"Default Country\",options:countryData.map(country=>country.code),optionTitles:countryData.map(country=>country.name),hidden:props=>props.enableGeolocation}});InitializePhoneInput.displayName=\"Phone Mask Configuration\";\nexport const __FramerMetadata__ = {\"exports\":{\"InitializePhoneInput\":{\"type\":\"reactComponent\",\"name\":\"InitializePhoneInput\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./InitializePhoneInput.map"],
  "mappings": "4JAAAA,IAA0I,IAAMC,EAAgB,oFAA0FC,EAAe,sFAA4FC,EAAY,2EAAiFC,EAAY,CAAC,CAAC,KAAK,cAAc,KAAK,KAAK,UAAU,KAAK,CAAC,EAAS,SAASC,EAAqB,CAAC,kBAAAC,EAAkB,eAAAC,CAAc,EAAE,CAACC,EAAU,IAAI,CAAC,QAAQ,IAAI,0BAA0B,EAC7nB,IAAMC,EAAK,SAAS,cAAc,MAAM,EAAEA,EAAK,IAAI,aAAaA,EAAK,KAAKR,EAAgB,SAAS,KAAK,YAAYQ,CAAI,EACxH,IAAMC,EAAO,SAAS,cAAc,QAAQ,EAAE,OAAAA,EAAO,IAAIR,EAAe,SAAS,KAAK,YAAYQ,CAAM,EAAEA,EAAO,OAAO,IAAI,CAAc,SAAS,iBAAiB,mBAAmB,EAAS,QAAQC,GAAO,CAAC,IAAIC,EAAoB,GACjOC,EAAI,OAAO,aAAaF,EAAM,CAAC,eAAeL,EAAkB,OAAOC,GAAgB,KAAK,YAAYD,EAAkBQ,GAAU,CAAC,MAAM,wBAAwB,EAAE,KAAKC,GAAKA,EAAI,KAAK,CAAC,EAAE,KAAKC,GAAMF,EAASE,EAAK,SAAS,IAAI,CAAC,EACxO,MAAM,IAAIF,EAAS,IAAI,CAAC,CAAE,EAAE,OAAU,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AC,CAAC,CAAC,CAAC,CAAE,CAACC,EAAoBrB,EAAqB,CAAC,kBAAkB,CAAC,KAAKsB,EAAY,QAAQ,MAAM,YAAY,aAAa,EAAI,EAAE,eAAe,CAAC,KAAKA,EAAY,KAAK,MAAM,kBAAkB,QAAQvB,EAAY,IAAIwB,GAASA,EAAQ,IAAI,EAAE,aAAaxB,EAAY,IAAIwB,GAASA,EAAQ,IAAI,EAAE,OAAOC,GAAOA,EAAM,iBAAiB,CAAC,CAAC,EAAExB,EAAqB,YAAY",
  "names": ["init_ssg_sandbox_shims", "intlTelInputCss", "intlTelInputJs", "utilsScript", "countryData", "InitializePhoneInput", "enableGeolocation", "defaultCountry", "ue", "link", "script", "input", "userSelectedCountry", "iti", "callback", "res", "data", "placeholder", "dialCodeWithPlusAndSpace", "dialCodeLength", "selectedCountry", "form", "fullNumber", "hiddenStyle", "u", "p", "addPropertyControls", "ControlType", "country", "props"]
}
