@jpmorgan-payments/embedded-finance-components 0.6.21 → 0.6.22

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 CHANGED
@@ -202,7 +202,7 @@ The `OnboardingWizardBasic` component implements the client onboarding process a
202
202
  | ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------------------------------------------------- |
203
203
  | `initialClientId` | `string` | No | Initial client ID for existing client onboarding |
204
204
  | `onSetClientId` | `(clientId: string) => Promise<void>` | No | Callback function when client ID is set |
205
- | `onGetClient` | `(clientData: ClientResponse \| undefined, status: 'success' \| 'pending' \| 'error', error: ErrorType<SchemasApiError> \| null) => void` | No | Callback function triggered when client data is fetched |
205
+ | `onGetClientSettled` | `(clientData: ClientResponse \| undefined, status: 'success' \| 'pending' \| 'error', error: ErrorType<SchemasApiError> \| null) => void` | No | Callback function triggered when client data is fetched |
206
206
  | `onPostClientSettled` | `(response?: ClientResponse, error?: ApiError) => void` | No | Callback function for client creation response |
207
207
  | `onPostPartySettled` | `(response?: PartyResponse, error?: ApiError) => void` | No | Callback function for party creation response |
208
208
  | `onPostClientVerificationsSettled` | `(response?: ClientVerificationResponse, error?: ApiError) => void` | No | Callback function for client verification response |
@@ -1,7 +1,7 @@
1
1
  var ps = Object.defineProperty;
