Files
Investidor-V2/outputs/investmoz-navegacao-QA-20261016/DOC01/rollback/public/build/assets/security-lCWO89N4.js
T
nala cef6e201c7
tests / ci (push) Canceled after 0s
versao nrgocios 2
2026-10-16 20:11:05 +02:00

1 line
31 KiB
JavaScript

import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{n as t,t as n,u as r}from"./dist-BHykSMWQ.js";import{n as i,t as a}from"./jsx-runtime-BpzPEenQ.js";import{t as o}from"./compiler-runtime-sKsOXjDo.js";import{n as s,t as c}from"./button-DAU4R6e9.js";import{t as l}from"./utils-CCDJ05Ll.js";import{t as u}from"./createLucideIcon-oMeAlXbs.js";import{t as d}from"./check-PcBNn_NG.js";import{n as f,r as p,t as m}from"./password-input-BnSDL8ce.js";import{n as h,r as g}from"./react-mlFDtEmO.js";import{a as _,c as v,i as y,l as b,n as x,r as S,s as C,t as w,u as T}from"./use-two-factor-auth-Dv2TBEg_.js";import{n as E,t as D}from"./wayfinder-Dp7PqxvV.js";import{C as O,b as k,r as A,t as j}from"./app-DHQVsCWJ.js";import{t as M}from"./input-error-U1QKS0ED.js";import{t as N}from"./label-uPFpYsdE.js";import{t as P}from"./spinner-hD8hHC_m.js";import{a as ee,c as te,i as F,n as ne,o as re,r as I,s as L,t as R}from"./dialog-DtrbPIkg.js";var ie=u(`CircleAlert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),ae=u(`Copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),oe=u(`LockKeyhole`,[[`circle`,{cx:`12`,cy:`16`,r:`1`,key:`1au0dj`}],[`rect`,{x:`3`,y:`10`,width:`18`,height:`12`,rx:`2`,key:`6s8ecr`}],[`path`,{d:`M7 10V7a5 5 0 0 1 10 0v3`,key:`1pqi11`}]]),se=u(`RefreshCw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),ce=u(`ScanLine`,[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`path`,{d:`M7 12h10`,key:`b7w52i`}]]),le=u(`ShieldCheck`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),ue=u(`Trash2`,[[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`,key:`4alrt4`}],[`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`,key:`v07s0e`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`,key:`1uufr5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`,key:`xtxkd`}]]),z=e(i(),1),B=o(),V=e=>({url:V.url(e),method:`get`});V.definition={methods:[`get`,`head`],url:`/settings/security`},V.url=e=>V.definition.url+E(e),V.get=e=>({url:V.url(e),method:`get`}),V.head=e=>({url:V.url(e),method:`head`});var H=e=>({action:V.url(e),method:`get`});H.get=e=>({action:V.url(e),method:`get`}),H.head=e=>({action:V.url({[e?.mergeQuery?`mergeQuery`:`query`]:{_method:`HEAD`,...e?.query??e?.mergeQuery??{}}}),method:`get`}),V.form=H;var U=e=>({url:U.url(e),method:`put`});U.definition={methods:[`put`],url:`/settings/password`},U.url=e=>U.definition.url+E(e),U.put=e=>({url:U.url(e),method:`put`});var W=e=>({action:U.url({[e?.mergeQuery?`mergeQuery`:`query`]:{_method:`PUT`,...e?.query??e?.mergeQuery??{}}}),method:`post`});W.put=e=>({action:U.url({[e?.mergeQuery?`mergeQuery`:`query`]:{_method:`PUT`,...e?.query??e?.mergeQuery??{}}}),method:`post`}),U.form=W;var de={edit:V,update:U},G=e=>({url:G.url(e),method:`get`});G.definition={methods:[`get`,`head`],url:`/user/passkeys/options`},G.url=e=>G.definition.url+E(e),G.get=e=>({url:G.url(e),method:`get`}),G.head=e=>({url:G.url(e),method:`head`});var K=e=>({action:G.url(e),method:`get`});K.get=e=>({action:G.url(e),method:`get`}),K.head=e=>({action:G.url({[e?.mergeQuery?`mergeQuery`:`query`]:{_method:`HEAD`,...e?.query??e?.mergeQuery??{}}}),method:`get`}),G.form=K;var q=e=>({url:q.url(e),method:`post`});q.definition={methods:[`post`],url:`/user/passkeys`},q.url=e=>q.definition.url+E(e),q.post=e=>({url:q.url(e),method:`post`});var J=e=>({action:q.url(e),method:`post`});J.post=e=>({action:q.url(e),method:`post`}),q.form=J;var Y=(e,t)=>({url:Y.url(e,t),method:`delete`});Y.definition={methods:[`delete`],url:`/user/passkeys/{passkey}`},Y.url=(e,t)=>{(typeof e==`string`||typeof e==`number`)&&(e={passkey:e}),typeof e==`object`&&!Array.isArray(e)&&`id`in e&&(e={passkey:e.id}),Array.isArray(e)&&(e={passkey:e[0]}),e=D(e);let n={passkey:typeof e.passkey==`object`?e.passkey.id:e.passkey};return Y.definition.url.replace(`{passkey}`,n.passkey.toString()).replace(/\/+$/,``)+E(t)},Y.delete=(e,t)=>({url:Y.url(e,t),method:`delete`});var X=(e,t)=>({action:Y.url(e,{[t?.mergeQuery?`mergeQuery`:`query`]:{_method:`DELETE`,...t?.query??t?.mergeQuery??{}}}),method:`post`});X.delete=(e,t)=>({action:Y.url(e,{[t?.mergeQuery?`mergeQuery`:`query`]:{_method:`DELETE`,...t?.query??t?.mergeQuery??{}}}),method:`post`}),Y.form=X;var Z=a();function fe(e){let t=(0,B.c)(34),{passkey:n,onDelete:r}=e,[i,a]=(0,z.useState)(!1),o;t[0]!==r||t[1]!==n.id?(o=()=>{a(!0),r(n.id,()=>a(!1))},t[0]=r,t[1]=n.id,t[2]=o):o=t[2];let s=o,l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`div`,{className:`bg-muted flex h-10 w-10 shrink-0 items-center justify-center rounded-xl`,children:(0,Z.jsx)(g,{className:`text-muted-foreground h-5 w-5`})}),t[3]=l):l=t[3];let u;t[4]===n.name?u=t[5]:(u=(0,Z.jsx)(`p`,{className:`font-medium tracking-tight`,children:n.name}),t[4]=n.name,t[5]=u);let d;t[6]===n.authenticator?d=t[7]:(d=n.authenticator&&(0,Z.jsx)(`span`,{className:`bg-muted text-muted-foreground ring-border inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-[11px] font-medium tracking-wide uppercase ring-1 ring-inset`,children:n.authenticator}),t[6]=n.authenticator,t[7]=d);let f;t[8]!==u||t[9]!==d?(f=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[u,d]}),t[8]=u,t[9]=d,t[10]=f):f=t[10];let p;t[11]===n.last_used_at_diff?p=t[12]:(p=n.last_used_at_diff&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`text-muted-foreground/50 mx-1`,children:`/`}),`Last used `,n.last_used_at_diff]}),t[11]=n.last_used_at_diff,t[12]=p);let m;t[13]!==n.created_at_diff||t[14]!==p?(m=(0,Z.jsxs)(`p`,{className:`text-muted-foreground text-sm`,children:[`Added `,n.created_at_diff,p]}),t[13]=n.created_at_diff,t[14]=p,t[15]=m):m=t[15];let h;t[16]!==f||t[17]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex items-center gap-4`,children:[l,(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[f,m]})]}),t[16]=f,t[17]=m,t[18]=h):h=t[18];let _;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(te,{asChild:!0,children:(0,Z.jsxs)(c,{variant:`ghost`,size:`sm`,className:`text-destructive hover:bg-destructive/10 hover:text-destructive`,children:[(0,Z.jsx)(ue,{className:`h-4 w-4`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`Remove`})]})}),t[19]=_):_=t[19];let v;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(L,{children:`Remove passkey`}),t[20]=v):v=t[20];let y;t[21]===n.name?y=t[22]:(y=(0,Z.jsxs)(F,{children:[`Are you sure you want to remove the "`,n.name,`" passkey? You will no longer be able to use it to sign in.`]}),t[21]=n.name,t[22]=y);let b;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(ne,{asChild:!0,children:(0,Z.jsx)(c,{variant:`secondary`,children:`Cancel`})}),t[23]=b):b=t[23];let x=i?`Removing...`:`Remove passkey`,S;t[24]!==s||t[25]!==i||t[26]!==x?(S=(0,Z.jsxs)(ee,{className:`gap-2`,children:[b,(0,Z.jsx)(c,{variant:`destructive`,onClick:s,disabled:i,children:x})]}),t[24]=s,t[25]=i,t[26]=x,t[27]=S):S=t[27];let C;t[28]!==y||t[29]!==S?(C=(0,Z.jsxs)(R,{children:[_,(0,Z.jsxs)(I,{children:[v,y,S]})]}),t[28]=y,t[29]=S,t[30]=C):C=t[30];let w;return t[31]!==C||t[32]!==h?(w=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between border-b p-4 last:border-b-0`,children:[h,C]}),t[31]=C,t[32]=h,t[33]=w):w=t[33],w}function pe(e){let t=(0,B.c)(31),{onSuccess:n}=e,[r,i]=(0,z.useState)(me),[a,o]=(0,z.useState)(!1),s;t[0]===n?s=t[1]:(s={onSuccess:()=>{i(``),o(!1),n()}},t[0]=n,t[1]=s);let{register:l,isLoading:u,error:d,isSupported:f}=h(s),p;t[2]!==r||t[3]!==l?(p=async e=>{e.preventDefault(),r.trim()&&await l(r)},t[2]=r,t[3]=l,t[4]=p):p=t[4];let m=p,g;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{o(!1),i(``)},t[5]=g):g=t[5];let _=g;if(!f){let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`div`,{className:`text-muted-foreground text-sm`,children:`Passkeys are not supported in this browser.`}),t[6]=e):e=t[6],e}if(!a){let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(c,{variant:`outline`,onClick:()=>o(!0),children:`Add passkey`}),t[7]=e):e=t[7],e}let v;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(N,{htmlFor:`passkey-name`,children:`Passkey name`}),t[8]=v):v=t[8];let y;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>i(e.target.value),t[9]=y):y=t[9];let b;t[10]===r?b=t[11]:(b=(0,Z.jsx)(k,{id:`passkey-name`,type:`text`,value:r,onChange:y,placeholder:`e.g., MacBook Pro, iPhone`,className:`border-foreground/20 mt-1 block w-full`,autoFocus:!0}),t[10]=r,t[11]=b);let x;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`A name helps you identify this passkey later.`}),t[12]=x):x=t[12];let S;t[13]===b?S=t[14]:(S=(0,Z.jsxs)(`div`,{className:`grid gap-2`,children:[v,b,x]}),t[13]=b,t[14]=S);let C;t[15]===d?C=t[16]:(C=d&&(0,Z.jsx)(M,{message:d}),t[15]=d,t[16]=C);let w;t[17]!==u||t[18]!==r?(w=u||!r.trim(),t[17]=u,t[18]=r,t[19]=w):w=t[19];let T=u?`Registering...`:`Register passkey`,E;t[20]!==w||t[21]!==T?(E=(0,Z.jsx)(c,{type:`submit`,disabled:w,children:T}),t[20]=w,t[21]=T,t[22]=E):E=t[22];let D;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(c,{type:`button`,variant:`ghost`,onClick:_,children:`Cancel`}),t[23]=D):D=t[23];let O;t[24]===E?O=t[25]:(O=(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[E,D]}),t[24]=E,t[25]=O);let A;return t[26]!==m||t[27]!==O||t[28]!==S||t[29]!==C?(A=(0,Z.jsxs)(`form`,{onSubmit:m,className:`border-border bg-muted/50 space-y-4 rounded-lg border p-4`,children:[S,C,O]}),t[26]=m,t[27]=O,t[28]=S,t[29]=C,t[30]=A):A=t[30],A}function me(){let e=navigator.userAgent;return[[{pattern:/Edg|Edge/,name:`Edge`},{pattern:/OPR|Opera|OPiOS/,name:`Opera`},{pattern:/Firefox|FxiOS/,name:`Firefox`},{pattern:/Chrome|CriOS/,name:`Chrome`},{pattern:/Safari/,name:`Safari`}].find(t=>{let{pattern:n}=t;return n.test(e)})?.name,[{pattern:/iPhone/,name:`iPhone`},{pattern:/iPad|Macintosh(?=.*Mobile)/,name:`iPad`},{pattern:/Android/,name:`Android`},{pattern:/Mac/,name:`Mac`},{pattern:/Windows/,name:`Windows`}].find(t=>{let{pattern:n}=t;return n.test(e)})?.name].filter(Boolean).join(` on `)||``}var he=()=>{let e=(0,B.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsxs)(`div`,{className:`p-8 text-center`,children:[(0,Z.jsx)(`div`,{className:`bg-muted mx-auto mb-4 flex h-14 w-14 items-center justify-center rounded-2xl`,children:(0,Z.jsx)(g,{className:`text-muted-foreground h-7 w-7`})}),(0,Z.jsx)(`p`,{className:`font-medium`,children:`No passkeys yet`}),(0,Z.jsx)(`p`,{className:`text-muted-foreground mt-1 text-sm`,children:`Add a passkey to sign in without a password`})]}),e[0]=t):t=e[0],t};function ge(e){let t=(0,B.c)(10),n;t[0]===e.passkeys?n=t[1]:(n=e.passkeys??[],t[0]=e.passkeys,t[1]=n);let r=n,i=ve,a=_e;if(!(e.canManagePasskeys??!1))return null;let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(A,{variant:`small`,title:`Passkeys`,description:`Manage your passkeys for passwordless sign-in`}),t[2]=o):o=t[2];let s;t[3]===r?s=t[4]:(s=r.length>0?r.map(e=>(0,Z.jsx)(fe,{passkey:e,onDelete:i},e.id)):(0,Z.jsx)(he,{}),t[3]=r,t[4]=s);let c;t[5]===s?c=t[6]:(c=(0,Z.jsx)(`div`,{className:`border-border overflow-hidden rounded-lg border`,children:s}),t[5]=s,t[6]=c);let l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(pe,{onSuccess:a}),t[7]=l):l=t[7];let u;return t[8]===c?u=t[9]:(u=(0,Z.jsxs)(`div`,{className:`space-y-6`,children:[o,c,l]}),t[8]=c,t[9]=u),u}function _e(){r.reload()}function ve(e,t){r.delete(Y.url(e),{preserveScroll:!0,onError:t})}var ye=s(`relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current`,{variants:{variant:{default:`bg-background text-foreground`,destructive:`text-destructive-foreground [&>svg]:text-current *:data-[slot=alert-description]:text-destructive-foreground/80`}},defaultVariants:{variant:`default`}});function be(e){let t=(0,B.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]!==n||t[5]!==i?(a=l(ye({variant:i}),n),t[4]=n,t[5]=i,t[6]=a):a=t[6];let o;return t[7]!==r||t[8]!==a?(o=(0,Z.jsx)(`div`,{"data-slot":`alert`,role:`alert`,className:a,...r}),t[7]=r,t[8]=a,t[9]=o):o=t[9],o}function xe(e){let t=(0,B.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=l(`col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`alert-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Se(e){let t=(0,B.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=l(`text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`alert-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Q(e){let t=(0,B.c)(8),{errors:n,title:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(ie,{}),t[0]=i):i=t[0];let a=r||`Something went wrong.`,o;t[1]===a?o=t[2]:(o=(0,Z.jsx)(xe,{children:a}),t[1]=a,t[2]=o);let s;t[3]===n?s=t[4]:(s=(0,Z.jsx)(Se,{children:(0,Z.jsx)(`ul`,{className:`list-inside list-disc text-sm`,children:Array.from(new Set(n)).map(Ce)})}),t[3]=n,t[4]=s);let c;return t[5]!==o||t[6]!==s?(c=(0,Z.jsxs)(be,{variant:`destructive`,children:[i,o,s]}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function Ce(e,t){return(0,Z.jsx)(`li`,{children:e},t)}function we(e){let t=(0,B.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=l(`bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`card`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Te(e){let t=(0,B.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=l(`flex flex-col gap-1.5 px-6`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`card-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ee(e){let t=(0,B.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=l(`leading-none font-semibold`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`card-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function De(e){let t=(0,B.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=l(`text-muted-foreground text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`card-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Oe(e){let t=(0,B.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=l(`px-6`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`card-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ke(e){let t=(0,B.c)(32),{recoveryCodesList:r,fetchRecoveryCodes:i,errors:a}=e,[o,s]=(0,z.useState)(!1),l=(0,z.useRef)(null),u=r.length>0&&o,d;t[0]!==o||t[1]!==i||t[2]!==r.length?(d=async()=>{!o&&!r.length&&await i(),s(!o),o||setTimeout(()=>{l.current?.scrollIntoView({behavior:`smooth`,block:`nearest`})})},t[0]=o,t[1]=i,t[2]=r.length,t[3]=d):d=t[3];let m=d,h,g;t[4]!==i||t[5]!==r.length?(h=()=>{r.length||i()},g=[r.length,i],t[4]=i,t[5]=r.length,t[6]=h,t[7]=g):(h=t[6],g=t[7]),(0,z.useEffect)(h,g);let v=o?p:f,y;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsxs)(Te,{children:[(0,Z.jsxs)(Ee,{className:`flex gap-3`,children:[(0,Z.jsx)(oe,{className:`size-4`,"aria-hidden":`true`}),`2FA recovery codes`]}),(0,Z.jsx)(De,{children:`Recovery codes let you regain access if you lose your 2FA device. Store them in a secure password manager.`})]}),t[8]=y):y=t[8];let b;t[9]===v?b=t[10]:(b=(0,Z.jsx)(v,{className:`size-4`,"aria-hidden":`true`}),t[9]=v,t[10]=b);let x=o?`Hide`:`View`,S;t[11]!==o||t[12]!==b||t[13]!==x||t[14]!==m?(S=(0,Z.jsxs)(c,{onClick:m,className:`w-fit`,"aria-expanded":o,"aria-controls":`recovery-codes-section`,children:[b,x,` recovery codes`]}),t[11]=o,t[12]=b,t[13]=x,t[14]=m,t[15]=S):S=t[15];let C;t[16]!==u||t[17]!==i?(C=u&&(0,Z.jsx)(n,{..._.form(),options:{preserveScroll:!0},onSuccess:i,children:Me}),t[16]=u,t[17]=i,t[18]=C):C=t[18];let w;t[19]!==S||t[20]!==C?(w=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3 select-none sm:flex-row sm:items-center sm:justify-between`,children:[S,C]}),t[19]=S,t[20]=C,t[21]=w):w=t[21];let T=`relative overflow-hidden transition-all duration-300 ${o?`h-auto opacity-100`:`h-0 opacity-0`}`,E=!o,D;t[22]!==a||t[23]!==r?(D=(0,Z.jsx)(`div`,{className:`mt-3 space-y-3`,children:a?.length?(0,Z.jsx)(Q,{errors:a}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{ref:l,className:`bg-muted grid gap-1 rounded-lg p-4 font-mono text-sm`,role:`list`,"aria-label":`Recovery codes`,children:r.length?r.map(je):(0,Z.jsx)(`div`,{className:`space-y-2`,"aria-label":`Loading recovery codes`,children:Array.from({length:8},Ae)})}),(0,Z.jsx)(`div`,{className:`text-muted-foreground text-xs select-none`,children:(0,Z.jsxs)(`p`,{id:`regenerate-warning`,children:[`Each recovery code can be used once to access your account and will be removed after use. If you need more, click`,` `,(0,Z.jsx)(`span`,{className:`font-bold`,children:`Regenerate codes`}),` `,`above.`]})})]})}),t[22]=a,t[23]=r,t[24]=D):D=t[24];let O;t[25]!==T||t[26]!==E||t[27]!==D?(O=(0,Z.jsx)(`div`,{id:`recovery-codes-section`,className:T,"aria-hidden":E,children:D}),t[25]=T,t[26]=E,t[27]=D,t[28]=O):O=t[28];let k;return t[29]!==O||t[30]!==w?(k=(0,Z.jsxs)(we,{children:[y,(0,Z.jsxs)(Oe,{children:[w,O]})]}),t[29]=O,t[30]=w,t[31]=k):k=t[31],k}function Ae(e,t){return(0,Z.jsx)(`div`,{className:`bg-muted-foreground/20 h-4 animate-pulse rounded`,"aria-hidden":`true`},t)}function je(e,t){return(0,Z.jsx)(`div`,{role:`listitem`,className:`select-text`,children:e},t)}function Me(e){let{processing:t}=e;return(0,Z.jsxs)(c,{variant:`secondary`,type:`submit`,disabled:t,"aria-describedby":`regenerate-warning`,children:[(0,Z.jsx)(se,{}),` Regenerate codes`]})}function Ne(){let e=(0,B.c)(3),[t,n]=(0,z.useState)(null),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=async e=>{if(!navigator?.clipboard)return console.warn(`Clipboard not supported`),!1;try{return await navigator.clipboard.writeText(e),n(e),!0}catch(e){return console.warn(`Copy failed`,e),n(null),!1}},e[0]=r):r=e[0];let i=r,a;return e[1]===t?a=e[2]:(a=[t,i],e[1]=t,e[2]=a),a}function Pe(){let e=(0,B.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`div`,{className:`absolute inset-0 grid grid-cols-5 opacity-50`,children:Array.from({length:5},Ie)}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`div`,{className:`border-border bg-card mb-3 rounded-full border p-0.5 shadow-sm`,children:(0,Z.jsxs)(`div`,{className:`border-border bg-muted relative overflow-hidden rounded-full border p-2.5`,children:[t,(0,Z.jsx)(`div`,{className:`absolute inset-0 grid grid-rows-5 opacity-50`,children:Array.from({length:5},Fe)}),(0,Z.jsx)(ce,{className:`text-foreground relative z-20 size-6`})]})}),e[1]=n):n=e[1],n}function Fe(e,t){return(0,Z.jsx)(`div`,{className:`border-border border-b last:border-b-0`},`row-${t+1}`)}function Ie(e,t){return(0,Z.jsx)(`div`,{className:`border-border border-r last:border-r-0`},`col-${t+1}`)}function Le(e){let t=(0,B.c)(9),{qrCodeSvg:n,manualSetupKey:r,buttonText:i,onNextStep:a,errors:o}=e,{resolvedAppearance:s}=O(),[l,u]=Ne(),f=l===r?d:ae,p;return t[0]!==f||t[1]!==i||t[2]!==u||t[3]!==o||t[4]!==r||t[5]!==a||t[6]!==n||t[7]!==s?(p=(0,Z.jsx)(Z.Fragment,{children:o?.length?(0,Z.jsx)(Q,{errors:o}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`mx-auto flex max-w-md overflow-hidden`,children:(0,Z.jsx)(`div`,{className:`border-border mx-auto aspect-square w-64 rounded-lg border`,children:(0,Z.jsx)(`div`,{className:`z-10 flex h-full w-full items-center justify-center p-5`,children:n?(0,Z.jsx)(`div`,{className:`aspect-square w-full rounded-lg bg-white p-2 [&_svg]:size-full`,dangerouslySetInnerHTML:{__html:n},style:{filter:s===`dark`?`invert(1) brightness(1.5)`:void 0}}):(0,Z.jsx)(P,{})})})}),(0,Z.jsx)(`div`,{className:`flex w-full space-x-5`,children:(0,Z.jsx)(c,{className:`w-full`,onClick:a,children:i})}),(0,Z.jsxs)(`div`,{className:`relative flex w-full items-center justify-center`,children:[(0,Z.jsx)(`div`,{className:`bg-border absolute inset-0 top-1/2 h-px w-full`}),(0,Z.jsx)(`span`,{className:`bg-card relative px-2 py-1`,children:`or, enter the code manually`})]}),(0,Z.jsx)(`div`,{className:`flex w-full space-x-2`,children:(0,Z.jsx)(`div`,{className:`border-border flex w-full items-stretch overflow-hidden rounded-xl border`,children:r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`input`,{type:`text`,readOnly:!0,value:r,className:`bg-background text-foreground h-full w-full p-3 outline-none`}),(0,Z.jsx)(`button`,{onClick:()=>u(r),className:`border-border hover:bg-muted border-l px-3`,children:(0,Z.jsx)(f,{className:`w-4`})})]}):(0,Z.jsx)(`div`,{className:`bg-muted flex h-full w-full items-center justify-center p-3`,children:(0,Z.jsx)(P,{})})})})]})}),t[0]=f,t[1]=i,t[2]=u,t[3]=o,t[4]=r,t[5]=a,t[6]=n,t[7]=s,t[8]=p):p=t[8],p}function Re(e){let t=(0,B.c)(11),{onClose:r,onBack:i}=e,[a,o]=(0,z.useState)(``),s=(0,z.useRef)(null),l,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{setTimeout(()=>{s.current?.querySelector(`input`)?.focus()},0)},u=[],t[0]=l,t[1]=u):(l=t[0],u=t[1]),(0,z.useEffect)(l,u);let d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=x.form(),t[2]=d):d=t[2];let f;t[3]===r?f=t[4]:(f=()=>r(),t[3]=r,t[4]=f);let p;t[5]!==a||t[6]!==i?(p=e=>{let{processing:t,errors:n}=e;return(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsxs)(`div`,{ref:s,className:`relative w-full space-y-3`,children:[(0,Z.jsxs)(`div`,{className:`flex w-full flex-col items-center space-y-3 py-2`,children:[(0,Z.jsx)(C,{id:`otp`,name:`code`,maxLength:6,onChange:o,disabled:t,pattern:T,autoFocus:!0,children:(0,Z.jsx)(v,{children:Array.from({length:6},ze)})}),(0,Z.jsx)(M,{message:n?.confirmTwoFactorAuthentication?.code})]}),(0,Z.jsxs)(`div`,{className:`flex w-full space-x-5`,children:[(0,Z.jsx)(c,{type:`button`,variant:`outline`,className:`flex-1`,onClick:i,disabled:t,children:`Back`}),(0,Z.jsx)(c,{type:`submit`,className:`flex-1`,disabled:t||a.length<6,children:`Confirm`})]})]})})},t[5]=a,t[6]=i,t[7]=p):p=t[7];let m;return t[8]!==f||t[9]!==p?(m=(0,Z.jsx)(n,{...d,onSuccess:f,resetOnError:!0,resetOnSuccess:!0,children:p}),t[8]=f,t[9]=p,t[10]=m):m=t[10],m}function ze(e,t){return(0,Z.jsx)(b,{index:t},t)}function Be(e){let t=(0,B.c)(45),{isOpen:n,onClose:r,requiresConfirmation:i,twoFactorEnabled:a,qrCodeSvg:o,manualSetupKey:s,clearSetupData:c,fetchSetupData:l,errors:u}=e,[d,f]=(0,z.useState)(!1),p;bb0:{if(a){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e={title:`Two-factor authentication enabled`,description:`Two-factor authentication is now enabled. Scan the QR code or enter the setup key in your authenticator app.`,buttonText:`Close`},t[0]=e):e=t[0],p=e;break bb0}if(d){let e;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e={title:`Verify authentication code`,description:`Enter the 6-digit code from your authenticator app`,buttonText:`Continue`},t[1]=e):e=t[1],p=e;break bb0}let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e={title:`Enable two-factor authentication`,description:`To finish enabling two-factor authentication, scan the QR code or enter the setup key in your authenticator app`,buttonText:`Continue`},t[2]=e):e=t[2],p=e}let m=p,h;t[3]!==c||t[4]!==a?(h=()=>{a&&c(),f(!1)},t[3]=c,t[4]=a,t[5]=h):h=t[5];let g=h,_;t[6]!==r||t[7]!==g?(_=()=>{g(),r()},t[6]=r,t[7]=g,t[8]=_):_=t[8];let v=_,y;t[9]!==c||t[10]!==v||t[11]!==i?(y=()=>{if(i){f(!0);return}c(),v()},t[9]=c,t[10]=v,t[11]=i,t[12]=y):y=t[12];let b=y,x=(0,z.useRef)(l),S,C;t[13]===l?(S=t[14],C=t[15]):(S=()=>{x.current=l},C=[l],t[13]=l,t[14]=S,t[15]=C),(0,z.useEffect)(S,C);let w,T;t[16]!==n||t[17]!==o?(w=()=>{n&&!o&&x.current()},T=[n,o],t[16]=n,t[17]=o,t[18]=w,t[19]=T):(w=t[18],T=t[19]),(0,z.useEffect)(w,T);let E;t[20]===v?E=t[21]:(E=e=>!e&&v(),t[20]=v,t[21]=E);let D;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(Pe,{}),t[22]=D):D=t[22];let O;t[23]===m.title?O=t[24]:(O=(0,Z.jsx)(L,{children:m.title}),t[23]=m.title,t[24]=O);let k;t[25]===m.description?k=t[26]:(k=(0,Z.jsx)(F,{className:`text-center`,children:m.description}),t[25]=m.description,t[26]=k);let A;t[27]!==O||t[28]!==k?(A=(0,Z.jsxs)(re,{className:`flex items-center justify-center`,children:[D,O,k]}),t[27]=O,t[28]=k,t[29]=A):A=t[29];let j;t[30]!==u||t[31]!==v||t[32]!==b||t[33]!==s||t[34]!==m.buttonText||t[35]!==o||t[36]!==d?(j=(0,Z.jsx)(`div`,{className:`flex flex-col items-center space-y-5`,children:d?(0,Z.jsx)(Re,{onClose:v,onBack:()=>f(!1)}):(0,Z.jsx)(Le,{qrCodeSvg:o,manualSetupKey:s,buttonText:m.buttonText,onNextStep:b,errors:u})}),t[30]=u,t[31]=v,t[32]=b,t[33]=s,t[34]=m.buttonText,t[35]=o,t[36]=d,t[37]=j):j=t[37];let M;t[38]!==A||t[39]!==j?(M=(0,Z.jsxs)(I,{className:`sm:max-w-md`,children:[A,j]}),t[38]=A,t[39]=j,t[40]=M):M=t[40];let N;return t[41]!==n||t[42]!==M||t[43]!==E?(N=(0,Z.jsx)(R,{open:n,onOpenChange:E,children:M}),t[41]=n,t[42]=M,t[43]=E,t[44]=N):N=t[44],N}function Ve(e){let t=(0,B.c)(24),r=e.requiresConfirmation??!1,i=e.twoFactorEnabled??!1,{qrCodeSvg:a,hasSetupData:o,manualSetupKey:s,clearSetupData:l,clearTwoFactorAuthData:u,fetchSetupData:d,recoveryCodesList:f,fetchRecoveryCodes:p,errors:m}=w(),[h,g]=(0,z.useState)(!1),_=(0,z.useRef)(i),v,b;if(t[0]!==u||t[1]!==i?(v=()=>{_.current&&!i&&u(),_.current=i},b=[i,u],t[0]=u,t[1]=i,t[2]=v,t[3]=b):(v=t[2],b=t[3]),(0,z.useEffect)(v,b),!(e.canManageTwoFactor??!1))return null;let x;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(A,{variant:`small`,title:`Two-factor authentication`,description:`Manage your two-factor authentication settings`}),t[4]=x):x=t[4];let C;t[5]!==m||t[6]!==p||t[7]!==o||t[8]!==f||t[9]!==i?(C=i?(0,Z.jsxs)(`div`,{className:`flex flex-col items-start justify-start space-y-4`,children:[(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`You will be prompted for a secure, random pin during login, which you can retrieve from the TOTP-supported application on your phone.`}),(0,Z.jsx)(`div`,{className:`relative inline`,children:(0,Z.jsx)(n,{...S.form(),children:Ue})}),(0,Z.jsx)(ke,{recoveryCodesList:f,fetchRecoveryCodes:p,errors:m})]}):(0,Z.jsxs)(`div`,{className:`flex flex-col items-start justify-start space-y-4`,children:[(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`When you enable two-factor authentication, you will be prompted for a secure pin during login. This pin can be retrieved from a TOTP-supported application on your phone.`}),(0,Z.jsx)(`div`,{children:o?(0,Z.jsxs)(c,{onClick:()=>g(!0),children:[(0,Z.jsx)(le,{}),`Continue setup`]}):(0,Z.jsx)(n,{...y.form(),onSuccess:()=>g(!0),children:He})})]}),t[5]=m,t[6]=p,t[7]=o,t[8]=f,t[9]=i,t[10]=C):C=t[10];let T;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>g(!1),t[11]=T):T=t[11];let E;t[12]!==l||t[13]!==m||t[14]!==d||t[15]!==s||t[16]!==a||t[17]!==r||t[18]!==h||t[19]!==i?(E=(0,Z.jsx)(Be,{isOpen:h,onClose:T,requiresConfirmation:r,twoFactorEnabled:i,qrCodeSvg:a,manualSetupKey:s,clearSetupData:l,fetchSetupData:d,errors:m}),t[12]=l,t[13]=m,t[14]=d,t[15]=s,t[16]=a,t[17]=r,t[18]=h,t[19]=i,t[20]=E):E=t[20];let D;return t[21]!==C||t[22]!==E?(D=(0,Z.jsxs)(`div`,{className:`space-y-6`,children:[x,C,E]}),t[21]=C,t[22]=E,t[23]=D):D=t[23],D}function He(e){let{processing:t}=e;return(0,Z.jsx)(c,{type:`submit`,disabled:t,children:`Enable 2FA`})}function Ue(e){let{processing:t}=e;return(0,Z.jsx)(c,{variant:`destructive`,type:`submit`,disabled:t,children:`Disable 2FA`})}function $(e){let r=(0,B.c)(20),i=(0,z.useRef)(null),a=(0,z.useRef)(null),o,s;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(t,{title:`Security settings`}),s=(0,Z.jsx)(`h1`,{className:`sr-only`,children:`Security settings`}),r[0]=o,r[1]=s):(o=r[0],s=r[1]);let l;r[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(A,{variant:`small`,title:`Update password`,description:`Ensure your account is using a long, random password to stay secure`}),r[2]=l):l=r[2];let u,d,f;r[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=de.update.form(),d={preserveScroll:!0},f=[`password`,`password_confirmation`,`current_password`],r[3]=u,r[4]=d,r[5]=f):(u=r[3],d=r[4],f=r[5]);let p;r[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>{e.password&&i.current?.focus(),e.current_password&&a.current?.focus()},r[6]=p):p=r[6];let h;r[7]===e.passwordRules?h=r[8]:(h=(0,Z.jsxs)(`div`,{className:`space-y-6`,children:[l,(0,Z.jsx)(n,{...u,options:d,resetOnError:f,resetOnSuccess:!0,onError:p,className:`space-y-6`,children:t=>{let{errors:n,processing:r}=t;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Z.jsx)(N,{htmlFor:`current_password`,children:`Current password`}),(0,Z.jsx)(m,{id:`current_password`,ref:a,name:`current_password`,className:`mt-1 block w-full`,autoComplete:`current-password`,placeholder:`Current password`}),(0,Z.jsx)(M,{message:n.current_password})]}),(0,Z.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Z.jsx)(N,{htmlFor:`password`,children:`New password`}),(0,Z.jsx)(m,{id:`password`,ref:i,name:`password`,className:`mt-1 block w-full`,autoComplete:`new-password`,placeholder:`New password`,passwordrules:e.passwordRules}),(0,Z.jsx)(M,{message:n.password})]}),(0,Z.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Z.jsx)(N,{htmlFor:`password_confirmation`,children:`Confirm password`}),(0,Z.jsx)(m,{id:`password_confirmation`,name:`password_confirmation`,className:`mt-1 block w-full`,autoComplete:`new-password`,placeholder:`Confirm password`,passwordrules:e.passwordRules}),(0,Z.jsx)(M,{message:n.password_confirmation})]}),(0,Z.jsx)(`div`,{className:`flex items-center gap-4`,children:(0,Z.jsx)(c,{disabled:r,"data-test":`update-password-button`,children:`Save`})})]})}})]}),r[7]=e.passwordRules,r[8]=h);let g;r[9]!==e.canManageTwoFactor||r[10]!==e.requiresConfirmation||r[11]!==e.twoFactorEnabled?(g=(0,Z.jsx)(Ve,{canManageTwoFactor:e.canManageTwoFactor,requiresConfirmation:e.requiresConfirmation,twoFactorEnabled:e.twoFactorEnabled}),r[9]=e.canManageTwoFactor,r[10]=e.requiresConfirmation,r[11]=e.twoFactorEnabled,r[12]=g):g=r[12];let _;r[13]!==e.canManagePasskeys||r[14]!==e.passkeys?(_=(0,Z.jsx)(ge,{canManagePasskeys:e.canManagePasskeys,passkeys:e.passkeys}),r[13]=e.canManagePasskeys,r[14]=e.passkeys,r[15]=_):_=r[15];let v;return r[16]!==h||r[17]!==g||r[18]!==_?(v=(0,Z.jsxs)(Z.Fragment,{children:[o,s,h,g,_]}),r[16]=h,r[17]=g,r[18]=_,r[19]=v):v=r[19],v}$.layout={breadcrumbs:[{title:`Security settings`,href:j()}]};export{$ as default};