@tuwaio/nova-payments 0.0.0 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +139 -12
- package/dist/OwnConnection-ET76SUMX.js +1 -0
- package/dist/OwnConnection-S5SQLIBT.cjs +1 -0
- package/dist/chunk-7FQXTBOY.cjs +1 -0
- package/dist/chunk-7HSDAUKN.js +1 -0
- package/dist/chunk-EMYW4LI7.js +1 -0
- package/dist/chunk-HRTXVGBJ.cjs +1 -0
- package/dist/de-DXFDX3GR.js +1 -0
- package/dist/de-TJ6BGSUG.cjs +1 -0
- package/dist/es-DCARFZ3R.js +1 -0
- package/dist/es-I4V64VEP.cjs +1 -0
- package/dist/evm/index.cjs +1 -1
- package/dist/evm/index.d.cts +14 -6
- package/dist/evm/index.d.ts +14 -6
- package/dist/evm/index.js +1 -1
- package/dist/i18n/index.cjs +1 -1
- package/dist/i18n/index.d.cts +4 -23
- package/dist/i18n/index.d.ts +4 -23
- package/dist/i18n/index.js +1 -1
- package/dist/index.cjs +2 -1
- package/dist/index.css +626 -61
- package/dist/index.d.cts +2181 -373
- package/dist/index.d.ts +2181 -373
- package/dist/index.js +2 -1
- package/dist/it-N36S2FXH.js +1 -0
- package/dist/it-RQJGHQPP.cjs +1 -0
- package/dist/locales-DP2jStIs.d.cts +1282 -0
- package/dist/locales-DP2jStIs.d.ts +1282 -0
- package/dist/solana/index.cjs +1 -1
- package/dist/solana/index.d.cts +7 -4
- package/dist/solana/index.d.ts +7 -4
- package/dist/solana/index.js +1 -1
- package/dist/{types-Bmj8ctqc.d.cts → types-Bp6JUt56.d.cts} +116 -7
- package/dist/{types-Bmj8ctqc.d.ts → types-Bp6JUt56.d.ts} +116 -7
- package/dist/uk-FFP4RBO4.js +1 -0
- package/dist/uk-HYM26VN5.cjs +1 -0
- package/dist/zhCN-EKUFCQTZ.js +1 -0
- package/dist/zhCN-Q5DO4HXO.cjs +1 -0
- package/package.json +39 -39
- package/dist/chunk-2GRM2VF3.cjs +0 -1
- package/dist/chunk-4TPU7WSP.cjs +0 -1
- package/dist/chunk-BK3GAYTJ.js +0 -1
- package/dist/chunk-XAUJNVKC.js +0 -1
- package/dist/locales-DtReb4Tp.d.cts +0 -588
- package/dist/locales-DtReb4Tp.d.ts +0 -588
package/dist/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import {b,d,f,e,c}from'./chunk-BK3GAYTJ.js';import {b as b$1,a}from'./chunk-XAUJNVKC.js';export{a as PaymentWalletError,b as walletErrorKind}from'./chunk-XAUJNVKC.js';import {getChainName,WalletIcon,cn as cn$1,TokenIcon,NetworkIcon,Dialog,DialogContent,DialogTitle}from'@tuwaio/nova-core';import {createContext,useContext,useId,useRef,useEffect,useState,useMemo,useEffectEvent,useCallback}from'react';import {toCaip2ChainId,formatCaip10AccountId,toEvmChainId,parseCaip19AssetId,parseCaip10AccountId,OrbitAdapter,parseCaip2ChainId}from'@tuwaio/orbit-core';import {ArrowPathIcon,LockClosedIcon,ClockIcon,GlobeAltIcon,ChevronDownIcon,CheckIcon as CheckIcon$1,XMarkIcon,WalletIcon as WalletIcon$1,QrCodeIcon,DevicePhoneMobileIcon,NoSymbolIcon,ArrowPathRoundedSquareIcon,XCircleIcon,ArrowUturnLeftIcon,MagnifyingGlassIcon,ExclamationTriangleIcon,DocumentTextIcon,ArrowDownTrayIcon,CheckCircleIcon,DocumentDuplicateIcon}from'@heroicons/react/24/outline';import {jsxs,jsx,Fragment}from'react/jsx-runtime';import {CheckIcon}from'@heroicons/react/24/solid';import {TxStatusVisual,TxProgressIndicator,HashLink}from'@tuwaio/nova-transactions';import {useLabels,NovaTransactionsLabelsProvider}from'@tuwaio/nova-transactions/providers';import {MotionConfig}from'framer-motion';import {createCheckoutStore}from'@tuwaio/quasar-sdk/checkout';import {useStore}from'zustand';import {SatelliteStoreContext}from'@tuwaio/satellite-react';import {createStore}from'zustand/vanilla';import {NovaConnectProviderContext}from'@tuwaio/nova-connect/hooks';import {encode}from'uqr';var Ie=createContext(null),Ze=Ie.Provider;function C(){let a=useContext(Ie);if(!a)throw new Error("useCheckoutContext must be used inside PaymentCheckout");return a}function X(a,e=2){let o=a.startsWith("-"),t=(o?a.slice(1):a).padStart(e+1,"0");return `${o?"-":""}${t.slice(0,-e)}.${t.slice(-e)}`}var Je=a=>new Intl.NumberFormat(a).formatToParts(1.1).find(e=>e.type==="decimal")?.value??".";function H(a,e){let[o="0",t=""]=(typeof a=="number"?a.toFixed(2):a.trim()).split("."),n=o.startsWith("-"),r=new Intl.NumberFormat(e).format(BigInt(n?o.slice(1):o));return `${n?"-":""}${r}${Je(e)}${t.padEnd(2,"0").slice(0,2)}`}function $(a,e,o){let t=BigInt(a),n=t<0n,r=n?-t:t,s=10n**BigInt(e),c=new Intl.NumberFormat(o).format(r/s),y=(r%s).toString().padStart(e,"0").replace(/0+$/,"").padEnd(2,"0");return `${n?"-":""}${c}${Je(o)}${y}`}function se(a,e){let o=BigInt(a),t=10n**BigInt(e),n=(o%t).toString().padStart(e,"0").replace(/0+$/,"");return n?`${o/t}.${n}`:String(o/t)}function Y(a,e=a.startsWith("0x")?6:4,o=4){return a.length<=e+o+1?a:`${a.slice(0,e)}\u2026${a.slice(-o)}`}var Ca=a=>String(a).padStart(2,"0");function ua(a){let e=Math.max(0,Math.floor(a/1e3)),o=Math.floor(e/86400),t=Math.floor(e%86400/3600),n=Math.floor(e%3600/60),r=e%60;return o>0?`${o}d ${Ca(t)}:${Ca(n)}:${Ca(r)}`:t>0?`${Ca(t)}:${Ca(n)}:${Ca(r)}`:`${Ca(n)}:${Ca(r)}`}var Po={metamask:"MetaMask",walletconnect:"WalletConnect",coinbase:"Coinbase Wallet",okx:"OKX Wallet",trust:"Trust Wallet",injected:"Browser wallet"};function So(a){let e=a.slice(a.indexOf(":")+1).toLowerCase();return Po[e]??e.charAt(0).toUpperCase()+e.slice(1)}var Xe=a=>{let e=parseCaip2ChainId(a)?.namespace;return e==="eip155"||e==="solana"?e:null};function at(a){if(!a?.address)return null;let e=toCaip2ChainId(a.chainId),o=e?Xe(e):null;return !e||!o?null:{address:a.address,chainId:e,family:o,connectorType:a.connectorType,walletId:a.connectorType.slice(a.connectorType.indexOf(":")+1).toLowerCase(),name:So(a.connectorType),connection:a}}function aa(a){return Xe(a.chainId)}function ma(a,e){return !a||a.family!==aa(e)?null:formatCaip10AccountId(e.chainId,a.address)??null}function et(a,e){let o=aa(a);return o==="solana"||o==="eip155"&&!!e}function Te(a){let e=o=>String(Number((o/100).toFixed(2)));return a.discountBps>0?{kind:"discount",percent:e(a.discountBps)}:a.markupBps>0?{kind:"markup",percent:e(a.markupBps)}:null}function G(a){return getChainName(toEvmChainId(a)??a).name}function tt(a){let e=a.assetId?parseCaip19AssetId(a.assetId):void 0;return !e||e.assetNamespace==="slip44"?"native":e.assetReference}function ot(a,e){return a.supportEmail?`mailto:${a.supportEmail}?subject=${encodeURIComponent(e)}`:a.website??null}var Io=["buyer","selectMethod","quoting","awaitingPayment"];function Ae(a){return Io.includes(a)}function pe(a,e){switch(a.code){case "screening_unavailable":return e.pay.screeningUnavailable;case "request_failed":return e.pay.noAnswer;case "amount_out_of_range":case "method_not_found":return e.method.methodUnavailable;case "payer_not_expected":return e.method.payerNotExpected;case "rate_limited":return e.method.rateLimited;default:return e.error.generic}}function nt(a,e){if(a?.status!=="available")return null;let o=e.find(r=>r.id===a.methodId);if(!o)return null;let{request:t}=a,n=t.rules.find(r=>r.type==="expiry")?.data;return {chainId:`eip155:${Number.parseInt(t.chainId,16)}`,to:t.to,limit:BigInt(t.permission.data.periodAmount).toString(),decimals:o.decimals,symbol:o.symbol,periodSeconds:t.permission.data.periodDuration,expiresAt:n?.timestamp?n.timestamp*1e3:null}}function rt(a,e){let o=a%86400===0;return new Intl.NumberFormat(e,{style:"unit",unit:o?"day":"hour",unitDisplay:"long"}).format(o?a/86400:Math.round(a/3600))}function st(a,e){if(!a||e===null)return null;let o=BigInt(a.cryptoAmountExpected)-BigInt(e);return o>0n?o.toString():null}var A="novapay:focus-visible:outline-2 novapay:focus-visible:outline-offset-2 novapay:focus-visible:outline-[var(--tuwa-text-accent)]",Fa=`novapay:inline-flex novapay:h-7 novapay:min-w-7 novapay:items-center novapay:justify-center novapay:gap-1 novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:border-[var(--tuwa-border-primary)] novapay:bg-[var(--tuwa-bg-primary)] novapay:px-1.5 novapay:text-[var(--tuwa-text-primary)] novapay:cursor-pointer novapay:transition-colors novapay:hover:bg-[var(--tuwa-bg-muted)] ${A}`,x="novapay:font-mono novapay:tabular-nums";function ya({title:a,subtitle:e,children:o}){return jsxs("section",{className:"novapay:flex novapay:flex-1 novapay:flex-col novapay:gap-2.5 novapay:px-5 novapay:py-4",children:[jsxs("div",{children:[jsx("h2",{className:cn$1(x,"novapay:m-0 novapay:text-base novapay:font-bold"),children:a}),e&&jsx("p",{className:"novapay:m-0 novapay:mt-1 novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:e})]}),o]})}function K({children:a}){return jsx("footer",{className:"novapay:flex novapay:flex-col novapay:gap-1.5 novapay:border-t novapay:border-[var(--tuwa-border-primary)] novapay:px-5 novapay:pb-3.5 novapay:pt-3",children:a})}function ie({children:a,id:e}){return jsx("span",{id:e,className:cn$1(x,"novapay:text-[11px] novapay:text-[var(--tuwa-text-secondary)]"),children:a})}function U({busy:a,children:e,className:o,...t}){return jsxs("button",{type:"button","aria-busy":a||void 0,...t,disabled:t.disabled||a,className:cn$1(x,"novapay:inline-flex novapay:h-11 novapay:w-full novapay:cursor-pointer novapay:items-center novapay:justify-center novapay:gap-2 novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border-0 novapay:bg-[var(--tuwa-button-primary-bg)] novapay:text-sm novapay:font-bold novapay:text-[var(--tuwa-text-on-accent)] novapay:transition-colors novapay:hover:bg-[var(--tuwa-button-primary-bg-hover)] novapay:disabled:cursor-not-allowed novapay:disabled:opacity-70",A,o),children:[a&&jsx(ArrowPathIcon,{"aria-hidden":true,className:"novapay:h-4 novapay:w-4 novapay:animate-spin novapay:motion-reduce:animate-none"}),e]})}function J({children:a}){return jsx("p",{role:"alert",className:"novapay:m-0 novapay:rounded-[var(--tuwa-rounded-corners)] novapay:bg-[var(--tuwa-error-bg)] novapay:px-3 novapay:py-2 novapay:text-xs novapay:text-[var(--tuwa-error-text)]",children:a})}function za({text:a,label:e,copiedLabel:o,children:t}){let[n,r]=useState(false);useEffect(()=>{if(!n)return;let c=setTimeout(()=>r(false),2e3);return ()=>clearTimeout(c)},[n]);let s=n?CheckIcon$1:DocumentDuplicateIcon;return jsxs(Fragment,{children:[jsxs("button",{type:"button","aria-label":t?void 0:e,onClick:()=>{navigator.clipboard?.writeText(a).then(()=>r(true),()=>{});},className:cn$1(Fa,"novapay:min-h-6 novapay:min-w-6 novapay:text-xs"),children:[jsx(s,{"aria-hidden":true,className:"novapay:h-3.5 novapay:w-3.5"}),t]}),jsx("span",{role:"status",className:"novapay:sr-only",children:n?o:""})]})}function D({name:a,children:e}){return jsxs("div",{className:"novapay:flex novapay:items-baseline novapay:justify-between novapay:gap-3 novapay:text-xs",children:[jsx("dt",{className:"novapay:shrink-0 novapay:text-[var(--tuwa-text-secondary)]",children:a}),jsx("dd",{className:cn$1(x,"novapay:m-0 novapay:min-w-0 novapay:text-right novapay:break-words"),children:e})]})}function W({children:a,onClick:e}){return jsx("button",{type:"button",onClick:e,className:cn$1("novapay:min-h-6 novapay:cursor-pointer novapay:border-0 novapay:bg-transparent novapay:p-0 novapay:text-xs novapay:text-[var(--tuwa-text-accent)] novapay:underline novapay:hover:no-underline",A),children:a})}function ce({kind:a,walletName:e,walletId:o,amount:t,merchant:n,network:r,to:s,priceTime:c,onRetry:y,onCancel:l}){let{labels:u}=C(),i=useId(),v=useRef(null);useEffect(()=>v.current?.focus(),[a]);let m={wallet:e,amount:t,merchant:n,network:r},b$1=a==="sign"?u.walletPrompt.signIn:a==="switch"?u.walletPrompt.switchIn:a==="submitting"?u.walletPrompt.submitting:a==="permission"?u.autoPay.approveIn:u.walletPrompt.confirmIn;return jsxs("section",{"aria-labelledby":i,className:"novapay:absolute novapay:inset-0 novapay:z-10 novapay:flex novapay:flex-col novapay:items-center novapay:justify-center novapay:gap-3 novapay:bg-[var(--tuwa-bg-primary)] novapay:px-6 novapay:py-5 novapay:text-center",children:[jsxs("span",{className:"novapay:relative novapay:h-12 novapay:w-12",children:[o&&jsx(WalletIcon,{walletName:o}),jsx(ArrowPathIcon,{"aria-hidden":true,className:"novapay:absolute novapay:-bottom-1 novapay:-right-1 novapay:h-5 novapay:w-5 novapay:animate-spin novapay:rounded-full novapay:bg-[var(--tuwa-bg-primary)] novapay:text-[var(--tuwa-text-accent)] novapay:motion-reduce:animate-none"})]}),jsx("h2",{id:i,ref:v,tabIndex:-1,className:cn$1(x,"novapay:m-0 novapay:text-base novapay:font-bold novapay:outline-none"),children:b(b$1,m)}),(a==="sign"||a==="confirm")&&jsxs(Fragment,{children:[jsx("p",{className:"novapay:m-0 novapay:max-w-sm novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:b(a==="sign"?u.walletPrompt.signText:u.walletPrompt.confirmText,m)}),jsxs("div",{className:"novapay:w-full novapay:max-w-xs novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:border-[var(--tuwa-border-primary)] novapay:px-3 novapay:py-2 novapay:text-left",children:[jsx("span",{className:"novapay:text-[11px] novapay:font-semibold",children:b(u.walletPrompt.check,m)}),jsxs("dl",{className:"novapay:m-0 novapay:mt-1.5 novapay:flex novapay:flex-col novapay:gap-1",children:[jsx(D,{name:u.walletPrompt.amount,children:t}),jsx(D,{name:u.walletPrompt.to,children:s}),jsx(D,{name:u.walletPrompt.network,children:r}),c&&jsx(D,{name:u.walletPrompt.priceLocked,children:c})]})]}),y?jsxs("p",{className:"novapay:m-0 novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:[u.walletPrompt.notOpened," ",jsx(W,{onClick:y,children:u.walletPrompt.tryAgain})]}):jsx("p",{className:"novapay:m-0 novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:b(u.walletPrompt.stillWaiting,m)})]}),a==="permission"&&jsx("p",{className:"novapay:m-0 novapay:max-w-sm novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:u.autoPay.walletNote}),a!=="submitting"&&jsx(W,{onClick:l,children:u.walletPrompt.cancel})]})}function it(){let{checkout:a,state:e,store:o,labels:t,locale:n,wallet:r,adapterFor:s,setAutoPay:c}=C(),[y,l]=useState(false),[u,i]=useState(null);if(!a)return null;let v=a.merchant.name,m=nt(a.autoCharge,a.methods),b$2=a.autoCharge,N=b$2?.status==="available"?a.methods.find(w=>w.id===b$2.methodId):void 0,S=N?aa(N):null,T=S?s(S):void 0,f=async()=>{if(b$2?.status!=="available"||!m||!r||!T?.requestPermission)return i("unsupported");i(null),l(true);try{let w=await T.requestPermission({request:b$2.request,account:r.address});await o.getState().grantPermission({payer:`${m.chainId}:${r.address}`,...w})&&c(!1);}catch(w){i(b$1(w));}finally{l(false);}},d={wallet:r?.name??"",network:m?G(m.chainId):""},h=u==="declined"?b(t.pay.declined,d):u==="unsupported"?b(t.autoPay.unavailable,d):u?t.error.generic:e.error?pe(e.error,t):null;return jsxs("div",{className:"novapay:relative novapay:flex novapay:flex-1 novapay:flex-col",children:[jsxs("div",{inert:y,className:"novapay:flex novapay:flex-1 novapay:flex-col",children:[jsxs(ya,{title:t.autoPay.title,subtitle:t.autoPay.subtitle,children:[m&&jsxs(Fragment,{children:[jsxs("div",{className:"novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:border-[var(--tuwa-border-primary)] novapay:px-3 novapay:py-2",children:[jsx("span",{className:"novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:b(t.autoPay.allow,{merchant:v})}),jsxs("p",{className:cn$1(x,"novapay:m-0 novapay:text-lg novapay:font-bold"),children:[b(t.autoPay.limit,{amount:`${$(m.limit,m.decimals,n)} ${m.symbol}`})," ",jsx("span",{className:"novapay:text-sm novapay:font-normal",children:b(t.autoPay.every,{period:rt(m.periodSeconds,n)})})]})]}),jsxs("dl",{className:"novapay:m-0 novapay:flex novapay:flex-col novapay:gap-1.5",children:[r&&jsxs(D,{name:t.autoPay.from,children:[Y(r.address)," \xB7 ",G(m.chainId)]}),jsxs(D,{name:t.autoPay.to,children:[Y(m.to)," ",jsx("span",{className:"novapay:font-sans novapay:text-[var(--tuwa-text-secondary)]",children:v})]}),m.expiresAt&&jsx(D,{name:t.autoPay.validUntil,children:b(t.autoPay.validUntilValue,{date:new Intl.DateTimeFormat(n,{dateStyle:"medium"}).format(m.expiresAt)})})]}),jsxs("ul",{className:"novapay:m-0 novapay:flex novapay:list-disc novapay:flex-col novapay:gap-1 novapay:pl-4 novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:[jsx("li",{children:t.autoPay.invoices}),jsx("li",{children:b(t.autoPay.cap,{merchant:v})}),jsx("li",{children:t.autoPay.turnOff})]})]}),h&&jsx(J,{children:h})]}),jsxs(K,{children:[jsx(U,{busy:y,disabled:!m,onClick:()=>{f();},children:t.autoPay.confirm}),jsx(W,{onClick:()=>c(false),children:t.autoPay.skip}),jsx("p",{className:"novapay:m-0 novapay:text-[11px] novapay:text-[var(--tuwa-text-secondary)]",children:t.autoPay.walletNote})]})]}),y&&r&&jsx(ce,{kind:"permission",walletName:r.name,walletId:r.walletId,amount:"",merchant:v,network:d.network,to:"",priceTime:null,onCancel:()=>l(false)})]})}var Go=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,ct="AD AE AF AG AI AL AM AO AQ AR AS AT AU AW AX AZ BA BB BD BE BF BG BH BI BJ BL BM BN BO BQ BR BS BT BV BW BY BZ CA CC CD CF CG CH CI CK CL CM CN CO CR CU CV CW CX CY CZ DE DJ DK DM DO DZ EC EE EG EH ER ES ET FI FJ FK FM FO FR GA GB GD GE GF GG GH GI GL GM GN GP GQ GR GS GT GU GW GY HK HM HN HR HT HU ID IE IL IM IN IO IQ IR IS IT JE JM JO JP KE KG KH KI KM KN KP KR KW KY KZ LA LB LC LI LK LR LS LT LU LV LY MA MC MD ME MF MG MH MK ML MM MN MO MP MQ MR MS MT MU MV MW MX MY MZ NA NC NE NF NG NI NL NO NP NR NU NZ OM PA PE PF PG PH PK PL PM PN PR PS PT PW PY QA RE RO RS RU RW SA SB SC SD SE SG SH SI SJ SK SL SM SN SO SR SS ST SV SX SY SZ TC TD TF TG TH TJ TK TL TM TN TO TR TT TV TW TZ UA UG UM US UY UZ VA VC VE VG VI VN VU WF WS YE YT ZA ZM ZW".split(" "),Ko=new Set(ct);function Ee(a,e){let o=a==="full"||e,t=[{name:"email",required:true,autoComplete:"email",type:"email"}];return o?[...t,{name:"name",required:true,autoComplete:e?"organization":"name",type:"text"},{name:"addressLine1",required:true,autoComplete:"address-line1",type:"text"},{name:"addressLine2",required:false,autoComplete:"address-line2",type:"text"},{name:"postalCode",required:false,autoComplete:"postal-code",type:"text"},{name:"city",required:false,autoComplete:"address-level2",type:"text"},{name:"country",required:true,autoComplete:"country",type:"country"},...e?Vo():[]]:t}var Vo=()=>[{name:"taxId",required:true,autoComplete:"off",type:"text"},{name:"registrationNumber",required:false,autoComplete:"off",type:"text"}];function lt(a,e,o){let t={};for(let n of Ee(e,o)){let r=a[n.name]?.trim()??"";r?n.type==="email"&&!Go.test(r)?t[n.name]="email":n.type==="country"&&!Ko.has(r.toUpperCase())&&(t[n.name]="country"):n.required&&(t[n.name]="required");}return t}function ut(a){let e={};for(let[o,t]of Object.entries(a)){let n=t?.trim();n&&(e[o]=o==="country"?n.toUpperCase():n);}return e}function mt(a){let e=new Intl.DisplayNames([a],{type:"region"});return ct.map(o=>({code:o,name:e.of(o)??o})).sort((o,t)=>o.name.localeCompare(t.name,a))}var jo=(a,e,o)=>e==="name"&&o?a.buyer.companyName:a.buyer[e]??e,zo=(a,e)=>e==="email"?a.buyer.invalidEmail:e==="country"?a.buyer.invalidCountry:a.buyer.required,yt=a=>cn$1("novapay:h-9 novapay:w-full novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:bg-[var(--tuwa-bg-primary)] novapay:px-2.5 novapay:text-[13px] novapay:text-[var(--tuwa-text-primary)]",a?"novapay:border-[var(--tuwa-error-icon)]":"novapay:border-[var(--tuwa-text-secondary)]",A);function vt(){let{checkout:a,state:e,store:o,labels:t,locale:n}=C(),[r,s]=useState({}),[c,y]=useState(false),[l,u]=useState(false),[i,v]=useState(false),m=useId(),b=useMemo(()=>mt(n),[n]);if(!a||a.buyer.collect==="off")return null;let N=a.buyer.collect,S=Ee(N,c),T=lt(r,N,c),f=(h,w)=>s(B=>({...B,[h]:w})),d=async h=>{if(h.preventDefault(),u(true),Object.keys(T).length>0){document.getElementById(`${m}-${Object.keys(T)[0]}`)?.focus();return}v(true),await o.getState().setBuyer(ut(r),{company:c}),v(false);};return jsxs("form",{noValidate:true,onSubmit:h=>{d(h);},className:"novapay:flex novapay:flex-1 novapay:flex-col",children:[jsxs(ya,{title:t.buyer.title,subtitle:t.buyer.subtitle,children:[a.buyer.companyInvoice&&jsxs("label",{className:"novapay:flex novapay:cursor-pointer novapay:items-center novapay:gap-2 novapay:text-[13px]",children:[jsx("input",{type:"checkbox",checked:c,onChange:h=>y(h.target.checked),className:cn$1("novapay:h-4 novapay:w-4 novapay:accent-[var(--tuwa-text-accent)]",A)}),t.buyer.companyInvoice]}),jsx("div",{className:"novapay:grid novapay:grid-cols-1 novapay:gap-x-3 novapay:gap-y-2.5 novapay:sm:grid-cols-2",children:S.map(h=>{let w=`${m}-${h.name}`,B=l?T[h.name]:void 0,_=h.name==="email"||h.name==="name"||h.name.startsWith("addressLine");return jsxs("div",{className:cn$1("novapay:flex novapay:flex-col novapay:gap-1",_&&"novapay:sm:col-span-2"),children:[jsxs("label",{htmlFor:w,className:"novapay:text-xs novapay:text-[var(--tuwa-text-primary)]",children:[jo(t,h.name,c),!h.required&&jsxs("span",{className:"novapay:text-[var(--tuwa-text-secondary)]",children:[" (",t.buyer.optional,")"]})]}),h.type==="country"?jsxs("select",{id:w,autoComplete:h.autoComplete,required:h.required,"aria-invalid":!!B,"aria-describedby":B?`${w}-error`:void 0,value:r.country??"",onChange:F=>f("country",F.target.value),className:yt(!!B),children:[jsx("option",{value:"",children:t.buyer.chooseCountry}),b.map(F=>jsx("option",{value:F.code,children:F.name},F.code))]}):jsx("input",{id:w,type:h.type,autoComplete:h.autoComplete,required:h.required,"aria-invalid":!!B,"aria-describedby":B?`${w}-error`:void 0,value:r[h.name]??"",onChange:F=>f(h.name,F.target.value),className:yt(!!B)}),B&&jsx("span",{id:`${w}-error`,className:"novapay:text-[11px] novapay:text-[var(--tuwa-error-text)]",children:zo(t,B)})]},h.name)})}),e.error&&e.phase==="buyer"&&jsx(J,{children:e.error.message})]}),jsx(K,{children:jsx(U,{type:"submit",busy:i,children:t.buyer.continue})})]})}function dt(a,e={}){switch(a.phase){case "selectMethod":return e.handoff&&e.payWith==="qr"?"qr":"method";case "quoting":return a.quote?e.payWith==="qr"||a.quote.payer===null?"qr":"pay":"method";case "awaitingPayment":case "submitting":return e.payWith==="qr"||a.quote?.payer===null?"qr":"pay";case "confirming":return "confirm";case "paid":return e.autoPay&&a.checkout?.autoCharge?.status==="available"?"autoPay":"paid";case "cancelled":return a.checkout?.invoice.replacedBy?"replaced":"cancelled";default:return a.phase}}var Yo={buyer:"details",method:"method",pay:"pay",qr:"pay",underpaid:"pay",confirm:"confirm",autoPay:"autoPay"};function Me(a,e={}){let o=Yo[a];if(!o)return null;let t=[...e.withDetails||o==="details"?["details"]:[],"method","pay","confirm",...o==="autoPay"?["autoPay"]:[]],n=t.indexOf(o);return t.map((r,s)=>({key:r,state:s<n?"done":s===n?"current":"upcoming"}))}function ft(a,e){let o=s=>s.chainId===e?0:s.featured?1:2,t=new Map;for(let s of a)t.set(s.symbol,[...t.get(s.symbol)??[],s]);let n=[...t].map(([s,c])=>{let y=[...c].sort((l,u)=>o(l)-o(u));return {symbol:s,methods:y,featured:c.some(l=>l.featured),inWallet:!!e&&c.some(l=>l.chainId===e)}}),r=s=>s.inWallet?0:s.featured?1:2;return n.sort((s,c)=>r(s)-r(c))}var Zo=[10,5,1];function xt(a,e){if(a===null||e<=0)return null;let o=Zo.filter(t=>a>t*6e4&&e<=t*6e4);return o.length?Math.min(...o):null}var Be=6e4;function ht(a){return a>0&&a<=Be}function Re({steps:a,labels:e,className:o}){let t=a.findIndex(n=>n.state==="current");return jsx("nav",{"aria-label":e.steps.label,className:cn$1("novapay:min-w-0 novapay:flex-1",o),children:jsx("ol",{className:"novapay:flex novapay:items-center novapay:gap-1.5",children:a.map((n,r)=>{let s=e.steps[n.key];return jsxs("li",{"aria-current":n.state==="current"?"step":void 0,className:cn$1("novapay:flex novapay:min-w-0 novapay:items-center novapay:gap-1.5",r>0&&"novapay:flex-auto"),children:[r>0&&jsx("span",{"aria-hidden":true,className:cn$1("novapay:h-0.5 novapay:min-w-2 novapay:flex-1 novapay:rounded-full",n.state==="upcoming"?"novapay:bg-[var(--tuwa-border-primary)]":"novapay:bg-[var(--tuwa-success-icon)]")}),jsx("span",{"aria-hidden":true,className:cn$1(x,"novapay:flex novapay:h-5 novapay:w-5 novapay:shrink-0 novapay:items-center novapay:justify-center novapay:rounded-full novapay:text-[10px] novapay:font-bold",n.state==="done"&&"novapay:bg-[var(--tuwa-success-icon)] novapay:text-white",n.state==="current"&&"novapay:border-2 novapay:border-[var(--tuwa-text-accent)] novapay:text-[var(--tuwa-text-accent)]",n.state==="upcoming"&&"novapay:border-2 novapay:border-[var(--tuwa-border-primary)] novapay:text-[var(--tuwa-text-secondary)]"),children:n.state==="done"?jsx(CheckIcon,{className:"novapay:h-3 novapay:w-3"}):r+1}),jsx("span",{className:cn$1(x,"novapay:truncate novapay:text-[11px]",n.state==="current"?"novapay:font-bold novapay:text-[var(--tuwa-text-primary)]":"novapay:text-[var(--tuwa-text-secondary)]"),children:n.state==="current"?jsxs(Fragment,{children:[jsx("span",{className:"novapay:sr-only",children:b(e.steps.progress,{current:t+1,total:a.length,name:s})}),jsx("span",{"aria-hidden":true,children:s})]}):s})]},n.key)})})})}function ue(a){let e=a.lineItems.reduce((r,s)=>r+BigInt(s.netMinor),0n),o=BigInt(a.totalMinor??e.toString()),t=o-e,n=[...new Set(a.lineItems.filter(r=>Number(r.taxRate)>0).map(r=>r.taxRate))];return {subtotal:X(e.toString()),tax:t>0n?X(t.toString()):null,rate:n.length===1?String(Number(n[0])):null,total:X(o.toString())}}var gt=new Set(["open","processing","underpaid"]),rn=a=>{try{return new URL(a).host}catch{return a}};function Fe({compact:a=false}){let{checkout:e,state:o,labels:t}=C();if(!e)return null;let{merchant:n,invoice:r}=e,s=a?"novapay:h-8 novapay:w-8":"novapay:h-9 novapay:w-9";return jsxs("div",{className:"novapay:flex novapay:min-w-0 novapay:items-center novapay:gap-2.5",children:[o.logoUrl?jsx("img",{src:o.logoUrl,alt:"",className:cn$1(s,"novapay:shrink-0 novapay:rounded-[var(--tuwa-rounded-corners)] novapay:object-contain")}):jsx("span",{"aria-hidden":true,className:cn$1(s,x,"novapay:flex novapay:shrink-0 novapay:items-center novapay:justify-center novapay:rounded-[var(--tuwa-rounded-corners)] novapay:bg-[var(--tuwa-text-primary)] novapay:text-[15px] novapay:font-bold novapay:text-[var(--tuwa-bg-primary)]"),children:n.name.trim().charAt(0).toUpperCase()}),jsxs("div",{className:"novapay:flex novapay:min-w-0 novapay:flex-col",children:[jsx("span",{className:"novapay:truncate novapay:text-sm novapay:font-semibold",children:n.name}),a?r.number&&jsx("span",{className:cn$1(x,"novapay:text-[11px] novapay:text-[var(--tuwa-text-secondary)]"),children:r.number}):n.website&&jsx("a",{href:n.website,target:"_blank",rel:"noopener noreferrer",className:cn$1("novapay:truncate novapay:text-xs novapay:text-[var(--tuwa-text-secondary)] novapay:hover:underline",A),children:rn(n.website)})]}),r.environment==="test"&&jsxs("span",{title:t.summary.testHint,className:cn$1(x,"novapay:ml-auto novapay:shrink-0 novapay:rounded-[var(--tuwa-rounded-corners)] novapay:bg-[var(--tuwa-pending-bg)] novapay:px-1.5 novapay:py-0.5 novapay:text-[10px] novapay:font-bold novapay:uppercase novapay:tracking-wider novapay:text-[var(--tuwa-pending-text)]"),children:[t.summary.test,jsxs("span",{className:"novapay:sr-only",children:[": ",t.summary.testHint]})]})]})}function wt({checkout:a,labels:e}){let{merchant:o}=a,t=o.seller,n=[[e.summary.terms,o.links.terms],[e.summary.refundPolicy,o.links.refundPolicy],[e.summary.privacy,o.links.privacy]].filter(r=>!!r[1]);return jsxs("div",{className:"novapay:flex novapay:flex-col novapay:gap-1 novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:border-[var(--tuwa-border-primary)] novapay:bg-[var(--tuwa-bg-primary)] novapay:px-3 novapay:py-2.5 novapay:text-[11px] novapay:leading-snug novapay:text-[var(--tuwa-text-secondary)]",children:[t?.legalName&&jsx("span",{className:"novapay:text-xs novapay:font-semibold novapay:text-[var(--tuwa-text-primary)]",children:t.legalName}),(t?.address||t?.country)&&jsx("span",{children:[t.address,t.country].filter(Boolean).join(", ")}),t?.registrationNumber&&jsxs("span",{children:[e.summary.registration," ",t.registrationNumber]}),t?.taxId&&jsxs("span",{children:[e.summary.taxId," ",t.taxId]}),o.supportEmail&&jsx("a",{href:`mailto:${o.supportEmail}`,className:cn$1("novapay:text-[var(--tuwa-text-accent)] novapay:underline",A),children:o.supportEmail}),n.length>0&&jsx("span",{className:"novapay:flex novapay:flex-wrap novapay:gap-x-3",children:n.map(([r,s])=>jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:cn$1("novapay:text-[var(--tuwa-text-accent)] novapay:underline",A),children:r},r))}),jsx("span",{children:b(e.summary.sellerRole,{seller:t?.legalName||o.name})})]})}function sn(){let{checkout:a,labels:e,locale:o,now:t}=C(),n=a?.invoice.dueAt;if(!a||!n||!gt.has(a.invoice.status))return null;let r=new Intl.DateTimeFormat(o,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(n));return jsxs("div",{className:"novapay:flex novapay:items-center novapay:justify-between novapay:gap-2 novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:border-[var(--tuwa-border-primary)] novapay:bg-[var(--tuwa-bg-primary)] novapay:px-3 novapay:py-2.5",children:[jsxs("div",{className:"novapay:flex novapay:flex-col novapay:gap-0.5",children:[jsx("span",{className:cn$1(x,"novapay:text-[11px] novapay:text-[var(--tuwa-text-secondary)]"),children:e.summary.payWithin}),jsx("span",{className:"novapay:text-[11px] novapay:text-[var(--tuwa-text-secondary)]",children:b(e.summary.until,{date:r})})]}),jsx("span",{role:"timer",className:cn$1(x,"novapay:text-lg novapay:font-bold"),children:ua(Date.parse(n)-t)})]})}function kt(){let{checkout:a,labels:e,locale:o}=C();if(!a)return null;let{invoice:t}=a,n=ue(t);return jsxs("div",{className:"novapay:flex novapay:flex-col novapay:gap-3.5",children:[jsxs("div",{className:"novapay:flex novapay:flex-col novapay:gap-2.5",children:[t.number&&jsxs("div",{className:cn$1(x,"novapay:flex novapay:justify-between novapay:text-[11px] novapay:text-[var(--tuwa-text-secondary)]"),children:[jsx("span",{children:e.summary.invoice}),jsx("span",{children:t.number})]}),jsx("ul",{className:"novapay:m-0 novapay:flex novapay:list-none novapay:flex-col novapay:gap-2.5 novapay:p-0",children:t.lineItems.map((r,s)=>jsxs("li",{className:"novapay:flex novapay:justify-between novapay:gap-2 novapay:text-[13px]",children:[jsxs("span",{className:"novapay:flex novapay:min-w-0 novapay:flex-col",children:[jsx("span",{className:"novapay:break-words",children:r.name}),r.description&&jsx("span",{className:"novapay:text-[11px] novapay:text-[var(--tuwa-text-secondary)]",children:r.description}),jsx("span",{className:cn$1(x,"novapay:text-[11px] novapay:text-[var(--tuwa-text-secondary)]"),children:b(e.summary.quantity,{quantity:r.quantity,price:H(r.unitPrice,o)})})]}),jsx("span",{className:x,children:H(X(r.netMinor),o)})]},s))})]}),n.tax&&jsxs("dl",{className:"novapay:m-0 novapay:flex novapay:flex-col novapay:gap-1.5 novapay:border-t novapay:border-dashed novapay:border-[var(--tuwa-border-primary)] novapay:pt-2.5 novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:[jsxs("div",{className:"novapay:flex novapay:justify-between",children:[jsx("dt",{children:e.summary.subtotal}),jsx("dd",{className:cn$1(x,"novapay:m-0"),children:H(n.subtotal,o)})]}),jsxs("div",{className:"novapay:flex novapay:justify-between",children:[jsx("dt",{children:n.rate?b(e.summary.taxRate,{rate:n.rate}):e.summary.tax}),jsx("dd",{className:cn$1(x,"novapay:m-0"),children:H(n.tax,o)})]})]})]})}function pn(){let{checkout:a,labels:e,locale:o}=C();return a?jsxs("div",{className:"novapay:flex novapay:items-baseline novapay:justify-between",children:[jsx("span",{className:cn$1(x,"novapay:text-xs novapay:font-bold"),children:e.summary.total}),jsxs("span",{className:cn$1(x,"novapay:text-[22px] novapay:font-bold"),children:[H(ue(a.invoice).total,o)," ",jsx("span",{className:"novapay:text-[13px] novapay:font-normal novapay:text-[var(--tuwa-text-secondary)]",children:a.invoice.currency})]})]}):null}function cn(){let{checkout:a,labels:e}=C();return jsxs("div",{className:"novapay:flex novapay:flex-col novapay:gap-1 novapay:text-[11px] novapay:text-[var(--tuwa-text-secondary)]",children:[jsxs("span",{className:"novapay:flex novapay:items-center novapay:gap-1.5",children:[jsx(LockClosedIcon,{"aria-hidden":true,className:"novapay:h-3 novapay:w-3"}),e.summary.secured]}),a?.merchant.supportEmail&&jsxs("span",{children:[e.summary.help,":"," ",jsx("a",{href:`mailto:${a.merchant.supportEmail}`,className:cn$1("novapay:text-[var(--tuwa-text-accent)] novapay:underline",A),children:a.merchant.supportEmail})]})]})}function Nt({label:a,children:e,className:o}){let[t,n]=useState(false),r=useId();return jsxs("div",{className:cn$1("novapay:flex novapay:flex-col novapay:gap-2",o),children:[jsxs("button",{type:"button","aria-expanded":t,"aria-controls":r,onClick:()=>n(s=>!s),className:cn$1("novapay:inline-flex novapay:cursor-pointer novapay:items-center novapay:gap-1 novapay:self-start novapay:border-0 novapay:bg-transparent novapay:p-0 novapay:text-[11px] novapay:text-[var(--tuwa-text-secondary)] novapay:hover:text-[var(--tuwa-text-primary)]",A),children:[a,jsx(ChevronDownIcon,{"aria-hidden":true,className:cn$1("novapay:h-3 novapay:w-3 novapay:transition-transform novapay:motion-reduce:transition-none",t&&"novapay:rotate-180")})]}),jsx("div",{id:r,hidden:!t,children:e})]})}function Ct(){let{checkout:a,labels:e}=C();return a?jsxs("div",{className:"novapay:flex novapay:h-full novapay:flex-col novapay:gap-3.5",children:[jsxs("div",{className:"novapay:flex novapay:flex-col novapay:gap-1.5",children:[jsx(Fe,{}),jsx(Nt,{label:e.summary.sellerDetails,children:jsx(wt,{checkout:a,labels:e})})]}),jsx(sn,{}),jsx("div",{className:"novapay:-mr-2.5 novapay:min-h-0 novapay:flex-1 novapay:overflow-y-auto novapay:pr-2.5",children:jsx(kt,{})}),jsx(pn,{}),jsx(cn,{})]}):null}function Pt(){let{checkout:a,labels:e,locale:o,now:t}=C();if(!a)return null;let{invoice:n}=a,r=ue(n),s=n.dueAt&>.has(n.status)?Date.parse(n.dueAt):null;return jsxs("div",{className:"novapay:mx-4 novapay:flex novapay:flex-col novapay:gap-2 novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:border-[var(--tuwa-border-primary)] novapay:bg-[var(--tuwa-bg-secondary)] novapay:p-3",children:[jsxs("div",{className:"novapay:flex novapay:items-baseline novapay:justify-between",children:[jsxs("span",{className:cn$1(x,"novapay:text-[22px] novapay:font-bold"),children:[H(r.total,o)," ",jsx("span",{className:"novapay:text-xs novapay:font-normal novapay:text-[var(--tuwa-text-secondary)]",children:n.currency})]}),s&&jsxs("span",{role:"timer",className:cn$1(x,"novapay:flex novapay:items-center novapay:gap-1 novapay:text-xs novapay:font-bold"),children:[jsx(ClockIcon,{"aria-hidden":true,className:"novapay:h-3.5 novapay:w-3.5 novapay:text-[var(--tuwa-text-secondary)]"}),ua(s-t)]})]}),jsx(Nt,{label:`${b(e.summary.compact,{count:n.lineItems.length,tax:r.tax?H(r.tax,o):H("0",o)})} \xB7 ${e.summary.showOrder}`,children:jsxs("div",{className:"novapay:flex novapay:flex-col novapay:gap-3 novapay:pt-1",children:[jsx(kt,{}),jsx(wt,{checkout:a,labels:e})]})})]})}function It({locale:a,labels:e,receiptIssued:o,onSelect:t,className:n}){let[r,s]=useState(false),c=d.find(f=>f.code===a)??d[0],[y,l]=useState(0),u=useId(),i=useRef(null),v=useRef(null),m=useRef(null);useEffect(()=>{if(!r)return;m.current?.focus();let f=d=>{i.current?.contains(d.target)||s(false);};return document.addEventListener("pointerdown",f),()=>document.removeEventListener("pointerdown",f)},[r]);let b$1=()=>{l(Math.max(0,d.indexOf(c))),s(true);},N=()=>{s(false),v.current?.focus();},S=f=>{N(),f!==c.code&&t(f);},T=f=>{let d$1=d.length-1,h={ArrowDown:()=>Math.min(d$1,y+1),ArrowUp:()=>Math.max(0,y-1),Home:()=>0,End:()=>d$1};h[f.key]?(f.preventDefault(),l(h[f.key]())):f.key==="Enter"||f.key===" "?(f.preventDefault(),S(d[y].code)):(f.key==="Escape"||f.key==="Tab")&&(f.preventDefault(),f.stopPropagation(),N());};return jsxs("div",{ref:i,className:cn$1("novapay:relative",n),children:[jsxs("button",{ref:v,type:"button","aria-haspopup":"listbox","aria-expanded":r,"aria-controls":r?`${u}-list`:void 0,"aria-label":b(e.language.button,{language:c.name}),className:cn$1(Fa,x,"novapay:text-[11px] novapay:font-semibold"),onClick:()=>r?N():b$1(),onKeyDown:f=>{f.key==="ArrowDown"&&!r&&(f.preventDefault(),b$1());},children:[jsx(GlobeAltIcon,{"aria-hidden":true,className:"novapay:h-3.5 novapay:w-3.5"}),jsx("span",{"aria-hidden":true,children:c.short}),jsx(ChevronDownIcon,{"aria-hidden":true,className:"novapay:h-3 novapay:w-3"})]}),r&&jsxs("div",{className:"novapay:absolute novapay:right-0 novapay:top-full novapay:z-20 novapay:mt-1.5 novapay:w-60 novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:border-[var(--tuwa-border-primary)] novapay:bg-[var(--tuwa-bg-primary)] novapay:p-1.5 novapay:shadow-xl",children:[jsx("span",{id:`${u}-title`,className:cn$1(x,"novapay:block novapay:px-2.5 novapay:py-1 novapay:text-[11px] novapay:text-[var(--tuwa-text-secondary)]"),children:e.language.title}),jsx("ul",{ref:m,id:`${u}-list`,role:"listbox",tabIndex:-1,"aria-labelledby":`${u}-title`,"aria-activedescendant":`${u}-${d[y].code}`,onKeyDown:T,className:cn$1("novapay:m-0 novapay:flex novapay:list-none novapay:flex-col novapay:gap-0.5 novapay:p-0",A),children:d.map((f,d)=>{let h=f.code===c.code;return jsxs("li",{id:`${u}-${f.code}`,role:"option","aria-selected":h,lang:f.code,onClick:()=>S(f.code),onPointerMove:()=>l(d),className:cn$1("novapay:flex novapay:h-8 novapay:cursor-pointer novapay:items-center novapay:gap-2.5 novapay:rounded-[var(--tuwa-rounded-corners)] novapay:px-2.5 novapay:text-[13px]",d===y&&"novapay:bg-[var(--tuwa-bg-muted)]","novapay:text-[var(--tuwa-text-primary)]",h&&"novapay:font-semibold"),children:[jsx("span",{"aria-hidden":true,className:cn$1(x,"novapay:w-5 novapay:text-[11px]"),children:f.short}),jsx("span",{children:f.name}),h&&jsx(CheckIcon$1,{"aria-hidden":true,className:"novapay:ml-auto novapay:h-3.5 novapay:w-3.5 novapay:text-[var(--tuwa-text-accent)]"})]},f.code)})}),jsx("p",{className:"novapay:m-0 novapay:mt-1 novapay:border-t novapay:border-[var(--tuwa-border-primary)] novapay:px-2.5 novapay:pb-1 novapay:pt-2 novapay:text-[11px] novapay:leading-snug novapay:text-[var(--tuwa-text-secondary)]",children:o?e.language.noteAfterPaid:e.language.note})]})]})}function Tt({title:a,withDetails:e}){let{screen:o,labels:t,locale:n,store:r,close:s,state:c}=C(),y=Me(o,{withDetails:e}),l=jsxs("div",{className:"novapay:ml-auto novapay:flex novapay:shrink-0 novapay:items-center novapay:gap-2",children:[jsx(It,{locale:n,labels:t,receiptIssued:!!c.receiptUrl,onSelect:u=>{r.getState().setLocale(u);}}),s&&jsx("button",{type:"button","aria-label":t.common.close,onClick:s,className:Fa,children:jsx(XMarkIcon,{"aria-hidden":true,className:"novapay:h-3.5 novapay:w-3.5"})})]});return jsxs(Fragment,{children:[jsxs("header",{className:"novapay:hidden novapay:items-center novapay:gap-3 novapay:border-b novapay:border-[var(--tuwa-border-primary)] novapay:py-3.5 novapay:pl-5 novapay:pr-4 novapay:sm:flex",children:[y?jsx(Re,{steps:y,labels:t}):a&&jsx("h2",{className:cn$1(x,"novapay:m-0 novapay:flex-1 novapay:text-[15px] novapay:font-bold"),children:a}),l]}),jsxs("header",{className:"novapay:flex novapay:items-center novapay:gap-2.5 novapay:px-4 novapay:pb-3 novapay:pt-1.5 novapay:sm:hidden",children:[jsx(Fe,{compact:true}),l]})]})}function At({withDetails:a}){let{screen:e,labels:o}=C(),t=Me(e,{withDetails:a});return t?jsx(Re,{steps:t,labels:o,className:"novapay:px-4 novapay:pt-3.5"}):null}function Lt(a,e){return e.withGas||!a.gasless?"transfer":a.gasless.paymaster&&e.canSponsorCalls?"paymaster":a.gasless.relay?"relay":"transfer"}function Mt(a){let e=BigInt(a.amountToSend),o=BigInt(a.cryptoAmountExpected);return !a.transferFee||e<=o?{send:a.amountToSend,receives:a.cryptoAmountExpected,fee:null}:{send:a.amountToSend,receives:a.cryptoAmountExpected,fee:{amount:String(e-o),percent:String(a.transferFee.bps/100)}}}var ve=10000n,Et=8n;function Bt(a,e){let o=BigInt(a.cryptoAmountExpected);if(!e||o<=0n)return null;let n=BigInt(e)*(ve+BigInt(a.markupBps))*(ve-BigInt(a.discountBps))*10n**BigInt(a.decimals)*10n**Et/(100n*ve*ve*o);return Number(n)/10**Number(Et)}function Rt(a,e,o=0n){let t=BigInt(e.amountToSend)+o;return a>=t?null:{have:String(a),need:String(t),short:String(t-a)}}function na(a){return a.family==="eip155"?`eip155:${a.chainId}`:a.chainId}function de(){let{state:a,locale:e,adapterFor:o}=C(),t=a.quote,n=t?na(t.instructions):null,r=a.txHash??a.txKey,s=t?.payer?parseCaip10AccountId(t.payer)?.address:void 0;return {network:n?G(n):null,amount:t?`${$(t.amountToSend,t.decimals,e)} ${t.instructions.symbol}`:null,txKey:r,explorerUrl:t&&n&&r?o(t.instructions.family)?.explorerUrl?.({chainId:n,txKey:r}):void 0,from:s?Y(s):null}}function fe({children:a}){let{labels:e}=C(),o=useLabels(),t=useMemo(()=>({...o,trackingModal:{...o.trackingModal,progressIndicator:{created:e.confirm.sent,processing:e.confirm.confirming,succeed:e.confirm.paid}},statuses:{...o.statuses,confirmed:e.confirm.confirmed,failed:e.confirm.failed},actions:{...o.actions,viewOnExplorer:e.confirm.viewOnExplorer,copy:e.confirm.copyHash},txError:{...o.txError,copied:e.pay.copied}}),[o,e]);return jsx(NovaTransactionsLabelsProvider,{labels:t,children:a})}function Ft(){let{labels:a,close:e}=C(),o=de();return jsxs(fe,{children:[jsxs("section",{className:"novapay:flex novapay:flex-1 novapay:flex-col novapay:items-center novapay:gap-3 novapay:px-5 novapay:py-5 novapay:text-center",children:[jsx(TxStatusVisual,{isProcessing:true}),jsxs("div",{children:[jsx("h2",{className:cn$1(x,"novapay:m-0 novapay:text-base novapay:font-bold"),children:a.confirm.title}),o.network&&jsx("p",{className:"novapay:m-0 novapay:mt-1 novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:b(a.confirm.hint,{network:o.network})})]}),jsx(TxProgressIndicator,{isProcessing:true,className:"novapay:max-w-sm"}),jsxs("dl",{className:"novapay:m-0 novapay:flex novapay:w-full novapay:max-w-sm novapay:flex-col novapay:gap-1.5 novapay:text-left",children:[o.network&&jsx(D,{name:a.confirm.network,children:o.network}),o.amount&&jsx(D,{name:a.confirm.amount,children:o.amount}),o.txKey&&jsx(D,{name:a.confirm.transaction,children:jsx(HashLink,{hash:o.txKey,explorerUrl:o.explorerUrl,variant:"compact"})}),o.from&&jsx(D,{name:a.confirm.from,children:o.from})]}),jsx("p",{role:"status",className:"novapay:m-0 novapay:max-w-sm novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:a.confirm.canClose})]}),e&&jsx(K,{children:jsx(W,{onClick:e,children:a.common.close})})]})}function Dt({onStay:a,onLeave:e}){let{checkout:o,labels:t,locale:n}=C(),r=useId(),s=useRef(null);useEffect(()=>s.current?.focus(),[]);let c=o?.invoice.dueAt?new Intl.DateTimeFormat(n,{dateStyle:"medium",timeStyle:"short"}).format(Date.parse(o.invoice.dueAt)):null;return jsx("section",{role:"alertdialog","aria-modal":"true","aria-labelledby":r,className:"novapay:absolute novapay:inset-0 novapay:z-20 novapay:flex novapay:items-center novapay:justify-center novapay:bg-[var(--tuwa-bg-primary)]/95 novapay:p-6",children:jsxs("div",{className:"novapay:flex novapay:max-w-sm novapay:flex-col novapay:gap-3 novapay:text-center",children:[jsx("h2",{id:r,ref:s,tabIndex:-1,className:cn$1(x,"novapay:m-0 novapay:text-base novapay:font-bold novapay:outline-none"),children:t.leave.title}),jsx("p",{className:"novapay:m-0 novapay:text-xs",children:c?b(t.leave.text,{date:c}):t.leave.textNoDate}),jsx("p",{className:"novapay:m-0 novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:t.leave.price}),jsx(U,{onClick:a,children:t.leave.stay}),jsx(W,{onClick:e,children:t.leave.leave})]})})}function he({label:a,items:e,value:o,getKey:t,onChange:n,children:r,className:s,itemClassName:c}){let y=useRef([]),l=Math.max(0,e.findIndex(i=>t(i)===o)),u=(i,v)=>{let m=e.length-1,b={ArrowRight:v+1,ArrowDown:v+1,ArrowLeft:v-1,ArrowUp:v-1,Home:0,End:m}[i.key];if(b===void 0)return;i.preventDefault();let N=b<0?m:b>m?0:b;n(t(e[N])),y.current[N]?.focus();};return jsx("div",{role:"radiogroup","aria-label":a,className:s,children:e.map((i,v)=>{let m=t(i),b=m===o;return jsx("button",{ref:N=>{y.current[v]=N;},type:"button",role:"radio","aria-checked":b,tabIndex:v===l?0:-1,onClick:()=>n(m),onKeyDown:N=>u(N,v),className:cn$1("novapay:cursor-pointer novapay:rounded-[var(--tuwa-rounded-corners)] novapay:text-left novapay:text-[var(--tuwa-text-primary)] novapay:transition-colors",b?"novapay:border-2 novapay:border-[var(--tuwa-text-accent)] novapay:bg-[var(--tuwa-bg-primary)]":"novapay:border novapay:border-[var(--tuwa-border-primary)] novapay:bg-[var(--tuwa-bg-secondary)] novapay:hover:border-[var(--tuwa-text-secondary)]",A,c?.(b)),children:r(i,b)},m)})})}function Za({tone:a,children:e}){return jsx("span",{className:cn$1("novapay:shrink-0 novapay:rounded-[var(--tuwa-rounded-corners)] novapay:px-1.5 novapay:py-0.5 novapay:text-[11px]",a==="neutral"&&"novapay:bg-[var(--tuwa-bg-muted)] novapay:text-[var(--tuwa-text-primary)]",a==="accent"&&"novapay:border novapay:border-[var(--tuwa-text-accent)] novapay:text-[var(--tuwa-text-accent)]",a==="success"&&"novapay:bg-[var(--tuwa-success-bg)] novapay:text-[var(--tuwa-success-text)]"),children:e})}function Ot({method:a,labels:e}){let o=Te(a);return o?o.kind==="discount"?jsx(Za,{tone:"success",children:b(e.method.discount,{percent:o.percent})}):jsx(Za,{tone:"neutral",children:b(e.method.markup,{percent:o.percent})}):null}function Kn({selected:a}){return jsx("span",{"aria-hidden":true,className:cn$1("novapay:h-3.5 novapay:w-3.5 novapay:shrink-0 novapay:rounded-full novapay:box-border",a?"novapay:border-4 novapay:border-[var(--tuwa-text-accent)]":"novapay:border novapay:border-[var(--tuwa-text-secondary)]")})}function Vn({labels:a,terms:e,refundPolicy:o}){let t=(r,s)=>jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:cn$1("novapay:text-[var(--tuwa-text-accent)] novapay:underline",A),children:s},r),n=e&&o?c(a.method.agreeBoth,{terms:t(e,a.summary.terms),refundPolicy:t(o,a.summary.refundPolicy)}):e||o?c(a.method.agreeOne,{link:e?t(e,a.summary.terms):t(o,a.summary.refundPolicy)}):null;return n?jsx("p",{className:"novapay:m-0 novapay:text-center novapay:text-[11px] novapay:text-[var(--tuwa-text-secondary)]",children:n}):null}function $t(){let{checkout:a,state:e,store:o,labels:t,wallet:n,payWith:r,setPayWith:s,payUrl:c,connectWallet:y,adapterFor:l,setHandoff:u}=C(),i=useMemo(()=>a?.methods??[],[a]),v=useMemo(()=>ft(i,n?.chainId),[i,n?.chainId]),m=i.find(g=>g.id===e.methodId)??null,b$1=v.find(g=>g.symbol===m?.symbol)??null,N=m?et(m,c):false,S=m?aa(m):null,f=[...(S?!!l(S):false)?["wallet"]:[],...N?["qr"]:[]],d=f.includes(r)?r:f[0]??null,[h,w]=useState(false),B=useEffectEvent(()=>{let g=v[0]?.methods[0];!e.methodId&&g&&o.getState().selectMethod(g.id);});if(useEffect(()=>B(),[v]),!a)return null;if(i.length===0)return jsx(ya,{title:t.method.title,children:jsx(J,{children:t.method.noMethods})});let _=e.phase==="quoting",F=async()=>{if(!m||!d)return;if(w(false),d==="qr"){if(r!=="qr"&&s("qr"),S!=="solana")return u(true);o.getState().setPayer(null),await o.getState().requestQuote();return}r!=="wallet"&&s("wallet");let g=ma(n,m);if(!g)return w(!y(m));o.getState().setPayer(g),await o.getState().requestQuote();};return jsxs(Fragment,{children:[jsxs(ya,{title:t.method.title,subtitle:b(t.method.subtitle,{minutes:Math.round(a.quoteTtlSeconds/60)}),children:[jsx(ie,{children:t.method.token}),jsx(he,{label:t.method.token,items:v,value:b$1?.symbol??null,getKey:g=>g.symbol,onChange:g=>{let j=v.find(Ba=>Ba.symbol===g)?.methods[0];j&&o.getState().selectMethod(j.id);},className:"novapay:grid novapay:grid-cols-2 novapay:gap-2 novapay:sm:grid-cols-4",itemClassName:()=>"novapay:flex novapay:flex-col novapay:items-center novapay:gap-1 novapay:px-1 novapay:py-2",children:g=>jsxs(Fragment,{children:[jsx("span",{className:"novapay:h-6.5 novapay:w-6.5",children:jsx(TokenIcon,{symbol:g.symbol})}),jsx("span",{className:"novapay:text-[13px] novapay:font-semibold",children:g.symbol}),jsx("span",{className:"novapay:text-[10px] novapay:text-[var(--tuwa-text-secondary)]",children:g.methods.length>1?b(t.method.networks,{count:g.methods.length}):Te(g.methods[0])?jsx(Ot,{method:g.methods[0],labels:t}):G(g.methods[0].chainId)})]})}),b$1&&b$1.methods.length>1&&jsxs(Fragment,{children:[jsx(ie,{children:b(t.method.network,{symbol:b$1.symbol})}),jsx(he,{label:b(t.method.network,{symbol:b$1.symbol}),items:b$1.methods,value:m?.id??null,getKey:g=>g.id,onChange:g=>o.getState().selectMethod(g),className:"novapay:flex novapay:flex-col novapay:gap-1.5",itemClassName:()=>"novapay:flex novapay:items-center novapay:gap-2.5 novapay:px-3 novapay:py-2",children:(g,j)=>jsxs(Fragment,{children:[jsx("span",{className:"novapay:h-5 novapay:w-5 novapay:shrink-0",children:jsx(NetworkIcon,{chainId:toEvmChainId(g.chainId)??g.chainId})}),jsx("span",{className:"novapay:text-[13px] novapay:font-semibold",children:G(g.chainId)}),jsxs("span",{className:"novapay:ml-auto novapay:flex novapay:flex-wrap novapay:justify-end novapay:gap-1.5",children:[n?.chainId===g.chainId&&jsx(Za,{tone:"neutral",children:t.method.yourWallet}),g.featured&&jsx(Za,{tone:"accent",children:t.method.popular}),jsx(Ot,{method:g,labels:t}),g.gasless==="auto"?jsx(Za,{tone:"success",children:t.method.noGasFee}):jsx("span",{className:"novapay:text-[11px] novapay:text-[var(--tuwa-text-secondary)]",children:t.method.buyerPaysGas})]}),jsx(Kn,{selected:j})]})})]}),jsx(ie,{children:t.method.payWith}),jsx(he,{label:t.method.payWith,items:f,value:d,getKey:g=>g,onChange:g=>{w(false),s(g);},className:cn$1("novapay:grid novapay:gap-2",f.length>1&&"novapay:grid-cols-2"),itemClassName:()=>"novapay:flex novapay:items-center novapay:gap-2.5 novapay:px-2.5 novapay:py-2",children:g=>g==="wallet"?jsxs(Fragment,{children:[n?jsx("span",{className:"novapay:h-5 novapay:w-5 novapay:shrink-0",children:jsx(WalletIcon,{walletName:n.walletId})}):jsx(WalletIcon$1,{"aria-hidden":true,className:"novapay:h-5 novapay:w-5 novapay:shrink-0 novapay:text-[var(--tuwa-text-accent)]"}),jsxs("span",{className:"novapay:flex novapay:min-w-0 novapay:flex-col",children:[jsx("span",{className:"novapay:text-[13px] novapay:font-semibold",children:t.method.wallet}),jsx("span",{className:cn$1("novapay:truncate novapay:text-[11px] novapay:text-[var(--tuwa-text-secondary)]",n&&x),children:n?`${n.name} \xB7 ${Y(n.address)}`:t.method.walletHint})]})]}):jsxs(Fragment,{children:[m&&aa(m)==="solana"?jsx(QrCodeIcon,{"aria-hidden":true,className:"novapay:h-5 novapay:w-5 novapay:shrink-0"}):jsx(DevicePhoneMobileIcon,{"aria-hidden":true,className:"novapay:h-5 novapay:w-5 novapay:shrink-0"}),jsxs("span",{className:"novapay:flex novapay:flex-col",children:[jsx("span",{className:"novapay:text-[13px] novapay:font-semibold",children:t.method.qr}),jsx("span",{className:"novapay:text-[11px] novapay:text-[var(--tuwa-text-secondary)]",children:t.method.qrHint})]})]})}),m&&!d&&jsx(J,{children:t.method.methodUnavailable}),h&&jsx(J,{children:N?t.pay.connectUnavailable:t.method.methodUnavailable}),e.error&&e.phase==="selectMethod"&&jsx(J,{children:pe(e.error,t)})]}),jsxs(K,{children:[jsx(U,{busy:_,disabled:!m||!d,onClick:()=>{F();},children:_?t.method.quoting:t.method.continue}),jsx(Vn,{labels:t,terms:a.merchant.links.terms,refundPolicy:a.merchant.links.refundPolicy})]})]})}var ar={underpaid:{Icon:ExclamationTriangleIcon,tone:"novapay:text-[var(--tuwa-pending-icon)]"},held:{Icon:MagnifyingGlassIcon,tone:"novapay:text-[var(--tuwa-info-icon)]"},refunded:{Icon:ArrowUturnLeftIcon,tone:"novapay:text-[var(--tuwa-info-icon)]"},expired:{Icon:ClockIcon,tone:"novapay:text-[var(--tuwa-text-secondary)]"},cancelled:{Icon:XCircleIcon,tone:"novapay:text-[var(--tuwa-text-secondary)]"},replaced:{Icon:ArrowPathRoundedSquareIcon,tone:"novapay:text-[var(--tuwa-info-icon)]"},blocked:{Icon:NoSymbolIcon,tone:"novapay:text-[var(--tuwa-error-icon)]"}},sa=({children:a,muted:e})=>jsx("p",{className:cn$1("novapay:m-0 novapay:max-w-sm novapay:text-xs",e?"novapay:text-[var(--tuwa-text-secondary)]":"novapay:text-[var(--tuwa-text-primary)]"),children:a});function er(){let{checkout:a,labels:e,onContact:o}=C();if(!a)return null;let t=b(e.outcome.contact,{merchant:a.merchant.name}),n=cn$1("novapay:inline-flex novapay:min-h-6 novapay:items-center novapay:justify-center novapay:text-xs novapay:font-semibold novapay:text-[var(--tuwa-text-accent)] novapay:underline novapay:hover:no-underline",A);if(o)return jsx("button",{type:"button",onClick:o,className:cn$1(n,"novapay:cursor-pointer novapay:border-0 novapay:bg-transparent"),children:t});let r=ot(a.merchant,b(e.outcome.contactSubject,{number:a.invoice.number??a.invoice.id}));return r?jsx("a",{href:r,target:r.startsWith("mailto:")?void 0:"_blank",rel:"noopener noreferrer",className:n,children:t}):null}function Ut({kind:a}){let{checkout:e,state:o,store:t,labels:n,locale:r,wallet:s,connectWallet:c,openInvoice:y}=C();if(!e)return null;let l=e.merchant.name,{Icon:u,tone:i}=ar[a],v=o.quote,m=e.methods.find(d=>d.id===(o.methodId??v?.methodId)),b$1=e.invoice.dueAt?new Intl.DateTimeFormat(r,{dateStyle:"medium",timeStyle:"short"}).format(Date.parse(e.invoice.dueAt)):null,N=d=>v?`${$(d,v.decimals,r)} ${v.instructions.symbol}`:d,S,T=null,f=null;switch(a){case "underpaid":{let d=e.invoice.amountPaid,h=st(v,d);S=n.outcome.underpaidTitle,T=jsxs(Fragment,{children:[v&&d&&jsx(sa,{children:b(n.outcome.underpaidText,{received:N(d),total:N(v.cryptoAmountExpected)})}),v&&h&&jsx(sa,{children:b(n.outcome.underpaidRest,{rest:N(h),network:G(na(v.instructions))})}),b$1&&jsx(sa,{muted:true,children:b(n.outcome.underpaidNote,{merchant:l,date:b$1})})]});let w=()=>{if(!m)return;let B=v?.payer===null?null:s?ma(s,m):null;if(v?.payer!==null&&!B)return void c(m);t.getState().setPayer(B),t.getState().requestQuote();};f=jsx(U,{busy:o.phase==="quoting",onClick:w,children:n.outcome.payRest});break}case "held":{S=b(n.outcome.heldTitle,{merchant:l});let d=e.invoice.review?.reason,h=d==="late"?n.outcome.heldLate:d==="overpaid"?n.outcome.heldOverpaid:n.outcome.heldScreening;T=jsxs(Fragment,{children:[jsx(sa,{children:b(h,{merchant:l})}),jsx(sa,{muted:true,children:n.outcome.heldNote})]});break}case "refunded":{S=n.outcome.refundedTitle;let d=e.invoice.refundedTotalMinor??e.invoice.totalMinor;T=d&&jsx(sa,{children:b(n.outcome.refundedText,{merchant:l,amount:H(X(d),r),currency:e.invoice.currency})});break}case "expired":S=n.outcome.expiredTitle,T=jsxs(Fragment,{children:[b$1&&jsx(sa,{children:b(n.outcome.expiredText,{date:b$1,merchant:l})}),jsx(sa,{muted:true,children:n.outcome.expiredNote})]});break;case "cancelled":S=n.outcome.cancelledTitle,T=jsx(sa,{children:b(n.outcome.cancelledText,{merchant:l})});break;case "replaced":{let d=e.invoice.replacedBy,h=d?.number??"";if(S=b(n.outcome.replacedTitle,{merchant:l}),T=jsxs(Fragment,{children:[jsx(sa,{children:b(n.outcome.replacedText,{number:h})}),jsx(sa,{muted:true,children:n.outcome.replacedPaid})]}),d?.checkoutToken){let w=d.checkoutToken;f=jsx(U,{onClick:()=>y(w),children:b(n.outcome.openReplacement,{number:h})});}break}case "blocked":{S=n.outcome.blockedTitle;let d=o.payer?parseCaip10AccountId(o.payer)?.address:void 0;T=jsxs(Fragment,{children:[jsx(sa,{children:b(n.outcome.blockedText,{merchant:l})}),d&&jsx("p",{className:cn$1(x,"novapay:m-0 novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]"),children:Y(d)})]}),m&&(f=jsx(U,{onClick:()=>{c(m);},children:n.outcome.useAnotherWallet}));break}}return jsxs(Fragment,{children:[jsxs("section",{role:a==="blocked"?"alert":void 0,className:"novapay:flex novapay:flex-1 novapay:flex-col novapay:items-center novapay:justify-center novapay:gap-3 novapay:px-5 novapay:py-6 novapay:text-center",children:[jsx(u,{"aria-hidden":true,className:cn$1("novapay:h-12 novapay:w-12",i)}),jsx("h2",{className:cn$1(x,"novapay:m-0 novapay:max-w-sm novapay:text-base novapay:font-bold"),children:S}),T]}),jsxs(K,{children:[f,jsx(er,{})]})]})}function Vt(a,e,o){let t=useRef(false),n=useEffectEvent(()=>{e&&o?.(e);});useEffect(()=>{a!=="paid"||t.current||(t.current=true,n());},[a]);}function _t({url:a,seconds:e,now:o,navigate:t=n=>window.location.assign(n)}){let[n]=useState(o),[r,s]=useState(false),c=a&&e>0&&!r?Math.max(0,e-Math.floor((o-n)/1e3)):null,y=useEffectEvent(()=>{a&&t(a);});return useEffect(()=>{c===0&&y();},[c]),{left:c,stay:()=>s(true)}}function Qt(){let{checkout:a,state:e,labels:o,locale:t,now:n,close:r,wallet:s,adapterFor:c,setAutoPay:y,autoReturnSeconds:l}=C(),u=de(),[i]=useState(n),v=a?.merchant.name??"",m=a?.invoice.successUrl??null,b$1=a?.autoCharge??null,N=b$1?.status==="available"?a?.methods.find(B=>B.id===b$1.methodId):void 0,S=N?aa(N):null,T=!!(s&&S&&c(S)?.requestPermission),f=_t({url:m,seconds:T?0:l,now:n});if(!a)return null;let d=a.invoice.totalMinor?H(X(a.invoice.totalMinor),t):null,h=a.invoice.refundedTotalMinor&&BigInt(a.invoice.refundedTotalMinor)>0n?H(X(a.invoice.refundedTotalMinor),t):null,w=new Intl.DateTimeFormat(t,{dateStyle:"medium",timeStyle:"short"}).format(i);return jsxs(fe,{children:[jsxs("section",{className:"novapay:flex novapay:flex-1 novapay:flex-col novapay:items-center novapay:gap-3 novapay:px-5 novapay:py-5 novapay:text-center",children:[jsx(TxStatusVisual,{isSucceed:true}),jsx("h2",{className:cn$1(x,"novapay:m-0 novapay:text-base novapay:font-bold"),children:o.paid.title}),jsxs("div",{children:[jsx("p",{className:cn$1(x,"novapay:m-0 novapay:text-2xl novapay:font-bold"),children:u.amount??(d&&`${d} ${a.invoice.currency}`)}),jsx("p",{className:"novapay:m-0 novapay:mt-1 novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:u.network?b(o.paid.summary,{network:u.network,date:w}):w})]}),u.txKey&&jsx(HashLink,{hash:u.txKey,explorerUrl:u.explorerUrl,variant:"compact",className:"novapay:max-w-sm"}),jsx(TxProgressIndicator,{isSucceed:true,isConfirmed:true,className:"novapay:max-w-sm"}),h&&jsx("p",{className:"novapay:m-0 novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:b(o.paid.refunded,{amount:h,currency:a.invoice.currency})}),e.receiptUrl&&jsxs("div",{className:"novapay:flex novapay:w-full novapay:max-w-sm novapay:items-center novapay:gap-3 novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:border-[var(--tuwa-border-primary)] novapay:px-3 novapay:py-2 novapay:text-left",children:[jsx(DocumentTextIcon,{"aria-hidden":true,className:"novapay:h-6 novapay:w-6 novapay:shrink-0 novapay:text-[var(--tuwa-text-secondary)]"}),jsxs("span",{className:"novapay:flex novapay:min-w-0 novapay:flex-1 novapay:flex-col",children:[jsx("span",{className:"novapay:text-[13px] novapay:font-semibold",children:o.paid.receipt}),jsx("span",{className:"novapay:text-[11px] novapay:text-[var(--tuwa-text-secondary)]",children:o.paid.receiptHint})]}),jsxs("a",{href:e.receiptUrl,target:"_blank",rel:"noopener noreferrer",className:cn$1("novapay:inline-flex novapay:min-h-6 novapay:items-center novapay:gap-1 novapay:text-xs novapay:font-semibold novapay:text-[var(--tuwa-text-accent)]",A),children:[jsx(ArrowDownTrayIcon,{"aria-hidden":true,className:"novapay:h-4 novapay:w-4"}),o.paid.download]})]}),b$1?.status==="active"&&jsxs("p",{className:"novapay:m-0 novapay:flex novapay:items-center novapay:gap-1.5 novapay:text-xs novapay:text-[var(--tuwa-success-text)]",children:[jsx(CheckCircleIcon,{"aria-hidden":true,className:"novapay:h-4 novapay:w-4"}),o.paid.autoPayActive]})]}),jsxs(K,{children:[T&&jsx(U,{onClick:()=>y(true),children:o.paid.autoPayOffer}),m?jsxs(Fragment,{children:[jsx("a",{href:m,className:cn$1(x,"novapay:inline-flex novapay:h-11 novapay:items-center novapay:justify-center novapay:rounded-[var(--tuwa-rounded-corners)] novapay:text-sm novapay:font-bold novapay:no-underline",T?"novapay:border novapay:border-[var(--tuwa-border-primary)] novapay:text-[var(--tuwa-text-primary)]":"novapay:bg-[var(--tuwa-button-primary-bg)] novapay:text-[var(--tuwa-text-on-accent)]",A),children:b(o.paid.back,{merchant:v})}),f.left!==null&&jsxs("p",{className:"novapay:m-0 novapay:text-center novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:[jsx("span",{role:"timer","aria-live":"off",children:b(o.paid.returning,{merchant:v,seconds:f.left})})," ","\xB7 ",jsx(W,{onClick:f.stay,children:o.paid.stay})]})]}):r&&jsx(W,{onClick:r,children:o.common.close})]})]})}var Ma=()=>new Promise(()=>{}),dr={view:Ma,quote:Ma,buyer:Ma,locale:Ma,submit:Ma,relay:Ma,permission:Ma,url:()=>""},fr=createCheckoutStore({token:"idle",api:dr,EventSource:null});function zt(a){let{token:e,baseUrl:o,api:t,EventSource:n,pollMs:r}=a,[s,c]=useState(fr),y=useEffectEvent(()=>createCheckoutStore({token:e,baseUrl:o,api:t,EventSource:n,pollMs:r}));return useEffect(()=>{let l=y();return c(l),l.getState().load(),()=>l.getState().destroy()},[e,o]),s}function Yt(a,e){return useStore(a,e)}var kr=createStore(()=>({}));function Zt(){let a=useContext(SatelliteStoreContext),e=useStore(a??kr,o=>o.activeConnection);return useMemo(()=>at(e),[e])}var ge=createContext({});function we(){return useContext(ge)}function Jt(a,e=true){let[o,t]=useState(()=>Date.now());return useEffect(()=>{if(!e)return;let n=setInterval(()=>t(Date.now()),a);return ()=>clearInterval(n)},[a,e]),o}var Ir=100,Tr=300,Xt=(a,e)=>a.length>e?`${a.slice(0,e-1)}\u2026`:a,Ar=["paid","underpaid","held","refunded","expired","cancelled","blocked"];function ao(a){return !Ar.includes(a.phase)&&a.error?.code!=="payment_failed"}async function eo({adapter:a,pulsar:e,payment:o,labels:t,merchant:n,invoice:r,amount:s}){if(!e||!a?.pulsarTransaction)return false;let c=r.number?b(t.pay.txDescription,{amount:s,invoice:r.number}):s,y=a.pulsarTransaction({...o,title:Xt(b(t.pay.txTitle,{merchant:n}),Ir),description:Xt(c,Tr),payload:{quasarInvoice:r.id}});return await e.injectExternalPendingTxs([y]),true}function to({store:a,open:e,adapterFor:o,pulsar:t,labels:n,locale:r}){let s=useRef(null),c=useRef(!e),y=useRef({adapterFor:o,pulsar:t,labels:n,locale:r});useEffect(()=>{y.current={adapterFor:o,pulsar:t,labels:n,locale:r};});let l=useCallback(i=>{let{phase:v,error:m,checkout:b}=a.getState();if(!b||!ao({phase:v,error:m}))return;let{adapterFor:N,pulsar:S,labels:T,locale:f}=y.current,{amount:d,decimals:h,symbol:w}=i.instructions;eo({adapter:N(i.instructions.family),pulsar:S,payment:i,labels:T,merchant:b.merchant.name,invoice:{id:b.invoice.id,number:b.invoice.number},amount:`${$(d,h,f)} ${w}`}).catch(()=>{});},[a]),u=useCallback(()=>{c.current=true,s.current&&l(s.current),s.current=null;},[l]);return useEffect(()=>{e?c.current=false:u();},[e,u]),useEffect(()=>u,[u]),useCallback(i=>{c.current?l(i):s.current=i;},[l])}function oo(a){let{labels:e$1,customization:o}=we(),t=o?.labels?.transform;return useMemo(()=>{let n=f(e(a),e$1);return t?t(n,{locale:a}):n},[a,e$1,t])}function ro(a){let e=useContext(NovaConnectProviderContext);return {canConnect:!!(e||a),connecting:e?.isConnectModalOpen??false,connect:o=>e?(e.setIsConnectModalOpen(true,{adapter:o==="solana"?OrbitAdapter.SOLANA:OrbitAdapter.EVM}),true):a?(a(o),true):false}}function Xa(a,e){let[o,t]=useState(null),n=useEffectEvent(e);return useEffect(()=>{if(a===null)return;let r=true,s;try{s=Promise.resolve(n());}catch(c){s=Promise.reject(c);}return s.then(c=>r&&t({key:a,value:c}),()=>r&&t({key:a,value:null})),()=>{r=false;}},[a]),o&&o.key===a?o.value:void 0}var so=a$1=>new a("unsupported",`${a$1} is not available`);async function po({adapter:a,store:e,quote:o,wallet:t,path:n,paymasterUrl:r,onWalletDone:s,onSent:c}){let y=t.address;if(n==="relay"){let u=o.gasless?.relay?.typedData;if(!u||!a.signTransferAuthorization)throw so("A gasless signature");let i=await a.signTransferAuthorization({typedData:u,account:y});return s?.(),e.getState().relay(i)}if(n==="paymaster"){let u=o.gasless?.paymaster?.calls;if(!u||!r||!a.sendSponsoredCalls)throw so("A sponsored payment");let i=na(o.instructions),v=await a.sendSponsoredCalls({calls:u,paymasterUrl:r,chainId:i,account:y,onSent:s});return s?.(),c?.(v),e.getState().submit({txKey:v,connectorType:t.connectorType})}let l=await a.sendTransfer({instructions:o.instructions,account:y,connection:t.connection});return s?.(),c?.(l),e.getState().submit({txKey:l,connectorType:t.connectorType})}function co({adapter:a,store:e,quote:o,wallet:t,path:n,paymasterUrl:r,onSent:s}){let[c,y]=useState("idle"),[l,u]=useState(null),i=useRef(0),v=async(m,b)=>{let N=++i.current,S=()=>i.current===N;u(null),y(m);try{await b(S);}catch(T){S()&&u(b$1(T));}finally{S()&&y("idle");}};return {status:c,problem:l,pay:()=>v("wallet",async m=>{if(!a||!o||!t)return u("unsupported");await po({adapter:a,store:e,quote:o,wallet:t,path:n,paymasterUrl:r,onWalletDone:()=>m()&&y("submitting"),onSent:b=>s?.({txKey:b,instructions:o.instructions,account:t.address,connectorType:t.connectorType})});}),switchNetwork:()=>v("switching",async()=>{if(!a?.switchChain||!o)return u("unsupported");await a.switchChain(na(o.instructions));}),dismiss:()=>{i.current++,y("idle");}}}function Ur(a,e){return a>=1?H(a,e):new Intl.NumberFormat(e,{maximumSignificantDigits:6}).format(a)}function Hr(a,e,o,t){return o==="declined"?b(a.pay.declined,e):o==="unsupported"?b(a.pay.unsupported,e):o==="failed"||t==="payment_failed"?b(a.pay.failed,e):t==="screening_unavailable"?a.pay.screeningUnavailable:t==="request_failed"?a.pay.noAnswer:null}function Gr(a,e,o){let{wallet:t,adapterFor:n}=C(),r=e?.instructions.family,s=r?n(r):void 0,c=a.filter(l=>l.id!==e?.methodId&&aa(l)===r),y=Xa(o&&s&&t&&c.length?`${t.address}:${c.map(l=>l.id).join()}`:null,()=>Promise.all(c.map(l=>s.getBalance({chainId:l.chainId,account:t.address,token:tt(l)}).catch(()=>0n))));return y?c.map((l,u)=>({method:l,balance:y[u]})).filter(l=>l.balance>0n):[]}function lo(){let{checkout:a,state:e,store:o,labels:t,locale:n,now:r,wallet:s,adapterFor:c,connectWallet:y,backToMethods:l,onPaymentSent:u}=C(),i=e.quote,v=a?.methods??[],m=v.find(z=>z.id===i?.methodId),b$1=i?.instructions.family??"eip155",N=c(b$1),S=i?na(i.instructions):"",T=s?.address??"",[f,d]=useState(false),h=Xa(i?.gasless?.paymaster&&N?.canSponsorCalls&&s?`${S}:${T}`:null,()=>N.canSponsorCalls({chainId:S,account:T})),w=i?Lt(i,{withGas:f,canSponsorCalls:h===true}):"transfer",B=Xa(i&&N&&s?`${S}:${T}:${i.instructions.token}`:null,()=>N.getBalance({chainId:S,account:T,token:i.instructions.token})),_=Xa(i&&w==="transfer"&&N?.estimateFee&&s?`${S}:${T}:${i.amountToSend}`:null,()=>N.estimateFee({instructions:i.instructions,account:T})),F=co({adapter:N,store:o,quote:i,wallet:s,path:w,paymasterUrl:e.paymasterUrl,onSent:u}),g=i?.instructions.token==="native",j=i&&typeof B=="bigint"?Rt(B,i,g&&_?_.amount:0n):null,Ba=Gr(v,i,!!j);if(!a||!i||!m)return null;let da=a.merchant.name,fa=G(S),xa=z=>`${$(z,i.decimals,n)} ${i.instructions.symbol}`,Z=Mt(i),ka=i.expiresAt?Date.parse(i.expiresAt)-r:Number.POSITIVE_INFINITY,ha=ka<=0,Ce=ht(ka),Aa=e.phase==="quoting",ae=a.invoice.amountPaid?null:Bt(i,a.invoice.totalMinor),ee=a.invoice.totalMinor?H(X(a.invoice.totalMinor),n):null,ba=!!(s&&i.payer&&ma(s,m)===i.payer),Va=b$1==="eip155"&&s&&s.chainId!==S&&!!N?.switchChain,te=F.status!=="idle"||e.phase==="submitting"||Aa,oe=Hr(t,{wallet:s?.name??"",network:fa},F.problem,e.phase==="awaitingPayment"?e.error?.code:void 0),_a=()=>{o.getState().requestQuote();},la;ha?la={label:t.pay.newPrice,run:_a}:ba?Va?la={label:b(t.pay.switchTo,{network:fa}),run:()=>{F.switchNetwork();}}:la={label:b(w==="transfer"?t.pay.payAmount:t.pay.signToPay,{amount:xa(Z.send)}),run:()=>{F.pay();},disabled:!!j}:la={label:t.pay.connect,run:()=>{y(m);}};let Qa=F.status==="switching"?"switch":F.status==="submitting"||e.phase==="submitting"?"submitting":F.status==="wallet"?w==="transfer"?"confirm":"sign":null;return jsxs("div",{className:"novapay:relative novapay:flex novapay:flex-1 novapay:flex-col",children:[jsxs("div",{inert:Qa!==null,className:"novapay:flex novapay:flex-1 novapay:flex-col",children:[jsxs("section",{className:"novapay:flex novapay:flex-1 novapay:flex-col novapay:gap-3 novapay:px-5 novapay:py-4",children:[jsx("h2",{className:"novapay:sr-only",children:t.pay.title}),s&&jsxs("div",{className:"novapay:flex novapay:items-center novapay:gap-2.5 novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:border-[var(--tuwa-border-primary)] novapay:px-3 novapay:py-2",children:[jsx("span",{className:"novapay:h-7 novapay:w-7 novapay:shrink-0",children:jsx(WalletIcon,{walletName:s.walletId})}),jsxs("span",{className:"novapay:flex novapay:min-w-0 novapay:flex-1 novapay:flex-col",children:[jsx("span",{className:"novapay:text-[13px] novapay:font-semibold",children:s.name}),jsx("span",{className:cn$1(x,"novapay:truncate novapay:text-[11px] novapay:text-[var(--tuwa-text-secondary)]"),children:b(t.pay.walletLine,{address:Y(s.address),network:G(s.chainId)})})]}),jsx("button",{type:"button","aria-label":t.pay.changeWallet,onClick:()=>y(m),className:cn$1("novapay:min-h-6 novapay:cursor-pointer novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:border-[var(--tuwa-border-primary)] novapay:bg-transparent novapay:px-2.5 novapay:py-1 novapay:text-xs novapay:font-semibold novapay:text-[var(--tuwa-text-primary)] novapay:hover:bg-[var(--tuwa-bg-muted)]",A),children:t.pay.change})]}),Va&&ba&&!ha&&jsxs("div",{role:"status",className:"novapay:flex novapay:gap-2 novapay:rounded-[var(--tuwa-rounded-corners)] novapay:bg-[var(--tuwa-pending-bg)] novapay:px-3 novapay:py-2 novapay:text-xs novapay:text-[var(--tuwa-pending-text)]",children:[jsx(ExclamationTriangleIcon,{"aria-hidden":true,className:"novapay:h-4 novapay:w-4 novapay:shrink-0"}),jsxs("span",{children:[jsx("strong",{className:"novapay:block",children:t.pay.wrongNetwork}),b(t.pay.wrongNetworkText,{current:G(s.chainId),network:fa})," ",t.pay.switchHint]})]}),jsxs("div",{children:[jsx("span",{className:"novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:t.pay.youSend}),jsxs("div",{className:"novapay:flex novapay:items-baseline novapay:gap-2",children:[jsx("span",{className:cn$1(x,"novapay:text-[28px] novapay:font-bold novapay:leading-tight"),children:$(Z.send,i.decimals,n)}),jsx("span",{className:cn$1(x,"novapay:text-sm novapay:font-semibold"),children:i.instructions.symbol}),jsx(za,{text:se(Z.send,i.decimals),label:t.pay.copyAmount,copiedLabel:t.pay.copied})]}),jsxs("span",{className:"novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:[b(t.pay.onNetwork,{network:fa}),ee&&!Z.fee&&jsxs(Fragment,{children:[" \xB7 ",b(t.pay.fiatValue,{amount:ee,currency:a.invoice.currency})]})]})]}),Z.fee&&jsxs("div",{className:"novapay:flex novapay:flex-col novapay:gap-1 novapay:rounded-[var(--tuwa-rounded-corners)] novapay:bg-[var(--tuwa-bg-secondary)] novapay:px-3 novapay:py-2",children:[jsxs("dl",{className:"novapay:m-0 novapay:flex novapay:flex-col novapay:gap-1",children:[jsx(D,{name:t.pay.invoiceTotal,children:$(Z.receives,i.decimals,n)}),jsx(D,{name:b(t.pay.transferFee,{percent:Z.fee.percent}),children:$(Z.fee.amount,i.decimals,n)}),jsx(D,{name:b(t.pay.merchantReceives,{merchant:da}),children:xa(Z.receives)})]}),jsx("p",{className:"novapay:m-0 novapay:text-[11px] novapay:text-[var(--tuwa-text-secondary)]",children:t.pay.transferFeeNote})]}),!ha&&jsxs("div",{className:"novapay:flex novapay:items-center novapay:gap-2 novapay:text-xs",children:[jsx(ClockIcon,{"aria-hidden":true,className:"novapay:h-4 novapay:w-4 novapay:text-[var(--tuwa-text-secondary)]"}),jsx("span",{role:"timer","aria-live":"off",className:"novapay:flex-1",children:b(t.pay.priceLocked,{time:ua(ka)})}),jsx(W,{onClick:_a,children:t.pay.refreshPrice})]}),Ce&&jsxs("div",{className:"novapay:flex novapay:flex-col novapay:gap-2 novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:border-[var(--tuwa-text-accent)] novapay:px-3 novapay:py-2",children:[jsx("span",{"aria-hidden":true,className:"novapay:text-xs",children:b(t.pay.priceEnding,{time:ua(ka)})}),jsx("span",{role:"status",className:"novapay:sr-only",children:b(t.pay.priceEnding,{time:ua(Be)})}),jsx("button",{type:"button",onClick:_a,disabled:Aa,className:cn$1(x,"novapay:min-h-8 novapay:cursor-pointer novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border-0 novapay:bg-[var(--tuwa-button-primary-bg)] novapay:px-3 novapay:text-xs novapay:font-bold novapay:text-[var(--tuwa-text-on-accent)] novapay:disabled:opacity-70",A),children:b(t.pay.keepPrice,{minutes:Math.round(a.quoteTtlSeconds/60)})})]}),ha&&jsx(J,{children:t.pay.priceExpired}),j&&!ha&&jsxs("div",{className:"novapay:flex novapay:flex-col novapay:gap-2 novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:border-[var(--tuwa-border-primary)] novapay:px-3 novapay:py-2 novapay:text-xs",children:[jsxs("div",{role:"alert",children:[jsx("strong",{className:"novapay:block",children:t.pay.notEnough}),b(t.pay.walletHas,{amount:xa(j.have),network:fa}),"."," ",b(t.pay.shortBy,{short:xa(j.short),need:xa(j.need)})]}),Ba.length>0&&jsxs("div",{className:"novapay:flex novapay:flex-col novapay:gap-1.5",children:[jsx("span",{className:"novapay:text-[var(--tuwa-text-secondary)]",children:t.pay.payFromBalance}),Ba.map(({method:z,balance:Ke})=>jsxs("button",{type:"button",onClick:()=>{let Ve=s?ma(s,z):null;o.getState().selectMethod(z.id),o.getState().setPayer(Ve),o.getState().requestQuote();},className:cn$1("novapay:flex novapay:cursor-pointer novapay:items-center novapay:justify-between novapay:gap-2 novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:border-[var(--tuwa-border-primary)] novapay:bg-transparent novapay:px-2.5 novapay:py-1.5 novapay:text-left novapay:text-xs novapay:text-[var(--tuwa-text-primary)] novapay:hover:bg-[var(--tuwa-bg-muted)]",A),children:[jsxs("span",{className:"novapay:font-semibold",children:[z.symbol," \xB7 ",G(z.chainId)]}),jsx("span",{className:cn$1(x,"novapay:text-[var(--tuwa-text-secondary)]"),children:b(t.pay.youHave,{amount:`${$(String(Ke),z.decimals,n)} ${z.symbol}`})})]},z.id))]}),a.merchant.fundingUrl&&jsxs("span",{children:[b(t.pay.topUp,{symbol:i.instructions.symbol})," ",jsxs("a",{href:a.merchant.fundingUrl,target:"_blank",rel:"noopener noreferrer",className:cn$1("novapay:text-[var(--tuwa-text-accent)] novapay:underline",A),children:[b(t.pay.getToken,{symbol:i.instructions.symbol})," \u2197"]})]})]}),jsxs("dl",{className:"novapay:m-0 novapay:flex novapay:flex-col novapay:gap-1.5 novapay:border-t novapay:border-[var(--tuwa-border-primary)] novapay:pt-3",children:[ae!==null&&jsx(D,{name:t.pay.rate,children:b(t.pay.rateValue,{symbol:i.instructions.symbol,price:Ur(ae,n),currency:a.invoice.currency})}),jsx(D,{name:t.pay.networkFee,children:w!=="transfer"?jsx("span",{className:"novapay:text-[var(--tuwa-success-text)]",children:b(t.pay.merchantPaysGas,{merchant:da})}):_?b(t.pay.gasEstimate,{amount:`${$(String(_.amount),_.decimals,n)} ${_.symbol}`}):t.pay.gasFromWallet}),jsxs(D,{name:t.pay.to,children:[Y(i.instructions.to)," ",jsx("span",{className:"novapay:font-sans novapay:text-[var(--tuwa-text-secondary)]",children:da})]})]}),oe&&jsx(J,{children:oe})]}),jsxs(K,{children:[jsx(U,{busy:te,disabled:la.disabled,onClick:la.run,children:la.label}),jsxs("div",{className:"novapay:flex novapay:items-center novapay:justify-between novapay:gap-3",children:[jsx(W,{onClick:l,children:t.pay.back}),i.gasless&&jsx(W,{onClick:()=>d(!f),children:f?b(t.pay.payGasless,{merchant:da}):t.pay.payWithGas})]}),jsx("p",{className:"novapay:m-0 novapay:text-[11px] novapay:text-[var(--tuwa-text-secondary)]",children:b(t.pay.disclaimer,{merchant:da})})]})]}),Qa&&jsx(ce,{kind:Qa,walletName:s?.name??"",walletId:s?.walletId??"",amount:xa(Z.send),merchant:da,network:fa,to:Y(i.instructions.to),priceTime:ha?null:ua(ka),onRetry:w==="relay"?()=>{F.pay();}:void 0,onCancel:F.dismiss})]})}var $e=4;function uo(a){let{size:e,data:o}=encode(a,{ecc:"M",border:0}),t="";return o.forEach((n,r)=>n.forEach((s,c)=>{s&&(t+=`M${c+$e} ${r+$e}h1v1h-1z`);})),{size:e+$e*2,path:t}}function Ue({value:a,label:e,className:o}){let{size:t,path:n}=useMemo(()=>uo(a),[a]);return jsxs("svg",{role:"img","aria-label":e,viewBox:`0 0 ${t} ${t}`,shapeRendering:"crispEdges",className:cn$1("novapay:block novapay:rounded-[var(--tuwa-rounded-corners)]",o),children:[jsx("rect",{width:t,height:t,fill:"#ffffff"}),jsx("path",{d:n,fill:"#111827"})]})}function Zr({payUrl:a}){let{labels:e,backToMethods:o}=C();return jsxs(Fragment,{children:[jsx(ya,{title:e.qr.handoffTitle,subtitle:e.qr.handoffHint,children:jsxs("div",{className:"novapay:flex novapay:flex-col novapay:items-center novapay:gap-3 novapay:py-2",children:[jsx(Ue,{value:a,label:e.qr.handoffCode,className:"novapay:h-48 novapay:w-48"}),jsx(za,{text:a,label:e.qr.copyLink,copiedLabel:e.pay.copied,children:e.qr.copyLink}),jsx("p",{className:"novapay:m-0 novapay:max-w-xs novapay:text-center novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:e.qr.handoffNote})]})}),jsx(K,{children:jsx(W,{onClick:o,children:e.qr.back})})]})}function yo(){let{checkout:a,state:e,store:o,labels:t,locale:n,now:r,payUrl:s,backToMethods:c}=C(),y=e.quote;if(!a)return null;if(!y||y.instructions.family!=="solana")return s?jsx(Zr,{payUrl:s}):null;let{instructions:l}=y,u=G(na(l)),i=`${$(y.amountToSend,y.decimals,n)} ${l.symbol}`,v=y.expiresAt?Date.parse(y.expiresAt)-r:Number.POSITIVE_INFINITY,m=v<=0,b$1=e.phase==="quoting";return jsxs(Fragment,{children:[jsxs(ya,{title:t.qr.solanaTitle,subtitle:t.qr.solanaHint,children:[jsxs("div",{className:"novapay:flex novapay:flex-col novapay:items-center novapay:gap-4 novapay:sm:flex-row novapay:sm:items-start",children:[jsx(Ue,{value:l.solanaPayUrl,label:b(t.qr.solanaCode,{amount:i}),className:cn$1("novapay:h-44 novapay:w-44 novapay:shrink-0",m&&"novapay:opacity-30")}),jsxs("div",{className:"novapay:flex novapay:min-w-0 novapay:flex-col novapay:gap-2 novapay:text-xs",children:[jsxs("ol",{className:"novapay:m-0 novapay:flex novapay:list-decimal novapay:flex-col novapay:gap-1 novapay:pl-4",children:[jsx("li",{children:t.qr.scanStep}),jsx("li",{children:t.qr.approveStep})]}),jsxs("div",{className:"novapay:flex novapay:items-baseline novapay:gap-2",children:[jsx("span",{className:cn$1(x,"novapay:text-2xl novapay:font-bold"),children:$(y.amountToSend,y.decimals,n)}),jsx(za,{text:se(y.amountToSend,y.decimals),label:t.pay.copyAmount,copiedLabel:t.pay.copied})]}),jsxs("span",{className:cn$1(x,"novapay:text-[var(--tuwa-text-secondary)]"),children:[l.symbol," \xB7 ",u," \xB7 ",Y(l.to)]}),!m&&jsxs(Fragment,{children:[jsxs("span",{role:"status",className:"novapay:flex novapay:items-center novapay:gap-1.5",children:[jsx(ArrowPathIcon,{"aria-hidden":true,className:"novapay:h-3.5 novapay:w-3.5 novapay:animate-spin novapay:motion-reduce:animate-none"}),t.qr.waiting]}),jsx("span",{role:"timer","aria-live":"off",className:"novapay:text-[var(--tuwa-text-secondary)]",children:b(t.pay.priceLocked,{time:ua(v)})})]})]})]}),m&&jsx(J,{children:t.pay.priceExpired}),jsxs("p",{className:"novapay:m-0 novapay:flex novapay:gap-2 novapay:rounded-[var(--tuwa-rounded-corners)] novapay:bg-[var(--tuwa-pending-bg)] novapay:px-3 novapay:py-2 novapay:text-xs novapay:text-[var(--tuwa-pending-text)]",children:[jsx(ExclamationTriangleIcon,{"aria-hidden":true,className:"novapay:h-4 novapay:w-4 novapay:shrink-0"}),t.qr.exchangeWarning]})]}),jsxs(K,{children:[m?jsx(U,{busy:b$1,onClick:()=>{o.getState().requestQuote();},children:t.pay.newPrice}):jsx("a",{href:l.solanaPayUrl,className:cn$1(x,"novapay:inline-flex novapay:h-11 novapay:items-center novapay:justify-center novapay:rounded-[var(--tuwa-rounded-corners)] novapay:bg-[var(--tuwa-button-primary-bg)] novapay:text-sm novapay:font-bold novapay:text-[var(--tuwa-text-on-accent)] novapay:no-underline novapay:hover:bg-[var(--tuwa-button-primary-bg-hover)]",A),children:t.qr.openInWallet}),jsx(W,{onClick:c,children:t.qr.back})]})]})}function ss(){let{labels:a}=C();return jsxs("div",{role:"status",className:"novapay:flex novapay:flex-1 novapay:flex-col novapay:items-center novapay:justify-center novapay:gap-3 novapay:p-8 novapay:text-sm novapay:text-[var(--tuwa-text-secondary)]",children:[jsx(ArrowPathIcon,{"aria-hidden":true,className:"novapay:h-6 novapay:w-6 novapay:animate-spin novapay:motion-reduce:animate-none"}),a.common.loading]})}function ps(){let{labels:a,state:e,store:o}=C(),t=e.error?.code==="checkout_not_found";return jsxs("div",{role:"alert",className:"novapay:flex novapay:flex-1 novapay:flex-col novapay:items-center novapay:justify-center novapay:gap-3 novapay:p-8 novapay:text-center",children:[jsx(ExclamationTriangleIcon,{"aria-hidden":true,className:"novapay:h-7 novapay:w-7 novapay:text-[var(--tuwa-error-icon)]"}),jsx("h2",{className:cn$1(x,"novapay:m-0 novapay:text-base novapay:font-bold"),children:a.error.title}),jsx("p",{className:"novapay:m-0 novapay:max-w-sm novapay:text-[13px] novapay:text-[var(--tuwa-text-secondary)]",children:t?a.error.notFound:a.error.generic}),!t&&jsx("button",{type:"button",onClick:()=>{o.getState().load();},className:cn$1(x,"novapay:h-9 novapay:cursor-pointer novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border-0 novapay:bg-[var(--tuwa-standart-button-bg)] novapay:px-4 novapay:text-xs novapay:font-bold novapay:text-[var(--tuwa-text-primary)] novapay:hover:bg-[var(--tuwa-standart-button-hover)]",A),children:a.common.retry})]})}function is(){let{screen:a}=C();return a==="loading"?jsx(ss,{}):a==="error"?jsx(ps,{}):a==="buyer"?jsx(vt,{}):a==="method"?jsx($t,{}):a==="pay"?jsx(lo,{}):a==="qr"?jsx(yo,{}):a==="confirm"?jsx(Ft,{}):a==="paid"?jsx(Qt,{}):a==="autoPay"?jsx(it,{}):jsx(Ut,{kind:a})}function cs({className:a,withDetails:e,leave:o}){let{checkout:t,locale:n,labels:r,now:s}=C(),[c,y]=useState(""),l=useRef(null),u=t?.invoice.dueAt?Date.parse(t.invoice.dueAt):null;return useEffect(()=>{if(u===null)return;let i=u-s,v=xt(l.current,i);l.current=i,v!==null&&y(v===1?r.summary.oneMinuteLeft:b(r.summary.minutesLeft,{minutes:v}));},[u,s,r]),jsxs("div",{lang:n,className:cn$1("novapay:relative novapay:flex novapay:w-full novapay:flex-col novapay:overflow-hidden novapay:bg-[var(--tuwa-bg-primary)] novapay:text-[var(--tuwa-text-primary)] novapay:sm:h-[600px] novapay:sm:w-[760px] novapay:sm:flex-row",a),children:[t&&jsx("aside",{className:"novapay:hidden novapay:w-[286px] novapay:shrink-0 novapay:border-r novapay:border-[var(--tuwa-border-primary)] novapay:bg-[var(--tuwa-bg-secondary)] novapay:p-5 novapay:sm:block",children:jsx(Ct,{})}),jsxs("div",{className:"novapay:flex novapay:min-h-0 novapay:min-w-0 novapay:flex-1 novapay:flex-col",children:[jsx(Tt,{withDetails:e}),jsxs("div",{className:"novapay:sm:hidden",children:[t&&jsx(Pt,{}),jsx(At,{withDetails:e})]}),jsx("div",{className:"novapay:flex novapay:min-h-0 novapay:flex-1 novapay:flex-col novapay:overflow-y-auto",children:jsx(is,{})})]}),jsx("div",{role:"status","aria-live":"polite",className:"novapay:sr-only",children:c}),o&&jsx(Dt,{onStay:o.onStay,onLeave:o.onLeave})]})}function yu({token:a,display:e="modal",open:o=true,onOpenChange:t,onClose:n,baseUrl:r,api:s,EventSource:c,pollMs:y,payUrl:l,onConnectWallet:u,onPaid:i,autoReturnSeconds:v=5,onContact:m,className:b$1}){let N=we(),[S,T]=useState({from:a,token:a}),f=S.from===a?S.token:a,d=zt({token:f,baseUrl:r??N.baseUrl,api:s,EventSource:c,pollMs:y}),h=Yt(d,Q=>Q),w=h.checkout,B=h.locale??w?.invoice.locale??"en",_=oo(B),F=Jt(1e3,!!w),g=Zt(),j=ro(u),Ba=N.adapters,[da,fa]=useState("wallet"),[xa,Z]=useState(false),[ka,ha]=useState(false),[Ce,Aa]=useState(false),[ae,ee]=useState(f);ae!==f&&(ee(f),Z(false),ha(false),fa("wallet"));let ba=useRef(null),Va=dt(h,{payWith:da,handoff:xa,autoPay:ka});Vt(h.phase,w?.invoice,i);let te=Q=>Ba?.find(Ra=>Ra.family===Q),oe=to({store:d,open:e!=="modal"||o,adapterFor:te,pulsar:N.pulsar,labels:_,locale:B}),_a=useEffectEvent(()=>{if(!g||!w)return;let{quote:Q,phase:Ra}=d.getState();if(ba.current){let ne=w.methods.find(fo=>fo.id===ba.current),Qe=ne?ma(g,ne):null;if(!Qe)return;ba.current=null,d.getState().setPayer(Qe),d.getState().requestQuote();return}if(Ra!=="awaitingPayment"||!Q?.payer)return;let ja=w.methods.find(ne=>ne.id===Q.methodId),Pe=ja?ma(g,ja):null;if(Pe!==Q.payer){if(!Pe)return d.getState().releaseQuote();d.getState().setPayer(Pe),d.getState().requestQuote();}});useEffect(()=>_a(),[g?.address,g?.chainId,g?.connectorType]),useEffect(()=>{j.connecting||(ba.current=null);},[j.connecting]);let[la,Qa]=useState(false);Va==="buyer"&&!la&&Qa(true);let z=useMemo(()=>e==="modal"?()=>t?t(false):n?.():n,[e,t,n]),_e=jsx(Ze,{value:{store:d,state:h,checkout:w,screen:Va,locale:B,labels:_,now:F,close:z&&(()=>Ae(d.getState().phase)?Aa(true):z()),wallet:g,payWith:da,setPayWith:fa,payUrl:l,connectWallet:Q=>{let Ra=aa(Q);ba.current=Q.id;let ja=Ra!==null&&j.connect(Ra);return ja||(ba.current=null),ja},adapterFor:te,handoff:xa,setHandoff:Z,backToMethods:()=>{Z(false),d.getState().releaseQuote();},onPaymentSent:oe,autoPay:ka,setAutoPay:ha,openInvoice:Q=>T({from:a,token:Q}),onContact:m,autoReturnSeconds:v},children:jsx(MotionConfig,{reducedMotion:"user",children:jsx(cs,{withDetails:la,leave:Ce?{onStay:()=>Aa(false),onLeave:()=>{Aa(false),d.getState().releaseQuote(),z?.();}}:null,className:e==="modal"?b$1:void 0})})});return e==="modal"?jsx(Dialog,{open:o,onOpenChange:Q=>{if(!Q&&Ae(d.getState().phase))return Aa(true);t?.(Q),Q||n?.();},children:jsxs(DialogContent,{className:"novapay:w-full novapay:sm:w-auto",children:[jsx(DialogTitle,{className:"novapay:sr-only",children:b(_.common.dialogTitle,{merchant:w?.merchant.name??""})}),_e]})}):jsx("section",{"aria-label":b(_.common.dialogTitle,{merchant:w?.merchant.name??""}),className:cn$1("novapay:w-full novapay:overflow-hidden novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:border-[var(--tuwa-border-primary)] novapay:sm:w-[760px]",e==="page"&&"novapay:mx-auto novapay:my-8",b$1),children:_e})}function Fu({baseUrl:a,labels:e,customization:o,adapters:t,pulsar:n,children:r}){let s=useMemo(()=>({baseUrl:a,labels:e,customization:o,adapters:t,pulsar:n}),[a,e,o,t,n]);return jsx(ge.Provider,{value:s,children:r})}export{it as AutoPayScreen,vt as BuyerScreen,Ie as CheckoutContext,Ze as CheckoutContextProvider,Tt as CheckoutHeader,Re as CheckoutStepper,Ct as CheckoutSummary,Pt as CompactSummary,Ft as ConfirmScreen,Zo as DEADLINE_ANNOUNCEMENTS,sn as DeadlineTimer,Dt as LeaveDialog,It as LocaleSwitcher,Fe as MerchantBadge,$t as MethodScreen,At as MobileSteps,ge as NovaPaymentsContext,Fu as NovaPaymentsProvider,kt as OrderLines,pn as OrderTotal,Ut as OutcomeScreen,Qt as PaidScreen,lo as PayScreen,yu as PaymentCheckout,Be as QUOTE_WARNING_MS,yo as QrScreen,wt as SellerDetailsContent,cn as SummaryFooter,ce as WalletPrompt,nt as autoPayTerms,Rt as balanceShortfall,se as baseUnitsToDecimal,Ee as buyerFields,lt as buyerIssues,et as canPayWithQr,dt as checkoutScreen,Me as checkoutSteps,ut as cleanBuyer,at as connectedWallet,ot as contactHref,mt as countryOptions,xt as deadlineAnnouncement,ua as formatCountdown,H as formatFiat,rt as formatPeriod,$ as formatTokenAmount,ft as groupMethodsByToken,eo as handOverPayment,na as instructionsChainId,ue as invoiceTotals,ht as isQuoteEnding,pe as methodErrorText,aa as methodFamily,tt as methodToken,X as minorToDecimal,Ae as needsLeaveConfirm,G as networkName,po as payInvoice,Lt as payPath,ma as payerFor,Te as priceAdjustment,uo as qrPath,Mt as quoteAmounts,Bt as quoteRate,Y as shortAddress,ao as shouldHandOver,st as underpaidRest,Xa as useAsyncValue,_t as useAutoReturn,C as useCheckoutContext,Yt as useCheckoutState,zt as useCheckoutStore,Zt as useConnectedWallet,we as useNovaPayments,Jt as useNow,Vt as usePaidCallback,co as usePayment,de as usePaymentFacts,to as usePaymentHandOver,oo as usePaymentsLabels,ro as useWalletConnection,So as walletLabel};
|
|
1
|
+
import {c,b,e,h,g,i,j,f,d}from'./chunk-EMYW4LI7.js';import {b as b$1,a}from'./chunk-7HSDAUKN.js';export{a as PaymentWalletError,b as walletErrorKind}from'./chunk-7HSDAUKN.js';import {getChainName,cn,DrawnCheck,CloseIcon,MorphText,WalletIcon,Dialog,DialogContent,DialogTitle,TokenIcon,QuasarLoader,StatusEdge,NetworkIcon,NovaSetIcon,CopyIcon,useNovaIcons,DrawnCross,pixelFlight}from'@tuwaio/nova-core';import {createContext,lazy,useState,useEffectEvent,useEffect,useContext,useId,useRef,useMemo,Fragment as Fragment$1,useCallback,Suspense,useLayoutEffect}from'react';import {formatBaseUnits,parseCaip2ChainId,toCaip2ChainId,formatCaip10AccountId,toEvmChainId,parseCaip19AssetId,parseCaip10AccountId,shortAddress,OrbitAdapter,getAdapterFromConnectorType,getConnectorTypeFromName,formatConnectorName,getSolanaCluster,isSameAddress,delay}from'@tuwaio/orbit-core';export{shortAddress}from'@tuwaio/orbit-core';import {HashLink,TxProgressIndicator,TxStatusVisual}from'@tuwaio/nova-transactions';import {jsxs,jsx,Fragment}from'react/jsx-runtime';import {useLabels,NovaTransactionsLabelsProvider}from'@tuwaio/nova-transactions/providers';import {LockClosedIcon,FingerPrintIcon,QrCodeIcon,DevicePhoneMobileIcon,ArrowDownTrayIcon,NoSymbolIcon,ArrowPathRoundedSquareIcon,ArrowUturnLeftIcon,MagnifyingGlassIcon}from'@tuwaio/nova-icons/24/outline';import {MotionConfig,AnimatePresence}from'framer-motion';import {createCheckoutStore}from'@tuwaio/quasar-sdk/checkout';import {useStore}from'zustand';import {SatelliteStoreContext}from'@tuwaio/satellite-react';import {createStore}from'zustand/vanilla';import {NovaConnectProviderContext}from'@tuwaio/nova-connect/hooks';import {encode}from'uqr';function Ot(e,t){let[a,n]=useState(null),o=useEffectEvent(t);return useEffect(()=>{if(e===null)return;let r=true,s;try{s=Promise.resolve(o());}catch(i){s=Promise.reject(i);}return s.then(i=>r&&n({key:e,value:i}),()=>r&&n({key:e,value:null})),()=>{r=false;}},[e]),a&&a.key===e?a.value:void 0}function ua(e,t,a){let[n,o]=useState(0),[r,s]=useState(null),i=useEffectEvent(t);return useEffect(()=>{if(e===null||typeof window>"u")return;let c=()=>{document.visibilityState!=="hidden"&&o(d=>d+1);},l=window,p=document;return l.addEventListener("focus",c),p.addEventListener("visibilitychange",c),()=>{l.removeEventListener("focus",c),p.removeEventListener("visibilitychange",c);}},[e]),useEffect(()=>{if(e===null)return;let c=true,l;try{l=Promise.resolve(i());}catch(p){l=Promise.reject(p);}return l.then(p=>c&&s({key:e,value:p}),()=>c&&s({key:e,value:null})),()=>{c=false;}},[e,n,a]),r&&r.key===e?r.value:void 0}var ma=createContext(null),or=ma.Provider;function O(){let e=useContext(ma);if(!e)throw new Error("useCheckoutContext must be used inside PaymentCheckout");return e}function Ke(){return useContext(ma)}function sr(e){return e.closest("[data-novapay-scroll]")??null}function Zc(e,t){let a=t?.offsetHeight;return a&&a>0?Math.min(e,a):e}function Jc(e){let t=e.offsetHeight;return t>0?Zc(t,sr(e)):null}function pn(e){let[t,a]=useState(null),[n,o]=useState(null),[r,s]=useState(null);return useEffect(()=>{if(!t)return;let i=sr(t),c=()=>{if(!e){let d=Jc(t);d!==null&&o(d);}let p=i?.offsetHeight;s(p&&p>0?p:null);};if(c(),typeof ResizeObserver>"u")return;let l=new ResizeObserver(c);return e||l.observe(t),i&&l.observe(i),()=>l.disconnect()},[t,e]),!e||n===null?[a,null]:[a,r?Math.min(n,r):n]}function _e(e,t=2){let a=e.startsWith("-"),n=(a?e.slice(1):e).padStart(t+1,"0");return `${a?"-":""}${n.slice(0,-t)}.${n.slice(-t)}`}var ir=e=>new Intl.NumberFormat(e).formatToParts(1.1).find(t=>t.type==="decimal")?.value??".";function ke(e,t){let[a="0",n=""]=(typeof e=="number"?e.toFixed(2):e.trim()).split("."),o=a.startsWith("-"),r=new Intl.NumberFormat(t).format(BigInt(o?a.slice(1):a));return `${o?"-":""}${r}${ir(t)}${n.padEnd(2,"0").slice(0,2)}`}function ue(e,t,a){let n=BigInt(e),o=n<0n,r=o?-n:n,s=10n**BigInt(t),i=new Intl.NumberFormat(a).format(r/s),c=(r%s).toString().padStart(t,"0").replace(/0+$/,"").padEnd(2,"0");return `${o?"-":""}${i}${ir(a)}${c}`}function da(e,t,a){let n=10n**BigInt(Math.max(t-6,0)),o=(BigInt(e)+n/2n)/n*n;return o===0n?null:ue(o.toString(),t,a)}function ya(e,t){return formatBaseUnits(e,t)??"0"}var jt=e=>String(e).padStart(2,"0");function st(e){let t=Math.max(0,Math.floor(e/1e3)),a=Math.floor(t/86400),n=Math.floor(t%86400/3600),o=Math.floor(t%3600/60),r=t%60;return a>0?`${a}d ${jt(n)}:${jt(o)}`:n>0?`${jt(n)}:${jt(o)}:${jt(r)}`:`${jt(o)}:${jt(r)}`}var cr={metamask:"MetaMask",walletconnect:"WalletConnect",coinbase:"Coinbase Wallet",okx:"OKX Wallet",trust:"Trust Wallet",injected:"Browser wallet"};function ll(e,t){let a=e.slice(e.indexOf(":")+1).toLowerCase();return a==="injected"?cr.injected:t?.trim()||cr[a]||a.charAt(0).toUpperCase()+a.slice(1)}var lo=e=>/^data:image\//i.test(e)||/^https:\/\//i.test(e),co=e=>{let t=typeof e=="string"?e.trim():"";return t&&lo(t)?t:void 0};function pl(e,t,a){let n=getAdapterFromConnectorType(t),o=e[n];if(!Array.isArray(o))return;let r=o.filter(s=>typeof s=="object"&&s!==null&&typeof s.name=="string"&&getConnectorTypeFromName(n,formatConnectorName(s.name))===t);return a&&r.find(s=>co(s.icon)===a)||r[0]}var un=e=>{let t=parseCaip2ChainId(e)?.namespace;return t==="eip155"||t==="solana"?t:null};function lr(e,t){if(!e?.address)return null;let a=toCaip2ChainId(e.chainId),n=a?un(a):null;if(!a||!n)return null;let o=co(e.icon),r=t?pl(t,e.connectorType,o):void 0;return {address:e.address,chainId:a,family:n,connectorType:e.connectorType,walletId:e.connectorType.slice(e.connectorType.indexOf(":")+1).toLowerCase(),name:ll(e.connectorType,typeof r?.name=="string"?r.name:void 0),icon:o??co(r?.icon),connection:e}}function We(e){return un(e.chainId)}function Ge(e,t){return !e||e.family!==We(t)?null:formatCaip10AccountId(t.chainId,e.address)??null}function pr(e,t){let a=We(e);return a==="solana"||a==="eip155"&&!!t}function po(e){let t=a=>String(Number((a/100).toFixed(2)));return e.discountBps>0?{kind:"discount",percent:t(e.discountBps)}:e.markupBps>0?{kind:"markup",percent:t(e.markupBps)}:null}function de(e){return getChainName(toEvmChainId(e)??e).name}function ur(e){let t=e.assetId?parseCaip19AssetId(e.assetId):void 0;return !t||t.assetNamespace==="slip44"?"native":t.assetReference}var ul=new Set(["awaitingPayment","selectMethod","underpaid"]),ml="too_many_payments",dr=e=>e==="selectMethod"||e==="awaitingPayment",mr=e=>e?.status==="active"&&!!e.replacement;function uo(e,t={}){if(t.labelsReady===false&&e.phase!=="error")return "loading";if(t.autoPayOff&&e.checkout?.autoCharge?.status==="active")return "autoPayOff";if(e.phase==="unconfirmed")return Ft(e.error)==="retrying"?"confirm":"unconfirmed";if(t.afterFailure&&e.error?.code==="payment_failed"&&ul.has(e.phase))return "failed";let a=e.payerProof==="required"||e.payerProof==="confirming"||e.payerProof==="confirmed"&&!e.error,n=!!(t.confirmWallet&&a);switch(e.phase){case "selectMethod":return t.autoPay&&mr(e.checkout?.autoCharge)?"autoPay":n&&!(t.handoff&&t.payWith==="qr")?"confirmWallet":t.handoff&&t.payWith==="qr"?"qr":"method";case "underpaid":return n?"confirmWallet":"underpaid";case "quoting":return e.quote?t.payWith==="qr"||e.quote.payer===null?"qr":"pay":t.confirmWallet?"confirmWallet":"method";case "awaitingPayment":if(t.autoPay&&mr(e.checkout?.autoCharge))return "autoPay";case "submitting":return e.phase==="submitting"&&!e.quote?"confirm":t.payWith==="qr"||e.quote?.payer===null?"qr":"pay";case "confirming":return "confirm";case "paid":return t.autoPay&&e.checkout?.autoCharge?.status==="available"?"autoPay":"paid";case "cancelled":return e.checkout?.invoice.replacedBy?"replaced":"cancelled";default:return e.phase}}var dl={buyer:"details",method:"method",confirmWallet:"method",pay:"pay",qr:"pay",underpaid:"pay",confirm:"confirm",unconfirmed:"confirm",failed:"confirm",autoPay:"autoPay"};function yr(e,t={}){let a=dl[e];if(!a)return null;let n=[...t.withDetails||a==="details"?["details"]:[],"method","pay","confirm",...a==="autoPay"?["autoPay"]:[]],o=n.indexOf(a);return n.map((r,s)=>({key:r,state:s<o?"done":s===o?"current":"upcoming"}))}function fr(e={}){return [...e.withDetails?["details"]:[],"method","pay","confirm"].map(a=>({key:a,state:"done"}))}function vr(e,t){let a=s=>s.chainId===t?0:s.featured?1:2,n=new Map;for(let s of e)n.set(s.symbol,[...n.get(s.symbol)??[],s]);let o=[...n].map(([s,i])=>{let c=[...i].sort((l,p)=>a(l)-a(p));return {symbol:s,methods:c,featured:i.some(l=>l.featured),inWallet:!!t&&i.some(l=>l.chainId===t)}}),r=s=>s.inWallet?0:s.featured?1:2;return o.sort((s,i)=>r(s)-r(i))}var yl=new Set(["open","processing","underpaid"]),fl=new Set(["loading","error","buyer","method","confirmWallet","pay","qr","failed","underpaid","blocked"]);function Un(e,t,a){return yl.has(e)?t==="confirm"||t==="unconfirmed"?"confirming":fl.has(t)?e==="underpaid"&&a===false?"closed":"paying":null:null}var vl=[10,5,1];function hr(e,t,a=vl){if(e===null||t<=0)return null;let n=a.filter(o=>e>o*6e4&&t<=o*6e4);return n.length?Math.min(...n):null}var mo=6e4;function xr(e){let{autoPayOffOpen:t,phase:a,quotePayer:n,payer:o}=e;return t||a!=="awaitingPayment"||!n||o===n?"keep":o?"lock":"release"}function gr(e){let{open:t,storePayer:a,payer:n,paysRest:o}=e;return !t||n===a?"keep":n&&o?"follow":"leave"}function br(e){return e>0&&e<=mo}function wr(e){return e.amlScreening!==false}function it(e){return e.paymentOnTheWay??!!(e.txKey||e.txHash)}function gt(e,t){let a=t?.invoice?.pendingPayments??0;return e.invoicePaymentOnTheWay??a>0}function kr({state:e,checkout:t,handedOverAt:a,dueAt:n}){let o=e.paymentSentInTime,r=it({paymentOnTheWay:e.paymentOnTheWay,txKey:e.txKey??null,txHash:e.txHash??null});if(typeof o=="boolean"&&r)return o;let s=t.invoice.paymentCountsUntil;return s===void 0?a!==null&&a<n:a!==null&&a>=n?false:(e.paymentCountsUntil===void 0?s:e.paymentCountsUntil)!==null}var yo="settlement_failed",Cr="tx_already_used";function Pr(e){let t=e?.code,a=e?.reason;return (t==="payment_failed"||t==="payment_mismatch")&&!!a&&a!==yo}var hl=new Set(["no_matching_transfer","reference_missing","too_early","tx_already_used","payer_mismatch","payer_unconfirmed","quote_changed","too_many_parts","too_many_transfers","below_minimum","native_from_contract_unverifiable","invoice_not_payable"]);function bt(e){let t=e?.code,a=e?.reason;return a===yo?false:t==="payment_mismatch"?true:t==="payment_failed"&&a!==void 0&&hl.has(a)}function Sr(e){let t=e?.reason;return bt(e)&&t===Cr}function Yt(e,t){let a=t?.invoice?.unresolvedPayments??0;return e.invoicePaymentUnresolved??a>0}function Ft(e){let t=e?.code,{reason:a,rechecked:n,stillRead:o}=e??{};return t==="payment_failed"&&a==="unresolved_after_24h"?"closed":a===yo&&(t==="payment_unconfirmed"||t==="payment_mismatch")?n===true?"settlementRetrying":"settlementFailed":t!=="payment_unconfirmed"?null:a==="nonce_spent_unexplained"?"nonceSpent":a==="unmined_after_24h"||o===true?"unmined":a===Cr?"takenElsewhere":a==="submit_retrying"?"retrying":a==="submit_failed"?"notReceived":a===ml?"invoiceFull":n===true?"rechecked":"contact"}function Nr(e,t){let{txKey:a}=e.error??{};if(a)return a;let n=t?.invoice?.rejectedPayments;return e.txHash??e.txKey??n?.[0]?.txKey??null}function Tr({picked:e,page:t,invoice:a}){return e&&e.page===t?e.locale:t??a??"en"}function Ir(e,t){return e.supportEmail?`mailto:${e.supportEmail}?subject=${encodeURIComponent(t)}`:e.website??null}var Rr={nonceSpent:"unconfirmedNonceSpent",closed:"unconfirmedClosed",takenElsewhere:"unconfirmedTakenElsewhere",settlementRetrying:"unconfirmedSettlementRetrying",settlementFailed:"unconfirmedSettlementFailed",invoiceFull:"unconfirmedInvoiceFull"};function Hn(e,t,a){let n=e.reason;return n==="expired"?t.pay.failedExpired:n==="cancelled"?t.pay.failedCancelled:n==="reverted"?a?c(t.pay.failed,{network:a}):t.method.paymentFailed:t.pay.didNotGoThrough}function fa(e){if(e?.code!=="payment_failed"&&e?.code!=="payment_mismatch")return null;let{txKey:t}=e;return typeof t=="string"&&t?t:null}var gl=new Set(["payer_mismatch","payer_unconfirmed"]);function Zt(e,t,a=""){if(bt(e)){let r=e.reason??"",s=e.held===true;if(r==="quote_changed")return c(t.pay.mismatchChargeHeld,{merchant:a});if(r==="too_many_parts")return c(t.pay.mismatchTooManyParts,{merchant:a});if(r==="reference_missing"&&s)return c(t.pay.mismatchNoReferenceHeld,{merchant:a});let i=gl.has(r)?s?t.pay.mismatchOtherWalletHeld:t.pay.mismatchOtherWallet:s?t.pay.mismatchHeldElsewhere:Sr(e)?t.pay.mismatchTakenElsewhere:t.pay.mismatch;return c(i,{merchant:a})}let n=Ft(e),o=n?Rr[n]:void 0;return o?c(t.outcome[o],{merchant:a}):null}var bl=["buyer","selectMethod","quoting","awaitingPayment"];function fo(e,t,a){if(a==="underpaid")return false;let n=Ft(t);return bl.includes(e)&&!bt(t)&&!(n&&Rr[n])}function mn(e,t,a=""){let n=Zt(e,t,a);if(n!==null)return n;switch(e.code){case "screening_unavailable":return t.pay.screeningUnavailable;case "request_failed":return t.pay.noAnswer;case "amount_out_of_range":case "method_not_found":case "testnet_required":return t.method.methodUnavailable;case "payer_not_expected":return t.method.payerNotExpected;case "too_many_payments":return c(t.method.tooManyPayments,{merchant:a});case "too_many_payers":return c(t.method.tooManyPayers,{merchant:a});case "native_from_contract":return t.method.nativeFromSmartWallet;case "rate_limited":return t.method.rateLimited;case "price_unavailable":case "price_no_rpc":return t.method.priceUnavailable;case "consent_required":return t.method.consentRequired;case "payer_proof_required":case "payer_proof_declined":return t.payerProof.text;case "payer_proof_invalid":return t.payerProof.invalid;case "payer_proof_unavailable":return t.payerProof.unavailable;case "payment_failed":return Hn(e,t);case "rest_method_mismatch":return t.method.restSameMethod;default:return t.error.generic}}function vo(e){return e?.status==="available"?e:e?.status==="active"?e.replacement??null:null}function Er(e,t){let a=vo(e);if(!a)return null;let n=t.find(i=>i.id===a.methodId);if(!n)return null;let{request:o}=a,r=o.rules.find(i=>i.type==="expiry")?.data,s=o.rules.find(i=>i.type==="payee")?.data;return {chainId:`eip155:${Number.parseInt(o.chainId,16)}`,to:s?.addresses?.[0]??o.to,limit:BigInt(o.permission.data.periodAmount).toString(),decimals:n.decimals,symbol:n.symbol,periodSeconds:o.permission.data.periodDuration,expiresAt:r?.timestamp?r.timestamp*1e3:null}}function va(e,t){let a=e%86400===0;return new Intl.NumberFormat(t,{style:"unit",unit:a?"day":"hour",unitDisplay:"long"}).format(a?e/86400:Math.round(e/3600))}function Ar(e,t){if(!e||t===null)return null;let a=BigInt(e.cryptoAmountExpected)-BigInt(t);return a>0n?a.toString():null}function dn(e,t,a,n,o,r=a.pay.restRateEnded){let s=e?.rateHeldUntil?Date.parse(e.rateHeldUntil):null;if(s===null)return null;if(s<=t)return c(r,{merchant:n});let i=new Intl.DateTimeFormat(o,{dateStyle:"medium",timeStyle:"short"}).format(s);return c(a.pay.restRateUntil,{time:i,merchant:n})}function ct(e){return parseCaip10AccountId(e)?.address??e}function _t(e,t){let a=ct(e),n=ct(t);return a.startsWith("0x")?a.toLowerCase()===n.toLowerCase():a===n}function Lr(e){return e&&/^\d+$/.test(e)&&BigInt(e)>0n?e:null}function Or(e){let t=BigInt(e.cryptoAmount),a=e.received?BigInt(e.received):null;if(a&&t>a&&(t-a)*200n>=a)return true;if(!e.atPaymentRate)return false;let n=BigInt(e.atPaymentRate);return n===0n?false:(t>n?t-n:n-t)*200n>=n}var wl=new Set(["held","refunded","expired","cancelled","blocked","error"]);function Fr(e,t,a){return a?e==="paid"?t!==0:!wl.has(e):true}var kl=new Set(["evm:coinbase","evm:baseaccount","evm:porto"]);function ha(e){return !!(e&&kl.has(e.connectorType.toLowerCase()))}function _r(e,t){return e==="required"||e==="confirming"?true:e==="unless_relayed"&&t!=="relay"}async function Br(e,t){let{payerProof:a}=e.getState();if(a==="required"||a==="confirming")return t(true),null;t(false);let n=await e.getState().requestQuote();return !n&&e.getState().error?.code==="payer_proof_required"&&t(true),n}var Cl=new Set(["payer_chain_mismatch","too_many_payers"]);function yn(e){let t=e?.code;return t!==void 0&&(t.startsWith("payer_proof_")||Cl.has(t))}var Pl=new Set(["rate_limited","request_failed","origin_required","invoice_not_payable"]);function $n(e){let t=e?.code;return yn(e)||t!==void 0&&Pl.has(t)}function fn(e,t,a,n){if(t==="declined")return c(a.payerProof.declined,n);if(t==="switchDeclined")return c(a.payerProof.switchDeclined,n);if(t==="unsupported")return c(a.payerProof.unsupported,n);if(t==="wrongNetwork"||t==="switchFailed")return c(a.payerProof.wrongNetwork,n);if(t==="notAuthorized")return c(a.pay.notAuthorized,n);if(t==="alreadyPending")return c(a.walletPrompt.stillWaiting,n);if(t)return c(a.payerProof.failed,n);switch(e?.code){case void 0:case "payer_proof_required":return null;case "payer_proof_declined":return c(a.payerProof.declined,n);case "payer_proof_invalid":return a.payerProof.invalid;case "payer_proof_unavailable":return a.payerProof.unavailable;case "payer_chain_mismatch":return c(a.payerProof.wrongNetwork,n);case "too_many_payers":return c(a.payerProof.tooManyWallets,n);case "rate_limited":return a.method.rateLimited;case "request_failed":return a.pay.noAnswer;default:return a.error.generic}}var Bt=6e5;async function xa(e,t){let a,n=new Promise(o=>{a=setTimeout(()=>o(false),t);});try{return await Promise.race([e.then(()=>!0),n])}finally{clearTimeout(a);}}var ye="novapay:focus-visible:outline-2 novapay:focus-visible:outline-offset-2 novapay:focus-visible:outline-[var(--tuwa-text-accent)]",Mt=`novapay:inline-flex novapay:h-7 novapay:min-w-7 novapay:items-center novapay:justify-center novapay:gap-1 novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:border-[var(--tuwa-border-strong)] novapay:bg-[var(--tuwa-standart-button-bg)] novapay:px-1.5 novapay:text-[var(--tuwa-text-primary)] novapay:cursor-pointer novapay:transition-colors novapay:hover:bg-[var(--tuwa-standart-button-hover)] ${ye}`,$="novapay:font-mono novapay:tabular-nums",lt="novapay:font-mono novapay:font-bold novapay:uppercase novapay:tracking-[0.12em]",He=`${lt} novapay:text-[11px] novapay:leading-4 novapay:text-[var(--tuwa-text-secondary)]`,vn=`${lt} novapay:inline-flex novapay:shrink-0 novapay:items-center novapay:gap-1 novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:px-1.5 novapay:py-0.5 novapay:text-[10px] novapay:leading-3`,hn={neutral:"novapay:border-[var(--tuwa-border-strong)] novapay:text-[var(--tuwa-text-primary)]",accent:"novapay:border-[var(--tuwa-text-accent)] novapay:text-[var(--tuwa-text-accent)]",success:"novapay:border-[color-mix(in_srgb,var(--tuwa-success-icon)_35%,transparent)] novapay:bg-[var(--tuwa-success-bg)] novapay:text-[var(--tuwa-success-text)]",pending:"novapay:border-[color-mix(in_srgb,var(--tuwa-pending-icon)_35%,transparent)] novapay:bg-[var(--tuwa-pending-bg)] novapay:text-[var(--tuwa-pending-text)]",error:"novapay:border-[color-mix(in_srgb,var(--tuwa-error-icon)_35%,transparent)] novapay:bg-[var(--tuwa-error-bg)] novapay:text-[var(--tuwa-error-text)]"},pt=`novapay-title ${$} novapay:m-0 novapay:text-base novapay:font-bold novapay:text-balance novapay:outline-none`,Dt={tabIndex:-1,"data-novapay-heading":""},Mr=`${lt} novapay:box-border novapay:inline-flex novapay:min-h-11 novapay:w-full novapay:min-w-0 novapay:cursor-pointer novapay:items-center novapay:justify-center novapay:gap-2 novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:px-3 novapay:py-2 novapay:text-center novapay:text-xs novapay:leading-4 novapay:no-underline novapay:transition-colors novapay:disabled:cursor-not-allowed novapay:disabled:opacity-70 ${ye}`,Wt=`tuwa-solid ${Mr} novapay:border-[var(--tuwa-button-primary-bg)] novapay:bg-[var(--tuwa-button-primary-bg)] novapay:text-[var(--tuwa-text-on-accent)] novapay:hover:border-[var(--tuwa-button-primary-bg-hover)] novapay:hover:bg-[var(--tuwa-button-primary-bg-hover)]`,ga=`novapay:cursor-pointer novapay:border-0 novapay:bg-transparent novapay:p-0 novapay:text-[length:inherit] novapay:font-semibold novapay:text-[var(--tuwa-text-accent)] novapay:underline ${ye}`,xn=`${Mr} novapay:border-[var(--tuwa-border-strong)] novapay:bg-[var(--tuwa-standart-button-bg)] novapay:text-[var(--tuwa-text-primary)] novapay:hover:bg-[var(--tuwa-standart-button-hover)]`,gn=`${lt} novapay:inline-flex novapay:min-h-7 novapay:shrink-0 novapay:cursor-pointer novapay:items-center novapay:justify-center novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:border-[var(--tuwa-border-strong)] novapay:bg-[var(--tuwa-standart-button-bg)] novapay:px-2.5 novapay:py-1 novapay:text-[10px] novapay:leading-3 novapay:text-[var(--tuwa-text-primary)] novapay:transition-colors novapay:hover:bg-[var(--tuwa-standart-button-hover)] novapay:disabled:cursor-not-allowed novapay:disabled:opacity-70 ${ye}`,Dr=`tuwa-solid ${lt} novapay:inline-flex novapay:min-h-8 novapay:cursor-pointer novapay:items-center novapay:justify-center novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:border-[var(--tuwa-button-primary-bg)] novapay:bg-[var(--tuwa-button-primary-bg)] novapay:px-3 novapay:py-1.5 novapay:text-center novapay:text-[11px] novapay:leading-4 novapay:text-[var(--tuwa-text-on-accent)] novapay:transition-colors novapay:hover:border-[var(--tuwa-button-primary-bg-hover)] novapay:hover:bg-[var(--tuwa-button-primary-bg-hover)] novapay:disabled:cursor-not-allowed novapay:disabled:opacity-70 ${ye}`,ba="novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:border-[color-mix(in_srgb,var(--tuwa-pending-icon)_35%,transparent)] novapay:bg-[var(--tuwa-pending-bg)] novapay:text-[var(--tuwa-pending-text)]";function wa(e){return e==="modal"?{frame:"novapay:sm:w-[min(760px,calc(100vw_-_2rem_-_2px))]",section:""}:{frame:"",section:`novapay:box-border ${e==="page"?"novapay:w-[880px]":"novapay:w-[760px]"} novapay:max-w-full`}}var Wr={default:{frame:"tuwa-scanlines novapay:relative novapay:box-border novapay:flex novapay:w-full novapay:flex-col novapay:overflow-hidden novapay:bg-[var(--tuwa-bg-primary)] novapay:text-[var(--tuwa-text-primary)] novapay:sm:h-[680px] novapay:sm:flex-row",aside:"tuwa-scanlines novapay:hidden novapay:w-[286px] novapay:shrink-0 novapay:border-r novapay:border-[var(--tuwa-border-primary)] novapay:bg-[var(--tuwa-bg-secondary)] novapay:p-5 novapay:sm:block",main:"novapay:flex novapay:min-h-0 novapay:min-w-0 novapay:flex-1 novapay:flex-col",area:"novapay:@container novapay:flex novapay:min-h-0 novapay:flex-1 novapay:flex-col novapay:overflow-y-auto"},page:{frame:"tuwa-scanlines novapay:relative novapay:box-border novapay:flex novapay:w-full novapay:flex-1 novapay:flex-col novapay:bg-[var(--tuwa-bg-primary)] novapay:text-[var(--tuwa-text-primary)] novapay:sm:min-h-[calc(var(--novapay-page-floor)_-_2px)] novapay:sm:flex-row",aside:"novapay-page-aside tuwa-scanlines novapay:hidden novapay:w-[clamp(260px,36.4%,320px)] novapay:shrink-0 novapay:flex-col novapay:border-r novapay:border-[var(--tuwa-border-primary)] novapay:bg-[var(--tuwa-bg-primary)] novapay:p-5 novapay:sm:flex",main:"novapay:flex novapay:min-w-0 novapay:flex-1 novapay:flex-col",area:"novapay:@container novapay:flex novapay:flex-1 novapay:flex-col"}};function qr(e){return e.length<=7?"novapay:text-[36px]":e.length<=10?"novapay:text-[30px]":e.length<=13?"novapay:text-[24px]":"novapay:text-[20px]"}function Hr(e,t){return t.withGas||!e.gasless?"transfer":e.gasless.paymaster&&t.canSponsorCalls?"paymaster":e.gasless.relay?"relay":"transfer"}function $r(e){let t=BigInt(e.amountToSend),a=BigInt(e.amountDue);return !e.transferFee||t<=a?{send:e.amountToSend,receives:e.amountDue,fee:null}:{send:e.amountToSend,receives:e.amountDue,fee:{amount:String(t-a),percent:String(e.transferFee.bps/100)}}}var ka=10000n,Ur=8n;function Kr(e,t){let a=BigInt(e.cryptoAmountExpected);if(!t||a<=0n)return null;let o=BigInt(t)*(ka+BigInt(e.markupBps))*(ka-BigInt(e.discountBps))*10n**BigInt(e.decimals)*10n**Ur/(100n*ka*ka*a);return Number(o)/10**Number(Ur)}function Gr(e,t,a=0n){let n=BigInt(t.amountToSend)+a;return e>=n?null:{have:String(e),need:String(n),short:String(n-e)}}function Ne(e){return e.family==="eip155"?`eip155:${e.chainId}`:e.chainId}var zr="novapay:normal-case",Rl=3,El={};function Al(e){let[,t="",a="",n=""]=/^(\s*)([\s\S]*?)(\s*)$/.exec(e)??[];return [t,a,n]}function Ll(e,t){let a=e.ownerDocument.createElement("span");a.style.cssText="position:absolute;visibility:hidden;white-space:nowrap;pointer-events:none";for(let[o,r]of t){let s=e.ownerDocument.createElement("span");r&&(s.style.textTransform="none"),s.textContent=o,a.append(s);}e.append(a);let{width:n}=a.getBoundingClientRect();return a.remove(),n}function Ol(e,t){let a=getComputedStyle(t),n=[...t.children].filter(s=>s!==e),o=n.reduce((s,i)=>s+i.getBoundingClientRect().width,0),r=(Number.parseFloat(a.columnGap)||0)*n.length;return t.clientWidth-Number.parseFloat(a.paddingLeft)-Number.parseFloat(a.paddingRight)-o-r}function Ce({label:e,values:t=El}){let a=useRef(null),[n,o]=useState(false),[r,s]=useState(Rl),i=Object.fromEntries(Object.entries(t).map(([p,d])=>[p,{own:String(d)}])),c=d(e,i).map(p=>typeof p=="string"?[p,false]:[p.own,true]),l=JSON.stringify(c);return useLayoutEffect(()=>{let p=a.current,d=p?.parentElement;if(!p||!d)return;let y=JSON.parse(l),f=()=>{o(Ll(p,y)>Ol(p,d)+.5),s(m=>Math.max(m,y.length));};if(f(),typeof ResizeObserver>"u")return;let v=new ResizeObserver(f);return v.observe(d),()=>v.disconnect()},[l]),n?jsx("span",{ref:a,className:"novapay:min-w-0",children:jsx("span",{className:"novapay-label-fade",children:c.map(([p,d],y)=>d?jsx("span",{className:zr,children:p},y):p)},l)}):jsx("span",{ref:a,className:"novapay:min-w-0 novapay:whitespace-nowrap",children:Array.from({length:Math.max(r,c.length)},(p,d)=>{let[y,f]=c[d]??["",false],[v,m,C]=Al(y);return jsxs(Fragment$1,{children:[v,jsx(MorphText,{className:f?zr:void 0,children:m}),C]},d)})})}function ne(e,t,a){let n=e.customization.classNames?.[t];return n?.({screen:e.screen,checkoutState:e.state,checkout:e.checkout,...a})}function et({children:e,labels:t}){let a=Ke(),n=t??a?.labels,o=useLabels(),r=useMemo(()=>({...o,trackingModal:{...o.trackingModal,progressIndicator:{created:n.confirm.sent,processing:n.confirm.confirming,succeed:n.confirm.paid}},statuses:{...o.statuses,confirmed:n.confirm.confirmed,failed:n.confirm.failed},actions:{...o.actions,viewOnExplorer:n.confirm.viewOnExplorer,copy:n.confirm.copyHash},txError:{...o.txError,copied:n.pay.copied}}),[o,n]);return jsx(NovaTransactionsLabelsProvider,{labels:r,children:e})}var Xt=(e,t)=>e?ne(e,t):void 0;function Gn({walletId:e,icon:t}){let[a,n]=useState(null);return t&&t!==a&&lo(t)?jsx("img",{src:t,alt:"",onError:()=>n(t),className:"novapay:block novapay:h-full novapay:w-full novapay:object-contain"}):jsx(WalletIcon,{walletName:e})}function Ie({hash:e,chainId:t,explorerUrl:a,labels:n}){let o=Ke(),r=a??(t?o?.adapterFor(t.startsWith("solana:")?"solana":"eip155")?.explorerAddressUrl?.({chainId:t,address:e}):void 0);return jsx(et,{labels:n,children:jsx(HashLink,{hash:e,explorerUrl:r,variant:"compact",...o?.customization.childCustomizations?.hashLink})})}function Ca({walletId:e,walletIcon:t}){return !e&&!t?jsx(QuasarLoader,{size:48,accent:"var(--tuwa-pending-icon)"}):jsx("span",{className:"novapay-chase novapay:relative novapay:flex novapay:h-20 novapay:w-20 novapay:items-center novapay:justify-center novapay:rounded-[var(--tuwa-rounded-full)] novapay:border-2 novapay:border-[color-mix(in_srgb,var(--tuwa-pending-text)_25%,transparent)]",children:jsx("span",{className:"novapay:block novapay:h-11 novapay:w-11",children:jsx(Gn,{walletId:e??"",icon:t})})})}function he({title:e,subtitle:t,children:a}){let n=Ke(),o=n?.display==="page";return jsxs("section",{className:cn("novapay:flex novapay:flex-1 novapay:flex-col novapay:gap-2.5 novapay:px-5 novapay:py-4",o&&"novapay-page-screen",Xt(n,"screen")),children:[jsxs("div",{children:[jsx("h2",{...Dt,className:pt,children:typeof e=="string"?jsx(MorphText,{wrap:true,children:e}):e}),t&&jsx("p",{className:cn("novapay:m-0 novapay:mt-1 novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",o&&"novapay-page-subtitle"),children:t})]}),a]})}function ee({children:e}){let t=Ke(),a=useRef(null),n=t?.display==="page";return useEffect(()=>{let o=a.current,r=n?o?.ownerDocument.documentElement:o?.closest("[data-novapay-scroll]");if(!o||!r||typeof ResizeObserver>"u")return;let s=()=>r.style.scrollPaddingBottom=!n||getComputedStyle(o).position==="sticky"?`${o.offsetHeight+8}px`:"";s();let i=new ResizeObserver(s);return i.observe(o),()=>{i.disconnect(),r.style.scrollPaddingBottom="";}},[n]),jsx("footer",{ref:a,className:cn("tuwa-scanlines novapay:empty:hidden novapay:sticky novapay:bottom-0 novapay:z-10 novapay:flex novapay:flex-col novapay:gap-2 novapay:border-t novapay:border-[var(--tuwa-border-primary)] novapay:bg-[var(--tuwa-bg-primary)] novapay:px-5 novapay:pb-3.5 novapay:pt-3 novapay:text-center",n&&"novapay-page-footer",Xt(t,"footer")),children:e})}function bn({children:e,id:t}){let a=Ke()?.display==="page";return jsx("span",{id:t,className:cn(He,a&&"novapay-page-group"),children:e})}function Y({busy:e,children:t,className:a,...n}){let o=Ke(),r=Xt(o,"primaryButton"),s=o?.customization.components?.PrimaryButton;return s?jsx(s,{busy:e,className:cn(a,r),...n,children:t}):jsxs("button",{type:"button","aria-busy":e||void 0,...n,disabled:n.disabled||e,className:cn(Wt,a,r),children:[e&&jsx(QuasarLoader,{size:16,accent:"currentColor"}),typeof t=="string"?jsx(Ce,{label:t}):t]})}function te({children:e,className:t,...a}){let n=Ke();return jsx("button",{type:"button",...a,className:cn(xn,t,Xt(n,"secondaryButton")),children:e})}function Pa({className:e,...t}){return jsxs("span",{className:cn("novapay:relative novapay:inline-flex novapay:h-4 novapay:w-4 novapay:shrink-0",e),children:[jsx("input",{type:"checkbox",...t,className:cn("novapay:peer novapay:m-0 novapay:box-border novapay:h-4 novapay:w-4 novapay:cursor-pointer novapay:appearance-none novapay:rounded-[var(--tuwa-rounded-full)] novapay:border novapay:border-[var(--tuwa-text-secondary)] novapay:bg-[var(--tuwa-bg-primary)] novapay:transition-colors novapay:checked:border-[var(--tuwa-text-accent)] novapay:checked:bg-[var(--tuwa-text-accent)]",ye)}),jsx(DrawnCheck,{className:"novapay:pointer-events-none novapay:absolute novapay:inset-0 novapay:m-auto novapay:h-3 novapay:w-3 novapay:text-[var(--tuwa-bg-primary)] novapay:opacity-0 novapay:peer-checked:opacity-100"})]})}function Re({children:e}){return jsx("p",{className:"novapay:m-0 novapay:text-center novapay:text-[11px] novapay:leading-snug novapay:text-[var(--tuwa-text-secondary)]",children:e})}function xe({children:e,className:t}){let a=Ke();return jsx("dl",{className:cn("tuwa-scanlines novapay:m-0 novapay:flex novapay:w-full novapay:flex-col novapay:divide-y novapay:divide-[var(--tuwa-border-primary)] novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:border-[var(--tuwa-border-primary)] novapay:bg-[var(--tuwa-bg-primary)] novapay:px-3 novapay:text-left",t,Xt(a,"detailsCard")),children:e})}function J({children:e}){let t=Ke();return jsx("p",{role:"alert",className:cn("novapay:m-0 novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:border-[color-mix(in_srgb,var(--tuwa-error-icon)_35%,transparent)] novapay:bg-[var(--tuwa-error-bg)] novapay:px-3 novapay:py-2 novapay:text-xs novapay:text-[var(--tuwa-error-text)]",Xt(t,"error")),children:e})}function Sa({error:e}){let t=Ke(),a=fa(e);if(!t||!a)return null;let n=t.state.quote??t.checkout?.quote,o=n?Ne(n.instructions):null,r=n&&o?t.adapterFor(n.instructions.family)?.explorerUrl?.({chainId:o,txKey:a}):void 0;return jsx(et,{children:jsx(xe,{children:jsx(W,{name:t.labels.confirm.transaction,children:jsx(HashLink,{hash:a,explorerUrl:r,variant:"compact",...t.customization.childCustomizations?.hashLink})})})})}function Vn({text:e,label:t,copiedLabel:a,children:n}){let[o,r]=useState(false);return useEffect(()=>{if(!o)return;let s=setTimeout(()=>r(false),2e3);return ()=>clearTimeout(s)},[o]),jsxs(Fragment,{children:[jsxs("button",{type:"button","aria-label":n?void 0:t,onClick:()=>{navigator.clipboard?.writeText(e).then(()=>r(true),()=>{});},className:cn(Mt,"novapay:min-h-6 novapay:min-w-6 novapay:text-xs"),children:[jsx(CopyIcon,{copied:o,className:"novapay:h-3.5 novapay:w-3.5"}),n]}),jsx("span",{role:"status",className:"novapay:sr-only",children:o?a:""})]})}function W({name:e,children:t}){let a=Ke();return jsxs("div",{className:cn("novapay:flex novapay:items-baseline novapay:justify-between novapay:gap-3 novapay:py-2 novapay:text-xs",a?.display==="page"&&"novapay-page-row",Xt(a,"detailRow")),children:[jsx("dt",{className:"novapay:shrink-0 novapay:text-[var(--tuwa-text-secondary)]",children:e}),jsx("dd",{className:cn($,"novapay:m-0 novapay:min-w-0 novapay:text-right novapay:break-words"),children:t})]})}function wt({children:e,onClick:t,disabled:a}){return jsx("button",{type:"button",onClick:t,disabled:a,className:cn("novapay:disabled:cursor-default novapay:disabled:opacity-50 novapay:min-h-6 novapay:cursor-pointer novapay:border-0 novapay:bg-transparent novapay:p-0 novapay:text-xs novapay:text-[var(--tuwa-text-accent)] novapay:underline novapay:hover:no-underline",ye),children:e})}function en({kind:e,walletName:t,walletId:a,walletIcon:n,amount:o,merchant:r,network:s,to:i,priceTime:c$1,onRetry:l,text:p,details:d,hint:y,onCancel:f,stepHeight:v}){let{labels:m,display:C}=O(),g=useId(),b=useRef(null);useEffect(()=>b.current?.focus(),[e]);let[h]=useState(()=>typeof document>"u"?null:document.activeElement);useEffect(()=>()=>{let k=h?.ownerDocument;if(!h||!k||h===k.body||!h.isConnected)return;let x=k.activeElement;x&&x!==k.body&&!x.contains(h)||h.focus();},[h]);let w={wallet:t,amount:o,merchant:r,network:s},T=e==="sign"||e==="proof"?m.walletPrompt.signIn:e==="switch"?m.walletPrompt.switchIn:e==="submitting"?m.walletPrompt.submitting:e==="permission"?m.autoPay.approveIn:m.walletPrompt.confirmIn;return jsxs("section",{"aria-labelledby":g,style:v?{"--novapay-step-height":`${v}px`}:void 0,className:cn("tuwa-scanlines novapay:flex novapay:flex-1 novapay:flex-col novapay:items-center novapay:justify-center-safe novapay:gap-3 novapay:bg-[var(--tuwa-bg-primary)] novapay:px-6 novapay:py-5 novapay:text-center",v&&(C==="page"?"novapay:min-h-[var(--novapay-step-height)]":"novapay:max-sm:min-h-[var(--novapay-step-height)]")),children:[jsx(Ca,{walletId:a,walletIcon:n}),jsx("h2",{id:g,ref:b,tabIndex:-1,className:pt,children:c(T,w)}),(e==="sign"||e==="confirm"||e==="proof")&&jsxs(Fragment,{children:[jsx("p",{className:"novapay:m-0 novapay:max-w-sm novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:p??c(e==="confirm"?m.walletPrompt.confirmText:m.walletPrompt.signText,w)}),y&&jsx("p",{className:"novapay:m-0 novapay:max-w-sm novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:y}),jsxs("div",{className:"novapay:flex novapay:w-full novapay:max-w-xs novapay:flex-col novapay:gap-1.5 novapay:text-left",children:[jsx("span",{className:He,children:jsx(Ce,{label:m.walletPrompt.check,values:w})}),jsx(xe,{children:d?d.map(k=>jsx(W,{name:k.name,children:k.value},k.name)):jsxs(Fragment,{children:[jsx(W,{name:m.walletPrompt.amount,children:o}),jsx(W,{name:m.walletPrompt.to,children:i}),jsx(W,{name:m.walletPrompt.network,children:s}),c$1&&jsx(W,{name:m.walletPrompt.priceLocked,children:c$1})]})})]}),l?jsxs("p",{className:"novapay:m-0 novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:[m.walletPrompt.notOpened," ",jsx(wt,{onClick:l,children:m.walletPrompt.tryAgain})]}):jsx("p",{className:"novapay:m-0 novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:c(m.walletPrompt.stillWaiting,w)})]}),e==="permission"&&jsx("p",{className:"novapay:m-0 novapay:max-w-sm novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:m.autoPay.walletNote}),e!=="submitting"&&jsx(te,{onClick:f,className:"novapay:max-w-xs",children:m.walletPrompt.cancel})]})}var Ia=class extends Error{};function ts(){let{checkout:e,state:t,store:a,labels:n,locale:o,wallet:r,adapterFor:s,setAutoPay:i,connectFamily:c$1}=O(),[l,p]=useState("idle"),[d,y]=useState(null),f=r?.address,[v,m]=useState(f);v!==f&&(m(f),y(null),p("idle"));let C=useRef(0);useEffect(()=>{C.current++;let{error:me,clearError:S}=a.getState();me&&(yn(me)||me.code==="permission_invalid")&&S();},[f]);let g=useRef(null),b=useRef(null),h=useRef(null),w=l!=="idle"&&r!==null,[T,k]=pn(w),x=vo(e?.autoCharge??null),N=x?e?.methods.find(me=>me.id===x.methodId):void 0,I=N?We(N):null,F=I?s(I):void 0,L=e?Er(e.autoCharge,e.methods):null,[U,E]=useState(null),se=Ot(L&&r&&F?.smartAccountStatus&&U!==r.address?`${L.chainId}:${r.address}`:null,()=>F.smartAccountStatus({chainId:L.chainId,account:r.address}));if(!e)return null;let P=e.merchant.name,B=se==="upgradable"&&!!F?.upgradeToSmartAccount,G=async()=>{if(!x||!L||!r||!F?.requestPermission)return y("unsupported");let{requestPermission:me}=F,S=++C.current,_=()=>C.current===S,M=r.address;y(null),a.getState().clearError();try{if(r.chainId!==L.chainId&&F.switchChain&&(p("switching"),await F.switchChain(L.chainId),!_()))return;if(B){p("upgrading");try{if(b.current?.account!==M){let ce={account:M,done:F.upgradeToSmartAccount({chainId:L.chainId,account:M}).then(rt=>(E(M),rt))};b.current=ce;let ve=()=>{b.current===ce&&(b.current=null);};ce.done.then(ve,ve);}await b.current?.done;}catch(ce){throw b$1(ce)==="failed"?new Ia:ce}if(!_())return}p("permission");let z=h.current?.account===M?h.current.granted:null;if(!z){if(g.current?.account!==M){let Ye=me({request:x.request,account:M}),It={account:M,asked:Ye};g.current=It;let Oe=()=>{g.current===It&&(g.current=null);};Ye.then(Oe,Oe);}let ce=g.current,ve=null;if(!await xa(ce.asked.then(Ye=>{ve=Ye;}),6e5)||!ve){g.current===ce&&(g.current=null),_()&&y("alreadyPending");return}z=ve,h.current={account:M,granted:z};}if(await a.getState().grantPermission({payer:`${L.chainId}:${M}`,...z},F.signMessage&&((ce,ve)=>(_()&&p("proof"),F.signMessage({message:ce,account:M,chainId:ve.chainId}))))){h.current=null,_()&&i(!1);return}a.getState().error?.code==="permission_invalid"&&(h.current=null);}catch(z){if(!_())return;y(z instanceof Ia?"smartAccount":b$1(z));}finally{_()&&p("idle");}},K={wallet:r?.name??"",network:L?de(L.chainId):"",merchant:P},j=t.error,X=j?j.code==="permission_invalid"?j.reason==="wallet_unknown"?c(n.autoPay.smartAccountNeeded,K):n.autoPay.invalid:yn(j)?fn(j,null,n,K):mn(j,n,P):null,ie=d==="declined"?c(n.pay.declined,K):d==="unsupported"?c(n.autoPay.unavailable,K):d==="smartAccount"?c(n.autoPay.smartAccountNeeded,K):d==="wrongNetwork"||d==="switchFailed"?c(n.pay.switchFailed,K):d==="notAuthorized"?c(n.pay.notAuthorized,K):d==="alreadyPending"?c(n.walletPrompt.stillWaiting,K):d==="cannotConnect"?n.pay.connectUnavailable:d?c(n.autoPay.notGranted,K):X;return jsxs("div",{className:"novapay:relative novapay:flex novapay:flex-1 novapay:flex-col",children:[jsxs("div",{ref:T,inert:w,className:cn("novapay:flex novapay:flex-1 novapay:flex-col",w&&"novapay:hidden"),children:[jsxs(he,{title:n.autoPay.title,subtitle:n.autoPay.subtitle,children:[L&&jsxs(Fragment,{children:[jsxs("div",{className:"novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:border-[var(--tuwa-border-primary)] novapay:px-3 novapay:py-2",children:[jsx("span",{className:"novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:c(n.autoPay.allow,{merchant:P})}),jsxs("p",{className:cn($,"novapay:m-0 novapay:text-lg novapay:font-bold"),children:[c(n.autoPay.limit,{amount:`${ue(L.limit,L.decimals,o)} ${L.symbol}`})," ",jsx("span",{className:"novapay:text-sm novapay:font-normal",children:c(n.autoPay.every,{period:va(L.periodSeconds,o)})})]})]}),jsxs(xe,{children:[r&&jsx(W,{name:n.autoPay.from,children:jsxs("span",{className:"novapay:inline-flex novapay:items-center novapay:gap-1",children:[jsx(Ie,{hash:r.address,chainId:L.chainId})," \xB7 ",de(L.chainId)]})}),jsxs(W,{name:n.autoPay.to,children:[jsx(Ie,{hash:L.to,chainId:L.chainId}),jsx("span",{className:"novapay:font-sans novapay:text-[var(--tuwa-text-secondary)]",children:P})]}),L.expiresAt&&jsx(W,{name:n.autoPay.validUntil,children:c(n.autoPay.validUntilValue,{date:new Intl.DateTimeFormat(o,{dateStyle:"medium"}).format(L.expiresAt)})})]}),jsxs("ul",{className:"novapay:m-0 novapay:flex novapay:list-disc novapay:flex-col novapay:gap-1 novapay:pl-4 novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:[jsx("li",{children:c(n.autoPay.collector,{merchant:P})}),jsx("li",{children:n.autoPay.invoices}),jsx("li",{children:c(n.autoPay.cap,{merchant:P})}),jsx("li",{children:c(n.autoPay.turnOff,{merchant:P})})]})]}),B&&jsx("p",{className:"novapay:m-0 novapay:text-xs novapay:text-[var(--tuwa-text-primary)]",children:c(n.autoPay.smartAccountNote,K)}),ie&&jsx(J,{children:ie})]}),jsxs(ee,{children:[r?jsx(Y,{busy:w,disabled:!L,onClick:()=>{G();},children:n.autoPay.confirm}):jsx(Y,{disabled:!I,onClick:()=>{I&&!c$1(I)&&y("cannotConnect");},children:n.pay.connect}),jsx(te,{onClick:()=>i(false),children:n.autoPay.skip}),jsx(Re,{children:n.autoPay.walletNote})]})]}),w&&r&&jsx(en,{kind:l==="switching"?"switch":l==="upgrading"?"confirm":l==="proof"?"proof":"permission",walletName:r.name,walletId:r.walletId,walletIcon:r.icon,amount:"",merchant:P,network:K.network,to:"",priceTime:null,text:l==="upgrading"?c(n.autoPay.smartAccountPrompt,K):l==="proof"?c(n.payerProof.promptText,{...K,invoice:e.invoice.number??e.invoice.id}):void 0,details:l==="upgrading"?[{name:n.autoPay.from,value:shortAddress(r.address)},{name:n.walletPrompt.network,value:K.network}]:l==="proof"?[{name:n.payerProof.invoice,value:e.invoice.number??e.invoice.id},{name:n.payerProof.merchant,value:P}]:void 0,onCancel:()=>{C.current++,p("idle");},stepHeight:k})]})}var Zl=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,ns="AD AE AF AG AI AL AM AO AQ AR AS AT AU AW AX AZ BA BB BD BE BF BG BH BI BJ BL BM BN BO BQ BR BS BT BV BW BY BZ CA CC CD CF CG CH CI CK CL CM CN CO CR CU CV CW CX CY CZ DE DJ DK DM DO DZ EC EE EG EH ER ES ET FI FJ FK FM FO FR GA GB GD GE GF GG GH GI GL GM GN GP GQ GR GS GT GU GW GY HK HM HN HR HT HU ID IE IL IM IN IO IQ IR IS IT JE JM JO JP KE KG KH KI KM KN KP KR KW KY KZ LA LB LC LI LK LR LS LT LU LV LY MA MC MD ME MF MG MH MK ML MM MN MO MP MQ MR MS MT MU MV MW MX MY MZ NA NC NE NF NG NI NL NO NP NR NU NZ OM PA PE PF PG PH PK PL PM PN PR PS PT PW PY QA RE RO RS RU RW SA SB SC SD SE SG SH SI SJ SK SL SM SN SO SR SS ST SV SX SY SZ TC TD TF TG TH TJ TK TL TM TN TO TR TT TV TW TZ UA UG UM US UY UZ VA VC VE VG VI VN VU WF WS YE YT ZA ZM ZW".split(" "),Jl=new Set(ns);function ho(e,t){let a=e==="full"||t,n=[{name:"email",required:true,autoComplete:"email",type:"email"}];return a?[...n,{name:"name",required:true,autoComplete:t?"organization":"name",type:"text"},{name:"country",required:true,autoComplete:"country",type:"country"},{name:"addressLine1",required:true,autoComplete:"address-line1",type:"text"},{name:"addressLine2",required:false,autoComplete:"address-line2",type:"text"},{name:"postalCode",required:false,autoComplete:"postal-code",type:"text"},{name:"city",required:false,autoComplete:"address-level2",type:"text"},...t?Xl():[]]:n}var Xl=()=>[{name:"taxId",required:true,autoComplete:"off",type:"text"},{name:"registrationNumber",required:false,autoComplete:"off",type:"text"}];function as(e,t,a){let n={};for(let o of ho(t,a)){let r=e[o.name]?.trim()??"";r?o.type==="email"&&!Zl.test(r)?n[o.name]="email":o.type==="country"&&!Jl.has(r.toUpperCase())&&(n[o.name]="country"):o.required&&(n[o.name]="required");}return n}function os(e){let t={};for(let[a,n]of Object.entries(e)){let o=n?.trim();o&&(t[a]=a==="country"?o.toUpperCase():o);}return t}function rs(e){let t=new Intl.DisplayNames([e],{type:"region"});return ns.map(a=>({code:a,name:t.of(a)??a})).sort((a,n)=>a.name.localeCompare(n.name,e))}function kt(){return useNovaIcons().outline}function wn(e){return jsx(NovaSetIcon,{solid:"ChevronDownIcon",...e})}function ss(e){return jsx(NovaSetIcon,{solid:"GlobeAltIcon",...e})}function kn(e){return jsx(NovaSetIcon,{outline:"ClockIcon",...e})}function is(e){return jsx(NovaSetIcon,{outline:"DocumentTextIcon",...e})}function Ct(e){return jsx(NovaSetIcon,{outline:"ExclamationTriangleIcon",...e})}function cs(e){return jsx(NovaSetIcon,{outline:"InformationCircleIcon",...e})}function ls(e){return jsx(NovaSetIcon,{outline:"WalletIcon",...e})}function ps(e){let a=kt().ArrowDownTrayIcon??ArrowDownTrayIcon;return jsx(a,{...e})}function us(e){let a=kt().ArrowPathRoundedSquareIcon??ArrowPathRoundedSquareIcon;return jsx(a,{...e})}function ms(e){let a=kt().ArrowUturnLeftIcon??ArrowUturnLeftIcon;return jsx(a,{...e})}function ds(e){let a=kt().DevicePhoneMobileIcon??DevicePhoneMobileIcon;return jsx(a,{...e})}function ys(e){let a=kt().FingerPrintIcon??FingerPrintIcon;return jsx(a,{...e})}function fs(e){let a=kt().LockClosedIcon??LockClosedIcon;return jsx(a,{...e})}function vs(e){let a=kt().MagnifyingGlassIcon??MagnifyingGlassIcon;return jsx(a,{...e})}function hs(e){let a=kt().NoSymbolIcon??NoSymbolIcon;return jsx(a,{...e})}function xs(e){let a=kt().QrCodeIcon??QrCodeIcon;return jsx(a,{...e})}var dp=(e,t,a)=>t==="name"&&a?e.buyer.companyName:e.buyer[t]??t,yp=(e,t)=>t==="email"?e.buyer.invalidEmail:t==="country"?e.buyer.invalidCountry:e.buyer.required,fp=new Set(["postalCode","city","taxId","registrationNumber"]),vp=new Set(["name","country","addressLine1","addressLine2"]),gs=e=>cn("novapay:h-10 novapay:w-full novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:bg-[var(--tuwa-bg-primary)] novapay:px-3 novapay:text-[13px] novapay:text-[var(--tuwa-text-primary)] novapay:transition-colors novapay:focus:border-[var(--tuwa-text-accent)]",e?"novapay:border-[var(--tuwa-error-icon)]":"novapay:border-[var(--tuwa-text-secondary)] novapay:hover:border-[var(--tuwa-text-primary)]",ye);function bs(){let{checkout:e,state:t,store:a,labels:n,locale:o,display:r}=O(),[s,i]=useState({}),[c,l]=useState(false),[p,d]=useState(false),[y,f]=useState(false),v=useId(),m=useMemo(()=>rs(o),[o]);if(!e||e.buyer.collect==="off")return null;let C=e.buyer.collect,g=ho(C,c),b=as(s,C,c),h=(T,k)=>i(x=>({...x,[T]:k})),w=async T=>{if(T.preventDefault(),d(true),Object.keys(b).length>0){document.getElementById(`${v}-${Object.keys(b)[0]}`)?.focus();return}f(true),await a.getState().setBuyer(os(s),{company:c}),f(false);};return jsxs("form",{noValidate:true,onSubmit:T=>{w(T);},className:"novapay:flex novapay:flex-1 novapay:flex-col",children:[jsxs(he,{title:n.buyer.title,subtitle:n.buyer.subtitle,children:[jsx("div",{className:"novapay:grid novapay:grid-cols-1 novapay:gap-x-3 novapay:gap-y-3.5 novapay:pt-1 novapay:sm:grid-cols-2",children:g.map((T,k)=>{let x=`${v}-${T.name}`,N=p?b[T.name]:void 0,I=T.type==="country"?jsxs("div",{className:"novapay:relative",children:[jsxs("select",{id:x,autoComplete:T.autoComplete,required:T.required,"aria-invalid":!!N,"aria-describedby":N?`${x}-error`:void 0,value:s.country??"",onChange:F=>h("country",F.target.value),className:cn(gs(!!N),"novapay:cursor-pointer novapay:appearance-none novapay:pr-9",!s.country&&"novapay:text-[var(--tuwa-text-secondary)]"),children:[jsx("option",{value:"",children:n.buyer.chooseCountry}),m.map(F=>jsx("option",{value:F.code,children:F.name},F.code))]}),jsx(wn,{"aria-hidden":true,className:"novapay:pointer-events-none novapay:absolute novapay:top-1/2 novapay:right-3 novapay:h-4 novapay:w-4 novapay:-translate-y-1/2 novapay:text-[var(--tuwa-text-secondary)]"})]}):jsx("input",{id:x,type:T.type,autoComplete:T.autoComplete,required:T.required,"aria-invalid":!!N,"aria-describedby":N?`${x}-error`:void 0,value:s[T.name]??"",onChange:F=>h(T.name,F.target.value),className:gs(!!N)});return jsxs(Fragment$1,{children:[jsxs("div",{className:cn("novapay:flex novapay:flex-col novapay:gap-1.5",!fp.has(T.name)&&(r==="page"&&vp.has(T.name)?"novapay:sm:@max-[519px]:col-span-2":"novapay:sm:col-span-2")),children:[jsxs("label",{htmlFor:x,className:"novapay:text-xs novapay:font-medium novapay:text-[var(--tuwa-text-primary)]",children:[dp(n,T.name,c),T.required&&jsxs("span",{"aria-hidden":"true",className:"novapay:text-[var(--tuwa-error-text)]",children:[" ","*"]}),!T.required&&jsxs("span",{className:"novapay:font-normal novapay:text-[var(--tuwa-text-secondary)]",children:[" ","(",n.buyer.optional,")"]})]}),I,N&&jsx("span",{id:`${x}-error`,className:"novapay:text-[11px] novapay:text-[var(--tuwa-error-text)]",children:yp(n,N)})]}),k===0&&e.buyer.companyInvoice&&jsxs("label",{className:cn("novapay:flex novapay:cursor-pointer novapay:items-center novapay:gap-2.5 novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:px-3 novapay:py-2.5 novapay:text-[13px] novapay:transition-colors novapay:sm:col-span-2",c?"novapay:border-[var(--tuwa-text-accent)] novapay:bg-[var(--tuwa-bg-primary)] novapay:ring-1 novapay:ring-[var(--tuwa-text-accent)]":"novapay:border-[var(--tuwa-border-primary)] novapay:bg-[var(--tuwa-bg-secondary)] novapay:hover:border-[var(--tuwa-border-strong)]"),children:[jsx(Pa,{checked:c,onChange:F=>l(F.target.checked)}),jsx("span",{className:"novapay:font-semibold",children:n.buyer.companyInvoice})]})]},T.name)})}),t.error&&t.phase==="buyer"&&jsx(J,{children:n.buyer.refused})]}),jsx(ee,{children:jsx(Y,{type:"submit",busy:y,children:n.buyer.continue})})]})}function ks({steps:e,labels:t,className:a,stepClassName:n}){let o=e.findIndex(p=>p.state==="current"),r=e.map(p=>t.steps[p.key]).join(""),s=useRef(null),i=useRef(null),[c$1,l]=useState(false);return useEffect(()=>{let p=s.current,d=i.current;if(!p||!d||typeof ResizeObserver>"u")return;let y=()=>l(d.offsetWidth+e.length*32+(e.length-1)*24>p.clientWidth);y();let f=new ResizeObserver(y);return f.observe(p),()=>f.disconnect()},[r,e.length]),jsxs("nav",{ref:s,"aria-label":t.steps.label,className:cn("novapay:relative novapay:min-w-0 novapay:flex-1",a),children:[jsx("span",{"aria-hidden":true,className:"novapay:invisible novapay:absolute novapay:h-0 novapay:w-0 novapay:overflow-hidden",children:jsx("span",{ref:i,className:cn(lt,"novapay:whitespace-nowrap novapay:text-[11px]"),children:r})}),jsx("ol",{className:"novapay:m-0 novapay:flex novapay:list-none novapay:items-center novapay:gap-1.5 novapay:p-0",children:e.map((p,d)=>{let y=t.steps[p.key];return jsxs("li",{"aria-current":p.state==="current"?"step":void 0,className:cn("novapay:flex novapay:min-w-0 novapay:items-center novapay:gap-1.5",d>0&&"novapay:flex-auto",n?.(p,d)),children:[d>0&&jsx("span",{"aria-hidden":true,className:cn("novapay:h-px novapay:min-w-2 novapay:flex-1 novapay:transition-colors novapay:duration-300 novapay:motion-reduce:transition-none",p.state==="upcoming"?"novapay:bg-[var(--tuwa-border-primary)]":"novapay:bg-[var(--tuwa-success-icon)]")}),jsx("span",{"aria-hidden":true,className:cn($,"novapay:box-border novapay:flex novapay:h-5 novapay:w-5 novapay:shrink-0 novapay:items-center novapay:justify-center novapay:rounded-[var(--tuwa-rounded-full)] novapay:border novapay:text-[10px] novapay:font-bold",p.state==="done"&&"novapay:border-[var(--tuwa-success-icon)] novapay:bg-[var(--tuwa-success-icon)] novapay:text-white",p.state==="current"&&"novapay:border-[var(--tuwa-text-accent)] novapay:text-[var(--tuwa-text-accent)]",p.state==="upcoming"&&"novapay:border-[var(--tuwa-border-strong)] novapay:text-[var(--tuwa-text-secondary)]"),children:p.state==="done"?jsx(DrawnCheck,{className:"novapay:h-3 novapay:w-3"}):d+1}),jsx("span",{className:cn(lt,"novapay:truncate novapay:text-[11px] novapay:leading-4",p.state==="current"?"novapay:text-[var(--tuwa-text-primary)]":"novapay:text-[var(--tuwa-text-secondary)]",c$1&&p.state!=="current"&&"novapay:sr-only"),children:p.state==="current"?jsxs(Fragment,{children:[jsx("span",{className:"novapay:sr-only",children:c(t.steps.progress,{current:o+1,total:e.length,name:y})}),jsx("span",{"aria-hidden":true,children:y})]}):y})]},p.key)})})]})}function Pn(e){let t=e.lineItems.reduce((r,s)=>r+BigInt(s.netMinor),0n),a=BigInt(e.totalMinor??t.toString()),n=a-t,o=[...new Set(e.lineItems.filter(r=>Number(r.taxRate)>0).map(r=>r.taxRate))];return {subtotal:_e(t.toString()),tax:n>0n?_e(n.toString()):null,rate:o.length===1?String(Number(o[0])):null,total:_e(a.toString())}}var kp=e=>{try{return new URL(e).host}catch{return e}};function Aa({compact:e=false}){let{checkout:t,state:a,labels:n,display:o}=O(),[r,s]=useState(false);if(!t)return null;let{merchant:i,invoice:c}=t,l=e?"novapay:h-8 novapay:w-8":"novapay:h-9 novapay:w-9";return jsxs("div",{className:"novapay:flex novapay:min-w-0 novapay:items-center novapay:gap-2.5",children:[a.logoUrl&&!r?jsx("img",{src:a.logoUrl,alt:"",onError:()=>s(true),className:cn(l,"novapay:shrink-0 novapay:rounded-[var(--tuwa-rounded-corners)] novapay:object-contain")}):jsx("span",{"aria-hidden":true,className:cn(l,$,"novapay:flex novapay:shrink-0 novapay:items-center novapay:justify-center novapay:rounded-[var(--tuwa-rounded-corners)] novapay:bg-[var(--tuwa-text-primary)] novapay:text-[15px] novapay:font-bold novapay:text-[var(--tuwa-bg-primary)]"),children:i.name.trim().charAt(0).toUpperCase()}),jsxs("div",{className:"novapay:flex novapay:min-w-0 novapay:flex-col",children:[jsx("span",{className:cn("novapay:text-sm novapay:font-semibold",o==="page"&&!e?"novapay:line-clamp-2 novapay:break-words":"novapay:truncate"),children:i.name}),e?c.number&&jsx("span",{className:cn($,"novapay:text-[11px] novapay:text-[var(--tuwa-text-secondary)]"),children:c.number}):i.website&&jsx("a",{href:i.website,target:"_blank",rel:"noopener noreferrer",className:cn("novapay:truncate novapay:text-xs novapay:text-[var(--tuwa-text-secondary)] novapay:hover:underline",ye),children:kp(i.website)})]}),c.environment==="test"&&jsxs("span",{title:n.summary.testHint,className:cn(vn,hn.pending,"novapay:ml-auto"),children:[n.summary.test,jsxs("span",{className:"novapay:sr-only",children:[": ",n.summary.testHint]})]})]})}function go({checkout:e,labels:t}){let{merchant:a}=e,n=a.seller,o=[[t.summary.terms,a.links.terms],[t.summary.refundPolicy,a.links.refundPolicy],[t.summary.privacy,a.links.privacy]].filter(r=>!!r[1]);return jsxs("div",{className:"tuwa-scanlines novapay:flex novapay:flex-col novapay:gap-1 novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:border-[var(--tuwa-border-primary)] novapay:bg-[var(--tuwa-bg-primary)] novapay:px-3 novapay:py-2.5 novapay:text-[11px] novapay:leading-snug novapay:text-[var(--tuwa-text-secondary)]",children:[n?.legalName&&jsx("span",{className:"novapay:text-xs novapay:font-semibold novapay:text-[var(--tuwa-text-primary)]",children:n.legalName}),(n?.address||n?.country)&&jsx("span",{children:[n.address,n.country].filter(Boolean).join(", ")}),n?.registrationNumber&&jsxs("span",{children:[t.summary.registration," ",n.registrationNumber]}),n?.taxId&&jsxs("span",{children:[t.summary.taxId," ",n.taxId]}),a.supportEmail&&jsx("a",{href:`mailto:${a.supportEmail}`,className:cn("novapay:text-[var(--tuwa-text-accent)] novapay:underline",ye),children:a.supportEmail}),o.length>0&&jsx("span",{className:"novapay:flex novapay:flex-wrap novapay:gap-x-3",children:o.map(([r,s])=>jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:cn("novapay:text-[var(--tuwa-text-accent)] novapay:underline",ye),children:r},r))}),jsx("span",{children:c(t.summary.sellerRole,{seller:n?.legalName||a.name})})]})}function Ns(){let{checkout:e,labels:t,locale:a,now:n,screen:o,display:r}=O(),s=e?.invoice.dueAt,i=e&&Un(e.invoice.status,o,e.invoice.restPayable);if(!e||!s||!i)return null;let c$1=new Intl.DateTimeFormat(a,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(s));return jsxs("div",{className:cn("tuwa-scanlines novapay:flex novapay:items-center novapay:justify-between novapay:gap-2 novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:border-[var(--tuwa-border-primary)] novapay:bg-[var(--tuwa-bg-primary)] novapay:px-3 novapay:py-2.5",r==="page"&&"novapay-page-deadline"),children:[jsxs("div",{className:"novapay:flex novapay:min-w-0 novapay:flex-col novapay:gap-0.5",children:[jsx("span",{className:He,children:i==="closed"?t.summary.refundAfter:t.summary.payWithin}),jsx("span",{className:"novapay:text-[11px] novapay:text-[var(--tuwa-text-secondary)]",children:i==="closed"?c$1:c(t.summary.until,{date:c$1})})]}),jsx("span",{role:"timer",className:cn($,"novapay:shrink-0 novapay:whitespace-nowrap novapay:text-lg novapay:font-bold"),children:st(Date.parse(s)-n)})]})}function Ts(){let{checkout:e,labels:t,locale:a}=O();if(!e)return null;let{invoice:n}=e,o=Pn(n);return jsxs("div",{className:"novapay:flex novapay:flex-col novapay:gap-3.5",children:[jsxs("div",{className:"novapay:flex novapay:flex-col novapay:gap-2.5",children:[n.number&&jsxs("div",{className:"novapay:flex novapay:items-baseline novapay:justify-between novapay:gap-3",children:[jsx("span",{className:He,children:t.summary.invoice}),jsx("span",{className:cn($,"novapay:min-w-0 novapay:break-all novapay:text-right novapay:text-[11px] novapay:text-[var(--tuwa-text-secondary)]"),children:n.number})]}),jsx("ul",{className:"novapay:m-0 novapay:flex novapay:list-none novapay:flex-col novapay:gap-2.5 novapay:p-0",children:n.lineItems.map((r,s)=>jsxs("li",{className:"novapay:flex novapay:justify-between novapay:gap-2 novapay:text-[13px]",children:[jsxs("span",{className:"novapay:flex novapay:min-w-0 novapay:flex-col",children:[jsx("span",{className:"novapay:break-words",children:r.name}),r.description&&jsx("span",{className:"novapay:text-[11px] novapay:text-[var(--tuwa-text-secondary)]",children:r.description}),jsx("span",{className:cn($,"novapay:text-[11px] novapay:text-[var(--tuwa-text-secondary)]"),children:c(t.summary.quantity,{quantity:r.quantity,price:ke(r.unitPrice,a)})})]}),jsx("span",{className:$,children:ke(_e(r.netMinor),a)})]},s))})]}),o.tax&&jsxs("dl",{className:"novapay:m-0 novapay:flex novapay:flex-col novapay:gap-1.5 novapay:border-t novapay:border-dashed novapay:border-[var(--tuwa-border-primary)] novapay:pt-2.5 novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:[jsxs("div",{className:"novapay:flex novapay:justify-between",children:[jsx("dt",{children:t.summary.subtotal}),jsx("dd",{className:cn($,"novapay:m-0"),children:ke(o.subtotal,a)})]}),jsxs("div",{className:"novapay:flex novapay:justify-between",children:[jsx("dt",{children:o.rate?c(t.summary.taxRate,{rate:o.rate}):t.summary.tax}),jsx("dd",{className:cn($,"novapay:m-0"),children:ke(o.tax,a)})]})]})]})}function Cp(){let e=O(),{checkout:t,labels:a,locale:n}=e;return t?jsxs("div",{className:cn("novapay:flex novapay:items-baseline novapay:justify-between",ne(e,"total")),children:[jsx("span",{className:cn(He,"novapay:text-[var(--tuwa-text-primary)]"),children:a.summary.total}),jsxs("span",{className:cn($,"novapay:text-[22px] novapay:font-bold"),children:[ke(Pn(t.invoice).total,n)," ",jsx("span",{className:"novapay:text-[13px] novapay:font-normal novapay:text-[var(--tuwa-text-secondary)]",children:t.invoice.currency})]})]}):null}function Is(){let{checkout:e,labels:t}=O();return jsxs("div",{className:"novapay:flex novapay:flex-col novapay:gap-1 novapay:text-[11px] novapay:text-[var(--tuwa-text-secondary)]",children:[jsxs("span",{className:"novapay:flex novapay:items-center novapay:gap-1.5",children:[jsx(fs,{"aria-hidden":true,className:"novapay:h-3.5 novapay:w-3.5 novapay:shrink-0"}),t.summary.secured]}),e?.merchant.supportEmail&&jsxs("span",{children:[t.summary.help,":"," ",jsx("a",{href:`mailto:${e.merchant.supportEmail}`,className:cn("novapay:text-[var(--tuwa-text-accent)] novapay:underline",ye),children:e.merchant.supportEmail})]})]})}function La({label:e,children:t,className:a,buttonClassName:n,growsUp:o=false}){let[r,s]=useState(false),i=useId();return jsxs("div",{className:cn("novapay:flex novapay:flex-col novapay:gap-2",a),children:[jsxs("button",{type:"button","aria-expanded":r,"aria-controls":i,onClick:()=>s(c=>!c),className:cn("novapay:inline-flex novapay:cursor-pointer novapay:items-center novapay:gap-1 novapay:self-start novapay:border-0 novapay:bg-transparent novapay:p-0 novapay:text-[11px] novapay:text-[var(--tuwa-text-secondary)] novapay:hover:text-[var(--tuwa-text-primary)]",ye,n),children:[e,jsx(wn,{"aria-hidden":true,className:cn("novapay:h-3.5 novapay:w-3.5 novapay:transition-transform novapay:motion-reduce:transition-none",r!==o&&"novapay:rotate-180")})]}),jsx("div",{id:i,hidden:!r,children:t})]})}var Cs=5;function Pp(){let e=O(),{checkout:t,labels:a,locale:n}=e;if(!t)return null;let o=ke(Pn(t.invoice).total,n);return jsxs("div",{className:cn("novapay:flex novapay:flex-col novapay:gap-1.5",ne(e,"total")),children:[jsx("span",{className:He,children:a.summary.total}),jsxs("span",{className:cn($,"novapay:flex novapay:flex-wrap novapay:items-baseline novapay:gap-x-2 novapay:gap-y-1 novapay:font-bold",qr(o)),children:[jsx("span",{children:o}),jsx("span",{className:"novapay:text-[15px] novapay:font-normal novapay:text-[var(--tuwa-text-secondary)]",children:t.invoice.currency})]})]})}var Rs="novapay:flex novapay:justify-between novapay:gap-3 novapay:px-3 novapay:py-2";function Ps({line:e}){let{labels:t,locale:a}=O(),n=ke(_e(e.netMinor),a),o=ke(e.unitPrice,a);return jsxs("li",{className:cn(Rs,"novapay:text-[13px]"),children:[jsxs("span",{className:"novapay:flex novapay:min-w-0 novapay:flex-col",children:[jsx("span",{className:"novapay:break-words",children:e.name}),e.description&&jsx("span",{className:"novapay:text-[11px] novapay:text-[var(--tuwa-text-secondary)]",children:e.description}),(Number(e.quantity)!==1||o!==n)&&jsx("span",{className:cn($,"novapay:text-[11px] novapay:text-[var(--tuwa-text-secondary)]"),children:c(t.summary.quantity,{quantity:e.quantity,price:o})})]}),jsx("span",{className:cn($,"novapay:shrink-0"),children:n})]})}function Sp(){let{checkout:e,labels:t,locale:a}=O();if(!e)return null;let{invoice:n}=e,o=Pn(n),r=o.tax?Cs-1:Cs,s=n.lineItems,i=s.length>r?s.slice(0,r-1):s,c$1=s.slice(i.length);return !n.number&&s.length===0?null:jsxs("div",{className:"tuwa-scanlines novapay:flex novapay:flex-col novapay:divide-y novapay:divide-[var(--tuwa-border-primary)] novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:border-[var(--tuwa-border-primary)] novapay:bg-[var(--tuwa-bg-primary)]",children:[n.number&&jsxs("div",{className:cn(Rs,"novapay:items-baseline"),children:[jsx("span",{className:He,children:t.summary.invoice}),jsx("span",{className:cn($,"novapay:min-w-0 novapay:break-all novapay:text-right novapay:text-[11px] novapay:text-[var(--tuwa-text-secondary)]"),children:n.number})]}),i.length>0&&jsx("ul",{className:"novapay:m-0 novapay:flex novapay:list-none novapay:flex-col novapay:divide-y novapay:divide-[var(--tuwa-border-primary)] novapay:p-0",children:i.map((l,p)=>jsx(Ps,{line:l},p))}),c$1.length>0&&jsx(La,{label:`+${c$1.length} \xB7 ${t.summary.showOrder}`,className:"novapay:px-3 novapay:py-2",buttonClassName:"novapay:min-h-6",children:jsx("ul",{className:"novapay:-mx-3 novapay:m-0 novapay:flex novapay:list-none novapay:flex-col novapay:divide-y novapay:divide-[var(--tuwa-border-primary)] novapay:p-0",children:c$1.map((l,p)=>jsx(Ps,{line:l},p))})}),o.tax&&jsxs("dl",{className:"novapay:m-0 novapay:flex novapay:flex-col novapay:gap-1.5 novapay:px-3 novapay:py-2 novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:[jsxs("div",{className:"novapay:flex novapay:justify-between",children:[jsx("dt",{children:t.summary.subtotal}),jsx("dd",{className:cn($,"novapay:m-0"),children:ke(o.subtotal,a)})]}),jsxs("div",{className:"novapay:flex novapay:justify-between",children:[jsx("dt",{children:o.rate?c(t.summary.taxRate,{rate:o.rate}):t.summary.tax}),jsx("dd",{className:cn($,"novapay:m-0"),children:ke(o.tax,a)})]})]})]})}function Np(){let{checkout:e,labels:t}=O();return e?jsxs("div",{className:"novapay:flex novapay:min-w-0 novapay:flex-1 novapay:flex-col",children:[jsx(Aa,{}),jsx("div",{className:"novapay:mt-6",children:jsx(Pp,{})}),jsx("div",{className:"novapay:mt-5",children:jsx(Sp,{})}),jsxs("div",{className:"novapay:mt-auto novapay:flex novapay:flex-col novapay:gap-3 novapay:pt-5",children:[jsx(Ns,{}),jsx(La,{label:t.summary.sellerDetails,buttonClassName:"novapay:min-h-6",growsUp:true,children:jsx(go,{checkout:e,labels:t})}),jsx(Is,{})]})]}):null}function Es(){let{checkout:e,labels:t,display:a}=O();return e?a==="page"?jsx(Np,{}):jsxs("div",{className:"novapay:flex novapay:h-full novapay:flex-col novapay:gap-3.5",children:[jsxs("div",{className:"novapay:flex novapay:flex-col novapay:gap-1.5",children:[jsx(Aa,{}),jsx(La,{label:t.summary.sellerDetails,children:jsx(go,{checkout:e,labels:t})})]}),jsx(Ns,{}),jsx("div",{className:"novapay:-mr-2.5 novapay:min-h-0 novapay:flex-1 novapay:overflow-y-auto novapay:pr-2.5",children:jsx(Ts,{})}),jsx(Cp,{}),jsx(Is,{})]}):null}function As({className:e}={}){let{checkout:t,labels:a,locale:n,now:o,screen:r}=O();if(!t)return null;let{invoice:s}=t,i=Pn(s),c=s.dueAt&&Un(s.status,r)?Date.parse(s.dueAt):null;return jsxs("div",{className:cn("tuwa-scanlines novapay:mx-4 novapay:flex novapay:flex-col novapay:gap-2 novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:border-[var(--tuwa-border-primary)] novapay:bg-[var(--tuwa-bg-secondary)] novapay:p-3",e),children:[jsxs("div",{className:"novapay:flex novapay:items-baseline novapay:justify-between",children:[jsxs("span",{className:cn($,"novapay:text-[22px] novapay:font-bold"),children:[ke(i.total,n)," ",jsx("span",{className:"novapay:text-xs novapay:font-normal novapay:text-[var(--tuwa-text-secondary)]",children:s.currency})]}),c&&jsxs("span",{role:"timer",className:cn($,"novapay:flex novapay:items-center novapay:gap-1 novapay:whitespace-nowrap novapay:text-xs novapay:font-bold"),children:[jsx(kn,{"aria-hidden":true,className:"novapay:h-3.5 novapay:w-3.5 novapay:text-[var(--tuwa-text-secondary)]"}),st(c-o)]})]}),jsx(La,{label:`${b(i.tax?{one:a.summary.compactOne,other:a.summary.compact}:{one:a.summary.compactNoTaxOne,other:a.summary.compactNoTax},s.lineItems.length,n,i.tax?{tax:ke(i.tax,n)}:{})} \xB7 ${a.summary.showOrder}`,children:jsxs("div",{className:"novapay:flex novapay:flex-col novapay:gap-3 novapay:pt-1",children:[jsx(Ts,{}),jsx(go,{checkout:t,labels:a})]})})]})}function Os({locale:e$1,labels:t,receiptIssued:a,onSelect:n,className:o}){let[r,s]=useState(false),i=e.find(b=>b.code===e$1)??e[0],[c$1,l]=useState(0),p=useId(),d=useRef(null),y=useRef(null),f=useRef(null);useEffect(()=>{if(!r)return;f.current?.focus();let b=h=>{d.current?.contains(h.target)||s(false);};return document.addEventListener("pointerdown",b),()=>document.removeEventListener("pointerdown",b)},[r]);let v=()=>{l(Math.max(0,e.indexOf(i))),s(true);},m=()=>{s(false),y.current?.focus();},C=b=>{m(),b!==i.code&&n(b);},g=b=>{let h=e.length-1,w={ArrowDown:()=>Math.min(h,c$1+1),ArrowUp:()=>Math.max(0,c$1-1),Home:()=>0,End:()=>h};w[b.key]?(b.preventDefault(),l(w[b.key]())):b.key==="Enter"||b.key===" "?(b.preventDefault(),C(e[c$1].code)):(b.key==="Escape"||b.key==="Tab")&&(b.preventDefault(),b.stopPropagation(),m());};return jsxs("div",{ref:d,className:cn("novapay:relative",o),children:[jsxs("button",{ref:y,type:"button","aria-haspopup":"listbox","aria-expanded":r,"aria-controls":r?`${p}-list`:void 0,className:cn(Mt,lt,"novapay:text-[11px]"),onClick:()=>r?m():v(),onKeyDown:b=>{b.key==="ArrowDown"&&!r&&(b.preventDefault(),v());},children:[jsx(ss,{"aria-hidden":true,className:"novapay:h-3.5 novapay:w-3.5"}),jsx("span",{children:i.short}),jsxs("span",{className:"novapay:sr-only",children:[", ",c(t.language.button,{language:i.name})]}),jsx(wn,{"aria-hidden":true,className:"novapay:h-3.5 novapay:w-3.5"})]}),r&&jsxs("div",{className:"tuwa-scanlines novapay:absolute novapay:right-0 novapay:top-full novapay:z-20 novapay:mt-1.5 novapay:w-60 novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:border-[var(--tuwa-border-strong)] novapay:bg-[var(--tuwa-bg-primary)] novapay:p-1.5",children:[jsx("span",{id:`${p}-title`,className:cn(He,"novapay:block novapay:px-2.5 novapay:py-1"),children:t.language.title}),jsx("ul",{ref:f,id:`${p}-list`,role:"listbox",tabIndex:-1,"aria-labelledby":`${p}-title`,"aria-activedescendant":`${p}-${e[c$1].code}`,onKeyDown:g,className:cn("novapay:m-0 novapay:flex novapay:list-none novapay:flex-col novapay:gap-0.5 novapay:p-0",ye),children:e.map((b,h)=>{let w=b.code===i.code;return jsxs("li",{id:`${p}-${b.code}`,role:"option","aria-selected":w,lang:b.code,onClick:()=>C(b.code),onPointerMove:()=>l(h),className:cn("novapay:flex novapay:h-8 novapay:cursor-pointer novapay:items-center novapay:gap-2.5 novapay:rounded-[var(--tuwa-rounded-corners)] novapay:px-2.5 novapay:text-[13px]",h===c$1&&"novapay:bg-[var(--tuwa-bg-muted)]","novapay:text-[var(--tuwa-text-primary)]",w&&"novapay:font-semibold"),children:[jsx("span",{"aria-hidden":true,className:cn($,"novapay:w-5 novapay:text-[11px]"),children:b.short}),jsx("span",{children:b.name}),w&&jsx(DrawnCheck,{className:"novapay:ml-auto novapay:h-3.5 novapay:w-3.5 novapay:text-[var(--tuwa-text-accent)]"})]},b.code)})}),jsx("p",{className:"novapay:m-0 novapay:mt-1 novapay:border-t novapay:border-[var(--tuwa-border-primary)] novapay:px-2.5 novapay:pb-1 novapay:pt-2 novapay:text-[11px] novapay:leading-snug novapay:text-[var(--tuwa-text-secondary)]",children:a?t.language.noteAfterPaid:t.language.note})]})]})}var Fs=(e,t)=>yr(e.screen,{withDetails:t})??(e.screen==="paid"?fr({withDetails:t}):null);function _s(e,t,a){let n=e.customization.components?.Stepper??ks;return jsx(n,{steps:t,labels:e.labels,className:cn(a,ne(e,"stepper")),stepClassName:(o,r)=>ne(e,"step",{step:o,index:r})})}function Bs({title:e,withDetails:t}){let a=O(),{labels:n,locale:o,setLocale:r,close:s,state:i}=a,c=a.display==="page",l=a.customization.config?.showSteps===false?null:Fs(a,t),p=ne(a,"header"),d=a.customization.handlers?.onLocaleChange,y=jsxs("div",{className:"novapay:ml-auto novapay:flex novapay:shrink-0 novapay:items-center novapay:gap-2",children:[jsx(Os,{locale:o,labels:n,receiptIssued:!!i.receiptUrl,onSelect:f=>{d?d({locale:f,proceed:()=>r(f)}):r(f);}}),s&&jsx("button",{type:"button","aria-label":n.common.close,onClick:s,className:Mt,children:jsx(CloseIcon,{"aria-hidden":true,className:"novapay:h-4 novapay:w-4"})})]});return jsxs(Fragment,{children:[jsxs("header",{className:cn("novapay:hidden novapay:items-center novapay:gap-3 novapay:border-b novapay:border-[var(--tuwa-border-primary)] novapay:py-3.5 novapay:pl-5 novapay:pr-4 novapay:sm:flex",c&&"novapay-page-header",p),children:[l?_s(a,l):e&&jsx("h2",{className:cn($,"novapay:m-0 novapay:flex-1 novapay:text-[15px] novapay:font-bold"),children:e}),y]}),jsxs("header",{className:cn("novapay:flex novapay:items-center novapay:gap-2.5 novapay:px-4 novapay:pb-3 novapay:pt-1.5 novapay:sm:hidden",c&&"novapay-page-header-phone",p),children:[jsx(Aa,{compact:true}),y]})]})}function Ms({withDetails:e}){let t=O();if(t.customization.config?.showSteps===false)return null;let a=Fs(t,e);return a?_s(t,a,"novapay:px-4 novapay:pt-3.5"):null}var Op=new Set(["paid","held","refunded","partially_refunded"]);function Tn(){let{state:e,locale:t,adapterFor:a}=O(),o=(e.invoiceStatus&&Op.has(e.invoiceStatus)?e.checkout?.quote:null)??e.quote,r=o?Ne(o.instructions):null,s=e.txHash??e.txKey,i=o?.payer?parseCaip10AccountId(o.payer)?.address:void 0,c=(e.checkout?.invoice.payments??[]).map(l=>{let p=l.chainId?un(l.chainId):null;return {txKey:l.txKey,amount:l.symbol&&l.decimals!==null?`${ue(l.amount,l.decimals,t)} ${l.symbol}`:null,at:Date.parse(l.at),explorerUrl:p&&l.chainId?a(p)?.explorerUrl?.({chainId:l.chainId,txKey:l.txKey}):void 0}});return {network:r?de(r):null,amount:o?`${ue(o.amountToSend,o.decimals,t)} ${o.instructions.symbol}`:null,paidAmount:o?`${ue(o.amountDue===o.cryptoAmountExpected?o.amountToSend:o.cryptoAmountExpected,o.decimals,t)} ${o.instructions.symbol}`:null,txKey:s,lastOfParts:o?o.amountDue!==o.cryptoAmountExpected:false,transfers:c,explorerUrl:o&&r&&s?a(o.instructions.family)?.explorerUrl?.({chainId:r,txKey:s}):void 0,from:i?shortAddress(i):null,fromAddress:i??null,fromUrl:o&&r&&i?a(o.instructions.family)?.explorerAddressUrl?.({chainId:r,address:i}):void 0}}var wo=new WeakMap,Bp=500;function Nt(e,t){let a=wo.get(e)?.get(t);if(a)return a.leftAt===null||Date.now()-a.leftAt<Bp?a.value:void 0}function jn(e,t,a,n=true){let o=wo.get(e)??new Map;o.set(t,{value:a,leftAt:n?Date.now():null}),wo.set(e,o);}function Ve(e,t){let{store:a}=O(),[n,o]=useState(()=>Nt(a,e)??t);return useEffect(()=>(o(t),jn(a,e,t,false),()=>jn(a,e,t)),[a,e,t]),n}var Ds="actionKind",Dp="actionLabel",_a="novapay-action-arrives";function In(e,t){let{store:a,customization:n}=O(),[o]=useState(()=>e==="primary"&&Nt(a,Ds)==="secondary"&&!n.config?.animation?.disabled);return Ve(Ds,e??"none"),{label:Ve(Dp,e?t:"")||t,arrives:o}}function qs({tone:e,children:t}){let a=O(),n=Ve("chipTone",e),o=Ve("chipLabel",t);return jsx("span",{className:cn(vn,"novapay:transition-colors novapay:duration-300 novapay:motion-reduce:transition-none",hn[n],ne(a,"statusChip",{tone:e})),children:jsx(MorphText,{children:o})})}var Us=["................",".....######.....","...##########...","..############..",".##############.",".##############.",".##############.",".##############.",".##############.",".##############.",".##############.",".##############.","..############..","...##########...",".....######.....","................"],Up=["................","................","................","................","................","..........##....",".........###....","....##..###.....","....######......",".....####.......","......##........","................","................","................","................","................"],Hp=["................","................","................","................","....##....##....","....###..###....",".....######.....","......####......","......####......",".....######.....","....###..###....","....##....##....","................","................","................","................"],Ba=e=>e.flatMap((t,a)=>[...t].flatMap((n,o)=>n==="."?[]:[{x:o,y:a}])),Hs=({x:e,y:t})=>`${e},${t}`,$s=(e,t)=>{let a=new Set(t.map(Hs));return e.filter(n=>!a.has(Hs(n)))},Gs={check:$s(Ba(Us),Ba(Up)),cross:$s(Ba(Us),Ba(Hp))},Ks=/M(\d+) (\d+)h(\d+)v1h-\3z/g;function Vs(e){let t=new Map,a=(n,o)=>t.set(`${n},${o}`,{x:n,y:o});for(let n of e){if("d"in n){if(n.d.replace(Ks,"")!=="")continue;for(let[,r,s,i]of n.d.matchAll(Ks))for(let c=0;c<Number(i);c++)a(Number(r)+c,Number(s));continue}if([n.x,n.y,n.width,n.height].every(Number.isInteger))for(let r=0;r<n.height;r++)for(let s=0;s<n.width;s++)a(n.x+s,n.y+r);}return [...t.values()]}function zs(e,t,a){if(t.length===0)return [];let n=Math.PI*2,o=({x:i,y:c})=>Math.atan2(c-a.y,i-a.x),r=(i,c)=>{let l=Math.abs(i-c)%n;return l>Math.PI?n-l:l},s=t.map(i=>({source:i,at:o(i)}));return e.map(i=>{let c=o(i);return s.reduce((l,p)=>r(p.at,c)<r(l.at,c)?p:l).source})}var ko="mark",jp={paid:{mark:"check",tone:"novapay:text-[var(--tuwa-success-icon)]"},failed:{mark:"cross",tone:"novapay:text-[var(--tuwa-error-icon)]"},cancelled:{mark:"cross",tone:"novapay:text-[var(--tuwa-text-secondary)]"}},Yp={unconfirmed:{Icon:Ct,tone:"novapay:text-[var(--tuwa-pending-icon)]"},underpaid:{Icon:Ct,tone:"novapay:text-[var(--tuwa-pending-icon)]"},held:{Icon:vs,tone:"novapay:text-[var(--tuwa-info-icon)]"},refunded:{Icon:ms,tone:"novapay:text-[var(--tuwa-info-icon)]"},expired:{Icon:kn,tone:"novapay:text-[var(--tuwa-text-secondary)]"},replaced:{Icon:us,tone:"novapay:text-[var(--tuwa-info-icon)]"},blocked:{Icon:hs,tone:"novapay:text-[var(--tuwa-error-icon)]"}},Ys={waiting:"processing",paid:"succeed",failed:"failed"};function Zp(e,t){let a=e.viewBox.baseVal,n=e.getBoundingClientRect();if(!a||a.width===0||n.width===0)return [];let o=(c,l)=>Number(c.getAttribute(l)??0),r=c=>!c.closest("defs, clipPath, mask"),s=[...[...e.querySelectorAll("rect")].filter(r).map(c=>({x:o(c,"x"),y:o(c,"y"),width:o(c,"width"),height:o(c,"height")})),...[...e.querySelectorAll("path")].filter(r).map(c=>({d:c.getAttribute("d")??""}))],i=n.width/a.width;return Vs(s).map(({x:c,y:l})=>({x:n.left-t.left+(c+.5)*i,y:n.top-t.top+(l+.5)*i}))}function Jp(e,t,a){let n=[...e.querySelectorAll("[data-px]")],o=e.viewBox.baseVal,r=e.getBoundingClientRect();if(n.length===0||!o||o.width===0||r.width===0)return;let s=r.width/o.width,i=n.map(p=>({x:r.left-t.left+(Number(p.getAttribute("x")??0)+.5)*s,y:r.top-t.top+(Number(p.getAttribute("y")??0)+.5)*s})),c=zs(i,a,{x:t.width/2,y:t.height/2});if(c.length===0)return;let l=p=>`${Math.round(p/s*100)/100}px`;n.forEach((p,d)=>{p.style.setProperty("--nova-px-x",l(c[d].x-i[d].x)),p.style.setProperty("--nova-px-y",l(c[d].y-i[d].y));});}function Xp({mark:e,moves:t,className:a}){return jsx("svg",{viewBox:`0 0 ${16} ${16}`,shapeRendering:"crispEdges",fill:"currentColor","aria-hidden":"true",className:cn("novapay:block",a),"data-motion":t?"assemble":void 0,children:Gs[e].map(({x:n,y:o})=>jsx("rect",{x:n,y:o,width:1,height:1,"data-px":"",style:pixelFlight(n,o)},`${n}-${o}`))})}function Zs({kind:e,className:t}){let a=O(),{store:n,customization:o}=a,{look:r}=useNovaIcons(),s=useRef(null),i=useRef(null),c=!o.config?.animation?.disabled;useLayoutEffect(()=>{let g=s.current,b=g?.querySelector("svg")??null,h=g?.getBoundingClientRect(),w=i.current??Nt(n,ko)??null;b&&h&&c&&w&&w.kind!==e&&Jp(b,h,w.pixels);let T={kind:e,pixels:b&&h?Zp(b,h):[]};return i.current=T,jn(n,ko,T,false),()=>jn(n,ko,T)},[e,n,c]);let l=o.childCustomizations?.statusVisual,p=e in Ys?Ys[e]:null,d=p&&cn(l?.iconClassNames?.icon,l?.iconClassNames?.statusOverrides?.[p]),y=jp[e],f=Yp[e],v=o.components?.StatusIcon,m=p?void 0:ne(a,"statusIcon",{kind:e}),C;if(!p&&v)C=jsx(v,{kind:e,className:m});else {if(p&&r!=="pixel")return jsx(TxStatusVisual,{isProcessing:e==="waiting",isSucceed:e==="paid",isFailed:e==="failed",...l,className:cn(t,l?.className)});e==="waiting"?C=jsx(QuasarLoader,{size:64,accent:"var(--tuwa-pending-icon)",className:cn("novapay:text-[var(--tuwa-text-primary)]",d)}):y&&r==="pixel"?C=jsx(Xp,{mark:y.mark,moves:c,className:cn(p?"novapay:h-16 novapay:w-16":"novapay:h-12 novapay:w-12",y.tone,d,m)}):y?C=jsx(DrawnCross,{variant:"disc",className:cn("novapay:h-12 novapay:w-12",y.tone,m)}):f&&(C=jsx(f.Icon,{"aria-hidden":true,className:cn("novapay:h-12 novapay:w-12",f.tone,m),...c&&r==="pixel"?{motion:"assemble"}:{}}));}return jsx("div",{className:cn("novapay:flex novapay:justify-center novapay:py-4",t,p&&l?.className),children:jsx("span",{ref:s,className:"novapay:relative novapay:flex novapay:h-16 novapay:w-16 novapay:items-center novapay:justify-center",children:C})})}function Xs({children:e,className:t}){let a=Ve("title",e);return jsx("h2",{...Dt,"aria-label":e,className:cn(pt,t),children:jsx(MorphText,{wrap:true,children:a})})}function Ut({mark:e,tone:t,chip:a,title:n,amount:o,note:r}){let{display:s}=O(),i=s==="page",c=Ve("amount",o??""),l=Ve("note",r??"");return jsxs(Fragment,{children:[jsx(Zs,{kind:e,className:i?"novapay-page-visual":void 0}),jsxs("div",{className:"novapay:flex novapay:w-full novapay:max-w-sm novapay:flex-col novapay:items-center",children:[jsx(qs,{tone:t,children:a}),jsx(Xs,{className:"novapay:mt-2",children:n}),o&&jsx("p",{"aria-label":o,className:cn($,"novapay:m-0 novapay:mt-2 novapay:text-2xl novapay:font-bold",i&&"novapay-page-amount"),children:jsx(MorphText,{children:c||o})}),r&&jsx("p",{className:"novapay:m-0 novapay:mt-1 novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:jsx(MorphText,{wrap:true,children:l||r})})]})]})}var ni="steps";function Rn({state:e}){let{store:t,customization:a}=O(),n=a.childCustomizations,[o]=useState(()=>Nt(t,ni)!==void 0),r=Ve(ni,e),s=jsx(TxProgressIndicator,{isProcessing:r==="processing",isSucceed:r==="succeed",isConfirmed:r==="succeed",isFailed:r==="failed",...n?.progressIndicator,className:cn("novapay:max-w-sm",n?.progressIndicator?.className)});return o?jsx(AnimatePresence,{initial:false,children:s}):s}var lu=new Set(["open","underpaid"]);function si(){let{checkout:e,state:t,labels:a,close:n,customization:o,now:r,handedOverAt:s,display:i}=O(),c$1=i==="page",l=o.childCustomizations,p=Tn(),d=e?.invoice.dueAt?Date.parse(e.invoice.dueAt):null,y=t.invoiceStatus??e?.invoice.status,f=it(t),v=!f&>(t,e),m=e!==null&&(f||v)&&lu.has(y??"")&&d!==null&&r>=d,C=m&&kr({state:t,checkout:e,handedOverAt:s,dueAt:d}),g=Ft(t.error)==="retrying",b=In(n?"secondary":null,a.common.close);return jsxs(et,{children:[jsxs("section",{className:cn("novapay:flex novapay:flex-1 novapay:flex-col novapay:items-center novapay:gap-3 novapay:px-5 novapay:py-5 novapay:text-center",c$1&&"novapay-page-status"),children:[jsx(Ut,{mark:"waiting",tone:"pending",chip:a.status.pending,title:a.confirm.title,amount:p.amount,note:p.network?c(a.confirm.hint,{network:p.network}):null}),jsx(Rn,{state:"processing"}),jsxs(xe,{className:"novapay:max-w-sm",children:[p.network&&jsx(W,{name:a.confirm.network,children:p.network}),p.txKey&&jsx(W,{name:a.confirm.transaction,children:jsx(HashLink,{hash:p.txKey,explorerUrl:p.explorerUrl,variant:"compact",...l?.hashLink})}),p.fromAddress&&jsx(W,{name:a.confirm.from,children:jsx(HashLink,{hash:p.fromAddress,explorerUrl:p.fromUrl,variant:"compact",...l?.hashLink})})]}),jsx("p",{role:"status",className:cn("novapay:m-0 novapay:max-w-sm novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",c$1&&"novapay:mt-auto"),children:jsx(MorphText,{wrap:true,children:g?a.outcome.unconfirmedRetrying:m?c(C?a.confirm.afterDeadline:a.confirm.pastDeadline,{merchant:e.merchant.name}):v?a.confirm.invoicePayment:a.confirm.canClose})})]}),n&&jsx(ee,{children:jsx(te,{onClick:n,children:b.label})})]})}function Ma({adapter:e,store:t,wallet:a$1,chainId:n}){let[o,r]=useState("idle"),[s,i]=useState(null),[c,l]=useState(null),p=useRef(0),d=a$1?.address,y=useRef(d);useEffect(()=>{y.current!==d&&(y.current=d,p.current++,r("idle"),i(null),l(null));},[d]);let f=useRef(false);return useEffect(()=>(f.current=false,()=>{f.current=true;}),[]),{step:o,problem:s,request:c,confirm:async({quote:m=false}={})=>{let C=++p.current,g=()=>p.current===C;i(null);let b=e?.signMessage;if(!b||!a$1)return i("unsupported"),false;if(a$1.chainId!==n&&e.switchChain){r("switching");try{await e.switchChain(n);}catch(k){if(g()){let x=b$1(k);i(x==="declined"?"switchDeclined":x==="failed"?"switchFailed":x),r("idle");}return false}if(!g())return false}g()&&r("signing");let h=t.getState().payer,w=null,T=await t.getState().confirmPayer(async(k,x)=>{g()&&l(x);try{return await b({message:k,account:a$1.address,chainId:x.chainId})}catch(N){let I=b$1(N);throw w=I==="declined"&&N instanceof a&&N.step==="switch"?"switchDeclined":I,N}});return g()&&(i(w),r("idle")),T&&m&&!f.current&&t.getState().payer===h&&await t.getState().requestQuote(),T},dismiss:()=>{p.current++,r("idle"),t.getState().abandonConfirmation();}}}function pi(){let{checkout:e,state:t,store:a,labels:n,locale:o,wallet:r,adapterFor:s,connectWallet:i,setConfirmWallet:c$1}=O(),l=e?.methods.find(G=>G.id===t.methodId)??null,p=l?We(l):null,d=Ma({adapter:p?s(p):void 0,store:a,wallet:r,chainId:l?.chainId??""}),[y,f]=useState(false),v=useRef(null),m=d.step!=="idle",[C,g]=pn(m),b=useRef(false);if(useEffect(()=>{b.current&&!m&&v.current?.querySelector("[data-novapay-heading]")?.focus(),b.current=m;},[m]),!e||!l)return null;let h=e.merchant.name,w=r?.name??"",T=de(l.chainId),k=e.invoice.number??e.invoice.id,x=e.invoice.totalMinor?`${ke(_e(e.invoice.totalMinor),o)} ${e.invoice.currency}`:null,N=ha(r),I=t.phase==="quoting",F=m,L=fn(!I&&$n(t.error)?t.error:null,d.problem,n,{wallet:w,network:T,merchant:h}),U={wallet:w,invoice:k,merchant:h},E=Ge(r,l),se=()=>{E&&t.payer!==E&&a.getState().setPayer(E),d.confirm({quote:true});},P=()=>{c$1(false),a.getState().clearError();},B=E?t.confirmedWallets?.find(G=>!_t(G,E)):void 0;return jsxs("div",{ref:v,className:"novapay:relative novapay:flex novapay:flex-1 novapay:flex-col",children:[jsxs("div",{ref:C,inert:m,className:cn("novapay:flex novapay:flex-1 novapay:flex-col",m&&"novapay:hidden"),children:[jsxs(he,{title:n.payerProof.title,subtitle:n.payerProof.text,children:[r&&jsxs("div",{className:"novapay:flex novapay:items-center novapay:gap-2.5 novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:border-[var(--tuwa-border-primary)] novapay:px-3 novapay:py-2",children:[jsx("span",{className:"novapay:h-7 novapay:w-7 novapay:shrink-0",children:jsx(WalletIcon,{walletName:r.walletId})}),jsxs("span",{className:"novapay:flex novapay:min-w-0 novapay:flex-1 novapay:flex-col",children:[jsx("span",{className:"novapay:text-[13px] novapay:font-semibold",children:w}),jsx("span",{className:cn($,"novapay:truncate novapay:text-[11px] novapay:text-[var(--tuwa-text-secondary)]"),children:c(n.pay.walletLine,{address:shortAddress(r.address),network:de(r.chainId)})})]}),jsx("button",{type:"button","aria-label":n.pay.changeWallet,onClick:()=>{i(l)||f(true);},className:gn,children:n.pay.change})]}),jsx(bn,{children:n.payerProof.summary}),jsxs(xe,{children:[jsx(W,{name:n.payerProof.invoice,children:k}),jsx(W,{name:n.payerProof.merchant,children:h}),x&&jsx(W,{name:n.payerProof.amount,children:x}),r&&jsx(W,{name:n.payerProof.wallet,children:jsx(Ie,{hash:r.address,chainId:r.chainId})})]}),jsx("p",{className:"novapay:m-0 novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:n.payerProof.why}),N&&jsxs("p",{className:"novapay:m-0 novapay:flex novapay:items-start novapay:gap-2 novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:[jsx(ys,{"aria-hidden":true,className:"novapay:h-4 novapay:w-4 novapay:shrink-0"}),jsx("span",{children:c(n.payerProof.passkey,U)})]}),r&&p==="eip155"&&r.chainId!==l.chainId&&jsx("p",{className:"novapay:m-0 novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:c(n.payerProof.willSwitch,{current:de(r.chainId),network:T})}),B&&jsx("p",{className:"novapay:m-0 novapay:text-xs novapay:text-[var(--tuwa-text-primary)]",children:c(n.payerProof.alreadyConfirmed,{wallet:shortAddress(ct(B))})}),L&&jsx(J,{children:L}),y&&jsx(J,{children:n.pay.connectUnavailable})]}),jsxs(ee,{children:[jsx(Y,{busy:F||I,onClick:se,children:I?n.method.quoting:F?jsx(Ce,{label:n.payerProof.waiting,values:U}):jsx(Ce,{label:n.payerProof.confirm,values:U})}),jsx(te,{disabled:I,onClick:P,children:(t.invoiceStatus??e?.invoice.status)==="underpaid"?n.pay.backFromRest:n.pay.back}),jsx(Re,{children:N?n.payerProof.noteSmart:n.payerProof.note})]})]}),m&&jsx(en,{kind:d.step==="switching"?"switch":"proof",walletName:w,walletId:r?.walletId??"",walletIcon:r?.icon,amount:x??"",merchant:h,network:T,to:"",priceTime:null,text:c(N?n.payerProof.promptPasskey:n.payerProof.promptText,U),details:[...d.request?[{name:n.payerProof.site,value:d.request.domain}]:[],{name:n.payerProof.invoice,value:k},{name:n.payerProof.merchant,value:h},...x?[{name:n.payerProof.amount,value:x}]:[]],hint:d.request?c(n.payerProof.signInRequest,{wallet:w,site:d.request.domain}):void 0,onRetry:se,onCancel:d.dismiss,stepHeight:g})]})}function En(){let{checkout:e,labels:t,autoPayOff:a,setAutoPayOff:n}=O(),o=e?.autoCharge;return a==="done"?jsx(Re,{children:c(t.paid.autoPayTurnedOff,{merchant:e?.merchant.name??""})}):o?.status!=="active"||!o.revocation?null:jsxs(Re,{children:[t.paid.autoPayActive," ",jsx("button",{type:"button",onClick:()=>n("open"),className:ga,children:t.paid.autoPayOff})]})}var vu=/^0x[0-9a-fA-F]{64}$/,hu=/^[1-9A-HJ-NP-Za-km-z]{64,90}$/;function Zn(){let{store:e,state:t,checkout:a,labels:n,wallet:o}=O(),[r,s]=useState(false),[i,c]=useState(""),[l,p]=useState(false),[d,y]=useState(null),f=useId(),v=t.quote??a?.quote;if(!v)return null;let m=n.outcome;if(!r)return jsx(wt,{onClick:()=>s(true),children:m.nameHash});let C=async g=>{g.preventDefault();let b=i.trim();if(!(v.instructions.family==="solana"?hu:vu).test(b))return y(m.nameHashInvalid);y(null),p(true);let w=await e.getState().submit({txKey:b,...o?{from:o.address}:{}});p(false),w||y(m.nameHashRefused);};return jsxs("form",{onSubmit:g=>{C(g);},className:"novapay:flex novapay:w-full novapay:max-w-sm novapay:flex-col novapay:gap-2 novapay:text-left",children:[jsx("label",{htmlFor:f,className:"novapay:text-xs novapay:font-semibold",children:m.nameHashField}),jsx("input",{id:f,value:i,autoComplete:"off",spellCheck:false,"aria-invalid":d?true:void 0,onChange:g=>c(g.target.value),className:cn($,"novapay:box-border novapay:h-10 novapay:w-full novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:border-[var(--tuwa-border-primary)] novapay:bg-[var(--tuwa-bg-primary)] novapay:px-3 novapay:text-xs novapay:text-[var(--tuwa-text-primary)]",ye)}),d&&jsx(J,{children:d}),jsx(te,{type:"submit",disabled:l||!i.trim(),children:m.nameHashSend})]})}var di=e=>e?.code==="payment_unconfirmed",wu={nonceSpent:"unconfirmedNonceSpent",unmined:"unconfirmedUnmined",rechecked:"unconfirmedNote",retrying:"unconfirmedRetrying",notReceived:"unconfirmedNotReceived",contact:"unconfirmedContact",closed:"unconfirmedClosed",takenElsewhere:"unconfirmedTakenElsewhere",settlementRetrying:"unconfirmedSettlementRetrying",settlementFailed:"unconfirmedSettlementFailed",invoiceFull:"unconfirmedInvoiceFull"},yi=new Set(["nonceSpent","unmined","notReceived","contact","closed","takenElsewhere","settlementRetrying","settlementFailed","invoiceFull"]),fi=new Set(["nonceSpent","takenElsewhere","settlementRetrying","settlementFailed","invoiceFull"]),vi={unconfirmed:{tone:"pending",label:"unconfirmed"},underpaid:{tone:"pending",label:"underpaid"},held:{tone:"neutral",label:"review"},refunded:{tone:"neutral",label:"refunded"},expired:{tone:"neutral",label:"expired"},cancelled:{tone:"neutral",label:"cancelled"},replaced:{tone:"neutral",label:"replaced"},blocked:{tone:"error",label:"blocked"}},re=({children:e,muted:t})=>jsx("p",{className:cn("novapay:m-0 novapay:max-w-sm novapay:text-xs",t?"novapay:text-[var(--tuwa-text-secondary)]":"novapay:text-[var(--tuwa-text-primary)]"),children:e});function To(){let e=O(),{checkout:t,labels:a,onContact:n}=e;if(!t)return null;let o=jsx(Ce,{label:a.outcome.contact,values:{merchant:t.merchant.name}}),r=cn(xn,ne(e,"secondaryButton"));if(n)return jsx("button",{type:"button",onClick:n,className:r,children:o});let s=Ir(t.merchant,c(a.outcome.contactSubject,{number:t.invoice.number??t.invoice.id}));return s?jsx("a",{href:s,target:s.startsWith("mailto:")?void 0:"_blank",rel:"noopener noreferrer",className:r,children:o}):null}function hi({kind:e}){let[t,a]=useState(false),n=O(),{checkout:o,state:r,store:s,labels:i,locale:c$1,now:l,wallet:p,connectWallet:d,openInvoice:y,qrShown:f,paymentSent:v,adapterFor:m,lockPrice:C}=n;if(!o)return null;let g=o.merchant.name,b=r.quote,h=o.methods.find(P=>P.id===(r.methodId??b?.methodId)),w=o.invoice.dueAt&&!o.invoice.closed?new Intl.DateTimeFormat(c$1,{dateStyle:"medium",timeStyle:"short"}).format(Date.parse(o.invoice.dueAt)):null,T=(P,B=b)=>B?`${ue(P,B.decimals,c$1)} ${B.instructions.symbol}`:P,k=Ft(r.error),x=P=>c(i.outcome[wu[P]],{merchant:g}),N=r.followingUntil??null,I=N?jsx(re,{muted:true,children:c(i.outcome.followingUntil,{time:new Intl.DateTimeFormat(c$1,{timeStyle:"short"}).format(Date.parse(N))})}):null,F=Nr(r,o),L=P=>{if(!F||P!=="mismatch"&&(!P||!yi.has(P)))return null;let B=b??o.quote,G=B?Ne(B.instructions):null,K=B&&G?m(B.instructions.family)?.explorerUrl?.({chainId:G,txKey:F}):void 0;return jsx(et,{children:jsx(xe,{className:"novapay:w-full novapay:max-w-sm",children:jsx(W,{name:i.confirm.transaction,children:jsx(HashLink,{hash:F,explorerUrl:K,variant:"compact",...n.customization.childCustomizations?.hashLink})})})})},U,E=null,se=null;switch(e){case "unconfirmed":{if(U=i.outcome.unconfirmedTitle,bt(r.error))E=jsxs(Fragment,{children:[jsx(re,{children:Zt(r.error,i,g)}),L("mismatch")]});else if(k&&fi.has(k))E=jsxs(Fragment,{children:[jsx(re,{children:x(k)}),L(k),k==="nonceSpent"&&jsx(Zn,{})]});else {let G=k??"contact";E=jsxs(Fragment,{children:[jsx(re,{children:i.outcome.unconfirmedText}),jsx(re,{muted:true,children:x(G)}),L(G),jsx(Zn,{})]});}let{payAgain:P}=s.getState(),B=r.invoiceStatus??o.invoice.status;P&&(B==="open"||B==="underpaid")&&!(k&&fi.has(k))&&(se=bt(r.error)?r.error.held===true?jsx(Y,{onClick:()=>P(),children:i.pay.payAgain}):jsx(te,{onClick:()=>P(),children:i.pay.payAgain}):jsx(te,{onClick:()=>P(),children:i.outcome.unconfirmedPayAgain}));break}case "underpaid":{let P=b??o.quote,B=o.invoice.amountPaid,G=Ar(P,B);U=i.outcome.underpaidTitle;let K=P&&B&&jsx(re,{children:c(i.outcome.underpaidText,{received:T(B,P),total:T(P.cryptoAmountExpected,P)})});if(o.invoice.status==="underpaid"&&o.invoice.restPayable===false||r.error?.code==="method_not_found"){E=jsxs(Fragment,{children:[K,jsx(re,{children:i.outcome.underpaidClosed}),w&&jsx(re,{children:c(i.outcome.underpaidClosedRefund,{merchant:g,date:w})})]});break}let X=dn(P,l,i,g,c$1,i.outcome.underpaidRateEnded),ie=o.methods.find(ve=>ve.id===P?.methodId)??h??o.methods[0],me=r.error?.code==="payer_blocked"?c(i.outcome.underpaidBlocked,{merchant:g}):r.error&&r.error.code!=="payer_mismatch"?mn(r.error,i,g):null;E=jsxs(Fragment,{children:[K,P&&G&&jsx(re,{children:c(i.outcome.underpaidRest,{rest:T(G,P),network:de(Ne(P.instructions))})}),w&&jsx(re,{muted:true,children:c(i.outcome.underpaidNote,{merchant:g,date:w})}),X&&jsx(re,{muted:true,children:X}),me&&jsx(J,{children:me})]});let S=ie&&p?Ge(p,ie):null,_=r.error?.code==="payer_mismatch"?r.error.originWallet??null:null,M=_??o.invoice.originWallet??P?.payer??null,z=M?ct(M):void 0,be=S?parseCaip10AccountId(S)?.address:void 0,we=P?.payer!==null&&!!(z&&(be?!_t(be,z):_)),ce=()=>{if(!ie)return;if(we)return void d(ie);let ve=P?.payer===null?null:S;if(P?.payer!==null&&!ve)return void d(ie);r.methodId!==ie.id&&s.getState().selectMethod(ie.id),s.getState().setPayer(ve),C();};we&&z&&(E=jsxs(Fragment,{children:[E,jsx(re,{children:c(i.outcome.payRestFirstWallet,{wallet:shortAddress(z)})})]})),se=jsx(Y,{busy:r.phase==="quoting",onClick:ce,children:i.outcome.payRest});break}case "held":{U=c(i.outcome.heldTitle,{merchant:g});let P=o.invoice.review?.reason,B=P==="late"?i.outcome.heldLate:P==="overpaid"?i.outcome.heldOverpaid:P==="quote_expired"?i.outcome.heldQuoteExpired:i.outcome.heldScreening;E=jsxs(Fragment,{children:[jsx(re,{children:c(B,{merchant:g})}),jsx(re,{muted:true,children:i.outcome.heldNote})]});break}case "refunded":{U=i.outcome.refundedTitle;let P=o.invoice.refundedTotalMinor??o.invoice.totalMinor;E=P&&jsx(re,{children:c(i.outcome.refundedText,{merchant:g,amount:ke(_e(P),c$1),currency:o.invoice.currency})});break}case "expired":{U=i.outcome.expiredTitle;let P=Lr(o.invoice.amountPaid),B=b??o.quote,G=it(r)||gt(r,o),K=di(r.error)||k==="settlementFailed"||k==="settlementRetrying",j=K||!G&&Yt(r,o),X=!j&&k==="closed",ie=!j&&!X&&(G||v),me=!j&&!X&&!ie&&bt(r.error),S=ie||j||X||me||f,_=K?k??"contact":"rechecked";E=jsxs(Fragment,{children:[P?jsxs(Fragment,{children:[w&&jsx(re,{children:B?c(i.outcome.expiredPartText,{date:w,amount:T(P,B)}):c(i.outcome.expiredPartNoAmount,{date:w})}),!w&&B&&jsx(re,{children:c(i.outcome.closedPartText,{merchant:g,amount:T(P,B)})}),jsx(re,{children:c(i.outcome.expiredPartRefund,{merchant:g})})]}):!S&&w&&jsx(re,{children:c(i.outcome.expiredText,{date:w,merchant:g})}),j?jsxs(Fragment,{children:[jsx(re,{children:_==="rechecked"?c(i.outcome.expiredUnconfirmed,{merchant:g}):x(_)}),L(_),_==="nonceSpent"&&jsx(Zn,{})]}):X?jsxs(Fragment,{children:[jsx(re,{children:x("closed")}),L("closed")]}):ie?jsxs(Fragment,{children:[jsx(re,{children:c(i.outcome.expiredWhileConfirming,{merchant:g})}),I]}):me?jsxs(Fragment,{children:[jsx(re,{children:Zt(r.error,i,g)}),L("mismatch")]}):f?jsx(re,{children:c(i.outcome.expiredAfterQr,{merchant:g})}):jsx(re,{muted:true,children:i.outcome.expiredNote})]});break}case "cancelled":{if(U=i.outcome.cancelledTitle,k&&yi.has(k)){E=jsxs(Fragment,{children:[jsx(re,{children:x(k)}),L(k),k==="nonceSpent"&&jsx(Zn,{})]});break}let P=di(r.error)||k==="closed"||it(r)||gt(r,o)||Yt(r,o)||v,B=!P&&bt(r.error),G=P?c(i.outcome.cancelledWhilePaying,{merchant:g}):B?Zt(r.error,i,g):c(f?i.outcome.cancelledAfterQr:i.outcome.cancelledText,{merchant:g});E=jsxs(Fragment,{children:[jsx(re,{children:G}),B&&L("mismatch"),k==="retrying"&&jsx(re,{muted:true,children:i.outcome.unconfirmedRetrying}),P&&I]});break}case "replaced":{let P=o.invoice.replacedBy,B=P?.number??"";if(U=c(i.outcome.replacedTitle,{merchant:g}),E=jsxs(Fragment,{children:[jsx(re,{children:c(i.outcome.replacedText,{number:B})}),jsx(re,{muted:true,children:i.outcome.replacedPaid})]}),P?.checkoutToken){let G=P.checkoutToken;se=jsx(Y,{onClick:()=>y(G),children:jsx(Ce,{label:i.outcome.openReplacement,values:{number:B}})});}break}case "blocked":{U=i.outcome.blockedTitle;let P=r.payer?parseCaip10AccountId(r.payer)?.address:void 0;E=jsxs(Fragment,{children:[jsx(re,{children:r.error?.code==="payer_not_expected"?i.method.payerNotExpected:c(i.outcome.blockedText,{merchant:g})}),P&&jsx(Ie,{hash:P,chainId:b??o.quote?Ne((b??o.quote).instructions):null})]}),h&&(se=jsx(Y,{onClick:()=>{d(h)||a(true);},children:i.outcome.useAnotherWallet}));break}}return jsxs(Fragment,{children:[jsxs("section",{role:e==="blocked"?"alert":void 0,className:cn("novapay:flex novapay:flex-1 novapay:flex-col novapay:items-center novapay:gap-3 novapay:px-5 novapay:py-5 novapay:text-center",n.display==="page"&&"novapay-page-status"),children:[jsx(Ut,{mark:e,tone:vi[e].tone,chip:i.status[vi[e].label],title:U}),E,t&&jsx(J,{children:i.pay.connectUnavailable})]}),jsxs(ee,{children:[se,jsx(To,{}),jsx(En,{})]})]})}function Jn({children:e,className:t}){let{store:a,customization:n}=O(),[o]=useState(()=>Nt(a,"title")!==void 0),r=o&&!n.config?.animation?.disabled;return jsx("div",{className:cn("novapay:w-full",r&&"novapay-status-reveal",t),children:e})}function gi(){let e=O(),{checkout:t,state:a,labels:n,adapterFor:o,payAfterFailure:r,customization:s,display:i}=e,c$1=Tn(),l=In("primary",n.pay.payAgain);if(!t||!a.error)return null;let p=i==="page",d=s.childCustomizations,y=fa(a.error)??c$1.txKey,f=a.quote??t.quote,v=f?Ne(f.instructions):null,m=y===c$1.txKey?c$1.explorerUrl:f&&v&&y?o(f.instructions.family)?.explorerUrl?.({chainId:v,txKey:y}):void 0;return jsxs(et,{children:[jsxs("section",{className:cn("novapay:flex novapay:flex-1 novapay:flex-col novapay:items-center novapay:gap-3 novapay:px-5 novapay:py-5 novapay:text-center",p&&"novapay-page-status"),children:[jsx(Ut,{mark:"failed",tone:"error",chip:n.status.failed,title:n.failed.title,amount:c$1.amount,note:c$1.network?c(n.failed.summary,{network:c$1.network}):null}),jsx(Rn,{state:"failed"}),(c$1.network||y||c$1.fromAddress)&&jsxs(xe,{className:"novapay:max-w-sm",children:[c$1.network&&jsx(W,{name:n.confirm.network,children:c$1.network}),y&&jsx(W,{name:n.confirm.transaction,children:jsx(HashLink,{hash:y,explorerUrl:m,variant:"compact",...d?.hashLink})}),c$1.fromAddress&&jsx(W,{name:n.confirm.from,children:jsx(HashLink,{hash:c$1.fromAddress,explorerUrl:c$1.fromUrl,variant:"compact",...d?.hashLink})})]}),jsx(Jn,{className:"novapay:max-w-sm",children:jsx("p",{role:"status",className:"novapay:m-0 novapay:text-xs novapay:text-[var(--tuwa-text-primary)]",children:Hn(a.error,n,c$1.network??void 0)})})]}),jsxs(ee,{children:[jsx(Y,{onClick:r,className:l.arrives?_a:void 0,children:l.label}),jsx(Jn,{children:jsx(To,{})})]})]})}function ki({onStay:e,onLeave:t}){let{checkout:a,labels:n,locale:o}=O(),r=useId(),s=useId(),i=useRef(null),c$1=a?.invoice.dueAt?new Intl.DateTimeFormat(o,{dateStyle:"medium",timeStyle:"short"}).format(Date.parse(a.invoice.dueAt)):null;return jsx(Dialog,{open:true,onOpenChange:l=>{l||e();},children:jsxs(DialogContent,{role:"alertdialog","aria-labelledby":r,"aria-describedby":s,onOpenAutoFocus:l=>{l.preventDefault(),i.current?.focus();},className:"novapay:w-full novapay:sm:w-[24rem]",children:[jsx(DialogTitle,{"aria-hidden":true,className:"novapay:sr-only",children:n.leave.title}),jsxs("div",{className:"novapay:flex novapay:flex-col novapay:gap-3 novapay:p-5 novapay:text-center",children:[jsx("h2",{id:r,ref:i,tabIndex:-1,className:pt,children:n.leave.title}),jsx("p",{id:s,className:"novapay:m-0 novapay:text-xs",children:c$1?c(n.leave.text,{date:c$1}):n.leave.textNoDate}),jsx("p",{className:"novapay:m-0 novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:n.leave.price}),jsx(Y,{onClick:e,children:n.leave.stay}),jsx(te,{onClick:t,children:n.leave.leave})]})]})})}function An({label:e,items:t,value:a,getKey:n,onChange:o,children:r,className:s,itemClassName:i}){let c=useRef([]),l=Math.max(0,t.findIndex(d=>n(d)===a)),p=(d,y)=>{let f=t.length-1,v={ArrowRight:y+1,ArrowDown:y+1,ArrowLeft:y-1,ArrowUp:y-1,Home:0,End:f}[d.key];if(v===void 0)return;d.preventDefault();let m=v<0?f:v>f?0:v;o(n(t[m])),c.current[m]?.focus();};return jsx("div",{role:"radiogroup","aria-label":e,className:s,children:t.map((d,y)=>{let f=n(d),v=f===a;return jsx("button",{ref:m=>{c.current[y]=m;},type:"button",role:"radio","aria-checked":v,tabIndex:y===l?0:-1,onClick:()=>o(f),onKeyDown:m=>p(m,y),className:cn("novapay:cursor-pointer novapay:rounded-[var(--tuwa-rounded-corners)] novapay:text-left novapay:text-[var(--tuwa-text-primary)] novapay:transition-colors","novapay:border",v?"novapay:border-[var(--tuwa-text-accent)] novapay:bg-[var(--tuwa-bg-primary)] novapay:ring-1 novapay:ring-[var(--tuwa-text-accent)]":"novapay:border-[var(--tuwa-border-primary)] novapay:bg-[var(--tuwa-bg-secondary)] novapay:hover:border-[var(--tuwa-border-strong)]",ye,i?.(v,d)),children:r(d,v)},f)})})}function Xn({tone:e,children:t}){return jsx("span",{className:cn(vn,hn[e]),children:t})}function Ni({method:e,labels:t}){let a=po(e);return a?a.kind==="discount"?jsx(Xn,{tone:"success",children:c(t.method.discount,{percent:a.percent})}):jsx(Xn,{tone:"neutral",children:c(t.method.markup,{percent:a.percent})}):null}function Du({selected:e}){return jsx("span",{"aria-hidden":true,className:cn("novapay:h-3.5 novapay:w-3.5 novapay:shrink-0 novapay:rounded-[var(--tuwa-rounded-full)] novapay:box-border",e?"novapay:border-4 novapay:border-[var(--tuwa-text-accent)]":"novapay:border novapay:border-[var(--tuwa-text-secondary)]")})}function Wu({labels:e,terms:t,refundPolicy:a}){let n=(r,s)=>jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:cn("novapay:text-[var(--tuwa-text-accent)] novapay:underline",ye),children:s},r),o=t&&a?d(e.method.agreeBoth,{terms:n(t,e.summary.terms),refundPolicy:n(a,e.summary.refundPolicy)}):t||a?d(e.method.agreeOne,{link:t?n(t,e.summary.terms):n(a,e.summary.refundPolicy)}):null;return o?jsx("p",{className:"novapay:m-0 novapay:text-center novapay:text-[11px] novapay:text-[var(--tuwa-text-secondary)]",children:o}):null}function Ti(){let e=O(),{checkout:t,state:a,store:n,labels:o,wallet:r,payWith:s,setPayWith:i,payUrl:c$1,connectWallet:l,adapterFor:p,setHandoff:d,lockPrice:y}=e,{TokenOption:f,NetworkOption:v}=e.customization.components??{},m=useMemo(()=>t?.methods??[],[t]),C=useMemo(()=>vr(m,r?.chainId),[m,r?.chainId]),g=m.find(S=>S.id===a.methodId)??null,b=C.find(S=>S.symbol===g?.symbol)??null,h=g?pr(g,c$1):false,w=g?We(g):null,k=[...(w?!!p(w):false)?["wallet"]:[],...h?["qr"]:[]],x=k.includes(s)?s:k[0]??null,[N,I]=useState(false),F=useId(),L=useId(),U=useEffectEvent(()=>{let S=C[0]?.methods[0];!a.methodId&&S&&n.getState().selectMethod(S.id,{keepError:true});});if(useEffect(()=>U(),[C]),!t)return null;if(m.length===0)return jsx(he,{title:o.method.title,children:jsx(J,{children:o.method.noMethods})});let E=e.display==="page",se=C.reduce((S,_)=>_.methods.length>S.methods.length?_:S,C[0]),P=a.phase==="quoting",B=t.consent??null,G=!!a.consentGiven,K=!!(B?.required&&!G),j=e.customization.handlers,X=S=>{let _=()=>n.getState().selectMethod(S.id);j?.onMethodSelect?j.onMethodSelect({method:S,select:_}):_();},ie=async()=>{if(!g||!x)return;if(I(false),x==="qr"){if(s!=="qr"&&i("qr"),w!=="solana")return d(true);n.getState().setPayer(null),await n.getState().requestQuote();return}s!=="wallet"&&i("wallet");let S=Ge(r,g);if(!S)return I(!l(g));n.getState().setPayer(S),await y();},me=S=>jsxs(Fragment,{children:[jsx(bn,{children:jsx(Ce,{label:o.method.network,values:{symbol:S.symbol}})}),jsx(An,{label:c(o.method.network,{symbol:S.symbol}),items:S.methods,value:g?.id??null,getKey:_=>_.id,onChange:_=>{let M=S.methods.find(z=>z.id===_);M&&X(M);},className:E&&S.methods.length>1?"novapay:grid novapay:grid-cols-1 novapay:gap-1.5 novapay:@min-[520px]:grid-cols-2":"novapay:flex novapay:flex-col novapay:gap-1.5",itemClassName:(_,M)=>cn("novapay:flex novapay:items-center novapay:gap-2.5 novapay:px-3 novapay:py-2.5",ne(e,"networkOption",{method:M,selected:_})),children:(_,M)=>v?jsx(v,{method:_,selected:M}):jsxs(Fragment,{children:[jsx("span",{className:"novapay:h-5 novapay:w-5 novapay:shrink-0",children:jsx(NetworkIcon,{chainId:toEvmChainId(_.chainId)??_.chainId})}),jsxs("span",{className:"novapay:flex novapay:min-w-0 novapay:flex-1 novapay:flex-col novapay:gap-1",children:[jsx("span",{className:"novapay:text-[13px] novapay:font-semibold",children:de(_.chainId)}),jsxs("span",{className:"novapay:flex novapay:flex-wrap novapay:items-center novapay:gap-1.5",children:[r?.chainId===_.chainId&&jsx(Xn,{tone:"neutral",children:o.method.yourWallet}),_.featured&&jsx(Xn,{tone:"accent",children:o.method.popular}),jsx(Ni,{method:_,labels:o}),_.gasless==="auto"?jsx(Xn,{tone:"success",children:o.method.noGasFee}):jsx("span",{className:"novapay:text-[11px] novapay:text-[var(--tuwa-text-secondary)]",children:o.method.buyerPaysGas})]})]}),jsx(Du,{selected:M})]})})]});return jsxs(Fragment,{children:[jsxs(he,{title:o.method.title,subtitle:c(o.method.subtitle,{minutes:Math.round(t.quoteTtlSeconds/60)}),children:[jsx(bn,{children:o.method.token}),jsx(An,{label:o.method.token,items:C,value:b?.symbol??null,getKey:S=>S.symbol,onChange:S=>{let _=C.find(M=>M.symbol===S)?.methods[0];_&&X(_);},className:"novapay:grid novapay:grid-cols-[repeat(auto-fit,minmax(5.5rem,1fr))] novapay:gap-2",itemClassName:(S,_)=>cn("novapay:flex novapay:min-w-0 novapay:flex-col novapay:items-center novapay:gap-1 novapay:px-2 novapay:py-2",E&&"novapay-page-token",ne(e,"tokenOption",{group:_,selected:S})),children:(S,_)=>f?jsx(f,{group:S,selected:_}):jsxs(Fragment,{children:[jsx("span",{className:"novapay:h-6.5 novapay:w-6.5",children:jsx(TokenIcon,{symbol:S.symbol})}),jsx("span",{className:"novapay:text-[13px] novapay:font-semibold",children:S.symbol}),jsx("span",{className:"novapay:max-w-full novapay:truncate novapay:text-[10px] novapay:text-[var(--tuwa-text-secondary)]",children:S.methods.length>1?c(o.method.networks,{count:S.methods.length}):po(S.methods[0])?jsx(Ni,{method:S.methods[0],labels:o}):de(S.methods[0].chainId)})]})}),E&&b?jsxs("div",{className:cn("novapay:grid",b.methods.length===1&&"novapay:max-sm:hidden"),children:[se!==b&&jsx("div",{inert:true,"aria-hidden":true,className:"novapay:invisible novapay:flex novapay:flex-col novapay:gap-2.5 novapay:[grid-area:1/1] novapay:max-sm:hidden",children:me(se)}),jsx("div",{className:"novapay:flex novapay:min-w-0 novapay:flex-col novapay:gap-2.5 novapay:[grid-area:1/1]",children:me(b)})]}):b&&b.methods.length>1&&me(b),jsx(bn,{children:o.method.payWith}),jsx(An,{label:o.method.payWith,items:k,value:x,getKey:S=>S,onChange:S=>{I(false),i(S);},className:cn("novapay:grid novapay:gap-2",k.length>1&&"novapay:grid-cols-2"),itemClassName:(S,_)=>cn("novapay:flex novapay:items-center novapay:gap-2.5 novapay:px-2.5 novapay:py-2",E&&"novapay-page-way",ne(e,"payWithOption",{payWith:_,selected:S})),children:S=>S==="wallet"?jsxs(Fragment,{children:[r?jsx("span",{className:"novapay:h-5 novapay:w-5 novapay:shrink-0",children:jsx(Gn,{walletId:r.walletId,icon:r.icon})}):jsx(ls,{"aria-hidden":true,className:"novapay:h-5 novapay:w-5 novapay:shrink-0 novapay:text-[var(--tuwa-text-accent)]"}),jsxs("span",{className:"novapay:flex novapay:min-w-0 novapay:flex-col",children:[jsx("span",{className:"novapay:text-[13px] novapay:font-semibold",children:o.method.wallet}),jsx("span",{className:cn("novapay:truncate novapay:text-[11px] novapay:text-[var(--tuwa-text-secondary)]",r&&$),children:r?`${r.name} \xB7 ${shortAddress(r.address)}`:o.method.walletHint})]})]}):jsxs(Fragment,{children:[g&&We(g)==="solana"?jsx(xs,{"aria-hidden":true,className:"novapay:h-5 novapay:w-5 novapay:shrink-0"}):jsx(ds,{"aria-hidden":true,className:"novapay:h-5 novapay:w-5 novapay:shrink-0"}),jsxs("span",{className:"novapay:flex novapay:flex-col",children:[jsx("span",{className:"novapay:text-[13px] novapay:font-semibold",children:o.method.qr}),jsx("span",{className:"novapay:text-[11px] novapay:text-[var(--tuwa-text-secondary)]",children:o.method.qrHint})]})]})}),B&&jsxs("label",{className:cn("novapay:flex novapay:cursor-pointer novapay:items-start novapay:gap-2.5 novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:px-3 novapay:py-2.5 novapay:transition-colors",G?"novapay:border-[var(--tuwa-text-accent)] novapay:bg-[var(--tuwa-bg-primary)] novapay:ring-1 novapay:ring-[var(--tuwa-text-accent)]":"novapay:border-[var(--tuwa-border-primary)] novapay:bg-[var(--tuwa-bg-secondary)] novapay:hover:border-[var(--tuwa-border-strong)]",ne(e,"consentOption",{checked:G,required:B.required})),children:[jsx(Pa,{checked:G,required:B.required,"aria-labelledby":F,"aria-describedby":B.required?L:void 0,onChange:S=>n.getState().setConsentGiven(S.target.checked),className:"novapay:mt-0.5"}),jsxs("span",{className:"novapay:flex novapay:min-w-0 novapay:flex-col novapay:gap-1",children:[jsx("span",{id:F,className:"novapay:whitespace-pre-line novapay:break-words novapay:text-[12px] novapay:leading-snug",children:B.text}),B.required&&jsx("span",{id:L,className:"novapay:text-[11px] novapay:text-[var(--tuwa-text-secondary)]",children:o.method.consentRequired})]})]}),g&&!x&&jsx(J,{children:o.method.methodUnavailable}),N&&jsx(J,{children:h?o.pay.connectUnavailable:o.method.methodUnavailable}),a.error&&a.phase==="selectMethod"&&jsxs(Fragment,{children:[jsx(J,{children:mn(a.error,o,t.merchant.name)}),jsx(Sa,{error:a.error})]})]}),jsxs(ee,{children:[jsx(Y,{busy:P,disabled:!g||!x||K,onClick:()=>{g&&x&&j?.onQuote?j.onQuote({method:g,payWith:x,proceed:ie}):ie();},children:P?o.method.quoting:o.method.continue}),jsx(Wu,{labels:o,terms:t.merchant.links.terms,refundPolicy:t.merchant.links.refundPolicy}),jsx(En,{})]})]})}function Ai(e,t,a,n=false){let o=useRef(null),r=t?.id??null,s=useEffectEvent(()=>{t&&a?.({...t,status:"paid"});});useEffect(()=>{e!=="paid"||!r||o.current===r||(o.current=r,n||s());},[e,r,n]);}function Li({url:e,seconds:t,now:a,navigate:n=o=>window.location.assign(o)}){let[o,r]=useState(t>0?a:null);t>0!=(o!==null)&&r(t>0?a:null);let s=t>0?o??a:a,[i,c]=useState(false),l=e&&t>0&&!i?Math.max(0,t-Math.floor((a-s)/1e3)):null,p=useEffectEvent(()=>{e&&n(e);});return useEffect(()=>{l===0&&p();},[l]),{left:l,stay:()=>c(true)}}function Fi(){let e=O(),{checkout:t,state:a,labels:n,locale:o,now:r,close:s,wallet:i,adapterFor:c$1,setAutoPay:l,autoPayOff:p,setAutoPayOff:d,autoReturnSeconds:y,openedPaid:f,display:v}=e,m=e.customization.childCustomizations,C=Tn(),[g]=useState(r),b=t?.merchant.name??"",h=v==="modal"&&y===0?null:t?.invoice.successUrl??null,w=t?.autoCharge??null,T=w?.status==="available"?t?.methods.find(S=>S.id===w.methodId):void 0,k=T?We(T):null,x=p!=="done"&&!!(i&&k&&c$1(k)?.requestPermission),N=x||f||w?.status==="active",I=Li({url:h,seconds:N?0:y,now:r}),F=x?n.paid.autoPayOffer:h?n.paid.back:s?n.common.close:null,L=In(F===null?null:"primary",F??""),U=L.arrives?_a:void 0;if(!t)return null;let E=t.invoice.totalMinor?ke(_e(t.invoice.totalMinor),o):null,se=t.invoice.refundedTotalMinor&&BigInt(t.invoice.refundedTotalMinor)>0n?ke(_e(t.invoice.refundedTotalMinor),o):null,P=t.invoice.paidAt?Date.parse(t.invoice.paidAt):g,B=new Intl.DateTimeFormat(o,{dateStyle:"medium",timeStyle:"short"}).format(P),{transfers:G}=C,K=G.length>1?G:null,j=G.length===1?G[0]:null,X=C.txKey??j?.txKey??null,ie=C.txKey?C.explorerUrl:j?.explorerUrl,me=new Intl.DateTimeFormat(o,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"});return jsxs(et,{children:[jsxs("section",{className:cn("novapay:flex novapay:flex-1 novapay:flex-col novapay:items-center novapay:gap-3 novapay:px-5 novapay:py-5 novapay:text-center",e.display==="page"&&"novapay-page-status"),children:[jsx(Ut,{mark:"paid",tone:"success",chip:n.status.paid,title:n.paid.title,amount:C.paidAmount??(E&&`${E} ${t.invoice.currency}`),note:C.network?c(n.paid.summary,{network:C.network,date:B}):B}),jsx(Rn,{state:"succeed"}),(C.network||X||K||C.from)&&jsxs(xe,{className:"novapay:max-w-sm",children:[C.network&&jsx(W,{name:n.confirm.network,children:C.network}),K?K.map((S,_)=>jsxs(W,{name:jsxs(Fragment,{children:[jsx("span",{className:"novapay:block",children:c(n.confirm.transferOf,{index:_+1,count:K.length})}),jsx("time",{dateTime:new Date(S.at).toISOString(),className:"novapay:block novapay:text-[11px] novapay:leading-4",children:me.format(S.at)})]}),children:[S.amount&&jsx("span",{className:"novapay:block",children:S.amount}),jsx(HashLink,{hash:S.txKey,explorerUrl:S.explorerUrl,variant:"compact",...m?.hashLink})]},`${S.txKey}:${_}`)):X&&jsx(W,{name:C.lastOfParts?n.confirm.lastTransfer:n.confirm.transaction,children:jsx(HashLink,{hash:X,explorerUrl:ie,variant:"compact",...m?.hashLink})}),C.fromAddress&&jsx(W,{name:n.confirm.from,children:jsx(HashLink,{hash:C.fromAddress,explorerUrl:C.fromUrl,variant:"compact",...m?.hashLink})})]}),se&&jsx("p",{className:"novapay:m-0 novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:c(n.paid.refunded,{amount:se,currency:t.invoice.currency})}),a.receiptUrl&&jsx(Jn,{className:"novapay:max-w-sm",children:jsxs("div",{className:"novapay:flex novapay:w-full novapay:items-center novapay:gap-3 novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:border-[var(--tuwa-border-primary)] novapay:px-3 novapay:py-2 novapay:text-left",children:[jsx(is,{"aria-hidden":true,className:"novapay:h-6 novapay:w-6 novapay:shrink-0 novapay:text-[var(--tuwa-text-secondary)]"}),jsxs("span",{className:"novapay:flex novapay:min-w-0 novapay:flex-1 novapay:flex-col",children:[jsx("span",{className:"novapay:text-[13px] novapay:font-semibold",children:n.paid.receipt}),jsx("span",{className:"novapay:text-[11px] novapay:text-[var(--tuwa-text-secondary)]",children:n.paid.receiptHint})]}),jsxs("a",{href:a.receiptUrl,target:"_blank",rel:"noopener noreferrer",className:cn(gn,"novapay:gap-1.5 novapay:no-underline"),children:[jsx(ps,{"aria-hidden":true,className:"novapay:h-3.5 novapay:w-3.5"}),n.paid.download]})]})}),w?.status==="active"&&jsxs("p",{className:"novapay:m-0 novapay:flex novapay:items-center novapay:gap-1.5 novapay:text-xs novapay:text-[var(--tuwa-success-text)]",children:[jsx(DrawnCheck,{variant:"disc",className:"novapay:h-4 novapay:w-4"}),n.paid.autoPayActive,w.revocation&&jsx("button",{type:"button",onClick:()=>d("open"),className:ga,children:n.paid.autoPayOff})]}),p==="done"&&jsx("p",{className:"novapay:m-0 novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:c(n.paid.autoPayTurnedOff,{merchant:b})})]}),jsxs(ee,{children:[x&&jsx(Y,{onClick:()=>l(true),className:U,children:L.label}),h?jsxs(Fragment,{children:[jsx("a",{href:h,className:x?cn(xn,ne(e,"secondaryButton")):cn(Wt,U,ne(e,"primaryButton")),children:jsx(Ce,{label:x?n.paid.back:L.label,values:{merchant:b}})}),I.left!==null&&jsxs(Re,{children:[jsx("span",{role:"timer","aria-live":"off",children:c(n.paid.returning,{merchant:b,seconds:I.left})})," ","\xB7 ",jsx(wt,{onClick:I.stay,children:n.paid.stay})]})]}):s&&(x?jsx(te,{onClick:s,children:n.common.close}):jsx(Y,{onClick:s,className:U,children:L.label}))]})]})}function _i({state:e,screen:t,now:a,locale:n=null,handlers:o}){let r=e.checkout?.invoice.status??null,{phase:s,error:i}=e,c=e.quote?.expiresAt?Date.parse(e.quote.expiresAt):null,l=c!==null&&a>=c,p=useEffectEvent(()=>o?.onStatusChange?.({phase:s,status:r,screen:t}));useEffect(()=>p(),[s,r]);let d=useEffectEvent(()=>{n&&o?.onLocaleShown?.({locale:n});});useEffect(()=>d(),[n]);let y=useEffectEvent(()=>{i&&o?.onError?.({error:i,screen:t});});useEffect(()=>y(),[i]);let f=useRef({quote:false,invoice:false}),v=useEffectEvent(m=>o?.onExpire?.({kind:m,paymentOnTheWay:it(e)||gt(e,e.checkout)||Yt(e,e.checkout)}));useEffect(()=>{l&&!f.current.quote&&v("quote"),f.current.quote=l;},[l]),useEffect(()=>{let m=r==="expired";m&&!f.current.invoice&&v("invoice"),f.current.invoice=m;},[r]);}var $t=()=>new Promise(()=>{}),Qu={view:$t,quote:$t,buyer:$t,locale:$t,submit:$t,relay:$t,permission:$t,permissionRevoked:$t,url:()=>""},ju=createCheckoutStore({token:"idle",api:Qu,EventSource:null});function Mi(e){let{token:t,baseUrl:a,api:n,EventSource:o,pollMs:r,enabled:s=true}=e,[i,c]=useState(ju),l=useEffectEvent(()=>createCheckoutStore({token:t,baseUrl:a,api:n,EventSource:o,pollMs:r}));return useEffect(()=>{if(!s)return;let p=l();return c(p),p.getState().load(),()=>p.getState().destroy()},[t,a,s]),i}function Di(e,t){return useStore(e,t)}var tm=createStore(()=>({}));function Ha(){let e=useContext(SatelliteStoreContext)??tm,t=useStore(e,l=>l.activeConnection),a=useStore(e,l=>l.getConnectors),n=useStore(e,l=>l.watchConnectors),[o,r]=useState(0);useEffect(()=>n?.(()=>r(l=>l+1)),[n]);let s=useMemo(()=>lr(t,a?.()),[t,a,o]),i=s?.name,c=s?.icon;return useMemo(()=>s,[t,i,c])}function qi(e){let[t,a]=useState({store:e,at:null});return useEffect(()=>e.subscribe((n,o)=>{n.phase!==o.phase&&(n.phase==="confirming"?a({store:e,at:o.phase==="submitting"?Date.now():null}):o.phase==="confirming"&&a({store:e,at:null}));}),[e]),t.store===e?t.at:null}var Ui=Symbol.for("tuwaio.nova-payments.context"),Hi=globalThis,ta=Hi[Ui]??(Hi[Ui]=createContext({}));function yt(){return useContext(ta)}function $i(e,t=true){let[a,n]=useState(()=>Date.now());return useEffect(()=>{if(!t)return;let o=setInterval(()=>n(Date.now()),e);return ()=>clearInterval(o)},[e,t]),a}var Eo="nova-payments:sponsoredBatches";var Ao=()=>{try{return globalThis.sessionStorage??null}catch{return null}},Lo=()=>{try{let e=JSON.parse(Ao()?.getItem(Eo)??"[]");return Array.isArray(e)?e:[]}catch{return []}},Ki=e=>{try{e.length>0?Ao()?.setItem(Eo,JSON.stringify(e)):Ao()?.removeItem(Eo);}catch{}},$a=e=>Ki(Lo().filter(t=>t.invoiceId!==e)),Gi=e=>Ki([...Lo().filter(t=>t.invoiceId!==e.invoiceId),e]),Oo=e=>Lo().find(t=>t.invoiceId===e&&Date.now()-t.at<21e5)??null;var Vi=e=>new a("unsupported",`${e} is not available`);async function zi({adapter:e,store:t,quote:a,wallet:n,path:o,paymasterUrl:r,onWalletDone:s,onBatchAccepted:i,onSent:c}){let l=n.address;if(o==="relay"){let d=a.gasless?.relay?.typedData;if(!d||!e.signTransferAuthorization)throw Vi("A gasless signature");let y=await e.signTransferAuthorization({typedData:d,account:l});return s?.(),t.getState().relay(y)}if(o==="paymaster"){let d=a.gasless?.paymaster?.calls;if(!d||!r||!e.sendSponsoredCalls)throw Vi("A sponsored payment");let y=Ne(a.instructions),f=await e.sendSponsoredCalls({calls:d,paymasterUrl:r,chainId:y,account:l,onSent:s,onAccepted:i,onLate:v=>{c?.(v),t.getState().submit({txKey:v,connectorType:n.connectorType,methodId:a.methodId});}});return s?.(),c?.(f),t.getState().submit({txKey:f,connectorType:n.connectorType,methodId:a.methodId})}let p=await e.sendTransfer({instructions:a.instructions,account:l,connection:n.connection});return s?.(),c?.(p),t.getState().submit({txKey:p,connectorType:n.connectorType,methodId:a.methodId})}var Kt=new WeakMap;function Ga(e){let t=Kt.get(e);return !!(t?.accepted&&Date.now()<t.until)}function ji({adapter:e,store:t,quote:a$1,wallet:n,path:o,paymasterUrl:r,invoiceId:s,onSent:i}){let[c,l]=useState("idle"),[p,d]=useState(()=>{let h=Kt.get(t),w=h?.unconfirmed&&h.account===n?.address&&Date.now()<h.until,T=s?Oo(s):null;return w||T?"sentUnconfirmed":null}),y=useEffectEvent(h=>i?.(h));useEffect(()=>{if(!s||Kt.has(t))return;let h=Oo(s);if(!h)return;let w=Promise.reject(new a("sentUnconfirmed","The sponsored payment is not confirmed yet"));w.catch(()=>{});let T=h.at+21e5;Kt.set(t,{account:h.account,path:"paymaster",paying:w,until:T,unconfirmed:true,instructions:h.instructions,accepted:true}),e?.followSponsoredCalls?.({batchId:h.batchId,until:T,onLate:k=>{$a(s),y({txKey:k,instructions:h.instructions,account:h.account,connectorType:h.connectorType}),t.getState().submit({txKey:k,connectorType:h.connectorType,methodId:h.methodId});}});},[s,e,t]);let f=useRef(0),[v,m]=useState(null),[C,g]=useState(null),b=async(h,w)=>{let T=++f.current,k=()=>f.current===T;d(null),l(h);try{await w(k);}catch(x){k()&&d(b$1(x));}finally{k()&&l("idle");}};return {status:c,problem:p,askedWallet:v,askedInstructions:C,pay:()=>b("wallet",async h=>{if(!e||!a$1||!n)return d("unsupported");m(n);let w=Kt.get(t),T=w?.path==="relay"&&o==="relay";if(w?.account===n.address&&!T&&Date.now()<w.until){g(w.instructions),await w.paying;return}g(a$1.instructions);let k={account:n.address,path:o,paying:Promise.resolve(),until:Date.now()+6e5,unconfirmed:!1,instructions:a$1.instructions,accepted:!1};Kt.set(t,k);let x=zi({adapter:e,store:t,quote:a$1,wallet:n,path:o,paymasterUrl:r,onWalletDone:()=>{o==="paymaster"&&(k.accepted=!0),h()&&l("submitting");},onBatchAccepted:I=>{s&&Gi({invoiceId:s,batchId:I,account:n.address,instructions:a$1.instructions,connectorType:n.connectorType,methodId:a$1.methodId,at:Date.now()});},onSent:I=>{s&&$a(s),i?.({txKey:I,instructions:a$1.instructions,account:n.address,connectorType:n.connectorType});}});k.paying=x;let N=()=>{Kt.get(t)===k&&Kt.delete(t),s&&$a(s);};x.then(N,I=>{if(b$1(I)!=="sentUnconfirmed")return N();k.unconfirmed=!0,k.until=Date.now()+21e5;}),await x;}),switchNetwork:()=>b("switching",async()=>{if(!e?.switchChain||!a$1)return d("unsupported");await e.switchChain(Ne(a$1.instructions));}),dismiss:()=>{f.current++,l("idle");}}}var um=100,mm=300,Yi=(e,t)=>e.length>t?`${e.slice(0,t-1)}\u2026`:e;async function Zi({adapter:e,pulsar:t,payment:a,labels:n,merchant:o,invoice:r,amount:s}){if(!t||!e?.pulsarTransaction)return false;let i=r.number?c(n.pay.txDescription,{amount:s,invoice:r.number}):s,c$1=e.pulsarTransaction({...a,title:Yi(c(n.pay.txTitle,{merchant:o}),um),description:Yi(i,mm),payload:{quasarInvoice:r.id}});return await t.injectExternalPendingTxs([c$1]),true}var ym=new Set(["open","processing","underpaid"]),ec=new WeakMap,Fo=e=>{let t=ec.get(e);return t||ec.set(e,t={keys:new Set,sentHere:false}),t},fm=e=>e.split(":").at(-1)??e;function tc({store:e,adapterFor:t,pulsar:a,labels:n,locale:o}){let r=useRef({adapterFor:t,pulsar:a,labels:n,locale:o});useEffect(()=>{r.current={adapterFor:t,pulsar:a,labels:n,locale:o};});let s=useCallback(i=>{let{checkout:c}=e.getState(),{adapterFor:l,pulsar:p,labels:d,locale:y}=r.current,f=Fo(e);if(!c||!p||f.keys.has(i.txKey))return;f.keys.add(i.txKey);let{amount:v,decimals:m,symbol:C}=i.instructions;Zi({adapter:l(i.instructions.family),pulsar:p,payment:i,labels:d,merchant:c.merchant.name,invoice:{id:c.invoice.id,number:c.invoice.number},amount:`${ue(v,m,y)} ${C}`}).catch(()=>{});},[e]);return useEffect(()=>e.subscribe((i,c)=>{let{txHash:l,quote:p,checkout:d}=i;if(!l||l===c.txHash||!p||!d||!ym.has(c.invoiceStatus)||Fo(e).sentHere)return;let y=d.invoice.originWallet??p.payer;s({txKey:l,instructions:p.instructions,account:y?fm(y):"",connectorType:""});}),[e,s]),useCallback(i=>{Fo(e).sentHere=true,s(i);},[e,s])}function ac({store:e,state:t,walletTxKey:a=null}){let[n,o]=useState(null),[r,s]=useState(null),i=a!==null&&a!==r;i&&s(a);let c=t.phase,l=i||it(t)||gt(t,t.checkout)||Yt(t,t.checkout)||c==="confirming"||c==="unconfirmed",p=n?.store===e?n:null,d=l?p&&p.error===t.error?p:{store:e,error:t.error}:p&&Pr(t.error)&&t.error!==p.error?null:n;return d!==n&&o(d),d?.store===e}function na(e){let{labels:t,customization:a}=yt(),n=a?.labels?.transform,[o,r]=useState(()=>h(e)),s=g(e);s&&o!==h(e)&&r(h(e));let i$1=s?h(e):o;return useEffect(()=>{if(g(e))return;let c=true;return i(e).then(l=>c&&r(l)),()=>{c=false;}},[e]),useMemo(()=>{let c=j(i$1,t);return n?n(c,{locale:e}):c},[i$1,e,t,n])}function oc({store:e,screen:t}){let[a,n]=useState(null),o=t==="qr";return o&&a!==e&&n(e),o||a===e}function Va(e){let t=useContext(NovaConnectProviderContext),a=yt(),n=e??a.onConnectWallet;return {canConnect:!!(t||n),connecting:t?.isConnectModalOpen??false,connect:o=>t?(t.setIsConnectModalOpen(true,{adapter:o==="solana"?OrbitAdapter.SOLANA:OrbitAdapter.EVM}),true):n?(n(o),true):false}}var sc=5,Cm=2e3;function ic(){let{checkout:e,state:t,store:a$1,labels:n,locale:o,wallet:r,adapterFor:s,connectFamily:i,setAutoPayOff:c$1,setAutoPay:l,revokeSent:p,setRevokeSent:d}=O(),[y,f]=useState("idle"),[v,m]=useState(null),C=r?.address,[g,b]=useState(C);g!==C&&(b(C),m(null));let h=e?.autoCharge,w=h?.status==="active"&&!!h.replacement&&dr(t.phase);if(!e||h?.status!=="active"||!h.permission||!h.revocation)return null;let{permission:T,revocation:k}=h,x=e.merchant.name,N=T.chainId??"",I=de(N),F=ct(T.payer??""),L=e.methods.find(j=>j.id===T.methodId),U=s("eip155"),E=!!(r&&_t(r.address,F)),se=async()=>{f("network");let j=false;for(let X=0;X<sc;X++){let ie=await a$1.getState().permissionRevoked();if(ie===true)return c$1("done");j||=ie===false,X<sc-1&&await delay(void 0,Cm);}m(j?"notYet":"notAsked");},P=async()=>{if(!r)return;m(null);let j=false;try{if(!p){f("network");let X=await a$1.getState().permissionRevoked();if(X===!0)return c$1("done");if(X===null)return m("notAsked");if(!U?.revokePermission)return m("unsupported");if(f("wallet"),!await xa(U.revokePermission({revocation:k,chainId:N,account:r.address,onSent:()=>{j=!0,d(!0),f("network");}}),6e5)&&!j)return m("alreadyPending")}await se();}catch(X){j?(X instanceof a&&X.kind==="failed"&&d(false),await se().catch(()=>m("notYet"))):m(b$1(X));}finally{f("idle");}},B={wallet:r?.name??"",network:I},G=v==="notYet"?n.autoPayOff.notYet:v==="declined"?c(n.pay.declined,B):v==="unsupported"?c(n.autoPayOff.unsupported,B):v==="wrongNetwork"||v==="switchFailed"?c(n.pay.switchFailed,B):v==="notAuthorized"?c(n.pay.notAuthorized,B):v==="alreadyPending"?c(n.walletPrompt.stillWaiting,B):v==="failed"?c(n.pay.walletFailed,B):v?n.error.generic:null,K=L?Number(L.decimals):null;return jsxs(Fragment,{children:[jsxs(he,{title:n.autoPayOff.title,subtitle:c(n.autoPayOff.subtitle,{merchant:x}),children:[jsxs(xe,{children:[jsx(W,{name:n.autoPayOff.wallet,children:jsxs("span",{className:"novapay:inline-flex novapay:items-center novapay:gap-1",children:[jsx(Ie,{hash:F,chainId:N})," \xB7 ",I]})}),T.periodAmount&&K!==null&&L&&jsxs(W,{name:n.autoPayOff.allowed,children:[c(n.autoPay.limit,{amount:`${ue(T.periodAmount,K,o)} ${L.symbol}`})," ",c(n.autoPay.every,{period:va(T.periodSeconds??0,o)})]})]}),jsx("p",{className:"novapay:m-0 novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:E?c(n.autoPayOff.fee,{network:I}):c(n.autoPayOff.otherWallet,{wallet:shortAddress(F)})}),G&&jsx(J,{children:G})]}),jsxs(ee,{children:[E?jsx(Y,{busy:y!=="idle",onClick:()=>{P();},children:y==="wallet"?jsx(Ce,{label:n.autoPayOff.inWallet,values:B}):y==="network"?n.autoPayOff.waiting:p?n.autoPayOff.checkAgain:jsx(Ce,{label:n.autoPayOff.confirm,values:B})}):jsx(Y,{onClick:()=>{i("eip155");},children:n.autoPayOff.connect}),!E&&r&&w&&jsx(te,{onClick:()=>{c$1(null),l(true);},children:n.autoPayOff.useThisWallet}),jsx(te,{onClick:()=>c$1(null),children:n.autoPayOff.keep})]})]})}function cc({box:e,content:t,isNarrow:a,isActive:n,duration:o=300}){if(typeof ResizeObserver>"u")return ()=>{};let r,s,i=0,c=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,l=()=>{s=void 0,e.style.removeProperty("overflow");},p=()=>{let f=s;l(),f?.cancel();},d=()=>{let f=t.offsetHeight,v=r;if(r=f,v===void 0||v===f)return;if(s){s.effect?.setKeyframes?.([{height:`${i}px`},{height:`${f}px`}]);return}if(!a()||!n()||c()||typeof e.animate!="function"||Math.abs(f-v)<12)return;i=v,e.style.overflow="clip";let C=e.animate([{height:`${v}px`},{height:`${f}px`}],{duration:o,easing:"cubic-bezier(0.2, 0, 0, 1)"});s=C;let g=()=>{s===C&&l();};C.onfinish=g,C.oncancel=g;},y=new ResizeObserver(d);return y.observe(t),d(),()=>{y.disconnect(),p();}}function uc({active:e,children:t}){let a=useRef(null),n=useRef(null),o=useRef(e);return useEffect(()=>{o.current=e;},[e]),useEffect(()=>{if(!a.current||!n.current||typeof window>"u"||!window.matchMedia)return;let r=window.matchMedia("(max-width: 639.98px)");return cc({box:a.current,content:n.current,isNarrow:()=>r.matches,isActive:()=>o.current})},[]),jsx("div",{ref:a,className:"novapay:flex novapay:flex-none novapay:flex-col novapay:sm:min-h-0 novapay:sm:flex-1",children:jsx("div",{ref:n,className:"novapay:flex novapay:flex-none novapay:flex-col novapay:sm:min-h-0 novapay:sm:flex-1",children:t})})}var Sm=e=>e.charAt(0).toUpperCase()+e.slice(1);function mc(e,t,a){let n=e.startsWith("solana:")?getSolanaCluster(e):void 0;if(!n||n==="mainnet")return null;let o={network:de(e),cluster:Sm(n),wallet:t?.name??""},r=t?.family!=="solana"?void 0:t.walletId==="phantom"?a.pay.solanaHintPhantom:t.walletId==="solflare"?a.pay.solanaHintSolflare:a.pay.solanaHintOther;return {title:c(a.pay.solanaNetwork,o),text:c(a.pay.solanaNetworkText,o),...r?{hint:c(r,o)}:{}}}function dc(e,t){let a=e.startsWith("solana:")?getSolanaCluster(e):void 0;return !a||t?.family!=="solana"||getSolanaCluster(t.chainId)===a?null:e}function yc(e,t){let a=useContext(SatelliteStoreContext),n=dc(e,t);useEffect(()=>{n&&a?.getState().switchNetwork?.(n);},[a,n]);}function Rm(e,t){return e>=1?ke(e,t):new Intl.NumberFormat(t,{maximumSignificantDigits:6}).format(e)}function Em(e,t,a,n){let o=n?.code;if(a==="declined")return c(e.pay.declined,t);if(a==="unsupported")return c(e.pay.unsupported,t);if(a==="wrongNetwork")return c(e.pay.wrongCluster,t);if(a==="switchFailed")return c(e.pay.switchFailed,t);if(a==="notAuthorized")return c(e.pay.notAuthorized,t);if(a==="alreadyPending")return c(e.walletPrompt.stillWaiting,t);if(a==="sentUnconfirmed")return c(e.pay.sentUnconfirmed,t);let r=a?null:Zt(n,e,t.merchant);return r!==null?r:a==="failed"?c(e.pay.walletFailed,t):n&&o==="payment_failed"?Hn(n,e,t.network):o==="screening_unavailable"?e.pay.screeningUnavailable:o==="request_failed"?e.pay.noAnswer:o==="price_unavailable"||o==="price_no_rpc"?e.method.priceUnavailable:o==="rate_limited"?e.method.rateLimited:o==="method_not_found"||o==="amount_out_of_range"||o==="testnet_required"?e.method.methodUnavailable:n&&!yn(n)?e.error.generic:null}var Am=(...e)=>e.reduce((t,a)=>t&&!/[。!?]$/.test(t)?`${t} ${a}`:`${t}${a}`,"");function Lm(e,t,a){let{wallet:n,adapterFor:o}=O(),r=t?.instructions.family,s=r?o(r):void 0,i=e.filter(l=>l.id!==t?.methodId&&We(l)===r),c=Ot(a&&s&&n&&i.length?`${n.address}:${i.map(l=>l.id).join()}`:null,()=>Promise.all(i.map(l=>s.getBalance({chainId:l.chainId,account:n.address,token:ur(l)}).catch(()=>0n))));return c?i.map((l,p)=>({method:l,balance:c[p]})).filter(l=>l.balance>0n):[]}function hc(){let{checkout:e,state:t,store:a,labels:n,locale:o,now:r,wallet:s,adapterFor:i,connectWallet:c$1,backToMethods:l,onPaymentSent:p,customization:d,lockPrice:y,display:f}=O(),v=d.config?.balanceCheck!==false,m=t.quote,C=e?.methods??[],g=C.find(Fe=>Fe.id===m?.methodId),b=m?.instructions.family??"eip155",h=i(b),w=m?Ne(m.instructions):"",T=s?.address??"",[k,x]=useState(false),N=Ot(m?.gasless?.paymaster&&h?.canSponsorCalls&&s?`${w}:${T}`:null,()=>h.canSponsorCalls({chainId:w,account:T})),I=m?Hr(m,{withGas:k,canSponsorCalls:N===true}):"transfer",F=ua(v&&m&&h&&s?`${w}:${T}:${m.instructions.token}`:null,()=>h.getBalance({chainId:w,account:T,token:m.instructions.token}),m?.expiresAt),L=Ot(m&&I==="transfer"&&h?.estimateFee&&s?`${w}:${T}:${m.amountToSend}`:null,()=>h.estimateFee({instructions:m.instructions,account:T})),U=ji({adapter:h,store:a,quote:m,wallet:s,path:I,paymasterUrl:t.paymasterUrl,invoiceId:e?.invoice.id,onSent:p}),E=Ma({adapter:h,store:a,wallet:s,chainId:w});yc(w,s);let se=m?.instructions.token==="native",P=m&&typeof F=="bigint"?Gr(F,m,se&&L?L.amount:0n):null,B=(t.invoiceStatus??e?.invoice.status)==="underpaid",G=Lm(C,m,v&&!!P&&!B),[K,j]=useState(false),X=E.step==="switching"||E.step==="signing"||U.status==="switching"||U.status==="submitting"||U.status==="wallet"||t.phase==="submitting",[ie,me]=pn(X);if(e&&m&&!g)return jsxs(Fragment,{children:[jsx(he,{title:n.method.methodUnavailable,children:null}),jsx(ee,{children:jsx(te,{onClick:l,children:n.pay.back})})]});if(!e||!m||!g)return null;let S=e.merchant.name,_=de(w),M=Fe=>`${ue(Fe,m.decimals,o)} ${m.instructions.symbol}`,z=$r(m),be=U.askedInstructions,we=be&&be.amount!==m.instructions.amount?`${ue(be.amount,be.decimals,o)} ${be.symbol}`:M(z.send),ce=m.expiresAt?Date.parse(m.expiresAt)-r:Number.POSITIVE_INFINITY,ve=ce<=0,rt=br(ce),Ye=t.phase==="quoting",It=e.invoice.amountPaid?null:Kr(m,e.invoice.totalMinor),Oe=(t.invoiceStatus??e.invoice.status)==="underpaid",Rt=f==="page",vt=L?da(String(L.amount),L.decimals,o):null,sn=Oe?dn(m,r,n,S,o):null,aa=e.invoice.totalMinor?ke(_e(e.invoice.totalMinor),o):null,oa=!!(s&&m.payer&&Ge(s,g)===m.payer),ra=b==="eip155"&&s&&s.chainId!==w&&!!h?.switchChain,sa=U.status!=="idle"||t.phase==="submitting"||Ye||E.step!=="idle",ht=mc(w,s,n),cn$1=()=>{a.getState().requestQuote();},Gt=t.payerProof,Vt=_r(Gt,I),xt=Vt?fn($n(t.error)?t.error:null,E.problem,n,{wallet:s?.name??"",network:_,merchant:S}):null,zt=t.phase==="awaitingPayment"&&!(Vt&&$n(t.error))?t.error:void 0,ia=Em(n,{wallet:s?.name??"",network:_,merchant:S},U.problem,zt),ca=!U.problem&&(zt?.code==="payment_failed"||zt?.code==="payment_mismatch"),Bn=()=>{c$1(g)||j(true);},Ze;ve?Ze={label:Oe?n.outcome.payRest:n.pay.newPrice,run:cn$1}:oa?ra?Ze={label:jsx(Ce,{label:n.pay.switchTo,values:{network:_}}),run:()=>{U.switchNetwork();}}:Vt?Ze={label:n.payerProof.confirmToPay,run:()=>{E.confirm();}}:Ze={label:ca?n.pay.payAgain:jsx(Ce,{label:I==="transfer"?n.pay.payAmount:n.pay.signToPay,values:{amount:M(z.send)}}),run:()=>{d.handlers?.onSubmit?d.handlers.onSubmit({quote:m,method:g,proceed:U.pay}):U.pay();},disabled:!!P||U.problem==="sentUnconfirmed"}:Ze={label:n.pay.connect,run:Bn};let Qt=E.step==="switching"?"switch":E.step==="signing"?"proof":U.status==="switching"?"switch":U.status==="submitting"||t.phase==="submitting"?"submitting":U.status==="wallet"?I==="transfer"?"confirm":"sign":null,Mn=e.invoice.number??e.invoice.id,Je=s??U.askedWallet,Et={wallet:Je?.name??"",invoice:Mn,merchant:S};return jsxs("div",{className:"novapay:relative novapay:flex novapay:flex-1 novapay:flex-col",children:[jsxs("div",{ref:ie,inert:X,className:cn("novapay:flex novapay:flex-1 novapay:flex-col",X&&"novapay:hidden"),children:[jsxs("section",{className:cn("novapay:flex novapay:flex-1 novapay:flex-col novapay:gap-3 novapay:px-5 novapay:py-4",Rt&&"novapay-page-screen novapay-page-pay"),children:[jsx("h2",{...Dt,className:"novapay:sr-only",children:n.pay.title}),s&&jsxs("div",{className:"novapay:flex novapay:items-center novapay:gap-2.5 novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:border-[var(--tuwa-border-primary)] novapay:px-3 novapay:py-2",children:[jsx("span",{className:"novapay:h-7 novapay:w-7 novapay:shrink-0",children:jsx(Gn,{walletId:s.walletId,icon:s.icon})}),jsxs("span",{className:"novapay:flex novapay:min-w-0 novapay:flex-1 novapay:flex-col",children:[jsx("span",{className:"novapay:text-[13px] novapay:font-semibold",children:s.name}),jsx("span",{className:cn($,"novapay:truncate novapay:text-[11px] novapay:text-[var(--tuwa-text-secondary)]"),children:c(n.pay.walletLine,{address:shortAddress(s.address),network:de(s.chainId)})})]}),jsx("button",{type:"button","aria-label":n.pay.changeWallet,onClick:Bn,className:gn,children:n.pay.change})]}),ra&&oa&&!ve&&jsxs("div",{role:"status",className:cn(ba,"novapay:flex novapay:gap-2 novapay:px-3 novapay:py-2 novapay:text-xs"),children:[jsx(Ct,{"aria-hidden":true,className:"novapay:h-4 novapay:w-4 novapay:shrink-0"}),jsxs("span",{children:[jsx("strong",{className:"novapay:block",children:n.pay.wrongNetwork}),c(n.pay.wrongNetworkText,{current:de(s.chainId),network:_})," ",n.pay.switchHint]})]}),ht&&!ve&&jsxs("div",{className:"novapay:flex novapay:gap-2 novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:border-[var(--tuwa-border-primary)] novapay:px-3 novapay:py-2 novapay:text-xs",children:[jsx(cs,{"aria-hidden":true,className:"novapay:h-4 novapay:w-4 novapay:shrink-0 novapay:text-[var(--tuwa-text-secondary)]"}),jsxs("span",{className:"novapay:flex novapay:flex-col novapay:gap-0.5",children:[jsx("strong",{children:ht.title}),jsx("span",{children:ht.text}),ht.hint&&jsx("span",{className:"novapay:text-[var(--tuwa-text-secondary)]",children:ht.hint})]})]}),jsxs("div",{children:[jsx("span",{className:cn(He,"novapay:block"),children:Oe?n.pay.youSendRest:n.pay.youSend}),jsxs("div",{className:cn("novapay:flex novapay:items-baseline novapay:gap-2",Rt&&"novapay-page-amount-row"),children:[jsx("span",{className:cn($,"novapay:text-[28px] novapay:font-bold novapay:leading-tight",Rt&&"novapay-page-amount"),children:ue(z.send,m.decimals,o)}),jsx("span",{className:cn($,"novapay:text-sm novapay:font-semibold"),children:m.instructions.symbol}),jsx(Vn,{text:ya(z.send,m.decimals),label:n.pay.copyAmount,copiedLabel:n.pay.copied})]}),jsxs("span",{className:"novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:[c(n.pay.onNetwork,{network:_}),aa&&!z.fee&&!Oe&&jsxs(Fragment,{children:[" \xB7 ",c(n.pay.fiatValue,{amount:aa,currency:e.invoice.currency})]})]})]}),z.fee&&jsxs("div",{className:"novapay:flex novapay:flex-col novapay:gap-1.5",children:[jsxs(xe,{children:[jsx(W,{name:Oe?n.pay.invoiceRest:n.pay.invoiceTotal,children:ue(z.receives,m.decimals,o)}),jsx(W,{name:c(n.pay.transferFee,{percent:z.fee.percent}),children:ue(z.fee.amount,m.decimals,o)}),jsx(W,{name:c(n.pay.merchantReceives,{merchant:S}),children:M(z.receives)})]}),jsx("p",{className:"novapay:m-0 novapay:text-[11px] novapay:text-[var(--tuwa-text-secondary)]",children:n.pay.transferFeeNote})]}),!ve&&jsxs("div",{className:"novapay:flex novapay:items-center novapay:gap-2 novapay:text-xs",children:[jsx(kn,{"aria-hidden":true,className:"novapay:h-4 novapay:w-4 novapay:text-[var(--tuwa-text-secondary)]"}),jsx("span",{role:"timer","aria-live":"off",className:"novapay:flex-1",children:c(sn?n.pay.restTimeLeft:n.pay.priceLocked,{time:st(ce)})}),!Oe&&jsx(wt,{disabled:Ye,onClick:cn$1,children:n.pay.refreshPrice})]}),rt&&!sn&&jsxs("div",{className:"novapay:flex novapay:flex-col novapay:gap-2 novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:border-[var(--tuwa-text-accent)] novapay:px-3 novapay:py-2",children:[jsx("span",{"aria-hidden":true,className:"novapay:text-xs",children:c(n.pay.priceEnding,{time:st(ce)})}),jsx("span",{role:"status",className:"novapay:sr-only",children:c(n.pay.priceEnding,{time:st(mo)})}),jsx("button",{type:"button",onClick:cn$1,disabled:Ye,className:Dr,children:jsx(Ce,{label:n.pay.keepPrice,values:{minutes:Math.round(e.quoteTtlSeconds/60)}})})]}),ve&&jsx(J,{children:n.pay.priceExpired}),sn&&jsx("p",{className:"novapay:m-0 novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:sn}),P&&!ve&&jsxs("div",{className:"novapay:flex novapay:flex-col novapay:gap-2 novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:border-[var(--tuwa-border-primary)] novapay:px-3 novapay:py-2 novapay:text-xs",children:[jsxs("div",{role:"alert",children:[jsx("strong",{className:"novapay:block",children:n.pay.notEnough}),c(n.pay.walletHas,{amount:M(P.have),network:_}),"."," ",c(n.pay.shortBy,{short:M(P.short),need:M(P.need)})]}),G.length>0&&jsxs("div",{className:"novapay:flex novapay:flex-col novapay:gap-1.5",children:[jsx("span",{className:"novapay:text-[var(--tuwa-text-secondary)]",children:n.pay.payFromBalance}),G.map(({method:Fe,balance:Xa})=>jsxs("button",{type:"button",onClick:()=>{let eo=s?Ge(s,Fe):null;a.getState().selectMethod(Fe.id),a.getState().setPayer(eo),y();},className:cn("novapay:flex novapay:cursor-pointer novapay:items-center novapay:justify-between novapay:gap-2 novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:border-[var(--tuwa-border-primary)] novapay:bg-transparent novapay:px-2.5 novapay:py-1.5 novapay:text-left novapay:text-xs novapay:text-[var(--tuwa-text-primary)] novapay:hover:bg-[var(--tuwa-bg-muted)]",ye),children:[jsxs("span",{className:"novapay:font-semibold",children:[Fe.symbol," \xB7 ",de(Fe.chainId)]}),jsx("span",{className:cn($,"novapay:text-[var(--tuwa-text-secondary)]"),children:c(n.pay.youHave,{amount:`${ue(String(Xa),Fe.decimals,o)} ${Fe.symbol}`})})]},Fe.id))]}),e.merchant.fundingUrl&&jsxs("span",{children:[c(n.pay.topUp,{symbol:m.instructions.symbol})," ",jsxs("a",{href:e.merchant.fundingUrl,target:"_blank",rel:"noopener noreferrer",className:cn("novapay:text-[var(--tuwa-text-accent)] novapay:underline",ye),children:[c(n.pay.getToken,{symbol:m.instructions.symbol})," \u2197"]})]})]}),jsxs(xe,{children:[It!==null&&jsx(W,{name:n.pay.rate,children:c(n.pay.rateValue,{symbol:m.instructions.symbol,price:Rm(It,o),currency:e.invoice.currency})}),jsx(W,{name:n.pay.networkFee,children:jsxs("span",{className:"novapay:inline-flex novapay:flex-col novapay:items-end novapay:gap-0.5",children:[I!=="transfer"?jsx("span",{className:"novapay:text-[var(--tuwa-success-text)]",children:c(n.pay.merchantPaysGas,{merchant:S})}):vt?c(n.pay.gasEstimate,{amount:`${vt} ${L?.symbol}`}):n.pay.gasFromWallet,m.gasless&&jsx(wt,{onClick:()=>x(!k),children:k?c(n.pay.payGasless,{merchant:S}):n.pay.payWithGas})]})}),jsxs(W,{name:n.pay.to,children:[jsx(Ie,{hash:m.instructions.to,chainId:w}),jsx("span",{className:"novapay:font-sans novapay:text-[var(--tuwa-text-secondary)]",children:S})]})]}),Vt&&!ve&&jsx("p",{className:"novapay:m-0 novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:n.payerProof.payNote}),xt&&jsx(J,{children:xt}),ia&&jsx(J,{children:ia}),!U.problem&&jsx(Sa,{error:zt}),K&&jsx(J,{children:n.pay.connectUnavailable})]}),jsxs(ee,{children:[jsx(Y,{busy:sa,disabled:Ze.disabled,onClick:Ze.run,children:Ze.label}),jsx(te,{disabled:Ye,onClick:l,children:Oe?n.pay.backFromRest:n.pay.back}),jsx(Re,{children:Am(c(n.pay.disclaimer,{merchant:S}),...wr(e)?[c(n.pay.disclaimerScreening,{merchant:S})]:[])}),jsx(En,{})]})]}),Qt==="proof"&&jsx(en,{kind:"proof",walletName:Je?.name??"",walletId:Je?.walletId??"",walletIcon:Je?.icon,amount:we,merchant:S,network:_,to:shortAddress(m.instructions.to),priceTime:null,text:c(ha(s)?n.payerProof.promptPasskey:n.payerProof.promptText,Et),details:[...E.request?[{name:n.payerProof.site,value:E.request.domain}]:[],{name:n.payerProof.invoice,value:Mn},{name:n.payerProof.merchant,value:S}],hint:E.request?c(n.payerProof.signInRequest,{wallet:Je?.name??"",site:E.request.domain}):void 0,onRetry:()=>{E.confirm();},onCancel:E.dismiss,stepHeight:me}),Qt&&Qt!=="proof"&&jsx(en,{kind:Qt,walletName:Je?.name??"",walletId:Je?.walletId??"",walletIcon:Je?.icon,amount:we,merchant:S,network:_,to:shortAddress(m.instructions.to),priceTime:ve?null:st(ce),onRetry:I==="relay"?()=>{U.pay();}:void 0,onCancel:E.step==="switching"?E.dismiss:U.dismiss,stepHeight:me})]})}var Do=4;function xc(e){let{size:t,data:a}=encode(e,{ecc:"M",border:0}),n="";return a.forEach((o,r)=>o.forEach((s,i)=>{s&&(n+=`M${i+Do} ${r+Do}h1v1h-1z`);})),{size:t+Do*2,path:n}}function qo({value:e,label:t,className:a}){let n=O(),o=cn(a,ne(n,"qrCode")),{size:r,path:s}=useMemo(()=>xc(e),[e]),i=n.customization.components?.QrCode;return i?jsx(i,{value:e,label:t,className:o}):jsxs("svg",{role:"img","aria-label":t,viewBox:`0 0 ${r} ${r}`,shapeRendering:"crispEdges",className:cn("novapay:block novapay:rounded-[var(--tuwa-rounded-corners)]",o),children:[jsx("rect",{width:r,height:r,fill:"#ffffff"}),jsx("path",{d:s,fill:"#111827"})]})}function Mm({payUrl:e}){let{labels:t,backToMethods:a,display:n}=O();return jsxs(Fragment,{children:[jsx(he,{title:t.qr.handoffTitle,subtitle:t.qr.handoffHint,children:jsxs("div",{className:"novapay:flex novapay:flex-col novapay:items-center novapay:gap-3 novapay:py-2",children:[jsx(qo,{value:e,label:t.qr.handoffCode,className:cn("novapay:h-48 novapay:w-48",n==="page"&&"novapay-page-qr-handoff")}),jsx(Vn,{text:e,label:t.qr.copyLink,copiedLabel:t.pay.copied,children:t.qr.copyLink}),jsx("p",{className:"novapay:m-0 novapay:max-w-xs novapay:text-center novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:t.qr.handoffNote})]})}),jsx(ee,{children:jsx(te,{onClick:a,children:t.qr.back})})]})}function bc(){let e=O(),{checkout:t,state:a,store:n,labels:o,locale:r,now:s,payUrl:i,backToMethods:c$1}=e,l=a.quote;if(!t)return null;if(!l||l.instructions.family!=="solana")return i?jsx(Mm,{payUrl:i}):null;let{instructions:p}=l,d=de(Ne(p)),y=`${ue(l.amountToSend,l.decimals,r)} ${p.symbol}`,f=l.expiresAt?Date.parse(l.expiresAt)-s:Number.POSITIVE_INFINITY,v=f<=0,m=a.phase==="quoting",C=(a.invoiceStatus??t.invoice.status)==="underpaid",g=C?dn(l,s,o,t.merchant.name,r):null,b=C?t.invoice.originWallet:null,h=b?c(o.qr.restHint,{wallet:shortAddress(ct(b))}):o.qr.solanaHint;return jsxs(Fragment,{children:[jsxs(he,{title:o.qr.solanaTitle,subtitle:h,children:[jsxs("div",{className:"novapay:flex novapay:flex-col novapay:items-center novapay:gap-4 novapay:@min-[440px]:flex-row novapay:@min-[440px]:items-start",children:[jsx(qo,{value:p.solanaPayUrl,label:c(o.qr.solanaCode,{amount:y}),className:cn("novapay:h-44 novapay:w-44 novapay:shrink-0",e.display==="page"&&"novapay-page-qr",v&&"novapay:opacity-30")}),jsxs("div",{className:"novapay:flex novapay:min-w-0 novapay:flex-col novapay:gap-2 novapay:self-stretch novapay:text-xs novapay:@min-[440px]:self-auto",children:[jsxs("ol",{className:"novapay:m-0 novapay:flex novapay:list-decimal novapay:flex-col novapay:gap-1 novapay:pl-4",children:[jsx("li",{children:o.qr.scanStep}),jsx("li",{children:o.qr.approveStep})]}),C&&jsx("span",{className:"novapay:text-[var(--tuwa-text-secondary)]",children:o.pay.youSendRest}),jsxs("div",{className:"novapay:flex novapay:items-baseline novapay:gap-2",children:[jsx("span",{className:cn($,"novapay:text-2xl novapay:font-bold"),children:ue(l.amountToSend,l.decimals,r)}),jsx(Vn,{text:ya(l.amountToSend,l.decimals),label:o.pay.copyAmount,copiedLabel:o.pay.copied})]}),jsxs("div",{"data-qr-line":true,className:cn($,"novapay:flex novapay:flex-wrap novapay:items-center novapay:gap-x-1 novapay:gap-y-0.5 novapay:text-[var(--tuwa-text-secondary)]"),children:[jsxs("span",{"data-qr-part":true,className:"novapay:whitespace-nowrap",children:[p.symbol," \xB7"]}),jsxs("span",{"data-qr-part":true,className:"novapay:whitespace-nowrap",children:[d," \xB7"]}),jsx("span",{"data-qr-part":true,className:"novapay:whitespace-nowrap",children:jsx(Ie,{hash:p.to,chainId:Ne(p)})})]}),!v&&jsxs(Fragment,{children:[jsxs("span",{role:"status",className:"novapay:flex novapay:items-center novapay:gap-1.5",children:[jsx(QuasarLoader,{size:14,accent:"var(--tuwa-pending-icon)"}),o.qr.waiting]}),jsx("span",{role:"timer","aria-live":"off",className:"novapay:text-[var(--tuwa-text-secondary)]",children:c(g?o.pay.restTimeLeft:o.pay.priceLocked,{time:st(f)})})]})]})]}),v&&jsx(J,{children:o.pay.priceExpired}),g&&jsx("p",{className:"novapay:m-0 novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:g}),jsxs("p",{className:cn(ba,"novapay:m-0 novapay:flex novapay:gap-2 novapay:px-3 novapay:py-2 novapay:text-xs"),children:[jsx(Ct,{"aria-hidden":true,className:"novapay:h-4 novapay:w-4 novapay:shrink-0"}),o.qr.exchangeWarning]})]}),jsxs(ee,{children:[v?jsx(Y,{busy:m,onClick:()=>{n.getState().requestQuote();},children:C?o.outcome.payRest:o.pay.newPrice}):jsx("a",{href:p.solanaPayUrl,className:cn(Wt,ne(e,"primaryButton")),children:o.qr.openInWallet}),jsx(te,{onClick:c$1,children:C?o.pay.backFromRest:o.qr.back})]})]})}function Ho(e){switch(e){case "confirm":return "pending";case "unconfirmed":case "underpaid":return "warning";case "paid":return "success";case "failed":case "blocked":case "error":return "error";case "held":case "refunded":case "expired":case "cancelled":case "replaced":return "neutral";default:return null}}function zm(){let{labels:e}=O();return jsxs("div",{role:"status",className:"novapay:flex novapay:flex-1 novapay:flex-col novapay:items-center novapay:justify-center novapay:gap-3 novapay:p-8 novapay:text-sm novapay:text-[var(--tuwa-text-secondary)]",children:[jsx(QuasarLoader,{size:48}),e.common.loading]})}function Qm(){let{labels:e,state:t,store:a}=O(),n=t.error?.code==="checkout_not_found";return jsxs("div",{role:"alert",className:"novapay:flex novapay:flex-1 novapay:flex-col novapay:items-center novapay:justify-center novapay:gap-3 novapay:p-8 novapay:text-center",children:[jsx(Ct,{"aria-hidden":true,className:"novapay:h-7 novapay:w-7 novapay:text-[var(--tuwa-error-icon)]"}),jsx("h2",{...Dt,className:pt,children:e.error.title}),jsx("p",{className:"novapay:m-0 novapay:max-w-sm novapay:text-[13px] novapay:text-[var(--tuwa-text-secondary)]",children:n?e.error.notFound:e.error.generic}),!n&&jsx(te,{onClick:()=>{a.getState().load();},className:"novapay:w-auto novapay:px-6",children:e.common.retry})]})}var jm=new Set(["paid","partially_refunded","refunded"]);function wc(){let{screen:e,customization:t}=O(),a=t.components?.screens?.[e];return a?jsx(a,{screen:e}):e==="loading"?jsx(zm,{}):e==="error"?jsx(Qm,{}):e==="buyer"?jsx(bs,{}):e==="method"?jsx(Ti,{}):e==="confirmWallet"?jsx(pi,{}):e==="pay"?jsx(hc,{}):e==="qr"?jsx(bc,{}):e==="confirm"?jsx(si,{}):e==="failed"?jsx(gi,{}):e==="paid"?jsx(Fi,{}):e==="autoPay"?jsx(ts,{}):e==="autoPayOff"?jsx(ic,{}):jsx(hi,{kind:e})}function Ym({className:e,withDetails:t,leave:a}){let n=O(),{checkout:o,locale:r,labels:s,now:i,customization:c$1,display:l}=n,{Header:p=Bs,Summary:d=Es,CompactSummary:y=As}=c$1.components??{},f=c$1.config?.deadlineAnnouncements,{screen:v}=n,m=useRef(null),C=useRef(v);useEffect(()=>{let F=C.current;C.current=v;let L=m.current;if(!L||F===v||F==="loading")return;let U=L.ownerDocument.activeElement;if(U&&U!==L.ownerDocument.body&&!L.contains(U))return;let E=L.querySelector("[data-novapay-scroll] [data-novapay-heading]");if(l!=="page")return E?.focus();L.getBoundingClientRect().top<0&&L.scrollIntoView({block:"start"}),E?.focus({preventScroll:true});},[v,l]);let[g,b]=useState(""),h=useRef(null),w=o?.invoice.dueAt?Date.parse(o.invoice.dueAt):null,T=o?Un(o.invoice.status,v,o.invoice.restPayable)==="paying":false;useEffect(()=>{if(w===null)return;let F=w-i,L=hr(h.current,F,f);h.current=F,L!==null&&T&&b(L===1?s.summary.oneMinuteLeft:c(s.summary.minutesLeft,{minutes:L}));},[w,i,s,f,T]);let k=l==="page",x=Wr[k?"page":"default"],N=Ho(v),I=c$1.components?.StatusEdge??StatusEdge;return jsxs("div",{ref:m,lang:r,className:cn(x.frame,wa(l).frame,e),children:[o&&jsx("aside",{inert:!!a,className:cn(x.aside,ne(n,"summary")),children:jsx(d,{})}),jsxs("div",{inert:!!a,className:cn("novapay:relative",x.main),children:[N&&jsx(I,{tone:N,className:cn("novapay:z-20",ne(n,"statusEdge",{tone:N}))}),jsxs(uc,{active:!!N&&!k&&!c$1.config?.animation?.disabled,children:[jsx(p,{withDetails:t}),jsxs("div",{className:"novapay:sm:hidden",children:[o&&jsx(y,{className:ne(n,"compactSummary")}),jsx(Ms,{withDetails:t})]}),jsx("div",{"data-novapay-scroll":"",className:cn(x.area,ne(n,"body")),children:k?jsx("div",{className:cn("novapay:flex novapay:flex-1 novapay:flex-col",!c$1.config?.animation?.disabled&&"novapay-page-fade"),children:jsx(wc,{})},N?"status":v):jsx(wc,{})})]})]}),jsx("div",{role:"status","aria-live":"polite",className:"novapay:sr-only",children:g}),a&&jsx(ki,{onStay:a.onStay,onLeave:a.onLeave})]})}function Dk({token:e,display:t="modal",open:a=true,onOpenChange:n,onClose:o,baseUrl:r,api:s,EventSource:i,pollMs:c$1,payUrl:l,onConnectWallet:p,onPaid:d,autoReturnSeconds:y,onContact:f$1,locale:v,className:m,customization:C}){let g$1=yt(),[b,h]=useState({from:e,token:e}),w=b.from===e?b.token:e,[T,k]=useState(t!=="modal"||a);!T&&(t!=="modal"||a)&&k(true);let x=Mi({token:w,baseUrl:r??g$1.baseUrl,api:s,EventSource:i,pollMs:c$1,enabled:T}),N=Di(x,pe=>pe),I=N.checkout,F=f(v),[L,U]=useState(null),E=Tr({picked:L,page:F,invoice:N.locale??I?.invoice.locale}),se=na(E),P=!!I&&T&&Fr(N.phase,y,g(E)),G=$i(1e3,P)-(N.clockSkewMs??0),K=Ha(),j=Va(p),X=g$1.adapters,[ie,me]=useState("wallet"),[S,_]=useState(false),[M,z]=useState(false),[be,we]=useState(null),[ce,ve]=useState(false),[rt,Ye]=useState(null);I&&rt?.store!==x&&Ye({store:x,paid:jm.has(I.invoice.status)});let[It,Oe]=useState(false),[Rt,vt]=useState(false),[sn,aa]=useState(w);sn!==w&&(aa(w),_(false),z(false),we(null),ve(false),me("wallet"),vt(false));let oa=N.payerProof==="confirmed"&&!!N.error,ra=N.error?.code==="payer_mismatch";Rt&&(N.phase==="awaitingPayment"||oa||ra)&&vt(false);let sa=(N.invoiceStatus??I?.invoice.status)==="underpaid"?I?.invoice.originWallet??null:null,ht=pe=>!sa||_t(pe,sa),cn$1=I?.methods.find(pe=>pe.id===N.methodId),Gt=cn$1?Ge(K,cn$1):null,Vt=gr({open:Rt,storePayer:N.payer,payer:Gt,paysRest:!Gt||ht(Gt)});Vt==="leave"&&vt(false);let xt=useRef(null),[zt,ia]=useState(false);!zt&&I&&g(E)&&ia(true);let ca={payWith:ie,handoff:S,autoPay:M,autoPayOff:be==="open",confirmWallet:Rt,labelsReady:zt||!I},Bn=uo(N,ca),[Ze,Qt]=useState(null),[Mn,Je]=useState(null);Bn==="confirm"?Ze!==x&&Qt(x):Ze===x&&(Qt(null),N.error?.code==="payment_failed"&&Je(N.error));let Et=Mn!==null&&N.error===Mn?uo(N,{...ca,afterFailure:true}):Bn,Fe=async()=>{await Br(x,vt);},Xa=qi(x),eo=oc({store:x,screen:Et}),[Vo,Dc]=useState(null),Wc=ac({store:x,state:N,walletTxKey:Vo?.store===x?Vo.txKey:null});Ai(N.phase,I?.invoice,d,rt?.store===x&&rt.paid),_i({state:N,screen:Et,now:G,locale:I||F?E:null,handlers:C?.handlers});let zo=pe=>X?.find(Xe=>Xe.family===pe),Qo=tc({store:x,adapterFor:zo,pulsar:g$1.pulsar,labels:se,locale:E}),qc=useCallback(pe=>{Dc({store:x,txKey:pe.txKey}),Qo(pe);},[x,Qo]),Uc=useEffectEvent(()=>{if(!I)return;let{quote:pe,phase:Xe}=x.getState();if(K&&xt.current){let pa=I.methods.find(Qc=>Qc.id===xt.current),oo=pa?Ge(K,pa):null;if(!oo)return;xt.current=null,x.getState().setPayer(oo),ht(oo)&&Fe();return}if(Xe==="selectMethod"||Xe==="underpaid"||Xe==="blocked"){if(N.payer===null||Gt===N.payer)return;x.getState().setPayer(Gt),Vt==="follow"&&Fe();return}if(!K)return;let Dn=I.methods.find(pa=>pa.id===pe?.methodId),la=Dn?Ge(K,Dn):null,Jo=xr({autoPayOffOpen:be==="open",phase:Xe,quotePayer:pe?.payer,payer:la});if(Jo==="release")return x.getState().releaseQuote();Jo==="keep"||!la||(x.getState().setPayer(la),ht(la)&&Fe());}),Hc=N.quote?.payer,$c=!!I;useEffect(()=>Uc(),[K?.address,K?.chainId,K?.connectorType,be,N.phase,Hc,$c]),useEffect(()=>{j.connecting||(xt.current=null);},[j.connecting]);let[jo,Kc]=useState(false);Et==="buyer"&&!jo&&Kc(true);let to=useMemo(()=>t==="modal"?()=>{n?.(false),o?.();}:o,[t,n,o]),Gc=to&&(()=>fo(x.getState().phase,x.getState().error,x.getState().invoiceStatus)&&!Ga(x)?Oe(true):to()),Vc=It?{onStay:()=>Oe(false),onLeave:()=>{Oe(false),x.getState().releaseQuote(),to?.();}}:null,Yo=C??{},zc={store:x,state:N,checkout:I,screen:Et,locale:E,labels:se,setLocale:async pe=>{let Xe=L;U({locale:pe,page:F}),await x.getState().setLocale(pe)||U(Xe);},now:G,handedOverAt:Xa,qrShown:eo,paymentSent:Wc||Ga(x),close:Gc,wallet:K,payWith:ie,setPayWith:me,payUrl:l,connectWallet:pe=>{let Xe=We(pe);xt.current=pe.id;let Dn=Xe!==null&&j.connect(Xe);return Dn||(xt.current=null),Dn},connectFamily:pe=>j.connect(pe),openedPaid:rt?.store===x&&rt.paid,revokeSent:ce,setRevokeSent:ve,adapterFor:zo,handoff:S,setHandoff:_,backToMethods:()=>{_(false),vt(false),x.getState().releaseQuote();},payAfterFailure:()=>{Je(null),x.getState().clearError();},confirmWallet:Rt,setConfirmWallet:vt,lockPrice:Fe,onPaymentSent:qc,autoPay:M,setAutoPay:z,autoPayOff:be,setAutoPayOff:we,openInvoice:pe=>h({from:e,token:pe}),onContact:f$1,autoReturnSeconds:y??(t==="modal"?0:5),display:t,customization:Yo},no=cn(m,ne({customization:Yo,screen:Et,state:N,checkout:I},"container")),ao=jsx(or,{value:zc,children:jsx(MotionConfig,{reducedMotion:C?.config?.animation?.disabled?"always":"user",children:jsx(Ym,{withDetails:jo,leave:Vc,className:t==="modal"?no:void 0})})});if(t==="modal")return jsx(Dialog,{open:a,onOpenChange:pe=>{if(!pe&&It)return Oe(false);if(!pe&&fo(x.getState().phase,x.getState().error,x.getState().invoiceStatus)&&!Ga(x))return Oe(true);n?.(pe),pe||o?.();},children:jsxs(DialogContent,{className:"novapay:w-full novapay:sm:w-auto",animateHeight:Ho(Et)===null,children:[jsx(DialogTitle,{className:"novapay:sr-only",children:c(se.common.dialogTitle,{merchant:I?.merchant.name??""})}),ao]})});let Zo=c(se.common.dialogTitle,{merchant:I?.merchant.name??""});return t==="page"?jsx(Zm,{label:Zo,className:no,children:ao}):jsx("section",{"aria-label":Zo,className:cn("novapay:overflow-hidden novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:border-[var(--tuwa-border-primary)]",wa(t).section,no),children:ao})}function Zm({label:e,className:t,children:a}){return jsx("div",{className:"novapay-page",children:jsx("section",{"aria-label":e,className:cn(wa("page").section,"novapay-page-block",t),children:a})})}function kc(e){if(!e.to)return null;let t=parseCaip19AssetId(e.assetId),a={to:e.to,token:!t||t.assetNamespace==="slip44"?"native":t.assetReference,amount:e.amount,decimals:e.decimals,symbol:e.symbol},n=un(e.chainId);if(n==="solana")return {family:n,chainId:e.chainId,...a,reference:"",solanaPayUrl:""};let o=n==="eip155"?toEvmChainId(e.chainId):void 0;return o===void 0?null:{family:"eip155",chainId:o,...a}}function Pc(e){let t=b$1(e);return t==="switchFailed"?"wrongNetwork":t==="notAuthorized"||t==="alreadyPending"||t==="sentUnconfirmed"?"failed":t}var Ko=new WeakMap,Fn=new WeakMap;function Sc({store:e,invoiceId:t,invoice:a,params:n,open:o,labels:r,locale:s,onConnectWallet:i}){let c$1=useStore(e),{adapters:l,pulsar:p}=yt(),d=Ha(),y=Va(i),[f,v]=useState("idle"),[m,C]=useState(null),[,g]=useState(0),b=Fn.has(e),h=useRef(0),w=useRef(o),T=c$1.sentTransaction?.txHash??c$1.refund?.txHash??null,k=c$1.instructions?kc(c$1.instructions):null,x=k?.family??null,N=k?Ne(k):c$1.instructions?.chainId??null,I=l?.find(M=>M.family===x),F=d&&d.family===x?d:null,L=N?de(N):"",U=m&&m.account===F?.address?m.problem:null,E=M=>C(M?{problem:M,account:F?.address}:null),se=!!(F&&x==="eip155"&&N&&F.chainId!==N),P=c$1.instructions,B=P?`${ue(P.amount,P.decimals,s)} ${P.symbol}`:"",G=ua(k&&F&&I?`balance|${N}|${F.address}|${k.token}`:null,()=>I.getBalance({chainId:N,account:F.address,token:k.token}),c$1.refund?.id),K=Ot(k&&F&&I?.estimateFee?`fee|${N}|${F.address}|${k.token}`:null,()=>I.estimateFee({instructions:k,account:F.address}));useEffect(()=>{!n||Ko.get(e)===t||e.getState().phase!=="idle"||(Ko.set(e,t),e.getState().start(t,n));},[n,e,t]),useEffect(()=>{o&&!w.current&&!n&&e.getState().phase==="confirmed"&&e.getState().reset(),w.current=o;},[o,n,e]),useEffect(()=>(e.getState().keepFollowing(),()=>e.getState().stopFollowing()),[e]),useEffect(()=>{let M=true;return Fn.get(e)?.settled.then(()=>{M&&g(z=>z+1);}),()=>{M=false;}},[e]);let j=async(M,z,be)=>{if(!p||!I?.pulsarTransaction||!c$1.refund)return;let we={invoice:a??t,amount:B};try{await p.injectExternalPendingTxs([I.pulsarTransaction({txKey:M,instructions:be,account:z.address,connectorType:z.connectorType,title:c(r.refund.txTitle,we),description:c(c$1.refund.heldTransfer?r.refund.txDescriptionSender:r.refund.txDescription,we),payload:{quasarRefund:c$1.refund.id}})]);}catch{}},X=async()=>{if(E(null),!(!se||!I?.switchChain))try{v("switching"),await I.switchChain(N);}catch(M){E(Pc(M));}finally{v("idle");}},ie=async()=>{if(E(null),!k)return E("noRecipient");if(!F||!I)return E("unsupported");if(c$1.sentTransaction){await e.getState().submit(c$1.sentTransaction);return}let M=BigInt(k.amount)+(k.token==="native"&&K?K.amount:0n);if(typeof G=="bigint"&&G<M)return E("notEnough");if(x&&k.to&&isSameAddress(x,F.address,k.to))return E("fromBuyer");if(!await e.getState().recheck()){let we=e.getState(),ce=we.error?.code==="refund_repriced";we.phase==="awaitingTransfer"&&!we.sentTransaction&&!ce&&E("unreachable");return}let z=++h.current,be=()=>h.current===z;try{se&&I.switchChain&&(v("switching"),await I.switchChain(N)),be()&&v("wallet");let we=await I.sendTransfer({instructions:k,account:F.address,connection:F.connection});be()?v("idle"):C(null),j(we,F,k),await e.getState().submit({txHash:we,from:F.address});}catch(we){be()?(v("idle"),E(Pc(we))):C(null);}},me=async()=>{if(Fn.has(e))return;let M,z={settled:new Promise(ce=>M=ce)},be=()=>{Fn.get(e)===z&&Fn.delete(e),M(),g(ce=>ce+1);},we=setTimeout(be,6e5);Fn.set(e,z),g(ce=>ce+1);try{await ie();}finally{clearTimeout(we),be();}},S=f!=="idle"?f:F?"confirm":"connect";return {step:c$1.phase==="idle"?n&&!c$1.error&&Ko.get(e)!==t?"requesting":"amount":c$1.phase==="awaitingTransfer"?S:c$1.phase,phase:c$1.phase,refund:c$1.refund,error:c$1.error,transfer:k,chainId:N,network:L,amount:B,wallet:F,wrongNetwork:se,balance:G,fee:K,problem:U??(c$1.instructions&&!k?"noRecipient":null),txKey:T,transactionUrl:M=>N?I?.explorerUrl?.({chainId:N,txKey:M}):void 0,addressUrl:M=>N?I?.explorerAddressUrl?.({chainId:N,address:M}):void 0,canConnect:y.canConnect,connecting:y.connecting,preview:async M=>{let z=await e.getState().preview(t,M);return z||(e.getState().error?"refused":null)},start:async M=>{E(null),await e.getState().start(t,M);},connect:()=>{x&&y.connect(x);},switchNetwork:X,send:me,dismiss:()=>{h.current++,v("idle"),E("stillInWallet");},sending:b}}function vC({label:e,className:t,disabled:a,...n}){let[o,r]=useState(false),s=na(n.locale??"en");return jsxs(Fragment,{children:[jsx("button",{type:"button",disabled:a,onClick:()=>r(true),className:cn(Wt,"novapay:w-auto novapay:px-4",t),children:e??s.refund.button}),jsx(cd,{...n,open:o,onOpenChange:r})]})}function cd({open:e,onOpenChange:t,locale:a="en",onRefunded:n,...o}){let r=na(a),s=Sc({store:o.store,invoiceId:o.invoiceId,invoice:o.invoice,params:e?o.params:void 0,open:e,labels:r,locale:a,onConnectWallet:o.onConnectWallet}),i=useEffectEvent(p=>n?.(p)),c$1=s.phase==="confirmed"?s.refund:null;useEffect(()=>{c$1&&i(c$1);},[c$1]);let l=o.invoice?c(r.refund.title,{invoice:o.invoice}):r.refund.button;return jsx(Dialog,{open:e,onOpenChange:t,children:jsxs(DialogContent,{className:"novapay:w-full novapay:sm:w-[440px]",children:[jsxs("div",{className:"novapay:flex novapay:items-center novapay:justify-between novapay:gap-3 novapay:border-b novapay:border-[var(--tuwa-border-primary)] novapay:px-5 novapay:py-3",children:[jsx(DialogTitle,{className:cn($,"novapay:m-0 novapay:truncate novapay:text-sm novapay:font-bold"),children:l}),jsx("button",{type:"button","aria-label":r.refund.close,onClick:()=>t(false),className:Mt,children:jsx(CloseIcon,{"aria-hidden":true,className:"novapay:h-4 novapay:w-4"})})]}),jsx(ld,{flow:s,labels:r,locale:a,close:()=>t(false),...o})]})})}function ld({flow:e,labels:t,locale:a,close:n,currency:o="USD",refundable:r,details:s,onRecord:i}){let c$1=t.refund,l={network:e.network,symbol:e.transfer?.symbol??e.refund?.assetId??"",amount:e.amount,wallet:e.wallet?.name??""},p=e.refund?.txHash??e.txKey,d=i&&jsxs(Fragment,{children:[jsx(te,{onClick:i,children:c$1.record}),jsx(Re,{children:c$1.recordHint})]});switch(e.step){case "amount":return jsx(hd,{flow:e,labels:t,locale:a,currency:o,refundable:r});case "requesting":case "submitting":return jsx(Ec,{children:e.step==="requesting"?c$1.requesting:c$1.submitting});case "switching":case "wallet":return jsxs(Fragment,{children:[jsxs(Ec,{walletId:e.wallet?.walletId,walletIcon:e.wallet?.icon,children:[jsx("strong",{className:cn($,"novapay:text-sm"),children:c(e.step==="switching"?c$1.switchTitle:c$1.walletTitle,l)}),e.step==="wallet"&&jsx("span",{children:c(c$1.walletText,l)})]}),jsx(ee,{children:jsx(te,{onClick:e.dismiss,children:t.walletPrompt.cancel})})]});case "connect":return jsxs(Fragment,{children:[jsxs(he,{title:c$1.connectTitle,subtitle:c(c$1.connectText,l),children:[e.problem==="noRecipient"&&jsx(J,{children:c$1.noRecipient}),!e.canConnect&&jsx(J,{children:c$1.connectUnavailable})]}),jsxs(ee,{children:[e.canConnect&&e.problem!=="noRecipient"&&jsx(Y,{busy:e.connecting,onClick:e.connect,children:c$1.connect}),d]})]});case "confirm":return jsx(xd,{flow:e,labels:t,locale:a,values:l,details:s?.confirm,recordAction:d});case "confirming":return jsxs(Fragment,{children:[jsxs(he,{title:c$1.onItsWay,children:[jsxs(xe,{children:[jsx(W,{name:c$1.status,children:c$1.pending}),p&&jsx(W,{name:c$1.transaction,children:jsx(Ie,{hash:p,explorerUrl:e.transactionUrl(p),labels:t})}),jsx(W,{name:c$1.network,children:c(c$1.waiting,l)})]}),Rc(e.refund)&&jsx(Re,{children:c$1.slowNote})]}),jsxs(ee,{children:[jsx(te,{onClick:n,children:c$1.close}),Rc(e.refund)?d:jsx(Re,{children:c$1.canClose})]})]});case "confirmed":return jsxs(Fragment,{children:[jsx(he,{title:c$1.refunded,children:jsxs(xe,{children:[e.refund?.creditNoteNumber&&jsx(W,{name:c$1.creditNote,children:e.refund.creditNoteNumber}),p&&jsx(W,{name:c$1.transaction,children:jsx(Ie,{hash:p,explorerUrl:e.transactionUrl(p),labels:t})}),s?.done]})}),jsx(ee,{children:jsx(Y,{onClick:n,children:c$1.done})})]});case "failed":return jsx(vd,{flow:e,labels:t,locale:a,values:l,recordAction:d,close:n})}}var pd={amount_short:"failedShort",over_limit:"failedByHand",tx_of_another_refund:"failedByHand",refund_from_buyer:"failedFromBuyer",transaction_failed:"failedNotFound",dropped:"failedDropped",too_early:"failedTooEarly",no_matching_transfer:"failedNoTransfer",withdrawn:"failedWithdrawn",cancelled:"failedCancelling",cancelled_final:"failedCancelled",resend_confirmed:"failedResendConfirmed"},Tc=(e,t,a)=>{let n=e?.failureReason?pd[e.failureReason]:void 0;return n?t[n]:c(t.failedText,a)},ud={withdrawn:"failedWithdrawnTitle",cancelled:"failedCancelledTitle",cancelled_final:"failedCancelledTitle"},Ic=(e,t)=>t[e?.failureReason&&ud[e.failureReason]||"failedTitle"],md={refund_repriced:"movedTitle",request_failed:"unreachable",amount_exceeds_refundable:"refusedAmount",invoice_not_refundable:"refusedNotRefundable",payment_unknown:"refusedNotRefundable",held_transfer_not_refundable:"refusedNotRefundable",held_refund_must_be_whole:"refusedWhole",sender_blocked:"refusedBlocked",refund_not_waiting:"refusedNotWaiting",refund_may_have_landed:"refusedMayHaveLanded",refund_from_buyer:"failedFromBuyer",method_not_priced:"refusedPrice",price_no_rpc:"refusedPrice",price_unavailable:"refusedPrice",mainnet_disabled_on_node:"refusedTestOnly"},dd=600*1e3,Rc=e=>{let t=e?.updatedAt??e?.createdAt;return !!t&&Date.now()-Date.parse(t)>dd},Za=(e,t)=>e.text??t[md[e.code]??"refusedOther"],yd=e=>e?.failureReason==="over_limit"||e?.failureReason==="tx_of_another_refund",fd=e=>{let t=e.mode==="fiat_value"||e.failureReason==="amount_short";return {mode:t?"fiat_value":e.mode,...t&&{amount:e.amount},...e.reason&&{reason:e.reason}}};function Oc(e){let[t,a]=useState(false),[n,o]=useState(null),r=useRef(false);return useEffect(()=>(r.current=false,()=>{r.current=true;}),[]),{ask:async(i,c)=>{if(i?.mode==="fiat_value"){a(true);let l=await e.preview(i);if(r.current||(a(false),l==="refused"))return;if(l&&Or(c?{cryptoAmount:l.cryptoAmount,atPaymentRate:c.cryptoAmount}:l))return o({preview:l,request:i})}o(null),e.start(i);},checking:t,moved:n,back:()=>o(null)}}function Fc({preview:e,request:t},a,n,o,r,s){let i=o.refund,c$1=l=>`${ue(l,e.decimals,r)} ${e.symbol}`;return jsxs(Fragment,{children:[jsxs(he,{title:i.movedTitle,children:[jsx("p",{className:"novapay:m-0 novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:c(i.movedText,{symbol:e.symbol})}),jsxs(xe,{children:[jsx(W,{name:i.movedSend,children:c$1(e.cryptoAmount)}),e.atPaymentRate&&jsx(W,{name:i.movedAtPayment,children:c$1(e.atPaymentRate)}),e.received&&jsx(W,{name:i.movedReceived,children:c$1(e.received)})]}),s&&e.exactPossible&&jsx(Re,{children:c(i.movedExact,{exact:i.modeExact})}),n.error&&jsx(J,{children:Za(n.error,i)})]}),jsxs(ee,{children:[jsx(Y,{busy:a.checking,onClick:()=>{a.ask(t,e);},children:i.movedContinue}),jsx(te,{disabled:a.checking,onClick:a.back,children:i.movedBack})]})]})}function vd({flow:e,labels:t,locale:a,values:n,recordAction:o,close:r}){let s=t.refund,i=Oc(e);return e.refund?.heldTransfer?jsxs(Fragment,{children:[jsxs(he,{title:Ic(e.refund,s),children:[jsx(J,{children:Tc(e.refund,s,n)}),jsx(Re,{children:s.failedHeldNote})]}),jsx(ee,{children:jsx(Y,{onClick:r,children:s.close})})]}):i.moved?Fc(i.moved,i,e,t,a,false):jsxs(Fragment,{children:[jsxs(he,{title:Ic(e.refund,s),children:[jsx(J,{children:Tc(e.refund,s,n)}),e.error&&jsx(J,{children:Za(e.error,s)})]}),jsxs(ee,{children:[yd(e.refund)?jsx(Y,{onClick:r,children:s.close}):jsx(Y,{busy:i.checking,onClick:()=>e.refund&&void i.ask(fd(e.refund)),children:s.sendRefund}),o]})]})}function Ec({walletId:e,walletIcon:t,children:a}){return jsxs("section",{role:"status",className:"novapay:flex novapay:min-h-56 novapay:flex-col novapay:items-center novapay:justify-center novapay:gap-3 novapay:px-5 novapay:py-6 novapay:text-center",children:[jsx(Ca,{walletId:e,walletIcon:t}),a]})}function hd({flow:e,labels:t,locale:a,currency:n,refundable:o}){let r=t.refund,s=useId(),i=useId(),[c$1,l]=useState("fiat_value"),[p,d]=useState(""),[y,f]=useState(""),v=Oc(e),m=c$1==="exact_received"||p.trim()===""||/^\d{1,12}(\.\d{1,2})?$/.test(p.trim()),C=[{key:"fiat_value",title:r.modeFiat,hint:c(r.modeFiatText,{currency:n})},{key:"exact_received",title:r.modeExact,hint:r.modeExactText}],g="novapay:h-10 novapay:w-full novapay:rounded-[var(--tuwa-rounded-corners)] novapay:border novapay:border-[var(--tuwa-border-primary)] novapay:bg-[var(--tuwa-bg-primary)] novapay:px-3 novapay:text-sm novapay:text-[var(--tuwa-text-primary)]",b={mode:c$1,...c$1==="fiat_value"&&p.trim()&&{amount:p.trim()},...y.trim()&&{reason:y.trim()}};return v.moved?Fc(v.moved,v,e,t,a,true):jsxs(Fragment,{children:[jsxs(he,{title:r.amountTitle,children:[jsxs("fieldset",{disabled:v.checking,className:"novapay:contents",children:[jsx(An,{label:r.amountTitle,items:[...C],value:c$1,getKey:h=>h.key,onChange:h=>l(h),className:"novapay:flex novapay:flex-col novapay:gap-2",itemClassName:()=>"novapay:flex novapay:flex-col novapay:gap-0.5 novapay:px-3 novapay:py-2.5",children:h=>jsxs(Fragment,{children:[jsx("span",{className:"novapay:text-sm novapay:font-semibold",children:h.title}),jsx("span",{className:"novapay:text-xs novapay:text-[var(--tuwa-text-secondary)]",children:h.hint})]})}),c$1==="fiat_value"&&jsxs("label",{htmlFor:s,className:"novapay:flex novapay:flex-col novapay:gap-1 novapay:text-xs",children:[jsxs("span",{children:[c(r.amount,{currency:n}),jsxs("span",{"aria-hidden":"true",className:"novapay:text-[var(--tuwa-error-text)]",children:[" ","*"]})]}),jsx("input",{id:s,required:true,inputMode:"decimal",value:p,placeholder:"0.00","aria-invalid":!m||void 0,onChange:h=>d(h.target.value.replace(",",".")),className:cn($,g)}),o&&jsx("span",{className:"novapay:text-[var(--tuwa-text-secondary)]",children:c(r.amountHint,{amount:o})})]}),jsxs("label",{htmlFor:i,className:"novapay:flex novapay:flex-col novapay:gap-1 novapay:text-xs",children:[jsx("span",{children:r.reason}),jsx("input",{id:i,value:y,maxLength:500,onChange:h=>f(h.target.value),className:g})]})]}),e.error&&jsx(J,{children:Za(e.error,r)})]}),jsx(ee,{children:jsx(Y,{busy:v.checking,disabled:!m,onClick:()=>{v.ask(b);},children:r.continue})})]})}function Ac(e,t){return jsxs("span",{className:"novapay:flex novapay:flex-col novapay:items-end novapay:gap-1",children:[e,t&&jsx("span",{className:"novapay:text-[var(--tuwa-text-secondary)]",children:t})]})}function xd({flow:e,labels:t,locale:a,values:n,details:o,recordAction:r}){let s=t.refund,i=e.transfer,c$1=typeof e.balance=="bigint"&&i?`${ue(e.balance.toString(),i.decimals,a)} ${i.symbol}`:null,l=e.fee?da(e.fee.amount.toString(),e.fee.decimals,a):null,p=e.fee&&l?`${l} ${e.fee.symbol}`:null,d={notEnough:c(s.notEnough,{...n,address:e.wallet?shortAddress(e.wallet.address):"",balance:c$1??""}),declined:c(s.declined,n),unsupported:c(s.unsupported,n),wrongNetwork:c(s.wrongNetwork,n),failed:s.failed,noRecipient:s.noRecipient,fromBuyer:s.failedFromBuyer,stillInWallet:c(t.walletPrompt.stillWaiting,n),unreachable:s.unreachable},y=!!e.problem,f=!!e.txKey;return jsxs(Fragment,{children:[jsxs(he,{title:y?s.notSent:s.confirmTitle,children:[jsxs(xe,{children:[jsx(W,{name:s.send,children:n.amount}),jsx(W,{name:s.network,children:n.network}),i&&jsx(W,{name:s.to,children:Ac(jsx(Ie,{hash:i.to,explorerUrl:e.addressUrl(i.to),labels:t}),e.refund?.heldTransfer?s.theSender:s.thePayer)}),e.wallet&&jsx(W,{name:s.from,children:Ac(jsx(Ie,{hash:e.wallet.address,explorerUrl:e.addressUrl(e.wallet.address),labels:t}),c$1&&c(s.balance,{amount:c$1}))}),p&&jsx(W,{name:s.networkFee,children:c(s.feeEstimate,{amount:p})}),o]}),e.problem&&jsx(J,{children:d[e.problem]}),e.problem&&!["noRecipient","unreachable","stillInWallet"].includes(e.problem)&&jsx(Re,{children:s.nothingSent}),f&&e.error&&jsx(J,{children:s.notHandedOver}),!f&&e.error&&e.problem!=="unreachable"&&jsx(J,{children:Za(e.error,s)})]}),jsxs(ee,{children:[e.problem!=="noRecipient"&&(e.wrongNetwork&&!f?jsx(Y,{onClick:()=>{e.switchNetwork();},children:jsx(Ce,{label:s.switchTo,values:n})}):jsx(Y,{busy:e.sending,onClick:()=>{e.send();},children:f?s.handOver:s.sendRefund})),(y||f)&&r,!y&&!f&&e.wallet&&jsx(te,{onClick:e.connect,children:t.pay.changeWallet})]})]})}function wd(e){return e.appStore?e.novaConnect?"app":"appStore":e.ownConnection?"own":"none"}function Ja(e){let t=useContext(SatelliteStoreContext),a=useContext(NovaConnectProviderContext);return wd({appStore:t!=null,novaConnect:a!==void 0,ownConnection:e})}function VC(){let e=yt(),t=Ja(false);return e.connection??t}var Cd=()=>import('./OwnConnection-ET76SUMX.js').then(e=>({default:e.OwnConnection})),Bc=lazy(Cd);var Rd=()=>process.env.NODE_ENV==="development";function eP({baseUrl:e,labels:t,customization:a,adapters:n,pulsar:o,ownConnection:r,onConnectWallet:s,children:i}){let c=useContext(ta),l=Ja(!!r),[p]=useState(l),[d]=useState(r),y=p==="own"?r??d:void 0,f=(p==="app"||p==="appStore")&&c.connection!==void 0&&c.connection!=="none",v=y?y.adapters:n??(f?c.adapters:void 0),m=useMemo(()=>({baseUrl:e,labels:t,customization:a,adapters:v,pulsar:o,connection:p,onConnectWallet:s}),[e,t,a,v,o,p,s]),C=useRef(null),g=!!r,b=!!v;return useEffect(()=>{if(!Rd())return;C.current??=new Set;let h=C.current,w=(T,k)=>{h.has(T)||(h.add(T),console.warn(`[NovaPaymentsProvider] ${k}`));};l!==p&&w("connection",`it keeps the wallet connection it chose on its first render ("${p}"), though the providers above now call for "${l}". Render it inside the app's SatelliteConnectProvider and NovaConnectProvider from the start.`),g&&p==="appStore"&&w("appStore","it is inside the app's SatelliteConnectProvider without NovaConnectProvider: it uses the app's wallet and never adds a second store, so `ownConnection` is not used. Connect wallets with `onConnectWallet`, or render it inside NovaConnectProvider."),g&&!b&&(p==="app"||p==="appStore")&&w("adapters","it uses the app's wallet connection, so the adapters of `ownConnection` are not used: pass `adapters` on the app's wagmi config to pay from the app's wallet.");},[l,p,g,b]),jsx(ta.Provider,{value:m,children:y?jsx(Suspense,{fallback:null,children:jsx(Bc,{own:y,children:i})}):i})}
|
|
2
|
+
export{hd as AmountStep,ts as AutoPayScreen,bs as BuyerScreen,ma as CheckoutContext,or as CheckoutContextProvider,Ym as CheckoutFrame,Bs as CheckoutHeader,Zm as CheckoutPageRoot,ks as CheckoutStepper,Es as CheckoutSummary,As as CompactSummary,si as ConfirmScreen,xd as ConfirmStep,pi as ConfirmWalletScreen,To as ContactLink,vl as DEADLINE_ANNOUNCEMENTS,Ns as DeadlineTimer,La as Disclosure,gi as FailedScreen,vd as FailedStep,ki as LeaveDialog,Os as LocaleSwitcher,Aa as MerchantBadge,Ti as MethodScreen,Ms as MobileSteps,ta as NovaPaymentsContext,eP as NovaPaymentsProvider,Bt as OPEN_REQUEST_MS,Ts as OrderLines,Cp as OrderTotal,hi as OutcomeScreen,Fi as PaidScreen,hc as PayScreen,Dk as PaymentCheckout,mo as QUOTE_WARNING_MS,bc as QrScreen,vC as RefundButton,cd as RefundDialog,ld as RefundSteps,wc as ScreenBody,go as SellerDetailsContent,Is as SummaryFooter,en as WalletPrompt,ct as addressOfWallet,Er as autoPayTerms,Gr as balanceShortfall,ya as baseUnitsToDecimal,ho as buyerFields,as as buyerIssues,pr as canPayWithQr,ne as checkoutClassName,uo as checkoutScreen,yr as checkoutSteps,os as cleanBuyer,lr as connectedWallet,Ir as contactHref,rs as countryOptions,hr as deadlineAnnouncement,Un as deadlineState,fa as failedPaymentTx,un as familyOf,st as formatCountdown,da as formatFeeAmount,ke as formatFiat,va as formatPeriod,ue as formatTokenAmount,vo as grantableOffer,vr as groupMethodsByToken,Zi as handOverPayment,Ne as instructionsChainId,Pn as invoiceTotals,$n as isConfirmationError,Pr as isFinalPaymentFailure,gt as isInvoicePaymentOnTheWay,Yt as isInvoicePaymentUnresolved,bt as isMovedMoneyFailure,Sr as isPaidElsewhere,yn as isPayerProofError,Ga as isPaymentAccepted,it as isPaymentOnTheWay,br as isQuoteEnding,_t as isSameWallet,Rc as isSlow,ha as isSmartWallet,lo as isWalletIconUrl,Zt as leftTheWalletText,Br as lockPrice,xr as lockedPriceOnWallet,mn as methodErrorText,We as methodFamily,ur as methodToken,_e as minorToDecimal,fo as needsLeaveConfirm,_r as needsPayerProof,Fr as needsTheClock,de as networkName,fr as paidSteps,zi as payInvoice,Hr as payPath,Ge as payerFor,fn as payerProofErrorText,Hn as paymentFailedText,po as priceAdjustment,xc as qrPath,$r as quoteAmounts,Kr as quoteRate,Lr as receivedAmount,Or as refundRateMoved,kc as refundTransfer,Za as refusalText,dn as restRateText,wr as screensPayingWallets,kr as sentBeforeDeadline,Tr as shownLocale,dr as takeOverOpens,Ft as unconfirmedFollowUp,Nr as unconfirmedTxKey,Ar as underpaidRest,Ot as useAsyncValue,Li as useAutoReturn,O as useCheckoutContext,_i as useCheckoutEvents,Di as useCheckoutState,Mi as useCheckoutStore,Ha as useConnectedWallet,yt as useNovaPayments,$i as useNow,Ke as useOptionalCheckoutContext,Ai as usePaidCallback,Ma as usePayerProof,ji as usePayment,Tn as usePaymentFacts,tc as usePaymentHandOver,VC as usePaymentsConnection,na as usePaymentsLabels,Sc as useRefund,ua as useRereadValue,Va as useWalletConnection,ll as walletLabel,gr as walletOnConfirmStep};
|