"use strict";var e=require("react/jsx-runtime"),r=require("@heroicons/react/24/outline"),s=require("react"),n=require("styled-components"),i=require("@privy-io/js-sdk-core"),l=require("./ModalHeader-Cpls13mi.js"),o=require("./Value-mhPsfsxe.js"),a=require("./Row-CMqYn75Q.js"),t=require("./ErrorMessage-BfTVyue9.js"),d=require("./LabelXs-C8rLnCfU.js"),c=require("./Subtitle-CR8zM7ZJ.js"),x=require("./Title-ifTy35V5.js"),h=require("./Address-DW_NyDV7.js"),u=require("./WalletInfoCard-CG-n_44w.js"),j=require("./context-rs-ygOK2.js"),m=require("./useActiveWallet-dTc6deka.js"),p=require("./LoadingSkeleton-BoyADunQ.js"),g=require("viem"),b=require("./shared-DBm7PUrg.js"),w=require("./Checkbox-DzxHC5tk.js"),f=require("./ErrorBanner-dOLclNms.js"),y=require("./WarningBanner-DUcGaIpZ.js"),S=require("@heroicons/react/24/outline/ClipboardDocumentCheckIcon"),k=require("@heroicons/react/24/outline/ClipboardDocumentIcon"),v=require("@heroicons/react/24/outline/ExclamationCircleIcon"),L=require("@privy-io/api-base"),A=require("./internal-context-CdsQ3LEl.js");function R(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var T=/*#__PURE__*/R(S),I=/*#__PURE__*/R(k),V=/*#__PURE__*/R(v);const C=n.styled(o.LabelSm)`
  cursor: pointer;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--privy-color-accent);
  svg {
    fill: var(--privy-color-accent);
  }
`;var M=({iconUrl:r,value:s,symbol:n,usdValue:i,nftName:l,nftCount:o,decimals:a,$isLoading:t})=>{if(t)/*#__PURE__*/return e.jsx(E,{$isLoading:t});let d=s&&i&&a?function(e,r,s){let n=parseFloat(e),i=parseFloat(s);if(0===n||0===i||Number.isNaN(n)||Number.isNaN(i))return e;let l=Math.ceil(-Math.log10(.01/(i/n))),o=Math.pow(10,l=Math.max(l=Math.min(l,r),1)),a=+(Math.floor(n*o)/o).toFixed(l).replace(/\.?0+$/,"");return Intl.NumberFormat(void 0,{maximumFractionDigits:r}).format(a)}(s,a,i):s;/*#__PURE__*/return e.jsxs("div",{children:[/*#__PURE__*/e.jsxs(E,{$isLoading:t,children:[r&&/*#__PURE__*/e.jsx($,{src:r,alt:"Token icon"}),o&&o>1?o+"x":void 0," ",l,d," ",n]}),i&&/*#__PURE__*/e.jsxs(F,{$isLoading:t,children:["$",i]})]})};let E=n.styled.span`
  color: var(--privy-color-foreground);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.375rem;
  word-break: break-all;
  text-align: right;
  display: flex;
  justify-content: flex-end;

  ${p.LoadingSkeleton}
`;const F=n.styled.span`
  color: var(--privy-color-foreground-2);
  font-size: 12px;
  font-weight: 400;
  line-height: 18px;
  word-break: break-all;
  text-align: right;
  display: flex;
  justify-content: flex-end;

  ${p.LoadingSkeleton}
`;let $=n.styled.img`
  height: 14px;
  width: 14px;
  margin-right: 4px;
  object-fit: contain;
`;const q=r=>{let{chain:s,transactionDetails:n,isTokenContractInfoLoading:i,symbol:l}=r,{action:t,functionName:d}=n;/*#__PURE__*/return e.jsx(b.Box,{children:/*#__PURE__*/e.jsxs(a.Rows,{children:["transaction"!==t&&/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Action"}),/*#__PURE__*/e.jsx(o.Value,{children:d})]}),"mint"===d&&"args"in n&&n.args.filter((e=>e)).map(((r,n)=>/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:`Param ${n}`}),/*#__PURE__*/e.jsx(o.Value,{children:"string"==typeof r&&g.isAddress(r)?/*#__PURE__*/e.jsx(h.Address,{address:r,url:s?.blockExplorers?.default?.url,showCopyIcon:!1}):r?.toString()})]},n))),"setApprovalForAll"===d&&n.operator&&/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Operator"}),/*#__PURE__*/e.jsx(o.Value,{children:/*#__PURE__*/e.jsx(h.Address,{address:n.operator,url:s?.blockExplorers?.default?.url,showCopyIcon:!1})})]}),"setApprovalForAll"===d&&void 0!==n.approved&&/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Set approval to"}),/*#__PURE__*/e.jsx(o.Value,{children:n.approved?"true":"false"})]}),"transfer"===d||"transferWithMemo"===d||"transferFrom"===d||"safeTransferFrom"===d||"approve"===d?/*#__PURE__*/e.jsxs(e.Fragment,{children:["formattedAmount"in n&&n.formattedAmount&&/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Amount"}),/*#__PURE__*/e.jsxs(o.Value,{$isLoading:i,children:[n.formattedAmount," ",l]})]}),"tokenId"in n&&n.tokenId&&/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Token ID"}),/*#__PURE__*/e.jsx(o.Value,{children:n.tokenId.toString()})]})]}):null,"safeBatchTransferFrom"===d&&/*#__PURE__*/e.jsxs(e.Fragment,{children:["amounts"in n&&n.amounts&&/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Amounts"}),/*#__PURE__*/e.jsx(o.Value,{children:n.amounts.join(", ")})]}),"tokenIds"in n&&n.tokenIds&&/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Token IDs"}),/*#__PURE__*/e.jsx(o.Value,{children:n.tokenIds.join(", ")})]})]}),"approve"===d&&n.spender&&/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Spender"}),/*#__PURE__*/e.jsx(o.Value,{children:/*#__PURE__*/e.jsx(h.Address,{address:n.spender,url:s?.blockExplorers?.default?.url,showCopyIcon:!1})})]}),("transferFrom"===d||"safeTransferFrom"===d||"safeBatchTransferFrom"===d)&&n.transferFrom&&/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Transferring from"}),/*#__PURE__*/e.jsx(o.Value,{children:/*#__PURE__*/e.jsx(h.Address,{address:n.transferFrom,url:s?.blockExplorers?.default?.url,showCopyIcon:!1})})]}),("transferFrom"===d||"safeTransferFrom"===d||"safeBatchTransferFrom"===d)&&n.transferTo&&/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Transferring to"}),/*#__PURE__*/e.jsx(o.Value,{children:/*#__PURE__*/e.jsx(h.Address,{address:n.transferTo,url:s?.blockExplorers?.default?.url,showCopyIcon:!1})})]})]})})},O=({variant:r,setPreventMaliciousTransaction:s,colorScheme:n="light",preventMaliciousTransaction:i})=>"warn"===r?/*#__PURE__*/e.jsx(D,{children:/*#__PURE__*/e.jsxs(y.WarningBanner,{theme:n,children:[/*#__PURE__*/e.jsx("span",{style:{fontWeight:"500"},children:"Warning: Suspicious transaction"}),/*#__PURE__*/e.jsx("br",{}),"This has been flagged as a potentially deceptive request. Approving could put your assets or funds at risk."]})}):"error"===r?/*#__PURE__*/e.jsx(e.Fragment,{children:/*#__PURE__*/e.jsxs(D,{children:[/*#__PURE__*/e.jsx(f.ErrorBanner,{theme:n,children:/*#__PURE__*/e.jsxs("div",{children:[/*#__PURE__*/e.jsx("strong",{children:"This is a malicious transaction"}),/*#__PURE__*/e.jsx("br",{}),"This transaction transfers tokens to a known malicious address. Proceeding may result in the loss of valuable assets."]})}),/*#__PURE__*/e.jsxs(N,{children:[/*#__PURE__*/e.jsx(w.Checkbox,{color:"var(--privy-color-error)",checked:!i,readOnly:!0,onClick:()=>s(!i)}),/*#__PURE__*/e.jsx("span",{children:"I understand and want to proceed anyways."})]})]})}):null;let D=n.styled.div`
  margin-top: 1.5rem;
`,N=n.styled.div`
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
`;const B=({transactionIndex:e,maxIndex:r})=>"number"!=typeof e||0===r?"":` (${e+1} / ${r+1})`;let P=n.styled(u.WalletInfoCard)`
  ${e=>e.$useSmallMargins?"margin-top: 0.5rem;":"margin-top: 2rem;"}
`,X=n.styled(a.Rows)`
  margin-top: 0.5rem;
  border: 1px solid var(--privy-color-foreground-4);
  border-radius: var(--privy-border-radius-sm);
  padding: 0.5rem;
`,W="There was an error preparing your transaction. Your transaction request will likely fail.",z=n.styled.div`
  display: flex;
  width: 100%;
  justify-content: center;
  max-height: 40px;

  > img {
    object-fit: contain;
    border-radius: var(--privy-border-radius-sm);
  }
`,H=n.styled.span`
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
`,U=n.styled.span`
  font-size: 14px;
  font-weight: 500;
  color: var(--privy-color-foreground);
`;let G=e=>e?.code===L.PrivyErrorCode.COMPLIANCE_BLOCKED,J=()=>/*#__PURE__*/e.jsxs(_,{children:[/*#__PURE__*/e.jsx(ee,{}),/*#__PURE__*/e.jsx(Z,{})]});let Q=n.styled.div`
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
`,K=n.styled.span`
  color: var(--privy-color-foreground);
  text-align: center;
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1.25rem; /* 111.111% */
  text-align: center;
  margin: 10px;
`,Y=n.styled.span`
  margin-top: 4px;
  margin-bottom: 10px;
  color: var(--privy-color-foreground-3);
  text-align: center;

  font-size: 0.875rem;
  font-style: normal;
  font-weight: 400;
  line-height: 20px; /* 142.857% */
  letter-spacing: -0.008px;
`,_=n.styled.div`
  position: relative;
  width: 60px;
  height: 60px;
  margin: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
`,Z=n.styled(V.default)`
  position: absolute;
  width: 35px;
  height: 35px;
  color: var(--privy-color-error);
`,ee=n.styled.div`
  position: absolute;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: var(--privy-color-error);
  opacity: 0.1;
`,re=n.styled(l.PrimaryButton)`
  && {
    margin-top: 24px;
  }
  transition:
    color 350ms ease,
    background-color 350ms ease;
`,se=n.styled.span`
  width: 100%;
  text-align: left;
  font-size: 0.825rem;
  color: var(--privy-color-foreground);
  padding: 4px;
`,ne=n.styled.div`
  width: 100%;
  margin: 5px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
`,ie=n.styled.text`
  position: relative;
  width: 100%;
  padding: 5px;
  font-size: 0.8rem;
  color: var(--privy-color-foreground-3);
  text-align: left;
  word-wrap: break-word;
`,le=n.styled.span`
  position: relative;
  width: 100%;
  background-color: var(--privy-color-background-2);
  padding: 8px 12px;
  border-radius: 10px;
  margin-top: 5px;
  font-size: 14px;
  color: var(--privy-color-foreground-3);
  text-align: left;
  word-wrap: break-word;
  ${e=>e.$clickable&&"cursor: pointer;\n  transition: background-color 0.3s;\n  padding-right: 45px;\n\n  &:hover {\n    background-color: var(--privy-color-foreground-4);\n  }"}
`,oe=n.styled(I.default)`
  position: absolute;
  top: 13px;
  right: 13px;
  width: 24px;
  height: 24px;
`,ae=n.styled(T.default)`
  position: absolute;
  top: 13px;
  right: 13px;
  width: 24px;
  height: 24px;
`,te=({clicked:r})=>r?/*#__PURE__*/e.jsx(ae,{}):/*#__PURE__*/e.jsx(oe,{});exports.SendSolanaTransactionScreenView=({img:n,title:u,subtitle:p,cta:g,instructions:b,network:w,blockExplorerUrl:f,isMissingFunds:y,submitError:S,parseError:k,total:v,swap:L,transactingWalletAddress:A,fee:R,balance:T,disabled:I,isSubmitting:V,isPreparing:M,isTokenPriceLoading:E,onClick:F,onClose:$,onBack:q,isSponsored:O})=>{let D=M||E,[N,B]=s.useState(!1),G=j.useAppConfig();/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(l.ModalHeader,{onClose:$,backFn:q}),n&&/*#__PURE__*/e.jsx(z,{children:n}),/*#__PURE__*/e.jsx(x.Title,{style:{marginTop:n?"1.5rem":0},children:u}),/*#__PURE__*/e.jsx(c.Subtitle,{children:p}),/*#__PURE__*/e.jsxs(a.Rows,{style:{marginTop:"2rem",marginBottom:".5rem"},children:[(v||D)&&/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Amount"}),/*#__PURE__*/e.jsx(o.Value,{$isLoading:D,children:v})]}),L&&/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Swap"}),/*#__PURE__*/e.jsx(o.Value,{children:L})]}),w&&/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Network"}),/*#__PURE__*/e.jsx(o.Value,{children:w})]}),(R||D||void 0!==O)&&/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Estimated fee"}),/*#__PURE__*/e.jsx(o.Value,{$isLoading:D,children:O&&!D?/*#__PURE__*/e.jsxs(H,{children:[/*#__PURE__*/e.jsxs(U,{children:["Sponsored by ",G.name]}),/*#__PURE__*/e.jsx(r.BoltIcon,{height:16,width:16})]}):R})]})]}),/*#__PURE__*/e.jsx(a.Row,{children:/*#__PURE__*/e.jsxs(C,{onClick:()=>B((e=>!e)),children:[/*#__PURE__*/e.jsx("span",{children:"Advanced"}),/*#__PURE__*/e.jsx(r.ChevronDownIcon,{height:"16px",width:"16px",strokeWidth:"2",style:{transition:"all 300ms",transform:N?"rotate(180deg)":void 0}})]})}),N&&/*#__PURE__*/e.jsx(e.Fragment,{children:b.map(((r,s)=>"sol-transfer"===r.type?/*#__PURE__*/e.jsxs(X,{children:[/*#__PURE__*/e.jsx(a.Row,{children:/*#__PURE__*/e.jsxs(d.LabelXs,{children:["Transfer ",r.withSeed?"with seed":""]})}),/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Amount"}),/*#__PURE__*/e.jsxs(o.Value,{children:[i.formatTokenAmount({amount:r.value,decimals:r.token.decimals})," ",r.token.symbol]})]}),!!r.toAccount&&/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Destination"}),/*#__PURE__*/e.jsx(o.Value,{children:/*#__PURE__*/e.jsx(h.Address,{address:r.toAccount,url:f})})]})]},s):"spl-transfer"===r.type?/*#__PURE__*/e.jsxs(X,{children:[/*#__PURE__*/e.jsx(a.Row,{children:/*#__PURE__*/e.jsxs(d.LabelXs,{children:["Transfer ",r.token.symbol]})}),/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Amount"}),/*#__PURE__*/e.jsx(o.Value,{children:r.value.toString()})]}),!!r.fromAta&&/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Source"}),/*#__PURE__*/e.jsx(o.Value,{children:/*#__PURE__*/e.jsx(h.Address,{address:r.fromAta,url:f})})]}),!!r.toAta&&/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Destination"}),/*#__PURE__*/e.jsx(o.Value,{children:/*#__PURE__*/e.jsx(h.Address,{address:r.toAta,url:f})})]}),!!r.token.address&&/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Token"}),/*#__PURE__*/e.jsx(o.Value,{children:/*#__PURE__*/e.jsx(h.Address,{address:r.token.address,url:f})})]})]},s):"ata-creation"===r.type?/*#__PURE__*/e.jsxs(X,{children:[/*#__PURE__*/e.jsx(a.Row,{children:/*#__PURE__*/e.jsx(d.LabelXs,{children:"Create token account"})}),/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Program ID"}),/*#__PURE__*/e.jsx(o.Value,{children:/*#__PURE__*/e.jsx(h.Address,{address:r.program,url:f})})]}),!!r.owner&&/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Owner"}),/*#__PURE__*/e.jsx(o.Value,{children:/*#__PURE__*/e.jsx(h.Address,{address:r.owner,url:f})})]})]},s):"create-account"===r.type?/*#__PURE__*/e.jsxs(X,{children:[/*#__PURE__*/e.jsx(a.Row,{children:/*#__PURE__*/e.jsxs(d.LabelXs,{children:["Create account ",r.withSeed?"with seed":""]})}),!!r.account&&/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Account"}),/*#__PURE__*/e.jsx(o.Value,{children:/*#__PURE__*/e.jsx(h.Address,{address:r.account,url:f})})]}),/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Amount"}),/*#__PURE__*/e.jsxs(o.Value,{children:[i.formatTokenAmount({amount:r.value,decimals:9})," SOL"]})]})]},s):"spl-init-account"===r.type?/*#__PURE__*/e.jsxs(X,{children:[/*#__PURE__*/e.jsx(a.Row,{children:/*#__PURE__*/e.jsx(d.LabelXs,{children:"Initialize token account"})}),!!r.account&&/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Account"}),/*#__PURE__*/e.jsx(o.Value,{children:/*#__PURE__*/e.jsx(h.Address,{address:r.account,url:f})})]}),!!r.mint&&/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Mint"}),/*#__PURE__*/e.jsx(o.Value,{children:/*#__PURE__*/e.jsx(h.Address,{address:r.mint,url:f})})]}),!!r.owner&&/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Owner"}),/*#__PURE__*/e.jsx(o.Value,{children:/*#__PURE__*/e.jsx(h.Address,{address:r.owner,url:f})})]})]},s):"spl-close-account"===r.type?/*#__PURE__*/e.jsxs(X,{children:[/*#__PURE__*/e.jsx(a.Row,{children:/*#__PURE__*/e.jsx(d.LabelXs,{children:"Close token account"})}),!!r.source&&/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Source"}),/*#__PURE__*/e.jsx(o.Value,{children:/*#__PURE__*/e.jsx(h.Address,{address:r.source,url:f})})]}),!!r.destination&&/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Destination"}),/*#__PURE__*/e.jsx(o.Value,{children:/*#__PURE__*/e.jsx(h.Address,{address:r.destination,url:f})})]}),!!r.owner&&/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Owner"}),/*#__PURE__*/e.jsx(o.Value,{children:/*#__PURE__*/e.jsx(h.Address,{address:r.owner,url:f})})]})]},s):"spl-sync-native"===r.type?/*#__PURE__*/e.jsxs(X,{children:[/*#__PURE__*/e.jsx(a.Row,{children:/*#__PURE__*/e.jsx(d.LabelXs,{children:"Sync native"})}),/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Program ID"}),/*#__PURE__*/e.jsx(o.Value,{children:/*#__PURE__*/e.jsx(h.Address,{address:r.program,url:f})})]})]},s):"raydium-swap-base-input"===r.type?/*#__PURE__*/e.jsxs(X,{children:[/*#__PURE__*/e.jsx(a.Row,{children:/*#__PURE__*/e.jsxs(d.LabelXs,{children:["Raydium swap"," ",r.tokenIn&&r.tokenOut?`${r.tokenIn.symbol} → ${r.tokenOut.symbol}`:""]})}),/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Amount in"}),/*#__PURE__*/e.jsx(o.Value,{children:r.amountIn.toString()})]}),/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Minimum amount out"}),/*#__PURE__*/e.jsx(o.Value,{children:r.minimumAmountOut.toString()})]}),r.mintIn&&/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Token in"}),/*#__PURE__*/e.jsx(o.Value,{children:/*#__PURE__*/e.jsx(h.Address,{address:r.mintIn,url:f})})]}),r.mintOut&&/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Token out"}),/*#__PURE__*/e.jsx(o.Value,{children:/*#__PURE__*/e.jsx(h.Address,{address:r.mintOut,url:f})})]})]},s):"raydium-swap-base-output"===r.type?/*#__PURE__*/e.jsxs(X,{children:[/*#__PURE__*/e.jsx(a.Row,{children:/*#__PURE__*/e.jsxs(d.LabelXs,{children:["Raydium swap"," ",r.tokenIn&&r.tokenOut?`${r.tokenIn.symbol} → ${r.tokenOut.symbol}`:""]})}),/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Max amount in"}),/*#__PURE__*/e.jsx(o.Value,{children:r.maxAmountIn.toString()})]}),/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Amount out"}),/*#__PURE__*/e.jsx(o.Value,{children:r.amountOut.toString()})]}),r.mintIn&&/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Token in"}),/*#__PURE__*/e.jsx(o.Value,{children:/*#__PURE__*/e.jsx(h.Address,{address:r.mintIn,url:f})})]}),r.mintOut&&/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Token out"}),/*#__PURE__*/e.jsx(o.Value,{children:/*#__PURE__*/e.jsx(h.Address,{address:r.mintOut,url:f})})]})]},s):"jupiter-swap-shared-accounts-route"===r.type?/*#__PURE__*/e.jsxs(X,{children:[/*#__PURE__*/e.jsx(a.Row,{children:/*#__PURE__*/e.jsxs(d.LabelXs,{children:["Jupiter swap"," ",r.tokenIn&&r.tokenOut?`${r.tokenIn.symbol} → ${r.tokenOut.symbol}`:""]})}),/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"In amount"}),/*#__PURE__*/e.jsx(o.Value,{children:r.inAmount.toString()})]}),/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Quoted out amount"}),/*#__PURE__*/e.jsx(o.Value,{children:r.quotedOutAmount.toString()})]}),r.mintIn&&/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Token in"}),/*#__PURE__*/e.jsx(o.Value,{children:/*#__PURE__*/e.jsx(h.Address,{address:r.mintIn,url:f})})]}),r.mintOut&&/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Token out"}),/*#__PURE__*/e.jsx(o.Value,{children:/*#__PURE__*/e.jsx(h.Address,{address:r.mintOut,url:f})})]})]},s):"jupiter-swap-exact-out-route"===r.type?/*#__PURE__*/e.jsxs(X,{children:[/*#__PURE__*/e.jsx(a.Row,{children:/*#__PURE__*/e.jsxs(d.LabelXs,{children:["Jupiter swap"," ",r.tokenIn&&r.tokenOut?`${r.tokenIn.symbol} → ${r.tokenOut.symbol}`:""]})}),/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Quoted in amount"}),/*#__PURE__*/e.jsx(o.Value,{children:r.quotedInAmount.toString()})]}),/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Amount out"}),/*#__PURE__*/e.jsx(o.Value,{children:r.outAmount.toString()})]}),r.mintIn&&/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Token in"}),/*#__PURE__*/e.jsx(o.Value,{children:/*#__PURE__*/e.jsx(h.Address,{address:r.mintIn,url:f})})]}),r.mintOut&&/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Token out"}),/*#__PURE__*/e.jsx(o.Value,{children:/*#__PURE__*/e.jsx(h.Address,{address:r.mintOut,url:f})})]})]},s):/*#__PURE__*/e.jsxs(X,{children:[/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Program ID"}),/*#__PURE__*/e.jsx(o.Value,{children:/*#__PURE__*/e.jsx(h.Address,{address:r.program,url:f})})]}),/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Data"}),/*#__PURE__*/e.jsx(o.Value,{children:r.discriminator})]})]},s)))}),/*#__PURE__*/e.jsx(m.Grow,{}),S?/*#__PURE__*/e.jsx(t.ErrorMessage,{style:{marginTop:"2rem"},children:S.message}):k?/*#__PURE__*/e.jsx(t.ErrorMessage,{style:{marginTop:"2rem"},children:W}):null,/*#__PURE__*/e.jsx(P,{$useSmallMargins:!(!k&&!S),title:"",address:A,balance:T,errMsg:M||k||S||!y?void 0:"Add funds on Solana to complete transaction."}),/*#__PURE__*/e.jsx(l.PrimaryButton,{style:{marginTop:"1rem"},loading:V,disabled:I||M,onClick:F,children:g}),/*#__PURE__*/e.jsx(l.BlobbyFooter,{})]})},exports.SendTransactionScreenView=({img:n,submitError:i,prepareError:d,onClose:u,action:p,title:g,subtitle:b,to:w,tokenAddress:f,network:y,missingFunds:S,fee:k,from:v,cta:L,disabled:A,chain:R,isSubmitting:T,isPreparing:I,isTokenPriceLoading:V,isTokenContractInfoLoading:E,isSponsored:F,symbol:$,balance:D,onClick:N,transactionDetails:X,transactionIndex:G,maxIndex:J,onBack:Q,chainName:K,validation:Y,hasScanDetails:_,setIsScanDetailsOpen:Z,preventMaliciousTransaction:ee,setPreventMaliciousTransaction:re,tokensSent:se,tokensReceived:ne,isScanning:ie,isCancellable:le,functionName:oe})=>{let{showTransactionDetails:ae,setShowTransactionDetails:te,hasMoreDetails:de,isErc20Ish:ce}=(e=>{let[r,n]=s.useState(!1),i=!0,l=!1;return(!e||e.isErc20Ish||"transaction"===e.action)&&(i=!1),i&&(l=Object.entries(e||{}).some((([e,r])=>r&&!["action","isErc20Ish","isNFTIsh"].includes(e)))),{showTransactionDetails:r,setShowTransactionDetails:n,hasMoreDetails:i&&l,isErc20Ish:e?.isErc20Ish}})(X),xe=j.useAppConfig(),he=ce&&E||I||V||ie;/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(l.ModalHeader,{onClose:u,backFn:Q}),n&&/*#__PURE__*/e.jsx(z,{children:n}),/*#__PURE__*/e.jsxs(x.Title,{style:{marginTop:n?"1.5rem":0},children:[g,/*#__PURE__*/e.jsx(B,{maxIndex:J,transactionIndex:G})]}),/*#__PURE__*/e.jsx(c.Subtitle,{children:b}),/*#__PURE__*/e.jsxs(a.Rows,{style:{marginTop:"2rem"},children:[(!!se[0]||he)&&/*#__PURE__*/e.jsxs(a.Row,{children:[ne.length>0?/*#__PURE__*/e.jsx(o.LabelSm,{children:"Send"}):/*#__PURE__*/e.jsx(o.LabelSm,{children:"approve"===p?"Approval amount":"Amount"}),/*#__PURE__*/e.jsx("div",{className:"flex flex-col",children:se.map(((r,s)=>/*#__PURE__*/e.jsx(M,{iconUrl:r.iconUrl,value:"setApprovalForAll"===oe?"All":r.value,usdValue:r.usdValue,symbol:r.symbol,nftName:r.nftName,nftCount:r.nftCount,decimals:r.decimals},s)))})]}),ne.length>0&&/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Receive"}),/*#__PURE__*/e.jsx("div",{className:"flex flex-col",children:ne.map(((r,s)=>/*#__PURE__*/e.jsx(M,{iconUrl:r.iconUrl,value:r.value,usdValue:r.usdValue,symbol:r.symbol,nftName:r.nftName,nftCount:r.nftCount,decimals:r.decimals},s)))})]}),X&&"spender"in X&&X?.spender?/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Spender"}),/*#__PURE__*/e.jsx(o.Value,{children:/*#__PURE__*/e.jsx(h.Address,{address:X.spender,url:R?.blockExplorers?.default?.url})})]}):null,w&&/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"To"}),/*#__PURE__*/e.jsx(o.Value,{children:/*#__PURE__*/e.jsx(h.Address,{address:w,url:R?.blockExplorers?.default?.url,showCopyIcon:!0})})]}),f&&/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Token address"}),/*#__PURE__*/e.jsx(o.Value,{children:/*#__PURE__*/e.jsx(h.Address,{address:f,url:R?.blockExplorers?.default?.url})})]}),/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Network"}),/*#__PURE__*/e.jsx(o.Value,{children:y})]}),/*#__PURE__*/e.jsxs(a.Row,{children:[/*#__PURE__*/e.jsx(o.LabelSm,{children:"Estimated fee"}),/*#__PURE__*/e.jsx(o.Value,{$isLoading:I||V||void 0===F,children:F?/*#__PURE__*/e.jsxs(H,{children:[/*#__PURE__*/e.jsxs(U,{children:["Sponsored by ",xe.name]}),/*#__PURE__*/e.jsx(r.BoltIcon,{height:16,width:16})]}):k})]}),de&&!_&&/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(a.Row,{className:"cursor-pointer",onClick:()=>te(!ae),children:/*#__PURE__*/e.jsxs(o.LabelSmPrimary,{className:"flex items-center gap-x-1",children:["Details"," ",/*#__PURE__*/e.jsx(r.ChevronDownIcon,{style:{width:"0.75rem",marginLeft:"0.25rem",transform:ae?"rotate(180deg)":void 0}})]})}),ae&&X&&/*#__PURE__*/e.jsx(q,{action:p,chain:R,transactionDetails:X,isTokenContractInfoLoading:E,symbol:$})]}),_&&/*#__PURE__*/e.jsx(a.Row,{children:/*#__PURE__*/e.jsxs(C,{onClick:()=>Z(!0),children:[/*#__PURE__*/e.jsx("span",{className:"text-color-primary",children:"Details"}),/*#__PURE__*/e.jsx(r.ArrowRightIcon,{height:"14px",width:"14px",strokeWidth:"2"})]})})]}),/*#__PURE__*/e.jsx(m.Grow,{}),i?/*#__PURE__*/e.jsx(t.ErrorMessage,{style:{marginTop:"2rem"},children:i.message}):d&&0===G?
/*#__PURE__*/e.jsx(t.ErrorMessage,{style:{marginTop:"2rem"},children:d.shortMessage??W}):null,/*#__PURE__*/e.jsx(O,{variant:Y,preventMaliciousTransaction:ee,setPreventMaliciousTransaction:re}),/*#__PURE__*/e.jsx(P,{$useSmallMargins:!(!d&&!i&&"warn"!==Y&&"error"!==Y),address:v,balance:D,errMsg:I||d||i||!S?void 0:`Add funds on ${R?.name??K} to complete transaction.`}),/*#__PURE__*/e.jsx(l.PrimaryButton,{style:{marginTop:"1rem"},loading:T,disabled:A||I,onClick:N,children:L}),le&&/*#__PURE__*/e.jsx(l.EmbeddedButton,{style:{marginTop:"1rem"},onClick:u,isSubmitting:!1,children:"Not now"}),/*#__PURE__*/e.jsx(l.BlobbyFooter,{})]})},exports.TransactionErrorView=({transactionError:r,chainId:n,onClose:i,onRetry:o,chainType:a,transactionHash:t})=>{let{chains:d}=A.usePrivyInternal(),[c,x]=s.useState(!1),{errorCode:h,errorMessage:u}=((e,r)=>{if("ethereum"===r)return G(e)?{errorCode:"Transaction blocked",errorMessage:e.message}:{errorCode:e.details??e.message,errorMessage:e.shortMessage};let s=e.txSignature,n=e?.transactionMessage||"Something went wrong.";if(Array.isArray(e.logs)){let r=e.logs.find((e=>/insufficient (lamports|funds)/gi.test(e)));r&&(n=r)}return{transactionHash:s,errorMessage:n}})(r,a),j=G(r),m=(({chains:e,chainId:r,chainType:s,transactionHash:n})=>"ethereum"===s?e.find((e=>e.id===r))?.blockExplorers?.default.url??"https://etherscan.io":function(e,r){return`https://explorer.solana.com/tx/${e}?chain=${r}`}(n||"",r))({chains:d,chainId:n,chainType:a,transactionHash:t});/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(l.ModalHeader,{onClose:i}),/*#__PURE__*/e.jsxs(Q,{children:[/*#__PURE__*/e.jsx(J,{}),/*#__PURE__*/e.jsx(K,{children:h}),/*#__PURE__*/e.jsx(Y,{children:j?"This transaction cannot be completed.":"Please try again."}),/*#__PURE__*/e.jsxs(ne,{children:[/*#__PURE__*/e.jsx(se,{children:"Error message"}),/*#__PURE__*/e.jsx(le,{$clickable:!1,children:u})]}),t&&/*#__PURE__*/e.jsxs(ne,{children:[/*#__PURE__*/e.jsx(se,{children:"Transaction hash"}),/*#__PURE__*/e.jsxs(ie,{children:["Copy this hash to view details about the transaction on a"," ",/*#__PURE__*/e.jsx("u",{children:/*#__PURE__*/e.jsx("a",{href:m,children:"block explorer"})}),"."]}),/*#__PURE__*/e.jsxs(le,{$clickable:!0,onClick:async()=>{await navigator.clipboard.writeText(t),x(!0)},children:[t,/*#__PURE__*/e.jsx(te,{clicked:c})]})]}),!j&&/*#__PURE__*/e.jsx(re,{onClick:()=>o({resetNonce:!!t}),children:"Retry transaction"})]}),/*#__PURE__*/e.jsx(l.ModalFooter,{})]})};
//# sourceMappingURL=TransactionErrorView-CIZbOcj4.js.map
