import{o as e}from"./rolldown-runtime.js";import{n as t,t as n}from"./jsx-runtime.js";import{Vt as r,j as i,xt as a}from"./useActiveWallet-CEs8euQ3.js";import{k as o,x as s}from"./context-Cdw68BC2.js";import{t as c}from"./modal-context-DHfp-mFQ.js";import{t as l}from"./createLucideIcon.js";import{t as u}from"./circle-alert.js";import{t as d}from"./circle-check-big.js";import{t as f}from"./ScreenLayout-Dy-3vlz4.js";var p=l(`ban`,[[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),m=n(),h=e(t(),1);i();var g=({appName:e,success:t,error:n,onRevoke:r,onDeny:i,onClose:a})=>(0,m.jsx)(f,t||n?{title:n?`Something went wrong`:`Success!`,subtitle:n?`Please try again.`:`You've successfully revoked permissions.`,icon:n?u:d,iconVariant:n?`error`:`success`,onBack:a,watermark:!0}:{title:`Revoke offline access to wallet`,subtitle:`By confirming, ${e} will no longer be able to use this wallet on your behalf when you are not online.`,icon:p,primaryCta:{label:`Confirm`,onClick:r},secondaryCta:{label:`Deny`,onClick:i},onBack:a,watermark:!0}),_={component:()=>{let{data:e}=c(),t=o(),{closePrivyModal:n}=r(),[i,l]=(0,h.useState)(!1),[u,d]=(0,h.useState)(),{onRevoke:f,onSuccess:p,onError:_}=e.delegatedActions.revoke,v=async()=>{i?p():_(u??new a(`User declined revoking access to their delegated wallet.`)),n({shouldCallAuthOnSuccess:!1})};return(0,h.useEffect)((()=>{if(!i&&!u)return;let e=setTimeout(v,s);return()=>clearTimeout(e)}),[i,u]),(0,m.jsx)(g,{appName:t.name,success:i,error:u,onRevoke:async()=>{try{await f(),l(!0)}catch(e){d(e)}},onDeny:()=>{v()},onClose:v})}};export{_ as DelegatedActionsRevokeScreen,_ as default,g as DelegatedActionsRevokeScreenView};