"use strict";var e=require("react/jsx-runtime"),r=require("lucide-react"),t=require("react"),i=require("./WalletInfoCard-CG-n_44w.js"),s=require("./context-rs-ygOK2.js"),o=require("./errors-CBapWvRs.js"),n=require("./internal-context-CdsQ3LEl.js"),c=require("./modal-context-BgeioxwT.js"),a=require("./ScreenLayout-DaFW0I3a.js");require("styled-components"),require("./ModalHeader-Cpls13mi.js"),require("./useActiveWallet-dTc6deka.js"),require("viem/utils"),require("./wallet-connect-BuohfvHK.js"),require("./getPublicClient-CFd_sHBk.js"),require("viem"),require("viem/chains"),require("@privy-io/js-sdk-core"),require("eventemitter3"),require("./events-context-Di6--rDg.js"),require("./privy-context-UTJouJ1x.js"),require("@privy-io/are-addresses-equal"),require("./index-Ub4KpwSY.js"),require("zustand"),require("react-device-detect"),require("./get-entropy-details-for-user-D63rM5_a.js"),require("./user-D2oPA-vS.js"),require("@heroicons/react/24/outline/ArrowLeftIcon"),require("@heroicons/react/24/outline/ArrowRightIcon"),require("@heroicons/react/24/outline/QuestionMarkCircleIcon"),require("@heroicons/react/24/outline/XMarkIcon"),require("./ErrorMessage-BfTVyue9.js"),require("./LabelXs-C8rLnCfU.js"),require("./Address-DW_NyDV7.js"),require("./shared-DBm7PUrg.js"),require("tinycolor2"),require("ofetch"),require("./Screen-8NusMFtu.js"),require("./index-ByFhjjzH.js");const u=({appName:t,address:s,success:o,error:n,onAccept:c,onDecline:u,onClose:l})=>o||n?/*#__PURE__*/e.jsx(a.ScreenLayout,{title:n?"Something went wrong":"Success!",subtitle:n?"Please try again.":`You've successfully granted delegated action permissions to ${t}.`,icon:n?r.AlertCircle:r.CheckCircle,iconVariant:n?"error":"success",onBack:l,watermark:!0}):/*#__PURE__*/e.jsx(a.ScreenLayout,{title:"Enable offline access",subtitle:`By confirming, ${t} will be able to use your wallet for you even when you're not around. You can revoke this later.`,icon:r.CloudUpload,primaryCta:{label:"Accept",onClick:c},secondaryCta:{label:"Not now",onClick:u},onBack:l,watermark:!0,children:/*#__PURE__*/e.jsx(i.WalletInfoCard,{address:s,title:"Wallet"})}),l={component:()=>{let{data:r}=c.usePrivyModal(),i=s.useAppConfig(),{closePrivyModal:a}=n.usePrivyInternal(),[l,d]=t.useState(!1),[q,j]=t.useState(),{address:y,onDelegate:C,onSuccess:p,onError:m}=r.delegatedActions.consent,v=async()=>{l?p():m(q??new o.PrivyClientError("User declined delegating actions.")),a({shouldCallAuthOnSuccess:!1})};return t.useEffect((()=>{if(!l&&!q)return;let e=setTimeout(v,s.DEFAULT_SUCCESS_SCREEN_LONG_DURATION_MS);return()=>clearTimeout(e)}),[l,q]),/*#__PURE__*/e.jsx(u,{appName:i.name,address:y,success:l,error:q,onAccept:async()=>{try{await C(),d(!0)}catch(e){j(e)}},onDecline:()=>{v()},onClose:v})}};exports.DelegatedActionsConsentScreen=l,exports.DelegatedActionsConsentScreenView=u,exports.default=l;
//# sourceMappingURL=DelegatedActionsConsentScreen-Bd19dcyL.js.map
