@getcredify/credify-insurance-widget 1.36.0 → 1.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -113,5 +113,5 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
113
113
  transition-duration: 0.001ms !important;
114
114
  }
115
115
  }
116
- `}),m.jsx("div",{style:{background:"#F8FAFC",display:"flex",alignItems:"center",justifyContent:"center",padding:"2rem",fontFamily:"'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",height:"100%",minHeight:400,overflowY:"auto"},children:m.jsxs("div",{style:{width:"100%",maxWidth:560},children:[m.jsxs("div",{style:{textAlign:"center",marginBottom:40},children:[m.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8,background:o.accent+"12",border:`1px solid ${o.accent}30`,borderRadius:100,padding:"6px 16px",marginBottom:16},children:[m.jsx("span",{style:{fontSize:14},"aria-hidden":"true",children:o.icon}),m.jsx("span",{style:{fontSize:12,fontWeight:700,color:o.accent,letterSpacing:"0.1em",textTransform:"uppercase"},children:o.label})]}),m.jsx("h1",{style:{fontSize:26,fontWeight:700,color:"#0F172A",margin:0,letterSpacing:"-0.02em",lineHeight:1.3},children:G?"Connecting to top carriers":"Fetching your best rates"}),m.jsx("p",{style:{fontSize:14,color:"#64748B",marginTop:8,marginBottom:0},children:G?"Identifying the carriers eligible for your quote...":j?"Still gathering — a few carriers are taking a little longer...":"We're reaching out to multiple insurers on your behalf"})]}),m.jsx("div",{style:{display:"flex",justifyContent:"center",marginBottom:32},children:G?m.jsx("div",{style:{display:"flex",gap:20},children:[0,1,2,3,4].map(M=>m.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:6},children:[m.jsx("div",{style:{width:48,height:48,borderRadius:14,background:"#E2E8F0",animation:"skeletonPulse 1.4s ease-in-out infinite",animationDelay:`${M*.12}s`}}),m.jsx("div",{style:{width:40,height:8,borderRadius:4,background:"#E2E8F0",animation:"skeletonPulse 1.4s ease-in-out infinite",animationDelay:`${M*.12}s`}})]},`skeleton-${M}`))}):O?m.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8},children:[m.jsxs("div",{style:{width:64,height:64,borderRadius:18,background:O.color+"18",border:`2px solid ${O.color}`,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:700,fontSize:16,color:O.color,position:"relative",animation:"providerPulse 1.8s ease-in-out infinite"},children:[O.abbr,m.jsx("div",{style:{position:"absolute",inset:-5,borderRadius:22,border:`2px solid ${O.color}`,pointerEvents:"none",animation:"ringPulse 1.6s ease-in-out infinite"},"aria-hidden":"true"})]}),m.jsx("span",{style:{fontSize:13,fontWeight:600,color:O.color,letterSpacing:"0.04em"},children:O.name})]}):null}),m.jsxs("div",{className:`iq-card-fade ${_?"iq-card-visible":"iq-card-hidden"}`,style:{background:"#FFFFFF",borderRadius:24,border:"1px solid #E2E8F0",padding:32},children:[m.jsx("div",{style:{display:"flex",alignItems:"center",gap:20,marginBottom:28},children:G||!O?m.jsxs("div",{style:{flex:1,textAlign:"center",padding:"8px 0"},children:[m.jsx("p",{style:{fontSize:11,fontWeight:700,color:"#94A3B8",letterSpacing:"0.1em",textTransform:"uppercase",margin:"0 0 6px"},children:"Please wait"}),m.jsx("h2",{style:{fontSize:18,fontWeight:700,color:"#0F172A",margin:"0 0 6px",letterSpacing:"-0.02em"},children:"Checking eligible providers"}),m.jsx("p",{style:{fontSize:13,color:"#64748B",margin:0},children:"Reviewing your details against our carrier network"})]}):m.jsxs(m.Fragment,{children:[m.jsxs("div",{style:{position:"relative",flexShrink:0},children:[m.jsx(pT,{progress:p,color:O.color,size:80}),m.jsx("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center"},children:m.jsxs("span",{style:{fontSize:14,fontWeight:700,color:O.color},"aria-hidden":"true",children:[Math.round(p),"%"]})})]}),m.jsxs("div",{style:{flex:1},children:[m.jsx("p",{style:{fontSize:11,fontWeight:700,color:"#94A3B8",letterSpacing:"0.1em",textTransform:"uppercase",margin:"0 0 4px"},children:j?"Still checking":"Now checking"}),m.jsx("h2",{style:{fontSize:20,fontWeight:700,color:"#0F172A",margin:"0 0 6px",letterSpacing:"-0.02em"},children:O.name}),m.jsx("p",{className:"iq-status-text",style:{fontSize:13,color:"#64748B",margin:0},role:"status","aria-live":"polite",children:Pl[g]},`${u}-${g}`)]})]})}),m.jsxs("div",{children:[m.jsx("p",{style:{fontSize:11,fontWeight:700,color:"#94A3B8",letterSpacing:"0.08em",textTransform:"uppercase",margin:"0 0 8px"},children:G?"Initializing":"Gathering quotes"}),m.jsx("div",{style:{height:6,background:"#F1F5F9",borderRadius:100,overflow:"hidden"},children:m.jsx("div",{style:{height:"100%",width:"35%",background:o.accent,borderRadius:100,animation:"shimmerSlide 1.4s ease-in-out infinite"},"aria-hidden":"true"})})]})]})]})})]})}function Zb({onGoBack:e}){return m.jsxs("section",{className:"mt-4",role:"alert","aria-labelledby":"submission-error-title",children:[m.jsxs("div",{className:"rounded-xl border border-red-200 bg-red-50 p-5",children:[m.jsx("h3",{id:"submission-error-title",className:"text-base font-semibold text-red-700",children:"Sorry, quote submission failed"}),m.jsx("p",{className:"mt-2 text-sm text-red-700",children:"We ran into an issue submitting your quote. Our team will investigate and get back to you soon."})]}),m.jsx("div",{className:"mt-5",children:m.jsx("button",{type:"button",onClick:e,className:"h-12 w-full rounded-full border border-gray-300 text-text-primary hover:bg-gray-50 transition",children:"Go back"})})]})}var Il={intercomAppId:"",cobrowseLicense:""};function gT(){try{return typeof Il<"u"&&Il?Il:{}}catch{return{}}}function yT(e){const t=gT(),r=e?.intercomAppId??t.intercomAppId,n=e?.cobrowseLicense??t.cobrowseLicense;return{enabled:(e?.enabled??!0)&&!!(r||n),intercomAppId:r||void 0,cobrowseLicense:n||void 0,proactiveOnError:e?.proactiveOnError??!0}}const Ml=new Map;function Gb(e){if(typeof document>"u")return Promise.reject(new Error("loadScript called without a document"));const t=Ml.get(e);if(t)return t;const r=new Promise((n,a)=>{const o=document.createElement("script");o.src=e,o.async=!0,o.onload=()=>n(),o.onerror=()=>{Ml.delete(e),a(new Error(`Failed to load script: ${e}`))},document.head.appendChild(o)});return Ml.set(e,r),r}let Fl=!1;function bT(){if(typeof window.Intercom=="function")return window.Intercom;const e=function(...t){e.c?.(t)};return e.q=[],e.c=t=>{e.q.push(t)},window.Intercom=e,e}function _T(e){const t={app_id:e,hide_default_launcher:!0},r=ui();return r&&(t.quote_id=r),t}function qb(e){if(typeof window>"u")return;bT();const t=_T(e);if(window.intercomSettings=t,Fl){window.Intercom("update",t);return}window.Intercom("boot",t),Fl=!0,Gb(`https://widget.intercom.io/widget/${e}`).catch(()=>{})}function vT(){typeof window?.Intercom=="function"&&window.Intercom("show")}function ET(e){typeof window?.Intercom=="function"&&window.Intercom("showNewMessage",e)}function DT(e){typeof window?.Intercom=="function"&&window.Intercom("update",e)}function ST(){if(typeof window?.Intercom=="function")try{window.Intercom("shutdown")}catch{}Fl=!1}const CT="https://js.cobrowse.io/CobrowseIO.js";let Ol=!1;async function wT(e){await Gb(CT);const t=window.CobrowseIO;if(!t)return null;if(!Ol){t.license=e,t.redactedViews=["input","select","textarea","[data-credify-redact]"],t.customData={quote_id:ui()??void 0,device_name:"Credify Insurance Widget"},t.confirmSession=()=>Promise.resolve(typeof window<"u"?window.confirm("Allow a Credify support agent to view your screen?"):!1);try{await t.client?.()}catch{}t.start?.(),Ol=!0}return t}async function xT(e){if(typeof window>"u")return null;try{const t=await wT(e);return t?.createSessionCode?await t.createSessionCode():null}catch{return null}}function $T(){try{window.CobrowseIO?.stop?.()}catch{}Ol=!1}const AT="Hi! It looks like something went wrong submitting your quote. We're here to help — tell us what you were trying to do and we'll jump in.";let At=null,Ei=null,Bl=!1;function kT(e){Qb();const t=yT(e);if(At=t,!!t.enabled&&t.proactiveOnError&&t.intercomAppId){const r=n=>{Bl||(Bl=!0,qb(t.intercomAppId),DT({last_quote_error:n?.reason??"unknown"}),ET(AT))};Db("submissionFailed",r),Ei=r}}function Kb(){!At?.enabled||!At.intercomAppId||(qb(At.intercomAppId),vT())}function Yb(){return!At?.enabled||!At.cobrowseLicense?Promise.resolve(null):xT(At.cobrowseLicense)}function TT(){return!!(At?.enabled&&At.intercomAppId)}function PT(){return!!(At?.enabled&&At.cobrowseLicense)}function Qb(){Ei&&(Sb("submissionFailed",Ei),Ei=null),ST(),$T(),Bl=!1,At=null}const IT="Chat with our support team in real time — we'll help you finish your quote.",MT="Share your screen with a support agent so they can see what you see and guide you in real time. We'll generate a secure code — share it with your agent to begin. Your personal information stays hidden.",Xb="inline-flex h-9 w-9 items-center justify-center rounded-full text-slate-500 hover:bg-slate-100 hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-slate-400 disabled:opacity-60",Wb="pointer-events-none absolute bottom-full left-1/2 z-10 mb-2 w-60 -translate-x-1/2 rounded-lg bg-slate-800 px-3 py-2 text-center text-xs leading-snug text-white shadow-lg transition-opacity duration-150";function FT(){const e=TT(),t=PT(),[r,n]=d.useState(null),[a,o]=d.useState(!1),[i,s]=d.useState(!1),[u,l]=d.useState(null),c=d.useCallback(async()=>{o(!0),s(!1);try{const f=await Yb();f?n(f):s(!0)}finally{o(!1)}},[]);return!e&&!t?null:m.jsxs("div",{className:"flex flex-col items-center gap-1.5 text-sm text-slate-500",children:[m.jsx("span",{className:"font-medium",children:"Need help?"}),m.jsxs("div",{className:"inline-flex items-center gap-1",children:[e&&m.jsxs("span",{className:"relative inline-flex",onMouseEnter:()=>l("chat"),onMouseLeave:()=>l(null),children:[m.jsx("button",{type:"button",onClick:Kb,onFocus:()=>l("chat"),onBlur:()=>l(null),onKeyDown:f=>{f.key==="Escape"&&(f.stopPropagation(),l(null))},"aria-label":"Chat with support","aria-describedby":"credify-chat-tooltip",className:Xb,children:m.jsx("svg",{className:"h-5 w-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:m.jsx("path",{d:"M21 11.5a8.38 8.38 0 0 1-8.5 8.5 9 9 0 0 1-3.8-.8L3 21l1.3-4.2A8.38 8.38 0 0 1 3.5 11.5 8.5 8.5 0 0 1 12 3a8.38 8.38 0 0 1 9 8.5Z",strokeLinejoin:"round"})})}),m.jsx("span",{id:"credify-chat-tooltip",role:"tooltip",className:`${Wb} ${u==="chat"?"opacity-100":"opacity-0"}`,children:IT})]}),e&&t&&m.jsx("span",{className:"mx-1 h-6 w-px bg-slate-200","aria-hidden":"true"}),t&&m.jsxs("span",{className:"relative inline-flex",onMouseEnter:()=>l("screen"),onMouseLeave:()=>l(null),children:[m.jsx("button",{type:"button",onClick:c,disabled:a,onFocus:()=>l("screen"),onBlur:()=>l(null),onKeyDown:f=>{f.key==="Escape"&&(f.stopPropagation(),l(null))},"aria-label":"Share your screen with an agent","aria-describedby":"credify-cobrowse-tooltip",className:Xb,children:a?m.jsx("span",{className:"h-4 w-4 animate-spin rounded-full border-2 border-slate-300 border-t-slate-600","aria-hidden":"true"}):m.jsxs("svg",{className:"h-5 w-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[m.jsx("rect",{x:"2.5",y:"4",width:"19",height:"13",rx:"2"}),m.jsx("path",{d:"M8 21h8M12 17v4",strokeLinecap:"round"}),m.jsx("path",{d:"M12 13V8m0 0-2 2m2-2 2 2",strokeLinecap:"round",strokeLinejoin:"round"})]})}),m.jsx("span",{id:"credify-cobrowse-tooltip",role:"tooltip",className:`${Wb} ${u==="screen"?"opacity-100":"opacity-0"}`,children:MT})]})]}),r&&m.jsxs("span",{children:["Read this code to your agent: ",m.jsx("strong",{className:"tracking-widest text-text-primary",children:r})]}),i&&m.jsx("span",{className:"text-red-600",children:"Couldn't start screen sharing. Please try chat instead."})]})}const Jb="credify_rt";let Di=null;function OT(){try{if(typeof window>"u")return;const e=new URL(window.location.href),t=e.searchParams.get(Jb);if(!t)return;Di=t,e.searchParams.delete(Jb),window.history.replaceState(window.history.state,"",e.toString())}catch(e){console.error("Failed to capture resume token from URL:",e)}}function BT(){return Di!==null}function LT(){const e=Di;return Di=null,e}const e_="credify_test",t_="credify_test_mode";let Si=!1;function RT(e){return e===""||/^(1|true|yes)$/i.test(e.trim())}function NT(){try{if(typeof window>"u")return;window.sessionStorage?.getItem(t_)==="1"&&(Si=!0);const e=new URL(window.location.href),t=e.searchParams.get(e_);if(t!==null){Si=RT(t);try{window.sessionStorage?.setItem(t_,Si?"1":"0")}catch{}e.searchParams.delete(e_),window.history.replaceState(window.history.state,"",e.toString())}}catch(e){console.error("Failed to capture test mode from URL:",e)}}function UT(){return Si}function ye(e){if(e===!0)return"Yes";if(e===!1)return"No"}function mt(e){if(e)try{const t=typeof e=="string"?new Date(e):e;return isNaN(t.getTime())?void 0:t.toISOString().split("T")[0]}catch{return}}function HT(e){const t=e,r={};t.phone&&(r.phone=t.phone),t.first_name&&(r.first_name=t.first_name),t.last_name&&(r.last_name=t.last_name),t.email&&(r.email=t.email),t.date_of_birth&&(r.date_of_birth=mt(t.date_of_birth)),t.product&&(r.product=t.product),t.state&&(r.state=t.state),t.postal_code&&(r.postal_code=t.postal_code);const n=[];t.line_1&&n.push(t.line_1),t.line_2&&n.push(t.line_2),t.city&&n.push(t.city),t.state&&n.push(t.state),t.postal_code&&n.push(t.postal_code),n.length>0&&(r.address=n.join(", ")),typeof t.ssn_display=="string"&&(r.ssn_display=t.ssn_display),t.years_at_address!==null&&t.years_at_address!==void 0&&(r.years_at_address=t.years_at_address),t.months_at_address!==null&&t.months_at_address!==void 0&&(r.months_at_address=t.months_at_address),t.move_in_date&&(r.move_in_date=mt(t.move_in_date));const a=[];t.prior_line_1&&a.push(t.prior_line_1),t.prior_line_2&&a.push(t.prior_line_2),t.prior_city&&a.push(t.prior_city),t.prior_state&&a.push(t.prior_state),t.prior_postal_code&&a.push(t.prior_postal_code),a.length>0&&(r.prior_address=a.join(", ")),t.years_at_prior_address!==null&&t.years_at_prior_address!==void 0&&(r.years_at_prior_address=t.years_at_prior_address),t.is_mailing_address_different!==null&&t.is_mailing_address_different!==void 0&&(r.is_mailing_address_different=ye(t.is_mailing_address_different)),t.mailing_address&&(r.mailing_address=t.mailing_address),t.effective_date&&(r.effective_date=mt(t.effective_date)),t.auto_has_prior_insurance!==null&&t.auto_has_prior_insurance!==void 0&&(r.auto_has_prior_insurance=ye(t.auto_has_prior_insurance)),t.auto_prior_expiration_date&&(r.auto_prior_expiration_date=mt(t.auto_prior_expiration_date)),t.auto_prior_carrier_name&&(r.auto_prior_carrier_name=t.auto_prior_carrier_name),t.auto_prior_liability_limit&&(r.auto_prior_liability_limit=t.auto_prior_liability_limit),t.auto_reason_for_no_insurance&&(r.auto_reason_for_no_insurance=t.auto_reason_for_no_insurance),t.auto_prior_years!==null&&t.auto_prior_years!==void 0&&(r.auto_prior_years=t.auto_prior_years),t.auto_prior_months!==null&&t.auto_prior_months!==void 0&&(r.auto_prior_months=t.auto_prior_months),t.auto_continuous_coverage_years!==null&&t.auto_continuous_coverage_years!==void 0&&(r.auto_continuous_coverage_years=t.auto_continuous_coverage_years),t.auto_cancelled_declined_refused_to_renew!==null&&t.auto_cancelled_declined_refused_to_renew!==void 0&&(r.auto_cancelled_declined_refused_to_renew=ye(t.auto_cancelled_declined_refused_to_renew)),t.auto_current_annual_premium_cents!==null&&t.auto_current_annual_premium_cents!==void 0&&(r.auto_current_annual_premium_cents=t.auto_current_annual_premium_cents),t.policy_bi&&(r.policy_bi=t.policy_bi),t.policy_um&&(r.policy_um=t.policy_um),t.policy_pd&&(r.policy_pd=t.policy_pd),t.policy_mp&&(r.policy_mp=t.policy_mp),t.policy_umpd&&(r.policy_umpd=t.policy_umpd),t.policy_pip&&(r.policy_pip=t.policy_pip),t.policy_auto_death_indemnity&&(r.policy_auto_death_indemnity=t.policy_auto_death_indemnity),t.driver_vehicle_assignments&&(r.driver_vehicle_assignments=t.driver_vehicle_assignments),t.home_has_prior_insurance!==null&&t.home_has_prior_insurance!==void 0&&(r.home_has_prior_insurance=ye(t.home_has_prior_insurance)),t.home_prior_expiration_date&&(r.home_prior_expiration_date=mt(t.home_prior_expiration_date)),t.home_prior_carrier_name&&(r.home_prior_carrier_name=t.home_prior_carrier_name),t.home_prior_years!==null&&t.home_prior_years!==void 0&&(r.home_prior_years=t.home_prior_years),t.home_continuous_coverage_years!==null&&t.home_continuous_coverage_years!==void 0&&(r.home_continuous_coverage_years=t.home_continuous_coverage_years),t.property_insurance_cancelled!==null&&t.property_insurance_cancelled!==void 0&&(r.property_insurance_cancelled=ye(t.property_insurance_cancelled)),t.lapse_in_coverage!==null&&t.lapse_in_coverage!==void 0&&(r.lapse_in_coverage=ye(t.lapse_in_coverage)),t.year_built!==null&&t.year_built!==void 0&&(r.year_built=t.year_built),t.number_of_units!==null&&t.number_of_units!==void 0&&(r.number_of_units=t.number_of_units),t.number_of_stories!==null&&t.number_of_stories!==void 0&&(r.number_of_stories=t.number_of_stories),t.number_of_beds!==null&&t.number_of_beds!==void 0&&(r.number_of_beds=t.number_of_beds),t.number_of_full_baths!==null&&t.number_of_full_baths!==void 0&&(r.number_of_full_baths=t.number_of_full_baths),t.number_of_partial_baths!==null&&t.number_of_partial_baths!==void 0&&(r.number_of_partial_baths=t.number_of_partial_baths),t.under_construction!==null&&t.under_construction!==void 0&&(r.under_construction=ye(t.under_construction)),t.distance_from_fire_hydrant_ft&&(r.distance_from_fire_hydrant_ft=t.distance_from_fire_hydrant_ft),t.distance_from_fire_station_miles&&(r.distance_from_fire_station_miles=t.distance_from_fire_station_miles),t.architectural_style&&(r.architectural_style=t.architectural_style),t.dwelling_type&&(r.dwelling_type=t.dwelling_type),t.construction_quality&&(r.construction_quality=t.construction_quality),t.located_over_water!==null&&t.located_over_water!==void 0&&(r.located_over_water=t.located_over_water),t.construction_type&&(r.construction_type=t.construction_type),t.exterior_wall_type&&(r.exterior_wall_type=t.exterior_wall_type),t.foundation_type&&(r.foundation_type=t.foundation_type),t.roof_material_type&&(r.roof_material_type=t.roof_material_type),t.roof_shape&&(r.roof_shape=t.roof_shape),t.roof_updated_type&&(r.roof_updated_type=t.roof_updated_type),t.year_roof_updated!==null&&t.year_roof_updated!==void 0&&(r.year_roof_updated=t.year_roof_updated),t.mit_credit_form!==null&&t.mit_credit_form!==void 0&&(r.mit_credit_form=ye(t.mit_credit_form)),t.storm_shutters!==null&&t.storm_shutters!==void 0&&(r.storm_shutters=ye(t.storm_shutters)),t.heating_type&&(r.heating_type=t.heating_type),t.oil_tank_location&&(r.oil_tank_location=t.oil_tank_location),t.heating_fuel_type&&(r.heating_fuel_type=t.heating_fuel_type),t.number_of_fireplaces!==null&&t.number_of_fireplaces!==void 0&&(r.number_of_fireplaces=t.number_of_fireplaces),t.basement_type&&(r.basement_type=t.basement_type),t.parking_type&&(r.parking_type=t.parking_type),t.number_of_parking_spaces!==null&&t.number_of_parking_spaces!==void 0&&(r.number_of_parking_spaces=t.number_of_parking_spaces),t.plumbing_type&&(r.plumbing_type=t.plumbing_type),t.pool_type&&(r.pool_type=t.pool_type),t.total_area_sq_ft!==null&&t.total_area_sq_ft!==void 0&&(r.total_area_sq_ft=t.total_area_sq_ft),t.parcel_area_sq_ft!==null&&t.parcel_area_sq_ft!==void 0&&(r.parcel_area_sq_ft=t.parcel_area_sq_ft),t.residence_type&&(r.residence_type=t.residence_type),t.usage_type&&(r.usage_type=t.usage_type),t.household_size!==null&&t.household_size!==void 0&&(r.household_size=t.household_size),t.number_of_mortgagees!==null&&t.number_of_mortgagees!==void 0&&(r.number_of_mortgagees=t.number_of_mortgagees),t.has_dog!==null&&t.has_dog!==void 0&&(r.has_dog=ye(t.has_dog)),t.dog_breed_type&&(r.dog_breed_type=t.dog_breed_type),t.number_of_dogs!==null&&t.number_of_dogs!==void 0&&(r.number_of_dogs=t.number_of_dogs),t.has_vicious_animals!==null&&t.has_vicious_animals!==void 0&&(r.has_vicious_animals=ye(t.has_vicious_animals)),t.has_business_on_premises!==null&&t.has_business_on_premises!==void 0&&(r.has_business_on_premises=ye(t.has_business_on_premises)),t.business_class&&(r.business_class=t.business_class),t.occupancy_type&&(r.occupancy_type=t.occupancy_type),t.short_term_rental!==null&&t.short_term_rental!==void 0&&(r.short_term_rental=ye(t.short_term_rental)),t.sale_price_cents!==null&&t.sale_price_cents!==void 0&&(r.sale_price_cents=Math.round(Number(t.sale_price_cents)/100)),t.number_of_families!==null&&t.number_of_families!==void 0&&(r.number_of_families=t.number_of_families),t.number_of_units_in_firewall!==null&&t.number_of_units_in_firewall!==void 0&&(r.number_of_units_in_firewall=t.number_of_units_in_firewall),t.heating_update_yn!==null&&t.heating_update_yn!==void 0&&(r.heating_update_yn=ye(t.heating_update_yn)),t.heating_update_type&&(r.heating_update_type=t.heating_update_type),t.heating_update_year!==null&&t.heating_update_year!==void 0&&(r.heating_update_year=t.heating_update_year),t.plumbing_update_yn!==null&&t.plumbing_update_yn!==void 0&&(r.plumbing_update_yn=ye(t.plumbing_update_yn)),t.plumbing_update_type&&(r.plumbing_update_type=t.plumbing_update_type),t.plumbing_update_year!==null&&t.plumbing_update_year!==void 0&&(r.plumbing_update_year=t.plumbing_update_year),t.electrical_update_yn!==null&&t.electrical_update_yn!==void 0&&(r.electrical_update_yn=ye(t.electrical_update_yn)),t.electrical_update_type&&(r.electrical_update_type=t.electrical_update_type),t.electrical_update_year!==null&&t.electrical_update_year!==void 0&&(r.electrical_update_year=t.electrical_update_year),t.electric_circuit_breaker!==null&&t.electric_circuit_breaker!==void 0&&(r.electric_circuit_breaker=ye(t.electric_circuit_breaker)),t.dwelling_replacement_cost!==null&&t.dwelling_replacement_cost!==void 0&&(r.dwelling_replacement_cost=t.dwelling_replacement_cost),t.other_structures_coverage!==null&&t.other_structures_coverage!==void 0&&(r.other_structures_coverage=t.other_structures_coverage),t.personal_property_coverage!==null&&t.personal_property_coverage!==void 0&&(r.personal_property_coverage=t.personal_property_coverage),t.loss_of_use_coverage!==null&&t.loss_of_use_coverage!==void 0&&(r.loss_of_use_coverage=t.loss_of_use_coverage),t.personal_liability&&(r.personal_liability=t.personal_liability),t.dwelling_medical_payments&&(r.dwelling_medical_payments=t.dwelling_medical_payments),t.all_perils_deductible&&(r.all_perils_deductible=t.all_perils_deductible),t.windstorm_deductible&&(r.windstorm_deductible=t.windstorm_deductible),t.has_garage!==null&&t.has_garage!==void 0&&(r.has_garage=ye(t.has_garage)),t.has_pool!==null&&t.has_pool!==void 0&&(r.has_pool=ye(t.has_pool)),t.has_trampoline!==null&&t.has_trampoline!==void 0&&(r.has_trampoline=ye(t.has_trampoline)),t.gender&&(r.gender=t.gender),t.marital_status&&(r.marital_status=t.marital_status),t.employment_industry&&(r.employment_industry=t.employment_industry),t.occupation&&(r.occupation=t.occupation),t.has_co_applicant!==null&&t.has_co_applicant!==void 0&&(r.has_co_applicant=ye(t.has_co_applicant)),t.co_applicant_first_name&&(r.co_applicant_first_name=t.co_applicant_first_name),t.co_applicant_middle_name&&(r.co_applicant_middle_name=t.co_applicant_middle_name),t.co_applicant_last_name&&(r.co_applicant_last_name=t.co_applicant_last_name),t.co_applicant_gender&&(r.co_applicant_gender=t.co_applicant_gender),t.co_applicant_marital_status&&(r.co_applicant_marital_status=t.co_applicant_marital_status),t.co_applicant_relationship&&(r.co_applicant_relationship=t.co_applicant_relationship),t.co_applicant_date_of_birth&&(r.co_applicant_date_of_birth=mt(t.co_applicant_date_of_birth)),t.co_applicant_employment_industry&&(r.co_applicant_employment_industry=t.co_applicant_employment_industry),t.co_applicant_occupation&&(r.co_applicant_occupation=t.co_applicant_occupation),t.retiree_discount!==null&&t.retiree_discount!==void 0&&(r.retiree_discount=ye(t.retiree_discount)),t.gated_community_discount!==null&&t.gated_community_discount!==void 0&&(r.gated_community_discount=ye(t.gated_community_discount)),t.multi_policy_discount!==null&&t.multi_policy_discount!==void 0&&(r.multi_policy_discount=ye(t.multi_policy_discount)),t.non_smoker_discount!==null&&t.non_smoker_discount!==void 0&&(r.non_smoker_discount=ye(t.non_smoker_discount)),t.first_time_buyer_discount!==null&&t.first_time_buyer_discount!==void 0&&(r.first_time_buyer_discount=ye(t.first_time_buyer_discount)),t.fire_detection_system!==null&&t.fire_detection_system!==void 0&&(r.fire_detection_system=ye(t.fire_detection_system)),t.burglar_alarm_system!==null&&t.burglar_alarm_system!==void 0&&(r.burglar_alarm_system=ye(t.burglar_alarm_system)),t.burglar_alarm_system_type&&(r.burglar_alarm_system_type=t.burglar_alarm_system_type),t.smoke_detectors!==null&&t.smoke_detectors!==void 0&&(r.smoke_detectors=ye(t.smoke_detectors)),t.sprinkler_system!==null&&t.sprinkler_system!==void 0&&(r.sprinkler_system=ye(t.sprinkler_system)),t.sprinkler_system_type&&(r.sprinkler_system_type=t.sprinkler_system_type),t.gas_leakage_detector!==null&&t.gas_leakage_detector!==void 0&&(r.gas_leakage_detector=ye(t.gas_leakage_detector)),t.deadbolt_locks!==null&&t.deadbolt_locks!==void 0&&(r.deadbolt_locks=ye(t.deadbolt_locks)),t.fire_extinguisher!==null&&t.fire_extinguisher!==void 0&&(r.fire_extinguisher=ye(t.fire_extinguisher)),t.order_credit_authorized!==null&&t.order_credit_authorized!==void 0&&(r.order_credit_authorized=ye(t.order_credit_authorized)),t.has_health_insurance_auto_accident!==null&&t.has_health_insurance_auto_accident!==void 0&&(r.has_health_insurance_auto_accident=ye(t.has_health_insurance_auto_accident)),t.is_corporation!==null&&t.is_corporation!==void 0&&(r.is_corporation=ye(t.is_corporation)),t.named_insured_foreclosure_repo_bankruptcy!==null&&t.named_insured_foreclosure_repo_bankruptcy!==void 0&&(r.named_insured_foreclosure_repo_bankruptcy=ye(t.named_insured_foreclosure_repo_bankruptcy)),t.named_insured_convicted_insurance_fraud!==null&&t.named_insured_convicted_insurance_fraud!==void 0&&(r.named_insured_convicted_insurance_fraud=ye(t.named_insured_convicted_insurance_fraud));const o={};if(t.vehicles)for(const i of t.vehicles)i.quote_vehicle_id&&i.vin&&(o[i.quote_vehicle_id]=i.vin);return t.drivers&&t.drivers.length>0?(r.drivers="Yes",r.drivers__items=t.drivers.map(i=>{const s=i,u={};s.first_name&&(u.first_name=s.first_name),s.middle_name&&(u.middle_name=s.middle_name),s.last_name&&(u.last_name=s.last_name),s.date_of_birth&&(u.date_of_birth=mt(s.date_of_birth)),s.gender&&(u.gender=s.gender),s.marital_status&&(u.marital_status=s.marital_status),s.relationship_to_insured&&(u.relationship_to_insured=s.relationship_to_insured),s.is_registered_owner!==null&&s.is_registered_owner!==void 0&&(u.is_registered_owner=s.is_registered_owner?"Yes":"No"),s.license_state&&(u.license_state=s.license_state),s.license_status&&(u.license_status=s.license_status),s.license_number&&(u.license_number=s.license_number),s.date_first_licensed&&(u.date_first_licensed=mt(s.date_first_licensed)),s.education_level&&(u.education_level=Oy(s.education_level)),s.occupation&&(u.occupation=By(s.occupation)),s.industry&&(u.industry=ai(s.industry)),s.employment_status&&(u.employment_status=s.employment_status),s.last_5_years_license_suspended_or_revoked!==null&&s.last_5_years_license_suspended_or_revoked!==void 0&&(u.last_5_years_license_suspended_or_revoked=ye(s.last_5_years_license_suspended_or_revoked)),s.accident_prevention_course!==null&&s.accident_prevention_course!==void 0&&(u.accident_prevention_course=ye(s.accident_prevention_course)),s.accident_prevention_course_date&&(u.accident_prevention_course_date=mt(s.accident_prevention_course_date)),s.sr22!==null&&s.sr22!==void 0&&(u.sr22=ye(s.sr22));const l=s.ssn_display;typeof l=="string"&&(u.ssn_display=l);const c=s.driver_violations;c&&c.length>0&&(u.driver_violations="Yes",u.driver_violations__items=c.map(h=>{const g={};return h.code&&(g.code=h.code),h.occurred_at&&(g.occurred_at=mt(h.occurred_at)),g}));const f=s.driver_accidents;f&&f.length>0&&(u.driver_accidents="Yes",u.driver_accidents__items=f.map(h=>{const g={};return h.occurred_at&&(g.occurred_at=mt(h.occurred_at)),h.description&&(g.description=h.description),h.quote_vehicle_id&&(g.quote_vehicle_id=o[h.quote_vehicle_id]??h.quote_vehicle_id),h.property_damage_amount_paid_cents!==null&&h.property_damage_amount_paid_cents!==void 0&&(g.property_damage_amount_paid_cents=h.property_damage_amount_paid_cents),h.personal_injury_amount_paid_cents!==null&&h.personal_injury_amount_paid_cents!==void 0&&(g.personal_injury_amount_paid_cents=h.personal_injury_amount_paid_cents),g}));const p=s.losses;return p&&p.length>0&&(u.losses="Yes",u.losses__items=p.map(h=>{const g={};return h.description&&(g.description=h.description),h.date_of_incident&&(g.date_of_incident=mt(h.date_of_incident)),h.amount_paid_cents!==null&&h.amount_paid_cents!==void 0&&(g.amount_paid_cents=h.amount_paid_cents),h.quote_vehicle_id&&(g.quote_vehicle_id=o[h.quote_vehicle_id]??h.quote_vehicle_id),g})),u})):r.drivers="No",t.vehicles&&t.vehicles.length>0?(r.vehicles="Yes",r.vehicles__items=t.vehicles.map(i=>{const s=i,u={};s.vin&&(u.vin=s.vin),s.year!==null&&s.year!==void 0&&(u.year=String(s.year)),s.make&&(u.make=s.make),s.model&&(u.model=s.model),s.body_style&&(u.body_style=s.body_style),s.ownership_type&&(u.ownership_type=s.ownership_type),s.usage&&(u.usage=s.usage),s.annual_mileage!==null&&s.annual_mileage!==void 0&&(u.annual_mileage=s.annual_mileage),s.miles_to_work!==null&&s.miles_to_work!==void 0&&(u.miles_to_work=s.miles_to_work),s.percent_to_work!==null&&s.percent_to_work!==void 0&&(u.percent_to_work=s.percent_to_work);const l=[];return s.garaging_address_line_1&&l.push(s.garaging_address_line_1),s.garaging_address_line_2&&l.push(s.garaging_address_line_2),s.garaging_address_city&&l.push(s.garaging_address_city),s.garaging_address_state&&l.push(s.garaging_address_state),s.garaging_address_postal_code&&l.push(s.garaging_address_postal_code),l.length>0&&(u.garaging_address=l.join(", ")),s.new_when_purchased!==null&&s.new_when_purchased!==void 0&&(u.new_when_purchased=ye(s.new_when_purchased)),s.purchase_date&&(u.purchase_date=mt(s.purchase_date)),s.anti_theft_type&&(u.anti_theft_type=s.anti_theft_type),s.passive_restraint_type&&(u.passive_restraint_type=s.passive_restraint_type),s.anti_lock_brakes!==null&&s.anti_lock_brakes!==void 0&&(u.anti_lock_brakes=ye(s.anti_lock_brakes)),s.daytime_running_lights!==null&&s.daytime_running_lights!==void 0&&(u.daytime_running_lights=ye(s.daytime_running_lights)),s.custom_equipment_value_cents!==null&&s.custom_equipment_value_cents!==void 0&&(u.custom_equipment_value_cents=s.custom_equipment_value_cents),s.cost_new_value_cents!==null&&s.cost_new_value_cents!==void 0&&(u.cost_new_value_cents=s.cost_new_value_cents),s.stated_value_amount_cents!==null&&s.stated_value_amount_cents!==void 0&&(u.stated_value_amount_cents=s.stated_value_amount_cents),s.vehicle_has_modifications!==null&&s.vehicle_has_modifications!==void 0&&(u.vehicle_has_modifications=ye(s.vehicle_has_modifications)),s.vehicle_garaged_at_residence!==null&&s.vehicle_garaged_at_residence!==void 0&&(u.vehicle_garaged_at_residence=ye(s.vehicle_garaged_at_residence)),s.vehicle_comp_deductible&&(u.vehicle_comp_deductible=s.vehicle_comp_deductible),s.vehicle_coll_deductible&&(u.vehicle_coll_deductible=s.vehicle_coll_deductible),s.vehicle_towing_and_labor&&(u.vehicle_towing_and_labor=s.vehicle_towing_and_labor),s.vehicle_transportation_expense&&(u.vehicle_transportation_expense=s.vehicle_transportation_expense),s.vehicle_full_glass!==null&&s.vehicle_full_glass!==void 0&&(u.vehicle_full_glass=ye(s.vehicle_full_glass)),s.vehicle_loan_lease!==null&&s.vehicle_loan_lease!==void 0&&(u.vehicle_loan_lease=ye(s.vehicle_loan_lease)),s.coverages&&s.coverages.length>0&&(u.coverages__items=s.coverages.map(c=>{const f={};return c.type&&(f.type=c.type),c.per_person_limit_cents!==null&&c.per_person_limit_cents!==void 0&&(f.per_person_limit_cents=c.per_person_limit_cents),c.per_incident_limit_cents!==null&&c.per_incident_limit_cents!==void 0&&(f.per_incident_limit_cents=c.per_incident_limit_cents),c.per_incident_limit_percent!==null&&c.per_incident_limit_percent!==void 0&&(f.per_incident_limit_percent=c.per_incident_limit_percent),c.per_day_limit_cents!==null&&c.per_day_limit_cents!==void 0&&(f.per_day_limit_cents=c.per_day_limit_cents),c.deductible_cents!==null&&c.deductible_cents!==void 0&&(f.deductible_cents=c.deductible_cents),c.is_declined!==null&&c.is_declined!==void 0&&(f.is_declined=ye(c.is_declined)),f})),s.vehicle_lienholders&&s.vehicle_lienholders.length>0&&(u.vehicle_lienholders__items=s.vehicle_lienholders.map(c=>{const f={};return c.name&&(f.name=c.name),c.type&&(f.type=c.type),c.line_1&&(f.line_1=c.line_1),c.line_2&&(f.line_2=c.line_2),c.city&&(f.city=c.city),c.state&&(f.state=c.state),c.postal_code&&(f.postal_code=c.postal_code),c.phone&&(f.phone=c.phone),c.fax&&(f.fax=c.fax),f})),u})):r.vehicles="No",t.losses&&t.losses.length>0?(r.home_losses="Yes",r.home_losses__items=t.losses.map(i=>{const s={};return i.description&&(s.description=i.description),i.date_of_incident&&(s.date_of_incident=mt(i.date_of_incident)),i.amount_paid_cents!==null&&i.amount_paid_cents!==void 0&&(s.amount_paid_cents=Math.round(Number(i.amount_paid_cents)/100)),s})):r.home_losses="No",r}const VT={Zip:"ZIP Code",Email:"Email",Product:"Product & Address",Home:"Home Details",Vehicle:"Vehicle",Name:"Name & DOB",Driver:"Operator",AutoCurrentCarrier:"Policy",HomeCurrentCarrier:"Policy",HomePolicy:"Policy",BundlePolicy:"Policy",Demographics:"Applicant",Ssn:"SSN",Phone:"Phone",SMSVerification:"Verify",AutoPolicy:"Policy",Customer:"Applicant",HomeCustomer:"Applicant",BundleCustomer:"Applicant",HomeConstruction:"Structure",HomeFeatures:"Features"};function zT(e){return VT[e]||e}const r_=new Set(["Zip","Product","Driver","Vehicle"]);function jT(e){return e?Array.isArray(e.drivers__items)?e.drivers__items.length:Array.isArray(e.drivers)?e.drivers.length:null:null}function n_(e,t){const r=jT(t),n=e.filter(o=>o.key!=="AutoPolicy"),a=n.length>0?n:e;return a}function ZT(e,t){const r=e.findIndex(a=>a.key===t);return r<0?t:e[r+1]?.key??t}function a_(e){return e.some(t=>String(t.key)==="BundlePolicy"||String(t.key)==="BundleCustomer")}function o_(e){return a_(e)?"Bundle":e.some(t=>String(t.key)==="Vehicle"||String(t.key)==="Driver")?"Auto":"Home"}const GT={Auto:45e3,Home:5e4,Bundle:1e5},i_=["a[href]","button:not([disabled])","textarea:not([disabled])","input:not([disabled])","select:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");function qT(e,t){if(e!=="AutoCurrentCarrier")return t;const r=t.some(o=>String(o.key)==="auto_cancelled_declined_refused_to_renew"),n=t.some(o=>String(o.key)==="vehicle_policy_selections"),a=[...t];return r||a.push({question:"Has any auto insurance company cancelled, declined or refused to renew you in the last 5 years?",inputType:"radio",options:["Yes","No"],key:"auto_cancelled_declined_refused_to_renew",required:!0}),n||a.push({question:"Vehicle coverage selections",inputType:"custom",key:"vehicle_policy_selections",required:!1}),a}function KT(e,t){if(e!=="Vehicle")return t;const r=n=>n.map(a=>{const o=a.conditionals?.map(i=>{const s=i.conditionalQuestions??[];return s.length?{...i,conditionalQuestions:r(s)}:i});return String(a.key)!=="vin"?o?{...a,conditionals:o}:a:{...a,required:!1,...o?{conditionals:o}:{}}});return r(t)}function YT({isOpen:e,onClose:t}){const[r,n]=d.useState([]),[a,o]=d.useState(null),i=d.useRef(null);d.useEffect(()=>{i.current=a},[a]);const[s,u]=d.useState(null),[l,c]=d.useState(!1),[f,p]=d.useState(!1),[h,g]=d.useState(!1),[y,_]=d.useState(!1),[D,w]=d.useState([]),b=d.useRef(null),[C,v]=d.useState(null),[k,I]=d.useState(void 0),[G,O]=d.useState(!1),[j,M]=d.useState(null),[W,ce]=d.useState(null),[x,V]=d.useState(!1),[U,P]=d.useState(!1),[K,$]=d.useState(!1),T=d.useRef(!1),Y=d.useRef(null),se=d.useRef(null),ee=d.useRef(null),H=d.useRef(null),[Q,A]=d.useState(!1);d.useEffect(()=>{if(!h||y)return;const L=o_(r);let J=!1;const X=[];let ie=0,ae=0;const de=66,F=3,N=5e3;let oe=!1;const te=async()=>{if(J)return;ie++;try{const{quote:fe}=await nb(a??void 0);if(J)return;if(ae=0,!oe){const De=fe?.appetites??null,_e=qk(De,L);_e.length>0&&(w(_e),oe=!0)}const pe=fe?.rates_status??null;if(pe==="completed"){const{rates:De}=await vl(a??void 0);if(J)return;b.current=De,_(!0);return}if(pe==="no_rates"){b.current=[],_(!0);return}if(pe==="failed"){In(new Error("Quote failed: rate-generation worker reported rates_status=failed"),{quoteId:i.current??void 0,phase:"rates_status_failed"}),xa({reason:"submission"}),M({message:"submission_failed"}),g(!1);return}}catch(fe){if(ae++,console.warn("Provider polling: getQuote failed",{attempt:ie,consecutiveFailures:ae,error:fe}),ae>=F){fe?.__sentryReported||In(fe,{quoteId:i.current??void 0,phase:"rates_polling",message:`Quote failed: ${F} consecutive get-quote poll failures`}),xa({reason:"network"}),M({message:"submission_failed"}),g(!1);return}}if(J)return;if(ie>=de){In(new Error(`Quote failed: rate-generation timed out after ${de} polls`),{quoteId:i.current??void 0,phase:"rates_polling_timeout"}),xa({reason:"timeout"}),M({message:"submission_failed"}),g(!1);return}const le=window.setTimeout(te,N);X.push(le)};return te(),()=>{J=!0,X.forEach(le=>window.clearTimeout(le))}},[h,y,r,a]);function S(L){return L.map(X=>({key:X,title:zT(X),loadQuestions:async()=>{const ie=await HA(X,i.current??void 0);let ae=qT(X,ie.questions);return ae=KT(X,ae),ae}}))}d.useEffect(()=>{const L=async()=>{try{const J=LT();if(J)try{const{token:ie,quoteId:ae}=await zA(J);ie&&ae&&(ci(ie),Ny(ae))}catch(ie){ie.statusCode===401&&P(!0)}const X=ui();if(di(),X){O(!0),o(X);try{const ie=Wt(),ae=await nb(ie?void 0:X);if(!ae||!ae.quote)throw new Error("Invalid response from getQuote: missing quote data");const{quote:de}=ae,{stages:F}=await fi(X),N=S(F);n(N);let oe;try{oe=HT(de),v(oe)}catch(_e){throw new Error(`Failed to transform quote data: ${_e instanceof Error?_e.message:"Unknown error"}`)}const te=n_(N,oe);n(te);const le=de?.review_status??null;if(p(le!=null),le==="pending_review"&&Wt()){$(!0);return}const fe=de?.rates_status??null,pe=Wt()!=null;if(pe||le===null){if(fe==="completed")try{const{rates:_e}=await vl(pe?void 0:X);u(_e);return}catch(_e){console.warn("Failed to fetch completed rates on resume",_e)}else if(fe==="no_rates"){u([]);return}else if(fe==="processing"){w([]),_(!1),b.current=null,g(!0);return}}I(0)}catch(ie){const ae=ie;if(ae.statusCode===404)Uy(),o(null);else if(ae.statusCode===401){eb();try{const{stages:de}=await fi(X),F=S(de);n(F);const N=F.findIndex(oe=>oe.key==="SMSVerification");I(N>=0?N:F.length-1)}catch{}}}finally{O(!1)}}else{const{stages:ie}=await fi();n(S(ie))}}catch{O(!1)}};e&&!T.current&&(T.current=!0,L())},[e]),d.useEffect(()=>{if(!e)return;const{overflow:L}=document.body.style;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=L}},[e]),d.useEffect(()=>{if(!e)return;H.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const L=window.setTimeout(()=>{const J=Y.current;if(!J)return;(J.querySelector(i_)??J).focus()},0);return()=>{window.clearTimeout(L);const J=H.current;H.current=null,J&&document.contains(J)&&J.focus()}},[e]);const E=d.useCallback(L=>{if(L.key==="Escape"){Q?(L.preventDefault(),A(!1)):(L.preventDefault(),A(!0));return}if(L.key!=="Tab")return;const J=Q?se.current:Y.current;if(!J)return;const X=Array.from(J.querySelectorAll(i_)).filter(F=>!F.hasAttribute("disabled")&&F.getAttribute("aria-hidden")!=="true");if(X.length===0){L.preventDefault(),J.focus();return}const ie=X[0],ae=X[X.length-1],de=document.activeElement;L.shiftKey&&de===ie?(L.preventDefault(),ae.focus()):!L.shiftKey&&de===ae&&(L.preventDefault(),ie.focus())},[Q]);d.useEffect(()=>{if(e)return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[e,E]),d.useEffect(()=>{if(!Q)return;const L=window.setTimeout(()=>{ee.current?.focus()},0);return()=>window.clearTimeout(L)},[Q]),d.useEffect(()=>{e||(v(null),I(void 0),O(!1),g(!1),ce(null),V(!1),A(!1))},[e]),d.useEffect(()=>{e&&Tk()},[e]),d.useEffect(()=>{s&&Array.isArray(s)&&Fk({rateCount:s.length})},[s]);const z=d.useCallback(()=>{M(null),I(Math.max(0,r.length-1))},[r.length]),q=d.useCallback(async(L,J)=>{try{w([]),_(!1),b.current=null,g(!0);let X;try{X=await Dr(L,!0,a??void 0)}catch(de){throw g(!1),de}if(X.status==="submission_failed"){In(new Error(`Quote failed at submission: ${X.message}`),{quoteId:a??void 0,phase:J}),g(!1),_(!1),b.current=null,xa({reason:"submission"}),M({message:X.message});return}if(X.status==="success")try{const{rates:de}=await vl(a??void 0);b.current=de,_(!0)}catch(de){throw g(!1),de}const ie=r.length,ae=r[ie-1];Cb({stageKey:ae?.key??"unknown",stageTitle:ae?.title??"unknown",stepIndex:ie,totalSteps:ie}),Mk()}catch(X){X?.__sentryReported||In(X,{quoteId:a??void 0,phase:J}),g(!1),xa({reason:"submission"}),M({message:"Oops, something went wrong. Please try again later."})}},[a,r]),ne=d.useCallback(async L=>{if(!(!W||!a||x)){V(!0);try{const X={...en(W.allValues),communications_consent:L};ce(null),await q(X,"consent_submit")}finally{V(!1)}}},[W,a,x,q]),Z=d.useCallback(async L=>{if(!(!a||x)){V(!0);try{v(L);const J={...en(L),customer_review_confirmed:!0};await q(J,"review_submit")}finally{V(!1)}}},[a,x,q]);if(!e)return null;const ue=()=>{A(!0)},ve=()=>{A(!1)},R=()=>{Pk(),t()},re=!!(!j&&s&&a&&!l);return m.jsxs("div",{ref:Y,className:"fixed inset-0 z-[9999] flex items-center justify-center",role:"dialog","aria-modal":"true","aria-labelledby":"insurance-modal-title",tabIndex:-1,children:[m.jsx("div",{className:"backdrop","aria-hidden":"true"}),m.jsxs("div",{className:`modal-panel bg-white relative w-full flex flex-col max-h-[90vh] overflow-hidden ${re?"max-w-6xl":"max-w-2xl"}`,role:"document",children:[m.jsx("h2",{id:"insurance-modal-title",className:"sr-only",children:"Credify insurance quote widget"}),m.jsx("button",{onClick:ue,className:"modal-close-btn absolute top-4 right-4","aria-label":"Close quote form",type:"button",children:m.jsx("span",{"aria-hidden":"true",children:"×"})}),!h&&!j&&m.jsx("div",{className:"widget-modal-header text-center",children:m.jsx("h2",{className:"h1-title",children:"Let's shop multiple leading carriers for you"})}),m.jsxs("div",{className:"panel-body flex-1 min-h-0 overflow-hidden",children:[U&&m.jsxs("div",{className:"mb-4 flex items-start justify-between gap-3 rounded-md border border-amber-300 bg-amber-50 px-4 py-3 text-sm text-amber-800",role:"alert",children:[m.jsx("span",{children:"This resume link has expired or is no longer valid. For your security, emailed links only work for a limited time — you can continue your quote below."}),m.jsx("button",{type:"button",onClick:()=>P(!1),className:"shrink-0 font-bold text-amber-800 hover:text-amber-900","aria-label":"Dismiss",children:"×"})]}),j&&m.jsx(Zb,{onGoBack:z}),!j&&h&&(()=>{const L=o_(r);return m.jsx(hT,{providers:D,totalTime:GT[L],flow:L,isComplete:y,onComplete:()=>{g(!1),_(!1),w([]),b.current&&(u(b.current),b.current=null)}})})(),!j&&!h&&W&&m.jsx(Sw,{onChoose:ne,isSubmitting:x}),!j&&!s&&!h&&!W&&m.jsx(m.Fragment,{children:G||r.length===0?m.jsx("div",{className:"flex items-center justify-center py-12",children:m.jsx("div",{className:"text-slate-600",children:"Loading..."})}):K&&a?m.jsx(mT,{stages:r,initialValues:C??{},quoteId:a,isSubmitting:x,onConfirmed:Z}):m.jsx(jk,{stages:r,initialValues:C??void 0,initialActive:k,quoteId:a??void 0,nonTerminalStageKeys:r_,onStageComplete:async(L,J)=>{try{const X=en(L);let ie=a,ae=r;const de=ae.findIndex(oe=>oe.key===J),F=ae[de],N=ZT(ae,J);if(ie)if(J==="Phone"){const oe=X.phone;if(!oe)throw new Error("Phone number is required.");const te=Wt();await Dr({...X,current_stage:N},!1,te?void 0:ie),await tb(ie,oe)}else if(J==="SMSVerification"){const{isVerified:oe,token:te}=await _l(ie,X.sms_code);if(!oe)throw new Error("Invalid SMS code");te&&ci(te),await Dr({current_stage:N},!1)}else if(J==="Product"){const oe=Wt(),{isSupported:te}=await rb(X.state,oe?void 0:ie??void 0);if(await Dr({...X,current_stage:te?N:J},!1,oe?void 0:ie),!te){const le=Vb(X.state);throw new Error(`Sorry, Credify Corporation doesn't currently offer insurance in ${le}. We're expanding our coverage and hope to serve your state soon.`)}}else{const oe=Wt();await Dr({...X,current_stage:N},!1,oe?void 0:ie||void 0)}else{const oe=X.postal_code??"";if(!oe)throw new Error("ZIP code is required to start a quote.");const le=(await VA(oe,UT()))?.quoteId;if(!le||typeof le!="string"||le.trim()==="")throw new Error(`Failed to create quote - invalid quoteId returned: ${le}`);ie=le,o(le),Ny(le),await Dr({...X,current_stage:N},!1,le)}if(J==="Name"&&ie){const oe=String(L.product??"");(oe==="Auto"||oe==="Both")&&bk(ie)}if(J==="Vehicle"&&ie&&Ek(ie),r_.has(J))try{const{stages:oe}=await fi(ie||void 0);ae=S(oe),ae=n_(ae,L),n(ae)}catch(oe){console.warn("Unable to refresh stages after flow-shaping step",oe)}return Cb({stageKey:J,stageTitle:F?.title??J,stepIndex:de+1,totalSteps:ae.length}),{success:!0,latestStages:ae}}catch(X){return{success:!1,error:X instanceof Error?X.message:"An error occurred"}}},onComplete:async(L,J)=>{if(!a)return{success:!1,error:"Oops, something went wrong. Please try again later."};v(L);try{if(J==="Phone"){const X=en(L);if(!X.phone)return{success:!1,error:"Phone number is required."};const ae=Wt();return await Dr({...X,suppress_verification_sms:!0},!1,ae?void 0:a),ce({allValues:L}),{success:!0}}if(J==="SMSVerification"){const X=en(L),{isVerified:ie,token:ae}=await _l(a,X.sms_code);return ie?(ae&&ci(ae),ce({allValues:L}),{success:!0}):{success:!1,error:"Invalid SMS code"}}return ce({allValues:L}),{success:!0}}catch{const ie="Oops, something went wrong. Please try again later.";return M({message:ie}),{success:!1,error:ie}}}})})," ",!j&&s&&a&&m.jsx(eT,{rates:s,onBack:()=>u(null),isBundleFlow:a_(r),quoteId:a,initialPhone:C?.phone??"",requirePursueVerification:f,onSubScreenChange:c})]}),m.jsxs("div",{className:"widget-legal-footer space-y-1.5",children:[m.jsx(FT,{}),m.jsx("p",{className:"text-center text-sm text-slate-500",children:"Insurance products offered through Credify Corporation, a licensed insurance agency."})]}),Q&&m.jsx("div",{className:"close-confirm-backdrop",role:"presentation",children:m.jsxs("div",{ref:se,className:"close-confirm-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":"close-confirm-title","aria-describedby":"close-confirm-description",tabIndex:-1,children:[m.jsx("h3",{id:"close-confirm-title",children:"Close quote form?"}),m.jsx("p",{id:"close-confirm-description",children:"Your answers in this session will be lost if you close this window."}),m.jsxs("div",{className:"close-confirm-actions",children:[m.jsx("button",{ref:ee,type:"button",className:"btn-outline",onClick:ve,children:"Keep editing"}),m.jsx("button",{type:"button",className:"btn-primary close-confirm-danger",onClick:R,children:"Close form"})]})]})})]})]})}function QT({onClose:e}){return m.jsxs("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center",role:"dialog","aria-modal":"true",children:[m.jsx("div",{className:"backdrop","aria-hidden":"true"}),m.jsx("div",{className:"modal-panel bg-white relative w-full max-w-2xl p-6",children:m.jsx(Zb,{onGoBack:e})})]})}function XT({isOpen:e}){const t=()=>wi.close();return m.jsx(ps,{fallback:m.jsx(QT,{onClose:t}),children:m.jsx(YT,{isOpen:e,onClose:t})})}var Ll={dsn:"",environment:"production",release:"57ea74a8604e737cd511c4d889deefd328468da7"};function WT(){try{return typeof Ll<"u"&&Ll?Ll:{}}catch{return{}}}let s_=!1;function JT(e,t){if(!e)return t;const r=Number(e);return Number.isFinite(r)&&r>=0&&r<=1?r:t}function eP(e={}){if(s_)return!0;if(typeof window>"u")return!1;const t=WT(),r=e.dsn??t.dsn;return!r||e.enabled===!1?!1:(PA({baseUrl:Ve}),A1({dsn:r,environment:e.environment??t.environment??"production",release:e.release??t.release,sendDefaultPii:!1,maxBreadcrumbs:50,tracesSampleRate:e.tracesSampleRate??JT(t.tracesSampleRate,.1),tracePropagationTargets:[Ve],replaysSessionSampleRate:0,replaysOnErrorSampleRate:1,beforeSend:n=>Yy(n),beforeBreadcrumb:n=>n&&(Yy({breadcrumbs:[n]}),n)}),s_=!0,x1("replayIntegration").then(n=>{try{g4(n({maskAllText:!0,maskAllInputs:!0,blockAllMedia:!0,networkDetailAllowUrls:[Ve],networkCaptureBodies:!1}))}catch{}}).catch(()=>{}),!0)}var u_={key:""};const tP="mock";function rP(){try{typeof u_<"u"&&u_?.key;return}catch{return}}function nP(){const e=rP();if(!e||typeof window>"u"||!window.location)return!1;try{return new URLSearchParams(window.location.search).get(tP)===e}catch{return!1}}const aP=new Set(["/create-quote","/get-stages-for-quote","/get-questions-by-stage","/update-quote","/verify-quote","/is-supported-state","/get-rates","/get-quote","/get-vehicle-options","/request-bind"]);let l_=!1;function oP(e){try{if(typeof e=="string")return new URL(e,window.location.href).pathname;if(e instanceof URL)return e.pathname;if(e instanceof Request)return new URL(e.url,window.location.href).pathname}catch{return null}return null}async function iP(e,t){try{if(t?.body&&typeof t.body=="string")return JSON.parse(t.body);if(e instanceof Request){const r=await e.clone().text();return r?JSON.parse(r):{}}}catch{return{}}return{}}function c_(e,t=200){return new Response(JSON.stringify(e),{status:t,headers:{"Content-Type":"application/json"}})}function sP(){try{if(typeof document>"u"||document.getElementById("credify-mock-badge"))return;const e=()=>{const t=document.createElement("div");t.id="credify-mock-badge",t.textContent="MOCK MODE",t.setAttribute("aria-hidden","true"),t.style.cssText=["position:fixed","bottom:12px","left:12px","z-index:2147483647","background:#b91c1c","color:#fff","font:600 11px/1 system-ui,sans-serif","letter-spacing:0.08em","padding:6px 10px","border-radius:9999px","box-shadow:0 1px 4px rgba(0,0,0,0.3)","pointer-events:none","user-select:none"].join(";"),document.body.appendChild(t)};document.body?e():document.addEventListener("DOMContentLoaded",e,{once:!0})}catch{}}function uP(){if(l_||typeof window>"u"||typeof window.fetch!="function"||!nP())return;l_=!0;const e=window.fetch.bind(window),t=Promise.resolve().then(()=>OP);window.fetch=async(r,n)=>{const a=oP(r);if(!a||!aP.has(a))return e(r,n);const o=await iP(r,n),{handleMockRequest:i}=await t;await new Promise(s=>window.setTimeout(s,120));try{return c_(i(a,o))}catch(s){return c_({error:s instanceof Error?s.message:"Mock handler error"},404)}},sP(),typeof console<"u"&&console.info("[Credify] Mock mode active — all API calls are served from in-memory fixtures.")}uP();let er=null,tn=null,Ci=!1;function lP(){er||(er=document.createElement("div"),er.id="insurance-widget-root",document.documentElement.appendChild(er)),!tn&&er&&(tn=b_.createRoot(er))}function Rl(){lP(),tn&&tn.render(d.createElement(XT,{isOpen:Ci}))}function cP(){tn&&er&&(tn.unmount(),er.remove()),tn=null,er=null,Qb(),kk()}const wi={init:e=>{eP(e?.sentry),kT(e?.support),OT(),NT(),Ci=!!e?.autoOpen||BT(),Rl()},open:()=>{Ci=!0,Rl()},close:()=>{Ci=!1,Rl()},destroy:cP,on:Db,off:Sb,support:{openChat:Kb,startScreenShare:Yb}};typeof window<"u"&&(window.CredifyInsuranceWidget=wi);const dP=["Zip","Email","Product"],fP={Auto:["Zip","Email","Product","Name","Vehicle","Driver","AutoCurrentCarrier","Demographics","Ssn","Phone"],Home:["Zip","Email","Product","Name","Home","HomePolicy","Demographics","Ssn","Phone"],Bundle:["Zip","Email","Product","Name","Home","Vehicle","Driver","BundlePolicy","Demographics","Ssn","Phone"]};function mP(e){return e==="Auto"||e==="Home"||e==="Bundle"?fP[e]:dP}const d_=["Allstate","State Farm","GEICO","Progressive","Liberty Mutual","Nationwide","Farmers","NoPriorInsurance"],f_=["25/50","50/100","100/300","250/500"],pP=Array.from({length:35},(e,t)=>String(2024-t)),hP=[{question:"What's your ZIP code?",inputType:"text",key:"postal_code",required:!0}],gP=[{question:"What is your email address?",inputType:"email",key:"email",required:!0}],yP=[{question:"Do you want to quote auto, home, or both?",inputType:"select",options:["Auto","Home","Bundle"],key:"product",required:!0},{question:"What is your property address?",inputType:"address",key:"address",required:!0}],bP=[{question:"What is your first name?",inputType:"text",key:"first_name",required:!0},{question:"What is your last name?",inputType:"text",key:"last_name",required:!0},{question:"What is your date of birth?",inputType:"date",key:"date_of_birth",required:!0}],_P=[{question:"Add Vehicles",inputType:"radio",options:["Yes"],key:"vehicles",required:!0,conditionals:[{conditionalType:"equals",conditionalValue:"Yes",conditionalQuestionsAllowMultiple:!0,conditionalQuestions:[{question:"Vehicle Identification Number (VIN)",inputType:"text",key:"vin",required:!1},{question:"Year",inputType:"select",options:pP,key:"year",required:!0},{question:"Make",inputType:"select",options:[],key:"make",required:!0},{question:"Model",inputType:"select",options:[],key:"model",required:!0},{question:"Body style",inputType:"select",options:[],key:"body_style",required:!0},{question:"Vehicle ownership type",inputType:"select",options:["Owned","Leased","Lien"],key:"ownership_type",required:!0},{question:"What is the primary use of this vehicle?",inputType:"select",options:["Pleasure","To_FromWork","To_FromSchool","Business","Farming"],key:"usage",required:!0},{question:"Annual mileage driven",inputType:"number",key:"annual_mileage",required:!0}]}]}],vP=[{question:"Add Drivers",inputType:"radio",options:["Yes"],key:"drivers",required:!0,conditionals:[{conditionalType:"equals",conditionalValue:"Yes",conditionalQuestionsAllowMultiple:!0,conditionalQuestions:[{question:"First Name",inputType:"text",key:"first_name",required:!0},{question:"Middle Name Initial",inputType:"text",key:"middle_name",required:!1},{question:"Last Name",inputType:"text",key:"last_name",required:!0},{question:"Date of Birth",inputType:"date",key:"date_of_birth",required:!0},{question:"Gender",inputType:"select",options:["Male","Female"],key:"gender",required:!0},{question:"What is the relationship to Driver #1?",inputType:"select",options:["Spouse","Parent","Child","Domestic Partner","Relative","Employee","Other"],key:"relationship_to_insured",required:!0},{question:"Marital status",inputType:"select",options:["Single","Married","Divorced","Widowed"],key:"marital_status",required:!0}]}]}],m_=[{question:"When do you need your insurance to begin?",inputType:"date",key:"effective_date",required:!0},{question:"Type of residence",inputType:"select",options:["Single Family Dwelling","Condo","Apartment","Townhouse","Mobile Home"],key:"residence_type",required:!0},{question:"Please select your current auto insurance company",inputType:"select",options:d_,key:"auto_prior_carrier_name",required:!0,conditionals:[{conditionalType:"notEquals",conditionalValue:"NoPriorInsurance",conditionalQuestions:[{question:"Years with prior personal auto carrier",inputType:"number",key:"auto_prior_years",required:!0},{question:"Months with prior personal auto carrier",inputType:"number",key:"auto_prior_months",required:!0},{question:"When does the current policy expire?",inputType:"date",key:"auto_prior_expiration_date",required:!0},{question:"What is your current or most recent Bodily Injury Limit?",inputType:"select",options:f_,key:"auto_prior_liability_limit",required:!0}]}]},{question:"Has any auto insurance company cancelled, declined or refused to renew you in the last 5 years?",inputType:"radio",options:["Yes","No"],key:"auto_cancelled_declined_refused_to_renew",required:!0},{question:"Bodily Injury liability",inputType:"select",options:f_,key:"policy_bi",required:!0},{question:"Property Damage Liability",inputType:"select",options:["25000","50000","100000"],key:"policy_pd",required:!0}],EP=[{question:"Year built",inputType:"number",key:"year_built",required:!0},{question:"Total living area (sq ft)",inputType:"number",key:"total_area_sq_ft",required:!0},{question:"Dwelling type",inputType:"select",options:["Single Family","Condo","Townhouse","Multi-Family"],key:"dwelling_type",required:!0},{question:"Construction type",inputType:"select",options:["Frame","Masonry","Masonry Veneer","Fire Resistive"],key:"construction_type",required:!0},{question:"Roof material",inputType:"select",options:["Asphalt Shingle","Metal","Tile","Wood Shake","Slate"],key:"roof_material_type",required:!0},{question:"Number of stories",inputType:"select",options:["1","1.5","2","2.5","3"],key:"number_of_stories",required:!0}],p_=[{question:"When do you need your insurance to begin?",inputType:"date",key:"effective_date",required:!0},{question:"Do you currently have a Homeowners policy?",inputType:"radio",options:["Yes","No"],key:"home_has_prior_insurance",required:!0,conditionals:[{conditionalType:"equals",conditionalValue:"Yes",conditionalQuestions:[{question:"Which carrier currently insures the home?",inputType:"select",options:d_,key:"home_prior_carrier_name",required:!0}]}]},{question:"Personal liability limit",inputType:"select",options:["100000","300000","500000","1000000"],key:"home_personal_liability",required:!0},{question:"All-perils deductible",inputType:"select",options:["500","1000","2500","5000"],key:"home_all_perils_deductible",required:!0}],DP=[...p_,...m_],SP={Zip:hP,Email:gP,Product:yP,Name:bP,Vehicle:_P,Driver:vP,AutoCurrentCarrier:m_,Home:EP,HomePolicy:p_,BundlePolicy:DP,Demographics:[{question:"Gender",inputType:"radio",options:["Male","Female"],key:"gender",required:!0},{question:"Marital status",inputType:"select",options:["Single","Married","Divorced","Widowed","Domestic Partner"],key:"marital_status",required:!0},{question:"Employment industry",inputType:"select",options:["Technology","Healthcare","Education","Finance","Retail","Construction","Other"],key:"employment_industry",required:!0},{question:"How many occupants live in the household?",inputType:"number",key:"household_size",required:!0},{question:"Do you authorize us to check your credit?",inputType:"radio",options:["Yes","No"],key:"order_credit_authorized",required:!0}],Ssn:[{question:"Social Security Number",inputType:"text",key:"social_security_number",required:!1}],Phone:[{question:"What is your phone number?",inputType:"tel",key:"phone",required:!0}],SMSVerification:[{question:"Please enter the code we sent to your phone number.",inputType:"text",key:"sms_code",required:!0}]};function CP(e){return SP[e]??[]}const wP=[{quote_rate_id:"mock-rate-1",carrier_name:"Progressive",carrier_logo_base64:null,carrier_quote_id:"MOCK-PRG-001",premium_cents:142800,monthly_premium_cents:11900,term_months:12,lob:"auto",admitted_status:"admitted",effective_date:"2026-07-01",policy_end_date:"2027-07-01"},{quote_rate_id:"mock-rate-2",carrier_name:"Nationwide",carrier_logo_base64:null,carrier_quote_id:"MOCK-NW-002",premium_cents:156e3,monthly_premium_cents:13e3,term_months:12,lob:"auto",admitted_status:"admitted",effective_date:"2026-07-01",policy_end_date:"2027-07-01"},{quote_rate_id:"mock-rate-3",carrier_name:"Liberty Mutual",carrier_logo_base64:null,carrier_quote_id:"MOCK-LM-003",premium_cents:173400,monthly_premium_cents:14450,term_months:12,lob:"auto",admitted_status:"non_admitted",effective_date:"2026-07-01",policy_end_date:"2027-07-01"},{quote_rate_id:"mock-nq-1",carrier_name:"Travelers",carrier_logo_base64:null,carrier_quote_id:null,premium_cents:0,monthly_premium_cents:null,term_months:0,lob:"auto",admitted_status:"not_quoted",effective_date:null,policy_end_date:null,decline_category:"Upfront Underwriting",decline_reasons:["Consumer didn’t grant permission to review credit score."]},{quote_rate_id:"mock-nq-2",carrier_name:"NationalGeneral",carrier_logo_base64:null,carrier_quote_id:null,premium_cents:0,monthly_premium_cents:null,term_months:0,lob:"auto",admitted_status:"not_quoted",effective_date:null,policy_end_date:null,decline_category:"Declinations",decline_reasons:["Carrier requires credit report ordering. Please select Yes for Credit Check Authorized.","Monoline quoting is not allowed."]},{quote_rate_id:"mock-nq-3",carrier_name:"Allstate",carrier_logo_base64:null,carrier_quote_id:null,premium_cents:0,monthly_premium_cents:null,term_months:0,lob:"auto",admitted_status:"not_quoted",effective_date:null,policy_end_date:null,decline_category:"Declinations",decline_reasons:["This carrier will not quote if the credit disclosure is not accepted by the insured."]}],xP=["Toyota","Honda","Ford","Chevrolet","Tesla","Subaru"],$P={Toyota:["Camry","Corolla","RAV4","Highlander","Tacoma"],Honda:["Civic","Accord","CR-V","Pilot","Odyssey"],Ford:["F-150","Escape","Explorer","Mustang","Bronco"],Chevrolet:["Silverado","Equinox","Malibu","Tahoe","Camaro"],Tesla:["Model 3","Model Y","Model S","Model X"],Subaru:["Outback","Forester","Crosstrek","Impreza"]},AP=["Sedan","SUV","Truck","Coupe","Hatchback","Minivan"];function kP(e){return e.make&&e.model?{ready:!0,bodyStyles:AP}:e.make?{ready:!0,models:$P[e.make]??["Base","Sport","Limited"]}:{ready:!0,makes:xP}}function TP(){return{year:2022,make:"Toyota",model:"Camry",bodyStyle:"Sedan"}}const xi="mock-quote-0001",h_="mock-jwt-token";let $a={quote_id:xi};function PP(e={}){$a={quote_id:xi,...e}}function IP(e){return e.action==="send"?{success:!0}:e.action==="resume"?{isVerified:!0,token:h_,quoteId:xi}:{isVerified:!0,token:h_}}function MP(e){return e.action==="vinDecode"?TP():kP({year:typeof e.year=="number"?e.year:void 0,make:typeof e.make=="string"?e.make:void 0,model:typeof e.model=="string"?e.model:void 0})}function FP(e,t){switch(e){case"/create-quote":return PP({postal_code:t.postal_code}),{quoteId:xi};case"/get-stages-for-quote":return{stages:mP($a.product)};case"/get-questions-by-stage":return{questions:CP(t.stage)};case"/update-quote":{const r={...t.payload??{}};return delete r.current_stage,$a={...$a,...r},{status:"success"}}case"/verify-quote":return IP(t);case"/is-supported-state":return{isSupported:!0};case"/get-rates":return{rates:wP};case"/get-quote":return{quote:$a};case"/get-vehicle-options":return MP(t);case"/request-bind":return{success:!0};default:throw new Error(`No mock handler for ${e}`)}}const OP=Object.freeze(Object.defineProperty({__proto__:null,handleMockRequest:FP},Symbol.toStringTag,{value:"Module"}));pt.CredifyInsuranceWidget=wi,pt.default=wi,Object.defineProperties(pt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
116
+ `}),m.jsx("div",{style:{background:"#F8FAFC",display:"flex",alignItems:"center",justifyContent:"center",padding:"2rem",fontFamily:"'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",height:"100%",minHeight:400,overflowY:"auto"},children:m.jsxs("div",{style:{width:"100%",maxWidth:560},children:[m.jsxs("div",{style:{textAlign:"center",marginBottom:40},children:[m.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8,background:o.accent+"12",border:`1px solid ${o.accent}30`,borderRadius:100,padding:"6px 16px",marginBottom:16},children:[m.jsx("span",{style:{fontSize:14},"aria-hidden":"true",children:o.icon}),m.jsx("span",{style:{fontSize:12,fontWeight:700,color:o.accent,letterSpacing:"0.1em",textTransform:"uppercase"},children:o.label})]}),m.jsx("h1",{style:{fontSize:26,fontWeight:700,color:"#0F172A",margin:0,letterSpacing:"-0.02em",lineHeight:1.3},children:G?"Connecting to top carriers":"Fetching your best rates"}),m.jsx("p",{style:{fontSize:14,color:"#64748B",marginTop:8,marginBottom:0},children:G?"Identifying the carriers eligible for your quote...":j?"Still gathering — a few carriers are taking a little longer...":"We're reaching out to multiple insurers on your behalf"})]}),m.jsx("div",{style:{display:"flex",justifyContent:"center",marginBottom:32},children:G?m.jsx("div",{style:{display:"flex",gap:20},children:[0,1,2,3,4].map(M=>m.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:6},children:[m.jsx("div",{style:{width:48,height:48,borderRadius:14,background:"#E2E8F0",animation:"skeletonPulse 1.4s ease-in-out infinite",animationDelay:`${M*.12}s`}}),m.jsx("div",{style:{width:40,height:8,borderRadius:4,background:"#E2E8F0",animation:"skeletonPulse 1.4s ease-in-out infinite",animationDelay:`${M*.12}s`}})]},`skeleton-${M}`))}):O?m.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8},children:[m.jsxs("div",{style:{width:64,height:64,borderRadius:18,background:O.color+"18",border:`2px solid ${O.color}`,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:700,fontSize:16,color:O.color,position:"relative",animation:"providerPulse 1.8s ease-in-out infinite"},children:[O.abbr,m.jsx("div",{style:{position:"absolute",inset:-5,borderRadius:22,border:`2px solid ${O.color}`,pointerEvents:"none",animation:"ringPulse 1.6s ease-in-out infinite"},"aria-hidden":"true"})]}),m.jsx("span",{style:{fontSize:13,fontWeight:600,color:O.color,letterSpacing:"0.04em"},children:O.name})]}):null}),m.jsxs("div",{className:`iq-card-fade ${_?"iq-card-visible":"iq-card-hidden"}`,style:{background:"#FFFFFF",borderRadius:24,border:"1px solid #E2E8F0",padding:32},children:[m.jsx("div",{style:{display:"flex",alignItems:"center",gap:20,marginBottom:28},children:G||!O?m.jsxs("div",{style:{flex:1,textAlign:"center",padding:"8px 0"},children:[m.jsx("p",{style:{fontSize:11,fontWeight:700,color:"#94A3B8",letterSpacing:"0.1em",textTransform:"uppercase",margin:"0 0 6px"},children:"Please wait"}),m.jsx("h2",{style:{fontSize:18,fontWeight:700,color:"#0F172A",margin:"0 0 6px",letterSpacing:"-0.02em"},children:"Checking eligible providers"}),m.jsx("p",{style:{fontSize:13,color:"#64748B",margin:0},children:"Reviewing your details against our carrier network"})]}):m.jsxs(m.Fragment,{children:[m.jsxs("div",{style:{position:"relative",flexShrink:0},children:[m.jsx(pT,{progress:p,color:O.color,size:80}),m.jsx("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center"},children:m.jsxs("span",{style:{fontSize:14,fontWeight:700,color:O.color},"aria-hidden":"true",children:[Math.round(p),"%"]})})]}),m.jsxs("div",{style:{flex:1},children:[m.jsx("p",{style:{fontSize:11,fontWeight:700,color:"#94A3B8",letterSpacing:"0.1em",textTransform:"uppercase",margin:"0 0 4px"},children:j?"Still checking":"Now checking"}),m.jsx("h2",{style:{fontSize:20,fontWeight:700,color:"#0F172A",margin:"0 0 6px",letterSpacing:"-0.02em"},children:O.name}),m.jsx("p",{className:"iq-status-text",style:{fontSize:13,color:"#64748B",margin:0},role:"status","aria-live":"polite",children:Pl[g]},`${u}-${g}`)]})]})}),m.jsxs("div",{children:[m.jsx("p",{style:{fontSize:11,fontWeight:700,color:"#94A3B8",letterSpacing:"0.08em",textTransform:"uppercase",margin:"0 0 8px"},children:G?"Initializing":"Gathering quotes"}),m.jsx("div",{style:{height:6,background:"#F1F5F9",borderRadius:100,overflow:"hidden"},children:m.jsx("div",{style:{height:"100%",width:"35%",background:o.accent,borderRadius:100,animation:"shimmerSlide 1.4s ease-in-out infinite"},"aria-hidden":"true"})})]})]})]})})]})}function Zb({onGoBack:e}){return m.jsxs("section",{className:"mt-4",role:"alert","aria-labelledby":"submission-error-title",children:[m.jsxs("div",{className:"rounded-xl border border-red-200 bg-red-50 p-5",children:[m.jsx("h3",{id:"submission-error-title",className:"text-base font-semibold text-red-700",children:"Sorry, quote submission failed"}),m.jsx("p",{className:"mt-2 text-sm text-red-700",children:"We ran into an issue submitting your quote. Our team will investigate and get back to you soon."})]}),m.jsx("div",{className:"mt-5",children:m.jsx("button",{type:"button",onClick:e,className:"h-12 w-full rounded-full border border-gray-300 text-text-primary hover:bg-gray-50 transition",children:"Go back"})})]})}var Il={intercomAppId:"",cobrowseLicense:""};function gT(){try{return typeof Il<"u"&&Il?Il:{}}catch{return{}}}function yT(e){const t=gT(),r=e?.intercomAppId??t.intercomAppId,n=e?.cobrowseLicense??t.cobrowseLicense;return{enabled:(e?.enabled??!0)&&!!(r||n),intercomAppId:r||void 0,cobrowseLicense:n||void 0,proactiveOnError:e?.proactiveOnError??!0}}const Ml=new Map;function Gb(e){if(typeof document>"u")return Promise.reject(new Error("loadScript called without a document"));const t=Ml.get(e);if(t)return t;const r=new Promise((n,a)=>{const o=document.createElement("script");o.src=e,o.async=!0,o.onload=()=>n(),o.onerror=()=>{Ml.delete(e),a(new Error(`Failed to load script: ${e}`))},document.head.appendChild(o)});return Ml.set(e,r),r}let Fl=!1;function bT(){if(typeof window.Intercom=="function")return window.Intercom;const e=function(...t){e.c?.(t)};return e.q=[],e.c=t=>{e.q.push(t)},window.Intercom=e,e}function _T(e){const t={app_id:e,hide_default_launcher:!0},r=ui();return r&&(t.quote_id=r),t}function qb(e){if(typeof window>"u")return;bT();const t=_T(e);if(window.intercomSettings=t,Fl){window.Intercom("update",t);return}window.Intercom("boot",t),Fl=!0,Gb(`https://widget.intercom.io/widget/${e}`).catch(()=>{})}function vT(){typeof window?.Intercom=="function"&&window.Intercom("show")}function ET(e){typeof window?.Intercom=="function"&&window.Intercom("showNewMessage",e)}function DT(e){typeof window?.Intercom=="function"&&window.Intercom("update",e)}function ST(){if(typeof window?.Intercom=="function")try{window.Intercom("shutdown")}catch{}Fl=!1}const CT="https://js.cobrowse.io/CobrowseIO.js";let Ol=!1;async function wT(e){await Gb(CT);const t=window.CobrowseIO;if(!t)return null;if(!Ol){t.license=e,t.redactedViews=["input","select","textarea","[data-credify-redact]"],t.customData={quote_id:ui()??void 0,device_name:"Credify Insurance Widget"},t.confirmSession=()=>Promise.resolve(typeof window<"u"?window.confirm("Allow a Credify support agent to view your screen?"):!1);try{await t.client?.()}catch{}t.start?.(),Ol=!0}return t}async function xT(e){if(typeof window>"u")return null;try{const t=await wT(e);return t?.createSessionCode?await t.createSessionCode():null}catch{return null}}function $T(){try{window.CobrowseIO?.stop?.()}catch{}Ol=!1}const AT="Hi! It looks like something went wrong submitting your quote. We're here to help — tell us what you were trying to do and we'll jump in.";let At=null,Ei=null,Bl=!1;function kT(e){Qb();const t=yT(e);if(At=t,!!t.enabled&&t.proactiveOnError&&t.intercomAppId){const r=n=>{Bl||(Bl=!0,qb(t.intercomAppId),DT({last_quote_error:n?.reason??"unknown"}),ET(AT))};Db("submissionFailed",r),Ei=r}}function Kb(){!At?.enabled||!At.intercomAppId||(qb(At.intercomAppId),vT())}function Yb(){return!At?.enabled||!At.cobrowseLicense?Promise.resolve(null):xT(At.cobrowseLicense)}function TT(){return!!(At?.enabled&&At.intercomAppId)}function PT(){return!!(At?.enabled&&At.cobrowseLicense)}function Qb(){Ei&&(Sb("submissionFailed",Ei),Ei=null),ST(),$T(),Bl=!1,At=null}const IT="Chat with our support team in real time — we'll help you finish your quote.",MT="Share your screen with a support agent so they can see what you see and guide you in real time. We'll generate a secure code — share it with your agent to begin. Your personal information stays hidden.",Xb="inline-flex h-9 w-9 items-center justify-center rounded-full text-slate-500 hover:bg-slate-100 hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-slate-400 disabled:opacity-60",Wb="pointer-events-none absolute bottom-full left-1/2 z-10 mb-2 w-60 -translate-x-1/2 rounded-lg bg-slate-800 px-3 py-2 text-center text-xs leading-snug text-white shadow-lg transition-opacity duration-150";function FT(){const e=TT(),t=PT(),[r,n]=d.useState(null),[a,o]=d.useState(!1),[i,s]=d.useState(!1),[u,l]=d.useState(null),c=d.useCallback(async()=>{o(!0),s(!1);try{const f=await Yb();f?n(f):s(!0)}finally{o(!1)}},[]);return!e&&!t?null:m.jsxs("div",{className:"flex flex-col items-center gap-1.5 text-sm text-slate-500",children:[m.jsx("span",{className:"font-medium",children:"Need help?"}),m.jsxs("div",{className:"inline-flex items-center gap-1",children:[e&&m.jsxs("span",{className:"relative inline-flex",onMouseEnter:()=>l("chat"),onMouseLeave:()=>l(null),children:[m.jsx("button",{type:"button",onClick:Kb,onFocus:()=>l("chat"),onBlur:()=>l(null),onKeyDown:f=>{f.key==="Escape"&&(f.stopPropagation(),l(null))},"aria-label":"Chat with support","aria-describedby":"credify-chat-tooltip",className:Xb,children:m.jsx("svg",{className:"h-5 w-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:m.jsx("path",{d:"M21 11.5a8.38 8.38 0 0 1-8.5 8.5 9 9 0 0 1-3.8-.8L3 21l1.3-4.2A8.38 8.38 0 0 1 3.5 11.5 8.5 8.5 0 0 1 12 3a8.38 8.38 0 0 1 9 8.5Z",strokeLinejoin:"round"})})}),m.jsx("span",{id:"credify-chat-tooltip",role:"tooltip",className:`${Wb} ${u==="chat"?"opacity-100":"opacity-0"}`,children:IT})]}),e&&t&&m.jsx("span",{className:"mx-1 h-6 w-px bg-slate-200","aria-hidden":"true"}),t&&m.jsxs("span",{className:"relative inline-flex",onMouseEnter:()=>l("screen"),onMouseLeave:()=>l(null),children:[m.jsx("button",{type:"button",onClick:c,disabled:a,onFocus:()=>l("screen"),onBlur:()=>l(null),onKeyDown:f=>{f.key==="Escape"&&(f.stopPropagation(),l(null))},"aria-label":"Share your screen with an agent","aria-describedby":"credify-cobrowse-tooltip",className:Xb,children:a?m.jsx("span",{className:"h-4 w-4 animate-spin rounded-full border-2 border-slate-300 border-t-slate-600","aria-hidden":"true"}):m.jsxs("svg",{className:"h-5 w-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[m.jsx("rect",{x:"2.5",y:"4",width:"19",height:"13",rx:"2"}),m.jsx("path",{d:"M8 21h8M12 17v4",strokeLinecap:"round"}),m.jsx("path",{d:"M12 13V8m0 0-2 2m2-2 2 2",strokeLinecap:"round",strokeLinejoin:"round"})]})}),m.jsx("span",{id:"credify-cobrowse-tooltip",role:"tooltip",className:`${Wb} ${u==="screen"?"opacity-100":"opacity-0"}`,children:MT})]})]}),r&&m.jsxs("span",{children:["Read this code to your agent: ",m.jsx("strong",{className:"tracking-widest text-text-primary",children:r})]}),i&&m.jsx("span",{className:"text-red-600",children:"Couldn't start screen sharing. Please try chat instead."})]})}const Jb="credify_rt";let Di=null;function OT(){try{if(typeof window>"u")return;const e=new URL(window.location.href),t=e.searchParams.get(Jb);if(!t)return;Di=t,e.searchParams.delete(Jb),window.history.replaceState(window.history.state,"",e.toString())}catch(e){console.error("Failed to capture resume token from URL:",e)}}function BT(){return Di!==null}function LT(){const e=Di;return Di=null,e}const e_="credify_test",t_="credify_test_mode";let Si=!1;function RT(e){return e===""||/^(1|true|yes)$/i.test(e.trim())}function NT(){try{if(typeof window>"u")return;window.sessionStorage?.getItem(t_)==="1"&&(Si=!0);const e=new URL(window.location.href),t=e.searchParams.get(e_);if(t!==null){Si=RT(t);try{window.sessionStorage?.setItem(t_,Si?"1":"0")}catch{}e.searchParams.delete(e_),window.history.replaceState(window.history.state,"",e.toString())}}catch(e){console.error("Failed to capture test mode from URL:",e)}}function UT(){return Si}function ye(e){if(e===!0)return"Yes";if(e===!1)return"No"}function mt(e){if(e)try{const t=typeof e=="string"?new Date(e):e;return isNaN(t.getTime())?void 0:t.toISOString().split("T")[0]}catch{return}}function HT(e){const t=e,r={};t.phone&&(r.phone=t.phone),t.first_name&&(r.first_name=t.first_name),t.last_name&&(r.last_name=t.last_name),t.email&&(r.email=t.email),t.date_of_birth&&(r.date_of_birth=mt(t.date_of_birth)),t.product&&(r.product=t.product),t.state&&(r.state=t.state),t.postal_code&&(r.postal_code=t.postal_code);const n=[];t.line_1&&n.push(t.line_1),t.line_2&&n.push(t.line_2),t.city&&n.push(t.city),t.state&&n.push(t.state),t.postal_code&&n.push(t.postal_code),n.length>0&&(r.address=n.join(", ")),typeof t.ssn_display=="string"&&(r.ssn_display=t.ssn_display),t.years_at_address!==null&&t.years_at_address!==void 0&&(r.years_at_address=t.years_at_address),t.months_at_address!==null&&t.months_at_address!==void 0&&(r.months_at_address=t.months_at_address),t.move_in_date&&(r.move_in_date=mt(t.move_in_date));const a=[];t.prior_line_1&&a.push(t.prior_line_1),t.prior_line_2&&a.push(t.prior_line_2),t.prior_city&&a.push(t.prior_city),t.prior_state&&a.push(t.prior_state),t.prior_postal_code&&a.push(t.prior_postal_code),a.length>0&&(r.prior_address=a.join(", ")),t.years_at_prior_address!==null&&t.years_at_prior_address!==void 0&&(r.years_at_prior_address=t.years_at_prior_address),t.is_mailing_address_different!==null&&t.is_mailing_address_different!==void 0&&(r.is_mailing_address_different=ye(t.is_mailing_address_different)),t.mailing_address&&(r.mailing_address=t.mailing_address),t.effective_date&&(r.effective_date=mt(t.effective_date)),t.auto_has_prior_insurance!==null&&t.auto_has_prior_insurance!==void 0&&(r.auto_has_prior_insurance=ye(t.auto_has_prior_insurance)),t.auto_prior_expiration_date&&(r.auto_prior_expiration_date=mt(t.auto_prior_expiration_date)),t.auto_prior_carrier_name&&(r.auto_prior_carrier_name=t.auto_prior_carrier_name),t.auto_prior_liability_limit&&(r.auto_prior_liability_limit=t.auto_prior_liability_limit),t.auto_reason_for_no_insurance&&(r.auto_reason_for_no_insurance=t.auto_reason_for_no_insurance),t.auto_prior_years!==null&&t.auto_prior_years!==void 0&&(r.auto_prior_years=t.auto_prior_years),t.auto_prior_months!==null&&t.auto_prior_months!==void 0&&(r.auto_prior_months=t.auto_prior_months),t.auto_continuous_coverage_years!==null&&t.auto_continuous_coverage_years!==void 0&&(r.auto_continuous_coverage_years=t.auto_continuous_coverage_years),t.auto_cancelled_declined_refused_to_renew!==null&&t.auto_cancelled_declined_refused_to_renew!==void 0&&(r.auto_cancelled_declined_refused_to_renew=ye(t.auto_cancelled_declined_refused_to_renew)),t.auto_current_annual_premium_cents!==null&&t.auto_current_annual_premium_cents!==void 0&&(r.auto_current_annual_premium_cents=t.auto_current_annual_premium_cents),t.policy_bi&&(r.policy_bi=t.policy_bi),t.policy_um&&(r.policy_um=t.policy_um),t.policy_pd&&(r.policy_pd=t.policy_pd),t.policy_mp&&(r.policy_mp=t.policy_mp),t.policy_umpd&&(r.policy_umpd=t.policy_umpd),t.policy_pip&&(r.policy_pip=t.policy_pip),t.policy_auto_death_indemnity&&(r.policy_auto_death_indemnity=t.policy_auto_death_indemnity),t.driver_vehicle_assignments&&(r.driver_vehicle_assignments=t.driver_vehicle_assignments),t.home_has_prior_insurance!==null&&t.home_has_prior_insurance!==void 0&&(r.home_has_prior_insurance=ye(t.home_has_prior_insurance)),t.home_prior_expiration_date&&(r.home_prior_expiration_date=mt(t.home_prior_expiration_date)),t.home_prior_carrier_name&&(r.home_prior_carrier_name=t.home_prior_carrier_name),t.home_prior_years!==null&&t.home_prior_years!==void 0&&(r.home_prior_years=t.home_prior_years),t.home_continuous_coverage_years!==null&&t.home_continuous_coverage_years!==void 0&&(r.home_continuous_coverage_years=t.home_continuous_coverage_years),t.property_insurance_cancelled!==null&&t.property_insurance_cancelled!==void 0&&(r.property_insurance_cancelled=ye(t.property_insurance_cancelled)),t.lapse_in_coverage!==null&&t.lapse_in_coverage!==void 0&&(r.lapse_in_coverage=ye(t.lapse_in_coverage)),t.year_built!==null&&t.year_built!==void 0&&(r.year_built=t.year_built),t.number_of_units!==null&&t.number_of_units!==void 0&&(r.number_of_units=t.number_of_units),t.number_of_stories!==null&&t.number_of_stories!==void 0&&(r.number_of_stories=t.number_of_stories),t.number_of_beds!==null&&t.number_of_beds!==void 0&&(r.number_of_beds=t.number_of_beds),t.number_of_full_baths!==null&&t.number_of_full_baths!==void 0&&(r.number_of_full_baths=t.number_of_full_baths),t.number_of_partial_baths!==null&&t.number_of_partial_baths!==void 0&&(r.number_of_partial_baths=t.number_of_partial_baths),t.under_construction!==null&&t.under_construction!==void 0&&(r.under_construction=ye(t.under_construction)),t.distance_from_fire_hydrant_ft&&(r.distance_from_fire_hydrant_ft=t.distance_from_fire_hydrant_ft),t.distance_from_fire_station_miles&&(r.distance_from_fire_station_miles=t.distance_from_fire_station_miles),t.architectural_style&&(r.architectural_style=t.architectural_style),t.dwelling_type&&(r.dwelling_type=t.dwelling_type),t.construction_quality&&(r.construction_quality=t.construction_quality),t.located_over_water!==null&&t.located_over_water!==void 0&&(r.located_over_water=t.located_over_water),t.construction_type&&(r.construction_type=t.construction_type),t.exterior_wall_type&&(r.exterior_wall_type=t.exterior_wall_type),t.foundation_type&&(r.foundation_type=t.foundation_type),t.roof_material_type&&(r.roof_material_type=t.roof_material_type),t.roof_shape&&(r.roof_shape=t.roof_shape),t.roof_updated_type&&(r.roof_updated_type=t.roof_updated_type),t.year_roof_updated!==null&&t.year_roof_updated!==void 0&&(r.year_roof_updated=t.year_roof_updated),t.mit_credit_form!==null&&t.mit_credit_form!==void 0&&(r.mit_credit_form=ye(t.mit_credit_form)),t.storm_shutters!==null&&t.storm_shutters!==void 0&&(r.storm_shutters=ye(t.storm_shutters)),t.heating_type&&(r.heating_type=t.heating_type),t.oil_tank_location&&(r.oil_tank_location=t.oil_tank_location),t.heating_fuel_type&&(r.heating_fuel_type=t.heating_fuel_type),t.number_of_fireplaces!==null&&t.number_of_fireplaces!==void 0&&(r.number_of_fireplaces=t.number_of_fireplaces),t.basement_type&&(r.basement_type=t.basement_type),t.parking_type&&(r.parking_type=t.parking_type),t.garage_type&&(r.garage_type=t.garage_type),t.number_of_parking_spaces!==null&&t.number_of_parking_spaces!==void 0&&(r.number_of_parking_spaces=t.number_of_parking_spaces),t.plumbing_type&&(r.plumbing_type=t.plumbing_type),t.pool_type&&(r.pool_type=t.pool_type),t.total_area_sq_ft!==null&&t.total_area_sq_ft!==void 0&&(r.total_area_sq_ft=t.total_area_sq_ft),t.parcel_area_sq_ft!==null&&t.parcel_area_sq_ft!==void 0&&(r.parcel_area_sq_ft=t.parcel_area_sq_ft),t.residence_type&&(r.residence_type=t.residence_type),t.usage_type&&(r.usage_type=t.usage_type),t.household_size!==null&&t.household_size!==void 0&&(r.household_size=t.household_size),t.number_of_mortgagees!==null&&t.number_of_mortgagees!==void 0&&(r.number_of_mortgagees=t.number_of_mortgagees),t.has_dog!==null&&t.has_dog!==void 0&&(r.has_dog=ye(t.has_dog)),t.dog_breed_type&&(r.dog_breed_type=t.dog_breed_type),t.number_of_dogs!==null&&t.number_of_dogs!==void 0&&(r.number_of_dogs=t.number_of_dogs),t.has_vicious_animals!==null&&t.has_vicious_animals!==void 0&&(r.has_vicious_animals=ye(t.has_vicious_animals)),t.has_business_on_premises!==null&&t.has_business_on_premises!==void 0&&(r.has_business_on_premises=ye(t.has_business_on_premises)),t.business_class&&(r.business_class=t.business_class),t.occupancy_type&&(r.occupancy_type=t.occupancy_type),t.short_term_rental!==null&&t.short_term_rental!==void 0&&(r.short_term_rental=ye(t.short_term_rental)),t.sale_price_cents!==null&&t.sale_price_cents!==void 0&&(r.sale_price_cents=Math.round(Number(t.sale_price_cents)/100)),t.number_of_families!==null&&t.number_of_families!==void 0&&(r.number_of_families=t.number_of_families),t.number_of_units_in_firewall!==null&&t.number_of_units_in_firewall!==void 0&&(r.number_of_units_in_firewall=t.number_of_units_in_firewall),t.heating_update_yn!==null&&t.heating_update_yn!==void 0&&(r.heating_update_yn=ye(t.heating_update_yn)),t.heating_update_type&&(r.heating_update_type=t.heating_update_type),t.heating_update_year!==null&&t.heating_update_year!==void 0&&(r.heating_update_year=t.heating_update_year),t.plumbing_update_yn!==null&&t.plumbing_update_yn!==void 0&&(r.plumbing_update_yn=ye(t.plumbing_update_yn)),t.plumbing_update_type&&(r.plumbing_update_type=t.plumbing_update_type),t.plumbing_update_year!==null&&t.plumbing_update_year!==void 0&&(r.plumbing_update_year=t.plumbing_update_year),t.electrical_update_yn!==null&&t.electrical_update_yn!==void 0&&(r.electrical_update_yn=ye(t.electrical_update_yn)),t.electrical_update_type&&(r.electrical_update_type=t.electrical_update_type),t.electrical_update_year!==null&&t.electrical_update_year!==void 0&&(r.electrical_update_year=t.electrical_update_year),t.electric_circuit_breaker!==null&&t.electric_circuit_breaker!==void 0&&(r.electric_circuit_breaker=ye(t.electric_circuit_breaker)),t.dwelling_replacement_cost!==null&&t.dwelling_replacement_cost!==void 0&&(r.dwelling_replacement_cost=t.dwelling_replacement_cost),t.other_structures_coverage!==null&&t.other_structures_coverage!==void 0&&(r.other_structures_coverage=t.other_structures_coverage),t.personal_property_coverage!==null&&t.personal_property_coverage!==void 0&&(r.personal_property_coverage=t.personal_property_coverage),t.loss_of_use_coverage!==null&&t.loss_of_use_coverage!==void 0&&(r.loss_of_use_coverage=t.loss_of_use_coverage),t.personal_liability&&(r.personal_liability=t.personal_liability),t.dwelling_medical_payments&&(r.dwelling_medical_payments=t.dwelling_medical_payments),t.all_perils_deductible&&(r.all_perils_deductible=t.all_perils_deductible),t.windstorm_deductible&&(r.windstorm_deductible=t.windstorm_deductible),t.has_garage!==null&&t.has_garage!==void 0&&(r.has_garage=ye(t.has_garage)),t.has_pool!==null&&t.has_pool!==void 0&&(r.has_pool=ye(t.has_pool)),t.has_trampoline!==null&&t.has_trampoline!==void 0&&(r.has_trampoline=ye(t.has_trampoline)),t.gender&&(r.gender=t.gender),t.marital_status&&(r.marital_status=t.marital_status),t.employment_industry&&(r.employment_industry=t.employment_industry),t.occupation&&(r.occupation=t.occupation),t.has_co_applicant!==null&&t.has_co_applicant!==void 0&&(r.has_co_applicant=ye(t.has_co_applicant)),t.co_applicant_first_name&&(r.co_applicant_first_name=t.co_applicant_first_name),t.co_applicant_middle_name&&(r.co_applicant_middle_name=t.co_applicant_middle_name),t.co_applicant_last_name&&(r.co_applicant_last_name=t.co_applicant_last_name),t.co_applicant_gender&&(r.co_applicant_gender=t.co_applicant_gender),t.co_applicant_marital_status&&(r.co_applicant_marital_status=t.co_applicant_marital_status),t.co_applicant_relationship&&(r.co_applicant_relationship=t.co_applicant_relationship),t.co_applicant_date_of_birth&&(r.co_applicant_date_of_birth=mt(t.co_applicant_date_of_birth)),t.co_applicant_employment_industry&&(r.co_applicant_employment_industry=t.co_applicant_employment_industry),t.co_applicant_occupation&&(r.co_applicant_occupation=t.co_applicant_occupation),t.retiree_discount!==null&&t.retiree_discount!==void 0&&(r.retiree_discount=ye(t.retiree_discount)),t.gated_community_discount!==null&&t.gated_community_discount!==void 0&&(r.gated_community_discount=ye(t.gated_community_discount)),t.multi_policy_discount!==null&&t.multi_policy_discount!==void 0&&(r.multi_policy_discount=ye(t.multi_policy_discount)),t.non_smoker_discount!==null&&t.non_smoker_discount!==void 0&&(r.non_smoker_discount=ye(t.non_smoker_discount)),t.first_time_buyer_discount!==null&&t.first_time_buyer_discount!==void 0&&(r.first_time_buyer_discount=ye(t.first_time_buyer_discount)),t.fire_detection_system!==null&&t.fire_detection_system!==void 0&&(r.fire_detection_system=ye(t.fire_detection_system)),t.fire_detection_system_type&&(r.fire_detection_system_type=t.fire_detection_system_type),t.burglar_alarm_system!==null&&t.burglar_alarm_system!==void 0&&(r.burglar_alarm_system=ye(t.burglar_alarm_system)),t.burglar_alarm_system_type&&(r.burglar_alarm_system_type=t.burglar_alarm_system_type),t.smoke_detectors!==null&&t.smoke_detectors!==void 0&&(r.smoke_detectors=ye(t.smoke_detectors)),t.sprinkler_system!==null&&t.sprinkler_system!==void 0&&(r.sprinkler_system=ye(t.sprinkler_system)),t.sprinkler_system_type&&(r.sprinkler_system_type=t.sprinkler_system_type),t.gas_leakage_detector!==null&&t.gas_leakage_detector!==void 0&&(r.gas_leakage_detector=ye(t.gas_leakage_detector)),t.deadbolt_locks!==null&&t.deadbolt_locks!==void 0&&(r.deadbolt_locks=ye(t.deadbolt_locks)),t.fire_extinguisher!==null&&t.fire_extinguisher!==void 0&&(r.fire_extinguisher=ye(t.fire_extinguisher)),t.order_credit_authorized!==null&&t.order_credit_authorized!==void 0&&(r.order_credit_authorized=ye(t.order_credit_authorized)),t.has_health_insurance_auto_accident!==null&&t.has_health_insurance_auto_accident!==void 0&&(r.has_health_insurance_auto_accident=ye(t.has_health_insurance_auto_accident)),t.is_corporation!==null&&t.is_corporation!==void 0&&(r.is_corporation=ye(t.is_corporation)),t.named_insured_foreclosure_repo_bankruptcy!==null&&t.named_insured_foreclosure_repo_bankruptcy!==void 0&&(r.named_insured_foreclosure_repo_bankruptcy=ye(t.named_insured_foreclosure_repo_bankruptcy)),t.named_insured_convicted_insurance_fraud!==null&&t.named_insured_convicted_insurance_fraud!==void 0&&(r.named_insured_convicted_insurance_fraud=ye(t.named_insured_convicted_insurance_fraud));const o={};if(t.vehicles)for(const i of t.vehicles)i.quote_vehicle_id&&i.vin&&(o[i.quote_vehicle_id]=i.vin);return t.drivers&&t.drivers.length>0?(r.drivers="Yes",r.drivers__items=t.drivers.map(i=>{const s=i,u={};s.first_name&&(u.first_name=s.first_name),s.middle_name&&(u.middle_name=s.middle_name),s.last_name&&(u.last_name=s.last_name),s.date_of_birth&&(u.date_of_birth=mt(s.date_of_birth)),s.gender&&(u.gender=s.gender),s.marital_status&&(u.marital_status=s.marital_status),s.relationship_to_insured&&(u.relationship_to_insured=s.relationship_to_insured),s.is_registered_owner!==null&&s.is_registered_owner!==void 0&&(u.is_registered_owner=s.is_registered_owner?"Yes":"No"),s.license_state&&(u.license_state=s.license_state),s.license_status&&(u.license_status=s.license_status),s.license_number&&(u.license_number=s.license_number),s.date_first_licensed&&(u.date_first_licensed=mt(s.date_first_licensed)),s.education_level&&(u.education_level=Oy(s.education_level)),s.occupation&&(u.occupation=By(s.occupation)),s.industry&&(u.industry=ai(s.industry)),s.employment_status&&(u.employment_status=s.employment_status),s.last_5_years_license_suspended_or_revoked!==null&&s.last_5_years_license_suspended_or_revoked!==void 0&&(u.last_5_years_license_suspended_or_revoked=ye(s.last_5_years_license_suspended_or_revoked)),s.accident_prevention_course!==null&&s.accident_prevention_course!==void 0&&(u.accident_prevention_course=ye(s.accident_prevention_course)),s.accident_prevention_course_date&&(u.accident_prevention_course_date=mt(s.accident_prevention_course_date)),s.sr22!==null&&s.sr22!==void 0&&(u.sr22=ye(s.sr22));const l=s.ssn_display;typeof l=="string"&&(u.ssn_display=l);const c=s.driver_violations;c&&c.length>0&&(u.driver_violations="Yes",u.driver_violations__items=c.map(h=>{const g={};return h.code&&(g.code=h.code),h.occurred_at&&(g.occurred_at=mt(h.occurred_at)),g}));const f=s.driver_accidents;f&&f.length>0&&(u.driver_accidents="Yes",u.driver_accidents__items=f.map(h=>{const g={};return h.occurred_at&&(g.occurred_at=mt(h.occurred_at)),h.description&&(g.description=h.description),h.quote_vehicle_id&&(g.quote_vehicle_id=o[h.quote_vehicle_id]??h.quote_vehicle_id),h.property_damage_amount_paid_cents!==null&&h.property_damage_amount_paid_cents!==void 0&&(g.property_damage_amount_paid_cents=h.property_damage_amount_paid_cents),h.personal_injury_amount_paid_cents!==null&&h.personal_injury_amount_paid_cents!==void 0&&(g.personal_injury_amount_paid_cents=h.personal_injury_amount_paid_cents),g}));const p=s.losses;return p&&p.length>0&&(u.losses="Yes",u.losses__items=p.map(h=>{const g={};return h.description&&(g.description=h.description),h.date_of_incident&&(g.date_of_incident=mt(h.date_of_incident)),h.amount_paid_cents!==null&&h.amount_paid_cents!==void 0&&(g.amount_paid_cents=h.amount_paid_cents),h.quote_vehicle_id&&(g.quote_vehicle_id=o[h.quote_vehicle_id]??h.quote_vehicle_id),g})),u})):r.drivers="No",t.vehicles&&t.vehicles.length>0?(r.vehicles="Yes",r.vehicles__items=t.vehicles.map(i=>{const s=i,u={};s.vin&&(u.vin=s.vin),s.year!==null&&s.year!==void 0&&(u.year=String(s.year)),s.make&&(u.make=s.make),s.model&&(u.model=s.model),s.body_style&&(u.body_style=s.body_style),s.ownership_type&&(u.ownership_type=s.ownership_type),s.usage&&(u.usage=s.usage),s.annual_mileage!==null&&s.annual_mileage!==void 0&&(u.annual_mileage=s.annual_mileage),s.miles_to_work!==null&&s.miles_to_work!==void 0&&(u.miles_to_work=s.miles_to_work),s.percent_to_work!==null&&s.percent_to_work!==void 0&&(u.percent_to_work=s.percent_to_work);const l=[];return s.garaging_address_line_1&&l.push(s.garaging_address_line_1),s.garaging_address_line_2&&l.push(s.garaging_address_line_2),s.garaging_address_city&&l.push(s.garaging_address_city),s.garaging_address_state&&l.push(s.garaging_address_state),s.garaging_address_postal_code&&l.push(s.garaging_address_postal_code),l.length>0&&(u.garaging_address=l.join(", ")),s.new_when_purchased!==null&&s.new_when_purchased!==void 0&&(u.new_when_purchased=ye(s.new_when_purchased)),s.purchase_date&&(u.purchase_date=mt(s.purchase_date)),s.anti_theft_type&&(u.anti_theft_type=s.anti_theft_type),s.passive_restraint_type&&(u.passive_restraint_type=s.passive_restraint_type),s.anti_lock_brakes!==null&&s.anti_lock_brakes!==void 0&&(u.anti_lock_brakes=ye(s.anti_lock_brakes)),s.daytime_running_lights!==null&&s.daytime_running_lights!==void 0&&(u.daytime_running_lights=ye(s.daytime_running_lights)),s.custom_equipment_value_cents!==null&&s.custom_equipment_value_cents!==void 0&&(u.custom_equipment_value_cents=s.custom_equipment_value_cents),s.cost_new_value_cents!==null&&s.cost_new_value_cents!==void 0&&(u.cost_new_value_cents=s.cost_new_value_cents),s.stated_value_amount_cents!==null&&s.stated_value_amount_cents!==void 0&&(u.stated_value_amount_cents=s.stated_value_amount_cents),s.vehicle_has_modifications!==null&&s.vehicle_has_modifications!==void 0&&(u.vehicle_has_modifications=ye(s.vehicle_has_modifications)),s.vehicle_garaged_at_residence!==null&&s.vehicle_garaged_at_residence!==void 0&&(u.vehicle_garaged_at_residence=ye(s.vehicle_garaged_at_residence)),s.vehicle_comp_deductible&&(u.vehicle_comp_deductible=s.vehicle_comp_deductible),s.vehicle_coll_deductible&&(u.vehicle_coll_deductible=s.vehicle_coll_deductible),s.vehicle_towing_and_labor&&(u.vehicle_towing_and_labor=s.vehicle_towing_and_labor),s.vehicle_transportation_expense&&(u.vehicle_transportation_expense=s.vehicle_transportation_expense),s.vehicle_full_glass!==null&&s.vehicle_full_glass!==void 0&&(u.vehicle_full_glass=ye(s.vehicle_full_glass)),s.vehicle_loan_lease!==null&&s.vehicle_loan_lease!==void 0&&(u.vehicle_loan_lease=ye(s.vehicle_loan_lease)),s.coverages&&s.coverages.length>0&&(u.coverages__items=s.coverages.map(c=>{const f={};return c.type&&(f.type=c.type),c.per_person_limit_cents!==null&&c.per_person_limit_cents!==void 0&&(f.per_person_limit_cents=c.per_person_limit_cents),c.per_incident_limit_cents!==null&&c.per_incident_limit_cents!==void 0&&(f.per_incident_limit_cents=c.per_incident_limit_cents),c.per_incident_limit_percent!==null&&c.per_incident_limit_percent!==void 0&&(f.per_incident_limit_percent=c.per_incident_limit_percent),c.per_day_limit_cents!==null&&c.per_day_limit_cents!==void 0&&(f.per_day_limit_cents=c.per_day_limit_cents),c.deductible_cents!==null&&c.deductible_cents!==void 0&&(f.deductible_cents=c.deductible_cents),c.is_declined!==null&&c.is_declined!==void 0&&(f.is_declined=ye(c.is_declined)),f})),s.vehicle_lienholders&&s.vehicle_lienholders.length>0&&(u.vehicle_lienholders__items=s.vehicle_lienholders.map(c=>{const f={};return c.name&&(f.name=c.name),c.type&&(f.type=c.type),c.line_1&&(f.line_1=c.line_1),c.line_2&&(f.line_2=c.line_2),c.city&&(f.city=c.city),c.state&&(f.state=c.state),c.postal_code&&(f.postal_code=c.postal_code),c.phone&&(f.phone=c.phone),c.fax&&(f.fax=c.fax),f})),u})):r.vehicles="No",t.losses&&t.losses.length>0?(r.home_losses="Yes",r.home_losses__items=t.losses.map(i=>{const s={};return i.description&&(s.description=i.description),i.date_of_incident&&(s.date_of_incident=mt(i.date_of_incident)),i.amount_paid_cents!==null&&i.amount_paid_cents!==void 0&&(s.amount_paid_cents=Math.round(Number(i.amount_paid_cents)/100)),s})):r.home_losses="No",r}const VT={Zip:"ZIP Code",Email:"Email",Product:"Product & Address",Home:"Home Details",Vehicle:"Vehicle",Name:"Name & DOB",Driver:"Operator",AutoCurrentCarrier:"Policy",HomeCurrentCarrier:"Policy",HomePolicy:"Policy",BundlePolicy:"Policy",Demographics:"Applicant",Ssn:"SSN",Phone:"Phone",SMSVerification:"Verify",AutoPolicy:"Policy",Customer:"Applicant",HomeCustomer:"Applicant",BundleCustomer:"Applicant",HomeConstruction:"Structure",HomeFeatures:"Features"};function zT(e){return VT[e]||e}const r_=new Set(["Zip","Product","Driver","Vehicle"]);function jT(e){return e?Array.isArray(e.drivers__items)?e.drivers__items.length:Array.isArray(e.drivers)?e.drivers.length:null:null}function n_(e,t){const r=jT(t),n=e.filter(o=>o.key!=="AutoPolicy"),a=n.length>0?n:e;return a}function ZT(e,t){const r=e.findIndex(a=>a.key===t);return r<0?t:e[r+1]?.key??t}function a_(e){return e.some(t=>String(t.key)==="BundlePolicy"||String(t.key)==="BundleCustomer")}function o_(e){return a_(e)?"Bundle":e.some(t=>String(t.key)==="Vehicle"||String(t.key)==="Driver")?"Auto":"Home"}const GT={Auto:45e3,Home:5e4,Bundle:1e5},i_=["a[href]","button:not([disabled])","textarea:not([disabled])","input:not([disabled])","select:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");function qT(e,t){if(e!=="AutoCurrentCarrier")return t;const r=t.some(o=>String(o.key)==="auto_cancelled_declined_refused_to_renew"),n=t.some(o=>String(o.key)==="vehicle_policy_selections"),a=[...t];return r||a.push({question:"Has any auto insurance company cancelled, declined or refused to renew you in the last 5 years?",inputType:"radio",options:["Yes","No"],key:"auto_cancelled_declined_refused_to_renew",required:!0}),n||a.push({question:"Vehicle coverage selections",inputType:"custom",key:"vehicle_policy_selections",required:!1}),a}function KT(e,t){if(e!=="Vehicle")return t;const r=n=>n.map(a=>{const o=a.conditionals?.map(i=>{const s=i.conditionalQuestions??[];return s.length?{...i,conditionalQuestions:r(s)}:i});return String(a.key)!=="vin"?o?{...a,conditionals:o}:a:{...a,required:!1,...o?{conditionals:o}:{}}});return r(t)}function YT({isOpen:e,onClose:t}){const[r,n]=d.useState([]),[a,o]=d.useState(null),i=d.useRef(null);d.useEffect(()=>{i.current=a},[a]);const[s,u]=d.useState(null),[l,c]=d.useState(!1),[f,p]=d.useState(!1),[h,g]=d.useState(!1),[y,_]=d.useState(!1),[D,w]=d.useState([]),b=d.useRef(null),[C,v]=d.useState(null),[k,I]=d.useState(void 0),[G,O]=d.useState(!1),[j,M]=d.useState(null),[W,ce]=d.useState(null),[x,V]=d.useState(!1),[U,P]=d.useState(!1),[K,$]=d.useState(!1),T=d.useRef(!1),Y=d.useRef(null),se=d.useRef(null),ee=d.useRef(null),H=d.useRef(null),[Q,A]=d.useState(!1);d.useEffect(()=>{if(!h||y)return;const L=o_(r);let J=!1;const X=[];let ie=0,ae=0;const de=66,F=3,N=5e3;let oe=!1;const te=async()=>{if(J)return;ie++;try{const{quote:fe}=await nb(a??void 0);if(J)return;if(ae=0,!oe){const De=fe?.appetites??null,_e=qk(De,L);_e.length>0&&(w(_e),oe=!0)}const pe=fe?.rates_status??null;if(pe==="completed"){const{rates:De}=await vl(a??void 0);if(J)return;b.current=De,_(!0);return}if(pe==="no_rates"){b.current=[],_(!0);return}if(pe==="failed"){In(new Error("Quote failed: rate-generation worker reported rates_status=failed"),{quoteId:i.current??void 0,phase:"rates_status_failed"}),xa({reason:"submission"}),M({message:"submission_failed"}),g(!1);return}}catch(fe){if(ae++,console.warn("Provider polling: getQuote failed",{attempt:ie,consecutiveFailures:ae,error:fe}),ae>=F){fe?.__sentryReported||In(fe,{quoteId:i.current??void 0,phase:"rates_polling",message:`Quote failed: ${F} consecutive get-quote poll failures`}),xa({reason:"network"}),M({message:"submission_failed"}),g(!1);return}}if(J)return;if(ie>=de){In(new Error(`Quote failed: rate-generation timed out after ${de} polls`),{quoteId:i.current??void 0,phase:"rates_polling_timeout"}),xa({reason:"timeout"}),M({message:"submission_failed"}),g(!1);return}const le=window.setTimeout(te,N);X.push(le)};return te(),()=>{J=!0,X.forEach(le=>window.clearTimeout(le))}},[h,y,r,a]);function S(L){return L.map(X=>({key:X,title:zT(X),loadQuestions:async()=>{const ie=await HA(X,i.current??void 0);let ae=qT(X,ie.questions);return ae=KT(X,ae),ae}}))}d.useEffect(()=>{const L=async()=>{try{const J=LT();if(J)try{const{token:ie,quoteId:ae}=await zA(J);ie&&ae&&(ci(ie),Ny(ae))}catch(ie){ie.statusCode===401&&P(!0)}const X=ui();if(di(),X){O(!0),o(X);try{const ie=Wt(),ae=await nb(ie?void 0:X);if(!ae||!ae.quote)throw new Error("Invalid response from getQuote: missing quote data");const{quote:de}=ae,{stages:F}=await fi(X),N=S(F);n(N);let oe;try{oe=HT(de),v(oe)}catch(_e){throw new Error(`Failed to transform quote data: ${_e instanceof Error?_e.message:"Unknown error"}`)}const te=n_(N,oe);n(te);const le=de?.review_status??null;if(p(le!=null),le==="pending_review"&&Wt()){$(!0);return}const fe=de?.rates_status??null,pe=Wt()!=null;if(pe||le===null){if(fe==="completed")try{const{rates:_e}=await vl(pe?void 0:X);u(_e);return}catch(_e){console.warn("Failed to fetch completed rates on resume",_e)}else if(fe==="no_rates"){u([]);return}else if(fe==="processing"){w([]),_(!1),b.current=null,g(!0);return}}I(0)}catch(ie){const ae=ie;if(ae.statusCode===404)Uy(),o(null);else if(ae.statusCode===401){eb();try{const{stages:de}=await fi(X),F=S(de);n(F);const N=F.findIndex(oe=>oe.key==="SMSVerification");I(N>=0?N:F.length-1)}catch{}}}finally{O(!1)}}else{const{stages:ie}=await fi();n(S(ie))}}catch{O(!1)}};e&&!T.current&&(T.current=!0,L())},[e]),d.useEffect(()=>{if(!e)return;const{overflow:L}=document.body.style;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=L}},[e]),d.useEffect(()=>{if(!e)return;H.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const L=window.setTimeout(()=>{const J=Y.current;if(!J)return;(J.querySelector(i_)??J).focus()},0);return()=>{window.clearTimeout(L);const J=H.current;H.current=null,J&&document.contains(J)&&J.focus()}},[e]);const E=d.useCallback(L=>{if(L.key==="Escape"){Q?(L.preventDefault(),A(!1)):(L.preventDefault(),A(!0));return}if(L.key!=="Tab")return;const J=Q?se.current:Y.current;if(!J)return;const X=Array.from(J.querySelectorAll(i_)).filter(F=>!F.hasAttribute("disabled")&&F.getAttribute("aria-hidden")!=="true");if(X.length===0){L.preventDefault(),J.focus();return}const ie=X[0],ae=X[X.length-1],de=document.activeElement;L.shiftKey&&de===ie?(L.preventDefault(),ae.focus()):!L.shiftKey&&de===ae&&(L.preventDefault(),ie.focus())},[Q]);d.useEffect(()=>{if(e)return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[e,E]),d.useEffect(()=>{if(!Q)return;const L=window.setTimeout(()=>{ee.current?.focus()},0);return()=>window.clearTimeout(L)},[Q]),d.useEffect(()=>{e||(v(null),I(void 0),O(!1),g(!1),ce(null),V(!1),A(!1))},[e]),d.useEffect(()=>{e&&Tk()},[e]),d.useEffect(()=>{s&&Array.isArray(s)&&Fk({rateCount:s.length})},[s]);const z=d.useCallback(()=>{M(null),I(Math.max(0,r.length-1))},[r.length]),q=d.useCallback(async(L,J)=>{try{w([]),_(!1),b.current=null,g(!0);let X;try{X=await Dr(L,!0,a??void 0)}catch(de){throw g(!1),de}if(X.status==="submission_failed"){In(new Error(`Quote failed at submission: ${X.message}`),{quoteId:a??void 0,phase:J}),g(!1),_(!1),b.current=null,xa({reason:"submission"}),M({message:X.message});return}if(X.status==="success")try{const{rates:de}=await vl(a??void 0);b.current=de,_(!0)}catch(de){throw g(!1),de}const ie=r.length,ae=r[ie-1];Cb({stageKey:ae?.key??"unknown",stageTitle:ae?.title??"unknown",stepIndex:ie,totalSteps:ie}),Mk()}catch(X){X?.__sentryReported||In(X,{quoteId:a??void 0,phase:J}),g(!1),xa({reason:"submission"}),M({message:"Oops, something went wrong. Please try again later."})}},[a,r]),ne=d.useCallback(async L=>{if(!(!W||!a||x)){V(!0);try{const X={...en(W.allValues),communications_consent:L};ce(null),await q(X,"consent_submit")}finally{V(!1)}}},[W,a,x,q]),Z=d.useCallback(async L=>{if(!(!a||x)){V(!0);try{v(L);const J={...en(L),customer_review_confirmed:!0};await q(J,"review_submit")}finally{V(!1)}}},[a,x,q]);if(!e)return null;const ue=()=>{A(!0)},ve=()=>{A(!1)},R=()=>{Pk(),t()},re=!!(!j&&s&&a&&!l);return m.jsxs("div",{ref:Y,className:"fixed inset-0 z-[9999] flex items-center justify-center",role:"dialog","aria-modal":"true","aria-labelledby":"insurance-modal-title",tabIndex:-1,children:[m.jsx("div",{className:"backdrop","aria-hidden":"true"}),m.jsxs("div",{className:`modal-panel bg-white relative w-full flex flex-col max-h-[90vh] overflow-hidden ${re?"max-w-6xl":"max-w-2xl"}`,role:"document",children:[m.jsx("h2",{id:"insurance-modal-title",className:"sr-only",children:"Credify insurance quote widget"}),m.jsx("button",{onClick:ue,className:"modal-close-btn absolute top-4 right-4","aria-label":"Close quote form",type:"button",children:m.jsx("span",{"aria-hidden":"true",children:"×"})}),!h&&!j&&m.jsx("div",{className:"widget-modal-header text-center",children:m.jsx("h2",{className:"h1-title",children:"Let's shop multiple leading carriers for you"})}),m.jsxs("div",{className:"panel-body flex-1 min-h-0 overflow-hidden",children:[U&&m.jsxs("div",{className:"mb-4 flex items-start justify-between gap-3 rounded-md border border-amber-300 bg-amber-50 px-4 py-3 text-sm text-amber-800",role:"alert",children:[m.jsx("span",{children:"This resume link has expired or is no longer valid. For your security, emailed links only work for a limited time — you can continue your quote below."}),m.jsx("button",{type:"button",onClick:()=>P(!1),className:"shrink-0 font-bold text-amber-800 hover:text-amber-900","aria-label":"Dismiss",children:"×"})]}),j&&m.jsx(Zb,{onGoBack:z}),!j&&h&&(()=>{const L=o_(r);return m.jsx(hT,{providers:D,totalTime:GT[L],flow:L,isComplete:y,onComplete:()=>{g(!1),_(!1),w([]),b.current&&(u(b.current),b.current=null)}})})(),!j&&!h&&W&&m.jsx(Sw,{onChoose:ne,isSubmitting:x}),!j&&!s&&!h&&!W&&m.jsx(m.Fragment,{children:G||r.length===0?m.jsx("div",{className:"flex items-center justify-center py-12",children:m.jsx("div",{className:"text-slate-600",children:"Loading..."})}):K&&a?m.jsx(mT,{stages:r,initialValues:C??{},quoteId:a,isSubmitting:x,onConfirmed:Z}):m.jsx(jk,{stages:r,initialValues:C??void 0,initialActive:k,quoteId:a??void 0,nonTerminalStageKeys:r_,onStageComplete:async(L,J)=>{try{const X=en(L);let ie=a,ae=r;const de=ae.findIndex(oe=>oe.key===J),F=ae[de],N=ZT(ae,J);if(ie)if(J==="Phone"){const oe=X.phone;if(!oe)throw new Error("Phone number is required.");const te=Wt();await Dr({...X,current_stage:N},!1,te?void 0:ie),await tb(ie,oe)}else if(J==="SMSVerification"){const{isVerified:oe,token:te}=await _l(ie,X.sms_code);if(!oe)throw new Error("Invalid SMS code");te&&ci(te),await Dr({current_stage:N},!1)}else if(J==="Product"){const oe=Wt(),{isSupported:te}=await rb(X.state,oe?void 0:ie??void 0);if(await Dr({...X,current_stage:te?N:J},!1,oe?void 0:ie),!te){const le=Vb(X.state);throw new Error(`Sorry, Credify Corporation doesn't currently offer insurance in ${le}. We're expanding our coverage and hope to serve your state soon.`)}}else{const oe=Wt();await Dr({...X,current_stage:N},!1,oe?void 0:ie||void 0)}else{const oe=X.postal_code??"";if(!oe)throw new Error("ZIP code is required to start a quote.");const le=(await VA(oe,UT()))?.quoteId;if(!le||typeof le!="string"||le.trim()==="")throw new Error(`Failed to create quote - invalid quoteId returned: ${le}`);ie=le,o(le),Ny(le),await Dr({...X,current_stage:N},!1,le)}if(J==="Name"&&ie){const oe=String(L.product??"");(oe==="Auto"||oe==="Both")&&bk(ie)}if(J==="Vehicle"&&ie&&Ek(ie),r_.has(J))try{const{stages:oe}=await fi(ie||void 0);ae=S(oe),ae=n_(ae,L),n(ae)}catch(oe){console.warn("Unable to refresh stages after flow-shaping step",oe)}return Cb({stageKey:J,stageTitle:F?.title??J,stepIndex:de+1,totalSteps:ae.length}),{success:!0,latestStages:ae}}catch(X){return{success:!1,error:X instanceof Error?X.message:"An error occurred"}}},onComplete:async(L,J)=>{if(!a)return{success:!1,error:"Oops, something went wrong. Please try again later."};v(L);try{if(J==="Phone"){const X=en(L);if(!X.phone)return{success:!1,error:"Phone number is required."};const ae=Wt();return await Dr({...X,suppress_verification_sms:!0},!1,ae?void 0:a),ce({allValues:L}),{success:!0}}if(J==="SMSVerification"){const X=en(L),{isVerified:ie,token:ae}=await _l(a,X.sms_code);return ie?(ae&&ci(ae),ce({allValues:L}),{success:!0}):{success:!1,error:"Invalid SMS code"}}return ce({allValues:L}),{success:!0}}catch{const ie="Oops, something went wrong. Please try again later.";return M({message:ie}),{success:!1,error:ie}}}})})," ",!j&&s&&a&&m.jsx(eT,{rates:s,onBack:()=>u(null),isBundleFlow:a_(r),quoteId:a,initialPhone:C?.phone??"",requirePursueVerification:f,onSubScreenChange:c})]}),m.jsxs("div",{className:"widget-legal-footer space-y-1.5",children:[m.jsx(FT,{}),m.jsx("p",{className:"text-center text-sm text-slate-500",children:"Insurance products offered through Credify Corporation, a licensed insurance agency."})]}),Q&&m.jsx("div",{className:"close-confirm-backdrop",role:"presentation",children:m.jsxs("div",{ref:se,className:"close-confirm-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":"close-confirm-title","aria-describedby":"close-confirm-description",tabIndex:-1,children:[m.jsx("h3",{id:"close-confirm-title",children:"Close quote form?"}),m.jsx("p",{id:"close-confirm-description",children:"Your answers in this session will be lost if you close this window."}),m.jsxs("div",{className:"close-confirm-actions",children:[m.jsx("button",{ref:ee,type:"button",className:"btn-outline",onClick:ve,children:"Keep editing"}),m.jsx("button",{type:"button",className:"btn-primary close-confirm-danger",onClick:R,children:"Close form"})]})]})})]})]})}function QT({onClose:e}){return m.jsxs("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center",role:"dialog","aria-modal":"true",children:[m.jsx("div",{className:"backdrop","aria-hidden":"true"}),m.jsx("div",{className:"modal-panel bg-white relative w-full max-w-2xl p-6",children:m.jsx(Zb,{onGoBack:e})})]})}function XT({isOpen:e}){const t=()=>wi.close();return m.jsx(ps,{fallback:m.jsx(QT,{onClose:t}),children:m.jsx(YT,{isOpen:e,onClose:t})})}var Ll={dsn:"",environment:"production",release:"d9af5afa9b45f9b580135d355b0c26800fe8ccc7"};function WT(){try{return typeof Ll<"u"&&Ll?Ll:{}}catch{return{}}}let s_=!1;function JT(e,t){if(!e)return t;const r=Number(e);return Number.isFinite(r)&&r>=0&&r<=1?r:t}function eP(e={}){if(s_)return!0;if(typeof window>"u")return!1;const t=WT(),r=e.dsn??t.dsn;return!r||e.enabled===!1?!1:(PA({baseUrl:Ve}),A1({dsn:r,environment:e.environment??t.environment??"production",release:e.release??t.release,sendDefaultPii:!1,maxBreadcrumbs:50,tracesSampleRate:e.tracesSampleRate??JT(t.tracesSampleRate,.1),tracePropagationTargets:[Ve],replaysSessionSampleRate:0,replaysOnErrorSampleRate:1,beforeSend:n=>Yy(n),beforeBreadcrumb:n=>n&&(Yy({breadcrumbs:[n]}),n)}),s_=!0,x1("replayIntegration").then(n=>{try{g4(n({maskAllText:!0,maskAllInputs:!0,blockAllMedia:!0,networkDetailAllowUrls:[Ve],networkCaptureBodies:!1}))}catch{}}).catch(()=>{}),!0)}var u_={key:""};const tP="mock";function rP(){try{typeof u_<"u"&&u_?.key;return}catch{return}}function nP(){const e=rP();if(!e||typeof window>"u"||!window.location)return!1;try{return new URLSearchParams(window.location.search).get(tP)===e}catch{return!1}}const aP=new Set(["/create-quote","/get-stages-for-quote","/get-questions-by-stage","/update-quote","/verify-quote","/is-supported-state","/get-rates","/get-quote","/get-vehicle-options","/request-bind"]);let l_=!1;function oP(e){try{if(typeof e=="string")return new URL(e,window.location.href).pathname;if(e instanceof URL)return e.pathname;if(e instanceof Request)return new URL(e.url,window.location.href).pathname}catch{return null}return null}async function iP(e,t){try{if(t?.body&&typeof t.body=="string")return JSON.parse(t.body);if(e instanceof Request){const r=await e.clone().text();return r?JSON.parse(r):{}}}catch{return{}}return{}}function c_(e,t=200){return new Response(JSON.stringify(e),{status:t,headers:{"Content-Type":"application/json"}})}function sP(){try{if(typeof document>"u"||document.getElementById("credify-mock-badge"))return;const e=()=>{const t=document.createElement("div");t.id="credify-mock-badge",t.textContent="MOCK MODE",t.setAttribute("aria-hidden","true"),t.style.cssText=["position:fixed","bottom:12px","left:12px","z-index:2147483647","background:#b91c1c","color:#fff","font:600 11px/1 system-ui,sans-serif","letter-spacing:0.08em","padding:6px 10px","border-radius:9999px","box-shadow:0 1px 4px rgba(0,0,0,0.3)","pointer-events:none","user-select:none"].join(";"),document.body.appendChild(t)};document.body?e():document.addEventListener("DOMContentLoaded",e,{once:!0})}catch{}}function uP(){if(l_||typeof window>"u"||typeof window.fetch!="function"||!nP())return;l_=!0;const e=window.fetch.bind(window),t=Promise.resolve().then(()=>OP);window.fetch=async(r,n)=>{const a=oP(r);if(!a||!aP.has(a))return e(r,n);const o=await iP(r,n),{handleMockRequest:i}=await t;await new Promise(s=>window.setTimeout(s,120));try{return c_(i(a,o))}catch(s){return c_({error:s instanceof Error?s.message:"Mock handler error"},404)}},sP(),typeof console<"u"&&console.info("[Credify] Mock mode active — all API calls are served from in-memory fixtures.")}uP();let er=null,tn=null,Ci=!1;function lP(){er||(er=document.createElement("div"),er.id="insurance-widget-root",document.documentElement.appendChild(er)),!tn&&er&&(tn=b_.createRoot(er))}function Rl(){lP(),tn&&tn.render(d.createElement(XT,{isOpen:Ci}))}function cP(){tn&&er&&(tn.unmount(),er.remove()),tn=null,er=null,Qb(),kk()}const wi={init:e=>{eP(e?.sentry),kT(e?.support),OT(),NT(),Ci=!!e?.autoOpen||BT(),Rl()},open:()=>{Ci=!0,Rl()},close:()=>{Ci=!1,Rl()},destroy:cP,on:Db,off:Sb,support:{openChat:Kb,startScreenShare:Yb}};typeof window<"u"&&(window.CredifyInsuranceWidget=wi);const dP=["Zip","Email","Product"],fP={Auto:["Zip","Email","Product","Name","Vehicle","Driver","AutoCurrentCarrier","Demographics","Ssn","Phone"],Home:["Zip","Email","Product","Name","Home","HomePolicy","Demographics","Ssn","Phone"],Bundle:["Zip","Email","Product","Name","Home","Vehicle","Driver","BundlePolicy","Demographics","Ssn","Phone"]};function mP(e){return e==="Auto"||e==="Home"||e==="Bundle"?fP[e]:dP}const d_=["Allstate","State Farm","GEICO","Progressive","Liberty Mutual","Nationwide","Farmers","NoPriorInsurance"],f_=["25/50","50/100","100/300","250/500"],pP=Array.from({length:35},(e,t)=>String(2024-t)),hP=[{question:"What's your ZIP code?",inputType:"text",key:"postal_code",required:!0}],gP=[{question:"What is your email address?",inputType:"email",key:"email",required:!0}],yP=[{question:"Do you want to quote auto, home, or both?",inputType:"select",options:["Auto","Home","Bundle"],key:"product",required:!0},{question:"What is your property address?",inputType:"address",key:"address",required:!0}],bP=[{question:"What is your first name?",inputType:"text",key:"first_name",required:!0},{question:"What is your last name?",inputType:"text",key:"last_name",required:!0},{question:"What is your date of birth?",inputType:"date",key:"date_of_birth",required:!0}],_P=[{question:"Add Vehicles",inputType:"radio",options:["Yes"],key:"vehicles",required:!0,conditionals:[{conditionalType:"equals",conditionalValue:"Yes",conditionalQuestionsAllowMultiple:!0,conditionalQuestions:[{question:"Vehicle Identification Number (VIN)",inputType:"text",key:"vin",required:!1},{question:"Year",inputType:"select",options:pP,key:"year",required:!0},{question:"Make",inputType:"select",options:[],key:"make",required:!0},{question:"Model",inputType:"select",options:[],key:"model",required:!0},{question:"Body style",inputType:"select",options:[],key:"body_style",required:!0},{question:"Vehicle ownership type",inputType:"select",options:["Owned","Leased","Lien"],key:"ownership_type",required:!0},{question:"What is the primary use of this vehicle?",inputType:"select",options:["Pleasure","To_FromWork","To_FromSchool","Business","Farming"],key:"usage",required:!0},{question:"Annual mileage driven",inputType:"number",key:"annual_mileage",required:!0}]}]}],vP=[{question:"Add Drivers",inputType:"radio",options:["Yes"],key:"drivers",required:!0,conditionals:[{conditionalType:"equals",conditionalValue:"Yes",conditionalQuestionsAllowMultiple:!0,conditionalQuestions:[{question:"First Name",inputType:"text",key:"first_name",required:!0},{question:"Middle Name Initial",inputType:"text",key:"middle_name",required:!1},{question:"Last Name",inputType:"text",key:"last_name",required:!0},{question:"Date of Birth",inputType:"date",key:"date_of_birth",required:!0},{question:"Gender",inputType:"select",options:["Male","Female"],key:"gender",required:!0},{question:"What is the relationship to Driver #1?",inputType:"select",options:["Spouse","Parent","Child","Domestic Partner","Relative","Employee","Other"],key:"relationship_to_insured",required:!0},{question:"Marital status",inputType:"select",options:["Single","Married","Divorced","Widowed"],key:"marital_status",required:!0}]}]}],m_=[{question:"When do you need your insurance to begin?",inputType:"date",key:"effective_date",required:!0},{question:"Type of residence",inputType:"select",options:["Single Family Dwelling","Condo","Apartment","Townhouse","Mobile Home"],key:"residence_type",required:!0},{question:"Please select your current auto insurance company",inputType:"select",options:d_,key:"auto_prior_carrier_name",required:!0,conditionals:[{conditionalType:"notEquals",conditionalValue:"NoPriorInsurance",conditionalQuestions:[{question:"Years with prior personal auto carrier",inputType:"number",key:"auto_prior_years",required:!0},{question:"Months with prior personal auto carrier",inputType:"number",key:"auto_prior_months",required:!0},{question:"When does the current policy expire?",inputType:"date",key:"auto_prior_expiration_date",required:!0},{question:"What is your current or most recent Bodily Injury Limit?",inputType:"select",options:f_,key:"auto_prior_liability_limit",required:!0}]}]},{question:"Has any auto insurance company cancelled, declined or refused to renew you in the last 5 years?",inputType:"radio",options:["Yes","No"],key:"auto_cancelled_declined_refused_to_renew",required:!0},{question:"Bodily Injury liability",inputType:"select",options:f_,key:"policy_bi",required:!0},{question:"Property Damage Liability",inputType:"select",options:["25000","50000","100000"],key:"policy_pd",required:!0}],EP=[{question:"Year built",inputType:"number",key:"year_built",required:!0},{question:"Total living area (sq ft)",inputType:"number",key:"total_area_sq_ft",required:!0},{question:"Dwelling type",inputType:"select",options:["Single Family","Condo","Townhouse","Multi-Family"],key:"dwelling_type",required:!0},{question:"Construction type",inputType:"select",options:["Frame","Masonry","Masonry Veneer","Fire Resistive"],key:"construction_type",required:!0},{question:"Roof material",inputType:"select",options:["Asphalt Shingle","Metal","Tile","Wood Shake","Slate"],key:"roof_material_type",required:!0},{question:"Number of stories",inputType:"select",options:["1","1.5","2","2.5","3"],key:"number_of_stories",required:!0}],p_=[{question:"When do you need your insurance to begin?",inputType:"date",key:"effective_date",required:!0},{question:"Do you currently have a Homeowners policy?",inputType:"radio",options:["Yes","No"],key:"home_has_prior_insurance",required:!0,conditionals:[{conditionalType:"equals",conditionalValue:"Yes",conditionalQuestions:[{question:"Which carrier currently insures the home?",inputType:"select",options:d_,key:"home_prior_carrier_name",required:!0}]}]},{question:"Personal liability limit",inputType:"select",options:["100000","300000","500000","1000000"],key:"home_personal_liability",required:!0},{question:"All-perils deductible",inputType:"select",options:["500","1000","2500","5000"],key:"home_all_perils_deductible",required:!0}],DP=[...p_,...m_],SP={Zip:hP,Email:gP,Product:yP,Name:bP,Vehicle:_P,Driver:vP,AutoCurrentCarrier:m_,Home:EP,HomePolicy:p_,BundlePolicy:DP,Demographics:[{question:"Gender",inputType:"radio",options:["Male","Female"],key:"gender",required:!0},{question:"Marital status",inputType:"select",options:["Single","Married","Divorced","Widowed","Domestic Partner"],key:"marital_status",required:!0},{question:"Employment industry",inputType:"select",options:["Technology","Healthcare","Education","Finance","Retail","Construction","Other"],key:"employment_industry",required:!0},{question:"How many occupants live in the household?",inputType:"number",key:"household_size",required:!0},{question:"Do you authorize us to check your credit?",inputType:"radio",options:["Yes","No"],key:"order_credit_authorized",required:!0}],Ssn:[{question:"Social Security Number",inputType:"text",key:"social_security_number",required:!1}],Phone:[{question:"What is your phone number?",inputType:"tel",key:"phone",required:!0}],SMSVerification:[{question:"Please enter the code we sent to your phone number.",inputType:"text",key:"sms_code",required:!0}]};function CP(e){return SP[e]??[]}const wP=[{quote_rate_id:"mock-rate-1",carrier_name:"Progressive",carrier_logo_base64:null,carrier_quote_id:"MOCK-PRG-001",premium_cents:142800,monthly_premium_cents:11900,term_months:12,lob:"auto",admitted_status:"admitted",effective_date:"2026-07-01",policy_end_date:"2027-07-01"},{quote_rate_id:"mock-rate-2",carrier_name:"Nationwide",carrier_logo_base64:null,carrier_quote_id:"MOCK-NW-002",premium_cents:156e3,monthly_premium_cents:13e3,term_months:12,lob:"auto",admitted_status:"admitted",effective_date:"2026-07-01",policy_end_date:"2027-07-01"},{quote_rate_id:"mock-rate-3",carrier_name:"Liberty Mutual",carrier_logo_base64:null,carrier_quote_id:"MOCK-LM-003",premium_cents:173400,monthly_premium_cents:14450,term_months:12,lob:"auto",admitted_status:"non_admitted",effective_date:"2026-07-01",policy_end_date:"2027-07-01"},{quote_rate_id:"mock-nq-1",carrier_name:"Travelers",carrier_logo_base64:null,carrier_quote_id:null,premium_cents:0,monthly_premium_cents:null,term_months:0,lob:"auto",admitted_status:"not_quoted",effective_date:null,policy_end_date:null,decline_category:"Upfront Underwriting",decline_reasons:["Consumer didn’t grant permission to review credit score."]},{quote_rate_id:"mock-nq-2",carrier_name:"NationalGeneral",carrier_logo_base64:null,carrier_quote_id:null,premium_cents:0,monthly_premium_cents:null,term_months:0,lob:"auto",admitted_status:"not_quoted",effective_date:null,policy_end_date:null,decline_category:"Declinations",decline_reasons:["Carrier requires credit report ordering. Please select Yes for Credit Check Authorized.","Monoline quoting is not allowed."]},{quote_rate_id:"mock-nq-3",carrier_name:"Allstate",carrier_logo_base64:null,carrier_quote_id:null,premium_cents:0,monthly_premium_cents:null,term_months:0,lob:"auto",admitted_status:"not_quoted",effective_date:null,policy_end_date:null,decline_category:"Declinations",decline_reasons:["This carrier will not quote if the credit disclosure is not accepted by the insured."]}],xP=["Toyota","Honda","Ford","Chevrolet","Tesla","Subaru"],$P={Toyota:["Camry","Corolla","RAV4","Highlander","Tacoma"],Honda:["Civic","Accord","CR-V","Pilot","Odyssey"],Ford:["F-150","Escape","Explorer","Mustang","Bronco"],Chevrolet:["Silverado","Equinox","Malibu","Tahoe","Camaro"],Tesla:["Model 3","Model Y","Model S","Model X"],Subaru:["Outback","Forester","Crosstrek","Impreza"]},AP=["Sedan","SUV","Truck","Coupe","Hatchback","Minivan"];function kP(e){return e.make&&e.model?{ready:!0,bodyStyles:AP}:e.make?{ready:!0,models:$P[e.make]??["Base","Sport","Limited"]}:{ready:!0,makes:xP}}function TP(){return{year:2022,make:"Toyota",model:"Camry",bodyStyle:"Sedan"}}const xi="mock-quote-0001",h_="mock-jwt-token";let $a={quote_id:xi};function PP(e={}){$a={quote_id:xi,...e}}function IP(e){return e.action==="send"?{success:!0}:e.action==="resume"?{isVerified:!0,token:h_,quoteId:xi}:{isVerified:!0,token:h_}}function MP(e){return e.action==="vinDecode"?TP():kP({year:typeof e.year=="number"?e.year:void 0,make:typeof e.make=="string"?e.make:void 0,model:typeof e.model=="string"?e.model:void 0})}function FP(e,t){switch(e){case"/create-quote":return PP({postal_code:t.postal_code}),{quoteId:xi};case"/get-stages-for-quote":return{stages:mP($a.product)};case"/get-questions-by-stage":return{questions:CP(t.stage)};case"/update-quote":{const r={...t.payload??{}};return delete r.current_stage,$a={...$a,...r},{status:"success"}}case"/verify-quote":return IP(t);case"/is-supported-state":return{isSupported:!0};case"/get-rates":return{rates:wP};case"/get-quote":return{quote:$a};case"/get-vehicle-options":return MP(t);case"/request-bind":return{success:!0};default:throw new Error(`No mock handler for ${e}`)}}const OP=Object.freeze(Object.defineProperty({__proto__:null,handleMockRequest:FP},Symbol.toStringTag,{value:"Module"}));pt.CredifyInsuranceWidget=wi,pt.default=wi,Object.defineProperties(pt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
117
117
  //# sourceMappingURL=index.umd.js.map