@getcredify/credify-insurance-widget 1.43.0 → 1.44.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.
- package/README.md +4 -4
- package/dist/{address-BEVwov8q-Cgvd-ydq.js → address-BEVwov8q-DDhbGo15.js} +1 -1
- package/dist/{api-BGeBevot.js → api-CWMwIjKu.js} +1 -1
- package/dist/{car-BQXTRajZ.js → car-B83tx4O2.js} +1 -1
- package/dist/{check-04Hiu_0S.js → check-Bu17NqRV.js} +1 -1
- package/dist/{copy-applicant-offer-CqzfNhkJ-CXzGxES4.js → copy-applicant-offer-CqzfNhkJ-DLXjbOLT.js} +3 -3
- package/dist/{copy-from-record-BNP6CFFR-Ea4bf4lq.js → copy-from-record-BNP6CFFR-6SC1msxp.js} +4 -4
- package/dist/{core-CrEw_I-E-B6agkb7g.js → core-CrEw_I-E-CsRUhlZy.js} +1 -1
- package/dist/{coverageDerivation-CV2ORogj-B42UJhMa.js → coverageDerivation-CV2ORogj-De8x_Bpm.js} +1 -1
- package/dist/{fixtures-ijbZ16Zg-Bmt9N4zO.js → fixtures-ijbZ16Zg-9n-90hL2.js} +1 -1
- package/dist/{household-prefill-CmtB9R3R-DaQcDYh7.js → household-prefill-CmtB9R3R-Bw0M1Q50.js} +4 -4
- package/dist/{householdPrefill-DLm3pxFH-CqqJoa0N.js → householdPrefill-DLm3pxFH-BQibTi9l.js} +1 -1
- package/dist/iframe/assets/{address-BEVwov8q-Bqt4jr_e.js → address-BEVwov8q-BiiIpq2c.js} +1 -1
- package/dist/iframe/assets/{car-B0PQzDYj.js → car-cifgdWXX.js} +1 -1
- package/dist/iframe/assets/{check-bC0Zibyh.js → check-TbHiw7rw.js} +1 -1
- package/dist/iframe/assets/{copy-applicant-offer-CqzfNhkJ-D6mTQGjz.js → copy-applicant-offer-CqzfNhkJ-CVahKn8I.js} +1 -1
- package/dist/iframe/assets/{copy-from-record-BNP6CFFR-D3zdAXXN.js → copy-from-record-BNP6CFFR-Cn7Nr7XT.js} +1 -1
- package/dist/iframe/assets/{core-CrEw_I-E-ecektrnv.js → core-CrEw_I-E-DJNj5Zzo.js} +1 -1
- package/dist/iframe/assets/{coverageDerivation-CV2ORogj-CA4KQiLs.js → coverageDerivation-CV2ORogj-B7aNPljp.js} +1 -1
- package/dist/iframe/assets/{dob-calendar-RIJ5S6YU-1oIu3-0M.js → dob-calendar-RIJ5S6YU-CdxMGaLz.js} +1 -1
- package/dist/iframe/assets/{fixtures-ijbZ16Zg-Dif2LDkg.js → fixtures-ijbZ16Zg-NuD06-4v.js} +1 -1
- package/dist/iframe/assets/{household-prefill-CmtB9R3R-CrgN1qav.js → household-prefill-CmtB9R3R-0b9HYzDA.js} +1 -1
- package/dist/iframe/assets/{householdPrefill-DLm3pxFH-B3K_XX2k.js → householdPrefill-DLm3pxFH-DzyOYQr_.js} +1 -1
- package/dist/iframe/assets/{iframe-BsUmazO0.js → iframe-Be9NY0jq.js} +30 -30
- package/dist/iframe/assets/{index-BipROEB3.js → index-BknEWAR5.js} +1 -1
- package/dist/iframe/assets/{intake-review-panel-D27t8CZO-UOfbb2gR.js → intake-review-panel-D27t8CZO-QuAzDm1O.js} +1 -1
- package/dist/iframe/assets/{mockJump-hNzgzUmO-Dd1MY0fT.js → mockJump-hNzgzUmO-CQ7eZ354.js} +1 -1
- package/dist/iframe/assets/{payload-DrGFAxms-DeQGFkZt.js → payload-DrGFAxms-DIGXNw5l.js} +1 -1
- package/dist/iframe/assets/{question-list-DFjWa8ZA--GTrxgeK.js → question-list-DFjWa8ZA-DbabOwyP.js} +3 -3
- package/dist/iframe/assets/{rates-panel-BSFiWEZX-Bw7hcmIi.js → rates-panel-BSFiWEZX-GsRBXu7R.js} +3 -3
- package/dist/iframe/assets/{review-panel-C_WxX33U-BxLq8fbL.js → review-panel-C_WxX33U-CxzpQutt.js} +1 -1
- package/dist/iframe/assets/{stage-knShj71W-BctzWtx2.js → stage-knShj71W-CEkRTdvw.js} +1 -1
- package/dist/iframe/assets/{validation-D42QXxck-CI1J_zUB.js → validation-D42QXxck-DrIBn9be.js} +1 -1
- package/dist/iframe/assets/{vehicleCoverage-CBWORI1l-D_NVJvjm.js → vehicleCoverage-CBWORI1l-BqOK33e3.js} +1 -1
- package/dist/iframe/assets/{visibility-CKRGC3Il-CzwGG4Rt.js → visibility-CKRGC3Il-CLpoN3cd.js} +1 -1
- package/dist/iframe/iframe.html +1 -1
- package/dist/{index-C9szcdxC.js → index-CY0roJE_.js} +1 -1
- package/dist/index.es.js +1 -1
- package/dist/index.umd.js +55 -55
- package/dist/{intake-review-panel-D27t8CZO-BprNqAxn.js → intake-review-panel-D27t8CZO-CxiXytFS.js} +5 -5
- package/dist/{mockJump-hNzgzUmO-DdKPcdjz.js → mockJump-hNzgzUmO-CsTzthio.js} +1 -1
- package/dist/{payload-DrGFAxms-4aJBixaL.js → payload-DrGFAxms-DmfWvvu_.js} +2 -2
- package/dist/{question-list-DFjWa8ZA-DqUPEU4a.js → question-list-DFjWa8ZA-B8f7Jf6J.js} +13 -13
- package/dist/{rates-panel-BSFiWEZX-poz1p0rK.js → rates-panel-BSFiWEZX-DdETQZ83.js} +5 -5
- package/dist/{review-panel-C_WxX33U-DAqsW53a.js → review-panel-C_WxX33U-CZu6We48.js} +3 -3
- package/dist/{stage-knShj71W-DkbEgye4.js → stage-knShj71W-XIJ7bUoN.js} +4 -4
- package/dist/utils/branding.d.ts +1 -1
- package/dist/utils/placesAuthFailure.d.ts +10 -0
- package/dist/{validation-D42QXxck-6HA5X_Ql.js → validation-D42QXxck-BPUVtzkv.js} +1 -1
- package/dist/{vehicleCoverage-CBWORI1l-Cy7XD_03.js → vehicleCoverage-CBWORI1l-DZmjvVjU.js} +3 -3
- package/dist/{visibility-CKRGC3Il-v2xplFmb.js → visibility-CKRGC3Il-_72Koc98.js} +1 -1
- package/dist/{widget-wgT55Lu5.js → widget-CP6ApixH.js} +1523 -1504
- package/package.json +1 -1
package/dist/iframe/assets/{question-list-DFjWa8ZA--GTrxgeK.js → question-list-DFjWa8ZA-DbabOwyP.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dob-calendar-RIJ5S6YU-
|
|
2
|
-
import{l as E,r as g,L as he,a as n,M as Js,t as ea,S as ta,U as na,V as ra,d as Ke,p as F,f as V,W as un,X as sa,_ as aa,N as oa,Y as ia,Z as ca,$ as la,a0 as da}from"./iframe-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dob-calendar-RIJ5S6YU-CdxMGaLz.js","assets/iframe-Be9NY0jq.js","assets/iframe-Bl0qTZgO.css","assets/dob-calendar-RIJ5S6YU-D1-0B2xV.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{l as E,r as g,L as he,a as n,M as Js,t as ea,S as ta,U as na,V as ra,d as Ke,p as F,f as V,W as un,X as sa,_ as aa,N as oa,Y as ia,Z as ca,$ as la,a0 as da}from"./iframe-Be9NY0jq.js";import{o as ua,r as ha,s as fa,t as Ln,W as In,H as St,S as pa}from"./core-CrEw_I-E-DJNj5Zzo.js";import{n as Ie}from"./types-LUGvo5ic-CB-wcgK3.js";import{s as ma,a as va}from"./address-BEVwov8q-BiiIpq2c.js";import{U as ga,_ as ya,g as xa,s as ba}from"./householdPrefill-DLm3pxFH-DzyOYQr_.js";import{k as ka,n as wa,u as ja,c as _a,d as Ma,j as Ca,A as Sa}from"./visibility-CKRGC3Il-CLpoN3cd.js";import{C as Ea,f as Ir,T as Na}from"./validation-D42QXxck-DrIBn9be.js";import{i as Pa,a as Aa,t as Vr,u as $a,f as Ra,n as Oa,r as Ta,s as Fa,p as Da}from"./vehicleCoverage-CBWORI1l-BqOK33e3.js";import{d as La,l as Ia,u as Va,t as Ba}from"./stage-knShj71W-CEkRTdvw.js";import{s as Ha,u as Br,l as za,c as Wa,U as qa}from"./copy-from-record-BNP6CFFR-Cn7Nr7XT.js";import{s as Ua,c as Ka,d as Ya}from"./coverageDerivation-CV2ORogj-B7aNPljp.js";import{e as ze,P as ae,a as X,f as Ga,r as Hr,c as hn,d as fn,u as zr,b as Xa,C as Wr}from"./index-BknEWAR5.js";import{C as qr}from"./check-TbHiw7rw.js";import{C as Vn}from"./car-cifgdWXX.js";/**
|
|
3
3
|
* @license lucide-react v0.562.0 - ISC
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the ISC license.
|
|
@@ -314,4 +314,4 @@ import{l as E,r as g,L as he,a as n,M as Js,t as ea,S as ta,U as na,V as ra,d as
|
|
|
314
314
|
`)},or=function(){var e=parseInt(document.body.getAttribute(Ae)||"0",10);return isFinite(e)?e:0},nc=function(){g.useEffect(function(){return document.body.setAttribute(Ae,(or()+1).toString()),function(){var e=or()-1;e<=0?document.body.removeAttribute(Ae):document.body.setAttribute(Ae,e.toString())}},[])},rc=function(e){var t=e.noRelative,r=e.noImportant,s=e.gapMode,a=s===void 0?"margin":s;nc();var o=g.useMemo(function(){return Ji(a)},[a]);return g.createElement(ec,{styles:tc(o,!t,a,r?"":"!important")})},an=!1;if(typeof window<"u")try{var nt=Object.defineProperty({},"passive",{get:function(){return an=!0,!0}});window.addEventListener("test",nt,nt),window.removeEventListener("test",nt,nt)}catch{an=!1}var Ee=an?{passive:!1}:!1,sc=function(e){return e.tagName==="TEXTAREA"},is=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!sc(e)&&r[t]==="visible")},ac=function(e){return is(e,"overflowY")},oc=function(e){return is(e,"overflowX")},ir=function(e,t){var r=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var a=cs(e,s);if(a){var o=ls(e,s),i=o[1],c=o[2];if(i>c)return!0}s=s.parentNode}while(s&&s!==r.body);return!1},ic=function(e){var t=e.scrollTop,r=e.scrollHeight,s=e.clientHeight;return[t,r,s]},cc=function(e){var t=e.scrollLeft,r=e.scrollWidth,s=e.clientWidth;return[t,r,s]},cs=function(e,t){return e==="v"?ac(t):oc(t)},ls=function(e,t){return e==="v"?ic(t):cc(t)},lc=function(e,t){return e==="h"&&t==="rtl"?-1:1},dc=function(e,t,r,s,a){var o=lc(e,window.getComputedStyle(t).direction),i=o*s,c=r.target,l=t.contains(c),f=!1,v=i>0,d=0,h=0;do{if(!c)break;var u=ls(e,c),p=u[0],m=u[1],y=u[2],x=m-y-o*p;(p||x)&&cs(e,c)&&(d+=x,h+=p);var b=c.parentNode;c=b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}while(!l&&c!==document.body||l&&(t.contains(c)||t===c));return(v&&Math.abs(d)<1||!v&&Math.abs(h)<1)&&(f=!0),f},rt=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},cr=function(e){return[e.deltaX,e.deltaY]},lr=function(e){return e&&"current"in e?e.current:e},uc=function(e,t){return e[0]===t[0]&&e[1]===t[1]},hc=function(e){return`
|
|
315
315
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
316
316
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
317
|
-
`)},fc=0,Ne=[];function pc(e){var t=g.useRef([]),r=g.useRef([0,0]),s=g.useRef(),a=g.useState(fc++)[0],o=g.useState(os)[0],i=g.useRef(e);g.useEffect(function(){i.current=e},[e]),g.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var m=Ti([e.lockRef.current],(e.shards||[]).map(lr),!0).filter(Boolean);return m.forEach(function(y){return y.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),m.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var c=g.useCallback(function(m,y){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!i.current.allowPinchZoom;var x=rt(m),b=r.current,k="deltaX"in m?m.deltaX:b[0]-x[0],w="deltaY"in m?m.deltaY:b[1]-x[1],j,_=m.target,M=Math.abs(k)>Math.abs(w)?"h":"v";if("touches"in m&&M==="h"&&_.type==="range")return!1;var C=window.getSelection(),N=C&&C.anchorNode,A=N?N===_||N.contains(_):!1;if(A)return!1;var T=ir(M,_);if(!T)return!0;if(T?j=M:(j=M==="v"?"h":"v",T=ir(M,_)),!T)return!1;if(!s.current&&"changedTouches"in m&&(k||w)&&(s.current=j),!j)return!0;var P=s.current||j;return dc(P,y,m,P==="h"?k:w)},[]),l=g.useCallback(function(m){var y=m;if(!(!Ne.length||Ne[Ne.length-1]!==o)){var x="deltaY"in y?cr(y):rt(y),b=t.current.filter(function(j){return j.name===y.type&&(j.target===y.target||y.target===j.shadowParent)&&uc(j.delta,x)})[0];if(b&&b.should){y.cancelable&&y.preventDefault();return}if(!b){var k=(i.current.shards||[]).map(lr).filter(Boolean).filter(function(j){return j.contains(y.target)}),w=k.length>0?c(y,k[0]):!i.current.noIsolation;w&&y.cancelable&&y.preventDefault()}}},[]),f=g.useCallback(function(m,y,x,b){var k={name:m,delta:y,target:x,should:b,shadowParent:mc(x)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(w){return w!==k})},1)},[]),v=g.useCallback(function(m){r.current=rt(m),s.current=void 0},[]),d=g.useCallback(function(m){f(m.type,cr(m),m.target,c(m,e.lockRef.current))},[]),h=g.useCallback(function(m){f(m.type,rt(m),m.target,c(m,e.lockRef.current))},[]);g.useEffect(function(){return Ne.push(o),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:h}),document.addEventListener("wheel",l,Ee),document.addEventListener("touchmove",l,Ee),document.addEventListener("touchstart",v,Ee),function(){Ne=Ne.filter(function(m){return m!==o}),document.removeEventListener("wheel",l,Ee),document.removeEventListener("touchmove",l,Ee),document.removeEventListener("touchstart",v,Ee)}},[]);var u=e.removeScrollBar,p=e.inert;return g.createElement(g.Fragment,null,p?g.createElement(o,{styles:hc(a)}):null,u?g.createElement(rc,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function mc(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const vc=Wi(as,pc);var ds=g.forwardRef(function(e,t){return g.createElement(yt,Y({},e,{ref:t,sideCar:vc}))});ds.classNames=yt.classNames;var gc=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Pe=new WeakMap,st=new WeakMap,at={},Ht=0,us=function(e){return e&&(e.host||us(e.parentNode))},yc=function(e,t){return t.map(function(r){if(e.contains(r))return r;var s=us(r);return s&&e.contains(s)?s:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},xc=function(e,t,r,s){var a=yc(t,Array.isArray(e)?e:[e]);at[r]||(at[r]=new WeakMap);var o=at[r],i=[],c=new Set,l=new Set(a),f=function(d){!d||c.has(d)||(c.add(d),f(d.parentNode))};a.forEach(f);var v=function(d){!d||l.has(d)||Array.prototype.forEach.call(d.children,function(h){if(c.has(h))v(h);else try{var u=h.getAttribute(s),p=u!==null&&u!=="false",m=(Pe.get(h)||0)+1,y=(o.get(h)||0)+1;Pe.set(h,m),o.set(h,y),i.push(h),m===1&&p&&st.set(h,!0),y===1&&h.setAttribute(r,"true"),p||h.setAttribute(s,"true")}catch(x){console.error("aria-hidden: cannot operate on ",h,x)}})};return v(t),c.clear(),Ht++,function(){i.forEach(function(d){var h=Pe.get(d)-1,u=o.get(d)-1;Pe.set(d,h),o.set(d,u),h||(st.has(d)||d.removeAttribute(s),st.delete(d)),u||d.removeAttribute(r)}),Ht--,Ht||(Pe=new WeakMap,Pe=new WeakMap,st=new WeakMap,at={})}},bc=function(e,t,r){r===void 0&&(r="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),a=gc(e);return a?(s.push.apply(s,Array.from(a.querySelectorAll("[aria-live], script"))),xc(s,a,r,"aria-hidden")):function(){return null}};const kc=["top","right","bottom","left"],de=Math.min,ee=Math.max,ft=Math.round,ot=Math.floor,te=e=>({x:e,y:e}),wc={left:"right",right:"left",bottom:"top",top:"bottom"};function hs(e,t,r){return ee(e,de(t,r))}function re(e,t){return typeof e=="function"?e(t):e}function ue(e){return e.split("-")[0]}function Re(e){return e.split("-")[1]}function xn(e){return e==="x"?"y":"x"}function bn(e){return e==="y"?"height":"width"}function G(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function kn(e){return xn(G(e))}function jc(e,t,r){r===void 0&&(r=!1);const s=Re(e),a=kn(e),o=bn(a);let i=a==="x"?s===(r?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=pt(i)),[i,pt(i)]}function _c(e){const t=pt(e);return[on(e),t,on(t)]}function on(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const dr=["left","right"],ur=["right","left"],Mc=["top","bottom"],Cc=["bottom","top"];function Sc(e,t,r){switch(e){case"top":case"bottom":return r?t?ur:dr:t?dr:ur;case"left":case"right":return t?Mc:Cc;default:return[]}}function Ec(e,t,r,s){const a=Re(e);let o=Sc(ue(e),r==="start",s);return a&&(o=o.map(i=>i+"-"+a),t&&(o=o.concat(o.map(on)))),o}function pt(e){const t=ue(e);return wc[t]+e.slice(t.length)}function Nc(e){var t,r,s,a;return{top:(t=e.top)!=null?t:0,right:(r=e.right)!=null?r:0,bottom:(s=e.bottom)!=null?s:0,left:(a=e.left)!=null?a:0}}function fs(e){return typeof e!="number"?Nc(e):{top:e,right:e,bottom:e,left:e}}function mt(e){const{x:t,y:r,width:s,height:a}=e;return{width:s,height:a,top:r,left:t,right:t+s,bottom:r+a,x:t,y:r}}function hr(e,t,r){let{reference:s,floating:a}=e;const o=G(t),i=kn(t),c=bn(i),l=ue(t),f=o==="y",v=s.x+s.width/2-a.width/2,d=s.y+s.height/2-a.height/2,h=s[c]/2-a[c]/2;let u;switch(l){case"top":u={x:v,y:s.y-a.height};break;case"bottom":u={x:v,y:s.y+s.height};break;case"right":u={x:s.x+s.width,y:d};break;case"left":u={x:s.x-a.width,y:d};break;default:u={x:s.x,y:s.y}}const p=Re(t);return p&&(u[i]+=h*(p==="end"?1:-1)*(r&&f?-1:1)),u}async function Pc(e,t){var r;t===void 0&&(t={});const{x:s,y:a,platform:o,rects:i,elements:c,strategy:l}=e,{boundary:f="clippingAncestors",rootBoundary:v="viewport",elementContext:d="floating",altBoundary:h=!1,padding:u=0}=re(t,e),p=fs(u),y=c[h?d==="floating"?"reference":"floating":d],x=mt(await o.getClippingRect({element:(r=await(o.isElement==null?void 0:o.isElement(y)))==null||r?y:y.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(c.floating)),boundary:f,rootBoundary:v,strategy:l})),b=d==="floating"?{x:s,y:a,width:i.floating.width,height:i.floating.height}:i.reference,k=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c.floating)),w=await(o.isElement==null?void 0:o.isElement(k))&&await(o.getScale==null?void 0:o.getScale(k))||{x:1,y:1},j=mt(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:b,offsetParent:k,strategy:l}):b);return{top:(x.top-j.top+p.top)/w.y,bottom:(j.bottom-x.bottom+p.bottom)/w.y,left:(x.left-j.left+p.left)/w.x,right:(j.right-x.right+p.right)/w.x}}const Ac=50,$c=async(e,t,r)=>{const{placement:s="bottom",strategy:a="absolute",middleware:o=[],platform:i}=r,c=i.detectOverflow?i:{...i,detectOverflow:Pc},l=await(i.isRTL==null?void 0:i.isRTL(t));let f=await i.getElementRects({reference:e,floating:t,strategy:a}),{x:v,y:d}=hr(f,s,l),h=s,u=0;const p={};for(let m=0;m<o.length;m++){const y=o[m];if(!y)continue;const{name:x,fn:b}=y,{x:k,y:w,data:j,reset:_}=await b({x:v,y:d,initialPlacement:s,placement:h,strategy:a,middlewareData:p,rects:f,platform:c,elements:{reference:e,floating:t}});v=k??v,d=w??d,p[x]={...p[x],...j},_&&u<Ac&&(u++,typeof _=="object"&&(_.placement&&(h=_.placement),_.rects&&(f=_.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:a}):_.rects),{x:v,y:d}=hr(f,h,l)),m=-1)}return{x:v,y:d,placement:h,strategy:a,middlewareData:p}},Rc=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:s,placement:a,rects:o,platform:i,elements:c,middlewareData:l}=t,{element:f,padding:v=0}=re(e,t)||{};if(f==null)return{};const d=fs(v),h={x:r,y:s},u=kn(a),p=bn(u),m=await i.getDimensions(f),y=u==="y",x=y?"top":"left",b=y?"bottom":"right",k=y?"clientHeight":"clientWidth",w=o.reference[p]+o.reference[u]-h[u]-o.floating[p],j=h[u]-o.reference[u],_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(f));let M=_?_[k]:0;(!M||!await(i.isElement==null?void 0:i.isElement(_)))&&(M=c.floating[k]||o.floating[p]);const C=w/2-j/2,N=M/2-m[p]/2-1,A=de(d[x],N),T=de(d[b],N),P=M-m[p]-T,O=M/2-m[p]/2+C,R=hs(A,O,P),z=!l.arrow&&Re(a)!=null&&O!==R&&o.reference[p]/2-(O<A?A:T)-m[p]/2<0,D=z?O<A?O-A:O-P:0;return{[u]:h[u]+D,data:{[u]:R,centerOffset:O-R-D,...z&&{alignmentOffset:D}},reset:z}}}),Oc=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,s;const{placement:a,middlewareData:o,rects:i,initialPlacement:c,platform:l,elements:f}=t,{mainAxis:v=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:u="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...y}=re(e,t);if((r=o.arrow)!=null&&r.alignmentOffset)return{};const x=ue(a),b=G(c),k=ue(c)===c,w=await(l.isRTL==null?void 0:l.isRTL(f.floating)),j=h||(k||!m?[pt(c)]:_c(c)),_=p!=="none";!h&&_&&j.push(...Ec(c,m,p,w));const M=[c,...j],C=await l.detectOverflow(t,y),N=[];let A=((s=o.flip)==null?void 0:s.overflows)||[];if(v&&N.push(C[x]),d){const R=jc(a,i,w);N.push(C[R[0]],C[R[1]])}if(A=[...A,{placement:a,overflows:N}],!N.every(R=>R<=0)){var T,P;const R=(((T=o.flip)==null?void 0:T.index)||0)+1,z=M[R];if(z&&(!(d==="alignment"?b!==G(z):!1)||A.every($=>G($.placement)===b?$.overflows[0]>0:!0)))return{data:{index:R,overflows:A},reset:{placement:z}};let D=(P=A.filter(W=>W.overflows[0]<=0).sort((W,$)=>W.overflows[1]-$.overflows[1])[0])==null?void 0:P.placement;if(!D)switch(u){case"bestFit":{var O;const W=(O=A.filter($=>{if(_){const L=G($.placement);return L===b||L==="y"}return!0}).map($=>[$.placement,$.overflows.filter(L=>L>0).reduce((L,U)=>L+U,0)]).sort(($,L)=>$[1]-L[1])[0])==null?void 0:O[0];W&&(D=W);break}case"initialPlacement":D=c;break}if(a!==D)return{reset:{placement:D}}}return{}}}};function fr(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function pr(e){return kc.some(t=>e[t]>=0)}const Tc=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:s}=t,{strategy:a="referenceHidden",...o}=re(e,t);switch(a){case"referenceHidden":{const i=await s.detectOverflow(t,{...o,elementContext:"reference"}),c=fr(i,r.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:pr(c)}}}case"escaped":{const i=await s.detectOverflow(t,{...o,altBoundary:!0}),c=fr(i,r.floating);return{data:{escapedOffsets:c,escaped:pr(c)}}}default:return{}}}}},ps=new Set(["left","top"]);async function Fc(e,t){const{placement:r,platform:s,elements:a}=e,o=await(s.isRTL==null?void 0:s.isRTL(a.floating)),i=ue(r),c=Re(r),l=G(r)==="y",f=ps.has(i)?-1:1,v=o&&l?-1:1,d=re(t,e);let{mainAxis:h,crossAxis:u,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return c&&typeof p=="number"&&(u=c==="end"?p*-1:p),l?{x:u*v,y:h*f}:{x:h*f,y:u*v}}const Dc=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,s;const{x:a,y:o,placement:i,middlewareData:c}=t,l=await Fc(t,e);return i===((r=c.offset)==null?void 0:r.placement)&&(s=c.arrow)!=null&&s.alignmentOffset?{}:{x:a+l.x,y:o+l.y,data:{...l,placement:i}}}}},Lc=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:s,placement:a,platform:o}=t,{mainAxis:i=!0,crossAxis:c=!1,limiter:l={fn:b=>{let{x:k,y:w}=b;return{x:k,y:w}}},...f}=re(e,t),v={x:r,y:s},d=await o.detectOverflow(t,f),h=G(a),u=xn(h);let p=v[u],m=v[h];const y=(b,k)=>hs(k+d[b==="y"?"top":"left"],k,k-d[b==="y"?"bottom":"right"]);i&&(p=y(u,p)),c&&(m=y(h,m));const x=l.fn({...t,[u]:p,[h]:m});return{...x,data:{x:x.x-r,y:x.y-s,enabled:{[u]:i,[h]:c}}}}}},Ic=function(e){return e===void 0&&(e={}),{options:e,fn(t){var r,s;const{x:a,y:o,placement:i,rects:c,middlewareData:l}=t,{offset:f=0,mainAxis:v=!0,crossAxis:d=!0}=re(e,t),h={x:a,y:o},u=G(i),p=xn(u);let m=h[p],y=h[u];const x=re(f,t),b=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:(r=x.mainAxis)!=null?r:0,crossAxis:(s=x.crossAxis)!=null?s:0};if(v){const j=p==="y"?"height":"width",_=c.reference[p]-c.floating[j]+b.mainAxis,M=c.reference[p]+c.reference[j]-b.mainAxis;m<_?m=_:m>M&&(m=M)}if(d){var k,w;const j=p==="y"?"width":"height",_=ps.has(ue(i)),M=c.reference[u]-c.floating[j]+(_&&((k=l.offset)==null?void 0:k[u])||0)+(_?0:b.crossAxis),C=c.reference[u]+c.reference[j]+(_?0:((w=l.offset)==null?void 0:w[u])||0)-(_?b.crossAxis:0);y<M?y=M:y>C&&(y=C)}return{[p]:m,[u]:y}}}},Vc=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:r,rects:s,platform:a,elements:o}=t,{apply:i=()=>{},...c}=re(e,t),l=await a.detectOverflow(t,c),f=ue(r),v=Re(r),d=G(r)==="y",{width:h,height:u}=s.floating;let p,m;f==="top"||f==="bottom"?(p=f,m=v===(await(a.isRTL==null?void 0:a.isRTL(o.floating))?"start":"end")?"left":"right"):(m=f,p=v==="end"?"top":"bottom");const y=u-l.top-l.bottom,x=h-l.left-l.right,b=de(u-l[p],y),k=de(h-l[m],x),w=t.middlewareData.shift,j=!w;let _=b,M=k;w!=null&&w.enabled.x&&(M=x),w!=null&&w.enabled.y&&(_=y),j&&!v&&(d?M=h-2*ee(l.left,l.right):_=u-2*ee(l.top,l.bottom)),await i({...t,availableWidth:M,availableHeight:_});const C=await a.getDimensions(o.floating);return h!==C.width||u!==C.height?{reset:{rects:!0}}:{}}}};function xt(){return typeof window<"u"}function Oe(e){return ms(e)?(e.nodeName||"").toLowerCase():"#document"}function q(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function oe(e){var t;return(t=(ms(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ms(e){return xt()?e instanceof Node||e instanceof q(e).Node:!1}function Q(e){return xt()?e instanceof Element||e instanceof q(e).Element:!1}function fe(e){return xt()?e instanceof HTMLElement||e instanceof q(e).HTMLElement:!1}function mr(e){return!xt()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof q(e).ShadowRoot}function bt(e){const{overflow:t,overflowX:r,overflowY:s,display:a}=Z(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+r)&&a!=="inline"&&a!=="contents"}function Bc(e){return/^(table|td|th)$/.test(Oe(e))}function kt(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Hc=/transform|translate|scale|rotate|perspective|filter/,zc=/paint|layout|strict|content/,be=e=>!!e&&e!=="none";let zt;function wn(e){const t=Q(e)?Z(e):e;return be(t.transform)||be(t.translate)||be(t.scale)||be(t.rotate)||be(t.perspective)||!jn()&&(be(t.backdropFilter)||be(t.filter))||Hc.test(t.willChange||"")||zc.test(t.contain||"")}function Wc(e){let t=_e(e);for(;fe(t)&&!We(t);){if(wn(t))return t;if(kt(t))return null;t=_e(t)}return null}function jn(){return zt==null&&(zt=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),zt}function We(e){return/^(html|body|#document)$/.test(Oe(e))}function Z(e){return q(e).getComputedStyle(e)}function wt(e){return Q(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function _e(e){if(Oe(e)==="html")return e;const t=e.assignedSlot||e.parentNode||mr(e)&&e.host||oe(e);return mr(t)?t.host:t}function vs(e){const t=_e(e);return We(t)?(e.ownerDocument||e).body:fe(t)&&bt(t)?t:vs(t)}function qe(e,t,r){var s;t===void 0&&(t=[]),r===void 0&&(r=!0);const a=vs(e),o=a===((s=e.ownerDocument)==null?void 0:s.body),i=q(a);if(o){const c=cn(i);return t.concat(i,i.visualViewport||[],bt(a)?a:[],c&&r?qe(c):[])}else return t.concat(a,qe(a,[],r))}function cn(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function gs(e){const t=Z(e);let r=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const a=fe(e),o=a?e.offsetWidth:r,i=a?e.offsetHeight:s,c=ft(r)!==o||ft(s)!==i;return c&&(r=o,s=i),{width:r,height:s,$:c}}function _n(e){return Q(e)?e:e.contextElement}function $e(e){const t=_n(e);if(!fe(t))return te(1);const r=t.getBoundingClientRect(),{width:s,height:a,$:o}=gs(t);let i=(o?ft(r.width):r.width)/s,c=(o?ft(r.height):r.height)/a;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const qc=te(0);function ys(e){const t=q(e);return!jn()||!t.visualViewport?qc:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Uc(e,t,r){return t===void 0&&(t=!1),!!r&&t&&r===q(e)}function Me(e,t,r,s){t===void 0&&(t=!1),r===void 0&&(r=!1);const a=e.getBoundingClientRect(),o=_n(e);let i=te(1);t&&(s?Q(s)&&(i=$e(s)):i=$e(e));const c=Uc(o,r,s)?ys(o):te(0);let l=(a.left+c.x)/i.x,f=(a.top+c.y)/i.y,v=a.width/i.x,d=a.height/i.y;if(o&&s){const h=q(o),u=Q(s)?q(s):s;let p=h,m=cn(p);for(;m&&u!==p;){const y=$e(m),x=m.getBoundingClientRect(),b=Z(m),k=x.left+(m.clientLeft+parseFloat(b.paddingLeft))*y.x,w=x.top+(m.clientTop+parseFloat(b.paddingTop))*y.y;l*=y.x,f*=y.y,v*=y.x,d*=y.y,l+=k,f+=w,p=q(m),m=cn(p)}}return mt({width:v,height:d,x:l,y:f})}function jt(e,t){const r=wt(e).scrollLeft;return t?t.left+r:Me(oe(e)).left+r}function xs(e,t){const r=e.getBoundingClientRect(),s=r.left+t.scrollLeft-jt(e,r),a=r.top+t.scrollTop;return{x:s,y:a}}function Kc(e){let{elements:t,rect:r,offsetParent:s,strategy:a}=e;const o=a==="fixed",i=oe(s),c=t?kt(t.floating):!1;if(s===i||c&&o)return r;let l={scrollLeft:0,scrollTop:0},f=te(1);const v=te(0),d=fe(s);if((d||!o)&&((Oe(s)!=="body"||bt(i))&&(l=wt(s)),d)){const u=Me(s);f=$e(s),v.x=u.x+s.clientLeft,v.y=u.y+s.clientTop}const h=i&&!d&&!o?xs(i,l):te(0);return{width:r.width*f.x,height:r.height*f.y,x:r.x*f.x-l.scrollLeft*f.x+v.x+h.x,y:r.y*f.y-l.scrollTop*f.y+v.y+h.y}}function Yc(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Gc(e){const t=wt(e),r=e.ownerDocument.body,s=ee(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),a=ee(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-t.scrollLeft+jt(e);const i=-t.scrollTop;return Z(r).direction==="rtl"&&(o+=ee(e.clientWidth,r.clientWidth)-s),{width:s,height:a,x:o,y:i}}const Xc=25;function Qc(e,t,r){r===void 0&&(r="viewport");const s=r==="layoutViewport",a=q(e),o=oe(e),i=a.visualViewport;let c=o.clientWidth,l=o.clientHeight,f=0,v=0;if(i){const h=!jn()||t==="fixed";s?h||(f=-i.offsetLeft,v=-i.offsetTop):(c=i.width,l=i.height,h&&(f=i.offsetLeft,v=i.offsetTop))}if(jt(o)<=0){const h=o.ownerDocument,u=h.body,p=getComputedStyle(u),m=h.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,y=Math.abs(o.clientWidth-u.clientWidth-m),x=getComputedStyle(o).scrollbarGutter==="stable both-edges"?y/2:y;x<=Xc&&(c-=x)}return{width:c,height:l,x:f,y:v}}function Zc(e,t){const r=Me(e,!0,t==="fixed"),s=r.top+e.clientTop,a=r.left+e.clientLeft,o=$e(e),i=e.clientWidth*o.x,c=e.clientHeight*o.y,l=a*o.x,f=s*o.y;return{width:i,height:c,x:l,y:f}}function vr(e,t,r){let s;if(t==="viewport"||t==="layoutViewport")s=Qc(e,r,t);else if(t==="document")s=Gc(oe(e));else if(Q(t))s=Zc(t,r);else{const a=ys(e);s={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return mt(s)}function Jc(e,t){const r=t.get(e);if(r)return r;let s=qe(e,[],!1).filter(c=>Q(c)&&Oe(c)!=="body"),a=null;const o=Z(e).position==="fixed";let i=o?_e(e):e;for(;Q(i)&&!We(i);){const c=Z(i),l=wn(i),f=a?a.position:o?"fixed":"";!l&&(f==="fixed"||f==="absolute"&&c.position==="static")?s=s.filter(d=>d!==i):a=c,i=_e(i)}return t.set(e,s),s}function el(e){let{element:t,boundary:r,rootBoundary:s,strategy:a}=e;const i=[...r==="clippingAncestors"?kt(t)?[]:Jc(t,this._c):[].concat(r),s],c=vr(t,i[0],a);let l=c.top,f=c.right,v=c.bottom,d=c.left;for(let h=1;h<i.length;h++){const u=vr(t,i[h],a);l=ee(u.top,l),f=de(u.right,f),v=de(u.bottom,v),d=ee(u.left,d)}return{width:f-d,height:v-l,x:d,y:l}}function tl(e){const{width:t,height:r}=gs(e);return{width:t,height:r}}function nl(e,t,r){const s=fe(t),a=oe(t),o=r==="fixed",i=Me(e,!0,o,t);let c={scrollLeft:0,scrollTop:0};const l=te(0);if((s||!o)&&((Oe(t)!=="body"||bt(a))&&(c=wt(t)),s)){const h=Me(t,!0,o,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}!s&&a&&(l.x=jt(a));const f=a&&!s&&!o?xs(a,c):te(0),v=i.left+c.scrollLeft-l.x-f.x,d=i.top+c.scrollTop-l.y-f.y;return{x:v,y:d,width:i.width,height:i.height}}function Wt(e){return Z(e).position==="static"}function gr(e,t){if(!fe(e)||Z(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return oe(e)===r&&(r=r.ownerDocument.body),r}function bs(e,t){const r=q(e);if(kt(e))return r;if(!fe(e)){let a=_e(e);for(;a&&!We(a);){if(Q(a)&&!Wt(a))return a;a=_e(a)}return r}let s=gr(e,t);for(;s&&Bc(s)&&Wt(s);)s=gr(s,t);return s&&We(s)&&Wt(s)&&!wn(s)?r:s||Wc(e)||r}const rl=async function(e){const t=this.getOffsetParent||bs,r=this.getDimensions,s=await r(e.floating);return{reference:nl(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function sl(e){return Z(e).direction==="rtl"}const al={convertOffsetParentRelativeRectToViewportRelativeRect:Kc,getDocumentElement:oe,getClippingRect:el,getOffsetParent:bs,getElementRects:rl,getClientRects:Yc,getDimensions:tl,getScale:$e,isElement:Q,isRTL:sl};function ks(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ol(e,t,r){let s=null,a;const o=oe(e);function i(){var v;clearTimeout(a),(v=s)==null||v.disconnect(),s=null}function c(v,d){v===void 0&&(v=!1),d===void 0&&(d=1),i();const h=e.getBoundingClientRect(),{left:u,top:p,width:m,height:y}=h;if(v||t(),!m||!y)return;const x=ot(p),b=ot(o.clientWidth-(u+m)),k=ot(o.clientHeight-(p+y)),w=ot(u),_={rootMargin:-x+"px "+-b+"px "+-k+"px "+-w+"px",threshold:ee(0,de(1,d))||1};let M=!0;function C(N){const A=N[0].intersectionRatio;if(!ks(h,e.getBoundingClientRect()))return c();if(A!==d){if(!M)return c();A?c(!1,A):a=setTimeout(()=>{c(!1,1e-7)},1e3)}M=!1}try{s=new IntersectionObserver(C,{..._,root:o.ownerDocument})}catch{s=new IntersectionObserver(C,_)}s.observe(e)}const l=q(e),f=()=>c(r);return l.addEventListener("resize",f),c(!0),()=>{l.removeEventListener("resize",f),i()}}function il(e,t,r,s){s===void 0&&(s={});const{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=s,f=_n(e),v=a||o?[...f?qe(f):[],...t?qe(t):[]]:[];v.forEach(x=>{a&&x.addEventListener("scroll",r),o&&x.addEventListener("resize",r)});const d=f&&c?ol(f,r,o):null;let h=-1,u=null;i&&(u=new ResizeObserver(x=>{let[b]=x;b&&b.target===f&&u&&t&&(u.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var k;(k=u)==null||k.observe(t)})),r()}),f&&!l&&u.observe(f),t&&u.observe(t));let p,m=l?Me(e):null;l&&y();function y(){const x=Me(e);m&&!ks(m,x)&&r(),m=x,p=requestAnimationFrame(y)}return r(),()=>{var x;v.forEach(b=>{a&&b.removeEventListener("scroll",r),o&&b.removeEventListener("resize",r)}),d?.(),(x=u)==null||x.disconnect(),u=null,l&&cancelAnimationFrame(p)}}const cl=Dc,ll=Lc,dl=Oc,ul=Vc,hl=Tc,yr=Rc,fl=Ic,pl=(e,t,r)=>{const s=new Map,a=r??{},o={...al,...a.platform,_c:s};return $c(e,t,{...a,platform:o})};var ml=typeof document<"u",vl=function(){},ut=ml?g.useLayoutEffect:vl;function vt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,s,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(s=r;s--!==0;)if(!vt(e[s],t[s]))return!1;return!0}if(a=Object.keys(e),r=a.length,r!==Object.keys(t).length)return!1;for(s=r;s--!==0;)if(!{}.hasOwnProperty.call(t,a[s]))return!1;for(s=r;s--!==0;){const o=a[s];if(!(o==="_owner"&&e.$$typeof)&&!vt(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function ws(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function xr(e,t){const r=ws(e);return Math.round(t*r)/r}function qt(e){const t=g.useRef(e);return ut(()=>{t.current=e}),t}function gl(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:s=[],platform:a,elements:{reference:o,floating:i}={},transform:c=!0,whileElementsMounted:l,open:f}=e,[v,d]=g.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[h,u]=g.useState(s);vt(h,s)||u(s);const[p,m]=g.useState(null),[y,x]=g.useState(null),b=g.useCallback($=>{$!==_.current&&(_.current=$,m($))},[]),k=g.useCallback($=>{$!==M.current&&(M.current=$,x($))},[]),w=o||p,j=i||y,_=g.useRef(null),M=g.useRef(null),C=g.useRef(v),N=l!=null,A=qt(l),T=qt(a),P=qt(f),O=g.useCallback(()=>{if(!_.current||!M.current)return;const $={placement:t,strategy:r,middleware:h};T.current&&($.platform=T.current),pl(_.current,M.current,$).then(L=>{const U={...L,isPositioned:P.current!==!1};R.current&&!vt(C.current,U)&&(C.current=U,Hr.flushSync(()=>{d(U)}))})},[h,t,r,T,P]);ut(()=>{f===!1&&C.current.isPositioned&&(C.current.isPositioned=!1,d($=>({...$,isPositioned:!1})))},[f]);const R=g.useRef(!1);ut(()=>(R.current=!0,()=>{R.current=!1}),[]),ut(()=>{if(w&&(_.current=w),j&&(M.current=j),w&&j){if(A.current)return A.current(w,j,O);O()}},[w,j,O,A,N]);const z=g.useMemo(()=>({reference:_,floating:M,setReference:b,setFloating:k}),[b,k]),D=g.useMemo(()=>({reference:w,floating:j}),[w,j]),W=g.useMemo(()=>{const $={position:r,left:0,top:0};if(!D.floating)return $;const L=xr(D.floating,v.x),U=xr(D.floating,v.y);return c?{...$,transform:"translate("+L+"px, "+U+"px)",...ws(D.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:L,top:U}},[r,c,D.floating,v.x,v.y]);return g.useMemo(()=>({...v,update:O,refs:z,elements:D,floatingStyles:W}),[v,O,z,D,W])}const yl=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:s,padding:a}=typeof e=="function"?e(r):e;return s&&t(s)?s.current!=null?yr({element:s.current,padding:a}).fn(r):{}:s?yr({element:s,padding:a}).fn(r):{}}}},xl=(e,t)=>{const r=cl(e);return{name:r.name,fn:r.fn,options:[e,t]}},bl=(e,t)=>{const r=ll(e);return{name:r.name,fn:r.fn,options:[e,t]}},kl=(e,t)=>({fn:fl(e).fn,options:[e,t]}),wl=(e,t)=>{const r=dl(e);return{name:r.name,fn:r.fn,options:[e,t]}},jl=(e,t)=>{const r=ul(e);return{name:r.name,fn:r.fn,options:[e,t]}},_l=(e,t)=>{const r=hl(e);return{name:r.name,fn:r.fn,options:[e,t]}},Ml=(e,t)=>{const r=yl(e);return{name:r.name,fn:r.fn,options:[e,t]}};var Cl=Object.defineProperty,le=(e,t)=>Cl(e,"name",{value:t,configurable:!0}),js="Popper",[_s,Ms]=hn(js),[Sl,Cs]=_s(js),El=le(e=>{const{__scopePopper:t,children:r}=e,[s,a]=g.useState(null),[o,i]=g.useState(void 0);return n.jsx(Sl,{scope:t,anchor:s,onAnchorChange:a,placementState:o,setPlacementState:i,children:r})},"Popper"),Nl="PopperAnchor",Pl=g.forwardRef(le(function(t,r){const{__scopePopper:s,virtualRef:a,...o}=t,i=Cs(Nl,s),c=g.useRef(null),l=i.onAnchorChange,f=g.useCallback(m=>{c.current=m,m&&l(m)},[l]),v=he(r,f),d=g.useRef(null);g.useEffect(()=>{if(!a)return;const m=d.current;d.current=a.current,m!==d.current&&l(d.current)});const h=i.placementState&&_t(i.placementState),u=h?.[0],p=h?.[1];return a?null:n.jsx(ae.div,{"data-radix-popper-side":u,"data-radix-popper-align":p,...o,ref:v})},"PopperAnchor")),Ss="PopperContent",[Al,Fh]=_s(Ss),$l=g.forwardRef(le(function(t,r){const{__scopePopper:s,side:a="bottom",sideOffset:o=0,align:i="center",alignOffset:c=0,arrowPadding:l=0,avoidCollisions:f=!0,collisionBoundary:v=[],collisionPadding:d=0,sticky:h="partial",hideWhenDetached:u=!1,updatePositionStrategy:p="optimized",onPlaced:m,...y}=t,x=Cs(Ss,s),[b,k]=g.useState(null),w=he(r,k),[j,_]=g.useState(null),M=pn(j),C=M?.width??0,N=M?.height??0,A=a+(i!=="center"?"-"+i:""),T=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},P=Array.isArray(v)?v:[v],O=P.length>0,R={padding:T,boundary:P.filter(Es),altBoundary:O},{refs:z,floatingStyles:D,placement:W,isPositioned:$,middlewareData:L}=gl({strategy:"fixed",placement:A,whileElementsMounted:le((...Ct)=>il(...Ct,{animationFrame:p==="always"}),"whileElementsMounted"),elements:{reference:x.anchor},middleware:[xl({mainAxis:o+N,alignmentAxis:c}),f&&bl({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?kl():void 0,...R}),f&&wl({...R}),jl({...R,apply:le(({elements:Ct,rects:Dn,availableWidth:Gs,availableHeight:Xs})=>{const{width:Qs,height:Zs}=Dn.reference,Je=Ct.floating.style;Je.setProperty("--radix-popper-available-width",`${Gs}px`),Je.setProperty("--radix-popper-available-height",`${Xs}px`),Je.setProperty("--radix-popper-anchor-width",`${Qs}px`),Je.setProperty("--radix-popper-anchor-height",`${Zs}px`)},"apply")}),j&&Ml({element:j,padding:l}),Rl({arrowWidth:C,arrowHeight:N}),u&&_l({strategy:"referenceHidden",...R,boundary:O?R.boundary:void 0})]}),U=x.setPlacementState;ze(()=>(U(W),()=>{U(void 0)}),[W,U]);const[On,Tn]=_t(W),Fn=je(m);ze(()=>{$&&Fn?.()},[$,Fn]);const Ws=L.arrow?.x,qs=L.arrow?.y,Us=L.arrow?.centerOffset!==0,[Ks,Ys]=g.useState();return ze(()=>{b&&Ys(window.getComputedStyle(b).zIndex)},[b]),n.jsx("div",{ref:z.setFloating,"data-radix-popper-content-wrapper":"",style:{...D,transform:$?D.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Ks,"--radix-popper-transform-origin":[L.transformOrigin?.x,L.transformOrigin?.y].join(" "),...L.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:n.jsx(Al,{scope:s,placedSide:On,placedAlign:Tn,onArrowChange:_,arrowX:Ws,arrowY:qs,shouldHideArrow:Us,children:n.jsx(ae.div,{"data-side":On,"data-align":Tn,...y,ref:w,style:{...y.style,animation:$?y.style?.animation:"none"}})})})},"PopperContent"));function Es(e){return e!==null}le(Es,"isNotNull");var Rl=le(e=>({name:"transformOrigin",options:e,fn(t){const{placement:r,rects:s,middlewareData:a}=t,i=a.arrow?.centerOffset!==0,c=i?0:e.arrowWidth,l=i?0:e.arrowHeight,[f,v]=_t(r),d={start:"0%",center:"50%",end:"100%"}[v],h=(a.arrow?.x??0)+c/2,u=(a.arrow?.y??0)+l/2;let p="",m="";return f==="bottom"?(p=i?d:`${h}px`,m=`${-l}px`):f==="top"?(p=i?d:`${h}px`,m=`${s.floating.height+l}px`):f==="right"?(p=`${-l}px`,m=i?d:`${u}px`):f==="left"&&(p=`${s.floating.width+l}px`,m=i?d:`${u}px`),{data:{x:p,y:m}}}}),"transformOrigin");function _t(e){const[t,r="center"]=e.split("-");return[t,r]}le(_t,"getSideAndAlignFromPlacement");var Ol=El,Tl=Pl,Fl=$l,Dl=Object.defineProperty,se=(e,t)=>Dl(e,"name",{value:t,configurable:!0}),Mn="Checkbox",[Ll,Dh]=hn(Mn),[Il,Cn]=Ll(Mn);function Ns(e){const{__scopeCheckbox:t,checked:r,children:s,defaultChecked:a,disabled:o,form:i,name:c,onCheckedChange:l,required:f,value:v="on",internal_do_not_use_render:d}=e,[h,u]=zr({prop:r,defaultProp:a??!1,onChange:l,caller:Mn}),[p,m]=g.useState(null),[y,x]=g.useState(null),b=g.useRef(!1),[k,w]=g.useReducer(M=>M+1,0),j=p?!!i||!!p.closest("form"):!0,_={checked:h,disabled:o,setChecked:u,control:p,setControl:m,name:c,form:i,value:v,hasConsumerStoppedPropagationRef:b,userInteractionCount:k,onUserInteraction:w,required:f,defaultChecked:ne(a)?!1:a,isFormControl:j,bubbleInput:y,setBubbleInput:x};return n.jsx(Il,{scope:t,..._,children:As(d)?d(_):s})}se(Ns,"CheckboxProvider");var Vl="CheckboxTrigger",Bl=g.forwardRef(se(function({__scopeCheckbox:t,onKeyDown:r,onClick:s,...a},o){const{control:i,value:c,disabled:l,checked:f,required:v,setControl:d,setChecked:h,hasConsumerStoppedPropagationRef:u,onUserInteraction:p,isFormControl:m,bubbleInput:y}=Cn(Vl,t),x=he(o,d),b=g.useRef(f);return g.useEffect(()=>{const k=i?.form;if(k){const w=se(()=>h(b.current),"reset");return k.addEventListener("reset",w),()=>k.removeEventListener("reset",w)}},[i,h]),n.jsx(ae.button,{type:"button",role:"checkbox","aria-checked":ne(f)?"mixed":f,"aria-required":v,"data-state":Sn(f),"data-disabled":l?"":void 0,disabled:l,value:c,...a,ref:x,onKeyDown:X(r,k=>{k.key==="Enter"&&k.preventDefault()}),onClick:X(s,k=>{p(),h(w=>ne(w)?!0:!w),y&&m&&(u.current=k.isPropagationStopped(),u.current||k.stopPropagation())})})},"CheckboxTrigger")),Ps=g.forwardRef(se(function(t,r){const{__scopeCheckbox:s,name:a,checked:o,defaultChecked:i,required:c,disabled:l,value:f,onCheckedChange:v,form:d,...h}=t;return n.jsx(Ns,{__scopeCheckbox:s,checked:o,defaultChecked:i,disabled:l,required:c,onCheckedChange:v,name:a,form:d,value:f,internal_do_not_use_render:({isFormControl:u})=>n.jsxs(n.Fragment,{children:[n.jsx(Bl,{...h,ref:r,__scopeCheckbox:s}),u&&n.jsx(ql,{__scopeCheckbox:s})]})})},"Checkbox")),Hl="CheckboxIndicator",zl=g.forwardRef(se(function(t,r){const{__scopeCheckbox:s,forceMount:a,...o}=t,i=Cn(Hl,s);return n.jsx(fn,{present:a||ne(i.checked)||i.checked===!0,children:n.jsx(ae.span,{"data-state":Sn(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:r,style:{pointerEvents:"none",...t.style}})})},"CheckboxIndicator")),Wl="CheckboxBubbleInput",ql=g.forwardRef(se(function({__scopeCheckbox:t,onClick:r,...s},a){const{control:o,hasConsumerStoppedPropagationRef:i,userInteractionCount:c,checked:l,defaultChecked:f,required:v,disabled:d,name:h,value:u,form:p,bubbleInput:m,setBubbleInput:y}=Cn(Wl,t),x=he(a,y),b=pn(o),k=g.useRef(!1),w=g.useRef(l),j=g.useRef(c);g.useEffect(()=>{const M=m;if(!M)return;const C=window.HTMLInputElement.prototype,A=Object.getOwnPropertyDescriptor(C,"checked").set,T=c!==j.current;j.current=c;const P=w.current!==l;w.current=l;const O=!(T&&i.current);if(P&&A){k.current=!T;const R=new Event("click",{bubbles:O});M.indeterminate=ne(l),A.call(M,ne(l)?!1:l),M.dispatchEvent(R),k.current=!1}},[m,l,i,c]);const _=g.useRef(ne(l)?!1:l);return n.jsx(ae.input,{type:"checkbox","aria-hidden":!0,defaultChecked:f??_.current,required:v,disabled:d,name:h,value:u,form:p,...s,tabIndex:-1,ref:x,onClick:X(r,M=>{k.current&&M.stopPropagation()}),style:{...s.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"CheckboxBubbleInput"));function As(e){return typeof e=="function"}se(As,"isFunction");function ne(e){return e==="indeterminate"}se(ne,"isIndeterminate");function Sn(e){return ne(e)?"indeterminate":e?"checked":"unchecked"}se(Sn,"getState");var Ul=Object.defineProperty,pe=(e,t)=>Ul(e,"name",{value:t,configurable:!0}),En="Popover",[$s,Lh]=hn(En,[Ms]),Nn=Ms(),[Kl,Te]=$s(En),Yl=pe(e=>{const{__scopePopover:t,children:r,open:s,defaultOpen:a,onOpenChange:o,modal:i=!1}=e,c=Nn(t),l=g.useRef(null),[f,v]=g.useState(!1),[d,h]=zr({prop:s,defaultProp:a??!1,onChange:o,caller:En});return n.jsx(Ol,{...c,children:n.jsx(Kl,{scope:t,contentId:Xa(),triggerRef:l,open:d,onOpenChange:h,onOpenToggle:g.useCallback(()=>h(u=>!u),[h]),hasCustomAnchor:f,onCustomAnchorAdd:g.useCallback(()=>v(!0),[]),onCustomAnchorRemove:g.useCallback(()=>v(!1),[]),modal:i,children:r})})},"Popover"),Gl="PopoverTrigger",Xl=g.forwardRef(pe(function(t,r){const{__scopePopover:s,...a}=t,o=Te(Gl,s),i=Nn(s),c=he(r,o.triggerRef),l=n.jsx(ae.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":Pn(o.open),...a,ref:c,onClick:X(t.onClick,o.onOpenToggle)});return o.hasCustomAnchor?l:n.jsx(Tl,{asChild:!0,...i,children:l})},"PopoverTrigger")),Rs="PopoverPortal",[Ql,Zl]=$s(Rs,{forceMount:void 0}),Jl=pe(e=>{const{__scopePopover:t,forceMount:r,children:s,container:a}=e,o=Te(Rs,t);return n.jsx(Ql,{scope:t,forceMount:r,children:n.jsx(fn,{present:r||o.open,children:n.jsx($i,{asChild:!0,container:a,children:s})})})},"PopoverPortal"),Ue="PopoverContent",ed=g.forwardRef(pe(function(t,r){const s=Zl(Ue,t.__scopePopover),{forceMount:a=s.forceMount,...o}=t,i=Te(Ue,t.__scopePopover);return n.jsx(fn,{present:a||i.open,children:i.modal?n.jsx(nd,{...o,ref:r}):n.jsx(rd,{...o,ref:r})})},"PopoverContent")),td=Js("PopoverContent.RemoveScroll"),nd=g.forwardRef(pe(function(t,r){const s=Te(Ue,t.__scopePopover),a=g.useRef(null),o=he(r,a),i=g.useRef(!1);return g.useEffect(()=>{const c=a.current;if(c)return bc(c)},[]),n.jsx(ds,{as:td,allowPinchZoom:!0,children:n.jsx(Os,{...t,ref:o,trapFocus:s.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:X(t.onCloseAutoFocus,c=>{c.preventDefault(),i.current||s.triggerRef.current?.focus()}),onPointerDownOutside:X(t.onPointerDownOutside,c=>{const l=c.detail.originalEvent,f=l.button===0&&l.ctrlKey===!0,v=l.button===2||f;i.current=v},{checkForDefaultPrevented:!1}),onFocusOutside:X(t.onFocusOutside,c=>c.preventDefault(),{checkForDefaultPrevented:!1})})})},"PopoverContentModal")),rd=g.forwardRef(pe(function(t,r){const s=Te(Ue,t.__scopePopover),a=g.useRef(!1),o=g.useRef(!1);return n.jsx(Os,{...t,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{t.onCloseAutoFocus?.(i),i.defaultPrevented||(a.current||s.triggerRef.current?.focus(),i.preventDefault()),a.current=!1,o.current=!1},onInteractOutside:i=>{t.onInteractOutside?.(i),i.defaultPrevented||(a.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const c=i.target;s.triggerRef.current?.contains(c)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})},"PopoverContentNonModal")),Os=g.forwardRef(pe(function(t,r){const{__scopePopover:s,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:c,onEscapeKeyDown:l,onPointerDownOutside:f,onFocusOutside:v,onInteractOutside:d,...h}=t,u=Te(Ue,s),p=Nn(s);return yn(),n.jsx(Ni,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:o,onUnmountAutoFocus:i,children:n.jsx(Mi,{asChild:!0,disableOutsidePointerEvents:c,onInteractOutside:d,onEscapeKeyDown:l,onPointerDownOutside:f,onFocusOutside:v,onDismiss:()=>u.onOpenChange(!1),deferPointerDownOutside:!0,children:n.jsx(Fl,{"data-state":Pn(u.open),role:"dialog",id:u.contentId,...p,...h,ref:r,style:{...h.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})},"PopoverContentImpl"));function Pn(e){return e?"open":"closed"}pe(Pn,"getState");var sd=Yl,ad=Xl,od=Jl,Ts=ed,Fs=g.forwardRef(({className:e,...t},r)=>n.jsx(Ps,{ref:r,className:Ke("cds-flex cds-h-6 cds-w-6 cds-shrink-0 cds-cursor-pointer cds-items-center cds-justify-center cds-rounded-md cds-border-2 cds-border-input cds-bg-background cds-transition-colors hover:cds-border-accent focus-visible:cds-outline-none focus-visible:cds-ring-2 focus-visible:cds-ring-ring focus-visible:cds-ring-offset-2 focus-visible:cds-ring-offset-background disabled:cds-cursor-not-allowed disabled:cds-opacity-50 data-[state=checked]:cds-border-accent data-[state=checked]:cds-bg-accent",e),...t,children:n.jsx(zl,{className:"cds-flex cds-items-center cds-justify-center cds-text-accent-foreground",children:n.jsx(qr,{className:"cds-h-4 cds-w-4",strokeWidth:3})})}));Fs.displayName=Ps.displayName;var An=sd,$n=ad,Mt=g.forwardRef(({className:e,align:t="center",sideOffset:r=4,...s},a)=>{let o=ra();return n.jsx(od,{container:o??void 0,children:n.jsx(Ts,{ref:a,align:t,sideOffset:r,collisionBoundary:o??void 0,collisionPadding:8,style:{maxHeight:"var(--radix-popover-content-available-height)",overflowY:"auto"},className:Ke("credify-ui cds-z-50 cds-rounded-lg cds-border cds-border-border cds-bg-popover cds-p-3 cds-text-popover-foreground cds-shadow-lg cds-outline-none",e),...s})})});Mt.displayName=Ts.displayName;var id=g.lazy(()=>aa(()=>import("./dob-calendar-RIJ5S6YU-1oIu3-0M.js"),__vite__mapDeps([0,1,2,3]))),ht=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`,cd=e=>{let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(t)return new Date(Number(t[1]),Number(t[2])-1,Number(t[3]))},Ut=e=>{let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);return t?`${t[2]}/${t[3]}/${t[1]}`:""},ld=e=>{if(e.includes("-"))return e;let t=e.replace(/\D/g,"").slice(0,8);return t.length<=2?t:t.length<=4?`${t.slice(0,2)}/${t.slice(2)}`:`${t.slice(0,2)}/${t.slice(2,4)}/${t.slice(4)}`},br=e=>{let t=/^(\d{4})-(\d{1,2})-(\d{1,2})$/.exec(e.trim()),r=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(e.trim()),[s,a,o]=t?[Number(t[1]),Number(t[2]),Number(t[3])]:r?[Number(r[3]),Number(r[1]),Number(r[2])]:[0,0,0];if(!s)return"";let i=new Date(s,a-1,o);return i.getFullYear()===s&&i.getMonth()===a-1&&i.getDate()===o&&i<=new Date?ht(i):""},dd=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches,ud=({id:e,hintId:t,value:r,onChange:s})=>{let[a,o]=g.useState(()=>Ut(r)),[i,c]=g.useState(!1),l=new Date,[f,v]=g.useState(r);if(r!==f&&(v(r),br(a)!==r&&o(Ut(r))),dd())return n.jsx("input",{id:e,type:"date",max:ht(l),"aria-describedby":t,className:F,autoComplete:"bday",value:r,onChange:p=>s(p.target.value)});let d=cd(r),h=a.length===10&&!r,u=`${e}-error`;return n.jsxs("div",{children:[n.jsxs("div",{className:"cds-flex cds-gap-2",children:[n.jsx("input",{id:e,className:F,inputMode:"numeric",autoComplete:"bday",placeholder:"MM/DD/YYYY","aria-invalid":h||void 0,"aria-describedby":h?`${u} ${t??""}`.trim():t,value:a,onChange:p=>{let m=ld(p.target.value);o(m),s(br(m))}}),n.jsxs(An,{open:i,onOpenChange:c,children:[n.jsx($n,{asChild:!0,children:n.jsx("button",{type:"button","aria-label":"Pick date of birth from a calendar",className:Ke("cds-flex cds-w-12 cds-shrink-0 cds-items-center cds-justify-center cds-rounded-lg cds-border cds-border-input cds-bg-background cds-text-fg-muted cds-transition-colors hover:cds-border-accent hover:cds-text-accent",V),children:n.jsx(io,{className:"cds-h-5 cds-w-5","aria-hidden":"true"})})}),n.jsx(Mt,{align:"end",className:"cds-w-auto",children:n.jsx(g.Suspense,{fallback:n.jsx("div",{className:"cds-h-8 cds-w-64 cds-animate-pulse cds-rounded cds-bg-surface-muted"}),children:n.jsx(id,{today:l,selected:d,onSelect:p=>{p&&(s(ht(p)),o(Ut(ht(p)))),c(!1)}})})})]})]}),h?n.jsx("p",{id:u,role:"alert",className:"cds-mt-1 cds-text-xs cds-font-medium cds-text-destructive",children:"Enter a valid date of birth as MM/DD/YYYY — it can't be in the future."}):null]})},hd="cds-mt-1 cds-text-xs cds-font-medium cds-text-destructive",fd=({label:e,value:t,onChange:r,onPick:s})=>{let a=`${g.useId()}-address-suggestions`,[o,i]=g.useState([]),[c,l]=g.useState(!1),[f,v]=g.useState(-1),d=g.useRef(null),h=g.useRef(void 0);g.useEffect(()=>{let x=!1;return sa().then(b=>{x||(d.current=b)}),()=>{x=!0,clearTimeout(h.current)}},[]);let u=()=>{i([]),l(!1),v(-1)},p=x=>{if(r(x),clearTimeout(h.current),!d.current||x.trim().length<3){u();return}h.current=setTimeout(()=>{d.current?.(x).then(b=>{i(b),l(b.length>0),v(-1)})},250)},m=x=>{s(x),u()},y=x=>{if(!(!c||!o.length)){if(x.key==="ArrowDown"||x.key==="ArrowUp"){x.preventDefault();let b=x.key==="ArrowDown"?1:-1;v(k=>(k+b+o.length)%o.length);return}if(x.key==="Enter"&&f>=0){x.preventDefault();let b=o[f];b&&m(b);return}x.key==="Escape"&&u()}};return n.jsx(un,{label:e,children:({id:x})=>n.jsxs("div",{className:"cds-relative",children:[n.jsx("input",{id:x,type:"text",role:"combobox","aria-expanded":c,"aria-controls":a,"aria-autocomplete":"list","aria-activedescendant":f>=0?`${a}-${f}`:void 0,autoComplete:"address-line1",value:t,onChange:b=>p(b.target.value),onKeyDown:y,onBlur:()=>setTimeout(u,150),className:F}),c&&o.length?n.jsx("ul",{id:a,role:"listbox","aria-label":"Address suggestions",className:"cds-absolute cds-z-20 cds-mt-1 cds-w-full cds-overflow-hidden cds-rounded-lg cds-border cds-border-border cds-bg-popover cds-shadow-lg",children:o.map((b,k)=>n.jsx("li",{children:n.jsx("button",{type:"button",id:`${a}-${k}`,role:"option","aria-selected":k===f,onMouseDown:w=>w.preventDefault(),onClick:()=>m(b),className:Ke("cds-block cds-w-full cds-px-3 cds-py-2 cds-text-left cds-text-sm",k===f?"cds-bg-highlight cds-text-fg":"cds-text-popover-foreground"),children:b.description})},b.description))}):null]})})},pd=({question:e,values:t,error:r,onPatch:s})=>{let a=`__${e.key}`,o=String(t[e.key]??""),i=`${a}_line_1`in t;g.useEffect(()=>{if(i||!o)return;let u=ma(o);s({[`${a}_line_1`]:u.line_1,[`${a}_line_2`]:"",[`${a}_city`]:u.city||String(t.city??""),[`${a}_state`]:u.state||String(t.state??""),[`${a}_postal_code`]:u.postal_code||String(t.postal_code??"")})},[i,o]);let c=String(t[`${a}_line_1`]??""),l=String(t[`${a}_line_2`]??""),f=String(t[`${a}_city`]??t.city??""),v=String(t[`${a}_state`]??t.state??""),d=String(t[`${a}_postal_code`]??t.postal_code??"");g.useEffect(()=>{let u=va({line_1:c,line_2:l,city:f,state:v,postal_code:d});!u&&o||u!==o&&s({[e.key]:u})},[c,l,f,v,d]);let h=(u,p,m,y={})=>n.jsx(un,{label:p,children:({id:x})=>n.jsx("input",{id:x,type:"text",value:m,autoComplete:y.autoComplete,inputMode:y.inputMode,onChange:b=>s({[u]:y.uppercase?b.target.value.toUpperCase():b.target.value}),className:F})});return n.jsxs("fieldset",{className:"cds-mb-2",children:[n.jsx("legend",{className:"cds-mb-1 cds-block cds-text-sm cds-font-semibold cds-text-fg",children:e.question}),n.jsx(fd,{label:"Street address",value:c,onChange:u=>s({[`${a}_line_1`]:u}),onPick:u=>{let p=ta(u.description);s({[`${a}_line_1`]:p.line_1,[`${a}_city`]:p.city||f,[`${a}_state`]:p.state||v,[`${a}_postal_code`]:p.postal_code||d}),na(u.place_id).then(m=>{m&&s({[`${a}_postal_code`]:m})})}}),h(`${a}_line_2`,"Apt, unit, suite (optional)",l,{autoComplete:"address-line2"}),n.jsxs("div",{className:"cds-grid cds-gap-3 sm:cds-grid-cols-3",children:[h(`${a}_city`,"City",f,{autoComplete:"address-level2"}),h(`${a}_state`,"State",v,{autoComplete:"address-level1",uppercase:!0}),h(`${a}_postal_code`,"ZIP",d,{autoComplete:"postal-code",inputMode:"numeric"})]}),r?n.jsx("p",{className:hd,role:"alert",children:r}):null]})},md=({label:e,checked:t,onChange:r,className:s})=>{let a=g.useId();return n.jsxs("label",{htmlFor:a,className:Ke("cds-mb-2 cds-flex cds-cursor-pointer cds-items-center cds-justify-between cds-rounded-lg cds-border cds-border-border cds-bg-background cds-px-4 cds-py-3 cds-transition-colors hover:cds-border-accent/60 hover:cds-bg-highlight/40",s),children:[n.jsx("span",{className:"cds-text-sm cds-font-medium cds-text-fg",children:e}),n.jsx(Fs,{id:a,checked:t,onCheckedChange:o=>r(o===!0)})]})},S=e=>({className:t})=>n.jsx("svg",{viewBox:"0 0 48 48",fill:"none",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round",className:t,focusable:"false",children:e}),it=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M6 26 24 8l18 18"}),n.jsx("path",{d:"M10 26v14h28V26"})]})),vd=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M6 26 16 10h16l10 16"}),n.jsx("path",{d:"M10 26v14h28V26"}),n.jsx("path",{d:"M16 10 24 26l8-16"})]})),gd=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M6 16h36"}),n.jsx("path",{d:"M10 16v24h28V16"})]})),Kt=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M6 26 14 17l10-7 10 7 8 9"}),n.jsx("path",{d:"M10 26v14h28V26"})]})),yd=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M6 26 24 8l18 18"}),n.jsx("path",{d:"M10 26v14h28V26"}),n.jsx("path",{d:"M24 8 15 17",strokeWidth:5,strokeOpacity:.35})]})),xd=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M6 26 24 8l18 18",strokeWidth:5,strokeOpacity:.35}),n.jsx("path",{d:"M6 26 24 8l18 18"}),n.jsx("path",{d:"M10 26v14h28V26"})]})),bd=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M6 26 24 8l18 18",strokeDasharray:"5 4"}),n.jsx("path",{d:"M10 26v14h28V26"})]})),ce=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M6 24 24 10l18 14"}),n.jsx("path",{d:"M10 24v14h28V24"}),n.jsx("path",{d:"M20 38v-10h8v10"})]})),kd=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M4 22 24 10l20 12"}),n.jsx("path",{d:"M8 22v16h32V22"}),n.jsx("path",{d:"M18 38v-8h6v8"})]})),wd=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M6 20 24 8l18 12"}),n.jsx("path",{d:"M10 20v18h28V20"}),n.jsx("path",{d:"M20 38v-9h8v9"}),n.jsx("path",{d:"M14 24h4M30 24h4M14 30h4M30 30h4"})]})),jd=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 24 24 10l16 14"}),n.jsx("path",{d:"M12 24v14h24V24"}),n.jsx("path",{d:"M20 38v-8h8v8"}),n.jsx("circle",{cx:"24",cy:"19",r:"1.6",fill:"currentColor",stroke:"none"})]})),_d=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M6 22 16 12v-4"}),n.jsx("path",{d:"M12 22 24 10l12 12"}),n.jsx("path",{d:"M10 22v16h28V22"}),n.jsx("path",{d:"M20 38v-8h8v8"})]})),kr=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 18h32v20H8z"}),n.jsx("path",{d:"M8 18 24 8l16 10"}),n.jsx("path",{d:"M16 38V26h8v12"})]})),Md=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M4 26 24 12l20 14"}),n.jsx("path",{d:"M8 26v12h32V26"}),n.jsx("path",{d:"M18 38v-7h6v7"})]})),Cd=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M6 24 24 9l18 15"}),n.jsx("path",{d:"M10 24v14h28V24"}),n.jsx("path",{d:"M20 38v-9h8v9"}),n.jsx("path",{d:"M24 9V4"})]})),Sd=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M6 20 24 6l18 14"}),n.jsx("path",{d:"M10 20v18h28V20"}),n.jsx("path",{d:"M14 20v6M20 20v6M28 20v6M34 20v6"}),n.jsx("path",{d:"M20 38v-8h8v8"})]})),Ed=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 20c0-6 6-12 16-12s16 6 16 12"}),n.jsx("path",{d:"M10 20v18h28V20"}),n.jsx("path",{d:"M20 38v-8h8v8"})]})),Yt=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 22c0-7 7-13 16-13s16 6 16 13"}),n.jsx("path",{d:"M10 22v16h28V22"}),n.jsx("path",{d:"M20 38v-9a4 4 0 0 1 8 0v9"})]})),Nd=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 18 24 8l16 10"}),n.jsx("path",{d:"M10 18v20h28V18"}),n.jsx("path",{d:"M24 18v20M10 28h28"})]})),Gt=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M6 22 24 10l18 12"}),n.jsx("path",{d:"M10 22v16h28V22"}),n.jsx("path",{d:"M10 27h28M10 32h28"})]})),wr=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M4 24 16 16l10 6"}),n.jsx("path",{d:"M26 22 36 14l8 6"}),n.jsx("path",{d:"M8 24v14h18V24"}),n.jsx("path",{d:"M26 22v16h14V22"})]})),jr=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M4 30 12 24l8 4"}),n.jsx("path",{d:"M20 28 28 20l8 5"}),n.jsx("path",{d:"M8 30v10h12V30"}),n.jsx("path",{d:"M20 28v12h14V28"}),n.jsx("path",{d:"M34 25 42 20v20h-8"})]})),_r=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M6 22 24 8l18 14"}),n.jsx("path",{d:"M10 22v16h28V22"}),n.jsx("path",{d:"M24 22v16"}),n.jsx("path",{d:"M14 38v-7h5v7M29 38v-7h5v7"})]})),Pd=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 20 18 12l10 8"}),n.jsx("path",{d:"M28 20 38 13l6 7"}),n.jsx("path",{d:"M10 20v18h18V20"}),n.jsx("path",{d:"M28 20v18h14V20"})]})),Ad=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M6 22 12 16l6 6M18 22l6-6 6 6M30 22l6-6 6 6"}),n.jsx("path",{d:"M8 22v16h10V22M18 22v16h12V22M30 22v16h10V22"})]})),$d=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 20 24 10l16 10"}),n.jsx("path",{d:"M8 20v18h32V20"}),n.jsx("path",{d:"M8 26h32M8 32h32"})]})),Rd=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 14h32v24H8z"}),n.jsx("path",{d:"M24 14v24M8 26h32"})]})),Od=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 10h32v28H8z"}),n.jsx("path",{d:"M14 16h5v5h-5zM24 16h5v5h-5zM33 16h3v5h-3z"}),n.jsx("path",{d:"M14 26h5v5h-5zM24 26h5v5h-5zM33 26h3v5h-3z"})]})),Ce=(e,t)=>{let r=40-Math.min(e,4)*7-(t?3:0),s=[];for(let a=1;a<e;a+=1){let o=40-a*7;s.push(n.jsx("path",{d:`M10 ${o}h28`},a))}return S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:`M6 ${r} 24 ${Math.max(r-12,4)}l18 ${r-Math.max(r-12,4)}`}),n.jsx("path",{d:`M10 ${r}v${40-r}h28V${r}`}),s,t?n.jsx("path",{d:`M19 ${r}v-5h5`}):null]}))},Td=Ce(1,!1),Fd=Ce(1,!0),Mr=Ce(2,!1),Dd=Ce(2,!0),Ld=Ce(3,!1),Id=Ce(3,!0),Vd=Ce(4,!1),ie=e=>S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 20 24 10l16 10"}),n.jsx("path",{d:"M11 20v10h26V20"}),n.jsx("path",{d:"M4 30h40"}),e]})),Cr=ie(n.jsx("path",{d:"M11 30v4h26v-4",strokeWidth:4})),Bd=ie(n.jsx("path",{d:"M11 30v11h26V30"})),Hd=ie(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M11 30v11h13V30"}),n.jsx("path",{d:"M24 30v4h13v-4",strokeWidth:4})]})),zd=ie(n.jsx("path",{d:"M11 30v6h26v-6"})),Wd=ie(n.jsx(n.Fragment,{children:n.jsx("path",{d:"M13 30v10M24 30v10M35 30v10"})})),qd=ie(n.jsx("path",{d:"M11 30v10M37 30v10",strokeDasharray:"4 3"})),Sr=ie(n.jsx("path",{d:"M11 30v11h26V30"})),Ud=ie(n.jsx(n.Fragment,{children:n.jsx("path",{d:"M11 30v11h13V36h13v-6"})})),Kd=ie(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M11 30v11h26V30"}),n.jsx("path",{d:"M37 41h6"}),n.jsx("path",{d:"M30 41v-7h7"})]})),Ye=e=>S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M6 24 18 14l12 10"}),n.jsx("path",{d:"M9 24v16h18V24"}),e]})),Er=Ye(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M29 28h13v12H29z"}),n.jsx("path",{d:"M32 40v-7h7v7"})]})),Yd=Ye(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M33 28h11v12H33z"}),n.jsx("path",{d:"M36 40v-7h5v7"})]})),Gd=Ye(n.jsx("path",{d:"M13 40v-8h10v8"})),Xd=Ye(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M9 34h18"}),n.jsx("path",{d:"M13 40v-4h10v4"})]})),Qd=Ye(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M29 30h14"}),n.jsx("path",{d:"M30 30v10M42 30v10"})]})),Nr=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M22 40V22a4 4 0 0 1 8 0v18"}),n.jsx("path",{d:"M18 26h16M20 40h12M26 22v-4"}),n.jsx("path",{d:"M6 34h10"})]})),Zd=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M26 40V24a4 4 0 0 1 8 0v16"}),n.jsx("path",{d:"M22 28h16M24 40h12M30 24v-4"}),n.jsx("path",{d:"M4 34h14",strokeDasharray:"4 3"})]})),Jd=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M32 40V26a3 3 0 0 1 6 0v14"}),n.jsx("path",{d:"M29 29h12M30 40h10M35 26v-3"}),n.jsx("path",{d:"M4 34h20",strokeDasharray:"3 4"})]})),Pr=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 22 24 10l16 12"}),n.jsx("path",{d:"M12 22v14h24V22"}),n.jsx("path",{d:"M4 40h40"})]})),eu=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 20 24 8l16 12"}),n.jsx("path",{d:"M12 20v14h24V20"}),n.jsx("path",{d:"M4 40h16"}),n.jsx("path",{d:"M20 38c3-2 5 2 8 0s5 2 8 0 5 2 8 0"})]})),tu=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M10 18 24 8l14 10"}),n.jsx("path",{d:"M14 18v12h20V18"}),n.jsx("path",{d:"M17 30v8M31 30v8"}),n.jsx("path",{d:"M4 40c3-2 5 2 8 0s5 2 8 0 5 2 8 0 5 2 8 0 5 2 8 0"})]})),Ge=e=>S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 16h12a6 6 0 0 1 6 6v10a6 6 0 0 0 6 6h8"}),n.jsx("path",{d:"M6 12v8M42 34v8"}),n.jsx("text",{x:"24",y:"14",fill:"currentColor",stroke:"none",fontSize:"11",fontWeight:"700",textAnchor:"middle",children:e})]})),nu=Ge("Cu"),ru=Ge("Gal"),su=Ge("PEX"),au=Ge("PVC"),ou=Ge("PB"),Xt=S(n.jsxs(n.Fragment,{children:[n.jsx("circle",{cx:"24",cy:"24",r:"15"}),n.jsx("path",{d:"M24 9a15 15 0 0 1 0 30z",fill:"currentColor",stroke:"none",fillOpacity:.3})]})),Qt=S(n.jsxs(n.Fragment,{children:[n.jsx("circle",{cx:"24",cy:"24",r:"15",fill:"currentColor",stroke:"none",fillOpacity:.3}),n.jsx("circle",{cx:"24",cy:"24",r:"15"}),n.jsx("path",{d:"M17 24l5 5 9-10"})]})),iu=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M4 34h40"}),n.jsx("rect",{x:"14",y:"16",width:"20",height:"14",rx:"4"}),n.jsx("path",{d:"M18 30v4M30 30v4"})]})),cu=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M4 20h40"}),n.jsx("rect",{x:"14",y:"26",width:"20",height:"14",rx:"4"}),n.jsx("path",{d:"M24 26v-6"})]})),Ar=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 26 20 16l12 10"}),n.jsx("path",{d:"M11 26v14h18V26"}),n.jsx("path",{d:"M36 20a10 10 0 0 1 0 16"}),n.jsx("path",{d:"M40 15a16 16 0 0 1 0 26"})]})),$r=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 26 20 16l12 10"}),n.jsx("path",{d:"M11 26v14h18V26"}),n.jsx("path",{d:"M31 30h11"}),n.jsx("path",{d:"M38 26l4 4-4 4"})]})),Rr=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M10 26 24 14l14 12"}),n.jsx("path",{d:"M14 26v14h20V26"}),n.jsx("path",{d:"M24 34v-6"}),n.jsx("circle",{cx:"24",cy:"22",r:"2.5"})]})),lu=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 14h32"}),n.jsx("path",{d:"M16 14v4M24 14v4M32 14v4"}),n.jsx("path",{d:"M12 26c2-4 4-4 4-8M20 26c2-4 4-4 4-8M28 26c2-4 4-4 4-8",strokeDasharray:"3 3"}),n.jsx("path",{d:"M8 38h32"})]})),du=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 14h32"}),n.jsx("path",{d:"M16 14v4M24 14v4"}),n.jsx("path",{d:"M12 26c2-4 4-4 4-8M20 26c2-4 4-4 4-8",strokeDasharray:"3 3"}),n.jsx("path",{d:"M8 38h18"})]})),Or=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M6 24 24 10l18 14"}),n.jsx("path",{d:"M10 24v14h28V24"}),n.jsx("circle",{cx:"24",cy:"28",r:"3"}),n.jsx("path",{d:"M18 38c0-4 3-6 6-6s6 2 6 6"})]})),uu=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M4 22 16 12l12 10"}),n.jsx("path",{d:"M8 22v16h16V22"}),n.jsx("path",{d:"M26 28 35 21l9 7"}),n.jsx("path",{d:"M29 28v10h12V28"})]})),hu=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 28 24 16l16 12"}),n.jsx("path",{d:"M12 28v12h24V28"}),n.jsx("circle",{cx:"38",cy:"11",r:"4"}),n.jsx("path",{d:"M38 4v2M38 16v2M45 11h-2M33 11h-2"})]})),fu=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 30h32"}),n.jsx("path",{d:"M12 30l4-9h16l4 9"}),n.jsx("circle",{cx:"16",cy:"34",r:"3"}),n.jsx("circle",{cx:"32",cy:"34",r:"3"}),n.jsx("path",{d:"M20 15l3 3 6-6"})]})),pu=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 30h32"}),n.jsx("path",{d:"M12 30l4-9h16l4 9"}),n.jsx("circle",{cx:"16",cy:"34",r:"3"}),n.jsx("circle",{cx:"32",cy:"34",r:"3"}),n.jsx("path",{d:"M18 10h12v8H18z"}),n.jsx("path",{d:"M21 14h6"})]})),mu=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 30h32"}),n.jsx("path",{d:"M12 30l4-9h16l4 9"}),n.jsx("circle",{cx:"16",cy:"34",r:"3"}),n.jsx("circle",{cx:"32",cy:"34",r:"3"}),n.jsx("rect",{x:"19",y:"11",width:"10",height:"7",rx:"2"}),n.jsx("path",{d:"M21 11V9a3 3 0 0 1 6 0v2"})]})),vu=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M10 32h28"}),n.jsx("path",{d:"M14 32l3-8h6l3 8"}),n.jsx("circle",{cx:"17",cy:"35",r:"2.5"}),n.jsx("path",{d:"M31 28a5 5 0 1 1 10 0v6H31z"}),n.jsx("path",{d:"M36 14v6M31 17l3 3M41 17l-3 3"})]})),gu=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M10 32h28"}),n.jsx("path",{d:"M14 32l3-8h6l3 8"}),n.jsx("circle",{cx:"17",cy:"35",r:"2.5"}),n.jsx("path",{d:"M28 24h12v8H28z"}),n.jsx("path",{d:"M31 20l3 3 3-3"})]})),yu=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 32h32"}),n.jsx("path",{d:"M12 32l4-9h16l4 9"}),n.jsx("circle",{cx:"16",cy:"35",r:"2.5"}),n.jsx("circle",{cx:"32",cy:"35",r:"2.5"}),n.jsx("path",{d:"M18 16l4 4 8-8"})]})),xu={co_applicant_gender:"gender"},bu={roof_shape:{byToken:{B_Gable:it,C_Hip:vd,A_Flat:gd,D_Other:Kt},fallback:Kt},architectural_style:{byToken:{TwoFamilyHome:_r,American4square:Nd,Basic:ce,BiLevel:wr,Bungalow:Md,CapeCod:jd,Colonial:wd,ColonialSpanish:Yt,CompletelyCustom:kr,Contemporary:kr,ContractorModern:ce,Farmhouse:Cd,Folk:ce,Log:Gt,Mediterranean:Ed,Ranch:kd,TriLevel:jr,Tudor:Sd,Vernacular:ce,Victorian:_d},fallback:ce},dwelling_type:{byToken:{SingleFamilyHouse:ce,Townhouse:Pd,Rowhouse:Ad,Duplex:_r,Triplex:$d,Fourplex:Rd,MultFamily:Od},fallback:ce},number_of_stories:{byToken:{One:Td,OneHalf:Fd,Two:Mr,TwoHalf:Dd,Three:Ld,ThreeHalf:Id,Four:Vd,BiLevel:wr,TriLevel:jr},fallback:Mr},foundation_type:{byToken:{Slab:Cr,Basement:Bd,CrawlSpace:zd,PartialBasement:Hd,PiersPostsPiles:Wd,Open:qd},fallback:Cr},basement_type:{byToken:{Basement:Sr,SplitLevelBasement:Ud,WalkoutBasement:Kd},fallback:Sr},occupancy_type:{byToken:{OwnerPrimary:Or,OwnerSecondary:uu,OwnerSeasonal:hu},fallback:Or},roof_updated_type:{byToken:{NotUpdated:bd,PartialUpdate:yd,CompleteUpdate:xd},fallback:it},located_over_water:{byToken:{NotOverWater:Pr,PartiallyOverWater:eu,FullyOrEntirelyOverWater:tu},fallback:Pr},construction_type:{byToken:{Frame:ce,Masonry:me,MasonryVeneer:me,Log:Gt,Asbestos:At,EFIS:B,HardiPlank:ye,SuperiorFireResistive:Be,SuperiorMasonryNonCombustible:me,SuperiorNonCombustible:$t},fallback:me},exterior_wall_type:{byToken:{VinylSiding:ye,WoodFraming:xe,BrickVeneer:me,Stucco:B,AdobeBlock:ge,AluminumSiding:ye,CementFiberShingles:B,Clapboard:ye,ConcreteBlock:ge,HardboardSiding:ye,InsulatedConcreteForms:ge,LightGaugeSteelFraming:B,LogsSolid:Gt,MasoniteSiding:ye,PreEngineeredMetal:B,SolidBrickConstruction:me,SolidConcrete:ge,StandardPoleFramed:xe,Stone:K,StructuralInsulatedPanels:B,TimberFraming:xe},fallback:me},roof_material_type:{byToken:{ASPHALT_SHINGLES:it,ARCHITECTURAL_SHINGLES:B,METAL:B,TILE_CONCRETE:ge,ASBESTOS:At,BUILT_UP:B,COMPOSITION:B,CONCRETE:ge,COPPER:ei,CORRUGATED_STEEL:ye,FIBERGLASS:B,FOAM:Ve,GRAVEL:K,MEMBRANE:B,MINERAL_FIBER_SHAKE:K,PLASTIC:B,ROCK:K,ROLLED_PAPER:Nt,RUBBER:B,SLATE:K,TAR:Gn,TAR_GRAVEL:K,TILE_CLAY:ge,TILE_MISSION:Yt,TILE_SPANISH:Yt,TIN:B,WOOD_FIBERGLASS_SHINGLES:xe,WOOD_SHAKE:xe,WOOD_SHINGLES:xe,OTHER:Kt},fallback:it},heating_type:{byToken:{Electric:gi,Gas:Be,GasForcedAir:Bn,GasHotWater:Ve,Oil:Xn,OilForcedAir:Bn,OilHotWater:Ve,SolidFuel:xe,HeatPump:Rt,Other:Rt},fallback:Rt},plumbing_type:{byToken:{EntirelyCopper:nu,EntirelyGalvanized:ru,EntirelyPEX:su,EntirelyPVC:au,Polybutylene:ou},fallback:Gn},oil_tank_location:{byToken:{AboveGround:iu,BelowGround:cu},fallback:Xn},heating_update_type:{byToken:{PartialUpdate:Xt,CompleteUpdate:Qt},fallback:Ft},plumbing_update_type:{byToken:{PartialUpdate:Xt,CompleteUpdate:Qt},fallback:Ft},electrical_update_type:{byToken:{PartialUpdate:Xt,CompleteUpdate:Qt},fallback:Ft},garage_type:{byToken:{Attached:Er,Basement:Xd,BuiltIn:Gd,Carport:Qd,Detached:Yd},fallback:Er},distance_from_fire_hydrant_ft:{byToken:{_0_500ft:Nr,_501_1000ft:Zd,_1001ftAndGreater:Jd},fallback:Nr},distance_from_fire_station_miles:{byToken:{Lessthan5miles:Jn,Over5miles:er,NotAvailable:Ao},fallback:Jn},fire_detection_system_type:{byToken:{Central:Ar,Direct:$r,Local:Rr},fallback:Hn},burglar_alarm_system_type:{byToken:{Central:Ar,Direct:$r,Local:Rr},fallback:Hn},sprinkler_system_type:{byToken:{Full:lu,Partial:du},fallback:Ve},ownership_type:{byToken:{Owned:fu,Leased:pu,Lien:mu},fallback:Vn},usage:{byToken:{Business:zn,Pleasure:ci,Farming:si,To_FromWork:qn,To_FromSchool:qo},fallback:Vn},gender:{byToken:{Female:fi,Male:Fo},fallback:et},relationship_to_insured:{byToken:{Spouse:Eo,Parent:Tt,Child:eo,"Domestic Partner":ga,Relative:Tt,Employee:zn,Other:et},fallback:et},license_status:{byToken:{Valid:pa,Suspended:At,Permit:Nt,Unlicensed:Ur},fallback:Nt},residence_type:{byToken:{OwnHome:St,OwnCondo:qn,RentHome:Ro,RentCondo:Zn,RentApartment:Zn,LiveWithParents:Tt},fallback:St},description:{byToken:{"At Fault With Injuries":vu,"At Fault With No Injury":gu,"Not At Fault":yu,"All Others":ve,Contamination:Wn,"Credit Card":Yn,Earthquake:K,"Extended Coverage Perils":$t,Fire:Be,Flood:In,Hail:Un,Lightning:Kn,"Medical Payments":Qn,"Theft/Burglary":Et,"Vandalism/Malicious Mischief":Pt,"Water Damage":Ve,Wind:tr,Towing:er,Glass:ve,"Tornado/Hurricane":Ot,CONTAMINATION:Wn,CREDITCARD:Yn,DAMAGETOPROPERTYOFOTHERS:St,DOGBITELIABILITY:go,EARTHMOVEMENT:K,EARTHQUAKE:K,EXTENDEDCOVERAGEPERILS:$t,FIRE:Be,FLOOD:In,FREEZINGWATERINCLUDINGBURSTPIPES:Zo,HAIL:Un,HURRICANE:Ot,LIABILITYALLOTHER:ve,LIGHTNING:Kn,MEDICALPAYMENTS:Qn,MYSTERIOUSDISAPPEARANCE:ve,MYSTERIOUSDISAPPEARANCESCHEDULEDPROPERTY:ve,PHYSICALDAMAGEALLOTHER:Pt,SINKHOLE:K,SLIPFALLLIABILITY:et,SMOKE:Be,THEFTSCHEDULEDPROPERTY:Et,THEFTBURGLARY:Et,TORNADO:Ot,VANDALISMMALICIOUSMISCHIEF:Pt,WATERDAMAGE:fo,WIND:tr,WORKERSCOMPENSATION:Mo,ALLOTHER:ve},fallback:ve}},ku={Yes:qr,No:Ur},Ds=e=>bu[xu[e]??e],ln=(e,t)=>{let r=Ds(e);if(r)return r.byToken[t]??r.fallback},Fe="cds-relative cds-flex cds-items-center cds-justify-center cds-rounded-xl cds-border-2 cds-transition-colors disabled:cds-cursor-not-allowed",De="cds-border-accent cds-bg-accent/10 cds-text-fg",Le="cds-border-border-strong cds-bg-surface-elevated cds-text-fg-muted hover:cds-border-accent/60",Xe="cds-border-destructive",Qe=()=>n.jsx("span",{"aria-hidden":"true",className:"cds-absolute cds-right-1.5 cds-top-1.5 cds-flex cds-h-5 cds-w-5 cds-items-center cds-justify-center cds-rounded-full cds-bg-accent cds-text-xs cds-font-bold cds-text-accent-foreground",children:"✓"}),Ze=(e,t,r)=>{let s=g.useRef([]),a=g.useRef(null);g.useEffect(()=>{a.current!==null&&(s.current[a.current]?.focus(),a.current=null)},[t]);let o=e.findIndex(i=>i.value===t);return{tabStop:o>=0?o:0,onKeyDown:g.useCallback(i=>{let c=i.key==="ArrowRight"||i.key==="ArrowDown"?1:i.key==="ArrowLeft"||i.key==="ArrowUp"?-1:0;if(!c||e.length===0)return;i.preventDefault();let l=e.findIndex(d=>d.value===t),f=(l<0?0:l+c+e.length)%e.length,v=e[f];v&&(a.current=f,r(v.value))},[e,t,r]),register:g.useCallback(i=>c=>{s.current[i]=c},[])}},dn=({glyph:e,className:t})=>n.jsx("span",{"aria-hidden":"true",className:t??"cds-h-10 cds-w-10 cds-text-fg",children:n.jsx(e,{className:"cds-h-full cds-w-full"})}),wu=({fieldKey:e,label:t,options:r,value:s,invalid:a,describedBy:o,onChange:i})=>{let{tabStop:c,onKeyDown:l,register:f}=Ze(r,s,i),v=r.length<=4?"cds-grid-cols-2 sm:cds-grid-cols-4":"cds-grid-cols-2 sm:cds-grid-cols-3 md:cds-grid-cols-4";return n.jsx("div",{role:"radiogroup","aria-label":t,"aria-invalid":a||void 0,"aria-describedby":o,className:`cds-grid cds-gap-2 ${v}`,onKeyDown:l,children:r.map((d,h)=>{let u=d.value===s,p=ln(e,d.value);return n.jsxs("button",{ref:f(h),type:"button",role:"radio","aria-checked":u,tabIndex:h===c?0:-1,onClick:()=>i(d.value),className:`${Fe} cds-flex-col cds-gap-1 cds-p-3 cds-text-center cds-text-xs cds-font-medium ${V} ${u?De:`${Le} ${a?Xe:""}`}`,children:[u?n.jsx(Qe,{}):null,p?n.jsx(dn,{glyph:p}):null,n.jsx("span",{children:d.label})]},d.value)})})},ju=({label:e,options:t,value:r,invalid:s,describedBy:a,onChange:o})=>{let{tabStop:i,onKeyDown:c,register:l}=Ze(t,r,o);return n.jsx("div",{role:"radiogroup","aria-label":e,"aria-invalid":s||void 0,"aria-describedby":a,className:"cds-grid cds-grid-cols-2 cds-gap-2",onKeyDown:c,children:t.map((f,v)=>{let d=f.value===r,h=ku[f.value];return n.jsxs("button",{ref:l(v),type:"button",role:"radio","aria-checked":d,tabIndex:v===i?0:-1,onClick:()=>o(f.value),className:`${Fe} cds-gap-2 cds-px-4 cds-py-3 cds-text-sm cds-font-semibold ${V} ${d?De:`${Le} ${s?Xe:""}`}`,children:[h?n.jsx(h,{"aria-hidden":"true",className:`cds-h-5 cds-w-5 ${d?"cds-text-accent":"cds-text-fg-muted"}`}):null,n.jsx("span",{children:f.label})]},f.value)})})},_u={tort_threshold:{Verbal_Threshold:"Lower premium. You can sue for pain and suffering only if your injury is serious, as NJ law defines it.",Zero_Threshold:"Higher premium. You keep the full right to sue for pain and suffering."},pip_coverage_type:{Primary:"Your auto policy pays your medical bills first.",Secondary:"Your health plan pays first and auto covers what it does not. Needs eligible health coverage."}},Mu=({fieldKey:e,label:t,options:r,value:s,invalid:a,describedBy:o,onChange:i})=>{let{tabStop:c,onKeyDown:l,register:f}=Ze(r,s,i),v=_u[e];return n.jsx("div",{role:"radiogroup","aria-label":t,"aria-invalid":a||void 0,"aria-describedby":o,className:`cds-grid cds-gap-2 ${r.length===2?"sm:cds-grid-cols-2":"sm:cds-grid-cols-3"}`,onKeyDown:l,children:r.map((d,h)=>{let u=d.value===s,p=v?.[d.value];return n.jsxs("button",{ref:f(h),type:"button",role:"radio","aria-checked":u,tabIndex:h===c?0:-1,onClick:()=>i(d.value),className:`${Fe} cds-flex-col cds-gap-1 cds-px-4 cds-py-3 ${V} ${u?De:`${Le} ${a?Xe:""}`}`,children:[u?n.jsx(Qe,{}):null,n.jsx("span",{className:"cds-w-full cds-pr-6 cds-text-left cds-text-sm cds-font-bold cds-text-fg",children:d.label}),p?n.jsx("span",{className:"cds-w-full cds-text-left cds-text-[11px] cds-font-normal cds-leading-snug cds-text-fg-muted",children:p}):null]},d.value)})})},Cu=({id:e,fieldKey:t,label:r,options:s,value:a,invalid:o,describedBy:i,onChange:c})=>{let[l,f]=g.useState(!1),[v,d]=g.useState(""),h=g.useMemo(()=>{let m=v.trim().toLowerCase();return m?s.filter(y=>y.label.toLowerCase().includes(m)):s},[s,v]),u=s.find(m=>m.value===a),p=u?ln(t,u.value):void 0;return n.jsxs(An,{open:l,onOpenChange:m=>{f(m),m||d("")},children:[n.jsx($n,{asChild:!0,children:n.jsxs("button",{type:"button",id:e,"aria-label":r,"aria-invalid":o||void 0,"aria-describedby":i,className:`${F} cds-flex cds-items-center cds-justify-between cds-gap-2 cds-text-left ${o?"cds-border-destructive":""} ${V}`,children:[n.jsxs("span",{className:"cds-flex cds-min-w-0 cds-items-center cds-gap-2",children:[p?n.jsx(dn,{glyph:p,className:"cds-h-6 cds-w-6 cds-shrink-0 cds-text-fg"}):null,n.jsx("span",{className:`cds-truncate ${u?"cds-text-fg":"cds-text-fg-muted"}`,children:u?u.label:"Select…"})]}),n.jsx(Wr,{"aria-hidden":"true",className:"cds-h-4 cds-w-4 cds-shrink-0 cds-text-fg-muted"})]})}),n.jsxs(Mt,{className:"cds-w-[min(30rem,calc(100vw-2rem))] cds-p-0",align:"start",children:[n.jsxs("div",{className:"cds-relative cds-border-b cds-border-border cds-p-2",children:[n.jsx(Ko,{"aria-hidden":"true",className:"cds-pointer-events-none cds-absolute cds-left-4 cds-top-1/2 cds-h-4 cds-w-4 -cds-translate-y-1/2 cds-text-fg-muted"}),n.jsx("input",{autoFocus:!0,type:"text",value:v,onChange:m=>d(m.target.value),placeholder:"Type to search…","aria-label":`Search ${r}`,className:`${F} cds-pl-9`})]}),h.length===0?n.jsx("p",{className:"cds-px-3 cds-py-6 cds-text-center cds-text-sm cds-text-fg-muted",children:"No matches"}):n.jsx("div",{role:"radiogroup","aria-label":r,className:"cds-grid cds-max-h-72 cds-grid-cols-2 cds-gap-2 cds-overflow-y-auto cds-p-2 sm:cds-grid-cols-3",children:h.map(m=>{let y=m.value===a,x=ln(t,m.value);return n.jsxs("button",{type:"button",role:"radio","aria-checked":y,onClick:()=>{c(m.value),f(!1),d("")},className:`${Fe} cds-flex-col cds-gap-1 cds-p-2.5 cds-text-center cds-text-xs cds-font-medium ${V} ${y?De:Le}`,children:[y?n.jsx(Qe,{}):null,x?n.jsx(dn,{glyph:x,className:"cds-h-8 cds-w-8 cds-text-fg"}):null,n.jsx("span",{className:"cds-leading-tight",children:m.label})]},m.value)})})]})]})},Ls=new Set(["Dontknow","Reject","None","NoCoverage","No_Coverage","NotAvailable"]),Su={personal_liability:"per occurrence",dwelling_medical_payments:"per person",policy_pd:"per accident",policy_mp:"per person",policy_umpd:"per accident",policy_pip:"per person",policy_auto_death_indemnity:"per person",policy_pip_deductible:"you pay per claim",extended_medical:"per person",vehicle_comp_deductible:"you pay per claim",vehicle_coll_deductible:"you pay per claim",vehicle_towing_and_labor:"per disablement",windstorm_deductible:"of your dwelling coverage"},Eu=new Set(["policy_pd","policy_mp","policy_umpd","policy_pip","policy_auto_death_indemnity","vehicle_comp_deductible","vehicle_coll_deductible","vehicle_towing_and_labor"]),Nu=/^([\d,]+)\s*\/\s*([\d,]+)$/,Pu=/^([\d,]+)\s*CSL$/i,Zt=e=>`$${e}${e.includes(",")?"":",000"}`,Au=(e,t)=>{let r=Nu.exec(t);if(r)return e==="vehicle_transportation_expense"?`$${r[1]??""}/day, up to $${r[2]??""}`:`${Zt(r[1]??"")} per person · ${Zt(r[2]??"")} per accident`;let s=Pu.exec(t);return s?`${Zt(s[1]??"")} combined single limit`:Su[e]},$u=(e,t)=>Ls.has(t.value)||!Eu.has(e)?t.label:/^[\d,]+$/.test(t.label)?`$${t.label}`:t.label,Rn=({fieldKey:e,label:t,options:r,value:s,invalid:a,describedBy:o,detailFor:i,onChange:c})=>{let{tabStop:l,onKeyDown:f,register:v}=Ze(r,s,c);return n.jsx("div",{role:"radiogroup","aria-label":t,"aria-invalid":a||void 0,"aria-describedby":o,className:"cds-grid cds-grid-cols-2 cds-gap-2 sm:cds-grid-cols-3",onKeyDown:f,children:r.map((d,h)=>{let u=d.value===s,p=Ls.has(d.value),m=p?void 0:i?.(d)??Au(e,d.label);return n.jsxs("button",{ref:v(h),type:"button",role:"radio","aria-checked":u,tabIndex:h===l?0:-1,onClick:()=>c(d.value),className:`${Fe} cds-flex-col cds-gap-0.5 cds-px-3 cds-py-2.5 cds-text-center ${V} ${u?De:`${Le} ${a?Xe:""}`} ${p&&!u?"cds-border-dashed":""}`,children:[u?n.jsx(Qe,{}):null,n.jsx("span",{className:p?"cds-text-sm cds-font-semibold cds-text-fg-muted":"cds-text-base cds-font-bold cds-text-fg",children:$u(e,d)}),m?n.jsx("span",{className:"cds-text-[11px] cds-font-normal cds-leading-tight cds-text-fg-muted",children:m}):null]},d.value)})})},ke=e=>String(e??"").replace(/\D/g,""),Ru=({id:e,label:t,value:r,config:s,invalid:a,describedBy:o,onChange:i})=>{let c=ke(r),l=c===""?null:Number(c),f=g.useRef(!1);g.useEffect(()=>{f.current||(f.current=!0,l===null&&i(s.min))},[l,s.min,i]);let v=h=>{if(l===null){i(s.min);return}i(Math.min(s.max,Math.max(s.min,l+h)))},d=`cds-flex cds-h-11 cds-w-11 cds-shrink-0 cds-items-center cds-justify-center cds-rounded-lg cds-border-2 cds-border-border-strong cds-bg-surface-elevated cds-text-fg cds-transition-colors hover:cds-border-accent hover:cds-bg-highlight disabled:cds-cursor-not-allowed disabled:cds-opacity-40 disabled:hover:cds-border-border-strong disabled:hover:cds-bg-surface-elevated ${V}`;return n.jsxs("div",{className:"cds-flex cds-items-center cds-gap-3",children:[n.jsx("button",{type:"button",onClick:()=>v(-1),disabled:l!==null&&l<=s.min,"aria-label":`Decrease ${t}`,className:d,children:n.jsx(Lo,{"aria-hidden":"true",className:"cds-h-5 cds-w-5"})}),n.jsx("input",{id:e,type:"text",inputMode:"numeric","aria-label":t,"aria-invalid":a||void 0,"aria-describedby":o,value:c,onFocus:h=>h.target.select(),onChange:h=>{let u=ke(h.target.value);i(u===""?"":Number(u))},className:`cds-h-11 cds-w-full cds-min-w-0 cds-rounded-lg cds-border-2 cds-bg-surface-elevated cds-text-center cds-text-lg cds-font-bold cds-text-fg focus:cds-border-primary focus:cds-outline-none focus:cds-ring-2 focus:cds-ring-ring/40 ${a?"cds-border-destructive":"cds-border-border-strong"}`}),n.jsx("button",{type:"button",onClick:()=>v(1),disabled:l!==null&&l>=s.max,"aria-label":`Increase ${t}`,className:d,children:n.jsx(Kr,{"aria-hidden":"true",className:"cds-h-5 cds-w-5"})})]})},Ou=200,Tu="cds-h-3 cds-w-full cds-cursor-pointer cds-appearance-none cds-rounded-full focus-visible:cds-outline-none focus-visible:cds-ring-2 focus-visible:cds-ring-ring focus-visible:cds-ring-offset-2 [&::-webkit-slider-thumb]:cds-h-7 [&::-webkit-slider-thumb]:cds-w-7 [&::-webkit-slider-thumb]:cds-appearance-none [&::-webkit-slider-thumb]:cds-rounded-full [&::-webkit-slider-thumb]:cds-border-4 [&::-webkit-slider-thumb]:cds-border-solid [&::-webkit-slider-thumb]:cds-border-surface-elevated [&::-webkit-slider-thumb]:cds-bg-accent [&::-webkit-slider-thumb]:cds-shadow-md [&::-webkit-slider-thumb]:cds-cursor-grab [&::-webkit-slider-thumb]:active:cds-cursor-grabbing [&::-moz-range-thumb]:cds-h-7 [&::-moz-range-thumb]:cds-w-7 [&::-moz-range-thumb]:cds-rounded-full [&::-moz-range-thumb]:cds-border-4 [&::-moz-range-thumb]:cds-border-solid [&::-moz-range-thumb]:cds-border-surface-elevated [&::-moz-range-thumb]:cds-bg-accent [&::-moz-range-thumb]:cds-shadow-md [&::-moz-range-thumb]:cds-cursor-grab",Is=(e,t)=>t?e.toLocaleString("en-US"):String(e),Tr=(e,{currency:t,grouped:r=!0,unit:s})=>{let a=Is(e,r);return t?`$${a}`:s?`${a} ${s}`:a},Vs=({id:e,label:t,value:r,config:s,invalid:a,describedBy:o,onChange:i})=>{let[c,l]=g.useState(()=>ke(r)),f=g.useRef(!1),v=g.useRef(void 0);g.useEffect(()=>()=>clearTimeout(v.current),[]),g.useEffect(()=>{f.current||l(ke(r))},[r]);let d=g.useRef(!1);g.useEffect(()=>{d.current||(d.current=!0,!(s.openBlank||ke(r)!=="")&&i(s.min))},[s.openBlank,s.min,i,r]);let h=x=>{l(x),f.current=!0,clearTimeout(v.current),v.current=setTimeout(()=>{f.current=!1,i(x===""?"":Number(x))},Ou)},u=c===""?s.min:Number(c),p=Math.min(s.max,Math.max(s.min,u)),m=(p-s.min)/(s.max-s.min)*100,y=!s.hardMax&&u<=s.max;return n.jsxs("div",{children:[n.jsx("div",{className:"cds-mb-2 cds-flex cds-justify-center",children:n.jsxs("div",{className:"cds-relative",children:[s.currency?n.jsx("span",{"aria-hidden":"true",className:`cds-absolute cds-left-3 cds-top-1/2 -cds-translate-y-1/2 cds-font-extrabold cds-text-fg ${s.lead?"cds-text-2xl":"cds-text-xl"}`,children:"$"}):null,n.jsx("input",{id:e,type:"text",inputMode:"numeric","aria-label":t,"aria-invalid":a||void 0,"aria-describedby":o,value:c===""?"":Is(u,s.grouped??!0),onFocus:x=>x.target.select(),onChange:x=>h(ke(x.target.value).slice(0,9)),className:`cds-rounded-lg cds-border-2 cds-bg-surface-elevated cds-py-2 cds-pr-3 cds-text-center cds-font-extrabold cds-text-fg focus:cds-border-primary focus:cds-outline-none focus:cds-ring-2 focus:cds-ring-ring/40 ${s.lead?"cds-w-48 cds-text-2xl":"cds-w-44 cds-text-xl"} ${s.currency?"cds-pl-8":"cds-pl-3"} ${a?"cds-border-destructive":"cds-border-border-strong"}`}),s.unit&&!s.currency?n.jsx("span",{"aria-hidden":"true",className:"cds-absolute cds-right-3 cds-top-1/2 -cds-translate-y-1/2 cds-text-xs cds-font-semibold cds-text-fg-muted",children:s.unit}):null]})}),n.jsx("input",{type:"range","aria-label":`${t} slider`,min:s.min,max:s.max,step:s.step,value:p,"aria-describedby":o,onChange:x=>h(x.target.value),className:Tu,style:{background:`linear-gradient(to right, hsl(var(--cds-accent)) ${m}%, hsl(var(--cds-border)) ${m}%)`}}),n.jsxs("div",{className:"cds-flex cds-justify-between cds-text-xs cds-text-fg-muted",children:[n.jsx("span",{children:Tr(s.min,s)}),n.jsxs("span",{children:[Tr(s.max,s),y?"+":""]})]})]})},we=[{label:"Before 1940",from:1800,to:1939},{label:"1940s–50s",from:1940,to:1959},{label:"1960s–70s",from:1960,to:1979},{label:"1980s–90s",from:1980,to:1999},{label:"2000s",from:2e3,to:2009},{label:"2010 or newer",from:2010,to:new Date().getFullYear()}],Fu=e=>{if(!Number.isFinite(e)||e<=0)return-1;let t=we.findIndex(s=>e>=s.from&&e<=s.to);if(t>=0)return t;let r=we[0];return r&&e<r.from?0:we.length-1},Du=({id:e,label:t,value:r,invalid:s,describedBy:a,onChange:o})=>{let i=Number(ke(r)),c=Fu(i),l=g.useMemo(()=>we.map((p,m)=>({value:String(m),label:p.label})),[]),f=p=>{let m=we[p];m&&!(i>=m.from&&i<=m.to)&&o(m.to)},{tabStop:v,onKeyDown:d,register:h}=Ze(l,c>=0?String(c):"",p=>f(Number(p))),u=c>=0?we[c]:void 0;return n.jsxs("div",{children:[n.jsx("div",{role:"radiogroup","aria-label":`${t} — period`,"aria-invalid":s||void 0,"aria-describedby":a,className:"cds-grid cds-grid-cols-2 cds-gap-2 sm:cds-grid-cols-3",onKeyDown:d,children:we.map((p,m)=>{let y=m===c;return n.jsxs("button",{ref:h(m),type:"button",role:"radio","aria-checked":y,tabIndex:m===v?0:-1,onClick:()=>f(m),className:`${Fe} cds-px-2 cds-py-2.5 cds-text-center cds-text-xs cds-font-semibold ${V} ${y?De:`${Le} ${s?Xe:""}`}`,children:[y?n.jsx(Qe,{}):null,n.jsx("span",{children:p.label})]},p.label)})}),u?n.jsx("div",{className:"cds-mt-3",children:n.jsx(Vs,{id:e,label:t,value:r,config:{min:u.from,max:u.to,step:1,currency:!1,grouped:!1,hardMax:!0},invalid:s,describedBy:a,onChange:o})}):null]})},Lu=12,Iu=new Date().getFullYear(),Vu=new Set(["personal_liability","dwelling_medical_payments","windstorm_deductible","all_perils_deductible","auto_prior_liability_limit","policy_bi","policy_um","policy_pd","policy_mp","policy_umpd","policy_pip","policy_auto_death_indemnity","policy_pip_deductible","extended_medical","vehicle_comp_deductible","vehicle_coll_deductible","vehicle_towing_and_labor","vehicle_transportation_expense"]),Bu=new Set(["tort_threshold","pip_coverage_type"]),ct={min:1900,max:Iu,step:1,currency:!1,grouped:!1,hardMax:!0,minFromKey:"year_built",openBlank:!0},Hu={dwelling_replacement_cost:{min:1e5,max:2e6,step:5e3,currency:!0,lead:!0,openBlank:!0},total_area_sq_ft:{min:500,max:6e3,step:50,currency:!1,unit:"sq ft"},annual_mileage:{min:1e3,max:5e4,step:500,currency:!1,unit:"mi/yr"},miles_to_work:{min:1,max:100,step:1,currency:!1,unit:"mi"},year_roof_updated:ct,heating_update_year:ct,plumbing_update_year:ct,electrical_update_year:ct},zu={household_size:{min:1,max:8},number_of_dogs:{min:0,max:99},number_of_units:{min:1,max:99},number_of_families:{min:1,max:5},number_of_units_in_firewall:{min:0,max:99},number_of_mortgagees:{min:0,max:3},number_of_parking_spaces:{min:1,max:3},years_at_address:{min:0,max:100},months_at_address:{min:0,max:11},years_at_prior_address:{min:0,max:100},auto_prior_years:{min:0,max:99},auto_prior_months:{min:0,max:11},auto_continuous_coverage_years:{min:0,max:99},home_prior_years:{min:0,max:99},home_continuous_coverage_years:{min:0,max:99}},Wu=new Set(["social_security_number","vin","date_of_birth","co_applicant_date_of_birth","additional_pip"]),qu=e=>e.length===2&&e.every(t=>t.value==="Yes"||t.value==="No"),Uu=(e,t,r=!1)=>{let s=e.key;if(!Wu.has(s)){if(e.inputType==="number"){let a=Hu[s];if(a)return{kind:"slider",config:a};let o=zu[s];return o?{kind:"stepper",config:o}:s==="year_built"?{kind:"eraYear"}:void 0}if((e.inputType==="select"||e.inputType==="radio")&&!(r||t.length===0)){if(Vu.has(s))return{kind:"amountCards"};if(Bu.has(s))return{kind:"choiceCards"};if(qu(t))return{kind:"yesNo"};if(Ds(s))return t.length>Lu?{kind:"illustrated"}:{kind:"iconCards"}}}},Fr=e=>{let t=String(e??"").replace(/\D/g,"");if(!t)return;let r=Number(t);return Number.isFinite(r)?r:void 0},Ku=(e,t)=>{let r=e.minFromKey?Fr(t[e.minFromKey]):void 0,s=e.maxFromKey?Fr(t[e.maxFromKey]):void 0,a=r!==void 0&&r>=1800?r:e.min,o=s!==void 0&&s>0?s:e.max;return o-a<e.step?e:{...e,min:a,max:o}},Yu=({spec:e,id:t,question:r,options:s,value:a,values:o,invalid:i,describedBy:c,onChange:l,label:f})=>{let v=f??r.question,d=a==null?"":String(a),h={fieldKey:r.key,label:v,options:s,value:d,invalid:i,describedBy:c,onChange:l};switch(e.kind){case"iconCards":return n.jsx(wu,{...h});case"yesNo":return n.jsx(ju,{...h});case"illustrated":return n.jsx(Cu,{id:t,...h});case"amountCards":return n.jsx(Rn,{...h});case"choiceCards":return n.jsx(Mu,{...h});case"stepper":return n.jsx(Ru,{id:t,label:v,value:a,config:e.config,invalid:i,describedBy:c,onChange:l});case"slider":return n.jsx(Vs,{id:t,label:v,value:a,config:Ku(e.config,o),invalid:i,describedBy:c,onChange:l});case"eraYear":return n.jsx(Du,{id:t,label:v,value:a,invalid:i,describedBy:c,onChange:l});default:return null}},Gu=25,Bs="cds-mt-1 cds-text-xs cds-font-medium cds-text-destructive",gt=({id:e,message:t})=>t?n.jsx("p",{id:e,className:Bs,role:"alert",children:t}):null,Xu=({id:e,label:t,value:r,options:s,invalid:a,describedBy:o,onChange:i,onOpen:c})=>{let[l,f]=g.useState(!1),[v,d]=g.useState(""),h=g.useMemo(()=>{let p=v.trim().toLowerCase();return p?s.filter(m=>m.label.toLowerCase().includes(p)).slice(0,200):s.slice(0,200)},[s,v]),u=s.find(p=>p.value===r);return n.jsxs(An,{open:l,onOpenChange:p=>{f(p),p?c?.():d("")},children:[n.jsx($n,{asChild:!0,children:n.jsxs("button",{type:"button",id:e,"aria-label":t,"aria-invalid":a||void 0,"aria-describedby":o,className:`${F} cds-flex cds-items-center cds-justify-between cds-text-left ${a?"cds-border-destructive":""} ${V}`,children:[n.jsx("span",{className:u?"cds-text-fg":"cds-text-fg-muted",children:u?u.label:"Select…"}),n.jsx(Wr,{"aria-hidden":"true",className:"cds-h-4 cds-w-4 cds-shrink-0 cds-text-fg-muted"})]})}),n.jsxs(Mt,{className:"cds-w-[min(28rem,calc(100vw-2rem))] cds-p-0",align:"start",children:[n.jsx("div",{className:"cds-border-b cds-border-border cds-p-2",children:n.jsx("input",{autoFocus:!0,type:"text",value:v,onChange:p=>d(p.target.value),placeholder:"Type to search…","aria-label":`Search ${t}`,className:F})}),n.jsx("ul",{className:"cds-max-h-64 cds-overflow-y-auto cds-py-1",role:"listbox","aria-label":t,children:h.length===0?n.jsx("li",{className:"cds-px-3 cds-py-2 cds-text-sm cds-text-fg-muted",children:"No matches"}):h.map(p=>n.jsx("li",{children:n.jsx("button",{type:"button",role:"option","aria-selected":p.value===r,onClick:()=>{i(p.value),f(!1),d("")},className:`cds-block cds-w-full cds-px-3 cds-py-2 cds-text-left cds-text-sm hover:cds-bg-highlight ${p.value===r?"cds-bg-highlight cds-font-semibold cds-text-fg":"cds-text-fg"}`,children:p.label})},p.value))})]})]})},Qu=({id:e,label:t,value:r,options:s,invalid:a,describedBy:o,onChange:i,onOpen:c})=>n.jsxs("select",{id:e,value:r,"aria-label":t,"aria-invalid":a||void 0,"aria-describedby":o,onFocus:c,onChange:l=>i(l.target.value),className:`${F} ${a?"cds-border-destructive":""}`,children:[n.jsx("option",{value:"",children:"Select…"}),s.map(l=>n.jsx("option",{value:l.value,children:l.label},l.value))]}),Zu=({label:e,value:t,options:r,invalid:s,describedBy:a,onChange:o})=>n.jsx("div",{role:"radiogroup","aria-label":e,"aria-invalid":s||void 0,"aria-describedby":a,className:"cds-flex cds-flex-wrap cds-gap-2",children:r.map(i=>{let c=i.value===t;return n.jsx("button",{type:"button",role:"radio","aria-checked":c,onClick:()=>o(i.value),className:`cds-min-w-[5.5rem] cds-flex-1 cds-rounded-lg cds-border cds-px-4 cds-py-2.5 cds-text-sm cds-font-semibold cds-transition-colors ${V} ${c?"cds-border-accent cds-bg-highlight cds-text-fg":`border-gray-400 bg-white text-gray-700 hover:border-brand-accent/60 ${s?"cds-border-destructive":""}`}`,children:i.label},i.value)})}),Ju=(e,t)=>{if(e.key==="occupation"||e.key==="co_applicant_occupation"){let r=e.key==="occupation"?t.industry??t.employment_industry:t.co_applicant_employment_industry,s=oa(r);return s?s.map(a=>({value:a,label:ia(a)})):[]}return ca(e.key,e.options)},Dr={dwelling_replacement_cost:"Cost to rebuild your home",all_perils_deductible:"Deductible"},Jt={dwelling_replacement_cost:"We start you off at your purchase price. Adjust it to what rebuilding would cost today — not the market value, and not necessarily what you paid. Higher-value home? Type the amount directly.",all_perils_deductible:"What you pay out of pocket on a claim before insurance kicks in.",additional_pip:"Extra cover for lost income and essential services after an injury. Pick the weekly benefit, and whether what it pays in total is capped."},eh=e=>`$${e.toLocaleString("en-US")}`,th=e=>String(e??"").replace(/\D/g,""),Lr=e=>e.endsWith("Percent"),nh={OnePercent:1,TwoPercent:2,ThreePercent:3,FourPercent:4,FivePercent:5},rh="OneThousand",sh="OnePercent",ah=({label:e,value:t,options:r,dwelling:s,hint:a,error:o,onChange:i})=>{let c=`deductible-${g.useId()}`,l=a?`${c}-hint`:void 0,f=o?`${c}-error`:void 0,v=Lr(t),d=Number(th(s)),h=r.filter(m=>Lr(m.value)===v),u=m=>{let y=nh[m.value];return!v||!y||!d?void 0:`of coverage (about ${eh(Math.round(d*y/100/500)*500)})`},p=m=>`px-3 py-1.5 transition-colors ${m?"cds-bg-primary cds-text-primary-foreground":"cds-bg-surface-elevated cds-text-fg-muted hover:cds-bg-surface-muted"} ${V}`;return n.jsxs("div",{className:"cds-mb-4",children:[n.jsxs("div",{className:"cds-mb-1 cds-flex cds-items-center cds-justify-between",children:[n.jsx("span",{className:"cds-text-sm cds-font-semibold cds-text-fg",children:e}),n.jsxs("div",{role:"group","aria-label":"Deductible type",className:"cds-flex cds-overflow-hidden cds-rounded-lg cds-border cds-border-input cds-text-xs cds-font-semibold",children:[n.jsx("button",{type:"button","aria-pressed":!v,onClick:()=>v&&i(rh),className:p(!v),children:"Dollar amount"}),n.jsx("button",{type:"button","aria-pressed":v,onClick:()=>!v&&i(sh),className:p(v),children:"% of coverage"})]})]}),n.jsx(Rn,{fieldKey:"all_perils_deductible",label:typeof e=="string"?e:"Deductible",value:t,options:h,invalid:!!o,describedBy:[l,f].filter(Boolean).join(" ")||void 0,detailFor:u,onChange:i}),a?n.jsx("p",{id:l,className:"cds-mt-1.5 cds-text-xs cds-text-fg-muted",children:a}):null,n.jsx(gt,{id:f??"",message:o})]})},oh=/^cov(\d+)(?:_(\d+))?_(LIMITED|UNLIMITED)$/,He=e=>{let t=oh.exec(e);if(t)return{weekly:t[1]??"",aggregate:t[2],capped:t[3]==="LIMITED"}},ih=({label:e,name:t,value:r,options:s,hint:a,error:o,onChange:i})=>{let c=`additional-pip-${g.useId()}`,l=a?`${c}-hint`:void 0,f=o?`${c}-error`:void 0,v=He(r),d=!v||v.capped,h=s.flatMap(y=>{let x=He(y.value);return!x||x.capped!==d?[]:[{value:y.value,label:`$${x.weekly}/wk`}]}),u=y=>{let x=He(y.value);if(x)return x.aggregate?`up to $${Number(x.aggregate).toLocaleString("en-US")} in total`:"no cap on the total"},p=y=>{if(y===d)return;let x=s.find(w=>{let j=He(w.value);return j?.capped===y&&j.weekly===v?.weekly}),b=s.find(w=>He(w.value)?.capped===y),k=x??b;k&&i(k.value)},m=y=>`px-3 py-1.5 transition-colors ${y?"cds-bg-primary cds-text-primary-foreground":"cds-bg-surface-elevated cds-text-fg-muted hover:cds-bg-surface-muted"} ${V}`;return n.jsxs("div",{className:"cds-mb-4",children:[n.jsxs("div",{className:"cds-mb-1 cds-flex cds-items-center cds-justify-between cds-gap-2",children:[n.jsx("span",{className:"cds-text-sm cds-font-semibold cds-text-fg",children:e}),n.jsxs("div",{role:"group","aria-label":"Total benefit",className:"cds-flex cds-shrink-0 cds-overflow-hidden cds-rounded-lg cds-border cds-border-input cds-text-xs cds-font-semibold",children:[n.jsx("button",{type:"button","aria-pressed":d,onClick:()=>p(!0),className:m(d),children:"Capped total"}),n.jsx("button",{type:"button","aria-pressed":!d,onClick:()=>p(!1),className:m(!d),children:"Unlimited total"})]})]}),n.jsx(Rn,{fieldKey:"additional_pip",label:t,value:r,options:h,invalid:!!o,describedBy:[l,f].filter(Boolean).join(" ")||void 0,detailFor:u,onChange:i}),a?n.jsx("p",{id:l,className:"cds-mt-1.5 cds-text-xs cds-text-fg-muted",children:a}):null,n.jsx(gt,{id:f??"",message:o})]})},Hs=({question:e,value:t,error:r,values:s,onChange:a,asyncSelect:o,vinDecode:i,required:c})=>{let l=g.useId(),f=`q-${e.key}-${l}`,v=r?`${f}-error`:void 0,d=e.hint?`${f}-hint`:void 0,h=i?.error?`${f}-vin-error`:void 0,u=[d,v,h].filter(Boolean).join(" ")||void 0,p=Dr[e.key]??e.question,m=n.jsxs(n.Fragment,{children:[p,c?null:n.jsx("span",{className:"cds-ml-1 cds-font-normal cds-text-fg-muted",children:"(optional)"})]}),y=t==null?"":String(t),x=g.useMemo(()=>{let _=o?.options??Ju(e,s);return!o||!y||_.some(M=>M.value===y)?_:[{value:y,label:y},..._]},[o,e,s,y]);if(e.inputType==="checkbox")return n.jsxs("div",{className:"cds-mb-2",children:[n.jsx(md,{label:e.question,checked:t===!0,onChange:_=>a(_)}),n.jsx(gt,{id:v??"",message:r})]});if(e.key==="all_perils_deductible")return n.jsx(ah,{label:Dr.all_perils_deductible,value:y,options:x,dwelling:s.dwelling_replacement_cost,hint:Jt.all_perils_deductible,error:r,onChange:a});if(e.key==="additional_pip")return n.jsx(ih,{label:m,name:p,value:y,options:x,hint:Jt.additional_pip,error:r,onChange:a});let b=_=>{if(e.key==="social_security_number")return n.jsx("input",{id:_,type:"text",inputMode:"numeric",autoComplete:"off",maxLength:11,value:ua(y),"aria-invalid":!!r||void 0,"aria-describedby":u,onChange:C=>a(ha(fa(y,C.target.value))),placeholder:"XXX-XX-XXXX",className:`${F} ${r?"cds-border-destructive":""}`});if(e.key==="vin"&&i){let C=Ir(y);return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"cds-flex cds-items-start cds-gap-2",children:[n.jsx("input",{id:_,type:"text",value:y,maxLength:17,autoComplete:"off","aria-invalid":!!r||void 0,"aria-describedby":u,onChange:N=>a(N.target.value),className:`${F} ${r?"cds-border-destructive":""}`}),n.jsx("button",{type:"button",disabled:!C||i.loading,onClick:()=>i.run(y),className:`cds-shrink-0 cds-whitespace-nowrap cds-rounded-lg cds-border cds-border-accent cds-bg-surface-elevated cds-px-4 cds-py-2.5 cds-text-sm cds-font-bold cds-text-fg hover:cds-bg-highlight disabled:cds-cursor-not-allowed disabled:cds-opacity-50 disabled:hover:cds-bg-surface-elevated ${V}`,children:i.loading?"Looking up…":"Verify VIN"})]}),i.error?n.jsx("p",{id:h,className:Bs,role:"alert",children:i.error}):null]})}let M=Uu(e,x,!!o);if(M)return Yu({spec:M,id:_,question:e,options:x,value:t,values:s,invalid:!!r,describedBy:u,onChange:a,label:p});switch(e.inputType){case"radio":return n.jsx(Zu,{label:e.question,value:y,options:x,invalid:!!r,describedBy:u,onChange:a});case"select":return o?.loading&&!x.length?n.jsx("div",{className:`${F} cds-text-fg-muted`,"aria-live":"polite",children:"Loading options…"}):x.length?x.length>Gu?n.jsx(Xu,{id:_,label:e.question,value:y,options:x,invalid:!!r,describedBy:u,onChange:a,onOpen:o?.activate}):n.jsx(Qu,{id:_,label:e.question,value:y,options:x,invalid:!!r,describedBy:u,onChange:a,onOpen:o?.activate}):n.jsx("input",{id:_,type:"text",value:y,"aria-label":e.question,"aria-describedby":u,onFocus:o?.activate,onChange:C=>a(C.target.value),placeholder:"Type your answer",className:F});case"date":return e.key==="date_of_birth"||e.key==="co_applicant_date_of_birth"?n.jsx(ud,{id:_,hintId:u,value:y,onChange:C=>a(C)}):n.jsx("input",{id:_,type:"date",value:y,"aria-invalid":!!r||void 0,"aria-describedby":u,onChange:C=>a(C.target.value),className:`${F} ${r?"cds-border-destructive":""}`});case"number":{let C=La(e.key);return n.jsx("input",{id:_,type:"text",inputMode:"numeric",value:C?Ia(t,Va(e.key)):y,"aria-invalid":!!r||void 0,"aria-describedby":u,onChange:N=>{let A=N.target.value.replace(/[^\d]/g,"");a(A===""?"":Number(A))},className:`${F} ${r?"cds-border-destructive":""}`})}case"tel":return n.jsx("input",{id:_,type:"tel",inputMode:"tel",autoComplete:"tel",value:Ln(y),"aria-invalid":!!r||void 0,"aria-describedby":u,onChange:C=>a(Ln(C.target.value)),placeholder:"(512) 555-0134",className:`${F} ${r?"cds-border-destructive":""}`});case"email":return n.jsx("input",{id:_,type:"email",inputMode:"email",autoComplete:"email",value:y,"aria-invalid":!!r||void 0,"aria-describedby":u,onChange:C=>a(C.target.value),placeholder:"you@example.com",className:`${F} ${r?"cds-border-destructive":""}`});case"password":return n.jsx("input",{id:_,type:"password",autoComplete:"off",value:y,"aria-invalid":!!r||void 0,"aria-describedby":u,onChange:C=>a(C.target.value),className:`${F} ${r?"cds-border-destructive":""}`});case"textarea":return n.jsx("textarea",{id:_,rows:3,value:y,"aria-invalid":!!r||void 0,"aria-describedby":u,onChange:C=>a(C.target.value),className:`${F} ${r?"cds-border-destructive":""}`});default:return n.jsx("input",{id:_,type:"text",value:y,"aria-invalid":!!r||void 0,"aria-describedby":u,onChange:C=>a(C.target.value),className:`${F} ${r?"cds-border-destructive":""}`})}},k=Ua(e.key),w=Jt[e.key]??e.hint,j=e.key==="social_security_number"&&Ea(s)?[`${String(s.ssn_display).trim()}. Re-enter to update.`,w].filter(Boolean).join(" "):k===null?w:[w,`Typically ${k}% of your rebuild cost. Change it if needed.`].filter(Boolean).join(" ");return n.jsx(un,{label:m,hint:j,children:({id:_})=>n.jsxs(n.Fragment,{children:[b(_),n.jsx(gt,{id:v??"",message:r})]})})},Ih=ea({QuestionList:()=>kh}),ch={vehicles:{singular:"vehicle",plural:"Vehicles"},drivers:{singular:"driver",plural:"Drivers"},driver_accidents:{singular:"accident",plural:"Accidents"},driver_violations:{singular:"violation",plural:"Violations"},losses:{singular:"loss",plural:"Losses"},home_losses:{singular:"loss",plural:"Losses"}},lh=e=>ch[e]??{singular:"entry",plural:"Entries"},dh=[{heading:"Your current coverage",caption:"What you have today. Carriers rate on this history.",keys:new Set(["auto_prior_carrier_name","auto_prior_years","auto_prior_months","auto_continuous_coverage_years","auto_prior_expiration_date","auto_reason_for_no_insurance","auto_prior_liability_limit","auto_cancelled_declined_refused_to_renew"])},{heading:"Select your coverages",caption:"The limits on the policy you are quoting now.",keys:new Set(["policy_bi","policy_um","policy_pd","policy_mp","policy_umpd","policy_pip","policy_auto_death_indemnity","policy_pip_deductible","additional_pip","tort_threshold","pip_coverage_type","extended_medical"])},{heading:"Select your coverages for each vehicle",caption:"Deductibles and extras, per vehicle.",keys:new Set([Pa])}],uh=({heading:e,caption:t})=>n.jsxs("div",{className:"cds-mb-3 cds-mt-6 cds-border-t cds-border-border cds-pt-4 first:cds-mt-0 first:cds-border-t-0 first:cds-pt-0",children:[n.jsx("h3",{className:"cds-text-base cds-font-bold cds-text-fg",children:e}),n.jsx("p",{className:"cds-mt-0.5 cds-text-sm cds-text-fg-muted",children:t})]}),hh=e=>(e??[]).map(t=>({value:t,label:t})),fh=(e,t)=>{let[r,s]=g.useState({}),[a,o]=g.useState({}),i=g.useRef(new Set),c=g.useRef(Promise.resolve()),l=e.year?String(e.year):"",f=e.make?String(e.make):"",v=e.model?String(e.model):"",d=e.body_style?String(e.body_style):"",h=l?`make:${l}`:"",u=l&&f?`model:${l}|${f}`:"",p=l&&f&&v?`body:${l}|${f}|${v}`:"",m=g.useCallback((x,b,k)=>{!x||!t||i.current.has(x)||(i.current.add(x),o(w=>({...w,[x]:!0})),c.current=c.current.then(()=>la(b,t)).then(w=>{s(j=>({...j,[x]:hh(k(w))}))}).catch(()=>{s(w=>({...w,[x]:[]}))}).finally(()=>{o(w=>{let j={...w};return delete j[x],j})}))},[t]),y=g.useCallback(x=>{x==="make"?m(h,{year:l},b=>b.makes):x==="model"?m(u,{year:l,make:f},b=>b.models):m(p,{year:l,make:f,model:v},b=>b.bodyStyles)},[m,h,u,p,l,f,v]);return g.useEffect(()=>{l&&(f?v?d||y("body_style"):y("model"):y("make"))},[l,f,v,d,y]),{options:{make:r[h],model:r[u],body_style:r[p]},loading:{make:!!a[h],model:!!a[u],body_style:!!a[p]},ensure:y}},ph=(e,t)=>{let[r,s]=g.useState(!1),[a,o]=g.useState(void 0);return{run:g.useCallback(i=>{!e||r||!Ir(i)||(s(!0),o(void 0),da(i.trim().toUpperCase(),e).then(c=>{if(c.error){o(c.error);return}let l={};if(c.year&&(l.year=String(c.year)),c.make&&(l.make=c.make),c.model&&(l.model=c.model),c.bodyStyle&&(l.body_style=c.bodyStyle),!Object.keys(l).length){o("We couldn't read that VIN — please pick the vehicle details below.");return}t(l)}).catch(()=>o("VIN lookup failed — please pick the vehicle details below.")).finally(()=>s(!1)))},[e,r,t]),loading:r,error:a}},mh=(e,t,r,s)=>{let a=Ca(t,"drivers"),o=g.useCallback(i=>Br({kind:e,source:a[i]??{},targetQuestions:r}),[e,a,r]);return{candidates:g.useMemo(()=>za(t,{exclude:s}).filter(i=>Object.keys(o(i.index)).length>0),[t,o,s]),patchFor:o}},vh=({values:e,targetQuestions:t,onPatch:r})=>{let s=ya(e),{candidates:a,patchFor:o}=mh("coApplicant",e,t,g.useCallback((i,c)=>c===s,[s]));return a.length?n.jsx(Ha,{heading:"Is the co-applicant one of your drivers?",body:"We'll reuse their name, date of birth and details from the driver you entered.",applyLabel:"Use these details",candidates:a,onApply:i=>{let c=o(i);return r(c),Object.keys(c).length}}):null},gh=({entry:e,rootValues:t,targetQuestions:r,onPatch:s})=>{let a=g.useMemo(()=>Br({kind:"driverFromApplicant",source:t,targetQuestions:r}),[t,r]),o=Wa(t);return xa(t)||!ba(e)||!Object.keys(a).length?null:n.jsxs("button",{type:"button",onClick:()=>s(a),className:`cds-inline-flex cds-items-center cds-gap-1 cds-rounded cds-px-2 cds-py-1 cds-text-xs cds-font-semibold cds-text-fg hover:cds-bg-highlight ${V}`,children:[n.jsx(qa,{"aria-hidden":"true",className:"cds-h-3.5 cds-w-3.5"}),o?`This is me (${o})`:"This is me"]})},yh=({groupKey:e,itemQuestions:t,items:r,rootValues:s,stageKey:a,quoteId:o,itemErrors:i,onChange:c})=>{let{singular:l,plural:f}=lh(e),v=(h,u)=>{c(r.map((p,m)=>m===h?{...p,...u}:p))},d=h=>{c(r.filter((u,p)=>p!==h))};return n.jsxs("section",{className:"cds-mb-6 cds-rounded-xl cds-border cds-border-border cds-bg-surface-muted/60 cds-p-4",children:[n.jsx("h3",{className:"cds-mb-3 cds-text-sm cds-font-bold cds-uppercase cds-tracking-wide cds-text-fg",children:f}),r.map((h,u)=>n.jsx(xh,{index:u,singular:l,groupKey:e,item:h,itemQuestions:t,rootValues:s,stageKey:a,quoteId:o,errors:i.find(p=>p.index===u)?.errorsByKey??{},canRemove:r.length>1||e!=="drivers",onPatch:p=>v(u,p),onRemove:()=>d(u)},u)),n.jsxs("button",{type:"button",onClick:()=>c([...r,{}]),className:`cds-inline-flex cds-items-center cds-gap-1.5 cds-rounded-lg cds-border cds-border-accent cds-bg-surface-elevated cds-px-4 cds-py-2 cds-text-sm cds-font-bold cds-text-fg hover:cds-bg-highlight ${V}`,children:[n.jsx(Kr,{"aria-hidden":"true",className:"cds-h-4 cds-w-4"}),"Add ",r.length?`another ${l}`:l]})]})},xh=({index:e,singular:t,groupKey:r,item:s,itemQuestions:a,rootValues:o,stageKey:i,quoteId:c,errors:l,canRemove:f,onPatch:v,onRemove:d})=>{let h=r==="vehicles",u=fh(h?s:{},c),p=ph(c,v),m=g.useMemo(()=>Sa(a,s,o,i,e),[a,s,o,i,e]),y=g.useMemo(()=>new Set(m.map(x=>x.key)),[m]);return n.jsxs("div",{className:"cds-mb-4 cds-rounded-lg cds-border cds-border-border cds-bg-surface-elevated cds-p-4",children:[n.jsxs("div",{className:"cds-mb-3 cds-flex cds-items-center cds-justify-between",children:[n.jsxs("h4",{className:"cds-text-sm cds-font-bold cds-text-fg",children:[t.charAt(0).toUpperCase()+t.slice(1)," ",e+1]}),r==="drivers"&&e===0?n.jsx(gh,{entry:s,rootValues:o,targetQuestions:m,onPatch:v}):null,f?n.jsxs("button",{type:"button",onClick:d,className:`cds-inline-flex cds-items-center cds-gap-1 cds-rounded cds-px-2 cds-py-1 cds-text-xs cds-font-semibold cds-text-destructive hover:cds-bg-destructive/10 ${V}`,children:[n.jsx(oi,{"aria-hidden":"true",className:"cds-h-3.5 cds-w-3.5"}),"Remove"]}):null]}),n.jsx(zs,{questions:a,values:s,rootValues:o,visibleKeys:y,errors:l,itemErrors:[],stageKey:i,quoteId:c,cascade:h?u:void 0,vinDecode:h&&c?p:void 0,onPatch:v})]})},bh=({vehicles:e,drivers:t,assignments:r,state:s,itemErrors:a,onChange:o,onAssign:i})=>{let c=g.useMemo(()=>$a(s),[s]),l=t.length>1;if(!e.length)return n.jsx("p",{className:"cds-mb-4 cds-text-sm cds-text-fg-muted",children:"Add a vehicle first to choose its coverage."});let f=(v,d,h)=>{o(e.map((u,p)=>p===v?{...u,[d]:h}:u))};return n.jsx("div",{className:"cds-mb-4",children:e.map((v,d)=>{let h=Ra(v,d),u=a.find(m=>m.index===d)?.errorsByKey??{},p=u[Vr];return n.jsxs("fieldset",{className:`cds-mb-4 cds-rounded-lg cds-border cds-bg-surface-elevated cds-p-4 last:cds-mb-0 ${p?"cds-border-destructive":"cds-border-border"}`,children:[n.jsx("legend",{className:"cds-px-1 cds-text-sm cds-font-bold cds-text-fg",children:h}),Oa.map(m=>n.jsx(Hs,{question:{question:Ta[m],key:m,required:!0,inputType:"select",options:c[m]},required:!0,value:v[m],error:u[m],values:v,onChange:y=>f(d,m,y)},m)),l?n.jsxs("div",{className:"cds-mt-2 cds-border-t cds-border-border cds-pt-3",children:[n.jsxs("p",{className:"cds-mb-2 cds-text-sm cds-font-semibold cds-text-fg",children:["Who drives this one? ",n.jsx("span",{className:"cds-font-normal cds-text-fg-muted",children:"(share of use, totalling 100%)"})]}),n.jsx("div",{className:"cds-flex cds-flex-wrap cds-gap-3",children:t.map((m,y)=>{let x=[m.first_name,m.last_name].filter(Boolean).join(" ")||`Driver ${y+1}`,b=`usage-v${d}-d${y}`,k=Fa(r,d,y);return n.jsxs("div",{className:"cds-w-32",children:[n.jsx("label",{htmlFor:b,className:"cds-mb-1 cds-block cds-text-xs cds-font-semibold cds-text-fg-muted",children:x}),n.jsxs("div",{className:"cds-flex cds-items-center cds-gap-1",children:[n.jsx("input",{id:b,type:"text",inputMode:"numeric",value:k??"","aria-invalid":!!p||void 0,onChange:w=>{let j=w.target.value.replace(/\D/g,"");i(Da(r,d,y,j===""?0:Math.min(100,Number(j))))},className:`${F} ${p?"cds-border-destructive":""}`}),n.jsx("span",{"aria-hidden":"true",className:"cds-text-sm cds-text-fg-muted",children:"%"})]})]},b)})}),p?n.jsx("p",{className:"cds-mt-2 cds-text-sm cds-text-destructive",role:"alert",children:p}):null]}):null]},d)})})},zs=({questions:e,values:t,rootValues:r,visibleKeys:s,rootVisible:a=[],errors:o,itemErrors:i,stageKey:c,quoteId:l,cascade:f,vinDecode:v,onPatch:d})=>{let h=g.useMemo(()=>wa(e),[e]),u=t===r,p=g.useMemo(()=>{if(!u)return new Map;let y=new Map;for(let x of dh){let b=h.find(k=>x.keys.has(k.key)&&s.has(k.key));b&&y.set(b.key,x)}return y},[h,s,u]),m=y=>y.flatMap(x=>{let b=x.key,k=ja(x),w=_a(x);if(!w&&!s.has(b))return[];let j=[];b==="co_applicant_first_name"&&u&&j.push(n.jsx(vh,{values:r,targetQuestions:a,onPatch:d},`${b}-copy`));let _=p.get(b);if(_&&j.push(n.jsx(uh,{heading:_.heading,caption:_.caption},`${b}-section`)),b==="vehicle_policy_selections"){let M=C=>Array.isArray(C)?C:[];return j.push(n.jsx(bh,{vehicles:M(r[Ie("vehicles")]),drivers:M(r[Ie("drivers")]),assignments:Aa(r),state:r.state,itemErrors:i.filter(C=>C.groupKey==="vehicles"),onChange:C=>d({[Ie("vehicles")]:C}),onAssign:C=>d({[Vr]:C})},b)),j}if(!w){let M=b==="make"||b==="model"||b==="body_style"?b:void 0;j.push(x.inputType==="address"?n.jsx(pd,{question:x,values:t,error:o[b],onPatch:d},b):n.jsx(Hs,{question:x,value:t[b],error:o[b],values:t,required:Na(x,t===r?t:Ba(r,t)),asyncSelect:M&&f?{options:f.options[M],loading:f.loading[M],activate:()=>f.ensure(M)}:void 0,vinDecode:b==="vin"?v:void 0,onChange:C=>{let N={[b]:C};b==="year"&&Object.assign(N,{make:"",model:"",body_style:""}),b==="make"&&Object.assign(N,{model:"",body_style:""}),b==="model"&&Object.assign(N,{body_style:""}),(b==="industry"||b==="employment_industry")&&(N.occupation=""),b==="dwelling_replacement_cost"&&Object.assign(N,Ka(t,C)),Object.assign(N,Ya(t,b,C)),d(N)}},b))}if(k&&(w||t[b]===k.conditionalValue)){let M=t[Ie(b)],C=Array.isArray(M)?M:[];j.push(n.jsx(yh,{groupKey:b,itemQuestions:k.conditionalQuestions??[],items:C.length?C:[{}],rootValues:r,stageKey:c,quoteId:l,itemErrors:i.filter(N=>N.groupKey===b),onChange:N=>d({[Ie(b)]:N})},`${b}-group`))}return Ma(x,t).forEach(M=>{if(M.conditionalQuestionsAllowMultiple)return;let C=M.conditionalQuestions??[];C.length&&j.push(n.jsx("div",{className:"cds-mb-2 cds-border-l-2 cds-border-accent/40 cds-pl-4",children:m(C)},`${b}-branch`))}),j});return n.jsx(n.Fragment,{children:m(h)})},kh=({questions:e,values:t,errors:r,itemErrors:s,stageKey:a,quoteId:o,suppressedKeys:i,onPatch:c})=>{let l=g.useMemo(()=>ka(e,t,a),[e,t,a]),f=g.useMemo(()=>new Set(l.map(d=>d.key).filter(d=>!i?.has(d))),[l,i]),v=g.useCallback(d=>c(d),[c]);return n.jsx(zs,{questions:e,values:t,rootValues:t,visibleKeys:f,rootVisible:l,errors:r,itemErrors:s,stageKey:a,quoteId:o,onPatch:v})};export{pd as a,ld as c,Mt as d,$n as f,md as i,br as l,Ih as n,ud as o,Fs as p,Hs as r,ht as s,kh as t,An as u};
|
|
317
|
+
`)},fc=0,Ne=[];function pc(e){var t=g.useRef([]),r=g.useRef([0,0]),s=g.useRef(),a=g.useState(fc++)[0],o=g.useState(os)[0],i=g.useRef(e);g.useEffect(function(){i.current=e},[e]),g.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var m=Ti([e.lockRef.current],(e.shards||[]).map(lr),!0).filter(Boolean);return m.forEach(function(y){return y.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),m.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var c=g.useCallback(function(m,y){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!i.current.allowPinchZoom;var x=rt(m),b=r.current,k="deltaX"in m?m.deltaX:b[0]-x[0],w="deltaY"in m?m.deltaY:b[1]-x[1],j,_=m.target,M=Math.abs(k)>Math.abs(w)?"h":"v";if("touches"in m&&M==="h"&&_.type==="range")return!1;var C=window.getSelection(),N=C&&C.anchorNode,A=N?N===_||N.contains(_):!1;if(A)return!1;var T=ir(M,_);if(!T)return!0;if(T?j=M:(j=M==="v"?"h":"v",T=ir(M,_)),!T)return!1;if(!s.current&&"changedTouches"in m&&(k||w)&&(s.current=j),!j)return!0;var P=s.current||j;return dc(P,y,m,P==="h"?k:w)},[]),l=g.useCallback(function(m){var y=m;if(!(!Ne.length||Ne[Ne.length-1]!==o)){var x="deltaY"in y?cr(y):rt(y),b=t.current.filter(function(j){return j.name===y.type&&(j.target===y.target||y.target===j.shadowParent)&&uc(j.delta,x)})[0];if(b&&b.should){y.cancelable&&y.preventDefault();return}if(!b){var k=(i.current.shards||[]).map(lr).filter(Boolean).filter(function(j){return j.contains(y.target)}),w=k.length>0?c(y,k[0]):!i.current.noIsolation;w&&y.cancelable&&y.preventDefault()}}},[]),f=g.useCallback(function(m,y,x,b){var k={name:m,delta:y,target:x,should:b,shadowParent:mc(x)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(w){return w!==k})},1)},[]),v=g.useCallback(function(m){r.current=rt(m),s.current=void 0},[]),d=g.useCallback(function(m){f(m.type,cr(m),m.target,c(m,e.lockRef.current))},[]),h=g.useCallback(function(m){f(m.type,rt(m),m.target,c(m,e.lockRef.current))},[]);g.useEffect(function(){return Ne.push(o),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:h}),document.addEventListener("wheel",l,Ee),document.addEventListener("touchmove",l,Ee),document.addEventListener("touchstart",v,Ee),function(){Ne=Ne.filter(function(m){return m!==o}),document.removeEventListener("wheel",l,Ee),document.removeEventListener("touchmove",l,Ee),document.removeEventListener("touchstart",v,Ee)}},[]);var u=e.removeScrollBar,p=e.inert;return g.createElement(g.Fragment,null,p?g.createElement(o,{styles:hc(a)}):null,u?g.createElement(rc,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function mc(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const vc=Wi(as,pc);var ds=g.forwardRef(function(e,t){return g.createElement(yt,Y({},e,{ref:t,sideCar:vc}))});ds.classNames=yt.classNames;var gc=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Pe=new WeakMap,st=new WeakMap,at={},Ht=0,us=function(e){return e&&(e.host||us(e.parentNode))},yc=function(e,t){return t.map(function(r){if(e.contains(r))return r;var s=us(r);return s&&e.contains(s)?s:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},xc=function(e,t,r,s){var a=yc(t,Array.isArray(e)?e:[e]);at[r]||(at[r]=new WeakMap);var o=at[r],i=[],c=new Set,l=new Set(a),f=function(d){!d||c.has(d)||(c.add(d),f(d.parentNode))};a.forEach(f);var v=function(d){!d||l.has(d)||Array.prototype.forEach.call(d.children,function(h){if(c.has(h))v(h);else try{var u=h.getAttribute(s),p=u!==null&&u!=="false",m=(Pe.get(h)||0)+1,y=(o.get(h)||0)+1;Pe.set(h,m),o.set(h,y),i.push(h),m===1&&p&&st.set(h,!0),y===1&&h.setAttribute(r,"true"),p||h.setAttribute(s,"true")}catch(x){console.error("aria-hidden: cannot operate on ",h,x)}})};return v(t),c.clear(),Ht++,function(){i.forEach(function(d){var h=Pe.get(d)-1,u=o.get(d)-1;Pe.set(d,h),o.set(d,u),h||(st.has(d)||d.removeAttribute(s),st.delete(d)),u||d.removeAttribute(r)}),Ht--,Ht||(Pe=new WeakMap,Pe=new WeakMap,st=new WeakMap,at={})}},bc=function(e,t,r){r===void 0&&(r="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),a=gc(e);return a?(s.push.apply(s,Array.from(a.querySelectorAll("[aria-live], script"))),xc(s,a,r,"aria-hidden")):function(){return null}};const kc=["top","right","bottom","left"],de=Math.min,ee=Math.max,ft=Math.round,ot=Math.floor,te=e=>({x:e,y:e}),wc={left:"right",right:"left",bottom:"top",top:"bottom"};function hs(e,t,r){return ee(e,de(t,r))}function re(e,t){return typeof e=="function"?e(t):e}function ue(e){return e.split("-")[0]}function Re(e){return e.split("-")[1]}function xn(e){return e==="x"?"y":"x"}function bn(e){return e==="y"?"height":"width"}function G(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function kn(e){return xn(G(e))}function jc(e,t,r){r===void 0&&(r=!1);const s=Re(e),a=kn(e),o=bn(a);let i=a==="x"?s===(r?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=pt(i)),[i,pt(i)]}function _c(e){const t=pt(e);return[on(e),t,on(t)]}function on(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const dr=["left","right"],ur=["right","left"],Mc=["top","bottom"],Cc=["bottom","top"];function Sc(e,t,r){switch(e){case"top":case"bottom":return r?t?ur:dr:t?dr:ur;case"left":case"right":return t?Mc:Cc;default:return[]}}function Ec(e,t,r,s){const a=Re(e);let o=Sc(ue(e),r==="start",s);return a&&(o=o.map(i=>i+"-"+a),t&&(o=o.concat(o.map(on)))),o}function pt(e){const t=ue(e);return wc[t]+e.slice(t.length)}function Nc(e){var t,r,s,a;return{top:(t=e.top)!=null?t:0,right:(r=e.right)!=null?r:0,bottom:(s=e.bottom)!=null?s:0,left:(a=e.left)!=null?a:0}}function fs(e){return typeof e!="number"?Nc(e):{top:e,right:e,bottom:e,left:e}}function mt(e){const{x:t,y:r,width:s,height:a}=e;return{width:s,height:a,top:r,left:t,right:t+s,bottom:r+a,x:t,y:r}}function hr(e,t,r){let{reference:s,floating:a}=e;const o=G(t),i=kn(t),c=bn(i),l=ue(t),f=o==="y",v=s.x+s.width/2-a.width/2,d=s.y+s.height/2-a.height/2,h=s[c]/2-a[c]/2;let u;switch(l){case"top":u={x:v,y:s.y-a.height};break;case"bottom":u={x:v,y:s.y+s.height};break;case"right":u={x:s.x+s.width,y:d};break;case"left":u={x:s.x-a.width,y:d};break;default:u={x:s.x,y:s.y}}const p=Re(t);return p&&(u[i]+=h*(p==="end"?1:-1)*(r&&f?-1:1)),u}async function Pc(e,t){var r;t===void 0&&(t={});const{x:s,y:a,platform:o,rects:i,elements:c,strategy:l}=e,{boundary:f="clippingAncestors",rootBoundary:v="viewport",elementContext:d="floating",altBoundary:h=!1,padding:u=0}=re(t,e),p=fs(u),y=c[h?d==="floating"?"reference":"floating":d],x=mt(await o.getClippingRect({element:(r=await(o.isElement==null?void 0:o.isElement(y)))==null||r?y:y.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(c.floating)),boundary:f,rootBoundary:v,strategy:l})),b=d==="floating"?{x:s,y:a,width:i.floating.width,height:i.floating.height}:i.reference,k=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c.floating)),w=await(o.isElement==null?void 0:o.isElement(k))&&await(o.getScale==null?void 0:o.getScale(k))||{x:1,y:1},j=mt(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:b,offsetParent:k,strategy:l}):b);return{top:(x.top-j.top+p.top)/w.y,bottom:(j.bottom-x.bottom+p.bottom)/w.y,left:(x.left-j.left+p.left)/w.x,right:(j.right-x.right+p.right)/w.x}}const Ac=50,$c=async(e,t,r)=>{const{placement:s="bottom",strategy:a="absolute",middleware:o=[],platform:i}=r,c=i.detectOverflow?i:{...i,detectOverflow:Pc},l=await(i.isRTL==null?void 0:i.isRTL(t));let f=await i.getElementRects({reference:e,floating:t,strategy:a}),{x:v,y:d}=hr(f,s,l),h=s,u=0;const p={};for(let m=0;m<o.length;m++){const y=o[m];if(!y)continue;const{name:x,fn:b}=y,{x:k,y:w,data:j,reset:_}=await b({x:v,y:d,initialPlacement:s,placement:h,strategy:a,middlewareData:p,rects:f,platform:c,elements:{reference:e,floating:t}});v=k??v,d=w??d,p[x]={...p[x],...j},_&&u<Ac&&(u++,typeof _=="object"&&(_.placement&&(h=_.placement),_.rects&&(f=_.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:a}):_.rects),{x:v,y:d}=hr(f,h,l)),m=-1)}return{x:v,y:d,placement:h,strategy:a,middlewareData:p}},Rc=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:s,placement:a,rects:o,platform:i,elements:c,middlewareData:l}=t,{element:f,padding:v=0}=re(e,t)||{};if(f==null)return{};const d=fs(v),h={x:r,y:s},u=kn(a),p=bn(u),m=await i.getDimensions(f),y=u==="y",x=y?"top":"left",b=y?"bottom":"right",k=y?"clientHeight":"clientWidth",w=o.reference[p]+o.reference[u]-h[u]-o.floating[p],j=h[u]-o.reference[u],_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(f));let M=_?_[k]:0;(!M||!await(i.isElement==null?void 0:i.isElement(_)))&&(M=c.floating[k]||o.floating[p]);const C=w/2-j/2,N=M/2-m[p]/2-1,A=de(d[x],N),T=de(d[b],N),P=M-m[p]-T,O=M/2-m[p]/2+C,R=hs(A,O,P),z=!l.arrow&&Re(a)!=null&&O!==R&&o.reference[p]/2-(O<A?A:T)-m[p]/2<0,D=z?O<A?O-A:O-P:0;return{[u]:h[u]+D,data:{[u]:R,centerOffset:O-R-D,...z&&{alignmentOffset:D}},reset:z}}}),Oc=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,s;const{placement:a,middlewareData:o,rects:i,initialPlacement:c,platform:l,elements:f}=t,{mainAxis:v=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:u="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...y}=re(e,t);if((r=o.arrow)!=null&&r.alignmentOffset)return{};const x=ue(a),b=G(c),k=ue(c)===c,w=await(l.isRTL==null?void 0:l.isRTL(f.floating)),j=h||(k||!m?[pt(c)]:_c(c)),_=p!=="none";!h&&_&&j.push(...Ec(c,m,p,w));const M=[c,...j],C=await l.detectOverflow(t,y),N=[];let A=((s=o.flip)==null?void 0:s.overflows)||[];if(v&&N.push(C[x]),d){const R=jc(a,i,w);N.push(C[R[0]],C[R[1]])}if(A=[...A,{placement:a,overflows:N}],!N.every(R=>R<=0)){var T,P;const R=(((T=o.flip)==null?void 0:T.index)||0)+1,z=M[R];if(z&&(!(d==="alignment"?b!==G(z):!1)||A.every($=>G($.placement)===b?$.overflows[0]>0:!0)))return{data:{index:R,overflows:A},reset:{placement:z}};let D=(P=A.filter(W=>W.overflows[0]<=0).sort((W,$)=>W.overflows[1]-$.overflows[1])[0])==null?void 0:P.placement;if(!D)switch(u){case"bestFit":{var O;const W=(O=A.filter($=>{if(_){const L=G($.placement);return L===b||L==="y"}return!0}).map($=>[$.placement,$.overflows.filter(L=>L>0).reduce((L,U)=>L+U,0)]).sort(($,L)=>$[1]-L[1])[0])==null?void 0:O[0];W&&(D=W);break}case"initialPlacement":D=c;break}if(a!==D)return{reset:{placement:D}}}return{}}}};function fr(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function pr(e){return kc.some(t=>e[t]>=0)}const Tc=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:s}=t,{strategy:a="referenceHidden",...o}=re(e,t);switch(a){case"referenceHidden":{const i=await s.detectOverflow(t,{...o,elementContext:"reference"}),c=fr(i,r.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:pr(c)}}}case"escaped":{const i=await s.detectOverflow(t,{...o,altBoundary:!0}),c=fr(i,r.floating);return{data:{escapedOffsets:c,escaped:pr(c)}}}default:return{}}}}},ps=new Set(["left","top"]);async function Fc(e,t){const{placement:r,platform:s,elements:a}=e,o=await(s.isRTL==null?void 0:s.isRTL(a.floating)),i=ue(r),c=Re(r),l=G(r)==="y",f=ps.has(i)?-1:1,v=o&&l?-1:1,d=re(t,e);let{mainAxis:h,crossAxis:u,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return c&&typeof p=="number"&&(u=c==="end"?p*-1:p),l?{x:u*v,y:h*f}:{x:h*f,y:u*v}}const Dc=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,s;const{x:a,y:o,placement:i,middlewareData:c}=t,l=await Fc(t,e);return i===((r=c.offset)==null?void 0:r.placement)&&(s=c.arrow)!=null&&s.alignmentOffset?{}:{x:a+l.x,y:o+l.y,data:{...l,placement:i}}}}},Lc=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:s,placement:a,platform:o}=t,{mainAxis:i=!0,crossAxis:c=!1,limiter:l={fn:b=>{let{x:k,y:w}=b;return{x:k,y:w}}},...f}=re(e,t),v={x:r,y:s},d=await o.detectOverflow(t,f),h=G(a),u=xn(h);let p=v[u],m=v[h];const y=(b,k)=>hs(k+d[b==="y"?"top":"left"],k,k-d[b==="y"?"bottom":"right"]);i&&(p=y(u,p)),c&&(m=y(h,m));const x=l.fn({...t,[u]:p,[h]:m});return{...x,data:{x:x.x-r,y:x.y-s,enabled:{[u]:i,[h]:c}}}}}},Ic=function(e){return e===void 0&&(e={}),{options:e,fn(t){var r,s;const{x:a,y:o,placement:i,rects:c,middlewareData:l}=t,{offset:f=0,mainAxis:v=!0,crossAxis:d=!0}=re(e,t),h={x:a,y:o},u=G(i),p=xn(u);let m=h[p],y=h[u];const x=re(f,t),b=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:(r=x.mainAxis)!=null?r:0,crossAxis:(s=x.crossAxis)!=null?s:0};if(v){const j=p==="y"?"height":"width",_=c.reference[p]-c.floating[j]+b.mainAxis,M=c.reference[p]+c.reference[j]-b.mainAxis;m<_?m=_:m>M&&(m=M)}if(d){var k,w;const j=p==="y"?"width":"height",_=ps.has(ue(i)),M=c.reference[u]-c.floating[j]+(_&&((k=l.offset)==null?void 0:k[u])||0)+(_?0:b.crossAxis),C=c.reference[u]+c.reference[j]+(_?0:((w=l.offset)==null?void 0:w[u])||0)-(_?b.crossAxis:0);y<M?y=M:y>C&&(y=C)}return{[p]:m,[u]:y}}}},Vc=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:r,rects:s,platform:a,elements:o}=t,{apply:i=()=>{},...c}=re(e,t),l=await a.detectOverflow(t,c),f=ue(r),v=Re(r),d=G(r)==="y",{width:h,height:u}=s.floating;let p,m;f==="top"||f==="bottom"?(p=f,m=v===(await(a.isRTL==null?void 0:a.isRTL(o.floating))?"start":"end")?"left":"right"):(m=f,p=v==="end"?"top":"bottom");const y=u-l.top-l.bottom,x=h-l.left-l.right,b=de(u-l[p],y),k=de(h-l[m],x),w=t.middlewareData.shift,j=!w;let _=b,M=k;w!=null&&w.enabled.x&&(M=x),w!=null&&w.enabled.y&&(_=y),j&&!v&&(d?M=h-2*ee(l.left,l.right):_=u-2*ee(l.top,l.bottom)),await i({...t,availableWidth:M,availableHeight:_});const C=await a.getDimensions(o.floating);return h!==C.width||u!==C.height?{reset:{rects:!0}}:{}}}};function xt(){return typeof window<"u"}function Oe(e){return ms(e)?(e.nodeName||"").toLowerCase():"#document"}function q(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function oe(e){var t;return(t=(ms(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ms(e){return xt()?e instanceof Node||e instanceof q(e).Node:!1}function Q(e){return xt()?e instanceof Element||e instanceof q(e).Element:!1}function fe(e){return xt()?e instanceof HTMLElement||e instanceof q(e).HTMLElement:!1}function mr(e){return!xt()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof q(e).ShadowRoot}function bt(e){const{overflow:t,overflowX:r,overflowY:s,display:a}=Z(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+r)&&a!=="inline"&&a!=="contents"}function Bc(e){return/^(table|td|th)$/.test(Oe(e))}function kt(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Hc=/transform|translate|scale|rotate|perspective|filter/,zc=/paint|layout|strict|content/,be=e=>!!e&&e!=="none";let zt;function wn(e){const t=Q(e)?Z(e):e;return be(t.transform)||be(t.translate)||be(t.scale)||be(t.rotate)||be(t.perspective)||!jn()&&(be(t.backdropFilter)||be(t.filter))||Hc.test(t.willChange||"")||zc.test(t.contain||"")}function Wc(e){let t=_e(e);for(;fe(t)&&!We(t);){if(wn(t))return t;if(kt(t))return null;t=_e(t)}return null}function jn(){return zt==null&&(zt=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),zt}function We(e){return/^(html|body|#document)$/.test(Oe(e))}function Z(e){return q(e).getComputedStyle(e)}function wt(e){return Q(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function _e(e){if(Oe(e)==="html")return e;const t=e.assignedSlot||e.parentNode||mr(e)&&e.host||oe(e);return mr(t)?t.host:t}function vs(e){const t=_e(e);return We(t)?(e.ownerDocument||e).body:fe(t)&&bt(t)?t:vs(t)}function qe(e,t,r){var s;t===void 0&&(t=[]),r===void 0&&(r=!0);const a=vs(e),o=a===((s=e.ownerDocument)==null?void 0:s.body),i=q(a);if(o){const c=cn(i);return t.concat(i,i.visualViewport||[],bt(a)?a:[],c&&r?qe(c):[])}else return t.concat(a,qe(a,[],r))}function cn(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function gs(e){const t=Z(e);let r=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const a=fe(e),o=a?e.offsetWidth:r,i=a?e.offsetHeight:s,c=ft(r)!==o||ft(s)!==i;return c&&(r=o,s=i),{width:r,height:s,$:c}}function _n(e){return Q(e)?e:e.contextElement}function $e(e){const t=_n(e);if(!fe(t))return te(1);const r=t.getBoundingClientRect(),{width:s,height:a,$:o}=gs(t);let i=(o?ft(r.width):r.width)/s,c=(o?ft(r.height):r.height)/a;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const qc=te(0);function ys(e){const t=q(e);return!jn()||!t.visualViewport?qc:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Uc(e,t,r){return t===void 0&&(t=!1),!!r&&t&&r===q(e)}function Me(e,t,r,s){t===void 0&&(t=!1),r===void 0&&(r=!1);const a=e.getBoundingClientRect(),o=_n(e);let i=te(1);t&&(s?Q(s)&&(i=$e(s)):i=$e(e));const c=Uc(o,r,s)?ys(o):te(0);let l=(a.left+c.x)/i.x,f=(a.top+c.y)/i.y,v=a.width/i.x,d=a.height/i.y;if(o&&s){const h=q(o),u=Q(s)?q(s):s;let p=h,m=cn(p);for(;m&&u!==p;){const y=$e(m),x=m.getBoundingClientRect(),b=Z(m),k=x.left+(m.clientLeft+parseFloat(b.paddingLeft))*y.x,w=x.top+(m.clientTop+parseFloat(b.paddingTop))*y.y;l*=y.x,f*=y.y,v*=y.x,d*=y.y,l+=k,f+=w,p=q(m),m=cn(p)}}return mt({width:v,height:d,x:l,y:f})}function jt(e,t){const r=wt(e).scrollLeft;return t?t.left+r:Me(oe(e)).left+r}function xs(e,t){const r=e.getBoundingClientRect(),s=r.left+t.scrollLeft-jt(e,r),a=r.top+t.scrollTop;return{x:s,y:a}}function Kc(e){let{elements:t,rect:r,offsetParent:s,strategy:a}=e;const o=a==="fixed",i=oe(s),c=t?kt(t.floating):!1;if(s===i||c&&o)return r;let l={scrollLeft:0,scrollTop:0},f=te(1);const v=te(0),d=fe(s);if((d||!o)&&((Oe(s)!=="body"||bt(i))&&(l=wt(s)),d)){const u=Me(s);f=$e(s),v.x=u.x+s.clientLeft,v.y=u.y+s.clientTop}const h=i&&!d&&!o?xs(i,l):te(0);return{width:r.width*f.x,height:r.height*f.y,x:r.x*f.x-l.scrollLeft*f.x+v.x+h.x,y:r.y*f.y-l.scrollTop*f.y+v.y+h.y}}function Yc(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Gc(e){const t=wt(e),r=e.ownerDocument.body,s=ee(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),a=ee(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-t.scrollLeft+jt(e);const i=-t.scrollTop;return Z(r).direction==="rtl"&&(o+=ee(e.clientWidth,r.clientWidth)-s),{width:s,height:a,x:o,y:i}}const Xc=25;function Qc(e,t,r){r===void 0&&(r="viewport");const s=r==="layoutViewport",a=q(e),o=oe(e),i=a.visualViewport;let c=o.clientWidth,l=o.clientHeight,f=0,v=0;if(i){const h=!jn()||t==="fixed";s?h||(f=-i.offsetLeft,v=-i.offsetTop):(c=i.width,l=i.height,h&&(f=i.offsetLeft,v=i.offsetTop))}if(jt(o)<=0){const h=o.ownerDocument,u=h.body,p=getComputedStyle(u),m=h.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,y=Math.abs(o.clientWidth-u.clientWidth-m),x=getComputedStyle(o).scrollbarGutter==="stable both-edges"?y/2:y;x<=Xc&&(c-=x)}return{width:c,height:l,x:f,y:v}}function Zc(e,t){const r=Me(e,!0,t==="fixed"),s=r.top+e.clientTop,a=r.left+e.clientLeft,o=$e(e),i=e.clientWidth*o.x,c=e.clientHeight*o.y,l=a*o.x,f=s*o.y;return{width:i,height:c,x:l,y:f}}function vr(e,t,r){let s;if(t==="viewport"||t==="layoutViewport")s=Qc(e,r,t);else if(t==="document")s=Gc(oe(e));else if(Q(t))s=Zc(t,r);else{const a=ys(e);s={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return mt(s)}function Jc(e,t){const r=t.get(e);if(r)return r;let s=qe(e,[],!1).filter(c=>Q(c)&&Oe(c)!=="body"),a=null;const o=Z(e).position==="fixed";let i=o?_e(e):e;for(;Q(i)&&!We(i);){const c=Z(i),l=wn(i),f=a?a.position:o?"fixed":"";!l&&(f==="fixed"||f==="absolute"&&c.position==="static")?s=s.filter(d=>d!==i):a=c,i=_e(i)}return t.set(e,s),s}function el(e){let{element:t,boundary:r,rootBoundary:s,strategy:a}=e;const i=[...r==="clippingAncestors"?kt(t)?[]:Jc(t,this._c):[].concat(r),s],c=vr(t,i[0],a);let l=c.top,f=c.right,v=c.bottom,d=c.left;for(let h=1;h<i.length;h++){const u=vr(t,i[h],a);l=ee(u.top,l),f=de(u.right,f),v=de(u.bottom,v),d=ee(u.left,d)}return{width:f-d,height:v-l,x:d,y:l}}function tl(e){const{width:t,height:r}=gs(e);return{width:t,height:r}}function nl(e,t,r){const s=fe(t),a=oe(t),o=r==="fixed",i=Me(e,!0,o,t);let c={scrollLeft:0,scrollTop:0};const l=te(0);if((s||!o)&&((Oe(t)!=="body"||bt(a))&&(c=wt(t)),s)){const h=Me(t,!0,o,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}!s&&a&&(l.x=jt(a));const f=a&&!s&&!o?xs(a,c):te(0),v=i.left+c.scrollLeft-l.x-f.x,d=i.top+c.scrollTop-l.y-f.y;return{x:v,y:d,width:i.width,height:i.height}}function Wt(e){return Z(e).position==="static"}function gr(e,t){if(!fe(e)||Z(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return oe(e)===r&&(r=r.ownerDocument.body),r}function bs(e,t){const r=q(e);if(kt(e))return r;if(!fe(e)){let a=_e(e);for(;a&&!We(a);){if(Q(a)&&!Wt(a))return a;a=_e(a)}return r}let s=gr(e,t);for(;s&&Bc(s)&&Wt(s);)s=gr(s,t);return s&&We(s)&&Wt(s)&&!wn(s)?r:s||Wc(e)||r}const rl=async function(e){const t=this.getOffsetParent||bs,r=this.getDimensions,s=await r(e.floating);return{reference:nl(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function sl(e){return Z(e).direction==="rtl"}const al={convertOffsetParentRelativeRectToViewportRelativeRect:Kc,getDocumentElement:oe,getClippingRect:el,getOffsetParent:bs,getElementRects:rl,getClientRects:Yc,getDimensions:tl,getScale:$e,isElement:Q,isRTL:sl};function ks(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ol(e,t,r){let s=null,a;const o=oe(e);function i(){var v;clearTimeout(a),(v=s)==null||v.disconnect(),s=null}function c(v,d){v===void 0&&(v=!1),d===void 0&&(d=1),i();const h=e.getBoundingClientRect(),{left:u,top:p,width:m,height:y}=h;if(v||t(),!m||!y)return;const x=ot(p),b=ot(o.clientWidth-(u+m)),k=ot(o.clientHeight-(p+y)),w=ot(u),_={rootMargin:-x+"px "+-b+"px "+-k+"px "+-w+"px",threshold:ee(0,de(1,d))||1};let M=!0;function C(N){const A=N[0].intersectionRatio;if(!ks(h,e.getBoundingClientRect()))return c();if(A!==d){if(!M)return c();A?c(!1,A):a=setTimeout(()=>{c(!1,1e-7)},1e3)}M=!1}try{s=new IntersectionObserver(C,{..._,root:o.ownerDocument})}catch{s=new IntersectionObserver(C,_)}s.observe(e)}const l=q(e),f=()=>c(r);return l.addEventListener("resize",f),c(!0),()=>{l.removeEventListener("resize",f),i()}}function il(e,t,r,s){s===void 0&&(s={});const{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=s,f=_n(e),v=a||o?[...f?qe(f):[],...t?qe(t):[]]:[];v.forEach(x=>{a&&x.addEventListener("scroll",r),o&&x.addEventListener("resize",r)});const d=f&&c?ol(f,r,o):null;let h=-1,u=null;i&&(u=new ResizeObserver(x=>{let[b]=x;b&&b.target===f&&u&&t&&(u.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var k;(k=u)==null||k.observe(t)})),r()}),f&&!l&&u.observe(f),t&&u.observe(t));let p,m=l?Me(e):null;l&&y();function y(){const x=Me(e);m&&!ks(m,x)&&r(),m=x,p=requestAnimationFrame(y)}return r(),()=>{var x;v.forEach(b=>{a&&b.removeEventListener("scroll",r),o&&b.removeEventListener("resize",r)}),d?.(),(x=u)==null||x.disconnect(),u=null,l&&cancelAnimationFrame(p)}}const cl=Dc,ll=Lc,dl=Oc,ul=Vc,hl=Tc,yr=Rc,fl=Ic,pl=(e,t,r)=>{const s=new Map,a=r??{},o={...al,...a.platform,_c:s};return $c(e,t,{...a,platform:o})};var ml=typeof document<"u",vl=function(){},ut=ml?g.useLayoutEffect:vl;function vt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,s,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(s=r;s--!==0;)if(!vt(e[s],t[s]))return!1;return!0}if(a=Object.keys(e),r=a.length,r!==Object.keys(t).length)return!1;for(s=r;s--!==0;)if(!{}.hasOwnProperty.call(t,a[s]))return!1;for(s=r;s--!==0;){const o=a[s];if(!(o==="_owner"&&e.$$typeof)&&!vt(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function ws(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function xr(e,t){const r=ws(e);return Math.round(t*r)/r}function qt(e){const t=g.useRef(e);return ut(()=>{t.current=e}),t}function gl(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:s=[],platform:a,elements:{reference:o,floating:i}={},transform:c=!0,whileElementsMounted:l,open:f}=e,[v,d]=g.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[h,u]=g.useState(s);vt(h,s)||u(s);const[p,m]=g.useState(null),[y,x]=g.useState(null),b=g.useCallback($=>{$!==_.current&&(_.current=$,m($))},[]),k=g.useCallback($=>{$!==M.current&&(M.current=$,x($))},[]),w=o||p,j=i||y,_=g.useRef(null),M=g.useRef(null),C=g.useRef(v),N=l!=null,A=qt(l),T=qt(a),P=qt(f),O=g.useCallback(()=>{if(!_.current||!M.current)return;const $={placement:t,strategy:r,middleware:h};T.current&&($.platform=T.current),pl(_.current,M.current,$).then(L=>{const U={...L,isPositioned:P.current!==!1};R.current&&!vt(C.current,U)&&(C.current=U,Hr.flushSync(()=>{d(U)}))})},[h,t,r,T,P]);ut(()=>{f===!1&&C.current.isPositioned&&(C.current.isPositioned=!1,d($=>({...$,isPositioned:!1})))},[f]);const R=g.useRef(!1);ut(()=>(R.current=!0,()=>{R.current=!1}),[]),ut(()=>{if(w&&(_.current=w),j&&(M.current=j),w&&j){if(A.current)return A.current(w,j,O);O()}},[w,j,O,A,N]);const z=g.useMemo(()=>({reference:_,floating:M,setReference:b,setFloating:k}),[b,k]),D=g.useMemo(()=>({reference:w,floating:j}),[w,j]),W=g.useMemo(()=>{const $={position:r,left:0,top:0};if(!D.floating)return $;const L=xr(D.floating,v.x),U=xr(D.floating,v.y);return c?{...$,transform:"translate("+L+"px, "+U+"px)",...ws(D.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:L,top:U}},[r,c,D.floating,v.x,v.y]);return g.useMemo(()=>({...v,update:O,refs:z,elements:D,floatingStyles:W}),[v,O,z,D,W])}const yl=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:s,padding:a}=typeof e=="function"?e(r):e;return s&&t(s)?s.current!=null?yr({element:s.current,padding:a}).fn(r):{}:s?yr({element:s,padding:a}).fn(r):{}}}},xl=(e,t)=>{const r=cl(e);return{name:r.name,fn:r.fn,options:[e,t]}},bl=(e,t)=>{const r=ll(e);return{name:r.name,fn:r.fn,options:[e,t]}},kl=(e,t)=>({fn:fl(e).fn,options:[e,t]}),wl=(e,t)=>{const r=dl(e);return{name:r.name,fn:r.fn,options:[e,t]}},jl=(e,t)=>{const r=ul(e);return{name:r.name,fn:r.fn,options:[e,t]}},_l=(e,t)=>{const r=hl(e);return{name:r.name,fn:r.fn,options:[e,t]}},Ml=(e,t)=>{const r=yl(e);return{name:r.name,fn:r.fn,options:[e,t]}};var Cl=Object.defineProperty,le=(e,t)=>Cl(e,"name",{value:t,configurable:!0}),js="Popper",[_s,Ms]=hn(js),[Sl,Cs]=_s(js),El=le(e=>{const{__scopePopper:t,children:r}=e,[s,a]=g.useState(null),[o,i]=g.useState(void 0);return n.jsx(Sl,{scope:t,anchor:s,onAnchorChange:a,placementState:o,setPlacementState:i,children:r})},"Popper"),Nl="PopperAnchor",Pl=g.forwardRef(le(function(t,r){const{__scopePopper:s,virtualRef:a,...o}=t,i=Cs(Nl,s),c=g.useRef(null),l=i.onAnchorChange,f=g.useCallback(m=>{c.current=m,m&&l(m)},[l]),v=he(r,f),d=g.useRef(null);g.useEffect(()=>{if(!a)return;const m=d.current;d.current=a.current,m!==d.current&&l(d.current)});const h=i.placementState&&_t(i.placementState),u=h?.[0],p=h?.[1];return a?null:n.jsx(ae.div,{"data-radix-popper-side":u,"data-radix-popper-align":p,...o,ref:v})},"PopperAnchor")),Ss="PopperContent",[Al,Fh]=_s(Ss),$l=g.forwardRef(le(function(t,r){const{__scopePopper:s,side:a="bottom",sideOffset:o=0,align:i="center",alignOffset:c=0,arrowPadding:l=0,avoidCollisions:f=!0,collisionBoundary:v=[],collisionPadding:d=0,sticky:h="partial",hideWhenDetached:u=!1,updatePositionStrategy:p="optimized",onPlaced:m,...y}=t,x=Cs(Ss,s),[b,k]=g.useState(null),w=he(r,k),[j,_]=g.useState(null),M=pn(j),C=M?.width??0,N=M?.height??0,A=a+(i!=="center"?"-"+i:""),T=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},P=Array.isArray(v)?v:[v],O=P.length>0,R={padding:T,boundary:P.filter(Es),altBoundary:O},{refs:z,floatingStyles:D,placement:W,isPositioned:$,middlewareData:L}=gl({strategy:"fixed",placement:A,whileElementsMounted:le((...Ct)=>il(...Ct,{animationFrame:p==="always"}),"whileElementsMounted"),elements:{reference:x.anchor},middleware:[xl({mainAxis:o+N,alignmentAxis:c}),f&&bl({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?kl():void 0,...R}),f&&wl({...R}),jl({...R,apply:le(({elements:Ct,rects:Dn,availableWidth:Gs,availableHeight:Xs})=>{const{width:Qs,height:Zs}=Dn.reference,Je=Ct.floating.style;Je.setProperty("--radix-popper-available-width",`${Gs}px`),Je.setProperty("--radix-popper-available-height",`${Xs}px`),Je.setProperty("--radix-popper-anchor-width",`${Qs}px`),Je.setProperty("--radix-popper-anchor-height",`${Zs}px`)},"apply")}),j&&Ml({element:j,padding:l}),Rl({arrowWidth:C,arrowHeight:N}),u&&_l({strategy:"referenceHidden",...R,boundary:O?R.boundary:void 0})]}),U=x.setPlacementState;ze(()=>(U(W),()=>{U(void 0)}),[W,U]);const[On,Tn]=_t(W),Fn=je(m);ze(()=>{$&&Fn?.()},[$,Fn]);const Ws=L.arrow?.x,qs=L.arrow?.y,Us=L.arrow?.centerOffset!==0,[Ks,Ys]=g.useState();return ze(()=>{b&&Ys(window.getComputedStyle(b).zIndex)},[b]),n.jsx("div",{ref:z.setFloating,"data-radix-popper-content-wrapper":"",style:{...D,transform:$?D.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Ks,"--radix-popper-transform-origin":[L.transformOrigin?.x,L.transformOrigin?.y].join(" "),...L.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:n.jsx(Al,{scope:s,placedSide:On,placedAlign:Tn,onArrowChange:_,arrowX:Ws,arrowY:qs,shouldHideArrow:Us,children:n.jsx(ae.div,{"data-side":On,"data-align":Tn,...y,ref:w,style:{...y.style,animation:$?y.style?.animation:"none"}})})})},"PopperContent"));function Es(e){return e!==null}le(Es,"isNotNull");var Rl=le(e=>({name:"transformOrigin",options:e,fn(t){const{placement:r,rects:s,middlewareData:a}=t,i=a.arrow?.centerOffset!==0,c=i?0:e.arrowWidth,l=i?0:e.arrowHeight,[f,v]=_t(r),d={start:"0%",center:"50%",end:"100%"}[v],h=(a.arrow?.x??0)+c/2,u=(a.arrow?.y??0)+l/2;let p="",m="";return f==="bottom"?(p=i?d:`${h}px`,m=`${-l}px`):f==="top"?(p=i?d:`${h}px`,m=`${s.floating.height+l}px`):f==="right"?(p=`${-l}px`,m=i?d:`${u}px`):f==="left"&&(p=`${s.floating.width+l}px`,m=i?d:`${u}px`),{data:{x:p,y:m}}}}),"transformOrigin");function _t(e){const[t,r="center"]=e.split("-");return[t,r]}le(_t,"getSideAndAlignFromPlacement");var Ol=El,Tl=Pl,Fl=$l,Dl=Object.defineProperty,se=(e,t)=>Dl(e,"name",{value:t,configurable:!0}),Mn="Checkbox",[Ll,Dh]=hn(Mn),[Il,Cn]=Ll(Mn);function Ns(e){const{__scopeCheckbox:t,checked:r,children:s,defaultChecked:a,disabled:o,form:i,name:c,onCheckedChange:l,required:f,value:v="on",internal_do_not_use_render:d}=e,[h,u]=zr({prop:r,defaultProp:a??!1,onChange:l,caller:Mn}),[p,m]=g.useState(null),[y,x]=g.useState(null),b=g.useRef(!1),[k,w]=g.useReducer(M=>M+1,0),j=p?!!i||!!p.closest("form"):!0,_={checked:h,disabled:o,setChecked:u,control:p,setControl:m,name:c,form:i,value:v,hasConsumerStoppedPropagationRef:b,userInteractionCount:k,onUserInteraction:w,required:f,defaultChecked:ne(a)?!1:a,isFormControl:j,bubbleInput:y,setBubbleInput:x};return n.jsx(Il,{scope:t,..._,children:As(d)?d(_):s})}se(Ns,"CheckboxProvider");var Vl="CheckboxTrigger",Bl=g.forwardRef(se(function({__scopeCheckbox:t,onKeyDown:r,onClick:s,...a},o){const{control:i,value:c,disabled:l,checked:f,required:v,setControl:d,setChecked:h,hasConsumerStoppedPropagationRef:u,onUserInteraction:p,isFormControl:m,bubbleInput:y}=Cn(Vl,t),x=he(o,d),b=g.useRef(f);return g.useEffect(()=>{const k=i?.form;if(k){const w=se(()=>h(b.current),"reset");return k.addEventListener("reset",w),()=>k.removeEventListener("reset",w)}},[i,h]),n.jsx(ae.button,{type:"button",role:"checkbox","aria-checked":ne(f)?"mixed":f,"aria-required":v,"data-state":Sn(f),"data-disabled":l?"":void 0,disabled:l,value:c,...a,ref:x,onKeyDown:X(r,k=>{k.key==="Enter"&&k.preventDefault()}),onClick:X(s,k=>{p(),h(w=>ne(w)?!0:!w),y&&m&&(u.current=k.isPropagationStopped(),u.current||k.stopPropagation())})})},"CheckboxTrigger")),Ps=g.forwardRef(se(function(t,r){const{__scopeCheckbox:s,name:a,checked:o,defaultChecked:i,required:c,disabled:l,value:f,onCheckedChange:v,form:d,...h}=t;return n.jsx(Ns,{__scopeCheckbox:s,checked:o,defaultChecked:i,disabled:l,required:c,onCheckedChange:v,name:a,form:d,value:f,internal_do_not_use_render:({isFormControl:u})=>n.jsxs(n.Fragment,{children:[n.jsx(Bl,{...h,ref:r,__scopeCheckbox:s}),u&&n.jsx(ql,{__scopeCheckbox:s})]})})},"Checkbox")),Hl="CheckboxIndicator",zl=g.forwardRef(se(function(t,r){const{__scopeCheckbox:s,forceMount:a,...o}=t,i=Cn(Hl,s);return n.jsx(fn,{present:a||ne(i.checked)||i.checked===!0,children:n.jsx(ae.span,{"data-state":Sn(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:r,style:{pointerEvents:"none",...t.style}})})},"CheckboxIndicator")),Wl="CheckboxBubbleInput",ql=g.forwardRef(se(function({__scopeCheckbox:t,onClick:r,...s},a){const{control:o,hasConsumerStoppedPropagationRef:i,userInteractionCount:c,checked:l,defaultChecked:f,required:v,disabled:d,name:h,value:u,form:p,bubbleInput:m,setBubbleInput:y}=Cn(Wl,t),x=he(a,y),b=pn(o),k=g.useRef(!1),w=g.useRef(l),j=g.useRef(c);g.useEffect(()=>{const M=m;if(!M)return;const C=window.HTMLInputElement.prototype,A=Object.getOwnPropertyDescriptor(C,"checked").set,T=c!==j.current;j.current=c;const P=w.current!==l;w.current=l;const O=!(T&&i.current);if(P&&A){k.current=!T;const R=new Event("click",{bubbles:O});M.indeterminate=ne(l),A.call(M,ne(l)?!1:l),M.dispatchEvent(R),k.current=!1}},[m,l,i,c]);const _=g.useRef(ne(l)?!1:l);return n.jsx(ae.input,{type:"checkbox","aria-hidden":!0,defaultChecked:f??_.current,required:v,disabled:d,name:h,value:u,form:p,...s,tabIndex:-1,ref:x,onClick:X(r,M=>{k.current&&M.stopPropagation()}),style:{...s.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"CheckboxBubbleInput"));function As(e){return typeof e=="function"}se(As,"isFunction");function ne(e){return e==="indeterminate"}se(ne,"isIndeterminate");function Sn(e){return ne(e)?"indeterminate":e?"checked":"unchecked"}se(Sn,"getState");var Ul=Object.defineProperty,pe=(e,t)=>Ul(e,"name",{value:t,configurable:!0}),En="Popover",[$s,Lh]=hn(En,[Ms]),Nn=Ms(),[Kl,Te]=$s(En),Yl=pe(e=>{const{__scopePopover:t,children:r,open:s,defaultOpen:a,onOpenChange:o,modal:i=!1}=e,c=Nn(t),l=g.useRef(null),[f,v]=g.useState(!1),[d,h]=zr({prop:s,defaultProp:a??!1,onChange:o,caller:En});return n.jsx(Ol,{...c,children:n.jsx(Kl,{scope:t,contentId:Xa(),triggerRef:l,open:d,onOpenChange:h,onOpenToggle:g.useCallback(()=>h(u=>!u),[h]),hasCustomAnchor:f,onCustomAnchorAdd:g.useCallback(()=>v(!0),[]),onCustomAnchorRemove:g.useCallback(()=>v(!1),[]),modal:i,children:r})})},"Popover"),Gl="PopoverTrigger",Xl=g.forwardRef(pe(function(t,r){const{__scopePopover:s,...a}=t,o=Te(Gl,s),i=Nn(s),c=he(r,o.triggerRef),l=n.jsx(ae.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":Pn(o.open),...a,ref:c,onClick:X(t.onClick,o.onOpenToggle)});return o.hasCustomAnchor?l:n.jsx(Tl,{asChild:!0,...i,children:l})},"PopoverTrigger")),Rs="PopoverPortal",[Ql,Zl]=$s(Rs,{forceMount:void 0}),Jl=pe(e=>{const{__scopePopover:t,forceMount:r,children:s,container:a}=e,o=Te(Rs,t);return n.jsx(Ql,{scope:t,forceMount:r,children:n.jsx(fn,{present:r||o.open,children:n.jsx($i,{asChild:!0,container:a,children:s})})})},"PopoverPortal"),Ue="PopoverContent",ed=g.forwardRef(pe(function(t,r){const s=Zl(Ue,t.__scopePopover),{forceMount:a=s.forceMount,...o}=t,i=Te(Ue,t.__scopePopover);return n.jsx(fn,{present:a||i.open,children:i.modal?n.jsx(nd,{...o,ref:r}):n.jsx(rd,{...o,ref:r})})},"PopoverContent")),td=Js("PopoverContent.RemoveScroll"),nd=g.forwardRef(pe(function(t,r){const s=Te(Ue,t.__scopePopover),a=g.useRef(null),o=he(r,a),i=g.useRef(!1);return g.useEffect(()=>{const c=a.current;if(c)return bc(c)},[]),n.jsx(ds,{as:td,allowPinchZoom:!0,children:n.jsx(Os,{...t,ref:o,trapFocus:s.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:X(t.onCloseAutoFocus,c=>{c.preventDefault(),i.current||s.triggerRef.current?.focus()}),onPointerDownOutside:X(t.onPointerDownOutside,c=>{const l=c.detail.originalEvent,f=l.button===0&&l.ctrlKey===!0,v=l.button===2||f;i.current=v},{checkForDefaultPrevented:!1}),onFocusOutside:X(t.onFocusOutside,c=>c.preventDefault(),{checkForDefaultPrevented:!1})})})},"PopoverContentModal")),rd=g.forwardRef(pe(function(t,r){const s=Te(Ue,t.__scopePopover),a=g.useRef(!1),o=g.useRef(!1);return n.jsx(Os,{...t,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{t.onCloseAutoFocus?.(i),i.defaultPrevented||(a.current||s.triggerRef.current?.focus(),i.preventDefault()),a.current=!1,o.current=!1},onInteractOutside:i=>{t.onInteractOutside?.(i),i.defaultPrevented||(a.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const c=i.target;s.triggerRef.current?.contains(c)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})},"PopoverContentNonModal")),Os=g.forwardRef(pe(function(t,r){const{__scopePopover:s,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:c,onEscapeKeyDown:l,onPointerDownOutside:f,onFocusOutside:v,onInteractOutside:d,...h}=t,u=Te(Ue,s),p=Nn(s);return yn(),n.jsx(Ni,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:o,onUnmountAutoFocus:i,children:n.jsx(Mi,{asChild:!0,disableOutsidePointerEvents:c,onInteractOutside:d,onEscapeKeyDown:l,onPointerDownOutside:f,onFocusOutside:v,onDismiss:()=>u.onOpenChange(!1),deferPointerDownOutside:!0,children:n.jsx(Fl,{"data-state":Pn(u.open),role:"dialog",id:u.contentId,...p,...h,ref:r,style:{...h.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})},"PopoverContentImpl"));function Pn(e){return e?"open":"closed"}pe(Pn,"getState");var sd=Yl,ad=Xl,od=Jl,Ts=ed,Fs=g.forwardRef(({className:e,...t},r)=>n.jsx(Ps,{ref:r,className:Ke("cds-flex cds-h-6 cds-w-6 cds-shrink-0 cds-cursor-pointer cds-items-center cds-justify-center cds-rounded-md cds-border-2 cds-border-input cds-bg-background cds-transition-colors hover:cds-border-accent focus-visible:cds-outline-none focus-visible:cds-ring-2 focus-visible:cds-ring-ring focus-visible:cds-ring-offset-2 focus-visible:cds-ring-offset-background disabled:cds-cursor-not-allowed disabled:cds-opacity-50 data-[state=checked]:cds-border-accent data-[state=checked]:cds-bg-accent",e),...t,children:n.jsx(zl,{className:"cds-flex cds-items-center cds-justify-center cds-text-accent-foreground",children:n.jsx(qr,{className:"cds-h-4 cds-w-4",strokeWidth:3})})}));Fs.displayName=Ps.displayName;var An=sd,$n=ad,Mt=g.forwardRef(({className:e,align:t="center",sideOffset:r=4,...s},a)=>{let o=ra();return n.jsx(od,{container:o??void 0,children:n.jsx(Ts,{ref:a,align:t,sideOffset:r,collisionBoundary:o??void 0,collisionPadding:8,style:{maxHeight:"var(--radix-popover-content-available-height)",overflowY:"auto"},className:Ke("credify-ui cds-z-50 cds-rounded-lg cds-border cds-border-border cds-bg-popover cds-p-3 cds-text-popover-foreground cds-shadow-lg cds-outline-none",e),...s})})});Mt.displayName=Ts.displayName;var id=g.lazy(()=>aa(()=>import("./dob-calendar-RIJ5S6YU-CdxMGaLz.js"),__vite__mapDeps([0,1,2,3]))),ht=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`,cd=e=>{let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(t)return new Date(Number(t[1]),Number(t[2])-1,Number(t[3]))},Ut=e=>{let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);return t?`${t[2]}/${t[3]}/${t[1]}`:""},ld=e=>{if(e.includes("-"))return e;let t=e.replace(/\D/g,"").slice(0,8);return t.length<=2?t:t.length<=4?`${t.slice(0,2)}/${t.slice(2)}`:`${t.slice(0,2)}/${t.slice(2,4)}/${t.slice(4)}`},br=e=>{let t=/^(\d{4})-(\d{1,2})-(\d{1,2})$/.exec(e.trim()),r=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(e.trim()),[s,a,o]=t?[Number(t[1]),Number(t[2]),Number(t[3])]:r?[Number(r[3]),Number(r[1]),Number(r[2])]:[0,0,0];if(!s)return"";let i=new Date(s,a-1,o);return i.getFullYear()===s&&i.getMonth()===a-1&&i.getDate()===o&&i<=new Date?ht(i):""},dd=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches,ud=({id:e,hintId:t,value:r,onChange:s})=>{let[a,o]=g.useState(()=>Ut(r)),[i,c]=g.useState(!1),l=new Date,[f,v]=g.useState(r);if(r!==f&&(v(r),br(a)!==r&&o(Ut(r))),dd())return n.jsx("input",{id:e,type:"date",max:ht(l),"aria-describedby":t,className:F,autoComplete:"bday",value:r,onChange:p=>s(p.target.value)});let d=cd(r),h=a.length===10&&!r,u=`${e}-error`;return n.jsxs("div",{children:[n.jsxs("div",{className:"cds-flex cds-gap-2",children:[n.jsx("input",{id:e,className:F,inputMode:"numeric",autoComplete:"bday",placeholder:"MM/DD/YYYY","aria-invalid":h||void 0,"aria-describedby":h?`${u} ${t??""}`.trim():t,value:a,onChange:p=>{let m=ld(p.target.value);o(m),s(br(m))}}),n.jsxs(An,{open:i,onOpenChange:c,children:[n.jsx($n,{asChild:!0,children:n.jsx("button",{type:"button","aria-label":"Pick date of birth from a calendar",className:Ke("cds-flex cds-w-12 cds-shrink-0 cds-items-center cds-justify-center cds-rounded-lg cds-border cds-border-input cds-bg-background cds-text-fg-muted cds-transition-colors hover:cds-border-accent hover:cds-text-accent",V),children:n.jsx(io,{className:"cds-h-5 cds-w-5","aria-hidden":"true"})})}),n.jsx(Mt,{align:"end",className:"cds-w-auto",children:n.jsx(g.Suspense,{fallback:n.jsx("div",{className:"cds-h-8 cds-w-64 cds-animate-pulse cds-rounded cds-bg-surface-muted"}),children:n.jsx(id,{today:l,selected:d,onSelect:p=>{p&&(s(ht(p)),o(Ut(ht(p)))),c(!1)}})})})]})]}),h?n.jsx("p",{id:u,role:"alert",className:"cds-mt-1 cds-text-xs cds-font-medium cds-text-destructive",children:"Enter a valid date of birth as MM/DD/YYYY — it can't be in the future."}):null]})},hd="cds-mt-1 cds-text-xs cds-font-medium cds-text-destructive",fd=({label:e,value:t,onChange:r,onPick:s})=>{let a=`${g.useId()}-address-suggestions`,[o,i]=g.useState([]),[c,l]=g.useState(!1),[f,v]=g.useState(-1),d=g.useRef(null),h=g.useRef(void 0);g.useEffect(()=>{let x=!1;return sa().then(b=>{x||(d.current=b)}),()=>{x=!0,clearTimeout(h.current)}},[]);let u=()=>{i([]),l(!1),v(-1)},p=x=>{if(r(x),clearTimeout(h.current),!d.current||x.trim().length<3){u();return}h.current=setTimeout(()=>{d.current?.(x).then(b=>{i(b),l(b.length>0),v(-1)})},250)},m=x=>{s(x),u()},y=x=>{if(!(!c||!o.length)){if(x.key==="ArrowDown"||x.key==="ArrowUp"){x.preventDefault();let b=x.key==="ArrowDown"?1:-1;v(k=>(k+b+o.length)%o.length);return}if(x.key==="Enter"&&f>=0){x.preventDefault();let b=o[f];b&&m(b);return}x.key==="Escape"&&u()}};return n.jsx(un,{label:e,children:({id:x})=>n.jsxs("div",{className:"cds-relative",children:[n.jsx("input",{id:x,type:"text",role:"combobox","aria-expanded":c,"aria-controls":a,"aria-autocomplete":"list","aria-activedescendant":f>=0?`${a}-${f}`:void 0,autoComplete:"address-line1",value:t,onChange:b=>p(b.target.value),onKeyDown:y,onBlur:()=>setTimeout(u,150),className:F}),c&&o.length?n.jsx("ul",{id:a,role:"listbox","aria-label":"Address suggestions",className:"cds-absolute cds-z-20 cds-mt-1 cds-w-full cds-overflow-hidden cds-rounded-lg cds-border cds-border-border cds-bg-popover cds-shadow-lg",children:o.map((b,k)=>n.jsx("li",{children:n.jsx("button",{type:"button",id:`${a}-${k}`,role:"option","aria-selected":k===f,onMouseDown:w=>w.preventDefault(),onClick:()=>m(b),className:Ke("cds-block cds-w-full cds-px-3 cds-py-2 cds-text-left cds-text-sm",k===f?"cds-bg-highlight cds-text-fg":"cds-text-popover-foreground"),children:b.description})},b.description))}):null]})})},pd=({question:e,values:t,error:r,onPatch:s})=>{let a=`__${e.key}`,o=String(t[e.key]??""),i=`${a}_line_1`in t;g.useEffect(()=>{if(i||!o)return;let u=ma(o);s({[`${a}_line_1`]:u.line_1,[`${a}_line_2`]:"",[`${a}_city`]:u.city||String(t.city??""),[`${a}_state`]:u.state||String(t.state??""),[`${a}_postal_code`]:u.postal_code||String(t.postal_code??"")})},[i,o]);let c=String(t[`${a}_line_1`]??""),l=String(t[`${a}_line_2`]??""),f=String(t[`${a}_city`]??t.city??""),v=String(t[`${a}_state`]??t.state??""),d=String(t[`${a}_postal_code`]??t.postal_code??"");g.useEffect(()=>{let u=va({line_1:c,line_2:l,city:f,state:v,postal_code:d});!u&&o||u!==o&&s({[e.key]:u})},[c,l,f,v,d]);let h=(u,p,m,y={})=>n.jsx(un,{label:p,children:({id:x})=>n.jsx("input",{id:x,type:"text",value:m,autoComplete:y.autoComplete,inputMode:y.inputMode,onChange:b=>s({[u]:y.uppercase?b.target.value.toUpperCase():b.target.value}),className:F})});return n.jsxs("fieldset",{className:"cds-mb-2",children:[n.jsx("legend",{className:"cds-mb-1 cds-block cds-text-sm cds-font-semibold cds-text-fg",children:e.question}),n.jsx(fd,{label:"Street address",value:c,onChange:u=>s({[`${a}_line_1`]:u}),onPick:u=>{let p=ta(u.description);s({[`${a}_line_1`]:p.line_1,[`${a}_city`]:p.city||f,[`${a}_state`]:p.state||v,[`${a}_postal_code`]:p.postal_code||d}),na(u.place_id).then(m=>{m&&s({[`${a}_postal_code`]:m})})}}),h(`${a}_line_2`,"Apt, unit, suite (optional)",l,{autoComplete:"address-line2"}),n.jsxs("div",{className:"cds-grid cds-gap-3 sm:cds-grid-cols-3",children:[h(`${a}_city`,"City",f,{autoComplete:"address-level2"}),h(`${a}_state`,"State",v,{autoComplete:"address-level1",uppercase:!0}),h(`${a}_postal_code`,"ZIP",d,{autoComplete:"postal-code",inputMode:"numeric"})]}),r?n.jsx("p",{className:hd,role:"alert",children:r}):null]})},md=({label:e,checked:t,onChange:r,className:s})=>{let a=g.useId();return n.jsxs("label",{htmlFor:a,className:Ke("cds-mb-2 cds-flex cds-cursor-pointer cds-items-center cds-justify-between cds-rounded-lg cds-border cds-border-border cds-bg-background cds-px-4 cds-py-3 cds-transition-colors hover:cds-border-accent/60 hover:cds-bg-highlight/40",s),children:[n.jsx("span",{className:"cds-text-sm cds-font-medium cds-text-fg",children:e}),n.jsx(Fs,{id:a,checked:t,onCheckedChange:o=>r(o===!0)})]})},S=e=>({className:t})=>n.jsx("svg",{viewBox:"0 0 48 48",fill:"none",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round",className:t,focusable:"false",children:e}),it=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M6 26 24 8l18 18"}),n.jsx("path",{d:"M10 26v14h28V26"})]})),vd=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M6 26 16 10h16l10 16"}),n.jsx("path",{d:"M10 26v14h28V26"}),n.jsx("path",{d:"M16 10 24 26l8-16"})]})),gd=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M6 16h36"}),n.jsx("path",{d:"M10 16v24h28V16"})]})),Kt=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M6 26 14 17l10-7 10 7 8 9"}),n.jsx("path",{d:"M10 26v14h28V26"})]})),yd=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M6 26 24 8l18 18"}),n.jsx("path",{d:"M10 26v14h28V26"}),n.jsx("path",{d:"M24 8 15 17",strokeWidth:5,strokeOpacity:.35})]})),xd=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M6 26 24 8l18 18",strokeWidth:5,strokeOpacity:.35}),n.jsx("path",{d:"M6 26 24 8l18 18"}),n.jsx("path",{d:"M10 26v14h28V26"})]})),bd=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M6 26 24 8l18 18",strokeDasharray:"5 4"}),n.jsx("path",{d:"M10 26v14h28V26"})]})),ce=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M6 24 24 10l18 14"}),n.jsx("path",{d:"M10 24v14h28V24"}),n.jsx("path",{d:"M20 38v-10h8v10"})]})),kd=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M4 22 24 10l20 12"}),n.jsx("path",{d:"M8 22v16h32V22"}),n.jsx("path",{d:"M18 38v-8h6v8"})]})),wd=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M6 20 24 8l18 12"}),n.jsx("path",{d:"M10 20v18h28V20"}),n.jsx("path",{d:"M20 38v-9h8v9"}),n.jsx("path",{d:"M14 24h4M30 24h4M14 30h4M30 30h4"})]})),jd=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 24 24 10l16 14"}),n.jsx("path",{d:"M12 24v14h24V24"}),n.jsx("path",{d:"M20 38v-8h8v8"}),n.jsx("circle",{cx:"24",cy:"19",r:"1.6",fill:"currentColor",stroke:"none"})]})),_d=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M6 22 16 12v-4"}),n.jsx("path",{d:"M12 22 24 10l12 12"}),n.jsx("path",{d:"M10 22v16h28V22"}),n.jsx("path",{d:"M20 38v-8h8v8"})]})),kr=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 18h32v20H8z"}),n.jsx("path",{d:"M8 18 24 8l16 10"}),n.jsx("path",{d:"M16 38V26h8v12"})]})),Md=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M4 26 24 12l20 14"}),n.jsx("path",{d:"M8 26v12h32V26"}),n.jsx("path",{d:"M18 38v-7h6v7"})]})),Cd=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M6 24 24 9l18 15"}),n.jsx("path",{d:"M10 24v14h28V24"}),n.jsx("path",{d:"M20 38v-9h8v9"}),n.jsx("path",{d:"M24 9V4"})]})),Sd=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M6 20 24 6l18 14"}),n.jsx("path",{d:"M10 20v18h28V20"}),n.jsx("path",{d:"M14 20v6M20 20v6M28 20v6M34 20v6"}),n.jsx("path",{d:"M20 38v-8h8v8"})]})),Ed=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 20c0-6 6-12 16-12s16 6 16 12"}),n.jsx("path",{d:"M10 20v18h28V20"}),n.jsx("path",{d:"M20 38v-8h8v8"})]})),Yt=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 22c0-7 7-13 16-13s16 6 16 13"}),n.jsx("path",{d:"M10 22v16h28V22"}),n.jsx("path",{d:"M20 38v-9a4 4 0 0 1 8 0v9"})]})),Nd=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 18 24 8l16 10"}),n.jsx("path",{d:"M10 18v20h28V18"}),n.jsx("path",{d:"M24 18v20M10 28h28"})]})),Gt=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M6 22 24 10l18 12"}),n.jsx("path",{d:"M10 22v16h28V22"}),n.jsx("path",{d:"M10 27h28M10 32h28"})]})),wr=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M4 24 16 16l10 6"}),n.jsx("path",{d:"M26 22 36 14l8 6"}),n.jsx("path",{d:"M8 24v14h18V24"}),n.jsx("path",{d:"M26 22v16h14V22"})]})),jr=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M4 30 12 24l8 4"}),n.jsx("path",{d:"M20 28 28 20l8 5"}),n.jsx("path",{d:"M8 30v10h12V30"}),n.jsx("path",{d:"M20 28v12h14V28"}),n.jsx("path",{d:"M34 25 42 20v20h-8"})]})),_r=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M6 22 24 8l18 14"}),n.jsx("path",{d:"M10 22v16h28V22"}),n.jsx("path",{d:"M24 22v16"}),n.jsx("path",{d:"M14 38v-7h5v7M29 38v-7h5v7"})]})),Pd=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 20 18 12l10 8"}),n.jsx("path",{d:"M28 20 38 13l6 7"}),n.jsx("path",{d:"M10 20v18h18V20"}),n.jsx("path",{d:"M28 20v18h14V20"})]})),Ad=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M6 22 12 16l6 6M18 22l6-6 6 6M30 22l6-6 6 6"}),n.jsx("path",{d:"M8 22v16h10V22M18 22v16h12V22M30 22v16h10V22"})]})),$d=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 20 24 10l16 10"}),n.jsx("path",{d:"M8 20v18h32V20"}),n.jsx("path",{d:"M8 26h32M8 32h32"})]})),Rd=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 14h32v24H8z"}),n.jsx("path",{d:"M24 14v24M8 26h32"})]})),Od=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 10h32v28H8z"}),n.jsx("path",{d:"M14 16h5v5h-5zM24 16h5v5h-5zM33 16h3v5h-3z"}),n.jsx("path",{d:"M14 26h5v5h-5zM24 26h5v5h-5zM33 26h3v5h-3z"})]})),Ce=(e,t)=>{let r=40-Math.min(e,4)*7-(t?3:0),s=[];for(let a=1;a<e;a+=1){let o=40-a*7;s.push(n.jsx("path",{d:`M10 ${o}h28`},a))}return S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:`M6 ${r} 24 ${Math.max(r-12,4)}l18 ${r-Math.max(r-12,4)}`}),n.jsx("path",{d:`M10 ${r}v${40-r}h28V${r}`}),s,t?n.jsx("path",{d:`M19 ${r}v-5h5`}):null]}))},Td=Ce(1,!1),Fd=Ce(1,!0),Mr=Ce(2,!1),Dd=Ce(2,!0),Ld=Ce(3,!1),Id=Ce(3,!0),Vd=Ce(4,!1),ie=e=>S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 20 24 10l16 10"}),n.jsx("path",{d:"M11 20v10h26V20"}),n.jsx("path",{d:"M4 30h40"}),e]})),Cr=ie(n.jsx("path",{d:"M11 30v4h26v-4",strokeWidth:4})),Bd=ie(n.jsx("path",{d:"M11 30v11h26V30"})),Hd=ie(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M11 30v11h13V30"}),n.jsx("path",{d:"M24 30v4h13v-4",strokeWidth:4})]})),zd=ie(n.jsx("path",{d:"M11 30v6h26v-6"})),Wd=ie(n.jsx(n.Fragment,{children:n.jsx("path",{d:"M13 30v10M24 30v10M35 30v10"})})),qd=ie(n.jsx("path",{d:"M11 30v10M37 30v10",strokeDasharray:"4 3"})),Sr=ie(n.jsx("path",{d:"M11 30v11h26V30"})),Ud=ie(n.jsx(n.Fragment,{children:n.jsx("path",{d:"M11 30v11h13V36h13v-6"})})),Kd=ie(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M11 30v11h26V30"}),n.jsx("path",{d:"M37 41h6"}),n.jsx("path",{d:"M30 41v-7h7"})]})),Ye=e=>S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M6 24 18 14l12 10"}),n.jsx("path",{d:"M9 24v16h18V24"}),e]})),Er=Ye(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M29 28h13v12H29z"}),n.jsx("path",{d:"M32 40v-7h7v7"})]})),Yd=Ye(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M33 28h11v12H33z"}),n.jsx("path",{d:"M36 40v-7h5v7"})]})),Gd=Ye(n.jsx("path",{d:"M13 40v-8h10v8"})),Xd=Ye(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M9 34h18"}),n.jsx("path",{d:"M13 40v-4h10v4"})]})),Qd=Ye(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M29 30h14"}),n.jsx("path",{d:"M30 30v10M42 30v10"})]})),Nr=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M22 40V22a4 4 0 0 1 8 0v18"}),n.jsx("path",{d:"M18 26h16M20 40h12M26 22v-4"}),n.jsx("path",{d:"M6 34h10"})]})),Zd=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M26 40V24a4 4 0 0 1 8 0v16"}),n.jsx("path",{d:"M22 28h16M24 40h12M30 24v-4"}),n.jsx("path",{d:"M4 34h14",strokeDasharray:"4 3"})]})),Jd=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M32 40V26a3 3 0 0 1 6 0v14"}),n.jsx("path",{d:"M29 29h12M30 40h10M35 26v-3"}),n.jsx("path",{d:"M4 34h20",strokeDasharray:"3 4"})]})),Pr=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 22 24 10l16 12"}),n.jsx("path",{d:"M12 22v14h24V22"}),n.jsx("path",{d:"M4 40h40"})]})),eu=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 20 24 8l16 12"}),n.jsx("path",{d:"M12 20v14h24V20"}),n.jsx("path",{d:"M4 40h16"}),n.jsx("path",{d:"M20 38c3-2 5 2 8 0s5 2 8 0 5 2 8 0"})]})),tu=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M10 18 24 8l14 10"}),n.jsx("path",{d:"M14 18v12h20V18"}),n.jsx("path",{d:"M17 30v8M31 30v8"}),n.jsx("path",{d:"M4 40c3-2 5 2 8 0s5 2 8 0 5 2 8 0 5 2 8 0 5 2 8 0"})]})),Ge=e=>S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 16h12a6 6 0 0 1 6 6v10a6 6 0 0 0 6 6h8"}),n.jsx("path",{d:"M6 12v8M42 34v8"}),n.jsx("text",{x:"24",y:"14",fill:"currentColor",stroke:"none",fontSize:"11",fontWeight:"700",textAnchor:"middle",children:e})]})),nu=Ge("Cu"),ru=Ge("Gal"),su=Ge("PEX"),au=Ge("PVC"),ou=Ge("PB"),Xt=S(n.jsxs(n.Fragment,{children:[n.jsx("circle",{cx:"24",cy:"24",r:"15"}),n.jsx("path",{d:"M24 9a15 15 0 0 1 0 30z",fill:"currentColor",stroke:"none",fillOpacity:.3})]})),Qt=S(n.jsxs(n.Fragment,{children:[n.jsx("circle",{cx:"24",cy:"24",r:"15",fill:"currentColor",stroke:"none",fillOpacity:.3}),n.jsx("circle",{cx:"24",cy:"24",r:"15"}),n.jsx("path",{d:"M17 24l5 5 9-10"})]})),iu=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M4 34h40"}),n.jsx("rect",{x:"14",y:"16",width:"20",height:"14",rx:"4"}),n.jsx("path",{d:"M18 30v4M30 30v4"})]})),cu=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M4 20h40"}),n.jsx("rect",{x:"14",y:"26",width:"20",height:"14",rx:"4"}),n.jsx("path",{d:"M24 26v-6"})]})),Ar=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 26 20 16l12 10"}),n.jsx("path",{d:"M11 26v14h18V26"}),n.jsx("path",{d:"M36 20a10 10 0 0 1 0 16"}),n.jsx("path",{d:"M40 15a16 16 0 0 1 0 26"})]})),$r=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 26 20 16l12 10"}),n.jsx("path",{d:"M11 26v14h18V26"}),n.jsx("path",{d:"M31 30h11"}),n.jsx("path",{d:"M38 26l4 4-4 4"})]})),Rr=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M10 26 24 14l14 12"}),n.jsx("path",{d:"M14 26v14h20V26"}),n.jsx("path",{d:"M24 34v-6"}),n.jsx("circle",{cx:"24",cy:"22",r:"2.5"})]})),lu=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 14h32"}),n.jsx("path",{d:"M16 14v4M24 14v4M32 14v4"}),n.jsx("path",{d:"M12 26c2-4 4-4 4-8M20 26c2-4 4-4 4-8M28 26c2-4 4-4 4-8",strokeDasharray:"3 3"}),n.jsx("path",{d:"M8 38h32"})]})),du=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 14h32"}),n.jsx("path",{d:"M16 14v4M24 14v4"}),n.jsx("path",{d:"M12 26c2-4 4-4 4-8M20 26c2-4 4-4 4-8",strokeDasharray:"3 3"}),n.jsx("path",{d:"M8 38h18"})]})),Or=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M6 24 24 10l18 14"}),n.jsx("path",{d:"M10 24v14h28V24"}),n.jsx("circle",{cx:"24",cy:"28",r:"3"}),n.jsx("path",{d:"M18 38c0-4 3-6 6-6s6 2 6 6"})]})),uu=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M4 22 16 12l12 10"}),n.jsx("path",{d:"M8 22v16h16V22"}),n.jsx("path",{d:"M26 28 35 21l9 7"}),n.jsx("path",{d:"M29 28v10h12V28"})]})),hu=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 28 24 16l16 12"}),n.jsx("path",{d:"M12 28v12h24V28"}),n.jsx("circle",{cx:"38",cy:"11",r:"4"}),n.jsx("path",{d:"M38 4v2M38 16v2M45 11h-2M33 11h-2"})]})),fu=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 30h32"}),n.jsx("path",{d:"M12 30l4-9h16l4 9"}),n.jsx("circle",{cx:"16",cy:"34",r:"3"}),n.jsx("circle",{cx:"32",cy:"34",r:"3"}),n.jsx("path",{d:"M20 15l3 3 6-6"})]})),pu=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 30h32"}),n.jsx("path",{d:"M12 30l4-9h16l4 9"}),n.jsx("circle",{cx:"16",cy:"34",r:"3"}),n.jsx("circle",{cx:"32",cy:"34",r:"3"}),n.jsx("path",{d:"M18 10h12v8H18z"}),n.jsx("path",{d:"M21 14h6"})]})),mu=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 30h32"}),n.jsx("path",{d:"M12 30l4-9h16l4 9"}),n.jsx("circle",{cx:"16",cy:"34",r:"3"}),n.jsx("circle",{cx:"32",cy:"34",r:"3"}),n.jsx("rect",{x:"19",y:"11",width:"10",height:"7",rx:"2"}),n.jsx("path",{d:"M21 11V9a3 3 0 0 1 6 0v2"})]})),vu=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M10 32h28"}),n.jsx("path",{d:"M14 32l3-8h6l3 8"}),n.jsx("circle",{cx:"17",cy:"35",r:"2.5"}),n.jsx("path",{d:"M31 28a5 5 0 1 1 10 0v6H31z"}),n.jsx("path",{d:"M36 14v6M31 17l3 3M41 17l-3 3"})]})),gu=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M10 32h28"}),n.jsx("path",{d:"M14 32l3-8h6l3 8"}),n.jsx("circle",{cx:"17",cy:"35",r:"2.5"}),n.jsx("path",{d:"M28 24h12v8H28z"}),n.jsx("path",{d:"M31 20l3 3 3-3"})]})),yu=S(n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M8 32h32"}),n.jsx("path",{d:"M12 32l4-9h16l4 9"}),n.jsx("circle",{cx:"16",cy:"35",r:"2.5"}),n.jsx("circle",{cx:"32",cy:"35",r:"2.5"}),n.jsx("path",{d:"M18 16l4 4 8-8"})]})),xu={co_applicant_gender:"gender"},bu={roof_shape:{byToken:{B_Gable:it,C_Hip:vd,A_Flat:gd,D_Other:Kt},fallback:Kt},architectural_style:{byToken:{TwoFamilyHome:_r,American4square:Nd,Basic:ce,BiLevel:wr,Bungalow:Md,CapeCod:jd,Colonial:wd,ColonialSpanish:Yt,CompletelyCustom:kr,Contemporary:kr,ContractorModern:ce,Farmhouse:Cd,Folk:ce,Log:Gt,Mediterranean:Ed,Ranch:kd,TriLevel:jr,Tudor:Sd,Vernacular:ce,Victorian:_d},fallback:ce},dwelling_type:{byToken:{SingleFamilyHouse:ce,Townhouse:Pd,Rowhouse:Ad,Duplex:_r,Triplex:$d,Fourplex:Rd,MultFamily:Od},fallback:ce},number_of_stories:{byToken:{One:Td,OneHalf:Fd,Two:Mr,TwoHalf:Dd,Three:Ld,ThreeHalf:Id,Four:Vd,BiLevel:wr,TriLevel:jr},fallback:Mr},foundation_type:{byToken:{Slab:Cr,Basement:Bd,CrawlSpace:zd,PartialBasement:Hd,PiersPostsPiles:Wd,Open:qd},fallback:Cr},basement_type:{byToken:{Basement:Sr,SplitLevelBasement:Ud,WalkoutBasement:Kd},fallback:Sr},occupancy_type:{byToken:{OwnerPrimary:Or,OwnerSecondary:uu,OwnerSeasonal:hu},fallback:Or},roof_updated_type:{byToken:{NotUpdated:bd,PartialUpdate:yd,CompleteUpdate:xd},fallback:it},located_over_water:{byToken:{NotOverWater:Pr,PartiallyOverWater:eu,FullyOrEntirelyOverWater:tu},fallback:Pr},construction_type:{byToken:{Frame:ce,Masonry:me,MasonryVeneer:me,Log:Gt,Asbestos:At,EFIS:B,HardiPlank:ye,SuperiorFireResistive:Be,SuperiorMasonryNonCombustible:me,SuperiorNonCombustible:$t},fallback:me},exterior_wall_type:{byToken:{VinylSiding:ye,WoodFraming:xe,BrickVeneer:me,Stucco:B,AdobeBlock:ge,AluminumSiding:ye,CementFiberShingles:B,Clapboard:ye,ConcreteBlock:ge,HardboardSiding:ye,InsulatedConcreteForms:ge,LightGaugeSteelFraming:B,LogsSolid:Gt,MasoniteSiding:ye,PreEngineeredMetal:B,SolidBrickConstruction:me,SolidConcrete:ge,StandardPoleFramed:xe,Stone:K,StructuralInsulatedPanels:B,TimberFraming:xe},fallback:me},roof_material_type:{byToken:{ASPHALT_SHINGLES:it,ARCHITECTURAL_SHINGLES:B,METAL:B,TILE_CONCRETE:ge,ASBESTOS:At,BUILT_UP:B,COMPOSITION:B,CONCRETE:ge,COPPER:ei,CORRUGATED_STEEL:ye,FIBERGLASS:B,FOAM:Ve,GRAVEL:K,MEMBRANE:B,MINERAL_FIBER_SHAKE:K,PLASTIC:B,ROCK:K,ROLLED_PAPER:Nt,RUBBER:B,SLATE:K,TAR:Gn,TAR_GRAVEL:K,TILE_CLAY:ge,TILE_MISSION:Yt,TILE_SPANISH:Yt,TIN:B,WOOD_FIBERGLASS_SHINGLES:xe,WOOD_SHAKE:xe,WOOD_SHINGLES:xe,OTHER:Kt},fallback:it},heating_type:{byToken:{Electric:gi,Gas:Be,GasForcedAir:Bn,GasHotWater:Ve,Oil:Xn,OilForcedAir:Bn,OilHotWater:Ve,SolidFuel:xe,HeatPump:Rt,Other:Rt},fallback:Rt},plumbing_type:{byToken:{EntirelyCopper:nu,EntirelyGalvanized:ru,EntirelyPEX:su,EntirelyPVC:au,Polybutylene:ou},fallback:Gn},oil_tank_location:{byToken:{AboveGround:iu,BelowGround:cu},fallback:Xn},heating_update_type:{byToken:{PartialUpdate:Xt,CompleteUpdate:Qt},fallback:Ft},plumbing_update_type:{byToken:{PartialUpdate:Xt,CompleteUpdate:Qt},fallback:Ft},electrical_update_type:{byToken:{PartialUpdate:Xt,CompleteUpdate:Qt},fallback:Ft},garage_type:{byToken:{Attached:Er,Basement:Xd,BuiltIn:Gd,Carport:Qd,Detached:Yd},fallback:Er},distance_from_fire_hydrant_ft:{byToken:{_0_500ft:Nr,_501_1000ft:Zd,_1001ftAndGreater:Jd},fallback:Nr},distance_from_fire_station_miles:{byToken:{Lessthan5miles:Jn,Over5miles:er,NotAvailable:Ao},fallback:Jn},fire_detection_system_type:{byToken:{Central:Ar,Direct:$r,Local:Rr},fallback:Hn},burglar_alarm_system_type:{byToken:{Central:Ar,Direct:$r,Local:Rr},fallback:Hn},sprinkler_system_type:{byToken:{Full:lu,Partial:du},fallback:Ve},ownership_type:{byToken:{Owned:fu,Leased:pu,Lien:mu},fallback:Vn},usage:{byToken:{Business:zn,Pleasure:ci,Farming:si,To_FromWork:qn,To_FromSchool:qo},fallback:Vn},gender:{byToken:{Female:fi,Male:Fo},fallback:et},relationship_to_insured:{byToken:{Spouse:Eo,Parent:Tt,Child:eo,"Domestic Partner":ga,Relative:Tt,Employee:zn,Other:et},fallback:et},license_status:{byToken:{Valid:pa,Suspended:At,Permit:Nt,Unlicensed:Ur},fallback:Nt},residence_type:{byToken:{OwnHome:St,OwnCondo:qn,RentHome:Ro,RentCondo:Zn,RentApartment:Zn,LiveWithParents:Tt},fallback:St},description:{byToken:{"At Fault With Injuries":vu,"At Fault With No Injury":gu,"Not At Fault":yu,"All Others":ve,Contamination:Wn,"Credit Card":Yn,Earthquake:K,"Extended Coverage Perils":$t,Fire:Be,Flood:In,Hail:Un,Lightning:Kn,"Medical Payments":Qn,"Theft/Burglary":Et,"Vandalism/Malicious Mischief":Pt,"Water Damage":Ve,Wind:tr,Towing:er,Glass:ve,"Tornado/Hurricane":Ot,CONTAMINATION:Wn,CREDITCARD:Yn,DAMAGETOPROPERTYOFOTHERS:St,DOGBITELIABILITY:go,EARTHMOVEMENT:K,EARTHQUAKE:K,EXTENDEDCOVERAGEPERILS:$t,FIRE:Be,FLOOD:In,FREEZINGWATERINCLUDINGBURSTPIPES:Zo,HAIL:Un,HURRICANE:Ot,LIABILITYALLOTHER:ve,LIGHTNING:Kn,MEDICALPAYMENTS:Qn,MYSTERIOUSDISAPPEARANCE:ve,MYSTERIOUSDISAPPEARANCESCHEDULEDPROPERTY:ve,PHYSICALDAMAGEALLOTHER:Pt,SINKHOLE:K,SLIPFALLLIABILITY:et,SMOKE:Be,THEFTSCHEDULEDPROPERTY:Et,THEFTBURGLARY:Et,TORNADO:Ot,VANDALISMMALICIOUSMISCHIEF:Pt,WATERDAMAGE:fo,WIND:tr,WORKERSCOMPENSATION:Mo,ALLOTHER:ve},fallback:ve}},ku={Yes:qr,No:Ur},Ds=e=>bu[xu[e]??e],ln=(e,t)=>{let r=Ds(e);if(r)return r.byToken[t]??r.fallback},Fe="cds-relative cds-flex cds-items-center cds-justify-center cds-rounded-xl cds-border-2 cds-transition-colors disabled:cds-cursor-not-allowed",De="cds-border-accent cds-bg-accent/10 cds-text-fg",Le="cds-border-border-strong cds-bg-surface-elevated cds-text-fg-muted hover:cds-border-accent/60",Xe="cds-border-destructive",Qe=()=>n.jsx("span",{"aria-hidden":"true",className:"cds-absolute cds-right-1.5 cds-top-1.5 cds-flex cds-h-5 cds-w-5 cds-items-center cds-justify-center cds-rounded-full cds-bg-accent cds-text-xs cds-font-bold cds-text-accent-foreground",children:"✓"}),Ze=(e,t,r)=>{let s=g.useRef([]),a=g.useRef(null);g.useEffect(()=>{a.current!==null&&(s.current[a.current]?.focus(),a.current=null)},[t]);let o=e.findIndex(i=>i.value===t);return{tabStop:o>=0?o:0,onKeyDown:g.useCallback(i=>{let c=i.key==="ArrowRight"||i.key==="ArrowDown"?1:i.key==="ArrowLeft"||i.key==="ArrowUp"?-1:0;if(!c||e.length===0)return;i.preventDefault();let l=e.findIndex(d=>d.value===t),f=(l<0?0:l+c+e.length)%e.length,v=e[f];v&&(a.current=f,r(v.value))},[e,t,r]),register:g.useCallback(i=>c=>{s.current[i]=c},[])}},dn=({glyph:e,className:t})=>n.jsx("span",{"aria-hidden":"true",className:t??"cds-h-10 cds-w-10 cds-text-fg",children:n.jsx(e,{className:"cds-h-full cds-w-full"})}),wu=({fieldKey:e,label:t,options:r,value:s,invalid:a,describedBy:o,onChange:i})=>{let{tabStop:c,onKeyDown:l,register:f}=Ze(r,s,i),v=r.length<=4?"cds-grid-cols-2 sm:cds-grid-cols-4":"cds-grid-cols-2 sm:cds-grid-cols-3 md:cds-grid-cols-4";return n.jsx("div",{role:"radiogroup","aria-label":t,"aria-invalid":a||void 0,"aria-describedby":o,className:`cds-grid cds-gap-2 ${v}`,onKeyDown:l,children:r.map((d,h)=>{let u=d.value===s,p=ln(e,d.value);return n.jsxs("button",{ref:f(h),type:"button",role:"radio","aria-checked":u,tabIndex:h===c?0:-1,onClick:()=>i(d.value),className:`${Fe} cds-flex-col cds-gap-1 cds-p-3 cds-text-center cds-text-xs cds-font-medium ${V} ${u?De:`${Le} ${a?Xe:""}`}`,children:[u?n.jsx(Qe,{}):null,p?n.jsx(dn,{glyph:p}):null,n.jsx("span",{children:d.label})]},d.value)})})},ju=({label:e,options:t,value:r,invalid:s,describedBy:a,onChange:o})=>{let{tabStop:i,onKeyDown:c,register:l}=Ze(t,r,o);return n.jsx("div",{role:"radiogroup","aria-label":e,"aria-invalid":s||void 0,"aria-describedby":a,className:"cds-grid cds-grid-cols-2 cds-gap-2",onKeyDown:c,children:t.map((f,v)=>{let d=f.value===r,h=ku[f.value];return n.jsxs("button",{ref:l(v),type:"button",role:"radio","aria-checked":d,tabIndex:v===i?0:-1,onClick:()=>o(f.value),className:`${Fe} cds-gap-2 cds-px-4 cds-py-3 cds-text-sm cds-font-semibold ${V} ${d?De:`${Le} ${s?Xe:""}`}`,children:[h?n.jsx(h,{"aria-hidden":"true",className:`cds-h-5 cds-w-5 ${d?"cds-text-accent":"cds-text-fg-muted"}`}):null,n.jsx("span",{children:f.label})]},f.value)})})},_u={tort_threshold:{Verbal_Threshold:"Lower premium. You can sue for pain and suffering only if your injury is serious, as NJ law defines it.",Zero_Threshold:"Higher premium. You keep the full right to sue for pain and suffering."},pip_coverage_type:{Primary:"Your auto policy pays your medical bills first.",Secondary:"Your health plan pays first and auto covers what it does not. Needs eligible health coverage."}},Mu=({fieldKey:e,label:t,options:r,value:s,invalid:a,describedBy:o,onChange:i})=>{let{tabStop:c,onKeyDown:l,register:f}=Ze(r,s,i),v=_u[e];return n.jsx("div",{role:"radiogroup","aria-label":t,"aria-invalid":a||void 0,"aria-describedby":o,className:`cds-grid cds-gap-2 ${r.length===2?"sm:cds-grid-cols-2":"sm:cds-grid-cols-3"}`,onKeyDown:l,children:r.map((d,h)=>{let u=d.value===s,p=v?.[d.value];return n.jsxs("button",{ref:f(h),type:"button",role:"radio","aria-checked":u,tabIndex:h===c?0:-1,onClick:()=>i(d.value),className:`${Fe} cds-flex-col cds-gap-1 cds-px-4 cds-py-3 ${V} ${u?De:`${Le} ${a?Xe:""}`}`,children:[u?n.jsx(Qe,{}):null,n.jsx("span",{className:"cds-w-full cds-pr-6 cds-text-left cds-text-sm cds-font-bold cds-text-fg",children:d.label}),p?n.jsx("span",{className:"cds-w-full cds-text-left cds-text-[11px] cds-font-normal cds-leading-snug cds-text-fg-muted",children:p}):null]},d.value)})})},Cu=({id:e,fieldKey:t,label:r,options:s,value:a,invalid:o,describedBy:i,onChange:c})=>{let[l,f]=g.useState(!1),[v,d]=g.useState(""),h=g.useMemo(()=>{let m=v.trim().toLowerCase();return m?s.filter(y=>y.label.toLowerCase().includes(m)):s},[s,v]),u=s.find(m=>m.value===a),p=u?ln(t,u.value):void 0;return n.jsxs(An,{open:l,onOpenChange:m=>{f(m),m||d("")},children:[n.jsx($n,{asChild:!0,children:n.jsxs("button",{type:"button",id:e,"aria-label":r,"aria-invalid":o||void 0,"aria-describedby":i,className:`${F} cds-flex cds-items-center cds-justify-between cds-gap-2 cds-text-left ${o?"cds-border-destructive":""} ${V}`,children:[n.jsxs("span",{className:"cds-flex cds-min-w-0 cds-items-center cds-gap-2",children:[p?n.jsx(dn,{glyph:p,className:"cds-h-6 cds-w-6 cds-shrink-0 cds-text-fg"}):null,n.jsx("span",{className:`cds-truncate ${u?"cds-text-fg":"cds-text-fg-muted"}`,children:u?u.label:"Select…"})]}),n.jsx(Wr,{"aria-hidden":"true",className:"cds-h-4 cds-w-4 cds-shrink-0 cds-text-fg-muted"})]})}),n.jsxs(Mt,{className:"cds-w-[min(30rem,calc(100vw-2rem))] cds-p-0",align:"start",children:[n.jsxs("div",{className:"cds-relative cds-border-b cds-border-border cds-p-2",children:[n.jsx(Ko,{"aria-hidden":"true",className:"cds-pointer-events-none cds-absolute cds-left-4 cds-top-1/2 cds-h-4 cds-w-4 -cds-translate-y-1/2 cds-text-fg-muted"}),n.jsx("input",{autoFocus:!0,type:"text",value:v,onChange:m=>d(m.target.value),placeholder:"Type to search…","aria-label":`Search ${r}`,className:`${F} cds-pl-9`})]}),h.length===0?n.jsx("p",{className:"cds-px-3 cds-py-6 cds-text-center cds-text-sm cds-text-fg-muted",children:"No matches"}):n.jsx("div",{role:"radiogroup","aria-label":r,className:"cds-grid cds-max-h-72 cds-grid-cols-2 cds-gap-2 cds-overflow-y-auto cds-p-2 sm:cds-grid-cols-3",children:h.map(m=>{let y=m.value===a,x=ln(t,m.value);return n.jsxs("button",{type:"button",role:"radio","aria-checked":y,onClick:()=>{c(m.value),f(!1),d("")},className:`${Fe} cds-flex-col cds-gap-1 cds-p-2.5 cds-text-center cds-text-xs cds-font-medium ${V} ${y?De:Le}`,children:[y?n.jsx(Qe,{}):null,x?n.jsx(dn,{glyph:x,className:"cds-h-8 cds-w-8 cds-text-fg"}):null,n.jsx("span",{className:"cds-leading-tight",children:m.label})]},m.value)})})]})]})},Ls=new Set(["Dontknow","Reject","None","NoCoverage","No_Coverage","NotAvailable"]),Su={personal_liability:"per occurrence",dwelling_medical_payments:"per person",policy_pd:"per accident",policy_mp:"per person",policy_umpd:"per accident",policy_pip:"per person",policy_auto_death_indemnity:"per person",policy_pip_deductible:"you pay per claim",extended_medical:"per person",vehicle_comp_deductible:"you pay per claim",vehicle_coll_deductible:"you pay per claim",vehicle_towing_and_labor:"per disablement",windstorm_deductible:"of your dwelling coverage"},Eu=new Set(["policy_pd","policy_mp","policy_umpd","policy_pip","policy_auto_death_indemnity","vehicle_comp_deductible","vehicle_coll_deductible","vehicle_towing_and_labor"]),Nu=/^([\d,]+)\s*\/\s*([\d,]+)$/,Pu=/^([\d,]+)\s*CSL$/i,Zt=e=>`$${e}${e.includes(",")?"":",000"}`,Au=(e,t)=>{let r=Nu.exec(t);if(r)return e==="vehicle_transportation_expense"?`$${r[1]??""}/day, up to $${r[2]??""}`:`${Zt(r[1]??"")} per person · ${Zt(r[2]??"")} per accident`;let s=Pu.exec(t);return s?`${Zt(s[1]??"")} combined single limit`:Su[e]},$u=(e,t)=>Ls.has(t.value)||!Eu.has(e)?t.label:/^[\d,]+$/.test(t.label)?`$${t.label}`:t.label,Rn=({fieldKey:e,label:t,options:r,value:s,invalid:a,describedBy:o,detailFor:i,onChange:c})=>{let{tabStop:l,onKeyDown:f,register:v}=Ze(r,s,c);return n.jsx("div",{role:"radiogroup","aria-label":t,"aria-invalid":a||void 0,"aria-describedby":o,className:"cds-grid cds-grid-cols-2 cds-gap-2 sm:cds-grid-cols-3",onKeyDown:f,children:r.map((d,h)=>{let u=d.value===s,p=Ls.has(d.value),m=p?void 0:i?.(d)??Au(e,d.label);return n.jsxs("button",{ref:v(h),type:"button",role:"radio","aria-checked":u,tabIndex:h===l?0:-1,onClick:()=>c(d.value),className:`${Fe} cds-flex-col cds-gap-0.5 cds-px-3 cds-py-2.5 cds-text-center ${V} ${u?De:`${Le} ${a?Xe:""}`} ${p&&!u?"cds-border-dashed":""}`,children:[u?n.jsx(Qe,{}):null,n.jsx("span",{className:p?"cds-text-sm cds-font-semibold cds-text-fg-muted":"cds-text-base cds-font-bold cds-text-fg",children:$u(e,d)}),m?n.jsx("span",{className:"cds-text-[11px] cds-font-normal cds-leading-tight cds-text-fg-muted",children:m}):null]},d.value)})})},ke=e=>String(e??"").replace(/\D/g,""),Ru=({id:e,label:t,value:r,config:s,invalid:a,describedBy:o,onChange:i})=>{let c=ke(r),l=c===""?null:Number(c),f=g.useRef(!1);g.useEffect(()=>{f.current||(f.current=!0,l===null&&i(s.min))},[l,s.min,i]);let v=h=>{if(l===null){i(s.min);return}i(Math.min(s.max,Math.max(s.min,l+h)))},d=`cds-flex cds-h-11 cds-w-11 cds-shrink-0 cds-items-center cds-justify-center cds-rounded-lg cds-border-2 cds-border-border-strong cds-bg-surface-elevated cds-text-fg cds-transition-colors hover:cds-border-accent hover:cds-bg-highlight disabled:cds-cursor-not-allowed disabled:cds-opacity-40 disabled:hover:cds-border-border-strong disabled:hover:cds-bg-surface-elevated ${V}`;return n.jsxs("div",{className:"cds-flex cds-items-center cds-gap-3",children:[n.jsx("button",{type:"button",onClick:()=>v(-1),disabled:l!==null&&l<=s.min,"aria-label":`Decrease ${t}`,className:d,children:n.jsx(Lo,{"aria-hidden":"true",className:"cds-h-5 cds-w-5"})}),n.jsx("input",{id:e,type:"text",inputMode:"numeric","aria-label":t,"aria-invalid":a||void 0,"aria-describedby":o,value:c,onFocus:h=>h.target.select(),onChange:h=>{let u=ke(h.target.value);i(u===""?"":Number(u))},className:`cds-h-11 cds-w-full cds-min-w-0 cds-rounded-lg cds-border-2 cds-bg-surface-elevated cds-text-center cds-text-lg cds-font-bold cds-text-fg focus:cds-border-primary focus:cds-outline-none focus:cds-ring-2 focus:cds-ring-ring/40 ${a?"cds-border-destructive":"cds-border-border-strong"}`}),n.jsx("button",{type:"button",onClick:()=>v(1),disabled:l!==null&&l>=s.max,"aria-label":`Increase ${t}`,className:d,children:n.jsx(Kr,{"aria-hidden":"true",className:"cds-h-5 cds-w-5"})})]})},Ou=200,Tu="cds-h-3 cds-w-full cds-cursor-pointer cds-appearance-none cds-rounded-full focus-visible:cds-outline-none focus-visible:cds-ring-2 focus-visible:cds-ring-ring focus-visible:cds-ring-offset-2 [&::-webkit-slider-thumb]:cds-h-7 [&::-webkit-slider-thumb]:cds-w-7 [&::-webkit-slider-thumb]:cds-appearance-none [&::-webkit-slider-thumb]:cds-rounded-full [&::-webkit-slider-thumb]:cds-border-4 [&::-webkit-slider-thumb]:cds-border-solid [&::-webkit-slider-thumb]:cds-border-surface-elevated [&::-webkit-slider-thumb]:cds-bg-accent [&::-webkit-slider-thumb]:cds-shadow-md [&::-webkit-slider-thumb]:cds-cursor-grab [&::-webkit-slider-thumb]:active:cds-cursor-grabbing [&::-moz-range-thumb]:cds-h-7 [&::-moz-range-thumb]:cds-w-7 [&::-moz-range-thumb]:cds-rounded-full [&::-moz-range-thumb]:cds-border-4 [&::-moz-range-thumb]:cds-border-solid [&::-moz-range-thumb]:cds-border-surface-elevated [&::-moz-range-thumb]:cds-bg-accent [&::-moz-range-thumb]:cds-shadow-md [&::-moz-range-thumb]:cds-cursor-grab",Is=(e,t)=>t?e.toLocaleString("en-US"):String(e),Tr=(e,{currency:t,grouped:r=!0,unit:s})=>{let a=Is(e,r);return t?`$${a}`:s?`${a} ${s}`:a},Vs=({id:e,label:t,value:r,config:s,invalid:a,describedBy:o,onChange:i})=>{let[c,l]=g.useState(()=>ke(r)),f=g.useRef(!1),v=g.useRef(void 0);g.useEffect(()=>()=>clearTimeout(v.current),[]),g.useEffect(()=>{f.current||l(ke(r))},[r]);let d=g.useRef(!1);g.useEffect(()=>{d.current||(d.current=!0,!(s.openBlank||ke(r)!=="")&&i(s.min))},[s.openBlank,s.min,i,r]);let h=x=>{l(x),f.current=!0,clearTimeout(v.current),v.current=setTimeout(()=>{f.current=!1,i(x===""?"":Number(x))},Ou)},u=c===""?s.min:Number(c),p=Math.min(s.max,Math.max(s.min,u)),m=(p-s.min)/(s.max-s.min)*100,y=!s.hardMax&&u<=s.max;return n.jsxs("div",{children:[n.jsx("div",{className:"cds-mb-2 cds-flex cds-justify-center",children:n.jsxs("div",{className:"cds-relative",children:[s.currency?n.jsx("span",{"aria-hidden":"true",className:`cds-absolute cds-left-3 cds-top-1/2 -cds-translate-y-1/2 cds-font-extrabold cds-text-fg ${s.lead?"cds-text-2xl":"cds-text-xl"}`,children:"$"}):null,n.jsx("input",{id:e,type:"text",inputMode:"numeric","aria-label":t,"aria-invalid":a||void 0,"aria-describedby":o,value:c===""?"":Is(u,s.grouped??!0),onFocus:x=>x.target.select(),onChange:x=>h(ke(x.target.value).slice(0,9)),className:`cds-rounded-lg cds-border-2 cds-bg-surface-elevated cds-py-2 cds-pr-3 cds-text-center cds-font-extrabold cds-text-fg focus:cds-border-primary focus:cds-outline-none focus:cds-ring-2 focus:cds-ring-ring/40 ${s.lead?"cds-w-48 cds-text-2xl":"cds-w-44 cds-text-xl"} ${s.currency?"cds-pl-8":"cds-pl-3"} ${a?"cds-border-destructive":"cds-border-border-strong"}`}),s.unit&&!s.currency?n.jsx("span",{"aria-hidden":"true",className:"cds-absolute cds-right-3 cds-top-1/2 -cds-translate-y-1/2 cds-text-xs cds-font-semibold cds-text-fg-muted",children:s.unit}):null]})}),n.jsx("input",{type:"range","aria-label":`${t} slider`,min:s.min,max:s.max,step:s.step,value:p,"aria-describedby":o,onChange:x=>h(x.target.value),className:Tu,style:{background:`linear-gradient(to right, hsl(var(--cds-accent)) ${m}%, hsl(var(--cds-border)) ${m}%)`}}),n.jsxs("div",{className:"cds-flex cds-justify-between cds-text-xs cds-text-fg-muted",children:[n.jsx("span",{children:Tr(s.min,s)}),n.jsxs("span",{children:[Tr(s.max,s),y?"+":""]})]})]})},we=[{label:"Before 1940",from:1800,to:1939},{label:"1940s–50s",from:1940,to:1959},{label:"1960s–70s",from:1960,to:1979},{label:"1980s–90s",from:1980,to:1999},{label:"2000s",from:2e3,to:2009},{label:"2010 or newer",from:2010,to:new Date().getFullYear()}],Fu=e=>{if(!Number.isFinite(e)||e<=0)return-1;let t=we.findIndex(s=>e>=s.from&&e<=s.to);if(t>=0)return t;let r=we[0];return r&&e<r.from?0:we.length-1},Du=({id:e,label:t,value:r,invalid:s,describedBy:a,onChange:o})=>{let i=Number(ke(r)),c=Fu(i),l=g.useMemo(()=>we.map((p,m)=>({value:String(m),label:p.label})),[]),f=p=>{let m=we[p];m&&!(i>=m.from&&i<=m.to)&&o(m.to)},{tabStop:v,onKeyDown:d,register:h}=Ze(l,c>=0?String(c):"",p=>f(Number(p))),u=c>=0?we[c]:void 0;return n.jsxs("div",{children:[n.jsx("div",{role:"radiogroup","aria-label":`${t} — period`,"aria-invalid":s||void 0,"aria-describedby":a,className:"cds-grid cds-grid-cols-2 cds-gap-2 sm:cds-grid-cols-3",onKeyDown:d,children:we.map((p,m)=>{let y=m===c;return n.jsxs("button",{ref:h(m),type:"button",role:"radio","aria-checked":y,tabIndex:m===v?0:-1,onClick:()=>f(m),className:`${Fe} cds-px-2 cds-py-2.5 cds-text-center cds-text-xs cds-font-semibold ${V} ${y?De:`${Le} ${s?Xe:""}`}`,children:[y?n.jsx(Qe,{}):null,n.jsx("span",{children:p.label})]},p.label)})}),u?n.jsx("div",{className:"cds-mt-3",children:n.jsx(Vs,{id:e,label:t,value:r,config:{min:u.from,max:u.to,step:1,currency:!1,grouped:!1,hardMax:!0},invalid:s,describedBy:a,onChange:o})}):null]})},Lu=12,Iu=new Date().getFullYear(),Vu=new Set(["personal_liability","dwelling_medical_payments","windstorm_deductible","all_perils_deductible","auto_prior_liability_limit","policy_bi","policy_um","policy_pd","policy_mp","policy_umpd","policy_pip","policy_auto_death_indemnity","policy_pip_deductible","extended_medical","vehicle_comp_deductible","vehicle_coll_deductible","vehicle_towing_and_labor","vehicle_transportation_expense"]),Bu=new Set(["tort_threshold","pip_coverage_type"]),ct={min:1900,max:Iu,step:1,currency:!1,grouped:!1,hardMax:!0,minFromKey:"year_built",openBlank:!0},Hu={dwelling_replacement_cost:{min:1e5,max:2e6,step:5e3,currency:!0,lead:!0,openBlank:!0},total_area_sq_ft:{min:500,max:6e3,step:50,currency:!1,unit:"sq ft"},annual_mileage:{min:1e3,max:5e4,step:500,currency:!1,unit:"mi/yr"},miles_to_work:{min:1,max:100,step:1,currency:!1,unit:"mi"},year_roof_updated:ct,heating_update_year:ct,plumbing_update_year:ct,electrical_update_year:ct},zu={household_size:{min:1,max:8},number_of_dogs:{min:0,max:99},number_of_units:{min:1,max:99},number_of_families:{min:1,max:5},number_of_units_in_firewall:{min:0,max:99},number_of_mortgagees:{min:0,max:3},number_of_parking_spaces:{min:1,max:3},years_at_address:{min:0,max:100},months_at_address:{min:0,max:11},years_at_prior_address:{min:0,max:100},auto_prior_years:{min:0,max:99},auto_prior_months:{min:0,max:11},auto_continuous_coverage_years:{min:0,max:99},home_prior_years:{min:0,max:99},home_continuous_coverage_years:{min:0,max:99}},Wu=new Set(["social_security_number","vin","date_of_birth","co_applicant_date_of_birth","additional_pip"]),qu=e=>e.length===2&&e.every(t=>t.value==="Yes"||t.value==="No"),Uu=(e,t,r=!1)=>{let s=e.key;if(!Wu.has(s)){if(e.inputType==="number"){let a=Hu[s];if(a)return{kind:"slider",config:a};let o=zu[s];return o?{kind:"stepper",config:o}:s==="year_built"?{kind:"eraYear"}:void 0}if((e.inputType==="select"||e.inputType==="radio")&&!(r||t.length===0)){if(Vu.has(s))return{kind:"amountCards"};if(Bu.has(s))return{kind:"choiceCards"};if(qu(t))return{kind:"yesNo"};if(Ds(s))return t.length>Lu?{kind:"illustrated"}:{kind:"iconCards"}}}},Fr=e=>{let t=String(e??"").replace(/\D/g,"");if(!t)return;let r=Number(t);return Number.isFinite(r)?r:void 0},Ku=(e,t)=>{let r=e.minFromKey?Fr(t[e.minFromKey]):void 0,s=e.maxFromKey?Fr(t[e.maxFromKey]):void 0,a=r!==void 0&&r>=1800?r:e.min,o=s!==void 0&&s>0?s:e.max;return o-a<e.step?e:{...e,min:a,max:o}},Yu=({spec:e,id:t,question:r,options:s,value:a,values:o,invalid:i,describedBy:c,onChange:l,label:f})=>{let v=f??r.question,d=a==null?"":String(a),h={fieldKey:r.key,label:v,options:s,value:d,invalid:i,describedBy:c,onChange:l};switch(e.kind){case"iconCards":return n.jsx(wu,{...h});case"yesNo":return n.jsx(ju,{...h});case"illustrated":return n.jsx(Cu,{id:t,...h});case"amountCards":return n.jsx(Rn,{...h});case"choiceCards":return n.jsx(Mu,{...h});case"stepper":return n.jsx(Ru,{id:t,label:v,value:a,config:e.config,invalid:i,describedBy:c,onChange:l});case"slider":return n.jsx(Vs,{id:t,label:v,value:a,config:Ku(e.config,o),invalid:i,describedBy:c,onChange:l});case"eraYear":return n.jsx(Du,{id:t,label:v,value:a,invalid:i,describedBy:c,onChange:l});default:return null}},Gu=25,Bs="cds-mt-1 cds-text-xs cds-font-medium cds-text-destructive",gt=({id:e,message:t})=>t?n.jsx("p",{id:e,className:Bs,role:"alert",children:t}):null,Xu=({id:e,label:t,value:r,options:s,invalid:a,describedBy:o,onChange:i,onOpen:c})=>{let[l,f]=g.useState(!1),[v,d]=g.useState(""),h=g.useMemo(()=>{let p=v.trim().toLowerCase();return p?s.filter(m=>m.label.toLowerCase().includes(p)).slice(0,200):s.slice(0,200)},[s,v]),u=s.find(p=>p.value===r);return n.jsxs(An,{open:l,onOpenChange:p=>{f(p),p?c?.():d("")},children:[n.jsx($n,{asChild:!0,children:n.jsxs("button",{type:"button",id:e,"aria-label":t,"aria-invalid":a||void 0,"aria-describedby":o,className:`${F} cds-flex cds-items-center cds-justify-between cds-text-left ${a?"cds-border-destructive":""} ${V}`,children:[n.jsx("span",{className:u?"cds-text-fg":"cds-text-fg-muted",children:u?u.label:"Select…"}),n.jsx(Wr,{"aria-hidden":"true",className:"cds-h-4 cds-w-4 cds-shrink-0 cds-text-fg-muted"})]})}),n.jsxs(Mt,{className:"cds-w-[min(28rem,calc(100vw-2rem))] cds-p-0",align:"start",children:[n.jsx("div",{className:"cds-border-b cds-border-border cds-p-2",children:n.jsx("input",{autoFocus:!0,type:"text",value:v,onChange:p=>d(p.target.value),placeholder:"Type to search…","aria-label":`Search ${t}`,className:F})}),n.jsx("ul",{className:"cds-max-h-64 cds-overflow-y-auto cds-py-1",role:"listbox","aria-label":t,children:h.length===0?n.jsx("li",{className:"cds-px-3 cds-py-2 cds-text-sm cds-text-fg-muted",children:"No matches"}):h.map(p=>n.jsx("li",{children:n.jsx("button",{type:"button",role:"option","aria-selected":p.value===r,onClick:()=>{i(p.value),f(!1),d("")},className:`cds-block cds-w-full cds-px-3 cds-py-2 cds-text-left cds-text-sm hover:cds-bg-highlight ${p.value===r?"cds-bg-highlight cds-font-semibold cds-text-fg":"cds-text-fg"}`,children:p.label})},p.value))})]})]})},Qu=({id:e,label:t,value:r,options:s,invalid:a,describedBy:o,onChange:i,onOpen:c})=>n.jsxs("select",{id:e,value:r,"aria-label":t,"aria-invalid":a||void 0,"aria-describedby":o,onFocus:c,onChange:l=>i(l.target.value),className:`${F} ${a?"cds-border-destructive":""}`,children:[n.jsx("option",{value:"",children:"Select…"}),s.map(l=>n.jsx("option",{value:l.value,children:l.label},l.value))]}),Zu=({label:e,value:t,options:r,invalid:s,describedBy:a,onChange:o})=>n.jsx("div",{role:"radiogroup","aria-label":e,"aria-invalid":s||void 0,"aria-describedby":a,className:"cds-flex cds-flex-wrap cds-gap-2",children:r.map(i=>{let c=i.value===t;return n.jsx("button",{type:"button",role:"radio","aria-checked":c,onClick:()=>o(i.value),className:`cds-min-w-[5.5rem] cds-flex-1 cds-rounded-lg cds-border cds-px-4 cds-py-2.5 cds-text-sm cds-font-semibold cds-transition-colors ${V} ${c?"cds-border-accent cds-bg-highlight cds-text-fg":`border-gray-400 bg-white text-gray-700 hover:border-brand-accent/60 ${s?"cds-border-destructive":""}`}`,children:i.label},i.value)})}),Ju=(e,t)=>{if(e.key==="occupation"||e.key==="co_applicant_occupation"){let r=e.key==="occupation"?t.industry??t.employment_industry:t.co_applicant_employment_industry,s=oa(r);return s?s.map(a=>({value:a,label:ia(a)})):[]}return ca(e.key,e.options)},Dr={dwelling_replacement_cost:"Cost to rebuild your home",all_perils_deductible:"Deductible"},Jt={dwelling_replacement_cost:"We start you off at your purchase price. Adjust it to what rebuilding would cost today — not the market value, and not necessarily what you paid. Higher-value home? Type the amount directly.",all_perils_deductible:"What you pay out of pocket on a claim before insurance kicks in.",additional_pip:"Extra cover for lost income and essential services after an injury. Pick the weekly benefit, and whether what it pays in total is capped."},eh=e=>`$${e.toLocaleString("en-US")}`,th=e=>String(e??"").replace(/\D/g,""),Lr=e=>e.endsWith("Percent"),nh={OnePercent:1,TwoPercent:2,ThreePercent:3,FourPercent:4,FivePercent:5},rh="OneThousand",sh="OnePercent",ah=({label:e,value:t,options:r,dwelling:s,hint:a,error:o,onChange:i})=>{let c=`deductible-${g.useId()}`,l=a?`${c}-hint`:void 0,f=o?`${c}-error`:void 0,v=Lr(t),d=Number(th(s)),h=r.filter(m=>Lr(m.value)===v),u=m=>{let y=nh[m.value];return!v||!y||!d?void 0:`of coverage (about ${eh(Math.round(d*y/100/500)*500)})`},p=m=>`px-3 py-1.5 transition-colors ${m?"cds-bg-primary cds-text-primary-foreground":"cds-bg-surface-elevated cds-text-fg-muted hover:cds-bg-surface-muted"} ${V}`;return n.jsxs("div",{className:"cds-mb-4",children:[n.jsxs("div",{className:"cds-mb-1 cds-flex cds-items-center cds-justify-between",children:[n.jsx("span",{className:"cds-text-sm cds-font-semibold cds-text-fg",children:e}),n.jsxs("div",{role:"group","aria-label":"Deductible type",className:"cds-flex cds-overflow-hidden cds-rounded-lg cds-border cds-border-input cds-text-xs cds-font-semibold",children:[n.jsx("button",{type:"button","aria-pressed":!v,onClick:()=>v&&i(rh),className:p(!v),children:"Dollar amount"}),n.jsx("button",{type:"button","aria-pressed":v,onClick:()=>!v&&i(sh),className:p(v),children:"% of coverage"})]})]}),n.jsx(Rn,{fieldKey:"all_perils_deductible",label:typeof e=="string"?e:"Deductible",value:t,options:h,invalid:!!o,describedBy:[l,f].filter(Boolean).join(" ")||void 0,detailFor:u,onChange:i}),a?n.jsx("p",{id:l,className:"cds-mt-1.5 cds-text-xs cds-text-fg-muted",children:a}):null,n.jsx(gt,{id:f??"",message:o})]})},oh=/^cov(\d+)(?:_(\d+))?_(LIMITED|UNLIMITED)$/,He=e=>{let t=oh.exec(e);if(t)return{weekly:t[1]??"",aggregate:t[2],capped:t[3]==="LIMITED"}},ih=({label:e,name:t,value:r,options:s,hint:a,error:o,onChange:i})=>{let c=`additional-pip-${g.useId()}`,l=a?`${c}-hint`:void 0,f=o?`${c}-error`:void 0,v=He(r),d=!v||v.capped,h=s.flatMap(y=>{let x=He(y.value);return!x||x.capped!==d?[]:[{value:y.value,label:`$${x.weekly}/wk`}]}),u=y=>{let x=He(y.value);if(x)return x.aggregate?`up to $${Number(x.aggregate).toLocaleString("en-US")} in total`:"no cap on the total"},p=y=>{if(y===d)return;let x=s.find(w=>{let j=He(w.value);return j?.capped===y&&j.weekly===v?.weekly}),b=s.find(w=>He(w.value)?.capped===y),k=x??b;k&&i(k.value)},m=y=>`px-3 py-1.5 transition-colors ${y?"cds-bg-primary cds-text-primary-foreground":"cds-bg-surface-elevated cds-text-fg-muted hover:cds-bg-surface-muted"} ${V}`;return n.jsxs("div",{className:"cds-mb-4",children:[n.jsxs("div",{className:"cds-mb-1 cds-flex cds-items-center cds-justify-between cds-gap-2",children:[n.jsx("span",{className:"cds-text-sm cds-font-semibold cds-text-fg",children:e}),n.jsxs("div",{role:"group","aria-label":"Total benefit",className:"cds-flex cds-shrink-0 cds-overflow-hidden cds-rounded-lg cds-border cds-border-input cds-text-xs cds-font-semibold",children:[n.jsx("button",{type:"button","aria-pressed":d,onClick:()=>p(!0),className:m(d),children:"Capped total"}),n.jsx("button",{type:"button","aria-pressed":!d,onClick:()=>p(!1),className:m(!d),children:"Unlimited total"})]})]}),n.jsx(Rn,{fieldKey:"additional_pip",label:t,value:r,options:h,invalid:!!o,describedBy:[l,f].filter(Boolean).join(" ")||void 0,detailFor:u,onChange:i}),a?n.jsx("p",{id:l,className:"cds-mt-1.5 cds-text-xs cds-text-fg-muted",children:a}):null,n.jsx(gt,{id:f??"",message:o})]})},Hs=({question:e,value:t,error:r,values:s,onChange:a,asyncSelect:o,vinDecode:i,required:c})=>{let l=g.useId(),f=`q-${e.key}-${l}`,v=r?`${f}-error`:void 0,d=e.hint?`${f}-hint`:void 0,h=i?.error?`${f}-vin-error`:void 0,u=[d,v,h].filter(Boolean).join(" ")||void 0,p=Dr[e.key]??e.question,m=n.jsxs(n.Fragment,{children:[p,c?null:n.jsx("span",{className:"cds-ml-1 cds-font-normal cds-text-fg-muted",children:"(optional)"})]}),y=t==null?"":String(t),x=g.useMemo(()=>{let _=o?.options??Ju(e,s);return!o||!y||_.some(M=>M.value===y)?_:[{value:y,label:y},..._]},[o,e,s,y]);if(e.inputType==="checkbox")return n.jsxs("div",{className:"cds-mb-2",children:[n.jsx(md,{label:e.question,checked:t===!0,onChange:_=>a(_)}),n.jsx(gt,{id:v??"",message:r})]});if(e.key==="all_perils_deductible")return n.jsx(ah,{label:Dr.all_perils_deductible,value:y,options:x,dwelling:s.dwelling_replacement_cost,hint:Jt.all_perils_deductible,error:r,onChange:a});if(e.key==="additional_pip")return n.jsx(ih,{label:m,name:p,value:y,options:x,hint:Jt.additional_pip,error:r,onChange:a});let b=_=>{if(e.key==="social_security_number")return n.jsx("input",{id:_,type:"text",inputMode:"numeric",autoComplete:"off",maxLength:11,value:ua(y),"aria-invalid":!!r||void 0,"aria-describedby":u,onChange:C=>a(ha(fa(y,C.target.value))),placeholder:"XXX-XX-XXXX",className:`${F} ${r?"cds-border-destructive":""}`});if(e.key==="vin"&&i){let C=Ir(y);return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"cds-flex cds-items-start cds-gap-2",children:[n.jsx("input",{id:_,type:"text",value:y,maxLength:17,autoComplete:"off","aria-invalid":!!r||void 0,"aria-describedby":u,onChange:N=>a(N.target.value),className:`${F} ${r?"cds-border-destructive":""}`}),n.jsx("button",{type:"button",disabled:!C||i.loading,onClick:()=>i.run(y),className:`cds-shrink-0 cds-whitespace-nowrap cds-rounded-lg cds-border cds-border-accent cds-bg-surface-elevated cds-px-4 cds-py-2.5 cds-text-sm cds-font-bold cds-text-fg hover:cds-bg-highlight disabled:cds-cursor-not-allowed disabled:cds-opacity-50 disabled:hover:cds-bg-surface-elevated ${V}`,children:i.loading?"Looking up…":"Verify VIN"})]}),i.error?n.jsx("p",{id:h,className:Bs,role:"alert",children:i.error}):null]})}let M=Uu(e,x,!!o);if(M)return Yu({spec:M,id:_,question:e,options:x,value:t,values:s,invalid:!!r,describedBy:u,onChange:a,label:p});switch(e.inputType){case"radio":return n.jsx(Zu,{label:e.question,value:y,options:x,invalid:!!r,describedBy:u,onChange:a});case"select":return o?.loading&&!x.length?n.jsx("div",{className:`${F} cds-text-fg-muted`,"aria-live":"polite",children:"Loading options…"}):x.length?x.length>Gu?n.jsx(Xu,{id:_,label:e.question,value:y,options:x,invalid:!!r,describedBy:u,onChange:a,onOpen:o?.activate}):n.jsx(Qu,{id:_,label:e.question,value:y,options:x,invalid:!!r,describedBy:u,onChange:a,onOpen:o?.activate}):n.jsx("input",{id:_,type:"text",value:y,"aria-label":e.question,"aria-describedby":u,onFocus:o?.activate,onChange:C=>a(C.target.value),placeholder:"Type your answer",className:F});case"date":return e.key==="date_of_birth"||e.key==="co_applicant_date_of_birth"?n.jsx(ud,{id:_,hintId:u,value:y,onChange:C=>a(C)}):n.jsx("input",{id:_,type:"date",value:y,"aria-invalid":!!r||void 0,"aria-describedby":u,onChange:C=>a(C.target.value),className:`${F} ${r?"cds-border-destructive":""}`});case"number":{let C=La(e.key);return n.jsx("input",{id:_,type:"text",inputMode:"numeric",value:C?Ia(t,Va(e.key)):y,"aria-invalid":!!r||void 0,"aria-describedby":u,onChange:N=>{let A=N.target.value.replace(/[^\d]/g,"");a(A===""?"":Number(A))},className:`${F} ${r?"cds-border-destructive":""}`})}case"tel":return n.jsx("input",{id:_,type:"tel",inputMode:"tel",autoComplete:"tel",value:Ln(y),"aria-invalid":!!r||void 0,"aria-describedby":u,onChange:C=>a(Ln(C.target.value)),placeholder:"(512) 555-0134",className:`${F} ${r?"cds-border-destructive":""}`});case"email":return n.jsx("input",{id:_,type:"email",inputMode:"email",autoComplete:"email",value:y,"aria-invalid":!!r||void 0,"aria-describedby":u,onChange:C=>a(C.target.value),placeholder:"you@example.com",className:`${F} ${r?"cds-border-destructive":""}`});case"password":return n.jsx("input",{id:_,type:"password",autoComplete:"off",value:y,"aria-invalid":!!r||void 0,"aria-describedby":u,onChange:C=>a(C.target.value),className:`${F} ${r?"cds-border-destructive":""}`});case"textarea":return n.jsx("textarea",{id:_,rows:3,value:y,"aria-invalid":!!r||void 0,"aria-describedby":u,onChange:C=>a(C.target.value),className:`${F} ${r?"cds-border-destructive":""}`});default:return n.jsx("input",{id:_,type:"text",value:y,"aria-invalid":!!r||void 0,"aria-describedby":u,onChange:C=>a(C.target.value),className:`${F} ${r?"cds-border-destructive":""}`})}},k=Ua(e.key),w=Jt[e.key]??e.hint,j=e.key==="social_security_number"&&Ea(s)?[`${String(s.ssn_display).trim()}. Re-enter to update.`,w].filter(Boolean).join(" "):k===null?w:[w,`Typically ${k}% of your rebuild cost. Change it if needed.`].filter(Boolean).join(" ");return n.jsx(un,{label:m,hint:j,children:({id:_})=>n.jsxs(n.Fragment,{children:[b(_),n.jsx(gt,{id:v??"",message:r})]})})},Ih=ea({QuestionList:()=>kh}),ch={vehicles:{singular:"vehicle",plural:"Vehicles"},drivers:{singular:"driver",plural:"Drivers"},driver_accidents:{singular:"accident",plural:"Accidents"},driver_violations:{singular:"violation",plural:"Violations"},losses:{singular:"loss",plural:"Losses"},home_losses:{singular:"loss",plural:"Losses"}},lh=e=>ch[e]??{singular:"entry",plural:"Entries"},dh=[{heading:"Your current coverage",caption:"What you have today. Carriers rate on this history.",keys:new Set(["auto_prior_carrier_name","auto_prior_years","auto_prior_months","auto_continuous_coverage_years","auto_prior_expiration_date","auto_reason_for_no_insurance","auto_prior_liability_limit","auto_cancelled_declined_refused_to_renew"])},{heading:"Select your coverages",caption:"The limits on the policy you are quoting now.",keys:new Set(["policy_bi","policy_um","policy_pd","policy_mp","policy_umpd","policy_pip","policy_auto_death_indemnity","policy_pip_deductible","additional_pip","tort_threshold","pip_coverage_type","extended_medical"])},{heading:"Select your coverages for each vehicle",caption:"Deductibles and extras, per vehicle.",keys:new Set([Pa])}],uh=({heading:e,caption:t})=>n.jsxs("div",{className:"cds-mb-3 cds-mt-6 cds-border-t cds-border-border cds-pt-4 first:cds-mt-0 first:cds-border-t-0 first:cds-pt-0",children:[n.jsx("h3",{className:"cds-text-base cds-font-bold cds-text-fg",children:e}),n.jsx("p",{className:"cds-mt-0.5 cds-text-sm cds-text-fg-muted",children:t})]}),hh=e=>(e??[]).map(t=>({value:t,label:t})),fh=(e,t)=>{let[r,s]=g.useState({}),[a,o]=g.useState({}),i=g.useRef(new Set),c=g.useRef(Promise.resolve()),l=e.year?String(e.year):"",f=e.make?String(e.make):"",v=e.model?String(e.model):"",d=e.body_style?String(e.body_style):"",h=l?`make:${l}`:"",u=l&&f?`model:${l}|${f}`:"",p=l&&f&&v?`body:${l}|${f}|${v}`:"",m=g.useCallback((x,b,k)=>{!x||!t||i.current.has(x)||(i.current.add(x),o(w=>({...w,[x]:!0})),c.current=c.current.then(()=>la(b,t)).then(w=>{s(j=>({...j,[x]:hh(k(w))}))}).catch(()=>{s(w=>({...w,[x]:[]}))}).finally(()=>{o(w=>{let j={...w};return delete j[x],j})}))},[t]),y=g.useCallback(x=>{x==="make"?m(h,{year:l},b=>b.makes):x==="model"?m(u,{year:l,make:f},b=>b.models):m(p,{year:l,make:f,model:v},b=>b.bodyStyles)},[m,h,u,p,l,f,v]);return g.useEffect(()=>{l&&(f?v?d||y("body_style"):y("model"):y("make"))},[l,f,v,d,y]),{options:{make:r[h],model:r[u],body_style:r[p]},loading:{make:!!a[h],model:!!a[u],body_style:!!a[p]},ensure:y}},ph=(e,t)=>{let[r,s]=g.useState(!1),[a,o]=g.useState(void 0);return{run:g.useCallback(i=>{!e||r||!Ir(i)||(s(!0),o(void 0),da(i.trim().toUpperCase(),e).then(c=>{if(c.error){o(c.error);return}let l={};if(c.year&&(l.year=String(c.year)),c.make&&(l.make=c.make),c.model&&(l.model=c.model),c.bodyStyle&&(l.body_style=c.bodyStyle),!Object.keys(l).length){o("We couldn't read that VIN — please pick the vehicle details below.");return}t(l)}).catch(()=>o("VIN lookup failed — please pick the vehicle details below.")).finally(()=>s(!1)))},[e,r,t]),loading:r,error:a}},mh=(e,t,r,s)=>{let a=Ca(t,"drivers"),o=g.useCallback(i=>Br({kind:e,source:a[i]??{},targetQuestions:r}),[e,a,r]);return{candidates:g.useMemo(()=>za(t,{exclude:s}).filter(i=>Object.keys(o(i.index)).length>0),[t,o,s]),patchFor:o}},vh=({values:e,targetQuestions:t,onPatch:r})=>{let s=ya(e),{candidates:a,patchFor:o}=mh("coApplicant",e,t,g.useCallback((i,c)=>c===s,[s]));return a.length?n.jsx(Ha,{heading:"Is the co-applicant one of your drivers?",body:"We'll reuse their name, date of birth and details from the driver you entered.",applyLabel:"Use these details",candidates:a,onApply:i=>{let c=o(i);return r(c),Object.keys(c).length}}):null},gh=({entry:e,rootValues:t,targetQuestions:r,onPatch:s})=>{let a=g.useMemo(()=>Br({kind:"driverFromApplicant",source:t,targetQuestions:r}),[t,r]),o=Wa(t);return xa(t)||!ba(e)||!Object.keys(a).length?null:n.jsxs("button",{type:"button",onClick:()=>s(a),className:`cds-inline-flex cds-items-center cds-gap-1 cds-rounded cds-px-2 cds-py-1 cds-text-xs cds-font-semibold cds-text-fg hover:cds-bg-highlight ${V}`,children:[n.jsx(qa,{"aria-hidden":"true",className:"cds-h-3.5 cds-w-3.5"}),o?`This is me (${o})`:"This is me"]})},yh=({groupKey:e,itemQuestions:t,items:r,rootValues:s,stageKey:a,quoteId:o,itemErrors:i,onChange:c})=>{let{singular:l,plural:f}=lh(e),v=(h,u)=>{c(r.map((p,m)=>m===h?{...p,...u}:p))},d=h=>{c(r.filter((u,p)=>p!==h))};return n.jsxs("section",{className:"cds-mb-6 cds-rounded-xl cds-border cds-border-border cds-bg-surface-muted/60 cds-p-4",children:[n.jsx("h3",{className:"cds-mb-3 cds-text-sm cds-font-bold cds-uppercase cds-tracking-wide cds-text-fg",children:f}),r.map((h,u)=>n.jsx(xh,{index:u,singular:l,groupKey:e,item:h,itemQuestions:t,rootValues:s,stageKey:a,quoteId:o,errors:i.find(p=>p.index===u)?.errorsByKey??{},canRemove:r.length>1||e!=="drivers",onPatch:p=>v(u,p),onRemove:()=>d(u)},u)),n.jsxs("button",{type:"button",onClick:()=>c([...r,{}]),className:`cds-inline-flex cds-items-center cds-gap-1.5 cds-rounded-lg cds-border cds-border-accent cds-bg-surface-elevated cds-px-4 cds-py-2 cds-text-sm cds-font-bold cds-text-fg hover:cds-bg-highlight ${V}`,children:[n.jsx(Kr,{"aria-hidden":"true",className:"cds-h-4 cds-w-4"}),"Add ",r.length?`another ${l}`:l]})]})},xh=({index:e,singular:t,groupKey:r,item:s,itemQuestions:a,rootValues:o,stageKey:i,quoteId:c,errors:l,canRemove:f,onPatch:v,onRemove:d})=>{let h=r==="vehicles",u=fh(h?s:{},c),p=ph(c,v),m=g.useMemo(()=>Sa(a,s,o,i,e),[a,s,o,i,e]),y=g.useMemo(()=>new Set(m.map(x=>x.key)),[m]);return n.jsxs("div",{className:"cds-mb-4 cds-rounded-lg cds-border cds-border-border cds-bg-surface-elevated cds-p-4",children:[n.jsxs("div",{className:"cds-mb-3 cds-flex cds-items-center cds-justify-between",children:[n.jsxs("h4",{className:"cds-text-sm cds-font-bold cds-text-fg",children:[t.charAt(0).toUpperCase()+t.slice(1)," ",e+1]}),r==="drivers"&&e===0?n.jsx(gh,{entry:s,rootValues:o,targetQuestions:m,onPatch:v}):null,f?n.jsxs("button",{type:"button",onClick:d,className:`cds-inline-flex cds-items-center cds-gap-1 cds-rounded cds-px-2 cds-py-1 cds-text-xs cds-font-semibold cds-text-destructive hover:cds-bg-destructive/10 ${V}`,children:[n.jsx(oi,{"aria-hidden":"true",className:"cds-h-3.5 cds-w-3.5"}),"Remove"]}):null]}),n.jsx(zs,{questions:a,values:s,rootValues:o,visibleKeys:y,errors:l,itemErrors:[],stageKey:i,quoteId:c,cascade:h?u:void 0,vinDecode:h&&c?p:void 0,onPatch:v})]})},bh=({vehicles:e,drivers:t,assignments:r,state:s,itemErrors:a,onChange:o,onAssign:i})=>{let c=g.useMemo(()=>$a(s),[s]),l=t.length>1;if(!e.length)return n.jsx("p",{className:"cds-mb-4 cds-text-sm cds-text-fg-muted",children:"Add a vehicle first to choose its coverage."});let f=(v,d,h)=>{o(e.map((u,p)=>p===v?{...u,[d]:h}:u))};return n.jsx("div",{className:"cds-mb-4",children:e.map((v,d)=>{let h=Ra(v,d),u=a.find(m=>m.index===d)?.errorsByKey??{},p=u[Vr];return n.jsxs("fieldset",{className:`cds-mb-4 cds-rounded-lg cds-border cds-bg-surface-elevated cds-p-4 last:cds-mb-0 ${p?"cds-border-destructive":"cds-border-border"}`,children:[n.jsx("legend",{className:"cds-px-1 cds-text-sm cds-font-bold cds-text-fg",children:h}),Oa.map(m=>n.jsx(Hs,{question:{question:Ta[m],key:m,required:!0,inputType:"select",options:c[m]},required:!0,value:v[m],error:u[m],values:v,onChange:y=>f(d,m,y)},m)),l?n.jsxs("div",{className:"cds-mt-2 cds-border-t cds-border-border cds-pt-3",children:[n.jsxs("p",{className:"cds-mb-2 cds-text-sm cds-font-semibold cds-text-fg",children:["Who drives this one? ",n.jsx("span",{className:"cds-font-normal cds-text-fg-muted",children:"(share of use, totalling 100%)"})]}),n.jsx("div",{className:"cds-flex cds-flex-wrap cds-gap-3",children:t.map((m,y)=>{let x=[m.first_name,m.last_name].filter(Boolean).join(" ")||`Driver ${y+1}`,b=`usage-v${d}-d${y}`,k=Fa(r,d,y);return n.jsxs("div",{className:"cds-w-32",children:[n.jsx("label",{htmlFor:b,className:"cds-mb-1 cds-block cds-text-xs cds-font-semibold cds-text-fg-muted",children:x}),n.jsxs("div",{className:"cds-flex cds-items-center cds-gap-1",children:[n.jsx("input",{id:b,type:"text",inputMode:"numeric",value:k??"","aria-invalid":!!p||void 0,onChange:w=>{let j=w.target.value.replace(/\D/g,"");i(Da(r,d,y,j===""?0:Math.min(100,Number(j))))},className:`${F} ${p?"cds-border-destructive":""}`}),n.jsx("span",{"aria-hidden":"true",className:"cds-text-sm cds-text-fg-muted",children:"%"})]})]},b)})}),p?n.jsx("p",{className:"cds-mt-2 cds-text-sm cds-text-destructive",role:"alert",children:p}):null]}):null]},d)})})},zs=({questions:e,values:t,rootValues:r,visibleKeys:s,rootVisible:a=[],errors:o,itemErrors:i,stageKey:c,quoteId:l,cascade:f,vinDecode:v,onPatch:d})=>{let h=g.useMemo(()=>wa(e),[e]),u=t===r,p=g.useMemo(()=>{if(!u)return new Map;let y=new Map;for(let x of dh){let b=h.find(k=>x.keys.has(k.key)&&s.has(k.key));b&&y.set(b.key,x)}return y},[h,s,u]),m=y=>y.flatMap(x=>{let b=x.key,k=ja(x),w=_a(x);if(!w&&!s.has(b))return[];let j=[];b==="co_applicant_first_name"&&u&&j.push(n.jsx(vh,{values:r,targetQuestions:a,onPatch:d},`${b}-copy`));let _=p.get(b);if(_&&j.push(n.jsx(uh,{heading:_.heading,caption:_.caption},`${b}-section`)),b==="vehicle_policy_selections"){let M=C=>Array.isArray(C)?C:[];return j.push(n.jsx(bh,{vehicles:M(r[Ie("vehicles")]),drivers:M(r[Ie("drivers")]),assignments:Aa(r),state:r.state,itemErrors:i.filter(C=>C.groupKey==="vehicles"),onChange:C=>d({[Ie("vehicles")]:C}),onAssign:C=>d({[Vr]:C})},b)),j}if(!w){let M=b==="make"||b==="model"||b==="body_style"?b:void 0;j.push(x.inputType==="address"?n.jsx(pd,{question:x,values:t,error:o[b],onPatch:d},b):n.jsx(Hs,{question:x,value:t[b],error:o[b],values:t,required:Na(x,t===r?t:Ba(r,t)),asyncSelect:M&&f?{options:f.options[M],loading:f.loading[M],activate:()=>f.ensure(M)}:void 0,vinDecode:b==="vin"?v:void 0,onChange:C=>{let N={[b]:C};b==="year"&&Object.assign(N,{make:"",model:"",body_style:""}),b==="make"&&Object.assign(N,{model:"",body_style:""}),b==="model"&&Object.assign(N,{body_style:""}),(b==="industry"||b==="employment_industry")&&(N.occupation=""),b==="dwelling_replacement_cost"&&Object.assign(N,Ka(t,C)),Object.assign(N,Ya(t,b,C)),d(N)}},b))}if(k&&(w||t[b]===k.conditionalValue)){let M=t[Ie(b)],C=Array.isArray(M)?M:[];j.push(n.jsx(yh,{groupKey:b,itemQuestions:k.conditionalQuestions??[],items:C.length?C:[{}],rootValues:r,stageKey:c,quoteId:l,itemErrors:i.filter(N=>N.groupKey===b),onChange:N=>d({[Ie(b)]:N})},`${b}-group`))}return Ma(x,t).forEach(M=>{if(M.conditionalQuestionsAllowMultiple)return;let C=M.conditionalQuestions??[];C.length&&j.push(n.jsx("div",{className:"cds-mb-2 cds-border-l-2 cds-border-accent/40 cds-pl-4",children:m(C)},`${b}-branch`))}),j});return n.jsx(n.Fragment,{children:m(h)})},kh=({questions:e,values:t,errors:r,itemErrors:s,stageKey:a,quoteId:o,suppressedKeys:i,onPatch:c})=>{let l=g.useMemo(()=>ka(e,t,a),[e,t,a]),f=g.useMemo(()=>new Set(l.map(d=>d.key).filter(d=>!i?.has(d))),[l,i]),v=g.useCallback(d=>c(d),[c]);return n.jsx(zs,{questions:e,values:t,rootValues:t,visibleKeys:f,rootVisible:l,errors:r,itemErrors:s,stageKey:a,quoteId:o,onPatch:v})};export{pd as a,ld as c,Mt as d,$n as f,md as i,br as l,Ih as n,ud as o,Fs as p,Hs as r,ht as s,kh as t,An as u};
|