1"use strict";(self.webpackChunkcorporate_website_jss=self.webpackChunkcorporate_website_jss||[]).push([[91],{6091:(e,a,t)=>{t.r(a),t.d(a,{default:()=>C});var i=t(1088),l=t(7549),n=t.n(l);const r=(n().default||n()).LATLONG_URL,o={generate_otp:"/api/RVSF/CreateRVSFOTP",verify_otp:"/api/RVSF/VerifyRVSFOTP",submit_form:"/api/RVSF/SubmitRVSF"},s=n().default||n(),c=s.TOKEN_URL,d={},u=e=>{if(!e)throw new Error("Vehicle category is required");const a=e.toLowerCase();if(a.includes("2"))return{clientId:s.TVS_2W_CLIENT_ID,clientSecret:s.TVS_2W_SECRET_ID};if(a.includes("3"))return{clientId:s.TVS_3W_CLIENT_ID,clientSecret:s.TVS_3W_SECRET_ID};throw new Error(`No credentials mapped for ${e}`)};const m=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return{fetchLocationSuggestions:async function(e){const a=`/api/LatLongAutoComplete?query=${e}`,t=await fetch(a);return await t.json()},fetchDealerInformation:async function(a,t){var i,l;const n=e.find((e=>e.displayName===t)),o=null===n||void 0===n||null===(i=n.fields)||void 0===i||null===(l=i.BrandId)||void 0===l?void 0:l.value,s="2 Wheeler"===t?"&distance_within=20":"",m=await async function(e,a){if(!e)throw new Error("BrandId is required");const t=Date.now(),i=`${e}_${a}`;if(d[i]||(d[i]={token:null,expiresAt:0}),d[i].token&&t<d[i].expiresAt)return d[i].token;const{clientId:l,clientSecret:n}=u(a),r=`${c}?grant_type=client_credentials&client_id=${l}&client_secret=${n}`,o=await fetch(r,{method:"POST"}),s=await o.json();return d[i]={token:s.access_token,expiresAt:t+1e3*(s.expires_in-60)},s.access_token}(o,null===n||void 0===n?void 0:n.displayName),v=`${r}/v2/brands/${o}/find.json?query=${a}${s}&access_token=${m}`,h=await fetch(v);return await h.json()},getLocationDetailsUsingGeo:async function(e){const a=`/api/LatLongLocation?location=${e}`,t=await fetch(a);return await t.json()}}};var v=t(4035);const h=e=>{let{isOpen:a,onClose:t,onConfirm:i,title:l,message:n,showActions:r=!0}=e;return a?(0,v.jsx)("div",{className:"modal-overlay",onClick:t,children:(0,v.jsxs)("div",{className:"warning-modal",onClick:e=>e.stopPropagation(),children:[(0,v.jsx)("button",{className:"warning-modal-close",onClick:t,children:"\xd7"}),(0,v.jsx)("div",{className:"warning-modal-icon",children:(0,v.jsx)("img",{src:"data:image/png;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAAsACwDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD3TU9TtNHsJb29lEcMY5J6k9gB3JrxvxB8SdX1WRo7B2sLToBGf3jfVu34Y/Gj4k+IH1XxC9jG/wDolixjCjo0n8RP48fh71xdediMQ2+WOx9nlOU04U1WrK8nrr0/4JJNcT3D75ppJH/vOxJ/WtDTvEWsaTIHstRuIsfwb9yH6qeD+VbFroeiabplpdeJLi7Sa/G6CC127o4+0j57HsB+vbI1/RJdC1I2zSCaF1EkE6/dljPRhXPyyj7x6sa1Cs/ZNXXmtHbe3ex6r4N+IMOvSLYagqW9/j5GU4Sb6eh9v/1V3NfLyO0bq6MVdTlWBwQa+gvB2vf8JB4bt7uVh9oXMU/++O/4jB/Gu7DV3P3Zbny+dZXHD2rUfhe67P8AyPn+4lae5lmfJaRy7Z9Sc1t+FNIg1HUZLq/O3TLFPPumPcDov1J4/OqniLTX0nxFf2Trjy5js91PKn8iK6TT9Nu9X+H8VhoQSa4a6aS/hEiq+B9zgkZXv9a4oRfM79D6XEV0qEXF2UrK/ZPr923nYzftd74p1fWtQNvaystlLKUnJxDGuB8mP4gOmeOtWdK/4qjwxLor/NqWngz2J7yR/wAcX9R/9arGjeGvFWj/ANobdCeX7ZZSWhzKg2h8fN15xjpUWj+DvFmnata3sWnmFoJA5eSZAoHfPPTGc1ooyvqnrucs6tDlahOK5bcuq6L1+XocbWtpmuXmm2zQ27MEZy5xnrgD+lO8UmzPinUm09la1MxKFPuknrj2zmu08DeC4tV8PfbbssnmzN5eO6jAz+Yaopwk58sTpxWKo08OqtZaO2nqb/xB8Gvr1uuoWCg38C4Kf89k64+o5x9fpXizK8MhVgySKcEEYINfUNc/r3g7Rdf3S3dsUuMf6+E7X/HsfxBrsr4fm96O585lWcOglQqq8endf8A8B+03H/PeX/vs015pZBh5HYehYmtPW9Mh02/aCFpGUPty5BP6Cu28F+BtH1W3+13ouJduP3XmYQ/XAz+tcMYOUuVH1FbE06NL2slocn4U8KXfifUAiAx2cZBnnI4A9B6sa99tLWGytIbW3jEcMKBEUdgKW2tbeyt0t7WGOGFBhUjXAH4VLXp0aKprzPiMyzKeNn2itkf/2Q==",alt:"Alert"})}),(0,v.jsx)("h2",{className:"warning-modal-title",children:l}),(0,v.jsx)("p",{className:"warning-modal-message",children:n}),r&&(0,v.jsxs)("div",{className:"warning-modal-actions",children:[(0,v.jsx)("button",{className:"warning-modal-button warning-modal-button-cancel",onClick:t,children:"Cancel"}),(0,v.jsx)("button",{className:"warning-modal-button warning-modal-button-confirm",onClick:i,children:"Yes Proceed"})]})]})}):null},p=e=>{let{steps:a,currentStep:t}=e;return(0,v.jsx)("div",{className:"progress-indicator",children:a.map(((e,i)=>(0,v.jsxs)("div",{className:"progress-step",children:[(0,v.jsx)("div",{className:"step-circle "+(t>=e.id?"active":""),children:t>=e.id&&(0,v.jsx)("div",{className:"step-dot"})}),(0,v.jsx)("span",{className:"step-label "+(t>=e.id?"active":""),children:e.label}),i<a.length-1&&(0,v.jsx)("div",{className:"step-connector"})]},e.id)))})},y=e=>{var a,t;let{formData:l,onChange:n,onSubmit:r,isSubmitting:o,pushToDataLayer:s,privacyLink:c,termsLink:d}=e;const[u,m]=(0,i.useState)({}),h=(0,i.useRef)({fullName:!1,email:!1}),p=(0,i.useCallback)((e=>{if(!e.target||!e.target.name)return;const{name:a,value:t,type:i,checked:r}=e.target;let o=t;"fullName"===a&&(o=t.replace(/[^a-zA-Z\s.'-]/g,""),o=o.replace(/^\s+/,""),o.length>30&&(o=o.slice(0,30))),"email"===a&&(o=t.trimStart(),o.length>40&&(o=o.slice(0,40))),"mobileNumber"===a&&(o=t.replace(/\D/g,""),o.length>10&&(o=o.slice(0,10))),n({[a]:"checkbox"===i?r:o});const c=((e,a,t)=>{switch(e){case"fullName":{const e=a.trim(),t=e.replace(/\s/g,"");return e?t.length<3?"Name must be at least 3 characters":"":"Name is required"}case"email":{const e=a.trim();return e?e.length>40?"Email must not exceed 40 characters":/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[A-Za-z]{2,}$/.test(e)?"":"Please enter a valid email address":"Email is required"}case"mobileNumber":return a?/^\d{10}$/.test(a)?"":"Please enter a valid 10-digit mobile number":"Mobile number is required";case"agreeToTerms":return t.agreeToTerms?"":"You must agree to Privacy Policy & Terms";default:return""}})(a,"checkbox"===i?r:o,{...l,[a]:"checkbox"===i?r:o});
1m((e=>({...e,[a]:c})));const d={...l,[a]:"checkbox"===i?r:o};"checkbox"===i&&s({event:"Enquiry_Form",eventCategory:"Enquiry form",eventAction:"Authorization",eventLabel:r?"Check":"Uncheck",FormType:"ELV Form",section_name:"Contact Details"});const u=d.fullName.trim().replace(/\s/g,"").length>=3;"fullName"===a&&(u&&!h.current.fullName?(s({event:"Enquiry_Form",eventCategory:"Enquiry form",eventAction:"Name",eventLabel:"NA",FormType:"ELV Form",section_name:"Contact Details"}),h.current.fullName=!0):u||(h.current.fullName=!1));const v=d.email.trim(),p=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[A-Za-z]{2,}$/.test(v);"email"===a&&(p&&!h.current.email?(s({event:"Enquiry_Form",eventCategory:"Enquiry form",eventAction:"Mail",eventLabel:"NA",FormType:"ELV Form",section_name:"Contact Details"}),h.current.email=!0):p||(h.current.email=!1)),"mobileNumber"===a&&10===o.length&&s({event:"Enquiry_Form",eventCategory:"Enquiry form",eventAction:"Mobile Number",eventLabel:"NA",FormType:"ELV Form",section_name:"Contact Details"})}),[l,n,s]),y=(null===(a=l.fullName)||void 0===a?void 0:a.trim())||"",g=y.replace(/\s/g,""),f=y&&g.length>=3&&/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[A-Za-z]{2,}$/.test(null===(t=l.email)||void 0===t?void 0:t.trim())&&/^[0-9]{10}$/.test(l.mobileNumber)&&l.agreeToTerms&&!o;return(0,v.jsxs)("form",{className:"contact-form",onSubmit:e=>{e.preventDefault();const a={},t=l.fullName.trim(),i=t.replace(/\s/g,""),n=l.email.trim();t?i.length<3&&(a.fullName="Name must be at least 3 characters"):a.fullName="Name is required",n?/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[A-Za-z]{2,}$/.test(n)||(a.email="Please enter a valid email address"):a.email="Email is required",/^\d{10}$/.test(l.mobileNumber)||(a.mobileNumber="Please enter a valid 10-digit mobile number"),m(a),0===Object.keys(a).length&&r(e)},children:[(0,v.jsxs)("div",{className:"form-group floating-label",children:[(0,v.jsx)("input",{type:"text",id:"fullName",name:"fullName",value:l.fullName,onChange:p,placeholder:"Full Name",disabled:o}),(0,v.jsxs)("label",{htmlFor:"fullName",children:["Full Name",(0,v.jsx)("span",{className:"required",children:"*"})]}),u.fullName&&(0,v.jsx)("p",{className:"field-error",children:u.fullName})]}),(0,v.jsxs)("div",{className:"form-group floating-label",children:[(0,v.jsx)("input",{type:"email",id:"email",name:"email",value:l.email,onChange:p,placeholder:"Email",maxLength:"40",disabled:o}),(0,v.jsxs)("label",{htmlFor:"email",children:["Email",(0,v.jsx)("span",{className:"required",children:"*"})]}),u.email&&(0,v.jsx)("p",{className:"field-error",children:u.email})]}),(0,v.jsxs)("div",{className:"form-group floating-label",children:[(0,v.jsx)("input",{type:"tel",id:"mobileNumber",name:"mobileNumber",value:l.mobileNumber,onChange:p,className:"mobile-number",placeholder:"Mobile Number",inputMode:"numeric",maxLength:"10",disabled:o}),(0,v.jsxs)("label",{htmlFor:"mobileNumber",children:["Mobile Number",(0,v.jsx)("span",{className:"required",children:"*"})]}),u.mobileNumber&&(0,v.jsx)("p",{className:"field-error",children:u.mobileNumber})]}),(0,v.jsxs)("div",{className:"checkbox-group",children:[(0,v.jsx)("input",{type:"checkbox",id:"agreeToTerms",name:"agreeToTerms",checked:l.agreeToTerms,onChange:p,disabled:o}),(0,v.jsxs)("label",{htmlFor:"agreeToTerms",className:"checkbox-label",children:["By verifying with OTP, I confirm that I have read and understood the"," ",(0,v.jsx)("a",{href:c||"#",className:"link",target:"_blank",rel:"noopener noreferrer",onClick:()=>{s({event:"Enquiry_Form",eventCategory:"Enquiry form",eventAction:"Privacy Policy",eventLabel:"NA",FormType:"ELV Form",section_name:"Contact Details"})},children:"Privacy Policy"})," ","and agree to the"," ",(0,v.jsx)("a",{href:d||"#",className:"link",target:"_blank",rel:"noopener noreferrer",onClick:()=>{s({event:"Enquiry_Form",eventCategory:"Enquiry form",eventAction:"Terms & Conditions",eventLabel:"NA",FormType:"ELV Form",section_name:"Contact Details"})},children:"Terms & Conditions"})]})]}),(0,v.jsx)("button",{type:"submit",className:"submit-button "+(f?"enabled":""),disabled:!f,children:o?"Sending...":"Send OTP"})]})},g=e=>{var a,t,l;let{vehicleCategories:n=[],vehicleData:r,onChange:o,onSubmit:s,onBack:c,cmsStates:d,filteredCities:u,filteredVehicleMakers:m,filteredModels:h,locationSuggestionState:p,pincodeSuggestionList:y,onLocationSuggestion:g,onLocationSelection:f,setLocationSuggestionState:b,pushToDataLayer:N}=e;const x=n.find((e=>e.displayName===r.vehicleCategory)),A=(0,i.useCallback)((e=>{const{name:a,value:t}=e.target;if(o({[a]:t}),t){let e="",i=t;switch(a){case"vehicleCategory":e="Vehicle Category";break;case"vehicleType":e="Vehicle Type";break;case"vehicleMaker":e="Vehicle Maker";break;case"vehicleModel":e="Vehicle Model";break;case"yearOfPurchase":e="Year Of Purchase",i=t;break;default:return null}N({event:"Enquiry_Form",eventCategory:"Enquiry form",eventAction:e,eventLabel:i,FormType:"ELV Form",section_name:"Vehicle Details"})}}),[o,r,N]),j=(0,i.useCallback)((e=>{g(e.target.value)}),[g]),C=(0,i.useCallback)((e=>{f(e),N({event:"Enquiry_Form",eventCategory:"Enquiry form",eventAction:"Pincode/Location",eventLabel:e.name,FormType:"ELV Form",section_name:"Vehicle Details"})}),[f,N]);return(0,i.useEffect)((()=>{var e;const a=(null===x||void 0===x||null===(e=x.fields)||void 0===e?void 0:e.Vehicles)||[];a.length&&!r.vehicleType&&o({vehicleType:a[0].displayName})}),[x,r.vehicleType,o]),(0,i.useEffect)((()=>{const e=e=>{const a=e.target.closest(".location-suggestion-container"),t=e.target.closest("#pincode");a||t||(b(!1),y.length>0&&o({pincode:""}))};if(p)return document.addEventListener("click",e),()=>document.removeEventListener("click",e)}),[p,b,y,o]),(0,v.jsxs)("form",{className:"contact-form",onSubmit:s,children:[(0,v.jsxs)("div",{className:"form-scroll",children:[(0,v.jsxs)("div",{className:"form-group floating-label",children:[(0,v.jsxs)("select",{id:"vehicleCategory",name:"vehicleCategory",value:r.vehicleCategory,onChange:A,className:"select-input",required:!0,children:[(0,v.jsx)("option",{value:"",disabled:!0,children:"Select Vehicle Category"}),n.map((e=>(0,v.jsx)("option",{value:e.displayName,children:e.displayName},e.id)))]}),(0,v.jsxs)("label",{htmlFor:"vehicleCategory",children:["Vehicle Category",(0,v.jsx)("span",{className:"required",children:"*"})]})]}),(0,v.jsxs)("div",{className:"form-group",children:[(0,v.jsxs)("label",{children:["Vehicle Type",(0,v.jsx)("span",{className:"required",children:"*"})]}),(0,v.jsx)("div",{className:"radio-group",children:((null===x||void 0===x||null===(a=x.fields)||void 0===a?void 0:a.Vehicles)||[]).map((e=>(0,v.jsxs)("label",{className:"radio-option",children:[(0,v.jsx)("input",{type:"radio",placeholder:"vehicleType",name:"vehicleType",value:e.displayName,checked:r.vehicleType===e.displayName,onChange:A,disabled:!r.vehicleCategory}),(0,v.jsx)("span",{children:e.displayName})]},e.id)))})]}),(0,v.jsxs)("div",{className:"form-group floating-label",children:[(0,v.jsxs)("select",{id:"vehicleMaker",name:"vehicleMaker",value:r.vehicleMaker,onChange:A,className:"select-input",required:!0,disabled:!m.length,children:[(0,v.jsx)("option",{value:"",disabled:!0,children:"Select Vehicle Maker"}),m.map((e=>(0,v.jsx)("option",{value:e.displayName,children:e.displayName},e.id)))]}),(0,v.jsxs)("label",{htmlFor:"vehicleMaker",children:["Vehicle Maker",(0,v.jsx)("span",{className:"required",children:"*"})]})]}),(0,v.jsxs)("div",{className:"form-group floating-label",children:[(0,v.jsxs)("select",{id:"vehicleModel",name:"vehicleModel",value:r.vehicleModel,onChange:A,className:"select-input",required:!0,children:[(0,v.jsx)("option",{value:"",children:"Select Vehicle Model"}),h.length>0?h.map((e=>(0,v.jsx)("option",{value:e.fields.VehicleModel.value,children:e.fields.VehicleModel.value},e.id))):(0,v.jsx)("option",{value:"Other",children:"Other"})]}),(0,v.jsxs)("label",{htmlFor:"vehicleModel",children:["Vehicle Model",(0,v.jsx)("span",{className:"required",children:"*"})]})]}),(0,v.jsxs)("div",{className:"form-group floating-label",children:[(0,v.jsx)("input",{type:"text",id:"pincode",name:"pincode",placeholder:"Pincode/Location",value:r.pincode,onChange:j,required:!0}),(0,v.jsxs)("label",{htmlFor:"pincode",children:["Pincode/Location",(0,v.jsx)("span",{className:"required",children:"*"})]}),p&&y.length>0&&(0,v.jsx)("div",{className:"location-suggestion-container",children:y.map((e=>(0,v.jsx)("div",{className:"location-suggestion-item",onClick:()=>C(e),role:"button",tabIndex:0,onKeyDown:a=>"Enter"===a.key&&C(e),children:null===e||void 0===e?void 0:e.name},e.name)))})]}),(0,v.jsxs)("div",{className:"form-group floating-label date-input",children:[(0,v.jsx)("input",{type:"date",id:"yearOfPurchase",placeholder:"Year Of Purchase",name:"yearOfPurchase",value:r.yearOfPurchase,onChange:A,max:(new Date).toISOString().split("T")[0]}),(0,v.jsx)("label",{htmlFor:"yearOfPurchase",children:"Year Of Purchase"})]})]}),(0,v.jsxs)("div",{className:"form-actions",children:[(0,v.jsx)("button",{type:"button",className:"button-secondary",onClick:c,children:"Back"}),(0,v.jsx)("button",{type:"submit",className:"button-primary "+(r.vehicleCategory&&r.vehicleType&&r.vehicleMaker&&r.vehicleModel&&null!==(t=r.pincode)&&void 0!==t&&t.trim()?"enabled":""),disabled:!(r.vehicleCategory&&r.vehicleType&&r.vehicleMaker&&r.vehicleModel&&null!==(l=r.pincode)&&void 0!==l&&l.trim()),children:"Next"})]})]})},f=e=>{let{disposalQuestions:a=[],disposalData:t,onChange:l,onSubmit:n,onBack:r,pushToDataLayer:o}=e;const s=(0,i.useCallback)((e=>{const{name:a,value:t}=e.target;l({[a]:t});o({event:"Enquiry_Form",eventCategory:"Enquiry form",eventAction:{originalRc:"RC Certificate",kycMatch:"KYC Details",hypothecation:"Hypothecation",criminalRecord:"Criminal Record",pendingLiabilities:"Pending Liabilities"}[a]||a,eventLabel:"yes"===t?"Yes":"No",FormType:"ELV Form",section_name:"Disposal Details"})}),[l,o]);return(0,v.jsxs)("form",{className:"contact-form",onSubmit:n,children:[(0,v.jsx)("div",{className:"form-scroll",children:a.map(((e,a)=>{var i,l,n,r;const o=null===e||void 0===e||null===(i=e.fields)||void 0===i||null===(l=i.Name)||void 0===l?void 0:l.value,c=null===e||void 0===e||null===(n=e.fields)||void 0===n||null===(r=n.Label)||void 0===r?void 0:r.value;return o?(0,v.jsxs)("div",{className:"form-group",children:[(0,v.jsxs)("label",{className:"disposal-question",children:[a+1,". ",c]}),(0,v.jsx)("div",{className:"radio-group",children:["yes","no"].map((e=>(0,v.jsxs)("label",{className:"radio-option",children:[(0,v.jsx)("input",{type:"radio",name:o,value:e,checked:t[o]===e,onChange:s,required:!0}),(0,v.jsx)("span",{children:"yes"===e?"Yes":"No"})]},e)))})]},e.id):null}))}),(0,v.jsxs)("div",{className:"form-actions",children:[(0,v.jsx)("button",{type:"button",className:"button-secondary",onClick:r,children:"Back"}),(0,v.jsx)("button",{type:"submit",className:"button-primary enabled",children:"Next"})]})]})},b=e=>{let{vehicleCategories:a=[],vehicleData:t,vehicleTerm:l,dealers:n,selectedDealerId:r,onDealerSelect:o,onSubmit:s,onBack:c,isSubmitting:d,mailSrc:u,scrapValueText:m="",scrapMessage:h="",pushToDataLayer:p}=e;const y=(0,i.useCallback)((e=>{o(e),p({event:"Enquiry_Form",eventCategory:"Enquiry form",eventAction:e.wp_name,eventLabel:"NA",FormType:"ELV Form",State:t.state,City:t.city,Pincode:t.pincode,DealerName:e.wp_name,vehicle_type:t.vehicleType,section_name:"Validation Details"})}),[o,p]);return(0,v.jsxs)("form",{className:"contact-form",onSubmit:s,children:[(0,v.jsxs)("div",{className:"form-scroll",children:[(0,v.jsx)("h3",{className:"valuation-heading",children:m}),(0,v.jsxs)("div",{className:"valuation-banner",children:[h,(0,v.jsx)("span",{className:"valuation-amount",children:(()=>{var e,i;const l=a.find((e=>e.displayName===t.vehicleCategory));return(null===l||void 0===l||null===(e=l.fields)||void 0===e||null===(i=e.Message)||void 0===i?void 0:i.value)||""})()}),(0,v.jsxs)("span",{className:"star-tooltip",children:["*",(0,v.jsx)("span",{className:"tooltip-text",children:l})]})]}),(0,v.jsx)("h4",{className:"dealer-heading",children:`Dealers at ${t.city} for ${t.vehicleType}`}),n.length>0?(0,v.jsx)("div",{className:"dealer-list",children:n.map(((e,a)=>(0,v.jsxs)("div",{className:"dealer-card "+(r===e.dealer_id?"dealer-card--primary active":""),onClick:()=>y(e),role:"button",tabIndex:0,onKeyDown:a=>"Enter"===a.key&&y(e),children:[(0,v.jsx)("div",{className:"dealer-title",children:e.wp_name}),(0,v.jsx)("div",{className:"dealer-address",children:e.address}),e.email_id&&(0,v.jsxs)("div",{className:"dealer-email",children:[(0,v.jsx)("img",{src:u,alt:"email"}),(0,v.jsx)("span",{children:e.email_id})]})]},e.dealer_id||a)))}):(0,v.jsx)("p",{className:"no-dealers-message",children:"No dealers available for the selected location."})]}),(0,v.jsxs)("div",{className:"form-actions",children:[(0,v.jsx)("button",{type:"button",className:"button-secondary",onClick:c,children:"Back"}),(0,v.jsx)("button",{type:"submit",className:"button-primary "+(r?"enabled":""),disabled:!r||d,children:d?"Submitting...":"Submit"})]})]})},N=e=>{let{vehicleCategory:a,vehicleCategories:t=[],scrapValueText:i="",scrapMessage:l="",scrapSuccessMessage:n="",scrapCongratulations:r="",scrapCompletionIcon:o="",vehicleTerm:s}=e;return(0,v.jsxs)("div",{className:"contact-form",children:[(0,v.jsx)("h3",{className:"valuation-heading",children:i}),(0,v.jsxs)("div",{className:"valuation-banner",children:[l,(0,v.jsxs)("span",{className:"valuation-amount",children:[(()=>{var e,i;const l=t.find((e=>e.displayName===a));return(null===l||void 0===l||null===(e=l.fields)||void 0===e||null===(i=e.Message)||void 0===i?void 0:i.value)||""})()," "]}),(0,v.jsxs)("span",{className:"star-tooltip",children:["*",(0,v.jsx)("span",{className:"tooltip-text",children:s})]})]}),(0,v.jsxs)("div",{className:"completion-message",children:[(0,v.jsx)("div",{className:"completion-title",children:r}),(0,v.jsx)("div",{className:"completion-icon",children:o}),(0,v.jsx)("div",{className:"completion-text",children:n})]})]})},x=e=>{const a=e%60;return`${Math.floor(e/60).toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`},A=e=>{let{otp:a,timer:t,otpError:l,isSubmitting:n,otpInputRefs:r,onOtpChange:o,onOtpKeyDown:s,onOtpPaste:c,onSubmit:d,onResend:u,onClose:m,pushToDataLayer:h}=e;const p=(0,i.useRef)(!1);return(0,i.useEffect)((()=>{var e;null!==r&&void 0!==r&&null!==(e=r.current)&&void 0!==e&&e[0]&&r.current[0].focus()}),[]),(0,i.useEffect)((()=>{a.every((e=>""===e))&&(p.current=!1)}),[a]),(0,v.jsx)("div",{className:"modal-overlay",children:(0,v.jsxs)("div",{className:"otp-modal",onClick:e=>e.stopPropagation(),children:[(0,v.jsxs)("div",{className:"modal-header",children:[(0,v.jsx)("h3",{className:"modal-title",children:"Verify Mobile Number"}),(0,v.jsx)("button",{className:"modal-close",onClick:()=>{h({event:"Enquiry_Form",eventCategory:"Enquiry form",eventAction:"Close Icon",eventLabel:"NA",FormType:"ELV Form",section_name:"Contact Details"}
1),m()},"aria-label":"Close",children:"\xd7"})]}),(0,v.jsxs)("div",{className:"modal-content",children:[(0,v.jsx)("p",{className:"otp-instruction",children:"Enter OTP"}),(0,v.jsxs)("form",{className:"otp-form",onSubmit:d,children:[(0,v.jsx)("div",{className:"otp-inputs",children:a.map(((e,a)=>(0,v.jsx)("input",{ref:e=>r.current[a]=e,type:"text",inputMode:"numeric",maxLength:"1",value:e,onChange:e=>{o(a,e.target.value),e.target.value&&!p.current&&(h({event:"Enquiry_Form",eventCategory:"Enquiry form",eventAction:"Enter OTP",eventLabel:"NA",FormType:"ELV Form",section_name:"Contact Details"}),p.current=!0)},onKeyDown:e=>s(a,e),onPaste:c,className:"otp-input "+(l?"error":""),disabled:n,"aria-label":`OTP digit ${a+1}`},a)))}),l&&(0,v.jsx)("p",{className:"otp-error",role:"alert",children:l}),(0,v.jsx)("p",{className:"resend-otp",children:t>0?(0,v.jsxs)(v.Fragment,{children:["Resend OTP"," ",(0,v.jsxs)("span",{className:"timer",children:["in ",(0,v.jsx)("span",{className:"grnTxt",children:x(t)})]})]}):(0,v.jsx)("button",{type:"button",onClick:()=>{h({event:"Enquiry_Form",eventCategory:"Enquiry form",eventAction:"Resend OTP",eventLabel:"NA",FormType:"ELV Form",section_name:"Contact Details"}),u()},className:"resend-button",children:"Resend OTP"})}),(0,v.jsx)("button",{type:"submit",className:"otp-submit-button "+(a.every((e=>""!==e))&&!n?"enabled":""),disabled:a.some((e=>""===e))||n,children:n?"Verifying...":"Submit"})]})]})]})})},j=[{id:1,label:"Contact Details"},{id:2,label:"Vehicle Details"},{id:3,label:"Disposal Options"},{id:4,label:"Valuation"}],C=e=>{var a,t,l,n,r,s,c,d,u,x,C,S,D,E,T,L,k,V,F,M,P,w,_,O,q,I,B,R,K,W,Q,U,Z,H,Y,J,z,X,G,$;const{Banner:ee,EmailIcon:ae,VehicleMaker:te=[],VehicleModels:ie=[],source:le,sourceId:ne}=(null===e||void 0===e?void 0:e.returnSectionData)||{},re=(null===e||void 0===e||null===(a=e.returnSectionData)||void 0===a?void 0:a.titleLines)||[],oe=null===ee||void 0===ee||null===(t=ee.value)||void 0===t?void 0:t.src,se=null===ae||void 0===ae||null===(l=ae.value)||void 0===l?void 0:l.src,ce=null===le||void 0===le?void 0:le.value,de=null===ne||void 0===ne?void 0:ne.value,{formData:ue,updateFormData:me}=(()=>{const[e,a]=(0,i.useState)({fullName:"",email:"",mobileNumber:"",agreeToTerms:!1});return{formData:e,updateFormData:(0,i.useCallback)((e=>{a((a=>({...a,...e})))}),[])}})(),[ve,he]=(0,i.useState)(!1),{vehicleData:pe,updateVehicleData:ye,filteredModels:ge,filteredCities:fe,filteredVehicleMakers:be}=((e,a)=>{const[t,l]=(0,i.useState)({state:"",city:"",pincode:"",vehicleCategory:"2 Wheeler",vehicleType:"",vehicleMaker:"",vehicleModel:"",yearOfPurchase:""}),[n,r]=(0,i.useState)([]),o=(0,i.useCallback)((e=>{l((a=>({...a,...e,...e.vehicleCategory&&{vehicleType:"",vehicleMaker:"",vehicleModel:"",pincode:"",state:"",city:"",yearOfPurchase:""}})))}),[]),s=(0,i.useMemo)((()=>{var a;if(!t.vehicleCategory)return[];const i=t.vehicleCategory,l=e.find((e=>e.displayName===i));return(null===l||void 0===l||null===(a=l.fields)||void 0===a?void 0:a.VehicleMaker)||[]}),[t.vehicleCategory,e]);return(0,i.useEffect)((()=>{var e;const{vehicleType:i,vehicleMaker:n}=t;if(!i||!n)return void r([]);const o=a.find((e=>e.displayName===i));if(null===o||void 0===o||null===(e=o.fields)||void 0===e||!e.Vehicles)return void r([]);const s=o.fields.Vehicles.filter((e=>{var a,t;return(null===(a=e.fields)||void 0===a||null===(t=a.VehicleMaker)||void 0===t?void 0:t.value)===n})).sort(((e,a)=>{var t,i,l,n,r,o;return null===(t=e.fields)||void 0===t||null===(i=t.VehicleModel)||void 0===i||null===(l=i.value)||void 0===l?void 0:l.toLowerCase().localeCompare(null===(n=a.fields)||void 0===n||null===(r=n.VehicleModel)||void 0===r||null===(o=r.value)||void 0===o?void 0:o.toLowerCase())}));r(s),l((e=>({...e,vehicleModel:""})))}),[t.vehicleType,t.vehicleMaker,a]),{vehicleData:t,updateVehicleData:o,filteredModels:n,filteredVehicleMakers:s}})(te,ie),{disposalData:Ne,updateDisposalData:xe}=(()=>{const[e,a]=(0,i.useState)({originalRc:"yes",kycMatch:"yes",hypothecation:"no",criminalRecord:"no",pendingLiabilities:"no"});return{disposalData:e,updateDisposalData:(0,i.useCallback)((e=>{a((a=>({...a,...e})))}),[])}})(),{otp:Ae,timer:je,otpError:Ce,isModalOpen:Se,otpInputRefs:De,setOtp:Ee,setTimer:Te,setOtpError:Le,setIsModalOpen:ke,handleOtpChange:Ve,handleOtpKeyDown:Fe,handleOtpPaste:Me,resetOTP:Pe}=(()=>{const[e,a]=(0,i.useState)(Array(4).fill("")),[t,l]=(0,i.useState)(30),[n,r]=(0,i.useState)(""),[o,s]=(0,i.useState)(!1),c=(0,i.useRef)([]),d=(0,i.useCallback)(((e,t)=>{var i;/^\d*$/.test(t)&&(t.length>1||(a((a=>{const i=[...a];return i[e]=t,i}
1)),t&&e<3&&(null===(i=c.current[e+1])||void 0===i||i.focus())))}),[]),u=(0,i.useCallback)(((a,t)=>{var i;"Backspace"===t.key&&!e[a]&&a>0&&(null===(i=c.current[a-1])||void 0===i||i.focus())}),[e]),m=(0,i.useCallback)((e=>{var t;e.preventDefault();const i=e.clipboardData.getData("text").replace(/\D/g,"").slice(0,4),l=Array(4).fill("");i.split("").forEach(((e,a)=>{a<4&&(l[a]=e)})),a(l),null===(t=c.current[Math.min(i.length,3)])||void 0===t||t.focus()}),[]),v=(0,i.useCallback)((()=>{a(Array(4).fill("")),l(30),r("")}),[]);return(0,i.useEffect)((()=>{let e=null;return o&&t>0&&(e=setInterval((()=>{l((e=>e-1))}),1e3)),()=>{e&&clearInterval(e)}}),[o,t]),{otp:e,timer:t,otpError:n,isModalOpen:o,otpInputRefs:c,setOtp:a,setTimer:l,setOtpError:r,setIsModalOpen:s,handleOtpChange:d,handleOtpKeyDown:u,handleOtpPaste:m,resetOTP:v}})(),{pushToDataLayer:we}={pushToDataLayer:(0,i.useCallback)((e=>{window.dataLayer=window.dataLayer||[];const a={...e,BrandName:"Corp Web",VariantName:"NA"};window.dataLayer.push(a)}),[])},[_e,Oe]=(0,i.useState)(1),[qe,Ie]=(0,i.useState)(!1),[Be,Re]=(0,i.useState)(""),[Ke,We]=(0,i.useState)(!1),[Qe,Ue]=(0,i.useState)([]),[Ze,He]=(0,i.useState)([]),[Ye,Je]=(0,i.useState)(""),[ze,Xe]=(0,i.useState)(null),[Ge,$e]=(0,i.useState)(""),[ea,aa]=(0,i.useState)(""),[ta,ia]=(0,i.useState)(!1),la=(null===e||void 0===e||null===(n=e.returnSectionData)||void 0===n?void 0:n.VehicleCategory)||[],{fetchLocationSuggestions:na,fetchDealerInformation:ra,getLocationDetailsUsingGeo:oa}=m(la),sa=async e=>{try{const a={mobileNo:e},t=await fetch(o.generate_otp,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!t.ok)throw new Error("OTP generation failed");return t.json()}catch(a){throw console.error("Generate OTP failed:",a),a}},ca=(0,i.useCallback)((()=>{const e={2:"Vehicle Details",3:"Disposal Details",4:"Validation Details"};if(e[_e]){const a={event:"Enquiry_Form",eventCategory:"Enquiry form",eventAction:"Back",State:pe.state||"NA",City:pe.city||"NA",Pincode:ea||"NA",vehicle_type:pe.vehicleType||"NA",eventLabel:"NA",FormType:"ELV Form",section_name:e[_e]};2!==_e&&(a.DealerName=Ye||"NA"),we(a)}Oe((e=>Math.max(e-1,1)))}),[_e,we,ea,Ye,pe]),da=(0,i.useCallback)((e=>{Xe(e.dealer_id),Je(null===e||void 0===e?void 0:e.wp_name)}),[]),ua=null===e||void 0===e||null===(r=e.returnSectionData)||void 0===r||null===(s=r.VehicleCategory)||void 0===s?void 0:s.find((e=>e.displayName===pe.vehicleCategory)),ma=(null===ua||void 0===ua||null===(c=ua.fields)||void 0===c||null===(d=c.Years)||void 0===d?void 0:d.value)||"";return(0,i.useEffect)((()=>{aa(""),He([]),Xe(null),he(!1)}),[pe.vehicleCategory]),(0,v.jsxs)("section",{id:"returns-form",className:"returns-section",children:[(0,v.jsx)("div",{className:"container customContainer",children:(0,v.jsxs)("div",{className:"returns-content",children:[(0,v.jsxs)("div",{className:"returns-image-wrapper",children:[oe&&(0,v.jsx)("img",{src:oe,alt:"Returns On Your Return - TVS Vehicle Scrapping Program",className:"returns-image"}),(0,v.jsx)("div",{className:"form-banner-img",children:(0,v.jsxs)("h3",{children:[null===(u=re[0])||void 0===u||null===(x=u.fields)||void 0===x||null===(C=x.Name)||void 0===C?void 0:C.value," ",null===(S=re[1])||void 0===S||null===(D=S.fields)||void 0===D||null===(E=D.Name)||void 0===E?void 0:E.value]})})]}),(0,v.jsx)("div",{className:"returns-form-wrapper",children:(0,v.jsxs)("div",{className:"form-card",children:[(0,v.jsx)("h2",{className:"form-title",children:"Goodbye Old Ride, Hello Rewards!"}),(0,v.jsx)(p,{steps:j,currentStep:_e}),1===_e&&(0,v.jsx)(y,{formData:ue,onChange:me,onSubmit:async e=>{e.preventDefault(),ia(!0),we({event:"Enquiry_Form",eventCategory:"Enquiry form",eventAction:"Send OTP",eventLabel:"NA",FormType:"ELV Form",section_name:"Contact Details"});try{const e=await sa(ue.mobileNumber);"success"===(null===e||void 0===e?void 0:e.Result)||null!==e&&void 0!==e&&e.Success?ke(!0):alert(e.Message)}catch(a){alert("An error occurred. Please try again.")}finally{ia(!1)}},isSubmitting:ta,pushToDataLayer:we,privacyLink:null===e||void 0===e||null===(T=e.returnSectionData)||void 0===T||null===(L=T.Privacy)||void 0===L?void 0:L.value,termsLink:null===e||void 0===e||null===(k=e.returnSectionData)||void 0===k||null===(V=k.Terms)||void 0===V?void 0:V.value}),2===_e&&(0,v.jsx)(g,{vehicleCategories:(null===e||void 0===e||null===(F=e.returnSectionData)||void 0===F?void 0:F.VehicleCategory)||[],vehicleData:pe,onChange:ye,onSubmit:e=>{var a;e.preventDefault();if(!(null===(a=pe.pincode)||void 0===a?void 0:a.trim()))return void alert("Pincode/Location is required.");
1if(!ve)return void alert("Please enter the correct Pincode/Location.");we({event:"Enquiry_Form",eventCategory:"Enquiry form",eventAction:"Next",eventLabel:"NA",Pincode:ea,State:pe.state||"NA",City:pe.city||"NA",vehicle_type:pe.vehicleType,FormType:"ELV Form",section_name:"Vehicle Details"});if(((e,a)=>{var t,i;if(!e)return!1;const l=new Date(e),n=new Date,r=la.find((e=>e.displayName===a)),o=(null===r||void 0===r||null===(t=r.fields)||void 0===t||null===(i=t.Years)||void 0===i?void 0:i.value)||"",s=parseInt(o,10)||15,c=new Date(l);return c.setFullYear(c.getFullYear()+s),n<c})(pe.yearOfPurchase,pe.vehicleCategory))return Re("ageWarning"),void Ie(!0);Oe(3)},onBack:ca,filteredVehicleMakers:be,filteredModels:ge,locationSuggestionState:Ke,pincodeSuggestionList:Qe,onLocationSuggestion:async e=>{if(ye({pincode:e}),he(!1),!e.trim()||e.trim().length<3)return We(!1),void Ue([]);try{var a;const t=await na(e);Ue((null===t||void 0===t?void 0:t.data)||[]),We(Boolean(null===t||void 0===t||null===(a=t.data)||void 0===a?void 0:a.length))}catch(t){console.error("Location suggestion failed:",t),We(!1)}},onLocationSelection:async e=>{try{const a=await oa(e.geo),{pincode:t,state:i,city:l}=a||{};aa(t||""),ye({pincode:e.name,state:i||"",city:l||""}),he(!0);const n=await ra(t,pe.vehicleCategory),r=(null===n||void 0===n?void 0:n.stores)||[];He(r),r.length||(Re("noDealer"),Ie(!0),aa(""),ye({pincode:"",state:"",city:""}),he(!1))}catch(a){console.error("Location selection failed:",a)}finally{We(!1)}},setLocationSuggestionState:We,pushToDataLayer:we}),3===_e&&(0,v.jsx)(f,{disposalQuestions:(null===e||void 0===e||null===(M=e.returnSectionData)||void 0===M?void 0:M.DisposableQuestions)||[],disposalData:Ne,onChange:xe,onSubmit:e=>{e.preventDefault(),we({event:"Enquiry_Form",eventCategory:"Enquiry form",eventAction:"Next",eventLabel:"NA",FormType:"ELV Form",section_name:"Disposal Details"}),Oe(4)},onBack:ca,pushToDataLayer:we}),4===_e&&(0,v.jsx)(b,{vehicleCategories:(null===e||void 0===e||null===(P=e.returnSectionData)||void 0===P?void 0:P.VehicleCategory)||[],scrapValueText:null===e||void 0===e||null===(w=e.returnSectionData)||void 0===w||null===(_=w.ScrapValueText)||void 0===_?void 0:_.value,scrapMessage:null===e||void 0===e||null===(O=e.returnSectionData)||void 0===O||null===(q=O.ScrapMessage)||void 0===q?void 0:q.value,vehicleTerm:null===e||void 0===e||null===(I=e.returnSectionData)||void 0===I||null===(B=I.VehicleTerms)||void 0===B?void 0:B.value,vehicleData:pe,dealers:Ze,selectedDealerId:ze,onDealerSelect:da,onSubmit:async e=>{if(e.preventDefault(),ze){ia(!0);try{const e={CustomerName:ue.fullName,Email:ue.email,City:pe.city,Pincode:ea,CustomerState:pe.state,LeadId:Ge,UpdateDate:(new Date).toISOString().replace("T"," ").slice(0,23),EventIds:[2],UpdatedBy:1,ExtraAttributes:[{AttributeName:"Mobile",AttributeValue:ue.mobileNumber},{AttributeName:"AgreeToTerms",AttributeValue:String(ue.agreeToTerms)},{AttributeName:"VehicleCategory",AttributeValue:pe.vehicleCategory},{AttributeName:"VehicleType",AttributeValue:pe.vehicleType},{AttributeName:"VehicleMaker",AttributeValue:pe.vehicleMaker},{AttributeName:"VehicleModel",AttributeValue:pe.vehicleModel},{AttributeName:"YearOfPurchase",AttributeValue:pe.yearOfPurchase?pe.yearOfPurchase:"null"},{AttributeName:"DealerId",AttributeValue:ze},{AttributeName:"OriginalRC",AttributeValue:"yes"===Ne.originalRc?"true":"false"},{AttributeName:"KYCMatch",AttributeValue:"yes"===Ne.kycMatch?"true":"false"},{AttributeName:"Hypothecation",AttributeValue:"yes"===Ne.hypothecation?"true":"false"},{AttributeName:"CriminalRecord",AttributeValue:"yes"===Ne.criminalRecord?"true":"false"},{AttributeName:"PendingLiabilities",AttributeValue:"yes"===Ne.pendingLiabilities?"true":"false"}]},a=await(async e=>{try{const a=await fetch(o.submit_form,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!a.ok)throw new Error("Form submission failed");return a.json()}catch(a){throw console.error("Submit form failed:",a),a}})(e);if("200"===(null===a||void 0===a?void 0:a.Status)||null!==a&&void 0!==a&&a.Success){Ze.f
1ind((e=>e.dealer_id===ze));we({event:"Enquiry_Form",eventCategory:"Enquiry form",eventAction:"Submit",eventLabel:"Success",Pincode:ea,DealerName:Ye||"NA",vehicle_type:pe.vehicleType,State:pe.state||"NA",City:pe.city||"NA",FormType:"ELV Form",section_name:"Validation Details"}),we({event:"Enquiry_Form",eventCategory:"Enquiry form",eventAction:"Vehicle Scrap Confirmation",eventLabel:"NA",FormType:"ELV Form",section_name:"Validation Details"}),Oe(5)}else we({event:"Enquiry_Form",eventCategory:"Enquiry form",eventAction:"Submit",eventLabel:"Fail",Pincode:ea,vehicle_type:pe.vehicleType,State:pe.state||"NA",City:pe.city||"NA",FormType:"ELV Form",section_name:"Validation Details"}),alert("Submission failed. Please try again.")}catch(a){alert("An error occurred. Please try again.")}finally{ia(!1)}}else alert("Please select a dealer to continue.")},onBack:ca,isSubmitting:ta,mailSrc:se,pushToDataLayer:we}),5===_e&&(0,v.jsx)(N,{vehicleCategory:pe.vehicleCategory,vehicleCategories:(null===e||void 0===e||null===(R=e.returnSectionData)||void 0===R?void 0:R.VehicleCategory)||[],scrapValueText:null===e||void 0===e||null===(K=e.returnSectionData)||void 0===K||null===(W=K.ScrapValueText)||void 0===W?void 0:W.value,scrapMessage:null===e||void 0===e||null===(Q=e.returnSectionData)||void 0===Q||null===(U=Q.ScrapMessage)||void 0===U?void 0:U.value,scrapSuccessMessage:null===e||void 0===e||null===(Z=e.returnSectionData)||void 0===Z||null===(H=Z.ScrapSuccessMessage)||void 0===H?void 0:H.value,scrapCongratulations:null===e||void 0===e||null===(Y=e.returnSectionData)||void 0===Y||null===(J=Y.ScrapCongratulations)||void 0===J?void 0:J.value,scrapCompletionIcon:null===e||void 0===e||null===(z=e.returnSectionData)||void 0===z||null===(X=z.ScrapCompletionIcon)||void 0===X?void 0:X.value,vehicleTerm:null===e||void 0===e||null===(G=e.returnSectionData)||void 0===G||null===($=G.VehicleTerms)||void 0===$?void 0:$.value})]})})]})}),Se&&(0,v.jsx)(A,{otp:Ae,timer:je,otpError:Ce,isSubmitting:ta,otpInputRefs:De,onOtpChange:Ve,onOtpKeyDown:Fe,onOtpPaste:Me,onSubmit:async e=>{if(e.preventDefault(),!Ae.some((e=>""===e))){Le(""),ia(!0);try{const e=await(async e=>{try{const a={CustomerName:ue.fullName.trim(),Email:ue.email,MobileNumber:ue.mobileNumber,Source:ce,sourceId:de,OtpNumber:e},t=await fetch(o.verify_otp,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!t.ok)throw new Error("OTP verification failed");return t.json()}catch(a){throw console.error("Verify OTP failed:",a),a}})(Ae.join(""));var a;if("success"===(null===e||void 0===e?void 0:e.Result)||null!==e&&void 0!==e&&e.Success)we({event:"Enquiry_Form",eventCategory:"Enquiry form",eventAction:"Submit",eventLabel:"Success",ErrorMessage:(null===e||void 0===e?void 0:e.Message)||"NA",FormType:"ELV Form",section_name:"Contact Details"}),ke(!1),Pe(),Oe(2),$e(null===e||void 0===e?void 0:e.LeadId);else we({event:"Enquiry_Form",eventCategory:"Enquiry form",eventAction:"Submit",ErrorMessage:(null===e||void 0===e?void 0:e.Message)||"NA",eventLabel:"Fail",FormType:"ELV Form",section_name:"Contact Details"}),Le((null===e||void 0===e?void 0:e.Message)||"Invalid OTP. Please try again."),Ee(Array(Ae.length).fill("")),null===(a=De.current[0])||void 0===a||a.focus()}catch(i){var t;Le("Verification failed. Please try again."),Ee(Array(Ae.length).fill("")),null===(t=De.current[0])||void 0===t||t.focus()}finally{ia(!1)}}},onResend:async()=>{if(!(je>0))try{const a=await sa(ue.mobileNumber);var e;if("success"===(null===a||void 0===a?void 0:a.Result)||null!==a&&void 0!==a&&a.Success)Te(299),Pe(),null===(e=De.current[0])||void 0===e||e.focus()}catch(a){Le("Failed to resend OTP. Please try again.")}},onClose:()=>{ke(!1),Pe()},pushToDataLayer:we}),(0,v.jsx)(h,{isOpen:qe,onClose:()=>{"ageWarning"===Be&&we({event:"Enquiry_Form",eventCategory:"Enquiry form",eventAction:"Cancel",eventLabel:"NA",Pincode:ea,vehicle_type:pe.vehicleType,State:pe.state||"NA",City:pe.city||"NA",FormType:"ELV Form",section_name:"Vehicle Details"}),Ie(!1),Re("")},onConfirm:()=>{"ageWarning"===Be&&(we({event:"Enquiry_Form",eventCategory:"Enquiry form",eventAction:"Yes Proceed",eventLabel:"NA",Pincode:ea,vehicle_type:pe.vehicleType,State:pe.state||"NA",City:pe.city||"NA",FormType:"ELV Form",section_name:"Vehicle Details"}),Oe(3)),Ie(!1),Re("")},title:"noDealer"===Be?"Oops!":"Hold On!",message:"noDealer"===Be?(0,v.jsx)(v.Fragment,{children:"No dealer available for selected location."}):(0,v.jsxs)(v.Fragment,{children:["The selected vehicle is"," ",(0,v.jsxs)("span",{className:"warning-modal-highlight",children:["less than ",ma," old"]}),". Are you sure you want to proceed with scrapping?"]}),showActions:"noDealer"!==Be})]})}}}]); 2//# sourceMappingURL=91.889947bf.chunk.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.