import{jsx as e}from"react/jsx-runtime";import{AlertCircle as t,CheckCircle as o,CloudUpload as r}from"lucide-react";import{useState as i,useEffect as s}from"react";import{W as n}from"./WalletInfoCard-BVXOg6V2.mjs";import{u as m,s as a}from"./context-BKnOUECq.mjs";import{P as c}from"./errors-Dd6zfYtp.mjs";import{u as l}from"./internal-context-dfitw7Ot.mjs";import{u as p}from"./modal-context-DBwfUxD-.mjs";import{S as u}from"./ScreenLayout-Caq5mGD8.mjs";import"styled-components";import"./ModalHeader-DffkxvO4.mjs";import"./useActiveWallet-BEfvREjE.mjs";import"viem/utils";import"./wallet-connect-58EobR5U.mjs";import"./getPublicClient-D4yNgeGy.mjs";import"viem";import"viem/chains";import"@privy-io/js-sdk-core";import"eventemitter3";import"./events-context-BJ75xIIf.mjs";import"./privy-context-Bi6vqCPc.mjs";import"@privy-io/are-addresses-equal";import"./index-BtwxknTg.mjs";import"zustand";import"react-device-detect";import"./get-entropy-details-for-user-BIWg0YxF.mjs";import"./user-D5cqJNp9.mjs";import"@heroicons/react/24/outline/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import"@heroicons/react/24/outline/QuestionMarkCircleIcon";import"@heroicons/react/24/outline/XMarkIcon";import"./ErrorMessage-D8VaAP5m.mjs";import"./LabelXs-oqZNqbm_.mjs";import"./Address-BOC18tYY.mjs";import"./shared-FM0rljBt.mjs";import"tinycolor2";import"ofetch";import"./Screen-D8KNyGVj.mjs";import"./index-Dq_xe9dz.mjs";const d=({appName:i,address:s,success:m,error:a,onAccept:c,onDecline:l,onClose:p})=>/*#__PURE__*/e(u,m||a?{title:a?"Something went wrong":"Success!",subtitle:a?"Please try again.":`You've successfully granted delegated action permissions to ${i}.`,icon:a?t:o,iconVariant:a?"error":"success",onBack:p,watermark:!0}:{title:"Enable offline access",subtitle:`By confirming, ${i} will be able to use your wallet for you even when you're not around. You can revoke this later.`,icon:r,primaryCta:{label:"Accept",onClick:c},secondaryCta:{label:"Not now",onClick:l},onBack:p,watermark:!0,children:/*#__PURE__*/e(n,{address:s,title:"Wallet"})}),j={component:()=>{let{data:t}=p(),o=m(),{closePrivyModal:r}=l(),[n,u]=i(!1),[j,f]=i(),{address:y,onDelegate:h,onSuccess:g,onError:v}=t.delegatedActions.consent,w=async()=>{n?g():v(j??new c("User declined delegating actions.")),r({shouldCallAuthOnSuccess:!1})};return s((()=>{if(!n&&!j)return;let e=setTimeout(w,a);return()=>clearTimeout(e)}),[n,j]),/*#__PURE__*/e(d,{appName:o.name,address:y,success:n,error:j,onAccept:async()=>{try{await h(),u(!0)}catch(e){f(e)}},onDecline:()=>{w()},onClose:w})}};export{j as DelegatedActionsConsentScreen,d as DelegatedActionsConsentScreenView,j as default};
//# sourceMappingURL=DelegatedActionsConsentScreen-CLkXxmMZ.mjs.map
