{"version":3,"file":"PhoneNumber.Caa5s6qW.mjs","names":["useRef","__legacyOverrideHOC_DataObserverContext","_jsx"],"sources":["https:/framerusercontent.com/modules/gNQSdsoUyfI9AlunaJsK/0SE4LVRXZWR4UPv2a7Dx/PhoneNumber.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";const ITI_VERSION=\"18.1.1\";const CSS_HREF=`https://cdn.jsdelivr.net/npm/intl-tel-input@${ITI_VERSION}/build/css/intlTelInput.css`;const JS_SRC=`https://cdn.jsdelivr.net/npm/intl-tel-input@${ITI_VERSION}/build/js/intlTelInput.min.js`;const UTILS_SRC=`https://cdn.jsdelivr.net/npm/intl-tel-input@${ITI_VERSION}/build/js/utils.js`;const isArabicPage=()=>window.location.pathname.includes(\"/ar/\")||window.location.pathname.endsWith(\"/ar\");/* -------------------------------\n   Shared assets, loaded once\n-------------------------------- */// Each phone field on the page runs this override, so without these guards\n// a three-form page injects the library three times.\nlet loaderPromise=null;const loadIntlTelInput=()=>{if(loaderPromise)return loaderPromise;loaderPromise=new Promise((resolve,reject)=>{if(window.intlTelInput)return resolve();if(!document.getElementById(\"iti-css\")){const cssLink=document.createElement(\"link\");cssLink.id=\"iti-css\";cssLink.rel=\"stylesheet\";cssLink.href=CSS_HREF;document.head.appendChild(cssLink);}const existing=document.getElementById(\"iti-js\");if(existing){existing.addEventListener(\"load\",()=>resolve());existing.addEventListener(\"error\",reject);return;}const script=document.createElement(\"script\");script.id=\"iti-js\";script.src=JS_SRC;script.onload=()=>resolve();script.onerror=reject;document.body.appendChild(script);});return loaderPromise;};const injectStylesOnce=()=>{if(document.getElementById(\"iti-custom-style\"))return;const isArabic=isArabicPage();console.log(isArabic);console.log(window.location.pathname);const style=document.createElement(\"style\");style.id=\"iti-custom-style\";style.innerHTML=`\n        .custom-phone-wrapper {\n            overflow: visible;\n            display: flex;\n            transition: all 0.3s ease;\n            direction: ${isArabic?\"rtl\":\"ltr\"};\n        }\n\n        .custom-phone-wrapper.invalid {\n            border-color: red !important;\n            background-color: #ffe6e6 !important;\n        }\n\n        .custom-phone-wrapper .iti {\n            width: 100%;\n        }\n\n        .custom-phone-wrapper .iti input {\n            border: none;\n            outline: none;\n            background: transparent;\n            width: 100%;\n            font-size: 14px;\n            text-align: ${isArabic?\"right\":\"left\"};\n        }\n\n        /* Position country code selector */\n        .custom-phone-wrapper .iti--allow-dropdown .iti__flag-container,\n        .custom-phone-wrapper .iti--separate-dial-code .iti__flag-container {\n            right: ${isArabic?\"0\":\"auto\"};\n            left: ${isArabic?\"auto\":\"0\"};\n        }\n\n        /* Show country code instead of flag */\n        .custom-phone-wrapper .iti__flag,\n        .custom-phone-wrapper .iti__flag-box {\n            display: none !important;\n        }\n\n        .custom-phone-wrapper .iti__selected-flag {\n            padding-top: 0 !important;\n            padding-right: ${isArabic?\"0 !important\":\"12px !important\"};\n            padding-left: ${isArabic?\"12px !important\":\"0px !important\"};\n            background: transparent !important;\n        }\n\n        .custom-phone-wrapper .iti__selected-dial-code {\n            margin-left: 0 !important;\n            margin-right: 0 !important;\n            font-size: 14px;\n            color: inherit;\n            direction: ltr;\n        }\n\n        /* Input spacing */\n        .custom-phone-wrapper .iti--allow-dropdown input[type=\"tel\"],\n        .custom-phone-wrapper .iti--allow-dropdown input[type=\"text\"],\n        .custom-phone-wrapper .iti--separate-dial-code input[type=\"tel\"],\n        .custom-phone-wrapper .iti--separate-dial-code input[type=\"text\"] {\n            padding-right: ${isArabic?\"50px !important\":\"6px !important\"};\n            padding-left: ${isArabic?\"6px !important\":\"50px !important\"};\n        }\n\n        /* Dropdown direction */\n        .custom-phone-wrapper .iti__country-list {\n            direction: ltr;\n            text-align: left;\n        }\n    `;document.head.appendChild(style);};export function PhoneNumberWithCountryCode(){const containerRef=useRef(null);const itiRef=useRef(null);useEffect(()=>{let cancelled=false;let form=null;let input=null;let wrapper=null;const handleSubmit=e=>{if(!itiRef.current||!input)return;if(!itiRef.current.isValidNumber()){e.preventDefault();e.stopPropagation();wrapper?.classList.add(\"invalid\");return;}wrapper?.classList.remove(\"invalid\");input.value=itiRef.current.getNumber();};injectStylesOnce();loadIntlTelInput().then(()=>{if(cancelled)return;input=containerRef.current?.querySelector(\"input\")||null;if(!input||!window.intlTelInput)return;const iti=window.intlTelInput(input,{initialCountry:\"ae\",separateDialCode:true,nationalMode:false,utilsScript:UTILS_SRC});itiRef.current=iti;input.__iti=iti;// 2. Framer renders the field as type=\"text\", which hides it\n//    from input[type=\"tel\"] lookups. Also gives mobile the\n//    numeric keypad.\ninput.type=\"tel\";input.setAttribute(\"data-iti-ready\",\"true\");// 3. Registry keyed by element, for anything that prefers it.\nconst w=window;if(!w.phoneInputs||typeof w.phoneInputs.set!==\"function\"){w.phoneInputs=new WeakMap;}w.phoneInputs.set(input,iti);// 4. Legacy global kept for backwards compatibility only.\n//    Do not read this when the page has multiple forms.\nw.phoneInput=iti;wrapper=input.closest(\".framer-form-input-wrapper\");if(wrapper)wrapper.classList.add(\"custom-phone-wrapper\");form=input.closest(\"form\");if(form)form.addEventListener(\"submit\",handleSubmit,true);}).catch(err=>{console.error(\"intl-tel-input failed to load:\",err);});return()=>{cancelled=true;if(form)form.removeEventListener(\"submit\",handleSubmit,true);if(input){delete input.__iti;input.removeAttribute(\"data-iti-ready\");const w=window;w.phoneInputs?.delete?.(input);if(w.phoneInput===itiRef.current)w.phoneInput=null;}if(itiRef.current){itiRef.current.destroy();itiRef.current=null;}// Shared script/CSS are deliberately left in place — removing them\n// would break the other phone fields still on the page.\n};},[]);return{ref:containerRef};}import{useContext as __legacyOverrideHOC_useContext}from\"react\";import{DataObserverContext as __legacyOverrideHOC_DataObserverContext}from\"framer\";export function withPhoneNumberWithCountryCode(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...PhoneNumberWithCountryCode(props)});};}withPhoneNumberWithCountryCode.displayName=\"PhoneNumberWithCountryCode\";\nexport const __FramerMetadata__ = {\"exports\":{\"withPhoneNumberWithCountryCode\":{\"type\":\"reactHoc\",\"name\":\"withPhoneNumberWithCountryCode\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"PhoneNumberWithCountryCode\":{\"type\":\"override\",\"name\":\"PhoneNumberWithCountryCode\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PhoneNumber.map"],"mappings":"sLAwEyC,SAAgB,GAA4B,CAAC,IAAM,EAAaA,EAAO,IAAI,EAAQ,EAAOA,EAAO,IAAI,EAQtI,OARwI,MAAc,CAAC,IAAI,EAAU,GAAU,EAAK,KAAS,EAAM,KAAS,EAAQ,KAAW,EAAa,GAAG,CAAI,MAAC,EAAO,SAAS,CAAC,GAAa,IAAG,CAAC,EAAO,QAAQ,cAAc,EAAE,CAAC,EAAE,eAAe,EAAE,EAAE,gBAAgB,EAAE,GAAS,UAAU,IAAI,SAAS,EAAE,MAAO,CAAC,GAAS,UAAU,OAAO,SAAS,EAAE,EAAM,MAAM,EAAO,QAAQ,UAAU,CAA3E,CAA6E,EAMlM,OANoM,EAAiB,EAAE,EAAiB,CAAC,CAAC,SAAS,CAA8E,GAA1E,IAAiB,EAAM,EAAa,SAAS,cAAc,OAAO,GAAG,KAAQ,CAAC,GAAO,CAAC,EAAO,cAAa,OAAO,IAAM,EAAI,EAAO,aAAa,EAAM,CAAC,eAAe,KAAK,iBAAiB,GAAK,aAAa,GAAM,YAAY,CAAS,CAAC,EAAE,EAAO,QAAQ,EAAI,EAAM,MAAM,EAG1xB,EAAM,KAAK,MAAM,EAAM,aAAa,iBAAiB,MAAM,EAC3D,IAAM,EAAE,GAAU,CAAC,EAAE,aAAa,OAAO,EAAE,YAAY,KAAM,cAAY,EAAE,YAAY,IAAI,SAAS,EAAE,YAAY,IAAI,EAAM,CAAG,EAE/H,EAAE,WAAW,EAAI,EAAQ,EAAM,QAAQ,4BAA4B,EAAK,GAAQ,EAAQ,UAAU,IAAI,sBAAsB,E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