{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/pIeH5hNsPb9JcPLTHysI/OqpjBlF7bR3O8OL2Ikl1/Validation.js"],
  "sourcesContent": ["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect}from\"react\";/**\n@framerDisableUnlink\n@framerIntrinsicWidth 100\n@framerIntrinsicHeight 100\n*/export function withPhoneMaskAndNameValidation(Component){return props=>{useEffect(()=>{// Phone Mask Logic\nconst applyPhoneMask=event=>{const input=event.target;const matrix=\"+55 (__) _____-____\"// Fixed mask for Brazil phone numbers\n;const fixedPrefix=\"55\"// Brazil DDI without the plus\n;let currentValue=input.value.replace(/\\D/g,\"\")// Remove non-digits\n;// Ensure prefix \"55\" is always fixed\nif(!currentValue.startsWith(fixedPrefix)){currentValue=fixedPrefix+currentValue;}// Ensure no more than one \"55\" prefix exists\nif(currentValue.startsWith(fixedPrefix)){currentValue=currentValue.replace(/^55/,\"\")// Remove the fixed \"55\" temporarily\n;currentValue=fixedPrefix+currentValue// Re-add the fixed \"55\"\n;}let i=0;let newValue=matrix.replace(/./g,char=>{if(/[_\\d]/.test(char)&&i<currentValue.length){return currentValue.charAt(i++)// Insert input\n;}else if(i>=currentValue.length){return\"\"// Remove extra characters\n;}else{return char// Keep mask characters\n;}});// Update the input value\ninput.value=newValue;// Move the cursor to the correct position\nconst cursorPosition=newValue.indexOf(\"_\");if(cursorPosition!==-1){input.setSelectionRange(cursorPosition,cursorPosition);}};// Clear field if phone number is incomplete\nconst handleBlur=event=>{const currentValue=event.target.value.replace(/\\D/g,\"\");if(currentValue.length<12){// Less than full phone length\nevent.target.value=\"\";const customEvent=new Event(\"change\");event.target.dispatchEvent(customEvent);}};// Restrict name input to letters and spaces\nconst restrictNameInput=event=>{const regex=/^[a-zA-Z\\u0400-\\u04FF\\s]*$/// Latin, Cyrillic, and spaces\n;if(!regex.test(event.target.value)){event.target.value=event.target.value.replace(/[^a-zA-Z\\u0400-\\u04FF\\s]/g,\"\");}};// Add event listeners to phone and name fields\nconst phoneFields=document.querySelectorAll('input[type=\"tel\"]');const nameFields=document.querySelectorAll('input[name=\"name\"]');phoneFields.forEach(phoneField=>{phoneField.addEventListener(\"input\",applyPhoneMask);phoneField.addEventListener(\"blur\",handleBlur);});nameFields.forEach(nameField=>{nameField.addEventListener(\"input\",restrictNameInput);});// Cleanup on unmount\nreturn()=>{phoneFields.forEach(phoneField=>{phoneField.removeEventListener(\"input\",applyPhoneMask);phoneField.removeEventListener(\"blur\",handleBlur);});nameFields.forEach(nameField=>{nameField.removeEventListener(\"input\",restrictNameInput);});};},[]);return /*#__PURE__*/_jsx(Component,{...props});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withPhoneMaskAndNameValidation\":{\"type\":\"reactHoc\",\"name\":\"withPhoneMaskAndNameValidation\",\"annotations\":{\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"@framerIntrinsicWidth 100\",\"framerIntrinsicHeight\":\"100\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Validation.map"],
  "mappings": "gDAIS,SAASA,EAA+BC,EAAU,CAAC,OAAOC,IAAQC,EAAU,IAAI,CACzF,IAAMC,EAAeC,GAAO,CAAC,IAAMC,EAAMD,EAAM,OAAaE,EAAO,sBAC5DC,EAAY,KACdC,EAAaH,EAAM,MAAM,QAAQ,MAAM,EAAE,EAE1CG,EAAa,WAAWD,CAAW,IAAGC,EAAaD,EAAYC,GAChEA,EAAa,WAAWD,CAAW,IAAGC,EAAaA,EAAa,QAAQ,MAAM,EAAE,EAClFA,EAAaD,EAAYC,GACxB,IAAI,EAAE,EAAMC,EAASH,EAAO,QAAQ,KAAKI,GAAU,QAAQ,KAAKA,CAAI,GAAG,EAAEF,EAAa,OAAeA,EAAa,OAAO,GAAG,EACpH,GAAGA,EAAa,OAAc,GAC1BE,CACX,EACHL,EAAM,MAAMI,EACZ,IAAME,EAAeF,EAAS,QAAQ,GAAG,EAAKE,IAAiB,IAAIN,EAAM,kBAAkBM,EAAeA,CAAc,CAAG,EACrHC,EAAWR,GAAO,CAAyD,GAArCA,EAAM,OAAO,MAAM,QAAQ,MAAM,EAAE,EAAkB,OAAO,GAAG,CAC3GA,EAAM,OAAO,MAAM,GAAG,IAAMS,EAAY,IAAI,MAAM,QAAQ,EAAET,EAAM,OAAO,cAAcS,CAAW,CAAE,CAAC,EAC/FC,EAAkBV,GAAO,CAAa,6BACjC,KAAKA,EAAM,OAAO,KAAK,IAAGA,EAAM,OAAO,MAAMA,EAAM,OAAO,MAAM,QAAQ,4BAA4B,EAAE,EAAG,EAC9GW,EAAY,SAAS,iBAAiB,mBAAmB,EAAQC,EAAW,SAAS,iBAAiB,oBAAoB,EAAE,OAAAD,EAAY,QAAQE,GAAY,CAACA,EAAW,iBAAiB,QAAQd,CAAc,EAAEc,EAAW,iBAAiB,OAAOL,CAAU,CAAE,CAAC,EAAEI,EAAW,QAAQE,GAAW,CAACA,EAAU,iBAAiB,QAAQJ,CAAiB,CAAE,CAAC,EACzV,IAAI,CAACC,EAAY,QAAQE,GAAY,CAACA,EAAW,oBAAoB,QAAQd,CAAc,EAAEc,EAAW,oBAAoB,OAAOL,CAAU,CAAE,CAAC,EAAEI,EAAW,QAAQE,GAAW,CAACA,EAAU,oBAAoB,QAAQJ,CAAiB,CAAE,CAAC,CAAE,CAAE,EAAE,CAAC,CAAC,EAAsBK,EAAKnB,EAAU,CAAC,GAAGC,CAAK,CAAC,EAAI",
  "names": ["withPhoneMaskAndNameValidation", "Component", "props", "ue", "applyPhoneMask", "event", "input", "matrix", "fixedPrefix", "currentValue", "newValue", "char", "cursorPosition", "handleBlur", "customEvent", "restrictNameInput", "phoneFields", "nameFields", "phoneField", "nameField", "p"]
}