2
2
  var ws = (e, t, n) => t in e ? ps(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var Le = (e, t, n) => ws(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { g as xs, c as M, a as m, b as be, d as K, o as Ot, e as B, P as qo, S as N, t as P, i as E, f as H, h as I, j as $s, k as tr, u as pe, l as G, s as Nn, m as Un, n as rt, p as T, q as Cs, r as kn, v as Ke, w as Ss, x as Dt, y as Tt, z as ks, A as Es, B as mn, F as Ds, C as zr, D as Ft, $ as Ro, E as Ms, G as As, H as j, I as Br, J as Ts, K as nr, L as Fs, M as Is, N as _n, O as Ls, Q as Os, R as te, T as Ps, U as _s } from "./production-WY2ExuKH.js";
4
+ import { g as xs, c as M, a as m, b as be, d as K, o as Ot, e as B, P as qo, S as N, t as P, i as E, f as H, h as I, j as $s, k as tr, u as pe, l as G, s as Nn, m as Un, n as rt, p as T, q as Cs, r as kn, v as Ke, w as Ss, x as Dt, y as Tt, z as ks, A as Es, B as mn, F as Ds, C as zr, D as Ft, $ as Ro, E as Ms, G as As, H as j, I as Br, J as Ts, K as nr, L as Fs, M as Is, N as _n, O as Ls, Q as Os, R as te, T as Ps, U as _s } from "./production-D0M-oirb.js";
5
5
  var Ko = {
6
6
  À: "A",
7
7
  Á: "A",
@@ -1,4 +1,4 @@
1
- import { E as s, L as i, M as o, a as e, O as r, T as t, i as d } from "../index-Ds6PV6kN.js";
1
+ import { E as s, L as i, M as o, a as e, O as r, T as t, i as d } from "../index-Ch6OZaya.js";
2
2
  export {
3
3
  s as EBComponentsProvider,
4
4
  i as LinkedAccountWidget,
@@ -50203,7 +50203,7 @@ const Wh = new Xoe(), dY = Hn(void 0), pY = Hn({
50203
50203
  }), Y_ = B$.NODE_ENV === "development" ? Lte(
50204
50204
  () => import(
50205
50205
  // eslint-disable-next-line import/extensions
50206
- "./production-WY2ExuKH.js"
50206
+ "./production-D0M-oirb.js"
50207
50207
  ).then((e) => e.V).then((e) => ({
50208
50208
  default: e.ReactQueryDevtools
50209
50209
  }))
@@ -92591,7 +92591,7 @@ const $p = [
92591
92591
  userEventsToTrack: r = [],
92592
92592
  userEventsHandler: i,
92593
92593
  height: a,
92594
- onGetClient: o,
92594
+ onGetClientSettledSettled: o,
92595
92595
  ...s
92596
92596
  }) => {
92597
92597
  var S, I;
package/dist/index.d.ts CHANGED
@@ -4515,7 +4515,7 @@ export declare type OnboardingConfigDefault = {
4515
4515
  };
4516
4516
 
4517
4517
  export declare type OnboardingConfigUsedInContext = {
4518
- onGetClient?: (clientData: ClientResponse | undefined, status: 'success' | 'pending' | 'error', error: ErrorType<SchemasApiError> | null) => void;
4518
+ onGetClientSettledSettled?: (clientData: ClientResponse | undefined, status: 'success' | 'pending' | 'error', error: ErrorType<SchemasApiError> | null) => void;
4519
4519
  onPostClientSettled?: (response?: ClientResponse, error?: ApiError) => void;
4520
4520
  onPostPartySettled?: (response?: PartyResponse, error?: ApiError) => void;
4521
4521
  onPostClientVerificationsSettled?: (response?: ClientVerificationResponse, error?: ApiError) => void;
@@ -4,7 +4,7 @@ var Ye = (e) => {
4
4
  var Ze = (e, t, n) => t.has(e) || Ye("Cannot " + n);
5
5
  var v = (e, t, n) => (Ze(e, t, "read from private field"), n ? n.call(e) : t.get(e)), T = (e, t, n) => t.has(e) ? Ye("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), C = (e, t, n, r) => (Ze(e, t, "write to private field"), r ? r.call(e, n) : t.set(e, n), n);
6
6
  import * as _ from "react";
7
- import { u as jt, o as $t, j as _t } from "./index-Ds6PV6kN.js";
7
+ import { u as jt, o as $t, j as _t } from "./index-Ch6OZaya.js";
8
8
  var d = {
9
9
  context: void 0,
10
10
  registry: void 0,
@@ -1853,7 +1853,7 @@ var Br = (e, t = !1) => {
1853
1853
  const t = vn(() => {
1854
1854
  const n = this, [r] = v(this, W), [s] = v(this, Y), [i] = v(this, Z), [o] = v(this, J), [l] = v(this, Q);
1855
1855
  let a;
1856
- return v(this, ee) ? a = v(this, ee) : (a = ln(() => import("./2FJCTAHO-Cd2bvYPz.js")), C(this, ee, a)), dr(v(this, ge), v(this, X)), nn(a, sn({
1856
+ return v(this, ee) ? a = v(this, ee) : (a = ln(() => import("./2FJCTAHO-Dit0ZCcq.js")), C(this, ee, a)), dr(v(this, ge), v(this, X)), nn(a, sn({
1857
1857
  get queryFlavor() {
1858
1858
  return v(n, de);
1859
1859
  },
@@ -7780,7 +7780,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
7780
7780
  `)},Mze=0,p2=[];function Ize(e){var t=k.useRef([]),n=k.useRef([0,0]),r=k.useRef(),i=k.useState(Mze++)[0],o=k.useState(rie)[0],a=k.useRef(e);k.useEffect(function(){a.current=e},[e]),k.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var y=EO([e.lockRef.current],(e.shards||[]).map(uie),!0).filter(Boolean);return y.forEach(function(v){return v.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),y.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var s=k.useCallback(function(y,v){if("touches"in y&&y.touches.length===2||y.type==="wheel"&&y.ctrlKey)return!a.current.allowPinchZoom;var x=R$(y),w=n.current,C="deltaX"in y?y.deltaX:w[0]-x[0],M="deltaY"in y?y.deltaY:w[1]-x[1],S,I=y.target,L=Math.abs(C)>Math.abs(M)?"h":"v";if("touches"in y&&L==="h"&&I.type==="range")return!1;var E=aie(L,I);if(!E)return!0;if(E?S=L:(S=L==="v"?"h":"v",E=aie(L,I)),!E)return!1;if(!r.current&&"changedTouches"in y&&(C||M)&&(r.current=S),!S)return!0;var N=r.current||S;return kze(N,v,y,N==="h"?C:M)},[]),l=k.useCallback(function(y){var v=y;if(!(!p2.length||p2[p2.length-1]!==o)){var x="deltaY"in v?cie(v):R$(v),w=t.current.filter(function(S){return S.name===v.type&&(S.target===v.target||v.target===S.shadowParent)&&Cze(S.delta,x)})[0];if(w&&w.should){v.cancelable&&v.preventDefault();return}if(!w){var C=(a.current.shards||[]).map(uie).filter(Boolean).filter(function(S){return S.contains(v.target)}),M=C.length>0?s(v,C[0]):!a.current.noIsolation;M&&v.cancelable&&v.preventDefault()}}},[]),d=k.useCallback(function(y,v,x,w){var C={name:y,delta:v,target:x,should:w,shadowParent:Lze(x)};t.current.push(C),setTimeout(function(){t.current=t.current.filter(function(M){return M!==C})},1)},[]),p=k.useCallback(function(y){n.current=R$(y),r.current=void 0},[]),h=k.useCallback(function(y){d(y.type,cie(y),y.target,s(y,e.lockRef.current))},[]),f=k.useCallback(function(y){d(y.type,R$(y),y.target,s(y,e.lockRef.current))},[]);k.useEffect(function(){return p2.push(o),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:f}),document.addEventListener("wheel",l,d2),document.addEventListener("touchmove",l,d2),document.addEventListener("touchstart",p,d2),function(){p2=p2.filter(function(y){return y!==o}),document.removeEventListener("wheel",l,d2),document.removeEventListener("touchmove",l,d2),document.removeEventListener("touchstart",p,d2)}},[]);var m=e.removeScrollBar,b=e.inert;return k.createElement(k.Fragment,null,b?k.createElement(o,{styles:Sze(i)}):null,m?k.createElement(mze,{gapMode:e.gapMode}):null)}function Lze(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Eze=rze(nie,Ize);var die=k.forwardRef(function(e,t){return k.createElement(z$,En({},e,{ref:t,sideCar:Eze}))});die.classNames=z$.classNames;var TH=["Enter"," "],Aze=["ArrowDown","PageUp","Home"],pie=["ArrowUp","PageDown","End"],Dze=[...Aze,...pie],Tze={ltr:[...TH,"ArrowRight"],rtl:[...TH,"ArrowLeft"]},Nze={ltr:["ArrowLeft"],rtl:["ArrowRight"]},rf="Menu",[of,Fze,$ze]=MOe(rf),[a1,hie]=hH(rf,[$ze,Fre,Kre]),H$=Fre(),fie=Kre(),[Pze,s1]=a1(rf),[Oze,af]=a1(rf),mie=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:o,modal:a=!0}=e,s=H$(t),[l,d]=k.useState(null),p=k.useRef(!1),h=js(o),f=LOe(i);return k.useEffect(()=>{const m=()=>{p.current=!0,document.addEventListener("pointerdown",b,{capture:!0,once:!0}),document.addEventListener("pointermove",b,{capture:!0,once:!0})},b=()=>p.current=!1;return document.addEventListener("keydown",m,{capture:!0}),()=>{document.removeEventListener("keydown",m,{capture:!0}),document.removeEventListener("pointerdown",b,{capture:!0}),document.removeEventListener("pointermove",b,{capture:!0})}},[]),u.jsx(cje,{...s,children:u.jsx(Pze,{scope:t,open:n,onOpenChange:h,content:l,onContentChange:d,children:u.jsx(Oze,{scope:t,onClose:k.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:p,dir:f,modal:a,children:r})})})};mie.displayName=rf;var jze="MenuAnchor",NH=k.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=H$(n);return u.jsx(uje,{...i,...r,ref:t})});NH.displayName=jze;var FH="MenuPortal",[zze,gie]=a1(FH,{forceMount:void 0}),yie=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:i}=e,o=s1(FH,t);return u.jsx(zze,{scope:t,forceMount:n,children:u.jsx(nf,{present:n||o.open,children:u.jsx(qre,{asChild:!0,container:i,children:r})})})};yie.displayName=FH;var Xi="MenuContent",[_ze,$H]=a1(Xi),bie=k.forwardRef((e,t)=>{const n=gie(Xi,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,o=s1(Xi,e.__scopeMenu),a=af(Xi,e.__scopeMenu);return u.jsx(of.Provider,{scope:e.__scopeMenu,children:u.jsx(nf,{present:r||o.open,children:u.jsx(of.Slot,{scope:e.__scopeMenu,children:a.modal?u.jsx(Rze,{...i,ref:t}):u.jsx(Hze,{...i,ref:t})})})})}),Rze=k.forwardRef((e,t)=>{const n=s1(Xi,e.__scopeMenu),r=k.useRef(null),i=Ni(t,r);return k.useEffect(()=>{const o=r.current;if(o)return Kje(o)},[]),u.jsx(PH,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:An(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Hze=k.forwardRef((e,t)=>{const n=s1(Xi,e.__scopeMenu);return u.jsx(PH,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),qze=T$("MenuContent.ScrollLock"),PH=k.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:a,disableOutsidePointerEvents:s,onEntryFocus:l,onEscapeKeyDown:d,onPointerDownOutside:p,onFocusOutside:h,onInteractOutside:f,onDismiss:m,disableOutsideScroll:b,...y}=e,v=s1(Xi,n),x=af(Xi,n),w=H$(n),C=fie(n),M=Fze(n),[S,I]=k.useState(null),L=k.useRef(null),E=Ni(t,L,v.onContentChange),N=k.useRef(0),P=k.useRef(""),z=k.useRef(0),T=k.useRef(null),$=k.useRef("right"),H=k.useRef(0),O=b?die:k.Fragment,R=b?{as:qze,allowPinchZoom:!0}:void 0,B=G=>{var Z,X;const j=P.current+G,U=M().filter(se=>!se.disabled),D=document.activeElement,A=(Z=U.find(se=>se.ref.current===D))==null?void 0:Z.textValue,F=U.map(se=>se.textValue),_=e_e(F,j,A),W=(X=U.find(se=>se.textValue===_))==null?void 0:X.ref.current;(function se(pe){P.current=pe,window.clearTimeout(N.current),pe!==""&&(N.current=window.setTimeout(()=>se(""),1e3))})(j),W&&setTimeout(()=>W.focus())};k.useEffect(()=>()=>window.clearTimeout(N.current),[]),jOe();const V=k.useCallback(G=>{var U,D;return $.current===((U=T.current)==null?void 0:U.side)&&n_e(G,(D=T.current)==null?void 0:D.area)},[]);return u.jsx(_ze,{scope:n,searchRef:P,onItemEnter:k.useCallback(G=>{V(G)&&G.preventDefault()},[V]),onItemLeave:k.useCallback(G=>{var j;V(G)||((j=L.current)==null||j.focus(),I(null))},[V]),onTriggerLeave:k.useCallback(G=>{V(G)&&G.preventDefault()},[V]),pointerGraceTimerRef:z,onPointerGraceIntentChange:k.useCallback(G=>{T.current=G},[]),children:u.jsx(O,{...R,children:u.jsx(Mre,{asChild:!0,trapped:i,onMountAutoFocus:An(o,G=>{var j;G.preventDefault(),(j=L.current)==null||j.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:u.jsx(xre,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:d,onPointerDownOutside:p,onFocusOutside:h,onInteractOutside:f,onDismiss:m,children:u.jsx(Bje,{asChild:!0,...C,dir:x.dir,orientation:"vertical",loop:r,currentTabStopId:S,onCurrentTabStopIdChange:I,onEntryFocus:An(l,G=>{x.isUsingKeyboardRef.current||G.preventDefault()}),preventScrollOnEntryFocus:!0,children:u.jsx(dje,{role:"menu","aria-orientation":"vertical","data-state":Pie(v.open),"data-radix-menu-content":"",dir:x.dir,...w,...y,ref:E,style:{outline:"none",...y.style},onKeyDown:An(y.onKeyDown,G=>{const U=G.target.closest("[data-radix-menu-content]")===G.currentTarget,D=G.ctrlKey||G.altKey||G.metaKey,A=G.key.length===1;U&&(G.key==="Tab"&&G.preventDefault(),!D&&A&&B(G.key));const F=L.current;if(G.target!==F||!Dze.includes(G.key))return;G.preventDefault();const W=M().filter(Z=>!Z.disabled).map(Z=>Z.ref.current);pie.includes(G.key)&&W.reverse(),Qze(W)}),onBlur:An(e.onBlur,G=>{G.currentTarget.contains(G.target)||(window.clearTimeout(N.current),P.current="")}),onPointerMove:An(e.onPointerMove,lf(G=>{const j=G.target,U=H.current!==G.clientX;if(G.currentTarget.contains(j)&&U){const D=G.clientX>H.current?"right":"left";$.current=D,H.current=G.clientX}}))})})})})})})});bie.displayName=Xi;var Bze="MenuGroup",OH=k.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return u.jsx(Lo.div,{role:"group",...r,ref:t})});OH.displayName=Bze;var Vze="MenuLabel",vie=k.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return u.jsx(Lo.div,{...r,ref:t})});vie.displayName=Vze;var q$="MenuItem",xie="menu.itemSelect",B$=k.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...i}=e,o=k.useRef(null),a=af(q$,e.__scopeMenu),s=$H(q$,e.__scopeMenu),l=Ni(t,o),d=k.useRef(!1),p=()=>{const h=o.current;if(!n&&h){const f=new CustomEvent(xie,{bubbles:!0,cancelable:!0});h.addEventListener(xie,m=>r==null?void 0:r(m),{once:!0}),yre(h,f),f.defaultPrevented?d.current=!1:a.onClose()}};return u.jsx(wie,{...i,ref:l,disabled:n,onClick:An(e.onClick,p),onPointerDown:h=>{var f;(f=e.onPointerDown)==null||f.call(e,h),d.current=!0},onPointerUp:An(e.onPointerUp,h=>{var f;d.current||(f=h.currentTarget)==null||f.click()}),onKeyDown:An(e.onKeyDown,h=>{const f=s.searchRef.current!=="";n||f&&h.key===" "||TH.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});B$.displayName=q$;var wie=k.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...o}=e,a=$H(q$,n),s=fie(n),l=k.useRef(null),d=Ni(t,l),[p,h]=k.useState(!1),[f,m]=k.useState("");return k.useEffect(()=>{const b=l.current;b&&m((b.textContent??"").trim())},[o.children]),u.jsx(of.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:u.jsx(Vje,{asChild:!0,...s,focusable:!r,children:u.jsx(Lo.div,{role:"menuitem","data-highlighted":p?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...o,ref:d,onPointerMove:An(e.onPointerMove,lf(b=>{r?a.onItemLeave(b):(a.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:An(e.onPointerLeave,lf(b=>a.onItemLeave(b))),onFocus:An(e.onFocus,()=>h(!0)),onBlur:An(e.onBlur,()=>h(!1))})})})}),Uze="MenuCheckboxItem",kie=k.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...i}=e;return u.jsx(Lie,{scope:e.__scopeMenu,checked:n,children:u.jsx(B$,{role:"menuitemcheckbox","aria-checked":V$(n)?"mixed":n,...i,ref:t,"data-state":zH(n),onSelect:An(i.onSelect,()=>r==null?void 0:r(V$(n)?!0:!n),{checkForDefaultPrevented:!1})})})});kie.displayName=Uze;var Cie="MenuRadioGroup",[Gze,Wze]=a1(Cie,{value:void 0,onValueChange:()=>{}}),Sie=k.forwardRef((e,t)=>{const{value:n,onValueChange:r,...i}=e,o=js(r);return u.jsx(Gze,{scope:e.__scopeMenu,value:n,onValueChange:o,children:u.jsx(OH,{...i,ref:t})})});Sie.displayName=Cie;var Mie="MenuRadioItem",Iie=k.forwardRef((e,t)=>{const{value:n,...r}=e,i=Wze(Mie,e.__scopeMenu),o=n===i.value;return u.jsx(Lie,{scope:e.__scopeMenu,checked:o,children:u.jsx(B$,{role:"menuitemradio","aria-checked":o,...r,ref:t,"data-state":zH(o),onSelect:An(r.onSelect,()=>{var a;return(a=i.onValueChange)==null?void 0:a.call(i,n)},{checkForDefaultPrevented:!1})})})});Iie.displayName=Mie;var jH="MenuItemIndicator",[Lie,Kze]=a1(jH,{checked:!1}),Eie=k.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...i}=e,o=Kze(jH,n);return u.jsx(nf,{present:r||V$(o.checked)||o.checked===!0,children:u.jsx(Lo.span,{...i,ref:t,"data-state":zH(o.checked)})})});Eie.displayName=jH;var Yze="MenuSeparator",Aie=k.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return u.jsx(Lo.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});Aie.displayName=Yze;var Zze="MenuArrow",Die=k.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=H$(n);return u.jsx(pje,{...i,...r,ref:t})});Die.displayName=Zze;var Xze="MenuSub",[fXe,Tie]=a1(Xze),sf="MenuSubTrigger",Nie=k.forwardRef((e,t)=>{const n=s1(sf,e.__scopeMenu),r=af(sf,e.__scopeMenu),i=Tie(sf,e.__scopeMenu),o=$H(sf,e.__scopeMenu),a=k.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:l}=o,d={__scopeMenu:e.__scopeMenu},p=k.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return k.useEffect(()=>p,[p]),k.useEffect(()=>{const h=s.current;return()=>{window.clearTimeout(h),l(null)}},[s,l]),u.jsx(NH,{asChild:!0,...d,children:u.jsx(wie,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":Pie(n.open),...e,ref:fH(t,i.onTriggerChange),onClick:h=>{var f;(f=e.onClick)==null||f.call(e,h),!(e.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:An(e.onPointerMove,lf(h=>{o.onItemEnter(h),!h.defaultPrevented&&!e.disabled&&!n.open&&!a.current&&(o.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{n.onOpenChange(!0),p()},100))})),onPointerLeave:An(e.onPointerLeave,lf(h=>{var m,b;p();const f=(m=n.content)==null?void 0:m.getBoundingClientRect();if(f){const y=(b=n.content)==null?void 0:b.dataset.side,v=y==="right",x=v?-5:5,w=f[v?"left":"right"],C=f[v?"right":"left"];o.onPointerGraceIntentChange({area:[{x:h.clientX+x,y:h.clientY},{x:w,y:f.top},{x:C,y:f.top},{x:C,y:f.bottom},{x:w,y:f.bottom}],side:y}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(h),h.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:An(e.onKeyDown,h=>{var m;const f=o.searchRef.current!=="";e.disabled||f&&h.key===" "||Tze[r.dir].includes(h.key)&&(n.onOpenChange(!0),(m=n.content)==null||m.focus(),h.preventDefault())})})})});Nie.displayName=sf;var Fie="MenuSubContent",$ie=k.forwardRef((e,t)=>{const n=gie(Xi,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,o=s1(Xi,e.__scopeMenu),a=af(Xi,e.__scopeMenu),s=Tie(Fie,e.__scopeMenu),l=k.useRef(null),d=Ni(t,l);return u.jsx(of.Provider,{scope:e.__scopeMenu,children:u.jsx(nf,{present:r||o.open,children:u.jsx(of.Slot,{scope:e.__scopeMenu,children:u.jsx(PH,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:d,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:p=>{var h;a.isUsingKeyboardRef.current&&((h=l.current)==null||h.focus()),p.preventDefault()},onCloseAutoFocus:p=>p.preventDefault(),onFocusOutside:An(e.onFocusOutside,p=>{p.target!==s.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:An(e.onEscapeKeyDown,p=>{a.onClose(),p.preventDefault()}),onKeyDown:An(e.onKeyDown,p=>{var m;const h=p.currentTarget.contains(p.target),f=Nze[a.dir].includes(p.key);h&&f&&(o.onOpenChange(!1),(m=s.trigger)==null||m.focus(),p.preventDefault())})})})})})});$ie.displayName=Fie;function Pie(e){return e?"open":"closed"}function V$(e){return e==="indeterminate"}function zH(e){return V$(e)?"indeterminate":e?"checked":"unchecked"}function Qze(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Jze(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function e_e(e,t,n){const i=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let a=Jze(e,Math.max(o,0));i.length===1&&(a=a.filter(d=>d!==n));const l=a.find(d=>d.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function t_e(e,t){const{x:n,y:r}=e;let i=!1;for(let o=0,a=t.length-1;o<t.length;a=o++){const s=t[o].x,l=t[o].y,d=t[a].x,p=t[a].y;l>r!=p>r&&n<(d-s)*(r-l)/(p-l)+s&&(i=!i)}return i}function n_e(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return t_e(n,t)}function lf(e){return t=>t.pointerType==="mouse"?e(t):void 0}var r_e=mie,i_e=NH,o_e=yie,a_e=bie,s_e=OH,l_e=vie,c_e=B$,u_e=kie,d_e=Sie,p_e=Iie,h_e=Eie,f_e=Aie,m_e=Die,g_e=Nie,y_e=$ie,b_e=globalThis!=null&&globalThis.document?k.useLayoutEffect:()=>{},v_e=k[" useId ".trim().toString()]||(()=>{}),x_e=0;function Oie(e){const[t,n]=k.useState(v_e());return b_e(()=>{n(r=>r??String(x_e++))},[e]),e||(t?`radix-${t}`:"")}var _H="DropdownMenu",[w_e,mXe]=sOe(_H,[hie]),Qr=hie(),[k_e,jie]=w_e(_H),zie=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:o,onOpenChange:a,modal:s=!0}=e,l=Qr(t),d=k.useRef(null),[p=!1,h]=cOe({prop:i,defaultProp:o,onChange:a});return u.jsx(k_e,{scope:t,triggerId:Oie(),triggerRef:d,contentId:Oie(),open:p,onOpenChange:h,onOpenToggle:k.useCallback(()=>h(f=>!f),[h]),modal:s,children:u.jsx(r_e,{...l,open:p,onOpenChange:h,dir:r,modal:s,children:n})})};zie.displayName=_H;var _ie="DropdownMenuTrigger",Rie=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,o=jie(_ie,n),a=Qr(n);return u.jsx(i_e,{asChild:!0,...a,children:u.jsx(bOe.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:fre(t,o.triggerRef),onPointerDown:D$(e.onPointerDown,s=>{!r&&s.button===0&&s.ctrlKey===!1&&(o.onOpenToggle(),o.open||s.preventDefault())}),onKeyDown:D$(e.onKeyDown,s=>{r||(["Enter"," "].includes(s.key)&&o.onOpenToggle(),s.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(s.key)&&s.preventDefault())})})})});Rie.displayName=_ie;var C_e="DropdownMenuPortal",Hie=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Qr(t);return u.jsx(o_e,{...r,...n})};Hie.displayName=C_e;var qie="DropdownMenuContent",Bie=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=jie(qie,n),o=Qr(n),a=k.useRef(!1);return u.jsx(a_e,{id:i.contentId,"aria-labelledby":i.triggerId,...o,...r,ref:t,onCloseAutoFocus:D$(e.onCloseAutoFocus,s=>{var l;a.current||(l=i.triggerRef.current)==null||l.focus(),a.current=!1,s.preventDefault()}),onInteractOutside:D$(e.onInteractOutside,s=>{const l=s.detail.originalEvent,d=l.button===0&&l.ctrlKey===!0,p=l.button===2||d;(!i.modal||p)&&(a.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Bie.displayName=qie;var S_e="DropdownMenuGroup",M_e=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Qr(n);return u.jsx(s_e,{...i,...r,ref:t})});M_e.displayName=S_e;var I_e="DropdownMenuLabel",Vie=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Qr(n);return u.jsx(l_e,{...i,...r,ref:t})});Vie.displayName=I_e;var L_e="DropdownMenuItem",Uie=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Qr(n);return u.jsx(c_e,{...i,...r,ref:t})});Uie.displayName=L_e;var E_e="DropdownMenuCheckboxItem",Gie=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Qr(n);return u.jsx(u_e,{...i,...r,ref:t})});Gie.displayName=E_e;var A_e="DropdownMenuRadioGroup",D_e=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Qr(n);return u.jsx(d_e,{...i,...r,ref:t})});D_e.displayName=A_e;var T_e="DropdownMenuRadioItem",Wie=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Qr(n);return u.jsx(p_e,{...i,...r,ref:t})});Wie.displayName=T_e;var N_e="DropdownMenuItemIndicator",Kie=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Qr(n);return u.jsx(h_e,{...i,...r,ref:t})});Kie.displayName=N_e;var F_e="DropdownMenuSeparator",Yie=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Qr(n);return u.jsx(f_e,{...i,...r,ref:t})});Yie.displayName=F_e;var $_e="DropdownMenuArrow",P_e=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Qr(n);return u.jsx(m_e,{...i,...r,ref:t})});P_e.displayName=$_e;var O_e="DropdownMenuSubTrigger",Zie=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Qr(n);return u.jsx(g_e,{...i,...r,ref:t})});Zie.displayName=O_e;var j_e="DropdownMenuSubContent",Xie=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Qr(n);return u.jsx(y_e,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Xie.displayName=j_e;var z_e=zie,__e=Rie,R_e=Hie,Qie=Bie,Jie=Vie,eoe=Uie,toe=Gie,noe=Wie,roe=Kie,ioe=Yie,ooe=Zie,aoe=Xie;const soe=z_e,loe=__e,H_e=k.forwardRef(({className:e,inset:t,children:n,...r},i)=>u.jsxs(ooe,{ref:i,className:ye("eb-flex eb-cursor-pointer eb-select-none eb-items-center eb-gap-2 eb-rounded-sm eb-px-2 eb-py-1.5 eb-text-sm eb-outline-none focus:eb-bg-accent data-[state=open]:eb-bg-accent [&_svg]:eb-pointer-events-none [&_svg]:eb-size-4 [&_svg]:eb-shrink-0",t&&"eb-pl-8",e),...r,children:[n,u.jsx(xa,{className:"eb-ml-auto"})]}));H_e.displayName=ooe.displayName;const q_e=k.forwardRef(({className:e,...t},n)=>u.jsx(aoe,{ref:n,className:ye("eb-z-50 eb-min-w-[8rem] eb-origin-[--radix-dropdown-menu-content-transform-origin] eb-overflow-hidden eb-rounded-md eb-border eb-bg-popover eb-p-1 eb-text-popover-foreground eb-shadow-lg data-[state=open]:eb-animate-in data-[state=closed]:eb-animate-out data-[state=closed]:eb-fade-out-0 data-[state=open]:eb-fade-in-0 data-[state=closed]:eb-zoom-out-95 data-[state=open]:eb-zoom-in-95 data-[side=bottom]:eb-slide-in-from-top-2 data-[side=left]:eb-slide-in-from-right-2 data-[side=right]:eb-slide-in-from-left-2 data-[side=top]:eb-slide-in-from-bottom-2",e),...t}));q_e.displayName=aoe.displayName;const RH=k.forwardRef(({className:e,sideOffset:t=4,...n},r)=>u.jsx(R_e,{children:u.jsx(Qie,{ref:r,sideOffset:t,className:ye("eb-z-50 eb-max-h-[var(--radix-dropdown-menu-content-available-height)] eb-min-w-[8rem] eb-overflow-y-auto eb-overflow-x-hidden eb-rounded-md eb-border eb-bg-popover eb-p-1 eb-text-popover-foreground eb-shadow-md","eb-origin-[--radix-dropdown-menu-content-transform-origin] data-[state=open]:eb-animate-in data-[state=closed]:eb-animate-out data-[state=closed]:eb-fade-out-0 data-[state=open]:eb-fade-in-0 data-[state=closed]:eb-zoom-out-95 data-[state=open]:eb-zoom-in-95 data-[side=bottom]:eb-slide-in-from-top-2 data-[side=left]:eb-slide-in-from-right-2 data-[side=right]:eb-slide-in-from-left-2 data-[side=top]:eb-slide-in-from-bottom-2",e),...n})}));RH.displayName=Qie.displayName;const HH=k.forwardRef(({className:e,inset:t,...n},r)=>u.jsx(eoe,{ref:r,className:ye("eb-relative eb-flex eb-cursor-pointer eb-select-none eb-items-center eb-gap-2 eb-rounded-sm eb-px-2 eb-py-1.5 eb-text-sm eb-outline-none eb-transition-colors focus:eb-bg-accent focus:eb-text-accent-foreground data-[disabled]:eb-pointer-events-none data-[disabled]:eb-opacity-50 [&>svg]:eb-size-4 [&>svg]:eb-shrink-0",t&&"eb-pl-8",e),...n}));HH.displayName=eoe.displayName;const B_e=k.forwardRef(({className:e,children:t,checked:n,...r},i)=>u.jsxs(toe,{ref:i,className:ye("eb-relative eb-flex eb-cursor-pointer eb-select-none eb-items-center eb-rounded-sm eb-py-1.5 eb-pl-8 eb-pr-2 eb-text-sm eb-outline-none eb-transition-colors focus:eb-bg-accent focus:eb-text-accent-foreground data-[disabled]:eb-pointer-events-none data-[disabled]:eb-opacity-50",e),checked:n,...r,children:[u.jsx("span",{className:"eb-absolute eb-left-2 eb-flex eb-h-3.5 eb-w-3.5 eb-items-center eb-justify-center",children:u.jsx(roe,{children:u.jsx(Lr,{className:"eb-h-4 eb-w-4"})})}),t]}));B_e.displayName=toe.displayName;const V_e=k.forwardRef(({className:e,children:t,...n},r)=>u.jsxs(noe,{ref:r,className:ye("eb-relative eb-flex eb-cursor-pointer eb-select-none eb-items-center eb-rounded-sm eb-py-1.5 eb-pl-8 eb-pr-2 eb-text-sm eb-outline-none eb-transition-colors focus:eb-bg-accent focus:eb-text-accent-foreground data-[disabled]:eb-pointer-events-none data-[disabled]:eb-opacity-50",e),...n,children:[u.jsx("span",{className:"eb-absolute eb-left-2 eb-flex eb-h-3.5 eb-w-3.5 eb-items-center eb-justify-center",children:u.jsx(roe,{children:u.jsx(ac,{className:"eb-h-2 eb-w-2 eb-fill-current"})})}),t]}));V_e.displayName=noe.displayName;const U_e=k.forwardRef(({className:e,inset:t,...n},r)=>u.jsx(Jie,{ref:r,className:ye("eb-px-2 eb-py-1.5 eb-text-sm eb-font-semibold",t&&"eb-pl-8",e),...n}));U_e.displayName=Jie.displayName;const G_e=k.forwardRef(({className:e,...t},n)=>u.jsx(ioe,{ref:n,className:ye("eb--mx-1 eb-my-1 eb-h-px eb-bg-muted",e),...t}));G_e.displayName=ioe.displayName;const W_e=new Date().getFullYear(),K_e=/^[a-zA-Z0-9()_/&+%@#;,.: -?]*$/,Y_e=/[()_/&+%@#;,.: -?]/,Z_e=ne.object({description:ne.string().max(100,ee.t("onboarding:fields.organizationIds.description.validation.maxLength")).optional(),idType:ne.enum(["EIN","BUSINESS_REGISTRATION_ID","BUSINESS_NUMBER","BUSINESS_REGISTRATION_NUMBER"]),value:ne.string().min(1,ee.t("onboarding:fields.organizationIds.value.validation.required")).max(100,ee.t("onboarding:fields.organizationIds.value.validation.maxLength")).regex(/^[A-Za-z0-9-]+$/,ee.t("onboarding:fields.organizationIds.value.validation.format")),issuer:ne.string().min(1,ee.t("onboarding:fields.organizationIds.issuer.validation.required")).max(500,ee.t("onboarding:fields.organizationIds.issuer.validation.maxLength")),expiryDate:ne.string().refine(e=>/^\d{4}-\d{2}-\d{2}$/.test(e),{message:ee.t("onboarding:fields.organizationIds.expiryDate.validation.format")}).refine(e=>!Number.isNaN(new Date(e).getTime()),{message:ee.t("onboarding:fields.organizationIds.expiryDate.validation.invalid")}).refine(e=>new Date(e)>new Date,{message:ee.t("onboarding:fields.organizationIds.expiryDate.validation.future")}).refine(e=>{const t=new Date(e),n=new Date,r=new Date(n.setFullYear(n.getFullYear()+10));return t<r},{message:ee.t("onboarding:fields.organizationIds.expiryDate.validation.maxYears")}).optional()}).refine(e=>{switch(e.idType){case"EIN":return/^\d{9}$/.test(e.value);case"BUSINESS_REGISTRATION_ID":return/^[A-Za-z0-9]{5,15}$/.test(e.value);case"BUSINESS_NUMBER":return/^\d{9,12}$/.test(e.value);case"BUSINESS_REGISTRATION_NUMBER":return/^[A-Za-z0-9-]{6,15}$/.test(e.value);default:return!0}},e=>({message:ee.t(`onboarding:fields.organizationIds.value.validation.${e.idType.toLowerCase()}Format`),path:["value"]})),X_e=ne.object({countryOfFormation:ne.string().length(2,ee.t("onboarding:fields.countryOfFormation.validation.exactlyTwoChars")).refine(e=>xr.includes(e),ee.t("onboarding:fields.countryOfFormation.validation.invalidCountry")),organizationName:ne.string().min(2,ee.t("onboarding:fields.organizationName.validation.minLength")).max(100,ee.t("onboarding:fields.organizationName.validation.maxLength")).regex(K_e,ee.t("onboarding:fields.organizationName.validation.pattern")).refine(e=>!/\s\s/.test(e),ee.t("onboarding:fields.organizationName.validation.noConsecutiveSpaces")).refine(e=>!Y_e.test(e.charAt(0)),ee.t("onboarding:fields.organizationName.validation.noSpecialAtStart")),yearOfFormation:ne.string().regex(/^(19|20)\d{2}$/,ee.t("onboarding:fields.yearOfFormation.validation.format")).refine(e=>parseInt(e,10)>=1800,ee.t("onboarding:fields.yearOfFormation.validation.min")).refine(e=>parseInt(e,10)<=W_e,ee.t("onboarding:fields.yearOfFormation.validation.max")),organizationIds:ne.array(Z_e).max(6,ee.t("onboarding:fields.organizationIds.validation.maxIds")).refine(e=>{const t=e.map(n=>n.idType);return new Set(t).size===t.length},ee.t("onboarding:fields.organizationIds.validation.uniqueTypes"))}),coe=()=>{const{t:e}=Qt(["onboarding-overview","onboarding"]),t=ii(),n=a=>{switch(a){case"EIN":return"## - #######";default:return}},r=a=>e(a?[`idValueLabels.${a}`,`onboarding:idValueLabels.${a}`]:"onboarding:idValueLabels.placeholder"),i=a=>a?e([`idValueDescriptions.${a}`]):"",o=t.watch("organizationIds.0.idType");return c.useEffect(()=>{t.watch("organizationIds.0.issuer")!=="US"&&t.setValue("organizationIds.0.issuer","US")},[t.watch("organizationIds.0.issuer")]),u.jsxs("div",{className:"eb-mt-6 eb-space-y-6",children:[u.jsx(Ce,{control:t.control,name:"organizationName",type:"text"}),u.jsx(Ce,{control:t.control,name:"yearOfFormation",type:"text",inputProps:{maxLength:4}}),u.jsxs("div",{className:"eb-space-y-3",children:[u.jsx(Ce,{control:t.control,name:"countryOfFormation",type:"combobox",options:xr.map(a=>({value:a,label:u.jsxs("span",{children:[u.jsxs("span",{className:"eb-font-medium",children:["[",a,"]"]})," ",e([`common:countries.${a}`])]})}))}),u.jsxs(rn,{variant:"informative",density:"sm",noTitle:!0,children:[u.jsx(sr,{className:"eb-size-4"}),u.jsx(on,{children:"If your business is outside of the United States, please contact Platform operator."})]})]}),t.watch("countryOfFormation")==="US"&&u.jsxs("div",{className:"eb-space-y-3",children:[u.jsx(Ce,{control:t.control,name:"organizationIds.0.value",type:"text",label:r(o),description:i(o),maskFormat:n(o),maskChar:"_"},o),u.jsxs(soe,{children:[u.jsx(loe,{asChild:!0,children:u.jsxs(_e,{variant:"ghost",type:"button",size:"sm",className:"",children:["Use a different ID type",u.jsx(ao,{})]})}),u.jsx(RH,{className:"eb-component",children:["EIN","BUSINESS_REGISTRATION_ID","BUSINESS_REGISTRATION_NUMBER"].map(a=>u.jsx(HH,{disabled:t.watch("organizationIds.0.idType")===a,onClick:()=>{t.setValue("organizationIds.0.idType",a),t.setValue("organizationIds.0.value","")},children:u.jsx("div",{className:"eb-flex eb-items-center eb-gap-2",children:r(a)})},a))})]})]})]})};coe.schema=X_e;const Q_e=/^[a-zA-Z0-9()_/&+%@#;,.: -?]*$/,J_e=ne.object({dbaName:ne.string().max(100,ee.t("onboarding:fields.dbaName.validation.maxLength")).regex(Q_e,ee.t("onboarding:fields.dbaName.validation.pattern")).refine(e=>!e||!/\s\s/.test(e),ee.t("onboarding:fields.dbaName.validation.noConsecutiveSpaces")).refine(e=>!e||e.length>=2,ee.t("onboarding:fields.dbaName.validation.minLength")),dbaNameNotAvailable:ne.boolean(),organizationDescription:ne.string().min(10).max(500).transform(Yne),website:ne.string().regex(/^https?:\/\//,ee.t("onboarding:fields.website.validation.httpsRequired")).url(ee.t("onboarding:fields.website.validation.invalid")).max(500,ee.t("onboarding:fields.website.validation.maxLength")).refine(e=>!e||!/^https?:\/\/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/.test(e),ee.t("onboarding:fields.website.validation.noIp")),websiteNotAvailable:ne.boolean()}),eRe=e=>e.superRefine((t,n)=>{t.websiteNotAvailable===!1&&!t.website&&n.addIssue({code:ne.ZodIssueCode.custom,message:ee.t("onboarding:fields.website.validation.required"),path:["website"]}),t.dbaNameNotAvailable===!1&&!t.dbaName&&n.addIssue({code:ne.ZodIssueCode.custom,message:"Required",path:["dbaName"]})}),U$=({currentPartyData:e})=>{var n;const t=ii();return c.useEffect(()=>{const r=t.watch((i,{name:o})=>{o==="dbaNameNotAvailable"&&i.dbaNameNotAvailable&&t.clearErrors("dbaName")});return()=>r.unsubscribe()},[t,e]),c.useEffect(()=>{const r=t.watch((i,{name:o})=>{o==="websiteNotAvailable"&&i.websiteNotAvailable&&t.clearErrors("website")});return()=>r.unsubscribe()},[t]),u.jsxs("div",{className:"eb-mt-6 eb-space-y-6",children:[u.jsxs("div",{className:"eb-space-y-3",children:[u.jsx(Ce,{control:t.control,name:"dbaName",type:"text",valueOverride:t.watch("dbaNameNotAvailable")?((n=e==null?void 0:e.organizationDetails)==null?void 0:n.organizationName)??"":void 0,disabled:t.watch("dbaNameNotAvailable"),required:!0}),u.jsx(Ce,{control:t.control,name:"dbaNameNotAvailable",type:"checkbox-basic",label:"Same as legal name of the company",noOptionalLabel:!0})]}),u.jsx("div",{children:u.jsx(Ce,{control:t.control,name:"organizationDescription",type:"textarea",popoutTooltip:!0,tooltip:u.jsxs("div",{className:"eb-space-y-3",children:[u.jsx("h2",{className:"eb-font-header eb-text-2xl eb-font-medium",children:"Description example"}),u.jsx("p",{className:"eb-text-sm",children:"{Business name} creates sustainable and affordable beauty and hair care products that are vegan and cruelty free. Our top selling products are our organic citrus shampoo and conditioner line as well as our paraben and sulfate free mascara."}),u.jsx("p",{className:"eb-pb-1 eb-text-sm",children:"Please ensure this aligns with the business classification you have selected."}),u.jsx("h2",{className:"eb-font-header eb-text-2xl eb-font-medium",children:"Will my customers see this?"}),u.jsx("p",{className:"eb-pb-1 eb-text-sm",children:"No. This is used for compliance and regulatory purposes only."})]})})}),u.jsxs("div",{className:"eb-space-y-3",children:[u.jsx(Ce,{control:t.control,name:"website",type:"text",valueOverride:t.watch("websiteNotAvailable")?"N/A":void 0,disabled:t.watch("websiteNotAvailable"),required:!0}),u.jsx(Ce,{control:t.control,name:"websiteNotAvailable",type:"checkbox-basic",label:"My business doesn't have a website",noOptionalLabel:!0})]})]})};U$.schema=J_e,U$.refineSchemaFn=eRe,U$.modifyFormValuesBeforeSubmit=e=>{const{dbaName:t,website:n,dbaNameNotAvailable:r,websiteNotAvailable:i,...o}=e;return{...o,...r?{}:{dbaName:t},...i?{}:{website:n},websiteNotAvailable:i}};const tRe=ne.object({industry:ne.string().min(1,ee.t("onboarding:fields.industry.validation.required"))}),uoe=()=>{const e=ii();return u.jsxs("div",{className:"eb-mt-1 eb-space-y-6",children:[u.jsxs(rn,{variant:"informative",density:"sm",noTitle:!0,className:"eb-mt-8",children:[u.jsx(sr,{className:"eb-size-4"}),u.jsx(on,{children:"This is used for regulatory and compliance purposes, so please ensure your selection is accurate."})]}),u.jsx(Ce,{control:e.control,name:"industry",type:"industrySelect",popoutTooltip:!0,tooltip:u.jsxs("div",{className:"eb-mb-6",children:[u.jsx("h2",{className:"eb-mb-0 eb-font-header eb-text-2xl eb-font-medium",children:"How do I make the right choice?"}),u.jsx("p",{className:"eb-mb-0 eb-mt-1 eb-text-sm",children:"Please select the same classification chosen when your business or organization was registered in North America."}),u.jsx("h3",{className:"eb-mb-0 eb-mt-3 eb-text-sm eb-font-medium",children:"If you are a sole proprietor or your business is registered outside of North America,"}),u.jsx("p",{className:"eb-mb-0 eb-mt-1 eb-text-sm",children:"You may not have previously selected a classification. In this case, please make the best choice based on your primary line of business."})]})})]})};uoe.schema=tRe;const nRe=()=>{const{organizationType:e}=Kr(),{goTo:t}=Io(),{t:n}=Qt(["onboarding-overview","onboarding","common"]);return u.jsxs(Os,{subTitle:u.jsxs("div",{className:"eb-flex eb-h-6 eb-items-end eb-space-x-2",children:[u.jsx("p",{children:n(`onboarding:organizationTypes.${e}`)}),u.jsx(_e,{variant:"ghost",className:"eb-h-6 eb-w-6 eb-px-3",onClick:()=>t("gateway"),children:u.jsx(yi,{className:"eb-stroke-primary"})})]}),title:n("screens.checklist.title"),description:n("screens.checklist.description"),children:[u.jsx("div",{className:"eb-mt-1",children:u.jsxs(_e,{variant:"ghost",children:[u.jsx($1,{})," Download checklist"]})}),u.jsxs("div",{className:"eb-mt-6 eb-max-h-[480px] eb-flex-auto eb-space-y-4 eb-overflow-y-scroll eb-border-y eb-py-2",children:[u.jsxs(an,{className:"eb-space-y-4 eb-rounded-lg eb-border eb-p-4",children:[u.jsx(wi,{className:"eb-text-xl eb-font-bold eb-tracking-tight",children:"Personal details"}),u.jsxs("div",{className:"eb-space-y-1",children:[u.jsx("p",{className:"eb-font-semibold",children:"We'll need your information as the business's financial controller."}),u.jsxs("ul",{className:"eb-list-disc eb-pl-8",children:[u.jsx("li",{children:"Name and job title"}),u.jsx("li",{children:"Identity document details"}),u.jsx("li",{children:"Address and contact details"})]})]})]}),u.jsxs(an,{className:"eb-space-y-4 eb-rounded-lg eb-border eb-p-4",children:[u.jsx(wi,{className:"eb-text-xl eb-font-bold eb-tracking-tight",children:"Business details"}),u.jsxs("div",{className:"eb-space-y-1",children:[u.jsx("p",{className:"eb-font-semibold",children:"Collect pertinent business details, typically found on official business registration documents."}),u.jsxs("ul",{className:"eb-list-disc eb-pl-8",children:[u.jsx("li",{children:"Business classification"}),u.jsx("li",{children:"Registration ID details"}),u.jsx("li",{children:"Location and contact details"})]})]})]}),u.jsxs(an,{className:"eb-space-y-4 eb-rounded-lg eb-border eb-p-4",children:[u.jsx(wi,{className:"eb-text-xl eb-font-bold eb-tracking-tight",children:"Owners and key roles"}),u.jsxs("div",{children:[u.jsx("p",{className:"eb-font-semibold",children:"Collect personal details for key stakeholders in your business."}),u.jsxs("div",{className:"eb-space-y-1",children:[u.jsx("p",{className:"eb-font-semibold",children:"Controllers and beneficial owners"}),u.jsxs("ul",{className:"eb-list-disc eb-pl-8",children:[u.jsx("li",{children:"Name and job title"}),u.jsx("li",{children:"Identity document details"}),u.jsx("li",{children:"Address and contact details"})]})]})]})]}),u.jsxs(an,{className:"eb-space-y-4 eb-rounded-lg eb-border eb-p-4",children:[u.jsx(wi,{className:"eb-text-xl eb-font-bold eb-tracking-tight",children:"Bank account"}),u.jsx("div",{children:u.jsx("p",{className:"eb-font-semibold",children:"We'll need the details of the bank account you wish to receive payouts."})})]})]}),u.jsx("div",{className:"eb-mt-6 eb-space-y-6",children:u.jsxs("div",{className:"eb-flex eb-justify-between eb-gap-4",children:[u.jsx(_e,{variant:"secondary",size:"lg",className:"eb-w-full eb-text-lg",onClick:()=>t("gateway"),children:n("screens.checklist.prevButton")}),u.jsx(_e,{size:"lg",className:"eb-w-full eb-text-lg",onClick:()=>t("overview"),children:n("screens.checklist.nextButton")})]})})]})},rRe={"application/pdf":[".pdf"],"image/jpeg":[".jpeg",".jpg"],"image/png":[".png"],"image/gif":[".gif"],"image/bmp":[".bmp"],"image/tiff":[".tiff",".tif"],"image/webp":[".webp"]},iRe=e=>e?e.split(`
7781
7781
  `).map((t,n)=>{const r=/^\d+\./.test(t.trim());if(t.includes("[OR]")){let i=t.split("Acceptable documents are");if(i.length===2){const[o,a]=i,s=a.split(/\[AND\]|\[OR\]/g).map(l=>l.trim()).filter(l=>l);return u.jsxs("div",{className:"eb-mb-2",children:[u.jsx("p",{className:`eb-text-sm ${r?"eb-font-medium":""}`,children:o}),u.jsx("p",{className:"eb-ml-4 eb-mt-1 eb-text-sm",children:"Acceptable documents are:"}),u.jsx("ul",{className:"eb-ml-12 eb-mt-1 eb-list-disc eb-text-sm",children:s.map((l,d)=>u.jsx("li",{className:"eb-mb-1",children:l},`doc-${d}`))})]},`section-${n}`)}return i=t.split(/\[OR\]/g).map(o=>o.trim()).filter(o=>o),u.jsxs("div",{className:"eb-mb-2",children:[u.jsx("p",{className:`eb-text-sm ${r?"eb-font-medium":""}`,children:i[0]}),i.length>1&&u.jsx(u.Fragment,{children:u.jsx("ul",{className:"eb-ml-6 eb-list-disc eb-text-sm",children:i.slice(1).map((o,a)=>u.jsx("li",{className:"eb-mb-1",children:o},`part-${a}`))})})]},`section-${n}`)}if(t.includes("[AND]")){const i=t.split("[AND]").map(o=>o.trim()).filter(o=>o);return u.jsx("div",{className:"eb-mb-2",children:i.map((o,a)=>{const s=/^\d+\./.test(o.trim());return u.jsx("p",{className:`eb-text-sm ${s||r&&a===0?"eb-font-medium":""} ${a>0?"eb-mt-2":""}`,children:o},`and-part-${a}`)})},`section-${n}`)}return u.jsx("p",{className:`eb-mb-2 eb-text-sm ${r?"eb-font-medium":""}`,children:t},`section-${n}`)}):null,oRe=()=>{var E,N,P,z,T,$,H,O,R,B,V,G,j,U,D,A;const{clientData:e}=Kr(),t=Bi(),{goTo:n,editingPartyIds:r}=Io(),i=r["document-upload-form"],o=kX(),a=wX(),[s,l]=c.useState({}),[d,p]=c.useState([]),[h,f]=c.useState({}),m=(E=e==null?void 0:e.parties)==null?void 0:E.find(F=>F.id===i),b=Array.from(new Set((T=(P=(N=e==null?void 0:e.parties)==null?void 0:N.map(F=>{var _;return(_=F==null?void 0:F.validationResponse)==null?void 0:_.map(W=>W==null?void 0:W.documentRequestIds)}))==null?void 0:P.flat(2))==null?void 0:T.filter(F=>F==null?void 0:F.length).concat((z=e==null?void 0:e.outstanding)==null?void 0:z.documentRequestIds))),y=i?Array.from(new Set((G=(O=(H=($=e==null?void 0:e.parties)==null?void 0:$.filter(F=>F.id===i))==null?void 0:H.map(F=>{var _;return(_=F==null?void 0:F.validationResponse)==null?void 0:_.map(W=>W==null?void 0:W.documentRequestIds)}))==null?void 0:O.flat(2))==null?void 0:G.filter(F=>F==null?void 0:F.length).concat(((B=(R=e==null?void 0:e.parties)==null?void 0:R.find(F=>F.id===i))==null?void 0:B.partyType)==="ORGANIZATION"?((V=e==null?void 0:e.outstanding)==null?void 0:V.documentRequestIds)||[]:[]))):b,v=eN({queries:(y??[]).map(F=>({queryKey:["documentRequest",F],queryFn:()=>F&&xX(F)})),combine:F=>({data:F.map(_=>_.data).filter(_=>!!_&&_.status==="ACTIVE"),pending:F.some(_=>_.isPending)})});c.useEffect(()=>{var F;if((F=v==null?void 0:v.data)!=null&&F.length){const _={};v.data.forEach(W=>{var Z;W!=null&&W.id&&((Z=W.requirements)!=null&&Z.length)&&(_[W.id]=[0])}),l(_)}},[JSON.stringify(v==null?void 0:v.data)]);const x=c.useMemo(()=>{var _;const F={};return(_=v==null?void 0:v.data)==null||_.forEach(W=>{if(!(W!=null&&W.id)||!W.requirements)return;const Z={};W.requirements.forEach((X,se)=>{if(Math.max((X.minRequired||1)-X.documentTypes.filter(de=>d.includes(de)).length,0)>0){const de=X.minRequired||1;for(let le=0;le<de;le+=1){const ue=le>0?`_${le}`:"";Z[`requirement_${se}_docType${ue}`]=ne.string().optional(),Z[`requirement_${se}_files${ue}`]=ne.array(ne.instanceof(File)).refine(Y=>{if(!(Y!=null&&Y.length))return!0;const me=2*1024*1024;return Y.every(Me=>Me.size<=me)},{message:"Each file must be 2MB or less"}).optional()}}}),F[W.id]=ne.object(Z)}),ne.object(F)},[JSON.stringify(v==null?void 0:v.data),JSON.stringify(d)]),w=ki({resolver:yo(x),mode:"onChange"});c.useEffect(()=>{const F=setTimeout(()=>{w.trigger()},100);return()=>clearTimeout(F)},[JSON.stringify(s),w]);const C=UO({control:w.control});c.useEffect(()=>{var X;if(!C)return;const F={},_=[],W={};Object.entries(C).forEach(([se,pe])=>{F[se]=[],W[se]={},Object.entries(pe).forEach(([de,le])=>{if(de.includes("_docType")&&le){const ue=de.split("_"),Y=parseInt(ue[1],10),me=`requirement_${Y}_files`,Me=de.replace(`requirement_${Y}_docType`,""),he=`${me}${Me}`,q=pe[he];if(q&&q.length>0){const K=le;F[se].push({documentType:K,files:q}),_.includes(K)||_.push(K),W[se][Y]||(W[se][Y]=[]),W[se][Y].includes(K)||W[se][Y].push(K)}}})}),p(_),f(W);const Z={...s};(X=v==null?void 0:v.data)==null||X.forEach(se=>{if(!(se!=null&&se.id))return;const pe=se.id;if(Z[pe]||(Z[pe]=[0]),se.requirements){let de=!1;const le=[];se.requirements.forEach((ue,Y)=>{var Me;(((Me=F[pe])==null?void 0:Me.filter(he=>ue.documentTypes.includes(he.documentType)).length)||0)>=(ue.minRequired||1)&&le.push(Y)});for(let ue=0;ue<se.requirements.length;ue+=1)if(!le.includes(ue)&&(ue===0||se.requirements.slice(0,ue).every((me,Me)=>le.includes(Me)))){Z[pe]=[ue],de=!0;break}!de&&se.requirements.length>0&&(le.length===se.requirements.length?Z[pe]=[]:Z[pe]=[0])}}),l(Z)},[C,v==null?void 0:v.data]);const M=w.handleSubmit(async()=>{w.clearErrors();const F=w.getValues();try{const _=[];for(const[W,Z]of Object.entries(F)){_.push(W);const X=[];Object.entries(Z).forEach(([se,pe])=>{if(se.includes("_docType")&&pe){const de=se.split("_"),le=parseInt(de[1],10),ue=`requirement_${le}_files`,Y=se.replace(`requirement_${le}_docType`,""),me=`${ue}${Y}`,Me=Z[me];Me&&Me.length>0&&Me.forEach(he=>{X.push({documentType:pe,file:he})})}});for(const{documentType:se,file:pe}of X){const de={documentRequestId:W,documentType:se},le=/\.(jpe?g|png)$/i.test(pe.name);let ue=pe;if(le)try{const Y=await Ade(pe,1e3),Me=await(await fetch(Y)).blob();ue=new File([Me],pe.name,{type:pe.type})}catch(Y){console.error("Image compression failed, using original file:",Y)}await o.mutateAsync({data:{documentData:JSON.stringify(de),file:ue}})}}if(_.length>0)for(const W of _)await a.mutateAsync({id:W});t.invalidateQueries(),n("upload-documents-section")}catch(_){console.error("Error uploading documents:",_)}}),S=()=>{w.reset(),p([]),f({});const F={};v.data.forEach(_=>{_!=null&&_.id&&(F[_.id]=[0])}),l(F)},I=c.useMemo(()=>{var W;if(!((W=v==null?void 0:v.data)!=null&&W.length))return!1;const F=(Z,X)=>{var ue;if(!(Z!=null&&Z.id)||!Z.requirements||((ue=s[Z.id])==null?void 0:ue.includes(X)))return!1;const pe=Z.requirements[X];if(!pe)return!1;if(pe.minRequired===0)return!0;const de=pe.documentTypes.filter(Y=>d.includes(Y)).length;return de>0&&(de===pe.documentTypes.length||de>=(pe.minRequired||1))};return v.data.every(Z=>{var se;return!(Z!=null&&Z.id)||!((se=Z.requirements)!=null&&se.length)?!0:Z.requirements.every((pe,de)=>{var Me;const le=pe.documentTypes.filter(he=>d.includes(he)).length,ue=Z.id&&((Me=s[Z.id])==null?void 0:Me.includes(de)),Y=F(Z,de);return le>=(pe.minRequired??1)||Y||!ue})})},[v==null?void 0:v.data,d,s]);if(v!=null&&v.pending)return u.jsx(Ds,{message:"Fetching document requests..."});const L=F=>d.includes(F);return u.jsx(dr,{...w,children:u.jsx("form",{onSubmit:M,className:"eb-flex eb-min-h-full eb-flex-col",children:u.jsxs(Os,{title:ef(m),children:[u.jsxs("div",{className:"eb-flex-auto eb-space-y-6",children:[u.jsxs("div",{className:"eb-mb-6 eb-mt-1",children:[((j=m==null?void 0:m.roles)==null?void 0:j.includes("CLIENT"))&&u.jsx(ur,{variant:"subtle",size:"lg",children:"Business"}),((U=m==null?void 0:m.roles)==null?void 0:U.includes("BENEFICIAL_OWNER"))&&u.jsx(ur,{variant:"subtle",size:"lg",children:"Owner"}),((D=m==null?void 0:m.roles)==null?void 0:D.includes("CONTROLLER"))&&u.jsx(ur,{variant:"subtle",size:"lg",children:"Controller"})]}),u.jsx("div",{className:"eb-space-y-4",children:(A=v==null?void 0:v.data)==null?void 0:A.map((F,_)=>{var W;return u.jsxs("div",{children:[u.jsxs(rn,{variant:"informative",className:"eb-pb-3",children:[u.jsx(sr,{className:"eb-h-4 eb-w-4"}),u.jsx(on,{children:iRe(F==null?void 0:F.description)})]}),u.jsxs(an,{className:"eb-mt-6 eb-w-full eb-shadow-sm",children:[u.jsx("div",{className:"eb-flex eb-justify-end eb-px-4 eb-pb-0 eb-pt-3",children:u.jsxs(_e,{type:"button",variant:"outline",size:"sm",onClick:S,className:"eb-flex eb-items-center eb-gap-1 eb-text-xs",children:[u.jsx(iu,{className:"eb-h-3 eb-w-3"})," Reset form"]})}),u.jsx("div",{className:"eb-space-y-6 eb-p-4",children:(W=F==null?void 0:F.requirements)==null?void 0:W.map((Z,X)=>{var q,K;const se=F==null?void 0:F.id,pe=se&&((q=s[se])==null?void 0:q.includes(X)),de=Z.documentTypes.filter(re=>L(re)).length,le=Math.max((Z.minRequired||1)-de,0),ue=Z.documentTypes.filter(re=>L(re)),Y=le+(ue.length>0?ue.length-1:0),me=(F==null?void 0:F.id)&&((K=h[F.id])==null?void 0:K[X])||[],Me=me.length>0?me:ue;if(!pe){const re=de>0&&(de===Z.documentTypes.length||le===0);return u.jsx("div",{className:"eb-rounded-md eb-border eb-border-gray-200 eb-p-3",children:u.jsx("h4",{className:"eb-text-sm eb-font-medium eb-text-gray-700",children:re?u.jsxs("span",{className:"eb-flex eb-items-center",children:[u.jsx(Ri,{className:"eb-mr-2 eb-h-4 eb-w-4 eb-text-green-600"}),u.jsxs("span",{className:"eb-font-medium",children:["Step ",X+1,"."]}),u.jsx("span",{className:"eb-normal eb-ml-1",children:"Already provided:"}),u.jsx("span",{className:"eb-ml-1 eb-inline-flex eb-flex-wrap eb-gap-1",children:Me.map(xe=>{var ve;return u.jsx("span",{className:"eb-inline-flex eb-items-center eb-rounded-full eb-bg-green-100 eb-px-2 eb-py-0.5 eb-text-xs eb-font-medium eb-text-green-800",children:((ve=r1[xe])==null?void 0:ve.label)||xe},xe)})})]}):u.jsxs("div",{className:"eb-flex eb-items-center",children:[u.jsx(Oo,{className:"eb-mr-2 eb-h-4 eb-w-4 eb-text-gray-400"}),u.jsxs("span",{className:"eb-font-medium",children:["Step ",X+1,"."]}),u.jsx("span",{className:"eb-ml-2 eb-text-gray-500",children:"Pending completion of previous steps"})]})})},`${X}-summary`)}const he=Z.documentTypes.filter(re=>{const xe=re,ve=Array.from({length:Y}).some((be,fe)=>{const ke=`${F==null?void 0:F.id}.requirement_${X}_docType${fe>0?`_${fe}`:""}`;return w.watch(ke)===xe});return!L(xe)||ve});return u.jsxs("div",{className:"eb-rounded-md eb-border eb-border-gray-200 eb-p-4",children:[u.jsx("h4",{className:"eb-mb-3 eb-text-sm eb-font-medium eb-text-gray-700",children:u.jsxs("div",{className:"eb-flex eb-items-center",children:[u.jsx(cl,{className:"eb-mr-2 eb-h-4 eb-w-4 eb-text-amber-600"}),u.jsxs("span",{className:"eb-font-medium",children:["Step ",X+1]}),le>0?u.jsx("span",{className:"eb-ml-2 eb-font-normal eb-text-gray-600",children:Z.minRequired===0?u.jsx(u.Fragment,{children:u.jsx("span",{className:"eb-ml-2 eb-inline-flex eb-items-center eb-rounded-full eb-bg-gray-100 eb-px-2 eb-py-0.5 eb-text-xs eb-font-medium eb-text-gray-500",children:"Optional"})}):""}):u.jsx("span",{className:"eb-ml-2 eb-font-normal eb-text-gray-600",children:"All required documents provided"})]})}),he.length>0&&Y>0?u.jsx(u.Fragment,{children:Array.from({length:Y}).map((re,xe)=>{const ve=`${F==null?void 0:F.id}.requirement_${X}_docType${xe>0?`_${xe}`:""}`,be=w.watch(ve);return u.jsxs("div",{className:"eb-mb-6",children:[u.jsx(jt,{control:w.control,name:ve,render:({field:fe})=>u.jsxs(Ct,{className:"eb-mb-4",children:[u.jsxs($t,{asterisk:Z.minRequired!==0,className:"eb-text-sm eb-font-medium eb-text-gray-700",children:["Select Document Type",Z.minRequired===0&&u.jsx("span",{className:"eb-ml-2 eb-text-xs eb-font-normal eb-text-gray-500",children:"(Optional)"})]}),u.jsx(it,{children:u.jsxs(Fa,{onValueChange:fe.onChange,value:fe.value||be,children:[u.jsx(Jo,{className:"eb-w-full",children:u.jsx($a,{placeholder:"Select a document type"})}),u.jsx(ea,{children:he.map(ke=>{var ce;return u.jsx(go,{value:ke,children:((ce=r1[ke])==null?void 0:ce.label)||ke},ke)})})]})}),u.jsx(Ht,{className:"eb-text-xs"})]})}),u.jsx(jt,{control:w.control,name:`${F==null?void 0:F.id}.requirement_${X}_files${xe>0?`_${xe}`:""}`,render:({field:{onChange:fe,...ke}})=>{var ge;const ce=w.watch(`${F==null?void 0:F.id}.requirement_${X}_docType${xe>0?`_${xe}`:""}`);return u.jsxs(Ct,{className:"eb-space-y-2",children:[u.jsxs($t,{asterisk:Z.minRequired!==0,className:"eb-text-sm eb-font-medium eb-text-gray-700",children:["Upload Document",Z.minRequired===0&&u.jsx("span",{className:"eb-ml-2 eb-text-xs eb-font-normal eb-text-gray-500",children:"(Optional)"})]}),ce&&u.jsx(qd,{className:"eb-text-xs eb-text-gray-500",children:((ge=r1[ce])==null?void 0:ge.description)||""}),u.jsx(it,{children:u.jsx(ite,{containerClassName:"eb-max-w-full",...ke,multiple:!1,accept:rRe,onChange:De=>{fe(De)}})}),u.jsx(Ht,{className:"eb-text-xs"})]})}})]},`upload-section-${xe}`)})}):u.jsx("div",{className:"eb-rounded-md eb-bg-green-50 eb-p-2 eb-text-sm eb-font-medium eb-text-green-700",children:"All document types for this requirement have been provided. You can proceed to the next step."})]},`${X}-active`)})})]})]},`${F==null?void 0:F.id}-${_}`)})})]}),u.jsxs("div",{className:"eb-mt-6 eb-flex eb-flex-col eb-gap-3",children:[u.jsx(Gr,{error:o.error||a.error,customErrorMessage:o.error?"There was an unexpected error uploading documents. Please try again.":a.error?"There was an unexpected error submitting document requests. Please try again.":void 0}),u.jsx(_e,{type:"submit",disabled:w.formState.isSubmitting||!I,children:w.formState.isSubmitting?"Uploading...":I?"Upload Documents":"Complete All Required Documents"}),u.jsx(_e,{variant:"ghost",onClick:()=>n("upload-documents-section"),className:"eb-text-primary hover:eb-bg-primary/5 hover:eb-text-primary",children:"Cancel"})]})]})})})},doe=({party:e,docRequestStatus:t,onUploadClick:n})=>{var r,i,o;return u.jsxs(an,{className:"eb-space-y-6 eb-rounded-lg eb-border eb-p-6 eb-shadow",children:[u.jsxs("div",{className:"eb-space-y-1.5",children:[u.jsxs("div",{className:"eb-flex eb-items-center eb-justify-between",children:[u.jsx("h3",{className:"eb-font-header eb-text-lg eb-font-medium",children:ef(e)}),t==="ACTIVE"&&u.jsxs("span",{children:[u.jsx(Oo,{className:"eb-size-5 eb-text-muted-foreground"}),u.jsx("span",{className:"eb-sr-only",children:"Pending"})]}),t==="CLOSED"&&u.jsxs("span",{children:[u.jsx(so,{className:"eb-size-5 eb-stroke-green-700"}),u.jsx("span",{className:"eb-sr-only",children:"Completed"})]}),t==="EXPIRED"&&u.jsxs("span",{children:[u.jsx(Fn,{className:"eb-size-5 eb-stroke-[#C75300]"}),u.jsx("span",{className:"eb-sr-only",children:"Expired"})]})]}),u.jsxs("div",{className:"eb-flex eb-gap-2",children:[((r=e.roles)==null?void 0:r.includes("CLIENT"))&&u.jsx(ur,{variant:"subtle",size:"lg",children:"Business"}),((i=e.roles)==null?void 0:i.includes("BENEFICIAL_OWNER"))&&u.jsx(ur,{variant:"subtle",size:"lg",children:"Owner"}),((o=e.roles)==null?void 0:o.includes("CONTROLLER"))&&u.jsx(ur,{variant:"subtle",size:"lg",children:"Controller"})]})]}),u.jsx("div",{children:t==="ACTIVE"?u.jsxs(_e,{variant:"outline",className:"eb-w-full eb-border-primary eb-text-primary",onClick:()=>n(e),children:[u.jsx(os,{})," Upload documents"]}):u.jsxs("div",{className:"eb-inline-flex eb-items-center eb-justify-center eb-gap-2 eb-text-xs eb-text-green-700",children:[u.jsx(Lr,{className:"eb-size-4"}),"Required documents successfully uploaded"]})})]})},aRe=()=>{const{clientData:e,docUploadOnlyMode:t}=Kr(),{goTo:n}=Io(),{data:r,status:i}=vX({clientId:e==null?void 0:e.id,includeRelatedParty:!0}),o=r==null?void 0:r.documentRequests,a=l=>{n("document-upload-form",{editingPartyId:l.id})},s=()=>{var h,f;if((e==null?void 0:e.status)==="REVIEW_IN_PROGRESS")return u.jsxs(rn,{variant:"informative",children:[u.jsx(sr,{className:"eb-h-4 eb-w-4"}),u.jsx(vr,{children:"Review in progress"}),u.jsx(on,{children:"Your onboarding is currently under review. Please check back later."})]});if((e==null?void 0:e.status)==="APPROVED")return u.jsxs(rn,{variant:"informative",noTitle:!0,children:[u.jsx(Lr,{className:"eb-h-4 eb-w-4"}),u.jsx(on,{children:"Your onboarding has been approved. No documents are required."})]});if(!e)return u.jsxs(rn,{variant:"destructive",children:[u.jsx(Fn,{className:"eb-h-4 eb-w-4"}),u.jsx(vr,{children:"There was a problem"}),u.jsx(on,{children:"Unable to load client data. Please try again later."})]});if(i==="pending")return u.jsx(Ds,{message:"Loading document requests"});if(i==="error")return u.jsxs(rn,{variant:"destructive",children:[u.jsx(Fn,{className:"eb-h-4 eb-w-4"}),u.jsx(vr,{children:"There was a problem"}),u.jsx(on,{children:"Unable to load document requests. Please try again later."})]});if(!(o!=null&&o.length))return u.jsxs(rn,{variant:"warning",children:[u.jsx(Fn,{className:"eb-h-4 eb-w-4"}),u.jsx(vr,{children:"There is a problem"}),u.jsx(on,{children:"No document requests found."})]});const l=(f=(h=e.parties)==null?void 0:h.find(m=>{var b;return(b=m.roles)==null?void 0:b.includes("CLIENT")}))==null?void 0:f.id,d=o.filter(m=>!m.partyId&&m.clientId===e.id||m.partyId&&m.partyId===l),p=o.filter(m=>m.partyId&&m.partyId!==l);return u.jsxs("div",{className:"eb-space-y-6",children:[u.jsxs("div",{className:"eb-space-y-3",children:[u.jsx("h2",{className:"eb-font-header eb-text-2xl eb-font-medium",children:"For the business"}),d.length>0?d.map(m=>{var y;const b=(y=e.parties)==null?void 0:y.find(v=>{var x;return(x=v.roles)==null?void 0:x.includes("CLIENT")});return b?u.jsx(doe,{party:b,docRequestStatus:m.status,onUploadClick:a},b.id):null}):u.jsx(an,{className:"eb-space-y-6 eb-rounded-lg eb-border eb-p-6 eb-shadow",children:u.jsx("p",{className:"eb-flex eb-items-center eb-justify-center eb-text-sm eb-font-medium",children:"No documents required"})})]}),u.jsxs("div",{className:"eb-space-y-3",children:[u.jsx("h2",{className:"eb-font-header eb-text-2xl eb-font-medium",children:"For owners and key roles"}),p.length>0?p.map(m=>{var y;const b=(y=e.parties)==null?void 0:y.find(v=>v.id===m.partyId);return b?u.jsx(doe,{party:b,docRequestStatus:m.status,onUploadClick:a},b.id):null}):u.jsx(an,{className:"eb-space-y-6 eb-rounded-lg eb-border eb-p-6 eb-shadow",children:u.jsx("p",{className:"eb-flex eb-items-center eb-justify-center eb-text-sm eb-font-medium",children:"No documents required"})})]})]})};return u.jsxs(Os,{title:"Supporting documents",description:"To satisfy regularatory requirements, we need to obtain the following",children:[u.jsx("div",{className:"eb-mt-6 eb-flex-auto eb-space-y-6",children:s()}),!t&&u.jsx("div",{className:"eb-mt-6 eb-space-y-6",children:u.jsx("div",{className:"eb-flex eb-justify-between eb-gap-4",children:u.jsx(_e,{type:"button",variant:"default",size:"lg",className:"eb-w-full eb-text-lg",onClick:()=>n("overview"),children:"Return to overview"})})})]})},poe=ne.object({organizationTypeHierarchy:ne.object({generalOrganizationType:ne.union([ne.enum(["SOLE_PROPRIETORSHIP","REGISTERED_BUSINESS","OTHER"]),ne.literal("")]).refine(e=>e!=="",{message:ee.t("common:validation.required")}),specificOrganizationType:ne.union([ne.enum(["LIMITED_LIABILITY_COMPANY","LIMITED_LIABILITY_PARTNERSHIP","GENERAL_PARTNERSHIP","LIMITED_PARTNERSHIP","C_CORPORATION","S_CORPORATION","PARTNERSHIP","NON_PROFIT_CORPORATION","GOVERNMENT_ENTITY","SOLE_PROPRIETORSHIP","UNINCORPORATED_ASSOCIATION","PUBLICLY_TRADED_COMPANY"]),ne.literal("")]).refine(e=>e!=="",{message:ee.t("common:validation.required")})})}),qH={SOLE_PROPRIETORSHIP:["SOLE_PROPRIETORSHIP"],REGISTERED_BUSINESS:["LIMITED_LIABILITY_COMPANY","LIMITED_LIABILITY_PARTNERSHIP","GENERAL_PARTNERSHIP","LIMITED_PARTNERSHIP","C_CORPORATION","S_CORPORATION","PARTNERSHIP"],OTHER:["NON_PROFIT_CORPORATION","GOVERNMENT_ENTITY","UNINCORPORATED_ASSOCIATION"]},sRe=()=>{var O;const e=Bi(),{clientData:t,setClientId:n,onPostClientSettled:r,onPostPartySettled:i,availableOrganizationTypes:o}=Kr(),{goTo:a,sessionData:s,updateSessionData:l}=Io(),{t:d}=Qt(["onboarding-overview","onboarding","common"]),p=jJ({clientData:t,schema:poe,defaultValues:{}}),h=(O=t==null?void 0:t.parties)==null?void 0:O.find(R=>R.partyType==="ORGANIZATION"),[f,m]=c.useState(!1),b=()=>{a("overview")};c.useEffect(()=>{if(t&&h&&!f){const R=Ih(t,h.id);p.reset(Fs(R,poe)),m(!0)}},[t,h,f,p]);const{mutate:y,error:v,status:x}=yX(),{mutate:w,error:C,status:M}=na(),{mutate:S,error:I,status:L}=ra(),E=p.handleSubmit(R=>{var V;const B={roles:[vAe.CLIENT],partyType:bAe.ORGANIZATION,organizationDetails:{organizationName:"PLACEHOLDER_ORG_NAME",countryOfFormation:"US"}};if(t)if(t&&(h!=null&&h.id)){if(R.organizationTypeHierarchy.specificOrganizationType===((V=h.organizationDetails)==null?void 0:V.organizationType)){b();return}const G=Wp(R,{});S({partyId:h.id,data:G},{onSettled:(j,U)=>{var D;i==null||i(j,(D=U==null?void 0:U.response)==null?void 0:D.data)},onSuccess:j=>{e.setQueryData(As(t.id),U=>{var D;return{...U,parties:(D=U==null?void 0:U.parties)==null?void 0:D.map(A=>A.id===j.id?{...A,...j}:A)}}),b()},onError:j=>{var U,D;if((D=(U=j.response)==null?void 0:U.data)!=null&&D.context){const{context:A}=j.response.data,F=Gp(A);ci(p,F)}}})}else{const G=Ns(R,0,"addParties",{addParties:[B]});w({id:t.id,data:G},{onSettled:(j,U)=>{var D;r==null||r(j,(D=U==null?void 0:U.response)==null?void 0:D.data)},onSuccess:()=>{b()},onError:j=>{var U,D;if((D=(U=j.response)==null?void 0:U.data)!=null&&D.context){const{context:A}=j.response.data,F=Ts(A,0,"addParties");ci(p,F)}}})}else{const G=Ns(R,0,"parties",{parties:[B]});y({data:{products:["EMBEDDED_PAYMENTS"],...G}},{onSettled:(j,U)=>{var D;r==null||r(j,(D=U==null?void 0:U.response)==null?void 0:D.data)},onSuccess:j=>{n(j.id),e.setQueryData(As(j.id),j),b()},onError:j=>{var U,D;if((D=(U=j.response)==null?void 0:U.data)!=null&&D.context){const{context:A}=j.response.data,F=Ts(A,0,"parties");ci(p,F)}}})}}),N=()=>{const R=[];return Object.entries(qH).forEach(([B,V])=>{const G=B;(o?V.some(U=>o.includes(U)):V.some(U=>tH.includes(U)))&&R.push(G)}),R.length?R:Object.keys(qH)},P=p.watch("organizationTypeHierarchy.generalOrganizationType"),z=R=>{if(R==="SOLE_PROPRIETORSHIP"){p.setValue("organizationTypeHierarchy.specificOrganizationType","SOLE_PROPRIETORSHIP");return}p.setValue("organizationTypeHierarchy.specificOrganizationType","")},T=M==="pending"||x==="pending"||L==="pending",H=T||h&&!f;return u.jsx(dr,{...p,children:u.jsxs("form",{onSubmit:E,className:"eb-flex eb-min-h-full eb-flex-col",children:[!s.hideGatewayInfoAlert&&u.jsxs(rn,{variant:"informative",density:"sm",className:"eb-mb-4",children:[u.jsx(sr,{className:"eb-h-4 eb-w-4"}),u.jsx(vr,{className:"eb-text-sm eb-font-semibold",children:"Is this you?"}),u.jsx(on,{children:"To keep your account details safe, we expect that the person completing this application holds primary control over financial and business operations for the business. If this is not you, please don't proceed below."}),u.jsxs("button",{type:"button",className:"eb-hover:eb-opacity-100 eb-focus:eb-outline-none eb-focus:eb-ring-2 eb-focus:eb-ring-ring eb-focus:eb-ring-offset-2 eb-disabled:eb-pointer-events-none eb-absolute eb-right-4 eb-top-3 eb-rounded-sm eb-opacity-70 eb-ring-offset-background eb-transition-opacity data-[state=open]:eb-bg-accent data-[state=open]:eb-text-muted-foreground [&&]:eb-pl-0",onClick:()=>{l({hideGatewayInfoAlert:!0})},children:[u.jsx(lr,{className:"eb-h-4 eb-w-4 eb-pl-0 eb-text-foreground"}),u.jsx("span",{className:"eb-sr-only",children:"Close"})]})]}),u.jsxs(Os,{subTitle:d("welcomeText"),title:d("screens.gateway.title"),description:d("screens.gateway.description"),children:[u.jsxs("div",{className:"eb-mt-6 eb-flex-auto eb-space-y-6",children:[u.jsx(Ce,{control:p.control,disableFieldRuleMapping:!0,name:"organizationTypeHierarchy.generalOrganizationType",type:"radio-group-blocks",options:N().map(R=>({value:R,label:d([`generalOrganizationTypes.${R}`]),description:d([`generalOrganizationTypeDescriptions.${R}`])})),onChange:z,required:!0,disabled:H}),(P==="REGISTERED_BUSINESS"||P==="OTHER")&&u.jsx(Ce,{control:p.control,disableFieldRuleMapping:!0,name:"organizationTypeHierarchy.specificOrganizationType",type:"combobox",label:d([`fields.organizationTypeHierarchy.specificOrganizationType.label.${P}`]),description:d([`fields.organizationTypeHierarchy.specificOrganizationType.description.${P}`]),options:(o??tH).filter(R=>qH[P].includes(R)).map(R=>({value:R,label:d([`organizationTypes.${R}`,`onboarding:organizationTypes.${R}`]),description:d(`onboarding:organizationTypeDescriptions.${R}`)})),required:!0,disabled:H})]}),u.jsxs("div",{className:"eb-mt-6 eb-space-y-6",children:[u.jsx(Gr,{error:I||C||v}),u.jsxs(_e,{type:"submit",variant:"default",size:"lg",className:"eb-w-full eb-text-lg",disabled:H,children:[T?u.jsx(Ln,{className:"eb-animate-spin"}):null,d("screens.gateway.nextButton")]})]})]})]})})},hoe=["30071","30073"],lRe=["30005"],cRe=e=>{const t={};return e.forEach(n=>{var l,d,p,h,f,m,b,y,v,x;const r=((d=(l=n==null?void 0:n.responseSchema)==null?void 0:l.items)==null?void 0:d.type)??"string",i=(h=(p=n==null?void 0:n.responseSchema)==null?void 0:p.items)==null?void 0:h.enum,o=(m=(f=n==null?void 0:n.responseSchema)==null?void 0:f.items)==null?void 0:m.pattern,a=!!n.parentQuestionId;let s;if(n.id&&hoe.includes(n.id))s=ne.string().regex(/^\d{4}-\d{2}-\d{2}$/,ee.t("onboarding:fields.additionalQuestions.validation.dateFormat"));else if(r)switch(r){case"boolean":s=ne.enum(["true","false"]);break;case"string":i?i.length>0?s=ne.enum([i[0],...i.slice(1)]):s=ne.string():(s=ne.string().min(1,ee.t("onboarding:fields.additionalQuestions.validation.required")),o&&(s=s.regex(new RegExp(o),ee.t("onboarding:fields.additionalQuestions.validation.invalidFormat"))));break;case"integer":s=ne.string().min(1,ee.t("onboarding:fields.additionalQuestions.validation.required")).regex(/^\d+$/,ee.t("onboarding:fields.additionalQuestions.validation.numberFormat"));break;default:s=ne.string()}else{console.log("Unknown question type",n);return}if(((b=n==null?void 0:n.responseSchema)==null?void 0:b.type)==="array"){const w=s;s=ne.array(w),a||(s=s.min(((y=n==null?void 0:n.responseSchema)==null?void 0:y.minItems)??1,ee.t("onboarding:fields.additionalQuestions.validation.required")).max(((v=n==null?void 0:n.responseSchema)==null?void 0:v.maxItems)??1,ee.t("onboarding:fields.additionalQuestions.validation.maxItems",{maxItems:(x=n==null?void 0:n.responseSchema)==null?void 0:x.maxItems})).superRefine((C,M)=>(C.forEach(S=>{const I=w.safeParse(S);I.error&&M.addIssue(I.error.issues[0])}),!0)))}t[`question_${n.id}`]=s}),ne.object(t).superRefine((n,r)=>{e.forEach(i=>{var o,a,s,l,d,p;if(i.parentQuestionId){const h=n==null?void 0:n[`question_${i.parentQuestionId}`],f=e.find(m=>m.id===i.parentQuestionId);if(f!=null&&f.subQuestions){const m=f.subQuestions.find(b=>{var y;return(y=b.questionIds)==null?void 0:y.includes(i.id??"")});m&&(typeof(m==null?void 0:m.anyValuesMatch)=="string"&&h.includes(m.anyValuesMatch)||Array.isArray(m==null?void 0:m.anyValuesMatch)&&h.some(b=>{var y;return(y=m.anyValuesMatch)==null?void 0:y.includes(b)}))&&(((o=i==null?void 0:i.responseSchema)==null?void 0:o.type)==="array"?((a=i==null?void 0:i.responseSchema)!=null&&a.minItems&&(!(n!=null&&n[`question_${i.id}`])||(n==null?void 0:n[`question_${i.id}`].length)<((s=i==null?void 0:i.responseSchema)==null?void 0:s.minItems))&&r.addIssue({code:ne.ZodIssueCode.custom,message:ee.t("onboarding:fields.additionalQuestions.validation.required"),path:[`question_${i.id}`]}),(l=i==null?void 0:i.responseSchema)!=null&&l.maxItems&&(n==null?void 0:n[`question_${i.id}`].length)>((d=i==null?void 0:i.responseSchema)==null?void 0:d.maxItems)&&r.addIssue({code:ne.ZodIssueCode.custom,message:ee.t("onboarding:fields.additionalQuestions.validation.maxItems",{maxItems:(p=i==null?void 0:i.responseSchema)==null?void 0:p.maxItems}),path:[`question_${i.id}`]})):n!=null&&n[`question_${i.id}`]||r.addIssue({code:ne.ZodIssueCode.custom,message:ee.t("onboarding:fields.additionalQuestions.validation.required"),path:[`question_${i.id}`]}))}}})})},uRe=()=>{var N;const e=Bi(),{clientData:t}=Kr(),{originScreenId:n,goTo:r,updateSessionData:i}=Io(),o=n==="review-attest-section",a=((N=t==null?void 0:t.outstanding)==null?void 0:N.questionIds)??[],s=(t==null?void 0:t.questionResponses)??[],l=c.useMemo(()=>{const P=s.map(z=>z.questionId??"undefined");return[...new Set([...a,...P])]},[a,s]),{data:d,status:p,error:h}=jp({questionIds:l.join(",")}),f=c.useMemo(()=>l.reduce((P,z)=>{const T=s==null?void 0:s.find($=>$.questionId===z);return P[`question_${z}`]=T?T.values:[],P},{}),[l,s]),m=As((t==null?void 0:t.id)??""),{mutate:b,error:y,status:v}=na({mutation:{onMutate:async P=>{await e.cancelQueries({queryKey:m});const z=e.getQueryData(["client",t==null?void 0:t.id]);return e.setQueryData(m,T=>{var $,H;return{...T,outstanding:{...T==null?void 0:T.outstanding,questionIds:((H=($=T==null?void 0:T.outstanding)==null?void 0:$.questionIds)==null?void 0:H.filter(O=>!(P.data.questionResponses??[]).some(R=>R.questionId===O)))??[]},questionResponses:[...P.data.questionResponses??[]]}}),{previousClientData:z}},onError:(P,z,T)=>{e.setQueryData(m,T==null?void 0:T.previousClientData)},onSuccess:P=>{e.setQueryData(m,P),o?r("review-attest-section",{reviewScreenOpenedSectionId:"additional-questions-section"}):(r("overview"),i({mockedVerifyingSectionId:"additional-questions-section"}))}}}),x=P=>{var O,R,B,V,G,j,U,D;const z=`question_${P.id??"undefined"}`,T=((R=(O=P==null?void 0:P.responseSchema)==null?void 0:O.items)==null?void 0:R.type)??"string",$=(V=(B=P==null?void 0:P.responseSchema)==null?void 0:B.items)==null?void 0:V.enum,H=u.jsx("div",{className:"",children:(j=(G=P.description)==null?void 0:G.split(`
7782
7782
  `))==null?void 0:j.map((A,F)=>u.jsx("div",{children:u.jsx($t,{asterisk:F===0,className:ye({"eb-ml-4":F>0}),children:A},F)}))});if(P.id&&hoe.includes(P.id))return u.jsx(jt,{control:C.control,name:z,render:({field:A})=>u.jsxs(Ct,{children:[H,u.jsx(it,{children:u.jsx(vn,{...A,type:"date",onChange:F=>A.onChange([F.target.value])})}),u.jsx(Ht,{})]})});if(P.id&&lRe.includes(P.id))return u.jsx(jt,{control:C.control,name:z,render:({field:A})=>{var F;return u.jsxs(Ct,{children:[H,u.jsx(it,{children:u.jsxs("div",{className:"eb-relative",children:[u.jsx("span",{className:"eb-absolute eb-left-3 eb-translate-y-2 eb-text-gray-500",children:"$"}),u.jsx(vn,{type:"number",min:0,max:1e10,step:.01,placeholder:"0.00",className:"eb-pl-7",...A,value:(F=A.value)==null?void 0:F[0],onChange:_=>{const W=parseFloat(_.target.value);W>=0&&W<=1e10&&A.onChange([_.target.value])},onBlur:_=>{const W=parseFloat(_.target.value);W<0&&A.onChange(["0"]),W>1e10&&A.onChange(["10000000000"])}})]})}),u.jsx(Ht,{})]})}});switch(T){case"boolean":return u.jsx(jt,{control:C.control,name:z,render:({field:A})=>{var F;return u.jsxs(Ct,{className:"eb-space-y-3",children:[H,u.jsx(it,{children:u.jsxs(kp,{onValueChange:_=>A.onChange([_]),defaultValue:(F=A==null?void 0:A.value)==null?void 0:F[0],className:"eb-flex eb-flex-col eb-space-y-1",children:[u.jsxs(Ct,{className:"eb-flex eb-items-center eb-space-x-3 eb-space-y-0",children:[u.jsx(it,{children:u.jsx(ks,{value:"true"})}),u.jsx($t,{className:"eb-font-normal",children:"Yes"})]}),u.jsxs(Ct,{className:"eb-flex eb-items-center eb-space-x-3 eb-space-y-0",children:[u.jsx(it,{children:u.jsx(ks,{value:"false"})}),u.jsx($t,{className:"eb-font-normal",children:"No"})]})]})}),u.jsx(Ht,{})]})}});case"string":return $?(U=P==null?void 0:P.responseSchema)!=null&&U.maxItems&&((D=P==null?void 0:P.responseSchema)==null?void 0:D.maxItems)>0?u.jsx(jt,{control:C.control,name:z,render:()=>u.jsxs(Ct,{children:[H,$.map(A=>u.jsx(jt,{control:C.control,name:z,render:({field:F})=>{var _;return u.jsxs(Ct,{className:"eb-flex eb-flex-row eb-items-start eb-space-x-3 eb-space-y-0",children:[u.jsx(it,{children:u.jsx(mo,{checked:(_=F.value)==null?void 0:_.includes(A),onCheckedChange:W=>{var Z;return W?F.onChange([...F.value,A]):F.onChange((Z=F.value)==null?void 0:Z.filter(X=>X!==A))}})}),u.jsx($t,{className:"eb-font-normal",children:A})]},A)}},A)),u.jsx(Ht,{})]})}):u.jsx(jt,{control:C.control,name:z,render:({field:A})=>{var F;return u.jsxs(Ct,{children:[H,u.jsxs(Fa,{onValueChange:_=>A.onChange([_]),defaultValue:(F=A==null?void 0:A.value)==null?void 0:F[0],children:[u.jsx(it,{children:u.jsx(Jo,{children:u.jsx($a,{placeholder:"Select an option"})})}),u.jsx(ea,{children:$.map(_=>u.jsx(go,{value:_,children:_},_))})]}),u.jsx(Ht,{})]})}}):u.jsx(jt,{control:C.control,name:z,render:({field:A})=>u.jsxs(Ct,{children:[H,u.jsx(it,{children:u.jsx(vn,{...A,onChange:F=>A.onChange([F.target.value])})}),u.jsx(Ht,{})]})});case"integer":return u.jsx(jt,{control:C.control,name:z,render:({field:A})=>u.jsxs(Ct,{children:[H,u.jsx(it,{children:u.jsx(vn,{type:"number",...A,onChange:F=>A.onChange([F.target.value])})}),u.jsx(Ht,{})]})});default:return u.jsx(jt,{control:C.control,name:z,render:({field:A})=>u.jsxs(Ct,{children:[H,u.jsx(it,{children:u.jsx(vn,{...A,onChange:F=>A.onChange([F.target.value])})}),u.jsx(Ht,{})]})})}},w=c.useMemo(()=>{const P=(d==null?void 0:d.questions)??[];return P?cRe(P):ne.object({})},[d]),C=ki({resolver:yo(w),defaultValues:f}),M=P=>{var H,O;if(!P.parentQuestionId)return!0;const z=(H=d==null?void 0:d.questions)==null?void 0:H.find(R=>R.id===P.parentQuestionId);if(!z)return!1;const T=C.watch(`question_${z.id}`);if(!T)return!1;const $=(O=z==null?void 0:z.subQuestions)==null?void 0:O.find(R=>{var B;return(B=R.questionIds)==null?void 0:B.includes(P.id??"")});return typeof($==null?void 0:$.anyValuesMatch)=="string"?T.includes($.anyValuesMatch):Array.isArray($==null?void 0:$.anyValuesMatch)?T.some(R=>{var B;return(B=$.anyValuesMatch)==null?void 0:B.includes(R)}):!1},S=P=>!P.parentQuestionId,I=P=>{if(t!=null&&t.id){const T={questionResponses:Object.entries(P).map(([$,H])=>({questionId:$.replace("question_",""),values:Array.isArray(H)?H:[H]}))};b({id:t.id,data:T})}},L=()=>{var P;return d?(P=d==null?void 0:d.questions)==null?void 0:P.filter(S).filter(M).map((z,T)=>{var $;return u.jsxs(c.Fragment,{children:[T!==0&&u.jsx(Mp,{}),u.jsx("div",{className:"eb-mb-6",children:x(z)}),($=d==null?void 0:d.questions)==null?void 0:$.filter(H=>H.parentQuestionId===z.id).filter(M).map(H=>u.jsx("div",{className:"eb-mb-6",children:x(H)},H.id))]},z.id)}):u.jsx("div",{className:"eb-text-muted-foreground",children:"There are no additional questions. You may proceed to the next step."})},E=p==="pending"||v==="pending";return p==="pending"?u.jsx(Ds,{message:"Loading questions..."}):u.jsx(dr,{...C,children:u.jsx("form",{onSubmit:C.handleSubmit(I),className:"eb-space-y-6",children:u.jsx(Os,{title:"Operational details",description:"Please answer these additional questions to help us understand your business operations.",children:u.jsxs("div",{className:"eb-mt-6 eb-flex-auto eb-space-y-6",children:[L(),u.jsx(Gr,{error:h||y}),u.jsxs(_e,{type:"submit",size:"lg",className:"eb-w-full eb-text-lg",disabled:E,children:[v==="pending"&&u.jsx(Ln,{className:"eb-animate-spin"}),o?"Save and return to review":"Save and return to overview"]})]})})})})},dRe=()=>{const{organizationType:e,clientData:t,documentRequests:n}=Kr(),{sections:r,goTo:i,sessionData:o,updateSessionData:a}=Io(),{sectionStatuses:s,stepValidations:l}=dH(r,o,t,n),{t:d}=Qt(["onboarding-overview","onboarding","common"]),p=o.mockedKycCompleted||(t==null?void 0:t.status)==="APPROVED",h=d(`organizationTypes.${e}`),f=ure(n);return u.jsx(Os,{title:u.jsxs("div",{className:"eb-flex eb-items-center eb-justify-between",children:[u.jsx("p",{children:d("screens.overview.title")}),u.jsxs(_e,{variant:"outline",size:"sm",children:[u.jsx($1,{})," Download Checklist"]})]}),subTitle:!o.hideOverviewInfoAlert&&(t==null?void 0:t.status)==="NEW"?u.jsxs(rn,{variant:"informative",density:"sm",noTitle:!0,children:[u.jsx(sr,{className:"eb-size-4"}),u.jsx(on,{children:d("screens.overview.infoAlert")}),u.jsxs("button",{type:"button",className:"eb-hover:eb-opacity-100 eb-focus:eb-outline-none eb-focus:eb-ring-2 eb-focus:eb-ring-ring eb-focus:eb-ring-offset-2 eb-disabled:eb-pointer-events-none eb-absolute eb-right-4 eb-top-3 eb-rounded-sm eb-opacity-70 eb-ring-offset-background eb-transition-opacity data-[state=open]:eb-bg-accent data-[state=open]:eb-text-muted-foreground [&&]:eb-pl-0",onClick:()=>{a({hideOverviewInfoAlert:!0})},children:[u.jsx(lr,{className:"eb-size-4 eb-pl-0 eb-text-foreground"}),u.jsx("span",{className:"eb-sr-only",children:"Close"})]})]}):void 0,description:d("screens.overview.description"),children:u.jsxs("div",{className:"eb-flex-auto eb-space-y-6",children:[u.jsxs(an,{className:"eb-mt-6 eb-rounded-md eb-border-none eb-bg-card",children:[u.jsx(Ia,{className:"eb-p-3",children:u.jsx(wi,{children:u.jsx("h2",{className:"eb-font-header eb-text-2xl eb-font-medium",children:"Verify your business"})})}),u.jsxs(Ko,{className:"eb-p-3 eb-pt-0",children:[(t==null?void 0:t.status)==="REVIEW_IN_PROGRESS"&&!f&&u.jsxs(rn,{variant:"informative",density:"sm",className:"eb-mb-6",children:[u.jsx(N1,{className:"eb-size-4"}),u.jsx(vr,{children:"Great work!"}),u.jsxs(on,{children:["Please hang tight while we verify your details. This should only take a moment.",u.jsx(Ln,{className:"eb-mt-1.5 eb-size-9 eb-animate-spin eb-stroke-primary"})]})]}),(t==null?void 0:t.status)==="REVIEW_IN_PROGRESS"&&f&&u.jsxs(rn,{variant:"informative",density:"sm",className:"eb-mb-6",children:[u.jsx(N1,{className:"eb-size-4"}),u.jsx(vr,{children:"We have your documents"}),u.jsxs(on,{children:["Please hang tight if you can while we verify your documents.",u.jsx(Ln,{className:"eb-mt-1.5 eb-size-9 eb-animate-spin eb-stroke-primary"})]})]}),(t==null?void 0:t.status)==="INFORMATION_REQUESTED"&&u.jsxs(rn,{variant:"warning",density:"sm",className:"eb-mb-6",noTitle:!0,children:[u.jsx(Fn,{className:"eb-size-4"}),u.jsx(on,{children:"We're having trouble verifying your business. Please provide supporting documentation."})]}),(t==null?void 0:t.status)==="DECLINED"&&u.jsxs(rn,{variant:"destructive",density:"sm",children:[u.jsx(ar,{className:"eb-size-4"}),u.jsx(vr,{children:"Application declined"}),u.jsx(on,{children:"We're sorry, but we cannot proceed with your application at this time."})]}),(t==null?void 0:t.status)==="APPROVED"&&u.jsxs(rn,{variant:"success",density:"sm",children:[u.jsx(Lr,{className:"eb-size-4"}),u.jsx(vr,{children:"All set!"}),u.jsx(on,{children:"Your business details have been verified"})]}),u.jsxs("div",{className:"eb-space-y-3",children:[(t==null?void 0:t.status)==="NEW"&&u.jsxs("div",{className:"eb-space-y-3 eb-rounded eb-bg-accent eb-px-4 eb-py-3",children:[u.jsx("p",{className:"eb-text-xs eb-font-semibold eb-tracking-normal eb-text-muted-foreground",children:"Your selected business type"}),u.jsxs("div",{children:[u.jsxs("span",{id:"business-structure",className:"eb-inline-flex eb-h-10 eb-w-full eb-items-center eb-justify-between eb-gap-2 eb-rounded-input eb-border eb-py-2 eb-pl-3 eb-text-sm",children:[u.jsx("span",{className:"eb-flex eb-text-start eb-font-sans eb-text-sm eb-font-normal eb-normal-case eb-text-foreground",children:h}),u.jsxs(_e,{variant:"ghost",size:"sm",onClick:()=>i("gateway"),"aria-label":"Edit business type",className:"eb-rounded-input hover:eb-bg-black/5",children:[u.jsx(yi,{}),"Edit"]})]}),u.jsxs("p",{className:"eb-mt-3 eb-flex eb-gap-2 eb-text-xs eb-italic eb-text-muted-foreground",children:[u.jsx(Fn,{className:"eb-size-4"})," If you change this after starting the application, you may lose your saved progress."]})]})]}),r.map(m=>{var w,C,M;const b=s==null?void 0:s[m.id],y=b==="on_hold"||b==="completed_disabled",v=l[m.id]?(C=(w=m.stepperConfig)==null?void 0:w.steps.find(S=>l[m.id][S.id]&&!l[m.id][S.id].isValid))==null?void 0:C.id:void 0,x=uH(t,(M=m.stepperConfig)==null?void 0:M.associatedPartyFilters);return b==="hidden"?null:u.jsxs("div",{children:[b==="on_hold"&&m.sectionConfig.onHoldText&&u.jsxs("p",{className:ye("eb-mb-3 eb-mt-7 eb-flex eb-items-center eb-gap-2 eb-text-sm eb-font-medium",{"eb-text-muted-foreground":y}),children:[u.jsx(O1,{className:"eb-size-4"}),m.sectionConfig.onHoldText]}),u.jsxs(an,{className:ye("eb-rounded-md eb-border eb-bg-card eb-p-3",{"eb-border-dashed eb-border-muted-foreground":y}),children:[u.jsxs("div",{className:"eb-flex eb-w-full eb-items-center eb-justify-between",children:[u.jsxs("div",{className:"eb-flex eb-items-center eb-gap-2",children:[u.jsx(m.sectionConfig.icon,{className:ye("eb-size-4",{"eb-text-muted-foreground":y})}),u.jsx("h3",{className:ye("eb-font-header eb-text-lg eb-font-medium",{"eb-text-muted-foreground":y}),children:m.sectionConfig.label})]}),u.jsxs("div",{className:"eb-flex [&_svg]:eb-size-4",children:[(b==="completed"||b==="completed_disabled")&&u.jsxs(u.Fragment,{children:[u.jsx(so,{className:"eb-stroke-success"}),u.jsx("span",{className:"eb-sr-only",children:"Completed"})]}),["not_started","on_hold"].includes(b)&&u.jsxs(u.Fragment,{children:[u.jsx(Oo,{className:"eb-stroke-muted-foreground"}),u.jsx("span",{className:"eb-sr-only",children:"Not started"})]}),b==="missing_details"&&u.jsxs(u.Fragment,{children:[u.jsx(Fn,{className:"eb-stroke-warning"}),u.jsx("span",{className:"eb-sr-only",children:"Missing details"})]})]})]}),m.sectionConfig.requirementsList&&u.jsx("ul",{className:"eb-mt-1.5 eb-w-full eb-list-disc eb-whitespace-break-spaces eb-pl-8 eb-text-start eb-font-sans eb-text-sm eb-font-normal",children:m.sectionConfig.requirementsList.map((S,I)=>u.jsx("li",{children:S},I))}),u.jsx("div",{className:"eb-flex eb-justify-end",children:u.jsxs(_e,{variant:["completed","on_hold"].includes(b)?"secondary":"default",size:"sm",className:ye("eb-mt-3",{"eb-hidden":b==="completed_disabled"}),disabled:y,onClick:()=>{i(m.id,{editingPartyId:x.id,previouslyCompleted:b==="completed",initialStepperStepId:v})},children:[["on_hold","not_started"].includes(b)&&u.jsxs(u.Fragment,{children:[d("common:start"),u.jsx(xa,{})]}),b==="completed"&&u.jsxs(u.Fragment,{children:[d("common:edit"),u.jsx(yi,{})]}),b==="missing_details"&&u.jsxs(u.Fragment,{children:[d("common:continue"),u.jsx(xa,{})]})]})})]})]},m.id)})]})]})]}),u.jsxs(an,{className:"eb-mt-6 eb-rounded-md eb-border-none eb-bg-card",children:[u.jsx(Ia,{className:"eb-p-3",children:u.jsx(wi,{children:u.jsx("h2",{className:"eb-font-header eb-text-2xl eb-font-medium",children:"Link a bank account for payouts"})})}),u.jsx(Ko,{className:"eb-p-3 eb-pt-0",children:u.jsx("div",{className:"eb-space-y-3",children:u.jsxs("div",{children:[u.jsxs("p",{className:ye("eb-mb-3 eb-flex eb-items-center eb-gap-2 eb-text-sm eb-font-medium",{"eb-text-muted-foreground":!p}),children:[u.jsx(O1,{className:"eb-size-4"}),"Available after business verification"]}),u.jsxs(an,{className:ye("eb-rounded-md eb-border eb-bg-card eb-p-3",{"eb-border-dashed eb-border-muted-foreground":!p}),children:[u.jsxs("div",{className:"eb-flex eb-w-full eb-justify-between",children:[u.jsxs("div",{className:"eb-flex eb-items-center eb-gap-2",children:[u.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[u.jsx("path",{d:"M5.5 4V3H6.5V4H5.5Z",fill:"#4C5157",fillOpacity:"0.4"}),u.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 0L12 6H10V11H12V12H0V11L2 11V6H0L6 0ZM3 6V11H4V6H3ZM5 6V11H7V6H5ZM8 6V11H9V6H8ZM6 1.41421L9.58579 5H2.41421L6 1.41421Z",fill:"#4C5157",fillOpacity:p?"1":"0.8"})]}),u.jsx("h3",{className:ye("eb-font-header eb-text-lg eb-font-medium",{"eb-text-muted-foreground":!p}),children:"Link an account"})]}),u.jsxs("div",{className:"eb-flex [&_svg]:eb-size-4",children:[u.jsx(Oo,{className:"eb-stroke-gray-600"}),u.jsx("span",{className:"eb-sr-only",children:"Not started"})]})]}),u.jsxs(_e,{variant:"secondary",size:"sm",className:"eb-mt-3 eb-w-full",disabled:!p,children:[d("common:start"),u.jsx(xa,{})]})]})]})})})]})]})})},pRe=ne.object({controllerEmail:ne.string().email(ee.t("onboarding:fields.organizationEmail.validation.invalid")).max(100,ee.t("onboarding:fields.organizationEmail.validation.maxLength")),controllerPhone:$h,controllerAddresses:ne.array(Ph).refine(e=>{const t=e.map(n=>n.addressType);return new Set(t).size===t.length},ee.t("onboarding:fields.controllerAddresses.validation.uniqueTypes"))}),G$=()=>{const{t:e}=Qt("onboarding-overview"),t=ii();return console.log(t.formState.errors),u.jsxs("div",{className:"eb-mt-6 eb-space-y-6",children:[u.jsx(Ce,{control:t.control,name:"controllerEmail",type:"email"}),u.jsx(Ce,{control:t.control,name:"controllerPhone.phoneNumber",type:"phone"}),u.jsxs("fieldset",{className:"eb-grid eb-gap-3",children:[u.jsx("legend",{className:"eb-mb-3 eb-font-header eb-text-lg eb-font-medium",children:"Personal address"}),u.jsx(Ce,{control:t.control,name:"controllerAddresses.0.country",type:"combobox",options:xr.map(n=>({value:n,label:u.jsxs("span",{children:[u.jsxs("span",{className:"eb-font-medium",children:["[",n,"]"]})," ",e([`common:countries.${n}`])]})}))}),u.jsx(Ce,{control:t.control,name:"controllerAddresses.0.primaryAddressLine",type:"text"}),u.jsx(Ce,{control:t.control,name:"controllerAddresses.0.additionalAddressLines.0.value",type:"text",description:"Apt, Suite, Unit, Building etc."}),u.jsx(Ce,{control:t.control,name:"controllerAddresses.0.additionalAddressLines.1.value",type:"text",description:""}),u.jsx(Ce,{control:t.control,name:"controllerAddresses.0.postalCode",type:"text",className:"eb-max-w-48"}),u.jsx(Ce,{control:t.control,name:"controllerAddresses.0.city",type:"text"}),u.jsx(Ce,{control:t.control,name:"controllerAddresses.0.state",type:"combobox",options:Fh})]})]})};G$.schema=pRe,G$.modifyFormValuesBeforeSubmit=e=>({...e,controllerPhone:{...e.controllerPhone,phoneType:"MOBILE_PHONE"}});const hRe=18,fRe=120,mRe=ne.object({birthDate:ne.string().regex(/^\d{4}-\d{2}-\d{2}$/,ee.t("onboarding:fields.birthDate.validation.format")).refine(e=>!Number.isNaN(new Date(e).getTime()),ee.t("onboarding:fields.birthDate.validation.invalid")).refine(e=>new Date(e)<=new Date,ee.t("onboarding:fields.birthDate.validation.future")).refine(e=>{const t=new Date(e);return new Date().getFullYear()-t.getFullYear()>=hRe},ee.t("onboarding:fields.birthDate.validation.tooYoung")).refine(e=>{const t=new Date(e);return new Date().getFullYear()-t.getFullYear()<=fRe},ee.t("onboarding:fields.birthDate.validation.tooOld")),countryOfResidence:ne.string().length(2,ee.t("onboarding:fields.countryOfResidence.validation.exactlyTwoChars")).refine(e=>e==="US",{message:"Only US is supported at this time."}),controllerIds:ne.array(cte).refine(e=>{const t=e.map(n=>n.idType);return new Set(t).size===t.length},ee.t("onboarding:fields.controllerIds.validation.uniqueTypes"))}),BH=()=>{const{t:e}=Qt(["onboarding-overview","onboarding"]),t=ii(),n=o=>e(o?[`idValueLabels.${o}`,`onboarding:idValueLabels.${o}`]:["onboarding:idValueLabels.placeholder"]),r=o=>o?e([`idValueDescriptions.${o}`]):"",i=t.watch("controllerIds.0.idType");return c.useEffect(()=>{t.watch("controllerIds.0.issuer")!=="US"&&t.setValue("controllerIds.0.issuer","US")},[t.watch("controllerIds.0.issuer")]),u.jsxs("div",{className:"eb-mt-6 eb-space-y-6",children:[u.jsx(Ce,{control:t.control,name:"birthDate",type:"importantDate",labelClassName:"eb-mb-1 eb-font-header eb-text-lg eb-font-medium"}),u.jsx(Ce,{control:t.control,name:"countryOfResidence",type:"combobox",options:xr.map(o=>({value:o,label:u.jsxs("span",{children:[u.jsxs("span",{className:"eb-font-medium",children:["[",o,"]"]})," ",e([`common:countries.${o}`])]})}))}),t.watch("countryOfResidence")==="US"&&u.jsxs("div",{className:"eb-space-y-3",children:[u.jsx(Ce,{control:t.control,name:"controllerIds.0.value",type:"text",maskFormat:"### - ## - ####",maskChar:"_",label:n(i),description:r(i)}),u.jsxs(soe,{children:[u.jsx(loe,{asChild:!0,children:u.jsxs(_e,{variant:"ghost",type:"button",size:"sm",className:"",children:["Use a different ID type",u.jsx(ao,{})]})}),u.jsx(RH,{className:"eb-component",children:["SSN","ITIN"].map(o=>u.jsx(HH,{disabled:t.watch("controllerIds.0.idType")===o,onClick:()=>{t.setValue("controllerIds.0.idType",o),t.setValue("controllerIds.0.value","")},children:u.jsx("div",{className:"eb-flex eb-items-center eb-gap-2",children:n(o)})},o))})]})]})]})};BH.schema=mRe;const VH=/^[a-zA-Z0-9()_/\\&+%@#;,.: -?]*$/,gRe=/^[A-Za-z.IVX]*$/,yRe=ne.object({controllerFirstName:ne.string().min(2,ee.t("onboarding:fields.controllerFirstName.validation.minLength")).max(30,ee.t("onboarding:fields.controllerFirstName.validation.maxLength")).regex(VH,ee.t("onboarding:fields.firstName.validation.pattern")).refine(e=>!/\s\s/.test(e),ee.t("onboarding:fields.controllerName.validation.noConsecutiveSpaces")).refine(e=>!/-{2,}/.test(e),ee.t("onboarding:fields.controllerName.validation.noConsecutiveHyphens")),controllerMiddleName:ne.string().max(30,ee.t("onboarding:fields.controllerMiddleName.validation.maxLength")).regex(VH,ee.t("onboarding:fields.controllerMiddleName.validation.pattern")),controllerLastName:ne.string().min(2,ee.t("onboarding:fields.controllerLastName.validation.minLength")).max(30,ee.t("onboarding:fields.controllerLastName.validation.maxLength")).regex(VH,ee.t("onboarding:fields.controllerLastName.validation.pattern")).refine(e=>!/\s\s/.test(e),ee.t("onboarding:fields.controllerName.validation.noConsecutiveSpaces")).refine(e=>!/-{2,}/.test(e),ee.t("onboarding:fields.controllerName.validation.noConsecutiveHyphens")),controllerNameSuffix:ne.string().min(1,ee.t("onboarding:fields.controllerNameSuffix.validation.minLength")).max(5,ee.t("onboarding:fields.controllerNameSuffix.validation.maxLength")).regex(gRe,ee.t("onboarding:fields.controllerNameSuffix.validation.pattern")),controllerJobTitle:ne.union([ne.enum(["CEO","CFO","COO","President","Chairman","Senior Branch Manager","Other"]),ne.literal("")]).refine(e=>e!=="",{message:ee.t("common:validation.required")}),controllerJobTitleDescription:ne.string().max(50,ee.t("onboarding:fields.controllerJobTitleDescription.validation.maxLength")).regex(/^[a-zA-Z0-9\s,.&-]+$/,ee.t("onboarding:fields.controllerJobTitleDescription.validation.pattern")).refine(e=>!/(<[^>]*>)/.test(e),ee.t("onboarding:fields.controllerJobTitleDescription.validation.noHtml")).refine(e=>!/https?:\/\/[^\s]+/.test(e),ee.t("onboarding:fields.controllerJobTitleDescription.validation.noUrls"))}),bRe=e=>e.superRefine((t,n)=>{t.controllerJobTitle==="Other"&&!t.controllerJobTitleDescription&&n.addIssue({code:ne.ZodIssueCode.custom,message:ee.t("onboarding:fields.controllerJobTitleDescription.validation.required"),path:["controllerJobTitleDescription"]})}),cf=()=>{const e=ii(),t=e.watch("controllerJobTitle");return u.jsxs("div",{className:"eb-mt-6 eb-space-y-6",children:[u.jsxs("fieldset",{className:"eb-grid eb-gap-y-3",children:[u.jsx("legend",{className:"eb-mb-1.5 eb-text-lg eb-font-medium",children:"Legal name"}),u.jsx("p",{className:"eb-text-sm",children:"Your full name as recorded with government agencies"}),u.jsx(Ce,{control:e.control,name:"controllerFirstName",type:"text"}),u.jsx(Ce,{control:e.control,name:"controllerMiddleName",type:"text"}),u.jsx(Ce,{control:e.control,name:"controllerLastName",type:"text"}),u.jsx(Ce,{control:e.control,name:"controllerNameSuffix",type:"text",className:"eb-max-w-48"})]}),u.jsxs("div",{className:"eb-space-y-6",children:[u.jsx(Ce,{control:e.control,name:"controllerJobTitle",type:"combobox",options:[{value:"CEO",label:"CEO"},{value:"CFO",label:"CFO"},{value:"COO",label:"COO"},{value:"President",label:"President"},{value:"Chairman",label:"Chairman"},{value:"Senior Branch Manager",label:"Senior Branch Manager"},{value:"Other",label:"Other"}]}),t==="Other"&&u.jsx(Ce,{control:e.control,name:"controllerJobTitleDescription",type:"text",required:!0})]})]})};cf.schema=yRe,cf.refineSchemaFn=bRe,cf.modifyFormValuesBeforeSubmit=(e,t)=>{var r;return e.controllerJobTitle!=="Other"&&delete e.controllerJobTitleDescription,{...e,countryOfResidence:((r=t==null?void 0:t.individualDetails)==null?void 0:r.countryOfResidence)??"US"}};const uf=[{id:"personal-details",stepType:"form",title:"Personal details",description:"We collect personal information to verify individuals for security and compliance.",Component:cf},{id:"identity-document",stepType:"form",title:"Identity document",description:"We need some additional details to verify individuals for security and compliance.",Component:BH},{id:"contact-details",stepType:"form",title:"Contact details",description:"We need some additional details to confirm your identity.",Component:G$},{id:"check-answers",stepType:"check-answers",title:"Check your answers",description:"Please ensure your answers are accurate and complete anything you may have missed."}],vRe=()=>{var R,B,V;const{clientData:e,onPostPartySettled:t,organizationType:n,documentRequests:r}=Kr(),{t:i}=Qt(["onboarding","onboarding-overview","common"]),o=Bi(),a=(R=e==null?void 0:e.parties)==null?void 0:R.find(G=>{var j;return(G==null?void 0:G.partyType)==="INDIVIDUAL"&&((j=G==null?void 0:G.roles)==null?void 0:j.includes("CONTROLLER"))&&G.active}),{currentScreenId:s,originScreenId:l,goTo:d,previouslyCompletedScreens:p,sections:h,sessionData:f,updateSessionData:m}=Io(),{sectionStatuses:b}=dH(h,f,e,r),y=l==="review-attest-section",v=p[s],x=ki({defaultValues:{controllerIsAnOwner:a?(B=a.roles)!=null&&B.includes("BENEFICIAL_OWNER")?"yes":v?"no":void 0:void 0}}),{mutate:w,error:C,status:M}=ra();c.useEffect(()=>{const G=(j,U)=>{w({partyId:j,data:{roles:U}},{onSettled:(D,A)=>{var F;t==null||t(D,(F=A==null?void 0:A.response)==null?void 0:F.data)},onSuccess:D=>{var A;e&&(o.setQueryData(As(e.id),F=>{var _;return{...F,parties:(_=F==null?void 0:F.parties)==null?void 0:_.map(W=>W.id===D.id?{...W,...D}:W)}}),x.setValue("controllerIsAnOwner",(A=D.roles)!=null&&A.includes("BENEFICIAL_OWNER")?"yes":"no"))},onError:D=>{var A,F,_,W,Z;x.setValue("controllerIsAnOwner",(A=a==null?void 0:a.roles)!=null&&A.includes("BENEFICIAL_OWNER")?"yes":"no"),x.setError("controllerIsAnOwner",{type:"server",message:(Z=(W=(_=(F=D==null?void 0:D.response)==null?void 0:F.data)==null?void 0:_.context)==null?void 0:W[0])==null?void 0:Z.message})}})};x.watch("controllerIsAnOwner")==="yes"&&(a!=null&&a.id)&&(a!=null&&a.roles)&&!a.roles.includes("BENEFICIAL_OWNER")?G(a.id,[...a.roles,"BENEFICIAL_OWNER"]):x.watch("controllerIsAnOwner")==="no"&&(a!=null&&a.id)&&(a!=null&&a.roles)&&a.roles.includes("BENEFICIAL_OWNER")&&G(a.id,[...a.roles.filter(j=>j!=="BENEFICIAL_OWNER")])},[x.watch("controllerIsAnOwner")]);const{mutate:S,error:I,status:L}=ra(),E=((V=e==null?void 0:e.parties)==null?void 0:V.filter(G=>{var j;return(G==null?void 0:G.partyType)==="INDIVIDUAL"&&((j=G==null?void 0:G.roles)==null?void 0:j.includes("BENEFICIAL_OWNER"))}))||[],N=E.filter(G=>G.active||G.status==="ACTIVE"),P=dre(uf,N,e),z=G=>{var j;if(G){const U=P[G]?(j=uf.find(D=>P[G].stepValidationMap[D.id]&&!P[G].stepValidationMap[D.id].isValid))==null?void 0:j.id:void 0;d("owner-stepper",{editingPartyId:G,previouslyCompleted:P[G].allStepsValid,shortLabelOverride:"Edit owner",initialStepperStepId:U})}else d("owner-stepper",{shortLabelOverride:"Add owner"})},T=G=>{S({partyId:G,data:{active:!1}},{onSuccess:j=>{if(e){const U=As(e.id);o.setQueryData(U,D=>{var A;return{...D,parties:(A=D==null?void 0:D.parties)==null?void 0:A.map(F=>F.id===j.id?{...F,...j}:F)}}),H(!1),o.invalidateQueries({queryKey:U})}}})},[$,H]=c.useState(!1),O=M==="pending"||L==="pending";return u.jsxs(Os,{title:"Owners and key roles",description:"Provide information for owners and senior managers for your company. Keep in mind that individual people may have multiple roles.",children:[u.jsxs("div",{className:"eb-mt-6 eb-flex-auto eb-space-y-6",children:[u.jsxs(rn,{variant:"informative",children:[u.jsx(sr,{className:"eb-h-4 eb-w-4"}),u.jsxs(on,{className:"eb-flex eb-flex-col",children:[u.jsxs("p",{className:"eb-mb-2 eb-text-sm eb-font-semibold",children:["For a"," ",n&&i(`onboarding-overview:organizationTypes.${n}`)]}),u.jsxs("div",{className:"eb-flex eb-items-center eb-space-x-2",children:[u.jsx("span",{className:"eb-text-lg eb-font-bold",children:"Owners"}),u.jsx(Lee,{content:u.jsxs("div",{className:"eb-space-y-3",children:[u.jsx("h2",{className:"eb-font-header eb-text-xl eb-font-medium",children:"What is an owner?"}),u.jsx("p",{className:"eb-pb-1 eb-text-sm",children:"An owner is an individual or entity that ultimately owns at least part of a business, established through a chain of ownership or by means of control other than direct control."})]}),children:u.jsx(_e,{variant:"ghost",size:"icon",children:u.jsx(sr,{className:"eb-size-6 eb-stroke-primary"})})})]}),u.jsxs("p",{children:["Please add ",u.jsx("span",{className:"eb-font-semibold",children:"all owners"})," ","holding 25% or more of the business"]})]})]}),u.jsx(dr,{...x,children:u.jsxs("form",{children:[u.jsx(Ce,{control:x.control,disableFieldRuleMapping:!0,disabled:O||a===void 0||N.length>=4&&x.watch("controllerIsAnOwner")==="no",type:"radio-group",name:"controllerIsAnOwner",label:i("beneficialOwnerStepForm.controllerIsOwnerQuestion"),description:"",tooltip:"",options:[{value:"yes",label:i("common:yes")},{value:"no",label:i("common:no")}],noOptionalLabel:!0}),b["personal-section"]!=="completed"&&u.jsxs("div",{className:"eb-mt-2 eb-flex eb-items-center",children:[u.jsxs("p",{className:"eb-flex eb-h-8 eb-items-center eb-text-sm eb-font-normal eb-text-orange-500",children:["ⓘ"," Please complete the personal details first."]}),u.jsxs(_e,{variant:"link",size:"sm",className:"eb-h-8",onClick:()=>{d("personal-section",{editingPartyId:a==null?void 0:a.id})},children:["Go now",u.jsx(cl,{})]})]}),N.length>=4&&x.watch("controllerIsAnOwner")==="no"&&M!=="pending"&&u.jsxs("p",{className:"eb-mt-1 eb-text-sm eb-font-normal eb-text-blue-500",children:["ⓘ"," ",i("beneficialOwnerStepForm.controllerCannotBeOwnerWarning")]}),u.jsx("div",{className:"eb-mt-2 eb-inline-flex eb-h-4 eb-items-center eb-justify-center eb-gap-2 eb-text-sm eb-text-muted-foreground",children:M==="pending"&&u.jsxs(u.Fragment,{children:[u.jsx(Ln,{className:"eb-pointer-events-none eb-size-4 eb-shrink-0 eb-animate-spin"}),u.jsx("span",{children:i("beneficialOwnerStepForm.makingChanges")})]})})]})}),u.jsxs("div",{className:"eb-space-y-4",children:[u.jsxs(_e,{type:"button",variant:"secondary",size:"lg",className:"eb-w-full eb-text-lg",onClick:()=>z(""),disabled:O||N.length>=4,children:[u.jsx(j1,{})," Add Owner"]}),E.length>=4&&u.jsxs("p",{className:"eb-mt-1 eb-text-sm eb-font-normal eb-text-orange-500",children:["ⓘ"," ",i("beneficialOwnerStepForm.maxOwnersWarning")]}),N.length===0&&u.jsx(an,{className:"eb-mt-6 eb-p-4 eb-shadow-md",children:u.jsxs("div",{className:"eb-flex eb-flex-col eb-items-center eb-space-y-3",children:[u.jsx("div",{className:"eb-flex eb-h-8 eb-w-8 eb-items-center eb-justify-center eb-rounded-full eb-bg-primary eb-stroke-white",children:u.jsx(_1,{className:"eb-size-4 eb-fill-white eb-stroke-white"})}),u.jsx("p",{className:"eb-text-sm",children:"No stakeholders added yet."})]})}),N.map(G=>{var j,U,D,A,F;return u.jsxs(an,{className:"eb-space-y-4 eb-rounded-lg eb-border eb-p-4",children:[u.jsxs("div",{className:"eb-space-y-1",children:[u.jsx(wi,{className:"eb-text-xl eb-font-bold eb-tracking-tight",children:ef(G)}),u.jsx("p",{className:"eb-text-sm eb-font-medium",children:((j=G.individualDetails)==null?void 0:j.jobTitle)==="Other"?`${i("jobTitles.Other")} - ${G.individualDetails.jobTitleDescription}`:i([`jobTitles.${(U=G.individualDetails)==null?void 0:U.jobTitle}`])}),u.jsxs("div",{className:"eb-flex eb-gap-2 eb-pt-2",children:[u.jsx(ur,{variant:"outline",className:"eb-border-transparent eb-bg-[#EDF4FF] eb-text-[#355FA1]",children:"Owner"}),((D=G.roles)==null?void 0:D.includes("CONTROLLER"))&&u.jsx(ur,{variant:"outline",className:"eb-border-transparent eb-bg-[#FFEBD9] eb-text-[#8F521F]",children:"Controller"})]})]}),u.jsxs("div",{className:"eb-flex eb-gap-2 eb-pt-4",children:[!((A=G.roles)!=null&&A.includes("CONTROLLER"))&&u.jsxs(y0e,{open:$,onOpenChange:H,children:[u.jsx(b0e,{asChild:!0,children:u.jsxs(_e,{variant:"ghost",size:"sm",children:[u.jsx(hd,{}),"Remove"]})}),u.jsxs(NG,{className:"eb-component",children:[u.jsxs(FG,{children:[u.jsx(PG,{children:"Remove Owner?"}),u.jsxs(OG,{children:["Are you sure you want to remove"," ",u.jsx("b",{children:ef(G)})," as an owner?"]})]}),u.jsxs($G,{children:[u.jsx(zG,{children:"Cancel"}),u.jsxs(jG,{onClick:()=>G.id&&T(G.id),children:[L==="pending"&&u.jsx(Ln,{className:"eb-size-4 eb-animate-spin"}),"Remove"]})]})]})]}),u.jsxs(_e,{variant:"outline",size:"sm",onClick:()=>G.id&&z(G.id),children:[u.jsx(yi,{}),"Edit"]})]}),G.id&&!((F=P[G.id])!=null&&F.allStepsValid)&&u.jsxs("p",{className:"eb-mt-1 eb-text-sm eb-font-normal eb-text-orange-500",children:["ⓘ"," This individual is missing some details."]})]},G.id)})]})]}),u.jsxs("div",{className:"eb-mt-6 eb-space-y-6",children:[u.jsx(Gr,{error:C||I}),u.jsx("div",{className:"eb-flex eb-justify-between eb-gap-4",children:u.jsx(_e,{type:"button",variant:"default",size:"lg",className:"eb-w-full eb-text-lg",onClick:()=>{x.getValues("controllerIsAnOwner")!==void 0&&m({isOwnersSectionDone:!0,mockedVerifyingSectionId:"owners-section"}),y?d("review-attest-section",{reviewScreenOpenedSectionId:"owners-section"}):d("overview")},disabled:O,children:y?"Save and return to review":"Save and return to overview"})})]})]})},xRe=({handlePrev:e,handleNext:t,getPrevButtonLabel:n,getNextButtonLabel:r})=>{var E,N;const{clientData:i,documentRequests:o}=Kr(),{t:a}=Qt(["onboarding","common"]),{sections:s,goTo:l,sessionData:d,reviewScreenOpenedSectionId:p}=Io(),h=ki({defaultValues:{attested:!1},resolver:yo(ne.object({attested:ne.boolean().refine(P=>P===!0,{message:"You must attest that the data is true, accurate, and complete."})}))}),{sectionStatuses:f}=dH(s,d,i,o),m=((E=i==null?void 0:i.outstanding)==null?void 0:E.questionIds)??[],b=(i==null?void 0:i.questionResponses)??[],y=c.useMemo(()=>{const P=b.map(z=>z.questionId??"undefined");return[...new Set([...m,...P])]},[m,b]),{data:v}=jp({questionIds:y.join(",")}),x=P=>{var H,O,R;if(!P.parentQuestionId)return!0;const z=(H=v==null?void 0:v.questions)==null?void 0:H.find(B=>B.id===P.parentQuestionId);if(!z)return!1;const T=(O=b.find(B=>B.questionId===z.id))==null?void 0:O.values;if(!T)return!1;const $=(R=z==null?void 0:z.subQuestions)==null?void 0:R.find(B=>{var V;return(V=B.questionIds)==null?void 0:V.includes(P.id??"")});return typeof($==null?void 0:$.anyValuesMatch)=="string"?T.includes($.anyValuesMatch):Array.isArray($==null?void 0:$.anyValuesMatch)?T.some(B=>{var V;return(V=$.anyValuesMatch)==null?void 0:V.includes(B)}):!1},w=((N=i==null?void 0:i.parties)==null?void 0:N.filter(P=>{var z;return(P==null?void 0:P.partyType)==="INDIVIDUAL"&&((z=P==null?void 0:P.roles)==null?void 0:z.includes("BENEFICIAL_OWNER"))&&P.active}))||[],C=dre(uf,w,i),M=["personal-section","business-section","owners-section","additional-questions-section"],S=M.some(P=>f[P]!=="completed"),[I,L]=c.useState(!1);return u.jsx(dr,{...h,children:u.jsxs("form",{onSubmit:P=>{P.preventDefault(),S?L(!0):h.handleSubmit(()=>{t()})(P)},className:"eb-flex eb-flex-auto eb-flex-col",children:[u.jsxs("div",{className:"eb-mt-6 eb-flex-auto eb-space-y-6",children:[u.jsxs(rn,{variant:"informative",noTitle:!0,children:[u.jsx(sr,{className:"eb-h-4 eb-w-4"}),u.jsx(on,{children:"Your application is not submitted yet. Review your data and continue to finish."})]}),S&&I&&u.jsxs(rn,{variant:"warning",children:[u.jsx(Fn,{className:"eb-h-4 eb-w-4"}),u.jsx(vr,{children:"There is a problem"}),u.jsx(on,{children:"Please provide missing details before finishing your application."})]}),u.jsx("div",{children:u.jsx(ZF,{type:"single",collapsible:!0,className:"eb-w-full",defaultValue:p??void 0,children:s.filter(P=>M.includes(P.id)).map(P=>{var $,H,O;let z=null;const T=f[P.id]==="completed";if(P.type==="stepper"&&P.id!=="review-attest-section"){const R=($=P.stepperConfig)==null?void 0:$.associatedPartyFilters,B=R?(H=i==null?void 0:i.parties)==null?void 0:H.find(V=>{var G;return(V==null?void 0:V.partyType)===R.partyType&&((G=R.roles)==null?void 0:G.every(j=>{var U;return(U=V==null?void 0:V.roles)==null?void 0:U.includes(j)}))&&V.active}):void 0;z=u.jsx(pre,{steps:P.stepperConfig.steps,partyData:B,onEditClick:V=>{l(P.id,{initialStepperStepId:V,editingPartyId:B==null?void 0:B.id})}})}else if(P.id==="owners-section"){const R=()=>{l("owners-section")};z=u.jsxs(an,{className:"eb-mt-6 eb-p-4",children:[u.jsxs("div",{className:"eb-flex eb-items-start eb-justify-between",children:[u.jsx("h2",{className:"eb-text-xl eb-font-bold eb-tracking-tight",children:"Owners"}),T?u.jsxs(_e,{variant:"ghost",type:"button",size:"sm",className:"eb-h-8 eb-p-2 eb-text-sm",onClick:R,children:[u.jsx(yi,{}),"Change"]}):u.jsxs(_e,{variant:"default",type:"button",size:"sm",className:"eb-bg-warning eb-text-sm hover:eb-bg-warning/90",onClick:R,children:[u.jsx(yi,{}),"Add"]})]}),u.jsxs("div",{className:"eb-mt-4 eb-space-y-4",children:[w.length===0&&u.jsx(an,{className:"eb-mt-6 eb-p-4 eb-shadow-md",children:u.jsxs("div",{className:"eb-flex eb-flex-col eb-items-center eb-space-y-3",children:[u.jsx("div",{className:"eb-flex eb-h-8 eb-w-8 eb-items-center eb-justify-center eb-rounded-full eb-bg-primary eb-stroke-white",children:u.jsx(_1,{className:"eb-size-4 eb-fill-white eb-stroke-white"})}),u.jsx("p",{className:"eb-text-sm",children:"No stakeholders added yet."})]})}),w.map(B=>{var V,G,j;return u.jsxs(an,{className:"eb-space-y-4 eb-rounded-lg eb-border eb-p-4",children:[u.jsxs("div",{className:"eb-space-y-1",children:[u.jsx(wi,{className:"eb-text-xl eb-font-bold eb-tracking-tight",children:ef(B)}),u.jsx("p",{className:"eb-text-sm eb-font-medium",children:((V=B.individualDetails)==null?void 0:V.jobTitle)==="Other"?`${a("jobTitles.Other")} - ${B.individualDetails.jobTitleDescription}`:a([`jobTitles.${(G=B.individualDetails)==null?void 0:G.jobTitle}`])}),u.jsxs("div",{className:"eb-flex eb-gap-2 eb-pt-2",children:[u.jsx(ur,{variant:"outline",className:"eb-border-transparent eb-bg-[#EDF4FF] eb-text-[#355FA1]",children:"Owner"}),((j=B.roles)==null?void 0:j.includes("CONTROLLER"))&&u.jsx(ur,{variant:"outline",className:"eb-border-transparent eb-bg-[#FFEBD9] eb-text-[#8F521F]",children:"Controller"})]})]}),B.id&&!C[B.id].allStepsValid&&u.jsxs("p",{className:"eb-mt-1 eb-text-sm eb-font-normal eb-text-orange-500",children:["ⓘ"," This individual is missing some details."]})]},B.id)})]})]})}else P.id==="additional-questions-section"&&(z=u.jsxs(an,{className:"eb-mt-6 eb-space-y-3 eb-rounded-lg eb-border eb-p-4",children:[u.jsxs("div",{className:"eb-flex eb-items-start eb-justify-between",children:[u.jsx("h2",{className:"eb-text-xl eb-font-bold eb-tracking-tight",children:"Operational details"}),u.jsxs(_e,{variant:"ghost",type:"button",size:"sm",className:"eb-h-8 eb-p-2 eb-text-sm",onClick:()=>{l("additional-questions-section")},children:[u.jsx(yi,{}),"Change"]})]}),(O=v==null?void 0:v.questions)==null?void 0:O.map(R=>{var G,j;if(!x(R))return null;const B=(G=R.description)==null?void 0:G.split(`
7783
- `).map((U,D)=>u.jsx("p",{className:ye({"eb-ml-4":D>0}),children:U},D));if(R.id&&((j=i==null?void 0:i.outstanding.questionIds)!=null&&j.includes(R.id)))return u.jsxs("div",{className:"eb-space-y-0.5",children:[u.jsx("div",{className:"eb-text-sm eb-font-medium",children:B}),u.jsxs("div",{className:"eb-flex eb-items-center eb-gap-1 eb-text-warning",children:[u.jsx(Fn,{className:"eb-size-4"}),u.jsx("p",{className:"eb-italic",children:"This field is missing"})]})]},R.id);const V=b==null?void 0:b.find(U=>U.questionId===R.id);return u.jsxs("div",{className:"eb-space-y-0.5",children:[u.jsx("div",{className:"eb-text-sm eb-font-medium",children:B}),u.jsxs("div",{children:[u.jsxs("b",{children:[a("reviewAndAttest.response"),":"]})," ",V&&nOe(V)||u.jsx("span",{className:"eb-italic eb-text-muted-foreground",children:a("common:empty")})]})]},R.id)})]}));return u.jsxs(Lh,{value:P.id,className:ye({"eb-border-success":T,"eb-border-warning":!T}),children:[u.jsxs(Eh,{className:ye({"eb-bg-success-accent":T,"eb-bg-warning-accent":!T}),children:[u.jsx(ao,{className:"eb-ml-2 eb-h-4 eb-w-4 eb-shrink-0 eb-transition-transform eb-duration-200"}),u.jsx("div",{className:"eb-ml-2 eb-text-sm",children:P.sectionConfig.label}),u.jsx("div",{className:"eb-ml-auto eb-mr-2 eb-flex eb-items-center eb-gap-2 eb-text-sm eb-font-normal eb-text-muted-foreground",children:T?u.jsxs(u.Fragment,{children:[u.jsx("p",{children:"Complete"}),u.jsx(Lr,{className:"eb-size-4 eb-text-success"})]}):u.jsxs(u.Fragment,{children:[u.jsx("p",{children:"Missing details"}),u.jsx(Fn,{className:"eb-size-4 eb-text-warning"})]})})]}),u.jsx(XF,{className:"eb-mt-4",children:z})]},P.id)})})}),u.jsxs("div",{className:"eb-space-y-2",children:[u.jsx("p",{className:"eb-text-sm eb-font-medium",children:"Data accuracy attestation"}),u.jsx(jt,{control:h.control,name:"attested",render:({field:P})=>u.jsxs(Ct,{children:[u.jsxs("div",{className:"eb-flex eb-items-start eb-space-x-3",children:[u.jsx(it,{children:u.jsx(mo,{className:"eb-mt-0.5 eb-rounded-sm",checked:P.value,onCheckedChange:P.onChange})}),u.jsx($t,{className:"eb-text-sm eb-font-normal eb-text-foreground peer-disabled:eb-cursor-not-allowed peer-disabled:eb-opacity-70",children:"The data I am providing is true, accurate and complete to the best of my knowledge."})]}),u.jsx(Ht,{})]})})]})]}),u.jsx("div",{className:"eb-mt-6 eb-space-y-6",children:u.jsxs("div",{className:"eb-flex eb-justify-between eb-gap-4",children:[u.jsx(_e,{onClick:e,variant:"secondary",size:"lg",className:ye("eb-w-full eb-text-lg",{"eb-hidden":n()===null}),children:n()}),u.jsx(_e,{type:"submit",variant:"default",size:"lg",className:ye("eb-w-full eb-text-lg",{"eb-hidden":r()===null}),children:r()})]})})]})})},wRe=()=>Xne().replace(/[^a-zA-Z0-9_-]/g,""),kRe=({handlePrev:e,handleNext:t,getPrevButtonLabel:n,getNextButtonLabel:r})=>{var z;const{clientData:i,onPostClientSettled:o}=Kr(),{updateSessionData:a}=Io(),{t:s}=Qt("onboarding"),l=ki({defaultValues:{attested:!1},resolver:yo(ne.object({attested:ne.boolean().refine(T=>T===!0,{message:"You must agree to all of the documents listed on this page."})}))}),{data:d}=Qne(),[p,h]=c.useState({}),[f,m]=c.useState({}),[b,y]=c.useState({}),{mutateAsync:v,error:x}=na(),{mutateAsync:w,error:C}=bX(),M=((z=i==null?void 0:i.outstanding)==null?void 0:z.attestationDocumentIds)||[],S=eN({queries:M.map(T=>({queryKey:["documentDetail",T],queryFn:()=>CX(T)}))}),I=M.every(T=>p[T]||b[T]),L=T=>async()=>{h($=>({...$,[T]:!0}));try{y(B=>({...B,[T]:null})),m(B=>({...B,[T]:!0}));const $=await SX(T,{responseType:"blob"}),H=new Blob([$],{type:"application/pdf"}),O=URL.createObjectURL(H),R=window.open(O,"_blank");if(!R)throw new Error("Failed to open document. Please check your popup blocker settings.");R.focus(),h(B=>({...B,[T]:!0}))}catch($){y(H=>({...H,[T]:$ instanceof Error?$.message:"Failed to download document"}))}finally{m($=>({...$,[T]:!1}))}},E=async()=>{var T,$,H,O,R,B,V;if(i!=null&&i.id){const G={addAttestations:[{attestationTime:new Date().toISOString(),attesterFullName:(H=($=(T=i==null?void 0:i.parties)==null?void 0:T.find(U=>(U==null?void 0:U.partyType)==="INDIVIDUAL"))==null?void 0:$.individualDetails)==null?void 0:H.firstName,ipAddress:d,documentId:(R=(O=i==null?void 0:i.outstanding)==null?void 0:O.attestationDocumentIds)==null?void 0:R[0]}]},j={consumerDevice:{ipAddress:d,sessionId:wRe()}};try{(V=(B=i==null?void 0:i.outstanding)==null?void 0:B.attestationDocumentIds)!=null&&V.length&&await v({id:i.id,data:G},{onSettled:(U,D)=>{var A;o==null||o(U,(A=D==null?void 0:D.response)==null?void 0:A.data)}}),await w({id:i.id,data:j},{onSuccess:()=>{a({mockedKycCompleted:!0}),t()}})}catch(U){console.error("Error completing KYC process:",U)}}};c.useEffect(()=>{const T=S.reduce((H,O)=>{var R;return(R=O.data)!=null&&R.id&&(H[O.data.id]=!1),H},{});Object.keys(T).some(H=>!(H in p))&&h(T)},[S.map(T=>{var $;return($=T.data)==null?void 0:$.id}).filter(Boolean)]);const[N,P]=c.useState(!1);return u.jsx(dr,{...l,children:u.jsxs("form",{onSubmit:T=>{T.preventDefault(),I?l.handleSubmit(()=>{E()})(T):P(!0)},className:"eb-flex eb-flex-auto eb-flex-col",children:[u.jsxs("div",{className:"eb-mt-6 eb-flex-auto eb-space-y-6",children:[!I&&N&&u.jsxs(rn,{variant:"destructive",noTitle:!0,children:[u.jsx(ar,{className:"eb-h-4 eb-w-4"}),u.jsx(on,{children:"Please open the document links and confirm that you have read and agree to all documents."})]}),u.jsx("div",{className:"eb-mt-2 eb-flex eb-flex-col eb-gap-2",children:M.map(T=>{var H,O;const $=S.find(R=>{var B;return((B=R.data)==null?void 0:B.id)===T});return u.jsxs("div",{className:"eb-flex eb-flex-col eb-gap-1",children:[u.jsxs(_e,{type:"button",onClick:L(T),variant:"ghost",className:ye("eb-flex eb-h-14 eb-w-full eb-justify-between eb-rounded-md eb-border eb-bg-card eb-px-4 eb-py-2 eb-font-sans eb-text-sm eb-font-normal eb-shadow-md",{"eb-border-success eb-bg-success-accent hover:eb-bg-success-accent/80":p[T]}),disabled:($==null?void 0:$.isLoading)||f[T],children:[u.jsxs("span",{className:"eb-flex eb-items-center eb-gap-2",children:[u.jsx(P1,{}),u.jsx("p",{className:"eb-text-[#12647E] eb-underline",children:$!=null&&$.isLoading?"Loading...":(H=$==null?void 0:$.data)==null?void 0:H.documentType}),u.jsx(J2,{className:"eb-text-[#12647E]"})]}),u.jsxs("span",{children:[p[T]&&u.jsx(Ri,{className:"eb-text-success"}),f[T]&&s("reviewAndAttest.termsAndConditions.downloading")]})]}),((O=$==null?void 0:$.data)==null?void 0:O.id)&&b[$==null?void 0:$.data.id]&&u.jsxs("div",{className:"eb-ml-1 eb-text-sm eb-text-destructive",children:["Failed to download document: ",b[T]]}),!$&&b[T]&&u.jsxs("div",{className:"eb-ml-1 eb-text-sm eb-text-destructive",children:["Failed to fetch document details: ",b[T]]})]},T)})}),u.jsxs("div",{className:"eb-space-y-1",children:[u.jsx("p",{className:"eb-text-sm eb-font-medium",children:"Document attestation"}),u.jsx(jt,{control:l.control,name:"attested",disabled:!I,render:({field:T})=>u.jsxs(Ct,{children:[u.jsxs("div",{className:"eb-flex eb-items-center eb-space-x-2",children:[u.jsx(it,{children:u.jsx(mo,{checked:T.value,onCheckedChange:T.onChange,disabled:T.disabled})}),u.jsx($t,{className:"eb-text-sm eb-font-normal eb-text-foreground peer-disabled:eb-cursor-not-allowed peer-disabled:eb-opacity-70",children:"I have read and agree to all of the documents listed on this page"})]}),u.jsx(Ht,{})]})})]}),!I&&u.jsxs(rn,{variant:"informative",noTitle:!0,children:[u.jsx(sr,{className:"eb-h-4 eb-w-4"}),u.jsx(on,{children:"You must open and review all documents before selecting the checkbox"})]}),u.jsx(Gr,{error:x||C})]}),u.jsx("div",{className:"eb-mt-6 eb-space-y-6",children:u.jsxs("div",{className:"eb-flex eb-justify-between eb-gap-4",children:[u.jsx(_e,{onClick:e,variant:"secondary",size:"lg",className:ye("eb-w-full eb-text-lg",{"eb-hidden":n()===null}),children:n()}),u.jsx(_e,{type:"submit",variant:"default",size:"lg",className:ye("eb-w-full eb-text-lg",{"eb-hidden":r()===null}),children:r()})]})})]})})},CRe=[{id:"gateway",isSection:!1,type:"component",Component:sRe},{id:"checklist",isSection:!1,type:"component",Component:nRe},{id:"overview",isSection:!1,type:"component",Component:dRe},{id:"owner-stepper",isSection:!1,type:"stepper",stepperConfig:{associatedPartyFilters:{partyType:"INDIVIDUAL",roles:["BENEFICIAL_OWNER"]},defaultPartyRequestBody:{partyType:"INDIVIDUAL",roles:["BENEFICIAL_OWNER"]},steps:uf}},{id:"document-upload-form",isSection:!1,type:"component",Component:oRe}],SRe=[{id:"personal-section",isSection:!0,type:"stepper",sectionConfig:{label:"Your personal details",shortLabel:"Personal details",icon:z1,requirementsList:["Your name and job title","Government issued identifier (e.g. social security number)","Address and contact details"],statusResolver:(e,t,n,r)=>e.mockedKycCompleted||(t==null?void 0:t.status)==="INFORMATION_REQUESTED"||(t==null?void 0:t.status)==="REVIEW_IN_PROGRESS"||(t==null?void 0:t.status)==="APPROVED"||(t==null?void 0:t.status)==="DECLINED"?"hidden":n?"completed":Object.entries(r).some(([,o])=>o.isValid)?"missing_details":"not_started"},stepperConfig:{associatedPartyFilters:{partyType:"INDIVIDUAL",roles:["CONTROLLER"]},defaultPartyRequestBody:{partyType:"INDIVIDUAL",roles:["CONTROLLER"]},steps:[{id:"personal-details",title:"Your personal details",stepType:"form",description:"We collect your personal information as the primary person controlling business operations for the company.",Component:cf},{id:"identity-document",title:"Your ID details",stepType:"form",description:"We need some additional details to confirm your identity.",Component:BH},{id:"contact-details",title:"Your contact details",stepType:"form",description:"We need some additional details to confirm your identity.",Component:G$},{id:"check-answers",title:"Check your answers",stepType:"check-answers",description:"Please ensure your answers are accurate and complete anything you may have missed."}]}},{id:"business-section",isSection:!0,type:"stepper",sectionConfig:{label:"Business details",icon:D1,requirementsList:["Industry classification code","Registration ID details (e.g. employer identification number)","Location and contact details"],statusResolver:(e,t,n)=>e.mockedKycCompleted||(t==null?void 0:t.status)==="INFORMATION_REQUESTED"||(t==null?void 0:t.status)==="REVIEW_IN_PROGRESS"||(t==null?void 0:t.status)==="APPROVED"||(t==null?void 0:t.status)==="DECLINED"?"hidden":n?"completed":"not_started"},stepperConfig:{associatedPartyFilters:{partyType:"ORGANIZATION",roles:["CLIENT"]},defaultPartyRequestBody:{partyType:"ORGANIZATION",roles:["CLIENT"]},steps:[{id:"industry",stepType:"form",title:"Industry classification",description:"Choose a classification that best describes your income-producing lines of business.",Component:uoe},{id:"company-identification",stepType:"form",title:"Business identity",description:"Please provide details about your business.",Component:coe},{id:"customer-facing-details",stepType:"form",title:"Description & website",description:"Please help us understand the products and services you offer.",Component:U$},{id:"contact-info",stepType:"form",title:"Contact information",description:"Please let us know how to get in touch.",Component:pH},{id:"check-answers",stepType:"check-answers",title:"Check your answers",description:"Please ensure your answers are accurate and complete anything you may have missed."}]}},{id:"owners-section",isSection:!0,type:"component",sectionConfig:{label:"Owners and key roles",icon:as,requirementsList:["Name and job titles for all individuals","Government issued identifier (e.g. social security number)","Address and contact details"],statusResolver:(e,t)=>{const n=JPe(t),r=n==null?void 0:n.every(i=>{const{allStepsValid:o}=tf(uf,i,t);return o});return e.mockedKycCompleted||(t==null?void 0:t.status)==="INFORMATION_REQUESTED"||(t==null?void 0:t.status)==="REVIEW_IN_PROGRESS"||(t==null?void 0:t.status)==="APPROVED"||(t==null?void 0:t.status)==="DECLINED"?"hidden":r?e.isOwnersSectionDone?"completed":"not_started":"missing_details"}},Component:vRe},{id:"additional-questions-section",isSection:!0,type:"component",sectionConfig:{label:"Operational details",icon:l0,requirementsList:["Total annual revenue","Additional questions based on your business profile"],statusResolver:(e,t)=>{var r,i;const n=((i=(r=t==null?void 0:t.outstanding)==null?void 0:r.questionIds)==null?void 0:i.length)===0;return e.mockedKycCompleted||(t==null?void 0:t.status)==="INFORMATION_REQUESTED"||(t==null?void 0:t.status)==="REVIEW_IN_PROGRESS"||(t==null?void 0:t.status)==="APPROVED"||(t==null?void 0:t.status)==="DECLINED"?"hidden":n?"completed":"not_started"}},Component:uRe},{id:"review-attest-section",isSection:!0,type:"stepper",sectionConfig:{label:"Review and attest",icon:P1,statusResolver:(e,t)=>e.mockedKycCompleted||(t==null?void 0:t.status)==="INFORMATION_REQUESTED"||(t==null?void 0:t.status)==="REVIEW_IN_PROGRESS"||(t==null?void 0:t.status)==="APPROVED"||(t==null?void 0:t.status)==="DECLINED"?"hidden":"not_started"},stepperConfig:{steps:[{id:"review",title:"Review your details",stepType:"static",description:"Please ensure your answers are accurate and complete anything you may have missed.",Component:xRe},{id:"documents",title:"Terms and conditions",stepType:"static",description:"Please open and review the following documents from J.P. Morgan to complete the process.",Component:kRe}]}},{id:"upload-documents-section",isSection:!0,type:"component",sectionConfig:{label:"Supporting documents",icon:os,onHoldText:"We'll let you know if any documents are needed",statusResolver:(e,t,n,r,i)=>{var s,l;const o=(s=t==null?void 0:t.parties)==null?void 0:s.some(d=>{var p;return(p=d.validationResponse)==null?void 0:p.some(h=>{var f;return!!((f=h.documentRequestIds)!=null&&f.length)})}),a=ure(i);return(t==null?void 0:t.status)==="INFORMATION_REQUESTED"&&((l=t.outstanding.documentRequestIds)!=null&&l.length||o)?"not_started":(t==null?void 0:t.status)==="NEW"||(t==null?void 0:t.status)==="REVIEW_IN_PROGRESS"?a?"completed_disabled":"on_hold":(t==null?void 0:t.status)==="APPROVED"||(t==null?void 0:t.status)==="DECLINED"?"hidden":"completed_disabled"}},Component:aRe}],foe={screens:[...CRe,...SRe]},MRe=({initialClientId:e,onboardingContentTokens:t={},alertOnExit:n=!1,userEventsToTrack:r=[],userEventsHandler:i,height:o,onGetClient:a,...s})=>{var S,I;const[l,d]=c.useState(e??""),{interceptorReady:p}=pye(),{data:h,status:f,error:m}=Li(l,{query:{enabled:!!l&&p,refetchOnWindowFocus:!1}});c.useEffect(()=>{a&&a(h,f,m)},[h,f,m,a]);const{data:{documentRequests:b}={}}=vX({clientId:l});c.useEffect(()=>{d(e??"")},[e]);const y=(S=h==null?void 0:h.parties)==null?void 0:S.find(L=>L.partyType==="ORGANIZATION"),v=(I=y==null?void 0:y.organizationDetails)==null?void 0:I.organizationType,{tokens:x={}}=GZ(),{i18n:w,t:C}=Qt(["onboarding-overview","onboarding"]);c.useEffect(()=>{$0(w.language,"onboarding",[x.onboarding,t])},[w.language,JSON.stringify(x.onboarding),JSON.stringify(t)]),c.useEffect(()=>{const L=E=>{E.preventDefault(),E.returnValue=!0};return n&&window.addEventListener("beforeunload",L),()=>{window.removeEventListener("beforeunload",L)}},[n]);const M=c.useCallback(L=>{var N;const E=L.target;Object.keys(E.dataset).includes("userEventTracking")&&(i==null||i({actionName:`${L.type} on ${(N=E.dataset)==null?void 0:N.userEventTracking}`}))},[]);return c.useEffect(()=>{if((r==null?void 0:r.length)>0&&i){const L=document.getElementById("eb-component");return r.forEach(E=>L==null?void 0:L.addEventListener(E,M)),()=>{r.forEach(E=>L==null?void 0:L.removeEventListener(E,M))}}return()=>{}},[]),gX({userEmail:"test@test.com",DOMElementToTrack:"embedded-component-layout",eventsToTrack:["click","blur"]}),u.jsx(XJ.Provider,{value:{...s,clientData:h,setClientId:d,organizationType:v,documentRequests:b},children:u.jsx("div",{id:"embedded-component-layout",className:"eb-component eb-mx-auto eb-flex eb-flex-1 eb-flex-col eb-bg-background eb-p-4 eb-pb-6 eb-font-sans eb-text-foreground eb-antialiased sm:eb-max-w-screen-sm sm:eb-p-10 sm:eb-pb-12",style:{minHeight:o},children:m?u.jsx(Gr,{error:m}):f==="pending"&&e?u.jsx(Ds,{message:C("onboarding:fetchingClientData")}):u.jsx(XPe,{initialScreenId:s.docUploadOnlyMode?"upload-documents-section":v?"overview":"gateway",flowConfig:foe,children:u.jsx(IRe,{})})},e)})},IRe=()=>{const{clientData:e,organizationType:t,docUploadOnlyMode:n}=Kr(),{currentScreenId:r,goTo:i,sessionData:o,updateSessionData:a}=Io(),s=c.useRef(null),l=c.useRef(!0);c.useEffect(()=>{var h;if(l.current){l.current=!1;return}(h=s.current)==null||h.scrollIntoView({behavior:"smooth",block:"start"})},[r]),c.useEffect(()=>{n&&!["upload-documents-section","document-upload-form"].includes(r)?i("upload-documents-section",{resetHistory:!0}):!n&&!t&&r!=="gateway"&&i("gateway",{resetHistory:!0})},[r,n,t]),c.useEffect(()=>{if(o.mockedVerifyingSectionId){const h=setTimeout(()=>{a({mockedVerifyingSectionId:void 0})},1500);return()=>clearTimeout(h)}return()=>{}},[o.mockedVerifyingSectionId]);const d=foe.screens.find(h=>h.id===r),p=()=>{if(!d)return u.jsxs("div",{children:["Unknown screen id: ",r]});if(d.type==="component"){const h=d.Component;return u.jsx(h,{})}return d.type==="stepper"?u.jsx(rOe,{...d.stepperConfig}):u.jsx("div",{children:"Unhandled screen error"})};return u.jsx("div",{className:"eb-flex eb-flex-1 eb-scroll-mt-44 sm:eb-scroll-mt-48",ref:s,children:u.jsx("div",{className:"eb-w-full",children:p()})},e==null?void 0:e.id)};var zt={context:void 0,registry:void 0,getContextId(){return moe(this.context.count)},getNextContextId(){return moe(this.context.count++)}};function moe(e){const t=String(e),n=t.length-1;return zt.context.id+(n?String.fromCharCode(96+n):"")+t}function df(e){zt.context=e}var LRe=(e,t)=>e===t,W$=Symbol("solid-proxy"),K$=Symbol("solid-track"),Y$={equals:LRe},goe=Coe,Ba=1,Z$=2,yoe={owned:null,cleanups:null,context:null,owner:null},UH={},nn=null,GH=null,ERe=null,gn=null,$r=null,Va=null,X$=0;function Ua(e,t){const n=gn,r=nn,i=e.length===0,o=t===void 0?r:t,a=i?yoe:{owned:null,cleanups:null,context:o?o.context:null,owner:o},s=i?e:()=>e(()=>jn(()=>tP(a)));nn=a,gn=null;try{return la(s,!0)}finally{gn=n,nn=r}}function Ge(e,t){t=t?Object.assign({},Y$,t):Y$;const n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},r=i=>(typeof i=="function"&&(i=i(n.value)),koe(n,i));return[woe.bind(n),r]}function boe(e,t,n){const r=Q$(e,t,!0,Ba);h2(r)}function ct(e,t,n){const r=Q$(e,t,!1,Ba);h2(r)}function rt(e,t,n){goe=_Re;const r=Q$(e,t,!1,Ba);(!n||!n.render)&&(r.user=!0),Va?Va.push(r):h2(r)}function Ee(e,t,n){n=n?Object.assign({},Y$,n):Y$;const r=Q$(e,t,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,h2(r),woe.bind(r)}function ARe(e){return e&&typeof e=="object"&&"then"in e}function DRe(e,t,n){let r,i,o;arguments.length===1?(r=!0,i=e,o={}):(r=e,i=t,o={});let a=null,s=UH,l=null,d=!1,p="initialValue"in o,h=typeof r=="function"&&Ee(r);const f=new Set,[m,b]=(o.storage||Ge)(o.initialValue),[y,v]=Ge(void 0),[x,w]=Ge(void 0,{equals:!1}),[C,M]=Ge(p?"ready":"unresolved");if(zt.context){l=zt.getNextContextId();let N;o.ssrLoadFrom==="initial"?s=o.initialValue:zt.load&&(N=zt.load(l))&&(s=N)}function S(N,P,z,T){return a===N&&(a=null,T!==void 0&&(p=!0),(N===s||P===s)&&o.onHydrated&&queueMicrotask(()=>o.onHydrated(T,{value:P})),s=UH,I(P,z)),P}function I(N,P){la(()=>{P===void 0&&b(()=>N),M(P!==void 0?"errored":p?"ready":"unresolved"),v(P);for(const z of f.keys())z.decrement();f.clear()},!1)}function L(){const N=ORe,P=m(),z=y();if(z!==void 0&&!a)throw z;return gn&&gn.user,P}function E(N=!0){if(N!==!1&&d)return;d=!1;const P=h?h():r;if(P==null||P===!1){S(a,jn(m));return}const z=s!==UH?s:jn(()=>i(P,{value:m(),refetching:N}));return ARe(z)?(a=z,"value"in z?(z.status==="success"?S(a,z.value,void 0,P):S(a,void 0,WH(z.value),P),z):(d=!0,queueMicrotask(()=>d=!1),la(()=>{M(p?"refreshing":"pending"),w()},!1),z.then(T=>S(z,T,void 0,P),T=>S(z,void 0,WH(T),P)))):(S(a,z,void 0,P),z)}return Object.defineProperties(L,{state:{get:()=>C()},error:{get:()=>y()},loading:{get(){const N=C();return N==="pending"||N==="refreshing"}},latest:{get(){if(!p)return L();const N=y();if(N&&!a)throw N;return m()}}}),h?boe(()=>E(!1)):E(!1),[L,{refetch:E,mutate:b}]}function TRe(e){return la(e,!1)}function jn(e){if(gn===null)return e();const t=gn;gn=null;try{return e()}finally{gn=t}}function Ga(e,t,n){const r=Array.isArray(e);let i,o=n&&n.defer;return a=>{let s;if(r){s=Array(e.length);for(let d=0;d<e.length;d++)s[d]=e[d]()}else s=e();if(o)return o=!1,a;const l=jn(()=>t(s,i,a));return i=s,l}}function l1(e){rt(()=>jn(e))}function ut(e){return nn===null||(nn.cleanups===null?nn.cleanups=[e]:nn.cleanups.push(e)),e}function voe(){return nn}function NRe(e,t){const n=nn,r=gn;nn=e,gn=null;try{return la(t,!0)}catch(i){KH(i)}finally{nn=n,gn=r}}function FRe(e){const t=gn,n=nn;return Promise.resolve().then(()=>{gn=t,nn=n;let r;return la(e,!1),gn=nn=null,r?r.done:void 0})}var[$Re,gXe]=Ge(!1);function PRe(){return[$Re,FRe]}function kr(e,t){const n=Symbol("context");return{id:n,Provider:RRe(n),defaultValue:e}}function Cr(e){let t;return nn&&nn.context&&(t=nn.context[e.id])!==void 0?t:e.defaultValue}function xoe(e){const t=Ee(e),n=Ee(()=>YH(t()));return n.toArray=()=>{const r=n();return Array.isArray(r)?r:r!=null?[r]:[]},n}var ORe;function woe(){if(this.sources&&this.state)if(this.state===Ba)h2(this);else{const e=$r;$r=null,la(()=>eP(this),!1),$r=e}if(gn){const e=this.observers?this.observers.length:0;gn.sources?(gn.sources.push(this),gn.sourceSlots.push(e)):(gn.sources=[this],gn.sourceSlots=[e]),this.observers?(this.observers.push(gn),this.observerSlots.push(gn.sources.length-1)):(this.observers=[gn],this.observerSlots=[gn.sources.length-1])}return this.value}function koe(e,t,n){let r=e.value;return(!e.comparator||!e.comparator(r,t))&&(e.value=t,e.observers&&e.observers.length&&la(()=>{for(let i=0;i<e.observers.length;i+=1){const o=e.observers[i],a=GH&&GH.running;a&&GH.disposed.has(o),(a?!o.tState:!o.state)&&(o.pure?$r.push(o):Va.push(o),o.observers&&Soe(o)),a||(o.state=Ba)}if($r.length>1e6)throw $r=[],new Error},!1)),t}function h2(e){if(!e.fn)return;tP(e);const t=X$;jRe(e,e.value,t)}function jRe(e,t,n){let r;const i=nn,o=gn;gn=nn=e;try{r=e.fn(t)}catch(a){return e.pure&&(e.state=Ba,e.owned&&e.owned.forEach(tP),e.owned=null),e.updatedAt=n+1,KH(a)}finally{gn=o,nn=i}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&"observers"in e?koe(e,r):e.value=r,e.updatedAt=n)}function Q$(e,t,n,r=Ba,i){const o={fn:e,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:nn,context:nn?nn.context:null,pure:n};return nn===null||nn!==yoe&&(nn.owned?nn.owned.push(o):nn.owned=[o]),o}function J$(e){if(e.state===0)return;if(e.state===Z$)return eP(e);if(e.suspense&&jn(e.suspense.inFallback))return e.suspense.effects.push(e);const t=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<X$);)e.state&&t.push(e);for(let n=t.length-1;n>=0;n--)if(e=t[n],e.state===Ba)h2(e);else if(e.state===Z$){const r=$r;$r=null,la(()=>eP(e,t[0]),!1),$r=r}}function la(e,t){if($r)return e();let n=!1;t||($r=[]),Va?n=!0:Va=[],X$++;try{const r=e();return zRe(n),r}catch(r){n||(Va=null),$r=null,KH(r)}}function zRe(e){if($r&&(Coe($r),$r=null),e)return;const t=Va;Va=null,t.length&&la(()=>goe(t),!1)}function Coe(e){for(let t=0;t<e.length;t++)J$(e[t])}function _Re(e){let t,n=0;for(t=0;t<e.length;t++){const r=e[t];r.user?e[n++]=r:J$(r)}if(zt.context){if(zt.count){zt.effects||(zt.effects=[]),zt.effects.push(...e.slice(0,n));return}else zt.effects&&(e=[...zt.effects,...e],n+=zt.effects.length,delete zt.effects);df()}for(t=0;t<n;t++)J$(e[t])}function eP(e,t){e.state=0;for(let n=0;n<e.sources.length;n+=1){const r=e.sources[n];if(r.sources){const i=r.state;i===Ba?r!==t&&(!r.updatedAt||r.updatedAt<X$)&&J$(r):i===Z$&&eP(r,t)}}}function Soe(e){for(let t=0;t<e.observers.length;t+=1){const n=e.observers[t];n.state||(n.state=Z$,n.pure?$r.push(n):Va.push(n),n.observers&&Soe(n))}}function tP(e){let t;if(e.sources)for(;e.sources.length;){const n=e.sources.pop(),r=e.sourceSlots.pop(),i=n.observers;if(i&&i.length){const o=i.pop(),a=n.observerSlots.pop();r<i.length&&(o.sourceSlots[a]=r,i[r]=o,n.observerSlots[r]=a)}}if(e.owned){for(t=e.owned.length-1;t>=0;t--)tP(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}e.state=0}function WH(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function KH(e,t=nn){throw WH(e)}function YH(e){if(typeof e=="function"&&!e.length)return YH(e());if(Array.isArray(e)){const t=[];for(let n=0;n<e.length;n++){const r=YH(e[n]);Array.isArray(r)?t.push.apply(t,r):t.push(r)}return t}return e}function RRe(e,t){return function(r){let i;return ct(()=>i=jn(()=>(nn.context={...nn.context,[e]:r.value},xoe(()=>r.children))),void 0),i}}var ZH=Symbol("fallback");function nP(e){for(let t=0;t<e.length;t++)e[t]()}function HRe(e,t,n={}){let r=[],i=[],o=[],a=0,s=t.length>1?[]:null;return ut(()=>nP(o)),()=>{let l=e()||[],d=l.length,p,h;return l[K$],jn(()=>{let m,b,y,v,x,w,C,M,S;if(d===0)a!==0&&(nP(o),o=[],r=[],i=[],a=0,s&&(s=[])),n.fallback&&(r=[ZH],i[0]=Ua(I=>(o[0]=I,n.fallback())),a=1);else if(a===0){for(i=new Array(d),h=0;h<d;h++)r[h]=l[h],i[h]=Ua(f);a=d}else{for(y=new Array(d),v=new Array(d),s&&(x=new Array(d)),w=0,C=Math.min(a,d);w<C&&r[w]===l[w];w++);for(C=a-1,M=d-1;C>=w&&M>=w&&r[C]===l[M];C--,M--)y[M]=i[C],v[M]=o[C],s&&(x[M]=s[C]);for(m=new Map,b=new Array(M+1),h=M;h>=w;h--)S=l[h],p=m.get(S),b[h]=p===void 0?-1:p,m.set(S,h);for(p=w;p<=C;p++)S=r[p],h=m.get(S),h!==void 0&&h!==-1?(y[h]=i[p],v[h]=o[p],s&&(x[h]=s[p]),h=b[h],m.set(S,h)):o[p]();for(h=w;h<d;h++)h in y?(i[h]=y[h],o[h]=v[h],s&&(s[h]=x[h],s[h](h))):i[h]=Ua(f);i=i.slice(0,a=d),r=l.slice(0)}return i});function f(m){if(o[h]=m,s){const[b,y]=Ge(h);return s[h]=y,t(l[h],b)}return t(l[h])}}}function qRe(e,t,n={}){let r=[],i=[],o=[],a=[],s=0,l;return ut(()=>nP(o)),()=>{const d=e()||[],p=d.length;return d[K$],jn(()=>{if(p===0)return s!==0&&(nP(o),o=[],r=[],i=[],s=0,a=[]),n.fallback&&(r=[ZH],i[0]=Ua(f=>(o[0]=f,n.fallback())),s=1),i;for(r[0]===ZH&&(o[0](),o=[],r=[],i=[],s=0),l=0;l<p;l++)l<r.length&&r[l]!==d[l]?a[l](()=>d[l]):l>=r.length&&(i[l]=Ua(h));for(;l<r.length;l++)o[l]();return s=a.length=o.length=p,r=d.slice(0),i=i.slice(0,s)});function h(f){o[l]=f;const[m,b]=Ge(d[l]);return a[l]=b,t(m,l)}}}function ie(e,t){return jn(()=>e(t||{}))}function rP(){return!0}var XH={get(e,t,n){return t===W$?n:e.get(t)},has(e,t){return t===W$?!0:e.has(t)},set:rP,deleteProperty:rP,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:rP,deleteProperty:rP}},ownKeys(e){return e.keys()}};function QH(e){return(e=typeof e=="function"?e():e)?e:{}}function BRe(){for(let e=0,t=this.length;e<t;++e){const n=this[e]();if(n!==void 0)return n}}function Dt(...e){let t=!1;for(let a=0;a<e.length;a++){const s=e[a];t=t||!!s&&W$ in s,e[a]=typeof s=="function"?(t=!0,Ee(s)):s}if(t)return new Proxy({get(a){for(let s=e.length-1;s>=0;s--){const l=QH(e[s])[a];if(l!==void 0)return l}},has(a){for(let s=e.length-1;s>=0;s--)if(a in QH(e[s]))return!0;return!1},keys(){const a=[];for(let s=0;s<e.length;s++)a.push(...Object.keys(QH(e[s])));return[...new Set(a)]}},XH);const n={},r=Object.create(null);for(let a=e.length-1;a>=0;a--){const s=e[a];if(!s)continue;const l=Object.getOwnPropertyNames(s);for(let d=l.length-1;d>=0;d--){const p=l[d];if(p==="__proto__"||p==="constructor")continue;const h=Object.getOwnPropertyDescriptor(s,p);if(!r[p])r[p]=h.get?{enumerable:!0,configurable:!0,get:BRe.bind(n[p]=[h.get.bind(s)])}:h.value!==void 0?h:void 0;else{const f=n[p];f&&(h.get?f.push(h.get.bind(s)):h.value!==void 0&&f.push(()=>h.value))}}}const i={},o=Object.keys(r);for(let a=o.length-1;a>=0;a--){const s=o[a],l=r[s];l&&l.get?Object.defineProperty(i,s,l):i[s]=l?l.value:void 0}return i}function cn(e,...t){if(W$ in e){const i=new Set(t.length>1?t.flat():t[0]),o=t.map(a=>new Proxy({get(s){return a.includes(s)?e[s]:void 0},has(s){return a.includes(s)&&s in e},keys(){return a.filter(s=>s in e)}},XH));return o.push(new Proxy({get(a){return i.has(a)?void 0:e[a]},has(a){return i.has(a)?!1:a in e},keys(){return Object.keys(e).filter(a=>!i.has(a))}},XH)),o}const n={},r=t.map(()=>({}));for(const i of Object.getOwnPropertyNames(e)){const o=Object.getOwnPropertyDescriptor(e,i),a=!o.get&&!o.set&&o.enumerable&&o.writable&&o.configurable;let s=!1,l=0;for(const d of t)d.includes(i)&&(s=!0,a?r[l][i]=o.value:Object.defineProperty(r[l],i,o)),++l;s||(a?n[i]=o.value:Object.defineProperty(n,i,o))}return[...r,n]}function VRe(e){let t,n;const r=i=>{const o=zt.context;if(o){const[s,l]=Ge();zt.count||(zt.count=0),zt.count++,(n||(n=e())).then(d=>{df(o),zt.count--,l(()=>d.default),df()}),t=s}else if(!t){const[s]=DRe(()=>(n||(n=e())).then(l=>l.default));t=s}let a;return Ee(()=>(a=t())&&jn(()=>{if(!o)return a(i);const s=zt.context;df(o);const l=a(i);return df(s),l}))};return r.preload=()=>n||((n=e()).then(i=>t=()=>i.default),n),r}var URe=0;function Qi(){return zt.context?zt.getNextContextId():`cl-${URe++}`}var Moe=e=>`Stale read from <${e}>.`;function GRe(e){const t="fallback"in e&&{fallback:()=>e.fallback};return Ee(HRe(()=>e.each,e.children,t||void 0))}function WRe(e){const t="fallback"in e&&{fallback:()=>e.fallback};return Ee(qRe(()=>e.each,e.children,t||void 0))}function dt(e){const t=e.keyed,n=Ee(()=>e.when,void 0,{equals:(r,i)=>t?r===i:!r==!i});return Ee(()=>{const r=n();if(r){const i=e.children;return typeof i=="function"&&i.length>0?jn(()=>i(t?r:()=>{if(!jn(n))throw Moe("Show");return e.when})):i}return e.fallback},void 0,void 0)}function KRe(e){let t=!1;const n=(o,a)=>(t?o[1]===a[1]:!o[1]==!a[1])&&o[2]===a[2],r=xoe(()=>e.children),i=Ee(()=>{let o=r();Array.isArray(o)||(o=[o]);for(let a=0;a<o.length;a++){const s=o[a].when;if(s)return t=!!o[a].keyed,[a,s,o[a]]}return[-1]},void 0,{equals:n});return Ee(()=>{const[o,a,s]=i();if(o<0)return e.fallback;const l=s.children;return typeof l=="function"&&l.length>0?jn(()=>l(t?a:()=>{if(jn(i)[0]!==o)throw Moe("Match");return s.when})):l},void 0,void 0)}function JH(e){return e}var YRe=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected"],ZRe=new Set(["className","value","readOnly","formNoValidate","isMap","noModule","playsInline",...YRe]),XRe=new Set(["innerHTML","textContent","innerText","children"]),QRe=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),JRe=Object.assign(Object.create(null),{class:"className",formnovalidate:{$:"formNoValidate",BUTTON:1,INPUT:1},ismap:{$:"isMap",IMG:1},nomodule:{$:"noModule",SCRIPT:1},playsinline:{$:"playsInline",VIDEO:1},readonly:{$:"readOnly",INPUT:1,TEXTAREA:1}});function eHe(e,t){const n=JRe[e];return typeof n=="object"?n[t]?n.$:void 0:n}var tHe=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),nHe=new Set(["altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","svg","switch","symbol","text","textPath","tref","tspan","use","view","vkern"]),rHe={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"};function iHe(e,t,n){let r=n.length,i=t.length,o=r,a=0,s=0,l=t[i-1].nextSibling,d=null;for(;a<i||s<o;){if(t[a]===n[s]){a++,s++;continue}for(;t[i-1]===n[o-1];)i--,o--;if(i===a){const p=o<r?s?n[s-1].nextSibling:n[o-s]:l;for(;s<o;)e.insertBefore(n[s++],p)}else if(o===s)for(;a<i;)(!d||!d.has(t[a]))&&t[a].remove(),a++;else if(t[a]===n[o-1]&&n[s]===t[i-1]){const p=t[--i].nextSibling;e.insertBefore(n[s++],t[a++].nextSibling),e.insertBefore(n[--o],p),t[i]=n[o]}else{if(!d){d=new Map;let h=s;for(;h<o;)d.set(n[h],h++)}const p=d.get(t[a]);if(p!=null)if(s<p&&p<o){let h=a,f=1,m;for(;++h<i&&h<o&&!((m=d.get(t[h]))==null||m!==p+f);)f++;if(f>p-s){const b=t[a];for(;s<p;)e.insertBefore(n[s++],b)}else e.replaceChild(n[s++],t[a++])}else a++;else t[a++].remove()}}}var pf="_$DX_DELEGATE";function oHe(e,t,n,r={}){let i;return Ua(o=>{i=o,t===document?e():Te(t,e(),t.firstChild?null:void 0,n)},r.owner),()=>{i(),t.textContent=""}}function et(e,t,n){let r;const i=()=>{const a=document.createElement("template");return a.innerHTML=e,a.content.firstChild},o=()=>(r||(r=i())).cloneNode(!0);return o.cloneNode=o,o}function iP(e,t=window.document){const n=t[pf]||(t[pf]=new Set);for(let r=0,i=e.length;r<i;r++){const o=e[r];n.has(o)||(n.add(o),t.addEventListener(o,Doe))}}function aHe(e=window.document){if(e[pf]){for(let t of e[pf].keys())e.removeEventListener(t,Doe);delete e[pf]}}function $e(e,t,n){zt.context&&e.isConnected||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function sHe(e,t,n,r){zt.context&&e.isConnected||(r==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,r))}function He(e,t){zt.context&&e.isConnected||(t==null?e.removeAttribute("class"):e.className=t)}function Ioe(e,t,n,r){if(r)Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n;else if(Array.isArray(n)){const i=n[0];e.addEventListener(t,n[0]=o=>i.call(e,n[1],o))}else e.addEventListener(t,n)}function lHe(e,t,n={}){const r=Object.keys(t||{}),i=Object.keys(n);let o,a;for(o=0,a=i.length;o<a;o++){const s=i[o];!s||s==="undefined"||t[s]||(Eoe(e,s,!1),delete n[s])}for(o=0,a=r.length;o<a;o++){const s=r[o],l=!!t[s];!s||s==="undefined"||n[s]===l||!l||(Eoe(e,s,!0),n[s]=l)}return n}function cHe(e,t,n){if(!t)return n?$e(e,"style"):t;const r=e.style;if(typeof t=="string")return r.cssText=t;typeof n=="string"&&(r.cssText=n=void 0),n||(n={}),t||(t={});let i,o;for(o in n)t[o]==null&&r.removeProperty(o),delete n[o];for(o in t)i=t[o],i!==n[o]&&(r.setProperty(o,i),n[o]=i);return n}function Loe(e,t={},n,r){const i={};return r||ct(()=>i.children=ff(e,t.children,i.children)),ct(()=>typeof t.ref=="function"&&hf(t.ref,e)),ct(()=>uHe(e,t,n,!0,i,!0)),i}function hf(e,t,n){return jn(()=>e(t,n))}function Te(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!="function")return ff(e,t,r,n);ct(i=>ff(e,t(),i,n),r)}function uHe(e,t,n,r,i={},o=!1){t||(t={});for(const a in i)if(!(a in t)){if(a==="children")continue;i[a]=Aoe(e,a,null,i[a],n,o)}for(const a in t){if(a==="children")continue;const s=t[a];i[a]=Aoe(e,a,s,i[a],n,o)}}function dHe(e){let t,n;return!zt.context||!(t=zt.registry.get(n=hHe()))?e():(zt.completed&&zt.completed.add(t),zt.registry.delete(n),t)}function pHe(e){return e.toLowerCase().replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function Eoe(e,t,n){const r=t.trim().split(/\s+/);for(let i=0,o=r.length;i<o;i++)e.classList.toggle(r[i],n)}function Aoe(e,t,n,r,i,o){let a,s,l,d,p;if(t==="style")return cHe(e,n,r);if(t==="classList")return lHe(e,n,r);if(n===r)return r;if(t==="ref")o||n(e);else if(t.slice(0,3)==="on:"){const h=t.slice(3);r&&e.removeEventListener(h,r),n&&e.addEventListener(h,n)}else if(t.slice(0,10)==="oncapture:"){const h=t.slice(10);r&&e.removeEventListener(h,r,!0),n&&e.addEventListener(h,n,!0)}else if(t.slice(0,2)==="on"){const h=t.slice(2).toLowerCase(),f=tHe.has(h);if(!f&&r){const m=Array.isArray(r)?r[0]:r;e.removeEventListener(h,m)}(f||n)&&(Ioe(e,h,n,f),f&&iP([h]))}else if(t.slice(0,5)==="attr:")$e(e,t.slice(5),n);else if((p=t.slice(0,5)==="prop:")||(l=XRe.has(t))||!i&&((d=eHe(t,e.tagName))||(s=ZRe.has(t)))||(a=e.nodeName.includes("-"))){if(p)t=t.slice(5),s=!0;else if(zt.context&&e.isConnected)return n;t==="class"||t==="className"?He(e,n):a&&!s&&!l?e[pHe(t)]=n:e[d||t]=n}else{const h=i&&t.indexOf(":")>-1&&rHe[t.split(":")[0]];h?sHe(e,h,t,n):$e(e,QRe[t]||t,n)}return n}function Doe(e){const t=`$$${e.type}`;let n=e.composedPath&&e.composedPath()[0]||e.target;for(e.target!==n&&Object.defineProperty(e,"target",{configurable:!0,value:n}),Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return n||document}}),zt.registry&&!zt.done&&(zt.done=_$HY.done=!0);n;){const r=n[t];if(r&&!n.disabled){const i=n[`${t}Data`];if(i!==void 0?r.call(n,i,e):r.call(n,e),e.cancelBubble)return}n=n._$host||n.parentNode||n.host}}function ff(e,t,n,r,i){const o=!!zt.context&&e.isConnected;if(o){!n&&(n=[...e.childNodes]);let l=[];for(let d=0;d<n.length;d++){const p=n[d];p.nodeType===8&&p.data.slice(0,2)==="!$"?p.remove():l.push(p)}n=l}for(;typeof n=="function";)n=n();if(t===n)return n;const a=typeof t,s=r!==void 0;if(e=s&&n[0]&&n[0].parentNode||e,a==="string"||a==="number"){if(o||a==="number"&&(t=t.toString(),t===n))return n;if(s){let l=n[0];l&&l.nodeType===3?l.data!==t&&(l.data=t):l=document.createTextNode(t),n=f2(e,n,r,l)}else n!==""&&typeof n=="string"?n=e.firstChild.data=t:n=e.textContent=t}else if(t==null||a==="boolean"){if(o)return n;n=f2(e,n,r)}else{if(a==="function")return ct(()=>{let l=t();for(;typeof l=="function";)l=l();n=ff(e,l,n,r)}),()=>n;if(Array.isArray(t)){const l=[],d=n&&Array.isArray(n);if(eq(l,t,n,i))return ct(()=>n=ff(e,l,n,r,!0)),()=>n;if(o){if(!l.length)return n;if(r===void 0)return[...e.childNodes];let p=l[0],h=[p];for(;(p=p.nextSibling)!==r;)h.push(p);return n=h}if(l.length===0){if(n=f2(e,n,r),s)return n}else d?n.length===0?Toe(e,l,r):iHe(e,n,l):(n&&f2(e),Toe(e,l));n=l}else if(t.nodeType){if(o&&t.parentNode)return n=s?[t]:t;if(Array.isArray(n)){if(s)return n=f2(e,n,r,t);f2(e,n,null,t)}else n==null||n===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}}return n}function eq(e,t,n,r){let i=!1;for(let o=0,a=t.length;o<a;o++){let s=t[o],l=n&&n[e.length],d;if(!(s==null||s===!0||s===!1))if((d=typeof s)=="object"&&s.nodeType)e.push(s);else if(Array.isArray(s))i=eq(e,s,l)||i;else if(d==="function")if(r){for(;typeof s=="function";)s=s();i=eq(e,Array.isArray(s)?s:[s],Array.isArray(l)?l:[l])||i}else e.push(s),i=!0;else{const p=String(s);l&&l.nodeType===3&&l.data===p?e.push(l):e.push(document.createTextNode(p))}}return i}function Toe(e,t,n=null){for(let r=0,i=t.length;r<i;r++)e.insertBefore(t[r],n)}function f2(e,t,n,r){if(n===void 0)return e.textContent="";const i=r||document.createTextNode("");if(t.length){let o=!1;for(let a=t.length-1;a>=0;a--){const s=t[a];if(i!==s){const l=s.parentNode===e;!o&&!a?l?e.replaceChild(i,s):e.insertBefore(i,n):l&&s.remove()}else o=!0}}else e.insertBefore(i,n);return[i]}function hHe(){return zt.getNextContextId()}var fHe="http://www.w3.org/2000/svg";function Noe(e,t=!1){return t?document.createElementNS(fHe,e):document.createElement(e)}function Foe(e){const{useShadow:t}=e,n=document.createTextNode(""),r=()=>e.mount||document.body,i=voe();let o,a=!!zt.context;return rt(()=>{a&&(voe().user=a=!1),o||(o=NRe(i,()=>Ee(()=>e.children)));const s=r();if(s instanceof HTMLHeadElement){const[l,d]=Ge(!1),p=()=>d(!0);Ua(h=>Te(s,()=>l()?h():o(),null)),ut(p)}else{const l=Noe(e.isSVG?"g":"div",e.isSVG),d=t&&l.attachShadow?l.attachShadow({mode:"open"}):l;Object.defineProperty(l,"_$host",{get(){return n.parentNode},configurable:!0}),Te(d,o),s.appendChild(l),e.ref&&e.ref(l),ut(()=>s.removeChild(l))}},void 0,{render:!a}),n}function mHe(e){const[t,n]=cn(e,["component"]),r=Ee(()=>t.component);return Ee(()=>{const i=r();switch(typeof i){case"function":return jn(()=>i(n));case"string":const o=nHe.has(i),a=zt.context?dHe():Noe(i,o);return Loe(a,n,o),a}})}var gHe=class{constructor(){this.keyToValue=new Map,this.valueToKey=new Map}set(e,t){this.keyToValue.set(e,t),this.valueToKey.set(t,e)}getByKey(e){return this.keyToValue.get(e)}getByValue(e){return this.valueToKey.get(e)}clear(){this.keyToValue.clear(),this.valueToKey.clear()}},$oe=class{constructor(e){this.generateIdentifier=e,this.kv=new gHe}register(e,t){this.kv.getByValue(e)||(t||(t=this.generateIdentifier(e)),this.kv.set(t,e))}clear(){this.kv.clear()}getIdentifier(e){return this.kv.getByValue(e)}getValue(e){return this.kv.getByKey(e)}},yHe=class extends $oe{constructor(){super(e=>e.name),this.classToAllowedProps=new Map}register(e,t){typeof t=="object"?(t.allowProps&&this.classToAllowedProps.set(e,t.allowProps),super.register(e,t.identifier)):super.register(e,t)}getAllowedProps(e){return this.classToAllowedProps.get(e)}};function bHe(e){if("values"in Object)return Object.values(e);const t=[];for(const n in e)e.hasOwnProperty(n)&&t.push(e[n]);return t}function vHe(e,t){const n=bHe(e);if("find"in n)return n.find(t);const r=n;for(let i=0;i<r.length;i++){const o=r[i];if(t(o))return o}}function m2(e,t){Object.entries(e).forEach(([n,r])=>t(r,n))}function oP(e,t){return e.indexOf(t)!==-1}function Poe(e,t){for(let n=0;n<e.length;n++){const r=e[n];if(t(r))return r}}var xHe=class{constructor(){this.transfomers={}}register(e){this.transfomers[e.name]=e}findApplicable(e){return vHe(this.transfomers,t=>t.isApplicable(e))}findByName(e){return this.transfomers[e]}},wHe=e=>Object.prototype.toString.call(e).slice(8,-1),Ooe=e=>typeof e>"u",kHe=e=>e===null,mf=e=>typeof e!="object"||e===null||e===Object.prototype?!1:Object.getPrototypeOf(e)===null?!0:Object.getPrototypeOf(e)===Object.prototype,tq=e=>mf(e)&&Object.keys(e).length===0,_s=e=>Array.isArray(e),CHe=e=>typeof e=="string",SHe=e=>typeof e=="number"&&!isNaN(e),MHe=e=>typeof e=="boolean",IHe=e=>e instanceof RegExp,gf=e=>e instanceof Map,yf=e=>e instanceof Set,joe=e=>wHe(e)==="Symbol",LHe=e=>e instanceof Date&&!isNaN(e.valueOf()),EHe=e=>e instanceof Error,zoe=e=>typeof e=="number"&&isNaN(e),AHe=e=>MHe(e)||kHe(e)||Ooe(e)||SHe(e)||CHe(e)||joe(e),DHe=e=>typeof e=="bigint",THe=e=>e===1/0||e===-1/0,NHe=e=>ArrayBuffer.isView(e)&&!(e instanceof DataView),FHe=e=>e instanceof URL,_oe=e=>e.replace(/\./g,"\\."),nq=e=>e.map(String).map(_oe).join("."),bf=e=>{const t=[];let n="";for(let i=0;i<e.length;i++){let o=e.charAt(i);if(o==="\\"&&e.charAt(i+1)==="."){n+=".",i++;continue}if(o==="."){t.push(n),n="";continue}n+=o}const r=n;return t.push(r),t};function ca(e,t,n,r){return{isApplicable:e,annotation:t,transform:n,untransform:r}}var Roe=[ca(Ooe,"undefined",()=>null,()=>{}),ca(DHe,"bigint",e=>e.toString(),e=>typeof BigInt<"u"?BigInt(e):e),ca(LHe,"Date",e=>e.toISOString(),e=>new Date(e)),ca(EHe,"Error",(e,t)=>{const n={name:e.name,message:e.message};return t.allowedErrorProps.forEach(r=>{n[r]=e[r]}),n},(e,t)=>{const n=new Error(e.message);return n.name=e.name,n.stack=e.stack,t.allowedErrorProps.forEach(r=>{n[r]=e[r]}),n}),ca(IHe,"regexp",e=>""+e,e=>{const t=e.slice(1,e.lastIndexOf("/")),n=e.slice(e.lastIndexOf("/")+1);return new RegExp(t,n)}),ca(yf,"set",e=>[...e.values()],e=>new Set(e)),ca(gf,"map",e=>[...e.entries()],e=>new Map(e)),ca(e=>zoe(e)||THe(e),"number",e=>zoe(e)?"NaN":e>0?"Infinity":"-Infinity",Number),ca(e=>e===0&&1/e===-1/0,"number",()=>"-0",Number),ca(FHe,"URL",e=>e.toString(),e=>new URL(e))];function aP(e,t,n,r){return{isApplicable:e,annotation:t,transform:n,untransform:r}}var Hoe=aP((e,t)=>joe(e)?!!t.symbolRegistry.getIdentifier(e):!1,(e,t)=>["symbol",t.symbolRegistry.getIdentifier(e)],e=>e.description,(e,t,n)=>{const r=n.symbolRegistry.getValue(t[1]);if(!r)throw new Error("Trying to deserialize unknown symbol");return r}),$He=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((e,t)=>(e[t.name]=t,e),{}),qoe=aP(NHe,e=>["typed-array",e.constructor.name],e=>[...e],(e,t)=>{const n=$He[t[1]];if(!n)throw new Error("Trying to deserialize unknown typed array");return new n(e)});function Boe(e,t){return e!=null&&e.constructor?!!t.classRegistry.getIdentifier(e.constructor):!1}var Voe=aP(Boe,(e,t)=>["class",t.classRegistry.getIdentifier(e.constructor)],(e,t)=>{const n=t.classRegistry.getAllowedProps(e.constructor);if(!n)return{...e};const r={};return n.forEach(i=>{r[i]=e[i]}),r},(e,t,n)=>{const r=n.classRegistry.getValue(t[1]);if(!r)throw new Error("Trying to deserialize unknown class - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564");return Object.assign(Object.create(r.prototype),e)}),Uoe=aP((e,t)=>!!t.customTransformerRegistry.findApplicable(e),(e,t)=>["custom",t.customTransformerRegistry.findApplicable(e).name],(e,t)=>t.customTransformerRegistry.findApplicable(e).serialize(e),(e,t,n)=>{const r=n.customTransformerRegistry.findByName(t[1]);if(!r)throw new Error("Trying to deserialize unknown custom value");return r.deserialize(e)}),PHe=[Voe,Hoe,Uoe,qoe],Goe=(e,t)=>{const n=Poe(PHe,i=>i.isApplicable(e,t));if(n)return{value:n.transform(e,t),type:n.annotation(e,t)};const r=Poe(Roe,i=>i.isApplicable(e,t));if(r)return{value:r.transform(e,t),type:r.annotation}},Woe={};Roe.forEach(e=>{Woe[e.annotation]=e});var OHe=(e,t,n)=>{if(_s(t))switch(t[0]){case"symbol":return Hoe.untransform(e,t,n);case"class":return Voe.untransform(e,t,n);case"custom":return Uoe.untransform(e,t,n);case"typed-array":return qoe.untransform(e,t,n);default:throw new Error("Unknown transformation: "+t)}else{const r=Woe[t];if(!r)throw new Error("Unknown transformation: "+t);return r.untransform(e,n)}},g2=(e,t)=>{const n=e.keys();for(;t>0;)n.next(),t--;return n.next().value};function Koe(e){if(oP(e,"__proto__"))throw new Error("__proto__ is not allowed as a property");if(oP(e,"prototype"))throw new Error("prototype is not allowed as a property");if(oP(e,"constructor"))throw new Error("constructor is not allowed as a property")}var jHe=(e,t)=>{Koe(t);for(let n=0;n<t.length;n++){const r=t[n];if(yf(e))e=g2(e,+r);else if(gf(e)){const i=+r,o=+t[++n]==0?"key":"value",a=g2(e,i);switch(o){case"key":e=a;break;case"value":e=e.get(a);break}}else e=e[r]}return e},rq=(e,t,n)=>{if(Koe(t),t.length===0)return n(e);let r=e;for(let o=0;o<t.length-1;o++){const a=t[o];if(_s(r)){const s=+a;r=r[s]}else if(mf(r))r=r[a];else if(yf(r)){const s=+a;r=g2(r,s)}else if(gf(r)){if(o===t.length-2)break;const l=+a,d=+t[++o]==0?"key":"value",p=g2(r,l);switch(d){case"key":r=p;break;case"value":r=r.get(p);break}}}const i=t[t.length-1];if(_s(r)?r[+i]=n(r[+i]):mf(r)&&(r[i]=n(r[i])),yf(r)){const o=g2(r,+i),a=n(o);o!==a&&(r.delete(o),r.add(a))}if(gf(r)){const o=+t[t.length-2],a=g2(r,o);switch(+i==0?"key":"value"){case"key":{const l=n(a);r.set(l,r.get(a)),l!==a&&r.delete(a);break}case"value":{r.set(a,n(r.get(a)));break}}}return e};function iq(e,t,n=[]){if(!e)return;if(!_s(e)){m2(e,(o,a)=>iq(o,t,[...n,...bf(a)]));return}const[r,i]=e;i&&m2(i,(o,a)=>{iq(o,t,[...n,...bf(a)])}),t(r,n)}function zHe(e,t,n){return iq(t,(r,i)=>{e=rq(e,i,o=>OHe(o,r,n))}),e}function _He(e,t){function n(r,i){const o=jHe(e,bf(i));r.map(bf).forEach(a=>{e=rq(e,a,()=>o)})}if(_s(t)){const[r,i]=t;r.forEach(o=>{e=rq(e,bf(o),()=>e)}),i&&m2(i,n)}else m2(t,n);return e}var RHe=(e,t)=>mf(e)||_s(e)||gf(e)||yf(e)||Boe(e,t);function HHe(e,t,n){const r=n.get(e);r?r.push(t):n.set(e,[t])}function qHe(e,t){const n={};let r;return e.forEach(i=>{if(i.length<=1)return;t||(i=i.map(s=>s.map(String)).sort((s,l)=>s.length-l.length));const[o,...a]=i;o.length===0?r=a.map(nq):n[nq(o)]=a.map(nq)}),r?tq(n)?[r]:[r,n]:tq(n)?void 0:n}var Yoe=(e,t,n,r,i=[],o=[],a=new Map)=>{const s=AHe(e);if(!s){HHe(e,i,t);const m=a.get(e);if(m)return r?{transformedValue:null}:m}if(!RHe(e,n)){const m=Goe(e,n),b=m?{transformedValue:m.value,annotations:[m.type]}:{transformedValue:e};return s||a.set(e,b),b}if(oP(o,e))return{transformedValue:null};const l=Goe(e,n),d=(l==null?void 0:l.value)??e,p=_s(d)?[]:{},h={};m2(d,(m,b)=>{if(b==="__proto__"||b==="constructor"||b==="prototype")throw new Error(`Detected property ${b}. This is a prototype pollution risk, please remove it from your object.`);const y=Yoe(m,t,n,r,[...i,b],[...o,e],a);p[b]=y.transformedValue,_s(y.annotations)?h[b]=y.annotations:mf(y.annotations)&&m2(y.annotations,(v,x)=>{h[_oe(b)+"."+x]=v})});const f=tq(h)?{transformedValue:p,annotations:l?[l.type]:void 0}:{transformedValue:p,annotations:l?[l.type,h]:h};return s||a.set(e,f),f};function Zoe(e){return Object.prototype.toString.call(e).slice(8,-1)}function Xoe(e){return Zoe(e)==="Array"}function BHe(e){if(Zoe(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return!!t&&t.constructor===Object&&t===Object.prototype}function VHe(e,t,n,r,i){const o={}.propertyIsEnumerable.call(r,t)?"enumerable":"nonenumerable";o==="enumerable"&&(e[t]=n),i&&o==="nonenumerable"&&Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})}function oq(e,t={}){if(Xoe(e))return e.map(i=>oq(i,t));if(!BHe(e))return e;const n=Object.getOwnPropertyNames(e),r=Object.getOwnPropertySymbols(e);return[...n,...r].reduce((i,o)=>{if(Xoe(t.props)&&!t.props.includes(o))return i;const a=e[o],s=oq(a,t);return VHe(i,o,s,e,t.nonenumerable),i},{})}var yn=class{constructor({dedupe:e=!1}={}){this.classRegistry=new yHe,this.symbolRegistry=new $oe(t=>t.description??""),this.customTransformerRegistry=new xHe,this.allowedErrorProps=[],this.dedupe=e}serialize(e){const t=new Map,n=Yoe(e,t,this,this.dedupe),r={json:n.transformedValue};n.annotations&&(r.meta={...r.meta,values:n.annotations});const i=qHe(t,this.dedupe);return i&&(r.meta={...r.meta,referentialEqualities:i}),r}deserialize(e){const{json:t,meta:n}=e;let r=oq(t);return n!=null&&n.values&&(r=zHe(r,n.values,this)),n!=null&&n.referentialEqualities&&(r=_He(r,n.referentialEqualities)),r}stringify(e){return JSON.stringify(this.serialize(e))}parse(e){return this.deserialize(JSON.parse(e))}registerClass(e,t){this.classRegistry.register(e,t)}registerSymbol(e,t){this.symbolRegistry.register(e,t)}registerCustom(e,t){this.customTransformerRegistry.register({name:t,...e})}allowErrorProps(...e){this.allowedErrorProps.push(...e)}};yn.defaultInstance=new yn,yn.serialize=yn.defaultInstance.serialize.bind(yn.defaultInstance),yn.deserialize=yn.defaultInstance.deserialize.bind(yn.defaultInstance),yn.stringify=yn.defaultInstance.stringify.bind(yn.defaultInstance),yn.parse=yn.defaultInstance.parse.bind(yn.defaultInstance),yn.registerClass=yn.defaultInstance.registerClass.bind(yn.defaultInstance),yn.registerSymbol=yn.defaultInstance.registerSymbol.bind(yn.defaultInstance),yn.registerCustom=yn.defaultInstance.registerCustom.bind(yn.defaultInstance),yn.allowErrorProps=yn.defaultInstance.allowErrorProps.bind(yn.defaultInstance);var UHe=yn.serialize,GHe=yn.stringify;function y2(e){return e.state.fetchStatus==="fetching"?"fetching":e.getObserversCount()?e.state.fetchStatus==="paused"?"paused":e.isStale()?"stale":"fresh":"inactive"}function WHe(e,t){return`${e}${t.charAt(0).toUpperCase()+t.slice(1)}`}function KHe({queryState:e,observerCount:t,isStale:n}){return e.fetchStatus==="fetching"?"blue":t?e.fetchStatus==="paused"?"purple":n?"yellow":"green":"gray"}function b2({status:e,isPaused:t}){return t?"purple":e==="error"?"red":e==="pending"?"yellow":e==="success"?"green":"gray"}function YHe(e){return e==="fresh"?"green":e==="stale"?"yellow":e==="paused"?"purple":e==="inactive"?"gray":"blue"}var sP=(e,t=!1)=>{const{json:n}=UHe(e);return JSON.stringify(n,null,t?2:void 0)},lP=e=>e.state.fetchStatus!=="idle"?0:e.getObserversCount()?e.isStale()?2:1:3,ZHe=(e,t)=>e.queryHash.localeCompare(t.queryHash),Qoe=(e,t)=>e.state.dataUpdatedAt<t.state.dataUpdatedAt?1:-1,XHe=(e,t)=>lP(e)===lP(t)?Qoe(e,t):lP(e)>lP(t)?1:-1,aq={status:XHe,"query hash":ZHe,"last updated":Qoe},cP=e=>e.state.isPaused?0:e.state.status==="error"?2:e.state.status==="pending"?1:3,Joe=(e,t)=>e.state.submittedAt<t.state.submittedAt?1:-1,QHe=(e,t)=>cP(e)===cP(t)?Joe(e,t):cP(e)>cP(t)?1:-1,sq={status:QHe,"last updated":Joe},eae=e=>e*parseFloat(getComputedStyle(document.documentElement).fontSize),JHe=()=>{const[e,t]=Ge("dark");return l1(()=>{const n=window.matchMedia("(prefers-color-scheme: dark)");t(n.matches?"dark":"light");const r=i=>{t(i.matches?"dark":"light")};n.addEventListener("change",r),ut(()=>n.removeEventListener("change",r))}),e},c1=(e,t,n)=>{if(t.length===0)return n;if(e instanceof Map){const r=new Map(e);if(t.length===1)return r.set(t[0],n),r;const[i,...o]=t;return r.set(i,c1(r.get(i),o,n)),r}if(e instanceof Set){const r=c1(Array.from(e),t,n);return new Set(r)}if(Array.isArray(e)){const r=[...e];if(t.length===1)return r[t[0]]=n,r;const[i,...o]=t;return r[i]=c1(r[i],o,n),r}if(e instanceof Object){const r={...e};if(t.length===1)return r[t[0]]=n,r;const[i,...o]=t;return r[i]=c1(r[i],o,n),r}return e},vf=(e,t)=>{if(e instanceof Map){const n=new Map(e);if(t.length===1)return n.delete(t[0]),n;const[r,...i]=t;return n.set(r,vf(n.get(r),i)),n}if(e instanceof Set){const n=vf(Array.from(e),t);return new Set(n)}if(Array.isArray(e)){const n=[...e];if(t.length===1)return n.filter((o,a)=>a.toString()!==t[0]);const[r,...i]=t;return n[r]=vf(n[r],i),n}if(e instanceof Object){const n={...e};if(t.length===1)return delete n[t[0]],n;const[r,...i]=t;return n[r]=vf(n[r],i),n}return e},eqe=(e,t)=>{if(!e||document.querySelector("#_goober")||(t==null?void 0:t.querySelector("#_goober")))return;const r=document.createElement("style"),i=document.createTextNode("");r.appendChild(i),r.id="_goober",r.setAttribute("nonce",e),t?t.appendChild(r):document.head.appendChild(r)},tqe=(Hle=class{constructor(e){Xe(this,q2);Xe(this,qf);Xe(this,Bf);Xe(this,Vf);Xe(this,C1,!1);Xe(this,Uf);Xe(this,B2);Xe(this,V2);Xe(this,U2);Xe(this,G2);Xe(this,W2);Xe(this,K2);Xe(this,Gf);const{client:t,queryFlavor:n,version:r,onlineManager:i,buttonPosition:o,position:a,initialIsOpen:s,errorTypes:l,styleNonce:d,shadowDOMTarget:p}=e;Oe(this,q2,Ge(t)),Oe(this,Bf,n),Oe(this,Vf,r),Oe(this,qf,i),Oe(this,Uf,d),Oe(this,B2,p),Oe(this,V2,Ge(o)),Oe(this,U2,Ge(a)),Oe(this,G2,Ge(s)),Oe(this,W2,Ge(l))}setButtonPosition(e){te(this,V2)[1](e)}setPosition(e){te(this,U2)[1](e)}setInitialIsOpen(e){te(this,G2)[1](e)}setErrorTypes(e){te(this,W2)[1](e)}setClient(e){te(this,q2)[1](e)}mount(e){if(te(this,C1))throw new Error("Devtools is already mounted");const t=oHe(()=>{const n=this,[r]=te(this,V2),[i]=te(this,U2),[o]=te(this,G2),[a]=te(this,W2),[s]=te(this,q2);let l;return te(this,K2)?l=te(this,K2):(l=VRe(()=>Promise.resolve().then(()=>_We)),Oe(this,K2,l)),eqe(te(this,Uf),te(this,B2)),ie(l,Dt({get queryFlavor(){return te(n,Bf)},get version(){return te(n,Vf)},get onlineManager(){return te(n,qf)},get shadowDOMTarget(){return te(n,B2)}},{get client(){return s()},get buttonPosition(){return r()},get position(){return i()},get initialIsOpen(){return o()},get errorTypes(){return a()}}))},e);Oe(this,C1,!0),Oe(this,Gf,t)}unmount(){var e;if(!te(this,C1))throw new Error("Devtools is not mounted");(e=te(this,Gf))==null||e.call(this),Oe(this,C1,!1)}},q2=new WeakMap,qf=new WeakMap,Bf=new WeakMap,Vf=new WeakMap,C1=new WeakMap,Uf=new WeakMap,B2=new WeakMap,V2=new WeakMap,U2=new WeakMap,G2=new WeakMap,W2=new WeakMap,K2=new WeakMap,Gf=new WeakMap,Hle);function nqe(e){const t=Bi(e.client),n=k.useRef(null),{buttonPosition:r,position:i,initialIsOpen:o,errorTypes:a,styleNonce:s,shadowDOMTarget:l}=e,[d]=k.useState(new tqe({client:t,queryFlavor:"React Query",version:"5",onlineManager:O0,buttonPosition:r,position:i,initialIsOpen:o,errorTypes:a,styleNonce:s,shadowDOMTarget:l}));return k.useEffect(()=>{d.setClient(t)},[t,d]),k.useEffect(()=>{r&&d.setButtonPosition(r)},[r,d]),k.useEffect(()=>{i&&d.setPosition(i)},[i,d]),k.useEffect(()=>{d.setInitialIsOpen(o||!1)},[o,d]),k.useEffect(()=>{d.setErrorTypes(a||[])},[a,d]),k.useEffect(()=>(n.current&&d.mount(n.current),()=>{d.unmount()}),[d]),u.jsx("div",{className:"tsqd-parent-container",ref:n})}var rqe=nqe;const iqe=Object.freeze(Object.defineProperty({__proto__:null,ReactQueryDevtools:rqe},Symbol.toStringTag,{value:"Module"})),tae="[a-fA-F\\d:]",Rs=e=>e&&e.includeBoundaries?`(?:(?<=\\s|^)(?=${tae})|(?<=${tae})(?=\\s|$))`:"",Eo="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",Xn="[a-fA-F\\d]{1,4}",uP=`
7783
+ `).map((U,D)=>u.jsx("p",{className:ye({"eb-ml-4":D>0}),children:U},D));if(R.id&&((j=i==null?void 0:i.outstanding.questionIds)!=null&&j.includes(R.id)))return u.jsxs("div",{className:"eb-space-y-0.5",children:[u.jsx("div",{className:"eb-text-sm eb-font-medium",children:B}),u.jsxs("div",{className:"eb-flex eb-items-center eb-gap-1 eb-text-warning",children:[u.jsx(Fn,{className:"eb-size-4"}),u.jsx("p",{className:"eb-italic",children:"This field is missing"})]})]},R.id);const V=b==null?void 0:b.find(U=>U.questionId===R.id);return u.jsxs("div",{className:"eb-space-y-0.5",children:[u.jsx("div",{className:"eb-text-sm eb-font-medium",children:B}),u.jsxs("div",{children:[u.jsxs("b",{children:[a("reviewAndAttest.response"),":"]})," ",V&&nOe(V)||u.jsx("span",{className:"eb-italic eb-text-muted-foreground",children:a("common:empty")})]})]},R.id)})]}));return u.jsxs(Lh,{value:P.id,className:ye({"eb-border-success":T,"eb-border-warning":!T}),children:[u.jsxs(Eh,{className:ye({"eb-bg-success-accent":T,"eb-bg-warning-accent":!T}),children:[u.jsx(ao,{className:"eb-ml-2 eb-h-4 eb-w-4 eb-shrink-0 eb-transition-transform eb-duration-200"}),u.jsx("div",{className:"eb-ml-2 eb-text-sm",children:P.sectionConfig.label}),u.jsx("div",{className:"eb-ml-auto eb-mr-2 eb-flex eb-items-center eb-gap-2 eb-text-sm eb-font-normal eb-text-muted-foreground",children:T?u.jsxs(u.Fragment,{children:[u.jsx("p",{children:"Complete"}),u.jsx(Lr,{className:"eb-size-4 eb-text-success"})]}):u.jsxs(u.Fragment,{children:[u.jsx("p",{children:"Missing details"}),u.jsx(Fn,{className:"eb-size-4 eb-text-warning"})]})})]}),u.jsx(XF,{className:"eb-mt-4",children:z})]},P.id)})})}),u.jsxs("div",{className:"eb-space-y-2",children:[u.jsx("p",{className:"eb-text-sm eb-font-medium",children:"Data accuracy attestation"}),u.jsx(jt,{control:h.control,name:"attested",render:({field:P})=>u.jsxs(Ct,{children:[u.jsxs("div",{className:"eb-flex eb-items-start eb-space-x-3",children:[u.jsx(it,{children:u.jsx(mo,{className:"eb-mt-0.5 eb-rounded-sm",checked:P.value,onCheckedChange:P.onChange})}),u.jsx($t,{className:"eb-text-sm eb-font-normal eb-text-foreground peer-disabled:eb-cursor-not-allowed peer-disabled:eb-opacity-70",children:"The data I am providing is true, accurate and complete to the best of my knowledge."})]}),u.jsx(Ht,{})]})})]})]}),u.jsx("div",{className:"eb-mt-6 eb-space-y-6",children:u.jsxs("div",{className:"eb-flex eb-justify-between eb-gap-4",children:[u.jsx(_e,{onClick:e,variant:"secondary",size:"lg",className:ye("eb-w-full eb-text-lg",{"eb-hidden":n()===null}),children:n()}),u.jsx(_e,{type:"submit",variant:"default",size:"lg",className:ye("eb-w-full eb-text-lg",{"eb-hidden":r()===null}),children:r()})]})})]})})},wRe=()=>Xne().replace(/[^a-zA-Z0-9_-]/g,""),kRe=({handlePrev:e,handleNext:t,getPrevButtonLabel:n,getNextButtonLabel:r})=>{var z;const{clientData:i,onPostClientSettled:o}=Kr(),{updateSessionData:a}=Io(),{t:s}=Qt("onboarding"),l=ki({defaultValues:{attested:!1},resolver:yo(ne.object({attested:ne.boolean().refine(T=>T===!0,{message:"You must agree to all of the documents listed on this page."})}))}),{data:d}=Qne(),[p,h]=c.useState({}),[f,m]=c.useState({}),[b,y]=c.useState({}),{mutateAsync:v,error:x}=na(),{mutateAsync:w,error:C}=bX(),M=((z=i==null?void 0:i.outstanding)==null?void 0:z.attestationDocumentIds)||[],S=eN({queries:M.map(T=>({queryKey:["documentDetail",T],queryFn:()=>CX(T)}))}),I=M.every(T=>p[T]||b[T]),L=T=>async()=>{h($=>({...$,[T]:!0}));try{y(B=>({...B,[T]:null})),m(B=>({...B,[T]:!0}));const $=await SX(T,{responseType:"blob"}),H=new Blob([$],{type:"application/pdf"}),O=URL.createObjectURL(H),R=window.open(O,"_blank");if(!R)throw new Error("Failed to open document. Please check your popup blocker settings.");R.focus(),h(B=>({...B,[T]:!0}))}catch($){y(H=>({...H,[T]:$ instanceof Error?$.message:"Failed to download document"}))}finally{m($=>({...$,[T]:!1}))}},E=async()=>{var T,$,H,O,R,B,V;if(i!=null&&i.id){const G={addAttestations:[{attestationTime:new Date().toISOString(),attesterFullName:(H=($=(T=i==null?void 0:i.parties)==null?void 0:T.find(U=>(U==null?void 0:U.partyType)==="INDIVIDUAL"))==null?void 0:$.individualDetails)==null?void 0:H.firstName,ipAddress:d,documentId:(R=(O=i==null?void 0:i.outstanding)==null?void 0:O.attestationDocumentIds)==null?void 0:R[0]}]},j={consumerDevice:{ipAddress:d,sessionId:wRe()}};try{(V=(B=i==null?void 0:i.outstanding)==null?void 0:B.attestationDocumentIds)!=null&&V.length&&await v({id:i.id,data:G},{onSettled:(U,D)=>{var A;o==null||o(U,(A=D==null?void 0:D.response)==null?void 0:A.data)}}),await w({id:i.id,data:j},{onSuccess:()=>{a({mockedKycCompleted:!0}),t()}})}catch(U){console.error("Error completing KYC process:",U)}}};c.useEffect(()=>{const T=S.reduce((H,O)=>{var R;return(R=O.data)!=null&&R.id&&(H[O.data.id]=!1),H},{});Object.keys(T).some(H=>!(H in p))&&h(T)},[S.map(T=>{var $;return($=T.data)==null?void 0:$.id}).filter(Boolean)]);const[N,P]=c.useState(!1);return u.jsx(dr,{...l,children:u.jsxs("form",{onSubmit:T=>{T.preventDefault(),I?l.handleSubmit(()=>{E()})(T):P(!0)},className:"eb-flex eb-flex-auto eb-flex-col",children:[u.jsxs("div",{className:"eb-mt-6 eb-flex-auto eb-space-y-6",children:[!I&&N&&u.jsxs(rn,{variant:"destructive",noTitle:!0,children:[u.jsx(ar,{className:"eb-h-4 eb-w-4"}),u.jsx(on,{children:"Please open the document links and confirm that you have read and agree to all documents."})]}),u.jsx("div",{className:"eb-mt-2 eb-flex eb-flex-col eb-gap-2",children:M.map(T=>{var H,O;const $=S.find(R=>{var B;return((B=R.data)==null?void 0:B.id)===T});return u.jsxs("div",{className:"eb-flex eb-flex-col eb-gap-1",children:[u.jsxs(_e,{type:"button",onClick:L(T),variant:"ghost",className:ye("eb-flex eb-h-14 eb-w-full eb-justify-between eb-rounded-md eb-border eb-bg-card eb-px-4 eb-py-2 eb-font-sans eb-text-sm eb-font-normal eb-shadow-md",{"eb-border-success eb-bg-success-accent hover:eb-bg-success-accent/80":p[T]}),disabled:($==null?void 0:$.isLoading)||f[T],children:[u.jsxs("span",{className:"eb-flex eb-items-center eb-gap-2",children:[u.jsx(P1,{}),u.jsx("p",{className:"eb-text-[#12647E] eb-underline",children:$!=null&&$.isLoading?"Loading...":(H=$==null?void 0:$.data)==null?void 0:H.documentType}),u.jsx(J2,{className:"eb-text-[#12647E]"})]}),u.jsxs("span",{children:[p[T]&&u.jsx(Ri,{className:"eb-text-success"}),f[T]&&s("reviewAndAttest.termsAndConditions.downloading")]})]}),((O=$==null?void 0:$.data)==null?void 0:O.id)&&b[$==null?void 0:$.data.id]&&u.jsxs("div",{className:"eb-ml-1 eb-text-sm eb-text-destructive",children:["Failed to download document: ",b[T]]}),!$&&b[T]&&u.jsxs("div",{className:"eb-ml-1 eb-text-sm eb-text-destructive",children:["Failed to fetch document details: ",b[T]]})]},T)})}),u.jsxs("div",{className:"eb-space-y-1",children:[u.jsx("p",{className:"eb-text-sm eb-font-medium",children:"Document attestation"}),u.jsx(jt,{control:l.control,name:"attested",disabled:!I,render:({field:T})=>u.jsxs(Ct,{children:[u.jsxs("div",{className:"eb-flex eb-items-center eb-space-x-2",children:[u.jsx(it,{children:u.jsx(mo,{checked:T.value,onCheckedChange:T.onChange,disabled:T.disabled})}),u.jsx($t,{className:"eb-text-sm eb-font-normal eb-text-foreground peer-disabled:eb-cursor-not-allowed peer-disabled:eb-opacity-70",children:"I have read and agree to all of the documents listed on this page"})]}),u.jsx(Ht,{})]})})]}),!I&&u.jsxs(rn,{variant:"informative",noTitle:!0,children:[u.jsx(sr,{className:"eb-h-4 eb-w-4"}),u.jsx(on,{children:"You must open and review all documents before selecting the checkbox"})]}),u.jsx(Gr,{error:x||C})]}),u.jsx("div",{className:"eb-mt-6 eb-space-y-6",children:u.jsxs("div",{className:"eb-flex eb-justify-between eb-gap-4",children:[u.jsx(_e,{onClick:e,variant:"secondary",size:"lg",className:ye("eb-w-full eb-text-lg",{"eb-hidden":n()===null}),children:n()}),u.jsx(_e,{type:"submit",variant:"default",size:"lg",className:ye("eb-w-full eb-text-lg",{"eb-hidden":r()===null}),children:r()})]})})]})})},CRe=[{id:"gateway",isSection:!1,type:"component",Component:sRe},{id:"checklist",isSection:!1,type:"component",Component:nRe},{id:"overview",isSection:!1,type:"component",Component:dRe},{id:"owner-stepper",isSection:!1,type:"stepper",stepperConfig:{associatedPartyFilters:{partyType:"INDIVIDUAL",roles:["BENEFICIAL_OWNER"]},defaultPartyRequestBody:{partyType:"INDIVIDUAL",roles:["BENEFICIAL_OWNER"]},steps:uf}},{id:"document-upload-form",isSection:!1,type:"component",Component:oRe}],SRe=[{id:"personal-section",isSection:!0,type:"stepper",sectionConfig:{label:"Your personal details",shortLabel:"Personal details",icon:z1,requirementsList:["Your name and job title","Government issued identifier (e.g. social security number)","Address and contact details"],statusResolver:(e,t,n,r)=>e.mockedKycCompleted||(t==null?void 0:t.status)==="INFORMATION_REQUESTED"||(t==null?void 0:t.status)==="REVIEW_IN_PROGRESS"||(t==null?void 0:t.status)==="APPROVED"||(t==null?void 0:t.status)==="DECLINED"?"hidden":n?"completed":Object.entries(r).some(([,o])=>o.isValid)?"missing_details":"not_started"},stepperConfig:{associatedPartyFilters:{partyType:"INDIVIDUAL",roles:["CONTROLLER"]},defaultPartyRequestBody:{partyType:"INDIVIDUAL",roles:["CONTROLLER"]},steps:[{id:"personal-details",title:"Your personal details",stepType:"form",description:"We collect your personal information as the primary person controlling business operations for the company.",Component:cf},{id:"identity-document",title:"Your ID details",stepType:"form",description:"We need some additional details to confirm your identity.",Component:BH},{id:"contact-details",title:"Your contact details",stepType:"form",description:"We need some additional details to confirm your identity.",Component:G$},{id:"check-answers",title:"Check your answers",stepType:"check-answers",description:"Please ensure your answers are accurate and complete anything you may have missed."}]}},{id:"business-section",isSection:!0,type:"stepper",sectionConfig:{label:"Business details",icon:D1,requirementsList:["Industry classification code","Registration ID details (e.g. employer identification number)","Location and contact details"],statusResolver:(e,t,n)=>e.mockedKycCompleted||(t==null?void 0:t.status)==="INFORMATION_REQUESTED"||(t==null?void 0:t.status)==="REVIEW_IN_PROGRESS"||(t==null?void 0:t.status)==="APPROVED"||(t==null?void 0:t.status)==="DECLINED"?"hidden":n?"completed":"not_started"},stepperConfig:{associatedPartyFilters:{partyType:"ORGANIZATION",roles:["CLIENT"]},defaultPartyRequestBody:{partyType:"ORGANIZATION",roles:["CLIENT"]},steps:[{id:"industry",stepType:"form",title:"Industry classification",description:"Choose a classification that best describes your income-producing lines of business.",Component:uoe},{id:"company-identification",stepType:"form",title:"Business identity",description:"Please provide details about your business.",Component:coe},{id:"customer-facing-details",stepType:"form",title:"Description & website",description:"Please help us understand the products and services you offer.",Component:U$},{id:"contact-info",stepType:"form",title:"Contact information",description:"Please let us know how to get in touch.",Component:pH},{id:"check-answers",stepType:"check-answers",title:"Check your answers",description:"Please ensure your answers are accurate and complete anything you may have missed."}]}},{id:"owners-section",isSection:!0,type:"component",sectionConfig:{label:"Owners and key roles",icon:as,requirementsList:["Name and job titles for all individuals","Government issued identifier (e.g. social security number)","Address and contact details"],statusResolver:(e,t)=>{const n=JPe(t),r=n==null?void 0:n.every(i=>{const{allStepsValid:o}=tf(uf,i,t);return o});return e.mockedKycCompleted||(t==null?void 0:t.status)==="INFORMATION_REQUESTED"||(t==null?void 0:t.status)==="REVIEW_IN_PROGRESS"||(t==null?void 0:t.status)==="APPROVED"||(t==null?void 0:t.status)==="DECLINED"?"hidden":r?e.isOwnersSectionDone?"completed":"not_started":"missing_details"}},Component:vRe},{id:"additional-questions-section",isSection:!0,type:"component",sectionConfig:{label:"Operational details",icon:l0,requirementsList:["Total annual revenue","Additional questions based on your business profile"],statusResolver:(e,t)=>{var r,i;const n=((i=(r=t==null?void 0:t.outstanding)==null?void 0:r.questionIds)==null?void 0:i.length)===0;return e.mockedKycCompleted||(t==null?void 0:t.status)==="INFORMATION_REQUESTED"||(t==null?void 0:t.status)==="REVIEW_IN_PROGRESS"||(t==null?void 0:t.status)==="APPROVED"||(t==null?void 0:t.status)==="DECLINED"?"hidden":n?"completed":"not_started"}},Component:uRe},{id:"review-attest-section",isSection:!0,type:"stepper",sectionConfig:{label:"Review and attest",icon:P1,statusResolver:(e,t)=>e.mockedKycCompleted||(t==null?void 0:t.status)==="INFORMATION_REQUESTED"||(t==null?void 0:t.status)==="REVIEW_IN_PROGRESS"||(t==null?void 0:t.status)==="APPROVED"||(t==null?void 0:t.status)==="DECLINED"?"hidden":"not_started"},stepperConfig:{steps:[{id:"review",title:"Review your details",stepType:"static",description:"Please ensure your answers are accurate and complete anything you may have missed.",Component:xRe},{id:"documents",title:"Terms and conditions",stepType:"static",description:"Please open and review the following documents from J.P. Morgan to complete the process.",Component:kRe}]}},{id:"upload-documents-section",isSection:!0,type:"component",sectionConfig:{label:"Supporting documents",icon:os,onHoldText:"We'll let you know if any documents are needed",statusResolver:(e,t,n,r,i)=>{var s,l;const o=(s=t==null?void 0:t.parties)==null?void 0:s.some(d=>{var p;return(p=d.validationResponse)==null?void 0:p.some(h=>{var f;return!!((f=h.documentRequestIds)!=null&&f.length)})}),a=ure(i);return(t==null?void 0:t.status)==="INFORMATION_REQUESTED"&&((l=t.outstanding.documentRequestIds)!=null&&l.length||o)?"not_started":(t==null?void 0:t.status)==="NEW"||(t==null?void 0:t.status)==="REVIEW_IN_PROGRESS"?a?"completed_disabled":"on_hold":(t==null?void 0:t.status)==="APPROVED"||(t==null?void 0:t.status)==="DECLINED"?"hidden":"completed_disabled"}},Component:aRe}],foe={screens:[...CRe,...SRe]},MRe=({initialClientId:e,onboardingContentTokens:t={},alertOnExit:n=!1,userEventsToTrack:r=[],userEventsHandler:i,height:o,onGetClientSettledSettled:a,...s})=>{var S,I;const[l,d]=c.useState(e??""),{interceptorReady:p}=pye(),{data:h,status:f,error:m}=Li(l,{query:{enabled:!!l&&p,refetchOnWindowFocus:!1}});c.useEffect(()=>{a&&a(h,f,m)},[h,f,m,a]);const{data:{documentRequests:b}={}}=vX({clientId:l});c.useEffect(()=>{d(e??"")},[e]);const y=(S=h==null?void 0:h.parties)==null?void 0:S.find(L=>L.partyType==="ORGANIZATION"),v=(I=y==null?void 0:y.organizationDetails)==null?void 0:I.organizationType,{tokens:x={}}=GZ(),{i18n:w,t:C}=Qt(["onboarding-overview","onboarding"]);c.useEffect(()=>{$0(w.language,"onboarding",[x.onboarding,t])},[w.language,JSON.stringify(x.onboarding),JSON.stringify(t)]),c.useEffect(()=>{const L=E=>{E.preventDefault(),E.returnValue=!0};return n&&window.addEventListener("beforeunload",L),()=>{window.removeEventListener("beforeunload",L)}},[n]);const M=c.useCallback(L=>{var N;const E=L.target;Object.keys(E.dataset).includes("userEventTracking")&&(i==null||i({actionName:`${L.type} on ${(N=E.dataset)==null?void 0:N.userEventTracking}`}))},[]);return c.useEffect(()=>{if((r==null?void 0:r.length)>0&&i){const L=document.getElementById("eb-component");return r.forEach(E=>L==null?void 0:L.addEventListener(E,M)),()=>{r.forEach(E=>L==null?void 0:L.removeEventListener(E,M))}}return()=>{}},[]),gX({userEmail:"test@test.com",DOMElementToTrack:"embedded-component-layout",eventsToTrack:["click","blur"]}),u.jsx(XJ.Provider,{value:{...s,clientData:h,setClientId:d,organizationType:v,documentRequests:b},children:u.jsx("div",{id:"embedded-component-layout",className:"eb-component eb-mx-auto eb-flex eb-flex-1 eb-flex-col eb-bg-background eb-p-4 eb-pb-6 eb-font-sans eb-text-foreground eb-antialiased sm:eb-max-w-screen-sm sm:eb-p-10 sm:eb-pb-12",style:{minHeight:o},children:m?u.jsx(Gr,{error:m}):f==="pending"&&e?u.jsx(Ds,{message:C("onboarding:fetchingClientData")}):u.jsx(XPe,{initialScreenId:s.docUploadOnlyMode?"upload-documents-section":v?"overview":"gateway",flowConfig:foe,children:u.jsx(IRe,{})})},e)})},IRe=()=>{const{clientData:e,organizationType:t,docUploadOnlyMode:n}=Kr(),{currentScreenId:r,goTo:i,sessionData:o,updateSessionData:a}=Io(),s=c.useRef(null),l=c.useRef(!0);c.useEffect(()=>{var h;if(l.current){l.current=!1;return}(h=s.current)==null||h.scrollIntoView({behavior:"smooth",block:"start"})},[r]),c.useEffect(()=>{n&&!["upload-documents-section","document-upload-form"].includes(r)?i("upload-documents-section",{resetHistory:!0}):!n&&!t&&r!=="gateway"&&i("gateway",{resetHistory:!0})},[r,n,t]),c.useEffect(()=>{if(o.mockedVerifyingSectionId){const h=setTimeout(()=>{a({mockedVerifyingSectionId:void 0})},1500);return()=>clearTimeout(h)}return()=>{}},[o.mockedVerifyingSectionId]);const d=foe.screens.find(h=>h.id===r),p=()=>{if(!d)return u.jsxs("div",{children:["Unknown screen id: ",r]});if(d.type==="component"){const h=d.Component;return u.jsx(h,{})}return d.type==="stepper"?u.jsx(rOe,{...d.stepperConfig}):u.jsx("div",{children:"Unhandled screen error"})};return u.jsx("div",{className:"eb-flex eb-flex-1 eb-scroll-mt-44 sm:eb-scroll-mt-48",ref:s,children:u.jsx("div",{className:"eb-w-full",children:p()})},e==null?void 0:e.id)};var zt={context:void 0,registry:void 0,getContextId(){return moe(this.context.count)},getNextContextId(){return moe(this.context.count++)}};function moe(e){const t=String(e),n=t.length-1;return zt.context.id+(n?String.fromCharCode(96+n):"")+t}function df(e){zt.context=e}var LRe=(e,t)=>e===t,W$=Symbol("solid-proxy"),K$=Symbol("solid-track"),Y$={equals:LRe},goe=Coe,Ba=1,Z$=2,yoe={owned:null,cleanups:null,context:null,owner:null},UH={},nn=null,GH=null,ERe=null,gn=null,$r=null,Va=null,X$=0;function Ua(e,t){const n=gn,r=nn,i=e.length===0,o=t===void 0?r:t,a=i?yoe:{owned:null,cleanups:null,context:o?o.context:null,owner:o},s=i?e:()=>e(()=>jn(()=>tP(a)));nn=a,gn=null;try{return la(s,!0)}finally{gn=n,nn=r}}function Ge(e,t){t=t?Object.assign({},Y$,t):Y$;const n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},r=i=>(typeof i=="function"&&(i=i(n.value)),koe(n,i));return[woe.bind(n),r]}function boe(e,t,n){const r=Q$(e,t,!0,Ba);h2(r)}function ct(e,t,n){const r=Q$(e,t,!1,Ba);h2(r)}function rt(e,t,n){goe=_Re;const r=Q$(e,t,!1,Ba);(!n||!n.render)&&(r.user=!0),Va?Va.push(r):h2(r)}function Ee(e,t,n){n=n?Object.assign({},Y$,n):Y$;const r=Q$(e,t,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,h2(r),woe.bind(r)}function ARe(e){return e&&typeof e=="object"&&"then"in e}function DRe(e,t,n){let r,i,o;arguments.length===1?(r=!0,i=e,o={}):(r=e,i=t,o={});let a=null,s=UH,l=null,d=!1,p="initialValue"in o,h=typeof r=="function"&&Ee(r);const f=new Set,[m,b]=(o.storage||Ge)(o.initialValue),[y,v]=Ge(void 0),[x,w]=Ge(void 0,{equals:!1}),[C,M]=Ge(p?"ready":"unresolved");if(zt.context){l=zt.getNextContextId();let N;o.ssrLoadFrom==="initial"?s=o.initialValue:zt.load&&(N=zt.load(l))&&(s=N)}function S(N,P,z,T){return a===N&&(a=null,T!==void 0&&(p=!0),(N===s||P===s)&&o.onHydrated&&queueMicrotask(()=>o.onHydrated(T,{value:P})),s=UH,I(P,z)),P}function I(N,P){la(()=>{P===void 0&&b(()=>N),M(P!==void 0?"errored":p?"ready":"unresolved"),v(P);for(const z of f.keys())z.decrement();f.clear()},!1)}function L(){const N=ORe,P=m(),z=y();if(z!==void 0&&!a)throw z;return gn&&gn.user,P}function E(N=!0){if(N!==!1&&d)return;d=!1;const P=h?h():r;if(P==null||P===!1){S(a,jn(m));return}const z=s!==UH?s:jn(()=>i(P,{value:m(),refetching:N}));return ARe(z)?(a=z,"value"in z?(z.status==="success"?S(a,z.value,void 0,P):S(a,void 0,WH(z.value),P),z):(d=!0,queueMicrotask(()=>d=!1),la(()=>{M(p?"refreshing":"pending"),w()},!1),z.then(T=>S(z,T,void 0,P),T=>S(z,void 0,WH(T),P)))):(S(a,z,void 0,P),z)}return Object.defineProperties(L,{state:{get:()=>C()},error:{get:()=>y()},loading:{get(){const N=C();return N==="pending"||N==="refreshing"}},latest:{get(){if(!p)return L();const N=y();if(N&&!a)throw N;return m()}}}),h?boe(()=>E(!1)):E(!1),[L,{refetch:E,mutate:b}]}function TRe(e){return la(e,!1)}function jn(e){if(gn===null)return e();const t=gn;gn=null;try{return e()}finally{gn=t}}function Ga(e,t,n){const r=Array.isArray(e);let i,o=n&&n.defer;return a=>{let s;if(r){s=Array(e.length);for(let d=0;d<e.length;d++)s[d]=e[d]()}else s=e();if(o)return o=!1,a;const l=jn(()=>t(s,i,a));return i=s,l}}function l1(e){rt(()=>jn(e))}function ut(e){return nn===null||(nn.cleanups===null?nn.cleanups=[e]:nn.cleanups.push(e)),e}function voe(){return nn}function NRe(e,t){const n=nn,r=gn;nn=e,gn=null;try{return la(t,!0)}catch(i){KH(i)}finally{nn=n,gn=r}}function FRe(e){const t=gn,n=nn;return Promise.resolve().then(()=>{gn=t,nn=n;let r;return la(e,!1),gn=nn=null,r?r.done:void 0})}var[$Re,gXe]=Ge(!1);function PRe(){return[$Re,FRe]}function kr(e,t){const n=Symbol("context");return{id:n,Provider:RRe(n),defaultValue:e}}function Cr(e){let t;return nn&&nn.context&&(t=nn.context[e.id])!==void 0?t:e.defaultValue}function xoe(e){const t=Ee(e),n=Ee(()=>YH(t()));return n.toArray=()=>{const r=n();return Array.isArray(r)?r:r!=null?[r]:[]},n}var ORe;function woe(){if(this.sources&&this.state)if(this.state===Ba)h2(this);else{const e=$r;$r=null,la(()=>eP(this),!1),$r=e}if(gn){const e=this.observers?this.observers.length:0;gn.sources?(gn.sources.push(this),gn.sourceSlots.push(e)):(gn.sources=[this],gn.sourceSlots=[e]),this.observers?(this.observers.push(gn),this.observerSlots.push(gn.sources.length-1)):(this.observers=[gn],this.observerSlots=[gn.sources.length-1])}return this.value}function koe(e,t,n){let r=e.value;return(!e.comparator||!e.comparator(r,t))&&(e.value=t,e.observers&&e.observers.length&&la(()=>{for(let i=0;i<e.observers.length;i+=1){const o=e.observers[i],a=GH&&GH.running;a&&GH.disposed.has(o),(a?!o.tState:!o.state)&&(o.pure?$r.push(o):Va.push(o),o.observers&&Soe(o)),a||(o.state=Ba)}if($r.length>1e6)throw $r=[],new Error},!1)),t}function h2(e){if(!e.fn)return;tP(e);const t=X$;jRe(e,e.value,t)}function jRe(e,t,n){let r;const i=nn,o=gn;gn=nn=e;try{r=e.fn(t)}catch(a){return e.pure&&(e.state=Ba,e.owned&&e.owned.forEach(tP),e.owned=null),e.updatedAt=n+1,KH(a)}finally{gn=o,nn=i}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&"observers"in e?koe(e,r):e.value=r,e.updatedAt=n)}function Q$(e,t,n,r=Ba,i){const o={fn:e,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:nn,context:nn?nn.context:null,pure:n};return nn===null||nn!==yoe&&(nn.owned?nn.owned.push(o):nn.owned=[o]),o}function J$(e){if(e.state===0)return;if(e.state===Z$)return eP(e);if(e.suspense&&jn(e.suspense.inFallback))return e.suspense.effects.push(e);const t=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<X$);)e.state&&t.push(e);for(let n=t.length-1;n>=0;n--)if(e=t[n],e.state===Ba)h2(e);else if(e.state===Z$){const r=$r;$r=null,la(()=>eP(e,t[0]),!1),$r=r}}function la(e,t){if($r)return e();let n=!1;t||($r=[]),Va?n=!0:Va=[],X$++;try{const r=e();return zRe(n),r}catch(r){n||(Va=null),$r=null,KH(r)}}function zRe(e){if($r&&(Coe($r),$r=null),e)return;const t=Va;Va=null,t.length&&la(()=>goe(t),!1)}function Coe(e){for(let t=0;t<e.length;t++)J$(e[t])}function _Re(e){let t,n=0;for(t=0;t<e.length;t++){const r=e[t];r.user?e[n++]=r:J$(r)}if(zt.context){if(zt.count){zt.effects||(zt.effects=[]),zt.effects.push(...e.slice(0,n));return}else zt.effects&&(e=[...zt.effects,...e],n+=zt.effects.length,delete zt.effects);df()}for(t=0;t<n;t++)J$(e[t])}function eP(e,t){e.state=0;for(let n=0;n<e.sources.length;n+=1){const r=e.sources[n];if(r.sources){const i=r.state;i===Ba?r!==t&&(!r.updatedAt||r.updatedAt<X$)&&J$(r):i===Z$&&eP(r,t)}}}function Soe(e){for(let t=0;t<e.observers.length;t+=1){const n=e.observers[t];n.state||(n.state=Z$,n.pure?$r.push(n):Va.push(n),n.observers&&Soe(n))}}function tP(e){let t;if(e.sources)for(;e.sources.length;){const n=e.sources.pop(),r=e.sourceSlots.pop(),i=n.observers;if(i&&i.length){const o=i.pop(),a=n.observerSlots.pop();r<i.length&&(o.sourceSlots[a]=r,i[r]=o,n.observerSlots[r]=a)}}if(e.owned){for(t=e.owned.length-1;t>=0;t--)tP(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}e.state=0}function WH(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function KH(e,t=nn){throw WH(e)}function YH(e){if(typeof e=="function"&&!e.length)return YH(e());if(Array.isArray(e)){const t=[];for(let n=0;n<e.length;n++){const r=YH(e[n]);Array.isArray(r)?t.push.apply(t,r):t.push(r)}return t}return e}function RRe(e,t){return function(r){let i;return ct(()=>i=jn(()=>(nn.context={...nn.context,[e]:r.value},xoe(()=>r.children))),void 0),i}}var ZH=Symbol("fallback");function nP(e){for(let t=0;t<e.length;t++)e[t]()}function HRe(e,t,n={}){let r=[],i=[],o=[],a=0,s=t.length>1?[]:null;return ut(()=>nP(o)),()=>{let l=e()||[],d=l.length,p,h;return l[K$],jn(()=>{let m,b,y,v,x,w,C,M,S;if(d===0)a!==0&&(nP(o),o=[],r=[],i=[],a=0,s&&(s=[])),n.fallback&&(r=[ZH],i[0]=Ua(I=>(o[0]=I,n.fallback())),a=1);else if(a===0){for(i=new Array(d),h=0;h<d;h++)r[h]=l[h],i[h]=Ua(f);a=d}else{for(y=new Array(d),v=new Array(d),s&&(x=new Array(d)),w=0,C=Math.min(a,d);w<C&&r[w]===l[w];w++);for(C=a-1,M=d-1;C>=w&&M>=w&&r[C]===l[M];C--,M--)y[M]=i[C],v[M]=o[C],s&&(x[M]=s[C]);for(m=new Map,b=new Array(M+1),h=M;h>=w;h--)S=l[h],p=m.get(S),b[h]=p===void 0?-1:p,m.set(S,h);for(p=w;p<=C;p++)S=r[p],h=m.get(S),h!==void 0&&h!==-1?(y[h]=i[p],v[h]=o[p],s&&(x[h]=s[p]),h=b[h],m.set(S,h)):o[p]();for(h=w;h<d;h++)h in y?(i[h]=y[h],o[h]=v[h],s&&(s[h]=x[h],s[h](h))):i[h]=Ua(f);i=i.slice(0,a=d),r=l.slice(0)}return i});function f(m){if(o[h]=m,s){const[b,y]=Ge(h);return s[h]=y,t(l[h],b)}return t(l[h])}}}function qRe(e,t,n={}){let r=[],i=[],o=[],a=[],s=0,l;return ut(()=>nP(o)),()=>{const d=e()||[],p=d.length;return d[K$],jn(()=>{if(p===0)return s!==0&&(nP(o),o=[],r=[],i=[],s=0,a=[]),n.fallback&&(r=[ZH],i[0]=Ua(f=>(o[0]=f,n.fallback())),s=1),i;for(r[0]===ZH&&(o[0](),o=[],r=[],i=[],s=0),l=0;l<p;l++)l<r.length&&r[l]!==d[l]?a[l](()=>d[l]):l>=r.length&&(i[l]=Ua(h));for(;l<r.length;l++)o[l]();return s=a.length=o.length=p,r=d.slice(0),i=i.slice(0,s)});function h(f){o[l]=f;const[m,b]=Ge(d[l]);return a[l]=b,t(m,l)}}}function ie(e,t){return jn(()=>e(t||{}))}function rP(){return!0}var XH={get(e,t,n){return t===W$?n:e.get(t)},has(e,t){return t===W$?!0:e.has(t)},set:rP,deleteProperty:rP,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:rP,deleteProperty:rP}},ownKeys(e){return e.keys()}};function QH(e){return(e=typeof e=="function"?e():e)?e:{}}function BRe(){for(let e=0,t=this.length;e<t;++e){const n=this[e]();if(n!==void 0)return n}}function Dt(...e){let t=!1;for(let a=0;a<e.length;a++){const s=e[a];t=t||!!s&&W$ in s,e[a]=typeof s=="function"?(t=!0,Ee(s)):s}if(t)return new Proxy({get(a){for(let s=e.length-1;s>=0;s--){const l=QH(e[s])[a];if(l!==void 0)return l}},has(a){for(let s=e.length-1;s>=0;s--)if(a in QH(e[s]))return!0;return!1},keys(){const a=[];for(let s=0;s<e.length;s++)a.push(...Object.keys(QH(e[s])));return[...new Set(a)]}},XH);const n={},r=Object.create(null);for(let a=e.length-1;a>=0;a--){const s=e[a];if(!s)continue;const l=Object.getOwnPropertyNames(s);for(let d=l.length-1;d>=0;d--){const p=l[d];if(p==="__proto__"||p==="constructor")continue;const h=Object.getOwnPropertyDescriptor(s,p);if(!r[p])r[p]=h.get?{enumerable:!0,configurable:!0,get:BRe.bind(n[p]=[h.get.bind(s)])}:h.value!==void 0?h:void 0;else{const f=n[p];f&&(h.get?f.push(h.get.bind(s)):h.value!==void 0&&f.push(()=>h.value))}}}const i={},o=Object.keys(r);for(let a=o.length-1;a>=0;a--){const s=o[a],l=r[s];l&&l.get?Object.defineProperty(i,s,l):i[s]=l?l.value:void 0}return i}function cn(e,...t){if(W$ in e){const i=new Set(t.length>1?t.flat():t[0]),o=t.map(a=>new Proxy({get(s){return a.includes(s)?e[s]:void 0},has(s){return a.includes(s)&&s in e},keys(){return a.filter(s=>s in e)}},XH));return o.push(new Proxy({get(a){return i.has(a)?void 0:e[a]},has(a){return i.has(a)?!1:a in e},keys(){return Object.keys(e).filter(a=>!i.has(a))}},XH)),o}const n={},r=t.map(()=>({}));for(const i of Object.getOwnPropertyNames(e)){const o=Object.getOwnPropertyDescriptor(e,i),a=!o.get&&!o.set&&o.enumerable&&o.writable&&o.configurable;let s=!1,l=0;for(const d of t)d.includes(i)&&(s=!0,a?r[l][i]=o.value:Object.defineProperty(r[l],i,o)),++l;s||(a?n[i]=o.value:Object.defineProperty(n,i,o))}return[...r,n]}function VRe(e){let t,n;const r=i=>{const o=zt.context;if(o){const[s,l]=Ge();zt.count||(zt.count=0),zt.count++,(n||(n=e())).then(d=>{df(o),zt.count--,l(()=>d.default),df()}),t=s}else if(!t){const[s]=DRe(()=>(n||(n=e())).then(l=>l.default));t=s}let a;return Ee(()=>(a=t())&&jn(()=>{if(!o)return a(i);const s=zt.context;df(o);const l=a(i);return df(s),l}))};return r.preload=()=>n||((n=e()).then(i=>t=()=>i.default),n),r}var URe=0;function Qi(){return zt.context?zt.getNextContextId():`cl-${URe++}`}var Moe=e=>`Stale read from <${e}>.`;function GRe(e){const t="fallback"in e&&{fallback:()=>e.fallback};return Ee(HRe(()=>e.each,e.children,t||void 0))}function WRe(e){const t="fallback"in e&&{fallback:()=>e.fallback};return Ee(qRe(()=>e.each,e.children,t||void 0))}function dt(e){const t=e.keyed,n=Ee(()=>e.when,void 0,{equals:(r,i)=>t?r===i:!r==!i});return Ee(()=>{const r=n();if(r){const i=e.children;return typeof i=="function"&&i.length>0?jn(()=>i(t?r:()=>{if(!jn(n))throw Moe("Show");return e.when})):i}return e.fallback},void 0,void 0)}function KRe(e){let t=!1;const n=(o,a)=>(t?o[1]===a[1]:!o[1]==!a[1])&&o[2]===a[2],r=xoe(()=>e.children),i=Ee(()=>{let o=r();Array.isArray(o)||(o=[o]);for(let a=0;a<o.length;a++){const s=o[a].when;if(s)return t=!!o[a].keyed,[a,s,o[a]]}return[-1]},void 0,{equals:n});return Ee(()=>{const[o,a,s]=i();if(o<0)return e.fallback;const l=s.children;return typeof l=="function"&&l.length>0?jn(()=>l(t?a:()=>{if(jn(i)[0]!==o)throw Moe("Match");return s.when})):l},void 0,void 0)}function JH(e){return e}var YRe=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected"],ZRe=new Set(["className","value","readOnly","formNoValidate","isMap","noModule","playsInline",...YRe]),XRe=new Set(["innerHTML","textContent","innerText","children"]),QRe=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),JRe=Object.assign(Object.create(null),{class:"className",formnovalidate:{$:"formNoValidate",BUTTON:1,INPUT:1},ismap:{$:"isMap",IMG:1},nomodule:{$:"noModule",SCRIPT:1},playsinline:{$:"playsInline",VIDEO:1},readonly:{$:"readOnly",INPUT:1,TEXTAREA:1}});function eHe(e,t){const n=JRe[e];return typeof n=="object"?n[t]?n.$:void 0:n}var tHe=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),nHe=new Set(["altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","svg","switch","symbol","text","textPath","tref","tspan","use","view","vkern"]),rHe={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"};function iHe(e,t,n){let r=n.length,i=t.length,o=r,a=0,s=0,l=t[i-1].nextSibling,d=null;for(;a<i||s<o;){if(t[a]===n[s]){a++,s++;continue}for(;t[i-1]===n[o-1];)i--,o--;if(i===a){const p=o<r?s?n[s-1].nextSibling:n[o-s]:l;for(;s<o;)e.insertBefore(n[s++],p)}else if(o===s)for(;a<i;)(!d||!d.has(t[a]))&&t[a].remove(),a++;else if(t[a]===n[o-1]&&n[s]===t[i-1]){const p=t[--i].nextSibling;e.insertBefore(n[s++],t[a++].nextSibling),e.insertBefore(n[--o],p),t[i]=n[o]}else{if(!d){d=new Map;let h=s;for(;h<o;)d.set(n[h],h++)}const p=d.get(t[a]);if(p!=null)if(s<p&&p<o){let h=a,f=1,m;for(;++h<i&&h<o&&!((m=d.get(t[h]))==null||m!==p+f);)f++;if(f>p-s){const b=t[a];for(;s<p;)e.insertBefore(n[s++],b)}else e.replaceChild(n[s++],t[a++])}else a++;else t[a++].remove()}}}var pf="_$DX_DELEGATE";function oHe(e,t,n,r={}){let i;return Ua(o=>{i=o,t===document?e():Te(t,e(),t.firstChild?null:void 0,n)},r.owner),()=>{i(),t.textContent=""}}function et(e,t,n){let r;const i=()=>{const a=document.createElement("template");return a.innerHTML=e,a.content.firstChild},o=()=>(r||(r=i())).cloneNode(!0);return o.cloneNode=o,o}function iP(e,t=window.document){const n=t[pf]||(t[pf]=new Set);for(let r=0,i=e.length;r<i;r++){const o=e[r];n.has(o)||(n.add(o),t.addEventListener(o,Doe))}}function aHe(e=window.document){if(e[pf]){for(let t of e[pf].keys())e.removeEventListener(t,Doe);delete e[pf]}}function $e(e,t,n){zt.context&&e.isConnected||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function sHe(e,t,n,r){zt.context&&e.isConnected||(r==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,r))}function He(e,t){zt.context&&e.isConnected||(t==null?e.removeAttribute("class"):e.className=t)}function Ioe(e,t,n,r){if(r)Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n;else if(Array.isArray(n)){const i=n[0];e.addEventListener(t,n[0]=o=>i.call(e,n[1],o))}else e.addEventListener(t,n)}function lHe(e,t,n={}){const r=Object.keys(t||{}),i=Object.keys(n);let o,a;for(o=0,a=i.length;o<a;o++){const s=i[o];!s||s==="undefined"||t[s]||(Eoe(e,s,!1),delete n[s])}for(o=0,a=r.length;o<a;o++){const s=r[o],l=!!t[s];!s||s==="undefined"||n[s]===l||!l||(Eoe(e,s,!0),n[s]=l)}return n}function cHe(e,t,n){if(!t)return n?$e(e,"style"):t;const r=e.style;if(typeof t=="string")return r.cssText=t;typeof n=="string"&&(r.cssText=n=void 0),n||(n={}),t||(t={});let i,o;for(o in n)t[o]==null&&r.removeProperty(o),delete n[o];for(o in t)i=t[o],i!==n[o]&&(r.setProperty(o,i),n[o]=i);return n}function Loe(e,t={},n,r){const i={};return r||ct(()=>i.children=ff(e,t.children,i.children)),ct(()=>typeof t.ref=="function"&&hf(t.ref,e)),ct(()=>uHe(e,t,n,!0,i,!0)),i}function hf(e,t,n){return jn(()=>e(t,n))}function Te(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!="function")return ff(e,t,r,n);ct(i=>ff(e,t(),i,n),r)}function uHe(e,t,n,r,i={},o=!1){t||(t={});for(const a in i)if(!(a in t)){if(a==="children")continue;i[a]=Aoe(e,a,null,i[a],n,o)}for(const a in t){if(a==="children")continue;const s=t[a];i[a]=Aoe(e,a,s,i[a],n,o)}}function dHe(e){let t,n;return!zt.context||!(t=zt.registry.get(n=hHe()))?e():(zt.completed&&zt.completed.add(t),zt.registry.delete(n),t)}function pHe(e){return e.toLowerCase().replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function Eoe(e,t,n){const r=t.trim().split(/\s+/);for(let i=0,o=r.length;i<o;i++)e.classList.toggle(r[i],n)}function Aoe(e,t,n,r,i,o){let a,s,l,d,p;if(t==="style")return cHe(e,n,r);if(t==="classList")return lHe(e,n,r);if(n===r)return r;if(t==="ref")o||n(e);else if(t.slice(0,3)==="on:"){const h=t.slice(3);r&&e.removeEventListener(h,r),n&&e.addEventListener(h,n)}else if(t.slice(0,10)==="oncapture:"){const h=t.slice(10);r&&e.removeEventListener(h,r,!0),n&&e.addEventListener(h,n,!0)}else if(t.slice(0,2)==="on"){const h=t.slice(2).toLowerCase(),f=tHe.has(h);if(!f&&r){const m=Array.isArray(r)?r[0]:r;e.removeEventListener(h,m)}(f||n)&&(Ioe(e,h,n,f),f&&iP([h]))}else if(t.slice(0,5)==="attr:")$e(e,t.slice(5),n);else if((p=t.slice(0,5)==="prop:")||(l=XRe.has(t))||!i&&((d=eHe(t,e.tagName))||(s=ZRe.has(t)))||(a=e.nodeName.includes("-"))){if(p)t=t.slice(5),s=!0;else if(zt.context&&e.isConnected)return n;t==="class"||t==="className"?He(e,n):a&&!s&&!l?e[pHe(t)]=n:e[d||t]=n}else{const h=i&&t.indexOf(":")>-1&&rHe[t.split(":")[0]];h?sHe(e,h,t,n):$e(e,QRe[t]||t,n)}return n}function Doe(e){const t=`$$${e.type}`;let n=e.composedPath&&e.composedPath()[0]||e.target;for(e.target!==n&&Object.defineProperty(e,"target",{configurable:!0,value:n}),Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return n||document}}),zt.registry&&!zt.done&&(zt.done=_$HY.done=!0);n;){const r=n[t];if(r&&!n.disabled){const i=n[`${t}Data`];if(i!==void 0?r.call(n,i,e):r.call(n,e),e.cancelBubble)return}n=n._$host||n.parentNode||n.host}}function ff(e,t,n,r,i){const o=!!zt.context&&e.isConnected;if(o){!n&&(n=[...e.childNodes]);let l=[];for(let d=0;d<n.length;d++){const p=n[d];p.nodeType===8&&p.data.slice(0,2)==="!$"?p.remove():l.push(p)}n=l}for(;typeof n=="function";)n=n();if(t===n)return n;const a=typeof t,s=r!==void 0;if(e=s&&n[0]&&n[0].parentNode||e,a==="string"||a==="number"){if(o||a==="number"&&(t=t.toString(),t===n))return n;if(s){let l=n[0];l&&l.nodeType===3?l.data!==t&&(l.data=t):l=document.createTextNode(t),n=f2(e,n,r,l)}else n!==""&&typeof n=="string"?n=e.firstChild.data=t:n=e.textContent=t}else if(t==null||a==="boolean"){if(o)return n;n=f2(e,n,r)}else{if(a==="function")return ct(()=>{let l=t();for(;typeof l=="function";)l=l();n=ff(e,l,n,r)}),()=>n;if(Array.isArray(t)){const l=[],d=n&&Array.isArray(n);if(eq(l,t,n,i))return ct(()=>n=ff(e,l,n,r,!0)),()=>n;if(o){if(!l.length)return n;if(r===void 0)return[...e.childNodes];let p=l[0],h=[p];for(;(p=p.nextSibling)!==r;)h.push(p);return n=h}if(l.length===0){if(n=f2(e,n,r),s)return n}else d?n.length===0?Toe(e,l,r):iHe(e,n,l):(n&&f2(e),Toe(e,l));n=l}else if(t.nodeType){if(o&&t.parentNode)return n=s?[t]:t;if(Array.isArray(n)){if(s)return n=f2(e,n,r,t);f2(e,n,null,t)}else n==null||n===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}}return n}function eq(e,t,n,r){let i=!1;for(let o=0,a=t.length;o<a;o++){let s=t[o],l=n&&n[e.length],d;if(!(s==null||s===!0||s===!1))if((d=typeof s)=="object"&&s.nodeType)e.push(s);else if(Array.isArray(s))i=eq(e,s,l)||i;else if(d==="function")if(r){for(;typeof s=="function";)s=s();i=eq(e,Array.isArray(s)?s:[s],Array.isArray(l)?l:[l])||i}else e.push(s),i=!0;else{const p=String(s);l&&l.nodeType===3&&l.data===p?e.push(l):e.push(document.createTextNode(p))}}return i}function Toe(e,t,n=null){for(let r=0,i=t.length;r<i;r++)e.insertBefore(t[r],n)}function f2(e,t,n,r){if(n===void 0)return e.textContent="";const i=r||document.createTextNode("");if(t.length){let o=!1;for(let a=t.length-1;a>=0;a--){const s=t[a];if(i!==s){const l=s.parentNode===e;!o&&!a?l?e.replaceChild(i,s):e.insertBefore(i,n):l&&s.remove()}else o=!0}}else e.insertBefore(i,n);return[i]}function hHe(){return zt.getNextContextId()}var fHe="http://www.w3.org/2000/svg";function Noe(e,t=!1){return t?document.createElementNS(fHe,e):document.createElement(e)}function Foe(e){const{useShadow:t}=e,n=document.createTextNode(""),r=()=>e.mount||document.body,i=voe();let o,a=!!zt.context;return rt(()=>{a&&(voe().user=a=!1),o||(o=NRe(i,()=>Ee(()=>e.children)));const s=r();if(s instanceof HTMLHeadElement){const[l,d]=Ge(!1),p=()=>d(!0);Ua(h=>Te(s,()=>l()?h():o(),null)),ut(p)}else{const l=Noe(e.isSVG?"g":"div",e.isSVG),d=t&&l.attachShadow?l.attachShadow({mode:"open"}):l;Object.defineProperty(l,"_$host",{get(){return n.parentNode},configurable:!0}),Te(d,o),s.appendChild(l),e.ref&&e.ref(l),ut(()=>s.removeChild(l))}},void 0,{render:!a}),n}function mHe(e){const[t,n]=cn(e,["component"]),r=Ee(()=>t.component);return Ee(()=>{const i=r();switch(typeof i){case"function":return jn(()=>i(n));case"string":const o=nHe.has(i),a=zt.context?dHe():Noe(i,o);return Loe(a,n,o),a}})}var gHe=class{constructor(){this.keyToValue=new Map,this.valueToKey=new Map}set(e,t){this.keyToValue.set(e,t),this.valueToKey.set(t,e)}getByKey(e){return this.keyToValue.get(e)}getByValue(e){return this.valueToKey.get(e)}clear(){this.keyToValue.clear(),this.valueToKey.clear()}},$oe=class{constructor(e){this.generateIdentifier=e,this.kv=new gHe}register(e,t){this.kv.getByValue(e)||(t||(t=this.generateIdentifier(e)),this.kv.set(t,e))}clear(){this.kv.clear()}getIdentifier(e){return this.kv.getByValue(e)}getValue(e){return this.kv.getByKey(e)}},yHe=class extends $oe{constructor(){super(e=>e.name),this.classToAllowedProps=new Map}register(e,t){typeof t=="object"?(t.allowProps&&this.classToAllowedProps.set(e,t.allowProps),super.register(e,t.identifier)):super.register(e,t)}getAllowedProps(e){return this.classToAllowedProps.get(e)}};function bHe(e){if("values"in Object)return Object.values(e);const t=[];for(const n in e)e.hasOwnProperty(n)&&t.push(e[n]);return t}function vHe(e,t){const n=bHe(e);if("find"in n)return n.find(t);const r=n;for(let i=0;i<r.length;i++){const o=r[i];if(t(o))return o}}function m2(e,t){Object.entries(e).forEach(([n,r])=>t(r,n))}function oP(e,t){return e.indexOf(t)!==-1}function Poe(e,t){for(let n=0;n<e.length;n++){const r=e[n];if(t(r))return r}}var xHe=class{constructor(){this.transfomers={}}register(e){this.transfomers[e.name]=e}findApplicable(e){return vHe(this.transfomers,t=>t.isApplicable(e))}findByName(e){return this.transfomers[e]}},wHe=e=>Object.prototype.toString.call(e).slice(8,-1),Ooe=e=>typeof e>"u",kHe=e=>e===null,mf=e=>typeof e!="object"||e===null||e===Object.prototype?!1:Object.getPrototypeOf(e)===null?!0:Object.getPrototypeOf(e)===Object.prototype,tq=e=>mf(e)&&Object.keys(e).length===0,_s=e=>Array.isArray(e),CHe=e=>typeof e=="string",SHe=e=>typeof e=="number"&&!isNaN(e),MHe=e=>typeof e=="boolean",IHe=e=>e instanceof RegExp,gf=e=>e instanceof Map,yf=e=>e instanceof Set,joe=e=>wHe(e)==="Symbol",LHe=e=>e instanceof Date&&!isNaN(e.valueOf()),EHe=e=>e instanceof Error,zoe=e=>typeof e=="number"&&isNaN(e),AHe=e=>MHe(e)||kHe(e)||Ooe(e)||SHe(e)||CHe(e)||joe(e),DHe=e=>typeof e=="bigint",THe=e=>e===1/0||e===-1/0,NHe=e=>ArrayBuffer.isView(e)&&!(e instanceof DataView),FHe=e=>e instanceof URL,_oe=e=>e.replace(/\./g,"\\."),nq=e=>e.map(String).map(_oe).join("."),bf=e=>{const t=[];let n="";for(let i=0;i<e.length;i++){let o=e.charAt(i);if(o==="\\"&&e.charAt(i+1)==="."){n+=".",i++;continue}if(o==="."){t.push(n),n="";continue}n+=o}const r=n;return t.push(r),t};function ca(e,t,n,r){return{isApplicable:e,annotation:t,transform:n,untransform:r}}var Roe=[ca(Ooe,"undefined",()=>null,()=>{}),ca(DHe,"bigint",e=>e.toString(),e=>typeof BigInt<"u"?BigInt(e):e),ca(LHe,"Date",e=>e.toISOString(),e=>new Date(e)),ca(EHe,"Error",(e,t)=>{const n={name:e.name,message:e.message};return t.allowedErrorProps.forEach(r=>{n[r]=e[r]}),n},(e,t)=>{const n=new Error(e.message);return n.name=e.name,n.stack=e.stack,t.allowedErrorProps.forEach(r=>{n[r]=e[r]}),n}),ca(IHe,"regexp",e=>""+e,e=>{const t=e.slice(1,e.lastIndexOf("/")),n=e.slice(e.lastIndexOf("/")+1);return new RegExp(t,n)}),ca(yf,"set",e=>[...e.values()],e=>new Set(e)),ca(gf,"map",e=>[...e.entries()],e=>new Map(e)),ca(e=>zoe(e)||THe(e),"number",e=>zoe(e)?"NaN":e>0?"Infinity":"-Infinity",Number),ca(e=>e===0&&1/e===-1/0,"number",()=>"-0",Number),ca(FHe,"URL",e=>e.toString(),e=>new URL(e))];function aP(e,t,n,r){return{isApplicable:e,annotation:t,transform:n,untransform:r}}var Hoe=aP((e,t)=>joe(e)?!!t.symbolRegistry.getIdentifier(e):!1,(e,t)=>["symbol",t.symbolRegistry.getIdentifier(e)],e=>e.description,(e,t,n)=>{const r=n.symbolRegistry.getValue(t[1]);if(!r)throw new Error("Trying to deserialize unknown symbol");return r}),$He=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((e,t)=>(e[t.name]=t,e),{}),qoe=aP(NHe,e=>["typed-array",e.constructor.name],e=>[...e],(e,t)=>{const n=$He[t[1]];if(!n)throw new Error("Trying to deserialize unknown typed array");return new n(e)});function Boe(e,t){return e!=null&&e.constructor?!!t.classRegistry.getIdentifier(e.constructor):!1}var Voe=aP(Boe,(e,t)=>["class",t.classRegistry.getIdentifier(e.constructor)],(e,t)=>{const n=t.classRegistry.getAllowedProps(e.constructor);if(!n)return{...e};const r={};return n.forEach(i=>{r[i]=e[i]}),r},(e,t,n)=>{const r=n.classRegistry.getValue(t[1]);if(!r)throw new Error("Trying to deserialize unknown class - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564");return Object.assign(Object.create(r.prototype),e)}),Uoe=aP((e,t)=>!!t.customTransformerRegistry.findApplicable(e),(e,t)=>["custom",t.customTransformerRegistry.findApplicable(e).name],(e,t)=>t.customTransformerRegistry.findApplicable(e).serialize(e),(e,t,n)=>{const r=n.customTransformerRegistry.findByName(t[1]);if(!r)throw new Error("Trying to deserialize unknown custom value");return r.deserialize(e)}),PHe=[Voe,Hoe,Uoe,qoe],Goe=(e,t)=>{const n=Poe(PHe,i=>i.isApplicable(e,t));if(n)return{value:n.transform(e,t),type:n.annotation(e,t)};const r=Poe(Roe,i=>i.isApplicable(e,t));if(r)return{value:r.transform(e,t),type:r.annotation}},Woe={};Roe.forEach(e=>{Woe[e.annotation]=e});var OHe=(e,t,n)=>{if(_s(t))switch(t[0]){case"symbol":return Hoe.untransform(e,t,n);case"class":return Voe.untransform(e,t,n);case"custom":return Uoe.untransform(e,t,n);case"typed-array":return qoe.untransform(e,t,n);default:throw new Error("Unknown transformation: "+t)}else{const r=Woe[t];if(!r)throw new Error("Unknown transformation: "+t);return r.untransform(e,n)}},g2=(e,t)=>{const n=e.keys();for(;t>0;)n.next(),t--;return n.next().value};function Koe(e){if(oP(e,"__proto__"))throw new Error("__proto__ is not allowed as a property");if(oP(e,"prototype"))throw new Error("prototype is not allowed as a property");if(oP(e,"constructor"))throw new Error("constructor is not allowed as a property")}var jHe=(e,t)=>{Koe(t);for(let n=0;n<t.length;n++){const r=t[n];if(yf(e))e=g2(e,+r);else if(gf(e)){const i=+r,o=+t[++n]==0?"key":"value",a=g2(e,i);switch(o){case"key":e=a;break;case"value":e=e.get(a);break}}else e=e[r]}return e},rq=(e,t,n)=>{if(Koe(t),t.length===0)return n(e);let r=e;for(let o=0;o<t.length-1;o++){const a=t[o];if(_s(r)){const s=+a;r=r[s]}else if(mf(r))r=r[a];else if(yf(r)){const s=+a;r=g2(r,s)}else if(gf(r)){if(o===t.length-2)break;const l=+a,d=+t[++o]==0?"key":"value",p=g2(r,l);switch(d){case"key":r=p;break;case"value":r=r.get(p);break}}}const i=t[t.length-1];if(_s(r)?r[+i]=n(r[+i]):mf(r)&&(r[i]=n(r[i])),yf(r)){const o=g2(r,+i),a=n(o);o!==a&&(r.delete(o),r.add(a))}if(gf(r)){const o=+t[t.length-2],a=g2(r,o);switch(+i==0?"key":"value"){case"key":{const l=n(a);r.set(l,r.get(a)),l!==a&&r.delete(a);break}case"value":{r.set(a,n(r.get(a)));break}}}return e};function iq(e,t,n=[]){if(!e)return;if(!_s(e)){m2(e,(o,a)=>iq(o,t,[...n,...bf(a)]));return}const[r,i]=e;i&&m2(i,(o,a)=>{iq(o,t,[...n,...bf(a)])}),t(r,n)}function zHe(e,t,n){return iq(t,(r,i)=>{e=rq(e,i,o=>OHe(o,r,n))}),e}function _He(e,t){function n(r,i){const o=jHe(e,bf(i));r.map(bf).forEach(a=>{e=rq(e,a,()=>o)})}if(_s(t)){const[r,i]=t;r.forEach(o=>{e=rq(e,bf(o),()=>e)}),i&&m2(i,n)}else m2(t,n);return e}var RHe=(e,t)=>mf(e)||_s(e)||gf(e)||yf(e)||Boe(e,t);function HHe(e,t,n){const r=n.get(e);r?r.push(t):n.set(e,[t])}function qHe(e,t){const n={};let r;return e.forEach(i=>{if(i.length<=1)return;t||(i=i.map(s=>s.map(String)).sort((s,l)=>s.length-l.length));const[o,...a]=i;o.length===0?r=a.map(nq):n[nq(o)]=a.map(nq)}),r?tq(n)?[r]:[r,n]:tq(n)?void 0:n}var Yoe=(e,t,n,r,i=[],o=[],a=new Map)=>{const s=AHe(e);if(!s){HHe(e,i,t);const m=a.get(e);if(m)return r?{transformedValue:null}:m}if(!RHe(e,n)){const m=Goe(e,n),b=m?{transformedValue:m.value,annotations:[m.type]}:{transformedValue:e};return s||a.set(e,b),b}if(oP(o,e))return{transformedValue:null};const l=Goe(e,n),d=(l==null?void 0:l.value)??e,p=_s(d)?[]:{},h={};m2(d,(m,b)=>{if(b==="__proto__"||b==="constructor"||b==="prototype")throw new Error(`Detected property ${b}. This is a prototype pollution risk, please remove it from your object.`);const y=Yoe(m,t,n,r,[...i,b],[...o,e],a);p[b]=y.transformedValue,_s(y.annotations)?h[b]=y.annotations:mf(y.annotations)&&m2(y.annotations,(v,x)=>{h[_oe(b)+"."+x]=v})});const f=tq(h)?{transformedValue:p,annotations:l?[l.type]:void 0}:{transformedValue:p,annotations:l?[l.type,h]:h};return s||a.set(e,f),f};function Zoe(e){return Object.prototype.toString.call(e).slice(8,-1)}function Xoe(e){return Zoe(e)==="Array"}function BHe(e){if(Zoe(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return!!t&&t.constructor===Object&&t===Object.prototype}function VHe(e,t,n,r,i){const o={}.propertyIsEnumerable.call(r,t)?"enumerable":"nonenumerable";o==="enumerable"&&(e[t]=n),i&&o==="nonenumerable"&&Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})}function oq(e,t={}){if(Xoe(e))return e.map(i=>oq(i,t));if(!BHe(e))return e;const n=Object.getOwnPropertyNames(e),r=Object.getOwnPropertySymbols(e);return[...n,...r].reduce((i,o)=>{if(Xoe(t.props)&&!t.props.includes(o))return i;const a=e[o],s=oq(a,t);return VHe(i,o,s,e,t.nonenumerable),i},{})}var yn=class{constructor({dedupe:e=!1}={}){this.classRegistry=new yHe,this.symbolRegistry=new $oe(t=>t.description??""),this.customTransformerRegistry=new xHe,this.allowedErrorProps=[],this.dedupe=e}serialize(e){const t=new Map,n=Yoe(e,t,this,this.dedupe),r={json:n.transformedValue};n.annotations&&(r.meta={...r.meta,values:n.annotations});const i=qHe(t,this.dedupe);return i&&(r.meta={...r.meta,referentialEqualities:i}),r}deserialize(e){const{json:t,meta:n}=e;let r=oq(t);return n!=null&&n.values&&(r=zHe(r,n.values,this)),n!=null&&n.referentialEqualities&&(r=_He(r,n.referentialEqualities)),r}stringify(e){return JSON.stringify(this.serialize(e))}parse(e){return this.deserialize(JSON.parse(e))}registerClass(e,t){this.classRegistry.register(e,t)}registerSymbol(e,t){this.symbolRegistry.register(e,t)}registerCustom(e,t){this.customTransformerRegistry.register({name:t,...e})}allowErrorProps(...e){this.allowedErrorProps.push(...e)}};yn.defaultInstance=new yn,yn.serialize=yn.defaultInstance.serialize.bind(yn.defaultInstance),yn.deserialize=yn.defaultInstance.deserialize.bind(yn.defaultInstance),yn.stringify=yn.defaultInstance.stringify.bind(yn.defaultInstance),yn.parse=yn.defaultInstance.parse.bind(yn.defaultInstance),yn.registerClass=yn.defaultInstance.registerClass.bind(yn.defaultInstance),yn.registerSymbol=yn.defaultInstance.registerSymbol.bind(yn.defaultInstance),yn.registerCustom=yn.defaultInstance.registerCustom.bind(yn.defaultInstance),yn.allowErrorProps=yn.defaultInstance.allowErrorProps.bind(yn.defaultInstance);var UHe=yn.serialize,GHe=yn.stringify;function y2(e){return e.state.fetchStatus==="fetching"?"fetching":e.getObserversCount()?e.state.fetchStatus==="paused"?"paused":e.isStale()?"stale":"fresh":"inactive"}function WHe(e,t){return`${e}${t.charAt(0).toUpperCase()+t.slice(1)}`}function KHe({queryState:e,observerCount:t,isStale:n}){return e.fetchStatus==="fetching"?"blue":t?e.fetchStatus==="paused"?"purple":n?"yellow":"green":"gray"}function b2({status:e,isPaused:t}){return t?"purple":e==="error"?"red":e==="pending"?"yellow":e==="success"?"green":"gray"}function YHe(e){return e==="fresh"?"green":e==="stale"?"yellow":e==="paused"?"purple":e==="inactive"?"gray":"blue"}var sP=(e,t=!1)=>{const{json:n}=UHe(e);return JSON.stringify(n,null,t?2:void 0)},lP=e=>e.state.fetchStatus!=="idle"?0:e.getObserversCount()?e.isStale()?2:1:3,ZHe=(e,t)=>e.queryHash.localeCompare(t.queryHash),Qoe=(e,t)=>e.state.dataUpdatedAt<t.state.dataUpdatedAt?1:-1,XHe=(e,t)=>lP(e)===lP(t)?Qoe(e,t):lP(e)>lP(t)?1:-1,aq={status:XHe,"query hash":ZHe,"last updated":Qoe},cP=e=>e.state.isPaused?0:e.state.status==="error"?2:e.state.status==="pending"?1:3,Joe=(e,t)=>e.state.submittedAt<t.state.submittedAt?1:-1,QHe=(e,t)=>cP(e)===cP(t)?Joe(e,t):cP(e)>cP(t)?1:-1,sq={status:QHe,"last updated":Joe},eae=e=>e*parseFloat(getComputedStyle(document.documentElement).fontSize),JHe=()=>{const[e,t]=Ge("dark");return l1(()=>{const n=window.matchMedia("(prefers-color-scheme: dark)");t(n.matches?"dark":"light");const r=i=>{t(i.matches?"dark":"light")};n.addEventListener("change",r),ut(()=>n.removeEventListener("change",r))}),e},c1=(e,t,n)=>{if(t.length===0)return n;if(e instanceof Map){const r=new Map(e);if(t.length===1)return r.set(t[0],n),r;const[i,...o]=t;return r.set(i,c1(r.get(i),o,n)),r}if(e instanceof Set){const r=c1(Array.from(e),t,n);return new Set(r)}if(Array.isArray(e)){const r=[...e];if(t.length===1)return r[t[0]]=n,r;const[i,...o]=t;return r[i]=c1(r[i],o,n),r}if(e instanceof Object){const r={...e};if(t.length===1)return r[t[0]]=n,r;const[i,...o]=t;return r[i]=c1(r[i],o,n),r}return e},vf=(e,t)=>{if(e instanceof Map){const n=new Map(e);if(t.length===1)return n.delete(t[0]),n;const[r,...i]=t;return n.set(r,vf(n.get(r),i)),n}if(e instanceof Set){const n=vf(Array.from(e),t);return new Set(n)}if(Array.isArray(e)){const n=[...e];if(t.length===1)return n.filter((o,a)=>a.toString()!==t[0]);const[r,...i]=t;return n[r]=vf(n[r],i),n}if(e instanceof Object){const n={...e};if(t.length===1)return delete n[t[0]],n;const[r,...i]=t;return n[r]=vf(n[r],i),n}return e},eqe=(e,t)=>{if(!e||document.querySelector("#_goober")||(t==null?void 0:t.querySelector("#_goober")))return;const r=document.createElement("style"),i=document.createTextNode("");r.appendChild(i),r.id="_goober",r.setAttribute("nonce",e),t?t.appendChild(r):document.head.appendChild(r)},tqe=(Hle=class{constructor(e){Xe(this,q2);Xe(this,qf);Xe(this,Bf);Xe(this,Vf);Xe(this,C1,!1);Xe(this,Uf);Xe(this,B2);Xe(this,V2);Xe(this,U2);Xe(this,G2);Xe(this,W2);Xe(this,K2);Xe(this,Gf);const{client:t,queryFlavor:n,version:r,onlineManager:i,buttonPosition:o,position:a,initialIsOpen:s,errorTypes:l,styleNonce:d,shadowDOMTarget:p}=e;Oe(this,q2,Ge(t)),Oe(this,Bf,n),Oe(this,Vf,r),Oe(this,qf,i),Oe(this,Uf,d),Oe(this,B2,p),Oe(this,V2,Ge(o)),Oe(this,U2,Ge(a)),Oe(this,G2,Ge(s)),Oe(this,W2,Ge(l))}setButtonPosition(e){te(this,V2)[1](e)}setPosition(e){te(this,U2)[1](e)}setInitialIsOpen(e){te(this,G2)[1](e)}setErrorTypes(e){te(this,W2)[1](e)}setClient(e){te(this,q2)[1](e)}mount(e){if(te(this,C1))throw new Error("Devtools is already mounted");const t=oHe(()=>{const n=this,[r]=te(this,V2),[i]=te(this,U2),[o]=te(this,G2),[a]=te(this,W2),[s]=te(this,q2);let l;return te(this,K2)?l=te(this,K2):(l=VRe(()=>Promise.resolve().then(()=>_We)),Oe(this,K2,l)),eqe(te(this,Uf),te(this,B2)),ie(l,Dt({get queryFlavor(){return te(n,Bf)},get version(){return te(n,Vf)},get onlineManager(){return te(n,qf)},get shadowDOMTarget(){return te(n,B2)}},{get client(){return s()},get buttonPosition(){return r()},get position(){return i()},get initialIsOpen(){return o()},get errorTypes(){return a()}}))},e);Oe(this,C1,!0),Oe(this,Gf,t)}unmount(){var e;if(!te(this,C1))throw new Error("Devtools is not mounted");(e=te(this,Gf))==null||e.call(this),Oe(this,C1,!1)}},q2=new WeakMap,qf=new WeakMap,Bf=new WeakMap,Vf=new WeakMap,C1=new WeakMap,Uf=new WeakMap,B2=new WeakMap,V2=new WeakMap,U2=new WeakMap,G2=new WeakMap,W2=new WeakMap,K2=new WeakMap,Gf=new WeakMap,Hle);function nqe(e){const t=Bi(e.client),n=k.useRef(null),{buttonPosition:r,position:i,initialIsOpen:o,errorTypes:a,styleNonce:s,shadowDOMTarget:l}=e,[d]=k.useState(new tqe({client:t,queryFlavor:"React Query",version:"5",onlineManager:O0,buttonPosition:r,position:i,initialIsOpen:o,errorTypes:a,styleNonce:s,shadowDOMTarget:l}));return k.useEffect(()=>{d.setClient(t)},[t,d]),k.useEffect(()=>{r&&d.setButtonPosition(r)},[r,d]),k.useEffect(()=>{i&&d.setPosition(i)},[i,d]),k.useEffect(()=>{d.setInitialIsOpen(o||!1)},[o,d]),k.useEffect(()=>{d.setErrorTypes(a||[])},[a,d]),k.useEffect(()=>(n.current&&d.mount(n.current),()=>{d.unmount()}),[d]),u.jsx("div",{className:"tsqd-parent-container",ref:n})}var rqe=nqe;const iqe=Object.freeze(Object.defineProperty({__proto__:null,ReactQueryDevtools:rqe},Symbol.toStringTag,{value:"Module"})),tae="[a-fA-F\\d:]",Rs=e=>e&&e.includeBoundaries?`(?:(?<=\\s|^)(?=${tae})|(?<=${tae})(?=\\s|$))`:"",Eo="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",Xn="[a-fA-F\\d]{1,4}",uP=`
7784
7784
  (?:
7785
7785
  (?:${Xn}:){7}(?:${Xn}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8
7786
7786
  (?:${Xn}:){6}(?:${Eo}|:${Xn}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jpmorgan-payments/embedded-finance-components",
3
- "version": "0.6.21",
3
+ "version": "0.6.22",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "description": "Embedded Finance Components",