import{eM as h,dZ as S,h as C,b as t,i as u,dt as T,J as m,k as D,a as x,t as j,c as A,cx as M,aA as v}from"./index-6Jqoo2rk.js";import{a0 as f,aG as E,aH as I,ap as H}from"./appDialogsManager-DnVhdlim.js";import{b as R}from"./anchorCallback-DsA1XczG.js";import{M as d}from"./mediaHeader-B5k-4_FU.js";import{I as g}from"./getInputPasskeyResponse-RiY9Fe0r.js";import{B as U}from"./bootstrapIm-BS8HLnlI.js";import"./emailSetup-CFcJlzt-.js";import"./iconTsx-Cr8T7ZIv.js";import"./transition-DuxZkCEv.js";import"./animations-O3syBkMX.js";import"./accumulate-BydAFozl.js";import"./browser-BlRx6CLO.js";import"./_commonjsHelpers-DsqdWQfm.js";import"./putPreloader-WBjcuDFX.js";import"./htmlToSpan-DhAls8qz.js";import"./toast-B3QB1-N7.js";import"./paintQrCode-u2FNs0A8.js";import"./fastBlur-Co-79rP4.js";import"./space-DBcSn32d.js";import"./telInputField-Fj4gE689.js";import"./readBlobAsDataURL-DL2tTmc_.js";import"./tracking-CIK7NCFD.js";import"./sha256-BMgYLqDy.js";import"./bytesCmp-DgkPox5J.js";import"./base64ToBytes-B7rMxzcy.js";const z="_container_tjnis_1",B="_items_tjnis_5",y={container:z,items:B},K=j("<div>"),L=e=>{const[c]=f(),{rootScope:l,wrapEmojiText:s,wrapAdaptiveCustomEmoji:r,Row:a,i18n:n,confirmationPopup:_,formatDate:p}=h(),[P,b]=A(!1),w=()=>{const i=n("Privacy.Passkey.Created",[p(new Date(e.date*1e3),{withTime:!0})]);if(!e.last_usage_date)return i;const o=n("Privacy.Passkey.LastUsage",[p(new Date(e.last_usage_date*1e3),{withTime:!0})]);return[i," • ",o]};return t(a,{get disabled(){return P()},contextMenu:{buttons:[{icon:"delete",text:"Delete",onClick:async()=>{await _({titleLangKey:"Passkey.Deletion.Title",descriptionLangKey:"Passkey.Deletion.Text",button:{langKey:"Delete",isDanger:!0}}),b(!0),l.managers.appAccountManager.deletePasskey(e.id).finally(()=>{c.payload.setPasskeys(i=>{const o=[...i];return v(o,k=>k.id===e.id),o})})},danger:!0}]},get children(){return[t(m,{get when(){return!e.software_emoji_id},get children(){return t(a.Icon,{icon:"key"})}}),t(a.Title,{class:"text-bold",get children(){return s(e.name)}}),t(a.Subtitle,{get children(){return w()}}),t(m,{get when(){return e.software_emoji_id},get children(){return t(a.Media,{size:"abitbigger",get children(){return r({docId:e.software_emoji_id,size:42,wrapOptions:{middleware:M().get()}}).container}})}})]}})},pe=()=>{const[e]=f(),{i18n:c}=h(),l=S(),s=r=>{e.payload.setPasskeys(a=>{const n=[...a];return n.unshift(r),n})};return C(()=>{!e.payload.passkeys.length&&!g&&e.close()}),t(H,{get class(){return y.container},caption:"Privacy.Passkeys.Caption",get captionArgs(){return[R(()=>I(s))]},get children(){return[t(d,{get children(){return[t(d.Sticker,{name:"key",size:100}),t(d.Subtitle,{secondary:!0,get children(){return c("Passkey.Subtitle")}})]}}),(()=>{const r=K();return u(r,t(T,{get each(){return e.payload.passkeys},children:L}),null),u(r,t(m,{get when(){return g&&e.payload.passkeys.length<l.passkeys_account_passkeys_max},get children(){return t(U,{text:"Privacy.Passkey.Create",primaryTransparent:!0,icon:"add",onClick:()=>E().then(s)})}}),null),D(()=>x(r,y.items)),r})()]}})};export{pe as default};
//# sourceMappingURL=passkeys-DHXXfIWA.js.map
