@privy-io/react-auth 1.88.2 → 1.88.3
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/dist/cjs/index.js +16 -16
- package/dist/cjs/ui.js +5 -5
- package/dist/cjs/useFundWallet.js +15 -15
- package/dist/cjs/useWallets.js +1 -1
- package/dist/dts/types.d.mts +20 -8
- package/dist/dts/types.d.ts +20 -8
- package/dist/dts/ui.d.mts +4 -1
- package/dist/dts/ui.d.ts +4 -1
- package/dist/esm/index.mjs +17 -17
- package/dist/esm/privy-context.mjs +1 -1
- package/dist/esm/ui.mjs +9 -9
- package/dist/esm/useFundWallet.mjs +17 -17
- package/dist/esm/useSolanaWallets.mjs +1 -1
- package/dist/esm/useWallets.mjs +1 -1
- package/dist/esm/user.mjs +1 -1
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),t=require("@ethersproject/address"),r=require("@ethersproject/providers"),n=require("mipd"),i=require("react"),a=require("react-device-detect"),o=require("./privy-context.js"),s=require("jose"),l=require("./useWallets.js"),d=require("./useFundWallet.js"),c=require("uuid"),u=require("./user.js"),h=require("@ethersproject/bytes"),p=require("eventemitter3"),y=require("@coinbase/wallet-sdk"),m=require("./useSolanaWallets.js"),f=require("@walletconnect/ethereum-provider"),g=require("./getEmbeddedConnectedWallet.js"),v=require("ofetch"),w=require("js-cookie"),x=require("@marsidev/react-turnstile"),C=require("styled-components"),E=require("@heroicons/react/24/outline/QuestionMarkCircleIcon"),b=require("@heroicons/react/24/outline/ArrowLeftIcon"),S=require("@heroicons/react/24/outline/ArrowRightIcon"),A=require("@heroicons/react/24/outline/XMarkIcon"),j=require("@heroicons/react/24/outline/ExclamationTriangleIcon"),$=require("@heroicons/react/24/outline/WalletIcon"),T=require("@heroicons/react/24/outline"),P=require("@heroicons/react/24/outline/ArrowTopRightOnSquareIcon"),_=require("@heroicons/react/24/solid/DocumentCheckIcon"),k=require("@heroicons/react/20/solid/CheckIcon"),N=require("@heroicons/react/24/outline/EnvelopeIcon"),I=require("@heroicons/react/24/outline/PhoneIcon"),M=require("@heroicons/react/24/solid/CheckCircleIcon"),O=require("@heroicons/react/24/solid/XCircleIcon"),R=require("fast-password-entropy"),F=require("secure-password-utilities"),L=require("secure-password-utilities/wordlists"),U=require("@heroicons/react/24/outline/ArrowPathIcon"),D=require("@heroicons/react/24/outline/EyeIcon"),W=require("@heroicons/react/24/outline/EyeSlashIcon"),B=require("@heroicons/react/24/outline/KeyIcon"),H=require("@heroicons/react/24/outline/ArrowDownTrayIcon"),G=require("@heroicons/react/24/outline/ClipboardDocumentCheckIcon"),q=require("@heroicons/react/24/outline/DocumentDuplicateIcon"),z=require("@heroicons/react/24/outline/UserCircleIcon"),V=require("@heroicons/react/24/solid/LockClosedIcon"),K=require("qrcode"),Y=require("@heroicons/react/24/outline/CheckCircleIcon"),Z=require("viem"),X=require("@heroicons/react/24/outline/GlobeAltIcon"),J=require("@headlessui/react"),Q=require("@heroicons/react/24/outline/ClockIcon"),ee=require("@heroicons/react/24/outline/TrashIcon"),te=require("@heroicons/react/24/solid/CheckBadgeIcon"),re=require("@heroicons/react/24/solid/ArrowsRightLeftIcon"),ne=require("@heroicons/react/24/outline/PencilIcon"),ie=require("@ethersproject/units"),ae=require("@heroicons/react/24/outline/InformationCircleIcon"),oe=require("@heroicons/react/24/outline/QrCodeIcon"),se=require("@heroicons/react/24/outline/LinkIcon"),le=require("@heroicons/react/24/outline/ChevronRightIcon"),de=require("@heroicons/react/24/solid/DevicePhoneMobileIcon"),ce=require("@heroicons/react/24/solid/IdentificationIcon"),ue=require("@heroicons/react/24/solid/PhoneIcon"),he=require("@heroicons/react/24/solid/QuestionMarkCircleIcon"),pe=require("@heroicons/react/24/solid/ShieldCheckIcon"),ye=require("@heroicons/react/24/outline/DevicePhoneMobileIcon"),me=require("@heroicons/react/24/outline/FingerPrintIcon"),fe=require("@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon"),ge=require("@heroicons/react/24/outline/ShieldCheckIcon"),ve=require("@ethersproject/abstract-signer"),we=require("@ethersproject/bignumber"),xe=require("@ethersproject/contracts"),Ce=require("@ethersproject/transactions"),Ee=require("fetch-retry"),be=require("@heroicons/react/24/outline/ChevronDownIcon"),Se=require("@heroicons/react/24/outline/CalendarIcon"),Ae=require("@heroicons/react/24/outline/LockClosedIcon"),je=require("@heroicons/react/24/outline/PencilSquareIcon"),$e=require("@solana/wallet-adapter-base"),Te=require("@heroicons/react/24/outline/ClipboardDocumentIcon"),Pe=require("@heroicons/react/24/outline/ExclamationCircleIcon"),_e=require("@ethersproject/logger"),ke=require("@ethersproject/strings");function Ne(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function Ie(e){if(e&&"object"==typeof e&&"default"in e)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}require("tinycolor2"),require("@heroicons/react/24/outline/Square2StackIcon");var Me=Ne(i),Oe=Ie(a),Re=Ie(s),Fe=Ne(p),Le=Ne(w),Ue=Ne(E),De=Ne(b),We=Ne(S),Be=Ne(A),He=Ne(j),Ge=Ne($),qe=Ne(P),ze=Ne(_),Ve=Ne(k),Ke=Ne(N),Ye=Ne(I),Ze=Ne(M),Xe=Ne(O),Je=Ne(R),Qe=Ie(F),et=Ne(U),tt=Ne(D),rt=Ne(W),nt=Ne(B),it=Ne(H),at=Ne(G),ot=Ne(q),st=Ne(z),lt=Ne(V),dt=Ne(K),ct=Ne(Y),ut=Ne(X),ht=Ne(Q),pt=Ne(ee),yt=Ne(te),mt=Ne(re),ft=Ne(ne),gt=Ne(ae),vt=Ne(oe),wt=Ne(se),xt=Ne(le),Ct=Ne(de),Et=Ne(ce),bt=Ne(ue),St=Ne(he),At=Ne(pe),jt=Ne(ye),$t=Ne(me),Tt=Ne(fe),Pt=Ne(ge),_t=Ne(Ee),kt=Ne(be),Nt=Ne(Se),It=Ne(Ae),Mt=Ne(je),Ot=Ne(Te),Rt=Ne(Pe);let Ft={id:42161,name:"Arbitrum One",network:"arbitrum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-mainnet.rpc.privy.systems"]},alchemy:{http:["https://arb-mainnet.g.alchemy.com/v2"],webSocket:["wss://arb-mainnet.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-mainnet.infura.io/v3"],webSocket:["wss://arbitrum-mainnet.infura.io/ws/v3"]},default:{http:["https://arb1.arbitrum.io/rpc"]},public:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://arbiscan.io"},default:{name:"Arbiscan",url:"https://arbiscan.io"}}},Lt={id:421613,name:"Arbitrum Goerli",network:"arbitrum-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"AGOR",decimals:18},rpcUrls:{default:{http:["https://goerli-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"}},testnet:!0},Ut={id:421614,name:"Arbitrum Sepolia",network:"arbitrum-sepolia",nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]},public:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia-explorer.arbitrum.io"}},testnet:!0},Dt={id:8453,network:"base",name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-mainnet.rpc.privy.systems"]},blast:{http:["https://base-mainnet.blastapi.io"],webSocket:["wss://base-mainnet.blastapi.io"]},default:{http:["https://mainnet.base.org"]},public:{http:["https://mainnet.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://basescan.org"},default:{name:"Basescan",url:"https://basescan.org"}}},Wt={id:84531,network:"base-goerli",name:"Base Goerli Testnet",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://goerli.base.org"]}},blockExplorers:{default:{name:"Basescan",url:"https://goerli.basescan.org"}},testnet:!0},Bt={id:84532,network:"base-sepolia",name:"Base Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.base.org"]},public:{http:["https://sepolia.base.org"]}},blockExplorers:{default:{name:"Blockscout",url:"https://base-sepolia.blockscout.com"}},testnet:!0},Ht={id:10,name:"OP Mainnet",network:"optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-mainnet.rpc.privy.systems"]},alchemy:{http:["https://opt-mainnet.g.alchemy.com/v2"],webSocket:["wss://opt-mainnet.g.alchemy.com/v2"]},infura:{http:["https://optimism-mainnet.infura.io/v3"],webSocket:["wss://optimism-mainnet.infura.io/ws/v3"]},default:{http:["https://mainnet.optimism.io"]},public:{http:["https://mainnet.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://optimistic.etherscan.io"},default:{name:"Optimism Explorer",url:"https://explorer.optimism.io"}}},Gt={id:420,name:"Optimism Goerli Testnet",network:"optimism-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://goerli.optimism.io"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"}},testnet:!0},qt={id:11155420,name:"Optimism Sepolia",network:"optimism-sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.optimism.io"]},public:{http:["https://sepolia.optimism.io"]},infura:{http:["https://optimism-sepolia.infura.io/v3"]}},blockExplorers:{default:{name:"Blockscout",url:"https://optimism-sepolia.blockscout.com"}},testnet:!0},zt={id:137,name:"Polygon Mainnet",network:"polygon",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{privy:{http:["https://polygon-mainnet.rpc.privy.systems"]},alchemy:{http:["https://polygon-mainnet.g.alchemy.com/v2"],webSocket:["wss://polygon-mainnet.g.alchemy.com/v2"]},infura:{http:["https://polygon-mainnet.infura.io/v3"],webSocket:["wss://polygon-mainnet.infura.io/ws/v3"]},default:{http:["https://polygon-rpc.com"]},public:{http:["https://polygon-rpc.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://polygonscan.com"},default:{name:"PolygonScan",url:"https://polygonscan.com"}}},Vt={id:80001,name:"Mumbai",network:"maticmum",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{default:{http:["https://matic-mumbai.chainstacklabs.com"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://mumbai.polygonscan.com"}},testnet:!0},Kt={id:7777777,name:"Zora",network:"zora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]},public:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.zora.energy"}}},Yt={id:999999999,name:"Zora Sepolia",network:"zora-sepolia",nativeCurrency:{decimals:18,name:"Zora Sepolia",symbol:"ETH"},rpcUrls:{default:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]},public:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]}},blockExplorers:{default:{name:"Zora Sepolia Explorer",url:"https://sepolia.explorer.zora.energy/"}},testnet:!0},Zt={id:999,name:"Zora Goerli Testnet",network:"zora-testnet",nativeCurrency:{decimals:18,name:"Zora Goerli",symbol:"ETH"},rpcUrls:{default:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]},public:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.explorer.zora.energy"}},testnet:!0},Xt=e=>[Ft.id,Lt.id,Ut.id].includes(e),Jt=e=>[56,97].includes(e),Qt="0x420000000000000000000000000000000000000F",er=["function getL1Fee(bytes memory _data) external view returns (uint256)"],tr=e=>[Dt.id,Wt.id,Bt.id,Ht.id,Gt.id,qt.id,Kt.id,Zt.id,Yt.id,81457,168587773].includes(e);let rr={id:80002,name:"Polygon Amoy",network:"polygon-amoy",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{privy:{http:["https://polygon-amoy.rpc.privy.systems"]},infura:{http:["https://polygon-amoy.infura.io/v3"],webSocket:["wss://polygon-amoy.infura.io/ws/v3"]},default:{http:["https://rpc-amoy.polygon.technology"]}},blockExplorers:{default:{name:"OK LINK",url:"https://www.oklink.com/amoy"}},testnet:!0},nr=_t.default(fetch,{retries:3,retryDelay:500}),ir=e=>[zt.id,Vt.id,rr.id].includes(e),ar=e=>({maxPriorityFee:ie.parseUnits(e.maxPriorityFee.toFixed(9),"gwei").toHexString(),maxFee:ie.parseUnits(e.maxFee.toFixed(9),"gwei").toHexString()}),or=async e=>{let t="";switch(e){case zt.id:t="https://gasstation.polygon.technology/v2";break;case Vt.id:t="https://gasstation-testnet.polygon.technology/v2";break;case rr.id:t="https://gasstation.polygon.technology/amoy";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}let r=await nr(t),n=await r.json();if(r.status>399)throw n;return{safeLow:ar(n.safeLow),standard:ar(n.standard),fast:ar(n.fast)}};async function sr(e,t){if(!e.gasLimit)throw new m.l("gasLimit was not successfully set for transaction.");let r=d.i(e.gasLimit),n=we.BigNumber.from(0);if(2==e.type){if(!e.maxFeePerGas)throw new m.l("maxFeePerGas was not successfully set for transaction of type 2.");n=d.i(e.maxFeePerGas)}else{if(!e.gasPrice)throw new m.l("gasPrice was not successfully set for transaction of type 0 or 1.");n=d.i(e.gasPrice)}let i=r.mul(n),a=we.BigNumber.from(0);if(e.chainId&&tr(e.chainId))try{a=await async function(e,t){if(!e.chainId||e.chainId&&!tr(e.chainId))return we.BigNumber.from(0);let r=we.BigNumber.from(0);try{let n=new xe.Contract(Qt,er,t),i=d.r(e),a=Ce.serialize(i);r=await n.getL1Fee(a)}catch(e){}return r}(e,t),i=i.add(a)}catch(e){}return{totalGasEstimate:i,l1ExecutionFeeEstimate:a}}function lr(e){return/^-?0x[a-f0-9]+$/i.test(e)}async function dr(e,t,r){if(t.chainId=Number(t.chainId),function(e){for(let t of["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"]){let r=e[t];if(void 0!==r&&!function(e){let t="number"==typeof e,r="bigint"==typeof e,n="string"==typeof e&&lr(e);return t||r||n}(r))throw Error(`Transaction request property '${t}' must be a valid number, bigint, or hex string representing a quantity`)}if("number"!=typeof e.chainId)throw Error("Transaction request property 'chainId' must be a number")}(t),t.from||(t.from=e),!t.nonce){let n=new ve.VoidSigner(e,r);t.nonce=await n.getTransactionCount("pending")}return t.gasLimit||(t.gas?(t.gasLimit=t.gas,delete t.gas):t.gasLimit=await async function(e,t){try{return(await t.estimateGas(e)).toHexString()}catch(r){let n;if("message"in r&&r.message.includes("insufficient funds")&&(console.warn(`Gas estimation failed with error: ${r}. Retrying gas estimation by omitting the 'value'`),n=await async function({txRequest:e,provider:t}){try{let r={...e,value:void 0};return(await t.estimateGas(r)).toHexString()}catch(e){return console.warn(`Gas estimation failed with error: ${e} when omitting the 'value'`),null}}({txRequest:e,provider:t})),n||(console.warn(`Gas estimation failed with error: ${r}. Retrying gas estimation by omitting the 'from'`),n=await async function({txRequest:e,provider:t}){try{let r={...e,from:void 0};return(await t.estimateGas(r)).toHexString()}catch(e){return console.warn(`Gas estimation failed with error: ${e} when omitting the 'from' address`),null}}({txRequest:e,provider:t})),!n)throw r;return n}}(t,r)),"string"==typeof t.type&&lr(t.type)&&(t.type=Number(t.type)),[23294,23295].includes(t.chainId)&&(t.type=0),0===(t=ir(t.chainId)?await async function(e){if(!ir(e.chainId))throw Error("Invalid chain ID for Polygon gas estimation.");if(void 0===e.type&&(e.type=2),e.maxPriorityFeePerGas&&e.maxFeePerGas)return e;try{let{standard:t}=await or(e.chainId);e.maxPriorityFeePerGas||(e.maxPriorityFeePerGas=t.maxPriorityFee),e.maxFeePerGas||(e.maxFeePerGas=t.maxFee),e.gasPrice&&(console.warn("`gasPrice` is not supported on this chain and will be ignored. Use `maxPriorityFeePerGas` and/or `maxFeePerGas` instead."),delete e.gasPrice)}catch(e){throw Error(`Failed to set gas prices from Polygon gas station with error: ${e}.`)}return e}(t):Xt(t.chainId)?await(async(e,t)=>{if(!Xt(e.chainId))throw Error("Invalid chain ID for Arbitrum gas estimation.");if(void 0===e.type&&(e.type=2),e.maxFeePerGas)return e;try{let{lastBaseFeePerGas:r}=await t.getFeeData();if(r){let t=r.mul(we.BigNumber.from(120)).div(we.BigNumber.from(100));e.maxFeePerGas=d.t(t),e.maxPriorityFeePerGas=d.t(we.BigNumber.from(0))}}catch(e){throw Error(`Failed to set gas price for Arbitrum transaction: ${e}.`)}return e})(t,r):tr(t.chainId)?await(async(e,t)=>{if(!tr(e.chainId))throw Error("Invalid chain ID for OP Stack gas estimation.");if(void 0===e.type&&(e.type=2),e.gasPrice&&(console.warn("`gasPrice` is not supported on this chain and will be ignored. Use `maxPriorityFeePerGas` and/or `maxFeePerGas` instead."),delete e.gasPrice),e.maxPriorityFeePerGas&&e.maxFeePerGas)return e;try{if(!e.maxPriorityFeePerGas){let r=await t.send("eth_maxPriorityFeePerGas",[]);e.maxPriorityFeePerGas=r}if(e.maxFeePerGas&&(console.warn("maxFeePerGas is specified without maxPriorityFeePerGas - this can result in hung transactions."),e.maxPriorityFeePerGas>=e.maxFeePerGas))throw Error("Overridden maxFeePerGas is less than or equal to the calculated maxPriorityFeePerGas. Please set both values or maxPriorityFeePerGas alone for correct gas estimation.");if(!e.maxFeePerGas){let{lastBaseFeePerGas:r}=await t.getFeeData();if(!r)throw Error("Unable to fetch baseFee for last block.");let n=we.BigNumber.from(r).mul(we.BigNumber.from(126)).div(we.BigNumber.from(100)).add(we.BigNumber.from(e.maxPriorityFeePerGas));e.maxFeePerGas=d.t(n)}}catch(e){throw Error(`Failed to set gas price for OP stack transaction: ${e}.`)}return e})(t,r):Jt(t.chainId)?await(async(e,t)=>{if(!Jt(e.chainId))throw Error("Invalid chain ID for BSC gas estimation.");if(void 0===e.type?e.type=0:1!=e.type&&2!=e.type||console.warn("Transaction request type specified is incompatible for chain and will result in undefined behavior. Please use transaction type 0."),!e.gasPrice){let r=await t.getFeeData();e.gasPrice=r.gasPrice?.toHexString()}return e})(t,r):await(async(e,t)=>{if(void 0===e.type&&(e.type=2),2===e.type){if(!e.maxFeePerGas||!e.maxPriorityFeePerGas){let r=await t.getFeeData();e.maxFeePerGas||(e.maxFeePerGas=r.maxFeePerGas?.toHexString()),e.maxPriorityFeePerGas||(e.maxPriorityFeePerGas=r.maxPriorityFeePerGas?.toHexString())}}else if(!e.gasPrice){let r=await t.getFeeData();e.gasPrice=r.gasPrice?.toHexString()}return e})(t,r)).type&&delete t.accessList,2!==t.type&&(delete t.maxPriorityFeePerGas,delete t.maxFeePerGas),t}var cr={AC:"40123",AD:"312345",AE:"501234567",AF:"701234567",AG:"2684641234",AI:"2642351234",AL:"672123456",AM:"77123456",AO:"923123456",AR:"91123456789",AS:"6847331234",AT:"664123456",AU:"412345678",AW:"5601234",AX:"412345678",AZ:"401234567",BA:"61123456",BB:"2462501234",BD:"1812345678",BE:"470123456",BF:"70123456",BG:"43012345",BH:"36001234",BI:"79561234",BJ:"90011234",BL:"690001234",BM:"4413701234",BN:"7123456",BO:"71234567",BQ:"3181234",BR:"11961234567",BS:"2423591234",BT:"17123456",BW:"71123456",BY:"294911911",BZ:"6221234",CA:"5062345678",CC:"412345678",CD:"991234567",CF:"70012345",CG:"061234567",CH:"781234567",CI:"0123456789",CK:"71234",CL:"221234567",CM:"671234567",CN:"13123456789",CO:"3211234567",CR:"83123456",CU:"51234567",CV:"9911234",CW:"95181234",CX:"412345678",CY:"96123456",CZ:"601123456",DE:"15123456789",DJ:"77831001",DK:"32123456",DM:"7672251234",DO:"8092345678",DZ:"551234567",EC:"991234567",EE:"51234567",EG:"1001234567",EH:"650123456",ER:"7123456",ES:"612345678",ET:"911234567",FI:"412345678",FJ:"7012345",FK:"51234",FM:"3501234",FO:"211234",FR:"612345678",GA:"06031234",GB:"7400123456",GD:"4734031234",GE:"555123456",GF:"694201234",GG:"7781123456",GH:"231234567",GI:"57123456",GL:"221234",GM:"3012345",GN:"601123456",GP:"690001234",GQ:"222123456",GR:"6912345678",GT:"51234567",GU:"6713001234",GW:"955012345",GY:"6091234",HK:"51234567",HN:"91234567",HR:"921234567",HT:"34101234",HU:"201234567",ID:"812345678",IE:"850123456",IL:"502345678",IM:"7924123456",IN:"8123456789",IO:"3801234",IQ:"7912345678",IR:"9123456789",IS:"6111234",IT:"3123456789",JE:"7797712345",JM:"8762101234",JO:"790123456",JP:"9012345678",KE:"712123456",KG:"700123456",KH:"91234567",KI:"72001234",KM:"3212345",KN:"8697652917",KP:"1921234567",KR:"1020000000",KW:"50012345",KY:"3453231234",KZ:"7710009998",LA:"2023123456",LB:"71123456",LC:"7582845678",LI:"660234567",LK:"712345678",LR:"770123456",LS:"50123456",LT:"61234567",LU:"628123456",LV:"21234567",LY:"912345678",MA:"650123456",MC:"612345678",MD:"62112345",ME:"67622901",MF:"690001234",MG:"321234567",MH:"2351234",MK:"72345678",ML:"65012345",MM:"92123456",MN:"88123456",MO:"66123456",MP:"6702345678",MQ:"696201234",MR:"22123456",MS:"6644923456",MT:"96961234",MU:"52512345",MV:"7712345",MW:"991234567",MX:"12221234567",MY:"123456789",MZ:"821234567",NA:"811234567",NC:"751234",NE:"93123456",NF:"381234",NG:"8021234567",NI:"81234567",NL:"612345678",NO:"40612345",NP:"9841234567",NR:"5551234",NU:"8884012",NZ:"211234567",OM:"92123456",PA:"61234567",PE:"912345678",PF:"87123456",PG:"70123456",PH:"9051234567",PK:"3012345678",PL:"512345678",PM:"551234",PR:"7872345678",PS:"599123456",PT:"912345678",PW:"6201234",PY:"961456789",QA:"33123456",RE:"692123456",RO:"712034567",RS:"601234567",RU:"9123456789",RW:"720123456",SA:"512345678",SB:"7421234",SC:"2510123",SD:"911231234",SE:"701234567",SG:"81234567",SH:"51234",SI:"31234567",SJ:"41234567",SK:"912123456",SL:"25123456",SM:"66661212",SN:"701234567",SO:"71123456",SR:"7412345",SS:"977123456",ST:"9812345",SV:"70123456",SX:"7215205678",SY:"944567890",SZ:"76123456",TA:"8999",TC:"6492311234",TD:"63012345",TG:"90112345",TH:"812345678",TJ:"917123456",TK:"7290",TL:"77212345",TM:"66123456",TN:"20123456",TO:"7715123",TR:"5012345678",TT:"8682911234",TV:"901234",TW:"912345678",TZ:"621234567",UA:"501234567",UG:"712345678",US:"2015550123",UY:"94231234",UZ:"912345678",VA:"3123456789",VC:"7844301234",VE:"4121234567",VG:"2843001234",VI:"3406421234",VN:"912345678",VU:"5912345",WF:"821234",WS:"7212345",XK:"43201234",YE:"712345678",YT:"639012345",ZA:"711234567",ZM:"955123456",ZW:"712345678"},ur={version:4,country_calling_codes:{1:["US","AG","AI","AS","BB","BM","BS","CA","DM","DO","GD","GU","JM","KN","KY","LC","MP","MS","PR","SX","TC","TT","VC","VG","VI"],7:["RU","KZ"],20:["EG"],27:["ZA"],30:["GR"],31:["NL"],32:["BE"],33:["FR"],34:["ES"],36:["HU"],39:["IT","VA"],40:["RO"],41:["CH"],43:["AT"],44:["GB","GG","IM","JE"],45:["DK"],46:["SE"],47:["NO","SJ"],48:["PL"],49:["DE"],51:["PE"],52:["MX"],53:["CU"],54:["AR"],55:["BR"],56:["CL"],57:["CO"],58:["VE"],60:["MY"],61:["AU","CC","CX"],62:["ID"],63:["PH"],64:["NZ"],65:["SG"],66:["TH"],81:["JP"],82:["KR"],84:["VN"],86:["CN"],90:["TR"],91:["IN"],92:["PK"],93:["AF"],94:["LK"],95:["MM"],98:["IR"],211:["SS"],212:["MA","EH"],213:["DZ"],216:["TN"],218:["LY"],220:["GM"],221:["SN"],222:["MR"],223:["ML"],224:["GN"],225:["CI"],226:["BF"],227:["NE"],228:["TG"],229:["BJ"],230:["MU"],231:["LR"],232:["SL"],233:["GH"],234:["NG"],235:["TD"],236:["CF"],237:["CM"],238:["CV"],239:["ST"],240:["GQ"],241:["GA"],242:["CG"],243:["CD"],244:["AO"],245:["GW"],246:["IO"],247:["AC"],248:["SC"],249:["SD"],250:["RW"],251:["ET"],252:["SO"],253:["DJ"],254:["KE"],255:["TZ"],256:["UG"],257:["BI"],258:["MZ"],260:["ZM"],261:["MG"],262:["RE","YT"],263:["ZW"],264:["NA"],265:["MW"],266:["LS"],267:["BW"],268:["SZ"],269:["KM"],290:["SH","TA"],291:["ER"],297:["AW"],298:["FO"],299:["GL"],350:["GI"],351:["PT"],352:["LU"],353:["IE"],354:["IS"],355:["AL"],356:["MT"],357:["CY"],358:["FI","AX"],359:["BG"],370:["LT"],371:["LV"],372:["EE"],373:["MD"],374:["AM"],375:["BY"],376:["AD"],377:["MC"],378:["SM"],380:["UA"],381:["RS"],382:["ME"],383:["XK"],385:["HR"],386:["SI"],387:["BA"],389:["MK"],420:["CZ"],421:["SK"],423:["LI"],500:["FK"],501:["BZ"],502:["GT"],503:["SV"],504:["HN"],505:["NI"],506:["CR"],507:["PA"],508:["PM"],509:["HT"],590:["GP","BL","MF"],591:["BO"],592:["GY"],593:["EC"],594:["GF"],595:["PY"],596:["MQ"],597:["SR"],598:["UY"],599:["CW","BQ"],670:["TL"],672:["NF"],673:["BN"],674:["NR"],675:["PG"],676:["TO"],677:["SB"],678:["VU"],679:["FJ"],680:["PW"],681:["WF"],682:["CK"],683:["NU"],685:["WS"],686:["KI"],687:["NC"],688:["TV"],689:["PF"],690:["TK"],691:["FM"],692:["MH"],850:["KP"],852:["HK"],853:["MO"],855:["KH"],856:["LA"],880:["BD"],886:["TW"],960:["MV"],961:["LB"],962:["JO"],963:["SY"],964:["IQ"],965:["KW"],966:["SA"],967:["YE"],968:["OM"],970:["PS"],971:["AE"],972:["IL"],973:["BH"],974:["QA"],975:["BT"],976:["MN"],977:["NP"],992:["TJ"],993:["TM"],994:["AZ"],995:["GE"],996:["KG"],998:["UZ"]},countries:{AC:["247","00","(?:[01589]\\d|[46])\\d{4}",[5,6]],AD:["376","00","(?:1|6\\d)\\d{7}|[135-9]\\d{5}",[6,8,9],[["(\\d{3})(\\d{3})","$1 $2",["[135-9]"]],["(\\d{4})(\\d{4})","$1 $2",["1"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]]],AE:["971","00","(?:[4-7]\\d|9[0-689])\\d{7}|800\\d{2,9}|[2-4679]\\d{7}",[5,6,7,8,9,10,11,12],[["(\\d{3})(\\d{2,9})","$1 $2",["60|8"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[236]|[479][2-8]"],"0$1"],["(\\d{3})(\\d)(\\d{5})","$1 $2 $3",["[479]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"]],"0"],AF:["93","00","[2-7]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"]],"0"],AG:["1","011","(?:268|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([457]\\d{6})$|1","268$1",0,"268"],AI:["1","011","(?:264|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2457]\\d{6})$|1","264$1",0,"264"],AL:["355","00","(?:700\\d\\d|900)\\d{3}|8\\d{5,7}|(?:[2-5]|6\\d)\\d{7}",[6,7,8,9],[["(\\d{3})(\\d{3,4})","$1 $2",["80|9"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["4[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2358][2-5]|4"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["[23578]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["6"],"0$1"]],"0"],AM:["374","00","(?:[1-489]\\d|55|60|77)\\d{6}",[8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[89]0"],"0 $1"],["(\\d{3})(\\d{5})","$1 $2",["2|3[12]"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["1|47"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[3-9]"],"0$1"]],"0"],AO:["244","00","[29]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[29]"]]]],AR:["54","00","(?:11|[89]\\d\\d)\\d{8}|[2368]\\d{9}",[10,11],[["(\\d{4})(\\d{2})(\\d{4})","$1 $2-$3",["2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9])","2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8]))|2(?:2[24-9]|3[1-59]|47)","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5[56][46]|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|58|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|54(?:4|5[13-7]|6[89])|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:454|85[56])[46]|3(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["1"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[68]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2-$3",["[23]"],"0$1",1],["(\\d)(\\d{4})(\\d{2})(\\d{4})","$2 15-$3-$4",["9(?:2[2-469]|3[3-578])","9(?:2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9]))","9(?:2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8])))|92(?:2[24-9]|3[1-59]|47)","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5(?:[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|5(?:4(?:4|5[13-7]|6[89])|[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",0,"$1 $2 $3-$4"],["(\\d)(\\d{2})(\\d{4})(\\d{4})","$2 15-$3-$4",["91"],"0$1",0,"$1 $2 $3-$4"],["(\\d{3})(\\d{3})(\\d{5})","$1-$2-$3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{4})","$2 15-$3-$4",["9"],"0$1",0,"$1 $2 $3-$4"]],"0",0,"0?(?:(11|2(?:2(?:02?|[13]|2[13-79]|4[1-6]|5[2457]|6[124-8]|7[1-4]|8[13-6]|9[1267])|3(?:02?|1[467]|2[03-6]|3[13-8]|[49][2-6]|5[2-8]|[67])|4(?:7[3-578]|9)|6(?:[0136]|2[24-6]|4[6-8]?|5[15-8])|80|9(?:0[1-3]|[19]|2\\d|3[1-6]|4[02568]?|5[2-4]|6[2-46]|72?|8[23]?))|3(?:3(?:2[79]|6|8[2578])|4(?:0[0-24-9]|[12]|3[5-8]?|4[24-7]|5[4-68]?|6[02-9]|7[126]|8[2379]?|9[1-36-8])|5(?:1|2[1245]|3[237]?|4[1-46-9]|6[2-4]|7[1-6]|8[2-5]?)|6[24]|7(?:[069]|1[1568]|2[15]|3[145]|4[13]|5[14-8]|7[2-57]|8[126])|8(?:[01]|2[15-7]|3[2578]?|4[13-6]|5[4-8]?|6[1-357-9]|7[36-8]?|8[5-8]?|9[124])))15)?","9$1"],AS:["1","011","(?:[58]\\d\\d|684|900)\\d{7}",[10],0,"1",0,"([267]\\d{6})$|1","684$1",0,"684"],AT:["43","00","1\\d{3,12}|2\\d{6,12}|43(?:(?:0\\d|5[02-9])\\d{3,9}|2\\d{4,5}|[3467]\\d{4}|8\\d{4,6}|9\\d{4,7})|5\\d{4,12}|8\\d{7,12}|9\\d{8,12}|(?:[367]\\d|4[0-24-9])\\d{4,11}",[4,5,6,7,8,9,10,11,12,13],[["(\\d)(\\d{3,12})","$1 $2",["1(?:11|[2-9])"],"0$1"],["(\\d{3})(\\d{2})","$1 $2",["517"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["5[079]"],"0$1"],["(\\d{3})(\\d{3,10})","$1 $2",["(?:31|4)6|51|6(?:5[0-3579]|[6-9])|7(?:20|32|8)|[89]"],"0$1"],["(\\d{4})(\\d{3,9})","$1 $2",["[2-467]|5[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["5"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,7})","$1 $2 $3",["5"],"0$1"]],"0"],AU:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{7}(?:\\d(?:\\d{2})?)?|8[0-24-9]\\d{7})|[2-478]\\d{8}|1\\d{4,7}",[5,6,7,8,9,10,12],[["(\\d{2})(\\d{3,4})","$1 $2",["16"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,4})","$1 $2 $3",["16"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["14|4"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[2378]"],"(0$1)"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:30|[89])"]]],"0",0,"(183[12])|0",0,0,0,[["(?:(?:2(?:[0-26-9]\\d|3[0-8]|4[02-9]|5[0135-9])|3(?:[0-3589]\\d|4[0-578]|6[1-9]|7[0-35-9])|7(?:[013-57-9]\\d|2[0-8]))\\d{3}|8(?:51(?:0(?:0[03-9]|[12479]\\d|3[2-9]|5[0-8]|6[1-9]|8[0-7])|1(?:[0235689]\\d|1[0-69]|4[0-589]|7[0-47-9])|2(?:0[0-79]|[18][13579]|2[14-9]|3[0-46-9]|[4-6]\\d|7[89]|9[0-4]))|(?:6[0-8]|[78]\\d)\\d{3}|9(?:[02-9]\\d{3}|1(?:(?:[0-58]\\d|6[0135-9])\\d|7(?:0[0-24-9]|[1-9]\\d)|9(?:[0-46-9]\\d|5[0-79])))))\\d{3}",[9]],["4(?:(?:79|94)[01]|83[0-389])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[016-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,["163\\d{2,6}",[5,6,7,8,9]],["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],AW:["297","00","(?:[25-79]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[25-9]"]]]],AX:["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","2\\d{4,9}|35\\d{4,5}|(?:60\\d\\d|800)\\d{4,6}|7\\d{5,11}|(?:[14]\\d|3[0-46-9]|50)\\d{4,8}",[5,6,7,8,9,10,11,12],0,"0",0,0,0,0,"18",0,"00"],AZ:["994","00","365\\d{6}|(?:[124579]\\d|60|88)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[28]|2|365|46","1[28]|2|365[45]|46","1[28]|2|365(?:4|5[02])|46"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[13-9]"],"0$1"]],"0"],BA:["387","00","6\\d{8}|(?:[35689]\\d|49|70)\\d{6}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["6[1-3]|[7-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2-$3",["[3-5]|6[56]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["6"],"0$1"]],"0"],BB:["1","011","(?:246|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","246$1",0,"246"],BD:["880","00","[1-469]\\d{9}|8[0-79]\\d{7,8}|[2-79]\\d{8}|[2-9]\\d{7}|[3-9]\\d{6}|[57-9]\\d{5}",[6,7,8,9,10],[["(\\d{2})(\\d{4,6})","$1-$2",["31[5-8]|[459]1"],"0$1"],["(\\d{3})(\\d{3,7})","$1-$2",["3(?:[67]|8[013-9])|4(?:6[168]|7|[89][18])|5(?:6[128]|9)|6(?:[15]|28|4[14])|7[2-589]|8(?:0[014-9]|[12])|9[358]|(?:3[2-5]|4[235]|5[2-578]|6[0389]|76|8[3-7]|9[24])1|(?:44|66)[01346-9]"],"0$1"],["(\\d{4})(\\d{3,6})","$1-$2",["[13-9]|22"],"0$1"],["(\\d)(\\d{7,8})","$1-$2",["2"],"0$1"]],"0"],BE:["32","00","4\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:80|9)0"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[239]|4[23]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[15-8]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4"],"0$1"]],"0"],BF:["226","00","[025-7]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[025-7]"]]]],BG:["359","00","00800\\d{7}|[2-7]\\d{6,7}|[89]\\d{6,8}|2\\d{5}",[6,7,8,9,12],[["(\\d)(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["43[1-6]|70[1-9]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["[356]|4[124-7]|7[1-9]|8[1-6]|9[1-7]"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:70|8)0"],"0$1"],["(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3",["43[1-7]|7"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[48]|9[08]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"]],"0"],BH:["973","00","[136-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[13679]|8[02-4679]"]]]],BI:["257","00","(?:[267]\\d|31)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2367]"]]]],BJ:["229","00","[24-689]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-689]"]]]],BL:["590","00","590\\d{6}|(?:69|80|9\\d)\\d{7}",[9],0,"0",0,0,0,0,0,[["590(?:2[7-9]|3[3-7]|5[12]|87)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:395|76[018])\\d|475[0-5])\\d{4}"]]],BM:["1","011","(?:441|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","441$1",0,"441"],BN:["673","00","[2-578]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-578]"]]]],BO:["591","00(?:1\\d)?","(?:[2-467]\\d\\d|8001)\\d{5}",[8,9],[["(\\d)(\\d{7})","$1 $2",["[23]|4[46]"]],["(\\d{8})","$1",["[67]"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["8"]]],"0",0,"0(1\\d)?"],BQ:["599","00","(?:[34]1|7\\d)\\d{5}",[7],0,0,0,0,0,0,"[347]"],BR:["55","00(?:1[245]|2[1-35]|31|4[13]|[56]5|99)","(?:[1-46-9]\\d\\d|5(?:[0-46-9]\\d|5[0-46-9]))\\d{8}|[1-9]\\d{9}|[3589]\\d{8}|[34]\\d{7}",[8,9,10,11],[["(\\d{4})(\\d{4})","$1-$2",["300|4(?:0[02]|37)","4(?:02|37)0|[34]00"]],["(\\d{3})(\\d{2,3})(\\d{4})","$1 $2 $3",["(?:[358]|90)0"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["(?:[14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])[2-57]"],"($1)"],["(\\d{2})(\\d{5})(\\d{4})","$1 $2-$3",["[16][1-9]|[2-57-9]"],"($1)"]],"0",0,"(?:0|90)(?:(1[245]|2[1-35]|31|4[13]|[56]5|99)(\\d{10,11}))?","$2"],BS:["1","011","(?:242|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([3-8]\\d{6})$|1","242$1",0,"242"],BT:["975","00","[17]\\d{7}|[2-8]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[2-68]|7[246]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[67]|7"]]]],BW:["267","00","(?:0800|(?:[37]|800)\\d)\\d{6}|(?:[2-6]\\d|90)\\d{5}",[7,8,10],[["(\\d{2})(\\d{5})","$1 $2",["90"]],["(\\d{3})(\\d{4})","$1 $2",["[24-6]|3[15-9]"]],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37]"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["8"]]]],BY:["375","810","(?:[12]\\d|33|44|902)\\d{7}|8(?:0[0-79]\\d{5,7}|[1-7]\\d{9})|8(?:1[0-489]|[5-79]\\d)\\d{7}|8[1-79]\\d{6,7}|8[0-79]\\d{5}|8\\d{5}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3})","$1 $2",["800"],"8 $1"],["(\\d{3})(\\d{2})(\\d{2,4})","$1 $2 $3",["800"],"8 $1"],["(\\d{4})(\\d{2})(\\d{3})","$1 $2-$3",["1(?:5[169]|6[3-5]|7[179])|2(?:1[35]|2[34]|3[3-5])","1(?:5[169]|6(?:3[1-3]|4|5[125])|7(?:1[3-9]|7[0-24-6]|9[2-7]))|2(?:1[35]|2[34]|3[3-5])"],"8 0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["1(?:[56]|7[467])|2[1-3]"],"8 0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-4]"],"8 0$1"],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["[89]"],"8 $1"]],"8",0,"0|80?",0,0,0,0,"8~10"],BZ:["501","00","(?:0800\\d|[2-8])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1-$2",["[2-8]"]],["(\\d)(\\d{3})(\\d{4})(\\d{3})","$1-$2-$3-$4",["0"]]]],CA:["1","011","(?:[2-8]\\d|90)\\d{8}|3\\d{6}",[7,10],0,"1",0,0,0,0,0,[["(?:2(?:04|[23]6|[48]9|50|63)|3(?:06|43|54|6[578]|82)|4(?:03|1[68]|[26]8|3[178]|50|74)|5(?:06|1[49]|48|79|8[147])|6(?:04|[18]3|39|47|72)|7(?:0[59]|42|53|78|8[02])|8(?:[06]7|19|25|73)|90[25])[2-9]\\d{6}",[10]],["",[10]],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}",[10]],["900[2-9]\\d{6}",[10]],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|(?:5(?:00|2[125-9]|33|44|66|77|88)|622)[2-9]\\d{6}",[10]],0,["310\\d{4}",[7]],0,["600[2-9]\\d{6}",[10]]]],CC:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10,12],0,"0",0,"([59]\\d{7})$|0","8$1",0,0,[["8(?:51(?:0(?:02|31|60|89)|1(?:18|76)|223)|91(?:0(?:1[0-2]|29)|1(?:[28]2|50|79)|2(?:10|64)|3(?:[06]8|22)|4[29]8|62\\d|70[23]|959))\\d{3}",[9]],["4(?:(?:79|94)[01]|83[0-389])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[016-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],CD:["243","00","[189]\\d{8}|[1-68]\\d{6}",[7,9],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["[1-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]"],"0$1"]],"0"],CF:["236","00","(?:[27]\\d{3}|8776)\\d{4}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[278]"]]]],CG:["242","00","222\\d{6}|(?:0\\d|80)\\d{7}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["8"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[02]"]]]],CH:["41","00","8\\d{11}|[2-9]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8[047]|90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-79]|81"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["8"],"0$1"]],"0"],CI:["225","00","[02]\\d{9}",[10],[["(\\d{2})(\\d{2})(\\d)(\\d{5})","$1 $2 $3 $4",["2"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3 $4",["0"]]]],CK:["682","00","[2-578]\\d{4}",[5],[["(\\d{2})(\\d{3})","$1 $2",["[2-578]"]]]],CL:["56","(?:0|1(?:1[0-69]|2[02-5]|5[13-58]|69|7[0167]|8[018]))0","12300\\d{6}|6\\d{9,10}|[2-9]\\d{8}",[9,10,11],[["(\\d{5})(\\d{4})","$1 $2",["219","2196"],"($1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["44"]],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2[1-36]"],"($1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["9[2-9]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["3[2-5]|[47]|5[1-3578]|6[13-57]|8(?:0[1-9]|[1-9])"],"($1)"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["60|8"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{3})(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3 $4",["60"]]]],CM:["237","00","[26]\\d{8}|88\\d{6,7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["88"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[26]|88"]]]],CN:["86","00|1(?:[12]\\d|79)\\d\\d00","1[127]\\d{8,9}|2\\d{9}(?:\\d{2})?|[12]\\d{6,7}|86\\d{6}|(?:1[03-689]\\d|6)\\d{7,9}|(?:[3-579]\\d|8[0-57-9])\\d{6,9}",[7,8,9,10,11,12],[["(\\d{2})(\\d{5,6})","$1 $2",["(?:10|2[0-57-9])[19]","(?:10|2[0-57-9])(?:10|9[56])","10(?:10|9[56])|2[0-57-9](?:100|9[56])"],"0$1"],["(\\d{3})(\\d{5,6})","$1 $2",["3(?:[157]|35|49|9[1-68])|4(?:[17]|2[179]|6[47-9]|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]|4[13]|5[1-5])|(?:4[35]|59|85)[1-9]","(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))[19]","85[23](?:10|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:10|9[56])","85[23](?:100|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:100|9[56])"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["(?:4|80)0"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["10|2(?:[02-57-9]|1[1-9])","10|2(?:[02-57-9]|1[1-9])","10[0-79]|2(?:[02-57-9]|1[1-79])|(?:10|21)8(?:0[1-9]|[1-9])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["3(?:[3-59]|7[02-68])|4(?:[26-8]|3[3-9]|5[2-9])|5(?:3[03-9]|[468]|7[028]|9[2-46-9])|6|7(?:[0-247]|3[04-9]|5[0-4689]|6[2368])|8(?:[1-358]|9[1-7])|9(?:[013479]|5[1-5])|(?:[34]1|55|79|87)[02-9]"],"0$1",1],["(\\d{3})(\\d{7,8})","$1 $2",["9"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["80"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[3-578]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["1[3-9]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3 $4",["[12]"],"0$1",1]],"0",0,"(1(?:[12]\\d|79)\\d\\d)|0",0,0,0,0,"00"],CO:["57","00(?:4(?:[14]4|56)|[579])","(?:60\\d\\d|9101)\\d{6}|(?:1\\d|3)\\d{9}",[10,11],[["(\\d{3})(\\d{7})","$1 $2",["6"],"($1)"],["(\\d{3})(\\d{7})","$1 $2",["3[0-357]|91"]],["(\\d)(\\d{3})(\\d{7})","$1-$2-$3",["1"],"0$1",0,"$1 $2 $3"]],"0",0,"0(4(?:[14]4|56)|[579])?"],CR:["506","00","(?:8\\d|90)\\d{8}|(?:[24-8]\\d{3}|3005)\\d{4}",[8,10],[["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[3-9]"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[89]"]]],0,0,"(19(?:0[0-2468]|1[09]|20|66|77|99))"],CU:["53","119","[27]\\d{6,7}|[34]\\d{5,7}|63\\d{6}|(?:5|8\\d\\d)\\d{7}",[6,7,8,10],[["(\\d{2})(\\d{4,6})","$1 $2",["2[1-4]|[34]"],"(0$1)"],["(\\d)(\\d{6,7})","$1 $2",["7"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["[56]"],"0$1"],["(\\d{3})(\\d{7})","$1 $2",["8"],"0$1"]],"0"],CV:["238","0","(?:[2-59]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[2-589]"]]]],CW:["599","00","(?:[34]1|60|(?:7|9\\d)\\d)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[3467]"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["9[4-8]"]]],0,0,0,0,0,"[69]"],CX:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10,12],0,"0",0,"([59]\\d{7})$|0","8$1",0,0,[["8(?:51(?:0(?:01|30|59|88)|1(?:17|46|75)|2(?:22|35))|91(?:00[6-9]|1(?:[28]1|49|78)|2(?:09|63)|3(?:12|26|75)|4(?:56|97)|64\\d|7(?:0[01]|1[0-2])|958))\\d{3}",[9]],["4(?:(?:79|94)[01]|83[0-389])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[016-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],CY:["357","00","(?:[279]\\d|[58]0)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[257-9]"]]]],CZ:["420","00","(?:[2-578]\\d|60)\\d{7}|9\\d{8,11}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]|9[015-7]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3 $4",["96"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]]],DE:["49","00","[2579]\\d{5,14}|49(?:[34]0|69|8\\d)\\d\\d?|49(?:37|49|60|7[089]|9\\d)\\d{1,3}|49(?:2[024-9]|3[2-689]|7[1-7])\\d{1,8}|(?:1|[368]\\d|4[0-8])\\d{3,13}|49(?:[015]\\d|2[13]|31|[46][1-8])\\d{1,9}",[4,5,6,7,8,9,10,11,12,13,14,15],[["(\\d{2})(\\d{3,13})","$1 $2",["3[02]|40|[68]9"],"0$1"],["(\\d{3})(\\d{3,12})","$1 $2",["2(?:0[1-389]|1[124]|2[18]|3[14])|3(?:[35-9][15]|4[015])|906|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1","2(?:0[1-389]|12[0-8])|3(?:[35-9][15]|4[015])|906|2(?:[13][14]|2[18])|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1"],"0$1"],["(\\d{4})(\\d{2,11})","$1 $2",["[24-6]|3(?:[3569][02-46-9]|4[2-4679]|7[2-467]|8[2-46-8])|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]","[24-6]|3(?:3(?:0[1-467]|2[127-9]|3[124578]|7[1257-9]|8[1256]|9[145])|4(?:2[135]|4[13578]|9[1346])|5(?:0[14]|2[1-3589]|6[1-4]|7[13468]|8[13568])|6(?:2[1-489]|3[124-6]|6[13]|7[12579]|8[1-356]|9[135])|7(?:2[1-7]|4[145]|6[1-5]|7[1-4])|8(?:21|3[1468]|6|7[1467]|8[136])|9(?:0[12479]|2[1358]|4[134679]|6[1-9]|7[136]|8[147]|9[1468]))|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]|3[68]4[1347]|3(?:47|60)[1356]|3(?:3[46]|46|5[49])[1246]|3[4579]3[1357]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["138"],"0$1"],["(\\d{5})(\\d{2,10})","$1 $2",["3"],"0$1"],["(\\d{3})(\\d{5,11})","$1 $2",["181"],"0$1"],["(\\d{3})(\\d)(\\d{4,10})","$1 $2 $3",["1(?:3|80)|9"],"0$1"],["(\\d{3})(\\d{7,8})","$1 $2",["1[67]"],"0$1"],["(\\d{3})(\\d{7,12})","$1 $2",["8"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["185","1850","18500"],"0$1"],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["18[68]"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["15[0568]"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["15[1279]"],"0$1"],["(\\d{3})(\\d{8})","$1 $2",["18"],"0$1"],["(\\d{3})(\\d{2})(\\d{7,8})","$1 $2 $3",["1(?:6[023]|7)"],"0$1"],["(\\d{4})(\\d{2})(\\d{7})","$1 $2 $3",["15[279]"],"0$1"],["(\\d{3})(\\d{2})(\\d{8})","$1 $2 $3",["15"],"0$1"]],"0"],DJ:["253","00","(?:2\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[27]"]]]],DK:["45","00","[2-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-9]"]]]],DM:["1","011","(?:[58]\\d\\d|767|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","767$1",0,"767"],DO:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,0,0,0,"8001|8[024]9"],DZ:["213","00","(?:[1-4]|[5-79]\\d|80)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["9"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-8]"],"0$1"]],"0"],EC:["593","00","1\\d{9,10}|(?:[2-7]|9\\d)\\d{7}",[8,9,10,11],[["(\\d)(\\d{3})(\\d{4})","$1 $2-$3",["[2-7]"],"(0$1)",0,"$1-$2-$3"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{3})(\\d{3,4})","$1 $2 $3",["1"]]],"0"],EE:["372","00","8\\d{9}|[4578]\\d{7}|(?:[3-8]\\d|90)\\d{5}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[369]|4[3-8]|5(?:[0-2]|5[0-478]|6[45])|7[1-9]|88","[369]|4[3-8]|5(?:[02]|1(?:[0-8]|95)|5[0-478]|6(?:4[0-4]|5[1-589]))|7[1-9]|88"]],["(\\d{4})(\\d{3,4})","$1 $2",["[45]|8(?:00|[1-49])","[45]|8(?:00[1-9]|[1-49])"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]]],EG:["20","00","[189]\\d{8,9}|[24-6]\\d{8}|[135]\\d{7}",[8,9,10],[["(\\d)(\\d{7,8})","$1 $2",["[23]"],"0$1"],["(\\d{2})(\\d{6,7})","$1 $2",["1[35]|[4-6]|8[2468]|9[235-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{8})","$1 $2",["1"],"0$1"]],"0"],EH:["212","00","[5-8]\\d{8}",[9],0,"0",0,0,0,0,"528[89]"],ER:["291","00","[178]\\d{6}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[178]"],"0$1"]],"0"],ES:["34","00","[5-9]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]00"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-9]"]]]],ET:["251","00","(?:11|[2-579]\\d)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-579]"],"0$1"]],"0"],FI:["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","[1-35689]\\d{4}|7\\d{10,11}|(?:[124-7]\\d|3[0-46-9])\\d{8}|[1-9]\\d{5,8}",[5,6,7,8,9,10,11,12],[["(\\d)(\\d{4,9})","$1 $2",["[2568][1-8]|3(?:0[1-9]|[1-9])|9"],"0$1"],["(\\d{3})(\\d{3,7})","$1 $2",["[12]00|[368]|70[07-9]"],"0$1"],["(\\d{2})(\\d{4,8})","$1 $2",["[1245]|7[135]"],"0$1"],["(\\d{2})(\\d{6,10})","$1 $2",["7"],"0$1"]],"0",0,0,0,0,"1[03-79]|[2-9]",0,"00"],FJ:["679","0(?:0|52)","45\\d{5}|(?:0800\\d|[235-9])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1 $2",["[235-9]|45"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]]],0,0,0,0,0,0,0,"00"],FK:["500","00","[2-7]\\d{4}",[5]],FM:["691","00","(?:[39]\\d\\d|820)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[389]"]]]],FO:["298","00","[2-9]\\d{5}",[6],[["(\\d{6})","$1",["[2-9]"]]],0,0,"(10(?:01|[12]0|88))"],FR:["33","00","[1-9]\\d{8}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0 $1"],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[1-79]"],"0$1"]],"0"],GA:["241","00","(?:[067]\\d|11)\\d{6}|[2-7]\\d{6}",[7,8],[["(\\d)(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-7]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["11|[67]"],"0$1"]],0,0,"0(11\\d{6}|60\\d{6}|61\\d{6}|6[256]\\d{6}|7[467]\\d{6})","$1"],GB:["44","00","[1-357-9]\\d{9}|[18]\\d{8}|8\\d{6}",[7,9,10],[["(\\d{3})(\\d{4})","$1 $2",["800","8001","80011","800111","8001111"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["845","8454","84546","845464"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["800"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["1(?:38|5[23]|69|76|94)","1(?:(?:38|69)7|5(?:24|39)|768|946)","1(?:3873|5(?:242|39[4-6])|(?:697|768)[347]|9467)"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["1(?:[2-69][02-9]|[78])"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[25]|7(?:0|6[02-9])","[25]|7(?:0|6(?:[03-9]|2[356]))"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[1389]"],"0$1"]],"0",0,0,0,0,0,[["(?:1(?:1(?:3(?:[0-58]\\d\\d|73[0235])|4(?:[0-5]\\d\\d|69[7-9]|70[0-79])|(?:(?:5[0-26-9]|[78][0-49])\\d|6(?:[0-4]\\d|50))\\d)|(?:2(?:(?:0[024-9]|2[3-9]|3[3-79]|4[1-689]|[58][02-9]|6[0-47-9]|7[013-9]|9\\d)\\d|1(?:[0-7]\\d|8[0-2]))|(?:3(?:0\\d|1[0-8]|[25][02-9]|3[02-579]|[468][0-46-9]|7[1-35-79]|9[2-578])|4(?:0[03-9]|[137]\\d|[28][02-57-9]|4[02-69]|5[0-8]|[69][0-79])|5(?:0[1-35-9]|[16]\\d|2[024-9]|3[015689]|4[02-9]|5[03-9]|7[0-35-9]|8[0-468]|9[0-57-9])|6(?:0[034689]|1\\d|2[0-35689]|[38][013-9]|4[1-467]|5[0-69]|6[13-9]|7[0-8]|9[0-24578])|7(?:0[0246-9]|2\\d|3[0236-8]|4[03-9]|5[0-46-9]|6[013-9]|7[0-35-9]|8[024-9]|9[02-9])|8(?:0[35-9]|2[1-57-9]|3[02-578]|4[0-578]|5[124-9]|6[2-69]|7\\d|8[02-9]|9[02569])|9(?:0[02-589]|[18]\\d|2[02-689]|3[1-57-9]|4[2-9]|5[0-579]|6[2-47-9]|7[0-24578]|9[2-57]))\\d)\\d)|2(?:0[013478]|3[0189]|4[017]|8[0-46-9]|9[0-2])\\d{3})\\d{4}|1(?:2(?:0(?:46[1-4]|87[2-9])|545[1-79]|76(?:2\\d|3[1-8]|6[1-6])|9(?:7(?:2[0-4]|3[2-5])|8(?:2[2-8]|7[0-47-9]|8[3-5])))|3(?:6(?:38[2-5]|47[23])|8(?:47[04-9]|64[0157-9]))|4(?:044[1-7]|20(?:2[23]|8\\d)|6(?:0(?:30|5[2-57]|6[1-8]|7[2-8])|140)|8(?:052|87[1-3]))|5(?:2(?:4(?:3[2-79]|6\\d)|76\\d)|6(?:26[06-9]|686))|6(?:06(?:4\\d|7[4-79])|295[5-7]|35[34]\\d|47(?:24|61)|59(?:5[08]|6[67]|74)|9(?:55[0-4]|77[23]))|7(?:26(?:6[13-9]|7[0-7])|(?:442|688)\\d|50(?:2[0-3]|[3-68]2|76))|8(?:27[56]\\d|37(?:5[2-5]|8[239])|843[2-58])|9(?:0(?:0(?:6[1-8]|85)|52\\d)|3583|4(?:66[1-8]|9(?:2[01]|81))|63(?:23|3[1-4])|9561))\\d{3}",[9,10]],["7(?:457[0-57-9]|700[01]|911[028])\\d{5}|7(?:[1-3]\\d\\d|4(?:[0-46-9]\\d|5[0-689])|5(?:0[0-8]|[13-9]\\d|2[0-35-9])|7(?:0[1-9]|[1-7]\\d|8[02-9]|9[0-689])|8(?:[014-9]\\d|[23][0-8])|9(?:[024-9]\\d|1[02-9]|3[0-689]))\\d{6}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[2-49]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}",[10]],["56\\d{8}",[10]]],0," x"],GD:["1","011","(?:473|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","473$1",0,"473"],GE:["995","00","(?:[3-57]\\d\\d|800)\\d{6}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["32"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[57]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[348]"],"0$1"]],"0"],GF:["594","00","[56]94\\d{6}|(?:80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[56]|9[47]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[89]"],"0$1"]],"0"],GG:["44","00","(?:1481|[357-9]\\d{3})\\d{6}|8\\d{6}(?:\\d{2})?",[7,9,10],0,"0",0,"([25-9]\\d{5})$|0","1481$1",0,0,[["1481[25-9]\\d{5}",[10]],["7(?:(?:781|839)\\d|911[17])\\d{5}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[0-3]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}",[10]],["56\\d{8}",[10]]]],GH:["233","00","(?:[235]\\d{3}|800)\\d{5}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[235]"],"0$1"]],"0"],GI:["350","00","(?:[25]\\d|60)\\d{6}",[8],[["(\\d{3})(\\d{5})","$1 $2",["2"]]]],GL:["299","00","(?:19|[2-689]\\d|70)\\d{4}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["19|[2-9]"]]]],GM:["220","00","[2-9]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],GN:["224","00","722\\d{6}|(?:3|6\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["3"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[67]"]]]],GP:["590","00","590\\d{6}|(?:69|80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[569]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0",0,0,0,0,0,[["590(?:0[1-68]|[14][0-24-9]|2[0-68]|3[1-9]|5[3-579]|[68][0-689]|7[08]|9\\d)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:395|76[018])\\d|475[0-5])\\d{4}"]]],GQ:["240","00","222\\d{6}|(?:3\\d|55|[89]0)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235]"]],["(\\d{3})(\\d{6})","$1 $2",["[89]"]]]],GR:["30","00","5005000\\d{3}|8\\d{9,11}|(?:[269]\\d|70)\\d{8}",[10,11,12],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["21|7"]],["(\\d{4})(\\d{6})","$1 $2",["2(?:2|3[2-57-9]|4[2-469]|5[2-59]|6[2-9]|7[2-69]|8[2-49])|5"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2689]"]],["(\\d{3})(\\d{3,4})(\\d{5})","$1 $2 $3",["8"]]]],GT:["502","00","(?:1\\d{3}|[2-7])\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1 $2",["[2-7]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]]],GU:["1","011","(?:[58]\\d\\d|671|900)\\d{7}",[10],0,"1",0,"([3-9]\\d{6})$|1","671$1",0,"671"],GW:["245","00","[49]\\d{8}|4\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["40"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"]]]],GY:["592","001","9008\\d{3}|(?:[2-467]\\d\\d|510|862)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],HK:["852","00(?:30|5[09]|[126-9]?)","8[0-46-9]\\d{6,7}|9\\d{4,7}|(?:[2-7]|9\\d{3})\\d{7}",[5,6,7,8,9,11],[["(\\d{3})(\\d{2,5})","$1 $2",["900","9003"]],["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[1-4]|9(?:0[1-9]|[1-8])"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]],["(\\d{3})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]],0,0,0,0,0,0,0,"00"],HN:["504","00","8\\d{10}|[237-9]\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1-$2",["[237-9]"]]]],HR:["385","00","(?:[24-69]\\d|3[0-79])\\d{7}|80\\d{5,7}|[1-79]\\d{7}|6\\d{5,6}",[6,7,8,9],[["(\\d{2})(\\d{2})(\\d{2,3})","$1 $2 $3",["6[01]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{4})(\\d{3})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[67]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-5]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"]],"0"],HT:["509","00","(?:[2-489]\\d|55)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[2-589]"]]]],HU:["36","00","[235-7]\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27][2-9]|3[2-7]|4[24-9]|5[2-79]|6|8[2-57-9]|9[2-69]"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"06 $1"]],"06"],ID:["62","00[89]","(?:(?:00[1-9]|8\\d)\\d{4}|[1-36])\\d{6}|00\\d{10}|[1-9]\\d{8,10}|[2-9]\\d{7}",[7,8,9,10,11,12,13],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["15"]],["(\\d{2})(\\d{5,9})","$1 $2",["2[124]|[36]1"],"(0$1)"],["(\\d{3})(\\d{5,7})","$1 $2",["800"],"0$1"],["(\\d{3})(\\d{5,8})","$1 $2",["[2-79]"],"(0$1)"],["(\\d{3})(\\d{3,4})(\\d{3})","$1-$2-$3",["8[1-35-9]"],"0$1"],["(\\d{3})(\\d{6,8})","$1 $2",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["804"],"0$1"],["(\\d{3})(\\d)(\\d{3})(\\d{3})","$1 $2 $3 $4",["80"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1-$2-$3",["8"],"0$1"]],"0"],IE:["353","00","(?:1\\d|[2569])\\d{6,8}|4\\d{6,9}|7\\d{8}|8\\d{8,9}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["2[24-9]|47|58|6[237-9]|9[35-9]"],"(0$1)"],["(\\d{3})(\\d{5})","$1 $2",["[45]0"],"(0$1)"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["1"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2569]|4[1-69]|7[14]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["81"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[78]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["4"],"(0$1)"],["(\\d{2})(\\d)(\\d{3})(\\d{4})","$1 $2 $3 $4",["8"],"0$1"]],"0"],IL:["972","0(?:0|1[2-9])","1\\d{6}(?:\\d{3,5})?|[57]\\d{8}|[1-489]\\d{7}",[7,8,9,10,11,12],[["(\\d{4})(\\d{3})","$1-$2",["125"]],["(\\d{4})(\\d{2})(\\d{2})","$1-$2-$3",["121"]],["(\\d)(\\d{3})(\\d{4})","$1-$2-$3",["[2-489]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1-$2-$3",["12"]],["(\\d{4})(\\d{6})","$1-$2",["159"]],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3-$4",["1[7-9]"]],["(\\d{3})(\\d{1,2})(\\d{3})(\\d{4})","$1-$2 $3-$4",["15"]]],"0"],IM:["44","00","1624\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"([25-8]\\d{5})$|0","1624$1",0,"74576|(?:16|7[56])24"],IN:["91","00","(?:000800|[2-9]\\d\\d)\\d{7}|1\\d{7,12}",[8,9,10,11,12,13],[["(\\d{8})","$1",["5(?:0|2[23]|3[03]|[67]1|88)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|888)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|8888)"],0,1],["(\\d{4})(\\d{4,5})","$1 $2",["180","1800"],0,1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["140"],0,1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["11|2[02]|33|4[04]|79[1-7]|80[2-46]","11|2[02]|33|4[04]|79(?:[1-6]|7[19])|80(?:[2-4]|6[0-589])","11|2[02]|33|4[04]|79(?:[124-6]|3(?:[02-9]|1[0-24-9])|7(?:1|9[1-6]))|80(?:[2-4]|6[0-589])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1(?:2[0-249]|3[0-25]|4[145]|[68]|7[1257])|2(?:1[257]|3[013]|4[01]|5[0137]|6[0158]|78|8[1568])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|5[12]|[78]1)|6(?:12|[2-4]1|5[17]|6[13]|80)|7(?:12|3[134]|4[47]|61|88)|8(?:16|2[014]|3[126]|6[136]|7[078]|8[34]|91)|(?:43|59|75)[15]|(?:1[59]|29|67|72)[14]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|674|7(?:(?:2[14]|3[34]|5[15])[2-6]|61[346]|88[0-8])|8(?:70[2-6]|84[235-7]|91[3-7])|(?:1(?:29|60|8[06])|261|552|6(?:12|[2-47]1|5[17]|6[13]|80)|7(?:12|31|4[47])|8(?:16|2[014]|3[126]|6[136]|7[78]|83))[2-7]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|6(?:12(?:[2-6]|7[0-8])|74[2-7])|7(?:(?:2[14]|5[15])[2-6]|3171|61[346]|88(?:[2-7]|82))|8(?:70[2-6]|84(?:[2356]|7[19])|91(?:[3-6]|7[19]))|73[134][2-6]|(?:74[47]|8(?:16|2[014]|3[126]|6[136]|7[78]|83))(?:[2-6]|7[19])|(?:1(?:29|60|8[06])|261|552|6(?:[2-4]1|5[17]|6[13]|7(?:1|4[0189])|80)|7(?:12|88[01]))[2-7]"],"0$1",1],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2[2457-9]|3[2-5]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1[013-9]|28|3[129]|4[1-35689]|5[29]|6[02-5]|70)|807","1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2(?:[2457]|84|95)|3(?:[2-4]|55)|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1(?:[013-8]|9[6-9])|28[6-8]|3(?:17|2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4|5[0-367])|70[13-7])|807[19]","1(?:[2-479]|5(?:[0236-9]|5[013-9]))|[2-5]|6(?:2(?:84|95)|355|83)|73179|807(?:1|9[1-3])|(?:1552|6(?:1[1358]|2[2457]|3[2-4]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[124-6])\\d|7(?:1(?:[013-8]\\d|9[6-9])|28[6-8]|3(?:2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]\\d|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4\\d|5[0-367])|70[13-7]))[2-7]"],"0$1",1],["(\\d{5})(\\d{5})","$1 $2",["[6-9]"],"0$1",1],["(\\d{4})(\\d{2,4})(\\d{4})","$1 $2 $3",["1(?:6|8[06])","1(?:6|8[06]0)"],0,1],["(\\d{4})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["18"],0,1]],"0"],IO:["246","00","3\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["3"]]]],IQ:["964","00","(?:1|7\\d\\d)\\d{7}|[2-6]\\d{7,8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-6]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"]],"0"],IR:["98","00","[1-9]\\d{9}|(?:[1-8]\\d\\d|9)\\d{3,4}",[4,5,6,7,10],[["(\\d{4,5})","$1",["96"],"0$1"],["(\\d{2})(\\d{4,5})","$1 $2",["(?:1[137]|2[13-68]|3[1458]|4[145]|5[1468]|6[16]|7[1467]|8[13467])[12689]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[1-8]"],"0$1"]],"0"],IS:["354","00|1(?:0(?:01|[12]0)|100)","(?:38\\d|[4-9])\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["[4-9]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["3"]]],0,0,0,0,0,0,0,"00"],IT:["39","00","0\\d{5,10}|1\\d{8,10}|3(?:[0-8]\\d{7,10}|9\\d{7,8})|(?:55|70)\\d{8}|8\\d{5}(?:\\d{2,4})?",[6,7,8,9,10,11],[["(\\d{2})(\\d{4,6})","$1 $2",["0[26]"]],["(\\d{3})(\\d{3,6})","$1 $2",["0[13-57-9][0159]|8(?:03|4[17]|9[2-5])","0[13-57-9][0159]|8(?:03|4[17]|9(?:2|3[04]|[45][0-4]))"]],["(\\d{4})(\\d{2,6})","$1 $2",["0(?:[13-579][2-46-8]|8[236-8])"]],["(\\d{4})(\\d{4})","$1 $2",["894"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[26]|5"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["1(?:44|[679])|[378]"]],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[13-57-9][0159]|14"]],["(\\d{2})(\\d{4})(\\d{5})","$1 $2 $3",["0[26]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["3"]]],0,0,0,0,0,0,[["0669[0-79]\\d{1,6}|0(?:1(?:[0159]\\d|[27][1-5]|31|4[1-4]|6[1356]|8[2-57])|2\\d\\d|3(?:[0159]\\d|2[1-4]|3[12]|[48][1-6]|6[2-59]|7[1-7])|4(?:[0159]\\d|[23][1-9]|4[245]|6[1-5]|7[1-4]|81)|5(?:[0159]\\d|2[1-5]|3[2-6]|4[1-79]|6[4-6]|7[1-578]|8[3-8])|6(?:[0-57-9]\\d|6[0-8])|7(?:[0159]\\d|2[12]|3[1-7]|4[2-46]|6[13569]|7[13-6]|8[1-59])|8(?:[0159]\\d|2[3-578]|3[1-356]|[6-8][1-5])|9(?:[0159]\\d|[238][1-5]|4[12]|6[1-8]|7[1-6]))\\d{2,7}"],["3[1-9]\\d{8}|3[2-9]\\d{7}",[9,10]],["80(?:0\\d{3}|3)\\d{3}",[6,9]],["(?:0878\\d{3}|89(?:2\\d|3[04]|4(?:[0-4]|[5-9]\\d\\d)|5[0-4]))\\d\\d|(?:1(?:44|6[346])|89(?:38|5[5-9]|9))\\d{6}",[6,8,9,10]],["1(?:78\\d|99)\\d{6}",[9,10]],0,0,0,["55\\d{8}",[10]],["84(?:[08]\\d{3}|[17])\\d{3}",[6,9]]]],JE:["44","00","1534\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"([0-24-8]\\d{5})$|0","1534$1",0,0,[["1534[0-24-8]\\d{5}"],["7(?:(?:(?:50|82)9|937)\\d|7(?:00[378]|97[7-9]))\\d{5}"],["80(?:07(?:35|81)|8901)\\d{4}"],["(?:8(?:4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|90(?:066[59]|1810|71(?:07|55)))\\d{4}"],["701511\\d{4}"],0,["(?:3(?:0(?:07(?:35|81)|8901)|3\\d{4}|4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|55\\d{4})\\d{4}"],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}"],["56\\d{8}"]]],JM:["1","011","(?:[58]\\d\\d|658|900)\\d{7}",[10],0,"1",0,0,0,0,"658|876"],JO:["962","00","(?:(?:[2689]|7\\d)\\d|32|53)\\d{6}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2356]|87"],"(0$1)"],["(\\d{3})(\\d{5,6})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["70"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["7"],"0$1"]],"0"],JP:["81","010","00[1-9]\\d{6,14}|[257-9]\\d{9}|(?:00|[1-9]\\d\\d)\\d{6}",[8,9,10,11,12,13,14,15,16,17],[["(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3",["(?:12|57|99)0"],"0$1"],["(\\d{4})(\\d)(\\d{4})","$1-$2-$3",["1(?:26|3[79]|4[56]|5[4-68]|6[3-5])|499|5(?:76|97)|746|8(?:3[89]|47|51)|9(?:80|9[16])","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:76|97)9|7468|8(?:3(?:8[7-9]|96)|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:769|979[2-69])|7468|8(?:3(?:8[7-9]|96[2457-9])|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["60"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2-$3",["[36]|4(?:2[09]|7[01])","[36]|4(?:2(?:0|9[02-69])|7(?:0[019]|1))"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["1(?:1|5[45]|77|88|9[69])|2(?:2[1-37]|3[0-269]|4[59]|5|6[24]|7[1-358]|8[1369]|9[0-38])|4(?:[28][1-9]|3[0-57]|[45]|6[248]|7[2-579]|9[29])|5(?:2|3[0459]|4[0-369]|5[29]|8[02389]|9[0-389])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9[2-6])|8(?:2[124589]|3[26-9]|49|51|6|7[0-468]|8[68]|9[019])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9[1-489])","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2(?:[127]|3[014-9])|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9[19])|62|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|8[1-9]|9[29])|5(?:2|3(?:[045]|9[0-8])|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0-2469])|3(?:[29]|60)|49|51|6(?:[0-24]|36|5[0-3589]|7[23]|9[01459])|7[0-468]|8[68])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9(?:[1289]|3[34]|4[0178]))|(?:264|837)[016-9]|2(?:57|93)[015-9]|(?:25[0468]|422|838)[01]|(?:47[59]|59[89]|8(?:6[68]|9))[019]","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2[127]|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9(?:17|99))|6(?:2|4[016-9])|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|9[29])|5(?:2|3(?:[045]|9(?:[0-58]|6[4-9]|7[0-35689]))|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0169])|3(?:[29]|60|7(?:[017-9]|6[6-8]))|49|51|6(?:[0-24]|36[2-57-9]|5(?:[0-389]|5[23])|6(?:[01]|9[178])|7(?:2[2-468]|3[78])|9[0145])|7[0-468]|8[68])|9(?:4[15]|5[138]|7[156]|8[189]|9(?:[1289]|3(?:31|4[357])|4[0178]))|(?:8294|96)[1-3]|2(?:57|93)[015-9]|(?:223|8699)[014-9]|(?:25[0468]|422|838)[01]|(?:48|8292|9[23])[1-9]|(?:47[59]|59[89]|8(?:68|9))[019]"],"0$1"],["(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3",["[14]|[289][2-9]|5[3-9]|7[2-4679]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["800"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[257-9]"],"0$1"]],"0",0,"(000[259]\\d{6})$|(?:(?:003768)0?)|0","$1"],KE:["254","000","(?:[17]\\d\\d|900)\\d{6}|(?:2|80)0\\d{6,7}|[4-6]\\d{6,8}",[7,8,9,10],[["(\\d{2})(\\d{5,7})","$1 $2",["[24-6]"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[17]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0"],KG:["996","00","8\\d{9}|[235-9]\\d{8}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["3(?:1[346]|[24-79])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235-79]|88"],"0$1"],["(\\d{3})(\\d{3})(\\d)(\\d{2,3})","$1 $2 $3 $4",["8"],"0$1"]],"0"],KH:["855","00[14-9]","1\\d{9}|[1-9]\\d{7,8}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],KI:["686","00","(?:[37]\\d|6[0-79])\\d{6}|(?:[2-48]\\d|50)\\d{3}",[5,8],0,"0"],KM:["269","00","[3478]\\d{6}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[3478]"]]]],KN:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","869$1",0,"869"],KP:["850","00|99","85\\d{6}|(?:19\\d|[2-7])\\d{7}",[8,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"]],"0"],KR:["82","00(?:[125689]|3(?:[46]5|91)|7(?:00|27|3|55|6[126]))","00[1-9]\\d{8,11}|(?:[12]|5\\d{3})\\d{7}|[13-6]\\d{9}|(?:[1-6]\\d|80)\\d{7}|[3-6]\\d{4,5}|(?:00|7)0\\d{8}",[5,6,8,9,10,11,12,13,14],[["(\\d{2})(\\d{3,4})","$1-$2",["(?:3[1-3]|[46][1-4]|5[1-5])1"],"0$1"],["(\\d{4})(\\d{4})","$1-$2",["1"]],["(\\d)(\\d{3,4})(\\d{4})","$1-$2-$3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["60|8"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1-$2-$3",["[1346]|5[1-5]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{2})(\\d{5})(\\d{4})","$1-$2-$3",["5"],"0$1"]],"0",0,"0(8(?:[1-46-8]|5\\d\\d))?"],KW:["965","00","18\\d{5}|(?:[2569]\\d|41)\\d{6}",[7,8],[["(\\d{4})(\\d{3,4})","$1 $2",["[169]|2(?:[235]|4[1-35-9])|52"]],["(\\d{3})(\\d{5})","$1 $2",["[245]"]]]],KY:["1","011","(?:345|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","345$1",0,"345"],KZ:["7","810","(?:33622|8\\d{8})\\d{5}|[78]\\d{9}",[10,14],0,"8",0,0,0,0,"33|7",0,"8~10"],LA:["856","00","[23]\\d{9}|3\\d{8}|(?:[235-8]\\d|41)\\d{6}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2[13]|3[14]|[4-8]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["30[013-9]"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[23]"],"0$1"]],"0"],LB:["961","00","[27-9]\\d{7}|[13-9]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[13-69]|7(?:[2-57]|62|8[0-7]|9[04-9])|8[02-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27-9]"]]],"0"],LC:["1","011","(?:[58]\\d\\d|758|900)\\d{7}",[10],0,"1",0,"([2-8]\\d{6})$|1","758$1",0,"758"],LI:["423","00","[68]\\d{8}|(?:[2378]\\d|90)\\d{5}",[7,9],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[2379]|8(?:0[09]|7)","[2379]|8(?:0(?:02|9)|7)"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["69"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]],"0",0,"(1001)|0"],LK:["94","00","[1-9]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[1-689]"],"0$1"]],"0"],LR:["231","00","(?:[25]\\d|33|77|88)\\d{7}|(?:2\\d|[4-6])\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[4-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[23578]"],"0$1"]],"0"],LS:["266","00","(?:[256]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2568]"]]]],LT:["370","00","(?:[3469]\\d|52|[78]0)\\d{6}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["52[0-7]"],"(8-$1)",1],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[7-9]"],"8 $1",1],["(\\d{2})(\\d{6})","$1 $2",["37|4(?:[15]|6[1-8])"],"(8-$1)",1],["(\\d{3})(\\d{5})","$1 $2",["[3-6]"],"(8-$1)",1]],"8",0,"[08]"],LU:["352","00","35[013-9]\\d{4,8}|6\\d{8}|35\\d{2,4}|(?:[2457-9]\\d|3[0-46-9])\\d{2,9}",[4,5,6,7,8,9,10,11],[["(\\d{2})(\\d{3})","$1 $2",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["20[2-689]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4",["2(?:[0367]|4[3-8])"]],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["80[01]|90[015]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["20"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4 $5",["2(?:[0367]|4[3-8])"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,5})","$1 $2 $3 $4",["[3-57]|8[13-9]|9(?:0[89]|[2-579])|(?:2|80)[2-9]"]]],0,0,"(15(?:0[06]|1[12]|[35]5|4[04]|6[26]|77|88|99)\\d)"],LV:["371","00","(?:[268]\\d|90)\\d{6}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[269]|8[01]"]]]],LY:["218","00","[2-9]\\d{8}",[9],[["(\\d{2})(\\d{7})","$1-$2",["[2-9]"],"0$1"]],"0"],MA:["212","00","[5-8]\\d{8}",[9],[["(\\d{5})(\\d{4})","$1-$2",["5(?:29|38)","5(?:29[1289]|389)","529(?:1[1-46-9]|2[013-8]|90)|5(?:298|389)[0-46-9]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["5[45]"],"0$1"],["(\\d{4})(\\d{5})","$1-$2",["5(?:2[2-489]|3[5-9]|9)|892","5(?:2(?:[2-49]|8[235-9])|3[5-9]|9)|892"],"0$1"],["(\\d{2})(\\d{7})","$1-$2",["8"],"0$1"],["(\\d{3})(\\d{6})","$1-$2",["[5-7]"],"0$1"]],"0",0,0,0,0,0,[["5293[01]\\d{4}|5(?:2(?:[0-25-7]\\d|3[1-578]|4[02-46-8]|8[0235-7]|9[0-289])|3(?:[0-47]\\d|5[02-9]|6[02-8]|8[0189]|9[3-9])|(?:4[067]|5[03])\\d)\\d{5}"],["(?:6(?:[0-79]\\d|8[0-247-9])|7(?:[017]\\d|2[0-2]|6[0-8]|8[0-3]))\\d{6}"],["80\\d{7}"],["89\\d{7}"],0,0,0,0,["592(?:4[0-2]|93)\\d{4}"]]],MC:["377","00","(?:[3489]|6\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["4"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[389]"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["6"],"0$1"]],"0"],MD:["373","00","(?:[235-7]\\d|[89]0)\\d{6}",[8],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["22|3"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[25-7]"],"0$1"]],"0"],ME:["382","00","(?:20|[3-79]\\d)\\d{6}|80\\d{6,7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"0$1"]],"0"],MF:["590","00","590\\d{6}|(?:69|80|9\\d)\\d{7}",[9],0,"0",0,0,0,0,0,[["590(?:0[079]|[14]3|[27][79]|3[03-7]|5[0-268]|87)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:395|76[018])\\d|475[0-5])\\d{4}"]]],MG:["261","00","[23]\\d{8}",[9],[["(\\d{2})(\\d{2})(\\d{3})(\\d{2})","$1 $2 $3 $4",["[23]"],"0$1"]],"0",0,"([24-9]\\d{6})$|0","20$1"],MH:["692","011","329\\d{4}|(?:[256]\\d|45)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1-$2",["[2-6]"]]],"1"],MK:["389","00","[2-578]\\d{7}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2|34[47]|4(?:[37]7|5[47]|64)"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[347]"],"0$1"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["[58]"],"0$1"]],"0"],ML:["223","00","[24-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-9]"]]]],MM:["95","00","1\\d{5,7}|95\\d{6}|(?:[4-7]|9[0-46-9])\\d{6,8}|(?:2|8\\d)\\d{5,8}",[6,7,8,9,10],[["(\\d)(\\d{2})(\\d{3})","$1 $2 $3",["16|2"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["[45]|6(?:0[23]|[1-689]|7[235-7])|7(?:[0-4]|5[2-7])|8[1-6]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[4-7]|8[1-35]"],"0$1"],["(\\d)(\\d{3})(\\d{4,6})","$1 $2 $3",["9(?:2[0-4]|[35-9]|4[137-9])"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["92"],"0$1"],["(\\d)(\\d{5})(\\d{4})","$1 $2 $3",["9"],"0$1"]],"0"],MN:["976","001","[12]\\d{7,9}|[5-9]\\d{7}",[8,9,10],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[12]1"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[5-9]"]],["(\\d{3})(\\d{5,6})","$1 $2",["[12]2[1-3]"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["[12](?:27|3[2-8]|4[2-68]|5[1-4689])","[12](?:27|3[2-8]|4[2-68]|5[1-4689])[0-3]"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["[12]"],"0$1"]],"0"],MO:["853","00","0800\\d{3}|(?:28|[68]\\d)\\d{6}",[7,8],[["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{4})(\\d{4})","$1 $2",["[268]"]]]],MP:["1","011","[58]\\d{9}|(?:67|90)0\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","670$1",0,"670"],MQ:["596","00","596\\d{6}|(?:69|80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[569]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],MR:["222","00","(?:[2-4]\\d\\d|800)\\d{5}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-48]"]]]],MS:["1","011","(?:[58]\\d\\d|664|900)\\d{7}",[10],0,"1",0,"([34]\\d{6})$|1","664$1",0,"664"],MT:["356","00","3550\\d{4}|(?:[2579]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2357-9]"]]]],MU:["230","0(?:0|[24-7]0|3[03])","(?:[57]|8\\d\\d)\\d{7}|[2-468]\\d{6}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[2-46]|8[013]"]],["(\\d{4})(\\d{4})","$1 $2",["[57]"]],["(\\d{5})(\\d{5})","$1 $2",["8"]]],0,0,0,0,0,0,0,"020"],MV:["960","0(?:0|19)","(?:800|9[0-57-9]\\d)\\d{7}|[34679]\\d{6}",[7,10],[["(\\d{3})(\\d{4})","$1-$2",["[34679]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"]]],0,0,0,0,0,0,0,"00"],MW:["265","00","(?:[1289]\\d|31|77)\\d{7}|1\\d{6}",[7,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["1[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[137-9]"],"0$1"]],"0"],MX:["52","0[09]","1(?:(?:[27]2|44|99)[1-9]|65[0-689])\\d{7}|(?:1(?:[01]\\d|2[13-9]|[35][1-9]|4[0-35-9]|6[0-46-9]|7[013-9]|8[1-79]|9[1-8])|[2-9]\\d)\\d{8}",[10,11],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["33|5[56]|81"],0,1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2-9]"],0,1],["(\\d)(\\d{2})(\\d{4})(\\d{4})","$2 $3 $4",["1(?:33|5[56]|81)"],0,1],["(\\d)(\\d{3})(\\d{3})(\\d{4})","$2 $3 $4",["1"],0,1]],"01",0,"0(?:[12]|4[45])|1",0,0,0,0,"00"],MY:["60","00","1\\d{8,9}|(?:3\\d|[4-9])\\d{7}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1-$2 $3",["[4-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1-$2 $3",["1(?:[02469]|[378][1-9]|53)|8","1(?:[02469]|[37][1-9]|53|8(?:[1-46-9]|5[7-9]))|8"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2 $3",["3"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3-$4",["1(?:[367]|80)"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2 $3",["15"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2 $3",["1"],"0$1"]],"0"],MZ:["258","00","(?:2|8\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2|8[2-79]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]]],NA:["264","00","[68]\\d{7,8}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["87"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0"],NC:["687","00","(?:050|[2-57-9]\\d\\d)\\d{3}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1.$2.$3",["[02-57-9]"]]]],NE:["227","00","[027-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["08"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[089]|2[013]|7[047]"]]]],NF:["672","00","[13]\\d{5}",[6],[["(\\d{2})(\\d{4})","$1 $2",["1[0-3]"]],["(\\d)(\\d{5})","$1 $2",["[13]"]]],0,0,"([0-258]\\d{4})$","3$1"],NG:["234","009","(?:[124-7]|9\\d{3})\\d{6}|[1-9]\\d{7}|[78]\\d{9,13}",[7,8,10,11,12,13,14],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["78"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]|9(?:0[3-9]|[1-9])"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["[3-7]|8[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[7-9]"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["[78]"],"0$1"],["(\\d{3})(\\d{5})(\\d{5,6})","$1 $2 $3",["[78]"],"0$1"]],"0"],NI:["505","00","(?:1800|[25-8]\\d{3})\\d{4}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[125-8]"]]]],NL:["31","00","(?:[124-7]\\d\\d|3(?:[02-9]\\d|1[0-8]))\\d{6}|8\\d{6,9}|9\\d{6,10}|1\\d{4,5}",[5,6,7,8,9,10,11],[["(\\d{3})(\\d{4,7})","$1 $2",["[89]0"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["66"],"0$1"],["(\\d)(\\d{8})","$1 $2",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["1[16-8]|2[259]|3[124]|4[17-9]|5[124679]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-578]|91"],"0$1"],["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3",["9"],"0$1"]],"0"],NO:["47","00","(?:0|[2-9]\\d{3})\\d{4}",[5,8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["8"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-79]"]]],0,0,0,0,0,"[02-689]|7[0-8]"],NP:["977","00","(?:1\\d|9)\\d{9}|[1-9]\\d{7}",[8,10,11],[["(\\d)(\\d{7})","$1-$2",["1[2-6]"],"0$1"],["(\\d{2})(\\d{6})","$1-$2",["1[01]|[2-8]|9(?:[1-59]|[67][2-6])"],"0$1"],["(\\d{3})(\\d{7})","$1-$2",["9"]]],"0"],NR:["674","00","(?:444|(?:55|8\\d)\\d|666)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[4-68]"]]]],NU:["683","00","(?:[47]|888\\d)\\d{3}",[4,7],[["(\\d{3})(\\d{4})","$1 $2",["8"]]]],NZ:["64","0(?:0|161)","[1289]\\d{9}|50\\d{5}(?:\\d{2,3})?|[27-9]\\d{7,8}|(?:[34]\\d|6[0-35-9])\\d{6}|8\\d{4,6}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,8})","$1 $2",["8[1-79]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["50[036-8]|8|90","50(?:[0367]|88)|8|90"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["24|[346]|7[2-57-9]|9[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:10|74)|[589]"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["1|2[028]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,5})","$1 $2 $3",["2(?:[169]|7[0-35-9])|7"],"0$1"]],"0",0,0,0,0,0,0,"00"],OM:["968","00","(?:1505|[279]\\d{3}|500)\\d{4}|800\\d{5,6}",[7,8,9],[["(\\d{3})(\\d{4,6})","$1 $2",["[58]"]],["(\\d{2})(\\d{6})","$1 $2",["2"]],["(\\d{4})(\\d{4})","$1 $2",["[179]"]]]],PA:["507","00","(?:00800|8\\d{3})\\d{6}|[68]\\d{7}|[1-57-9]\\d{6}",[7,8,10,11],[["(\\d{3})(\\d{4})","$1-$2",["[1-57-9]"]],["(\\d{4})(\\d{4})","$1-$2",["[68]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]]],PE:["51","00|19(?:1[124]|77|90)00","(?:[14-8]|9\\d)\\d{7}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["80"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["1"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[4-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"]]],"0",0,0,0,0,0,0,"00"," Anexo "],PF:["689","00","4\\d{5}(?:\\d{2})?|8\\d{7,8}",[6,8,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["44"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4|8[7-9]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]]],PG:["675","00|140[1-3]","(?:180|[78]\\d{3})\\d{4}|(?:[2-589]\\d|64)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["18|[2-69]|85"]],["(\\d{4})(\\d{4})","$1 $2",["[78]"]]],0,0,0,0,0,0,0,"00"],PH:["63","00","(?:[2-7]|9\\d)\\d{8}|2\\d{5}|(?:1800|8)\\d{7,9}",[6,8,9,10,11,12,13],[["(\\d)(\\d{5})","$1 $2",["2"],"(0$1)"],["(\\d{4})(\\d{4,6})","$1 $2",["3(?:23|39|46)|4(?:2[3-6]|[35]9|4[26]|76)|544|88[245]|(?:52|64|86)2","3(?:230|397|461)|4(?:2(?:35|[46]4|51)|396|4(?:22|63)|59[347]|76[15])|5(?:221|446)|642[23]|8(?:622|8(?:[24]2|5[13]))"],"(0$1)"],["(\\d{5})(\\d{4})","$1 $2",["346|4(?:27|9[35])|883","3469|4(?:279|9(?:30|56))|8834"],"(0$1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3-7]|8[2-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{4})(\\d{1,2})(\\d{3})(\\d{4})","$1 $2 $3 $4",["1"]]],"0"],PK:["92","00","122\\d{6}|[24-8]\\d{10,11}|9(?:[013-9]\\d{8,10}|2(?:[01]\\d\\d|2(?:[06-8]\\d|1[01]))\\d{7})|(?:[2-8]\\d{3}|92(?:[0-7]\\d|8[1-9]))\\d{6}|[24-9]\\d{8}|[89]\\d{7}",[8,9,10,11,12],[["(\\d{3})(\\d{3})(\\d{2,7})","$1 $2 $3",["[89]0"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["1"]],["(\\d{3})(\\d{6,7})","$1 $2",["2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:2[2-8]|3[27-9]|4[2-6]|6[3569]|9[25-8])","9(?:2[3-8]|98)|(?:2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:22|3[27-9]|4[2-6]|6[3569]|9[25-7]))[2-9]"],"(0$1)"],["(\\d{2})(\\d{7,8})","$1 $2",["(?:2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91)[2-9]"],"(0$1)"],["(\\d{5})(\\d{5})","$1 $2",["58"],"(0$1)"],["(\\d{3})(\\d{7})","$1 $2",["3"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[24-9]"],"(0$1)"]],"0"],PL:["48","00","(?:6|8\\d\\d)\\d{7}|[1-9]\\d{6}(?:\\d{2})?|[26]\\d{5}",[6,7,8,9,10],[["(\\d{5})","$1",["19"]],["(\\d{3})(\\d{3})","$1 $2",["11|20|64"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])1","(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])19"]],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["64"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["21|39|45|5[0137]|6[0469]|7[02389]|8(?:0[14]|8)"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[2-8]|[2-7]|8[1-79]|9[145]"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["8"]]]],PM:["508","00","[45]\\d{5}|(?:708|80\\d)\\d{6}",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[45]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["7"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],PR:["1","011","(?:[589]\\d\\d|787)\\d{7}",[10],0,"1",0,0,0,0,"787|939"],PS:["970","00","[2489]2\\d{6}|(?:1\\d|5)\\d{8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2489]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["5"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],PT:["351","00","1693\\d{5}|(?:[26-9]\\d|30)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["2[12]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["16|[236-9]"]]]],PW:["680","01[12]","(?:[24-8]\\d\\d|345|900)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],PY:["595","00","59\\d{4,6}|9\\d{5,10}|(?:[2-46-8]\\d|5[0-8])\\d{4,7}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3,6})","$1 $2",["[2-9]0"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["[26]1|3[289]|4[1246-8]|7[1-3]|8[1-36]"],"(0$1)"],["(\\d{3})(\\d{4,5})","$1 $2",["2[279]|3[13-5]|4[359]|5|6(?:[34]|7[1-46-8])|7[46-8]|85"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2[14-68]|3[26-9]|4[1246-8]|6(?:1|75)|7[1-35]|8[1-36]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["87"]],["(\\d{3})(\\d{6})","$1 $2",["9(?:[5-79]|8[1-6])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["9"]]],"0"],QA:["974","00","800\\d{4}|(?:2|800)\\d{6}|(?:0080|[3-7])\\d{7}",[7,8,9,11],[["(\\d{3})(\\d{4})","$1 $2",["2[16]|8"]],["(\\d{4})(\\d{4})","$1 $2",["[3-7]"]]]],RE:["262","00","(?:26|[689]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2689]"],"0$1"]],"0",0,0,0,0,0,[["26(?:2\\d\\d|3(?:0\\d|1[0-5]))\\d{4}"],["69(?:2\\d\\d|3(?:[06][0-6]|1[013]|2[0-2]|3[0-39]|4\\d|5[0-5]|7[0-27]|8[0-8]|9[0-479]))\\d{4}"],["80\\d{7}"],["89[1-37-9]\\d{6}"],0,0,0,0,["9(?:399[0-3]|479[0-5]|76(?:2[27]|3[0-37]))\\d{4}"],["8(?:1[019]|2[0156]|84|90)\\d{6}"]]],RO:["40","00","(?:[2378]\\d|90)\\d{7}|[23]\\d{5}",[6,9],[["(\\d{3})(\\d{3})","$1 $2",["2[3-6]","2[3-6]\\d9"],"0$1"],["(\\d{2})(\\d{4})","$1 $2",["219|31"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[23]1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[237-9]"],"0$1"]],"0",0,0,0,0,0,0,0," int "],RS:["381","00","38[02-9]\\d{6,9}|6\\d{7,9}|90\\d{4,8}|38\\d{5,6}|(?:7\\d\\d|800)\\d{3,9}|(?:[12]\\d|3[0-79])\\d{5,10}",[6,7,8,9,10,11,12],[["(\\d{3})(\\d{3,9})","$1 $2",["(?:2[389]|39)0|[7-9]"],"0$1"],["(\\d{2})(\\d{5,10})","$1 $2",["[1-36]"],"0$1"]],"0"],RU:["7","810","8\\d{13}|[347-9]\\d{9}",[10,14],[["(\\d{4})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-8]|2[1-9])","7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:1[23]|[2-9]2))","7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:13[03-69]|62[013-9]))|72[1-57-9]2"],"8 ($1)",1],["(\\d{5})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-68]|2[1-9])","7(?:1(?:[06][3-6]|[18]|2[35]|[3-5][3-5])|2(?:[13][3-5]|[24-689]|7[457]))","7(?:1(?:0(?:[356]|4[023])|[18]|2(?:3[013-9]|5)|3[45]|43[013-79]|5(?:3[1-8]|4[1-7]|5)|6(?:3[0-35-9]|[4-6]))|2(?:1(?:3[178]|[45])|[24-689]|3[35]|7[457]))|7(?:14|23)4[0-8]|71(?:33|45)[1-79]"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[349]|8(?:[02-7]|1[1-8])"],"8 ($1)",1],["(\\d{4})(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3 $4",["8"],"8 ($1)"]],"8",0,0,0,0,"3[04-689]|[489]",0,"8~10"],RW:["250","00","(?:06|[27]\\d\\d|[89]00)\\d{6}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[7-9]"],"0$1"]],"0"],SA:["966","00","92\\d{7}|(?:[15]|8\\d)\\d{8}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["9"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["81"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]],"0"],SB:["677","0[01]","(?:[1-6]|[7-9]\\d\\d)\\d{4}",[5,7],[["(\\d{2})(\\d{5})","$1 $2",["7|8[4-9]|9(?:[1-8]|9[0-8])"]]]],SC:["248","010|0[0-2]","800\\d{4}|(?:[249]\\d|64)\\d{5}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[246]|9[57]"]]],0,0,0,0,0,0,0,"00"],SD:["249","00","[19]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[19]"],"0$1"]],"0"],SE:["46","00","(?:[26]\\d\\d|9)\\d{9}|[1-9]\\d{8}|[1-689]\\d{7}|[1-4689]\\d{6}|2\\d{5}",[6,7,8,9,10],[["(\\d{2})(\\d{2,3})(\\d{2})","$1-$2 $3",["20"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{4})","$1-$2",["9(?:00|39|44|9)"],"0$1",0,"$1 $2"],["(\\d{2})(\\d{3})(\\d{2})","$1-$2 $3",["[12][136]|3[356]|4[0246]|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3"],["(\\d)(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2,3})(\\d{2})","$1-$2 $3",["1[2457]|2(?:[247-9]|5[0138])|3[0247-9]|4[1357-9]|5[0-35-9]|6(?:[125689]|4[02-57]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{2,3})(\\d{3})","$1-$2 $3",["9(?:00|39|44)"],"0$1",0,"$1 $2 $3"],["(\\d{2})(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["1[13689]|2[0136]|3[1356]|4[0246]|54|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3 $4"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["10|7"],"0$1",0,"$1 $2 $3 $4"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1-$2 $3 $4",["[13-5]|2(?:[247-9]|5[0138])|6(?:[124-689]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{3})","$1-$2 $3 $4",["9"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4 $5",["[26]"],"0$1",0,"$1 $2 $3 $4 $5"]],"0"],SG:["65","0[0-3]\\d","(?:(?:1\\d|8)\\d\\d|7000)\\d{7}|[3689]\\d{7}",[8,10,11],[["(\\d{4})(\\d{4})","$1 $2",["[369]|8(?:0[1-8]|[1-9])"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]],["(\\d{4})(\\d{4})(\\d{3})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]]],SH:["290","00","(?:[256]\\d|8)\\d{3}",[4,5],0,0,0,0,0,0,"[256]"],SI:["386","00|10(?:22|66|88|99)","[1-7]\\d{7}|8\\d{4,7}|90\\d{4,6}",[5,6,7,8],[["(\\d{2})(\\d{3,6})","$1 $2",["8[09]|9"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["59|8"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37][01]|4[0139]|51|6"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-57]"],"(0$1)"]],"0",0,0,0,0,0,0,"00"],SJ:["47","00","0\\d{4}|(?:[489]\\d|79)\\d{6}",[5,8],0,0,0,0,0,0,"79"],SK:["421","00","[2-689]\\d{8}|[2-59]\\d{6}|[2-5]\\d{5}",[6,7,9],[["(\\d)(\\d{2})(\\d{3,4})","$1 $2 $3",["21"],"0$1"],["(\\d{2})(\\d{2})(\\d{2,3})","$1 $2 $3",["[3-5][1-8]1","[3-5][1-8]1[67]"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1/$2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[689]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1/$2 $3 $4",["[3-5]"],"0$1"]],"0"],SL:["232","00","(?:[237-9]\\d|66)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[236-9]"],"(0$1)"]],"0"],SM:["378","00","(?:0549|[5-7]\\d)\\d{6}",[8,10],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-7]"]],["(\\d{4})(\\d{6})","$1 $2",["0"]]],0,0,"([89]\\d{5})$","0549$1"],SN:["221","00","(?:[378]\\d|93)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[379]"]]]],SO:["252","00","[346-9]\\d{8}|[12679]\\d{7}|[1-5]\\d{6}|[1348]\\d{5}",[6,7,8,9],[["(\\d{2})(\\d{4})","$1 $2",["8[125]"]],["(\\d{6})","$1",["[134]"]],["(\\d)(\\d{6})","$1 $2",["[15]|2[0-79]|3[0-46-8]|4[0-7]"]],["(\\d)(\\d{7})","$1 $2",["(?:2|90)4|[67]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[348]|64|79|90"]],["(\\d{2})(\\d{5,7})","$1 $2",["1|28|6[0-35-9]|77|9[2-9]"]]],"0"],SR:["597","00","(?:[2-5]|68|[78]\\d)\\d{5}",[6,7],[["(\\d{2})(\\d{2})(\\d{2})","$1-$2-$3",["56"]],["(\\d{3})(\\d{3})","$1-$2",["[2-5]"]],["(\\d{3})(\\d{4})","$1-$2",["[6-8]"]]]],SS:["211","00","[19]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[19]"],"0$1"]],"0"],ST:["239","00","(?:22|9\\d)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[29]"]]]],SV:["503","00","[267]\\d{7}|[89]00\\d{4}(?:\\d{4})?",[7,8,11],[["(\\d{3})(\\d{4})","$1 $2",["[89]"]],["(\\d{4})(\\d{4})","$1 $2",["[267]"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[89]"]]]],SX:["1","011","7215\\d{6}|(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"(5\\d{6})$|1","721$1",0,"721"],SY:["963","00","[1-39]\\d{8}|[1-5]\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-5]"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1",1]],"0"],SZ:["268","00","0800\\d{4}|(?:[237]\\d|900)\\d{6}",[8,9],[["(\\d{4})(\\d{4})","$1 $2",["[0237]"]],["(\\d{5})(\\d{4})","$1 $2",["9"]]]],TA:["290","00","8\\d{3}",[4],0,0,0,0,0,0,"8"],TC:["1","011","(?:[58]\\d\\d|649|900)\\d{7}",[10],0,"1",0,"([2-479]\\d{6})$|1","649$1",0,"649"],TD:["235","00|16","(?:22|[69]\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2679]"]]],0,0,0,0,0,0,0,"00"],TG:["228","00","[279]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[279]"]]]],TH:["66","00[1-9]","(?:001800|[2-57]|[689]\\d)\\d{7}|1\\d{7,9}",[8,9,10,13],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[13-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],TJ:["992","810","[0-57-9]\\d{8}",[9],[["(\\d{6})(\\d)(\\d{2})","$1 $2 $3",["331","3317"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["44[04]|[34]7"]],["(\\d{4})(\\d)(\\d{4})","$1 $2 $3",["3[1-5]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[0-57-9]"]]],0,0,0,0,0,0,0,"8~10"],TK:["690","00","[2-47]\\d{3,6}",[4,5,6,7]],TL:["670","00","7\\d{7}|(?:[2-47]\\d|[89]0)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[2-489]|70"]],["(\\d{4})(\\d{4})","$1 $2",["7"]]]],TM:["993","810","[1-6]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["12"],"(8 $1)"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-5]"],"(8 $1)"],["(\\d{2})(\\d{6})","$1 $2",["6"],"8 $1"]],"8",0,0,0,0,0,0,"8~10"],TN:["216","00","[2-57-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-57-9]"]]]],TO:["676","00","(?:0800|(?:[5-8]\\d\\d|999)\\d)\\d{3}|[2-8]\\d{4}",[5,7],[["(\\d{2})(\\d{3})","$1-$2",["[2-4]|50|6[09]|7[0-24-69]|8[05]"]],["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{3})(\\d{4})","$1 $2",["[5-9]"]]]],TR:["90","00","4\\d{6}|8\\d{11,12}|(?:[2-58]\\d\\d|900)\\d{7}",[7,10,12,13],[["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["512|8[01589]|90"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["5(?:[0-59]|61)","5(?:[0-59]|616)","5(?:[0-59]|6161)"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24][1-8]|3[1-9]"],"(0$1)",1],["(\\d{3})(\\d{3})(\\d{6,7})","$1 $2 $3",["80"],"0$1",1]],"0"],TT:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-46-8]\\d{6})$|1","868$1",0,"868"],TV:["688","00","(?:2|7\\d\\d|90)\\d{4}",[5,6,7],[["(\\d{2})(\\d{3})","$1 $2",["2"]],["(\\d{2})(\\d{4})","$1 $2",["90"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]]],TW:["886","0(?:0[25-79]|19)","[2-689]\\d{8}|7\\d{9,10}|[2-8]\\d{7}|2\\d{6}",[7,8,9,10,11],[["(\\d{2})(\\d)(\\d{4})","$1 $2 $3",["202"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[258]0"],"0$1"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["[23568]|4(?:0[02-48]|[1-47-9])|7[1-9]","[23568]|4(?:0[2-48]|[1-47-9])|(?:400|7)[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,5})","$1 $2 $3",["7"],"0$1"]],"0",0,0,0,0,0,0,0,"#"],TZ:["255","00[056]","(?:[25-8]\\d|41|90)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[24]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["5"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[67]"],"0$1"]],"0"],UA:["380","00","[89]\\d{9}|[3-9]\\d{8}",[9,10],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6[12][29]|(?:3[1-8]|4[136-8]|5[12457]|6[49])2|(?:56|65)[24]","6[12][29]|(?:35|4[1378]|5[12457]|6[49])2|(?:56|65)[24]|(?:3[1-46-8]|46)2[013-9]"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6[0135689]|7[4-6])|6(?:[12][3-7]|[459])","3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6(?:[015689]|3[02389])|7[4-6])|6(?:[12][3-7]|[459])"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3-7]|89|9[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0",0,0,0,0,0,0,"0~0"],UG:["256","00[057]","800\\d{6}|(?:[29]0|[347]\\d)\\d{7}",[9],[["(\\d{4})(\\d{5})","$1 $2",["202","2024"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[27-9]|4(?:6[45]|[7-9])"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[34]"],"0$1"]],"0"],US:["1","011","[2-9]\\d{9}|3\\d{6}",[10],[["(\\d{3})(\\d{4})","$1-$2",["310"],0,1],["(\\d{3})(\\d{3})(\\d{4})","($1) $2-$3",["[2-9]"],0,1,"$1-$2-$3"]],"1",0,0,0,0,0,[["5056(?:[0-35-9]\\d|4[46])\\d{4}|(?:4722|505[2-57-9]|983[29])\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-589]|3[149]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-57-9]|1[02-9]|2[01356]|3[0-24679]|4[167]|5[0-2]|6[014]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-47-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|[34][016]|5[01679]|6[0-279]|78|8[0-29])|7(?:0[1-46-8]|1[2-9]|2[04-7]|3[1247]|4[037]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[068]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-389]|8[04-69]))[2-9]\\d{6}"],[""],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}"]]],UY:["598","0(?:0|1[3-9]\\d)","(?:0004|4)\\d{9}|[1249]\\d{7}|(?:[49]\\d|80)\\d{5}",[7,8,10,13],[["(\\d{3})(\\d{4})","$1 $2",["405|8|90"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[124]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["4"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3 $4",["0"]]],"0",0,0,0,0,0,0,"00"," int. "],UZ:["998","810","200\\d{6}|(?:33|[5-79]\\d|88)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[235-9]"],"8 $1"]],"8",0,0,0,0,0,0,"8~10"],VA:["39","00","0\\d{5,10}|3[0-8]\\d{7,10}|55\\d{8}|8\\d{5}(?:\\d{2,4})?|(?:1\\d|39)\\d{7,8}",[6,7,8,9,10,11],0,0,0,0,0,0,"06698"],VC:["1","011","(?:[58]\\d\\d|784|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","784$1",0,"784"],VE:["58","00","[68]00\\d{7}|(?:[24]\\d|[59]0)\\d{8}",[10],[["(\\d{3})(\\d{7})","$1-$2",["[24-689]"],"0$1"]],"0"],VG:["1","011","(?:284|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-578]\\d{6})$|1","284$1",0,"284"],VI:["1","011","[58]\\d{9}|(?:34|90)0\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","340$1",0,"340"],VN:["84","00","[12]\\d{9}|[135-9]\\d{8}|[16]\\d{7}|[16-8]\\d{6}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["80"],"0$1",1],["(\\d{4})(\\d{4,6})","$1 $2",["1"],0,1],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["6"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[357-9]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["2[48]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["2"],"0$1",1]],"0"],VU:["678","00","[57-9]\\d{6}|(?:[238]\\d|48)\\d{3}",[5,7],[["(\\d{3})(\\d{4})","$1 $2",["[57-9]"]]]],WF:["681","00","(?:40|72)\\d{4}|8\\d{5}(?:\\d{3})?",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[478]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]]],WS:["685","0","(?:[2-6]|8\\d{5})\\d{4}|[78]\\d{6}|[68]\\d{5}",[5,6,7,10],[["(\\d{5})","$1",["[2-5]|6[1-9]"]],["(\\d{3})(\\d{3,7})","$1 $2",["[68]"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]]],XK:["383","00","[23]\\d{7,8}|(?:4\\d\\d|[89]00)\\d{5}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[23]"],"0$1"]],"0"],YE:["967","00","(?:1|7\\d)\\d{7}|[1-7]\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-6]|7(?:[24-6]|8[0-7])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["7"],"0$1"]],"0"],YT:["262","00","(?:80|9\\d)\\d{7}|(?:26|63)9\\d{6}",[9],0,"0",0,0,0,0,0,[["269(?:0[0-467]|5[0-4]|6\\d|[78]0)\\d{4}"],["639(?:0[0-79]|1[019]|[267]\\d|3[09]|40|5[05-9]|9[04-79])\\d{4}"],["80\\d{7}"],0,0,0,0,0,["9(?:(?:39|47)8[01]|769\\d)\\d{4}"]]],ZA:["27","00","[1-79]\\d{8}|8\\d{4,9}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,4})","$1 $2",["8[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["8[1-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["860"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0"],ZM:["260","00","800\\d{6}|(?:21|63|[79]\\d)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[28]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[79]"],"0$1"]],"0"],ZW:["263","00","2(?:[0-57-9]\\d{6,8}|6[0-24-9]\\d{6,7})|[38]\\d{9}|[35-8]\\d{8}|[3-6]\\d{7}|[1-689]\\d{6}|[1-3569]\\d{5}|[1356]\\d{4}",[5,6,7,8,9,10],[["(\\d{3})(\\d{3,5})","$1 $2",["2(?:0[45]|2[278]|[49]8)|3(?:[09]8|17)|6(?:[29]8|37|75)|[23][78]|(?:33|5[15]|6[68])[78]"],"0$1"],["(\\d)(\\d{3})(\\d{2,4})","$1 $2 $3",["[49]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["80"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["24|8[13-59]|(?:2[05-79]|39|5[45]|6[15-8])2","2(?:02[014]|4|[56]20|[79]2)|392|5(?:42|525)|6(?:[16-8]21|52[013])|8[13-59]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:1[39]|2[0157]|[378]|[56][14])|3(?:12|29)","2(?:1[39]|2[0157]|[378]|[56][14])|3(?:123|29)"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["1|2(?:0[0-36-9]|12|29|[56])|3(?:1[0-689]|[24-6])|5(?:[0236-9]|1[2-4])|6(?:[013-59]|7[0-46-9])|(?:33|55|6[68])[0-69]|(?:29|3[09]|62)[0-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["29[013-9]|39|54"],"0$1"],["(\\d{4})(\\d{3,5})","$1 $2",["(?:25|54)8","258|5483"],"0$1"]],"0"]},nonGeographic:{800:["800",0,"(?:00|[1-9]\\d)\\d{6}",[8],[["(\\d{4})(\\d{4})","$1 $2",["\\d"]]],0,0,0,0,0,0,[0,0,["(?:00|[1-9]\\d)\\d{6}"]]],808:["808",0,"[1-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[1-9]"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,0,["[1-9]\\d{7}"]]],870:["870",0,"7\\d{11}|[35-7]\\d{8}",[9,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[35-7]"]]],0,0,0,0,0,0,[0,["(?:[356]|774[45])\\d{8}|7[6-8]\\d{7}"]]],878:["878",0,"10\\d{10}",[12],[["(\\d{2})(\\d{5})(\\d{5})","$1 $2 $3",["1"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["10\\d{10}"]]],881:["881",0,"[0-36-9]\\d{8}",[9],[["(\\d)(\\d{3})(\\d{5})","$1 $2 $3",["[0-36-9]"]]],0,0,0,0,0,0,[0,["[0-36-9]\\d{8}"]]],882:["882",0,"[13]\\d{6}(?:\\d{2,5})?|[19]\\d{7}|(?:[25]\\d\\d|4)\\d{7}(?:\\d{2})?",[7,8,9,10,11,12],[["(\\d{2})(\\d{5})","$1 $2",["16|342"]],["(\\d{2})(\\d{6})","$1 $2",["49"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["1[36]|9"]],["(\\d{2})(\\d{4})(\\d{3})","$1 $2 $3",["3[23]"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["16"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["10|23|3(?:[15]|4[57])|4|51"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["34"]],["(\\d{2})(\\d{4,5})(\\d{5})","$1 $2 $3",["[1-35]"]]],0,0,0,0,0,0,[0,["342\\d{4}|(?:337|49)\\d{6}|(?:3(?:2|47|7\\d{3})|50\\d{3})\\d{7}",[7,8,9,10,12]],0,0,0,0,0,0,["1(?:3(?:0[0347]|[13][0139]|2[035]|4[013568]|6[0459]|7[06]|8[15-8]|9[0689])\\d{4}|6\\d{5,10})|(?:345\\d|9[89])\\d{6}|(?:10|2(?:3|85\\d)|3(?:[15]|[69]\\d\\d)|4[15-8]|51)\\d{8}"]]],883:["883",0,"(?:[1-4]\\d|51)\\d{6,10}",[8,9,10,11,12],[["(\\d{3})(\\d{3})(\\d{2,8})","$1 $2 $3",["[14]|2[24-689]|3[02-689]|51[24-9]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["510"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["21"]],["(\\d{4})(\\d{4})(\\d{4})","$1 $2 $3",["51[13]"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[235]"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["(?:2(?:00\\d\\d|10)|(?:370[1-9]|51\\d0)\\d)\\d{7}|51(?:00\\d{5}|[24-9]0\\d{4,7})|(?:1[013-79]|2[24-689]|3[02-689]|4[0-4])0\\d{5,9}"]]],888:["888",0,"\\d{11}",[11],[["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3"]],0,0,0,0,0,0,[0,0,0,0,0,0,["\\d{11}"]]],979:["979",0,"[1359]\\d{8}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[1359]"]]],0,0,0,0,0,0,[0,0,0,["[1359]\\d{8}"]]]}};function hr(e,t){var r=Array.prototype.slice.call(t);return r.push(ur),e.apply(this,r)}function pr(e){return(pr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function yr(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function mr(e){var t="function"==typeof Map?new Map:void 0;return(mr=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return fr(e,arguments,wr(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),vr(r,e)})(e)}function fr(e,t,r){return(fr=gr()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&vr(i,r.prototype),i}).apply(null,arguments)}function gr(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function vr(e,t){return(vr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function wr(e){return(wr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var xr=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&vr(e,t)}(n,mr(Error));var t,r=(t=gr(),function(){var e=wr(n);return function(e,t){if(t&&("object"===pr(t)||"function"==typeof t))return t;if(void 0!==t)throw TypeError("Derived constructors may only return object or undefined");return yr(e)}(this,t?Reflect.construct(e,arguments,wr(this).constructor):e.apply(this,arguments))});function n(e){var t;return function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,n),Object.setPrototypeOf(yr(t=r.call(this,e)),n.prototype),t.name=t.constructor.name,t}return Object.defineProperty(n,"prototype",{writable:!1}),n}(),Cr="0-90-9٠-٩۰-۹",Er="".concat("-‐-―−ー-").concat("//").concat("..").concat(" ").concat("()()[]\\[\\]").concat("~⁓∼~");function br(e,t){e=e.split("-"),t=t.split("-");for(var r=e[0].split("."),n=t[0].split("."),i=0;i<3;i++){var a=Number(r[i]),o=Number(n[i]);if(a>o)return 1;if(o>a)return-1;if(!isNaN(a)&&isNaN(o))return 1;if(isNaN(a)&&!isNaN(o))return-1}return e[1]&&t[1]?e[1]>t[1]?1:e[1]<t[1]?-1:0:!e[1]&&t[1]?1:e[1]&&!t[1]?-1:0}function Sr(e){return(Sr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ar(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function jr(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var $r=" ext. ",Tr=/^\d+$/,Pr=function(){function e(t){Ar(this,e),function(e){if(!e)throw Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!Or(e)||!Or(e.countries))throw Error("[libphonenumber-js] `metadata` argument was passed but it's not a valid metadata. Must be an object having `.countries` child object property. Got ".concat(Or(e)?"an object of shape: { "+Object.keys(e).join(", ")+" }":"a "+Rr(e)+": "+e,"."))}(t),this.metadata=t,Lr.call(this,t)}return jr(e,[{key:"getCountries",value:function(){return Object.keys(this.metadata.countries).filter((function(e){return"001"!==e}))}},{key:"getCountryMetadata",value:function(e){return this.metadata.countries[e]}},{key:"nonGeographic",value:function(){if(!(this.v1||this.v2||this.v3))return this.metadata.nonGeographic||this.metadata.nonGeographical}},{key:"hasCountry",value:function(e){return void 0!==this.getCountryMetadata(e)}},{key:"hasCallingCode",value:function(e){if(this.getCountryCodesForCallingCode(e))return!0;if(this.nonGeographic()){if(this.nonGeographic()[e])return!0}else{var t=this.countryCallingCodes()[e];if(t&&1===t.length&&"001"===t[0])return!0}}},{key:"isNonGeographicCallingCode",value:function(e){return this.nonGeographic()?!!this.nonGeographic()[e]:!this.getCountryCodesForCallingCode(e)}},{key:"country",value:function(e){return this.selectNumberingPlan(e)}},{key:"selectNumberingPlan",value:function(e,t){if(e&&Tr.test(e)&&(t=e,e=null),e&&"001"!==e){if(!this.hasCountry(e))throw Error("Unknown country: ".concat(e));this.numberingPlan=new _r(this.getCountryMetadata(e),this)}else if(t){if(!this.hasCallingCode(t))throw Error("Unknown calling code: ".concat(t));this.numberingPlan=new _r(this.getNumberingPlanMetadata(t),this)}else this.numberingPlan=void 0;return this}},{key:"getCountryCodesForCallingCode",value:function(e){var t=this.countryCallingCodes()[e];if(t){if(1===t.length&&3===t[0].length)return;return t}}},{key:"getCountryCodeForCallingCode",value:function(e){var t=this.getCountryCodesForCallingCode(e);if(t)return t[0]}},{key:"getNumberingPlanMetadata",value:function(e){var t=this.getCountryCodeForCallingCode(e);if(t)return this.getCountryMetadata(t);if(this.nonGeographic()){var r=this.nonGeographic()[e];if(r)return r}else{var n=this.countryCallingCodes()[e];if(n&&1===n.length&&"001"===n[0])return this.metadata.countries["001"]}}},{key:"countryCallingCode",value:function(){return this.numberingPlan.callingCode()}},{key:"IDDPrefix",value:function(){return this.numberingPlan.IDDPrefix()}},{key:"defaultIDDPrefix",value:function(){return this.numberingPlan.defaultIDDPrefix()}},{key:"nationalNumberPattern",value:function(){return this.numberingPlan.nationalNumberPattern()}},{key:"possibleLengths",value:function(){return this.numberingPlan.possibleLengths()}},{key:"formats",value:function(){return this.numberingPlan.formats()}},{key:"nationalPrefixForParsing",value:function(){return this.numberingPlan.nationalPrefixForParsing()}},{key:"nationalPrefixTransformRule",value:function(){return this.numberingPlan.nationalPrefixTransformRule()}},{key:"leadingDigits",value:function(){return this.numberingPlan.leadingDigits()}},{key:"hasTypes",value:function(){return this.numberingPlan.hasTypes()}},{key:"type",value:function(e){return this.numberingPlan.type(e)}},{key:"ext",value:function(){return this.numberingPlan.ext()}},{key:"countryCallingCodes",value:function(){return this.v1?this.metadata.country_phone_code_to_countries:this.metadata.country_calling_codes}},{key:"chooseCountryByCountryCallingCode",value:function(e){return this.selectNumberingPlan(e)}},{key:"hasSelectedNumberingPlan",value:function(){return void 0!==this.numberingPlan}}]),e}(),_r=function(){function e(t,r){Ar(this,e),this.globalMetadataObject=r,this.metadata=t,Lr.call(this,r.metadata)}return jr(e,[{key:"callingCode",value:function(){return this.metadata[0]}},{key:"getDefaultCountryMetadataForRegion",value:function(){return this.globalMetadataObject.getNumberingPlanMetadata(this.callingCode())}},{key:"IDDPrefix",value:function(){if(!this.v1&&!this.v2)return this.metadata[1]}},{key:"defaultIDDPrefix",value:function(){if(!this.v1&&!this.v2)return this.metadata[12]}},{key:"nationalNumberPattern",value:function(){return this.v1||this.v2?this.metadata[1]:this.metadata[2]}},{key:"possibleLengths",value:function(){if(!this.v1)return this.metadata[this.v2?2:3]}},{key:"_getFormats",value:function(e){return e[this.v1?2:this.v2?3:4]}},{key:"formats",value:function(){var e=this;return(this._getFormats(this.metadata)||this._getFormats(this.getDefaultCountryMetadataForRegion())||[]).map((function(t){return new kr(t,e)}))}},{key:"nationalPrefix",value:function(){return this.metadata[this.v1?3:this.v2?4:5]}},{key:"_getNationalPrefixFormattingRule",value:function(e){return e[this.v1?4:this.v2?5:6]}},{key:"nationalPrefixFormattingRule",value:function(){return this._getNationalPrefixFormattingRule(this.metadata)||this._getNationalPrefixFormattingRule(this.getDefaultCountryMetadataForRegion())}},{key:"_nationalPrefixForParsing",value:function(){return this.metadata[this.v1?5:this.v2?6:7]}},{key:"nationalPrefixForParsing",value:function(){return this._nationalPrefixForParsing()||this.nationalPrefix()}},{key:"nationalPrefixTransformRule",value:function(){return this.metadata[this.v1?6:this.v2?7:8]}},{key:"_getNationalPrefixIsOptionalWhenFormatting",value:function(){return!!this.metadata[this.v1?7:this.v2?8:9]}},{key:"nationalPrefixIsOptionalWhenFormattingInNationalFormat",value:function(){return this._getNationalPrefixIsOptionalWhenFormatting(this.metadata)||this._getNationalPrefixIsOptionalWhenFormatting(this.getDefaultCountryMetadataForRegion())}},{key:"leadingDigits",value:function(){return this.metadata[this.v1?8:this.v2?9:10]}},{key:"types",value:function(){return this.metadata[this.v1?9:this.v2?10:11]}},{key:"hasTypes",value:function(){return!(this.types()&&0===this.types().length||!this.types())}},{key:"type",value:function(e){if(this.hasTypes()&&Mr(this.types(),e))return new Ir(Mr(this.types(),e),this)}},{key:"ext",value:function(){return this.v1||this.v2?$r:this.metadata[13]||$r}}]),e}(),kr=function(){function e(t,r){Ar(this,e),this._format=t,this.metadata=r}return jr(e,[{key:"pattern",value:function(){return this._format[0]}},{key:"format",value:function(){return this._format[1]}},{key:"leadingDigitsPatterns",value:function(){return this._format[2]||[]}},{key:"nationalPrefixFormattingRule",value:function(){return this._format[3]||this.metadata.nationalPrefixFormattingRule()}},{key:"nationalPrefixIsOptionalWhenFormattingInNationalFormat",value:function(){return!!this._format[4]||this.metadata.nationalPrefixIsOptionalWhenFormattingInNationalFormat()}},{key:"nationalPrefixIsMandatoryWhenFormattingInNationalFormat",value:function(){return this.usesNationalPrefix()&&!this.nationalPrefixIsOptionalWhenFormattingInNationalFormat()}},{key:"usesNationalPrefix",value:function(){return!(!this.nationalPrefixFormattingRule()||Nr.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}]),e}(),Nr=/^\(?\$1\)?$/,Ir=function(){function e(t,r){Ar(this,e),this.type=t,this.metadata=r}return jr(e,[{key:"pattern",value:function(){return this.metadata.v1?this.type:this.type[0]}},{key:"possibleLengths",value:function(){if(!this.metadata.v1)return this.type[1]||this.metadata.possibleLengths()}}]),e}();function Mr(e,t){switch(t){case"FIXED_LINE":return e[0];case"MOBILE":return e[1];case"TOLL_FREE":return e[2];case"PREMIUM_RATE":return e[3];case"PERSONAL_NUMBER":return e[4];case"VOICEMAIL":return e[5];case"UAN":return e[6];case"PAGER":return e[7];case"VOIP":return e[8];case"SHARED_COST":return e[9]}}var Or=function(e){return"object"===Sr(e)},Rr=function(e){return Sr(e)};function Fr(e,t){if((t=new Pr(t)).hasCountry(e))return t.country(e).countryCallingCode();throw Error("Unknown country: ".concat(e))}function Lr(e){var t=e.version;"number"==typeof t?(this.v1=1===t,this.v2=2===t,this.v3=3===t,this.v4=4===t):t?-1===br(t,"1.2.0")?this.v2=!0:-1===br(t,"1.7.35")?this.v3=!0:this.v4=!0:this.v1=!0}var Ur=function(e){return"([".concat(Cr,"]{1,").concat(e,"})")};function Dr(e){var t="[ \\t,]*",r="[:\\..]?[ \\t,-]*",n="[ \\t]*";return";ext="+Ur("20")+"|"+t+"(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)"+r+Ur("20")+"#?|"+t+"(?:[xx##~~]|int|int)"+r+Ur("9")+"#?|[- ]+"+Ur("6")+"#|"+n+"(?:,{2}|;)"+r+Ur("15")+"#?|"+n+"(?:,)+"+r+Ur("9")+"#?"}var Wr=RegExp("^[++]{0,1}(?:["+Er+"]*["+Cr+"]){1,2}$","i"),Br="[++]{0,1}(?:["+Er+"]*["+Cr+"]){3,}["+Er+Cr+"]*(?:"+Dr()+")?",Hr=RegExp("^["+Cr+"]{2}$|^"+Br+"$","i"),Gr=RegExp("(?:"+Dr()+")$","i");function qr(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var zr={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9","0":"0","1":"1","2":"2","3":"3","4":"4","5":"5","6":"6","7":"7","8":"8","9":"9","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","۰":"0","۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9"};function Vr(e){for(var t,r="",n=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return qr(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return qr(e,void 0)}}(e))){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(e.split(""));!(t=n()).done;){var i=zr[t.value];i&&(r+=i)}return r}function Kr(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Yr(e){for(var t,r="",n=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return Kr(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Kr(e,void 0)}}(e))){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(e.split(""));!(t=n()).done;)r+=function(e,t){if("+"===e){if(t)return;return"+"}return zr[e]}(t.value,r)||"";return r}function Zr(e,t){return function(e,t,r){var n=r.type(t),i=n&&n.possibleLengths()||r.possibleLengths();if(!i)return"IS_POSSIBLE";var a=e.length,o=i[0];return o===a?"IS_POSSIBLE":o>a?"TOO_SHORT":i[i.length-1]<a?"TOO_LONG":i.indexOf(a,1)>=0?"IS_POSSIBLE":"INVALID_LENGTH"}(e,void 0,t)}function Xr(e,t){return"IS_POSSIBLE"===Zr(e,t)}function Jr(e,t){return e=e||"",RegExp("^(?:"+t+")$").test(e)}function Qr(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var en=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function tn(e,t,r){if(t=t||{},e.country){(r=new Pr(r)).selectNumberingPlan(e.country,e.countryCallingCode);var n=t.v2?e.nationalNumber:e.phone;if(Jr(n,r.nationalNumberPattern())){if(rn(n,"FIXED_LINE",r))return r.type("MOBILE")&&""===r.type("MOBILE").pattern()?"FIXED_LINE_OR_MOBILE":r.type("MOBILE")?rn(n,"MOBILE",r)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE":"FIXED_LINE_OR_MOBILE";for(var i,a=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return Qr(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Qr(e,void 0)}}(e))){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(en);!(i=a()).done;){var o=i.value;if(rn(n,o,r))return o}}}}function rn(e,t,r){return!(!(t=r.type(t))||!t.pattern())&&!(t.possibleLengths()&&0>t.possibleLengths().indexOf(e.length))&&Jr(e,t.pattern())}function nn(e){return e.replace(RegExp("[".concat(Er,"]+"),"g")," ").trim()}var an=/(\$\d)/;function on(e,t,r){var n=r.useInternationalFormat,i=r.withNationalPrefix;r.carrierCode,r.metadata;var a=e.replace(new RegExp(t.pattern()),n?t.internationalFormat():i&&t.nationalPrefixFormattingRule()?t.format().replace(an,t.nationalPrefixFormattingRule()):t.format());return n?nn(a):a}var sn=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function ln(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function dn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function cn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?dn(Object(r),!0).forEach((function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):dn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var un={formatExtension:function(e,t,r){return"".concat(e).concat(r.ext()).concat(t)}};function hn(e,t,r,n,i){var a=function(e,t){for(var r,n=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return ln(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ln(e,void 0)}}(e))){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(e);!(r=n()).done;){var i=r.value;if(i.leadingDigitsPatterns().length>0){var a=i.leadingDigitsPatterns()[i.leadingDigitsPatterns().length-1];if(0!==t.search(a))continue}if(Jr(t,i.pattern()))return i}}(n.formats(),e);return a?on(e,a,{useInternationalFormat:"INTERNATIONAL"===r,withNationalPrefix:!a.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!i||!1!==i.nationalPrefix,carrierCode:t,metadata:n}):e}function pn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function yn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?pn(Object(r),!0).forEach((function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):pn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var mn=function(){var e;function t(e,r,n){if(function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,t),!e)throw TypeError("`country` or `countryCallingCode` not passed");if(!r)throw TypeError("`nationalNumber` not passed");if(!n)throw TypeError("`metadata` not passed");var i,a,o,s=(o=new Pr(n),fn(e)?(i=e,o.selectNumberingPlan(i),a=o.countryCallingCode()):a=e,{country:i,countryCallingCode:a}),l=s.country,d=s.countryCallingCode;this.country=l,this.countryCallingCode=d,this.nationalNumber=r,this.number="+"+this.countryCallingCode+this.nationalNumber,this.getMetadata=function(){return n}}return e=[{key:"setExt",value:function(e){this.ext=e}},{key:"getPossibleCountries",value:function(){var e,t,r,n;return this.country?[this.country]:(e=this.countryCallingCode,t=this.nationalNumber,(n=new Pr(r=this.getMetadata()).getCountryCodesForCallingCode(e))?n.filter((function(e){var n;return(n=new Pr(r)).selectNumberingPlan(e),n.numberingPlan.possibleLengths().indexOf(t.length)>=0})):[])}},{key:"isPossible",value:function(){return function(e,t,r){if(void 0===t&&(t={}),r=new Pr(r),t.v2){if(!e.countryCallingCode)throw Error("Invalid phone number object passed");r.selectNumberingPlan(e.countryCallingCode)}else{if(!e.phone)return!1;if(e.country){if(!r.hasCountry(e.country))throw Error("Unknown country: ".concat(e.country));r.country(e.country)}else{if(!e.countryCallingCode)throw Error("Invalid phone number object passed");r.selectNumberingPlan(e.countryCallingCode)}}if(r.possibleLengths())return Xr(e.phone||e.nationalNumber,r);if(e.countryCallingCode&&r.isNonGeographicCallingCode(e.countryCallingCode))return!0;throw Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.')}(this,{v2:!0},this.getMetadata())}},{key:"isValid",value:function(){var e,t;return e={v2:!0},t=this.getMetadata(),e=e||{},(t=new Pr(t)).selectNumberingPlan(this.country,this.countryCallingCode),t.hasTypes()?void 0!==tn(this,e,t.metadata):Jr(e.v2?this.nationalNumber:this.phone,t.nationalNumberPattern())}},{key:"isNonGeographic",value:function(){return new Pr(this.getMetadata()).isNonGeographicCallingCode(this.countryCallingCode)}},{key:"isEqual",value:function(e){return this.number===e.number&&this.ext===e.ext}},{key:"getType",value:function(){return tn(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(e,t){return function(e,t,r,n){if(r=r?cn(cn({},un),r):un,n=new Pr(n),e.country&&"001"!==e.country){if(!n.hasCountry(e.country))throw Error("Unknown country: ".concat(e.country));n.country(e.country)}else{if(!e.countryCallingCode)return e.phone||"";n.selectNumberingPlan(e.countryCallingCode)}var i,a,o,s,l,d,c,u,h,p,y,m,f,g=n.countryCallingCode(),v=r.v2?e.nationalNumber:e.phone;switch(t){case"NATIONAL":return v?(i=f=hn(v,e.carrierCode,"NATIONAL",n,r),a=e.ext,o=n,s=r.formatExtension,a?s(i,a,o):i):"";case"INTERNATIONAL":return v?(f=hn(v,null,"INTERNATIONAL",n,r),l=f="+".concat(g," ").concat(f),d=e.ext,c=n,u=r.formatExtension,d?u(l,d,c):l):"+".concat(g);case"E.164":return"+".concat(g).concat(v);case"RFC3966":return function(e){var t=e.number,r=e.ext;if(!t)return"";if("+"!==t[0])throw Error('"formatRFC3966()" expects "number" to be in E.164 format.');return"tel:".concat(t).concat(r?";ext="+r:"")}({number:"+".concat(g).concat(v),ext:e.ext});case"IDD":if(!r.fromCountry)return;return h=function(e,t,r,n,i){if(Fr(n,i.metadata)===r){var a,o=hn(e,t,"NATIONAL",i);return"1"===r?r+" "+o:o}var s=(void 0,(a=new Pr(i.metadata)).selectNumberingPlan(n,undefined),a.defaultIDDPrefix()?a.defaultIDDPrefix():sn.test(a.IDDPrefix())?a.IDDPrefix():void 0);if(s)return"".concat(s," ").concat(r," ").concat(hn(e,null,"INTERNATIONAL",i))}(v,e.carrierCode,g,r.fromCountry,n),p=e.ext,y=n,m=r.formatExtension,p?m(h,p,y):h;default:throw Error('Unknown "format" argument passed to "formatNumber()": "'.concat(t,'"'))}}(this,e,t?yn(yn({},t),{},{v2:!0}):{v2:!0},this.getMetadata())}},{key:"formatNational",value:function(e){return this.format("NATIONAL",e)}},{key:"formatInternational",value:function(e){return this.format("INTERNATIONAL",e)}},{key:"getURI",value:function(e){return this.format("RFC3966",e)}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(),fn=function(e){return/^[A-Z]{2}$/.test(e)},gn=RegExp("(["+Cr+"])");function vn(e,t,r,n){if(t){var i=new Pr(n);i.selectNumberingPlan(t,r);var a=new RegExp(i.IDDPrefix());if(0===e.search(a)){var o=(e=e.slice(e.match(a)[0].length)).match(gn);if(!(o&&null!=o[1]&&o[1].length>0&&"0"===o[1]))return e}}}function wn(e,t){if(e&&t.numberingPlan.nationalPrefixForParsing()){var r=RegExp("^(?:"+t.numberingPlan.nationalPrefixForParsing()+")"),n=r.exec(e);if(n){var i,a,o,s=n.length-1,l=s>0&&n[s];if(t.nationalPrefixTransformRule()&&l)i=e.replace(r,t.nationalPrefixTransformRule()),s>1&&(a=n[1]);else{var d=n[0];i=e.slice(d.length),l&&(a=n[1])}if(l){var c=e.indexOf(n[1]);e.slice(0,c)===t.numberingPlan.nationalPrefix()&&(o=t.numberingPlan.nationalPrefix())}else o=n[0];return{nationalNumber:i,nationalPrefix:o,carrierCode:a}}}return{nationalNumber:e}}function xn(e,t){var r=wn(e,t),n=r.carrierCode,i=r.nationalNumber;return i!==e&&(Jr(e,t.nationalNumberPattern())&&!Jr(i,t.nationalNumberPattern())||t.possibleLengths()&&!function(e,t){switch(Zr(e,t)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}(i,t))?{nationalNumber:e}:{nationalNumber:i,carrierCode:n}}function Cn(e,t,r,n){var i=t?Fr(t,n):r;if(0===e.indexOf(i)){(n=new Pr(n)).selectNumberingPlan(t,r);var a=e.slice(i.length),o=xn(a,n).nationalNumber,s=xn(e,n).nationalNumber;if(!Jr(s,n.nationalNumberPattern())&&Jr(o,n.nationalNumberPattern())||"TOO_LONG"===Zr(s,n))return{countryCallingCode:i,number:a}}return{number:e}}function En(e,t,r,n){if(!e)return{};if("+"!==e[0]){var i,a=vn(e,t,r,n);if(!a||a===e){if(t||r){var o=Cn(e,t,r,n),s=o.countryCallingCode,l=o.number;if(s)return{countryCallingCodeSource:"FROM_NUMBER_WITHOUT_PLUS_SIGN",countryCallingCode:s,number:l}}return{number:e}}i=!0,e="+"+a}if("0"===e[1])return{};n=new Pr(n);for(var d=2;d-1<=3&&d<=e.length;){var c=e.slice(1,d);if(n.hasCallingCode(c))return n.selectNumberingPlan(c),{countryCallingCodeSource:i?"FROM_NUMBER_WITH_IDD":"FROM_NUMBER_WITH_PLUS_SIGN",countryCallingCode:c,number:e.slice(d)};d++}return{}}function bn(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Sn(e,t){var r=t.countries,n=t.defaultCountry,i=t.metadata;i=new Pr(i);for(var a,o=[],s=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return bn(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return bn(e,void 0)}}(e))){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(r);!(a=s()).done;){var l=a.value;if(i.country(l),i.leadingDigits()){if(e&&0===e.search(i.leadingDigits()))return l}else if(tn({phone:e,country:l},void 0,i.metadata)){if(!n||l===n)return l;o.push(l)}}if(o.length>0)return o[0]}function An(e,t){var r=t.nationalNumber,n=t.defaultCountry,i=t.metadata,a=i.getCountryCodesForCallingCode(e);return a?1===a.length?a[0]:Sn(r,{countries:a,defaultCountry:n,metadata:i.metadata}):void 0}var jn="(["+Cr+"]|[\\-\\.\\(\\)]?)",$n=RegExp("^\\+"+jn+"*["+Cr+"]"+jn+"*$","g"),Tn=RegExp("^(["+Cr+"]+((\\-)*["+Cr+"])*\\.)*[a-zA-Z]+((\\-)*["+Cr+"])*\\.?$","g"),Pn="tel:",_n=";phone-context=",kn=RegExp("[++"+Cr+"]"),Nn=RegExp("[^"+Cr+"#]+$");function In(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Mn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?In(Object(r),!0).forEach((function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):In(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function On(e){return(On="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Rn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Fn(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Ln(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Un(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ln(Object(r),!0).forEach((function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ln(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Dn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Wn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Dn(Object(r),!0).forEach((function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Dn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Bn(){var e=function(e){var t,r,n,i=function(e){if(Array.isArray(e))return e}(t=Array.prototype.slice.call(e))||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,a=[],o=!0,s=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(a.push(n.value),4!==a.length);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==r.return||r.return()}finally{if(s)throw i}}return a}}(t)||function(e,t){if(e){if("string"==typeof e)return Fn(e,4);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Fn(e,4)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),a=i[0],o=i[1],s=i[2],l=i[3];if("string"!=typeof a)throw TypeError("A text for parsing must be a string.");if(o&&"string"!=typeof o){if("object"!==On(o))throw Error("Invalid second argument: ".concat(o));s?(r=o,n=s):n=o}else l?(r=s,n=l):(r=void 0,n=s),o&&(r=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Rn(Object(r),!0).forEach((function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Rn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({defaultCountry:o},r));return{text:a,options:r,metadata:n}}(arguments),t=e.text,r=e.options,n=e.metadata,i=function(e,t,r){var n;t&&t.defaultCountry&&(n=t.defaultCountry,!r.countries.hasOwnProperty(n))&&(t=Un(Un({},t),{},{defaultCountry:void 0}));try{return function(e,t,r){if(t=t||{},r=new Pr(r),t.defaultCountry&&!r.hasCountry(t.defaultCountry)){if(t.v2)throw new xr("INVALID_COUNTRY");throw Error("Unknown country: ".concat(t.defaultCountry))}var n,i=function(e,t,r){var n=function(e,t){var r,n=t.extractFormattedPhoneNumber,i=function(e){var t=e.indexOf(_n);if(t<0)return null;var r=t+15;if(r>=e.length)return"";var n=e.indexOf(";",r);return n>=0?e.substring(r,n):e.substring(r)}(e);if(null!==i&&(0===i.length||!$n.test(i)&&!Tn.test(i)))throw new xr("NOT_A_NUMBER");if(null===i)r=n(e)||"";else{r="","+"===i.charAt(0)&&(r+=i);var a,o=e.indexOf(Pn);a=o>=0?o+4:0;var s=e.indexOf(_n);r+=e.substring(a,s)}var l=r.indexOf(";isub=");if(l>0&&(r=r.substring(0,l)),""!==r)return r}(e,{extractFormattedPhoneNumber:function(e){return function(e,t,r){if(e){if(e.length>250){if(r)throw new xr("TOO_LONG");return}if(!1===t)return e;var n=e.search(kn);if(!(n<0))return e.slice(n).replace(Nn,"")}}(e,r,t)}});if(!n)return{};if(!(n.length>=2&&Hr.test(n)))return Wr.test(n)?{error:"TOO_SHORT"}:{};var i=function(e){var t=e.search(Gr);if(t<0)return{};for(var r=e.slice(0,t),n=e.match(Gr),i=1;i<n.length;){if(n[i])return{number:r,ext:n[i]};i++}}(n);return i.ext?i:{number:n}}(e,t.v2,t.extract),a=i.number,o=i.ext,s=i.error;if(!a){if(t.v2){if("TOO_SHORT"===s)throw new xr("TOO_SHORT");throw new xr("NOT_A_NUMBER")}return{}}var l=function(e,t,r,n){var i,a=En(Yr(e),t,r,n.metadata),o=a.countryCallingCodeSource,s=a.countryCallingCode,l=a.number;if(s)n.selectNumberingPlan(s);else{if(!l||!t&&!r)return{};n.selectNumberingPlan(t,r),t&&(i=t),s=r||Fr(t,n.metadata)}if(!l)return{countryCallingCodeSource:o,countryCallingCode:s};var d=xn(Yr(l),n),c=d.nationalNumber,u=d.carrierCode,h=An(s,{nationalNumber:c,defaultCountry:t,metadata:n});return h&&(i=h,"001"===h||n.country(i)),{country:i,countryCallingCode:s,countryCallingCodeSource:o,nationalNumber:c,carrierCode:u}}(a,t.defaultCountry,t.defaultCallingCode,r),d=l.country,c=l.nationalNumber,u=l.countryCallingCode,h=l.countryCallingCodeSource,p=l.carrierCode;if(!r.hasSelectedNumberingPlan()){if(t.v2)throw new xr("INVALID_COUNTRY");return{}}if(!c||c.length<2){if(t.v2)throw new xr("TOO_SHORT");return{}}if(c.length>17){if(t.v2)throw new xr("TOO_LONG");return{}}if(t.v2){var y=new mn(u,c,r.metadata);return d&&(y.country=d),p&&(y.carrierCode=p),o&&(y.ext=o),y.__countryCallingCodeSource=h,y}var m=!!(t.extended?r.hasSelectedNumberingPlan():d)&&Jr(c,r.nationalNumberPattern());return t.extended?{country:d,countryCallingCode:u,carrierCode:p,valid:m,possible:!!m||!(!0!==t.extended||!r.possibleLengths()||!Xr(c,r)),phone:c,ext:o}:m?(n={country:d,phone:c},o&&(n.ext=o),n):{}}(e,Mn(Mn({},t),{},{v2:!0}),r)}catch(e){if(!(e instanceof xr))throw e}}(t,r=Wn(Wn({},r),{},{extract:!1}),n);return i&&i.isPossible()||!1}var Hn=function(){var e;function t(e){var r=e.onCountryChange,n=e.onCallingCodeChange;!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,t),this.onCountryChange=r,this.onCallingCodeChange=n}return e=[{key:"reset",value:function(e){var t=e.country,r=e.callingCode;this.international=!1,this.missingPlus=!1,this.IDDPrefix=void 0,this.callingCode=void 0,this.digits="",this.resetNationalSignificantNumber(),this.initCountryAndCallingCode(t,r)}},{key:"resetNationalSignificantNumber",value:function(){this.nationalSignificantNumber=this.getNationalDigits(),this.nationalSignificantNumberMatchesInput=!0,this.nationalPrefix=void 0,this.carrierCode=void 0,this.complexPrefixBeforeNationalSignificantNumber=void 0}},{key:"update",value:function(e){for(var t=0,r=Object.keys(e);t<r.length;t++){var n=r[t];this[n]=e[n]}}},{key:"initCountryAndCallingCode",value:function(e,t){this.setCountry(e),this.setCallingCode(t)}},{key:"setCountry",value:function(e){this.country=e,this.onCountryChange(e)}},{key:"setCallingCode",value:function(e){this.callingCode=e,this.onCallingCodeChange(e,this.country)}},{key:"startInternationalNumber",value:function(e,t){this.international=!0,this.initCountryAndCallingCode(e,t)}},{key:"appendDigits",value:function(e){this.digits+=e}},{key:"appendNationalSignificantNumberDigits",value:function(e){this.nationalSignificantNumber+=e}},{key:"getNationalDigits",value:function(){return this.international?this.digits.slice((this.IDDPrefix?this.IDDPrefix.length:0)+(this.callingCode?this.callingCode.length:0)):this.digits}},{key:"getDigitsWithoutInternationalPrefix",value:function(){return this.international&&this.IDDPrefix?this.digits.slice(this.IDDPrefix.length):this.digits}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}();function Gn(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var qn=/x/;function zn(e,t){if(t<1)return"";for(var r="";t>1;)1&t&&(r+=e),t>>=1,e+=e;return r+e}function Vn(e,t){return")"===e[t]&&t++,function(e){for(var t=[],r=0;r<e.length;)"("===e[r]?t.push(r):")"===e[r]&&t.pop(),r++;var n=0,i="";t.push(e.length);for(var a=0;a<t.length;a++){var o=t[a];i+=e.slice(n,o),n=o+1}return i}(e.slice(0,t))}function Kn(e,t,r){var n=r.metadata,i=r.useNationalPrefixFormattingRule,a=r.getSeparatorAfterNationalPrefix,o=on(e.nationalSignificantNumber,t,{carrierCode:e.carrierCode,useInternationalFormat:e.international,withNationalPrefix:i,metadata:n});if(i||(e.nationalPrefix?o=e.nationalPrefix+a(t)+o:e.complexPrefixBeforeNationalSignificantNumber&&(o=e.complexPrefixBeforeNationalSignificantNumber+" "+o)),Vr(o)===e.getNationalDigits())return o}var Yn=function(){var e;function t(){!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,t)}return e=[{key:"parse",value:function(e){if(this.context=[{or:!0,instructions:[]}],this.parsePattern(e),1!==this.context.length)throw Error("Non-finalized contexts left when pattern parse ended");var t=this.context[0],r=t.branches,n=t.instructions;if(r)return{op:"|",args:r.concat([Jn(n)])};if(0===n.length)throw Error("Pattern is required");return 1===n.length?n[0]:n}},{key:"startContext",value:function(e){this.context.push(e)}},{key:"endContext",value:function(){this.context.pop()}},{key:"getContext",value:function(){return this.context[this.context.length-1]}},{key:"parsePattern",value:function(e){if(!e)throw Error("Pattern is required");var t=e.match(Xn);if(t){var r=t[1],n=e.slice(0,t.index),i=e.slice(t.index+r.length);switch(r){case"(?:":n&&this.parsePattern(n),this.startContext({or:!0,instructions:[],branches:[]});break;case")":if(!this.getContext().or)throw Error('")" operator must be preceded by "(?:" operator');if(n&&this.parsePattern(n),0===this.getContext().instructions.length)throw Error('No instructions found after "|" operator in an "or" group');var a=this.getContext().branches;a.push(Jn(this.getContext().instructions)),this.endContext(),this.getContext().instructions.push({op:"|",args:a});break;case"|":if(!this.getContext().or)throw Error('"|" operator can only be used inside "or" groups');if(n&&this.parsePattern(n),!this.getContext().branches){if(1!==this.context.length)throw Error('"branches" not found in an "or" group context');this.getContext().branches=[]}this.getContext().branches.push(Jn(this.getContext().instructions)),this.getContext().instructions=[];break;case"[":n&&this.parsePattern(n),this.startContext({oneOfSet:!0});break;case"]":if(!this.getContext().oneOfSet)throw Error('"]" operator must be preceded by "[" operator');this.endContext(),this.getContext().instructions.push({op:"[]",args:function(e){for(var t=[],r=0;r<e.length;){if("-"===e[r]){if(0===r||r===e.length-1)throw Error("Couldn't parse a one-of set pattern: ".concat(e));for(var n=e[r-1].charCodeAt(0)+1,i=e[r+1].charCodeAt(0)-1,a=n;a<=i;)t.push(String.fromCharCode(a)),a++}else t.push(e[r]);r++}return t}(n)});break;default:throw Error("Unknown operator: ".concat(r))}i&&this.parsePattern(i)}else{if(Zn.test(e))throw Error("Illegal characters found in a pattern: ".concat(e));this.getContext().instructions=this.getContext().instructions.concat(e.split(""))}}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(),Zn=/[\(\)\[\]\?\:\|]/,Xn=RegExp("(\\||\\(\\?\\:|\\)|\\[|\\])");function Jn(e){return 1===e.length?e[0]:e}function Qn(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return ei(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ei(e,void 0)}}(e))||t){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ei(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var ti=function(){var e;function t(e){!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,t),this.matchTree=(new Yn).parse(e)}return e=[{key:"match",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).allowOverflow;if(!e)throw Error("String is required");var r=function e(t,r,n){if("string"==typeof r){var i=t.join("");return 0===r.indexOf(i)?t.length===r.length?{match:!0,matchedChars:t}:{partialMatch:!0}:0===i.indexOf(r)?n&&t.length>r.length?{overflow:!0}:{match:!0,matchedChars:t.slice(0,r.length)}:void 0}if(Array.isArray(r)){for(var a=t.slice(),o=0;o<r.length;){var s=e(a,r[o],n&&o===r.length-1);if(!s)return;if(s.overflow)return s;if(!s.match){if(s.partialMatch)return{partialMatch:!0};throw Error("Unsupported match result:\n".concat(JSON.stringify(s,null,2)))}if(0===(a=a.slice(s.matchedChars.length)).length)return o===r.length-1?{match:!0,matchedChars:t}:{partialMatch:!0};o++}return n?{overflow:!0}:{match:!0,matchedChars:t.slice(0,t.length-a.length)}}switch(r.op){case"|":for(var l,d,c=Qn(r.args);!(d=c()).done;){var u=e(t,d.value,n);if(u){if(u.overflow)return u;if(u.match)return{match:!0,matchedChars:u.matchedChars};if(!u.partialMatch)throw Error("Unsupported match result:\n".concat(JSON.stringify(u,null,2)));l=!0}}return l?{partialMatch:!0}:void 0;case"[]":for(var h,p=Qn(r.args);!(h=p()).done;){var y=h.value;if(t[0]===y)return 1===t.length?{match:!0,matchedChars:t}:n?{overflow:!0}:{match:!0,matchedChars:[y]}}return;default:throw Error("Unsupported instruction tree: ".concat(r))}}(e.split(""),this.matchTree,!0);if(r&&r.match&&delete r.matchedChars,!r||!r.overflow||t)return r}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}();function ri(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return ni(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ni(e,void 0)}}(e))||t){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ni(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var ii=zn("9",15),ai=/[- ]/,oi=RegExp("["+Er+"]*\\$1["+Er+"]*(\\$\\d["+Er+"]*)*$"),si=function(){var e;function t(e){e.state;var r=e.metadata;!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,t),this.metadata=r,this.resetFormat()}return e=[{key:"resetFormat",value:function(){this.chosenFormat=void 0,this.template=void 0,this.nationalNumberTemplate=void 0,this.populatedNationalNumberTemplate=void 0,this.populatedNationalNumberTemplatePosition=-1}},{key:"reset",value:function(e,t){this.resetFormat(),e?(this.isNANP="1"===e.callingCode(),this.matchingFormats=e.formats(),t.nationalSignificantNumber&&this.narrowDownMatchingFormats(t)):(this.isNANP=void 0,this.matchingFormats=[])}},{key:"format",value:function(e,t){var r=this;if("IS_POSSIBLE"===Zr(t.nationalSignificantNumber,this.metadata))for(var n,i=ri(this.matchingFormats);!(n=i()).done;){var a=n.value,o=function(e,t,r){var n=r.metadata,i=r.shouldTryNationalPrefixFormattingRule,a=r.getSeparatorAfterNationalPrefix;if(new RegExp("^(?:".concat(t.pattern(),")$")).test(e.nationalSignificantNumber))return function(e,t,r){var n=r.metadata,i=r.shouldTryNationalPrefixFormattingRule,a=r.getSeparatorAfterNationalPrefix;if(e.nationalSignificantNumber,e.international,e.nationalPrefix,e.carrierCode,i(t)){var o=Kn(e,t,{useNationalPrefixFormattingRule:!0,getSeparatorAfterNationalPrefix:a,metadata:n});if(o)return o}return Kn(e,t,{useNationalPrefixFormattingRule:!1,getSeparatorAfterNationalPrefix:a,metadata:n})}(e,t,{metadata:n,shouldTryNationalPrefixFormattingRule:i,getSeparatorAfterNationalPrefix:a})}(t,a,{metadata:this.metadata,shouldTryNationalPrefixFormattingRule:function(e){return r.shouldTryNationalPrefixFormattingRule(e,{international:t.international,nationalPrefix:t.nationalPrefix})},getSeparatorAfterNationalPrefix:function(e){return r.getSeparatorAfterNationalPrefix(e)}});if(o)return this.resetFormat(),this.chosenFormat=a,this.setNationalNumberTemplate(o.replace(/\d/g,"x"),t),this.populatedNationalNumberTemplate=o,this.populatedNationalNumberTemplatePosition=this.template.lastIndexOf("x"),o}return this.formatNationalNumberWithNextDigits(e,t)}},{key:"formatNationalNumberWithNextDigits",value:function(e,t){var r=this.chosenFormat,n=this.chooseFormat(t);if(n)return n===r?this.formatNextNationalNumberDigits(e):this.formatNextNationalNumberDigits(t.getNationalDigits())}},{key:"narrowDownMatchingFormats",value:function(e){var t=this,r=e.nationalSignificantNumber,n=e.nationalPrefix,i=e.international,a=r.length-3;a<0&&(a=0),this.matchingFormats=this.matchingFormats.filter((function(e){return t.formatSuits(e,i,n)&&t.formatMatches(e,r,a)})),this.chosenFormat&&-1===this.matchingFormats.indexOf(this.chosenFormat)&&this.resetFormat()}},{key:"formatSuits",value:function(e,t,r){return!(r&&!e.usesNationalPrefix()&&!e.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!t&&!r&&e.nationalPrefixIsMandatoryWhenFormattingInNationalFormat())}},{key:"formatMatches",value:function(e,t,r){var n=e.leadingDigitsPatterns().length;if(0===n)return!0;r=Math.min(r,n-1);var i=e.leadingDigitsPatterns()[r];if(t.length<3)try{return void 0!==new ti(i).match(t,{allowOverflow:!0})}catch(e){return console.error(e),!0}return new RegExp("^(".concat(i,")")).test(t)}},{key:"getFormatFormat",value:function(e,t){return t?e.internationalFormat():e.format()}},{key:"chooseFormat",value:function(e){for(var t,r,n=ri(this.matchingFormats.slice());!(r=n()).done&&"break"!=(t=r.value,this.chosenFormat===t?"break":oi.test(this.getFormatFormat(t,e.international))?this.createTemplateForFormat(t,e)?(this.chosenFormat=t,"break"):(this.matchingFormats=this.matchingFormats.filter((function(e){return e!==t})),"continue"):"continue"););return this.chosenFormat||this.resetFormat(),this.chosenFormat}},{key:"createTemplateForFormat",value:function(e,t){if(!(e.pattern().indexOf("|")>=0)){var r=this.getTemplateForFormat(e,t);return r?(this.setNationalNumberTemplate(r,t),!0):void 0}}},{key:"getSeparatorAfterNationalPrefix",value:function(e){return this.isNANP||e&&e.nationalPrefixFormattingRule()&&ai.test(e.nationalPrefixFormattingRule())?" ":""}},{key:"getInternationalPrefixBeforeCountryCallingCode",value:function(e,t){var r=e.IDDPrefix,n=e.missingPlus;return r?t&&!1===t.spacing?r:r+" ":n?"":"+"}},{key:"getTemplate",value:function(e){if(this.template){for(var t=-1,r=0,n=e.international?this.getInternationalPrefixBeforeCountryCallingCode(e,{spacing:!1}):"";r<n.length+e.getDigitsWithoutInternationalPrefix().length;)t=this.template.indexOf("x",t+1),r++;return Vn(this.template,t+1)}}},{key:"setNationalNumberTemplate",value:function(e,t){this.nationalNumberTemplate=e,this.populatedNationalNumberTemplate=e,this.populatedNationalNumberTemplatePosition=-1,t.international?this.template=this.getInternationalPrefixBeforeCountryCallingCode(t).replace(/[\d\+]/g,"x")+zn("x",t.callingCode.length)+" "+e:this.template=e}},{key:"getTemplateForFormat",value:function(e,t){var r=t.nationalSignificantNumber,n=t.international,i=t.nationalPrefix,a=t.complexPrefixBeforeNationalSignificantNumber,o=e.pattern();o=o.replace(/\[([^\[\]])*\]/g,"\\d").replace(/\d(?=[^,}][^,}])/g,"\\d");var s=ii.match(o)[0];if(!(r.length>s.length)){var l=RegExp("^"+o+"$"),d=r.replace(/\d/g,"9");l.test(d)&&(s=d);var c,u=this.getFormatFormat(e,n);if(this.shouldTryNationalPrefixFormattingRule(e,{international:n,nationalPrefix:i})){var h=u.replace(an,e.nationalPrefixFormattingRule());if(Vr(e.nationalPrefixFormattingRule())===(i||"")+Vr("$1")&&(u=h,c=!0,i))for(var p=i.length;p>0;)u=u.replace(/\d/,"x"),p--}var y=s.replace(new RegExp(o),u).replace(/9/g,"x");return c||(a?y=zn("x",a.length)+" "+y:i&&(y=zn("x",i.length)+this.getSeparatorAfterNationalPrefix(e)+y)),n&&(y=nn(y)),y}}},{key:"formatNextNationalNumberDigits",value:function(e){var t=function(e,t,r){for(var n,i=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return Gn(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Gn(e,void 0)}}(e))){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(r.split(""));!(n=i()).done;){var a=n.value;if(0>e.slice(t+1).search(qn))return;t=e.search(qn),e=e.replace(qn,a)}return[e,t]}(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition,e);if(t)return this.populatedNationalNumberTemplate=t[0],this.populatedNationalNumberTemplatePosition=t[1],Vn(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition+1);this.resetFormat()}},{key:"shouldTryNationalPrefixFormattingRule",value:function(e,t){var r=t.international,n=t.nationalPrefix;if(e.nationalPrefixFormattingRule()){var i=e.usesNationalPrefix();if(i&&n||!i&&!r)return!0}}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}();function li(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,a=[],o=!0,s=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==r.return||r.return()}finally{if(s)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return di(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return di(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function di(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var ci=RegExp("^["+Er+Cr+"]+$","i"),ui="(?:[++]["+Er+Cr+"]*|["+Er+Cr+"]+)",hi=RegExp("[^"+Er+Cr+"]+.*$"),pi=/[^\d\[\]]/,yi=function(){var e;function t(e){var r=e.defaultCountry,n=e.defaultCallingCode,i=e.metadata,a=e.onNationalSignificantNumberChange;!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,t),this.defaultCountry=r,this.defaultCallingCode=n,this.metadata=i,this.onNationalSignificantNumberChange=a}return e=[{key:"input",value:function(e,t){var r,n,i,a,o,s=(i=(n=li("+"===(r=function(e){var t,r=e.search(ui);if(!(r<0))return"+"===(e=e.slice(r))[0]&&(t=!0,e=e.slice(1)),e=e.replace(hi,""),t&&(e="+"+e),e}(e)||"")[0]?[r.slice(1),!0]:[r],2))[0],a=n[1],ci.test(i)||(i=""),[i,a]),l=li(s,2),d=l[0],c=l[1],u=Vr(d);return c&&(t.digits||(t.startInternationalNumber(),u||(o=!0))),u&&this.inputDigits(u,t),{digits:u,justLeadingPlus:o}}},{key:"inputDigits",value:function(e,t){var r=t.digits,n=r.length<3&&r.length+e.length>=3;if(t.appendDigits(e),n&&this.extractIddPrefix(t),this.isWaitingForCountryCallingCode(t)){if(!this.extractCountryCallingCode(t))return}else t.appendNationalSignificantNumberDigits(e);t.international||this.hasExtractedNationalSignificantNumber||this.extractNationalSignificantNumber(t.getNationalDigits(),(function(e){return t.update(e)}))}},{key:"isWaitingForCountryCallingCode",value:function(e){var t=e.international,r=e.callingCode;return t&&!r}},{key:"extractCountryCallingCode",value:function(e){var t=En("+"+e.getDigitsWithoutInternationalPrefix(),this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),r=t.countryCallingCode,n=t.number;if(r)return e.setCallingCode(r),e.update({nationalSignificantNumber:n}),!0}},{key:"reset",value:function(e){if(e){this.hasSelectedNumberingPlan=!0;var t=e._nationalPrefixForParsing();this.couldPossiblyExtractAnotherNationalSignificantNumber=t&&pi.test(t)}else this.hasSelectedNumberingPlan=void 0,this.couldPossiblyExtractAnotherNationalSignificantNumber=void 0}},{key:"extractNationalSignificantNumber",value:function(e,t){if(this.hasSelectedNumberingPlan){var r=wn(e,this.metadata),n=r.nationalPrefix,i=r.nationalNumber,a=r.carrierCode;if(i!==e)return this.onExtractedNationalNumber(n,a,i,e,t),!0}}},{key:"extractAnotherNationalSignificantNumber",value:function(e,t,r){if(!this.hasExtractedNationalSignificantNumber)return this.extractNationalSignificantNumber(e,r);if(this.couldPossiblyExtractAnotherNationalSignificantNumber){var n=wn(e,this.metadata),i=n.nationalPrefix,a=n.nationalNumber,o=n.carrierCode;if(a!==t)return this.onExtractedNationalNumber(i,o,a,e,r),!0}}},{key:"onExtractedNationalNumber",value:function(e,t,r,n,i){var a,o,s=n.lastIndexOf(r);if(s>=0&&s===n.length-r.length){o=!0;var l=n.slice(0,s);l!==e&&(a=l)}i({nationalPrefix:e,carrierCode:t,nationalSignificantNumber:r,nationalSignificantNumberMatchesInput:o,complexPrefixBeforeNationalSignificantNumber:a}),this.hasExtractedNationalSignificantNumber=!0,this.onNationalSignificantNumberChange()}},{key:"reExtractNationalSignificantNumber",value:function(e){return!!this.extractAnotherNationalSignificantNumber(e.getNationalDigits(),e.nationalSignificantNumber,(function(t){return e.update(t)}))||(this.extractIddPrefix(e)||this.fixMissingPlus(e)?(this.extractCallingCodeAndNationalSignificantNumber(e),!0):void 0)}},{key:"extractIddPrefix",value:function(e){var t=e.international,r=e.IDDPrefix,n=e.digits;if(e.nationalSignificantNumber,!t&&!r){var i=vn(n,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata);return void 0!==i&&i!==n?(e.update({IDDPrefix:n.slice(0,n.length-i.length)}),this.startInternationalNumber(e,{country:void 0,callingCode:void 0}),!0):void 0}}},{key:"fixMissingPlus",value:function(e){if(!e.international){var t=Cn(e.digits,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),r=t.countryCallingCode;if(t.number,r)return e.update({missingPlus:!0}),this.startInternationalNumber(e,{country:e.country,callingCode:r}),!0}}},{key:"startInternationalNumber",value:function(e,t){var r=t.country,n=t.callingCode;e.startInternationalNumber(r,n),e.nationalSignificantNumber&&(e.resetNationalSignificantNumber(),this.onNationalSignificantNumberChange(),this.hasExtractedNationalSignificantNumber=void 0)}},{key:"extractCallingCodeAndNationalSignificantNumber",value:function(e){this.extractCountryCallingCode(e)&&this.extractNationalSignificantNumber(e.getNationalDigits(),(function(t){return e.update(t)}))}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}();function mi(e){return(mi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function fi(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var gi=function(){var e;function t(e,r){!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,t),this.metadata=new Pr(r);var n,i=function(e){if(Array.isArray(e))return e}(n=this.getCountryAndCallingCode(e))||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,a=[],o=!0,s=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(a.push(n.value),2!==a.length);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==r.return||r.return()}finally{if(s)throw i}}return a}}(n)||function(e,t){if(e){if("string"==typeof e)return fi(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return fi(e,2)}}(n)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),a=i[0],o=i[1];this.defaultCountry=a,this.defaultCallingCode=o,this.reset()}return e=[{key:"getCountryAndCallingCode",value:function(e){var t,r;return e&&("object"===mi(e)?(t=e.defaultCountry,r=e.defaultCallingCode):t=e),t&&!this.metadata.hasCountry(t)&&(t=void 0),[t,r]}},{key:"input",value:function(e){var t,r=this.parser.input(e,this.state),n=r.digits;if(r.justLeadingPlus)this.formattedOutput="+";else if(n){if(this.determineTheCountryIfNeeded(),this.state.nationalSignificantNumber&&this.formatter.narrowDownMatchingFormats(this.state),this.metadata.hasSelectedNumberingPlan()&&(t=this.formatter.format(n,this.state)),void 0===t&&this.parser.reExtractNationalSignificantNumber(this.state)){this.determineTheCountryIfNeeded();var i=this.state.getNationalDigits();i&&(t=this.formatter.format(i,this.state))}this.formattedOutput=t?this.getFullNumber(t):this.getNonFormattedNumber()}return this.formattedOutput}},{key:"reset",value:function(){var e=this;return this.state=new Hn({onCountryChange:function(t){e.country=t},onCallingCodeChange:function(t,r){e.metadata.selectNumberingPlan(r,t),e.formatter.reset(e.metadata.numberingPlan,e.state),e.parser.reset(e.metadata.numberingPlan)}}),this.formatter=new si({state:this.state,metadata:this.metadata}),this.parser=new yi({defaultCountry:this.defaultCountry,defaultCallingCode:this.defaultCallingCode,metadata:this.metadata,state:this.state,onNationalSignificantNumberChange:function(){e.determineTheCountryIfNeeded(),e.formatter.reset(e.metadata.numberingPlan,e.state)}}),this.state.reset({country:this.defaultCountry,callingCode:this.defaultCallingCode}),this.formattedOutput="",this}},{key:"isInternational",value:function(){return this.state.international}},{key:"getCallingCode",value:function(){if(this.isInternational())return this.state.callingCode}},{key:"getCountryCallingCode",value:function(){return this.getCallingCode()}},{key:"getCountry",value:function(){if(this.state.digits)return this._getCountry()}},{key:"_getCountry",value:function(){return this.state.country}},{key:"determineTheCountryIfNeeded",value:function(){this.state.country&&!this.isCountryCallingCodeAmbiguous()||this.determineTheCountry()}},{key:"getFullNumber",value:function(e){if(this.isInternational()){var t,r=this.state.callingCode;return t=r?e?"".concat(r," ").concat(e):r:"".concat(this.state.getDigitsWithoutInternationalPrefix()),this.formatter.getInternationalPrefixBeforeCountryCallingCode(this.state,{spacing:!!t})+t}return e}},{key:"getNonFormattedNationalNumberWithPrefix",value:function(){var e=this.state,t=e.nationalSignificantNumber,r=e.complexPrefixBeforeNationalSignificantNumber,n=e.nationalPrefix,i=t,a=r||n;return a&&(i=a+i),i}},{key:"getNonFormattedNumber",value:function(){var e=this.state.nationalSignificantNumberMatchesInput;return this.getFullNumber(e?this.getNonFormattedNationalNumberWithPrefix():this.state.getNationalDigits())}},{key:"getNonFormattedTemplate",value:function(){var e=this.getNonFormattedNumber();if(e)return e.replace(/[\+\d]/g,"x")}},{key:"isCountryCallingCodeAmbiguous",value:function(){var e=this.state.callingCode,t=this.metadata.getCountryCodesForCallingCode(e);return t&&t.length>1}},{key:"determineTheCountry",value:function(){this.state.setCountry(An(this.isInternational()?this.state.callingCode:this.defaultCallingCode,{nationalNumber:this.state.nationalSignificantNumber,defaultCountry:this.defaultCountry,metadata:this.metadata}))}},{key:"getNumberValue",value:function(){var e=this.state,t=e.digits,r=e.callingCode,n=e.country,i=e.nationalSignificantNumber;if(t)return this.isInternational()?r?"+"+r+i:"+"+t:n||r?"+"+(n?this.metadata.countryCallingCode():r)+i:void 0}},{key:"getNumber",value:function(){var e=this.state,t=e.nationalSignificantNumber,r=e.carrierCode,n=e.callingCode,i=this._getCountry();if(t&&(i||n)){if(i&&i===this.defaultCountry){var a=new Pr(this.metadata.metadata);a.selectNumberingPlan(i);var o=a.numberingPlan.callingCode(),s=this.metadata.getCountryCodesForCallingCode(o);if(s.length>1){var l=Sn(t,{countries:s,defaultCountry:this.defaultCountry,metadata:this.metadata.metadata});l&&(i=l)}}var d=new mn(i||n,t,this.metadata.metadata);return r&&(d.carrierCode=r),d}}},{key:"isPossible",value:function(){var e=this.getNumber();return!!e&&e.isPossible()}},{key:"isValid",value:function(){var e=this.getNumber();return!!e&&e.isValid()}},{key:"getNationalNumber",value:function(){return this.state.nationalSignificantNumber}},{key:"getChars",value:function(){return(this.state.international?"+":"")+this.state.digits}},{key:"getTemplate",value:function(){return this.formatter.getTemplate(this.state)||this.getNonFormattedTemplate()||""}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}();function vi(e){return new Pr(e).getCountries()}function wi(e,t,r){if(t[e])return new mn(e,t[e],r)}function xi(e){return gi.call(this,e,ur)}function Ci(){return hr(Fr,arguments)}xi.prototype=Object.create(gi.prototype,{}),xi.prototype.constructor=xi;let Ei=(e,t)=>function(){return hr(Bn,arguments)}(String(e),t),bi=(e,t)=>`+${Ci(t)} ${e}`,Si=e=>`*${e.replaceAll("-","").slice(-4)}`,Ai=function(){return hr(vi,arguments)}().map((e=>({code:e,callCode:Ci(e)})));const ji="/api/v1/sessions",$i="/api/v1/sessions/logout",Ti="/api/v1/sessions/fork/recover",Pi="/api/v1/oauth/init",_i="/api/v1/oauth/authenticate",ki="/api/v1/oauth/link",Ni="/api/v1/analytics_events";class Ii{async authenticate(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");try{let e=await this.api.post("/api/v1/custom_jwt_account/authenticate",{token:this.meta.token});return{user:e.user,token:e.token,refresh_token:e.refresh_token,identity_token:e.identity_token,is_new_user:e.is_new_user}}catch(e){throw o.formatApiError(e)}}async link(){throw Error("Unimplemented")}constructor(e){this.meta={token:e}}}class Mi{async authenticate(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new o.PrivyClientError("Email and email code must be set prior to calling authenticate.");try{let e=await this.api.post("/api/v1/passwordless/authenticate",{email:this.meta.email,code:this.meta.emailCode,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});return{user:e.user,token:e.token,refresh_token:e.refresh_token,identity_token:e.identity_token,is_new_user:e.is_new_user}}catch(e){throw o.formatApiError(e)}}async link(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new o.PrivyClientError("Email and email code must be set prior to calling authenticate.");try{return await this.api.post("/api/v1/passwordless/link",{email:this.meta.email,code:this.meta.emailCode})}catch(e){throw o.formatApiError(e)}}async sendCodeEmail(e,t){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(e&&(this.meta.email=e),t&&(this.meta.captchaToken=t),!this.meta.email)throw new o.PrivyClientError("Email must be set when initialzing authentication.");try{return await this.api.post("/api/v1/passwordless/init",{email:this.meta.email,token:this.meta.captchaToken})}catch(e){throw o.formatApiError(e)}}constructor(e,t,r=!1){this.meta={email:e,captchaToken:t,disableSignup:r}}}class Oi extends Mi{async link(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new o.PrivyClientError("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post("/api/v1/passwordless/update",{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(e){throw o.formatApiError(e)}}constructor(e,t,r){super(t,r),this.meta={email:t,captchaToken:r,oldAddress:e,disableSignup:!1}}}const Ri=e=>{let t;try{t=new URL(e).hostname}catch(e){return}for(let[e,r]of Object.entries(Fi))if(t.includes(r.hostname))return{walletClientType:e,entry:r}},Fi={metamask:{id:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",displayName:"MetaMask",hostname:"metamask.io",mobile:{native:"metamask://",universal:"https://metamask.app.link"}},trust:{id:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",displayName:"Trust",hostname:"trustwallet.com",mobile:{universal:"https://link.trustwallet.com"}},safe:{id:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",displayName:"Safe",hostname:"safe.global",mobile:{universal:"https://app.safe.global/"}},rainbow:{id:"1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",displayName:"Rainbow",hostname:"rainbow.me",mobile:{native:"rainbow://",universal:"https://rnbwapp.com"}},uniswap:{id:"c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a",displayName:"Uniswap",hostname:"uniswap.org",mobile:{universal:"https://uniswap.org/app",native:"uniswap://"}},zerion:{id:"ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18",displayName:"Zerion",hostname:"zerion.io",mobile:{native:"zerion://",universal:"https://wallet.zerion.io"}},argent:{id:"bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6",displayName:"Argent",hostname:"www.argent.xyz",mobile:{universal:"https://www.argent.xyz/app"}},spot:{id:"74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d",displayName:"Spot",hostname:"www.spot-wallet.com",mobile:{universal:"https://spot.so"}},omni:{id:"afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7",displayName:"Omni",hostname:"omni.app",mobile:{universal:"https://links.omni.app"}},cryptocom:{id:"f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d",displayName:"Crypto.com",hostname:"crypto.com",mobile:{universal:"https://wallet.crypto.com",native:"dfw://"}},blockchain:{id:"84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04",displayName:"Blockchain",hostname:"www.blockchain.com",mobile:{universal:"https://www.blockchain.com"}},safepal:{id:"0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150",displayName:"SafePal",hostname:"safepal.com",mobile:{universal:"https://link.safepal.io"}},bitkeep:{id:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",displayName:"BitKeep",hostname:"bitkeep.com",mobile:{universal:"https://bkapp.vip"}},zengo:{id:"9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0",displayName:"ZenGo",hostname:"zengo.com",mobile:{universal:"https://get.zengo.com/"}},"1inch":{id:"c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576",displayName:"1inch",hostname:"wallet.1inch.io",mobile:{universal:"https://wallet.1inch.io/wc/"}},binance:{id:"8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",displayName:"Binance",hostname:"www.binance.com",mobile:{universal:"https://app.binance.com/cedefi"}},exodus:{id:"e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4",displayName:"Exodus",hostname:"exodus.com",mobile:{universal:"https://exodus.com/m"}},mew_wallet:{id:"f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2",displayName:"MEW wallet",hostname:"mewwallet.com",mobile:{universal:"https://mewwallet.com"}},alphawallet:{id:"138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98",displayName:"AlphaWallet",hostname:"alphawallet.com",mobile:{universal:"https://aw.app"}},keyring_pro:{id:"47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83",displayName:"KEYRING PRO",hostname:"keyring.app",mobile:{universal:"https://keyring.app/"}},mathwallet:{id:"7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26",displayName:"MathWallet",hostname:"mathwallet.org",mobile:{universal:"https://www.mathwallet.org"}},unstoppable:{id:"8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3",displayName:"Unstoppable",hostname:"unstoppabledomains.com",mobile:{universal:"https://unstoppabledomains.com/mobile"}},obvious:{id:"031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa",displayName:"Obvious",hostname:"obvious.technology",mobile:{universal:"https://wallet.obvious.technology"}},ambire:{id:"2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568",displayName:"Ambire",hostname:"www.ambire.com",mobile:{universal:"https://mobile.ambire.com"}},internet_money_wallet:{id:"dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd",displayName:"Internet Money Wallet",hostname:"internetmoney.io",mobile:{universal:"https://internetmoney.io"}},coin98:{id:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",displayName:"Coin98",hostname:"coin98.com",mobile:{universal:"https://coin98.services"}},abc_wallet:{id:"b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f",displayName:"ABC Wallet",hostname:"myabcwallet.io",mobile:{universal:"https://abcwalletconnect.page.link"}},arculus_wallet:{id:"0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92",displayName:"Arculus Wallet",hostname:"www.getarculus.com",mobile:{universal:"https://gw.arculus.co/app"}},haha:{id:"719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3",displayName:"HaHa",hostname:"www.haha.me",mobile:{universal:"https://haha.me"}},cling_wallet:{id:"942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef",displayName:"Cling Wallet",hostname:"clingon.io",mobile:{universal:"https://cling.carrieverse.com/apple-app-site-association"}},broearn:{id:"8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2",displayName:"Broearn",hostname:"www.broearn.com",mobile:{universal:"https://www.broearn.com/link/wallet/"}},copiosa:{id:"07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80",displayName:"Copiosa",hostname:"copiosa.io",mobile:{universal:"https://copiosa.io/action/"}},burrito_wallet:{id:"8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819",displayName:"Burrito Wallet",hostname:"burritowallet.com",mobile:{universal:"https://burritowallet.com/wc?uri="}},enjin_wallet:{id:"bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a",displayName:"Enjin Wallet",hostname:"enjin.io",mobile:{universal:"https://deeplink.wallet.enjin.io/"}},plasma_wallet:{id:"cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e",displayName:"Plasma Wallet",hostname:"plasma-wallet.com",mobile:{universal:"https://plasma-wallet.com"}},avacus:{id:"94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43",displayName:"Avacus",hostname:"avacus.cc",mobile:{universal:"https://avacus.app.link"}},bee:{id:"2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715",displayName:"Bee",hostname:"www.beewallet.app",mobile:{universal:"https://beewallet.app/wc"}},pitaka:{id:"14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc",displayName:"Pitaka",hostname:"pitaka.io",mobile:{universal:"https://app.pitaka.io"}},pltwallet:{id:"576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd",displayName:"PLTwallet",hostname:"pltwallet.io",mobile:{universal:"https://pltwallet.io/"}},minerva:{id:"49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd",displayName:"Minerva",hostname:"minerva.digital",mobile:{universal:"https://minerva.digital"}},kryptogo:{id:"19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b",displayName:"KryptoGO",hostname:"kryptogo.com",mobile:{universal:"https://kryptogo.page.link"}},prema:{id:"5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b",displayName:"PREMA",hostname:"premanft.com",mobile:{universal:"https://premanft.com"}},slingshot:{id:"d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b",displayName:"Slingshot",hostname:"slingshot.finance",mobile:{universal:"https://app.slingshot.finance"}},kriptonio:{id:"50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b",displayName:"Kriptonio",hostname:"kriptonio.com",mobile:{universal:"https://app.kriptonio.com/mobile"}},timeless:{id:"9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8",displayName:"Timeless",hostname:"timelesswallet.xyz",mobile:{universal:"https://timelesswallet.xyz"}},secux:{id:"6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa",displayName:"SecuX",hostname:"secuxtech.com",mobile:{universal:"https://wsweb.secuxtech.com"}},bitizen:{id:"41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071",displayName:"Bitizen",hostname:"bitizen.org",mobile:{universal:"https://bitizen.org/wallet"}},blocto:{id:"14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd",displayName:"Blocto",hostname:"blocto.io",mobile:{universal:"https://blocto.app"}},safemoon:{id:"a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1",displayName:"SafeMoon",hostname:"safemoon.com",mobile:{universal:"https://safemoon.com/wc"}},okx_wallet:{id:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",displayName:"OKX Wallet",hostname:"okx.com",mobile:{native:"okex://main"}},rabby_wallet:{id:"18388be9ac2d02726dbac9777c96efaac06d744b2f6d580fccdd4127a6d01fd1",displayName:"Rabby Wallet",hostname:"rabby.io",mobile:{}}};function Li(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}let Ui="WALLETCONNECT_DEEPLINK_CHOICE";function Di(e){return e.startsWith("http://")||e.startsWith("https://")}function Wi(e,t){if(Di(e))return Bi(e,t);let r=e;return r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`),{redirect:`${r}wc?uri=${encodeURIComponent(t)}`,href:r}}function Bi(e,t){if(!Di(e))return Wi(e,t);let r=e;return r.endsWith("/")||(r=`${r}/`),{redirect:`${r}wc?uri=${encodeURIComponent(t)}`,href:r}}function Hi(e,t){window.open(e,t,"noreferrer noopener")}class Gi{execute(e){return null===this.promise&&(this.promise=(async()=>{try{return await this.fn(e)}finally{this.promise=null}})()),this.promise}constructor(e){this.promise=null,this.fn=e}}class qi{get meta(){return this._meta}async authenticate(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!this.meta.channelToken)throw new o.PrivyClientError("Auth flow must be initialized first");try{let e=await this.api.post("/api/v1/farcaster/authenticate",{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});if(!e)throw new o.PrivyClientError("No response from authentication");return{user:e.user,token:e.token,refresh_token:e.refresh_token,identity_token:e.identity_token,is_new_user:e.is_new_user}}catch(e){throw o.formatApiError(e)}}async link(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");try{return await this.api.post("/api/v1/farcaster/link",{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(e){throw o.formatApiError(e)}}async _startChannelOnce(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");let e=await this.api.post("/api/v1/farcaster/init",{token:this.captchaToken});a.isMobile&&!a.isIOS&&e.connect_uri&&Hi(e.connect_uri,"_blank"),this._meta={...this._meta,connectUri:e.connect_uri,channelToken:e.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!this.meta.channelToken)throw new o.PrivyClientError("Auth flow must be initialized first");let e=await this.api.get("/api/v1/farcaster/status",{headers:{"farcaster-channel-token":this.meta.channelToken}});return"completed"===e.state&&(this.message=e.message,this.signature=e.signature,this.fid=e.fid,!0)}constructor(e,t=!1){this._meta={disableSignup:!1},this.captchaToken=e,this.startChannelOnce=new Gi(this._startChannelOnce.bind(this)),this.pollForReady=new Gi(this._pollForReady.bind(this)),this._meta.disableSignup=t}}function zi(e){return crypto.getRandomValues(new Uint8Array(e))}class Vi{getOrCreateGuestCredential(e){let t=l.getGuestCredentialStorageKey(e);if(d.e()){if(d.e5.get(t))return d.e5.get(t);{let e=s.base64url.encode(zi(32));return d.e5.put(t,e),e}}return s.base64url.encode(zi(32))}async authenticate(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");try{let e=await this.api.post("/api/v1/guest/authenticate",{guest_credential:this.meta.guestCredential});return{user:e.user,token:e.token,refresh_token:e.refresh_token,identity_token:e.identity_token,is_new_user:e.is_new_user}}catch(e){throw o.formatApiError(e)}}async link(){throw Error("Linking is not supported for the guest flow")}constructor(e){this.meta={guestCredential:this.getOrCreateGuestCredential(e)}}}function Ki(){return s.base64url.encode(zi(36))}function Yi(){return Ki()}async function Zi(e,t="S256"){if("S256"!=t)return e;{let t=await async function(e){let t=(new TextEncoder).encode(e);return new Uint8Array(await crypto.subtle.digest("SHA-256",t))}(e);return s.base64url.encode(t)}}function Xi(){return!!d.e5.get(l.HEADLESS_OAUTH_KEY)}class Ji{addCaptchaToken(e){this.meta.captchaToken=e}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new o.PrivyClientError("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if("undefined"===this.meta.authorizationCode)throw new o.PrivyClientError("User denied confirmation during OAuth flow");let e=function(){let e=d.e5.get(l.CODE_VERIFIER_KEY);if(!e)throw new o.PrivyClientError("Authentication error.");return e}();try{let t=await this.api.post(_i,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:e,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});return d.e5.del(l.CODE_VERIFIER_KEY),d.e5.del(l.HEADLESS_OAUTH_KEY),d.e5.del(l.OAUTH_DISABLE_SIGNUP_KEY),{user:t.user,token:t.token,refresh_token:t.refresh_token,identity_token:t.identity_token,is_new_user:t.is_new_user,oauth_tokens:t.oauth_tokens}}catch(e){let t=o.formatApiError(e);if(t.privyErrorCode)throw new o.PrivyClientError(t.message||"Invalid code during OAuth flow.",void 0,t.privyErrorCode);if("User denied confirmation during OAuth flow"===t.message)throw new o.PrivyClientError("Invalid code during oauth flow.",void 0,o.PrivyErrorCode.OAUTH_USER_DENIED);throw new o.PrivyClientError("Invalid code during OAuth flow.",void 0,o.PrivyErrorCode.UNKNOWN_AUTH_ERROR)}}async link(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new o.PrivyClientError("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if("undefined"===this.meta.authorizationCode)throw new o.PrivyClientError("User denied confirmation during OAuth flow");let e=d.e5.get(l.CODE_VERIFIER_KEY);if(!e)throw new o.PrivyClientError("Authentication error.");try{let t=await this.api.post(ki,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:e});return d.e5.del(l.CODE_VERIFIER_KEY),t}catch(e){throw o.formatApiError(e)}}async getAuthorizationUrl(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!this.meta.provider)throw new o.PrivyClientError("Provider must be set when initializing OAuth authentication.");let e=Ki();d.e5.put(l.CODE_VERIFIER_KEY,e);let t=Yi();d.e5.put(l.STATE_CODE_KEY,t);let r=await Zi(e);this.meta.headless&&d.e5.put(l.HEADLESS_OAUTH_KEY,!0),this.meta.disableSignup&&d.e5.put(l.OAUTH_DISABLE_SIGNUP_KEY,!0);try{return await this.api.post(Pi,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:r,state_code:t})}catch(e){throw o.formatApiError(e)}}constructor(e){let t="boolean"==typeof e.headless?e.headless:Xi();this.meta={...e,headless:t}}}function Qi(e){return e.charAt(0).toUpperCase()+e.slice(1)}const ea=({style:t,...r})=>e.jsxs("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 24 24",style:{height:"24px",...t},...r,children:[e.jsx("path",{d:"M17.0722 11.6888C17.0471 8.90571 19.3263 7.56847 19.429 7.50274C18.1466 5.60938 16.153 5.35154 15.4417 5.3212C13.7461 5.14678 12.1306 6.32982 11.269 6.32982C10.4074 6.32982 9.08004 5.34648 7.67246 5.37429C5.82158 5.40209 4.11595 6.45874 3.16171 8.13218C1.24068 11.4942 2.6708 16.4817 4.54423 19.2143C5.46091 20.549 6.55041 22.0531 7.98554 21.9975C9.36803 21.9419 9.88905 21.095 11.5571 21.095C13.2251 21.095 13.696 21.9975 15.1537 21.9697C16.6389 21.9393 17.5806 20.6046 18.4897 19.2648C19.5392 17.7153 19.9725 16.2137 19.9975 16.1354C19.965 16.1228 17.1022 15.0155 17.0722 11.6888Z",fill:"currentColor"}),e.jsx("path",{d:"M14.3295 3.51373C15.0909 2.58347 15.6043 1.28921 15.4641 0C14.3671 0.0455014 13.0396 0.738135 12.2532 1.66838C11.5494 2.48994 10.9307 3.80695 11.0986 5.07089C12.3183 5.16694 13.5681 4.44145 14.3295 3.51373Z",fill:"currentColor"})]}),ta=({style:t,...r})=>e.jsxs("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 71 55",style:{height:"24px",...t},...r,children:[e.jsx("g",{clipPath:"url(#clip0)",children:e.jsx("path",{d:"M60.1045 4.8978C55.5792 2.8214 50.7265 1.2916 45.6527 0.41542C45.5603 0.39851 45.468 0.440769 45.4204 0.525289C44.7963 1.6353 44.105 3.0834 43.6209 4.2216C38.1637 3.4046 32.7345 3.4046 27.3892 4.2216C26.905 3.0581 26.1886 1.6353 25.5617 0.525289C25.5141 0.443589 25.4218 0.40133 25.3294 0.41542C20.2584 1.2888 15.4057 2.8186 10.8776 4.8978C10.8384 4.9147 10.8048 4.9429 10.7825 4.9795C1.57795 18.7309 -0.943561 32.1443 0.293408 45.3914C0.299005 45.4562 0.335386 45.5182 0.385761 45.5576C6.45866 50.0174 12.3413 52.7249 18.1147 54.5195C18.2071 54.5477 18.305 54.5139 18.3638 54.4378C19.7295 52.5728 20.9469 50.6063 21.9907 48.5383C22.0523 48.4172 21.9935 48.2735 21.8676 48.2256C19.9366 47.4931 18.0979 46.6 16.3292 45.5858C16.1893 45.5041 16.1781 45.304 16.3068 45.2082C16.679 44.9293 17.0513 44.6391 17.4067 44.3461C17.471 44.2926 17.5606 44.2813 17.6362 44.3151C29.2558 49.6202 41.8354 49.6202 53.3179 44.3151C53.3935 44.2785 53.4831 44.2898 53.5502 44.3433C53.9057 44.6363 54.2779 44.9293 54.6529 45.2082C54.7816 45.304 54.7732 45.5041 54.6333 45.5858C52.8646 46.6197 51.0259 47.4931 49.0921 48.2228C48.9662 48.2707 48.9102 48.4172 48.9718 48.5383C50.038 50.6034 51.2554 52.5699 52.5959 54.435C52.6519 54.5139 52.7526 54.5477 52.845 54.5195C58.6464 52.7249 64.529 50.0174 70.6019 45.5576C70.6551 45.5182 70.6887 45.459 70.6943 45.3942C72.1747 30.0791 68.2147 16.7757 60.1968 4.9823C60.1772 4.9429 60.1437 4.9147 60.1045 4.8978ZM23.7259 37.3253C20.2276 37.3253 17.3451 34.1136 17.3451 30.1693C17.3451 26.225 20.1717 23.0133 23.7259 23.0133C27.308 23.0133 30.1626 26.2532 30.1066 30.1693C30.1066 34.1136 27.28 37.3253 23.7259 37.3253ZM47.3178 37.3253C43.8196 37.3253 40.9371 34.1136 40.9371 30.1693C40.9371 26.225 43.7636 23.0133 47.3178 23.0133C50.9 23.0133 53.7545 26.2532 53.6986 30.1693C53.6986 34.1136 50.9 37.3253 47.3178 37.3253Z",fill:"#5865F2"})}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0",children:e.jsx("rect",{width:"71",height:"55",fill:"white"})})})]}),ra=({style:t,...r})=>e.jsx("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"24",y:"24",viewBox:"0 0 98 96",style:{height:"24px",...t},...r,children:e.jsx("path",{d:"M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z",fill:"currentColor"})}),na=({style:t})=>e.jsx(ut.default,{style:{color:"var(--privy-color-error)",...t}}),ia=({style:t,...r})=>e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...t},...r,children:[e.jsx("path",{d:"M22.56 12.25C22.56 11.47 22.49 10.72 22.36 10H12V14.255H17.92C17.665 15.63 16.89 16.795 15.725 17.575V20.335H19.28C21.36 18.42 22.56 15.6 22.56 12.25Z",fill:"#4285F4"}),e.jsx("path",{d:"M12 23C14.97 23 17.46 22.015 19.28 20.335L15.725 17.575C14.74 18.235 13.48 18.625 12 18.625C9.13504 18.625 6.71004 16.69 5.84504 14.09H2.17004V16.94C3.98004 20.535 7.70004 23 12 23Z",fill:"#34A853"}),e.jsx("path",{d:"M5.845 14.09C5.625 13.43 5.5 12.725 5.5 12C5.5 11.275 5.625 10.57 5.845 9.91V7.06H2.17C1.4 8.59286 0.999321 10.2846 1 12C1 13.775 1.425 15.455 2.17 16.94L5.845 14.09Z",fill:"#FBBC05"}),e.jsx("path",{d:"M12 5.375C13.615 5.375 15.065 5.93 16.205 7.02L19.36 3.865C17.455 2.09 14.965 1 12 1C7.70004 1 3.98004 3.465 2.17004 7.06L5.84504 9.91C6.71004 7.31 9.13504 5.375 12 5.375Z",fill:"#EA4335"})]});function aa(t){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:26,height:26,viewBox:"0 0 140 140",x:"0px",y:"0px",fill:"none",...t,children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"b",children:[e.jsx("stop",{offset:"0",stopColor:"#3771c8"}),e.jsx("stop",{stopColor:"#3771c8",offset:".128"}),e.jsx("stop",{offset:"1",stopColor:"#60f",stopOpacity:"0"})]}),e.jsxs("linearGradient",{id:"a",children:[e.jsx("stop",{offset:"0",stopColor:"#fd5"}),e.jsx("stop",{offset:".1",stopColor:"#fd5"}),e.jsx("stop",{offset:".5",stopColor:"#ff543e"}),e.jsx("stop",{offset:"1",stopColor:"#c837ab"})]}),e.jsx("radialGradient",{id:"c",cx:"158.429",cy:"578.088",r:"65",xlinkHref:"#a",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(0 -1.98198 1.8439 0 -1031.402 454.004)",fx:"158.429",fy:"578.088"}),e.jsx("radialGradient",{id:"d",cx:"147.694",cy:"473.455",r:"65",xlinkHref:"#b",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(.17394 .86872 -3.5818 .71718 1648.348 -458.493)",fx:"147.694",fy:"473.455"})]}),e.jsx("path",{fill:"url(#c)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),e.jsx("path",{fill:"url(#d)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),e.jsx("path",{fill:"#fff",d:"M66.004 18c-13.036 0-14.672.057-19.792.29-5.11.234-8.598 1.043-11.65 2.23-3.157 1.226-5.835 2.866-8.503 5.535-2.67 2.668-4.31 5.346-5.54 8.502-1.19 3.053-2 6.542-2.23 11.65C18.06 51.327 18 52.964 18 66s.058 14.667.29 19.787c.235 5.11 1.044 8.598 2.23 11.65 1.227 3.157 2.867 5.835 5.536 8.503 2.667 2.67 5.345 4.314 8.5 5.54 3.054 1.187 6.543 1.996 11.652 2.23 5.12.233 6.755.29 19.79.29 13.037 0 14.668-.057 19.788-.29 5.11-.234 8.602-1.043 11.656-2.23 3.156-1.226 5.83-2.87 8.497-5.54 2.67-2.668 4.31-5.346 5.54-8.502 1.18-3.053 1.99-6.542 2.23-11.65.23-5.12.29-6.752.29-19.788 0-13.036-.06-14.672-.29-19.792-.24-5.11-1.05-8.598-2.23-11.65-1.23-3.157-2.87-5.835-5.54-8.503-2.67-2.67-5.34-4.31-8.5-5.535-3.06-1.187-6.55-1.996-11.66-2.23-5.12-.233-6.75-.29-19.79-.29zm-4.306 8.65c1.278-.002 2.704 0 4.306 0 12.816 0 14.335.046 19.396.276 4.68.214 7.22.996 8.912 1.653 2.24.87 3.837 1.91 5.516 3.59 1.68 1.68 2.72 3.28 3.592 5.52.657 1.69 1.44 4.23 1.653 8.91.23 5.06.28 6.58.28 19.39s-.05 14.33-.28 19.39c-.214 4.68-.996 7.22-1.653 8.91-.87 2.24-1.912 3.835-3.592 5.514-1.68 1.68-3.275 2.72-5.516 3.59-1.69.66-4.232 1.44-8.912 1.654-5.06.23-6.58.28-19.396.28-12.817 0-14.336-.05-19.396-.28-4.68-.216-7.22-.998-8.913-1.655-2.24-.87-3.84-1.91-5.52-3.59-1.68-1.68-2.72-3.276-3.592-5.517-.657-1.69-1.44-4.23-1.653-8.91-.23-5.06-.276-6.58-.276-19.398s.046-14.33.276-19.39c.214-4.68.996-7.22 1.653-8.912.87-2.24 1.912-3.84 3.592-5.52 1.68-1.68 3.28-2.72 5.52-3.592 1.692-.66 4.233-1.44 8.913-1.655 4.428-.2 6.144-.26 15.09-.27zm29.928 7.97c-3.18 0-5.76 2.577-5.76 5.758 0 3.18 2.58 5.76 5.76 5.76 3.18 0 5.76-2.58 5.76-5.76 0-3.18-2.58-5.76-5.76-5.76zm-25.622 6.73c-13.613 0-24.65 11.037-24.65 24.65 0 13.613 11.037 24.645 24.65 24.645C79.617 90.645 90.65 79.613 90.65 66S79.616 41.35 66.003 41.35zm0 8.65c8.836 0 16 7.163 16 16 0 8.836-7.164 16-16 16-8.837 0-16-7.164-16-16 0-8.837 7.163-16 16-16z"})]})}function oa({style:t,...r}){return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0,0,256,256",style:{height:"26px",width:"26px",...t},...r,children:e.jsx("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:e.jsx("g",{transform:"scale(5.12,5.12)",children:e.jsx("path",{d:"M41,4h-32c-2.76,0 -5,2.24 -5,5v32c0,2.76 2.24,5 5,5h32c2.76,0 5,-2.24 5,-5v-32c0,-2.76 -2.24,-5 -5,-5zM17,20v19h-6v-19zM11,14.47c0,-1.4 1.2,-2.47 3,-2.47c1.8,0 2.93,1.07 3,2.47c0,1.4 -1.12,2.53 -3,2.53c-1.8,0 -3,-1.13 -3,-2.53zM39,39h-6c0,0 0,-9.26 0,-10c0,-2 -1,-4 -3.5,-4.04h-0.08c-2.42,0 -3.42,2.06 -3.42,4.04c0,0.91 0,10 0,10h-6v-19h6v2.56c0,0 1.93,-2.56 5.81,-2.56c3.97,0 7.19,2.73 7.19,8.26z"})})})})}function sa(t){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...t,children:[e.jsx("path",{fill:"#1ed760",d:"M248 8C111.1 8 0 119.1 0 256s111.1 248 248 248 248-111.1 248-248S384.9 8 248 8Z"}),e.jsx("path",{d:"M406.6 231.1c-5.2 0-8.4-1.3-12.9-3.9-71.2-42.5-198.5-52.7-280.9-29.7-3.6 1-8.1 2.6-12.9 2.6-13.2 0-23.3-10.3-23.3-23.6 0-13.6 8.4-21.3 17.4-23.9 35.2-10.3 74.6-15.2 117.5-15.2 73 0 149.5 15.2 205.4 47.8 7.8 4.5 12.9 10.7 12.9 22.6 0 13.6-11 23.3-23.2 23.3zm-31 76.2c-5.2 0-8.7-2.3-12.3-4.2-62.5-37-155.7-51.9-238.6-29.4-4.8 1.3-7.4 2.6-11.9 2.6-10.7 0-19.4-8.7-19.4-19.4s5.2-17.8 15.5-20.7c27.8-7.8 56.2-13.6 97.8-13.6 64.9 0 127.6 16.1 177 45.5 8.1 4.8 11.3 11 11.3 19.7-.1 10.8-8.5 19.5-19.4 19.5zm-26.9 65.6c-4.2 0-6.8-1.3-10.7-3.6-62.4-37.6-135-39.2-206.7-24.5-3.9 1-9 2.6-11.9 2.6-9.7 0-15.8-7.7-15.8-15.8 0-10.3 6.1-15.2 13.6-16.8 81.9-18.1 165.6-16.5 237 26.2 6.1 3.9 9.7 7.4 9.7 16.5s-7.1 15.4-15.2 15.4z"})]})}function la(t){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 293768 333327",width:24,height:24,...t,children:[e.jsx("path",{fill:"#26f4ee",d:"M204958 0c5369 45832 32829 78170 77253 81022v43471l-287 27V87593c-44424-2850-69965-30183-75333-76015l-47060-1v192819c6791 86790-60835 89368-86703 56462 30342 18977 79608 6642 73766-68039V0h58365zM78515 319644c-26591-5471-50770-21358-64969-44588-34496-56437-3401-148418 96651-157884v54345l-164 27v-40773C17274 145544 7961 245185 33650 286633c9906 15984 26169 27227 44864 33011z"}),e.jsx("path",{fill:"#fb2c53",d:"M218434 11587c3505 29920 15609 55386 35948 70259-27522-10602-43651-34934-47791-70262l11843 3zm63489 82463c3786 804 7734 1348 11844 1611v51530c-25770 2537-48321-5946-74600-21749l4034 88251c0 28460 106 41467-15166 67648-34260 58734-95927 63376-137628 35401 54529 22502 137077-4810 136916-103049v-96320c26279 15803 48830 24286 74600 21748V94050zm-171890 37247c5390-1122 11048-1985 16998-2548v54345c-21666 3569-35427 10222-41862 22528-20267 38754 5827 69491 35017 74111-33931 5638-73721-28750-49999-74111 6434-12304 18180-18959 39846-22528v-51797zm64479-119719h1808-1808z"}),e.jsx("path",{d:"M206590 11578c5369 45832 30910 73164 75333 76015v51528c-25770 2539-48321-5945-74600-21748v96320c206 125717-135035 135283-173673 72939-25688-41449-16376-141089 76383-155862v52323c-21666 3569-33412 10224-39846 22528-39762 76035 98926 121273 89342-1225V11577l47060 1z",fill:"#000000"})]})}const da=({style:t,...r})=>e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",width:"24px",...t},...r,children:e.jsx("path",{d:"M 14.285156 10.171875 L 23.222656 0 L 21.105469 0 L 13.34375 8.832031 L 7.148438 0 L 0 0 L 9.371094 13.355469 L 0 24.019531 L 2.117188 24.019531 L 10.308594 14.691406 L 16.851562 24.019531 L 24 24.019531 M 2.878906 1.5625 L 6.132812 1.5625 L 21.101562 22.535156 L 17.851562 22.535156",fill:"currentColor"})});let ca={google:{name:"Google",component:ia},discord:{name:"Discord",component:ta},github:{name:"Github",component:ra},linkedin:{name:"LinkedIn",component:oa},twitter:{name:"Twitter",component:da},spotify:{name:"Spotify",component:sa},instagram:{name:"Instagram",component:aa},tiktok:{name:"Tiktok",component:la},apple:{name:"Apple",component:ea}};const ua=e=>e in ca?ca[e]:{name:"Unknown",component:na};function ha(){let e=new URLSearchParams(window.location.search),t=e.get("privy_oauth_code"),r=e.get("privy_oauth_state"),n=e.get("privy_oauth_provider");if(!t||!r||!n)return{inProgress:!1};let i=!1;try{i=!!window.opener.location.origin}catch{}return{inProgress:!0,authorizationCode:t,stateCode:r,provider:n,headless:Xi(),popupFlow:null!==window.opener&&i,disableSignup:!!d.e5.get(l.OAUTH_DISABLE_SIGNUP_KEY)}}function pa(){let e=new URL(window.location.href);e.searchParams.delete("privy_oauth_code"),e.searchParams.delete("privy_oauth_provider"),e.searchParams.delete("privy_oauth_state"),d.e5.del(l.STATE_CODE_KEY),window.history.replaceState({},"",e)}class ya{async initAuthenticationFlow(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute()}async initLinkFlow(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");this.meta.initLinkResponse=await this.initLinkOnce.execute()}async authenticate(){let e=await import("@simplewebauthn/browser");if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new o.PrivyClientError("WebAuthn is not supported in this browser");this.meta.initAuthenticateResponse||(this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute());try{let t=await e.startAuthentication(this._transformInitAuthenticateOptionsToCamelCase(this.meta.initAuthenticateResponse.options));this.meta.setPasskeyAuthState?.({status:"submitting-response"});let r=await this.api.post("/api/v1/passkeys/authenticate",{relying_party:this.meta.initAuthenticateResponse.relying_party,challenge:this.meta.initAuthenticateResponse.options.challenge,authenticator_response:this._transformAuthenticationResponseToSnakeCase(t)});return{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user}}catch(e){if("NotAllowedError"===e.name)throw new o.PrivyClientError("Passkey request timed out or rejected by user.",void 0,o.PrivyErrorCode.PASSKEY_NOT_ALLOWED);throw o.formatApiError(e)}}async link(){let e=await import("@simplewebauthn/browser");if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new o.PrivyClientError("WebAuthn is not supported in this browser");this.meta.initLinkResponse||(this.meta.initLinkResponse=await this.initLinkOnce.execute());try{let t=this.meta.initLinkResponse.options,r=await e.startRegistration(this._transformInitLinkOptionsToCamelCase(t));return await this.api.post("/api/v1/passkeys/link",{relying_party:this.meta.initLinkResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(r)})}catch(e){if("NotAllowedError"===e.name)throw new o.PrivyClientError("Passkey request timed out or rejected by user.",void 0,o.PrivyErrorCode.PASSKEY_NOT_ALLOWED);throw o.formatApiError(e)}}async _initAuthenticateOnce(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");return await this.api.post("/api/v1/passkeys/authenticate/init",{token:this.meta.captchaToken})}async _initLinkOnce(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");return await this.api.post("/api/v1/passkeys/link/init",{})}_transformInitLinkOptionsToCamelCase(e){return{rp:e.rp,user:{id:e.user.id,name:e.user.name,displayName:e.user.display_name},challenge:e.challenge,pubKeyCredParams:e.pub_key_cred_params.map((e=>({type:e.type,alg:e.alg}))),timeout:e.timeout,excludeCredentials:e.exclude_credentials?.map((e=>({id:e.id,type:e.type,transports:e.transports}))),authenticatorSelection:{authenticatorAttachment:e.authenticator_selection?.authenticator_attachment,requireResidentKey:e.authenticator_selection?.require_resident_key,residentKey:e.authenticator_selection?.resident_key,userVerification:e.authenticator_selection?.user_verification},attestation:e.attestation,extensions:{appid:e.extensions?.app_id,credProps:e.extensions?.cred_props?.rk,hmacCreateSecret:e.extensions?.hmac_create_secret}}}_transformRegistrationResponseToSnakeCase(e){return{id:e.id,raw_id:e.rawId,response:{client_data_json:e.response.clientDataJSON,attestation_object:e.response.attestationObject,authenticator_data:e.response.authenticatorData},authenticator_attachment:e.authenticatorAttachment,client_extension_results:{app_id:e.clientExtensionResults.appid,cred_props:e.clientExtensionResults.credProps,hmac_create_secret:e.clientExtensionResults.hmacCreateSecret},type:e.type}}_transformInitAuthenticateOptionsToCamelCase(e){return{challenge:e.challenge,allowCredentials:e.allow_credentials?.map((e=>({id:e.id,type:e.type,transports:e.transports})))||[],timeout:e.timeout,extensions:{appid:e.extensions?.app_id,credProps:e.extensions?.cred_props,hmacCreateSecret:e.extensions?.hmac_create_secret},userVerification:e.user_verification}}_transformAuthenticationResponseToSnakeCase(e){return{id:e.id,raw_id:e.rawId,response:{client_data_json:e.response.clientDataJSON,authenticator_data:e.response.authenticatorData,signature:e.response.signature,user_handle:e.response.userHandle},authenticator_attachment:e.authenticatorAttachment,client_extension_results:{app_id:e.clientExtensionResults.appid,cred_props:e.clientExtensionResults.credProps,hmac_create_secret:e.clientExtensionResults.hmacCreateSecret},type:e.type}}constructor(e,t){this.initAuthenticateOnce=new Gi(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new Gi(this._initLinkOnce.bind(this)),this.meta={captchaToken:e,setPasskeyAuthState:t}}}const ma=({address:e,chainId:t,nonce:r})=>`${window.location.host} wants you to sign in with your Ethereum account:\n${e}\n\nBy signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.\n\nURI: ${window.location.origin}\nVersion: 1\nChain ID: ${t}\nNonce: ${r}\nIssued At: ${(new Date).toISOString()}\nResources:\n- https://privy.io`;class fa{get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType,chainId:this.wallet.chainId,address:this.wallet.address,disableSignup:this._meta.disableSignup}}async authenticate(){if(!this.client)throw new o.PrivyClientError("SiweFlow has no client instance");try{let{message:e,signature:t}=await this.sign(),r=await this.client.authenticateWithSiweInternal({message:e,signature:t,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});return{user:r.user,token:r.token,refresh_token:r.refresh_token,identity_token:r.identity_token,is_new_user:r.is_new_user}}catch(e){throw o.formatApiError(e)}}async link(){if(!this.client)throw new o.PrivyClientError("SiweFlow has no client instance");try{let{message:e,signature:t}=await this.sign();return await this.client.linkWithSiweInternal({message:e,signature:t,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(e){throw o.formatApiError(e)}}async sign(){if(!this.client)throw new o.PrivyClientError("SiweFlow has no client instance");if(await this.buildMessage(),!this.preparedMessage)throw new o.PrivyClientError("Could not prepare SIWE message");let e=await this.wallet.sign(this.preparedMessage);return{message:this.preparedMessage,signature:e}}async _getNonceOnce(){if(!this.client)throw new o.PrivyClientError("SiweFlow has no client instance");return await this.client.generateSiweNonce({address:this.wallet.address,captchaToken:this.captchaToken})}async buildMessage(){if(!this.client)throw new o.PrivyClientError("SiweFlow has no client instance");let e=this.wallet.address,t=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=ma({address:e,chainId:t,nonce:this.nonce}),this.preparedMessage}constructor(e,t,r,n=!1){this._meta={disableSignup:!1},this.getNonceOnce=new Gi(this._getNonceOnce.bind(this)),this.wallet=e,this.captchaToken=r,this.client=t,this._meta.disableSignup=n}}class ga{get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType,disableSignup:this._meta.disableSignup}}async authenticate(){if(!this.client)throw new o.PrivyClientError("SiwsFlow has no client instance");try{let{message:e,signature:t}=await this.sign(),r=await this.client.authenticateWithSiwsInternal({message:e,signature:t,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});return{user:r.user,token:r.token,refresh_token:r.refresh_token,identity_token:r.identity_token,is_new_user:r.is_new_user}}catch(e){throw o.formatApiError(e)}}async link(){if(!this.client)throw new o.PrivyClientError("SiwsFlow has no client instance");try{let{message:e,signature:t}=await this.sign();return await this.client.linkWithSiwsInternal({message:e,signature:t,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(e){throw o.formatApiError(e)}}async sign(){if(!this.client)throw new o.PrivyClientError("SiwsFlow has no client instance");if(await this.buildMessage(),!this.preparedMessage)throw new o.PrivyClientError("Could not prepare SIWS message");if(!this.wallet.signMessage)throw new o.PrivyClientError("Wallet does not support signMessage");let e=await this.wallet.signMessage(Buffer.from(this.preparedMessage));return{message:this.preparedMessage,signature:Buffer.from(e).toString("base64")}}async _getNonceOnce(){if(!this.client)throw new o.PrivyClientError("SiwsFlow has no client instance");return await this.client.generateSiwsNonce({address:this.wallet.address,captchaToken:this.captchaToken})}async buildMessage(){if(!this.client)throw new o.PrivyClientError("SiwsFlow has no client instance");let e=this.wallet.address;return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=(({address:e,nonce:t})=>`${window.location.host} wants you to sign in with your Solana account:\n${e}\n\nYou are proving you own ${e}.\n\nURI: ${window.location.origin}\nVersion: 1\nChain ID: mainnet\nNonce: ${t}\nIssued At: ${(new Date).toISOString()}\nResources:\n- https://privy.io`)({address:e,nonce:this.nonce}),this.preparedMessage}constructor(e,t,r,n=!1){this._meta={disableSignup:!1},this.getNonceOnce=new Gi(this._getNonceOnce.bind(this)),this.wallet=e,this.captchaToken=r,this.client=t,this._meta.disableSignup=n}}class va{async authenticate(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new o.PrivyClientError("phone number and sms code must be set prior to calling authenticate.");try{let e=await this.api.post("/api/v1/passwordless_sms/authenticate",{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});return{user:e.user,token:e.token,refresh_token:e.refresh_token,identity_token:e.identity_token,is_new_user:e.is_new_user}}catch(e){throw o.formatApiError(e)}}async link(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new o.PrivyClientError("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post("/api/v1/passwordless_sms/link",{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(e){throw o.formatApiError(e)}}async sendSmsCode(e,t){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(e&&(this.meta.phoneNumber=e),t&&(this.meta.captchaToken=t),!this.meta.phoneNumber)throw new o.PrivyClientError("phone nNumber must be set when initialzing authentication.");try{return await this.api.post("/api/v1/passwordless_sms/init",{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(e){throw o.formatApiError(e)}}constructor(e,t,r=!1){this.meta={phoneNumber:e,captchaToken:t,disableSignup:r}}}class wa extends va{async link(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode||!this.meta.oldPhoneNumber)throw new o.PrivyClientError("Phone number, sms code, and an old phone number must be set prior to calling update.");try{return await this.api.post("/api/v1/passwordless_sms/update",{old_phone_number:this.meta.oldPhoneNumber,new_phone_number:this.meta.phoneNumber,code:this.meta.smsCode})}catch(e){throw o.formatApiError(e)}}constructor(e,t,r){super(t,r),this.meta={phoneNumber:t,captchaToken:r,oldPhoneNumber:e,disableSignup:!1}}}class xa{async authenticate(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");try{let e=await this.api.post("/api/v1/telegram/authenticate",{captcha_token:this.meta.captchaToken,telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});return{user:e.user,token:e.token,refresh_token:e.refresh_token,identity_token:e.identity_token,is_new_user:e.is_new_user}}catch(e){throw o.formatApiError(e)}}async link(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");try{return await this.api.post("/api/v1/telegram/link",{telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData})}catch(e){throw o.formatApiError(e)}}constructor(e,t=!1){this.meta={disableSignup:!1},this.meta={captchaToken:e,disableSignup:!1},this.meta.disableSignup=t}}function Ca(e){let t={detail:"",retryable:!1};return e?.privyErrorCode===o.PrivyErrorCode.LINKED_TO_ANOTHER_USER&&(t.detail="This account has already been linked to another user."),e?.privyErrorCode===o.PrivyErrorCode.DISALLOWED_LOGIN_METHOD&&(t.detail="Login with Telegram not allowed."),e?.privyErrorCode===o.PrivyErrorCode.INVALID_DATA&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===o.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===o.PrivyErrorCode.INVALID_CREDENTIALS&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===o.PrivyErrorCode.TOO_MANY_REQUESTS&&(t.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode===o.PrivyErrorCode.TOO_MANY_REQUESTS&&e.message.includes("rate limit")&&(t.detail="Request limit reached for Telegram. Please wait a moment and try again."),t}function Ea(){let e=new URL(window.location.href);e.searchParams.delete("id"),e.searchParams.delete("hash"),e.searchParams.delete("auth_date"),e.searchParams.delete("first_name"),e.searchParams.delete("last_name"),e.searchParams.delete("username"),e.searchParams.delete("photo_url"),e.hash="",window.history.replaceState({},"",e)}const ba=({style:t,...r})=>e.jsxs("svg",{width:"1024",height:"1024",viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...t},...r,children:[e.jsx("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]}),Sa=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4","csw_signUserOperation"];class Aa{on(e,t){if(this.walletProvider)return this.walletProvider.on(e,t);this._subscriptions.push({eventName:e,listener:t})}async request(e){if(!this.walletProvider)throw new o.PrivyConnectorError(`A wallet request of type ${e.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(e),this.walletTimeout()]).catch((e=>{throw m.formatConnectorError(e)}))}constructor(e,t){this.removeListener=(e,t)=>{if(this.walletProvider)try{return this.walletProvider.removeListener(e,t)}catch(e){console.warn("Unable to remove wallet provider listener")}},this.walletTimeout=(e=new m.WalletTimeoutError,t=this.rpcTimeoutDuration)=>new Promise(((r,n)=>setTimeout((()=>{n(e)}),t))),this.setWalletProvider=e=>{this.walletProvider&&this._subscriptions.forEach((e=>{this.removeListener(e.eventName,e.listener)})),this.walletProvider=e,this._subscriptions.forEach((e=>{this.walletProvider?.on(e.eventName,e.listener)}))},this.walletProvider=e,this.rpcTimeoutDuration=t||l.DEFAULT_RPC_TIMEOUT,this._subscriptions=[]}}let ja=class extends Error{constructor(e,t,r){super(e),this.code=t,this.data=r}};class $a extends Fe.default{async handleSendTransaction(e){if(!e.params||!Array.isArray(e.params))throw new ja(`Invalid params for ${e.method}`,4200);let t=e.params[0];if(!await Sg()||!this.address)throw new ja("Disconnected",4900);return(await $g(t,void 0,void 0,this.address)).hash}handleSwitchEthereumChain(e){let t;if(!e.params||!Array.isArray(e.params))throw new ja(`Invalid params for ${e.method}`,4200);if("string"==typeof e.params[0])t=e.params[0];else{if(!("chainId"in e.params[0])||"string"!=typeof e.params[0].chainId)throw new ja(`Invalid params for ${e.method}`,4200);t=e.params[0].chainId}this.chainId=Number(t),this.provider=d.getJsonRpcProvider(this.chainId,this.chains,this.rpcConfig,{appId:this.appId}),this.emit("chainChanged",t)}async handlePersonalSign(e){if(!e.params||!Array.isArray(e.params))throw Error("Invalid params for personal_sign");let t=e.params[0],r=e.params[1];return await Ag(t,void 0,r)}async handleSignedTypedData(e){if(!e.params||!Array.isArray(e.params))throw Error("Invalid params for eth_signTypedData_v4");let t=e.params[0],r="string"==typeof e.params[1]?JSON.parse(e.params[1]):e.params[1];return await jg(d.generateTypedDataWithDomainType(r),void 0,t)}async handleEstimateGas(e){if(!e.params||!Array.isArray(e.params))throw Error("Invalid params for eth_estimateGas");delete e.params[0].gasPrice,delete e.params[0].maxFeePerGas,delete e.params[0].maxPriorityFeePerGas;let t={...e.params[0],chainId:d.toHex(this.chainId)};try{return await this.provider.send("eth_estimateGas",[t])}catch(e){console.warn(`Gas estimation failed with error: ${e}. Retrying gas estimation by omitting the 'from' address`);try{return delete t.from,await this.provider.send("eth_estimateGas",[t])}catch(t){throw console.warn(`Gas estimation failed with error: ${t} when omitting the 'from' address`),e}}}async request(e){switch(console.debug("Embedded1193Provider.request() called with args",e),e.method){case"eth_accounts":case"eth_requestAccounts":return this.address?[this.address]:[];case"eth_chainId":return d.toHex(this.chainId);case"eth_estimateGas":return this.handleEstimateGas(e);case"eth_sendTransaction":return this.handleSendTransaction(e);case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(e);case"personal_sign":return this.handlePersonalSign(e);case"eth_signTypedData_v4":return this.handleSignedTypedData(e)}if(!(e=>Sa.includes(e))(e.method))return this.provider.send(e.method,e.params);{let t=await Sg();if(await Tg(),!t||!this.address)throw new ja("Disconnected",4900);try{return(await this.walletProxy.rpc({address:this.rootAddress,accessToken:t,hdWalletIndex:this.walletIndex,request:{method:e.method,params:e.params}})).response.data}catch(e){throw console.error(e),new ja("Disconnected",4900)}}}async connect(){let e=await Sg();if(!e||!this.address)return null;try{return(await this.walletProxy.connect({address:this.address,accessToken:e})).address}catch(e){return console.error(e),null}}constructor({walletProxy:e,address:t,rootAddress:r,rpcConfig:n,chains:i,appId:a,chainId:o=1,walletIndex:s}){super(),this.walletProxy=e,this.address=t,this.rootAddress=r,this.chainId=o,this.rpcConfig=n,this.chains=i,this.provider=d.getJsonRpcProvider(o,this.chains,n,{appId:a}),this.rpcTimeoutDuration=Qa(n,"privy"),this.appId=a,this.walletIndex=s}}class Ta extends Aa{constructor(e){super(e,e.rpcTimeoutDuration)}}class Pa extends Aa{sendAsync(e,t){throw Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}constructor(e){super(e,e.rpcTimeoutDuration)}}let _a;function ka(e){return"ethereum"===e.chainType}function Na(e){return"ethereum"===e.type}class Ia extends m.WalletConnector{buildConnectedWallet(e,n,i,a){let s=async()=>!!this.wallets.find((r=>t.getAddress(r.address)===t.getAddress(e)));return{type:"ethereum",address:t.getAddress(e),chainId:n,meta:i,imported:a,switchChain:async r=>{let i,a;if(!s)throw new o.PrivyConnectorError("Wallet is not currently connected.");let l=this.wallets.find((r=>t.getAddress(r.address)===t.getAddress(e)))?.chainId;if(!l)throw new o.PrivyConnectorError("Unable to determine current chainId.");if("number"==typeof r?(i=`0x${r.toString(16)}`,a=r):(i=r,a=Number(r)),l===d.formatChainIdToCAIP2(i))return;let c=this.chains.find((e=>e.id===a));if(!c)throw new o.PrivyConnectorError(`Unsupported chainId: ${r}`);let u=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:i}]})};try{return await u()}catch(e){if(((e,t)=>"coinbase_wallet"===t?e.message.includes("addEthereumChain"):4902===e.code||e.message?.includes("4902"))(e,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:i,chainName:c.name,nativeCurrency:c.nativeCurrency,rpcUrls:[c.rpcUrls.default?.http[0]??""],blockExplorerUrls:[c.blockExplorers?.default.url??""]}]}),u();if("rainbow"===this.walletClientType&&e.message?.includes("wallet_switchEthereumChain"))throw new o.PrivyConnectorError(`Rainbow does not support the chainId ${n}`);throw e}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:s,getEthereumProvider:async()=>{if(!await s())throw new o.PrivyConnectorError("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await s())throw new o.PrivyConnectorError("Wallet is not currently connected.");return new r.Web3Provider(new Ta(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await s())throw new o.PrivyConnectorError("Wallet is not currently connected.");return new Pa(this.proxyProvider)},sign:async e=>{if(!await s())throw new o.PrivyConnectorError("Wallet is not currently connected.");return await this.sign(e)},disconnect:()=>{this.disconnect()}}}async syncAccounts(e){let r,n=e;try{if(void 0===n){let e=await d.invokeUntilSettled((()=>this.proxyProvider.request({method:"eth_accounts"})),{maxAttempts:10,delayMs:500});console.debug(`eth_accounts for ${this.walletClientType}:`,e),Array.isArray(e)&&(n=e)}}catch(e){console.warn("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.",e)}if(!n||!Array.isArray(n)||n.length<=0||!n[0])return;let i=n[0],a=t.getAddress(i),o=[];if("privy"===this.walletClientType){let e=d.e5.get(l.getPrivyWalletKey(a));this.chains.find((t=>t.id===Number(e)))||(d.e5.del(l.getPrivyWalletKey(a)),e=null),r=e||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:r}]})}catch(e){console.warn(`Unable to switch embedded wallet to chain ID ${r} on initialization`)}}else try{let e=await d.invokeUntilSettled((()=>this.proxyProvider.request({method:"eth_chainId"})),{maxAttempts:10,delayMs:500});if(console.debug(`eth_chainId for ${this.walletClientType}:`,e),"string"==typeof e)r=e;else{if("number"!=typeof e)throw Error("Invalid chainId returned from provider");r=`0x${e.toString(16)}`}}catch(e){console.warn(`Failed to get chainId from provider, defaulting to ${l.DEFAULT_NETWORK}`,e),r=l.DEFAULT_NETWORK}let s=d.formatChainIdToCAIP2(r);if(!o.find((e=>t.getAddress(e.address)===a))){let e={name:this.walletBranding.name,icon:"string"==typeof this.walletBranding.icon?this.walletBranding.icon:void 0,id:this.walletBranding.id};o.push(this.buildConnectedWallet(t.getAddress(i),s,e,"embedded_imported"===this.connectorType))}to(o,this.wallets)||(this.wallets=o,this.emit("walletsUpdated"))}async getConnectedWallet(){let e=await this.proxyProvider.request({method:"eth_accounts"});return this.wallets.sort(((e,t)=>t.connectedAt-e.connectedAt)).find((r=>e.find((e=>t.getAddress(e)===t.getAddress(r.address)))))||null}async isConnected(){let e=await this.proxyProvider.request({method:"eth_accounts"});return Array.isArray(e)&&e.length>0}async sign(e){return await this.connect({showPrompt:!1}),new r.Web3Provider(new Ta(this.proxyProvider)).getSigner().signMessage(e)}subscribeListeners(){this.proxyProvider.on("accountsChanged",this.onAccountsChanged),this.proxyProvider.on("chainChanged",this.onChainChanged),this.proxyProvider.on("disconnect",this.onDisconnect),this.proxyProvider.on("connect",this.onConnect)}unsubscribeListeners(){this.proxyProvider.removeListener("accountsChanged",this.onAccountsChanged),this.proxyProvider.removeListener("chainChanged",this.onChainChanged),this.proxyProvider.removeListener("disconnect",this.onDisconnect),this.proxyProvider.removeListener("connect",this.onConnect)}constructor(e,t,r,n){super(e),this.chainType="ethereum",this.onAccountsChanged=e=>{0===e.length?this.onDisconnect():this.syncAccounts(e)},this.onChainChanged=e=>{this.wallets.forEach((t=>{t.chainId=d.formatChainIdToCAIP2(e),"privy"===this.walletClientType&&d.e5.put(l.getPrivyWalletKey(t.address),e)})),this.emit("walletsUpdated")},this.onDisconnect=()=>{this.connected=!1,this.wallets=[],this.emit("walletsUpdated")},this.onConnect=()=>{this.connected=!0,this.syncAccounts()},this.wallets=[],this.walletClientType=e,this.chains=t,this.defaultChain=r,this.rpcConfig=n,this.rpcTimeoutDuration=Qa(n,e),this.connected=!1,this.initialized=!1}}let Ma=[1,11155111,137,10,8453,84532,42161,7777777,43114,56],Oa=(e,t)=>e.makeWeb3Provider({options:t});class Ra extends Ia{async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(e){return e.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}disconnect(){this.proxyProvider.walletProvider.disconnect(),this.onDisconnect()}get walletBranding(){return{name:this.displayName,icon:ba,id:"com.coinbase.wallet"}}async promptConnection(){try{let e=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!e||0===e.length||!e[0])throw new o.PrivyConnectorError("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([e[0]])}catch(e){throw m.formatConnectorError(e)}}updateConnectionPreference(e){this.connectionOptions=e,this.walletClientType="smartWalletOnly"===e?"coinbase_smart_wallet":"coinbase_wallet",this.proxyProvider.setWalletProvider(Oa(_a,this.connectionOptions))}constructor(e,t,r,n,i,a){if(super("coinbase_wallet",e,t,r),this.connectorType="coinbase_wallet",this.displayName="Coinbase Wallet",this.proxyProvider=new Aa(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.connectionOptions=n.coinbaseWallet.connectionOptions??"all",this.walletClientType="smartWalletOnly"===this.connectionOptions?"coinbase_smart_wallet":"coinbase_wallet","coinbase_smart_wallet"===this.walletClientType&&(this.displayName="Coinbase Smart Wallet"),!_a){let r=[t.id].concat(e.map((e=>e.id))),n="eoaOnly"!==this.connectionOptions?r.filter((e=>!Ma.includes(e))):[];n.length>0&&console.warn(`The following configured chains are not supported by the Coinbase Smart Wallet: ${n.join(", ")}`),_a=new y.CoinbaseWalletSDK({appName:i,appLogoUrl:a,appChainIds:r})}this.proxyProvider.setWalletProvider(Oa(_a,this.connectionOptions))}}const Fa=({...t})=>e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.37126 11.0323C2.37126 12.696 3.90598 13.4421 5.40654 13.4468C8.91753 13.4468 12.8021 11.2897 12.7819 7.67984C12.7673 5.07728 10.3748 2.86167 7.54357 2.88296C4.8495 2.88296 2.21821 4.6411 2.21803 7.03628C2.21803 7.67951 2.58722 8.30178 3.55231 8.37184C2.74763 9.16826 2.37126 10.1225 2.37126 11.0323ZM7.55283 8.68012C8.11562 8.68012 8.57186 8.13217 8.57186 7.45624C8.57186 6.78032 8.11562 6.23237 7.55283 6.23237C6.99003 6.23237 6.53379 6.78032 6.53379 7.45624C6.53379 8.13217 6.99003 8.68012 7.55283 8.68012ZM10.4747 8.68012C11.0375 8.68012 11.4937 8.13217 11.4937 7.45625C11.4937 6.78032 11.0375 6.23237 10.4747 6.23237C9.91186 6.23237 9.45562 6.78032 9.45562 7.45625C9.45562 8.13217 9.91186 8.68012 10.4747 8.68012Z",fill:t.color||"var(--privy-color-foreground-3)"})});class La extends Ia{async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(e){return await this.isConnected()?(await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[d.toHex(e?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:Fa,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}constructor({provider:e,chains:t,defaultChain:r,rpcConfig:n,imported:i,walletIndex:a}){super("privy",t,r,n),this.connectorType="embedded",this.proxyProvider=e,this.walletIndex=a,i&&(this.connectorType="embedded_imported"),this.subscribeListeners()}}const Ua=({style:t,...r})=>e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...t},...r,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})}),Da=({style:t,...r})=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",x:0,y:0,viewBox:"0 0 318.6 318.6",width:"28",height:"28",style:{height:"28px",width:"28px",...t},...r,children:[e.jsx("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),e.jsx("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),e.jsx("path",{d:"m44.4 35.5 98.7 74.6-17.5-44.3zm193.9 171.3-26.5 40.6 56.7 15.6 16.3-55.3zm-204.4.9L50.1 263l56.7-15.6-26.5-40.6z",className:"s1 s2"}),e.jsx("path",{d:"m103.6 138.2-15.8 23.9 56.3 2.5-2-60.5zm111.3 0-39-34.8-1.3 61.2 56.2-2.5zM106.8 247.4l33.8-16.5-29.2-22.8zm71.1-16.5 33.9 16.5-4.7-39.3z",className:"s1 s2"}),e.jsx("path",{fill:"#d7c1b3",stroke:"#d7c1b3",className:"s1",d:"m211.8 247.4-33.9-16.5 2.7 22.1-.3 9.3zm-105 0 31.5 14.9-.2-9.3 2.5-22.1z"}),e.jsx("path",{fill:"#233447",stroke:"#233447",className:"s1",d:"m138.8 193.5-28.2-8.3 19.9-9.1zm40.9 0 8.3-17.4 20 9.1z"}),e.jsx("path",{fill:"#cd6116",stroke:"#cd6116",className:"s1",d:"m106.8 247.4 4.8-40.6-31.3.9zM207 206.8l4.8 40.6 26.5-39.7zm23.8-44.7-56.2 2.5 5.2 28.9 8.3-17.4 20 9.1zm-120.2 23.1 20-9.1 8.2 17.4 5.3-28.9-56.3-2.5z"}),e.jsx("path",{fill:"#e4751f",stroke:"#e4751f",className:"s1",d:"m87.8 162.1 23.6 46-.8-22.9zm120.3 23.1-1 22.9 23.7-46zm-64-20.6-5.3 28.9 6.6 34.1 1.5-44.9zm30.5 0-2.7 18 1.2 45 6.7-34.1z"}),e.jsx("path",{d:"m179.8 193.5-6.7 34.1 4.8 3.3 29.2-22.8 1-22.9zm-69.2-8.3.8 22.9 29.2 22.8 4.8-3.3-6.6-34.1z",className:"s3"}),e.jsx("path",{fill:"#c0ad9e",stroke:"#c0ad9e",className:"s1",d:"m180.3 262.3.3-9.3-2.5-2.2h-37.7l-2.3 2.2.2 9.3-31.5-14.9 11 9 22.3 15.5h38.3l22.4-15.5 11-9z"}),e.jsx("path",{fill:"#161616",stroke:"#161616",className:"s1",d:"m177.9 230.9-4.8-3.3h-27.7l-4.8 3.3-2.5 22.1 2.3-2.2h37.7l2.5 2.2z"}),e.jsx("path",{fill:"#763d16",stroke:"#763d16",className:"s1",d:"m278.3 114.2 8.5-40.8-12.7-37.9-96.2 71.4 37 31.3 52.3 15.3 11.6-13.5-5-3.6 8-7.3-6.2-4.8 8-6.1zM31.8 73.4l8.5 40.8-5.4 4 8 6.1-6.1 4.8 8 7.3-5 3.6 11.5 13.5 52.3-15.3 37-31.3-96.2-71.4z"}),e.jsx("path",{d:"m267.2 153.5-52.3-15.3 15.9 23.9-23.7 46 31.2-.4h46.5zm-163.6-15.3-52.3 15.3-17.4 54.2h46.4l31.1.4-23.6-46zm71 26.4 3.3-57.7 15.2-41.1h-67.5l15 41.1 3.5 57.7 1.2 18.2.1 44.8h27.7l.2-44.8z",className:"s3"})]}),Wa=({style:t,...r})=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"108",height:"108",viewBox:"0 0 108 108",fill:"none",style:{height:"28px",width:"28px",...t},...r,children:[e.jsx("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M46.5267 69.9229C42.0054 76.8509 34.4292 85.6182 24.348 85.6182C19.5824 85.6182 15 83.6563 15 75.1342C15 53.4305 44.6326 19.8327 72.1268 19.8327C87.768 19.8327 94 30.6846 94 43.0079C94 58.8258 83.7355 76.9122 73.5321 76.9122C70.2939 76.9122 68.7053 75.1342 68.7053 72.314C68.7053 71.5783 68.8275 70.7812 69.0719 69.9229C65.5893 75.8699 58.8685 81.3878 52.5754 81.3878C47.993 81.3878 45.6713 78.5063 45.6713 74.4598C45.6713 72.9884 45.9768 71.4556 46.5267 69.9229ZM83.6761 42.5794C83.6761 46.1704 81.5575 47.9658 79.1875 47.9658C76.7816 47.9658 74.6989 46.1704 74.6989 42.5794C74.6989 38.9885 76.7816 37.1931 79.1875 37.1931C81.5575 37.1931 83.6761 38.9885 83.6761 42.5794ZM70.2103 42.5795C70.2103 46.1704 68.0916 47.9658 65.7216 47.9658C63.3157 47.9658 61.233 46.1704 61.233 42.5795C61.233 38.9885 63.3157 37.1931 65.7216 37.1931C68.0916 37.1931 70.2103 38.9885 70.2103 42.5795Z",fill:"#FFFDF8"})]});function Ba(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}var Ha=0;class Ga extends Ia{async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(e){return e.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:this.providerDetail.info.name,icon:this.providerDetail.info.icon,id:this.providerDetail.info.rdns}}disconnect(){console.warn(`Programmatic disconnect with ${this.providerDetail.info.name} is not yet supported.`)}async promptConnection(){try{let e=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!e||0===e.length||!e[0])throw new o.PrivyConnectorError("Unable to retrieve accounts");await this.syncAccounts([e[0]])}catch(e){throw m.formatConnectorError(e)}}constructor(e,t,r,n,i){super(i||"unknown",e,t,r),this.connectorType="injected",this.proxyProvider=new Aa(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=n;let a=n.provider;this.proxyProvider.setWalletProvider(a)}}var qa="__private_"+Ha+++"__walletBranding";class za extends Ia{async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(e){return e.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return Ba(this,qa)[qa]??{name:"Browser Extension",icon:Ua,id:"extension"}}disconnect(){console.warn("Programmatic disconnect with browser wallets is not yet supported.")}async promptConnection(){try{let e=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!e||0===e.length||!e[0])throw new o.PrivyConnectorError("Unable to retrieve accounts");await this.syncAccounts([e[0]])}catch(e){throw m.formatConnectorError(e)}}constructor(e,t,r,n,i){super(i??"unknown",e,t,r),Object.defineProperty(this,qa,{writable:!0,value:void 0}),this.connectorType="injected",this.proxyProvider=new Aa(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(n),"metamask"===i?Ba(this,qa)[qa]={name:"MetaMask",icon:Da,id:"io.metamask"}:"phantom"===i&&(Ba(this,qa)[qa]={name:"Phantom",icon:Wa,id:"phantom"})}}class Va extends Ga{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{a.isMobile||await this.proxyProvider.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});let e=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!e||0===e.length||!e[0])throw new o.PrivyConnectorError("Unable to retrieve accounts");await this.syncAccounts([e[0]])}catch(e){throw m.formatConnectorError(e)}}}class Ka extends Ia{get walletBranding(){return{name:"Wallet",id:""}}async initialize(){this.initialized=!0,this.emit("initialized")}async connect(){throw Error("connect called for an uninstalled wallet via the NullConnector")}disconnect(){throw Error("disconnect called for an uninstalled wallet via the NullConnector")}promptConnection(e){throw Error(`promptConnection called for an uninstalled wallet via the NullConnector for ${e}`)}constructor(e,t){super(e,[],t,{}),this.connectorType="null",this.proxyProvider=new Aa(void 0,l.DEFAULT_RPC_TIMEOUT),this.connectorType=e}}class Ya extends Ka{get walletBranding(){return{name:"Phantom",icon:Wa,id:"phantom"}}constructor(e){super("phantom",e)}}const Za=({style:t,...r})=>{let{app:n}=g.usePrivyModal();return e.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...t},...r,children:[e.jsx("rect",{width:"28",height:"28",rx:"3",fill:"dark"===n?.appearance.palette.colorScheme?"#3396ff":"#141414"}),e.jsx("g",{clipPath:"url(#clip0_1765_9946)",children:e.jsx("path",{d:"M8.09448 10.3941C11.3558 7.20196 16.6442 7.20196 19.9055 10.3941L20.2982 10.7782C20.3369 10.8157 20.3677 10.8606 20.3887 10.9102C20.4097 10.9599 20.4206 11.0132 20.4206 11.0671C20.4206 11.121 20.4097 11.1744 20.3887 11.224C20.3677 11.2737 20.3369 11.3186 20.2982 11.3561L18.9554 12.6702C18.9158 12.7086 18.8628 12.7301 18.8077 12.7301C18.7526 12.7301 18.6996 12.7086 18.66 12.6702L18.1198 12.1415C15.8448 9.91503 12.1557 9.91503 9.88015 12.1415L9.30167 12.7075C9.26207 12.7459 9.20909 12.7673 9.15395 12.7673C9.0988 12.7673 9.04582 12.7459 9.00622 12.7075L7.66346 11.3934C7.62475 11.3559 7.59397 11.3109 7.57295 11.2613C7.55193 11.2117 7.5411 11.1583 7.5411 11.1044C7.5411 11.0505 7.55193 10.9971 7.57295 10.9475C7.59397 10.8979 7.62475 10.8529 7.66346 10.8154L8.09448 10.3941ZM22.6829 13.1115L23.8776 14.2814C23.9163 14.319 23.9471 14.3639 23.9681 14.4135C23.9892 14.4632 24 14.5165 24 14.5704C24 14.6243 23.9892 14.6777 23.9681 14.7273C23.9471 14.777 23.9163 14.8219 23.8776 14.8594L18.4893 20.1332C18.4102 20.2101 18.3042 20.2531 18.1938 20.2531C18.0835 20.2531 17.9775 20.2101 17.8984 20.1332L14.0743 16.3901C14.0545 16.3708 14.0279 16.36 14.0003 16.36C13.9726 16.36 13.9461 16.3708 13.9263 16.3901L10.1021 20.1332C10.023 20.2101 9.91703 20.2531 9.8067 20.2531C9.69636 20.2531 9.59038 20.2101 9.51124 20.1332L4.12236 14.8594C4.08365 14.8219 4.05287 14.777 4.03185 14.7273C4.01083 14.6777 4 14.6243 4 14.5704C4 14.5165 4.01083 14.4632 4.03185 14.4135C4.05287 14.3639 4.08365 14.319 4.12236 14.2814L5.31767 13.1115C5.39678 13.0348 5.50265 12.9919 5.61285 12.9919C5.72305 12.9919 5.82892 13.0348 5.90803 13.1115L9.73216 16.8546C9.75194 16.874 9.7785 16.8848 9.80616 16.8848C9.83381 16.8848 9.86037 16.874 9.88015 16.8546L13.7043 13.1115C13.7834 13.0346 13.8894 12.9916 13.9997 12.9916C14.1101 12.9916 14.216 13.0346 14.2952 13.1115L18.1198 16.8546C18.1396 16.874 18.1662 16.8848 18.1938 16.8848C18.2215 16.8848 18.2481 16.874 18.2678 16.8546L22.092 13.1115C22.1711 13.0346 22.2771 12.9916 22.3874 12.9916C22.4977 12.9916 22.6037 13.0346 22.6829 13.1115Z",fill:"white"})}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0_1765_9946",children:e.jsx("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};class Xa extends Ia{async initialize(){let e=await this.createProvider();if(this.provider=e,this.proxyProvider.setWalletProvider(e),this.subscribeListeners(),e.session){if(this.walletProvider?.session?.peer.metadata.url){let e=Ri(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=e?.entry,this.walletClientType=e?.walletClientType||"unknown"}this.connected=!0,await this.syncAccounts()}this.initialized=!0,this.emit("initialized");let{WalletConnectModal:t}=await import("@walletconnect/modal");this.modal=new t({projectId:this.walletConnectCloudProjectId,themeVariables:{"--wcm-z-index":"1000000"}}),this.modal.subscribeModal((e=>{e.open||this.walletProvider?.session||!this.onQrModalClosed||this.onQrModalClosed()}))}async connect(e){return e.showPrompt&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return!!this.walletProvider?.connected}get walletBranding(){return"metamask"===this.walletClientType?{name:"MetaMask",icon:Da,id:"io.metamask"}:{name:d.stripEmoji(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||Za,id:this.walletProvider?.session?.peer.metadata.name.toLowerCase()||"wallet_connect_v2"}}async resetConnection(e){this.walletProvider&&this.walletProvider.connected&&(await this.walletProvider.disconnect(),this.walletProvider.signer.session=void 0,this.walletEntry=Fi[e],this.walletClientType=e,this.redirectUri=void 0,this.fallbackUniversalRedirectUri=void 0,function(){try{localStorage.removeItem(Ui)}catch{}}(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise(((e,t)=>{this.onQrModalClosed=()=>{t(new m.UserRejectedConnectionError)},(async()=>{let t="",r=await Promise.race([this.walletProvider?.enable(),this.proxyProvider.walletTimeout()]);if(r?.length&&(t=r[0]),!t||""===t)throw new o.PrivyConnectorError("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let e=Ri(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=e?.entry,this.walletClientType=e?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=Qa(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(r),e()})().catch((e=>{t(e?m.formatConnectorError(e):new o.PrivyConnectorError("Unknown error during connection"))})).finally((()=>this.modal?.closeModal()))}))}disconnect(){this.walletProvider?.disconnect().then((()=>this.onDisconnect())).catch((()=>console.warn("Unable to disconnect Wallet Connect provider")))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(e){this.proxyProvider.setWalletProvider(e)}async createProvider(){let e={};for(let t of this.chains){let r=d.getJsonRpcEndpoint(t.id,this.chains,this.rpcConfig,this.privyAppId);r&&(e[t.id]=r)}let t=this.shouldEnforceDefaultChainOnConnect?[this.defaultChain.id]:[],r=this.chains.map((e=>e.id)),n=await f.EthereumProvider.init({projectId:this.walletConnectCloudProjectId,chains:t,optionalChains:r,optionalEvents:f.OPTIONAL_EVENTS,optionalMethods:f.OPTIONAL_METHODS,rpcMap:e,showQrModal:!1,metadata:{description:this.privyAppName,name:this.privyAppName,url:window.location.toString(),icons:[]}});return n.on("display_uri",(e=>{if(n.signer.abortPairingAttempt(),a.isMobile&&this.walletEntry){let{redirect:t,href:r}=function(e,t){let r=Li(t);if(r.deepLink)return Wi(r.deepLink,e);if(r.universalLink)return Bi(r.universalLink,e);throw new o.PrivyClientError(`Unsupported wallet ${t.id}`)}(e,this.walletEntry);(function({href:e,name:t}){try{localStorage.setItem(Ui,JSON.stringify({href:e,name:t}))}catch{}})({href:r,name:this.walletEntry.displayName}),this.redirectUri=t;let n=function(e,t){let r=Li(t);if(r.universalLink)return Bi(r.universalLink,e)}(e,this.walletEntry);n?.redirect&&(this.fallbackUniversalRedirectUri=n.redirect),Hi(t,"_self")}else this.modal?.openModal({uri:e,chains:[this.defaultChain.id]})})),n.on("connect",(()=>{if(this.modal?.closeModal(),n.session?.peer.metadata.url){let e=Ri(n.session?.peer.metadata.url);this.walletEntry=e?.entry,this.walletClientType=e?.walletClientType||"unknown"}})),n}async enableProvider(){return this.walletProvider?.connected?Promise.resolve(this.walletProvider.accounts):await(this.walletProvider?.enable())}constructor(e,t,r,n,i,a,o,s){super(s||"unknown",r,n,t),this.connectorType="wallet_connect_v2",this.privyAppId=a,this.privyAppName=o,this.walletConnectCloudProjectId=e,this.rpcConfig=t,this.shouldEnforceDefaultChainOnConnect=i,this.proxyProvider=new Aa(void 0,this.rpcTimeoutDuration),s&&(this.walletEntry=Fi[s],this.walletClientType=s)}}const Ja=e=>{let r=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses")?.split(" ").filter((e=>h.isHexString(e))).map((e=>t.getAddress(e)));return!!r?.length&&!!e?.linkedAccounts.filter((e=>"wallet"==e.type&&r.includes(e.address))).length},Qa=(e,t)=>e.rpcTimeouts&&e.rpcTimeouts[t]||l.DEFAULT_RPC_TIMEOUT;class eo extends Fe.default{get wallets(){let e=new Set,t=this.walletConnectors.flatMap((e=>e.wallets)).sort(((e,t)=>e.connectedAt&&t.connectedAt?t.connectedAt-e.connectedAt:0)).filter((t=>{let r=`${t.address}${t.walletClientType}${t.connectorType}`;return!e.has(r)&&(e.add(r),!0)})),r=t.findIndex((e=>e.address===(this.activeWallet?this.activeWallet:"unknown")));return r>=0&&t.unshift(t.splice(r,1)[0]),t}async initialize(){if(this.initialized)return;d.e5.get(l.CONNECTORS_STATE_KEY)&&(d.e5.getKeys().forEach((e=>{e.startsWith("walletconnect")&&d.e5.del(e)})),d.e5.del(l.CONNECTORS_STATE_KEY));let e=d.detectInjectedConnectors(this.store,this.walletList,this.externalWalletConfig).then((e=>{e.forEach((({type:e,eip6963InjectedProvider:t,legacyInjectedProvider:r})=>{this.createEthereumWalletConnector("injected",e,{eip6963InjectedProvider:t,legacyInjectedProvider:r})}))}));this.walletList.includes("coinbase_wallet")&&this.createEthereumWalletConnector("coinbase_wallet","coinbase_wallet"),!d.isPhantomInstalled()&&this.walletList.includes("phantom")&&this.createEthereumWalletConnector("phantom","phantom"),this.externalWalletConfig.walletConnect.enabled&&this.createEthereumWalletConnector("wallet_connect_v2","unknown"),this.externalWalletConfig.solana.connectors?.get().forEach(this.addSolanaWalletConnector),this.externalWalletConfig.solana.connectors?._setOnConnectorsUpdated?.((e=>{e?.forEach(this.addSolanaWalletConnector)})),await e,this.initialized=!0}findWalletConnector(e,t){return"wallet_connect_v2"===e?this.walletConnectors.filter(ka).find((t=>t.connectorType===e))??null:this.walletConnectors.filter(ka).find((r=>r.connectorType===e&&r.walletClientType===t))??null}findSolanaWalletConnector(e,t){return this.walletConnectors.filter(m.isSolanaWalletConnector).find((r=>r.connectorType===e&&r.walletClientType===t))??null}findEmbeddedWalletConnectors(){return this.walletConnectors.filter((e=>"embedded"===e.connectorType))}onInitialized(e){e.wallets.forEach((e=>{let t=this.storedConnections.find((t=>t.address===e.address&&t.connectorType===e.connectorType&&t.walletClientType===e.walletClientType));t&&(e.connectedAt=t.connectedAt)})),this.saveConnectionHistory(),this.emit("walletsUpdated"),this.emit("connectorInitialized")}onWalletsUpdated(e){e.initialized&&(this.saveConnectionHistory(),this.emit("walletsUpdated"))}addEmbeddedWalletConnectors({walletProxy:e,rootWallet:t,embeddedWallets:r,defaultChain:n,appId:i}){for(let a of r){let r=this.findEmbeddedWalletConnectors().find((e=>e.walletIndex===a.walletIndex));if(r&&ka(r))r.proxyProvider.walletProxy=e;else{let r=new La({provider:new $a({walletProxy:e,address:a.address,rootAddress:t.address,rpcConfig:this.rpcConfig,chains:this.chains,appId:i,chainId:n.id,walletIndex:a.walletIndex}),chains:this.chains,defaultChain:n,rpcConfig:this.rpcConfig,imported:!1,walletIndex:a.walletIndex});this.addWalletConnector(r)}}}addImportedWalletConnector(e,t,r,n){let i=this.findWalletConnector("embedded_imported","privy");if(i&&ka(i))i.proxyProvider.walletProxy=e;else{let i=new La({provider:new $a({walletProxy:e,rootAddress:t,address:t,walletIndex:0,rpcConfig:this.rpcConfig,chains:this.chains,appId:n,chainId:r.id}),chains:this.chains,walletIndex:0,defaultChain:r,rpcConfig:this.rpcConfig,imported:!0});this.addWalletConnector(i)}}removeEmbeddedWalletConnectors(){this.walletConnectors=this.walletConnectors.filter((e=>"embedded"!==e.connectorType)),this.saveConnectionHistory(),this.storedConnections=ro(),this.emit("walletsUpdated")}removeImportedWalletConnector(){let e=this.findWalletConnector("embedded_imported","privy");if(e){let t=this.walletConnectors.indexOf(e);this.walletConnectors.splice(t,1),this.saveConnectionHistory(),this.storedConnections=ro(),this.emit("walletsUpdated")}}async createEthereumWalletConnector(e,t,r){let n=this.findWalletConnector(e,t);if(n&&ka(n))return n instanceof Xa&&n.resetConnection(t),n;let i=(()=>"injected"!==e?"coinbase_wallet"===e?new Ra(this.chains,this.defaultChain,this.rpcConfig,this.externalWalletConfig,this.privyAppName,this.privyAppLogo):"phantom"===e?new Ya(this.defaultChain):new Xa(this.walletConnectCloudProjectId,this.rpcConfig,this.chains,this.defaultChain,this.shouldEnforceDefaultChainOnConnect,this.privyAppId,this.privyAppName,t):"metamask"===t&&r?.eip6963InjectedProvider?new Va(this.chains,this.defaultChain,this.rpcConfig,r?.eip6963InjectedProvider,"metamask"):"metamask"===t&&r?.legacyInjectedProvider?new za(this.chains,this.defaultChain,this.rpcConfig,r?.legacyInjectedProvider,"metamask"):"phantom"===t&&r?.legacyInjectedProvider?new za(this.chains,this.defaultChain,this.rpcConfig,r?.legacyInjectedProvider,"phantom"):r?.legacyInjectedProvider&&"unknown_browser_extension"===t?new za(this.chains,this.defaultChain,this.rpcConfig,r?.legacyInjectedProvider):r?.eip6963InjectedProvider?new Ga(this.chains,this.defaultChain,this.rpcConfig,r?.eip6963InjectedProvider,t):void 0)();return i&&this.addWalletConnector(i),i||null}addWalletConnector(e){this.walletConnectors.push(e),e.on("initialized",(()=>this.onInitialized(e))),e.on("walletsUpdated",(()=>this.onWalletsUpdated(e))),e.initialize().catch((e=>{console.debug("Failed to initialize connector",e)}))}saveConnectionHistory(){let e=this.wallets.map((e=>({address:e.address,connectorType:e.connectorType,walletClientType:e.walletClientType,connectedAt:e.connectedAt})));d.e5.put(l.CONNECTIONS_HISTORY_KEY,e)}async activeWalletSign(e){let t=this.wallets,r=t.length>0?t[0]:null;return r&&Na(r)?r.sign(e):null}setActiveWallet(e){this.activeWallet=t.getAddress(e),this.emit("walletsUpdated")}constructor(e,t,r,n,i,a,o,s,l,d,c){super(),this.addSolanaWalletConnector=async e=>{this.findWalletConnector("solana_adapter",e.walletClientType)||this.addWalletConnector(e)},this.getEthereumProvider=()=>{let e=this.wallets[0],t=this.walletConnectors.find((t=>t.wallets.find((t=>t.address===e?.address))));return e&&t?t.proxyProvider:new Aa},this.privyAppId=e,this.walletConnectCloudProjectId=t,this.rpcConfig=r,this.chains=n,this.defaultChain=i,this.walletConnectors=[],this.initialized=!1,this.store=a,this.walletList=o,this.shouldEnforceDefaultChainOnConnect=s,this.externalWalletConfig=l,this.privyAppName=d,this.privyAppLogo=c,this.storedConnections=ro()}}function to(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){let n=e[r],i=t[r];if(n?.address!==i?.address||n&&i&&Na(n)&&Na(i)&&n?.chainId!==i?.chainId||n?.connectorType!==i?.connectorType||n?.connectedAt!==i?.connectedAt||n?.walletClientType!==i?.walletClientType||n?.isConnected!==i?.isConnected||n?.linked!==i?.linked)return!1}return!0}const ro=()=>{let e=d.e5.get(l.CONNECTIONS_HISTORY_KEY);return e&&Array.isArray(e)&&e.map((e=>(e=>e&&"string"==typeof e.address&&"string"==typeof e.connectorType&&"string"==typeof e.walletClientType&&"number"==typeof e.connectedAt)(e))).every(Boolean)?e:[]};let no=[ji,Ti,$i,Ni];class io{async get(e,t){try{return await this.baseFetch(e,t)}catch(e){throw o.formatApiError(e)}}async post(e,t,r){try{return await this.baseFetch(e,{method:"POST",...t?{body:t}:{},...r})}catch(e){throw o.formatApiError(e)}}async delete(e,t){try{return await this.baseFetch(e,{method:"DELETE",...t})}catch(e){throw o.formatApiError(e)}}constructor({appId:e,appClientId:t,client:r,defaults:n}){this.appId=e,this.appClientId=t,this.clientAnalyticsId=r.clientAnalyticsId,this.sdkVersion=l.VERSION,this.client=r,this.defaults=n,this.fallbackApiUrl=r.fallbackApiUrl,this.baseFetch=v.ofetch.create({baseURL:this.defaults.baseURL,timeout:this.defaults.timeout,retry:3,retryDelay:500,retryStatusCodes:[408,409,425,500,502,503,504],credentials:"include",onRequest:async({request:e,options:t})=>{let r=new Headers(t.headers);r.set("privy-app-id",this.appId),this.appClientId&&r.set("privy-client-id",this.appClientId),r.set("privy-ca-id",this.clientAnalyticsId||""),r.set("privy-client",`react-auth:${this.sdkVersion}`);let n=no.includes(e.toString());if(!r.has("authorization")){let e=await this.client.getAccessToken({disableAutoRefresh:n});null!==e&&r.set("authorization",`Bearer ${e}`)}t.headers=r,t.retryDelay&&(t.retryDelay=3*t.retryDelay)},onRequestError:({error:e})=>{if(e instanceof DOMException&&"AbortError"===e.name)throw new o.PrivyTimeoutError}})}}function ao(){return!(a.isSafari&&window.location.origin.startsWith("http://localhost"))}class oo{static parse(e){try{return new oo(e)}catch(e){return null}}get subject(){return this._decoded.sub}get expiration(){return this._decoded.exp}get issuer(){return this._decoded.iss}get audience(){return this._decoded.aud}isExpired(e=0){return Date.now()>=1e3*(this.expiration-e)}constructor(e){this.value=e,this._decoded=Re.decodeJwt(e)}}class so{get token(){try{let e=d.e5.get(l.TOKEN_STORAGE_KEY);return"string"==typeof e?new oo(e).value:null}catch(e){return console.error(e),this.destroyLocalState(),null}}get refreshToken(){try{let e=d.e5.get(l.REFRESH_TOKEN_STORAGE_KEY);return"string"==typeof e?e:null}catch(e){return console.error(e),this.destroyLocalState(),null}}get forkedToken(){try{let e=d.e5.get(l.FORKED_TOKEN_STORAGE_KEY);return"string"==typeof e?e:null}catch(e){return console.error(e),this.destroyLocalState(),null}}getProviderAccessToken(e){try{let t=d.e5.get(l.getProviderAccessTokenStorageKey(e));if("string"!=typeof t)return null;{let r=new oo(t);return r.isExpired()?(d.e5.del(l.getProviderAccessTokenStorageKey(e)),null):r.value}}catch(e){return console.error(e),null}}get mightHaveServerCookies(){try{let e=Le.default.get(l.SESSION_COOKIE_KEY);return void 0!==e&&e.length>0}catch(e){console.error(e)}return!1}hasRefreshCredentials(){return this.mightHaveServerCookies||"string"==typeof this.token&&"string"==typeof this.refreshToken&&this.refreshToken!==l.DEPRECATED_REFRESH_TOKEN}hasRecoveryCredentials(){return"string"==typeof this.forkedToken}hasActiveToken(){let e=oo.parse(this.token);return null!==e&&!e.isExpired(30)}authenticate(e){return this.authenticateOnce.execute(e)}link(e){return this.linkOnce.execute(e)}refresh(){return this.refreshOnce.execute()}forkSession(){return this.forkSessionOnce.execute()}destroy(){return this.destroyOnce.execute()}storeProviderAccessToken(e,t){"string"==typeof t?d.e5.put(l.getProviderAccessTokenStorageKey(e),t):d.e5.del(l.getProviderAccessTokenStorageKey(e))}async _authenticate(e){try{let t=await e.authenticate(),{user:r,is_new_user:n,oauth_tokens:i}=t;this.handleTokenResponse(t);let a=i?{provider:i.provider,accessToken:i.access_token,accessTokenExpiresInSeconds:i.access_token_expires_in_seconds,refreshToken:i.refresh_token,refreshTokenExpiresInSeconds:i.refresh_token_expires_in_seconds,scopes:i.scopes}:void 0,o=function(e){return e instanceof Mi?"email":e instanceof va?"sms":e instanceof fa?"siwe":e instanceof Vi?"guest":e instanceof Ii?"custom_auth":e instanceof Ji?e.meta.provider:null}(e);return o&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate",payload:{method:o,isNewUser:n}}),"siwe"===o&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate_siwe",payload:{connectorType:e.meta.connectorType,walletClientType:e.meta.walletClientType}}),{user:u.convertUserResponseToUser(r),isNewUser:n,oAuthTokens:a}}catch(e){throw console.warn("Error authenticating session"),o.formatPrivyError(e)}}async _link(e){try{let t=await e.link(),r=t.oauth_tokens,n=r?{provider:r.provider,accessToken:r.access_token,accessTokenExpiresInSeconds:r.access_token_expires_in_seconds,refreshToken:r.refresh_token,refreshTokenExpiresInSeconds:r.refresh_token_expires_in_seconds,scopes:r.scopes}:void 0;return{user:u.convertUserResponseToUser(t),oAuthTokens:n}}catch(e){throw console.warn("Error linking account"),o.formatPrivyError(e)}}async _refresh(){if(!this.api)throw new o.PrivyClientError("Session has no API instance");if(!this.client)throw new o.PrivyClientError("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let e=this.token,t=this.refreshToken,r=this.forkedToken;if(this.client.useServerCookies&&!this.mightHaveServerCookies&&this.token&&window.location.origin===this.client.apiUrl)return this.destroyLocalState(),null;try{let n;if(e&&t||this.mightHaveServerCookies){let i={};e&&(i.authorization=`Bearer ${e}`),n=await this.api.post(ji,t?{refresh_token:t}:{},{headers:i}),r&&this.clearForkedToken()}else{if(!r)return null;n=await this.api.post(Ti,{refresh_token:r}),this.clearForkedToken()}return this.handleTokenResponse(n),u.convertUserResponseToUser(n.user)}catch(e){if(e instanceof o.PrivyApiError&&e.privyErrorCode===o.PrivyErrorCode.MISSING_OR_INVALID_TOKEN)return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw o.formatPrivyError(e)}}handleTokenResponse(e){e.session_update_action?"set"===e.session_update_action?(this.storeRefreshToken(e.refresh_token),this.storeToken(e.token),e.identity_token&&this.storeIdentityToken(e.identity_token)):"clear"===e.session_update_action?this.destroyLocalState():"ignore"===e.session_update_action&&e.token&&(this.storeToken(e.token),e.identity_token&&this.storeIdentityToken(e.identity_token)):(this.storeRefreshToken(e.refresh_token),this.storeToken(e.token),e.identity_token&&this.storeIdentityToken(e.identity_token))}async _destroy(){try{await(this.api?.post($i,{refresh_token:this.refreshToken}))}catch(e){console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new o.PrivyClientError("Session has no API instance");let e=this.refreshToken;try{let t=await this.api.post("/api/v1/sessions/fork",{refresh_token:e});return this.storeRefreshToken(t.refresh_token),this.storeToken(t.token),t.new_session_refresh_token}catch(e){throw o.formatPrivyError(e)}}destroyLocalState(){this.storeRefreshToken(null),this.storeToken(null),this.clearIdentityToken(),this.clearForkedToken()}storeToken(e){if("string"==typeof e){let t=d.e5.get(l.TOKEN_STORAGE_KEY);if(d.e5.put(l.TOKEN_STORAGE_KEY,e),!this.client?.useServerCookies){let t=oo.parse(e)?.expiration;Le.default.set(l.TOKEN_COOKIE_KEY,e,{sameSite:"Strict",secure:ao(),expires:t?new Date(1e3*t):void 0})}t!==e&&this.client?.onStoreToken?.(e)}else d.e5.del(l.TOKEN_STORAGE_KEY),Le.default.remove(l.TOKEN_COOKIE_KEY),this.client?.onDeleteToken?.()}storeRefreshToken(e){"string"==typeof e?(d.e5.put(l.REFRESH_TOKEN_STORAGE_KEY,e),this.client?.useServerCookies||Le.default.set(l.SESSION_COOKIE_KEY,"t",{sameSite:"Strict",secure:ao(),expires:30})):(d.e5.del(l.REFRESH_TOKEN_STORAGE_KEY),Le.default.remove(l.REFRESH_TOKEN_COOKIE_KEY),Le.default.remove(l.SESSION_COOKIE_KEY))}storeIdentityToken(e){if(this.client?.useServerCookies)return;d.e5.put(l.IDENTITY_TOKEN_STORAGE_KEY,e);let t=oo.parse(e)?.expiration;Le.default.set(l.IDENTITY_TOKEN_COOKIE_KEY,e,{sameSite:"Strict",secure:ao(),expires:t?new Date(1e3*t):void 0})}clearIdentityToken(){d.e5.del(l.IDENTITY_TOKEN_STORAGE_KEY),Le.default.remove(l.IDENTITY_TOKEN_COOKIE_KEY)}clearForkedToken(){d.e5.del(l.FORKED_TOKEN_STORAGE_KEY)}constructor(){this.authenticateOnce=new Gi((async e=>this._authenticate(e))),this.linkOnce=new Gi((async e=>this._link(e))),this.refreshOnce=new Gi(this._refresh.bind(this)),this.destroyOnce=new Gi(this._destroy.bind(this)),this.forkSessionOnce=new Gi(this._forkSession.bind(this))}}let lo;var co=0,uo="__private_"+co+++"__getOrGenerateClientAnalyticsId";class ho{initializeConnectorManager({walletConnectCloudProjectId:e,rpcConfig:t,chains:r,defaultChain:n,store:i,walletList:a,shouldEnforceDefaultChainOnConnect:o,externalWalletConfig:s,appName:l}){this.connectors||(this.connectors=new eo(this.appId,e,t,r,n,i,a,o,s,l))}sessionHasActiveToken(){return this.session.hasActiveToken()}generateApi(){let e=new io({appId:this.appId,appClientId:this.appClientId,client:this,defaults:{baseURL:this.apiUrl,timeout:this.timeout}});return this.session.api=e,e}updateApiUrl(e){this.apiUrl=e||this.fallbackApiUrl,this.api=this.generateApi(),e&&(this.useServerCookies=!0)}authenticate(){if(!this.authFlow)throw new o.PrivyClientError("No auth flow in progress.");return this.session.authenticate(this.authFlow)}async link(){if(!this.authFlow)throw new o.PrivyClientError("No auth flow in progress.");let{oAuthTokens:e}=await this.session.link(this.authFlow);return{user:await this.getAuthenticatedUser(),oAuthTokens:e}}storeProviderAccessToken(e,t){this.session.storeProviderAccessToken(e,t)}getProviderAccessToken(e){return this.session.getProviderAccessToken(e)}async logout(){await this.session.destroy(),this.authFlow=void 0}clearProviderAcccessTokens(e){e.linkedAccounts.filter((e=>"cross_app"===e.type)).forEach((e=>{this.storeProviderAccessToken(e.providerApp.id,null)}))}startAuthFlow(e){return e.api=this.api,this.authFlow=e,this.authFlow}async initMfaSmsVerification(){try{await this.api.post("/api/v1/mfa/passwordless_sms/init",{action:"verify"})}catch(e){throw o.formatApiError(e)}}async initMfaPasskeyVerification(){try{return(e=>({challenge:e.challenge,allowCredentials:e.allow_credentials?.map((e=>({id:e.id,type:e.type,transports:e.transports})))||[],timeout:e.timeout,extensions:{appid:e.extensions?.app_id,credProps:e.extensions?.cred_props,hmacCreateSecret:e.extensions?.hmac_create_secret},userVerification:e.user_verification}))((await this.api.post("/api/v1/mfa/passkeys/init",{})).options)}catch(e){throw o.formatApiError(e)}}async acceptTerms(){try{let e=await this.api.post("/api/v1/users/me/accept_terms",{});return u.convertUserResponseToUser(e)}catch(e){throw o.formatPrivyError(e)}}async unlinkEmail(e){try{let t=await this.api.post("/api/v1/passwordless/unlink",{address:e});return await this.getAuthenticatedUser()??u.convertUserResponseToUser(t)}catch(e){throw o.formatPrivyError(e)}}async unlinkPhone(e){try{let t=await this.api.post("/api/v1/passwordless_sms/unlink",{phoneNumber:e});return await this.getAuthenticatedUser()??u.convertUserResponseToUser(t)}catch(e){throw o.formatPrivyError(e)}}async unlinkEthereumWallet(e){try{let t=await this.api.post("/api/v1/siwe/unlink",{address:e});return await this.getAuthenticatedUser()??u.convertUserResponseToUser(t)}catch(e){throw o.formatPrivyError(e)}}async unlinkSolanaWallet(e){try{let t=await this.api.post("/api/v1/siws/unlink",{address:e});return await this.getAuthenticatedUser()??u.convertUserResponseToUser(t)}catch(e){throw o.formatPrivyError(e)}}async unlinkOAuth(e,t){try{let r=await this.api.post("/api/v1/oauth/unlink",{provider:e,subject:t});return await this.getAuthenticatedUser()??u.convertUserResponseToUser(r)}catch(e){throw o.formatPrivyError(e)}}async unlinkFarcaster(e){try{let t=await this.api.post("/api/v1/farcaster/unlink",{fid:e});return await this.getAuthenticatedUser()??u.convertUserResponseToUser(t)}catch(e){throw o.formatPrivyError(e)}}async unlinkTelegram(e){try{let t=await this.api.post("/api/v1/telegram/unlink",{telegram_user_id:e});return await this.getAuthenticatedUser()??u.convertUserResponseToUser(t)}catch(e){throw o.formatPrivyError(e)}}async unlinkPasskey(e){try{let t=await this.api.post("/api/v1/passkeys/unlink",{credential_id:e});return await this.getAuthenticatedUser()??u.convertUserResponseToUser(t)}catch(e){throw o.formatPrivyError(e)}}async createAnalyticsEvent({eventName:e,payload:t,timestamp:r,options:n}){if("undefined"!=typeof window)try{this.clientAnalyticsId||console.warn("No client analytics id set, refusing to send analytics event"),await this.api.post(Ni,{event_name:e,client_id:this.clientAnalyticsId,payload:{...t||{},clientTimestamp:r?r.toISOString():(new Date).toISOString()}},{retry:-1,keepalive:n?.keepAlive??!1})}catch(e){}}async signMoonpayOnRampUrl(e){try{return this.api.post("/api/v1/plugins/moonpay_on_ramp/sign",e)}catch(e){throw o.formatPrivyError(e)}}async initCoinbaseOnRamp(e){try{return this.api.post("/api/v1/funding/coinbase_on_ramp/init",e)}catch(e){throw o.formatPrivyError(e)}}async getCoinbaseOnRampStatus({partnerUserId:e}){try{return this.api.get(`/api/v1/funding/coinbase_on_ramp/status?partnerUserId=${e}`)}catch(e){throw o.formatPrivyError(e)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(e){return this.session.hasActiveToken()?this.session.hasRefreshCredentials()?oo.parse(this.session.token)?.audience!==this.appId?(await this.logout(),null):this.session.token:(this.session.destroyLocalState(),null):!e?.disableAutoRefresh&&this.session.hasRefreshCredentials()?(await this.session.refresh(),this.session.token):null}async getSmartWalletsConfig(){try{let e={},t=this.session.token;t&&(e.authorization=`Bearer ${t}`);let r=await this.api.get(`/api/v1/apps/${this.appId}/smart_wallets`,{baseURL:this.fallbackApiUrl,headers:e});return r.enabled?{enabled:r.enabled,smartWalletType:r.smart_wallet_type,configuredNetworks:r.configured_networks.map((e=>({chainId:e.chain_id,bundlerUrl:e.bundler_url,paymasterUrl:e.paymaster_url})))}:{enabled:r.enabled}}catch(e){throw o.formatPrivyError(e)}}async getServerConfig(){try{let e={},t=this.session.token;t&&(e.authorization=`Bearer ${t}`);let r=await this.api.get(`/api/v1/apps/${this.appId}`,{baseURL:this.fallbackApiUrl,headers:e}),n=r.telegram_auth_config?{botId:r.telegram_auth_config.bot_id,botName:r.telegram_auth_config.bot_name,linkEnabled:r.telegram_auth_config.link_enabled,seamlessAuthEnabled:r.telegram_auth_config.seamless_auth_enabled}:void 0,i=r.funding_config?{methods:r.funding_config.methods,defaultRecommendedAmount:r.funding_config.default_recommended_amount,defaultRecommendedCurrency:r.funding_config.default_recommended_currency,promptFundingOnWalletCreation:r.funding_config.prompt_funding_on_wallet_creation}:void 0;return{id:r.id,name:r.name,verificationKey:r.verification_key,logoUrl:r.logo_url||void 0,accentColor:r.accent_color||void 0,showWalletLoginFirst:r.show_wallet_login_first,allowlistConfig:{errorTitle:r.allowlist_config.error_title,errorDetail:r.allowlist_config.error_detail,errorCtaText:r.allowlist_config.cta_text,errorCtaLink:r.allowlist_config.cta_link},walletAuth:r.wallet_auth,emailAuth:r.email_auth,smsAuth:r.sms_auth,googleOAuth:r.google_oauth,twitterOAuth:r.twitter_oauth,discordOAuth:r.discord_oauth,githubOAuth:r.github_oauth,spotifyOAuth:r.spotify_oauth,instagramOAuth:r.instagram_oauth,tiktokOAuth:r.tiktok_oauth,linkedinOAuth:r.linkedin_oauth,appleOAuth:r.apple_oauth,farcasterAuth:r.farcaster_auth,passkeyAuth:r.passkey_auth,telegramAuth:r.telegram_auth,termsAndConditionsUrl:r.terms_and_conditions_url,embeddedWalletConfig:{createOnLogin:r.embedded_wallet_config?.create_on_login,userOwnedRecoveryOptions:r.embedded_wallet_config.user_owned_recovery_options,requireUserOwnedRecoveryOnCreate:r.embedded_wallet_config.require_user_owned_recovery_on_create},privacyPolicyUrl:r.privacy_policy_url,requireUsersAcceptTerms:r.require_users_accept_terms,customApiUrl:r.custom_api_url,walletConnectCloudProjectId:r.wallet_connect_cloud_project_id,fiatOnRampEnabled:r.fiat_on_ramp_enabled,captchaEnabled:r.captcha_enabled,captchaSiteKey:r.captcha_site_key,createdAt:new Date(1e3*r.created_at),updatedAt:new Date(1e3*r.updated_at),mfaMethods:r.mfa_methods,enforceWalletUis:r.enforce_wallet_uis,legacyWalletUiConfig:r.legacy_wallet_ui_config,telegramAuthConfiguration:n,fundingConfig:i}}catch(e){throw o.formatPrivyError(e)}}async getUsdTokenPrice(e){try{return(await this.api.get(`/api/v1/token_price?chainId=${e.id}&tokenSymbol=${e.nativeCurrency.symbol}`)).usd}catch(t){return void console.error(`Unable to fetch token price for chain with id ${e.id}`)}}async getUsdPriceForSol(){try{return(await this.api.get("/api/v1/token_price?chainId=0&tokenSymbol=SOL")).usd}catch(e){return void console.error("Unable to fetch token price for SOL")}}async requestFarcasterSignerStatus(e){try{return await this.api.post("/api/v1/farcaster/signer/status",{ed25519_public_key:e})}catch(e){throw console.error("Unable to fetch Farcaster signer status"),e}}async forkSession(){return await this.session.forkSession()}async generateSiweNonce({address:e,captchaToken:t}){try{return(await this.api.post("/api/v1/siwe/init",{address:e,token:t})).nonce}catch(e){throw o.formatPrivyError(e)}}async authenticateWithSiweInternal({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i,mode:a}){return await this.api.post("/api/v1/siwe/authenticate",{message:e,signature:t,chainId:r,walletClientType:n,connectorType:i,mode:a})}async linkWithSiweInternal({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i}){return await this.api.post("/api/v1/siwe/link",{message:e,signature:t,chainId:r,walletClientType:n,connectorType:i})}async linkSmartWallet({message:e,signature:t,smartWalletType:r}){try{let n=await this.api.post("/api/v1/siwe/link_smart_wallet",{message:e,signature:t,smart_wallet_type:r});return u.convertUserResponseToUser(n)}catch(e){throw o.formatPrivyError(e)}}async linkWithSiwe({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i}){try{let a=await this.linkWithSiweInternal({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i});return u.convertUserResponseToUser(a)}catch(e){throw o.formatPrivyError(e)}}async generateSiwsNonce({address:e,captchaToken:t}){try{return(await this.api.post("/api/v1/siws/init",{address:e,token:t})).nonce}catch(e){throw o.formatPrivyError(e)}}async authenticateWithSiwsInternal({message:e,signature:t,walletClientType:r,connectorType:n,mode:i}){return await this.api.post("/api/v1/siws/authenticate",{message:e,signature:t,walletClientType:r,connectorType:n,mode:i})}async sendAccountTransferRequest({nonce:e,account:t,accountType:r,externalWalletMetadata:n,telegramAuthResult:i,farcasterEmbeddedAddress:a,oAuthUserInfo:s}){try{let o,l;switch(r){case"email":o="/api/v1/passwordless/transfer",l={nonce:e,email:t};break;case"sms":o="/api/v1/passwordless_sms/transfer",l={nonce:e,phoneNumber:t};break;case"siwe":if(o="/api/v1/siwe/transfer",!n)throw Error("Wallet parameters must be defined");l={nonce:e,address:t,...n};break;case"farcaster":o="/api/v1/farcaster/transfer",l={nonce:e,farcaster_id:t,farcaster_embedded_address:a};break;case"telegram":o="/api/v1/telegram/transfer",l={nonce:e,telegram_auth_result:i};break;case"custom":case"guest":case"passkey":throw Error("Invalid transfer account type");default:o="/api/v1/oauth/transfer",l={nonce:e,userInfo:s}}let d=await this.api.post(o,l);return await this.getAuthenticatedUser()??u.convertUserResponseToUser(d)}catch(e){throw o.formatPrivyError(e)}}async linkWithSiwsInternal({message:e,signature:t,walletClientType:r,connectorType:n}){return await this.api.post("/api/v1/siws/link",{message:e,signature:t,walletClientType:r,connectorType:n})}async linkWithSiws({message:e,signature:t,walletClientType:r,connectorType:n}){try{let i=await this.linkWithSiwsInternal({message:e,signature:t,walletClientType:r,connectorType:n});return u.convertUserResponseToUser(i)}catch(e){throw o.formatPrivyError(e)}}constructor(e){Object.defineProperty(this,uo,{value:po}),this.apiUrl=e.apiUrl||l.DEFAULT_PRIVY_API_URL,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!!e.apiUrl&&e.apiUrl.startsWith("https://privy."),this.timeout=e.timeout||l.DEFAULT_API_TIMEOUT_MS,this.appId=e.appId,this.appClientId=e.appClientId,this.clientAnalyticsId=function(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}(this,uo)[uo](),lo||(lo=new so),this.session=lo,this.api=this.generateApi(),this.session.client=this}}function po(){if("undefined"==typeof window)return null;try{let e=d.e5.get(l.CLIENT_ANALYTICS_ID_KEY);if("string"==typeof e&&e.length>0)return e}catch(e){}let e=c.v4();try{return d.e5.put(l.CLIENT_ANALYTICS_ID_KEY,e),e}catch(t){return e}}const yo=i.createContext({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:o.notImplemented,setError:o.notImplemented,setExecuting:o.notImplemented,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:o.notImplemented,reset:o.notImplemented,execute:o.notImplemented});class mo extends o.PrivyError{constructor(e,t,r){super(e||"Captcha failed"),this.type="Captcha",t instanceof Error&&(this.cause=t),this.privyErrorCode=r}}const fo=({children:t,id:r,captchaSiteKey:n,captchaEnabled:a})=>{let s=i.useRef(null),[l,c]=i.useState(),[u,h]=i.useState(),[p,y]=i.useState(!1),m=i.useMemo((()=>a?p||l||u?!p||l||u?l&&!u?{status:"success",token:l}:u?{status:"error",error:u}:{status:"ready"}:{status:"loading"}:{status:"ready"}:{status:"disabled"}),[a,l,u,p]);return e.jsx(yo.Provider,{value:{...m,ref:s,enabled:a,siteKey:n,appId:r,setToken:c,setError:h,setExecuting:y,remove(){a&&(s.current?.remove(),y(!1),h(void 0),c(void 0))},reset(){a&&(s.current?.reset(),y(!1),h(void 0),c(void 0))},execute(){a&&(y(!0),s.current?.execute())},async waitForResult(){if(!a)return"";try{return await d.pollForResult((()=>s.current?.getResponse()),{interval:200,timeout:2e4})}catch(e){throw new mo("Captcha failed",null,o.PrivyErrorCode.CAPTCHA_TIMEOUT)}}},children:t})},go=()=>i.useContext(yo),vo=t=>{let{enabled:r,siteKey:n,appId:a,setError:o,setToken:s,setExecuting:l,ref:d}=go(),[,c]=i.useMemo((()=>n?.split("t:")||[]),[n]);if(i.useEffect((()=>d.current?.remove),[]),!r)return null;if(!c)throw Error("Unsupported captcha site key");return e.jsx("div",{className:"hidden h-0 w-0",children:e.jsx(x.Turnstile,{...t,ref:d,siteKey:c,options:{action:a,size:"invisible",...t.delayedExecution?{appearance:"execute",execution:"execute"}:{appearance:"always",execution:"render"}},onUnsupported:()=>{t.onUnsupported?.(),console.warn("Browser does not support Turnstile.")},onError:()=>{t.onError?.(),o("Captcha failed"),l(!1)},onSuccess:e=>{t.onSuccess?.(e),s(e),l(!1)},onExpire:()=>{t.onExpire?.();try{d.current?.reset(),o(void 0),s(void 0)}catch(e){o("expired_and_failed_reset")}}})})};function wo(e){d.usePrivyEventSubscription("configureMfa",e)}const xo=({success:t,fail:r})=>e.jsxs(e.Fragment,{children:[e.jsx(Co,{className:t?"success":r?"fail":""}),e.jsx(Eo,{className:t?"success":r?"fail":""})]}),Co=C.styled.span`
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("@ethersproject/address"),r=require("@ethersproject/providers"),n=require("mipd"),i=require("react"),a=require("react-device-detect"),o=require("./privy-context.js"),s=require("jose"),l=require("./useWallets.js"),d=require("./useFundWallet.js"),c=require("uuid"),u=require("./user.js"),h=require("@ethersproject/bytes"),p=require("eventemitter3"),y=require("@coinbase/wallet-sdk"),m=require("./useSolanaWallets.js"),f=require("@walletconnect/ethereum-provider"),g=require("./getEmbeddedConnectedWallet.js"),v=require("ofetch"),w=require("js-cookie"),x=require("@marsidev/react-turnstile"),C=require("styled-components"),E=require("@heroicons/react/24/outline/QuestionMarkCircleIcon"),b=require("@heroicons/react/24/outline/ArrowLeftIcon"),S=require("@heroicons/react/24/outline/ArrowRightIcon"),A=require("@heroicons/react/24/outline/XMarkIcon"),j=require("@heroicons/react/24/outline/ExclamationTriangleIcon"),$=require("@heroicons/react/24/outline/WalletIcon"),T=require("@heroicons/react/24/outline"),P=require("@heroicons/react/24/outline/ArrowTopRightOnSquareIcon"),_=require("@heroicons/react/24/solid/DocumentCheckIcon"),k=require("@heroicons/react/20/solid/CheckIcon"),N=require("@heroicons/react/24/outline/EnvelopeIcon"),I=require("@heroicons/react/24/outline/PhoneIcon"),M=require("@heroicons/react/24/solid/CheckCircleIcon"),O=require("@heroicons/react/24/solid/XCircleIcon"),R=require("fast-password-entropy"),F=require("secure-password-utilities"),L=require("secure-password-utilities/wordlists"),U=require("@heroicons/react/24/outline/ArrowPathIcon"),D=require("@heroicons/react/24/outline/EyeIcon"),W=require("@heroicons/react/24/outline/EyeSlashIcon"),B=require("@heroicons/react/24/outline/KeyIcon"),H=require("@heroicons/react/24/outline/ArrowDownTrayIcon"),G=require("@heroicons/react/24/outline/ClipboardDocumentCheckIcon"),q=require("@heroicons/react/24/outline/DocumentDuplicateIcon"),z=require("@heroicons/react/24/outline/UserCircleIcon"),V=require("@heroicons/react/24/solid/LockClosedIcon"),K=require("qrcode"),Y=require("@heroicons/react/24/outline/CheckCircleIcon"),Z=require("viem"),X=require("@heroicons/react/24/outline/GlobeAltIcon"),J=require("@headlessui/react"),Q=require("@heroicons/react/24/outline/ClockIcon"),ee=require("@heroicons/react/24/outline/TrashIcon"),te=require("@heroicons/react/24/solid/CheckBadgeIcon"),re=require("@heroicons/react/24/solid/ArrowsRightLeftIcon"),ne=require("@heroicons/react/24/outline/PencilIcon"),ie=require("@ethersproject/units"),ae=require("@heroicons/react/24/outline/InformationCircleIcon"),oe=require("@heroicons/react/24/outline/QrCodeIcon"),se=require("@heroicons/react/24/outline/LinkIcon"),le=require("@heroicons/react/24/outline/ChevronRightIcon"),de=require("@heroicons/react/24/solid/DevicePhoneMobileIcon"),ce=require("@heroicons/react/24/solid/IdentificationIcon"),ue=require("@heroicons/react/24/solid/PhoneIcon"),he=require("@heroicons/react/24/solid/QuestionMarkCircleIcon"),pe=require("@heroicons/react/24/solid/ShieldCheckIcon"),ye=require("@heroicons/react/24/outline/DevicePhoneMobileIcon"),me=require("@heroicons/react/24/outline/FingerPrintIcon"),fe=require("@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon"),ge=require("@heroicons/react/24/outline/ShieldCheckIcon"),ve=require("@ethersproject/abstract-signer"),we=require("@ethersproject/bignumber"),xe=require("@ethersproject/contracts"),Ce=require("@ethersproject/transactions"),Ee=require("fetch-retry"),be=require("@heroicons/react/24/outline/ChevronDownIcon"),Se=require("@heroicons/react/24/outline/CalendarIcon"),Ae=require("@heroicons/react/24/outline/LockClosedIcon"),je=require("@heroicons/react/24/outline/PencilSquareIcon"),$e=require("@solana/wallet-adapter-base"),Te=require("@heroicons/react/24/outline/ClipboardDocumentIcon"),Pe=require("@heroicons/react/24/outline/ExclamationCircleIcon"),_e=require("@ethersproject/logger"),ke=require("@ethersproject/strings");function Ne(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function Ie(e){if(e&&"object"==typeof e&&"default"in e)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}require("tinycolor2"),require("@heroicons/react/24/outline/Square2StackIcon");var Me=Ne(i),Oe=Ie(a),Re=Ie(s),Fe=Ne(p),Le=Ne(w),Ue=Ne(E),De=Ne(b),We=Ne(S),Be=Ne(A),He=Ne(j),Ge=Ne($),qe=Ne(P),ze=Ne(_),Ve=Ne(k),Ke=Ne(N),Ye=Ne(I),Ze=Ne(M),Xe=Ne(O),Je=Ne(R),Qe=Ie(F),et=Ne(U),tt=Ne(D),rt=Ne(W),nt=Ne(B),it=Ne(H),at=Ne(G),ot=Ne(q),st=Ne(z),lt=Ne(V),dt=Ne(K),ct=Ne(Y),ut=Ne(X),ht=Ne(Q),pt=Ne(ee),yt=Ne(te),mt=Ne(re),ft=Ne(ne),gt=Ne(ae),vt=Ne(oe),wt=Ne(se),xt=Ne(le),Ct=Ne(de),Et=Ne(ce),bt=Ne(ue),St=Ne(he),At=Ne(pe),jt=Ne(ye),$t=Ne(me),Tt=Ne(fe),Pt=Ne(ge),_t=Ne(Ee),kt=Ne(be),Nt=Ne(Se),It=Ne(Ae),Mt=Ne(je),Ot=Ne(Te),Rt=Ne(Pe);let Ft={id:42161,name:"Arbitrum One",network:"arbitrum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-mainnet.rpc.privy.systems"]},alchemy:{http:["https://arb-mainnet.g.alchemy.com/v2"],webSocket:["wss://arb-mainnet.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-mainnet.infura.io/v3"],webSocket:["wss://arbitrum-mainnet.infura.io/ws/v3"]},default:{http:["https://arb1.arbitrum.io/rpc"]},public:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://arbiscan.io"},default:{name:"Arbiscan",url:"https://arbiscan.io"}}},Lt={id:421613,name:"Arbitrum Goerli",network:"arbitrum-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"AGOR",decimals:18},rpcUrls:{default:{http:["https://goerli-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"}},testnet:!0},Ut={id:421614,name:"Arbitrum Sepolia",network:"arbitrum-sepolia",nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]},public:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia-explorer.arbitrum.io"}},testnet:!0},Dt={id:8453,network:"base",name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-mainnet.rpc.privy.systems"]},blast:{http:["https://base-mainnet.blastapi.io"],webSocket:["wss://base-mainnet.blastapi.io"]},default:{http:["https://mainnet.base.org"]},public:{http:["https://mainnet.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://basescan.org"},default:{name:"Basescan",url:"https://basescan.org"}}},Wt={id:84531,network:"base-goerli",name:"Base Goerli Testnet",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://goerli.base.org"]}},blockExplorers:{default:{name:"Basescan",url:"https://goerli.basescan.org"}},testnet:!0},Bt={id:84532,network:"base-sepolia",name:"Base Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.base.org"]},public:{http:["https://sepolia.base.org"]}},blockExplorers:{default:{name:"Blockscout",url:"https://base-sepolia.blockscout.com"}},testnet:!0},Ht={id:10,name:"OP Mainnet",network:"optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-mainnet.rpc.privy.systems"]},alchemy:{http:["https://opt-mainnet.g.alchemy.com/v2"],webSocket:["wss://opt-mainnet.g.alchemy.com/v2"]},infura:{http:["https://optimism-mainnet.infura.io/v3"],webSocket:["wss://optimism-mainnet.infura.io/ws/v3"]},default:{http:["https://mainnet.optimism.io"]},public:{http:["https://mainnet.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://optimistic.etherscan.io"},default:{name:"Optimism Explorer",url:"https://explorer.optimism.io"}}},Gt={id:420,name:"Optimism Goerli Testnet",network:"optimism-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://goerli.optimism.io"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"}},testnet:!0},qt={id:11155420,name:"Optimism Sepolia",network:"optimism-sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.optimism.io"]},public:{http:["https://sepolia.optimism.io"]},infura:{http:["https://optimism-sepolia.infura.io/v3"]}},blockExplorers:{default:{name:"Blockscout",url:"https://optimism-sepolia.blockscout.com"}},testnet:!0},zt={id:137,name:"Polygon Mainnet",network:"polygon",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{privy:{http:["https://polygon-mainnet.rpc.privy.systems"]},alchemy:{http:["https://polygon-mainnet.g.alchemy.com/v2"],webSocket:["wss://polygon-mainnet.g.alchemy.com/v2"]},infura:{http:["https://polygon-mainnet.infura.io/v3"],webSocket:["wss://polygon-mainnet.infura.io/ws/v3"]},default:{http:["https://polygon-rpc.com"]},public:{http:["https://polygon-rpc.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://polygonscan.com"},default:{name:"PolygonScan",url:"https://polygonscan.com"}}},Vt={id:80001,name:"Mumbai",network:"maticmum",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{default:{http:["https://matic-mumbai.chainstacklabs.com"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://mumbai.polygonscan.com"}},testnet:!0},Kt={id:7777777,name:"Zora",network:"zora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]},public:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.zora.energy"}}},Yt={id:999999999,name:"Zora Sepolia",network:"zora-sepolia",nativeCurrency:{decimals:18,name:"Zora Sepolia",symbol:"ETH"},rpcUrls:{default:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]},public:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]}},blockExplorers:{default:{name:"Zora Sepolia Explorer",url:"https://sepolia.explorer.zora.energy/"}},testnet:!0},Zt={id:999,name:"Zora Goerli Testnet",network:"zora-testnet",nativeCurrency:{decimals:18,name:"Zora Goerli",symbol:"ETH"},rpcUrls:{default:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]},public:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.explorer.zora.energy"}},testnet:!0},Xt=e=>[Ft.id,Lt.id,Ut.id].includes(e),Jt=e=>[56,97].includes(e),Qt="0x420000000000000000000000000000000000000F",er=["function getL1Fee(bytes memory _data) external view returns (uint256)"],tr=e=>[Dt.id,Wt.id,Bt.id,Ht.id,Gt.id,qt.id,Kt.id,Zt.id,Yt.id,81457,168587773].includes(e);let rr={id:80002,name:"Polygon Amoy",network:"polygon-amoy",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{privy:{http:["https://polygon-amoy.rpc.privy.systems"]},infura:{http:["https://polygon-amoy.infura.io/v3"],webSocket:["wss://polygon-amoy.infura.io/ws/v3"]},default:{http:["https://rpc-amoy.polygon.technology"]}},blockExplorers:{default:{name:"OK LINK",url:"https://www.oklink.com/amoy"}},testnet:!0},nr=_t.default(fetch,{retries:3,retryDelay:500}),ir=e=>[zt.id,Vt.id,rr.id].includes(e),ar=e=>({maxPriorityFee:ie.parseUnits(e.maxPriorityFee.toFixed(9),"gwei").toHexString(),maxFee:ie.parseUnits(e.maxFee.toFixed(9),"gwei").toHexString()}),or=async e=>{let t="";switch(e){case zt.id:t="https://gasstation.polygon.technology/v2";break;case Vt.id:t="https://gasstation-testnet.polygon.technology/v2";break;case rr.id:t="https://gasstation.polygon.technology/amoy";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}let r=await nr(t),n=await r.json();if(r.status>399)throw n;return{safeLow:ar(n.safeLow),standard:ar(n.standard),fast:ar(n.fast)}};async function sr(e,t){if(!e.gasLimit)throw new m.l("gasLimit was not successfully set for transaction.");let r=d.i(e.gasLimit),n=we.BigNumber.from(0);if(2==e.type){if(!e.maxFeePerGas)throw new m.l("maxFeePerGas was not successfully set for transaction of type 2.");n=d.i(e.maxFeePerGas)}else{if(!e.gasPrice)throw new m.l("gasPrice was not successfully set for transaction of type 0 or 1.");n=d.i(e.gasPrice)}let i=r.mul(n),a=we.BigNumber.from(0);if(e.chainId&&tr(e.chainId))try{a=await async function(e,t){if(!e.chainId||e.chainId&&!tr(e.chainId))return we.BigNumber.from(0);let r=we.BigNumber.from(0);try{let n=new xe.Contract(Qt,er,t),i=d.r(e),a=Ce.serialize(i);r=await n.getL1Fee(a)}catch(e){}return r}(e,t),i=i.add(a)}catch(e){}return{totalGasEstimate:i,l1ExecutionFeeEstimate:a}}function lr(e){return/^-?0x[a-f0-9]+$/i.test(e)}async function dr(e,t,r){if(t.chainId=Number(t.chainId),function(e){for(let t of["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"]){let r=e[t];if(void 0!==r&&!function(e){let t="number"==typeof e,r="bigint"==typeof e,n="string"==typeof e&&lr(e);return t||r||n}(r))throw Error(`Transaction request property '${t}' must be a valid number, bigint, or hex string representing a quantity`)}if("number"!=typeof e.chainId)throw Error("Transaction request property 'chainId' must be a number")}(t),t.from||(t.from=e),!t.nonce){let n=new ve.VoidSigner(e,r);t.nonce=await n.getTransactionCount("pending")}return t.gasLimit||(t.gas?(t.gasLimit=t.gas,delete t.gas):t.gasLimit=await async function(e,t){try{return(await t.estimateGas(e)).toHexString()}catch(r){let n;if("message"in r&&r.message.includes("insufficient funds")&&(console.warn(`Gas estimation failed with error: ${r}. Retrying gas estimation by omitting the 'value'`),n=await async function({txRequest:e,provider:t}){try{let r={...e,value:void 0};return(await t.estimateGas(r)).toHexString()}catch(e){return console.warn(`Gas estimation failed with error: ${e} when omitting the 'value'`),null}}({txRequest:e,provider:t})),n||(console.warn(`Gas estimation failed with error: ${r}. Retrying gas estimation by omitting the 'from'`),n=await async function({txRequest:e,provider:t}){try{let r={...e,from:void 0};return(await t.estimateGas(r)).toHexString()}catch(e){return console.warn(`Gas estimation failed with error: ${e} when omitting the 'from' address`),null}}({txRequest:e,provider:t})),!n)throw r;return n}}(t,r)),"string"==typeof t.type&&lr(t.type)&&(t.type=Number(t.type)),[23294,23295].includes(t.chainId)&&(t.type=0),0===(t=ir(t.chainId)?await async function(e){if(!ir(e.chainId))throw Error("Invalid chain ID for Polygon gas estimation.");if(void 0===e.type&&(e.type=2),e.maxPriorityFeePerGas&&e.maxFeePerGas)return e;try{let{standard:t}=await or(e.chainId);e.maxPriorityFeePerGas||(e.maxPriorityFeePerGas=t.maxPriorityFee),e.maxFeePerGas||(e.maxFeePerGas=t.maxFee),e.gasPrice&&(console.warn("`gasPrice` is not supported on this chain and will be ignored. Use `maxPriorityFeePerGas` and/or `maxFeePerGas` instead."),delete e.gasPrice)}catch(e){throw Error(`Failed to set gas prices from Polygon gas station with error: ${e}.`)}return e}(t):Xt(t.chainId)?await(async(e,t)=>{if(!Xt(e.chainId))throw Error("Invalid chain ID for Arbitrum gas estimation.");if(void 0===e.type&&(e.type=2),e.maxFeePerGas)return e;try{let{lastBaseFeePerGas:r}=await t.getFeeData();if(r){let t=r.mul(we.BigNumber.from(120)).div(we.BigNumber.from(100));e.maxFeePerGas=d.t(t),e.maxPriorityFeePerGas=d.t(we.BigNumber.from(0))}}catch(e){throw Error(`Failed to set gas price for Arbitrum transaction: ${e}.`)}return e})(t,r):tr(t.chainId)?await(async(e,t)=>{if(!tr(e.chainId))throw Error("Invalid chain ID for OP Stack gas estimation.");if(void 0===e.type&&(e.type=2),e.gasPrice&&(console.warn("`gasPrice` is not supported on this chain and will be ignored. Use `maxPriorityFeePerGas` and/or `maxFeePerGas` instead."),delete e.gasPrice),e.maxPriorityFeePerGas&&e.maxFeePerGas)return e;try{if(!e.maxPriorityFeePerGas){let r=await t.send("eth_maxPriorityFeePerGas",[]);e.maxPriorityFeePerGas=r}if(e.maxFeePerGas&&(console.warn("maxFeePerGas is specified without maxPriorityFeePerGas - this can result in hung transactions."),e.maxPriorityFeePerGas>=e.maxFeePerGas))throw Error("Overridden maxFeePerGas is less than or equal to the calculated maxPriorityFeePerGas. Please set both values or maxPriorityFeePerGas alone for correct gas estimation.");if(!e.maxFeePerGas){let{lastBaseFeePerGas:r}=await t.getFeeData();if(!r)throw Error("Unable to fetch baseFee for last block.");let n=we.BigNumber.from(r).mul(we.BigNumber.from(126)).div(we.BigNumber.from(100)).add(we.BigNumber.from(e.maxPriorityFeePerGas));e.maxFeePerGas=d.t(n)}}catch(e){throw Error(`Failed to set gas price for OP stack transaction: ${e}.`)}return e})(t,r):Jt(t.chainId)?await(async(e,t)=>{if(!Jt(e.chainId))throw Error("Invalid chain ID for BSC gas estimation.");if(void 0===e.type?e.type=0:1!=e.type&&2!=e.type||console.warn("Transaction request type specified is incompatible for chain and will result in undefined behavior. Please use transaction type 0."),!e.gasPrice){let r=await t.getFeeData();e.gasPrice=r.gasPrice?.toHexString()}return e})(t,r):await(async(e,t)=>{if(void 0===e.type&&(e.type=2),2===e.type){if(!e.maxFeePerGas||!e.maxPriorityFeePerGas){let r=await t.getFeeData();e.maxFeePerGas||(e.maxFeePerGas=r.maxFeePerGas?.toHexString()),e.maxPriorityFeePerGas||(e.maxPriorityFeePerGas=r.maxPriorityFeePerGas?.toHexString())}}else if(!e.gasPrice){let r=await t.getFeeData();e.gasPrice=r.gasPrice?.toHexString()}return e})(t,r)).type&&delete t.accessList,2!==t.type&&(delete t.maxPriorityFeePerGas,delete t.maxFeePerGas),t}var cr={AC:"40123",AD:"312345",AE:"501234567",AF:"701234567",AG:"2684641234",AI:"2642351234",AL:"672123456",AM:"77123456",AO:"923123456",AR:"91123456789",AS:"6847331234",AT:"664123456",AU:"412345678",AW:"5601234",AX:"412345678",AZ:"401234567",BA:"61123456",BB:"2462501234",BD:"1812345678",BE:"470123456",BF:"70123456",BG:"43012345",BH:"36001234",BI:"79561234",BJ:"90011234",BL:"690001234",BM:"4413701234",BN:"7123456",BO:"71234567",BQ:"3181234",BR:"11961234567",BS:"2423591234",BT:"17123456",BW:"71123456",BY:"294911911",BZ:"6221234",CA:"5062345678",CC:"412345678",CD:"991234567",CF:"70012345",CG:"061234567",CH:"781234567",CI:"0123456789",CK:"71234",CL:"221234567",CM:"671234567",CN:"13123456789",CO:"3211234567",CR:"83123456",CU:"51234567",CV:"9911234",CW:"95181234",CX:"412345678",CY:"96123456",CZ:"601123456",DE:"15123456789",DJ:"77831001",DK:"32123456",DM:"7672251234",DO:"8092345678",DZ:"551234567",EC:"991234567",EE:"51234567",EG:"1001234567",EH:"650123456",ER:"7123456",ES:"612345678",ET:"911234567",FI:"412345678",FJ:"7012345",FK:"51234",FM:"3501234",FO:"211234",FR:"612345678",GA:"06031234",GB:"7400123456",GD:"4734031234",GE:"555123456",GF:"694201234",GG:"7781123456",GH:"231234567",GI:"57123456",GL:"221234",GM:"3012345",GN:"601123456",GP:"690001234",GQ:"222123456",GR:"6912345678",GT:"51234567",GU:"6713001234",GW:"955012345",GY:"6091234",HK:"51234567",HN:"91234567",HR:"921234567",HT:"34101234",HU:"201234567",ID:"812345678",IE:"850123456",IL:"502345678",IM:"7924123456",IN:"8123456789",IO:"3801234",IQ:"7912345678",IR:"9123456789",IS:"6111234",IT:"3123456789",JE:"7797712345",JM:"8762101234",JO:"790123456",JP:"9012345678",KE:"712123456",KG:"700123456",KH:"91234567",KI:"72001234",KM:"3212345",KN:"8697652917",KP:"1921234567",KR:"1020000000",KW:"50012345",KY:"3453231234",KZ:"7710009998",LA:"2023123456",LB:"71123456",LC:"7582845678",LI:"660234567",LK:"712345678",LR:"770123456",LS:"50123456",LT:"61234567",LU:"628123456",LV:"21234567",LY:"912345678",MA:"650123456",MC:"612345678",MD:"62112345",ME:"67622901",MF:"690001234",MG:"321234567",MH:"2351234",MK:"72345678",ML:"65012345",MM:"92123456",MN:"88123456",MO:"66123456",MP:"6702345678",MQ:"696201234",MR:"22123456",MS:"6644923456",MT:"96961234",MU:"52512345",MV:"7712345",MW:"991234567",MX:"12221234567",MY:"123456789",MZ:"821234567",NA:"811234567",NC:"751234",NE:"93123456",NF:"381234",NG:"8021234567",NI:"81234567",NL:"612345678",NO:"40612345",NP:"9841234567",NR:"5551234",NU:"8884012",NZ:"211234567",OM:"92123456",PA:"61234567",PE:"912345678",PF:"87123456",PG:"70123456",PH:"9051234567",PK:"3012345678",PL:"512345678",PM:"551234",PR:"7872345678",PS:"599123456",PT:"912345678",PW:"6201234",PY:"961456789",QA:"33123456",RE:"692123456",RO:"712034567",RS:"601234567",RU:"9123456789",RW:"720123456",SA:"512345678",SB:"7421234",SC:"2510123",SD:"911231234",SE:"701234567",SG:"81234567",SH:"51234",SI:"31234567",SJ:"41234567",SK:"912123456",SL:"25123456",SM:"66661212",SN:"701234567",SO:"71123456",SR:"7412345",SS:"977123456",ST:"9812345",SV:"70123456",SX:"7215205678",SY:"944567890",SZ:"76123456",TA:"8999",TC:"6492311234",TD:"63012345",TG:"90112345",TH:"812345678",TJ:"917123456",TK:"7290",TL:"77212345",TM:"66123456",TN:"20123456",TO:"7715123",TR:"5012345678",TT:"8682911234",TV:"901234",TW:"912345678",TZ:"621234567",UA:"501234567",UG:"712345678",US:"2015550123",UY:"94231234",UZ:"912345678",VA:"3123456789",VC:"7844301234",VE:"4121234567",VG:"2843001234",VI:"3406421234",VN:"912345678",VU:"5912345",WF:"821234",WS:"7212345",XK:"43201234",YE:"712345678",YT:"639012345",ZA:"711234567",ZM:"955123456",ZW:"712345678"},ur={version:4,country_calling_codes:{1:["US","AG","AI","AS","BB","BM","BS","CA","DM","DO","GD","GU","JM","KN","KY","LC","MP","MS","PR","SX","TC","TT","VC","VG","VI"],7:["RU","KZ"],20:["EG"],27:["ZA"],30:["GR"],31:["NL"],32:["BE"],33:["FR"],34:["ES"],36:["HU"],39:["IT","VA"],40:["RO"],41:["CH"],43:["AT"],44:["GB","GG","IM","JE"],45:["DK"],46:["SE"],47:["NO","SJ"],48:["PL"],49:["DE"],51:["PE"],52:["MX"],53:["CU"],54:["AR"],55:["BR"],56:["CL"],57:["CO"],58:["VE"],60:["MY"],61:["AU","CC","CX"],62:["ID"],63:["PH"],64:["NZ"],65:["SG"],66:["TH"],81:["JP"],82:["KR"],84:["VN"],86:["CN"],90:["TR"],91:["IN"],92:["PK"],93:["AF"],94:["LK"],95:["MM"],98:["IR"],211:["SS"],212:["MA","EH"],213:["DZ"],216:["TN"],218:["LY"],220:["GM"],221:["SN"],222:["MR"],223:["ML"],224:["GN"],225:["CI"],226:["BF"],227:["NE"],228:["TG"],229:["BJ"],230:["MU"],231:["LR"],232:["SL"],233:["GH"],234:["NG"],235:["TD"],236:["CF"],237:["CM"],238:["CV"],239:["ST"],240:["GQ"],241:["GA"],242:["CG"],243:["CD"],244:["AO"],245:["GW"],246:["IO"],247:["AC"],248:["SC"],249:["SD"],250:["RW"],251:["ET"],252:["SO"],253:["DJ"],254:["KE"],255:["TZ"],256:["UG"],257:["BI"],258:["MZ"],260:["ZM"],261:["MG"],262:["RE","YT"],263:["ZW"],264:["NA"],265:["MW"],266:["LS"],267:["BW"],268:["SZ"],269:["KM"],290:["SH","TA"],291:["ER"],297:["AW"],298:["FO"],299:["GL"],350:["GI"],351:["PT"],352:["LU"],353:["IE"],354:["IS"],355:["AL"],356:["MT"],357:["CY"],358:["FI","AX"],359:["BG"],370:["LT"],371:["LV"],372:["EE"],373:["MD"],374:["AM"],375:["BY"],376:["AD"],377:["MC"],378:["SM"],380:["UA"],381:["RS"],382:["ME"],383:["XK"],385:["HR"],386:["SI"],387:["BA"],389:["MK"],420:["CZ"],421:["SK"],423:["LI"],500:["FK"],501:["BZ"],502:["GT"],503:["SV"],504:["HN"],505:["NI"],506:["CR"],507:["PA"],508:["PM"],509:["HT"],590:["GP","BL","MF"],591:["BO"],592:["GY"],593:["EC"],594:["GF"],595:["PY"],596:["MQ"],597:["SR"],598:["UY"],599:["CW","BQ"],670:["TL"],672:["NF"],673:["BN"],674:["NR"],675:["PG"],676:["TO"],677:["SB"],678:["VU"],679:["FJ"],680:["PW"],681:["WF"],682:["CK"],683:["NU"],685:["WS"],686:["KI"],687:["NC"],688:["TV"],689:["PF"],690:["TK"],691:["FM"],692:["MH"],850:["KP"],852:["HK"],853:["MO"],855:["KH"],856:["LA"],880:["BD"],886:["TW"],960:["MV"],961:["LB"],962:["JO"],963:["SY"],964:["IQ"],965:["KW"],966:["SA"],967:["YE"],968:["OM"],970:["PS"],971:["AE"],972:["IL"],973:["BH"],974:["QA"],975:["BT"],976:["MN"],977:["NP"],992:["TJ"],993:["TM"],994:["AZ"],995:["GE"],996:["KG"],998:["UZ"]},countries:{AC:["247","00","(?:[01589]\\d|[46])\\d{4}",[5,6]],AD:["376","00","(?:1|6\\d)\\d{7}|[135-9]\\d{5}",[6,8,9],[["(\\d{3})(\\d{3})","$1 $2",["[135-9]"]],["(\\d{4})(\\d{4})","$1 $2",["1"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]]],AE:["971","00","(?:[4-7]\\d|9[0-689])\\d{7}|800\\d{2,9}|[2-4679]\\d{7}",[5,6,7,8,9,10,11,12],[["(\\d{3})(\\d{2,9})","$1 $2",["60|8"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[236]|[479][2-8]"],"0$1"],["(\\d{3})(\\d)(\\d{5})","$1 $2 $3",["[479]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"]],"0"],AF:["93","00","[2-7]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"]],"0"],AG:["1","011","(?:268|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([457]\\d{6})$|1","268$1",0,"268"],AI:["1","011","(?:264|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2457]\\d{6})$|1","264$1",0,"264"],AL:["355","00","(?:700\\d\\d|900)\\d{3}|8\\d{5,7}|(?:[2-5]|6\\d)\\d{7}",[6,7,8,9],[["(\\d{3})(\\d{3,4})","$1 $2",["80|9"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["4[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2358][2-5]|4"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["[23578]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["6"],"0$1"]],"0"],AM:["374","00","(?:[1-489]\\d|55|60|77)\\d{6}",[8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[89]0"],"0 $1"],["(\\d{3})(\\d{5})","$1 $2",["2|3[12]"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["1|47"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[3-9]"],"0$1"]],"0"],AO:["244","00","[29]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[29]"]]]],AR:["54","00","(?:11|[89]\\d\\d)\\d{8}|[2368]\\d{9}",[10,11],[["(\\d{4})(\\d{2})(\\d{4})","$1 $2-$3",["2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9])","2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8]))|2(?:2[24-9]|3[1-59]|47)","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5[56][46]|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|58|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|54(?:4|5[13-7]|6[89])|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:454|85[56])[46]|3(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["1"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[68]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2-$3",["[23]"],"0$1",1],["(\\d)(\\d{4})(\\d{2})(\\d{4})","$2 15-$3-$4",["9(?:2[2-469]|3[3-578])","9(?:2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9]))","9(?:2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8])))|92(?:2[24-9]|3[1-59]|47)","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5(?:[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|5(?:4(?:4|5[13-7]|6[89])|[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",0,"$1 $2 $3-$4"],["(\\d)(\\d{2})(\\d{4})(\\d{4})","$2 15-$3-$4",["91"],"0$1",0,"$1 $2 $3-$4"],["(\\d{3})(\\d{3})(\\d{5})","$1-$2-$3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{4})","$2 15-$3-$4",["9"],"0$1",0,"$1 $2 $3-$4"]],"0",0,"0?(?:(11|2(?:2(?:02?|[13]|2[13-79]|4[1-6]|5[2457]|6[124-8]|7[1-4]|8[13-6]|9[1267])|3(?:02?|1[467]|2[03-6]|3[13-8]|[49][2-6]|5[2-8]|[67])|4(?:7[3-578]|9)|6(?:[0136]|2[24-6]|4[6-8]?|5[15-8])|80|9(?:0[1-3]|[19]|2\\d|3[1-6]|4[02568]?|5[2-4]|6[2-46]|72?|8[23]?))|3(?:3(?:2[79]|6|8[2578])|4(?:0[0-24-9]|[12]|3[5-8]?|4[24-7]|5[4-68]?|6[02-9]|7[126]|8[2379]?|9[1-36-8])|5(?:1|2[1245]|3[237]?|4[1-46-9]|6[2-4]|7[1-6]|8[2-5]?)|6[24]|7(?:[069]|1[1568]|2[15]|3[145]|4[13]|5[14-8]|7[2-57]|8[126])|8(?:[01]|2[15-7]|3[2578]?|4[13-6]|5[4-8]?|6[1-357-9]|7[36-8]?|8[5-8]?|9[124])))15)?","9$1"],AS:["1","011","(?:[58]\\d\\d|684|900)\\d{7}",[10],0,"1",0,"([267]\\d{6})$|1","684$1",0,"684"],AT:["43","00","1\\d{3,12}|2\\d{6,12}|43(?:(?:0\\d|5[02-9])\\d{3,9}|2\\d{4,5}|[3467]\\d{4}|8\\d{4,6}|9\\d{4,7})|5\\d{4,12}|8\\d{7,12}|9\\d{8,12}|(?:[367]\\d|4[0-24-9])\\d{4,11}",[4,5,6,7,8,9,10,11,12,13],[["(\\d)(\\d{3,12})","$1 $2",["1(?:11|[2-9])"],"0$1"],["(\\d{3})(\\d{2})","$1 $2",["517"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["5[079]"],"0$1"],["(\\d{3})(\\d{3,10})","$1 $2",["(?:31|4)6|51|6(?:5[0-3579]|[6-9])|7(?:20|32|8)|[89]"],"0$1"],["(\\d{4})(\\d{3,9})","$1 $2",["[2-467]|5[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["5"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,7})","$1 $2 $3",["5"],"0$1"]],"0"],AU:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{7}(?:\\d(?:\\d{2})?)?|8[0-24-9]\\d{7})|[2-478]\\d{8}|1\\d{4,7}",[5,6,7,8,9,10,12],[["(\\d{2})(\\d{3,4})","$1 $2",["16"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,4})","$1 $2 $3",["16"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["14|4"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[2378]"],"(0$1)"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:30|[89])"]]],"0",0,"(183[12])|0",0,0,0,[["(?:(?:2(?:[0-26-9]\\d|3[0-8]|4[02-9]|5[0135-9])|3(?:[0-3589]\\d|4[0-578]|6[1-9]|7[0-35-9])|7(?:[013-57-9]\\d|2[0-8]))\\d{3}|8(?:51(?:0(?:0[03-9]|[12479]\\d|3[2-9]|5[0-8]|6[1-9]|8[0-7])|1(?:[0235689]\\d|1[0-69]|4[0-589]|7[0-47-9])|2(?:0[0-79]|[18][13579]|2[14-9]|3[0-46-9]|[4-6]\\d|7[89]|9[0-4]))|(?:6[0-8]|[78]\\d)\\d{3}|9(?:[02-9]\\d{3}|1(?:(?:[0-58]\\d|6[0135-9])\\d|7(?:0[0-24-9]|[1-9]\\d)|9(?:[0-46-9]\\d|5[0-79])))))\\d{3}",[9]],["4(?:(?:79|94)[01]|83[0-389])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[016-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,["163\\d{2,6}",[5,6,7,8,9]],["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],AW:["297","00","(?:[25-79]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[25-9]"]]]],AX:["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","2\\d{4,9}|35\\d{4,5}|(?:60\\d\\d|800)\\d{4,6}|7\\d{5,11}|(?:[14]\\d|3[0-46-9]|50)\\d{4,8}",[5,6,7,8,9,10,11,12],0,"0",0,0,0,0,"18",0,"00"],AZ:["994","00","365\\d{6}|(?:[124579]\\d|60|88)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[28]|2|365|46","1[28]|2|365[45]|46","1[28]|2|365(?:4|5[02])|46"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[13-9]"],"0$1"]],"0"],BA:["387","00","6\\d{8}|(?:[35689]\\d|49|70)\\d{6}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["6[1-3]|[7-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2-$3",["[3-5]|6[56]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["6"],"0$1"]],"0"],BB:["1","011","(?:246|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","246$1",0,"246"],BD:["880","00","[1-469]\\d{9}|8[0-79]\\d{7,8}|[2-79]\\d{8}|[2-9]\\d{7}|[3-9]\\d{6}|[57-9]\\d{5}",[6,7,8,9,10],[["(\\d{2})(\\d{4,6})","$1-$2",["31[5-8]|[459]1"],"0$1"],["(\\d{3})(\\d{3,7})","$1-$2",["3(?:[67]|8[013-9])|4(?:6[168]|7|[89][18])|5(?:6[128]|9)|6(?:[15]|28|4[14])|7[2-589]|8(?:0[014-9]|[12])|9[358]|(?:3[2-5]|4[235]|5[2-578]|6[0389]|76|8[3-7]|9[24])1|(?:44|66)[01346-9]"],"0$1"],["(\\d{4})(\\d{3,6})","$1-$2",["[13-9]|22"],"0$1"],["(\\d)(\\d{7,8})","$1-$2",["2"],"0$1"]],"0"],BE:["32","00","4\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:80|9)0"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[239]|4[23]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[15-8]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4"],"0$1"]],"0"],BF:["226","00","[025-7]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[025-7]"]]]],BG:["359","00","00800\\d{7}|[2-7]\\d{6,7}|[89]\\d{6,8}|2\\d{5}",[6,7,8,9,12],[["(\\d)(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["43[1-6]|70[1-9]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["[356]|4[124-7]|7[1-9]|8[1-6]|9[1-7]"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:70|8)0"],"0$1"],["(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3",["43[1-7]|7"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[48]|9[08]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"]],"0"],BH:["973","00","[136-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[13679]|8[02-4679]"]]]],BI:["257","00","(?:[267]\\d|31)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2367]"]]]],BJ:["229","00","[24-689]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-689]"]]]],BL:["590","00","590\\d{6}|(?:69|80|9\\d)\\d{7}",[9],0,"0",0,0,0,0,0,[["590(?:2[7-9]|3[3-7]|5[12]|87)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:395|76[018])\\d|475[0-5])\\d{4}"]]],BM:["1","011","(?:441|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","441$1",0,"441"],BN:["673","00","[2-578]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-578]"]]]],BO:["591","00(?:1\\d)?","(?:[2-467]\\d\\d|8001)\\d{5}",[8,9],[["(\\d)(\\d{7})","$1 $2",["[23]|4[46]"]],["(\\d{8})","$1",["[67]"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["8"]]],"0",0,"0(1\\d)?"],BQ:["599","00","(?:[34]1|7\\d)\\d{5}",[7],0,0,0,0,0,0,"[347]"],BR:["55","00(?:1[245]|2[1-35]|31|4[13]|[56]5|99)","(?:[1-46-9]\\d\\d|5(?:[0-46-9]\\d|5[0-46-9]))\\d{8}|[1-9]\\d{9}|[3589]\\d{8}|[34]\\d{7}",[8,9,10,11],[["(\\d{4})(\\d{4})","$1-$2",["300|4(?:0[02]|37)","4(?:02|37)0|[34]00"]],["(\\d{3})(\\d{2,3})(\\d{4})","$1 $2 $3",["(?:[358]|90)0"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["(?:[14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])[2-57]"],"($1)"],["(\\d{2})(\\d{5})(\\d{4})","$1 $2-$3",["[16][1-9]|[2-57-9]"],"($1)"]],"0",0,"(?:0|90)(?:(1[245]|2[1-35]|31|4[13]|[56]5|99)(\\d{10,11}))?","$2"],BS:["1","011","(?:242|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([3-8]\\d{6})$|1","242$1",0,"242"],BT:["975","00","[17]\\d{7}|[2-8]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[2-68]|7[246]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[67]|7"]]]],BW:["267","00","(?:0800|(?:[37]|800)\\d)\\d{6}|(?:[2-6]\\d|90)\\d{5}",[7,8,10],[["(\\d{2})(\\d{5})","$1 $2",["90"]],["(\\d{3})(\\d{4})","$1 $2",["[24-6]|3[15-9]"]],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37]"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["8"]]]],BY:["375","810","(?:[12]\\d|33|44|902)\\d{7}|8(?:0[0-79]\\d{5,7}|[1-7]\\d{9})|8(?:1[0-489]|[5-79]\\d)\\d{7}|8[1-79]\\d{6,7}|8[0-79]\\d{5}|8\\d{5}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3})","$1 $2",["800"],"8 $1"],["(\\d{3})(\\d{2})(\\d{2,4})","$1 $2 $3",["800"],"8 $1"],["(\\d{4})(\\d{2})(\\d{3})","$1 $2-$3",["1(?:5[169]|6[3-5]|7[179])|2(?:1[35]|2[34]|3[3-5])","1(?:5[169]|6(?:3[1-3]|4|5[125])|7(?:1[3-9]|7[0-24-6]|9[2-7]))|2(?:1[35]|2[34]|3[3-5])"],"8 0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["1(?:[56]|7[467])|2[1-3]"],"8 0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-4]"],"8 0$1"],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["[89]"],"8 $1"]],"8",0,"0|80?",0,0,0,0,"8~10"],BZ:["501","00","(?:0800\\d|[2-8])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1-$2",["[2-8]"]],["(\\d)(\\d{3})(\\d{4})(\\d{3})","$1-$2-$3-$4",["0"]]]],CA:["1","011","(?:[2-8]\\d|90)\\d{8}|3\\d{6}",[7,10],0,"1",0,0,0,0,0,[["(?:2(?:04|[23]6|[48]9|50|63)|3(?:06|43|54|6[578]|82)|4(?:03|1[68]|[26]8|3[178]|50|74)|5(?:06|1[49]|48|79|8[147])|6(?:04|[18]3|39|47|72)|7(?:0[59]|42|53|78|8[02])|8(?:[06]7|19|25|73)|90[25])[2-9]\\d{6}",[10]],["",[10]],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}",[10]],["900[2-9]\\d{6}",[10]],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|(?:5(?:00|2[125-9]|33|44|66|77|88)|622)[2-9]\\d{6}",[10]],0,["310\\d{4}",[7]],0,["600[2-9]\\d{6}",[10]]]],CC:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10,12],0,"0",0,"([59]\\d{7})$|0","8$1",0,0,[["8(?:51(?:0(?:02|31|60|89)|1(?:18|76)|223)|91(?:0(?:1[0-2]|29)|1(?:[28]2|50|79)|2(?:10|64)|3(?:[06]8|22)|4[29]8|62\\d|70[23]|959))\\d{3}",[9]],["4(?:(?:79|94)[01]|83[0-389])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[016-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],CD:["243","00","[189]\\d{8}|[1-68]\\d{6}",[7,9],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["[1-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]"],"0$1"]],"0"],CF:["236","00","(?:[27]\\d{3}|8776)\\d{4}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[278]"]]]],CG:["242","00","222\\d{6}|(?:0\\d|80)\\d{7}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["8"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[02]"]]]],CH:["41","00","8\\d{11}|[2-9]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8[047]|90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-79]|81"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["8"],"0$1"]],"0"],CI:["225","00","[02]\\d{9}",[10],[["(\\d{2})(\\d{2})(\\d)(\\d{5})","$1 $2 $3 $4",["2"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3 $4",["0"]]]],CK:["682","00","[2-578]\\d{4}",[5],[["(\\d{2})(\\d{3})","$1 $2",["[2-578]"]]]],CL:["56","(?:0|1(?:1[0-69]|2[02-5]|5[13-58]|69|7[0167]|8[018]))0","12300\\d{6}|6\\d{9,10}|[2-9]\\d{8}",[9,10,11],[["(\\d{5})(\\d{4})","$1 $2",["219","2196"],"($1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["44"]],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2[1-36]"],"($1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["9[2-9]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["3[2-5]|[47]|5[1-3578]|6[13-57]|8(?:0[1-9]|[1-9])"],"($1)"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["60|8"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{3})(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3 $4",["60"]]]],CM:["237","00","[26]\\d{8}|88\\d{6,7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["88"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[26]|88"]]]],CN:["86","00|1(?:[12]\\d|79)\\d\\d00","1[127]\\d{8,9}|2\\d{9}(?:\\d{2})?|[12]\\d{6,7}|86\\d{6}|(?:1[03-689]\\d|6)\\d{7,9}|(?:[3-579]\\d|8[0-57-9])\\d{6,9}",[7,8,9,10,11,12],[["(\\d{2})(\\d{5,6})","$1 $2",["(?:10|2[0-57-9])[19]","(?:10|2[0-57-9])(?:10|9[56])","10(?:10|9[56])|2[0-57-9](?:100|9[56])"],"0$1"],["(\\d{3})(\\d{5,6})","$1 $2",["3(?:[157]|35|49|9[1-68])|4(?:[17]|2[179]|6[47-9]|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]|4[13]|5[1-5])|(?:4[35]|59|85)[1-9]","(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))[19]","85[23](?:10|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:10|9[56])","85[23](?:100|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:100|9[56])"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["(?:4|80)0"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["10|2(?:[02-57-9]|1[1-9])","10|2(?:[02-57-9]|1[1-9])","10[0-79]|2(?:[02-57-9]|1[1-79])|(?:10|21)8(?:0[1-9]|[1-9])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["3(?:[3-59]|7[02-68])|4(?:[26-8]|3[3-9]|5[2-9])|5(?:3[03-9]|[468]|7[028]|9[2-46-9])|6|7(?:[0-247]|3[04-9]|5[0-4689]|6[2368])|8(?:[1-358]|9[1-7])|9(?:[013479]|5[1-5])|(?:[34]1|55|79|87)[02-9]"],"0$1",1],["(\\d{3})(\\d{7,8})","$1 $2",["9"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["80"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[3-578]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["1[3-9]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3 $4",["[12]"],"0$1",1]],"0",0,"(1(?:[12]\\d|79)\\d\\d)|0",0,0,0,0,"00"],CO:["57","00(?:4(?:[14]4|56)|[579])","(?:60\\d\\d|9101)\\d{6}|(?:1\\d|3)\\d{9}",[10,11],[["(\\d{3})(\\d{7})","$1 $2",["6"],"($1)"],["(\\d{3})(\\d{7})","$1 $2",["3[0-357]|91"]],["(\\d)(\\d{3})(\\d{7})","$1-$2-$3",["1"],"0$1",0,"$1 $2 $3"]],"0",0,"0(4(?:[14]4|56)|[579])?"],CR:["506","00","(?:8\\d|90)\\d{8}|(?:[24-8]\\d{3}|3005)\\d{4}",[8,10],[["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[3-9]"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[89]"]]],0,0,"(19(?:0[0-2468]|1[09]|20|66|77|99))"],CU:["53","119","[27]\\d{6,7}|[34]\\d{5,7}|63\\d{6}|(?:5|8\\d\\d)\\d{7}",[6,7,8,10],[["(\\d{2})(\\d{4,6})","$1 $2",["2[1-4]|[34]"],"(0$1)"],["(\\d)(\\d{6,7})","$1 $2",["7"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["[56]"],"0$1"],["(\\d{3})(\\d{7})","$1 $2",["8"],"0$1"]],"0"],CV:["238","0","(?:[2-59]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[2-589]"]]]],CW:["599","00","(?:[34]1|60|(?:7|9\\d)\\d)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[3467]"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["9[4-8]"]]],0,0,0,0,0,"[69]"],CX:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10,12],0,"0",0,"([59]\\d{7})$|0","8$1",0,0,[["8(?:51(?:0(?:01|30|59|88)|1(?:17|46|75)|2(?:22|35))|91(?:00[6-9]|1(?:[28]1|49|78)|2(?:09|63)|3(?:12|26|75)|4(?:56|97)|64\\d|7(?:0[01]|1[0-2])|958))\\d{3}",[9]],["4(?:(?:79|94)[01]|83[0-389])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[016-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],CY:["357","00","(?:[279]\\d|[58]0)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[257-9]"]]]],CZ:["420","00","(?:[2-578]\\d|60)\\d{7}|9\\d{8,11}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]|9[015-7]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3 $4",["96"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]]],DE:["49","00","[2579]\\d{5,14}|49(?:[34]0|69|8\\d)\\d\\d?|49(?:37|49|60|7[089]|9\\d)\\d{1,3}|49(?:2[024-9]|3[2-689]|7[1-7])\\d{1,8}|(?:1|[368]\\d|4[0-8])\\d{3,13}|49(?:[015]\\d|2[13]|31|[46][1-8])\\d{1,9}",[4,5,6,7,8,9,10,11,12,13,14,15],[["(\\d{2})(\\d{3,13})","$1 $2",["3[02]|40|[68]9"],"0$1"],["(\\d{3})(\\d{3,12})","$1 $2",["2(?:0[1-389]|1[124]|2[18]|3[14])|3(?:[35-9][15]|4[015])|906|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1","2(?:0[1-389]|12[0-8])|3(?:[35-9][15]|4[015])|906|2(?:[13][14]|2[18])|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1"],"0$1"],["(\\d{4})(\\d{2,11})","$1 $2",["[24-6]|3(?:[3569][02-46-9]|4[2-4679]|7[2-467]|8[2-46-8])|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]","[24-6]|3(?:3(?:0[1-467]|2[127-9]|3[124578]|7[1257-9]|8[1256]|9[145])|4(?:2[135]|4[13578]|9[1346])|5(?:0[14]|2[1-3589]|6[1-4]|7[13468]|8[13568])|6(?:2[1-489]|3[124-6]|6[13]|7[12579]|8[1-356]|9[135])|7(?:2[1-7]|4[145]|6[1-5]|7[1-4])|8(?:21|3[1468]|6|7[1467]|8[136])|9(?:0[12479]|2[1358]|4[134679]|6[1-9]|7[136]|8[147]|9[1468]))|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]|3[68]4[1347]|3(?:47|60)[1356]|3(?:3[46]|46|5[49])[1246]|3[4579]3[1357]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["138"],"0$1"],["(\\d{5})(\\d{2,10})","$1 $2",["3"],"0$1"],["(\\d{3})(\\d{5,11})","$1 $2",["181"],"0$1"],["(\\d{3})(\\d)(\\d{4,10})","$1 $2 $3",["1(?:3|80)|9"],"0$1"],["(\\d{3})(\\d{7,8})","$1 $2",["1[67]"],"0$1"],["(\\d{3})(\\d{7,12})","$1 $2",["8"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["185","1850","18500"],"0$1"],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["18[68]"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["15[0568]"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["15[1279]"],"0$1"],["(\\d{3})(\\d{8})","$1 $2",["18"],"0$1"],["(\\d{3})(\\d{2})(\\d{7,8})","$1 $2 $3",["1(?:6[023]|7)"],"0$1"],["(\\d{4})(\\d{2})(\\d{7})","$1 $2 $3",["15[279]"],"0$1"],["(\\d{3})(\\d{2})(\\d{8})","$1 $2 $3",["15"],"0$1"]],"0"],DJ:["253","00","(?:2\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[27]"]]]],DK:["45","00","[2-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-9]"]]]],DM:["1","011","(?:[58]\\d\\d|767|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","767$1",0,"767"],DO:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,0,0,0,"8001|8[024]9"],DZ:["213","00","(?:[1-4]|[5-79]\\d|80)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["9"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-8]"],"0$1"]],"0"],EC:["593","00","1\\d{9,10}|(?:[2-7]|9\\d)\\d{7}",[8,9,10,11],[["(\\d)(\\d{3})(\\d{4})","$1 $2-$3",["[2-7]"],"(0$1)",0,"$1-$2-$3"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{3})(\\d{3,4})","$1 $2 $3",["1"]]],"0"],EE:["372","00","8\\d{9}|[4578]\\d{7}|(?:[3-8]\\d|90)\\d{5}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[369]|4[3-8]|5(?:[0-2]|5[0-478]|6[45])|7[1-9]|88","[369]|4[3-8]|5(?:[02]|1(?:[0-8]|95)|5[0-478]|6(?:4[0-4]|5[1-589]))|7[1-9]|88"]],["(\\d{4})(\\d{3,4})","$1 $2",["[45]|8(?:00|[1-49])","[45]|8(?:00[1-9]|[1-49])"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]]],EG:["20","00","[189]\\d{8,9}|[24-6]\\d{8}|[135]\\d{7}",[8,9,10],[["(\\d)(\\d{7,8})","$1 $2",["[23]"],"0$1"],["(\\d{2})(\\d{6,7})","$1 $2",["1[35]|[4-6]|8[2468]|9[235-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{8})","$1 $2",["1"],"0$1"]],"0"],EH:["212","00","[5-8]\\d{8}",[9],0,"0",0,0,0,0,"528[89]"],ER:["291","00","[178]\\d{6}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[178]"],"0$1"]],"0"],ES:["34","00","[5-9]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]00"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-9]"]]]],ET:["251","00","(?:11|[2-579]\\d)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-579]"],"0$1"]],"0"],FI:["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","[1-35689]\\d{4}|7\\d{10,11}|(?:[124-7]\\d|3[0-46-9])\\d{8}|[1-9]\\d{5,8}",[5,6,7,8,9,10,11,12],[["(\\d)(\\d{4,9})","$1 $2",["[2568][1-8]|3(?:0[1-9]|[1-9])|9"],"0$1"],["(\\d{3})(\\d{3,7})","$1 $2",["[12]00|[368]|70[07-9]"],"0$1"],["(\\d{2})(\\d{4,8})","$1 $2",["[1245]|7[135]"],"0$1"],["(\\d{2})(\\d{6,10})","$1 $2",["7"],"0$1"]],"0",0,0,0,0,"1[03-79]|[2-9]",0,"00"],FJ:["679","0(?:0|52)","45\\d{5}|(?:0800\\d|[235-9])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1 $2",["[235-9]|45"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]]],0,0,0,0,0,0,0,"00"],FK:["500","00","[2-7]\\d{4}",[5]],FM:["691","00","(?:[39]\\d\\d|820)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[389]"]]]],FO:["298","00","[2-9]\\d{5}",[6],[["(\\d{6})","$1",["[2-9]"]]],0,0,"(10(?:01|[12]0|88))"],FR:["33","00","[1-9]\\d{8}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0 $1"],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[1-79]"],"0$1"]],"0"],GA:["241","00","(?:[067]\\d|11)\\d{6}|[2-7]\\d{6}",[7,8],[["(\\d)(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-7]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["11|[67]"],"0$1"]],0,0,"0(11\\d{6}|60\\d{6}|61\\d{6}|6[256]\\d{6}|7[467]\\d{6})","$1"],GB:["44","00","[1-357-9]\\d{9}|[18]\\d{8}|8\\d{6}",[7,9,10],[["(\\d{3})(\\d{4})","$1 $2",["800","8001","80011","800111","8001111"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["845","8454","84546","845464"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["800"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["1(?:38|5[23]|69|76|94)","1(?:(?:38|69)7|5(?:24|39)|768|946)","1(?:3873|5(?:242|39[4-6])|(?:697|768)[347]|9467)"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["1(?:[2-69][02-9]|[78])"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[25]|7(?:0|6[02-9])","[25]|7(?:0|6(?:[03-9]|2[356]))"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[1389]"],"0$1"]],"0",0,0,0,0,0,[["(?:1(?:1(?:3(?:[0-58]\\d\\d|73[0235])|4(?:[0-5]\\d\\d|69[7-9]|70[0-79])|(?:(?:5[0-26-9]|[78][0-49])\\d|6(?:[0-4]\\d|50))\\d)|(?:2(?:(?:0[024-9]|2[3-9]|3[3-79]|4[1-689]|[58][02-9]|6[0-47-9]|7[013-9]|9\\d)\\d|1(?:[0-7]\\d|8[0-2]))|(?:3(?:0\\d|1[0-8]|[25][02-9]|3[02-579]|[468][0-46-9]|7[1-35-79]|9[2-578])|4(?:0[03-9]|[137]\\d|[28][02-57-9]|4[02-69]|5[0-8]|[69][0-79])|5(?:0[1-35-9]|[16]\\d|2[024-9]|3[015689]|4[02-9]|5[03-9]|7[0-35-9]|8[0-468]|9[0-57-9])|6(?:0[034689]|1\\d|2[0-35689]|[38][013-9]|4[1-467]|5[0-69]|6[13-9]|7[0-8]|9[0-24578])|7(?:0[0246-9]|2\\d|3[0236-8]|4[03-9]|5[0-46-9]|6[013-9]|7[0-35-9]|8[024-9]|9[02-9])|8(?:0[35-9]|2[1-57-9]|3[02-578]|4[0-578]|5[124-9]|6[2-69]|7\\d|8[02-9]|9[02569])|9(?:0[02-589]|[18]\\d|2[02-689]|3[1-57-9]|4[2-9]|5[0-579]|6[2-47-9]|7[0-24578]|9[2-57]))\\d)\\d)|2(?:0[013478]|3[0189]|4[017]|8[0-46-9]|9[0-2])\\d{3})\\d{4}|1(?:2(?:0(?:46[1-4]|87[2-9])|545[1-79]|76(?:2\\d|3[1-8]|6[1-6])|9(?:7(?:2[0-4]|3[2-5])|8(?:2[2-8]|7[0-47-9]|8[3-5])))|3(?:6(?:38[2-5]|47[23])|8(?:47[04-9]|64[0157-9]))|4(?:044[1-7]|20(?:2[23]|8\\d)|6(?:0(?:30|5[2-57]|6[1-8]|7[2-8])|140)|8(?:052|87[1-3]))|5(?:2(?:4(?:3[2-79]|6\\d)|76\\d)|6(?:26[06-9]|686))|6(?:06(?:4\\d|7[4-79])|295[5-7]|35[34]\\d|47(?:24|61)|59(?:5[08]|6[67]|74)|9(?:55[0-4]|77[23]))|7(?:26(?:6[13-9]|7[0-7])|(?:442|688)\\d|50(?:2[0-3]|[3-68]2|76))|8(?:27[56]\\d|37(?:5[2-5]|8[239])|843[2-58])|9(?:0(?:0(?:6[1-8]|85)|52\\d)|3583|4(?:66[1-8]|9(?:2[01]|81))|63(?:23|3[1-4])|9561))\\d{3}",[9,10]],["7(?:457[0-57-9]|700[01]|911[028])\\d{5}|7(?:[1-3]\\d\\d|4(?:[0-46-9]\\d|5[0-689])|5(?:0[0-8]|[13-9]\\d|2[0-35-9])|7(?:0[1-9]|[1-7]\\d|8[02-9]|9[0-689])|8(?:[014-9]\\d|[23][0-8])|9(?:[024-9]\\d|1[02-9]|3[0-689]))\\d{6}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[2-49]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}",[10]],["56\\d{8}",[10]]],0," x"],GD:["1","011","(?:473|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","473$1",0,"473"],GE:["995","00","(?:[3-57]\\d\\d|800)\\d{6}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["32"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[57]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[348]"],"0$1"]],"0"],GF:["594","00","[56]94\\d{6}|(?:80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[56]|9[47]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[89]"],"0$1"]],"0"],GG:["44","00","(?:1481|[357-9]\\d{3})\\d{6}|8\\d{6}(?:\\d{2})?",[7,9,10],0,"0",0,"([25-9]\\d{5})$|0","1481$1",0,0,[["1481[25-9]\\d{5}",[10]],["7(?:(?:781|839)\\d|911[17])\\d{5}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[0-3]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}",[10]],["56\\d{8}",[10]]]],GH:["233","00","(?:[235]\\d{3}|800)\\d{5}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[235]"],"0$1"]],"0"],GI:["350","00","(?:[25]\\d|60)\\d{6}",[8],[["(\\d{3})(\\d{5})","$1 $2",["2"]]]],GL:["299","00","(?:19|[2-689]\\d|70)\\d{4}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["19|[2-9]"]]]],GM:["220","00","[2-9]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],GN:["224","00","722\\d{6}|(?:3|6\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["3"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[67]"]]]],GP:["590","00","590\\d{6}|(?:69|80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[569]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0",0,0,0,0,0,[["590(?:0[1-68]|[14][0-24-9]|2[0-68]|3[1-9]|5[3-579]|[68][0-689]|7[08]|9\\d)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:395|76[018])\\d|475[0-5])\\d{4}"]]],GQ:["240","00","222\\d{6}|(?:3\\d|55|[89]0)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235]"]],["(\\d{3})(\\d{6})","$1 $2",["[89]"]]]],GR:["30","00","5005000\\d{3}|8\\d{9,11}|(?:[269]\\d|70)\\d{8}",[10,11,12],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["21|7"]],["(\\d{4})(\\d{6})","$1 $2",["2(?:2|3[2-57-9]|4[2-469]|5[2-59]|6[2-9]|7[2-69]|8[2-49])|5"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2689]"]],["(\\d{3})(\\d{3,4})(\\d{5})","$1 $2 $3",["8"]]]],GT:["502","00","(?:1\\d{3}|[2-7])\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1 $2",["[2-7]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]]],GU:["1","011","(?:[58]\\d\\d|671|900)\\d{7}",[10],0,"1",0,"([3-9]\\d{6})$|1","671$1",0,"671"],GW:["245","00","[49]\\d{8}|4\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["40"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"]]]],GY:["592","001","9008\\d{3}|(?:[2-467]\\d\\d|510|862)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],HK:["852","00(?:30|5[09]|[126-9]?)","8[0-46-9]\\d{6,7}|9\\d{4,7}|(?:[2-7]|9\\d{3})\\d{7}",[5,6,7,8,9,11],[["(\\d{3})(\\d{2,5})","$1 $2",["900","9003"]],["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[1-4]|9(?:0[1-9]|[1-8])"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]],["(\\d{3})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]],0,0,0,0,0,0,0,"00"],HN:["504","00","8\\d{10}|[237-9]\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1-$2",["[237-9]"]]]],HR:["385","00","(?:[24-69]\\d|3[0-79])\\d{7}|80\\d{5,7}|[1-79]\\d{7}|6\\d{5,6}",[6,7,8,9],[["(\\d{2})(\\d{2})(\\d{2,3})","$1 $2 $3",["6[01]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{4})(\\d{3})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[67]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-5]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"]],"0"],HT:["509","00","(?:[2-489]\\d|55)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[2-589]"]]]],HU:["36","00","[235-7]\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27][2-9]|3[2-7]|4[24-9]|5[2-79]|6|8[2-57-9]|9[2-69]"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"06 $1"]],"06"],ID:["62","00[89]","(?:(?:00[1-9]|8\\d)\\d{4}|[1-36])\\d{6}|00\\d{10}|[1-9]\\d{8,10}|[2-9]\\d{7}",[7,8,9,10,11,12,13],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["15"]],["(\\d{2})(\\d{5,9})","$1 $2",["2[124]|[36]1"],"(0$1)"],["(\\d{3})(\\d{5,7})","$1 $2",["800"],"0$1"],["(\\d{3})(\\d{5,8})","$1 $2",["[2-79]"],"(0$1)"],["(\\d{3})(\\d{3,4})(\\d{3})","$1-$2-$3",["8[1-35-9]"],"0$1"],["(\\d{3})(\\d{6,8})","$1 $2",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["804"],"0$1"],["(\\d{3})(\\d)(\\d{3})(\\d{3})","$1 $2 $3 $4",["80"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1-$2-$3",["8"],"0$1"]],"0"],IE:["353","00","(?:1\\d|[2569])\\d{6,8}|4\\d{6,9}|7\\d{8}|8\\d{8,9}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["2[24-9]|47|58|6[237-9]|9[35-9]"],"(0$1)"],["(\\d{3})(\\d{5})","$1 $2",["[45]0"],"(0$1)"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["1"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2569]|4[1-69]|7[14]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["81"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[78]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["4"],"(0$1)"],["(\\d{2})(\\d)(\\d{3})(\\d{4})","$1 $2 $3 $4",["8"],"0$1"]],"0"],IL:["972","0(?:0|1[2-9])","1\\d{6}(?:\\d{3,5})?|[57]\\d{8}|[1-489]\\d{7}",[7,8,9,10,11,12],[["(\\d{4})(\\d{3})","$1-$2",["125"]],["(\\d{4})(\\d{2})(\\d{2})","$1-$2-$3",["121"]],["(\\d)(\\d{3})(\\d{4})","$1-$2-$3",["[2-489]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1-$2-$3",["12"]],["(\\d{4})(\\d{6})","$1-$2",["159"]],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3-$4",["1[7-9]"]],["(\\d{3})(\\d{1,2})(\\d{3})(\\d{4})","$1-$2 $3-$4",["15"]]],"0"],IM:["44","00","1624\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"([25-8]\\d{5})$|0","1624$1",0,"74576|(?:16|7[56])24"],IN:["91","00","(?:000800|[2-9]\\d\\d)\\d{7}|1\\d{7,12}",[8,9,10,11,12,13],[["(\\d{8})","$1",["5(?:0|2[23]|3[03]|[67]1|88)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|888)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|8888)"],0,1],["(\\d{4})(\\d{4,5})","$1 $2",["180","1800"],0,1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["140"],0,1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["11|2[02]|33|4[04]|79[1-7]|80[2-46]","11|2[02]|33|4[04]|79(?:[1-6]|7[19])|80(?:[2-4]|6[0-589])","11|2[02]|33|4[04]|79(?:[124-6]|3(?:[02-9]|1[0-24-9])|7(?:1|9[1-6]))|80(?:[2-4]|6[0-589])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1(?:2[0-249]|3[0-25]|4[145]|[68]|7[1257])|2(?:1[257]|3[013]|4[01]|5[0137]|6[0158]|78|8[1568])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|5[12]|[78]1)|6(?:12|[2-4]1|5[17]|6[13]|80)|7(?:12|3[134]|4[47]|61|88)|8(?:16|2[014]|3[126]|6[136]|7[078]|8[34]|91)|(?:43|59|75)[15]|(?:1[59]|29|67|72)[14]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|674|7(?:(?:2[14]|3[34]|5[15])[2-6]|61[346]|88[0-8])|8(?:70[2-6]|84[235-7]|91[3-7])|(?:1(?:29|60|8[06])|261|552|6(?:12|[2-47]1|5[17]|6[13]|80)|7(?:12|31|4[47])|8(?:16|2[014]|3[126]|6[136]|7[78]|83))[2-7]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|6(?:12(?:[2-6]|7[0-8])|74[2-7])|7(?:(?:2[14]|5[15])[2-6]|3171|61[346]|88(?:[2-7]|82))|8(?:70[2-6]|84(?:[2356]|7[19])|91(?:[3-6]|7[19]))|73[134][2-6]|(?:74[47]|8(?:16|2[014]|3[126]|6[136]|7[78]|83))(?:[2-6]|7[19])|(?:1(?:29|60|8[06])|261|552|6(?:[2-4]1|5[17]|6[13]|7(?:1|4[0189])|80)|7(?:12|88[01]))[2-7]"],"0$1",1],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2[2457-9]|3[2-5]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1[013-9]|28|3[129]|4[1-35689]|5[29]|6[02-5]|70)|807","1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2(?:[2457]|84|95)|3(?:[2-4]|55)|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1(?:[013-8]|9[6-9])|28[6-8]|3(?:17|2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4|5[0-367])|70[13-7])|807[19]","1(?:[2-479]|5(?:[0236-9]|5[013-9]))|[2-5]|6(?:2(?:84|95)|355|83)|73179|807(?:1|9[1-3])|(?:1552|6(?:1[1358]|2[2457]|3[2-4]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[124-6])\\d|7(?:1(?:[013-8]\\d|9[6-9])|28[6-8]|3(?:2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]\\d|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4\\d|5[0-367])|70[13-7]))[2-7]"],"0$1",1],["(\\d{5})(\\d{5})","$1 $2",["[6-9]"],"0$1",1],["(\\d{4})(\\d{2,4})(\\d{4})","$1 $2 $3",["1(?:6|8[06])","1(?:6|8[06]0)"],0,1],["(\\d{4})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["18"],0,1]],"0"],IO:["246","00","3\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["3"]]]],IQ:["964","00","(?:1|7\\d\\d)\\d{7}|[2-6]\\d{7,8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-6]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"]],"0"],IR:["98","00","[1-9]\\d{9}|(?:[1-8]\\d\\d|9)\\d{3,4}",[4,5,6,7,10],[["(\\d{4,5})","$1",["96"],"0$1"],["(\\d{2})(\\d{4,5})","$1 $2",["(?:1[137]|2[13-68]|3[1458]|4[145]|5[1468]|6[16]|7[1467]|8[13467])[12689]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[1-8]"],"0$1"]],"0"],IS:["354","00|1(?:0(?:01|[12]0)|100)","(?:38\\d|[4-9])\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["[4-9]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["3"]]],0,0,0,0,0,0,0,"00"],IT:["39","00","0\\d{5,10}|1\\d{8,10}|3(?:[0-8]\\d{7,10}|9\\d{7,8})|(?:55|70)\\d{8}|8\\d{5}(?:\\d{2,4})?",[6,7,8,9,10,11],[["(\\d{2})(\\d{4,6})","$1 $2",["0[26]"]],["(\\d{3})(\\d{3,6})","$1 $2",["0[13-57-9][0159]|8(?:03|4[17]|9[2-5])","0[13-57-9][0159]|8(?:03|4[17]|9(?:2|3[04]|[45][0-4]))"]],["(\\d{4})(\\d{2,6})","$1 $2",["0(?:[13-579][2-46-8]|8[236-8])"]],["(\\d{4})(\\d{4})","$1 $2",["894"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[26]|5"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["1(?:44|[679])|[378]"]],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[13-57-9][0159]|14"]],["(\\d{2})(\\d{4})(\\d{5})","$1 $2 $3",["0[26]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["3"]]],0,0,0,0,0,0,[["0669[0-79]\\d{1,6}|0(?:1(?:[0159]\\d|[27][1-5]|31|4[1-4]|6[1356]|8[2-57])|2\\d\\d|3(?:[0159]\\d|2[1-4]|3[12]|[48][1-6]|6[2-59]|7[1-7])|4(?:[0159]\\d|[23][1-9]|4[245]|6[1-5]|7[1-4]|81)|5(?:[0159]\\d|2[1-5]|3[2-6]|4[1-79]|6[4-6]|7[1-578]|8[3-8])|6(?:[0-57-9]\\d|6[0-8])|7(?:[0159]\\d|2[12]|3[1-7]|4[2-46]|6[13569]|7[13-6]|8[1-59])|8(?:[0159]\\d|2[3-578]|3[1-356]|[6-8][1-5])|9(?:[0159]\\d|[238][1-5]|4[12]|6[1-8]|7[1-6]))\\d{2,7}"],["3[1-9]\\d{8}|3[2-9]\\d{7}",[9,10]],["80(?:0\\d{3}|3)\\d{3}",[6,9]],["(?:0878\\d{3}|89(?:2\\d|3[04]|4(?:[0-4]|[5-9]\\d\\d)|5[0-4]))\\d\\d|(?:1(?:44|6[346])|89(?:38|5[5-9]|9))\\d{6}",[6,8,9,10]],["1(?:78\\d|99)\\d{6}",[9,10]],0,0,0,["55\\d{8}",[10]],["84(?:[08]\\d{3}|[17])\\d{3}",[6,9]]]],JE:["44","00","1534\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"([0-24-8]\\d{5})$|0","1534$1",0,0,[["1534[0-24-8]\\d{5}"],["7(?:(?:(?:50|82)9|937)\\d|7(?:00[378]|97[7-9]))\\d{5}"],["80(?:07(?:35|81)|8901)\\d{4}"],["(?:8(?:4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|90(?:066[59]|1810|71(?:07|55)))\\d{4}"],["701511\\d{4}"],0,["(?:3(?:0(?:07(?:35|81)|8901)|3\\d{4}|4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|55\\d{4})\\d{4}"],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}"],["56\\d{8}"]]],JM:["1","011","(?:[58]\\d\\d|658|900)\\d{7}",[10],0,"1",0,0,0,0,"658|876"],JO:["962","00","(?:(?:[2689]|7\\d)\\d|32|53)\\d{6}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2356]|87"],"(0$1)"],["(\\d{3})(\\d{5,6})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["70"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["7"],"0$1"]],"0"],JP:["81","010","00[1-9]\\d{6,14}|[257-9]\\d{9}|(?:00|[1-9]\\d\\d)\\d{6}",[8,9,10,11,12,13,14,15,16,17],[["(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3",["(?:12|57|99)0"],"0$1"],["(\\d{4})(\\d)(\\d{4})","$1-$2-$3",["1(?:26|3[79]|4[56]|5[4-68]|6[3-5])|499|5(?:76|97)|746|8(?:3[89]|47|51)|9(?:80|9[16])","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:76|97)9|7468|8(?:3(?:8[7-9]|96)|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:769|979[2-69])|7468|8(?:3(?:8[7-9]|96[2457-9])|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["60"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2-$3",["[36]|4(?:2[09]|7[01])","[36]|4(?:2(?:0|9[02-69])|7(?:0[019]|1))"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["1(?:1|5[45]|77|88|9[69])|2(?:2[1-37]|3[0-269]|4[59]|5|6[24]|7[1-358]|8[1369]|9[0-38])|4(?:[28][1-9]|3[0-57]|[45]|6[248]|7[2-579]|9[29])|5(?:2|3[0459]|4[0-369]|5[29]|8[02389]|9[0-389])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9[2-6])|8(?:2[124589]|3[26-9]|49|51|6|7[0-468]|8[68]|9[019])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9[1-489])","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2(?:[127]|3[014-9])|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9[19])|62|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|8[1-9]|9[29])|5(?:2|3(?:[045]|9[0-8])|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0-2469])|3(?:[29]|60)|49|51|6(?:[0-24]|36|5[0-3589]|7[23]|9[01459])|7[0-468]|8[68])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9(?:[1289]|3[34]|4[0178]))|(?:264|837)[016-9]|2(?:57|93)[015-9]|(?:25[0468]|422|838)[01]|(?:47[59]|59[89]|8(?:6[68]|9))[019]","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2[127]|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9(?:17|99))|6(?:2|4[016-9])|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|9[29])|5(?:2|3(?:[045]|9(?:[0-58]|6[4-9]|7[0-35689]))|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0169])|3(?:[29]|60|7(?:[017-9]|6[6-8]))|49|51|6(?:[0-24]|36[2-57-9]|5(?:[0-389]|5[23])|6(?:[01]|9[178])|7(?:2[2-468]|3[78])|9[0145])|7[0-468]|8[68])|9(?:4[15]|5[138]|7[156]|8[189]|9(?:[1289]|3(?:31|4[357])|4[0178]))|(?:8294|96)[1-3]|2(?:57|93)[015-9]|(?:223|8699)[014-9]|(?:25[0468]|422|838)[01]|(?:48|8292|9[23])[1-9]|(?:47[59]|59[89]|8(?:68|9))[019]"],"0$1"],["(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3",["[14]|[289][2-9]|5[3-9]|7[2-4679]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["800"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[257-9]"],"0$1"]],"0",0,"(000[259]\\d{6})$|(?:(?:003768)0?)|0","$1"],KE:["254","000","(?:[17]\\d\\d|900)\\d{6}|(?:2|80)0\\d{6,7}|[4-6]\\d{6,8}",[7,8,9,10],[["(\\d{2})(\\d{5,7})","$1 $2",["[24-6]"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[17]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0"],KG:["996","00","8\\d{9}|[235-9]\\d{8}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["3(?:1[346]|[24-79])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235-79]|88"],"0$1"],["(\\d{3})(\\d{3})(\\d)(\\d{2,3})","$1 $2 $3 $4",["8"],"0$1"]],"0"],KH:["855","00[14-9]","1\\d{9}|[1-9]\\d{7,8}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],KI:["686","00","(?:[37]\\d|6[0-79])\\d{6}|(?:[2-48]\\d|50)\\d{3}",[5,8],0,"0"],KM:["269","00","[3478]\\d{6}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[3478]"]]]],KN:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","869$1",0,"869"],KP:["850","00|99","85\\d{6}|(?:19\\d|[2-7])\\d{7}",[8,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"]],"0"],KR:["82","00(?:[125689]|3(?:[46]5|91)|7(?:00|27|3|55|6[126]))","00[1-9]\\d{8,11}|(?:[12]|5\\d{3})\\d{7}|[13-6]\\d{9}|(?:[1-6]\\d|80)\\d{7}|[3-6]\\d{4,5}|(?:00|7)0\\d{8}",[5,6,8,9,10,11,12,13,14],[["(\\d{2})(\\d{3,4})","$1-$2",["(?:3[1-3]|[46][1-4]|5[1-5])1"],"0$1"],["(\\d{4})(\\d{4})","$1-$2",["1"]],["(\\d)(\\d{3,4})(\\d{4})","$1-$2-$3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["60|8"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1-$2-$3",["[1346]|5[1-5]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{2})(\\d{5})(\\d{4})","$1-$2-$3",["5"],"0$1"]],"0",0,"0(8(?:[1-46-8]|5\\d\\d))?"],KW:["965","00","18\\d{5}|(?:[2569]\\d|41)\\d{6}",[7,8],[["(\\d{4})(\\d{3,4})","$1 $2",["[169]|2(?:[235]|4[1-35-9])|52"]],["(\\d{3})(\\d{5})","$1 $2",["[245]"]]]],KY:["1","011","(?:345|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","345$1",0,"345"],KZ:["7","810","(?:33622|8\\d{8})\\d{5}|[78]\\d{9}",[10,14],0,"8",0,0,0,0,"33|7",0,"8~10"],LA:["856","00","[23]\\d{9}|3\\d{8}|(?:[235-8]\\d|41)\\d{6}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2[13]|3[14]|[4-8]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["30[013-9]"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[23]"],"0$1"]],"0"],LB:["961","00","[27-9]\\d{7}|[13-9]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[13-69]|7(?:[2-57]|62|8[0-7]|9[04-9])|8[02-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27-9]"]]],"0"],LC:["1","011","(?:[58]\\d\\d|758|900)\\d{7}",[10],0,"1",0,"([2-8]\\d{6})$|1","758$1",0,"758"],LI:["423","00","[68]\\d{8}|(?:[2378]\\d|90)\\d{5}",[7,9],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[2379]|8(?:0[09]|7)","[2379]|8(?:0(?:02|9)|7)"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["69"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]],"0",0,"(1001)|0"],LK:["94","00","[1-9]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[1-689]"],"0$1"]],"0"],LR:["231","00","(?:[25]\\d|33|77|88)\\d{7}|(?:2\\d|[4-6])\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[4-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[23578]"],"0$1"]],"0"],LS:["266","00","(?:[256]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2568]"]]]],LT:["370","00","(?:[3469]\\d|52|[78]0)\\d{6}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["52[0-7]"],"(8-$1)",1],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[7-9]"],"8 $1",1],["(\\d{2})(\\d{6})","$1 $2",["37|4(?:[15]|6[1-8])"],"(8-$1)",1],["(\\d{3})(\\d{5})","$1 $2",["[3-6]"],"(8-$1)",1]],"8",0,"[08]"],LU:["352","00","35[013-9]\\d{4,8}|6\\d{8}|35\\d{2,4}|(?:[2457-9]\\d|3[0-46-9])\\d{2,9}",[4,5,6,7,8,9,10,11],[["(\\d{2})(\\d{3})","$1 $2",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["20[2-689]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4",["2(?:[0367]|4[3-8])"]],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["80[01]|90[015]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["20"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4 $5",["2(?:[0367]|4[3-8])"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,5})","$1 $2 $3 $4",["[3-57]|8[13-9]|9(?:0[89]|[2-579])|(?:2|80)[2-9]"]]],0,0,"(15(?:0[06]|1[12]|[35]5|4[04]|6[26]|77|88|99)\\d)"],LV:["371","00","(?:[268]\\d|90)\\d{6}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[269]|8[01]"]]]],LY:["218","00","[2-9]\\d{8}",[9],[["(\\d{2})(\\d{7})","$1-$2",["[2-9]"],"0$1"]],"0"],MA:["212","00","[5-8]\\d{8}",[9],[["(\\d{5})(\\d{4})","$1-$2",["5(?:29|38)","5(?:29[1289]|389)","529(?:1[1-46-9]|2[013-8]|90)|5(?:298|389)[0-46-9]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["5[45]"],"0$1"],["(\\d{4})(\\d{5})","$1-$2",["5(?:2[2-489]|3[5-9]|9)|892","5(?:2(?:[2-49]|8[235-9])|3[5-9]|9)|892"],"0$1"],["(\\d{2})(\\d{7})","$1-$2",["8"],"0$1"],["(\\d{3})(\\d{6})","$1-$2",["[5-7]"],"0$1"]],"0",0,0,0,0,0,[["5293[01]\\d{4}|5(?:2(?:[0-25-7]\\d|3[1-578]|4[02-46-8]|8[0235-7]|9[0-289])|3(?:[0-47]\\d|5[02-9]|6[02-8]|8[0189]|9[3-9])|(?:4[067]|5[03])\\d)\\d{5}"],["(?:6(?:[0-79]\\d|8[0-247-9])|7(?:[017]\\d|2[0-2]|6[0-8]|8[0-3]))\\d{6}"],["80\\d{7}"],["89\\d{7}"],0,0,0,0,["592(?:4[0-2]|93)\\d{4}"]]],MC:["377","00","(?:[3489]|6\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["4"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[389]"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["6"],"0$1"]],"0"],MD:["373","00","(?:[235-7]\\d|[89]0)\\d{6}",[8],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["22|3"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[25-7]"],"0$1"]],"0"],ME:["382","00","(?:20|[3-79]\\d)\\d{6}|80\\d{6,7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"0$1"]],"0"],MF:["590","00","590\\d{6}|(?:69|80|9\\d)\\d{7}",[9],0,"0",0,0,0,0,0,[["590(?:0[079]|[14]3|[27][79]|3[03-7]|5[0-268]|87)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:395|76[018])\\d|475[0-5])\\d{4}"]]],MG:["261","00","[23]\\d{8}",[9],[["(\\d{2})(\\d{2})(\\d{3})(\\d{2})","$1 $2 $3 $4",["[23]"],"0$1"]],"0",0,"([24-9]\\d{6})$|0","20$1"],MH:["692","011","329\\d{4}|(?:[256]\\d|45)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1-$2",["[2-6]"]]],"1"],MK:["389","00","[2-578]\\d{7}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2|34[47]|4(?:[37]7|5[47]|64)"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[347]"],"0$1"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["[58]"],"0$1"]],"0"],ML:["223","00","[24-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-9]"]]]],MM:["95","00","1\\d{5,7}|95\\d{6}|(?:[4-7]|9[0-46-9])\\d{6,8}|(?:2|8\\d)\\d{5,8}",[6,7,8,9,10],[["(\\d)(\\d{2})(\\d{3})","$1 $2 $3",["16|2"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["[45]|6(?:0[23]|[1-689]|7[235-7])|7(?:[0-4]|5[2-7])|8[1-6]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[4-7]|8[1-35]"],"0$1"],["(\\d)(\\d{3})(\\d{4,6})","$1 $2 $3",["9(?:2[0-4]|[35-9]|4[137-9])"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["92"],"0$1"],["(\\d)(\\d{5})(\\d{4})","$1 $2 $3",["9"],"0$1"]],"0"],MN:["976","001","[12]\\d{7,9}|[5-9]\\d{7}",[8,9,10],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[12]1"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[5-9]"]],["(\\d{3})(\\d{5,6})","$1 $2",["[12]2[1-3]"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["[12](?:27|3[2-8]|4[2-68]|5[1-4689])","[12](?:27|3[2-8]|4[2-68]|5[1-4689])[0-3]"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["[12]"],"0$1"]],"0"],MO:["853","00","0800\\d{3}|(?:28|[68]\\d)\\d{6}",[7,8],[["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{4})(\\d{4})","$1 $2",["[268]"]]]],MP:["1","011","[58]\\d{9}|(?:67|90)0\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","670$1",0,"670"],MQ:["596","00","596\\d{6}|(?:69|80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[569]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],MR:["222","00","(?:[2-4]\\d\\d|800)\\d{5}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-48]"]]]],MS:["1","011","(?:[58]\\d\\d|664|900)\\d{7}",[10],0,"1",0,"([34]\\d{6})$|1","664$1",0,"664"],MT:["356","00","3550\\d{4}|(?:[2579]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2357-9]"]]]],MU:["230","0(?:0|[24-7]0|3[03])","(?:[57]|8\\d\\d)\\d{7}|[2-468]\\d{6}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[2-46]|8[013]"]],["(\\d{4})(\\d{4})","$1 $2",["[57]"]],["(\\d{5})(\\d{5})","$1 $2",["8"]]],0,0,0,0,0,0,0,"020"],MV:["960","0(?:0|19)","(?:800|9[0-57-9]\\d)\\d{7}|[34679]\\d{6}",[7,10],[["(\\d{3})(\\d{4})","$1-$2",["[34679]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"]]],0,0,0,0,0,0,0,"00"],MW:["265","00","(?:[1289]\\d|31|77)\\d{7}|1\\d{6}",[7,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["1[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[137-9]"],"0$1"]],"0"],MX:["52","0[09]","1(?:(?:[27]2|44|99)[1-9]|65[0-689])\\d{7}|(?:1(?:[01]\\d|2[13-9]|[35][1-9]|4[0-35-9]|6[0-46-9]|7[013-9]|8[1-79]|9[1-8])|[2-9]\\d)\\d{8}",[10,11],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["33|5[56]|81"],0,1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2-9]"],0,1],["(\\d)(\\d{2})(\\d{4})(\\d{4})","$2 $3 $4",["1(?:33|5[56]|81)"],0,1],["(\\d)(\\d{3})(\\d{3})(\\d{4})","$2 $3 $4",["1"],0,1]],"01",0,"0(?:[12]|4[45])|1",0,0,0,0,"00"],MY:["60","00","1\\d{8,9}|(?:3\\d|[4-9])\\d{7}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1-$2 $3",["[4-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1-$2 $3",["1(?:[02469]|[378][1-9]|53)|8","1(?:[02469]|[37][1-9]|53|8(?:[1-46-9]|5[7-9]))|8"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2 $3",["3"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3-$4",["1(?:[367]|80)"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2 $3",["15"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2 $3",["1"],"0$1"]],"0"],MZ:["258","00","(?:2|8\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2|8[2-79]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]]],NA:["264","00","[68]\\d{7,8}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["87"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0"],NC:["687","00","(?:050|[2-57-9]\\d\\d)\\d{3}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1.$2.$3",["[02-57-9]"]]]],NE:["227","00","[027-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["08"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[089]|2[013]|7[047]"]]]],NF:["672","00","[13]\\d{5}",[6],[["(\\d{2})(\\d{4})","$1 $2",["1[0-3]"]],["(\\d)(\\d{5})","$1 $2",["[13]"]]],0,0,"([0-258]\\d{4})$","3$1"],NG:["234","009","(?:[124-7]|9\\d{3})\\d{6}|[1-9]\\d{7}|[78]\\d{9,13}",[7,8,10,11,12,13,14],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["78"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]|9(?:0[3-9]|[1-9])"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["[3-7]|8[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[7-9]"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["[78]"],"0$1"],["(\\d{3})(\\d{5})(\\d{5,6})","$1 $2 $3",["[78]"],"0$1"]],"0"],NI:["505","00","(?:1800|[25-8]\\d{3})\\d{4}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[125-8]"]]]],NL:["31","00","(?:[124-7]\\d\\d|3(?:[02-9]\\d|1[0-8]))\\d{6}|8\\d{6,9}|9\\d{6,10}|1\\d{4,5}",[5,6,7,8,9,10,11],[["(\\d{3})(\\d{4,7})","$1 $2",["[89]0"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["66"],"0$1"],["(\\d)(\\d{8})","$1 $2",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["1[16-8]|2[259]|3[124]|4[17-9]|5[124679]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-578]|91"],"0$1"],["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3",["9"],"0$1"]],"0"],NO:["47","00","(?:0|[2-9]\\d{3})\\d{4}",[5,8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["8"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-79]"]]],0,0,0,0,0,"[02-689]|7[0-8]"],NP:["977","00","(?:1\\d|9)\\d{9}|[1-9]\\d{7}",[8,10,11],[["(\\d)(\\d{7})","$1-$2",["1[2-6]"],"0$1"],["(\\d{2})(\\d{6})","$1-$2",["1[01]|[2-8]|9(?:[1-59]|[67][2-6])"],"0$1"],["(\\d{3})(\\d{7})","$1-$2",["9"]]],"0"],NR:["674","00","(?:444|(?:55|8\\d)\\d|666)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[4-68]"]]]],NU:["683","00","(?:[47]|888\\d)\\d{3}",[4,7],[["(\\d{3})(\\d{4})","$1 $2",["8"]]]],NZ:["64","0(?:0|161)","[1289]\\d{9}|50\\d{5}(?:\\d{2,3})?|[27-9]\\d{7,8}|(?:[34]\\d|6[0-35-9])\\d{6}|8\\d{4,6}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,8})","$1 $2",["8[1-79]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["50[036-8]|8|90","50(?:[0367]|88)|8|90"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["24|[346]|7[2-57-9]|9[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:10|74)|[589]"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["1|2[028]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,5})","$1 $2 $3",["2(?:[169]|7[0-35-9])|7"],"0$1"]],"0",0,0,0,0,0,0,"00"],OM:["968","00","(?:1505|[279]\\d{3}|500)\\d{4}|800\\d{5,6}",[7,8,9],[["(\\d{3})(\\d{4,6})","$1 $2",["[58]"]],["(\\d{2})(\\d{6})","$1 $2",["2"]],["(\\d{4})(\\d{4})","$1 $2",["[179]"]]]],PA:["507","00","(?:00800|8\\d{3})\\d{6}|[68]\\d{7}|[1-57-9]\\d{6}",[7,8,10,11],[["(\\d{3})(\\d{4})","$1-$2",["[1-57-9]"]],["(\\d{4})(\\d{4})","$1-$2",["[68]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]]],PE:["51","00|19(?:1[124]|77|90)00","(?:[14-8]|9\\d)\\d{7}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["80"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["1"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[4-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"]]],"0",0,0,0,0,0,0,"00"," Anexo "],PF:["689","00","4\\d{5}(?:\\d{2})?|8\\d{7,8}",[6,8,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["44"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4|8[7-9]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]]],PG:["675","00|140[1-3]","(?:180|[78]\\d{3})\\d{4}|(?:[2-589]\\d|64)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["18|[2-69]|85"]],["(\\d{4})(\\d{4})","$1 $2",["[78]"]]],0,0,0,0,0,0,0,"00"],PH:["63","00","(?:[2-7]|9\\d)\\d{8}|2\\d{5}|(?:1800|8)\\d{7,9}",[6,8,9,10,11,12,13],[["(\\d)(\\d{5})","$1 $2",["2"],"(0$1)"],["(\\d{4})(\\d{4,6})","$1 $2",["3(?:23|39|46)|4(?:2[3-6]|[35]9|4[26]|76)|544|88[245]|(?:52|64|86)2","3(?:230|397|461)|4(?:2(?:35|[46]4|51)|396|4(?:22|63)|59[347]|76[15])|5(?:221|446)|642[23]|8(?:622|8(?:[24]2|5[13]))"],"(0$1)"],["(\\d{5})(\\d{4})","$1 $2",["346|4(?:27|9[35])|883","3469|4(?:279|9(?:30|56))|8834"],"(0$1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3-7]|8[2-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{4})(\\d{1,2})(\\d{3})(\\d{4})","$1 $2 $3 $4",["1"]]],"0"],PK:["92","00","122\\d{6}|[24-8]\\d{10,11}|9(?:[013-9]\\d{8,10}|2(?:[01]\\d\\d|2(?:[06-8]\\d|1[01]))\\d{7})|(?:[2-8]\\d{3}|92(?:[0-7]\\d|8[1-9]))\\d{6}|[24-9]\\d{8}|[89]\\d{7}",[8,9,10,11,12],[["(\\d{3})(\\d{3})(\\d{2,7})","$1 $2 $3",["[89]0"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["1"]],["(\\d{3})(\\d{6,7})","$1 $2",["2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:2[2-8]|3[27-9]|4[2-6]|6[3569]|9[25-8])","9(?:2[3-8]|98)|(?:2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:22|3[27-9]|4[2-6]|6[3569]|9[25-7]))[2-9]"],"(0$1)"],["(\\d{2})(\\d{7,8})","$1 $2",["(?:2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91)[2-9]"],"(0$1)"],["(\\d{5})(\\d{5})","$1 $2",["58"],"(0$1)"],["(\\d{3})(\\d{7})","$1 $2",["3"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[24-9]"],"(0$1)"]],"0"],PL:["48","00","(?:6|8\\d\\d)\\d{7}|[1-9]\\d{6}(?:\\d{2})?|[26]\\d{5}",[6,7,8,9,10],[["(\\d{5})","$1",["19"]],["(\\d{3})(\\d{3})","$1 $2",["11|20|64"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])1","(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])19"]],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["64"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["21|39|45|5[0137]|6[0469]|7[02389]|8(?:0[14]|8)"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[2-8]|[2-7]|8[1-79]|9[145]"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["8"]]]],PM:["508","00","[45]\\d{5}|(?:708|80\\d)\\d{6}",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[45]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["7"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],PR:["1","011","(?:[589]\\d\\d|787)\\d{7}",[10],0,"1",0,0,0,0,"787|939"],PS:["970","00","[2489]2\\d{6}|(?:1\\d|5)\\d{8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2489]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["5"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],PT:["351","00","1693\\d{5}|(?:[26-9]\\d|30)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["2[12]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["16|[236-9]"]]]],PW:["680","01[12]","(?:[24-8]\\d\\d|345|900)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],PY:["595","00","59\\d{4,6}|9\\d{5,10}|(?:[2-46-8]\\d|5[0-8])\\d{4,7}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3,6})","$1 $2",["[2-9]0"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["[26]1|3[289]|4[1246-8]|7[1-3]|8[1-36]"],"(0$1)"],["(\\d{3})(\\d{4,5})","$1 $2",["2[279]|3[13-5]|4[359]|5|6(?:[34]|7[1-46-8])|7[46-8]|85"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2[14-68]|3[26-9]|4[1246-8]|6(?:1|75)|7[1-35]|8[1-36]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["87"]],["(\\d{3})(\\d{6})","$1 $2",["9(?:[5-79]|8[1-6])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["9"]]],"0"],QA:["974","00","800\\d{4}|(?:2|800)\\d{6}|(?:0080|[3-7])\\d{7}",[7,8,9,11],[["(\\d{3})(\\d{4})","$1 $2",["2[16]|8"]],["(\\d{4})(\\d{4})","$1 $2",["[3-7]"]]]],RE:["262","00","(?:26|[689]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2689]"],"0$1"]],"0",0,0,0,0,0,[["26(?:2\\d\\d|3(?:0\\d|1[0-5]))\\d{4}"],["69(?:2\\d\\d|3(?:[06][0-6]|1[013]|2[0-2]|3[0-39]|4\\d|5[0-5]|7[0-27]|8[0-8]|9[0-479]))\\d{4}"],["80\\d{7}"],["89[1-37-9]\\d{6}"],0,0,0,0,["9(?:399[0-3]|479[0-5]|76(?:2[27]|3[0-37]))\\d{4}"],["8(?:1[019]|2[0156]|84|90)\\d{6}"]]],RO:["40","00","(?:[2378]\\d|90)\\d{7}|[23]\\d{5}",[6,9],[["(\\d{3})(\\d{3})","$1 $2",["2[3-6]","2[3-6]\\d9"],"0$1"],["(\\d{2})(\\d{4})","$1 $2",["219|31"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[23]1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[237-9]"],"0$1"]],"0",0,0,0,0,0,0,0," int "],RS:["381","00","38[02-9]\\d{6,9}|6\\d{7,9}|90\\d{4,8}|38\\d{5,6}|(?:7\\d\\d|800)\\d{3,9}|(?:[12]\\d|3[0-79])\\d{5,10}",[6,7,8,9,10,11,12],[["(\\d{3})(\\d{3,9})","$1 $2",["(?:2[389]|39)0|[7-9]"],"0$1"],["(\\d{2})(\\d{5,10})","$1 $2",["[1-36]"],"0$1"]],"0"],RU:["7","810","8\\d{13}|[347-9]\\d{9}",[10,14],[["(\\d{4})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-8]|2[1-9])","7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:1[23]|[2-9]2))","7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:13[03-69]|62[013-9]))|72[1-57-9]2"],"8 ($1)",1],["(\\d{5})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-68]|2[1-9])","7(?:1(?:[06][3-6]|[18]|2[35]|[3-5][3-5])|2(?:[13][3-5]|[24-689]|7[457]))","7(?:1(?:0(?:[356]|4[023])|[18]|2(?:3[013-9]|5)|3[45]|43[013-79]|5(?:3[1-8]|4[1-7]|5)|6(?:3[0-35-9]|[4-6]))|2(?:1(?:3[178]|[45])|[24-689]|3[35]|7[457]))|7(?:14|23)4[0-8]|71(?:33|45)[1-79]"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[349]|8(?:[02-7]|1[1-8])"],"8 ($1)",1],["(\\d{4})(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3 $4",["8"],"8 ($1)"]],"8",0,0,0,0,"3[04-689]|[489]",0,"8~10"],RW:["250","00","(?:06|[27]\\d\\d|[89]00)\\d{6}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[7-9]"],"0$1"]],"0"],SA:["966","00","92\\d{7}|(?:[15]|8\\d)\\d{8}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["9"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["81"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]],"0"],SB:["677","0[01]","(?:[1-6]|[7-9]\\d\\d)\\d{4}",[5,7],[["(\\d{2})(\\d{5})","$1 $2",["7|8[4-9]|9(?:[1-8]|9[0-8])"]]]],SC:["248","010|0[0-2]","800\\d{4}|(?:[249]\\d|64)\\d{5}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[246]|9[57]"]]],0,0,0,0,0,0,0,"00"],SD:["249","00","[19]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[19]"],"0$1"]],"0"],SE:["46","00","(?:[26]\\d\\d|9)\\d{9}|[1-9]\\d{8}|[1-689]\\d{7}|[1-4689]\\d{6}|2\\d{5}",[6,7,8,9,10],[["(\\d{2})(\\d{2,3})(\\d{2})","$1-$2 $3",["20"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{4})","$1-$2",["9(?:00|39|44|9)"],"0$1",0,"$1 $2"],["(\\d{2})(\\d{3})(\\d{2})","$1-$2 $3",["[12][136]|3[356]|4[0246]|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3"],["(\\d)(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2,3})(\\d{2})","$1-$2 $3",["1[2457]|2(?:[247-9]|5[0138])|3[0247-9]|4[1357-9]|5[0-35-9]|6(?:[125689]|4[02-57]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{2,3})(\\d{3})","$1-$2 $3",["9(?:00|39|44)"],"0$1",0,"$1 $2 $3"],["(\\d{2})(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["1[13689]|2[0136]|3[1356]|4[0246]|54|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3 $4"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["10|7"],"0$1",0,"$1 $2 $3 $4"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1-$2 $3 $4",["[13-5]|2(?:[247-9]|5[0138])|6(?:[124-689]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{3})","$1-$2 $3 $4",["9"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4 $5",["[26]"],"0$1",0,"$1 $2 $3 $4 $5"]],"0"],SG:["65","0[0-3]\\d","(?:(?:1\\d|8)\\d\\d|7000)\\d{7}|[3689]\\d{7}",[8,10,11],[["(\\d{4})(\\d{4})","$1 $2",["[369]|8(?:0[1-8]|[1-9])"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]],["(\\d{4})(\\d{4})(\\d{3})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]]],SH:["290","00","(?:[256]\\d|8)\\d{3}",[4,5],0,0,0,0,0,0,"[256]"],SI:["386","00|10(?:22|66|88|99)","[1-7]\\d{7}|8\\d{4,7}|90\\d{4,6}",[5,6,7,8],[["(\\d{2})(\\d{3,6})","$1 $2",["8[09]|9"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["59|8"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37][01]|4[0139]|51|6"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-57]"],"(0$1)"]],"0",0,0,0,0,0,0,"00"],SJ:["47","00","0\\d{4}|(?:[489]\\d|79)\\d{6}",[5,8],0,0,0,0,0,0,"79"],SK:["421","00","[2-689]\\d{8}|[2-59]\\d{6}|[2-5]\\d{5}",[6,7,9],[["(\\d)(\\d{2})(\\d{3,4})","$1 $2 $3",["21"],"0$1"],["(\\d{2})(\\d{2})(\\d{2,3})","$1 $2 $3",["[3-5][1-8]1","[3-5][1-8]1[67]"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1/$2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[689]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1/$2 $3 $4",["[3-5]"],"0$1"]],"0"],SL:["232","00","(?:[237-9]\\d|66)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[236-9]"],"(0$1)"]],"0"],SM:["378","00","(?:0549|[5-7]\\d)\\d{6}",[8,10],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-7]"]],["(\\d{4})(\\d{6})","$1 $2",["0"]]],0,0,"([89]\\d{5})$","0549$1"],SN:["221","00","(?:[378]\\d|93)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[379]"]]]],SO:["252","00","[346-9]\\d{8}|[12679]\\d{7}|[1-5]\\d{6}|[1348]\\d{5}",[6,7,8,9],[["(\\d{2})(\\d{4})","$1 $2",["8[125]"]],["(\\d{6})","$1",["[134]"]],["(\\d)(\\d{6})","$1 $2",["[15]|2[0-79]|3[0-46-8]|4[0-7]"]],["(\\d)(\\d{7})","$1 $2",["(?:2|90)4|[67]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[348]|64|79|90"]],["(\\d{2})(\\d{5,7})","$1 $2",["1|28|6[0-35-9]|77|9[2-9]"]]],"0"],SR:["597","00","(?:[2-5]|68|[78]\\d)\\d{5}",[6,7],[["(\\d{2})(\\d{2})(\\d{2})","$1-$2-$3",["56"]],["(\\d{3})(\\d{3})","$1-$2",["[2-5]"]],["(\\d{3})(\\d{4})","$1-$2",["[6-8]"]]]],SS:["211","00","[19]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[19]"],"0$1"]],"0"],ST:["239","00","(?:22|9\\d)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[29]"]]]],SV:["503","00","[267]\\d{7}|[89]00\\d{4}(?:\\d{4})?",[7,8,11],[["(\\d{3})(\\d{4})","$1 $2",["[89]"]],["(\\d{4})(\\d{4})","$1 $2",["[267]"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[89]"]]]],SX:["1","011","7215\\d{6}|(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"(5\\d{6})$|1","721$1",0,"721"],SY:["963","00","[1-39]\\d{8}|[1-5]\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-5]"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1",1]],"0"],SZ:["268","00","0800\\d{4}|(?:[237]\\d|900)\\d{6}",[8,9],[["(\\d{4})(\\d{4})","$1 $2",["[0237]"]],["(\\d{5})(\\d{4})","$1 $2",["9"]]]],TA:["290","00","8\\d{3}",[4],0,0,0,0,0,0,"8"],TC:["1","011","(?:[58]\\d\\d|649|900)\\d{7}",[10],0,"1",0,"([2-479]\\d{6})$|1","649$1",0,"649"],TD:["235","00|16","(?:22|[69]\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2679]"]]],0,0,0,0,0,0,0,"00"],TG:["228","00","[279]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[279]"]]]],TH:["66","00[1-9]","(?:001800|[2-57]|[689]\\d)\\d{7}|1\\d{7,9}",[8,9,10,13],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[13-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],TJ:["992","810","[0-57-9]\\d{8}",[9],[["(\\d{6})(\\d)(\\d{2})","$1 $2 $3",["331","3317"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["44[04]|[34]7"]],["(\\d{4})(\\d)(\\d{4})","$1 $2 $3",["3[1-5]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[0-57-9]"]]],0,0,0,0,0,0,0,"8~10"],TK:["690","00","[2-47]\\d{3,6}",[4,5,6,7]],TL:["670","00","7\\d{7}|(?:[2-47]\\d|[89]0)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[2-489]|70"]],["(\\d{4})(\\d{4})","$1 $2",["7"]]]],TM:["993","810","[1-6]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["12"],"(8 $1)"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-5]"],"(8 $1)"],["(\\d{2})(\\d{6})","$1 $2",["6"],"8 $1"]],"8",0,0,0,0,0,0,"8~10"],TN:["216","00","[2-57-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-57-9]"]]]],TO:["676","00","(?:0800|(?:[5-8]\\d\\d|999)\\d)\\d{3}|[2-8]\\d{4}",[5,7],[["(\\d{2})(\\d{3})","$1-$2",["[2-4]|50|6[09]|7[0-24-69]|8[05]"]],["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{3})(\\d{4})","$1 $2",["[5-9]"]]]],TR:["90","00","4\\d{6}|8\\d{11,12}|(?:[2-58]\\d\\d|900)\\d{7}",[7,10,12,13],[["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["512|8[01589]|90"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["5(?:[0-59]|61)","5(?:[0-59]|616)","5(?:[0-59]|6161)"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24][1-8]|3[1-9]"],"(0$1)",1],["(\\d{3})(\\d{3})(\\d{6,7})","$1 $2 $3",["80"],"0$1",1]],"0"],TT:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-46-8]\\d{6})$|1","868$1",0,"868"],TV:["688","00","(?:2|7\\d\\d|90)\\d{4}",[5,6,7],[["(\\d{2})(\\d{3})","$1 $2",["2"]],["(\\d{2})(\\d{4})","$1 $2",["90"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]]],TW:["886","0(?:0[25-79]|19)","[2-689]\\d{8}|7\\d{9,10}|[2-8]\\d{7}|2\\d{6}",[7,8,9,10,11],[["(\\d{2})(\\d)(\\d{4})","$1 $2 $3",["202"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[258]0"],"0$1"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["[23568]|4(?:0[02-48]|[1-47-9])|7[1-9]","[23568]|4(?:0[2-48]|[1-47-9])|(?:400|7)[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,5})","$1 $2 $3",["7"],"0$1"]],"0",0,0,0,0,0,0,0,"#"],TZ:["255","00[056]","(?:[25-8]\\d|41|90)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[24]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["5"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[67]"],"0$1"]],"0"],UA:["380","00","[89]\\d{9}|[3-9]\\d{8}",[9,10],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6[12][29]|(?:3[1-8]|4[136-8]|5[12457]|6[49])2|(?:56|65)[24]","6[12][29]|(?:35|4[1378]|5[12457]|6[49])2|(?:56|65)[24]|(?:3[1-46-8]|46)2[013-9]"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6[0135689]|7[4-6])|6(?:[12][3-7]|[459])","3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6(?:[015689]|3[02389])|7[4-6])|6(?:[12][3-7]|[459])"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3-7]|89|9[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0",0,0,0,0,0,0,"0~0"],UG:["256","00[057]","800\\d{6}|(?:[29]0|[347]\\d)\\d{7}",[9],[["(\\d{4})(\\d{5})","$1 $2",["202","2024"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[27-9]|4(?:6[45]|[7-9])"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[34]"],"0$1"]],"0"],US:["1","011","[2-9]\\d{9}|3\\d{6}",[10],[["(\\d{3})(\\d{4})","$1-$2",["310"],0,1],["(\\d{3})(\\d{3})(\\d{4})","($1) $2-$3",["[2-9]"],0,1,"$1-$2-$3"]],"1",0,0,0,0,0,[["5056(?:[0-35-9]\\d|4[46])\\d{4}|(?:4722|505[2-57-9]|983[29])\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-589]|3[149]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-57-9]|1[02-9]|2[01356]|3[0-24679]|4[167]|5[0-2]|6[014]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-47-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|[34][016]|5[01679]|6[0-279]|78|8[0-29])|7(?:0[1-46-8]|1[2-9]|2[04-7]|3[1247]|4[037]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[068]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-389]|8[04-69]))[2-9]\\d{6}"],[""],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}"]]],UY:["598","0(?:0|1[3-9]\\d)","(?:0004|4)\\d{9}|[1249]\\d{7}|(?:[49]\\d|80)\\d{5}",[7,8,10,13],[["(\\d{3})(\\d{4})","$1 $2",["405|8|90"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[124]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["4"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3 $4",["0"]]],"0",0,0,0,0,0,0,"00"," int. "],UZ:["998","810","200\\d{6}|(?:33|[5-79]\\d|88)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[235-9]"],"8 $1"]],"8",0,0,0,0,0,0,"8~10"],VA:["39","00","0\\d{5,10}|3[0-8]\\d{7,10}|55\\d{8}|8\\d{5}(?:\\d{2,4})?|(?:1\\d|39)\\d{7,8}",[6,7,8,9,10,11],0,0,0,0,0,0,"06698"],VC:["1","011","(?:[58]\\d\\d|784|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","784$1",0,"784"],VE:["58","00","[68]00\\d{7}|(?:[24]\\d|[59]0)\\d{8}",[10],[["(\\d{3})(\\d{7})","$1-$2",["[24-689]"],"0$1"]],"0"],VG:["1","011","(?:284|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-578]\\d{6})$|1","284$1",0,"284"],VI:["1","011","[58]\\d{9}|(?:34|90)0\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","340$1",0,"340"],VN:["84","00","[12]\\d{9}|[135-9]\\d{8}|[16]\\d{7}|[16-8]\\d{6}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["80"],"0$1",1],["(\\d{4})(\\d{4,6})","$1 $2",["1"],0,1],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["6"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[357-9]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["2[48]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["2"],"0$1",1]],"0"],VU:["678","00","[57-9]\\d{6}|(?:[238]\\d|48)\\d{3}",[5,7],[["(\\d{3})(\\d{4})","$1 $2",["[57-9]"]]]],WF:["681","00","(?:40|72)\\d{4}|8\\d{5}(?:\\d{3})?",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[478]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]]],WS:["685","0","(?:[2-6]|8\\d{5})\\d{4}|[78]\\d{6}|[68]\\d{5}",[5,6,7,10],[["(\\d{5})","$1",["[2-5]|6[1-9]"]],["(\\d{3})(\\d{3,7})","$1 $2",["[68]"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]]],XK:["383","00","[23]\\d{7,8}|(?:4\\d\\d|[89]00)\\d{5}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[23]"],"0$1"]],"0"],YE:["967","00","(?:1|7\\d)\\d{7}|[1-7]\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-6]|7(?:[24-6]|8[0-7])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["7"],"0$1"]],"0"],YT:["262","00","(?:80|9\\d)\\d{7}|(?:26|63)9\\d{6}",[9],0,"0",0,0,0,0,0,[["269(?:0[0-467]|5[0-4]|6\\d|[78]0)\\d{4}"],["639(?:0[0-79]|1[019]|[267]\\d|3[09]|40|5[05-9]|9[04-79])\\d{4}"],["80\\d{7}"],0,0,0,0,0,["9(?:(?:39|47)8[01]|769\\d)\\d{4}"]]],ZA:["27","00","[1-79]\\d{8}|8\\d{4,9}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,4})","$1 $2",["8[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["8[1-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["860"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0"],ZM:["260","00","800\\d{6}|(?:21|63|[79]\\d)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[28]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[79]"],"0$1"]],"0"],ZW:["263","00","2(?:[0-57-9]\\d{6,8}|6[0-24-9]\\d{6,7})|[38]\\d{9}|[35-8]\\d{8}|[3-6]\\d{7}|[1-689]\\d{6}|[1-3569]\\d{5}|[1356]\\d{4}",[5,6,7,8,9,10],[["(\\d{3})(\\d{3,5})","$1 $2",["2(?:0[45]|2[278]|[49]8)|3(?:[09]8|17)|6(?:[29]8|37|75)|[23][78]|(?:33|5[15]|6[68])[78]"],"0$1"],["(\\d)(\\d{3})(\\d{2,4})","$1 $2 $3",["[49]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["80"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["24|8[13-59]|(?:2[05-79]|39|5[45]|6[15-8])2","2(?:02[014]|4|[56]20|[79]2)|392|5(?:42|525)|6(?:[16-8]21|52[013])|8[13-59]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:1[39]|2[0157]|[378]|[56][14])|3(?:12|29)","2(?:1[39]|2[0157]|[378]|[56][14])|3(?:123|29)"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["1|2(?:0[0-36-9]|12|29|[56])|3(?:1[0-689]|[24-6])|5(?:[0236-9]|1[2-4])|6(?:[013-59]|7[0-46-9])|(?:33|55|6[68])[0-69]|(?:29|3[09]|62)[0-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["29[013-9]|39|54"],"0$1"],["(\\d{4})(\\d{3,5})","$1 $2",["(?:25|54)8","258|5483"],"0$1"]],"0"]},nonGeographic:{800:["800",0,"(?:00|[1-9]\\d)\\d{6}",[8],[["(\\d{4})(\\d{4})","$1 $2",["\\d"]]],0,0,0,0,0,0,[0,0,["(?:00|[1-9]\\d)\\d{6}"]]],808:["808",0,"[1-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[1-9]"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,0,["[1-9]\\d{7}"]]],870:["870",0,"7\\d{11}|[35-7]\\d{8}",[9,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[35-7]"]]],0,0,0,0,0,0,[0,["(?:[356]|774[45])\\d{8}|7[6-8]\\d{7}"]]],878:["878",0,"10\\d{10}",[12],[["(\\d{2})(\\d{5})(\\d{5})","$1 $2 $3",["1"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["10\\d{10}"]]],881:["881",0,"[0-36-9]\\d{8}",[9],[["(\\d)(\\d{3})(\\d{5})","$1 $2 $3",["[0-36-9]"]]],0,0,0,0,0,0,[0,["[0-36-9]\\d{8}"]]],882:["882",0,"[13]\\d{6}(?:\\d{2,5})?|[19]\\d{7}|(?:[25]\\d\\d|4)\\d{7}(?:\\d{2})?",[7,8,9,10,11,12],[["(\\d{2})(\\d{5})","$1 $2",["16|342"]],["(\\d{2})(\\d{6})","$1 $2",["49"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["1[36]|9"]],["(\\d{2})(\\d{4})(\\d{3})","$1 $2 $3",["3[23]"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["16"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["10|23|3(?:[15]|4[57])|4|51"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["34"]],["(\\d{2})(\\d{4,5})(\\d{5})","$1 $2 $3",["[1-35]"]]],0,0,0,0,0,0,[0,["342\\d{4}|(?:337|49)\\d{6}|(?:3(?:2|47|7\\d{3})|50\\d{3})\\d{7}",[7,8,9,10,12]],0,0,0,0,0,0,["1(?:3(?:0[0347]|[13][0139]|2[035]|4[013568]|6[0459]|7[06]|8[15-8]|9[0689])\\d{4}|6\\d{5,10})|(?:345\\d|9[89])\\d{6}|(?:10|2(?:3|85\\d)|3(?:[15]|[69]\\d\\d)|4[15-8]|51)\\d{8}"]]],883:["883",0,"(?:[1-4]\\d|51)\\d{6,10}",[8,9,10,11,12],[["(\\d{3})(\\d{3})(\\d{2,8})","$1 $2 $3",["[14]|2[24-689]|3[02-689]|51[24-9]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["510"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["21"]],["(\\d{4})(\\d{4})(\\d{4})","$1 $2 $3",["51[13]"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[235]"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["(?:2(?:00\\d\\d|10)|(?:370[1-9]|51\\d0)\\d)\\d{7}|51(?:00\\d{5}|[24-9]0\\d{4,7})|(?:1[013-79]|2[24-689]|3[02-689]|4[0-4])0\\d{5,9}"]]],888:["888",0,"\\d{11}",[11],[["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3"]],0,0,0,0,0,0,[0,0,0,0,0,0,["\\d{11}"]]],979:["979",0,"[1359]\\d{8}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[1359]"]]],0,0,0,0,0,0,[0,0,0,["[1359]\\d{8}"]]]}};function hr(e,t){var r=Array.prototype.slice.call(t);return r.push(ur),e.apply(this,r)}function pr(e){return(pr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function yr(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function mr(e){var t="function"==typeof Map?new Map:void 0;return(mr=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return fr(e,arguments,wr(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),vr(r,e)})(e)}function fr(e,t,r){return(fr=gr()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&vr(i,r.prototype),i}).apply(null,arguments)}function gr(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function vr(e,t){return(vr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function wr(e){return(wr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var xr=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&vr(e,t)}(n,mr(Error));var t,r=(t=gr(),function(){var e=wr(n);return function(e,t){if(t&&("object"===pr(t)||"function"==typeof t))return t;if(void 0!==t)throw TypeError("Derived constructors may only return object or undefined");return yr(e)}(this,t?Reflect.construct(e,arguments,wr(this).constructor):e.apply(this,arguments))});function n(e){var t;return function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,n),Object.setPrototypeOf(yr(t=r.call(this,e)),n.prototype),t.name=t.constructor.name,t}return Object.defineProperty(n,"prototype",{writable:!1}),n}(),Cr="0-90-9٠-٩۰-۹",Er="".concat("-‐-―−ー-").concat("//").concat("..").concat(" ").concat("()()[]\\[\\]").concat("~⁓∼~");function br(e,t){e=e.split("-"),t=t.split("-");for(var r=e[0].split("."),n=t[0].split("."),i=0;i<3;i++){var a=Number(r[i]),o=Number(n[i]);if(a>o)return 1;if(o>a)return-1;if(!isNaN(a)&&isNaN(o))return 1;if(isNaN(a)&&!isNaN(o))return-1}return e[1]&&t[1]?e[1]>t[1]?1:e[1]<t[1]?-1:0:!e[1]&&t[1]?1:e[1]&&!t[1]?-1:0}function Sr(e){return(Sr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ar(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function jr(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var $r=" ext. ",Tr=/^\d+$/,Pr=function(){function e(t){Ar(this,e),function(e){if(!e)throw Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!Or(e)||!Or(e.countries))throw Error("[libphonenumber-js] `metadata` argument was passed but it's not a valid metadata. Must be an object having `.countries` child object property. Got ".concat(Or(e)?"an object of shape: { "+Object.keys(e).join(", ")+" }":"a "+Rr(e)+": "+e,"."))}(t),this.metadata=t,Lr.call(this,t)}return jr(e,[{key:"getCountries",value:function(){return Object.keys(this.metadata.countries).filter((function(e){return"001"!==e}))}},{key:"getCountryMetadata",value:function(e){return this.metadata.countries[e]}},{key:"nonGeographic",value:function(){if(!(this.v1||this.v2||this.v3))return this.metadata.nonGeographic||this.metadata.nonGeographical}},{key:"hasCountry",value:function(e){return void 0!==this.getCountryMetadata(e)}},{key:"hasCallingCode",value:function(e){if(this.getCountryCodesForCallingCode(e))return!0;if(this.nonGeographic()){if(this.nonGeographic()[e])return!0}else{var t=this.countryCallingCodes()[e];if(t&&1===t.length&&"001"===t[0])return!0}}},{key:"isNonGeographicCallingCode",value:function(e){return this.nonGeographic()?!!this.nonGeographic()[e]:!this.getCountryCodesForCallingCode(e)}},{key:"country",value:function(e){return this.selectNumberingPlan(e)}},{key:"selectNumberingPlan",value:function(e,t){if(e&&Tr.test(e)&&(t=e,e=null),e&&"001"!==e){if(!this.hasCountry(e))throw Error("Unknown country: ".concat(e));this.numberingPlan=new _r(this.getCountryMetadata(e),this)}else if(t){if(!this.hasCallingCode(t))throw Error("Unknown calling code: ".concat(t));this.numberingPlan=new _r(this.getNumberingPlanMetadata(t),this)}else this.numberingPlan=void 0;return this}},{key:"getCountryCodesForCallingCode",value:function(e){var t=this.countryCallingCodes()[e];if(t){if(1===t.length&&3===t[0].length)return;return t}}},{key:"getCountryCodeForCallingCode",value:function(e){var t=this.getCountryCodesForCallingCode(e);if(t)return t[0]}},{key:"getNumberingPlanMetadata",value:function(e){var t=this.getCountryCodeForCallingCode(e);if(t)return this.getCountryMetadata(t);if(this.nonGeographic()){var r=this.nonGeographic()[e];if(r)return r}else{var n=this.countryCallingCodes()[e];if(n&&1===n.length&&"001"===n[0])return this.metadata.countries["001"]}}},{key:"countryCallingCode",value:function(){return this.numberingPlan.callingCode()}},{key:"IDDPrefix",value:function(){return this.numberingPlan.IDDPrefix()}},{key:"defaultIDDPrefix",value:function(){return this.numberingPlan.defaultIDDPrefix()}},{key:"nationalNumberPattern",value:function(){return this.numberingPlan.nationalNumberPattern()}},{key:"possibleLengths",value:function(){return this.numberingPlan.possibleLengths()}},{key:"formats",value:function(){return this.numberingPlan.formats()}},{key:"nationalPrefixForParsing",value:function(){return this.numberingPlan.nationalPrefixForParsing()}},{key:"nationalPrefixTransformRule",value:function(){return this.numberingPlan.nationalPrefixTransformRule()}},{key:"leadingDigits",value:function(){return this.numberingPlan.leadingDigits()}},{key:"hasTypes",value:function(){return this.numberingPlan.hasTypes()}},{key:"type",value:function(e){return this.numberingPlan.type(e)}},{key:"ext",value:function(){return this.numberingPlan.ext()}},{key:"countryCallingCodes",value:function(){return this.v1?this.metadata.country_phone_code_to_countries:this.metadata.country_calling_codes}},{key:"chooseCountryByCountryCallingCode",value:function(e){return this.selectNumberingPlan(e)}},{key:"hasSelectedNumberingPlan",value:function(){return void 0!==this.numberingPlan}}]),e}(),_r=function(){function e(t,r){Ar(this,e),this.globalMetadataObject=r,this.metadata=t,Lr.call(this,r.metadata)}return jr(e,[{key:"callingCode",value:function(){return this.metadata[0]}},{key:"getDefaultCountryMetadataForRegion",value:function(){return this.globalMetadataObject.getNumberingPlanMetadata(this.callingCode())}},{key:"IDDPrefix",value:function(){if(!this.v1&&!this.v2)return this.metadata[1]}},{key:"defaultIDDPrefix",value:function(){if(!this.v1&&!this.v2)return this.metadata[12]}},{key:"nationalNumberPattern",value:function(){return this.v1||this.v2?this.metadata[1]:this.metadata[2]}},{key:"possibleLengths",value:function(){if(!this.v1)return this.metadata[this.v2?2:3]}},{key:"_getFormats",value:function(e){return e[this.v1?2:this.v2?3:4]}},{key:"formats",value:function(){var e=this;return(this._getFormats(this.metadata)||this._getFormats(this.getDefaultCountryMetadataForRegion())||[]).map((function(t){return new kr(t,e)}))}},{key:"nationalPrefix",value:function(){return this.metadata[this.v1?3:this.v2?4:5]}},{key:"_getNationalPrefixFormattingRule",value:function(e){return e[this.v1?4:this.v2?5:6]}},{key:"nationalPrefixFormattingRule",value:function(){return this._getNationalPrefixFormattingRule(this.metadata)||this._getNationalPrefixFormattingRule(this.getDefaultCountryMetadataForRegion())}},{key:"_nationalPrefixForParsing",value:function(){return this.metadata[this.v1?5:this.v2?6:7]}},{key:"nationalPrefixForParsing",value:function(){return this._nationalPrefixForParsing()||this.nationalPrefix()}},{key:"nationalPrefixTransformRule",value:function(){return this.metadata[this.v1?6:this.v2?7:8]}},{key:"_getNationalPrefixIsOptionalWhenFormatting",value:function(){return!!this.metadata[this.v1?7:this.v2?8:9]}},{key:"nationalPrefixIsOptionalWhenFormattingInNationalFormat",value:function(){return this._getNationalPrefixIsOptionalWhenFormatting(this.metadata)||this._getNationalPrefixIsOptionalWhenFormatting(this.getDefaultCountryMetadataForRegion())}},{key:"leadingDigits",value:function(){return this.metadata[this.v1?8:this.v2?9:10]}},{key:"types",value:function(){return this.metadata[this.v1?9:this.v2?10:11]}},{key:"hasTypes",value:function(){return!(this.types()&&0===this.types().length||!this.types())}},{key:"type",value:function(e){if(this.hasTypes()&&Mr(this.types(),e))return new Ir(Mr(this.types(),e),this)}},{key:"ext",value:function(){return this.v1||this.v2?$r:this.metadata[13]||$r}}]),e}(),kr=function(){function e(t,r){Ar(this,e),this._format=t,this.metadata=r}return jr(e,[{key:"pattern",value:function(){return this._format[0]}},{key:"format",value:function(){return this._format[1]}},{key:"leadingDigitsPatterns",value:function(){return this._format[2]||[]}},{key:"nationalPrefixFormattingRule",value:function(){return this._format[3]||this.metadata.nationalPrefixFormattingRule()}},{key:"nationalPrefixIsOptionalWhenFormattingInNationalFormat",value:function(){return!!this._format[4]||this.metadata.nationalPrefixIsOptionalWhenFormattingInNationalFormat()}},{key:"nationalPrefixIsMandatoryWhenFormattingInNationalFormat",value:function(){return this.usesNationalPrefix()&&!this.nationalPrefixIsOptionalWhenFormattingInNationalFormat()}},{key:"usesNationalPrefix",value:function(){return!(!this.nationalPrefixFormattingRule()||Nr.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}]),e}(),Nr=/^\(?\$1\)?$/,Ir=function(){function e(t,r){Ar(this,e),this.type=t,this.metadata=r}return jr(e,[{key:"pattern",value:function(){return this.metadata.v1?this.type:this.type[0]}},{key:"possibleLengths",value:function(){if(!this.metadata.v1)return this.type[1]||this.metadata.possibleLengths()}}]),e}();function Mr(e,t){switch(t){case"FIXED_LINE":return e[0];case"MOBILE":return e[1];case"TOLL_FREE":return e[2];case"PREMIUM_RATE":return e[3];case"PERSONAL_NUMBER":return e[4];case"VOICEMAIL":return e[5];case"UAN":return e[6];case"PAGER":return e[7];case"VOIP":return e[8];case"SHARED_COST":return e[9]}}var Or=function(e){return"object"===Sr(e)},Rr=function(e){return Sr(e)};function Fr(e,t){if((t=new Pr(t)).hasCountry(e))return t.country(e).countryCallingCode();throw Error("Unknown country: ".concat(e))}function Lr(e){var t=e.version;"number"==typeof t?(this.v1=1===t,this.v2=2===t,this.v3=3===t,this.v4=4===t):t?-1===br(t,"1.2.0")?this.v2=!0:-1===br(t,"1.7.35")?this.v3=!0:this.v4=!0:this.v1=!0}var Ur=function(e){return"([".concat(Cr,"]{1,").concat(e,"})")};function Dr(e){var t="[ \\t,]*",r="[:\\..]?[ \\t,-]*",n="[ \\t]*";return";ext="+Ur("20")+"|"+t+"(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)"+r+Ur("20")+"#?|"+t+"(?:[xx##~~]|int|int)"+r+Ur("9")+"#?|[- ]+"+Ur("6")+"#|"+n+"(?:,{2}|;)"+r+Ur("15")+"#?|"+n+"(?:,)+"+r+Ur("9")+"#?"}var Wr=RegExp("^[++]{0,1}(?:["+Er+"]*["+Cr+"]){1,2}$","i"),Br="[++]{0,1}(?:["+Er+"]*["+Cr+"]){3,}["+Er+Cr+"]*(?:"+Dr()+")?",Hr=RegExp("^["+Cr+"]{2}$|^"+Br+"$","i"),Gr=RegExp("(?:"+Dr()+")$","i");function qr(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var zr={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9","0":"0","1":"1","2":"2","3":"3","4":"4","5":"5","6":"6","7":"7","8":"8","9":"9","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","۰":"0","۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9"};function Vr(e){for(var t,r="",n=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return qr(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return qr(e,void 0)}}(e))){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(e.split(""));!(t=n()).done;){var i=zr[t.value];i&&(r+=i)}return r}function Kr(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Yr(e){for(var t,r="",n=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return Kr(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Kr(e,void 0)}}(e))){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(e.split(""));!(t=n()).done;)r+=function(e,t){if("+"===e){if(t)return;return"+"}return zr[e]}(t.value,r)||"";return r}function Zr(e,t){return function(e,t,r){var n=r.type(t),i=n&&n.possibleLengths()||r.possibleLengths();if(!i)return"IS_POSSIBLE";var a=e.length,o=i[0];return o===a?"IS_POSSIBLE":o>a?"TOO_SHORT":i[i.length-1]<a?"TOO_LONG":i.indexOf(a,1)>=0?"IS_POSSIBLE":"INVALID_LENGTH"}(e,void 0,t)}function Xr(e,t){return"IS_POSSIBLE"===Zr(e,t)}function Jr(e,t){return e=e||"",RegExp("^(?:"+t+")$").test(e)}function Qr(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var en=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function tn(e,t,r){if(t=t||{},e.country){(r=new Pr(r)).selectNumberingPlan(e.country,e.countryCallingCode);var n=t.v2?e.nationalNumber:e.phone;if(Jr(n,r.nationalNumberPattern())){if(rn(n,"FIXED_LINE",r))return r.type("MOBILE")&&""===r.type("MOBILE").pattern()?"FIXED_LINE_OR_MOBILE":r.type("MOBILE")?rn(n,"MOBILE",r)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE":"FIXED_LINE_OR_MOBILE";for(var i,a=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return Qr(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Qr(e,void 0)}}(e))){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(en);!(i=a()).done;){var o=i.value;if(rn(n,o,r))return o}}}}function rn(e,t,r){return!(!(t=r.type(t))||!t.pattern())&&!(t.possibleLengths()&&0>t.possibleLengths().indexOf(e.length))&&Jr(e,t.pattern())}function nn(e){return e.replace(RegExp("[".concat(Er,"]+"),"g")," ").trim()}var an=/(\$\d)/;function on(e,t,r){var n=r.useInternationalFormat,i=r.withNationalPrefix;r.carrierCode,r.metadata;var a=e.replace(new RegExp(t.pattern()),n?t.internationalFormat():i&&t.nationalPrefixFormattingRule()?t.format().replace(an,t.nationalPrefixFormattingRule()):t.format());return n?nn(a):a}var sn=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function ln(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function dn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function cn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?dn(Object(r),!0).forEach((function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):dn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var un={formatExtension:function(e,t,r){return"".concat(e).concat(r.ext()).concat(t)}};function hn(e,t,r,n,i){var a=function(e,t){for(var r,n=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return ln(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ln(e,void 0)}}(e))){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(e);!(r=n()).done;){var i=r.value;if(i.leadingDigitsPatterns().length>0){var a=i.leadingDigitsPatterns()[i.leadingDigitsPatterns().length-1];if(0!==t.search(a))continue}if(Jr(t,i.pattern()))return i}}(n.formats(),e);return a?on(e,a,{useInternationalFormat:"INTERNATIONAL"===r,withNationalPrefix:!a.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!i||!1!==i.nationalPrefix,carrierCode:t,metadata:n}):e}function pn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function yn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?pn(Object(r),!0).forEach((function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):pn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var mn=function(){var e;function t(e,r,n){if(function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,t),!e)throw TypeError("`country` or `countryCallingCode` not passed");if(!r)throw TypeError("`nationalNumber` not passed");if(!n)throw TypeError("`metadata` not passed");var i,a,o,s=(o=new Pr(n),fn(e)?(i=e,o.selectNumberingPlan(i),a=o.countryCallingCode()):a=e,{country:i,countryCallingCode:a}),l=s.country,d=s.countryCallingCode;this.country=l,this.countryCallingCode=d,this.nationalNumber=r,this.number="+"+this.countryCallingCode+this.nationalNumber,this.getMetadata=function(){return n}}return e=[{key:"setExt",value:function(e){this.ext=e}},{key:"getPossibleCountries",value:function(){var e,t,r,n;return this.country?[this.country]:(e=this.countryCallingCode,t=this.nationalNumber,(n=new Pr(r=this.getMetadata()).getCountryCodesForCallingCode(e))?n.filter((function(e){var n;return(n=new Pr(r)).selectNumberingPlan(e),n.numberingPlan.possibleLengths().indexOf(t.length)>=0})):[])}},{key:"isPossible",value:function(){return function(e,t,r){if(void 0===t&&(t={}),r=new Pr(r),t.v2){if(!e.countryCallingCode)throw Error("Invalid phone number object passed");r.selectNumberingPlan(e.countryCallingCode)}else{if(!e.phone)return!1;if(e.country){if(!r.hasCountry(e.country))throw Error("Unknown country: ".concat(e.country));r.country(e.country)}else{if(!e.countryCallingCode)throw Error("Invalid phone number object passed");r.selectNumberingPlan(e.countryCallingCode)}}if(r.possibleLengths())return Xr(e.phone||e.nationalNumber,r);if(e.countryCallingCode&&r.isNonGeographicCallingCode(e.countryCallingCode))return!0;throw Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.')}(this,{v2:!0},this.getMetadata())}},{key:"isValid",value:function(){var e,t;return e={v2:!0},t=this.getMetadata(),e=e||{},(t=new Pr(t)).selectNumberingPlan(this.country,this.countryCallingCode),t.hasTypes()?void 0!==tn(this,e,t.metadata):Jr(e.v2?this.nationalNumber:this.phone,t.nationalNumberPattern())}},{key:"isNonGeographic",value:function(){return new Pr(this.getMetadata()).isNonGeographicCallingCode(this.countryCallingCode)}},{key:"isEqual",value:function(e){return this.number===e.number&&this.ext===e.ext}},{key:"getType",value:function(){return tn(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(e,t){return function(e,t,r,n){if(r=r?cn(cn({},un),r):un,n=new Pr(n),e.country&&"001"!==e.country){if(!n.hasCountry(e.country))throw Error("Unknown country: ".concat(e.country));n.country(e.country)}else{if(!e.countryCallingCode)return e.phone||"";n.selectNumberingPlan(e.countryCallingCode)}var i,a,o,s,l,d,c,u,h,p,y,m,f,g=n.countryCallingCode(),v=r.v2?e.nationalNumber:e.phone;switch(t){case"NATIONAL":return v?(i=f=hn(v,e.carrierCode,"NATIONAL",n,r),a=e.ext,o=n,s=r.formatExtension,a?s(i,a,o):i):"";case"INTERNATIONAL":return v?(f=hn(v,null,"INTERNATIONAL",n,r),l=f="+".concat(g," ").concat(f),d=e.ext,c=n,u=r.formatExtension,d?u(l,d,c):l):"+".concat(g);case"E.164":return"+".concat(g).concat(v);case"RFC3966":return function(e){var t=e.number,r=e.ext;if(!t)return"";if("+"!==t[0])throw Error('"formatRFC3966()" expects "number" to be in E.164 format.');return"tel:".concat(t).concat(r?";ext="+r:"")}({number:"+".concat(g).concat(v),ext:e.ext});case"IDD":if(!r.fromCountry)return;return h=function(e,t,r,n,i){if(Fr(n,i.metadata)===r){var a,o=hn(e,t,"NATIONAL",i);return"1"===r?r+" "+o:o}var s=(void 0,(a=new Pr(i.metadata)).selectNumberingPlan(n,undefined),a.defaultIDDPrefix()?a.defaultIDDPrefix():sn.test(a.IDDPrefix())?a.IDDPrefix():void 0);if(s)return"".concat(s," ").concat(r," ").concat(hn(e,null,"INTERNATIONAL",i))}(v,e.carrierCode,g,r.fromCountry,n),p=e.ext,y=n,m=r.formatExtension,p?m(h,p,y):h;default:throw Error('Unknown "format" argument passed to "formatNumber()": "'.concat(t,'"'))}}(this,e,t?yn(yn({},t),{},{v2:!0}):{v2:!0},this.getMetadata())}},{key:"formatNational",value:function(e){return this.format("NATIONAL",e)}},{key:"formatInternational",value:function(e){return this.format("INTERNATIONAL",e)}},{key:"getURI",value:function(e){return this.format("RFC3966",e)}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(),fn=function(e){return/^[A-Z]{2}$/.test(e)},gn=RegExp("(["+Cr+"])");function vn(e,t,r,n){if(t){var i=new Pr(n);i.selectNumberingPlan(t,r);var a=new RegExp(i.IDDPrefix());if(0===e.search(a)){var o=(e=e.slice(e.match(a)[0].length)).match(gn);if(!(o&&null!=o[1]&&o[1].length>0&&"0"===o[1]))return e}}}function wn(e,t){if(e&&t.numberingPlan.nationalPrefixForParsing()){var r=RegExp("^(?:"+t.numberingPlan.nationalPrefixForParsing()+")"),n=r.exec(e);if(n){var i,a,o,s=n.length-1,l=s>0&&n[s];if(t.nationalPrefixTransformRule()&&l)i=e.replace(r,t.nationalPrefixTransformRule()),s>1&&(a=n[1]);else{var d=n[0];i=e.slice(d.length),l&&(a=n[1])}if(l){var c=e.indexOf(n[1]);e.slice(0,c)===t.numberingPlan.nationalPrefix()&&(o=t.numberingPlan.nationalPrefix())}else o=n[0];return{nationalNumber:i,nationalPrefix:o,carrierCode:a}}}return{nationalNumber:e}}function xn(e,t){var r=wn(e,t),n=r.carrierCode,i=r.nationalNumber;return i!==e&&(Jr(e,t.nationalNumberPattern())&&!Jr(i,t.nationalNumberPattern())||t.possibleLengths()&&!function(e,t){switch(Zr(e,t)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}(i,t))?{nationalNumber:e}:{nationalNumber:i,carrierCode:n}}function Cn(e,t,r,n){var i=t?Fr(t,n):r;if(0===e.indexOf(i)){(n=new Pr(n)).selectNumberingPlan(t,r);var a=e.slice(i.length),o=xn(a,n).nationalNumber,s=xn(e,n).nationalNumber;if(!Jr(s,n.nationalNumberPattern())&&Jr(o,n.nationalNumberPattern())||"TOO_LONG"===Zr(s,n))return{countryCallingCode:i,number:a}}return{number:e}}function En(e,t,r,n){if(!e)return{};if("+"!==e[0]){var i,a=vn(e,t,r,n);if(!a||a===e){if(t||r){var o=Cn(e,t,r,n),s=o.countryCallingCode,l=o.number;if(s)return{countryCallingCodeSource:"FROM_NUMBER_WITHOUT_PLUS_SIGN",countryCallingCode:s,number:l}}return{number:e}}i=!0,e="+"+a}if("0"===e[1])return{};n=new Pr(n);for(var d=2;d-1<=3&&d<=e.length;){var c=e.slice(1,d);if(n.hasCallingCode(c))return n.selectNumberingPlan(c),{countryCallingCodeSource:i?"FROM_NUMBER_WITH_IDD":"FROM_NUMBER_WITH_PLUS_SIGN",countryCallingCode:c,number:e.slice(d)};d++}return{}}function bn(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Sn(e,t){var r=t.countries,n=t.defaultCountry,i=t.metadata;i=new Pr(i);for(var a,o=[],s=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return bn(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return bn(e,void 0)}}(e))){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(r);!(a=s()).done;){var l=a.value;if(i.country(l),i.leadingDigits()){if(e&&0===e.search(i.leadingDigits()))return l}else if(tn({phone:e,country:l},void 0,i.metadata)){if(!n||l===n)return l;o.push(l)}}if(o.length>0)return o[0]}function An(e,t){var r=t.nationalNumber,n=t.defaultCountry,i=t.metadata,a=i.getCountryCodesForCallingCode(e);return a?1===a.length?a[0]:Sn(r,{countries:a,defaultCountry:n,metadata:i.metadata}):void 0}var jn="(["+Cr+"]|[\\-\\.\\(\\)]?)",$n=RegExp("^\\+"+jn+"*["+Cr+"]"+jn+"*$","g"),Tn=RegExp("^(["+Cr+"]+((\\-)*["+Cr+"])*\\.)*[a-zA-Z]+((\\-)*["+Cr+"])*\\.?$","g"),Pn="tel:",_n=";phone-context=",kn=RegExp("[++"+Cr+"]"),Nn=RegExp("[^"+Cr+"#]+$");function In(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Mn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?In(Object(r),!0).forEach((function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):In(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function On(e){return(On="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Rn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Fn(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Ln(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Un(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ln(Object(r),!0).forEach((function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ln(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Dn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Wn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Dn(Object(r),!0).forEach((function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Dn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Bn(){var e=function(e){var t,r,n,i=function(e){if(Array.isArray(e))return e}(t=Array.prototype.slice.call(e))||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,a=[],o=!0,s=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(a.push(n.value),4!==a.length);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==r.return||r.return()}finally{if(s)throw i}}return a}}(t)||function(e,t){if(e){if("string"==typeof e)return Fn(e,4);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Fn(e,4)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),a=i[0],o=i[1],s=i[2],l=i[3];if("string"!=typeof a)throw TypeError("A text for parsing must be a string.");if(o&&"string"!=typeof o){if("object"!==On(o))throw Error("Invalid second argument: ".concat(o));s?(r=o,n=s):n=o}else l?(r=s,n=l):(r=void 0,n=s),o&&(r=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Rn(Object(r),!0).forEach((function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Rn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({defaultCountry:o},r));return{text:a,options:r,metadata:n}}(arguments),t=e.text,r=e.options,n=e.metadata,i=function(e,t,r){var n;t&&t.defaultCountry&&(n=t.defaultCountry,!r.countries.hasOwnProperty(n))&&(t=Un(Un({},t),{},{defaultCountry:void 0}));try{return function(e,t,r){if(t=t||{},r=new Pr(r),t.defaultCountry&&!r.hasCountry(t.defaultCountry)){if(t.v2)throw new xr("INVALID_COUNTRY");throw Error("Unknown country: ".concat(t.defaultCountry))}var n,i=function(e,t,r){var n=function(e,t){var r,n=t.extractFormattedPhoneNumber,i=function(e){var t=e.indexOf(_n);if(t<0)return null;var r=t+15;if(r>=e.length)return"";var n=e.indexOf(";",r);return n>=0?e.substring(r,n):e.substring(r)}(e);if(null!==i&&(0===i.length||!$n.test(i)&&!Tn.test(i)))throw new xr("NOT_A_NUMBER");if(null===i)r=n(e)||"";else{r="","+"===i.charAt(0)&&(r+=i);var a,o=e.indexOf(Pn);a=o>=0?o+4:0;var s=e.indexOf(_n);r+=e.substring(a,s)}var l=r.indexOf(";isub=");if(l>0&&(r=r.substring(0,l)),""!==r)return r}(e,{extractFormattedPhoneNumber:function(e){return function(e,t,r){if(e){if(e.length>250){if(r)throw new xr("TOO_LONG");return}if(!1===t)return e;var n=e.search(kn);if(!(n<0))return e.slice(n).replace(Nn,"")}}(e,r,t)}});if(!n)return{};if(!(n.length>=2&&Hr.test(n)))return Wr.test(n)?{error:"TOO_SHORT"}:{};var i=function(e){var t=e.search(Gr);if(t<0)return{};for(var r=e.slice(0,t),n=e.match(Gr),i=1;i<n.length;){if(n[i])return{number:r,ext:n[i]};i++}}(n);return i.ext?i:{number:n}}(e,t.v2,t.extract),a=i.number,o=i.ext,s=i.error;if(!a){if(t.v2){if("TOO_SHORT"===s)throw new xr("TOO_SHORT");throw new xr("NOT_A_NUMBER")}return{}}var l=function(e,t,r,n){var i,a=En(Yr(e),t,r,n.metadata),o=a.countryCallingCodeSource,s=a.countryCallingCode,l=a.number;if(s)n.selectNumberingPlan(s);else{if(!l||!t&&!r)return{};n.selectNumberingPlan(t,r),t&&(i=t),s=r||Fr(t,n.metadata)}if(!l)return{countryCallingCodeSource:o,countryCallingCode:s};var d=xn(Yr(l),n),c=d.nationalNumber,u=d.carrierCode,h=An(s,{nationalNumber:c,defaultCountry:t,metadata:n});return h&&(i=h,"001"===h||n.country(i)),{country:i,countryCallingCode:s,countryCallingCodeSource:o,nationalNumber:c,carrierCode:u}}(a,t.defaultCountry,t.defaultCallingCode,r),d=l.country,c=l.nationalNumber,u=l.countryCallingCode,h=l.countryCallingCodeSource,p=l.carrierCode;if(!r.hasSelectedNumberingPlan()){if(t.v2)throw new xr("INVALID_COUNTRY");return{}}if(!c||c.length<2){if(t.v2)throw new xr("TOO_SHORT");return{}}if(c.length>17){if(t.v2)throw new xr("TOO_LONG");return{}}if(t.v2){var y=new mn(u,c,r.metadata);return d&&(y.country=d),p&&(y.carrierCode=p),o&&(y.ext=o),y.__countryCallingCodeSource=h,y}var m=!!(t.extended?r.hasSelectedNumberingPlan():d)&&Jr(c,r.nationalNumberPattern());return t.extended?{country:d,countryCallingCode:u,carrierCode:p,valid:m,possible:!!m||!(!0!==t.extended||!r.possibleLengths()||!Xr(c,r)),phone:c,ext:o}:m?(n={country:d,phone:c},o&&(n.ext=o),n):{}}(e,Mn(Mn({},t),{},{v2:!0}),r)}catch(e){if(!(e instanceof xr))throw e}}(t,r=Wn(Wn({},r),{},{extract:!1}),n);return i&&i.isPossible()||!1}var Hn=function(){var e;function t(e){var r=e.onCountryChange,n=e.onCallingCodeChange;!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,t),this.onCountryChange=r,this.onCallingCodeChange=n}return e=[{key:"reset",value:function(e){var t=e.country,r=e.callingCode;this.international=!1,this.missingPlus=!1,this.IDDPrefix=void 0,this.callingCode=void 0,this.digits="",this.resetNationalSignificantNumber(),this.initCountryAndCallingCode(t,r)}},{key:"resetNationalSignificantNumber",value:function(){this.nationalSignificantNumber=this.getNationalDigits(),this.nationalSignificantNumberMatchesInput=!0,this.nationalPrefix=void 0,this.carrierCode=void 0,this.complexPrefixBeforeNationalSignificantNumber=void 0}},{key:"update",value:function(e){for(var t=0,r=Object.keys(e);t<r.length;t++){var n=r[t];this[n]=e[n]}}},{key:"initCountryAndCallingCode",value:function(e,t){this.setCountry(e),this.setCallingCode(t)}},{key:"setCountry",value:function(e){this.country=e,this.onCountryChange(e)}},{key:"setCallingCode",value:function(e){this.callingCode=e,this.onCallingCodeChange(e,this.country)}},{key:"startInternationalNumber",value:function(e,t){this.international=!0,this.initCountryAndCallingCode(e,t)}},{key:"appendDigits",value:function(e){this.digits+=e}},{key:"appendNationalSignificantNumberDigits",value:function(e){this.nationalSignificantNumber+=e}},{key:"getNationalDigits",value:function(){return this.international?this.digits.slice((this.IDDPrefix?this.IDDPrefix.length:0)+(this.callingCode?this.callingCode.length:0)):this.digits}},{key:"getDigitsWithoutInternationalPrefix",value:function(){return this.international&&this.IDDPrefix?this.digits.slice(this.IDDPrefix.length):this.digits}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}();function Gn(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var qn=/x/;function zn(e,t){if(t<1)return"";for(var r="";t>1;)1&t&&(r+=e),t>>=1,e+=e;return r+e}function Vn(e,t){return")"===e[t]&&t++,function(e){for(var t=[],r=0;r<e.length;)"("===e[r]?t.push(r):")"===e[r]&&t.pop(),r++;var n=0,i="";t.push(e.length);for(var a=0;a<t.length;a++){var o=t[a];i+=e.slice(n,o),n=o+1}return i}(e.slice(0,t))}function Kn(e,t,r){var n=r.metadata,i=r.useNationalPrefixFormattingRule,a=r.getSeparatorAfterNationalPrefix,o=on(e.nationalSignificantNumber,t,{carrierCode:e.carrierCode,useInternationalFormat:e.international,withNationalPrefix:i,metadata:n});if(i||(e.nationalPrefix?o=e.nationalPrefix+a(t)+o:e.complexPrefixBeforeNationalSignificantNumber&&(o=e.complexPrefixBeforeNationalSignificantNumber+" "+o)),Vr(o)===e.getNationalDigits())return o}var Yn=function(){var e;function t(){!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,t)}return e=[{key:"parse",value:function(e){if(this.context=[{or:!0,instructions:[]}],this.parsePattern(e),1!==this.context.length)throw Error("Non-finalized contexts left when pattern parse ended");var t=this.context[0],r=t.branches,n=t.instructions;if(r)return{op:"|",args:r.concat([Jn(n)])};if(0===n.length)throw Error("Pattern is required");return 1===n.length?n[0]:n}},{key:"startContext",value:function(e){this.context.push(e)}},{key:"endContext",value:function(){this.context.pop()}},{key:"getContext",value:function(){return this.context[this.context.length-1]}},{key:"parsePattern",value:function(e){if(!e)throw Error("Pattern is required");var t=e.match(Xn);if(t){var r=t[1],n=e.slice(0,t.index),i=e.slice(t.index+r.length);switch(r){case"(?:":n&&this.parsePattern(n),this.startContext({or:!0,instructions:[],branches:[]});break;case")":if(!this.getContext().or)throw Error('")" operator must be preceded by "(?:" operator');if(n&&this.parsePattern(n),0===this.getContext().instructions.length)throw Error('No instructions found after "|" operator in an "or" group');var a=this.getContext().branches;a.push(Jn(this.getContext().instructions)),this.endContext(),this.getContext().instructions.push({op:"|",args:a});break;case"|":if(!this.getContext().or)throw Error('"|" operator can only be used inside "or" groups');if(n&&this.parsePattern(n),!this.getContext().branches){if(1!==this.context.length)throw Error('"branches" not found in an "or" group context');this.getContext().branches=[]}this.getContext().branches.push(Jn(this.getContext().instructions)),this.getContext().instructions=[];break;case"[":n&&this.parsePattern(n),this.startContext({oneOfSet:!0});break;case"]":if(!this.getContext().oneOfSet)throw Error('"]" operator must be preceded by "[" operator');this.endContext(),this.getContext().instructions.push({op:"[]",args:function(e){for(var t=[],r=0;r<e.length;){if("-"===e[r]){if(0===r||r===e.length-1)throw Error("Couldn't parse a one-of set pattern: ".concat(e));for(var n=e[r-1].charCodeAt(0)+1,i=e[r+1].charCodeAt(0)-1,a=n;a<=i;)t.push(String.fromCharCode(a)),a++}else t.push(e[r]);r++}return t}(n)});break;default:throw Error("Unknown operator: ".concat(r))}i&&this.parsePattern(i)}else{if(Zn.test(e))throw Error("Illegal characters found in a pattern: ".concat(e));this.getContext().instructions=this.getContext().instructions.concat(e.split(""))}}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(),Zn=/[\(\)\[\]\?\:\|]/,Xn=RegExp("(\\||\\(\\?\\:|\\)|\\[|\\])");function Jn(e){return 1===e.length?e[0]:e}function Qn(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return ei(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ei(e,void 0)}}(e))||t){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ei(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var ti=function(){var e;function t(e){!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,t),this.matchTree=(new Yn).parse(e)}return e=[{key:"match",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).allowOverflow;if(!e)throw Error("String is required");var r=function e(t,r,n){if("string"==typeof r){var i=t.join("");return 0===r.indexOf(i)?t.length===r.length?{match:!0,matchedChars:t}:{partialMatch:!0}:0===i.indexOf(r)?n&&t.length>r.length?{overflow:!0}:{match:!0,matchedChars:t.slice(0,r.length)}:void 0}if(Array.isArray(r)){for(var a=t.slice(),o=0;o<r.length;){var s=e(a,r[o],n&&o===r.length-1);if(!s)return;if(s.overflow)return s;if(!s.match){if(s.partialMatch)return{partialMatch:!0};throw Error("Unsupported match result:\n".concat(JSON.stringify(s,null,2)))}if(0===(a=a.slice(s.matchedChars.length)).length)return o===r.length-1?{match:!0,matchedChars:t}:{partialMatch:!0};o++}return n?{overflow:!0}:{match:!0,matchedChars:t.slice(0,t.length-a.length)}}switch(r.op){case"|":for(var l,d,c=Qn(r.args);!(d=c()).done;){var u=e(t,d.value,n);if(u){if(u.overflow)return u;if(u.match)return{match:!0,matchedChars:u.matchedChars};if(!u.partialMatch)throw Error("Unsupported match result:\n".concat(JSON.stringify(u,null,2)));l=!0}}return l?{partialMatch:!0}:void 0;case"[]":for(var h,p=Qn(r.args);!(h=p()).done;){var y=h.value;if(t[0]===y)return 1===t.length?{match:!0,matchedChars:t}:n?{overflow:!0}:{match:!0,matchedChars:[y]}}return;default:throw Error("Unsupported instruction tree: ".concat(r))}}(e.split(""),this.matchTree,!0);if(r&&r.match&&delete r.matchedChars,!r||!r.overflow||t)return r}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}();function ri(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return ni(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ni(e,void 0)}}(e))||t){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ni(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var ii=zn("9",15),ai=/[- ]/,oi=RegExp("["+Er+"]*\\$1["+Er+"]*(\\$\\d["+Er+"]*)*$"),si=function(){var e;function t(e){e.state;var r=e.metadata;!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,t),this.metadata=r,this.resetFormat()}return e=[{key:"resetFormat",value:function(){this.chosenFormat=void 0,this.template=void 0,this.nationalNumberTemplate=void 0,this.populatedNationalNumberTemplate=void 0,this.populatedNationalNumberTemplatePosition=-1}},{key:"reset",value:function(e,t){this.resetFormat(),e?(this.isNANP="1"===e.callingCode(),this.matchingFormats=e.formats(),t.nationalSignificantNumber&&this.narrowDownMatchingFormats(t)):(this.isNANP=void 0,this.matchingFormats=[])}},{key:"format",value:function(e,t){var r=this;if("IS_POSSIBLE"===Zr(t.nationalSignificantNumber,this.metadata))for(var n,i=ri(this.matchingFormats);!(n=i()).done;){var a=n.value,o=function(e,t,r){var n=r.metadata,i=r.shouldTryNationalPrefixFormattingRule,a=r.getSeparatorAfterNationalPrefix;if(new RegExp("^(?:".concat(t.pattern(),")$")).test(e.nationalSignificantNumber))return function(e,t,r){var n=r.metadata,i=r.shouldTryNationalPrefixFormattingRule,a=r.getSeparatorAfterNationalPrefix;if(e.nationalSignificantNumber,e.international,e.nationalPrefix,e.carrierCode,i(t)){var o=Kn(e,t,{useNationalPrefixFormattingRule:!0,getSeparatorAfterNationalPrefix:a,metadata:n});if(o)return o}return Kn(e,t,{useNationalPrefixFormattingRule:!1,getSeparatorAfterNationalPrefix:a,metadata:n})}(e,t,{metadata:n,shouldTryNationalPrefixFormattingRule:i,getSeparatorAfterNationalPrefix:a})}(t,a,{metadata:this.metadata,shouldTryNationalPrefixFormattingRule:function(e){return r.shouldTryNationalPrefixFormattingRule(e,{international:t.international,nationalPrefix:t.nationalPrefix})},getSeparatorAfterNationalPrefix:function(e){return r.getSeparatorAfterNationalPrefix(e)}});if(o)return this.resetFormat(),this.chosenFormat=a,this.setNationalNumberTemplate(o.replace(/\d/g,"x"),t),this.populatedNationalNumberTemplate=o,this.populatedNationalNumberTemplatePosition=this.template.lastIndexOf("x"),o}return this.formatNationalNumberWithNextDigits(e,t)}},{key:"formatNationalNumberWithNextDigits",value:function(e,t){var r=this.chosenFormat,n=this.chooseFormat(t);if(n)return n===r?this.formatNextNationalNumberDigits(e):this.formatNextNationalNumberDigits(t.getNationalDigits())}},{key:"narrowDownMatchingFormats",value:function(e){var t=this,r=e.nationalSignificantNumber,n=e.nationalPrefix,i=e.international,a=r.length-3;a<0&&(a=0),this.matchingFormats=this.matchingFormats.filter((function(e){return t.formatSuits(e,i,n)&&t.formatMatches(e,r,a)})),this.chosenFormat&&-1===this.matchingFormats.indexOf(this.chosenFormat)&&this.resetFormat()}},{key:"formatSuits",value:function(e,t,r){return!(r&&!e.usesNationalPrefix()&&!e.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!t&&!r&&e.nationalPrefixIsMandatoryWhenFormattingInNationalFormat())}},{key:"formatMatches",value:function(e,t,r){var n=e.leadingDigitsPatterns().length;if(0===n)return!0;r=Math.min(r,n-1);var i=e.leadingDigitsPatterns()[r];if(t.length<3)try{return void 0!==new ti(i).match(t,{allowOverflow:!0})}catch(e){return console.error(e),!0}return new RegExp("^(".concat(i,")")).test(t)}},{key:"getFormatFormat",value:function(e,t){return t?e.internationalFormat():e.format()}},{key:"chooseFormat",value:function(e){for(var t,r,n=ri(this.matchingFormats.slice());!(r=n()).done&&"break"!=(t=r.value,this.chosenFormat===t?"break":oi.test(this.getFormatFormat(t,e.international))?this.createTemplateForFormat(t,e)?(this.chosenFormat=t,"break"):(this.matchingFormats=this.matchingFormats.filter((function(e){return e!==t})),"continue"):"continue"););return this.chosenFormat||this.resetFormat(),this.chosenFormat}},{key:"createTemplateForFormat",value:function(e,t){if(!(e.pattern().indexOf("|")>=0)){var r=this.getTemplateForFormat(e,t);return r?(this.setNationalNumberTemplate(r,t),!0):void 0}}},{key:"getSeparatorAfterNationalPrefix",value:function(e){return this.isNANP||e&&e.nationalPrefixFormattingRule()&&ai.test(e.nationalPrefixFormattingRule())?" ":""}},{key:"getInternationalPrefixBeforeCountryCallingCode",value:function(e,t){var r=e.IDDPrefix,n=e.missingPlus;return r?t&&!1===t.spacing?r:r+" ":n?"":"+"}},{key:"getTemplate",value:function(e){if(this.template){for(var t=-1,r=0,n=e.international?this.getInternationalPrefixBeforeCountryCallingCode(e,{spacing:!1}):"";r<n.length+e.getDigitsWithoutInternationalPrefix().length;)t=this.template.indexOf("x",t+1),r++;return Vn(this.template,t+1)}}},{key:"setNationalNumberTemplate",value:function(e,t){this.nationalNumberTemplate=e,this.populatedNationalNumberTemplate=e,this.populatedNationalNumberTemplatePosition=-1,t.international?this.template=this.getInternationalPrefixBeforeCountryCallingCode(t).replace(/[\d\+]/g,"x")+zn("x",t.callingCode.length)+" "+e:this.template=e}},{key:"getTemplateForFormat",value:function(e,t){var r=t.nationalSignificantNumber,n=t.international,i=t.nationalPrefix,a=t.complexPrefixBeforeNationalSignificantNumber,o=e.pattern();o=o.replace(/\[([^\[\]])*\]/g,"\\d").replace(/\d(?=[^,}][^,}])/g,"\\d");var s=ii.match(o)[0];if(!(r.length>s.length)){var l=RegExp("^"+o+"$"),d=r.replace(/\d/g,"9");l.test(d)&&(s=d);var c,u=this.getFormatFormat(e,n);if(this.shouldTryNationalPrefixFormattingRule(e,{international:n,nationalPrefix:i})){var h=u.replace(an,e.nationalPrefixFormattingRule());if(Vr(e.nationalPrefixFormattingRule())===(i||"")+Vr("$1")&&(u=h,c=!0,i))for(var p=i.length;p>0;)u=u.replace(/\d/,"x"),p--}var y=s.replace(new RegExp(o),u).replace(/9/g,"x");return c||(a?y=zn("x",a.length)+" "+y:i&&(y=zn("x",i.length)+this.getSeparatorAfterNationalPrefix(e)+y)),n&&(y=nn(y)),y}}},{key:"formatNextNationalNumberDigits",value:function(e){var t=function(e,t,r){for(var n,i=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return Gn(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Gn(e,void 0)}}(e))){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(r.split(""));!(n=i()).done;){var a=n.value;if(0>e.slice(t+1).search(qn))return;t=e.search(qn),e=e.replace(qn,a)}return[e,t]}(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition,e);if(t)return this.populatedNationalNumberTemplate=t[0],this.populatedNationalNumberTemplatePosition=t[1],Vn(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition+1);this.resetFormat()}},{key:"shouldTryNationalPrefixFormattingRule",value:function(e,t){var r=t.international,n=t.nationalPrefix;if(e.nationalPrefixFormattingRule()){var i=e.usesNationalPrefix();if(i&&n||!i&&!r)return!0}}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}();function li(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,a=[],o=!0,s=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==r.return||r.return()}finally{if(s)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return di(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return di(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function di(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var ci=RegExp("^["+Er+Cr+"]+$","i"),ui="(?:[++]["+Er+Cr+"]*|["+Er+Cr+"]+)",hi=RegExp("[^"+Er+Cr+"]+.*$"),pi=/[^\d\[\]]/,yi=function(){var e;function t(e){var r=e.defaultCountry,n=e.defaultCallingCode,i=e.metadata,a=e.onNationalSignificantNumberChange;!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,t),this.defaultCountry=r,this.defaultCallingCode=n,this.metadata=i,this.onNationalSignificantNumberChange=a}return e=[{key:"input",value:function(e,t){var r,n,i,a,o,s=(i=(n=li("+"===(r=function(e){var t,r=e.search(ui);if(!(r<0))return"+"===(e=e.slice(r))[0]&&(t=!0,e=e.slice(1)),e=e.replace(hi,""),t&&(e="+"+e),e}(e)||"")[0]?[r.slice(1),!0]:[r],2))[0],a=n[1],ci.test(i)||(i=""),[i,a]),l=li(s,2),d=l[0],c=l[1],u=Vr(d);return c&&(t.digits||(t.startInternationalNumber(),u||(o=!0))),u&&this.inputDigits(u,t),{digits:u,justLeadingPlus:o}}},{key:"inputDigits",value:function(e,t){var r=t.digits,n=r.length<3&&r.length+e.length>=3;if(t.appendDigits(e),n&&this.extractIddPrefix(t),this.isWaitingForCountryCallingCode(t)){if(!this.extractCountryCallingCode(t))return}else t.appendNationalSignificantNumberDigits(e);t.international||this.hasExtractedNationalSignificantNumber||this.extractNationalSignificantNumber(t.getNationalDigits(),(function(e){return t.update(e)}))}},{key:"isWaitingForCountryCallingCode",value:function(e){var t=e.international,r=e.callingCode;return t&&!r}},{key:"extractCountryCallingCode",value:function(e){var t=En("+"+e.getDigitsWithoutInternationalPrefix(),this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),r=t.countryCallingCode,n=t.number;if(r)return e.setCallingCode(r),e.update({nationalSignificantNumber:n}),!0}},{key:"reset",value:function(e){if(e){this.hasSelectedNumberingPlan=!0;var t=e._nationalPrefixForParsing();this.couldPossiblyExtractAnotherNationalSignificantNumber=t&&pi.test(t)}else this.hasSelectedNumberingPlan=void 0,this.couldPossiblyExtractAnotherNationalSignificantNumber=void 0}},{key:"extractNationalSignificantNumber",value:function(e,t){if(this.hasSelectedNumberingPlan){var r=wn(e,this.metadata),n=r.nationalPrefix,i=r.nationalNumber,a=r.carrierCode;if(i!==e)return this.onExtractedNationalNumber(n,a,i,e,t),!0}}},{key:"extractAnotherNationalSignificantNumber",value:function(e,t,r){if(!this.hasExtractedNationalSignificantNumber)return this.extractNationalSignificantNumber(e,r);if(this.couldPossiblyExtractAnotherNationalSignificantNumber){var n=wn(e,this.metadata),i=n.nationalPrefix,a=n.nationalNumber,o=n.carrierCode;if(a!==t)return this.onExtractedNationalNumber(i,o,a,e,r),!0}}},{key:"onExtractedNationalNumber",value:function(e,t,r,n,i){var a,o,s=n.lastIndexOf(r);if(s>=0&&s===n.length-r.length){o=!0;var l=n.slice(0,s);l!==e&&(a=l)}i({nationalPrefix:e,carrierCode:t,nationalSignificantNumber:r,nationalSignificantNumberMatchesInput:o,complexPrefixBeforeNationalSignificantNumber:a}),this.hasExtractedNationalSignificantNumber=!0,this.onNationalSignificantNumberChange()}},{key:"reExtractNationalSignificantNumber",value:function(e){return!!this.extractAnotherNationalSignificantNumber(e.getNationalDigits(),e.nationalSignificantNumber,(function(t){return e.update(t)}))||(this.extractIddPrefix(e)||this.fixMissingPlus(e)?(this.extractCallingCodeAndNationalSignificantNumber(e),!0):void 0)}},{key:"extractIddPrefix",value:function(e){var t=e.international,r=e.IDDPrefix,n=e.digits;if(e.nationalSignificantNumber,!t&&!r){var i=vn(n,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata);return void 0!==i&&i!==n?(e.update({IDDPrefix:n.slice(0,n.length-i.length)}),this.startInternationalNumber(e,{country:void 0,callingCode:void 0}),!0):void 0}}},{key:"fixMissingPlus",value:function(e){if(!e.international){var t=Cn(e.digits,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),r=t.countryCallingCode;if(t.number,r)return e.update({missingPlus:!0}),this.startInternationalNumber(e,{country:e.country,callingCode:r}),!0}}},{key:"startInternationalNumber",value:function(e,t){var r=t.country,n=t.callingCode;e.startInternationalNumber(r,n),e.nationalSignificantNumber&&(e.resetNationalSignificantNumber(),this.onNationalSignificantNumberChange(),this.hasExtractedNationalSignificantNumber=void 0)}},{key:"extractCallingCodeAndNationalSignificantNumber",value:function(e){this.extractCountryCallingCode(e)&&this.extractNationalSignificantNumber(e.getNationalDigits(),(function(t){return e.update(t)}))}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}();function mi(e){return(mi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function fi(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var gi=function(){var e;function t(e,r){!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,t),this.metadata=new Pr(r);var n,i=function(e){if(Array.isArray(e))return e}(n=this.getCountryAndCallingCode(e))||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,a=[],o=!0,s=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(a.push(n.value),2!==a.length);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==r.return||r.return()}finally{if(s)throw i}}return a}}(n)||function(e,t){if(e){if("string"==typeof e)return fi(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return fi(e,2)}}(n)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),a=i[0],o=i[1];this.defaultCountry=a,this.defaultCallingCode=o,this.reset()}return e=[{key:"getCountryAndCallingCode",value:function(e){var t,r;return e&&("object"===mi(e)?(t=e.defaultCountry,r=e.defaultCallingCode):t=e),t&&!this.metadata.hasCountry(t)&&(t=void 0),[t,r]}},{key:"input",value:function(e){var t,r=this.parser.input(e,this.state),n=r.digits;if(r.justLeadingPlus)this.formattedOutput="+";else if(n){if(this.determineTheCountryIfNeeded(),this.state.nationalSignificantNumber&&this.formatter.narrowDownMatchingFormats(this.state),this.metadata.hasSelectedNumberingPlan()&&(t=this.formatter.format(n,this.state)),void 0===t&&this.parser.reExtractNationalSignificantNumber(this.state)){this.determineTheCountryIfNeeded();var i=this.state.getNationalDigits();i&&(t=this.formatter.format(i,this.state))}this.formattedOutput=t?this.getFullNumber(t):this.getNonFormattedNumber()}return this.formattedOutput}},{key:"reset",value:function(){var e=this;return this.state=new Hn({onCountryChange:function(t){e.country=t},onCallingCodeChange:function(t,r){e.metadata.selectNumberingPlan(r,t),e.formatter.reset(e.metadata.numberingPlan,e.state),e.parser.reset(e.metadata.numberingPlan)}}),this.formatter=new si({state:this.state,metadata:this.metadata}),this.parser=new yi({defaultCountry:this.defaultCountry,defaultCallingCode:this.defaultCallingCode,metadata:this.metadata,state:this.state,onNationalSignificantNumberChange:function(){e.determineTheCountryIfNeeded(),e.formatter.reset(e.metadata.numberingPlan,e.state)}}),this.state.reset({country:this.defaultCountry,callingCode:this.defaultCallingCode}),this.formattedOutput="",this}},{key:"isInternational",value:function(){return this.state.international}},{key:"getCallingCode",value:function(){if(this.isInternational())return this.state.callingCode}},{key:"getCountryCallingCode",value:function(){return this.getCallingCode()}},{key:"getCountry",value:function(){if(this.state.digits)return this._getCountry()}},{key:"_getCountry",value:function(){return this.state.country}},{key:"determineTheCountryIfNeeded",value:function(){this.state.country&&!this.isCountryCallingCodeAmbiguous()||this.determineTheCountry()}},{key:"getFullNumber",value:function(e){if(this.isInternational()){var t,r=this.state.callingCode;return t=r?e?"".concat(r," ").concat(e):r:"".concat(this.state.getDigitsWithoutInternationalPrefix()),this.formatter.getInternationalPrefixBeforeCountryCallingCode(this.state,{spacing:!!t})+t}return e}},{key:"getNonFormattedNationalNumberWithPrefix",value:function(){var e=this.state,t=e.nationalSignificantNumber,r=e.complexPrefixBeforeNationalSignificantNumber,n=e.nationalPrefix,i=t,a=r||n;return a&&(i=a+i),i}},{key:"getNonFormattedNumber",value:function(){var e=this.state.nationalSignificantNumberMatchesInput;return this.getFullNumber(e?this.getNonFormattedNationalNumberWithPrefix():this.state.getNationalDigits())}},{key:"getNonFormattedTemplate",value:function(){var e=this.getNonFormattedNumber();if(e)return e.replace(/[\+\d]/g,"x")}},{key:"isCountryCallingCodeAmbiguous",value:function(){var e=this.state.callingCode,t=this.metadata.getCountryCodesForCallingCode(e);return t&&t.length>1}},{key:"determineTheCountry",value:function(){this.state.setCountry(An(this.isInternational()?this.state.callingCode:this.defaultCallingCode,{nationalNumber:this.state.nationalSignificantNumber,defaultCountry:this.defaultCountry,metadata:this.metadata}))}},{key:"getNumberValue",value:function(){var e=this.state,t=e.digits,r=e.callingCode,n=e.country,i=e.nationalSignificantNumber;if(t)return this.isInternational()?r?"+"+r+i:"+"+t:n||r?"+"+(n?this.metadata.countryCallingCode():r)+i:void 0}},{key:"getNumber",value:function(){var e=this.state,t=e.nationalSignificantNumber,r=e.carrierCode,n=e.callingCode,i=this._getCountry();if(t&&(i||n)){if(i&&i===this.defaultCountry){var a=new Pr(this.metadata.metadata);a.selectNumberingPlan(i);var o=a.numberingPlan.callingCode(),s=this.metadata.getCountryCodesForCallingCode(o);if(s.length>1){var l=Sn(t,{countries:s,defaultCountry:this.defaultCountry,metadata:this.metadata.metadata});l&&(i=l)}}var d=new mn(i||n,t,this.metadata.metadata);return r&&(d.carrierCode=r),d}}},{key:"isPossible",value:function(){var e=this.getNumber();return!!e&&e.isPossible()}},{key:"isValid",value:function(){var e=this.getNumber();return!!e&&e.isValid()}},{key:"getNationalNumber",value:function(){return this.state.nationalSignificantNumber}},{key:"getChars",value:function(){return(this.state.international?"+":"")+this.state.digits}},{key:"getTemplate",value:function(){return this.formatter.getTemplate(this.state)||this.getNonFormattedTemplate()||""}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}();function vi(e){return new Pr(e).getCountries()}function wi(e,t,r){if(t[e])return new mn(e,t[e],r)}function xi(e){return gi.call(this,e,ur)}function Ci(){return hr(Fr,arguments)}xi.prototype=Object.create(gi.prototype,{}),xi.prototype.constructor=xi;let Ei=(e,t)=>function(){return hr(Bn,arguments)}(String(e),t),bi=(e,t)=>`+${Ci(t)} ${e}`,Si=e=>`*${e.replaceAll("-","").slice(-4)}`,Ai=function(){return hr(vi,arguments)}().map((e=>({code:e,callCode:Ci(e)})));const ji="/api/v1/sessions",$i="/api/v1/sessions/logout",Ti="/api/v1/sessions/fork/recover",Pi="/api/v1/oauth/init",_i="/api/v1/oauth/authenticate",ki="/api/v1/oauth/link",Ni="/api/v1/analytics_events";class Ii{async authenticate(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");try{let e=await this.api.post("/api/v1/custom_jwt_account/authenticate",{token:this.meta.token});return{user:e.user,token:e.token,refresh_token:e.refresh_token,identity_token:e.identity_token,is_new_user:e.is_new_user}}catch(e){throw o.formatApiError(e)}}async link(){throw Error("Unimplemented")}constructor(e){this.meta={token:e}}}class Mi{async authenticate(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new o.PrivyClientError("Email and email code must be set prior to calling authenticate.");try{let e=await this.api.post("/api/v1/passwordless/authenticate",{email:this.meta.email,code:this.meta.emailCode,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});return{user:e.user,token:e.token,refresh_token:e.refresh_token,identity_token:e.identity_token,is_new_user:e.is_new_user}}catch(e){throw o.formatApiError(e)}}async link(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new o.PrivyClientError("Email and email code must be set prior to calling authenticate.");try{return await this.api.post("/api/v1/passwordless/link",{email:this.meta.email,code:this.meta.emailCode})}catch(e){throw o.formatApiError(e)}}async sendCodeEmail(e,t){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(e&&(this.meta.email=e),t&&(this.meta.captchaToken=t),!this.meta.email)throw new o.PrivyClientError("Email must be set when initialzing authentication.");try{return await this.api.post("/api/v1/passwordless/init",{email:this.meta.email,token:this.meta.captchaToken})}catch(e){throw o.formatApiError(e)}}constructor(e,t,r=!1){this.meta={email:e,captchaToken:t,disableSignup:r}}}class Oi extends Mi{async link(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new o.PrivyClientError("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post("/api/v1/passwordless/update",{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(e){throw o.formatApiError(e)}}constructor(e,t,r){super(t,r),this.meta={email:t,captchaToken:r,oldAddress:e,disableSignup:!1}}}const Ri=e=>{let t;try{t=new URL(e).hostname}catch(e){return}for(let[e,r]of Object.entries(Fi))if(t.includes(r.hostname))return{walletClientType:e,entry:r}},Fi={metamask:{id:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",displayName:"MetaMask",hostname:"metamask.io",mobile:{native:"metamask://",universal:"https://metamask.app.link"}},trust:{id:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",displayName:"Trust",hostname:"trustwallet.com",mobile:{universal:"https://link.trustwallet.com"}},safe:{id:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",displayName:"Safe",hostname:"safe.global",mobile:{universal:"https://app.safe.global/"}},rainbow:{id:"1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",displayName:"Rainbow",hostname:"rainbow.me",mobile:{native:"rainbow://",universal:"https://rnbwapp.com"}},uniswap:{id:"c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a",displayName:"Uniswap",hostname:"uniswap.org",mobile:{universal:"https://uniswap.org/app",native:"uniswap://"}},zerion:{id:"ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18",displayName:"Zerion",hostname:"zerion.io",mobile:{native:"zerion://",universal:"https://wallet.zerion.io"}},argent:{id:"bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6",displayName:"Argent",hostname:"www.argent.xyz",mobile:{universal:"https://www.argent.xyz/app"}},spot:{id:"74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d",displayName:"Spot",hostname:"www.spot-wallet.com",mobile:{universal:"https://spot.so"}},omni:{id:"afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7",displayName:"Omni",hostname:"omni.app",mobile:{universal:"https://links.omni.app"}},cryptocom:{id:"f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d",displayName:"Crypto.com",hostname:"crypto.com",mobile:{universal:"https://wallet.crypto.com",native:"dfw://"}},blockchain:{id:"84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04",displayName:"Blockchain",hostname:"www.blockchain.com",mobile:{universal:"https://www.blockchain.com"}},safepal:{id:"0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150",displayName:"SafePal",hostname:"safepal.com",mobile:{universal:"https://link.safepal.io"}},bitkeep:{id:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",displayName:"BitKeep",hostname:"bitkeep.com",mobile:{universal:"https://bkapp.vip"}},zengo:{id:"9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0",displayName:"ZenGo",hostname:"zengo.com",mobile:{universal:"https://get.zengo.com/"}},"1inch":{id:"c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576",displayName:"1inch",hostname:"wallet.1inch.io",mobile:{universal:"https://wallet.1inch.io/wc/"}},binance:{id:"8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",displayName:"Binance",hostname:"www.binance.com",mobile:{universal:"https://app.binance.com/cedefi"}},exodus:{id:"e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4",displayName:"Exodus",hostname:"exodus.com",mobile:{universal:"https://exodus.com/m"}},mew_wallet:{id:"f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2",displayName:"MEW wallet",hostname:"mewwallet.com",mobile:{universal:"https://mewwallet.com"}},alphawallet:{id:"138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98",displayName:"AlphaWallet",hostname:"alphawallet.com",mobile:{universal:"https://aw.app"}},keyring_pro:{id:"47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83",displayName:"KEYRING PRO",hostname:"keyring.app",mobile:{universal:"https://keyring.app/"}},mathwallet:{id:"7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26",displayName:"MathWallet",hostname:"mathwallet.org",mobile:{universal:"https://www.mathwallet.org"}},unstoppable:{id:"8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3",displayName:"Unstoppable",hostname:"unstoppabledomains.com",mobile:{universal:"https://unstoppabledomains.com/mobile"}},obvious:{id:"031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa",displayName:"Obvious",hostname:"obvious.technology",mobile:{universal:"https://wallet.obvious.technology"}},ambire:{id:"2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568",displayName:"Ambire",hostname:"www.ambire.com",mobile:{universal:"https://mobile.ambire.com"}},internet_money_wallet:{id:"dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd",displayName:"Internet Money Wallet",hostname:"internetmoney.io",mobile:{universal:"https://internetmoney.io"}},coin98:{id:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",displayName:"Coin98",hostname:"coin98.com",mobile:{universal:"https://coin98.services"}},abc_wallet:{id:"b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f",displayName:"ABC Wallet",hostname:"myabcwallet.io",mobile:{universal:"https://abcwalletconnect.page.link"}},arculus_wallet:{id:"0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92",displayName:"Arculus Wallet",hostname:"www.getarculus.com",mobile:{universal:"https://gw.arculus.co/app"}},haha:{id:"719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3",displayName:"HaHa",hostname:"www.haha.me",mobile:{universal:"https://haha.me"}},cling_wallet:{id:"942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef",displayName:"Cling Wallet",hostname:"clingon.io",mobile:{universal:"https://cling.carrieverse.com/apple-app-site-association"}},broearn:{id:"8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2",displayName:"Broearn",hostname:"www.broearn.com",mobile:{universal:"https://www.broearn.com/link/wallet/"}},copiosa:{id:"07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80",displayName:"Copiosa",hostname:"copiosa.io",mobile:{universal:"https://copiosa.io/action/"}},burrito_wallet:{id:"8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819",displayName:"Burrito Wallet",hostname:"burritowallet.com",mobile:{universal:"https://burritowallet.com/wc?uri="}},enjin_wallet:{id:"bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a",displayName:"Enjin Wallet",hostname:"enjin.io",mobile:{universal:"https://deeplink.wallet.enjin.io/"}},plasma_wallet:{id:"cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e",displayName:"Plasma Wallet",hostname:"plasma-wallet.com",mobile:{universal:"https://plasma-wallet.com"}},avacus:{id:"94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43",displayName:"Avacus",hostname:"avacus.cc",mobile:{universal:"https://avacus.app.link"}},bee:{id:"2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715",displayName:"Bee",hostname:"www.beewallet.app",mobile:{universal:"https://beewallet.app/wc"}},pitaka:{id:"14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc",displayName:"Pitaka",hostname:"pitaka.io",mobile:{universal:"https://app.pitaka.io"}},pltwallet:{id:"576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd",displayName:"PLTwallet",hostname:"pltwallet.io",mobile:{universal:"https://pltwallet.io/"}},minerva:{id:"49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd",displayName:"Minerva",hostname:"minerva.digital",mobile:{universal:"https://minerva.digital"}},kryptogo:{id:"19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b",displayName:"KryptoGO",hostname:"kryptogo.com",mobile:{universal:"https://kryptogo.page.link"}},prema:{id:"5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b",displayName:"PREMA",hostname:"premanft.com",mobile:{universal:"https://premanft.com"}},slingshot:{id:"d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b",displayName:"Slingshot",hostname:"slingshot.finance",mobile:{universal:"https://app.slingshot.finance"}},kriptonio:{id:"50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b",displayName:"Kriptonio",hostname:"kriptonio.com",mobile:{universal:"https://app.kriptonio.com/mobile"}},timeless:{id:"9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8",displayName:"Timeless",hostname:"timelesswallet.xyz",mobile:{universal:"https://timelesswallet.xyz"}},secux:{id:"6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa",displayName:"SecuX",hostname:"secuxtech.com",mobile:{universal:"https://wsweb.secuxtech.com"}},bitizen:{id:"41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071",displayName:"Bitizen",hostname:"bitizen.org",mobile:{universal:"https://bitizen.org/wallet"}},blocto:{id:"14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd",displayName:"Blocto",hostname:"blocto.io",mobile:{universal:"https://blocto.app"}},safemoon:{id:"a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1",displayName:"SafeMoon",hostname:"safemoon.com",mobile:{universal:"https://safemoon.com/wc"}},okx_wallet:{id:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",displayName:"OKX Wallet",hostname:"okx.com",mobile:{native:"okex://main"}},rabby_wallet:{id:"18388be9ac2d02726dbac9777c96efaac06d744b2f6d580fccdd4127a6d01fd1",displayName:"Rabby Wallet",hostname:"rabby.io",mobile:{}}};function Li(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}let Ui="WALLETCONNECT_DEEPLINK_CHOICE";function Di(e){return e.startsWith("http://")||e.startsWith("https://")}function Wi(e,t){if(Di(e))return Bi(e,t);let r=e;return r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`),{redirect:`${r}wc?uri=${encodeURIComponent(t)}`,href:r}}function Bi(e,t){if(!Di(e))return Wi(e,t);let r=e;return r.endsWith("/")||(r=`${r}/`),{redirect:`${r}wc?uri=${encodeURIComponent(t)}`,href:r}}function Hi(e,t){window.open(e,t,"noreferrer noopener")}class Gi{execute(e){return null===this.promise&&(this.promise=(async()=>{try{return await this.fn(e)}finally{this.promise=null}})()),this.promise}constructor(e){this.promise=null,this.fn=e}}class qi{get meta(){return this._meta}async authenticate(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!this.meta.channelToken)throw new o.PrivyClientError("Auth flow must be initialized first");try{let e=await this.api.post("/api/v1/farcaster/authenticate",{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});if(!e)throw new o.PrivyClientError("No response from authentication");return{user:e.user,token:e.token,refresh_token:e.refresh_token,identity_token:e.identity_token,is_new_user:e.is_new_user}}catch(e){throw o.formatApiError(e)}}async link(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");try{return await this.api.post("/api/v1/farcaster/link",{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(e){throw o.formatApiError(e)}}async _startChannelOnce(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");let e=await this.api.post("/api/v1/farcaster/init",{token:this.captchaToken});a.isMobile&&!a.isIOS&&e.connect_uri&&Hi(e.connect_uri,"_blank"),this._meta={...this._meta,connectUri:e.connect_uri,channelToken:e.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!this.meta.channelToken)throw new o.PrivyClientError("Auth flow must be initialized first");let e=await this.api.get("/api/v1/farcaster/status",{headers:{"farcaster-channel-token":this.meta.channelToken}});return"completed"===e.state&&(this.message=e.message,this.signature=e.signature,this.fid=e.fid,!0)}constructor(e,t=!1){this._meta={disableSignup:!1},this.captchaToken=e,this.startChannelOnce=new Gi(this._startChannelOnce.bind(this)),this.pollForReady=new Gi(this._pollForReady.bind(this)),this._meta.disableSignup=t}}function zi(e){return crypto.getRandomValues(new Uint8Array(e))}class Vi{getOrCreateGuestCredential(e){let t=l.getGuestCredentialStorageKey(e);if(d.e()){if(d.e5.get(t))return d.e5.get(t);{let e=s.base64url.encode(zi(32));return d.e5.put(t,e),e}}return s.base64url.encode(zi(32))}async authenticate(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");try{let e=await this.api.post("/api/v1/guest/authenticate",{guest_credential:this.meta.guestCredential});return{user:e.user,token:e.token,refresh_token:e.refresh_token,identity_token:e.identity_token,is_new_user:e.is_new_user}}catch(e){throw o.formatApiError(e)}}async link(){throw Error("Linking is not supported for the guest flow")}constructor(e){this.meta={guestCredential:this.getOrCreateGuestCredential(e)}}}function Ki(){return s.base64url.encode(zi(36))}function Yi(){return Ki()}async function Zi(e,t="S256"){if("S256"!=t)return e;{let t=await async function(e){let t=(new TextEncoder).encode(e);return new Uint8Array(await crypto.subtle.digest("SHA-256",t))}(e);return s.base64url.encode(t)}}function Xi(){return!!d.e5.get(l.HEADLESS_OAUTH_KEY)}class Ji{addCaptchaToken(e){this.meta.captchaToken=e}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new o.PrivyClientError("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if("undefined"===this.meta.authorizationCode)throw new o.PrivyClientError("User denied confirmation during OAuth flow");let e=function(){let e=d.e5.get(l.CODE_VERIFIER_KEY);if(!e)throw new o.PrivyClientError("Authentication error.");return e}();try{let t=await this.api.post(_i,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:e,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});return d.e5.del(l.CODE_VERIFIER_KEY),d.e5.del(l.HEADLESS_OAUTH_KEY),d.e5.del(l.OAUTH_DISABLE_SIGNUP_KEY),{user:t.user,token:t.token,refresh_token:t.refresh_token,identity_token:t.identity_token,is_new_user:t.is_new_user,oauth_tokens:t.oauth_tokens}}catch(e){let t=o.formatApiError(e);if(t.privyErrorCode)throw new o.PrivyClientError(t.message||"Invalid code during OAuth flow.",void 0,t.privyErrorCode);if("User denied confirmation during OAuth flow"===t.message)throw new o.PrivyClientError("Invalid code during oauth flow.",void 0,o.PrivyErrorCode.OAUTH_USER_DENIED);throw new o.PrivyClientError("Invalid code during OAuth flow.",void 0,o.PrivyErrorCode.UNKNOWN_AUTH_ERROR)}}async link(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new o.PrivyClientError("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if("undefined"===this.meta.authorizationCode)throw new o.PrivyClientError("User denied confirmation during OAuth flow");let e=d.e5.get(l.CODE_VERIFIER_KEY);if(!e)throw new o.PrivyClientError("Authentication error.");try{let t=await this.api.post(ki,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:e});return d.e5.del(l.CODE_VERIFIER_KEY),t}catch(e){throw o.formatApiError(e)}}async getAuthorizationUrl(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!this.meta.provider)throw new o.PrivyClientError("Provider must be set when initializing OAuth authentication.");let e=Ki();d.e5.put(l.CODE_VERIFIER_KEY,e);let t=Yi();d.e5.put(l.STATE_CODE_KEY,t);let r=await Zi(e);this.meta.headless&&d.e5.put(l.HEADLESS_OAUTH_KEY,!0),this.meta.disableSignup&&d.e5.put(l.OAUTH_DISABLE_SIGNUP_KEY,!0);try{return await this.api.post(Pi,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:r,state_code:t})}catch(e){throw o.formatApiError(e)}}constructor(e){let t="boolean"==typeof e.headless?e.headless:Xi();this.meta={...e,headless:t}}}function Qi(e){return e.charAt(0).toUpperCase()+e.slice(1)}const ea=({style:t,...r})=>e.jsxs("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 24 24",style:{height:"24px",...t},...r,children:[e.jsx("path",{d:"M17.0722 11.6888C17.0471 8.90571 19.3263 7.56847 19.429 7.50274C18.1466 5.60938 16.153 5.35154 15.4417 5.3212C13.7461 5.14678 12.1306 6.32982 11.269 6.32982C10.4074 6.32982 9.08004 5.34648 7.67246 5.37429C5.82158 5.40209 4.11595 6.45874 3.16171 8.13218C1.24068 11.4942 2.6708 16.4817 4.54423 19.2143C5.46091 20.549 6.55041 22.0531 7.98554 21.9975C9.36803 21.9419 9.88905 21.095 11.5571 21.095C13.2251 21.095 13.696 21.9975 15.1537 21.9697C16.6389 21.9393 17.5806 20.6046 18.4897 19.2648C19.5392 17.7153 19.9725 16.2137 19.9975 16.1354C19.965 16.1228 17.1022 15.0155 17.0722 11.6888Z",fill:"currentColor"}),e.jsx("path",{d:"M14.3295 3.51373C15.0909 2.58347 15.6043 1.28921 15.4641 0C14.3671 0.0455014 13.0396 0.738135 12.2532 1.66838C11.5494 2.48994 10.9307 3.80695 11.0986 5.07089C12.3183 5.16694 13.5681 4.44145 14.3295 3.51373Z",fill:"currentColor"})]}),ta=({style:t,...r})=>e.jsxs("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 71 55",style:{height:"24px",...t},...r,children:[e.jsx("g",{clipPath:"url(#clip0)",children:e.jsx("path",{d:"M60.1045 4.8978C55.5792 2.8214 50.7265 1.2916 45.6527 0.41542C45.5603 0.39851 45.468 0.440769 45.4204 0.525289C44.7963 1.6353 44.105 3.0834 43.6209 4.2216C38.1637 3.4046 32.7345 3.4046 27.3892 4.2216C26.905 3.0581 26.1886 1.6353 25.5617 0.525289C25.5141 0.443589 25.4218 0.40133 25.3294 0.41542C20.2584 1.2888 15.4057 2.8186 10.8776 4.8978C10.8384 4.9147 10.8048 4.9429 10.7825 4.9795C1.57795 18.7309 -0.943561 32.1443 0.293408 45.3914C0.299005 45.4562 0.335386 45.5182 0.385761 45.5576C6.45866 50.0174 12.3413 52.7249 18.1147 54.5195C18.2071 54.5477 18.305 54.5139 18.3638 54.4378C19.7295 52.5728 20.9469 50.6063 21.9907 48.5383C22.0523 48.4172 21.9935 48.2735 21.8676 48.2256C19.9366 47.4931 18.0979 46.6 16.3292 45.5858C16.1893 45.5041 16.1781 45.304 16.3068 45.2082C16.679 44.9293 17.0513 44.6391 17.4067 44.3461C17.471 44.2926 17.5606 44.2813 17.6362 44.3151C29.2558 49.6202 41.8354 49.6202 53.3179 44.3151C53.3935 44.2785 53.4831 44.2898 53.5502 44.3433C53.9057 44.6363 54.2779 44.9293 54.6529 45.2082C54.7816 45.304 54.7732 45.5041 54.6333 45.5858C52.8646 46.6197 51.0259 47.4931 49.0921 48.2228C48.9662 48.2707 48.9102 48.4172 48.9718 48.5383C50.038 50.6034 51.2554 52.5699 52.5959 54.435C52.6519 54.5139 52.7526 54.5477 52.845 54.5195C58.6464 52.7249 64.529 50.0174 70.6019 45.5576C70.6551 45.5182 70.6887 45.459 70.6943 45.3942C72.1747 30.0791 68.2147 16.7757 60.1968 4.9823C60.1772 4.9429 60.1437 4.9147 60.1045 4.8978ZM23.7259 37.3253C20.2276 37.3253 17.3451 34.1136 17.3451 30.1693C17.3451 26.225 20.1717 23.0133 23.7259 23.0133C27.308 23.0133 30.1626 26.2532 30.1066 30.1693C30.1066 34.1136 27.28 37.3253 23.7259 37.3253ZM47.3178 37.3253C43.8196 37.3253 40.9371 34.1136 40.9371 30.1693C40.9371 26.225 43.7636 23.0133 47.3178 23.0133C50.9 23.0133 53.7545 26.2532 53.6986 30.1693C53.6986 34.1136 50.9 37.3253 47.3178 37.3253Z",fill:"#5865F2"})}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0",children:e.jsx("rect",{width:"71",height:"55",fill:"white"})})})]}),ra=({style:t,...r})=>e.jsx("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"24",y:"24",viewBox:"0 0 98 96",style:{height:"24px",...t},...r,children:e.jsx("path",{d:"M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z",fill:"currentColor"})}),na=({style:t})=>e.jsx(ut.default,{style:{color:"var(--privy-color-error)",...t}}),ia=({style:t,...r})=>e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...t},...r,children:[e.jsx("path",{d:"M22.56 12.25C22.56 11.47 22.49 10.72 22.36 10H12V14.255H17.92C17.665 15.63 16.89 16.795 15.725 17.575V20.335H19.28C21.36 18.42 22.56 15.6 22.56 12.25Z",fill:"#4285F4"}),e.jsx("path",{d:"M12 23C14.97 23 17.46 22.015 19.28 20.335L15.725 17.575C14.74 18.235 13.48 18.625 12 18.625C9.13504 18.625 6.71004 16.69 5.84504 14.09H2.17004V16.94C3.98004 20.535 7.70004 23 12 23Z",fill:"#34A853"}),e.jsx("path",{d:"M5.845 14.09C5.625 13.43 5.5 12.725 5.5 12C5.5 11.275 5.625 10.57 5.845 9.91V7.06H2.17C1.4 8.59286 0.999321 10.2846 1 12C1 13.775 1.425 15.455 2.17 16.94L5.845 14.09Z",fill:"#FBBC05"}),e.jsx("path",{d:"M12 5.375C13.615 5.375 15.065 5.93 16.205 7.02L19.36 3.865C17.455 2.09 14.965 1 12 1C7.70004 1 3.98004 3.465 2.17004 7.06L5.84504 9.91C6.71004 7.31 9.13504 5.375 12 5.375Z",fill:"#EA4335"})]});function aa(t){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:26,height:26,viewBox:"0 0 140 140",x:"0px",y:"0px",fill:"none",...t,children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"b",children:[e.jsx("stop",{offset:"0",stopColor:"#3771c8"}),e.jsx("stop",{stopColor:"#3771c8",offset:".128"}),e.jsx("stop",{offset:"1",stopColor:"#60f",stopOpacity:"0"})]}),e.jsxs("linearGradient",{id:"a",children:[e.jsx("stop",{offset:"0",stopColor:"#fd5"}),e.jsx("stop",{offset:".1",stopColor:"#fd5"}),e.jsx("stop",{offset:".5",stopColor:"#ff543e"}),e.jsx("stop",{offset:"1",stopColor:"#c837ab"})]}),e.jsx("radialGradient",{id:"c",cx:"158.429",cy:"578.088",r:"65",xlinkHref:"#a",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(0 -1.98198 1.8439 0 -1031.402 454.004)",fx:"158.429",fy:"578.088"}),e.jsx("radialGradient",{id:"d",cx:"147.694",cy:"473.455",r:"65",xlinkHref:"#b",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(.17394 .86872 -3.5818 .71718 1648.348 -458.493)",fx:"147.694",fy:"473.455"})]}),e.jsx("path",{fill:"url(#c)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),e.jsx("path",{fill:"url(#d)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),e.jsx("path",{fill:"#fff",d:"M66.004 18c-13.036 0-14.672.057-19.792.29-5.11.234-8.598 1.043-11.65 2.23-3.157 1.226-5.835 2.866-8.503 5.535-2.67 2.668-4.31 5.346-5.54 8.502-1.19 3.053-2 6.542-2.23 11.65C18.06 51.327 18 52.964 18 66s.058 14.667.29 19.787c.235 5.11 1.044 8.598 2.23 11.65 1.227 3.157 2.867 5.835 5.536 8.503 2.667 2.67 5.345 4.314 8.5 5.54 3.054 1.187 6.543 1.996 11.652 2.23 5.12.233 6.755.29 19.79.29 13.037 0 14.668-.057 19.788-.29 5.11-.234 8.602-1.043 11.656-2.23 3.156-1.226 5.83-2.87 8.497-5.54 2.67-2.668 4.31-5.346 5.54-8.502 1.18-3.053 1.99-6.542 2.23-11.65.23-5.12.29-6.752.29-19.788 0-13.036-.06-14.672-.29-19.792-.24-5.11-1.05-8.598-2.23-11.65-1.23-3.157-2.87-5.835-5.54-8.503-2.67-2.67-5.34-4.31-8.5-5.535-3.06-1.187-6.55-1.996-11.66-2.23-5.12-.233-6.75-.29-19.79-.29zm-4.306 8.65c1.278-.002 2.704 0 4.306 0 12.816 0 14.335.046 19.396.276 4.68.214 7.22.996 8.912 1.653 2.24.87 3.837 1.91 5.516 3.59 1.68 1.68 2.72 3.28 3.592 5.52.657 1.69 1.44 4.23 1.653 8.91.23 5.06.28 6.58.28 19.39s-.05 14.33-.28 19.39c-.214 4.68-.996 7.22-1.653 8.91-.87 2.24-1.912 3.835-3.592 5.514-1.68 1.68-3.275 2.72-5.516 3.59-1.69.66-4.232 1.44-8.912 1.654-5.06.23-6.58.28-19.396.28-12.817 0-14.336-.05-19.396-.28-4.68-.216-7.22-.998-8.913-1.655-2.24-.87-3.84-1.91-5.52-3.59-1.68-1.68-2.72-3.276-3.592-5.517-.657-1.69-1.44-4.23-1.653-8.91-.23-5.06-.276-6.58-.276-19.398s.046-14.33.276-19.39c.214-4.68.996-7.22 1.653-8.912.87-2.24 1.912-3.84 3.592-5.52 1.68-1.68 3.28-2.72 5.52-3.592 1.692-.66 4.233-1.44 8.913-1.655 4.428-.2 6.144-.26 15.09-.27zm29.928 7.97c-3.18 0-5.76 2.577-5.76 5.758 0 3.18 2.58 5.76 5.76 5.76 3.18 0 5.76-2.58 5.76-5.76 0-3.18-2.58-5.76-5.76-5.76zm-25.622 6.73c-13.613 0-24.65 11.037-24.65 24.65 0 13.613 11.037 24.645 24.65 24.645C79.617 90.645 90.65 79.613 90.65 66S79.616 41.35 66.003 41.35zm0 8.65c8.836 0 16 7.163 16 16 0 8.836-7.164 16-16 16-8.837 0-16-7.164-16-16 0-8.837 7.163-16 16-16z"})]})}function oa({style:t,...r}){return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0,0,256,256",style:{height:"26px",width:"26px",...t},...r,children:e.jsx("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:e.jsx("g",{transform:"scale(5.12,5.12)",children:e.jsx("path",{d:"M41,4h-32c-2.76,0 -5,2.24 -5,5v32c0,2.76 2.24,5 5,5h32c2.76,0 5,-2.24 5,-5v-32c0,-2.76 -2.24,-5 -5,-5zM17,20v19h-6v-19zM11,14.47c0,-1.4 1.2,-2.47 3,-2.47c1.8,0 2.93,1.07 3,2.47c0,1.4 -1.12,2.53 -3,2.53c-1.8,0 -3,-1.13 -3,-2.53zM39,39h-6c0,0 0,-9.26 0,-10c0,-2 -1,-4 -3.5,-4.04h-0.08c-2.42,0 -3.42,2.06 -3.42,4.04c0,0.91 0,10 0,10h-6v-19h6v2.56c0,0 1.93,-2.56 5.81,-2.56c3.97,0 7.19,2.73 7.19,8.26z"})})})})}function sa(t){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...t,children:[e.jsx("path",{fill:"#1ed760",d:"M248 8C111.1 8 0 119.1 0 256s111.1 248 248 248 248-111.1 248-248S384.9 8 248 8Z"}),e.jsx("path",{d:"M406.6 231.1c-5.2 0-8.4-1.3-12.9-3.9-71.2-42.5-198.5-52.7-280.9-29.7-3.6 1-8.1 2.6-12.9 2.6-13.2 0-23.3-10.3-23.3-23.6 0-13.6 8.4-21.3 17.4-23.9 35.2-10.3 74.6-15.2 117.5-15.2 73 0 149.5 15.2 205.4 47.8 7.8 4.5 12.9 10.7 12.9 22.6 0 13.6-11 23.3-23.2 23.3zm-31 76.2c-5.2 0-8.7-2.3-12.3-4.2-62.5-37-155.7-51.9-238.6-29.4-4.8 1.3-7.4 2.6-11.9 2.6-10.7 0-19.4-8.7-19.4-19.4s5.2-17.8 15.5-20.7c27.8-7.8 56.2-13.6 97.8-13.6 64.9 0 127.6 16.1 177 45.5 8.1 4.8 11.3 11 11.3 19.7-.1 10.8-8.5 19.5-19.4 19.5zm-26.9 65.6c-4.2 0-6.8-1.3-10.7-3.6-62.4-37.6-135-39.2-206.7-24.5-3.9 1-9 2.6-11.9 2.6-9.7 0-15.8-7.7-15.8-15.8 0-10.3 6.1-15.2 13.6-16.8 81.9-18.1 165.6-16.5 237 26.2 6.1 3.9 9.7 7.4 9.7 16.5s-7.1 15.4-15.2 15.4z"})]})}function la(t){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 293768 333327",width:24,height:24,...t,children:[e.jsx("path",{fill:"#26f4ee",d:"M204958 0c5369 45832 32829 78170 77253 81022v43471l-287 27V87593c-44424-2850-69965-30183-75333-76015l-47060-1v192819c6791 86790-60835 89368-86703 56462 30342 18977 79608 6642 73766-68039V0h58365zM78515 319644c-26591-5471-50770-21358-64969-44588-34496-56437-3401-148418 96651-157884v54345l-164 27v-40773C17274 145544 7961 245185 33650 286633c9906 15984 26169 27227 44864 33011z"}),e.jsx("path",{fill:"#fb2c53",d:"M218434 11587c3505 29920 15609 55386 35948 70259-27522-10602-43651-34934-47791-70262l11843 3zm63489 82463c3786 804 7734 1348 11844 1611v51530c-25770 2537-48321-5946-74600-21749l4034 88251c0 28460 106 41467-15166 67648-34260 58734-95927 63376-137628 35401 54529 22502 137077-4810 136916-103049v-96320c26279 15803 48830 24286 74600 21748V94050zm-171890 37247c5390-1122 11048-1985 16998-2548v54345c-21666 3569-35427 10222-41862 22528-20267 38754 5827 69491 35017 74111-33931 5638-73721-28750-49999-74111 6434-12304 18180-18959 39846-22528v-51797zm64479-119719h1808-1808z"}),e.jsx("path",{d:"M206590 11578c5369 45832 30910 73164 75333 76015v51528c-25770 2539-48321-5945-74600-21748v96320c206 125717-135035 135283-173673 72939-25688-41449-16376-141089 76383-155862v52323c-21666 3569-33412 10224-39846 22528-39762 76035 98926 121273 89342-1225V11577l47060 1z",fill:"#000000"})]})}const da=({style:t,...r})=>e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",width:"24px",...t},...r,children:e.jsx("path",{d:"M 14.285156 10.171875 L 23.222656 0 L 21.105469 0 L 13.34375 8.832031 L 7.148438 0 L 0 0 L 9.371094 13.355469 L 0 24.019531 L 2.117188 24.019531 L 10.308594 14.691406 L 16.851562 24.019531 L 24 24.019531 M 2.878906 1.5625 L 6.132812 1.5625 L 21.101562 22.535156 L 17.851562 22.535156",fill:"currentColor"})});let ca={google:{name:"Google",component:ia},discord:{name:"Discord",component:ta},github:{name:"Github",component:ra},linkedin:{name:"LinkedIn",component:oa},twitter:{name:"Twitter",component:da},spotify:{name:"Spotify",component:sa},instagram:{name:"Instagram",component:aa},tiktok:{name:"Tiktok",component:la},apple:{name:"Apple",component:ea}};const ua=e=>e in ca?ca[e]:{name:"Unknown",component:na};function ha(){let e=new URLSearchParams(window.location.search),t=e.get("privy_oauth_code"),r=e.get("privy_oauth_state"),n=e.get("privy_oauth_provider");if(!t||!r||!n)return{inProgress:!1};let i=!1;try{i=!!window.opener.location.origin}catch{}return{inProgress:!0,authorizationCode:t,stateCode:r,provider:n,headless:Xi(),popupFlow:null!==window.opener&&i,disableSignup:!!d.e5.get(l.OAUTH_DISABLE_SIGNUP_KEY)}}function pa(){let e=new URL(window.location.href);e.searchParams.delete("privy_oauth_code"),e.searchParams.delete("privy_oauth_provider"),e.searchParams.delete("privy_oauth_state"),d.e5.del(l.STATE_CODE_KEY),window.history.replaceState({},"",e)}class ya{async initAuthenticationFlow(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute()}async initLinkFlow(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");this.meta.initLinkResponse=await this.initLinkOnce.execute()}async authenticate(){let e=await import("@simplewebauthn/browser");if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new o.PrivyClientError("WebAuthn is not supported in this browser");this.meta.initAuthenticateResponse||(this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute());try{let t=await e.startAuthentication(this._transformInitAuthenticateOptionsToCamelCase(this.meta.initAuthenticateResponse.options));this.meta.setPasskeyAuthState?.({status:"submitting-response"});let r=await this.api.post("/api/v1/passkeys/authenticate",{relying_party:this.meta.initAuthenticateResponse.relying_party,challenge:this.meta.initAuthenticateResponse.options.challenge,authenticator_response:this._transformAuthenticationResponseToSnakeCase(t)});return{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user}}catch(e){if("NotAllowedError"===e.name)throw new o.PrivyClientError("Passkey request timed out or rejected by user.",void 0,o.PrivyErrorCode.PASSKEY_NOT_ALLOWED);throw o.formatApiError(e)}}async link(){let e=await import("@simplewebauthn/browser");if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new o.PrivyClientError("WebAuthn is not supported in this browser");this.meta.initLinkResponse||(this.meta.initLinkResponse=await this.initLinkOnce.execute());try{let t=this.meta.initLinkResponse.options,r=await e.startRegistration(this._transformInitLinkOptionsToCamelCase(t));return await this.api.post("/api/v1/passkeys/link",{relying_party:this.meta.initLinkResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(r)})}catch(e){if("NotAllowedError"===e.name)throw new o.PrivyClientError("Passkey request timed out or rejected by user.",void 0,o.PrivyErrorCode.PASSKEY_NOT_ALLOWED);throw o.formatApiError(e)}}async _initAuthenticateOnce(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");return await this.api.post("/api/v1/passkeys/authenticate/init",{token:this.meta.captchaToken})}async _initLinkOnce(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");return await this.api.post("/api/v1/passkeys/link/init",{})}_transformInitLinkOptionsToCamelCase(e){return{rp:e.rp,user:{id:e.user.id,name:e.user.name,displayName:e.user.display_name},challenge:e.challenge,pubKeyCredParams:e.pub_key_cred_params.map((e=>({type:e.type,alg:e.alg}))),timeout:e.timeout,excludeCredentials:e.exclude_credentials?.map((e=>({id:e.id,type:e.type,transports:e.transports}))),authenticatorSelection:{authenticatorAttachment:e.authenticator_selection?.authenticator_attachment,requireResidentKey:e.authenticator_selection?.require_resident_key,residentKey:e.authenticator_selection?.resident_key,userVerification:e.authenticator_selection?.user_verification},attestation:e.attestation,extensions:{appid:e.extensions?.app_id,credProps:e.extensions?.cred_props?.rk,hmacCreateSecret:e.extensions?.hmac_create_secret}}}_transformRegistrationResponseToSnakeCase(e){return{id:e.id,raw_id:e.rawId,response:{client_data_json:e.response.clientDataJSON,attestation_object:e.response.attestationObject,authenticator_data:e.response.authenticatorData},authenticator_attachment:e.authenticatorAttachment,client_extension_results:{app_id:e.clientExtensionResults.appid,cred_props:e.clientExtensionResults.credProps,hmac_create_secret:e.clientExtensionResults.hmacCreateSecret},type:e.type}}_transformInitAuthenticateOptionsToCamelCase(e){return{challenge:e.challenge,allowCredentials:e.allow_credentials?.map((e=>({id:e.id,type:e.type,transports:e.transports})))||[],timeout:e.timeout,extensions:{appid:e.extensions?.app_id,credProps:e.extensions?.cred_props,hmacCreateSecret:e.extensions?.hmac_create_secret},userVerification:e.user_verification}}_transformAuthenticationResponseToSnakeCase(e){return{id:e.id,raw_id:e.rawId,response:{client_data_json:e.response.clientDataJSON,authenticator_data:e.response.authenticatorData,signature:e.response.signature,user_handle:e.response.userHandle},authenticator_attachment:e.authenticatorAttachment,client_extension_results:{app_id:e.clientExtensionResults.appid,cred_props:e.clientExtensionResults.credProps,hmac_create_secret:e.clientExtensionResults.hmacCreateSecret},type:e.type}}constructor(e,t){this.initAuthenticateOnce=new Gi(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new Gi(this._initLinkOnce.bind(this)),this.meta={captchaToken:e,setPasskeyAuthState:t}}}const ma=({address:e,chainId:t,nonce:r})=>`${window.location.host} wants you to sign in with your Ethereum account:\n${e}\n\nBy signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.\n\nURI: ${window.location.origin}\nVersion: 1\nChain ID: ${t}\nNonce: ${r}\nIssued At: ${(new Date).toISOString()}\nResources:\n- https://privy.io`;class fa{get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType,chainId:this.wallet.chainId,address:this.wallet.address,disableSignup:this._meta.disableSignup}}async authenticate(){if(!this.client)throw new o.PrivyClientError("SiweFlow has no client instance");try{let{message:e,signature:t}=await this.sign(),r=await this.client.authenticateWithSiweInternal({message:e,signature:t,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});return{user:r.user,token:r.token,refresh_token:r.refresh_token,identity_token:r.identity_token,is_new_user:r.is_new_user}}catch(e){throw o.formatApiError(e)}}async link(){if(!this.client)throw new o.PrivyClientError("SiweFlow has no client instance");try{let{message:e,signature:t}=await this.sign();return await this.client.linkWithSiweInternal({message:e,signature:t,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(e){throw o.formatApiError(e)}}async sign(){if(!this.client)throw new o.PrivyClientError("SiweFlow has no client instance");if(await this.buildMessage(),!this.preparedMessage)throw new o.PrivyClientError("Could not prepare SIWE message");let e=await this.wallet.sign(this.preparedMessage);return{message:this.preparedMessage,signature:e}}async _getNonceOnce(){if(!this.client)throw new o.PrivyClientError("SiweFlow has no client instance");return await this.client.generateSiweNonce({address:this.wallet.address,captchaToken:this.captchaToken})}async buildMessage(){if(!this.client)throw new o.PrivyClientError("SiweFlow has no client instance");let e=this.wallet.address,t=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=ma({address:e,chainId:t,nonce:this.nonce}),this.preparedMessage}constructor(e,t,r,n=!1){this._meta={disableSignup:!1},this.getNonceOnce=new Gi(this._getNonceOnce.bind(this)),this.wallet=e,this.captchaToken=r,this.client=t,this._meta.disableSignup=n}}class ga{get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType,disableSignup:this._meta.disableSignup}}async authenticate(){if(!this.client)throw new o.PrivyClientError("SiwsFlow has no client instance");try{let{message:e,signature:t}=await this.sign(),r=await this.client.authenticateWithSiwsInternal({message:e,signature:t,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});return{user:r.user,token:r.token,refresh_token:r.refresh_token,identity_token:r.identity_token,is_new_user:r.is_new_user}}catch(e){throw o.formatApiError(e)}}async link(){if(!this.client)throw new o.PrivyClientError("SiwsFlow has no client instance");try{let{message:e,signature:t}=await this.sign();return await this.client.linkWithSiwsInternal({message:e,signature:t,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(e){throw o.formatApiError(e)}}async sign(){if(!this.client)throw new o.PrivyClientError("SiwsFlow has no client instance");if(await this.buildMessage(),!this.preparedMessage)throw new o.PrivyClientError("Could not prepare SIWS message");if(!this.wallet.signMessage)throw new o.PrivyClientError("Wallet does not support signMessage");let e=await this.wallet.signMessage(Buffer.from(this.preparedMessage));return{message:this.preparedMessage,signature:Buffer.from(e).toString("base64")}}async _getNonceOnce(){if(!this.client)throw new o.PrivyClientError("SiwsFlow has no client instance");return await this.client.generateSiwsNonce({address:this.wallet.address,captchaToken:this.captchaToken})}async buildMessage(){if(!this.client)throw new o.PrivyClientError("SiwsFlow has no client instance");let e=this.wallet.address;return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=(({address:e,nonce:t})=>`${window.location.host} wants you to sign in with your Solana account:\n${e}\n\nYou are proving you own ${e}.\n\nURI: ${window.location.origin}\nVersion: 1\nChain ID: mainnet\nNonce: ${t}\nIssued At: ${(new Date).toISOString()}\nResources:\n- https://privy.io`)({address:e,nonce:this.nonce}),this.preparedMessage}constructor(e,t,r,n=!1){this._meta={disableSignup:!1},this.getNonceOnce=new Gi(this._getNonceOnce.bind(this)),this.wallet=e,this.captchaToken=r,this.client=t,this._meta.disableSignup=n}}class va{async authenticate(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new o.PrivyClientError("phone number and sms code must be set prior to calling authenticate.");try{let e=await this.api.post("/api/v1/passwordless_sms/authenticate",{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});return{user:e.user,token:e.token,refresh_token:e.refresh_token,identity_token:e.identity_token,is_new_user:e.is_new_user}}catch(e){throw o.formatApiError(e)}}async link(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new o.PrivyClientError("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post("/api/v1/passwordless_sms/link",{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(e){throw o.formatApiError(e)}}async sendSmsCode(e,t){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(e&&(this.meta.phoneNumber=e),t&&(this.meta.captchaToken=t),!this.meta.phoneNumber)throw new o.PrivyClientError("phone nNumber must be set when initialzing authentication.");try{return await this.api.post("/api/v1/passwordless_sms/init",{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(e){throw o.formatApiError(e)}}constructor(e,t,r=!1){this.meta={phoneNumber:e,captchaToken:t,disableSignup:r}}}class wa extends va{async link(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode||!this.meta.oldPhoneNumber)throw new o.PrivyClientError("Phone number, sms code, and an old phone number must be set prior to calling update.");try{return await this.api.post("/api/v1/passwordless_sms/update",{old_phone_number:this.meta.oldPhoneNumber,new_phone_number:this.meta.phoneNumber,code:this.meta.smsCode})}catch(e){throw o.formatApiError(e)}}constructor(e,t,r){super(t,r),this.meta={phoneNumber:t,captchaToken:r,oldPhoneNumber:e,disableSignup:!1}}}const xa=i.createContext({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:o.notImplemented,setError:o.notImplemented,setExecuting:o.notImplemented,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:o.notImplemented,reset:o.notImplemented,execute:o.notImplemented});class Ca extends o.PrivyError{constructor(e,t,r){super(e||"Captcha failed"),this.type="Captcha",t instanceof Error&&(this.cause=t),this.privyErrorCode=r}}const Ea=({children:t,id:r,captchaSiteKey:n,captchaEnabled:a})=>{let s=i.useRef(null),[l,c]=i.useState(),[u,h]=i.useState(),[p,y]=i.useState(!1),m=i.useMemo((()=>a?p||l||u?!p||l||u?l&&!u?{status:"success",token:l}:u?{status:"error",error:u}:{status:"ready"}:{status:"loading"}:{status:"ready"}:{status:"disabled"}),[a,l,u,p]);return e.jsx(xa.Provider,{value:{...m,ref:s,enabled:a,siteKey:n,appId:r,setToken:c,setError:h,setExecuting:y,remove(){a&&(s.current?.remove(),y(!1),h(void 0),c(void 0))},reset(){a&&(s.current?.reset(),y(!1),h(void 0),c(void 0))},execute(){a&&(y(!0),s.current?.execute())},async waitForResult(){if(!a)return"";try{return await d.pollForResult((()=>s.current?.getResponse()),{interval:200,timeout:2e4})}catch(e){throw new Ca("Captcha failed",null,o.PrivyErrorCode.CAPTCHA_TIMEOUT)}}},children:t})},ba=()=>i.useContext(xa);class Sa{async authenticate(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");try{let e=await this.api.post("/api/v1/telegram/authenticate",{captcha_token:this.meta.captchaToken,telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});return{user:e.user,token:e.token,refresh_token:e.refresh_token,identity_token:e.identity_token,is_new_user:e.is_new_user}}catch(e){throw o.formatApiError(e)}}async link(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");try{return await this.api.post("/api/v1/telegram/link",{telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData})}catch(e){throw o.formatApiError(e)}}constructor(e,t=!1){this.meta={disableSignup:!1},this.meta={captchaToken:e,disableSignup:!1},this.meta.disableSignup=t}}function Aa(e){let t={detail:"",retryable:!1};return e?.privyErrorCode===o.PrivyErrorCode.LINKED_TO_ANOTHER_USER&&(t.detail="This account has already been linked to another user."),e?.privyErrorCode===o.PrivyErrorCode.DISALLOWED_LOGIN_METHOD&&(t.detail="Login with Telegram not allowed."),e?.privyErrorCode===o.PrivyErrorCode.INVALID_DATA&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===o.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===o.PrivyErrorCode.INVALID_CREDENTIALS&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===o.PrivyErrorCode.TOO_MANY_REQUESTS&&(t.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode===o.PrivyErrorCode.TOO_MANY_REQUESTS&&e.message.includes("rate limit")&&(t.detail="Request limit reached for Telegram. Please wait a moment and try again."),e instanceof Ca&&(t.retryable=!0,t.detail="Something went wrong. Try again."),t}function ja(){let e=new URL(window.location.href);e.searchParams.delete("id"),e.searchParams.delete("hash"),e.searchParams.delete("auth_date"),e.searchParams.delete("first_name"),e.searchParams.delete("last_name"),e.searchParams.delete("username"),e.searchParams.delete("photo_url"),e.hash="",window.history.replaceState({},"",e)}const $a=({style:t,...r})=>e.jsxs("svg",{width:"1024",height:"1024",viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...t},...r,children:[e.jsx("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]}),Ta=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4","csw_signUserOperation"];class Pa{on(e,t){if(this.walletProvider)return this.walletProvider.on(e,t);this._subscriptions.push({eventName:e,listener:t})}async request(e){if(!this.walletProvider)throw new o.PrivyConnectorError(`A wallet request of type ${e.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(e),this.walletTimeout()]).catch((e=>{throw m.formatConnectorError(e)}))}constructor(e,t){this.removeListener=(e,t)=>{if(this.walletProvider)try{return this.walletProvider.removeListener(e,t)}catch(e){console.warn("Unable to remove wallet provider listener")}},this.walletTimeout=(e=new m.WalletTimeoutError,t=this.rpcTimeoutDuration)=>new Promise(((r,n)=>setTimeout((()=>{n(e)}),t))),this.setWalletProvider=e=>{this.walletProvider&&this._subscriptions.forEach((e=>{this.removeListener(e.eventName,e.listener)})),this.walletProvider=e,this._subscriptions.forEach((e=>{this.walletProvider?.on(e.eventName,e.listener)}))},this.walletProvider=e,this.rpcTimeoutDuration=t||l.DEFAULT_RPC_TIMEOUT,this._subscriptions=[]}}let _a=class extends Error{constructor(e,t,r){super(e),this.code=t,this.data=r}};class ka extends Fe.default{async handleSendTransaction(e){if(!e.params||!Array.isArray(e.params))throw new _a(`Invalid params for ${e.method}`,4200);let t=e.params[0];if(!await Sg()||!this.address)throw new _a("Disconnected",4900);return(await $g(t,void 0,void 0,this.address)).hash}handleSwitchEthereumChain(e){let t;if(!e.params||!Array.isArray(e.params))throw new _a(`Invalid params for ${e.method}`,4200);if("string"==typeof e.params[0])t=e.params[0];else{if(!("chainId"in e.params[0])||"string"!=typeof e.params[0].chainId)throw new _a(`Invalid params for ${e.method}`,4200);t=e.params[0].chainId}this.chainId=Number(t),this.provider=d.getJsonRpcProvider(this.chainId,this.chains,this.rpcConfig,{appId:this.appId}),this.emit("chainChanged",t)}async handlePersonalSign(e){if(!e.params||!Array.isArray(e.params))throw Error("Invalid params for personal_sign");let t=e.params[0],r=e.params[1];return await Ag(t,void 0,r)}async handleSignedTypedData(e){if(!e.params||!Array.isArray(e.params))throw Error("Invalid params for eth_signTypedData_v4");let t=e.params[0],r="string"==typeof e.params[1]?JSON.parse(e.params[1]):e.params[1];return await jg(d.generateTypedDataWithDomainType(r),void 0,t)}async handleEstimateGas(e){if(!e.params||!Array.isArray(e.params))throw Error("Invalid params for eth_estimateGas");delete e.params[0].gasPrice,delete e.params[0].maxFeePerGas,delete e.params[0].maxPriorityFeePerGas;let t={...e.params[0],chainId:d.toHex(this.chainId)};try{return await this.provider.send("eth_estimateGas",[t])}catch(e){console.warn(`Gas estimation failed with error: ${e}. Retrying gas estimation by omitting the 'from' address`);try{return delete t.from,await this.provider.send("eth_estimateGas",[t])}catch(t){throw console.warn(`Gas estimation failed with error: ${t} when omitting the 'from' address`),e}}}async request(e){switch(console.debug("Embedded1193Provider.request() called with args",e),e.method){case"eth_accounts":case"eth_requestAccounts":return this.address?[this.address]:[];case"eth_chainId":return d.toHex(this.chainId);case"eth_estimateGas":return this.handleEstimateGas(e);case"eth_sendTransaction":return this.handleSendTransaction(e);case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(e);case"personal_sign":return this.handlePersonalSign(e);case"eth_signTypedData_v4":return this.handleSignedTypedData(e)}if(!(e=>Ta.includes(e))(e.method))return this.provider.send(e.method,e.params);{let t=await Sg();if(await Tg(),!t||!this.address)throw new _a("Disconnected",4900);try{return(await this.walletProxy.rpc({address:this.rootAddress,accessToken:t,hdWalletIndex:this.walletIndex,request:{method:e.method,params:e.params}})).response.data}catch(e){throw console.error(e),new _a("Disconnected",4900)}}}async connect(){let e=await Sg();if(!e||!this.address)return null;try{return(await this.walletProxy.connect({address:this.address,accessToken:e})).address}catch(e){return console.error(e),null}}constructor({walletProxy:e,address:t,rootAddress:r,rpcConfig:n,chains:i,appId:a,chainId:o=1,walletIndex:s}){super(),this.walletProxy=e,this.address=t,this.rootAddress=r,this.chainId=o,this.rpcConfig=n,this.chains=i,this.provider=d.getJsonRpcProvider(o,this.chains,n,{appId:a}),this.rpcTimeoutDuration=no(n,"privy"),this.appId=a,this.walletIndex=s}}class Na extends Pa{constructor(e){super(e,e.rpcTimeoutDuration)}}class Ia extends Pa{sendAsync(e,t){throw Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}constructor(e){super(e,e.rpcTimeoutDuration)}}let Ma;function Oa(e){return"ethereum"===e.chainType}function Ra(e){return"ethereum"===e.type}class Fa extends m.WalletConnector{buildConnectedWallet(e,n,i,a){let s=async()=>!!this.wallets.find((r=>t.getAddress(r.address)===t.getAddress(e)));return{type:"ethereum",address:t.getAddress(e),chainId:n,meta:i,imported:a,switchChain:async r=>{let i,a;if(!s)throw new o.PrivyConnectorError("Wallet is not currently connected.");let l=this.wallets.find((r=>t.getAddress(r.address)===t.getAddress(e)))?.chainId;if(!l)throw new o.PrivyConnectorError("Unable to determine current chainId.");if("number"==typeof r?(i=`0x${r.toString(16)}`,a=r):(i=r,a=Number(r)),l===d.formatChainIdToCAIP2(i))return;let c=this.chains.find((e=>e.id===a));if(!c)throw new o.PrivyConnectorError(`Unsupported chainId: ${r}`);let u=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:i}]})};try{return await u()}catch(e){if(((e,t)=>"coinbase_wallet"===t?e.message.includes("addEthereumChain"):4902===e.code||e.message?.includes("4902"))(e,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:i,chainName:c.name,nativeCurrency:c.nativeCurrency,rpcUrls:[c.rpcUrls.default?.http[0]??""],blockExplorerUrls:[c.blockExplorers?.default.url??""]}]}),u();if("rainbow"===this.walletClientType&&e.message?.includes("wallet_switchEthereumChain"))throw new o.PrivyConnectorError(`Rainbow does not support the chainId ${n}`);throw e}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:s,getEthereumProvider:async()=>{if(!await s())throw new o.PrivyConnectorError("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await s())throw new o.PrivyConnectorError("Wallet is not currently connected.");return new r.Web3Provider(new Na(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await s())throw new o.PrivyConnectorError("Wallet is not currently connected.");return new Ia(this.proxyProvider)},sign:async e=>{if(!await s())throw new o.PrivyConnectorError("Wallet is not currently connected.");return await this.sign(e)},disconnect:()=>{this.disconnect()}}}async syncAccounts(e){let r,n=e;try{if(void 0===n){let e=await d.invokeUntilSettled((()=>this.proxyProvider.request({method:"eth_accounts"})),{maxAttempts:10,delayMs:500});console.debug(`eth_accounts for ${this.walletClientType}:`,e),Array.isArray(e)&&(n=e)}}catch(e){console.warn("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.",e)}if(!n||!Array.isArray(n)||n.length<=0||!n[0])return;let i=n[0],a=t.getAddress(i),o=[];if("privy"===this.walletClientType){let e=d.e5.get(l.getPrivyWalletKey(a));this.chains.find((t=>t.id===Number(e)))||(d.e5.del(l.getPrivyWalletKey(a)),e=null),r=e||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:r}]})}catch(e){console.warn(`Unable to switch embedded wallet to chain ID ${r} on initialization`)}}else try{let e=await d.invokeUntilSettled((()=>this.proxyProvider.request({method:"eth_chainId"})),{maxAttempts:10,delayMs:500});if(console.debug(`eth_chainId for ${this.walletClientType}:`,e),"string"==typeof e)r=e;else{if("number"!=typeof e)throw Error("Invalid chainId returned from provider");r=`0x${e.toString(16)}`}}catch(e){console.warn(`Failed to get chainId from provider, defaulting to ${l.DEFAULT_NETWORK}`,e),r=l.DEFAULT_NETWORK}let s=d.formatChainIdToCAIP2(r);if(!o.find((e=>t.getAddress(e.address)===a))){let e={name:this.walletBranding.name,icon:"string"==typeof this.walletBranding.icon?this.walletBranding.icon:void 0,id:this.walletBranding.id};o.push(this.buildConnectedWallet(t.getAddress(i),s,e,"embedded_imported"===this.connectorType))}ao(o,this.wallets)||(this.wallets=o,this.emit("walletsUpdated"))}async getConnectedWallet(){let e=await this.proxyProvider.request({method:"eth_accounts"});return this.wallets.sort(((e,t)=>t.connectedAt-e.connectedAt)).find((r=>e.find((e=>t.getAddress(e)===t.getAddress(r.address)))))||null}async isConnected(){let e=await this.proxyProvider.request({method:"eth_accounts"});return Array.isArray(e)&&e.length>0}async sign(e){return await this.connect({showPrompt:!1}),new r.Web3Provider(new Na(this.proxyProvider)).getSigner().signMessage(e)}subscribeListeners(){this.proxyProvider.on("accountsChanged",this.onAccountsChanged),this.proxyProvider.on("chainChanged",this.onChainChanged),this.proxyProvider.on("disconnect",this.onDisconnect),this.proxyProvider.on("connect",this.onConnect)}unsubscribeListeners(){this.proxyProvider.removeListener("accountsChanged",this.onAccountsChanged),this.proxyProvider.removeListener("chainChanged",this.onChainChanged),this.proxyProvider.removeListener("disconnect",this.onDisconnect),this.proxyProvider.removeListener("connect",this.onConnect)}constructor(e,t,r,n){super(e),this.chainType="ethereum",this.onAccountsChanged=e=>{0===e.length?this.onDisconnect():this.syncAccounts(e)},this.onChainChanged=e=>{this.wallets.forEach((t=>{t.chainId=d.formatChainIdToCAIP2(e),"privy"===this.walletClientType&&d.e5.put(l.getPrivyWalletKey(t.address),e)})),this.emit("walletsUpdated")},this.onDisconnect=()=>{this.connected=!1,this.wallets=[],this.emit("walletsUpdated")},this.onConnect=()=>{this.connected=!0,this.syncAccounts()},this.wallets=[],this.walletClientType=e,this.chains=t,this.defaultChain=r,this.rpcConfig=n,this.rpcTimeoutDuration=no(n,e),this.connected=!1,this.initialized=!1}}let La=[1,11155111,137,10,8453,84532,42161,7777777,43114,56],Ua=(e,t)=>e.makeWeb3Provider({options:t});class Da extends Fa{async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(e){return e.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}disconnect(){this.proxyProvider.walletProvider.disconnect(),this.onDisconnect()}get walletBranding(){return{name:this.displayName,icon:$a,id:"com.coinbase.wallet"}}async promptConnection(){try{let e=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!e||0===e.length||!e[0])throw new o.PrivyConnectorError("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([e[0]])}catch(e){throw m.formatConnectorError(e)}}updateConnectionPreference(e){this.connectionOptions=e,this.walletClientType="smartWalletOnly"===e?"coinbase_smart_wallet":"coinbase_wallet",this.proxyProvider.setWalletProvider(Ua(Ma,this.connectionOptions))}constructor(e,t,r,n,i,a){if(super("coinbase_wallet",e,t,r),this.connectorType="coinbase_wallet",this.displayName="Coinbase Wallet",this.proxyProvider=new Pa(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.connectionOptions=n.coinbaseWallet.connectionOptions??"all",this.walletClientType="smartWalletOnly"===this.connectionOptions?"coinbase_smart_wallet":"coinbase_wallet","coinbase_smart_wallet"===this.walletClientType&&(this.displayName="Coinbase Smart Wallet"),!Ma){let r=[t.id].concat(e.map((e=>e.id))),n="eoaOnly"!==this.connectionOptions?r.filter((e=>!La.includes(e))):[];n.length>0&&console.warn(`The following configured chains are not supported by the Coinbase Smart Wallet: ${n.join(", ")}`),Ma=new y.CoinbaseWalletSDK({appName:i,appLogoUrl:a,appChainIds:r})}this.proxyProvider.setWalletProvider(Ua(Ma,this.connectionOptions))}}const Wa=({...t})=>e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.37126 11.0323C2.37126 12.696 3.90598 13.4421 5.40654 13.4468C8.91753 13.4468 12.8021 11.2897 12.7819 7.67984C12.7673 5.07728 10.3748 2.86167 7.54357 2.88296C4.8495 2.88296 2.21821 4.6411 2.21803 7.03628C2.21803 7.67951 2.58722 8.30178 3.55231 8.37184C2.74763 9.16826 2.37126 10.1225 2.37126 11.0323ZM7.55283 8.68012C8.11562 8.68012 8.57186 8.13217 8.57186 7.45624C8.57186 6.78032 8.11562 6.23237 7.55283 6.23237C6.99003 6.23237 6.53379 6.78032 6.53379 7.45624C6.53379 8.13217 6.99003 8.68012 7.55283 8.68012ZM10.4747 8.68012C11.0375 8.68012 11.4937 8.13217 11.4937 7.45625C11.4937 6.78032 11.0375 6.23237 10.4747 6.23237C9.91186 6.23237 9.45562 6.78032 9.45562 7.45625C9.45562 8.13217 9.91186 8.68012 10.4747 8.68012Z",fill:t.color||"var(--privy-color-foreground-3)"})});class Ba extends Fa{async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(e){return await this.isConnected()?(await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[d.toHex(e?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:Wa,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}constructor({provider:e,chains:t,defaultChain:r,rpcConfig:n,imported:i,walletIndex:a}){super("privy",t,r,n),this.connectorType="embedded",this.proxyProvider=e,this.walletIndex=a,i&&(this.connectorType="embedded_imported"),this.subscribeListeners()}}const Ha=({style:t,...r})=>e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...t},...r,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})}),Ga=({style:t,...r})=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",x:0,y:0,viewBox:"0 0 318.6 318.6",width:"28",height:"28",style:{height:"28px",width:"28px",...t},...r,children:[e.jsx("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),e.jsx("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),e.jsx("path",{d:"m44.4 35.5 98.7 74.6-17.5-44.3zm193.9 171.3-26.5 40.6 56.7 15.6 16.3-55.3zm-204.4.9L50.1 263l56.7-15.6-26.5-40.6z",className:"s1 s2"}),e.jsx("path",{d:"m103.6 138.2-15.8 23.9 56.3 2.5-2-60.5zm111.3 0-39-34.8-1.3 61.2 56.2-2.5zM106.8 247.4l33.8-16.5-29.2-22.8zm71.1-16.5 33.9 16.5-4.7-39.3z",className:"s1 s2"}),e.jsx("path",{fill:"#d7c1b3",stroke:"#d7c1b3",className:"s1",d:"m211.8 247.4-33.9-16.5 2.7 22.1-.3 9.3zm-105 0 31.5 14.9-.2-9.3 2.5-22.1z"}),e.jsx("path",{fill:"#233447",stroke:"#233447",className:"s1",d:"m138.8 193.5-28.2-8.3 19.9-9.1zm40.9 0 8.3-17.4 20 9.1z"}),e.jsx("path",{fill:"#cd6116",stroke:"#cd6116",className:"s1",d:"m106.8 247.4 4.8-40.6-31.3.9zM207 206.8l4.8 40.6 26.5-39.7zm23.8-44.7-56.2 2.5 5.2 28.9 8.3-17.4 20 9.1zm-120.2 23.1 20-9.1 8.2 17.4 5.3-28.9-56.3-2.5z"}),e.jsx("path",{fill:"#e4751f",stroke:"#e4751f",className:"s1",d:"m87.8 162.1 23.6 46-.8-22.9zm120.3 23.1-1 22.9 23.7-46zm-64-20.6-5.3 28.9 6.6 34.1 1.5-44.9zm30.5 0-2.7 18 1.2 45 6.7-34.1z"}),e.jsx("path",{d:"m179.8 193.5-6.7 34.1 4.8 3.3 29.2-22.8 1-22.9zm-69.2-8.3.8 22.9 29.2 22.8 4.8-3.3-6.6-34.1z",className:"s3"}),e.jsx("path",{fill:"#c0ad9e",stroke:"#c0ad9e",className:"s1",d:"m180.3 262.3.3-9.3-2.5-2.2h-37.7l-2.3 2.2.2 9.3-31.5-14.9 11 9 22.3 15.5h38.3l22.4-15.5 11-9z"}),e.jsx("path",{fill:"#161616",stroke:"#161616",className:"s1",d:"m177.9 230.9-4.8-3.3h-27.7l-4.8 3.3-2.5 22.1 2.3-2.2h37.7l2.5 2.2z"}),e.jsx("path",{fill:"#763d16",stroke:"#763d16",className:"s1",d:"m278.3 114.2 8.5-40.8-12.7-37.9-96.2 71.4 37 31.3 52.3 15.3 11.6-13.5-5-3.6 8-7.3-6.2-4.8 8-6.1zM31.8 73.4l8.5 40.8-5.4 4 8 6.1-6.1 4.8 8 7.3-5 3.6 11.5 13.5 52.3-15.3 37-31.3-96.2-71.4z"}),e.jsx("path",{d:"m267.2 153.5-52.3-15.3 15.9 23.9-23.7 46 31.2-.4h46.5zm-163.6-15.3-52.3 15.3-17.4 54.2h46.4l31.1.4-23.6-46zm71 26.4 3.3-57.7 15.2-41.1h-67.5l15 41.1 3.5 57.7 1.2 18.2.1 44.8h27.7l.2-44.8z",className:"s3"})]}),qa=({style:t,...r})=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"108",height:"108",viewBox:"0 0 108 108",fill:"none",style:{height:"28px",width:"28px",...t},...r,children:[e.jsx("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M46.5267 69.9229C42.0054 76.8509 34.4292 85.6182 24.348 85.6182C19.5824 85.6182 15 83.6563 15 75.1342C15 53.4305 44.6326 19.8327 72.1268 19.8327C87.768 19.8327 94 30.6846 94 43.0079C94 58.8258 83.7355 76.9122 73.5321 76.9122C70.2939 76.9122 68.7053 75.1342 68.7053 72.314C68.7053 71.5783 68.8275 70.7812 69.0719 69.9229C65.5893 75.8699 58.8685 81.3878 52.5754 81.3878C47.993 81.3878 45.6713 78.5063 45.6713 74.4598C45.6713 72.9884 45.9768 71.4556 46.5267 69.9229ZM83.6761 42.5794C83.6761 46.1704 81.5575 47.9658 79.1875 47.9658C76.7816 47.9658 74.6989 46.1704 74.6989 42.5794C74.6989 38.9885 76.7816 37.1931 79.1875 37.1931C81.5575 37.1931 83.6761 38.9885 83.6761 42.5794ZM70.2103 42.5795C70.2103 46.1704 68.0916 47.9658 65.7216 47.9658C63.3157 47.9658 61.233 46.1704 61.233 42.5795C61.233 38.9885 63.3157 37.1931 65.7216 37.1931C68.0916 37.1931 70.2103 38.9885 70.2103 42.5795Z",fill:"#FFFDF8"})]});function za(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}var Va=0;class Ka extends Fa{async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(e){return e.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:this.providerDetail.info.name,icon:this.providerDetail.info.icon,id:this.providerDetail.info.rdns}}disconnect(){console.warn(`Programmatic disconnect with ${this.providerDetail.info.name} is not yet supported.`)}async promptConnection(){try{let e=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!e||0===e.length||!e[0])throw new o.PrivyConnectorError("Unable to retrieve accounts");await this.syncAccounts([e[0]])}catch(e){throw m.formatConnectorError(e)}}constructor(e,t,r,n,i){super(i||"unknown",e,t,r),this.connectorType="injected",this.proxyProvider=new Pa(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=n;let a=n.provider;this.proxyProvider.setWalletProvider(a)}}var Ya="__private_"+Va+++"__walletBranding";class Za extends Fa{async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(e){return e.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return za(this,Ya)[Ya]??{name:"Browser Extension",icon:Ha,id:"extension"}}disconnect(){console.warn("Programmatic disconnect with browser wallets is not yet supported.")}async promptConnection(){try{let e=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!e||0===e.length||!e[0])throw new o.PrivyConnectorError("Unable to retrieve accounts");await this.syncAccounts([e[0]])}catch(e){throw m.formatConnectorError(e)}}constructor(e,t,r,n,i){super(i??"unknown",e,t,r),Object.defineProperty(this,Ya,{writable:!0,value:void 0}),this.connectorType="injected",this.proxyProvider=new Pa(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(n),"metamask"===i?za(this,Ya)[Ya]={name:"MetaMask",icon:Ga,id:"io.metamask"}:"phantom"===i&&(za(this,Ya)[Ya]={name:"Phantom",icon:qa,id:"phantom"})}}class Xa extends Ka{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{a.isMobile||await this.proxyProvider.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});let e=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!e||0===e.length||!e[0])throw new o.PrivyConnectorError("Unable to retrieve accounts");await this.syncAccounts([e[0]])}catch(e){throw m.formatConnectorError(e)}}}class Ja extends Fa{get walletBranding(){return{name:"Wallet",id:""}}async initialize(){this.initialized=!0,this.emit("initialized")}async connect(){throw Error("connect called for an uninstalled wallet via the NullConnector")}disconnect(){throw Error("disconnect called for an uninstalled wallet via the NullConnector")}promptConnection(e){throw Error(`promptConnection called for an uninstalled wallet via the NullConnector for ${e}`)}constructor(e,t){super(e,[],t,{}),this.connectorType="null",this.proxyProvider=new Pa(void 0,l.DEFAULT_RPC_TIMEOUT),this.connectorType=e}}class Qa extends Ja{get walletBranding(){return{name:"Phantom",icon:qa,id:"phantom"}}constructor(e){super("phantom",e)}}const eo=({style:t,...r})=>{let{app:n}=g.usePrivyModal();return e.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...t},...r,children:[e.jsx("rect",{width:"28",height:"28",rx:"3",fill:"dark"===n?.appearance.palette.colorScheme?"#3396ff":"#141414"}),e.jsx("g",{clipPath:"url(#clip0_1765_9946)",children:e.jsx("path",{d:"M8.09448 10.3941C11.3558 7.20196 16.6442 7.20196 19.9055 10.3941L20.2982 10.7782C20.3369 10.8157 20.3677 10.8606 20.3887 10.9102C20.4097 10.9599 20.4206 11.0132 20.4206 11.0671C20.4206 11.121 20.4097 11.1744 20.3887 11.224C20.3677 11.2737 20.3369 11.3186 20.2982 11.3561L18.9554 12.6702C18.9158 12.7086 18.8628 12.7301 18.8077 12.7301C18.7526 12.7301 18.6996 12.7086 18.66 12.6702L18.1198 12.1415C15.8448 9.91503 12.1557 9.91503 9.88015 12.1415L9.30167 12.7075C9.26207 12.7459 9.20909 12.7673 9.15395 12.7673C9.0988 12.7673 9.04582 12.7459 9.00622 12.7075L7.66346 11.3934C7.62475 11.3559 7.59397 11.3109 7.57295 11.2613C7.55193 11.2117 7.5411 11.1583 7.5411 11.1044C7.5411 11.0505 7.55193 10.9971 7.57295 10.9475C7.59397 10.8979 7.62475 10.8529 7.66346 10.8154L8.09448 10.3941ZM22.6829 13.1115L23.8776 14.2814C23.9163 14.319 23.9471 14.3639 23.9681 14.4135C23.9892 14.4632 24 14.5165 24 14.5704C24 14.6243 23.9892 14.6777 23.9681 14.7273C23.9471 14.777 23.9163 14.8219 23.8776 14.8594L18.4893 20.1332C18.4102 20.2101 18.3042 20.2531 18.1938 20.2531C18.0835 20.2531 17.9775 20.2101 17.8984 20.1332L14.0743 16.3901C14.0545 16.3708 14.0279 16.36 14.0003 16.36C13.9726 16.36 13.9461 16.3708 13.9263 16.3901L10.1021 20.1332C10.023 20.2101 9.91703 20.2531 9.8067 20.2531C9.69636 20.2531 9.59038 20.2101 9.51124 20.1332L4.12236 14.8594C4.08365 14.8219 4.05287 14.777 4.03185 14.7273C4.01083 14.6777 4 14.6243 4 14.5704C4 14.5165 4.01083 14.4632 4.03185 14.4135C4.05287 14.3639 4.08365 14.319 4.12236 14.2814L5.31767 13.1115C5.39678 13.0348 5.50265 12.9919 5.61285 12.9919C5.72305 12.9919 5.82892 13.0348 5.90803 13.1115L9.73216 16.8546C9.75194 16.874 9.7785 16.8848 9.80616 16.8848C9.83381 16.8848 9.86037 16.874 9.88015 16.8546L13.7043 13.1115C13.7834 13.0346 13.8894 12.9916 13.9997 12.9916C14.1101 12.9916 14.216 13.0346 14.2952 13.1115L18.1198 16.8546C18.1396 16.874 18.1662 16.8848 18.1938 16.8848C18.2215 16.8848 18.2481 16.874 18.2678 16.8546L22.092 13.1115C22.1711 13.0346 22.2771 12.9916 22.3874 12.9916C22.4977 12.9916 22.6037 13.0346 22.6829 13.1115Z",fill:"white"})}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0_1765_9946",children:e.jsx("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};class to extends Fa{async initialize(){let e=await this.createProvider();if(this.provider=e,this.proxyProvider.setWalletProvider(e),this.subscribeListeners(),e.session){if(this.walletProvider?.session?.peer.metadata.url){let e=Ri(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=e?.entry,this.walletClientType=e?.walletClientType||"unknown"}this.connected=!0,await this.syncAccounts()}this.initialized=!0,this.emit("initialized");let{WalletConnectModal:t}=await import("@walletconnect/modal");this.modal=new t({projectId:this.walletConnectCloudProjectId,themeVariables:{"--wcm-z-index":"1000000"}}),this.modal.subscribeModal((e=>{e.open||this.walletProvider?.session||!this.onQrModalClosed||this.onQrModalClosed()}))}async connect(e){return e.showPrompt&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return!!this.walletProvider?.connected}get walletBranding(){return"metamask"===this.walletClientType?{name:"MetaMask",icon:Ga,id:"io.metamask"}:{name:d.stripEmoji(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||eo,id:this.walletProvider?.session?.peer.metadata.name.toLowerCase()||"wallet_connect_v2"}}async resetConnection(e){this.walletProvider&&this.walletProvider.connected&&(await this.walletProvider.disconnect(),this.walletProvider.signer.session=void 0,this.walletEntry=Fi[e],this.walletClientType=e,this.redirectUri=void 0,this.fallbackUniversalRedirectUri=void 0,function(){try{localStorage.removeItem(Ui)}catch{}}(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise(((e,t)=>{this.onQrModalClosed=()=>{t(new m.UserRejectedConnectionError)},(async()=>{let t="",r=await Promise.race([this.walletProvider?.enable(),this.proxyProvider.walletTimeout()]);if(r?.length&&(t=r[0]),!t||""===t)throw new o.PrivyConnectorError("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let e=Ri(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=e?.entry,this.walletClientType=e?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=no(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(r),e()})().catch((e=>{t(e?m.formatConnectorError(e):new o.PrivyConnectorError("Unknown error during connection"))})).finally((()=>this.modal?.closeModal()))}))}disconnect(){this.walletProvider?.disconnect().then((()=>this.onDisconnect())).catch((()=>console.warn("Unable to disconnect Wallet Connect provider")))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(e){this.proxyProvider.setWalletProvider(e)}async createProvider(){let e={};for(let t of this.chains){let r=d.getJsonRpcEndpoint(t.id,this.chains,this.rpcConfig,this.privyAppId);r&&(e[t.id]=r)}let t=this.shouldEnforceDefaultChainOnConnect?[this.defaultChain.id]:[],r=this.chains.map((e=>e.id)),n=await f.EthereumProvider.init({projectId:this.walletConnectCloudProjectId,chains:t,optionalChains:r,optionalEvents:f.OPTIONAL_EVENTS,optionalMethods:f.OPTIONAL_METHODS,rpcMap:e,showQrModal:!1,metadata:{description:this.privyAppName,name:this.privyAppName,url:window.location.toString(),icons:[]}});return n.on("display_uri",(e=>{if(n.signer.abortPairingAttempt(),a.isMobile&&this.walletEntry){let{redirect:t,href:r}=function(e,t){let r=Li(t);if(r.deepLink)return Wi(r.deepLink,e);if(r.universalLink)return Bi(r.universalLink,e);throw new o.PrivyClientError(`Unsupported wallet ${t.id}`)}(e,this.walletEntry);(function({href:e,name:t}){try{localStorage.setItem(Ui,JSON.stringify({href:e,name:t}))}catch{}})({href:r,name:this.walletEntry.displayName}),this.redirectUri=t;let n=function(e,t){let r=Li(t);if(r.universalLink)return Bi(r.universalLink,e)}(e,this.walletEntry);n?.redirect&&(this.fallbackUniversalRedirectUri=n.redirect),Hi(t,"_self")}else this.modal?.openModal({uri:e,chains:[this.defaultChain.id]})})),n.on("connect",(()=>{if(this.modal?.closeModal(),n.session?.peer.metadata.url){let e=Ri(n.session?.peer.metadata.url);this.walletEntry=e?.entry,this.walletClientType=e?.walletClientType||"unknown"}})),n}async enableProvider(){return this.walletProvider?.connected?Promise.resolve(this.walletProvider.accounts):await(this.walletProvider?.enable())}constructor(e,t,r,n,i,a,o,s){super(s||"unknown",r,n,t),this.connectorType="wallet_connect_v2",this.privyAppId=a,this.privyAppName=o,this.walletConnectCloudProjectId=e,this.rpcConfig=t,this.shouldEnforceDefaultChainOnConnect=i,this.proxyProvider=new Pa(void 0,this.rpcTimeoutDuration),s&&(this.walletEntry=Fi[s],this.walletClientType=s)}}const ro=e=>{let r=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses")?.split(" ").filter((e=>h.isHexString(e))).map((e=>t.getAddress(e)));return!!r?.length&&!!e?.linkedAccounts.filter((e=>"wallet"==e.type&&r.includes(e.address))).length},no=(e,t)=>e.rpcTimeouts&&e.rpcTimeouts[t]||l.DEFAULT_RPC_TIMEOUT;class io extends Fe.default{get wallets(){let e=new Set,t=this.walletConnectors.flatMap((e=>e.wallets)).sort(((e,t)=>e.connectedAt&&t.connectedAt?t.connectedAt-e.connectedAt:0)).filter((t=>{let r=`${t.address}${t.walletClientType}${t.connectorType}`;return!e.has(r)&&(e.add(r),!0)})),r=t.findIndex((e=>e.address===(this.activeWallet?this.activeWallet:"unknown")));return r>=0&&t.unshift(t.splice(r,1)[0]),t}async initialize(){if(this.initialized)return;d.e5.get(l.CONNECTORS_STATE_KEY)&&(d.e5.getKeys().forEach((e=>{e.startsWith("walletconnect")&&d.e5.del(e)})),d.e5.del(l.CONNECTORS_STATE_KEY));let e=d.detectInjectedConnectors(this.store,this.walletList,this.externalWalletConfig).then((e=>{e.forEach((({type:e,eip6963InjectedProvider:t,legacyInjectedProvider:r})=>{this.createEthereumWalletConnector("injected",e,{eip6963InjectedProvider:t,legacyInjectedProvider:r})}))}));this.walletList.includes("coinbase_wallet")&&this.createEthereumWalletConnector("coinbase_wallet","coinbase_wallet"),!d.isPhantomInstalled()&&this.walletList.includes("phantom")&&this.createEthereumWalletConnector("phantom","phantom"),this.externalWalletConfig.walletConnect.enabled&&this.createEthereumWalletConnector("wallet_connect_v2","unknown"),this.externalWalletConfig.solana.connectors?.get().forEach(this.addSolanaWalletConnector),this.externalWalletConfig.solana.connectors?._setOnConnectorsUpdated?.((e=>{e?.forEach(this.addSolanaWalletConnector)})),await e,this.initialized=!0}findWalletConnector(e,t){return"wallet_connect_v2"===e?this.walletConnectors.filter(Oa).find((t=>t.connectorType===e))??null:this.walletConnectors.filter(Oa).find((r=>r.connectorType===e&&r.walletClientType===t))??null}findSolanaWalletConnector(e,t){return this.walletConnectors.filter(m.isSolanaWalletConnector).find((r=>r.connectorType===e&&r.walletClientType===t))??null}findEmbeddedWalletConnectors(){return this.walletConnectors.filter((e=>"embedded"===e.connectorType))}onInitialized(e){e.wallets.forEach((e=>{let t=this.storedConnections.find((t=>t.address===e.address&&t.connectorType===e.connectorType&&t.walletClientType===e.walletClientType));t&&(e.connectedAt=t.connectedAt)})),this.saveConnectionHistory(),this.emit("walletsUpdated"),this.emit("connectorInitialized")}onWalletsUpdated(e){e.initialized&&(this.saveConnectionHistory(),this.emit("walletsUpdated"))}addEmbeddedWalletConnectors({walletProxy:e,rootWallet:t,embeddedWallets:r,defaultChain:n,appId:i}){for(let a of r){let r=this.findEmbeddedWalletConnectors().find((e=>e.walletIndex===a.walletIndex));if(r&&Oa(r))r.proxyProvider.walletProxy=e;else{let r=new Ba({provider:new ka({walletProxy:e,address:a.address,rootAddress:t.address,rpcConfig:this.rpcConfig,chains:this.chains,appId:i,chainId:n.id,walletIndex:a.walletIndex}),chains:this.chains,defaultChain:n,rpcConfig:this.rpcConfig,imported:!1,walletIndex:a.walletIndex});this.addWalletConnector(r)}}}addImportedWalletConnector(e,t,r,n){let i=this.findWalletConnector("embedded_imported","privy");if(i&&Oa(i))i.proxyProvider.walletProxy=e;else{let i=new Ba({provider:new ka({walletProxy:e,rootAddress:t,address:t,walletIndex:0,rpcConfig:this.rpcConfig,chains:this.chains,appId:n,chainId:r.id}),chains:this.chains,walletIndex:0,defaultChain:r,rpcConfig:this.rpcConfig,imported:!0});this.addWalletConnector(i)}}removeEmbeddedWalletConnectors(){this.walletConnectors=this.walletConnectors.filter((e=>"embedded"!==e.connectorType)),this.saveConnectionHistory(),this.storedConnections=oo(),this.emit("walletsUpdated")}removeImportedWalletConnector(){let e=this.findWalletConnector("embedded_imported","privy");if(e){let t=this.walletConnectors.indexOf(e);this.walletConnectors.splice(t,1),this.saveConnectionHistory(),this.storedConnections=oo(),this.emit("walletsUpdated")}}async createEthereumWalletConnector(e,t,r){let n=this.findWalletConnector(e,t);if(n&&Oa(n))return n instanceof to&&n.resetConnection(t),n;let i=(()=>"injected"!==e?"coinbase_wallet"===e?new Da(this.chains,this.defaultChain,this.rpcConfig,this.externalWalletConfig,this.privyAppName,this.privyAppLogo):"phantom"===e?new Qa(this.defaultChain):new to(this.walletConnectCloudProjectId,this.rpcConfig,this.chains,this.defaultChain,this.shouldEnforceDefaultChainOnConnect,this.privyAppId,this.privyAppName,t):"metamask"===t&&r?.eip6963InjectedProvider?new Xa(this.chains,this.defaultChain,this.rpcConfig,r?.eip6963InjectedProvider,"metamask"):"metamask"===t&&r?.legacyInjectedProvider?new Za(this.chains,this.defaultChain,this.rpcConfig,r?.legacyInjectedProvider,"metamask"):"phantom"===t&&r?.legacyInjectedProvider?new Za(this.chains,this.defaultChain,this.rpcConfig,r?.legacyInjectedProvider,"phantom"):r?.legacyInjectedProvider&&"unknown_browser_extension"===t?new Za(this.chains,this.defaultChain,this.rpcConfig,r?.legacyInjectedProvider):r?.eip6963InjectedProvider?new Ka(this.chains,this.defaultChain,this.rpcConfig,r?.eip6963InjectedProvider,t):void 0)();return i&&this.addWalletConnector(i),i||null}addWalletConnector(e){this.walletConnectors.push(e),e.on("initialized",(()=>this.onInitialized(e))),e.on("walletsUpdated",(()=>this.onWalletsUpdated(e))),e.initialize().catch((e=>{console.debug("Failed to initialize connector",e)}))}saveConnectionHistory(){let e=this.wallets.map((e=>({address:e.address,connectorType:e.connectorType,walletClientType:e.walletClientType,connectedAt:e.connectedAt})));d.e5.put(l.CONNECTIONS_HISTORY_KEY,e)}async activeWalletSign(e){let t=this.wallets,r=t.length>0?t[0]:null;return r&&Ra(r)?r.sign(e):null}setActiveWallet(e){this.activeWallet=t.getAddress(e),this.emit("walletsUpdated")}constructor(e,t,r,n,i,a,o,s,l,d,c){super(),this.addSolanaWalletConnector=async e=>{this.findWalletConnector("solana_adapter",e.walletClientType)||this.addWalletConnector(e)},this.getEthereumProvider=()=>{let e=this.wallets[0],t=this.walletConnectors.find((t=>t.wallets.find((t=>t.address===e?.address))));return e&&t?t.proxyProvider:new Pa},this.privyAppId=e,this.walletConnectCloudProjectId=t,this.rpcConfig=r,this.chains=n,this.defaultChain=i,this.walletConnectors=[],this.initialized=!1,this.store=a,this.walletList=o,this.shouldEnforceDefaultChainOnConnect=s,this.externalWalletConfig=l,this.privyAppName=d,this.privyAppLogo=c,this.storedConnections=oo()}}function ao(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){let n=e[r],i=t[r];if(n?.address!==i?.address||n&&i&&Ra(n)&&Ra(i)&&n?.chainId!==i?.chainId||n?.connectorType!==i?.connectorType||n?.connectedAt!==i?.connectedAt||n?.walletClientType!==i?.walletClientType||n?.isConnected!==i?.isConnected||n?.linked!==i?.linked)return!1}return!0}const oo=()=>{let e=d.e5.get(l.CONNECTIONS_HISTORY_KEY);return e&&Array.isArray(e)&&e.map((e=>(e=>e&&"string"==typeof e.address&&"string"==typeof e.connectorType&&"string"==typeof e.walletClientType&&"number"==typeof e.connectedAt)(e))).every(Boolean)?e:[]};let so=[ji,Ti,$i,Ni];class lo{async get(e,t){try{return await this.baseFetch(e,t)}catch(e){throw o.formatApiError(e)}}async post(e,t,r){try{return await this.baseFetch(e,{method:"POST",...t?{body:t}:{},...r})}catch(e){throw o.formatApiError(e)}}async delete(e,t){try{return await this.baseFetch(e,{method:"DELETE",...t})}catch(e){throw o.formatApiError(e)}}constructor({appId:e,appClientId:t,client:r,defaults:n}){this.appId=e,this.appClientId=t,this.clientAnalyticsId=r.clientAnalyticsId,this.sdkVersion=l.VERSION,this.client=r,this.defaults=n,this.fallbackApiUrl=r.fallbackApiUrl,this.baseFetch=v.ofetch.create({baseURL:this.defaults.baseURL,timeout:this.defaults.timeout,retry:3,retryDelay:500,retryStatusCodes:[408,409,425,500,502,503,504],credentials:"include",onRequest:async({request:e,options:t})=>{let r=new Headers(t.headers);r.set("privy-app-id",this.appId),this.appClientId&&r.set("privy-client-id",this.appClientId),r.set("privy-ca-id",this.clientAnalyticsId||""),r.set("privy-client",`react-auth:${this.sdkVersion}`);let n=so.includes(e.toString());if(!r.has("authorization")){let e=await this.client.getAccessToken({disableAutoRefresh:n});null!==e&&r.set("authorization",`Bearer ${e}`)}t.headers=r,t.retryDelay&&(t.retryDelay=3*t.retryDelay)},onRequestError:({error:e})=>{if(e instanceof DOMException&&"AbortError"===e.name)throw new o.PrivyTimeoutError}})}}function co(){return!(a.isSafari&&window.location.origin.startsWith("http://localhost"))}class uo{static parse(e){try{return new uo(e)}catch(e){return null}}get subject(){return this._decoded.sub}get expiration(){return this._decoded.exp}get issuer(){return this._decoded.iss}get audience(){return this._decoded.aud}isExpired(e=0){return Date.now()>=1e3*(this.expiration-e)}constructor(e){this.value=e,this._decoded=Re.decodeJwt(e)}}class ho{get token(){try{let e=d.e5.get(l.TOKEN_STORAGE_KEY);return"string"==typeof e?new uo(e).value:null}catch(e){return console.error(e),this.destroyLocalState(),null}}get refreshToken(){try{let e=d.e5.get(l.REFRESH_TOKEN_STORAGE_KEY);return"string"==typeof e?e:null}catch(e){return console.error(e),this.destroyLocalState(),null}}get forkedToken(){try{let e=d.e5.get(l.FORKED_TOKEN_STORAGE_KEY);return"string"==typeof e?e:null}catch(e){return console.error(e),this.destroyLocalState(),null}}getProviderAccessToken(e){try{let t=d.e5.get(l.getProviderAccessTokenStorageKey(e));if("string"!=typeof t)return null;{let r=new uo(t);return r.isExpired()?(d.e5.del(l.getProviderAccessTokenStorageKey(e)),null):r.value}}catch(e){return console.error(e),null}}get mightHaveServerCookies(){try{let e=Le.default.get(l.SESSION_COOKIE_KEY);return void 0!==e&&e.length>0}catch(e){console.error(e)}return!1}hasRefreshCredentials(){return this.mightHaveServerCookies||"string"==typeof this.token&&"string"==typeof this.refreshToken&&this.refreshToken!==l.DEPRECATED_REFRESH_TOKEN}hasRecoveryCredentials(){return"string"==typeof this.forkedToken}hasActiveToken(){let e=uo.parse(this.token);return null!==e&&!e.isExpired(30)}authenticate(e){return this.authenticateOnce.execute(e)}link(e){return this.linkOnce.execute(e)}refresh(){return this.refreshOnce.execute()}forkSession(){return this.forkSessionOnce.execute()}destroy(){return this.destroyOnce.execute()}storeProviderAccessToken(e,t){"string"==typeof t?d.e5.put(l.getProviderAccessTokenStorageKey(e),t):d.e5.del(l.getProviderAccessTokenStorageKey(e))}async _authenticate(e){try{let t=await e.authenticate(),{user:r,is_new_user:n,oauth_tokens:i}=t;this.handleTokenResponse(t);let a=i?{provider:i.provider,accessToken:i.access_token,accessTokenExpiresInSeconds:i.access_token_expires_in_seconds,refreshToken:i.refresh_token,refreshTokenExpiresInSeconds:i.refresh_token_expires_in_seconds,scopes:i.scopes}:void 0,o=function(e){return e instanceof Mi?"email":e instanceof va?"sms":e instanceof fa?"siwe":e instanceof Vi?"guest":e instanceof Ii?"custom_auth":e instanceof Ji?e.meta.provider:null}(e);return o&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate",payload:{method:o,isNewUser:n}}),"siwe"===o&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate_siwe",payload:{connectorType:e.meta.connectorType,walletClientType:e.meta.walletClientType}}),{user:u.convertUserResponseToUser(r),isNewUser:n,oAuthTokens:a}}catch(e){throw console.warn("Error authenticating session"),o.formatPrivyError(e)}}async _link(e){try{let t=await e.link(),r=t.oauth_tokens,n=r?{provider:r.provider,accessToken:r.access_token,accessTokenExpiresInSeconds:r.access_token_expires_in_seconds,refreshToken:r.refresh_token,refreshTokenExpiresInSeconds:r.refresh_token_expires_in_seconds,scopes:r.scopes}:void 0;return{user:u.convertUserResponseToUser(t),oAuthTokens:n}}catch(e){throw console.warn("Error linking account"),o.formatPrivyError(e)}}async _refresh(){if(!this.api)throw new o.PrivyClientError("Session has no API instance");if(!this.client)throw new o.PrivyClientError("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let e=this.token,t=this.refreshToken,r=this.forkedToken;if(this.client.useServerCookies&&!this.mightHaveServerCookies&&this.token&&window.location.origin===this.client.apiUrl)return this.destroyLocalState(),null;try{let n;if(e&&t||this.mightHaveServerCookies){let i={};e&&(i.authorization=`Bearer ${e}`),n=await this.api.post(ji,t?{refresh_token:t}:{},{headers:i}),r&&this.clearForkedToken()}else{if(!r)return null;n=await this.api.post(Ti,{refresh_token:r}),this.clearForkedToken()}return this.handleTokenResponse(n),u.convertUserResponseToUser(n.user)}catch(e){if(e instanceof o.PrivyApiError&&e.privyErrorCode===o.PrivyErrorCode.MISSING_OR_INVALID_TOKEN)return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw o.formatPrivyError(e)}}handleTokenResponse(e){e.session_update_action?"set"===e.session_update_action?(this.storeRefreshToken(e.refresh_token),this.storeToken(e.token),e.identity_token&&this.storeIdentityToken(e.identity_token)):"clear"===e.session_update_action?this.destroyLocalState():"ignore"===e.session_update_action&&e.token&&(this.storeToken(e.token),e.identity_token&&this.storeIdentityToken(e.identity_token)):(this.storeRefreshToken(e.refresh_token),this.storeToken(e.token),e.identity_token&&this.storeIdentityToken(e.identity_token))}async _destroy(){try{await(this.api?.post($i,{refresh_token:this.refreshToken}))}catch(e){console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new o.PrivyClientError("Session has no API instance");let e=this.refreshToken;try{let t=await this.api.post("/api/v1/sessions/fork",{refresh_token:e});return this.storeRefreshToken(t.refresh_token),this.storeToken(t.token),t.new_session_refresh_token}catch(e){throw o.formatPrivyError(e)}}destroyLocalState(){this.storeRefreshToken(null),this.storeToken(null),this.clearIdentityToken(),this.clearForkedToken()}storeToken(e){if("string"==typeof e){let t=d.e5.get(l.TOKEN_STORAGE_KEY);if(d.e5.put(l.TOKEN_STORAGE_KEY,e),!this.client?.useServerCookies){let t=uo.parse(e)?.expiration;Le.default.set(l.TOKEN_COOKIE_KEY,e,{sameSite:"Strict",secure:co(),expires:t?new Date(1e3*t):void 0})}t!==e&&this.client?.onStoreToken?.(e)}else d.e5.del(l.TOKEN_STORAGE_KEY),Le.default.remove(l.TOKEN_COOKIE_KEY),this.client?.onDeleteToken?.()}storeRefreshToken(e){"string"==typeof e?(d.e5.put(l.REFRESH_TOKEN_STORAGE_KEY,e),this.client?.useServerCookies||Le.default.set(l.SESSION_COOKIE_KEY,"t",{sameSite:"Strict",secure:co(),expires:30})):(d.e5.del(l.REFRESH_TOKEN_STORAGE_KEY),Le.default.remove(l.REFRESH_TOKEN_COOKIE_KEY),Le.default.remove(l.SESSION_COOKIE_KEY))}storeIdentityToken(e){if(this.client?.useServerCookies)return;d.e5.put(l.IDENTITY_TOKEN_STORAGE_KEY,e);let t=uo.parse(e)?.expiration;Le.default.set(l.IDENTITY_TOKEN_COOKIE_KEY,e,{sameSite:"Strict",secure:co(),expires:t?new Date(1e3*t):void 0})}clearIdentityToken(){d.e5.del(l.IDENTITY_TOKEN_STORAGE_KEY),Le.default.remove(l.IDENTITY_TOKEN_COOKIE_KEY)}clearForkedToken(){d.e5.del(l.FORKED_TOKEN_STORAGE_KEY)}constructor(){this.authenticateOnce=new Gi((async e=>this._authenticate(e))),this.linkOnce=new Gi((async e=>this._link(e))),this.refreshOnce=new Gi(this._refresh.bind(this)),this.destroyOnce=new Gi(this._destroy.bind(this)),this.forkSessionOnce=new Gi(this._forkSession.bind(this))}}let po;var yo=0,mo="__private_"+yo+++"__getOrGenerateClientAnalyticsId";class fo{initializeConnectorManager({walletConnectCloudProjectId:e,rpcConfig:t,chains:r,defaultChain:n,store:i,walletList:a,shouldEnforceDefaultChainOnConnect:o,externalWalletConfig:s,appName:l}){this.connectors||(this.connectors=new io(this.appId,e,t,r,n,i,a,o,s,l))}sessionHasActiveToken(){return this.session.hasActiveToken()}generateApi(){let e=new lo({appId:this.appId,appClientId:this.appClientId,client:this,defaults:{baseURL:this.apiUrl,timeout:this.timeout}});return this.session.api=e,e}updateApiUrl(e){this.apiUrl=e||this.fallbackApiUrl,this.api=this.generateApi(),e&&(this.useServerCookies=!0)}authenticate(){if(!this.authFlow)throw new o.PrivyClientError("No auth flow in progress.");return this.session.authenticate(this.authFlow)}async link(){if(!this.authFlow)throw new o.PrivyClientError("No auth flow in progress.");let{oAuthTokens:e}=await this.session.link(this.authFlow);return{user:await this.getAuthenticatedUser(),oAuthTokens:e}}storeProviderAccessToken(e,t){this.session.storeProviderAccessToken(e,t)}getProviderAccessToken(e){return this.session.getProviderAccessToken(e)}async logout(){await this.session.destroy(),this.authFlow=void 0}clearProviderAcccessTokens(e){e.linkedAccounts.filter((e=>"cross_app"===e.type)).forEach((e=>{this.storeProviderAccessToken(e.providerApp.id,null)}))}startAuthFlow(e){return e.api=this.api,this.authFlow=e,this.authFlow}async initMfaSmsVerification(){try{await this.api.post("/api/v1/mfa/passwordless_sms/init",{action:"verify"})}catch(e){throw o.formatApiError(e)}}async initMfaPasskeyVerification(){try{return(e=>({challenge:e.challenge,allowCredentials:e.allow_credentials?.map((e=>({id:e.id,type:e.type,transports:e.transports})))||[],timeout:e.timeout,extensions:{appid:e.extensions?.app_id,credProps:e.extensions?.cred_props,hmacCreateSecret:e.extensions?.hmac_create_secret},userVerification:e.user_verification}))((await this.api.post("/api/v1/mfa/passkeys/init",{})).options)}catch(e){throw o.formatApiError(e)}}async acceptTerms(){try{let e=await this.api.post("/api/v1/users/me/accept_terms",{});return u.convertUserResponseToUser(e)}catch(e){throw o.formatPrivyError(e)}}async unlinkEmail(e){try{let t=await this.api.post("/api/v1/passwordless/unlink",{address:e});return await this.getAuthenticatedUser()??u.convertUserResponseToUser(t)}catch(e){throw o.formatPrivyError(e)}}async unlinkPhone(e){try{let t=await this.api.post("/api/v1/passwordless_sms/unlink",{phoneNumber:e});return await this.getAuthenticatedUser()??u.convertUserResponseToUser(t)}catch(e){throw o.formatPrivyError(e)}}async unlinkEthereumWallet(e){try{let t=await this.api.post("/api/v1/siwe/unlink",{address:e});return await this.getAuthenticatedUser()??u.convertUserResponseToUser(t)}catch(e){throw o.formatPrivyError(e)}}async unlinkSolanaWallet(e){try{let t=await this.api.post("/api/v1/siws/unlink",{address:e});return await this.getAuthenticatedUser()??u.convertUserResponseToUser(t)}catch(e){throw o.formatPrivyError(e)}}async unlinkOAuth(e,t){try{let r=await this.api.post("/api/v1/oauth/unlink",{provider:e,subject:t});return await this.getAuthenticatedUser()??u.convertUserResponseToUser(r)}catch(e){throw o.formatPrivyError(e)}}async unlinkFarcaster(e){try{let t=await this.api.post("/api/v1/farcaster/unlink",{fid:e});return await this.getAuthenticatedUser()??u.convertUserResponseToUser(t)}catch(e){throw o.formatPrivyError(e)}}async unlinkTelegram(e){try{let t=await this.api.post("/api/v1/telegram/unlink",{telegram_user_id:e});return await this.getAuthenticatedUser()??u.convertUserResponseToUser(t)}catch(e){throw o.formatPrivyError(e)}}async unlinkPasskey(e){try{let t=await this.api.post("/api/v1/passkeys/unlink",{credential_id:e});return await this.getAuthenticatedUser()??u.convertUserResponseToUser(t)}catch(e){throw o.formatPrivyError(e)}}async createAnalyticsEvent({eventName:e,payload:t,timestamp:r,options:n}){if("undefined"!=typeof window)try{this.clientAnalyticsId||console.warn("No client analytics id set, refusing to send analytics event"),await this.api.post(Ni,{event_name:e,client_id:this.clientAnalyticsId,payload:{...t||{},clientTimestamp:r?r.toISOString():(new Date).toISOString()}},{retry:-1,keepalive:n?.keepAlive??!1})}catch(e){}}async signMoonpayOnRampUrl(e){try{return this.api.post("/api/v1/plugins/moonpay_on_ramp/sign",e)}catch(e){throw o.formatPrivyError(e)}}async initCoinbaseOnRamp(e){try{return this.api.post("/api/v1/funding/coinbase_on_ramp/init",e)}catch(e){throw o.formatPrivyError(e)}}async getCoinbaseOnRampStatus({partnerUserId:e}){try{return this.api.get(`/api/v1/funding/coinbase_on_ramp/status?partnerUserId=${e}`)}catch(e){throw o.formatPrivyError(e)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(e){return this.session.hasActiveToken()?this.session.hasRefreshCredentials()?uo.parse(this.session.token)?.audience!==this.appId?(await this.logout(),null):this.session.token:(this.session.destroyLocalState(),null):!e?.disableAutoRefresh&&this.session.hasRefreshCredentials()?(await this.session.refresh(),this.session.token):null}async getSmartWalletsConfig(){try{let e={},t=this.session.token;t&&(e.authorization=`Bearer ${t}`);let r=await this.api.get(`/api/v1/apps/${this.appId}/smart_wallets`,{baseURL:this.fallbackApiUrl,headers:e});return r.enabled?{enabled:r.enabled,smartWalletType:r.smart_wallet_type,configuredNetworks:r.configured_networks.map((e=>({chainId:e.chain_id,bundlerUrl:e.bundler_url,paymasterUrl:e.paymaster_url})))}:{enabled:r.enabled}}catch(e){throw o.formatPrivyError(e)}}async getServerConfig(){try{let e={},t=this.session.token;t&&(e.authorization=`Bearer ${t}`);let r=await this.api.get(`/api/v1/apps/${this.appId}`,{baseURL:this.fallbackApiUrl,headers:e}),n=r.telegram_auth_config?{botId:r.telegram_auth_config.bot_id,botName:r.telegram_auth_config.bot_name,linkEnabled:r.telegram_auth_config.link_enabled,seamlessAuthEnabled:r.telegram_auth_config.seamless_auth_enabled}:void 0,i=r.funding_config?{methods:r.funding_config.methods,defaultRecommendedAmount:r.funding_config.default_recommended_amount,defaultRecommendedCurrency:r.funding_config.default_recommended_currency,promptFundingOnWalletCreation:r.funding_config.prompt_funding_on_wallet_creation}:void 0;return{id:r.id,name:r.name,verificationKey:r.verification_key,logoUrl:r.logo_url||void 0,accentColor:r.accent_color||void 0,showWalletLoginFirst:r.show_wallet_login_first,allowlistConfig:{errorTitle:r.allowlist_config.error_title,errorDetail:r.allowlist_config.error_detail,errorCtaText:r.allowlist_config.cta_text,errorCtaLink:r.allowlist_config.cta_link},walletAuth:r.wallet_auth,emailAuth:r.email_auth,smsAuth:r.sms_auth,googleOAuth:r.google_oauth,twitterOAuth:r.twitter_oauth,discordOAuth:r.discord_oauth,githubOAuth:r.github_oauth,spotifyOAuth:r.spotify_oauth,instagramOAuth:r.instagram_oauth,tiktokOAuth:r.tiktok_oauth,linkedinOAuth:r.linkedin_oauth,appleOAuth:r.apple_oauth,farcasterAuth:r.farcaster_auth,passkeyAuth:r.passkey_auth,telegramAuth:r.telegram_auth,termsAndConditionsUrl:r.terms_and_conditions_url,embeddedWalletConfig:{createOnLogin:r.embedded_wallet_config?.create_on_login,userOwnedRecoveryOptions:r.embedded_wallet_config.user_owned_recovery_options,requireUserOwnedRecoveryOnCreate:r.embedded_wallet_config.require_user_owned_recovery_on_create},privacyPolicyUrl:r.privacy_policy_url,requireUsersAcceptTerms:r.require_users_accept_terms,customApiUrl:r.custom_api_url,walletConnectCloudProjectId:r.wallet_connect_cloud_project_id,fiatOnRampEnabled:r.fiat_on_ramp_enabled,captchaEnabled:r.captcha_enabled,captchaSiteKey:r.captcha_site_key,createdAt:new Date(1e3*r.created_at),updatedAt:new Date(1e3*r.updated_at),mfaMethods:r.mfa_methods,enforceWalletUis:r.enforce_wallet_uis,legacyWalletUiConfig:r.legacy_wallet_ui_config,telegramAuthConfiguration:n,fundingConfig:i}}catch(e){throw o.formatPrivyError(e)}}async getUsdTokenPrice(e){try{return(await this.api.get(`/api/v1/token_price?chainId=${e.id}&tokenSymbol=${e.nativeCurrency.symbol}`)).usd}catch(t){return void console.error(`Unable to fetch token price for chain with id ${e.id}`)}}async getUsdPriceForSol(){try{return(await this.api.get("/api/v1/token_price?chainId=0&tokenSymbol=SOL")).usd}catch(e){return void console.error("Unable to fetch token price for SOL")}}async requestFarcasterSignerStatus(e){try{return await this.api.post("/api/v1/farcaster/signer/status",{ed25519_public_key:e})}catch(e){throw console.error("Unable to fetch Farcaster signer status"),e}}async forkSession(){return await this.session.forkSession()}async generateSiweNonce({address:e,captchaToken:t}){try{return(await this.api.post("/api/v1/siwe/init",{address:e,token:t})).nonce}catch(e){throw o.formatPrivyError(e)}}async authenticateWithSiweInternal({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i,mode:a}){return await this.api.post("/api/v1/siwe/authenticate",{message:e,signature:t,chainId:r,walletClientType:n,connectorType:i,mode:a})}async linkWithSiweInternal({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i}){return await this.api.post("/api/v1/siwe/link",{message:e,signature:t,chainId:r,walletClientType:n,connectorType:i})}async linkSmartWallet({message:e,signature:t,smartWalletType:r}){try{let n=await this.api.post("/api/v1/siwe/link_smart_wallet",{message:e,signature:t,smart_wallet_type:r});return u.convertUserResponseToUser(n)}catch(e){throw o.formatPrivyError(e)}}async linkWithSiwe({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i}){try{let a=await this.linkWithSiweInternal({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i});return u.convertUserResponseToUser(a)}catch(e){throw o.formatPrivyError(e)}}async generateSiwsNonce({address:e,captchaToken:t}){try{return(await this.api.post("/api/v1/siws/init",{address:e,token:t})).nonce}catch(e){throw o.formatPrivyError(e)}}async authenticateWithSiwsInternal({message:e,signature:t,walletClientType:r,connectorType:n,mode:i}){return await this.api.post("/api/v1/siws/authenticate",{message:e,signature:t,walletClientType:r,connectorType:n,mode:i})}async sendAccountTransferRequest({nonce:e,account:t,accountType:r,externalWalletMetadata:n,telegramAuthResult:i,farcasterEmbeddedAddress:a,oAuthUserInfo:s}){try{let o,l;switch(r){case"email":o="/api/v1/passwordless/transfer",l={nonce:e,email:t};break;case"sms":o="/api/v1/passwordless_sms/transfer",l={nonce:e,phoneNumber:t};break;case"siwe":if(o="/api/v1/siwe/transfer",!n)throw Error("Wallet parameters must be defined");l={nonce:e,address:t,...n};break;case"farcaster":o="/api/v1/farcaster/transfer",l={nonce:e,farcaster_id:t,farcaster_embedded_address:a};break;case"telegram":o="/api/v1/telegram/transfer",l={nonce:e,telegram_auth_result:i};break;case"custom":case"guest":case"passkey":throw Error("Invalid transfer account type");default:o="/api/v1/oauth/transfer",l={nonce:e,userInfo:s}}let d=await this.api.post(o,l);return await this.getAuthenticatedUser()??u.convertUserResponseToUser(d)}catch(e){throw o.formatPrivyError(e)}}async linkWithSiwsInternal({message:e,signature:t,walletClientType:r,connectorType:n}){return await this.api.post("/api/v1/siws/link",{message:e,signature:t,walletClientType:r,connectorType:n})}async linkWithSiws({message:e,signature:t,walletClientType:r,connectorType:n}){try{let i=await this.linkWithSiwsInternal({message:e,signature:t,walletClientType:r,connectorType:n});return u.convertUserResponseToUser(i)}catch(e){throw o.formatPrivyError(e)}}constructor(e){Object.defineProperty(this,mo,{value:go}),this.apiUrl=e.apiUrl||l.DEFAULT_PRIVY_API_URL,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!!e.apiUrl&&e.apiUrl.startsWith("https://privy."),this.timeout=e.timeout||l.DEFAULT_API_TIMEOUT_MS,this.appId=e.appId,this.appClientId=e.appClientId,this.clientAnalyticsId=function(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}(this,mo)[mo](),po||(po=new ho),this.session=po,this.api=this.generateApi(),this.session.client=this}}function go(){if("undefined"==typeof window)return null;try{let e=d.e5.get(l.CLIENT_ANALYTICS_ID_KEY);if("string"==typeof e&&e.length>0)return e}catch(e){}let e=c.v4();try{return d.e5.put(l.CLIENT_ANALYTICS_ID_KEY,e),e}catch(t){return e}}const vo=t=>{let{enabled:r,siteKey:n,appId:a,setError:o,setToken:s,setExecuting:l,ref:d}=ba(),[,c]=i.useMemo((()=>n?.split("t:")||[]),[n]);if(i.useEffect((()=>d.current?.remove),[]),!r)return null;if(!c)throw Error("Unsupported captcha site key");return e.jsx("div",{className:"hidden h-0 w-0",children:e.jsx(x.Turnstile,{...t,ref:d,siteKey:c,options:{action:a,size:"invisible",...t.delayedExecution?{appearance:"execute",execution:"execute"}:{appearance:"always",execution:"render"}},onUnsupported:()=>{t.onUnsupported?.(),console.warn("Browser does not support Turnstile.")},onError:()=>{t.onError?.(),o("Captcha failed"),l(!1)},onSuccess:e=>{t.onSuccess?.(e),s(e),l(!1)},onExpire:()=>{t.onExpire?.();try{d.current?.reset(),o(void 0),s(void 0)}catch(e){o("expired_and_failed_reset")}}})})};function wo(e){d.usePrivyEventSubscription("configureMfa",e)}const xo=({success:t,fail:r})=>e.jsxs(e.Fragment,{children:[e.jsx(Co,{className:t?"success":r?"fail":""}),e.jsx(Eo,{className:t?"success":r?"fail":""})]}),Co=C.styled.span`
|
|
2
2
|
&& {
|
|
3
3
|
width: 82px;
|
|
4
4
|
height: 82px;
|
|
@@ -925,7 +925,7 @@
|
|
|
925
925
|
justify-content: center;
|
|
926
926
|
gap: 24px;
|
|
927
927
|
width: 100%;
|
|
928
|
-
`;const El=({icon:t,name:r})=>"string"==typeof t?e.jsx("img",{alt:`${r||"wallet"} logo`,src:t,style:{height:24,width:24,borderRadius:4}}):t?e.jsx(t,{}):null,bl={coinbase_wallet:{logo:ba,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},coinbase_smart_wallet:{logo:ba,displayName:"Coinbase Smart Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:Da,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:Wa,displayName:"Phantom"},rainbow:{logo:({style:t,...r})=>e.jsxs("svg",{width:"120",height:"120",viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...t},...r,children:[e.jsx("g",{clipPath:"url(#clip0_5_32)",children:e.jsxs("g",{clipPath:"url(#clip1_5_32)",children:[e.jsx("mask",{id:"mask0_5_32",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:e.jsx("path",{d:"M78.163 0H41.837C29.79 0 23.767 0 17.283 2.04999C10.203 4.62701 4.627 10.203 2.05 17.283C0 23.767 0 29.791 0 41.837V78.163C0 90.21 0 96.232 2.05 102.717C4.627 109.797 10.203 115.373 17.283 117.949C23.767 120 29.79 120 41.837 120H78.163C90.21 120 96.232 120 102.717 117.949C109.797 115.373 115.373 109.797 117.95 102.717C120 96.232 120 90.21 120 78.163V41.837C120 29.791 120 23.767 117.95 17.283C115.373 10.203 109.797 4.62701 102.717 2.04999C96.232 0 90.21 0 78.163 0Z",fill:"black"})}),e.jsx("g",{mask:"url(#mask0_5_32)",children:e.jsx("rect",{width:"120",height:"120",fill:"url(#paint0_linear_5_32)"})}),e.jsx("path",{d:"M20 38H26C56.9279 38 82 63.0721 82 94V100H94C97.3137 100 100 97.3137 100 94C100 53.1309 66.8691 20 26 20C22.6863 20 20 22.6863 20 26V38Z",fill:"url(#paint1_radial_5_32)"}),e.jsx("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_5_32)"}),e.jsx("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_5_32)"}),e.jsx("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_5_32)"}),e.jsx("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_5_32)"}),e.jsx("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_5_32)"}),e.jsx("path",{d:"M20 62C20 65.3137 22.6863 68 26 68C40.3594 68 52 79.6406 52 94C52 97.3137 54.6863 100 58 100H68V94C68 70.804 49.196 52 26 52H20V62Z",fill:"url(#paint7_radial_5_32)"}),e.jsx("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_5_32)"}),e.jsx("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z",fill:"url(#paint9_radial_5_32)"})]})}),e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"paint0_linear_5_32",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#174299"}),e.jsx("stop",{offset:"1",stopColor:"#001E59"})]}),e.jsxs("radialGradient",{id:"paint1_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[e.jsx("stop",{offset:"0.770277",stopColor:"#FF4000"}),e.jsx("stop",{offset:"1",stopColor:"#8754C9"})]}),e.jsxs("linearGradient",{id:"paint2_linear_5_32",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#FF4000"}),e.jsx("stop",{offset:"1",stopColor:"#8754C9"})]}),e.jsxs("linearGradient",{id:"paint3_linear_5_32",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#8754C9"}),e.jsx("stop",{offset:"1",stopColor:"#FF4000"})]}),e.jsxs("radialGradient",{id:"paint4_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[e.jsx("stop",{offset:"0.723929",stopColor:"#FFF700"}),e.jsx("stop",{offset:"1",stopColor:"#FF9901"})]}),e.jsxs("linearGradient",{id:"paint5_linear_5_32",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#FFF700"}),e.jsx("stop",{offset:"1",stopColor:"#FF9901"})]}),e.jsxs("linearGradient",{id:"paint6_linear_5_32",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#FFF700"}),e.jsx("stop",{offset:"1",stopColor:"#FF9901"})]}),e.jsxs("radialGradient",{id:"paint7_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[e.jsx("stop",{offset:"0.59513",stopColor:"#00AAFF"}),e.jsx("stop",{offset:"1",stopColor:"#01DA40"})]}),e.jsxs("radialGradient",{id:"paint8_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[e.jsx("stop",{stopColor:"#00AAFF"}),e.jsx("stop",{offset:"1",stopColor:"#01DA40"})]}),e.jsxs("radialGradient",{id:"paint9_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(23 69) rotate(-90) scale(17 322.37)",children:[e.jsx("stop",{stopColor:"#00AAFF"}),e.jsx("stop",{offset:"1",stopColor:"#01DA40"})]}),e.jsx("clipPath",{id:"clip0_5_32",children:e.jsx("rect",{width:"120",height:"120",fill:"white"})}),e.jsx("clipPath",{id:"clip1_5_32",children:e.jsx("rect",{width:"120",height:"120",fill:"white"})})]})]}),displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:Za,displayName:"WalletConnect"},zerion:{logo:({style:t,...r})=>e.jsxs("svg",{width:"176",height:"176",viewBox:"0 0 176 176",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...t},...r,children:[e.jsxs("g",{clipPath:"url(#clip0_1704_1423)",children:[e.jsx("path",{d:"M126.233 176H49.7672C22.287 176 0 153.723 0 126.233V49.7673C0 22.287 22.2769 0 49.7672 0H126.233C153.713 0 176 22.277 176 49.7673V126.233C176 153.723 153.713 176 126.233 176Z",fill:"#2461ED"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M100.667 85.6591C83.4133 76.3353 62.4196 64.2443 46.6192 54.3891C41.9573 51.0306 44.3234 43.9023 49.9578 43.9023H128.138C132.499 43.9023 135.416 48.7648 133.231 52.4442C127.977 61.5174 120.308 73.0368 113.901 82.1702C110.462 87.0727 104.858 87.9149 100.667 85.6591ZM75.5031 88.6867C92.1858 97.5795 115.566 111.104 132.178 121.33C137.311 124.498 135.266 132.098 129.271 132.098C119.46 132.098 103.518 132.1 87.6592 132.103C71.9639 132.105 56.3497 132.108 46.8398 132.108C42.0476 132.108 39.5913 127.135 41.6265 123.666C48.5041 111.946 56.2338 100.116 62.6603 91.2834C65.5176 87.3433 71.3325 86.461 75.5031 88.6867Z",fill:"white"})]}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0_1704_1423",children:e.jsx("rect",{width:"176",height:"176",fill:"white"})})})]}),displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:({...t})=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...t,children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"brave-linear-gradient",x1:"-18.79",y1:"359.73",x2:"194.32",y2:"359.73",gradientTransform:"matrix(2.05, 0, 0, -2.05, 38.49, 992.77)",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{offset:"0",stopColor:"#f1562b"}),e.jsx("stop",{offset:"0.3",stopColor:"#f1542b"}),e.jsx("stop",{offset:"0.41",stopColor:"#f04d2a"}),e.jsx("stop",{offset:"0.49",stopColor:"#ef4229"}),e.jsx("stop",{offset:"0.5",stopColor:"#ef4029"}),e.jsx("stop",{offset:"0.56",stopColor:"#e83e28"}),e.jsx("stop",{offset:"0.67",stopColor:"#e13c26"}),e.jsx("stop",{offset:"1",stopColor:"#df3c26"})]})}),e.jsx("path",{style:{fill:"url(#brave-linear-gradient)"},d:"M436.49,165.63,420.7,122.75l11-24.6A8.47,8.47,0,0,0,430,88.78L400.11,58.6a48.16,48.16,0,0,0-50.23-11.66l-8.19,2.89L296.09.43,218.25,0,140.4.61,94.85,50.41l-8.11-2.87A48.33,48.33,0,0,0,36.19,59.3L5.62,90.05a6.73,6.73,0,0,0-1.36,7.47l11.47,25.56L0,165.92,56.47,380.64a89.7,89.7,0,0,0,34.7,50.23l111.68,75.69a24.73,24.73,0,0,0,30.89,0l111.62-75.8A88.86,88.86,0,0,0,380,380.53l46.07-176.14Z"}),e.jsx("path",{style:{fill:"#fff"},d:"M231,317.33a65.61,65.61,0,0,0-9.11-3.3h-5.49a66.08,66.08,0,0,0-9.11,3.3l-13.81,5.74-15.6,7.18-25.4,13.24a4.84,4.84,0,0,0-.62,9l22.06,15.49q7,5,13.55,10.76l6.21,5.35,13,11.37,5.89,5.2a10.15,10.15,0,0,0,12.95,0l25.39-22.18,13.6-10.77,22.06-15.79a4.8,4.8,0,0,0-.68-8.93l-25.36-12.8L244.84,323ZM387.4,175.2l.8-2.3a61.26,61.26,0,0,0-.57-9.18,73.51,73.51,0,0,0-8.19-15.44l-14.35-21.06-10.22-13.88-19.23-24a69.65,69.65,0,0,0-5.7-6.67h-.4L321,84.25l-42.27,8.14a33.49,33.49,0,0,1-12.59-1.84l-23.21-7.5-16.61-4.59a70.52,70.52,0,0,0-14.67,0L195,83.1l-23.21,7.54a33.89,33.89,0,0,1-12.59,1.84l-42.22-8-8.54-1.58h-.4a65.79,65.79,0,0,0-5.7,6.67l-19.2,24Q77.81,120.32,73,127.45L58.61,148.51l-6.78,11.31a51,51,0,0,0-1.94,13.35l.8,2.3A34.51,34.51,0,0,0,52,179.81l11.33,13,50.23,53.39a14.31,14.31,0,0,1,2.55,14.34L107.68,280a25.23,25.23,0,0,0-.39,16l1.64,4.52a43.58,43.58,0,0,0,13.39,18.76l7.89,6.43a15,15,0,0,0,14.35,1.72L172.62,314A70.38,70.38,0,0,0,187,304.52l22.46-20.27a9,9,0,0,0,3-6.36,9.08,9.08,0,0,0-2.5-6.56L159.2,237.18a9.83,9.83,0,0,1-3.09-12.45l19.66-36.95a19.21,19.21,0,0,0,1-14.67A22.37,22.37,0,0,0,165.58,163L103.94,139.8c-4.44-1.6-4.2-3.6.51-3.88l36.2-3.59a55.9,55.9,0,0,1,16.9,1.5l31.5,8.8a9.64,9.64,0,0,1,6.74,10.76L183.42,221a34.72,34.72,0,0,0-.61,11.41c.5,1.61,4.73,3.6,9.36,4.73l19.19,4a46.38,46.38,0,0,0,16.86,0l17.26-4c4.64-1,8.82-3.23,9.35-4.85a34.94,34.94,0,0,0-.63-11.4l-12.45-67.59a9.66,9.66,0,0,1,6.74-10.76l31.5-8.83a55.87,55.87,0,0,1,16.9-1.5l36.2,3.37c4.74.44,5,2.2.54,3.88L272,162.79a22.08,22.08,0,0,0-11.16,10.12,19.3,19.3,0,0,0,1,14.67l19.69,36.95A9.84,9.84,0,0,1,278.45,237l-50.66,34.23a9,9,0,0,0,.32,12.78l.15.14,22.49,20.27a71.46,71.46,0,0,0,14.35,9.47l28.06,13.35a14.89,14.89,0,0,0,14.34-1.76l7.9-6.45a43.53,43.53,0,0,0,13.38-18.8l1.65-4.52a25.27,25.27,0,0,0-.39-16l-8.26-19.49a14.4,14.4,0,0,1,2.55-14.35l50.23-53.45,11.3-13a35.8,35.8,0,0,0,1.54-4.24Z"})]}),displayName:"Brave Wallet",rdns:"com.brave.wallet"},cryptocom:{logo:({style:t,...r})=>e.jsxs("svg",{width:"400",height:"400",viewBox:"0 0 400 400",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...t},...r,children:[e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"}),e.jsx("mask",{id:"mask0_16909_31415",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"400",height:"400",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"})}),e.jsxs("g",{mask:"url(#mask0_16909_31415)",children:[e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501Z",fill:"#FEFEFE"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501ZM144.359 109.116H254.873L268.197 164.788H131.538L144.359 109.116ZM176.201 204.291L164.148 173.197H235.711L223.913 204.291L227.339 239.028L199.804 239.154H172.522L176.201 204.291ZM211.354 275.892V264.862L236.093 241.414V204.417L268.451 183.607L305.376 211.066L255.119 297.589H235.203L211.354 275.892ZM94.2395 211.066L131.282 183.857L164.021 204.417V241.414L188.76 264.862V275.892L164.913 297.84H144.734L94.2395 211.066Z",fill:"#002D72"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M255.12 297.589H235.202L211.355 275.892V264.862L236.094 241.414V204.417L268.45 183.607L305.377 211.066L255.12 297.589ZM199.803 39.8498V109.117H254.872L268.198 164.789H199.803V173.199H235.712L223.914 204.291L227.338 239.028L199.803 239.153V360.296L340.231 280.181V119.957L199.803 39.8498Z",fill:"url(#paint0_linear_16909_31415)",style:{mixBlendMode:"multiply"}}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M188.761 275.892L164.912 297.84H144.734L94.2389 211.066L131.283 183.858L164.022 204.417V241.414L188.761 264.862V275.892ZM172.522 239.153L176.2 204.291L164.149 173.199H199.803V164.789H131.537L144.36 109.117H199.803V39.8498L59.375 119.957V280.181L199.803 360.296V239.153H172.522Z",fill:"url(#paint1_linear_16909_31415)",style:{mixBlendMode:"multiply"}})]}),e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"paint0_linear_16909_31415",x1:"325.255",y1:"325.727",x2:"325.255",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#002D72"}),e.jsx("stop",{offset:"1",stopColor:"#002D72",stopOpacity:"0.01"})]}),e.jsxs("linearGradient",{id:"paint1_linear_16909_31415",x1:"184.827",y1:"325.727",x2:"184.827",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#002D72",stopOpacity:"0.01"}),e.jsx("stop",{offset:"1",stopColor:"#002D72"})]})]})]}),displayName:"Crypto.com DeFi Wallet",rdns:"com.crypto.wallet"},uniswap:{logo:({style:t,...r})=>e.jsxs("svg",{width:"96",height:"96",viewBox:"0 0 96 96",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...t},...r,children:[e.jsx("rect",{width:"96",height:"96",rx:"18",fill:"#FEF4FF"}),e.jsxs("g",{children:[e.jsx("path",{d:"M71.9367 18.39C72.0482 16.4526 72.3145 15.1746 72.8497 14.0075C73.0616 13.5456 73.2601 13.1675 73.2907 13.1675C73.3214 13.1675 73.2293 13.5085 73.086 13.9252C72.6969 15.0578 72.633 16.607 72.901 18.4094C73.2413 20.6963 73.4348 21.0263 75.8841 23.4967C77.0329 24.6554 78.3692 26.1168 78.8536 26.7443L79.7343 27.8851L78.8536 27.0698C77.7764 26.0728 75.2992 24.1283 74.7521 23.8503C74.3852 23.6639 74.3306 23.6671 74.1043 23.8894C73.8958 24.0943 73.8519 24.4021 73.8229 25.8572C73.7778 28.125 73.4646 29.5807 72.7087 31.0362C72.2998 31.8234 72.2354 31.6554 72.6053 30.7668C72.8816 30.1034 72.9096 29.8117 72.9076 27.6163C72.9033 23.2052 72.3727 22.1447 69.2607 20.3281C68.4724 19.8678 67.1734 19.2041 66.3742 18.8531C65.575 18.502 64.9401 18.1962 64.9633 18.1734C65.0514 18.0868 68.0863 18.961 69.3077 19.4247C71.1247 20.1145 71.4247 20.2039 71.6454 20.1207C71.7933 20.0649 71.8648 19.6398 71.9367 18.39Z",fill:"#F50DB4"}),e.jsx("path",{d:"M33.5466 11.9727C32.4688 11.808 32.4233 11.7887 32.9306 11.7119C33.9026 11.5647 36.1979 11.7653 37.7796 12.1358C41.4722 13.0004 44.8322 15.2153 48.4188 19.1488L49.3717 20.1938L50.7348 19.978C56.4773 19.0689 62.3192 19.7914 67.2054 22.0148C68.5495 22.6265 70.6689 23.8441 70.9337 24.157C71.018 24.2568 71.173 24.8987 71.2779 25.5837C71.6408 27.9534 71.4591 29.7699 70.7234 31.1265C70.3229 31.8648 70.3006 32.0988 70.5698 32.7306C70.7847 33.2348 71.3838 33.608 71.9771 33.6072C73.1913 33.6056 74.4983 31.6721 75.1038 28.9818L75.3443 27.9131L75.8209 28.4448C78.4346 31.3619 80.4876 35.34 80.8403 38.1716L80.9321 38.9099L80.4928 38.2387C79.7366 37.0838 78.9769 36.2976 78.0041 35.6635C76.2504 34.5205 74.3961 34.1315 69.4853 33.8766C65.0501 33.6464 62.5399 33.2732 60.0509 32.4737C55.816 31.1137 53.6812 29.3023 48.6508 22.8012C46.4164 19.9135 45.0354 18.3159 43.6616 17.0293C40.5401 14.1058 37.4729 12.5726 33.5466 11.9727Z",fill:"#F50DB4"}),e.jsx("path",{d:"M35.6404 25.9564C33.4522 22.9889 32.0983 18.4391 32.3914 15.0379L32.482 13.9854L32.9801 14.0749C33.9155 14.243 35.5283 14.8343 36.2835 15.2861C38.3559 16.5259 39.253 18.1582 40.1658 22.3496C40.4332 23.5773 40.7839 24.9666 40.9454 25.437C41.2052 26.194 42.1871 27.9624 42.9854 29.1109C43.5605 29.938 43.1785 30.33 41.9074 30.217C39.9662 30.0444 37.3367 28.2568 35.6404 25.9564Z",fill:"#F50DB4"}),e.jsx("path",{d:"M69.2799 48.0419C59.0538 43.9862 55.4521 40.4658 55.4521 34.5259C55.4521 33.6517 55.4827 32.9365 55.5199 32.9365C55.5572 32.9365 55.9528 33.225 56.3991 33.5776C58.4728 35.216 60.7949 35.9157 67.2233 36.8395C71.0061 37.3831 73.1349 37.8222 75.0986 38.4637C81.3402 40.5027 85.2018 44.6406 86.1227 50.2766C86.3903 51.9143 86.2334 54.9854 85.7995 56.6039C85.457 57.8824 84.4118 60.1868 84.1346 60.2751C84.0578 60.2996 83.9824 60.0094 83.9626 59.6147C83.8575 57.4983 82.7718 55.438 80.9485 53.8946C78.8754 52.1399 76.0901 50.7428 69.2799 48.0419Z",fill:"#F50DB4"}),e.jsx("path",{d:"M62.1008 49.7268C61.9727 48.9758 61.7505 48.0167 61.607 47.5954L61.3461 46.8296L61.8307 47.3655C62.5014 48.107 63.0314 49.0559 63.4806 50.3197C63.8234 51.2843 63.862 51.5711 63.8594 53.1386C63.8568 54.6774 63.814 55 63.4974 55.8682C62.9983 57.2373 62.3788 58.208 61.3392 59.2501C59.4712 61.1228 57.0696 62.1596 53.6039 62.5896C53.0015 62.6643 51.2456 62.7902 49.7019 62.8693C45.8118 63.0686 43.2515 63.4803 40.9508 64.276C40.6201 64.3905 40.3247 64.4601 40.2948 64.4305C40.2017 64.3393 41.768 63.4195 43.0618 62.8056C44.8862 61.94 46.7021 61.4676 50.7709 60.8002C52.7809 60.4704 54.8566 60.0704 55.3837 59.9112C60.3612 58.4079 62.9197 54.5286 62.1008 49.7268Z",fill:"#F50DB4"}),e.jsx("path",{d:"M66.7886 57.9275C65.4299 55.0505 65.1179 52.2726 65.8623 49.6821C65.942 49.4053 66.07 49.1787 66.1471 49.1787C66.224 49.1787 66.5447 49.3495 66.8594 49.5581C67.4855 49.9732 68.7412 50.6725 72.0866 52.4692C76.2612 54.7111 78.6414 56.4472 80.2599 58.4306C81.6775 60.1677 82.5547 62.1459 82.9769 64.5583C83.2159 65.9248 83.0759 69.2128 82.7199 70.5889C81.5975 74.9275 78.9889 78.3356 75.2682 80.3242C74.7231 80.6155 74.2337 80.8547 74.1807 80.8558C74.1278 80.8569 74.3264 80.3594 74.6222 79.7503C75.8738 77.173 76.0163 74.6661 75.07 71.8756C74.4906 70.1671 73.3092 68.0823 70.924 64.5588C68.1507 60.4623 67.4708 59.3721 66.7886 57.9275Z",fill:"#F50DB4"}),e.jsx("path",{d:"M28.3782 73.4506C32.173 70.2943 36.8948 68.0521 41.1958 67.3639C43.0494 67.0672 46.1372 67.185 47.8537 67.6178C50.605 68.3113 53.0662 69.8648 54.3462 71.7156C55.5971 73.5245 56.1338 75.1008 56.6925 78.6081C56.913 79.9916 57.1527 81.3809 57.2252 81.6954C57.6449 83.5131 58.4614 84.966 59.4733 85.6957C61.0805 86.8544 63.8479 86.9265 66.5704 85.8804C67.0325 85.7028 67.4336 85.5801 67.4618 85.6078C67.5605 85.7044 66.1896 86.6083 65.2225 87.0842C63.9212 87.7245 62.8864 87.972 61.5115 87.972C59.0181 87.972 56.948 86.7226 55.2206 84.175C54.8807 83.6736 54.1167 82.1718 53.5228 80.8378C51.699 76.7403 50.7984 75.4921 48.6809 74.126C46.8381 72.9374 44.4615 72.7245 42.6736 73.588C40.325 74.7223 39.6698 77.6786 41.3518 79.5521C42.0204 80.2967 43.2671 80.939 44.2865 81.0638C46.1936 81.2975 47.8326 79.8684 47.8326 77.9717C47.8326 76.7402 47.352 76.0374 46.1423 75.4996C44.4901 74.7652 42.7141 75.6237 42.7226 77.1526C42.7263 77.8045 43.0145 78.214 43.6779 78.5097C44.1036 78.6994 44.1134 78.7144 43.7664 78.6434C42.2504 78.3337 41.8952 76.5335 43.1141 75.3383C44.5776 73.9036 47.6037 74.5367 48.6428 76.4951C49.0794 77.3177 49.1301 78.956 48.7495 79.9452C47.8976 82.1593 45.4138 83.3237 42.8941 82.6901C41.1787 82.2587 40.4801 81.7915 38.4119 79.6931C34.8179 76.0462 33.4226 75.3396 28.2413 74.5428L27.2484 74.3902L28.3782 73.4506Z",fill:"#F50DB4"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.5147 8.18128C23.517 22.5305 31.7835 28.4507 32.7022 29.7015C33.4607 30.7343 33.1752 31.6628 31.8758 32.3905C31.1532 32.7951 29.6676 33.205 28.9238 33.205C28.0825 33.205 27.7936 32.8853 27.7936 32.8853C27.3058 32.4296 27.0311 32.5093 24.5261 28.1293C21.0483 22.8137 18.1379 18.4041 18.0585 18.3303C17.8749 18.1596 17.878 18.1653 24.1715 29.2574C25.1883 31.5693 24.3737 32.4179 24.3737 32.7471C24.3737 33.417 24.1882 33.7691 23.3494 34.6907C21.951 36.2274 21.3259 37.954 20.8746 41.5274C20.3687 45.5332 18.9462 48.3629 15.0041 53.2057C12.6965 56.0406 12.3189 56.5602 11.7366 57.7028C11.0032 59.1416 10.8015 59.9475 10.7198 61.7645C10.6334 63.6855 10.8016 64.9265 11.3975 66.7632C11.9191 68.3712 12.4636 69.433 13.8555 71.5567C15.0568 73.3894 15.7484 74.7513 15.7484 75.2841C15.7484 75.708 15.8306 75.7085 17.692 75.2945C22.1466 74.3036 25.7638 72.5609 27.7981 70.4252C29.0571 69.1033 29.3527 68.3733 29.3623 66.5619C29.3686 65.377 29.3263 65.1289 29.0011 64.4473C28.4718 63.3379 27.5083 62.4154 25.3845 60.9853C22.6019 59.1115 21.4133 57.603 21.085 55.5285C20.8157 53.8263 21.1282 52.6253 22.6676 49.4472C24.2609 46.1575 24.6558 44.7557 24.9229 41.4399C25.0954 39.2977 25.3343 38.4528 25.9591 37.7747C26.6108 37.0676 27.1975 36.8281 28.8103 36.611C31.4396 36.2572 33.1139 35.5871 34.4901 34.3379C35.6839 33.2543 36.1835 32.2101 36.2602 30.6382L36.3184 29.4468L35.6512 28.6806C33.2352 25.9057 9.89667 6 9.74799 6C9.71623 6 10.5113 6.98164 11.5147 8.18128ZM17.1047 63.9381C17.6509 62.9852 17.3607 61.7601 16.447 61.1617C15.5836 60.5962 14.2424 60.8625 14.2424 61.5994C14.2424 61.8243 14.3687 61.9879 14.6532 62.1322C15.1322 62.375 15.167 62.648 14.7901 63.2061C14.4084 63.7712 14.4392 64.2681 14.877 64.6057C15.5826 65.15 16.5815 64.8507 17.1047 63.9381Z",fill:"#F50DB4"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M37.9777 37.236C36.7433 37.6095 35.5435 38.8981 35.172 40.2493C34.9454 41.0736 35.074 42.5196 35.4134 42.9662C35.9617 43.6874 36.492 43.8774 37.9277 43.8675C40.7388 43.8482 43.1825 42.6606 43.4666 41.176C43.6994 39.9591 42.6262 38.2726 41.1478 37.5321C40.385 37.1502 38.7626 36.9987 37.9777 37.236ZM41.2638 39.7671C41.6973 39.1604 41.5076 38.5047 40.7704 38.0611C39.3664 37.2167 37.2432 37.9155 37.2432 39.222C37.2432 39.8724 38.3504 40.5819 39.3653 40.5819C40.0408 40.5819 40.9652 40.1851 41.2638 39.7671Z",fill:"#F50DB4"})]})]}),displayName:"Uniswap Wallet",rdns:"org.uniswap.app"},okx_wallet:{displayName:"OKX Wallet",rdns:"com.okex.wallet",logo:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJDSURBVHgB7Zq9jtpAEMfHlhEgQLiioXEkoAGECwoKxMcTRHmC5E3IoyRPkPAEkI7unJYmTgEFTYwA8a3NTKScLnCHN6c9r1e3P2llWQy7M/s1Gv1twCP0ej37dDq9x+Zut1t3t9vZjDEHIiSRSPg4ZpDL5fxkMvn1cDh8m0wmfugfO53OoFQq/crn8wxfY9EymQyrVCqMfHvScZx1p9ls3pFxXBy/bKlUipGPrVbLuQqAfsCliq3zl0H84zwtjQrOw4Mt1W63P5LvBm2d+Xz+YzqdgkqUy+WgWCy+Mc/nc282m4FqLBYL+3g8fjDxenq72WxANZbLJeA13zDX67UDioL5ybXwafMYu64Ltn3bdDweQ5R97fd7GyhBQMipx4POeEDHIu2LfDdBIGGz+hJ9CQ1ABjoA2egAZPM6AgiCAEQhsi/C4jHyPA/6/f5NG3Ks2+3CYDC4aTccDrn6ojG54MnEvG00GoVmWLIRNZ7wTCwDHYBsdACy0QHIhiuRETxlICWpMMhGZHmqS8qH6JLyGegAZKMDkI0uKf8X4SWlaZo+Pp1bRrwlJU8ZKLIvUjKh0WiQ3sRUbNVq9c5Ebew7KEo2m/1p4jJ4qAmDaqDQBzj5XyiAT4VCQezJigAU+IDU+z8vJFnGWeC+bKQV/5VZ71FV6L7PA3gg3tXrdQ+DgLhC+75Wq3no69P3MC0NFQpx2lL04Ql9gHK1bRDjsSBIvScBnDTk1WrlGIZBorIDEYJj+rhdgnQ67VmWRe0zlplXl81vcyEt0rSoYDUAAAAASUVORK5CYII="},rabby_wallet:{logo:t=>e.jsxs("svg",{width:"52",height:"52",viewBox:"0 0 52 52",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[e.jsx("rect",{width:"52",height:"52",rx:"26",fill:"#7084FF"}),e.jsx("path",{d:"M43.6781 28.2954C45.1053 25.0988 38.0498 16.168 31.3094 12.4472C27.0608 9.56481 22.6337 9.96081 21.737 11.2264C19.7693 14.0039 28.2527 16.3574 33.9263 19.1037C32.7067 19.6348 31.5574 20.5879 30.8816 21.8067C28.7664 19.4915 24.1239 17.4977 18.6765 19.1037C15.0056 20.186 11.9547 22.7374 10.7756 26.5911C10.4891 26.4635 10.1719 26.3925 9.83814 26.3925C8.56192 26.3925 7.52734 27.4298 7.52734 28.7094C7.52734 29.989 8.56192 31.0263 9.83814 31.0263C10.0747 31.0263 10.8143 30.8672 10.8143 30.8672L22.6337 30.953C17.9068 38.4713 14.1713 39.5704 14.1713 40.8729C14.1713 42.1754 17.7455 41.8224 19.0876 41.3369C25.5121 39.0127 32.4123 31.7692 33.5964 29.6841C38.5688 30.3061 42.7476 30.3796 43.6781 28.2954Z",fill:"url(#paint0_linear_81034_11443)"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M33.8741 19.076C33.8926 19.084 33.911 19.092 33.9294 19.1001C34.1923 18.9962 34.1498 18.6068 34.0776 18.301C33.9116 17.5981 31.0479 14.7629 28.3588 13.493C24.6934 11.762 21.9946 11.8518 21.5972 12.65C22.3407 14.1849 25.8031 15.6258 29.4193 17.1308C30.9407 17.7639 32.4893 18.4084 33.8741 19.076Z",fill:"url(#paint1_linear_81034_11443)"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M29.272 34.5374C28.5323 34.2543 27.697 33.9945 26.7477 33.7587C27.7625 31.9382 27.9754 29.2432 27.0171 27.5392C25.6721 25.1478 23.9838 23.875 20.0605 23.875C17.9027 23.875 12.093 24.6037 11.9899 29.4663C11.9791 29.9743 11.9895 30.44 12.026 30.8685L22.6335 30.9456C21.2017 33.2229 19.8609 34.9113 18.6873 36.1947C20.0979 36.5571 21.2615 36.8612 22.3297 37.1404C23.3394 37.4043 24.2638 37.646 25.2309 37.8934C26.6941 36.8249 28.0698 35.6597 29.272 34.5374Z",fill:"url(#paint2_linear_81034_11443)"}),e.jsx("path",{d:"M10.6324 30.3712C11.0658 34.065 13.1596 35.5127 17.4381 35.9411C21.7166 36.3695 24.1708 36.0821 27.4381 36.3801C30.167 36.6291 32.6036 38.0233 33.5075 37.5415C34.321 37.1079 33.8659 35.5412 32.7774 34.5361C31.3663 33.2333 29.4135 32.3274 25.9773 32.006C26.6621 30.1261 26.4702 27.4903 25.4067 26.0562C23.8689 23.9827 21.0305 23.0453 17.4381 23.4549C13.6848 23.8828 10.0885 25.7354 10.6324 30.3712Z",fill:"url(#paint3_linear_81034_11443)"}),e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"paint0_linear_81034_11443",x1:"18.249",y1:"25.4646",x2:"43.3806",y2:"32.5728",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"white"}),e.jsx("stop",{offset:"1",stopColor:"white"})]}),e.jsxs("linearGradient",{id:"paint1_linear_81034_11443",x1:"39.1432",y1:"24.9813",x2:"20.9691",y2:"6.81008",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#8697FF"}),e.jsx("stop",{offset:"1",stopColor:"#8697FF",stopOpacity:"0"})]}),e.jsxs("linearGradient",{id:"paint2_linear_81034_11443",x1:"29.7761",y1:"35.1727",x2:"12.345",y2:"25.1792",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#8697FF"}),e.jsx("stop",{offset:"1",stopColor:"#8697FF",stopOpacity:"0"})]}),e.jsxs("linearGradient",{id:"paint3_linear_81034_11443",x1:"19.7472",y1:"25.2716",x2:"31.5549",y2:"40.2352",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"white"}),e.jsx("stop",{offset:"0.983895",stopColor:"#D1D8FF"})]})]})]}),displayName:"Rabby Wallet",rdns:"io.rabby.wallet"},safe:{displayName:"Safe",logo:({style:t,...r})=>e.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...t},...r,children:[e.jsx("rect",{width:"28",height:"28",rx:"3",fill:"#12FF80"}),e.jsx("path",{d:"M22.5151 13.9979H20.4244C19.7981 13.9979 19.2945 14.5058 19.2945 15.128V18.163C19.2945 18.7894 18.7866 19.2931 18.1645 19.2931H9.8398C9.21344 19.2931 8.70981 19.8011 8.70981 20.4233V22.5185C8.70981 23.145 9.21767 23.6487 9.8398 23.6487H18.6427C19.2691 23.6487 19.7642 23.1407 19.7642 22.5185V20.8423C19.7642 20.2159 20.2721 19.7757 20.8942 19.7757H22.5151C23.1415 19.7757 23.6451 19.2677 23.6451 18.6455V15.1196C23.6451 14.4889 23.1373 13.9979 22.5151 13.9979Z",fill:"black"}),e.jsx("path",{d:"M8.7098 9.84127C8.7098 9.21481 9.21766 8.71111 9.83978 8.71111H18.156C18.7823 8.71111 19.286 8.20317 19.286 7.58095V5.48995C19.286 4.86349 18.7781 4.35979 18.156 4.35979H9.35732C8.73096 4.35979 8.22733 4.86772 8.22733 5.48995V7.10264C8.22733 7.7291 7.71947 8.2328 7.09734 8.2328H5.48912C4.86276 8.2328 4.35913 8.74074 4.35913 9.36296V12.8931C4.35913 13.5196 4.86699 13.9979 5.49335 13.9979H7.58404C8.2104 13.9979 8.71403 13.4899 8.71403 12.8677L8.7098 9.84127Z",fill:"black"}),e.jsx("path",{d:"M13.0139 11.8011H15.0242C15.6802 11.8011 16.2092 12.3344 16.2092 12.9862V14.9968C16.2092 15.6529 15.6759 16.182 15.0242 16.182H13.0139C12.3579 16.182 11.8289 15.6487 11.8289 14.9968V12.9862C11.8289 12.3302 12.3621 11.8011 13.0139 11.8011Z",fill:"black"})]})},universal_profile:{displayName:"Universal Profile",logo:({style:t,...r})=>e.jsxs("svg",{fill:"none",height:"1024",width:"1024",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...t},...r,children:[e.jsxs("filter",{id:"a","color-interpolation-filters":"sRGB",filterUnits:"userSpaceOnUse",height:"1228",width:"1244",x:"-72",y:"-72",children:[e.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),e.jsx("feBlend",{in:"SourceGraphic",in2:"BackgroundImageFix",mode:"normal",result:"shape"}),e.jsx("feColorMatrix",{in:"SourceAlpha",result:"hardAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"}),e.jsx("feOffset",{dx:"-72",dy:"-72"}),e.jsx("feGaussianBlur",{stdDeviation:"54"}),e.jsx("feComposite",{in2:"hardAlpha",k2:"-1",k3:"1",operator:"arithmetic"}),e.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"}),e.jsx("feBlend",{in2:"shape",mode:"normal",result:"effect1_innerShadow_3981_20791"}),e.jsx("feColorMatrix",{in:"SourceAlpha",result:"hardAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"}),e.jsx("feOffset",{dx:"152",dy:"132"}),e.jsx("feGaussianBlur",{stdDeviation:"74"}),e.jsx("feComposite",{in2:"hardAlpha",k2:"-1",k3:"1",operator:"arithmetic"}),e.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.15 0"}),e.jsx("feBlend",{in2:"effect1_innerShadow_3981_20791",mode:"normal",result:"effect2_innerShadow_3981_20791"}),e.jsx("feColorMatrix",{in:"SourceAlpha",result:"hardAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"}),e.jsx("feOffset",{dx:"32",dy:"20"}),e.jsx("feGaussianBlur",{stdDeviation:"50"}),e.jsx("feComposite",{in2:"hardAlpha",k2:"-1",k3:"1",operator:"arithmetic"}),e.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.08 0"}),e.jsx("feBlend",{in2:"effect2_innerShadow_3981_20791",mode:"normal",result:"effect3_innerShadow_3981_20791"})]}),e.jsxs("filter",{id:"b","color-interpolation-filters":"sRGB",filterUnits:"userSpaceOnUse",height:"352",width:"747",x:"142",y:"352",children:[e.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),e.jsx("feBlend",{in:"SourceGraphic",in2:"BackgroundImageFix",mode:"normal",result:"shape"}),e.jsx("feColorMatrix",{in:"SourceAlpha",result:"hardAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"}),e.jsx("feOffset",{dx:"8",dy:"12"}),e.jsx("feGaussianBlur",{stdDeviation:"5"}),e.jsx("feComposite",{in2:"hardAlpha",k2:"-1",k3:"1",operator:"arithmetic"}),e.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0.120833 0 0 0 0 0.120833 0 0 0 0 0.120833 0 0 0 0.69 0"}),e.jsx("feBlend",{in2:"shape",mode:"normal",result:"effect1_innerShadow_3981_20791"})]}),e.jsxs("linearGradient",{id:"c",gradientUnits:"userSpaceOnUse",x1:"0",x2:"1024",y1:"0",y2:"1024",children:[e.jsx("stop",{offset:"0","stop-color":"#8992d1"}),e.jsx("stop",{offset:"1","stop-color":"#646c9f"})]}),e.jsx("clipPath",{id:"d",children:e.jsx("path",{d:"m0 0h1024v1024h-1024z"})}),e.jsxs("g",{"clip-path":"url(#d)",children:[e.jsx("g",{filter:"url(#a)",children:e.jsx("rect",{fill:"url(#c)",height:"1024",rx:"230",width:"1024"})}),e.jsxs("g",{fill:"#fff",filter:"url(#b)",children:[e.jsx("path",{d:"m212.459 354h-54.459c-8.837 0-16 7.163-16 16v203c0 66.826 54.174 121 121 121h44c66.826 0 121-54.174 121-121v-203c0-8.837-7.163-16-16-16h-56.548c-8.837 0-16 7.163-16 16v198.829c0 28.607-23.19 51.797-51.797 51.797-32.693 0-59.196-26.503-59.196-59.196v-191.43c0-8.837-7.163-16-16-16z"}),e.jsx("path",{d:"m868.426 352h-68.495c-6.98 0-12.487 5.934-11.967 12.895l14.206 190c.468 6.263 5.686 11.105 11.966 11.105h45.412c6.409 0 11.687-5.037 11.987-11.44l8.878-190c.32-6.84-5.14-12.56-11.987-12.56z"}),e.jsx("ellipse",{cx:"834",cy:"649.5",rx:"47",ry:"44.5"}),e.jsx("path",{"clip-rule":"evenodd",d:"m522 687h50c8.837 0 16-7.163 16-16v-80c0-8.837 7.163-16 16-16h33.5c61.58 0 111.5-49.92 111.5-111.5s-49.92-111.5-111.5-111.5h-115.5c-8.837 0-16 7.163-16 16v303c0 8.837 7.163 16 16 16zm70-252v58c0 6.627 5.373 12 12 12h14c20.987 0 38-17.013 38-38v-6c0-20.987-17.013-38-38-38h-14c-6.627 0-12 5.373-12 12z","fill-rule":"evenodd"})]})]})]})}},Sl=(e,t,r)=>bl[e]?.displayName?"coinbase_wallet"===e?bl[r].displayName:bl[e].displayName:"wallet_connect_v2"===t&&"wallet_connect"===e?"Wallet Connect":void 0,Al=(e,t,r)=>bl[e]?.logo?"coinbase_wallet"===e?bl[r].logo:bl[e].logo:"wallet_connect_v2"===t&&"wallet_connect"===e?Za:void 0;function jl(e){let t=e.toLowerCase();return!!window?.webkit?.messageHandlers?.ReactNativeWebView||!!window?.ReactNativeWebView||["fbav","fban","instagram","snapchat","linkedinapp"].some((e=>t.includes(e)))}const $l=({provider:t,displayName:r,logo:n,connectOnly:i,connector:s})=>{let{navigate:l}=g.usePrivyModal(),{connectWallet:c}=o.usePrivyInternal(),u=d.useRecentlyUsedLogin(),h="wallet_connect_v2"===s.connectorType?t:s.walletClientType,p=window.matchMedia("(display-mode: standalone)").matches;return e.jsxs(Tl,{onClick:"phantom"===s.connectorType||"solana_adapter"===s.connectorType&&"phantom"===s.walletClientType?()=>{d.isPhantomInstalled()||"solana"===s.chainType&&"isInstalled"in s&&s.isInstalled?(c(s,h),l(i?g.ModalScreen.AWAITING_CONNECT_ONLY_CONNECTION:g.ModalScreen.AWAITING_CONNECTION)):a.isMobile?l(g.ModalScreen.PHANTOM_INTERSTITIAL_SCREEN):l(g.ModalScreen.INSTALL_PHANTOM_SCREEN)}:"coinbase_wallet"!==s.connectorType||"eoaOnly"!==s.connectionOptions||!a.isMobile||p||d.isCoinbaseWalletInstalled()?()=>{(!jl(window.navigator.userAgent)||event?.isTrusted)&&(c(s,h),l(i?g.ModalScreen.AWAITING_CONNECT_ONLY_CONNECTION:g.ModalScreen.AWAITING_CONNECTION))}:()=>{window.location.href=`https://go.cb-w.com/dapp?cb_url=${encodeURI(window.location.href)}`},children:[e.jsx(El,{icon:Al(t,s.connectorType,s.walletClientType)??n,name:s.walletClientType}),e.jsx("span",{children:Sl(t,s.connectorType,s.walletClientType)||r||s.walletClientType}),e.jsxs(_l,{id:"chip-container",children:[u?.walletClientType===h&&u?.chainType===s.chainType?e.jsx(Pl,{color:"gray",children:"Recent"}):e.jsx("span",{id:"connect-text",children:"Connect"}),"solana_adapter"===s.connectorType&&e.jsx(Pl,{color:"gray",children:"Solana"})]})]})};let Tl=C.styled(ts)`
|
|
928
|
+
`;const El=({icon:t,name:r})=>"string"==typeof t?e.jsx("img",{alt:`${r||"wallet"} logo`,src:t,style:{height:24,width:24,borderRadius:4}}):t?e.jsx(t,{}):null,bl={coinbase_wallet:{logo:$a,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},coinbase_smart_wallet:{logo:$a,displayName:"Coinbase Smart Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:Ga,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:qa,displayName:"Phantom"},rainbow:{logo:({style:t,...r})=>e.jsxs("svg",{width:"120",height:"120",viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...t},...r,children:[e.jsx("g",{clipPath:"url(#clip0_5_32)",children:e.jsxs("g",{clipPath:"url(#clip1_5_32)",children:[e.jsx("mask",{id:"mask0_5_32",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:e.jsx("path",{d:"M78.163 0H41.837C29.79 0 23.767 0 17.283 2.04999C10.203 4.62701 4.627 10.203 2.05 17.283C0 23.767 0 29.791 0 41.837V78.163C0 90.21 0 96.232 2.05 102.717C4.627 109.797 10.203 115.373 17.283 117.949C23.767 120 29.79 120 41.837 120H78.163C90.21 120 96.232 120 102.717 117.949C109.797 115.373 115.373 109.797 117.95 102.717C120 96.232 120 90.21 120 78.163V41.837C120 29.791 120 23.767 117.95 17.283C115.373 10.203 109.797 4.62701 102.717 2.04999C96.232 0 90.21 0 78.163 0Z",fill:"black"})}),e.jsx("g",{mask:"url(#mask0_5_32)",children:e.jsx("rect",{width:"120",height:"120",fill:"url(#paint0_linear_5_32)"})}),e.jsx("path",{d:"M20 38H26C56.9279 38 82 63.0721 82 94V100H94C97.3137 100 100 97.3137 100 94C100 53.1309 66.8691 20 26 20C22.6863 20 20 22.6863 20 26V38Z",fill:"url(#paint1_radial_5_32)"}),e.jsx("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_5_32)"}),e.jsx("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_5_32)"}),e.jsx("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_5_32)"}),e.jsx("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_5_32)"}),e.jsx("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_5_32)"}),e.jsx("path",{d:"M20 62C20 65.3137 22.6863 68 26 68C40.3594 68 52 79.6406 52 94C52 97.3137 54.6863 100 58 100H68V94C68 70.804 49.196 52 26 52H20V62Z",fill:"url(#paint7_radial_5_32)"}),e.jsx("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_5_32)"}),e.jsx("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z",fill:"url(#paint9_radial_5_32)"})]})}),e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"paint0_linear_5_32",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#174299"}),e.jsx("stop",{offset:"1",stopColor:"#001E59"})]}),e.jsxs("radialGradient",{id:"paint1_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[e.jsx("stop",{offset:"0.770277",stopColor:"#FF4000"}),e.jsx("stop",{offset:"1",stopColor:"#8754C9"})]}),e.jsxs("linearGradient",{id:"paint2_linear_5_32",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#FF4000"}),e.jsx("stop",{offset:"1",stopColor:"#8754C9"})]}),e.jsxs("linearGradient",{id:"paint3_linear_5_32",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#8754C9"}),e.jsx("stop",{offset:"1",stopColor:"#FF4000"})]}),e.jsxs("radialGradient",{id:"paint4_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[e.jsx("stop",{offset:"0.723929",stopColor:"#FFF700"}),e.jsx("stop",{offset:"1",stopColor:"#FF9901"})]}),e.jsxs("linearGradient",{id:"paint5_linear_5_32",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#FFF700"}),e.jsx("stop",{offset:"1",stopColor:"#FF9901"})]}),e.jsxs("linearGradient",{id:"paint6_linear_5_32",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#FFF700"}),e.jsx("stop",{offset:"1",stopColor:"#FF9901"})]}),e.jsxs("radialGradient",{id:"paint7_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[e.jsx("stop",{offset:"0.59513",stopColor:"#00AAFF"}),e.jsx("stop",{offset:"1",stopColor:"#01DA40"})]}),e.jsxs("radialGradient",{id:"paint8_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[e.jsx("stop",{stopColor:"#00AAFF"}),e.jsx("stop",{offset:"1",stopColor:"#01DA40"})]}),e.jsxs("radialGradient",{id:"paint9_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(23 69) rotate(-90) scale(17 322.37)",children:[e.jsx("stop",{stopColor:"#00AAFF"}),e.jsx("stop",{offset:"1",stopColor:"#01DA40"})]}),e.jsx("clipPath",{id:"clip0_5_32",children:e.jsx("rect",{width:"120",height:"120",fill:"white"})}),e.jsx("clipPath",{id:"clip1_5_32",children:e.jsx("rect",{width:"120",height:"120",fill:"white"})})]})]}),displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:eo,displayName:"WalletConnect"},zerion:{logo:({style:t,...r})=>e.jsxs("svg",{width:"176",height:"176",viewBox:"0 0 176 176",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...t},...r,children:[e.jsxs("g",{clipPath:"url(#clip0_1704_1423)",children:[e.jsx("path",{d:"M126.233 176H49.7672C22.287 176 0 153.723 0 126.233V49.7673C0 22.287 22.2769 0 49.7672 0H126.233C153.713 0 176 22.277 176 49.7673V126.233C176 153.723 153.713 176 126.233 176Z",fill:"#2461ED"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M100.667 85.6591C83.4133 76.3353 62.4196 64.2443 46.6192 54.3891C41.9573 51.0306 44.3234 43.9023 49.9578 43.9023H128.138C132.499 43.9023 135.416 48.7648 133.231 52.4442C127.977 61.5174 120.308 73.0368 113.901 82.1702C110.462 87.0727 104.858 87.9149 100.667 85.6591ZM75.5031 88.6867C92.1858 97.5795 115.566 111.104 132.178 121.33C137.311 124.498 135.266 132.098 129.271 132.098C119.46 132.098 103.518 132.1 87.6592 132.103C71.9639 132.105 56.3497 132.108 46.8398 132.108C42.0476 132.108 39.5913 127.135 41.6265 123.666C48.5041 111.946 56.2338 100.116 62.6603 91.2834C65.5176 87.3433 71.3325 86.461 75.5031 88.6867Z",fill:"white"})]}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0_1704_1423",children:e.jsx("rect",{width:"176",height:"176",fill:"white"})})})]}),displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:({...t})=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...t,children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"brave-linear-gradient",x1:"-18.79",y1:"359.73",x2:"194.32",y2:"359.73",gradientTransform:"matrix(2.05, 0, 0, -2.05, 38.49, 992.77)",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{offset:"0",stopColor:"#f1562b"}),e.jsx("stop",{offset:"0.3",stopColor:"#f1542b"}),e.jsx("stop",{offset:"0.41",stopColor:"#f04d2a"}),e.jsx("stop",{offset:"0.49",stopColor:"#ef4229"}),e.jsx("stop",{offset:"0.5",stopColor:"#ef4029"}),e.jsx("stop",{offset:"0.56",stopColor:"#e83e28"}),e.jsx("stop",{offset:"0.67",stopColor:"#e13c26"}),e.jsx("stop",{offset:"1",stopColor:"#df3c26"})]})}),e.jsx("path",{style:{fill:"url(#brave-linear-gradient)"},d:"M436.49,165.63,420.7,122.75l11-24.6A8.47,8.47,0,0,0,430,88.78L400.11,58.6a48.16,48.16,0,0,0-50.23-11.66l-8.19,2.89L296.09.43,218.25,0,140.4.61,94.85,50.41l-8.11-2.87A48.33,48.33,0,0,0,36.19,59.3L5.62,90.05a6.73,6.73,0,0,0-1.36,7.47l11.47,25.56L0,165.92,56.47,380.64a89.7,89.7,0,0,0,34.7,50.23l111.68,75.69a24.73,24.73,0,0,0,30.89,0l111.62-75.8A88.86,88.86,0,0,0,380,380.53l46.07-176.14Z"}),e.jsx("path",{style:{fill:"#fff"},d:"M231,317.33a65.61,65.61,0,0,0-9.11-3.3h-5.49a66.08,66.08,0,0,0-9.11,3.3l-13.81,5.74-15.6,7.18-25.4,13.24a4.84,4.84,0,0,0-.62,9l22.06,15.49q7,5,13.55,10.76l6.21,5.35,13,11.37,5.89,5.2a10.15,10.15,0,0,0,12.95,0l25.39-22.18,13.6-10.77,22.06-15.79a4.8,4.8,0,0,0-.68-8.93l-25.36-12.8L244.84,323ZM387.4,175.2l.8-2.3a61.26,61.26,0,0,0-.57-9.18,73.51,73.51,0,0,0-8.19-15.44l-14.35-21.06-10.22-13.88-19.23-24a69.65,69.65,0,0,0-5.7-6.67h-.4L321,84.25l-42.27,8.14a33.49,33.49,0,0,1-12.59-1.84l-23.21-7.5-16.61-4.59a70.52,70.52,0,0,0-14.67,0L195,83.1l-23.21,7.54a33.89,33.89,0,0,1-12.59,1.84l-42.22-8-8.54-1.58h-.4a65.79,65.79,0,0,0-5.7,6.67l-19.2,24Q77.81,120.32,73,127.45L58.61,148.51l-6.78,11.31a51,51,0,0,0-1.94,13.35l.8,2.3A34.51,34.51,0,0,0,52,179.81l11.33,13,50.23,53.39a14.31,14.31,0,0,1,2.55,14.34L107.68,280a25.23,25.23,0,0,0-.39,16l1.64,4.52a43.58,43.58,0,0,0,13.39,18.76l7.89,6.43a15,15,0,0,0,14.35,1.72L172.62,314A70.38,70.38,0,0,0,187,304.52l22.46-20.27a9,9,0,0,0,3-6.36,9.08,9.08,0,0,0-2.5-6.56L159.2,237.18a9.83,9.83,0,0,1-3.09-12.45l19.66-36.95a19.21,19.21,0,0,0,1-14.67A22.37,22.37,0,0,0,165.58,163L103.94,139.8c-4.44-1.6-4.2-3.6.51-3.88l36.2-3.59a55.9,55.9,0,0,1,16.9,1.5l31.5,8.8a9.64,9.64,0,0,1,6.74,10.76L183.42,221a34.72,34.72,0,0,0-.61,11.41c.5,1.61,4.73,3.6,9.36,4.73l19.19,4a46.38,46.38,0,0,0,16.86,0l17.26-4c4.64-1,8.82-3.23,9.35-4.85a34.94,34.94,0,0,0-.63-11.4l-12.45-67.59a9.66,9.66,0,0,1,6.74-10.76l31.5-8.83a55.87,55.87,0,0,1,16.9-1.5l36.2,3.37c4.74.44,5,2.2.54,3.88L272,162.79a22.08,22.08,0,0,0-11.16,10.12,19.3,19.3,0,0,0,1,14.67l19.69,36.95A9.84,9.84,0,0,1,278.45,237l-50.66,34.23a9,9,0,0,0,.32,12.78l.15.14,22.49,20.27a71.46,71.46,0,0,0,14.35,9.47l28.06,13.35a14.89,14.89,0,0,0,14.34-1.76l7.9-6.45a43.53,43.53,0,0,0,13.38-18.8l1.65-4.52a25.27,25.27,0,0,0-.39-16l-8.26-19.49a14.4,14.4,0,0,1,2.55-14.35l50.23-53.45,11.3-13a35.8,35.8,0,0,0,1.54-4.24Z"})]}),displayName:"Brave Wallet",rdns:"com.brave.wallet"},cryptocom:{logo:({style:t,...r})=>e.jsxs("svg",{width:"400",height:"400",viewBox:"0 0 400 400",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...t},...r,children:[e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"}),e.jsx("mask",{id:"mask0_16909_31415",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"400",height:"400",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"})}),e.jsxs("g",{mask:"url(#mask0_16909_31415)",children:[e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501Z",fill:"#FEFEFE"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501ZM144.359 109.116H254.873L268.197 164.788H131.538L144.359 109.116ZM176.201 204.291L164.148 173.197H235.711L223.913 204.291L227.339 239.028L199.804 239.154H172.522L176.201 204.291ZM211.354 275.892V264.862L236.093 241.414V204.417L268.451 183.607L305.376 211.066L255.119 297.589H235.203L211.354 275.892ZM94.2395 211.066L131.282 183.857L164.021 204.417V241.414L188.76 264.862V275.892L164.913 297.84H144.734L94.2395 211.066Z",fill:"#002D72"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M255.12 297.589H235.202L211.355 275.892V264.862L236.094 241.414V204.417L268.45 183.607L305.377 211.066L255.12 297.589ZM199.803 39.8498V109.117H254.872L268.198 164.789H199.803V173.199H235.712L223.914 204.291L227.338 239.028L199.803 239.153V360.296L340.231 280.181V119.957L199.803 39.8498Z",fill:"url(#paint0_linear_16909_31415)",style:{mixBlendMode:"multiply"}}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M188.761 275.892L164.912 297.84H144.734L94.2389 211.066L131.283 183.858L164.022 204.417V241.414L188.761 264.862V275.892ZM172.522 239.153L176.2 204.291L164.149 173.199H199.803V164.789H131.537L144.36 109.117H199.803V39.8498L59.375 119.957V280.181L199.803 360.296V239.153H172.522Z",fill:"url(#paint1_linear_16909_31415)",style:{mixBlendMode:"multiply"}})]}),e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"paint0_linear_16909_31415",x1:"325.255",y1:"325.727",x2:"325.255",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#002D72"}),e.jsx("stop",{offset:"1",stopColor:"#002D72",stopOpacity:"0.01"})]}),e.jsxs("linearGradient",{id:"paint1_linear_16909_31415",x1:"184.827",y1:"325.727",x2:"184.827",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#002D72",stopOpacity:"0.01"}),e.jsx("stop",{offset:"1",stopColor:"#002D72"})]})]})]}),displayName:"Crypto.com DeFi Wallet",rdns:"com.crypto.wallet"},uniswap:{logo:({style:t,...r})=>e.jsxs("svg",{width:"96",height:"96",viewBox:"0 0 96 96",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...t},...r,children:[e.jsx("rect",{width:"96",height:"96",rx:"18",fill:"#FEF4FF"}),e.jsxs("g",{children:[e.jsx("path",{d:"M71.9367 18.39C72.0482 16.4526 72.3145 15.1746 72.8497 14.0075C73.0616 13.5456 73.2601 13.1675 73.2907 13.1675C73.3214 13.1675 73.2293 13.5085 73.086 13.9252C72.6969 15.0578 72.633 16.607 72.901 18.4094C73.2413 20.6963 73.4348 21.0263 75.8841 23.4967C77.0329 24.6554 78.3692 26.1168 78.8536 26.7443L79.7343 27.8851L78.8536 27.0698C77.7764 26.0728 75.2992 24.1283 74.7521 23.8503C74.3852 23.6639 74.3306 23.6671 74.1043 23.8894C73.8958 24.0943 73.8519 24.4021 73.8229 25.8572C73.7778 28.125 73.4646 29.5807 72.7087 31.0362C72.2998 31.8234 72.2354 31.6554 72.6053 30.7668C72.8816 30.1034 72.9096 29.8117 72.9076 27.6163C72.9033 23.2052 72.3727 22.1447 69.2607 20.3281C68.4724 19.8678 67.1734 19.2041 66.3742 18.8531C65.575 18.502 64.9401 18.1962 64.9633 18.1734C65.0514 18.0868 68.0863 18.961 69.3077 19.4247C71.1247 20.1145 71.4247 20.2039 71.6454 20.1207C71.7933 20.0649 71.8648 19.6398 71.9367 18.39Z",fill:"#F50DB4"}),e.jsx("path",{d:"M33.5466 11.9727C32.4688 11.808 32.4233 11.7887 32.9306 11.7119C33.9026 11.5647 36.1979 11.7653 37.7796 12.1358C41.4722 13.0004 44.8322 15.2153 48.4188 19.1488L49.3717 20.1938L50.7348 19.978C56.4773 19.0689 62.3192 19.7914 67.2054 22.0148C68.5495 22.6265 70.6689 23.8441 70.9337 24.157C71.018 24.2568 71.173 24.8987 71.2779 25.5837C71.6408 27.9534 71.4591 29.7699 70.7234 31.1265C70.3229 31.8648 70.3006 32.0988 70.5698 32.7306C70.7847 33.2348 71.3838 33.608 71.9771 33.6072C73.1913 33.6056 74.4983 31.6721 75.1038 28.9818L75.3443 27.9131L75.8209 28.4448C78.4346 31.3619 80.4876 35.34 80.8403 38.1716L80.9321 38.9099L80.4928 38.2387C79.7366 37.0838 78.9769 36.2976 78.0041 35.6635C76.2504 34.5205 74.3961 34.1315 69.4853 33.8766C65.0501 33.6464 62.5399 33.2732 60.0509 32.4737C55.816 31.1137 53.6812 29.3023 48.6508 22.8012C46.4164 19.9135 45.0354 18.3159 43.6616 17.0293C40.5401 14.1058 37.4729 12.5726 33.5466 11.9727Z",fill:"#F50DB4"}),e.jsx("path",{d:"M35.6404 25.9564C33.4522 22.9889 32.0983 18.4391 32.3914 15.0379L32.482 13.9854L32.9801 14.0749C33.9155 14.243 35.5283 14.8343 36.2835 15.2861C38.3559 16.5259 39.253 18.1582 40.1658 22.3496C40.4332 23.5773 40.7839 24.9666 40.9454 25.437C41.2052 26.194 42.1871 27.9624 42.9854 29.1109C43.5605 29.938 43.1785 30.33 41.9074 30.217C39.9662 30.0444 37.3367 28.2568 35.6404 25.9564Z",fill:"#F50DB4"}),e.jsx("path",{d:"M69.2799 48.0419C59.0538 43.9862 55.4521 40.4658 55.4521 34.5259C55.4521 33.6517 55.4827 32.9365 55.5199 32.9365C55.5572 32.9365 55.9528 33.225 56.3991 33.5776C58.4728 35.216 60.7949 35.9157 67.2233 36.8395C71.0061 37.3831 73.1349 37.8222 75.0986 38.4637C81.3402 40.5027 85.2018 44.6406 86.1227 50.2766C86.3903 51.9143 86.2334 54.9854 85.7995 56.6039C85.457 57.8824 84.4118 60.1868 84.1346 60.2751C84.0578 60.2996 83.9824 60.0094 83.9626 59.6147C83.8575 57.4983 82.7718 55.438 80.9485 53.8946C78.8754 52.1399 76.0901 50.7428 69.2799 48.0419Z",fill:"#F50DB4"}),e.jsx("path",{d:"M62.1008 49.7268C61.9727 48.9758 61.7505 48.0167 61.607 47.5954L61.3461 46.8296L61.8307 47.3655C62.5014 48.107 63.0314 49.0559 63.4806 50.3197C63.8234 51.2843 63.862 51.5711 63.8594 53.1386C63.8568 54.6774 63.814 55 63.4974 55.8682C62.9983 57.2373 62.3788 58.208 61.3392 59.2501C59.4712 61.1228 57.0696 62.1596 53.6039 62.5896C53.0015 62.6643 51.2456 62.7902 49.7019 62.8693C45.8118 63.0686 43.2515 63.4803 40.9508 64.276C40.6201 64.3905 40.3247 64.4601 40.2948 64.4305C40.2017 64.3393 41.768 63.4195 43.0618 62.8056C44.8862 61.94 46.7021 61.4676 50.7709 60.8002C52.7809 60.4704 54.8566 60.0704 55.3837 59.9112C60.3612 58.4079 62.9197 54.5286 62.1008 49.7268Z",fill:"#F50DB4"}),e.jsx("path",{d:"M66.7886 57.9275C65.4299 55.0505 65.1179 52.2726 65.8623 49.6821C65.942 49.4053 66.07 49.1787 66.1471 49.1787C66.224 49.1787 66.5447 49.3495 66.8594 49.5581C67.4855 49.9732 68.7412 50.6725 72.0866 52.4692C76.2612 54.7111 78.6414 56.4472 80.2599 58.4306C81.6775 60.1677 82.5547 62.1459 82.9769 64.5583C83.2159 65.9248 83.0759 69.2128 82.7199 70.5889C81.5975 74.9275 78.9889 78.3356 75.2682 80.3242C74.7231 80.6155 74.2337 80.8547 74.1807 80.8558C74.1278 80.8569 74.3264 80.3594 74.6222 79.7503C75.8738 77.173 76.0163 74.6661 75.07 71.8756C74.4906 70.1671 73.3092 68.0823 70.924 64.5588C68.1507 60.4623 67.4708 59.3721 66.7886 57.9275Z",fill:"#F50DB4"}),e.jsx("path",{d:"M28.3782 73.4506C32.173 70.2943 36.8948 68.0521 41.1958 67.3639C43.0494 67.0672 46.1372 67.185 47.8537 67.6178C50.605 68.3113 53.0662 69.8648 54.3462 71.7156C55.5971 73.5245 56.1338 75.1008 56.6925 78.6081C56.913 79.9916 57.1527 81.3809 57.2252 81.6954C57.6449 83.5131 58.4614 84.966 59.4733 85.6957C61.0805 86.8544 63.8479 86.9265 66.5704 85.8804C67.0325 85.7028 67.4336 85.5801 67.4618 85.6078C67.5605 85.7044 66.1896 86.6083 65.2225 87.0842C63.9212 87.7245 62.8864 87.972 61.5115 87.972C59.0181 87.972 56.948 86.7226 55.2206 84.175C54.8807 83.6736 54.1167 82.1718 53.5228 80.8378C51.699 76.7403 50.7984 75.4921 48.6809 74.126C46.8381 72.9374 44.4615 72.7245 42.6736 73.588C40.325 74.7223 39.6698 77.6786 41.3518 79.5521C42.0204 80.2967 43.2671 80.939 44.2865 81.0638C46.1936 81.2975 47.8326 79.8684 47.8326 77.9717C47.8326 76.7402 47.352 76.0374 46.1423 75.4996C44.4901 74.7652 42.7141 75.6237 42.7226 77.1526C42.7263 77.8045 43.0145 78.214 43.6779 78.5097C44.1036 78.6994 44.1134 78.7144 43.7664 78.6434C42.2504 78.3337 41.8952 76.5335 43.1141 75.3383C44.5776 73.9036 47.6037 74.5367 48.6428 76.4951C49.0794 77.3177 49.1301 78.956 48.7495 79.9452C47.8976 82.1593 45.4138 83.3237 42.8941 82.6901C41.1787 82.2587 40.4801 81.7915 38.4119 79.6931C34.8179 76.0462 33.4226 75.3396 28.2413 74.5428L27.2484 74.3902L28.3782 73.4506Z",fill:"#F50DB4"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.5147 8.18128C23.517 22.5305 31.7835 28.4507 32.7022 29.7015C33.4607 30.7343 33.1752 31.6628 31.8758 32.3905C31.1532 32.7951 29.6676 33.205 28.9238 33.205C28.0825 33.205 27.7936 32.8853 27.7936 32.8853C27.3058 32.4296 27.0311 32.5093 24.5261 28.1293C21.0483 22.8137 18.1379 18.4041 18.0585 18.3303C17.8749 18.1596 17.878 18.1653 24.1715 29.2574C25.1883 31.5693 24.3737 32.4179 24.3737 32.7471C24.3737 33.417 24.1882 33.7691 23.3494 34.6907C21.951 36.2274 21.3259 37.954 20.8746 41.5274C20.3687 45.5332 18.9462 48.3629 15.0041 53.2057C12.6965 56.0406 12.3189 56.5602 11.7366 57.7028C11.0032 59.1416 10.8015 59.9475 10.7198 61.7645C10.6334 63.6855 10.8016 64.9265 11.3975 66.7632C11.9191 68.3712 12.4636 69.433 13.8555 71.5567C15.0568 73.3894 15.7484 74.7513 15.7484 75.2841C15.7484 75.708 15.8306 75.7085 17.692 75.2945C22.1466 74.3036 25.7638 72.5609 27.7981 70.4252C29.0571 69.1033 29.3527 68.3733 29.3623 66.5619C29.3686 65.377 29.3263 65.1289 29.0011 64.4473C28.4718 63.3379 27.5083 62.4154 25.3845 60.9853C22.6019 59.1115 21.4133 57.603 21.085 55.5285C20.8157 53.8263 21.1282 52.6253 22.6676 49.4472C24.2609 46.1575 24.6558 44.7557 24.9229 41.4399C25.0954 39.2977 25.3343 38.4528 25.9591 37.7747C26.6108 37.0676 27.1975 36.8281 28.8103 36.611C31.4396 36.2572 33.1139 35.5871 34.4901 34.3379C35.6839 33.2543 36.1835 32.2101 36.2602 30.6382L36.3184 29.4468L35.6512 28.6806C33.2352 25.9057 9.89667 6 9.74799 6C9.71623 6 10.5113 6.98164 11.5147 8.18128ZM17.1047 63.9381C17.6509 62.9852 17.3607 61.7601 16.447 61.1617C15.5836 60.5962 14.2424 60.8625 14.2424 61.5994C14.2424 61.8243 14.3687 61.9879 14.6532 62.1322C15.1322 62.375 15.167 62.648 14.7901 63.2061C14.4084 63.7712 14.4392 64.2681 14.877 64.6057C15.5826 65.15 16.5815 64.8507 17.1047 63.9381Z",fill:"#F50DB4"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M37.9777 37.236C36.7433 37.6095 35.5435 38.8981 35.172 40.2493C34.9454 41.0736 35.074 42.5196 35.4134 42.9662C35.9617 43.6874 36.492 43.8774 37.9277 43.8675C40.7388 43.8482 43.1825 42.6606 43.4666 41.176C43.6994 39.9591 42.6262 38.2726 41.1478 37.5321C40.385 37.1502 38.7626 36.9987 37.9777 37.236ZM41.2638 39.7671C41.6973 39.1604 41.5076 38.5047 40.7704 38.0611C39.3664 37.2167 37.2432 37.9155 37.2432 39.222C37.2432 39.8724 38.3504 40.5819 39.3653 40.5819C40.0408 40.5819 40.9652 40.1851 41.2638 39.7671Z",fill:"#F50DB4"})]})]}),displayName:"Uniswap Wallet",rdns:"org.uniswap.app"},okx_wallet:{displayName:"OKX Wallet",rdns:"com.okex.wallet",logo:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJDSURBVHgB7Zq9jtpAEMfHlhEgQLiioXEkoAGECwoKxMcTRHmC5E3IoyRPkPAEkI7unJYmTgEFTYwA8a3NTKScLnCHN6c9r1e3P2llWQy7M/s1Gv1twCP0ej37dDq9x+Zut1t3t9vZjDEHIiSRSPg4ZpDL5fxkMvn1cDh8m0wmfugfO53OoFQq/crn8wxfY9EymQyrVCqMfHvScZx1p9ls3pFxXBy/bKlUipGPrVbLuQqAfsCliq3zl0H84zwtjQrOw4Mt1W63P5LvBm2d+Xz+YzqdgkqUy+WgWCy+Mc/nc282m4FqLBYL+3g8fjDxenq72WxANZbLJeA13zDX67UDioL5ybXwafMYu64Ltn3bdDweQ5R97fd7GyhBQMipx4POeEDHIu2LfDdBIGGz+hJ9CQ1ABjoA2egAZPM6AgiCAEQhsi/C4jHyPA/6/f5NG3Ks2+3CYDC4aTccDrn6ojG54MnEvG00GoVmWLIRNZ7wTCwDHYBsdACy0QHIhiuRETxlICWpMMhGZHmqS8qH6JLyGegAZKMDkI0uKf8X4SWlaZo+Pp1bRrwlJU8ZKLIvUjKh0WiQ3sRUbNVq9c5Ebew7KEo2m/1p4jJ4qAmDaqDQBzj5XyiAT4VCQezJigAU+IDU+z8vJFnGWeC+bKQV/5VZ71FV6L7PA3gg3tXrdQ+DgLhC+75Wq3no69P3MC0NFQpx2lL04Ql9gHK1bRDjsSBIvScBnDTk1WrlGIZBorIDEYJj+rhdgnQ67VmWRe0zlplXl81vcyEt0rSoYDUAAAAASUVORK5CYII="},rabby_wallet:{logo:t=>e.jsxs("svg",{width:"52",height:"52",viewBox:"0 0 52 52",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[e.jsx("rect",{width:"52",height:"52",rx:"26",fill:"#7084FF"}),e.jsx("path",{d:"M43.6781 28.2954C45.1053 25.0988 38.0498 16.168 31.3094 12.4472C27.0608 9.56481 22.6337 9.96081 21.737 11.2264C19.7693 14.0039 28.2527 16.3574 33.9263 19.1037C32.7067 19.6348 31.5574 20.5879 30.8816 21.8067C28.7664 19.4915 24.1239 17.4977 18.6765 19.1037C15.0056 20.186 11.9547 22.7374 10.7756 26.5911C10.4891 26.4635 10.1719 26.3925 9.83814 26.3925C8.56192 26.3925 7.52734 27.4298 7.52734 28.7094C7.52734 29.989 8.56192 31.0263 9.83814 31.0263C10.0747 31.0263 10.8143 30.8672 10.8143 30.8672L22.6337 30.953C17.9068 38.4713 14.1713 39.5704 14.1713 40.8729C14.1713 42.1754 17.7455 41.8224 19.0876 41.3369C25.5121 39.0127 32.4123 31.7692 33.5964 29.6841C38.5688 30.3061 42.7476 30.3796 43.6781 28.2954Z",fill:"url(#paint0_linear_81034_11443)"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M33.8741 19.076C33.8926 19.084 33.911 19.092 33.9294 19.1001C34.1923 18.9962 34.1498 18.6068 34.0776 18.301C33.9116 17.5981 31.0479 14.7629 28.3588 13.493C24.6934 11.762 21.9946 11.8518 21.5972 12.65C22.3407 14.1849 25.8031 15.6258 29.4193 17.1308C30.9407 17.7639 32.4893 18.4084 33.8741 19.076Z",fill:"url(#paint1_linear_81034_11443)"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M29.272 34.5374C28.5323 34.2543 27.697 33.9945 26.7477 33.7587C27.7625 31.9382 27.9754 29.2432 27.0171 27.5392C25.6721 25.1478 23.9838 23.875 20.0605 23.875C17.9027 23.875 12.093 24.6037 11.9899 29.4663C11.9791 29.9743 11.9895 30.44 12.026 30.8685L22.6335 30.9456C21.2017 33.2229 19.8609 34.9113 18.6873 36.1947C20.0979 36.5571 21.2615 36.8612 22.3297 37.1404C23.3394 37.4043 24.2638 37.646 25.2309 37.8934C26.6941 36.8249 28.0698 35.6597 29.272 34.5374Z",fill:"url(#paint2_linear_81034_11443)"}),e.jsx("path",{d:"M10.6324 30.3712C11.0658 34.065 13.1596 35.5127 17.4381 35.9411C21.7166 36.3695 24.1708 36.0821 27.4381 36.3801C30.167 36.6291 32.6036 38.0233 33.5075 37.5415C34.321 37.1079 33.8659 35.5412 32.7774 34.5361C31.3663 33.2333 29.4135 32.3274 25.9773 32.006C26.6621 30.1261 26.4702 27.4903 25.4067 26.0562C23.8689 23.9827 21.0305 23.0453 17.4381 23.4549C13.6848 23.8828 10.0885 25.7354 10.6324 30.3712Z",fill:"url(#paint3_linear_81034_11443)"}),e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"paint0_linear_81034_11443",x1:"18.249",y1:"25.4646",x2:"43.3806",y2:"32.5728",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"white"}),e.jsx("stop",{offset:"1",stopColor:"white"})]}),e.jsxs("linearGradient",{id:"paint1_linear_81034_11443",x1:"39.1432",y1:"24.9813",x2:"20.9691",y2:"6.81008",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#8697FF"}),e.jsx("stop",{offset:"1",stopColor:"#8697FF",stopOpacity:"0"})]}),e.jsxs("linearGradient",{id:"paint2_linear_81034_11443",x1:"29.7761",y1:"35.1727",x2:"12.345",y2:"25.1792",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#8697FF"}),e.jsx("stop",{offset:"1",stopColor:"#8697FF",stopOpacity:"0"})]}),e.jsxs("linearGradient",{id:"paint3_linear_81034_11443",x1:"19.7472",y1:"25.2716",x2:"31.5549",y2:"40.2352",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"white"}),e.jsx("stop",{offset:"0.983895",stopColor:"#D1D8FF"})]})]})]}),displayName:"Rabby Wallet",rdns:"io.rabby.wallet"},safe:{displayName:"Safe",logo:({style:t,...r})=>e.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...t},...r,children:[e.jsx("rect",{width:"28",height:"28",rx:"3",fill:"#12FF80"}),e.jsx("path",{d:"M22.5151 13.9979H20.4244C19.7981 13.9979 19.2945 14.5058 19.2945 15.128V18.163C19.2945 18.7894 18.7866 19.2931 18.1645 19.2931H9.8398C9.21344 19.2931 8.70981 19.8011 8.70981 20.4233V22.5185C8.70981 23.145 9.21767 23.6487 9.8398 23.6487H18.6427C19.2691 23.6487 19.7642 23.1407 19.7642 22.5185V20.8423C19.7642 20.2159 20.2721 19.7757 20.8942 19.7757H22.5151C23.1415 19.7757 23.6451 19.2677 23.6451 18.6455V15.1196C23.6451 14.4889 23.1373 13.9979 22.5151 13.9979Z",fill:"black"}),e.jsx("path",{d:"M8.7098 9.84127C8.7098 9.21481 9.21766 8.71111 9.83978 8.71111H18.156C18.7823 8.71111 19.286 8.20317 19.286 7.58095V5.48995C19.286 4.86349 18.7781 4.35979 18.156 4.35979H9.35732C8.73096 4.35979 8.22733 4.86772 8.22733 5.48995V7.10264C8.22733 7.7291 7.71947 8.2328 7.09734 8.2328H5.48912C4.86276 8.2328 4.35913 8.74074 4.35913 9.36296V12.8931C4.35913 13.5196 4.86699 13.9979 5.49335 13.9979H7.58404C8.2104 13.9979 8.71403 13.4899 8.71403 12.8677L8.7098 9.84127Z",fill:"black"}),e.jsx("path",{d:"M13.0139 11.8011H15.0242C15.6802 11.8011 16.2092 12.3344 16.2092 12.9862V14.9968C16.2092 15.6529 15.6759 16.182 15.0242 16.182H13.0139C12.3579 16.182 11.8289 15.6487 11.8289 14.9968V12.9862C11.8289 12.3302 12.3621 11.8011 13.0139 11.8011Z",fill:"black"})]})},universal_profile:{displayName:"Universal Profile",logo:({style:t,...r})=>e.jsxs("svg",{fill:"none",height:"1024",width:"1024",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...t},...r,children:[e.jsxs("filter",{id:"a","color-interpolation-filters":"sRGB",filterUnits:"userSpaceOnUse",height:"1228",width:"1244",x:"-72",y:"-72",children:[e.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),e.jsx("feBlend",{in:"SourceGraphic",in2:"BackgroundImageFix",mode:"normal",result:"shape"}),e.jsx("feColorMatrix",{in:"SourceAlpha",result:"hardAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"}),e.jsx("feOffset",{dx:"-72",dy:"-72"}),e.jsx("feGaussianBlur",{stdDeviation:"54"}),e.jsx("feComposite",{in2:"hardAlpha",k2:"-1",k3:"1",operator:"arithmetic"}),e.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"}),e.jsx("feBlend",{in2:"shape",mode:"normal",result:"effect1_innerShadow_3981_20791"}),e.jsx("feColorMatrix",{in:"SourceAlpha",result:"hardAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"}),e.jsx("feOffset",{dx:"152",dy:"132"}),e.jsx("feGaussianBlur",{stdDeviation:"74"}),e.jsx("feComposite",{in2:"hardAlpha",k2:"-1",k3:"1",operator:"arithmetic"}),e.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.15 0"}),e.jsx("feBlend",{in2:"effect1_innerShadow_3981_20791",mode:"normal",result:"effect2_innerShadow_3981_20791"}),e.jsx("feColorMatrix",{in:"SourceAlpha",result:"hardAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"}),e.jsx("feOffset",{dx:"32",dy:"20"}),e.jsx("feGaussianBlur",{stdDeviation:"50"}),e.jsx("feComposite",{in2:"hardAlpha",k2:"-1",k3:"1",operator:"arithmetic"}),e.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.08 0"}),e.jsx("feBlend",{in2:"effect2_innerShadow_3981_20791",mode:"normal",result:"effect3_innerShadow_3981_20791"})]}),e.jsxs("filter",{id:"b","color-interpolation-filters":"sRGB",filterUnits:"userSpaceOnUse",height:"352",width:"747",x:"142",y:"352",children:[e.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),e.jsx("feBlend",{in:"SourceGraphic",in2:"BackgroundImageFix",mode:"normal",result:"shape"}),e.jsx("feColorMatrix",{in:"SourceAlpha",result:"hardAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"}),e.jsx("feOffset",{dx:"8",dy:"12"}),e.jsx("feGaussianBlur",{stdDeviation:"5"}),e.jsx("feComposite",{in2:"hardAlpha",k2:"-1",k3:"1",operator:"arithmetic"}),e.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0.120833 0 0 0 0 0.120833 0 0 0 0 0.120833 0 0 0 0.69 0"}),e.jsx("feBlend",{in2:"shape",mode:"normal",result:"effect1_innerShadow_3981_20791"})]}),e.jsxs("linearGradient",{id:"c",gradientUnits:"userSpaceOnUse",x1:"0",x2:"1024",y1:"0",y2:"1024",children:[e.jsx("stop",{offset:"0","stop-color":"#8992d1"}),e.jsx("stop",{offset:"1","stop-color":"#646c9f"})]}),e.jsx("clipPath",{id:"d",children:e.jsx("path",{d:"m0 0h1024v1024h-1024z"})}),e.jsxs("g",{"clip-path":"url(#d)",children:[e.jsx("g",{filter:"url(#a)",children:e.jsx("rect",{fill:"url(#c)",height:"1024",rx:"230",width:"1024"})}),e.jsxs("g",{fill:"#fff",filter:"url(#b)",children:[e.jsx("path",{d:"m212.459 354h-54.459c-8.837 0-16 7.163-16 16v203c0 66.826 54.174 121 121 121h44c66.826 0 121-54.174 121-121v-203c0-8.837-7.163-16-16-16h-56.548c-8.837 0-16 7.163-16 16v198.829c0 28.607-23.19 51.797-51.797 51.797-32.693 0-59.196-26.503-59.196-59.196v-191.43c0-8.837-7.163-16-16-16z"}),e.jsx("path",{d:"m868.426 352h-68.495c-6.98 0-12.487 5.934-11.967 12.895l14.206 190c.468 6.263 5.686 11.105 11.966 11.105h45.412c6.409 0 11.687-5.037 11.987-11.44l8.878-190c.32-6.84-5.14-12.56-11.987-12.56z"}),e.jsx("ellipse",{cx:"834",cy:"649.5",rx:"47",ry:"44.5"}),e.jsx("path",{"clip-rule":"evenodd",d:"m522 687h50c8.837 0 16-7.163 16-16v-80c0-8.837 7.163-16 16-16h33.5c61.58 0 111.5-49.92 111.5-111.5s-49.92-111.5-111.5-111.5h-115.5c-8.837 0-16 7.163-16 16v303c0 8.837 7.163 16 16 16zm70-252v58c0 6.627 5.373 12 12 12h14c20.987 0 38-17.013 38-38v-6c0-20.987-17.013-38-38-38h-14c-6.627 0-12 5.373-12 12z","fill-rule":"evenodd"})]})]})]})}},Sl=(e,t,r)=>bl[e]?.displayName?"coinbase_wallet"===e?bl[r].displayName:bl[e].displayName:"wallet_connect_v2"===t&&"wallet_connect"===e?"Wallet Connect":void 0,Al=(e,t,r)=>bl[e]?.logo?"coinbase_wallet"===e?bl[r].logo:bl[e].logo:"wallet_connect_v2"===t&&"wallet_connect"===e?eo:void 0;function jl(e){let t=e.toLowerCase();return!!window?.webkit?.messageHandlers?.ReactNativeWebView||!!window?.ReactNativeWebView||["fbav","fban","instagram","snapchat","linkedinapp"].some((e=>t.includes(e)))}const $l=({provider:t,displayName:r,logo:n,connectOnly:i,connector:s})=>{let{navigate:l}=g.usePrivyModal(),{connectWallet:c}=o.usePrivyInternal(),u=d.useRecentlyUsedLogin(),h="wallet_connect_v2"===s.connectorType?t:s.walletClientType,p=window.matchMedia("(display-mode: standalone)").matches;return e.jsxs(Tl,{onClick:"phantom"===s.connectorType||"solana_adapter"===s.connectorType&&"phantom"===s.walletClientType?()=>{d.isPhantomInstalled()||"solana"===s.chainType&&"isInstalled"in s&&s.isInstalled?(c(s,h),l(i?g.ModalScreen.AWAITING_CONNECT_ONLY_CONNECTION:g.ModalScreen.AWAITING_CONNECTION)):a.isMobile?l(g.ModalScreen.PHANTOM_INTERSTITIAL_SCREEN):l(g.ModalScreen.INSTALL_PHANTOM_SCREEN)}:"coinbase_wallet"!==s.connectorType||"eoaOnly"!==s.connectionOptions||!a.isMobile||p||d.isCoinbaseWalletInstalled()?()=>{(!jl(window.navigator.userAgent)||event?.isTrusted)&&(c(s,h),l(i?g.ModalScreen.AWAITING_CONNECT_ONLY_CONNECTION:g.ModalScreen.AWAITING_CONNECTION))}:()=>{window.location.href=`https://go.cb-w.com/dapp?cb_url=${encodeURI(window.location.href)}`},children:[e.jsx(El,{icon:Al(t,s.connectorType,s.walletClientType)??n,name:s.walletClientType}),e.jsx("span",{children:Sl(t,s.connectorType,s.walletClientType)||r||s.walletClientType}),e.jsxs(_l,{id:"chip-container",children:[u?.walletClientType===h&&u?.chainType===s.chainType?e.jsx(Pl,{color:"gray",children:"Recent"}):e.jsx("span",{id:"connect-text",children:"Connect"}),"solana_adapter"===s.connectorType&&e.jsx(Pl,{color:"gray",children:"Solana"})]})]})};let Tl=C.styled(ts)`
|
|
929
929
|
/* Show "Connect" on hover */
|
|
930
930
|
> #chip-container > #connect-text {
|
|
931
931
|
font-weight: 500;
|
|
@@ -1119,7 +1119,7 @@
|
|
|
1119
1119
|
border-radius: var(--privy-border-radius-md);
|
|
1120
1120
|
background-color: var(--privy-color-background-2);
|
|
1121
1121
|
color: var(--privy-color-foreground-3);
|
|
1122
|
-
`;function Cd(){let{refreshUser:e,createAnalyticsEvent:t,initializeWalletProxy:r}=o.usePrivyInternal(),n=i.useRef(!1);return{createWallet:i.useCallback((async
|
|
1122
|
+
`;function Cd(){let{refreshUser:e,createAnalyticsEvent:t,initializeWalletProxy:r}=o.usePrivyInternal(),n=i.useRef(!1);return{createWallet:i.useCallback((async({user:i,recoveryPassword:a})=>{let o=await Sg();if(!o)throw t({eventName:"embedded_wallet_creation_failed",payload:{error:"Missing access token for user."}}),Error("An error has occured, please login again.");try{t({eventName:"embedded_wallet_creation_started"});let s=await r(l.WALLET_PROXY_TIMEOUT);if(!s)throw Error("walletProxy does not exist.");let d=new Promise(((e,t)=>{setTimeout((()=>{t(Error("walletProxy.create timed out."))}),2e4)})),c=u.getPrivySolanaWallet(i);if(!await Promise.race([s.create({accessToken:o,recoveryPassword:a,solanaAddress:c?.address}),d]))throw Error("walletProxy.create did not send a response.");let h=await e();if(!h)throw Error("Failed to refresh user.");let p=u.getPrivyEthereumWallet(h);if(!p)throw Error("Updated user is missing embedded wallet.");return t({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:p.address}}),n.current=!0,p}catch(i){if(n.current)return;throw t({eventName:"embedded_wallet_creation_failed",payload:{error:i.toString()}}),console.warn(i),i}}),[])}}let Ed=C.styled.div`
|
|
1123
1123
|
height: 44px;
|
|
1124
1124
|
`,bd=C.css`
|
|
1125
1125
|
font-size: 14px;
|
|
@@ -1362,7 +1362,7 @@
|
|
|
1362
1362
|
display: flex;
|
|
1363
1363
|
flex-direction: column;
|
|
1364
1364
|
height: 100%;
|
|
1365
|
-
`;const lc=({buttonHideAnimations:t,buttonLoading:r,appName:n,password:a,onSubmit:o,onBack:s})=>{let[l,c]=i.useState(!1),u=i.useCallback((()=>{c(!0),a&&navigator.clipboard.writeText(a)}),[a]),h=i.useCallback((()=>{let e=document.createElement("a"),t=n.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),r=new Blob([dc(n,a)],{type:"text/plain"}),i=URL.createObjectURL(r);e.href=i,e.target="_blank",e.download=`${t}-privy-wallet-recovery.txt`,document.body.appendChild(e),e.click(),setTimeout((()=>{e.remove(),URL.revokeObjectURL(i)}),5e3)}),[a]);return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{backFn:s,closeable:!1}),e.jsx(Xs,{}),e.jsxs(Ad,{children:[e.jsxs(kd,{children:[e.jsx(He.default,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),e.jsx("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),e.jsx("p",{style:{color:"var(--privy-color-foreground-2)"},children:"For your security, this password cannot be reset, so keep it somewhere safe."})]}),e.jsx(_d,{centered:!0,children:e.jsx(Pd,{children:a})}),e.jsxs("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[e.jsx(Md,{onClick:u,children:l?e.jsxs(e.Fragment,{children:[e.jsx(at.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}):e.jsxs(e.Fragment,{children:[e.jsx(ot.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),e.jsxs(Md,{onClick:h,children:[e.jsx(it.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),e.jsx(jd,{onClick:o,loading:r,hideAnimations:t,children:"Continue"}),e.jsx(Js,{}),e.jsx(d.BlobbyFooter,{})]})};let dc=(e,t)=>`Your wallet recovery password for ${e} is\n\n${t}\n\nYou will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;const cc=({error:t,onClose:r})=>e.jsxs(e.Fragment,{children:[e.jsx(Wo,{closeable:!1}),e.jsx(Xs,{}),t?e.jsxs(Vs,{children:[e.jsx(Xe.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),e.jsx(il,{title:"Something went wrong",description:t})]}):e.jsxs(Vs,{children:[e.jsx(Ze.default,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}),e.jsx(il,{title:"Success"})]}),e.jsx(jo,{onClick:r,children:"Close"}),e.jsx(Js,{}),e.jsx(d.BlobbyFooter,{})]});let uc=(e,t)=>{switch(e){case"creating":return"back"===t?e:"saving";case"saving":return"back"===t?"creating":"confirming";case"confirming":return"back"===t?"saving":"finalizing";case"finalizing":return"back"===t?"confirming":"done";default:return e}};const hc=({onSubmit:t,...r})=>{let{lastScreen:n,navigate:a}=g.usePrivyModal(),{send:o,state:s}=(()=>{let[e,t]=i.useReducer(uc,"creating");return{send:t,state:e}})(),d=i.useCallback((async()=>{"finalizing"===s&&await t(),o("next")}),[s,o,t]);i.useEffect((()=>{let e;return"done"===s&&"automatic"===r.config.initiatedBy&&(e=setTimeout((()=>r.onClose?.()),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS)),()=>{e&&clearTimeout(e)}}),[s,r.config.initiatedBy,r.onClose]);let c=i.useCallback((()=>{o("back")}),[o]),u=i.useCallback((()=>{a(g.ModalScreen.EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN)}),[n,a]);return"creating"===s?e.jsx(ac,{...r,onSubmit:d,onBack:n===g.ModalScreen.EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN?u:void 0}):"saving"===s?e.jsx(lc,{...r,onSubmit:d,onBack:c}):"confirming"===s?e.jsx(Dd,{...r,onSubmit:d,onBack:c}):"finalizing"===s?e.jsx(zd,{...r,onSubmit:d,onBack:c}):"done"===s?e.jsx(cc,{...r,onSubmit:d}):null};const pc=({error:t,backFn:r,onClick:n})=>{let{reset:i}=
|
|
1365
|
+
`;const lc=({buttonHideAnimations:t,buttonLoading:r,appName:n,password:a,onSubmit:o,onBack:s})=>{let[l,c]=i.useState(!1),u=i.useCallback((()=>{c(!0),a&&navigator.clipboard.writeText(a)}),[a]),h=i.useCallback((()=>{let e=document.createElement("a"),t=n.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),r=new Blob([dc(n,a)],{type:"text/plain"}),i=URL.createObjectURL(r);e.href=i,e.target="_blank",e.download=`${t}-privy-wallet-recovery.txt`,document.body.appendChild(e),e.click(),setTimeout((()=>{e.remove(),URL.revokeObjectURL(i)}),5e3)}),[a]);return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{backFn:s,closeable:!1}),e.jsx(Xs,{}),e.jsxs(Ad,{children:[e.jsxs(kd,{children:[e.jsx(He.default,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),e.jsx("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),e.jsx("p",{style:{color:"var(--privy-color-foreground-2)"},children:"For your security, this password cannot be reset, so keep it somewhere safe."})]}),e.jsx(_d,{centered:!0,children:e.jsx(Pd,{children:a})}),e.jsxs("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[e.jsx(Md,{onClick:u,children:l?e.jsxs(e.Fragment,{children:[e.jsx(at.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}):e.jsxs(e.Fragment,{children:[e.jsx(ot.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),e.jsxs(Md,{onClick:h,children:[e.jsx(it.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),e.jsx(jd,{onClick:o,loading:r,hideAnimations:t,children:"Continue"}),e.jsx(Js,{}),e.jsx(d.BlobbyFooter,{})]})};let dc=(e,t)=>`Your wallet recovery password for ${e} is\n\n${t}\n\nYou will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;const cc=({error:t,onClose:r})=>e.jsxs(e.Fragment,{children:[e.jsx(Wo,{closeable:!1}),e.jsx(Xs,{}),t?e.jsxs(Vs,{children:[e.jsx(Xe.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),e.jsx(il,{title:"Something went wrong",description:t})]}):e.jsxs(Vs,{children:[e.jsx(Ze.default,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}),e.jsx(il,{title:"Success"})]}),e.jsx(jo,{onClick:r,children:"Close"}),e.jsx(Js,{}),e.jsx(d.BlobbyFooter,{})]});let uc=(e,t)=>{switch(e){case"creating":return"back"===t?e:"saving";case"saving":return"back"===t?"creating":"confirming";case"confirming":return"back"===t?"saving":"finalizing";case"finalizing":return"back"===t?"confirming":"done";default:return e}};const hc=({onSubmit:t,...r})=>{let{lastScreen:n,navigate:a}=g.usePrivyModal(),{send:o,state:s}=(()=>{let[e,t]=i.useReducer(uc,"creating");return{send:t,state:e}})(),d=i.useCallback((async()=>{"finalizing"===s&&await t(),o("next")}),[s,o,t]);i.useEffect((()=>{let e;return"done"===s&&"automatic"===r.config.initiatedBy&&(e=setTimeout((()=>r.onClose?.()),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS)),()=>{e&&clearTimeout(e)}}),[s,r.config.initiatedBy,r.onClose]);let c=i.useCallback((()=>{o("back")}),[o]),u=i.useCallback((()=>{a(g.ModalScreen.EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN)}),[n,a]);return"creating"===s?e.jsx(ac,{...r,onSubmit:d,onBack:n===g.ModalScreen.EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN?u:void 0}):"saving"===s?e.jsx(lc,{...r,onSubmit:d,onBack:c}):"confirming"===s?e.jsx(Dd,{...r,onSubmit:d,onBack:c}):"finalizing"===s?e.jsx(zd,{...r,onSubmit:d,onBack:c}):"done"===s?e.jsx(cc,{...r,onSubmit:d}):null};const pc=({error:t,backFn:r,onClick:n})=>{let{reset:i}=ba(),{app:a}=g.usePrivyModal(),s=((t,r)=>{let n=e.jsx(He.default,{height:38,width:38,stroke:"var(--privy-color-error)"});if(t instanceof o.PrivyClientError)switch(t.privyErrorCode){case o.PrivyErrorCode.CLIENT_REQUEST_TIMEOUT:return{title:"Timed out",detail:t.message,ctaText:"Try again",icon:n};case o.PrivyErrorCode.INSUFFICIENT_BALANCE:return{title:"Insufficient balance",detail:t.message,ctaText:"Try again",icon:n};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:n}}else{if(t instanceof Ql&&"twilio_verification_failed"===t.type)return{title:"Something went wrong",detail:t.message,ctaText:"Try again",icon:e.jsx(Ye.default,{height:38,width:38,stroke:"var(--privy-color-error)"})};if(!(t instanceof o.PrivyError))return t instanceof o.PrivyApiError&&t.status&&[400,422].includes(t.status)?{title:"Something went wrong",detail:t.message,ctaText:"Try again",icon:n}:{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:n};switch(t.privyErrorCode){case o.PrivyErrorCode.INVALID_CAPTCHA:return{title:"Something went wrong",detail:"Please try again.",ctaText:"Try again",icon:n};case o.PrivyErrorCode.DISALLOWED_LOGIN_METHOD:return{title:"Not allowed",detail:t.message,ctaText:"Try another method",icon:n};case o.PrivyErrorCode.ALLOWLIST_REJECTED:return{title:r.errorTitle||"You don't have access to this app",detail:r.errorDetail||"Have you been invited?",ctaText:r.errorCtaText||"Try another account",icon:e.jsx(Ds,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})};case o.PrivyErrorCode.CAPTCHA_FAILURE:return{title:"Something went wrong",detail:"You did not pass CAPTCHA. Please try again.",ctaText:"Try again",icon:e.jsx("span",{})};case o.PrivyErrorCode.CAPTCHA_TIMEOUT:return{title:"Something went wrong",detail:"Something went wrong! Please try again later.",ctaText:"Try again",icon:e.jsx("span",{})};case o.PrivyErrorCode.LINKED_TO_ANOTHER_USER:return{title:"Authentication failed",detail:"This account has already been linked to another user.",ctaText:"Try again",icon:n};case o.PrivyErrorCode.NOT_SUPPORTED:return{title:"This region is not supported",detail:"SMS authentication from this region is not available",ctaText:"Try another method",icon:n};case o.PrivyErrorCode.TOO_MANY_REQUESTS:return{title:"Request failed",detail:"Too many attempts.",ctaText:"Try again later",icon:n};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:n}}}})(t,a.allowlistConfig);return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{backFn:r}),e.jsxs(yc,{children:[e.jsx(Ko,{children:e.jsxs("div",{children:[e.jsx(os,{color:"var(--privy-color-error)"}),s.icon]})}),e.jsxs(mc,{children:[e.jsx("h3",{children:s.title}),e.jsx("p",{children:s.detail})]}),e.jsx(jo,{color:"var(--privy-color-error)",onClick:()=>{t instanceof o.PrivyError&&(t.privyErrorCode===o.PrivyErrorCode.INVALID_CAPTCHA&&i(),t.privyErrorCode===o.PrivyErrorCode.ALLOWLIST_REJECTED&&a.allowlistConfig.errorCtaLink)?window.location.href=a.allowlistConfig.errorCtaLink:n?.()},children:s.ctaText})]})]})};let yc=C.styled.div`
|
|
1366
1366
|
display: flex;
|
|
1367
1367
|
flex-direction: column;
|
|
1368
1368
|
align-items: center;
|
|
@@ -1838,7 +1838,7 @@
|
|
|
1838
1838
|
flex-direction: row;
|
|
1839
1839
|
align-items: center;
|
|
1840
1840
|
gap: 4px;
|
|
1841
|
-
`;class Ku{async authenticate(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");try{return await this.api.post(_i,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:this.meta.codeVerifier,provider:this.meta.provider})}catch(e){throw o.formatApiError(e)}}async link(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");try{return await this.api.post(ki,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:this.meta.codeVerifier,provider:this.meta.provider})}catch(e){throw o.formatApiError(e)}}constructor({authorizationCode:e,stateCode:t,codeVerifier:r,provider:n}){this.meta={authorizationCode:e,stateCode:t,codeVerifier:r,provider:n}}}async function Yu({api:e,requesterAppId:t,providerAppId:r}){let n=(await e.get(`/api/v1/apps/${t}/cross-app/connections`)).connections.find((e=>e.provider_app_id===r));if(!n)throw new o.PrivyClientError("Invalid connected app");return{name:n.provider_app_name,logoUrl:n.provider_app_icon_url||void 0,apiUrl:n.provider_app_custom_api_url,readOnly:n.read_only}}const Zu=async({user:e,address:t,client:r,request:n,requesterAppId:i,reconnect:a})=>{r.createAnalyticsEvent({eventName:"cross_app_request_started",payload:{address:t,method:n.method}});let s=e?.linkedAccounts.find((e=>!("cross_app"!==e.type||!e.embeddedWallets.find((e=>e.address===t)))));if(!e||!s)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Cannot request a signature with this wallet address",address:t}}),new o.PrivyClientError("Cannot request a signature with this wallet address");let l=r.getProviderAccessToken(s.providerApp.id),d=await Yu({api:r.api,requesterAppId:i,providerAppId:s.providerApp.id});if(!l){if(d.readOnly)throw console.error("cannot transact against a read-only provider app"),new o.PrivyClientError("Cannot transact against a read-only provider app");await a({appId:s.providerApp.id,action:"link"})&&(l=r.getProviderAccessToken(s.providerApp.id))}if(!l)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Transactions require a valid token",address:t}}),new o.PrivyClientError("Transactions require a valid token");let c=window.open(void 0,void 0,Ju({w:400,h:680}));if(!c)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Missing token",address:t}}),new o.PrivyClientError("Failed to initialize signature request");let u=new URL(`${d.apiUrl}/oauth/transact`);return u.searchParams.set("token",l||""),u.searchParams.set("request",Xu(n)),c.location=u.href,new Promise(((e,i)=>{let a=setTimeout((()=>{u(),i(new o.PrivyClientError("Request timeout")),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Request timeout",address:t}})}),12e4),l=setInterval((()=>{c.closed&&(u(),i(new o.PrivyClientError("User rejected request")),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"User rejected request",address:t}}))}),300),d=a=>{a.data&&("set"===a.data.token?.action&&void 0!==a.data.token?.value?r.storeProviderAccessToken(s.providerApp.id,a.data.token.value):"clear"===a.data.token?.action&&r.storeProviderAccessToken(s.providerApp.id,null),"PRIVY_CROSS_APP_ACTION_RESPONSE"===a.data.type&&a.data.result&&(u(),e(a.data.result),r.createAnalyticsEvent({eventName:"cross_app_request_success",payload:{address:t,method:n.method}})),"PRIVY_CROSS_APP_ACTION_ERROR"===a.data.type&&a.data.error&&(u(),i(a.data.error),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:a.data.error,address:t}})))};window.addEventListener("message",d);let u=()=>{c.close(),clearInterval(l),clearTimeout(a),window.removeEventListener("message",d)}}))};let Xu=e=>JSON.stringify({content:{request:{request:e}},timestamp:Date.now(),callbackUrl:window.origin});const Ju=({w:e,h:t})=>{let r=void 0!==window.screenLeft?window.screenLeft:window.screenX,n=void 0!==window.screenTop?window.screenTop:window.screenY,i=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,a=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height;return`toolbar=0,location=0,menubar=0,height=${t},width=${e},popup=1,left=${(i-e)/2/(i/window.screen.availWidth)+r},top=${(a-t)/2/(a/window.screen.availHeight)+n}`};let Qu=new Set([l.mainnet.id,l.base.id,l.optimism.id,l.polygon.id,l.arbitrum.id]),eh=new Set([l.mainnet.id,l.base.id,l.polygon.id,l.optimism.id]),th={[l.mainnet.id]:"ethereum",[l.base.id]:"base",[l.optimism.id]:"optimism",[l.polygon.id]:"polygon",[l.arbitrum.id]:"arbitrum"};let rh=Math.floor(160);let nh=({isSucccess:t,onClickCta:r})=>{let{title:n,body:a,cta:o}=i.useMemo((()=>(e=>e?{title:"You've funded your account!",body:"It may take a few minutes for the assets to appear.",cta:"Continue"}:{title:"In Progress",body:"Go back to Coinbase Onramp to finish funding your account.",cta:""})(t)),[t]);return e.jsxs(e.Fragment,{children:[e.jsxs(oh,{children:[e.jsx(ih,{isSucccess:t}),e.jsxs(Ys,{children:[e.jsx("h3",{children:n}),e.jsx(ah,{children:a})]})]}),o&&e.jsx(jo,{onClick:r,children:o})]})},ih=({isSucccess:t})=>{if(!t){let t="var(--privy-color-foreground-4)";return e.jsxs("div",{style:{position:"relative"},children:[e.jsx(Co,{color:t,style:{position:"absolute"}}),e.jsx(Eo,{color:t}),e.jsx(
|
|
1841
|
+
`;class Ku{async authenticate(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");try{return await this.api.post(_i,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:this.meta.codeVerifier,provider:this.meta.provider})}catch(e){throw o.formatApiError(e)}}async link(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");try{return await this.api.post(ki,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:this.meta.codeVerifier,provider:this.meta.provider})}catch(e){throw o.formatApiError(e)}}constructor({authorizationCode:e,stateCode:t,codeVerifier:r,provider:n}){this.meta={authorizationCode:e,stateCode:t,codeVerifier:r,provider:n}}}async function Yu({api:e,requesterAppId:t,providerAppId:r}){let n=(await e.get(`/api/v1/apps/${t}/cross-app/connections`)).connections.find((e=>e.provider_app_id===r));if(!n)throw new o.PrivyClientError("Invalid connected app");return{name:n.provider_app_name,logoUrl:n.provider_app_icon_url||void 0,apiUrl:n.provider_app_custom_api_url,readOnly:n.read_only}}const Zu=async({user:e,address:t,client:r,request:n,requesterAppId:i,reconnect:a})=>{r.createAnalyticsEvent({eventName:"cross_app_request_started",payload:{address:t,method:n.method}});let s=e?.linkedAccounts.find((e=>!("cross_app"!==e.type||!e.embeddedWallets.find((e=>e.address===t)))));if(!e||!s)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Cannot request a signature with this wallet address",address:t}}),new o.PrivyClientError("Cannot request a signature with this wallet address");let l=r.getProviderAccessToken(s.providerApp.id),d=await Yu({api:r.api,requesterAppId:i,providerAppId:s.providerApp.id});if(!l){if(d.readOnly)throw console.error("cannot transact against a read-only provider app"),new o.PrivyClientError("Cannot transact against a read-only provider app");await a({appId:s.providerApp.id,action:"link"})&&(l=r.getProviderAccessToken(s.providerApp.id))}if(!l)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Transactions require a valid token",address:t}}),new o.PrivyClientError("Transactions require a valid token");let c=window.open(void 0,void 0,Ju({w:400,h:680}));if(!c)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Missing token",address:t}}),new o.PrivyClientError("Failed to initialize signature request");let u=new URL(`${d.apiUrl}/oauth/transact`);return u.searchParams.set("token",l||""),u.searchParams.set("request",Xu(n)),c.location=u.href,new Promise(((e,i)=>{let a=setTimeout((()=>{u(),i(new o.PrivyClientError("Request timeout")),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Request timeout",address:t}})}),12e4),l=setInterval((()=>{c.closed&&(u(),i(new o.PrivyClientError("User rejected request")),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"User rejected request",address:t}}))}),300),d=a=>{a.data&&("set"===a.data.token?.action&&void 0!==a.data.token?.value?r.storeProviderAccessToken(s.providerApp.id,a.data.token.value):"clear"===a.data.token?.action&&r.storeProviderAccessToken(s.providerApp.id,null),"PRIVY_CROSS_APP_ACTION_RESPONSE"===a.data.type&&a.data.result&&(u(),e(a.data.result),r.createAnalyticsEvent({eventName:"cross_app_request_success",payload:{address:t,method:n.method}})),"PRIVY_CROSS_APP_ACTION_ERROR"===a.data.type&&a.data.error&&(u(),i(a.data.error),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:a.data.error,address:t}})))};window.addEventListener("message",d);let u=()=>{c.close(),clearInterval(l),clearTimeout(a),window.removeEventListener("message",d)}}))};let Xu=e=>JSON.stringify({content:{request:{request:e}},timestamp:Date.now(),callbackUrl:window.origin});const Ju=({w:e,h:t})=>{let r=void 0!==window.screenLeft?window.screenLeft:window.screenX,n=void 0!==window.screenTop?window.screenTop:window.screenY,i=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,a=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height;return`toolbar=0,location=0,menubar=0,height=${t},width=${e},popup=1,left=${(i-e)/2/(i/window.screen.availWidth)+r},top=${(a-t)/2/(a/window.screen.availHeight)+n}`};let Qu=new Set([l.mainnet.id,l.base.id,l.optimism.id,l.polygon.id,l.arbitrum.id]),eh=new Set([l.mainnet.id,l.base.id,l.polygon.id,l.optimism.id]),th={[l.mainnet.id]:"ethereum",[l.base.id]:"base",[l.optimism.id]:"optimism",[l.polygon.id]:"polygon",[l.arbitrum.id]:"arbitrum"};let rh=Math.floor(160);let nh=({isSucccess:t,onClickCta:r})=>{let{title:n,body:a,cta:o}=i.useMemo((()=>(e=>e?{title:"You've funded your account!",body:"It may take a few minutes for the assets to appear.",cta:"Continue"}:{title:"In Progress",body:"Go back to Coinbase Onramp to finish funding your account.",cta:""})(t)),[t]);return e.jsxs(e.Fragment,{children:[e.jsxs(oh,{children:[e.jsx(ih,{isSucccess:t}),e.jsxs(Ys,{children:[e.jsx("h3",{children:n}),e.jsx(ah,{children:a})]})]}),o&&e.jsx(jo,{onClick:r,children:o})]})},ih=({isSucccess:t})=>{if(!t){let t="var(--privy-color-foreground-4)";return e.jsxs("div",{style:{position:"relative"},children:[e.jsx(Co,{color:t,style:{position:"absolute"}}),e.jsx(Eo,{color:t}),e.jsx($a,{style:{position:"absolute",width:"2.8rem",height:"2.8rem",top:"1.2rem",left:"1.2rem"}})]})}let r=(t=>t?Ze.default:()=>e.jsx(mt.default,{width:"3rem",height:"3rem",style:{backgroundColor:"var(--privy-color-foreground-4)",color:"var(--privy-color-background)",borderRadius:"100%",padding:"0.5rem",margin:"0.5rem"}}))(t),n=(e=>e?"var(--privy-color-success)":"var(--privy-color-foreground-4)")(t);return e.jsx("div",{style:{borderColor:n,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:r&&e.jsx(r,{width:"4rem",height:"4rem",color:n})})},ah=C.styled.p`
|
|
1842
1842
|
font-size: 1rem;
|
|
1843
1843
|
color: var(--privy-color-foreground-3);
|
|
1844
1844
|
margin-bottom: 1rem;
|
|
@@ -1872,7 +1872,7 @@
|
|
|
1872
1872
|
border: 1px solid var(--privy-color-error);
|
|
1873
1873
|
border-radius: var(--privy-border-radius-sm);
|
|
1874
1874
|
}
|
|
1875
|
-
`;const dh=async({address:e,chain:t,rpcConfig:r,privyAppId:n})=>{try{let i=Z.createPublicClient({chain:t,transport:Z.http(d.getJsonRpcEndpointFromChain(t,r,n))}),[a,o]=await Promise.all([i.readContract({abi:ch,address:e,functionName:"symbol"}),i.readContract({abi:ch,address:e,functionName:"decimals"})]);return{decimals:o,symbol:a}}catch(e){return console.log(e),null}};let ch=[{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"}];const uh="moonpay";let hh=new Set([l.mainnet.id,l.arbitrum.id,l.base.id,l.polygon.id]),ph=new Set([l.mainnet.id,l.arbitrum.id,l.optimism.id,l.base.id,l.polygon.id]);function yh(e,t){switch(e){case l.arbitrum.id:return"native-currency"===t?"ETH_ARBITRUM":"USDC_ARBITRUM";case 43114:return"AVAX_CCHAIN";case l.base.id:return"native-currency"===t?"ETH_BASE":"USDC_BASE";case l.celo.id:return"CELO_CELO";case l.polygon.id:return"native-currency"===t?"MATIC_POLYGON":"USDC_POLYGON";case l.mainnet.id:return"native-currency"===t?"ETH_ETHEREUM":"USDC_ETHEREUM";default:return console.warn(`Chain ${e} not supported by Moonpay, defaulting to Ethereum mainnet`),"ETH_ETHEREUM"}}function mh(e){return parseFloat(e)}function fh(e){return!!e&&void 0!==e.config&&void 0!==e.provider}function gh(e){return!!e&&(void 0!==e.chain||void 0!==e.amount)}function vh(e,t=!1){let[r,n]=i.useState(null),{createAnalyticsEvent:a}=o.usePrivyInternal(),{data:s,navigate:d,setModalData:c}=g.usePrivyModal(),u=s?.funding,h=i.useRef(0);return i.useEffect((()=>{let r=setInterval((async()=>{if(e)try{let[i]=await async function(e,t){return v.ofetch(`${t?l.MOONPAY_API_URL_SANDBOX:l.MOONPAY_API_URL}/transactions/ext/${e}`,{query:{apiKey:t?l.MOONPAY_PUBLIC_KEY_SANDBOX:l.MOONPAY_PUBLIC_KEY}})}(e,t),o="waitingAuthorization"===i.status&&"credit_debit_card"===i.paymentMethod?"pending":i.status;if(["failed","completed","awaitingAuthorization"].includes(o)&&(a({eventName:zc,payload:{status:o,provider:uh,paymentMethod:i.paymentMethod,cardPaymentType:i.cardPaymentType,currency:i.currency?.code,baseCurrencyAmount:i.baseCurrencyAmount,quoteCurrencyAmount:i.quoteCurrencyAmount,feeAmount:i.feeAmount,extraFeeAmount:i.extraFeeAmount,networkFeeAmount:i.networkFeeAmount,isSandbox:t}}),clearInterval(r)),"failed"===o||"serviceFailure"===o)return c({funding:{...u,errorMessage:"Something went wrong adding funds from Moonpay. Please try again or use another method to fund your wallet."}}),void d(g.ModalScreen.FUNDING_METHOD_SELECTION_SCREEN);n(o)}catch(e){404!==e.response?.status&&(h.current+=1),h.current>=3&&(a({eventName:zc,payload:{status:"serviceFailure",provider:uh}}),clearInterval(r),c({funding:{...u,errorMessage:"Something went wrong adding funds from Moonpay. Please try again or use another method to fund your wallet."}}),d(g.ModalScreen.FUNDING_METHOD_SELECTION_SCREEN))}}),3e3);return()=>clearInterval(r)}),[e,h]),r}const wh=({size:t=61,...r})=>e.jsx("svg",{width:t,height:t,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r,children:e.jsxs("g",{id:"moonpay_symbol_wht 2",children:[e.jsx("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),e.jsx("path",{id:"Vector",d:"M43.8884 23.3258C45.0203 23.3258 46.1268 22.9901 47.068 22.3613C48.0091 21.7324 48.7427 20.8386 49.1759 19.7928C49.6091 18.747 49.7224 17.5962 49.5016 16.4861C49.2807 15.3759 48.7357 14.3561 47.9353 13.5557C47.1349 12.7553 46.1151 12.2102 45.0049 11.9893C43.8947 11.7685 42.7439 11.8819 41.6982 12.3151C40.6524 12.7482 39.7585 13.4818 39.1297 14.423C38.5008 15.3641 38.1651 16.4707 38.1651 17.6026C38.165 18.3542 38.3131 19.0985 38.6007 19.7929C38.8883 20.4873 39.3098 21.1182 39.8413 21.6496C40.3728 22.1811 41.0037 22.6027 41.6981 22.8903C42.3925 23.1778 43.1367 23.3259 43.8884 23.3258ZM26.3395 49.1017C23.5804 49.1017 20.8832 48.2836 18.5891 46.7507C16.295 45.2178 14.5069 43.039 13.4511 40.49C12.3952 37.9409 12.1189 35.1359 12.6572 32.4298C13.1955 29.7237 14.5241 27.238 16.4751 25.287C18.4262 23.336 20.9118 22.0074 23.6179 21.4691C26.324 20.9308 29.129 21.2071 31.6781 22.2629C34.2272 23.3189 36.406 25.1069 37.9389 27.401C39.4717 29.6952 40.2899 32.3923 40.2899 35.1514C40.2899 36.9835 39.9291 38.7975 39.2281 40.49C38.527 42.1826 37.4994 43.7205 36.204 45.0159C34.9086 46.3113 33.3707 47.3389 31.6781 48.04C29.9856 48.741 28.1715 49.1018 26.3395 49.1017Z",fill:"white"})]})});let xh=({...t})=>e.jsx(
|
|
1875
|
+
`;const dh=async({address:e,chain:t,rpcConfig:r,privyAppId:n})=>{try{let i=Z.createPublicClient({chain:t,transport:Z.http(d.getJsonRpcEndpointFromChain(t,r,n))}),[a,o]=await Promise.all([i.readContract({abi:ch,address:e,functionName:"symbol"}),i.readContract({abi:ch,address:e,functionName:"decimals"})]);return{decimals:o,symbol:a}}catch(e){return console.log(e),null}};let ch=[{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"}];const uh="moonpay";let hh=new Set([l.mainnet.id,l.arbitrum.id,l.base.id,l.polygon.id]),ph=new Set([l.mainnet.id,l.arbitrum.id,l.optimism.id,l.base.id,l.polygon.id]);function yh(e,t){switch(e){case l.arbitrum.id:return"native-currency"===t?"ETH_ARBITRUM":"USDC_ARBITRUM";case 43114:return"AVAX_CCHAIN";case l.base.id:return"native-currency"===t?"ETH_BASE":"USDC_BASE";case l.celo.id:return"CELO_CELO";case l.polygon.id:return"native-currency"===t?"MATIC_POLYGON":"USDC_POLYGON";case l.mainnet.id:return"native-currency"===t?"ETH_ETHEREUM":"USDC_ETHEREUM";default:return console.warn(`Chain ${e} not supported by Moonpay, defaulting to Ethereum mainnet`),"ETH_ETHEREUM"}}function mh(e){return parseFloat(e)}function fh(e){return!!e&&void 0!==e.config&&void 0!==e.provider}function gh(e){return!!e&&(void 0!==e.chain||void 0!==e.amount)}function vh(e,t=!1){let[r,n]=i.useState(null),{createAnalyticsEvent:a}=o.usePrivyInternal(),{data:s,navigate:d,setModalData:c}=g.usePrivyModal(),u=s?.funding,h=i.useRef(0);return i.useEffect((()=>{let r=setInterval((async()=>{if(e)try{let[i]=await async function(e,t){return v.ofetch(`${t?l.MOONPAY_API_URL_SANDBOX:l.MOONPAY_API_URL}/transactions/ext/${e}`,{query:{apiKey:t?l.MOONPAY_PUBLIC_KEY_SANDBOX:l.MOONPAY_PUBLIC_KEY}})}(e,t),o="waitingAuthorization"===i.status&&"credit_debit_card"===i.paymentMethod?"pending":i.status;if(["failed","completed","awaitingAuthorization"].includes(o)&&(a({eventName:zc,payload:{status:o,provider:uh,paymentMethod:i.paymentMethod,cardPaymentType:i.cardPaymentType,currency:i.currency?.code,baseCurrencyAmount:i.baseCurrencyAmount,quoteCurrencyAmount:i.quoteCurrencyAmount,feeAmount:i.feeAmount,extraFeeAmount:i.extraFeeAmount,networkFeeAmount:i.networkFeeAmount,isSandbox:t}}),clearInterval(r)),"failed"===o||"serviceFailure"===o)return c({funding:{...u,errorMessage:"Something went wrong adding funds from Moonpay. Please try again or use another method to fund your wallet."}}),void d(g.ModalScreen.FUNDING_METHOD_SELECTION_SCREEN);n(o)}catch(e){404!==e.response?.status&&(h.current+=1),h.current>=3&&(a({eventName:zc,payload:{status:"serviceFailure",provider:uh}}),clearInterval(r),c({funding:{...u,errorMessage:"Something went wrong adding funds from Moonpay. Please try again or use another method to fund your wallet."}}),d(g.ModalScreen.FUNDING_METHOD_SELECTION_SCREEN))}}),3e3);return()=>clearInterval(r)}),[e,h]),r}const wh=({size:t=61,...r})=>e.jsx("svg",{width:t,height:t,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r,children:e.jsxs("g",{id:"moonpay_symbol_wht 2",children:[e.jsx("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),e.jsx("path",{id:"Vector",d:"M43.8884 23.3258C45.0203 23.3258 46.1268 22.9901 47.068 22.3613C48.0091 21.7324 48.7427 20.8386 49.1759 19.7928C49.6091 18.747 49.7224 17.5962 49.5016 16.4861C49.2807 15.3759 48.7357 14.3561 47.9353 13.5557C47.1349 12.7553 46.1151 12.2102 45.0049 11.9893C43.8947 11.7685 42.7439 11.8819 41.6982 12.3151C40.6524 12.7482 39.7585 13.4818 39.1297 14.423C38.5008 15.3641 38.1651 16.4707 38.1651 17.6026C38.165 18.3542 38.3131 19.0985 38.6007 19.7929C38.8883 20.4873 39.3098 21.1182 39.8413 21.6496C40.3728 22.1811 41.0037 22.6027 41.6981 22.8903C42.3925 23.1778 43.1367 23.3259 43.8884 23.3258ZM26.3395 49.1017C23.5804 49.1017 20.8832 48.2836 18.5891 46.7507C16.295 45.2178 14.5069 43.039 13.4511 40.49C12.3952 37.9409 12.1189 35.1359 12.6572 32.4298C13.1955 29.7237 14.5241 27.238 16.4751 25.287C18.4262 23.336 20.9118 22.0074 23.6179 21.4691C26.324 20.9308 29.129 21.2071 31.6781 22.2629C34.2272 23.3189 36.406 25.1069 37.9389 27.401C39.4717 29.6952 40.2899 32.3923 40.2899 35.1514C40.2899 36.9835 39.9291 38.7975 39.2281 40.49C38.527 42.1826 37.4994 43.7205 36.204 45.0159C34.9086 46.3113 33.3707 47.3389 31.6781 48.04C29.9856 48.741 28.1715 49.1018 26.3395 49.1017Z",fill:"white"})]})});let xh=({...t})=>e.jsx(Wa,{color:"black",...t}),Ch=t=>{let[r,n]=i.useState(!1);return e.jsx($h,{onClick:()=>{n(!0),navigator.clipboard.writeText(t.text),setTimeout((()=>n(!1)),1500)},children:e.jsxs(jh,{children:[r?e.jsx(fc,{style:{height:"16px",width:"16px"},strokeWidth:"2"}):e.jsx(ot.default,{style:{height:"16px",width:"16px"}}),r?"Copied":"Copy address"]})})},Eh=C.styled.div`
|
|
1876
1876
|
display: flex;
|
|
1877
1877
|
flex-direction: row;
|
|
1878
1878
|
gap: 8px;
|
|
@@ -2011,7 +2011,7 @@
|
|
|
2011
2011
|
margin-left: 1.75rem;
|
|
2012
2012
|
margin-right: 1.75rem;
|
|
2013
2013
|
padding: 2rem 0;
|
|
2014
|
-
`;const Gh=()=>{let{enabled:t,token:r}=
|
|
2014
|
+
`;const Gh=()=>{let{enabled:t,token:r}=ba(),{navigate:n,setModalData:i}=g.usePrivyModal(),{initLoginWithPasskey:a}=o.usePrivyInternal();return e.jsx(zh,{onClick:async()=>{t&&!r?(i({captchaModalData:{callback:e=>a(e),userIntentRequired:!1,onSuccessNavigateTo:g.ModalScreen.AWAITING_PASSKEY_SYSTEM_DIALOGUE,onErrorNavigateTo:g.ModalScreen.ERROR_SCREEN}}),n(g.ModalScreen.CAPTCHA_SCREEN)):(await a(),n(g.ModalScreen.AWAITING_PASSKEY_SYSTEM_DIALOGUE))},children:"I have a passkey"})};let qh=C.css`
|
|
2015
2015
|
&& {
|
|
2016
2016
|
width: 100%;
|
|
2017
2017
|
font-size: 0.875rem;
|
|
@@ -2077,7 +2077,7 @@
|
|
|
2077
2077
|
margin-bottom: auto;
|
|
2078
2078
|
}
|
|
2079
2079
|
}
|
|
2080
|
-
`,ep=()=>{let t=Oe.isFirefox?"https://addons.mozilla.org/en-US/firefox/addon/phantom-app/":"https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa?hl=en";return e.jsxs(tp,{children:[e.jsx(rl,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),e.jsx(Gs,{children:e.jsx(
|
|
2080
|
+
`,ep=()=>{let t=Oe.isFirefox?"https://addons.mozilla.org/en-US/firefox/addon/phantom-app/":"https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa?hl=en";return e.jsxs(tp,{children:[e.jsx(rl,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),e.jsx(Gs,{children:e.jsx(qa,{style:{width:"152px",height:"152px"}})}),e.jsxs(Zh,{children:[e.jsx(Jh,{children:e.jsxs("div",{children:[e.jsx("span",{children:"Install the "}),e.jsx("a",{href:t,target:"_blank",children:"Phantom browser extension"})]})}),e.jsx(Xh,{}),e.jsx(Jh,{children:"Set up your first wallet"}),e.jsx(Xh,{}),e.jsx(Jh,{children:"Store your recovery phrase in a safe place!"})]}),e.jsx(Io,{onClick:()=>window.location.reload(),children:"Reload the page to use your wallet"})]})};let tp=C.styled(Gs)`
|
|
2081
2081
|
gap: 30px;
|
|
2082
2082
|
|
|
2083
2083
|
> :first-child > svg {
|
|
@@ -2090,7 +2090,7 @@
|
|
|
2090
2090
|
padding: 24px 0;
|
|
2091
2091
|
flex-grow: 1;
|
|
2092
2092
|
justify-content: center;
|
|
2093
|
-
`,sp=i.forwardRef(((t,r)=>{let[n,a]=i.useState(t.defaultValue||""),[s,l]=i.useState(!1),{authenticated:c}=o.usePrivy(),{initLoginWithEmail:u}=o.usePrivyInternal(),{navigate:h,setModalData:p,currentScreen:y,data:m}=g.usePrivyModal(),{enabled:f,token:v}=
|
|
2093
|
+
`,sp=i.forwardRef(((t,r)=>{let[n,a]=i.useState(t.defaultValue||""),[s,l]=i.useState(!1),{authenticated:c}=o.usePrivy(),{initLoginWithEmail:u}=o.usePrivyInternal(),{navigate:h,setModalData:p,currentScreen:y,data:m}=g.usePrivyModal(),{enabled:f,token:v}=ba(),[w,x]=i.useState(!1),{accountType:C}=d.useRecentlyUsedLogin(),E=d.validateEmail(n),b=s||!E,S=()=>{!f||v||c?(e=>{l(!0),u(n,e,m?.login?.disableSignup).then((()=>{h(g.ModalScreen.AWAITING_PASSWORDLESS_CODE)})).catch((e=>{p({errorModalData:{error:e,previousScreen:y||g.ModalScreen.LANDING}}),h(g.ModalScreen.ERROR_SCREEN)})).finally((()=>{l(!1)}))})(v):(p({captchaModalData:{callback:e=>u(n,e),userIntentRequired:!1,onSuccessNavigateTo:g.ModalScreen.AWAITING_PASSWORDLESS_CODE,onErrorNavigateTo:g.ModalScreen.ERROR_SCREEN}}),h(g.ModalScreen.CAPTCHA_SCREEN))};return e.jsxs(e.Fragment,{children:[e.jsx(lp,{children:e.jsxs(dp,{stacked:t.stacked,children:[e.jsx(Ke.default,{}),e.jsx("input",{ref:r,id:"email-input",type:"email",placeholder:"your@email.com",onFocus:()=>x(!0),onChange:e=>a(e.target.value),onKeyUp:e=>{"Enter"===e.key&&S()},value:n,autoComplete:"email"}),"email"!==C||w?t.stacked?e.jsx("span",{}):e.jsx(Mo,{isSubmitting:s,onClick:S,disabled:b,children:"Submit"}):e.jsx(d.Chip,{color:"gray",children:"Recent"})]})}),t.stacked?e.jsx(jo,{loadingText:null,loading:s,disabled:b,onClick:S,children:"Submit"}):null]})}));let lp=C.styled.div`
|
|
2094
2094
|
width: 100%;
|
|
2095
2095
|
`,dp=C.styled.label`
|
|
2096
2096
|
display: block;
|
|
@@ -2159,7 +2159,7 @@
|
|
|
2159
2159
|
&& > input::placeholder {
|
|
2160
2160
|
color: var(--privy-color-foreground-3);
|
|
2161
2161
|
}
|
|
2162
|
-
`;const cp=({isEditable:t,setIsEditable:r,defaultValue:n})=>{let a=i.useRef(null);return e.jsxs(e.Fragment,{children:[e.jsx(ns,{$if:!t,children:e.jsx(sp,{ref:a,defaultValue:n})}),e.jsx(ns,{$if:t,children:e.jsxs(ts,{onClick:()=>{r(),setTimeout((()=>{a.current?.focus()}),0)},children:[e.jsx(Ke.default,{})," Continue with Email"]})})]})},up=()=>{let[t,r]=i.useState(!1),{currentScreen:n,navigate:a,setModalData:s,data:l}=g.usePrivyModal(),{enabled:c,token:u}=
|
|
2162
|
+
`;const cp=({isEditable:t,setIsEditable:r,defaultValue:n})=>{let a=i.useRef(null);return e.jsxs(e.Fragment,{children:[e.jsx(ns,{$if:!t,children:e.jsx(sp,{ref:a,defaultValue:n})}),e.jsx(ns,{$if:t,children:e.jsxs(ts,{onClick:()=>{r(),setTimeout((()=>{a.current?.focus()}),0)},children:[e.jsx(Ke.default,{})," Continue with Email"]})})]})},up=()=>{let[t,r]=i.useState(!1),{currentScreen:n,navigate:a,setModalData:s,data:l}=g.usePrivyModal(),{enabled:c,token:u}=ba(),{initLoginWithFarcaster:h}=o.usePrivyInternal(),{accountType:p}=d.useRecentlyUsedLogin();return e.jsxs(ts,{onClick:async()=>{r(!0);try{c&&!u?(s({captchaModalData:{callback:e=>h(e,l?.login?.disableSignup),userIntentRequired:!0,onSuccessNavigateTo:g.ModalScreen.AWAITING_FARCASTER_CONNECTION,onErrorNavigateTo:g.ModalScreen.ERROR_SCREEN}}),a(g.ModalScreen.CAPTCHA_SCREEN)):(await h(u,l?.login?.disableSignup),a(g.ModalScreen.AWAITING_FARCASTER_CONNECTION))}catch(e){s({errorModalData:{error:e,previousScreen:n||g.ModalScreen.LANDING}}),a(g.ModalScreen.ERROR_SCREEN)}finally{r(!1)}},disabled:!1,children:[e.jsx(_c,{})," Farcaster",t&&e.jsx(bo,{}),"farcaster"===p&&e.jsx(hp,{color:"gray",children:"Recent"})]})};let hp=C.styled(d.Chip)`
|
|
2163
2163
|
margin-left: auto;
|
|
2164
2164
|
`;const pp=({value:t,onChange:r})=>e.jsx("select",{value:t,onChange:r,children:Ai.map((t=>e.jsxs("option",{value:t.code,children:[t.code," +",t.callCode]},t.code)))}),yp=i.forwardRef(((t,r)=>{let{app:n}=g.usePrivyModal(),[a,o]=i.useState(!1),{accountType:s}=d.useRecentlyUsedLogin(),[l,c]=i.useState(""),[u,h]=i.useState(n?.intl.defaultCountry??"US"),p=Ei(l,u),y=(e=>new xi(e))(u),m=(e=>{let t=function(){return hr(wi,arguments)}(e,cr)?.formatInternational();return t?.substring(t.indexOf(" ")+1)})(u),f=Ci(u),v=!p,[w,x]=i.useState(!1),C=f.length,E=e=>{let r=e.target.value;h(r),c(""),t.onChange&&t.onChange({rawPhoneNumber:l,qualifiedPhoneNumber:bi(l,r),countryCode:r,isValid:Ei(l,u)})},b=(e,r)=>{try{let n=e.replace(/\D/g,"")===l.replace(/\D/g,"")?e:y.input(e);c(n),t.onChange&&t.onChange({rawPhoneNumber:n,qualifiedPhoneNumber:bi(e,r),countryCode:r,isValid:Ei(e,r)})}catch(e){console.error("Error processing phone number:",e)}},S=()=>{x(!0);let e=bi(l,u);t.onSubmit({rawPhoneNumber:l,qualifiedPhoneNumber:e,countryCode:u,isValid:Ei(l,u)}).finally((()=>x(!1)))};return i.useEffect((()=>{if(t.defaultValue){let e=(e=>{let t=new xi;t.input(e);let r=t.getCountry()||"US",n=t.getCallingCode()||"1";return{countryCode:r,phone:e.replace("+"+n,"")}})(t.defaultValue);y.reset(),E({target:{value:e.countryCode}}),b(e.phone,e.countryCode)}}),[t.defaultValue]),e.jsxs(e.Fragment,{children:[e.jsx(mp,{children:e.jsxs(fp,{callingCodeLength:C,stacked:t.stacked,children:[e.jsx(pp,{value:u,onChange:E}),e.jsx("input",{ref:r,id:"phone-number-input",type:"tel",placeholder:m,onFocus:()=>o(!0),onChange:e=>{b(e.target.value,u)},onKeyUp:e=>{"Enter"===e.key&&S()},value:l,autoComplete:"tel"}),"phone"!==s||a||t.hideRecent?t.stacked||t.noIncludeSubmitButton?e.jsx("span",{}):e.jsx(Mo,{isSubmitting:w,onClick:S,disabled:v,children:"Submit"}):e.jsx(d.Chip,{color:"gray",children:"Recent"})]})}),t.stacked&&!t.noIncludeSubmitButton?e.jsx(jo,{loading:w,loadingText:null,onClick:S,disabled:v,children:"Submit"}):null]})}));let mp=C.styled.div`
|
|
2165
2165
|
width: 100%;
|
|
@@ -2256,9 +2256,9 @@
|
|
|
2256
2256
|
&& > input::placeholder {
|
|
2257
2257
|
color: var(--privy-color-foreground-3);
|
|
2258
2258
|
}
|
|
2259
|
-
`;const gp=({isEditable:t,setIsEditable:r,defaultValue:n})=>{let a=i.useRef(null),{authenticated:s}=o.usePrivy(),{navigate:l,setModalData:d,currentScreen:c,data:u}=g.usePrivyModal(),{initLoginWithSms:h}=o.usePrivyInternal(),{enabled:p,token:y}=
|
|
2259
|
+
`;const gp=({isEditable:t,setIsEditable:r,defaultValue:n})=>{let a=i.useRef(null),{authenticated:s}=o.usePrivy(),{navigate:l,setModalData:d,currentScreen:c,data:u}=g.usePrivyModal(),{initLoginWithSms:h}=o.usePrivyInternal(),{enabled:p,token:y}=ba();return e.jsxs(e.Fragment,{children:[e.jsx(ns,{$if:!t,children:e.jsx(yp,{ref:a,onSubmit:async function({qualifiedPhoneNumber:e}){if(!p||y||s)try{await h(e,y,u?.login?.disableSignup),l(g.ModalScreen.AWAITING_PASSWORDLESS_CODE)}catch(e){d({errorModalData:{error:e,previousScreen:c||g.ModalScreen.LANDING}}),l(g.ModalScreen.ERROR_SCREEN)}else d({captchaModalData:{callback:t=>h(e,t,u?.login?.disableSignup),userIntentRequired:!1,onSuccessNavigateTo:g.ModalScreen.AWAITING_PASSWORDLESS_CODE,onErrorNavigateTo:g.ModalScreen.ERROR_SCREEN}}),l(g.ModalScreen.CAPTCHA_SCREEN)},defaultValue:n})}),e.jsx(ns,{$if:t,children:e.jsxs(ts,{onClick:()=>{r(),setTimeout((()=>{a.current?.focus()}),0)},children:[e.jsx(Ye.default,{})," Continue with SMS"]})})]})};let vp={apple:{logo:e.jsx(ea,{}),displayName:"Apple"},discord:{logo:e.jsx(ta,{}),displayName:"Discord"},github:{logo:e.jsx(ra,{}),displayName:"GitHub"},google:{logo:e.jsx(ia,{}),displayName:"Google"},linkedin:{logo:e.jsx(oa,{}),displayName:"LinkedIn"},spotify:{logo:e.jsx(sa,{}),displayName:"Spotify"},instagram:{logo:e.jsx(aa,{}),displayName:"Instagram"},twitter:{logo:e.jsx(da,{}),displayName:"Twitter"},tiktok:{logo:e.jsx(la,{}),displayName:"TikTok"}};const wp=({provider:t})=>{let{enabled:r,token:n}=ba(),{navigate:a,setModalData:s,data:l}=g.usePrivyModal(),[c,u]=i.useState(!1),{initLoginWithOAuth:h}=o.usePrivyInternal(),{accountType:p}=d.useRecentlyUsedLogin(),y=p?np(p):null,{displayName:m,logo:f}=vp[t];return e.jsxs(ts,{onClick:()=>{u(!0),r&&!n?(s({captchaModalData:{callback:e=>h(t,e,l?.login?.disableSignup),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:g.ModalScreen.ERROR_SCREEN}}),a(g.ModalScreen.CAPTCHA_SCREEN)):h(t,void 0,l?.login?.disableSignup)},disabled:c,children:[f," ",m,y?.loginMethod===t&&e.jsx(xp,{color:"gray",children:"Recent"})]})};let xp=C.styled(d.Chip)`
|
|
2260
2260
|
margin-left: auto;
|
|
2261
|
-
`;function Cp(t){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 240 240",...t,children:[e.jsx("defs",{children:e.jsxs("linearGradient",{x1:"120",y1:"240",x2:"120",gradientUnits:"userSpaceOnUse",id:"telegram-linear-gradient",children:[e.jsx("stop",{offset:"0",stopColor:"#1d93d2"}),e.jsx("stop",{offset:"1",stopColor:"#38b0e3"})]})}),e.jsx("title",{children:"Telegram_logo"}),e.jsx("circle",{cx:"120",cy:"120",r:"120",fill:"url(#telegram-linear-gradient)"}),e.jsx("path",{d:"M81.229,128.772l14.237,39.406s1.78,3.687,3.686,3.687,30.255-29.492,30.255-29.492l31.525-60.89L81.737,118.6Z",fill:"#c8daea"}),e.jsx("path",{d:"M100.106,138.878l-2.733,29.046s-1.144,8.9,7.754,0,17.415-15.763,17.415-15.763",fill:"#a9c6d8"}),e.jsx("path",{d:"M81.486,130.178,52.2,120.636s-3.5-1.42-2.373-4.64c.232-.664.7-1.229,2.1-2.2,6.489-4.523,120.106-45.36,120.106-45.36s3.208-1.081,5.1-.362a2.766,2.766,0,0,1,1.885,2.055,9.357,9.357,0,0,1,.254,2.585c-.009.752-.1,1.449-.169,2.542-.692,11.165-21.4,94.493-21.4,94.493s-1.239,4.876-5.678,5.043A8.13,8.13,0,0,1,146.1,172.5c-8.711-7.493-38.819-27.727-45.472-32.177a1.27,1.27,0,0,1-.546-.9c-.093-.469.417-1.05.417-1.05s52.426-46.6,53.821-51.492c.108-.379-.3-.566-.848-.4-3.482,1.281-63.844,39.4-70.506,43.607A3.21,3.21,0,0,1,81.486,130.178Z",fill:"#fff"})]})}const Ep=()=>{let{enabled:t,token:r}=
|
|
2261
|
+
`;function Cp(t){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 240 240",...t,children:[e.jsx("defs",{children:e.jsxs("linearGradient",{x1:"120",y1:"240",x2:"120",gradientUnits:"userSpaceOnUse",id:"telegram-linear-gradient",children:[e.jsx("stop",{offset:"0",stopColor:"#1d93d2"}),e.jsx("stop",{offset:"1",stopColor:"#38b0e3"})]})}),e.jsx("title",{children:"Telegram_logo"}),e.jsx("circle",{cx:"120",cy:"120",r:"120",fill:"url(#telegram-linear-gradient)"}),e.jsx("path",{d:"M81.229,128.772l14.237,39.406s1.78,3.687,3.686,3.687,30.255-29.492,30.255-29.492l31.525-60.89L81.737,118.6Z",fill:"#c8daea"}),e.jsx("path",{d:"M100.106,138.878l-2.733,29.046s-1.144,8.9,7.754,0,17.415-15.763,17.415-15.763",fill:"#a9c6d8"}),e.jsx("path",{d:"M81.486,130.178,52.2,120.636s-3.5-1.42-2.373-4.64c.232-.664.7-1.229,2.1-2.2,6.489-4.523,120.106-45.36,120.106-45.36s3.208-1.081,5.1-.362a2.766,2.766,0,0,1,1.885,2.055,9.357,9.357,0,0,1,.254,2.585c-.009.752-.1,1.449-.169,2.542-.692,11.165-21.4,94.493-21.4,94.493s-1.239,4.876-5.678,5.043A8.13,8.13,0,0,1,146.1,172.5c-8.711-7.493-38.819-27.727-45.472-32.177a1.27,1.27,0,0,1-.546-.9c-.093-.469.417-1.05.417-1.05s52.426-46.6,53.821-51.492c.108-.379-.3-.566-.848-.4-3.482,1.281-63.844,39.4-70.506,43.607A3.21,3.21,0,0,1,81.486,130.178Z",fill:"#fff"})]})}const Ep=()=>{let{enabled:t,token:r}=ba(),{navigate:n,setModalData:a,data:s}=g.usePrivyModal(),[l,c]=i.useState(!1),{initLoginWithTelegram:u}=o.usePrivyInternal(),{accountType:h}=d.useRecentlyUsedLogin();async function p(e){try{await u(e,s?.login?.disableSignup),a({telegramAuthModalData:{seamlessAuth:!1}}),n(g.ModalScreen.TELEGRAM_AUTH_SCREEN)}catch(e){console.error(e),c(!1)}}return e.jsxs(ts,{onClick:async function(){if(c(!0),t&&!r)return a({captchaModalData:{callback:p,userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:g.ModalScreen.ERROR_SCREEN}}),void n(g.ModalScreen.CAPTCHA_SCREEN);await p(r)},disabled:l,children:[e.jsx(Cp,{}),"Telegram","telegram"===h&&e.jsx(bp,{color:"gray",children:"Recent"})]})};let bp=C.styled(d.Chip)`
|
|
2262
2262
|
margin-left: auto;
|
|
2263
2263
|
`;const Sp=({onClick:t,text:r,icon:n})=>e.jsxs(ts,{onClick:t,children:[n,e.jsx(Yo,{children:r}),e.jsx(xt.default,{})]}),Ap=({connectOnly:t})=>{let{closePrivyModal:r,connectors:n}=o.usePrivyInternal(),{app:a,onUserCloseViaDialogOrKeybindRef:s,data:c}=g.usePrivyModal(),{appearance:{palette:{colorScheme:u}}}=l.useAppConfig(),{accountType:h,walletClientType:p}=d.useRecentlyUsedLogin(),y=h?np(h):null,m=a.loginMethodsAndOrder?.primary??[],f=a.loginMethodsAndOrder?.overflow??[],v=[...m,...f],w=a.loginMethods.passkey,x=c?.login,C=[];p&&v.includes(p)?C.push(p):h&&v.includes(y?.loginMethod)&&C.push(y?.loginMethod);let[E,b]=i.useState("default"),[S,A]=i.useState("phone"===h?"sms":"email");i.useEffect((()=>{"phone"===h&&A("sms");let e=v.indexOf("sms"),t=v.indexOf("email");e>-1&&e<t&&A("sms")}),[h,m,f]);let j=()=>{r({shouldCallAuthOnSuccess:!0}),setTimeout((()=>{b("default")}),150)};s.current=j;let $=r=>"email"===r?e.jsx(cp,{isEditable:"email"===S,setIsEditable:()=>{A("email")},defaultValue:"email"===x?.prefill?.type?x.prefill.value:void 0},r):"sms"===r?e.jsx(gp,{isEditable:"sms"===S,setIsEditable:()=>{A("sms")},defaultValue:"phone"===x?.prefill?.type?x.prefill.value:void 0},r):"apple"===r?e.jsx(wp,{provider:"apple"},r):"discord"===r?e.jsx(wp,{provider:"discord"},r):"farcaster"===r?e.jsx(up,{},r):"github"===r?e.jsx(wp,{provider:"github"},r):"google"===r?e.jsx(wp,{provider:"google"},r):"linkedin"===r?e.jsx(wp,{provider:"linkedin"},r):"spotify"===r?e.jsx(wp,{provider:"spotify"},r):"instagram"===r?e.jsx(wp,{provider:"instagram"},r):"tiktok"===r?e.jsx(wp,{provider:"tiktok"},r):"twitter"===r?e.jsx(wp,{provider:"twitter"},r):"telegram"===r?e.jsx(Ep,{},r):Rl([r],a.appearance.walletChainType,n,t,v,a.externalWallets.walletConnect.enabled),T=C.flatMap($),P=m.filter((e=>e!==p&&e!==y?.loginMethod)).flatMap($),_=f.filter((e=>e!==p&&e!==y?.loginMethod)).flatMap($),[k,N]=d.splitAtIndex([...T,...P,..._],jp({primary:P.length+T.length,overflow:_.length}));return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{title:a.appearance.landingHeader,onClose:j,backFn:"default"===E?void 0:()=>{b("default")}}),"default"===E&&e.jsx($p,{}),"default"===E&&("string"==typeof a.appearance.loginMessage?e.jsx(es,{children:a.appearance.loginMessage}):a.appearance.loginMessage),e.jsx(Zo,{style:{overflow:"hidden"},children:e.jsxs(Jo,{$colorScheme:u,style:{maxHeight:400,overflowY:"scroll",padding:2},children:["default"===E&&e.jsxs(e.Fragment,{children:[...k,N.length>0&&e.jsx(Sp,{text:"More options",icon:e.jsx(st.default,{}),onClick:()=>b("overflow")})]}),"overflow"===E&&e.jsxs(e.Fragment,{children:[...N]}),w&&"default"===E&&e.jsx(Gh,{})]})}),a&&e.jsx(d.TermsAndConditions,{app:a}),e.jsx(d.BlobbyFooter,{})]})};let jp=({primary:e,overflow:t})=>e<5?e:5===e&&0===t?5:4,$p=C.styled(ap)`
|
|
2264
2264
|
margin-bottom: 16px;
|
|
@@ -2420,7 +2420,7 @@
|
|
|
2420
2420
|
border-radius: var(--privy-border-radius-full);
|
|
2421
2421
|
background-color: var(--privy-color-background-2);
|
|
2422
2422
|
padding: 4px 8px;
|
|
2423
|
-
`,cy=new Intl.NumberFormat(void 0,{style:"currency",currency:"USD",maximumFractionDigits:2});function uy(e,t=6,r=!1){let n=(parseFloat(e.toString())/1e9).toFixed(t).replace(/0+$/,"").replace(/\.$/,"");return r?`${n} SOL`:`${"0"===n?"<0.001":n} SOL`}function hy(e,t){let r=parseFloat(e.toString())/1e9,n=cy.format(t*r);return"$0.00"===n?"<$0.01":n}function py(e){return"version"in e}function yy(e,t,r=0){let n="from"===t?0:"to"===t?1:2;if(py(e)){let
|
|
2423
|
+
`,cy=new Intl.NumberFormat(void 0,{style:"currency",currency:"USD",maximumFractionDigits:2});function uy(e,t=6,r=!1){let n=(parseFloat(e.toString())/1e9).toFixed(t).replace(/0+$/,"").replace(/\.$/,"");return r?`${n} SOL`:`${"0"===n?"<0.001":n} SOL`}function hy(e,t){let r=parseFloat(e.toString())/1e9,n=cy.format(t*r);return"$0.00"===n?"<$0.01":n}function py(e){return"version"in e}function yy(e,t,r=0){let n="from"===t?0:"to"===t?1:2;if(py(e)){let i=e.message.getAccountKeys(),a=e.message.compiledInstructions.at(r)?.accountKeyIndexes[n];if(null==a)throw Error(`Transaction does not contain a "${t}" public key`);let o=i.get(a);if(!o)throw Error(`Transaction does not contain a "${t}" public key`);return o}let i=e.instructions.at(r)?.keys.at(n)?.pubkey;if(null==i)throw Error(`Transaction does not contain a "${t}" public key`);return i}function my(e,t=!1,r=0){let n=t?1:4;if(py(e)){let t=e.message.compiledInstructions.at(r)?.data;if(!t)throw Error("Transaction does not contain data");return Buffer.from(t).readBigInt64LE(n)}let i=e.instructions.at(r)?.data.readBigInt64LE(n);if(null==i)throw Error("Transaction does not contain lamports");return i}function fy(e,t=0){let r;if(py(e)){let n=e.message.compiledInstructions.at(t)?.programIdIndex;if(null==n)throw Error("Transaction does not contain a Program ID");r=e.message.getAccountKeys().get(n)?.toBase58()}else r=e.instructions.at(t)?.programId.toBase58();if(!r)throw Error("Transaction does not contain a Program ID");if("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"===r)return"approve";if("11111111111111111111111111111111"===r)return"transfer";throw Error("Unsupported Program ID")}function gy(e,t){return{signature:e,parsedTransaction:t,fees:BigInt(t?.meta?.fee||0)}}async function vy(e,t){let r=[],n=py(e)?e.message.compiledInstructions.length:e.instructions.length,i={},a=BigInt(await async function(e,t){return py(e)?(await t.getFeeForMessage(e.message)).value:await e.getEstimatedFee(t)}(e,t)||0);for(let a=0;a<n;a++){let n=fy(e,a),o=yy(e,"from",a),s=yy(e,"to",a),l=my(e,"approve"===n,a),d="transfer"===n?void 0:yy(e,"owner",a);null==i[o.toBase58()]&&(i[o.toBase58()]=BigInt(await t.getBalance(o)));let c=i[o.toBase58()]||0n;r.push({from:o,to:s,spender:d,action:n,amount:l,balance:c,hasFunds:c>=l})}return{fees:a,instructions:r}}const wy=({weiQuantities:t,tokenPrice:r,tokenSymbol:n})=>{let i=d.sumWeiQuantitiesToHexString(t),a=r?d.getDollarsFromWei(i,r):void 0,o=d.getNativeCurrencyFromWei(i,n);return e.jsx(Ey,{children:a||o})},xy=({weiQuantities:t,tokenPrice:r,tokenSymbol:n})=>{let i=d.sumWeiQuantitiesToHexString(t),a=r?d.getDollarsFromWei(i,r):void 0,o=d.getNativeCurrencyFromWei(i,n);return e.jsx(Ey,{children:a?e.jsxs(e.Fragment,{children:[e.jsx(by,{children:"USD"}),"<$0.01"===a?e.jsxs(Ay,{children:[e.jsx(Sy,{children:"<"}),"$0.01"]}):a]}):o})},Cy=({quantities:t,tokenPrice:r})=>{let n=t.reduce(((e,t)=>e+t),0n),i=r?hy(n,r):void 0,a=uy(n);return e.jsx(Ey,{children:i?e.jsx(e.Fragment,{children:"<$0.01"===i?e.jsxs(Ay,{children:[e.jsx(Sy,{children:"<"}),"$0.01"]}):i}):a})};let Ey=C.styled.span`
|
|
2424
2424
|
font-size: 14px;
|
|
2425
2425
|
line-height: 140%;
|
|
2426
2426
|
display: flex;
|
|
@@ -2844,7 +2844,7 @@
|
|
|
2844
2844
|
margin-left: 27px;
|
|
2845
2845
|
margin-right: 27px;
|
|
2846
2846
|
gap: 24px;
|
|
2847
|
-
`;const Mf=i.forwardRef(((t,r)=>{let[n,a]=i.useState(""),[s,l]=i.useState(!1),{authenticated:c,user:u}=o.usePrivy(),{initUpdateEmail:h}=o.usePrivyInternal(),{navigate:p,setModalData:y,currentScreen:m}=g.usePrivyModal(),{enabled:f,token:v}=
|
|
2847
|
+
`;const Mf=i.forwardRef(((t,r)=>{let[n,a]=i.useState(""),[s,l]=i.useState(!1),{authenticated:c,user:u}=o.usePrivy(),{initUpdateEmail:h}=o.usePrivyInternal(),{navigate:p,setModalData:y,currentScreen:m}=g.usePrivyModal(),{enabled:f,token:v}=ba(),w=d.validateEmail(n),x=s||!w,C=()=>{!f||v||c?(async e=>{if(!u?.email)throw Error("User is required to have an email address to update it.");l(!0);try{await h(u.email.address,n,e),p(g.ModalScreen.AWAITING_PASSWORDLESS_CODE)}catch(e){y({errorModalData:{error:e,previousScreen:m||g.ModalScreen.LANDING}})}l(!1)})(v):(y({captchaModalData:{callback:e=>{if(!u?.email)throw Error("User is required to have an email address to update it.");return h(u.email.address,n,e)},userIntentRequired:!1,onSuccessNavigateTo:g.ModalScreen.AWAITING_PASSWORDLESS_CODE,onErrorNavigateTo:g.ModalScreen.ERROR_SCREEN}}),p(g.ModalScreen.CAPTCHA_SCREEN))};return e.jsxs(e.Fragment,{children:[e.jsx(Of,{children:e.jsxs(Rf,{children:[e.jsx(Ke.default,{}),e.jsx("input",{ref:r,id:"email-input",type:"email",placeholder:"your@email.com",onChange:e=>a(e.target.value),onKeyUp:e=>{"Enter"===e.key&&C()},value:n,autoComplete:"email"}),t.stacked?null:e.jsx(Mo,{isSubmitting:s,onClick:C,disabled:x,children:"Submit"})]})}),t.stacked?e.jsx(jo,{loadingText:null,loading:s,disabled:x,onClick:C,children:"Submit"}):null]})}));let Of=C.styled.div`
|
|
2848
2848
|
width: 100%;
|
|
2849
2849
|
`,Rf=C.styled.label`
|
|
2850
2850
|
display: block;
|
|
@@ -3092,7 +3092,7 @@
|
|
|
3092
3092
|
align-items: center;
|
|
3093
3093
|
justify-content: center;
|
|
3094
3094
|
height: 100%;
|
|
3095
|
-
`;let Yf={[g.ModalScreen.LANDING]:()=>{let{app:t}=g.usePrivyModal();return t.loginMethodsAndOrder&&t.loginMethodsAndOrder.primary.length>0?e.jsx(Ap,{connectOnly:!1}):e.jsx(Pp,{connectOnly:!1})},[g.ModalScreen.CONNECT_OR_CREATE]:()=>{let{app:t}=g.usePrivyModal();return t.loginMethodsAndOrder&&t.loginMethodsAndOrder.primary.length>0?e.jsx(Ap,{connectOnly:!0}):e.jsx(Pp,{connectOnly:!0})},[g.ModalScreen.AWAITING_PASSWORDLESS_CODE]:()=>{let{app:t,navigate:r,lastScreen:n,navigateBack:s,setModalData:c,onUserCloseViaDialogOrKeybindRef:h}=g.usePrivyModal(),{closePrivyModal:p,resendEmailCode:y,resendSmsCode:m,getAuthMeta:f,loginWithCode:v,updateWallets:w,createAnalyticsEvent:x}=o.usePrivyInternal(),{authenticated:C,logout:E,user:b}=o.usePrivy(),[S,A]=i.useState(ul),[j,$]=i.useState(!1),[T,P]=i.useState(null),[_,k]=i.useState(null),[N,I]=i.useState(0);h.current=()=>null;let M=f()?.email?0:1,O=l.DEFAULT_SUCCESS_SCREEN_DURATION_MS-500;i.useEffect((()=>{if(N){let e=setTimeout((()=>{I(N-1)}),1e3);return()=>clearTimeout(e)}}),[N]),i.useEffect((()=>{if(C&&j&&b){if(t?.legal.requireUsersAcceptTerms&&!b.hasAcceptedTerms){let e=setTimeout((()=>{r(g.ModalScreen.AFFIRMATIVE_CONSENT_SCREEN)}),O);return()=>clearTimeout(e)}if(u.shouldProceedtoEmbeddedWalletCreationFlow(b,t?.embeddedWallets?.createOnLogin)){let e=setTimeout((()=>{c({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),x({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"AwaitingPasswordlessCodeScreen"}}),E()},callAuthOnSuccessOnClose:!0}}),r(g.ModalScreen.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}),O);return()=>clearTimeout(e)}{w();let e=setTimeout((()=>p({shouldCallAuthOnSuccess:!0,isSuccess:!0})),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}}}),[C,j,b]),i.useEffect((()=>{if(T&&0===_){let e=setTimeout((()=>{A(ul),P(null);let e=document.querySelector("input[name=code-0]");e?.focus()}),1400);return()=>clearTimeout(e)}}),[T]);let R=e=>{e.preventDefault();let t=e.currentTarget.value.replace(" ","");if(""===t)return;if(isNaN(Number(t)))return P("Code should be numeric"),void k(1);P(null),k(null);let i=Number(e.currentTarget.name?.charAt(5)),a=[...t||[""]].slice(0,6-i),s=[...S.slice(0,i),...a,...S.slice(i+a.length)];A(s);let l=Math.min(Math.max(i+a.length,0),5);if(!isNaN(Number(e.currentTarget.value))){let e=document.querySelector(`input[name=code-${l}]`);e?.focus()}if(s.every((e=>e&&!isNaN(+e)))){let e=document.querySelector(`input[name=code-${l}]`);e?.blur(),v(s.join("")).then((()=>$(!0))).catch((e=>{if(e instanceof o.PrivyApiError&&e.privyErrorCode===o.PrivyErrorCode.INVALID_CREDENTIALS)P("Invalid or expired verification code");else if(e instanceof o.PrivyApiError&&e.privyErrorCode===o.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE)P(e.message);else{if(e instanceof o.PrivyApiError&&e.privyErrorCode===o.PrivyErrorCode.USER_LIMIT_REACHED)return console.error(new o.PrivyUserLimitReachedError(e).toString()),void r(g.ModalScreen.USER_LIMIT_REACHED_SCREEN);if(e instanceof o.PrivyApiError&&e.privyErrorCode===o.PrivyErrorCode.USER_DOES_NOT_EXIST)return void r(g.ModalScreen.ACCOUNT_NOT_FOUND_SCREEN);if(e instanceof o.PrivyApiError&&e.privyErrorCode===o.PrivyErrorCode.LINKED_TO_ANOTHER_USER)return c({errorModalData:{error:e,previousScreen:n??g.ModalScreen.AWAITING_PASSWORDLESS_CODE}}),void r(g.ModalScreen.ERROR_SCREEN,!1);if(e instanceof o.PrivyApiError&&e.privyErrorCode===o.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return c({accountTransfer:{nonce:e.data?.data?.nonce,account:0===M?f()?.email:f()?.phoneNumber,displayName:e.data?.data?.account?.displayName,linkMethod:0===M?"email":"sms",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress}}),void r(g.ModalScreen.LINK_CONFLICT_SCREEN);P("Issue verifying code")}k(0)}))}},F=0==M?e.jsx(Ke.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):e.jsx(Ye.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),L=0==M?e.jsxs("p",{children:["Please check ",e.jsx(vl,{children:f()?.email})," for an email from privy.io and enter your code below."]}):e.jsxs("p",{children:["Please check ",e.jsx(vl,{children:f()?.phoneNumber})," for a message from ",t?.name||"Privy"," and enter your code below."]});return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{backFn:()=>s()},"header"),e.jsxs(hl,{children:[e.jsx(il,{title:"Enter confirmation code",description:L,icon:F}),e.jsxs(qs,{children:[e.jsxs(pl,{children:[e.jsx(yl,{$fail:!!T,$success:j,children:e.jsx("span",{children:T||(j?"Success!":"")})}),e.jsx("div",{children:S.map(((t,r)=>e.jsx("input",{name:`code-${r}`,type:"text",value:S[r],onChange:R,onKeyUp:e=>{"Backspace"===e.key&&(e=>{if(1===_&&(P(null),k(null)),A([...S.slice(0,e),"",...S.slice(e+1)]),e>0){let t=document.querySelector(`input[name=code-${e-1}]`);t?.focus()}})(r)},inputMode:"numeric",autoFocus:0===r,pattern:"[0-9]",className:`${j?"success":""} ${T?"fail":""}`,autoComplete:a.isMobile?"one-time-code":"off"},r)))})]}),e.jsxs(ml,{children:[e.jsxs("span",{children:["Didn't get ",0==M?"an email":"a message","?"]}),N?e.jsxs(gl,{children:[e.jsx(Ve.default,{color:"var(--privy-color-foreground)",strokeWidth:1.33,height:"12px",width:"12px"}),e.jsx("span",{children:"Code sent"})]}):e.jsx(fl,{children:e.jsx("button",{onClick:async()=>{I(30),0==M?await y():await m()},children:"Resend code"})})]})]})]}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.AWAITING_CONNECTION]:()=>{let t,[r,n]=i.useState(!1),[s,c]=i.useState(!1),[h,p]=i.useState(void 0),{authenticated:y,logout:f}=o.usePrivy(),{app:v,navigate:w,navigateBack:x,lastScreen:C,currentScreen:E,setModalData:b,data:S}=g.usePrivyModal(),{getAuthFlow:A,walletConnectionStatus:j,closePrivyModal:$,initLoginWithWallet:T,loginWithWallet:P,updateWallets:_,createAnalyticsEvent:k}=o.usePrivyInternal(),{walletConnectors:N}=o.usePrivy(),[I,M]=i.useState(0),{user:O}=o.usePrivy(),[R]=i.useState(O?.linkedAccounts.length||0),[F,L]=i.useState(""),[U,D]=i.useState(""),[W,B]=i.useState(!1),{hasTabbedAway:H}=function(){let[e,t]=i.useState(!1),r=i.useCallback((()=>{document.hidden&&t(!0)}),[]);return i.useEffect((()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r))),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}(),{enabled:G,token:q}=go(),z=a.isMobile&&"wallet_connect_v2"===j?.connector?.connectorType||a.isMobile&&"coinbase_wallet"===j?.connector?.connectorType||a.isMobile&&"injected"===j?.connector?.connectorType&&"phantom"===j?.connector?.walletClientType,V="connected"===j?.status,K="switching_to_supported_chain"===j?.status;i.useEffect((()=>{let e=A(),t=e instanceof fa||e instanceof ga?e:void 0;V&&!t&&(!G||q||y?T(j.connectedWallet,q,S?.login?.disableSignup).then((()=>{B(!0)})):(b({captchaModalData:{callback:e=>T(j.connectedWallet,e,S?.login?.disableSignup).then((()=>{B(!0)})),userIntentRequired:!1,onSuccessNavigateTo:g.ModalScreen.AWAITING_CONNECTION,onErrorNavigateTo:g.ModalScreen.ERROR_SCREEN}}),w(g.ModalScreen.CAPTCHA_SCREEN,!1))),t&&z&&V&&!t.preparedMessage?t.buildMessage():t&&!z&&V&&(s||(async()=>{c(!0),p(void 0);try{"wallet_connect_v2"===j?.connector?.connectorType&&"metamask"===j?.connector?.walletClientType&&await d.sleep(2500),await Z()}catch(e){console.warn("Auto-prompted signature failed",e)}finally{c(!1)}})())}),[I,V,W]),i.useEffect((()=>{if(O&&r){let e=l.DEFAULT_SUCCESS_SCREEN_DURATION_MS-500;if(v?.legal.requireUsersAcceptTerms&&!O.hasAcceptedTerms){let t=setTimeout((()=>{w(g.ModalScreen.AFFIRMATIVE_CONSENT_SCREEN)}),e);return()=>clearTimeout(t)}if(u.shouldProceedtoEmbeddedWalletCreationFlow(O,v?.embeddedWallets?.createOnLogin)){let t=setTimeout((()=>{b({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),k({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"ConnectionStatusScreen"}}),f()},callAuthOnSuccessOnClose:!0}}),w(g.ModalScreen.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}),e);return()=>clearTimeout(t)}_();let t=setTimeout((()=>$({shouldCallAuthOnSuccess:!0,isSuccess:!0})),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(t)}}),[O,r]);let Y=e=>{if(e?.privyErrorCode!==o.PrivyErrorCode.ALLOWLIST_REJECTED){if(e?.privyErrorCode===o.PrivyErrorCode.USER_LIMIT_REACHED)return console.error(new o.PrivyUserLimitReachedError(e).toString()),void w(g.ModalScreen.USER_LIMIT_REACHED_SCREEN);if(e?.privyErrorCode!==o.PrivyErrorCode.USER_DOES_NOT_EXIST)return e?.privyErrorCode===o.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce?(b({accountTransfer:{nonce:e.data?.data?.nonce,account:A()?.meta.address,displayName:e.data?.data?.account?.displayName,externalWalletMetadata:{walletClientType:A()?.meta.walletClientType,chainId:A()?.meta.chainId,connectorType:A()?.meta.connectorType},linkMethod:"siwe",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress}}),void w(g.ModalScreen.LINK_CONFLICT_SCREEN)):void p(Fl(e));w(g.ModalScreen.ACCOUNT_NOT_FOUND_SCREEN)}else w(g.ModalScreen.ALLOWLIST_REJECTION_SCREEN)};async function Z(){try{await P(),n(!0)}catch(e){Y(e)}finally{c(!1)}}i.useEffect((()=>{j?.connectError&&Y(j?.connectError)}),[j]),((e,t)=>{let r=i.useRef((()=>{}));i.useEffect((()=>{r.current=e})),i.useEffect((()=>{if(null!==t){let e=setInterval((()=>r.current()),t||0);return()=>clearInterval(e)}}),[t])})((()=>{let e="wallet_connect_v2"===X&&j?.connector instanceof Xa?j.connector.redirectUri:void 0;e&&L(e);let t="wallet_connect_v2"===X&&j?.connector instanceof Xa?j.connector.fallbackUniversalRedirectUri:void 0;t&&D(t)}),j?.connector instanceof Xa&&!F?500:null);let X=j?.connector?.connectorType||"injected",J=j?.connector?.walletClientType||"unknown",Q=bl[J]?.displayName||j?.connector?.walletBranding.name||"Browser Extension",ee=bl[J]?.logo||j?.connector?.walletBranding.icon||(t=>e.jsx(Ua,{...t})),te="Browser Extension"===Q?Q.toLowerCase():Q;t=r?`Successfully connected with ${te}`:h?h.message:K?"Switching networks":V?s&&z?"Signing":"Sign to verify":`Waiting for ${te}`;let re="Don’t see your wallet? Check your other browser windows.";r?re=R===(O?.linkedAccounts.length||0)?"Wallet was already linked.":"You’re good to go!":I>=2&&h?re="Unable to connect wallet":h?re=h.detail:K?re="Switch your wallet to the requested network.":V&&z?re="Sign the message in your wallet to verify it belongs to you.":"metamask"===J&&a.isMobile?re="Click continue to open and connect MetaMask.":"metamask"===J?re="For the best experience, connect only one wallet at a time.":"wallet_connect"===X?re="Open your mobile wallet app to continue":"coinbase_wallet"!==X||d.isCoinbaseWalletInstalled()||(re=Ja(O)?"Continue with the Coinbase app. Not the right wallet? Reset your connection below.":"Open the Coinbase app on your phone to continue.");let ne=N?.walletConnectors?.find((e=>"coinbase_wallet"===e.walletClientType)),ie="coinbase_wallet"===J&&(Ja(O)||h===m.ConnectorErrors.ERROR_USER_EXISTS);return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{backFn:C&&E!==C?x:void 0}),e.jsxs(Ll,{children:[e.jsx(Dl,{walletLogo:ee,success:r,fail:!!h}),e.jsxs(Ys,{children:[e.jsx("h3",{children:t}),e.jsx("p",{children:re}),V||!F||H?null:e.jsxs("p",{children:["Still here?"," ",e.jsx("a",{href:F,target:"_blank",style:{textDecoration:"underline"},children:"Try connecting again"}),U&&e.jsxs(e.Fragment,{children:[" ","or"," ",e.jsx("a",{href:U,target:"_blank",style:{textDecoration:"underline"},children:"use this different link"})]})]})]}),ie?e.jsx(jo,{onClick:()=>ne&&ne?.disconnect(),disabled:r,children:"Use a different wallet"}):h==m.ConnectorErrors.ERROR_USER_EXISTS&&E!==C?e.jsx(jo,{onClick:x,children:"Use a different wallet"}):V&&!r&&z?e.jsx(jo,{onClick:()=>{c(!0),Z()},disabled:s,children:s?"Signing":"Sign with your wallet"}):!r&&h?.retryable&&I<2?e.jsx(jo,{onClick:()=>{M(I+1),p(void 0),V?(c(!0),Z()):j?.connectRetry()},disabled:!r&&(!h?.retryable||I>=2),children:"Retry"}):r||h?null:e.jsx(jo,{onClick:()=>{},disabled:!0,children:"Connecting"})]}),e.jsx(d.ModalFooter,{})]})},[g.ModalScreen.AWAITING_CONNECT_ONLY_CONNECTION]:()=>{let t,{navigateBack:r,navigate:n,lastScreen:s,currentScreen:c,data:u}=g.usePrivyModal(),{walletConnectionStatus:h,closePrivyModal:p}=o.usePrivyInternal(),[y,f]=i.useState(void 0),[v,w]=i.useState(0),x="connected"===h?.status,C="switching_to_supported_chain"===h?.status;i.useEffect((()=>{if(x){let e;if(u?.externalConnectWallet?.onCompleteNavigateTo){let t=u.externalConnectWallet.onCompleteNavigateTo;e=setTimeout((()=>{n(t)}),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS)}else e=setTimeout(p,l.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}}),[x]);i.useEffect((()=>{h?.connectError&&(e=>{f(Fl(e))})(h?.connectError)}),[h]);let E=h?.connector?.connectorType||"injected",b=h?.connector?.walletClientType||"unknown",S=bl[b]?.displayName||h?.connector?.walletBranding.name||"Browser Extension",A=bl[b]?.logo||h?.connector?.walletBranding.icon||(t=>e.jsx(Ua,{...t})),j="Browser Extension"===S?S.toLowerCase():S;t=x?`Successfully connected with ${j}`:y?y.message:C?"Switching networks":`Waiting for ${j}`;let $="Don’t see your wallet? Check your other browser windows.";return x?$="You’re good to go!":v>=2&&y?$="Unable to connect wallet":y?$=y.detail:C?$="Switch your wallet to the requested network.":"metamask"===b&&a.isMobile?$="Click to continue to open and connect MetaMask.":"metamask"===b?$="For the best experience, connect only one wallet at a time.":"wallet_connect_v2"===E?$="Open your mobile wallet app to continue":"coinbase_wallet"===E&&($="Open the Coinbase app on your phone to continue."),e.jsxs(e.Fragment,{children:[e.jsx(Wo,{backFn:c===s?void 0:r}),e.jsxs(Wl,{children:[e.jsx(Dl,{walletLogo:A,success:x,fail:!!y}),e.jsxs(Ys,{children:[e.jsx("h3",{children:t}),e.jsx("p",{children:$})]}),y==m.ConnectorErrors.ERROR_USER_EXISTS?e.jsx(jo,{onClick:r,children:"Use a different wallet"}):!x&&y?.retryable&&v<2?e.jsx(jo,{onClick:()=>{w(v+1),f(void 0),h?.connectRetry()},disabled:!x&&(!y?.retryable||v>=2),children:"Retry"}):!x&&y&&v>=2?e.jsx(jo,{onClick:r,children:"Use a different wallet"}):null]}),e.jsx(d.ModalFooter,{})]})},[g.ModalScreen.AWAITING_FARCASTER_CONNECTION]:()=>{let{authenticated:t,logout:r,ready:n,user:s}=o.usePrivy(),{lastScreen:c,navigate:h,navigateBack:p,setModalData:y,app:m}=g.usePrivyModal(),{getAuthFlow:f,loginWithFarcaster:v,closePrivyModal:w,createAnalyticsEvent:x}=o.usePrivyInternal(),[C,E]=i.useState(void 0),[b,S]=i.useState(!1),[A,j]=i.useState(!1),$=i.useRef([]),T=f(),P=T?.meta.connectUri;return i.useEffect((()=>{let e=Date.now(),t=setInterval((async()=>{let r=await T.pollForReady.execute(),n=Date.now()-e;if(r){clearInterval(t),S(!0);try{await v(),j(!0)}catch(e){let t={retryable:!1,message:"Authentication failed"};if(e?.privyErrorCode===o.PrivyErrorCode.ALLOWLIST_REJECTED)return void h(g.ModalScreen.ALLOWLIST_REJECTION_SCREEN);if(e?.privyErrorCode===o.PrivyErrorCode.USER_LIMIT_REACHED)return console.error(new o.PrivyUserLimitReachedError(e).toString()),void h(g.ModalScreen.USER_LIMIT_REACHED_SCREEN);if(e?.privyErrorCode===o.PrivyErrorCode.USER_DOES_NOT_EXIST)return void h(g.ModalScreen.ACCOUNT_NOT_FOUND_SCREEN);if(e?.privyErrorCode===o.PrivyErrorCode.LINKED_TO_ANOTHER_USER)t.detail="This account has already been linked to another user.";else{if(e?.privyErrorCode===o.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return y({accountTransfer:{nonce:e.data?.data?.nonce,account:e.data?.data?.subject,displayName:e.data?.data?.account?.displayName,linkMethod:"farcaster",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress,farcasterEmbeddedAddress:e.data?.data?.otherUser?.farcasterEmbeddedAddress}}),void h(g.ModalScreen.LINK_CONFLICT_SCREEN);e?.privyErrorCode===o.PrivyErrorCode.INVALID_CREDENTIALS?(t.retryable=!0,t.detail="Something went wrong. Try again."):e?.privyErrorCode===o.PrivyErrorCode.TOO_MANY_REQUESTS&&(t.detail="Too many requests. Please wait before trying again.")}E(t)}}else n>12e4&&(clearInterval(t),E({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))}),2e3);return()=>{clearInterval(t),$.current.forEach((e=>clearTimeout(e)))}}),[]),i.useEffect((()=>{if(n&&t&&A&&s){if(m?.legal.requireUsersAcceptTerms&&!s.hasAcceptedTerms){let e=setTimeout((()=>{h(g.ModalScreen.AFFIRMATIVE_CONSENT_SCREEN)}),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}A&&(u.shouldProceedtoEmbeddedWalletCreationFlow(s,m?.embeddedWallets.createOnLogin)?$.current.push(setTimeout((()=>{y({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),x({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"FarcasterConnectStatusScreen"}}),r()},callAuthOnSuccessOnClose:!0}}),h(g.ModalScreen.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS)):$.current.push(setTimeout((()=>w({shouldCallAuthOnSuccess:!0,isSuccess:!0})),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS)))}}),[A,n,t,s]),a.isMobile||b?e.jsxs(e.Fragment,{children:[e.jsx(Wo,{backFn:c?p:void 0,onClose:w},"header"),e.jsx(Xs,{}),a.isIOS?e.jsx(e.Fragment,{children:e.jsxs(Ic,{children:[e.jsx(Ko,{children:e.jsxs("div",{children:[e.jsx(xo,{success:A,fail:!!C}),e.jsx(_c,{style:{width:"38px",height:"38px"}})]})}),e.jsxs(Ys,{children:[e.jsx(Cs,{children:C?C.message:"Sign in with Farcaster"}),e.jsx(Es,{children:C?C.detail:"To sign in with Farcaster, please open the Warpcast app."})]}),P&&e.jsx(jo,{onClick:e=>{e.preventDefault(),window.location.href=P},children:"Open Warpcast app"})]})}):e.jsx(e.Fragment,{children:e.jsxs(Nc,{children:[e.jsx(Ko,{children:e.jsxs("div",{children:[e.jsx(xo,{success:A,fail:!!C}),e.jsx(_c,{style:{width:"38px",height:"38px"}})]})}),e.jsxs(Ys,{children:[e.jsx(Cs,{children:C?C.message:"Signing in with Farcaster"}),e.jsx(Es,{children:C?C.detail:"This should only take a moment"}),e.jsx(Gs,{children:P&&a.isMobile&&e.jsx(wc,{text:"Take me to Warpcast",url:P,color:kc})})]})]})}),e.jsx(d.ModalFooter,{})]}):e.jsxs(e.Fragment,{children:[e.jsx(Wo,{backFn:c?p:void 0,onClose:w},"header"),e.jsx(Xs,{}),e.jsx(Nc,{children:e.jsxs("div",{children:[e.jsx(Cs,{children:"Sign in with Farcaster"}),e.jsx(Es,{children:"Scan with your phone's camera to continue."}),e.jsx(zs,{children:P?e.jsx(Pc,{url:P,size:275,squareLogoElement:_c}):e.jsx(Co,{})}),e.jsxs(Gs,{children:[e.jsx(Es,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),P&&e.jsx(gc,{text:P,itemName:"link",color:kc})]})]})}),e.jsx(d.ModalFooter,{})]})},[g.ModalScreen.AWAITING_FARCASTER_SIGNER]:()=>{let{lastScreen:t,navigateBack:r,data:n,app:s}=g.usePrivyModal(),{requestFarcasterSignerStatus:c,closePrivyModal:u}=o.usePrivyInternal(),[h,p]=i.useState(void 0),[y,m]=i.useState(!1),[f,v]=i.useState(!1),w=i.useRef([]),x=n?.farcasterSigner;i.useEffect((()=>{let e=Date.now(),t=setInterval((async()=>{if(!x?.public_key)return clearInterval(t),void p({retryable:!0,message:"Connect failed",detail:"Something went wrong. Please try again."});"approved"===x.status&&(clearInterval(t),m(!1),v(!0),w.current.push(setTimeout((()=>u({shouldCallAuthOnSuccess:!1,isSuccess:!0})),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS)));let r=await c(x?.public_key),n=Date.now()-e;"approved"===r.status?(clearInterval(t),m(!1),v(!0),w.current.push(setTimeout((()=>u({shouldCallAuthOnSuccess:!1,isSuccess:!0})),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS))):n>3e5?(clearInterval(t),p({retryable:!0,message:"Connect failed",detail:"The request timed out. Try again."})):"revoked"===r.status&&(clearInterval(t),p({retryable:!0,message:"Request rejected",detail:"The request was rejected. Please try again."}))}),2e3);return()=>{clearInterval(t),w.current.forEach((e=>clearTimeout(e)))}}),[]);let C="pending_approval"===x?.status?x.signer_approval_url:void 0;return a.isMobile||y?e.jsxs(e.Fragment,{children:[e.jsx(Wo,{backFn:t?r:void 0,onClose:u},"header"),e.jsx(Xs,{}),a.isIOS?e.jsx(e.Fragment,{children:e.jsxs(Rc,{children:[e.jsx(Ko,{children:e.jsxs("div",{children:[e.jsx(xo,{success:f,fail:!!h}),e.jsx(_c,{style:{width:"38px",height:"38px"}})]})}),e.jsxs(Ys,{children:[e.jsx(Cs,{children:h?h.message:"Add a signer to Farcaster"}),e.jsx(Es,{children:h?h.detail:"This will allow "+s.name+" to add casts, likes, follows, and more on your behalf."})]}),C&&e.jsx(jo,{onClick:e=>{e.preventDefault(),window.location.href=C},children:"Open Warpcast app"})]})}):e.jsx(e.Fragment,{children:e.jsxs(Oc,{children:[e.jsx(Ko,{children:e.jsxs("div",{children:[e.jsx(xo,{success:f,fail:!!h}),e.jsx(_c,{style:{width:"38px",height:"38px"}})]})}),e.jsxs(Ys,{children:[e.jsx(Cs,{children:h?h.message:"Requesting signer from Farcaster"}),e.jsx(Es,{children:h?h.detail:"This should only take a moment"}),e.jsx(Gs,{children:C&&a.isMobile&&e.jsx(wc,{text:"Take me to Warpcast",url:C,color:Mc})})]})]})}),e.jsx(d.ModalFooter,{})]}):e.jsxs(e.Fragment,{children:[e.jsx(Wo,{backFn:t?r:void 0,onClose:u},"header"),e.jsx(Xs,{}),e.jsx(Oc,{children:e.jsxs("div",{children:[e.jsx(Cs,{children:"Add a signer to Farcaster"}),e.jsxs(Es,{children:["This will allow ",s.name," to add casts, likes, follows, and more on your behalf."]}),e.jsx(zs,{children:"pending_approval"===x?.status?e.jsx(Pc,{url:x.signer_approval_url,size:275,squareLogoElement:_c}):e.jsx(Co,{})}),e.jsxs(Gs,{children:[e.jsx(Es,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),"pending_approval"===x?.status&&e.jsx(gc,{text:x.signer_approval_url,itemName:"link",color:Mc})]})]})}),e.jsx(d.ModalFooter,{})]})},[g.ModalScreen.AWAITING_PASSKEY_SYSTEM_DIALOGUE]:()=>{let{lastScreen:t,currentScreen:r,navigateBack:n}=g.usePrivyModal(),{loginWithPasskey:a,closePrivyModal:s}=o.usePrivyInternal(),[c,u]=i.useState("loading"),[h,p]=i.useState(null),y=i.useRef([]);i.useEffect((()=>()=>{y.current.forEach((e=>clearTimeout(e))),y.current=[]}),[]);let m=async()=>{u("loading");try{await a(),u("success")}catch(e){p(e),u("error")}};return i.useEffect((()=>{"success"===c&&(e=>{y.current=[e,...y.current]})(setTimeout((()=>{s({shouldCallAuthOnSuccess:!0,isSuccess:!0})}),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS))}),[c]),i.useEffect((()=>{m()}),[]),e.jsxs(e.Fragment,{children:[e.jsx(Wo,{backFn:t&&r!==t?n:void 0}),e.jsxs(am,{children:[e.jsx(Ko,{children:e.jsxs("div",{children:[e.jsx(xo,{success:"success"===c,fail:"error"===c}),e.jsx(mu,{style:{width:"38px",height:"38px"}})]})}),e.jsxs(Ys,{children:[e.jsx("h3",{children:(()=>{switch(c){case"loading":return"Waiting for passkey";case"success":return"Success";case"error":return"Something went wrong"}})()}),e.jsx("p",{style:{whiteSpace:"pre-wrap"},children:(()=>{switch(c){case"loading":return"Please follow prompts to verify your passkey.\nYou will have to sign up with another method first to register a passkey for your account.";case"success":return"You've successfully logged in with your passkey.";case"error":if(h instanceof o.PrivyError){if(h.privyErrorCode===o.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE)return"Cannot link more passkeys to account.";if(h.privyErrorCode===o.PrivyErrorCode.PASSKEY_NOT_ALLOWED)return"Passkey request timed out or rejected by user.\nYou will have to sign up with another method first to register a passkey for your account."}return"An unknown error occurred.\nYou will have to sign up with another method first to register a passkey for your account."}})()})]}),(()=>{switch(c){case"loading":case"success":return e.jsx(jo,{onClick:()=>{},disabled:!0,children:"Continue"});case"error":return e.jsx(jo,{onClick:m,disabled:!1,children:"Retry"})}})()]}),e.jsx(d.ModalFooter,{})]})},[g.ModalScreen.PHANTOM_INTERSTITIAL_SCREEN]:()=>{let{forkSession:t,ready:r,authenticated:n}=o.usePrivy(),{walletConnectionStatus:s}=o.usePrivyInternal(),[l,c]=i.useState(""),[u,h]=i.useState(!1);i.useEffect((()=>{r&&n&&t().then(c)}),[r,n]);let p=((e,t,r)=>{let n=encodeURIComponent(new URL(window.location.href).href.replace(/\/$/g,"")+`?privy_token=${e}&privy_connector=${r?"solana_adapter":"injected"}&privy_wallet_client=${r?"phantom_solana":"phantom"}`);if(!d.isPhantomInstalled()&&a.isMobile)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${n}?ref=${n}`})(l,!u,"solana"===s?.connector?.chainType),y={title:"Redirecting to Phantom Mobile Wallet",description:"We'll take you to the Phantom Mobile Wallet app to continue your login experience.",footnote:""};return r&&(y.description="For the best experience, we'll automatically log you into the Phantom Mobile Wallet in-app browser.",y.footnote="Once you're done, you can always return here and refresh to view your updated account."),u&&(y.title="Still here?",y.description="You may need to install the Phantom mobile app.",y.footnote="Once you're done, you can return here or connect via Phantom's in-app browser."),e.jsxs(e.Fragment,{children:[e.jsx(Wo,{},"header"),e.jsx(Xs,{}),e.jsx(nl,{title:y.title,description:y.description}),e.jsxs(Hs,{children:[e.jsx(om,{children:e.jsx(Wa,{style:{width:"72px",height:"72px"}})}),e.jsx(Po,{href:p,onClick:()=>{setTimeout((()=>h(!0)),1e3)},loading:r&&!p,children:u?"Go to App Store":"Continue"}),y.footnote?e.jsx("p",{children:y.footnote}):null]}),e.jsx(Js,{}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.LOGIN_FAILED_SCREEN]:()=>{let{closePrivyModal:t}=o.usePrivyInternal(),{navigate:r}=g.usePrivyModal();return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{},"header"),e.jsx(Xs,{}),e.jsx(Op,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),e.jsx(nl,{title:"Could not connect with wallet",description:"Please check that Phantom multichain is enabled and try again.",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}}),e.jsxs(Hs,{children:[e.jsx(jo,{onClick:()=>r(g.ModalScreen.LANDING),children:"Try again"}),e.jsx(ko,{onClick:()=>t(),children:"Cancel"})]}),e.jsx(Js,{}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.AWAITING_OAUTH_SCREEN]:()=>{let{authenticated:t,logout:r,ready:n,user:a}=o.usePrivy(),{app:s,setModalData:c,navigate:h,resetNavigation:p}=g.usePrivyModal(),{getAuthMeta:y,initLoginWithOAuth:m,loginWithOAuth:f,updateWallets:v,setReadyToTrue:w,closePrivyModal:x,createAnalyticsEvent:C}=o.usePrivyInternal(),[E,b]=i.useState(!1),[S,A]=i.useState(void 0),j=y()?.provider||"google",{name:$,component:T}=ua(j),P=d.useEmitPrivyEvent();i.useEffect((()=>{f(j).then((e=>{b(!0),w(!0),e&&P("login","onOAuthLoginComplete",e)})).catch((e=>{if(w(!1),e?.privyErrorCode===o.PrivyErrorCode.ALLOWLIST_REJECTED)return A(void 0),p(),void h(g.ModalScreen.ALLOWLIST_REJECTION_SCREEN);if(e?.privyErrorCode===o.PrivyErrorCode.USER_LIMIT_REACHED)return console.error(new o.PrivyUserLimitReachedError(e).toString()),A(void 0),p(),void h(g.ModalScreen.USER_LIMIT_REACHED_SCREEN);if(e?.privyErrorCode===o.PrivyErrorCode.USER_DOES_NOT_EXIST)return A(void 0),p(),void h(g.ModalScreen.ACCOUNT_NOT_FOUND_SCREEN);if(e?.privyErrorCode===o.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return A(void 0),p(),c({accountTransfer:{nonce:e.data?.data?.nonce,account:e.data?.data?.subject,displayName:e.data?.data?.account?.displayName,linkMethod:y()?.provider,embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress,oAuthUserInfo:e.data?.data?.otherUser?.oAuthUserInfo}}),void h(g.ModalScreen.LINK_CONFLICT_SCREEN);let{retryable:t,detail:r}=function(e,t){let r={detail:"",retryable:!1},n=Qi(t);if(e?.privyErrorCode===o.PrivyErrorCode.LINKED_TO_ANOTHER_USER&&(r.detail="This account has already been linked to another user."),e?.privyErrorCode===o.PrivyErrorCode.INVALID_CREDENTIALS&&(r.retryable=!0,r.detail="Something went wrong. Try again."),e.privyErrorCode===o.PrivyErrorCode.OAUTH_USER_DENIED&&(r.detail=`Retry and check ${n} to finish connecting your account.`,r.retryable=!0),e?.privyErrorCode===o.PrivyErrorCode.TOO_MANY_REQUESTS&&(r.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode===o.PrivyErrorCode.TOO_MANY_REQUESTS&&e.message.includes("provider rate limit")){let e=ua(t).name;r.detail=`Request limit reached for ${e}. Please wait a moment and try again.`}if(e?.privyErrorCode===o.PrivyErrorCode.OAUTH_ACCOUNT_SUSPENDED){let e=ua(t).name;r.detail=`Your ${e} account is suspended. Please try another login method.`}return e?.privyErrorCode===o.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE&&(r.detail="You cannot authorize more than one account for this user."),e?.privyErrorCode===o.PrivyErrorCode.OAUTH_UNEXPECTED&&t.startsWith("privy:")&&(r.detail="Something went wrong. Please try again."),r}(e,j);A({retryable:t,detail:r,message:"Authentication failed"})})).finally((()=>{pa()}))}),[$,j]),i.useEffect((()=>{if(n&&t&&E&&a){if(s?.legal.requireUsersAcceptTerms&&!a.hasAcceptedTerms){let e=setTimeout((()=>{h(g.ModalScreen.AFFIRMATIVE_CONSENT_SCREEN)}),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}if(u.shouldProceedtoEmbeddedWalletCreationFlow(a,s?.embeddedWallets?.createOnLogin)){let e=setTimeout((()=>{c({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),C({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,provider:j,screen:"OAuthStatusScreen"}}),r()},callAuthOnSuccessOnClose:!0}}),h(g.ModalScreen.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}{let e=setTimeout((()=>x({shouldCallAuthOnSuccess:!0,isSuccess:!0})),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return v(),()=>clearTimeout(e)}}}),[n,t,E,a]);let _=E?`Successfully connected with ${$}`:S?S.message:`Verifying connection to ${$}`,k="";return k=E?"You’re good to go!":S?S.detail:"Just a few moments more",e.jsxs(e.Fragment,{children:[e.jsx(Wo,{}),e.jsx(Xs,{}),e.jsxs(im,{children:[e.jsx(Ko,{children:e.jsxs("div",{children:[e.jsx(xo,{success:E,fail:!!S}),e.jsx(T,{style:{width:"38px",height:"38px"}})]})}),e.jsxs(Ys,{children:[e.jsx("h3",{children:_}),e.jsx("p",{children:k})]}),S&&S?.retryable?e.jsx(Io,{onClick:()=>{pa(),m(j),A(void 0)},disabled:!E&&!S?.retryable,children:"Retry"}):null]}),e.jsx(Js,{}),e.jsx(d.ModalFooter,{})]})},[g.ModalScreen.CROSS_APP_AUTH_SCREEN]:()=>{let t=l.useAppConfig(),{data:r,navigate:n,setModalData:a,onUserCloseViaDialogOrKeybindRef:s}=g.usePrivyModal(),{crossAppAuthFlow:c,updateWallets:h,closePrivyModal:p,createAnalyticsEvent:y}=o.usePrivyInternal(),{logout:m}=d.useLogout(),[f,v]=i.useState({}),w=r?.crossAppAuth,x={id:w.appId,name:w.name,logoUrl:w.logoUrl},C=new o.PrivyClientError(`There was an issue connecting your ${x.name} account. Please try again.`),E=new Gi((async e=>{if(w.popup)try{let t=await c({appId:e,popup:w.popup,action:w.action});v({data:t})}catch(e){e instanceof o.PrivyClientError?v({error:e}):(e instanceof o.PrivyApiError&&w.popup&&w.popup.close(),v({error:C}))}else v({error:C})})),b=()=>{f.data&&(h(),w.onSuccess(f.data),p({shouldCallAuthOnSuccess:!0,isSuccess:!0})),w.onError(f.error??new o.PrivyClientError("User canceled flow")),p({shouldCallAuthOnSuccess:!1,isSuccess:!1})};s.current=b,i.useEffect((()=>{x.id.length&&E.execute(x.id)}),[x.id]),i.useEffect((()=>{if(!f.data)return;let e=f.data;if(t.legal.requireUsersAcceptTerms&&!e.hasAcceptedTerms){let e=setTimeout((()=>{n(g.ModalScreen.AFFIRMATIVE_CONSENT_SCREEN)}),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}if(u.shouldProceedtoEmbeddedWalletCreationFlow(e,t.embeddedWallets?.createOnLogin)){let e=setTimeout((()=>{a({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),y({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,provider:`privy:${x.id}`,screen:"CrossAppAuthScreen"}}),m()},callAuthOnSuccessOnClose:!0}}),n(g.ModalScreen.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}let r=setTimeout(b,l.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(r)}),[f.data]);let{title:S,subtitle:A}=i.useMemo((()=>f.data?{title:`Successfully connected with ${x.name}`,subtitle:"You're good to go!"}:f.error?{title:"Authentication failed",subtitle:f.error.message}:{title:`Connecting to ${x.name}`,subtitle:`Please check the pop-up from ${x.name} to continue`}),[f,x.name]);return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{onClose:b}),e.jsx(Xs,{}),e.jsxs(Hl,{children:[e.jsx(Ko,{children:e.jsxs("div",{children:[e.jsx(xo,{success:!!f.data,fail:!!f.error}),e.jsx(Bl,{name:x.name,logoUrl:x.logoUrl})]})}),e.jsxs(Ys,{children:[e.jsx("h3",{children:S}),e.jsx("p",{children:A})]})]}),e.jsx(Js,{}),e.jsx(d.ModalFooter,{})]})},[g.ModalScreen.ALLOWLIST_REJECTION_SCREEN]:()=>{let{navigate:t,app:r}=g.usePrivyModal(),n=r?.allowlistConfig.errorTitle||"You don't have access to this app",i=r?.allowlistConfig.errorDetail||"Have you been invited?",a=r?.allowlistConfig.errorCtaText||"Try another account";return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{}),e.jsxs(Ws,{children:[e.jsx(Ko,{children:e.jsxs("div",{children:[e.jsx(os,{}),e.jsx(Ds,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),e.jsxs(Bs,{children:["string"==typeof n?e.jsx("h3",{children:n}):e.jsx(e.Fragment,{children:n}),"string"==typeof i?e.jsx("p",{children:i}):e.jsx(e.Fragment,{children:i})]}),r?.allowlistConfig.errorCtaLink?e.jsx(jo,{as:"a",href:r.allowlistConfig.errorCtaLink,children:a}):e.jsx(jo,{onClick:()=>{t(g.ModalScreen.LANDING)},children:a})]})]})},[g.ModalScreen.ACCOUNT_NOT_FOUND_SCREEN]:()=>{let{navigate:t,app:r}=g.usePrivyModal();return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{}),e.jsxs(is,{children:[e.jsx(Ko,{children:e.jsxs("div",{children:[e.jsx(Ro,{color:"var(--privy-color-warn-light)"}),e.jsx(Ue.default,{height:38,width:38,strokeWidth:2,stroke:"var(--privy-color-warn)"})]})}),e.jsxs(as,{children:[e.jsx("h3",{children:"Account not found"}),e.jsxs("p",{children:["Please try logging in again or go to ",r.name," to create an account."]})]}),e.jsx(Yo,{}),e.jsx(jo,{onClick:()=>t(g.ModalScreen.LANDING),children:"Try logging in again"})]})]})},[g.ModalScreen.USER_LIMIT_REACHED_SCREEN]:()=>{let{navigate:t}=g.usePrivyModal();return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{}),e.jsxs(Lf,{children:[e.jsx(Uf,{children:e.jsx(Ff,{})}),e.jsxs(Df,{children:[e.jsx("h3",{children:"Unable to sign in"}),e.jsx("p",{children:"This application has reached its user limit and cannot sign in new users."})]}),e.jsx(jo,{onClick:()=>{t(g.ModalScreen.LANDING)},children:"Go back"})]}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.INSTALL_PHANTOM_SCREEN]:()=>{let{navigateBack:t}=g.usePrivyModal();return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{backFn:t},"header"),e.jsx(Xs,{}),e.jsx(ep,{}),e.jsx(Js,{}),e.jsxs(d.ModalFooter,{children:[e.jsx("span",{children:"Still not sure? "}),e.jsx("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})},[g.ModalScreen.LINK_EMAIL_SCREEN]:()=>{let{app:t}=g.usePrivyModal();return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{},"header"),e.jsx(Xs,{}),e.jsx(il,{title:"Connect your email",description:`Add your email to your ${t?.name} account`,icon:e.jsx(Ke.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),e.jsx(Hs,{children:e.jsx(sp,{stacked:!0})}),e.jsx(Js,{}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.LINK_PHONE_SCREEN]:()=>{let{app:t,currentScreen:r,data:n,navigate:i,setModalData:a}=g.usePrivyModal(),{initLoginWithSms:s}=o.usePrivyInternal();return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{},"header"),e.jsx(Xs,{}),e.jsx(il,{title:"Connect your phone",description:`Add your number to your ${t?.name} account`,icon:e.jsx(Ye.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),e.jsx(Hs,{children:e.jsx(yp,{stacked:!0,onSubmit:async function({qualifiedPhoneNumber:e}){try{await s(e),i(g.ModalScreen.AWAITING_PASSWORDLESS_CODE)}catch(e){a({errorModalData:{error:e,previousScreen:n?.errorModalData?.previousScreen||r||g.ModalScreen.LINK_PHONE_SCREEN}}),i(g.ModalScreen.ERROR_SCREEN)}},hideRecent:!0})}),e.jsx(Js,{}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.LINK_WALLET_SCREEN]:()=>{let{app:t,data:r}=g.usePrivyModal(),n=r?.externalConnectWallet?.suggestedAddress,i=n?e.jsxs("span",{children:["Link the wallet with address ",e.jsx(d.Address,{showCopyIcon:!1,address:n})," ",t?.name?`to ${t.name}.`:"."]}):`Link a wallet to your ${t?.name} account`;return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{},"header"),e.jsx(nl,{title:"Link your wallet",description:i}),e.jsx(Xo,{children:e.jsx(Ol,{connectOnly:!1})}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.LINK_PASSKEY_SCREEN]:()=>{let{user:t,unlinkPasskey:r}=o.usePrivy(),{linkWithPasskey:n,closePrivyModal:a}=o.usePrivyInternal(),s=t?.linkedAccounts.filter((e=>"passkey"===e.type)),[l,c]=i.useState(!1),[u,h]=i.useState(""),[p,y]=i.useState(!1),[m,f]=i.useState(!1);i.useEffect((()=>{0===s.length&&f(!1)}),[s.length]);let g=async e=>(c(!0),await r(e).then((()=>y(!0))).catch((e=>{e instanceof o.PrivyError&&e.privyErrorCode===o.PrivyErrorCode.MISSING_MFA_CREDENTIALS?h("Cannot unlink a passkey enrolled in MFA"):h("Unknown error occurred.")})).finally((()=>{c(!1)})));return p?e.jsxs(e.Fragment,{children:[e.jsx(Wo,{onClose:()=>a()},"header"),e.jsx(xs,{children:e.jsx(Rs,{status:"success",children:e.jsx(Ze.default,{})})}),e.jsx(bu,{children:"Passkey added"}),e.jsx(Su,{children:"From now on, you can use your passkey to log in."}),e.jsx($s,{children:e.jsx(jo,{onClick:()=>a(),children:"Done"})}),e.jsx(d.ModalFooter,{})]}):m?e.jsxs(e.Fragment,{children:[e.jsx(Wo,{backFn:()=>f(!1),onClose:()=>a()},"header"),e.jsx(fu,{passkeys:s,expanded:m,onUnlink:g,onExpand:()=>f(!0)}),e.jsx(d.ModalFooter,{})]}):e.jsxs(e.Fragment,{children:[e.jsx(Wo,{onClose:()=>a()},"header"),e.jsx(xs,{children:e.jsxs(vu,{children:[e.jsx(yu,{}),e.jsx(mu,{})]})}),e.jsx(bu,{children:"Secure your account with a passkey"}),e.jsx(Au,{}),0===s.length?e.jsx(gu,{}):e.jsx(fu,{passkeys:s,expanded:m,onUnlink:g,onExpand:()=>f(!0)}),e.jsxs($s,{style:{marginTop:"12px"},children:[u&&e.jsx(wu,{$fail:!0,children:u}),e.jsx(jo,{onClick:()=>{c(!0),n().then((()=>y(!0))).catch((e=>{if(e instanceof o.PrivyError){if(e.privyErrorCode===o.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE)return void h("Cannot link more passkeys to account.");if(e.privyErrorCode===o.PrivyErrorCode.PASSKEY_NOT_ALLOWED)return void h("Passkey request timed out or rejected by user.")}h("Unknown error occurred.")})).finally((()=>{c(!1)}))},loading:l,children:"Add new passkey"})]}),e.jsx(d.ModalFooter,{})]})},[g.ModalScreen.UPDATE_EMAIL_SCREEN]:()=>e.jsxs(e.Fragment,{children:[e.jsx(Wo,{},"header"),e.jsx(Xs,{}),e.jsx(il,{title:"Update your email",description:"Add the email address you'd like to use going forward. We'll send you a confirmation code",icon:e.jsx(Ke.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),e.jsx(Hs,{children:e.jsx(Mf,{stacked:!0})}),e.jsx(Js,{}),e.jsx(d.BlobbyFooter,{})]}),[g.ModalScreen.UPDATE_PHONE_SCREEN]:()=>{let{currentScreen:t,data:r,navigate:n,setModalData:i}=g.usePrivyModal(),{user:a}=o.usePrivy(),{initUpdatePhone:s}=o.usePrivyInternal();return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{},"header"),e.jsx(Xs,{}),e.jsx(il,{title:"Update your phone number",description:"Add the phone number you'd like to use going forward. We'll send you a confirmation code",icon:e.jsx(Ye.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),e.jsx(Hs,{children:e.jsx(yp,{stacked:!0,onSubmit:async function({qualifiedPhoneNumber:e}){try{if(!a?.phone?.number)throw Error("User is required to have an phone number to update it.");await s(a?.phone?.number,e),n(g.ModalScreen.AWAITING_PASSWORDLESS_CODE)}catch(e){i({errorModalData:{error:e,previousScreen:r?.errorModalData?.previousScreen||t||g.ModalScreen.LINK_PHONE_SCREEN}}),n(g.ModalScreen.ERROR_SCREEN)}},hideRecent:!0})}),e.jsx(Js,{}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.CONNECT_ONLY_LANDING_SCREEN]:()=>{let{app:t,data:r}=g.usePrivyModal(),n=r?.externalConnectWallet?.suggestedAddress,i=n?e.jsxs("span",{children:["Connect the wallet with address ",e.jsx(d.Address,{showCopyIcon:!1,address:n})," ",t?.name?`to ${t.name}.`:"."]}):`Connect a wallet to your ${t?.name} account`;return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{},"header"),e.jsx(rl,{title:"Connect your wallet",description:i}),e.jsx(Xo,{children:e.jsx(Ol,{connectOnly:!0})}),t&&e.jsx(d.TermsAndConditions,{app:t,alwaysShowImplicitConsent:!0}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.CONNECT_ONLY_AUTHENTICATED_SCREEN]:()=>{let{app:t,data:r}=g.usePrivyModal(),n=r?.externalConnectWallet?.suggestedAddress,i=n?`Connect the wallet with address ${d.formatWalletAddress(n)} ${t?.name?`to ${t.name}.`:"."}`:`Connect a wallet to ${t?.name}`;return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{},"header"),e.jsx(nl,{title:"Connect your wallet",description:i}),e.jsx(Xo,{children:e.jsx(Ol,{connectOnly:!0})}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN]:()=>{let{app:t,setModalData:r,navigate:n,data:a,onUserCloseViaDialogOrKeybindRef:s}=g.usePrivyModal(),[d,c]=i.useState(""),{embeddedWallets:u}=l.useAppConfig(),{authenticated:h}=o.usePrivy(),{closePrivyModal:p}=o.usePrivyInternal(),{onSuccess:y,onFailure:m,callAuthOnSuccessOnClose:f}=a.createWallet,v=!0===t?.embeddedWallets.requireUserOwnedRecoveryOnCreate,{createWallet:w}=Cd(),[x,C]=i.useState(null),E=new Gi((async()=>{try{let e=await w();if(!e)return;C(e),n(g.ModalScreen.EMBEDDED_WALLET_CREATED_SCREEN)}catch(e){c(e.message)}}));return i.useEffect((()=>h?v?(r({...a,recoverySelection:{...a?.recoverySelection,isInAccountCreateFlow:!0}}),n(ld({walletAction:"create",showAutomaticRecovery:!1,availableRecoveryMethods:u.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:!1,isResettingPassword:!1}))):void E.execute():(n(g.ModalScreen.LANDING),void m(Error("User must be authenticated before creating a Privy wallet")))),[v,h]),s.current=()=>null,d?e.jsxs(e.Fragment,{children:[e.jsx(Wo,{closeable:!1}),e.jsxs(Vs,{children:[e.jsx(Xe.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),e.jsx(il,{title:"Something went wrong",description:d})]}),e.jsx(jo,{onClick:()=>{x?(y(x),p({shouldCallAuthOnSuccess:f})):(m(new o.PrivyEmbeddedWalletError("User wallet creation failed")),p({shouldCallAuthOnSuccess:!1}))},children:"Close"}),e.jsx(Ed,{})]}):e.jsx(Vl,{})},[g.ModalScreen.EMBEDDED_WALLET_CREATED_SCREEN]:()=>{let{user:t}=o.usePrivy(),{closePrivyModal:r,isNewUserThisSession:n,updateWallets:a}=o.usePrivyInternal(),{app:s,data:c,onUserCloseViaDialogOrKeybindRef:h}=g.usePrivyModal(),{onSuccess:p,onFailure:y,callAuthOnSuccessOnClose:m}=c.createWallet,f=()=>{let e=u.getPrivyEthereumWallet(t);e?(a(),p(e)):y(Error("Failed to create wallet")),r({shouldCallAuthOnSuccess:m})};return i.useEffect((()=>{let e=setTimeout(f,l.DEFAULT_SUCCESS_SCREEN_LONG_DURATION_MS);return()=>clearTimeout(e)}),[]),h.current=f,e.jsxs(e.Fragment,{children:[e.jsx(Wo,{onClose:f}),e.jsx(Xs,{}),e.jsxs(Vs,{children:[e.jsx(Ze.default,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),e.jsx(il,{title:n?"Welcome"+(s?.name?` to ${s?.name}`:""):"All set!",description:n?"You’ve successfully created an account.":"Your account is secured."})]}),e.jsx(Js,{}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN]:()=>{let{authenticated:t,user:r,getAccessToken:n}=o.usePrivy(),{closePrivyModal:a,createAnalyticsEvent:s,walletProxy:l}=o.usePrivyInternal(),{navigate:d,data:c,setModalData:h,onUserCloseViaDialogOrKeybindRef:p}=g.usePrivyModal(),y=i.useMemo((()=>Date.now()),[]),[m,f]=i.useState(!1),{onCompleteNavigateTo:v,onFailure:w,shouldForceMFA:x,address:C}=c?.connectWallet,E=e=>{m||(f(!0),w("string"==typeof e?Error(e):e))};i.useEffect((()=>{let e,i=C?r?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType&&e.address===C)):u.getPrivyEthereumWallet(r);return t&&i?l?((async()=>{let t=await n();if(!t)return E("User must be authenticated and have a Privy wallet before it can be connected");let r="ethereum"===i.chainType;try{r?await l.connect({accessToken:t,address:i.address}):await l.connectSolana({accessToken:t,publicKey:i.address}),x&&await l.verifyMfa({accessToken:t});let n=(Date.now()-y)/1e3;v===g.ModalScreen.EMBEDDED_WALLET_KEY_EXPORT_SCREEN&&n<1?e=setTimeout((()=>{d(v,!1)}),1e3*(1-n)):d(v,!1)}catch(e){if(td(e)&&"privy"===i.recoveryMethod){let e=await n();if(!e)return E("User must be authenticated and have a Privy wallet before it can be recovered");try{if(s({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:i.address}}),r){let t=await(l?.recover({address:i.address,accessToken:e,recoveryMethod:i.recoveryMethod}));t?.address||E(Error("Unable to recover wallet"))}else{let t=await(l?.recoverSolana({publicKey:i.address,accessToken:e}));t?.publicKey||E(Error("Unable to recover wallet"))}v?d(v):a({shouldCallAuthOnSuccess:!1}),s({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:i.address}}),d(v)}catch(e){E("An error has occurred, please try again.")}}else td(e)&&"privy"!==i.recoveryMethod?(h({...c,recoverWallet:{privyWallet:i,onCompleteNavigateTo:v,onFailure:w},recoveryOAuthStatus:{provider:i.recoveryMethod,action:"recover",isInAccountCreateFlow:!1}}),d(dd(i.recoveryMethod))):E(e)}})(),()=>clearTimeout(e)):void 0:E("User must be authenticated and have a Privy wallet before it can be connected")}),[t,r,l]);let b=()=>{E("User exited before wallet could be connected"),a({shouldCallAuthOnSuccess:!1})};return p.current=b,e.jsxs(e.Fragment,{children:[e.jsx(Wo,{onClose:b}),m?e.jsxs(e.Fragment,{children:[e.jsxs(Vs,{children:[e.jsx(Xe.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),e.jsx(il,{title:"Something went wrong",description:"We’re on it. Please try again later."})]}),e.jsx(jo,{onClick:()=>a({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):e.jsx(Vl,{}),e.jsx(hd,{})]})},[g.ModalScreen.EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN]:()=>{let[t,r]=i.useState(!0),{authenticated:n,getAccessToken:a}=o.usePrivy(),{walletProxy:s,closePrivyModal:l,createAnalyticsEvent:c}=o.usePrivyInternal(),{navigate:u,data:h,onUserCloseViaDialogOrKeybindRef:p}=g.usePrivyModal(),[y,m]=i.useState(void 0),[f,v]=i.useState(""),[w,x]=i.useState(!1),{privyWallet:C,onCompleteNavigateTo:E,onSuccess:b,onFailure:S}=h.recoverWallet,A=(e="User exited before their wallet could be recovered")=>{l({shouldCallAuthOnSuccess:!1}),S("string"==typeof e?new o.PrivyEmbeddedWalletError(e):e)};p.current=A,i.useEffect((()=>{if(!n||!C)return A("User must be authenticated and have a Privy wallet before it can be recovered")}),[n]);return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{onClose:A}),e.jsx(Xs,{}),e.jsxs(lm,{children:[e.jsxs(sm,{children:[e.jsx(Pt.default,{height:48,width:48,stroke:"var(--privy-color-accent)"}),e.jsx("h3",{style:{color:"var(--privy-color-foreground)"},children:"Enter your password"}),e.jsx("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),e.jsxs("div",{children:[e.jsxs(_d,{children:[e.jsx(Td,{type:t?"password":"text",onChange:e=>(e=>{e&&m(e)})(e.target.value),disabled:w,style:{paddingRight:"2.3rem"}}),e.jsx(Od,{style:{right:"0.75rem"},children:t?e.jsx(Fd,{onClick:()=>r(!1)}):e.jsx(Ld,{onClick:()=>r(!0)})})]}),!!f&&e.jsx(dm,{children:f})]}),e.jsxs("div",{children:[e.jsxs(Zs,{children:[e.jsx("h4",{children:"Why is this necessary?"}),e.jsx("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),e.jsx(cm,{loading:w||!s,disabled:!y,onClick:async()=>{x(!0);let e=await a();if(!e||!C||null===y)return A("User must be authenticated and have a Privy wallet before it can be recovered");try{c({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:C.address}}),await(s?.recover({address:C.address,accessToken:e,recoveryPin:y,recoveryMethod:C.recoveryMethod})),v(""),E?u(E):l({shouldCallAuthOnSuccess:!1}),b?.(C),c({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:C.address}})}catch(e){!function(e){return ed(e)&&("invalid_recovery_pin"===e.type||"invalid_request_arguments"===e.type)}(e)?v("An error has occurred, please try again."):v("Invalid recovery password, please try again.")}finally{x(!1)}},warn:!1,hideAnimations:!C&&w,children:"Recover your account"})]})]}),e.jsx(Js,{}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN]:()=>{let[t,r]=i.useState(!1),{navigate:n,lastScreen:a,navigateBack:s,setModalData:c,data:h,onUserCloseViaDialogOrKeybindRef:p}=g.usePrivyModal(),{user:y}=o.usePrivy(),{embeddedWallets:m}=l.useAppConfig(),{closePrivyModal:f}=o.usePrivyInternal(),v=u.getPrivyEthereumWallet(y),w=null===v,{isInAccountCreateFlow:x,isResettingPassword:C}=h.recoverySelection,E=v&&"privy"!==v.recoveryMethod,b=E?e.jsxs("span",{children:["Your account is currently secured using"," ",e.jsx("strong",{children:gm[v?.recoveryMethod||"user-passcode"]}),"."]}):"Select a method for logging in on new devices and recovering your account.";function S(e){c({recoveryOAuthStatus:{provider:e,action:w?"create-wallet":"set-recovery",isInAccountCreateFlow:x}}),n(g.ModalScreen.EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN)}function A(){h?.setWalletPassword?.onFailure(Error("User exited set recovery flow")),f({shouldCallAuthOnSuccess:h?.setWalletPassword?.callAuthOnSuccessOnClose??!1})}return p.current=A,e.jsxs(e.Fragment,{children:[e.jsx(Wo,{onClose:A,backFn:t?()=>r(!1):a?s:void 0,infoFn:a||t?void 0:()=>r(!0)},"header"),t?e.jsx(vm,{onClose:()=>r(!1)}):e.jsxs(e.Fragment,{children:[e.jsx(il,{title:E?"Update backup method":"Secure your account",icon:e.jsx(It.default,{width:48}),description:b}),e.jsx(pm,{children:m.userOwnedRecoveryOptions.filter((e=>!["icloud","google-drive"].includes(v?.recoveryMethod||"")||e!==v?.recoveryMethod)).sort().map((t=>{switch(t){case"google-drive":return e.jsxs(ts,{onClick:()=>S("google-drive"),children:[e.jsx(fm,{children:e.jsx(hm,{style:{width:18}})}),"Back up to Google Drive"]},t);case"icloud":return e.jsxs(ts,{onClick:()=>S("icloud"),children:[e.jsx(fm,{children:e.jsx(um,{style:{width:24}})}),"Back up to Apple iCloud"]},t);case"user-passcode":return e.jsxs(ts,{onClick:()=>{n(sd({isCreatingWallet:w,skipSplashScreen:!0}))},children:[e.jsx(fm,{children:e.jsx(Mt.default,{style:{width:18}})}),C?"Reset your":"Set a"," password"]},t);default:return null}}))})]}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.EMBEDDED_WALLET_SET_AUTOMATIC_RECOVERY_SCREEN]:()=>{let{user:t,getAccessToken:r}=o.usePrivy(),n=u.getPrivyEthereumWallet(t),{walletProxy:a,refreshUser:s,closePrivyModal:c}=o.usePrivyInternal(),h=g.usePrivyModal(),[p,y]=i.useState(!1),[m,f]=i.useState(null),[v,w]=i.useState(null);function x(){if(!p){if(v)return h.data?.setWalletPassword?.onFailure(v),void c();if(!m)return h.data?.setWalletPassword?.onFailure(Error("User exited set recovery flow")),void c()}}h.onUserCloseViaDialogOrKeybindRef.current=x;let C=!(!p&&!m);return v?e.jsxs(e.Fragment,{children:[e.jsx(Wo,{onClose:x},"header"),e.jsx(wm,{$color:"var(--privy-color-error)",style:{alignSelf:"center"},children:e.jsx(He.default,{height:38,width:38,stroke:"var(--privy-color-error)"})}),e.jsx(fd,{style:{marginTop:"0.5rem"},children:"Something went wrong"}),e.jsx(Yo,{style:{minHeight:"2rem"}}),e.jsx($o,{onClick:()=>w(null),children:"Try again"}),e.jsx(d.BlobbyFooter,{})]}):e.jsxs(e.Fragment,{children:[e.jsx(Wo,{onClose:x},"header"),e.jsx(It.default,{style:{width:"3rem",height:"3rem",alignSelf:"center"}}),e.jsx(fd,{style:{marginTop:"0.5rem"},children:"Automatically secure your account"}),e.jsx(md,{style:{marginTop:"1rem"},children:"When you log into a new device, you’ll only need to authenticate to access your account. Never get logged out if you forget your password."}),e.jsx(Yo,{style:{minHeight:"2rem"}}),e.jsx($o,{loading:p,disabled:C,onClick:()=>async function(){y(!0);try{let e=await r();if(!e||!a||!n)return;if(!(await a.setRecovery({recoveryMethod:"privy",address:n.address,accessToken:e})).address)throw Error("Unable to set recovery on wallet");let t=await s();if(!t)throw Error("Unable to set recovery on wallet");let i=u.getPrivyEthereumWallet(t);if(!i)throw Error("Unabled to set recovery on wallet");f(!!t),setTimeout((()=>{h.data?.setWalletPassword?.onSuccess(i),c()}),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS)}catch(e){w(e)}finally{y(!1)}}(),children:m?"Success":"Confirm"}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN]:()=>{let{logout:t}=o.usePrivy(),{navigate:r,setModalData:n,data:a}=g.usePrivyModal(),{recoveryOAuthFlow:s,closePrivyModal:c,createAnalyticsEvent:u}=o.usePrivyInternal(),[h,p]=i.useState(!1),{provider:y,action:m,isInAccountCreateFlow:f}=a?.recoveryOAuthStatus,[v,w]=i.useState(void 0),[x,C]=i.useState("create-wallet"===m);if("user-passcode"===y)throw Error("RecoveryOAuthScreen should never be called with a wallet that specifies recoveryMethod: `user-passcode`");let E=mm[y].name,b=mm[y].component,S=a?.recoverWallet?.onCompleteNavigateTo,A=new Gi((async(e="create-wallet")=>(C(!0),new Promise(((t,r)=>{setTimeout((async()=>{try{let r=window.open();await s(y,e,r),p(!0),t()}catch(t){w({message:`${"recover"===e?"Recovery":"Back up"} with ${E} unsuccessful`,detail:"recover"===m?`Please verify that you are selecting the ${E} account associated with your backup.`:"",retryable:!0}),r()}}),0)})))));i.useEffect((()=>{"recover"!==m&&A.execute(f?"create-wallet":"set-recovery")}),[]),i.useEffect((()=>{if(!h)return;let e=setTimeout((()=>{f?(n({createWallet:{onSuccess:()=>{},onFailure:e=>{u({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"RecoveryOAuthScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),r(g.ModalScreen.EMBEDDED_WALLET_CREATED_SCREEN)):c({shouldCallAuthOnSuccess:!1})}),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}),[h]);let j=i.useCallback((async()=>{await A.execute("recover"),S?r(S):p(!0)}),[]),$="google-drive"===y?"Google Drive":"Apple iCloud",T=h&&`Successfully ${"recover"===m?"recovered":"backed up"} with ${$}.`||v&&v.message||`${"recover"===m?"Recovering":"Backing up"} with ${$}...`,P=v?v.detail:"";return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{}),x?e.jsx(e.Fragment,{children:e.jsxs(pm,{children:[e.jsx(il,{title:T,icon:e.jsx(b,{style:{width:"38px",height:"38px"}}),description:P}),v&&v?.retryable?e.jsx(jo,{onClick:()=>{pa(),w(void 0),"create-wallet"===m?A.execute("create-wallet"):j()},disabled:!h&&!v?.retryable,children:"Try again"}):null]})}):e.jsxs(pm,{children:[e.jsx(il,{title:"Confirm it's really you",icon:e.jsx(b,{style:{height:42,width:48}}),description:`To confirm your identity, please log in to ${$} where your account is backed up.`}),e.jsxs(jo,{onClick:j,children:["Confirm with ",$]})]}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.EMBEDDED_WALLET_KEY_EXPORT_SCREEN]:()=>{let[t,r]=i.useState(null),{authenticated:n,user:a,getAccessToken:s}=o.usePrivy(),{closePrivyModal:c,createAnalyticsEvent:u,clientAnalyticsId:h}=o.usePrivyInternal(),p=l.useAppConfig(),{data:y,onUserCloseViaDialogOrKeybindRef:m}=g.usePrivyModal(),{onFailure:f,onSuccess:v,origin:w,appId:x,appClientId:C,wallet:E}=y.keyExport,b=e=>{c({shouldCallAuthOnSuccess:!1}),f("string"==typeof e?Error(e):e)},S=()=>{c({shouldCallAuthOnSuccess:!1}),v(),u({eventName:"embedded_wallet_key_export_completed",payload:{walletAddress:E.address}})};return i.useEffect((()=>{if(!n||!E)return b("User must be authenticated before exporting their wallet");s().then(r,b)}),[n,a]),m.current=S,e.jsxs(e.Fragment,{children:[e.jsx(Wo,{onClose:S}),e.jsxs(vd,{children:[e.jsx(fd,{children:"Transfer wallet"}),e.jsxs(md,{children:["Either copy your private key or seed phrase to transfer your wallet."," ",e.jsx("a",{href:"https://privy-io.notion.site/Transferring-your-account-9dab9e16c6034a7ab1ff7fa479b02828",target:"blank",rel:"noopener noreferrer",children:"Learn more"})]}),e.jsx(pd,{theme:p.appearance.palette.colorScheme,children:"Never share your private key or seed phrase with anyone."}),e.jsx(d.WalletInfoCard,{isLoading:!1,isPulsing:!1,title:"Your wallet",address:E.address,showIcon:!0}),e.jsx("div",{style:{width:"100%"},children:t&&e.jsx(gd,{origin:w,appId:x,appClientId:C,accessToken:t,clientAnalyticsId:h,wallet:E,dimensions:{height:"44px"}})})]}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN]:()=>{let{authenticated:t}=o.usePrivy(),{initializeWalletProxy:r,closePrivyModal:n}=o.usePrivyInternal(),{navigate:a,data:s,onUserCloseViaDialogOrKeybindRef:c}=g.usePrivyModal(),[u,h]=i.useState(!0),[p,y]=i.useState(""),[f,v]=i.useState(),[w,x]=i.useState(null),[C,E]=i.useState(!1),b=null!==w;i.useEffect((()=>{t||a(g.ModalScreen.LANDING)}),[t]),i.useEffect((()=>{r(l.WALLET_PROXY_TIMEOUT).then((e=>{h(!1),e||(y("An error has occurred, please try again."),v(new m.PrivyProviderRpcError(new m.ProviderRpcError(p,m.E.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))}))}),[]);let{method:S,data:A,confirmAndSign:j,onSuccess:$,onFailure:T,uiOptions:P}=s.signMessage,_={title:P.title||"Sign message",description:P.description||"Signing this message will not cost you any fees.",buttonText:P.buttonText||"Sign and continue"},k=e=>{e?$(e):T(f||new m.PrivyProviderRpcError(new m.ProviderRpcError("The user rejected the request.",m.E.E4001_USER_REJECTED_REQUEST.eipCode))),n({shouldCallAuthOnSuccess:!1}),setTimeout((()=>{x(null),y(""),v(void 0)}),200)};return c.current=()=>{k(w)},e.jsxs(e.Fragment,{children:[e.jsx(Wo,{onClose:()=>k(w)}),e.jsx(Xs,{}),P.iconUrl&&"string"==typeof P.iconUrl?e.jsx(kf,{children:e.jsx(Ef,{size:"sm",src:P.iconUrl,alt:"app image"})}):null,e.jsx(fd,{children:_.title}),e.jsx(md,{children:_.description}),"personal_sign"===S&&e.jsx($f,{children:bf(A)}),"eth_signTypedData_v4"===S&&e.jsx(jf,{typedData:A}),"solana_signMessage"===S&&e.jsx($f,{children:A}),e.jsx(Nf,{}),e.jsx(Pf,{$fail:!0,children:p}),e.jsx($o,{disabled:C||b||u,loading:C,onClick:async()=>{E(!0),y("");try{let e=await j();x(e),E(!1),setTimeout((()=>{k(e)}),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS)}catch(e){console.error(e),y("An error has occurred, please try again."),v(new m.PrivyProviderRpcError(new m.ProviderRpcError(p,m.E.E32603_DEFAULT_INTERNAL_ERROR.eipCode))),E(!1)}},children:C?"Signing...":b?e.jsxs(_f,{children:[e.jsx(fc,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",e.jsx("span",{children:"Success"})]}):_.buttonText}),e.jsx(Js,{}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN]:()=>{let{data:t,onUserCloseViaDialogOrKeybindRef:r,setModalData:n,navigate:a}=g.usePrivyModal(),{rpcConfig:s,chains:c,closePrivyModal:u,walletProxy:h}=o.usePrivyInternal(),{getAccessToken:p,user:y}=o.usePrivy(),f=l.useAppConfig(),[v,w]=i.useState(0),x=(e=>e?.sendTransaction?"transactionRequest"in e.sendTransaction?0:e.sendTransaction.transactionRequests.length-1:0)(t),[C,E]=i.useState(((e,t)=>e?.sendTransaction?"transactionRequest"in e.sendTransaction?e.sendTransaction.transactionRequest:e.sendTransaction.transactionRequests[t]:void 0)(t,v)),[b,S]=i.useState(null),[A,j]=i.useState(),[$,T]=i.useState(!1),[P,_]=i.useState(null),[k,N]=i.useState(null);if(!C||!t?.sendTransaction||!t?.sendTransaction.transactingWallet)return e.jsx(pc,{error:Error("Invalid transaction request"),onClick:()=>{t?.sendTransaction?.onFailure(Cf),u({shouldCallAuthOnSuccess:!1})}});let I=t.sendTransaction.rootWallet,M=t.sendTransaction.transactingWallet,O=i.useMemo((()=>c.find((e=>Number(e.id)===Number(C.chainId)))),[C.chainId]),R=O?.nativeCurrency.symbol??"ETH",{action:F,amount:L,spender:U,isErc20Ish:D}=i.useMemo((()=>(e=>{let t=vf(e);if(t)return{action:"approve",isErc20Ish:!0,functionName:t.functionName,spender:t.args[0],amount:t.args[1]};let r=wf(e);return r?{action:"transfer",isErc20Ish:!0,functionName:r.functionName,amount:r.args[1]}:{action:"transaction",isErc20Ish:!1}})(C.data)),[C.data]);i.useEffect((()=>{C.to&&O&&D&&dh({address:C.to,chain:O,rpcConfig:f.rpcConfig,privyAppId:f.id}).then(S).catch(console.error)}),[C.to,O]);let{tokenPrice:W,isTokenPriceLoading:B}=Hc(C),H=i.useMemo((()=>d.getJsonRpcProvider(Number(C.chainId),c,s,{appId:f.id})),[C.chainId,s]),G=xf(C,M,H);i.useEffect((()=>{t.sendTransaction?.getIsSponsored?t.sendTransaction.getIsSponsored().then(j).catch(console.error):j(!1)}),[t.sendTransaction.getIsSponsored]);let q=()=>{if(!$)return P?t?.sendTransaction?.onSuccess(P.response):k||G?.errors[0]?t?.sendTransaction?.onFailure(k??G?.errors[0]??Cf):t?.sendTransaction?.onFailure(new m.PrivyProviderRpcError(new m.ProviderRpcError("The user rejected the request",m.E.E4001_USER_REJECTED_REQUEST.eipCode))),u({shouldCallAuthOnSuccess:!1})};r.current=q;let z=!!(f.fundingConfig&&f.fundingConfig.methods.length>0&&t.funding),V="fiat-currency"===f.embeddedWallets.priceDisplay.primary,K=d.i(G?.tx.value??0).add(d.i(G?.totalGasEstimate?.toBigInt()??0)).toHexString(),Y=d.getNativeCurrencyFromWei(K,R),Z=V&&W?d.getDollarsFromWei(K,W):void 0,X=d.getNativeCurrencyFromWei(G?.totalGasEstimate?.toString()??0,R),J=V&&W?d.getDollarsFromWei(G?.totalGasEstimate?.toString()??0,W):void 0,Q=d.getNativeCurrencyFromWei(G?.balance?.toString()??0,R,void 0,!0),ee=V&&W?d.getDollarsFromWei(G?.balance?.toString()??0,W):void 0,te=t.sendTransaction?.uiOptions?.transactionInfo?.title||("approve"===F?"Confirm address":`Approve ${F}`),re=t.sendTransaction?.uiOptions?.description||`${f.name} wants your permission to approve the following transaction.`,ne=t.sendTransaction?.uiOptions?.transactionInfo?.contractInfo?.imgUrl?e.jsx("img",{src:t.sendTransaction.uiOptions.transactionInfo.contractInfo.imgUrl,alt:t.sendTransaction.uiOptions.transactionInfo.contractInfo.imgAltText}):null,ie=!(!G||G.errors[0]||G.hasFunds||!1!==A),ae=ie&&z,oe=ae?"Add funds":t.sendTransaction?.uiOptions?.buttonText||(v<x?"Continue":"Approve");if(P?.receipt)return e.jsx(mf,{txn:G?.tx??C,onClose:q,receipt:P.receipt,transactionInfo:t.sendTransaction?.uiOptions.transactionInfo,tokenPrice:W,tokenSymbol:R,l1GasEstimate:G?.l1ExecutionFeeEstimate?.toString(),receiptHeader:t.sendTransaction?.uiOptions.successHeader,receiptDescription:t.sendTransaction?.uiOptions.successDescription});if(k)return e.jsx(Nm,{transactionError:k,network:"ethereum",chainId:G?.tx.chainId??C.chainId,onClose:q,onRetry:({resetNonce:e})=>{N(null);let t={...G?.tx??C};e&&(t.nonce=void 0),E(t)}});let se=0!==x&&"number"==typeof v&&0!==v?()=>{w(v-1)}:void 0;return e.jsx(bm,{transactionIndex:v,onBack:se,maxIndex:x,disabled:ie&&!z,isSubmitting:$,submitError:k,isPreparing:!G,isTokenPriceLoading:B,isTokenContractInfoLoading:!b,prepareError:G?.errors[0],symbol:b?.symbol,chain:O,img:ne,title:te,subtitle:re,spender:U,total:C.value?Z??Y:void 0,txValue:C.value,fee:J??X,isSponsored:A,to:C.to,network:f.chains.find((e=>e.id===C.chainId))?.name??"",from:M?.address??"",cta:oe,missingFunds:ie,action:F,balance:ee??Q,amount:L&&b?qc({amount:L,decimals:b.decimals}):L,onClose:q,onClick:ae?async()=>{if(!M)return;if(!z)throw Error("Funding wallet is not enabled");let e=pf({fundingMethods:f.fundingConfig.methods});n({...t,funding:{...t.funding,methodScreen:e}}),a(e)}:async()=>{if(v<x)w(v+1);else{T(!0);try{let e=await p();if($||!e||!M||!h||!y)return;let r=t?.sendTransaction?.onConfirm?await t.sendTransaction.onConfirm().then((e=>H.getTransaction(e))):await nf({accessToken:e,transactingWallet:M,rootWallet:I,walletProxy:h,transactionRequest:G?.tx??C,provider:H,requesterAppId:t.sendTransaction?.requesterAppId}),n=await r.wait();_({receipt:of(n),response:r})}catch(e){console.warn({transaction:G?.tx??C,error:e}),N(e)}finally{T(!1)}}}})},[g.ModalScreen.EMBEDDED_WALLET_SEND_SOLANA_TRANSACTION_SCREEN]:()=>{let{data:t,onUserCloseViaDialogOrKeybindRef:r}=g.usePrivyModal(),{closePrivyModal:n,walletProxy:a}=o.usePrivyInternal(),s=l.useAppConfig(),{user:d}=o.usePrivy(),[c,u]=i.useState(t?.sendSolanaTransaction?.transactionRequest),[h,p]=i.useState(),[y,m]=i.useState(),[f,v]=i.useState(0),[w,x]=i.useState(!1),[C,E]=i.useState(),[b,S]=i.useState(null),A=t?.sendSolanaTransaction?.connection,j=t?.sendSolanaTransaction?.transactingWallet,$=h?.instructions.at(f),T=h?.instructions.length??1;if(i.useEffect((()=>{!async function(){if(c&&A)try{m(void 0);let e=await vy(c,A);p(e),v(0)}catch(e){console.warn("Failed to prepare transaction",e),m(e)}}()}),[c,A]),!(c&&t?.sendSolanaTransaction&&j&&A)){let r=Error("Invalid transaction request");return e.jsx(pc,{error:r,onClick:()=>{t?.sendSolanaTransaction?.onFailure(r),n({shouldCallAuthOnSuccess:!1})}})}let{solPrice:P,isSolPriceLoading:_}=(()=>{let{showFiatPrices:e,getUsdPriceForSol:t}=o.usePrivyInternal(),[r,n]=i.useState(!0),[a,s]=i.useState(void 0),[l,d]=i.useState(void 0);return i.useEffect((()=>{(async()=>{if(e)try{n(!0);let e=await t();e?d(e):s(Error("Unable to fetch SOL price"))}catch(e){s(e)}finally{n(!1)}else n(!1)})()}),[]),{solPrice:l,isSolPriceLoading:r,solPriceError:a}})(),k=()=>{if(!w)return C?t?.sendSolanaTransaction?.onSuccess(C):(t?.sendSolanaTransaction?.onFailure(b??y??Error("User exited the modal before submitting the transaction")),v(0)),n({shouldCallAuthOnSuccess:!1})};r.current=k;let N="fiat-currency"===s.embeddedWallets.priceDisplay.primary,I=t.sendTransaction?.uiOptions?.transactionInfo?.title||("approve"===$?.action?"Confirm address":"Approve transaction"),M=t.sendTransaction?.uiOptions?.description||`${s.name} wants your permission to approve the following transaction.`,O=t.sendTransaction?.uiOptions?.transactionInfo?.contractInfo?.imgUrl?e.jsx("img",{src:t.sendTransaction.uiOptions.transactionInfo.contractInfo.imgUrl,alt:t.sendTransaction.uiOptions.transactionInfo.contractInfo.imgAltText}):null,R=$?.amount||0n,F=0===f&&h?.fees||0n,L=$?.balance||0n,U=$?.from,D=$?.to,W=R+F,B=uy(W),H=N&&P?hy(W,P):void 0,G=F?uy(F):void 0,q=N&&P?hy(F,P):void 0,z=L?uy(L):void 0,V=N&&P?hy(L,P):void 0,K=t.sendTransaction?.uiOptions?.buttonText||"Approve";return C?e.jsx(tf,{instructions:h?.instructions.map((({from:e,to:t,amount:r})=>({from:e.toBase58(),to:t.toBase58(),amount:r})))??[],fees:0===f?C.fees:0n,onClose:k,transactionInfo:t.sendTransaction?.uiOptions.transactionInfo,solPrice:P,receiptHeader:t.sendTransaction?.uiOptions.successHeader,receiptDescription:t.sendTransaction?.uiOptions.successDescription,rpcEndpoint:A.rpcEndpoint}):b?e.jsx(Nm,{transactionError:b,connection:A,onClose:k,network:"solana",onRetry:async()=>{S(null);let{blockhash:e}=await A.getLatestBlockhash();$e.isVersionedTransaction(c)?c.message.recentBlockhash=e:c.recentBlockhash=e,u(c)}}):e.jsx(bm,{isSubmitting:w,submitError:b,isPreparing:!h,isTokenPriceLoading:_,isTokenContractInfoLoading:!1,symbol:"SOL",chain:void 0,img:O,title:I,subtitle:M,from:U?.toBase58()||"",to:D?.toBase58(),fee:q??G,total:null!=R?H??B:void 0,txValue:R,spender:$?.spender?.toBase58(),network:"Solana",cta:K,missingFunds:!y&&!$?.hasFunds,action:$?.action,balance:V??z,prepareError:y,chainName:"Solana",onClose:k,onClick:async()=>{if(f<(h?.instructions.length??1)-1)v(f+1);else try{x(!0);let e=await Sg();if(w||!e||!j||!a||!d)return;let{signature:r,receipt:n}=await Cm({tx:c,accessToken:e,connection:A,walletProxy:a,transactingWalletAddress:j.address,transactionOptions:t.sendSolanaTransaction?.transactionOptions});E(gy(r,n))}catch(e){console.warn({transaction:c,error:e}),S(e)}finally{x(!1)}},isSponsored:!1,transactionIndex:f,maxIndex:T-1,disabled:!$?.hasFunds,onBack:f>0&&T>1?()=>v(f-1):void 0})},[g.ModalScreen.EMBEDDED_WALLET_DELEGATED_ACTIONS_CONSENT_SCREEN]:()=>{let{app:t,data:r}=g.usePrivyModal(),{closePrivyModal:n}=o.usePrivyInternal(),[a,s]=i.useState(!1),[c,u]=i.useState(),h=async()=>{a?r?.delegatedActions?.onSuccess():r?.delegatedActions?.onError(c??new o.PrivyClientError("User declined delegating actions.")),n({shouldCallAuthOnSuccess:!1})};return i.useEffect((()=>{if(!a&&!c)return;let e=setTimeout(h,l.DEFAULT_SUCCESS_SCREEN_LONG_DURATION_MS);return()=>clearTimeout(e)}),[a,c]),a||c?e.jsxs(e.Fragment,{children:[e.jsx(Wo,{onClose:h}),e.jsx(Xs,{}),e.jsxs(qs,{children:[c?e.jsx(T.ExclamationCircleIcon,{stroke:"var(--privy-color-error)",width:"64px",height:"64px"}):e.jsx(T.CheckCircleIcon,{stroke:"var(--privy-color-success)",width:"64px",height:"64px"}),e.jsx(el,{height:20}),e.jsx(il,{title:c?"Something went wrong":"Success!",description:c?"Please try again.":"You've successfully delegated actions."})]}),e.jsx(Js,{}),e.jsx(d.BlobbyFooter,{})]}):e.jsxs(e.Fragment,{children:[e.jsx(Wo,{closeable:!0,onClose:h}),e.jsx(Gl,{width:56,height:56,style:{margin:"auto"}}),e.jsx(Cs,{style:{marginTop:24},children:"Enable delegated actions"}),e.jsxs(Es,{children:["Give ",t.name," permissions to transact on your behalf. You can revoke this later."," ",e.jsx("a",{style:{color:"var(--privy-color-accent-dark)"},href:"https://www.privy.io/using-privy",target:"_blank",children:"Learn more"})]}),e.jsx(zl,{showIcon:!0,address:r?.delegatedActions?.address??"",title:"Wallet",isLoading:!1}),e.jsxs(ql,{style:{marginTop:24},children:[e.jsx(ko,{onClick:h,children:"No thanks"}),e.jsx(jo,{onClick:async()=>{try{await(r?.delegatedActions?.onDelegate()),s(!0)}catch(e){u(e)}},children:"Accept"})]}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.FUNDING_METHOD_SELECTION_SCREEN]:()=>{let{wallets:r}=l.useWallets(),{navigate:n,data:a,setModalData:o}=g.usePrivyModal(),s=l.useAppConfig(),c=a?.funding,u=i.useRef(null),[h,p]=i.useState(!1);i.useEffect((()=>{u.current&&u.current.style.setProperty("--funding-input-length",Math.max(c.amount.length,1).toString())}),[c.amount,u.current]);let y=s.fundingConfig?.methods.slice()??[],{tokenPrice:m}=Hc({chainId:c.chain.id});i.useEffect((()=>{c.erc20Address&&c.chain&&!c.erc20ContractInfo&&dh({address:c.erc20Address,chain:c.chain,rpcConfig:s.rpcConfig,privyAppId:s.id}).then((e=>o({...a,funding:{...a.funding,erc20ContractInfo:e?{symbol:e.symbol,decimals:e.decimals}:void 0}}))).catch(console.error)}),[c.erc20Address,c.chain]);let f=m?d.getDollarsFromStringFloat(c.amount,m):void 0,v=r.find((e=>t.getAddress(e.address)===t.getAddress(c.address))),w=v&&"privy"!==v.walletClientType?Sl(v.walletClientType,v.connectorType,v.walletClientType):s.name,x=parseFloat(c.amount),C=!isNaN(x)&&x>0,E=!(!c.erc20Address||c.erc20ContractInfo),b=c.isUSDC?"USDC":c.erc20Address?void 0:"native-currency",S=b&&((e,t)=>{switch(t){case"native-currency":return hh.has(e);case"USDC":return ph.has(e);default:return console.warn("Unknown asset passed to MoonPay Onramp"),!1}})(Number(c.chain.id),b),A=b&&((e,t)=>{switch(t){case"native-currency":return Qu.has(e);case"USDC":return eh.has(e);default:return console.warn("Unknown asset passed to Coinbase Onramp"),!1}})(Number(c.chain.id),b),j=c.erc20Address||!c.erc20Address&&!c.isUSDC;return e.jsxs(e.Fragment,{children:[e.jsx(Fc,{}),e.jsxs("h3",{children:["Add funds to your"," ",w?.toLowerCase().endsWith("wallet")?w:w+" wallet"]}),e.jsx(Ks,{style:{marginTop:"32px"},children:e.jsx(Mu,{children:E?e.jsx(Lc,{size:"50px"}):e.jsxs(e.Fragment,{children:[e.jsxs(Ou,{onClick:()=>u.current?.focus(),children:[e.jsx(Fu,{ref:u,value:c.amount,onFocus:()=>p(!0),onBlur:()=>p(!1),onChange:e=>{let t=e.target.value;/^[0-9.]*$/.test(t)&&t.split(".").length-1<=1&&o({...a,funding:{...c,amount:t}})}}),e.jsx(Uu,{children:c.erc20Address?c.erc20ContractInfo?.symbol:c.chain.nativeCurrency.symbol}),!h&&e.jsx(Lu,{children:e.jsx(ft.default,{width:12,height:12})})]}),!c.erc20Address&&e.jsx(Du,{children:f&&C?f:""})]})})}),e.jsxs(Nu,{children:[c.errorMessage&&e.jsx(sh,{children:c.errorMessage}),y.sort().map((t=>{switch(t){case"moonpay":return S?e.jsxs(ts,{disabled:!C||E,onClick:()=>{n(g.ModalScreen.MOONPAY_PROMPT_SCREEN)},children:[e.jsx(Iu,{children:e.jsx(wh,{style:{width:24}})}),"Moonpay"]},t):null;case"coinbase-onramp":return A?e.jsxs(ts,{disabled:!C||E,onClick:()=>{n(g.ModalScreen.COINBASE_ONRAMP_STATUS_SCREEN)},children:[e.jsx(Iu,{children:e.jsx(ba,{style:{width:24}})}),"Coinbase Onramp"]},t):null;case"external":return j?e.jsxs(ts,{disabled:!C||E,onClick:()=>{n(g.ModalScreen.FUNDING_TRANSFER_FROM_WALLET_SCREEN)},children:[e.jsx(Iu,{children:e.jsx(Ge.default,{style:{width:24}})}),"Transfer from wallet"]},t):null}})),e.jsx(Bu,{disabled:!C,onClick:()=>n(g.ModalScreen.FUNDING_MANUAL_TRANSFER_SCREEN),children:"Send funds manually"})]}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.MOONPAY_PROMPT_SCREEN]:()=>{let{app:t,data:r,navigate:n,setModalData:a}=g.usePrivyModal(),{createAnalyticsEvent:s,getMoonpaySignedUrl:l}=o.usePrivyInternal(),[c,u]=i.useState(null),h=r?.funding,p=h.isUSDC?"USDC":"native-currency";return i.useEffect((()=>{!c&&h&&async function(){if(!t.fundingConfig)return;let{signedUrl:e,externalTransactionId:n}=await l(h.address,{...t.fundingMethodConfig.moonpay,...h.moonpayConfigOverride,currencyCode:h.moonpayConfigOverride?.currencyCode??yh(h.chain.id,p),quoteCurrencyAmount:h.moonpayConfigOverride?.quoteCurrencyAmount??mh(h.amount)});u(e),a({moonpayStatus:{externalTransactionId:n},funding:r?.funding})}()}),[c,h]),e.jsxs(e.Fragment,{children:[e.jsx(Fc,{}),e.jsx(Ph,{app:t,signedUrl:c,onContinue:()=>{s({eventName:"sdk_fiat_on_ramp_started",payload:{provider:uh}}),n(g.ModalScreen.MOONPAY_STATUS_SCREEN)}}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.MOONPAY_STATUS_SCREEN]:()=>{let{app:t,data:r}=g.usePrivyModal(),{closePrivyModal:n}=o.usePrivyInternal(),{externalTransactionId:i}=r?.moonpayStatus,a=vh(i||null,t.fundingMethodConfig.moonpay.useSandbox??!1);return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{title:"Fund account"},"header"),e.jsx(Dh,{status:a,onClickCta:n}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.COINBASE_ONRAMP_STATUS_SCREEN]:()=>{let{data:t,setModalData:r,navigate:n}=g.usePrivyModal(),{closePrivyModal:a,createAnalyticsEvent:s,initCoinbaseOnRamp:l,getCoinbaseOnRampStatus:c}=o.usePrivyInternal(),u=t?.funding,h=u.isUSDC?"USDC":"ETH",[p,y]=i.useState(!1),[m,f]=i.useState(!1);return i.useEffect((()=>{if(p)return;y(!0);let e=async()=>{try{s({eventName:"sdk_fiat_on_ramp_started",payload:{provider:"coinbase-onramp",value:u.amount,chainId:u.chain.id}});let e=window.open(void 0,void 0,Ju({w:440,h:680})),t=function(e){let t=th[e];if(!t)throw new o.PrivyClientError(`Unsupported chainId: ${e} for Coinbase Onramp`);return t}(u.chain.id),r=await l({addresses:[{address:u.address,blockchains:[t]}],assets:[h]}),{url:n}=(({input:e,amount:t,blockchain:r})=>{let n=new URL("https://pay.coinbase.com/buy/select-asset");return n.searchParams.set("appId",e.app_id),n.searchParams.set("sessionToken",e.session_token),n.searchParams.set("defaultExperience","buy"),n.searchParams.set("presetCryptoAmount",t.startsWith(".")?`0${t}`:t),n.searchParams.set("defaultNetwork",r),n.searchParams.set("partnerUserId",e.partner_user_id),{url:n}})({input:r,amount:u.amount,blockchain:t});if(!e)throw Error("Unable to initiate Coinbase Onramp flow.");e.location=n.toString();let i=0,a=!1;for(;i<rh;){i++;let{status:t}=await c({partnerUserId:r.partner_user_id});if("success"===t){a=!0;break}if("failure"===t)throw Error("There was an error completing Coinbase Onramp flow.");if(e.closed)throw Error("User exited Coinbase Onramp flow before transaction response.");await new Promise((e=>setTimeout(e,1500)))}if(!a)throw Error("Timed out waiting for transaction response from Coinbase Onramp.");f(!0)}catch(e){console.error(e),s({eventName:zc,payload:{status:"failure",provider:"coinbase-onramp",error:e.message}}),r({funding:{...u,errorMessage:"Something went wrong adding funds from Coinbase Onramp. Please try again or use another method to fund your wallet."}}),n(g.ModalScreen.FUNDING_METHOD_SELECTION_SCREEN)}finally{y(!1)}},t=setTimeout((()=>{e()}),500);return()=>clearTimeout(t)}),[]),e.jsxs(e.Fragment,{children:[e.jsx(Wo,{title:"Fund account"},"header"),e.jsx(nh,{isSucccess:m,onClickCta:a}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.FUNDING_TRANSFER_FROM_WALLET_SCREEN]:()=>{let{connectors:t}=o.usePrivyInternal(),{app:r,setModalData:n,data:a,navigate:s}=g.usePrivyModal(),[l,c]=i.useState("default"),u=Rl(r.appearance.walletList,"ethereum-only",t,!0,r.appearance.walletList,r.externalWallets.walletConnect.enabled),h=e.jsx(Vh,{text:"More wallets",onClick:()=>c("overflow")});return i.useEffect((()=>{n({...a,externalConnectWallet:{onCompleteNavigateTo:g.ModalScreen.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN}})}),[]),"overflow"===l?e.jsxs(e.Fragment,{children:[e.jsx(Wo,{backFn:()=>c("default")},"header"),e.jsxs(Xo,{children:[e.jsx(md,{style:{color:"var(--privy-color-foreground-3)",textAlign:"left"},children:"More wallets"}),u]}),e.jsx(d.BlobbyFooter,{})]}):e.jsxs(e.Fragment,{children:[e.jsx(Fc,{}),e.jsx(il,{title:"Transfer from wallet",description:"Connect a wallet to deposit funds or send funds manually to your wallet address."}),e.jsxs(Xo,{children:[...u.length>3?u.slice(0,2):u,u.length>3&&h,e.jsx(zh,{onClick:()=>s(g.ModalScreen.FUNDING_MANUAL_TRANSFER_SCREEN),children:"Send funds manually"})]}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN]:()=>{let{rpcConfig:t,appId:r,closePrivyModal:n,createAnalyticsEvent:a}=o.usePrivyInternal(),{navigate:s,setModalData:c,app:u,data:h}=g.usePrivyModal(),{wallets:p}=l.useWallets(),[y,m]=i.useState(!1),[f,v]=i.useState(0n),[w,x]=i.useState(!1),[C,E]=i.useState(null),[b,S]=i.useState(null),[A,j]=i.useState([]),[$,T]=i.useState(0),[P,_]=i.useState(!1),[k,N]=i.useState(!1),[I,M]=i.useState(!1),[O,R]=i.useState(!1),{erc20ContractInfo:F,erc20Address:L,address:U,chain:D,amount:W}=h.funding;i.useEffect((()=>{L&&!F&&E(Error("Unable to fetch token details"))}),[]);let B=!!L&&!!F,H=B?BigInt(parseFloat(W)*10**F.decimals):Z.parseEther(W),G=p[0],[q,z]=i.useState(null);i.useEffect((()=>{(async()=>{if(!G)return;let e=await G.getEthereumProvider();z(Z.createWalletClient({account:G.address,transport:Z.custom(e)}).extend(Z.publicActions))})().catch(console.error)}),[G]);let[V,K]=i.useState(0n);i.useEffect((()=>{Z.createPublicClient({chain:D,transport:Z.http(d.getJsonRpcEndpointFromChain(D,t,r))}).getBalance({address:U}).then(K).catch(console.error)}),[]);let[Y,X]=i.useState(0n);i.useEffect((()=>{B&&(async({chain:e,address:t,appId:r,rpcConfig:n,erc20Address:i})=>{let a=Z.createPublicClient({chain:e,transport:Z.http(d.getJsonRpcEndpointFromChain(e,n,r))});return{balance:await a.readContract({address:i,abi:Xc,functionName:"balanceOf",args:[t]}).catch((()=>0n)),chain:e}})({chain:D,address:U,appId:r,rpcConfig:t,erc20Address:L}).then((e=>X(e.balance))).catch(console.error)}),[]);let{tokenPrice:J}=Hc({chainId:D.id}),[Q,ee]=i.useState({to:U,chain:D,value:H,data:void 0});i.useEffect((()=>{(async()=>{let e,n;if(!q||!G||P||I)return;_(!0);let i=Z.createPublicClient({chain:Q.chain,transport:Z.http(d.getJsonRpcEndpointFromChain(Q.chain,t,r))});if(B&&!Q.data)return await i.simulateContract({address:L,chain:Q.chain,abi:Gc,functionName:"transfer",args:[U,H],account:G.address}).catch((e=>{console.warn("Simulated token transfer failed with error, fetching bridge options.",e)}))?(_(!1),void ee({to:L,chain:Q.chain,data:Z.encodeFunctionData({abi:Gc,functionName:"transfer",args:[U,H]}),value:"0x0"})):(_(!1),void x(!0));try{e=await i.prepareTransactionRequest({account:G.address,to:Q.to,chain:Q.chain,data:Q.data,value:BigInt(Q.value??0)})}catch(e){console.error(e),A.length>1&&S(e.shortMessage??"Something went wrong")}if(!e)return _(!1),void x(!0);_(!1),M(!0),m(!0),v(e.gas);try{await q.switchChain({id:Q.chain.id})}catch(e){await q.addChain({chain:Q.chain}),await q.switchChain({id:Q.chain.id})}try{n=await q.sendTransaction(e),a({eventName:zc,payload:{provider:"external",status:"success",address:G.address,chainId:Q.chain.id,value:Q.value?.toString(),txHash:n}})}catch(e){console.error(e),"TransactionExecutionError"===e.name&&(A.length<1?E(new o.PrivyClientError(e.shortMessage,void 0,o.PrivyErrorCode.TRANSACTION_FAILURE)):S(e.shortMessage??"Something went wrong"))}n?(await q.waitForTransactionReceipt({hash:n}),M(!1),R(!0)):M(!1)})().catch(console.error)}),[q,Q]),i.useEffect((()=>{(async()=>{if(!w||!q||!G)return;let e=l.addToDefaultChains(u.chains).filter((e=>e.id!==h.funding.chain.id&&!!e.testnet==!!h.funding.chain.testnet));B&&e.unshift(h.funding.chain);let n=await(({chains:e,appId:t,address:r,rpcConfig:n})=>Promise.all(e.map((async e=>{let i=Z.createPublicClient({chain:e,transport:Z.http(d.getJsonRpcEndpointFromChain(e,n,t))});return{balance:await i.getBalance({address:r}).catch((()=>0n)),chain:e}}))))({chains:e,address:G.address,appId:r,rpcConfig:t}),i=B?n.filter((e=>e.balance>0n)):n.filter((e=>e.balance>H));if(i.length<1)return void E(new o.PrivyClientError(`Wallet ${d.formatWalletAddress(G.address)} does not have enough funds.`,void 0,o.PrivyErrorCode.INSUFFICIENT_BALANCE));i.sort(((e,t)=>Number(t.balance-e.balance)));let a=(await Promise.allSettled(i.map((async e=>({quote:await Yc({isTestnet:!!h.funding?.chain.testnet,input:Kc({amount:H.toString(),user:G.address,recipient:U,destinationChainId:D.id,destinationCurrency:L,originChainId:e.chain.id})}),...e}))))).filter((e=>"fulfilled"===e.status)).map((e=>e.value));if(a.length<1)return void E(new o.PrivyClientError(`Wallet ${d.formatWalletAddress(G.address)} does not have enough funds.`,void 0,o.PrivyErrorCode.INSUFFICIENT_BALANCE));let s=a.map((e=>({bridgeTx:Zc(e.quote),balance:e.balance,chain:e.chain}))).filter((e=>!!e.bridgeTx));if(s.length>1)return void j(s);let c=s[0];c?(N(!0),ee({data:c.bridgeTx.data,to:c.bridgeTx.to,value:c.bridgeTx.value,chain:c.chain})):E(new o.PrivyClientError(`Wallet ${d.formatWalletAddress(G.address)} does not have enough funds.`,void 0,o.PrivyErrorCode.INSUFFICIENT_BALANCE))})().catch(console.error)}),[w]),i.useEffect((()=>{if(!C)return;let e={error:C,previousScreen:g.ModalScreen.FUNDING_TRANSFER_FROM_WALLET_SCREEN};c({funding:h?.funding,sendTransaction:h?.sendTransaction,errorModalData:e}),s(g.ModalScreen.ERROR_SCREEN,!1)}),[C]);let te=G?Sl(G.walletClientType,G.connectorType,G.walletClientType)||"wallet":null,re=!B&&J?d.getDollarsFromStringFloat(h?.funding?.amount??"0",J):void 0,ne=B?f:d.sumWeiQuantitiesToHexString([f,H]),ie=ne&&J?d.getDollarsFromWei(ne,J):void 0,ae=ne?d.getNativeCurrencyFromWei(ne,"ETH"):void 0,oe=f&&J?d.getDollarsFromWei(f,J):void 0,se=f?d.getNativeCurrencyFromWei(f,"ETH"):void 0;if(i.useEffect((()=>{if(!O)return;let e=setTimeout(n,l.DEFAULT_SUCCESS_SCREEN_EXTRA_LONG_DURATION_MS);return()=>clearTimeout(e)}),[O]),O)return e.jsxs(e.Fragment,{children:[e.jsx(Fc,{}),e.jsx(Xs,{}),e.jsxs(Vs,{children:[e.jsx(ct.default,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),e.jsx(il,{title:"Success!",description:`You’ve successfully added ${W} ${B?F.symbol:D.nativeCurrency.symbol} to your ${u.name} wallet. It may take a minute before the funds are available to use.`})]}),e.jsx(Js,{}),e.jsx(d.BlobbyFooter,{})]});let le=B?`${qc({amount:Y,decimals:F.decimals})} ${F.symbol}`:d.getNativeCurrencyFromWei(V,D.nativeCurrency.symbol,3,!0),de=A[$];return A.length>1&&de?e.jsx(qu,{displayName:te,configuredFundingChain:D,formattedBalance:le,fundingAmount:W,fundingCurrency:B?F.symbol:D.nativeCurrency.symbol,fundingAmountInUsd:re,options:A,selectedOption:de,isPreparing:P,isSubmitting:I,errorMessage:b,onSubmit:()=>{ee({to:de.bridgeTx.to,data:de.bridgeTx.data,value:de.bridgeTx.value,chain:de.chain})},onSelect:e=>{e!==$&&(S(null),T(e))}}):y&&f&&G&&h?.funding?e.jsx(zu,{wallet:G,displayName:te,addressToFund:U,isBridging:k,isErc20Flow:B,totalPriceInUsd:ie,totalPriceInNativeCurrency:ae,gasPriceInUsd:oe,gasPriceInNativeCurrency:se,chain:h.funding.chain}):e.jsxs(e.Fragment,{children:[e.jsx(Fc,{}),e.jsx(Lc,{}),e.jsx("div",{style:{marginTop:"1rem"}}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.FUNDING_MANUAL_TRANSFER_SCREEN]:()=>{let{wallets:t}=l.useWallets(),{app:r,data:n,setModalData:a,navigate:s,lastScreen:c}=g.usePrivyModal(),{chains:u,rpcConfig:h,appId:p,closePrivyModal:y,createAnalyticsEvent:m}=o.usePrivyInternal(),[f,v]=i.useState("default"),[w,x]=i.useState(void 0),C=n?.funding,{tokenPrice:E}=Hc({chainId:C.chain.id}),b=E?d.getDollarsFromStringFloat(C.amount,E):void 0,S=t.find((e=>d.formatWalletAddress(e.address)===d.formatWalletAddress(C.address))),A=S&&"privy"!==S.walletClientType?Sl(S.walletClientType,S.connectorType,S.walletClientType):r.name;if(!C)return a({errorModalData:{error:Error("Couldn't find funding config"),previousScreen:c||g.ModalScreen.FUNDING_METHOD_SELECTION_SCREEN},funding:n?.funding,sendTransaction:n?.sendTransaction}),s(g.ModalScreen.ERROR_SCREEN),e.jsx(e.Fragment,{});i.useEffect((()=>{let e=d.getJsonRpcProvider(C.chain.id,u,h,{appId:p});function t(){e.getBalance(C.address).then((e=>{let t=parseFloat(ie.formatUnits(e,"ether"));x((e=>(e&&t>e&&m({eventName:zc,payload:{provider:"manual",status:"success",address:S?.address,value:(t-e).toString()}}),t)))})).catch((()=>x(void 0)))}let r=setInterval(t,2e3);return t(),()=>clearInterval(r)}),[]);let j=i.useMemo((()=>void 0!==w&&w>=parseFloat(C.amount)),[w,C.amount]),$=e.jsxs(e.Fragment,{children:[e.jsx(d.WalletInfoCard,{title:"Your wallet",errMsg:void 0,isLoading:!C||void 0===w,isPulsing:!j,balance:`${void 0!==w?w.toPrecision(2):""} ETH`,address:C.address,statusColor:j?"green":"gray"}),j&&e.jsx(Gu,{onClick:()=>y(),children:"Close"})]});return"qr-code"===f?e.jsxs(e.Fragment,{children:[e.jsx(Wo,{backFn:()=>v("default")}),e.jsxs(Ks,{style:{gap:"24px",marginBottom:"24px"},children:[e.jsxs("div",{children:[e.jsx(Cs,{children:"Scan QR code"}),e.jsxs(Es,{children:["Scan this code using your mobile wallet to send funds to your ",A," ","wallet."]})]}),e.jsx(Pc,{url:C.address,size:200,squareLogoElement:xh}),$]}),e.jsx(d.BlobbyFooter,{})]}):e.jsxs(e.Fragment,{children:[e.jsx(Fc,{}),e.jsx(il,{title:"Send funds",description:"Send funds directly to your wallet by copying your wallet address or scanning a QR code."}),e.jsxs(Ks,{style:{gap:"16px"},children:[e.jsxs(bh,{children:[e.jsx(gt.default,{height:"20px",width:"20px",color:"var(--privy-color-accent-light)"}),e.jsxs(Sh,{children:["Make sure to send on ",C.chain.name,"."]})]}),e.jsxs(Ah,{children:[e.jsx(el,{height:16}),e.jsxs(Mu,{children:[e.jsxs(Ou,{children:[e.jsx(Ru,{children:C.amount}),e.jsx(Uu,{children:C.chain.nativeCurrency.symbol})]}),e.jsx(Du,{children:b?`${b} USD`:"..."}),e.jsxs(Wu,{children:[e.jsx(nu,{chainId:C.chain.id,height:16,width:16})," ",C.chain.name]})]}),e.jsx(el,{height:8}),e.jsxs(Eh,{children:[e.jsx(Ch,{text:C.address}),e.jsx($h,{onClick:()=>v("qr-code"),children:e.jsxs(jh,{children:[e.jsx(vt.default,{height:"16px",width:"16px"}),"Scan code"]})})]})]}),$]}),e.jsx(el,{height:16}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN]:()=>{let{closePrivyModal:t}=o.usePrivyInternal(),{data:r,setModalData:n,navigate:i,onUserCloseViaDialogOrKeybindRef:a}=g.usePrivyModal(),{onSuccess:s,onFailure:l}=r.setWalletPassword,c=()=>{l(new o.PrivyEmbeddedWalletError("Exited before password was added to wallet")),t({shouldCallAuthOnSuccess:!1})};return a.current=c,e.jsxs(e.Fragment,{children:[e.jsx(Wo,{onClose:c}),e.jsx(Xs,{}),e.jsxs(Vs,{children:[e.jsxs(Qs,{children:[e.jsx(st.default,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),e.jsx(tl,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:e.jsx(lt.default,{width:"12px",height:"12px",fill:"white"})})]}),e.jsxs(il,{title:"Secure Your Account",children:["Please set a password to secure your account.",e.jsx("p",{children:"Losing access to this password and this device will make your account inaccessible."})]})]}),e.jsx(jo,{onClick:()=>{n({createWallet:{onFailure:l,onSuccess:s,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),i(g.ModalScreen.EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN)},children:"Add password"}),e.jsx(Js,{}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN]:()=>{let[t,r]=i.useState(null),[n,a]=i.useState(!1),[s,l]=i.useState(null),[d,c]=i.useState(""),{authenticated:h,getAccessToken:p,user:y}=o.usePrivy(),{walletProxy:m,refreshUser:f,closePrivyModal:v,createAnalyticsEvent:w}=o.usePrivyInternal(),{app:x,navigate:C,data:E,onUserCloseViaDialogOrKeybindRef:b}=g.usePrivyModal(),{onSuccess:S,onFailure:A}=E.createWallet,j=u.getPrivyEthereumWallet(y),$="user-passcode"===t?.recoveryMethod,T="user-passcode"===j?.recoveryMethod;i.useEffect((()=>{h||(C(g.ModalScreen.LANDING),A(new o.PrivyUnauthenticatedError("User must be authenticated before setting a password on a Privy wallet")))}),[h]);let P=()=>s?(A(s),void v({shouldCallAuthOnSuccess:!1})):$?(S(t),void v({shouldCallAuthOnSuccess:!1})):(A(new o.PrivyEmbeddedWalletError("Exited before password was added to wallet")),void v({shouldCallAuthOnSuccess:!1}));b.current=P;return e.jsx(hc,{appName:x?.name||"privy",config:{initiatedBy:"user",onCancel:P},error:s?"An error has occurred, please try again.":void 0,buttonLoading:n,buttonHideAnimations:!1,password:d,isResettingPassword:T,onPasswordGenerate:()=>c(rc()),onPasswordChange:c,onSubmit:async()=>{$?(S(t),v({shouldCallAuthOnSuccess:!1})):(a(!0),l(null),await(async()=>{let e=await p();if(e&&j?.address&&d&&m)try{if(w({eventName:"embedded_wallet_set_recovery_started",payload:{walletAddress:j.address,existingRecoveryMethod:j.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:T}}),!(await m.setRecovery({accessToken:e,address:j.address,recoveryPassword:d,recoveryMethod:"user-passcode"})).address)return l(new o.PrivyEmbeddedWalletError("Error setting password on privy wallet")),void w({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:j.address,existingRecoveryMethod:j.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:T,reason:"error setting password"}});let t=await f(),n=u.getPrivyEthereumWallet(t);if(!n)return l(new o.PrivyEmbeddedWalletError("Error setting password on privy wallet")),void w({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:j.address,existingRecoveryMethod:j.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:T,reason:"wallet disconnected"}});r(n),w({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:j.address,existingRecoveryMethod:j.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:T}})}catch(e){console.warn(e),l(e instanceof Error?e:Error("Error setting password on privy wallet")),w({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:j.address,reason:e}})}})(),a(!1))},onClose:P})},[g.ModalScreen.EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN]:()=>{let{app:t,navigate:r,data:n,onUserCloseViaDialogOrKeybindRef:a}=g.usePrivyModal(),[s,l]=i.useState(""),[d,c]=i.useState(!1),[u,h]=i.useState(),[p,y]=i.useState(null),{authenticated:m}=o.usePrivy(),{closePrivyModal:f,isNewUserThisSession:v,initializeWalletProxy:w}=o.usePrivyInternal(),{onSuccess:x,onFailure:C,callAuthOnSuccessOnClose:E}=n.createWallet,{createWallet:b}=Cd(),[S,A]=i.useState(null),j=new Gi((async()=>{try{let e=await b(u);if(!e)return;A(e),v?r(g.ModalScreen.EMBEDDED_WALLET_CREATED_SCREEN):(x(e),f({shouldCallAuthOnSuccess:E}))}catch(e){l(e.message)}}));i.useEffect((()=>{p||w(3e4).then((e=>y(e)))}),[p]),i.useEffect((()=>{if(!m)return r(g.ModalScreen.LANDING),void C(Error("User must be authenticated before creating a Privy wallet"))}),[m]),a.current=()=>null;return e.jsx(hc,{config:{initiatedBy:"automatic"},appName:t?.name||"privy",loading:!p,buttonLoading:d,buttonHideAnimations:!S&&d,isResettingPassword:!1,error:s,password:u||"",onClose:()=>{S&&"user-passcode"!==S?.recoveryMethod?(C(new o.PrivyEmbeddedWalletError("User created a wallet but failed to set a password for it")),f({shouldCallAuthOnSuccess:!1})):S?(x(S),f({shouldCallAuthOnSuccess:E})):(C(new o.PrivyEmbeddedWalletError("User wallet creation failed")),f({shouldCallAuthOnSuccess:!1}))},onPasswordChange:h,onPasswordGenerate:()=>h(rc()),onSubmit:async()=>(c(!0),j.execute().then((()=>new Promise((e=>setTimeout(e,250))))).finally((()=>c(!1))))})},[g.ModalScreen.MFA_ENROLLMENT_FLOW_SCREEN]:()=>{let{user:t,enrollInMfa:r}=o.usePrivy(),[n,a]=i.useState(null),{unenrollWithSms:s,unenrollWithTotp:l,unenrollWithPasskey:c}=Fp(),{app:u,ready:h,data:p,onUserCloseViaDialogOrKeybindRef:y}=g.usePrivyModal(),{closePrivyModal:m}=o.usePrivyInternal(),{promptMfa:f}=Rp(),{initEnrollmentWithTotp:v}=Fp(),[w,x]=i.useState(!1),[C,E]=i.useState(null),[b,S]=i.useState(null),A=()=>{m({shouldCallAuthOnSuccess:!0}),r(!1),setTimeout((()=>{a(null),E(null)}),500)},{initEnrollmentWithPasskey:j,submitEnrollmentWithPasskey:$}=Fp(),[T,P]=i.useState(!1),[_,k]=i.useState(null);y.current=A;let N=t?.mfaMethods.includes("sms"),I=!!t?.phone,M=t?.mfaMethods.includes("totp"),O=t?.mfaMethods.includes("passkey"),R=N||M||O,F=t?.linkedAccounts.filter((e=>"passkey"===e.type)).map((e=>e.credentialId))??[];function L(){a(null),E(null)}if(i.useEffect((()=>{R&&x(!0)}),[R]),!h||!t||!u)return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{onClose:A},"header"),e.jsx(xs,{children:e.jsx(Lp,{})}),e.jsx(bs,{children:e.jsx(Co,{})}),e.jsx(d.ModalFooter,{})]});if("sms"===n)return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{backFn:L,onClose:A},"header"),e.jsx(xs,{children:e.jsx(Rs,{children:e.jsx(bt.default,{})})}),e.jsx(Cs,{children:"Remove SMS verification?"}),e.jsxs(Es,{children:["MFA adds an extra layer of security to your ",u?.name," account. Make sure you have other methods to secure your account."]}),e.jsx($s,{children:e.jsx(jo,{warn:!0,onClick:async function(){a(null);try{await s()}catch(e){a(null)}},children:"Remove SMS for MFA"})}),e.jsx(d.ModalFooter,{})]});if("totp"===n)return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{backFn:L,onClose:A},"header"),e.jsx(xs,{children:e.jsx(Rs,{children:e.jsx(Ct.default,{})})}),e.jsx(Cs,{children:"Remove Authenticator App verification?"}),e.jsxs(Es,{children:["MFA adds an extra layer of security to your ",u?.name," account. Make sure you have other methods to secure your account."]}),e.jsx($s,{children:e.jsx(jo,{warn:!0,onClick:async function(){a(null);try{await l()}catch(e){a(null)}},children:"Remove Authenticator App for MFA"})}),e.jsx(d.ModalFooter,{})]});if("passkey"===n)return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{backFn:L,onClose:A},"header"),e.jsx(xs,{children:e.jsx(Rs,{children:e.jsx(St.default,{})})}),e.jsx(Cs,{children:"Are you sure you want to remove passkey verification?"}),e.jsx(Es,{children:"This will disable any passkeys you have set up for verification. You’ll still be able to login with your passkeys if you’ve set up passkey login."}),e.jsx($s,{children:e.jsx(jo,{warn:!0,onClick:async function(){a(null);try{await f(),await c()}catch(e){a(null)}},children:"Yes, remove"})}),e.jsx(d.ModalFooter,{})]});if(0===p.mfaEnrollmentFlow.mfaMethods.length&&!R)return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{onClose:A},"header"),e.jsx(xs,{children:e.jsx(Rs,{children:e.jsx(At.default,{})})}),e.jsx(Cs,{children:"Add more security"}),e.jsxs(Es,{children:[u?.name," does not have any verification methods enabled."]}),e.jsx($s,{children:e.jsx(jo,{onClick:A,children:"Close"})}),e.jsx(d.ModalFooter,{})]});let U=!R&&!w;return U?e.jsxs(e.Fragment,{children:[e.jsx(Wo,{onClose:A},"header"),e.jsx(xs,{children:e.jsx(Rs,{children:e.jsx(At.default,{})})}),e.jsx(Cs,{children:"Transaction Protection"}),e.jsx(Es,{children:"Set up transaction protection to add an extra layer of security to your account"}),e.jsxs(Ss,{children:[e.jsxs(js,{children:[e.jsx(As,{children:e.jsx(yt.default,{})}),"Enable 2-Step verification for your ",u?.name," wallet."]}),e.jsxs(js,{children:[e.jsx(As,{children:e.jsx(Et.default,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),e.jsxs($s,{children:[e.jsx(jo,{onClick:()=>x(!0),children:"Continue"}),e.jsx(ko,{onClick:A,children:"Not now"})]}),e.jsx(d.ModalFooter,{})]}):"sms"===C?e.jsx(iy,{onComplete:A,onReset:L,onClose:A}):"totp"===C&&b?e.jsx(oy,{onComplete:A,onClose:A,onReset:L,totpInfo:b}):"passkey"===C?e.jsx(Wp,{onComplete:A,onReset:L,onClose:A}):e.jsx(Dp,{showIntro:U,userMfaMethods:t.mfaMethods,appMfaMethods:u.mfa.methods,userHasAuthSms:I,onBackToIntro:function(){x(!1)},handleSelectMethod:async function(e){return await f().catch(k),"totp"===e?(E(e),S(null),void v().then((e=>{S(e)})).catch((()=>{S(null),L()}))):"passkey"===e&&1===F.length?await async function(){P(!0);try{await j(),await $({credentialIds:F})}catch(e){k(e)}finally{P(!1)}}():void E(e)},isTotpLoading:"totp"===C&&!b,isPasskeyLoading:T,error:_,onClose:A,setRemovingMfaMethod:a})},[g.ModalScreen.CAPTCHA_SCREEN]:()=>{let{lastScreen:t,currentScreen:r,data:n,navigateBack:a,navigate:o,setModalData:s}=g.usePrivyModal(),{status:l,token:c,waitForResult:u,reset:h,execute:p}=go(),y=i.useRef([]),m=e=>{y.current=[e,...y.current]},[f,v]=i.useState(!0);i.useEffect((()=>(m(setTimeout(v,1e3,!1)),()=>{y.current.forEach((e=>clearTimeout(e))),y.current=[]})),[]);let[w,x]=i.useState(""),[C,E]=i.useState("Checking that you are a human..."),[b,S]=i.useState(e.jsx(jo,{onClick:()=>{},disabled:!0,children:"Continue"})),[A,j]=i.useState(!1),[$,T]=i.useState(3),P=n?.captchaModalData,_=async e=>{try{await(P?.callback(e)),P?.onSuccessNavigateTo&&o(P?.onSuccessNavigateTo,!1)}catch(e){if(e instanceof mo)return;s({errorModalData:{error:e,previousScreen:t||g.ModalScreen.LANDING}}),o(P?.onErrorNavigateTo||g.ModalScreen.ERROR_SCREEN,!1)}};i.useEffect((()=>{"success"===l?m(setTimeout((async()=>{let e=await u();!e||P?.userIntentRequired||_(e)}),1e3)):"ready"===l&&m(setTimeout((()=>{"ready"===l&&p()}),500))}),[l]),i.useEffect((()=>{if(!f)switch(l){case"success":x("Success!"),E("CAPTCHA passed successfully."),S(e.jsx(jo,{onClick:()=>{j(!0),_(c)},disabled:!P?.userIntentRequired,loading:A,children:P?.userIntentRequired?"Continue":"Continuing..."}));break;case"loading":x(""),E("Checking that you are a human..."),S(e.jsx(jo,{onClick:()=>{},disabled:!0,children:"Continue"}));break;case"error":x("Something went wrong"),$<=0?(E("If you use an adblocker or VPN, try disabling and re-attempting."),S(null)):(E("You did not pass CAPTCHA. Please try again."),S(e.jsx(jo,{onClick:k,children:"Retry"})))}}),[l,f,A]);let k=async()=>{if($<=0)return;T((e=>e-1)),h(),p();let e=await u();!e||P?.userIntentRequired||_(e)};return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{backFn:t&&r!==t?a:void 0}),e.jsxs(Cl,{children:["success"===l?e.jsx(Ze.default,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):"error"===l?e.jsx(Xe.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):e.jsx(wl,{}),e.jsxs(Ys,{children:[w?e.jsx("h3",{children:w}):null,e.jsx("p",{children:C})]}),b]}),e.jsx(d.ModalFooter,{})]})},[g.ModalScreen.ERROR_SCREEN]:()=>{let{navigate:t,navigateBack:r,data:n,lastScreen:i,currentScreen:a}=g.usePrivyModal(),o=n?.errorModalData?.previousScreen||(i===a?void 0:i);return e.jsx(pc,{error:n?.errorModalData?.error||Error(),backFn:()=>o?t(o,!1):r(),onClick:()=>t(o||g.ModalScreen.LANDING,!1)})},[g.ModalScreen.IN_APP_BROWSER_LOGIN_NOT_POSSIBLE]:()=>{let{closePrivyModal:t}=o.usePrivyInternal();return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{},"header"),e.jsx(Kh,{children:e.jsx(qe.default,{style:{width:32,height:32}})}),e.jsx(nl,{title:"Could not log in with provider",description:"It looks like you're using an in-app browser. To log in, please try again using an external browser.",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}}),e.jsx(Hs,{children:e.jsx(jo,{onClick:()=>t(),children:"Close"})}),e.jsx(Js,{}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.AFFIRMATIVE_CONSENT_SCREEN]:()=>{let{user:t,logout:r}=o.usePrivy(),{app:n,onUserCloseViaDialogOrKeybindRef:i,setModalData:a,navigate:s}=g.usePrivyModal(),{acceptTerms:l,closePrivyModal:d,createAnalyticsEvent:c}=o.usePrivyInternal(),h=e=>{e?.preventDefault(),d({shouldCallAuthOnSuccess:!1}),r()};i.current=h;return e.jsx(Ls,{termsAndConditionsUrl:n?.legal.termsAndConditionsUrl,privacyPolicyUrl:n?.legal.privacyPolicyUrl,onAccept:async e=>{e.preventDefault(),await l(),t&&u.shouldProceedtoEmbeddedWalletCreationFlow(t,n?.embeddedWallets?.createOnLogin)?(a({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),c({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"AffirmativeConsentScreen"}}),r()},callAuthOnSuccessOnClose:!0}}),s(g.ModalScreen.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)):d()},onDecline:h})},[g.ModalScreen.TELEGRAM_AUTH_SCREEN]:()=>{let{authenticated:t,logout:r,ready:n,user:a}=o.usePrivy(),{app:s,setModalData:c,navigate:h,resetNavigation:p,data:y}=g.usePrivyModal(),{initLoginWithTelegram:m,loginWithTelegram:f,updateWallets:v,setReadyToTrue:w,closePrivyModal:x,createAnalyticsEvent:C,getAuthMeta:E}=o.usePrivyInternal(),[b,S]=i.useState(!1),[A,j]=i.useState(void 0);async function $(){try{await f(),S(!0),w(!0)}catch(e){if(e?.privyErrorCode===o.PrivyErrorCode.ALLOWLIST_REJECTED)return j(void 0),p(),void h(g.ModalScreen.ALLOWLIST_REJECTION_SCREEN);if(e?.privyErrorCode===o.PrivyErrorCode.USER_LIMIT_REACHED)return console.error(new o.PrivyUserLimitReachedError(e).toString()),j(void 0),p(),void h(g.ModalScreen.USER_LIMIT_REACHED_SCREEN);if(e?.privyErrorCode===o.PrivyErrorCode.USER_DOES_NOT_EXIST)return j(void 0),p(),void h(g.ModalScreen.ACCOUNT_NOT_FOUND_SCREEN);if(e?.privyErrorCode===o.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return j(void 0),p(),c({accountTransfer:{nonce:e.data?.data?.nonce,account:e.data?.data?.subject,telegramAuthResult:E()?.telegramAuthResult,displayName:e.data?.data?.account?.displayName,linkMethod:"telegram",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress}}),void h(g.ModalScreen.LINK_CONFLICT_SCREEN);let{retryable:t,detail:r}=Ca(e);j({retryable:t,detail:r,message:"Authentication failed"})}}i.useEffect((()=>{$()}),[]),i.useEffect((()=>{if(!(n&&t&&b&&a))return;if(s?.legal.requireUsersAcceptTerms&&!a.hasAcceptedTerms){let e=setTimeout((()=>{h(g.ModalScreen.AFFIRMATIVE_CONSENT_SCREEN)}),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}if(u.shouldProceedtoEmbeddedWalletCreationFlow(a,s?.embeddedWallets?.createOnLogin)){let e=setTimeout((()=>{c({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),C({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,provider:"telegram",screen:"TelegramAuthScreen"}}),r()},callAuthOnSuccessOnClose:!0}}),h(g.ModalScreen.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}v();let e=setTimeout((()=>x({shouldCallAuthOnSuccess:!0,isSuccess:!0})),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}),[n,t,b,a]);let T=b?"Successfully connected with Telegram":A?A.message:"Verifying connection to Telegram",P="";return P=b?"You’re good to go!":A?A.detail:"Just a few moments more",e.jsxs(e.Fragment,{children:[e.jsx(Wo,{}),e.jsx(Xs,{}),e.jsxs(If,{children:[e.jsx(Ko,{children:e.jsxs("div",{children:[e.jsx(xo,{success:b,fail:!!A}),e.jsx(Cp,{style:{width:"38px",height:"38px"}})]})}),e.jsxs(Ys,{children:[e.jsx("h3",{children:T}),e.jsx("p",{children:P})]}),A&&A?.retryable?e.jsx(Io,{onClick:()=>{m(void 0,y?.login?.disableSignup).then((async()=>$())).catch((e=>{let{retryable:t,detail:r}=Ca(e);j({retryable:t,detail:r,message:"Authentication failed"})})),j(void 0)},disabled:!b&&!A?.retryable,children:"Retry"}):null]}),e.jsx(Js,{}),e.jsx(d.ModalFooter,{})]})},[g.ModalScreen.LINK_CONFLICT_SCREEN]:()=>{let{initiateAccountTransfer:t,closePrivyModal:r}=o.usePrivyInternal(),{data:n,navigate:a,lastScreen:s,setModalData:l}=g.usePrivyModal(),[d,c]=i.useState(void 0),[u,h]=i.useState(!1),[p,y]=i.useState(!1),m=async()=>{try{if(!n?.accountTransfer?.nonce||!n?.accountTransfer?.account)throw Error("missing account transfer inputs");y(!0),await t({nonce:n?.accountTransfer?.nonce,account:n?.accountTransfer?.account,accountType:n?.accountTransfer?.linkMethod,externalWalletMetadata:n?.accountTransfer?.externalWalletMetadata,telegramAuthResult:n?.accountTransfer?.telegramAuthResult,farcasterEmbeddedAddress:n?.accountTransfer?.farcasterEmbeddedAddress,oAuthUserInfo:n?.accountTransfer?.oAuthUserInfo}),h(!0),y(!1),setTimeout(r,1e3)}catch(e){l({errorModalData:{error:e,previousScreen:s||g.ModalScreen.LINK_CONFLICT_SCREEN}}),a(g.ModalScreen.ERROR_SCREEN,!0)}};return d?e.jsx(gs,{address:d,onClose:r,onRetry:()=>c(void 0),onTransfer:m,isTransferring:p,transferSuccess:u}):e.jsx(vs,{onClose:r,onInfo:()=>c(n?.accountTransfer?.embeddedWalletAddress),onContinue:()=>c(n?.accountTransfer?.embeddedWalletAddress),onTransfer:m,isTransferring:p,transferSuccess:u,data:n})}},Zf=[g.ModalScreen.LANDING,g.ModalScreen.AWAITING_CONNECTION],Xf=({isMfaVerifying:t,onMfaVerificationComplete:r})=>{let{ready:n,isModalOpen:a}=o.usePrivy(),{headless:s}=l.useAppConfig(),{ready:c,currentScreen:u}=g.usePrivyModal(),{status:h,execute:p,reset:y,enabled:m}=go(),f=a&&u&&Zf.includes(u)&&!s&&"ready"===h;return i.useEffect((()=>{f&&p()}),[f]),i.useEffect((()=>{!a&&m&&y()}),[a,m]),n&&c||u===g.ModalScreen.AWAITING_OAUTH_SCREEN||u===g.ModalScreen.CROSS_APP_AUTH_SCREEN||u===g.ModalScreen.TELEGRAM_AUTH_SCREEN?!u&&t?e.jsx(rm,{open:t,onClose:r}):u?e.jsxs(e.Fragment,{children:[e.jsx(ns,{$if:!!t,children:e.jsx(Yf[u],{})}),e.jsx(ns,{$if:!t,children:e.jsx(rm,{open:t,onClose:r})})]}):null:e.jsxs(e.Fragment,{children:[e.jsx(Wo,{}),e.jsx(Xs,{}),e.jsx(Kf,{children:e.jsx(Co,{})}),e.jsx(Js,{}),e.jsx(d.ModalFooter,{})]})},Jf=({isMfaVerifying:t,onMfaVerificationComplete:r})=>{let n=i.useRef(null);return e.jsx(tg,{style:{height:d.useElementHeight(n)},id:"privy-modal-content",children:e.jsx("div",{ref:n,children:e.jsx(Xf,{isMfaVerifying:t,onMfaVerificationComplete:r})})})};const Qf=({open:t})=>{let{app:r}=g.usePrivyModal(),{gracefulClosePrivyModal:n}=(()=>{let{closePrivyModal:e}=o.usePrivyInternal(),{onUserCloseViaDialogOrKeybindRef:t}=g.usePrivyModal();return{gracefulClosePrivyModal:i.useCallback((()=>{if(!t?.current)return e({shouldCallAuthOnSuccess:!1});t.current()}),[e])}})(),[a,s]=i.useState(!1);wo({onMfaRequired:()=>{r?.mfa.noPromptOnMfaRequired||s(!0)}});let l=t||a;return r.render.standalone?e.jsx(Bf,{children:e.jsx(eg,{id:"privy-modal-content",children:e.jsx(Xf,{isMfaVerifying:a,onMfaVerificationComplete:()=>s(!1)})})}):e.jsx(Hf,{open:l,id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>n(),children:e.jsx(Bf,{children:e.jsx(Jf,{isMfaVerifying:a,onMfaVerificationComplete:()=>s(!1)})})})};let eg=C.styled.div`
|
|
3095
|
+
`;let Yf={[g.ModalScreen.LANDING]:()=>{let{app:t}=g.usePrivyModal();return t.loginMethodsAndOrder&&t.loginMethodsAndOrder.primary.length>0?e.jsx(Ap,{connectOnly:!1}):e.jsx(Pp,{connectOnly:!1})},[g.ModalScreen.CONNECT_OR_CREATE]:()=>{let{app:t}=g.usePrivyModal();return t.loginMethodsAndOrder&&t.loginMethodsAndOrder.primary.length>0?e.jsx(Ap,{connectOnly:!0}):e.jsx(Pp,{connectOnly:!0})},[g.ModalScreen.AWAITING_PASSWORDLESS_CODE]:()=>{let{app:t,navigate:r,lastScreen:n,navigateBack:s,setModalData:c,onUserCloseViaDialogOrKeybindRef:h}=g.usePrivyModal(),{closePrivyModal:p,resendEmailCode:y,resendSmsCode:m,getAuthMeta:f,loginWithCode:v,updateWallets:w,createAnalyticsEvent:x}=o.usePrivyInternal(),{authenticated:C,logout:E,user:b}=o.usePrivy(),[S,A]=i.useState(ul),[j,$]=i.useState(!1),[T,P]=i.useState(null),[_,k]=i.useState(null),[N,I]=i.useState(0);h.current=()=>null;let M=f()?.email?0:1,O=l.DEFAULT_SUCCESS_SCREEN_DURATION_MS-500;i.useEffect((()=>{if(N){let e=setTimeout((()=>{I(N-1)}),1e3);return()=>clearTimeout(e)}}),[N]),i.useEffect((()=>{if(C&&j&&b){if(t?.legal.requireUsersAcceptTerms&&!b.hasAcceptedTerms){let e=setTimeout((()=>{r(g.ModalScreen.AFFIRMATIVE_CONSENT_SCREEN)}),O);return()=>clearTimeout(e)}if(u.shouldProceedtoEmbeddedWalletCreationFlow(b,t?.embeddedWallets?.createOnLogin)){let e=setTimeout((()=>{c({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),x({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"AwaitingPasswordlessCodeScreen"}}),E()},callAuthOnSuccessOnClose:!0}}),r(g.ModalScreen.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}),O);return()=>clearTimeout(e)}{w();let e=setTimeout((()=>p({shouldCallAuthOnSuccess:!0,isSuccess:!0})),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}}}),[C,j,b]),i.useEffect((()=>{if(T&&0===_){let e=setTimeout((()=>{A(ul),P(null);let e=document.querySelector("input[name=code-0]");e?.focus()}),1400);return()=>clearTimeout(e)}}),[T]);let R=e=>{e.preventDefault();let t=e.currentTarget.value.replace(" ","");if(""===t)return;if(isNaN(Number(t)))return P("Code should be numeric"),void k(1);P(null),k(null);let i=Number(e.currentTarget.name?.charAt(5)),a=[...t||[""]].slice(0,6-i),s=[...S.slice(0,i),...a,...S.slice(i+a.length)];A(s);let l=Math.min(Math.max(i+a.length,0),5);if(!isNaN(Number(e.currentTarget.value))){let e=document.querySelector(`input[name=code-${l}]`);e?.focus()}if(s.every((e=>e&&!isNaN(+e)))){let e=document.querySelector(`input[name=code-${l}]`);e?.blur(),v(s.join("")).then((()=>$(!0))).catch((e=>{if(e instanceof o.PrivyApiError&&e.privyErrorCode===o.PrivyErrorCode.INVALID_CREDENTIALS)P("Invalid or expired verification code");else if(e instanceof o.PrivyApiError&&e.privyErrorCode===o.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE)P(e.message);else{if(e instanceof o.PrivyApiError&&e.privyErrorCode===o.PrivyErrorCode.USER_LIMIT_REACHED)return console.error(new o.PrivyUserLimitReachedError(e).toString()),void r(g.ModalScreen.USER_LIMIT_REACHED_SCREEN);if(e instanceof o.PrivyApiError&&e.privyErrorCode===o.PrivyErrorCode.USER_DOES_NOT_EXIST)return void r(g.ModalScreen.ACCOUNT_NOT_FOUND_SCREEN);if(e instanceof o.PrivyApiError&&e.privyErrorCode===o.PrivyErrorCode.LINKED_TO_ANOTHER_USER)return c({errorModalData:{error:e,previousScreen:n??g.ModalScreen.AWAITING_PASSWORDLESS_CODE}}),void r(g.ModalScreen.ERROR_SCREEN,!1);if(e instanceof o.PrivyApiError&&e.privyErrorCode===o.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return c({accountTransfer:{nonce:e.data?.data?.nonce,account:0===M?f()?.email:f()?.phoneNumber,displayName:e.data?.data?.account?.displayName,linkMethod:0===M?"email":"sms",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress}}),void r(g.ModalScreen.LINK_CONFLICT_SCREEN);P("Issue verifying code")}k(0)}))}},F=0==M?e.jsx(Ke.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):e.jsx(Ye.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),L=0==M?e.jsxs("p",{children:["Please check ",e.jsx(vl,{children:f()?.email})," for an email from privy.io and enter your code below."]}):e.jsxs("p",{children:["Please check ",e.jsx(vl,{children:f()?.phoneNumber})," for a message from ",t?.name||"Privy"," and enter your code below."]});return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{backFn:()=>s()},"header"),e.jsxs(hl,{children:[e.jsx(il,{title:"Enter confirmation code",description:L,icon:F}),e.jsxs(qs,{children:[e.jsxs(pl,{children:[e.jsx(yl,{$fail:!!T,$success:j,children:e.jsx("span",{children:T||(j?"Success!":"")})}),e.jsx("div",{children:S.map(((t,r)=>e.jsx("input",{name:`code-${r}`,type:"text",value:S[r],onChange:R,onKeyUp:e=>{"Backspace"===e.key&&(e=>{if(1===_&&(P(null),k(null)),A([...S.slice(0,e),"",...S.slice(e+1)]),e>0){let t=document.querySelector(`input[name=code-${e-1}]`);t?.focus()}})(r)},inputMode:"numeric",autoFocus:0===r,pattern:"[0-9]",className:`${j?"success":""} ${T?"fail":""}`,autoComplete:a.isMobile?"one-time-code":"off"},r)))})]}),e.jsxs(ml,{children:[e.jsxs("span",{children:["Didn't get ",0==M?"an email":"a message","?"]}),N?e.jsxs(gl,{children:[e.jsx(Ve.default,{color:"var(--privy-color-foreground)",strokeWidth:1.33,height:"12px",width:"12px"}),e.jsx("span",{children:"Code sent"})]}):e.jsx(fl,{children:e.jsx("button",{onClick:async()=>{I(30),0==M?await y():await m()},children:"Resend code"})})]})]})]}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.AWAITING_CONNECTION]:()=>{let t,[r,n]=i.useState(!1),[s,c]=i.useState(!1),[h,p]=i.useState(void 0),{authenticated:y,logout:f}=o.usePrivy(),{app:v,navigate:w,navigateBack:x,lastScreen:C,currentScreen:E,setModalData:b,data:S}=g.usePrivyModal(),{getAuthFlow:A,walletConnectionStatus:j,closePrivyModal:$,initLoginWithWallet:T,loginWithWallet:P,updateWallets:_,createAnalyticsEvent:k}=o.usePrivyInternal(),{walletConnectors:N}=o.usePrivy(),[I,M]=i.useState(0),{user:O}=o.usePrivy(),[R]=i.useState(O?.linkedAccounts.length||0),[F,L]=i.useState(""),[U,D]=i.useState(""),[W,B]=i.useState(!1),{hasTabbedAway:H}=function(){let[e,t]=i.useState(!1),r=i.useCallback((()=>{document.hidden&&t(!0)}),[]);return i.useEffect((()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r))),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}(),{enabled:G,token:q}=ba(),z=a.isMobile&&"wallet_connect_v2"===j?.connector?.connectorType||a.isMobile&&"coinbase_wallet"===j?.connector?.connectorType||a.isMobile&&"injected"===j?.connector?.connectorType&&"phantom"===j?.connector?.walletClientType,V="connected"===j?.status,K="switching_to_supported_chain"===j?.status;i.useEffect((()=>{let e=A(),t=e instanceof fa||e instanceof ga?e:void 0;V&&!t&&(!G||q||y?T(j.connectedWallet,q,S?.login?.disableSignup).then((()=>{B(!0)})):(b({captchaModalData:{callback:e=>T(j.connectedWallet,e,S?.login?.disableSignup).then((()=>{B(!0)})),userIntentRequired:!1,onSuccessNavigateTo:g.ModalScreen.AWAITING_CONNECTION,onErrorNavigateTo:g.ModalScreen.ERROR_SCREEN}}),w(g.ModalScreen.CAPTCHA_SCREEN,!1))),t&&z&&V&&!t.preparedMessage?t.buildMessage():t&&!z&&V&&(s||(async()=>{c(!0),p(void 0);try{"wallet_connect_v2"===j?.connector?.connectorType&&"metamask"===j?.connector?.walletClientType&&await d.sleep(2500),await Z()}catch(e){console.warn("Auto-prompted signature failed",e)}finally{c(!1)}})())}),[I,V,W]),i.useEffect((()=>{if(O&&r){let e=l.DEFAULT_SUCCESS_SCREEN_DURATION_MS-500;if(v?.legal.requireUsersAcceptTerms&&!O.hasAcceptedTerms){let t=setTimeout((()=>{w(g.ModalScreen.AFFIRMATIVE_CONSENT_SCREEN)}),e);return()=>clearTimeout(t)}if(u.shouldProceedtoEmbeddedWalletCreationFlow(O,v?.embeddedWallets?.createOnLogin)){let t=setTimeout((()=>{b({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),k({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"ConnectionStatusScreen"}}),f()},callAuthOnSuccessOnClose:!0}}),w(g.ModalScreen.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}),e);return()=>clearTimeout(t)}_();let t=setTimeout((()=>$({shouldCallAuthOnSuccess:!0,isSuccess:!0})),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(t)}}),[O,r]);let Y=e=>{if(e?.privyErrorCode!==o.PrivyErrorCode.ALLOWLIST_REJECTED){if(e?.privyErrorCode===o.PrivyErrorCode.USER_LIMIT_REACHED)return console.error(new o.PrivyUserLimitReachedError(e).toString()),void w(g.ModalScreen.USER_LIMIT_REACHED_SCREEN);if(e?.privyErrorCode!==o.PrivyErrorCode.USER_DOES_NOT_EXIST)return e?.privyErrorCode===o.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce?(b({accountTransfer:{nonce:e.data?.data?.nonce,account:A()?.meta.address,displayName:e.data?.data?.account?.displayName,externalWalletMetadata:{walletClientType:A()?.meta.walletClientType,chainId:A()?.meta.chainId,connectorType:A()?.meta.connectorType},linkMethod:"siwe",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress}}),void w(g.ModalScreen.LINK_CONFLICT_SCREEN)):void p(Fl(e));w(g.ModalScreen.ACCOUNT_NOT_FOUND_SCREEN)}else w(g.ModalScreen.ALLOWLIST_REJECTION_SCREEN)};async function Z(){try{await P(),n(!0)}catch(e){Y(e)}finally{c(!1)}}i.useEffect((()=>{j?.connectError&&Y(j?.connectError)}),[j]),((e,t)=>{let r=i.useRef((()=>{}));i.useEffect((()=>{r.current=e})),i.useEffect((()=>{if(null!==t){let e=setInterval((()=>r.current()),t||0);return()=>clearInterval(e)}}),[t])})((()=>{let e="wallet_connect_v2"===X&&j?.connector instanceof to?j.connector.redirectUri:void 0;e&&L(e);let t="wallet_connect_v2"===X&&j?.connector instanceof to?j.connector.fallbackUniversalRedirectUri:void 0;t&&D(t)}),j?.connector instanceof to&&!F?500:null);let X=j?.connector?.connectorType||"injected",J=j?.connector?.walletClientType||"unknown",Q=bl[J]?.displayName||j?.connector?.walletBranding.name||"Browser Extension",ee=bl[J]?.logo||j?.connector?.walletBranding.icon||(t=>e.jsx(Ha,{...t})),te="Browser Extension"===Q?Q.toLowerCase():Q;t=r?`Successfully connected with ${te}`:h?h.message:K?"Switching networks":V?s&&z?"Signing":"Sign to verify":`Waiting for ${te}`;let re="Don’t see your wallet? Check your other browser windows.";r?re=R===(O?.linkedAccounts.length||0)?"Wallet was already linked.":"You’re good to go!":I>=2&&h?re="Unable to connect wallet":h?re=h.detail:K?re="Switch your wallet to the requested network.":V&&z?re="Sign the message in your wallet to verify it belongs to you.":"metamask"===J&&a.isMobile?re="Click continue to open and connect MetaMask.":"metamask"===J?re="For the best experience, connect only one wallet at a time.":"wallet_connect"===X?re="Open your mobile wallet app to continue":"coinbase_wallet"!==X||d.isCoinbaseWalletInstalled()||(re=ro(O)?"Continue with the Coinbase app. Not the right wallet? Reset your connection below.":"Open the Coinbase app on your phone to continue.");let ne=N?.walletConnectors?.find((e=>"coinbase_wallet"===e.walletClientType)),ie="coinbase_wallet"===J&&(ro(O)||h===m.ConnectorErrors.ERROR_USER_EXISTS);return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{backFn:C&&E!==C?x:void 0}),e.jsxs(Ll,{children:[e.jsx(Dl,{walletLogo:ee,success:r,fail:!!h}),e.jsxs(Ys,{children:[e.jsx("h3",{children:t}),e.jsx("p",{children:re}),V||!F||H?null:e.jsxs("p",{children:["Still here?"," ",e.jsx("a",{href:F,target:"_blank",style:{textDecoration:"underline"},children:"Try connecting again"}),U&&e.jsxs(e.Fragment,{children:[" ","or"," ",e.jsx("a",{href:U,target:"_blank",style:{textDecoration:"underline"},children:"use this different link"})]})]})]}),ie?e.jsx(jo,{onClick:()=>ne&&ne?.disconnect(),disabled:r,children:"Use a different wallet"}):h==m.ConnectorErrors.ERROR_USER_EXISTS&&E!==C?e.jsx(jo,{onClick:x,children:"Use a different wallet"}):V&&!r&&z?e.jsx(jo,{onClick:()=>{c(!0),Z()},disabled:s,children:s?"Signing":"Sign with your wallet"}):!r&&h?.retryable&&I<2?e.jsx(jo,{onClick:()=>{M(I+1),p(void 0),V?(c(!0),Z()):j?.connectRetry()},disabled:!r&&(!h?.retryable||I>=2),children:"Retry"}):r||h?null:e.jsx(jo,{onClick:()=>{},disabled:!0,children:"Connecting"})]}),e.jsx(d.ModalFooter,{})]})},[g.ModalScreen.AWAITING_CONNECT_ONLY_CONNECTION]:()=>{let t,{navigateBack:r,navigate:n,lastScreen:s,currentScreen:c,data:u}=g.usePrivyModal(),{walletConnectionStatus:h,closePrivyModal:p}=o.usePrivyInternal(),[y,f]=i.useState(void 0),[v,w]=i.useState(0),x="connected"===h?.status,C="switching_to_supported_chain"===h?.status;i.useEffect((()=>{if(x){let e;if(u?.externalConnectWallet?.onCompleteNavigateTo){let t=u.externalConnectWallet.onCompleteNavigateTo;e=setTimeout((()=>{n(t)}),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS)}else e=setTimeout(p,l.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}}),[x]);i.useEffect((()=>{h?.connectError&&(e=>{f(Fl(e))})(h?.connectError)}),[h]);let E=h?.connector?.connectorType||"injected",b=h?.connector?.walletClientType||"unknown",S=bl[b]?.displayName||h?.connector?.walletBranding.name||"Browser Extension",A=bl[b]?.logo||h?.connector?.walletBranding.icon||(t=>e.jsx(Ha,{...t})),j="Browser Extension"===S?S.toLowerCase():S;t=x?`Successfully connected with ${j}`:y?y.message:C?"Switching networks":`Waiting for ${j}`;let $="Don’t see your wallet? Check your other browser windows.";return x?$="You’re good to go!":v>=2&&y?$="Unable to connect wallet":y?$=y.detail:C?$="Switch your wallet to the requested network.":"metamask"===b&&a.isMobile?$="Click to continue to open and connect MetaMask.":"metamask"===b?$="For the best experience, connect only one wallet at a time.":"wallet_connect_v2"===E?$="Open your mobile wallet app to continue":"coinbase_wallet"===E&&($="Open the Coinbase app on your phone to continue."),e.jsxs(e.Fragment,{children:[e.jsx(Wo,{backFn:c===s?void 0:r}),e.jsxs(Wl,{children:[e.jsx(Dl,{walletLogo:A,success:x,fail:!!y}),e.jsxs(Ys,{children:[e.jsx("h3",{children:t}),e.jsx("p",{children:$})]}),y==m.ConnectorErrors.ERROR_USER_EXISTS?e.jsx(jo,{onClick:r,children:"Use a different wallet"}):!x&&y?.retryable&&v<2?e.jsx(jo,{onClick:()=>{w(v+1),f(void 0),h?.connectRetry()},disabled:!x&&(!y?.retryable||v>=2),children:"Retry"}):!x&&y&&v>=2?e.jsx(jo,{onClick:r,children:"Use a different wallet"}):null]}),e.jsx(d.ModalFooter,{})]})},[g.ModalScreen.AWAITING_FARCASTER_CONNECTION]:()=>{let{authenticated:t,logout:r,ready:n,user:s}=o.usePrivy(),{lastScreen:c,navigate:h,navigateBack:p,setModalData:y,app:m}=g.usePrivyModal(),{getAuthFlow:f,loginWithFarcaster:v,closePrivyModal:w,createAnalyticsEvent:x}=o.usePrivyInternal(),[C,E]=i.useState(void 0),[b,S]=i.useState(!1),[A,j]=i.useState(!1),$=i.useRef([]),T=f(),P=T?.meta.connectUri;return i.useEffect((()=>{let e=Date.now(),t=setInterval((async()=>{let r=await T.pollForReady.execute(),n=Date.now()-e;if(r){clearInterval(t),S(!0);try{await v(),j(!0)}catch(e){let t={retryable:!1,message:"Authentication failed"};if(e?.privyErrorCode===o.PrivyErrorCode.ALLOWLIST_REJECTED)return void h(g.ModalScreen.ALLOWLIST_REJECTION_SCREEN);if(e?.privyErrorCode===o.PrivyErrorCode.USER_LIMIT_REACHED)return console.error(new o.PrivyUserLimitReachedError(e).toString()),void h(g.ModalScreen.USER_LIMIT_REACHED_SCREEN);if(e?.privyErrorCode===o.PrivyErrorCode.USER_DOES_NOT_EXIST)return void h(g.ModalScreen.ACCOUNT_NOT_FOUND_SCREEN);if(e?.privyErrorCode===o.PrivyErrorCode.LINKED_TO_ANOTHER_USER)t.detail="This account has already been linked to another user.";else{if(e?.privyErrorCode===o.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return y({accountTransfer:{nonce:e.data?.data?.nonce,account:e.data?.data?.subject,displayName:e.data?.data?.account?.displayName,linkMethod:"farcaster",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress,farcasterEmbeddedAddress:e.data?.data?.otherUser?.farcasterEmbeddedAddress}}),void h(g.ModalScreen.LINK_CONFLICT_SCREEN);e?.privyErrorCode===o.PrivyErrorCode.INVALID_CREDENTIALS?(t.retryable=!0,t.detail="Something went wrong. Try again."):e?.privyErrorCode===o.PrivyErrorCode.TOO_MANY_REQUESTS&&(t.detail="Too many requests. Please wait before trying again.")}E(t)}}else n>12e4&&(clearInterval(t),E({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))}),2e3);return()=>{clearInterval(t),$.current.forEach((e=>clearTimeout(e)))}}),[]),i.useEffect((()=>{if(n&&t&&A&&s){if(m?.legal.requireUsersAcceptTerms&&!s.hasAcceptedTerms){let e=setTimeout((()=>{h(g.ModalScreen.AFFIRMATIVE_CONSENT_SCREEN)}),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}A&&(u.shouldProceedtoEmbeddedWalletCreationFlow(s,m?.embeddedWallets.createOnLogin)?$.current.push(setTimeout((()=>{y({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),x({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"FarcasterConnectStatusScreen"}}),r()},callAuthOnSuccessOnClose:!0}}),h(g.ModalScreen.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS)):$.current.push(setTimeout((()=>w({shouldCallAuthOnSuccess:!0,isSuccess:!0})),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS)))}}),[A,n,t,s]),a.isMobile||b?e.jsxs(e.Fragment,{children:[e.jsx(Wo,{backFn:c?p:void 0,onClose:w},"header"),e.jsx(Xs,{}),a.isIOS?e.jsx(e.Fragment,{children:e.jsxs(Ic,{children:[e.jsx(Ko,{children:e.jsxs("div",{children:[e.jsx(xo,{success:A,fail:!!C}),e.jsx(_c,{style:{width:"38px",height:"38px"}})]})}),e.jsxs(Ys,{children:[e.jsx(Cs,{children:C?C.message:"Sign in with Farcaster"}),e.jsx(Es,{children:C?C.detail:"To sign in with Farcaster, please open the Warpcast app."})]}),P&&e.jsx(jo,{onClick:e=>{e.preventDefault(),window.location.href=P},children:"Open Warpcast app"})]})}):e.jsx(e.Fragment,{children:e.jsxs(Nc,{children:[e.jsx(Ko,{children:e.jsxs("div",{children:[e.jsx(xo,{success:A,fail:!!C}),e.jsx(_c,{style:{width:"38px",height:"38px"}})]})}),e.jsxs(Ys,{children:[e.jsx(Cs,{children:C?C.message:"Signing in with Farcaster"}),e.jsx(Es,{children:C?C.detail:"This should only take a moment"}),e.jsx(Gs,{children:P&&a.isMobile&&e.jsx(wc,{text:"Take me to Warpcast",url:P,color:kc})})]})]})}),e.jsx(d.ModalFooter,{})]}):e.jsxs(e.Fragment,{children:[e.jsx(Wo,{backFn:c?p:void 0,onClose:w},"header"),e.jsx(Xs,{}),e.jsx(Nc,{children:e.jsxs("div",{children:[e.jsx(Cs,{children:"Sign in with Farcaster"}),e.jsx(Es,{children:"Scan with your phone's camera to continue."}),e.jsx(zs,{children:P?e.jsx(Pc,{url:P,size:275,squareLogoElement:_c}):e.jsx(Co,{})}),e.jsxs(Gs,{children:[e.jsx(Es,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),P&&e.jsx(gc,{text:P,itemName:"link",color:kc})]})]})}),e.jsx(d.ModalFooter,{})]})},[g.ModalScreen.AWAITING_FARCASTER_SIGNER]:()=>{let{lastScreen:t,navigateBack:r,data:n,app:s}=g.usePrivyModal(),{requestFarcasterSignerStatus:c,closePrivyModal:u}=o.usePrivyInternal(),[h,p]=i.useState(void 0),[y,m]=i.useState(!1),[f,v]=i.useState(!1),w=i.useRef([]),x=n?.farcasterSigner;i.useEffect((()=>{let e=Date.now(),t=setInterval((async()=>{if(!x?.public_key)return clearInterval(t),void p({retryable:!0,message:"Connect failed",detail:"Something went wrong. Please try again."});"approved"===x.status&&(clearInterval(t),m(!1),v(!0),w.current.push(setTimeout((()=>u({shouldCallAuthOnSuccess:!1,isSuccess:!0})),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS)));let r=await c(x?.public_key),n=Date.now()-e;"approved"===r.status?(clearInterval(t),m(!1),v(!0),w.current.push(setTimeout((()=>u({shouldCallAuthOnSuccess:!1,isSuccess:!0})),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS))):n>3e5?(clearInterval(t),p({retryable:!0,message:"Connect failed",detail:"The request timed out. Try again."})):"revoked"===r.status&&(clearInterval(t),p({retryable:!0,message:"Request rejected",detail:"The request was rejected. Please try again."}))}),2e3);return()=>{clearInterval(t),w.current.forEach((e=>clearTimeout(e)))}}),[]);let C="pending_approval"===x?.status?x.signer_approval_url:void 0;return a.isMobile||y?e.jsxs(e.Fragment,{children:[e.jsx(Wo,{backFn:t?r:void 0,onClose:u},"header"),e.jsx(Xs,{}),a.isIOS?e.jsx(e.Fragment,{children:e.jsxs(Rc,{children:[e.jsx(Ko,{children:e.jsxs("div",{children:[e.jsx(xo,{success:f,fail:!!h}),e.jsx(_c,{style:{width:"38px",height:"38px"}})]})}),e.jsxs(Ys,{children:[e.jsx(Cs,{children:h?h.message:"Add a signer to Farcaster"}),e.jsx(Es,{children:h?h.detail:"This will allow "+s.name+" to add casts, likes, follows, and more on your behalf."})]}),C&&e.jsx(jo,{onClick:e=>{e.preventDefault(),window.location.href=C},children:"Open Warpcast app"})]})}):e.jsx(e.Fragment,{children:e.jsxs(Oc,{children:[e.jsx(Ko,{children:e.jsxs("div",{children:[e.jsx(xo,{success:f,fail:!!h}),e.jsx(_c,{style:{width:"38px",height:"38px"}})]})}),e.jsxs(Ys,{children:[e.jsx(Cs,{children:h?h.message:"Requesting signer from Farcaster"}),e.jsx(Es,{children:h?h.detail:"This should only take a moment"}),e.jsx(Gs,{children:C&&a.isMobile&&e.jsx(wc,{text:"Take me to Warpcast",url:C,color:Mc})})]})]})}),e.jsx(d.ModalFooter,{})]}):e.jsxs(e.Fragment,{children:[e.jsx(Wo,{backFn:t?r:void 0,onClose:u},"header"),e.jsx(Xs,{}),e.jsx(Oc,{children:e.jsxs("div",{children:[e.jsx(Cs,{children:"Add a signer to Farcaster"}),e.jsxs(Es,{children:["This will allow ",s.name," to add casts, likes, follows, and more on your behalf."]}),e.jsx(zs,{children:"pending_approval"===x?.status?e.jsx(Pc,{url:x.signer_approval_url,size:275,squareLogoElement:_c}):e.jsx(Co,{})}),e.jsxs(Gs,{children:[e.jsx(Es,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),"pending_approval"===x?.status&&e.jsx(gc,{text:x.signer_approval_url,itemName:"link",color:Mc})]})]})}),e.jsx(d.ModalFooter,{})]})},[g.ModalScreen.AWAITING_PASSKEY_SYSTEM_DIALOGUE]:()=>{let{lastScreen:t,currentScreen:r,navigateBack:n}=g.usePrivyModal(),{loginWithPasskey:a,closePrivyModal:s}=o.usePrivyInternal(),[c,u]=i.useState("loading"),[h,p]=i.useState(null),y=i.useRef([]);i.useEffect((()=>()=>{y.current.forEach((e=>clearTimeout(e))),y.current=[]}),[]);let m=async()=>{u("loading");try{await a(),u("success")}catch(e){p(e),u("error")}};return i.useEffect((()=>{"success"===c&&(e=>{y.current=[e,...y.current]})(setTimeout((()=>{s({shouldCallAuthOnSuccess:!0,isSuccess:!0})}),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS))}),[c]),i.useEffect((()=>{m()}),[]),e.jsxs(e.Fragment,{children:[e.jsx(Wo,{backFn:t&&r!==t?n:void 0}),e.jsxs(am,{children:[e.jsx(Ko,{children:e.jsxs("div",{children:[e.jsx(xo,{success:"success"===c,fail:"error"===c}),e.jsx(mu,{style:{width:"38px",height:"38px"}})]})}),e.jsxs(Ys,{children:[e.jsx("h3",{children:(()=>{switch(c){case"loading":return"Waiting for passkey";case"success":return"Success";case"error":return"Something went wrong"}})()}),e.jsx("p",{style:{whiteSpace:"pre-wrap"},children:(()=>{switch(c){case"loading":return"Please follow prompts to verify your passkey.\nYou will have to sign up with another method first to register a passkey for your account.";case"success":return"You've successfully logged in with your passkey.";case"error":if(h instanceof o.PrivyError){if(h.privyErrorCode===o.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE)return"Cannot link more passkeys to account.";if(h.privyErrorCode===o.PrivyErrorCode.PASSKEY_NOT_ALLOWED)return"Passkey request timed out or rejected by user.\nYou will have to sign up with another method first to register a passkey for your account."}return"An unknown error occurred.\nYou will have to sign up with another method first to register a passkey for your account."}})()})]}),(()=>{switch(c){case"loading":case"success":return e.jsx(jo,{onClick:()=>{},disabled:!0,children:"Continue"});case"error":return e.jsx(jo,{onClick:m,disabled:!1,children:"Retry"})}})()]}),e.jsx(d.ModalFooter,{})]})},[g.ModalScreen.PHANTOM_INTERSTITIAL_SCREEN]:()=>{let{forkSession:t,ready:r,authenticated:n}=o.usePrivy(),{walletConnectionStatus:s}=o.usePrivyInternal(),[l,c]=i.useState(""),[u,h]=i.useState(!1);i.useEffect((()=>{r&&n&&t().then(c)}),[r,n]);let p=((e,t,r)=>{let n=encodeURIComponent(new URL(window.location.href).href.replace(/\/$/g,"")+`?privy_token=${e}&privy_connector=${r?"solana_adapter":"injected"}&privy_wallet_client=${r?"phantom_solana":"phantom"}`);if(!d.isPhantomInstalled()&&a.isMobile)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${n}?ref=${n}`})(l,!u,"solana"===s?.connector?.chainType),y={title:"Redirecting to Phantom Mobile Wallet",description:"We'll take you to the Phantom Mobile Wallet app to continue your login experience.",footnote:""};return r&&(y.description="For the best experience, we'll automatically log you into the Phantom Mobile Wallet in-app browser.",y.footnote="Once you're done, you can always return here and refresh to view your updated account."),u&&(y.title="Still here?",y.description="You may need to install the Phantom mobile app.",y.footnote="Once you're done, you can return here or connect via Phantom's in-app browser."),e.jsxs(e.Fragment,{children:[e.jsx(Wo,{},"header"),e.jsx(Xs,{}),e.jsx(nl,{title:y.title,description:y.description}),e.jsxs(Hs,{children:[e.jsx(om,{children:e.jsx(qa,{style:{width:"72px",height:"72px"}})}),e.jsx(Po,{href:p,onClick:()=>{setTimeout((()=>h(!0)),1e3)},loading:r&&!p,children:u?"Go to App Store":"Continue"}),y.footnote?e.jsx("p",{children:y.footnote}):null]}),e.jsx(Js,{}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.LOGIN_FAILED_SCREEN]:()=>{let{closePrivyModal:t}=o.usePrivyInternal(),{navigate:r}=g.usePrivyModal();return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{},"header"),e.jsx(Xs,{}),e.jsx(Op,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),e.jsx(nl,{title:"Could not connect with wallet",description:"Please check that Phantom multichain is enabled and try again.",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}}),e.jsxs(Hs,{children:[e.jsx(jo,{onClick:()=>r(g.ModalScreen.LANDING),children:"Try again"}),e.jsx(ko,{onClick:()=>t(),children:"Cancel"})]}),e.jsx(Js,{}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.AWAITING_OAUTH_SCREEN]:()=>{let{authenticated:t,logout:r,ready:n,user:a}=o.usePrivy(),{app:s,setModalData:c,navigate:h,resetNavigation:p}=g.usePrivyModal(),{getAuthMeta:y,initLoginWithOAuth:m,loginWithOAuth:f,updateWallets:v,setReadyToTrue:w,closePrivyModal:x,createAnalyticsEvent:C}=o.usePrivyInternal(),[E,b]=i.useState(!1),[S,A]=i.useState(void 0),j=y()?.provider||"google",{name:$,component:T}=ua(j),P=d.useEmitPrivyEvent();i.useEffect((()=>{f(j).then((e=>{b(!0),w(!0),e&&P("login","onOAuthLoginComplete",e)})).catch((e=>{if(w(!1),e?.privyErrorCode===o.PrivyErrorCode.ALLOWLIST_REJECTED)return A(void 0),p(),void h(g.ModalScreen.ALLOWLIST_REJECTION_SCREEN);if(e?.privyErrorCode===o.PrivyErrorCode.USER_LIMIT_REACHED)return console.error(new o.PrivyUserLimitReachedError(e).toString()),A(void 0),p(),void h(g.ModalScreen.USER_LIMIT_REACHED_SCREEN);if(e?.privyErrorCode===o.PrivyErrorCode.USER_DOES_NOT_EXIST)return A(void 0),p(),void h(g.ModalScreen.ACCOUNT_NOT_FOUND_SCREEN);if(e?.privyErrorCode===o.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return A(void 0),p(),c({accountTransfer:{nonce:e.data?.data?.nonce,account:e.data?.data?.subject,displayName:e.data?.data?.account?.displayName,linkMethod:y()?.provider,embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress,oAuthUserInfo:e.data?.data?.otherUser?.oAuthUserInfo}}),void h(g.ModalScreen.LINK_CONFLICT_SCREEN);let{retryable:t,detail:r}=function(e,t){let r={detail:"",retryable:!1},n=Qi(t);if(e?.privyErrorCode===o.PrivyErrorCode.LINKED_TO_ANOTHER_USER&&(r.detail="This account has already been linked to another user."),e?.privyErrorCode===o.PrivyErrorCode.INVALID_CREDENTIALS&&(r.retryable=!0,r.detail="Something went wrong. Try again."),e.privyErrorCode===o.PrivyErrorCode.OAUTH_USER_DENIED&&(r.detail=`Retry and check ${n} to finish connecting your account.`,r.retryable=!0),e?.privyErrorCode===o.PrivyErrorCode.TOO_MANY_REQUESTS&&(r.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode===o.PrivyErrorCode.TOO_MANY_REQUESTS&&e.message.includes("provider rate limit")){let e=ua(t).name;r.detail=`Request limit reached for ${e}. Please wait a moment and try again.`}if(e?.privyErrorCode===o.PrivyErrorCode.OAUTH_ACCOUNT_SUSPENDED){let e=ua(t).name;r.detail=`Your ${e} account is suspended. Please try another login method.`}return e?.privyErrorCode===o.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE&&(r.detail="You cannot authorize more than one account for this user."),e?.privyErrorCode===o.PrivyErrorCode.OAUTH_UNEXPECTED&&t.startsWith("privy:")&&(r.detail="Something went wrong. Please try again."),r}(e,j);A({retryable:t,detail:r,message:"Authentication failed"})})).finally((()=>{pa()}))}),[$,j]),i.useEffect((()=>{if(n&&t&&E&&a){if(s?.legal.requireUsersAcceptTerms&&!a.hasAcceptedTerms){let e=setTimeout((()=>{h(g.ModalScreen.AFFIRMATIVE_CONSENT_SCREEN)}),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}if(u.shouldProceedtoEmbeddedWalletCreationFlow(a,s?.embeddedWallets?.createOnLogin)){let e=setTimeout((()=>{c({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),C({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,provider:j,screen:"OAuthStatusScreen"}}),r()},callAuthOnSuccessOnClose:!0}}),h(g.ModalScreen.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}{let e=setTimeout((()=>x({shouldCallAuthOnSuccess:!0,isSuccess:!0})),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return v(),()=>clearTimeout(e)}}}),[n,t,E,a]);let _=E?`Successfully connected with ${$}`:S?S.message:`Verifying connection to ${$}`,k="";return k=E?"You’re good to go!":S?S.detail:"Just a few moments more",e.jsxs(e.Fragment,{children:[e.jsx(Wo,{}),e.jsx(Xs,{}),e.jsxs(im,{children:[e.jsx(Ko,{children:e.jsxs("div",{children:[e.jsx(xo,{success:E,fail:!!S}),e.jsx(T,{style:{width:"38px",height:"38px"}})]})}),e.jsxs(Ys,{children:[e.jsx("h3",{children:_}),e.jsx("p",{children:k})]}),S&&S?.retryable?e.jsx(Io,{onClick:()=>{pa(),m(j),A(void 0)},disabled:!E&&!S?.retryable,children:"Retry"}):null]}),e.jsx(Js,{}),e.jsx(d.ModalFooter,{})]})},[g.ModalScreen.CROSS_APP_AUTH_SCREEN]:()=>{let t=l.useAppConfig(),{data:r,navigate:n,setModalData:a,onUserCloseViaDialogOrKeybindRef:s}=g.usePrivyModal(),{crossAppAuthFlow:c,updateWallets:h,closePrivyModal:p,createAnalyticsEvent:y}=o.usePrivyInternal(),{logout:m}=d.useLogout(),[f,v]=i.useState({}),w=r?.crossAppAuth,x={id:w.appId,name:w.name,logoUrl:w.logoUrl},C=new o.PrivyClientError(`There was an issue connecting your ${x.name} account. Please try again.`),E=new Gi((async e=>{if(w.popup)try{let t=await c({appId:e,popup:w.popup,action:w.action});v({data:t})}catch(e){e instanceof o.PrivyClientError?v({error:e}):(e instanceof o.PrivyApiError&&w.popup&&w.popup.close(),v({error:C}))}else v({error:C})})),b=()=>{f.data&&(h(),w.onSuccess(f.data),p({shouldCallAuthOnSuccess:!0,isSuccess:!0})),w.onError(f.error??new o.PrivyClientError("User canceled flow")),p({shouldCallAuthOnSuccess:!1,isSuccess:!1})};s.current=b,i.useEffect((()=>{x.id.length&&E.execute(x.id)}),[x.id]),i.useEffect((()=>{if(!f.data)return;let e=f.data;if(t.legal.requireUsersAcceptTerms&&!e.hasAcceptedTerms){let e=setTimeout((()=>{n(g.ModalScreen.AFFIRMATIVE_CONSENT_SCREEN)}),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}if(u.shouldProceedtoEmbeddedWalletCreationFlow(e,t.embeddedWallets?.createOnLogin)){let e=setTimeout((()=>{a({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),y({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,provider:`privy:${x.id}`,screen:"CrossAppAuthScreen"}}),m()},callAuthOnSuccessOnClose:!0}}),n(g.ModalScreen.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}let r=setTimeout(b,l.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(r)}),[f.data]);let{title:S,subtitle:A}=i.useMemo((()=>f.data?{title:`Successfully connected with ${x.name}`,subtitle:"You're good to go!"}:f.error?{title:"Authentication failed",subtitle:f.error.message}:{title:`Connecting to ${x.name}`,subtitle:`Please check the pop-up from ${x.name} to continue`}),[f,x.name]);return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{onClose:b}),e.jsx(Xs,{}),e.jsxs(Hl,{children:[e.jsx(Ko,{children:e.jsxs("div",{children:[e.jsx(xo,{success:!!f.data,fail:!!f.error}),e.jsx(Bl,{name:x.name,logoUrl:x.logoUrl})]})}),e.jsxs(Ys,{children:[e.jsx("h3",{children:S}),e.jsx("p",{children:A})]})]}),e.jsx(Js,{}),e.jsx(d.ModalFooter,{})]})},[g.ModalScreen.ALLOWLIST_REJECTION_SCREEN]:()=>{let{navigate:t,app:r}=g.usePrivyModal(),n=r?.allowlistConfig.errorTitle||"You don't have access to this app",i=r?.allowlistConfig.errorDetail||"Have you been invited?",a=r?.allowlistConfig.errorCtaText||"Try another account";return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{}),e.jsxs(Ws,{children:[e.jsx(Ko,{children:e.jsxs("div",{children:[e.jsx(os,{}),e.jsx(Ds,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),e.jsxs(Bs,{children:["string"==typeof n?e.jsx("h3",{children:n}):e.jsx(e.Fragment,{children:n}),"string"==typeof i?e.jsx("p",{children:i}):e.jsx(e.Fragment,{children:i})]}),r?.allowlistConfig.errorCtaLink?e.jsx(jo,{as:"a",href:r.allowlistConfig.errorCtaLink,children:a}):e.jsx(jo,{onClick:()=>{t(g.ModalScreen.LANDING)},children:a})]})]})},[g.ModalScreen.ACCOUNT_NOT_FOUND_SCREEN]:()=>{let{navigate:t,app:r}=g.usePrivyModal();return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{}),e.jsxs(is,{children:[e.jsx(Ko,{children:e.jsxs("div",{children:[e.jsx(Ro,{color:"var(--privy-color-warn-light)"}),e.jsx(Ue.default,{height:38,width:38,strokeWidth:2,stroke:"var(--privy-color-warn)"})]})}),e.jsxs(as,{children:[e.jsx("h3",{children:"Account not found"}),e.jsxs("p",{children:["Please try logging in again or go to ",r.name," to create an account."]})]}),e.jsx(Yo,{}),e.jsx(jo,{onClick:()=>t(g.ModalScreen.LANDING),children:"Try logging in again"})]})]})},[g.ModalScreen.USER_LIMIT_REACHED_SCREEN]:()=>{let{navigate:t}=g.usePrivyModal();return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{}),e.jsxs(Lf,{children:[e.jsx(Uf,{children:e.jsx(Ff,{})}),e.jsxs(Df,{children:[e.jsx("h3",{children:"Unable to sign in"}),e.jsx("p",{children:"This application has reached its user limit and cannot sign in new users."})]}),e.jsx(jo,{onClick:()=>{t(g.ModalScreen.LANDING)},children:"Go back"})]}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.INSTALL_PHANTOM_SCREEN]:()=>{let{navigateBack:t}=g.usePrivyModal();return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{backFn:t},"header"),e.jsx(Xs,{}),e.jsx(ep,{}),e.jsx(Js,{}),e.jsxs(d.ModalFooter,{children:[e.jsx("span",{children:"Still not sure? "}),e.jsx("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})},[g.ModalScreen.LINK_EMAIL_SCREEN]:()=>{let{app:t}=g.usePrivyModal();return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{},"header"),e.jsx(Xs,{}),e.jsx(il,{title:"Connect your email",description:`Add your email to your ${t?.name} account`,icon:e.jsx(Ke.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),e.jsx(Hs,{children:e.jsx(sp,{stacked:!0})}),e.jsx(Js,{}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.LINK_PHONE_SCREEN]:()=>{let{app:t,currentScreen:r,data:n,navigate:i,setModalData:a}=g.usePrivyModal(),{initLoginWithSms:s}=o.usePrivyInternal();return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{},"header"),e.jsx(Xs,{}),e.jsx(il,{title:"Connect your phone",description:`Add your number to your ${t?.name} account`,icon:e.jsx(Ye.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),e.jsx(Hs,{children:e.jsx(yp,{stacked:!0,onSubmit:async function({qualifiedPhoneNumber:e}){try{await s(e),i(g.ModalScreen.AWAITING_PASSWORDLESS_CODE)}catch(e){a({errorModalData:{error:e,previousScreen:n?.errorModalData?.previousScreen||r||g.ModalScreen.LINK_PHONE_SCREEN}}),i(g.ModalScreen.ERROR_SCREEN)}},hideRecent:!0})}),e.jsx(Js,{}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.LINK_WALLET_SCREEN]:()=>{let{app:t,data:r}=g.usePrivyModal(),n=r?.externalConnectWallet?.suggestedAddress,i=n?e.jsxs("span",{children:["Link the wallet with address ",e.jsx(d.Address,{showCopyIcon:!1,address:n})," ",t?.name?`to ${t.name}.`:"."]}):`Link a wallet to your ${t?.name} account`;return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{},"header"),e.jsx(nl,{title:"Link your wallet",description:i}),e.jsx(Xo,{children:e.jsx(Ol,{connectOnly:!1})}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.LINK_PASSKEY_SCREEN]:()=>{let{user:t,unlinkPasskey:r}=o.usePrivy(),{linkWithPasskey:n,closePrivyModal:a}=o.usePrivyInternal(),s=t?.linkedAccounts.filter((e=>"passkey"===e.type)),[l,c]=i.useState(!1),[u,h]=i.useState(""),[p,y]=i.useState(!1),[m,f]=i.useState(!1);i.useEffect((()=>{0===s.length&&f(!1)}),[s.length]);let g=async e=>(c(!0),await r(e).then((()=>y(!0))).catch((e=>{e instanceof o.PrivyError&&e.privyErrorCode===o.PrivyErrorCode.MISSING_MFA_CREDENTIALS?h("Cannot unlink a passkey enrolled in MFA"):h("Unknown error occurred.")})).finally((()=>{c(!1)})));return p?e.jsxs(e.Fragment,{children:[e.jsx(Wo,{onClose:()=>a()},"header"),e.jsx(xs,{children:e.jsx(Rs,{status:"success",children:e.jsx(Ze.default,{})})}),e.jsx(bu,{children:"Passkey added"}),e.jsx(Su,{children:"From now on, you can use your passkey to log in."}),e.jsx($s,{children:e.jsx(jo,{onClick:()=>a(),children:"Done"})}),e.jsx(d.ModalFooter,{})]}):m?e.jsxs(e.Fragment,{children:[e.jsx(Wo,{backFn:()=>f(!1),onClose:()=>a()},"header"),e.jsx(fu,{passkeys:s,expanded:m,onUnlink:g,onExpand:()=>f(!0)}),e.jsx(d.ModalFooter,{})]}):e.jsxs(e.Fragment,{children:[e.jsx(Wo,{onClose:()=>a()},"header"),e.jsx(xs,{children:e.jsxs(vu,{children:[e.jsx(yu,{}),e.jsx(mu,{})]})}),e.jsx(bu,{children:"Secure your account with a passkey"}),e.jsx(Au,{}),0===s.length?e.jsx(gu,{}):e.jsx(fu,{passkeys:s,expanded:m,onUnlink:g,onExpand:()=>f(!0)}),e.jsxs($s,{style:{marginTop:"12px"},children:[u&&e.jsx(wu,{$fail:!0,children:u}),e.jsx(jo,{onClick:()=>{c(!0),n().then((()=>y(!0))).catch((e=>{if(e instanceof o.PrivyError){if(e.privyErrorCode===o.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE)return void h("Cannot link more passkeys to account.");if(e.privyErrorCode===o.PrivyErrorCode.PASSKEY_NOT_ALLOWED)return void h("Passkey request timed out or rejected by user.")}h("Unknown error occurred.")})).finally((()=>{c(!1)}))},loading:l,children:"Add new passkey"})]}),e.jsx(d.ModalFooter,{})]})},[g.ModalScreen.UPDATE_EMAIL_SCREEN]:()=>e.jsxs(e.Fragment,{children:[e.jsx(Wo,{},"header"),e.jsx(Xs,{}),e.jsx(il,{title:"Update your email",description:"Add the email address you'd like to use going forward. We'll send you a confirmation code",icon:e.jsx(Ke.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),e.jsx(Hs,{children:e.jsx(Mf,{stacked:!0})}),e.jsx(Js,{}),e.jsx(d.BlobbyFooter,{})]}),[g.ModalScreen.UPDATE_PHONE_SCREEN]:()=>{let{currentScreen:t,data:r,navigate:n,setModalData:i}=g.usePrivyModal(),{user:a}=o.usePrivy(),{initUpdatePhone:s}=o.usePrivyInternal();return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{},"header"),e.jsx(Xs,{}),e.jsx(il,{title:"Update your phone number",description:"Add the phone number you'd like to use going forward. We'll send you a confirmation code",icon:e.jsx(Ye.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),e.jsx(Hs,{children:e.jsx(yp,{stacked:!0,onSubmit:async function({qualifiedPhoneNumber:e}){try{if(!a?.phone?.number)throw Error("User is required to have an phone number to update it.");await s(a?.phone?.number,e),n(g.ModalScreen.AWAITING_PASSWORDLESS_CODE)}catch(e){i({errorModalData:{error:e,previousScreen:r?.errorModalData?.previousScreen||t||g.ModalScreen.LINK_PHONE_SCREEN}}),n(g.ModalScreen.ERROR_SCREEN)}},hideRecent:!0})}),e.jsx(Js,{}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.CONNECT_ONLY_LANDING_SCREEN]:()=>{let{app:t,data:r}=g.usePrivyModal(),n=r?.externalConnectWallet?.suggestedAddress,i=n?e.jsxs("span",{children:["Connect the wallet with address ",e.jsx(d.Address,{showCopyIcon:!1,address:n})," ",t?.name?`to ${t.name}.`:"."]}):`Connect a wallet to your ${t?.name} account`;return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{},"header"),e.jsx(rl,{title:"Connect your wallet",description:i}),e.jsx(Xo,{children:e.jsx(Ol,{connectOnly:!0})}),t&&e.jsx(d.TermsAndConditions,{app:t,alwaysShowImplicitConsent:!0}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.CONNECT_ONLY_AUTHENTICATED_SCREEN]:()=>{let{app:t,data:r}=g.usePrivyModal(),n=r?.externalConnectWallet?.suggestedAddress,i=n?`Connect the wallet with address ${d.formatWalletAddress(n)} ${t?.name?`to ${t.name}.`:"."}`:`Connect a wallet to ${t?.name}`;return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{},"header"),e.jsx(nl,{title:"Connect your wallet",description:i}),e.jsx(Xo,{children:e.jsx(Ol,{connectOnly:!0})}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN]:()=>{let{app:t,setModalData:r,navigate:n,data:a,onUserCloseViaDialogOrKeybindRef:s}=g.usePrivyModal(),[d,c]=i.useState(""),{embeddedWallets:u}=l.useAppConfig(),{authenticated:h,user:p}=o.usePrivy(),{closePrivyModal:y}=o.usePrivyInternal(),{onSuccess:m,onFailure:f,callAuthOnSuccessOnClose:v}=a.createWallet,w=!0===t?.embeddedWallets.requireUserOwnedRecoveryOnCreate,{createWallet:x}=Cd(),[C,E]=i.useState(null),b=new Gi((async()=>{try{let e=await x({user:p});if(!e)return;E(e),n(g.ModalScreen.EMBEDDED_WALLET_CREATED_SCREEN)}catch(e){c(e.message)}}));return i.useEffect((()=>h&&p?w?(r({...a,recoverySelection:{...a?.recoverySelection,isInAccountCreateFlow:!0}}),n(ld({walletAction:"create",showAutomaticRecovery:!1,availableRecoveryMethods:u.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:!1,isResettingPassword:!1}))):void b.execute():(n(g.ModalScreen.LANDING),void f(Error("User must be authenticated before creating a Privy wallet")))),[w,h]),s.current=()=>null,d?e.jsxs(e.Fragment,{children:[e.jsx(Wo,{closeable:!1}),e.jsxs(Vs,{children:[e.jsx(Xe.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),e.jsx(il,{title:"Something went wrong",description:d})]}),e.jsx(jo,{onClick:()=>{C?(m(C),y({shouldCallAuthOnSuccess:v})):(f(new o.PrivyEmbeddedWalletError("User wallet creation failed")),y({shouldCallAuthOnSuccess:!1}))},children:"Close"}),e.jsx(Ed,{})]}):e.jsx(Vl,{})},[g.ModalScreen.EMBEDDED_WALLET_CREATED_SCREEN]:()=>{let{user:t}=o.usePrivy(),{closePrivyModal:r,isNewUserThisSession:n,updateWallets:a}=o.usePrivyInternal(),{app:s,data:c,onUserCloseViaDialogOrKeybindRef:h}=g.usePrivyModal(),{onSuccess:p,onFailure:y,callAuthOnSuccessOnClose:m}=c.createWallet,f=()=>{let e=u.getPrivyEthereumWallet(t);e?(a(),p(e)):y(Error("Failed to create wallet")),r({shouldCallAuthOnSuccess:m})};return i.useEffect((()=>{let e=setTimeout(f,l.DEFAULT_SUCCESS_SCREEN_LONG_DURATION_MS);return()=>clearTimeout(e)}),[]),h.current=f,e.jsxs(e.Fragment,{children:[e.jsx(Wo,{onClose:f}),e.jsx(Xs,{}),e.jsxs(Vs,{children:[e.jsx(Ze.default,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),e.jsx(il,{title:n?"Welcome"+(s?.name?` to ${s?.name}`:""):"All set!",description:n?"You’ve successfully created an account.":"Your account is secured."})]}),e.jsx(Js,{}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN]:()=>{let{authenticated:t,user:r,getAccessToken:n}=o.usePrivy(),{closePrivyModal:a,createAnalyticsEvent:s,walletProxy:l}=o.usePrivyInternal(),{navigate:d,data:c,setModalData:h,onUserCloseViaDialogOrKeybindRef:p}=g.usePrivyModal(),y=i.useMemo((()=>Date.now()),[]),[m,f]=i.useState(!1),{onCompleteNavigateTo:v,onFailure:w,shouldForceMFA:x,address:C}=c?.connectWallet,E=e=>{m||(f(!0),w("string"==typeof e?Error(e):e))};i.useEffect((()=>{let e,i=C?r?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType&&e.address===C)):u.getPrivyEthereumWallet(r);return t&&i?l?((async()=>{let t=await n();if(!t)return E("User must be authenticated and have a Privy wallet before it can be connected");let r="ethereum"===i.chainType;try{r?await l.connect({accessToken:t,address:i.address}):await l.connectSolana({accessToken:t,publicKey:i.address}),x&&await l.verifyMfa({accessToken:t});let n=(Date.now()-y)/1e3;v===g.ModalScreen.EMBEDDED_WALLET_KEY_EXPORT_SCREEN&&n<1?e=setTimeout((()=>{d(v,!1)}),1e3*(1-n)):d(v,!1)}catch(e){if(td(e)&&"privy"===i.recoveryMethod){let e=await n();if(!e)return E("User must be authenticated and have a Privy wallet before it can be recovered");try{if(s({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:i.address}}),r){let t=await(l?.recover({address:i.address,accessToken:e,recoveryMethod:i.recoveryMethod}));t?.address||E(Error("Unable to recover wallet"))}else{let t=await(l?.recoverSolana({publicKey:i.address,accessToken:e}));t?.publicKey||E(Error("Unable to recover wallet"))}v?d(v):a({shouldCallAuthOnSuccess:!1}),s({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:i.address}}),d(v)}catch(e){E("An error has occurred, please try again.")}}else td(e)&&"privy"!==i.recoveryMethod?(h({...c,recoverWallet:{privyWallet:i,onCompleteNavigateTo:v,onFailure:w},recoveryOAuthStatus:{provider:i.recoveryMethod,action:"recover",isInAccountCreateFlow:!1}}),d(dd(i.recoveryMethod))):E(e)}})(),()=>clearTimeout(e)):void 0:E("User must be authenticated and have a Privy wallet before it can be connected")}),[t,r,l]);let b=()=>{E("User exited before wallet could be connected"),a({shouldCallAuthOnSuccess:!1})};return p.current=b,e.jsxs(e.Fragment,{children:[e.jsx(Wo,{onClose:b}),m?e.jsxs(e.Fragment,{children:[e.jsxs(Vs,{children:[e.jsx(Xe.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),e.jsx(il,{title:"Something went wrong",description:"We’re on it. Please try again later."})]}),e.jsx(jo,{onClick:()=>a({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):e.jsx(Vl,{}),e.jsx(hd,{})]})},[g.ModalScreen.EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN]:()=>{let[t,r]=i.useState(!0),{authenticated:n,getAccessToken:a}=o.usePrivy(),{walletProxy:s,closePrivyModal:l,createAnalyticsEvent:c}=o.usePrivyInternal(),{navigate:u,data:h,onUserCloseViaDialogOrKeybindRef:p}=g.usePrivyModal(),[y,m]=i.useState(void 0),[f,v]=i.useState(""),[w,x]=i.useState(!1),{privyWallet:C,onCompleteNavigateTo:E,onSuccess:b,onFailure:S}=h.recoverWallet,A=(e="User exited before their wallet could be recovered")=>{l({shouldCallAuthOnSuccess:!1}),S("string"==typeof e?new o.PrivyEmbeddedWalletError(e):e)};p.current=A,i.useEffect((()=>{if(!n||!C)return A("User must be authenticated and have a Privy wallet before it can be recovered")}),[n]);return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{onClose:A}),e.jsx(Xs,{}),e.jsxs(lm,{children:[e.jsxs(sm,{children:[e.jsx(Pt.default,{height:48,width:48,stroke:"var(--privy-color-accent)"}),e.jsx("h3",{style:{color:"var(--privy-color-foreground)"},children:"Enter your password"}),e.jsx("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),e.jsxs("div",{children:[e.jsxs(_d,{children:[e.jsx(Td,{type:t?"password":"text",onChange:e=>(e=>{e&&m(e)})(e.target.value),disabled:w,style:{paddingRight:"2.3rem"}}),e.jsx(Od,{style:{right:"0.75rem"},children:t?e.jsx(Fd,{onClick:()=>r(!1)}):e.jsx(Ld,{onClick:()=>r(!0)})})]}),!!f&&e.jsx(dm,{children:f})]}),e.jsxs("div",{children:[e.jsxs(Zs,{children:[e.jsx("h4",{children:"Why is this necessary?"}),e.jsx("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),e.jsx(cm,{loading:w||!s,disabled:!y,onClick:async()=>{x(!0);let e=await a();if(!e||!C||null===y)return A("User must be authenticated and have a Privy wallet before it can be recovered");try{c({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:C.address}}),await(s?.recover({address:C.address,accessToken:e,recoveryPin:y,recoveryMethod:C.recoveryMethod})),v(""),E?u(E):l({shouldCallAuthOnSuccess:!1}),b?.(C),c({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:C.address}})}catch(e){!function(e){return ed(e)&&("invalid_recovery_pin"===e.type||"invalid_request_arguments"===e.type)}(e)?v("An error has occurred, please try again."):v("Invalid recovery password, please try again.")}finally{x(!1)}},warn:!1,hideAnimations:!C&&w,children:"Recover your account"})]})]}),e.jsx(Js,{}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN]:()=>{let[t,r]=i.useState(!1),{navigate:n,lastScreen:a,navigateBack:s,setModalData:c,data:h,onUserCloseViaDialogOrKeybindRef:p}=g.usePrivyModal(),{user:y}=o.usePrivy(),{embeddedWallets:m}=l.useAppConfig(),{closePrivyModal:f}=o.usePrivyInternal(),v=u.getPrivyEthereumWallet(y),w=null===v,{isInAccountCreateFlow:x,isResettingPassword:C}=h.recoverySelection,E=v&&"privy"!==v.recoveryMethod,b=E?e.jsxs("span",{children:["Your account is currently secured using"," ",e.jsx("strong",{children:gm[v?.recoveryMethod||"user-passcode"]}),"."]}):"Select a method for logging in on new devices and recovering your account.";function S(e){c({recoveryOAuthStatus:{provider:e,action:w?"create-wallet":"set-recovery",isInAccountCreateFlow:x}}),n(g.ModalScreen.EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN)}function A(){h?.setWalletPassword?.onFailure(Error("User exited set recovery flow")),f({shouldCallAuthOnSuccess:h?.setWalletPassword?.callAuthOnSuccessOnClose??!1})}return p.current=A,e.jsxs(e.Fragment,{children:[e.jsx(Wo,{onClose:A,backFn:t?()=>r(!1):a?s:void 0,infoFn:a||t?void 0:()=>r(!0)},"header"),t?e.jsx(vm,{onClose:()=>r(!1)}):e.jsxs(e.Fragment,{children:[e.jsx(il,{title:E?"Update backup method":"Secure your account",icon:e.jsx(It.default,{width:48}),description:b}),e.jsx(pm,{children:m.userOwnedRecoveryOptions.filter((e=>!["icloud","google-drive"].includes(v?.recoveryMethod||"")||e!==v?.recoveryMethod)).sort().map((t=>{switch(t){case"google-drive":return e.jsxs(ts,{onClick:()=>S("google-drive"),children:[e.jsx(fm,{children:e.jsx(hm,{style:{width:18}})}),"Back up to Google Drive"]},t);case"icloud":return e.jsxs(ts,{onClick:()=>S("icloud"),children:[e.jsx(fm,{children:e.jsx(um,{style:{width:24}})}),"Back up to Apple iCloud"]},t);case"user-passcode":return e.jsxs(ts,{onClick:()=>{n(sd({isCreatingWallet:w,skipSplashScreen:!0}))},children:[e.jsx(fm,{children:e.jsx(Mt.default,{style:{width:18}})}),C?"Reset your":"Set a"," password"]},t);default:return null}}))})]}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.EMBEDDED_WALLET_SET_AUTOMATIC_RECOVERY_SCREEN]:()=>{let{user:t,getAccessToken:r}=o.usePrivy(),n=u.getPrivyEthereumWallet(t),{walletProxy:a,refreshUser:s,closePrivyModal:c}=o.usePrivyInternal(),h=g.usePrivyModal(),[p,y]=i.useState(!1),[m,f]=i.useState(null),[v,w]=i.useState(null);function x(){if(!p){if(v)return h.data?.setWalletPassword?.onFailure(v),void c();if(!m)return h.data?.setWalletPassword?.onFailure(Error("User exited set recovery flow")),void c()}}h.onUserCloseViaDialogOrKeybindRef.current=x;let C=!(!p&&!m);return v?e.jsxs(e.Fragment,{children:[e.jsx(Wo,{onClose:x},"header"),e.jsx(wm,{$color:"var(--privy-color-error)",style:{alignSelf:"center"},children:e.jsx(He.default,{height:38,width:38,stroke:"var(--privy-color-error)"})}),e.jsx(fd,{style:{marginTop:"0.5rem"},children:"Something went wrong"}),e.jsx(Yo,{style:{minHeight:"2rem"}}),e.jsx($o,{onClick:()=>w(null),children:"Try again"}),e.jsx(d.BlobbyFooter,{})]}):e.jsxs(e.Fragment,{children:[e.jsx(Wo,{onClose:x},"header"),e.jsx(It.default,{style:{width:"3rem",height:"3rem",alignSelf:"center"}}),e.jsx(fd,{style:{marginTop:"0.5rem"},children:"Automatically secure your account"}),e.jsx(md,{style:{marginTop:"1rem"},children:"When you log into a new device, you’ll only need to authenticate to access your account. Never get logged out if you forget your password."}),e.jsx(Yo,{style:{minHeight:"2rem"}}),e.jsx($o,{loading:p,disabled:C,onClick:()=>async function(){y(!0);try{let e=await r();if(!e||!a||!n)return;if(!(await a.setRecovery({recoveryMethod:"privy",address:n.address,accessToken:e})).address)throw Error("Unable to set recovery on wallet");let t=await s();if(!t)throw Error("Unable to set recovery on wallet");let i=u.getPrivyEthereumWallet(t);if(!i)throw Error("Unabled to set recovery on wallet");f(!!t),setTimeout((()=>{h.data?.setWalletPassword?.onSuccess(i),c()}),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS)}catch(e){w(e)}finally{y(!1)}}(),children:m?"Success":"Confirm"}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN]:()=>{let{logout:t}=o.usePrivy(),{navigate:r,setModalData:n,data:a}=g.usePrivyModal(),{recoveryOAuthFlow:s,closePrivyModal:c,createAnalyticsEvent:u}=o.usePrivyInternal(),[h,p]=i.useState(!1),{provider:y,action:m,isInAccountCreateFlow:f}=a?.recoveryOAuthStatus,[v,w]=i.useState(void 0),[x,C]=i.useState("create-wallet"===m);if("user-passcode"===y)throw Error("RecoveryOAuthScreen should never be called with a wallet that specifies recoveryMethod: `user-passcode`");let E=mm[y].name,b=mm[y].component,S=a?.recoverWallet?.onCompleteNavigateTo,A=new Gi((async(e="create-wallet")=>(C(!0),new Promise(((t,r)=>{setTimeout((async()=>{try{let r=window.open();await s(y,e,r),p(!0),t()}catch(t){w({message:`${"recover"===e?"Recovery":"Back up"} with ${E} unsuccessful`,detail:"recover"===m?`Please verify that you are selecting the ${E} account associated with your backup.`:"",retryable:!0}),r()}}),0)})))));i.useEffect((()=>{"recover"!==m&&A.execute(f?"create-wallet":"set-recovery")}),[]),i.useEffect((()=>{if(!h)return;let e=setTimeout((()=>{f?(n({createWallet:{onSuccess:()=>{},onFailure:e=>{u({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"RecoveryOAuthScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),r(g.ModalScreen.EMBEDDED_WALLET_CREATED_SCREEN)):c({shouldCallAuthOnSuccess:!1})}),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}),[h]);let j=i.useCallback((async()=>{await A.execute("recover"),S?r(S):p(!0)}),[]),$="google-drive"===y?"Google Drive":"Apple iCloud",T=h&&`Successfully ${"recover"===m?"recovered":"backed up"} with ${$}.`||v&&v.message||`${"recover"===m?"Recovering":"Backing up"} with ${$}...`,P=v?v.detail:"";return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{}),x?e.jsx(e.Fragment,{children:e.jsxs(pm,{children:[e.jsx(il,{title:T,icon:e.jsx(b,{style:{width:"38px",height:"38px"}}),description:P}),v&&v?.retryable?e.jsx(jo,{onClick:()=>{pa(),w(void 0),"create-wallet"===m?A.execute("create-wallet"):j()},disabled:!h&&!v?.retryable,children:"Try again"}):null]})}):e.jsxs(pm,{children:[e.jsx(il,{title:"Confirm it's really you",icon:e.jsx(b,{style:{height:42,width:48}}),description:`To confirm your identity, please log in to ${$} where your account is backed up.`}),e.jsxs(jo,{onClick:j,children:["Confirm with ",$]})]}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.EMBEDDED_WALLET_KEY_EXPORT_SCREEN]:()=>{let[t,r]=i.useState(null),{authenticated:n,user:a,getAccessToken:s}=o.usePrivy(),{closePrivyModal:c,createAnalyticsEvent:u,clientAnalyticsId:h}=o.usePrivyInternal(),p=l.useAppConfig(),{data:y,onUserCloseViaDialogOrKeybindRef:m}=g.usePrivyModal(),{onFailure:f,onSuccess:v,origin:w,appId:x,appClientId:C,wallet:E}=y.keyExport,b=e=>{c({shouldCallAuthOnSuccess:!1}),f("string"==typeof e?Error(e):e)},S=()=>{c({shouldCallAuthOnSuccess:!1}),v(),u({eventName:"embedded_wallet_key_export_completed",payload:{walletAddress:E.address}})};return i.useEffect((()=>{if(!n||!E)return b("User must be authenticated before exporting their wallet");s().then(r,b)}),[n,a]),m.current=S,e.jsxs(e.Fragment,{children:[e.jsx(Wo,{onClose:S}),e.jsxs(vd,{children:[e.jsx(fd,{children:"Transfer wallet"}),e.jsxs(md,{children:["Either copy your private key or seed phrase to transfer your wallet."," ",e.jsx("a",{href:"https://privy-io.notion.site/Transferring-your-account-9dab9e16c6034a7ab1ff7fa479b02828",target:"blank",rel:"noopener noreferrer",children:"Learn more"})]}),e.jsx(pd,{theme:p.appearance.palette.colorScheme,children:"Never share your private key or seed phrase with anyone."}),e.jsx(d.WalletInfoCard,{isLoading:!1,isPulsing:!1,title:"Your wallet",address:E.address,showIcon:!0}),e.jsx("div",{style:{width:"100%"},children:t&&e.jsx(gd,{origin:w,appId:x,appClientId:C,accessToken:t,clientAnalyticsId:h,wallet:E,dimensions:{height:"44px"}})})]}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN]:()=>{let{authenticated:t}=o.usePrivy(),{initializeWalletProxy:r,closePrivyModal:n}=o.usePrivyInternal(),{navigate:a,data:s,onUserCloseViaDialogOrKeybindRef:c}=g.usePrivyModal(),[u,h]=i.useState(!0),[p,y]=i.useState(""),[f,v]=i.useState(),[w,x]=i.useState(null),[C,E]=i.useState(!1),b=null!==w;i.useEffect((()=>{t||a(g.ModalScreen.LANDING)}),[t]),i.useEffect((()=>{r(l.WALLET_PROXY_TIMEOUT).then((e=>{h(!1),e||(y("An error has occurred, please try again."),v(new m.PrivyProviderRpcError(new m.ProviderRpcError(p,m.E.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))}))}),[]);let{method:S,data:A,confirmAndSign:j,onSuccess:$,onFailure:T,uiOptions:P}=s.signMessage,_={title:P.title||"Sign message",description:P.description||"Signing this message will not cost you any fees.",buttonText:P.buttonText||"Sign and continue"},k=e=>{e?$(e):T(f||new m.PrivyProviderRpcError(new m.ProviderRpcError("The user rejected the request.",m.E.E4001_USER_REJECTED_REQUEST.eipCode))),n({shouldCallAuthOnSuccess:!1}),setTimeout((()=>{x(null),y(""),v(void 0)}),200)};return c.current=()=>{k(w)},e.jsxs(e.Fragment,{children:[e.jsx(Wo,{onClose:()=>k(w)}),e.jsx(Xs,{}),P.iconUrl&&"string"==typeof P.iconUrl?e.jsx(kf,{children:e.jsx(Ef,{size:"sm",src:P.iconUrl,alt:"app image"})}):null,e.jsx(fd,{children:_.title}),e.jsx(md,{children:_.description}),"personal_sign"===S&&e.jsx($f,{children:bf(A)}),"eth_signTypedData_v4"===S&&e.jsx(jf,{typedData:A}),"solana_signMessage"===S&&e.jsx($f,{children:A}),e.jsx(Nf,{}),e.jsx(Pf,{$fail:!0,children:p}),e.jsx($o,{disabled:C||b||u,loading:C,onClick:async()=>{E(!0),y("");try{let e=await j();x(e),E(!1),setTimeout((()=>{k(e)}),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS)}catch(e){console.error(e),y("An error has occurred, please try again."),v(new m.PrivyProviderRpcError(new m.ProviderRpcError(p,m.E.E32603_DEFAULT_INTERNAL_ERROR.eipCode))),E(!1)}},children:C?"Signing...":b?e.jsxs(_f,{children:[e.jsx(fc,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",e.jsx("span",{children:"Success"})]}):_.buttonText}),e.jsx(Js,{}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN]:()=>{let{data:t,onUserCloseViaDialogOrKeybindRef:r,setModalData:n,navigate:a}=g.usePrivyModal(),{rpcConfig:s,chains:c,closePrivyModal:u,walletProxy:h}=o.usePrivyInternal(),{getAccessToken:p,user:y}=o.usePrivy(),f=l.useAppConfig(),[v,w]=i.useState(0),x=(e=>e?.sendTransaction?"transactionRequest"in e.sendTransaction?0:e.sendTransaction.transactionRequests.length-1:0)(t),[C,E]=i.useState(((e,t)=>e?.sendTransaction?"transactionRequest"in e.sendTransaction?e.sendTransaction.transactionRequest:e.sendTransaction.transactionRequests[t]:void 0)(t,v)),[b,S]=i.useState(null),[A,j]=i.useState(),[$,T]=i.useState(!1),[P,_]=i.useState(null),[k,N]=i.useState(null);if(!C||!t?.sendTransaction||!t?.sendTransaction.transactingWallet)return e.jsx(pc,{error:Error("Invalid transaction request"),onClick:()=>{t?.sendTransaction?.onFailure(Cf),u({shouldCallAuthOnSuccess:!1})}});let I=t.sendTransaction.rootWallet,M=t.sendTransaction.transactingWallet,O=i.useMemo((()=>c.find((e=>Number(e.id)===Number(C.chainId)))),[C.chainId]),R=O?.nativeCurrency.symbol??"ETH",{action:F,amount:L,spender:U,isErc20Ish:D}=i.useMemo((()=>(e=>{let t=vf(e);if(t)return{action:"approve",isErc20Ish:!0,functionName:t.functionName,spender:t.args[0],amount:t.args[1]};let r=wf(e);return r?{action:"transfer",isErc20Ish:!0,functionName:r.functionName,amount:r.args[1]}:{action:"transaction",isErc20Ish:!1}})(C.data)),[C.data]);i.useEffect((()=>{C.to&&O&&D&&dh({address:C.to,chain:O,rpcConfig:f.rpcConfig,privyAppId:f.id}).then(S).catch(console.error)}),[C.to,O]);let{tokenPrice:W,isTokenPriceLoading:B}=Hc(C),H=i.useMemo((()=>d.getJsonRpcProvider(Number(C.chainId),c,s,{appId:f.id})),[C.chainId,s]),G=xf(C,M,H);i.useEffect((()=>{t.sendTransaction?.getIsSponsored?t.sendTransaction.getIsSponsored().then(j).catch(console.error):j(!1)}),[t.sendTransaction.getIsSponsored]);let q=()=>{if(!$)return P?t?.sendTransaction?.onSuccess(P.response):k||G?.errors[0]?t?.sendTransaction?.onFailure(k??G?.errors[0]??Cf):t?.sendTransaction?.onFailure(new m.PrivyProviderRpcError(new m.ProviderRpcError("The user rejected the request",m.E.E4001_USER_REJECTED_REQUEST.eipCode))),u({shouldCallAuthOnSuccess:!1})};r.current=q;let z=!!(f.fundingConfig&&f.fundingConfig.methods.length>0&&t.funding),V="fiat-currency"===f.embeddedWallets.priceDisplay.primary,K=d.i(G?.tx.value??0).add(d.i(G?.totalGasEstimate?.toBigInt()??0)).toHexString(),Y=d.getNativeCurrencyFromWei(K,R),Z=V&&W?d.getDollarsFromWei(K,W):void 0,X=d.getNativeCurrencyFromWei(G?.totalGasEstimate?.toString()??0,R),J=V&&W?d.getDollarsFromWei(G?.totalGasEstimate?.toString()??0,W):void 0,Q=d.getNativeCurrencyFromWei(G?.balance?.toString()??0,R,void 0,!0),ee=V&&W?d.getDollarsFromWei(G?.balance?.toString()??0,W):void 0,te=t.sendTransaction?.uiOptions?.transactionInfo?.title||("approve"===F?"Confirm address":`Approve ${F}`),re=t.sendTransaction?.uiOptions?.description||`${f.name} wants your permission to approve the following transaction.`,ne=t.sendTransaction?.uiOptions?.transactionInfo?.contractInfo?.imgUrl?e.jsx("img",{src:t.sendTransaction.uiOptions.transactionInfo.contractInfo.imgUrl,alt:t.sendTransaction.uiOptions.transactionInfo.contractInfo.imgAltText}):null,ie=!(!G||G.errors[0]||G.hasFunds||!1!==A),ae=ie&&z,oe=ae?"Add funds":t.sendTransaction?.uiOptions?.buttonText||(v<x?"Continue":"Approve");if(P?.receipt)return e.jsx(mf,{txn:G?.tx??C,onClose:q,receipt:P.receipt,transactionInfo:t.sendTransaction?.uiOptions.transactionInfo,tokenPrice:W,tokenSymbol:R,l1GasEstimate:G?.l1ExecutionFeeEstimate?.toString(),receiptHeader:t.sendTransaction?.uiOptions.successHeader,receiptDescription:t.sendTransaction?.uiOptions.successDescription});if(k)return e.jsx(Nm,{transactionError:k,network:"ethereum",chainId:G?.tx.chainId??C.chainId,onClose:q,onRetry:({resetNonce:e})=>{N(null);let t={...G?.tx??C};e&&(t.nonce=void 0),E(t)}});let se=0!==x&&"number"==typeof v&&0!==v?()=>{w(v-1)}:void 0;return e.jsx(bm,{transactionIndex:v,onBack:se,maxIndex:x,disabled:ie&&!z,isSubmitting:$,submitError:k,isPreparing:!G,isTokenPriceLoading:B,isTokenContractInfoLoading:!b,prepareError:G?.errors[0],symbol:b?.symbol,chain:O,img:ne,title:te,subtitle:re,spender:U,total:C.value?Z??Y:void 0,txValue:C.value,fee:J??X,isSponsored:A,to:C.to,network:f.chains.find((e=>e.id===C.chainId))?.name??"",from:M?.address??"",cta:oe,missingFunds:ie,action:F,balance:ee??Q,amount:L&&b?qc({amount:L,decimals:b.decimals}):L,onClose:q,onClick:ae?async()=>{if(!M)return;if(!z)throw Error("Funding wallet is not enabled");let e=pf({fundingMethods:f.fundingConfig.methods});n({...t,funding:{...t.funding,methodScreen:e}}),a(e)}:async()=>{if(v<x)w(v+1);else{T(!0);try{let e=await p();if($||!e||!M||!h||!y)return;let r=t?.sendTransaction?.onConfirm?await t.sendTransaction.onConfirm().then((e=>H.getTransaction(e))):await nf({accessToken:e,transactingWallet:M,rootWallet:I,walletProxy:h,transactionRequest:G?.tx??C,provider:H,requesterAppId:t.sendTransaction?.requesterAppId}),n=await r.wait();_({receipt:of(n),response:r})}catch(e){console.warn({transaction:G?.tx??C,error:e}),N(e)}finally{T(!1)}}}})},[g.ModalScreen.EMBEDDED_WALLET_SEND_SOLANA_TRANSACTION_SCREEN]:()=>{let{data:t,onUserCloseViaDialogOrKeybindRef:r}=g.usePrivyModal(),{closePrivyModal:n,walletProxy:a}=o.usePrivyInternal(),s=l.useAppConfig(),{user:d}=o.usePrivy(),[c,u]=i.useState(t?.sendSolanaTransaction?.transactionRequest),[h,p]=i.useState(),[y,m]=i.useState(),[f,v]=i.useState(0),[w,x]=i.useState(!1),[C,E]=i.useState(),[b,S]=i.useState(null),A=t?.sendSolanaTransaction?.connection,j=t?.sendSolanaTransaction?.transactingWallet,$=h?.instructions.at(f),T=h?.instructions.length??1;if(i.useEffect((()=>{!async function(){if(c&&A)try{m(void 0);let e=await vy(c,A);p(e),v(0)}catch(e){console.warn("Failed to prepare transaction",e),m(e)}}()}),[c,A]),!(c&&t?.sendSolanaTransaction&&j&&A)){let r=Error("Invalid transaction request");return e.jsx(pc,{error:r,onClick:()=>{t?.sendSolanaTransaction?.onFailure(r),n({shouldCallAuthOnSuccess:!1})}})}let{solPrice:P,isSolPriceLoading:_}=(()=>{let{showFiatPrices:e,getUsdPriceForSol:t}=o.usePrivyInternal(),[r,n]=i.useState(!0),[a,s]=i.useState(void 0),[l,d]=i.useState(void 0);return i.useEffect((()=>{(async()=>{if(e)try{n(!0);let e=await t();e?d(e):s(Error("Unable to fetch SOL price"))}catch(e){s(e)}finally{n(!1)}else n(!1)})()}),[]),{solPrice:l,isSolPriceLoading:r,solPriceError:a}})(),k=()=>{if(!w)return C?t?.sendSolanaTransaction?.onSuccess(C):(t?.sendSolanaTransaction?.onFailure(b??y??Error("User exited the modal before submitting the transaction")),v(0)),n({shouldCallAuthOnSuccess:!1})};r.current=k;let N="fiat-currency"===s.embeddedWallets.priceDisplay.primary,I=t.sendTransaction?.uiOptions?.transactionInfo?.title||("approve"===$?.action?"Confirm address":"Approve transaction"),M=t.sendTransaction?.uiOptions?.description||`${s.name} wants your permission to approve the following transaction.`,O=t.sendTransaction?.uiOptions?.transactionInfo?.contractInfo?.imgUrl?e.jsx("img",{src:t.sendTransaction.uiOptions.transactionInfo.contractInfo.imgUrl,alt:t.sendTransaction.uiOptions.transactionInfo.contractInfo.imgAltText}):null,R=$?.amount||0n,F=0===f&&h?.fees||0n,L=$?.balance||0n,U=$?.from,D=$?.to,W=R+F,B=uy(W),H=N&&P?hy(W,P):void 0,G=F?uy(F):void 0,q=N&&P?hy(F,P):void 0,z=L?uy(L):void 0,V=N&&P?hy(L,P):void 0,K=t.sendTransaction?.uiOptions?.buttonText||"Approve";return C?e.jsx(tf,{instructions:h?.instructions.map((({from:e,to:t,amount:r})=>({from:e.toBase58(),to:t.toBase58(),amount:r})))??[],fees:0===f?C.fees:0n,onClose:k,transactionInfo:t.sendTransaction?.uiOptions.transactionInfo,solPrice:P,receiptHeader:t.sendTransaction?.uiOptions.successHeader,receiptDescription:t.sendTransaction?.uiOptions.successDescription,rpcEndpoint:A.rpcEndpoint}):b?e.jsx(Nm,{transactionError:b,connection:A,onClose:k,network:"solana",onRetry:async()=>{S(null);let{blockhash:e}=await A.getLatestBlockhash();$e.isVersionedTransaction(c)?c.message.recentBlockhash=e:c.recentBlockhash=e,u(c)}}):e.jsx(bm,{isSubmitting:w,submitError:b,isPreparing:!h,isTokenPriceLoading:_,isTokenContractInfoLoading:!1,symbol:"SOL",chain:void 0,img:O,title:I,subtitle:M,from:U?.toBase58()||"",to:D?.toBase58(),fee:q??G,total:null!=R?H??B:void 0,txValue:R,spender:$?.spender?.toBase58(),network:"Solana",cta:K,missingFunds:!y&&!$?.hasFunds,action:$?.action,balance:V??z,prepareError:y,chainName:"Solana",onClose:k,onClick:async()=>{if(f<(h?.instructions.length??1)-1)v(f+1);else try{x(!0);let e=await Sg();if(w||!e||!j||!a||!d)return;let{signature:r,receipt:n}=await Cm({tx:c,accessToken:e,connection:A,walletProxy:a,transactingWalletAddress:j.address,transactionOptions:t.sendSolanaTransaction?.transactionOptions});E(gy(r,n))}catch(e){console.warn({transaction:c,error:e}),S(e)}finally{x(!1)}},isSponsored:!1,transactionIndex:f,maxIndex:T-1,disabled:!$?.hasFunds,onBack:f>0&&T>1?()=>v(f-1):void 0})},[g.ModalScreen.EMBEDDED_WALLET_DELEGATED_ACTIONS_CONSENT_SCREEN]:()=>{let{app:t,data:r}=g.usePrivyModal(),{closePrivyModal:n}=o.usePrivyInternal(),[a,s]=i.useState(!1),[c,u]=i.useState(),h=async()=>{a?r?.delegatedActions?.onSuccess():r?.delegatedActions?.onError(c??new o.PrivyClientError("User declined delegating actions.")),n({shouldCallAuthOnSuccess:!1})};return i.useEffect((()=>{if(!a&&!c)return;let e=setTimeout(h,l.DEFAULT_SUCCESS_SCREEN_LONG_DURATION_MS);return()=>clearTimeout(e)}),[a,c]),a||c?e.jsxs(e.Fragment,{children:[e.jsx(Wo,{onClose:h}),e.jsx(Xs,{}),e.jsxs(qs,{children:[c?e.jsx(T.ExclamationCircleIcon,{stroke:"var(--privy-color-error)",width:"64px",height:"64px"}):e.jsx(T.CheckCircleIcon,{stroke:"var(--privy-color-success)",width:"64px",height:"64px"}),e.jsx(el,{height:20}),e.jsx(il,{title:c?"Something went wrong":"Success!",description:c?"Please try again.":"You've successfully delegated actions."})]}),e.jsx(Js,{}),e.jsx(d.BlobbyFooter,{})]}):e.jsxs(e.Fragment,{children:[e.jsx(Wo,{closeable:!0,onClose:h}),e.jsx(Gl,{width:56,height:56,style:{margin:"auto"}}),e.jsx(Cs,{style:{marginTop:24},children:"Enable delegated actions"}),e.jsxs(Es,{children:["Give ",t.name," permissions to transact on your behalf. You can revoke this later."," ",e.jsx("a",{style:{color:"var(--privy-color-accent-dark)"},href:"https://www.privy.io/using-privy",target:"_blank",children:"Learn more"})]}),e.jsx(zl,{showIcon:!0,address:r?.delegatedActions?.address??"",title:"Wallet",isLoading:!1}),e.jsxs(ql,{style:{marginTop:24},children:[e.jsx(ko,{onClick:h,children:"No thanks"}),e.jsx(jo,{onClick:async()=>{try{await(r?.delegatedActions?.onDelegate()),s(!0)}catch(e){u(e)}},children:"Accept"})]}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.FUNDING_METHOD_SELECTION_SCREEN]:()=>{let{wallets:r}=l.useWallets(),{navigate:n,data:a,setModalData:o}=g.usePrivyModal(),s=l.useAppConfig(),c=a?.funding,u=i.useRef(null),[h,p]=i.useState(!1);i.useEffect((()=>{u.current&&u.current.style.setProperty("--funding-input-length",Math.max(c.amount.length,1).toString())}),[c.amount,u.current]);let y=s.fundingConfig?.methods.slice()??[],{tokenPrice:m}=Hc({chainId:c.chain.id});i.useEffect((()=>{c.erc20Address&&c.chain&&!c.erc20ContractInfo&&dh({address:c.erc20Address,chain:c.chain,rpcConfig:s.rpcConfig,privyAppId:s.id}).then((e=>o({...a,funding:{...a.funding,erc20ContractInfo:e?{symbol:e.symbol,decimals:e.decimals}:void 0}}))).catch(console.error)}),[c.erc20Address,c.chain]);let f=m?d.getDollarsFromStringFloat(c.amount,m):void 0,v=r.find((e=>t.getAddress(e.address)===t.getAddress(c.address))),w=v&&"privy"!==v.walletClientType?Sl(v.walletClientType,v.connectorType,v.walletClientType):s.name,x=parseFloat(c.amount),C=!isNaN(x)&&x>0,E=!(!c.erc20Address||c.erc20ContractInfo),b=c.isUSDC?"USDC":c.erc20Address?void 0:"native-currency",S=b&&((e,t)=>{switch(t){case"native-currency":return hh.has(e);case"USDC":return ph.has(e);default:return console.warn("Unknown asset passed to MoonPay Onramp"),!1}})(Number(c.chain.id),b),A=b&&((e,t)=>{switch(t){case"native-currency":return Qu.has(e);case"USDC":return eh.has(e);default:return console.warn("Unknown asset passed to Coinbase Onramp"),!1}})(Number(c.chain.id),b),j=c.erc20Address||!c.erc20Address&&!c.isUSDC;return e.jsxs(e.Fragment,{children:[e.jsx(Fc,{}),e.jsxs("h3",{children:["Add funds to your"," ",w?.toLowerCase().endsWith("wallet")?w:w+" wallet"]}),e.jsx(Ks,{style:{marginTop:"32px"},children:e.jsx(Mu,{children:E?e.jsx(Lc,{size:"50px"}):e.jsxs(e.Fragment,{children:[e.jsxs(Ou,{onClick:()=>u.current?.focus(),children:[e.jsx(Fu,{ref:u,value:c.amount,onFocus:()=>p(!0),onBlur:()=>p(!1),onChange:e=>{let t=e.target.value;/^[0-9.]*$/.test(t)&&t.split(".").length-1<=1&&o({...a,funding:{...c,amount:t}})}}),e.jsx(Uu,{children:c.erc20Address?c.erc20ContractInfo?.symbol:c.chain.nativeCurrency.symbol}),!h&&e.jsx(Lu,{children:e.jsx(ft.default,{width:12,height:12})})]}),!c.erc20Address&&e.jsx(Du,{children:f&&C?f:""})]})})}),e.jsxs(Nu,{children:[c.errorMessage&&e.jsx(sh,{children:c.errorMessage}),y.sort().map((t=>{switch(t){case"moonpay":return S?e.jsxs(ts,{disabled:!C||E,onClick:()=>{n(g.ModalScreen.MOONPAY_PROMPT_SCREEN)},children:[e.jsx(Iu,{children:e.jsx(wh,{style:{width:24}})}),"Moonpay"]},t):null;case"coinbase-onramp":return A?e.jsxs(ts,{disabled:!C||E,onClick:()=>{n(g.ModalScreen.COINBASE_ONRAMP_STATUS_SCREEN)},children:[e.jsx(Iu,{children:e.jsx($a,{style:{width:24}})}),"Coinbase Onramp"]},t):null;case"external":return j?e.jsxs(ts,{disabled:!C||E,onClick:()=>{n(g.ModalScreen.FUNDING_TRANSFER_FROM_WALLET_SCREEN)},children:[e.jsx(Iu,{children:e.jsx(Ge.default,{style:{width:24}})}),"Transfer from wallet"]},t):null}})),e.jsx(Bu,{disabled:!C,onClick:()=>n(g.ModalScreen.FUNDING_MANUAL_TRANSFER_SCREEN),children:"Send funds manually"})]}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.MOONPAY_PROMPT_SCREEN]:()=>{let{app:t,data:r,navigate:n,setModalData:a}=g.usePrivyModal(),{createAnalyticsEvent:s,getMoonpaySignedUrl:l}=o.usePrivyInternal(),[c,u]=i.useState(null),h=r?.funding,p=h.isUSDC?"USDC":"native-currency";return i.useEffect((()=>{!c&&h&&async function(){if(!t.fundingConfig)return;let{signedUrl:e,externalTransactionId:n}=await l(h.address,{...t.fundingMethodConfig.moonpay,...h.moonpayConfigOverride,currencyCode:h.moonpayConfigOverride?.currencyCode??yh(h.chain.id,p),quoteCurrencyAmount:h.moonpayConfigOverride?.quoteCurrencyAmount??mh(h.amount)});u(e),a({moonpayStatus:{externalTransactionId:n},funding:r?.funding})}()}),[c,h]),e.jsxs(e.Fragment,{children:[e.jsx(Fc,{}),e.jsx(Ph,{app:t,signedUrl:c,onContinue:()=>{s({eventName:"sdk_fiat_on_ramp_started",payload:{provider:uh}}),n(g.ModalScreen.MOONPAY_STATUS_SCREEN)}}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.MOONPAY_STATUS_SCREEN]:()=>{let{app:t,data:r}=g.usePrivyModal(),{closePrivyModal:n}=o.usePrivyInternal(),{externalTransactionId:i}=r?.moonpayStatus,a=vh(i||null,t.fundingMethodConfig.moonpay.useSandbox??!1);return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{title:"Fund account"},"header"),e.jsx(Dh,{status:a,onClickCta:n}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.COINBASE_ONRAMP_STATUS_SCREEN]:()=>{let{data:t,setModalData:r,navigate:n}=g.usePrivyModal(),{closePrivyModal:a,createAnalyticsEvent:s,initCoinbaseOnRamp:l,getCoinbaseOnRampStatus:c}=o.usePrivyInternal(),u=t?.funding,h=u.isUSDC?"USDC":"ETH",[p,y]=i.useState(!1),[m,f]=i.useState(!1);return i.useEffect((()=>{if(p)return;y(!0);let e=async()=>{try{s({eventName:"sdk_fiat_on_ramp_started",payload:{provider:"coinbase-onramp",value:u.amount,chainId:u.chain.id}});let e=window.open(void 0,void 0,Ju({w:440,h:680})),t=function(e){let t=th[e];if(!t)throw new o.PrivyClientError(`Unsupported chainId: ${e} for Coinbase Onramp`);return t}(u.chain.id),r=await l({addresses:[{address:u.address,blockchains:[t]}],assets:[h]}),{url:n}=(({input:e,amount:t,blockchain:r})=>{let n=new URL("https://pay.coinbase.com/buy/select-asset");return n.searchParams.set("appId",e.app_id),n.searchParams.set("sessionToken",e.session_token),n.searchParams.set("defaultExperience","buy"),n.searchParams.set("presetCryptoAmount",t.startsWith(".")?`0${t}`:t),n.searchParams.set("defaultNetwork",r),n.searchParams.set("partnerUserId",e.partner_user_id),{url:n}})({input:r,amount:u.amount,blockchain:t});if(!e)throw Error("Unable to initiate Coinbase Onramp flow.");e.location=n.toString();let i=0,a=!1;for(;i<rh;){i++;let{status:t}=await c({partnerUserId:r.partner_user_id});if("success"===t){a=!0;break}if("failure"===t)throw Error("There was an error completing Coinbase Onramp flow.");if(e.closed)throw Error("User exited Coinbase Onramp flow before transaction response.");await new Promise((e=>setTimeout(e,1500)))}if(!a)throw Error("Timed out waiting for transaction response from Coinbase Onramp.");f(!0)}catch(e){console.error(e),s({eventName:zc,payload:{status:"failure",provider:"coinbase-onramp",error:e.message}}),r({funding:{...u,errorMessage:"Something went wrong adding funds from Coinbase Onramp. Please try again or use another method to fund your wallet."}}),n(g.ModalScreen.FUNDING_METHOD_SELECTION_SCREEN)}finally{y(!1)}},t=setTimeout((()=>{e()}),500);return()=>clearTimeout(t)}),[]),e.jsxs(e.Fragment,{children:[e.jsx(Wo,{title:"Fund account"},"header"),e.jsx(nh,{isSucccess:m,onClickCta:a}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.FUNDING_TRANSFER_FROM_WALLET_SCREEN]:()=>{let{connectors:t}=o.usePrivyInternal(),{app:r,setModalData:n,data:a,navigate:s}=g.usePrivyModal(),[l,c]=i.useState("default"),u=Rl(r.appearance.walletList,"ethereum-only",t,!0,r.appearance.walletList,r.externalWallets.walletConnect.enabled),h=e.jsx(Vh,{text:"More wallets",onClick:()=>c("overflow")});return i.useEffect((()=>{n({...a,externalConnectWallet:{onCompleteNavigateTo:g.ModalScreen.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN}})}),[]),"overflow"===l?e.jsxs(e.Fragment,{children:[e.jsx(Wo,{backFn:()=>c("default")},"header"),e.jsxs(Xo,{children:[e.jsx(md,{style:{color:"var(--privy-color-foreground-3)",textAlign:"left"},children:"More wallets"}),u]}),e.jsx(d.BlobbyFooter,{})]}):e.jsxs(e.Fragment,{children:[e.jsx(Fc,{}),e.jsx(il,{title:"Transfer from wallet",description:"Connect a wallet to deposit funds or send funds manually to your wallet address."}),e.jsxs(Xo,{children:[...u.length>3?u.slice(0,2):u,u.length>3&&h,e.jsx(zh,{onClick:()=>s(g.ModalScreen.FUNDING_MANUAL_TRANSFER_SCREEN),children:"Send funds manually"})]}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN]:()=>{let{rpcConfig:t,appId:r,closePrivyModal:n,createAnalyticsEvent:a}=o.usePrivyInternal(),{navigate:s,setModalData:c,app:u,data:h}=g.usePrivyModal(),{wallets:p}=l.useWallets(),[y,m]=i.useState(!1),[f,v]=i.useState(0n),[w,x]=i.useState(!1),[C,E]=i.useState(null),[b,S]=i.useState(null),[A,j]=i.useState([]),[$,T]=i.useState(0),[P,_]=i.useState(!1),[k,N]=i.useState(!1),[I,M]=i.useState(!1),[O,R]=i.useState(!1),{erc20ContractInfo:F,erc20Address:L,address:U,chain:D,amount:W}=h.funding;i.useEffect((()=>{L&&!F&&E(Error("Unable to fetch token details"))}),[]);let B=!!L&&!!F,H=B?BigInt(parseFloat(W)*10**F.decimals):Z.parseEther(W),G=p[0],[q,z]=i.useState(null);i.useEffect((()=>{(async()=>{if(!G)return;let e=await G.getEthereumProvider();z(Z.createWalletClient({account:G.address,transport:Z.custom(e)}).extend(Z.publicActions))})().catch(console.error)}),[G]);let[V,K]=i.useState(0n);i.useEffect((()=>{Z.createPublicClient({chain:D,transport:Z.http(d.getJsonRpcEndpointFromChain(D,t,r))}).getBalance({address:U}).then(K).catch(console.error)}),[]);let[Y,X]=i.useState(0n);i.useEffect((()=>{B&&(async({chain:e,address:t,appId:r,rpcConfig:n,erc20Address:i})=>{let a=Z.createPublicClient({chain:e,transport:Z.http(d.getJsonRpcEndpointFromChain(e,n,r))});return{balance:await a.readContract({address:i,abi:Xc,functionName:"balanceOf",args:[t]}).catch((()=>0n)),chain:e}})({chain:D,address:U,appId:r,rpcConfig:t,erc20Address:L}).then((e=>X(e.balance))).catch(console.error)}),[]);let{tokenPrice:J}=Hc({chainId:D.id}),[Q,ee]=i.useState({to:U,chain:D,value:H,data:void 0});i.useEffect((()=>{(async()=>{let e,n;if(!q||!G||P||I)return;_(!0);let i=Z.createPublicClient({chain:Q.chain,transport:Z.http(d.getJsonRpcEndpointFromChain(Q.chain,t,r))});if(B&&!Q.data)return await i.simulateContract({address:L,chain:Q.chain,abi:Gc,functionName:"transfer",args:[U,H],account:G.address}).catch((e=>{console.warn("Simulated token transfer failed with error, fetching bridge options.",e)}))?(_(!1),void ee({to:L,chain:Q.chain,data:Z.encodeFunctionData({abi:Gc,functionName:"transfer",args:[U,H]}),value:"0x0"})):(_(!1),void x(!0));try{e=await i.prepareTransactionRequest({account:G.address,to:Q.to,chain:Q.chain,data:Q.data,value:BigInt(Q.value??0)})}catch(e){console.error(e),A.length>1&&S(e.shortMessage??"Something went wrong")}if(!e)return _(!1),void x(!0);_(!1),M(!0),m(!0),v(e.gas);try{await q.switchChain({id:Q.chain.id})}catch(e){await q.addChain({chain:Q.chain}),await q.switchChain({id:Q.chain.id})}try{n=await q.sendTransaction(e),a({eventName:zc,payload:{provider:"external",status:"success",address:G.address,chainId:Q.chain.id,value:Q.value?.toString(),txHash:n}})}catch(e){console.error(e),"TransactionExecutionError"===e.name&&(A.length<1?E(new o.PrivyClientError(e.shortMessage,void 0,o.PrivyErrorCode.TRANSACTION_FAILURE)):S(e.shortMessage??"Something went wrong"))}n?(await q.waitForTransactionReceipt({hash:n}),M(!1),R(!0)):M(!1)})().catch(console.error)}),[q,Q]),i.useEffect((()=>{(async()=>{if(!w||!q||!G)return;let e=l.addToDefaultChains(u.chains).filter((e=>e.id!==h.funding.chain.id&&!!e.testnet==!!h.funding.chain.testnet));B&&e.unshift(h.funding.chain);let n=await(({chains:e,appId:t,address:r,rpcConfig:n})=>Promise.all(e.map((async e=>{let i=Z.createPublicClient({chain:e,transport:Z.http(d.getJsonRpcEndpointFromChain(e,n,t))});return{balance:await i.getBalance({address:r}).catch((()=>0n)),chain:e}}))))({chains:e,address:G.address,appId:r,rpcConfig:t}),i=B?n.filter((e=>e.balance>0n)):n.filter((e=>e.balance>H));if(i.length<1)return void E(new o.PrivyClientError(`Wallet ${d.formatWalletAddress(G.address)} does not have enough funds.`,void 0,o.PrivyErrorCode.INSUFFICIENT_BALANCE));i.sort(((e,t)=>Number(t.balance-e.balance)));let a=(await Promise.allSettled(i.map((async e=>({quote:await Yc({isTestnet:!!h.funding?.chain.testnet,input:Kc({amount:H.toString(),user:G.address,recipient:U,destinationChainId:D.id,destinationCurrency:L,originChainId:e.chain.id})}),...e}))))).filter((e=>"fulfilled"===e.status)).map((e=>e.value));if(a.length<1)return void E(new o.PrivyClientError(`Wallet ${d.formatWalletAddress(G.address)} does not have enough funds.`,void 0,o.PrivyErrorCode.INSUFFICIENT_BALANCE));let s=a.map((e=>({bridgeTx:Zc(e.quote),balance:e.balance,chain:e.chain}))).filter((e=>!!e.bridgeTx));if(s.length>1)return void j(s);let c=s[0];c?(N(!0),ee({data:c.bridgeTx.data,to:c.bridgeTx.to,value:c.bridgeTx.value,chain:c.chain})):E(new o.PrivyClientError(`Wallet ${d.formatWalletAddress(G.address)} does not have enough funds.`,void 0,o.PrivyErrorCode.INSUFFICIENT_BALANCE))})().catch(console.error)}),[w]),i.useEffect((()=>{if(!C)return;let e={error:C,previousScreen:g.ModalScreen.FUNDING_TRANSFER_FROM_WALLET_SCREEN};c({funding:h?.funding,sendTransaction:h?.sendTransaction,errorModalData:e}),s(g.ModalScreen.ERROR_SCREEN,!1)}),[C]);let te=G?Sl(G.walletClientType,G.connectorType,G.walletClientType)||"wallet":null,re=!B&&J?d.getDollarsFromStringFloat(h?.funding?.amount??"0",J):void 0,ne=B?f:d.sumWeiQuantitiesToHexString([f,H]),ie=ne&&J?d.getDollarsFromWei(ne,J):void 0,ae=ne?d.getNativeCurrencyFromWei(ne,"ETH"):void 0,oe=f&&J?d.getDollarsFromWei(f,J):void 0,se=f?d.getNativeCurrencyFromWei(f,"ETH"):void 0;if(i.useEffect((()=>{if(!O)return;let e=setTimeout(n,l.DEFAULT_SUCCESS_SCREEN_EXTRA_LONG_DURATION_MS);return()=>clearTimeout(e)}),[O]),O)return e.jsxs(e.Fragment,{children:[e.jsx(Fc,{}),e.jsx(Xs,{}),e.jsxs(Vs,{children:[e.jsx(ct.default,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),e.jsx(il,{title:"Success!",description:`You’ve successfully added ${W} ${B?F.symbol:D.nativeCurrency.symbol} to your ${u.name} wallet. It may take a minute before the funds are available to use.`})]}),e.jsx(Js,{}),e.jsx(d.BlobbyFooter,{})]});let le=B?`${qc({amount:Y,decimals:F.decimals})} ${F.symbol}`:d.getNativeCurrencyFromWei(V,D.nativeCurrency.symbol,3,!0),de=A[$];return A.length>1&&de?e.jsx(qu,{displayName:te,configuredFundingChain:D,formattedBalance:le,fundingAmount:W,fundingCurrency:B?F.symbol:D.nativeCurrency.symbol,fundingAmountInUsd:re,options:A,selectedOption:de,isPreparing:P,isSubmitting:I,errorMessage:b,onSubmit:()=>{ee({to:de.bridgeTx.to,data:de.bridgeTx.data,value:de.bridgeTx.value,chain:de.chain})},onSelect:e=>{e!==$&&(S(null),T(e))}}):y&&f&&G&&h?.funding?e.jsx(zu,{wallet:G,displayName:te,addressToFund:U,isBridging:k,isErc20Flow:B,totalPriceInUsd:ie,totalPriceInNativeCurrency:ae,gasPriceInUsd:oe,gasPriceInNativeCurrency:se,chain:h.funding.chain}):e.jsxs(e.Fragment,{children:[e.jsx(Fc,{}),e.jsx(Lc,{}),e.jsx("div",{style:{marginTop:"1rem"}}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.FUNDING_MANUAL_TRANSFER_SCREEN]:()=>{let{wallets:t}=l.useWallets(),{app:r,data:n,setModalData:a,navigate:s,lastScreen:c}=g.usePrivyModal(),{chains:u,rpcConfig:h,appId:p,closePrivyModal:y,createAnalyticsEvent:m}=o.usePrivyInternal(),[f,v]=i.useState("default"),[w,x]=i.useState(void 0),C=n?.funding,{tokenPrice:E}=Hc({chainId:C.chain.id}),b=E?d.getDollarsFromStringFloat(C.amount,E):void 0,S=t.find((e=>d.formatWalletAddress(e.address)===d.formatWalletAddress(C.address))),A=S&&"privy"!==S.walletClientType?Sl(S.walletClientType,S.connectorType,S.walletClientType):r.name;if(!C)return a({errorModalData:{error:Error("Couldn't find funding config"),previousScreen:c||g.ModalScreen.FUNDING_METHOD_SELECTION_SCREEN},funding:n?.funding,sendTransaction:n?.sendTransaction}),s(g.ModalScreen.ERROR_SCREEN),e.jsx(e.Fragment,{});i.useEffect((()=>{let e=d.getJsonRpcProvider(C.chain.id,u,h,{appId:p});function t(){e.getBalance(C.address).then((e=>{let t=parseFloat(ie.formatUnits(e,"ether"));x((e=>(e&&t>e&&m({eventName:zc,payload:{provider:"manual",status:"success",address:S?.address,value:(t-e).toString()}}),t)))})).catch((()=>x(void 0)))}let r=setInterval(t,2e3);return t(),()=>clearInterval(r)}),[]);let j=i.useMemo((()=>void 0!==w&&w>=parseFloat(C.amount)),[w,C.amount]),$=e.jsxs(e.Fragment,{children:[e.jsx(d.WalletInfoCard,{title:"Your wallet",errMsg:void 0,isLoading:!C||void 0===w,isPulsing:!j,balance:`${void 0!==w?w.toPrecision(2):""} ETH`,address:C.address,statusColor:j?"green":"gray"}),j&&e.jsx(Gu,{onClick:()=>y(),children:"Close"})]});return"qr-code"===f?e.jsxs(e.Fragment,{children:[e.jsx(Wo,{backFn:()=>v("default")}),e.jsxs(Ks,{style:{gap:"24px",marginBottom:"24px"},children:[e.jsxs("div",{children:[e.jsx(Cs,{children:"Scan QR code"}),e.jsxs(Es,{children:["Scan this code using your mobile wallet to send funds to your ",A," ","wallet."]})]}),e.jsx(Pc,{url:C.address,size:200,squareLogoElement:xh}),$]}),e.jsx(d.BlobbyFooter,{})]}):e.jsxs(e.Fragment,{children:[e.jsx(Fc,{}),e.jsx(il,{title:"Send funds",description:"Send funds directly to your wallet by copying your wallet address or scanning a QR code."}),e.jsxs(Ks,{style:{gap:"16px"},children:[e.jsxs(bh,{children:[e.jsx(gt.default,{height:"20px",width:"20px",color:"var(--privy-color-accent-light)"}),e.jsxs(Sh,{children:["Make sure to send on ",C.chain.name,"."]})]}),e.jsxs(Ah,{children:[e.jsx(el,{height:16}),e.jsxs(Mu,{children:[e.jsxs(Ou,{children:[e.jsx(Ru,{children:C.amount}),e.jsx(Uu,{children:C.chain.nativeCurrency.symbol})]}),e.jsx(Du,{children:b?`${b} USD`:"..."}),e.jsxs(Wu,{children:[e.jsx(nu,{chainId:C.chain.id,height:16,width:16})," ",C.chain.name]})]}),e.jsx(el,{height:8}),e.jsxs(Eh,{children:[e.jsx(Ch,{text:C.address}),e.jsx($h,{onClick:()=>v("qr-code"),children:e.jsxs(jh,{children:[e.jsx(vt.default,{height:"16px",width:"16px"}),"Scan code"]})})]})]}),$]}),e.jsx(el,{height:16}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN]:()=>{let{closePrivyModal:t}=o.usePrivyInternal(),{data:r,setModalData:n,navigate:i,onUserCloseViaDialogOrKeybindRef:a}=g.usePrivyModal(),{onSuccess:s,onFailure:l}=r.setWalletPassword,c=()=>{l(new o.PrivyEmbeddedWalletError("Exited before password was added to wallet")),t({shouldCallAuthOnSuccess:!1})};return a.current=c,e.jsxs(e.Fragment,{children:[e.jsx(Wo,{onClose:c}),e.jsx(Xs,{}),e.jsxs(Vs,{children:[e.jsxs(Qs,{children:[e.jsx(st.default,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),e.jsx(tl,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:e.jsx(lt.default,{width:"12px",height:"12px",fill:"white"})})]}),e.jsxs(il,{title:"Secure Your Account",children:["Please set a password to secure your account.",e.jsx("p",{children:"Losing access to this password and this device will make your account inaccessible."})]})]}),e.jsx(jo,{onClick:()=>{n({createWallet:{onFailure:l,onSuccess:s,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),i(g.ModalScreen.EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN)},children:"Add password"}),e.jsx(Js,{}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN]:()=>{let[t,r]=i.useState(null),[n,a]=i.useState(!1),[s,l]=i.useState(null),[d,c]=i.useState(""),{authenticated:h,getAccessToken:p,user:y}=o.usePrivy(),{walletProxy:m,refreshUser:f,closePrivyModal:v,createAnalyticsEvent:w}=o.usePrivyInternal(),{app:x,navigate:C,data:E,onUserCloseViaDialogOrKeybindRef:b}=g.usePrivyModal(),{onSuccess:S,onFailure:A}=E.createWallet,j=u.getPrivyEthereumWallet(y),$="user-passcode"===t?.recoveryMethod,T="user-passcode"===j?.recoveryMethod;i.useEffect((()=>{h||(C(g.ModalScreen.LANDING),A(new o.PrivyUnauthenticatedError("User must be authenticated before setting a password on a Privy wallet")))}),[h]);let P=()=>s?(A(s),void v({shouldCallAuthOnSuccess:!1})):$?(S(t),void v({shouldCallAuthOnSuccess:!1})):(A(new o.PrivyEmbeddedWalletError("Exited before password was added to wallet")),void v({shouldCallAuthOnSuccess:!1}));b.current=P;return e.jsx(hc,{appName:x?.name||"privy",config:{initiatedBy:"user",onCancel:P},error:s?"An error has occurred, please try again.":void 0,buttonLoading:n,buttonHideAnimations:!1,password:d,isResettingPassword:T,onPasswordGenerate:()=>c(rc()),onPasswordChange:c,onSubmit:async()=>{$?(S(t),v({shouldCallAuthOnSuccess:!1})):(a(!0),l(null),await(async()=>{let e=await p();if(e&&j?.address&&d&&m)try{if(w({eventName:"embedded_wallet_set_recovery_started",payload:{walletAddress:j.address,existingRecoveryMethod:j.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:T}}),!(await m.setRecovery({accessToken:e,address:j.address,recoveryPassword:d,recoveryMethod:"user-passcode"})).address)return l(new o.PrivyEmbeddedWalletError("Error setting password on privy wallet")),void w({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:j.address,existingRecoveryMethod:j.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:T,reason:"error setting password"}});let t=await f(),n=u.getPrivyEthereumWallet(t);if(!n)return l(new o.PrivyEmbeddedWalletError("Error setting password on privy wallet")),void w({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:j.address,existingRecoveryMethod:j.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:T,reason:"wallet disconnected"}});r(n),w({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:j.address,existingRecoveryMethod:j.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:T}})}catch(e){console.warn(e),l(e instanceof Error?e:Error("Error setting password on privy wallet")),w({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:j.address,reason:e}})}})(),a(!1))},onClose:P})},[g.ModalScreen.EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN]:()=>{let{app:t,navigate:r,data:n,onUserCloseViaDialogOrKeybindRef:a}=g.usePrivyModal(),[s,l]=i.useState(""),[d,c]=i.useState(!1),[u,h]=i.useState(),[p,y]=i.useState(null),{authenticated:m,user:f}=o.usePrivy(),{closePrivyModal:v,isNewUserThisSession:w,initializeWalletProxy:x}=o.usePrivyInternal(),{onSuccess:C,onFailure:E,callAuthOnSuccessOnClose:b}=n.createWallet,{createWallet:S}=Cd(),[A,j]=i.useState(null),$=new Gi((async()=>{try{let e=await S({recoveryPassword:u,user:f});if(!e)return;j(e),w?r(g.ModalScreen.EMBEDDED_WALLET_CREATED_SCREEN):(C(e),v({shouldCallAuthOnSuccess:b}))}catch(e){l(e.message)}}));i.useEffect((()=>{p||x(3e4).then((e=>y(e)))}),[p]),i.useEffect((()=>{if(!m||!f)return r(g.ModalScreen.LANDING),void E(Error("User must be authenticated before creating a Privy wallet"))}),[m]),a.current=()=>null;return e.jsx(hc,{config:{initiatedBy:"automatic"},appName:t?.name||"privy",loading:!p,buttonLoading:d,buttonHideAnimations:!A&&d,isResettingPassword:!1,error:s,password:u||"",onClose:()=>{A&&"user-passcode"!==A?.recoveryMethod?(E(new o.PrivyEmbeddedWalletError("User created a wallet but failed to set a password for it")),v({shouldCallAuthOnSuccess:!1})):A?(C(A),v({shouldCallAuthOnSuccess:b})):(E(new o.PrivyEmbeddedWalletError("User wallet creation failed")),v({shouldCallAuthOnSuccess:!1}))},onPasswordChange:h,onPasswordGenerate:()=>h(rc()),onSubmit:async()=>(c(!0),$.execute().then((()=>new Promise((e=>setTimeout(e,250))))).finally((()=>c(!1))))})},[g.ModalScreen.MFA_ENROLLMENT_FLOW_SCREEN]:()=>{let{user:t,enrollInMfa:r}=o.usePrivy(),[n,a]=i.useState(null),{unenrollWithSms:s,unenrollWithTotp:l,unenrollWithPasskey:c}=Fp(),{app:u,ready:h,data:p,onUserCloseViaDialogOrKeybindRef:y}=g.usePrivyModal(),{closePrivyModal:m}=o.usePrivyInternal(),{promptMfa:f}=Rp(),{initEnrollmentWithTotp:v}=Fp(),[w,x]=i.useState(!1),[C,E]=i.useState(null),[b,S]=i.useState(null),A=()=>{m({shouldCallAuthOnSuccess:!0}),r(!1),setTimeout((()=>{a(null),E(null)}),500)},{initEnrollmentWithPasskey:j,submitEnrollmentWithPasskey:$}=Fp(),[T,P]=i.useState(!1),[_,k]=i.useState(null);y.current=A;let N=t?.mfaMethods.includes("sms"),I=!!t?.phone,M=t?.mfaMethods.includes("totp"),O=t?.mfaMethods.includes("passkey"),R=N||M||O,F=t?.linkedAccounts.filter((e=>"passkey"===e.type)).map((e=>e.credentialId))??[];function L(){a(null),E(null)}if(i.useEffect((()=>{R&&x(!0)}),[R]),!h||!t||!u)return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{onClose:A},"header"),e.jsx(xs,{children:e.jsx(Lp,{})}),e.jsx(bs,{children:e.jsx(Co,{})}),e.jsx(d.ModalFooter,{})]});if("sms"===n)return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{backFn:L,onClose:A},"header"),e.jsx(xs,{children:e.jsx(Rs,{children:e.jsx(bt.default,{})})}),e.jsx(Cs,{children:"Remove SMS verification?"}),e.jsxs(Es,{children:["MFA adds an extra layer of security to your ",u?.name," account. Make sure you have other methods to secure your account."]}),e.jsx($s,{children:e.jsx(jo,{warn:!0,onClick:async function(){a(null);try{await s()}catch(e){a(null)}},children:"Remove SMS for MFA"})}),e.jsx(d.ModalFooter,{})]});if("totp"===n)return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{backFn:L,onClose:A},"header"),e.jsx(xs,{children:e.jsx(Rs,{children:e.jsx(Ct.default,{})})}),e.jsx(Cs,{children:"Remove Authenticator App verification?"}),e.jsxs(Es,{children:["MFA adds an extra layer of security to your ",u?.name," account. Make sure you have other methods to secure your account."]}),e.jsx($s,{children:e.jsx(jo,{warn:!0,onClick:async function(){a(null);try{await l()}catch(e){a(null)}},children:"Remove Authenticator App for MFA"})}),e.jsx(d.ModalFooter,{})]});if("passkey"===n)return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{backFn:L,onClose:A},"header"),e.jsx(xs,{children:e.jsx(Rs,{children:e.jsx(St.default,{})})}),e.jsx(Cs,{children:"Are you sure you want to remove passkey verification?"}),e.jsx(Es,{children:"This will disable any passkeys you have set up for verification. You’ll still be able to login with your passkeys if you’ve set up passkey login."}),e.jsx($s,{children:e.jsx(jo,{warn:!0,onClick:async function(){a(null);try{await f(),await c()}catch(e){a(null)}},children:"Yes, remove"})}),e.jsx(d.ModalFooter,{})]});if(0===p.mfaEnrollmentFlow.mfaMethods.length&&!R)return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{onClose:A},"header"),e.jsx(xs,{children:e.jsx(Rs,{children:e.jsx(At.default,{})})}),e.jsx(Cs,{children:"Add more security"}),e.jsxs(Es,{children:[u?.name," does not have any verification methods enabled."]}),e.jsx($s,{children:e.jsx(jo,{onClick:A,children:"Close"})}),e.jsx(d.ModalFooter,{})]});let U=!R&&!w;return U?e.jsxs(e.Fragment,{children:[e.jsx(Wo,{onClose:A},"header"),e.jsx(xs,{children:e.jsx(Rs,{children:e.jsx(At.default,{})})}),e.jsx(Cs,{children:"Transaction Protection"}),e.jsx(Es,{children:"Set up transaction protection to add an extra layer of security to your account"}),e.jsxs(Ss,{children:[e.jsxs(js,{children:[e.jsx(As,{children:e.jsx(yt.default,{})}),"Enable 2-Step verification for your ",u?.name," wallet."]}),e.jsxs(js,{children:[e.jsx(As,{children:e.jsx(Et.default,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),e.jsxs($s,{children:[e.jsx(jo,{onClick:()=>x(!0),children:"Continue"}),e.jsx(ko,{onClick:A,children:"Not now"})]}),e.jsx(d.ModalFooter,{})]}):"sms"===C?e.jsx(iy,{onComplete:A,onReset:L,onClose:A}):"totp"===C&&b?e.jsx(oy,{onComplete:A,onClose:A,onReset:L,totpInfo:b}):"passkey"===C?e.jsx(Wp,{onComplete:A,onReset:L,onClose:A}):e.jsx(Dp,{showIntro:U,userMfaMethods:t.mfaMethods,appMfaMethods:u.mfa.methods,userHasAuthSms:I,onBackToIntro:function(){x(!1)},handleSelectMethod:async function(e){return await f().catch(k),"totp"===e?(E(e),S(null),void v().then((e=>{S(e)})).catch((()=>{S(null),L()}))):"passkey"===e&&1===F.length?await async function(){P(!0);try{await j(),await $({credentialIds:F})}catch(e){k(e)}finally{P(!1)}}():void E(e)},isTotpLoading:"totp"===C&&!b,isPasskeyLoading:T,error:_,onClose:A,setRemovingMfaMethod:a})},[g.ModalScreen.CAPTCHA_SCREEN]:()=>{let{lastScreen:t,currentScreen:r,data:n,navigateBack:a,navigate:o,setModalData:s}=g.usePrivyModal(),{status:l,token:c,waitForResult:u,reset:h,execute:p}=ba(),y=i.useRef([]),m=e=>{y.current=[e,...y.current]},[f,v]=i.useState(!0);i.useEffect((()=>(m(setTimeout(v,1e3,!1)),()=>{y.current.forEach((e=>clearTimeout(e))),y.current=[]})),[]);let[w,x]=i.useState(""),[C,E]=i.useState("Checking that you are a human..."),[b,S]=i.useState(e.jsx(jo,{onClick:()=>{},disabled:!0,children:"Continue"})),[A,j]=i.useState(!1),[$,T]=i.useState(3),P=n?.captchaModalData,_=async e=>{try{await(P?.callback(e)),P?.onSuccessNavigateTo&&o(P?.onSuccessNavigateTo,!1)}catch(e){if(e instanceof Ca)return;s({errorModalData:{error:e,previousScreen:t||g.ModalScreen.LANDING}}),o(P?.onErrorNavigateTo||g.ModalScreen.ERROR_SCREEN,!1)}};i.useEffect((()=>{"success"===l?m(setTimeout((async()=>{let e=await u();!e||P?.userIntentRequired||_(e)}),1e3)):"ready"===l&&m(setTimeout((()=>{"ready"===l&&p()}),500))}),[l]),i.useEffect((()=>{if(!f)switch(l){case"success":x("Success!"),E("CAPTCHA passed successfully."),S(e.jsx(jo,{onClick:()=>{j(!0),_(c)},disabled:!P?.userIntentRequired,loading:A,children:P?.userIntentRequired?"Continue":"Continuing..."}));break;case"loading":x(""),E("Checking that you are a human..."),S(e.jsx(jo,{onClick:()=>{},disabled:!0,children:"Continue"}));break;case"error":x("Something went wrong"),$<=0?(E("If you use an adblocker or VPN, try disabling and re-attempting."),S(null)):(E("You did not pass CAPTCHA. Please try again."),S(e.jsx(jo,{onClick:k,children:"Retry"})))}}),[l,f,A]);let k=async()=>{if($<=0)return;T((e=>e-1)),h(),p();let e=await u();!e||P?.userIntentRequired||_(e)};return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{backFn:t&&r!==t?a:void 0}),e.jsxs(Cl,{children:["success"===l?e.jsx(Ze.default,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):"error"===l?e.jsx(Xe.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):e.jsx(wl,{}),e.jsxs(Ys,{children:[w?e.jsx("h3",{children:w}):null,e.jsx("p",{children:C})]}),b]}),e.jsx(d.ModalFooter,{})]})},[g.ModalScreen.ERROR_SCREEN]:()=>{let{navigate:t,navigateBack:r,data:n,lastScreen:i,currentScreen:a}=g.usePrivyModal(),o=n?.errorModalData?.previousScreen||(i===a?void 0:i);return e.jsx(pc,{error:n?.errorModalData?.error||Error(),backFn:()=>o?t(o,!1):r(),onClick:()=>t(o||g.ModalScreen.LANDING,!1)})},[g.ModalScreen.IN_APP_BROWSER_LOGIN_NOT_POSSIBLE]:()=>{let{closePrivyModal:t}=o.usePrivyInternal();return e.jsxs(e.Fragment,{children:[e.jsx(Wo,{},"header"),e.jsx(Kh,{children:e.jsx(qe.default,{style:{width:32,height:32}})}),e.jsx(nl,{title:"Could not log in with provider",description:"It looks like you're using an in-app browser. To log in, please try again using an external browser.",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}}),e.jsx(Hs,{children:e.jsx(jo,{onClick:()=>t(),children:"Close"})}),e.jsx(Js,{}),e.jsx(d.BlobbyFooter,{})]})},[g.ModalScreen.AFFIRMATIVE_CONSENT_SCREEN]:()=>{let{user:t,logout:r}=o.usePrivy(),{app:n,onUserCloseViaDialogOrKeybindRef:i,setModalData:a,navigate:s}=g.usePrivyModal(),{acceptTerms:l,closePrivyModal:d,createAnalyticsEvent:c}=o.usePrivyInternal(),h=e=>{e?.preventDefault(),d({shouldCallAuthOnSuccess:!1}),r()};i.current=h;return e.jsx(Ls,{termsAndConditionsUrl:n?.legal.termsAndConditionsUrl,privacyPolicyUrl:n?.legal.privacyPolicyUrl,onAccept:async e=>{e.preventDefault(),await l(),t&&u.shouldProceedtoEmbeddedWalletCreationFlow(t,n?.embeddedWallets?.createOnLogin)?(a({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),c({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"AffirmativeConsentScreen"}}),r()},callAuthOnSuccessOnClose:!0}}),s(g.ModalScreen.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)):d()},onDecline:h})},[g.ModalScreen.TELEGRAM_AUTH_SCREEN]:()=>{let{authenticated:t,logout:r,ready:n,user:a}=o.usePrivy(),{app:s,setModalData:c,navigate:h,resetNavigation:p,data:y}=g.usePrivyModal(),{initLoginWithTelegram:m,loginWithTelegram:f,updateWallets:v,setReadyToTrue:w,closePrivyModal:x,createAnalyticsEvent:C,getAuthMeta:E}=o.usePrivyInternal(),[b,S]=i.useState(!1),[A,j]=i.useState(void 0),$=ba();async function T(){try{let e=await async function(){let e;if($.enabled&&"error"===$.status)throw new Ca($.error,null,o.PrivyErrorCode.CAPTCHA_FAILURE);return $.enabled&&"success"!==$.status&&($.execute(),e=await $.waitForResult()),e}();await f(e),S(!0),w(!0)}catch(e){if(e?.privyErrorCode===o.PrivyErrorCode.ALLOWLIST_REJECTED)return j(void 0),p(),void h(g.ModalScreen.ALLOWLIST_REJECTION_SCREEN);if(e?.privyErrorCode===o.PrivyErrorCode.USER_LIMIT_REACHED)return console.error(new o.PrivyUserLimitReachedError(e).toString()),j(void 0),p(),void h(g.ModalScreen.USER_LIMIT_REACHED_SCREEN);if(e?.privyErrorCode===o.PrivyErrorCode.USER_DOES_NOT_EXIST)return j(void 0),p(),void h(g.ModalScreen.ACCOUNT_NOT_FOUND_SCREEN);if(e?.privyErrorCode===o.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return j(void 0),p(),c({accountTransfer:{nonce:e.data?.data?.nonce,account:e.data?.data?.subject,telegramAuthResult:E()?.telegramAuthResult,displayName:e.data?.data?.account?.displayName,linkMethod:"telegram",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress}}),void h(g.ModalScreen.LINK_CONFLICT_SCREEN);let{retryable:t,detail:r}=Aa(e);j({retryable:t,detail:r,message:"Authentication failed"})}}i.useEffect((()=>{T()}),[]),i.useEffect((()=>{if(!(n&&t&&b&&a))return;if(s?.legal.requireUsersAcceptTerms&&!a.hasAcceptedTerms){let e=setTimeout((()=>{h(g.ModalScreen.AFFIRMATIVE_CONSENT_SCREEN)}),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}if(u.shouldProceedtoEmbeddedWalletCreationFlow(a,s?.embeddedWallets?.createOnLogin)){let e=setTimeout((()=>{c({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),C({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,provider:"telegram",screen:"TelegramAuthScreen"}}),r()},callAuthOnSuccessOnClose:!0}}),h(g.ModalScreen.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}v();let e=setTimeout((()=>x({shouldCallAuthOnSuccess:!0,isSuccess:!0})),l.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}),[n,t,b,a]);let P=b?"Successfully connected with Telegram":A?A.message:"Verifying connection to Telegram",_="";return _=b?"You’re good to go!":A?A.detail:"Just a few moments more",e.jsxs(e.Fragment,{children:[e.jsx(Wo,{}),e.jsx(Xs,{}),e.jsxs(If,{children:[e.jsx(Ko,{children:e.jsxs("div",{children:[e.jsx(xo,{success:b,fail:!!A}),e.jsx(Cp,{style:{width:"38px",height:"38px"}})]})}),e.jsxs(Ys,{children:[e.jsx("h3",{children:P}),e.jsx("p",{children:_})]}),A&&A?.retryable?e.jsx(Io,{onClick:async()=>{try{j(void 0),y?.telegramAuthModalData?.seamlessAuth||await m(void 0,y?.login?.disableSignup),await T()}catch(e){let{retryable:t,detail:r}=Aa(e);j({retryable:t,detail:r,message:"Authentication failed"})}},disabled:!b&&!A?.retryable,children:"Retry"}):null]}),e.jsx(Js,{}),e.jsx(d.ModalFooter,{})]})},[g.ModalScreen.LINK_CONFLICT_SCREEN]:()=>{let{initiateAccountTransfer:t,closePrivyModal:r}=o.usePrivyInternal(),{data:n,navigate:a,lastScreen:s,setModalData:l}=g.usePrivyModal(),[d,c]=i.useState(void 0),[u,h]=i.useState(!1),[p,y]=i.useState(!1),m=async()=>{try{if(!n?.accountTransfer?.nonce||!n?.accountTransfer?.account)throw Error("missing account transfer inputs");y(!0),await t({nonce:n?.accountTransfer?.nonce,account:n?.accountTransfer?.account,accountType:n?.accountTransfer?.linkMethod,externalWalletMetadata:n?.accountTransfer?.externalWalletMetadata,telegramAuthResult:n?.accountTransfer?.telegramAuthResult,farcasterEmbeddedAddress:n?.accountTransfer?.farcasterEmbeddedAddress,oAuthUserInfo:n?.accountTransfer?.oAuthUserInfo}),h(!0),y(!1),setTimeout(r,1e3)}catch(e){l({errorModalData:{error:e,previousScreen:s||g.ModalScreen.LINK_CONFLICT_SCREEN}}),a(g.ModalScreen.ERROR_SCREEN,!0)}};return d?e.jsx(gs,{address:d,onClose:r,onRetry:()=>c(void 0),onTransfer:m,isTransferring:p,transferSuccess:u}):e.jsx(vs,{onClose:r,onInfo:()=>c(n?.accountTransfer?.embeddedWalletAddress),onContinue:()=>c(n?.accountTransfer?.embeddedWalletAddress),onTransfer:m,isTransferring:p,transferSuccess:u,data:n})}},Zf=[g.ModalScreen.LANDING,g.ModalScreen.AWAITING_CONNECTION],Xf=({isMfaVerifying:t,onMfaVerificationComplete:r})=>{let{ready:n,isModalOpen:a}=o.usePrivy(),{headless:s}=l.useAppConfig(),{ready:c,currentScreen:u}=g.usePrivyModal(),{status:h,execute:p,reset:y,enabled:m}=ba(),f=a&&u&&Zf.includes(u)&&!s&&"ready"===h;return i.useEffect((()=>{f&&p()}),[f]),i.useEffect((()=>{!a&&m&&y()}),[a,m]),n&&c||u===g.ModalScreen.AWAITING_OAUTH_SCREEN||u===g.ModalScreen.CROSS_APP_AUTH_SCREEN||u===g.ModalScreen.TELEGRAM_AUTH_SCREEN?!u&&t?e.jsx(rm,{open:t,onClose:r}):u?e.jsxs(e.Fragment,{children:[e.jsx(ns,{$if:!!t,children:e.jsx(Yf[u],{})}),e.jsx(ns,{$if:!t,children:e.jsx(rm,{open:t,onClose:r})})]}):null:e.jsxs(e.Fragment,{children:[e.jsx(Wo,{}),e.jsx(Xs,{}),e.jsx(Kf,{children:e.jsx(Co,{})}),e.jsx(Js,{}),e.jsx(d.ModalFooter,{})]})},Jf=({isMfaVerifying:t,onMfaVerificationComplete:r})=>{let n=i.useRef(null);return e.jsx(tg,{style:{height:d.useElementHeight(n)},id:"privy-modal-content",children:e.jsx("div",{ref:n,children:e.jsx(Xf,{isMfaVerifying:t,onMfaVerificationComplete:r})})})};const Qf=({open:t})=>{let{app:r}=g.usePrivyModal(),{gracefulClosePrivyModal:n}=(()=>{let{closePrivyModal:e}=o.usePrivyInternal(),{onUserCloseViaDialogOrKeybindRef:t}=g.usePrivyModal();return{gracefulClosePrivyModal:i.useCallback((()=>{if(!t?.current)return e({shouldCallAuthOnSuccess:!1});t.current()}),[e])}})(),[a,s]=i.useState(!1);wo({onMfaRequired:()=>{r?.mfa.noPromptOnMfaRequired||s(!0)}});let l=t||a;return r.render.standalone?e.jsx(Bf,{children:e.jsx(eg,{id:"privy-modal-content",children:e.jsx(Xf,{isMfaVerifying:a,onMfaVerificationComplete:()=>s(!1)})})}):e.jsx(Hf,{open:l,id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>n(),children:e.jsx(Bf,{children:e.jsx(Jf,{isMfaVerifying:a,onMfaVerificationComplete:()=>s(!1)})})})};let eg=C.styled.div`
|
|
3096
3096
|
display: flex;
|
|
3097
3097
|
flex-direction: column;
|
|
3098
3098
|
text-align: center;
|
|
@@ -3115,4 +3115,4 @@
|
|
|
3115
3115
|
box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
|
|
3116
3116
|
border-radius: var(--privy-border-radius-lg);
|
|
3117
3117
|
}
|
|
3118
|
-
`;function rg(t){let r=i.useRef(null),n=i.useRef();return i.useEffect((()=>{n.current?.remove(),n.current=function({botUsername:e,scriptHost:t}){let r=document.createElement("script"),{origin:n}=new URL(t);return r.async=!0,r.src=`${n}/js/telegram-login.js`,r.setAttribute("data-telegram-login",e),r.setAttribute("data-request-access","write"),r.setAttribute("data-lang","en"),r}(t),r.current?.after(n.current)}),[t]),e.jsx("div",{ref:r,hidden:!0})}async function ng(e,t,r,n,i,a=!1){let o=a,s=async s=>{if(o&&t&&t.length>0){s===(a?0:1)?i("configureMfa","onMfaRequired",t):n.current?.reject(new Ql("missing_or_invalid_mfa","MFA verification failed, retry."));let o=await new Promise(((e,t)=>{r.current={resolve:e,reject:t},setTimeout((()=>{let e=new Ql("mfa_timeout","Timed out waiting for MFA code");n.current?.reject(e),t(e)}),3e5)}));return await e(o)}return await e()},l=null;for(let e=0;e<4;e++)try{l=await s(e),n.current?.resolve(void 0);break}catch(e){if("missing_or_invalid_mfa"!==e.type)throw n.current?.resolve(void 0),e;o=!0}if(null===l){let e=new Ql("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw n.current?.reject(e),e}return l}var ig;let ag=(ig=0,()=>"id-"+ig++);function og(e){return void 0!==e.error}let sg=new class{enqueue(e,t){this.callbacks[e]=t}dequeue(e,t){let r=this.callbacks[t];if(!r)throw Error(`cannot dequeue ${e} event: no event found for id ${t}`);switch(delete this.callbacks[t],e){case"privy:iframe:ready":case"privy:wallet:create":case"privy:wallet:create-additional":case"privy:wallet:import":case"privy:wallet:connect":case"privy:wallet:recover":case"privy:wallet:rpc":case"privy:wallet:set-recovery":case"privy:mfa:verify":case"privy:mfa:init-enrollment":case"privy:mfa:submit-enrollment":case"privy:mfa:unenroll":case"privy:mfa:clear":case"privy:farcaster:init-signer":case"privy:farcaster:sign":case"privy:solana-wallet:create":case"privy:solana-wallet:connect":case"privy:solana-wallet:recover":case"privy:solana-wallet:rpc":case"privy:delegated-actions:consent":return r;default:throw Error(`invalid wallet event type ${e}`)}}constructor(){this.callbacks={}}},lg=new Map,dg=(e,t)=>"bigint"==typeof t?t.toString():t,cg=(e,t)=>`${e}${JSON.stringify(t,dg)}`;function ug(e,t,r,n){let i=r.contentWindow;if(!i)throw Error("iframe not initialized");let a=cg(e,t);if("privy:wallet:create"===e){let e=lg.get(a);if(e)return e}let o=new Promise(((r,a)=>{let o=ag();sg.enqueue(o,{resolve:r,reject:a}),i.postMessage({id:o,event:e,data:t},n)})).finally((()=>{lg.delete(a)}));return lg.set(a,o),o}function hg(t){let r=i.useRef(null),n=i.useRef(t.mfaMethods),a=d.useEmitPrivyEvent(),[o,s]=i.useState(!1);return i.useEffect((()=>{n.current=t.mfaMethods}),[t.mfaMethods]),i.useEffect((()=>{if(!o)return;let e=r.current;if(!e)return;function i(e){var r;e&&e.origin===t.origin&&"string"==typeof(r=e.data).event&&/^privy:.+/.test(r.event)&&function(e){switch(e.event){case"privy:iframe:ready":let t=sg.dequeue(e.event,e.id);return og(e)?t.reject(new Ql(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=sg.dequeue(e.event,e.id);return og(e)?r.reject(new Ql(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:create-additional":let n=sg.dequeue(e.event,e.id);return og(e)?n.reject(new Ql(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:import":let i=sg.dequeue(e.event,e.id);return og(e)?i.reject(new Ql(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:connect":let a=sg.dequeue(e.event,e.id);return og(e)?a.reject(new Ql(e.error.type,e.error.message)):a.resolve(e.data);case"privy:wallet:recover":let o=sg.dequeue(e.event,e.id);return og(e)?o.reject(new Ql(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:rpc":let s=sg.dequeue(e.event,e.id);return og(e)?s.reject(new Ql(e.error.type,e.error.message)):s.resolve(e.data);case"privy:wallet:set-recovery":let l=sg.dequeue(e.event,e.id);return og(e)?l.reject(new Ql(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:verify":let d=sg.dequeue(e.event,e.id);return og(e)?d.reject(new Ql(e.error.type,e.error.message)):d.resolve(e.data);case"privy:mfa:init-enrollment":{let t=sg.dequeue(e.event,e.id);return og(e)?t.reject(new Ql(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:mfa:submit-enrollment":{let t=sg.dequeue(e.event,e.id);return og(e)?t.reject(new Ql(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:mfa:unenroll":{let t=sg.dequeue(e.event,e.id);return og(e)?t.reject(new Ql(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:mfa:clear":{let t=sg.dequeue(e.event,e.id);return og(e)?t.reject(new Ql(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:farcaster:init-signer":{let t=sg.dequeue(e.event,e.id);return og(e)?t.reject(new Ql(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:farcaster:sign":{let t=sg.dequeue(e.event,e.id);return og(e)?t.reject(new Ql(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:solana-wallet:create":let c=sg.dequeue(e.event,e.id);return og(e)?c.reject(new Ql(e.error.type,e.error.message)):c.resolve(e.data);case"privy:solana-wallet:connect":let u=sg.dequeue(e.event,e.id);return og(e)?u.reject(new Ql(e.error.type,e.error.message)):u.resolve(e.data);case"privy:solana-wallet:recover":let h=sg.dequeue(e.event,e.id);return og(e)?h.reject(new Ql(e.error.type,e.error.message)):h.resolve(e.data);case"privy:solana-wallet:rpc":{let t=sg.dequeue(e.event,e.id);return og(e)?t.reject(new Ql(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:delegated-actions:consent":{let t=sg.dequeue(e.event,e.id);return og(e)?t.reject(new Ql(e.error.type,e.error.message)):t.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}(e.data)}let s={create:r=>ug("privy:wallet:create",r,e,t.origin),createAdditional:r=>ug("privy:wallet:create-additional",r,e,t.origin),import:r=>ug("privy:wallet:import",r,e,t.origin),connect:r=>ug("privy:wallet:connect",r,e,t.origin),recover:r=>ng((n=>ug("privy:wallet:recover",{...r,...n},e,t.origin)),n.current,t.mfaPromise,t.mfaSubmitPromise,a,!r.recoveryMethod||"privy"===r.recoveryMethod),rpc:r=>ng((n=>ug("privy:wallet:rpc",{...r,...n},e,t.origin)),n.current,t.mfaPromise,t.mfaSubmitPromise,a),createSolana:r=>ug("privy:solana-wallet:create",r,e,t.origin),connectSolana:r=>ug("privy:solana-wallet:connect",r,e,t.origin),recoverSolana:r=>ug("privy:solana-wallet:recover",r,e,t.origin),rpcSolana:r=>ug("privy:solana-wallet:rpc",r,e,t.origin),createDelegatedAction:r=>ug("privy:delegated-actions:consent",r,e,t.origin),setRecovery:r=>ng((n=>ug("privy:wallet:set-recovery",{...r,...n},e,t.origin)),n.current,t.mfaPromise,t.mfaSubmitPromise,a),verifyMfa:r=>ng((n=>ug("privy:mfa:verify",{...r,...n},e,t.origin)),n.current,t.mfaPromise,t.mfaSubmitPromise,a,!0),initEnrollMfa:r=>ng((n=>ug("privy:mfa:init-enrollment",{...r,...n},e,t.origin)),n.current,t.mfaPromise,t.mfaSubmitPromise,a),submitEnrollMfa:r=>ng((n=>ug("privy:mfa:submit-enrollment",{...r,...n},e,t.origin)),n.current,t.mfaPromise,t.mfaSubmitPromise,a),unenrollMfa:r=>ng((n=>ug("privy:mfa:unenroll",{...r,...n},e,t.origin)),n.current,t.mfaPromise,t.mfaSubmitPromise,a,!0),clearMfa:r=>ug("privy:mfa:clear",r,e,t.origin),initFarcasterSigner:r=>ug("privy:farcaster:init-signer",r,e,t.origin),signFarcasterMessage:r=>ug("privy:farcaster:sign",r,e,t.origin)};window.addEventListener("message",i);let l=new AbortController;return d.invokeUntilSettled((()=>ug("privy:iframe:ready",{},e,t.origin)),{abortSignal:l.signal}).then((()=>t.onLoad(s)),((...e)=>{console.warn("Privy iframe failed to load: ",...e),t.onLoadFailed()})),()=>{window.removeEventListener("message",i),l.abort()}}),[o]),e.jsx("iframe",{ref:r,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>s(!0),src:d.constructURL(t.origin,`/apps/${t.appId}/embedded-wallets`,{caid:t.clientAnalyticsId,client_id:t.appClientId})})}class pg{async handleSignMessage(e){if(!e.params||"string"!=typeof e.params.message)throw Error("Message must be provided as a string for Solana signMessage RPC");return await _g({message:e.params.message})}async request(e){if(console.debug("EmbeddedSolanaProvider.request() called with args",e),!await Sg())throw Error("User must be authenticated to use embedded Solana wallet");if(!await Pg())throw new o.PrivyClientError("Unable to connect to Solana embedded wallet");if("signMessage"===e.method)return await this.handleSignMessage(e);throw Error("Embedded Solana provider does not yet support this RPC method.")}constructor(e,t){this.walletProxy=e,this.address=t}}const yg="popup-privy-oauth",mg="PRIVY_OAUTH_USE_BROADCAST_CHANNEL";async function fg({url:e,popup:t,provider:r}){return t.location=e,new Promise(((e,r)=>{function n(){t?.close(),window.removeEventListener("message",i)}function i(t){t.data&&("PRIVY_OAUTH_RESPONSE"===t.data.type&&t.data.stateCode&&t.data.authorizationCode&&(e(t.data),n()),"https://cdn.apple-cloudkit.com"===t.origin&&t.data.ckSession&&(e({type:"PRIVY_OAUTH_RESPONSE",ckWebAuthToken:t.data.ckSession}),n()),"PRIVY_OAUTH_ERROR"===t.data.type&&(r(t.data.error),n()))}window.addEventListener("message",i)}))}let gg,vg,wg,xg,Cg,Eg,bg;function Sg(){return gg?gg.getAccessToken():Promise.resolve(d.e5.get(l.TOKEN_STORAGE_KEY)||null)}const Ag=(e,t,r)=>vg(e,t,r),jg=(e,t,r)=>wg(e,t,r),$g=(e,t,r,n)=>xg(e,t,r,n),Tg=()=>Cg(),Pg=()=>Eg(),_g=({message:e})=>bg({message:e});let kg=s=>{let c=s.client,[h,p]=i.useState(!1),[y,f]=i.useState(!1),[v,w]=i.useState(!1),[x,C]=i.useState(null),[E,b]=i.useState([]),[S,A]=i.useState([]),[j,$]=i.useState(null),T=i.useRef(E),[P,_]=i.useState(!1),[k,N]=i.useState(null),[I,M]=i.useState(!1),[O,R]=i.useState({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:o.notImplemented}),[F,L]=i.useState({status:"initial"}),[U,D]=i.useState({status:"initial"}),[W,B]=i.useState({status:"initial"}),[H,G]=i.useState({status:"initial"}),[q,z]=i.useState({status:"initial"}),[V,K]=i.useState(null),Y=l.useAppConfig(),Z=l.useIsServerConfigLoaded(),[X,J]=i.useState(!0),[Q,ee]=i.useState({}),[te,re]=i.useState(null),[ne,ie]=i.useState(null),[ae,oe]=i.useState(!1),[se,le]=i.useState(!1),[de,ce]=i.useState(Y.customAuth?.enabled?{status:"initial"}:{status:"not-enabled"}),ue=i.useRef(null),he=i.useRef(null),pe=i.useRef(d.privyEventsDefault),[ye,me]=i.useState(!1);c.onStoreToken=e=>{e&&d.emitPrivyEvent(pe,"accessToken","onAccessTokenGranted",e)},c.onDeleteToken=()=>{C(null),w(!1),d.emitPrivyEvent(pe,"accessToken","onAccessTokenRemoved")};let fe=i.useRef(null),ge=i.useRef(null),ve=i.useRef(!1),we=e=>{N(e),setTimeout((()=>{p(!0)}),15),c.createAnalyticsEvent({eventName:"modal_open",payload:{initialScreen:e}})},xe=e=>{"off"!==Y.embeddedWallets.createOnLogin&&J(!0),we(e)};i.useEffect((()=>{let e=u.getPrivySolanaWallet(x);if(!e||!V)return void $(null);let t={type:"solana",imported:!1,address:e.address,connectedAt:Date.now(),walletClientType:"privy",connectorType:"embedded",meta:{name:"Privy Wallet",icon:void 0,id:"io.privy.solana.wallet"},linked:!0,fund:()=>{throw new o.PrivyClientError("Funding is not supported for Solana embedded wallets.")},unlink:()=>{throw new o.PrivyClientError("Cannot unlink an embedded Solana wallet")},getProvider:async()=>new pg(V,e.address),signMessage:async e=>{let r=await Sg();if(!r||!V)throw new o.PrivyClientError("Must have valid access token and Privy wallet to send transaction",o.PrivyErrorCode.MUST_BE_AUTHENTICATED);let{response:n}=await V.rpcSolana({accessToken:r,publicKey:t.address,request:{method:"signMessage",params:{message:Buffer.from(e).toString("base64")}}});return Buffer.from(n.data.signature,"base64")},async sendTransaction(e,t,r){let{signature:n}=await Oe({transaction:e,connection:t,transactionOptions:r,wallet:this});return n},async signTransaction(e){let t=await Sg();if(!t||!V)throw new o.PrivyClientError("Must have valid access token and Privy wallet to send transaction",o.PrivyErrorCode.MUST_BE_AUTHENTICATED);return await xm({tx:e,accessToken:t,walletProxy:V,transactingWalletAddress:this.address}),e},loginOrLink:async()=>{throw new o.PrivyClientError("Cannot login or link with an embedded Solana wallet")},disconnect:()=>{$(null)},isConnected:async()=>!0};$(t)}),[V,x]),i.useEffect((()=>{if(!x)return void c.connectors?.removeEmbeddedWalletConnectors();let e=u.getPrivyEthereumWallet(x),t=u.getPrivyEthereumHDWallets(x),r=u.getImportedPrivyEthereumWallet(x);e&&t.length||c.connectors?.removeEmbeddedWalletConnectors(),r||c.connectors?.removeImportedWalletConnector(),c.connectors?V?(e&&c.connectors.addEmbeddedWalletConnectors({walletProxy:V,rootWallet:e,embeddedWallets:t,defaultChain:Y.defaultChain,appId:s.appId}),r&&c.connectors.addImportedWalletConnector(V,r.address,Y.defaultChain,s.appId)):console.debug("Failed to add embedded wallet connector: Wallet proxy not initialized"):console.debug("Failed to add embedded wallet connector: Client connectors not initialized")}),[V,x]),i.useEffect((()=>{V&&ne?.(V)}),[V]),i.useEffect((()=>{(async()=>{if(!Y.customAuth?.enabled)return void ce({status:"not-enabled"});J(!0),ce({status:"loading"});let{getCustomAccessToken:e,isLoading:t}=Y.customAuth;if(y&&!t)try{let t=await e();if(!t&&v)return await We.logout(),ce({status:"done"}),void d.emitPrivyEvent(pe,"customAuth","onUnauthenticated");if(!t||v)return void ce({status:"done"});c.startAuthFlow(new Ii(t));let{user:r,isNewUser:n}=await c.authenticate();if(!r)return await We.logout(),ce({status:"error",error:new o.PrivyClientError("Failed to sync with custom auth provider")}),void d.emitPrivyEvent(pe,"customAuth","onUnauthenticated");void 0!==n&&d.emitPrivyEvent(pe,"login","onComplete",r,n,!1,"custom",null),d.emitPrivyEvent(pe,"customAuth","onAuthenticated",{user:r}),ce({status:"done"}),C(r||null),_(n||!1),w(!0),le(!0)}catch(e){console.warn(e),v&&(await We.logout(),d.emitPrivyEvent(pe,"customAuth","onUnauthenticated")),d.emitPrivyEvent(pe,"login","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR),ce({status:"error",error:e})}})()}),[Y.customAuth?.enabled,Y.customAuth?.getCustomAccessToken,Y.customAuth?.isLoading,y,v]),i.useEffect((()=>{se&&V&&x&&u.shouldProceedtoEmbeddedWalletCreationFlow(x,Y.embeddedWallets.createOnLogin)&&(le(!1),Ie(x,l.WALLET_PROXY_TIMEOUT).catch(console.error))}),[se&&V&&x]),i.useEffect((()=>{if(Y.externalWallets.solana.connectors)return Y.externalWallets.solana.connectors.onMount(),()=>Y.externalWallets.solana.connectors?.onUnmount()}),[Y.externalWallets.solana.connectors]),i.useEffect((()=>{!y&&Z&&async function(){let e,t=Ce(),r=Ee();(()=>{let e=new URLSearchParams(window.location.search).get("privy_token");if(!e)return;d.e5.put(l.FORKED_TOKEN_STORAGE_KEY,e);let t=new URL(window.location.href);t.searchParams.delete("privy_token"),window.history.pushState({},"",t)})();let i=n.createStore();c.initializeConnectorManager({walletConnectCloudProjectId:Y.walletConnectCloudProjectId,rpcConfig:Y.rpcConfig,chains:Y.chains,defaultChain:Y.defaultChain,store:i,walletList:Y.appearance.walletList,shouldEnforceDefaultChainOnConnect:Y.shouldEnforceDefaultChainOnConnect,externalWalletConfig:Y.externalWallets,appName:Y.name??"Privy"}),c.connectors?.on("connectorInitialized",(()=>{e&&clearTimeout(e);let t=c.connectors.walletConnectors.length,r=c.connectors.walletConnectors.reduce(((e,t)=>e+(t.initialized?1:0)),0);r===t?me(!0):e=setTimeout((()=>{console.debug({message:"Unable to initialize all expected connectors before timeout",initialized:r,expected:t}),me(!0)}),1500)})),c.connectors?.initialize().then((()=>{$e()}));let a=await c.getAuthenticatedUser(),o=!!a;if(Y.customAuth?.enabled||(w(!!a),a&&d.emitPrivyEvent(pe,"login","onComplete",a,!1,!0,null,null),C(a)),!t)return r&&!o?(ge.current="login",void xe(g.ModalScreen.TELEGRAM_AUTH_SCREEN)):void Be.setReadyToTrue(!!a);ge.current=o?"link":"login"}()}),[c,te,y,Z]),i.useEffect((()=>{if(y){if(!x||!x.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType)))return void oe(!0);oe(!!E.find((e=>"privy"===e.walletClientType)))}}),[y,x,E]);let Ce=()=>{let e=ha();return e.inProgress&&e.popupFlow?window.opener.location.origin!==window.location.origin?void window.opener.postMessage({type:"PRIVY_OAUTH_ERROR",error:"Origins between parent and child windows do not match."}):"error"===e.authorizationCode?void window.opener.postMessage({type:"PRIVY_OAUTH_ERROR",error:"Something went wrong. Try again."}):void window.opener.postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:e.stateCode,authorizationCode:e.authorizationCode}):(e.inProgress&&function(e){return e.startsWith("privy:")}(e.provider)&&!e.popupFlow&&(new BroadcastChannel(yg).postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:e.stateCode,authorizationCode:e.authorizationCode}),window.close()),!!e.inProgress&&!e.headless&&(c.startAuthFlow(new Ji(e)),xe(g.ModalScreen.AWAITING_OAUTH_SCREEN),!0))},Ee=()=>{let e=function(){let e;return(e=function(){let e=new URLSearchParams(window.location.search),t=Number(e.get("id")||""),r=e.get("hash"),n=Number(e.get("auth_date")||""),i=e.get("first_name"),a=e.get("last_name")||void 0,o=e.get("username")||void 0,s=e.get("photo_url")||void 0;if(t&&i&&n&&r)return{id:t,first_name:i,last_name:a,username:o,photo_url:s,auth_date:n,hash:r}}())?(Ea(),{...e,flowType:"login-url"}):(e=function(){let e=window.location.hash;if(!e||!e.startsWith("#tgWebAppData"))return;let t=new URLSearchParams(decodeURIComponent(e.replace("#tgWebAppData=",""))),r=t.get("query_id")||void 0,n=t.get("user"),i=Number(t.get("auth_date")||""),a=t.get("hash"),o=t.get("chat_instance")||void 0,s=t.get("chat_type")||void 0,l=t.get("start_param")||void 0;return n&&i&&a?{query_id:r,user:n,auth_date:i,hash:a,chat_instance:o,chat_type:s,start_param:l}:void 0}())?(Ea(),{...e,flowType:"web-app"}):void 0}();if(!e||!Y.loginMethods.telegram||!Y.loginConfig.telegramAuthConfiguration?.seamlessAuthEnabled)return;let t=new xa;return c.startAuthFlow(t),"login-url"===e.flowType&&(t.meta.telegramWebAppData=void 0,t.meta.telegramAuthResult={id:e.id,first_name:e.first_name,last_name:e.last_name,auth_date:e.auth_date,username:e.username,photo_url:e.photo_url,hash:e.hash}),"web-app"===e.flowType&&(t.meta.telegramAuthResult=void 0,t.meta.telegramWebAppData={query_id:e.query_id,user:e.user,auth_date:e.auth_date,hash:e.hash,chat_instance:e.chat_instance,chat_type:e.chat_type,start_param:e.start_param}),!0},be=async(e,t,r,n)=>{Se(await(c.connectors?.createEthereumWalletConnector(e,t))||null,t,r,n)};async function Se(e,t,r,n){if(!e)return R({status:"disconnected",connectedWallet:null,connectError:new o.PrivyConnectorError("Unable to connect to wallet."),connector:null,connectRetry:o.notImplemented}),n?.(null,r);R({status:"disconnected",connectedWallet:null,connectError:null,connector:e,connectRetry:o.notImplemented}),e instanceof Xa&&t&&await e.resetConnection(t),R({connector:e,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>Se(e,t,r,n)});try{let t=await e.connect({showPrompt:!0});if((!t||Na(t))&&Y.shouldEnforceDefaultChainOnConnect&&!Y.chains.find((e=>e.id===Number(t?.chainId.replace("eip155:",""))))&&("wallet_connect_v2"!==t?.connectorType||"metamask"!==t?.walletClientType)){R((t=>({...t,connector:e,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:o.notImplemented})));try{await(t?.switchChain(Y.defaultChain.id)),t&&(t.chainId=d.formatChainIdToCAIP2(d.toHex(Y.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${Y.defaultChain.id}`)}}return R((e=>({...e,status:"connected",connectedWallet:t,connectError:null,connectRetry:o.notImplemented}))),t&&d.emitPrivyEvent(pe,"connectWallet","onSuccess",t),n?.(t,r)}catch(e){return e instanceof o.PrivyError?(console.warn(e.cause?e.cause:e.message),d.emitPrivyEvent(pe,"connectWallet","onError",e.privyErrorCode||o.PrivyErrorCode.GENERIC_CONNECT_WALLET_ERROR)):(console.warn(e),d.emitPrivyEvent(pe,"connectWallet","onError",o.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR)),R((t=>({...t,status:"disconnected",connectedWallet:null,connectError:e}))),n?.(null,r)}}let Ae=async(e,t,r)=>{if(null===e||!Na(e))return;let n=new fa(e,c,t,r);c.startAuthFlow(n)},je=async(e,t)=>{if(null===e||!m.isBaseConnectedSolanaWallet(e))return;let r=new ga(e,c,t);c.startAuthFlow(r)},$e=()=>{let e=new URLSearchParams(window.location.search),t=e.get("privy_connector"),r=e.get("privy_wallet_client");if(!t||!r)return;if("phantom"!==r||d.isPhantomInstalled()||xe(g.ModalScreen.LOGIN_FAILED_SCREEN),!c.connectors)throw new o.PrivyClientError("Connector not initialized");we(g.ModalScreen.AWAITING_CONNECTION);let n=new URL(window.location.href);n.searchParams.delete("privy_connector"),n.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",n),be(t,r,void 0,Ae)};i.useEffect((()=>{y&&v&&null===x&&c.getAuthenticatedUser().then(C)}),[y,v,x,c]);let Te=e=>{if(!v)throw d.emitPrivyEvent(pe,"linkAccount","onError",o.PrivyErrorCode.MUST_BE_AUTHENTICATED,{linkMethod:e}),new o.PrivyClientError("User must be authenticated before linking an account.")},Pe=()=>{Te("siwe"),fe.current="siwe",ge.current="link",we(g.ModalScreen.LINK_WALLET_SCREEN)},_e=e=>{if(!v||!x)return!1;if("privy"===e.walletClientType)return!0;for(let t of x.linkedAccounts)if("wallet"===t.type&&t.address===e.address&&"privy"!==t.walletClientType)return!0;return!1},ke=async e=>{let t;if(!c.connectors)throw new o.PrivyClientError("Connector not initialized");t="ethereum"===e.type?c.connectors.findWalletConnector(e.connectorType,e.walletClientType)||null:c.connectors.findSolanaWalletConnector(e.connectorType,e.walletClientType)||null,R((r=>({...r,connector:t,status:"connected",connectedWallet:e,connectError:null,connectRetry:o.notImplemented}))),Y.captchaEnabled&&!v?(ee({captchaModalData:{callback:t=>Na(e)?Ae(e,t):je(e,t),userIntentRequired:!1,onSuccessNavigateTo:g.ModalScreen.AWAITING_CONNECTION,onErrorNavigateTo:g.ModalScreen.ERROR_SCREEN}}),xe(g.ModalScreen.CAPTCHA_SCREEN)):(Na(e)?await Ae(e):await je(e),xe(g.ModalScreen.AWAITING_CONNECTION))},Ne=()=>{b((e=>{let t=c.connectors?.wallets.filter(Na).map((e=>({...e,linked:_e(e),loginOrLink:async()=>{if(!await e.isConnected())throw new o.PrivyClientError("Wallet is not connected");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new o.PrivyClientError("Cannot link or login with embedded wallet");ke(e)},fund:async t=>{await Be.fundWallet(e.address,t)},unlink:async()=>{if(!v)throw new o.PrivyClientError("User is not authenticated.");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new o.PrivyClientError("Cannot unlink an embedded wallet");C(await c.unlinkEthereumWallet(e.address))}})))||[];return to(e,t)?e:t})),A((e=>{let t=c.connectors?.wallets.filter(m.isBaseConnectedSolanaWallet).map((e=>({...e,linked:_e(e),loginOrLink:async()=>{if(!await e.isConnected())throw new o.PrivyClientError("Wallet is not connected");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new o.PrivyClientError("Cannot link or login with embedded wallet");ke(e)},fund:async e=>{throw new o.PrivyClientError("Funding not supported for Solana wallets")},unlink:async()=>{if(!v)throw new o.PrivyClientError("User is not authenticated.");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new o.PrivyClientError("Cannot unlink an embedded wallet");C(await c.unlinkSolanaWallet(e.address))}})))||[];return to(e,t)?e:t}))};i.useEffect((()=>{Ne()}),[x?.linkedAccounts,v,y]),i.useEffect((()=>{if(y){if(!c.connectors)throw new o.PrivyClientError("Connector not initialized");Ne(),c.connectors.on("walletsUpdated",Ne)}}),[y]),i.useEffect((()=>{let e;if(!E[0])return;let t=E[0],r=T.current.find((e=>e.address===t.address));if(e="privy"===t.walletClientType?x?.linkedAccounts.find((e=>"wallet"===e.type&&e.address===t.address&&"privy"===e.walletClientType)):x?.linkedAccounts.find((e=>"wallet"===e.type&&e.address===t.address&&"privy"!==e.walletClientType)),!r&&e){let t=Object.assign({},x);t.wallet=e&&{address:e.address,chainType:e.chainType,chainId:e.chainId,walletClient:e.walletClient,walletClientType:e.walletClientType,connectorType:e.connectorType,imported:e.imported,walletIndex:e.walletIndex},C(t)}T.current=E}),[E]);let Ie=async(e,t,r)=>{let n=u.getPrivyEthereumWallet(e);if(n&&!r?.createAdditional)throw d.emitPrivyEvent(pe,"createWallet","onError",o.PrivyErrorCode.EMBEDDED_WALLET_ALREADY_EXISTS),Error("User already has an embedded wallet.");let[i,a]=await Promise.all([Be.initializeWalletProxy(t),Sg()]);if(!i&&Y.customAuth?.enabled)throw d.emitPrivyEvent(pe,"createWallet","onError",o.PrivyErrorCode.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to connect to wallet proxy");if(!i||!a||Y.embeddedWallets?.requireUserOwnedRecoveryOnCreate)return new Promise(((e,t)=>{J(!0),ee({createWallet:{onSuccess:t=>{d.emitPrivyEvent(pe,"createWallet","onSuccess",t),e(t)},onFailure:e=>{d.emitPrivyEvent(pe,"createWallet","onError",o.PrivyErrorCode.UNKNOWN_EMBEDDED_WALLET_ERROR),t(e)},callAuthOnSuccessOnClose:!1}}),we(g.ModalScreen.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}));{if(n){let t=u.getPrivyEthereumHDWallets(e),r=t?.length?Math.max(...t.map((e=>e.walletIndex))):n.walletIndex;await Be.recoverEmbeddedEthereumWallet(),await i.createAdditional({accessToken:a,primaryWalletAddress:n?.address,hdWalletIndex:r+1})}else await i.create({accessToken:a});let t=u.getPrivyEthereumWallet(await Be.refreshUser());if(!t)throw d.emitPrivyEvent(pe,"createWallet","onError",o.PrivyErrorCode.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to create wallet");return d.emitPrivyEvent(pe,"createWallet","onSuccess",t),t}},Me=(e,r,n,i)=>new Promise((async(a,l)=>{let{requesterAppId:c}=r||{};if(!v||!x)return d.emitPrivyEvent(pe,"sendTransaction","onError",o.PrivyErrorCode.MUST_BE_AUTHENTICATED),void l(Error("User must be authenticated before signing with a Privy wallet"));let h=i??u.getPrivyEthereumWallet(x)?.address;if(!h)throw new o.PrivyClientError("User must have an embedded wallet to send a transaction.");let{signingWallet:p,rootWallet:y}=u.getSigningAndRootWallet(x,h);if(!y||!p)return d.emitPrivyEvent(pe,"sendTransaction","onError",o.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),void l(Error("Must have a Privy wallet before signing"));J(!0);let f=He.wallets.find((e=>"privy"===e.walletClientType&&t.getAddress(e.address)===t.getAddress(p.address))),w=await(f?.getEthereumProvider());if(!f||!w)throw new o.PrivyClientError(`Cannot sendTransaction before embedded wallet ${p.address} is connected`);let C=e.chainId?Number(e.chainId):sf(f.chainId);(e=>{if(!Y.chains.map((e=>e.id)).includes(e))throw new o.PrivyConnectorError(`Chain ID ${e} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,o.PrivyErrorCode.UNSUPPORTED_CHAIN_ID)})(C);let E=Object.assign({},e,{chainId:C});if(Y.embeddedWallets.noPromptOnSignature||ve.current)r&&Y.embeddedWallets.noPromptOnSignature&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),(async()=>{let e=await Sg();if(!e||!V)return d.emitPrivyEvent(pe,"sendTransaction","onError",o.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),void l(Error("Must have valid access token and Privy wallet to send transaction"));try{if(!await Be.recoverEmbeddedEthereumWallet())return d.emitPrivyEvent(pe,"sendTransaction","onError",o.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR),void l(Error("Unable to connect to wallet"));let t=d.getJsonRpcProvider(E.chainId,Y.chains,Y.rpcConfig,{appId:s.appId}),r=await dr(p.address,E,t);if(Y.embeddedWallets.noPromptOnSignature||ve.current){let{totalGasEstimate:e}=await sr(r,t),{hasSufficientFunds:n}=await af(p.address,r,e,t);if(!n)throw new m.PrivyProviderRpcError(new m.ProviderRpcError("Wallet has insufficient funds for this transaction.",m.E.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let n=await nf({accessToken:e,rootWallet:y,transactingWallet:p,walletProxy:V,transactionRequest:r,provider:t,requesterAppId:c});d.emitPrivyEvent(pe,"sendTransaction","onSuccess",n),a(n)}catch(e){d.emitPrivyEvent(pe,"sendTransaction","onError",o.PrivyErrorCode.TRANSACTION_FAILURE),l(e)}})();else{let e={address:y.address,onCompleteNavigateTo:g.ModalScreen.EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN,onFailure:e=>{d.emitPrivyEvent(pe,"sendTransaction","onError",o.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR),l(e)}},t=df({address:p.address,appConfig:Y,fundWalletConfig:n,chainIdOverride:E.chainId,comingFromSendTransactionScreen:!0});ee({connectWallet:e,sendTransaction:{transactionRequest:E,transactingWallet:p,rootWallet:y,onSuccess:e=>{d.emitPrivyEvent(pe,"sendTransaction","onSuccess",e),a(e)},onFailure:e=>{d.emitPrivyEvent(pe,"sendTransaction","onError",o.PrivyErrorCode.TRANSACTION_FAILURE),l(e)},uiOptions:r||{},fundWalletConfig:n,requesterAppId:c},funding:t}),we(g.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN)}})),Oe=({transaction:e,connection:t,transactionOptions:r,uiOptions:n,wallet:i})=>new Promise((async(a,s)=>{let{requesterAppId:l}=n||{};if(!v||!x)return d.emitPrivyEvent(pe,"sendSolanaTransaction","onError",o.PrivyErrorCode.MUST_BE_AUTHENTICATED),void s(new o.PrivyClientError("User must be authenticated before signing with a Privy wallet",o.PrivyErrorCode.MUST_BE_AUTHENTICATED));let c=i?x.linkedAccounts.find((e=>"wallet"===e.type&&e.address===i.address)):u.getPrivySolanaWallet(x);if(!c)return d.emitPrivyEvent(pe,"sendSolanaTransaction","onError",o.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),void s(new o.PrivyClientError("Must have a Privy wallet before signing",o.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND));J(!0);let h=i??j,p=await(h?.isConnected());if(!h||!p)throw d.emitPrivyEvent(pe,"sendSolanaTransaction","onError",o.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),new o.PrivyClientError(`Cannot sendSolanaTransaction before embedded wallet ${c.address} is connected`,o.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND);Y.embeddedWallets.noPromptOnSignature?(n&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),(async()=>{let n=await Sg();if(!n||!V)return d.emitPrivyEvent(pe,"sendSolanaTransaction","onError",o.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),void s(new o.PrivyClientError("Must have valid access token and Privy wallet to send transaction",o.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND));try{if(!await Be.recoverEmbeddedSolanaWallet())return d.emitPrivyEvent(pe,"sendSolanaTransaction","onError",o.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR),void s(new o.PrivyClientError("Unable to connect to wallet",o.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR));if(Y.embeddedWallets.noPromptOnSignature){let{instructions:r}=await vy(e,t);r.every((e=>e.hasFunds))||(d.emitPrivyEvent(pe,"sendSolanaTransaction","onError",o.PrivyErrorCode.INSUFFICIENT_BALANCE),s(new o.PrivyClientError("Solana wallet has insufficient funds for this transaction.",o.PrivyErrorCode.INSUFFICIENT_BALANCE)))}let{signature:i,receipt:l}=await Cm({accessToken:n,tx:e,connection:t,walletProxy:V,transactionOptions:r,transactingWalletAddress:c.address}),u=gy(i,l);d.emitPrivyEvent(pe,"sendSolanaTransaction","onSuccess",u),a(u)}catch(e){d.emitPrivyEvent(pe,"sendSolanaTransaction","onError",o.PrivyErrorCode.TRANSACTION_FAILURE),s(e)}})()):(ee({connectWallet:{address:c.address,onCompleteNavigateTo:g.ModalScreen.EMBEDDED_WALLET_SEND_SOLANA_TRANSACTION_SCREEN,onFailure:e=>{d.emitPrivyEvent(pe,"sendSolanaTransaction","onError",o.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR),s(e)}},sendSolanaTransaction:{transactionRequest:e,connection:t,transactionOptions:r,transactingWallet:c,onSuccess:e=>{d.emitPrivyEvent(pe,"sendSolanaTransaction","onSuccess",e),a(e)},onFailure:e=>{d.emitPrivyEvent(pe,"sendSolanaTransaction","onError",o.PrivyErrorCode.TRANSACTION_FAILURE),s(e)},uiOptions:n||{},requesterAppId:l},funding:void 0}),we(g.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN))}));function Re(){return new Promise((async(e,t)=>{let r=await Sg();if(!r||!V)throw Error("Must have valid access token to enroll in MFA");try{await V.verifyMfa({accessToken:r}),e()}catch(e){t(e)}}))}let Fe=e=>e?.linkedAccounts.filter((e=>null!==e.latestVerifiedAt&&!("wallet"===e.type&&"privy"===e.walletClientType))).sort(((e,t)=>t.latestVerifiedAt.getTime()-e.latestVerifiedAt.getTime()))[0],Le=e=>{let t=x?.linkedAccounts.filter((t=>t.type===e)).length??0,{displayName:r,loginMethod:n}=np(e);if("passkey"===e&&t>=5||"passkey"!==e&&t>=1)throw d.emitPrivyEvent(pe,"linkAccount","onError",o.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE,{linkMethod:n}),new o.PrivyClientError(`User already has an account of type ${r} linked.`)};async function Ue({showAutomaticRecovery:e=!1,legacySetWalletPasswordFlow:t=!1}){N(null);let r=t?"setWalletPassword":"setWalletRecovery";if(!v||!x)throw d.emitPrivyEvent(pe,r,"onError",o.PrivyErrorCode.MUST_BE_AUTHENTICATED),Error("User must be authenticated before adding recovery method to Privy wallet");let n=u.getPrivyEthereumWallet(x);if(!n||!V)throw d.emitPrivyEvent(pe,r,"onError",o.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),Error("Must have a Privy wallet to add a recovery method");if(u.getPrivySolanaWallet(x))throw Error("Cannot set user-controlled recovery for user with Solana.");try{await Re()}catch(e){throw d.emitPrivyEvent(pe,r,"onError",o.PrivyErrorCode.MISSING_MFA_CREDENTIALS),e}return new Promise(((i,a)=>{J(!0);let s={onSuccess:e=>{d.emitPrivyEvent(pe,r,"onSuccess","user-passcode",e),i(e)},onFailure:e=>{d.emitPrivyEvent(pe,r,"onError",o.PrivyErrorCode.USER_EXITED_SET_PASSWORD_FLOW),a(e)},callAuthOnSuccessOnClose:!1},l="user-passcode"===n.recoveryMethod;ee({setWalletPassword:s,createWallet:s,connectWallet:{onCompleteNavigateTo:ld({walletAction:"update",availableRecoveryMethods:Y.embeddedWallets.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:t,isResettingPassword:l,showAutomaticRecovery:e}),shouldForceMFA:!1,onFailure:e=>{d.emitPrivyEvent(pe,r,"onError",o.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR),a(e)}},recoverySelection:{isInAccountCreateFlow:!1,isResettingPassword:l}}),we(g.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN)}))}async function De({appId:e,action:t}){let r=await Sg();if("link"===t&&!r)throw d.emitPrivyEvent(pe,"linkAccount","onError",o.PrivyErrorCode.MUST_BE_AUTHENTICATED,{linkMethod:`privy:${e}`}),new o.PrivyClientError("User must be authenticated before linking an account.");if("login"===t&&r)throw d.emitPrivyEvent(pe,"login","onError",o.PrivyErrorCode.UNKNOWN_AUTH_ERROR),new o.PrivyClientError("Attempted to log in, but user is already logged in. Use a `link` helper instead.");fe.current=`privy:${e}`,ge.current=t;let n=window.open(void 0,void 0,Ju({w:440,h:680}));return c.createAnalyticsEvent({eventName:"cross_app_auth_started",payload:{providerAppId:e}}),new Promise((async(r,i)=>{let{name:a,logoUrl:o}=await Yu({api:c.api,providerAppId:e,requesterAppId:Y.id});ee({crossAppAuth:{appId:e,name:a,logoUrl:o,action:t,popup:n,onSuccess:r,onError:i}}),xe(g.ModalScreen.CROSS_APP_AUTH_SCREEN)}))}let We={ready:y,authenticated:v,user:x,walletConnectors:c.connectors||null,connectWallet:e=>{e&&"target"in e&&e&&(e=void 0),ee({externalConnectWallet:{walletList:e?.walletList&&e?.walletList.length>0?e.walletList:void 0,suggestedAddress:e?.suggestedAddress}}),we(v?g.ModalScreen.CONNECT_ONLY_AUTHENTICATED_SCREEN:g.ModalScreen.CONNECT_ONLY_LANDING_SCREEN)},importWallet:async({privateKey:e})=>{Te("siwe");let[t,r]=await Promise.all([Be.initializeWalletProxy(15e3),Sg()]);if(t&&r){await t.import({privateKey:e,accessToken:r});let n=u.getImportedPrivyEthereumWallet(await Be.refreshUser());if(!n)throw d.emitPrivyEvent(pe,"createWallet","onError",o.PrivyErrorCode.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to import wallet");return d.emitPrivyEvent(pe,"createWallet","onSuccess",n),n}throw new o.PrivyClientError("User is not authenticated")},linkWallet:Pe,startCrossAppAuthFlow:De,linkEmail:()=>{Te("email"),Le("email"),fe.current="email",ge.current="link",we(g.ModalScreen.LINK_EMAIL_SCREEN)},linkPhone:()=>{Te("sms"),Le("phone"),fe.current="sms",ge.current="link",we(g.ModalScreen.LINK_PHONE_SCREEN)},linkGoogle:async()=>{Te("google"),Le("google_oauth"),ge.current="link",await Be.initLoginWithOAuth("google")},linkTwitter:async()=>{Te("twitter"),Le("twitter_oauth"),ge.current="link",await Be.initLoginWithOAuth("twitter")},linkDiscord:async()=>{Te("discord"),Le("discord_oauth"),ge.current="link",await Be.initLoginWithOAuth("discord")},linkGithub:async()=>{Te("github"),Le("github_oauth"),ge.current="link",await Be.initLoginWithOAuth("github")},linkSpotify:async()=>{Te("spotify"),Le("spotify_oauth"),ge.current="link",await Be.initLoginWithOAuth("spotify")},linkInstagram:async()=>{Te("instagram"),Le("instagram_oauth"),ge.current="link",await Be.initLoginWithOAuth("instagram")},linkTiktok:async()=>{Te("tiktok"),Le("tiktok_oauth"),ge.current="link",await Be.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{Te("linkedin"),Le("linkedin_oauth"),ge.current="link",await Be.initLoginWithOAuth("linkedin")},linkApple:async()=>{Te("apple"),Le("apple_oauth"),ge.current="link",await Be.initLoginWithOAuth("apple")},linkPasskey:async()=>{Te("passkey"),Le("passkey"),await Be.initLinkWithPasskey(),we(g.ModalScreen.LINK_PASSKEY_SCREEN)},linkTelegram:async()=>{Te("telegram"),Le("telegram"),ge.current="link",fe.current="telegram",await Be.initLoginWithTelegram(),we(g.ModalScreen.TELEGRAM_AUTH_SCREEN)},linkFarcaster:async()=>{Te("farcaster"),Le("farcaster"),await Be.initLoginWithFarcaster(),ge.current="link",fe.current="farcaster",we(g.ModalScreen.AWAITING_FARCASTER_CONNECTION)},updateEmail:()=>{if(Te("email"),!x?.email)throw new o.PrivyClientError("User does not have an email linked to their account.");ge.current="link",fe.current="email",we(g.ModalScreen.UPDATE_EMAIL_SCREEN)},updatePhone:()=>{if(Te("sms"),!x?.phone)throw new o.PrivyClientError("User does not have a phone number linked to their account.");ge.current="link",fe.current="sms",we(g.ModalScreen.UPDATE_PHONE_SCREEN)},login:async e=>{e&&"target"in e&&e&&(e=void 0);let t="Attempted to log in, but user is already logged in. Use a `link` helper instead.";if(!y){let e=await new Promise((e=>{re((t=>e.bind(t)))}));if(re(null),e)return void console.warn(t)}!x||x.isGuest?(ge.current="login",ee({login:e}),xe(g.ModalScreen.LANDING)):console.warn(t)},connectOrCreateWallet:async()=>{y||(await new Promise((e=>{re((()=>e))})),re(null)),v?console.warn("User must be unauthenticated to `connectOrCreateWallet`"):xe(g.ModalScreen.CONNECT_OR_CREATE)},logout:async()=>{if(x&&c.clearProviderAcccessTokens(x),N(null),await c.logout(),x&&V)try{await V.clearMfa({userId:x.id})}catch(e){}C(null),w(!1),d.emitPrivyEvent(pe,"logout","onSuccess"),ge.current=null,fe.current=null,p(!1),d.e5.del(l.CLIENT_ANALYTICS_ID_KEY),d.e5.del(l.getGuestCredentialStorageKey(Y.id))},getAccessToken:()=>c.getAccessToken(),getEthereumProvider:()=>{if(!x||!x.wallet)return new Aa;let e=E.find((e=>x.wallet&&e.address===x.wallet.address)),t=c.connectors?.walletConnectors.find((t=>t.wallets.find((t=>t.address===e?.address))));return e&&t?t.proxyProvider:new Aa},getEthersProvider:()=>{if(!x||!x.wallet)return new r.Web3Provider(new Ta(new Aa));let e=E.find((e=>x.wallet&&e.address===x.wallet.address)),t=c.connectors?.walletConnectors.find((t=>t.wallets.find((t=>t.address===e?.address))));return new r.Web3Provider(new Ta(e&&t?t.proxyProvider:new Aa))},getWeb3jsProvider:()=>{if(!x||!x.wallet)return new Pa(new Aa);let e=E.find((e=>x.wallet&&e.address===x.wallet.address)),t=c.connectors?.walletConnectors.find((t=>t.wallets.find((t=>t.address===e?.address))));return new Pa(e&&t?t.proxyProvider:new Aa)},unlinkWallet:async e=>{let t;return C(t=e.startsWith("0x")?await c.unlinkEthereumWallet(e):await c.unlinkSolanaWallet(e)),t},unlinkEmail:async e=>{let t=await c.unlinkEmail(e);return C(t),t},unlinkPhone:async e=>{let t=await c.unlinkPhone(e);return C(t),t},unlinkGoogle:async e=>{let t=await c.unlinkOAuth("google",e);return C(t),t},unlinkTwitter:async e=>{let t=await c.unlinkOAuth("twitter",e);return C(t),t},unlinkDiscord:async e=>{let t=await c.unlinkOAuth("discord",e);return C(t),t},unlinkGithub:async e=>{let t=await c.unlinkOAuth("github",e);return C(t),t},unlinkSpotify:async e=>{let t=await c.unlinkOAuth("spotify",e);return C(t),t},unlinkInstagram:async e=>{let t=await c.unlinkOAuth("instagram",e);return C(t),t},unlinkTiktok:async e=>{let t=await c.unlinkOAuth("tiktok",e);return C(t),t},unlinkLinkedIn:async e=>{let t=await c.unlinkOAuth("linkedin",e);return C(t),t},unlinkApple:async e=>{let t=await c.unlinkOAuth("apple",e);return C(t),t},unlinkFarcaster:async e=>{let t=await c.unlinkFarcaster(e);return C(t),t},unlinkTelegram:async e=>{let t=await c.unlinkTelegram(e);return C(t),t},unlinkPasskey:async e=>{let t=await c.unlinkPasskey(e);return C(t),t},unlinkCrossAppAccount:async({subject:e})=>{let t=x?.linkedAccounts.find((t=>"cross_app"===t.type&&t.subject===e))?.providerApp;if(!t)throw new o.PrivyClientError("Invalid subject");c.storeProviderAccessToken(t.id,null);let r=await c.unlinkOAuth(`privy:${t.id}`,e);return C(r),r},setActiveWallet:async e=>{let r=E.find((r=>t.getAddress(r.address)===t.getAddress(e))),n=x?.linkedAccounts.find((r=>"wallet"===r.type&&t.getAddress(r.address)===t.getAddress(e)));if(r&&await r.isConnected())if(r.linked){let e=Object.assign({},x);e.wallet=n&&{address:n.address,chainType:n.chainType,chainId:n.chainId,walletClient:n.walletClient,walletClientType:n.walletClientType,connectorType:n.connectorType,imported:n.imported,walletIndex:n.walletIndex},C(e)}else r.loginOrLink();else ee({externalConnectWallet:{suggestedAddress:e}}),Pe()},forkSession:()=>c.forkSession(),createWallet:async e=>{if(e&&"target"in e&&e&&(e=void 0),!v||!x)throw d.emitPrivyEvent(pe,"createWallet","onError",o.PrivyErrorCode.MUST_BE_AUTHENTICATED),Error("User must be authenticated before creating a Privy wallet");return Ie(x,15e3,e)},setWalletRecovery:async e=>Ue({legacySetWalletPasswordFlow:!1,showAutomaticRecovery:e?.showAutomaticRecovery??!1}),setWalletPassword:async()=>Ue({legacySetWalletPasswordFlow:!0,showAutomaticRecovery:!1}),signMessage:(e,t,r)=>new Promise((async(n,i)=>{let{requesterAppId:a}=t||{};if(!v||!x)return d.emitPrivyEvent(pe,"signMessage","onError",o.PrivyErrorCode.MUST_BE_AUTHENTICATED),void i(Error("User must be authenticated before signing with a Privy wallet"));let s=r??u.getPrivyEthereumWallet(x)?.address;if(!s)throw new o.PrivyClientError("User must have an embedded wallet to sign a message.");let{signingWallet:l,rootWallet:h}=u.getSigningAndRootWallet(x,s);if(!l||!h)return d.emitPrivyEvent(pe,"signMessage","onError",o.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),void i(Error("Must have a Privy wallet before signing"));if("string"!=typeof e||e.length<1)return d.emitPrivyEvent(pe,"signMessage","onError",o.PrivyErrorCode.INVALID_MESSAGE),void i(Error("Message must be a non-empty string"));J(!0);let p=async()=>{if(!v)throw Error("User must be authenticated before signing with a Privy wallet");let t=await Sg();if(!V||!t||!await Be.recoverEmbeddedEthereumWallet())throw Error("Unable to connect to wallet");c.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_started",payload:{walletAddress:l.address,requesterAppId:a}});let{response:r}=await V.rpc({accessToken:t,address:h.address,hdWalletIndex:l.walletIndex??void 0,requesterAppId:a,request:{method:"personal_sign",params:[e,l.address]}}),n=r.data;return c.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_completed",payload:{walletAddress:l.address,requesterAppId:a}}),n};if(Y.embeddedWallets.noPromptOnSignature||ve.current){t&&Y.embeddedWallets.noPromptOnSignature&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let e=await p();d.emitPrivyEvent(pe,"signMessage","onSuccess",e),n(e)}catch(e){d.emitPrivyEvent(pe,"signMessage","onError",o.PrivyErrorCode.UNABLE_TO_SIGN),i(e??new m.PrivyProviderRpcError("Unable to sign message"))}}else ee({signMessage:{method:"personal_sign",data:e,confirmAndSign:p,onSuccess:e=>{d.emitPrivyEvent(pe,"signMessage","onSuccess",e),n(e)},onFailure:e=>{d.emitPrivyEvent(pe,"signMessage","onError",o.PrivyErrorCode.UNABLE_TO_SIGN),i(e)},uiOptions:t||{}},connectWallet:{onCompleteNavigateTo:g.ModalScreen.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN,onFailure:e=>{d.emitPrivyEvent(pe,"signMessage","onError",o.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR),i(e)},address:h.address}}),we(g.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN)})),signTypedData:(e,t,r)=>new Promise((async(n,i)=>{let{requesterAppId:a}=t||{};if(!v||!x)return d.emitPrivyEvent(pe,"signTypedData","onError",o.PrivyErrorCode.MUST_BE_AUTHENTICATED),void i(Error("User must be authenticated before signing with a Privy wallet"));let s=r??u.getPrivyEthereumWallet(x)?.address;if(!s)throw new o.PrivyClientError("User must have an embedded wallet to sign a message.");let{signingWallet:l,rootWallet:h}=u.getSigningAndRootWallet(x,s);if(!h||!l)return d.emitPrivyEvent(pe,"signTypedData","onError",o.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),void i(Error("Must have a Privy wallet before signing"));J(!0);let p=d.generateTypedDataWithDomainType(e),y=async()=>{if(!v)throw Error("User must be authenticated before signing with a Privy wallet");let e=await Sg();if(!V||!e||!await Be.recoverEmbeddedEthereumWallet())throw Error("Unable to connect to wallet");c.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_started",payload:{walletAddress:l.address,requesterAppId:a}});let{response:t}=await V.rpc({accessToken:e,address:h.address,hdWalletIndex:l.walletIndex??void 0,requesterAppId:a,request:{method:"eth_signTypedData_v4",params:[l.address,p]}}),r=t.data;return c.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_completed",payload:{walletAddress:l.address,requesterAppId:a}}),r};if(ve.current||Y.embeddedWallets.noPromptOnSignature||Y.legacyWalletUiConfig){t&&Y.embeddedWallets.noPromptOnSignature&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let e=await y();d.emitPrivyEvent(pe,"signTypedData","onSuccess",e),n(e)}catch(e){d.emitPrivyEvent(pe,"signTypedData","onError",o.PrivyErrorCode.UNABLE_TO_SIGN),i(e??new m.PrivyProviderRpcError("Unable to sign message"))}}else ee({signMessage:{method:"eth_signTypedData_v4",data:p,confirmAndSign:y,onSuccess:e=>{d.emitPrivyEvent(pe,"signTypedData","onSuccess",e),n(e)},onFailure:e=>{d.emitPrivyEvent(pe,"signTypedData","onError",o.PrivyErrorCode.UNABLE_TO_SIGN),i(e)},uiOptions:t||{}},connectWallet:{address:h.address,onCompleteNavigateTo:g.ModalScreen.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN,onFailure:e=>{d.emitPrivyEvent(pe,"signMessage","onError",o.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR),i(e)}}}),we(g.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN)})),sendTransaction:async(e,t,r,n)=>{let i=await Me(e,t,r,n);return of(await i.wait())},sendSolanaTransaction:async(e,t,r,n)=>await Oe({transaction:e,connection:t,transactionOptions:n,uiOptions:r,wallet:j??void 0}),exportWallet:e=>new Promise((async(r,n)=>{if(!v||!x)return void n(Error("User must be authenticated before exporting their Privy wallet"));e&&"target"in e&&e&&(e=void 0);let i=e?.address,a=x.linkedAccounts.filter((e=>"wallet"===e.type&&"privy"===e.walletClientType&&"ethereum"===e.chainType)),o=i?a.find((e=>e.address===t.getAddress(i))):a.find((e=>!e.imported))||a[0];if(!o)return void n(Error("Must have a Privy wallet before exporting"));J(!0);let l={onCompleteNavigateTo:g.ModalScreen.EMBEDDED_WALLET_KEY_EXPORT_SCREEN,onFailure:n,address:o.address,shouldForceMFA:!0};ee(Q),await Sg()&&V?V?(ee({keyExport:{appId:s.appId,appClientId:s.clientId,origin:c.apiUrl,wallet:o,onSuccess:r,onFailure:n},connectWallet:l}),we(g.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN)):n(Error("Must have a Privy wallet before exporting")):n(Error("Must have valid access token to enroll in MFA"))})),promptMfa:Re,async init(e){switch(e){case"sms":return void await c.initMfaSmsVerification();case"passkey":return await c.initMfaPasskeyVerification();case"totp":return;default:throw Error(`Unsupported MFA method: ${e}`)}},async submit(e,t){switch(e){case"totp":case"sms":if("string"!=typeof t)throw new o.PrivyClientError("Invalid MFA code");ue.current?.resolve({mfaMethod:e,mfaCode:t,relyingParty:window.origin}),await new Promise(((e,t)=>{he.current={resolve:e,reject:t}}));break;case"passkey":if("string"==typeof t)throw new o.PrivyClientError("Invalid authenticator response");let r=await import("@simplewebauthn/browser"),n=(e=>({id:e.id,raw_id:e.rawId,response:{client_data_json:e.response.clientDataJSON,authenticator_data:e.response.authenticatorData,signature:e.response.signature,user_handle:e.response.userHandle},authenticator_attachment:e.authenticatorAttachment,client_extension_results:{app_id:e.clientExtensionResults.appid,cred_props:e.clientExtensionResults.credProps,hmac_create_secret:e.clientExtensionResults.hmacCreateSecret},type:e.type}))(await r.startAuthentication(t));ue.current?.resolve({mfaMethod:e,mfaCode:n,relyingParty:window.origin}),await new Promise(((e,t)=>{he.current={resolve:e,reject:t}}));break;default:throw ue.current?.reject(new o.PrivyClientError("Unsupported MFA method")),new o.PrivyClientError(`Unsupported MFA method: ${e}`)}},cancel(){ue.current?.reject(new o.PrivyClientError("MFA canceled"))},async initEnrollmentWithSms(e){let t=await Sg();if(!t||!V)throw Error("Must have valid access token to enroll in MFA");await V.initEnrollMfa({method:"sms",accessToken:t,phoneNumber:e.phoneNumber})},enrollInMfa:e=>new Promise(((t,r)=>{if(!e)return Be.closePrivyModal(),void t();Y.mfa.noPromptOnMfaRequired&&console.warn("[Privy Warning] Triggering the 'showMfaEnrollmentModal' function when 'noPromptOnMfaRequired' is set to true is unexpected. If this is intentional, ensure that you are building custom UIs for MFA verification."),ee({mfaEnrollmentFlow:{mfaMethods:Y.mfa.methods,onSuccess:t,onFailure:r}}),we(g.ModalScreen.MFA_ENROLLMENT_FLOW_SCREEN)})),async initEnrollmentWithTotp(){let e=await Sg();if(!e||!V)throw Error("Must have valid access token to enroll in MFA");let t=await V.initEnrollMfa({method:"totp",accessToken:e});return{secret:t.secret,authUrl:t.authUrl}},async submitEnrollmentWithSms(e){let t=await Sg();if(!t||!V)throw Error("Must have valid access token to enroll in MFA");await V.submitEnrollMfa({method:"sms",accessToken:t,phoneNumber:e.phoneNumber,code:e.mfaCode}),C(await c.getAuthenticatedUser())},async submitEnrollmentWithTotp(e){let t=await Sg();if(!t||!V)throw Error("Must have valid access token to enroll in MFA");await V.submitEnrollMfa({method:"totp",accessToken:t,code:e.mfaCode}),C(await c.getAuthenticatedUser())},async initEnrollmentWithPasskey(){},async submitEnrollmentWithPasskey({credentialIds:e}){let t=await Sg();if(!t||!V)throw Error("Must have valid access token to enroll in MFA");await V.submitEnrollMfa({method:"passkey",accessToken:t,credentialIds:e}),C(await c.getAuthenticatedUser())},async unenroll(e){let t=await Sg();if(!t||!V)throw Error("Must have valid access token to remove MFA");"passkey"===e?await V.submitEnrollMfa({method:"passkey",accessToken:t,credentialIds:[]}):await V.unenrollMfa({method:e,accessToken:t}),C(await c.getAuthenticatedUser())},requestFarcasterSignerFromWarpcast:async()=>{let e=await Sg(),t=x?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!e)throw Error("Must have valid access token to connect with Farcaster");if(!V||!t)throw Error("Must have an embedded wallet to use Farcaster signers");if(!x?.farcaster?.fid)throw Error("Must have Farcaster account to use Farcaster signers");if(!await Be.recoverEmbeddedEthereumWallet())throw Error("Unable to connect to wallet");let r=await V.initFarcasterSigner({address:t.address,hdWalletIndex:null,accessToken:e,mfaCode:null,mfaMethod:null,relyingParty:window.origin});"approved"===r.status&&C(await c.getAuthenticatedUser()||x||null),ee({farcasterSigner:r}),we(g.ModalScreen.AWAITING_FARCASTER_SIGNER)},getFarcasterSignerPublicKey:async()=>{let e,t=await Sg(),r=x?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!t)throw Error("Must have valid access token to connect with Farcaster");if(!V||!r)throw Error("Must have an embedded wallet to use Farcaster signers");if(!x?.farcaster?.fid)throw Error("Must have Farcaster account to use Farcaster signers");if(!await Be.recoverEmbeddedEthereumWallet())throw Error("Unable to connect to wallet");if(!x.farcaster?.signerPublicKey)throw Error("Must have a Farcaster signer public key to sign");return e=x.farcaster.signerPublicKey.slice(2),Uint8Array.from(e.match(/.{1,2}/g).map((e=>parseInt(e,16))))},signFarcasterMessage:async e=>{let t=await Sg(),r=x?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!t)throw Error("Must have valid access token to connect with Farcaster");if(!V||!r)throw Error("Must have an embedded wallet to use Farcaster signers");if(!x?.farcaster?.fid)throw Error("Must have Farcaster account to use Farcaster signers");if(!await Be.recoverEmbeddedEthereumWallet())throw Error("Unable to connect to wallet");if(!x.farcaster?.signerPublicKey)throw Error("Must have a Farcaster signer public key to sign");let n=await import("@simplewebauthn/browser"),i=await V.signFarcasterMessage({address:r.address,hdWalletIndex:null,accessToken:t,mfaCode:null,mfaMethod:null,payload:{hash:n.bufferToBase64URLString(e)},fid:BigInt(x.farcaster.fid),relyingParty:window.origin});return new Uint8Array(n.base64URLStringToBuffer(i.signature))},createGuestAccount:async()=>{if(x&&!x.isGuest)throw Error("User cannot already be authenticated to create a guest account");return x?.isGuest?x:Be.loginWithGuestAccountFlow()},isHeadlessOAuthLoading:I,async loginWithCode(e){await Be.loginWithCode(e)},initLoginWithEmail:e=>Be.initLoginWithEmail(e),initLoginWithSms:e=>Be.initLoginWithSms(e),otpState:W,fundWallet:(e,t)=>Be.fundWallet(e,t),initLoginWithHeadlessOAuth:(e,t)=>Be.initLoginWithHeadlessOAuth(e,t),loginWithHeadlessOAuth:e=>Be.loginWithHeadlessOAuth(e),generateSiweMessage:({address:e,chainId:t})=>Be.generateSiweMessage({address:e,chainId:t}),async linkWithSiwe({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i}){Te("siwe"),await Be.linkWithSiwe({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i})},signMessageWithCrossAppWallet:(e,{address:t})=>Zu({user:x,client:c,address:t,requesterAppId:Y.id,request:{method:"personal_sign",params:[e,t]},reconnect:De}),signTypedDataWithCrossAppWallet(e,{address:t}){let r=d.generateTypedDataWithDomainType(e);return Zu({user:x,client:c,address:t,requesterAppId:Y.id,request:{method:"eth_signTypedData_v4",params:[t,r]},reconnect:De})},sendTransactionWithCrossAppWallet:(e,{address:t})=>Zu({user:x,client:c,address:t,requesterAppId:Y.id,request:{method:"eth_sendTransaction",params:[e]},reconnect:De}),isModalOpen:h,mfaMethods:Y.mfa.methods};vg=We.signMessage,wg=We.signTypedData,xg=async(...e)=>{let t=await Me(...e);return Y.embeddedWallets.waitForTransactionConfirmation&&await t.wait(),t};let Be={isNewUserThisSession:P,pendingTransaction:null,walletConnectionStatus:O,connectors:c.connectors?.walletConnectors??[],solanaWallets:S,rpcConfig:Y.rpcConfig,chains:Y.chains,appId:s.appId,showFiatPrices:"native-token"!==Y.embeddedWallets.priceDisplay.primary,clientAnalyticsId:c.clientAnalyticsId,customAuthStatus:de,noPromptOnSignature:ve,emailOtpState:U,setEmailOtpState:D,smsOtpState:W,setSmsOtpState:B,oAuthState:q,setOAuthState:z,siweState:H,setSiweState:G,nativeTokenSymbolForChainId:e=>Y.chains.find((t=>t.id===Number(e)))?.nativeCurrency.symbol,initializeWalletProxy:async e=>{if(V)return V;let t=new Promise((e=>{ie((()=>t=>e(t)))})),r=new Promise((t=>setTimeout((()=>t(null)),e))),n=await Promise.race([t,r]);return ie(null),n},getAuthFlow:()=>c.authFlow,getAuthMeta:()=>c.authFlow?.meta,client:c,closePrivyModal:async(e={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let t,r=y&&v&&x;r&&fe.current&&(t=Fe(x)),"login"===ge.current?e.shouldCallAuthOnSuccess&&r&&fe.current?(d.emitPrivyEvent(pe,"login","onComplete",x,P,!1,fe.current,t??null),s.onSuccess?.(x,P)):d.emitPrivyEvent(pe,"login","onError",o.PrivyErrorCode.USER_EXITED_AUTH_FLOW):"link"===ge.current&&t&&(e.isSuccess&&r&&fe.current?d.emitPrivyEvent(pe,"linkAccount","onSuccess",x,fe.current,t):fe.current&&d.emitPrivyEvent(pe,"linkAccount","onError",o.PrivyErrorCode.USER_EXITED_LINK_FLOW,{linkMethod:fe.current}));let n=k&&cf.includes(k),i=k===g.ModalScreen.ERROR_SCREEN&&Q.errorModalData&&cf.includes(Q.errorModalData.previousScreen);if((n||i)&&Q.funding){let e,t=uf[k]??null,r=d.getJsonRpcProvider(Q.funding.chain.id,Y.chains,Y.rpcConfig,{appId:s.appId});try{e=(await r.getBalance(Q.funding.address)).toBigInt()}catch{console.error("Unable to pull wallet balance")}d.emitPrivyEvent(pe,"fundWallet","onUserExited",{address:Q.funding.address,chain:Q.funding.chain,fundingMethod:t,balance:e})}ee({...Q,externalConnectWallet:{suggestedAddress:void 0}}),ge.current=null,fe.current=null,_(!1),p(!1),setTimeout((()=>{c.authFlow=void 0}),200),c.createAnalyticsEvent({eventName:"modal_closed"})},solanaSignMessage:async({message:e})=>new Promise((async(t,r)=>{let n=async()=>{let t=await c.getAccessToken();if(!t)throw Error("User must be authenticated to use their embedded wallet.");if(!j)throw Error("User must have an embedded Solana wallet to sign messages for Solana.");let r=Be.walletProxy??await Be.initializeWalletProxy(15e3);if(!r)throw Error("Failed to initialize embedded wallet proxy.");let{response:n}=await r.rpcSolana({accessToken:t,publicKey:j.address,request:{method:"signMessage",params:{message:e}}});return n.data.signature};if(Y.embeddedWallets.noPromptOnSignature||ve.current)try{let e=await n();t({signature:e})}catch(e){r(e)}else ee({signMessage:{method:"solana_signMessage",data:e,confirmAndSign:n,onSuccess:e=>{t({signature:e})},onFailure:e=>{r(e)},uiOptions:{}}}),xe(g.ModalScreen.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN)})),openPrivyModal:we,connectWallet:Se,initLoginWithWallet:async(e,t,r)=>{Na(e)?(fe.current="siwe",Ae(e,t,r)):(fe.current="siws",je(e,t))},loginWithWallet:async()=>{let e,t,r;if(!y)throw new o.PrivyNotReadyError;if(c.authFlow instanceof fa?e="siwe":c.authFlow instanceof ga&&(e="siws"),!e)throw new o.PrivyClientError("Must initialize SIWE/SIWS flow first.");if(null!==await c.getAccessToken())try{({user:t}=await c.link()),fe.current=e}catch(t){throw d.emitPrivyEvent(pe,"linkAccount","onError",t.privyErrorCode||o.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:e}),t}else try{({user:t,isNewUser:r}=await c.authenticate()),fe.current=e}catch(e){throw d.emitPrivyEvent(pe,"login","onError",e.privyErrorCode||o.PrivyErrorCode.GENERIC_CONNECT_WALLET_ERROR),e}C(t||x||null),_(r||!1),w(!0)},initDelegateAction:async({address:e})=>new Promise((async(t,r)=>{let n=await Sg();if(!v||!x||!n)throw new o.PrivyClientError("User must be authenticated and have an embedded wallet to delegate actions.");let i=Be.walletProxy??await Be.initializeWalletProxy(15e3);if(!i)throw new o.PrivyClientError("Wallet proxy not initialized.");let a=(({address:e,user:t})=>{let r=t.linkedAccounts.find((t=>"wallet"===t.type&&"privy"===t.walletClientType&&t.address===e));if(!r)throw new o.PrivyClientError("Address to delegate is not associated with current user.");return{address:r.address,chainType:r.chainType,walletIndex:r.walletIndex??0}})({address:e,user:x}),s=(({address:e,user:t})=>{let r,n=t.linkedAccounts.find((t=>"wallet"===t.type&&"privy"===t.walletClientType&&t.address===e));if(!n)throw new o.PrivyClientError("Address to delegate is not associated with current user.");if(!(r="ethereum"===n.chainType?n.imported?u.getImportedPrivyEthereumWallet(t):u.getPrivyEthereumWallet(t):n))throw new o.PrivyClientError("Unable to determine root address for delegated address.");return{address:r.address,chainType:r.chainType,imported:r.imported}})({address:e,user:x});"ethereum"===a.chainType?await Be.recoverEmbeddedEthereumWallet():await Be.recoverEmbeddedSolanaWallet(),ee({delegatedActions:{address:e,onDelegate:async()=>{await i.createDelegatedAction({accessToken:n,rootWallet:s,delegatedWallets:[a]})},onSuccess:async()=>{t()},onError:async e=>{r(e)}}}),we(g.ModalScreen.EMBEDDED_WALLET_DELEGATED_ACTIONS_CONSENT_SCREEN)})),initLoginWithFarcaster:async(e,t)=>{let r=new qi(e,t);c.startAuthFlow(r);try{fe.current="farcaster",await r.initializeFarcasterConnect()}catch(e){throw"login"===ge.current?d.emitPrivyEvent(pe,"login","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR):"link"===ge.current&&d.emitPrivyEvent(pe,"linkAccount","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR,{linkMethod:"farcaster"}),e}},loginWithFarcaster:async()=>{let e,t;if(!y)throw new o.PrivyNotReadyError;if(!(c.authFlow instanceof qi))throw new o.PrivyClientError("Must initialize Farcaster flow first.");if(null!==await c.getAccessToken())try{({user:e}=await c.link()),fe.current="farcaster"}catch(e){throw d.emitPrivyEvent(pe,"linkAccount","onError",e.privyErrorCode||o.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:"farcaster"}),e}else try{({user:e,isNewUser:t}=await c.authenticate()),fe.current="farcaster"}catch(e){throw d.emitPrivyEvent(pe,"login","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR),e}C(e||null),_(t||!1),w(!0)},async loginWithGuestAccountFlow(){let e=new Vi(this.appId);c.startAuthFlow(e);try{ge.current="login",fe.current="guest";let{user:e,isNewUser:t}=await c.authenticate();if(t=t||!1,!e)throw new o.PrivyClientError("Unable to authenticate guest account");if(u.shouldProceedtoEmbeddedWalletCreationFlow(e,Y.embeddedWallets.createOnLogin))try{await Ie(e,15e3),e=await Be.refreshUser()}catch(t){C(e),console.warn("Unable to create embedded wallet for guest account")}else C(e);return _(t),w(!0),d.emitPrivyEvent(pe,"login","onComplete",e,t,!1,"guest",null),e}catch(e){throw d.emitPrivyEvent(pe,"login","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR),e}},async crossAppAuthFlow({appId:e,popup:t,action:r}){let n=`privy:${e}`;fe.current=n;let{url:i,stateCode:a,codeVerifier:s}=await async function({api:e,appId:t}){let r=Ki(),n=Yi(),i=await Zi(r);try{let{url:a}=await e.post(Pi,{provider:`privy:${t}`,redirect_to:window.location.href,code_challenge:i,state_code:n});return{url:a,stateCode:n,codeVerifier:r}}catch(e){throw o.formatApiError(e)}}({api:c.api,appId:e});if(!i)throw c.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:"Unable to open cross-app auth popup",appId:e}}),new o.PrivyClientError("No authorization URL returned for cross-app auth.");try{let l=await async function({url:e,popup:t}){return t.location=e,new Promise(((e,r)=>{let n,i=setTimeout((()=>{r(new o.PrivyClientError("Authorization request timed out after 2 minutes.")),a()}),12e4);function a(){t?.close(),window.removeEventListener("message",l)}let s=setInterval((()=>{t?.closed&&!n&&(a(),clearInterval(s),clearTimeout(i),r(new o.PrivyClientError("User rejected request")))}),300);function l(t){t.data&&("PRIVY_OAUTH_RESPONSE"===t.data.type&&t.data.stateCode&&t.data.authorizationCode&&(clearTimeout(i),e(t.data),a()),"PRIVY_OAUTH_ERROR"===t.data.type&&(clearTimeout(i),r(new o.PrivyClientError(t.data.error)),a()),t.data.type===mg&&((n=new BroadcastChannel(yg)).onmessage=l))}window.addEventListener("message",l)}))}({url:i,popup:t,provider:n}),d=l.stateCode,u=l.authorizationCode;if(d!==a)throw c.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:n,storedStateCode:a??"",returnedStateCode:d??""}}),new o.PrivyClientError("Unexpected auth flow. This may be a phishing attempt.",void 0,o.PrivyErrorCode.OAUTH_UNEXPECTED);let h=await async function({appId:e,stateCode:t,codeVerifier:r,authorizationCode:n,action:i,client:a}){if(!n||!t)throw new o.PrivyClientError("[Cross-App AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if("undefined"===n)throw new o.PrivyClientError("User denied confirmation during cross-app auth flow");try{let o=new Ku({authorizationCode:n,stateCode:t,codeVerifier:r,provider:`privy:${e}`});a.startAuthFlow(o);let s="link"===i?await a.link():await a.authenticate(),l=s.oAuthTokens?.accessToken;return console.debug(),l}catch(e){let t=o.formatApiError(e);if(t.privyErrorCode)throw new o.PrivyClientError(t.message||"Invalid code during cross-app auth flow.",void 0,t.privyErrorCode);if("User denied confirmation during cross-app auth flow"===t.message)throw new o.PrivyClientError("Invalid code during cross-app auth flow.",void 0,o.PrivyErrorCode.OAUTH_USER_DENIED);throw new o.PrivyClientError("Invalid code during cross-app auth flow.",void 0,o.PrivyErrorCode.UNKNOWN_AUTH_ERROR)}}({appId:e,codeVerifier:s,stateCode:d,authorizationCode:u,action:r,client:c});h&&c.storeProviderAccessToken(e,h);let p=await Be.refreshUser();if(!p)throw new o.PrivyClientError("Unable to update user");return c.createAnalyticsEvent({eventName:"cross_app_auth_completed",payload:{providerAppId:e}}),p}catch(e){throw c.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:e.toString(),provider:n}}),e}},async initLoginWithOAuth(e,t,r){if(fe.current=e,!d.e())return void xe(g.ModalScreen.IN_APP_BROWSER_LOGIN_NOT_POSSIBLE);if("google"===e&&jl(window.navigator.userAgent))return void xe(g.ModalScreen.IN_APP_BROWSER_LOGIN_NOT_POSSIBLE);"twitter"===e&&window.opener&&window.opener.postMessage({type:mg},"*"),d.e5.del(l.HEADLESS_OAUTH_KEY),d.e5.del(l.OAUTH_DISABLE_SIGNUP_KEY);let n=new Ji({provider:e,disableSignup:!!r});t&&n.addCaptchaToken(t),c.startAuthFlow(n);let i=await c.authFlow.getAuthorizationUrl();i&&i.url&&("twitter"===e&&a.isAndroid&&(i.url=i.url.replace("x.com","twitter.com")),window.location.assign(i.url))},async initLoginWithTelegram(e,t){if(!y)throw new o.PrivyNotReadyError;fe.current="telegram";let r=new xa(e,t);c.startAuthFlow(r),r.meta.telegramWebAppData=void 0,r.meta.telegramAuthResult=await new Promise(((e,t)=>Y.loginConfig.telegramAuthConfiguration?window.Telegram?void window.Telegram.Login.auth({bot_id:Y.loginConfig.telegramAuthConfiguration.botId,request_access:!0},(r=>r?e(r):t(new o.PrivyClientError("Telegram auth failed or was canceled by the client")))):t(new o.PrivyClientError("Telegram was not initialized")):t(new o.PrivyClientError("Telegram Auth configuration is not loaded"))))},async loginWithTelegram(){let e,t;if(!(c.authFlow instanceof xa))throw new o.PrivyClientError("Must initialize Telegram flow before calling loginWithTelegram");if("login"===ge.current)try{let r=await c.authenticate();e=r.user,t=r.isNewUser,fe.current="telegram"}catch(e){throw d.emitPrivyEvent(pe,"login","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR),e}else{if("link"!==ge.current)throw new o.PrivyClientError("Unknown auth intent");try{e=(await c.link()).user,fe.current="telegram"}catch(e){throw d.emitPrivyEvent(pe,"linkAccount","onError",e.privyErrorCode||o.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:"telegram"}),e}}C(e),_(t||!1),w(!0)},async recoveryOAuthFlow(e,t,r){let n,i;function a(t){if(!t)throw c.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:"Unable to open recovery OAuth popup",provider:e}}),new o.PrivyClientError("Recovery OAuth failed")}switch(e){case"google-drive":{let t,s,{url:l,codeVerifier:d,stateCode:u}=await cd({api:gg.api,provider:e});a(l);try{let n=await fg({url:l,popup:r,provider:e});if(t=n.stateCode,s=n.authorizationCode,t!==u)throw c.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:e,storedStateCode:u??"",returnedStateCode:t??""}}),new o.PrivyClientError("Unexpected auth flow. This may be a phishing attempt.",void 0,o.PrivyErrorCode.OAUTH_UNEXPECTED)}catch(t){throw c.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:t.toString(),provider:e}}),new o.PrivyClientError("Recovery OAuth failed")}[n,i]=await Promise.all([Sg(),ud({api:gg.api,provider:e,codeVerifier:d,stateCode:t,authorizationCode:s})]);break}case"icloud":{let{url:t}=await cd({api:gg.api,provider:e});a(t);let{ckWebAuthToken:o}=await fg({url:t,popup:r,provider:e});i=o,n=await Sg()}}if(!V)throw new o.PrivyClientError("Cannot connect to wallet proxy");if(!n)throw new o.PrivyClientError("Unable to authorize user");switch(t){case"recover":let t=Q.recoverWallet?.privyWallet?.address;if(!t)throw new o.PrivyClientError("Recovery OAuth failed");c.createAnalyticsEvent({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:t,recoveryMethod:e}}),await V.recover({address:t,accessToken:n,recoveryAccessToken:i,recoveryMethod:e}),c.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:t,recoveryMethod:e}});break;case"create-wallet":c.createAnalyticsEvent({eventName:"embedded_wallet_creation_started"}),await V.create({accessToken:n,recoveryAccessToken:i,recoveryMethod:e});let r=u.getPrivyEthereumWallet(await Be.refreshUser());if(!r)throw d.emitPrivyEvent(pe,"createWallet","onError",o.PrivyErrorCode.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to create wallet");c.createAnalyticsEvent({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:r.address}}),d.emitPrivyEvent(pe,"createWallet","onSuccess",r);break;case"set-recovery":let a=u.getPrivyEthereumWallet(x);if(!a)throw d.emitPrivyEvent(pe,"setWalletRecovery","onError",o.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),Error("Embedded wallet not found");c.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_started",payload:{walletAddress:a.address,existingRecoveryMethod:a.recoveryMethod,targetRecoveryMethod:e}}),await V.setRecovery({address:a.address,accessToken:n,recoveryAccessToken:i,recoveryMethod:e});let s=u.getPrivyEthereumWallet(await Be.refreshUser());if(!s)throw d.emitPrivyEvent(pe,"createWallet","onError",o.PrivyErrorCode.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to set recovery on wallet");c.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:a.address,existingRecoveryMethod:a.recoveryMethod,targetRecoveryMethod:e}}),d.emitPrivyEvent(pe,"setWalletRecovery","onSuccess",e,s);break;default:throw new o.PrivyClientError("Unsupported recovery action")}},async loginWithOAuth(e){let t,r,n;if(!(c.authFlow instanceof Ji))throw new o.PrivyClientError("Must initialize OAuth flow before calling loginWithOAuth");let i=d.e5.get(l.STATE_CODE_KEY),a=c.authFlow.meta.stateCode;if(i!==a)throw c.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:e,storedStateCode:i??"",returnedStateCode:a??""}}),new o.PrivyClientError("Unexpected auth flow. This may be a phishing attempt.",void 0,o.PrivyErrorCode.OAUTH_UNEXPECTED);if(null!==await c.getAccessToken())try{let r=await c.link();t=r.user,n=r.oAuthTokens,fe.current=e}catch(t){throw d.emitPrivyEvent(pe,"linkAccount","onError",t.privyErrorCode||o.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:e}),t}else try{let i=await c.authenticate();t=i.user,r=i.isNewUser,n=i.oAuthTokens,fe.current=e}catch(t){throw"login"===ge.current?d.emitPrivyEvent(pe,"login","onError",t.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR):"link"===ge.current&&d.emitPrivyEvent(pe,"linkAccount","onError",t.privyErrorCode||o.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:e}),t}return C(t),_(r||!1),w(!0),n&&t&&d.emitPrivyEvent(pe,"oAuthAuthorization","onOAuthTokenGrant",n,{user:t}),n},passkeyAuthState:F,setPasskeyAuthState:L,async initLoginWithPasskey(e){let t=new ya(e,L);c.startAuthFlow(t),ge.current="login";try{fe.current="passkey",L({status:"generating-challenge"}),await t.initAuthenticationFlow(),L({status:"awaiting-passkey"})}catch(e){throw L({status:"error",error:e}),d.emitPrivyEvent(pe,"login","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR),e}},async loginWithPasskey(){let e,t;if(!y)throw new o.PrivyNotReadyError;if(!(c.authFlow instanceof ya))throw new o.PrivyClientError("Must initialize Passkey flow first.");if("passkey"!==fe.current){let e=new o.PrivyClientError("Must init login with Passkey flow first.");throw L({status:"error",error:e}),e}let r=await Sg();try{fe.current="passkey",L({status:"awaiting-passkey"}),({user:e,isNewUser:t}=await c.authenticate())}catch(e){throw L({status:"error",error:e}),d.emitPrivyEvent(pe,"login","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR),e}C(e),_(t||!1),w(!0),L({status:"done"});let n=e?.linkedAccounts.find((({type:e})=>"passkey"===e))||null;return{user:e,isNewUser:t||!1,wasAlreadyAuthenticated:!!r,loginAccount:n}},async initLinkWithPasskey(e){let t=new ya(e);c.startAuthFlow(t),ge.current="link",fe.current="passkey";try{await t.initLinkFlow()}catch(e){throw d.emitPrivyEvent(pe,"linkAccount","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR,{linkMethod:"passkey"}),e}},async linkWithPasskey(){let e;if(!y)throw new o.PrivyNotReadyError;if(!(c.authFlow instanceof ya))throw new o.PrivyClientError("Must initialize Passkey flow first.");if("passkey"!==fe.current)throw new o.PrivyClientError("Must init login with Passkey flow first.");try{fe.current="passkey",({user:e}=await c.link())}catch(e){throw d.emitPrivyEvent(pe,"linkAccount","onError",e.privyErrorCode||o.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:"passkey"}),e}return C(e||x||null),e},async initLoginWithHeadlessOAuth(e,t){if(!d.e())throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.");if("google"===e&&jl(window.navigator.userAgent))throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.");let r=new Ji({provider:e,headless:!0,disableSignup:!1});t&&r.addCaptchaToken(t),z({status:"loading"});let n=await c.startAuthFlow(r).getAuthorizationUrl();n?.url&&window.location.assign(n.url)},async loginWithHeadlessOAuth(e){let t,r,n;M(!0),z({status:"loading"}),c.startAuthFlow(new Ji(e));let i=d.e5.get(l.STATE_CODE_KEY),a=e.stateCode;if(i!==a)throw c.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:e.provider,storedStateCode:i??"",returnedStateCode:a??""}}),M(!1),new o.PrivyClientError("Unexpected auth flow. This may be a phishing attempt.",void 0,o.PrivyErrorCode.OAUTH_UNEXPECTED);if(null!==await c.getAccessToken())try{({user:t,oAuthTokens:n}=await c.link()),fe.current=e.provider;let r=Fe(t);t&&r&&d.emitPrivyEvent(pe,"linkAccount","onSuccess",t,fe.current,r)}catch(t){throw M(!1),d.emitPrivyEvent(pe,"linkAccount","onError",t.privyErrorCode||o.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:e.provider}),t}else try{({user:t,isNewUser:r,oAuthTokens:n}=await c.authenticate()),fe.current=e.provider;let i=Fe(t);t&&i&&void 0!==r&&"login"===ge.current&&d.emitPrivyEvent(pe,"login","onComplete",t,r,!1,fe.current,i)}catch(e){throw M(!1),z({status:"error",error:e}),d.emitPrivyEvent(pe,"login","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR),e}return C(t),_(r||!1),w(!0),M(!1),z({status:"done"}),n&&t&&d.emitPrivyEvent(pe,"oAuthAuthorization","onOAuthTokenGrant",n,{user:t}),t??void 0},initLoginWithEmail:async(e,t,r)=>{let n=new Mi(e,t,r);c.startAuthFlow(n);try{fe.current="email",D({status:"sending-code"}),await n.sendCodeEmail(),D({status:"awaiting-code-input"})}catch(e){throw D({status:"error",error:e}),"login"===ge.current?d.emitPrivyEvent(pe,"login","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR):"link"===ge.current&&d.emitPrivyEvent(pe,"linkAccount","onError",e.privyErrorCode||o.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:"email"}),e}},initUpdateEmail:async(e,t,r)=>{let n=new Oi(e,t,r);c.startAuthFlow(n),await n.sendCodeEmail()},initUpdatePhone:async(e,t,r)=>{let n=new wa(e,t,r);c.startAuthFlow(n),await n.sendSmsCode()},initLoginWithSms:async(e,t,r)=>{B({status:"sending-code"});let n=new va(e,t,r);c.startAuthFlow(n);try{fe.current="sms",await n.sendSmsCode(),B({status:"awaiting-code-input"})}catch(e){throw B({status:"error",error:e}),"login"===ge.current?d.emitPrivyEvent(pe,"login","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR):"link"===ge.current&&d.emitPrivyEvent(pe,"linkAccount","onError",e.privyErrorCode||o.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:"sms"}),e}},resendEmailCode:async()=>{await(c.authFlow?.sendCodeEmail())},resendSmsCode:async()=>{await(c.authFlow?.sendSmsCode())},loginWithCode:async e=>{let t,r;function n(e){c.authFlow instanceof Mi?D(e):c.authFlow instanceof va&&B(e)}if(n({status:"submitting-code"}),!y){let e=new o.PrivyNotReadyError;throw n({status:"error",error:e}),e}if(c.authFlow instanceof Mi)c.authFlow.meta.emailCode=e.trim();else{if(!(c.authFlow instanceof va)){let e=new o.PrivyClientError("Must initialize a passwordless code flow first");throw n({status:"error",error:e}),e}c.authFlow.meta.smsCode=e.trim()}let i=await Sg();if("link"===ge.current)try{({user:t}=await c.link())}catch(e){throw n({status:"error",error:e}),d.emitPrivyEvent(pe,"linkAccount","onError",e.privyErrorCode||o.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:fe.current}),e}else try{({user:t,isNewUser:r}=await c.authenticate())}catch(e){throw n({status:"error",error:e}),d.emitPrivyEvent(pe,"login","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR),e}let a=t||x;C(a||null),_(r||!1),w(!0),n({status:"done"});let s=null;return c.authFlow instanceof Mi?s=a?.linkedAccounts.find((({type:e})=>"email"===e))||null:c.authFlow instanceof va&&(s=a?.linkedAccounts.find((({type:e})=>"phone"===e))||null),{user:a,isNewUser:r||!1,wasAlreadyAuthenticated:!!i,linkedAccount:s}},generateSiweMessage:async({address:e,chainId:t,captchaToken:r})=>{ge.current="link",fe.current="siwe",G({status:"generating-message"});let n=await c.generateSiweNonce({address:e,captchaToken:r});return G({status:"awaiting-signature"}),ma({address:e,chainId:t.replace("eip155:",""),nonce:n})},linkSmartWallet:async({message:e,signature:t,smartWalletType:r})=>{let n;ge.current=null,fe.current=null;try{n=await c.linkSmartWallet({message:e,signature:t,smartWalletType:r}),n=await Be.refreshUser()??n}catch(e){throw e}C(n||x||null)},linkWithSiwe:async({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i})=>{let a,s=null;try{G({status:"submitting-signature"}),a=await c.linkWithSiwe({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i}),a=await Be.refreshUser()??a,G({status:"done"}),(s=Fe(a)||null)&&d.emitPrivyEvent(pe,"linkAccount","onSuccess",a,"siwe",s)}catch(e){throw d.emitPrivyEvent(pe,"linkAccount","onError",e.privyErrorCode||o.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:"siwe"}),ge.current=null,fe.current=null,G({status:"error",error:e}),e}let l=a||x;return C(l||null),ge.current=null,fe.current=null,{user:l,linkedAccount:s}},refreshUser:async()=>{let e=await c.getAuthenticatedUser();return w(!!e),C(e),e},walletProxy:V,createAnalyticsEvent:({eventName:e,payload:t,timestamp:r})=>c.createAnalyticsEvent({eventName:e,payload:t,timestamp:r}),acceptTerms:async()=>{let e=await c.acceptTerms();return C(e),e},getUsdTokenPrice:e=>c.getUsdTokenPrice(e),getUsdPriceForSol:()=>c.getUsdPriceForSol(),recoverEmbeddedEthereumWallet:async e=>new Promise((async(t,r)=>{let n=u.getPrivyEthereumWallet(e?.user??x)||u.getImportedPrivyEthereumWallet(e?.user??x),i=await Sg();if(i&&V&&n){J(!0);try{await V.connect({accessToken:i,address:n.address}),t(!0)}catch(e){td(e)&&"privy"===n.recoveryMethod?(c.createAnalyticsEvent({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:n.address}}),(await V.recover({address:n.address,accessToken:i,recoveryMethod:n.recoveryMethod})).address||r(Error("Unable to recover wallet")),c.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:n.address}}),t(!0)):td(e)&&"privy"!==n.recoveryMethod?(ee({recoverWallet:{privyWallet:n,onFailure:r,onSuccess:()=>t(!0)},recoveryOAuthStatus:{provider:n.recoveryMethod,action:"recover"}}),we(dd(n.recoveryMethod))):r(e)}}else r(Error("Must have valid access token and Privy wallet to recover wallet"))})),embeddedSolanaWallet:j,createEmbeddedSolanaWallet:async()=>{J(!0);let e=await Sg(),t=await Be.refreshUser(),r=u.getPrivySolanaWallet(t),n=u.getPrivyEthereumWallet(t);if(!t||!e)throw new o.PrivyClientError("User must be logged in to create a Solana wallet");if(r)throw new o.PrivyClientError("User already has an embedded Solana wallet.");if(n){if("privy"!==n.recoveryMethod)throw new o.PrivyClientError("Cannot create an embedded Solana wallet for a user with an existing Ethereum wallet with user-controlled recovery.");await Be.recoverEmbeddedEthereumWallet({user:t})}let i=await Be.initializeWalletProxy(15e3);if(!i)throw new o.PrivyClientError("Unable to initialize wallet proxy");c.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_started"});try{await i.createSolana({accessToken:e,ethereumAddress:n?.address});let t=await Be.refreshUser(),r=u.getPrivySolanaWallet(t);if(!r)throw new o.PrivyClientError("Could not get Solana wallet for user");return c.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_completed",payload:{walletAddress:r.address}}),r}catch(e){throw c.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_failed"}),new o.PrivyClientError("Failed to create Solana embedded wallet with error ",e)}},exportSolanaWallet:e=>new Promise((async(t,r)=>{if(!v||!x)return void r(Error("User must be authenticated before exporting their Privy wallet"));let n=e?.address,i=x.linkedAccounts.filter((e=>"wallet"===e.type&&"privy"===e.walletClientType&&"solana"===e.chainType)),a=n?i.find((e=>e.address.toLowerCase()===n.toLowerCase())):i.find((e=>!e.imported))||i[0];a?(J(!0),await Sg()&&V?V?(await Be.recoverEmbeddedSolanaWallet(),ee({keyExport:{appId:s.appId,appClientId:s.clientId,origin:c.apiUrl,wallet:a,onSuccess:t,onFailure:r}}),we(g.ModalScreen.EMBEDDED_WALLET_KEY_EXPORT_SCREEN)):r(Error("Must have a Privy wallet before exporting")):r(Error("Must have valid access token to enroll in MFA"))):r(Error("Must have a Privy wallet before exporting"))})),recoverEmbeddedSolanaWallet:async()=>new Promise((async(e,t)=>{let r=u.getPrivySolanaWallet(x),n=await Sg();if(n&&V&&r){J(!0);try{await V.connectSolana({accessToken:n,publicKey:r.address}),e(!0)}catch(i){td(i)&&"privy"===r.recoveryMethod?(c.createAnalyticsEvent({eventName:"embedded_solana_wallet_pinless_recovery_started",payload:{walletAddress:r.address}}),(await V.recoverSolana({publicKey:r.address,accessToken:n})).publicKey||t(Error("Unable to recover wallet")),c.createAnalyticsEvent({eventName:"embedded_solana_wallet_recovery_completed",payload:{walletAddress:r.address}}),e(!0)):t(i)}}else t(Error("Must have valid access token and Privy wallet to recover wallet"))})),getMoonpaySignedUrl:async(e,t)=>{let{signedUrl:r,externalTransactionId:n}=await async function(e,t,r,n,i=!1){let a=r.currencyCode?{}:{defaultCurrencyCode:"ETH_ETHEREUM"},o=r.uiConfig||{accentColor:n.accent,theme:n.colorScheme};return e.signMoonpayOnRampUrl({address:t,useSandbox:i,config:{...r,...a,...o}})}(c,e,t??{},Y.appearance.palette,Y.fundingMethodConfig?.moonpay.useSandbox??!1);return{signedUrl:r,externalTransactionId:n}},initCoinbaseOnRamp:c.initCoinbaseOnRamp.bind(c),getCoinbaseOnRampStatus:c.getCoinbaseOnRampStatus.bind(c),setReadyToTrue:e=>{f(!0),te?.(e)},updateWallets:()=>Ne(),fundWallet:async(e,t)=>{if(!Y.fundingConfig||0===Y.fundingConfig.methods.length)throw Error("Wallet funding is not enabled");let r=pf({fundingMethods:Y.fundingConfig.methods});ee({funding:df({address:e,appConfig:Y,fundWalletConfig:t,methodScreen:r})}),we(r)},requestFarcasterSignerStatus:async e=>{let t=await Sg(),r=x?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!t)throw Error("Must have valid access token to connect with Farcaster");if(!V||!r)throw Error("Must have an embedded wallet to use Farcaster signers");if(!x?.farcaster?.fid)throw Error("Must have Farcaster account to use Farcaster signers");let n=await c.requestFarcasterSignerStatus(e);return"approved"===n.status&&C(await c.getAuthenticatedUser()||x||null),n},connectCoinbaseSmartWallet:async()=>{Y.externalWallets.coinbaseWallet.connectionOptions="smartWalletOnly";let e=c.connectors?.findWalletConnector("coinbase_wallet","coinbase_smart_wallet")||c.connectors?.findWalletConnector("coinbase_wallet","coinbase_wallet");if(e)return e.updateConnectionPreference("smartWalletOnly"),Se(e);await be("coinbase_wallet","coinbase_smart_wallet")},initiateAccountTransfer:async({nonce:e,account:t,accountType:r,externalWalletMetadata:n,telegramAuthResult:i,farcasterEmbeddedAddress:a,oAuthUserInfo:o})=>{try{let s=await c.sendAccountTransferRequest({nonce:e,account:t,accountType:r,externalWalletMetadata:n,telegramAuthResult:i,farcasterEmbeddedAddress:a,oAuthUserInfo:o});return C(s),s}catch(e){throw e}}};Cg=Be.recoverEmbeddedEthereumWallet,Eg=Be.recoverEmbeddedSolanaWallet,bg=Be.solanaSignMessage;let He=i.useMemo((()=>({wallets:E,ready:ae&&ye})),[E,ae,ye]);return e.jsx(o.PrivyContext.Provider,{value:We,children:e.jsx(d.PrivyEventsContext.Provider,{value:pe,children:e.jsx(l.UseWalletsContext.Provider,{value:He,children:e.jsx(fo,{...Y,children:e.jsxs(o.InternalPrivyContext.Provider,{value:Be,children:[e.jsx(d.RecentlyUsedAccountProvider,{children:e.jsxs(g.ModalProvider,{data:Q,setModalData:ee,setInitialScreen:N,initialScreen:k,authenticated:v,open:h,children:[s.children,!Y.headless&&Y.captchaEnabled&&y&&!v&&e.jsx(vo,{delayedExecution:!1}),e.jsx(Wf,{theme:{...Y.appearance.palette||{}}}),!Y.render.standalone&&e.jsx(Qf,{open:h})]})}),X&&Z?e.jsx(hg,{appId:s.appId,appClientId:s.clientId,clientAnalyticsId:c.clientAnalyticsId,origin:c.apiUrl,mfaMethods:x?.mfaMethods,mfaPromise:ue,mfaSubmitPromise:he,onLoad:K,onLoadFailed:()=>null}):null,Y.loginConfig.telegramAuthConfiguration&&e.jsx(ns,{$if:!0,children:e.jsx(rg,{scriptHost:s.apiUrl||l.DEFAULT_PRIVY_API_URL,botUsername:Y.loginConfig.telegramAuthConfiguration.botName})})]})})})})})};let Ng=async(e,t,r,n,i)=>{if(!e)throw n("linkAccount","onError",o.PrivyErrorCode.MUST_BE_AUTHENTICATED,{linkMethod:i}),new o.PrivyClientError("User must be authenticated before linking an account.");if(!t?.linkedAccounts.some((e=>e.type.includes(i))))throw new o.PrivyClientError(`OAuth account of type ${i} not linked to the account.`);await r(i)};const Ig=Mg;function Mg(){let{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}=o.usePrivy();return{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}}exports.usePrivy=o.usePrivy,exports.SUPPORTED_CHAINS=l.DEFAULT_SUPPORTED_CHAINS,exports.VERSION=l.VERSION,exports.addRpcUrlOverrideToChain=l.addRpcUrlOverrideToChain,exports.useWallets=l.useWallets,exports.useConnectWallet=d.useConnectWallet,exports.useFundWallet=d.useFundWallet,exports.useLogin=d.useLogin,exports.useLogout=d.useLogout,exports.WalletConnector=m.WalletConnector,exports.useSolanaWallets=m.useSolanaWallets,exports.getEmbeddedConnectedWallet=g.getEmbeddedConnectedWallet,exports.AsExternalProvider=Ta,exports.Captcha=vo,exports.ConnectorManager=eo,exports.EthereumWalletConnector=Ia,exports.LoginModal=Qf,exports.PrivyClient=ho,exports.PrivyProvider=({config:t,...r})=>{var n;if("undefined"!=typeof window&&0>["localhost","127.0.0.1"].indexOf(window.location.hostname)&&"https:"!==window.location.protocol)throw new o.PrivyClientError("Embedded wallet is only available over HTTPS");if("string"!=typeof(n=r.appId)||25!==n.length)throw new o.PrivyClientError("Cannot initialize the Privy provider with an invalid Privy app ID");gg||(gg=new ho({appId:r.appId,appClientId:r.clientId,apiUrl:r.apiUrl}));let i=Object.assign({},t);return void 0!==r.createPrivyWalletOnLogin&&void 0===i.embeddedWallets?.createOnLogin&&(i.embeddedWallets||(i.embeddedWallets={}),i.embeddedWallets.createOnLogin=r.createPrivyWalletOnLogin?"users-without-wallets":"off"),void 0!==r.createPrivyWalletOnLogin&&t?.embeddedWallets?.createOnLogin&&console.warn("Both `createPrivyWalletOnLogin` and `config.embeddedWallets.createOnLogin` are set. `createPrivyWalletOnLogin` is deprecated and should be removed."),e.jsx(l.PrivyAppConfigProvider,{client:gg,clientConfig:i,legacyCreateEmbeddedWalletFlag:r.createPrivyWalletOnLogin,children:e.jsx(kg,{...r,client:gg})})},exports.PrivyProxyProvider=Aa,exports.errorIndicatesMaxMfaRetries=id,exports.errorIndicatesMfaTimeout=rd,exports.errorIndicatesMfaVerificationFailed=nd,exports.getAccessToken=Sg,exports.useConnectCoinbaseSmartWallet=()=>{let{connectCoinbaseSmartWallet:e}=o.usePrivyInternal();return{connectCoinbaseSmartWallet:e}},exports.useCreateWallet=function(e){let{createWallet:t}=i.useContext(o.PrivyContext);return d.usePrivyEventSubscription("createWallet",e),{createWallet:t}},exports.useCrossAppAccounts=()=>{let{startCrossAppAuthFlow:e,unlinkCrossAppAccount:t,signMessageWithCrossAppWallet:r,signTypedDataWithCrossAppWallet:n,sendTransactionWithCrossAppWallet:i}=o.usePrivy();return{loginWithCrossAppAccount:({appId:t})=>e({appId:t,action:"login"}),linkCrossAppAccount:({appId:t})=>e({appId:t,action:"link"}),unlinkCrossAppAccount:t,signMessage:r,signTypedData:n,sendTransaction:i}},exports.useCustomAuth=e=>{let{customAuthStatus:t}=o.usePrivyInternal();return d.usePrivyEventSubscription("customAuth",e),{status:t}},exports.useExperimentalFarcasterSigner=Ig,exports.useFarcasterSigner=Mg,exports.useGuestAccounts=function(){let{createGuestAccount:e}=i.useContext(o.PrivyContext);return{createGuestAccount:e}},exports.useLinkAccount=function(e){let{linkEmail:t,linkPhone:r,linkWallet:n,linkGoogle:a,linkApple:s,linkTwitter:l,linkDiscord:c,linkGithub:u,linkLinkedIn:h,linkTiktok:p,linkSpotify:y,linkInstagram:m,linkTelegram:f,linkFarcaster:g}=i.useContext(o.PrivyContext);return d.usePrivyEventSubscription("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:n,linkGoogle:a,linkApple:s,linkTwitter:l,linkDiscord:c,linkGithub:u,linkLinkedIn:h,linkTiktok:p,linkSpotify:y,linkInstagram:m,linkFarcaster:g,linkTelegram:f}},exports.useLinkWithSiwe=e=>{let t=go(),{generateSiweMessage:r}=o.usePrivy(),{siweState:n,setSiweState:a,linkWithSiwe:s}=o.usePrivyInternal();return{generateSiweMessage:i.useCallback((async({address:t,chainId:n})=>{try{if(!t||!n)throw Error("wallet address and chainId required to generate nonce");return await r({address:t,chainId:n}).then((e=>e))}catch(t){throw a({status:"error",error:t}),e?.onError?.(t.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR,{linkMethod:"siwe"}),t}}),[r]),linkWithSiwe:i.useCallback((async({signature:r,message:n,chainId:i,walletClientType:l,connectorType:d})=>{try{if(t.enabled&&"success"!==t.status)throw new mo(t.error,null,o.PrivyErrorCode.CAPTCHA_FAILURE);let{user:a,linkedAccount:c}=await s({message:n,signature:r,chainId:i,walletClientType:l,connectorType:d});c&&e?.onSuccess?.(a,"siwe",c)}catch(r){throw a({status:"error",error:r}),e?.onError?.(r.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR,{linkMethod:"siwe"}),r}}),[s,t.status]),state:n}},exports.useLoginWithEmail=e=>{let t=go(),{emailOtpState:r,setEmailOtpState:n,initLoginWithEmail:a,loginWithCode:s}=o.usePrivyInternal();return{sendCode:i.useCallback((async({email:r})=>{try{let e;if(!r)throw Error("Email required to send OTP code");if(t.enabled&&"error"===t.status)throw new mo(t.error,null,o.PrivyErrorCode.CAPTCHA_FAILURE);return t.enabled&&"success"!==t.status&&(t.execute(),e=await t.waitForResult()),await a(r,e)}catch(r){throw n({status:"error",error:r}),e?.onError?.(r.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR),r}}),[a]),loginWithCode:i.useCallback((async({code:r})=>{try{if(t.enabled&&"error"===t.status)throw new mo(t.error,null,o.PrivyErrorCode.CAPTCHA_FAILURE);let{user:n,isNewUser:i,wasAlreadyAuthenticated:a,linkedAccount:l}=await s(r);e?.onComplete?.(n,i,a,"email",l)}catch(r){throw n({status:"error",error:r}),e?.onError?.(r.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR),r}}),[s,t.status]),state:r}},exports.useLoginWithOAuth=e=>{d.usePrivyEventSubscription("login",e);let t=go(),r=l.useIsServerConfigLoaded(),{initLoginWithHeadlessOAuth:n,loginWithHeadlessOAuth:a,isHeadlessOAuthLoading:s,ready:c,user:u}=o.usePrivy(),{oAuthState:h,setOAuthState:p}=o.usePrivyInternal(),y=i.useCallback((async e=>{try{if(t.enabled&&"success"!==t.status)throw new mo(t.error,null,o.PrivyErrorCode.CAPTCHA_FAILURE);return await n(e.provider,t.token)}catch(e){throw p({status:"error",error:e}),e}}),[n,t]),m=i.useCallback((async()=>{let e=ha();try{if(u)return console.warn("Cannot login with OAuth when already logged in"),u;if(!e.inProgress)throw Error("Cannot login with OAuth because no OAuth flow is in progress");if(e.popupFlow)return}catch(e){throw p({status:"error",error:e}),e}try{return await a(e)}catch(e){throw p({status:"error",error:e}),e}finally{pa()}}),[a]);return i.useEffect((()=>{let e=ha();c&&r&&e.inProgress&&e.headless&&!e.popupFlow&&m()}),[c,r]),{initOAuth:y,loginWithOAuth:m,loading:s,state:h}},exports.useLoginWithPasskey=e=>{let t=go(),{initLoginWithPasskey:r,loginWithPasskey:n,passkeyAuthState:a,setPasskeyAuthState:s}=o.usePrivyInternal();return{loginWithPasskey:i.useCallback((async()=>{try{let i;if(t.enabled&&"error"===t.status)throw new mo(t.error,null,o.PrivyErrorCode.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),i=await t.waitForResult()),await r(i);let{user:a,isNewUser:s,wasAlreadyAuthenticated:l,loginAccount:d}=await n();e?.onComplete?.(a,s,l,"passkey",d)}catch(t){throw s({status:"error",error:t}),e?.onError?.(t),t}}),[n,t.status]),state:a}},exports.useLoginWithSms=e=>{let t=go(),{smsOtpState:r,setSmsOtpState:n,initLoginWithSms:a,loginWithCode:s}=o.usePrivyInternal();return{sendCode:i.useCallback((async({phoneNumber:r})=>{try{let e;if(!r)throw Error("SMS required to send OTP code");if(t.enabled&&"error"===t.status)throw new mo(t.error,null,o.PrivyErrorCode.CAPTCHA_FAILURE);return t.enabled&&"success"!==t.status&&(t.execute(),e=await t.waitForResult()),await a(r,e)}catch(r){throw n({status:"error",error:r}),e?.onError?.(r.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR),r}}),[a]),loginWithCode:i.useCallback((async({code:r})=>{try{if(t.enabled&&"success"!==t.status)throw new mo(t.error,null,o.PrivyErrorCode.CAPTCHA_FAILURE);let{user:n,isNewUser:i,wasAlreadyAuthenticated:a,linkedAccount:l}=await s(r);e?.onComplete?.(n,i,a,"sms",l)}catch(r){throw n({status:"error",error:r}),e?.onError?.(r.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR),r}}),[s,t.status]),state:r}},exports.useMfa=Rp,exports.useMfaEnrollment=Fp,exports.useModalStatus=()=>{let{isModalOpen:e}=i.useContext(o.PrivyContext);return{isOpen:e}},exports.useOAuthTokens=function(e){let{authenticated:t,user:r}=o.usePrivy(),{initLoginWithOAuth:n}=o.usePrivyInternal(),i=d.useEmitPrivyEvent();return d.usePrivyEventSubscription("oAuthAuthorization",e),{reauthorize:e=>Ng(t,r,n,i,e.provider)}},exports.useRegisterMfaListener=wo,exports.useSendSolanaTransaction=function(e){let{sendSolanaTransaction:t}=i.useContext(o.PrivyContext);return d.usePrivyEventSubscription("sendSolanaTransaction",e),{sendSolanaTransaction:t}},exports.useSendTransaction=function(e){let{sendTransaction:t}=i.useContext(o.PrivyContext);return d.usePrivyEventSubscription("sendTransaction",e),{sendTransaction:t}},exports.useSetWalletPassword=function(e){let{setWalletPassword:t}=i.useContext(o.PrivyContext);return d.usePrivyEventSubscription("setWalletPassword",e),{setWalletPassword:t}},exports.useSetWalletRecovery=function(e){let{setWalletRecovery:t}=i.useContext(o.PrivyContext);return d.usePrivyEventSubscription("setWalletRecovery",e),{setWalletRecovery:t}},exports.useSignMessage=function(e){let{signMessage:t}=i.useContext(o.PrivyContext);return d.usePrivyEventSubscription("signMessage",e),{signMessage:t}},exports.useSignTypedData=function(e){let{signTypedData:t}=i.useContext(o.PrivyContext);return d.usePrivyEventSubscription("signTypedData",e),{signTypedData:t}},exports.useToken=function(e){let{getAccessToken:t}=i.useContext(o.PrivyContext);return d.usePrivyEventSubscription("accessToken",e),{getAccessToken:t}};
|
|
3118
|
+
`;function rg(t){let r=i.useRef(null),n=i.useRef();return i.useEffect((()=>{n.current?.remove(),n.current=function({botUsername:e,scriptHost:t}){let r=document.createElement("script"),{origin:n}=new URL(t);return r.async=!0,r.src=`${n}/js/telegram-login.js`,r.setAttribute("data-telegram-login",e),r.setAttribute("data-request-access","write"),r.setAttribute("data-lang","en"),r}(t),r.current?.after(n.current)}),[t]),e.jsx("div",{ref:r,hidden:!0})}async function ng(e,t,r,n,i,a=!1){let o=a,s=async s=>{if(o&&t&&t.length>0){s===(a?0:1)?i("configureMfa","onMfaRequired",t):n.current?.reject(new Ql("missing_or_invalid_mfa","MFA verification failed, retry."));let o=await new Promise(((e,t)=>{r.current={resolve:e,reject:t},setTimeout((()=>{let e=new Ql("mfa_timeout","Timed out waiting for MFA code");n.current?.reject(e),t(e)}),3e5)}));return await e(o)}return await e()},l=null;for(let e=0;e<4;e++)try{l=await s(e),n.current?.resolve(void 0);break}catch(e){if("missing_or_invalid_mfa"!==e.type)throw n.current?.resolve(void 0),e;o=!0}if(null===l){let e=new Ql("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw n.current?.reject(e),e}return l}var ig;let ag=(ig=0,()=>"id-"+ig++);function og(e){return void 0!==e.error}let sg=new class{enqueue(e,t){this.callbacks[e]=t}dequeue(e,t){let r=this.callbacks[t];if(!r)throw Error(`cannot dequeue ${e} event: no event found for id ${t}`);switch(delete this.callbacks[t],e){case"privy:iframe:ready":case"privy:wallet:create":case"privy:wallet:create-additional":case"privy:wallet:import":case"privy:wallet:connect":case"privy:wallet:recover":case"privy:wallet:rpc":case"privy:wallet:set-recovery":case"privy:mfa:verify":case"privy:mfa:init-enrollment":case"privy:mfa:submit-enrollment":case"privy:mfa:unenroll":case"privy:mfa:clear":case"privy:farcaster:init-signer":case"privy:farcaster:sign":case"privy:solana-wallet:create":case"privy:solana-wallet:connect":case"privy:solana-wallet:recover":case"privy:solana-wallet:rpc":case"privy:delegated-actions:consent":return r;default:throw Error(`invalid wallet event type ${e}`)}}constructor(){this.callbacks={}}},lg=new Map,dg=(e,t)=>"bigint"==typeof t?t.toString():t,cg=(e,t)=>`${e}${JSON.stringify(t,dg)}`;function ug(e,t,r,n){let i=r.contentWindow;if(!i)throw Error("iframe not initialized");let a=cg(e,t);if("privy:wallet:create"===e){let e=lg.get(a);if(e)return e}let o=new Promise(((r,a)=>{let o=ag();sg.enqueue(o,{resolve:r,reject:a}),i.postMessage({id:o,event:e,data:t},n)})).finally((()=>{lg.delete(a)}));return lg.set(a,o),o}function hg(t){let r=i.useRef(null),n=i.useRef(t.mfaMethods),a=d.useEmitPrivyEvent(),[o,s]=i.useState(!1);return i.useEffect((()=>{n.current=t.mfaMethods}),[t.mfaMethods]),i.useEffect((()=>{if(!o)return;let e=r.current;if(!e)return;function i(e){var r;e&&e.origin===t.origin&&"string"==typeof(r=e.data).event&&/^privy:.+/.test(r.event)&&function(e){switch(e.event){case"privy:iframe:ready":let t=sg.dequeue(e.event,e.id);return og(e)?t.reject(new Ql(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=sg.dequeue(e.event,e.id);return og(e)?r.reject(new Ql(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:create-additional":let n=sg.dequeue(e.event,e.id);return og(e)?n.reject(new Ql(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:import":let i=sg.dequeue(e.event,e.id);return og(e)?i.reject(new Ql(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:connect":let a=sg.dequeue(e.event,e.id);return og(e)?a.reject(new Ql(e.error.type,e.error.message)):a.resolve(e.data);case"privy:wallet:recover":let o=sg.dequeue(e.event,e.id);return og(e)?o.reject(new Ql(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:rpc":let s=sg.dequeue(e.event,e.id);return og(e)?s.reject(new Ql(e.error.type,e.error.message)):s.resolve(e.data);case"privy:wallet:set-recovery":let l=sg.dequeue(e.event,e.id);return og(e)?l.reject(new Ql(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:verify":let d=sg.dequeue(e.event,e.id);return og(e)?d.reject(new Ql(e.error.type,e.error.message)):d.resolve(e.data);case"privy:mfa:init-enrollment":{let t=sg.dequeue(e.event,e.id);return og(e)?t.reject(new Ql(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:mfa:submit-enrollment":{let t=sg.dequeue(e.event,e.id);return og(e)?t.reject(new Ql(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:mfa:unenroll":{let t=sg.dequeue(e.event,e.id);return og(e)?t.reject(new Ql(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:mfa:clear":{let t=sg.dequeue(e.event,e.id);return og(e)?t.reject(new Ql(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:farcaster:init-signer":{let t=sg.dequeue(e.event,e.id);return og(e)?t.reject(new Ql(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:farcaster:sign":{let t=sg.dequeue(e.event,e.id);return og(e)?t.reject(new Ql(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:solana-wallet:create":let c=sg.dequeue(e.event,e.id);return og(e)?c.reject(new Ql(e.error.type,e.error.message)):c.resolve(e.data);case"privy:solana-wallet:connect":let u=sg.dequeue(e.event,e.id);return og(e)?u.reject(new Ql(e.error.type,e.error.message)):u.resolve(e.data);case"privy:solana-wallet:recover":let h=sg.dequeue(e.event,e.id);return og(e)?h.reject(new Ql(e.error.type,e.error.message)):h.resolve(e.data);case"privy:solana-wallet:rpc":{let t=sg.dequeue(e.event,e.id);return og(e)?t.reject(new Ql(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:delegated-actions:consent":{let t=sg.dequeue(e.event,e.id);return og(e)?t.reject(new Ql(e.error.type,e.error.message)):t.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}(e.data)}let s={create:r=>ug("privy:wallet:create",r,e,t.origin),createAdditional:r=>ug("privy:wallet:create-additional",r,e,t.origin),import:r=>ug("privy:wallet:import",r,e,t.origin),connect:r=>ug("privy:wallet:connect",r,e,t.origin),recover:r=>ng((n=>ug("privy:wallet:recover",{...r,...n},e,t.origin)),n.current,t.mfaPromise,t.mfaSubmitPromise,a,!r.recoveryMethod||"privy"===r.recoveryMethod),rpc:r=>ng((n=>ug("privy:wallet:rpc",{...r,...n},e,t.origin)),n.current,t.mfaPromise,t.mfaSubmitPromise,a),createSolana:r=>ug("privy:solana-wallet:create",r,e,t.origin),connectSolana:r=>ug("privy:solana-wallet:connect",r,e,t.origin),recoverSolana:r=>ug("privy:solana-wallet:recover",r,e,t.origin),rpcSolana:r=>ug("privy:solana-wallet:rpc",r,e,t.origin),createDelegatedAction:r=>ug("privy:delegated-actions:consent",r,e,t.origin),setRecovery:r=>ng((n=>ug("privy:wallet:set-recovery",{...r,...n},e,t.origin)),n.current,t.mfaPromise,t.mfaSubmitPromise,a),verifyMfa:r=>ng((n=>ug("privy:mfa:verify",{...r,...n},e,t.origin)),n.current,t.mfaPromise,t.mfaSubmitPromise,a,!0),initEnrollMfa:r=>ng((n=>ug("privy:mfa:init-enrollment",{...r,...n},e,t.origin)),n.current,t.mfaPromise,t.mfaSubmitPromise,a),submitEnrollMfa:r=>ng((n=>ug("privy:mfa:submit-enrollment",{...r,...n},e,t.origin)),n.current,t.mfaPromise,t.mfaSubmitPromise,a),unenrollMfa:r=>ng((n=>ug("privy:mfa:unenroll",{...r,...n},e,t.origin)),n.current,t.mfaPromise,t.mfaSubmitPromise,a,!0),clearMfa:r=>ug("privy:mfa:clear",r,e,t.origin),initFarcasterSigner:r=>ug("privy:farcaster:init-signer",r,e,t.origin),signFarcasterMessage:r=>ug("privy:farcaster:sign",r,e,t.origin)};window.addEventListener("message",i);let l=new AbortController;return d.invokeUntilSettled((()=>ug("privy:iframe:ready",{},e,t.origin)),{abortSignal:l.signal}).then((()=>t.onLoad(s)),((...e)=>{console.warn("Privy iframe failed to load: ",...e),t.onLoadFailed()})),()=>{window.removeEventListener("message",i),l.abort()}}),[o]),e.jsx("iframe",{ref:r,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>s(!0),src:d.constructURL(t.origin,`/apps/${t.appId}/embedded-wallets`,{caid:t.clientAnalyticsId,client_id:t.appClientId})})}class pg{async handleSignMessage(e){if(!e.params||"string"!=typeof e.params.message)throw Error("Message must be provided as a string for Solana signMessage RPC");return await _g({message:e.params.message})}async request(e){if(console.debug("EmbeddedSolanaProvider.request() called with args",e),!await Sg())throw Error("User must be authenticated to use embedded Solana wallet");if(!await Pg())throw new o.PrivyClientError("Unable to connect to Solana embedded wallet");if("signMessage"===e.method)return await this.handleSignMessage(e);throw Error("Embedded Solana provider does not yet support this RPC method.")}constructor(e,t){this.walletProxy=e,this.address=t}}const yg="popup-privy-oauth",mg="PRIVY_OAUTH_USE_BROADCAST_CHANNEL";async function fg({url:e,popup:t,provider:r}){return t.location=e,new Promise(((e,r)=>{function n(){t?.close(),window.removeEventListener("message",i)}function i(t){t.data&&("PRIVY_OAUTH_RESPONSE"===t.data.type&&t.data.stateCode&&t.data.authorizationCode&&(e(t.data),n()),"https://cdn.apple-cloudkit.com"===t.origin&&t.data.ckSession&&(e({type:"PRIVY_OAUTH_RESPONSE",ckWebAuthToken:t.data.ckSession}),n()),"PRIVY_OAUTH_ERROR"===t.data.type&&(r(t.data.error),n()))}window.addEventListener("message",i)}))}let gg,vg,wg,xg,Cg,Eg,bg;function Sg(){return gg?gg.getAccessToken():Promise.resolve(d.e5.get(l.TOKEN_STORAGE_KEY)||null)}const Ag=(e,t,r)=>vg(e,t,r),jg=(e,t,r)=>wg(e,t,r),$g=(e,t,r,n)=>xg(e,t,r,n),Tg=()=>Cg(),Pg=()=>Eg(),_g=({message:e})=>bg({message:e});let kg=s=>{let c=s.client,[h,p]=i.useState(!1),[y,f]=i.useState(!1),[v,w]=i.useState(!1),[x,C]=i.useState(null),[E,b]=i.useState([]),[S,A]=i.useState([]),[j,$]=i.useState(null),T=i.useRef(E),[P,_]=i.useState(!1),[k,N]=i.useState(null),[I,M]=i.useState(!1),[O,R]=i.useState({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:o.notImplemented}),[F,L]=i.useState({status:"initial"}),[U,D]=i.useState({status:"initial"}),[W,B]=i.useState({status:"initial"}),[H,G]=i.useState({status:"initial"}),[q,z]=i.useState({status:"initial"}),[V,K]=i.useState(null),Y=l.useAppConfig(),Z=l.useIsServerConfigLoaded(),[X,J]=i.useState(!0),[Q,ee]=i.useState({}),[te,re]=i.useState(null),[ne,ie]=i.useState(null),[ae,oe]=i.useState(!1),[se,le]=i.useState(!1),[de,ce]=i.useState(Y.customAuth?.enabled?{status:"initial"}:{status:"not-enabled"}),ue=i.useRef(null),he=i.useRef(null),pe=i.useRef(d.privyEventsDefault),[ye,me]=i.useState(!1);c.onStoreToken=e=>{e&&d.emitPrivyEvent(pe,"accessToken","onAccessTokenGranted",e)},c.onDeleteToken=()=>{C(null),w(!1),d.emitPrivyEvent(pe,"accessToken","onAccessTokenRemoved")};let fe=i.useRef(null),ge=i.useRef(null),ve=i.useRef(!1),we=e=>{N(e),setTimeout((()=>{p(!0)}),15),c.createAnalyticsEvent({eventName:"modal_open",payload:{initialScreen:e}})},xe=e=>{"off"!==Y.embeddedWallets.createOnLogin&&J(!0),we(e)};i.useEffect((()=>{let e=u.getPrivySolanaWallet(x);if(!e||!V)return void $(null);let t={type:"solana",imported:!1,address:e.address,connectedAt:Date.now(),walletClientType:"privy",connectorType:"embedded",meta:{name:"Privy Wallet",icon:void 0,id:"io.privy.solana.wallet"},linked:!0,fund:()=>{throw new o.PrivyClientError("Funding is not supported for Solana embedded wallets.")},unlink:()=>{throw new o.PrivyClientError("Cannot unlink an embedded Solana wallet")},getProvider:async()=>new pg(V,e.address),signMessage:async e=>{let r=await Sg();if(!r||!V)throw new o.PrivyClientError("Must have valid access token and Privy wallet to send transaction",o.PrivyErrorCode.MUST_BE_AUTHENTICATED);if(!await Be.recoverEmbeddedSolanaWallet().catch((()=>!1)))throw new o.PrivyClientError("Wallet couldn't be connected",o.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR);let{response:n}=await V.rpcSolana({accessToken:r,publicKey:t.address,request:{method:"signMessage",params:{message:Buffer.from(e).toString("base64")}}});return Buffer.from(n.data.signature,"base64")},async sendTransaction(e,t,r){let{signature:n}=await Oe({transaction:e,connection:t,transactionOptions:r,wallet:this});return n},async signTransaction(e){let t=await Sg();if(!t||!V)throw new o.PrivyClientError("Must have valid access token and Privy wallet to send transaction",o.PrivyErrorCode.MUST_BE_AUTHENTICATED);if(!await Be.recoverEmbeddedSolanaWallet().catch((()=>!1)))throw new o.PrivyClientError("Wallet couldn't be connected",o.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR);return await xm({tx:e,accessToken:t,walletProxy:V,transactingWalletAddress:this.address}),e},loginOrLink:async()=>{throw new o.PrivyClientError("Cannot login or link with an embedded Solana wallet")},disconnect:()=>{$(null)},isConnected:async()=>!0};$(t)}),[V,x]),i.useEffect((()=>{if(!x)return void c.connectors?.removeEmbeddedWalletConnectors();let e=u.getPrivyEthereumWallet(x),t=u.getPrivyEthereumHDWallets(x),r=u.getImportedPrivyEthereumWallet(x);e&&t.length||c.connectors?.removeEmbeddedWalletConnectors(),r||c.connectors?.removeImportedWalletConnector(),c.connectors?V?(e&&c.connectors.addEmbeddedWalletConnectors({walletProxy:V,rootWallet:e,embeddedWallets:t,defaultChain:Y.defaultChain,appId:s.appId}),r&&c.connectors.addImportedWalletConnector(V,r.address,Y.defaultChain,s.appId)):console.debug("Failed to add embedded wallet connector: Wallet proxy not initialized"):console.debug("Failed to add embedded wallet connector: Client connectors not initialized")}),[V,x]),i.useEffect((()=>{V&&ne?.(V)}),[V]),i.useEffect((()=>{(async()=>{if(!Y.customAuth?.enabled)return void ce({status:"not-enabled"});J(!0),ce({status:"loading"});let{getCustomAccessToken:e,isLoading:t}=Y.customAuth;if(y&&!t)try{let t=await e();if(!t&&v)return await We.logout(),ce({status:"done"}),void d.emitPrivyEvent(pe,"customAuth","onUnauthenticated");if(!t||v)return void ce({status:"done"});c.startAuthFlow(new Ii(t));let{user:r,isNewUser:n}=await c.authenticate();if(!r)return await We.logout(),ce({status:"error",error:new o.PrivyClientError("Failed to sync with custom auth provider")}),void d.emitPrivyEvent(pe,"customAuth","onUnauthenticated");void 0!==n&&d.emitPrivyEvent(pe,"login","onComplete",r,n,!1,"custom",null),d.emitPrivyEvent(pe,"customAuth","onAuthenticated",{user:r}),ce({status:"done"}),C(r||null),_(n||!1),w(!0),le(!0)}catch(e){console.warn(e),v&&(await We.logout(),d.emitPrivyEvent(pe,"customAuth","onUnauthenticated")),d.emitPrivyEvent(pe,"login","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR),ce({status:"error",error:e})}})()}),[Y.customAuth?.enabled,Y.customAuth?.getCustomAccessToken,Y.customAuth?.isLoading,y,v]),i.useEffect((()=>{se&&V&&x&&u.shouldProceedtoEmbeddedWalletCreationFlow(x,Y.embeddedWallets.createOnLogin)&&(le(!1),Ie(x,l.WALLET_PROXY_TIMEOUT).catch(console.error))}),[se&&V&&x]),i.useEffect((()=>{if(Y.externalWallets.solana.connectors)return Y.externalWallets.solana.connectors.onMount(),()=>Y.externalWallets.solana.connectors?.onUnmount()}),[Y.externalWallets.solana.connectors]),i.useEffect((()=>{!y&&Z&&async function(){let e,t=Ce(),r=Ee();(()=>{let e=new URLSearchParams(window.location.search).get("privy_token");if(!e)return;d.e5.put(l.FORKED_TOKEN_STORAGE_KEY,e);let t=new URL(window.location.href);t.searchParams.delete("privy_token"),window.history.pushState({},"",t)})();let i=n.createStore();c.initializeConnectorManager({walletConnectCloudProjectId:Y.walletConnectCloudProjectId,rpcConfig:Y.rpcConfig,chains:Y.chains,defaultChain:Y.defaultChain,store:i,walletList:Y.appearance.walletList,shouldEnforceDefaultChainOnConnect:Y.shouldEnforceDefaultChainOnConnect,externalWalletConfig:Y.externalWallets,appName:Y.name??"Privy"}),c.connectors?.on("connectorInitialized",(()=>{e&&clearTimeout(e);let t=c.connectors.walletConnectors.length,r=c.connectors.walletConnectors.reduce(((e,t)=>e+(t.initialized?1:0)),0);r===t?me(!0):e=setTimeout((()=>{console.debug({message:"Unable to initialize all expected connectors before timeout",initialized:r,expected:t}),me(!0)}),1500)})),c.connectors?.initialize().then((()=>{$e()}));let a=await c.getAuthenticatedUser(),o=!!a;if(Y.customAuth?.enabled||(w(!!a),a&&d.emitPrivyEvent(pe,"login","onComplete",a,!1,!0,null,null),C(a)),!t)return r&&!o?(ge.current="login",ee({telegramAuthModalData:{seamlessAuth:!0}}),void xe(g.ModalScreen.TELEGRAM_AUTH_SCREEN)):void Be.setReadyToTrue(!!a);ge.current=o?"link":"login"}()}),[c,te,y,Z]),i.useEffect((()=>{if(y){if(!x||!x.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType)))return void oe(!0);oe(!!E.find((e=>"privy"===e.walletClientType)))}}),[y,x,E]);let Ce=()=>{let e=ha();return e.inProgress&&e.popupFlow?window.opener.location.origin!==window.location.origin?void window.opener.postMessage({type:"PRIVY_OAUTH_ERROR",error:"Origins between parent and child windows do not match."}):"error"===e.authorizationCode?void window.opener.postMessage({type:"PRIVY_OAUTH_ERROR",error:"Something went wrong. Try again."}):void window.opener.postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:e.stateCode,authorizationCode:e.authorizationCode}):(e.inProgress&&function(e){return e.startsWith("privy:")}(e.provider)&&!e.popupFlow&&(new BroadcastChannel(yg).postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:e.stateCode,authorizationCode:e.authorizationCode}),window.close()),!!e.inProgress&&!e.headless&&(c.startAuthFlow(new Ji(e)),xe(g.ModalScreen.AWAITING_OAUTH_SCREEN),!0))},Ee=()=>{let e=function(){let e;return(e=function(){let e=new URLSearchParams(window.location.search),t=Number(e.get("id")||""),r=e.get("hash"),n=Number(e.get("auth_date")||""),i=e.get("first_name"),a=e.get("last_name")||void 0,o=e.get("username")||void 0,s=e.get("photo_url")||void 0;if(t&&i&&n&&r)return{id:t,first_name:i,last_name:a,username:o,photo_url:s,auth_date:n,hash:r}}())?(ja(),{...e,flowType:"login-url"}):(e=function(){let e=window.location.hash;if(!e||!e.startsWith("#tgWebAppData"))return;let t=new URLSearchParams(decodeURIComponent(e.replace("#tgWebAppData=",""))),r=t.get("query_id")||void 0,n=t.get("user"),i=Number(t.get("auth_date")||""),a=t.get("hash"),o=t.get("chat_instance")||void 0,s=t.get("chat_type")||void 0,l=t.get("start_param")||void 0;return n&&i&&a?{query_id:r,user:n,auth_date:i,hash:a,chat_instance:o,chat_type:s,start_param:l}:void 0}())?(ja(),{...e,flowType:"web-app"}):void 0}();if(!e||!Y.loginMethods.telegram||!Y.loginConfig.telegramAuthConfiguration?.seamlessAuthEnabled)return;let t=new Sa;return c.startAuthFlow(t),"login-url"===e.flowType&&(t.meta.telegramWebAppData=void 0,t.meta.telegramAuthResult={id:e.id,first_name:e.first_name,last_name:e.last_name,auth_date:e.auth_date,username:e.username,photo_url:e.photo_url,hash:e.hash}),"web-app"===e.flowType&&(t.meta.telegramAuthResult=void 0,t.meta.telegramWebAppData={query_id:e.query_id,user:e.user,auth_date:e.auth_date,hash:e.hash,chat_instance:e.chat_instance,chat_type:e.chat_type,start_param:e.start_param}),!0},be=async(e,t,r,n)=>{Se(await(c.connectors?.createEthereumWalletConnector(e,t))||null,t,r,n)};async function Se(e,t,r,n){if(!e)return R({status:"disconnected",connectedWallet:null,connectError:new o.PrivyConnectorError("Unable to connect to wallet."),connector:null,connectRetry:o.notImplemented}),n?.(null,r);R({status:"disconnected",connectedWallet:null,connectError:null,connector:e,connectRetry:o.notImplemented}),e instanceof to&&t&&await e.resetConnection(t),R({connector:e,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>Se(e,t,r,n)});try{let t=await e.connect({showPrompt:!0});if((!t||Ra(t))&&Y.shouldEnforceDefaultChainOnConnect&&!Y.chains.find((e=>e.id===Number(t?.chainId.replace("eip155:",""))))&&("wallet_connect_v2"!==t?.connectorType||"metamask"!==t?.walletClientType)){R((t=>({...t,connector:e,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:o.notImplemented})));try{await(t?.switchChain(Y.defaultChain.id)),t&&(t.chainId=d.formatChainIdToCAIP2(d.toHex(Y.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${Y.defaultChain.id}`)}}return R((e=>({...e,status:"connected",connectedWallet:t,connectError:null,connectRetry:o.notImplemented}))),t&&d.emitPrivyEvent(pe,"connectWallet","onSuccess",t),n?.(t,r)}catch(e){return e instanceof o.PrivyError?(console.warn(e.cause?e.cause:e.message),d.emitPrivyEvent(pe,"connectWallet","onError",e.privyErrorCode||o.PrivyErrorCode.GENERIC_CONNECT_WALLET_ERROR)):(console.warn(e),d.emitPrivyEvent(pe,"connectWallet","onError",o.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR)),R((t=>({...t,status:"disconnected",connectedWallet:null,connectError:e}))),n?.(null,r)}}let Ae=async(e,t,r)=>{if(null===e||!Ra(e))return;let n=new fa(e,c,t,r);c.startAuthFlow(n)},je=async(e,t)=>{if(null===e||!m.isBaseConnectedSolanaWallet(e))return;let r=new ga(e,c,t);c.startAuthFlow(r)},$e=()=>{let e=new URLSearchParams(window.location.search),t=e.get("privy_connector"),r=e.get("privy_wallet_client");if(!t||!r)return;if("phantom"!==r||d.isPhantomInstalled()||xe(g.ModalScreen.LOGIN_FAILED_SCREEN),!c.connectors)throw new o.PrivyClientError("Connector not initialized");we(g.ModalScreen.AWAITING_CONNECTION);let n=new URL(window.location.href);n.searchParams.delete("privy_connector"),n.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",n),be(t,r,void 0,Ae)};i.useEffect((()=>{y&&v&&null===x&&c.getAuthenticatedUser().then(C)}),[y,v,x,c]);let Te=e=>{if(!v)throw d.emitPrivyEvent(pe,"linkAccount","onError",o.PrivyErrorCode.MUST_BE_AUTHENTICATED,{linkMethod:e}),new o.PrivyClientError("User must be authenticated before linking an account.")},Pe=()=>{Te("siwe"),fe.current="siwe",ge.current="link",we(g.ModalScreen.LINK_WALLET_SCREEN)},_e=e=>{if(!v||!x)return!1;if("privy"===e.walletClientType)return!0;for(let t of x.linkedAccounts)if("wallet"===t.type&&t.address===e.address&&"privy"!==t.walletClientType)return!0;return!1},ke=async e=>{let t;if(!c.connectors)throw new o.PrivyClientError("Connector not initialized");t="ethereum"===e.type?c.connectors.findWalletConnector(e.connectorType,e.walletClientType)||null:c.connectors.findSolanaWalletConnector(e.connectorType,e.walletClientType)||null,R((r=>({...r,connector:t,status:"connected",connectedWallet:e,connectError:null,connectRetry:o.notImplemented}))),Y.captchaEnabled&&!v?(ee({captchaModalData:{callback:t=>Ra(e)?Ae(e,t):je(e,t),userIntentRequired:!1,onSuccessNavigateTo:g.ModalScreen.AWAITING_CONNECTION,onErrorNavigateTo:g.ModalScreen.ERROR_SCREEN}}),xe(g.ModalScreen.CAPTCHA_SCREEN)):(Ra(e)?await Ae(e):await je(e),xe(g.ModalScreen.AWAITING_CONNECTION))},Ne=()=>{b((e=>{let t=c.connectors?.wallets.filter(Ra).map((e=>({...e,linked:_e(e),loginOrLink:async()=>{if(!await e.isConnected())throw new o.PrivyClientError("Wallet is not connected");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new o.PrivyClientError("Cannot link or login with embedded wallet");ke(e)},fund:async t=>{await Be.fundWallet(e.address,t)},unlink:async()=>{if(!v)throw new o.PrivyClientError("User is not authenticated.");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new o.PrivyClientError("Cannot unlink an embedded wallet");C(await c.unlinkEthereumWallet(e.address))}})))||[];return ao(e,t)?e:t})),A((e=>{let t=c.connectors?.wallets.filter(m.isBaseConnectedSolanaWallet).map((e=>({...e,linked:_e(e),loginOrLink:async()=>{if(!await e.isConnected())throw new o.PrivyClientError("Wallet is not connected");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new o.PrivyClientError("Cannot link or login with embedded wallet");ke(e)},fund:async e=>{throw new o.PrivyClientError("Funding not supported for Solana wallets")},unlink:async()=>{if(!v)throw new o.PrivyClientError("User is not authenticated.");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new o.PrivyClientError("Cannot unlink an embedded wallet");C(await c.unlinkSolanaWallet(e.address))}})))||[];return ao(e,t)?e:t}))};i.useEffect((()=>{Ne()}),[x?.linkedAccounts,v,y]),i.useEffect((()=>{if(y){if(!c.connectors)throw new o.PrivyClientError("Connector not initialized");Ne(),c.connectors.on("walletsUpdated",Ne)}}),[y]),i.useEffect((()=>{let e;if(!E[0])return;let t=E[0],r=T.current.find((e=>e.address===t.address));if(e="privy"===t.walletClientType?x?.linkedAccounts.find((e=>"wallet"===e.type&&e.address===t.address&&"privy"===e.walletClientType)):x?.linkedAccounts.find((e=>"wallet"===e.type&&e.address===t.address&&"privy"!==e.walletClientType)),!r&&e){let t=Object.assign({},x);t.wallet=e&&{address:e.address,chainType:e.chainType,chainId:e.chainId,walletClient:e.walletClient,walletClientType:e.walletClientType,connectorType:e.connectorType,imported:e.imported,walletIndex:e.walletIndex},C(t)}T.current=E}),[E]);let Ie=async(e,t,r)=>{let n=u.getPrivyEthereumWallet(e),i=u.getPrivySolanaWallet(e);if(n&&!r?.createAdditional)throw d.emitPrivyEvent(pe,"createWallet","onError",o.PrivyErrorCode.EMBEDDED_WALLET_ALREADY_EXISTS),Error("User already has an embedded wallet.");let[a,s]=await Promise.all([Be.initializeWalletProxy(t),Sg()]);if(!a&&Y.customAuth?.enabled)throw d.emitPrivyEvent(pe,"createWallet","onError",o.PrivyErrorCode.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to connect to wallet proxy");if(!a||!s||Y.embeddedWallets?.requireUserOwnedRecoveryOnCreate)return new Promise(((e,t)=>{J(!0),ee({createWallet:{onSuccess:t=>{d.emitPrivyEvent(pe,"createWallet","onSuccess",t),e(t)},onFailure:e=>{d.emitPrivyEvent(pe,"createWallet","onError",o.PrivyErrorCode.UNKNOWN_EMBEDDED_WALLET_ERROR),t(e)},callAuthOnSuccessOnClose:!1}}),we(g.ModalScreen.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}));{if(n){let t=u.getPrivyEthereumHDWallets(e),r=t?.length?Math.max(...t.map((e=>e.walletIndex))):n.walletIndex;await Be.recoverEmbeddedEthereumWallet(),await a.createAdditional({accessToken:s,primaryWalletAddress:n?.address,hdWalletIndex:r+1})}else console.log("solanaWallet",i),await a.create({accessToken:s,solanaAddress:i?.address});let t=u.getPrivyEthereumWallet(await Be.refreshUser());if(!t)throw d.emitPrivyEvent(pe,"createWallet","onError",o.PrivyErrorCode.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to create wallet");return d.emitPrivyEvent(pe,"createWallet","onSuccess",t),t}},Me=(e,r,n,i)=>new Promise((async(a,l)=>{let{requesterAppId:c}=r||{};if(!v||!x)return d.emitPrivyEvent(pe,"sendTransaction","onError",o.PrivyErrorCode.MUST_BE_AUTHENTICATED),void l(Error("User must be authenticated before signing with a Privy wallet"));let h=i??u.getPrivyEthereumWallet(x)?.address;if(!h)throw new o.PrivyClientError("User must have an embedded wallet to send a transaction.");let{signingWallet:p,rootWallet:y}=u.getSigningAndRootWallet(x,h);if(!y||!p)return d.emitPrivyEvent(pe,"sendTransaction","onError",o.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),void l(Error("Must have a Privy wallet before signing"));J(!0);let f=He.wallets.find((e=>"privy"===e.walletClientType&&t.getAddress(e.address)===t.getAddress(p.address))),w=await(f?.getEthereumProvider());if(!f||!w)throw new o.PrivyClientError(`Cannot sendTransaction before embedded wallet ${p.address} is connected`);let C=e.chainId?Number(e.chainId):sf(f.chainId);(e=>{if(!Y.chains.map((e=>e.id)).includes(e))throw new o.PrivyConnectorError(`Chain ID ${e} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,o.PrivyErrorCode.UNSUPPORTED_CHAIN_ID)})(C);let E=Object.assign({},e,{chainId:C});if(Y.embeddedWallets.noPromptOnSignature||ve.current)r&&Y.embeddedWallets.noPromptOnSignature&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),(async()=>{let e=await Sg();if(!e||!V)return d.emitPrivyEvent(pe,"sendTransaction","onError",o.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),void l(Error("Must have valid access token and Privy wallet to send transaction"));try{if(!await Be.recoverEmbeddedEthereumWallet())return d.emitPrivyEvent(pe,"sendTransaction","onError",o.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR),void l(Error("Unable to connect to wallet"));let t=d.getJsonRpcProvider(E.chainId,Y.chains,Y.rpcConfig,{appId:s.appId}),r=await dr(p.address,E,t);if(Y.embeddedWallets.noPromptOnSignature||ve.current){let{totalGasEstimate:e}=await sr(r,t),{hasSufficientFunds:n}=await af(p.address,r,e,t);if(!n)throw new m.PrivyProviderRpcError(new m.ProviderRpcError("Wallet has insufficient funds for this transaction.",m.E.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let n=await nf({accessToken:e,rootWallet:y,transactingWallet:p,walletProxy:V,transactionRequest:r,provider:t,requesterAppId:c});d.emitPrivyEvent(pe,"sendTransaction","onSuccess",n),a(n)}catch(e){d.emitPrivyEvent(pe,"sendTransaction","onError",o.PrivyErrorCode.TRANSACTION_FAILURE),l(e)}})();else{let e={address:y.address,onCompleteNavigateTo:g.ModalScreen.EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN,onFailure:e=>{d.emitPrivyEvent(pe,"sendTransaction","onError",o.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR),l(e)}},t=df({address:p.address,appConfig:Y,fundWalletConfig:n,chainIdOverride:E.chainId,comingFromSendTransactionScreen:!0});ee({connectWallet:e,sendTransaction:{transactionRequest:E,transactingWallet:p,rootWallet:y,onSuccess:e=>{d.emitPrivyEvent(pe,"sendTransaction","onSuccess",e),a(e)},onFailure:e=>{d.emitPrivyEvent(pe,"sendTransaction","onError",o.PrivyErrorCode.TRANSACTION_FAILURE),l(e)},uiOptions:r||{},fundWalletConfig:n,requesterAppId:c},funding:t}),we(g.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN)}})),Oe=({transaction:e,connection:t,transactionOptions:r,uiOptions:n,wallet:i})=>new Promise((async(a,s)=>{let{requesterAppId:l}=n||{};if(!v||!x)return d.emitPrivyEvent(pe,"sendSolanaTransaction","onError",o.PrivyErrorCode.MUST_BE_AUTHENTICATED),void s(new o.PrivyClientError("User must be authenticated before signing with a Privy wallet",o.PrivyErrorCode.MUST_BE_AUTHENTICATED));let c=i?x.linkedAccounts.find((e=>"wallet"===e.type&&e.address===i.address)):u.getPrivySolanaWallet(x);if(!c)return d.emitPrivyEvent(pe,"sendSolanaTransaction","onError",o.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),void s(new o.PrivyClientError("Must have a Privy wallet before signing",o.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND));J(!0);let h=i??j,p=await(h?.isConnected());if(!h||!p)throw d.emitPrivyEvent(pe,"sendSolanaTransaction","onError",o.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),new o.PrivyClientError(`Cannot sendSolanaTransaction before embedded wallet ${c.address} is connected`,o.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND);Y.embeddedWallets.noPromptOnSignature?(n&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),(async()=>{let n=await Sg();if(!n||!V)return d.emitPrivyEvent(pe,"sendSolanaTransaction","onError",o.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),void s(new o.PrivyClientError("Must have valid access token and Privy wallet to send transaction",o.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND));try{if(!await Be.recoverEmbeddedSolanaWallet())return d.emitPrivyEvent(pe,"sendSolanaTransaction","onError",o.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR),void s(new o.PrivyClientError("Unable to connect to wallet",o.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR));if(Y.embeddedWallets.noPromptOnSignature){let{instructions:r}=await vy(e,t);r.every((e=>e.hasFunds))||(d.emitPrivyEvent(pe,"sendSolanaTransaction","onError",o.PrivyErrorCode.INSUFFICIENT_BALANCE),s(new o.PrivyClientError("Solana wallet has insufficient funds for this transaction.",o.PrivyErrorCode.INSUFFICIENT_BALANCE)))}let{signature:i,receipt:l}=await Cm({accessToken:n,tx:e,connection:t,walletProxy:V,transactionOptions:r,transactingWalletAddress:c.address}),u=gy(i,l);d.emitPrivyEvent(pe,"sendSolanaTransaction","onSuccess",u),a(u)}catch(e){d.emitPrivyEvent(pe,"sendSolanaTransaction","onError",o.PrivyErrorCode.TRANSACTION_FAILURE),s(e)}})()):(ee({connectWallet:{address:c.address,onCompleteNavigateTo:g.ModalScreen.EMBEDDED_WALLET_SEND_SOLANA_TRANSACTION_SCREEN,onFailure:e=>{d.emitPrivyEvent(pe,"sendSolanaTransaction","onError",o.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR),s(e)}},sendSolanaTransaction:{transactionRequest:e,connection:t,transactionOptions:r,transactingWallet:c,onSuccess:e=>{d.emitPrivyEvent(pe,"sendSolanaTransaction","onSuccess",e),a(e)},onFailure:e=>{d.emitPrivyEvent(pe,"sendSolanaTransaction","onError",o.PrivyErrorCode.TRANSACTION_FAILURE),s(e)},uiOptions:n||{},requesterAppId:l},funding:void 0}),we(g.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN))}));function Re(){return new Promise((async(e,t)=>{let r=await Sg();if(!r||!V)throw Error("Must have valid access token to enroll in MFA");try{await V.verifyMfa({accessToken:r}),e()}catch(e){t(e)}}))}let Fe=e=>e?.linkedAccounts.filter((e=>null!==e.latestVerifiedAt&&!("wallet"===e.type&&"privy"===e.walletClientType))).sort(((e,t)=>t.latestVerifiedAt.getTime()-e.latestVerifiedAt.getTime()))[0],Le=e=>{let t=x?.linkedAccounts.filter((t=>t.type===e)).length??0,{displayName:r,loginMethod:n}=np(e);if("passkey"===e&&t>=5||"passkey"!==e&&t>=1)throw d.emitPrivyEvent(pe,"linkAccount","onError",o.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE,{linkMethod:n}),new o.PrivyClientError(`User already has an account of type ${r} linked.`)};async function Ue({showAutomaticRecovery:e=!1,legacySetWalletPasswordFlow:t=!1}){N(null);let r=t?"setWalletPassword":"setWalletRecovery";if(!v||!x)throw d.emitPrivyEvent(pe,r,"onError",o.PrivyErrorCode.MUST_BE_AUTHENTICATED),Error("User must be authenticated before adding recovery method to Privy wallet");let n=u.getPrivyEthereumWallet(x);if(!n||!V)throw d.emitPrivyEvent(pe,r,"onError",o.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),Error("Must have a Privy wallet to add a recovery method");if(u.getPrivySolanaWallet(x))throw Error("Cannot set user-controlled recovery for user with Solana.");try{await Re()}catch(e){throw d.emitPrivyEvent(pe,r,"onError",o.PrivyErrorCode.MISSING_MFA_CREDENTIALS),e}return new Promise(((i,a)=>{J(!0);let s={onSuccess:e=>{d.emitPrivyEvent(pe,r,"onSuccess","user-passcode",e),i(e)},onFailure:e=>{d.emitPrivyEvent(pe,r,"onError",o.PrivyErrorCode.USER_EXITED_SET_PASSWORD_FLOW),a(e)},callAuthOnSuccessOnClose:!1},l="user-passcode"===n.recoveryMethod;ee({setWalletPassword:s,createWallet:s,connectWallet:{onCompleteNavigateTo:ld({walletAction:"update",availableRecoveryMethods:Y.embeddedWallets.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:t,isResettingPassword:l,showAutomaticRecovery:e}),shouldForceMFA:!1,onFailure:e=>{d.emitPrivyEvent(pe,r,"onError",o.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR),a(e)}},recoverySelection:{isInAccountCreateFlow:!1,isResettingPassword:l}}),we(g.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN)}))}async function De({appId:e,action:t}){let r=await Sg();if("link"===t&&!r)throw d.emitPrivyEvent(pe,"linkAccount","onError",o.PrivyErrorCode.MUST_BE_AUTHENTICATED,{linkMethod:`privy:${e}`}),new o.PrivyClientError("User must be authenticated before linking an account.");if("login"===t&&r)throw d.emitPrivyEvent(pe,"login","onError",o.PrivyErrorCode.UNKNOWN_AUTH_ERROR),new o.PrivyClientError("Attempted to log in, but user is already logged in. Use a `link` helper instead.");fe.current=`privy:${e}`,ge.current=t;let n=window.open(void 0,void 0,Ju({w:440,h:680}));return c.createAnalyticsEvent({eventName:"cross_app_auth_started",payload:{providerAppId:e}}),new Promise((async(r,i)=>{let{name:a,logoUrl:o}=await Yu({api:c.api,providerAppId:e,requesterAppId:Y.id});ee({crossAppAuth:{appId:e,name:a,logoUrl:o,action:t,popup:n,onSuccess:r,onError:i}}),xe(g.ModalScreen.CROSS_APP_AUTH_SCREEN)}))}let We={ready:y,authenticated:v,user:x,walletConnectors:c.connectors||null,connectWallet:e=>{e&&"target"in e&&e&&(e=void 0),ee({externalConnectWallet:{walletList:e?.walletList&&e?.walletList.length>0?e.walletList:void 0,suggestedAddress:e?.suggestedAddress}}),we(v?g.ModalScreen.CONNECT_ONLY_AUTHENTICATED_SCREEN:g.ModalScreen.CONNECT_ONLY_LANDING_SCREEN)},importWallet:async({privateKey:e})=>{Te("siwe");let[t,r]=await Promise.all([Be.initializeWalletProxy(15e3),Sg()]);if(t&&r){await t.import({privateKey:e,accessToken:r});let n=u.getImportedPrivyEthereumWallet(await Be.refreshUser());if(!n)throw d.emitPrivyEvent(pe,"createWallet","onError",o.PrivyErrorCode.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to import wallet");return d.emitPrivyEvent(pe,"createWallet","onSuccess",n),n}throw new o.PrivyClientError("User is not authenticated")},linkWallet:Pe,startCrossAppAuthFlow:De,linkEmail:()=>{Te("email"),Le("email"),fe.current="email",ge.current="link",we(g.ModalScreen.LINK_EMAIL_SCREEN)},linkPhone:()=>{Te("sms"),Le("phone"),fe.current="sms",ge.current="link",we(g.ModalScreen.LINK_PHONE_SCREEN)},linkGoogle:async()=>{Te("google"),Le("google_oauth"),ge.current="link",await Be.initLoginWithOAuth("google")},linkTwitter:async()=>{Te("twitter"),Le("twitter_oauth"),ge.current="link",await Be.initLoginWithOAuth("twitter")},linkDiscord:async()=>{Te("discord"),Le("discord_oauth"),ge.current="link",await Be.initLoginWithOAuth("discord")},linkGithub:async()=>{Te("github"),Le("github_oauth"),ge.current="link",await Be.initLoginWithOAuth("github")},linkSpotify:async()=>{Te("spotify"),Le("spotify_oauth"),ge.current="link",await Be.initLoginWithOAuth("spotify")},linkInstagram:async()=>{Te("instagram"),Le("instagram_oauth"),ge.current="link",await Be.initLoginWithOAuth("instagram")},linkTiktok:async()=>{Te("tiktok"),Le("tiktok_oauth"),ge.current="link",await Be.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{Te("linkedin"),Le("linkedin_oauth"),ge.current="link",await Be.initLoginWithOAuth("linkedin")},linkApple:async()=>{Te("apple"),Le("apple_oauth"),ge.current="link",await Be.initLoginWithOAuth("apple")},linkPasskey:async()=>{Te("passkey"),Le("passkey"),await Be.initLinkWithPasskey(),we(g.ModalScreen.LINK_PASSKEY_SCREEN)},linkTelegram:async()=>{Te("telegram"),Le("telegram"),ge.current="link",fe.current="telegram",await Be.initLoginWithTelegram(),we(g.ModalScreen.TELEGRAM_AUTH_SCREEN)},linkFarcaster:async()=>{Te("farcaster"),Le("farcaster"),await Be.initLoginWithFarcaster(),ge.current="link",fe.current="farcaster",we(g.ModalScreen.AWAITING_FARCASTER_CONNECTION)},updateEmail:()=>{if(Te("email"),!x?.email)throw new o.PrivyClientError("User does not have an email linked to their account.");ge.current="link",fe.current="email",we(g.ModalScreen.UPDATE_EMAIL_SCREEN)},updatePhone:()=>{if(Te("sms"),!x?.phone)throw new o.PrivyClientError("User does not have a phone number linked to their account.");ge.current="link",fe.current="sms",we(g.ModalScreen.UPDATE_PHONE_SCREEN)},login:async e=>{e&&"target"in e&&e&&(e=void 0);let t="Attempted to log in, but user is already logged in. Use a `link` helper instead.";if(!y){let e=await new Promise((e=>{re((t=>e.bind(t)))}));if(re(null),e)return void console.warn(t)}!x||x.isGuest?(ge.current="login",ee({login:e}),xe(g.ModalScreen.LANDING)):console.warn(t)},connectOrCreateWallet:async()=>{y||(await new Promise((e=>{re((()=>e))})),re(null)),v?console.warn("User must be unauthenticated to `connectOrCreateWallet`"):xe(g.ModalScreen.CONNECT_OR_CREATE)},logout:async()=>{if(x&&c.clearProviderAcccessTokens(x),N(null),await c.logout(),x&&V)try{await V.clearMfa({userId:x.id})}catch(e){}C(null),w(!1),d.emitPrivyEvent(pe,"logout","onSuccess"),ge.current=null,fe.current=null,p(!1),d.e5.del(l.CLIENT_ANALYTICS_ID_KEY),d.e5.del(l.getGuestCredentialStorageKey(Y.id))},getAccessToken:()=>c.getAccessToken(),getEthereumProvider:()=>{if(!x||!x.wallet)return new Pa;let e=E.find((e=>x.wallet&&e.address===x.wallet.address)),t=c.connectors?.walletConnectors.find((t=>t.wallets.find((t=>t.address===e?.address))));return e&&t?t.proxyProvider:new Pa},getEthersProvider:()=>{if(!x||!x.wallet)return new r.Web3Provider(new Na(new Pa));let e=E.find((e=>x.wallet&&e.address===x.wallet.address)),t=c.connectors?.walletConnectors.find((t=>t.wallets.find((t=>t.address===e?.address))));return new r.Web3Provider(new Na(e&&t?t.proxyProvider:new Pa))},getWeb3jsProvider:()=>{if(!x||!x.wallet)return new Ia(new Pa);let e=E.find((e=>x.wallet&&e.address===x.wallet.address)),t=c.connectors?.walletConnectors.find((t=>t.wallets.find((t=>t.address===e?.address))));return new Ia(e&&t?t.proxyProvider:new Pa)},unlinkWallet:async e=>{let t;return C(t=e.startsWith("0x")?await c.unlinkEthereumWallet(e):await c.unlinkSolanaWallet(e)),t},unlinkEmail:async e=>{let t=await c.unlinkEmail(e);return C(t),t},unlinkPhone:async e=>{let t=await c.unlinkPhone(e);return C(t),t},unlinkGoogle:async e=>{let t=await c.unlinkOAuth("google",e);return C(t),t},unlinkTwitter:async e=>{let t=await c.unlinkOAuth("twitter",e);return C(t),t},unlinkDiscord:async e=>{let t=await c.unlinkOAuth("discord",e);return C(t),t},unlinkGithub:async e=>{let t=await c.unlinkOAuth("github",e);return C(t),t},unlinkSpotify:async e=>{let t=await c.unlinkOAuth("spotify",e);return C(t),t},unlinkInstagram:async e=>{let t=await c.unlinkOAuth("instagram",e);return C(t),t},unlinkTiktok:async e=>{let t=await c.unlinkOAuth("tiktok",e);return C(t),t},unlinkLinkedIn:async e=>{let t=await c.unlinkOAuth("linkedin",e);return C(t),t},unlinkApple:async e=>{let t=await c.unlinkOAuth("apple",e);return C(t),t},unlinkFarcaster:async e=>{let t=await c.unlinkFarcaster(e);return C(t),t},unlinkTelegram:async e=>{let t=await c.unlinkTelegram(e);return C(t),t},unlinkPasskey:async e=>{let t=await c.unlinkPasskey(e);return C(t),t},unlinkCrossAppAccount:async({subject:e})=>{let t=x?.linkedAccounts.find((t=>"cross_app"===t.type&&t.subject===e))?.providerApp;if(!t)throw new o.PrivyClientError("Invalid subject");c.storeProviderAccessToken(t.id,null);let r=await c.unlinkOAuth(`privy:${t.id}`,e);return C(r),r},setActiveWallet:async e=>{let r=E.find((r=>t.getAddress(r.address)===t.getAddress(e))),n=x?.linkedAccounts.find((r=>"wallet"===r.type&&t.getAddress(r.address)===t.getAddress(e)));if(r&&await r.isConnected())if(r.linked){let e=Object.assign({},x);e.wallet=n&&{address:n.address,chainType:n.chainType,chainId:n.chainId,walletClient:n.walletClient,walletClientType:n.walletClientType,connectorType:n.connectorType,imported:n.imported,walletIndex:n.walletIndex},C(e)}else r.loginOrLink();else ee({externalConnectWallet:{suggestedAddress:e}}),Pe()},forkSession:()=>c.forkSession(),createWallet:async e=>{if(e&&"target"in e&&e&&(e=void 0),!v||!x)throw d.emitPrivyEvent(pe,"createWallet","onError",o.PrivyErrorCode.MUST_BE_AUTHENTICATED),Error("User must be authenticated before creating a Privy wallet");return Ie(x,15e3,e)},setWalletRecovery:async e=>Ue({legacySetWalletPasswordFlow:!1,showAutomaticRecovery:e?.showAutomaticRecovery??!1}),setWalletPassword:async()=>Ue({legacySetWalletPasswordFlow:!0,showAutomaticRecovery:!1}),signMessage:(e,t,r)=>new Promise((async(n,i)=>{let{requesterAppId:a}=t||{};if(!v||!x)return d.emitPrivyEvent(pe,"signMessage","onError",o.PrivyErrorCode.MUST_BE_AUTHENTICATED),void i(Error("User must be authenticated before signing with a Privy wallet"));let s=r??u.getPrivyEthereumWallet(x)?.address;if(!s)throw new o.PrivyClientError("User must have an embedded wallet to sign a message.");let{signingWallet:l,rootWallet:h}=u.getSigningAndRootWallet(x,s);if(!l||!h)return d.emitPrivyEvent(pe,"signMessage","onError",o.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),void i(Error("Must have a Privy wallet before signing"));if("string"!=typeof e||e.length<1)return d.emitPrivyEvent(pe,"signMessage","onError",o.PrivyErrorCode.INVALID_MESSAGE),void i(Error("Message must be a non-empty string"));J(!0);let p=async()=>{if(!v)throw Error("User must be authenticated before signing with a Privy wallet");let t=await Sg();if(!V||!t||!await Be.recoverEmbeddedEthereumWallet())throw Error("Unable to connect to wallet");c.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_started",payload:{walletAddress:l.address,requesterAppId:a}});let{response:r}=await V.rpc({accessToken:t,address:h.address,hdWalletIndex:l.walletIndex??void 0,requesterAppId:a,request:{method:"personal_sign",params:[e,l.address]}}),n=r.data;return c.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_completed",payload:{walletAddress:l.address,requesterAppId:a}}),n};if(Y.embeddedWallets.noPromptOnSignature||ve.current){t&&Y.embeddedWallets.noPromptOnSignature&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let e=await p();d.emitPrivyEvent(pe,"signMessage","onSuccess",e),n(e)}catch(e){d.emitPrivyEvent(pe,"signMessage","onError",o.PrivyErrorCode.UNABLE_TO_SIGN),i(e??new m.PrivyProviderRpcError("Unable to sign message"))}}else ee({signMessage:{method:"personal_sign",data:e,confirmAndSign:p,onSuccess:e=>{d.emitPrivyEvent(pe,"signMessage","onSuccess",e),n(e)},onFailure:e=>{d.emitPrivyEvent(pe,"signMessage","onError",o.PrivyErrorCode.UNABLE_TO_SIGN),i(e)},uiOptions:t||{}},connectWallet:{onCompleteNavigateTo:g.ModalScreen.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN,onFailure:e=>{d.emitPrivyEvent(pe,"signMessage","onError",o.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR),i(e)},address:h.address}}),we(g.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN)})),signTypedData:(e,t,r)=>new Promise((async(n,i)=>{let{requesterAppId:a}=t||{};if(!v||!x)return d.emitPrivyEvent(pe,"signTypedData","onError",o.PrivyErrorCode.MUST_BE_AUTHENTICATED),void i(Error("User must be authenticated before signing with a Privy wallet"));let s=r??u.getPrivyEthereumWallet(x)?.address;if(!s)throw new o.PrivyClientError("User must have an embedded wallet to sign a message.");let{signingWallet:l,rootWallet:h}=u.getSigningAndRootWallet(x,s);if(!h||!l)return d.emitPrivyEvent(pe,"signTypedData","onError",o.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),void i(Error("Must have a Privy wallet before signing"));J(!0);let p=d.generateTypedDataWithDomainType(e),y=async()=>{if(!v)throw Error("User must be authenticated before signing with a Privy wallet");let e=await Sg();if(!V||!e||!await Be.recoverEmbeddedEthereumWallet())throw Error("Unable to connect to wallet");c.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_started",payload:{walletAddress:l.address,requesterAppId:a}});let{response:t}=await V.rpc({accessToken:e,address:h.address,hdWalletIndex:l.walletIndex??void 0,requesterAppId:a,request:{method:"eth_signTypedData_v4",params:[l.address,p]}}),r=t.data;return c.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_completed",payload:{walletAddress:l.address,requesterAppId:a}}),r};if(ve.current||Y.embeddedWallets.noPromptOnSignature||Y.legacyWalletUiConfig){t&&Y.embeddedWallets.noPromptOnSignature&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let e=await y();d.emitPrivyEvent(pe,"signTypedData","onSuccess",e),n(e)}catch(e){d.emitPrivyEvent(pe,"signTypedData","onError",o.PrivyErrorCode.UNABLE_TO_SIGN),i(e??new m.PrivyProviderRpcError("Unable to sign message"))}}else ee({signMessage:{method:"eth_signTypedData_v4",data:p,confirmAndSign:y,onSuccess:e=>{d.emitPrivyEvent(pe,"signTypedData","onSuccess",e),n(e)},onFailure:e=>{d.emitPrivyEvent(pe,"signTypedData","onError",o.PrivyErrorCode.UNABLE_TO_SIGN),i(e)},uiOptions:t||{}},connectWallet:{address:h.address,onCompleteNavigateTo:g.ModalScreen.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN,onFailure:e=>{d.emitPrivyEvent(pe,"signMessage","onError",o.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR),i(e)}}}),we(g.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN)})),sendTransaction:async(e,t,r,n)=>{let i=await Me(e,t,r,n);return of(await i.wait())},sendSolanaTransaction:async(e,t,r,n)=>await Oe({transaction:e,connection:t,transactionOptions:n,uiOptions:r,wallet:j??void 0}),exportWallet:e=>new Promise((async(r,n)=>{if(!v||!x)return void n(Error("User must be authenticated before exporting their Privy wallet"));e&&"target"in e&&e&&(e=void 0);let i=e?.address,a=x.linkedAccounts.filter((e=>"wallet"===e.type&&"privy"===e.walletClientType&&"ethereum"===e.chainType)),o=i?a.find((e=>e.address===t.getAddress(i))):a.find((e=>!e.imported))||a[0];if(!o)return void n(Error("Must have a Privy wallet before exporting"));J(!0);let l={onCompleteNavigateTo:g.ModalScreen.EMBEDDED_WALLET_KEY_EXPORT_SCREEN,onFailure:n,address:o.address,shouldForceMFA:!0};ee(Q),await Sg()&&V?V?(ee({keyExport:{appId:s.appId,appClientId:s.clientId,origin:c.apiUrl,wallet:o,onSuccess:r,onFailure:n},connectWallet:l}),we(g.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN)):n(Error("Must have a Privy wallet before exporting")):n(Error("Must have valid access token to enroll in MFA"))})),promptMfa:Re,async init(e){switch(e){case"sms":return void await c.initMfaSmsVerification();case"passkey":return await c.initMfaPasskeyVerification();case"totp":return;default:throw Error(`Unsupported MFA method: ${e}`)}},async submit(e,t){switch(e){case"totp":case"sms":if("string"!=typeof t)throw new o.PrivyClientError("Invalid MFA code");ue.current?.resolve({mfaMethod:e,mfaCode:t,relyingParty:window.origin}),await new Promise(((e,t)=>{he.current={resolve:e,reject:t}}));break;case"passkey":if("string"==typeof t)throw new o.PrivyClientError("Invalid authenticator response");let r=await import("@simplewebauthn/browser"),n=(e=>({id:e.id,raw_id:e.rawId,response:{client_data_json:e.response.clientDataJSON,authenticator_data:e.response.authenticatorData,signature:e.response.signature,user_handle:e.response.userHandle},authenticator_attachment:e.authenticatorAttachment,client_extension_results:{app_id:e.clientExtensionResults.appid,cred_props:e.clientExtensionResults.credProps,hmac_create_secret:e.clientExtensionResults.hmacCreateSecret},type:e.type}))(await r.startAuthentication(t));ue.current?.resolve({mfaMethod:e,mfaCode:n,relyingParty:window.origin}),await new Promise(((e,t)=>{he.current={resolve:e,reject:t}}));break;default:throw ue.current?.reject(new o.PrivyClientError("Unsupported MFA method")),new o.PrivyClientError(`Unsupported MFA method: ${e}`)}},cancel(){ue.current?.reject(new o.PrivyClientError("MFA canceled"))},async initEnrollmentWithSms(e){let t=await Sg();if(!t||!V)throw Error("Must have valid access token to enroll in MFA");await V.initEnrollMfa({method:"sms",accessToken:t,phoneNumber:e.phoneNumber})},enrollInMfa:e=>new Promise(((t,r)=>{if(!e)return Be.closePrivyModal(),void t();Y.mfa.noPromptOnMfaRequired&&console.warn("[Privy Warning] Triggering the 'showMfaEnrollmentModal' function when 'noPromptOnMfaRequired' is set to true is unexpected. If this is intentional, ensure that you are building custom UIs for MFA verification."),ee({mfaEnrollmentFlow:{mfaMethods:Y.mfa.methods,onSuccess:t,onFailure:r}}),we(g.ModalScreen.MFA_ENROLLMENT_FLOW_SCREEN)})),async initEnrollmentWithTotp(){let e=await Sg();if(!e||!V)throw Error("Must have valid access token to enroll in MFA");let t=await V.initEnrollMfa({method:"totp",accessToken:e});return{secret:t.secret,authUrl:t.authUrl}},async submitEnrollmentWithSms(e){let t=await Sg();if(!t||!V)throw Error("Must have valid access token to enroll in MFA");await V.submitEnrollMfa({method:"sms",accessToken:t,phoneNumber:e.phoneNumber,code:e.mfaCode}),C(await c.getAuthenticatedUser())},async submitEnrollmentWithTotp(e){let t=await Sg();if(!t||!V)throw Error("Must have valid access token to enroll in MFA");await V.submitEnrollMfa({method:"totp",accessToken:t,code:e.mfaCode}),C(await c.getAuthenticatedUser())},async initEnrollmentWithPasskey(){},async submitEnrollmentWithPasskey({credentialIds:e}){let t=await Sg();if(!t||!V)throw Error("Must have valid access token to enroll in MFA");await V.submitEnrollMfa({method:"passkey",accessToken:t,credentialIds:e}),C(await c.getAuthenticatedUser())},async unenroll(e){let t=await Sg();if(!t||!V)throw Error("Must have valid access token to remove MFA");"passkey"===e?await V.submitEnrollMfa({method:"passkey",accessToken:t,credentialIds:[]}):await V.unenrollMfa({method:e,accessToken:t}),C(await c.getAuthenticatedUser())},requestFarcasterSignerFromWarpcast:async()=>{let e=await Sg(),t=x?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!e)throw Error("Must have valid access token to connect with Farcaster");if(!V||!t)throw Error("Must have an embedded wallet to use Farcaster signers");if(!x?.farcaster?.fid)throw Error("Must have Farcaster account to use Farcaster signers");if(!await Be.recoverEmbeddedEthereumWallet())throw Error("Unable to connect to wallet");let r=await V.initFarcasterSigner({address:t.address,hdWalletIndex:null,accessToken:e,mfaCode:null,mfaMethod:null,relyingParty:window.origin});"approved"===r.status&&C(await c.getAuthenticatedUser()||x||null),ee({farcasterSigner:r}),we(g.ModalScreen.AWAITING_FARCASTER_SIGNER)},getFarcasterSignerPublicKey:async()=>{let e,t=await Sg(),r=x?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!t)throw Error("Must have valid access token to connect with Farcaster");if(!V||!r)throw Error("Must have an embedded wallet to use Farcaster signers");if(!x?.farcaster?.fid)throw Error("Must have Farcaster account to use Farcaster signers");if(!await Be.recoverEmbeddedEthereumWallet())throw Error("Unable to connect to wallet");if(!x.farcaster?.signerPublicKey)throw Error("Must have a Farcaster signer public key to sign");return e=x.farcaster.signerPublicKey.slice(2),Uint8Array.from(e.match(/.{1,2}/g).map((e=>parseInt(e,16))))},signFarcasterMessage:async e=>{let t=await Sg(),r=x?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!t)throw Error("Must have valid access token to connect with Farcaster");if(!V||!r)throw Error("Must have an embedded wallet to use Farcaster signers");if(!x?.farcaster?.fid)throw Error("Must have Farcaster account to use Farcaster signers");if(!await Be.recoverEmbeddedEthereumWallet())throw Error("Unable to connect to wallet");if(!x.farcaster?.signerPublicKey)throw Error("Must have a Farcaster signer public key to sign");let n=await import("@simplewebauthn/browser"),i=await V.signFarcasterMessage({address:r.address,hdWalletIndex:null,accessToken:t,mfaCode:null,mfaMethod:null,payload:{hash:n.bufferToBase64URLString(e)},fid:BigInt(x.farcaster.fid),relyingParty:window.origin});return new Uint8Array(n.base64URLStringToBuffer(i.signature))},createGuestAccount:async()=>{if(x&&!x.isGuest)throw Error("User cannot already be authenticated to create a guest account");return x?.isGuest?x:Be.loginWithGuestAccountFlow()},isHeadlessOAuthLoading:I,async loginWithCode(e){await Be.loginWithCode(e)},initLoginWithEmail:e=>Be.initLoginWithEmail(e),initLoginWithSms:e=>Be.initLoginWithSms(e),otpState:W,fundWallet:(e,t)=>Be.fundWallet(e,t),initLoginWithHeadlessOAuth:(e,t)=>Be.initLoginWithHeadlessOAuth(e,t),loginWithHeadlessOAuth:e=>Be.loginWithHeadlessOAuth(e),generateSiweMessage:({address:e,chainId:t})=>Be.generateSiweMessage({address:e,chainId:t}),async linkWithSiwe({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i}){Te("siwe"),await Be.linkWithSiwe({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i})},signMessageWithCrossAppWallet:(e,{address:t})=>Zu({user:x,client:c,address:t,requesterAppId:Y.id,request:{method:"personal_sign",params:[e,t]},reconnect:De}),signTypedDataWithCrossAppWallet(e,{address:t}){let r=d.generateTypedDataWithDomainType(e);return Zu({user:x,client:c,address:t,requesterAppId:Y.id,request:{method:"eth_signTypedData_v4",params:[t,r]},reconnect:De})},sendTransactionWithCrossAppWallet:(e,{address:t})=>Zu({user:x,client:c,address:t,requesterAppId:Y.id,request:{method:"eth_sendTransaction",params:[e]},reconnect:De}),isModalOpen:h,mfaMethods:Y.mfa.methods};vg=We.signMessage,wg=We.signTypedData,xg=async(...e)=>{let t=await Me(...e);return Y.embeddedWallets.waitForTransactionConfirmation&&await t.wait(),t};let Be={isNewUserThisSession:P,pendingTransaction:null,walletConnectionStatus:O,connectors:c.connectors?.walletConnectors??[],solanaWallets:S,rpcConfig:Y.rpcConfig,chains:Y.chains,appId:s.appId,showFiatPrices:"native-token"!==Y.embeddedWallets.priceDisplay.primary,clientAnalyticsId:c.clientAnalyticsId,customAuthStatus:de,noPromptOnSignature:ve,emailOtpState:U,setEmailOtpState:D,smsOtpState:W,setSmsOtpState:B,oAuthState:q,setOAuthState:z,siweState:H,setSiweState:G,nativeTokenSymbolForChainId:e=>Y.chains.find((t=>t.id===Number(e)))?.nativeCurrency.symbol,initializeWalletProxy:async e=>{if(V)return V;let t=new Promise((e=>{ie((()=>t=>e(t)))})),r=new Promise((t=>setTimeout((()=>t(null)),e))),n=await Promise.race([t,r]);return ie(null),n},getAuthFlow:()=>c.authFlow,getAuthMeta:()=>c.authFlow?.meta,client:c,closePrivyModal:async(e={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let t,r=y&&v&&x;r&&fe.current&&(t=Fe(x)),"login"===ge.current?e.shouldCallAuthOnSuccess&&r&&fe.current?(d.emitPrivyEvent(pe,"login","onComplete",x,P,!1,fe.current,t??null),s.onSuccess?.(x,P)):d.emitPrivyEvent(pe,"login","onError",o.PrivyErrorCode.USER_EXITED_AUTH_FLOW):"link"===ge.current&&t&&(e.isSuccess&&r&&fe.current?d.emitPrivyEvent(pe,"linkAccount","onSuccess",x,fe.current,t):fe.current&&d.emitPrivyEvent(pe,"linkAccount","onError",o.PrivyErrorCode.USER_EXITED_LINK_FLOW,{linkMethod:fe.current}));let n=k&&cf.includes(k),i=k===g.ModalScreen.ERROR_SCREEN&&Q.errorModalData&&cf.includes(Q.errorModalData.previousScreen);if((n||i)&&Q.funding){let e,t=uf[k]??null,r=d.getJsonRpcProvider(Q.funding.chain.id,Y.chains,Y.rpcConfig,{appId:s.appId});try{e=(await r.getBalance(Q.funding.address)).toBigInt()}catch{console.error("Unable to pull wallet balance")}d.emitPrivyEvent(pe,"fundWallet","onUserExited",{address:Q.funding.address,chain:Q.funding.chain,fundingMethod:t,balance:e})}ee({...Q,externalConnectWallet:{suggestedAddress:void 0}}),ge.current=null,fe.current=null,_(!1),p(!1),setTimeout((()=>{c.authFlow=void 0}),200),c.createAnalyticsEvent({eventName:"modal_closed"})},solanaSignMessage:async({message:e})=>new Promise((async(t,r)=>{let n=async()=>{let t=await c.getAccessToken();if(!t)throw Error("User must be authenticated to use their embedded wallet.");if(!j)throw Error("User must have an embedded Solana wallet to sign messages for Solana.");let r=Be.walletProxy??await Be.initializeWalletProxy(15e3);if(!r)throw Error("Failed to initialize embedded wallet proxy.");let{response:n}=await r.rpcSolana({accessToken:t,publicKey:j.address,request:{method:"signMessage",params:{message:e}}});return n.data.signature};if(Y.embeddedWallets.noPromptOnSignature||ve.current)try{let e=await n();t({signature:e})}catch(e){r(e)}else ee({signMessage:{method:"solana_signMessage",data:e,confirmAndSign:n,onSuccess:e=>{t({signature:e})},onFailure:e=>{r(e)},uiOptions:{}}}),xe(g.ModalScreen.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN)})),openPrivyModal:we,connectWallet:Se,initLoginWithWallet:async(e,t,r)=>{Ra(e)?(fe.current="siwe",Ae(e,t,r)):(fe.current="siws",je(e,t))},loginWithWallet:async()=>{let e,t,r;if(!y)throw new o.PrivyNotReadyError;if(c.authFlow instanceof fa?e="siwe":c.authFlow instanceof ga&&(e="siws"),!e)throw new o.PrivyClientError("Must initialize SIWE/SIWS flow first.");if(null!==await c.getAccessToken())try{({user:t}=await c.link()),fe.current=e}catch(t){throw d.emitPrivyEvent(pe,"linkAccount","onError",t.privyErrorCode||o.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:e}),t}else try{({user:t,isNewUser:r}=await c.authenticate()),fe.current=e}catch(e){throw d.emitPrivyEvent(pe,"login","onError",e.privyErrorCode||o.PrivyErrorCode.GENERIC_CONNECT_WALLET_ERROR),e}C(t||x||null),_(r||!1),w(!0)},initDelegateAction:async({address:e})=>new Promise((async(t,r)=>{let n=await Sg();if(!v||!x||!n)throw new o.PrivyClientError("User must be authenticated and have an embedded wallet to delegate actions.");let i=Be.walletProxy??await Be.initializeWalletProxy(15e3);if(!i)throw new o.PrivyClientError("Wallet proxy not initialized.");let a=(({address:e,user:t})=>{let r=t.linkedAccounts.find((t=>"wallet"===t.type&&"privy"===t.walletClientType&&t.address===e));if(!r)throw new o.PrivyClientError("Address to delegate is not associated with current user.");return{address:r.address,chainType:r.chainType,walletIndex:r.walletIndex??0}})({address:e,user:x}),s=(({address:e,user:t})=>{let r,n=t.linkedAccounts.find((t=>"wallet"===t.type&&"privy"===t.walletClientType&&t.address===e));if(!n)throw new o.PrivyClientError("Address to delegate is not associated with current user.");if(!(r="ethereum"===n.chainType?n.imported?u.getImportedPrivyEthereumWallet(t):u.getPrivyEthereumWallet(t):n))throw new o.PrivyClientError("Unable to determine root address for delegated address.");return{address:r.address,chainType:r.chainType,imported:r.imported}})({address:e,user:x});"ethereum"===a.chainType?await Be.recoverEmbeddedEthereumWallet():await Be.recoverEmbeddedSolanaWallet(),ee({delegatedActions:{address:e,onDelegate:async()=>{await i.createDelegatedAction({accessToken:n,rootWallet:s,delegatedWallets:[a]})},onSuccess:async()=>{t()},onError:async e=>{r(e)}}}),we(g.ModalScreen.EMBEDDED_WALLET_DELEGATED_ACTIONS_CONSENT_SCREEN)})),initLoginWithFarcaster:async(e,t)=>{let r=new qi(e,t);c.startAuthFlow(r);try{fe.current="farcaster",await r.initializeFarcasterConnect()}catch(e){throw"login"===ge.current?d.emitPrivyEvent(pe,"login","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR):"link"===ge.current&&d.emitPrivyEvent(pe,"linkAccount","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR,{linkMethod:"farcaster"}),e}},loginWithFarcaster:async()=>{let e,t;if(!y)throw new o.PrivyNotReadyError;if(!(c.authFlow instanceof qi))throw new o.PrivyClientError("Must initialize Farcaster flow first.");if(null!==await c.getAccessToken())try{({user:e}=await c.link()),fe.current="farcaster"}catch(e){throw d.emitPrivyEvent(pe,"linkAccount","onError",e.privyErrorCode||o.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:"farcaster"}),e}else try{({user:e,isNewUser:t}=await c.authenticate()),fe.current="farcaster"}catch(e){throw d.emitPrivyEvent(pe,"login","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR),e}C(e||null),_(t||!1),w(!0)},async loginWithGuestAccountFlow(){let e=new Vi(this.appId);c.startAuthFlow(e);try{ge.current="login",fe.current="guest";let{user:e,isNewUser:t}=await c.authenticate();if(t=t||!1,!e)throw new o.PrivyClientError("Unable to authenticate guest account");if(u.shouldProceedtoEmbeddedWalletCreationFlow(e,Y.embeddedWallets.createOnLogin))try{await Ie(e,15e3),e=await Be.refreshUser()}catch(t){C(e),console.warn("Unable to create embedded wallet for guest account")}else C(e);return _(t),w(!0),d.emitPrivyEvent(pe,"login","onComplete",e,t,!1,"guest",null),e}catch(e){throw d.emitPrivyEvent(pe,"login","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR),e}},async crossAppAuthFlow({appId:e,popup:t,action:r}){let n=`privy:${e}`;fe.current=n;let{url:i,stateCode:a,codeVerifier:s}=await async function({api:e,appId:t}){let r=Ki(),n=Yi(),i=await Zi(r);try{let{url:a}=await e.post(Pi,{provider:`privy:${t}`,redirect_to:window.location.href,code_challenge:i,state_code:n});return{url:a,stateCode:n,codeVerifier:r}}catch(e){throw o.formatApiError(e)}}({api:c.api,appId:e});if(!i)throw c.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:"Unable to open cross-app auth popup",appId:e}}),new o.PrivyClientError("No authorization URL returned for cross-app auth.");try{let l=await async function({url:e,popup:t}){return t.location=e,new Promise(((e,r)=>{let n,i=setTimeout((()=>{r(new o.PrivyClientError("Authorization request timed out after 2 minutes.")),a()}),12e4);function a(){t?.close(),window.removeEventListener("message",l)}let s=setInterval((()=>{t?.closed&&!n&&(a(),clearInterval(s),clearTimeout(i),r(new o.PrivyClientError("User rejected request")))}),300);function l(t){t.data&&("PRIVY_OAUTH_RESPONSE"===t.data.type&&t.data.stateCode&&t.data.authorizationCode&&(clearTimeout(i),e(t.data),a()),"PRIVY_OAUTH_ERROR"===t.data.type&&(clearTimeout(i),r(new o.PrivyClientError(t.data.error)),a()),t.data.type===mg&&((n=new BroadcastChannel(yg)).onmessage=l))}window.addEventListener("message",l)}))}({url:i,popup:t,provider:n}),d=l.stateCode,u=l.authorizationCode;if(d!==a)throw c.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:n,storedStateCode:a??"",returnedStateCode:d??""}}),new o.PrivyClientError("Unexpected auth flow. This may be a phishing attempt.",void 0,o.PrivyErrorCode.OAUTH_UNEXPECTED);let h=await async function({appId:e,stateCode:t,codeVerifier:r,authorizationCode:n,action:i,client:a}){if(!n||!t)throw new o.PrivyClientError("[Cross-App AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if("undefined"===n)throw new o.PrivyClientError("User denied confirmation during cross-app auth flow");try{let o=new Ku({authorizationCode:n,stateCode:t,codeVerifier:r,provider:`privy:${e}`});a.startAuthFlow(o);let s="link"===i?await a.link():await a.authenticate(),l=s.oAuthTokens?.accessToken;return console.debug(),l}catch(e){let t=o.formatApiError(e);if(t.privyErrorCode)throw new o.PrivyClientError(t.message||"Invalid code during cross-app auth flow.",void 0,t.privyErrorCode);if("User denied confirmation during cross-app auth flow"===t.message)throw new o.PrivyClientError("Invalid code during cross-app auth flow.",void 0,o.PrivyErrorCode.OAUTH_USER_DENIED);throw new o.PrivyClientError("Invalid code during cross-app auth flow.",void 0,o.PrivyErrorCode.UNKNOWN_AUTH_ERROR)}}({appId:e,codeVerifier:s,stateCode:d,authorizationCode:u,action:r,client:c});h&&c.storeProviderAccessToken(e,h);let p=await Be.refreshUser();if(!p)throw new o.PrivyClientError("Unable to update user");return c.createAnalyticsEvent({eventName:"cross_app_auth_completed",payload:{providerAppId:e}}),p}catch(e){throw c.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:e.toString(),provider:n}}),e}},async initLoginWithOAuth(e,t,r){if(fe.current=e,!d.e())return void xe(g.ModalScreen.IN_APP_BROWSER_LOGIN_NOT_POSSIBLE);if("google"===e&&jl(window.navigator.userAgent))return void xe(g.ModalScreen.IN_APP_BROWSER_LOGIN_NOT_POSSIBLE);"twitter"===e&&window.opener&&window.opener.postMessage({type:mg},"*"),d.e5.del(l.HEADLESS_OAUTH_KEY),d.e5.del(l.OAUTH_DISABLE_SIGNUP_KEY);let n=new Ji({provider:e,disableSignup:!!r});t&&n.addCaptchaToken(t),c.startAuthFlow(n);let i=await c.authFlow.getAuthorizationUrl();i&&i.url&&("twitter"===e&&a.isAndroid&&(i.url=i.url.replace("x.com","twitter.com")),window.location.assign(i.url))},async initLoginWithTelegram(e,t){if(!y)throw new o.PrivyNotReadyError;fe.current="telegram";let r=new Sa(e,t);c.startAuthFlow(r),r.meta.telegramWebAppData=void 0,r.meta.telegramAuthResult=await new Promise(((e,t)=>Y.loginConfig.telegramAuthConfiguration?window.Telegram?void window.Telegram.Login.auth({bot_id:Y.loginConfig.telegramAuthConfiguration.botId,request_access:!0},(r=>r?e(r):t(new o.PrivyClientError("Telegram auth failed or was canceled by the client")))):t(new o.PrivyClientError("Telegram was not initialized")):t(new o.PrivyClientError("Telegram Auth configuration is not loaded"))))},async loginWithTelegram(e){let t,r;if(!(c.authFlow instanceof Sa))throw new o.PrivyClientError("Must initialize Telegram flow before calling loginWithTelegram");if(c.authFlow.meta.captchaToken||=e,"login"===ge.current)try{let e=await c.authenticate();t=e.user,r=e.isNewUser,fe.current="telegram"}catch(e){throw d.emitPrivyEvent(pe,"login","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR),e}else{if("link"!==ge.current)throw new o.PrivyClientError("Unknown auth intent");try{t=(await c.link()).user,fe.current="telegram"}catch(e){throw d.emitPrivyEvent(pe,"linkAccount","onError",e.privyErrorCode||o.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:"telegram"}),e}}C(t),_(r||!1),w(!0)},async recoveryOAuthFlow(e,t,r){let n,i;function a(t){if(!t)throw c.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:"Unable to open recovery OAuth popup",provider:e}}),new o.PrivyClientError("Recovery OAuth failed")}switch(e){case"google-drive":{let t,s,{url:l,codeVerifier:d,stateCode:u}=await cd({api:gg.api,provider:e});a(l);try{let n=await fg({url:l,popup:r,provider:e});if(t=n.stateCode,s=n.authorizationCode,t!==u)throw c.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:e,storedStateCode:u??"",returnedStateCode:t??""}}),new o.PrivyClientError("Unexpected auth flow. This may be a phishing attempt.",void 0,o.PrivyErrorCode.OAUTH_UNEXPECTED)}catch(t){throw c.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:t.toString(),provider:e}}),new o.PrivyClientError("Recovery OAuth failed")}[n,i]=await Promise.all([Sg(),ud({api:gg.api,provider:e,codeVerifier:d,stateCode:t,authorizationCode:s})]);break}case"icloud":{let{url:t}=await cd({api:gg.api,provider:e});a(t);let{ckWebAuthToken:o}=await fg({url:t,popup:r,provider:e});i=o,n=await Sg()}}if(!V)throw new o.PrivyClientError("Cannot connect to wallet proxy");if(!n)throw new o.PrivyClientError("Unable to authorize user");switch(t){case"recover":let t=Q.recoverWallet?.privyWallet?.address;if(!t)throw new o.PrivyClientError("Recovery OAuth failed");c.createAnalyticsEvent({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:t,recoveryMethod:e}}),await V.recover({address:t,accessToken:n,recoveryAccessToken:i,recoveryMethod:e}),c.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:t,recoveryMethod:e}});break;case"create-wallet":c.createAnalyticsEvent({eventName:"embedded_wallet_creation_started"});let r=u.getPrivySolanaWallet(x);await V.create({accessToken:n,recoveryAccessToken:i,recoveryMethod:e,solanaAddress:r?.address});let a=u.getPrivyEthereumWallet(await Be.refreshUser());if(!a)throw d.emitPrivyEvent(pe,"createWallet","onError",o.PrivyErrorCode.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to create wallet");c.createAnalyticsEvent({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:a.address}}),d.emitPrivyEvent(pe,"createWallet","onSuccess",a);break;case"set-recovery":let s=u.getPrivyEthereumWallet(x);if(!s)throw d.emitPrivyEvent(pe,"setWalletRecovery","onError",o.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),Error("Embedded wallet not found");c.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_started",payload:{walletAddress:s.address,existingRecoveryMethod:s.recoveryMethod,targetRecoveryMethod:e}}),await V.setRecovery({address:s.address,accessToken:n,recoveryAccessToken:i,recoveryMethod:e});let l=u.getPrivyEthereumWallet(await Be.refreshUser());if(!l)throw d.emitPrivyEvent(pe,"createWallet","onError",o.PrivyErrorCode.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to set recovery on wallet");c.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:s.address,existingRecoveryMethod:s.recoveryMethod,targetRecoveryMethod:e}}),d.emitPrivyEvent(pe,"setWalletRecovery","onSuccess",e,l);break;default:throw new o.PrivyClientError("Unsupported recovery action")}},async loginWithOAuth(e){let t,r,n;if(!(c.authFlow instanceof Ji))throw new o.PrivyClientError("Must initialize OAuth flow before calling loginWithOAuth");let i=d.e5.get(l.STATE_CODE_KEY),a=c.authFlow.meta.stateCode;if(i!==a)throw c.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:e,storedStateCode:i??"",returnedStateCode:a??""}}),new o.PrivyClientError("Unexpected auth flow. This may be a phishing attempt.",void 0,o.PrivyErrorCode.OAUTH_UNEXPECTED);if(null!==await c.getAccessToken())try{let r=await c.link();t=r.user,n=r.oAuthTokens,fe.current=e}catch(t){throw d.emitPrivyEvent(pe,"linkAccount","onError",t.privyErrorCode||o.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:e}),t}else try{let i=await c.authenticate();t=i.user,r=i.isNewUser,n=i.oAuthTokens,fe.current=e}catch(t){throw"login"===ge.current?d.emitPrivyEvent(pe,"login","onError",t.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR):"link"===ge.current&&d.emitPrivyEvent(pe,"linkAccount","onError",t.privyErrorCode||o.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:e}),t}return C(t),_(r||!1),w(!0),n&&t&&d.emitPrivyEvent(pe,"oAuthAuthorization","onOAuthTokenGrant",n,{user:t}),n},passkeyAuthState:F,setPasskeyAuthState:L,async initLoginWithPasskey(e){let t=new ya(e,L);c.startAuthFlow(t),ge.current="login";try{fe.current="passkey",L({status:"generating-challenge"}),await t.initAuthenticationFlow(),L({status:"awaiting-passkey"})}catch(e){throw L({status:"error",error:e}),d.emitPrivyEvent(pe,"login","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR),e}},async loginWithPasskey(){let e,t;if(!y)throw new o.PrivyNotReadyError;if(!(c.authFlow instanceof ya))throw new o.PrivyClientError("Must initialize Passkey flow first.");if("passkey"!==fe.current){let e=new o.PrivyClientError("Must init login with Passkey flow first.");throw L({status:"error",error:e}),e}let r=await Sg();try{fe.current="passkey",L({status:"awaiting-passkey"}),({user:e,isNewUser:t}=await c.authenticate())}catch(e){throw L({status:"error",error:e}),d.emitPrivyEvent(pe,"login","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR),e}C(e),_(t||!1),w(!0),L({status:"done"});let n=e?.linkedAccounts.find((({type:e})=>"passkey"===e))||null;return{user:e,isNewUser:t||!1,wasAlreadyAuthenticated:!!r,loginAccount:n}},async initLinkWithPasskey(e){let t=new ya(e);c.startAuthFlow(t),ge.current="link",fe.current="passkey";try{await t.initLinkFlow()}catch(e){throw d.emitPrivyEvent(pe,"linkAccount","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR,{linkMethod:"passkey"}),e}},async linkWithPasskey(){let e;if(!y)throw new o.PrivyNotReadyError;if(!(c.authFlow instanceof ya))throw new o.PrivyClientError("Must initialize Passkey flow first.");if("passkey"!==fe.current)throw new o.PrivyClientError("Must init login with Passkey flow first.");try{fe.current="passkey",({user:e}=await c.link())}catch(e){throw d.emitPrivyEvent(pe,"linkAccount","onError",e.privyErrorCode||o.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:"passkey"}),e}return C(e||x||null),e},async initLoginWithHeadlessOAuth(e,t){if(!d.e())throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.");if("google"===e&&jl(window.navigator.userAgent))throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.");let r=new Ji({provider:e,headless:!0,disableSignup:!1});t&&r.addCaptchaToken(t),z({status:"loading"});let n=await c.startAuthFlow(r).getAuthorizationUrl();n?.url&&window.location.assign(n.url)},async loginWithHeadlessOAuth(e){let t,r,n;M(!0),z({status:"loading"}),c.startAuthFlow(new Ji(e));let i=d.e5.get(l.STATE_CODE_KEY),a=e.stateCode;if(i!==a)throw c.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:e.provider,storedStateCode:i??"",returnedStateCode:a??""}}),M(!1),new o.PrivyClientError("Unexpected auth flow. This may be a phishing attempt.",void 0,o.PrivyErrorCode.OAUTH_UNEXPECTED);if(null!==await c.getAccessToken())try{({user:t,oAuthTokens:n}=await c.link()),fe.current=e.provider;let r=Fe(t);t&&r&&d.emitPrivyEvent(pe,"linkAccount","onSuccess",t,fe.current,r)}catch(t){throw M(!1),d.emitPrivyEvent(pe,"linkAccount","onError",t.privyErrorCode||o.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:e.provider}),t}else try{({user:t,isNewUser:r,oAuthTokens:n}=await c.authenticate()),fe.current=e.provider;let i=Fe(t);t&&i&&void 0!==r&&"login"===ge.current&&d.emitPrivyEvent(pe,"login","onComplete",t,r,!1,fe.current,i)}catch(e){throw M(!1),z({status:"error",error:e}),d.emitPrivyEvent(pe,"login","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR),e}return C(t),_(r||!1),w(!0),M(!1),z({status:"done"}),n&&t&&d.emitPrivyEvent(pe,"oAuthAuthorization","onOAuthTokenGrant",n,{user:t}),t??void 0},initLoginWithEmail:async(e,t,r)=>{let n=new Mi(e,t,r);c.startAuthFlow(n);try{fe.current="email",D({status:"sending-code"}),await n.sendCodeEmail(),D({status:"awaiting-code-input"})}catch(e){throw D({status:"error",error:e}),"login"===ge.current?d.emitPrivyEvent(pe,"login","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR):"link"===ge.current&&d.emitPrivyEvent(pe,"linkAccount","onError",e.privyErrorCode||o.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:"email"}),e}},initUpdateEmail:async(e,t,r)=>{let n=new Oi(e,t,r);c.startAuthFlow(n),await n.sendCodeEmail()},initUpdatePhone:async(e,t,r)=>{let n=new wa(e,t,r);c.startAuthFlow(n),await n.sendSmsCode()},initLoginWithSms:async(e,t,r)=>{B({status:"sending-code"});let n=new va(e,t,r);c.startAuthFlow(n);try{fe.current="sms",await n.sendSmsCode(),B({status:"awaiting-code-input"})}catch(e){throw B({status:"error",error:e}),"login"===ge.current?d.emitPrivyEvent(pe,"login","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR):"link"===ge.current&&d.emitPrivyEvent(pe,"linkAccount","onError",e.privyErrorCode||o.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:"sms"}),e}},resendEmailCode:async()=>{await(c.authFlow?.sendCodeEmail())},resendSmsCode:async()=>{await(c.authFlow?.sendSmsCode())},loginWithCode:async e=>{let t,r;function n(e){c.authFlow instanceof Mi?D(e):c.authFlow instanceof va&&B(e)}if(n({status:"submitting-code"}),!y){let e=new o.PrivyNotReadyError;throw n({status:"error",error:e}),e}if(c.authFlow instanceof Mi)c.authFlow.meta.emailCode=e.trim();else{if(!(c.authFlow instanceof va)){let e=new o.PrivyClientError("Must initialize a passwordless code flow first");throw n({status:"error",error:e}),e}c.authFlow.meta.smsCode=e.trim()}let i=await Sg();if("link"===ge.current)try{({user:t}=await c.link())}catch(e){throw n({status:"error",error:e}),d.emitPrivyEvent(pe,"linkAccount","onError",e.privyErrorCode||o.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:fe.current}),e}else try{({user:t,isNewUser:r}=await c.authenticate())}catch(e){throw n({status:"error",error:e}),d.emitPrivyEvent(pe,"login","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR),e}let a=t||x;C(a||null),_(r||!1),w(!0),n({status:"done"});let s=null;return c.authFlow instanceof Mi?s=a?.linkedAccounts.find((({type:e})=>"email"===e))||null:c.authFlow instanceof va&&(s=a?.linkedAccounts.find((({type:e})=>"phone"===e))||null),{user:a,isNewUser:r||!1,wasAlreadyAuthenticated:!!i,linkedAccount:s}},generateSiweMessage:async({address:e,chainId:t,captchaToken:r})=>{ge.current="link",fe.current="siwe",G({status:"generating-message"});let n=await c.generateSiweNonce({address:e,captchaToken:r});return G({status:"awaiting-signature"}),ma({address:e,chainId:t.replace("eip155:",""),nonce:n})},linkSmartWallet:async({message:e,signature:t,smartWalletType:r})=>{let n;ge.current=null,fe.current=null;try{n=await c.linkSmartWallet({message:e,signature:t,smartWalletType:r}),n=await Be.refreshUser()??n}catch(e){throw e}C(n||x||null)},linkWithSiwe:async({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i})=>{let a,s=null;try{G({status:"submitting-signature"}),a=await c.linkWithSiwe({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i}),a=await Be.refreshUser()??a,G({status:"done"}),(s=Fe(a)||null)&&d.emitPrivyEvent(pe,"linkAccount","onSuccess",a,"siwe",s)}catch(e){throw d.emitPrivyEvent(pe,"linkAccount","onError",e.privyErrorCode||o.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:"siwe"}),ge.current=null,fe.current=null,G({status:"error",error:e}),e}let l=a||x;return C(l||null),ge.current=null,fe.current=null,{user:l,linkedAccount:s}},refreshUser:async()=>{let e=await c.getAuthenticatedUser();return w(!!e),C(e),e},walletProxy:V,createAnalyticsEvent:({eventName:e,payload:t,timestamp:r})=>c.createAnalyticsEvent({eventName:e,payload:t,timestamp:r}),acceptTerms:async()=>{let e=await c.acceptTerms();return C(e),e},getUsdTokenPrice:e=>c.getUsdTokenPrice(e),getUsdPriceForSol:()=>c.getUsdPriceForSol(),recoverEmbeddedEthereumWallet:async e=>new Promise((async(t,r)=>{let n=u.getPrivyEthereumWallet(e?.user??x)||u.getImportedPrivyEthereumWallet(e?.user??x),i=await Sg();if(i&&V&&n){J(!0);try{await V.connect({accessToken:i,address:n.address}),t(!0)}catch(e){td(e)&&"privy"===n.recoveryMethod?(c.createAnalyticsEvent({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:n.address}}),(await V.recover({address:n.address,accessToken:i,recoveryMethod:n.recoveryMethod})).address||r(Error("Unable to recover wallet")),c.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:n.address}}),t(!0)):td(e)&&"privy"!==n.recoveryMethod?(ee({recoverWallet:{privyWallet:n,onFailure:r,onSuccess:()=>t(!0)},recoveryOAuthStatus:{provider:n.recoveryMethod,action:"recover"}}),we(dd(n.recoveryMethod))):r(e)}}else r(Error("Must have valid access token and Privy wallet to recover wallet"))})),embeddedSolanaWallet:j,createEmbeddedSolanaWallet:async()=>{J(!0);let e=await Sg(),t=await Be.refreshUser(),r=u.getPrivySolanaWallet(t),n=u.getPrivyEthereumWallet(t);if(!t||!e)throw new o.PrivyClientError("User must be logged in to create a Solana wallet");if(r)throw new o.PrivyClientError("User already has an embedded Solana wallet.");if(n){if("privy"!==n.recoveryMethod)throw new o.PrivyClientError("Cannot create an embedded Solana wallet for a user with an existing Ethereum wallet with user-controlled recovery.");await Be.recoverEmbeddedEthereumWallet({user:t})}let i=await Be.initializeWalletProxy(15e3);if(!i)throw new o.PrivyClientError("Unable to initialize wallet proxy");c.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_started"});try{await i.createSolana({accessToken:e,ethereumAddress:n?.address});let t=await Be.refreshUser(),r=u.getPrivySolanaWallet(t);if(!r)throw new o.PrivyClientError("Could not get Solana wallet for user");return c.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_completed",payload:{walletAddress:r.address}}),r}catch(e){throw c.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_failed"}),new o.PrivyClientError("Failed to create Solana embedded wallet with error ",e)}},exportSolanaWallet:e=>new Promise((async(t,r)=>{if(!v||!x)return void r(Error("User must be authenticated before exporting their Privy wallet"));let n=e?.address,i=x.linkedAccounts.filter((e=>"wallet"===e.type&&"privy"===e.walletClientType&&"solana"===e.chainType)),a=n?i.find((e=>e.address.toLowerCase()===n.toLowerCase())):i.find((e=>!e.imported))||i[0];a?(J(!0),await Sg()&&V?V?(await Be.recoverEmbeddedSolanaWallet(),ee({keyExport:{appId:s.appId,appClientId:s.clientId,origin:c.apiUrl,wallet:a,onSuccess:t,onFailure:r}}),we(g.ModalScreen.EMBEDDED_WALLET_KEY_EXPORT_SCREEN)):r(Error("Must have a Privy wallet before exporting")):r(Error("Must have valid access token to enroll in MFA"))):r(Error("Must have a Privy wallet before exporting"))})),recoverEmbeddedSolanaWallet:async()=>new Promise((async(e,t)=>{let r=u.getPrivySolanaWallet(x),n=await Sg();if(n&&V&&r){J(!0);try{await V.connectSolana({accessToken:n,publicKey:r.address}),e(!0)}catch(i){td(i)&&"privy"===r.recoveryMethod?(c.createAnalyticsEvent({eventName:"embedded_solana_wallet_pinless_recovery_started",payload:{walletAddress:r.address}}),(await V.recoverSolana({publicKey:r.address,accessToken:n})).publicKey||t(Error("Unable to recover wallet")),c.createAnalyticsEvent({eventName:"embedded_solana_wallet_recovery_completed",payload:{walletAddress:r.address}}),e(!0)):t(i)}}else t(Error("Must have valid access token and Privy wallet to recover wallet"))})),getMoonpaySignedUrl:async(e,t)=>{let{signedUrl:r,externalTransactionId:n}=await async function(e,t,r,n,i=!1){let a=r.currencyCode?{}:{defaultCurrencyCode:"ETH_ETHEREUM"},o=r.uiConfig||{accentColor:n.accent,theme:n.colorScheme};return e.signMoonpayOnRampUrl({address:t,useSandbox:i,config:{...r,...a,...o}})}(c,e,t??{},Y.appearance.palette,Y.fundingMethodConfig?.moonpay.useSandbox??!1);return{signedUrl:r,externalTransactionId:n}},initCoinbaseOnRamp:c.initCoinbaseOnRamp.bind(c),getCoinbaseOnRampStatus:c.getCoinbaseOnRampStatus.bind(c),setReadyToTrue:e=>{f(!0),te?.(e)},updateWallets:()=>Ne(),fundWallet:async(e,t)=>{if(!Y.fundingConfig||0===Y.fundingConfig.methods.length)throw Error("Wallet funding is not enabled");let r=pf({fundingMethods:Y.fundingConfig.methods});ee({funding:df({address:e,appConfig:Y,fundWalletConfig:t,methodScreen:r})}),we(r)},requestFarcasterSignerStatus:async e=>{let t=await Sg(),r=x?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!t)throw Error("Must have valid access token to connect with Farcaster");if(!V||!r)throw Error("Must have an embedded wallet to use Farcaster signers");if(!x?.farcaster?.fid)throw Error("Must have Farcaster account to use Farcaster signers");let n=await c.requestFarcasterSignerStatus(e);return"approved"===n.status&&C(await c.getAuthenticatedUser()||x||null),n},connectCoinbaseSmartWallet:async()=>{Y.externalWallets.coinbaseWallet.connectionOptions="smartWalletOnly";let e=c.connectors?.findWalletConnector("coinbase_wallet","coinbase_smart_wallet")||c.connectors?.findWalletConnector("coinbase_wallet","coinbase_wallet");if(e)return e.updateConnectionPreference("smartWalletOnly"),Se(e);await be("coinbase_wallet","coinbase_smart_wallet")},initiateAccountTransfer:async({nonce:e,account:t,accountType:r,externalWalletMetadata:n,telegramAuthResult:i,farcasterEmbeddedAddress:a,oAuthUserInfo:o})=>{try{let s=await c.sendAccountTransferRequest({nonce:e,account:t,accountType:r,externalWalletMetadata:n,telegramAuthResult:i,farcasterEmbeddedAddress:a,oAuthUserInfo:o});return C(s),s}catch(e){throw e}}};Cg=Be.recoverEmbeddedEthereumWallet,Eg=Be.recoverEmbeddedSolanaWallet,bg=Be.solanaSignMessage;let He=i.useMemo((()=>({wallets:E,ready:ae&&ye})),[E,ae,ye]);return e.jsx(o.PrivyContext.Provider,{value:We,children:e.jsx(d.PrivyEventsContext.Provider,{value:pe,children:e.jsx(l.UseWalletsContext.Provider,{value:He,children:e.jsx(Ea,{...Y,children:e.jsxs(o.InternalPrivyContext.Provider,{value:Be,children:[e.jsx(d.RecentlyUsedAccountProvider,{children:e.jsxs(g.ModalProvider,{data:Q,setModalData:ee,setInitialScreen:N,initialScreen:k,authenticated:v,open:h,children:[s.children,!Y.headless&&Y.captchaEnabled&&y&&!v&&e.jsx(vo,{delayedExecution:!1}),e.jsx(Wf,{theme:{...Y.appearance.palette||{}}}),!Y.render.standalone&&e.jsx(Qf,{open:h})]})}),X&&Z?e.jsx(hg,{appId:s.appId,appClientId:s.clientId,clientAnalyticsId:c.clientAnalyticsId,origin:c.apiUrl,mfaMethods:x?.mfaMethods,mfaPromise:ue,mfaSubmitPromise:he,onLoad:K,onLoadFailed:()=>null}):null,Y.loginConfig.telegramAuthConfiguration&&e.jsx(ns,{$if:!0,children:e.jsx(rg,{scriptHost:s.apiUrl||l.DEFAULT_PRIVY_API_URL,botUsername:Y.loginConfig.telegramAuthConfiguration.botName})})]})})})})})};let Ng=async(e,t,r,n,i)=>{if(!e)throw n("linkAccount","onError",o.PrivyErrorCode.MUST_BE_AUTHENTICATED,{linkMethod:i}),new o.PrivyClientError("User must be authenticated before linking an account.");if(!t?.linkedAccounts.some((e=>e.type.includes(i))))throw new o.PrivyClientError(`OAuth account of type ${i} not linked to the account.`);await r(i)};const Ig=Mg;function Mg(){let{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}=o.usePrivy();return{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}}exports.usePrivy=o.usePrivy,exports.SUPPORTED_CHAINS=l.DEFAULT_SUPPORTED_CHAINS,exports.VERSION=l.VERSION,exports.addRpcUrlOverrideToChain=l.addRpcUrlOverrideToChain,exports.useWallets=l.useWallets,exports.useConnectWallet=d.useConnectWallet,exports.useFundWallet=d.useFundWallet,exports.useLogin=d.useLogin,exports.useLogout=d.useLogout,exports.WalletConnector=m.WalletConnector,exports.useSolanaWallets=m.useSolanaWallets,exports.getEmbeddedConnectedWallet=g.getEmbeddedConnectedWallet,exports.AsExternalProvider=Na,exports.Captcha=vo,exports.ConnectorManager=io,exports.EthereumWalletConnector=Fa,exports.LoginModal=Qf,exports.PrivyClient=fo,exports.PrivyProvider=({config:t,...r})=>{var n;if("undefined"!=typeof window&&0>["localhost","127.0.0.1"].indexOf(window.location.hostname)&&"https:"!==window.location.protocol)throw new o.PrivyClientError("Embedded wallet is only available over HTTPS");if("string"!=typeof(n=r.appId)||25!==n.length)throw new o.PrivyClientError("Cannot initialize the Privy provider with an invalid Privy app ID");gg||(gg=new fo({appId:r.appId,appClientId:r.clientId,apiUrl:r.apiUrl}));let i=Object.assign({},t);return void 0!==r.createPrivyWalletOnLogin&&void 0===i.embeddedWallets?.createOnLogin&&(i.embeddedWallets||(i.embeddedWallets={}),i.embeddedWallets.createOnLogin=r.createPrivyWalletOnLogin?"users-without-wallets":"off"),void 0!==r.createPrivyWalletOnLogin&&t?.embeddedWallets?.createOnLogin&&console.warn("Both `createPrivyWalletOnLogin` and `config.embeddedWallets.createOnLogin` are set. `createPrivyWalletOnLogin` is deprecated and should be removed."),e.jsx(l.PrivyAppConfigProvider,{client:gg,clientConfig:i,legacyCreateEmbeddedWalletFlag:r.createPrivyWalletOnLogin,children:e.jsx(kg,{...r,client:gg})})},exports.PrivyProxyProvider=Pa,exports.errorIndicatesMaxMfaRetries=id,exports.errorIndicatesMfaTimeout=rd,exports.errorIndicatesMfaVerificationFailed=nd,exports.getAccessToken=Sg,exports.useConnectCoinbaseSmartWallet=()=>{let{connectCoinbaseSmartWallet:e}=o.usePrivyInternal();return{connectCoinbaseSmartWallet:e}},exports.useCreateWallet=function(e){let{createWallet:t}=i.useContext(o.PrivyContext);return d.usePrivyEventSubscription("createWallet",e),{createWallet:t}},exports.useCrossAppAccounts=()=>{let{startCrossAppAuthFlow:e,unlinkCrossAppAccount:t,signMessageWithCrossAppWallet:r,signTypedDataWithCrossAppWallet:n,sendTransactionWithCrossAppWallet:i}=o.usePrivy();return{loginWithCrossAppAccount:({appId:t})=>e({appId:t,action:"login"}),linkCrossAppAccount:({appId:t})=>e({appId:t,action:"link"}),unlinkCrossAppAccount:t,signMessage:r,signTypedData:n,sendTransaction:i}},exports.useCustomAuth=e=>{let{customAuthStatus:t}=o.usePrivyInternal();return d.usePrivyEventSubscription("customAuth",e),{status:t}},exports.useExperimentalFarcasterSigner=Ig,exports.useFarcasterSigner=Mg,exports.useGuestAccounts=function(){let{createGuestAccount:e}=i.useContext(o.PrivyContext);return{createGuestAccount:e}},exports.useLinkAccount=function(e){let{linkEmail:t,linkPhone:r,linkWallet:n,linkGoogle:a,linkApple:s,linkTwitter:l,linkDiscord:c,linkGithub:u,linkLinkedIn:h,linkTiktok:p,linkSpotify:y,linkInstagram:m,linkTelegram:f,linkFarcaster:g}=i.useContext(o.PrivyContext);return d.usePrivyEventSubscription("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:n,linkGoogle:a,linkApple:s,linkTwitter:l,linkDiscord:c,linkGithub:u,linkLinkedIn:h,linkTiktok:p,linkSpotify:y,linkInstagram:m,linkFarcaster:g,linkTelegram:f}},exports.useLinkWithSiwe=e=>{let t=ba(),{generateSiweMessage:r}=o.usePrivy(),{siweState:n,setSiweState:a,linkWithSiwe:s}=o.usePrivyInternal();return{generateSiweMessage:i.useCallback((async({address:t,chainId:n})=>{try{if(!t||!n)throw Error("wallet address and chainId required to generate nonce");return await r({address:t,chainId:n}).then((e=>e))}catch(t){throw a({status:"error",error:t}),e?.onError?.(t.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR,{linkMethod:"siwe"}),t}}),[r]),linkWithSiwe:i.useCallback((async({signature:r,message:n,chainId:i,walletClientType:l,connectorType:d})=>{try{if(t.enabled&&"success"!==t.status)throw new Ca(t.error,null,o.PrivyErrorCode.CAPTCHA_FAILURE);let{user:a,linkedAccount:c}=await s({message:n,signature:r,chainId:i,walletClientType:l,connectorType:d});c&&e?.onSuccess?.(a,"siwe",c)}catch(r){throw a({status:"error",error:r}),e?.onError?.(r.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR,{linkMethod:"siwe"}),r}}),[s,t.status]),state:n}},exports.useLoginWithEmail=e=>{let t=ba(),{emailOtpState:r,setEmailOtpState:n,initLoginWithEmail:a,loginWithCode:s}=o.usePrivyInternal();return{sendCode:i.useCallback((async({email:r})=>{try{let e;if(!r)throw Error("Email required to send OTP code");if(t.enabled&&"error"===t.status)throw new Ca(t.error,null,o.PrivyErrorCode.CAPTCHA_FAILURE);return t.enabled&&"success"!==t.status&&(t.execute(),e=await t.waitForResult()),await a(r,e)}catch(r){throw n({status:"error",error:r}),e?.onError?.(r.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR),r}}),[a]),loginWithCode:i.useCallback((async({code:r})=>{try{if(t.enabled&&"error"===t.status)throw new Ca(t.error,null,o.PrivyErrorCode.CAPTCHA_FAILURE);let{user:n,isNewUser:i,wasAlreadyAuthenticated:a,linkedAccount:l}=await s(r);e?.onComplete?.(n,i,a,"email",l)}catch(r){throw n({status:"error",error:r}),e?.onError?.(r.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR),r}}),[s,t.status]),state:r}},exports.useLoginWithOAuth=e=>{d.usePrivyEventSubscription("login",e);let t=ba(),r=l.useIsServerConfigLoaded(),{initLoginWithHeadlessOAuth:n,loginWithHeadlessOAuth:a,isHeadlessOAuthLoading:s,ready:c,user:u}=o.usePrivy(),{oAuthState:h,setOAuthState:p}=o.usePrivyInternal(),y=i.useCallback((async e=>{try{if(t.enabled&&"success"!==t.status)throw new Ca(t.error,null,o.PrivyErrorCode.CAPTCHA_FAILURE);return await n(e.provider,t.token)}catch(e){throw p({status:"error",error:e}),e}}),[n,t]),m=i.useCallback((async()=>{let e=ha();try{if(u)return console.warn("Cannot login with OAuth when already logged in"),u;if(!e.inProgress)throw Error("Cannot login with OAuth because no OAuth flow is in progress");if(e.popupFlow)return}catch(e){throw p({status:"error",error:e}),e}try{return await a(e)}catch(e){throw p({status:"error",error:e}),e}finally{pa()}}),[a]);return i.useEffect((()=>{let e=ha();c&&r&&e.inProgress&&e.headless&&!e.popupFlow&&m()}),[c,r]),{initOAuth:y,loginWithOAuth:m,loading:s,state:h}},exports.useLoginWithPasskey=e=>{let t=ba(),{initLoginWithPasskey:r,loginWithPasskey:n,passkeyAuthState:a,setPasskeyAuthState:s}=o.usePrivyInternal();return{loginWithPasskey:i.useCallback((async()=>{try{let i;if(t.enabled&&"error"===t.status)throw new Ca(t.error,null,o.PrivyErrorCode.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),i=await t.waitForResult()),await r(i);let{user:a,isNewUser:s,wasAlreadyAuthenticated:l,loginAccount:d}=await n();e?.onComplete?.(a,s,l,"passkey",d)}catch(t){throw s({status:"error",error:t}),e?.onError?.(t),t}}),[n,t.status]),state:a}},exports.useLoginWithSms=e=>{let t=ba(),{smsOtpState:r,setSmsOtpState:n,initLoginWithSms:a,loginWithCode:s}=o.usePrivyInternal();return{sendCode:i.useCallback((async({phoneNumber:r})=>{try{let e;if(!r)throw Error("SMS required to send OTP code");if(t.enabled&&"error"===t.status)throw new Ca(t.error,null,o.PrivyErrorCode.CAPTCHA_FAILURE);return t.enabled&&"success"!==t.status&&(t.execute(),e=await t.waitForResult()),await a(r,e)}catch(r){throw n({status:"error",error:r}),e?.onError?.(r.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR),r}}),[a]),loginWithCode:i.useCallback((async({code:r})=>{try{if(t.enabled&&"success"!==t.status)throw new Ca(t.error,null,o.PrivyErrorCode.CAPTCHA_FAILURE);let{user:n,isNewUser:i,wasAlreadyAuthenticated:a,linkedAccount:l}=await s(r);e?.onComplete?.(n,i,a,"sms",l)}catch(r){throw n({status:"error",error:r}),e?.onError?.(r.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR),r}}),[s,t.status]),state:r}},exports.useMfa=Rp,exports.useMfaEnrollment=Fp,exports.useModalStatus=()=>{let{isModalOpen:e}=i.useContext(o.PrivyContext);return{isOpen:e}},exports.useOAuthTokens=function(e){let{authenticated:t,user:r}=o.usePrivy(),{initLoginWithOAuth:n}=o.usePrivyInternal(),i=d.useEmitPrivyEvent();return d.usePrivyEventSubscription("oAuthAuthorization",e),{reauthorize:e=>Ng(t,r,n,i,e.provider)}},exports.useRegisterMfaListener=wo,exports.useSendSolanaTransaction=function(e){let{sendSolanaTransaction:t}=i.useContext(o.PrivyContext);return d.usePrivyEventSubscription("sendSolanaTransaction",e),{sendSolanaTransaction:t}},exports.useSendTransaction=function(e){let{sendTransaction:t}=i.useContext(o.PrivyContext);return d.usePrivyEventSubscription("sendTransaction",e),{sendTransaction:t}},exports.useSetWalletPassword=function(e){let{setWalletPassword:t}=i.useContext(o.PrivyContext);return d.usePrivyEventSubscription("setWalletPassword",e),{setWalletPassword:t}},exports.useSetWalletRecovery=function(e){let{setWalletRecovery:t}=i.useContext(o.PrivyContext);return d.usePrivyEventSubscription("setWalletRecovery",e),{setWalletRecovery:t}},exports.useSignMessage=function(e){let{signMessage:t}=i.useContext(o.PrivyContext);return d.usePrivyEventSubscription("signMessage",e),{signMessage:t}},exports.useSignTypedData=function(e){let{signTypedData:t}=i.useContext(o.PrivyContext);return d.usePrivyEventSubscription("signTypedData",e),{signTypedData:t}},exports.useToken=function(e){let{getAccessToken:t}=i.useContext(o.PrivyContext);return d.usePrivyEventSubscription("accessToken",e),{getAccessToken:t}};
|