@getcredify/credify-insurance-widget 1.37.0 → 1.37.1

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.
@@ -118,7 +118,7 @@ Url: ${nd(e)}`),!0)}function jT(e,t){return e.type||!t||!t.length?!1:VT(e).some(
118
118
  `)}S.write("payload.value = newResult;"),S.write("return payload;");const I=S.compile();return(A,L)=>I(E,A,L)};let s;const c=gd,d=!jx.jitless,h=d&&VO.value,y=t.catchall;let g;e._zod.parse=(E,S)=>{g??(g=i.value);const D=E.value;return c(D)?d&&h&&S?.async===!1&&S.jitless!==!0?(s||(s=o(t.shape)),E=s(E,S),y?r5([],D,E,S,g,e):E):n(E,S):(E.issues.push({expected:"object",code:"invalid_type",input:D,inst:e}),E)}});function F1(e,t,n,i){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const o=e.filter(s=>!Vo(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(c=>Ui(c,i,zi())))}),t)}const MB=ue("$ZodUnion",(e,t)=>{kt.init(e,t),mt(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),mt(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),mt(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),mt(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>gy(s.source)).join("|")})$`)}});const n=t.options.length===1,i=t.options[0]._zod.run;e._zod.parse=(o,s)=>{if(n)return i(o,s);let c=!1;const d=[];for(const m of t.options){const h=m._zod.run({value:o.value,issues:[]},s);if(h instanceof Promise)d.push(h),c=!0;else{if(h.issues.length===0)return h;d.push(h)}}return c?Promise.all(d).then(m=>F1(m,o,e,s)):F1(d,o,e,s)}}),RB=ue("$ZodIntersection",(e,t)=>{kt.init(e,t),e._zod.parse=(n,i)=>{const o=n.value,s=t.left._zod.run({value:o,issues:[]},i),c=t.right._zod.run({value:o,issues:[]},i);return s instanceof Promise||c instanceof Promise?Promise.all([s,c]).then(([m,h])=>j1(n,m,h)):j1(n,s,c)}});function c0(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ps(e)&&Ps(t)){const n=Object.keys(t),i=Object.keys(e).filter(s=>n.indexOf(s)!==-1),o={...e,...t};for(const s of i){const c=c0(e[s],t[s]);if(!c.valid)return{valid:!1,mergeErrorPath:[s,...c.mergeErrorPath]};o[s]=c.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let i=0;i<e.length;i++){const o=e[i],s=t[i],c=c0(o,s);if(!c.valid)return{valid:!1,mergeErrorPath:[i,...c.mergeErrorPath]};n.push(c.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function j1(e,t,n){const i=new Map;let o;for(const d of t.issues)if(d.code==="unrecognized_keys"){o??(o=d);for(const m of d.keys)i.has(m)||i.set(m,{}),i.get(m).l=!0}else e.issues.push(d);for(const d of n.issues)if(d.code==="unrecognized_keys")for(const m of d.keys)i.has(m)||i.set(m,{}),i.get(m).r=!0;else e.issues.push(d);const s=[...i].filter(([,d])=>d.l&&d.r).map(([d])=>d);if(s.length&&o&&e.issues.push({...o,keys:s}),Vo(e))return e;const c=c0(t.value,n.value);if(!c.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`);return e.value=c.data,e}const OB=ue("$ZodEnum",(e,t)=>{kt.init(e,t);const n=zx(t.entries),i=new Set(n);e._zod.values=i,e._zod.pattern=new RegExp(`^(${n.filter(o=>GO.has(typeof o)).map(o=>typeof o=="string"?ll(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const c=o.value;return i.has(c)||o.issues.push({code:"invalid_value",values:n,input:c,inst:e}),o}}),kB=ue("$ZodLiteral",(e,t)=>{if(kt.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(i=>typeof i=="string"?ll(i):i?ll(i.toString()):String(i)).join("|")})$`),e._zod.parse=(i,o)=>{const s=i.value;return n.has(s)||i.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),i}}),BB=ue("$ZodTransform",(e,t)=>{kt.init(e,t),e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new Fx(e.constructor.name);const o=t.transform(n.value,n);if(i.async)return(o instanceof Promise?o:Promise.resolve(o)).then(c=>(n.value=c,n));if(o instanceof Promise)throw new Jo;return n.value=o,n}});function z1(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const a5=ue("$ZodOptional",(e,t)=>{kt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",mt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),mt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${gy(n.source)})?$`):void 0}),e._zod.parse=(n,i)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(n,i);return o instanceof Promise?o.then(s=>z1(s,n.value)):z1(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,i)}}),LB=ue("$ZodExactOptional",(e,t)=>{a5.init(e,t),mt(e._zod,"values",()=>t.innerType._zod.values),mt(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,i)=>t.innerType._zod.run(n,i)}),PB=ue("$ZodNullable",(e,t)=>{kt.init(e,t),mt(e._zod,"optin",()=>t.innerType._zod.optin),mt(e._zod,"optout",()=>t.innerType._zod.optout),mt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${gy(n.source)}|null)$`):void 0}),mt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,i)=>n.value===null?n:t.innerType._zod.run(n,i)}),IB=ue("$ZodDefault",(e,t)=>{kt.init(e,t),e._zod.optin="optional",mt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,i);return o instanceof Promise?o.then(s=>U1(s,t)):U1(o,t)}});function U1(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const FB=ue("$ZodPrefault",(e,t)=>{kt.init(e,t),e._zod.optin="optional",mt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,i)=>(i.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,i))}),jB=ue("$ZodNonOptional",(e,t)=>{kt.init(e,t),mt(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(i=>i!==void 0)):void 0}),e._zod.parse=(n,i)=>{const o=t.innerType._zod.run(n,i);return o instanceof Promise?o.then(s=>H1(s,e)):H1(o,e)}});function H1(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const zB=ue("$ZodCatch",(e,t)=>{kt.init(e,t),mt(e._zod,"optin",()=>t.innerType._zod.optin),mt(e._zod,"optout",()=>t.innerType._zod.optout),mt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);const o=t.innerType._zod.run(n,i);return o instanceof Promise?o.then(s=>(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(c=>Ui(c,i,zi()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(s=>Ui(s,i,zi()))},input:n.value}),n.issues=[]),n)}}),UB=ue("$ZodPipe",(e,t)=>{kt.init(e,t),mt(e._zod,"values",()=>t.in._zod.values),mt(e._zod,"optin",()=>t.in._zod.optin),mt(e._zod,"optout",()=>t.out._zod.optout),mt(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,i)=>{if(i.direction==="backward"){const s=t.out._zod.run(n,i);return s instanceof Promise?s.then(c=>Nc(c,t.in,i)):Nc(s,t.in,i)}const o=t.in._zod.run(n,i);return o instanceof Promise?o.then(s=>Nc(s,t.out,i)):Nc(o,t.out,i)}});function Nc(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const HB=ue("$ZodReadonly",(e,t)=>{kt.init(e,t),mt(e._zod,"propValues",()=>t.innerType._zod.propValues),mt(e._zod,"values",()=>t.innerType._zod.values),mt(e._zod,"optin",()=>t.innerType?._zod?.optin),mt(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);const o=t.innerType._zod.run(n,i);return o instanceof Promise?o.then(V1):V1(o)}});function V1(e){return e.value=Object.freeze(e.value),e}const VB=ue("$ZodCustom",(e,t)=>{Tn.init(e,t),kt.init(e,t),e._zod.parse=(n,i)=>n,e._zod.check=n=>{const i=n.value,o=t.fn(i);if(o instanceof Promise)return o.then(s=>G1(s,n,i,e));G1(o,n,i,e)}});function G1(e,t,n,i){if(!e){const o={code:"custom",input:n,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(o.params=i._zod.def.params),t.issues.push(Is(o))}}var Z1;class GB{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const i=n[0];return this._map.set(t,i),i&&typeof i=="object"&&"id"in i&&this._idmap.set(i.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const i={...this.get(n)??{}};delete i.id;const o={...i,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function ZB(){return new GB}(Z1=globalThis).__zod_globalRegistry??(Z1.__zod_globalRegistry=ZB());const _s=globalThis.__zod_globalRegistry;function YB(e,t){return new e({type:"string",...Le(t)})}function qB(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Le(t)})}function Y1(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Le(t)})}function KB(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Le(t)})}function WB(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Le(t)})}function QB(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Le(t)})}function JB(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Le(t)})}function XB(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Le(t)})}function eL(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Le(t)})}function tL(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Le(t)})}function nL(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Le(t)})}function rL(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Le(t)})}function aL(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Le(t)})}function iL(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Le(t)})}function oL(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Le(t)})}function lL(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Le(t)})}function sL(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Le(t)})}function uL(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Le(t)})}function cL(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Le(t)})}function dL(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Le(t)})}function fL(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Le(t)})}function mL(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Le(t)})}function pL(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Le(t)})}function hL(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Le(t)})}function yL(e,t){return new e({type:"string",format:"date",check:"string_format",...Le(t)})}function gL(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Le(t)})}function bL(e,t){return new e({type:"string",format:"duration",check:"string_format",...Le(t)})}function vL(e,t){return new e({type:"number",coerce:!0,checks:[],...Le(t)})}function _L(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Le(t)})}function EL(e,t){return new e({type:"boolean",...Le(t)})}function SL(e){return new e({type:"unknown"})}function DL(e,t){return new e({type:"never",...Le(t)})}function q1(e,t){return new Jx({check:"less_than",...Le(t),value:e,inclusive:!1})}function ih(e,t){return new Jx({check:"less_than",...Le(t),value:e,inclusive:!0})}function K1(e,t){return new Xx({check:"greater_than",...Le(t),value:e,inclusive:!1})}function oh(e,t){return new Xx({check:"greater_than",...Le(t),value:e,inclusive:!0})}function W1(e,t){return new Fk({check:"multiple_of",...Le(t),value:e})}function i5(e,t){return new zk({check:"max_length",...Le(t),maximum:e})}function vd(e,t){return new Uk({check:"min_length",...Le(t),minimum:e})}function o5(e,t){return new Hk({check:"length_equals",...Le(t),length:e})}function $L(e,t){return new Vk({check:"string_format",format:"regex",...Le(t),pattern:e})}function xL(e){return new Gk({check:"string_format",format:"lowercase",...Le(e)})}function CL(e){return new Zk({check:"string_format",format:"uppercase",...Le(e)})}function AL(e,t){return new Yk({check:"string_format",format:"includes",...Le(t),includes:e})}function wL(e,t){return new qk({check:"string_format",format:"starts_with",...Le(t),prefix:e})}function TL(e,t){return new Kk({check:"string_format",format:"ends_with",...Le(t),suffix:e})}function fl(e){return new Wk({check:"overwrite",tx:e})}function NL(e){return fl(t=>t.normalize(e))}function ML(){return fl(e=>e.trim())}function RL(){return fl(e=>e.toLowerCase())}function OL(){return fl(e=>e.toUpperCase())}function kL(){return fl(e=>HO(e))}function BL(e,t,n){return new e({type:"array",element:t,...Le(n)})}function LL(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Le(n)})}function PL(e){const t=IL(n=>(n.addIssue=i=>{if(typeof i=="string")n.issues.push(Is(i,n.value,t._zod.def));else{const o=i;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),n.issues.push(Is(o))}},e(n.value,n)));return t}function IL(e,t){const n=new Tn({check:"custom",...Le(t)});return n._zod.check=e,n}function l5(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??_s,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function an(e,t,n={path:[],schemaPath:[]}){var i;const o=e._zod.def,s=t.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;const c={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,c);const d=e._zod.toJSONSchema?.();if(d)c.schema=d;else{const y={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,c.schema,y);else{const E=c.schema,S=t.processors[o.type];if(!S)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);S(e,t,E,y)}const g=e._zod.parent;g&&(c.ref||(c.ref=g),an(g,t,y),t.seen.get(g).isParent=!0)}const m=t.metadataRegistry.get(e);return m&&Object.assign(c.schema,m),t.io==="input"&&dn(e)&&(delete c.schema.examples,delete c.schema.default),t.io==="input"&&c.schema._prefault&&((i=c.schema).default??(i.default=c.schema._prefault)),delete c.schema._prefault,t.seen.get(e).schema}function s5(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=new Map;for(const c of e.seen.entries()){const d=e.metadataRegistry.get(c[0])?.id;if(d){const m=i.get(d);if(m&&m!==c[0])throw new Error(`Duplicate schema id "${d}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(d,c[0])}}const o=c=>{const d=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const g=e.external.registry.get(c[0])?.id,E=e.external.uri??(D=>D);if(g)return{ref:E(g)};const S=c[1].defId??c[1].schema.id??`schema${e.counter++}`;return c[1].defId=S,{defId:S,ref:`${E("__shared")}#/${d}/${S}`}}if(c[1]===n)return{ref:"#"};const h=`#/${d}/`,y=c[1].schema.id??`__schema${e.counter++}`;return{defId:y,ref:h+y}},s=c=>{if(c[1].schema.$ref)return;const d=c[1],{ref:m,defId:h}=o(c);d.def={...d.schema},h&&(d.defId=h);const y=d.schema;for(const g in y)delete y[g];y.$ref=m};if(e.cycles==="throw")for(const c of e.seen.entries()){const d=c[1];if(d.cycle)throw new Error(`Cycle detected: #/${d.cycle?.join("/")}/<root>
119
119
 
120
120
  Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const c of e.seen.entries()){const d=c[1];if(t===c[0]){s(c);continue}if(e.external){const h=e.external.registry.get(c[0])?.id;if(t!==c[0]&&h){s(c);continue}}if(e.metadataRegistry.get(c[0])?.id){s(c);continue}if(d.cycle){s(c);continue}if(d.count>1&&e.reused==="ref"){s(c);continue}}}function u5(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=c=>{const d=e.seen.get(c);if(d.ref===null)return;const m=d.def??d.schema,h={...m},y=d.ref;if(d.ref=null,y){i(y);const E=e.seen.get(y),S=E.schema;if(S.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(m.allOf=m.allOf??[],m.allOf.push(S)):Object.assign(m,S),Object.assign(m,h),c._zod.parent===y)for(const x in m)x==="$ref"||x==="allOf"||x in h||delete m[x];if(S.$ref&&E.def)for(const x in m)x==="$ref"||x==="allOf"||x in E.def&&JSON.stringify(m[x])===JSON.stringify(E.def[x])&&delete m[x]}const g=c._zod.parent;if(g&&g!==y){i(g);const E=e.seen.get(g);if(E?.schema.$ref&&(m.$ref=E.schema.$ref,E.def))for(const S in m)S==="$ref"||S==="allOf"||S in E.def&&JSON.stringify(m[S])===JSON.stringify(E.def[S])&&delete m[S]}e.override({zodSchema:c,jsonSchema:m,path:d.path??[]})};for(const c of[...e.seen.entries()].reverse())i(c[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const c=e.external.registry.get(t)?.id;if(!c)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(c)}Object.assign(o,n.def??n.schema);const s=e.external?.defs??{};for(const c of e.seen.entries()){const d=c[1];d.def&&d.defId&&(s[d.defId]=d.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{const c=JSON.parse(JSON.stringify(o));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:_d(t,"input",e.processors),output:_d(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function dn(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const i=e._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return dn(i.element,n);if(i.type==="set")return dn(i.valueType,n);if(i.type==="lazy")return dn(i.getter(),n);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault")return dn(i.innerType,n);if(i.type==="intersection")return dn(i.left,n)||dn(i.right,n);if(i.type==="record"||i.type==="map")return dn(i.keyType,n)||dn(i.valueType,n);if(i.type==="pipe")return dn(i.in,n)||dn(i.out,n);if(i.type==="object"){for(const o in i.shape)if(dn(i.shape[o],n))return!0;return!1}if(i.type==="union"){for(const o of i.options)if(dn(o,n))return!0;return!1}if(i.type==="tuple"){for(const o of i.items)if(dn(o,n))return!0;return!!(i.rest&&dn(i.rest,n))}return!1}const FL=(e,t={})=>n=>{const i=l5({...n,processors:t});return an(e,i),s5(i,e),u5(i,e)},_d=(e,t,n={})=>i=>{const{libraryOptions:o,target:s}=i??{},c=l5({...o??{},target:s,io:t,processors:n});return an(e,c),s5(c,e),u5(c,e)},jL={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},zL=(e,t,n,i)=>{const o=n;o.type="string";const{minimum:s,maximum:c,format:d,patterns:m,contentEncoding:h}=e._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof c=="number"&&(o.maxLength=c),d&&(o.format=jL[d]??d,o.format===""&&delete o.format,d==="time"&&delete o.format),h&&(o.contentEncoding=h),m&&m.size>0){const y=[...m];y.length===1?o.pattern=y[0].source:y.length>1&&(o.allOf=[...y.map(g=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:g.source}))])}},UL=(e,t,n,i)=>{const o=n,{minimum:s,maximum:c,format:d,multipleOf:m,exclusiveMaximum:h,exclusiveMinimum:y}=e._zod.bag;typeof d=="string"&&d.includes("int")?o.type="integer":o.type="number",typeof y=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=y,o.exclusiveMinimum=!0):o.exclusiveMinimum=y),typeof s=="number"&&(o.minimum=s,typeof y=="number"&&t.target!=="draft-04"&&(y>=s?delete o.minimum:delete o.exclusiveMinimum)),typeof h=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=h,o.exclusiveMaximum=!0):o.exclusiveMaximum=h),typeof c=="number"&&(o.maximum=c,typeof h=="number"&&t.target!=="draft-04"&&(h<=c?delete o.maximum:delete o.exclusiveMaximum)),typeof m=="number"&&(o.multipleOf=m)},HL=(e,t,n,i)=>{n.type="boolean"},VL=(e,t,n,i)=>{n.not={}},GL=(e,t,n,i)=>{},ZL=(e,t,n,i)=>{const o=e._zod.def,s=zx(o.entries);s.every(c=>typeof c=="number")&&(n.type="number"),s.every(c=>typeof c=="string")&&(n.type="string"),n.enum=s},YL=(e,t,n,i)=>{const o=e._zod.def,s=[];for(const c of o.values)if(c===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof c=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(c))}else s.push(c);if(s.length!==0)if(s.length===1){const c=s[0];n.type=c===null?"null":typeof c,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[c]:n.const=c}else s.every(c=>typeof c=="number")&&(n.type="number"),s.every(c=>typeof c=="string")&&(n.type="string"),s.every(c=>typeof c=="boolean")&&(n.type="boolean"),s.every(c=>c===null)&&(n.type="null"),n.enum=s},qL=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},KL=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},WL=(e,t,n,i)=>{const o=n,s=e._zod.def,{minimum:c,maximum:d}=e._zod.bag;typeof c=="number"&&(o.minItems=c),typeof d=="number"&&(o.maxItems=d),o.type="array",o.items=an(s.element,t,{...i,path:[...i.path,"items"]})},QL=(e,t,n,i)=>{const o=n,s=e._zod.def;o.type="object",o.properties={};const c=s.shape;for(const h in c)o.properties[h]=an(c[h],t,{...i,path:[...i.path,"properties",h]});const d=new Set(Object.keys(c)),m=new Set([...d].filter(h=>{const y=s.shape[h]._zod;return t.io==="input"?y.optin===void 0:y.optout===void 0}));m.size>0&&(o.required=Array.from(m)),s.catchall?._zod.def.type==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=an(s.catchall,t,{...i,path:[...i.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},JL=(e,t,n,i)=>{const o=e._zod.def,s=o.inclusive===!1,c=o.options.map((d,m)=>an(d,t,{...i,path:[...i.path,s?"oneOf":"anyOf",m]}));s?n.oneOf=c:n.anyOf=c},XL=(e,t,n,i)=>{const o=e._zod.def,s=an(o.left,t,{...i,path:[...i.path,"allOf",0]}),c=an(o.right,t,{...i,path:[...i.path,"allOf",1]}),d=h=>"allOf"in h&&Object.keys(h).length===1,m=[...d(s)?s.allOf:[s],...d(c)?c.allOf:[c]];n.allOf=m},eP=(e,t,n,i)=>{const o=e._zod.def,s=an(o.innerType,t,i),c=t.seen.get(e);t.target==="openapi-3.0"?(c.ref=o.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},tP=(e,t,n,i)=>{const o=e._zod.def;an(o.innerType,t,i);const s=t.seen.get(e);s.ref=o.innerType},nP=(e,t,n,i)=>{const o=e._zod.def;an(o.innerType,t,i);const s=t.seen.get(e);s.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},rP=(e,t,n,i)=>{const o=e._zod.def;an(o.innerType,t,i);const s=t.seen.get(e);s.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},aP=(e,t,n,i)=>{const o=e._zod.def;an(o.innerType,t,i);const s=t.seen.get(e);s.ref=o.innerType;let c;try{c=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=c},iP=(e,t,n,i)=>{const o=e._zod.def,s=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;an(s,t,i);const c=t.seen.get(e);c.ref=s},oP=(e,t,n,i)=>{const o=e._zod.def;an(o.innerType,t,i);const s=t.seen.get(e);s.ref=o.innerType,n.readOnly=!0},c5=(e,t,n,i)=>{const o=e._zod.def;an(o.innerType,t,i);const s=t.seen.get(e);s.ref=o.innerType},lP=ue("ZodISODateTime",(e,t)=>{cB.init(e,t),wt.init(e,t)});function sP(e){return hL(lP,e)}const uP=ue("ZodISODate",(e,t)=>{dB.init(e,t),wt.init(e,t)});function cP(e){return yL(uP,e)}const dP=ue("ZodISOTime",(e,t)=>{fB.init(e,t),wt.init(e,t)});function fP(e){return gL(dP,e)}const mP=ue("ZodISODuration",(e,t)=>{mB.init(e,t),wt.init(e,t)});function pP(e){return bL(mP,e)}const hP=(e,t)=>{Zx.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>nk(e,n)},flatten:{value:n=>tk(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,u0,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,u0,2)}},isEmpty:{get(){return e.issues.length===0}}})},cr=ue("ZodError",hP,{Parent:Error}),yP=vy(cr),gP=_y(cr),bP=Xd(cr),vP=ef(cr),_P=ik(cr),EP=ok(cr),SP=lk(cr),DP=sk(cr),$P=uk(cr),xP=ck(cr),CP=dk(cr),AP=fk(cr),Bt=ue("ZodType",(e,t)=>(kt.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:_d(e,"input"),output:_d(e,"output")}}),e.toJSONSchema=FL(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(ei(t,{checks:[...t.checks??[],...n.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0}),e.with=e.check,e.clone=(n,i)=>ti(e,n,i),e.brand=()=>e,e.register=((n,i)=>(n.add(e,i),e)),e.parse=(n,i)=>yP(e,n,i,{callee:e.parse}),e.safeParse=(n,i)=>bP(e,n,i),e.parseAsync=async(n,i)=>gP(e,n,i,{callee:e.parseAsync}),e.safeParseAsync=async(n,i)=>vP(e,n,i),e.spa=e.safeParseAsync,e.encode=(n,i)=>_P(e,n,i),e.decode=(n,i)=>EP(e,n,i),e.encodeAsync=async(n,i)=>SP(e,n,i),e.decodeAsync=async(n,i)=>DP(e,n,i),e.safeEncode=(n,i)=>$P(e,n,i),e.safeDecode=(n,i)=>xP(e,n,i),e.safeEncodeAsync=async(n,i)=>CP(e,n,i),e.safeDecodeAsync=async(n,i)=>AP(e,n,i),e.refine=(n,i)=>e.check(DI(n,i)),e.superRefine=n=>e.check($I(n)),e.overwrite=n=>e.check(fl(n)),e.optional=()=>e3(e),e.exactOptional=()=>cI(e),e.nullable=()=>t3(e),e.nullish=()=>e3(t3(e)),e.nonoptional=n=>yI(e,n),e.array=()=>XP(e),e.or=n=>m5([e,n]),e.and=n=>aI(e,n),e.transform=n=>n3(e,sI(n)),e.default=n=>mI(e,n),e.prefault=n=>hI(e,n),e.catch=n=>bI(e,n),e.pipe=n=>n3(e,n),e.readonly=()=>EI(e),e.describe=n=>{const i=e.clone();return _s.add(i,{description:n}),i},Object.defineProperty(e,"description",{get(){return _s.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return _s.get(e);const i=e.clone();return _s.add(i,n[0]),i},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),d5=ue("_ZodString",(e,t)=>{Ey.init(e,t),Bt.init(e,t),e._zod.processJSONSchema=(i,o,s)=>zL(e,i,o);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...i)=>e.check($L(...i)),e.includes=(...i)=>e.check(AL(...i)),e.startsWith=(...i)=>e.check(wL(...i)),e.endsWith=(...i)=>e.check(TL(...i)),e.min=(...i)=>e.check(vd(...i)),e.max=(...i)=>e.check(i5(...i)),e.length=(...i)=>e.check(o5(...i)),e.nonempty=(...i)=>e.check(vd(1,...i)),e.lowercase=i=>e.check(xL(i)),e.uppercase=i=>e.check(CL(i)),e.trim=()=>e.check(ML()),e.normalize=(...i)=>e.check(NL(...i)),e.toLowerCase=()=>e.check(RL()),e.toUpperCase=()=>e.check(OL()),e.slugify=()=>e.check(kL())}),wP=ue("ZodString",(e,t)=>{Ey.init(e,t),d5.init(e,t),e.email=n=>e.check(qB(TP,n)),e.url=n=>e.check(XB(NP,n)),e.jwt=n=>e.check(pL(GP,n)),e.emoji=n=>e.check(eL(MP,n)),e.guid=n=>e.check(Y1(Q1,n)),e.uuid=n=>e.check(KB(Mc,n)),e.uuidv4=n=>e.check(WB(Mc,n)),e.uuidv6=n=>e.check(QB(Mc,n)),e.uuidv7=n=>e.check(JB(Mc,n)),e.nanoid=n=>e.check(tL(RP,n)),e.guid=n=>e.check(Y1(Q1,n)),e.cuid=n=>e.check(nL(OP,n)),e.cuid2=n=>e.check(rL(kP,n)),e.ulid=n=>e.check(aL(BP,n)),e.base64=n=>e.check(dL(UP,n)),e.base64url=n=>e.check(fL(HP,n)),e.xid=n=>e.check(iL(LP,n)),e.ksuid=n=>e.check(oL(PP,n)),e.ipv4=n=>e.check(lL(IP,n)),e.ipv6=n=>e.check(sL(FP,n)),e.cidrv4=n=>e.check(uL(jP,n)),e.cidrv6=n=>e.check(cL(zP,n)),e.e164=n=>e.check(mL(VP,n)),e.datetime=n=>e.check(sP(n)),e.date=n=>e.check(cP(n)),e.time=n=>e.check(fP(n)),e.duration=n=>e.check(pP(n))});function ja(e){return YB(wP,e)}const wt=ue("ZodStringFormat",(e,t)=>{At.init(e,t),d5.init(e,t)}),TP=ue("ZodEmail",(e,t)=>{tB.init(e,t),wt.init(e,t)}),Q1=ue("ZodGUID",(e,t)=>{Xk.init(e,t),wt.init(e,t)}),Mc=ue("ZodUUID",(e,t)=>{eB.init(e,t),wt.init(e,t)}),NP=ue("ZodURL",(e,t)=>{nB.init(e,t),wt.init(e,t)}),MP=ue("ZodEmoji",(e,t)=>{rB.init(e,t),wt.init(e,t)}),RP=ue("ZodNanoID",(e,t)=>{aB.init(e,t),wt.init(e,t)}),OP=ue("ZodCUID",(e,t)=>{iB.init(e,t),wt.init(e,t)}),kP=ue("ZodCUID2",(e,t)=>{oB.init(e,t),wt.init(e,t)}),BP=ue("ZodULID",(e,t)=>{lB.init(e,t),wt.init(e,t)}),LP=ue("ZodXID",(e,t)=>{sB.init(e,t),wt.init(e,t)}),PP=ue("ZodKSUID",(e,t)=>{uB.init(e,t),wt.init(e,t)}),IP=ue("ZodIPv4",(e,t)=>{pB.init(e,t),wt.init(e,t)}),FP=ue("ZodIPv6",(e,t)=>{hB.init(e,t),wt.init(e,t)}),jP=ue("ZodCIDRv4",(e,t)=>{yB.init(e,t),wt.init(e,t)}),zP=ue("ZodCIDRv6",(e,t)=>{gB.init(e,t),wt.init(e,t)}),UP=ue("ZodBase64",(e,t)=>{bB.init(e,t),wt.init(e,t)}),HP=ue("ZodBase64URL",(e,t)=>{_B.init(e,t),wt.init(e,t)}),VP=ue("ZodE164",(e,t)=>{EB.init(e,t),wt.init(e,t)}),GP=ue("ZodJWT",(e,t)=>{DB.init(e,t),wt.init(e,t)}),f5=ue("ZodNumber",(e,t)=>{t5.init(e,t),Bt.init(e,t),e._zod.processJSONSchema=(i,o,s)=>UL(e,i,o),e.gt=(i,o)=>e.check(K1(i,o)),e.gte=(i,o)=>e.check(oh(i,o)),e.min=(i,o)=>e.check(oh(i,o)),e.lt=(i,o)=>e.check(q1(i,o)),e.lte=(i,o)=>e.check(ih(i,o)),e.max=(i,o)=>e.check(ih(i,o)),e.int=i=>e.check(J1(i)),e.safe=i=>e.check(J1(i)),e.positive=i=>e.check(K1(0,i)),e.nonnegative=i=>e.check(oh(0,i)),e.negative=i=>e.check(q1(0,i)),e.nonpositive=i=>e.check(ih(0,i)),e.multipleOf=(i,o)=>e.check(W1(i,o)),e.step=(i,o)=>e.check(W1(i,o)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null}),ZP=ue("ZodNumberFormat",(e,t)=>{$B.init(e,t),f5.init(e,t)});function J1(e){return _L(ZP,e)}const YP=ue("ZodBoolean",(e,t)=>{xB.init(e,t),Bt.init(e,t),e._zod.processJSONSchema=(n,i,o)=>HL(e,n,i)});function qP(e){return EL(YP,e)}const KP=ue("ZodUnknown",(e,t)=>{CB.init(e,t),Bt.init(e,t),e._zod.processJSONSchema=(n,i,o)=>GL()});function X1(){return SL(KP)}const WP=ue("ZodNever",(e,t)=>{AB.init(e,t),Bt.init(e,t),e._zod.processJSONSchema=(n,i,o)=>VL(e,n,i)});function QP(e){return DL(WP,e)}const JP=ue("ZodArray",(e,t)=>{wB.init(e,t),Bt.init(e,t),e._zod.processJSONSchema=(n,i,o)=>WL(e,n,i,o),e.element=t.element,e.min=(n,i)=>e.check(vd(n,i)),e.nonempty=n=>e.check(vd(1,n)),e.max=(n,i)=>e.check(i5(n,i)),e.length=(n,i)=>e.check(o5(n,i)),e.unwrap=()=>e.element});function XP(e,t){return BL(JP,e,t)}const eI=ue("ZodObject",(e,t)=>{NB.init(e,t),Bt.init(e,t),e._zod.processJSONSchema=(n,i,o)=>QL(e,n,i,o),mt(e,"shape",()=>t.shape),e.keyof=()=>zo(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:X1()}),e.loose=()=>e.clone({...e._zod.def,catchall:X1()}),e.strict=()=>e.clone({...e._zod.def,catchall:QP()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>WO(e,n),e.safeExtend=n=>QO(e,n),e.merge=n=>JO(e,n),e.pick=n=>qO(e,n),e.omit=n=>KO(e,n),e.partial=(...n)=>XO(p5,e,n[0]),e.required=(...n)=>ek(h5,e,n[0])});function tI(e,t){const n={type:"object",shape:e??{},...Le(t)};return new eI(n)}const nI=ue("ZodUnion",(e,t)=>{MB.init(e,t),Bt.init(e,t),e._zod.processJSONSchema=(n,i,o)=>JL(e,n,i,o),e.options=t.options});function m5(e,t){return new nI({type:"union",options:e,...Le(t)})}const rI=ue("ZodIntersection",(e,t)=>{RB.init(e,t),Bt.init(e,t),e._zod.processJSONSchema=(n,i,o)=>XL(e,n,i,o)});function aI(e,t){return new rI({type:"intersection",left:e,right:t})}const d0=ue("ZodEnum",(e,t)=>{OB.init(e,t),Bt.init(e,t),e._zod.processJSONSchema=(i,o,s)=>ZL(e,i,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(i,o)=>{const s={};for(const c of i)if(n.has(c))s[c]=t.entries[c];else throw new Error(`Key ${c} not found in enum`);return new d0({...t,checks:[],...Le(o),entries:s})},e.exclude=(i,o)=>{const s={...t.entries};for(const c of i)if(n.has(c))delete s[c];else throw new Error(`Key ${c} not found in enum`);return new d0({...t,checks:[],...Le(o),entries:s})}});function zo(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new d0({type:"enum",entries:n,...Le(t)})}const iI=ue("ZodLiteral",(e,t)=>{kB.init(e,t),Bt.init(e,t),e._zod.processJSONSchema=(n,i,o)=>YL(e,n,i),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function oI(e,t){return new iI({type:"literal",values:Array.isArray(e)?e:[e],...Le(t)})}const lI=ue("ZodTransform",(e,t)=>{BB.init(e,t),Bt.init(e,t),e._zod.processJSONSchema=(n,i,o)=>KL(e,n),e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new Fx(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(Is(s,n.value,t));else{const c=s;c.fatal&&(c.continue=!1),c.code??(c.code="custom"),c.input??(c.input=n.value),c.inst??(c.inst=e),n.issues.push(Is(c))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n)):(n.value=o,n)}});function sI(e){return new lI({type:"transform",transform:e})}const p5=ue("ZodOptional",(e,t)=>{a5.init(e,t),Bt.init(e,t),e._zod.processJSONSchema=(n,i,o)=>c5(e,n,i,o),e.unwrap=()=>e._zod.def.innerType});function e3(e){return new p5({type:"optional",innerType:e})}const uI=ue("ZodExactOptional",(e,t)=>{LB.init(e,t),Bt.init(e,t),e._zod.processJSONSchema=(n,i,o)=>c5(e,n,i,o),e.unwrap=()=>e._zod.def.innerType});function cI(e){return new uI({type:"optional",innerType:e})}const dI=ue("ZodNullable",(e,t)=>{PB.init(e,t),Bt.init(e,t),e._zod.processJSONSchema=(n,i,o)=>eP(e,n,i,o),e.unwrap=()=>e._zod.def.innerType});function t3(e){return new dI({type:"nullable",innerType:e})}const fI=ue("ZodDefault",(e,t)=>{IB.init(e,t),Bt.init(e,t),e._zod.processJSONSchema=(n,i,o)=>nP(e,n,i,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function mI(e,t){return new fI({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Hx(t)}})}const pI=ue("ZodPrefault",(e,t)=>{FB.init(e,t),Bt.init(e,t),e._zod.processJSONSchema=(n,i,o)=>rP(e,n,i,o),e.unwrap=()=>e._zod.def.innerType});function hI(e,t){return new pI({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Hx(t)}})}const h5=ue("ZodNonOptional",(e,t)=>{jB.init(e,t),Bt.init(e,t),e._zod.processJSONSchema=(n,i,o)=>tP(e,n,i,o),e.unwrap=()=>e._zod.def.innerType});function yI(e,t){return new h5({type:"nonoptional",innerType:e,...Le(t)})}const gI=ue("ZodCatch",(e,t)=>{zB.init(e,t),Bt.init(e,t),e._zod.processJSONSchema=(n,i,o)=>aP(e,n,i,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function bI(e,t){return new gI({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const vI=ue("ZodPipe",(e,t)=>{UB.init(e,t),Bt.init(e,t),e._zod.processJSONSchema=(n,i,o)=>iP(e,n,i,o),e.in=t.in,e.out=t.out});function n3(e,t){return new vI({type:"pipe",in:e,out:t})}const _I=ue("ZodReadonly",(e,t)=>{HB.init(e,t),Bt.init(e,t),e._zod.processJSONSchema=(n,i,o)=>oP(e,n,i,o),e.unwrap=()=>e._zod.def.innerType});function EI(e){return new _I({type:"readonly",innerType:e})}const SI=ue("ZodCustom",(e,t)=>{VB.init(e,t),Bt.init(e,t),e._zod.processJSONSchema=(n,i,o)=>qL(e,n)});function DI(e,t={}){return LL(SI,e,t)}function $I(e){return PL(e)}const f0={custom:"custom"};function Gt(e){return vL(f5,e)}const xI=["additional_pip","tort_threshold","pip_coverage_type","extended_medical","policy_pip_deductible"],CI=new Set([...xI,"is_corporation"]);tI({additional_pip:zo(["cov100_10400_LIMITED","cov125_13000_LIMITED","cov175_18200_LIMITED","cov250_26000_LIMITED","cov400_41600_LIMITED","cov500_52000_LIMITED","cov600_62400_LIMITED","cov700_72800_LIMITED","cov100_UNLIMITED","cov125_UNLIMITED","cov175_UNLIMITED","cov250_UNLIMITED","cov400_UNLIMITED","cov500_UNLIMITED","cov600_UNLIMITED","cov700_UNLIMITED"]),tort_threshold:zo(["Verbal_Threshold","Zero_Threshold"]),pip_coverage_type:zo(["Primary","Secondary"]),extended_medical:zo(["cov1000","cov10000"]),policy_pip_deductible:zo(["cov250","cov500","cov1000","cov2000","cov2500"]),has_health_insurance_auto_accident:qP().nullable().optional()}).superRefine((e,t)=>{e.pip_coverage_type==="Secondary"&&e.has_health_insurance_auto_accident!==!0&&t.addIssue({code:f0.custom,path:["pip_coverage_type"],message:"Secondary PIP coverage requires health insurance that covers auto accidents."})});const AI=new Set(["Home","HomeConstruction","HomeFeatures","Demographics"]),wI=new Set(["HomePolicy","BundlePolicy"]),TI=new Set(["HomeCustomer","BundleCustomer","Demographics"]);function Ed(e){if(typeof e!="string"||!e.trim())return!1;const t=e.trim().toLowerCase();return t==="nj"||t==="n.j."||t==="n.j"||t==="new jersey"}function r3(e){return e?Ed(e.state??e.State):!1}function nf(e,t,n){return e==="has_health_insurance_auto_accident"?t==="BundleCustomer"||t==="Demographics"?!1:!r3(n):CI.has(e)?!r3(n):e==="household_size"?!(t&&AI.has(t)):e==="number_of_mortgagees"?!(t&&wI.has(t)):(e==="has_co_applicant"||e==="co_applicant_middle_name"||e==="co_applicant_relationship")&&t&&TI.has(t)?!1:e==="multi_policy_discount"&&t==="HomePolicy"?!0:NI.has(e)}const NI=new Set(["anti_theft_type","passive_restraint_type","anti_lock_brakes","daytime_running_lights","vehicle_full_glass","vehicle_loan_lease","percent_to_work","stated_value_amount_cents","vehicle_comp_deductible","vehicle_coll_deductible","vehicle_towing_and_labor","vehicle_transportation_expense","accident_prevention_course","driver_accidents","driver_violations","losses","middle_name","ssn_display","auto_current_annual_premium_cents","has_co_applicant","co_applicant_middle_name","co_applicant_relationship"]),y5=new Date().getUTCFullYear(),Rc=ja().trim().min(1,"Required").regex(/^[A-Za-z\s]+$/,"Only alphabetic characters are allowed."),a3=m5([oI(""),ja().trim().regex(/^[A-Za-z\s]*$/,"Only alphabetic characters are allowed.")]).optional(),MI=(e,t,n)=>Gt({error:`${e} must be a number.`}).min(t,`${e} must be between ${t.toLocaleString("en-US")} and ${n.toLocaleString("en-US")}.`).max(n,`${e} must be between ${t.toLocaleString("en-US")} and ${n.toLocaleString("en-US")}.`).int(`${e} must be a whole number.`),Fo=(e,t)=>Gt({error:`${e} must be a number.`}).min(0,`${e} must be between 0 and ${t.toLocaleString("en-US")}.`).max(t,`${e} must be between 0 and ${t.toLocaleString("en-US")}.`).int(`${e} must be a whole number.`),Oc=(e,t=1600)=>Gt({error:`${e} must be a valid 4-digit year.`}).int(`${e} must be a whole number.`).min(t,`${e} should be between ${t} and the current year.`).max(y5,`${e} cannot be in the future.`),kc=e=>Gt({error:`${e} must be a number.`}).int(`${e} must be a whole number.`).min(0,`${e} must be between 0 and 99.`).max(99,`${e} must be between 0 and 99.`),fs=(e,t,n=0)=>{const i=Math.pow(10,t)-1,o=i.toLocaleString("en-US"),s=n.toLocaleString("en-US");return Gt({error:`${e} must be a number.`}).min(n,`${e}: Value must be between ${s} and ${o}.`).max(i,`${e}: Value must be between ${s} and ${o}.`).int(`${e} must be a whole number.`)},RI={email:ja().trim().min(1,"Required").email("Please enter a valid email address."),phone:ja().trim().min(1,"Required").refine(e=>{let t=e.replace(/\D/g,"");return t.length===11&&t.startsWith("1")&&(t=t.slice(1)),t.length===10},"Please enter a valid 10-digit US phone number."),social_security_number:ja().trim().refine(e=>e===""||/^\d{3}-\d{2}-\d{4}$/.test(e),"Social Security Number must be in the format XXX-XX-XXXX.").optional(),sms_code:ja().trim().min(1,"Required").regex(/^\d{6}$/,"Please enter the 6-digit code."),first_name:Rc,last_name:Rc,middle_name:a3,co_applicant_first_name:Rc,co_applicant_last_name:Rc,co_applicant_middle_name:a3,year_built:Oc("Year built",1800),year_roof_updated:Gt({error:"Please enter a valid 4-digit year."}).int("Year must be a whole number.").min(1e3,"Please enter a valid 4-digit year.").max(9999,"Please enter a valid 4-digit year."),heating_update_year:Oc("Heating update year"),plumbing_update_year:Oc("Plumbing update year"),electrical_update_year:Oc("Electrical update year"),total_area_sq_ft:MI("Square footage",1,999999),sale_price_cents:Gt({error:"Purchase Price must be a number."}).min(1,"Purchase Price must be between 1 and 21,474,836.").max(21474836,"Purchase Price must be between 1 and 21,474,836.").int("Purchase Price must be a whole number."),home_prior_years:kc("Number of years with your prior carrier"),home_continuous_coverage_years:kc("How long you have had continuous home coverage"),household_size:Gt({error:"Household size must be a number."}).min(1,"Occupants must be between 1 and 8.").max(8,"Occupants must be between 1 and 8.").int("Occupants must be between 1 and 8."),number_of_mortgagees:Gt({error:"Number of mortgagees must be a number."}).int().min(0,"Number of mortgagees cannot be negative.").max(3,"Number of mortgagees must be between 0 and 3."),dwelling_replacement_cost:fs("Replacement cost",9,1),other_structures_coverage:fs("Other structures",9),personal_property_coverage:fs("Personal property",7),loss_of_use_coverage:fs("Loss of use coverage",8),years_at_address:Gt({error:"Years at address must be a number."}).int().min(0,"Years at address cannot be negative.").max(100,"Years at address must be 100 or less."),months_at_address:Gt({error:"Months at address must be a number."}).int().min(0,"Months at address cannot be negative.").max(11,"Months at address must be between 0 and 11."),years_at_prior_address:Gt({error:"Years at prior address must be a number."}).int().min(0,"Years at prior address cannot be negative.").max(100,"Years at prior address must be 100 or less."),number_of_units:Gt({error:"Number of units must be a number."}).int().min(1,"Number of units/apartments should be greater than 0.").max(99,"Number of units/apartments must be between 1 and 99."),number_of_families:Gt({error:"Number of families must be a number."}).int("Number of families must be a whole number.").refine(e=>e>=1&&e<=5,{message:"Number of families must be between 1 and 5."}),number_of_dogs:Gt({error:"Number of dogs must be a number."}).int().min(0,"Number of dogs must be between 0 and 99.").max(99,"Number of dogs must be between 0 and 99."),distance_to_coast_miles:Gt({error:"Distance to coast must be a number."}).int().min(0,"Distance to coast cannot be negative.").max(9999,"Distance to coast must be at most 4 digits."),amount_paid_cents:fs("Amount paid",7),license_number:ja().trim().min(1,"Required").max(20,"License number must be 20 characters or fewer.").regex(/^[A-Z0-9]+$/i,"License number must contain only letters and numbers."),vin:ja().superRefine((e,t)=>{if(typeof e!="string"||e.trim()==="")return;if(/\s/.test(e)){t.addIssue({code:f0.custom,message:"VIN cannot contain spaces."});return}const n=e.trim();/^[A-HJ-NPR-Z0-9]{17}$/i.test(n)||t.addIssue({code:f0.custom,message:"VIN must be exactly 17 letters and numbers (excluding I, O, and Q)."})}),annual_mileage:Gt({error:"Annual mileage must be a number."}).int("Annual mileage must be a whole number.").min(1e3,"Vehicle annual use should be between 1,000 & 100,000 miles.").max(1e5,"Vehicle annual use should be between 1,000 & 100,000 miles."),miles_to_work:Gt({error:"Miles driven to work/school must be a number."}).int("Miles driven to work/school must be a whole number.").min(1,"Please enter a value greater than 0.").max(9999,"Miles driven to work/school must be between 1 and 9,999."),custom_equipment_value_cents:Fo("Modifications value",9999999),cost_new_value_cents:Fo("Cost new value",9999999),stated_value_amount_cents:Fo("Stated Value Amount",9999999),property_damage_amount_paid_cents:Fo("Property damage amount paid",9999999),personal_injury_amount_paid_cents:Fo("Personal injury amount paid",9999999),auto_current_annual_premium_cents:Fo("Current annual premium",9999999),auto_prior_years:kc("Years with prior auto carrier"),auto_prior_months:Gt({error:"Months with prior carrier must be a number."}).int().min(0,"Months with prior carrier must be between 0 and 11.").max(11,"Months with prior carrier must be between 0 and 11."),auto_continuous_coverage_years:kc("Years with continuous auto coverage")};function It(e){return new Date(`${e}T00:00:00Z`)}function nn(){const e=new Date;return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()))}function Ba(e,t){let n=t.getUTCFullYear()-e.getUTCFullYear();const i=t.getUTCMonth()-e.getUTCMonth();return(i<0||i===0&&t.getUTCDate()<e.getUTCDate())&&n--,n}const g5=[{targetKey:"social_security_number",dependsOn:["social_security_number","state"],validate:e=>{if(!("social_security_number"in e)||!Ed(e.state))return;const t=e.social_security_number;return(typeof t=="string"?t.trim():"")===""?"Social Security Number is required in New Jersey.":void 0}},{targetKey:"date_of_birth",dependsOn:["date_of_birth"],validate:e=>{const t=e.date_of_birth;if(!t||typeof t!="string")return;const n=It(t);return isNaN(n.getTime())?"Invalid date.":n.getUTCFullYear()<1900?"Date of birth year can't be earlier than 1900.":Ba(n,nn())<18?"Applicant can't be under the age of 18.":void 0}},{targetKey:"co_applicant_date_of_birth",dependsOn:["co_applicant_date_of_birth"],validate:e=>{const t=e.co_applicant_date_of_birth;if(!t||typeof t!="string")return;const n=It(t);return isNaN(n.getTime())?"Invalid date.":n.getUTCFullYear()<1900?"Date of birth year can't be earlier than 1900.":Ba(n,nn())<16?"Co-applicant can't be under the age of 16.":void 0}},{targetKey:"year_roof_updated",dependsOn:["year_roof_updated","year_built"],validate:e=>{const t=Number(e.year_roof_updated),n=Number(e.year_built);if(isNaN(t))return;const i=isNaN(n)?1e3:n;if(t<i||t>y5)return"Roof renovation/replacement year must be between the home's build year and the current year."}},{targetKey:"move_in_date",dependsOn:["move_in_date","year_built"],validate:e=>{const t=e.move_in_date,n=e.year_built;if(!t||n==null)return;const i=It(String(t));if(isNaN(i.getTime()))return;const o=Number(n);if(!isNaN(o))return i.getUTCFullYear()<o?"Purchase date cannot be prior to the year the building was originally constructed.":void 0}},{targetKey:"date_first_licensed",dependsOn:["date_first_licensed"],validate:e=>{const t=e.date_first_licensed;if(!t||typeof t!="string")return;const n=It(t);return isNaN(n.getTime())?"Invalid date.":n>nn()?"Date first licensed cannot be in the future.":void 0}},{targetKey:"date_first_licensed",dependsOn:["date_first_licensed","date_of_birth"],validate:e=>{const t=e.date_first_licensed,n=e.date_of_birth;if(!t||typeof t!="string"||!n||typeof n!="string")return;const i=It(n),o=It(t);if(isNaN(i.getTime())||isNaN(o.getTime()))return;if(o<i)return"Date licensed cannot be before driver date of birth.";const s=new Date(Date.UTC(i.getUTCFullYear()+16,i.getUTCMonth(),i.getUTCDate()));return o<s?"Driver must be at least 16 years old at the date first licensed.":void 0}},{targetKey:"occurred_at",dependsOn:["occurred_at"],validate:e=>{const t=e.occurred_at;if(!t||typeof t!="string")return;const n=It(t);return isNaN(n.getTime())?"Invalid date.":n>nn()?"Incident date cannot be in the future.":void 0}},{targetKey:"accident_prevention_course_date",dependsOn:["accident_prevention_course_date"],validate:e=>{const t=e.accident_prevention_course_date;if(!t||typeof t!="string")return;const n=It(t);return isNaN(n.getTime())?"Invalid date.":n>nn()?"Course date cannot be in the future.":void 0}},{targetKey:"effective_date",dependsOn:["effective_date"],validate:e=>{const t=e.effective_date;if(!t||typeof t!="string")return;const n=It(t);if(isNaN(n.getTime()))return"Invalid date.";const i=nn(),o=new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth()+3,i.getUTCDate()));if(n<i)return"Insurance start date cannot be in the past.";if(n>o)return"Insurance must begin within 3 months from today."}},{targetKey:"years_at_address",dependsOn:["years_at_address","date_of_birth"],validate:e=>{const t=e.years_at_address,n=e.date_of_birth;if(t==null||n==null||typeof n!="string")return;const i=Number(t);if(isNaN(i))return;const o=It(n);if(isNaN(o.getTime()))return;const s=Ba(o,nn());return i>s?"Time at address cannot be greater than the applicant age.":void 0}},{targetKey:"years_at_prior_address",dependsOn:["years_at_prior_address","date_of_birth"],validate:e=>{const t=e.years_at_prior_address,n=e.date_of_birth;if(t==null||n==null||typeof n!="string")return;const i=Number(t);if(isNaN(i))return;const o=It(n);if(isNaN(o.getTime()))return;const s=Ba(o,nn());return i>s?"Years at prior address cannot be greater than the applicant age.":void 0}},{targetKey:"home_prior_years",dependsOn:["home_prior_years","home_continuous_coverage_years"],validate:e=>{const t=e.home_prior_years,n=e.home_continuous_coverage_years;if(t==null||n==null)return;const i=Number(t),o=Number(n);if(!(isNaN(i)||isNaN(o)))return i>o?"Years with prior carrier cannot be higher than years with continuous coverage.":void 0}},{targetKey:"home_prior_years",dependsOn:["home_prior_years","date_of_birth"],validate:e=>{const t=e.home_prior_years,n=e.date_of_birth;if(t==null||n==null||typeof n!="string")return;const i=Number(t);if(isNaN(i))return;const o=It(n);if(isNaN(o.getTime()))return;const s=Ba(o,nn());return i>s?"Years with prior carrier cannot be greater than the Applicant's age.":void 0}},{targetKey:"home_continuous_coverage_years",dependsOn:["home_continuous_coverage_years","date_of_birth"],validate:e=>{const t=e.home_continuous_coverage_years,n=e.date_of_birth;if(t==null||n==null||typeof n!="string")return;const i=Number(t);if(isNaN(i))return;const o=It(n);if(isNaN(o.getTime()))return;const s=Ba(o,nn());return i>s?"Years with continuous home coverage cannot be greater than the Applicant's age.":void 0}},{targetKey:"move_in_date",dependsOn:["move_in_date"],validate:e=>{const t=e.move_in_date;if(!t||typeof t!="string")return;const n=It(t);return isNaN(n.getTime())?"Invalid date.":n>nn()?"Purchase date cannot be in the future.":void 0}},{targetKey:"date_of_incident",dependsOn:["date_of_incident"],validate:e=>{const t=e.date_of_incident;if(!t||typeof t!="string")return;const n=It(t);if(isNaN(n.getTime()))return"Invalid date.";const i=nn();return n>i?"Loss date cannot be in the future.":void 0}},{targetKey:"home_prior_expiration_date",dependsOn:["home_prior_expiration_date"],validate:e=>{const t=e.home_prior_expiration_date;if(!t||typeof t!="string")return;const n=It(t);if(isNaN(n.getTime()))return"Invalid date.";const i=nn(),o=new Date(Date.UTC(i.getUTCFullYear()-1,i.getUTCMonth(),i.getUTCDate())),s=new Date(Date.UTC(i.getUTCFullYear()+1,i.getUTCMonth(),i.getUTCDate()));if(n<o||n>s)return"Policy expiration date must be between 1 year ago and 1 year from now."}},{targetKey:"purchase_date",dependsOn:["purchase_date"],validate:e=>{const t=e.purchase_date;if(!t||typeof t!="string")return;const n=It(t);return isNaN(n.getTime())?"Invalid date.":n>nn()?"Vehicle purchase date cannot be in the future.":void 0}},{targetKey:"purchase_date",dependsOn:["purchase_date","year"],validate:e=>{const t=e.purchase_date,n=e.year;if(!t||typeof t!="string"||n==null)return;const i=It(t);if(isNaN(i.getTime()))return;const o=Number(n);if(!isNaN(o))return i.getUTCFullYear()<o?"The year the vehicle was purchased is not valid with the model year.":void 0}},{targetKey:"auto_prior_expiration_date",dependsOn:["auto_prior_expiration_date"],validate:e=>{const t=e.auto_prior_expiration_date;if(!t||typeof t!="string")return;const n=It(t);if(isNaN(n.getTime()))return"Invalid date.";const i=nn(),o=new Date(Date.UTC(i.getUTCFullYear()-1,i.getUTCMonth(),i.getUTCDate())),s=new Date(Date.UTC(i.getUTCFullYear()+1,i.getUTCMonth(),i.getUTCDate()));if(n<o||n>s)return"Auto policy expiration date must be between 1 year ago and 1 year from now."}},{targetKey:"auto_prior_years",dependsOn:["auto_prior_years","auto_continuous_coverage_years"],validate:e=>{const t=e.auto_prior_years,n=e.auto_continuous_coverage_years;if(t==null||n==null)return;const i=Number(t),o=Number(n);if(!(isNaN(i)||isNaN(o)))return i>o?"Years with prior auto carrier cannot be higher than years with continuous coverage.":void 0}},{targetKey:"auto_prior_years",dependsOn:["auto_prior_years","date_of_birth"],validate:e=>{const t=e.auto_prior_years,n=e.date_of_birth;if(t==null||n==null||typeof n!="string")return;const i=Number(t);if(isNaN(i))return;const o=It(n);if(isNaN(o.getTime()))return;const s=Ba(o,nn());return i>s?"Years with prior auto carrier cannot be greater than the Applicant's age.":void 0}},{targetKey:"auto_continuous_coverage_years",dependsOn:["auto_continuous_coverage_years","date_of_birth"],validate:e=>{const t=e.auto_continuous_coverage_years,n=e.date_of_birth;if(t==null||n==null||typeof n!="string")return;const i=Number(t);if(isNaN(i))return;const o=It(n);if(isNaN(o.getTime()))return;const s=Ba(o,nn());return i>s?"Years with continuous auto coverage cannot be greater than the Applicant's age.":void 0}},{targetKey:"vehicle_coll_deductible",dependsOn:["vehicle_coll_deductible","vehicle_comp_deductible"],validate:e=>{const t=e.vehicle_coll_deductible,n=e.vehicle_comp_deductible;if(!(!t||typeof t!="string"||!n||typeof n!="string")&&n==="NoCoverage"&&t!=="NoCoverage")return"Collision Coverage cannot be chosen if Comprehensive is No Coverage."}},{targetKey:"policy_um",dependsOn:["policy_um","policy_bi"],validate:e=>{const t=e.policy_um,n=e.policy_bi;if(!t||typeof t!="string"||!n||typeof n!="string"||t==="Reject"||n==="Dontknow")return;const i=h=>h.endsWith("CSL"),o=i(t),s=i(n);if(o&&!s)return"A Combined Single Limit cannot be selected for Uninsured/Underinsured Motorist unless a Combined Single Limit has also been selected for Liability.";const c={cov30to60:30,cov50to100:50,cov100to100:100,cov100to300:100,cov250to500:250,cov300to300:300,cov500to500:500,cov100CSL:100,cov300CSL:300,cov500CSL:500},d=c[t],m=c[n];if(d!=null&&m!=null&&d>m)return"Uninsured/Underinsured Motorist Limit value cannot be greater than Bodily Injury Limit value."}},{targetKey:"policy_umpd",dependsOn:["policy_umpd","policy_pd"],validate:e=>{const t=e.policy_umpd,n=e.policy_pd;if(!t||typeof t!="string"||!n||typeof n!="string"||t==="NoCoverage"||n==="Dontknow")return;const i=c=>{if(!c.startsWith("cov"))return null;const d=parseInt(c.replace("cov",""),10);return isNaN(d)?null:d},o=i(t),s=i(n);if(o!=null&&s!=null&&o>s)return"Uninsured Motorist Property Damage Limit value cannot be greater than Liability Property Damage Limit value."}},{targetKey:"custom_equipment_value_cents",dependsOn:["custom_equipment_value_cents","stated_value_amount_cents"],validate:e=>{const t=e.custom_equipment_value_cents,n=e.stated_value_amount_cents;if(t==null||n==null)return;const i=Number(t),o=Number(n);if(!(isNaN(i)||isNaN(o))&&o>0&&i>0)return"Modifications should be included in the stated value of the vehicle. If a stated value quote is not required, remove the stated value."}}];function m0(e,t){const n=RI[e];if(!n)return;const i=n.safeParse(t);return i.success?void 0:i.error.issues[0].message}function i3(e){if(/\s/.test(e))return!1;const t=e.trim();return t.length===17&&/^[A-HJ-NPR-Z0-9]{17}$/i.test(t)}function OI(e,t){const n={};for(const i of g5){if(t?.has(i.targetKey))continue;const o=i.validate(e);o&&(n[i.targetKey]=o)}return n}function Sd(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"")}function Ya(e,t){return e.key??`${Sd(e.question)}-${t}`}function Cr(e,t){return t==="number"?e==null||typeof e=="string"&&e.trim()==="":t==="checkbox"?e!==!0:e==null||typeof e=="string"&&e.trim()===""}function Fs(e,t){const n={};e.forEach((c,d)=>{const m=Ya(c,d),h=t[m];if(c.required&&Cr(h,c.inputType)){n[m]="Required";return}if(!Cr(h,c.inputType)){const y=m0(m,h);if(y){n[m]=y;return}}});const i={...t};e.forEach((c,d)=>{const m=Ya(c,d);m in i||(i[m]="")});const o=new Set(Object.keys(n).filter(c=>n[c])),s=OI(i,o);for(const[c,d]of Object.entries(s))n[c]=d;return n}function kI(e){if(e===""||e===null||e===void 0)return;const t=Number(e);return Number.isNaN(t)?void 0:t}const BI={NoPriorInsurance:"No Prior Insurance",TwentyFirstCentury:"21st Century",ACentral:"A.Central",AAA:"AAA",AARP:"AARP",Acadia:"Acadia",Ace:"Ace",Acuity:"Acuity",AdirondackInsExchange:"Adirondack Ins Exchange",Aegis:"Aegis",AIC:"AIC",AIG:"AIG",AlfaAlliance:"Alfa Alliance",Allied:"Allied",Allstate:"Allstate",AmericaFirst:"America First",AmericanCommerce:"American Commerce",AmericanFamily:"American Family",Amica:"Amica",ASILloyds:"ASI Lloyds",AustinMutual:"Austin Mutual",Autoone:"Autoone",AutoOwners:"Auto-Owners",BadgerMutual:"Badger Mutual",Balboa:"Balboa",Bankers:"Bankers",BeaconNational:"Beacon National",BrethernMutual:"Brethern Mutual",BristolWest:"Bristol West",CapitalInsuranceGroup:"Capital Insurance Group",Celina:"Celina",CentralMutualOfOH:"Central Mutual of OH",Chubb:"Chubb",Cincinnati:"Cincinnati",Clearcover:"Clearcover",CNA:"CNA",ColonialPenn:"Colonial Penn",ColoradoCasualty:"Colorado Casualty",Columbia:"Columbia",CommerceWest:"Commerce West",CommonwealthCasualty:"Commonwealth Casualty",Ameriprise:"CONNECT",ConstitutionalCasualty:"Constitutional Casualty",Cornerstone:"Cornerstone",Countrywide:"Countrywide",CSE:"CSE",Cumberland:"Cumberland",Dairyland:"Dairyland",Deerbrook:"Deerbrook",Direct:"Direct",Donegal:"Donegal",Drive:"Drive",Electric:"Electric",EMC:"EMC",Encompass:"Encompass",Erie:"Erie",Esurance:"Esurance",Explorer:"Explorer",FarmBureau:"Farm Bureau",Farmers:"Farmers",FiremansFund:"Firemans Fund",FirstAmerican:"First American",Foremost:"Foremost",Geico:"Geico",GeneralCasualty:"General Casualty",GermantownMutual:"Germantown Mutual",GMAC:"GMAC",Grange:"Grange",GreatAmerican:"Great American",Grinnell:"Grinnell",GuideOne:"Guide One",Hanover:"Hanover",Harbor:"Harbor",Harleysville:"Harleysville",HartfordOMNI:"Hartford OMNI",Hartford:"Hartford",HastingsMutual:"Hastings Mutual",HawkeyeSecurity:"Hawkeye Security",HDI:"HDI",HoraceMann:"Horace Mann",HoustonGeneral:"Houston General",IFA:"IFA",ImperialCasualty:"Imperial Casualty",IndianaFarmers:"Indiana Farmers",Indiana:"Indiana",Infinity:"Infinity",Insurequest:"Insurequest",Integon:"Integon",Integrity:"Integrity",Kemper:"Kemper",LibertyMutual:"Liberty Mutual",LibertyNorthwest:"Liberty Northwest",MainStreetAmerica:"Main Street America",Mapfre:"Mapfre",Mendota:"Mendota",MerchantsGroup:"Merchants Group",Mercury:"Mercury",Metlife:"MetLife",Metropolitan:"Metropolitan",MidContinent:"Mid-Continent",MidwesternIndemnity:"Midwestern Indemnity",Montgomery:"Montgomery",MSA:"MSA",MtWashington:"Mt. Washington",MutualBenefit:"Mutual Benefit",NationalGeneral:"National General",Nationwide:"Nationwide",NewYorkCentralMutual:"New York Central Mutual",NJManufacturers:"NJ Manufacturers",NJSkylands:"NJ Skylands",Northstar:"Northstar",Occidental:"Occidental",OhioCasualty:"Ohio Casualty",OmahaPC:"Omaha P/C",OneBeacon:"One Beacon",OregonMutual:"Oregon Mutual",Palisades:"Palisades",PeerlessMontgomery:"Peerless/Montgomery",Pekin:"Pekin",Pemco:"Pemco",PennNational:"Penn National",PlymouthRock:"Plymouth Rock",PreferredMutual:"Preferred Mutual",Proformance:"Proformance",Progressive:"Progressive",Prudential:"Prudential",Republic:"Republic",RockfordMutual:"Rockford Mutual",RoyalAndSunAlliance:"Royal and Sun Alliance",Safeco:"Safeco",SECURA:"SECURA",Selective:"Selective",SouthernCounty:"Southern County",SouthernMutual:"Southern Mutual",SouthernTrust:"Southern Trust",StPaulTravelers:"St. Paul/Travelers",StandardMutual:"Standard Mutual",StarCasualty:"Star Casualty",StateAuto:"State Auto",StateFarm:"State Farm",Fidelity:"Stillwater",Travelers:"Travelers",TWFG:"TWFG",Unigard:"Unigard",UnitedFireAndCasualty:"United Fire and Casualty",Unitrin:"Unitrin",Universal:"Universal",USAA:"USAA",UticaNational:"Utica National",Victoria:"Victoria",WestBend:"West Bend",WesternNational:"Western National",WesternReserveGroup:"Western Reserve Group",Westfield:"Westfield",WhiteMountains:"White Mountains",WilsonMutual:"Wilson Mutual",Windsor:"Windsor",Zurich:"Zurich",OtherStandard:"Other Standard",OtherNonStandard:"Other Non-Standard"},LI={OwnHome:"Own Home",OwnCondo:"Own Condo",RentHome:"Rent Home",RentCondo:"Rent Condo",RentApartment:"Rent Apartment",LiveWithParents:"Live With Parents"},PI={TwentyFirstCentury:"21st Century",AAA:"AAA",Acuity:"Acuity",AdirondackInsExchange:"Adirondack Ins Exchange",AIG:"AIG",AlfaAlliance:"Alfa Alliance",AllianzOfAmerica:"Allianz of America",AllianzOfAmericaJefferson:"Allianz of America-Jefferson",Allied:"Allied",Allmerica:"Allmerica",Allstate:"Allstate",AmericaFirst:"America First",AmericanFamily:"American Family",AmericanCommerce:"American Commerce",Amica:"Amica",ASILloyds:"ASI Lloyds",Assurant:"Assurant",AtlasGeneralAgency:"Atlas General Agency",AustinMutual:"Austin Mutual",AutoOwners:"Auto-Owners",BadgerMutual:"Badger Mutual",Balboa:"Balboa",Bamboo:"Bamboo",BeaconNational:"Beacon National",BunkerHill:"Bunker Hill",CapitalInsuranceGroup:"Capital Insurance Group",CentralMutualOfOH:"Central Mutual of OH",ChubbInsurance:"Chubb",Cincinnati:"Cincinnati",Citizens:"Citizens",ColoradoCasualty:"Colorado Casualty",Ameriprise:"CONNECT",CSE:"CSE",Cumberland:"Cumberland",Cypress:"Cypress",Dairyland:"Dairyland",Donegal:"Donegal",Electric:"Electric",EMC:"EMC",Encompass:"Encompass",Erie:"Erie",Esurance:"Esurance",ExcelsiorInsuranceCompany:"Excelsior Insurance Company",FairPlan:"Fair Plan",FarmBureau:"Farm Bureau",Farmers:"Farmers",FiremansFund:"Firemans Fund",FirstAmerican:"First American",ForemostInsuranceCompany:"Foremost Insurance Company",Geico:"Geico",GeneralCasualty:"General Casualty",GermantownMutual:"Germantown Mutual",GMAC:"GMAC",Grange:"Grange",Grinnell:"Grinnell",GuideOne:"Guide One",Hanover:"Hanover",Harleysville:"Harleysville",Hartford:"Hartford",HartfordOMNI:"Hartford OMNI",HawkeyeSecurity:"Hawkeye Security",HippoInsuranceCompany:"Hippo Insurance Company",HomeownersOfAmerica:"Homeowners of America",Homesite:"Homesite",HoraceMann:"Horace Mann",HoustonGeneral:"Houston General",Indiana:"Indiana",IndianaFarmers:"Indiana Farmers",Integrity:"Integrity",Kemper:"Kemper",LibertyMutual:"Liberty Mutual",LibertyNorthwest:"Liberty Northwest",Lloyds:"Lloyds",MainStreetAmerica:"Main Street America",MarkelInsuranceCompany:"Markel Insurance Company",MerchantsGroup:"Merchants Group",Mercury:"Mercury",Metlife:"MetLife",MidwesternIndemnity:"Midwestern Indemnity",Montgomery:"Montgomery",MSA:"MSA",MutualBenefit:"Mutual Benefit",Tower:"National General",NatGenPremier:"NatGen Premier",Nationwide:"Nationwide",NationwideScottsdale:"Nationwide-Scottsdale",NewYorkCentralMutual:"New York Central Mutual",NJSkylands:"NJ Skylands",Northstar:"Northstar",OhioCasualty:"Ohio Casualty",OneBeacon:"One Beacon",OregonMutual:"Oregon Mutual",PeerlessMontgomery:"Peerless/Montgomery",Pekin:"Pekin",PennNational:"Penn National",PlymouthRock:"Plymouth Rock",PreferredMutual:"Preferred Mutual",Prudential:"Prudential",PureHighValue:"Pure High Value",Republic:"Republic",RoyalAndSunAlliance:"Royal and Sun Alliance",Safeco:"Safeco",SECURA:"SECURA",SouthernMutual:"Southern Mutual",SouthernTrust:"Southern Trust",StPaulTravelers:"St. Paul/Travelers",StandardMutual:"Standard Mutual",StateAuto:"State Auto",StateFarm:"State Farm",StateFarmFloridaInsuranceCompany:"State Farm Florida Insurance Company",Fidelity:"Stillwater",SunshineStateInsuranceCompany:"Sunshine State Insurance Company",Travelers:"Travelers",TWFG:"TWFG",Unigard:"Unigard",UnitedFireAndCasualty:"United Fire and Casualty",Unitrin:"Unitrin",Universal:"Universal",USAA:"USAA",UticaNational:"Utica National",Wellington:"Wellington",WestBend:"West Bend",WesternNational:"Western National",WesternReserveGroup:"Western Reserve Group",Westfield:"Westfield",WhiteMountains:"White Mountains",WilsonMutual:"Wilson Mutual",Zurich:"Zurich",Other:"Other",OtherNonStandard:"Other Non-Standard",OtherStandard:"Other Standard"},II={Business:"Business",Pleasure:"Pleasure",Farming:"Farming",To_FromWork:"To/From Work",To_FromSchool:"To/From School"},FI={Dontknow:"Don't Know",ThirtyToSixty:"30/60",FiftyToHundred:"50/100",HundredToHundred:"100/100",HundredToThreeHundred:"100/300",TwoHundredFiftyToFiveHundred:"250/500",ThreeHundredToThreeHundred:"300/300",FiveHundredToFiveHundred:"500/500",HundredCSL:"100CSL",ThreeHundredCSL:"300CSL",FiveHundredCSL:"500CSL"},jI={ActiveMilitaryDuty:"Active Military Duty",DrivingCompanyCar:"Driving A Company Car",DrivingCarOwnedByRelative:"Driving A Car Owned By A Relative",HasNotOwnedOrOperatedVehicle:"Has Not Owned Or Operated A Vehicle",OwnedVehParkedStoredOffRoadNotDriven:"Owned Veh Parked/Stored Off Road/Not Driven",NonPayment:"Non-Payment",Other:"Other"},zI={Dontknow:"Don't Know",cov30to60:"30/60",cov35to70:"35/70",cov50to100:"50/100",cov100to100:"100/100",cov100to300:"100/300",cov250to500:"250/500",cov300to300:"300/300",cov500to500:"500/500",cov100CSL:"100 CSL",cov300CSL:"300 CSL",cov500CSL:"500 CSL"},UI={Reject:"Reject",cov30to60:"30/60",cov35to70:"35/70",cov50to100:"50/100",cov100to100:"100/100",cov100to300:"100/300",cov250to500:"250/500",cov300to300:"300/300",cov500to500:"500/500",cov100CSL:"100 CSL",cov300CSL:"300 CSL",cov500CSL:"500 CSL"},HI={Dontknow:"Don't know",cov25000:"25,000",cov50000:"50,000",cov100000:"100,000",cov250000:"250,000",cov500000:"500,000"},VI={None:"None",cov500:"500",cov1000:"1,000",cov2000:"2,000",cov2500:"2,500",cov5000:"5,000",cov10000:"10,000",cov15000:"15,000",cov25000:"25,000",cov50000:"50,000",cov100000:"100,000"},GI={cov25000:"25,000",cov35000:"35,000",cov50000:"50,000",cov100000:"100,000",cov200000:"200,000",cov250000:"250,000",cov300000:"300,000",cov500000:"500,000"},ZI={cov15000:"15,000",cov2500:"2,500",cov5000:"5,000",cov10000:"10,000",cov25000:"25,000",cov50000:"50,000",cov100000:"100,000",cov250000:"250,000",cov75000:"75,000",cov150000:"150,000"},YI={NoCoverage:"No Coverage",cov5000:"5,000",cov10000:"10,000"},p0={NoCoverage:"No Coverage",Zero:"0",Fifty:"50",Hundred:"100",TwoHunderd:"200",TwoHundredfifty:"250",FiveHundred:"500",SeventyFiveHundred:"750",Thousand:"1,000",TwoThousand:"2,000"},qI=["NoCoverage","Zero","Fifty","Hundred","TwoHunderd","TwoHundredfifty","FiveHundred","SeventyFiveHundred","Thousand","TwoThousand"],KI=["NoCoverage","Zero","Fifty","Hundred","TwoHunderd","TwoHundredfifty","FiveHundred","Thousand","TwoThousand"],h0={NoCoverage:"No Coverage",TwentyFive:"25",Forty:"40",Fifty:"50",SeventyFive:"75",Eighty:"80",Hundred:"100",TwelveHundred:"120",TwoHundred:"200",Unlimited:"Unlimited"},WI=["NoCoverage","TwentyFive","Fifty","SeventyFive","Hundred","TwoHundred","Unlimited"],b5={NoCoverage:"No Coverage",cov20to600:"20/600",cov25to750:"25/750",cov30to900:"30/900",cov40to1200:"40/1,200",cov50to1500:"50/1,500",cov100to3000:"100/3,000"},QI=["NoCoverage","cov20to600","cov25to750","cov30to900","cov40to1200","cov50to1500","cov100to3000"],JI=["NoCoverage","cov20to600","cov30to900","cov40to1200","cov50to1500"],v5={NoHighSchoolDiploma:"No High School Diploma",HighSchoolDiploma:"High School Diploma",SomeCollegeNoDegree:"Some College - No Degree",VocationalTechnicalDegree:"Vocational Technical Degree",AssociatesDegree:"Associates Degree",Bachelors:"Bachelors",Masters:"Masters",Phd:"Phd",MedicalDegree:"Medical Degree",LawDegree:"Law Degree"},XI={TwoFamilyHome:"2-Family Home",American4square:"American 4-square",Basic:"Basic",BiLevel:"Bi-Level",Bungalow:"Bungalow",CapeCod:"Cape Cod",Colonial:"Colonial",ColonialSpanish:"Colonial - Spanish",CompletelyCustom:"Completely Custom",Contemporary:"Contemporary",ContractorModern:"Contractor Modern",Farmhouse:"Farmhouse",Folk:"Folk",Log:"Log",Mediterranean:"Mediterranean",Ranch:"Ranch",TriLevel:"Tri-Level",Tudor:"Tudor",Vernacular:"Vernacular",Victorian:"Victorian"},eF={SingleFamilyHouse:"Single Family House",Townhouse:"Townhouse",Rowhouse:"Rowhouse",Duplex:"Duplex/Two Family Unit",Triplex:"Tri-plex/Three Family Unit",Fourplex:"Four-plex/Four Family Unit",MultFamily:"Multi-family (more than four units)"},tF={OwnerPrimary:"Owner Primary",OwnerSecondary:"Owner Secondary",OwnerSeasonal:"Owner Seasonal"},nF={Basic:"Basic",Modest:"Modest",Average:"Average",AboveAverage:"Above Average",Expensive:"Expensive",VeryExpensive:"Very Expensive",Opulent:"Opulent"},rF={Frame:"Frame",Masonry:"Masonry",MasonryVeneer:"Masonry Veneer",Log:"Log",Asbestos:"Asbestos",EFIS:"EFIS",HardiPlank:"HardiPlank",SuperiorFireResistive:"Superior Fire Resistive",SuperiorMasonryNonCombustible:"Superior Masonry Non Combustible",SuperiorNonCombustible:"Superior Non Combustible"},aF={Slab:"Slab",Basement:"Basement",CrawlSpace:"Crawl Space",PartialBasement:"Partial Basement",PiersPostsPiles:"Piers / Posts / Piles",Open:"Open"},iF={NotOverWater:"No",PartiallyOverWater:"Partially Over Water",FullyOrEntirelyOverWater:"Fully or Entirely Over Water"},oF={One:"1",OneHalf:"1.5",Two:"2",TwoHalf:"2.5",Three:"3",ThreeHalf:"3.5",Four:"4",BiLevel:"Bi-Level",TriLevel:"Tri-Level"},lF={VinylSiding:"Vinyl Siding",WoodFraming:"Wood Framing",BrickVeneer:"Brick Veneer",Stucco:"Stucco",AdobeBlock:"Adobe Block",AluminumSiding:"Aluminum Siding",CementFiberShingles:"Cement Fiber Shingles",Clapboard:"Clapboard",ConcreteBlock:"Concrete Block",HardboardSiding:"Hardboard Siding",InsulatedConcreteForms:"Insulated Concrete Forms",LightGaugeSteelFraming:"Light Gauge Steel Framing",LogsSolid:"Logs (Solid)",MasoniteSiding:"Masonite Siding",PreEngineeredMetal:"Pre-Engineered Metal",SolidBrickConstruction:"Solid Brick Construction",SolidConcrete:"Solid Concrete",StandardPoleFramed:"Standard Pole Framed",Stone:"Stone",StructuralInsulatedPanels:"Structural Insulated Panels",TimberFraming:"Timber Framing"},sF={ASPHALT_SHINGLES:"Asphalt Shingles",ARCHITECTURAL_SHINGLES:"Architectural Shingles",METAL:"Metal",TILE_CONCRETE:"Tile (Concrete)",ASBESTOS:"Asbestos",BUILT_UP:"Built-Up",COMPOSITION:"Composition",CONCRETE:"Concrete",COPPER:"Copper",CORRUGATED_STEEL:"Corrugated Steel",FIBERGLASS:"Fiberglass",FOAM:"Foam",GRAVEL:"Gravel",MEMBRANE:"Membrane",MINERAL_FIBER_SHAKE:"Mineral Fiber Shake",PLASTIC:"Plastic",ROCK:"Rock",ROLLED_PAPER:"Rolled Paper",RUBBER:"Rubber",SLATE:"Slate",TAR:"Tar",TAR_GRAVEL:"Tar and Gravel",TILE_CLAY:"Tile (Clay)",TILE_MISSION:"Tile (Mission)",TILE_SPANISH:"Tile (Spanish)",TIN:"Tin",WOOD_FIBERGLASS_SHINGLES:"Wood/Fiberglass Shingles",WOOD_SHAKE:"Wood Shake",WOOD_SHINGLES:"Wood Shingles",OTHER:"Other"},uF={B_Gable:"Gable",C_Hip:"Hip",A_Flat:"Flat",D_Other:"Other"},cF={NotUpdated:"Not Updated",PartialUpdate:"Partial Update",CompleteUpdate:"Complete Update"},dF={Electric:"Electric",Gas:"Gas",GasForcedAir:"Gas - Forced Air",GasHotWater:"Gas - Hot Water",Oil:"Oil",OilForcedAir:"Oil - Forced Air",OilHotWater:"Oil - Hot Water",SolidFuel:"Solid Fuel",HeatPump:"Heat Pump",Other:"Other"},fF={AboveGround:"Above Ground",BelowGround:"Below Ground"},mF={Basement:"Below Grade Basement",SplitLevelBasement:"Split Level Basement",WalkoutBasement:"Walkout Basement"},pF={EntirelyCopper:"Entirely Copper",EntirelyGalvanized:"Entirely Galvanized",EntirelyPEX:"Entirely PEX",EntirelyPVC:"Entirely PVC",Polybutylene:"Polybutylene"},hF={TwentyFive:"$25,000",Fifty:"$50,000",OneHundred:"$100,000",TwoHundred:"$200,000",ThreeHundred:"$300,000",FourHundred:"$400,000",FiveHundred:"$500,000"},yF={cov1000:"$1,000",cov2000:"$2,000",cov3000:"$3,000",cov4000:"$4,000",cov5000:"$5,000"},gF={TwoHundredFifty:"$250",FiveHundred:"$500",SevenHundredFifty:"$750",OneThousand:"$1,000",OneThousandFiveHundred:"$1,500",TwoThousand:"$2,000",TwoThousandFiveHundred:"$2,500",ThreeThousands:"$3,000",FourThousands:"$4,000",FiveThousands:"$5,000",OnePercent:"1%",TwoPercent:"2%",ThreePercent:"3%",FourPercent:"4%",FivePercent:"5%"},bF={None:"None",OnePercent:"1%",TwoPercent:"2%",FivePercent:"5%",TenPercent:"10%"},vF={_0_500ft:"0-500 Feet",_501_1000ft:"501-1000 Feet",_1001ftAndGreater:"1001 Feet And Greater"},_F={Lessthan5miles:"Less Than 5 Miles",Over5miles:"Over 5 Miles",NotAvailable:"Not Available"},o3={"Agriclt/Forestry/Fish":"Agriculture/Forestry/Fishing","Art/Design/Media":"Art/Design/Media","Banking/Finance/RE":"Banking/Finance/Real Estate","Business/Sales/Offi":"Business/Sales/Office","Construct/EnrgyTrds":"Construction/Energy Trades",Disabled:"Disabled","Education/Library":"Education/Library","Engr/Archt/Sci/Math":"Engineer/Architect/Science/Math","Government/Military":"Government/Military","Homemaker/Houseprsn":"Homemaker/House Person","Info Tech":"Information Technology",Insurance:"Insurance","Lgl/Law Enfcmt/Sec":"Legal/Law Enforcement/Security","Maint/Rpr/Hsekeep":"Maintenance/Repair/Housekeeping","Mfg/Production":"Manufacturing/Production","Med/Soc Svcs/Relig":"Medical/Social Services/Religion",Other:"Other","Person.Care/Service":"Personal Care/Service","Rest/Hotel Services":"Restaurant/Hotel Services",Retired:"Retired","Sports/Recreation":"Sports/Recreation",Student:"Student","Trvl/Trnsprt/Warehs":"Travel/Transportation/Warehousing",Unemployed:"Unemployed"},l3={Single:"Single",Married:"Married",Seperated:"Separated",Divorced:"Divorced",Widowed:"Widowed",DomesticPartner:"Domestic Partner"},s3={Female:"Female",Male:"Male"},_5={"Agriclt/Forestry/Fish":"Agriculture/Forestry/Fishing","Art/Design/Media":"Art/Design/Media","Banking/Finance/RE":"Banking/Finance/Real Estate","Business/Sales/Offi":"Business/Sales/Office","Construct/EnrgyTrds":"Construction/Energy Trades",Disabled:"Disabled","Education/Library":"Education/Library","Engr/Archt/Sci/Math":"Engineer/Architect/Science/Math","Government/Military":"Government/Military","Homemaker/Houseprsn":"Homemaker/House person","Info Tech":"Information Technology",Insurance:"Insurance","Lgl/Law Enfcmt/Sec":"Legal/Law Enforcement/Security","Maint/Rpr/Hsekeep":"Maintenance/Repair/Housekeeping","Mfg/Production":"Manufacturing/Production","Med/Soc Svcs/Relig":"Medical/Social Services/Religion",Other:"Other","Person.Care/Service":"Personal Care/Service","Rest/Hotel Services":"Restaurant/Hotel Services",Retired:"Retired","Sports/Recreation":"Sports/Recreation",Student:"Student","Trvl/Trnsprt/Warehs":"Travel/Transportation/Warehousing",Unemployed:"Unemployed"},EF={CONTAMINATION:"Contamination",CREDITCARD:"Credit Card",DAMAGETOPROPERTYOFOTHERS:"Damage To Property Of Others",DOGBITELIABILITY:"Dog Bite",EARTHMOVEMENT:"Earth Movement",EARTHQUAKE:"Earthquake",EXTENDEDCOVERAGEPERILS:"Extended Coverage Perils",FIRE:"Fire",FLOOD:"Flood",FREEZINGWATERINCLUDINGBURSTPIPES:"Freezing Water",HAIL:"Hail",HURRICANE:"Hurricane",LIABILITYALLOTHER:"Liability",LIGHTNING:"Lightning",MEDICALPAYMENTS:"Medical Payments",MYSTERIOUSDISAPPEARANCE:"Mysterious Disappearance",MYSTERIOUSDISAPPEARANCESCHEDULEDPROPERTY:"Mysterious Disappearance - Scheduled Property",PHYSICALDAMAGEALLOTHER:"Physical Damage",SINKHOLE:"Sinkhole",SLIPFALLLIABILITY:"Slip/Fall",SMOKE:"Smoke",THEFTSCHEDULEDPROPERTY:"Theft - Scheduled Property",THEFTBURGLARY:"Theft - Burglary",TORNADO:"Tornado",VANDALISMMALICIOUSMISCHIEF:"Vandalism",WATERDAMAGE:"Water Damage",WIND:"Wind",WORKERSCOMPENSATION:"Workers Compensation",ALLOTHER:"All Other"},SF={Verbal_Threshold:"Limited right to sue",Zero_Threshold:"Unlimited right to sue"},DF={Primary:"Primary",Secondary:"Secondary"},$F={cov1000:"$1,000",cov10000:"$10,000"},xF={cov100_10400_LIMITED:"100 - 10,400/ LIMITED",cov125_13000_LIMITED:"125 - 13,000/ LIMITED",cov175_18200_LIMITED:"175 - 18,200/ LIMITED",cov250_26000_LIMITED:"250 - 26,000/ LIMITED",cov400_41600_LIMITED:"400 - 41,600/ LIMITED",cov500_52000_LIMITED:"500 - 52,000/ LIMITED",cov600_62400_LIMITED:"600 - 62,400/ LIMITED",cov700_72800_LIMITED:"700 - 72,800/ LIMITED",cov100_UNLIMITED:"100/UNLIMITED",cov125_UNLIMITED:"125/UNLIMITED",cov175_UNLIMITED:"175/UNLIMITED",cov250_UNLIMITED:"250/UNLIMITED",cov400_UNLIMITED:"400/UNLIMITED",cov500_UNLIMITED:"500/UNLIMITED",cov600_UNLIMITED:"600/UNLIMITED",cov700_UNLIMITED:"700/UNLIMITED"},CF={cov250:"$250",cov500:"$500",cov1000:"$1,000",cov2000:"$2,000",cov2500:"$2,500"},AF={"Agriclt/Forestry/Fish":["Agr Inspect/Grader","Arborist","Clerk","Equip. Operator","Farm/Ranch Owner","Farm/Ranch Worker","Fisherman","Florist","Laborer/Worker","Landscape/NursryWkr","Landscaper","Logger","Millworker","Other","Ranger","Supervisor","Timber Grader/Scale"],"Art/Design/Media":["Actor","Admin Assist","Announcer/Broadcstr","Artist/Animator","Author/Writer","Choreography/Dancer","Clerk","Composer/Director","Curator","Designer","Editor","Journalist/Reporter","Musician/Singer","Other","Printer","Producer","Production Crew","Projectionist","Receptionist/Sec","Ticket Sales/Usher"],"Banking/Finance/RE":["Accountant/Auditor","Admin Assist","Analyst/Broker","Bookkeeper","Branch Manager","Clerk","Collections","Consultant","Controller","CSR/Teller","Director/Administr","Executive","Financial Advisor","Investment Banker","Investor","Loan/EscrowProcess","Mgr-Credit/Loan","Mgr-Portfolio/Prod.","Mgr-Property","Other","Realtor","Receptionist/Sec","SalesAgt/Represent.","Trader,Finan Instru","Underwriter"],"Business/Sales/Offi":["Account Executive","Admin Assist","Buyer","Clerk-Office","Consultant","CSR","Director/Administr","Executive","H.R. Representative","Marketing Researchr","Messenger/Courier","Mgr - District","Mgr - Finance","Mgr-Dept/Store","Mgr-General Opers","Mgr-H.R./PublicRel","Mgr-Mkt/Sales","Mgr/Supervisr-Offic","Other","Receptionist/Sec","Sales-Counter/Rentl","Sales-Home Based","Sales-Mfg Rep","Sales-Retail/Whlsle","Sales-Route/Vendor"],"Construct/EnrgyTrds":["Boiler Oper/Maker","Bricklayer/Mason","Carpenter","Carpet Installer","Concrete Worker","Constrct Proj Mgr","Contractor","Crane Operator","Electrician/Linesmn","ElevatorTech/Instl","Equip. Operator","FloorLayer/Finisher","Foreman/Supervisor","Handyman","Heat/Air Technician","Inspector","Laborer/Worker","Metalworker","Miner","Oil/GasDril/RigOpr","Other","Painter","Plstr/Drywall/Stuc","Plumber","Roofer"],Disabled:["Disabled"],"Education/Library":["Admin Assist","Audio-Visual Tech.","Child/DayCare Wrker","Clerk","Counselor","Grad. Teaching/Asst","Instructor-Vocation","Librarian/Curator","Other","Professor, College","Receptionist/Sec","Superintendent","Teacher, College","Teacher, K-12","Teaching Asst/Aide","Tutor"],"Engr/Archt/Sci/Math":["Actuary","Admin Assist","Analyst","Architect","Clerk","Clinical Data Coord.","Drafter","Engineer","Manager-Project","Manager-R&D","Mathematician","Other","Receptionist/Sec","Research Prog. Dir.","Researcher","Scientist","Sociologist","Surveyor/Mapmaker","Technician"],"Government/Military":["Accountant/Auditor","Admin Assist","Analyst","Attorney","Chief Executive","Clerk","Commissioner","Council member","Director/Administr","Enlst Mil Prsnl E1-4","Legislator","Mayor/City Manager","Meter Reader","NCO (E5-9)","Officer-Commissiond","Officer-Warrant","Other","Park Ranger","Planner","Postmaster","Receptionist/Sec","Regulator","US Postal Worker"],"Homemaker/Houseprsn":["Homemaker/Houseprsn"],"Info Tech":["Admin Assist","Analyst","Clerk","Director/Administr","Engineer-Hardware","Engineer-Software","Engineer-Systems","Executive","Manager-Systems","Network Admin","Other","Programmer","Project Coordinator","Receptionist/Sec","Support Technician","Systems Security","Technical Writer","Web Developer"],Insurance:["Accountant/Auditor","Actuarial Clerk","Actuary","Admin Assist","Agent/Broker","Analyst","Attorney","Claims Adjuster","Clerk","Commissioner","CSR","Director/Administr","Executive","Other","Product Manager","Receptionist/Sec","Sales Rep","Underwriter"],"Lgl/Law Enfcmt/Sec":["Airport Sec Ofcr","Animal Control Ofcr","Attorney","Bailiff","Corrections Officer","Court Clrk/Reporter","Deputy Sheriff","Dispatcher","Examiner","Fed Agt/Marshall","Fire Chief","Fire Fighter/Supv.","Gaming Ofcr/Invest","Highway Patrol Ofcr","Judge/Hearing Ofcr","Legal Asst./Sec","Other","Paralegal/Law Clerk","Police Chief","Police Det/Investgr","Police Offcr/Supvr","Process Server","Prvt Invest/Detec.","Security Guard","Sheriff"],"Maint/Rpr/Hsekeep":["Bldg Maint Engineer","Custodian/Janitor","Electrician","Field Service Tech.","Handyman","Heat/AirCond Repair","Housekeeper/Maid","Lndscpe/Grnds Maint","Maint Mechanic","Mechanic","Other"],"Mfg/Production":["Admin Assist","Clerk","Factory Worker","Foreman/Supervisor","Furniture Finisher","Inspector","Jeweler","Machine Operator","Other","Packer","Plant Manager","Printer/Bookbinder","Quality Control","Receptionist/Sec","Refining Operator","Shoemaker","Tailor/Custom Sewer","Textile Worker","Upholsterer"],"Med/Soc Svcs/Relig":["Admin Assist","Assist-Med/Dent/Vet","Clergy","Clerk","Client Care Worker","Dental Hygenist","Dentist","Doctor","Hospice Volunteer","Mortician","Nurse - C.N.A.","Nurse - LPN","Nurse - RN","Nurse Practitioner","Optometrist","Other","Paramedic/EM Tech","Pharmacist","Receptionist/Sec","Social Worker","Support Services","Technician","Therapist","Veterinarian"],Other:["Other"],"Person.Care/Service":["Caregiver","Dry Cleaner/Laundry","Hair Stylist/Barber","Housekeeper","Manicurist","Masseuse","Nanny","Other","Pet Services","Receptionist/Sec"],"Rest/Hotel Services":["Baker","Bartender","Bellhop","Bus Person","Caterer","Chef","Concessionaire","Concierge","Cook-Rest/Cafeteria","Cook/Wrkr-Fast Food","Delivery Person","Desk Clerk","Dishwasher","Food Prod/Packing","Host/Maitre d","Housekeeper/Maid","Manager","Other","Valet","Waiter/Waitress","Wine Steward"],Retired:["Retired"],"Sports/Recreation":["Activity/Recre.Asst","Admin Assist","Agent","Athlete","CampCounselor/Lead","Clerk","Coach","Concessionaire","Director, Program","Event Mgr/Promoter","Life Guard","Mgr - Fitness Club","Other","Park Ranger","Receptionist/Sec","Sales-Tkt/Mmbrshp","SportsBrdcstr/Journ","Trainer/Instructor","Umpire/Referee"],Student:["Graduate Student","High school","Other","Undergraduate"],"Trvl/Trnsprt/Warehs":["Admin Assist","Air Traffic Control","Airport Ops Crew","Bellhop/Porter","Clerk","Crane Loader/Oper","Dispatcher","Driver-Bus/Strcar","Driver-Taxi/Limo","Driver-Truck/Delvry","Flight Attendant","Forklift Operator","Laborer","Longshoreman","Mate/Sailor","Mgr Warehse/Dist","Other","Parking Lot Attend","Pilot/Capt/Eng","Railroad Worker","Receptionist/Sec","Shipping/RecClk","Subway/LgtRail Oper","Ticket Agent","Transportation Spec"],Unemployed:["Unemployed"]},wF={"Agr Inspect/Grader":"Agriculture Inspector/Grader",Arborist:"Arborist",Clerk:"Clerk","Equip. Operator":"Equipment Operator","Farm/Ranch Owner":"Farm/Ranch Owner","Farm/Ranch Worker":"Farm/Ranch Worker",Fisherman:"Fisherman",Florist:"Florist","Laborer/Worker":"Laborer/Worker","Landscape/NursryWkr":"Landscaper/Nursery Worker",Landscaper:"Landscaper",Logger:"Logger",Millworker:"Mill worker",Other:"Other",Ranger:"Ranger",Supervisor:"Supervisor","Timber Grader/Scale":"Timber Grader/Scale",Actor:"Actor","Admin Assist":"Administrative Assistant","Announcer/Broadcstr":"Announcer/Broadcaster","Artist/Animator":"Artist/Animator","Author/Writer":"Author/Writer","Choreography/Dancer":"Choreography/Dancer","Composer/Director":"Composer/Director",Curator:"Curator",Designer:"Designer",Editor:"Editor","Journalist/Reporter":"Journalist/Reporter","Musician/Singer":"Musician/Singer",Printer:"Printer",Producer:"Producer","Production Crew":"Production Crew",Projectionist:"Projectionist","Receptionist/Sec":"Receptionist/Secretary","Ticket Sales/Usher":"Ticket Sales/Usher","Accountant/Auditor":"Accountant/Auditor","Analyst/Broker":"Analyst/Broker",Bookkeeper:"Bookkeeper","Branch Manager":"Branch Manager",Collections:"Collections",Consultant:"Consultant",Controller:"Controller","CSR/Teller":"CSR/Teller","Director/Administr":"Director/Administrator",Executive:"Executive","Financial Advisor":"Financial Advisor","Investment Banker":"Investment Banker",Investor:"Investor","Loan/EscrowProcess":"Loan/Escrow Processor","Mgr-Credit/Loan":"Manager-Credit/Loan","Mgr-Portfolio/Prod.":"Manager-Portfolio/Production","Mgr-Property":"Manager-Property",Realtor:"Realtor","SalesAgt/Represent.":"Sales Agent/Representative","Trader,Finan Instru":"Trader, Financial Instruments",Underwriter:"Underwriter","Account Executive":"Account Executive",Buyer:"Buyer","Clerk-Office":"Clerk-Office",CSR:"Customer Service Representative","H.R. Representative":"H.R. Representative","Marketing Researchr":"Marketing Researcher","Messenger/Courier":"Messenger/Courier","Mgr - District":"Manager - District","Mgr - Finance":"Manager - Finance","Mgr-Dept/Store":"Manager - Department/Store","Mgr-General Opers":"Manager - General Operations","Mgr-H.R./PublicRel":"Manager - H.R./Public Relations","Mgr-Mkt/Sales":"Manager - Marketing/Sales","Mgr/Supervisr-Offic":"Manager/Supervisor - Office","Sales-Counter/Rentl":"Sales-Counter/Rental","Sales-Home Based":"Sales-Home Based","Sales-Mfg Rep":"Sales-Manufacture Rep","Sales-Retail/Whlsle":"Sales-Retail/Wholesale","Sales-Route/Vendor":"Sales-Route/Vendor","Boiler Oper/Maker":"Boiler Operator/Maker","Bricklayer/Mason":"Bricklayer/Mason",Carpenter:"Carpenter","Carpet Installer":"Carpet Installer","Concrete Worker":"Concrete Worker","Constrct Proj Mgr":"Construction - Project Manager",Contractor:"Contractor","Crane Operator":"Crane Operator","Electrician/Linesmn":"Electrician/Linesman","ElevatorTech/Instl":"Elevator Technician/Installer","FloorLayer/Finisher":"Floor Layer/Finisher","Foreman/Supervisor":"Foreman/Supervisor",Handyman:"Handyman","Heat/Air Technician":"Heat/Air Technician",Inspector:"Inspector",Metalworker:"Metalworker",Miner:"Miner","Oil/GasDril/RigOpr":"Oil/Gas Driller/Rig Operator",Painter:"Painter","Plstr/Drywall/Stuc":"Plaster/Drywall/Stucco",Plumber:"Plumber",Roofer:"Roofer",Disabled:"Disabled","Audio-Visual Tech.":"Audio-Visual Tech.","Child/DayCare Wrker":"Child/Daycare Worker",Counselor:"Counselor","Grad. Teaching/Asst":"Graduate Teaching Assistant","Instructor-Vocation":"Instructor-Vocation","Librarian/Curator":"Librarian/Curator","Professor, College":"Professor, College",Superintendent:"Superintendent","Teacher, College":"Teacher, College","Teacher, K-12":"Teacher, K-12","Teaching Asst/Aide":"Teaching Assistant/Aide",Tutor:"Tutor",Actuary:"Actuary",Analyst:"Analyst",Architect:"Architect","Clinical Data Coord.":"Clinical Data Coordinator",Drafter:"Drafter",Engineer:"Engineer","Manager-Project":"Manager-Project","Manager-R&D":"Manager-R&D",Mathematician:"Mathematician","Research Prog. Dir.":"Research Program Director",Researcher:"Researcher",Scientist:"Scientist",Sociologist:"Sociologist","Surveyor/Mapmaker":"Surveyor/Mapmaker",Technician:"Technician",Attorney:"Attorney","Chief Executive":"Chief Executive",Commissioner:"Commissioner","Council member":"Council member","Enlst Mil Prsnl E1-4":"Enlisted Military Personnel (E1-4)",Legislator:"Legislator","Mayor/City Manager":"Mayor/City Manager","Meter Reader":"Meter Reader","NCO (E5-9)":"NCO (E5-9)","Officer-Commissiond":"Officer-Commissioned","Officer-Warrant":"Officer-Warrant","Park Ranger":"Park Ranger",Planner:"Planner",Postmaster:"Postmaster",Regulator:"Regulator","US Postal Worker":"US Postal Worker","Homemaker/Houseprsn":"Homemaker/House person","Engineer-Hardware":"Engineer-Hardware","Engineer-Software":"Engineer-Software","Engineer-Systems":"Engineer-Systems","Manager-Systems":"Manager-Systems","Network Admin":"Network Administrator",Programmer:"Programmer","Project Coordinator":"Project Coordinator","Support Technician":"Support Technician","Systems Security":"Systems Security","Technical Writer":"Technical Writer","Web Developer":"Web Developer","Actuarial Clerk":"Actuarial Clerk","Agent/Broker":"Agent/Broker","Claims Adjuster":"Claims Adjuster","Product Manager":"Product Manager","Sales Rep":"Sales Representative","Airport Sec Ofcr":"Airport Security Officer","Animal Control Ofcr":"Animal Control Officer",Bailiff:"Bailiff","Corrections Officer":"Corrections Officer","Court Clrk/Reporter":"Court Clerk/Reporter","Deputy Sheriff":"Deputy Sheriff",Dispatcher:"Dispatcher",Examiner:"Examiner","Fed Agt/Marshall":"Federal Agent/Marshall","Fire Chief":"Fire Chief","Fire Fighter/Supv.":"Fire Fighter/Supervisor","Gaming Ofcr/Invest":"Gaming Officer/Investigator","Highway Patrol Ofcr":"Highway Patrol Officer","Judge/Hearing Ofcr":"Judge/Hearing Officer","Legal Asst./Sec":"Legal Assistant/Secretary","Paralegal/Law Clerk":"Paralegal/Law Clerk","Police Chief":"Police Chief","Police Det/Investgr":"Police Detective/Investigator","Police Offcr/Supvr":"Police Officer/Supervisor","Process Server":"Process Server","Prvt Invest/Detec.":"Private Investigator/Detective","Security Guard":"Security Guard",Sheriff:"Sheriff","Bldg Maint Engineer":"Building Maintenance Engineer","Custodian/Janitor":"Custodian/Janitor",Electrician:"Electrician","Field Service Tech.":"Field Service Technician","Heat/AirCond Repair":"Heat/Air Conditioner Repairman","Housekeeper/Maid":"Housekeeper/Maid","Lndscpe/Grnds Maint":"Landscape/Grounds Maintenance","Maint Mechanic":"Maintenance Mechanic",Mechanic:"Mechanic","Factory Worker":"Factory Worker","Furniture Finisher":"Furniture Finisher",Jeweler:"Jeweler","Machine Operator":"Machine Operator",Packer:"Packer","Plant Manager":"Plant Manager","Printer/Bookbinder":"Printer/Bookbinder","Quality Control":"Quality Control","Refining Operator":"Refining Operator",Shoemaker:"Shoemaker","Tailor/Custom Sewer":"Tailor/Custom Sewer","Textile Worker":"Textile Worker",Upholsterer:"Upholsterer","Assist-Med/Dent/Vet":"Assistant - Medic/Dent/Vet",Clergy:"Clergy","Client Care Worker":"Client Care Worker","Dental Hygenist":"Dental Hygienist",Dentist:"Dentist",Doctor:"Doctor","Hospice Volunteer":"Hospice Volunteer",Mortician:"Mortician","Nurse - C.N.A.":"Nurse - C.N.A.","Nurse - LPN":"Nurse - LPN","Nurse - RN":"Nurse - RN","Nurse Practitioner":"Nurse Practitioner",Optometrist:"Optometrist","Paramedic/EM Tech":"Paramedic/E.M. Technician",Pharmacist:"Pharmacist","Social Worker":"Social Worker","Support Services":"Support Services",Therapist:"Therapist",Veterinarian:"Veterinarian",Caregiver:"Caregiver","Dry Cleaner/Laundry":"Dry Cleaner/Laundry","Hair Stylist/Barber":"Hair Stylist/Barber",Housekeeper:"Housekeeper",Manicurist:"Manicurist",Masseuse:"Masseuse",Nanny:"Nanny","Pet Services":"Pet Services",Baker:"Baker",Bartender:"Bartender",Bellhop:"Bellhop","Bus Person":"Bus Person",Caterer:"Caterer",Chef:"Chef",Concessionaire:"Concessionaire",Concierge:"Concierge","Cook-Rest/Cafeteria":"Cook - Restaurant/Cafeteria","Cook/Wrkr-Fast Food":"Cook/Worker-Fast Food","Delivery Person":"Delivery Person","Desk Clerk":"Desk Clerk",Dishwasher:"Dishwasher","Food Prod/Packing":"Food Production/Packing","Host/Maitre d":"Host/Maitre d",Manager:"Manager",Valet:"Valet","Waiter/Waitress":"Waiter/Waitress","Wine Steward":"Wine Steward",Retired:"Retired","Activity/Recre.Asst":"Activity/Recreational Assistant",Agent:"Agent",Athlete:"Athlete","CampCounselor/Lead":"Camp Counselor/Lead",Coach:"Coach","Director, Program":"Director, Program","Event Mgr/Promoter":"Event Manager/Promoter","Life Guard":"Life Guard","Mgr - Fitness Club":"Manager - Fitness Club","Sales-Tkt/Mmbrshp":"Sales-Ticket/Membership","SportsBrdcstr/Journ":"Sports Broadcaster/Journalist","Trainer/Instructor":"Trainer/Instructor","Umpire/Referee":"Umpire/Referee","Graduate Student":"Graduate Student","High school":"High school",Undergraduate:"Undergraduate","Air Traffic Control":"Air Traffic Control","Airport Ops Crew":"Airport Operations Crew","Bellhop/Porter":"Bellhop/Porter","Crane Loader/Oper":"Crane Loader/Operator","Driver-Bus/Strcar":"Driver - Bus/Streetcar","Driver-Taxi/Limo":"Driver-Taxi/Limo","Driver-Truck/Delvry":"Driver-Truck/Delivery","Flight Attendant":"Flight Attendant","Forklift Operator":"Forklift Operator",Laborer:"Laborer",Longshoreman:"Longshoreman","Mate/Sailor":"Mate/Sailor","Mgr Warehse/Dist":"Manager - Warehouse/District","Parking Lot Attend":"Parking Lot Attendant","Pilot/Capt/Eng":"Pilot/Captain/Engineer","Railroad Worker":"Railroad Worker","Shipping/RecClk":"Shipping/Receiving Clerk","Subway/LgtRail Oper":"Subway/Light Rail Operator","Ticket Agent":"Ticket Agent","Transportation Spec":"Transportation Specialist",Unemployed:"Unemployed"},u3=AF,E5=wF;function Sy(e,t){if(typeof e!="string")return e;const n=e.trim();if(!n)return e;if(t[n])return n;const i=n.toLowerCase();return Object.keys(t).find(s=>s.toLowerCase()===i||t[s]?.toLowerCase()===i)??e}function Dd(e){return Sy(e,_5)}function S5(e){return Sy(e,v5)}function D5(e){return Sy(e,E5)}function TF(e){return e.trim().toLowerCase()}function c3(e){if(typeof e!="string")return null;const t=e.match(/^(\d{4})-(\d{2})-(\d{2})$/);if(!t)return null;const n=Number(t[1]),i=Number(t[2]),o=Number(t[3]);if(!Number.isFinite(n)||!Number.isFinite(i)||!Number.isFinite(o)||i<1||i>12||o<1||o>31)return null;const s=new Date(Date.UTC(n,i-1,o));return s.getUTCFullYear()!==n||s.getUTCMonth()!==i-1||s.getUTCDate()!==o?null:s.getTime()}function Xo(e,t){if(!t.effectiveDateKey||!t.expirationDateKey)return!1;const n=c3(e[t.expirationDateKey]),i=c3(e[t.effectiveDateKey]);return n==null||i==null?!1:n<i}const NF=new Set(["HomePolicy","BundlePolicy"]);function Yc(e,t,n){return String(e.key??"")!=="lapse_in_coverage"||!n||!NF.has(n)?!0:t.home_prior_carrier_name!=="NoPriorInsurance"}function Dy(e){let t=null,n=null,i=null;const o=new Set,s=new Set,c=m=>{const h=String(m.key??""),y=TF(String(m.question??""));!t&&(h==="auto_prior_carrier_name"||h==="home_prior_carrier_name"||y.includes("current auto insurance company"))&&(t=h),!n&&(h==="effective_date"||y.includes("when do you need your insurance to begin"))&&(n=h),!i&&(h==="auto_prior_expiration_date"||h==="home_prior_expiration_date"||y.includes("when does the current policy expire"))&&(i=h),(h==="auto_reason_for_no_insurance"||y.includes("reason you are not currently insured")||y.includes("reason for lapse in coverage"))&&o.add(h),(h==="auto_prior_years"||h==="auto_prior_months"||h==="auto_continuous_coverage_years"||h==="auto_prior_expiration_date"||h==="auto_current_annual_premium_cents"||h==="auto_prior_liability_limit")&&s.add(h)};e.forEach(c);const d=m=>{m.forEach(h=>{(h.conditionals??[]).forEach(y=>{const g=y.conditionalQuestions??[];g.forEach(c),d(g)})})};return d(e),{currentCarrierKey:t,effectiveDateKey:n,expirationDateKey:i,noInsuranceReasonKeys:o,hideWhenNoPriorInsuranceKeys:s}}function xs(e,t){return t.currentCarrierKey==="home_prior_carrier_name"&&e.home_prior_carrier_name==="NoPriorInsurance"&&e.auto_prior_carrier_name!=="NoPriorInsurance"?!1:(t.currentCarrierKey?e[t.currentCarrierKey]:void 0)==="NoPriorInsurance"?!0:!t.effectiveDateKey||!t.expirationDateKey||t.expirationDateKey==="home_prior_expiration_date"&&Xo(e,t)?!1:Xo(e,t)}function qc(e,t,n){const i=String(e.key??"");if(n.noInsuranceReasonKeys.has(i)&&n.currentCarrierKey==="home_prior_carrier_name"&&t.home_prior_carrier_name==="NoPriorInsurance"&&t.auto_prior_carrier_name!=="NoPriorInsurance")return!1;const s=(n.currentCarrierKey?t[n.currentCarrierKey]:void 0)==="NoPriorInsurance";return s&&n.hideWhenNoPriorInsuranceKeys.has(i)?!1:!n.noInsuranceReasonKeys.has(i)||s?!0:xs(t,n)}function Kc(e,t){const n=String(e.key??"");return t.noInsuranceReasonKeys.has(n)}const d3=["ACURA","ALFA ROMEO","ASTON MARTIN","AUDI","BENTLEY","BMW","BUGATTI","BUICK","CADILLAC","CHEVROLET","CHRYSLER","CRUISE","DODGE","FERRARI","FIAT","FORD","FREIGHTLINER","GENESIS","GLOBAL ELECTRIC MOTORS","GMC","HONDA","HYUNDAI","INFINITI","JAGUAR","JEEP","KARMA AUTOMOTIVE","KIA","LAMBORGHINI","LAND ROVER","LEXUS","LINCOLN","LOTUS","MASERATI","MAZDA","MCLAREN AUTOMOTIVE","MERCEDES-BENZ","MINI","MITSUBISHI","NISSAN","POLESTAR","PORSCHE","RAM","ROLLS-ROYCE","SUBARU","TESLA","TOYOTA","VOLKSWAGEN","VOLVO"],$y="credify_quote_id",xy="credify_auth_token";function f3(e){try{localStorage.setItem($y,e)}catch(t){console.error("Failed to save quoteId to localStorage:",t)}}function rf(){try{return localStorage.getItem($y)}catch(e){return console.error("Failed to load quoteId from localStorage:",e),null}}function $5(){try{localStorage.removeItem($y)}catch(e){console.error("Failed to clear quoteId from localStorage:",e)}}function MF(e){try{localStorage.setItem(xy,e)}catch(t){console.error("Failed to save authToken to localStorage:",t)}}function RF(){try{return localStorage.getItem(xy)}catch(e){return console.error("Failed to load authToken from localStorage:",e),null}}function x5(){try{localStorage.removeItem(xy)}catch(e){console.error("Failed to clear authToken from localStorage:",e)}}function OF(){$5(),x5()}const kF="credify-insurance-widget",BF="1.0",C5=25,A5=64*1024,LF=`
121
- …[truncated]`;let m3=!1,p3=null,h3="",w5=C5,y0=A5,Cs=[];function PF(e){return typeof e=="string"?e:e instanceof URL?e.href:e.url}function IF(e,t){return t?.method?t.method.toUpperCase():typeof e!="string"&&!(e instanceof URL)&&e.method?e.method.toUpperCase():"GET"}function y3(e){if(!e)return[];const t=[];if(Array.isArray(e))for(const[n,i]of e)t.push({name:n,value:String(i)});else if(typeof e.forEach=="function")e.forEach((n,i)=>t.push({name:i,value:n}));else for(const[n,i]of Object.entries(e))t.push({name:n,value:String(i)});return t}function FF(e){try{const t=[];return new URL(e).searchParams.forEach((n,i)=>t.push({name:i,value:n})),t}catch{return[]}}function jF(e,t){const n=t?.body;return typeof n!="string"||n.length===0?void 0:{mimeType:e.find(o=>o.name.toLowerCase()==="content-type")?.value??"application/json",text:n}}function zF(e){const t=e.length;return t<=y0?{text:e,size:t}:{text:e.slice(0,y0)+LF,size:t}}function UF(e){Cs.push(e),Cs.length>w5&&Cs.shift()}function HF(e){if(m3)return!0;if(typeof window>"u"||typeof window.fetch!="function")return!1;h3=e.baseUrl,w5=e.maxEntries??C5,y0=e.maxBodyBytes??A5,p3=window.fetch.bind(window);const t=p3;return window.fetch=async(n,i)=>{let o;try{o=PF(n)}catch{return t(n,i)}if(!o.startsWith(h3))return t(n,i);const s=y3(i?.headers??(typeof n!="string"&&!(n instanceof URL)?n.headers:void 0)),c={startedDateTime:new Date().toISOString(),time:-1,request:{method:IF(n,i),url:o,httpVersion:"HTTP/1.1",headers:s,queryString:FF(o),cookies:[],headersSize:-1,bodySize:typeof i?.body=="string"?i.body.length:-1,postData:jF(s,i)},response:VF(),cache:{},timings:{send:0,wait:-1,receive:0}};UF(c);const d=typeof performance<"u"?performance.now():0;let m;try{m=await t(n,i)}catch(y){const g=(typeof performance<"u"?performance.now():0)-d;throw c.time=Math.round(g),c.timings.wait=Math.round(g),c.response._error=y instanceof Error?y.message:String(y),y}const h=(typeof performance<"u"?performance.now():0)-d;c.time=Math.round(h),c.timings.wait=Math.round(h),c.response.status=m.status,c.response.statusText=m.statusText,c.response.headers=y3(m.headers),c.response.content.mimeType=typeof m.headers?.get=="function"&&m.headers.get("content-type")||"";try{m.clone().text().then(g=>{const{text:E,size:S}=zF(g);c.response.content.text=E,c.response.content.size=S,c.response.bodySize=S}).catch(()=>{})}catch{}return m},m3=!0,!0}function VF(){return{status:0,statusText:"",httpVersion:"HTTP/1.1",headers:[],cookies:[],content:{size:0,mimeType:""},redirectURL:"",headersSize:-1,bodySize:-1}}function GF(){return{log:{version:"1.2",creator:{name:kF,version:BF},entries:Cs.map(e=>({...e}))}}}function ZF(){return Cs.length}const YF=[/ssn/i,/social.?security/i,/(driver.?licen[cs]e|^dln$|^dl$)/i,/(date.?of.?birth|^dob$)/i,/^vin$/i,/(sms.?code|^otp$|^code$|verification.?code)/i,/phone/i,/^email$/i,/(first.?name|last.?name|full.?name)/i,/(^address$|street|^zip$|postal)/i,/(jwt|^token$|authorization|^auth$|api.?key|secret|password|credential)/i,/cookie/i],qF=[/\b\d{3}-?\d{2}-?\d{4}\b/g,/\b[A-HJ-NPR-Z0-9]{17}\b/g,/eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g,/\bsk_[A-Za-z0-9]{16,}\b/g,/\bBearer\s+[A-Za-z0-9._-]+/gi],qa="[REDACTED]",KF=8;function af(e){for(const t of YF)if(t.test(e))return!0;return!1}function Ka(e){let t=e;for(const n of qF)t=t.replace(n,qa);return t}function Ua(e,t=0,n=new WeakSet){if(t>KF)return qa;if(e==null)return e;if(typeof e=="string")return Ka(e);if(typeof e!="object")return e;if(n.has(e))return qa;if(n.add(e),Array.isArray(e))return e.map(s=>Ua(s,t+1,n));const i=Object.getPrototypeOf(e);if(i!==null&&i!==Object.prototype)return e;const o={};for(const[s,c]of Object.entries(e)){if(af(s)){o[s]=qa;continue}o[s]=Ua(c,t+1,n)}return o}function g3(e){if(e.request&&(e.request.data!==void 0&&(e.request.data=Ua(e.request.data)),e.request.cookies!==void 0&&(e.request.cookies=qa),e.request.headers)){const t=e.request.headers;for(const n of Object.keys(t))af(n)&&(t[n]=qa)}if(e.extra&&(e.extra=Ua(e.extra)),e.contexts&&(e.contexts=Ua(e.contexts)),e.tags&&(e.tags=Ua(e.tags)),e.user){const{id:t,email:n,username:i}=e.user;e.user={...typeof t=="string"?{id:t}:{},...typeof n=="string"?{email:n}:{},...typeof i=="string"?{username:i}:{}}}if(Array.isArray(e.breadcrumbs))for(const t of e.breadcrumbs)t.data!==void 0&&(t.data=Ua(t.data)),typeof t.message=="string"&&(t.message=Ka(t.message));return typeof e.message=="string"&&(e.message=Ka(e.message)),e}function b3(e){for(const t of e)t.value=af(t.name)?qa:Ka(t.value)}function v3(e){try{return JSON.stringify(Ua(JSON.parse(e)))}catch{return Ka(e)}}function WF(e){const t=JSON.parse(JSON.stringify(e));for(const n of t.log.entries){b3(n.request.headers),b3(n.response.headers);for(const i of n.request.queryString)i.value=af(i.name)?qa:Ka(i.value);n.request.postData?.text&&(n.request.postData.text=v3(n.request.postData.text)),n.response.content.text&&(n.response.content.text=v3(n.response.content.text)),n.request.url=Ka(n.request.url),n.response._error&&(n.response._error=Ka(n.response._error))}return t}function Uo(e,t={}){try{M0(n=>{n.setTag("failure_type","quote"),t.stage&&n.setTag("stage",t.stage),t.quoteId&&n.setTag("quote_id",t.quoteId),t.phase&&n.setTag("phase",t.phase),t.endpoint&&n.setTag("endpoint",t.endpoint),typeof t.statusCode=="number"&&n.setTag("status_code",String(t.statusCode));try{ZF()>0&&n.addAttachment({filename:"quote-failure.har",data:JSON.stringify(WF(GF())),contentType:"application/json"})}catch{}const i=e instanceof Error?e:new Error(t.message??"Quote failed");Ld(i)})}catch{}}const Rt="https://api.getcredify.com";let sl=null;const QF=6e4,_3=new Map;function JF(e){try{return new URL(e).pathname}catch{return e}}function E3(e,t,n){if(!(n>=500&&n<600)&&!(n===0))return;e.__sentryReported=!0;const s=JF(t),c=`${s}:${n}`,d=Date.now(),m=_3.get(c);m&&d-m<QF||(_3.set(c,d),Uo(e,{phase:"api_request",endpoint:s,statusCode:n}))}function Wc(e){sl=e,MF(e)}function Jr(){return sl}function Qc(){const e=RF();e&&(sl=e)}function T5(){sl=null,x5()}async function qt(e,t){const n={"Content-Type":"application/json"};sl&&(n.Authorization=`Bearer ${sl}`);let i;try{i=await fetch(e,{method:"POST",headers:n,body:JSON.stringify(t)})}catch(o){const s=o instanceof Error?o:new Error(String(o));throw E3(s,e,0),o}if(!i.ok){let o=`Request failed with status ${i.status}`;try{o=(await i.json()).error||o}catch{o=i.statusText||o}const s=new Error(o);throw s.statusCode=i.status,E3(s,e,i.status),s}return i}async function Qs(e){try{return await e.json()}catch{return{}}}async function XF(e,t){const n=t?{stage:e,quoteId:t}:{stage:e};return await(await qt(`${Rt}/get-questions-by-stage`,n)).json()}async function Bc(e){const t=e?{quoteId:e}:{};return await(await qt(`${Rt}/get-stages-for-quote`,t)).json()}async function ej(e,t=!1){const n=t?{postal_code:e,is_test:!0}:{postal_code:e},o=await(await qt(`${Rt}/create-quote`,n)).json();if(!o||typeof o!="object"||!o.quoteId)throw new Error(`Invalid createQuote response: ${JSON.stringify(o)}`);return o}async function N5(e,t){return await(await qt(`${Rt}/verify-quote`,{action:"send",quoteId:e,phone:t})).json()}async function La(e,t,n){const i={payload:e,getRates:t};n&&typeof n=="string"&&n.trim()!==""&&(i.quoteId=n);const o=await qt(`${Rt}/update-quote`,i),s=await Qs(o);return!s||typeof s!="object"||!("status"in s)||s.status==null?{status:"success"}:s}async function g0(e,t){return await(await qt(`${Rt}/verify-quote`,{quoteId:e,smsCode:t})).json()}async function tj(e){return await(await qt(`${Rt}/verify-quote`,{action:"resume",resumeToken:e})).json()}async function M5(e,t){const n={state:e};return t&&typeof t=="string"&&t.trim()!==""&&(n.quoteId=t),await(await qt(`${Rt}/is-supported-state`,n)).json()}async function lh(e){const t=e?{quoteId:e}:{};return await(await qt(`${Rt}/get-rates`,t)).json()}async function S3(e){const t=e?{quoteId:e}:{};return await(await qt(`${Rt}/get-quote`,t)).json()}async function R5(e){return(await qt(`${Rt}/get-vehicle-options`,e)).json()}async function nj(e){return(await qt(`${Rt}/get-vehicle-options`,{...e,action:"vinDecode"})).json()}async function rj(e){const t=await qt(`${Rt}/get-vehicle-options`,{quoteId:e,action:"vehiclePrefillSuggestions"}),n=await Qs(t);return{suggestions:Array.isArray(n.suggestions)?n.suggestions:[]}}async function aj(e,t){const n=await qt(`${Rt}/get-vehicle-options`,{quoteId:e,action:"applyVehiclePrefill",selectedIds:t}),i=await Qs(n);return{items:Array.isArray(i.items)?i.items:[]}}async function ij(e){await qt(`${Rt}/get-vehicle-options`,{quoteId:e,action:"dismissVehiclePrefill"})}async function oj(e){const t=await qt(`${Rt}/get-vehicle-options`,{quoteId:e,action:"driverPrefillSuggestions"}),n=await Qs(t);return{suggestions:Array.isArray(n.suggestions)?n.suggestions:[]}}async function lj(e,t){const n=await qt(`${Rt}/get-vehicle-options`,{quoteId:e,action:"applyDriverPrefill",selectedIds:t}),i=await Qs(n);return{items:Array.isArray(i.items)?i.items:[]}}async function sj(e){await qt(`${Rt}/get-vehicle-options`,{quoteId:e,action:"dismissDriverPrefill"})}async function uj(e,t){const i=await(await qt(`${Rt}/request-bind`,{quoteRateId:e,privacyNoticeAcknowledged:t})).json();return i&&typeof i=="object"&&"success"in i?i:{success:!0}}const sh=new Set(["auto_prior_years","auto_prior_months","auto_continuous_coverage_years"]);function b0(e){return Sd(String(e??"")).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()}function cj(e){const t=b0(e??"unknown-stage");return["form-area",`form-area--${t}`,`formArea-${t}`].join(" ")}function uh(e,t,n){const i=b0(t??"unknown-stage"),o=b0(e);return["form-section","form-question",`form-section--${o}`,`form-question--${o}`,`formQuestion-${i}_${o}`,n&&n.length>0?"form-question--scoped":null].filter(Boolean).join(" ")}const dj={None:"None","30000/60000/25000":"30/60k","30000/60000/30000":"30/60k","50000/100000/30000":"50/100k","50000/100000/50000":"50/100k","100000/300000/50000":"100/300k","100000/300000/100000":"100/300k","250000/500000/100000":"250/500k","250000/500000/250000":"250/500k","300000/500000/250000":"300/500k","300000/500000/300000":"300/500k","500000/500000/300000":"500k CSL","500000/500000/500000":"500k CSL","500000/1000000/300000":"500k/1M","500000/1000000/500000":"500k/1M"},D3={auto_prior_carrier_name:BI,auto_prior_liability_limit:FI,auto_reason_for_no_insurance:jI,residence_type:LI,home_prior_carrier_name:PI,policy_bi:zI,policy_um:UI,policy_pd:HI,policy_mp:VI,policy_umpd:GI,policy_pip:ZI,policy_auto_death_indemnity:YI,vehicle_comp_deductible:p0,vehicle_coll_deductible:p0,vehicle_towing_and_labor:h0,vehicle_transportation_expense:b5,education_level:v5,industry:_5,occupation:E5,usage:II,architectural_style:XI,dwelling_type:eF,occupancy_type:tF,construction_quality:nF,construction_type:rF,foundation_type:aF,located_over_water:iF,number_of_stories:oF,exterior_wall_type:lF,roof_material_type:sF,roof_shape:uF,roof_updated_type:cF,heating_type:dF,oil_tank_location:fF,basement_type:mF,plumbing_type:pF,personal_liability:hF,dwelling_medical_payments:yF,all_perils_deductible:gF,windstorm_deductible:bF,distance_from_fire_hydrant_ft:vF,distance_from_fire_station_miles:_F,employment_industry:o3,marital_status:l3,gender:s3,co_applicant_employment_industry:o3,co_applicant_marital_status:l3,co_applicant_gender:s3,description:EF,tort_threshold:SF,pip_coverage_type:DF,extended_medical:$F,additional_pip:xF,policy_pip_deductible:CF},$3=["OTHER / NOT LISTED"],x3=["SEDAN","SUV","COUPE","HATCHBACK","PICKUP","VAN","WAGON","OTHER"],fj=["Other"];function jn(e){const t=e.getUTCFullYear(),n=String(e.getUTCMonth()+1).padStart(2,"0"),i=String(e.getUTCDate()).padStart(2,"0");return`${t}-${n}-${i}`}function C3(e){const t=e.replace(/\D+/g,"");if(t!=="")return kI(t)}function mj(e){return e==="-"||e==="+"||e==="."||e==="e"||e==="E"}const pj={year_built:4,year_roof_updated:4,heating_update_year:4,plumbing_update_year:4,electrical_update_year:4,total_area_sq_ft:6,sale_price_cents:9,dwelling_replacement_cost:9,other_structures_coverage:9,personal_property_coverage:7,amount_paid_cents:7,loss_of_use_coverage:8,home_prior_years:2,home_continuous_coverage_years:2,number_of_dogs:2,number_of_units:2,months_at_address:2,years_at_address:3,years_at_prior_address:3,distance_to_coast_miles:4,household_size:1,number_of_families:1,number_of_mortgagees:1,annual_mileage:6,miles_to_work:4,custom_equipment_value_cents:7,cost_new_value_cents:7,stated_value_amount_cents:7,property_damage_amount_paid_cents:7,personal_injury_amount_paid_cents:7,auto_current_annual_premium_cents:7,auto_prior_years:2,auto_prior_months:2,auto_continuous_coverage_years:2},A3=new Set(["sale_price_cents","dwelling_replacement_cost","other_structures_coverage","personal_property_coverage","loss_of_use_coverage","custom_equipment_value_cents","cost_new_value_cents","stated_value_amount_cents","property_damage_amount_paid_cents","personal_injury_amount_paid_cents","auto_current_annual_premium_cents","amount_paid_cents"]),hj=new Set(["total_area_sq_ft","annual_mileage","miles_to_work","distance_to_coast_miles"]),Lc={first_name:"given-name",last_name:"family-name",co_applicant_first_name:"given-name",co_applicant_last_name:"family-name",date_of_birth:"bday",co_applicant_date_of_birth:"bday",sms_code:"one-time-code",vin:"off",license_number:"off",effective_date:"off"},yj={license_number:20};function gj(e){const t=new Date,n=new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()));if(e==="effective_date"){const i=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth()+3,n.getUTCDate()));return{min:jn(n),max:jn(i)}}if(e==="home_prior_expiration_date"){const i=new Date(Date.UTC(n.getUTCFullYear()-1,n.getUTCMonth(),n.getUTCDate())),o=new Date(Date.UTC(n.getUTCFullYear()+1,n.getUTCMonth(),n.getUTCDate()));return{min:jn(i),max:jn(o)}}if(e==="date_of_incident")return{max:jn(n)};if(e==="move_in_date")return{max:jn(n)};if(e==="purchase_date")return{max:jn(n)};if(e==="date_of_birth")return{max:jn(n)};if(e==="date_first_licensed")return{max:jn(n)};if(e==="occurred_at")return{max:jn(n)};if(e==="accident_prevention_course_date")return{max:jn(n)};if(e==="auto_prior_expiration_date"){const i=new Date(Date.UTC(n.getUTCFullYear()-1,n.getUTCMonth(),n.getUTCDate())),o=new Date(Date.UTC(n.getUTCFullYear()+1,n.getUTCMonth(),n.getUTCDate()));return{min:jn(i),max:jn(o)}}return{}}const bj=new Set(["Disabled","Retired","Unemployed","Other"]);function ch(e,t,n){const i=String(e.key??"");if(i!=="occupation"&&i!=="co_applicant_occupation"||i==="co_applicant_occupation")return!0;const o=rn(t,n,"industry"),s=rn(t,n,"employment_industry"),c=String(o??s??"").trim();return!bj.has(c)}function dh(e,t,n,i){return nf(e,i,n)}function Jc(e){return e.inputType!=="radio"||!e.options||e.options.length!==1||e.options[0]!=="Yes"?!1:(e.conditionals??[]).some(n=>n.conditionalQuestionsAllowMultiple&&n.conditionalType==="equals"&&n.conditionalValue==="Yes")}function w3(e,t){return Jc(e)?"Yes":t}function T3(e){return typeof e=="number"&&Number.isFinite(e)?e:typeof e=="string"&&e.trim()!==""&&!Number.isNaN(Number(e))?Number(e):null}function N3(e){if(e instanceof Date&&!Number.isNaN(e.getTime()))return e.getTime();if(typeof e=="string"){const t=Date.parse(e);return Number.isNaN(t)?null:t}return null}function M3(e,t){const n=T3(e),i=T3(t);if(n!=null&&i!=null)return n-i;const o=N3(e),s=N3(t);return o!=null&&s!=null?o-s:e==null||t==null?null:String(e).localeCompare(String(t))}function vj(e,t){return Array.isArray(e)?e.some(n=>n===t):typeof e=="string"?t!=null&&e.includes(String(t)):!1}function ms(e,t,n){switch(t){case"equals":return e===n;case"notEquals":return e!==n&&e!==""&&e!=null;case"lessThan":{const i=M3(e,n);return i!=null&&i<0}case"greaterThan":{const i=M3(e,n);return i!=null&&i>0}case"contains":return vj(e,n);case"startsWith":return e!=null&&n!=null&&String(e).startsWith(String(n));case"endsWith":return e!=null&&n!=null&&String(e).endsWith(String(n));default:return!1}}function Es(e,t){return t.reduce((n,i)=>n?.[i],e)}function tr(e,t,n){if(t.length===0)return e;const[i,...o]=t;if(o.length===0){if(typeof i=="number"){const h=(Array.isArray(e)?e:[]).slice();return h[i]=n,h}return{...e,[i]:n}}const s=e?.[i],c=typeof o[0]=="number"?Array.isArray(s)?s:[]:s&&typeof s=="object"?s:{},d=tr(c,o,n);if(typeof i=="number"){const h=(Array.isArray(e)?e:[]).slice();return h[i]=d,h}return{...e,[i]:d}}function rn(e,t,n){return Es(e,[...t??[],n])}function ln(e,t,n,i){return tr(e,[...t??[],n],i)}function _j(e,t){return e?.length?`${e.join("-")}-${t}`:t}const Ej="__items",Pc=e=>`${e}${Ej}`;function Dn(e){return e==null?"":typeof e=="string"?e:String(e)}function R3(e){return e==null?"":typeof e=="number"&&Number.isFinite(e)||typeof e=="string"?e:""}function Sj(e){return e==null?"":typeof e=="string"||typeof e=="number"?e:String(e)}function O5({questions:e,initialValues:t,controlledValues:n,onChangeValues:i,onSubmit:o,quoteId:s,widgetStageKey:c,validationAttempt:d=0,invalidValueKeys:m,fetchVehicleOptions:h}){const y=b.useMemo(()=>h??(z=>R5({quoteId:s,...z})),[h,s]),g=b.useMemo(()=>py(e),[e]),E=b.useMemo(()=>Dy(g),[g]),S=b.useMemo(()=>c==="BundlePolicy"?!0:g.some(z=>String(z.key)==="home_prior_carrier_name")&&g.some(z=>String(z.key)==="driver_vehicle_assignments"),[c,g]),D=b.useMemo(()=>{const z={};return t&&Object.assign(z,t),z},[t]),[x,w]=b.useState(D);b.useEffect(()=>{w(D)},[D]);const[R,I]=b.useState({}),A=b.useMemo(()=>({...R,...n??x}),[R,n,x]);b.useEffect(()=>{n&&I(z=>({...z,...n}))},[n]);const[L,M]=b.useState({}),Z=b.useRef(new Map),V=b.useRef(new Set),[,fe]=b.useState({}),[ne,pe]=b.useState({}),J=b.useRef(!1);b.useEffect(()=>{!s||J.current||!g.some(T=>T.key==="year"||T.key==="make"||T.key==="model"||T.key==="body_style")||(J.current=!0,y({}).catch(()=>{}))},[s,g,y]);const[ye,Ae]=b.useState({}),[j,de]=b.useState({}),k=b.useCallback(async(z,T)=>{if(!s||!i3(T))return;const N=z?z.join("-"):"_root";Ae(ie=>({...ie,[N]:!0})),de(ie=>({...ie,[N]:null}));try{const ie=await nj({quoteId:s,vin:T});if(ie.error){de(Se=>({...Se,[N]:ie.error}));return}let ge=A;ie.year&&(ge=ln(ge,z,"year",String(ie.year))),ie.make&&(ge=ln(ge,z,"make",ie.make)),ie.model&&(ge=ln(ge,z,"model",ie.model)),ie.bodyStyle&&(ge=ln(ge,z,"body_style",ie.bodyStyle)),n&&i?i(ge):w(ge),I(ge),Z.current.clear(),V.current.clear(),fe({})}catch{de(ie=>({...ie,[N]:"VIN lookup failed — please enter vehicle details manually"}))}finally{Ae(ie=>({...ie,[N]:!1}))}},[s,A,n,i]),B=b.useCallback(z=>{const T=`${z.year}|${z.make??""}|${z.model??""}`,N=z.model?"bodyStyles":z.make?"models":"makes",ie=Z.current.get(T);return ie?ie[N]??[]:void 0},[]),X=b.useCallback((z,T)=>{if(!s)return;const N=`${T.year}|${T.make??""}|${T.model??""}`,ie=T.model?"bodyStyles":T.make?"models":"makes",ge=`${z}:${ie}`;Z.current.has(N)||V.current.has(N)||(V.current.add(N),pe(Se=>({...Se,[ge]:!0})),y(T).then(Se=>{Z.current.set(N,Se),fe(he=>({...he,[ge]:Se[ie]??[]}))}).catch(()=>{Z.current.set(N,{}),fe(Se=>({...Se,[ge]:[]}))}).finally(()=>{V.current.delete(N),pe(Se=>({...Se,[ge]:!1}))}))},[s,y]);function F(z,T,N){const ie=A,ge=z?Es(A,z)??{}:ie;return z?{state:ie.state,...ge,[T]:N}:{...ge,[T]:N}}function G(z,T){const N=g5.filter(ge=>ge.targetKey===z||ge.dependsOn.includes(z)),ie={[z]:void 0};for(const ge of N){const Se=ge.validate(T);ge.targetKey in ie?Se!==void 0&&(ie[ge.targetKey]=Se):ie[ge.targetKey]=Se}M(ge=>({...ge,...ie}))}const C=(z,T,N)=>{const ie=rn(A,N,z);if(Cr(ie,T)){L[z]&&M(Se=>({...Se,[z]:void 0}));return}const ge=m0(z,ie);if(ge){M(Se=>({...Se,[z]:ge}));return}G(z,F(N,z,ie))};b.useEffect(()=>{let z=A,T=!1;g.forEach(N=>{if(!Jc(N))return;const ie=String(N.key);rn(z,void 0,ie)!=="Yes"&&(z=ln(z,void 0,ie,"Yes"),T=!0)}),T&&(n&&i?i(z):w(z),I(z))},[g,A,n,i]);function U(z,T){const N=z.key;if((N==="relationship_to_insured"||N==="is_registered_owner")&&T){const me=T[T.length-1];if(typeof me=="number"&&me===0)return null}if((N==="purchase_date"||N==="cost_new_value_cents")&&T)return null;if(N==="custom_equipment_value_cents"&&T){const me=rn(A,T,"vehicle_has_modifications");if(me!=="Yes"&&me!==!0)return null}const ie=N==="auto_reason_for_no_insurance"&&E.currentCarrierKey?A[E.currentCarrierKey]==="NoPriorInsurance"?"Reason you are not currently insured":"Reason for lapse in coverage":z.question,ge=z.hint,Se=rn(A,T,N),he=Kc(z,E)?xs(A,E):N==="social_security_number"&&Ed(A.state??A.State)?!0:z.required,we=L[N],Ie=me=>{let De=ln(A,T,N,me);if(z.inputType==="radio"&&z.conditionals){const se=z.conditionals??[];for(const _e of se){const be=rn(A,T,N),xe=ms(be,_e.conditionalType,_e.conditionalValue),$e=ms(me,_e.conditionalType,_e.conditionalValue);if(xe&&!$e&&_e.conditionalQuestionsAllowMultiple){const Me=_e.conditionalQuestions??[];if(Me.length>0){const re=Pc(N);De=tr(De,[...T??[],re],[]);const oe=(Ce,Ee)=>{Ce.forEach(Te=>{(Te.conditionals??[]).forEach(ke=>{if(ke.conditionalQuestionsAllowMultiple){const Ue=Pc(Te.key);De=tr(De,[...Ee,Ue],[])}const qe=ke.conditionalQuestions??[];qe.length>0&&oe(qe,Ee)})})};oe(Me,[...T??[],re])}}}}n&&i?i(De):w(De),I(De)};if(N==="vehicle_policy_selections"){const me=A.vehicles__items??[],De=A.drivers__items??[];if(me.length===0)return v.jsx("p",{style:{color:"#666",fontStyle:"italic"},children:"Add vehicles first to configure coverage selections."},N);const se=A.driver_vehicle_assignments??{},_e=De.length>1,be=Ue=>Object.entries(Ue).map(([ze,tt])=>({value:ze,label:tt})),xe=Ed(A.state??A.State),$e=(Ue,ze)=>Object.fromEntries(Ue.filter(tt=>tt in ze).map(tt=>[tt,ze[tt]])),re=be($e(xe?qI:KI,p0)),oe=xe?$e(WI,h0):h0,Ce=be(oe),Te=be($e(xe?QI:JI,b5)),Re=(Ue,ze,tt)=>{const rt=tr(A,["vehicles__items",Ue,ze],tt);n&&i?i(rt):w(rt),I(rt)},ke=(Ue,ze,tt)=>{const rt={...se},Tt=`v${Ue}`;rt[Tt]={...rt[Tt]??{}},rt[Tt][`d${ze}`]=tt;const Ye=tr(A,["driver_vehicle_assignments"],rt);n&&i?i(Ye):w(Ye),I(Ye)},qe=Ue=>{if(!_e)return null;const ze=se[`v${Ue}`];if(!ze)return null;const tt=De.map((Ye,Hn)=>ze[`d${Hn}`]??0),rt=tt.filter(Ye=>Ye>0);if(rt.length>=2&&rt.every(Ye=>Ye===rt[0])&&rt[0]===50)return`Assignments for Vehicle ${Ue+1} cannot be 50 percent for both Drivers.`;const Tt=tt.reduce((Ye,Hn)=>Ye+Hn,0);return Tt>0&&Tt!==100?`Driver percentages for this vehicle must add up to 100% (currently ${Tt}%).`:null};return v.jsx("div",{children:me.map((Ue,ze)=>{const tt=[Ue.year,Ue.make,Ue.model].filter(Boolean).join(" ")||`Vehicle ${ze+1}`,rt=qe(ze),Tt=Ye=>typeof Ue[Ye]=="string"?Ue[Ye]:"";return v.jsxs("fieldset",{style:{border:`1px solid ${rt?"#dc3545":"#ddd"}`,borderRadius:"8px",padding:"16px",marginBottom:"16px"},children:[v.jsx("legend",{style:{fontWeight:600,padding:"0 8px"},children:tt}),v.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:"12px"},children:[v.jsx(ds,{id:`veh-${ze}-comp`,label:"Comprehensive deductible",required:!0,placeholder:"Select...",options:re,value:Tt("vehicle_comp_deductible"),onChange:Ye=>Re(ze,"vehicle_comp_deductible",Ye.currentTarget.value)}),v.jsx(ds,{id:`veh-${ze}-coll`,label:"Collision deductible",required:!0,placeholder:"Select...",options:re,value:Tt("vehicle_coll_deductible"),onChange:Ye=>Re(ze,"vehicle_coll_deductible",Ye.currentTarget.value)}),v.jsx(ds,{id:`veh-${ze}-tow`,label:"Towing and Labor",required:!0,placeholder:"Select...",options:Ce,value:Tt("vehicle_towing_and_labor"),onChange:Ye=>Re(ze,"vehicle_towing_and_labor",Ye.currentTarget.value)}),v.jsx(ds,{id:`veh-${ze}-trans`,label:"Transportation expense",required:!0,placeholder:"Select...",options:Te,value:Tt("vehicle_transportation_expense"),onChange:Ye=>Re(ze,"vehicle_transportation_expense",Ye.currentTarget.value)})]}),_e&&v.jsxs("div",{style:{marginTop:"16px"},children:[v.jsx("p",{style:{fontWeight:600,margin:"0 0 8px"},children:"Drivers usage (%)"}),v.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"12px"},children:De.map((Ye,Hn)=>{const ml=[Ye.first_name,Ye.last_name].filter(Boolean).join(" ")||`Driver ${Hn+1}`,Nn=se[`v${ze}`]?.[`d${Hn}`];return v.jsx("div",{style:{flex:"0 0 140px"},children:v.jsx(Tp,{id:`assignment-v${ze}-d${Hn}`,label:`${ml} %`,value:Nn??"",min:0,max:100,step:1,inputMode:"numeric",onChange:gr=>{const Mn=gr.currentTarget.value.replace(/\D+/g,"");ke(ze,Hn,Mn===""?0:Math.min(100,parseInt(Mn,10)))}})},`${ze}-${Hn}`)})}),rt&&v.jsx("p",{style:{color:"#dc3545",fontSize:"0.85rem",marginTop:"8px",marginBottom:0},children:rt})]})]},ze)})},N)}if(N==="driver_vehicle_assignments"){const me=A.vehicles__items??[],De=A.drivers__items??[];if(S&&De.length<=1)return null;if(me.length===0||De.length===0)return v.jsx("p",{style:{color:"#666",fontStyle:"italic"},children:"Add vehicles and drivers first to configure driver usage percentages."},N);const se=A.driver_vehicle_assignments??{},_e=(xe,$e,Me)=>{const re={...se},oe=`v${xe}`;re[oe]={...re[oe]??{}},re[oe][`d${$e}`]=Me,Ie(re)},be=xe=>{if(De.length<2)return null;const $e=se[`v${xe}`];if(!$e)return null;const Me=De.map((Ce,Ee)=>$e[`d${Ee}`]??0),re=Me.filter(Ce=>Ce>0);if(re.length>=2&&re.every(Ce=>Ce===re[0])&&re[0]===50)return`Assignments for Vehicle ${xe+1} cannot be 50 percent for both Drivers.`;const oe=Me.reduce((Ce,Ee)=>Ce+Ee,0);return oe>0&&oe!==100?`Driver percentages for this vehicle must add up to 100% (currently ${oe}%).`:null};return v.jsxs("div",{children:[v.jsx("h4",{style:{marginBottom:"12px"},children:ie}),me.map((xe,$e)=>{const Me=[xe.year,xe.make,xe.model].filter(Boolean).join(" ")||`Vehicle ${$e+1}`,re=be($e);return v.jsxs("fieldset",{style:{border:`1px solid ${re?"#dc3545":"#ddd"}`,borderRadius:"8px",padding:"16px",marginBottom:"16px"},children:[v.jsx("legend",{style:{fontWeight:600,padding:"0 8px"},children:Me}),v.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"12px"},children:De.map((oe,Ce)=>{const Ee=[oe.first_name,oe.last_name].filter(Boolean).join(" ")||`Driver ${Ce+1}`,Te=se[`v${$e}`]?.[`d${Ce}`];return v.jsx("div",{style:{flex:"0 0 140px"},children:v.jsx(Tp,{id:`assignment-v${$e}-d${Ce}`,label:`${Ee} %`,value:Te??"",min:0,max:100,step:1,inputMode:"numeric",onChange:Re=>{const ke=Re.currentTarget.value.replace(/\D+/g,"");_e($e,Ce,ke===""?0:Math.min(100,parseInt(ke,10)))}})},`${$e}-${Ce}`)})}),re&&v.jsx("p",{style:{color:"#dc3545",fontSize:"0.85rem",marginTop:"8px",marginBottom:0},children:re})]},$e)})]},N)}switch(z.inputType){case"text":{if(N==="vin"&&s){const me=T?T.join("-"):"_root",De=ye[me]??!1,se=j[me]??null,_e=[ge?`${N}-hint`:null,we?`${N}-error`:null,se?`${N}-vin-error`:null].filter(Boolean).join(" ");return v.jsxs("div",{children:[v.jsx(Un,{id:N,label:ie,hint:ge,error:we,required:he,children:v.jsxs("div",{className:"flex items-end gap-2",children:[v.jsx("div",{className:"flex-1 min-w-0",children:v.jsx("input",{id:N,className:`form-input ${we?"input-error":""}`,"aria-invalid":!!we,"aria-describedby":_e||void 0,"aria-required":he||void 0,required:he,value:Dn(Se),maxLength:17,onChange:be=>Ie(be.currentTarget.value),onBlur:()=>C(N,"text",T),autoComplete:Lc[N],type:"text"})}),v.jsx("button",{type:"button",disabled:De||!i3(Dn(Se)),className:"btn btn-outline shrink-0 self-end !w-auto min-w-[8.5rem] px-4 whitespace-nowrap disabled:opacity-50",onClick:()=>k(T,Dn(Se)),children:De?"Looking up...":"Verify VIN"})]})}),se&&v.jsx("p",{id:`${N}-vin-error`,className:"text-sm text-red-600 mt-1",children:se})]},N)}if(N==="sms_code"){const me=Dn(Se);return v.jsx(jc,{id:N,label:ie,hint:ge,value:me,inputMode:"numeric",pattern:"[0-9]*",maxLength:6,onChange:De=>{const se=De.currentTarget.value.replace(/\D+/g,"").slice(0,6);Ie(se)},onBlur:()=>C(N,"text",T),"aria-required":he||void 0,error:we,autoComplete:Lc[N]},N)}if(N==="license_number")return v.jsx(jc,{id:N,label:ie,hint:ge,value:Dn(Se),onChange:me=>Ie(me.currentTarget.value.replace(/[^A-Z0-9]/gi,"").slice(0,20)),onBlur:()=>C(N,"text",T),"aria-required":he||void 0,error:we,autoComplete:"off",maxLength:20},N);if(N==="social_security_number"){const me=rn(A,T,"ssn_display"),De=typeof me=="string"?me:"",se=De?`${De}. Re-enter to update.${ge?` ${ge}`:""}`:ge;return v.jsx(Y7,{id:N,label:ie,hint:se,value:Dn(Se),onChange:_e=>Ie(_e.currentTarget.value),onBlur:()=>C(N,"text",T),"aria-required":he||void 0,error:we},N)}return v.jsx(jc,{id:N,label:ie,hint:ge,value:Dn(Se),onChange:me=>Ie(me.currentTarget.value),onBlur:()=>C(N,"text",T),"aria-required":he||void 0,error:we,autoComplete:Lc[N],maxLength:yj[N]},N)}case"email":return v.jsx(q7,{id:N,label:ie,value:Dn(Se),onChange:me=>Ie(me.currentTarget.value),onBlur:()=>C(N,"email",T),"aria-required":he||void 0,error:we},N);case"password":return v.jsx(W7,{id:N,label:ie,value:Dn(Se),onChange:me=>Ie(me.currentTarget.value),onBlur:()=>C(N,"password",T),"aria-required":he||void 0,error:we},N);case"tel":return v.jsxs(v.Fragment,{children:[v.jsx(zE,{id:N,label:ie,value:Dn(Se),onChange:me=>Ie(me.currentTarget.value),onBlur:()=>C(N,"tel",T),"aria-required":he||void 0,error:we},N),N==="phone"&&v.jsxs("div",{className:"mt-3 text-xs text-slate-600 space-y-1",children:[v.jsx("p",{children:"Enter your mobile number to continue to your quotes. If you choose to pursue a quote, you'll verify this number with a 6-digit text — we won't text you now."}),v.jsx("p",{children:"Message & data rates may apply. One message per request."}),v.jsxs("p",{children:["See our"," ",v.jsx("a",{href:"https://getcredify.com/privacy-policy",target:"_blank",rel:"noopener noreferrer",className:"credify-link-underline",children:"Privacy Policy"})," ","and"," ",v.jsx("a",{href:"https://getcredify.com/terms-of-service",target:"_blank",rel:"noopener noreferrer",className:"credify-link-underline",children:"Terms of Service"}),"."]})]})]});case"url":return v.jsx(K7,{id:N,label:ie,value:Dn(Se),onChange:me=>Ie(me.currentTarget.value),onBlur:()=>C(N,"url",T),"aria-required":he||void 0,error:we},N);case"number":{const me=pj[N];return A3.has(N)||hj.has(N)?v.jsx(Z7,{id:N,label:ie,hint:ge,value:R3(Se),isCurrency:A3.has(N),maxDigits:me,onChange:De=>Ie(C3(De.currentTarget.value)),onBlur:()=>C(N,"number",T),"aria-required":he||void 0,error:we},N):v.jsx(Tp,{id:N,label:ie,hint:ge,value:R3(Se),inputMode:"numeric",pattern:"[0-9]*",onKeyDown:De=>{if(mj(De.key)){De.preventDefault();return}me!==void 0&&/^\d$/.test(De.key)&&String(De.currentTarget.value).replace(/\D/g,"").length>=me&&De.preventDefault()},onChange:De=>{let se=De.currentTarget.value;me!==void 0&&(se=se.slice(0,me)),Ie(C3(se))},onBlur:()=>C(N,"number",T),"aria-required":he||void 0,error:we},N)}case"textarea":return v.jsx(Q7,{id:N,label:ie,value:Dn(Se),onChange:me=>Ie(me.currentTarget.value),onBlur:()=>C(N,"textarea",T),"aria-required":he||void 0,error:we,rows:4},N);case"date":{const{min:me,max:De}=gj(N);return v.jsx(OO,{id:N,label:ie,hint:ge,value:Dn(Se),min:me,max:De,onChange:se=>{const _e=se.currentTarget.value;Ie(_e),!Cr(_e,"date")&&!m0(N,_e)&&G(N,F(T,N,_e))},onBlur:()=>C(N,"date",T),"aria-required":he||void 0,error:we,autoComplete:Lc[N]},N)}case"checkbox":{if(z.options){const me=Array.isArray(Se)?Se:[],De=`${N}-error`;return v.jsxs("fieldset",{className:"space-y-2","aria-describedby":we?De:void 0,children:[v.jsxs("legend",{className:"form-label",children:[ie,he&&v.jsxs(v.Fragment,{children:[v.jsx("span",{className:"text-red-600 ml-1","aria-hidden":"true",children:"*"}),v.jsx("span",{className:"sr-only",children:" required"})]})]}),v.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:z.options.map(se=>{const _e=`${N}-${Sd(se)}`,be=me.includes(se);return v.jsx(ji,{id:_e,label:se,checked:be,onChange:xe=>{const $e=new Set(me);xe.currentTarget.checked?$e.add(se):$e.delete(se),Ie(Array.from($e))},"aria-required":he||void 0,"aria-describedby":we?De:void 0},_e)})}),we&&v.jsx("p",{id:De,className:"mt-1 text-sm text-red-600",children:we})]},N)}return v.jsx(ji,{id:N,label:he?`${ie} *`:ie,checked:!!Se,onChange:me=>Ie(me.currentTarget.checked),"aria-required":he||void 0},N)}case"radio":{if(Jc(z))return null;const me=z.options??[],De=T&&T.length>0?`${N}__${T.join("__")}`:N;return v.jsx(LO,{legend:ie,required:he,children:me.map(se=>v.jsx(BO,{name:De,value:se,checked:Se===se,onChange:()=>{Ie(se),G(N,F(T,N,se))},children:D3[N]?.[se]??se},`${N}-${Sd(se)}`))},N)}case"select":{let me=z.options??[];N==="quote_vehicle_id"&&(me=n?.vehicles__items?.map(Me=>Me.vin)??[]);let De=!1,se,_e,be;if(N==="year"||N==="make"||N==="model"||N==="body_style"){const Me=T?T.join("-"):"_root";ye[Me]&&(De=!0,se="Looking up VIN...")}if(!De&&(N==="make"||N==="model"||N==="body_style")){const Me=T?T.join("-"):"_root";be=Me;const re=rn(A,T,"year"),oe=typeof re=="number"?re:Number(re);if(N==="make"){const Ce=`${Me}:makes`;if(!oe||!Number.isFinite(oe))De=!0,se="Select a year first";else{_e={year:oe};const Ee=B(_e);Ee&&Ee.length>0?me=Ee:ne[Ce]?(se="Loading makes...",me=[...d3]):me=[...d3]}typeof Se=="string"&&Se&&!me.includes(Se)&&(me=[Se,...me])}else if(N==="model"){const Ce=`${Me}:models`,Ee=String(rn(A,T,"make")??"");if(!Ee)De=!0,se="Select a make first";else if(oe&&Number.isFinite(oe)){_e={year:oe,make:Ee};const Te=B(_e);Te&&Te.length>0?me=Te:ne[Ce]?(se="Loading models...",me=[...$3]):me=[...$3]}typeof Se=="string"&&Se&&!me.includes(Se)&&(me=[Se,...me])}else{const Ce=`${Me}:bodyStyles`,Ee=String(rn(A,T,"make")??""),Te=String(rn(A,T,"model")??"");if(!Te)De=!0,se="Select a model first";else if(oe&&Number.isFinite(oe)&&Ee){_e={year:oe,make:Ee,model:Te};const Re=B(_e);Re&&Re.length>0?me=Re:ne[Ce]?(se="Loading body styles...",me=[...x3]):me=[...x3]}typeof Se=="string"&&Se&&!me.includes(Se)&&(me=[Se,...me])}}if(N==="occupation"||N==="co_applicant_occupation"){const Me=N==="co_applicant_occupation"?"co_applicant_employment_industry":void 0,re=Me?void 0:rn(A,T,"industry"),oe=rn(A,T,Me??"employment_industry"),Ee=String(Dd(re??oe)??"").trim();me=[...u3[Ee]??fj],typeof Se=="string"&&Se&&!me.includes(Se)&&(me=[Se,...me])}const xe=_j(T,N),$e=m?.has([...T??[],N].join("."))??!1;return v.jsx(ds,{id:xe,label:se?`${ie} — ${se}`:ie,"aria-required":he||void 0,error:we,disabled:De,value:$e?"":Sj(Se),onChange:Me=>{const re=Me.currentTarget.value;if(N!=="year"&&N!=="make"&&N!=="model"&&N!=="industry"&&N!=="employment_industry"&&N!=="co_applicant_employment_industry"){Ie(re),G(N,F(T,N,re));return}let oe=ln(A,T,N,re);if(N==="year")oe=ln(oe,T,"make",""),oe=ln(oe,T,"model",""),oe=ln(oe,T,"body_style","");else if(N==="make")oe=ln(oe,T,"model",""),oe=ln(oe,T,"body_style","");else if(N==="model")oe=ln(oe,T,"body_style","");else if(N==="industry"||N==="employment_industry")oe=ln(oe,T,"occupation","");else if(N==="co_applicant_employment_industry"){const Ee=String(Dd(re)??"").trim(),Te=u3[Ee]??[],Re=Te.find(ke=>ke===Ee)??Te[0]??"";oe=ln(oe,T,"co_applicant_occupation",Re??"")}n&&i?i(oe):w(oe),I(oe);const Ce=T?Es(oe,T)??{}:oe;G(N,{...Ce,[N]:re})},placeholder:se??"Select an option",onFocus:_e&&be?()=>X(be,_e):void 0,options:me.map(Me=>({value:Me,label:D3[N]?.[Me]??dj[Me]??Me}))},xe)}case"address":return v.jsx(zO,{id:N,label:ie,value:Dn(Se),onChange:(me,De)=>{let se=ln(A,T,N,me);const _e=De?.state??(typeof me=="string"?me.match(/,\s*([A-Z]{2})\s+\d{5}\b/)?.[1]:void 0);if(_e){const be=T?[...T,"state"]:["state"];se=tr(se,be,_e)}if(!T){const be=De?.zipCode??(typeof me=="string"?me.match(/,\s*[A-Z]{2}\s+(\d{5})(?:-\d{4})?\b/)?.[1]:void 0);be&&(se=tr(se,["postal_code"],be))}n&&i?i(se):w(se),I(se)},onBlur:()=>C(N,"address",T),required:he,"aria-required":he||void 0,error:we},N);default:return null}}function W(z,T){const N=z.some(ge=>String(ge.key)==="years_at_address"),ie=z.find(ge=>String(ge.key)==="months_at_address");return z.map((ge,Se)=>{const he=String(ge.key);if(he==="months_at_address"&&N||!qc(ge,A,E)||!ch(ge,A,T)||!Yc(ge,A,c))return null;if(dh(he,ge,A,c)){const be=E.currentCarrierKey?A[E.currentCarrierKey]:void 0;if(!(be&&be!=="NoPriorInsurance"&&Xo(A,E)&&sh.has(he)))return null}const we=U(ge,T),Ie=he==="years_at_address"&&ie?U(ie,T):null,me=ge.conditionals??[];if(!me.length)return c==="BundlePolicy"&&he==="policy_bi"?v.jsxs("div",{className:uh(he,c,T),"data-question-key":he,children:[v.jsx("h3",{className:"text-lg font-semibold mt-6 mb-3",children:"Vehicle Coverage Information"}),we]},`wrap-${he}-${Se}`):v.jsxs("div",{className:uh(he,c,T),"data-question-key":he,children:[we,Ie]},`wrap-${he}-${Se}`);const De=w3(ge,rn(A,T,he)),se=me.filter(be=>ms(De,be.conditionalType,be.conditionalValue)),_e=se.length>1&&!se.some(be=>be.conditionalQuestionsAllowMultiple)?se.slice(0,1):se;return v.jsxs("div",{className:uh(he,c,T),"data-question-key":he,children:[we,Ie,_e.map((be,xe)=>{const $e=be.conditionalQuestions??[];if(!$e.length)return null;if(!be.conditionalQuestionsAllowMultiple)return v.jsx("div",{className:"mt-3",children:W($e,T)},`branch-${he}-${xe}`);const Me=Pc(he),re=Es(A,[...T??[],Me])??[],oe=Math.max(1,re.length||1),Ce=()=>{const Re=tr(A,[...T??[],Me,re.length],{});n&&i?i(Re):w(Re),I(Re)},Ee=()=>{const Re=re.slice(0,Math.max(0,re.length-1)),ke=tr(A,[...T??[],Me],Re);n&&i?i(ke):w(ke),I(ke)},Te=`${he}__c${xe}`;return v.jsxs("div",{className:"mt-3",children:[v.jsxs("div",{className:"repeatable-controls flex items-center justify-between mb-2 gap-2",children:[v.jsx("div",{className:"text-sm font-medium opacity-75",children:"Add one or more entries"}),v.jsxs("div",{className:"repeatable-actions space-x-2",children:[v.jsx("button",{type:"button",className:"btn-outline px-3 py-1",onClick:Ce,children:"Add another"}),oe>1&&v.jsx("button",{type:"button",className:"btn-outline px-3 py-1",onClick:Ee,children:"Remove last"})]})]}),Array.from({length:oe}).map((Re,ke)=>{const qe=[...T??[],Me,ke],Ue=`${Te}__i${ke}`,ze=re[ke]??{},tt=he==="drivers",Ye=tt?`Driver #${ke+1}`:he==="vehicles"?`Vehicle #${ke+1}`:he==="home_losses"||he==="losses"?`Loss #${ke+1}`:`Entry #${ke+1}`,ml=tt&&typeof ze.ssn_display=="string"&&ze.ssn_display?` — ${ze.ssn_display}`:"";return v.jsxs("div",{className:"rounded-lg border p-3 mb-3",children:[v.jsxs("div",{className:"text-sm font-semibold mb-2",children:[Ye,ml]}),$e.map(Nn=>{const gr=String(Nn.key);if(!qc(Nn,A,E)||!ch(Nn,A,qe)||!Yc(Nn,A,c))return null;if(dh(gr,Nn,A,c)){const Mn=E.currentCarrierKey?A[E.currentCarrierKey]:void 0;if(!(Mn&&Mn!=="NoPriorInsurance"&&Xo(A,E)&&sh.has(gr)))return null}return v.jsxs("div",{className:"mt-3",children:[U(Nn,qe),(()=>{const Mn=Nn.conditionals??[];if(!Mn.length)return null;const ri=rn(A,qe,Nn.key),Vn=Mn.filter(Rn=>ms(ri,Rn.conditionalType,Rn.conditionalValue));return(Vn.length>1&&!Vn.some(Rn=>Rn.conditionalQuestionsAllowMultiple)?Vn.slice(0,1):Vn).map((Rn,hl)=>{const Qi=Rn.conditionalQuestions??[];if(!Qi.length)return null;if(!Rn.conditionalQuestionsAllowMultiple)return v.jsx("div",{className:"mt-3",children:W(Qi,qe)},`nested-${Ue}-${hl}`);const ua=Pc(Nn.key),br=Es(A,[...qe,ua])??[],Js=Math.max(1,br.length||1),Xs=()=>{const Tr=tr(A,[...qe,ua,br.length],{});n&&i?i(Tr):w(Tr),I(Tr)},eu=()=>{const Tr=br.slice(0,Math.max(0,br.length-1)),dr=tr(A,[...qe,ua],Tr);n&&i?i(dr):w(dr),I(dr)};return v.jsxs("div",{className:"mt-3",children:[v.jsxs("div",{className:"repeatable-controls flex items-center justify-between mb-2 gap-2",children:[v.jsx("div",{className:"text-sm font-medium opacity-75",children:"Add one or more entries"}),v.jsxs("div",{className:"repeatable-actions space-x-2",children:[v.jsx("button",{type:"button",className:"btn-outline px-3 py-1",onClick:Xs,children:"Add another"}),Js>1&&v.jsx("button",{type:"button",className:"btn-outline px-3 py-1",onClick:eu,children:"Remove last"})]})]}),Array.from({length:Js}).map((Tr,dr)=>{const yl=[...qe,ua,dr];return v.jsxs("div",{className:"rounded-lg border p-3 mb-3",children:[v.jsxs("div",{className:"text-sm font-semibold mb-2",children:["Entry #",dr+1]}),W(Qi,yl)]},`nested-item-${Ue}-${hl}-${dr}`)})]},`nested-repeat-${Ue}-${hl}`)})})()]},`${Ue}-${gr}`)})]},`group-${Ue}`)})]},`branch-${he}-${xe}`)})]},`wrap-${he}-${Se}`)})}const Y=b.useMemo(()=>{const z=[],T=(N,ie)=>{N.forEach(ge=>{if(!qc(ge,A,E)||!ch(ge,A,ie)||!Yc(ge,A,c))return;const Se=String(ge.key);if(dh(Se,ge,A,c)){const De=E.currentCarrierKey?A[E.currentCarrierKey]:void 0;if(!(De&&De!=="NoPriorInsurance"&&Xo(A,E)&&sh.has(Se)))return}Jc(ge)||z.push(ge);const he=ge.conditionals??[];if(!he.length)return;const we=w3(ge,rn(A,ie,Se)),Ie=he.filter(De=>ms(we,De.conditionalType,De.conditionalValue));(Ie.length>1&&!Ie.some(De=>De.conditionalQuestionsAllowMultiple)?Ie.slice(0,1):Ie).forEach(De=>{const se=De.conditionalQuestions??[];se.length&&(De.conditionalQuestionsAllowMultiple||T(se,ie))})})};return T(g),z},[g,A,E,c]);b.useEffect(()=>{if(d<=0)return;const z=xs(A,E),T=Y.map(N=>Kc(N,E)?{...N,required:z}:N);M(Fs(T,A))},[d,Y,A,E]);function te(z){z.preventDefault();const T=xs(A,E),N=Y.map(ge=>Kc(ge,E)?{...ge,required:T}:ge),ie=Fs(N,A);if(M(ie),Object.keys(ie).length>0){const ge=Y.findIndex(Se=>ie[Se.key]);ge>=0&&document.getElementById(Y[ge].key)?.focus();return}o(A)}return v.jsx("form",{className:cj(c),"data-form-area":c??"unknown-stage",onSubmit:te,noValidate:!0,children:W(g)})}function O3({title:e,description:t,applyLabel:n,dismissLabel:i,alreadyOnApplicationNote:o,suggestions:s,isApplying:c,onApply:d,onDismiss:m}){const[h,y]=b.useState(new Set),g=s.length>0&&s.every(x=>h.has(x.id)),E=b.useMemo(()=>s.some(x=>x.alreadyOnApplication),[s]),S=x=>{y(w=>{const R=new Set(w);return R.has(x)?R.delete(x):R.add(x),R})},D=()=>{y(g?new Set:new Set(s.map(x=>x.id)))};return v.jsxs("div",{className:"prefill-suggestions-modal fixed inset-0 z-[10000] flex items-center justify-center p-4",role:"dialog","aria-modal":"true","aria-labelledby":"prefill-suggestions-title",children:[v.jsx("div",{className:"backdrop","aria-hidden":"true"}),v.jsxs("div",{className:"modal-panel bg-white relative w-full max-w-lg max-h-[85vh] overflow-y-auto",role:"document",children:[v.jsxs("div",{className:"text-center mb-6",children:[v.jsx("h2",{id:"prefill-suggestions-title",className:"h1-title",children:e}),v.jsx("p",{className:"text-sm text-slate-600 mt-3",children:t})]}),v.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 text-left mb-4",children:[s.map(x=>v.jsx(ji,{id:`prefill-suggestion-${x.id}`,label:x.alreadyOnApplication?`${x.label} *`:x.label,checked:h.has(x.id),disabled:c,onChange:()=>S(x.id)},x.id)),s.length>1&&v.jsx(ji,{id:"prefill-suggestion-select-all",label:"Select All",checked:g,disabled:c,onChange:D})]}),E&&v.jsx("p",{className:"text-xs text-slate-500 mb-4 text-left",children:o??"* This entry is already on the application; selecting it will fill in available data that does not exist on the application."}),v.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 mt-6",children:[v.jsx("button",{type:"button","data-widget-ctrl":"prefill-dismiss",onClick:m,disabled:c,className:"credify-btn-back h-12 rounded-full border border-gray-300 text-text-primary hover:bg-gray-50 transition disabled:opacity-50 disabled:cursor-not-allowed",children:i}),v.jsxs("button",{type:"button","data-widget-ctrl":"prefill-apply",onClick:()=>d(Array.from(h)),disabled:h.size===0||c,className:["form-wizard-next-btn","h-12 rounded-full text-white transition","disabled:opacity-50 disabled:cursor-not-allowed","flex items-center justify-center gap-2",h.size===0||c?"bg-gray-300":"bg-blue-600 hover:bg-blue-600/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-600/40 bg-primary hover:bg-primary/90 focus-visible:ring-primary/40"].join(" "),children:[c&&v.jsxs("svg",{className:"animate-spin h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","aria-hidden":"true",children:[v.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),v.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),n]})]})]})]})}const Dj="https://getcredify.com/privacy-policy";function $j(){return v.jsx("a",{href:Dj,target:"_blank",rel:"noopener noreferrer",className:"credify-link-underline",children:"Privacy Policy"})}function k3(){return v.jsxs(v.Fragment,{children:["See our ",v.jsx($j,{})," for how we use your information."]})}const xj=new Set(["Product","Name","Home","HomeConstruction","HomeFeatures","Vehicle","Driver","Demographics","Customer","HomeCustomer","BundleCustomer"]),Cj=new Set(["AutoCurrentCarrier","HomeCurrentCarrier","HomePolicy","BundlePolicy","AutoPolicy"]);function Aj(e){return e.trim().replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()}function jo(e){return`stage-footer-hint stage-footer-hint--${Aj(e)}`}function k5({stageKey:e}){return e?e==="Zip"?v.jsx("p",{className:jo(e),"data-stage-key":e,children:"No credit card required."}):e==="Email"?v.jsxs("div",{className:jo(e),"data-stage-key":e,children:[v.jsx("p",{children:"We'll send your quotes and updates here, and save your progress so you can return anytime."}),v.jsx("p",{children:v.jsx(k3,{})})]}):Cj.has(e)?v.jsx("p",{className:jo(e),"data-stage-key":e,children:"Tell us about your current coverage. Carriers ask about your coverage history to put together accurate quotes — it's a standard step on any application. Coverage gaps are common, so just enter things as they are. You're almost there: your quotes are almost ready."}):e==="Ssn"?v.jsx("p",{className:jo(e),"data-stage-key":e,children:"Your SSN is required by some carriers for fraud prevention, underwriting and to generate a quote. It's entered directly into our secure, encrypted form."}):e==="SMSVerification"?v.jsx("p",{className:jo(e),"data-stage-key":e,children:"You'll receive a text from Credify shortly."}):xj.has(e)?v.jsx("p",{className:jo(e),"data-stage-key":e,children:v.jsx(k3,{})}):null:null}function B5(e){const t=new Map,n=new Map,i=o=>{let s=t.get(o);return s||(s=e(o).then(c=>(n.set(o,c.suggestions),c.suggestions)).catch(c=>{throw t.delete(o),c}),t.set(o,s)),s};return{fetch:i,peek:o=>n.get(o),prefetch:o=>{i(o).catch(()=>{})},reset:()=>{t.clear(),n.clear()}}}const Cy=B5(rj),Ay=B5(oj),wj=Cy.fetch,Tj=Cy.peek,Nj=Cy.prefetch,Mj=Ay.fetch,Rj=Ay.peek,Oj=Ay.prefetch,kj=["vin","year","make","model"];function Bj(e){if(!e||typeof e!="object")return!0;const t=e;return kj.every(n=>{const i=t[n];return i==null||String(i).trim()===""})}function Lj(e,t){if(t.length===0)return e;const n=e.vehicles__items??[],i=n.filter(c=>!Bj(c)),o=new Set(i.map(c=>String(c.vin??"").trim().toUpperCase()).filter(c=>c!=="")),s=t.filter(c=>{const d=String(c.vin??"").trim().toUpperCase();return d===""||!o.has(d)});return s.length===0&&i.length===n.length?e:{...e,vehicles:"Yes",vehicles__items:[...i,...s]}}const Pj=["first_name","last_name","date_of_birth"];function L5(e){if(!e||typeof e!="object")return!0;const t=e;return Pj.every(n=>{const i=t[n];return i==null||String(i).trim()===""})}function B3(e){return`${String(e.first_name??"").trim()} ${String(e.last_name??"").trim()}`.trim().toUpperCase()}function Ij(e,t){if(t.length===0)return e;const n=e.drivers__items??[],i=n.filter(c=>!L5(c)),o=new Set(i.map(B3).filter(c=>c!=="")),s=t.filter(c=>{const d=B3(c);return d===""||!o.has(d)});return s.length===0&&i.length===n.length?e:{...e,drivers:"Yes",drivers__items:[...i,...s]}}function Fj(e){return(e.drivers__items??[]).some(n=>!L5(n))}const jj=["widgetOpened","widgetClosed","stageViewed","stageCompleted","flowCompleted","ratesViewed","ratesBack","submissionFailed"],$d={};function zj(e){let t=$d[e];return t||(t=new Set,$d[e]=t),t}function P5(e,t){zj(e).add(t)}function I5(e,t){$d[e]?.delete(t)}function ni(e,...t){const n=$d[e];if(!n||n.size===0)return;const i=t[0],o={quoteId:rf(),timestamp:Date.now()};for(const s of[...n])try{s(i,o)}catch(c){Ld(c,{tags:{source:"widget-event-listener",event:e}})}}function Uj(){ni("widgetOpened")}function Hj(){ni("widgetClosed")}function Vj(e){ni("stageViewed",e)}function L3(e){ni("stageCompleted",e)}function Gj(){ni("flowCompleted")}function Zj(e){ni("ratesViewed",e)}function Yj(){ni("ratesBack")}function ps(e){ni("submissionFailed",e)}const F5=new Set(["Disabled","Retired","Unemployed","Other"]);function qj(e,t){const n=String(e.key??"");if(n==="co_applicant_occupation"||n!=="occupation")return!0;const i=t.industry,o=t.employment_industry,s=String(i??o??"").trim();return!F5.has(s)}function Kj(e,t){const n=String(e.key??"");if(n==="co_applicant_occupation"||n!=="occupation")return!0;const i=t.industry,o=t.employment_industry,s=String(i??o??"").trim();return!F5.has(s)}function j5(e){return e.inputType!=="radio"||!e.options||e.options.length!==1||e.options[0]!=="Yes"?!1:(e.conditionals??[]).some(n=>n.conditionalQuestionsAllowMultiple&&n.conditionalType==="equals"&&n.conditionalValue==="Yes")}function wy(e,t){return j5(e)?"Yes":t}function P3(e){return typeof e=="number"&&Number.isFinite(e)?e:typeof e=="string"&&e.trim()!==""&&!Number.isNaN(Number(e))?Number(e):null}function I3(e){if(e instanceof Date&&!Number.isNaN(e.getTime()))return e.getTime();if(typeof e=="string"){const t=Date.parse(e);return Number.isNaN(t)?null:t}return null}function F3(e,t){const n=P3(e),i=P3(t);if(n!=null&&i!=null)return n-i;const o=I3(e),s=I3(t);return o!=null&&s!=null?o-s:e==null||t==null?null:String(e).localeCompare(String(t))}function Wj(e,t){return Array.isArray(e)?e.some(n=>n===t):typeof e=="string"?t!=null&&e.includes(String(t)):!1}function Ty(e,t,n){switch(t){case"equals":return e===n;case"notEquals":return e!==n&&e!==""&&e!=null;case"lessThan":{const i=F3(e,n);return i!=null&&i<0}case"greaterThan":{const i=F3(e,n);return i!=null&&i>0}case"contains":return Wj(e,n);case"startsWith":return e!=null&&n!=null&&String(e).startsWith(String(n));case"endsWith":return e!=null&&n!=null&&String(e).endsWith(String(n));default:return!1}}const Qj=new Set(["auto_prior_years","auto_prior_months","auto_continuous_coverage_years"]);function Jj(e){return String(e??"").trim().replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()}function of(e,t,n){const i=py([...e]),o=Dy(i),s=[],c=d=>{d.forEach(m=>{if(!qc(m,t,o)||!qj(m,t)||!Yc(m,t,n))return;const h=String(m.key);if(nf(h,n,t)){const D=o.currentCarrierKey?t[o.currentCarrierKey]:void 0;if(!(D&&D!=="NoPriorInsurance"&&Xo(t,o)&&Qj.has(h)))return}j5(m)||s.push(m);const y=wy(m,t[h]),g=m.conditionals??[];if(!g.length)return;const E=g.filter(D=>Ty(y,D.conditionalType,D.conditionalValue));(E.length>1&&!E.some(D=>D.conditionalQuestionsAllowMultiple)?E.slice(0,1):E).forEach(D=>{const x=D.conditionalQuestions??[];x.length&&(D.conditionalQuestionsAllowMultiple||c(x))})})};return c(i),s}const z5="__items",xd=e=>`${e}${z5}`;function Xj(e,t){if(e.key==="relationship_to_insured"||e.key==="is_registered_owner"){const n=t[t.length-1];return typeof n=="number"&&n===0}return!1}function Cd(e,t,n,i=[],o=void 0,s=t){for(const c of e){const d=String(c.key),m=wy(c,t[d]),h=c.conditionals??[];if(!h.length)continue;const y=h.filter(E=>Ty(m,E.conditionalType,E.conditionalValue)),g=y.length>1&&!y.some(E=>E.conditionalQuestionsAllowMultiple)?y.slice(0,1):y;for(const E of g){const S=E.conditionalQuestions??[];if(!S.length)continue;if(!E.conditionalQuestionsAllowMultiple){Cd(S,t,n,i,o,s);continue}if(nf(d,o,s))continue;const D=t[xd(d)]??[];if(D.length===0){n.push({groupKey:d,index:-1,fieldKey:"",fieldLabel:"",message:"At least one entry is required"});continue}for(const[x,w]of D.entries()){const R=[...i,xd(d),x],I=of(S,w,o).filter(Z=>!(Xj(Z,R)||!Kj(Z,w))),A={state:s.state,...w},L=Fs(I,A),M=new Map(I.map((Z,V)=>[Ya(Z,V),Z.question??""]));for(const[Z,V]of Object.entries(L))V&&n.push({groupKey:d,index:x,fieldKey:Z,fieldLabel:M.get(Z)??Z,message:V});Cd(S,w,n,R,o,s)}}}}function ez(e,t,n){const i=[];return Cd(e,t,i,[],n,t),i}function tz(e,t,n){const i=[];return Cd(e,t,i,[],n,t),i.length>0}function v0(e,t,n,i){for(const o of e){const s=String(o.key),c=wy(o,t[s]),d=o.conditionals??[];if(!d.length)continue;const m=d.filter(y=>Ty(c,y.conditionalType,y.conditionalValue)),h=m.length>1&&!m.some(y=>y.conditionalQuestionsAllowMultiple)?m.slice(0,1):m;for(const y of h){const g=y.conditionalQuestions??[];if(!g.length)continue;if(!y.conditionalQuestionsAllowMultiple){v0(g,t,n,i);continue}if(nf(s,n,t))continue;const E=t[xd(s)]??[];for(const[S,D]of E.entries())typeof D!="object"||D===null||(i(of(g,D,n),D,{groupKey:s,index:S}),v0(g,D,n,i))}}}function U5(e){const t=e.vehicles__items??[];if(!Array.isArray(t)||t.length===0)return!1;for(const n of t)if(Cr(n.vehicle_comp_deductible,"select")||Cr(n.vehicle_coll_deductible,"select")||Cr(n.vehicle_towing_and_labor,"select")||Cr(n.vehicle_transportation_expense,"select"))return!0;return!1}function j3({targetStage:e,stageKey:t,quoteId:n,fetchSuggestions:i,peekSuggestions:o,applySelection:s,dismissSelection:c,mergeItems:d,setAllValues:m,shouldSkip:h}){const[y,g]=b.useState(null),[E,S]=b.useState(!1),[D,x]=b.useState(!1),w=b.useRef(new Set);return b.useEffect(()=>{if(t!==e||!n||w.current.has(n))return;if(h?.()){w.current.add(n);return}const A=o(n);if(A!==void 0){A.length>0?g(A):w.current.add(n);return}let L=!1;return x(!0),i(n).then(M=>{M.length===0&&w.current.add(n),!L&&M.length>0&&g(M)}).catch(()=>{w.current.add(n)}).finally(()=>{L||x(!1)}),()=>{L=!0,x(!1)}},[t,n,e]),{suggestions:y,isApplying:E,isPending:D,handleApply:async A=>{if(n){S(!0);try{const{items:L}=await s(n,A);L.length>0&&m(M=>d(M,L))}catch{}finally{w.current.add(n),S(!1),g(null)}}},handleDismiss:()=>{n&&(w.current.add(n),c(n).catch(()=>{})),g(null)}}}function nz({stages:e,onStageComplete:t,onComplete:n,initialValues:i,initialActive:o,quoteId:s,nonTerminalStageKeys:c}){const[d,m]=b.useState(o??0),[h,y]=b.useState(i??{}),[g,E]=b.useState({}),[S,D]=b.useState(!1),[x,w]=b.useState(!1),[R,I]=b.useState(null),[A,L]=b.useState(0),[M,Z]=b.useState([]),[V,fe]=b.useState(o??0),ne=b.useRef({}),pe=b.useRef([]),J=b.useRef(null),ye=b.useRef(e),Ae=Array.isArray(e)&&e.length>0,j=Ae?Math.min(d,e.length-1):0,de=Ae?e[j]:null,k=de?.key??null,B=b.useRef(h);B.current=h;const X=j3({targetStage:"Vehicle",stageKey:k,quoteId:s,fetchSuggestions:wj,peekSuggestions:Tj,applySelection:aj,dismissSelection:ij,mergeItems:Lj,setAllValues:y}),F=j3({targetStage:"Driver",stageKey:k,quoteId:s,fetchSuggestions:Mj,peekSuggestions:Rj,applySelection:lj,dismissSelection:sj,mergeItems:Ij,setAllValues:y,shouldSkip:()=>Fj(B.current)}),G=k==="Vehicle"&&X.isPending||k==="Driver"&&F.isPending;b.useEffect(()=>{o!==void 0&&(m(o),fe(he=>Math.max(he,o)))},[o]),ye.current=e;const C=b.useMemo(()=>{const he=j>=e.length-1;return he&&k&&c?.has(k)?!1:!!(he||e.slice(j+1).every(Ie=>Ie.key==="AutoPolicy")&&(h.drivers__items??[]).length<=1)},[j,e,h,k,c]);b.useEffect(()=>{Ae&&d>=e.length&&m(e.length-1)},[d,e.length,Ae]),b.useEffect(()=>{L(0),Z([])},[k]),b.useEffect(()=>{const he=pe.current[j];he&&he.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[j]),b.useEffect(()=>{i!==void 0&&y(i)},[i]),b.useEffect(()=>{if(!de||!k){D(!1),I(null);return}if(g[k]){D(!1),I(null);return}let he=!1;return D(!0),I(null),Promise.resolve(de.loadQuestions()).then(we=>{if(!he){if(!Array.isArray(we))throw new Error(`loadQuestions("${k}") did not return an array`);E(Ie=>({...Ie,[k]:we}))}}).catch(we=>{he||I(`Failed to load stage "${de?.title??""}": ${we?.message??"Unknown error"}`)}).finally(()=>{he||D(!1)}),()=>{he=!0}},[de,k,g]);const U=k?g[k]:void 0,W=b.useMemo(()=>Dy(py(U??[])),[U]);b.useEffect(()=>{de&&k&&U&&Vj({stageKey:k,stageTitle:de.title??k,stepIndex:d+1,totalSteps:e.length})},[k,d,e.length,de,U]);const Y=b.useMemo(()=>{if(!U)return{};const he={};(me=>{const De=[],se=_e=>{_e.forEach((be,xe)=>{const $e=Ya(be,xe);De.push($e);const Me=xd($e);De.push(Me),(be.conditionals??[]).forEach(oe=>{const Ce=oe.conditionalQuestions??[];Ce.length>0&&se(Ce)})})};return se(me),De})(U).forEach(me=>{me in h&&(he[me]=h[me])});for(const me of["state","State","address","product"])me in h&&(he[me]=h[me]);for(const[me,De]of Object.entries(h))me.endsWith(z5)&&!(me in he)&&(he[me]=De);return he},[U,h]),te=he=>{y(we=>({...we,...he}))},z=()=>{m(he=>he>0?he-1:0),document.querySelector(".panel-body")?.scrollTo({top:0,behavior:"instant"})},T=he=>{he<0||he>=e.length||he>V||he===j||(m(he),document.querySelector(".panel-body")?.scrollTo({top:0,behavior:"instant"}))},N=async()=>{if(!U||!de||S||R||x||G)return;const he=of(U,Y,k??void 0),we=xs(h,W),Ie=he.map(Ee=>Kc(Ee,W)?{...Ee,required:we}:Ee),me=Fs(Ie,Y),De=new Set(Ie.map((Ee,Te)=>Ya(Ee,Te))),se=Object.entries(me).some(([Ee,Te])=>Te&&De.has(Ee)),_e=tz(U,h,k??void 0),xe=he.some(Ee=>String(Ee.key??"")==="vehicle_policy_selections")?U5(h):!1,$e=h.driver_vehicle_assignments,Me=h.drivers__items??[];let re=!1;if($e&&Me.length>=2){const Ee=h.vehicles__items??[];for(let Te=0;Te<Ee.length;Te++){const Re=$e[`v${Te}`];if(!Re)continue;const ke=Me.map((ze,tt)=>Re[`d${tt}`]??0),qe=ke.filter(ze=>ze>0);if(qe.length>=2&&qe.every(ze=>ze===50)){re=!0;break}const Ue=ke.reduce((ze,tt)=>ze+tt,0);if(Ue>0&&Ue!==100){re=!0;break}}}if(se||_e||xe||re){const Ee=new Map(Ie.map((ke,qe)=>[Ya(ke,qe),ke])),Re=[...Object.entries(me).filter(([ke,qe])=>!!qe&&De.has(ke)).map(([ke,qe])=>{const Ue=qe,ze=Ee.get(ke)?.question;return Ue==="Required"&&ze?`${ze} is required`:Ue}),_e?"Complete all required repeated entries before continuing.":null,xe?"Complete the vehicle policy selections before continuing.":null,re?"Driver usage percentages must be valid before continuing.":null].filter(ke=>!!ke);L(ke=>ke+1),Z(Re.length>0?Re:["Review the highlighted fields before continuing."]),window.setTimeout(()=>{J.current?.focus()},0);return}Z([]);const oe=JSON.stringify(Y);if(!C&&j<V&&ne.current[k??""]===oe){m(Ee=>Math.min(Ee+1,e.length-1)),document.querySelector(".panel-body")?.scrollTo({top:0,behavior:"instant"});return}w(!0);try{const Ee=C,Te=Ee?await n(h,k??""):await t(Y,k??""),{success:Re,error:ke}=Te;if(!Re){I(ke??"An error occurred");return}if(!Ee){const qe=Te.latestStages??ye.current,Ue=qe.findIndex(tt=>tt.key===k),ze=Ue>=0?Math.min(Ue+1,qe.length-1):Math.min(d+1,qe.length-1);ne.current[k??""]=oe,fe(tt=>Math.max(tt,ze)),m(ze)}}finally{w(!1)}},ie=b.useMemo(()=>!!(!U||S||R||x||G),[U,S,R,x,G]),ge=e.length>0?(j+1)/e.length*100:0,Se=Jj(k??"unknown-stage");return Ae?v.jsxs("div",{className:`form-wizard-shell form-wizard-shell--${Se}`,"data-stage-key":k??void 0,children:[k==="Vehicle"&&X.suggestions&&X.suggestions.length>0&&v.jsx(O3,{title:"Select your vehicles",description:"We found the vehicles below at your address. Select the ones you'd like to add to your quote, or add them manually.",applyLabel:"Add selected vehicles",dismissLabel:"Add manually",alreadyOnApplicationNote:"* This vehicle is already on the application; selecting it will fill in available data that does not exist on the application.",suggestions:X.suggestions,isApplying:X.isApplying,onApply:X.handleApply,onDismiss:X.handleDismiss}),k==="Driver"&&F.suggestions&&F.suggestions.length>0&&v.jsx(O3,{title:"Additional drivers",description:"We found the drivers below at your address. Select the ones you'd like to add to your quote, or add them manually.",applyLabel:"Add selected drivers",dismissLabel:"Add manually",alreadyOnApplicationNote:"* This driver is already on the application; selecting them will fill in available data that does not exist on the application.",suggestions:F.suggestions,isApplying:F.isApplying,onApply:F.handleApply,onDismiss:F.handleDismiss}),v.jsx("div",{className:`form-wizard-steps-header form-wizard-steps-header--${Se}`,children:v.jsx("div",{className:"form-wizard-steps-scroll",children:v.jsx("ol",{className:"form-wizard-steps flex gap-2 text-xs overflow-x-auto flex-1 pb-1 scrollbar-hide items-center",style:{scrollbarWidth:"none",msOverflowStyle:"none"},tabIndex:0,"aria-label":"Quote steps",children:e.flatMap((he,we)=>[v.jsx("li",{ref:Ie=>{pe.current[we]=Ie},className:"flex-shrink-0",children:v.jsx("button",{type:"button",className:"form-wizard-step-pill px-2.5 py-1 rounded-full border whitespace-nowrap","data-step-state":we<j?"complete":we===j?"current":"upcoming",onClick:()=>T(we),disabled:we>V,"aria-current":we===j?"step":void 0,"aria-label":`${he.title}, step ${we+1} of ${e.length}${we>V?", not available yet":""}`,children:he.title})},he.key??`stage-${we}`),...we<e.length-1?[v.jsx("li",{className:"form-wizard-step-arrow text-slate-400 flex-shrink-0","aria-hidden":"true",children:"›"},`arrow-${he.key??we}`)]:[]])})})}),v.jsxs("div",{className:`form-wizard-card form-wizard-card--${Se}`,style:{"--form-wizard-progress":`${ge}%`},children:[v.jsxs("div",{className:`form-wizard-content form-wizard-content--${Se}`,children:[S&&v.jsx("div",{className:"text-slate-500",role:"status","aria-live":"polite",children:"Loading…"}),G&&v.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",role:"status","aria-live":"polite",children:[v.jsxs("svg",{className:"animate-spin h-8 w-8 text-blue-600 mb-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","aria-hidden":"true",children:[v.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),v.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),v.jsx("div",{className:"text-text-primary font-semibold",children:k==="Driver"?"Looking up additional drivers at your address…":"Looking up vehicles at your address…"}),v.jsx("div",{className:"text-sm text-slate-500 mt-1",children:"This can take a few moments."})]}),!G&&M.length>0&&v.jsxs("div",{ref:J,className:"mb-4 rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700",role:"alert",tabIndex:-1,children:[v.jsx("p",{className:"font-semibold",children:"Please fix the following before continuing:"}),v.jsx("ul",{className:"mt-2 list-disc space-y-1 pl-5",children:M.map((he,we)=>v.jsx("li",{children:he},`${he}-${we}`))})]}),de&&!G&&v.jsx(O5,{questions:U??[],controlledValues:Y,onChangeValues:te,onSubmit:()=>N(),quoteId:s,widgetStageKey:k??void 0,validationAttempt:A},de.key),!S&&R&&v.jsxs("div",{className:"text-red-600 text-sm -mt-4",role:"alert",children:[v.jsx("div",{children:R}),de&&v.jsx("button",{type:"button",className:"credify-retry-btn underline mt-1 font-bold",onClick:()=>{E(he=>{if(!k)return he;const we={...he};return delete we[k],we})},children:"Retry"})]}),v.jsx(k5,{stageKey:k})]}),v.jsxs("div",{className:j>0?"form-wizard-actions grid grid-cols-2 gap-3":"form-wizard-actions",children:[j>0&&v.jsx("button",{type:"button",onClick:z,disabled:S,className:"credify-btn-back h-12 rounded-full border border-gray-300 text-text-primary hover:bg-gray-50 transition",children:"Back"}),v.jsxs("button",{type:"button","data-widget-ctrl":"next",onClick:N,disabled:ie,className:["form-wizard-next-btn",j>0?"":"w-full","h-12 rounded-full text-white transition","disabled:opacity-50 disabled:cursor-not-allowed","flex items-center justify-center gap-2",ie?"bg-gray-300":"bg-blue-600 hover:bg-blue-600/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-600/40 bg-primary hover:bg-primary/90 focus-visible:ring-primary/40"].join(" "),children:[x&&v.jsxs("svg",{className:"animate-spin h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[v.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),v.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),C?"Finish":"Next"]})]})]})]}):v.jsx("div",{className:"text-slate-600",children:"Loading..."})}const H5={SafecoPersonal:{name:"Safeco",abbr:"SFC",color:"#0F337A"},SafecoPersoanl:{name:"Safeco",abbr:"SFC",color:"#0F337A"},AssuranceAmerica:{name:"Assurance America",abbr:"AA",color:"#2768B5"},CommonWealthCasualty:{name:"Commonwealth Casualty",abbr:"CW",color:"#2D69EC"},Alinsco:{name:"Alinsco",abbr:"AL",color:"#20395D"},ACORDBOLTPersonalAuto:{name:"Bolt Auto",abbr:"BLT",color:"#1F2937"},ACORDBOLTPersonalHome:{name:"Bolt Home",abbr:"BLT",color:"#1F2937"},TwentyFirstCentury:{name:"21st Century",abbr:"21C",color:"#B2392A"},ACentral:{name:"A-Central",abbr:"ACT",color:"#EAAD1D"},AAA:{name:"AAA",abbr:"AAA",color:"#DB461C"},AARP:{name:"AARP",abbr:"ARP",color:"#DB4724"},Acadia:{name:"Acadia",abbr:"ACD",color:"#386B61"},Ace:{name:"ACE",abbr:"ACE",color:"#457D48"},Acuity:{name:"Acuity",abbr:"ACU",color:"#D74630"},AdirondackInsExchange:{name:"Adirondack",abbr:"ADK",color:"#1F5490"},Aegis:{name:"Aegis",abbr:"AEG",color:"#1A4675"},AIC:{name:"AIC",abbr:"AIC",color:"#508F47"},AIG:{name:"AIG",abbr:"AIG",color:"#223572"},AlfaAlliance:{name:"Alfa Alliance",abbr:"ALF",color:"#C13D17"},AllianzOfAmerica:{name:"Allianz",abbr:"ALZ",color:"#003781"},AllianzOfAmericaJefferson:{name:"Allianz Jefferson",abbr:"ALZ",color:"#003781"},Allied:{name:"Allied",abbr:"ALD",color:"#0047BB"},Allmerica:{name:"Allmerica",abbr:"ALM",color:"#003DA5"},Allstate:{name:"Allstate",abbr:"ALS",color:"#002F87"},AmericaFirst:{name:"America First",abbr:"AMF",color:"#003DA5"},AmericanCommerce:{name:"American Commerce",abbr:"ACM",color:"#003DA5"},AmericanFamily:{name:"American Family",abbr:"AMF",color:"#0033A0"},Amica:{name:"Amica",abbr:"AMI",color:"#003DA5"},Ameriprise:{name:"Ameriprise",abbr:"AMP",color:"#003DA5"},ASILloyds:{name:"ASI Lloyds",abbr:"ASI",color:"#003DA5"},Assurant:{name:"Assurant",abbr:"ASR",color:"#0033A0"},AtlasGeneralAgency:{name:"Atlas General",abbr:"ATL",color:"#1F3864"},AustinMutual:{name:"Austin Mutual",abbr:"AUS",color:"#1F3864"},Autoone:{name:"AutoOne",abbr:"AON",color:"#003DA5"},AutoOwners:{name:"Auto-Owners",abbr:"AO",color:"#C8102E"},BadgerMutual:{name:"Badger Mutual",abbr:"BDG",color:"#003DA5"},Balboa:{name:"Balboa",abbr:"BAL",color:"#1F3864"},Bamboo:{name:"Bamboo",abbr:"BMB",color:"#0F4C3A"},Bankers:{name:"Bankers",abbr:"BNK",color:"#1F3864"},BeaconNational:{name:"Beacon National",abbr:"BCN",color:"#003DA5"},BrethernMutual:{name:"Brethren Mutual",abbr:"BRT",color:"#1F3864"},BristolWest:{name:"Bristol West",abbr:"BW",color:"#003DA5"},BunkerHill:{name:"Bunker Hill",abbr:"BHL",color:"#1F3864"},CapitalInsuranceGroup:{name:"Capital Insurance",abbr:"CIG",color:"#003DA5"},Celina:{name:"Celina",abbr:"CEL",color:"#1F3864"},CentralMutualOfOH:{name:"Central Mutual",abbr:"CMO",color:"#003DA5"},Chubb:{name:"Chubb",abbr:"CHB",color:"#000000"},ChubbInsurance:{name:"Chubb",abbr:"CHB",color:"#000000"},Cincinnati:{name:"Cincinnati",abbr:"CIN",color:"#003DA5"},Citizens:{name:"Citizens",abbr:"CTZ",color:"#003DA5"},Clearcover:{name:"Clearcover",abbr:"CC",color:"#00B5E2"},CNA:{name:"CNA",abbr:"CNA",color:"#CC3232"},ColonialPenn:{name:"Colonial Penn",abbr:"CPN",color:"#0072CE"},ColoradoCasualty:{name:"Colorado Casualty",abbr:"COC",color:"#1F3864"},Columbia:{name:"Columbia",abbr:"CLM",color:"#003DA5"},CommerceWest:{name:"Commerce West",abbr:"CMW",color:"#003DA5"},CommonwealthCasualty:{name:"Commonwealth Casualty",abbr:"CW",color:"#1F3864"},ConstitutionalCasualty:{name:"Constitutional Casualty",abbr:"CON",color:"#1F3864"},Cornerstone:{name:"Cornerstone",abbr:"CRN",color:"#1F3864"},Countrywide:{name:"Countrywide",abbr:"CTW",color:"#003DA5"},CSE:{name:"CSE",abbr:"CSE",color:"#003DA5"},Cumberland:{name:"Cumberland",abbr:"CMB",color:"#1F3864"},Cypress:{name:"Cypress",abbr:"CYP",color:"#0F4C3A"},Dairyland:{name:"Dairyland",abbr:"DL",color:"#0072CE"},Deerbrook:{name:"Deerbrook",abbr:"DBK",color:"#1F3864"},Direct:{name:"Direct",abbr:"DIR",color:"#D52B1E"},Donegal:{name:"Donegal",abbr:"DON",color:"#003DA5"},Drive:{name:"Drive",abbr:"DRV",color:"#1F3864"},Electric:{name:"Electric",abbr:"ELC",color:"#003DA5"},EMC:{name:"EMC",abbr:"EMC",color:"#003DA5"},Encompass:{name:"Encompass",abbr:"ENC",color:"#002F87"},Erie:{name:"Erie",abbr:"ERI",color:"#005FAC"},Esurance:{name:"Esurance",abbr:"ESU",color:"#00A6CE"},ExcelsiorInsuranceCompany:{name:"Excelsior",abbr:"EXC",color:"#1F3864"},Explorer:{name:"Explorer",abbr:"EXP",color:"#1F3864"},FairPlan:{name:"FAIR Plan",abbr:"FPN",color:"#1F3864"},FarmBureau:{name:"Farm Bureau",abbr:"FB",color:"#00843D"},Farmers:{name:"Farmers",abbr:"FRM",color:"#1C428B"},Fidelity:{name:"Fidelity",abbr:"FID",color:"#00833F"},FiremansFund:{name:"Fireman's Fund",abbr:"FF",color:"#E31837"},FirstAmerican:{name:"First American",abbr:"FAM",color:"#003DA5"},Foremost:{name:"Foremost",abbr:"FOR",color:"#E31837"},ForemostInsuranceCompany:{name:"Foremost",abbr:"FOR",color:"#E31837"},Geico:{name:"GEICO",abbr:"GEI",color:"#0F4293"},GeneralCasualty:{name:"General Casualty",abbr:"GC",color:"#1F3864"},GermantownMutual:{name:"Germantown Mutual",abbr:"GTM",color:"#1F3864"},GMAC:{name:"GMAC",abbr:"GMA",color:"#003DA5"},Grange:{name:"Grange",abbr:"GRG",color:"#003DA5"},GreatAmerican:{name:"Great American",abbr:"GA",color:"#003DA5"},Grinnell:{name:"Grinnell Mutual",abbr:"GRN",color:"#E31837"},GuideOne:{name:"GuideOne",abbr:"GO",color:"#0072CE"},Hanover:{name:"Hanover",abbr:"HAN",color:"#003DA5"},Harbor:{name:"Harbor",abbr:"HBR",color:"#1F3864"},Harleysville:{name:"Harleysville",abbr:"HRL",color:"#003DA5"},Hartford:{name:"The Hartford",abbr:"HFD",color:"#7F1734"},HartfordOMNI:{name:"Hartford OMNI",abbr:"HOM",color:"#7F1734"},HastingsMutual:{name:"Hastings Mutual",abbr:"HST",color:"#1F3864"},HawkeyeSecurity:{name:"Hawkeye Security",abbr:"HWK",color:"#1F3864"},HDI:{name:"HDI",abbr:"HDI",color:"#00563F"},HippoInsuranceCompany:{name:"Hippo",abbr:"HPO",color:"#00C9A7"},HomeownersOfAmerica:{name:"Homeowners of America",abbr:"HOA",color:"#003DA5"},Homesite:{name:"Homesite",abbr:"HMS",color:"#0033A0"},HoraceMann:{name:"Horace Mann",abbr:"HM",color:"#003DA5"},HoustonGeneral:{name:"Houston General",abbr:"HG",color:"#1F3864"},IFA:{name:"IFA",abbr:"IFA",color:"#003DA5"},ImperialCasualty:{name:"Imperial Casualty",abbr:"IMP",color:"#1F3864"},Indiana:{name:"Indiana Insurance",abbr:"IND",color:"#003DA5"},IndianaFarmers:{name:"Indiana Farmers",abbr:"IFM",color:"#00843D"},Infinity:{name:"Infinity",abbr:"INF",color:"#E31837"},Insurequest:{name:"Insurequest",abbr:"INQ",color:"#1F3864"},Integon:{name:"Integon",abbr:"ITG",color:"#003DA5"},Integrity:{name:"Integrity",abbr:"ITY",color:"#1F3864"},Kemper:{name:"Kemper",abbr:"KMP",color:"#0033A0"},LibertyMutual:{name:"Liberty Mutual",abbr:"LM",color:"#FFD000"},LibertyNorthwest:{name:"Liberty Northwest",abbr:"LNW",color:"#FFD000"},Lloyds:{name:"Lloyd's",abbr:"LLY",color:"#003DA5"},MainStreetAmerica:{name:"Main Street America",abbr:"MSA",color:"#003DA5"},Mapfre:{name:"MAPFRE",abbr:"MAP",color:"#E31837"},MarkelInsuranceCompany:{name:"Markel",abbr:"MKL",color:"#003DA5"},Mendota:{name:"Mendota",abbr:"MND",color:"#1F3864"},MerchantsGroup:{name:"Merchants Group",abbr:"MRC",color:"#003DA5"},Mercury:{name:"Mercury",abbr:"MER",color:"#ED1C24"},Metlife:{name:"MetLife",abbr:"MET",color:"#0090DA"},Metropolitan:{name:"Metropolitan",abbr:"MTP",color:"#0090DA"},MidContinent:{name:"Mid-Continent",abbr:"MC",color:"#003DA5"},MidwesternIndemnity:{name:"Midwestern Indemnity",abbr:"MWI",color:"#003DA5"},Montgomery:{name:"Montgomery",abbr:"MTG",color:"#1F3864"},MSA:{name:"MSA",abbr:"MSA",color:"#003DA5"},MtWashington:{name:"Mt. Washington",abbr:"MTW",color:"#1F3864"},MutualBenefit:{name:"Mutual Benefit",abbr:"MB",color:"#1F3864"},NatGenPremier:{name:"NatGen Premier",abbr:"NGP",color:"#0033A0"},NationalGeneral:{name:"National General",abbr:"NG",color:"#0033A0"},Nationwide:{name:"Nationwide",abbr:"NW",color:"#204D9B"},NationwideScottsdale:{name:"Nationwide Scottsdale",abbr:"NWS",color:"#204D9B"},NewYorkCentralMutual:{name:"NY Central Mutual",abbr:"NYC",color:"#003DA5"},NJManufacturers:{name:"NJM Insurance",abbr:"NJM",color:"#003DA5"},NJSkylands:{name:"NJ Skylands",abbr:"NJS",color:"#003DA5"},Northstar:{name:"Northstar",abbr:"NST",color:"#1F3864"},Occidental:{name:"Occidental",abbr:"OCC",color:"#1F3864"},OhioCasualty:{name:"Ohio Casualty",abbr:"OHC",color:"#003DA5"},OmahaPC:{name:"Omaha P&C",abbr:"OMA",color:"#003DA5"},OneBeacon:{name:"OneBeacon",abbr:"OB",color:"#003DA5"},OregonMutual:{name:"Oregon Mutual",abbr:"ORE",color:"#003DA5"},Palisades:{name:"Palisades",abbr:"PAL",color:"#1F3864"},PeerlessMontgomery:{name:"Peerless Montgomery",abbr:"PRM",color:"#1F3864"},Pekin:{name:"Pekin",abbr:"PEK",color:"#003DA5"},Pemco:{name:"PEMCO",abbr:"PMC",color:"#0072CE"},PennNational:{name:"Penn National",abbr:"PN",color:"#003DA5"},PlymouthRock:{name:"Plymouth Rock",abbr:"PLR",color:"#003DA5"},PreferredMutual:{name:"Preferred Mutual",abbr:"PFM",color:"#003DA5"},Proformance:{name:"Proformance",abbr:"PRF",color:"#1F3864"},Progressive:{name:"Progressive",abbr:"PRG",color:"#0053BA"},Prudential:{name:"Prudential",abbr:"PRU",color:"#0033A0"},PureHighValue:{name:"PURE",abbr:"PUR",color:"#003DA5"},Republic:{name:"Republic",abbr:"REP",color:"#003DA5"},RockfordMutual:{name:"Rockford Mutual",abbr:"RKF",color:"#1F3864"},RoyalAndSunAlliance:{name:"Royal & SunAlliance",abbr:"RSA",color:"#003DA5"},Safeco:{name:"Safeco",abbr:"SFC",color:"#E4002B"},SECURA:{name:"SECURA",abbr:"SEC",color:"#003DA5"},Selective:{name:"Selective",abbr:"SEL",color:"#003DA5"},SouthernCounty:{name:"Southern County",abbr:"SCM",color:"#1F3864"},SouthernMutual:{name:"Southern Mutual",abbr:"SM",color:"#1F3864"},SouthernTrust:{name:"Southern Trust",abbr:"ST",color:"#1F3864"},StPaulTravelers:{name:"St. Paul Travelers",abbr:"SPT",color:"#C8102E"},StandardMutual:{name:"Standard Mutual",abbr:"STM",color:"#1F3864"},StarCasualty:{name:"Star Casualty",abbr:"SC",color:"#1F3864"},StateAuto:{name:"State Auto",abbr:"SA",color:"#003DA5"},StateFarm:{name:"State Farm",abbr:"SF",color:"#CC0717"},StateFarmFloridaInsuranceCompany:{name:"State Farm Florida",abbr:"SFF",color:"#CC0717"},SunshineStateInsuranceCompany:{name:"Sunshine State",abbr:"SSS",color:"#FFC72C"},Travelers:{name:"Travelers",abbr:"TRV",color:"#C8102E"},Tower:{name:"Tower",abbr:"TWR",color:"#1F3864"},TWFG:{name:"TWFG",abbr:"TWF",color:"#003DA5"},Unigard:{name:"Unigard",abbr:"UNG",color:"#1F3864"},UnitedFireAndCasualty:{name:"United Fire & Casualty",abbr:"UFC",color:"#003DA5"},Unitrin:{name:"Unitrin",abbr:"UTN",color:"#003DA5"},Universal:{name:"Universal",abbr:"UNV",color:"#003DA5"},USAA:{name:"USAA",abbr:"USA",color:"#1A3258"},UticaNational:{name:"Utica National",abbr:"UTC",color:"#003DA5"},Victoria:{name:"Victoria",abbr:"VIC",color:"#1F3864"},Wellington:{name:"Wellington",abbr:"WLG",color:"#1F3864"},WestBend:{name:"West Bend",abbr:"WB",color:"#003DA5"},WesternNational:{name:"Western National",abbr:"WN",color:"#003DA5"},WesternReserveGroup:{name:"Western Reserve",abbr:"WR",color:"#003DA5"},Westfield:{name:"Westfield",abbr:"WF",color:"#F05136"},WhiteMountains:{name:"White Mountains",abbr:"WM",color:"#1F3864"},WilsonMutual:{name:"Wilson Mutual",abbr:"WLM",color:"#1F3864"},Windsor:{name:"Windsor",abbr:"WIN",color:"#1F3864"},Zurich:{name:"Zurich",abbr:"ZUR",color:"#003399"}},z3=["#0369A1","#1D4ED8","#0F766E","#7C3AED","#B45309","#DC2626","#0891B2","#9333EA"];function rz(e){return e.replace(/[^A-Za-z0-9]/g,"").slice(0,3).toUpperCase()||"CAR"}function V5(e){return e.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/_/g," ").trim()}function Ti(e){if(!e)return e;const t=H5[e];return t?t.name:V5(e)}function az(e){const t=new Set,n=[];return e.forEach((i,o)=>{const c=H5[i]??{name:V5(i),abbr:rz(i),color:z3[o%z3.length]};t.has(c.name)||(t.add(c.name),n.push(c))}),n}function iz(e,t){if(!e)return[];const n=[];return(t==="Auto"||t==="Bundle")&&Array.isArray(e.PersonalAuto)&&n.push(...e.PersonalAuto),(t==="Home"||t==="Bundle")&&Array.isArray(e.PersonalHome)&&n.push(...e.PersonalHome),az(n)}const oz="https://getcredify.com/privacy-policy";function lz({acknowledged:e,onChange:t,disabled:n=!1}){return v.jsx("div",{className:"privacy-notice-ack rounded-xl border border-slate-200 bg-slate-50 p-4","data-testid":"privacy-notice-acknowledgment",children:v.jsx(ji,{id:"privacy-notice-ack-checkbox",className:"privacy-notice-ack-checkbox",checked:e,onChange:i=>t(i.target.checked),disabled:n,label:v.jsxs(v.Fragment,{children:["I acknowledge I have received Credify’s"," ",v.jsx("a",{href:oz,target:"_blank",rel:"noopener noreferrer",className:"credify-link-underline",children:"Privacy Notice"}),"."]})})})}function sz({carrierName:e,formattedPremium:t,lobLabel:n,acknowledged:i,onAcknowledgeChange:o,onCancel:s,onProceed:c,isProcessing:d,hasError:m}){const h=!i||d;return v.jsxs("div",{className:"bind-confirmation","data-testid":"bind-confirmation",role:"group","aria-label":"Confirm your bind request",children:[v.jsx("h3",{className:"text-lg font-semibold text-slate-900",children:"Confirm your bind request"}),v.jsxs("div",{className:"mt-4 rounded-xl border border-slate-200 bg-white p-4",children:[n&&v.jsx("div",{className:"mb-1 text-xs font-semibold uppercase tracking-wide text-slate-500",children:n}),v.jsx("p",{className:"font-semibold text-slate-900",children:e}),v.jsxs("p",{className:"text-2xl font-bold text-slate-900",children:[t,v.jsx("span",{className:"ml-1 text-sm font-medium text-slate-500",children:"/month"})]})]}),v.jsx("div",{className:"mt-4",children:v.jsx(lz,{acknowledged:i,onChange:o,disabled:d})}),m&&v.jsx("p",{className:"mt-3 text-sm text-red-600",role:"alert",children:"Something went wrong while processing your bind request. Please try again."}),v.jsxs("div",{className:"mt-6 grid grid-cols-1 gap-3 sm:grid-cols-2",children:[v.jsx("button",{type:"button","data-testid":"bind-confirmation-cancel",onClick:s,disabled:d,className:"credify-btn-back h-12 rounded-full border border-gray-300 text-text-primary hover:bg-gray-50 transition disabled:opacity-50 disabled:cursor-not-allowed",children:"Cancel"}),v.jsxs("button",{type:"button","data-testid":"bind-confirmation-proceed",onClick:c,disabled:h,className:["h-12 rounded-full text-white font-bold transition","flex items-center justify-center gap-2","disabled:cursor-not-allowed",h?"bg-slate-400":"bg-blue-600 hover:bg-blue-600/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-600/40 bg-primary hover:bg-primary/90 focus-visible:ring-primary/40"].join(" "),children:[d&&v.jsxs("svg",{className:"animate-spin h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[v.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),v.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),d?"Processing…":"Proceed"]})]})]})}const G5=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"});function Z5(e){const t=Number.isFinite(e.term_months)&&e.term_months>0?e.term_months:1;return e.monthly_premium_cents!=null?e.monthly_premium_cents:Math.round((e.premium_cents||0)/t)}const Ad={PersonalHome:"Homeowners",PersonalAuto:"Personal Auto",Flood:"Flood",ExcessFlood:"Excess Flood",_other:"Other"},wd=["PersonalHome","PersonalAuto","Flood","ExcessFlood"];function uz(e){if(e.length===0)return[];const t=(i,o)=>Ti(i.carrier_name).localeCompare(Ti(o.carrier_name));if(!e.some(i=>i.lob))return[{lob:null,title:"Not Quoted",rates:[...e].sort(t)}];const n=new Map;for(const i of e){const o=i.lob||"_other",s=n.get(o);s?s.push(i):n.set(o,[i])}return[...n.entries()].sort(([i],[o])=>{const s=wd.indexOf(i),c=wd.indexOf(o);return(s===-1?999:s)-(c===-1?999:c)}).map(([i,o])=>({lob:i,title:Ad[i]??i,rates:[...o].sort(t)}))}const Kr={admitted:{tab:"rates-tab-admitted",panel:"rates-panel-admitted"},non_admitted:{tab:"rates-tab-non-admitted",panel:"rates-panel-non-admitted"},not_quoted:{tab:"rates-tab-not-quoted",panel:"rates-panel-not-quoted"}};function U3({onBack:e}){const t=()=>{Yj(),e?.()};return v.jsx("button",{type:"button",onClick:t,className:"credify-btn-back credify-btn-back-rates h-12 rounded-full border border-gray-300 text-text-primary hover:bg-gray-50 transition w-full",children:"Back"})}function cz({rate:e,status:t,onRequestBind:n,disabled:i,showLobLabel:o=!0,className:s}){const c=Z5(e)/100,d=G5.format(c),m=t==="loading",h=t==="success",y=!!i||m||h,g=!!(e.effective_date&&e.policy_end_date),E=e.lob?Ad[e.lob]||e.lob:null,S=(e.coverages??[]).filter(D=>!!D&&typeof D.label=="string"&&D.label.trim()!==""&&typeof D.value=="string"&&D.value.trim()!=="");return v.jsxs("div",{className:`flex h-full w-full flex-col rounded-xl border border-slate-200 bg-white p-6 shadow-sm transition hover:shadow-md${s?` ${s}`:""}`,children:[o&&E&&v.jsx("div",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-slate-500",children:E}),v.jsxs("div",{className:"mb-4 flex flex-col items-start gap-2",children:[e.carrier_logo_base64?v.jsx("img",{src:`data:image/png;base64,${e.carrier_logo_base64}`,alt:Ti(e.carrier_name),className:"h-12 w-auto max-w-full object-contain"}):v.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-md bg-slate-100 text-sm font-semibold text-slate-500",children:Ti(e.carrier_name).charAt(0).toUpperCase()}),v.jsx("h4",{className:"w-full break-words text-left font-semibold text-slate-900",children:Ti(e.carrier_name)})]}),v.jsx("div",{className:"mb-2",children:v.jsxs("p",{className:"text-2xl font-bold text-slate-900",children:[d,v.jsx("span",{className:"ml-1 text-sm font-medium text-slate-500",children:"/month"})]})}),g&&v.jsx("div",{className:"mb-2",children:v.jsxs("p",{className:"text-xs text-slate-500",children:["Effective ",e.effective_date," - ",e.policy_end_date]})}),e.carrier_quote_id&&v.jsx("div",{className:"mb-4",children:v.jsxs("p",{className:"text-xs text-slate-400",children:["Quote ID: ",e.carrier_quote_id]})}),S.length>0&&v.jsx("div",{className:"mb-2 border-t border-slate-200 pt-3",children:v.jsx("dl",{children:S.map((D,x)=>v.jsxs("div",{className:"flex items-baseline justify-between gap-2 py-1",children:[v.jsx("dt",{className:"text-xs text-slate-600",children:D.label}),v.jsx("dd",{className:"text-right text-xs font-semibold text-slate-900",children:D.value})]},`${D.label}-${x}`))})}),v.jsxs("div",{className:"mt-auto pt-4",children:[v.jsx("button",{type:"button",onClick:n,disabled:y,className:`rates-bind-btn w-full cursor-pointer rounded-full px-4 py-2.5 text-sm font-semibold transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-600/40 disabled:cursor-not-allowed ${h?"rates-bind-btn-requested":"hover:bg-blue-600/90 disabled:bg-slate-300 disabled:text-slate-500"}`,children:m?"Requesting…":h?"Requested":"Request Bind"}),t==="error"&&v.jsx("p",{className:"mt-2 text-xs text-red-600",role:"alert",children:"Something went wrong. Please try again."}),t==="success"&&v.jsx("p",{className:"mt-2 text-xs text-emerald-600",role:"status","aria-live":"polite",children:"We received your bind request."})]})]})}function dz({item:e}){const t=Ti(e.carrier_name),n=(e.decline_reasons??[]).filter(Boolean);return v.jsxs("div",{className:"flex w-full gap-4 rounded-xl border border-slate-200 bg-white p-4 shadow-sm",children:[v.jsx("div",{className:"shrink-0",children:e.carrier_logo_base64?v.jsx("img",{src:`data:image/png;base64,${e.carrier_logo_base64}`,alt:t,className:"h-10 w-auto max-w-[7rem] object-contain"}):v.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-md bg-slate-100 text-sm font-semibold text-slate-500",children:t.charAt(0).toUpperCase()})}),v.jsxs("div",{className:"min-w-0 flex-1",children:[v.jsx("div",{className:"flex flex-wrap items-center gap-2",children:v.jsx("h4",{className:"break-words font-semibold text-slate-900",children:t})}),n.length>0?v.jsx("ul",{className:"mt-2 list-disc space-y-1 pl-5 text-sm text-slate-600",children:n.map((i,o)=>v.jsx("li",{children:i},o))}):v.jsx("p",{className:"mt-2 text-sm text-slate-500",children:"This carrier did not return a quote."})]})]})}function fz({rates:e,onBack:t,isBundleFlow:n=!1,quoteId:i,initialPhone:o="",requirePursueVerification:s=!1,onSubScreenChange:c}){const d=b.useMemo(()=>Array.isArray(e)?e:[],[e]),m=d.length>0,[h,y]=b.useState({}),[g,E]=b.useState("admitted"),[S,D]=b.useState(!1),[x,w]=b.useState(null),[R,I]=b.useState(!1),[A,L]=b.useState(null),[M,Z]=b.useState(!1),[V,fe]=b.useState(o),[ne,pe]=b.useState(""),[J,ye]=b.useState("phone"),[Ae,j]=b.useState("idle"),[de,k]=b.useState(null),B=!!(A||x);b.useEffect(()=>{c?.(B)},[B,c]),b.useEffect(()=>()=>c?.(!1),[c]);const X=b.useMemo(()=>d.some(re=>re.lob==="PersonalAuto"),[d]),F=b.useMemo(()=>d.some(re=>re.lob==="PersonalHome"),[d]),G=b.useMemo(()=>{if(!n)return[];const re=[];return X&&re.push("PersonalAuto"),F&&re.push("PersonalHome"),re},[n,X,F]),C=b.useMemo(()=>{const re=new Set;for(const oe of d){const Ce=oe.lob??null;Ce&&h[oe.quote_rate_id]==="success"&&re.add(Ce)}return re},[d,h]),U=b.useMemo(()=>Object.values(h).some(re=>re==="success"),[h]),W=b.useMemo(()=>S?!0:!n||G.length===0?U:G.every(re=>C.has(re)),[S,n,U,G,C]),Y=b.useMemo(()=>m?d.filter(re=>(re.admitted_status??"admitted")==="admitted"):[],[d,m]),te=b.useMemo(()=>m?d.filter(re=>re.admitted_status==="non_admitted"):[],[d,m]),z=b.useMemo(()=>m?d.filter(re=>re.admitted_status==="not_quoted"):[],[d,m]),T=Y.length,N=te.length,ie=z.length,ge=T+N>0,Se=ge||ie>0,he=b.useMemo(()=>uz(z),[z]);b.useEffect(()=>{Se&&g==="admitted"&&T===0&&(N>0?E("non_admitted"):ie>0&&E("not_quoted"))},[g,T,N,ie,Se]);const we=b.useMemo(()=>ge?g==="admitted"?Y:g==="non_admitted"?te:[]:[],[ge,g,Y,te]),Ie=re=>{if(re.key!=="ArrowLeft"&&re.key!=="ArrowRight"&&re.key!=="Home"&&re.key!=="End")return;re.preventDefault();const oe=re.key==="Home"?"admitted":re.key==="End"||g==="admitted"?"non_admitted":"admitted";E(oe),window.setTimeout(()=>document.getElementById(Kr[oe].tab)?.focus(),0)};b.useEffect(()=>{Qc()},[]),b.useEffect(()=>{!W||S||(OF(),T5(),D(!0))},[W,S]);const me=b.useMemo(()=>{if(we.length===0)return[];if(!we.some(Ee=>Ee.lob))return[{lob:null,title:"Rates",rates:[...we].sort((Te,Re)=>{const ke=Number.isFinite(Te.term_months)&&Te.term_months>0?Te.term_months:1,qe=Number.isFinite(Re.term_months)&&Re.term_months>0?Re.term_months:1,Ue=Te.monthly_premium_cents??Math.round((Te.premium_cents||0)/ke),ze=Re.monthly_premium_cents??Math.round((Re.premium_cents||0)/qe);return Ue-ze})}];const oe=new Map;for(const Ee of we){const Te=Ee.lob||"_other",Re=oe.get(Te);Re?Re.push(Ee):oe.set(Te,[Ee])}return[...oe.entries()].sort(([Ee],[Te])=>{const Re=wd.indexOf(Ee),ke=wd.indexOf(Te);return(Re===-1?999:Re)-(ke===-1?999:ke)}).map(([Ee,Te])=>({lob:Ee,title:Ad[Ee]??Ee,rates:[...Te].sort((Re,ke)=>{const qe=Number.isFinite(Re.term_months)&&Re.term_months>0?Re.term_months:1,Ue=Number.isFinite(ke.term_months)&&ke.term_months>0?ke.term_months:1,ze=Re.monthly_premium_cents??Math.round((Re.premium_cents||0)/qe),tt=ke.monthly_premium_cents??Math.round((ke.premium_cents||0)/Ue);return ze-tt})}))},[we]),De=b.useMemo(()=>{if(!n)return[];const re=d.some(Ee=>Ee.lob==="PersonalAuto"),oe=d.some(Ee=>Ee.lob==="PersonalHome"),Ce=[];return re||Ce.push("Sorry, no rates found for Personal Auto."),oe||Ce.push("Sorry, no rates found for Homeowners."),Ce},[n,d]);if(!Se)return v.jsxs("section",{className:"mt-8",children:[v.jsx("h3",{className:"text-lg font-semibold text-slate-900",children:"Rates"}),v.jsx("p",{className:"mt-2 text-sm text-slate-500",children:"Sorry, no rates are available at this time."}),t&&v.jsx(U3,{onBack:t})]});const se=re=>{if(y(oe=>({...oe,[re.quote_rate_id]:"idle"})),I(!1),Qc(),!M&&(s||!Jr())){fe(o),pe(""),ye("phone"),j("idle"),k(null),L({cardKey:re.quote_rate_id,rate:re});return}w({cardKey:re.quote_rate_id,rate:re})},_e=()=>{w(null),I(!1)},be=()=>{L(null),k(null),j("idle")},xe=async()=>{if(!A||!i)return;const re=V.trim();if(!re){k("Please enter your phone number.");return}j("sending"),k(null);try{await N5(i,re),ye("code"),j("sent")}catch{j("idle"),k("We could not send a code to that number. Please check it and try again.")}},$e=async()=>{if(!A||!i)return;const re=ne.trim();if(!re){k("Please enter the code we texted you.");return}j("verifying"),k(null);try{const{isVerified:oe,token:Ce}=await g0(i,re);if(!oe||!Ce){j("sent"),k("That code was incorrect. Please try again.");return}Wc(Ce);const Ee=A;Z(!0),L(null),j("idle"),w(Ee)}catch{j("sent"),k("Something went wrong verifying your code. Please try again.")}},Me=async()=>{if(!x||!R)return;const re=x.cardKey;y(oe=>({...oe,[re]:"loading"}));try{if(Qc(),!Jr())throw new Error("Authentication required. Please verify your phone number first.");if(!((await uj(re,!0))?.success!==!1))throw new Error("Request failed");y(Te=>({...Te,[re]:"success"})),w(null),I(!1)}catch{y(oe=>({...oe,[re]:"error"}))}};if(A){const re=Ae==="sending"||Ae==="verifying",oe=["h-12 rounded-full text-white font-bold transition","flex items-center justify-center gap-2","disabled:cursor-not-allowed",re?"bg-slate-400":"bg-blue-600 hover:bg-blue-600/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-600/40 bg-primary hover:bg-primary/90 focus-visible:ring-primary/40"].join(" "),Ce="credify-btn-back h-12 rounded-full border border-gray-300 text-text-primary hover:bg-gray-50 transition disabled:opacity-50 disabled:cursor-not-allowed";return v.jsx("section",{className:"mt-8",children:J==="phone"?v.jsxs(v.Fragment,{children:[v.jsx(zE,{id:"phone",label:"What is your phone number?",value:V,onChange:Ee=>fe(Ee.currentTarget.value),error:de??void 0}),v.jsxs("div",{className:"mt-3 text-xs text-slate-600 space-y-1",children:[v.jsx("p",{children:"We'll text you a 6-digit code to confirm your number. This is just to confirm your number, not a sales call."}),v.jsx("p",{children:"Message & data rates may apply. One message per request."}),v.jsxs("p",{children:["See our"," ",v.jsx("a",{href:"https://getcredify.com/privacy-policy",target:"_blank",rel:"noopener noreferrer",className:"credify-link-underline",children:"Privacy Policy"})," ","and"," ",v.jsx("a",{href:"https://getcredify.com/terms-of-service",target:"_blank",rel:"noopener noreferrer",className:"credify-link-underline",children:"Terms of Service"}),"."]})]}),v.jsxs("div",{className:"mt-6 grid grid-cols-2 gap-3",children:[v.jsx("button",{type:"button",onClick:be,className:Ce,children:"Back to rates"}),v.jsx("button",{type:"button",onClick:xe,disabled:re,className:oe,children:Ae==="sending"?"Sending…":"Send code"})]})]}):v.jsxs(v.Fragment,{children:[v.jsx(jc,{id:"sms_code",label:"Please enter the code we sent to your phone number.",value:ne,inputMode:"numeric",pattern:"[0-9]*",maxLength:6,autoComplete:"one-time-code",onChange:Ee=>pe(Ee.currentTarget.value.replace(/\D+/g,"").slice(0,6)),error:de??void 0}),v.jsx(k5,{stageKey:"SMSVerification"}),v.jsxs("div",{className:"mt-6 grid grid-cols-2 gap-3",children:[v.jsx("button",{type:"button",onClick:()=>{ye("phone"),k(null)},className:Ce,children:"Change number"}),v.jsx("button",{type:"button",onClick:$e,disabled:re,className:oe,children:Ae==="verifying"?"Verifying…":"Verify & continue"})]})]})})}if(x){const re=x.rate.lob?Ad[x.rate.lob]||x.rate.lob:null;return v.jsx("section",{className:"mt-8",children:v.jsx(sz,{carrierName:Ti(x.rate.carrier_name),formattedPremium:G5.format(Z5(x.rate)/100),lobLabel:re,acknowledged:R,onAcknowledgeChange:I,onCancel:_e,onProceed:Me,isProcessing:h[x.cardKey]==="loading",hasError:h[x.cardKey]==="error"})})}return v.jsxs("section",{className:"mt-8",children:[v.jsx("h3",{className:"text-lg font-semibold text-slate-900",children:"Rates"}),De.length>0&&v.jsx("div",{className:"mt-3 space-y-1",children:De.map(re=>v.jsx("p",{className:"text-sm text-slate-600",children:re},re))}),v.jsx("div",{className:"mt-4 border-b border-slate-200",children:v.jsxs("div",{className:"flex items-center gap-6",role:"tablist","aria-label":"Rate market type",children:[v.jsxs("button",{id:Kr.admitted.tab,type:"button",role:"tab","aria-selected":g==="admitted","aria-controls":Kr.admitted.panel,onClick:()=>E("admitted"),onKeyDown:Ie,className:`border-b-2 px-1 py-2 text-sm font-semibold transition ${g==="admitted"?"border-cyan-500 text-slate-900":"border-transparent text-slate-500 hover:text-slate-800"}`,children:["Admitted (",T,")"]}),v.jsxs("button",{id:Kr.non_admitted.tab,type:"button",role:"tab","aria-selected":g==="non_admitted","aria-controls":Kr.non_admitted.panel,onClick:()=>E("non_admitted"),onKeyDown:Ie,className:`border-b-2 px-1 py-2 text-sm font-semibold transition ${g==="non_admitted"?"border-cyan-500 text-slate-900":"border-transparent text-slate-500 hover:text-slate-800"}`,children:["Non-admitted (",N,")"]}),ie>0&&v.jsxs("button",{id:Kr.not_quoted.tab,type:"button",role:"tab","aria-selected":g==="not_quoted","aria-controls":Kr.not_quoted.panel,onClick:()=>E("not_quoted"),className:`border-b-2 px-1 py-2 text-sm font-semibold transition ${g==="not_quoted"?"border-cyan-500 text-slate-900":"border-transparent text-slate-500 hover:text-slate-800"}`,children:["Not Quoted (",ie,")"]})]})}),v.jsx("div",{id:Kr[g].panel,role:"tabpanel","aria-labelledby":Kr[g].tab,tabIndex:0,children:g==="not_quoted"?he.map(re=>v.jsxs("div",{className:"mt-6",children:[re.lob!=null&&v.jsx("h4",{className:"mb-3 text-center text-base font-semibold text-slate-800",children:re.title}),v.jsx("div",{className:"space-y-3",children:re.rates.map(oe=>v.jsx(dz,{item:oe},oe.quote_rate_id))})]},re.lob??"all")):v.jsxs(v.Fragment,{children:[we.length===0&&v.jsx("p",{className:"mt-4 text-sm text-slate-500",children:g==="admitted"?"Sorry, no admitted rates are available at this time.":"Sorry, no non-admitted rates are available at this time."}),we.length>0&&me.map(re=>v.jsxs("div",{className:"mt-6",children:[v.jsx("h4",{className:"mb-3 text-center text-base font-semibold text-slate-800",children:re.title}),v.jsx("div",{className:"flex flex-wrap justify-center gap-4",children:re.rates.map(oe=>v.jsx("div",{className:"w-full min-w-0 sm:w-[calc(50%-0.5rem)] lg:w-[calc(33.333%-0.667rem)] xl:w-[calc(25%-0.75rem)]",children:v.jsx(cz,{rate:oe,showLobLabel:re.lob==null,status:h[oe.quote_rate_id]??"idle",disabled:W||(n?!!(oe.lob&&G.includes(oe.lob)&&C.has(oe.lob)):U),onRequestBind:()=>se(oe)})},oe.quote_rate_id))})]},re.lob??"all"))]})}),t&&v.jsx(U3,{onBack:t})]})}function mz({stageKey:e,title:t,questions:n,values:i,onChangeValues:o,review:s,quoteId:c,fetchVehicleOptions:d}){const m=b.useMemo(()=>new Set(Object.keys(s.errorsByKey)),[s.errorsByKey]);return v.jsxs("section",{id:`review-section-${e}`,"data-testid":`review-section-${e}`,className:`review-section rounded-lg border p-4 ${s.hasIssues?"border-amber-300 bg-amber-50/40":"border-slate-200"}`,children:[v.jsxs("div",{className:"flex items-center justify-between gap-3 mb-3",children:[v.jsx("h3",{className:"text-base font-semibold text-text-primary",children:t}),s.hasIssues?v.jsxs("span",{"data-testid":`review-section-${e}-badge`,className:"shrink-0 rounded-full bg-amber-100 border border-amber-300 text-amber-800 text-xs font-semibold px-2.5 py-1",children:[s.issues.length," ",s.issues.length===1?"field needs":"fields need"," attention"]}):v.jsx("svg",{"data-testid":`review-section-${e}-ok`,className:"h-5 w-5 shrink-0 text-emerald-600",viewBox:"0 0 20 20",fill:"currentColor",role:"img","aria-label":"Section complete",children:v.jsx("path",{fillRule:"evenodd",d:"M16.704 5.29a1 1 0 010 1.415l-7.5 7.5a1 1 0 01-1.415 0l-3.5-3.5a1 1 0 011.415-1.415l2.792 2.793 6.793-6.793a1 1 0 011.415 0z",clipRule:"evenodd"})})]}),s.hasIssues&&v.jsx("ul",{className:"mb-3 list-disc list-inside space-y-0.5 text-sm text-amber-800","data-testid":`review-section-${e}-issues`,children:s.issues.map(h=>v.jsxs("li",{children:[h.label,": ",h.message]},h.key))}),v.jsx(O5,{questions:n,controlledValues:i,onChangeValues:o,onSubmit:()=>{},quoteId:c,widgetStageKey:e,invalidValueKeys:m,fetchVehicleOptions:d})]})}const H3=new Set(["make","model","body_style","occupation","co_applicant_occupation","quote_vehicle_id"]),V3={vehicles:"Vehicle",drivers:"Driver",driver_accidents:"Accident",driver_violations:"Violation",losses:"Loss",home_losses:"Loss"};function G3(e){const t=e.options;return Array.isArray(t)?t.map(n=>n&&typeof n=="object"&&"value"in n?String(n.value):String(n)):[]}const pz=new Set(["SMSVerification","CanopyConnect","Phone"]);function hz({stageKey:e,questions:t,values:n}){const i=of(t,n,e),o=Fs(i,n),s=new Map(i.map((h,y)=>[Ya(h,y),h])),c={},d=[];for(const[h,y]of Object.entries(o))!y||!s.has(h)||(c[h]=y,d.push({key:h,label:s.get(h)?.question??h,message:y}));i.forEach((h,y)=>{const g=Ya(h,y);if(c[g]||h.inputType!=="select"&&h.inputType!=="radio"||H3.has(String(h.key??"")))return;const E=G3(h);if(E.length===0)return;const S=n[g];Cr(S,h.inputType)||E.includes(String(S))||(c[g]="Not a valid option",d.push({key:g,label:h.question??g,message:"Choose a valid option from the list"}))}),v0(t,n,e,(h,y,g)=>{h.forEach(E=>{if(E.inputType!=="select"&&E.inputType!=="radio")return;const S=String(E.key??"");if(!S||H3.has(S))return;const D=G3(E);if(D.length===0)return;const x=y[S];if(!Cr(x,E.inputType)&&!D.includes(String(x))){const w=V3[g.groupKey]??g.groupKey,R=`${g.groupKey}__items.${g.index}.${S}`;c[R]="Not a valid option",d.push({key:R,label:`${w} ${g.index+1} — ${E.question??S}`,message:"Choose a valid option from the list"})}})});for(const h of ez(t,n,e)){const y=V3[h.groupKey]??h.groupKey;if(h.index<0){d.push({key:`${h.groupKey}__missing`,label:y,message:"Add at least one entry"});continue}const g=`${h.groupKey}__items.${h.index}.${h.fieldKey}`;if(c[g])continue;c[g]=h.message;const E=h.fieldLabel?`${y} ${h.index+1} — ${h.fieldLabel}`:`${y} ${h.index+1}`;d.push({key:g,label:E,message:h.message})}if(i.some(h=>String(h.key??"")==="vehicle_policy_selections")&&U5(n)&&d.push({key:"__vehicle_policy",label:"Vehicle coverage selections",message:"Coverage selections are incomplete"}),_z(n,i)&&d.push({key:"__dva",label:"Driver usage",message:"Driver usage percentages must total 100% (50/50 is not allowed)"}),i.some(h=>h.inputType==="address"&&String(h.key??"")==="address")){const h=vz(n);h&&d.push(h)}return{stageKey:e,errorsByKey:c,issues:d,hasIssues:d.length>0}}async function yz(e,t){const n=e.vehicles__items??[];if(!Array.isArray(n)||n.length===0)return[];const i=[];for(const[o,s]of n.entries()){if(typeof s!="object"||s===null)continue;const c=Number(s.year),d=typeof s.make=="string"?s.make.trim():"",m=typeof s.model=="string"?s.model.trim():"",h=typeof s.body_style=="string"?s.body_style.trim():"";if(!(!Number.isFinite(c)||!c||!d))try{const{makes:y}=await t({year:c});if(Array.isArray(y)&&y.length>0&&!y.includes(d)){i.push({key:`vehicles__items.${o}.make`,label:`Vehicle ${o+1} — Make`,message:`"${d}" isn't available for ${c} — choose the make from the list`});continue}if(!m)continue;const{models:g}=await t({year:c,make:d});if(Array.isArray(g)&&g.length>0&&!g.includes(m)){i.push({key:`vehicles__items.${o}.model`,label:`Vehicle ${o+1} — Model`,message:`"${m}" isn't a listed model for the ${c} ${d} — choose the model from the list`});continue}if(!h)continue;const{bodyStyles:E}=await t({year:c,make:d,model:m});Array.isArray(E)&&E.length>0&&!E.includes(h)&&i.push({key:`vehicles__items.${o}.body_style`,label:`Vehicle ${o+1} — Body style`,message:"Choose the body style from the list"})}catch{}}return i}const gz=/^[A-Z]{2}$/,bz=/^\d{5}(-\d{4})?$/;function vz(e){if(!(typeof e.address=="string"?e.address.trim():""))return null;const n=typeof e.state=="string"?e.state.trim().toUpperCase():"",i=e.postal_code==null?"":String(e.postal_code).trim();return gz.test(n)&&bz.test(i)?null:{key:"__address",label:"Property address",message:"Select your address from the dropdown suggestions so we can verify the state and ZIP code"}}function _z(e,t){if(!t.some(s=>String(s.key??"")==="driver_vehicle_assignments"||String(s.key??"")==="vehicle_policy_selections"))return!1;const n=e.driver_vehicle_assignments,i=e.drivers__items??[];if(!n||i.length<2)return!1;const o=e.vehicles__items??[];for(let s=0;s<o.length;s++){const c=n[`v${s}`];if(!c)continue;const d=i.map((y,g)=>c[`d${g}`]??0),m=d.filter(y=>y>0);if(m.length>=2&&m.every(y=>y===50))return!0;const h=d.reduce((y,g)=>y+g,0);if(h>0&&h!==100)return!0}return!1}function xi(e){const t={},n=h=>{if(typeof h=="string"){if(h==="Yes")return!0;if(h==="No")return!1}return h},i=Object.keys(e).filter(h=>!h.includes("__items")),o=new Set,s=new Set;for(const[h,y]of Object.entries(e))if(h.endsWith("__items")&&Array.isArray(y)){const g=h.replace("__items","");s.add(g),i.includes(g)&&y.forEach(E=>{typeof E=="object"&&E!==null&&Object.keys(E).forEach(S=>{o.add(S)})})}for(const[h,y]of Object.entries(e))if(h.endsWith("__items")){const g=h.replace("__items","");if(i.includes(g)){const S=Array.isArray(y)?y.map(D=>xi(D)):y;t[g]=S}}else if(!h.includes("__items")){if(s.has(h))continue;o.has(h)||(t[h]=n(y))}const c=t.auto_prior_carrier_name;if(typeof c=="string"&&c.trim()!==""){const h=c==="NoPriorInsurance";t.auto_has_prior_insurance=!h,h&&(delete t.auto_prior_years,delete t.auto_prior_months,delete t.auto_prior_expiration_date,delete t.auto_prior_liability_limit,delete t.auto_continuous_coverage_years,delete t.auto_cancelled_declined_refused_to_renew,delete t.auto_current_annual_premium_cents)}const d=t.home_prior_carrier_name;if(typeof d=="string"&&d.trim()!==""){const h=d==="NoPriorInsurance";t.home_has_prior_insurance=!h,h&&(delete t.home_prior_years,delete t.home_continuous_coverage_years,delete t.home_prior_expiration_date,delete t.property_insurance_cancelled)}Array.isArray(t.drivers)&&(t.drivers=t.drivers.map(h=>{if(!h||typeof h!="object")return h;const y={...h};return y.industry=Dd(y.industry),y.education_level=S5(y.education_level),y.occupation=D5(y.occupation),y}));const m=21474836;if("sale_price_cents"in t){const h=t.sale_price_cents;if(typeof h=="number"&&Number.isFinite(h)){const y=Math.trunc(h);if(y>=1){const g=Math.min(y,m);t.sale_price_cents=g*100}}}return Array.isArray(t.home_losses)&&(t.home_losses=t.home_losses.map(h=>{if(!h||typeof h!="object")return h;const y=h,g=y.amount_paid_cents;if(typeof g!="number"||!Number.isFinite(g))return y;const E=Math.trunc(g),S=Math.min(Math.max(E,0),m);return{...y,amount_paid_cents:S*100}})),t}const Ez={AL:"Alabama",AK:"Alaska",AZ:"Arizona",AR:"Arkansas",CA:"California",CO:"Colorado",CT:"Connecticut",DE:"Delaware",DC:"District of Columbia",FL:"Florida",GA:"Georgia",HI:"Hawaii",ID:"Idaho",IL:"Illinois",IN:"Indiana",IA:"Iowa",KS:"Kansas",KY:"Kentucky",LA:"Louisiana",ME:"Maine",MD:"Maryland",MA:"Massachusetts",MI:"Michigan",MN:"Minnesota",MS:"Mississippi",MO:"Missouri",MT:"Montana",NE:"Nebraska",NV:"Nevada",NH:"New Hampshire",NJ:"New Jersey",NM:"New Mexico",NY:"New York",NC:"North Carolina",ND:"North Dakota",OH:"Ohio",OK:"Oklahoma",OR:"Oregon",PA:"Pennsylvania",RI:"Rhode Island",SC:"South Carolina",SD:"South Dakota",TN:"Tennessee",TX:"Texas",UT:"Utah",VT:"Vermont",VA:"Virginia",WA:"Washington",WV:"West Virginia",WI:"Wisconsin",WY:"Wyoming",PR:"Puerto Rico"};function Y5(e){const t=e?.trim().toUpperCase();if(!t)return"your state";const n=Ez[t];return n?`${n} (${t})`:"your state"}const Sz=1500,Dz=800;function $z(e){const t=e.vehicles__items??[];return Array.isArray(t)?t.map(n=>[n?.year,n?.make,n?.model,n?.body_style].map(i=>String(i??"")).join("|")).join(";"):""}function xz({stages:e,initialValues:t,quoteId:n,isSubmitting:i,onConfirmed:o}){const s=b.useMemo(()=>e.filter(te=>!pz.has(String(te.key))),[e]),[c,d]=b.useState(t),[m,h]=b.useState({}),[y,g]=b.useState(null),[E,S]=b.useState(!0),[D,x]=b.useState(0),[w,R]=b.useState(!1),[I,A]=b.useState(null),[L,M]=b.useState(!1);b.useEffect(()=>{let te=!1;return S(!0),g(null),Promise.all(s.map(async z=>{const T=await z.loadQuestions();return[String(z.key),[...T]]})).then(z=>{te||h(Object.fromEntries(z))}).catch(z=>{te||g(z instanceof Error?z.message:"Failed to load your review")}).finally(()=>{te||S(!1)}),()=>{te=!0}},[s,D]);const Z=b.useRef(null),V=b.useRef(!0);b.useEffect(()=>{if(V.current){V.current=!1;return}return Z.current&&window.clearTimeout(Z.current),Z.current=window.setTimeout(()=>{La(xi(c),!1).catch(te=>{console.warn("Review autosave failed (will retry on next edit / submit)",te)})},Sz),()=>{Z.current&&window.clearTimeout(Z.current)}},[c]);const fe=b.useCallback(te=>{d(z=>({...z,...te}))},[]),ne=b.useMemo(()=>{for(const[te,z]of Object.entries(m))if(z.some(T=>String(T.key??"")==="vehicles"))return te;return null},[m]),[pe,J]=b.useState([]),[ye,Ae]=b.useState(!1),j=b.useRef(0),de=$z(c),k=b.useRef(new Map),B=b.useRef(Promise.resolve()),X=b.useCallback(te=>{const z=`${te.year??""}|${te.make??""}|${te.model??""}`,T=k.current,N=T.get(z);if(N)return N;const ie=B.current.catch(()=>{}).then(()=>R5({quoteId:n,...te}));B.current=ie.catch(()=>{});const ge=ie.catch(Se=>{throw T.delete(z),Se});return T.set(z,ge),ge},[n]);b.useEffect(()=>{if(!ne||!de){J([]),Ae(!1);return}const te=++j.current;Ae(!0);const z=window.setTimeout(()=>{yz(c,X).then(T=>{j.current===te&&J(T)}).finally(()=>{j.current===te&&Ae(!1)})},Dz);return()=>window.clearTimeout(z)},[ne,de,n,X]);const F=b.useMemo(()=>{const te={};for(const z of s){const T=String(z.key),N=m[T];N&&(te[T]=hz({stageKey:T,questions:N,values:c}))}if(ne&&te[ne]&&pe.length>0){const z=te[ne];te[ne]={...z,errorsByKey:{...z.errorsByKey,...Object.fromEntries(pe.map(T=>[T.key,T.message]))},issues:[...z.issues,...pe],hasIssues:!0}}return te},[s,m,c,ne,pe]),G=b.useMemo(()=>Object.values(F).reduce((te,z)=>te+z.issues.length,0),[F]),C=i||L,U=!E&&!y&&G===0&&w&&!C&&!ye,W=b.useCallback(()=>{const te=s.find(z=>F[String(z.key)]?.hasIssues);te&&document.getElementById(`review-section-${String(te.key)}`)?.scrollIntoView({behavior:"smooth",block:"start"})},[s,F]),Y=b.useCallback(async()=>{if(U){A(null),M(!0);try{const te=typeof c.state=="string"?c.state:"";if(te){const{isSupported:z}=await M5(te);if(!z){A(`Sorry, Credify Corporation doesn't currently offer insurance in ${Y5(te)}. We're expanding our coverage and hope to serve your state soon.`);return}}await o(c)}catch{A("Oops, something went wrong. Please try again later.")}finally{M(!1)}}},[U,c,o]);return E?v.jsx("div",{className:"flex items-center justify-center py-12","data-testid":"review-loading",children:v.jsx("div",{className:"text-slate-600",children:"Loading your details..."})}):y?v.jsxs("div",{className:"text-red-600 text-sm","data-testid":"review-load-error",children:[v.jsx("div",{children:y}),v.jsx("button",{type:"button",className:"credify-retry-btn underline mt-1 font-bold",onClick:()=>x(te=>te+1),children:"Retry"})]}):v.jsxs("div",{className:"space-y-6","data-testid":"review-screen",children:[v.jsxs("div",{className:"text-center",children:[v.jsx("h3",{className:"text-lg font-semibold text-text-primary",children:"Review your information"}),v.jsx("p",{className:"text-sm text-slate-600 mt-1",children:"Here's what we collected during your conversation. Please review each section, fix anything we got wrong, and fill in anything missing — then confirm below to see your quotes."})]}),G>0&&v.jsxs("div",{className:"sticky top-0 z-10 flex items-center justify-between gap-3 rounded-md border border-amber-300 bg-amber-50 px-4 py-2.5 text-sm text-amber-800",role:"status","data-testid":"review-issue-summary",children:[v.jsxs("span",{children:[G," ",G===1?"field needs":"fields need"," your attention before you can continue."]}),v.jsx("button",{type:"button",onClick:W,className:"shrink-0 font-bold underline text-amber-800 hover:text-amber-900",children:"Show me"})]}),s.map(te=>{const z=String(te.key),T=m[z],N=F[z];return!T||!N?null:v.jsx(mz,{stageKey:z,title:te.title,questions:T,values:c,onChangeValues:fe,review:N,quoteId:n,fetchVehicleOptions:X},z)}),v.jsxs("div",{className:"rounded-lg border border-slate-200 p-4 space-y-4","data-testid":"review-consent-block",children:[v.jsx(ji,{id:"review-terms-checkbox","data-testid":"review-terms-checkbox",checked:w,onChange:te=>R(te.target.checked),disabled:i,label:"I have reviewed my information and confirm it is accurate, and I agree to the Terms of Service and Privacy Policy."}),v.jsxs("p",{className:"text-sm text-slate-600",children:["Credify Corporation – Texas #3309669."," ",v.jsx("a",{href:"https://getcredify.com/privacy-policy",target:"_blank",rel:"noopener noreferrer",className:"credify-link-underline",children:"Privacy Policy"})," ","|"," ",v.jsx("a",{href:"https://getcredify.com/terms-of-service",target:"_blank",rel:"noopener noreferrer",className:"credify-link-underline",children:"Terms of Service"})]})]}),I&&v.jsx("div",{className:"text-red-600 text-sm",role:"alert","data-testid":"review-submit-error",children:I}),v.jsxs("button",{type:"button","data-testid":"review-submit","data-widget-ctrl":"review-submit",onClick:Y,disabled:!U,className:["form-wizard-next-btn w-full","h-12 rounded-full text-white font-bold transition","cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed","flex items-center justify-center gap-2",U?"bg-blue-600 hover:bg-blue-600/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-600/40 bg-primary hover:bg-primary/90 focus-visible:ring-primary/40":"bg-gray-300"].join(" "),children:[C&&v.jsxs("svg",{className:"animate-spin h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[v.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),v.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Confirm & See My Quotes"]})]})}const fh=["Validating your details...","Checking underwriting rules...","Applying eligible discounts...","Reviewing your risk profile...","Calculating premium...","Check complete"],Z3={Auto:{label:"Auto Policy",icon:"🚗",accent:"#0369A1"},Home:{label:"Home Policy",icon:"🏠",accent:"#059669"},Bundle:{label:"Home + Auto Bundle",icon:"🔗",accent:"#7C3AED"}},Y3={Auto:6e4,Home:9e4,Bundle:12e4};function Cz({progress:e,color:t,size:n=80}){const i=(n-10)/2,o=2*Math.PI*i,s=o-e/100*o;return v.jsxs("svg",{width:n,height:n,style:{transform:"rotate(-90deg)"},"aria-hidden":"true",children:[v.jsx("circle",{cx:n/2,cy:n/2,r:i,fill:"none",stroke:"#F1F5F9",strokeWidth:6}),v.jsx("circle",{cx:n/2,cy:n/2,r:i,fill:"none",stroke:t,strokeWidth:6,strokeLinecap:"round",strokeDasharray:o,strokeDashoffset:s,style:{transition:"stroke-dashoffset 0.2s linear"}})]})}function Az({providers:e=[],totalTime:t=6e4,flow:n="Auto",isComplete:i=!1,onComplete:o}){const s=Z3[n]??Z3.Auto,c=Y3[n]??Y3.Auto,d=e.length>0?Math.floor(c/e.length):t,[m,h]=b.useState(0),[y,g]=b.useState(0),[E,S]=b.useState(0),[D,x]=b.useState(0),[w,R]=b.useState(!0),I=b.useRef(i),A=b.useRef(o),L=b.useRef(m),M=b.useRef(e.length),Z=b.useRef(!1),V=b.useRef(!1);b.useEffect(()=>{I.current=i,i&&e.length===0&&!Z.current&&(Z.current=!0,A.current?.())},[i,e.length]),b.useEffect(()=>{A.current=o},[o]),b.useEffect(()=>{L.current=m},[m]),b.useEffect(()=>{M.current=e.length,e.length>0&&(V.current=!1,h(0),g(0),S(0),x(0),R(!0))},[e.length]),b.useEffect(()=>{if(e.length===0){I.current&&!Z.current&&(Z.current=!0,A.current?.());return}V.current=!1;const J=100,ye=100/(d/J),Ae=setInterval(()=>{S(j=>{if(V.current||Z.current)return j;const de=j+ye;return de<100?de:(V.current=!0,setTimeout(()=>{if(I.current){if(Z.current)return;Z.current=!0,A.current?.();return}const B=L.current===M.current-1;R(!1),setTimeout(()=>{B?(h(0),g(X=>X+1)):h(X=>X+1),S(0),x(0),R(!0)},300)},400),100)})},J);return()=>clearInterval(Ae)},[m,d,e.length]),b.useEffect(()=>{if(e.length===0)return;const J=Math.floor(d/fh.length),ye=setInterval(()=>x(Ae=>Math.min(Ae+1,fh.length-1)),J);return()=>clearInterval(ye)},[m,d,e.length]);const fe=e.length===0,ne=fe?null:e[Math.min(m,e.length-1)],pe=y>0;return v.jsxs(v.Fragment,{children:[v.jsx("style",{children:`
121
+ …[truncated]`;let m3=!1,p3=null,h3="",w5=C5,y0=A5,Cs=[];function PF(e){return typeof e=="string"?e:e instanceof URL?e.href:e.url}function IF(e,t){return t?.method?t.method.toUpperCase():typeof e!="string"&&!(e instanceof URL)&&e.method?e.method.toUpperCase():"GET"}function y3(e){if(!e)return[];const t=[];if(Array.isArray(e))for(const[n,i]of e)t.push({name:n,value:String(i)});else if(typeof e.forEach=="function")e.forEach((n,i)=>t.push({name:i,value:n}));else for(const[n,i]of Object.entries(e))t.push({name:n,value:String(i)});return t}function FF(e){try{const t=[];return new URL(e).searchParams.forEach((n,i)=>t.push({name:i,value:n})),t}catch{return[]}}function jF(e,t){const n=t?.body;return typeof n!="string"||n.length===0?void 0:{mimeType:e.find(o=>o.name.toLowerCase()==="content-type")?.value??"application/json",text:n}}function zF(e){const t=e.length;return t<=y0?{text:e,size:t}:{text:e.slice(0,y0)+LF,size:t}}function UF(e){Cs.push(e),Cs.length>w5&&Cs.shift()}function HF(e){if(m3)return!0;if(typeof window>"u"||typeof window.fetch!="function")return!1;h3=e.baseUrl,w5=e.maxEntries??C5,y0=e.maxBodyBytes??A5,p3=window.fetch.bind(window);const t=p3;return window.fetch=async(n,i)=>{let o;try{o=PF(n)}catch{return t(n,i)}if(!o.startsWith(h3))return t(n,i);const s=y3(i?.headers??(typeof n!="string"&&!(n instanceof URL)?n.headers:void 0)),c={startedDateTime:new Date().toISOString(),time:-1,request:{method:IF(n,i),url:o,httpVersion:"HTTP/1.1",headers:s,queryString:FF(o),cookies:[],headersSize:-1,bodySize:typeof i?.body=="string"?i.body.length:-1,postData:jF(s,i)},response:VF(),cache:{},timings:{send:0,wait:-1,receive:0}};UF(c);const d=typeof performance<"u"?performance.now():0;let m;try{m=await t(n,i)}catch(y){const g=(typeof performance<"u"?performance.now():0)-d;throw c.time=Math.round(g),c.timings.wait=Math.round(g),c.response._error=y instanceof Error?y.message:String(y),y}const h=(typeof performance<"u"?performance.now():0)-d;c.time=Math.round(h),c.timings.wait=Math.round(h),c.response.status=m.status,c.response.statusText=m.statusText,c.response.headers=y3(m.headers),c.response.content.mimeType=typeof m.headers?.get=="function"&&m.headers.get("content-type")||"";try{m.clone().text().then(g=>{const{text:E,size:S}=zF(g);c.response.content.text=E,c.response.content.size=S,c.response.bodySize=S}).catch(()=>{})}catch{}return m},m3=!0,!0}function VF(){return{status:0,statusText:"",httpVersion:"HTTP/1.1",headers:[],cookies:[],content:{size:0,mimeType:""},redirectURL:"",headersSize:-1,bodySize:-1}}function GF(){return{log:{version:"1.2",creator:{name:kF,version:BF},entries:Cs.map(e=>({...e}))}}}function ZF(){return Cs.length}const YF=[/ssn/i,/social.?security/i,/(driver.?licen[cs]e|^dln$|^dl$)/i,/(date.?of.?birth|^dob$)/i,/^vin$/i,/(sms.?code|^otp$|^code$|verification.?code)/i,/phone/i,/^email$/i,/(first.?name|last.?name|full.?name)/i,/(^address$|street|^zip$|postal)/i,/(jwt|^token$|authorization|^auth$|api.?key|secret|password|credential)/i,/cookie/i],qF=[/\b\d{3}-?\d{2}-?\d{4}\b/g,/\b[A-HJ-NPR-Z0-9]{17}\b/g,/eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g,/\bsk_[A-Za-z0-9]{16,}\b/g,/\bBearer\s+[A-Za-z0-9._-]+/gi],qa="[REDACTED]",KF=8;function af(e){for(const t of YF)if(t.test(e))return!0;return!1}function Ka(e){let t=e;for(const n of qF)t=t.replace(n,qa);return t}function Ua(e,t=0,n=new WeakSet){if(t>KF)return qa;if(e==null)return e;if(typeof e=="string")return Ka(e);if(typeof e!="object")return e;if(n.has(e))return qa;if(n.add(e),Array.isArray(e))return e.map(s=>Ua(s,t+1,n));const i=Object.getPrototypeOf(e);if(i!==null&&i!==Object.prototype)return e;const o={};for(const[s,c]of Object.entries(e)){if(af(s)){o[s]=qa;continue}o[s]=Ua(c,t+1,n)}return o}function g3(e){if(e.request&&(e.request.data!==void 0&&(e.request.data=Ua(e.request.data)),e.request.cookies!==void 0&&(e.request.cookies=qa),e.request.headers)){const t=e.request.headers;for(const n of Object.keys(t))af(n)&&(t[n]=qa)}if(e.extra&&(e.extra=Ua(e.extra)),e.contexts&&(e.contexts=Ua(e.contexts)),e.tags&&(e.tags=Ua(e.tags)),e.user){const{id:t,email:n,username:i}=e.user;e.user={...typeof t=="string"?{id:t}:{},...typeof n=="string"?{email:n}:{},...typeof i=="string"?{username:i}:{}}}if(Array.isArray(e.breadcrumbs))for(const t of e.breadcrumbs)t.data!==void 0&&(t.data=Ua(t.data)),typeof t.message=="string"&&(t.message=Ka(t.message));return typeof e.message=="string"&&(e.message=Ka(e.message)),e}function b3(e){for(const t of e)t.value=af(t.name)?qa:Ka(t.value)}function v3(e){try{return JSON.stringify(Ua(JSON.parse(e)))}catch{return Ka(e)}}function WF(e){const t=JSON.parse(JSON.stringify(e));for(const n of t.log.entries){b3(n.request.headers),b3(n.response.headers);for(const i of n.request.queryString)i.value=af(i.name)?qa:Ka(i.value);n.request.postData?.text&&(n.request.postData.text=v3(n.request.postData.text)),n.response.content.text&&(n.response.content.text=v3(n.response.content.text)),n.request.url=Ka(n.request.url),n.response._error&&(n.response._error=Ka(n.response._error))}return t}function Uo(e,t={}){try{M0(n=>{n.setTag("failure_type","quote"),t.stage&&n.setTag("stage",t.stage),t.quoteId&&n.setTag("quote_id",t.quoteId),t.phase&&n.setTag("phase",t.phase),t.endpoint&&n.setTag("endpoint",t.endpoint),typeof t.statusCode=="number"&&n.setTag("status_code",String(t.statusCode));try{ZF()>0&&n.addAttachment({filename:"quote-failure.har",data:JSON.stringify(WF(GF())),contentType:"application/json"})}catch{}const i=e instanceof Error?e:new Error(t.message??"Quote failed");Ld(i)})}catch{}}const Rt="https://api.getcredify.com";let sl=null;const QF=6e4,_3=new Map;function JF(e){try{return new URL(e).pathname}catch{return e}}function E3(e,t,n){if(!(n>=500&&n<600)&&!(n===0))return;e.__sentryReported=!0;const s=JF(t),c=`${s}:${n}`,d=Date.now(),m=_3.get(c);m&&d-m<QF||(_3.set(c,d),Uo(e,{phase:"api_request",endpoint:s,statusCode:n}))}function Wc(e){sl=e,MF(e)}function Jr(){return sl}function Qc(){const e=RF();e&&(sl=e)}function T5(){sl=null,x5()}async function qt(e,t){const n={"Content-Type":"application/json"};sl&&(n.Authorization=`Bearer ${sl}`);let i;try{i=await fetch(e,{method:"POST",headers:n,body:JSON.stringify(t)})}catch(o){const s=o instanceof Error?o:new Error(String(o));throw E3(s,e,0),o}if(!i.ok){let o=`Request failed with status ${i.status}`;try{o=(await i.json()).error||o}catch{o=i.statusText||o}const s=new Error(o);throw s.statusCode=i.status,E3(s,e,i.status),s}return i}async function Qs(e){try{return await e.json()}catch{return{}}}async function XF(e,t){const n=t?{stage:e,quoteId:t}:{stage:e};return await(await qt(`${Rt}/get-questions-by-stage`,n)).json()}async function Bc(e){const t=e?{quoteId:e}:{};return await(await qt(`${Rt}/get-stages-for-quote`,t)).json()}async function ej(e,t=!1){const n=t?{postal_code:e,is_test:!0}:{postal_code:e},o=await(await qt(`${Rt}/create-quote`,n)).json();if(!o||typeof o!="object"||!o.quoteId)throw new Error(`Invalid createQuote response: ${JSON.stringify(o)}`);return o}async function N5(e,t){return await(await qt(`${Rt}/verify-quote`,{action:"send",quoteId:e,phone:t})).json()}async function La(e,t,n){const i={payload:e,getRates:t};n&&typeof n=="string"&&n.trim()!==""&&(i.quoteId=n);const o=await qt(`${Rt}/update-quote`,i),s=await Qs(o);return!s||typeof s!="object"||!("status"in s)||s.status==null?{status:"success"}:s}async function g0(e,t){return await(await qt(`${Rt}/verify-quote`,{quoteId:e,smsCode:t})).json()}async function tj(e){return await(await qt(`${Rt}/verify-quote`,{action:"resume",resumeToken:e})).json()}async function M5(e,t){const n={state:e};return t&&typeof t=="string"&&t.trim()!==""&&(n.quoteId=t),await(await qt(`${Rt}/is-supported-state`,n)).json()}async function lh(e){const t=e?{quoteId:e}:{};return await(await qt(`${Rt}/get-rates`,t)).json()}async function S3(e){const t=e?{quoteId:e}:{};return await(await qt(`${Rt}/get-quote`,t)).json()}async function R5(e){return(await qt(`${Rt}/get-vehicle-options`,e)).json()}async function nj(e){return(await qt(`${Rt}/get-vehicle-options`,{...e,action:"vinDecode"})).json()}async function rj(e){const t=await qt(`${Rt}/get-vehicle-options`,{quoteId:e,action:"vehiclePrefillSuggestions"}),n=await Qs(t);return{suggestions:Array.isArray(n.suggestions)?n.suggestions:[]}}async function aj(e,t){const n=await qt(`${Rt}/get-vehicle-options`,{quoteId:e,action:"applyVehiclePrefill",selectedIds:t}),i=await Qs(n);return{items:Array.isArray(i.items)?i.items:[]}}async function ij(e){await qt(`${Rt}/get-vehicle-options`,{quoteId:e,action:"dismissVehiclePrefill"})}async function oj(e){const t=await qt(`${Rt}/get-vehicle-options`,{quoteId:e,action:"driverPrefillSuggestions"}),n=await Qs(t);return{suggestions:Array.isArray(n.suggestions)?n.suggestions:[]}}async function lj(e,t){const n=await qt(`${Rt}/get-vehicle-options`,{quoteId:e,action:"applyDriverPrefill",selectedIds:t}),i=await Qs(n);return{items:Array.isArray(i.items)?i.items:[]}}async function sj(e){await qt(`${Rt}/get-vehicle-options`,{quoteId:e,action:"dismissDriverPrefill"})}async function uj(e,t){const i=await(await qt(`${Rt}/request-bind`,{quoteRateId:e,privacyNoticeAcknowledged:t})).json();return i&&typeof i=="object"&&"success"in i?i:{success:!0}}const sh=new Set(["auto_prior_years","auto_prior_months","auto_continuous_coverage_years"]);function b0(e){return Sd(String(e??"")).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()}function cj(e){const t=b0(e??"unknown-stage");return["form-area",`form-area--${t}`,`formArea-${t}`].join(" ")}function uh(e,t,n){const i=b0(t??"unknown-stage"),o=b0(e);return["form-section","form-question",`form-section--${o}`,`form-question--${o}`,`formQuestion-${i}_${o}`,n&&n.length>0?"form-question--scoped":null].filter(Boolean).join(" ")}const dj={None:"None","30000/60000/25000":"30/60k","30000/60000/30000":"30/60k","50000/100000/30000":"50/100k","50000/100000/50000":"50/100k","100000/300000/50000":"100/300k","100000/300000/100000":"100/300k","250000/500000/100000":"250/500k","250000/500000/250000":"250/500k","300000/500000/250000":"300/500k","300000/500000/300000":"300/500k","500000/500000/300000":"500k CSL","500000/500000/500000":"500k CSL","500000/1000000/300000":"500k/1M","500000/1000000/500000":"500k/1M"},D3={auto_prior_carrier_name:BI,auto_prior_liability_limit:FI,auto_reason_for_no_insurance:jI,residence_type:LI,home_prior_carrier_name:PI,policy_bi:zI,policy_um:UI,policy_pd:HI,policy_mp:VI,policy_umpd:GI,policy_pip:ZI,policy_auto_death_indemnity:YI,vehicle_comp_deductible:p0,vehicle_coll_deductible:p0,vehicle_towing_and_labor:h0,vehicle_transportation_expense:b5,education_level:v5,industry:_5,occupation:E5,usage:II,architectural_style:XI,dwelling_type:eF,occupancy_type:tF,construction_quality:nF,construction_type:rF,foundation_type:aF,located_over_water:iF,number_of_stories:oF,exterior_wall_type:lF,roof_material_type:sF,roof_shape:uF,roof_updated_type:cF,heating_type:dF,oil_tank_location:fF,basement_type:mF,plumbing_type:pF,personal_liability:hF,dwelling_medical_payments:yF,all_perils_deductible:gF,windstorm_deductible:bF,distance_from_fire_hydrant_ft:vF,distance_from_fire_station_miles:_F,employment_industry:o3,marital_status:l3,gender:s3,co_applicant_employment_industry:o3,co_applicant_marital_status:l3,co_applicant_gender:s3,description:EF,tort_threshold:SF,pip_coverage_type:DF,extended_medical:$F,additional_pip:xF,policy_pip_deductible:CF},$3=["OTHER / NOT LISTED"],x3=["SEDAN","SUV","COUPE","HATCHBACK","PICKUP","VAN","WAGON","OTHER"],fj=["Other"];function jn(e){const t=e.getUTCFullYear(),n=String(e.getUTCMonth()+1).padStart(2,"0"),i=String(e.getUTCDate()).padStart(2,"0");return`${t}-${n}-${i}`}function C3(e){const t=e.replace(/\D+/g,"");if(t!=="")return kI(t)}function mj(e){return e==="-"||e==="+"||e==="."||e==="e"||e==="E"}const pj={year_built:4,year_roof_updated:4,heating_update_year:4,plumbing_update_year:4,electrical_update_year:4,total_area_sq_ft:6,sale_price_cents:9,dwelling_replacement_cost:9,other_structures_coverage:9,personal_property_coverage:7,amount_paid_cents:7,loss_of_use_coverage:8,home_prior_years:2,home_continuous_coverage_years:2,number_of_dogs:2,number_of_units:2,months_at_address:2,years_at_address:3,years_at_prior_address:3,distance_to_coast_miles:4,household_size:1,number_of_families:1,number_of_mortgagees:1,annual_mileage:6,miles_to_work:4,custom_equipment_value_cents:7,cost_new_value_cents:7,stated_value_amount_cents:7,property_damage_amount_paid_cents:7,personal_injury_amount_paid_cents:7,auto_current_annual_premium_cents:7,auto_prior_years:2,auto_prior_months:2,auto_continuous_coverage_years:2},A3=new Set(["sale_price_cents","dwelling_replacement_cost","other_structures_coverage","personal_property_coverage","loss_of_use_coverage","custom_equipment_value_cents","cost_new_value_cents","stated_value_amount_cents","property_damage_amount_paid_cents","personal_injury_amount_paid_cents","auto_current_annual_premium_cents","amount_paid_cents"]),hj=new Set(["total_area_sq_ft","annual_mileage","miles_to_work","distance_to_coast_miles"]),Lc={first_name:"given-name",last_name:"family-name",co_applicant_first_name:"given-name",co_applicant_last_name:"family-name",date_of_birth:"bday",co_applicant_date_of_birth:"bday",sms_code:"one-time-code",vin:"off",license_number:"off",effective_date:"off"},yj={license_number:20};function gj(e){const t=new Date,n=new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()));if(e==="effective_date"){const i=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth()+3,n.getUTCDate()));return{min:jn(n),max:jn(i)}}if(e==="home_prior_expiration_date"){const i=new Date(Date.UTC(n.getUTCFullYear()-1,n.getUTCMonth(),n.getUTCDate())),o=new Date(Date.UTC(n.getUTCFullYear()+1,n.getUTCMonth(),n.getUTCDate()));return{min:jn(i),max:jn(o)}}if(e==="date_of_incident")return{max:jn(n)};if(e==="move_in_date")return{max:jn(n)};if(e==="purchase_date")return{max:jn(n)};if(e==="date_of_birth")return{max:jn(n)};if(e==="date_first_licensed")return{max:jn(n)};if(e==="occurred_at")return{max:jn(n)};if(e==="accident_prevention_course_date")return{max:jn(n)};if(e==="auto_prior_expiration_date"){const i=new Date(Date.UTC(n.getUTCFullYear()-1,n.getUTCMonth(),n.getUTCDate())),o=new Date(Date.UTC(n.getUTCFullYear()+1,n.getUTCMonth(),n.getUTCDate()));return{min:jn(i),max:jn(o)}}return{}}const bj=new Set(["Disabled","Retired","Unemployed","Other"]);function ch(e,t,n){const i=String(e.key??"");if(i!=="occupation"&&i!=="co_applicant_occupation"||i==="co_applicant_occupation")return!0;const o=rn(t,n,"industry"),s=rn(t,n,"employment_industry"),c=String(o??s??"").trim();return!bj.has(c)}function dh(e,t,n,i){return nf(e,i,n)}function Jc(e){return e.inputType!=="radio"||!e.options||e.options.length!==1||e.options[0]!=="Yes"?!1:(e.conditionals??[]).some(n=>n.conditionalQuestionsAllowMultiple&&n.conditionalType==="equals"&&n.conditionalValue==="Yes")}function w3(e,t){return Jc(e)?"Yes":t}function T3(e){return typeof e=="number"&&Number.isFinite(e)?e:typeof e=="string"&&e.trim()!==""&&!Number.isNaN(Number(e))?Number(e):null}function N3(e){if(e instanceof Date&&!Number.isNaN(e.getTime()))return e.getTime();if(typeof e=="string"){const t=Date.parse(e);return Number.isNaN(t)?null:t}return null}function M3(e,t){const n=T3(e),i=T3(t);if(n!=null&&i!=null)return n-i;const o=N3(e),s=N3(t);return o!=null&&s!=null?o-s:e==null||t==null?null:String(e).localeCompare(String(t))}function vj(e,t){return Array.isArray(e)?e.some(n=>n===t):typeof e=="string"?t!=null&&e.includes(String(t)):!1}function ms(e,t,n){switch(t){case"equals":return e===n;case"notEquals":return e!==n&&e!==""&&e!=null;case"lessThan":{const i=M3(e,n);return i!=null&&i<0}case"greaterThan":{const i=M3(e,n);return i!=null&&i>0}case"contains":return vj(e,n);case"startsWith":return e!=null&&n!=null&&String(e).startsWith(String(n));case"endsWith":return e!=null&&n!=null&&String(e).endsWith(String(n));default:return!1}}function Es(e,t){return t.reduce((n,i)=>n?.[i],e)}function tr(e,t,n){if(t.length===0)return e;const[i,...o]=t;if(o.length===0){if(typeof i=="number"){const h=(Array.isArray(e)?e:[]).slice();return h[i]=n,h}return{...e,[i]:n}}const s=e?.[i],c=typeof o[0]=="number"?Array.isArray(s)?s:[]:s&&typeof s=="object"?s:{},d=tr(c,o,n);if(typeof i=="number"){const h=(Array.isArray(e)?e:[]).slice();return h[i]=d,h}return{...e,[i]:d}}function rn(e,t,n){return Es(e,[...t??[],n])}function ln(e,t,n,i){return tr(e,[...t??[],n],i)}function _j(e,t){return e?.length?`${e.join("-")}-${t}`:t}const Ej="__items",Pc=e=>`${e}${Ej}`;function Dn(e){return e==null?"":typeof e=="string"?e:String(e)}function R3(e){return e==null?"":typeof e=="number"&&Number.isFinite(e)||typeof e=="string"?e:""}function Sj(e){return e==null?"":typeof e=="string"||typeof e=="number"?e:String(e)}function O5({questions:e,initialValues:t,controlledValues:n,onChangeValues:i,onSubmit:o,quoteId:s,widgetStageKey:c,validationAttempt:d=0,invalidValueKeys:m,fetchVehicleOptions:h}){const y=b.useMemo(()=>h??(z=>R5({quoteId:s,...z})),[h,s]),g=b.useMemo(()=>py(e),[e]),E=b.useMemo(()=>Dy(g),[g]),S=b.useMemo(()=>c==="BundlePolicy"?!0:g.some(z=>String(z.key)==="home_prior_carrier_name")&&g.some(z=>String(z.key)==="driver_vehicle_assignments"),[c,g]),D=b.useMemo(()=>{const z={};return t&&Object.assign(z,t),z},[t]),[x,w]=b.useState(D);b.useEffect(()=>{w(D)},[D]);const[R,I]=b.useState({}),A=b.useMemo(()=>({...R,...n??x}),[R,n,x]);b.useEffect(()=>{n&&I(z=>({...z,...n}))},[n]);const[L,M]=b.useState({}),Z=b.useRef(new Map),V=b.useRef(new Set),[,fe]=b.useState({}),[ne,pe]=b.useState({}),J=b.useRef(!1);b.useEffect(()=>{!s||J.current||!g.some(T=>T.key==="year"||T.key==="make"||T.key==="model"||T.key==="body_style")||(J.current=!0,y({}).catch(()=>{}))},[s,g,y]);const[ye,Ae]=b.useState({}),[j,de]=b.useState({}),k=b.useCallback(async(z,T)=>{if(!s||!i3(T))return;const N=z?z.join("-"):"_root";Ae(ie=>({...ie,[N]:!0})),de(ie=>({...ie,[N]:null}));try{const ie=await nj({quoteId:s,vin:T});if(ie.error){de(Se=>({...Se,[N]:ie.error}));return}let ge=A;ie.year&&(ge=ln(ge,z,"year",String(ie.year))),ie.make&&(ge=ln(ge,z,"make",ie.make)),ie.model&&(ge=ln(ge,z,"model",ie.model)),ie.bodyStyle&&(ge=ln(ge,z,"body_style",ie.bodyStyle)),n&&i?i(ge):w(ge),I(ge),Z.current.clear(),V.current.clear(),fe({})}catch{de(ie=>({...ie,[N]:"VIN lookup failed — please enter vehicle details manually"}))}finally{Ae(ie=>({...ie,[N]:!1}))}},[s,A,n,i]),B=b.useCallback(z=>{const T=`${z.year}|${z.make??""}|${z.model??""}`,N=z.model?"bodyStyles":z.make?"models":"makes",ie=Z.current.get(T);return ie?ie[N]??[]:void 0},[]),X=b.useCallback((z,T)=>{if(!s)return;const N=`${T.year}|${T.make??""}|${T.model??""}`,ie=T.model?"bodyStyles":T.make?"models":"makes",ge=`${z}:${ie}`;Z.current.has(N)||V.current.has(N)||(V.current.add(N),pe(Se=>({...Se,[ge]:!0})),y(T).then(Se=>{Z.current.set(N,Se),fe(he=>({...he,[ge]:Se[ie]??[]}))}).catch(()=>{Z.current.set(N,{}),fe(Se=>({...Se,[ge]:[]}))}).finally(()=>{V.current.delete(N),pe(Se=>({...Se,[ge]:!1}))}))},[s,y]);function F(z,T,N){const ie=A,ge=z?Es(A,z)??{}:ie;return z?{state:ie.state,...ge,[T]:N}:{...ge,[T]:N}}function G(z,T){const N=g5.filter(ge=>ge.targetKey===z||ge.dependsOn.includes(z)),ie={[z]:void 0};for(const ge of N){const Se=ge.validate(T);ge.targetKey in ie?Se!==void 0&&(ie[ge.targetKey]=Se):ie[ge.targetKey]=Se}M(ge=>({...ge,...ie}))}const C=(z,T,N)=>{const ie=rn(A,N,z);if(Cr(ie,T)){L[z]&&M(Se=>({...Se,[z]:void 0}));return}const ge=m0(z,ie);if(ge){M(Se=>({...Se,[z]:ge}));return}G(z,F(N,z,ie))};b.useEffect(()=>{let z=A,T=!1;g.forEach(N=>{if(!Jc(N))return;const ie=String(N.key);rn(z,void 0,ie)!=="Yes"&&(z=ln(z,void 0,ie,"Yes"),T=!0)}),T&&(n&&i?i(z):w(z),I(z))},[g,A,n,i]);function U(z,T){const N=z.key;if((N==="relationship_to_insured"||N==="is_registered_owner")&&T){const me=T[T.length-1];if(typeof me=="number"&&me===0)return null}if((N==="purchase_date"||N==="cost_new_value_cents")&&T)return null;if(N==="custom_equipment_value_cents"&&T){const me=rn(A,T,"vehicle_has_modifications");if(me!=="Yes"&&me!==!0)return null}const ie=N==="auto_reason_for_no_insurance"&&E.currentCarrierKey?A[E.currentCarrierKey]==="NoPriorInsurance"?"Reason you are not currently insured":"Reason for lapse in coverage":z.question,ge=z.hint,Se=rn(A,T,N),he=Kc(z,E)?xs(A,E):N==="social_security_number"&&Ed(A.state??A.State)?!0:z.required,we=L[N],Ie=me=>{let De=ln(A,T,N,me);if(z.inputType==="radio"&&z.conditionals){const se=z.conditionals??[];for(const _e of se){const be=rn(A,T,N),xe=ms(be,_e.conditionalType,_e.conditionalValue),$e=ms(me,_e.conditionalType,_e.conditionalValue);if(xe&&!$e&&_e.conditionalQuestionsAllowMultiple){const Me=_e.conditionalQuestions??[];if(Me.length>0){const re=Pc(N);De=tr(De,[...T??[],re],[]);const oe=(Ce,Ee)=>{Ce.forEach(Te=>{(Te.conditionals??[]).forEach(ke=>{if(ke.conditionalQuestionsAllowMultiple){const Ue=Pc(Te.key);De=tr(De,[...Ee,Ue],[])}const qe=ke.conditionalQuestions??[];qe.length>0&&oe(qe,Ee)})})};oe(Me,[...T??[],re])}}}}n&&i?i(De):w(De),I(De)};if(N==="vehicle_policy_selections"){const me=A.vehicles__items??[],De=A.drivers__items??[];if(me.length===0)return v.jsx("p",{style:{color:"#666",fontStyle:"italic"},children:"Add vehicles first to configure coverage selections."},N);const se=A.driver_vehicle_assignments??{},_e=De.length>1,be=Ue=>Object.entries(Ue).map(([ze,tt])=>({value:ze,label:tt})),xe=Ed(A.state??A.State),$e=(Ue,ze)=>Object.fromEntries(Ue.filter(tt=>tt in ze).map(tt=>[tt,ze[tt]])),re=be($e(xe?qI:KI,p0)),oe=xe?$e(WI,h0):h0,Ce=be(oe),Te=be($e(xe?QI:JI,b5)),Re=(Ue,ze,tt)=>{const rt=tr(A,["vehicles__items",Ue,ze],tt);n&&i?i(rt):w(rt),I(rt)},ke=(Ue,ze,tt)=>{const rt={...se},Tt=`v${Ue}`;rt[Tt]={...rt[Tt]??{}},rt[Tt][`d${ze}`]=tt;const Ye=tr(A,["driver_vehicle_assignments"],rt);n&&i?i(Ye):w(Ye),I(Ye)},qe=Ue=>{if(!_e)return null;const ze=se[`v${Ue}`];if(!ze)return null;const tt=De.map((Ye,Hn)=>ze[`d${Hn}`]??0),rt=tt.filter(Ye=>Ye>0);if(rt.length>=2&&rt.every(Ye=>Ye===rt[0])&&rt[0]===50)return`Assignments for Vehicle ${Ue+1} cannot be 50 percent for both Drivers.`;const Tt=tt.reduce((Ye,Hn)=>Ye+Hn,0);return Tt>0&&Tt!==100?`Driver percentages for this vehicle must add up to 100% (currently ${Tt}%).`:null};return v.jsx("div",{children:me.map((Ue,ze)=>{const tt=[Ue.year,Ue.make,Ue.model].filter(Boolean).join(" ")||`Vehicle ${ze+1}`,rt=qe(ze),Tt=Ye=>typeof Ue[Ye]=="string"?Ue[Ye]:"";return v.jsxs("fieldset",{style:{border:`1px solid ${rt?"#dc3545":"#ddd"}`,borderRadius:"8px",padding:"16px",marginBottom:"16px"},children:[v.jsx("legend",{style:{fontWeight:600,padding:"0 8px"},children:tt}),v.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:"12px"},children:[v.jsx(ds,{id:`veh-${ze}-comp`,label:"Comprehensive deductible",required:!0,placeholder:"Select...",options:re,value:Tt("vehicle_comp_deductible"),onChange:Ye=>Re(ze,"vehicle_comp_deductible",Ye.currentTarget.value)}),v.jsx(ds,{id:`veh-${ze}-coll`,label:"Collision deductible",required:!0,placeholder:"Select...",options:re,value:Tt("vehicle_coll_deductible"),onChange:Ye=>Re(ze,"vehicle_coll_deductible",Ye.currentTarget.value)}),v.jsx(ds,{id:`veh-${ze}-tow`,label:"Towing and Labor",required:!0,placeholder:"Select...",options:Ce,value:Tt("vehicle_towing_and_labor"),onChange:Ye=>Re(ze,"vehicle_towing_and_labor",Ye.currentTarget.value)}),v.jsx(ds,{id:`veh-${ze}-trans`,label:"Transportation expense",required:!0,placeholder:"Select...",options:Te,value:Tt("vehicle_transportation_expense"),onChange:Ye=>Re(ze,"vehicle_transportation_expense",Ye.currentTarget.value)})]}),_e&&v.jsxs("div",{style:{marginTop:"16px"},children:[v.jsx("p",{style:{fontWeight:600,margin:"0 0 8px"},children:"Drivers usage (%)"}),v.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"12px"},children:De.map((Ye,Hn)=>{const ml=[Ye.first_name,Ye.last_name].filter(Boolean).join(" ")||`Driver ${Hn+1}`,Nn=se[`v${ze}`]?.[`d${Hn}`];return v.jsx("div",{style:{flex:"0 0 140px"},children:v.jsx(Tp,{id:`assignment-v${ze}-d${Hn}`,label:`${ml} %`,value:Nn??"",min:0,max:100,step:1,inputMode:"numeric",onChange:gr=>{const Mn=gr.currentTarget.value.replace(/\D+/g,"");ke(ze,Hn,Mn===""?0:Math.min(100,parseInt(Mn,10)))}})},`${ze}-${Hn}`)})}),rt&&v.jsx("p",{style:{color:"#dc3545",fontSize:"0.85rem",marginTop:"8px",marginBottom:0},children:rt})]})]},ze)})},N)}if(N==="driver_vehicle_assignments"){const me=A.vehicles__items??[],De=A.drivers__items??[];if(S&&De.length<=1)return null;if(me.length===0||De.length===0)return v.jsx("p",{style:{color:"#666",fontStyle:"italic"},children:"Add vehicles and drivers first to configure driver usage percentages."},N);const se=A.driver_vehicle_assignments??{},_e=(xe,$e,Me)=>{const re={...se},oe=`v${xe}`;re[oe]={...re[oe]??{}},re[oe][`d${$e}`]=Me,Ie(re)},be=xe=>{if(De.length<2)return null;const $e=se[`v${xe}`];if(!$e)return null;const Me=De.map((Ce,Ee)=>$e[`d${Ee}`]??0),re=Me.filter(Ce=>Ce>0);if(re.length>=2&&re.every(Ce=>Ce===re[0])&&re[0]===50)return`Assignments for Vehicle ${xe+1} cannot be 50 percent for both Drivers.`;const oe=Me.reduce((Ce,Ee)=>Ce+Ee,0);return oe>0&&oe!==100?`Driver percentages for this vehicle must add up to 100% (currently ${oe}%).`:null};return v.jsxs("div",{children:[v.jsx("h4",{style:{marginBottom:"12px"},children:ie}),me.map((xe,$e)=>{const Me=[xe.year,xe.make,xe.model].filter(Boolean).join(" ")||`Vehicle ${$e+1}`,re=be($e);return v.jsxs("fieldset",{style:{border:`1px solid ${re?"#dc3545":"#ddd"}`,borderRadius:"8px",padding:"16px",marginBottom:"16px"},children:[v.jsx("legend",{style:{fontWeight:600,padding:"0 8px"},children:Me}),v.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"12px"},children:De.map((oe,Ce)=>{const Ee=[oe.first_name,oe.last_name].filter(Boolean).join(" ")||`Driver ${Ce+1}`,Te=se[`v${$e}`]?.[`d${Ce}`];return v.jsx("div",{style:{flex:"0 0 140px"},children:v.jsx(Tp,{id:`assignment-v${$e}-d${Ce}`,label:`${Ee} %`,value:Te??"",min:0,max:100,step:1,inputMode:"numeric",onChange:Re=>{const ke=Re.currentTarget.value.replace(/\D+/g,"");_e($e,Ce,ke===""?0:Math.min(100,parseInt(ke,10)))}})},`${$e}-${Ce}`)})}),re&&v.jsx("p",{style:{color:"#dc3545",fontSize:"0.85rem",marginTop:"8px",marginBottom:0},children:re})]},$e)})]},N)}switch(z.inputType){case"text":{if(N==="vin"&&s){const me=T?T.join("-"):"_root",De=ye[me]??!1,se=j[me]??null,_e=[ge?`${N}-hint`:null,we?`${N}-error`:null,se?`${N}-vin-error`:null].filter(Boolean).join(" ");return v.jsxs("div",{children:[v.jsx(Un,{id:N,label:ie,hint:ge,error:we,required:he,children:v.jsxs("div",{className:"flex items-end gap-2",children:[v.jsx("div",{className:"flex-1 min-w-0",children:v.jsx("input",{id:N,className:`form-input ${we?"input-error":""}`,"aria-invalid":!!we,"aria-describedby":_e||void 0,"aria-required":he||void 0,required:he,value:Dn(Se),maxLength:17,onChange:be=>Ie(be.currentTarget.value),onBlur:()=>C(N,"text",T),autoComplete:Lc[N],type:"text"})}),v.jsx("button",{type:"button",disabled:De||!i3(Dn(Se)),className:"btn btn-outline shrink-0 self-end !w-auto min-w-[8.5rem] px-4 whitespace-nowrap disabled:opacity-50",onClick:()=>k(T,Dn(Se)),children:De?"Looking up...":"Verify VIN"})]})}),se&&v.jsx("p",{id:`${N}-vin-error`,className:"text-sm text-red-600 mt-1",children:se})]},N)}if(N==="sms_code"){const me=Dn(Se);return v.jsx(jc,{id:N,label:ie,hint:ge,value:me,inputMode:"numeric",pattern:"[0-9]*",maxLength:6,onChange:De=>{const se=De.currentTarget.value.replace(/\D+/g,"").slice(0,6);Ie(se)},onBlur:()=>C(N,"text",T),"aria-required":he||void 0,error:we,autoComplete:Lc[N]},N)}if(N==="license_number")return v.jsx(jc,{id:N,label:ie,hint:ge,value:Dn(Se),onChange:me=>Ie(me.currentTarget.value.replace(/[^A-Z0-9]/gi,"").slice(0,20)),onBlur:()=>C(N,"text",T),"aria-required":he||void 0,error:we,autoComplete:"off",maxLength:20},N);if(N==="social_security_number"){const me=rn(A,T,"ssn_display"),De=typeof me=="string"?me:"",se=De?`${De}. Re-enter to update.${ge?` ${ge}`:""}`:ge;return v.jsx(Y7,{id:N,label:ie,hint:se,value:Dn(Se),onChange:_e=>Ie(_e.currentTarget.value),onBlur:()=>C(N,"text",T),"aria-required":he||void 0,error:we},N)}return v.jsx(jc,{id:N,label:ie,hint:ge,value:Dn(Se),onChange:me=>Ie(me.currentTarget.value),onBlur:()=>C(N,"text",T),"aria-required":he||void 0,error:we,autoComplete:Lc[N],maxLength:yj[N]},N)}case"email":return v.jsx(q7,{id:N,label:ie,value:Dn(Se),onChange:me=>Ie(me.currentTarget.value),onBlur:()=>C(N,"email",T),"aria-required":he||void 0,error:we},N);case"password":return v.jsx(W7,{id:N,label:ie,value:Dn(Se),onChange:me=>Ie(me.currentTarget.value),onBlur:()=>C(N,"password",T),"aria-required":he||void 0,error:we},N);case"tel":return v.jsxs(v.Fragment,{children:[v.jsx(zE,{id:N,label:ie,value:Dn(Se),onChange:me=>Ie(me.currentTarget.value),onBlur:()=>C(N,"tel",T),"aria-required":he||void 0,error:we},N),N==="phone"&&v.jsxs("div",{className:"mt-3 text-xs text-slate-600 space-y-1",children:[v.jsx("p",{children:"Enter your mobile number to continue to your quotes. If you choose to pursue a quote, you'll verify this number with a 6-digit text — we won't text you now."}),v.jsx("p",{children:"Message & data rates may apply. One message per request."}),v.jsxs("p",{children:["See our"," ",v.jsx("a",{href:"https://getcredify.com/privacy-policy",target:"_blank",rel:"noopener noreferrer",className:"credify-link-underline",children:"Privacy Policy"})," ","and"," ",v.jsx("a",{href:"https://getcredify.com/terms-of-service",target:"_blank",rel:"noopener noreferrer",className:"credify-link-underline",children:"Terms of Service"}),"."]})]})]});case"url":return v.jsx(K7,{id:N,label:ie,value:Dn(Se),onChange:me=>Ie(me.currentTarget.value),onBlur:()=>C(N,"url",T),"aria-required":he||void 0,error:we},N);case"number":{const me=pj[N];return A3.has(N)||hj.has(N)?v.jsx(Z7,{id:N,label:ie,hint:ge,value:R3(Se),isCurrency:A3.has(N),maxDigits:me,onChange:De=>Ie(C3(De.currentTarget.value)),onBlur:()=>C(N,"number",T),required:he,"aria-required":he||void 0,error:we},N):v.jsx(Tp,{id:N,label:ie,hint:ge,value:R3(Se),inputMode:"numeric",pattern:"[0-9]*",onKeyDown:De=>{if(mj(De.key)){De.preventDefault();return}me!==void 0&&/^\d$/.test(De.key)&&String(De.currentTarget.value).replace(/\D/g,"").length>=me&&De.preventDefault()},onChange:De=>{let se=De.currentTarget.value;me!==void 0&&(se=se.slice(0,me)),Ie(C3(se))},onBlur:()=>C(N,"number",T),required:he,"aria-required":he||void 0,error:we},N)}case"textarea":return v.jsx(Q7,{id:N,label:ie,value:Dn(Se),onChange:me=>Ie(me.currentTarget.value),onBlur:()=>C(N,"textarea",T),"aria-required":he||void 0,error:we,rows:4},N);case"date":{const{min:me,max:De}=gj(N);return v.jsx(OO,{id:N,label:ie,hint:ge,value:Dn(Se),min:me,max:De,onChange:se=>{const _e=se.currentTarget.value;Ie(_e),!Cr(_e,"date")&&!m0(N,_e)&&G(N,F(T,N,_e))},onBlur:()=>C(N,"date",T),"aria-required":he||void 0,error:we,autoComplete:Lc[N]},N)}case"checkbox":{if(z.options){const me=Array.isArray(Se)?Se:[],De=`${N}-error`;return v.jsxs("fieldset",{className:"space-y-2","aria-describedby":we?De:void 0,children:[v.jsxs("legend",{className:"form-label",children:[ie,he&&v.jsxs(v.Fragment,{children:[v.jsx("span",{className:"text-red-600 ml-1","aria-hidden":"true",children:"*"}),v.jsx("span",{className:"sr-only",children:" required"})]})]}),v.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:z.options.map(se=>{const _e=`${N}-${Sd(se)}`,be=me.includes(se);return v.jsx(ji,{id:_e,label:se,checked:be,onChange:xe=>{const $e=new Set(me);xe.currentTarget.checked?$e.add(se):$e.delete(se),Ie(Array.from($e))},"aria-required":he||void 0,"aria-describedby":we?De:void 0},_e)})}),we&&v.jsx("p",{id:De,className:"mt-1 text-sm text-red-600",children:we})]},N)}return v.jsx(ji,{id:N,label:he?`${ie} *`:ie,checked:!!Se,onChange:me=>Ie(me.currentTarget.checked),"aria-required":he||void 0},N)}case"radio":{if(Jc(z))return null;const me=z.options??[],De=T&&T.length>0?`${N}__${T.join("__")}`:N;return v.jsx(LO,{legend:ie,required:he,children:me.map(se=>v.jsx(BO,{name:De,value:se,checked:Se===se,onChange:()=>{Ie(se),G(N,F(T,N,se))},children:D3[N]?.[se]??se},`${N}-${Sd(se)}`))},N)}case"select":{let me=z.options??[];N==="quote_vehicle_id"&&(me=n?.vehicles__items?.map(Me=>Me.vin)??[]);let De=!1,se,_e,be;if(N==="year"||N==="make"||N==="model"||N==="body_style"){const Me=T?T.join("-"):"_root";ye[Me]&&(De=!0,se="Looking up VIN...")}if(!De&&(N==="make"||N==="model"||N==="body_style")){const Me=T?T.join("-"):"_root";be=Me;const re=rn(A,T,"year"),oe=typeof re=="number"?re:Number(re);if(N==="make"){const Ce=`${Me}:makes`;if(!oe||!Number.isFinite(oe))De=!0,se="Select a year first";else{_e={year:oe};const Ee=B(_e);Ee&&Ee.length>0?me=Ee:ne[Ce]?(se="Loading makes...",me=[...d3]):me=[...d3]}typeof Se=="string"&&Se&&!me.includes(Se)&&(me=[Se,...me])}else if(N==="model"){const Ce=`${Me}:models`,Ee=String(rn(A,T,"make")??"");if(!Ee)De=!0,se="Select a make first";else if(oe&&Number.isFinite(oe)){_e={year:oe,make:Ee};const Te=B(_e);Te&&Te.length>0?me=Te:ne[Ce]?(se="Loading models...",me=[...$3]):me=[...$3]}typeof Se=="string"&&Se&&!me.includes(Se)&&(me=[Se,...me])}else{const Ce=`${Me}:bodyStyles`,Ee=String(rn(A,T,"make")??""),Te=String(rn(A,T,"model")??"");if(!Te)De=!0,se="Select a model first";else if(oe&&Number.isFinite(oe)&&Ee){_e={year:oe,make:Ee,model:Te};const Re=B(_e);Re&&Re.length>0?me=Re:ne[Ce]?(se="Loading body styles...",me=[...x3]):me=[...x3]}typeof Se=="string"&&Se&&!me.includes(Se)&&(me=[Se,...me])}}if(N==="occupation"||N==="co_applicant_occupation"){const Me=N==="co_applicant_occupation"?"co_applicant_employment_industry":void 0,re=Me?void 0:rn(A,T,"industry"),oe=rn(A,T,Me??"employment_industry"),Ee=String(Dd(re??oe)??"").trim();me=[...u3[Ee]??fj],typeof Se=="string"&&Se&&!me.includes(Se)&&(me=[Se,...me])}const xe=_j(T,N),$e=m?.has([...T??[],N].join("."))??!1;return v.jsx(ds,{id:xe,label:se?`${ie} — ${se}`:ie,required:he,"aria-required":he||void 0,error:we,disabled:De,value:$e?"":Sj(Se),onChange:Me=>{const re=Me.currentTarget.value;if(N!=="year"&&N!=="make"&&N!=="model"&&N!=="industry"&&N!=="employment_industry"&&N!=="co_applicant_employment_industry"){Ie(re),G(N,F(T,N,re));return}let oe=ln(A,T,N,re);if(N==="year")oe=ln(oe,T,"make",""),oe=ln(oe,T,"model",""),oe=ln(oe,T,"body_style","");else if(N==="make")oe=ln(oe,T,"model",""),oe=ln(oe,T,"body_style","");else if(N==="model")oe=ln(oe,T,"body_style","");else if(N==="industry"||N==="employment_industry")oe=ln(oe,T,"occupation","");else if(N==="co_applicant_employment_industry"){const Ee=String(Dd(re)??"").trim(),Te=u3[Ee]??[],Re=Te.find(ke=>ke===Ee)??Te[0]??"";oe=ln(oe,T,"co_applicant_occupation",Re??"")}n&&i?i(oe):w(oe),I(oe);const Ce=T?Es(oe,T)??{}:oe;G(N,{...Ce,[N]:re})},placeholder:se??"Select an option",onFocus:_e&&be?()=>X(be,_e):void 0,options:me.map(Me=>({value:Me,label:D3[N]?.[Me]??dj[Me]??Me}))},xe)}case"address":return v.jsx(zO,{id:N,label:ie,value:Dn(Se),onChange:(me,De)=>{let se=ln(A,T,N,me);const _e=De?.state??(typeof me=="string"?me.match(/,\s*([A-Z]{2})\s+\d{5}\b/)?.[1]:void 0);if(_e){const be=T?[...T,"state"]:["state"];se=tr(se,be,_e)}if(!T){const be=De?.zipCode??(typeof me=="string"?me.match(/,\s*[A-Z]{2}\s+(\d{5})(?:-\d{4})?\b/)?.[1]:void 0);be&&(se=tr(se,["postal_code"],be))}n&&i?i(se):w(se),I(se)},onBlur:()=>C(N,"address",T),required:he,"aria-required":he||void 0,error:we},N);default:return null}}function W(z,T){const N=z.some(ge=>String(ge.key)==="years_at_address"),ie=z.find(ge=>String(ge.key)==="months_at_address");return z.map((ge,Se)=>{const he=String(ge.key);if(he==="months_at_address"&&N||!qc(ge,A,E)||!ch(ge,A,T)||!Yc(ge,A,c))return null;if(dh(he,ge,A,c)){const be=E.currentCarrierKey?A[E.currentCarrierKey]:void 0;if(!(be&&be!=="NoPriorInsurance"&&Xo(A,E)&&sh.has(he)))return null}const we=U(ge,T),Ie=he==="years_at_address"&&ie?U(ie,T):null,me=ge.conditionals??[];if(!me.length)return c==="BundlePolicy"&&he==="policy_bi"?v.jsxs("div",{className:uh(he,c,T),"data-question-key":he,children:[v.jsx("h3",{className:"text-lg font-semibold mt-6 mb-3",children:"Vehicle Coverage Information"}),we]},`wrap-${he}-${Se}`):v.jsxs("div",{className:uh(he,c,T),"data-question-key":he,children:[we,Ie]},`wrap-${he}-${Se}`);const De=w3(ge,rn(A,T,he)),se=me.filter(be=>ms(De,be.conditionalType,be.conditionalValue)),_e=se.length>1&&!se.some(be=>be.conditionalQuestionsAllowMultiple)?se.slice(0,1):se;return v.jsxs("div",{className:uh(he,c,T),"data-question-key":he,children:[we,Ie,_e.map((be,xe)=>{const $e=be.conditionalQuestions??[];if(!$e.length)return null;if(!be.conditionalQuestionsAllowMultiple)return v.jsx("div",{className:"mt-3",children:W($e,T)},`branch-${he}-${xe}`);const Me=Pc(he),re=Es(A,[...T??[],Me])??[],oe=Math.max(1,re.length||1),Ce=()=>{const Re=tr(A,[...T??[],Me,re.length],{});n&&i?i(Re):w(Re),I(Re)},Ee=()=>{const Re=re.slice(0,Math.max(0,re.length-1)),ke=tr(A,[...T??[],Me],Re);n&&i?i(ke):w(ke),I(ke)},Te=`${he}__c${xe}`;return v.jsxs("div",{className:"mt-3",children:[v.jsxs("div",{className:"repeatable-controls flex items-center justify-between mb-2 gap-2",children:[v.jsx("div",{className:"text-sm font-medium opacity-75",children:"Add one or more entries"}),v.jsxs("div",{className:"repeatable-actions space-x-2",children:[v.jsx("button",{type:"button",className:"btn-outline px-3 py-1",onClick:Ce,children:"Add another"}),oe>1&&v.jsx("button",{type:"button",className:"btn-outline px-3 py-1",onClick:Ee,children:"Remove last"})]})]}),Array.from({length:oe}).map((Re,ke)=>{const qe=[...T??[],Me,ke],Ue=`${Te}__i${ke}`,ze=re[ke]??{},tt=he==="drivers",Ye=tt?`Driver #${ke+1}`:he==="vehicles"?`Vehicle #${ke+1}`:he==="home_losses"||he==="losses"?`Loss #${ke+1}`:`Entry #${ke+1}`,ml=tt&&typeof ze.ssn_display=="string"&&ze.ssn_display?` — ${ze.ssn_display}`:"";return v.jsxs("div",{className:"rounded-lg border p-3 mb-3",children:[v.jsxs("div",{className:"text-sm font-semibold mb-2",children:[Ye,ml]}),$e.map(Nn=>{const gr=String(Nn.key);if(!qc(Nn,A,E)||!ch(Nn,A,qe)||!Yc(Nn,A,c))return null;if(dh(gr,Nn,A,c)){const Mn=E.currentCarrierKey?A[E.currentCarrierKey]:void 0;if(!(Mn&&Mn!=="NoPriorInsurance"&&Xo(A,E)&&sh.has(gr)))return null}return v.jsxs("div",{className:"mt-3",children:[U(Nn,qe),(()=>{const Mn=Nn.conditionals??[];if(!Mn.length)return null;const ri=rn(A,qe,Nn.key),Vn=Mn.filter(Rn=>ms(ri,Rn.conditionalType,Rn.conditionalValue));return(Vn.length>1&&!Vn.some(Rn=>Rn.conditionalQuestionsAllowMultiple)?Vn.slice(0,1):Vn).map((Rn,hl)=>{const Qi=Rn.conditionalQuestions??[];if(!Qi.length)return null;if(!Rn.conditionalQuestionsAllowMultiple)return v.jsx("div",{className:"mt-3",children:W(Qi,qe)},`nested-${Ue}-${hl}`);const ua=Pc(Nn.key),br=Es(A,[...qe,ua])??[],Js=Math.max(1,br.length||1),Xs=()=>{const Tr=tr(A,[...qe,ua,br.length],{});n&&i?i(Tr):w(Tr),I(Tr)},eu=()=>{const Tr=br.slice(0,Math.max(0,br.length-1)),dr=tr(A,[...qe,ua],Tr);n&&i?i(dr):w(dr),I(dr)};return v.jsxs("div",{className:"mt-3",children:[v.jsxs("div",{className:"repeatable-controls flex items-center justify-between mb-2 gap-2",children:[v.jsx("div",{className:"text-sm font-medium opacity-75",children:"Add one or more entries"}),v.jsxs("div",{className:"repeatable-actions space-x-2",children:[v.jsx("button",{type:"button",className:"btn-outline px-3 py-1",onClick:Xs,children:"Add another"}),Js>1&&v.jsx("button",{type:"button",className:"btn-outline px-3 py-1",onClick:eu,children:"Remove last"})]})]}),Array.from({length:Js}).map((Tr,dr)=>{const yl=[...qe,ua,dr];return v.jsxs("div",{className:"rounded-lg border p-3 mb-3",children:[v.jsxs("div",{className:"text-sm font-semibold mb-2",children:["Entry #",dr+1]}),W(Qi,yl)]},`nested-item-${Ue}-${hl}-${dr}`)})]},`nested-repeat-${Ue}-${hl}`)})})()]},`${Ue}-${gr}`)})]},`group-${Ue}`)})]},`branch-${he}-${xe}`)})]},`wrap-${he}-${Se}`)})}const Y=b.useMemo(()=>{const z=[],T=(N,ie)=>{N.forEach(ge=>{if(!qc(ge,A,E)||!ch(ge,A,ie)||!Yc(ge,A,c))return;const Se=String(ge.key);if(dh(Se,ge,A,c)){const De=E.currentCarrierKey?A[E.currentCarrierKey]:void 0;if(!(De&&De!=="NoPriorInsurance"&&Xo(A,E)&&sh.has(Se)))return}Jc(ge)||z.push(ge);const he=ge.conditionals??[];if(!he.length)return;const we=w3(ge,rn(A,ie,Se)),Ie=he.filter(De=>ms(we,De.conditionalType,De.conditionalValue));(Ie.length>1&&!Ie.some(De=>De.conditionalQuestionsAllowMultiple)?Ie.slice(0,1):Ie).forEach(De=>{const se=De.conditionalQuestions??[];se.length&&(De.conditionalQuestionsAllowMultiple||T(se,ie))})})};return T(g),z},[g,A,E,c]);b.useEffect(()=>{if(d<=0)return;const z=xs(A,E),T=Y.map(N=>Kc(N,E)?{...N,required:z}:N);M(Fs(T,A))},[d,Y,A,E]);function te(z){z.preventDefault();const T=xs(A,E),N=Y.map(ge=>Kc(ge,E)?{...ge,required:T}:ge),ie=Fs(N,A);if(M(ie),Object.keys(ie).length>0){const ge=Y.findIndex(Se=>ie[Se.key]);ge>=0&&document.getElementById(Y[ge].key)?.focus();return}o(A)}return v.jsx("form",{className:cj(c),"data-form-area":c??"unknown-stage",onSubmit:te,noValidate:!0,children:W(g)})}function O3({title:e,description:t,applyLabel:n,dismissLabel:i,alreadyOnApplicationNote:o,suggestions:s,isApplying:c,onApply:d,onDismiss:m}){const[h,y]=b.useState(new Set),g=s.length>0&&s.every(x=>h.has(x.id)),E=b.useMemo(()=>s.some(x=>x.alreadyOnApplication),[s]),S=x=>{y(w=>{const R=new Set(w);return R.has(x)?R.delete(x):R.add(x),R})},D=()=>{y(g?new Set:new Set(s.map(x=>x.id)))};return v.jsxs("div",{className:"prefill-suggestions-modal fixed inset-0 z-[10000] flex items-center justify-center p-4",role:"dialog","aria-modal":"true","aria-labelledby":"prefill-suggestions-title",children:[v.jsx("div",{className:"backdrop","aria-hidden":"true"}),v.jsxs("div",{className:"modal-panel bg-white relative w-full max-w-lg max-h-[85vh] overflow-y-auto",role:"document",children:[v.jsxs("div",{className:"text-center mb-6",children:[v.jsx("h2",{id:"prefill-suggestions-title",className:"h1-title",children:e}),v.jsx("p",{className:"text-sm text-slate-600 mt-3",children:t})]}),v.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 text-left mb-4",children:[s.map(x=>v.jsx(ji,{id:`prefill-suggestion-${x.id}`,label:x.alreadyOnApplication?`${x.label} *`:x.label,checked:h.has(x.id),disabled:c,onChange:()=>S(x.id)},x.id)),s.length>1&&v.jsx(ji,{id:"prefill-suggestion-select-all",label:"Select All",checked:g,disabled:c,onChange:D})]}),E&&v.jsx("p",{className:"text-xs text-slate-500 mb-4 text-left",children:o??"* This entry is already on the application; selecting it will fill in available data that does not exist on the application."}),v.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 mt-6",children:[v.jsx("button",{type:"button","data-widget-ctrl":"prefill-dismiss",onClick:m,disabled:c,className:"credify-btn-back h-12 rounded-full border border-gray-300 text-text-primary hover:bg-gray-50 transition disabled:opacity-50 disabled:cursor-not-allowed",children:i}),v.jsxs("button",{type:"button","data-widget-ctrl":"prefill-apply",onClick:()=>d(Array.from(h)),disabled:h.size===0||c,className:["form-wizard-next-btn","h-12 rounded-full text-white transition","disabled:opacity-50 disabled:cursor-not-allowed","flex items-center justify-center gap-2",h.size===0||c?"bg-gray-300":"bg-blue-600 hover:bg-blue-600/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-600/40 bg-primary hover:bg-primary/90 focus-visible:ring-primary/40"].join(" "),children:[c&&v.jsxs("svg",{className:"animate-spin h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","aria-hidden":"true",children:[v.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),v.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),n]})]})]})]})}const Dj="https://getcredify.com/privacy-policy";function $j(){return v.jsx("a",{href:Dj,target:"_blank",rel:"noopener noreferrer",className:"credify-link-underline",children:"Privacy Policy"})}function k3(){return v.jsxs(v.Fragment,{children:["See our ",v.jsx($j,{})," for how we use your information."]})}const xj=new Set(["Product","Name","Home","HomeConstruction","HomeFeatures","Vehicle","Driver","Demographics","Customer","HomeCustomer","BundleCustomer"]),Cj=new Set(["AutoCurrentCarrier","HomeCurrentCarrier","HomePolicy","BundlePolicy","AutoPolicy"]);function Aj(e){return e.trim().replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()}function jo(e){return`stage-footer-hint stage-footer-hint--${Aj(e)}`}function k5({stageKey:e}){return e?e==="Zip"?v.jsx("p",{className:jo(e),"data-stage-key":e,children:"No credit card required."}):e==="Email"?v.jsxs("div",{className:jo(e),"data-stage-key":e,children:[v.jsx("p",{children:"We'll send your quotes and updates here, and save your progress so you can return anytime."}),v.jsx("p",{children:v.jsx(k3,{})})]}):Cj.has(e)?v.jsx("p",{className:jo(e),"data-stage-key":e,children:"Tell us about your current coverage. Carriers ask about your coverage history to put together accurate quotes — it's a standard step on any application. Coverage gaps are common, so just enter things as they are. You're almost there: your quotes are almost ready."}):e==="Ssn"?v.jsx("p",{className:jo(e),"data-stage-key":e,children:"Your SSN is required by some carriers for fraud prevention, underwriting and to generate a quote. It's entered directly into our secure, encrypted form."}):e==="SMSVerification"?v.jsx("p",{className:jo(e),"data-stage-key":e,children:"You'll receive a text from Credify shortly."}):xj.has(e)?v.jsx("p",{className:jo(e),"data-stage-key":e,children:v.jsx(k3,{})}):null:null}function B5(e){const t=new Map,n=new Map,i=o=>{let s=t.get(o);return s||(s=e(o).then(c=>(n.set(o,c.suggestions),c.suggestions)).catch(c=>{throw t.delete(o),c}),t.set(o,s)),s};return{fetch:i,peek:o=>n.get(o),prefetch:o=>{i(o).catch(()=>{})},reset:()=>{t.clear(),n.clear()}}}const Cy=B5(rj),Ay=B5(oj),wj=Cy.fetch,Tj=Cy.peek,Nj=Cy.prefetch,Mj=Ay.fetch,Rj=Ay.peek,Oj=Ay.prefetch,kj=["vin","year","make","model"];function Bj(e){if(!e||typeof e!="object")return!0;const t=e;return kj.every(n=>{const i=t[n];return i==null||String(i).trim()===""})}function Lj(e,t){if(t.length===0)return e;const n=e.vehicles__items??[],i=n.filter(c=>!Bj(c)),o=new Set(i.map(c=>String(c.vin??"").trim().toUpperCase()).filter(c=>c!=="")),s=t.filter(c=>{const d=String(c.vin??"").trim().toUpperCase();return d===""||!o.has(d)});return s.length===0&&i.length===n.length?e:{...e,vehicles:"Yes",vehicles__items:[...i,...s]}}const Pj=["first_name","last_name","date_of_birth"];function L5(e){if(!e||typeof e!="object")return!0;const t=e;return Pj.every(n=>{const i=t[n];return i==null||String(i).trim()===""})}function B3(e){return`${String(e.first_name??"").trim()} ${String(e.last_name??"").trim()}`.trim().toUpperCase()}function Ij(e,t){if(t.length===0)return e;const n=e.drivers__items??[],i=n.filter(c=>!L5(c)),o=new Set(i.map(B3).filter(c=>c!=="")),s=t.filter(c=>{const d=B3(c);return d===""||!o.has(d)});return s.length===0&&i.length===n.length?e:{...e,drivers:"Yes",drivers__items:[...i,...s]}}function Fj(e){return(e.drivers__items??[]).some(n=>!L5(n))}const jj=["widgetOpened","widgetClosed","stageViewed","stageCompleted","flowCompleted","ratesViewed","ratesBack","submissionFailed"],$d={};function zj(e){let t=$d[e];return t||(t=new Set,$d[e]=t),t}function P5(e,t){zj(e).add(t)}function I5(e,t){$d[e]?.delete(t)}function ni(e,...t){const n=$d[e];if(!n||n.size===0)return;const i=t[0],o={quoteId:rf(),timestamp:Date.now()};for(const s of[...n])try{s(i,o)}catch(c){Ld(c,{tags:{source:"widget-event-listener",event:e}})}}function Uj(){ni("widgetOpened")}function Hj(){ni("widgetClosed")}function Vj(e){ni("stageViewed",e)}function L3(e){ni("stageCompleted",e)}function Gj(){ni("flowCompleted")}function Zj(e){ni("ratesViewed",e)}function Yj(){ni("ratesBack")}function ps(e){ni("submissionFailed",e)}const F5=new Set(["Disabled","Retired","Unemployed","Other"]);function qj(e,t){const n=String(e.key??"");if(n==="co_applicant_occupation"||n!=="occupation")return!0;const i=t.industry,o=t.employment_industry,s=String(i??o??"").trim();return!F5.has(s)}function Kj(e,t){const n=String(e.key??"");if(n==="co_applicant_occupation"||n!=="occupation")return!0;const i=t.industry,o=t.employment_industry,s=String(i??o??"").trim();return!F5.has(s)}function j5(e){return e.inputType!=="radio"||!e.options||e.options.length!==1||e.options[0]!=="Yes"?!1:(e.conditionals??[]).some(n=>n.conditionalQuestionsAllowMultiple&&n.conditionalType==="equals"&&n.conditionalValue==="Yes")}function wy(e,t){return j5(e)?"Yes":t}function P3(e){return typeof e=="number"&&Number.isFinite(e)?e:typeof e=="string"&&e.trim()!==""&&!Number.isNaN(Number(e))?Number(e):null}function I3(e){if(e instanceof Date&&!Number.isNaN(e.getTime()))return e.getTime();if(typeof e=="string"){const t=Date.parse(e);return Number.isNaN(t)?null:t}return null}function F3(e,t){const n=P3(e),i=P3(t);if(n!=null&&i!=null)return n-i;const o=I3(e),s=I3(t);return o!=null&&s!=null?o-s:e==null||t==null?null:String(e).localeCompare(String(t))}function Wj(e,t){return Array.isArray(e)?e.some(n=>n===t):typeof e=="string"?t!=null&&e.includes(String(t)):!1}function Ty(e,t,n){switch(t){case"equals":return e===n;case"notEquals":return e!==n&&e!==""&&e!=null;case"lessThan":{const i=F3(e,n);return i!=null&&i<0}case"greaterThan":{const i=F3(e,n);return i!=null&&i>0}case"contains":return Wj(e,n);case"startsWith":return e!=null&&n!=null&&String(e).startsWith(String(n));case"endsWith":return e!=null&&n!=null&&String(e).endsWith(String(n));default:return!1}}const Qj=new Set(["auto_prior_years","auto_prior_months","auto_continuous_coverage_years"]);function Jj(e){return String(e??"").trim().replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()}function of(e,t,n){const i=py([...e]),o=Dy(i),s=[],c=d=>{d.forEach(m=>{if(!qc(m,t,o)||!qj(m,t)||!Yc(m,t,n))return;const h=String(m.key);if(nf(h,n,t)){const D=o.currentCarrierKey?t[o.currentCarrierKey]:void 0;if(!(D&&D!=="NoPriorInsurance"&&Xo(t,o)&&Qj.has(h)))return}j5(m)||s.push(m);const y=wy(m,t[h]),g=m.conditionals??[];if(!g.length)return;const E=g.filter(D=>Ty(y,D.conditionalType,D.conditionalValue));(E.length>1&&!E.some(D=>D.conditionalQuestionsAllowMultiple)?E.slice(0,1):E).forEach(D=>{const x=D.conditionalQuestions??[];x.length&&(D.conditionalQuestionsAllowMultiple||c(x))})})};return c(i),s}const z5="__items",xd=e=>`${e}${z5}`;function Xj(e,t){if(e.key==="relationship_to_insured"||e.key==="is_registered_owner"){const n=t[t.length-1];return typeof n=="number"&&n===0}return!1}function Cd(e,t,n,i=[],o=void 0,s=t){for(const c of e){const d=String(c.key),m=wy(c,t[d]),h=c.conditionals??[];if(!h.length)continue;const y=h.filter(E=>Ty(m,E.conditionalType,E.conditionalValue)),g=y.length>1&&!y.some(E=>E.conditionalQuestionsAllowMultiple)?y.slice(0,1):y;for(const E of g){const S=E.conditionalQuestions??[];if(!S.length)continue;if(!E.conditionalQuestionsAllowMultiple){Cd(S,t,n,i,o,s);continue}if(nf(d,o,s))continue;const D=t[xd(d)]??[];if(D.length===0){n.push({groupKey:d,index:-1,fieldKey:"",fieldLabel:"",message:"At least one entry is required"});continue}for(const[x,w]of D.entries()){const R=[...i,xd(d),x],I=of(S,w,o).filter(Z=>!(Xj(Z,R)||!Kj(Z,w))),A={state:s.state,...w},L=Fs(I,A),M=new Map(I.map((Z,V)=>[Ya(Z,V),Z.question??""]));for(const[Z,V]of Object.entries(L))V&&n.push({groupKey:d,index:x,fieldKey:Z,fieldLabel:M.get(Z)??Z,message:V});Cd(S,w,n,R,o,s)}}}}function ez(e,t,n){const i=[];return Cd(e,t,i,[],n,t),i}function tz(e,t,n){const i=[];return Cd(e,t,i,[],n,t),i.length>0}function v0(e,t,n,i){for(const o of e){const s=String(o.key),c=wy(o,t[s]),d=o.conditionals??[];if(!d.length)continue;const m=d.filter(y=>Ty(c,y.conditionalType,y.conditionalValue)),h=m.length>1&&!m.some(y=>y.conditionalQuestionsAllowMultiple)?m.slice(0,1):m;for(const y of h){const g=y.conditionalQuestions??[];if(!g.length)continue;if(!y.conditionalQuestionsAllowMultiple){v0(g,t,n,i);continue}if(nf(s,n,t))continue;const E=t[xd(s)]??[];for(const[S,D]of E.entries())typeof D!="object"||D===null||(i(of(g,D,n),D,{groupKey:s,index:S}),v0(g,D,n,i))}}}function U5(e){const t=e.vehicles__items??[];if(!Array.isArray(t)||t.length===0)return!1;for(const n of t)if(Cr(n.vehicle_comp_deductible,"select")||Cr(n.vehicle_coll_deductible,"select")||Cr(n.vehicle_towing_and_labor,"select")||Cr(n.vehicle_transportation_expense,"select"))return!0;return!1}function j3({targetStage:e,stageKey:t,quoteId:n,fetchSuggestions:i,peekSuggestions:o,applySelection:s,dismissSelection:c,mergeItems:d,setAllValues:m,shouldSkip:h}){const[y,g]=b.useState(null),[E,S]=b.useState(!1),[D,x]=b.useState(!1),w=b.useRef(new Set);return b.useEffect(()=>{if(t!==e||!n||w.current.has(n))return;if(h?.()){w.current.add(n);return}const A=o(n);if(A!==void 0){A.length>0?g(A):w.current.add(n);return}let L=!1;return x(!0),i(n).then(M=>{M.length===0&&w.current.add(n),!L&&M.length>0&&g(M)}).catch(()=>{w.current.add(n)}).finally(()=>{L||x(!1)}),()=>{L=!0,x(!1)}},[t,n,e]),{suggestions:y,isApplying:E,isPending:D,handleApply:async A=>{if(n){S(!0);try{const{items:L}=await s(n,A);L.length>0&&m(M=>d(M,L))}catch{}finally{w.current.add(n),S(!1),g(null)}}},handleDismiss:()=>{n&&(w.current.add(n),c(n).catch(()=>{})),g(null)}}}function nz({stages:e,onStageComplete:t,onComplete:n,initialValues:i,initialActive:o,quoteId:s,nonTerminalStageKeys:c}){const[d,m]=b.useState(o??0),[h,y]=b.useState(i??{}),[g,E]=b.useState({}),[S,D]=b.useState(!1),[x,w]=b.useState(!1),[R,I]=b.useState(null),[A,L]=b.useState(0),[M,Z]=b.useState([]),[V,fe]=b.useState(o??0),ne=b.useRef({}),pe=b.useRef([]),J=b.useRef(null),ye=b.useRef(e),Ae=Array.isArray(e)&&e.length>0,j=Ae?Math.min(d,e.length-1):0,de=Ae?e[j]:null,k=de?.key??null,B=b.useRef(h);B.current=h;const X=j3({targetStage:"Vehicle",stageKey:k,quoteId:s,fetchSuggestions:wj,peekSuggestions:Tj,applySelection:aj,dismissSelection:ij,mergeItems:Lj,setAllValues:y}),F=j3({targetStage:"Driver",stageKey:k,quoteId:s,fetchSuggestions:Mj,peekSuggestions:Rj,applySelection:lj,dismissSelection:sj,mergeItems:Ij,setAllValues:y,shouldSkip:()=>Fj(B.current)}),G=k==="Vehicle"&&X.isPending||k==="Driver"&&F.isPending;b.useEffect(()=>{o!==void 0&&(m(o),fe(he=>Math.max(he,o)))},[o]),ye.current=e;const C=b.useMemo(()=>{const he=j>=e.length-1;return he&&k&&c?.has(k)?!1:!!(he||e.slice(j+1).every(Ie=>Ie.key==="AutoPolicy")&&(h.drivers__items??[]).length<=1)},[j,e,h,k,c]);b.useEffect(()=>{Ae&&d>=e.length&&m(e.length-1)},[d,e.length,Ae]),b.useEffect(()=>{L(0),Z([])},[k]),b.useEffect(()=>{const he=pe.current[j];he&&he.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[j]),b.useEffect(()=>{i!==void 0&&y(i)},[i]),b.useEffect(()=>{if(!de||!k){D(!1),I(null);return}if(g[k]){D(!1),I(null);return}let he=!1;return D(!0),I(null),Promise.resolve(de.loadQuestions()).then(we=>{if(!he){if(!Array.isArray(we))throw new Error(`loadQuestions("${k}") did not return an array`);E(Ie=>({...Ie,[k]:we}))}}).catch(we=>{he||I(`Failed to load stage "${de?.title??""}": ${we?.message??"Unknown error"}`)}).finally(()=>{he||D(!1)}),()=>{he=!0}},[de,k,g]);const U=k?g[k]:void 0,W=b.useMemo(()=>Dy(py(U??[])),[U]);b.useEffect(()=>{de&&k&&U&&Vj({stageKey:k,stageTitle:de.title??k,stepIndex:d+1,totalSteps:e.length})},[k,d,e.length,de,U]);const Y=b.useMemo(()=>{if(!U)return{};const he={};(me=>{const De=[],se=_e=>{_e.forEach((be,xe)=>{const $e=Ya(be,xe);De.push($e);const Me=xd($e);De.push(Me),(be.conditionals??[]).forEach(oe=>{const Ce=oe.conditionalQuestions??[];Ce.length>0&&se(Ce)})})};return se(me),De})(U).forEach(me=>{me in h&&(he[me]=h[me])});for(const me of["state","State","address","product"])me in h&&(he[me]=h[me]);for(const[me,De]of Object.entries(h))me.endsWith(z5)&&!(me in he)&&(he[me]=De);return he},[U,h]),te=he=>{y(we=>({...we,...he}))},z=()=>{m(he=>he>0?he-1:0),document.querySelector(".panel-body")?.scrollTo({top:0,behavior:"instant"})},T=he=>{he<0||he>=e.length||he>V||he===j||(m(he),document.querySelector(".panel-body")?.scrollTo({top:0,behavior:"instant"}))},N=async()=>{if(!U||!de||S||R||x||G)return;const he=of(U,Y,k??void 0),we=xs(h,W),Ie=he.map(Ee=>Kc(Ee,W)?{...Ee,required:we}:Ee),me=Fs(Ie,Y),De=new Set(Ie.map((Ee,Te)=>Ya(Ee,Te))),se=Object.entries(me).some(([Ee,Te])=>Te&&De.has(Ee)),_e=tz(U,h,k??void 0),xe=he.some(Ee=>String(Ee.key??"")==="vehicle_policy_selections")?U5(h):!1,$e=h.driver_vehicle_assignments,Me=h.drivers__items??[];let re=!1;if($e&&Me.length>=2){const Ee=h.vehicles__items??[];for(let Te=0;Te<Ee.length;Te++){const Re=$e[`v${Te}`];if(!Re)continue;const ke=Me.map((ze,tt)=>Re[`d${tt}`]??0),qe=ke.filter(ze=>ze>0);if(qe.length>=2&&qe.every(ze=>ze===50)){re=!0;break}const Ue=ke.reduce((ze,tt)=>ze+tt,0);if(Ue>0&&Ue!==100){re=!0;break}}}if(se||_e||xe||re){const Ee=new Map(Ie.map((ke,qe)=>[Ya(ke,qe),ke])),Re=[...Object.entries(me).filter(([ke,qe])=>!!qe&&De.has(ke)).map(([ke,qe])=>{const Ue=qe,ze=Ee.get(ke)?.question;return Ue==="Required"&&ze?`${ze} is required`:Ue}),_e?"Complete all required repeated entries before continuing.":null,xe?"Complete the vehicle policy selections before continuing.":null,re?"Driver usage percentages must be valid before continuing.":null].filter(ke=>!!ke);L(ke=>ke+1),Z(Re.length>0?Re:["Review the highlighted fields before continuing."]),window.setTimeout(()=>{J.current?.focus()},0);return}Z([]);const oe=JSON.stringify(Y);if(!C&&j<V&&ne.current[k??""]===oe){m(Ee=>Math.min(Ee+1,e.length-1)),document.querySelector(".panel-body")?.scrollTo({top:0,behavior:"instant"});return}w(!0);try{const Ee=C,Te=Ee?await n(h,k??""):await t(Y,k??""),{success:Re,error:ke}=Te;if(!Re){I(ke??"An error occurred");return}if(!Ee){const qe=Te.latestStages??ye.current,Ue=qe.findIndex(tt=>tt.key===k),ze=Ue>=0?Math.min(Ue+1,qe.length-1):Math.min(d+1,qe.length-1);ne.current[k??""]=oe,fe(tt=>Math.max(tt,ze)),m(ze)}}finally{w(!1)}},ie=b.useMemo(()=>!!(!U||S||R||x||G),[U,S,R,x,G]),ge=e.length>0?(j+1)/e.length*100:0,Se=Jj(k??"unknown-stage");return Ae?v.jsxs("div",{className:`form-wizard-shell form-wizard-shell--${Se}`,"data-stage-key":k??void 0,children:[k==="Vehicle"&&X.suggestions&&X.suggestions.length>0&&v.jsx(O3,{title:"Select your vehicles",description:"We found the vehicles below at your address. Select the ones you'd like to add to your quote, or add them manually.",applyLabel:"Add selected vehicles",dismissLabel:"Add manually",alreadyOnApplicationNote:"* This vehicle is already on the application; selecting it will fill in available data that does not exist on the application.",suggestions:X.suggestions,isApplying:X.isApplying,onApply:X.handleApply,onDismiss:X.handleDismiss}),k==="Driver"&&F.suggestions&&F.suggestions.length>0&&v.jsx(O3,{title:"Additional drivers",description:"We found the drivers below at your address. Select the ones you'd like to add to your quote, or add them manually.",applyLabel:"Add selected drivers",dismissLabel:"Add manually",alreadyOnApplicationNote:"* This driver is already on the application; selecting them will fill in available data that does not exist on the application.",suggestions:F.suggestions,isApplying:F.isApplying,onApply:F.handleApply,onDismiss:F.handleDismiss}),v.jsx("div",{className:`form-wizard-steps-header form-wizard-steps-header--${Se}`,children:v.jsx("div",{className:"form-wizard-steps-scroll",children:v.jsx("ol",{className:"form-wizard-steps flex gap-2 text-xs overflow-x-auto flex-1 pb-1 scrollbar-hide items-center",style:{scrollbarWidth:"none",msOverflowStyle:"none"},tabIndex:0,"aria-label":"Quote steps",children:e.flatMap((he,we)=>[v.jsx("li",{ref:Ie=>{pe.current[we]=Ie},className:"flex-shrink-0",children:v.jsx("button",{type:"button",className:"form-wizard-step-pill px-2.5 py-1 rounded-full border whitespace-nowrap","data-step-state":we<j?"complete":we===j?"current":"upcoming",onClick:()=>T(we),disabled:we>V,"aria-current":we===j?"step":void 0,"aria-label":`${he.title}, step ${we+1} of ${e.length}${we>V?", not available yet":""}`,children:he.title})},he.key??`stage-${we}`),...we<e.length-1?[v.jsx("li",{className:"form-wizard-step-arrow text-slate-400 flex-shrink-0","aria-hidden":"true",children:"›"},`arrow-${he.key??we}`)]:[]])})})}),v.jsxs("div",{className:`form-wizard-card form-wizard-card--${Se}`,style:{"--form-wizard-progress":`${ge}%`},children:[v.jsxs("div",{className:`form-wizard-content form-wizard-content--${Se}`,children:[S&&v.jsx("div",{className:"text-slate-500",role:"status","aria-live":"polite",children:"Loading…"}),G&&v.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",role:"status","aria-live":"polite",children:[v.jsxs("svg",{className:"animate-spin h-8 w-8 text-blue-600 mb-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","aria-hidden":"true",children:[v.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),v.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),v.jsx("div",{className:"text-text-primary font-semibold",children:k==="Driver"?"Looking up additional drivers at your address…":"Looking up vehicles at your address…"}),v.jsx("div",{className:"text-sm text-slate-500 mt-1",children:"This can take a few moments."})]}),!G&&M.length>0&&v.jsxs("div",{ref:J,className:"mb-4 rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700",role:"alert",tabIndex:-1,children:[v.jsx("p",{className:"font-semibold",children:"Please fix the following before continuing:"}),v.jsx("ul",{className:"mt-2 list-disc space-y-1 pl-5",children:M.map((he,we)=>v.jsx("li",{children:he},`${he}-${we}`))})]}),de&&!G&&v.jsx(O5,{questions:U??[],controlledValues:Y,onChangeValues:te,onSubmit:()=>N(),quoteId:s,widgetStageKey:k??void 0,validationAttempt:A},de.key),!S&&R&&v.jsxs("div",{className:"text-red-600 text-sm -mt-4",role:"alert",children:[v.jsx("div",{children:R}),de&&v.jsx("button",{type:"button",className:"credify-retry-btn underline mt-1 font-bold",onClick:()=>{E(he=>{if(!k)return he;const we={...he};return delete we[k],we})},children:"Retry"})]}),v.jsx(k5,{stageKey:k})]}),v.jsxs("div",{className:j>0?"form-wizard-actions grid grid-cols-2 gap-3":"form-wizard-actions",children:[j>0&&v.jsx("button",{type:"button",onClick:z,disabled:S,className:"credify-btn-back h-12 rounded-full border border-gray-300 text-text-primary hover:bg-gray-50 transition",children:"Back"}),v.jsxs("button",{type:"button","data-widget-ctrl":"next",onClick:N,disabled:ie,className:["form-wizard-next-btn",j>0?"":"w-full","h-12 rounded-full text-white transition","disabled:opacity-50 disabled:cursor-not-allowed","flex items-center justify-center gap-2",ie?"bg-gray-300":"bg-blue-600 hover:bg-blue-600/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-600/40 bg-primary hover:bg-primary/90 focus-visible:ring-primary/40"].join(" "),children:[x&&v.jsxs("svg",{className:"animate-spin h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[v.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),v.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),C?"Finish":"Next"]})]})]})]}):v.jsx("div",{className:"text-slate-600",children:"Loading..."})}const H5={SafecoPersonal:{name:"Safeco",abbr:"SFC",color:"#0F337A"},SafecoPersoanl:{name:"Safeco",abbr:"SFC",color:"#0F337A"},AssuranceAmerica:{name:"Assurance America",abbr:"AA",color:"#2768B5"},CommonWealthCasualty:{name:"Commonwealth Casualty",abbr:"CW",color:"#2D69EC"},Alinsco:{name:"Alinsco",abbr:"AL",color:"#20395D"},ACORDBOLTPersonalAuto:{name:"Bolt Auto",abbr:"BLT",color:"#1F2937"},ACORDBOLTPersonalHome:{name:"Bolt Home",abbr:"BLT",color:"#1F2937"},TwentyFirstCentury:{name:"21st Century",abbr:"21C",color:"#B2392A"},ACentral:{name:"A-Central",abbr:"ACT",color:"#EAAD1D"},AAA:{name:"AAA",abbr:"AAA",color:"#DB461C"},AARP:{name:"AARP",abbr:"ARP",color:"#DB4724"},Acadia:{name:"Acadia",abbr:"ACD",color:"#386B61"},Ace:{name:"ACE",abbr:"ACE",color:"#457D48"},Acuity:{name:"Acuity",abbr:"ACU",color:"#D74630"},AdirondackInsExchange:{name:"Adirondack",abbr:"ADK",color:"#1F5490"},Aegis:{name:"Aegis",abbr:"AEG",color:"#1A4675"},AIC:{name:"AIC",abbr:"AIC",color:"#508F47"},AIG:{name:"AIG",abbr:"AIG",color:"#223572"},AlfaAlliance:{name:"Alfa Alliance",abbr:"ALF",color:"#C13D17"},AllianzOfAmerica:{name:"Allianz",abbr:"ALZ",color:"#003781"},AllianzOfAmericaJefferson:{name:"Allianz Jefferson",abbr:"ALZ",color:"#003781"},Allied:{name:"Allied",abbr:"ALD",color:"#0047BB"},Allmerica:{name:"Allmerica",abbr:"ALM",color:"#003DA5"},Allstate:{name:"Allstate",abbr:"ALS",color:"#002F87"},AmericaFirst:{name:"America First",abbr:"AMF",color:"#003DA5"},AmericanCommerce:{name:"American Commerce",abbr:"ACM",color:"#003DA5"},AmericanFamily:{name:"American Family",abbr:"AMF",color:"#0033A0"},Amica:{name:"Amica",abbr:"AMI",color:"#003DA5"},Ameriprise:{name:"Ameriprise",abbr:"AMP",color:"#003DA5"},ASILloyds:{name:"ASI Lloyds",abbr:"ASI",color:"#003DA5"},Assurant:{name:"Assurant",abbr:"ASR",color:"#0033A0"},AtlasGeneralAgency:{name:"Atlas General",abbr:"ATL",color:"#1F3864"},AustinMutual:{name:"Austin Mutual",abbr:"AUS",color:"#1F3864"},Autoone:{name:"AutoOne",abbr:"AON",color:"#003DA5"},AutoOwners:{name:"Auto-Owners",abbr:"AO",color:"#C8102E"},BadgerMutual:{name:"Badger Mutual",abbr:"BDG",color:"#003DA5"},Balboa:{name:"Balboa",abbr:"BAL",color:"#1F3864"},Bamboo:{name:"Bamboo",abbr:"BMB",color:"#0F4C3A"},Bankers:{name:"Bankers",abbr:"BNK",color:"#1F3864"},BeaconNational:{name:"Beacon National",abbr:"BCN",color:"#003DA5"},BrethernMutual:{name:"Brethren Mutual",abbr:"BRT",color:"#1F3864"},BristolWest:{name:"Bristol West",abbr:"BW",color:"#003DA5"},BunkerHill:{name:"Bunker Hill",abbr:"BHL",color:"#1F3864"},CapitalInsuranceGroup:{name:"Capital Insurance",abbr:"CIG",color:"#003DA5"},Celina:{name:"Celina",abbr:"CEL",color:"#1F3864"},CentralMutualOfOH:{name:"Central Mutual",abbr:"CMO",color:"#003DA5"},Chubb:{name:"Chubb",abbr:"CHB",color:"#000000"},ChubbInsurance:{name:"Chubb",abbr:"CHB",color:"#000000"},Cincinnati:{name:"Cincinnati",abbr:"CIN",color:"#003DA5"},Citizens:{name:"Citizens",abbr:"CTZ",color:"#003DA5"},Clearcover:{name:"Clearcover",abbr:"CC",color:"#00B5E2"},CNA:{name:"CNA",abbr:"CNA",color:"#CC3232"},ColonialPenn:{name:"Colonial Penn",abbr:"CPN",color:"#0072CE"},ColoradoCasualty:{name:"Colorado Casualty",abbr:"COC",color:"#1F3864"},Columbia:{name:"Columbia",abbr:"CLM",color:"#003DA5"},CommerceWest:{name:"Commerce West",abbr:"CMW",color:"#003DA5"},CommonwealthCasualty:{name:"Commonwealth Casualty",abbr:"CW",color:"#1F3864"},ConstitutionalCasualty:{name:"Constitutional Casualty",abbr:"CON",color:"#1F3864"},Cornerstone:{name:"Cornerstone",abbr:"CRN",color:"#1F3864"},Countrywide:{name:"Countrywide",abbr:"CTW",color:"#003DA5"},CSE:{name:"CSE",abbr:"CSE",color:"#003DA5"},Cumberland:{name:"Cumberland",abbr:"CMB",color:"#1F3864"},Cypress:{name:"Cypress",abbr:"CYP",color:"#0F4C3A"},Dairyland:{name:"Dairyland",abbr:"DL",color:"#0072CE"},Deerbrook:{name:"Deerbrook",abbr:"DBK",color:"#1F3864"},Direct:{name:"Direct",abbr:"DIR",color:"#D52B1E"},Donegal:{name:"Donegal",abbr:"DON",color:"#003DA5"},Drive:{name:"Drive",abbr:"DRV",color:"#1F3864"},Electric:{name:"Electric",abbr:"ELC",color:"#003DA5"},EMC:{name:"EMC",abbr:"EMC",color:"#003DA5"},Encompass:{name:"Encompass",abbr:"ENC",color:"#002F87"},Erie:{name:"Erie",abbr:"ERI",color:"#005FAC"},Esurance:{name:"Esurance",abbr:"ESU",color:"#00A6CE"},ExcelsiorInsuranceCompany:{name:"Excelsior",abbr:"EXC",color:"#1F3864"},Explorer:{name:"Explorer",abbr:"EXP",color:"#1F3864"},FairPlan:{name:"FAIR Plan",abbr:"FPN",color:"#1F3864"},FarmBureau:{name:"Farm Bureau",abbr:"FB",color:"#00843D"},Farmers:{name:"Farmers",abbr:"FRM",color:"#1C428B"},Fidelity:{name:"Fidelity",abbr:"FID",color:"#00833F"},FiremansFund:{name:"Fireman's Fund",abbr:"FF",color:"#E31837"},FirstAmerican:{name:"First American",abbr:"FAM",color:"#003DA5"},Foremost:{name:"Foremost",abbr:"FOR",color:"#E31837"},ForemostInsuranceCompany:{name:"Foremost",abbr:"FOR",color:"#E31837"},Geico:{name:"GEICO",abbr:"GEI",color:"#0F4293"},GeneralCasualty:{name:"General Casualty",abbr:"GC",color:"#1F3864"},GermantownMutual:{name:"Germantown Mutual",abbr:"GTM",color:"#1F3864"},GMAC:{name:"GMAC",abbr:"GMA",color:"#003DA5"},Grange:{name:"Grange",abbr:"GRG",color:"#003DA5"},GreatAmerican:{name:"Great American",abbr:"GA",color:"#003DA5"},Grinnell:{name:"Grinnell Mutual",abbr:"GRN",color:"#E31837"},GuideOne:{name:"GuideOne",abbr:"GO",color:"#0072CE"},Hanover:{name:"Hanover",abbr:"HAN",color:"#003DA5"},Harbor:{name:"Harbor",abbr:"HBR",color:"#1F3864"},Harleysville:{name:"Harleysville",abbr:"HRL",color:"#003DA5"},Hartford:{name:"The Hartford",abbr:"HFD",color:"#7F1734"},HartfordOMNI:{name:"Hartford OMNI",abbr:"HOM",color:"#7F1734"},HastingsMutual:{name:"Hastings Mutual",abbr:"HST",color:"#1F3864"},HawkeyeSecurity:{name:"Hawkeye Security",abbr:"HWK",color:"#1F3864"},HDI:{name:"HDI",abbr:"HDI",color:"#00563F"},HippoInsuranceCompany:{name:"Hippo",abbr:"HPO",color:"#00C9A7"},HomeownersOfAmerica:{name:"Homeowners of America",abbr:"HOA",color:"#003DA5"},Homesite:{name:"Homesite",abbr:"HMS",color:"#0033A0"},HoraceMann:{name:"Horace Mann",abbr:"HM",color:"#003DA5"},HoustonGeneral:{name:"Houston General",abbr:"HG",color:"#1F3864"},IFA:{name:"IFA",abbr:"IFA",color:"#003DA5"},ImperialCasualty:{name:"Imperial Casualty",abbr:"IMP",color:"#1F3864"},Indiana:{name:"Indiana Insurance",abbr:"IND",color:"#003DA5"},IndianaFarmers:{name:"Indiana Farmers",abbr:"IFM",color:"#00843D"},Infinity:{name:"Infinity",abbr:"INF",color:"#E31837"},Insurequest:{name:"Insurequest",abbr:"INQ",color:"#1F3864"},Integon:{name:"Integon",abbr:"ITG",color:"#003DA5"},Integrity:{name:"Integrity",abbr:"ITY",color:"#1F3864"},Kemper:{name:"Kemper",abbr:"KMP",color:"#0033A0"},LibertyMutual:{name:"Liberty Mutual",abbr:"LM",color:"#FFD000"},LibertyNorthwest:{name:"Liberty Northwest",abbr:"LNW",color:"#FFD000"},Lloyds:{name:"Lloyd's",abbr:"LLY",color:"#003DA5"},MainStreetAmerica:{name:"Main Street America",abbr:"MSA",color:"#003DA5"},Mapfre:{name:"MAPFRE",abbr:"MAP",color:"#E31837"},MarkelInsuranceCompany:{name:"Markel",abbr:"MKL",color:"#003DA5"},Mendota:{name:"Mendota",abbr:"MND",color:"#1F3864"},MerchantsGroup:{name:"Merchants Group",abbr:"MRC",color:"#003DA5"},Mercury:{name:"Mercury",abbr:"MER",color:"#ED1C24"},Metlife:{name:"MetLife",abbr:"MET",color:"#0090DA"},Metropolitan:{name:"Metropolitan",abbr:"MTP",color:"#0090DA"},MidContinent:{name:"Mid-Continent",abbr:"MC",color:"#003DA5"},MidwesternIndemnity:{name:"Midwestern Indemnity",abbr:"MWI",color:"#003DA5"},Montgomery:{name:"Montgomery",abbr:"MTG",color:"#1F3864"},MSA:{name:"MSA",abbr:"MSA",color:"#003DA5"},MtWashington:{name:"Mt. Washington",abbr:"MTW",color:"#1F3864"},MutualBenefit:{name:"Mutual Benefit",abbr:"MB",color:"#1F3864"},NatGenPremier:{name:"NatGen Premier",abbr:"NGP",color:"#0033A0"},NationalGeneral:{name:"National General",abbr:"NG",color:"#0033A0"},Nationwide:{name:"Nationwide",abbr:"NW",color:"#204D9B"},NationwideScottsdale:{name:"Nationwide Scottsdale",abbr:"NWS",color:"#204D9B"},NewYorkCentralMutual:{name:"NY Central Mutual",abbr:"NYC",color:"#003DA5"},NJManufacturers:{name:"NJM Insurance",abbr:"NJM",color:"#003DA5"},NJSkylands:{name:"NJ Skylands",abbr:"NJS",color:"#003DA5"},Northstar:{name:"Northstar",abbr:"NST",color:"#1F3864"},Occidental:{name:"Occidental",abbr:"OCC",color:"#1F3864"},OhioCasualty:{name:"Ohio Casualty",abbr:"OHC",color:"#003DA5"},OmahaPC:{name:"Omaha P&C",abbr:"OMA",color:"#003DA5"},OneBeacon:{name:"OneBeacon",abbr:"OB",color:"#003DA5"},OregonMutual:{name:"Oregon Mutual",abbr:"ORE",color:"#003DA5"},Palisades:{name:"Palisades",abbr:"PAL",color:"#1F3864"},PeerlessMontgomery:{name:"Peerless Montgomery",abbr:"PRM",color:"#1F3864"},Pekin:{name:"Pekin",abbr:"PEK",color:"#003DA5"},Pemco:{name:"PEMCO",abbr:"PMC",color:"#0072CE"},PennNational:{name:"Penn National",abbr:"PN",color:"#003DA5"},PlymouthRock:{name:"Plymouth Rock",abbr:"PLR",color:"#003DA5"},PreferredMutual:{name:"Preferred Mutual",abbr:"PFM",color:"#003DA5"},Proformance:{name:"Proformance",abbr:"PRF",color:"#1F3864"},Progressive:{name:"Progressive",abbr:"PRG",color:"#0053BA"},Prudential:{name:"Prudential",abbr:"PRU",color:"#0033A0"},PureHighValue:{name:"PURE",abbr:"PUR",color:"#003DA5"},Republic:{name:"Republic",abbr:"REP",color:"#003DA5"},RockfordMutual:{name:"Rockford Mutual",abbr:"RKF",color:"#1F3864"},RoyalAndSunAlliance:{name:"Royal & SunAlliance",abbr:"RSA",color:"#003DA5"},Safeco:{name:"Safeco",abbr:"SFC",color:"#E4002B"},SECURA:{name:"SECURA",abbr:"SEC",color:"#003DA5"},Selective:{name:"Selective",abbr:"SEL",color:"#003DA5"},SouthernCounty:{name:"Southern County",abbr:"SCM",color:"#1F3864"},SouthernMutual:{name:"Southern Mutual",abbr:"SM",color:"#1F3864"},SouthernTrust:{name:"Southern Trust",abbr:"ST",color:"#1F3864"},StPaulTravelers:{name:"St. Paul Travelers",abbr:"SPT",color:"#C8102E"},StandardMutual:{name:"Standard Mutual",abbr:"STM",color:"#1F3864"},StarCasualty:{name:"Star Casualty",abbr:"SC",color:"#1F3864"},StateAuto:{name:"State Auto",abbr:"SA",color:"#003DA5"},StateFarm:{name:"State Farm",abbr:"SF",color:"#CC0717"},StateFarmFloridaInsuranceCompany:{name:"State Farm Florida",abbr:"SFF",color:"#CC0717"},SunshineStateInsuranceCompany:{name:"Sunshine State",abbr:"SSS",color:"#FFC72C"},Travelers:{name:"Travelers",abbr:"TRV",color:"#C8102E"},Tower:{name:"Tower",abbr:"TWR",color:"#1F3864"},TWFG:{name:"TWFG",abbr:"TWF",color:"#003DA5"},Unigard:{name:"Unigard",abbr:"UNG",color:"#1F3864"},UnitedFireAndCasualty:{name:"United Fire & Casualty",abbr:"UFC",color:"#003DA5"},Unitrin:{name:"Unitrin",abbr:"UTN",color:"#003DA5"},Universal:{name:"Universal",abbr:"UNV",color:"#003DA5"},USAA:{name:"USAA",abbr:"USA",color:"#1A3258"},UticaNational:{name:"Utica National",abbr:"UTC",color:"#003DA5"},Victoria:{name:"Victoria",abbr:"VIC",color:"#1F3864"},Wellington:{name:"Wellington",abbr:"WLG",color:"#1F3864"},WestBend:{name:"West Bend",abbr:"WB",color:"#003DA5"},WesternNational:{name:"Western National",abbr:"WN",color:"#003DA5"},WesternReserveGroup:{name:"Western Reserve",abbr:"WR",color:"#003DA5"},Westfield:{name:"Westfield",abbr:"WF",color:"#F05136"},WhiteMountains:{name:"White Mountains",abbr:"WM",color:"#1F3864"},WilsonMutual:{name:"Wilson Mutual",abbr:"WLM",color:"#1F3864"},Windsor:{name:"Windsor",abbr:"WIN",color:"#1F3864"},Zurich:{name:"Zurich",abbr:"ZUR",color:"#003399"}},z3=["#0369A1","#1D4ED8","#0F766E","#7C3AED","#B45309","#DC2626","#0891B2","#9333EA"];function rz(e){return e.replace(/[^A-Za-z0-9]/g,"").slice(0,3).toUpperCase()||"CAR"}function V5(e){return e.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/_/g," ").trim()}function Ti(e){if(!e)return e;const t=H5[e];return t?t.name:V5(e)}function az(e){const t=new Set,n=[];return e.forEach((i,o)=>{const c=H5[i]??{name:V5(i),abbr:rz(i),color:z3[o%z3.length]};t.has(c.name)||(t.add(c.name),n.push(c))}),n}function iz(e,t){if(!e)return[];const n=[];return(t==="Auto"||t==="Bundle")&&Array.isArray(e.PersonalAuto)&&n.push(...e.PersonalAuto),(t==="Home"||t==="Bundle")&&Array.isArray(e.PersonalHome)&&n.push(...e.PersonalHome),az(n)}const oz="https://getcredify.com/privacy-policy";function lz({acknowledged:e,onChange:t,disabled:n=!1}){return v.jsx("div",{className:"privacy-notice-ack rounded-xl border border-slate-200 bg-slate-50 p-4","data-testid":"privacy-notice-acknowledgment",children:v.jsx(ji,{id:"privacy-notice-ack-checkbox",className:"privacy-notice-ack-checkbox",checked:e,onChange:i=>t(i.target.checked),disabled:n,label:v.jsxs(v.Fragment,{children:["I acknowledge I have received Credify’s"," ",v.jsx("a",{href:oz,target:"_blank",rel:"noopener noreferrer",className:"credify-link-underline",children:"Privacy Notice"}),"."]})})})}function sz({carrierName:e,formattedPremium:t,lobLabel:n,acknowledged:i,onAcknowledgeChange:o,onCancel:s,onProceed:c,isProcessing:d,hasError:m}){const h=!i||d;return v.jsxs("div",{className:"bind-confirmation","data-testid":"bind-confirmation",role:"group","aria-label":"Confirm your bind request",children:[v.jsx("h3",{className:"text-lg font-semibold text-slate-900",children:"Confirm your bind request"}),v.jsxs("div",{className:"mt-4 rounded-xl border border-slate-200 bg-white p-4",children:[n&&v.jsx("div",{className:"mb-1 text-xs font-semibold uppercase tracking-wide text-slate-500",children:n}),v.jsx("p",{className:"font-semibold text-slate-900",children:e}),v.jsxs("p",{className:"text-2xl font-bold text-slate-900",children:[t,v.jsx("span",{className:"ml-1 text-sm font-medium text-slate-500",children:"/month"})]})]}),v.jsx("div",{className:"mt-4",children:v.jsx(lz,{acknowledged:i,onChange:o,disabled:d})}),m&&v.jsx("p",{className:"mt-3 text-sm text-red-600",role:"alert",children:"Something went wrong while processing your bind request. Please try again."}),v.jsxs("div",{className:"mt-6 grid grid-cols-1 gap-3 sm:grid-cols-2",children:[v.jsx("button",{type:"button","data-testid":"bind-confirmation-cancel",onClick:s,disabled:d,className:"credify-btn-back h-12 rounded-full border border-gray-300 text-text-primary hover:bg-gray-50 transition disabled:opacity-50 disabled:cursor-not-allowed",children:"Cancel"}),v.jsxs("button",{type:"button","data-testid":"bind-confirmation-proceed",onClick:c,disabled:h,className:["h-12 rounded-full text-white font-bold transition","flex items-center justify-center gap-2","disabled:cursor-not-allowed",h?"bg-slate-400":"bg-blue-600 hover:bg-blue-600/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-600/40 bg-primary hover:bg-primary/90 focus-visible:ring-primary/40"].join(" "),children:[d&&v.jsxs("svg",{className:"animate-spin h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[v.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),v.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),d?"Processing…":"Proceed"]})]})]})}const G5=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"});function Z5(e){const t=Number.isFinite(e.term_months)&&e.term_months>0?e.term_months:1;return e.monthly_premium_cents!=null?e.monthly_premium_cents:Math.round((e.premium_cents||0)/t)}const Ad={PersonalHome:"Homeowners",PersonalAuto:"Personal Auto",Flood:"Flood",ExcessFlood:"Excess Flood",_other:"Other"},wd=["PersonalHome","PersonalAuto","Flood","ExcessFlood"];function uz(e){if(e.length===0)return[];const t=(i,o)=>Ti(i.carrier_name).localeCompare(Ti(o.carrier_name));if(!e.some(i=>i.lob))return[{lob:null,title:"Not Quoted",rates:[...e].sort(t)}];const n=new Map;for(const i of e){const o=i.lob||"_other",s=n.get(o);s?s.push(i):n.set(o,[i])}return[...n.entries()].sort(([i],[o])=>{const s=wd.indexOf(i),c=wd.indexOf(o);return(s===-1?999:s)-(c===-1?999:c)}).map(([i,o])=>({lob:i,title:Ad[i]??i,rates:[...o].sort(t)}))}const Kr={admitted:{tab:"rates-tab-admitted",panel:"rates-panel-admitted"},non_admitted:{tab:"rates-tab-non-admitted",panel:"rates-panel-non-admitted"},not_quoted:{tab:"rates-tab-not-quoted",panel:"rates-panel-not-quoted"}};function U3({onBack:e}){const t=()=>{Yj(),e?.()};return v.jsx("button",{type:"button",onClick:t,className:"credify-btn-back credify-btn-back-rates h-12 rounded-full border border-gray-300 text-text-primary hover:bg-gray-50 transition w-full",children:"Back"})}function cz({rate:e,status:t,onRequestBind:n,disabled:i,showLobLabel:o=!0,className:s}){const c=Z5(e)/100,d=G5.format(c),m=t==="loading",h=t==="success",y=!!i||m||h,g=!!(e.effective_date&&e.policy_end_date),E=e.lob?Ad[e.lob]||e.lob:null,S=(e.coverages??[]).filter(D=>!!D&&typeof D.label=="string"&&D.label.trim()!==""&&typeof D.value=="string"&&D.value.trim()!=="");return v.jsxs("div",{className:`flex h-full w-full flex-col rounded-xl border border-slate-200 bg-white p-6 shadow-sm transition hover:shadow-md${s?` ${s}`:""}`,children:[o&&E&&v.jsx("div",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-slate-500",children:E}),v.jsxs("div",{className:"mb-4 flex flex-col items-start gap-2",children:[e.carrier_logo_base64?v.jsx("img",{src:`data:image/png;base64,${e.carrier_logo_base64}`,alt:Ti(e.carrier_name),className:"h-12 w-auto max-w-full object-contain"}):v.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-md bg-slate-100 text-sm font-semibold text-slate-500",children:Ti(e.carrier_name).charAt(0).toUpperCase()}),v.jsx("h4",{className:"w-full break-words text-left font-semibold text-slate-900",children:Ti(e.carrier_name)})]}),v.jsx("div",{className:"mb-2",children:v.jsxs("p",{className:"text-2xl font-bold text-slate-900",children:[d,v.jsx("span",{className:"ml-1 text-sm font-medium text-slate-500",children:"/month"})]})}),g&&v.jsx("div",{className:"mb-2",children:v.jsxs("p",{className:"text-xs text-slate-500",children:["Effective ",e.effective_date," - ",e.policy_end_date]})}),e.carrier_quote_id&&v.jsx("div",{className:"mb-4",children:v.jsxs("p",{className:"text-xs text-slate-400",children:["Quote ID: ",e.carrier_quote_id]})}),S.length>0&&v.jsx("div",{className:"mb-2 border-t border-slate-200 pt-3",children:v.jsx("dl",{children:S.map((D,x)=>v.jsxs("div",{className:"flex items-baseline justify-between gap-2 py-1",children:[v.jsx("dt",{className:"text-xs text-slate-600",children:D.label}),v.jsx("dd",{className:"text-right text-xs font-semibold text-slate-900",children:D.value})]},`${D.label}-${x}`))})}),v.jsxs("div",{className:"mt-auto pt-4",children:[v.jsx("button",{type:"button",onClick:n,disabled:y,className:`rates-bind-btn w-full cursor-pointer rounded-full px-4 py-2.5 text-sm font-semibold transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-600/40 disabled:cursor-not-allowed ${h?"rates-bind-btn-requested":"hover:bg-blue-600/90 disabled:bg-slate-300 disabled:text-slate-500"}`,children:m?"Requesting…":h?"Requested":"Request Bind"}),t==="error"&&v.jsx("p",{className:"mt-2 text-xs text-red-600",role:"alert",children:"Something went wrong. Please try again."}),t==="success"&&v.jsx("p",{className:"mt-2 text-xs text-emerald-600",role:"status","aria-live":"polite",children:"We received your bind request."})]})]})}function dz({item:e}){const t=Ti(e.carrier_name),n=(e.decline_reasons??[]).filter(Boolean);return v.jsxs("div",{className:"flex w-full gap-4 rounded-xl border border-slate-200 bg-white p-4 shadow-sm",children:[v.jsx("div",{className:"shrink-0",children:e.carrier_logo_base64?v.jsx("img",{src:`data:image/png;base64,${e.carrier_logo_base64}`,alt:t,className:"h-10 w-auto max-w-[7rem] object-contain"}):v.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-md bg-slate-100 text-sm font-semibold text-slate-500",children:t.charAt(0).toUpperCase()})}),v.jsxs("div",{className:"min-w-0 flex-1",children:[v.jsx("div",{className:"flex flex-wrap items-center gap-2",children:v.jsx("h4",{className:"break-words font-semibold text-slate-900",children:t})}),n.length>0?v.jsx("ul",{className:"mt-2 list-disc space-y-1 pl-5 text-sm text-slate-600",children:n.map((i,o)=>v.jsx("li",{children:i},o))}):v.jsx("p",{className:"mt-2 text-sm text-slate-500",children:"This carrier did not return a quote."})]})]})}function fz({rates:e,onBack:t,isBundleFlow:n=!1,quoteId:i,initialPhone:o="",requirePursueVerification:s=!1,onSubScreenChange:c}){const d=b.useMemo(()=>Array.isArray(e)?e:[],[e]),m=d.length>0,[h,y]=b.useState({}),[g,E]=b.useState("admitted"),[S,D]=b.useState(!1),[x,w]=b.useState(null),[R,I]=b.useState(!1),[A,L]=b.useState(null),[M,Z]=b.useState(!1),[V,fe]=b.useState(o),[ne,pe]=b.useState(""),[J,ye]=b.useState("phone"),[Ae,j]=b.useState("idle"),[de,k]=b.useState(null),B=!!(A||x);b.useEffect(()=>{c?.(B)},[B,c]),b.useEffect(()=>()=>c?.(!1),[c]);const X=b.useMemo(()=>d.some(re=>re.lob==="PersonalAuto"),[d]),F=b.useMemo(()=>d.some(re=>re.lob==="PersonalHome"),[d]),G=b.useMemo(()=>{if(!n)return[];const re=[];return X&&re.push("PersonalAuto"),F&&re.push("PersonalHome"),re},[n,X,F]),C=b.useMemo(()=>{const re=new Set;for(const oe of d){const Ce=oe.lob??null;Ce&&h[oe.quote_rate_id]==="success"&&re.add(Ce)}return re},[d,h]),U=b.useMemo(()=>Object.values(h).some(re=>re==="success"),[h]),W=b.useMemo(()=>S?!0:!n||G.length===0?U:G.every(re=>C.has(re)),[S,n,U,G,C]),Y=b.useMemo(()=>m?d.filter(re=>(re.admitted_status??"admitted")==="admitted"):[],[d,m]),te=b.useMemo(()=>m?d.filter(re=>re.admitted_status==="non_admitted"):[],[d,m]),z=b.useMemo(()=>m?d.filter(re=>re.admitted_status==="not_quoted"):[],[d,m]),T=Y.length,N=te.length,ie=z.length,ge=T+N>0,Se=ge||ie>0,he=b.useMemo(()=>uz(z),[z]);b.useEffect(()=>{Se&&g==="admitted"&&T===0&&(N>0?E("non_admitted"):ie>0&&E("not_quoted"))},[g,T,N,ie,Se]);const we=b.useMemo(()=>ge?g==="admitted"?Y:g==="non_admitted"?te:[]:[],[ge,g,Y,te]),Ie=re=>{if(re.key!=="ArrowLeft"&&re.key!=="ArrowRight"&&re.key!=="Home"&&re.key!=="End")return;re.preventDefault();const oe=re.key==="Home"?"admitted":re.key==="End"||g==="admitted"?"non_admitted":"admitted";E(oe),window.setTimeout(()=>document.getElementById(Kr[oe].tab)?.focus(),0)};b.useEffect(()=>{Qc()},[]),b.useEffect(()=>{!W||S||(OF(),T5(),D(!0))},[W,S]);const me=b.useMemo(()=>{if(we.length===0)return[];if(!we.some(Ee=>Ee.lob))return[{lob:null,title:"Rates",rates:[...we].sort((Te,Re)=>{const ke=Number.isFinite(Te.term_months)&&Te.term_months>0?Te.term_months:1,qe=Number.isFinite(Re.term_months)&&Re.term_months>0?Re.term_months:1,Ue=Te.monthly_premium_cents??Math.round((Te.premium_cents||0)/ke),ze=Re.monthly_premium_cents??Math.round((Re.premium_cents||0)/qe);return Ue-ze})}];const oe=new Map;for(const Ee of we){const Te=Ee.lob||"_other",Re=oe.get(Te);Re?Re.push(Ee):oe.set(Te,[Ee])}return[...oe.entries()].sort(([Ee],[Te])=>{const Re=wd.indexOf(Ee),ke=wd.indexOf(Te);return(Re===-1?999:Re)-(ke===-1?999:ke)}).map(([Ee,Te])=>({lob:Ee,title:Ad[Ee]??Ee,rates:[...Te].sort((Re,ke)=>{const qe=Number.isFinite(Re.term_months)&&Re.term_months>0?Re.term_months:1,Ue=Number.isFinite(ke.term_months)&&ke.term_months>0?ke.term_months:1,ze=Re.monthly_premium_cents??Math.round((Re.premium_cents||0)/qe),tt=ke.monthly_premium_cents??Math.round((ke.premium_cents||0)/Ue);return ze-tt})}))},[we]),De=b.useMemo(()=>{if(!n)return[];const re=d.some(Ee=>Ee.lob==="PersonalAuto"),oe=d.some(Ee=>Ee.lob==="PersonalHome"),Ce=[];return re||Ce.push("Sorry, no rates found for Personal Auto."),oe||Ce.push("Sorry, no rates found for Homeowners."),Ce},[n,d]);if(!Se)return v.jsxs("section",{className:"mt-8",children:[v.jsx("h3",{className:"text-lg font-semibold text-slate-900",children:"Rates"}),v.jsx("p",{className:"mt-2 text-sm text-slate-500",children:"Sorry, no rates are available at this time."}),t&&v.jsx(U3,{onBack:t})]});const se=re=>{if(y(oe=>({...oe,[re.quote_rate_id]:"idle"})),I(!1),Qc(),!M&&(s||!Jr())){fe(o),pe(""),ye("phone"),j("idle"),k(null),L({cardKey:re.quote_rate_id,rate:re});return}w({cardKey:re.quote_rate_id,rate:re})},_e=()=>{w(null),I(!1)},be=()=>{L(null),k(null),j("idle")},xe=async()=>{if(!A||!i)return;const re=V.trim();if(!re){k("Please enter your phone number.");return}j("sending"),k(null);try{await N5(i,re),ye("code"),j("sent")}catch{j("idle"),k("We could not send a code to that number. Please check it and try again.")}},$e=async()=>{if(!A||!i)return;const re=ne.trim();if(!re){k("Please enter the code we texted you.");return}j("verifying"),k(null);try{const{isVerified:oe,token:Ce}=await g0(i,re);if(!oe||!Ce){j("sent"),k("That code was incorrect. Please try again.");return}Wc(Ce);const Ee=A;Z(!0),L(null),j("idle"),w(Ee)}catch{j("sent"),k("Something went wrong verifying your code. Please try again.")}},Me=async()=>{if(!x||!R)return;const re=x.cardKey;y(oe=>({...oe,[re]:"loading"}));try{if(Qc(),!Jr())throw new Error("Authentication required. Please verify your phone number first.");if(!((await uj(re,!0))?.success!==!1))throw new Error("Request failed");y(Te=>({...Te,[re]:"success"})),w(null),I(!1)}catch{y(oe=>({...oe,[re]:"error"}))}};if(A){const re=Ae==="sending"||Ae==="verifying",oe=["h-12 rounded-full text-white font-bold transition","flex items-center justify-center gap-2","disabled:cursor-not-allowed",re?"bg-slate-400":"bg-blue-600 hover:bg-blue-600/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-600/40 bg-primary hover:bg-primary/90 focus-visible:ring-primary/40"].join(" "),Ce="credify-btn-back h-12 rounded-full border border-gray-300 text-text-primary hover:bg-gray-50 transition disabled:opacity-50 disabled:cursor-not-allowed";return v.jsx("section",{className:"mt-8",children:J==="phone"?v.jsxs(v.Fragment,{children:[v.jsx(zE,{id:"phone",label:"What is your phone number?",value:V,onChange:Ee=>fe(Ee.currentTarget.value),error:de??void 0}),v.jsxs("div",{className:"mt-3 text-xs text-slate-600 space-y-1",children:[v.jsx("p",{children:"We'll text you a 6-digit code to confirm your number. This is just to confirm your number, not a sales call."}),v.jsx("p",{children:"Message & data rates may apply. One message per request."}),v.jsxs("p",{children:["See our"," ",v.jsx("a",{href:"https://getcredify.com/privacy-policy",target:"_blank",rel:"noopener noreferrer",className:"credify-link-underline",children:"Privacy Policy"})," ","and"," ",v.jsx("a",{href:"https://getcredify.com/terms-of-service",target:"_blank",rel:"noopener noreferrer",className:"credify-link-underline",children:"Terms of Service"}),"."]})]}),v.jsxs("div",{className:"mt-6 grid grid-cols-2 gap-3",children:[v.jsx("button",{type:"button",onClick:be,className:Ce,children:"Back to rates"}),v.jsx("button",{type:"button",onClick:xe,disabled:re,className:oe,children:Ae==="sending"?"Sending…":"Send code"})]})]}):v.jsxs(v.Fragment,{children:[v.jsx(jc,{id:"sms_code",label:"Please enter the code we sent to your phone number.",value:ne,inputMode:"numeric",pattern:"[0-9]*",maxLength:6,autoComplete:"one-time-code",onChange:Ee=>pe(Ee.currentTarget.value.replace(/\D+/g,"").slice(0,6)),error:de??void 0}),v.jsx(k5,{stageKey:"SMSVerification"}),v.jsxs("div",{className:"mt-6 grid grid-cols-2 gap-3",children:[v.jsx("button",{type:"button",onClick:()=>{ye("phone"),k(null)},className:Ce,children:"Change number"}),v.jsx("button",{type:"button",onClick:$e,disabled:re,className:oe,children:Ae==="verifying"?"Verifying…":"Verify & continue"})]})]})})}if(x){const re=x.rate.lob?Ad[x.rate.lob]||x.rate.lob:null;return v.jsx("section",{className:"mt-8",children:v.jsx(sz,{carrierName:Ti(x.rate.carrier_name),formattedPremium:G5.format(Z5(x.rate)/100),lobLabel:re,acknowledged:R,onAcknowledgeChange:I,onCancel:_e,onProceed:Me,isProcessing:h[x.cardKey]==="loading",hasError:h[x.cardKey]==="error"})})}return v.jsxs("section",{className:"mt-8",children:[v.jsx("h3",{className:"text-lg font-semibold text-slate-900",children:"Rates"}),De.length>0&&v.jsx("div",{className:"mt-3 space-y-1",children:De.map(re=>v.jsx("p",{className:"text-sm text-slate-600",children:re},re))}),v.jsx("div",{className:"mt-4 border-b border-slate-200",children:v.jsxs("div",{className:"flex items-center gap-6",role:"tablist","aria-label":"Rate market type",children:[v.jsxs("button",{id:Kr.admitted.tab,type:"button",role:"tab","aria-selected":g==="admitted","aria-controls":Kr.admitted.panel,onClick:()=>E("admitted"),onKeyDown:Ie,className:`border-b-2 px-1 py-2 text-sm font-semibold transition ${g==="admitted"?"border-cyan-500 text-slate-900":"border-transparent text-slate-500 hover:text-slate-800"}`,children:["Admitted (",T,")"]}),v.jsxs("button",{id:Kr.non_admitted.tab,type:"button",role:"tab","aria-selected":g==="non_admitted","aria-controls":Kr.non_admitted.panel,onClick:()=>E("non_admitted"),onKeyDown:Ie,className:`border-b-2 px-1 py-2 text-sm font-semibold transition ${g==="non_admitted"?"border-cyan-500 text-slate-900":"border-transparent text-slate-500 hover:text-slate-800"}`,children:["Non-admitted (",N,")"]}),ie>0&&v.jsxs("button",{id:Kr.not_quoted.tab,type:"button",role:"tab","aria-selected":g==="not_quoted","aria-controls":Kr.not_quoted.panel,onClick:()=>E("not_quoted"),className:`border-b-2 px-1 py-2 text-sm font-semibold transition ${g==="not_quoted"?"border-cyan-500 text-slate-900":"border-transparent text-slate-500 hover:text-slate-800"}`,children:["Not Quoted (",ie,")"]})]})}),v.jsx("div",{id:Kr[g].panel,role:"tabpanel","aria-labelledby":Kr[g].tab,tabIndex:0,children:g==="not_quoted"?he.map(re=>v.jsxs("div",{className:"mt-6",children:[re.lob!=null&&v.jsx("h4",{className:"mb-3 text-center text-base font-semibold text-slate-800",children:re.title}),v.jsx("div",{className:"space-y-3",children:re.rates.map(oe=>v.jsx(dz,{item:oe},oe.quote_rate_id))})]},re.lob??"all")):v.jsxs(v.Fragment,{children:[we.length===0&&v.jsx("p",{className:"mt-4 text-sm text-slate-500",children:g==="admitted"?"Sorry, no admitted rates are available at this time.":"Sorry, no non-admitted rates are available at this time."}),we.length>0&&me.map(re=>v.jsxs("div",{className:"mt-6",children:[v.jsx("h4",{className:"mb-3 text-center text-base font-semibold text-slate-800",children:re.title}),v.jsx("div",{className:"flex flex-wrap justify-center gap-4",children:re.rates.map(oe=>v.jsx("div",{className:"w-full min-w-0 sm:w-[calc(50%-0.5rem)] lg:w-[calc(33.333%-0.667rem)] xl:w-[calc(25%-0.75rem)]",children:v.jsx(cz,{rate:oe,showLobLabel:re.lob==null,status:h[oe.quote_rate_id]??"idle",disabled:W||(n?!!(oe.lob&&G.includes(oe.lob)&&C.has(oe.lob)):U),onRequestBind:()=>se(oe)})},oe.quote_rate_id))})]},re.lob??"all"))]})}),t&&v.jsx(U3,{onBack:t})]})}function mz({stageKey:e,title:t,questions:n,values:i,onChangeValues:o,review:s,quoteId:c,fetchVehicleOptions:d}){const m=b.useMemo(()=>new Set(Object.keys(s.errorsByKey)),[s.errorsByKey]);return v.jsxs("section",{id:`review-section-${e}`,"data-testid":`review-section-${e}`,className:`review-section rounded-lg border p-4 ${s.hasIssues?"border-amber-300 bg-amber-50/40":"border-slate-200"}`,children:[v.jsxs("div",{className:"flex items-center justify-between gap-3 mb-3",children:[v.jsx("h3",{className:"text-base font-semibold text-text-primary",children:t}),s.hasIssues?v.jsxs("span",{"data-testid":`review-section-${e}-badge`,className:"shrink-0 rounded-full bg-amber-100 border border-amber-300 text-amber-800 text-xs font-semibold px-2.5 py-1",children:[s.issues.length," ",s.issues.length===1?"field needs":"fields need"," attention"]}):v.jsx("svg",{"data-testid":`review-section-${e}-ok`,className:"h-5 w-5 shrink-0 text-emerald-600",viewBox:"0 0 20 20",fill:"currentColor",role:"img","aria-label":"Section complete",children:v.jsx("path",{fillRule:"evenodd",d:"M16.704 5.29a1 1 0 010 1.415l-7.5 7.5a1 1 0 01-1.415 0l-3.5-3.5a1 1 0 011.415-1.415l2.792 2.793 6.793-6.793a1 1 0 011.415 0z",clipRule:"evenodd"})})]}),s.hasIssues&&v.jsx("ul",{className:"mb-3 list-disc list-inside space-y-0.5 text-sm text-amber-800","data-testid":`review-section-${e}-issues`,children:s.issues.map(h=>v.jsxs("li",{children:[h.label,": ",h.message]},h.key))}),v.jsx(O5,{questions:n,controlledValues:i,onChangeValues:o,onSubmit:()=>{},quoteId:c,widgetStageKey:e,invalidValueKeys:m,fetchVehicleOptions:d})]})}const H3=new Set(["make","model","body_style","occupation","co_applicant_occupation","quote_vehicle_id"]),V3={vehicles:"Vehicle",drivers:"Driver",driver_accidents:"Accident",driver_violations:"Violation",losses:"Loss",home_losses:"Loss"};function G3(e){const t=e.options;return Array.isArray(t)?t.map(n=>n&&typeof n=="object"&&"value"in n?String(n.value):String(n)):[]}const pz=new Set(["SMSVerification","CanopyConnect","Phone"]);function hz({stageKey:e,questions:t,values:n}){const i=of(t,n,e),o=Fs(i,n),s=new Map(i.map((h,y)=>[Ya(h,y),h])),c={},d=[];for(const[h,y]of Object.entries(o))!y||!s.has(h)||(c[h]=y,d.push({key:h,label:s.get(h)?.question??h,message:y}));i.forEach((h,y)=>{const g=Ya(h,y);if(c[g]||h.inputType!=="select"&&h.inputType!=="radio"||H3.has(String(h.key??"")))return;const E=G3(h);if(E.length===0)return;const S=n[g];Cr(S,h.inputType)||E.includes(String(S))||(c[g]="Not a valid option",d.push({key:g,label:h.question??g,message:"Choose a valid option from the list"}))}),v0(t,n,e,(h,y,g)=>{h.forEach(E=>{if(E.inputType!=="select"&&E.inputType!=="radio")return;const S=String(E.key??"");if(!S||H3.has(S))return;const D=G3(E);if(D.length===0)return;const x=y[S];if(!Cr(x,E.inputType)&&!D.includes(String(x))){const w=V3[g.groupKey]??g.groupKey,R=`${g.groupKey}__items.${g.index}.${S}`;c[R]="Not a valid option",d.push({key:R,label:`${w} ${g.index+1} — ${E.question??S}`,message:"Choose a valid option from the list"})}})});for(const h of ez(t,n,e)){const y=V3[h.groupKey]??h.groupKey;if(h.index<0){d.push({key:`${h.groupKey}__missing`,label:y,message:"Add at least one entry"});continue}const g=`${h.groupKey}__items.${h.index}.${h.fieldKey}`;if(c[g])continue;c[g]=h.message;const E=h.fieldLabel?`${y} ${h.index+1} — ${h.fieldLabel}`:`${y} ${h.index+1}`;d.push({key:g,label:E,message:h.message})}if(i.some(h=>String(h.key??"")==="vehicle_policy_selections")&&U5(n)&&d.push({key:"__vehicle_policy",label:"Vehicle coverage selections",message:"Coverage selections are incomplete"}),_z(n,i)&&d.push({key:"__dva",label:"Driver usage",message:"Driver usage percentages must total 100% (50/50 is not allowed)"}),i.some(h=>h.inputType==="address"&&String(h.key??"")==="address")){const h=vz(n);h&&d.push(h)}return{stageKey:e,errorsByKey:c,issues:d,hasIssues:d.length>0}}async function yz(e,t){const n=e.vehicles__items??[];if(!Array.isArray(n)||n.length===0)return[];const i=[];for(const[o,s]of n.entries()){if(typeof s!="object"||s===null)continue;const c=Number(s.year),d=typeof s.make=="string"?s.make.trim():"",m=typeof s.model=="string"?s.model.trim():"",h=typeof s.body_style=="string"?s.body_style.trim():"";if(!(!Number.isFinite(c)||!c||!d))try{const{makes:y}=await t({year:c});if(Array.isArray(y)&&y.length>0&&!y.includes(d)){i.push({key:`vehicles__items.${o}.make`,label:`Vehicle ${o+1} — Make`,message:`"${d}" isn't available for ${c} — choose the make from the list`});continue}if(!m)continue;const{models:g}=await t({year:c,make:d});if(Array.isArray(g)&&g.length>0&&!g.includes(m)){i.push({key:`vehicles__items.${o}.model`,label:`Vehicle ${o+1} — Model`,message:`"${m}" isn't a listed model for the ${c} ${d} — choose the model from the list`});continue}if(!h)continue;const{bodyStyles:E}=await t({year:c,make:d,model:m});Array.isArray(E)&&E.length>0&&!E.includes(h)&&i.push({key:`vehicles__items.${o}.body_style`,label:`Vehicle ${o+1} — Body style`,message:"Choose the body style from the list"})}catch{}}return i}const gz=/^[A-Z]{2}$/,bz=/^\d{5}(-\d{4})?$/;function vz(e){if(!(typeof e.address=="string"?e.address.trim():""))return null;const n=typeof e.state=="string"?e.state.trim().toUpperCase():"",i=e.postal_code==null?"":String(e.postal_code).trim();return gz.test(n)&&bz.test(i)?null:{key:"__address",label:"Property address",message:"Select your address from the dropdown suggestions so we can verify the state and ZIP code"}}function _z(e,t){if(!t.some(s=>String(s.key??"")==="driver_vehicle_assignments"||String(s.key??"")==="vehicle_policy_selections"))return!1;const n=e.driver_vehicle_assignments,i=e.drivers__items??[];if(!n||i.length<2)return!1;const o=e.vehicles__items??[];for(let s=0;s<o.length;s++){const c=n[`v${s}`];if(!c)continue;const d=i.map((y,g)=>c[`d${g}`]??0),m=d.filter(y=>y>0);if(m.length>=2&&m.every(y=>y===50))return!0;const h=d.reduce((y,g)=>y+g,0);if(h>0&&h!==100)return!0}return!1}function xi(e){const t={},n=h=>{if(typeof h=="string"){if(h==="Yes")return!0;if(h==="No")return!1}return h},i=Object.keys(e).filter(h=>!h.includes("__items")),o=new Set,s=new Set;for(const[h,y]of Object.entries(e))if(h.endsWith("__items")&&Array.isArray(y)){const g=h.replace("__items","");s.add(g),i.includes(g)&&y.forEach(E=>{typeof E=="object"&&E!==null&&Object.keys(E).forEach(S=>{o.add(S)})})}for(const[h,y]of Object.entries(e))if(h.endsWith("__items")){const g=h.replace("__items","");if(i.includes(g)){const S=Array.isArray(y)?y.map(D=>xi(D)):y;t[g]=S}}else if(!h.includes("__items")){if(s.has(h))continue;o.has(h)||(t[h]=n(y))}const c=t.auto_prior_carrier_name;if(typeof c=="string"&&c.trim()!==""){const h=c==="NoPriorInsurance";t.auto_has_prior_insurance=!h,h&&(delete t.auto_prior_years,delete t.auto_prior_months,delete t.auto_prior_expiration_date,delete t.auto_prior_liability_limit,delete t.auto_continuous_coverage_years,delete t.auto_cancelled_declined_refused_to_renew,delete t.auto_current_annual_premium_cents)}const d=t.home_prior_carrier_name;if(typeof d=="string"&&d.trim()!==""){const h=d==="NoPriorInsurance";t.home_has_prior_insurance=!h,h&&(delete t.home_prior_years,delete t.home_continuous_coverage_years,delete t.home_prior_expiration_date,delete t.property_insurance_cancelled)}Array.isArray(t.drivers)&&(t.drivers=t.drivers.map(h=>{if(!h||typeof h!="object")return h;const y={...h};return y.industry=Dd(y.industry),y.education_level=S5(y.education_level),y.occupation=D5(y.occupation),y}));const m=21474836;if("sale_price_cents"in t){const h=t.sale_price_cents;if(typeof h=="number"&&Number.isFinite(h)){const y=Math.trunc(h);if(y>=1){const g=Math.min(y,m);t.sale_price_cents=g*100}}}return Array.isArray(t.home_losses)&&(t.home_losses=t.home_losses.map(h=>{if(!h||typeof h!="object")return h;const y=h,g=y.amount_paid_cents;if(typeof g!="number"||!Number.isFinite(g))return y;const E=Math.trunc(g),S=Math.min(Math.max(E,0),m);return{...y,amount_paid_cents:S*100}})),t}const Ez={AL:"Alabama",AK:"Alaska",AZ:"Arizona",AR:"Arkansas",CA:"California",CO:"Colorado",CT:"Connecticut",DE:"Delaware",DC:"District of Columbia",FL:"Florida",GA:"Georgia",HI:"Hawaii",ID:"Idaho",IL:"Illinois",IN:"Indiana",IA:"Iowa",KS:"Kansas",KY:"Kentucky",LA:"Louisiana",ME:"Maine",MD:"Maryland",MA:"Massachusetts",MI:"Michigan",MN:"Minnesota",MS:"Mississippi",MO:"Missouri",MT:"Montana",NE:"Nebraska",NV:"Nevada",NH:"New Hampshire",NJ:"New Jersey",NM:"New Mexico",NY:"New York",NC:"North Carolina",ND:"North Dakota",OH:"Ohio",OK:"Oklahoma",OR:"Oregon",PA:"Pennsylvania",RI:"Rhode Island",SC:"South Carolina",SD:"South Dakota",TN:"Tennessee",TX:"Texas",UT:"Utah",VT:"Vermont",VA:"Virginia",WA:"Washington",WV:"West Virginia",WI:"Wisconsin",WY:"Wyoming",PR:"Puerto Rico"};function Y5(e){const t=e?.trim().toUpperCase();if(!t)return"your state";const n=Ez[t];return n?`${n} (${t})`:"your state"}const Sz=1500,Dz=800;function $z(e){const t=e.vehicles__items??[];return Array.isArray(t)?t.map(n=>[n?.year,n?.make,n?.model,n?.body_style].map(i=>String(i??"")).join("|")).join(";"):""}function xz({stages:e,initialValues:t,quoteId:n,isSubmitting:i,onConfirmed:o}){const s=b.useMemo(()=>e.filter(te=>!pz.has(String(te.key))),[e]),[c,d]=b.useState(t),[m,h]=b.useState({}),[y,g]=b.useState(null),[E,S]=b.useState(!0),[D,x]=b.useState(0),[w,R]=b.useState(!1),[I,A]=b.useState(null),[L,M]=b.useState(!1);b.useEffect(()=>{let te=!1;return S(!0),g(null),Promise.all(s.map(async z=>{const T=await z.loadQuestions();return[String(z.key),[...T]]})).then(z=>{te||h(Object.fromEntries(z))}).catch(z=>{te||g(z instanceof Error?z.message:"Failed to load your review")}).finally(()=>{te||S(!1)}),()=>{te=!0}},[s,D]);const Z=b.useRef(null),V=b.useRef(!0);b.useEffect(()=>{if(V.current){V.current=!1;return}return Z.current&&window.clearTimeout(Z.current),Z.current=window.setTimeout(()=>{La(xi(c),!1).catch(te=>{console.warn("Review autosave failed (will retry on next edit / submit)",te)})},Sz),()=>{Z.current&&window.clearTimeout(Z.current)}},[c]);const fe=b.useCallback(te=>{d(z=>({...z,...te}))},[]),ne=b.useMemo(()=>{for(const[te,z]of Object.entries(m))if(z.some(T=>String(T.key??"")==="vehicles"))return te;return null},[m]),[pe,J]=b.useState([]),[ye,Ae]=b.useState(!1),j=b.useRef(0),de=$z(c),k=b.useRef(new Map),B=b.useRef(Promise.resolve()),X=b.useCallback(te=>{const z=`${te.year??""}|${te.make??""}|${te.model??""}`,T=k.current,N=T.get(z);if(N)return N;const ie=B.current.catch(()=>{}).then(()=>R5({quoteId:n,...te}));B.current=ie.catch(()=>{});const ge=ie.catch(Se=>{throw T.delete(z),Se});return T.set(z,ge),ge},[n]);b.useEffect(()=>{if(!ne||!de){J([]),Ae(!1);return}const te=++j.current;Ae(!0);const z=window.setTimeout(()=>{yz(c,X).then(T=>{j.current===te&&J(T)}).finally(()=>{j.current===te&&Ae(!1)})},Dz);return()=>window.clearTimeout(z)},[ne,de,n,X]);const F=b.useMemo(()=>{const te={};for(const z of s){const T=String(z.key),N=m[T];N&&(te[T]=hz({stageKey:T,questions:N,values:c}))}if(ne&&te[ne]&&pe.length>0){const z=te[ne];te[ne]={...z,errorsByKey:{...z.errorsByKey,...Object.fromEntries(pe.map(T=>[T.key,T.message]))},issues:[...z.issues,...pe],hasIssues:!0}}return te},[s,m,c,ne,pe]),G=b.useMemo(()=>Object.values(F).reduce((te,z)=>te+z.issues.length,0),[F]),C=i||L,U=!E&&!y&&G===0&&w&&!C&&!ye,W=b.useCallback(()=>{const te=s.find(z=>F[String(z.key)]?.hasIssues);te&&document.getElementById(`review-section-${String(te.key)}`)?.scrollIntoView({behavior:"smooth",block:"start"})},[s,F]),Y=b.useCallback(async()=>{if(U){A(null),M(!0);try{const te=typeof c.state=="string"?c.state:"";if(te){const{isSupported:z}=await M5(te);if(!z){A(`Sorry, Credify Corporation doesn't currently offer insurance in ${Y5(te)}. We're expanding our coverage and hope to serve your state soon.`);return}}await o(c)}catch{A("Oops, something went wrong. Please try again later.")}finally{M(!1)}}},[U,c,o]);return E?v.jsx("div",{className:"flex items-center justify-center py-12","data-testid":"review-loading",children:v.jsx("div",{className:"text-slate-600",children:"Loading your details..."})}):y?v.jsxs("div",{className:"text-red-600 text-sm","data-testid":"review-load-error",children:[v.jsx("div",{children:y}),v.jsx("button",{type:"button",className:"credify-retry-btn underline mt-1 font-bold",onClick:()=>x(te=>te+1),children:"Retry"})]}):v.jsxs("div",{className:"space-y-6","data-testid":"review-screen",children:[v.jsxs("div",{className:"text-center",children:[v.jsx("h3",{className:"text-lg font-semibold text-text-primary",children:"Review your information"}),v.jsx("p",{className:"text-sm text-slate-600 mt-1",children:"Here's what we collected during your conversation. Please review each section, fix anything we got wrong, and fill in anything missing — then confirm below to see your quotes."})]}),G>0&&v.jsxs("div",{className:"sticky top-0 z-10 flex items-center justify-between gap-3 rounded-md border border-amber-300 bg-amber-50 px-4 py-2.5 text-sm text-amber-800",role:"status","data-testid":"review-issue-summary",children:[v.jsxs("span",{children:[G," ",G===1?"field needs":"fields need"," your attention before you can continue."]}),v.jsx("button",{type:"button",onClick:W,className:"shrink-0 font-bold underline text-amber-800 hover:text-amber-900",children:"Show me"})]}),s.map(te=>{const z=String(te.key),T=m[z],N=F[z];return!T||!N?null:v.jsx(mz,{stageKey:z,title:te.title,questions:T,values:c,onChangeValues:fe,review:N,quoteId:n,fetchVehicleOptions:X},z)}),v.jsxs("div",{className:"rounded-lg border border-slate-200 p-4 space-y-4","data-testid":"review-consent-block",children:[v.jsx(ji,{id:"review-terms-checkbox","data-testid":"review-terms-checkbox",checked:w,onChange:te=>R(te.target.checked),disabled:i,label:"I have reviewed my information and confirm it is accurate, and I agree to the Terms of Service and Privacy Policy."}),v.jsxs("p",{className:"text-sm text-slate-600",children:["Credify Corporation – Texas #3309669."," ",v.jsx("a",{href:"https://getcredify.com/privacy-policy",target:"_blank",rel:"noopener noreferrer",className:"credify-link-underline",children:"Privacy Policy"})," ","|"," ",v.jsx("a",{href:"https://getcredify.com/terms-of-service",target:"_blank",rel:"noopener noreferrer",className:"credify-link-underline",children:"Terms of Service"})]})]}),I&&v.jsx("div",{className:"text-red-600 text-sm",role:"alert","data-testid":"review-submit-error",children:I}),v.jsxs("button",{type:"button","data-testid":"review-submit","data-widget-ctrl":"review-submit",onClick:Y,disabled:!U,className:["form-wizard-next-btn w-full","h-12 rounded-full text-white font-bold transition","cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed","flex items-center justify-center gap-2",U?"bg-blue-600 hover:bg-blue-600/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-600/40 bg-primary hover:bg-primary/90 focus-visible:ring-primary/40":"bg-gray-300"].join(" "),children:[C&&v.jsxs("svg",{className:"animate-spin h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[v.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),v.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Confirm & See My Quotes"]})]})}const fh=["Validating your details...","Checking underwriting rules...","Applying eligible discounts...","Reviewing your risk profile...","Calculating premium...","Check complete"],Z3={Auto:{label:"Auto Policy",icon:"🚗",accent:"#0369A1"},Home:{label:"Home Policy",icon:"🏠",accent:"#059669"},Bundle:{label:"Home + Auto Bundle",icon:"🔗",accent:"#7C3AED"}},Y3={Auto:6e4,Home:9e4,Bundle:12e4};function Cz({progress:e,color:t,size:n=80}){const i=(n-10)/2,o=2*Math.PI*i,s=o-e/100*o;return v.jsxs("svg",{width:n,height:n,style:{transform:"rotate(-90deg)"},"aria-hidden":"true",children:[v.jsx("circle",{cx:n/2,cy:n/2,r:i,fill:"none",stroke:"#F1F5F9",strokeWidth:6}),v.jsx("circle",{cx:n/2,cy:n/2,r:i,fill:"none",stroke:t,strokeWidth:6,strokeLinecap:"round",strokeDasharray:o,strokeDashoffset:s,style:{transition:"stroke-dashoffset 0.2s linear"}})]})}function Az({providers:e=[],totalTime:t=6e4,flow:n="Auto",isComplete:i=!1,onComplete:o}){const s=Z3[n]??Z3.Auto,c=Y3[n]??Y3.Auto,d=e.length>0?Math.floor(c/e.length):t,[m,h]=b.useState(0),[y,g]=b.useState(0),[E,S]=b.useState(0),[D,x]=b.useState(0),[w,R]=b.useState(!0),I=b.useRef(i),A=b.useRef(o),L=b.useRef(m),M=b.useRef(e.length),Z=b.useRef(!1),V=b.useRef(!1);b.useEffect(()=>{I.current=i,i&&e.length===0&&!Z.current&&(Z.current=!0,A.current?.())},[i,e.length]),b.useEffect(()=>{A.current=o},[o]),b.useEffect(()=>{L.current=m},[m]),b.useEffect(()=>{M.current=e.length,e.length>0&&(V.current=!1,h(0),g(0),S(0),x(0),R(!0))},[e.length]),b.useEffect(()=>{if(e.length===0){I.current&&!Z.current&&(Z.current=!0,A.current?.());return}V.current=!1;const J=100,ye=100/(d/J),Ae=setInterval(()=>{S(j=>{if(V.current||Z.current)return j;const de=j+ye;return de<100?de:(V.current=!0,setTimeout(()=>{if(I.current){if(Z.current)return;Z.current=!0,A.current?.();return}const B=L.current===M.current-1;R(!1),setTimeout(()=>{B?(h(0),g(X=>X+1)):h(X=>X+1),S(0),x(0),R(!0)},300)},400),100)})},J);return()=>clearInterval(Ae)},[m,d,e.length]),b.useEffect(()=>{if(e.length===0)return;const J=Math.floor(d/fh.length),ye=setInterval(()=>x(Ae=>Math.min(Ae+1,fh.length-1)),J);return()=>clearInterval(ye)},[m,d,e.length]);const fe=e.length===0,ne=fe?null:e[Math.min(m,e.length-1)],pe=y>0;return v.jsxs(v.Fragment,{children:[v.jsx("style",{children:`
122
122
  @keyframes providerPulse {
123
123
  0%, 100% { transform: scale(1); }
124
124
  50% { transform: scale(1.05); }
@@ -160,5 +160,5 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
160
160
  transition-duration: 0.001ms !important;
161
161
  }
162
162
  }
163
- `}),v.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:v.jsxs("div",{style:{width:"100%",maxWidth:560},children:[v.jsxs("div",{style:{textAlign:"center",marginBottom:40},children:[v.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8,background:s.accent+"12",border:`1px solid ${s.accent}30`,borderRadius:100,padding:"6px 16px",marginBottom:16},children:[v.jsx("span",{style:{fontSize:14},"aria-hidden":"true",children:s.icon}),v.jsx("span",{style:{fontSize:12,fontWeight:700,color:s.accent,letterSpacing:"0.1em",textTransform:"uppercase"},children:s.label})]}),v.jsx("h1",{style:{fontSize:26,fontWeight:700,color:"#0F172A",margin:0,letterSpacing:"-0.02em",lineHeight:1.3},children:fe?"Connecting to top carriers":"Fetching your best rates"}),v.jsx("p",{style:{fontSize:14,color:"#64748B",marginTop:8,marginBottom:0},children:fe?"Identifying the carriers eligible for your quote...":pe?"Still gathering — a few carriers are taking a little longer...":"We're reaching out to multiple insurers on your behalf"})]}),v.jsx("div",{style:{display:"flex",justifyContent:"center",marginBottom:32},children:fe?v.jsx("div",{style:{display:"flex",gap:20},children:[0,1,2,3,4].map(J=>v.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:6},children:[v.jsx("div",{style:{width:48,height:48,borderRadius:14,background:"#E2E8F0",animation:"skeletonPulse 1.4s ease-in-out infinite",animationDelay:`${J*.12}s`}}),v.jsx("div",{style:{width:40,height:8,borderRadius:4,background:"#E2E8F0",animation:"skeletonPulse 1.4s ease-in-out infinite",animationDelay:`${J*.12}s`}})]},`skeleton-${J}`))}):ne?v.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8},children:[v.jsxs("div",{style:{width:64,height:64,borderRadius:18,background:ne.color+"18",border:`2px solid ${ne.color}`,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:700,fontSize:16,color:ne.color,position:"relative",animation:"providerPulse 1.8s ease-in-out infinite"},children:[ne.abbr,v.jsx("div",{style:{position:"absolute",inset:-5,borderRadius:22,border:`2px solid ${ne.color}`,pointerEvents:"none",animation:"ringPulse 1.6s ease-in-out infinite"},"aria-hidden":"true"})]}),v.jsx("span",{style:{fontSize:13,fontWeight:600,color:ne.color,letterSpacing:"0.04em"},children:ne.name})]}):null}),v.jsxs("div",{className:`iq-card-fade ${w?"iq-card-visible":"iq-card-hidden"}`,style:{background:"#FFFFFF",borderRadius:24,border:"1px solid #E2E8F0",padding:32},children:[v.jsx("div",{style:{display:"flex",alignItems:"center",gap:20,marginBottom:28},children:fe||!ne?v.jsxs("div",{style:{flex:1,textAlign:"center",padding:"8px 0"},children:[v.jsx("p",{style:{fontSize:11,fontWeight:700,color:"#94A3B8",letterSpacing:"0.1em",textTransform:"uppercase",margin:"0 0 6px"},children:"Please wait"}),v.jsx("h2",{style:{fontSize:18,fontWeight:700,color:"#0F172A",margin:"0 0 6px",letterSpacing:"-0.02em"},children:"Checking eligible providers"}),v.jsx("p",{style:{fontSize:13,color:"#64748B",margin:0},children:"Reviewing your details against our carrier network"})]}):v.jsxs(v.Fragment,{children:[v.jsxs("div",{style:{position:"relative",flexShrink:0},children:[v.jsx(Cz,{progress:E,color:ne.color,size:80}),v.jsx("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center"},children:v.jsxs("span",{style:{fontSize:14,fontWeight:700,color:ne.color},"aria-hidden":"true",children:[Math.round(E),"%"]})})]}),v.jsxs("div",{style:{flex:1},children:[v.jsx("p",{style:{fontSize:11,fontWeight:700,color:"#94A3B8",letterSpacing:"0.1em",textTransform:"uppercase",margin:"0 0 4px"},children:pe?"Still checking":"Now checking"}),v.jsx("h2",{style:{fontSize:20,fontWeight:700,color:"#0F172A",margin:"0 0 6px",letterSpacing:"-0.02em"},children:ne.name}),v.jsx("p",{className:"iq-status-text",style:{fontSize:13,color:"#64748B",margin:0},role:"status","aria-live":"polite",children:fh[D]},`${m}-${D}`)]})]})}),v.jsxs("div",{children:[v.jsx("p",{style:{fontSize:11,fontWeight:700,color:"#94A3B8",letterSpacing:"0.08em",textTransform:"uppercase",margin:"0 0 8px"},children:fe?"Initializing":"Gathering quotes"}),v.jsx("div",{style:{height:6,background:"#F1F5F9",borderRadius:100,overflow:"hidden"},children:v.jsx("div",{style:{height:"100%",width:"35%",background:s.accent,borderRadius:100,animation:"shimmerSlide 1.4s ease-in-out infinite"},"aria-hidden":"true"})})]})]})]})})]})}function q5({onGoBack:e}){return v.jsxs("section",{className:"mt-4",role:"alert","aria-labelledby":"submission-error-title",children:[v.jsxs("div",{className:"rounded-xl border border-red-200 bg-red-50 p-5",children:[v.jsx("h3",{id:"submission-error-title",className:"text-base font-semibold text-red-700",children:"Sorry, quote submission failed"}),v.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."})]}),v.jsx("div",{className:"mt-5",children:v.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 mh={intercomAppId:"",cobrowseLicense:""};function wz(){try{return typeof mh<"u"&&mh?mh:{}}catch{return{}}}function Tz(e){const t=wz(),n=t.intercomAppId,i=t.cobrowseLicense;return{enabled:!!(n||i),intercomAppId:n||void 0,cobrowseLicense:i||void 0,proactiveOnError:!0}}const ph=new Map;function K5(e){if(typeof document>"u")return Promise.reject(new Error("loadScript called without a document"));const t=ph.get(e);if(t)return t;const n=new Promise((i,o)=>{const s=document.createElement("script");s.src=e,s.async=!0,s.onload=()=>i(),s.onerror=()=>{ph.delete(e),o(new Error(`Failed to load script: ${e}`))},document.head.appendChild(s)});return ph.set(e,n),n}let _0=!1;function Nz(){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 Mz(e){const t={app_id:e,hide_default_launcher:!0},n=rf();return n&&(t.quote_id=n),t}function W5(e){if(typeof window>"u")return;Nz();const t=Mz(e);if(window.intercomSettings=t,_0){window.Intercom("update",t);return}window.Intercom("boot",t),_0=!0,K5(`https://widget.intercom.io/widget/${e}`).catch(()=>{})}function Rz(){typeof window?.Intercom=="function"&&window.Intercom("show")}function Oz(e){typeof window?.Intercom=="function"&&window.Intercom("showNewMessage",e)}function kz(e){typeof window?.Intercom=="function"&&window.Intercom("update",e)}function Bz(){if(typeof window?.Intercom=="function")try{window.Intercom("shutdown")}catch{}_0=!1}const Lz="https://js.cobrowse.io/CobrowseIO.js";let E0=!1;async function Pz(e){await K5(Lz);const t=window.CobrowseIO;if(!t)return null;if(!E0){t.license=e,t.redactedViews=["input","select","textarea","[data-credify-redact]"],t.customData={quote_id:rf()??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?.(),E0=!0}return t}async function Iz(e){if(typeof window>"u")return null;try{const t=await Pz(e);return t?.createSessionCode?await t.createSessionCode():null}catch{return null}}function Fz(){try{window.CobrowseIO?.stop?.()}catch{}E0=!1}const jz="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 sr=null,Xc=null,S0=!1;function zz(e){Gz();const t=Tz();if(sr=t,!!t.enabled&&t.proactiveOnError&&t.intercomAppId){const n=i=>{S0||(S0=!0,W5(t.intercomAppId),kz({last_quote_error:i?.reason??"unknown"}),Oz(jz))};P5("submissionFailed",n),Xc=n}}function Q5(){!sr?.enabled||!sr.intercomAppId||(W5(sr.intercomAppId),Rz())}function Uz(){return!sr?.enabled||!sr.cobrowseLicense?Promise.resolve(null):Iz(sr.cobrowseLicense)}function Hz(){return!!(sr?.enabled&&sr.intercomAppId)}function Vz(){return!!(sr?.enabled&&sr.cobrowseLicense)}function Gz(){Xc&&(I5("submissionFailed",Xc),Xc=null),Bz(),Fz(),S0=!1,sr=null}const Zz="Chat with our support team in real time — we'll help you finish your quote.",Yz="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.",q3="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",K3="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 qz(){const e=Hz(),t=Vz(),[n,i]=b.useState(null),[o,s]=b.useState(!1),[c,d]=b.useState(!1),[m,h]=b.useState(null),y=b.useCallback(async()=>{s(!0),d(!1);try{const g=await Uz();g?i(g):d(!0)}finally{s(!1)}},[]);return!e&&!t?null:v.jsxs("div",{className:"flex flex-col items-center gap-1.5 text-sm text-slate-500",children:[v.jsx("span",{className:"font-medium",children:"Need help?"}),v.jsxs("div",{className:"inline-flex items-center gap-1",children:[e&&v.jsxs("span",{className:"relative inline-flex",onMouseEnter:()=>h("chat"),onMouseLeave:()=>h(null),children:[v.jsx("button",{type:"button",onClick:Q5,onFocus:()=>h("chat"),onBlur:()=>h(null),onKeyDown:g=>{g.key==="Escape"&&(g.stopPropagation(),h(null))},"aria-label":"Chat with support","aria-describedby":"credify-chat-tooltip",className:q3,children:v.jsx("svg",{className:"h-5 w-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:v.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"})})}),v.jsx("span",{id:"credify-chat-tooltip",role:"tooltip",className:`${K3} ${m==="chat"?"opacity-100":"opacity-0"}`,children:Zz})]}),e&&t&&v.jsx("span",{className:"mx-1 h-6 w-px bg-slate-200","aria-hidden":"true"}),t&&v.jsxs("span",{className:"relative inline-flex",onMouseEnter:()=>h("screen"),onMouseLeave:()=>h(null),children:[v.jsx("button",{type:"button",onClick:y,disabled:o,onFocus:()=>h("screen"),onBlur:()=>h(null),onKeyDown:g=>{g.key==="Escape"&&(g.stopPropagation(),h(null))},"aria-label":"Share your screen with an agent","aria-describedby":"credify-cobrowse-tooltip",className:q3,children:o?v.jsx("span",{className:"h-4 w-4 animate-spin rounded-full border-2 border-slate-300 border-t-slate-600","aria-hidden":"true"}):v.jsxs("svg",{className:"h-5 w-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[v.jsx("rect",{x:"2.5",y:"4",width:"19",height:"13",rx:"2"}),v.jsx("path",{d:"M8 21h8M12 17v4",strokeLinecap:"round"}),v.jsx("path",{d:"M12 13V8m0 0-2 2m2-2 2 2",strokeLinecap:"round",strokeLinejoin:"round"})]})}),v.jsx("span",{id:"credify-cobrowse-tooltip",role:"tooltip",className:`${K3} ${m==="screen"?"opacity-100":"opacity-0"}`,children:Yz})]})]}),n&&v.jsxs("span",{children:["Read this code to your agent: ",v.jsx("strong",{className:"tracking-widest text-text-primary",children:n})]}),c&&v.jsx("span",{className:"text-red-600",children:"Couldn't start screen sharing. Please try chat instead."})]})}let W3=null;function Kz(){const e=W3;return W3=null,e}let Wz=!1;function Qz(){return Wz}function He(e){if(e===!0)return"Yes";if(e===!1)return"No"}function $n(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 Jz(e){const t=e,n={};t.phone&&(n.phone=t.phone),t.first_name&&(n.first_name=t.first_name),t.last_name&&(n.last_name=t.last_name),t.email&&(n.email=t.email),t.date_of_birth&&(n.date_of_birth=$n(t.date_of_birth)),t.product&&(n.product=t.product),t.state&&(n.state=t.state),t.postal_code&&(n.postal_code=t.postal_code);const i=[];t.line_1&&i.push(t.line_1),t.line_2&&i.push(t.line_2),t.city&&i.push(t.city),t.state&&i.push(t.state),t.postal_code&&i.push(t.postal_code),i.length>0&&(n.address=i.join(", ")),typeof t.ssn_display=="string"&&(n.ssn_display=t.ssn_display),t.years_at_address!==null&&t.years_at_address!==void 0&&(n.years_at_address=t.years_at_address),t.months_at_address!==null&&t.months_at_address!==void 0&&(n.months_at_address=t.months_at_address),t.move_in_date&&(n.move_in_date=$n(t.move_in_date));const o=[];t.prior_line_1&&o.push(t.prior_line_1),t.prior_line_2&&o.push(t.prior_line_2),t.prior_city&&o.push(t.prior_city),t.prior_state&&o.push(t.prior_state),t.prior_postal_code&&o.push(t.prior_postal_code),o.length>0&&(n.prior_address=o.join(", ")),t.years_at_prior_address!==null&&t.years_at_prior_address!==void 0&&(n.years_at_prior_address=t.years_at_prior_address),t.is_mailing_address_different!==null&&t.is_mailing_address_different!==void 0&&(n.is_mailing_address_different=He(t.is_mailing_address_different)),t.mailing_address&&(n.mailing_address=t.mailing_address),t.effective_date&&(n.effective_date=$n(t.effective_date)),t.auto_has_prior_insurance!==null&&t.auto_has_prior_insurance!==void 0&&(n.auto_has_prior_insurance=He(t.auto_has_prior_insurance)),t.auto_prior_expiration_date&&(n.auto_prior_expiration_date=$n(t.auto_prior_expiration_date)),t.auto_prior_carrier_name&&(n.auto_prior_carrier_name=t.auto_prior_carrier_name),t.auto_prior_liability_limit&&(n.auto_prior_liability_limit=t.auto_prior_liability_limit),t.auto_reason_for_no_insurance&&(n.auto_reason_for_no_insurance=t.auto_reason_for_no_insurance),t.auto_prior_years!==null&&t.auto_prior_years!==void 0&&(n.auto_prior_years=t.auto_prior_years),t.auto_prior_months!==null&&t.auto_prior_months!==void 0&&(n.auto_prior_months=t.auto_prior_months),t.auto_continuous_coverage_years!==null&&t.auto_continuous_coverage_years!==void 0&&(n.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&&(n.auto_cancelled_declined_refused_to_renew=He(t.auto_cancelled_declined_refused_to_renew)),t.auto_current_annual_premium_cents!==null&&t.auto_current_annual_premium_cents!==void 0&&(n.auto_current_annual_premium_cents=t.auto_current_annual_premium_cents),t.policy_bi&&(n.policy_bi=t.policy_bi),t.policy_um&&(n.policy_um=t.policy_um),t.policy_pd&&(n.policy_pd=t.policy_pd),t.policy_mp&&(n.policy_mp=t.policy_mp),t.policy_umpd&&(n.policy_umpd=t.policy_umpd),t.policy_pip&&(n.policy_pip=t.policy_pip),t.policy_auto_death_indemnity&&(n.policy_auto_death_indemnity=t.policy_auto_death_indemnity),t.driver_vehicle_assignments&&(n.driver_vehicle_assignments=t.driver_vehicle_assignments),t.home_has_prior_insurance!==null&&t.home_has_prior_insurance!==void 0&&(n.home_has_prior_insurance=He(t.home_has_prior_insurance)),t.home_prior_expiration_date&&(n.home_prior_expiration_date=$n(t.home_prior_expiration_date)),t.home_prior_carrier_name&&(n.home_prior_carrier_name=t.home_prior_carrier_name),t.home_prior_years!==null&&t.home_prior_years!==void 0&&(n.home_prior_years=t.home_prior_years),t.home_continuous_coverage_years!==null&&t.home_continuous_coverage_years!==void 0&&(n.home_continuous_coverage_years=t.home_continuous_coverage_years),t.property_insurance_cancelled!==null&&t.property_insurance_cancelled!==void 0&&(n.property_insurance_cancelled=He(t.property_insurance_cancelled)),t.lapse_in_coverage!==null&&t.lapse_in_coverage!==void 0&&(n.lapse_in_coverage=He(t.lapse_in_coverage)),t.year_built!==null&&t.year_built!==void 0&&(n.year_built=t.year_built),t.number_of_units!==null&&t.number_of_units!==void 0&&(n.number_of_units=t.number_of_units),t.number_of_stories!==null&&t.number_of_stories!==void 0&&(n.number_of_stories=t.number_of_stories),t.number_of_beds!==null&&t.number_of_beds!==void 0&&(n.number_of_beds=t.number_of_beds),t.number_of_full_baths!==null&&t.number_of_full_baths!==void 0&&(n.number_of_full_baths=t.number_of_full_baths),t.number_of_partial_baths!==null&&t.number_of_partial_baths!==void 0&&(n.number_of_partial_baths=t.number_of_partial_baths),t.under_construction!==null&&t.under_construction!==void 0&&(n.under_construction=He(t.under_construction)),t.distance_from_fire_hydrant_ft&&(n.distance_from_fire_hydrant_ft=t.distance_from_fire_hydrant_ft),t.distance_from_fire_station_miles&&(n.distance_from_fire_station_miles=t.distance_from_fire_station_miles),t.architectural_style&&(n.architectural_style=t.architectural_style),t.dwelling_type&&(n.dwelling_type=t.dwelling_type),t.construction_quality&&(n.construction_quality=t.construction_quality),t.located_over_water!==null&&t.located_over_water!==void 0&&(n.located_over_water=t.located_over_water),t.construction_type&&(n.construction_type=t.construction_type),t.exterior_wall_type&&(n.exterior_wall_type=t.exterior_wall_type),t.foundation_type&&(n.foundation_type=t.foundation_type),t.roof_material_type&&(n.roof_material_type=t.roof_material_type),t.roof_shape&&(n.roof_shape=t.roof_shape),t.roof_updated_type&&(n.roof_updated_type=t.roof_updated_type),t.year_roof_updated!==null&&t.year_roof_updated!==void 0&&(n.year_roof_updated=t.year_roof_updated),t.mit_credit_form!==null&&t.mit_credit_form!==void 0&&(n.mit_credit_form=He(t.mit_credit_form)),t.storm_shutters!==null&&t.storm_shutters!==void 0&&(n.storm_shutters=He(t.storm_shutters)),t.heating_type&&(n.heating_type=t.heating_type),t.oil_tank_location&&(n.oil_tank_location=t.oil_tank_location),t.heating_fuel_type&&(n.heating_fuel_type=t.heating_fuel_type),t.number_of_fireplaces!==null&&t.number_of_fireplaces!==void 0&&(n.number_of_fireplaces=t.number_of_fireplaces),t.basement_type&&(n.basement_type=t.basement_type),t.parking_type&&(n.parking_type=t.parking_type),t.garage_type&&(n.garage_type=t.garage_type),t.number_of_parking_spaces!==null&&t.number_of_parking_spaces!==void 0&&(n.number_of_parking_spaces=t.number_of_parking_spaces),t.plumbing_type&&(n.plumbing_type=t.plumbing_type),t.pool_type&&(n.pool_type=t.pool_type),t.total_area_sq_ft!==null&&t.total_area_sq_ft!==void 0&&(n.total_area_sq_ft=t.total_area_sq_ft),t.parcel_area_sq_ft!==null&&t.parcel_area_sq_ft!==void 0&&(n.parcel_area_sq_ft=t.parcel_area_sq_ft),t.residence_type&&(n.residence_type=t.residence_type),t.usage_type&&(n.usage_type=t.usage_type),t.household_size!==null&&t.household_size!==void 0&&(n.household_size=t.household_size),t.number_of_mortgagees!==null&&t.number_of_mortgagees!==void 0&&(n.number_of_mortgagees=t.number_of_mortgagees),t.has_dog!==null&&t.has_dog!==void 0&&(n.has_dog=He(t.has_dog)),t.dog_breed_type&&(n.dog_breed_type=t.dog_breed_type),t.number_of_dogs!==null&&t.number_of_dogs!==void 0&&(n.number_of_dogs=t.number_of_dogs),t.has_vicious_animals!==null&&t.has_vicious_animals!==void 0&&(n.has_vicious_animals=He(t.has_vicious_animals)),t.has_business_on_premises!==null&&t.has_business_on_premises!==void 0&&(n.has_business_on_premises=He(t.has_business_on_premises)),t.business_class&&(n.business_class=t.business_class),t.occupancy_type&&(n.occupancy_type=t.occupancy_type),t.short_term_rental!==null&&t.short_term_rental!==void 0&&(n.short_term_rental=He(t.short_term_rental)),t.sale_price_cents!==null&&t.sale_price_cents!==void 0&&(n.sale_price_cents=Math.round(Number(t.sale_price_cents)/100)),t.number_of_families!==null&&t.number_of_families!==void 0&&(n.number_of_families=t.number_of_families),t.number_of_units_in_firewall!==null&&t.number_of_units_in_firewall!==void 0&&(n.number_of_units_in_firewall=t.number_of_units_in_firewall),t.heating_update_yn!==null&&t.heating_update_yn!==void 0&&(n.heating_update_yn=He(t.heating_update_yn)),t.heating_update_type&&(n.heating_update_type=t.heating_update_type),t.heating_update_year!==null&&t.heating_update_year!==void 0&&(n.heating_update_year=t.heating_update_year),t.plumbing_update_yn!==null&&t.plumbing_update_yn!==void 0&&(n.plumbing_update_yn=He(t.plumbing_update_yn)),t.plumbing_update_type&&(n.plumbing_update_type=t.plumbing_update_type),t.plumbing_update_year!==null&&t.plumbing_update_year!==void 0&&(n.plumbing_update_year=t.plumbing_update_year),t.electrical_update_yn!==null&&t.electrical_update_yn!==void 0&&(n.electrical_update_yn=He(t.electrical_update_yn)),t.electrical_update_type&&(n.electrical_update_type=t.electrical_update_type),t.electrical_update_year!==null&&t.electrical_update_year!==void 0&&(n.electrical_update_year=t.electrical_update_year),t.electric_circuit_breaker!==null&&t.electric_circuit_breaker!==void 0&&(n.electric_circuit_breaker=He(t.electric_circuit_breaker)),t.dwelling_replacement_cost!==null&&t.dwelling_replacement_cost!==void 0&&(n.dwelling_replacement_cost=t.dwelling_replacement_cost),t.other_structures_coverage!==null&&t.other_structures_coverage!==void 0&&(n.other_structures_coverage=t.other_structures_coverage),t.personal_property_coverage!==null&&t.personal_property_coverage!==void 0&&(n.personal_property_coverage=t.personal_property_coverage),t.loss_of_use_coverage!==null&&t.loss_of_use_coverage!==void 0&&(n.loss_of_use_coverage=t.loss_of_use_coverage),t.personal_liability&&(n.personal_liability=t.personal_liability),t.dwelling_medical_payments&&(n.dwelling_medical_payments=t.dwelling_medical_payments),t.all_perils_deductible&&(n.all_perils_deductible=t.all_perils_deductible),t.windstorm_deductible&&(n.windstorm_deductible=t.windstorm_deductible),t.has_garage!==null&&t.has_garage!==void 0&&(n.has_garage=He(t.has_garage)),t.has_pool!==null&&t.has_pool!==void 0&&(n.has_pool=He(t.has_pool)),t.has_trampoline!==null&&t.has_trampoline!==void 0&&(n.has_trampoline=He(t.has_trampoline)),t.gender&&(n.gender=t.gender),t.marital_status&&(n.marital_status=t.marital_status),t.employment_industry&&(n.employment_industry=t.employment_industry),t.occupation&&(n.occupation=t.occupation),t.has_co_applicant!==null&&t.has_co_applicant!==void 0&&(n.has_co_applicant=He(t.has_co_applicant)),t.co_applicant_first_name&&(n.co_applicant_first_name=t.co_applicant_first_name),t.co_applicant_middle_name&&(n.co_applicant_middle_name=t.co_applicant_middle_name),t.co_applicant_last_name&&(n.co_applicant_last_name=t.co_applicant_last_name),t.co_applicant_gender&&(n.co_applicant_gender=t.co_applicant_gender),t.co_applicant_marital_status&&(n.co_applicant_marital_status=t.co_applicant_marital_status),t.co_applicant_relationship&&(n.co_applicant_relationship=t.co_applicant_relationship),t.co_applicant_date_of_birth&&(n.co_applicant_date_of_birth=$n(t.co_applicant_date_of_birth)),t.co_applicant_employment_industry&&(n.co_applicant_employment_industry=t.co_applicant_employment_industry),t.co_applicant_occupation&&(n.co_applicant_occupation=t.co_applicant_occupation),t.retiree_discount!==null&&t.retiree_discount!==void 0&&(n.retiree_discount=He(t.retiree_discount)),t.gated_community_discount!==null&&t.gated_community_discount!==void 0&&(n.gated_community_discount=He(t.gated_community_discount)),t.multi_policy_discount!==null&&t.multi_policy_discount!==void 0&&(n.multi_policy_discount=He(t.multi_policy_discount)),t.non_smoker_discount!==null&&t.non_smoker_discount!==void 0&&(n.non_smoker_discount=He(t.non_smoker_discount)),t.first_time_buyer_discount!==null&&t.first_time_buyer_discount!==void 0&&(n.first_time_buyer_discount=He(t.first_time_buyer_discount)),t.fire_detection_system!==null&&t.fire_detection_system!==void 0&&(n.fire_detection_system=He(t.fire_detection_system)),t.fire_detection_system_type&&(n.fire_detection_system_type=t.fire_detection_system_type),t.burglar_alarm_system!==null&&t.burglar_alarm_system!==void 0&&(n.burglar_alarm_system=He(t.burglar_alarm_system)),t.burglar_alarm_system_type&&(n.burglar_alarm_system_type=t.burglar_alarm_system_type),t.smoke_detectors!==null&&t.smoke_detectors!==void 0&&(n.smoke_detectors=He(t.smoke_detectors)),t.sprinkler_system!==null&&t.sprinkler_system!==void 0&&(n.sprinkler_system=He(t.sprinkler_system)),t.sprinkler_system_type&&(n.sprinkler_system_type=t.sprinkler_system_type),t.gas_leakage_detector!==null&&t.gas_leakage_detector!==void 0&&(n.gas_leakage_detector=He(t.gas_leakage_detector)),t.deadbolt_locks!==null&&t.deadbolt_locks!==void 0&&(n.deadbolt_locks=He(t.deadbolt_locks)),t.fire_extinguisher!==null&&t.fire_extinguisher!==void 0&&(n.fire_extinguisher=He(t.fire_extinguisher)),t.order_credit_authorized!==null&&t.order_credit_authorized!==void 0&&(n.order_credit_authorized=He(t.order_credit_authorized)),t.has_health_insurance_auto_accident!==null&&t.has_health_insurance_auto_accident!==void 0&&(n.has_health_insurance_auto_accident=He(t.has_health_insurance_auto_accident)),t.is_corporation!==null&&t.is_corporation!==void 0&&(n.is_corporation=He(t.is_corporation)),t.named_insured_foreclosure_repo_bankruptcy!==null&&t.named_insured_foreclosure_repo_bankruptcy!==void 0&&(n.named_insured_foreclosure_repo_bankruptcy=He(t.named_insured_foreclosure_repo_bankruptcy)),t.named_insured_convicted_insurance_fraud!==null&&t.named_insured_convicted_insurance_fraud!==void 0&&(n.named_insured_convicted_insurance_fraud=He(t.named_insured_convicted_insurance_fraud));const s={};if(t.vehicles)for(const c of t.vehicles)c.quote_vehicle_id&&c.vin&&(s[c.quote_vehicle_id]=c.vin);return t.drivers&&t.drivers.length>0?(n.drivers="Yes",n.drivers__items=t.drivers.map(c=>{const d=c,m={};d.first_name&&(m.first_name=d.first_name),d.middle_name&&(m.middle_name=d.middle_name),d.last_name&&(m.last_name=d.last_name),d.date_of_birth&&(m.date_of_birth=$n(d.date_of_birth)),d.gender&&(m.gender=d.gender),d.marital_status&&(m.marital_status=d.marital_status),d.relationship_to_insured&&(m.relationship_to_insured=d.relationship_to_insured),d.is_registered_owner!==null&&d.is_registered_owner!==void 0&&(m.is_registered_owner=d.is_registered_owner?"Yes":"No"),d.license_state&&(m.license_state=d.license_state),d.license_status&&(m.license_status=d.license_status),d.license_number&&(m.license_number=d.license_number),d.date_first_licensed&&(m.date_first_licensed=$n(d.date_first_licensed)),d.education_level&&(m.education_level=S5(d.education_level)),d.occupation&&(m.occupation=D5(d.occupation)),d.industry&&(m.industry=Dd(d.industry)),d.employment_status&&(m.employment_status=d.employment_status),d.last_5_years_license_suspended_or_revoked!==null&&d.last_5_years_license_suspended_or_revoked!==void 0&&(m.last_5_years_license_suspended_or_revoked=He(d.last_5_years_license_suspended_or_revoked)),d.accident_prevention_course!==null&&d.accident_prevention_course!==void 0&&(m.accident_prevention_course=He(d.accident_prevention_course)),d.accident_prevention_course_date&&(m.accident_prevention_course_date=$n(d.accident_prevention_course_date)),d.sr22!==null&&d.sr22!==void 0&&(m.sr22=He(d.sr22));const h=d.ssn_display;typeof h=="string"&&(m.ssn_display=h);const y=d.driver_violations;y&&y.length>0&&(m.driver_violations="Yes",m.driver_violations__items=y.map(S=>{const D={};return S.code&&(D.code=S.code),S.occurred_at&&(D.occurred_at=$n(S.occurred_at)),D}));const g=d.driver_accidents;g&&g.length>0&&(m.driver_accidents="Yes",m.driver_accidents__items=g.map(S=>{const D={};return S.occurred_at&&(D.occurred_at=$n(S.occurred_at)),S.description&&(D.description=S.description),S.quote_vehicle_id&&(D.quote_vehicle_id=s[S.quote_vehicle_id]??S.quote_vehicle_id),S.property_damage_amount_paid_cents!==null&&S.property_damage_amount_paid_cents!==void 0&&(D.property_damage_amount_paid_cents=S.property_damage_amount_paid_cents),S.personal_injury_amount_paid_cents!==null&&S.personal_injury_amount_paid_cents!==void 0&&(D.personal_injury_amount_paid_cents=S.personal_injury_amount_paid_cents),D}));const E=d.losses;return E&&E.length>0&&(m.losses="Yes",m.losses__items=E.map(S=>{const D={};return S.description&&(D.description=S.description),S.date_of_incident&&(D.date_of_incident=$n(S.date_of_incident)),S.amount_paid_cents!==null&&S.amount_paid_cents!==void 0&&(D.amount_paid_cents=S.amount_paid_cents),S.quote_vehicle_id&&(D.quote_vehicle_id=s[S.quote_vehicle_id]??S.quote_vehicle_id),D})),m})):n.drivers="No",t.vehicles&&t.vehicles.length>0?(n.vehicles="Yes",n.vehicles__items=t.vehicles.map(c=>{const d=c,m={};d.vin&&(m.vin=d.vin),d.year!==null&&d.year!==void 0&&(m.year=String(d.year)),d.make&&(m.make=d.make),d.model&&(m.model=d.model),d.body_style&&(m.body_style=d.body_style),d.ownership_type&&(m.ownership_type=d.ownership_type),d.usage&&(m.usage=d.usage),d.annual_mileage!==null&&d.annual_mileage!==void 0&&(m.annual_mileage=d.annual_mileage),d.miles_to_work!==null&&d.miles_to_work!==void 0&&(m.miles_to_work=d.miles_to_work),d.percent_to_work!==null&&d.percent_to_work!==void 0&&(m.percent_to_work=d.percent_to_work);const h=[];return d.garaging_address_line_1&&h.push(d.garaging_address_line_1),d.garaging_address_line_2&&h.push(d.garaging_address_line_2),d.garaging_address_city&&h.push(d.garaging_address_city),d.garaging_address_state&&h.push(d.garaging_address_state),d.garaging_address_postal_code&&h.push(d.garaging_address_postal_code),h.length>0&&(m.garaging_address=h.join(", ")),d.new_when_purchased!==null&&d.new_when_purchased!==void 0&&(m.new_when_purchased=He(d.new_when_purchased)),d.purchase_date&&(m.purchase_date=$n(d.purchase_date)),d.anti_theft_type&&(m.anti_theft_type=d.anti_theft_type),d.passive_restraint_type&&(m.passive_restraint_type=d.passive_restraint_type),d.anti_lock_brakes!==null&&d.anti_lock_brakes!==void 0&&(m.anti_lock_brakes=He(d.anti_lock_brakes)),d.daytime_running_lights!==null&&d.daytime_running_lights!==void 0&&(m.daytime_running_lights=He(d.daytime_running_lights)),d.custom_equipment_value_cents!==null&&d.custom_equipment_value_cents!==void 0&&(m.custom_equipment_value_cents=d.custom_equipment_value_cents),d.cost_new_value_cents!==null&&d.cost_new_value_cents!==void 0&&(m.cost_new_value_cents=d.cost_new_value_cents),d.stated_value_amount_cents!==null&&d.stated_value_amount_cents!==void 0&&(m.stated_value_amount_cents=d.stated_value_amount_cents),d.vehicle_has_modifications!==null&&d.vehicle_has_modifications!==void 0&&(m.vehicle_has_modifications=He(d.vehicle_has_modifications)),d.vehicle_garaged_at_residence!==null&&d.vehicle_garaged_at_residence!==void 0&&(m.vehicle_garaged_at_residence=He(d.vehicle_garaged_at_residence)),d.vehicle_comp_deductible&&(m.vehicle_comp_deductible=d.vehicle_comp_deductible),d.vehicle_coll_deductible&&(m.vehicle_coll_deductible=d.vehicle_coll_deductible),d.vehicle_towing_and_labor&&(m.vehicle_towing_and_labor=d.vehicle_towing_and_labor),d.vehicle_transportation_expense&&(m.vehicle_transportation_expense=d.vehicle_transportation_expense),d.vehicle_full_glass!==null&&d.vehicle_full_glass!==void 0&&(m.vehicle_full_glass=He(d.vehicle_full_glass)),d.vehicle_loan_lease!==null&&d.vehicle_loan_lease!==void 0&&(m.vehicle_loan_lease=He(d.vehicle_loan_lease)),d.coverages&&d.coverages.length>0&&(m.coverages__items=d.coverages.map(y=>{const g={};return y.type&&(g.type=y.type),y.per_person_limit_cents!==null&&y.per_person_limit_cents!==void 0&&(g.per_person_limit_cents=y.per_person_limit_cents),y.per_incident_limit_cents!==null&&y.per_incident_limit_cents!==void 0&&(g.per_incident_limit_cents=y.per_incident_limit_cents),y.per_incident_limit_percent!==null&&y.per_incident_limit_percent!==void 0&&(g.per_incident_limit_percent=y.per_incident_limit_percent),y.per_day_limit_cents!==null&&y.per_day_limit_cents!==void 0&&(g.per_day_limit_cents=y.per_day_limit_cents),y.deductible_cents!==null&&y.deductible_cents!==void 0&&(g.deductible_cents=y.deductible_cents),y.is_declined!==null&&y.is_declined!==void 0&&(g.is_declined=He(y.is_declined)),g})),d.vehicle_lienholders&&d.vehicle_lienholders.length>0&&(m.vehicle_lienholders__items=d.vehicle_lienholders.map(y=>{const g={};return y.name&&(g.name=y.name),y.type&&(g.type=y.type),y.line_1&&(g.line_1=y.line_1),y.line_2&&(g.line_2=y.line_2),y.city&&(g.city=y.city),y.state&&(g.state=y.state),y.postal_code&&(g.postal_code=y.postal_code),y.phone&&(g.phone=y.phone),y.fax&&(g.fax=y.fax),g})),m})):n.vehicles="No",t.losses&&t.losses.length>0?(n.home_losses="Yes",n.home_losses__items=t.losses.map(c=>{const d={};return c.description&&(d.description=c.description),c.date_of_incident&&(d.date_of_incident=$n(c.date_of_incident)),c.amount_paid_cents!==null&&c.amount_paid_cents!==void 0&&(d.amount_paid_cents=Math.round(Number(c.amount_paid_cents)/100)),d})):n.home_losses="No",n}const Xz={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 eU(e){return Xz[e]||e}const Q3=new Set(["Zip","Product","Driver","Vehicle"]);function tU(e){return e?Array.isArray(e.drivers__items)?e.drivers__items.length:Array.isArray(e.drivers)?e.drivers.length:null:null}function J3(e,t){const n=tU(t),i=e.filter(s=>s.key!=="AutoPolicy"),o=i.length>0?i:e;return o}function nU(e,t){const n=e.findIndex(o=>o.key===t);return n<0?t:e[n+1]?.key??t}function J5(e){return e.some(t=>String(t.key)==="BundlePolicy"||String(t.key)==="BundleCustomer")}function X3(e){return J5(e)?"Bundle":e.some(t=>String(t.key)==="Vehicle"||String(t.key)==="Driver")?"Auto":"Home"}const rU={Auto:45e3,Home:5e4,Bundle:1e5},eE=["a[href]","button:not([disabled])","textarea:not([disabled])","input:not([disabled])","select:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");function aU(e,t){if(e!=="AutoCurrentCarrier")return t;const n=t.some(s=>String(s.key)==="auto_cancelled_declined_refused_to_renew"),i=t.some(s=>String(s.key)==="vehicle_policy_selections"),o=[...t];return n||o.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}),i||o.push({question:"Vehicle coverage selections",inputType:"custom",key:"vehicle_policy_selections",required:!1}),o}function iU(e,t){if(e!=="Vehicle")return t;const n=i=>i.map(o=>{const s=o.conditionals?.map(c=>{const d=c.conditionalQuestions??[];return d.length?{...c,conditionalQuestions:n(d)}:c});return String(o.key)!=="vin"?s?{...o,conditionals:s}:o:{...o,required:!1,...s?{conditionals:s}:{}}});return n(t)}function oU({isOpen:e,onClose:t}){const[n,i]=b.useState([]),[o,s]=b.useState(null),c=b.useRef(null);b.useEffect(()=>{c.current=o},[o]);const[d,m]=b.useState(null),[h,y]=b.useState(!1),[g,E]=b.useState(!1),[S,D]=b.useState(!1),[x,w]=b.useState(!1),[R,I]=b.useState([]),A=b.useRef(null),[L,M]=b.useState(null),[Z,V]=b.useState(void 0),[fe,ne]=b.useState(!1),[pe,J]=b.useState(null),[ye,Ae]=b.useState(null),[j,de]=b.useState(!1),[k,B]=b.useState(!1),[X,F]=b.useState(!1),G=b.useRef(!1),C=b.useRef(null),U=b.useRef(null),W=b.useRef(null),Y=b.useRef(null),[te,z]=b.useState(!1);b.useEffect(()=>{if(!S||x)return;const se=X3(n);let _e=!1;const be=[];let xe=0,$e=0;const Me=66,re=3,oe=5e3;let Ce=!1;const Ee=async()=>{if(_e)return;xe++;try{const{quote:Re}=await S3(o??void 0);if(_e)return;if($e=0,!Ce){const qe=Re?.appetites??null,Ue=iz(qe,se);Ue.length>0&&(I(Ue),Ce=!0)}const ke=Re?.rates_status??null;if(ke==="completed"){const{rates:qe}=await lh(o??void 0);if(_e)return;A.current=qe,w(!0);return}if(ke==="no_rates"){A.current=[],w(!0);return}if(ke==="failed"){Uo(new Error("Quote failed: rate-generation worker reported rates_status=failed"),{quoteId:c.current??void 0,phase:"rates_status_failed"}),ps({reason:"submission"}),J({message:"submission_failed"}),D(!1);return}}catch(Re){if($e++,console.warn("Provider polling: getQuote failed",{attempt:xe,consecutiveFailures:$e,error:Re}),$e>=re){Re?.__sentryReported||Uo(Re,{quoteId:c.current??void 0,phase:"rates_polling",message:`Quote failed: ${re} consecutive get-quote poll failures`}),ps({reason:"network"}),J({message:"submission_failed"}),D(!1);return}}if(_e)return;if(xe>=Me){Uo(new Error(`Quote failed: rate-generation timed out after ${Me} polls`),{quoteId:c.current??void 0,phase:"rates_polling_timeout"}),ps({reason:"timeout"}),J({message:"submission_failed"}),D(!1);return}const Te=window.setTimeout(Ee,oe);be.push(Te)};return Ee(),()=>{_e=!0,be.forEach(Te=>window.clearTimeout(Te))}},[S,x,n,o]);function T(se){return se.map(be=>({key:be,title:eU(be),loadQuestions:async()=>{const xe=await XF(be,c.current??void 0);let $e=aU(be,xe.questions);return $e=iU(be,$e),$e}}))}b.useEffect(()=>{const se=async()=>{try{const _e=Kz();if(_e)try{const{token:xe,quoteId:$e}=await tj(_e);xe&&$e&&(Wc(xe),f3($e))}catch(xe){xe.statusCode===401&&B(!0)}const be=rf();if(Qc(),be){ne(!0),s(be);try{const xe=Jr(),$e=await S3(xe?void 0:be);if(!$e||!$e.quote)throw new Error("Invalid response from getQuote: missing quote data");const{quote:Me}=$e,{stages:re}=await Bc(be),oe=T(re);i(oe);let Ce;try{Ce=Jz(Me),M(Ce)}catch(Ue){throw new Error(`Failed to transform quote data: ${Ue instanceof Error?Ue.message:"Unknown error"}`)}const Ee=J3(oe,Ce);i(Ee);const Te=Me?.review_status??null;if(E(Te!=null),Te==="pending_review"&&Jr()){F(!0);return}const Re=Me?.rates_status??null,ke=Jr()!=null;if(ke||Te===null){if(Re==="completed")try{const{rates:Ue}=await lh(ke?void 0:be);m(Ue);return}catch(Ue){console.warn("Failed to fetch completed rates on resume",Ue)}else if(Re==="no_rates"){m([]);return}else if(Re==="processing"){I([]),w(!1),A.current=null,D(!0);return}}V(0)}catch(xe){const $e=xe;if($e.statusCode===404)$5(),s(null);else if($e.statusCode===401){T5();try{const{stages:Me}=await Bc(be),re=T(Me);i(re);const oe=re.findIndex(Ce=>Ce.key==="SMSVerification");V(oe>=0?oe:re.length-1)}catch{}}}finally{ne(!1)}}else{const{stages:xe}=await Bc();i(T(xe))}}catch{ne(!1)}};e&&!G.current&&(G.current=!0,se())},[e]),b.useEffect(()=>{if(!e)return;const{overflow:se}=document.body.style;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=se}},[e]),b.useEffect(()=>{if(!e)return;Y.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const se=window.setTimeout(()=>{const _e=C.current;if(!_e)return;(_e.querySelector(eE)??_e).focus()},0);return()=>{window.clearTimeout(se);const _e=Y.current;Y.current=null,_e&&document.contains(_e)&&_e.focus()}},[e]);const N=b.useCallback(se=>{if(se.key==="Escape"){te?(se.preventDefault(),z(!1)):(se.preventDefault(),z(!0));return}if(se.key!=="Tab")return;const _e=te?U.current:C.current;if(!_e)return;const be=Array.from(_e.querySelectorAll(eE)).filter(re=>!re.hasAttribute("disabled")&&re.getAttribute("aria-hidden")!=="true");if(be.length===0){se.preventDefault(),_e.focus();return}const xe=be[0],$e=be[be.length-1],Me=document.activeElement;se.shiftKey&&Me===xe?(se.preventDefault(),$e.focus()):!se.shiftKey&&Me===$e&&(se.preventDefault(),xe.focus())},[te]);b.useEffect(()=>{if(e)return window.addEventListener("keydown",N),()=>window.removeEventListener("keydown",N)},[e,N]),b.useEffect(()=>{if(!te)return;const se=window.setTimeout(()=>{W.current?.focus()},0);return()=>window.clearTimeout(se)},[te]),b.useEffect(()=>{e||(M(null),V(void 0),ne(!1),D(!1),Ae(null),de(!1),z(!1))},[e]),b.useEffect(()=>{e&&Uj()},[e]),b.useEffect(()=>{d&&Array.isArray(d)&&Zj({rateCount:d.length})},[d]);const ie=b.useCallback(()=>{J(null),V(Math.max(0,n.length-1))},[n.length]),ge=b.useCallback(async(se,_e)=>{try{I([]),w(!1),A.current=null,D(!0);let be;try{be=await La(se,!0,o??void 0)}catch(Me){throw D(!1),Me}if(be.status==="submission_failed"){Uo(new Error(`Quote failed at submission: ${be.message}`),{quoteId:o??void 0,phase:_e}),D(!1),w(!1),A.current=null,ps({reason:"submission"}),J({message:be.message});return}if(be.status==="success")try{const{rates:Me}=await lh(o??void 0);A.current=Me,w(!0)}catch(Me){throw D(!1),Me}const xe=n.length,$e=n[xe-1];L3({stageKey:$e?.key??"unknown",stageTitle:$e?.title??"unknown",stepIndex:xe,totalSteps:xe}),Gj()}catch(be){be?.__sentryReported||Uo(be,{quoteId:o??void 0,phase:_e}),D(!1),ps({reason:"submission"}),J({message:"Oops, something went wrong. Please try again later."})}},[o,n]),Se=b.useCallback(async se=>{if(!(!ye||!o||j)){de(!0);try{const be={...xi(ye.allValues),communications_consent:se};Ae(null),await ge(be,"consent_submit")}finally{de(!1)}}},[ye,o,j,ge]),he=b.useCallback(async se=>{if(!(!o||j)){de(!0);try{M(se);const _e={...xi(se),customer_review_confirmed:!0};await ge(_e,"review_submit")}finally{de(!1)}}},[o,j,ge]);if(!e)return null;const we=()=>{z(!0)},Ie=()=>{z(!1)},me=()=>{Hj(),t()},De=!!(!pe&&d&&o&&!h);return v.jsxs("div",{ref:C,className:"fixed inset-0 z-[9999] flex items-center justify-center",role:"dialog","aria-modal":"true","aria-labelledby":"insurance-modal-title",tabIndex:-1,children:[v.jsx("div",{className:"backdrop","aria-hidden":"true"}),v.jsxs("div",{className:`modal-panel bg-white relative w-full flex flex-col max-h-[90vh] overflow-hidden ${De?"max-w-6xl":"max-w-2xl"}`,role:"document",children:[v.jsx("h2",{id:"insurance-modal-title",className:"sr-only",children:"Credify insurance quote widget"}),v.jsx("button",{onClick:we,className:"modal-close-btn absolute top-4 right-4","aria-label":"Close quote form",type:"button",children:v.jsx("span",{"aria-hidden":"true",children:"×"})}),!S&&!pe&&v.jsx("div",{className:"widget-modal-header text-center",children:v.jsx("h2",{className:"h1-title",children:"Let's shop multiple leading carriers for you"})}),v.jsxs("div",{className:"panel-body flex-1 min-h-0 overflow-hidden",children:[k&&v.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:[v.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."}),v.jsx("button",{type:"button",onClick:()=>B(!1),className:"shrink-0 font-bold text-amber-800 hover:text-amber-900","aria-label":"Dismiss",children:"×"})]}),pe&&v.jsx(q5,{onGoBack:ie}),!pe&&S&&(()=>{const se=X3(n);return v.jsx(Az,{providers:R,totalTime:rU[se],flow:se,isComplete:x,onComplete:()=>{D(!1),w(!1),I([]),A.current&&(m(A.current),A.current=null)}})})(),!pe&&!S&&ye&&v.jsx(kO,{onChoose:Se,isSubmitting:j}),!pe&&!d&&!S&&!ye&&v.jsx(v.Fragment,{children:fe||n.length===0?v.jsx("div",{className:"flex items-center justify-center py-12",children:v.jsx("div",{className:"text-slate-600",children:"Loading..."})}):X&&o?v.jsx(xz,{stages:n,initialValues:L??{},quoteId:o,isSubmitting:j,onConfirmed:he}):v.jsx(nz,{stages:n,initialValues:L??void 0,initialActive:Z,quoteId:o??void 0,nonTerminalStageKeys:Q3,onStageComplete:async(se,_e)=>{try{const be=xi(se);let xe=o,$e=n;const Me=$e.findIndex(Ce=>Ce.key===_e),re=$e[Me],oe=nU($e,_e);if(xe)if(_e==="Phone"){const Ce=be.phone;if(!Ce)throw new Error("Phone number is required.");const Ee=Jr();await La({...be,current_stage:oe},!1,Ee?void 0:xe),await N5(xe,Ce)}else if(_e==="SMSVerification"){const{isVerified:Ce,token:Ee}=await g0(xe,be.sms_code);if(!Ce)throw new Error("Invalid SMS code");Ee&&Wc(Ee),await La({current_stage:oe},!1)}else if(_e==="Product"){const Ce=Jr(),{isSupported:Ee}=await M5(be.state,Ce?void 0:xe??void 0);if(await La({...be,current_stage:Ee?oe:_e},!1,Ce?void 0:xe),!Ee){const Te=Y5(be.state);throw new Error(`Sorry, Credify Corporation doesn't currently offer insurance in ${Te}. We're expanding our coverage and hope to serve your state soon.`)}}else{const Ce=Jr();await La({...be,current_stage:oe},!1,Ce?void 0:xe||void 0)}else{const Ce=be.postal_code??"";if(!Ce)throw new Error("ZIP code is required to start a quote.");const Te=(await ej(Ce,Qz()))?.quoteId;if(!Te||typeof Te!="string"||Te.trim()==="")throw new Error(`Failed to create quote - invalid quoteId returned: ${Te}`);xe=Te,s(Te),f3(Te),await La({...be,current_stage:oe},!1,Te)}if(_e==="Name"&&xe){const Ce=String(se.product??"");(Ce==="Auto"||Ce==="Both")&&Nj(xe)}if(_e==="Vehicle"&&xe&&Oj(xe),Q3.has(_e))try{const{stages:Ce}=await Bc(xe||void 0);$e=T(Ce),$e=J3($e,se),i($e)}catch(Ce){console.warn("Unable to refresh stages after flow-shaping step",Ce)}return L3({stageKey:_e,stageTitle:re?.title??_e,stepIndex:Me+1,totalSteps:$e.length}),{success:!0,latestStages:$e}}catch(be){return{success:!1,error:be instanceof Error?be.message:"An error occurred"}}},onComplete:async(se,_e)=>{if(!o)return{success:!1,error:"Oops, something went wrong. Please try again later."};M(se);try{if(_e==="Phone"){const be=xi(se);if(!be.phone)return{success:!1,error:"Phone number is required."};const $e=Jr();return await La({...be,suppress_verification_sms:!0},!1,$e?void 0:o),Ae({allValues:se}),{success:!0}}if(_e==="SMSVerification"){const be=xi(se),{isVerified:xe,token:$e}=await g0(o,be.sms_code);return xe?($e&&Wc($e),Ae({allValues:se}),{success:!0}):{success:!1,error:"Invalid SMS code"}}return Ae({allValues:se}),{success:!0}}catch{const xe="Oops, something went wrong. Please try again later.";return J({message:xe}),{success:!1,error:xe}}}})})," ",!pe&&d&&o&&v.jsx(fz,{rates:d,onBack:()=>m(null),isBundleFlow:J5(n),quoteId:o,initialPhone:L?.phone??"",requirePursueVerification:g,onSubScreenChange:y})]}),v.jsxs("div",{className:"widget-legal-footer space-y-1.5",children:[v.jsx(qz,{}),v.jsx("p",{className:"text-center text-sm text-slate-500",children:"Insurance products offered through Credify Corporation, a licensed insurance agency."})]}),te&&v.jsx("div",{className:"close-confirm-backdrop",role:"presentation",children:v.jsxs("div",{ref:U,className:"close-confirm-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":"close-confirm-title","aria-describedby":"close-confirm-description",tabIndex:-1,children:[v.jsx("h3",{id:"close-confirm-title",children:"Close quote form?"}),v.jsx("p",{id:"close-confirm-description",children:"Your answers in this session will be lost if you close this window."}),v.jsxs("div",{className:"close-confirm-actions",children:[v.jsx("button",{ref:W,type:"button",className:"btn-outline",onClick:Ie,children:"Keep editing"}),v.jsx("button",{type:"button",className:"btn-primary close-confirm-danger",onClick:me,children:"Close form"})]})]})})]})]})}function lU({onClose:e}){return v.jsxs("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center",role:"dialog","aria-modal":"true",children:[v.jsx("div",{className:"backdrop","aria-hidden":"true"}),v.jsx("div",{className:"modal-panel bg-white relative w-full max-w-2xl p-6",children:v.jsx(q5,{onGoBack:e})})]})}var hh={dsn:"",environment:"production",release:"d9af5afa9b45f9b580135d355b0c26800fe8ccc7"};function sU(){try{return typeof hh<"u"&&hh?hh:{}}catch{return{}}}let tE=!1;function uU(e,t){if(!e)return t;const n=Number(e);return Number.isFinite(n)&&n>=0&&n<=1?n:t}function cU(e={}){if(tE)return!0;if(typeof window>"u")return!1;const t=sU(),n=e.dsn??t.dsn;return!n||e.enabled===!1?!1:(HF({baseUrl:Rt}),I7({dsn:n,environment:e.environment??t.environment??"production",release:e.release??t.release,sendDefaultPii:!1,maxBreadcrumbs:50,tracesSampleRate:e.tracesSampleRate??uU(t.tracesSampleRate,.1),tracePropagationTargets:[Rt],replaysSessionSampleRate:0,replaysOnErrorSampleRate:1,beforeSend:i=>g3(i),beforeBreadcrumb:i=>i&&(g3({breadcrumbs:[i]}),i)}),tE=!0,L7("replayIntegration").then(i=>{try{hT(i({maskAllText:!0,maskAllInputs:!0,blockAllMedia:!0,networkDetailAllowUrls:[Rt],networkCaptureBodies:!1}))}catch{}}).catch(()=>{}),!0)}function dU(){const[e,t]=b.useState(!1);b.useEffect(()=>{cU(),zz()},[]);const n=b.useCallback(o=>{window.parent&&window.parent!==window&&window.parent.postMessage({type:o,source:"credify-insurance-widget"},"*")},[]);b.useEffect(()=>{const o=(c,d,m)=>{window.parent&&window.parent!==window&&window.parent.postMessage({type:"event",source:"credify-insurance-widget",event:c,data:d,meta:m},"*")},s=jj.map(c=>{const d=(m,h)=>o(c,m,h);return P5(c,d),[c,d]});return()=>{for(const[c,d]of s)I5(c,d)}},[]),b.useEffect(()=>{const o=s=>{if(s.data?.source==="credify-insurance-widget")switch(s.data.type){case"open":t(!0),n("opened");break;case"close":t(!1),n("closed");break;case"init":n("ready");break;case"support-open":Q5();break}};return window.addEventListener("message",o),n("ready"),()=>{window.removeEventListener("message",o)}},[n]);const i=b.useCallback(()=>{t(!1),n("closed")},[n]);return v.jsx(P0,{fallback:v.jsx(lU,{onClose:i}),children:v.jsx(oU,{isOpen:e,onClose:i})})}const fU="modulepreload",mU=function(e){return"/iframe/"+e},nE={},pU=function(t,n,i){let o=Promise.resolve();if(n&&n.length>0){let h=function(y){return Promise.all(y.map(g=>Promise.resolve(g).then(E=>({status:"fulfilled",value:E}),E=>({status:"rejected",reason:E}))))};var c=h;document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),m=d?.nonce||d?.getAttribute("nonce");o=h(n.map(y=>{if(y=mU(y),y in nE)return;nE[y]=!0;const g=y.endsWith(".css"),E=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${y}"]${E}`))return;const S=document.createElement("link");if(S.rel=g?"stylesheet":fU,g||(S.as="script"),S.crossOrigin="",S.href=y,m&&S.setAttribute("nonce",m),document.head.appendChild(S),g)return new Promise((D,x)=>{S.addEventListener("load",D),S.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${y}`)))})}))}function s(d){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=d,window.dispatchEvent(m),!m.defaultPrevented)throw d}return o.then(d=>{for(const m of d||[])m.status==="rejected"&&s(m.reason);return t().catch(s)})};var rE={key:""};const hU="mock";function yU(){try{typeof rE<"u"&&rE?.key;return}catch{return}}function gU(){const e=yU();if(!e||typeof window>"u"||!window.location)return!1;try{return new URLSearchParams(window.location.search).get(hU)===e}catch{return!1}}const bU=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 aE=!1;function vU(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 _U(e,t){try{if(t?.body&&typeof t.body=="string")return JSON.parse(t.body);if(e instanceof Request){const n=await e.clone().text();return n?JSON.parse(n):{}}}catch{return{}}return{}}function iE(e,t=200){return new Response(JSON.stringify(e),{status:t,headers:{"Content-Type":"application/json"}})}function EU(){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 SU(){if(aE||typeof window>"u"||typeof window.fetch!="function"||!gU())return;aE=!0;const e=window.fetch.bind(window),t=pU(()=>import("./backend-CY4n4nTm.js"),[]);window.fetch=async(n,i)=>{const o=vU(n);if(!o||!bU.has(o))return e(n,i);const s=await _U(n,i),{handleMockRequest:c}=await t;await new Promise(d=>window.setTimeout(d,120));try{return iE(c(o,s))}catch(d){return iE({error:d instanceof Error?d.message:"Mock handler error"},404)}},EU(),typeof console<"u"&&console.info("[Credify] Mock mode active — all API calls are served from in-memory fixtures.")}SU();bA.createRoot(document.getElementById("root")).render(v.jsx(b.StrictMode,{children:v.jsx(dU,{})}));
164
- //# sourceMappingURL=iframe-CK4NkRx1.js.map
163
+ `}),v.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:v.jsxs("div",{style:{width:"100%",maxWidth:560},children:[v.jsxs("div",{style:{textAlign:"center",marginBottom:40},children:[v.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8,background:s.accent+"12",border:`1px solid ${s.accent}30`,borderRadius:100,padding:"6px 16px",marginBottom:16},children:[v.jsx("span",{style:{fontSize:14},"aria-hidden":"true",children:s.icon}),v.jsx("span",{style:{fontSize:12,fontWeight:700,color:s.accent,letterSpacing:"0.1em",textTransform:"uppercase"},children:s.label})]}),v.jsx("h1",{style:{fontSize:26,fontWeight:700,color:"#0F172A",margin:0,letterSpacing:"-0.02em",lineHeight:1.3},children:fe?"Connecting to top carriers":"Fetching your best rates"}),v.jsx("p",{style:{fontSize:14,color:"#64748B",marginTop:8,marginBottom:0},children:fe?"Identifying the carriers eligible for your quote...":pe?"Still gathering — a few carriers are taking a little longer...":"We're reaching out to multiple insurers on your behalf"})]}),v.jsx("div",{style:{display:"flex",justifyContent:"center",marginBottom:32},children:fe?v.jsx("div",{style:{display:"flex",gap:20},children:[0,1,2,3,4].map(J=>v.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:6},children:[v.jsx("div",{style:{width:48,height:48,borderRadius:14,background:"#E2E8F0",animation:"skeletonPulse 1.4s ease-in-out infinite",animationDelay:`${J*.12}s`}}),v.jsx("div",{style:{width:40,height:8,borderRadius:4,background:"#E2E8F0",animation:"skeletonPulse 1.4s ease-in-out infinite",animationDelay:`${J*.12}s`}})]},`skeleton-${J}`))}):ne?v.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8},children:[v.jsxs("div",{style:{width:64,height:64,borderRadius:18,background:ne.color+"18",border:`2px solid ${ne.color}`,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:700,fontSize:16,color:ne.color,position:"relative",animation:"providerPulse 1.8s ease-in-out infinite"},children:[ne.abbr,v.jsx("div",{style:{position:"absolute",inset:-5,borderRadius:22,border:`2px solid ${ne.color}`,pointerEvents:"none",animation:"ringPulse 1.6s ease-in-out infinite"},"aria-hidden":"true"})]}),v.jsx("span",{style:{fontSize:13,fontWeight:600,color:ne.color,letterSpacing:"0.04em"},children:ne.name})]}):null}),v.jsxs("div",{className:`iq-card-fade ${w?"iq-card-visible":"iq-card-hidden"}`,style:{background:"#FFFFFF",borderRadius:24,border:"1px solid #E2E8F0",padding:32},children:[v.jsx("div",{style:{display:"flex",alignItems:"center",gap:20,marginBottom:28},children:fe||!ne?v.jsxs("div",{style:{flex:1,textAlign:"center",padding:"8px 0"},children:[v.jsx("p",{style:{fontSize:11,fontWeight:700,color:"#94A3B8",letterSpacing:"0.1em",textTransform:"uppercase",margin:"0 0 6px"},children:"Please wait"}),v.jsx("h2",{style:{fontSize:18,fontWeight:700,color:"#0F172A",margin:"0 0 6px",letterSpacing:"-0.02em"},children:"Checking eligible providers"}),v.jsx("p",{style:{fontSize:13,color:"#64748B",margin:0},children:"Reviewing your details against our carrier network"})]}):v.jsxs(v.Fragment,{children:[v.jsxs("div",{style:{position:"relative",flexShrink:0},children:[v.jsx(Cz,{progress:E,color:ne.color,size:80}),v.jsx("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center"},children:v.jsxs("span",{style:{fontSize:14,fontWeight:700,color:ne.color},"aria-hidden":"true",children:[Math.round(E),"%"]})})]}),v.jsxs("div",{style:{flex:1},children:[v.jsx("p",{style:{fontSize:11,fontWeight:700,color:"#94A3B8",letterSpacing:"0.1em",textTransform:"uppercase",margin:"0 0 4px"},children:pe?"Still checking":"Now checking"}),v.jsx("h2",{style:{fontSize:20,fontWeight:700,color:"#0F172A",margin:"0 0 6px",letterSpacing:"-0.02em"},children:ne.name}),v.jsx("p",{className:"iq-status-text",style:{fontSize:13,color:"#64748B",margin:0},role:"status","aria-live":"polite",children:fh[D]},`${m}-${D}`)]})]})}),v.jsxs("div",{children:[v.jsx("p",{style:{fontSize:11,fontWeight:700,color:"#94A3B8",letterSpacing:"0.08em",textTransform:"uppercase",margin:"0 0 8px"},children:fe?"Initializing":"Gathering quotes"}),v.jsx("div",{style:{height:6,background:"#F1F5F9",borderRadius:100,overflow:"hidden"},children:v.jsx("div",{style:{height:"100%",width:"35%",background:s.accent,borderRadius:100,animation:"shimmerSlide 1.4s ease-in-out infinite"},"aria-hidden":"true"})})]})]})]})})]})}function q5({onGoBack:e}){return v.jsxs("section",{className:"mt-4",role:"alert","aria-labelledby":"submission-error-title",children:[v.jsxs("div",{className:"rounded-xl border border-red-200 bg-red-50 p-5",children:[v.jsx("h3",{id:"submission-error-title",className:"text-base font-semibold text-red-700",children:"Sorry, quote submission failed"}),v.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."})]}),v.jsx("div",{className:"mt-5",children:v.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 mh={intercomAppId:"",cobrowseLicense:""};function wz(){try{return typeof mh<"u"&&mh?mh:{}}catch{return{}}}function Tz(e){const t=wz(),n=t.intercomAppId,i=t.cobrowseLicense;return{enabled:!!(n||i),intercomAppId:n||void 0,cobrowseLicense:i||void 0,proactiveOnError:!0}}const ph=new Map;function K5(e){if(typeof document>"u")return Promise.reject(new Error("loadScript called without a document"));const t=ph.get(e);if(t)return t;const n=new Promise((i,o)=>{const s=document.createElement("script");s.src=e,s.async=!0,s.onload=()=>i(),s.onerror=()=>{ph.delete(e),o(new Error(`Failed to load script: ${e}`))},document.head.appendChild(s)});return ph.set(e,n),n}let _0=!1;function Nz(){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 Mz(e){const t={app_id:e,hide_default_launcher:!0},n=rf();return n&&(t.quote_id=n),t}function W5(e){if(typeof window>"u")return;Nz();const t=Mz(e);if(window.intercomSettings=t,_0){window.Intercom("update",t);return}window.Intercom("boot",t),_0=!0,K5(`https://widget.intercom.io/widget/${e}`).catch(()=>{})}function Rz(){typeof window?.Intercom=="function"&&window.Intercom("show")}function Oz(e){typeof window?.Intercom=="function"&&window.Intercom("showNewMessage",e)}function kz(e){typeof window?.Intercom=="function"&&window.Intercom("update",e)}function Bz(){if(typeof window?.Intercom=="function")try{window.Intercom("shutdown")}catch{}_0=!1}const Lz="https://js.cobrowse.io/CobrowseIO.js";let E0=!1;async function Pz(e){await K5(Lz);const t=window.CobrowseIO;if(!t)return null;if(!E0){t.license=e,t.redactedViews=["input","select","textarea","[data-credify-redact]"],t.customData={quote_id:rf()??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?.(),E0=!0}return t}async function Iz(e){if(typeof window>"u")return null;try{const t=await Pz(e);return t?.createSessionCode?await t.createSessionCode():null}catch{return null}}function Fz(){try{window.CobrowseIO?.stop?.()}catch{}E0=!1}const jz="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 sr=null,Xc=null,S0=!1;function zz(e){Gz();const t=Tz();if(sr=t,!!t.enabled&&t.proactiveOnError&&t.intercomAppId){const n=i=>{S0||(S0=!0,W5(t.intercomAppId),kz({last_quote_error:i?.reason??"unknown"}),Oz(jz))};P5("submissionFailed",n),Xc=n}}function Q5(){!sr?.enabled||!sr.intercomAppId||(W5(sr.intercomAppId),Rz())}function Uz(){return!sr?.enabled||!sr.cobrowseLicense?Promise.resolve(null):Iz(sr.cobrowseLicense)}function Hz(){return!!(sr?.enabled&&sr.intercomAppId)}function Vz(){return!!(sr?.enabled&&sr.cobrowseLicense)}function Gz(){Xc&&(I5("submissionFailed",Xc),Xc=null),Bz(),Fz(),S0=!1,sr=null}const Zz="Chat with our support team in real time — we'll help you finish your quote.",Yz="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.",q3="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",K3="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 qz(){const e=Hz(),t=Vz(),[n,i]=b.useState(null),[o,s]=b.useState(!1),[c,d]=b.useState(!1),[m,h]=b.useState(null),y=b.useCallback(async()=>{s(!0),d(!1);try{const g=await Uz();g?i(g):d(!0)}finally{s(!1)}},[]);return!e&&!t?null:v.jsxs("div",{className:"flex flex-col items-center gap-1.5 text-sm text-slate-500",children:[v.jsx("span",{className:"font-medium",children:"Need help?"}),v.jsxs("div",{className:"inline-flex items-center gap-1",children:[e&&v.jsxs("span",{className:"relative inline-flex",onMouseEnter:()=>h("chat"),onMouseLeave:()=>h(null),children:[v.jsx("button",{type:"button",onClick:Q5,onFocus:()=>h("chat"),onBlur:()=>h(null),onKeyDown:g=>{g.key==="Escape"&&(g.stopPropagation(),h(null))},"aria-label":"Chat with support","aria-describedby":"credify-chat-tooltip",className:q3,children:v.jsx("svg",{className:"h-5 w-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:v.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"})})}),v.jsx("span",{id:"credify-chat-tooltip",role:"tooltip",className:`${K3} ${m==="chat"?"opacity-100":"opacity-0"}`,children:Zz})]}),e&&t&&v.jsx("span",{className:"mx-1 h-6 w-px bg-slate-200","aria-hidden":"true"}),t&&v.jsxs("span",{className:"relative inline-flex",onMouseEnter:()=>h("screen"),onMouseLeave:()=>h(null),children:[v.jsx("button",{type:"button",onClick:y,disabled:o,onFocus:()=>h("screen"),onBlur:()=>h(null),onKeyDown:g=>{g.key==="Escape"&&(g.stopPropagation(),h(null))},"aria-label":"Share your screen with an agent","aria-describedby":"credify-cobrowse-tooltip",className:q3,children:o?v.jsx("span",{className:"h-4 w-4 animate-spin rounded-full border-2 border-slate-300 border-t-slate-600","aria-hidden":"true"}):v.jsxs("svg",{className:"h-5 w-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[v.jsx("rect",{x:"2.5",y:"4",width:"19",height:"13",rx:"2"}),v.jsx("path",{d:"M8 21h8M12 17v4",strokeLinecap:"round"}),v.jsx("path",{d:"M12 13V8m0 0-2 2m2-2 2 2",strokeLinecap:"round",strokeLinejoin:"round"})]})}),v.jsx("span",{id:"credify-cobrowse-tooltip",role:"tooltip",className:`${K3} ${m==="screen"?"opacity-100":"opacity-0"}`,children:Yz})]})]}),n&&v.jsxs("span",{children:["Read this code to your agent: ",v.jsx("strong",{className:"tracking-widest text-text-primary",children:n})]}),c&&v.jsx("span",{className:"text-red-600",children:"Couldn't start screen sharing. Please try chat instead."})]})}let W3=null;function Kz(){const e=W3;return W3=null,e}let Wz=!1;function Qz(){return Wz}function He(e){if(e===!0)return"Yes";if(e===!1)return"No"}function $n(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 Jz(e){const t=e,n={};t.phone&&(n.phone=t.phone),t.first_name&&(n.first_name=t.first_name),t.last_name&&(n.last_name=t.last_name),t.email&&(n.email=t.email),t.date_of_birth&&(n.date_of_birth=$n(t.date_of_birth)),t.product&&(n.product=t.product),t.state&&(n.state=t.state),t.postal_code&&(n.postal_code=t.postal_code);const i=[];t.line_1&&i.push(t.line_1),t.line_2&&i.push(t.line_2),t.city&&i.push(t.city),t.state&&i.push(t.state),t.postal_code&&i.push(t.postal_code),i.length>0&&(n.address=i.join(", ")),typeof t.ssn_display=="string"&&(n.ssn_display=t.ssn_display),t.years_at_address!==null&&t.years_at_address!==void 0&&(n.years_at_address=t.years_at_address),t.months_at_address!==null&&t.months_at_address!==void 0&&(n.months_at_address=t.months_at_address),t.move_in_date&&(n.move_in_date=$n(t.move_in_date));const o=[];t.prior_line_1&&o.push(t.prior_line_1),t.prior_line_2&&o.push(t.prior_line_2),t.prior_city&&o.push(t.prior_city),t.prior_state&&o.push(t.prior_state),t.prior_postal_code&&o.push(t.prior_postal_code),o.length>0&&(n.prior_address=o.join(", ")),t.years_at_prior_address!==null&&t.years_at_prior_address!==void 0&&(n.years_at_prior_address=t.years_at_prior_address),t.is_mailing_address_different!==null&&t.is_mailing_address_different!==void 0&&(n.is_mailing_address_different=He(t.is_mailing_address_different)),t.mailing_address&&(n.mailing_address=t.mailing_address),t.effective_date&&(n.effective_date=$n(t.effective_date)),t.auto_has_prior_insurance!==null&&t.auto_has_prior_insurance!==void 0&&(n.auto_has_prior_insurance=He(t.auto_has_prior_insurance)),t.auto_prior_expiration_date&&(n.auto_prior_expiration_date=$n(t.auto_prior_expiration_date)),t.auto_prior_carrier_name&&(n.auto_prior_carrier_name=t.auto_prior_carrier_name),t.auto_prior_liability_limit&&(n.auto_prior_liability_limit=t.auto_prior_liability_limit),t.auto_reason_for_no_insurance&&(n.auto_reason_for_no_insurance=t.auto_reason_for_no_insurance),t.auto_prior_years!==null&&t.auto_prior_years!==void 0&&(n.auto_prior_years=t.auto_prior_years),t.auto_prior_months!==null&&t.auto_prior_months!==void 0&&(n.auto_prior_months=t.auto_prior_months),t.auto_continuous_coverage_years!==null&&t.auto_continuous_coverage_years!==void 0&&(n.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&&(n.auto_cancelled_declined_refused_to_renew=He(t.auto_cancelled_declined_refused_to_renew)),t.auto_current_annual_premium_cents!==null&&t.auto_current_annual_premium_cents!==void 0&&(n.auto_current_annual_premium_cents=t.auto_current_annual_premium_cents),t.policy_bi&&(n.policy_bi=t.policy_bi),t.policy_um&&(n.policy_um=t.policy_um),t.policy_pd&&(n.policy_pd=t.policy_pd),t.policy_mp&&(n.policy_mp=t.policy_mp),t.policy_umpd&&(n.policy_umpd=t.policy_umpd),t.policy_pip&&(n.policy_pip=t.policy_pip),t.policy_auto_death_indemnity&&(n.policy_auto_death_indemnity=t.policy_auto_death_indemnity),t.driver_vehicle_assignments&&(n.driver_vehicle_assignments=t.driver_vehicle_assignments),t.home_has_prior_insurance!==null&&t.home_has_prior_insurance!==void 0&&(n.home_has_prior_insurance=He(t.home_has_prior_insurance)),t.home_prior_expiration_date&&(n.home_prior_expiration_date=$n(t.home_prior_expiration_date)),t.home_prior_carrier_name&&(n.home_prior_carrier_name=t.home_prior_carrier_name),t.home_prior_years!==null&&t.home_prior_years!==void 0&&(n.home_prior_years=t.home_prior_years),t.home_continuous_coverage_years!==null&&t.home_continuous_coverage_years!==void 0&&(n.home_continuous_coverage_years=t.home_continuous_coverage_years),t.property_insurance_cancelled!==null&&t.property_insurance_cancelled!==void 0&&(n.property_insurance_cancelled=He(t.property_insurance_cancelled)),t.lapse_in_coverage!==null&&t.lapse_in_coverage!==void 0&&(n.lapse_in_coverage=He(t.lapse_in_coverage)),t.year_built!==null&&t.year_built!==void 0&&(n.year_built=t.year_built),t.number_of_units!==null&&t.number_of_units!==void 0&&(n.number_of_units=t.number_of_units),t.number_of_stories!==null&&t.number_of_stories!==void 0&&(n.number_of_stories=t.number_of_stories),t.number_of_beds!==null&&t.number_of_beds!==void 0&&(n.number_of_beds=t.number_of_beds),t.number_of_full_baths!==null&&t.number_of_full_baths!==void 0&&(n.number_of_full_baths=t.number_of_full_baths),t.number_of_partial_baths!==null&&t.number_of_partial_baths!==void 0&&(n.number_of_partial_baths=t.number_of_partial_baths),t.under_construction!==null&&t.under_construction!==void 0&&(n.under_construction=He(t.under_construction)),t.distance_from_fire_hydrant_ft&&(n.distance_from_fire_hydrant_ft=t.distance_from_fire_hydrant_ft),t.distance_from_fire_station_miles&&(n.distance_from_fire_station_miles=t.distance_from_fire_station_miles),t.architectural_style&&(n.architectural_style=t.architectural_style),t.dwelling_type&&(n.dwelling_type=t.dwelling_type),t.construction_quality&&(n.construction_quality=t.construction_quality),t.located_over_water!==null&&t.located_over_water!==void 0&&(n.located_over_water=t.located_over_water),t.construction_type&&(n.construction_type=t.construction_type),t.exterior_wall_type&&(n.exterior_wall_type=t.exterior_wall_type),t.foundation_type&&(n.foundation_type=t.foundation_type),t.roof_material_type&&(n.roof_material_type=t.roof_material_type),t.roof_shape&&(n.roof_shape=t.roof_shape),t.roof_updated_type&&(n.roof_updated_type=t.roof_updated_type),t.year_roof_updated!==null&&t.year_roof_updated!==void 0&&(n.year_roof_updated=t.year_roof_updated),t.mit_credit_form!==null&&t.mit_credit_form!==void 0&&(n.mit_credit_form=He(t.mit_credit_form)),t.storm_shutters!==null&&t.storm_shutters!==void 0&&(n.storm_shutters=He(t.storm_shutters)),t.heating_type&&(n.heating_type=t.heating_type),t.oil_tank_location&&(n.oil_tank_location=t.oil_tank_location),t.heating_fuel_type&&(n.heating_fuel_type=t.heating_fuel_type),t.number_of_fireplaces!==null&&t.number_of_fireplaces!==void 0&&(n.number_of_fireplaces=t.number_of_fireplaces),t.basement_type&&(n.basement_type=t.basement_type),t.parking_type&&(n.parking_type=t.parking_type),t.garage_type&&(n.garage_type=t.garage_type),t.number_of_parking_spaces!==null&&t.number_of_parking_spaces!==void 0&&(n.number_of_parking_spaces=t.number_of_parking_spaces),t.plumbing_type&&(n.plumbing_type=t.plumbing_type),t.pool_type&&(n.pool_type=t.pool_type),t.total_area_sq_ft!==null&&t.total_area_sq_ft!==void 0&&(n.total_area_sq_ft=t.total_area_sq_ft),t.parcel_area_sq_ft!==null&&t.parcel_area_sq_ft!==void 0&&(n.parcel_area_sq_ft=t.parcel_area_sq_ft),t.residence_type&&(n.residence_type=t.residence_type),t.usage_type&&(n.usage_type=t.usage_type),t.household_size!==null&&t.household_size!==void 0&&(n.household_size=t.household_size),t.number_of_mortgagees!==null&&t.number_of_mortgagees!==void 0&&(n.number_of_mortgagees=t.number_of_mortgagees),t.has_dog!==null&&t.has_dog!==void 0&&(n.has_dog=He(t.has_dog)),t.dog_breed_type&&(n.dog_breed_type=t.dog_breed_type),t.number_of_dogs!==null&&t.number_of_dogs!==void 0&&(n.number_of_dogs=t.number_of_dogs),t.has_vicious_animals!==null&&t.has_vicious_animals!==void 0&&(n.has_vicious_animals=He(t.has_vicious_animals)),t.has_business_on_premises!==null&&t.has_business_on_premises!==void 0&&(n.has_business_on_premises=He(t.has_business_on_premises)),t.business_class&&(n.business_class=t.business_class),t.occupancy_type&&(n.occupancy_type=t.occupancy_type),t.short_term_rental!==null&&t.short_term_rental!==void 0&&(n.short_term_rental=He(t.short_term_rental)),t.sale_price_cents!==null&&t.sale_price_cents!==void 0&&(n.sale_price_cents=Math.round(Number(t.sale_price_cents)/100)),t.number_of_families!==null&&t.number_of_families!==void 0&&(n.number_of_families=t.number_of_families),t.number_of_units_in_firewall!==null&&t.number_of_units_in_firewall!==void 0&&(n.number_of_units_in_firewall=t.number_of_units_in_firewall),t.heating_update_yn!==null&&t.heating_update_yn!==void 0&&(n.heating_update_yn=He(t.heating_update_yn)),t.heating_update_type&&(n.heating_update_type=t.heating_update_type),t.heating_update_year!==null&&t.heating_update_year!==void 0&&(n.heating_update_year=t.heating_update_year),t.plumbing_update_yn!==null&&t.plumbing_update_yn!==void 0&&(n.plumbing_update_yn=He(t.plumbing_update_yn)),t.plumbing_update_type&&(n.plumbing_update_type=t.plumbing_update_type),t.plumbing_update_year!==null&&t.plumbing_update_year!==void 0&&(n.plumbing_update_year=t.plumbing_update_year),t.electrical_update_yn!==null&&t.electrical_update_yn!==void 0&&(n.electrical_update_yn=He(t.electrical_update_yn)),t.electrical_update_type&&(n.electrical_update_type=t.electrical_update_type),t.electrical_update_year!==null&&t.electrical_update_year!==void 0&&(n.electrical_update_year=t.electrical_update_year),t.electric_circuit_breaker!==null&&t.electric_circuit_breaker!==void 0&&(n.electric_circuit_breaker=He(t.electric_circuit_breaker)),t.dwelling_replacement_cost!==null&&t.dwelling_replacement_cost!==void 0&&(n.dwelling_replacement_cost=t.dwelling_replacement_cost),t.other_structures_coverage!==null&&t.other_structures_coverage!==void 0&&(n.other_structures_coverage=t.other_structures_coverage),t.personal_property_coverage!==null&&t.personal_property_coverage!==void 0&&(n.personal_property_coverage=t.personal_property_coverage),t.loss_of_use_coverage!==null&&t.loss_of_use_coverage!==void 0&&(n.loss_of_use_coverage=t.loss_of_use_coverage),t.personal_liability&&(n.personal_liability=t.personal_liability),t.dwelling_medical_payments&&(n.dwelling_medical_payments=t.dwelling_medical_payments),t.all_perils_deductible&&(n.all_perils_deductible=t.all_perils_deductible),t.windstorm_deductible&&(n.windstorm_deductible=t.windstorm_deductible),t.has_garage!==null&&t.has_garage!==void 0&&(n.has_garage=He(t.has_garage)),t.has_pool!==null&&t.has_pool!==void 0&&(n.has_pool=He(t.has_pool)),t.has_trampoline!==null&&t.has_trampoline!==void 0&&(n.has_trampoline=He(t.has_trampoline)),t.gender&&(n.gender=t.gender),t.marital_status&&(n.marital_status=t.marital_status),t.employment_industry&&(n.employment_industry=t.employment_industry),t.occupation&&(n.occupation=t.occupation),t.has_co_applicant!==null&&t.has_co_applicant!==void 0&&(n.has_co_applicant=He(t.has_co_applicant)),t.co_applicant_first_name&&(n.co_applicant_first_name=t.co_applicant_first_name),t.co_applicant_middle_name&&(n.co_applicant_middle_name=t.co_applicant_middle_name),t.co_applicant_last_name&&(n.co_applicant_last_name=t.co_applicant_last_name),t.co_applicant_gender&&(n.co_applicant_gender=t.co_applicant_gender),t.co_applicant_marital_status&&(n.co_applicant_marital_status=t.co_applicant_marital_status),t.co_applicant_relationship&&(n.co_applicant_relationship=t.co_applicant_relationship),t.co_applicant_date_of_birth&&(n.co_applicant_date_of_birth=$n(t.co_applicant_date_of_birth)),t.co_applicant_employment_industry&&(n.co_applicant_employment_industry=t.co_applicant_employment_industry),t.co_applicant_occupation&&(n.co_applicant_occupation=t.co_applicant_occupation),t.retiree_discount!==null&&t.retiree_discount!==void 0&&(n.retiree_discount=He(t.retiree_discount)),t.gated_community_discount!==null&&t.gated_community_discount!==void 0&&(n.gated_community_discount=He(t.gated_community_discount)),t.multi_policy_discount!==null&&t.multi_policy_discount!==void 0&&(n.multi_policy_discount=He(t.multi_policy_discount)),t.non_smoker_discount!==null&&t.non_smoker_discount!==void 0&&(n.non_smoker_discount=He(t.non_smoker_discount)),t.first_time_buyer_discount!==null&&t.first_time_buyer_discount!==void 0&&(n.first_time_buyer_discount=He(t.first_time_buyer_discount)),t.fire_detection_system!==null&&t.fire_detection_system!==void 0&&(n.fire_detection_system=He(t.fire_detection_system)),t.fire_detection_system_type&&(n.fire_detection_system_type=t.fire_detection_system_type),t.burglar_alarm_system!==null&&t.burglar_alarm_system!==void 0&&(n.burglar_alarm_system=He(t.burglar_alarm_system)),t.burglar_alarm_system_type&&(n.burglar_alarm_system_type=t.burglar_alarm_system_type),t.smoke_detectors!==null&&t.smoke_detectors!==void 0&&(n.smoke_detectors=He(t.smoke_detectors)),t.sprinkler_system!==null&&t.sprinkler_system!==void 0&&(n.sprinkler_system=He(t.sprinkler_system)),t.sprinkler_system_type&&(n.sprinkler_system_type=t.sprinkler_system_type),t.gas_leakage_detector!==null&&t.gas_leakage_detector!==void 0&&(n.gas_leakage_detector=He(t.gas_leakage_detector)),t.deadbolt_locks!==null&&t.deadbolt_locks!==void 0&&(n.deadbolt_locks=He(t.deadbolt_locks)),t.fire_extinguisher!==null&&t.fire_extinguisher!==void 0&&(n.fire_extinguisher=He(t.fire_extinguisher)),t.order_credit_authorized!==null&&t.order_credit_authorized!==void 0&&(n.order_credit_authorized=He(t.order_credit_authorized)),t.has_health_insurance_auto_accident!==null&&t.has_health_insurance_auto_accident!==void 0&&(n.has_health_insurance_auto_accident=He(t.has_health_insurance_auto_accident)),t.is_corporation!==null&&t.is_corporation!==void 0&&(n.is_corporation=He(t.is_corporation)),t.named_insured_foreclosure_repo_bankruptcy!==null&&t.named_insured_foreclosure_repo_bankruptcy!==void 0&&(n.named_insured_foreclosure_repo_bankruptcy=He(t.named_insured_foreclosure_repo_bankruptcy)),t.named_insured_convicted_insurance_fraud!==null&&t.named_insured_convicted_insurance_fraud!==void 0&&(n.named_insured_convicted_insurance_fraud=He(t.named_insured_convicted_insurance_fraud));const s={};if(t.vehicles)for(const c of t.vehicles)c.quote_vehicle_id&&c.vin&&(s[c.quote_vehicle_id]=c.vin);return t.drivers&&t.drivers.length>0?(n.drivers="Yes",n.drivers__items=t.drivers.map(c=>{const d=c,m={};d.first_name&&(m.first_name=d.first_name),d.middle_name&&(m.middle_name=d.middle_name),d.last_name&&(m.last_name=d.last_name),d.date_of_birth&&(m.date_of_birth=$n(d.date_of_birth)),d.gender&&(m.gender=d.gender),d.marital_status&&(m.marital_status=d.marital_status),d.relationship_to_insured&&(m.relationship_to_insured=d.relationship_to_insured),d.is_registered_owner!==null&&d.is_registered_owner!==void 0&&(m.is_registered_owner=d.is_registered_owner?"Yes":"No"),d.license_state&&(m.license_state=d.license_state),d.license_status&&(m.license_status=d.license_status),d.license_number&&(m.license_number=d.license_number),d.date_first_licensed&&(m.date_first_licensed=$n(d.date_first_licensed)),d.education_level&&(m.education_level=S5(d.education_level)),d.occupation&&(m.occupation=D5(d.occupation)),d.industry&&(m.industry=Dd(d.industry)),d.employment_status&&(m.employment_status=d.employment_status),d.last_5_years_license_suspended_or_revoked!==null&&d.last_5_years_license_suspended_or_revoked!==void 0&&(m.last_5_years_license_suspended_or_revoked=He(d.last_5_years_license_suspended_or_revoked)),d.accident_prevention_course!==null&&d.accident_prevention_course!==void 0&&(m.accident_prevention_course=He(d.accident_prevention_course)),d.accident_prevention_course_date&&(m.accident_prevention_course_date=$n(d.accident_prevention_course_date)),d.sr22!==null&&d.sr22!==void 0&&(m.sr22=He(d.sr22));const h=d.ssn_display;typeof h=="string"&&(m.ssn_display=h);const y=d.driver_violations;y&&y.length>0&&(m.driver_violations="Yes",m.driver_violations__items=y.map(S=>{const D={};return S.code&&(D.code=S.code),S.occurred_at&&(D.occurred_at=$n(S.occurred_at)),D}));const g=d.driver_accidents;g&&g.length>0&&(m.driver_accidents="Yes",m.driver_accidents__items=g.map(S=>{const D={};return S.occurred_at&&(D.occurred_at=$n(S.occurred_at)),S.description&&(D.description=S.description),S.quote_vehicle_id&&(D.quote_vehicle_id=s[S.quote_vehicle_id]??S.quote_vehicle_id),S.property_damage_amount_paid_cents!==null&&S.property_damage_amount_paid_cents!==void 0&&(D.property_damage_amount_paid_cents=S.property_damage_amount_paid_cents),S.personal_injury_amount_paid_cents!==null&&S.personal_injury_amount_paid_cents!==void 0&&(D.personal_injury_amount_paid_cents=S.personal_injury_amount_paid_cents),D}));const E=d.losses;return E&&E.length>0&&(m.losses="Yes",m.losses__items=E.map(S=>{const D={};return S.description&&(D.description=S.description),S.date_of_incident&&(D.date_of_incident=$n(S.date_of_incident)),S.amount_paid_cents!==null&&S.amount_paid_cents!==void 0&&(D.amount_paid_cents=S.amount_paid_cents),S.quote_vehicle_id&&(D.quote_vehicle_id=s[S.quote_vehicle_id]??S.quote_vehicle_id),D})),m})):n.drivers="No",t.vehicles&&t.vehicles.length>0?(n.vehicles="Yes",n.vehicles__items=t.vehicles.map(c=>{const d=c,m={};d.vin&&(m.vin=d.vin),d.year!==null&&d.year!==void 0&&(m.year=String(d.year)),d.make&&(m.make=d.make),d.model&&(m.model=d.model),d.body_style&&(m.body_style=d.body_style),d.ownership_type&&(m.ownership_type=d.ownership_type),d.usage&&(m.usage=d.usage),d.annual_mileage!==null&&d.annual_mileage!==void 0&&(m.annual_mileage=d.annual_mileage),d.miles_to_work!==null&&d.miles_to_work!==void 0&&(m.miles_to_work=d.miles_to_work),d.percent_to_work!==null&&d.percent_to_work!==void 0&&(m.percent_to_work=d.percent_to_work);const h=[];return d.garaging_address_line_1&&h.push(d.garaging_address_line_1),d.garaging_address_line_2&&h.push(d.garaging_address_line_2),d.garaging_address_city&&h.push(d.garaging_address_city),d.garaging_address_state&&h.push(d.garaging_address_state),d.garaging_address_postal_code&&h.push(d.garaging_address_postal_code),h.length>0&&(m.garaging_address=h.join(", ")),d.new_when_purchased!==null&&d.new_when_purchased!==void 0&&(m.new_when_purchased=He(d.new_when_purchased)),d.purchase_date&&(m.purchase_date=$n(d.purchase_date)),d.anti_theft_type&&(m.anti_theft_type=d.anti_theft_type),d.passive_restraint_type&&(m.passive_restraint_type=d.passive_restraint_type),d.anti_lock_brakes!==null&&d.anti_lock_brakes!==void 0&&(m.anti_lock_brakes=He(d.anti_lock_brakes)),d.daytime_running_lights!==null&&d.daytime_running_lights!==void 0&&(m.daytime_running_lights=He(d.daytime_running_lights)),d.custom_equipment_value_cents!==null&&d.custom_equipment_value_cents!==void 0&&(m.custom_equipment_value_cents=d.custom_equipment_value_cents),d.cost_new_value_cents!==null&&d.cost_new_value_cents!==void 0&&(m.cost_new_value_cents=d.cost_new_value_cents),d.stated_value_amount_cents!==null&&d.stated_value_amount_cents!==void 0&&(m.stated_value_amount_cents=d.stated_value_amount_cents),d.vehicle_has_modifications!==null&&d.vehicle_has_modifications!==void 0&&(m.vehicle_has_modifications=He(d.vehicle_has_modifications)),d.vehicle_garaged_at_residence!==null&&d.vehicle_garaged_at_residence!==void 0&&(m.vehicle_garaged_at_residence=He(d.vehicle_garaged_at_residence)),d.vehicle_comp_deductible&&(m.vehicle_comp_deductible=d.vehicle_comp_deductible),d.vehicle_coll_deductible&&(m.vehicle_coll_deductible=d.vehicle_coll_deductible),d.vehicle_towing_and_labor&&(m.vehicle_towing_and_labor=d.vehicle_towing_and_labor),d.vehicle_transportation_expense&&(m.vehicle_transportation_expense=d.vehicle_transportation_expense),d.vehicle_full_glass!==null&&d.vehicle_full_glass!==void 0&&(m.vehicle_full_glass=He(d.vehicle_full_glass)),d.vehicle_loan_lease!==null&&d.vehicle_loan_lease!==void 0&&(m.vehicle_loan_lease=He(d.vehicle_loan_lease)),d.coverages&&d.coverages.length>0&&(m.coverages__items=d.coverages.map(y=>{const g={};return y.type&&(g.type=y.type),y.per_person_limit_cents!==null&&y.per_person_limit_cents!==void 0&&(g.per_person_limit_cents=y.per_person_limit_cents),y.per_incident_limit_cents!==null&&y.per_incident_limit_cents!==void 0&&(g.per_incident_limit_cents=y.per_incident_limit_cents),y.per_incident_limit_percent!==null&&y.per_incident_limit_percent!==void 0&&(g.per_incident_limit_percent=y.per_incident_limit_percent),y.per_day_limit_cents!==null&&y.per_day_limit_cents!==void 0&&(g.per_day_limit_cents=y.per_day_limit_cents),y.deductible_cents!==null&&y.deductible_cents!==void 0&&(g.deductible_cents=y.deductible_cents),y.is_declined!==null&&y.is_declined!==void 0&&(g.is_declined=He(y.is_declined)),g})),d.vehicle_lienholders&&d.vehicle_lienholders.length>0&&(m.vehicle_lienholders__items=d.vehicle_lienholders.map(y=>{const g={};return y.name&&(g.name=y.name),y.type&&(g.type=y.type),y.line_1&&(g.line_1=y.line_1),y.line_2&&(g.line_2=y.line_2),y.city&&(g.city=y.city),y.state&&(g.state=y.state),y.postal_code&&(g.postal_code=y.postal_code),y.phone&&(g.phone=y.phone),y.fax&&(g.fax=y.fax),g})),m})):n.vehicles="No",t.losses&&t.losses.length>0?(n.home_losses="Yes",n.home_losses__items=t.losses.map(c=>{const d={};return c.description&&(d.description=c.description),c.date_of_incident&&(d.date_of_incident=$n(c.date_of_incident)),c.amount_paid_cents!==null&&c.amount_paid_cents!==void 0&&(d.amount_paid_cents=Math.round(Number(c.amount_paid_cents)/100)),d})):n.home_losses="No",n}const Xz={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 eU(e){return Xz[e]||e}const Q3=new Set(["Zip","Product","Driver","Vehicle"]);function tU(e){return e?Array.isArray(e.drivers__items)?e.drivers__items.length:Array.isArray(e.drivers)?e.drivers.length:null:null}function J3(e,t){const n=tU(t),i=e.filter(s=>s.key!=="AutoPolicy"),o=i.length>0?i:e;return o}function nU(e,t){const n=e.findIndex(o=>o.key===t);return n<0?t:e[n+1]?.key??t}function J5(e){return e.some(t=>String(t.key)==="BundlePolicy"||String(t.key)==="BundleCustomer")}function X3(e){return J5(e)?"Bundle":e.some(t=>String(t.key)==="Vehicle"||String(t.key)==="Driver")?"Auto":"Home"}const rU={Auto:45e3,Home:5e4,Bundle:1e5},eE=["a[href]","button:not([disabled])","textarea:not([disabled])","input:not([disabled])","select:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");function aU(e,t){if(e!=="AutoCurrentCarrier")return t;const n=t.some(s=>String(s.key)==="auto_cancelled_declined_refused_to_renew"),i=t.some(s=>String(s.key)==="vehicle_policy_selections"),o=[...t];return n||o.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}),i||o.push({question:"Vehicle coverage selections",inputType:"custom",key:"vehicle_policy_selections",required:!1}),o}function iU(e,t){if(e!=="Vehicle")return t;const n=i=>i.map(o=>{const s=o.conditionals?.map(c=>{const d=c.conditionalQuestions??[];return d.length?{...c,conditionalQuestions:n(d)}:c});return String(o.key)!=="vin"?s?{...o,conditionals:s}:o:{...o,required:!1,...s?{conditionals:s}:{}}});return n(t)}function oU({isOpen:e,onClose:t}){const[n,i]=b.useState([]),[o,s]=b.useState(null),c=b.useRef(null);b.useEffect(()=>{c.current=o},[o]);const[d,m]=b.useState(null),[h,y]=b.useState(!1),[g,E]=b.useState(!1),[S,D]=b.useState(!1),[x,w]=b.useState(!1),[R,I]=b.useState([]),A=b.useRef(null),[L,M]=b.useState(null),[Z,V]=b.useState(void 0),[fe,ne]=b.useState(!1),[pe,J]=b.useState(null),[ye,Ae]=b.useState(null),[j,de]=b.useState(!1),[k,B]=b.useState(!1),[X,F]=b.useState(!1),G=b.useRef(!1),C=b.useRef(null),U=b.useRef(null),W=b.useRef(null),Y=b.useRef(null),[te,z]=b.useState(!1);b.useEffect(()=>{if(!S||x)return;const se=X3(n);let _e=!1;const be=[];let xe=0,$e=0;const Me=66,re=3,oe=5e3;let Ce=!1;const Ee=async()=>{if(_e)return;xe++;try{const{quote:Re}=await S3(o??void 0);if(_e)return;if($e=0,!Ce){const qe=Re?.appetites??null,Ue=iz(qe,se);Ue.length>0&&(I(Ue),Ce=!0)}const ke=Re?.rates_status??null;if(ke==="completed"){const{rates:qe}=await lh(o??void 0);if(_e)return;A.current=qe,w(!0);return}if(ke==="no_rates"){A.current=[],w(!0);return}if(ke==="failed"){Uo(new Error("Quote failed: rate-generation worker reported rates_status=failed"),{quoteId:c.current??void 0,phase:"rates_status_failed"}),ps({reason:"submission"}),J({message:"submission_failed"}),D(!1);return}}catch(Re){if($e++,console.warn("Provider polling: getQuote failed",{attempt:xe,consecutiveFailures:$e,error:Re}),$e>=re){Re?.__sentryReported||Uo(Re,{quoteId:c.current??void 0,phase:"rates_polling",message:`Quote failed: ${re} consecutive get-quote poll failures`}),ps({reason:"network"}),J({message:"submission_failed"}),D(!1);return}}if(_e)return;if(xe>=Me){Uo(new Error(`Quote failed: rate-generation timed out after ${Me} polls`),{quoteId:c.current??void 0,phase:"rates_polling_timeout"}),ps({reason:"timeout"}),J({message:"submission_failed"}),D(!1);return}const Te=window.setTimeout(Ee,oe);be.push(Te)};return Ee(),()=>{_e=!0,be.forEach(Te=>window.clearTimeout(Te))}},[S,x,n,o]);function T(se){return se.map(be=>({key:be,title:eU(be),loadQuestions:async()=>{const xe=await XF(be,c.current??void 0);let $e=aU(be,xe.questions);return $e=iU(be,$e),$e}}))}b.useEffect(()=>{const se=async()=>{try{const _e=Kz();if(_e)try{const{token:xe,quoteId:$e}=await tj(_e);xe&&$e&&(Wc(xe),f3($e))}catch(xe){xe.statusCode===401&&B(!0)}const be=rf();if(Qc(),be){ne(!0),s(be);try{const xe=Jr(),$e=await S3(xe?void 0:be);if(!$e||!$e.quote)throw new Error("Invalid response from getQuote: missing quote data");const{quote:Me}=$e,{stages:re}=await Bc(be),oe=T(re);i(oe);let Ce;try{Ce=Jz(Me),M(Ce)}catch(Ue){throw new Error(`Failed to transform quote data: ${Ue instanceof Error?Ue.message:"Unknown error"}`)}const Ee=J3(oe,Ce);i(Ee);const Te=Me?.review_status??null;if(E(Te!=null),Te==="pending_review"&&Jr()){F(!0);return}const Re=Me?.rates_status??null,ke=Jr()!=null;if(ke||Te===null){if(Re==="completed")try{const{rates:Ue}=await lh(ke?void 0:be);m(Ue);return}catch(Ue){console.warn("Failed to fetch completed rates on resume",Ue)}else if(Re==="no_rates"){m([]);return}else if(Re==="processing"){I([]),w(!1),A.current=null,D(!0);return}}V(0)}catch(xe){const $e=xe;if($e.statusCode===404)$5(),s(null);else if($e.statusCode===401){T5();try{const{stages:Me}=await Bc(be),re=T(Me);i(re);const oe=re.findIndex(Ce=>Ce.key==="SMSVerification");V(oe>=0?oe:re.length-1)}catch{}}}finally{ne(!1)}}else{const{stages:xe}=await Bc();i(T(xe))}}catch{ne(!1)}};e&&!G.current&&(G.current=!0,se())},[e]),b.useEffect(()=>{if(!e)return;const{overflow:se}=document.body.style;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=se}},[e]),b.useEffect(()=>{if(!e)return;Y.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const se=window.setTimeout(()=>{const _e=C.current;if(!_e)return;(_e.querySelector(eE)??_e).focus()},0);return()=>{window.clearTimeout(se);const _e=Y.current;Y.current=null,_e&&document.contains(_e)&&_e.focus()}},[e]);const N=b.useCallback(se=>{if(se.key==="Escape"){te?(se.preventDefault(),z(!1)):(se.preventDefault(),z(!0));return}if(se.key!=="Tab")return;const _e=te?U.current:C.current;if(!_e)return;const be=Array.from(_e.querySelectorAll(eE)).filter(re=>!re.hasAttribute("disabled")&&re.getAttribute("aria-hidden")!=="true");if(be.length===0){se.preventDefault(),_e.focus();return}const xe=be[0],$e=be[be.length-1],Me=document.activeElement;se.shiftKey&&Me===xe?(se.preventDefault(),$e.focus()):!se.shiftKey&&Me===$e&&(se.preventDefault(),xe.focus())},[te]);b.useEffect(()=>{if(e)return window.addEventListener("keydown",N),()=>window.removeEventListener("keydown",N)},[e,N]),b.useEffect(()=>{if(!te)return;const se=window.setTimeout(()=>{W.current?.focus()},0);return()=>window.clearTimeout(se)},[te]),b.useEffect(()=>{e||(M(null),V(void 0),ne(!1),D(!1),Ae(null),de(!1),z(!1))},[e]),b.useEffect(()=>{e&&Uj()},[e]),b.useEffect(()=>{d&&Array.isArray(d)&&Zj({rateCount:d.length})},[d]);const ie=b.useCallback(()=>{J(null),V(Math.max(0,n.length-1))},[n.length]),ge=b.useCallback(async(se,_e)=>{try{I([]),w(!1),A.current=null,D(!0);let be;try{be=await La(se,!0,o??void 0)}catch(Me){throw D(!1),Me}if(be.status==="submission_failed"){Uo(new Error(`Quote failed at submission: ${be.message}`),{quoteId:o??void 0,phase:_e}),D(!1),w(!1),A.current=null,ps({reason:"submission"}),J({message:be.message});return}if(be.status==="success")try{const{rates:Me}=await lh(o??void 0);A.current=Me,w(!0)}catch(Me){throw D(!1),Me}const xe=n.length,$e=n[xe-1];L3({stageKey:$e?.key??"unknown",stageTitle:$e?.title??"unknown",stepIndex:xe,totalSteps:xe}),Gj()}catch(be){be?.__sentryReported||Uo(be,{quoteId:o??void 0,phase:_e}),D(!1),ps({reason:"submission"}),J({message:"Oops, something went wrong. Please try again later."})}},[o,n]),Se=b.useCallback(async se=>{if(!(!ye||!o||j)){de(!0);try{const be={...xi(ye.allValues),communications_consent:se};Ae(null),await ge(be,"consent_submit")}finally{de(!1)}}},[ye,o,j,ge]),he=b.useCallback(async se=>{if(!(!o||j)){de(!0);try{M(se);const _e={...xi(se),customer_review_confirmed:!0};await ge(_e,"review_submit")}finally{de(!1)}}},[o,j,ge]);if(!e)return null;const we=()=>{z(!0)},Ie=()=>{z(!1)},me=()=>{Hj(),t()},De=!!(!pe&&d&&o&&!h);return v.jsxs("div",{ref:C,className:"fixed inset-0 z-[9999] flex items-center justify-center",role:"dialog","aria-modal":"true","aria-labelledby":"insurance-modal-title",tabIndex:-1,children:[v.jsx("div",{className:"backdrop","aria-hidden":"true"}),v.jsxs("div",{className:`modal-panel bg-white relative w-full flex flex-col max-h-[90vh] overflow-hidden ${De?"max-w-6xl":"max-w-2xl"}`,role:"document",children:[v.jsx("h2",{id:"insurance-modal-title",className:"sr-only",children:"Credify insurance quote widget"}),v.jsx("button",{onClick:we,className:"modal-close-btn absolute top-4 right-4","aria-label":"Close quote form",type:"button",children:v.jsx("span",{"aria-hidden":"true",children:"×"})}),!S&&!pe&&v.jsx("div",{className:"widget-modal-header text-center",children:v.jsx("h2",{className:"h1-title",children:"Let's shop multiple leading carriers for you"})}),v.jsxs("div",{className:"panel-body flex-1 min-h-0 overflow-y-auto",children:[k&&v.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:[v.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."}),v.jsx("button",{type:"button",onClick:()=>B(!1),className:"shrink-0 font-bold text-amber-800 hover:text-amber-900","aria-label":"Dismiss",children:"×"})]}),pe&&v.jsx(q5,{onGoBack:ie}),!pe&&S&&(()=>{const se=X3(n);return v.jsx(Az,{providers:R,totalTime:rU[se],flow:se,isComplete:x,onComplete:()=>{D(!1),w(!1),I([]),A.current&&(m(A.current),A.current=null)}})})(),!pe&&!S&&ye&&v.jsx(kO,{onChoose:Se,isSubmitting:j}),!pe&&!d&&!S&&!ye&&v.jsx(v.Fragment,{children:fe||n.length===0?v.jsx("div",{className:"flex items-center justify-center py-12",children:v.jsx("div",{className:"text-slate-600",children:"Loading..."})}):X&&o?v.jsx(xz,{stages:n,initialValues:L??{},quoteId:o,isSubmitting:j,onConfirmed:he}):v.jsx(nz,{stages:n,initialValues:L??void 0,initialActive:Z,quoteId:o??void 0,nonTerminalStageKeys:Q3,onStageComplete:async(se,_e)=>{try{const be=xi(se);let xe=o,$e=n;const Me=$e.findIndex(Ce=>Ce.key===_e),re=$e[Me],oe=nU($e,_e);if(xe)if(_e==="Phone"){const Ce=be.phone;if(!Ce)throw new Error("Phone number is required.");const Ee=Jr();await La({...be,current_stage:oe},!1,Ee?void 0:xe),await N5(xe,Ce)}else if(_e==="SMSVerification"){const{isVerified:Ce,token:Ee}=await g0(xe,be.sms_code);if(!Ce)throw new Error("Invalid SMS code");Ee&&Wc(Ee),await La({current_stage:oe},!1)}else if(_e==="Product"){const Ce=Jr(),{isSupported:Ee}=await M5(be.state,Ce?void 0:xe??void 0);if(await La({...be,current_stage:Ee?oe:_e},!1,Ce?void 0:xe),!Ee){const Te=Y5(be.state);throw new Error(`Sorry, Credify Corporation doesn't currently offer insurance in ${Te}. We're expanding our coverage and hope to serve your state soon.`)}}else{const Ce=Jr();await La({...be,current_stage:oe},!1,Ce?void 0:xe||void 0)}else{const Ce=be.postal_code??"";if(!Ce)throw new Error("ZIP code is required to start a quote.");const Te=(await ej(Ce,Qz()))?.quoteId;if(!Te||typeof Te!="string"||Te.trim()==="")throw new Error(`Failed to create quote - invalid quoteId returned: ${Te}`);xe=Te,s(Te),f3(Te),await La({...be,current_stage:oe},!1,Te)}if(_e==="Name"&&xe){const Ce=String(se.product??"");(Ce==="Auto"||Ce==="Both")&&Nj(xe)}if(_e==="Vehicle"&&xe&&Oj(xe),Q3.has(_e))try{const{stages:Ce}=await Bc(xe||void 0);$e=T(Ce),$e=J3($e,se),i($e)}catch(Ce){console.warn("Unable to refresh stages after flow-shaping step",Ce)}return L3({stageKey:_e,stageTitle:re?.title??_e,stepIndex:Me+1,totalSteps:$e.length}),{success:!0,latestStages:$e}}catch(be){return{success:!1,error:be instanceof Error?be.message:"An error occurred"}}},onComplete:async(se,_e)=>{if(!o)return{success:!1,error:"Oops, something went wrong. Please try again later."};M(se);try{if(_e==="Phone"){const be=xi(se);if(!be.phone)return{success:!1,error:"Phone number is required."};const $e=Jr();return await La({...be,suppress_verification_sms:!0},!1,$e?void 0:o),Ae({allValues:se}),{success:!0}}if(_e==="SMSVerification"){const be=xi(se),{isVerified:xe,token:$e}=await g0(o,be.sms_code);return xe?($e&&Wc($e),Ae({allValues:se}),{success:!0}):{success:!1,error:"Invalid SMS code"}}return Ae({allValues:se}),{success:!0}}catch{const xe="Oops, something went wrong. Please try again later.";return J({message:xe}),{success:!1,error:xe}}}})})," ",!pe&&d&&o&&v.jsx(fz,{rates:d,onBack:()=>m(null),isBundleFlow:J5(n),quoteId:o,initialPhone:L?.phone??"",requirePursueVerification:g,onSubScreenChange:y})]}),v.jsxs("div",{className:"widget-legal-footer space-y-1.5",children:[v.jsx(qz,{}),v.jsx("p",{className:"text-center text-sm text-slate-500",children:"Insurance products offered through Credify Corporation, a licensed insurance agency."})]}),te&&v.jsx("div",{className:"close-confirm-backdrop",role:"presentation",children:v.jsxs("div",{ref:U,className:"close-confirm-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":"close-confirm-title","aria-describedby":"close-confirm-description",tabIndex:-1,children:[v.jsx("h3",{id:"close-confirm-title",children:"Close quote form?"}),v.jsx("p",{id:"close-confirm-description",children:"Your answers in this session will be lost if you close this window."}),v.jsxs("div",{className:"close-confirm-actions",children:[v.jsx("button",{ref:W,type:"button",className:"btn-outline",onClick:Ie,children:"Keep editing"}),v.jsx("button",{type:"button",className:"btn-primary close-confirm-danger",onClick:me,children:"Close form"})]})]})})]})]})}function lU({onClose:e}){return v.jsxs("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center",role:"dialog","aria-modal":"true",children:[v.jsx("div",{className:"backdrop","aria-hidden":"true"}),v.jsx("div",{className:"modal-panel bg-white relative w-full max-w-2xl p-6",children:v.jsx(q5,{onGoBack:e})})]})}var hh={dsn:"",environment:"production",release:"c17815f0e3c1103e5daecd58a5cd0ecf718a2daf"};function sU(){try{return typeof hh<"u"&&hh?hh:{}}catch{return{}}}let tE=!1;function uU(e,t){if(!e)return t;const n=Number(e);return Number.isFinite(n)&&n>=0&&n<=1?n:t}function cU(e={}){if(tE)return!0;if(typeof window>"u")return!1;const t=sU(),n=e.dsn??t.dsn;return!n||e.enabled===!1?!1:(HF({baseUrl:Rt}),I7({dsn:n,environment:e.environment??t.environment??"production",release:e.release??t.release,sendDefaultPii:!1,maxBreadcrumbs:50,tracesSampleRate:e.tracesSampleRate??uU(t.tracesSampleRate,.1),tracePropagationTargets:[Rt],replaysSessionSampleRate:0,replaysOnErrorSampleRate:1,beforeSend:i=>g3(i),beforeBreadcrumb:i=>i&&(g3({breadcrumbs:[i]}),i)}),tE=!0,L7("replayIntegration").then(i=>{try{hT(i({maskAllText:!0,maskAllInputs:!0,blockAllMedia:!0,networkDetailAllowUrls:[Rt],networkCaptureBodies:!1}))}catch{}}).catch(()=>{}),!0)}function dU(){const[e,t]=b.useState(!1);b.useEffect(()=>{cU(),zz()},[]);const n=b.useCallback(o=>{window.parent&&window.parent!==window&&window.parent.postMessage({type:o,source:"credify-insurance-widget"},"*")},[]);b.useEffect(()=>{const o=(c,d,m)=>{window.parent&&window.parent!==window&&window.parent.postMessage({type:"event",source:"credify-insurance-widget",event:c,data:d,meta:m},"*")},s=jj.map(c=>{const d=(m,h)=>o(c,m,h);return P5(c,d),[c,d]});return()=>{for(const[c,d]of s)I5(c,d)}},[]),b.useEffect(()=>{const o=s=>{if(s.data?.source==="credify-insurance-widget")switch(s.data.type){case"open":t(!0),n("opened");break;case"close":t(!1),n("closed");break;case"init":n("ready");break;case"support-open":Q5();break}};return window.addEventListener("message",o),n("ready"),()=>{window.removeEventListener("message",o)}},[n]);const i=b.useCallback(()=>{t(!1),n("closed")},[n]);return v.jsx(P0,{fallback:v.jsx(lU,{onClose:i}),children:v.jsx(oU,{isOpen:e,onClose:i})})}const fU="modulepreload",mU=function(e){return"/iframe/"+e},nE={},pU=function(t,n,i){let o=Promise.resolve();if(n&&n.length>0){let h=function(y){return Promise.all(y.map(g=>Promise.resolve(g).then(E=>({status:"fulfilled",value:E}),E=>({status:"rejected",reason:E}))))};var c=h;document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),m=d?.nonce||d?.getAttribute("nonce");o=h(n.map(y=>{if(y=mU(y),y in nE)return;nE[y]=!0;const g=y.endsWith(".css"),E=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${y}"]${E}`))return;const S=document.createElement("link");if(S.rel=g?"stylesheet":fU,g||(S.as="script"),S.crossOrigin="",S.href=y,m&&S.setAttribute("nonce",m),document.head.appendChild(S),g)return new Promise((D,x)=>{S.addEventListener("load",D),S.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${y}`)))})}))}function s(d){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=d,window.dispatchEvent(m),!m.defaultPrevented)throw d}return o.then(d=>{for(const m of d||[])m.status==="rejected"&&s(m.reason);return t().catch(s)})};var rE={key:""};const hU="mock";function yU(){try{typeof rE<"u"&&rE?.key;return}catch{return}}function gU(){const e=yU();if(!e||typeof window>"u"||!window.location)return!1;try{return new URLSearchParams(window.location.search).get(hU)===e}catch{return!1}}const bU=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 aE=!1;function vU(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 _U(e,t){try{if(t?.body&&typeof t.body=="string")return JSON.parse(t.body);if(e instanceof Request){const n=await e.clone().text();return n?JSON.parse(n):{}}}catch{return{}}return{}}function iE(e,t=200){return new Response(JSON.stringify(e),{status:t,headers:{"Content-Type":"application/json"}})}function EU(){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 SU(){if(aE||typeof window>"u"||typeof window.fetch!="function"||!gU())return;aE=!0;const e=window.fetch.bind(window),t=pU(()=>import("./backend-CY4n4nTm.js"),[]);window.fetch=async(n,i)=>{const o=vU(n);if(!o||!bU.has(o))return e(n,i);const s=await _U(n,i),{handleMockRequest:c}=await t;await new Promise(d=>window.setTimeout(d,120));try{return iE(c(o,s))}catch(d){return iE({error:d instanceof Error?d.message:"Mock handler error"},404)}},EU(),typeof console<"u"&&console.info("[Credify] Mock mode active — all API calls are served from in-memory fixtures.")}SU();bA.createRoot(document.getElementById("root")).render(v.jsx(b.StrictMode,{children:v.jsx(dU,{})}));
164
+ //# sourceMappingURL=iframe-CSrAr58U.js.map