@privy-io/expo 0.26.1 → 0.26.2-beta-20241010170842

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.
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var pt=Object.defineProperty,mt=Object.defineProperties;var yt=Object.getOwnPropertyDescriptors;var oe=Object.getOwnPropertySymbols;var Ce=Object.prototype.hasOwnProperty,Re=Object.prototype.propertyIsEnumerable;var We=(e,t,o)=>t in e?pt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,R= exports.a =(e,t)=>{for(var o in t||(t={}))Ce.call(t,o)&&We(e,o,t[o]);if(oe)for(var o of oe(t))Re.call(t,o)&&We(e,o,t[o]);return e},V= exports.b =(e,t)=>mt(e,yt(t));var lr=(e,t)=>{var o={};for(var r in e)Ce.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&oe)for(var r of oe(e))t.indexOf(r)<0&&Re.call(e,r)&&(o[r]=e[r]);return o};var y=(e,t,o)=>new Promise((r,c)=>{var a=n=>{try{s(o.next(n))}catch(d){c(d)}},l=n=>{try{s(o.throw(n))}catch(d){c(d)}},s=n=>n.done?r(n.value):Promise.resolve(n.value).then(a,l);s((o=o.apply(e,t)).next())});var _expoappleauthentication = require('expo-apple-authentication'); var ot = _interopRequireWildcard(_expoappleauthentication);var _expoapplication = require('expo-application');var _expolinking = require('expo-linking'); var B = _interopRequireWildcard(_expolinking); var ie = _interopRequireWildcard(_expolinking); var z = _interopRequireWildcard(_expolinking); var H = _interopRequireWildcard(_expolinking);var _exposecurestore = require('expo-secure-store'); var O = _interopRequireWildcard(_exposecurestore);var _expowebbrowser = require('expo-web-browser'); var re = _interopRequireWildcard(_expowebbrowser); var De = _interopRequireWildcard(_expowebbrowser);var _react = require('react'); var _react2 = _interopRequireDefault(_react);var _reactnative = require('react-native');var _jssdkcore = require('@privy-io/js-sdk-core'); var _jssdkcore2 = _interopRequireDefault(_jssdkcore);var _expocrypto = require('expo-crypto');var ke={name:"@privy-io/expo",version:"0.26.2-beta-20241010170842",description:"Expo client for the Privy Auth API",keywords:["authentication","authorization","identity","privacy","privy","user data","react-native","expo","web3"],license:"Apache-2.0",source:"./src/index.ts",main:"./dist/esm/index.js",types:"./dist/index.d.ts",exports:{".":{require:"./dist/index.js",import:"./dist/esm/index.js",types:"./dist/index.d.ts"},"./passkey":{require:"./dist/passkey.js",import:"./dist/esm/passkey.js",types:"./dist/passkey.d.ts"}},files:["dist/**/*","LICENSE","README.md"],scripts:{build:"npx tsup --clean --minify","generate-types":"npx tsup --dts-only",clean:"rm -rf dist .turbo",dev:"npx tsup --watch",test:'jest --testMatch "**/test/**/*.test.ts"',"test:ci":"npm run test",lint:'eslint "src/**/*.{ts,tsx,js,jsx}" && npx tsc --noEmit',format:'eslint "src/**/*.{ts,tsx,js,jsx}" --fix'},peerDependencies:{"@privy-io/expo-native-extensions":"0.0.3",react:"*","react-native":"*","react-native-passkeys":"^0.2.1","react-native-webview":"*","react-native-safe-area-context":"*","react-native-svg":"*","expo-constants":"*","expo-linking":"*","expo-crypto":"*","expo-font":"*","@expo-google-fonts/inter":"*","expo-secure-store":"*","expo-application":"*","expo-apple-authentication":"*","expo-web-browser":"*"},peerDependenciesMeta:{"expo-font":{optional:!0},"@expo-google-fonts/inter":{optional:!0}},dependencies:{"@privy-io/js-sdk-core":"0.28.9-beta-20241010170842","react-fast-compare":"^3.2.2",zustand:"^4.4.1"},devDependencies:{"@privy-io/eslint-config-custom":"*","@privy-io/tsconfig":"*","@simplewebauthn/types":"9.0.1","@tsconfig/node16-strictest-esm":"^1.0.3","@svgr/core":"^8.1.0","@svgr/plugin-jsx":"^8.1.0","@svgr/plugin-svgo":"^8.1.0",tsup:"^6.2.3",typescript:"~5.5.3"},author:"privy.io",publishConfig:{access:"public"}};var _reactnativewebview = require('react-native-webview'); var _reactnativewebview2 = _interopRequireDefault(_reactnativewebview);var xe=({client:e,isClientReady:t,setWebViewState:o,webViewState:r,logLevel:c})=>{let a=_react.useRef.call(void 0, null);_react.useEffect.call(void 0, ()=>{a.current&&r==="loaded"&&e.setMessagePoster(a.current)},[e,a.current,r==="loaded"]),_react.useEffect.call(void 0, ()=>_reactnative.AppState.addEventListener("change",n=>y(void 0,null,function*(){a.current&&n==="active"&&((yield e.embeddedWallet.ping(500))||(a.current.reload(),o("reloading")))})).remove,[]);let l=_react.useCallback.call(void 0, s=>y(void 0,null,function*(){let{data:n}=s.nativeEvent;e.embeddedWallet.onMessage(JSON.parse(n))}),[e]);return t?_react2.default.createElement(_reactnativewebview2.default,{style:{flex:1},ref:a,cacheEnabled:!1,cacheMode:"LOAD_NO_CACHE",source:{uri:e.embeddedWallet.getURL()},webviewDebuggingEnabled:c==="DEBUG",onLoad:()=>o("loaded"),onError:console.error,onMessage:l}):null};function ae(i){return y(this,arguments,function*({client:e,setWallet:t,createWalletCallbacks:o,recoveryMethod:r,setRecoveryFlowState:c,password:a,recoveryToken:l,recoverySecretOverride:s,iCloudRecordNameOverride:n,solanaAccount:d}){var p,g;switch(r){case"user-passcode":if(!a)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"password is required for user-passcode recovery method"});break;case"google-drive":if(!l)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"Recovery token is required for google-drive recovery method"});break;case"icloud":if(!s||!n)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"iCloud recovery failed due to inability to store credentials"});break}t({status:"creating",account:null});let u=r==="icloud"?"icloud-native":r;try{let{provider:v,user:h}=yield e.embeddedWallet.create(a,u,l,s,n,d),m=_jssdkcore.getUserEmbeddedWallet.call(void 0, h);return(g=(p=o.current)==null?void 0:p.onSuccess)==null||g.call(p,v),t({status:"connected",provider:v,account:m}),c({status:"initial"}),v}catch(v){let h=v instanceof Error?v.message:"Error creating embedded wallet";throw t({status:"error",error:h,account:null}),c({status:"initial"}),new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_creation_error",error:h})}})}function Oe(a){return y(this,arguments,function*({client:e,setSolanaWallet:t,createSolanaWalletCallbacks:o,setSolanaRecoveryFlowState:r,ethereumAccount:c}){var l,s;t({status:"creating"});try{let n=yield e.embeddedWallet.createSolana({ethereumAccount:c});return(s=(l=o.current)==null?void 0:l.onSuccess)==null||s.call(l,n),t({status:"connected",publicKey:n._publicKey}),r({status:"initial"}),n}catch(n){let d=n instanceof Error?n.message:"Error creating embedded wallet";throw t({status:"error",error:d}),r({status:"initial"}),new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_creation_error",error:d})}})}function ne(d){return y(this,arguments,function*({client:e,account:t,setWallet:o,recoverWalletCallbacks:r,recoveryMethod:c,setRecoveryFlowState:a,password:l,recoveryToken:s,recoverySecretOverride:n}){var i,u,p,g;if(!t)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});switch(c){case"user-passcode":if(!l)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"password is required for user-passcode recovery method"});break;case"google-drive":if(!s)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"Recovery token is required for google-drive recovery method"});break;case"icloud":if(!n)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"Record name is required for icloud recovery method"});break}o({status:"connecting",account:t});try{let v=yield e.embeddedWallet.getProvider(t,l,s,n);return o({status:"connected",provider:v,account:t}),a({status:"initial"}),(u=(i=r.current)==null?void 0:i.onSuccess)==null||u.call(i,v),v}catch(v){o({status:"needs-recovery",account:t}),a({status:"initial"});let h=new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:v instanceof Error?v.message:"Error recovering embedded wallet"});throw(g=(p=r.current)==null?void 0:p.onError)==null||g.call(p,h),h}})}function Pe(a){return y(this,arguments,function*({client:e,solanaAccount:t,setSolanaWallet:o,recoverSolanaWalletCallbacks:r,setSolanaRecoveryFlowState:c}){var l,s,n,d;if(!t)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});o({status:"connecting"});try{let i=yield e.embeddedWallet.getSolanaProvider(t);return o({status:"connected",publicKey:i._publicKey}),c({status:"initial"}),(s=(l=r.current)==null?void 0:l.onSuccess)==null||s.call(l,i),i}catch(i){o({status:"needs-recovery"}),c({status:"initial"});let u=new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:i instanceof Error?i.message:"Error recovering embedded wallet"});throw(d=(n=r.current)==null?void 0:n.onError)==null||d.call(n,u),u}})}var Ie=({client:e,user:t,solanaWallet:o,setSolanaWallet:r,setSolanaRecoveryFlowState:c,webViewState:a,createSolanaWalletCallbacks:l,recoverSolanaWalletCallbacks:s})=>{let n=_react.useMemo.call(void 0, ()=>_jssdkcore.getUserEmbeddedSolanaWallet.call(void 0, t),[t]),d=_react.useCallback.call(void 0, ()=>y(void 0,null,function*(){var v;let{user:p}=yield e.user.get(),g=(v=_jssdkcore.getUserEmbeddedWallet.call(void 0, p))!=null?v:void 0;return yield Oe({client:e,setSolanaWallet:r,createSolanaWalletCallbacks:l,setSolanaRecoveryFlowState:c,ethereumAccount:g})}),[e,l]),i=_react.useCallback.call(void 0, ()=>y(void 0,null,function*(){if(!n)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});return Pe({client:e,solanaAccount:n,setSolanaWallet:r,recoverSolanaWalletCallbacks:s,setSolanaRecoveryFlowState:c})}),[e,n]),u=_react.useCallback.call(void 0, ()=>y(void 0,null,function*(){if(!n)throw r({status:"not-created"}),new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});r(p=>p.status==="connected"?{status:"reconnecting"}:{status:"connecting"});try{let p=yield e.embeddedWallet.getSolanaProvider(n);return r({status:"connected",publicKey:p._publicKey}),p}catch(p){throw _jssdkcore.errorIndicatesRecoveryIsNeeded.call(void 0, p)?(r({status:"needs-recovery"}),new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_needs_recovery",error:"Embedded wallet not loaded on device"})):p instanceof Error?(r({status:"error",error:p.message}),new (0, _jssdkcore.PrivyClientError)({code:"unknown_embedded_wallet_error",error:p.message})):(r({status:"error",error:"Error loading embedded wallet"}),new (0, _jssdkcore.PrivyClientError)({code:"unknown_embedded_wallet_error",error:"Error loading embedded wallet"}))}}),[e,n]);return _react.useEffect.call(void 0, ()=>{if(!t&&o.status!=="disconnected")return r({status:"disconnected"});a==="loaded"&&u().catch(()=>{})},[a,t,n]),_react.useEffect.call(void 0, ()=>{o.status==="error"&&o.error.includes("User must be logged in")&&u()},[o.status]),{create:d,recover:i,getProvider:u}};function Fe(){return y(this,null,function*(){try{return yield Promise.resolve().then(() => _interopRequireWildcard(require("@privy-io/expo-native-extensions")))}catch(e){throw new Error("@privy-io/expo-native-extensions not found. Ensure that you're explicitly including as a dependency, and running an Expo development build")}})}function ve(r){return y(this,arguments,function*({user:e,appId:t,client:o}){var s;if(_reactnative.Platform.OS==="android")throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"iCloud recovery is not supported on Android"});let c=yield Fe(),a=yield o.recovery.icloudAuth.getICloudConfiguration("expo-ios");if(!(a==null?void 0:a.container_identifier))throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"An iCloud Container ID must be specified in the Privy Dashboard."});try{let{recoverySecret:n,iCloudRecordName:d}=yield c.writeRecoverySecretToICloud({containerId:a.container_identifier,appId:t,userId:e.id});return{recoverySecret:n,iCloudRecordName:d}}catch(n){if(n instanceof Error){let d=(s=n.message.split("Caused by: ")[1])!=null?s:"Error writing to iCloud";throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:d})}throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"Error writing to iCloud"})}})}function Me(o){return y(this,arguments,function*({walletAddress:e,client:t}){var n;if(_reactnative.Platform.OS==="android")throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"iCloud recovery is not supported on Android"});let r=yield Fe(),a=(yield t.recovery.getRecoveryKeyMaterial(e)).icloud_record_name;if(!a)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"iCloud recovery not properly backed up."});let l=yield t.recovery.icloudAuth.getICloudConfiguration("expo-ios"),s=l==null?void 0:l.container_identifier;if(!s)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"An iCloud Container ID must be specified in the Privy Dashboard."});try{let{recoverySecret:d}=yield r.readRecoverySecretFromICloud({containerId:s,recordName:a});return{recoverySecret:d}}catch(d){if(d instanceof Error){let i=(n=d.message.split("Caused by: ")[1])!=null?n:"Error writing to iCloud";throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:i})}throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"Error writing to iCloud"})}})}var _reactfastcompare = require('react-fast-compare'); var _reactfastcompare2 = _interopRequireDefault(_reactfastcompare);var Te=e=>t=>e(o=>_reactfastcompare2.default.call(void 0, o,t)?o:t);function x(e){return e instanceof Error||e instanceof _jssdkcore.PrivyApiError||e instanceof _jssdkcore.PrivyClientError?e:typeof e=="string"?new Error(e):new Error("Unknown error")}var jr=e=>new Promise(t=>setTimeout(t,e));function qr(){let e=_react.useRef.call(void 0, _reactnative.AppState.currentState);_react.useEffect.call(void 0, ()=>_reactnative.AppState.addEventListener("change",r=>{e.current=r}).remove,[]);function t(){return _reactnative.AppState.currentState}return{appState:e,getCurrentAppState:t}}function se(c){return y(this,arguments,function*({provider:e,redirectUri:t,client:o,onError:r}){try{let a;switch(e){case"google-drive":{let{url:d}=yield o.recovery.auth.generateURL(ie.createURL(t||"/"));a=d;break}default:throw new (0, _jssdkcore.PrivyClientError)({error:"OAuth invalid provider",code:"embedded_wallet_recovery_error"})}let l=yield De.openAuthSessionAsync(a);if(_reactnative.Platform.OS==="android")return;if(l.type!=="success")throw new (0, _jssdkcore.PrivyClientError)({error:"Recovery OAuth session failed",code:"embedded_wallet_recovery_error"});let{queryParams:s}=ie.parse(l.url),n;switch(e){case"google-drive":{let{privy_oauth_state:d,privy_oauth_code:i}=s;if(!i||!d)throw new (0, _jssdkcore.PrivyClientError)({error:"Recovery OAuth invalid credentials",code:"embedded_wallet_recovery_error"});n=yield fe({oAuthCode:i,oAuthState:d,client:o});break}default:throw new (0, _jssdkcore.PrivyClientError)({error:"Recovery OAuth invalid provider",code:"embedded_wallet_recovery_error"})}return n}catch(a){throw r==null||r(x(a)),a}})}function fe(r){return y(this,arguments,function*({oAuthCode:e,oAuthState:t,client:o}){let{access_token:c}=yield o.recovery.auth.authorize(e,t);if(!c)throw new (0, _jssdkcore.PrivyClientError)({error:"OAuth invalid credentials",code:"login_with_oauth_returned_with_invalid_credentials"});return c})}function de(a){return y(this,arguments,function*({client:e,recoveryInput:t,setWalletRecoveryCallbacks:o,setRecoveryFlowState:r,setWallet:c}){var l,s,n,d;try{let{provider:i,user:u}=yield e.embeddedWallet.setRecovery(t),p=_jssdkcore.getUserEmbeddedWallet.call(void 0, u);return c({status:"connected",provider:i,account:p}),(s=(l=o.current)==null?void 0:l.onSuccess)==null||s.call(l,i),r({status:"initial"}),i}catch(i){let u=new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_set_recovery_error",error:i instanceof Error?i.message:"Error setting password on embedded wallet"});throw(d=(n=o.current)==null?void 0:n.onError)==null||d.call(n,u),r({status:"initial"}),u}})}function Ve(e){return e===void 0?{recoveryMethod:"privy"}:typeof e=="string"?{recoveryMethod:"user-passcode",password:e}:e.recoveryMethod==="user-passcode"?{recoveryMethod:"user-passcode",password:e.password}:{recoveryMethod:e.recoveryMethod}}var ze=({client:e,user:t,appId:o,wallet:r,setWallet:c,setRecoveryFlowState:a,webViewState:l,createWalletCallbacks:s,recoverWalletCallbacks:n,setWalletRecoveryCallbacks:d})=>{let i=_react.useMemo.call(void 0, ()=>_jssdkcore.getUserEmbeddedWallet.call(void 0, t),[t]),u=_react.useCallback.call(void 0, m=>y(void 0,null,function*(){var A,N;if(i)throw new (0, _jssdkcore.PrivyClientError)({error:"This user already has an embedded wallet",code:"embedded_wallet_already_exists"});let{user:w}=yield e.user.get(),{password:f,recoveryMethod:b}=Ve(m),S,E,U;if(b==="google-drive"&&(S=yield se({provider:b,client:e,onError:(A=s.current)==null?void 0:A.onError}),a({status:"creating-wallet"}),!S))return null;if(b==="icloud"){if(!w)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"User must be loaded before creating a wallet with iCloud."});let{recoverySecret:I,iCloudRecordName:L}=yield ve({user:w,appId:o,client:e});E=I,U=L}return yield ae({client:e,setWallet:c,createWalletCallbacks:s,recoveryMethod:b,setRecoveryFlowState:a,password:f,recoverySecretOverride:E,iCloudRecordNameOverride:U,solanaAccount:(N=_jssdkcore.getUserEmbeddedSolanaWallet.call(void 0, w))!=null?N:void 0})}),[e,i,t]),p=_react.useCallback.call(void 0, m=>y(void 0,null,function*(){var b;if(r.status!=="connected")throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_to_set_password_before_connected",error:"Embedded wallet must be connected before setting password"});if(!i)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});if(_jssdkcore.getUserEmbeddedSolanaWallet.call(void 0, t))throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_set_recovery_error",error:"Cannot set user-controlled recovery for a user with an embedded Solana wallet."});_jssdkcore.throwIfInvalidRecoveryUpgradePath.call(void 0, {currentRecoveryMethod:i.recovery_method,upgradeToRecoveryMethod:m.recoveryMethod});let w,f;switch(m.recoveryMethod){case"privy":f=V(R({},m),{wallet:i});break;case"user-passcode":f=V(R({},m),{wallet:i,password:m.password});break;case"google-drive":if(w=yield se({provider:m.recoveryMethod,client:e,onError:(b=d.current)==null?void 0:b.onError}),a({status:"upgrading-recovery"}),!w)return null;f={recoveryMethod:"google-drive",wallet:i,recoveryAccessToken:w};break;case"icloud":if(!t)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"User must be loaded before backing up to iCloud."});let{recoverySecret:S,iCloudRecordName:E}=yield ve({user:t,appId:o,client:e});f={recoveryMethod:"icloud-native",recoverySecretOverride:S,iCloudRecordNameOverride:E,wallet:i};break;default:throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"Unrecognized recovery method"})}return de({client:e,recoveryInput:f,setWalletRecoveryCallbacks:d,setRecoveryFlowState:a,setWallet:c})}),[e,i,r.status,t]),g=_react.useCallback.call(void 0, m=>y(void 0,null,function*(){return p({recoveryMethod:"user-passcode",password:m})}),[e,i,r.status]),v=_react.useCallback.call(void 0, m=>y(void 0,null,function*(){var E;if(!i)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});let{password:w,recoveryMethod:f}=Ve(m),b,S;if(f==="google-drive"&&(b=yield se({provider:f,client:e,onError:(E=n.current)==null?void 0:E.onError}),a({status:"recovering"}),!b))return null;if(f==="icloud"){if(!t)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"User must be loaded before recovering via iCloud."});let{recoverySecret:U}=yield Me({client:e,walletAddress:i.address});S=U}return ne({client:e,account:i,setWallet:c,recoverWalletCallbacks:n,recoveryMethod:f,setRecoveryFlowState:a,password:w,recoveryToken:b,recoverySecretOverride:S})}),[e,i]),h=_react.useCallback.call(void 0, ()=>y(void 0,null,function*(){if(!i)throw c({status:"not-created",account:null}),new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});c(m=>m.status==="connected"?{status:"reconnecting",account:i}:{status:"connecting",account:i});try{let m=yield e.embeddedWallet.getProvider(i);return c({status:"connected",provider:m,account:i}),m}catch(m){throw _jssdkcore.errorIndicatesRecoveryIsNeeded.call(void 0, m)?(c({status:"needs-recovery",account:i}),new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_needs_recovery",error:"Embedded wallet not loaded on device"})):m instanceof Error?(c({status:"error",error:m.message,account:i}),new (0, _jssdkcore.PrivyClientError)({code:"unknown_embedded_wallet_error",error:m.message})):(c({status:"error",error:"Error loading embedded wallet",account:i}),new (0, _jssdkcore.PrivyClientError)({code:"unknown_embedded_wallet_error",error:"Error loading embedded wallet"}))}}),[e,i]);return _react.useEffect.call(void 0, ()=>{if(!t&&r.status!=="disconnected")return c({status:"disconnected",account:null});l==="loaded"&&h().catch(()=>{})},[l,t,i]),_react.useEffect.call(void 0, ()=>{r.status==="error"&&r.error.includes("User must be logged in")&&h()},[r.status]),{create:u,recover:v,setPassword:g,setRecovery:p,getProvider:h}};var qe=({client:e,user:t,isReady:o,customAuth:r})=>{let[c,a]=_react.useState.call(void 0, {status:"initial"});return _react.useEffect.call(void 0, ()=>{(()=>y(void 0,null,function*(){if(!(r!=null&&r.enabled)){a({status:"not-enabled"});return}a({status:"loading"});let{getCustomAccessToken:s,isLoading:n}=r;if(!(!o||n))try{let d=yield s();if(!d&&t){yield e.auth.logout(),a({status:"done"});return}if(!d){a({status:"done"});return}if(t){a({status:"done"});return}if(!(yield e.auth.customProvider.syncWithToken(d))){yield e.auth.logout(),a({status:"error",error:new (0, _jssdkcore.PrivyClientError)({error:"Failed to sync with custom auth provider",code:"third_party_auth_error"})});return}a({status:"done"})}catch(d){if(console.log("Error syncing with custom auth provider",d),a({status:"error",error:d}),t)throw yield e.auth.logout(),new (0, _jssdkcore.PrivyClientError)({error:"Third-party auth failed",code:"third_party_auth_error"})}}))()},[e,t,o,r==null?void 0:r.enabled,r==null?void 0:r.getCustomAccessToken,r==null?void 0:r.isLoading]),{customAuthState:c,customAuthStateIsSettled:c.status!=="loading"&&c.status!=="initial"}};var Be=({client:e,user:t,isUserInitialized:o,oAuthState:r,oAuthCallbacks:c,setOAuthState:a,recoveryFlowState:l,oAuthStateRef:s})=>{let n=z.useURL(),d=_react.useCallback.call(void 0, i=>{var p,g;let u=x(i);a({status:"error",error:u}),(g=(p=c.current).onError)==null||g.call(p,u)},[a]);return _react.useEffect.call(void 0, ()=>{function i(){return y(this,null,function*(){var v,h;if(!n||r.status!=="loading"||l.status!=="initial")return;let{queryParams:u}=z.parse(n),{privy_oauth_state:p,privy_oauth_code:g}=u;if(!g||!p){a({status:"done"});return}try{let m,w;if(t)m=yield e.auth.oauth.linkWithCode(g,p);else{let f=yield e.auth.oauth.loginWithCode(g,p,void 0,void 0,s.current.disableSignup?"no-signup":"login-or-sign-up");m=f.user,w=!!f.is_new_user}return(h=(v=c.current).onSuccess)==null||h.call(v,m,w),s.current={},a({status:"done"}),yield z.openURL(n.split("?")[0])}catch(m){s.current={},d(m)}})}_reactnative.Platform.OS==="android"&&o&&i()},[n,o])};var Ke=({client:e,user:t,createWalletCallbacks:o,recoverWalletCallbacks:r,setWalletRecoveryCallbacks:c,recoveryFlowState:a,oAuthState:l,setRecoveryFlowState:s,setWallet:n,appStateVisible:d,webViewLoaded:i})=>{let u=H.useURL(),p=_react.useMemo.call(void 0, ()=>_jssdkcore.getUserEmbeddedWallet.call(void 0, t),[t]),g=_react.useCallback.call(void 0, v=>{var m,w,f,b;let h=x(v);a.status==="creating-wallet"?(w=(m=o.current).onError)==null||w.call(m,x(h)):(b=(f=r.current).onError)==null||b.call(f,x(h)),s({status:"initial"})},[a]);return _react.useEffect.call(void 0, ()=>{function v(){return y(this,null,function*(){var f;if(!u&&a.status!=="initial"&&d&&g(new Error("Recovery OAuth session failed")),!u||a.status==="initial"||l.status!=="initial"||!d||!i)return;let{queryParams:h}=H.parse(u),{privy_oauth_state:m,privy_oauth_code:w}=h;if(!(!w||!m)){yield H.openURL(u.split("?")[0]);try{let b=yield fe({oAuthCode:w,oAuthState:m,client:e});if(a.status==="creating-wallet"){let S=(f=_jssdkcore.getUserEmbeddedSolanaWallet.call(void 0, t))!=null?f:void 0;yield ae({client:e,setWallet:n,createWalletCallbacks:o,recoveryMethod:"google-drive",setRecoveryFlowState:s,recoveryToken:b,solanaAccount:S})}else if(a.status==="upgrading-recovery"){if(!p)throw new Error("Embedded wallet not found");yield de({client:e,recoveryInput:{recoveryMethod:"google-drive",wallet:p,recoveryAccessToken:b},setWalletRecoveryCallbacks:c,setRecoveryFlowState:s,setWallet:n})}else yield ne({client:e,account:p,setWallet:n,recoverWalletCallbacks:r,recoveryMethod:"google-drive",setRecoveryFlowState:s,recoveryToken:b})}catch(b){g(b)}}})}_reactnative.Platform.OS==="android"&&v()},[u,a.status,d,i])};var Ge=({client:e,isUserInitialized:t,setIsUserInitialized:o})=>{_react.useEffect.call(void 0, ()=>{t||(()=>y(void 0,null,function*(){try{yield e.user.get()}catch(c){}finally{o(!0)}}))()},[t])};var _zustand = require('zustand');var k=class extends Error{constructor(o,r){super(r);this.code=o,this.error=r}};var le={success:e=>({value:e}),error:e=>({error:e})};var Ye=e=>{let t=Array.from(new Set(e)),o=t.length;return o===0?le.error(new k("no_login_methods_available","No login methods available")):o>2?le.error(new k("too_many_login_methods",`More than two (${o}) login methods were provided`)):le.success(t)},Ho= exports.p =e=>e[0],qo= exports.q =(e,t)=>{if(e.length!==2)return null;let[o,r]=e;return t===o?r:o},Bo= exports.r ={email:"email",sms:"phone"};var Qt=1e3*60*5,q=_zustand.create.call(void 0, )((e,t)=>({privyElementsConfig:null,loginPromiseExecutor:null,isUIMounted:!1,updateUIMounted:o=>e({isUIMounted:o}),openLoginFlow:(o,r,c)=>new Promise((a,l)=>{if(r!==null)return l(new k("user_already_logged_in","User is already logged in"));if(!t().isUIMounted)return l(new k("privy_elements_not_ready","Privy Elements is not mounted"));if(t().loginPromiseExecutor!==null)return l(new k("existing_login_flow_in_progress","A login flow is already in progress"));let s=Ye(o.loginMethods);if(s.error)return l(s.error);let n={loginMethods:s.value},d=setTimeout(()=>{l(new k("login_flow_timeout","The login flow timed out")),t().closeLoginFlow()},Qt);c(),e({loginPromiseExecutor:{resolve(u){clearTimeout(d),a(u)},reject(u){clearTimeout(d),l(u)}},privyElementsConfig:n})}),closeLoginFlow:()=>{var o;return(o=t().loginPromiseExecutor)==null||o.reject(new k("login_flow_closed","The login flow was closed")),e({privyElementsConfig:null,loginPromiseExecutor:null})}})),Jo= exports.s =()=>q(e=>e.privyElementsConfig),Qo= exports.t =()=>q(e=>e.openLoginFlow),Zo= exports.u =()=>q(e=>e.closeLoginFlow),Zt=e=>{let{loginPromiseExecutor:t}=q.getState();t==null||t.resolve(e)},Xe=()=>Zt,ea= exports.v =()=>{let e=q(t=>t.updateUIMounted);_react.useEffect.call(void 0, ()=>(e(!0),()=>{e(!1)}),[e])},ta= exports.w =()=>q(e=>e.privyElementsConfig!==null);var we=_react.createContext.call(void 0, {}),D;function wa(e){return D?D.getAccessToken():e!=null&&e.strict?Promise.reject(new (0, _jssdkcore.PrivyClientError)({code:"attempted_to_read_storage_before_client_initialized",error:"Called `getAccessToken` before client initialized"})):(console.warn("Called `getAccessToken` before client initialized"),Promise.resolve(null))}var Sa=e=>{var _e;let[t,o]=_react.useState.call(void 0, _reactnative.AppState.currentState==="active");_react.useEffect.call(void 0, ()=>{let F=_reactnative.AppState.addEventListener("change",ut=>{o(ut==="active")});return()=>{F.remove()}},[]);let[r,c]=_react.useState.call(void 0, !1),[a,l]=_react.useState.call(void 0, "loading"),[s,n]=_react.useState.call(void 0, !1),[d,i]=_react.useState.call(void 0, null),[u,p]=_react.useState.call(void 0, {status:"disconnected",account:null}),[g,v]=_react.useState.call(void 0, {status:"disconnected"}),[h,m]=_react.useState.call(void 0, {status:"initial"}),[w,f]=_react.useState.call(void 0, {status:"initial"}),b=_react.useRef.call(void 0, {}),[S,E]=_react.useState.call(void 0, {status:"initial"}),[U,A]=_react.useState.call(void 0, {status:"initial"}),[N,I]=_react.useState.call(void 0, {status:"initial"}),[L,K]=_react.useState.call(void 0, {status:"initial"}),[G,Y]=_react.useState.call(void 0, {status:"initial"}),X=_react.useRef.call(void 0, {}),ue=_react.useRef.call(void 0, {}),pe=_react.useRef.call(void 0, {}),me=_react.useRef.call(void 0, {}),he=_react.useRef.call(void 0, {}),Ee=_react.useRef.call(void 0, {}),at=Xe(),$=_react.useCallback.call(void 0, F=>{if(F){at(F),Te(i)(F);return}i(null),m({status:"initial"}),f({status:"initial"}),p({status:"disconnected",account:null})},[]),_=_react.useMemo.call(void 0, ()=>{let F=e.storage||et;return e.client?(D=e.client,D.setCallbacks({setUser:$,setIsReady:n}),D):(D=new (0, _jssdkcore2.default)({storage:Ze(F),appId:e.appId,clientId:e.clientId,supportedChains:e.supportedChains,nativeAppIdentifier:Qe(),baseUrl:e.baseUrl,sdkVersion:`expo:${ke.version}`,callbacks:{setUser:$,setIsReady:n},logLevel:e.logLevel,crypto:{digest:_expocrypto.digest}}),D)},[e.client,e.storage,e.appId,e.clientId,e.baseUrl,e.supportedChains,e.logLevel,$]),nt=_react.useCallback.call(void 0, ()=>($(null),_.auth.logout()),[$,_]),it=_react.useCallback.call(void 0, ()=>_.getAccessToken(),[_]),st=_react.useCallback.call(void 0, ()=>_.getIdentityToken(),[_]);Ge({client:_,isUserInitialized:r,setIsUserInitialized:c});let dt=ze({client:_,user:d,appId:e.appId,webViewState:a,createWalletCallbacks:ue,recoverWalletCallbacks:pe,setWalletRecoveryCallbacks:me,setRecoveryFlowState:E,wallet:u,setWallet:p}),lt=Ie({client:_,user:d,webViewState:a,createSolanaWalletCallbacks:he,recoverSolanaWalletCallbacks:Ee,setSolanaRecoveryFlowState:A,solanaWallet:g,setSolanaWallet:v});Be({client:_,isUserInitialized:r,user:d,oAuthState:w,setOAuthState:f,oAuthCallbacks:X,recoveryFlowState:S,oAuthStateRef:b}),Ke({client:_,user:d,webViewLoaded:a==="loaded",createWalletCallbacks:ue,recoverWalletCallbacks:pe,setWalletRecoveryCallbacks:me,recoveryFlowState:S,oAuthState:w,setRecoveryFlowState:E,setWallet:p,appStateVisible:t});let{customAuthStateIsSettled:ct}=qe({client:_,user:d,isReady:r,customAuth:(_e=e.config)==null?void 0:_e.customAuth});return _react2.default.createElement(_react2.default.Fragment,null,_react2.default.createElement(we.Provider,{value:{client:_,user:d,isReady:a!=="loading"&&r&&Je(w)&&ct,logout:nt,getAccessToken:it,getIdentityToken:st,wallet:R(R({},u),dt),solanaWallet:R(R({},g),lt),oAuthState:w,oAuthCallbacks:X,recoveryFlowState:S,setRecoveryFlowState:E,solanaRecoveryFlowState:U,setSolanaRecoveryFlowState:A,createWalletCallbacks:ue,recoverWalletCallbacks:pe,setWalletRecoveryCallbacks:me,createSolanaWalletCallbacks:he,recoverSolanaWalletCallbacks:Ee,setOAuthState:f,siweState:N,setSiweState:I,otpState:h,setOtpState:m,passkeyState:L,setPasskeyState:K,farcasterState:G,setFarcasterState:Y,oAuthStateRef:b}},e.children),_react2.default.createElement(_reactnative.View,{style:{width:0,height:0,overflow:"hidden"}},_react2.default.createElement(xe,{logLevel:e.logLevel,client:_,isClientReady:s,setWebViewState:l,webViewState:a})))};var Je=e=>e.status!=="loading",ge=(e={})=>{let{user:t,oAuthState:o,setOAuthState:r,oAuthCallbacks:c,client:a,oAuthStateRef:l}=_react.useContext.call(void 0, we),s=e.action?e.action==="login":!t;_react.useEffect.call(void 0, ()=>{c.current={onSuccess:e.onSuccess,onError:e.onError}},[e.onSuccess,e.onError]);let n=_react.useCallback.call(void 0, i=>{var p;let u=x(i);return r({status:"error",error:u}),(p=e==null?void 0:e.onError)==null||p.call(e,u),u},[e==null?void 0:e.onError]);return{start:_react.useCallback.call(void 0, function(h){return y(this,arguments,function*({provider:u,redirectUri:p,isLegacyAppleIosBehaviorEnabled:g=!1,disableSignup:v}){var m,w,f;r({status:"loading"}),l.current={disableSignup:v};try{if(t&&e.action==="login")throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_login_with_oauth_while_already_logged_in",error:"Already logged in, if trying to link an OAuth account use `useLinkWithOAuth`"});if(!t&&e.action==="link")throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_link_oauth_before_logged_in",error:"Must be logged in to link an OAuth account, use `useLoginWithOAuth`"});let{url:b}=yield a.auth.oauth.generateURL(u,B.createURL(p||"/")),S,E;if(_reactnative.Platform.OS==="ios"&&u==="apple"&&!g){let G=(m=new URL(b).searchParams.get("state"))!=null?m:"",Y=yield ot.signInAsync({state:G});if(!Y.authorizationCode)throw new (0, _jssdkcore.PrivyClientError)({error:"OAuth invalid credentials",code:s?"login_with_oauth_returned_with_invalid_credentials":"link_with_oauth_returned_with_invalid_credentials"});if(s){let X=yield a.auth.oauth.loginWithCode(Y.authorizationCode,G,u,"raw",v?"no-signup":"login-or-sign-up");S=X.user,E=X.is_new_user}else S=yield a.auth.oauth.linkWithCode(Y.authorizationCode,G,u,"raw");return(w=e==null?void 0:e.onSuccess)==null||w.call(e,S,E),r({status:"done"}),S!=null?S:void 0}let U=_reactnative.Platform.OS==="android"?b.replace("x.com","twitter.com"):b,A=yield re.openAuthSessionAsync(U);if(_reactnative.Platform.OS==="android")return;if(A.type!=="success")throw[re.WebBrowserResultType.CANCEL,re.WebBrowserResultType.DISMISS].includes(A.type)?new (0, _jssdkcore.PrivyClientError)({error:"OAuth was cancelled",code:s?"login_with_oauth_was_cancelled_by_user":"link_with_oauth_was_cancelled_by_user"}):new (0, _jssdkcore.PrivyClientError)({error:"OAuth session failed",code:s?"failed_to_complete_login_with_oauth":"failed_to_complete_link_with_oauth"});let{queryParams:N}=B.parse(A.url),{privy_oauth_state:I,privy_oauth_code:L}=N;if(!L||!I)throw new (0, _jssdkcore.PrivyClientError)({error:"OAuth invalid credentials",code:s?"login_with_oauth_returned_with_invalid_credentials":"link_with_oauth_returned_with_invalid_credentials"});if(s){let K=yield a.auth.oauth.loginWithCode(L,I,u,void 0,v?"no-signup":"login-or-sign-up");S=K.user,E=K.is_new_user}else S=yield a.auth.oauth.linkWithCode(L,I,u);return(f=e==null?void 0:e.onSuccess)==null||f.call(e,S,E),yield B.openURL(A.url.split("?")[0]),r({status:"done"}),S!=null?S:void 0}catch(b){n(b)}})},[t,a,r,n]),state:o}};function Aa(e){let{state:t,start:o}=ge(V(R({},e),{action:"login"}));return{state:t,login:o}}function xa(e){let{state:t,start:o}=ge(V(R({},e),{action:"link"}));return{state:t,link:o}}function Oa(e){return ge(e)}var Qe=()=>{if(typeof _expoapplication.applicationId!="string")throw new (0, _jssdkcore.PrivyClientError)({error:"Cannot determine native application ID. Please make sure `expo-application` is installed as a dependency and that `ios.bundleId` or `android.package` is set.",code:"invalid_native_app_id"});return _expoapplication.applicationId};function Ze(e){return{get(t){return e.get(t.replaceAll(":","-"))},put(t,o){return e.put(t.replaceAll(":","-"),o)},del(t){return e.del(t.replaceAll(":","-"))},getKeys:()=>y(this,null,function*(){return[]})}}var et={get(e){return O.getItemAsync(e,{keychainAccessible:O.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY})},put(e,t){return O.setItemAsync(e,t,{keychainAccessible:O.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY})},del(e){return O.deleteItemAsync(e,{keychainAccessible:O.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY})},getKeys:()=>y(void 0,null,function*(){return[]})};function Ia(e){return e.status==="connected"}function La(e){return e.status==="reconnecting"}function Fa(e){return e.status==="connecting"}function Ma(e){return e.status==="disconnected"}function Ta(e){return e.status==="not-created"}function Da(e){return e.status==="creating"}function ja(e){return e.status==="error"}function Na(e){return e.status==="needs-recovery"}exports.a = R; exports.b = V; exports.c = lr; exports.d = y; exports.e = ke; exports.f = x; exports.g = jr; exports.h = qr; exports.i = Aa; exports.j = xa; exports.k = Oa; exports.l = Qe; exports.m = Ze; exports.n = et; exports.o = k; exports.p = Ho; exports.q = qo; exports.r = Bo; exports.s = Jo; exports.t = Qo; exports.u = Zo; exports.v = ea; exports.w = ta; exports.x = we; exports.y = wa; exports.z = Sa; exports.A = Ia; exports.B = La; exports.C = Fa; exports.D = Ma; exports.E = Ta; exports.F = Da; exports.G = ja; exports.H = Na;
@@ -0,0 +1 @@
1
+ var pt=Object.defineProperty,mt=Object.defineProperties;var yt=Object.getOwnPropertyDescriptors;var oe=Object.getOwnPropertySymbols;var Ce=Object.prototype.hasOwnProperty,Re=Object.prototype.propertyIsEnumerable;var We=(e,t,o)=>t in e?pt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,R=(e,t)=>{for(var o in t||(t={}))Ce.call(t,o)&&We(e,o,t[o]);if(oe)for(var o of oe(t))Re.call(t,o)&&We(e,o,t[o]);return e},V=(e,t)=>mt(e,yt(t));var lr=(e,t)=>{var o={};for(var r in e)Ce.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&oe)for(var r of oe(e))t.indexOf(r)<0&&Re.call(e,r)&&(o[r]=e[r]);return o};var y=(e,t,o)=>new Promise((r,c)=>{var a=n=>{try{s(o.next(n))}catch(d){c(d)}},l=n=>{try{s(o.throw(n))}catch(d){c(d)}},s=n=>n.done?r(n.value):Promise.resolve(n.value).then(a,l);s((o=o.apply(e,t)).next())});import*as ot from"expo-apple-authentication";import{applicationId as tt}from"expo-application";import*as B from"expo-linking";import*as O from"expo-secure-store";import*as re from"expo-web-browser";import{useCallback as rt,useContext as sr,useEffect as dr}from"react";import{Platform as Se}from"react-native";import{PrivyClientError as j}from"@privy-io/js-sdk-core";import{digest as er}from"expo-crypto";import te,{useState as W,useMemo as tr,createContext as rr,useCallback as ce,useRef as T,useEffect as or}from"react";import{AppState as $e,View as ar}from"react-native";import nr,{PrivyClientError as ir}from"@privy-io/js-sdk-core";var ke={name:"@privy-io/expo",version:"0.26.2-beta-20241010170842",description:"Expo client for the Privy Auth API",keywords:["authentication","authorization","identity","privacy","privy","user data","react-native","expo","web3"],license:"Apache-2.0",source:"./src/index.ts",main:"./dist/esm/index.js",types:"./dist/index.d.ts",exports:{".":{require:"./dist/index.js",import:"./dist/esm/index.js",types:"./dist/index.d.ts"},"./passkey":{require:"./dist/passkey.js",import:"./dist/esm/passkey.js",types:"./dist/passkey.d.ts"}},files:["dist/**/*","LICENSE","README.md"],scripts:{build:"npx tsup --clean --minify","generate-types":"npx tsup --dts-only",clean:"rm -rf dist .turbo",dev:"npx tsup --watch",test:'jest --testMatch "**/test/**/*.test.ts"',"test:ci":"npm run test",lint:'eslint "src/**/*.{ts,tsx,js,jsx}" && npx tsc --noEmit',format:'eslint "src/**/*.{ts,tsx,js,jsx}" --fix'},peerDependencies:{"@privy-io/expo-native-extensions":"0.0.3",react:"*","react-native":"*","react-native-passkeys":"^0.2.1","react-native-webview":"*","react-native-safe-area-context":"*","react-native-svg":"*","expo-constants":"*","expo-linking":"*","expo-crypto":"*","expo-font":"*","@expo-google-fonts/inter":"*","expo-secure-store":"*","expo-application":"*","expo-apple-authentication":"*","expo-web-browser":"*"},peerDependenciesMeta:{"expo-font":{optional:!0},"@expo-google-fonts/inter":{optional:!0}},dependencies:{"@privy-io/js-sdk-core":"0.28.9-beta-20241010170842","react-fast-compare":"^3.2.2",zustand:"^4.4.1"},devDependencies:{"@privy-io/eslint-config-custom":"*","@privy-io/tsconfig":"*","@simplewebauthn/types":"9.0.1","@tsconfig/node16-strictest-esm":"^1.0.3","@svgr/core":"^8.1.0","@svgr/plugin-jsx":"^8.1.0","@svgr/plugin-svgo":"^8.1.0",tsup:"^6.2.3",typescript:"~5.5.3"},author:"privy.io",publishConfig:{access:"public"}};import bt from"react";import{useCallback as ft,useEffect as Ae,useRef as wt}from"react";import{AppState as St}from"react-native";import gt from"react-native-webview";var xe=({client:e,isClientReady:t,setWebViewState:o,webViewState:r,logLevel:c})=>{let a=wt(null);Ae(()=>{a.current&&r==="loaded"&&e.setMessagePoster(a.current)},[e,a.current,r==="loaded"]),Ae(()=>St.addEventListener("change",n=>y(void 0,null,function*(){a.current&&n==="active"&&((yield e.embeddedWallet.ping(500))||(a.current.reload(),o("reloading")))})).remove,[]);let l=ft(s=>y(void 0,null,function*(){let{data:n}=s.nativeEvent;e.embeddedWallet.onMessage(JSON.parse(n))}),[e]);return t?bt.createElement(gt,{style:{flex:1},ref:a,cacheEnabled:!1,cacheMode:"LOAD_NO_CACHE",source:{uri:e.embeddedWallet.getURL()},webviewDebuggingEnabled:c==="DEBUG",onLoad:()=>o("loaded"),onError:console.error,onMessage:l}):null};import{useCallback as ye,useEffect as Ue,useMemo as Et}from"react";import{errorIndicatesRecoveryIsNeeded as _t,getUserEmbeddedSolanaWallet as Wt,getUserEmbeddedWallet as Ct,PrivyClientError as Q}from"@privy-io/js-sdk-core";import{getUserEmbeddedWallet as ht}from"@privy-io/js-sdk-core";import{PrivyClientError as J}from"@privy-io/js-sdk-core";function ae(i){return y(this,arguments,function*({client:e,setWallet:t,createWalletCallbacks:o,recoveryMethod:r,setRecoveryFlowState:c,password:a,recoveryToken:l,recoverySecretOverride:s,iCloudRecordNameOverride:n,solanaAccount:d}){var p,g;switch(r){case"user-passcode":if(!a)throw new J({code:"embedded_wallet_recovery_error",error:"password is required for user-passcode recovery method"});break;case"google-drive":if(!l)throw new J({code:"embedded_wallet_recovery_error",error:"Recovery token is required for google-drive recovery method"});break;case"icloud":if(!s||!n)throw new J({code:"embedded_wallet_recovery_error",error:"iCloud recovery failed due to inability to store credentials"});break}t({status:"creating",account:null});let u=r==="icloud"?"icloud-native":r;try{let{provider:v,user:h}=yield e.embeddedWallet.create(a,u,l,s,n,d),m=ht(h);return(g=(p=o.current)==null?void 0:p.onSuccess)==null||g.call(p,v),t({status:"connected",provider:v,account:m}),c({status:"initial"}),v}catch(v){let h=v instanceof Error?v.message:"Error creating embedded wallet";throw t({status:"error",error:h,account:null}),c({status:"initial"}),new J({code:"embedded_wallet_creation_error",error:h})}})}function Oe(a){return y(this,arguments,function*({client:e,setSolanaWallet:t,createSolanaWalletCallbacks:o,setSolanaRecoveryFlowState:r,ethereumAccount:c}){var l,s;t({status:"creating"});try{let n=yield e.embeddedWallet.createSolana({ethereumAccount:c});return(s=(l=o.current)==null?void 0:l.onSuccess)==null||s.call(l,n),t({status:"connected",publicKey:n._publicKey}),r({status:"initial"}),n}catch(n){let d=n instanceof Error?n.message:"Error creating embedded wallet";throw t({status:"error",error:d}),r({status:"initial"}),new J({code:"embedded_wallet_creation_error",error:d})}})}import{PrivyClientError as M}from"@privy-io/js-sdk-core";function ne(d){return y(this,arguments,function*({client:e,account:t,setWallet:o,recoverWalletCallbacks:r,recoveryMethod:c,setRecoveryFlowState:a,password:l,recoveryToken:s,recoverySecretOverride:n}){var i,u,p,g;if(!t)throw new M({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});switch(c){case"user-passcode":if(!l)throw new M({code:"embedded_wallet_recovery_error",error:"password is required for user-passcode recovery method"});break;case"google-drive":if(!s)throw new M({code:"embedded_wallet_recovery_error",error:"Recovery token is required for google-drive recovery method"});break;case"icloud":if(!n)throw new M({code:"embedded_wallet_recovery_error",error:"Record name is required for icloud recovery method"});break}o({status:"connecting",account:t});try{let v=yield e.embeddedWallet.getProvider(t,l,s,n);return o({status:"connected",provider:v,account:t}),a({status:"initial"}),(u=(i=r.current)==null?void 0:i.onSuccess)==null||u.call(i,v),v}catch(v){o({status:"needs-recovery",account:t}),a({status:"initial"});let h=new M({code:"embedded_wallet_recovery_error",error:v instanceof Error?v.message:"Error recovering embedded wallet"});throw(g=(p=r.current)==null?void 0:p.onError)==null||g.call(p,h),h}})}function Pe(a){return y(this,arguments,function*({client:e,solanaAccount:t,setSolanaWallet:o,recoverSolanaWalletCallbacks:r,setSolanaRecoveryFlowState:c}){var l,s,n,d;if(!t)throw new M({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});o({status:"connecting"});try{let i=yield e.embeddedWallet.getSolanaProvider(t);return o({status:"connected",publicKey:i._publicKey}),c({status:"initial"}),(s=(l=r.current)==null?void 0:l.onSuccess)==null||s.call(l,i),i}catch(i){o({status:"needs-recovery"}),c({status:"initial"});let u=new M({code:"embedded_wallet_recovery_error",error:i instanceof Error?i.message:"Error recovering embedded wallet"});throw(d=(n=r.current)==null?void 0:n.onError)==null||d.call(n,u),u}})}var Ie=({client:e,user:t,solanaWallet:o,setSolanaWallet:r,setSolanaRecoveryFlowState:c,webViewState:a,createSolanaWalletCallbacks:l,recoverSolanaWalletCallbacks:s})=>{let n=Et(()=>Wt(t),[t]),d=ye(()=>y(void 0,null,function*(){var v;let{user:p}=yield e.user.get(),g=(v=Ct(p))!=null?v:void 0;return yield Oe({client:e,setSolanaWallet:r,createSolanaWalletCallbacks:l,setSolanaRecoveryFlowState:c,ethereumAccount:g})}),[e,l]),i=ye(()=>y(void 0,null,function*(){if(!n)throw new Q({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});return Pe({client:e,solanaAccount:n,setSolanaWallet:r,recoverSolanaWalletCallbacks:s,setSolanaRecoveryFlowState:c})}),[e,n]),u=ye(()=>y(void 0,null,function*(){if(!n)throw r({status:"not-created"}),new Q({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});r(p=>p.status==="connected"?{status:"reconnecting"}:{status:"connecting"});try{let p=yield e.embeddedWallet.getSolanaProvider(n);return r({status:"connected",publicKey:p._publicKey}),p}catch(p){throw _t(p)?(r({status:"needs-recovery"}),new Q({code:"embedded_wallet_needs_recovery",error:"Embedded wallet not loaded on device"})):p instanceof Error?(r({status:"error",error:p.message}),new Q({code:"unknown_embedded_wallet_error",error:p.message})):(r({status:"error",error:"Error loading embedded wallet"}),new Q({code:"unknown_embedded_wallet_error",error:"Error loading embedded wallet"}))}}),[e,n]);return Ue(()=>{if(!t&&o.status!=="disconnected")return r({status:"disconnected"});a==="loaded"&&u().catch(()=>{})},[a,t,n]),Ue(()=>{o.status==="error"&&o.error.includes("User must be logged in")&&u()},[o.status]),{create:d,recover:i,getProvider:u}};import{useCallback as ee,useEffect as je,useMemo as Lt}from"react";import{getUserEmbeddedSolanaWallet as Ne,throwIfInvalidRecoveryUpgradePath as Ft}from"@privy-io/js-sdk-core";import{errorIndicatesRecoveryIsNeeded as Mt,getUserEmbeddedWallet as Tt,PrivyClientError as C}from"@privy-io/js-sdk-core";import{Platform as Le}from"react-native";import{PrivyClientError as P}from"@privy-io/js-sdk-core";function Fe(){return y(this,null,function*(){try{return yield import("@privy-io/expo-native-extensions")}catch(e){throw new Error("@privy-io/expo-native-extensions not found. Ensure that you're explicitly including as a dependency, and running an Expo development build")}})}function ve(r){return y(this,arguments,function*({user:e,appId:t,client:o}){var s;if(Le.OS==="android")throw new P({code:"embedded_wallet_recovery_error",error:"iCloud recovery is not supported on Android"});let c=yield Fe(),a=yield o.recovery.icloudAuth.getICloudConfiguration("expo-ios");if(!(a==null?void 0:a.container_identifier))throw new P({code:"embedded_wallet_recovery_error",error:"An iCloud Container ID must be specified in the Privy Dashboard."});try{let{recoverySecret:n,iCloudRecordName:d}=yield c.writeRecoverySecretToICloud({containerId:a.container_identifier,appId:t,userId:e.id});return{recoverySecret:n,iCloudRecordName:d}}catch(n){if(n instanceof Error){let d=(s=n.message.split("Caused by: ")[1])!=null?s:"Error writing to iCloud";throw new P({code:"embedded_wallet_recovery_error",error:d})}throw new P({code:"embedded_wallet_recovery_error",error:"Error writing to iCloud"})}})}function Me(o){return y(this,arguments,function*({walletAddress:e,client:t}){var n;if(Le.OS==="android")throw new P({code:"embedded_wallet_recovery_error",error:"iCloud recovery is not supported on Android"});let r=yield Fe(),a=(yield t.recovery.getRecoveryKeyMaterial(e)).icloud_record_name;if(!a)throw new P({code:"embedded_wallet_recovery_error",error:"iCloud recovery not properly backed up."});let l=yield t.recovery.icloudAuth.getICloudConfiguration("expo-ios"),s=l==null?void 0:l.container_identifier;if(!s)throw new P({code:"embedded_wallet_recovery_error",error:"An iCloud Container ID must be specified in the Privy Dashboard."});try{let{recoverySecret:d}=yield r.readRecoverySecretFromICloud({containerId:s,recordName:a});return{recoverySecret:d}}catch(d){if(d instanceof Error){let i=(n=d.message.split("Caused by: ")[1])!=null?n:"Error writing to iCloud";throw new P({code:"embedded_wallet_recovery_error",error:i})}throw new P({code:"embedded_wallet_recovery_error",error:"Error writing to iCloud"})}})}import*as ie from"expo-linking";import*as De from"expo-web-browser";import{Platform as Pt}from"react-native";import{PrivyClientError as Z}from"@privy-io/js-sdk-core";import Rt from"react-fast-compare";var Te=e=>t=>e(o=>Rt(o,t)?o:t);import{PrivyApiError as kt,PrivyClientError as At}from"@privy-io/js-sdk-core";function x(e){return e instanceof Error||e instanceof kt||e instanceof At?e:typeof e=="string"?new Error(e):new Error("Unknown error")}var jr=e=>new Promise(t=>setTimeout(t,e));import{useEffect as xt,useRef as Ot}from"react";import{AppState as be}from"react-native";function qr(){let e=Ot(be.currentState);xt(()=>be.addEventListener("change",r=>{e.current=r}).remove,[]);function t(){return be.currentState}return{appState:e,getCurrentAppState:t}}function se(c){return y(this,arguments,function*({provider:e,redirectUri:t,client:o,onError:r}){try{let a;switch(e){case"google-drive":{let{url:d}=yield o.recovery.auth.generateURL(ie.createURL(t||"/"));a=d;break}default:throw new Z({error:"OAuth invalid provider",code:"embedded_wallet_recovery_error"})}let l=yield De.openAuthSessionAsync(a);if(Pt.OS==="android")return;if(l.type!=="success")throw new Z({error:"Recovery OAuth session failed",code:"embedded_wallet_recovery_error"});let{queryParams:s}=ie.parse(l.url),n;switch(e){case"google-drive":{let{privy_oauth_state:d,privy_oauth_code:i}=s;if(!i||!d)throw new Z({error:"Recovery OAuth invalid credentials",code:"embedded_wallet_recovery_error"});n=yield fe({oAuthCode:i,oAuthState:d,client:o});break}default:throw new Z({error:"Recovery OAuth invalid provider",code:"embedded_wallet_recovery_error"})}return n}catch(a){throw r==null||r(x(a)),a}})}function fe(r){return y(this,arguments,function*({oAuthCode:e,oAuthState:t,client:o}){let{access_token:c}=yield o.recovery.auth.authorize(e,t);if(!c)throw new Z({error:"OAuth invalid credentials",code:"login_with_oauth_returned_with_invalid_credentials"});return c})}import{getUserEmbeddedWallet as Ut,PrivyClientError as It}from"@privy-io/js-sdk-core";function de(a){return y(this,arguments,function*({client:e,recoveryInput:t,setWalletRecoveryCallbacks:o,setRecoveryFlowState:r,setWallet:c}){var l,s,n,d;try{let{provider:i,user:u}=yield e.embeddedWallet.setRecovery(t),p=Ut(u);return c({status:"connected",provider:i,account:p}),(s=(l=o.current)==null?void 0:l.onSuccess)==null||s.call(l,i),r({status:"initial"}),i}catch(i){let u=new It({code:"embedded_wallet_set_recovery_error",error:i instanceof Error?i.message:"Error setting password on embedded wallet"});throw(d=(n=o.current)==null?void 0:n.onError)==null||d.call(n,u),r({status:"initial"}),u}})}function Ve(e){return e===void 0?{recoveryMethod:"privy"}:typeof e=="string"?{recoveryMethod:"user-passcode",password:e}:e.recoveryMethod==="user-passcode"?{recoveryMethod:"user-passcode",password:e.password}:{recoveryMethod:e.recoveryMethod}}var ze=({client:e,user:t,appId:o,wallet:r,setWallet:c,setRecoveryFlowState:a,webViewState:l,createWalletCallbacks:s,recoverWalletCallbacks:n,setWalletRecoveryCallbacks:d})=>{let i=Lt(()=>Tt(t),[t]),u=ee(m=>y(void 0,null,function*(){var A,N;if(i)throw new C({error:"This user already has an embedded wallet",code:"embedded_wallet_already_exists"});let{user:w}=yield e.user.get(),{password:f,recoveryMethod:b}=Ve(m),S,E,U;if(b==="google-drive"&&(S=yield se({provider:b,client:e,onError:(A=s.current)==null?void 0:A.onError}),a({status:"creating-wallet"}),!S))return null;if(b==="icloud"){if(!w)throw new C({code:"embedded_wallet_recovery_error",error:"User must be loaded before creating a wallet with iCloud."});let{recoverySecret:I,iCloudRecordName:L}=yield ve({user:w,appId:o,client:e});E=I,U=L}return yield ae({client:e,setWallet:c,createWalletCallbacks:s,recoveryMethod:b,setRecoveryFlowState:a,password:f,recoverySecretOverride:E,iCloudRecordNameOverride:U,solanaAccount:(N=Ne(w))!=null?N:void 0})}),[e,i,t]),p=ee(m=>y(void 0,null,function*(){var b;if(r.status!=="connected")throw new C({code:"attempted_to_set_password_before_connected",error:"Embedded wallet must be connected before setting password"});if(!i)throw new C({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});if(Ne(t))throw new C({code:"embedded_wallet_set_recovery_error",error:"Cannot set user-controlled recovery for a user with an embedded Solana wallet."});Ft({currentRecoveryMethod:i.recovery_method,upgradeToRecoveryMethod:m.recoveryMethod});let w,f;switch(m.recoveryMethod){case"privy":f=V(R({},m),{wallet:i});break;case"user-passcode":f=V(R({},m),{wallet:i,password:m.password});break;case"google-drive":if(w=yield se({provider:m.recoveryMethod,client:e,onError:(b=d.current)==null?void 0:b.onError}),a({status:"upgrading-recovery"}),!w)return null;f={recoveryMethod:"google-drive",wallet:i,recoveryAccessToken:w};break;case"icloud":if(!t)throw new C({code:"embedded_wallet_recovery_error",error:"User must be loaded before backing up to iCloud."});let{recoverySecret:S,iCloudRecordName:E}=yield ve({user:t,appId:o,client:e});f={recoveryMethod:"icloud-native",recoverySecretOverride:S,iCloudRecordNameOverride:E,wallet:i};break;default:throw new C({code:"embedded_wallet_recovery_error",error:"Unrecognized recovery method"})}return de({client:e,recoveryInput:f,setWalletRecoveryCallbacks:d,setRecoveryFlowState:a,setWallet:c})}),[e,i,r.status,t]),g=ee(m=>y(void 0,null,function*(){return p({recoveryMethod:"user-passcode",password:m})}),[e,i,r.status]),v=ee(m=>y(void 0,null,function*(){var E;if(!i)throw new C({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});let{password:w,recoveryMethod:f}=Ve(m),b,S;if(f==="google-drive"&&(b=yield se({provider:f,client:e,onError:(E=n.current)==null?void 0:E.onError}),a({status:"recovering"}),!b))return null;if(f==="icloud"){if(!t)throw new C({code:"embedded_wallet_recovery_error",error:"User must be loaded before recovering via iCloud."});let{recoverySecret:U}=yield Me({client:e,walletAddress:i.address});S=U}return ne({client:e,account:i,setWallet:c,recoverWalletCallbacks:n,recoveryMethod:f,setRecoveryFlowState:a,password:w,recoveryToken:b,recoverySecretOverride:S})}),[e,i]),h=ee(()=>y(void 0,null,function*(){if(!i)throw c({status:"not-created",account:null}),new C({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});c(m=>m.status==="connected"?{status:"reconnecting",account:i}:{status:"connecting",account:i});try{let m=yield e.embeddedWallet.getProvider(i);return c({status:"connected",provider:m,account:i}),m}catch(m){throw Mt(m)?(c({status:"needs-recovery",account:i}),new C({code:"embedded_wallet_needs_recovery",error:"Embedded wallet not loaded on device"})):m instanceof Error?(c({status:"error",error:m.message,account:i}),new C({code:"unknown_embedded_wallet_error",error:m.message})):(c({status:"error",error:"Error loading embedded wallet",account:i}),new C({code:"unknown_embedded_wallet_error",error:"Error loading embedded wallet"}))}}),[e,i]);return je(()=>{if(!t&&r.status!=="disconnected")return c({status:"disconnected",account:null});l==="loaded"&&h().catch(()=>{})},[l,t,i]),je(()=>{r.status==="error"&&r.error.includes("User must be logged in")&&h()},[r.status]),{create:u,recover:v,setPassword:g,setRecovery:p,getProvider:h}};import{useEffect as Dt,useState as jt}from"react";import{PrivyClientError as He}from"@privy-io/js-sdk-core";var qe=({client:e,user:t,isReady:o,customAuth:r})=>{let[c,a]=jt({status:"initial"});return Dt(()=>{(()=>y(void 0,null,function*(){if(!(r!=null&&r.enabled)){a({status:"not-enabled"});return}a({status:"loading"});let{getCustomAccessToken:s,isLoading:n}=r;if(!(!o||n))try{let d=yield s();if(!d&&t){yield e.auth.logout(),a({status:"done"});return}if(!d){a({status:"done"});return}if(t){a({status:"done"});return}if(!(yield e.auth.customProvider.syncWithToken(d))){yield e.auth.logout(),a({status:"error",error:new He({error:"Failed to sync with custom auth provider",code:"third_party_auth_error"})});return}a({status:"done"})}catch(d){if(console.log("Error syncing with custom auth provider",d),a({status:"error",error:d}),t)throw yield e.auth.logout(),new He({error:"Third-party auth failed",code:"third_party_auth_error"})}}))()},[e,t,o,r==null?void 0:r.enabled,r==null?void 0:r.getCustomAccessToken,r==null?void 0:r.isLoading]),{customAuthState:c,customAuthStateIsSettled:c.status!=="loading"&&c.status!=="initial"}};import*as z from"expo-linking";import{useCallback as Nt,useEffect as Vt}from"react";import{Platform as zt}from"react-native";var Be=({client:e,user:t,isUserInitialized:o,oAuthState:r,oAuthCallbacks:c,setOAuthState:a,recoveryFlowState:l,oAuthStateRef:s})=>{let n=z.useURL(),d=Nt(i=>{var p,g;let u=x(i);a({status:"error",error:u}),(g=(p=c.current).onError)==null||g.call(p,u)},[a]);return Vt(()=>{function i(){return y(this,null,function*(){var v,h;if(!n||r.status!=="loading"||l.status!=="initial")return;let{queryParams:u}=z.parse(n),{privy_oauth_state:p,privy_oauth_code:g}=u;if(!g||!p){a({status:"done"});return}try{let m,w;if(t)m=yield e.auth.oauth.linkWithCode(g,p);else{let f=yield e.auth.oauth.loginWithCode(g,p,void 0,void 0,s.current.disableSignup?"no-signup":"login-or-sign-up");m=f.user,w=!!f.is_new_user}return(h=(v=c.current).onSuccess)==null||h.call(v,m,w),s.current={},a({status:"done"}),yield z.openURL(n.split("?")[0])}catch(m){s.current={},d(m)}})}zt.OS==="android"&&o&&i()},[n,o])};import*as H from"expo-linking";import{useCallback as Ht,useEffect as qt,useMemo as Bt}from"react";import{Platform as Kt}from"react-native";import{getUserEmbeddedSolanaWallet as Gt,getUserEmbeddedWallet as Yt}from"@privy-io/js-sdk-core";var Ke=({client:e,user:t,createWalletCallbacks:o,recoverWalletCallbacks:r,setWalletRecoveryCallbacks:c,recoveryFlowState:a,oAuthState:l,setRecoveryFlowState:s,setWallet:n,appStateVisible:d,webViewLoaded:i})=>{let u=H.useURL(),p=Bt(()=>Yt(t),[t]),g=Ht(v=>{var m,w,f,b;let h=x(v);a.status==="creating-wallet"?(w=(m=o.current).onError)==null||w.call(m,x(h)):(b=(f=r.current).onError)==null||b.call(f,x(h)),s({status:"initial"})},[a]);return qt(()=>{function v(){return y(this,null,function*(){var f;if(!u&&a.status!=="initial"&&d&&g(new Error("Recovery OAuth session failed")),!u||a.status==="initial"||l.status!=="initial"||!d||!i)return;let{queryParams:h}=H.parse(u),{privy_oauth_state:m,privy_oauth_code:w}=h;if(!(!w||!m)){yield H.openURL(u.split("?")[0]);try{let b=yield fe({oAuthCode:w,oAuthState:m,client:e});if(a.status==="creating-wallet"){let S=(f=Gt(t))!=null?f:void 0;yield ae({client:e,setWallet:n,createWalletCallbacks:o,recoveryMethod:"google-drive",setRecoveryFlowState:s,recoveryToken:b,solanaAccount:S})}else if(a.status==="upgrading-recovery"){if(!p)throw new Error("Embedded wallet not found");yield de({client:e,recoveryInput:{recoveryMethod:"google-drive",wallet:p,recoveryAccessToken:b},setWalletRecoveryCallbacks:c,setRecoveryFlowState:s,setWallet:n})}else yield ne({client:e,account:p,setWallet:n,recoverWalletCallbacks:r,recoveryMethod:"google-drive",setRecoveryFlowState:s,recoveryToken:b})}catch(b){g(b)}}})}Kt.OS==="android"&&v()},[u,a.status,d,i])};import{useEffect as Xt}from"react";var Ge=({client:e,isUserInitialized:t,setIsUserInitialized:o})=>{Xt(()=>{t||(()=>y(void 0,null,function*(){try{yield e.user.get()}catch(c){}finally{o(!0)}}))()},[t])};import{useEffect as $t}from"react";import{create as Jt}from"zustand";var k=class extends Error{constructor(o,r){super(r);this.code=o,this.error=r}};var le={success:e=>({value:e}),error:e=>({error:e})};var Ye=e=>{let t=Array.from(new Set(e)),o=t.length;return o===0?le.error(new k("no_login_methods_available","No login methods available")):o>2?le.error(new k("too_many_login_methods",`More than two (${o}) login methods were provided`)):le.success(t)},Ho=e=>e[0],qo=(e,t)=>{if(e.length!==2)return null;let[o,r]=e;return t===o?r:o},Bo={email:"email",sms:"phone"};var Qt=1e3*60*5,q=Jt()((e,t)=>({privyElementsConfig:null,loginPromiseExecutor:null,isUIMounted:!1,updateUIMounted:o=>e({isUIMounted:o}),openLoginFlow:(o,r,c)=>new Promise((a,l)=>{if(r!==null)return l(new k("user_already_logged_in","User is already logged in"));if(!t().isUIMounted)return l(new k("privy_elements_not_ready","Privy Elements is not mounted"));if(t().loginPromiseExecutor!==null)return l(new k("existing_login_flow_in_progress","A login flow is already in progress"));let s=Ye(o.loginMethods);if(s.error)return l(s.error);let n={loginMethods:s.value},d=setTimeout(()=>{l(new k("login_flow_timeout","The login flow timed out")),t().closeLoginFlow()},Qt);c(),e({loginPromiseExecutor:{resolve(u){clearTimeout(d),a(u)},reject(u){clearTimeout(d),l(u)}},privyElementsConfig:n})}),closeLoginFlow:()=>{var o;return(o=t().loginPromiseExecutor)==null||o.reject(new k("login_flow_closed","The login flow was closed")),e({privyElementsConfig:null,loginPromiseExecutor:null})}})),Jo=()=>q(e=>e.privyElementsConfig),Qo=()=>q(e=>e.openLoginFlow),Zo=()=>q(e=>e.closeLoginFlow),Zt=e=>{let{loginPromiseExecutor:t}=q.getState();t==null||t.resolve(e)},Xe=()=>Zt,ea=()=>{let e=q(t=>t.updateUIMounted);$t(()=>(e(!0),()=>{e(!1)}),[e])},ta=()=>q(e=>e.privyElementsConfig!==null);var we=rr({}),D;function wa(e){return D?D.getAccessToken():e!=null&&e.strict?Promise.reject(new ir({code:"attempted_to_read_storage_before_client_initialized",error:"Called `getAccessToken` before client initialized"})):(console.warn("Called `getAccessToken` before client initialized"),Promise.resolve(null))}var Sa=e=>{var _e;let[t,o]=W($e.currentState==="active");or(()=>{let F=$e.addEventListener("change",ut=>{o(ut==="active")});return()=>{F.remove()}},[]);let[r,c]=W(!1),[a,l]=W("loading"),[s,n]=W(!1),[d,i]=W(null),[u,p]=W({status:"disconnected",account:null}),[g,v]=W({status:"disconnected"}),[h,m]=W({status:"initial"}),[w,f]=W({status:"initial"}),b=T({}),[S,E]=W({status:"initial"}),[U,A]=W({status:"initial"}),[N,I]=W({status:"initial"}),[L,K]=W({status:"initial"}),[G,Y]=W({status:"initial"}),X=T({}),ue=T({}),pe=T({}),me=T({}),he=T({}),Ee=T({}),at=Xe(),$=ce(F=>{if(F){at(F),Te(i)(F);return}i(null),m({status:"initial"}),f({status:"initial"}),p({status:"disconnected",account:null})},[]),_=tr(()=>{let F=e.storage||et;return e.client?(D=e.client,D.setCallbacks({setUser:$,setIsReady:n}),D):(D=new nr({storage:Ze(F),appId:e.appId,clientId:e.clientId,supportedChains:e.supportedChains,nativeAppIdentifier:Qe(),baseUrl:e.baseUrl,sdkVersion:`expo:${ke.version}`,callbacks:{setUser:$,setIsReady:n},logLevel:e.logLevel,crypto:{digest:er}}),D)},[e.client,e.storage,e.appId,e.clientId,e.baseUrl,e.supportedChains,e.logLevel,$]),nt=ce(()=>($(null),_.auth.logout()),[$,_]),it=ce(()=>_.getAccessToken(),[_]),st=ce(()=>_.getIdentityToken(),[_]);Ge({client:_,isUserInitialized:r,setIsUserInitialized:c});let dt=ze({client:_,user:d,appId:e.appId,webViewState:a,createWalletCallbacks:ue,recoverWalletCallbacks:pe,setWalletRecoveryCallbacks:me,setRecoveryFlowState:E,wallet:u,setWallet:p}),lt=Ie({client:_,user:d,webViewState:a,createSolanaWalletCallbacks:he,recoverSolanaWalletCallbacks:Ee,setSolanaRecoveryFlowState:A,solanaWallet:g,setSolanaWallet:v});Be({client:_,isUserInitialized:r,user:d,oAuthState:w,setOAuthState:f,oAuthCallbacks:X,recoveryFlowState:S,oAuthStateRef:b}),Ke({client:_,user:d,webViewLoaded:a==="loaded",createWalletCallbacks:ue,recoverWalletCallbacks:pe,setWalletRecoveryCallbacks:me,recoveryFlowState:S,oAuthState:w,setRecoveryFlowState:E,setWallet:p,appStateVisible:t});let{customAuthStateIsSettled:ct}=qe({client:_,user:d,isReady:r,customAuth:(_e=e.config)==null?void 0:_e.customAuth});return te.createElement(te.Fragment,null,te.createElement(we.Provider,{value:{client:_,user:d,isReady:a!=="loading"&&r&&Je(w)&&ct,logout:nt,getAccessToken:it,getIdentityToken:st,wallet:R(R({},u),dt),solanaWallet:R(R({},g),lt),oAuthState:w,oAuthCallbacks:X,recoveryFlowState:S,setRecoveryFlowState:E,solanaRecoveryFlowState:U,setSolanaRecoveryFlowState:A,createWalletCallbacks:ue,recoverWalletCallbacks:pe,setWalletRecoveryCallbacks:me,createSolanaWalletCallbacks:he,recoverSolanaWalletCallbacks:Ee,setOAuthState:f,siweState:N,setSiweState:I,otpState:h,setOtpState:m,passkeyState:L,setPasskeyState:K,farcasterState:G,setFarcasterState:Y,oAuthStateRef:b}},e.children),te.createElement(ar,{style:{width:0,height:0,overflow:"hidden"}},te.createElement(xe,{logLevel:e.logLevel,client:_,isClientReady:s,setWebViewState:l,webViewState:a})))};var Je=e=>e.status!=="loading",ge=(e={})=>{let{user:t,oAuthState:o,setOAuthState:r,oAuthCallbacks:c,client:a,oAuthStateRef:l}=sr(we),s=e.action?e.action==="login":!t;dr(()=>{c.current={onSuccess:e.onSuccess,onError:e.onError}},[e.onSuccess,e.onError]);let n=rt(i=>{var p;let u=x(i);return r({status:"error",error:u}),(p=e==null?void 0:e.onError)==null||p.call(e,u),u},[e==null?void 0:e.onError]);return{start:rt(function(h){return y(this,arguments,function*({provider:u,redirectUri:p,isLegacyAppleIosBehaviorEnabled:g=!1,disableSignup:v}){var m,w,f;r({status:"loading"}),l.current={disableSignup:v};try{if(t&&e.action==="login")throw new j({code:"attempted_login_with_oauth_while_already_logged_in",error:"Already logged in, if trying to link an OAuth account use `useLinkWithOAuth`"});if(!t&&e.action==="link")throw new j({code:"attempted_link_oauth_before_logged_in",error:"Must be logged in to link an OAuth account, use `useLoginWithOAuth`"});let{url:b}=yield a.auth.oauth.generateURL(u,B.createURL(p||"/")),S,E;if(Se.OS==="ios"&&u==="apple"&&!g){let G=(m=new URL(b).searchParams.get("state"))!=null?m:"",Y=yield ot.signInAsync({state:G});if(!Y.authorizationCode)throw new j({error:"OAuth invalid credentials",code:s?"login_with_oauth_returned_with_invalid_credentials":"link_with_oauth_returned_with_invalid_credentials"});if(s){let X=yield a.auth.oauth.loginWithCode(Y.authorizationCode,G,u,"raw",v?"no-signup":"login-or-sign-up");S=X.user,E=X.is_new_user}else S=yield a.auth.oauth.linkWithCode(Y.authorizationCode,G,u,"raw");return(w=e==null?void 0:e.onSuccess)==null||w.call(e,S,E),r({status:"done"}),S!=null?S:void 0}let U=Se.OS==="android"?b.replace("x.com","twitter.com"):b,A=yield re.openAuthSessionAsync(U);if(Se.OS==="android")return;if(A.type!=="success")throw[re.WebBrowserResultType.CANCEL,re.WebBrowserResultType.DISMISS].includes(A.type)?new j({error:"OAuth was cancelled",code:s?"login_with_oauth_was_cancelled_by_user":"link_with_oauth_was_cancelled_by_user"}):new j({error:"OAuth session failed",code:s?"failed_to_complete_login_with_oauth":"failed_to_complete_link_with_oauth"});let{queryParams:N}=B.parse(A.url),{privy_oauth_state:I,privy_oauth_code:L}=N;if(!L||!I)throw new j({error:"OAuth invalid credentials",code:s?"login_with_oauth_returned_with_invalid_credentials":"link_with_oauth_returned_with_invalid_credentials"});if(s){let K=yield a.auth.oauth.loginWithCode(L,I,u,void 0,v?"no-signup":"login-or-sign-up");S=K.user,E=K.is_new_user}else S=yield a.auth.oauth.linkWithCode(L,I,u);return(f=e==null?void 0:e.onSuccess)==null||f.call(e,S,E),yield B.openURL(A.url.split("?")[0]),r({status:"done"}),S!=null?S:void 0}catch(b){n(b)}})},[t,a,r,n]),state:o}};function Aa(e){let{state:t,start:o}=ge(V(R({},e),{action:"login"}));return{state:t,login:o}}function xa(e){let{state:t,start:o}=ge(V(R({},e),{action:"link"}));return{state:t,link:o}}function Oa(e){return ge(e)}var Qe=()=>{if(typeof tt!="string")throw new j({error:"Cannot determine native application ID. Please make sure `expo-application` is installed as a dependency and that `ios.bundleId` or `android.package` is set.",code:"invalid_native_app_id"});return tt};function Ze(e){return{get(t){return e.get(t.replaceAll(":","-"))},put(t,o){return e.put(t.replaceAll(":","-"),o)},del(t){return e.del(t.replaceAll(":","-"))},getKeys:()=>y(this,null,function*(){return[]})}}var et={get(e){return O.getItemAsync(e,{keychainAccessible:O.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY})},put(e,t){return O.setItemAsync(e,t,{keychainAccessible:O.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY})},del(e){return O.deleteItemAsync(e,{keychainAccessible:O.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY})},getKeys:()=>y(void 0,null,function*(){return[]})};function Ia(e){return e.status==="connected"}function La(e){return e.status==="reconnecting"}function Fa(e){return e.status==="connecting"}function Ma(e){return e.status==="disconnected"}function Ta(e){return e.status==="not-created"}function Da(e){return e.status==="creating"}function ja(e){return e.status==="error"}function Na(e){return e.status==="needs-recovery"}export{R as a,V as b,lr as c,y as d,ke as e,x as f,jr as g,qr as h,Aa as i,xa as j,Oa as k,Qe as l,Ze as m,et as n,k as o,Ho as p,qo as q,Bo as r,Jo as s,Qo as t,Zo as u,ea as v,ta as w,we as x,wa as y,Sa as z,Ia as A,La as B,Fa as C,Ma as D,Ta as E,Da as F,ja as G,Na as H};
package/dist/esm/index.js CHANGED
@@ -1 +1 @@
1
- import{A as Zn,B as jn,C as qn,D as Jn,E as Yn,F as Qn,G as $n,H as Xn,a as k,c as Z,d as S,e as Ge,f as w,g as I,h as j,i as Jr,j as Yr,k as Qr,l as Ne,m as De,n as ce,o as ue,p as Re,q as Ke,r as ze,s as Ze,t as je,u as U,v as qe,w as Je,x as h,y as Kn,z as zn}from"./chunk-IVJEK62C.js";export*from"@privy-io/js-sdk-core";import{useCallback as me,useContext as $r}from"react";import{PrivyClientError as Xr}from"@privy-io/js-sdk-core";var ni=e=>{let{user:r,client:t,setSiweState:o,siweState:a}=$r(h),s=me(d=>{var u;let f=w(d);return o({status:"error",error:f}),(u=e==null?void 0:e.onError)==null||u.call(e,f),f},[e==null?void 0:e.onError]),n=me(g=>S(void 0,[g],function*({wallet:d,from:{domain:f,uri:u}}){var l;try{o({status:"generating-message"});let c=yield t.auth.siwe.init(d,f,u);return o({status:"awaiting-signature"}),(l=e==null?void 0:e.onGenerateMessage)==null||l.call(e,c.message),c.message}catch(c){throw s(c)}}),[t,s,e==null?void 0:e.onGenerateMessage]),i=me(u=>S(void 0,[u],function*({signature:d,messageOverride:f}){var g;try{if(!r)throw new Xr({code:"attempted_link_siwe_before_logged_in",error:"Must be logged in to link a wallet, Use `useLoginWithSiwe` to login with a wallet"});o({status:"submitting-signature"});let l=yield t.auth.siwe.linkWithSiwe(d,void 0,f);return o({status:"done"}),(g=e==null?void 0:e.onSuccess)==null||g.call(e,l),l}catch(l){throw s(l)}}),[r,t,s,e==null?void 0:e.onSuccess]);return{generateSiweMessage:n,linkWithSiwe:i,state:a}};import{useCallback as de,useContext as et}from"react";import{PrivyClientError as rt}from"@privy-io/js-sdk-core";var mi=e=>{let{user:r,client:t,setSiweState:o,siweState:a}=et(h),s=de(d=>{var u;let f=w(d);return o({status:"error",error:f}),(u=e==null?void 0:e.onError)==null||u.call(e,f),f},[e==null?void 0:e.onError]),n=de(g=>S(void 0,[g],function*({wallet:d,from:{domain:f,uri:u}}){var l;try{o({status:"generating-message"});let c=yield t.auth.siwe.init(d,f,u);return o({status:"awaiting-signature"}),(l=e==null?void 0:e.onGenerateMessage)==null||l.call(e,c.message),c.message}catch(c){throw s(c)}}),[t,s,e==null?void 0:e.onGenerateMessage]);return{loginWithSiwe:de(g=>S(void 0,[g],function*({signature:d,messageOverride:f,disableSignup:u}){var l;try{if(r)throw new rt({code:"attempted_login_with_siwe_while_already_logged_in",error:"Already logged in, use `useLinkWithSiwe` if you are trying to link a wallet to an existing account"});o({status:"submitting-signature"});let c=yield t.auth.siwe.loginWithSiwe(d,void 0,f,u?"no-signup":"login-or-sign-up");return o({status:"done"}),(l=e==null?void 0:e.onSuccess)==null||l.call(e,c.user,c.is_new_user),c.user}catch(c){throw s(c)}}),[r,t,s,e==null?void 0:e.onSuccess]),generateSiweMessage:n,state:a}};import{useCallback as Ye,useContext as tt}from"react";import{PrivyClientError as ot}from"@privy-io/js-sdk-core";var Si=e=>{let{user:r,client:t}=tt(h),o=Ye(s=>{var i;let n=w(s);return(i=e==null?void 0:e.onError)==null||i.call(e,n),n},[e==null?void 0:e.onError]);return{unlinkWallet:Ye(n=>S(void 0,[n],function*({address:s}){var i;try{if(!r)throw new ot({code:"attempted_unlink_siwe_before_logged_in",error:"Must be logged in to unlink a wallet, Use `useLoginWithSiwe` to login with a wallet"});let d=yield t.auth.siwe.unlinkWallet(s);return(i=e==null?void 0:e.onSuccess)==null||i.call(e,d),d}catch(d){throw o(d)}}),[r,t,o,e==null?void 0:e.onSuccess])}};import{useCallback as ge,useContext as nt,useState as it}from"react";import{PrivyClientError as Qe}from"@privy-io/js-sdk-core";var Ei=e=>{let[r,t]=it(""),{user:o,client:a,otpState:s,setOtpState:n}=nt(h),i=ge(u=>{var l;let g=w(u);return n({status:"error",error:g}),(l=e==null?void 0:e.onError)==null||l.call(e,g),g},[e==null?void 0:e.onError]),d=ge(g=>S(void 0,[g],function*({email:u}){var l;t(u);try{n({status:"sending-code"});let c=yield a.auth.email.sendCode(u);return n({status:"awaiting-code-input"}),(l=e==null?void 0:e.onSendCodeSuccess)==null||l.call(e,{email:u}),c}catch(c){return i(c),{success:!1}}}),[a,i,e==null?void 0:e.onSendCodeSuccess]),f=ge(l=>S(void 0,[l],function*({code:u,email:g}){var c;try{if(!o)throw new Qe({code:"attempted_link_email_before_logged_in",error:"Must be logged in to link an email, Use `useLoginWithEmail` to login with email"});let y=g||r;if(!y)throw new Qe({code:"attempted_submit_otp_before_sending",error:"Must `sendCode` with a valid email before calling `linkWithCode`"});n({status:"submitting-code"});let C=yield a.auth.email.linkWithCode(y,u);return n({status:"done"}),(c=e==null?void 0:e.onLinkSuccess)==null||c.call(e,C),C}catch(y){i(y)}}),[o,a,r,i,e==null?void 0:e.onLinkSuccess]);return{sendCode:d,linkWithCode:f,state:s}};import{useCallback as fe,useContext as at,useState as st}from"react";import{PrivyClientError as $e}from"@privy-io/js-sdk-core";var Xe=e=>{let[r,t]=st(""),{user:o,client:a,otpState:s,setOtpState:n}=at(h),i=fe(u=>{var l;let g=w(u);return n({status:"error",error:g}),(l=e==null?void 0:e.onError)==null||l.call(e,g),g},[e==null?void 0:e.onError]),d=fe(g=>S(void 0,[g],function*({email:u}){var l;t(u);try{n({status:"sending-code"});let c=yield a.auth.email.sendCode(u);return n({status:"awaiting-code-input"}),(l=e==null?void 0:e.onSendCodeSuccess)==null||l.call(e,{email:u}),c}catch(c){return i(c),{success:!1}}}),[a,i,e==null?void 0:e.onSendCodeSuccess]),f=fe(c=>S(void 0,[c],function*({code:u,email:g,disableSignup:l}){var y;try{if(o)throw new $e({code:"attempted_login_with_email_while_already_logged_in",error:"Already logged in, use `useLinkWithEmail` if you are trying to link an email to an existing account"});let C=g||r;if(!C)throw new $e({code:"attempted_submit_otp_before_sending",error:"Must `sendCode` with a valid email before calling `loginWithCode`"});n({status:"submitting-code"});let p=yield a.auth.email.loginWithCode(C,u,l?"no-signup":"login-or-sign-up");return n({status:"done"}),(y=e==null?void 0:e.onLoginSuccess)==null||y.call(e,p.user,p.is_new_user),p==null?void 0:p.user}catch(C){i(C)}}),[o,a,r,i,e==null?void 0:e.onLoginSuccess]);return{sendCode:d,loginWithCode:f,state:s}};import{useCallback as he,useContext as lt,useState as ct}from"react";import{PrivyClientError as er}from"@privy-io/js-sdk-core";var Vi=e=>{let[r,t]=ct(""),{user:o,client:a,otpState:s,setOtpState:n}=lt(h),i=he(u=>{var l;let g=w(u);return n({status:"error",error:g}),(l=e==null?void 0:e.onError)==null||l.call(e,g),g},[e==null?void 0:e.onError]),d=he(g=>S(void 0,[g],function*({phone:u}){var l;t(u);try{n({status:"sending-code"});let c=yield a.auth.phone.sendCode(u);return n({status:"awaiting-code-input"}),(l=e==null?void 0:e.onSendCodeSuccess)==null||l.call(e,{phone:u}),c}catch(c){return i(c),{success:!1}}}),[a,i,e==null?void 0:e.onSendCodeSuccess]),f=he(l=>S(void 0,[l],function*({code:u,phone:g}){var c;try{if(!o)throw new er({code:"attempted_link_sms_before_logged_in",error:"Must be logged in to link a phone number, Use `useLoginWithSMS` to login with a phone number"});if(!(g||r))throw new er({code:"attempted_submit_otp_before_sending",error:"Must `sendCode` with a valid phone number before calling `linkWithCode`"});n({status:"submitting-code"});let C=yield a.auth.phone.linkWithCode(g||r,u);return n({status:"done"}),(c=e==null?void 0:e.onLinkSuccess)==null||c.call(e,C),C}catch(y){i(y)}}),[o,a,r,i,e==null?void 0:e.onLinkSuccess]);return{sendCode:d,linkWithCode:f,state:s}};import{useCallback as pe,useContext as ut,useState as mt}from"react";import{PrivyClientError as rr}from"@privy-io/js-sdk-core";var tr=e=>{let[r,t]=mt(""),{user:o,client:a,otpState:s,setOtpState:n}=ut(h),i=pe(u=>{var l;let g=w(u);return n({status:"error",error:g}),(l=e==null?void 0:e.onError)==null||l.call(e,g),g},[e==null?void 0:e.onError]),d=pe(g=>S(void 0,[g],function*({phone:u}){var l;t(u);try{n({status:"sending-code"});let c=yield a.auth.phone.sendCode(u);return n({status:"awaiting-code-input"}),(l=e==null?void 0:e.onSendCodeSuccess)==null||l.call(e,{phone:u}),c}catch(c){return i(c),{success:!1}}}),[a,i,e==null?void 0:e.onSendCodeSuccess]),f=pe(c=>S(void 0,[c],function*({code:u,phone:g,disableSignup:l}){var y;try{if(o)throw new rr({code:"attempted_login_with_sms_while_already_logged_in",error:"Already logged in, use `useLinkWithSMS` if you are trying to link a phone number to an existing account"});if(!(g||r))throw new rr({code:"attempted_submit_otp_before_sending",error:"Must `sendCode` with a valid phone number before calling `loginWithCode`"});n({status:"submitting-code"});let p=yield a.auth.phone.loginWithCode(g||r,u,l?"no-signup":"login-or-sign-up");return n({status:"done"}),(y=e==null?void 0:e.onLoginSuccess)==null||y.call(e,p.user,p.is_new_user),p==null?void 0:p.user}catch(C){i(C)}}),[o,a,r,i,e==null?void 0:e.onLoginSuccess]);return{sendCode:d,loginWithCode:f,state:s}};import*as q from"expo-linking";import{useCallback as ye,useContext as dt,useRef as gt}from"react";import{PrivyClientError as G}from"@privy-io/js-sdk-core";var Qi=e=>{let{appState:r,getCurrentAppState:t}=j(),{client:o,user:a,farcasterState:s,setFarcasterState:n}=dt(h),i=gt(!1),d=ye(g=>{var c;let l=w(g);return n({status:"error",error:l}),(c=e==null?void 0:e.onError)==null||c.call(e,l),l},[e==null?void 0:e.onError,n]),f=ye(()=>{i.current=!0},[]);return{linkWithFarcaster:ye((y,...C)=>S(void 0,[y,...C],function*({relyingParty:g,redirectUrl:l},c={pollAttempts:10,pollIntervalMs:1e3}){var p;try{if(i.current=!1,!a)throw new G({code:"attempted_link_farcaster_before_logged_in",error:"Must be logged in to link a Farcaster account."});n({status:"generating-uri"});let{connect_uri:E,channel_token:L}=yield o.auth.farcaster.initializeAuth({relyingParty:g,redirectUrl:q.createURL(l!=null?l:"/")});if(!E)throw new G({code:"failed_to_generate_farcaster_uri",error:"Failed to generate farcaster uri"});if(!L)throw new G({code:"failed_to_generate_farcaster_channel_token",error:"Failed to generate farcaster channel token"});yield q.openURL(E),n({status:"polling-status"});let _=0;for(;_<c.pollAttempts;){if(i.current)throw new G({code:"farcaster_polling_canceled",error:"Farcaster polling canceled"});if(r.current!=="active"&&t()!=="active"){yield I(c.pollIntervalMs);continue}let V=yield o.auth.farcaster.getFarcasterStatus({channel_token:L});if(V.state==="completed"){n({status:"submitting-token"});let H=yield o.auth.farcaster.link(k({channel_token:L},V));return n({status:"done"}),(p=e==null?void 0:e.onSuccess)==null||p.call(e,H),H}_++,yield I(c.pollIntervalMs)}throw new G({code:"farcaster_polling_timeout",error:"Farcasting polling timed out"})}catch(E){throw d(E)}}),[o,e==null?void 0:e.onSuccess,d,n,a]),state:s,cancel:f}};import{useCallback as or,useContext as ft}from"react";var oa=e=>{let{client:r}=ft(h),t=or(a=>{var n;let s=w(a);return(n=e==null?void 0:e.onError)==null||n.call(e,s),s},[e==null?void 0:e.onError]);return{unlinkFarcaster:or(s=>S(void 0,[s],function*({fid:a}){var n;try{let i=yield r.auth.farcaster.unlink({fid:a});return(n=e==null?void 0:e.onSuccess)==null||n.call(e,i),i}catch(i){throw t(i)}}),[r,e==null?void 0:e.onSuccess,t])}};import*as J from"expo-linking";import{useCallback as we,useContext as ht,useRef as pt}from"react";import{PrivyClientError as N}from"@privy-io/js-sdk-core";var ua=e=>{let{appState:r,getCurrentAppState:t}=j(),{client:o,user:a,farcasterState:s,setFarcasterState:n}=ht(h),i=pt(!1),d=we(g=>{var c;let l=w(g);return n({status:"error",error:l}),(c=e==null?void 0:e.onError)==null||c.call(e,l),l},[e==null?void 0:e.onError,n]),f=we(()=>{i.current=!0},[]);return{loginWithFarcaster:we((C,...p)=>S(void 0,[C,...p],function*({relyingParty:g,redirectUrl:l,disableSignup:c},y={pollAttempts:10,pollIntervalMs:1e3}){var E;try{if(i.current=!1,a)throw new N({code:"attempted_login_with_farcaster_while_already_logged_in",error:"Already logged in, use `useLinkWithFarcaster` if you are trying to link farcaster to an existing account"});n({status:"generating-uri"});let{connect_uri:L,channel_token:_}=yield o.auth.farcaster.initializeAuth({relyingParty:g,redirectUrl:J.createURL(l!=null?l:"/")});if(!L)throw new N({code:"failed_to_generate_farcaster_uri",error:"Failed to generate farcaster uri"});if(!_)throw new N({code:"failed_to_generate_farcaster_channel_token",error:"Failed to generate farcaster channel token"});yield J.openURL(L),n({status:"polling-status"});let V=0;for(;V<y.pollAttempts;){if(i.current)throw new N({code:"farcaster_polling_canceled",error:"Farcaster polling canceled"});if(r.current!=="active"&&t()!=="active"){yield I(y.pollIntervalMs);continue}let H=yield o.auth.farcaster.getFarcasterStatus({channel_token:_});if(H.state==="completed"){n({status:"submitting-token"});let le=yield o.auth.farcaster.authenticate(k({channel_token:_,mode:c?"no-signup":"login-or-sign-up"},H));return n({status:"done"}),(E=e==null?void 0:e.onSuccess)==null||E.call(e,le.user,le.is_new_user),le.user}V++,yield I(y.pollIntervalMs)}throw new N({code:"farcaster_polling_timeout",error:"Farcasting polling timed out"})}catch(L){throw d(L)}}),[o,d,e==null?void 0:e.onSuccess,n,a,r]),state:s,cancel:f}};import{useCallback as nr,useContext as yt}from"react";var pa=e=>{let{client:r}=yt(h),t=nr(a=>{var n;let s=w(a);return(n=e==null?void 0:e.onError)==null||n.call(e,s),s},[e==null?void 0:e.onError]);return{unlinkOAuth:nr(n=>S(void 0,[n],function*({provider:a,subject:s}){var i;try{let d=yield r.auth.oauth.unlink(a,s);return(i=e==null?void 0:e.onSuccess)==null||i.call(e,d),d}catch(d){throw t(d)}}),[r,e==null?void 0:e.onSuccess,t])}};import{useContext as St,useEffect as Ct,useRef as wt}from"react";var ka=e=>{let{client:r}=St(h),t=wt(e.onOAuthTokenGrant);t.current=e.onOAuthTokenGrant,Ct(()=>{let{unsubscribe:o}=r.addOAuthTokensListener(a=>{t.current(a)});return o},[r])};import{useEffect as bt}from"react";import{useContext as kt,useEffect as ke}from"react";var be=(e={})=>{let{wallet:r,createWalletCallbacks:t,recoverWalletCallbacks:o,setWalletRecoveryCallbacks:a}=kt(h),{onCreateWalletSuccess:s,onCreateWalletError:n,onRecoverWalletError:i,onRecoverWalletSuccess:d,onSetWalletRecoverySuccess:f,onSetWalletRecoveryError:u}=e;return ke(()=>{t.current={onSuccess:s,onError:n}},[s,n]),ke(()=>{o.current={onSuccess:d,onError:i}},[d,i]),ke(()=>{a.current={onSuccess:f,onError:u}},[d,i]),r};var Fa=({onStateChange:e})=>{let r=be();return bt(()=>{e(r)},[r])};import{useContext as vt}from"react";var Aa=()=>{let{getIdentityToken:e}=vt(h);return{getIdentityToken:e}};import{useCallback as ir,useContext as xt}from"react";import{PrivyClientError as Et}from"@privy-io/js-sdk-core";var Va=e=>{let{user:r,client:t}=xt(h),o=ir(s=>{var i;let n=w(s);return(i=e==null?void 0:e.onError)==null||i.call(e,n),n},[e==null?void 0:e.onError]);return{create:ir(()=>S(void 0,null,function*(){var s;try{if(r)throw new Et({code:"attempted_to_create_guest_account_for_logged_in_user",error:"Already logged in, you cannot create a guest account"});let n=yield t.auth.guest.create();return(s=e==null?void 0:e.onSuccess)==null||s.call(e,n.user,n.is_new_user),n.user}catch(n){throw o(n)}}),[t,o,r,e==null?void 0:e.onSuccess])}};import{useContext as Lt,useEffect as ar}from"react";var Pt=(e={})=>{let{solanaWallet:r,createSolanaWalletCallbacks:t,recoverSolanaWalletCallbacks:o}=Lt(h),{onCreateWalletSuccess:a,onCreateWalletError:s,onRecoverWalletError:n,onRecoverWalletSuccess:i}=e;return ar(()=>{t.current={onSuccess:a,onError:s}},[a,s]),ar(()=>{o.current={onSuccess:i,onError:n}},[i,n]),r};import{useContext as Ft}from"react";var Mt=()=>{let{client:e}=Ft(h);return e};import{useContext as Tt}from"react";var Wt=()=>{let{user:e,isReady:r,logout:t,getAccessToken:o}=Tt(h);return{user:e,isReady:r,logout:t,getAccessToken:o}};import z,{useRef as _n,useState as In}from"react";import Ae,{useContext as Ao,useEffect as br,useMemo as _o,useState as vr}from"react";import M,{useCallback as to,useEffect as oo,useState as pr}from"react";import{View as Fe,StyleSheet as no,KeyboardAvoidingView as io,Platform as ao}from"react-native";import{createErrorFormatter as so}from"@privy-io/js-sdk-core";import Y from"react";import{View as Bt,Text as Vt,Pressable as Ht,StyleSheet as Gt}from"react-native";import ve,{useEffect as At}from"react";import{Animated as xe,Easing as _t,useAnimatedValue as It}from"react-native";import Ut,{Path as Ot}from"react-native-svg";var sr=()=>{let e=It(0);At(()=>{e.setValue(0);let t=xe.loop(xe.timing(e,{toValue:1,duration:1200,useNativeDriver:!0,easing:_t.linear}));return t.start(),()=>t.stop()},[]);let r=e.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return ve.createElement(xe.View,{style:{transform:[{rotate:r}]}},ve.createElement(Ut,{width:20,height:20,viewBox:"0 0 20 20",fill:"none"},ve.createElement(Ot,{d:"M19 10a9 9 0 11-6.219-8.56",stroke:"#fff",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})))};var m={interactive:"#5B4FFF",white:"#FFFFFF",black:"#000000",brand:"#010110",placeholder:"#9498B8",success:"#22C55E",successDark:"#15803D",inputBackground:"#F3F3F3",text:"#040217",icon:"#110F2A",border:"#E2E3F0",error:"#EF4444",errorDark:"#B91C1C",textMuted:"#64668B",textTitle:"#1A1C29"};var v=a=>{var s=a,{variant:e="primary",title:r,loading:t=!1}=s,o=Z(s,["variant","title","loading"]);return Y.createElement(Ht,k({},o),Y.createElement(Bt,{style:[O.buttonBox,e==="secondary"&&O.buttonBoxSecondary,e==="tertiary"&&O.buttonBoxTertiary]},t?Y.createElement(sr,null):Y.createElement(Vt,{style:[O.buttonLabel,e==="secondary"&&O.buttonLabelSecondary,e==="tertiary"&&O.buttonLabelTertiary]},r)))},O=Gt.create({buttonBox:{height:54,justifyContent:"center",alignItems:"center",borderRadius:14,paddingHorizontal:16,backgroundColor:m.interactive},buttonBoxSecondary:{backgroundColor:m.white,alignItems:"flex-start",borderColor:m.border,borderWidth:1,borderRadius:12},buttonBoxTertiary:{backgroundColor:m.white},buttonLabel:{fontFamily:"Inter_600SemiBold",fontSize:16,lineHeight:24,color:m.white},buttonLabelSecondary:{fontFamily:"Inter_400Regular",color:m.text},buttonLabelTertiary:{fontFamily:"Inter_500Medium",color:m.interactive}});import P,{useState as Kt,useRef as zt}from"react";import{View as ur,TextInput as Zt,Pressable as jt,Text as dr,StyleSheet as qt}from"react-native";import lr from"react";import{View as Nt,Text as Dt,StyleSheet as Rt}from"react-native";var cr=({value:e,isFocused:r,isSuccess:t,isError:o})=>lr.createElement(Nt,{style:[D.box,r&&D.focusedBox,t&&D.successBox,o&&D.errorBox]},lr.createElement(Dt,{style:D.text},e)),D=Rt.create({box:{borderWidth:1,borderColor:m.border,borderRadius:12,height:64,width:48,justifyContent:"center",alignItems:"center"},focusedBox:{borderWidth:2,borderColor:m.interactive},successBox:{borderColor:m.success},errorBox:{borderColor:m.error},text:{fontFamily:"Inter_500Medium",fontSize:16,lineHeight:20,color:m.text}});var mr=6,Jt=[0,1,2,"-",3,4,5];function Ee({value:e="",status:r=" ",onChangeText:t=()=>{},editable:o=!0,success:a=!1,error:s=!1,autoFocus:n=!1}){let i=zt(null),[d,f]=Kt(!1),u=()=>{var c;(c=i==null?void 0:i.current)==null||c.focus()},g=c=>{let y=c.replace(/\D/g,"");t(y)},l=d?Math.min(e.length,mr-1):void 0;return P.createElement(ur,{style:W.container},P.createElement(Zt,{autoFocus:n,style:W.invisibleTextInput,value:e,onChangeText:g,maxLength:mr,ref:i,editable:o,onFocus:()=>f(!0),onBlur:()=>f(!1),keyboardType:"numeric"}),P.createElement(jt,{onPress:u,disabled:!o},P.createElement(ur,{style:W.codeContainer},Jt.map((c,y)=>c==="-"?P.createElement(Yt,{key:y}):P.createElement(cr,{key:y,isFocused:l===c,value:e[c]||"",isSuccess:a,isError:s})))),P.createElement(dr,{style:[W.statusText,a&&W.statusSuccess,s&&W.statusError]},r))}var Yt=()=>P.createElement(dr,{style:W.separator},"-"),W=qt.create({container:{justifyContent:"center",paddingHorizontal:0,gap:6},invisibleTextInput:{position:"absolute",opacity:0},codeContainer:{flexDirection:"row",alignItems:"center",gap:10,justifyContent:"space-between"},separator:{fontFamily:"Inter_600SemiBold",fontSize:18,lineHeight:24,color:m.black},statusText:{textAlign:"left",color:m.textMuted,fontFamily:"Inter_400Regular",fontSize:14,lineHeight:22},statusError:{color:m.errorDark},statusSuccess:{color:m.successDark}});import Le from"react";import{StyleSheet as Qt,View as $t,Text as gr}from"react-native";var F=({title:e,subtitle:r})=>Le.createElement($t,{style:Pe.titleContainer},Le.createElement(gr,{style:Pe.title},e),r&&Le.createElement(gr,{style:Pe.subtitle},r)),Pe=Qt.create({titleContainer:{alignItems:"center",gap:16},title:{fontFamily:"Inter_600SemiBold",fontSize:20,lineHeight:32,color:m.textTitle},subtitle:{fontFamily:"Inter_400Regular",fontSize:16,lineHeight:24,color:m.textMuted,textAlign:"center"}});import Q from"react";import{Pressable as Xt,StyleSheet as eo,Text as fr,View as ro}from"react-native";var hr=({hint:e,link:r,onPress:t,disabled:o})=>Q.createElement(ro,{style:$.container},Q.createElement(fr,{style:$.hintText},e),r&&Q.createElement(Xt,{onPress:t,disabled:o},Q.createElement(fr,{style:[$.linkText,o&&$.disabledLink]}," ",r))),$=eo.create({container:{display:"flex",flexDirection:"row",gap:2},hintText:{fontFamily:"Inter_400Regular",fontSize:14,lineHeight:22,color:m.textMuted},linkText:{fontFamily:"Inter_500Medium",fontSize:14,lineHeight:22,color:m.interactive},disabledLink:{color:m.textMuted}});var lo=3e4,co=()=>{let[e,r]=pr(!1),t=to(()=>{r(!1),setTimeout(()=>{r(!0)},lo)},[]);return oo(()=>{t()},[]),[e,t]},X=({loginWithCode:e,requestNewCode:r,subtitle:t,isLoading:o,error:a,isDone:s})=>{let[n,i]=pr(""),d=l=>{i(l),l.length===6&&e(l)},[f,u]=co(),g=()=>{r(),u()};return M.createElement(io,{behavior:ao.OS==="ios"?"padding":void 0,style:Me.innerContainer},M.createElement(Fe,{style:{flex:1,justifyContent:"space-between",paddingHorizontal:16,paddingBottom:16}},M.createElement(Fe,{style:Me.content},M.createElement(Fe,{style:Me.formContainer},M.createElement(F,{title:"Enter confirmation code",subtitle:t}),M.createElement(Ee,{value:n,editable:!o,onChangeText:d,success:s,error:!!a,status:s?"Success.":a?uo(a):" ",autoFocus:!0}),M.createElement(hr,{hint:"Didn\u2019t get an email?",link:"Resend code",onPress:g,disabled:!f}))),M.createElement(v,{title:"Continue",loading:o,onPress:()=>e(n)})))},uo=so({invalid_credentials:"Invalid code.",invalid_data:"The code has expired.",too_many_requests:"Too many requests. Please try again later.",default:"Something went wrong. Please try again."}),Me=no.create({modalContent:{backgroundColor:"#ffffff"},innerContainer:{flex:1},content:{gap:16},formContainer:{rowGap:24}});import x,{useState as Eo}from"react";import{View as te,StyleSheet as Lo,KeyboardAvoidingView as Po,Platform as Fo}from"react-native";import{createErrorFormatter as Mo}from"@privy-io/js-sdk-core";import Sr from"react";import{StyleSheet as ho,View as po}from"react-native";import*as Te from"react";import mo,{Path as go}from"react-native-svg";var fo=e=>Te.createElement(mo,k({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 460 40"},e),Te.createElement(go,{fill:e.color,d:"M0 15.4v15.38h4.64V19.96h3.58c2.47 0 3.63-.01 3.77-.02 1-.08 1.49-.15 2.18-.3a9.45 9.45 0 0 0 4.6-2.37c1.66-1.57 2.64-3.87 2.81-6.56.02-.3.02-1.19 0-1.49-.1-1.77-.56-3.35-1.36-4.72A8.84 8.84 0 0 0 15.14.57c-.93-.3-1.75-.43-3.09-.54C11.9.02 10.2 0 5.93 0H0ZM10.85 4c1.85.05 3.1.45 4.16 1.3.22.17.54.49.69.68a5.97 5.97 0 0 1 1.19 3.13c.04.35.04 1.36 0 1.71-.08.68-.23 1.3-.44 1.85a4.8 4.8 0 0 1-1.09 1.68A5.63 5.63 0 0 1 12 15.92c-.6.08-.4.08-4.01.09H4.64V3.98h2.9c1.6 0 3.08 0 3.31.02m176.8 1.71v5.72h-.27l-.09-.14a16 16 0 0 0-1.21-1.73c-.43-.5-1-.95-1.7-1.36-.54-.3-1.05-.5-1.73-.63a9 9 0 0 0-1.7-.17 8.84 8.84 0 0 0-7.8 4.03 12.95 12.95 0 0 0-2.03 6.39c-.07.98-.06 2.15.02 3.13.2 2.47.87 4.53 2.02 6.25a8.98 8.98 0 0 0 10.22 3.65 6.5 6.5 0 0 0 2.8-1.93c.41-.51.84-1.1 1.1-1.55l.1-.17h.37v3.58h4.38V0h-4.48Zm-5.24 5.54c1.3.14 2.3.6 3.17 1.48.9.9 1.5 2.09 1.85 3.64.36 1.6.39 3.72.06 5.43a8.1 8.1 0 0 1-1.54 3.62 5.1 5.1 0 0 1-3.93 1.96 6.1 6.1 0 0 1-2.32-.31 5.87 5.87 0 0 1-3.33-3.5c-.39-1-.62-2.05-.72-3.32-.03-.32-.04-1.35-.02-1.73q.12-2.34.96-4.05a6.2 6.2 0 0 1 1.06-1.58 5.08 5.08 0 0 1 3.6-1.66c.25-.02.9 0 1.16.02m27.66 4.14.01 15.38h4.38l.01-3.57h.37l.09.15c.24.44.84 1.26 1.21 1.7a6.8 6.8 0 0 0 2.57 1.75 9.3 9.3 0 0 0 6.86-.49 9.28 9.28 0 0 0 4.05-4.07A13 13 0 0 0 231 21.6c.21-1.73.18-3.7-.09-5.32a13 13 0 0 0-1.5-4.3 9.1 9.1 0 0 0-3.75-3.63 9.15 9.15 0 0 0-4.43-.96 7.5 7.5 0 0 0-2.8.5A7.1 7.1 0 0 0 216 9.7c-.4.52-.82 1.12-1.1 1.59l-.07.14h-.27V0h-4.5Zm11.13-4.14c1.07.1 1.94.44 2.7 1.04a6.1 6.1 0 0 1 1.64 1.98c.43.84.78 2 .94 3.11.15 1.16.16 2.4.02 3.54a9.34 9.34 0 0 1-1.39 4.03 5.33 5.33 0 0 1-2.69 2.15c-.9.3-2.04.38-3.06.2a5.14 5.14 0 0 1-3.45-2.37 6 6 0 0 1-.45-.8c-.5-1.03-.8-2.2-.92-3.58-.04-.49-.06-.89-.05-1.53.01-.76.05-1.23.13-1.85.38-2.53 1.47-4.38 3.15-5.31a5.5 5.5 0 0 1 2.3-.63 10 10 0 0 1 1.13.02M69.05 2.17l-.01 2.77V7.7h-3.36v3.6h3.36v6.8l.01 7.15c.06 1.4.4 2.44 1.1 3.37a5.8 5.8 0 0 0 2.97 2.07c.91.3 1.83.42 2.9.38a8.7 8.7 0 0 0 2.66-.48l-.8-3.7-.38.06a4.96 4.96 0 0 1-2.43-.06c-.33-.1-.56-.25-.8-.49-.4-.41-.6-.88-.7-1.67-.02-.2-.02-.62-.03-6.82v-6.6h4.73V7.7h-4.73V2.16h-4.49Zm64.29 0V7.7h-3.39v3.6h3.38v6.9l.01 7.17a5.66 5.66 0 0 0 2.36 4.49c.85.6 2.03 1.03 3.26 1.17.85.1 2.03.05 2.81-.1.3-.06.75-.18 1-.26l.2-.06v-.05l-.81-3.67-.37.06a5 5 0 0 1-1.8.09c-.85-.13-1.32-.4-1.7-.97a2.6 2.6 0 0 1-.39-1.04c-.06-.4-.06 0-.06-7.1V11.3h4.7V7.7h-4.7l-.01-2.77V2.16h-4.49Zm160.07.19a14.56 14.56 0 0 0-13.7 16.07 14.59 14.59 0 0 0 21.86 11.08 14.5 14.5 0 0 0 7.11-14.07 14.61 14.61 0 0 0-6.53-10.73 14.5 14.5 0 0 0-8.74-2.35m57.39 0a10.17 10.17 0 0 0-7.56 4.2c-.16.2-.45.63-.58.83l-.05.1h-.47l-.01-4.36h-7.36v36.4h7.82V27.27h.49l.05.07a11.3 11.3 0 0 0 7.49 4.15 10.52 10.52 0 0 0 9.38-4.1c1.66-2.1 2.73-4.9 3.07-8.06.1-.87.13-1.4.13-2.37 0-.8 0-1.1-.07-1.76a15.95 15.95 0 0 0-3.23-8.72 12.8 12.8 0 0 0-1.85-1.84 10.5 10.5 0 0 0-7.26-2.28Zm-.94 6.05c1.27.15 2.33.65 3.2 1.5.98.96 1.67 2.31 2.03 4 .34 1.57.38 3.68.12 5.39a9.8 9.8 0 0 1-1.04 3.25c-.14.25-.44.69-.6.89a5.35 5.35 0 0 1-4.31 2.07 5.25 5.25 0 0 1-4.41-1.9 7.4 7.4 0 0 1-1.26-2.32 14.1 14.1 0 0 1-.62-4.83c.05-1.98.38-3.53 1.02-4.85a5.63 5.63 0 0 1 2.5-2.65c.66-.34 1.3-.5 2.14-.58.18-.02 1.04 0 1.23.03m13.77-5.31-.01 3.2v3.16h1.43c1.26.01 1.44.02 1.54.04.42.09.66.28.79.62.08.23.08.08.08 2.96a912 912 0 0 1 .03 10.18v7.54h7.82v-7.4l.01-7.83c.03-.94.11-1.63.27-2.28.46-1.9 1.54-2.93 3.35-3.23.52-.08.2-.08 5-.08h4.4v-6.9h-3.1c-3.48 0-3.91.01-4.67.1-1.83.2-3.04.79-3.96 1.88-.5.6-.9 1.32-1.26 2.26l-.06.17h-.46v-4.4h-5.6c-4.46 0-5.6 0-5.6.02Zm27.17 13.85V30.8h3.87l3.86-.01V3.09h-7.73Zm9.8-13.85-.01.4v.38l4.66 13.4 4.69 13.47.02.05h10.3l.03-.05 4.67-13.45 4.67-13.4v-.8h-7.43l-6.7 19.26h-.5l-3.28-9.5-3.31-9.64-.05-.12h-3.88l-3.88.01Zm30.38 0c-.01 0-.02.19-.02.4v.39l5.08 14.59c2.8 8.02 5.08 14.6 5.08 14.61.01.02-.22.02-4.8.02h-4.82v6.42h4.95c5.09 0 5.23 0 5.87-.06 3.15-.28 5.29-1.63 6.63-4.15.28-.55.44-.95.87-2.16L459 6.78l1-2.89v-.8h-7.43l-6.69 19.26h-.5l-3.27-9.46-3.31-9.64-.06-.16h-3.88zM36.57 7.36c-1.36.1-2.6.6-3.62 1.45a5.65 5.65 0 0 0-1.67 2.42l-.05.13H31V7.7h-4.35v23.08h4.5v-7.3c0-8 0-7.34.08-7.82a4.9 4.9 0 0 1 2.06-3.18c.83-.58 1.74-.89 2.87-.98a12 12 0 0 1 2.8.25H39v-4.3l-.21-.02c-.61-.07-1.74-.1-2.22-.07m14.51.05c-2.33.12-4.3.84-5.95 2.16a9.9 9.9 0 0 0-2.03 2.2 12.5 12.5 0 0 0-2 5.78 18 18 0 0 0 0 3.65 12.13 12.13 0 0 0 2.26 6.05 9.74 9.74 0 0 0 5 3.52c2.11.64 4.7.64 6.8 0a9.8 9.8 0 0 0 4.88-3.37c1.38-1.78 2.19-4 2.4-6.58.13-1.46.06-3.06-.18-4.42a11.24 11.24 0 0 0-3.58-6.6 10 10 0 0 0-5.75-2.35c-.56-.06-1.31-.07-1.85-.04m1.42 3.78c.88.1 1.62.34 2.28.75a6.1 6.1 0 0 1 1.99 2.15 10.3 10.3 0 0 1 1.2 5c.02 1.23-.12 2.44-.42 3.51a7.14 7.14 0 0 1-1.81 3.32c-.61.6-1.2.98-1.95 1.24a6 6 0 0 1-2 .3 5.7 5.7 0 0 1-2.72-.6 5 5 0 0 1-1.28-.94A7.1 7.1 0 0 1 46 22.73c-.57-1.99-.6-4.46-.08-6.5a7.24 7.24 0 0 1 2.03-3.67 5.13 5.13 0 0 1 3.35-1.4 11 11 0 0 1 1.2.03M92.05 7.4c-.96.06-1.56.15-2.3.33a9.62 9.62 0 0 0-6.09 4.66 13.5 13.5 0 0 0-1.71 7c0 .83 0 1.04.06 1.6.16 1.77.58 3.32 1.29 4.7A9.72 9.72 0 0 0 90.28 31c1.84.37 4.08.32 5.85-.13a9.07 9.07 0 0 0 5.02-3.1A7.6 7.6 0 0 0 102.5 25l-2.11-.39-2.11-.38-.08.13a4.72 4.72 0 0 1-2.35 2.55 6.3 6.3 0 0 1-2.23.58c-.29.03-1.13.03-1.44 0a6.35 6.35 0 0 1-3.02-1.04 5.93 5.93 0 0 1-2.02-2.43 8.4 8.4 0 0 1-.72-3.18v-.26h16.38v-.81c0-1.83-.06-2.76-.25-3.87-.2-1.22-.53-2.24-1.05-3.28a8.9 8.9 0 0 0-2.66-3.26 10.1 10.1 0 0 0-5.34-1.94 18 18 0 0 0-1.46-.03Zm1.3 3.75c1.2.13 2.19.55 3.05 1.3a5.8 5.8 0 0 1 1.78 2.96c.13.51.21 1.17.21 1.66v.15H86.43v-.12c.08-.97.3-1.78.72-2.61.5-1 1.2-1.8 2.14-2.42a5.3 5.3 0 0 1 2.9-.95c.2-.01.97 0 1.17.03Zm23.44-3.74c-2 .1-3.73.65-5.22 1.65a10.7 10.7 0 0 0-4.25 6.06 16.1 16.1 0 0 0-.5 5.8c.2 2.17.84 4.13 1.88 5.76.58.9 1.32 1.73 2.15 2.4a9.4 9.4 0 0 0 3.6 1.8 12 12 0 0 0 3.92.34 10.2 10.2 0 0 0 3.84-.95 8.31 8.31 0 0 0 4.76-6.75l.01-.04h-4.37l-.05.16a4.87 4.87 0 0 1-4.24 3.75c-.59.07-1.32.06-1.93-.05a5.47 5.47 0 0 1-3.5-2.27c-.56-.75-1-1.73-1.26-2.79a13.8 13.8 0 0 1-.16-5.24 7.77 7.77 0 0 1 2.1-4.3 5.5 5.5 0 0 1 2.15-1.3 6.4 6.4 0 0 1 3.89.1c.59.21 1.03.5 1.5.96a5.3 5.3 0 0 1 1.46 2.5l.04.15h4.37v-.06a8.22 8.22 0 0 0-5.31-6.94 11 11 0 0 0-4.88-.74m39.41 0a9.87 9.87 0 0 0-6 2.29 11 11 0 0 0-3.41 5.43c-.52 1.78-.68 3.9-.48 5.97.17 1.8.63 3.38 1.37 4.8a9.68 9.68 0 0 0 5.91 4.86c1.65.48 3.63.61 5.53.36 3.72-.49 6.55-2.62 7.56-5.69.12-.39.13-.42.1-.43-.02 0-4.13-.75-4.19-.75-.03 0-.04 0-.1.16-.18.42-.45.9-.72 1.22-.16.2-.49.53-.7.7-.67.54-1.5.9-2.43 1.08-.48.08-.83.11-1.41.11-.64 0-1.07-.04-1.6-.15a5.76 5.76 0 0 1-3.93-2.83 8 8 0 0 1-.99-3.79v-.16h16.38v-1.11l-.02-1.43c-.1-2.25-.53-4-1.35-5.59a9.24 9.24 0 0 0-6.18-4.75c-1.04-.26-2.2-.36-3.33-.3Zm1.45 3.74a5.35 5.35 0 0 1 3.66 1.94 6.1 6.1 0 0 1 1.38 4.01v.12h-11.97v-.06c0-.02 0-.14.02-.25a6.6 6.6 0 0 1 2.15-4.32 5.73 5.73 0 0 1 3.5-1.46c.25-.02 1 0 1.26.02m75.93-3.33 8.37 23.22a49 49 0 0 1-.67 1.9 5.4 5.4 0 0 1-1.14 1.8c-.41.4-.82.58-1.48.69-.27.04-1.03.03-1.35 0a8 8 0 0 1-1.1-.23l-1.08 3.67c0 .02.32.14.66.22.83.21 1.57.29 2.56.28.56-.01.8-.03 1.24-.1 2.71-.4 4.66-2.09 5.86-5.08l9.64-26.44c0-.02-4.82-.06-4.83-.05l-2.93 8.96-2.91 8.94h-.24l-.22-.65-2.91-8.95-2.7-8.3h-4.82Zm59.47 27.98c-1.18.04-1.93.09-2.8.16-2.52.24-4.53.69-5.43 1.23-.7.41-.76.86-.2 1.28.88.66 3.29 1.19 6.36 1.4a49 49 0 0 0 5.75.05c3.47-.19 6.24-.78 7.11-1.5.22-.19.3-.34.3-.53 0-.1 0-.12-.04-.22-.35-.69-2.32-1.3-5.25-1.63a41 41 0 0 0-5.8-.24m0 0"})),yr=fo;var ee=()=>Sr.createElement(po,{style:yo.legalFooterContainer},Sr.createElement(yr,{color:m.brand,width:"100%",height:11})),yo=ho.create({legalFooterContainer:{flexDirection:"row",alignItems:"center",marginVertical:16,justifyContent:"center",gap:2}});import re,{useState as So}from"react";import{View as Cr,TextInput as Co,StyleSheet as wo,Text as ko}from"react-native";var B=a=>{var s=a,{error:e,status:r,LeftIcon:t}=s,o=Z(s,["error","status","LeftIcon"]);let[n,i]=So(!1);return re.createElement(Cr,{style:A.container},re.createElement(Cr,{style:[A.inputBox,n&&A.inputBoxFocused,e&&A.inputBoxError]},t,re.createElement(Co,k({cursorColor:m.interactive,placeholderTextColor:m.placeholder,onFocus:()=>i(!0),onBlur:()=>i(!1),autoCapitalize:"none",returnKeyType:"next",multiline:!1,numberOfLines:1,style:A.input},o))),r&&re.createElement(ko,{style:[A.statusText,e&&A.statusError]},r))},A=wo.create({container:{gap:6},input:{flex:1,fontFamily:"Inter_400Regular",fontSize:18,height:30,color:m.text},inputBox:{flexDirection:"row",paddingHorizontal:16,height:64,backgroundColor:m.inputBackground,borderRadius:14,alignItems:"center",columnGap:10,borderWidth:2,borderColor:m.border},inputBoxFocused:{borderColor:m.interactive},inputBoxError:{borderColor:m.error},statusText:{textAlign:"left",color:m.textMuted,fontFamily:"Inter_400Regular",fontSize:14,lineHeight:22},statusError:{color:m.errorDark}});import*as We from"react";import bo,{Path as vo}from"react-native-svg";var xo=e=>We.createElement(bo,k({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),We.createElement(vo,{stroke:e.color,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7m2-3h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2"})),wr=xo;var kr=({sendCode:e,isLoading:r,error:t,initialEmail:o,FooterComponent:a})=>{let[s,n]=Eo(o!=null?o:"");return x.createElement(Po,{behavior:Fo.OS==="ios"?"padding":void 0,style:oe.innerContainer},x.createElement(te,{style:{flex:1,justifyContent:"space-between",paddingHorizontal:16,paddingBottom:16}},x.createElement(te,{style:oe.content},x.createElement(te,{style:oe.content},x.createElement(te,{style:oe.formContainer},x.createElement(F,{title:"Enter your email"}),x.createElement(B,{LeftIcon:x.createElement(wr,{color:m.icon}),value:s,onChangeText:n,error:!!t,status:t?To(t):" ",placeholder:"your@email.com",autoComplete:"email",keyboardType:"email-address",autoFocus:!0})),a),x.createElement(ee,null)),x.createElement(v,{title:"Continue",loading:r,onPress:()=>e(s)})))},To=Mo({invalid_data:"Invalid email address.",too_many_requests:"Too many requests. Please try again later.",default:"Something went wrong. Please try again."}),oe=Lo.create({innerContainer:{flex:1},content:{gap:4},formContainer:{rowGap:24}});import Wo from"react";var ne=({onLoginMethodChange:e,otherLoginMethod:r})=>r?Wo.createElement(v,{variant:"tertiary",title:`Use ${ze[r]} instead`,onPress:()=>e(r)}):null;var Io=600,xr=({goBackRef:e,onLoginMethodChange:r,otherLoginMethod:t})=>{let{setOtpState:o}=Ao(h),a=U(),[s,n]=vr(""),{state:i,loginWithCode:d,sendCode:f}=Xe(),[u,g]=vr("email"),{step:l,error:c=null,isLoading:y=!1,isDone:C=!1}=_o(()=>{var p;switch(i.status){case"initial":return{step:{type:"email"}};case"sending-code":return{step:{type:u},isLoading:!0};case"awaiting-code-input":return{step:{type:"code"}};case"submitting-code":return{step:{type:"code"},isLoading:!0};case"done":return{step:{type:"code"},isDone:!0};case"error":return{step:{type:u},error:(p=i.error)!=null?p:new Error("Unknown error")}}},[u,i.status]);switch(u!==l.type&&g(l.type),br(()=>{if(!C)return;let p=setTimeout(()=>{a()},Io);return()=>clearTimeout(p)},[C,a]),br(()=>{if(l.type==="code")return e.current=()=>{o({status:"initial"})},()=>{e.current=null}},[l.type,o]),l.type){case"code":return Ae.createElement(X,{loginWithCode:p=>d({code:p,email:s}),requestNewCode:()=>f({email:s}),subtitle:`Please check ${s} for a message with your login code.`,isLoading:y,error:c,isDone:C});case"email":return Ae.createElement(kr,{initialEmail:s,sendCode:p=>{n(p),f({email:p})},isLoading:y,error:c,FooterComponent:Ae.createElement(ne,{onLoginMethodChange:r,otherLoginMethod:t})})}};import Ve,{useContext as Cn,useEffect as Vr,useMemo as wn,useState as Hr}from"react";import b,{useState as Be}from"react";import{View as ae,StyleSheet as dn,KeyboardAvoidingView as gn,Platform as fn}from"react-native";import{getPlaceholderPhoneNumber as hn,phoneNumberTypingFormatter as pn,createErrorFormatter as yn}from"@privy-io/js-sdk-core";import T,{useMemo as Jo,useState as Yo}from"react";import{View as Qo,StyleSheet as $o,KeyboardAvoidingView as Xo,Platform as en,FlatList as rn}from"react-native";import{useState as Uo,useEffect as Oo}from"react";function Er(e,r){let[t,o]=Uo(e);return Oo(()=>{let a=setTimeout(()=>{o(e)},r);return()=>{clearTimeout(a)}},[e,r]),t}import{getCountryCallingCode as Vo}from"@privy-io/js-sdk-core";var Lr=[["Afghanistan","AF","\u{1F1E6}\u{1F1EB}"],["Albania","AL","\u{1F1E6}\u{1F1F1}"],["Algeria","DZ","\u{1F1E9}\u{1F1FF}"],["American Samoa","AS","\u{1F1E6}\u{1F1F8}"],["Andorra","AD","\u{1F1E6}\u{1F1E9}"],["Angola","AO","\u{1F1E6}\u{1F1F4}"],["Anguilla","AI","\u{1F1E6}\u{1F1EE}"],["Antigua & Barbuda","AG","\u{1F1E6}\u{1F1EC}"],["Argentina","AR","\u{1F1E6}\u{1F1F7}"],["Armenia","AM","\u{1F1E6}\u{1F1F2}"],["Aruba","AW","\u{1F1E6}\u{1F1FC}"],["Ascension Island","AC","\u{1F1E6}\u{1F1E8}"],["Australia","AU","\u{1F1E6}\u{1F1FA}"],["Austria","AT","\u{1F1E6}\u{1F1F9}"],["Azerbaijan","AZ","\u{1F1E6}\u{1F1FF}"],["Bahamas","BS","\u{1F1E7}\u{1F1F8}"],["Bahrain","BH","\u{1F1E7}\u{1F1ED}"],["Bangladesh","BD","\u{1F1E7}\u{1F1E9}"],["Barbados","BB","\u{1F1E7}\u{1F1E7}"],["Belarus","BY","\u{1F1E7}\u{1F1FE}"],["Belgium","BE","\u{1F1E7}\u{1F1EA}"],["Belize","BZ","\u{1F1E7}\u{1F1FF}"],["Benin","BJ","\u{1F1E7}\u{1F1EF}"],["Bermuda","BM","\u{1F1E7}\u{1F1F2}"],["Bhutan","BT","\u{1F1E7}\u{1F1F9}"],["Bolivia","BO","\u{1F1E7}\u{1F1F4}"],["Bosnia & Herzegovina","BA","\u{1F1E7}\u{1F1E6}"],["Botswana","BW","\u{1F1E7}\u{1F1FC}"],["Brazil","BR","\u{1F1E7}\u{1F1F7}"],["British Indian Ocean Territory","IO","\u{1F1EE}\u{1F1F4}"],["British Virgin Islands","VG","\u{1F1FB}\u{1F1EC}"],["Brunei","BN","\u{1F1E7}\u{1F1F3}"],["Bulgaria","BG","\u{1F1E7}\u{1F1EC}"],["Burkina Faso","BF","\u{1F1E7}\u{1F1EB}"],["Burundi","BI","\u{1F1E7}\u{1F1EE}"],["Cambodia","KH","\u{1F1F0}\u{1F1ED}"],["Cameroon","CM","\u{1F1E8}\u{1F1F2}"],["Canada","CA","\u{1F1E8}\u{1F1E6}"],["Cape Verde","CV","\u{1F1E8}\u{1F1FB}"],["Caribbean Netherlands","BQ","\u{1F1E7}\u{1F1F6}"],["Cayman Islands","KY","\u{1F1F0}\u{1F1FE}"],["Central African Republic","CF","\u{1F1E8}\u{1F1EB}"],["Chad","TD","\u{1F1F9}\u{1F1E9}"],["Chile","CL","\u{1F1E8}\u{1F1F1}"],["China","CN","\u{1F1E8}\u{1F1F3}"],["Christmas Island","CX","\u{1F1E8}\u{1F1FD}"],["Cocos (Keeling) Islands","CC","\u{1F1E8}\u{1F1E8}"],["Colombia","CO","\u{1F1E8}\u{1F1F4}"],["Comoros","KM","\u{1F1F0}\u{1F1F2}"],["Congo - Brazzaville","CG","\u{1F1E8}\u{1F1EC}"],["Congo - Kinshasa","CD","\u{1F1E8}\u{1F1E9}"],["Cook Islands","CK","\u{1F1E8}\u{1F1F0}"],["Costa Rica","CR","\u{1F1E8}\u{1F1F7}"],["Croatia","HR","\u{1F1ED}\u{1F1F7}"],["Cuba","CU","\u{1F1E8}\u{1F1FA}"],["Cura\xE7ao","CW","\u{1F1E8}\u{1F1FC}"],["Cyprus","CY","\u{1F1E8}\u{1F1FE}"],["Czechia","CZ","\u{1F1E8}\u{1F1FF}"],["C\xF4te d\u2019Ivoire","CI","\u{1F1E8}\u{1F1EE}"],["Denmark","DK","\u{1F1E9}\u{1F1F0}"],["Djibouti","DJ","\u{1F1E9}\u{1F1EF}"],["Dominica","DM","\u{1F1E9}\u{1F1F2}"],["Dominican Republic","DO","\u{1F1E9}\u{1F1F4}"],["Ecuador","EC","\u{1F1EA}\u{1F1E8}"],["Egypt","EG","\u{1F1EA}\u{1F1EC}"],["El Salvador","SV","\u{1F1F8}\u{1F1FB}"],["Equatorial Guinea","GQ","\u{1F1EC}\u{1F1F6}"],["Eritrea","ER","\u{1F1EA}\u{1F1F7}"],["Estonia","EE","\u{1F1EA}\u{1F1EA}"],["Eswatini","SZ","\u{1F1F8}\u{1F1FF}"],["Ethiopia","ET","\u{1F1EA}\u{1F1F9}"],["Falkland Islands","FK","\u{1F1EB}\u{1F1F0}"],["Faroe Islands","FO","\u{1F1EB}\u{1F1F4}"],["Fiji","FJ","\u{1F1EB}\u{1F1EF}"],["Finland","FI","\u{1F1EB}\u{1F1EE}"],["France","FR","\u{1F1EB}\u{1F1F7}"],["French Guiana","GF","\u{1F1EC}\u{1F1EB}"],["French Polynesia","PF","\u{1F1F5}\u{1F1EB}"],["Gabon","GA","\u{1F1EC}\u{1F1E6}"],["Gambia","GM","\u{1F1EC}\u{1F1F2}"],["Georgia","GE","\u{1F1EC}\u{1F1EA}"],["Germany","DE","\u{1F1E9}\u{1F1EA}"],["Ghana","GH","\u{1F1EC}\u{1F1ED}"],["Gibraltar","GI","\u{1F1EC}\u{1F1EE}"],["Greece","GR","\u{1F1EC}\u{1F1F7}"],["Greenland","GL","\u{1F1EC}\u{1F1F1}"],["Grenada","GD","\u{1F1EC}\u{1F1E9}"],["Guadeloupe","GP","\u{1F1EC}\u{1F1F5}"],["Guam","GU","\u{1F1EC}\u{1F1FA}"],["Guatemala","GT","\u{1F1EC}\u{1F1F9}"],["Guernsey","GG","\u{1F1EC}\u{1F1EC}"],["Guinea","GN","\u{1F1EC}\u{1F1F3}"],["Guinea-Bissau","GW","\u{1F1EC}\u{1F1FC}"],["Guyana","GY","\u{1F1EC}\u{1F1FE}"],["Haiti","HT","\u{1F1ED}\u{1F1F9}"],["Honduras","HN","\u{1F1ED}\u{1F1F3}"],["Hong Kong SAR China","HK","\u{1F1ED}\u{1F1F0}"],["Hungary","HU","\u{1F1ED}\u{1F1FA}"],["Iceland","IS","\u{1F1EE}\u{1F1F8}"],["India","IN","\u{1F1EE}\u{1F1F3}"],["Indonesia","ID","\u{1F1EE}\u{1F1E9}"],["Iran","IR","\u{1F1EE}\u{1F1F7}"],["Iraq","IQ","\u{1F1EE}\u{1F1F6}"],["Ireland","IE","\u{1F1EE}\u{1F1EA}"],["Isle of Man","IM","\u{1F1EE}\u{1F1F2}"],["Israel","IL","\u{1F1EE}\u{1F1F1}"],["Italy","IT","\u{1F1EE}\u{1F1F9}"],["Jamaica","JM","\u{1F1EF}\u{1F1F2}"],["Japan","JP","\u{1F1EF}\u{1F1F5}"],["Jersey","JE","\u{1F1EF}\u{1F1EA}"],["Jordan","JO","\u{1F1EF}\u{1F1F4}"],["Kazakhstan","KZ","\u{1F1F0}\u{1F1FF}"],["Kenya","KE","\u{1F1F0}\u{1F1EA}"],["Kiribati","KI","\u{1F1F0}\u{1F1EE}"],["Kosovo","XK","\u{1F1FD}\u{1F1F0}"],["Kuwait","KW","\u{1F1F0}\u{1F1FC}"],["Kyrgyzstan","KG","\u{1F1F0}\u{1F1EC}"],["Laos","LA","\u{1F1F1}\u{1F1E6}"],["Latvia","LV","\u{1F1F1}\u{1F1FB}"],["Lebanon","LB","\u{1F1F1}\u{1F1E7}"],["Lesotho","LS","\u{1F1F1}\u{1F1F8}"],["Liberia","LR","\u{1F1F1}\u{1F1F7}"],["Libya","LY","\u{1F1F1}\u{1F1FE}"],["Liechtenstein","LI","\u{1F1F1}\u{1F1EE}"],["Lithuania","LT","\u{1F1F1}\u{1F1F9}"],["Luxembourg","LU","\u{1F1F1}\u{1F1FA}"],["Macao SAR China","MO","\u{1F1F2}\u{1F1F4}"],["Madagascar","MG","\u{1F1F2}\u{1F1EC}"],["Malawi","MW","\u{1F1F2}\u{1F1FC}"],["Malaysia","MY","\u{1F1F2}\u{1F1FE}"],["Maldives","MV","\u{1F1F2}\u{1F1FB}"],["Mali","ML","\u{1F1F2}\u{1F1F1}"],["Malta","MT","\u{1F1F2}\u{1F1F9}"],["Marshall Islands","MH","\u{1F1F2}\u{1F1ED}"],["Martinique","MQ","\u{1F1F2}\u{1F1F6}"],["Mauritania","MR","\u{1F1F2}\u{1F1F7}"],["Mauritius","MU","\u{1F1F2}\u{1F1FA}"],["Mayotte","YT","\u{1F1FE}\u{1F1F9}"],["Mexico","MX","\u{1F1F2}\u{1F1FD}"],["Micronesia","FM","\u{1F1EB}\u{1F1F2}"],["Moldova","MD","\u{1F1F2}\u{1F1E9}"],["Monaco","MC","\u{1F1F2}\u{1F1E8}"],["Mongolia","MN","\u{1F1F2}\u{1F1F3}"],["Montenegro","ME","\u{1F1F2}\u{1F1EA}"],["Montserrat","MS","\u{1F1F2}\u{1F1F8}"],["Morocco","MA","\u{1F1F2}\u{1F1E6}"],["Mozambique","MZ","\u{1F1F2}\u{1F1FF}"],["Myanmar (Burma)","MM","\u{1F1F2}\u{1F1F2}"],["Namibia","NA","\u{1F1F3}\u{1F1E6}"],["Nauru","NR","\u{1F1F3}\u{1F1F7}"],["Nepal","NP","\u{1F1F3}\u{1F1F5}"],["Netherlands","NL","\u{1F1F3}\u{1F1F1}"],["New Caledonia","NC","\u{1F1F3}\u{1F1E8}"],["New Zealand","NZ","\u{1F1F3}\u{1F1FF}"],["Nicaragua","NI","\u{1F1F3}\u{1F1EE}"],["Niger","NE","\u{1F1F3}\u{1F1EA}"],["Nigeria","NG","\u{1F1F3}\u{1F1EC}"],["Niue","NU","\u{1F1F3}\u{1F1FA}"],["Norfolk Island","NF","\u{1F1F3}\u{1F1EB}"],["North Korea","KP","\u{1F1F0}\u{1F1F5}"],["North Macedonia","MK","\u{1F1F2}\u{1F1F0}"],["Northern Mariana Islands","MP","\u{1F1F2}\u{1F1F5}"],["Norway","NO","\u{1F1F3}\u{1F1F4}"],["Oman","OM","\u{1F1F4}\u{1F1F2}"],["Pakistan","PK","\u{1F1F5}\u{1F1F0}"],["Palau","PW","\u{1F1F5}\u{1F1FC}"],["Palestinian Territories","PS","\u{1F1F5}\u{1F1F8}"],["Panama","PA","\u{1F1F5}\u{1F1E6}"],["Papua New Guinea","PG","\u{1F1F5}\u{1F1EC}"],["Paraguay","PY","\u{1F1F5}\u{1F1FE}"],["Peru","PE","\u{1F1F5}\u{1F1EA}"],["Philippines","PH","\u{1F1F5}\u{1F1ED}"],["Poland","PL","\u{1F1F5}\u{1F1F1}"],["Portugal","PT","\u{1F1F5}\u{1F1F9}"],["Puerto Rico","PR","\u{1F1F5}\u{1F1F7}"],["Qatar","QA","\u{1F1F6}\u{1F1E6}"],["Romania","RO","\u{1F1F7}\u{1F1F4}"],["Russia","RU","\u{1F1F7}\u{1F1FA}"],["Rwanda","RW","\u{1F1F7}\u{1F1FC}"],["R\xE9union","RE","\u{1F1F7}\u{1F1EA}"],["Samoa","WS","\u{1F1FC}\u{1F1F8}"],["San Marino","SM","\u{1F1F8}\u{1F1F2}"],["Saudi Arabia","SA","\u{1F1F8}\u{1F1E6}"],["Senegal","SN","\u{1F1F8}\u{1F1F3}"],["Serbia","RS","\u{1F1F7}\u{1F1F8}"],["Seychelles","SC","\u{1F1F8}\u{1F1E8}"],["Sierra Leone","SL","\u{1F1F8}\u{1F1F1}"],["Singapore","SG","\u{1F1F8}\u{1F1EC}"],["Sint Maarten","SX","\u{1F1F8}\u{1F1FD}"],["Slovakia","SK","\u{1F1F8}\u{1F1F0}"],["Slovenia","SI","\u{1F1F8}\u{1F1EE}"],["Solomon Islands","SB","\u{1F1F8}\u{1F1E7}"],["Somalia","SO","\u{1F1F8}\u{1F1F4}"],["South Africa","ZA","\u{1F1FF}\u{1F1E6}"],["South Korea","KR","\u{1F1F0}\u{1F1F7}"],["South Sudan","SS","\u{1F1F8}\u{1F1F8}"],["Spain","ES","\u{1F1EA}\u{1F1F8}"],["Sri Lanka","LK","\u{1F1F1}\u{1F1F0}"],["St. Barth\xE9lemy","BL","\u{1F1E7}\u{1F1F1}"],["St. Helena","SH","\u{1F1F8}\u{1F1ED}"],["St. Kitts & Nevis","KN","\u{1F1F0}\u{1F1F3}"],["St. Lucia","LC","\u{1F1F1}\u{1F1E8}"],["St. Martin","MF","\u{1F1F2}\u{1F1EB}"],["St. Pierre & Miquelon","PM","\u{1F1F5}\u{1F1F2}"],["St. Vincent & Grenadines","VC","\u{1F1FB}\u{1F1E8}"],["Sudan","SD","\u{1F1F8}\u{1F1E9}"],["Suriname","SR","\u{1F1F8}\u{1F1F7}"],["Svalbard & Jan Mayen","SJ","\u{1F1F8}\u{1F1EF}"],["Sweden","SE","\u{1F1F8}\u{1F1EA}"],["Switzerland","CH","\u{1F1E8}\u{1F1ED}"],["Syria","SY","\u{1F1F8}\u{1F1FE}"],["S\xE3o Tom\xE9 & Pr\xEDncipe","ST","\u{1F1F8}\u{1F1F9}"],["Taiwan","TW","\u{1F1F9}\u{1F1FC}"],["Tajikistan","TJ","\u{1F1F9}\u{1F1EF}"],["Tanzania","TZ","\u{1F1F9}\u{1F1FF}"],["Thailand","TH","\u{1F1F9}\u{1F1ED}"],["Timor-Leste","TL","\u{1F1F9}\u{1F1F1}"],["Togo","TG","\u{1F1F9}\u{1F1EC}"],["Tokelau","TK","\u{1F1F9}\u{1F1F0}"],["Tonga","TO","\u{1F1F9}\u{1F1F4}"],["Trinidad & Tobago","TT","\u{1F1F9}\u{1F1F9}"],["Tristan da Cunha","TA","\u{1F1F9}\u{1F1E6}"],["Tunisia","TN","\u{1F1F9}\u{1F1F3}"],["Turkey","TR","\u{1F1F9}\u{1F1F7}"],["Turkmenistan","TM","\u{1F1F9}\u{1F1F2}"],["Turks & Caicos Islands","TC","\u{1F1F9}\u{1F1E8}"],["Tuvalu","TV","\u{1F1F9}\u{1F1FB}"],["U.S. Virgin Islands","VI","\u{1F1FB}\u{1F1EE}"],["Uganda","UG","\u{1F1FA}\u{1F1EC}"],["Ukraine","UA","\u{1F1FA}\u{1F1E6}"],["United Arab Emirates","AE","\u{1F1E6}\u{1F1EA}"],["United Kingdom","GB","\u{1F1EC}\u{1F1E7}"],["United States","US","\u{1F1FA}\u{1F1F8}"],["Uruguay","UY","\u{1F1FA}\u{1F1FE}"],["Uzbekistan","UZ","\u{1F1FA}\u{1F1FF}"],["Vanuatu","VU","\u{1F1FB}\u{1F1FA}"],["Vatican City","VA","\u{1F1FB}\u{1F1E6}"],["Venezuela","VE","\u{1F1FB}\u{1F1EA}"],["Vietnam","VN","\u{1F1FB}\u{1F1F3}"],["Wallis & Futuna","WF","\u{1F1FC}\u{1F1EB}"],["Western Sahara","EH","\u{1F1EA}\u{1F1ED}"],["Yemen","YE","\u{1F1FE}\u{1F1EA}"],["Zambia","ZM","\u{1F1FF}\u{1F1F2}"],["Zimbabwe","ZW","\u{1F1FF}\u{1F1FC}"],["\xC5land Islands","AX","\u{1F1E6}\u{1F1FD}"]];var Ho=Lr,Pr=Ho.map(([e,r,t])=>({name:e,code:r,callCode:Vo(r),flag:t}));import R from"react";import{View as Ro,Text as Mr,Pressable as Ko,StyleSheet as zo}from"react-native";import*as _e from"react";import Go,{Path as No}from"react-native-svg";var Do=e=>_e.createElement(Go,k({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),_e.createElement(No,{stroke:e.color,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 6 9 17l-5-5"})),Fr=Do;var Tr=({country:e,onPress:r,selected:t})=>R.createElement(Ko,{onPress:r},R.createElement(Ro,{style:Ie.row},R.createElement(Mr,{style:Ie.rowFlag},e.flag),R.createElement(Mr,{style:Ie.rowLabel},e.name," (+",e.callCode,")"),t&&R.createElement(Fr,{color:m.interactive}))),Ie=zo.create({row:{flexDirection:"row",alignItems:"center",gap:10,height:56},rowFlag:{fontFamily:"Inter_400Regular",fontSize:17,lineHeight:22},rowLabel:{flex:1,fontFamily:"Inter_400Regular",fontSize:17,lineHeight:22,color:m.black}});import*as Ue from"react";import Zo,{Path as jo}from"react-native-svg";var qo=e=>Ue.createElement(Zo,k({xmlns:"http://www.w3.org/2000/svg",width:17,height:16,fill:"none",viewBox:"0 0 17 16"},e),Ue.createElement(jo,{fill:e.color,fillRule:"evenodd",d:"M7.01 12.01a5.5 5.5 0 1 1 4.304-2.075.7.7 0 0 1 .156.115l3.818 3.819a.65.65 0 0 1-.92.92l-3.818-3.82a.7.7 0 0 1-.115-.155A5.48 5.48 0 0 1 7.01 12.01m4.5-5.5a4.5 4.5 0 1 1-9 0 4.5 4.5 0 0 1 9 0",clipRule:"evenodd"})),Wr=qo;var tn=600,_r=({countryCode:e,onChangeCountryCode:r,onComplete:t})=>{let[o,a]=Yo(""),s=Er(o,tn),n=Jo(()=>Pr.filter(i=>i.name.toLowerCase().includes(s.toLowerCase())),[s]);return T.createElement(Xo,{behavior:en.OS==="ios"?"padding":void 0,style:Ar.innerContainer},T.createElement(Qo,{style:Ar.header},T.createElement(F,{title:"Select country code"}),T.createElement(B,{LeftIcon:T.createElement(Wr,{color:m.placeholder}),value:o,onChangeText:a,placeholder:"Search country"})),T.createElement(rn,{style:{flex:1},data:n,keyExtractor:i=>`country-option-${i.code}`,renderItem:({item:i})=>T.createElement(Tr,{country:i,selected:i.code===e,onPress:()=>{r(i.code),t()}})}),T.createElement(v,{title:"Continue",onPress:t}))},Ar=$o.create({innerContainer:{flex:1,paddingHorizontal:16},header:{gap:20}});import ie from"react";import{View as sn,Text as ln,Pressable as cn,StyleSheet as un}from"react-native";import{getCountryCallingCode as mn}from"@privy-io/js-sdk-core";import*as Oe from"react";import on,{Path as nn}from"react-native-svg";var an=e=>Oe.createElement(on,k({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},e),Oe.createElement(nn,{stroke:e.color,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"m4 6 4 4 4-4"})),Ir=an;var Or=({countryCode:e,onPress:r})=>ie.createElement(cn,{onPress:r},ie.createElement(sn,{style:Ur.cell},ie.createElement(ln,{style:Ur.text},e," +",mn(e)),ie.createElement(Ir,{color:m.icon}))),Ur=un.create({cell:{flexDirection:"row",alignItems:"center",gap:6},text:{fontFamily:"Inter_400Regular",fontSize:18,lineHeight:30,color:m.text}});var Br=({sendCode:e,isLoading:r,error:t,initialPhone:o,FooterComponent:a})=>{let[s,n]=Be(o!=null?o:""),[i,d]=Be("US"),[f,u]=Be(!1),g=pn(i),l=hn(i),c=y=>{try{let C=y.replace(/\D/g,""),p=s.replace(/\D/g,""),E=C===p?y:g.input(y);n(E)}catch(C){console.error("Error processing phone number:",C),n("")}};return f?b.createElement(_r,{countryCode:i,onChangeCountryCode:d,onComplete:()=>u(!1)}):b.createElement(gn,{behavior:fn.OS==="ios"?"padding":void 0,style:se.innerContainer},b.createElement(ae,{style:{flex:1,justifyContent:"space-between",paddingHorizontal:16,paddingBottom:16}},b.createElement(ae,{style:se.content},b.createElement(ae,{style:se.content},b.createElement(ae,{style:se.formContainer},b.createElement(F,{title:"Enter your phone"}),b.createElement(B,{LeftIcon:b.createElement(Or,{countryCode:i,onPress:()=>u(!0)}),value:s,onChangeText:c,error:!!t,status:t?Sn(t):" ",placeholder:l,autoComplete:"tel",keyboardType:"phone-pad",autoFocus:!0})),a),b.createElement(ee,null)),b.createElement(v,{title:"Continue",loading:r,onPress:()=>e(s)})))},Sn=yn({invalid_data:"Phone is incorrect.",not_supported:"Region or carrier not yet supported.",too_many_requests:"Too many requests. Please try again later.",default:"Something went wrong. Please try again."}),se=dn.create({innerContainer:{flex:1},content:{gap:4},formContainer:{rowGap:24}});var kn=600,Gr=({goBackRef:e,onLoginMethodChange:r,otherLoginMethod:t})=>{let{setOtpState:o}=Cn(h),a=U(),[s,n]=Hr(""),{state:i,loginWithCode:d,sendCode:f}=tr(),[u,g]=Hr("phone"),{step:l,error:c=null,isLoading:y=!1,isDone:C=!1}=wn(()=>{var p;switch(i.status){case"initial":return{step:{type:"phone"}};case"sending-code":return{step:{type:u},isLoading:!0};case"awaiting-code-input":return{step:{type:"code"}};case"submitting-code":return{step:{type:"code"},isLoading:!0};case"done":return{step:{type:"code"},isDone:!0};case"error":return{step:{type:u},error:(p=i.error)!=null?p:new Error("Unknown error")}}},[u,i.status]);switch(u!==l.type&&g(l.type),Vr(()=>{if(!C)return;let p=setTimeout(()=>{a()},kn);return()=>clearTimeout(p)},[C,a]),Vr(()=>{if(l.type==="code")return e.current=()=>{o({status:"initial"})},()=>{e.current=null}},[l.type,o,a]),l.type){case"phone":return Ve.createElement(Br,{initialPhone:s,sendCode:p=>{n(p),f({phone:p})},isLoading:y,error:c,FooterComponent:Ve.createElement(ne,{onLoginMethodChange:r,otherLoginMethod:t})});case"code":return Ve.createElement(X,{loginWithCode:p=>d({code:p,phone:s}),requestNewCode:()=>f({phone:s}),subtitle:`Please check ${s} for a message with your login code.`,isLoading:y,error:c,isDone:C})}};import K from"react";import{Pressable as En,StyleSheet as Ln,View as Dr}from"react-native";import*as He from"react";import bn,{Path as vn}from"react-native-svg";var xn=e=>He.createElement(bn,k({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),He.createElement(vn,{fill:e.color,d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"})),Nr=xn;var Rr=({goBack:e})=>K.createElement(Dr,{style:Kr.navigationBar},K.createElement(Pn,{onPress:e})),Pn=e=>K.createElement(En,k({},e),K.createElement(Dr,{style:Kr.backButton},K.createElement(Nr,{color:m.icon}))),Kr=Ln.create({navigationBar:{height:48},backButton:{width:48,height:48,justifyContent:"center",alignItems:"center"}});import zr from"react";import{Modal as Fn,View as Mn,StyleSheet as Zr}from"react-native";import{useSafeAreaInsets as Tn}from"react-native-safe-area-context";var Wn=()=>{let e=Tn();return{paddingTop:e.top,paddingBottom:e.bottom,paddingLeft:e.left,paddingRight:e.right}},jr=({children:e,visible:r})=>{let t=Wn();return zr.createElement(Fn,{animationType:"slide",transparent:!0,visible:r},zr.createElement(Mn,{style:[Zr.absoluteFill,An.modalContent,t]},e))},An=Zr.create({modalContent:{backgroundColor:m.white}});var Un=({config:e,goBackRef:r})=>{let[t,o]=In(()=>Re(e.loginMethods)),a=t&&Ke(e.loginMethods,t);switch(t){case"email":return z.createElement(xr,{goBackRef:r,otherLoginMethod:a,onLoginMethodChange:o});case"sms":return z.createElement(Gr,{goBackRef:r,otherLoginMethod:a,onLoginMethodChange:o});default:throw new ue("unsupported_login_method",`Unsupported login method: ${t}`)}},On=()=>{let e=U(),r=Ze(),t=Je();qe();let o=_n(null);return z.createElement(jr,{visible:t},z.createElement(Rr,{goBack:()=>{var a;return((a=o.current)!=null?a:e)()}}),r&&z.createElement(Un,{config:r,goBackRef:o}))};import{useCallback as qr,useContext as Bn,useEffect as Vn,useRef as Hn}from"react";var Gn=()=>{let e=je(),{setOtpState:r,user:t}=Bn(h),o=qr(()=>r({status:"initial"}),[]),a=Hn(t);return Vn(()=>{a.current=t}),{login:qr(n=>S(void 0,null,function*(){return{user:yield e(n,a.current,o)}}),[e,o])}};import{digest as Nn}from"expo-crypto";import Dn from"@privy-io/js-sdk-core";var Rn=({appId:e,clientId:r,storage:t=ce,supportedChains:o,baseUrl:a,logLevel:s})=>new Dn({appId:e,clientId:r,supportedChains:o,storage:De(t),sdkVersion:`expo:${Ge.version}`,nativeAppIdentifier:Ne(),crypto:{digest:Nn},baseUrl:a,logLevel:s});export{h as PrivyContext,On as PrivyElements,zn as PrivyProvider,ue as PrivyUIError,ce as SecureStorageAdapter,Rn as createPrivyClient,Kn as getAccessToken,$n as hasError,Zn as isConnected,qn as isConnecting,Qn as isCreating,Jn as isDisconnected,Yn as isNotCreated,jn as isReconnecting,Xn as needsRecovery,Va as useCreateGuestAccount,Pt as useEmbeddedSolanaWallet,be as useEmbeddedWallet,Fa as useEmbeddedWalletStateChange,Aa as useIdentityToken,Ei as useLinkEmail,Vi as useLinkSMS,Qi as useLinkWithFarcaster,Yr as useLinkWithOAuth,ni as useLinkWithSiwe,Gn as useLogin,Xe as useLoginWithEmail,ua as useLoginWithFarcaster,Jr as useLoginWithOAuth,tr as useLoginWithSMS,mi as useLoginWithSiwe,Qr as useOAuthFlow,ka as useOAuthTokens,Wt as usePrivy,Mt as usePrivyClient,oa as useUnlinkFarcaster,pa as useUnlinkOAuth,Si as useUnlinkWallet};
1
+ import{A as Zn,B as jn,C as qn,D as Jn,E as Yn,F as Qn,G as $n,H as Xn,a as k,c as Z,d as S,e as Ge,f as w,g as I,h as j,i as Jr,j as Yr,k as Qr,l as Ne,m as De,n as ce,o as ue,p as Re,q as Ke,r as ze,s as Ze,t as je,u as U,v as qe,w as Je,x as h,y as Kn,z as zn}from"./chunk-LE4QILEJ.js";export*from"@privy-io/js-sdk-core";import{useCallback as me,useContext as $r}from"react";import{PrivyClientError as Xr}from"@privy-io/js-sdk-core";var ni=e=>{let{user:r,client:t,setSiweState:o,siweState:a}=$r(h),s=me(d=>{var u;let f=w(d);return o({status:"error",error:f}),(u=e==null?void 0:e.onError)==null||u.call(e,f),f},[e==null?void 0:e.onError]),n=me(g=>S(void 0,[g],function*({wallet:d,from:{domain:f,uri:u}}){var l;try{o({status:"generating-message"});let c=yield t.auth.siwe.init(d,f,u);return o({status:"awaiting-signature"}),(l=e==null?void 0:e.onGenerateMessage)==null||l.call(e,c.message),c.message}catch(c){throw s(c)}}),[t,s,e==null?void 0:e.onGenerateMessage]),i=me(u=>S(void 0,[u],function*({signature:d,messageOverride:f}){var g;try{if(!r)throw new Xr({code:"attempted_link_siwe_before_logged_in",error:"Must be logged in to link a wallet, Use `useLoginWithSiwe` to login with a wallet"});o({status:"submitting-signature"});let l=yield t.auth.siwe.linkWithSiwe(d,void 0,f);return o({status:"done"}),(g=e==null?void 0:e.onSuccess)==null||g.call(e,l),l}catch(l){throw s(l)}}),[r,t,s,e==null?void 0:e.onSuccess]);return{generateSiweMessage:n,linkWithSiwe:i,state:a}};import{useCallback as de,useContext as et}from"react";import{PrivyClientError as rt}from"@privy-io/js-sdk-core";var mi=e=>{let{user:r,client:t,setSiweState:o,siweState:a}=et(h),s=de(d=>{var u;let f=w(d);return o({status:"error",error:f}),(u=e==null?void 0:e.onError)==null||u.call(e,f),f},[e==null?void 0:e.onError]),n=de(g=>S(void 0,[g],function*({wallet:d,from:{domain:f,uri:u}}){var l;try{o({status:"generating-message"});let c=yield t.auth.siwe.init(d,f,u);return o({status:"awaiting-signature"}),(l=e==null?void 0:e.onGenerateMessage)==null||l.call(e,c.message),c.message}catch(c){throw s(c)}}),[t,s,e==null?void 0:e.onGenerateMessage]);return{loginWithSiwe:de(g=>S(void 0,[g],function*({signature:d,messageOverride:f,disableSignup:u}){var l;try{if(r)throw new rt({code:"attempted_login_with_siwe_while_already_logged_in",error:"Already logged in, use `useLinkWithSiwe` if you are trying to link a wallet to an existing account"});o({status:"submitting-signature"});let c=yield t.auth.siwe.loginWithSiwe(d,void 0,f,u?"no-signup":"login-or-sign-up");return o({status:"done"}),(l=e==null?void 0:e.onSuccess)==null||l.call(e,c.user,c.is_new_user),c.user}catch(c){throw s(c)}}),[r,t,s,e==null?void 0:e.onSuccess]),generateSiweMessage:n,state:a}};import{useCallback as Ye,useContext as tt}from"react";import{PrivyClientError as ot}from"@privy-io/js-sdk-core";var Si=e=>{let{user:r,client:t}=tt(h),o=Ye(s=>{var i;let n=w(s);return(i=e==null?void 0:e.onError)==null||i.call(e,n),n},[e==null?void 0:e.onError]);return{unlinkWallet:Ye(n=>S(void 0,[n],function*({address:s}){var i;try{if(!r)throw new ot({code:"attempted_unlink_siwe_before_logged_in",error:"Must be logged in to unlink a wallet, Use `useLoginWithSiwe` to login with a wallet"});let d=yield t.auth.siwe.unlinkWallet(s);return(i=e==null?void 0:e.onSuccess)==null||i.call(e,d),d}catch(d){throw o(d)}}),[r,t,o,e==null?void 0:e.onSuccess])}};import{useCallback as ge,useContext as nt,useState as it}from"react";import{PrivyClientError as Qe}from"@privy-io/js-sdk-core";var Ei=e=>{let[r,t]=it(""),{user:o,client:a,otpState:s,setOtpState:n}=nt(h),i=ge(u=>{var l;let g=w(u);return n({status:"error",error:g}),(l=e==null?void 0:e.onError)==null||l.call(e,g),g},[e==null?void 0:e.onError]),d=ge(g=>S(void 0,[g],function*({email:u}){var l;t(u);try{n({status:"sending-code"});let c=yield a.auth.email.sendCode(u);return n({status:"awaiting-code-input"}),(l=e==null?void 0:e.onSendCodeSuccess)==null||l.call(e,{email:u}),c}catch(c){return i(c),{success:!1}}}),[a,i,e==null?void 0:e.onSendCodeSuccess]),f=ge(l=>S(void 0,[l],function*({code:u,email:g}){var c;try{if(!o)throw new Qe({code:"attempted_link_email_before_logged_in",error:"Must be logged in to link an email, Use `useLoginWithEmail` to login with email"});let y=g||r;if(!y)throw new Qe({code:"attempted_submit_otp_before_sending",error:"Must `sendCode` with a valid email before calling `linkWithCode`"});n({status:"submitting-code"});let C=yield a.auth.email.linkWithCode(y,u);return n({status:"done"}),(c=e==null?void 0:e.onLinkSuccess)==null||c.call(e,C),C}catch(y){i(y)}}),[o,a,r,i,e==null?void 0:e.onLinkSuccess]);return{sendCode:d,linkWithCode:f,state:s}};import{useCallback as fe,useContext as at,useState as st}from"react";import{PrivyClientError as $e}from"@privy-io/js-sdk-core";var Xe=e=>{let[r,t]=st(""),{user:o,client:a,otpState:s,setOtpState:n}=at(h),i=fe(u=>{var l;let g=w(u);return n({status:"error",error:g}),(l=e==null?void 0:e.onError)==null||l.call(e,g),g},[e==null?void 0:e.onError]),d=fe(g=>S(void 0,[g],function*({email:u}){var l;t(u);try{n({status:"sending-code"});let c=yield a.auth.email.sendCode(u);return n({status:"awaiting-code-input"}),(l=e==null?void 0:e.onSendCodeSuccess)==null||l.call(e,{email:u}),c}catch(c){return i(c),{success:!1}}}),[a,i,e==null?void 0:e.onSendCodeSuccess]),f=fe(c=>S(void 0,[c],function*({code:u,email:g,disableSignup:l}){var y;try{if(o)throw new $e({code:"attempted_login_with_email_while_already_logged_in",error:"Already logged in, use `useLinkWithEmail` if you are trying to link an email to an existing account"});let C=g||r;if(!C)throw new $e({code:"attempted_submit_otp_before_sending",error:"Must `sendCode` with a valid email before calling `loginWithCode`"});n({status:"submitting-code"});let p=yield a.auth.email.loginWithCode(C,u,l?"no-signup":"login-or-sign-up");return n({status:"done"}),(y=e==null?void 0:e.onLoginSuccess)==null||y.call(e,p.user,p.is_new_user),p==null?void 0:p.user}catch(C){i(C)}}),[o,a,r,i,e==null?void 0:e.onLoginSuccess]);return{sendCode:d,loginWithCode:f,state:s}};import{useCallback as he,useContext as lt,useState as ct}from"react";import{PrivyClientError as er}from"@privy-io/js-sdk-core";var Vi=e=>{let[r,t]=ct(""),{user:o,client:a,otpState:s,setOtpState:n}=lt(h),i=he(u=>{var l;let g=w(u);return n({status:"error",error:g}),(l=e==null?void 0:e.onError)==null||l.call(e,g),g},[e==null?void 0:e.onError]),d=he(g=>S(void 0,[g],function*({phone:u}){var l;t(u);try{n({status:"sending-code"});let c=yield a.auth.phone.sendCode(u);return n({status:"awaiting-code-input"}),(l=e==null?void 0:e.onSendCodeSuccess)==null||l.call(e,{phone:u}),c}catch(c){return i(c),{success:!1}}}),[a,i,e==null?void 0:e.onSendCodeSuccess]),f=he(l=>S(void 0,[l],function*({code:u,phone:g}){var c;try{if(!o)throw new er({code:"attempted_link_sms_before_logged_in",error:"Must be logged in to link a phone number, Use `useLoginWithSMS` to login with a phone number"});if(!(g||r))throw new er({code:"attempted_submit_otp_before_sending",error:"Must `sendCode` with a valid phone number before calling `linkWithCode`"});n({status:"submitting-code"});let C=yield a.auth.phone.linkWithCode(g||r,u);return n({status:"done"}),(c=e==null?void 0:e.onLinkSuccess)==null||c.call(e,C),C}catch(y){i(y)}}),[o,a,r,i,e==null?void 0:e.onLinkSuccess]);return{sendCode:d,linkWithCode:f,state:s}};import{useCallback as pe,useContext as ut,useState as mt}from"react";import{PrivyClientError as rr}from"@privy-io/js-sdk-core";var tr=e=>{let[r,t]=mt(""),{user:o,client:a,otpState:s,setOtpState:n}=ut(h),i=pe(u=>{var l;let g=w(u);return n({status:"error",error:g}),(l=e==null?void 0:e.onError)==null||l.call(e,g),g},[e==null?void 0:e.onError]),d=pe(g=>S(void 0,[g],function*({phone:u}){var l;t(u);try{n({status:"sending-code"});let c=yield a.auth.phone.sendCode(u);return n({status:"awaiting-code-input"}),(l=e==null?void 0:e.onSendCodeSuccess)==null||l.call(e,{phone:u}),c}catch(c){return i(c),{success:!1}}}),[a,i,e==null?void 0:e.onSendCodeSuccess]),f=pe(c=>S(void 0,[c],function*({code:u,phone:g,disableSignup:l}){var y;try{if(o)throw new rr({code:"attempted_login_with_sms_while_already_logged_in",error:"Already logged in, use `useLinkWithSMS` if you are trying to link a phone number to an existing account"});if(!(g||r))throw new rr({code:"attempted_submit_otp_before_sending",error:"Must `sendCode` with a valid phone number before calling `loginWithCode`"});n({status:"submitting-code"});let p=yield a.auth.phone.loginWithCode(g||r,u,l?"no-signup":"login-or-sign-up");return n({status:"done"}),(y=e==null?void 0:e.onLoginSuccess)==null||y.call(e,p.user,p.is_new_user),p==null?void 0:p.user}catch(C){i(C)}}),[o,a,r,i,e==null?void 0:e.onLoginSuccess]);return{sendCode:d,loginWithCode:f,state:s}};import*as q from"expo-linking";import{useCallback as ye,useContext as dt,useRef as gt}from"react";import{PrivyClientError as G}from"@privy-io/js-sdk-core";var Qi=e=>{let{appState:r,getCurrentAppState:t}=j(),{client:o,user:a,farcasterState:s,setFarcasterState:n}=dt(h),i=gt(!1),d=ye(g=>{var c;let l=w(g);return n({status:"error",error:l}),(c=e==null?void 0:e.onError)==null||c.call(e,l),l},[e==null?void 0:e.onError,n]),f=ye(()=>{i.current=!0},[]);return{linkWithFarcaster:ye((y,...C)=>S(void 0,[y,...C],function*({relyingParty:g,redirectUrl:l},c={pollAttempts:10,pollIntervalMs:1e3}){var p;try{if(i.current=!1,!a)throw new G({code:"attempted_link_farcaster_before_logged_in",error:"Must be logged in to link a Farcaster account."});n({status:"generating-uri"});let{connect_uri:E,channel_token:L}=yield o.auth.farcaster.initializeAuth({relyingParty:g,redirectUrl:q.createURL(l!=null?l:"/")});if(!E)throw new G({code:"failed_to_generate_farcaster_uri",error:"Failed to generate farcaster uri"});if(!L)throw new G({code:"failed_to_generate_farcaster_channel_token",error:"Failed to generate farcaster channel token"});yield q.openURL(E),n({status:"polling-status"});let _=0;for(;_<c.pollAttempts;){if(i.current)throw new G({code:"farcaster_polling_canceled",error:"Farcaster polling canceled"});if(r.current!=="active"&&t()!=="active"){yield I(c.pollIntervalMs);continue}let V=yield o.auth.farcaster.getFarcasterStatus({channel_token:L});if(V.state==="completed"){n({status:"submitting-token"});let H=yield o.auth.farcaster.link(k({channel_token:L},V));return n({status:"done"}),(p=e==null?void 0:e.onSuccess)==null||p.call(e,H),H}_++,yield I(c.pollIntervalMs)}throw new G({code:"farcaster_polling_timeout",error:"Farcasting polling timed out"})}catch(E){throw d(E)}}),[o,e==null?void 0:e.onSuccess,d,n,a]),state:s,cancel:f}};import{useCallback as or,useContext as ft}from"react";var oa=e=>{let{client:r}=ft(h),t=or(a=>{var n;let s=w(a);return(n=e==null?void 0:e.onError)==null||n.call(e,s),s},[e==null?void 0:e.onError]);return{unlinkFarcaster:or(s=>S(void 0,[s],function*({fid:a}){var n;try{let i=yield r.auth.farcaster.unlink({fid:a});return(n=e==null?void 0:e.onSuccess)==null||n.call(e,i),i}catch(i){throw t(i)}}),[r,e==null?void 0:e.onSuccess,t])}};import*as J from"expo-linking";import{useCallback as we,useContext as ht,useRef as pt}from"react";import{PrivyClientError as N}from"@privy-io/js-sdk-core";var ua=e=>{let{appState:r,getCurrentAppState:t}=j(),{client:o,user:a,farcasterState:s,setFarcasterState:n}=ht(h),i=pt(!1),d=we(g=>{var c;let l=w(g);return n({status:"error",error:l}),(c=e==null?void 0:e.onError)==null||c.call(e,l),l},[e==null?void 0:e.onError,n]),f=we(()=>{i.current=!0},[]);return{loginWithFarcaster:we((C,...p)=>S(void 0,[C,...p],function*({relyingParty:g,redirectUrl:l,disableSignup:c},y={pollAttempts:10,pollIntervalMs:1e3}){var E;try{if(i.current=!1,a)throw new N({code:"attempted_login_with_farcaster_while_already_logged_in",error:"Already logged in, use `useLinkWithFarcaster` if you are trying to link farcaster to an existing account"});n({status:"generating-uri"});let{connect_uri:L,channel_token:_}=yield o.auth.farcaster.initializeAuth({relyingParty:g,redirectUrl:J.createURL(l!=null?l:"/")});if(!L)throw new N({code:"failed_to_generate_farcaster_uri",error:"Failed to generate farcaster uri"});if(!_)throw new N({code:"failed_to_generate_farcaster_channel_token",error:"Failed to generate farcaster channel token"});yield J.openURL(L),n({status:"polling-status"});let V=0;for(;V<y.pollAttempts;){if(i.current)throw new N({code:"farcaster_polling_canceled",error:"Farcaster polling canceled"});if(r.current!=="active"&&t()!=="active"){yield I(y.pollIntervalMs);continue}let H=yield o.auth.farcaster.getFarcasterStatus({channel_token:_});if(H.state==="completed"){n({status:"submitting-token"});let le=yield o.auth.farcaster.authenticate(k({channel_token:_,mode:c?"no-signup":"login-or-sign-up"},H));return n({status:"done"}),(E=e==null?void 0:e.onSuccess)==null||E.call(e,le.user,le.is_new_user),le.user}V++,yield I(y.pollIntervalMs)}throw new N({code:"farcaster_polling_timeout",error:"Farcasting polling timed out"})}catch(L){throw d(L)}}),[o,d,e==null?void 0:e.onSuccess,n,a,r]),state:s,cancel:f}};import{useCallback as nr,useContext as yt}from"react";var pa=e=>{let{client:r}=yt(h),t=nr(a=>{var n;let s=w(a);return(n=e==null?void 0:e.onError)==null||n.call(e,s),s},[e==null?void 0:e.onError]);return{unlinkOAuth:nr(n=>S(void 0,[n],function*({provider:a,subject:s}){var i;try{let d=yield r.auth.oauth.unlink(a,s);return(i=e==null?void 0:e.onSuccess)==null||i.call(e,d),d}catch(d){throw t(d)}}),[r,e==null?void 0:e.onSuccess,t])}};import{useContext as St,useEffect as Ct,useRef as wt}from"react";var ka=e=>{let{client:r}=St(h),t=wt(e.onOAuthTokenGrant);t.current=e.onOAuthTokenGrant,Ct(()=>{let{unsubscribe:o}=r.addOAuthTokensListener(a=>{t.current(a)});return o},[r])};import{useEffect as bt}from"react";import{useContext as kt,useEffect as ke}from"react";var be=(e={})=>{let{wallet:r,createWalletCallbacks:t,recoverWalletCallbacks:o,setWalletRecoveryCallbacks:a}=kt(h),{onCreateWalletSuccess:s,onCreateWalletError:n,onRecoverWalletError:i,onRecoverWalletSuccess:d,onSetWalletRecoverySuccess:f,onSetWalletRecoveryError:u}=e;return ke(()=>{t.current={onSuccess:s,onError:n}},[s,n]),ke(()=>{o.current={onSuccess:d,onError:i}},[d,i]),ke(()=>{a.current={onSuccess:f,onError:u}},[d,i]),r};var Fa=({onStateChange:e})=>{let r=be();return bt(()=>{e(r)},[r])};import{useContext as vt}from"react";var Aa=()=>{let{getIdentityToken:e}=vt(h);return{getIdentityToken:e}};import{useCallback as ir,useContext as xt}from"react";import{PrivyClientError as Et}from"@privy-io/js-sdk-core";var Va=e=>{let{user:r,client:t}=xt(h),o=ir(s=>{var i;let n=w(s);return(i=e==null?void 0:e.onError)==null||i.call(e,n),n},[e==null?void 0:e.onError]);return{create:ir(()=>S(void 0,null,function*(){var s;try{if(r)throw new Et({code:"attempted_to_create_guest_account_for_logged_in_user",error:"Already logged in, you cannot create a guest account"});let n=yield t.auth.guest.create();return(s=e==null?void 0:e.onSuccess)==null||s.call(e,n.user,n.is_new_user),n.user}catch(n){throw o(n)}}),[t,o,r,e==null?void 0:e.onSuccess])}};import{useContext as Lt,useEffect as ar}from"react";var Pt=(e={})=>{let{solanaWallet:r,createSolanaWalletCallbacks:t,recoverSolanaWalletCallbacks:o}=Lt(h),{onCreateWalletSuccess:a,onCreateWalletError:s,onRecoverWalletError:n,onRecoverWalletSuccess:i}=e;return ar(()=>{t.current={onSuccess:a,onError:s}},[a,s]),ar(()=>{o.current={onSuccess:i,onError:n}},[i,n]),r};import{useContext as Ft}from"react";var Mt=()=>{let{client:e}=Ft(h);return e};import{useContext as Tt}from"react";var Wt=()=>{let{user:e,isReady:r,logout:t,getAccessToken:o}=Tt(h);return{user:e,isReady:r,logout:t,getAccessToken:o}};import z,{useRef as _n,useState as In}from"react";import Ae,{useContext as Ao,useEffect as br,useMemo as _o,useState as vr}from"react";import M,{useCallback as to,useEffect as oo,useState as pr}from"react";import{View as Fe,StyleSheet as no,KeyboardAvoidingView as io,Platform as ao}from"react-native";import{createErrorFormatter as so}from"@privy-io/js-sdk-core";import Y from"react";import{View as Bt,Text as Vt,Pressable as Ht,StyleSheet as Gt}from"react-native";import ve,{useEffect as At}from"react";import{Animated as xe,Easing as _t,useAnimatedValue as It}from"react-native";import Ut,{Path as Ot}from"react-native-svg";var sr=()=>{let e=It(0);At(()=>{e.setValue(0);let t=xe.loop(xe.timing(e,{toValue:1,duration:1200,useNativeDriver:!0,easing:_t.linear}));return t.start(),()=>t.stop()},[]);let r=e.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return ve.createElement(xe.View,{style:{transform:[{rotate:r}]}},ve.createElement(Ut,{width:20,height:20,viewBox:"0 0 20 20",fill:"none"},ve.createElement(Ot,{d:"M19 10a9 9 0 11-6.219-8.56",stroke:"#fff",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})))};var m={interactive:"#5B4FFF",white:"#FFFFFF",black:"#000000",brand:"#010110",placeholder:"#9498B8",success:"#22C55E",successDark:"#15803D",inputBackground:"#F3F3F3",text:"#040217",icon:"#110F2A",border:"#E2E3F0",error:"#EF4444",errorDark:"#B91C1C",textMuted:"#64668B",textTitle:"#1A1C29"};var v=a=>{var s=a,{variant:e="primary",title:r,loading:t=!1}=s,o=Z(s,["variant","title","loading"]);return Y.createElement(Ht,k({},o),Y.createElement(Bt,{style:[O.buttonBox,e==="secondary"&&O.buttonBoxSecondary,e==="tertiary"&&O.buttonBoxTertiary]},t?Y.createElement(sr,null):Y.createElement(Vt,{style:[O.buttonLabel,e==="secondary"&&O.buttonLabelSecondary,e==="tertiary"&&O.buttonLabelTertiary]},r)))},O=Gt.create({buttonBox:{height:54,justifyContent:"center",alignItems:"center",borderRadius:14,paddingHorizontal:16,backgroundColor:m.interactive},buttonBoxSecondary:{backgroundColor:m.white,alignItems:"flex-start",borderColor:m.border,borderWidth:1,borderRadius:12},buttonBoxTertiary:{backgroundColor:m.white},buttonLabel:{fontFamily:"Inter_600SemiBold",fontSize:16,lineHeight:24,color:m.white},buttonLabelSecondary:{fontFamily:"Inter_400Regular",color:m.text},buttonLabelTertiary:{fontFamily:"Inter_500Medium",color:m.interactive}});import P,{useState as Kt,useRef as zt}from"react";import{View as ur,TextInput as Zt,Pressable as jt,Text as dr,StyleSheet as qt}from"react-native";import lr from"react";import{View as Nt,Text as Dt,StyleSheet as Rt}from"react-native";var cr=({value:e,isFocused:r,isSuccess:t,isError:o})=>lr.createElement(Nt,{style:[D.box,r&&D.focusedBox,t&&D.successBox,o&&D.errorBox]},lr.createElement(Dt,{style:D.text},e)),D=Rt.create({box:{borderWidth:1,borderColor:m.border,borderRadius:12,height:64,width:48,justifyContent:"center",alignItems:"center"},focusedBox:{borderWidth:2,borderColor:m.interactive},successBox:{borderColor:m.success},errorBox:{borderColor:m.error},text:{fontFamily:"Inter_500Medium",fontSize:16,lineHeight:20,color:m.text}});var mr=6,Jt=[0,1,2,"-",3,4,5];function Ee({value:e="",status:r=" ",onChangeText:t=()=>{},editable:o=!0,success:a=!1,error:s=!1,autoFocus:n=!1}){let i=zt(null),[d,f]=Kt(!1),u=()=>{var c;(c=i==null?void 0:i.current)==null||c.focus()},g=c=>{let y=c.replace(/\D/g,"");t(y)},l=d?Math.min(e.length,mr-1):void 0;return P.createElement(ur,{style:W.container},P.createElement(Zt,{autoFocus:n,style:W.invisibleTextInput,value:e,onChangeText:g,maxLength:mr,ref:i,editable:o,onFocus:()=>f(!0),onBlur:()=>f(!1),keyboardType:"numeric"}),P.createElement(jt,{onPress:u,disabled:!o},P.createElement(ur,{style:W.codeContainer},Jt.map((c,y)=>c==="-"?P.createElement(Yt,{key:y}):P.createElement(cr,{key:y,isFocused:l===c,value:e[c]||"",isSuccess:a,isError:s})))),P.createElement(dr,{style:[W.statusText,a&&W.statusSuccess,s&&W.statusError]},r))}var Yt=()=>P.createElement(dr,{style:W.separator},"-"),W=qt.create({container:{justifyContent:"center",paddingHorizontal:0,gap:6},invisibleTextInput:{position:"absolute",opacity:0},codeContainer:{flexDirection:"row",alignItems:"center",gap:10,justifyContent:"space-between"},separator:{fontFamily:"Inter_600SemiBold",fontSize:18,lineHeight:24,color:m.black},statusText:{textAlign:"left",color:m.textMuted,fontFamily:"Inter_400Regular",fontSize:14,lineHeight:22},statusError:{color:m.errorDark},statusSuccess:{color:m.successDark}});import Le from"react";import{StyleSheet as Qt,View as $t,Text as gr}from"react-native";var F=({title:e,subtitle:r})=>Le.createElement($t,{style:Pe.titleContainer},Le.createElement(gr,{style:Pe.title},e),r&&Le.createElement(gr,{style:Pe.subtitle},r)),Pe=Qt.create({titleContainer:{alignItems:"center",gap:16},title:{fontFamily:"Inter_600SemiBold",fontSize:20,lineHeight:32,color:m.textTitle},subtitle:{fontFamily:"Inter_400Regular",fontSize:16,lineHeight:24,color:m.textMuted,textAlign:"center"}});import Q from"react";import{Pressable as Xt,StyleSheet as eo,Text as fr,View as ro}from"react-native";var hr=({hint:e,link:r,onPress:t,disabled:o})=>Q.createElement(ro,{style:$.container},Q.createElement(fr,{style:$.hintText},e),r&&Q.createElement(Xt,{onPress:t,disabled:o},Q.createElement(fr,{style:[$.linkText,o&&$.disabledLink]}," ",r))),$=eo.create({container:{display:"flex",flexDirection:"row",gap:2},hintText:{fontFamily:"Inter_400Regular",fontSize:14,lineHeight:22,color:m.textMuted},linkText:{fontFamily:"Inter_500Medium",fontSize:14,lineHeight:22,color:m.interactive},disabledLink:{color:m.textMuted}});var lo=3e4,co=()=>{let[e,r]=pr(!1),t=to(()=>{r(!1),setTimeout(()=>{r(!0)},lo)},[]);return oo(()=>{t()},[]),[e,t]},X=({loginWithCode:e,requestNewCode:r,subtitle:t,isLoading:o,error:a,isDone:s})=>{let[n,i]=pr(""),d=l=>{i(l),l.length===6&&e(l)},[f,u]=co(),g=()=>{r(),u()};return M.createElement(io,{behavior:ao.OS==="ios"?"padding":void 0,style:Me.innerContainer},M.createElement(Fe,{style:{flex:1,justifyContent:"space-between",paddingHorizontal:16,paddingBottom:16}},M.createElement(Fe,{style:Me.content},M.createElement(Fe,{style:Me.formContainer},M.createElement(F,{title:"Enter confirmation code",subtitle:t}),M.createElement(Ee,{value:n,editable:!o,onChangeText:d,success:s,error:!!a,status:s?"Success.":a?uo(a):" ",autoFocus:!0}),M.createElement(hr,{hint:"Didn\u2019t get an email?",link:"Resend code",onPress:g,disabled:!f}))),M.createElement(v,{title:"Continue",loading:o,onPress:()=>e(n)})))},uo=so({invalid_credentials:"Invalid code.",invalid_data:"The code has expired.",too_many_requests:"Too many requests. Please try again later.",default:"Something went wrong. Please try again."}),Me=no.create({modalContent:{backgroundColor:"#ffffff"},innerContainer:{flex:1},content:{gap:16},formContainer:{rowGap:24}});import x,{useState as Eo}from"react";import{View as te,StyleSheet as Lo,KeyboardAvoidingView as Po,Platform as Fo}from"react-native";import{createErrorFormatter as Mo}from"@privy-io/js-sdk-core";import Sr from"react";import{StyleSheet as ho,View as po}from"react-native";import*as Te from"react";import mo,{Path as go}from"react-native-svg";var fo=e=>Te.createElement(mo,k({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 460 40"},e),Te.createElement(go,{fill:e.color,d:"M0 15.4v15.38h4.64V19.96h3.58c2.47 0 3.63-.01 3.77-.02 1-.08 1.49-.15 2.18-.3a9.45 9.45 0 0 0 4.6-2.37c1.66-1.57 2.64-3.87 2.81-6.56.02-.3.02-1.19 0-1.49-.1-1.77-.56-3.35-1.36-4.72A8.84 8.84 0 0 0 15.14.57c-.93-.3-1.75-.43-3.09-.54C11.9.02 10.2 0 5.93 0H0ZM10.85 4c1.85.05 3.1.45 4.16 1.3.22.17.54.49.69.68a5.97 5.97 0 0 1 1.19 3.13c.04.35.04 1.36 0 1.71-.08.68-.23 1.3-.44 1.85a4.8 4.8 0 0 1-1.09 1.68A5.63 5.63 0 0 1 12 15.92c-.6.08-.4.08-4.01.09H4.64V3.98h2.9c1.6 0 3.08 0 3.31.02m176.8 1.71v5.72h-.27l-.09-.14a16 16 0 0 0-1.21-1.73c-.43-.5-1-.95-1.7-1.36-.54-.3-1.05-.5-1.73-.63a9 9 0 0 0-1.7-.17 8.84 8.84 0 0 0-7.8 4.03 12.95 12.95 0 0 0-2.03 6.39c-.07.98-.06 2.15.02 3.13.2 2.47.87 4.53 2.02 6.25a8.98 8.98 0 0 0 10.22 3.65 6.5 6.5 0 0 0 2.8-1.93c.41-.51.84-1.1 1.1-1.55l.1-.17h.37v3.58h4.38V0h-4.48Zm-5.24 5.54c1.3.14 2.3.6 3.17 1.48.9.9 1.5 2.09 1.85 3.64.36 1.6.39 3.72.06 5.43a8.1 8.1 0 0 1-1.54 3.62 5.1 5.1 0 0 1-3.93 1.96 6.1 6.1 0 0 1-2.32-.31 5.87 5.87 0 0 1-3.33-3.5c-.39-1-.62-2.05-.72-3.32-.03-.32-.04-1.35-.02-1.73q.12-2.34.96-4.05a6.2 6.2 0 0 1 1.06-1.58 5.08 5.08 0 0 1 3.6-1.66c.25-.02.9 0 1.16.02m27.66 4.14.01 15.38h4.38l.01-3.57h.37l.09.15c.24.44.84 1.26 1.21 1.7a6.8 6.8 0 0 0 2.57 1.75 9.3 9.3 0 0 0 6.86-.49 9.28 9.28 0 0 0 4.05-4.07A13 13 0 0 0 231 21.6c.21-1.73.18-3.7-.09-5.32a13 13 0 0 0-1.5-4.3 9.1 9.1 0 0 0-3.75-3.63 9.15 9.15 0 0 0-4.43-.96 7.5 7.5 0 0 0-2.8.5A7.1 7.1 0 0 0 216 9.7c-.4.52-.82 1.12-1.1 1.59l-.07.14h-.27V0h-4.5Zm11.13-4.14c1.07.1 1.94.44 2.7 1.04a6.1 6.1 0 0 1 1.64 1.98c.43.84.78 2 .94 3.11.15 1.16.16 2.4.02 3.54a9.34 9.34 0 0 1-1.39 4.03 5.33 5.33 0 0 1-2.69 2.15c-.9.3-2.04.38-3.06.2a5.14 5.14 0 0 1-3.45-2.37 6 6 0 0 1-.45-.8c-.5-1.03-.8-2.2-.92-3.58-.04-.49-.06-.89-.05-1.53.01-.76.05-1.23.13-1.85.38-2.53 1.47-4.38 3.15-5.31a5.5 5.5 0 0 1 2.3-.63 10 10 0 0 1 1.13.02M69.05 2.17l-.01 2.77V7.7h-3.36v3.6h3.36v6.8l.01 7.15c.06 1.4.4 2.44 1.1 3.37a5.8 5.8 0 0 0 2.97 2.07c.91.3 1.83.42 2.9.38a8.7 8.7 0 0 0 2.66-.48l-.8-3.7-.38.06a4.96 4.96 0 0 1-2.43-.06c-.33-.1-.56-.25-.8-.49-.4-.41-.6-.88-.7-1.67-.02-.2-.02-.62-.03-6.82v-6.6h4.73V7.7h-4.73V2.16h-4.49Zm64.29 0V7.7h-3.39v3.6h3.38v6.9l.01 7.17a5.66 5.66 0 0 0 2.36 4.49c.85.6 2.03 1.03 3.26 1.17.85.1 2.03.05 2.81-.1.3-.06.75-.18 1-.26l.2-.06v-.05l-.81-3.67-.37.06a5 5 0 0 1-1.8.09c-.85-.13-1.32-.4-1.7-.97a2.6 2.6 0 0 1-.39-1.04c-.06-.4-.06 0-.06-7.1V11.3h4.7V7.7h-4.7l-.01-2.77V2.16h-4.49Zm160.07.19a14.56 14.56 0 0 0-13.7 16.07 14.59 14.59 0 0 0 21.86 11.08 14.5 14.5 0 0 0 7.11-14.07 14.61 14.61 0 0 0-6.53-10.73 14.5 14.5 0 0 0-8.74-2.35m57.39 0a10.17 10.17 0 0 0-7.56 4.2c-.16.2-.45.63-.58.83l-.05.1h-.47l-.01-4.36h-7.36v36.4h7.82V27.27h.49l.05.07a11.3 11.3 0 0 0 7.49 4.15 10.52 10.52 0 0 0 9.38-4.1c1.66-2.1 2.73-4.9 3.07-8.06.1-.87.13-1.4.13-2.37 0-.8 0-1.1-.07-1.76a15.95 15.95 0 0 0-3.23-8.72 12.8 12.8 0 0 0-1.85-1.84 10.5 10.5 0 0 0-7.26-2.28Zm-.94 6.05c1.27.15 2.33.65 3.2 1.5.98.96 1.67 2.31 2.03 4 .34 1.57.38 3.68.12 5.39a9.8 9.8 0 0 1-1.04 3.25c-.14.25-.44.69-.6.89a5.35 5.35 0 0 1-4.31 2.07 5.25 5.25 0 0 1-4.41-1.9 7.4 7.4 0 0 1-1.26-2.32 14.1 14.1 0 0 1-.62-4.83c.05-1.98.38-3.53 1.02-4.85a5.63 5.63 0 0 1 2.5-2.65c.66-.34 1.3-.5 2.14-.58.18-.02 1.04 0 1.23.03m13.77-5.31-.01 3.2v3.16h1.43c1.26.01 1.44.02 1.54.04.42.09.66.28.79.62.08.23.08.08.08 2.96a912 912 0 0 1 .03 10.18v7.54h7.82v-7.4l.01-7.83c.03-.94.11-1.63.27-2.28.46-1.9 1.54-2.93 3.35-3.23.52-.08.2-.08 5-.08h4.4v-6.9h-3.1c-3.48 0-3.91.01-4.67.1-1.83.2-3.04.79-3.96 1.88-.5.6-.9 1.32-1.26 2.26l-.06.17h-.46v-4.4h-5.6c-4.46 0-5.6 0-5.6.02Zm27.17 13.85V30.8h3.87l3.86-.01V3.09h-7.73Zm9.8-13.85-.01.4v.38l4.66 13.4 4.69 13.47.02.05h10.3l.03-.05 4.67-13.45 4.67-13.4v-.8h-7.43l-6.7 19.26h-.5l-3.28-9.5-3.31-9.64-.05-.12h-3.88l-3.88.01Zm30.38 0c-.01 0-.02.19-.02.4v.39l5.08 14.59c2.8 8.02 5.08 14.6 5.08 14.61.01.02-.22.02-4.8.02h-4.82v6.42h4.95c5.09 0 5.23 0 5.87-.06 3.15-.28 5.29-1.63 6.63-4.15.28-.55.44-.95.87-2.16L459 6.78l1-2.89v-.8h-7.43l-6.69 19.26h-.5l-3.27-9.46-3.31-9.64-.06-.16h-3.88zM36.57 7.36c-1.36.1-2.6.6-3.62 1.45a5.65 5.65 0 0 0-1.67 2.42l-.05.13H31V7.7h-4.35v23.08h4.5v-7.3c0-8 0-7.34.08-7.82a4.9 4.9 0 0 1 2.06-3.18c.83-.58 1.74-.89 2.87-.98a12 12 0 0 1 2.8.25H39v-4.3l-.21-.02c-.61-.07-1.74-.1-2.22-.07m14.51.05c-2.33.12-4.3.84-5.95 2.16a9.9 9.9 0 0 0-2.03 2.2 12.5 12.5 0 0 0-2 5.78 18 18 0 0 0 0 3.65 12.13 12.13 0 0 0 2.26 6.05 9.74 9.74 0 0 0 5 3.52c2.11.64 4.7.64 6.8 0a9.8 9.8 0 0 0 4.88-3.37c1.38-1.78 2.19-4 2.4-6.58.13-1.46.06-3.06-.18-4.42a11.24 11.24 0 0 0-3.58-6.6 10 10 0 0 0-5.75-2.35c-.56-.06-1.31-.07-1.85-.04m1.42 3.78c.88.1 1.62.34 2.28.75a6.1 6.1 0 0 1 1.99 2.15 10.3 10.3 0 0 1 1.2 5c.02 1.23-.12 2.44-.42 3.51a7.14 7.14 0 0 1-1.81 3.32c-.61.6-1.2.98-1.95 1.24a6 6 0 0 1-2 .3 5.7 5.7 0 0 1-2.72-.6 5 5 0 0 1-1.28-.94A7.1 7.1 0 0 1 46 22.73c-.57-1.99-.6-4.46-.08-6.5a7.24 7.24 0 0 1 2.03-3.67 5.13 5.13 0 0 1 3.35-1.4 11 11 0 0 1 1.2.03M92.05 7.4c-.96.06-1.56.15-2.3.33a9.62 9.62 0 0 0-6.09 4.66 13.5 13.5 0 0 0-1.71 7c0 .83 0 1.04.06 1.6.16 1.77.58 3.32 1.29 4.7A9.72 9.72 0 0 0 90.28 31c1.84.37 4.08.32 5.85-.13a9.07 9.07 0 0 0 5.02-3.1A7.6 7.6 0 0 0 102.5 25l-2.11-.39-2.11-.38-.08.13a4.72 4.72 0 0 1-2.35 2.55 6.3 6.3 0 0 1-2.23.58c-.29.03-1.13.03-1.44 0a6.35 6.35 0 0 1-3.02-1.04 5.93 5.93 0 0 1-2.02-2.43 8.4 8.4 0 0 1-.72-3.18v-.26h16.38v-.81c0-1.83-.06-2.76-.25-3.87-.2-1.22-.53-2.24-1.05-3.28a8.9 8.9 0 0 0-2.66-3.26 10.1 10.1 0 0 0-5.34-1.94 18 18 0 0 0-1.46-.03Zm1.3 3.75c1.2.13 2.19.55 3.05 1.3a5.8 5.8 0 0 1 1.78 2.96c.13.51.21 1.17.21 1.66v.15H86.43v-.12c.08-.97.3-1.78.72-2.61.5-1 1.2-1.8 2.14-2.42a5.3 5.3 0 0 1 2.9-.95c.2-.01.97 0 1.17.03Zm23.44-3.74c-2 .1-3.73.65-5.22 1.65a10.7 10.7 0 0 0-4.25 6.06 16.1 16.1 0 0 0-.5 5.8c.2 2.17.84 4.13 1.88 5.76.58.9 1.32 1.73 2.15 2.4a9.4 9.4 0 0 0 3.6 1.8 12 12 0 0 0 3.92.34 10.2 10.2 0 0 0 3.84-.95 8.31 8.31 0 0 0 4.76-6.75l.01-.04h-4.37l-.05.16a4.87 4.87 0 0 1-4.24 3.75c-.59.07-1.32.06-1.93-.05a5.47 5.47 0 0 1-3.5-2.27c-.56-.75-1-1.73-1.26-2.79a13.8 13.8 0 0 1-.16-5.24 7.77 7.77 0 0 1 2.1-4.3 5.5 5.5 0 0 1 2.15-1.3 6.4 6.4 0 0 1 3.89.1c.59.21 1.03.5 1.5.96a5.3 5.3 0 0 1 1.46 2.5l.04.15h4.37v-.06a8.22 8.22 0 0 0-5.31-6.94 11 11 0 0 0-4.88-.74m39.41 0a9.87 9.87 0 0 0-6 2.29 11 11 0 0 0-3.41 5.43c-.52 1.78-.68 3.9-.48 5.97.17 1.8.63 3.38 1.37 4.8a9.68 9.68 0 0 0 5.91 4.86c1.65.48 3.63.61 5.53.36 3.72-.49 6.55-2.62 7.56-5.69.12-.39.13-.42.1-.43-.02 0-4.13-.75-4.19-.75-.03 0-.04 0-.1.16-.18.42-.45.9-.72 1.22-.16.2-.49.53-.7.7-.67.54-1.5.9-2.43 1.08-.48.08-.83.11-1.41.11-.64 0-1.07-.04-1.6-.15a5.76 5.76 0 0 1-3.93-2.83 8 8 0 0 1-.99-3.79v-.16h16.38v-1.11l-.02-1.43c-.1-2.25-.53-4-1.35-5.59a9.24 9.24 0 0 0-6.18-4.75c-1.04-.26-2.2-.36-3.33-.3Zm1.45 3.74a5.35 5.35 0 0 1 3.66 1.94 6.1 6.1 0 0 1 1.38 4.01v.12h-11.97v-.06c0-.02 0-.14.02-.25a6.6 6.6 0 0 1 2.15-4.32 5.73 5.73 0 0 1 3.5-1.46c.25-.02 1 0 1.26.02m75.93-3.33 8.37 23.22a49 49 0 0 1-.67 1.9 5.4 5.4 0 0 1-1.14 1.8c-.41.4-.82.58-1.48.69-.27.04-1.03.03-1.35 0a8 8 0 0 1-1.1-.23l-1.08 3.67c0 .02.32.14.66.22.83.21 1.57.29 2.56.28.56-.01.8-.03 1.24-.1 2.71-.4 4.66-2.09 5.86-5.08l9.64-26.44c0-.02-4.82-.06-4.83-.05l-2.93 8.96-2.91 8.94h-.24l-.22-.65-2.91-8.95-2.7-8.3h-4.82Zm59.47 27.98c-1.18.04-1.93.09-2.8.16-2.52.24-4.53.69-5.43 1.23-.7.41-.76.86-.2 1.28.88.66 3.29 1.19 6.36 1.4a49 49 0 0 0 5.75.05c3.47-.19 6.24-.78 7.11-1.5.22-.19.3-.34.3-.53 0-.1 0-.12-.04-.22-.35-.69-2.32-1.3-5.25-1.63a41 41 0 0 0-5.8-.24m0 0"})),yr=fo;var ee=()=>Sr.createElement(po,{style:yo.legalFooterContainer},Sr.createElement(yr,{color:m.brand,width:"100%",height:11})),yo=ho.create({legalFooterContainer:{flexDirection:"row",alignItems:"center",marginVertical:16,justifyContent:"center",gap:2}});import re,{useState as So}from"react";import{View as Cr,TextInput as Co,StyleSheet as wo,Text as ko}from"react-native";var B=a=>{var s=a,{error:e,status:r,LeftIcon:t}=s,o=Z(s,["error","status","LeftIcon"]);let[n,i]=So(!1);return re.createElement(Cr,{style:A.container},re.createElement(Cr,{style:[A.inputBox,n&&A.inputBoxFocused,e&&A.inputBoxError]},t,re.createElement(Co,k({cursorColor:m.interactive,placeholderTextColor:m.placeholder,onFocus:()=>i(!0),onBlur:()=>i(!1),autoCapitalize:"none",returnKeyType:"next",multiline:!1,numberOfLines:1,style:A.input},o))),r&&re.createElement(ko,{style:[A.statusText,e&&A.statusError]},r))},A=wo.create({container:{gap:6},input:{flex:1,fontFamily:"Inter_400Regular",fontSize:18,height:30,color:m.text},inputBox:{flexDirection:"row",paddingHorizontal:16,height:64,backgroundColor:m.inputBackground,borderRadius:14,alignItems:"center",columnGap:10,borderWidth:2,borderColor:m.border},inputBoxFocused:{borderColor:m.interactive},inputBoxError:{borderColor:m.error},statusText:{textAlign:"left",color:m.textMuted,fontFamily:"Inter_400Regular",fontSize:14,lineHeight:22},statusError:{color:m.errorDark}});import*as We from"react";import bo,{Path as vo}from"react-native-svg";var xo=e=>We.createElement(bo,k({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),We.createElement(vo,{stroke:e.color,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7m2-3h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2"})),wr=xo;var kr=({sendCode:e,isLoading:r,error:t,initialEmail:o,FooterComponent:a})=>{let[s,n]=Eo(o!=null?o:"");return x.createElement(Po,{behavior:Fo.OS==="ios"?"padding":void 0,style:oe.innerContainer},x.createElement(te,{style:{flex:1,justifyContent:"space-between",paddingHorizontal:16,paddingBottom:16}},x.createElement(te,{style:oe.content},x.createElement(te,{style:oe.content},x.createElement(te,{style:oe.formContainer},x.createElement(F,{title:"Enter your email"}),x.createElement(B,{LeftIcon:x.createElement(wr,{color:m.icon}),value:s,onChangeText:n,error:!!t,status:t?To(t):" ",placeholder:"your@email.com",autoComplete:"email",keyboardType:"email-address",autoFocus:!0})),a),x.createElement(ee,null)),x.createElement(v,{title:"Continue",loading:r,onPress:()=>e(s)})))},To=Mo({invalid_data:"Invalid email address.",too_many_requests:"Too many requests. Please try again later.",default:"Something went wrong. Please try again."}),oe=Lo.create({innerContainer:{flex:1},content:{gap:4},formContainer:{rowGap:24}});import Wo from"react";var ne=({onLoginMethodChange:e,otherLoginMethod:r})=>r?Wo.createElement(v,{variant:"tertiary",title:`Use ${ze[r]} instead`,onPress:()=>e(r)}):null;var Io=600,xr=({goBackRef:e,onLoginMethodChange:r,otherLoginMethod:t})=>{let{setOtpState:o}=Ao(h),a=U(),[s,n]=vr(""),{state:i,loginWithCode:d,sendCode:f}=Xe(),[u,g]=vr("email"),{step:l,error:c=null,isLoading:y=!1,isDone:C=!1}=_o(()=>{var p;switch(i.status){case"initial":return{step:{type:"email"}};case"sending-code":return{step:{type:u},isLoading:!0};case"awaiting-code-input":return{step:{type:"code"}};case"submitting-code":return{step:{type:"code"},isLoading:!0};case"done":return{step:{type:"code"},isDone:!0};case"error":return{step:{type:u},error:(p=i.error)!=null?p:new Error("Unknown error")}}},[u,i.status]);switch(u!==l.type&&g(l.type),br(()=>{if(!C)return;let p=setTimeout(()=>{a()},Io);return()=>clearTimeout(p)},[C,a]),br(()=>{if(l.type==="code")return e.current=()=>{o({status:"initial"})},()=>{e.current=null}},[l.type,o]),l.type){case"code":return Ae.createElement(X,{loginWithCode:p=>d({code:p,email:s}),requestNewCode:()=>f({email:s}),subtitle:`Please check ${s} for a message with your login code.`,isLoading:y,error:c,isDone:C});case"email":return Ae.createElement(kr,{initialEmail:s,sendCode:p=>{n(p),f({email:p})},isLoading:y,error:c,FooterComponent:Ae.createElement(ne,{onLoginMethodChange:r,otherLoginMethod:t})})}};import Ve,{useContext as Cn,useEffect as Vr,useMemo as wn,useState as Hr}from"react";import b,{useState as Be}from"react";import{View as ae,StyleSheet as dn,KeyboardAvoidingView as gn,Platform as fn}from"react-native";import{getPlaceholderPhoneNumber as hn,phoneNumberTypingFormatter as pn,createErrorFormatter as yn}from"@privy-io/js-sdk-core";import T,{useMemo as Jo,useState as Yo}from"react";import{View as Qo,StyleSheet as $o,KeyboardAvoidingView as Xo,Platform as en,FlatList as rn}from"react-native";import{useState as Uo,useEffect as Oo}from"react";function Er(e,r){let[t,o]=Uo(e);return Oo(()=>{let a=setTimeout(()=>{o(e)},r);return()=>{clearTimeout(a)}},[e,r]),t}import{getCountryCallingCode as Vo}from"@privy-io/js-sdk-core";var Lr=[["Afghanistan","AF","\u{1F1E6}\u{1F1EB}"],["Albania","AL","\u{1F1E6}\u{1F1F1}"],["Algeria","DZ","\u{1F1E9}\u{1F1FF}"],["American Samoa","AS","\u{1F1E6}\u{1F1F8}"],["Andorra","AD","\u{1F1E6}\u{1F1E9}"],["Angola","AO","\u{1F1E6}\u{1F1F4}"],["Anguilla","AI","\u{1F1E6}\u{1F1EE}"],["Antigua & Barbuda","AG","\u{1F1E6}\u{1F1EC}"],["Argentina","AR","\u{1F1E6}\u{1F1F7}"],["Armenia","AM","\u{1F1E6}\u{1F1F2}"],["Aruba","AW","\u{1F1E6}\u{1F1FC}"],["Ascension Island","AC","\u{1F1E6}\u{1F1E8}"],["Australia","AU","\u{1F1E6}\u{1F1FA}"],["Austria","AT","\u{1F1E6}\u{1F1F9}"],["Azerbaijan","AZ","\u{1F1E6}\u{1F1FF}"],["Bahamas","BS","\u{1F1E7}\u{1F1F8}"],["Bahrain","BH","\u{1F1E7}\u{1F1ED}"],["Bangladesh","BD","\u{1F1E7}\u{1F1E9}"],["Barbados","BB","\u{1F1E7}\u{1F1E7}"],["Belarus","BY","\u{1F1E7}\u{1F1FE}"],["Belgium","BE","\u{1F1E7}\u{1F1EA}"],["Belize","BZ","\u{1F1E7}\u{1F1FF}"],["Benin","BJ","\u{1F1E7}\u{1F1EF}"],["Bermuda","BM","\u{1F1E7}\u{1F1F2}"],["Bhutan","BT","\u{1F1E7}\u{1F1F9}"],["Bolivia","BO","\u{1F1E7}\u{1F1F4}"],["Bosnia & Herzegovina","BA","\u{1F1E7}\u{1F1E6}"],["Botswana","BW","\u{1F1E7}\u{1F1FC}"],["Brazil","BR","\u{1F1E7}\u{1F1F7}"],["British Indian Ocean Territory","IO","\u{1F1EE}\u{1F1F4}"],["British Virgin Islands","VG","\u{1F1FB}\u{1F1EC}"],["Brunei","BN","\u{1F1E7}\u{1F1F3}"],["Bulgaria","BG","\u{1F1E7}\u{1F1EC}"],["Burkina Faso","BF","\u{1F1E7}\u{1F1EB}"],["Burundi","BI","\u{1F1E7}\u{1F1EE}"],["Cambodia","KH","\u{1F1F0}\u{1F1ED}"],["Cameroon","CM","\u{1F1E8}\u{1F1F2}"],["Canada","CA","\u{1F1E8}\u{1F1E6}"],["Cape Verde","CV","\u{1F1E8}\u{1F1FB}"],["Caribbean Netherlands","BQ","\u{1F1E7}\u{1F1F6}"],["Cayman Islands","KY","\u{1F1F0}\u{1F1FE}"],["Central African Republic","CF","\u{1F1E8}\u{1F1EB}"],["Chad","TD","\u{1F1F9}\u{1F1E9}"],["Chile","CL","\u{1F1E8}\u{1F1F1}"],["China","CN","\u{1F1E8}\u{1F1F3}"],["Christmas Island","CX","\u{1F1E8}\u{1F1FD}"],["Cocos (Keeling) Islands","CC","\u{1F1E8}\u{1F1E8}"],["Colombia","CO","\u{1F1E8}\u{1F1F4}"],["Comoros","KM","\u{1F1F0}\u{1F1F2}"],["Congo - Brazzaville","CG","\u{1F1E8}\u{1F1EC}"],["Congo - Kinshasa","CD","\u{1F1E8}\u{1F1E9}"],["Cook Islands","CK","\u{1F1E8}\u{1F1F0}"],["Costa Rica","CR","\u{1F1E8}\u{1F1F7}"],["Croatia","HR","\u{1F1ED}\u{1F1F7}"],["Cuba","CU","\u{1F1E8}\u{1F1FA}"],["Cura\xE7ao","CW","\u{1F1E8}\u{1F1FC}"],["Cyprus","CY","\u{1F1E8}\u{1F1FE}"],["Czechia","CZ","\u{1F1E8}\u{1F1FF}"],["C\xF4te d\u2019Ivoire","CI","\u{1F1E8}\u{1F1EE}"],["Denmark","DK","\u{1F1E9}\u{1F1F0}"],["Djibouti","DJ","\u{1F1E9}\u{1F1EF}"],["Dominica","DM","\u{1F1E9}\u{1F1F2}"],["Dominican Republic","DO","\u{1F1E9}\u{1F1F4}"],["Ecuador","EC","\u{1F1EA}\u{1F1E8}"],["Egypt","EG","\u{1F1EA}\u{1F1EC}"],["El Salvador","SV","\u{1F1F8}\u{1F1FB}"],["Equatorial Guinea","GQ","\u{1F1EC}\u{1F1F6}"],["Eritrea","ER","\u{1F1EA}\u{1F1F7}"],["Estonia","EE","\u{1F1EA}\u{1F1EA}"],["Eswatini","SZ","\u{1F1F8}\u{1F1FF}"],["Ethiopia","ET","\u{1F1EA}\u{1F1F9}"],["Falkland Islands","FK","\u{1F1EB}\u{1F1F0}"],["Faroe Islands","FO","\u{1F1EB}\u{1F1F4}"],["Fiji","FJ","\u{1F1EB}\u{1F1EF}"],["Finland","FI","\u{1F1EB}\u{1F1EE}"],["France","FR","\u{1F1EB}\u{1F1F7}"],["French Guiana","GF","\u{1F1EC}\u{1F1EB}"],["French Polynesia","PF","\u{1F1F5}\u{1F1EB}"],["Gabon","GA","\u{1F1EC}\u{1F1E6}"],["Gambia","GM","\u{1F1EC}\u{1F1F2}"],["Georgia","GE","\u{1F1EC}\u{1F1EA}"],["Germany","DE","\u{1F1E9}\u{1F1EA}"],["Ghana","GH","\u{1F1EC}\u{1F1ED}"],["Gibraltar","GI","\u{1F1EC}\u{1F1EE}"],["Greece","GR","\u{1F1EC}\u{1F1F7}"],["Greenland","GL","\u{1F1EC}\u{1F1F1}"],["Grenada","GD","\u{1F1EC}\u{1F1E9}"],["Guadeloupe","GP","\u{1F1EC}\u{1F1F5}"],["Guam","GU","\u{1F1EC}\u{1F1FA}"],["Guatemala","GT","\u{1F1EC}\u{1F1F9}"],["Guernsey","GG","\u{1F1EC}\u{1F1EC}"],["Guinea","GN","\u{1F1EC}\u{1F1F3}"],["Guinea-Bissau","GW","\u{1F1EC}\u{1F1FC}"],["Guyana","GY","\u{1F1EC}\u{1F1FE}"],["Haiti","HT","\u{1F1ED}\u{1F1F9}"],["Honduras","HN","\u{1F1ED}\u{1F1F3}"],["Hong Kong SAR China","HK","\u{1F1ED}\u{1F1F0}"],["Hungary","HU","\u{1F1ED}\u{1F1FA}"],["Iceland","IS","\u{1F1EE}\u{1F1F8}"],["India","IN","\u{1F1EE}\u{1F1F3}"],["Indonesia","ID","\u{1F1EE}\u{1F1E9}"],["Iran","IR","\u{1F1EE}\u{1F1F7}"],["Iraq","IQ","\u{1F1EE}\u{1F1F6}"],["Ireland","IE","\u{1F1EE}\u{1F1EA}"],["Isle of Man","IM","\u{1F1EE}\u{1F1F2}"],["Israel","IL","\u{1F1EE}\u{1F1F1}"],["Italy","IT","\u{1F1EE}\u{1F1F9}"],["Jamaica","JM","\u{1F1EF}\u{1F1F2}"],["Japan","JP","\u{1F1EF}\u{1F1F5}"],["Jersey","JE","\u{1F1EF}\u{1F1EA}"],["Jordan","JO","\u{1F1EF}\u{1F1F4}"],["Kazakhstan","KZ","\u{1F1F0}\u{1F1FF}"],["Kenya","KE","\u{1F1F0}\u{1F1EA}"],["Kiribati","KI","\u{1F1F0}\u{1F1EE}"],["Kosovo","XK","\u{1F1FD}\u{1F1F0}"],["Kuwait","KW","\u{1F1F0}\u{1F1FC}"],["Kyrgyzstan","KG","\u{1F1F0}\u{1F1EC}"],["Laos","LA","\u{1F1F1}\u{1F1E6}"],["Latvia","LV","\u{1F1F1}\u{1F1FB}"],["Lebanon","LB","\u{1F1F1}\u{1F1E7}"],["Lesotho","LS","\u{1F1F1}\u{1F1F8}"],["Liberia","LR","\u{1F1F1}\u{1F1F7}"],["Libya","LY","\u{1F1F1}\u{1F1FE}"],["Liechtenstein","LI","\u{1F1F1}\u{1F1EE}"],["Lithuania","LT","\u{1F1F1}\u{1F1F9}"],["Luxembourg","LU","\u{1F1F1}\u{1F1FA}"],["Macao SAR China","MO","\u{1F1F2}\u{1F1F4}"],["Madagascar","MG","\u{1F1F2}\u{1F1EC}"],["Malawi","MW","\u{1F1F2}\u{1F1FC}"],["Malaysia","MY","\u{1F1F2}\u{1F1FE}"],["Maldives","MV","\u{1F1F2}\u{1F1FB}"],["Mali","ML","\u{1F1F2}\u{1F1F1}"],["Malta","MT","\u{1F1F2}\u{1F1F9}"],["Marshall Islands","MH","\u{1F1F2}\u{1F1ED}"],["Martinique","MQ","\u{1F1F2}\u{1F1F6}"],["Mauritania","MR","\u{1F1F2}\u{1F1F7}"],["Mauritius","MU","\u{1F1F2}\u{1F1FA}"],["Mayotte","YT","\u{1F1FE}\u{1F1F9}"],["Mexico","MX","\u{1F1F2}\u{1F1FD}"],["Micronesia","FM","\u{1F1EB}\u{1F1F2}"],["Moldova","MD","\u{1F1F2}\u{1F1E9}"],["Monaco","MC","\u{1F1F2}\u{1F1E8}"],["Mongolia","MN","\u{1F1F2}\u{1F1F3}"],["Montenegro","ME","\u{1F1F2}\u{1F1EA}"],["Montserrat","MS","\u{1F1F2}\u{1F1F8}"],["Morocco","MA","\u{1F1F2}\u{1F1E6}"],["Mozambique","MZ","\u{1F1F2}\u{1F1FF}"],["Myanmar (Burma)","MM","\u{1F1F2}\u{1F1F2}"],["Namibia","NA","\u{1F1F3}\u{1F1E6}"],["Nauru","NR","\u{1F1F3}\u{1F1F7}"],["Nepal","NP","\u{1F1F3}\u{1F1F5}"],["Netherlands","NL","\u{1F1F3}\u{1F1F1}"],["New Caledonia","NC","\u{1F1F3}\u{1F1E8}"],["New Zealand","NZ","\u{1F1F3}\u{1F1FF}"],["Nicaragua","NI","\u{1F1F3}\u{1F1EE}"],["Niger","NE","\u{1F1F3}\u{1F1EA}"],["Nigeria","NG","\u{1F1F3}\u{1F1EC}"],["Niue","NU","\u{1F1F3}\u{1F1FA}"],["Norfolk Island","NF","\u{1F1F3}\u{1F1EB}"],["North Korea","KP","\u{1F1F0}\u{1F1F5}"],["North Macedonia","MK","\u{1F1F2}\u{1F1F0}"],["Northern Mariana Islands","MP","\u{1F1F2}\u{1F1F5}"],["Norway","NO","\u{1F1F3}\u{1F1F4}"],["Oman","OM","\u{1F1F4}\u{1F1F2}"],["Pakistan","PK","\u{1F1F5}\u{1F1F0}"],["Palau","PW","\u{1F1F5}\u{1F1FC}"],["Palestinian Territories","PS","\u{1F1F5}\u{1F1F8}"],["Panama","PA","\u{1F1F5}\u{1F1E6}"],["Papua New Guinea","PG","\u{1F1F5}\u{1F1EC}"],["Paraguay","PY","\u{1F1F5}\u{1F1FE}"],["Peru","PE","\u{1F1F5}\u{1F1EA}"],["Philippines","PH","\u{1F1F5}\u{1F1ED}"],["Poland","PL","\u{1F1F5}\u{1F1F1}"],["Portugal","PT","\u{1F1F5}\u{1F1F9}"],["Puerto Rico","PR","\u{1F1F5}\u{1F1F7}"],["Qatar","QA","\u{1F1F6}\u{1F1E6}"],["Romania","RO","\u{1F1F7}\u{1F1F4}"],["Russia","RU","\u{1F1F7}\u{1F1FA}"],["Rwanda","RW","\u{1F1F7}\u{1F1FC}"],["R\xE9union","RE","\u{1F1F7}\u{1F1EA}"],["Samoa","WS","\u{1F1FC}\u{1F1F8}"],["San Marino","SM","\u{1F1F8}\u{1F1F2}"],["Saudi Arabia","SA","\u{1F1F8}\u{1F1E6}"],["Senegal","SN","\u{1F1F8}\u{1F1F3}"],["Serbia","RS","\u{1F1F7}\u{1F1F8}"],["Seychelles","SC","\u{1F1F8}\u{1F1E8}"],["Sierra Leone","SL","\u{1F1F8}\u{1F1F1}"],["Singapore","SG","\u{1F1F8}\u{1F1EC}"],["Sint Maarten","SX","\u{1F1F8}\u{1F1FD}"],["Slovakia","SK","\u{1F1F8}\u{1F1F0}"],["Slovenia","SI","\u{1F1F8}\u{1F1EE}"],["Solomon Islands","SB","\u{1F1F8}\u{1F1E7}"],["Somalia","SO","\u{1F1F8}\u{1F1F4}"],["South Africa","ZA","\u{1F1FF}\u{1F1E6}"],["South Korea","KR","\u{1F1F0}\u{1F1F7}"],["South Sudan","SS","\u{1F1F8}\u{1F1F8}"],["Spain","ES","\u{1F1EA}\u{1F1F8}"],["Sri Lanka","LK","\u{1F1F1}\u{1F1F0}"],["St. Barth\xE9lemy","BL","\u{1F1E7}\u{1F1F1}"],["St. Helena","SH","\u{1F1F8}\u{1F1ED}"],["St. Kitts & Nevis","KN","\u{1F1F0}\u{1F1F3}"],["St. Lucia","LC","\u{1F1F1}\u{1F1E8}"],["St. Martin","MF","\u{1F1F2}\u{1F1EB}"],["St. Pierre & Miquelon","PM","\u{1F1F5}\u{1F1F2}"],["St. Vincent & Grenadines","VC","\u{1F1FB}\u{1F1E8}"],["Sudan","SD","\u{1F1F8}\u{1F1E9}"],["Suriname","SR","\u{1F1F8}\u{1F1F7}"],["Svalbard & Jan Mayen","SJ","\u{1F1F8}\u{1F1EF}"],["Sweden","SE","\u{1F1F8}\u{1F1EA}"],["Switzerland","CH","\u{1F1E8}\u{1F1ED}"],["Syria","SY","\u{1F1F8}\u{1F1FE}"],["S\xE3o Tom\xE9 & Pr\xEDncipe","ST","\u{1F1F8}\u{1F1F9}"],["Taiwan","TW","\u{1F1F9}\u{1F1FC}"],["Tajikistan","TJ","\u{1F1F9}\u{1F1EF}"],["Tanzania","TZ","\u{1F1F9}\u{1F1FF}"],["Thailand","TH","\u{1F1F9}\u{1F1ED}"],["Timor-Leste","TL","\u{1F1F9}\u{1F1F1}"],["Togo","TG","\u{1F1F9}\u{1F1EC}"],["Tokelau","TK","\u{1F1F9}\u{1F1F0}"],["Tonga","TO","\u{1F1F9}\u{1F1F4}"],["Trinidad & Tobago","TT","\u{1F1F9}\u{1F1F9}"],["Tristan da Cunha","TA","\u{1F1F9}\u{1F1E6}"],["Tunisia","TN","\u{1F1F9}\u{1F1F3}"],["Turkey","TR","\u{1F1F9}\u{1F1F7}"],["Turkmenistan","TM","\u{1F1F9}\u{1F1F2}"],["Turks & Caicos Islands","TC","\u{1F1F9}\u{1F1E8}"],["Tuvalu","TV","\u{1F1F9}\u{1F1FB}"],["U.S. Virgin Islands","VI","\u{1F1FB}\u{1F1EE}"],["Uganda","UG","\u{1F1FA}\u{1F1EC}"],["Ukraine","UA","\u{1F1FA}\u{1F1E6}"],["United Arab Emirates","AE","\u{1F1E6}\u{1F1EA}"],["United Kingdom","GB","\u{1F1EC}\u{1F1E7}"],["United States","US","\u{1F1FA}\u{1F1F8}"],["Uruguay","UY","\u{1F1FA}\u{1F1FE}"],["Uzbekistan","UZ","\u{1F1FA}\u{1F1FF}"],["Vanuatu","VU","\u{1F1FB}\u{1F1FA}"],["Vatican City","VA","\u{1F1FB}\u{1F1E6}"],["Venezuela","VE","\u{1F1FB}\u{1F1EA}"],["Vietnam","VN","\u{1F1FB}\u{1F1F3}"],["Wallis & Futuna","WF","\u{1F1FC}\u{1F1EB}"],["Western Sahara","EH","\u{1F1EA}\u{1F1ED}"],["Yemen","YE","\u{1F1FE}\u{1F1EA}"],["Zambia","ZM","\u{1F1FF}\u{1F1F2}"],["Zimbabwe","ZW","\u{1F1FF}\u{1F1FC}"],["\xC5land Islands","AX","\u{1F1E6}\u{1F1FD}"]];var Ho=Lr,Pr=Ho.map(([e,r,t])=>({name:e,code:r,callCode:Vo(r),flag:t}));import R from"react";import{View as Ro,Text as Mr,Pressable as Ko,StyleSheet as zo}from"react-native";import*as _e from"react";import Go,{Path as No}from"react-native-svg";var Do=e=>_e.createElement(Go,k({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),_e.createElement(No,{stroke:e.color,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 6 9 17l-5-5"})),Fr=Do;var Tr=({country:e,onPress:r,selected:t})=>R.createElement(Ko,{onPress:r},R.createElement(Ro,{style:Ie.row},R.createElement(Mr,{style:Ie.rowFlag},e.flag),R.createElement(Mr,{style:Ie.rowLabel},e.name," (+",e.callCode,")"),t&&R.createElement(Fr,{color:m.interactive}))),Ie=zo.create({row:{flexDirection:"row",alignItems:"center",gap:10,height:56},rowFlag:{fontFamily:"Inter_400Regular",fontSize:17,lineHeight:22},rowLabel:{flex:1,fontFamily:"Inter_400Regular",fontSize:17,lineHeight:22,color:m.black}});import*as Ue from"react";import Zo,{Path as jo}from"react-native-svg";var qo=e=>Ue.createElement(Zo,k({xmlns:"http://www.w3.org/2000/svg",width:17,height:16,fill:"none",viewBox:"0 0 17 16"},e),Ue.createElement(jo,{fill:e.color,fillRule:"evenodd",d:"M7.01 12.01a5.5 5.5 0 1 1 4.304-2.075.7.7 0 0 1 .156.115l3.818 3.819a.65.65 0 0 1-.92.92l-3.818-3.82a.7.7 0 0 1-.115-.155A5.48 5.48 0 0 1 7.01 12.01m4.5-5.5a4.5 4.5 0 1 1-9 0 4.5 4.5 0 0 1 9 0",clipRule:"evenodd"})),Wr=qo;var tn=600,_r=({countryCode:e,onChangeCountryCode:r,onComplete:t})=>{let[o,a]=Yo(""),s=Er(o,tn),n=Jo(()=>Pr.filter(i=>i.name.toLowerCase().includes(s.toLowerCase())),[s]);return T.createElement(Xo,{behavior:en.OS==="ios"?"padding":void 0,style:Ar.innerContainer},T.createElement(Qo,{style:Ar.header},T.createElement(F,{title:"Select country code"}),T.createElement(B,{LeftIcon:T.createElement(Wr,{color:m.placeholder}),value:o,onChangeText:a,placeholder:"Search country"})),T.createElement(rn,{style:{flex:1},data:n,keyExtractor:i=>`country-option-${i.code}`,renderItem:({item:i})=>T.createElement(Tr,{country:i,selected:i.code===e,onPress:()=>{r(i.code),t()}})}),T.createElement(v,{title:"Continue",onPress:t}))},Ar=$o.create({innerContainer:{flex:1,paddingHorizontal:16},header:{gap:20}});import ie from"react";import{View as sn,Text as ln,Pressable as cn,StyleSheet as un}from"react-native";import{getCountryCallingCode as mn}from"@privy-io/js-sdk-core";import*as Oe from"react";import on,{Path as nn}from"react-native-svg";var an=e=>Oe.createElement(on,k({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},e),Oe.createElement(nn,{stroke:e.color,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"m4 6 4 4 4-4"})),Ir=an;var Or=({countryCode:e,onPress:r})=>ie.createElement(cn,{onPress:r},ie.createElement(sn,{style:Ur.cell},ie.createElement(ln,{style:Ur.text},e," +",mn(e)),ie.createElement(Ir,{color:m.icon}))),Ur=un.create({cell:{flexDirection:"row",alignItems:"center",gap:6},text:{fontFamily:"Inter_400Regular",fontSize:18,lineHeight:30,color:m.text}});var Br=({sendCode:e,isLoading:r,error:t,initialPhone:o,FooterComponent:a})=>{let[s,n]=Be(o!=null?o:""),[i,d]=Be("US"),[f,u]=Be(!1),g=pn(i),l=hn(i),c=y=>{try{let C=y.replace(/\D/g,""),p=s.replace(/\D/g,""),E=C===p?y:g.input(y);n(E)}catch(C){console.error("Error processing phone number:",C),n("")}};return f?b.createElement(_r,{countryCode:i,onChangeCountryCode:d,onComplete:()=>u(!1)}):b.createElement(gn,{behavior:fn.OS==="ios"?"padding":void 0,style:se.innerContainer},b.createElement(ae,{style:{flex:1,justifyContent:"space-between",paddingHorizontal:16,paddingBottom:16}},b.createElement(ae,{style:se.content},b.createElement(ae,{style:se.content},b.createElement(ae,{style:se.formContainer},b.createElement(F,{title:"Enter your phone"}),b.createElement(B,{LeftIcon:b.createElement(Or,{countryCode:i,onPress:()=>u(!0)}),value:s,onChangeText:c,error:!!t,status:t?Sn(t):" ",placeholder:l,autoComplete:"tel",keyboardType:"phone-pad",autoFocus:!0})),a),b.createElement(ee,null)),b.createElement(v,{title:"Continue",loading:r,onPress:()=>e(s)})))},Sn=yn({invalid_data:"Phone is incorrect.",not_supported:"Region or carrier not yet supported.",too_many_requests:"Too many requests. Please try again later.",default:"Something went wrong. Please try again."}),se=dn.create({innerContainer:{flex:1},content:{gap:4},formContainer:{rowGap:24}});var kn=600,Gr=({goBackRef:e,onLoginMethodChange:r,otherLoginMethod:t})=>{let{setOtpState:o}=Cn(h),a=U(),[s,n]=Hr(""),{state:i,loginWithCode:d,sendCode:f}=tr(),[u,g]=Hr("phone"),{step:l,error:c=null,isLoading:y=!1,isDone:C=!1}=wn(()=>{var p;switch(i.status){case"initial":return{step:{type:"phone"}};case"sending-code":return{step:{type:u},isLoading:!0};case"awaiting-code-input":return{step:{type:"code"}};case"submitting-code":return{step:{type:"code"},isLoading:!0};case"done":return{step:{type:"code"},isDone:!0};case"error":return{step:{type:u},error:(p=i.error)!=null?p:new Error("Unknown error")}}},[u,i.status]);switch(u!==l.type&&g(l.type),Vr(()=>{if(!C)return;let p=setTimeout(()=>{a()},kn);return()=>clearTimeout(p)},[C,a]),Vr(()=>{if(l.type==="code")return e.current=()=>{o({status:"initial"})},()=>{e.current=null}},[l.type,o,a]),l.type){case"phone":return Ve.createElement(Br,{initialPhone:s,sendCode:p=>{n(p),f({phone:p})},isLoading:y,error:c,FooterComponent:Ve.createElement(ne,{onLoginMethodChange:r,otherLoginMethod:t})});case"code":return Ve.createElement(X,{loginWithCode:p=>d({code:p,phone:s}),requestNewCode:()=>f({phone:s}),subtitle:`Please check ${s} for a message with your login code.`,isLoading:y,error:c,isDone:C})}};import K from"react";import{Pressable as En,StyleSheet as Ln,View as Dr}from"react-native";import*as He from"react";import bn,{Path as vn}from"react-native-svg";var xn=e=>He.createElement(bn,k({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),He.createElement(vn,{fill:e.color,d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"})),Nr=xn;var Rr=({goBack:e})=>K.createElement(Dr,{style:Kr.navigationBar},K.createElement(Pn,{onPress:e})),Pn=e=>K.createElement(En,k({},e),K.createElement(Dr,{style:Kr.backButton},K.createElement(Nr,{color:m.icon}))),Kr=Ln.create({navigationBar:{height:48},backButton:{width:48,height:48,justifyContent:"center",alignItems:"center"}});import zr from"react";import{Modal as Fn,View as Mn,StyleSheet as Zr}from"react-native";import{useSafeAreaInsets as Tn}from"react-native-safe-area-context";var Wn=()=>{let e=Tn();return{paddingTop:e.top,paddingBottom:e.bottom,paddingLeft:e.left,paddingRight:e.right}},jr=({children:e,visible:r})=>{let t=Wn();return zr.createElement(Fn,{animationType:"slide",transparent:!0,visible:r},zr.createElement(Mn,{style:[Zr.absoluteFill,An.modalContent,t]},e))},An=Zr.create({modalContent:{backgroundColor:m.white}});var Un=({config:e,goBackRef:r})=>{let[t,o]=In(()=>Re(e.loginMethods)),a=t&&Ke(e.loginMethods,t);switch(t){case"email":return z.createElement(xr,{goBackRef:r,otherLoginMethod:a,onLoginMethodChange:o});case"sms":return z.createElement(Gr,{goBackRef:r,otherLoginMethod:a,onLoginMethodChange:o});default:throw new ue("unsupported_login_method",`Unsupported login method: ${t}`)}},On=()=>{let e=U(),r=Ze(),t=Je();qe();let o=_n(null);return z.createElement(jr,{visible:t},z.createElement(Rr,{goBack:()=>{var a;return((a=o.current)!=null?a:e)()}}),r&&z.createElement(Un,{config:r,goBackRef:o}))};import{useCallback as qr,useContext as Bn,useEffect as Vn,useRef as Hn}from"react";var Gn=()=>{let e=je(),{setOtpState:r,user:t}=Bn(h),o=qr(()=>r({status:"initial"}),[]),a=Hn(t);return Vn(()=>{a.current=t}),{login:qr(n=>S(void 0,null,function*(){return{user:yield e(n,a.current,o)}}),[e,o])}};import{digest as Nn}from"expo-crypto";import Dn from"@privy-io/js-sdk-core";var Rn=({appId:e,clientId:r,storage:t=ce,supportedChains:o,baseUrl:a,logLevel:s})=>new Dn({appId:e,clientId:r,supportedChains:o,storage:De(t),sdkVersion:`expo:${Ge.version}`,nativeAppIdentifier:Ne(),crypto:{digest:Nn},baseUrl:a,logLevel:s});export{h as PrivyContext,On as PrivyElements,zn as PrivyProvider,ue as PrivyUIError,ce as SecureStorageAdapter,Rn as createPrivyClient,Kn as getAccessToken,$n as hasError,Zn as isConnected,qn as isConnecting,Qn as isCreating,Jn as isDisconnected,Yn as isNotCreated,jn as isReconnecting,Xn as needsRecovery,Va as useCreateGuestAccount,Pt as useEmbeddedSolanaWallet,be as useEmbeddedWallet,Fa as useEmbeddedWalletStateChange,Aa as useIdentityToken,Ei as useLinkEmail,Vi as useLinkSMS,Qi as useLinkWithFarcaster,Yr as useLinkWithOAuth,ni as useLinkWithSiwe,Gn as useLogin,Xe as useLoginWithEmail,ua as useLoginWithFarcaster,Jr as useLoginWithOAuth,tr as useLoginWithSMS,mi as useLoginWithSiwe,Qr as useOAuthFlow,ka as useOAuthTokens,Wt as usePrivy,Mt as usePrivyClient,oa as useUnlinkFarcaster,pa as useUnlinkOAuth,Si as useUnlinkWallet};
@@ -1 +1 @@
1
- import{A as M,B as I,C as T,D as U,E as V,F as D,G as Y,H as j,a as m,b as k,d as c,f as g,x as f}from"./chunk-IVJEK62C.js";import{useCallback as E,useContext as W}from"react";import{PrivyClientError as q}from"@privy-io/js-sdk-core";import{PrivyClientError as J}from"@privy-io/js-sdk-core";var w=e=>c(void 0,null,function*(){var a;let r=yield(yield import("react-native-passkeys")).create({rp:e.rp,user:e.user,challenge:e.challenge,pubKeyCredParams:e.pubKeyCredParams,excludeCredentials:e.excludeCredentials,authenticatorSelection:e.authenticatorSelection,timeout:12e4});if(!r)throw new J({code:"failed_to_create_passkey",error:"Could not create passkey"});return k(m({},r),{type:(a=r.type)!=null?a:"public-key",clientExtensionResults:{}})});import{PrivyClientError as v}from"@privy-io/js-sdk-core";var C=e=>c(void 0,null,function*(){var a;let r=yield(yield import("react-native-passkeys")).get({rpId:e.rpId,challenge:e.challenge,allowCredentials:e.allowCredentials,timeout:12e4});if(!r)throw new v({code:"no_passkey_found_for_challenge",error:"Could not find a matching passkey to login with"});return k(m({},r),{type:(a=r.type)!=null?a:"public-key",clientExtensionResults:{}})});var oe=e=>{let{user:l,client:r,passkeyState:a,setPasskeyState:i}=W(f),d=E(o=>{var n;let u=g(o);return i({status:"error",error:u}),(n=e==null?void 0:e.onError)==null||n.call(e,u),u},[e==null?void 0:e.onError]);return{linkWithPasskey:E(u=>c(void 0,[u],function*({relyingParty:o}){var n,p,h,P,s,_,y,x,b;try{if(!l)throw new q({code:"attempted_link_passkey_before_logged_in",error:"Must be logged in to link a passkey."});i({status:"generating-challenege"});let{options:t}=yield r.auth.passkey.generateRegistrationOptions(o);i({status:"awaiting-passkey"});let N=yield w({rp:t.rp,user:{id:t.user.id,name:t.user.name,displayName:t.user.display_name},challenge:t.challenge,pubKeyCredParams:t.pub_key_cred_params,extensions:{hmacCreateSecret:(n=t.extensions)==null?void 0:n.hmac_create_secret,credProps:(h=(p=t.extensions)==null?void 0:p.cred_props)==null?void 0:h.rk,appid:(P=t.extensions)==null?void 0:P.app_id},attestation:t.attestation,excludeCredentials:t.exclude_credentials,authenticatorSelection:{authenticatorAttachment:(s=t.authenticator_selection)==null?void 0:s.authenticator_attachment,residentKey:(_=t.authenticator_selection)==null?void 0:_.resident_key,userVerification:(y=t.authenticator_selection)==null?void 0:y.user_verification,requireResidentKey:(x=t.authenticator_selection)==null?void 0:x.require_resident_key}});i({status:"submitting-response"});let O=yield r.auth.passkey.linkWithPasskey(N,o);return i({status:"done"}),(b=e==null?void 0:e.onSuccess)==null||b.call(e,O),O}catch(t){throw d(t)}}),[l,r,d,e==null?void 0:e.onSuccess]),state:a}};import{useCallback as K,useContext as H}from"react";import{PrivyClientError as L}from"@privy-io/js-sdk-core";var de=e=>{let{user:l,client:r,passkeyState:a,setPasskeyState:i}=H(f),d=K(o=>{var n;let u=g(o);return i({status:"error",error:u}),(n=e==null?void 0:e.onError)==null||n.call(e,u),u},[e==null?void 0:e.onError]);return{loginWithPasskey:K(u=>c(void 0,[u],function*({relyingParty:o}){var n,p,h,P;try{if(l)throw new L({code:"attempted_login_with_passkey_while_already_logged_in",error:"Already logged in, use `useLinkWithPasskey` if you are trying to link a passkey to an existing account"});i({status:"generating-challenege"});let{options:s}=yield r.auth.passkey.generateAuthenticationOptions(o);i({status:"awaiting-passkey"});let _=yield C({challenge:s.challenge,rpId:s.rp_id,extensions:{appid:(n=s.extensions)==null?void 0:n.app_id,credProps:(p=s.extensions)==null?void 0:p.cred_props,hmacCreateSecret:(h=s.extensions)==null?void 0:h.hmac_create_secret},timeout:s.timeout,allowCredentials:s.allow_credentials,userVerification:s.user_verification});i({status:"submitting-response"});let y=yield r.auth.passkey.loginWithPasskey(k(m({},_),{clientExtensionResults:{}}),s.challenge,o);return i({status:"done"}),(P=e==null?void 0:e.onSuccess)==null||P.call(e,y.user,y.is_new_user),y.user}catch(s){throw d(s)}}),[r,d,e==null?void 0:e.onSuccess]),state:a}};export{Y as hasError,M as isConnected,T as isConnecting,D as isCreating,U as isDisconnected,V as isNotCreated,I as isReconnecting,j as needsRecovery,oe as useLinkWithPasskey,de as useLoginWithPasskey};
1
+ import{A as M,B as I,C as T,D as U,E as V,F as D,G as Y,H as j,a as m,b as k,d as c,f as g,x as f}from"./chunk-LE4QILEJ.js";import{useCallback as E,useContext as W}from"react";import{PrivyClientError as q}from"@privy-io/js-sdk-core";import{PrivyClientError as J}from"@privy-io/js-sdk-core";var w=e=>c(void 0,null,function*(){var a;let r=yield(yield import("react-native-passkeys")).create({rp:e.rp,user:e.user,challenge:e.challenge,pubKeyCredParams:e.pubKeyCredParams,excludeCredentials:e.excludeCredentials,authenticatorSelection:e.authenticatorSelection,timeout:12e4});if(!r)throw new J({code:"failed_to_create_passkey",error:"Could not create passkey"});return k(m({},r),{type:(a=r.type)!=null?a:"public-key",clientExtensionResults:{}})});import{PrivyClientError as v}from"@privy-io/js-sdk-core";var C=e=>c(void 0,null,function*(){var a;let r=yield(yield import("react-native-passkeys")).get({rpId:e.rpId,challenge:e.challenge,allowCredentials:e.allowCredentials,timeout:12e4});if(!r)throw new v({code:"no_passkey_found_for_challenge",error:"Could not find a matching passkey to login with"});return k(m({},r),{type:(a=r.type)!=null?a:"public-key",clientExtensionResults:{}})});var oe=e=>{let{user:l,client:r,passkeyState:a,setPasskeyState:i}=W(f),d=E(o=>{var n;let u=g(o);return i({status:"error",error:u}),(n=e==null?void 0:e.onError)==null||n.call(e,u),u},[e==null?void 0:e.onError]);return{linkWithPasskey:E(u=>c(void 0,[u],function*({relyingParty:o}){var n,p,h,P,s,_,y,x,b;try{if(!l)throw new q({code:"attempted_link_passkey_before_logged_in",error:"Must be logged in to link a passkey."});i({status:"generating-challenege"});let{options:t}=yield r.auth.passkey.generateRegistrationOptions(o);i({status:"awaiting-passkey"});let N=yield w({rp:t.rp,user:{id:t.user.id,name:t.user.name,displayName:t.user.display_name},challenge:t.challenge,pubKeyCredParams:t.pub_key_cred_params,extensions:{hmacCreateSecret:(n=t.extensions)==null?void 0:n.hmac_create_secret,credProps:(h=(p=t.extensions)==null?void 0:p.cred_props)==null?void 0:h.rk,appid:(P=t.extensions)==null?void 0:P.app_id},attestation:t.attestation,excludeCredentials:t.exclude_credentials,authenticatorSelection:{authenticatorAttachment:(s=t.authenticator_selection)==null?void 0:s.authenticator_attachment,residentKey:(_=t.authenticator_selection)==null?void 0:_.resident_key,userVerification:(y=t.authenticator_selection)==null?void 0:y.user_verification,requireResidentKey:(x=t.authenticator_selection)==null?void 0:x.require_resident_key}});i({status:"submitting-response"});let O=yield r.auth.passkey.linkWithPasskey(N,o);return i({status:"done"}),(b=e==null?void 0:e.onSuccess)==null||b.call(e,O),O}catch(t){throw d(t)}}),[l,r,d,e==null?void 0:e.onSuccess]),state:a}};import{useCallback as K,useContext as H}from"react";import{PrivyClientError as L}from"@privy-io/js-sdk-core";var de=e=>{let{user:l,client:r,passkeyState:a,setPasskeyState:i}=H(f),d=K(o=>{var n;let u=g(o);return i({status:"error",error:u}),(n=e==null?void 0:e.onError)==null||n.call(e,u),u},[e==null?void 0:e.onError]);return{loginWithPasskey:K(u=>c(void 0,[u],function*({relyingParty:o}){var n,p,h,P;try{if(l)throw new L({code:"attempted_login_with_passkey_while_already_logged_in",error:"Already logged in, use `useLinkWithPasskey` if you are trying to link a passkey to an existing account"});i({status:"generating-challenege"});let{options:s}=yield r.auth.passkey.generateAuthenticationOptions(o);i({status:"awaiting-passkey"});let _=yield C({challenge:s.challenge,rpId:s.rp_id,extensions:{appid:(n=s.extensions)==null?void 0:n.app_id,credProps:(p=s.extensions)==null?void 0:p.cred_props,hmacCreateSecret:(h=s.extensions)==null?void 0:h.hmac_create_secret},timeout:s.timeout,allowCredentials:s.allow_credentials,userVerification:s.user_verification});i({status:"submitting-response"});let y=yield r.auth.passkey.loginWithPasskey(k(m({},_),{clientExtensionResults:{}}),s.challenge,o);return i({status:"done"}),(P=e==null?void 0:e.onSuccess)==null||P.call(e,y.user,y.is_new_user),y.user}catch(s){throw d(s)}}),[r,d,e==null?void 0:e.onSuccess]),state:a}};export{Y as hasError,M as isConnected,T as isConnecting,D as isCreating,U as isDisconnected,V as isNotCreated,I as isReconnecting,j as needsRecovery,oe as useLinkWithPasskey,de as useLoginWithPasskey};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _createStarExport(obj) { Object.keys(obj) .filter((key) => key !== "default" && key !== "__esModule") .forEach((key) => { if (exports.hasOwnProperty(key)) { return; } Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]}); }); }var _chunkIVJEK62Cjs = require('./chunk-IVJEK62C.js');var _jssdkcore = require('@privy-io/js-sdk-core'); var _jssdkcore2 = _interopRequireDefault(_jssdkcore); _createStarExport(_jssdkcore);var _react = require('react'); var Te = _interopRequireWildcard(_react); var We = _interopRequireWildcard(_react); var _e = _interopRequireWildcard(_react); var Ue = _interopRequireWildcard(_react); var Oe = _interopRequireWildcard(_react); var He = _interopRequireWildcard(_react);var ni=e=>{let{user:r,client:t,setSiweState:o,siweState:a}=_react.useContext.call(void 0, _chunkIVJEK62Cjs.x),s=_react.useCallback.call(void 0, d=>{var u;let f=_chunkIVJEK62Cjs.f.call(void 0, d);return o({status:"error",error:f}),(u=e==null?void 0:e.onError)==null||u.call(e,f),f},[e==null?void 0:e.onError]),n=_react.useCallback.call(void 0, g=>_chunkIVJEK62Cjs.d.call(void 0, void 0,[g],function*({wallet:d,from:{domain:f,uri:u}}){var l;try{o({status:"generating-message"});let c=yield t.auth.siwe.init(d,f,u);return o({status:"awaiting-signature"}),(l=e==null?void 0:e.onGenerateMessage)==null||l.call(e,c.message),c.message}catch(c){throw s(c)}}),[t,s,e==null?void 0:e.onGenerateMessage]),i=_react.useCallback.call(void 0, u=>_chunkIVJEK62Cjs.d.call(void 0, void 0,[u],function*({signature:d,messageOverride:f}){var g;try{if(!r)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_link_siwe_before_logged_in",error:"Must be logged in to link a wallet, Use `useLoginWithSiwe` to login with a wallet"});o({status:"submitting-signature"});let l=yield t.auth.siwe.linkWithSiwe(d,void 0,f);return o({status:"done"}),(g=e==null?void 0:e.onSuccess)==null||g.call(e,l),l}catch(l){throw s(l)}}),[r,t,s,e==null?void 0:e.onSuccess]);return{generateSiweMessage:n,linkWithSiwe:i,state:a}};var mi=e=>{let{user:r,client:t,setSiweState:o,siweState:a}=_react.useContext.call(void 0, _chunkIVJEK62Cjs.x),s=_react.useCallback.call(void 0, d=>{var u;let f=_chunkIVJEK62Cjs.f.call(void 0, d);return o({status:"error",error:f}),(u=e==null?void 0:e.onError)==null||u.call(e,f),f},[e==null?void 0:e.onError]),n=_react.useCallback.call(void 0, g=>_chunkIVJEK62Cjs.d.call(void 0, void 0,[g],function*({wallet:d,from:{domain:f,uri:u}}){var l;try{o({status:"generating-message"});let c=yield t.auth.siwe.init(d,f,u);return o({status:"awaiting-signature"}),(l=e==null?void 0:e.onGenerateMessage)==null||l.call(e,c.message),c.message}catch(c){throw s(c)}}),[t,s,e==null?void 0:e.onGenerateMessage]);return{loginWithSiwe:_react.useCallback.call(void 0, g=>_chunkIVJEK62Cjs.d.call(void 0, void 0,[g],function*({signature:d,messageOverride:f,disableSignup:u}){var l;try{if(r)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_login_with_siwe_while_already_logged_in",error:"Already logged in, use `useLinkWithSiwe` if you are trying to link a wallet to an existing account"});o({status:"submitting-signature"});let c=yield t.auth.siwe.loginWithSiwe(d,void 0,f,u?"no-signup":"login-or-sign-up");return o({status:"done"}),(l=e==null?void 0:e.onSuccess)==null||l.call(e,c.user,c.is_new_user),c.user}catch(c){throw s(c)}}),[r,t,s,e==null?void 0:e.onSuccess]),generateSiweMessage:n,state:a}};var Si=e=>{let{user:r,client:t}=_react.useContext.call(void 0, _chunkIVJEK62Cjs.x),o=_react.useCallback.call(void 0, s=>{var i;let n=_chunkIVJEK62Cjs.f.call(void 0, s);return(i=e==null?void 0:e.onError)==null||i.call(e,n),n},[e==null?void 0:e.onError]);return{unlinkWallet:_react.useCallback.call(void 0, n=>_chunkIVJEK62Cjs.d.call(void 0, void 0,[n],function*({address:s}){var i;try{if(!r)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_unlink_siwe_before_logged_in",error:"Must be logged in to unlink a wallet, Use `useLoginWithSiwe` to login with a wallet"});let d=yield t.auth.siwe.unlinkWallet(s);return(i=e==null?void 0:e.onSuccess)==null||i.call(e,d),d}catch(d){throw o(d)}}),[r,t,o,e==null?void 0:e.onSuccess])}};var Ei=e=>{let[r,t]=_react.useState.call(void 0, ""),{user:o,client:a,otpState:s,setOtpState:n}=_react.useContext.call(void 0, _chunkIVJEK62Cjs.x),i=_react.useCallback.call(void 0, u=>{var l;let g=_chunkIVJEK62Cjs.f.call(void 0, u);return n({status:"error",error:g}),(l=e==null?void 0:e.onError)==null||l.call(e,g),g},[e==null?void 0:e.onError]),d=_react.useCallback.call(void 0, g=>_chunkIVJEK62Cjs.d.call(void 0, void 0,[g],function*({email:u}){var l;t(u);try{n({status:"sending-code"});let c=yield a.auth.email.sendCode(u);return n({status:"awaiting-code-input"}),(l=e==null?void 0:e.onSendCodeSuccess)==null||l.call(e,{email:u}),c}catch(c){return i(c),{success:!1}}}),[a,i,e==null?void 0:e.onSendCodeSuccess]),f=_react.useCallback.call(void 0, l=>_chunkIVJEK62Cjs.d.call(void 0, void 0,[l],function*({code:u,email:g}){var c;try{if(!o)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_link_email_before_logged_in",error:"Must be logged in to link an email, Use `useLoginWithEmail` to login with email"});let y=g||r;if(!y)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_submit_otp_before_sending",error:"Must `sendCode` with a valid email before calling `linkWithCode`"});n({status:"submitting-code"});let C=yield a.auth.email.linkWithCode(y,u);return n({status:"done"}),(c=e==null?void 0:e.onLinkSuccess)==null||c.call(e,C),C}catch(y){i(y)}}),[o,a,r,i,e==null?void 0:e.onLinkSuccess]);return{sendCode:d,linkWithCode:f,state:s}};var Xe=e=>{let[r,t]=_react.useState.call(void 0, ""),{user:o,client:a,otpState:s,setOtpState:n}=_react.useContext.call(void 0, _chunkIVJEK62Cjs.x),i=_react.useCallback.call(void 0, u=>{var l;let g=_chunkIVJEK62Cjs.f.call(void 0, u);return n({status:"error",error:g}),(l=e==null?void 0:e.onError)==null||l.call(e,g),g},[e==null?void 0:e.onError]),d=_react.useCallback.call(void 0, g=>_chunkIVJEK62Cjs.d.call(void 0, void 0,[g],function*({email:u}){var l;t(u);try{n({status:"sending-code"});let c=yield a.auth.email.sendCode(u);return n({status:"awaiting-code-input"}),(l=e==null?void 0:e.onSendCodeSuccess)==null||l.call(e,{email:u}),c}catch(c){return i(c),{success:!1}}}),[a,i,e==null?void 0:e.onSendCodeSuccess]),f=_react.useCallback.call(void 0, c=>_chunkIVJEK62Cjs.d.call(void 0, void 0,[c],function*({code:u,email:g,disableSignup:l}){var y;try{if(o)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_login_with_email_while_already_logged_in",error:"Already logged in, use `useLinkWithEmail` if you are trying to link an email to an existing account"});let C=g||r;if(!C)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_submit_otp_before_sending",error:"Must `sendCode` with a valid email before calling `loginWithCode`"});n({status:"submitting-code"});let p=yield a.auth.email.loginWithCode(C,u,l?"no-signup":"login-or-sign-up");return n({status:"done"}),(y=e==null?void 0:e.onLoginSuccess)==null||y.call(e,p.user,p.is_new_user),p==null?void 0:p.user}catch(C){i(C)}}),[o,a,r,i,e==null?void 0:e.onLoginSuccess]);return{sendCode:d,loginWithCode:f,state:s}};var Vi=e=>{let[r,t]=_react.useState.call(void 0, ""),{user:o,client:a,otpState:s,setOtpState:n}=_react.useContext.call(void 0, _chunkIVJEK62Cjs.x),i=_react.useCallback.call(void 0, u=>{var l;let g=_chunkIVJEK62Cjs.f.call(void 0, u);return n({status:"error",error:g}),(l=e==null?void 0:e.onError)==null||l.call(e,g),g},[e==null?void 0:e.onError]),d=_react.useCallback.call(void 0, g=>_chunkIVJEK62Cjs.d.call(void 0, void 0,[g],function*({phone:u}){var l;t(u);try{n({status:"sending-code"});let c=yield a.auth.phone.sendCode(u);return n({status:"awaiting-code-input"}),(l=e==null?void 0:e.onSendCodeSuccess)==null||l.call(e,{phone:u}),c}catch(c){return i(c),{success:!1}}}),[a,i,e==null?void 0:e.onSendCodeSuccess]),f=_react.useCallback.call(void 0, l=>_chunkIVJEK62Cjs.d.call(void 0, void 0,[l],function*({code:u,phone:g}){var c;try{if(!o)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_link_sms_before_logged_in",error:"Must be logged in to link a phone number, Use `useLoginWithSMS` to login with a phone number"});if(!(g||r))throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_submit_otp_before_sending",error:"Must `sendCode` with a valid phone number before calling `linkWithCode`"});n({status:"submitting-code"});let C=yield a.auth.phone.linkWithCode(g||r,u);return n({status:"done"}),(c=e==null?void 0:e.onLinkSuccess)==null||c.call(e,C),C}catch(y){i(y)}}),[o,a,r,i,e==null?void 0:e.onLinkSuccess]);return{sendCode:d,linkWithCode:f,state:s}};var tr=e=>{let[r,t]=_react.useState.call(void 0, ""),{user:o,client:a,otpState:s,setOtpState:n}=_react.useContext.call(void 0, _chunkIVJEK62Cjs.x),i=_react.useCallback.call(void 0, u=>{var l;let g=_chunkIVJEK62Cjs.f.call(void 0, u);return n({status:"error",error:g}),(l=e==null?void 0:e.onError)==null||l.call(e,g),g},[e==null?void 0:e.onError]),d=_react.useCallback.call(void 0, g=>_chunkIVJEK62Cjs.d.call(void 0, void 0,[g],function*({phone:u}){var l;t(u);try{n({status:"sending-code"});let c=yield a.auth.phone.sendCode(u);return n({status:"awaiting-code-input"}),(l=e==null?void 0:e.onSendCodeSuccess)==null||l.call(e,{phone:u}),c}catch(c){return i(c),{success:!1}}}),[a,i,e==null?void 0:e.onSendCodeSuccess]),f=_react.useCallback.call(void 0, c=>_chunkIVJEK62Cjs.d.call(void 0, void 0,[c],function*({code:u,phone:g,disableSignup:l}){var y;try{if(o)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_login_with_sms_while_already_logged_in",error:"Already logged in, use `useLinkWithSMS` if you are trying to link a phone number to an existing account"});if(!(g||r))throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_submit_otp_before_sending",error:"Must `sendCode` with a valid phone number before calling `loginWithCode`"});n({status:"submitting-code"});let p=yield a.auth.phone.loginWithCode(g||r,u,l?"no-signup":"login-or-sign-up");return n({status:"done"}),(y=e==null?void 0:e.onLoginSuccess)==null||y.call(e,p.user,p.is_new_user),p==null?void 0:p.user}catch(C){i(C)}}),[o,a,r,i,e==null?void 0:e.onLoginSuccess]);return{sendCode:d,loginWithCode:f,state:s}};var _expolinking = require('expo-linking'); var q = _interopRequireWildcard(_expolinking); var J = _interopRequireWildcard(_expolinking);var Qi=e=>{let{appState:r,getCurrentAppState:t}=_chunkIVJEK62Cjs.h.call(void 0, ),{client:o,user:a,farcasterState:s,setFarcasterState:n}=_react.useContext.call(void 0, _chunkIVJEK62Cjs.x),i=_react.useRef.call(void 0, !1),d=_react.useCallback.call(void 0, g=>{var c;let l=_chunkIVJEK62Cjs.f.call(void 0, g);return n({status:"error",error:l}),(c=e==null?void 0:e.onError)==null||c.call(e,l),l},[e==null?void 0:e.onError,n]),f=_react.useCallback.call(void 0, ()=>{i.current=!0},[]);return{linkWithFarcaster:_react.useCallback.call(void 0, (y,...C)=>_chunkIVJEK62Cjs.d.call(void 0, void 0,[y,...C],function*({relyingParty:g,redirectUrl:l},c={pollAttempts:10,pollIntervalMs:1e3}){var p;try{if(i.current=!1,!a)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_link_farcaster_before_logged_in",error:"Must be logged in to link a Farcaster account."});n({status:"generating-uri"});let{connect_uri:E,channel_token:L}=yield o.auth.farcaster.initializeAuth({relyingParty:g,redirectUrl:q.createURL(l!=null?l:"/")});if(!E)throw new (0, _jssdkcore.PrivyClientError)({code:"failed_to_generate_farcaster_uri",error:"Failed to generate farcaster uri"});if(!L)throw new (0, _jssdkcore.PrivyClientError)({code:"failed_to_generate_farcaster_channel_token",error:"Failed to generate farcaster channel token"});yield q.openURL(E),n({status:"polling-status"});let _=0;for(;_<c.pollAttempts;){if(i.current)throw new (0, _jssdkcore.PrivyClientError)({code:"farcaster_polling_canceled",error:"Farcaster polling canceled"});if(r.current!=="active"&&t()!=="active"){yield _chunkIVJEK62Cjs.g.call(void 0, c.pollIntervalMs);continue}let V=yield o.auth.farcaster.getFarcasterStatus({channel_token:L});if(V.state==="completed"){n({status:"submitting-token"});let H=yield o.auth.farcaster.link(_chunkIVJEK62Cjs.a.call(void 0, {channel_token:L},V));return n({status:"done"}),(p=e==null?void 0:e.onSuccess)==null||p.call(e,H),H}_++,yield _chunkIVJEK62Cjs.g.call(void 0, c.pollIntervalMs)}throw new (0, _jssdkcore.PrivyClientError)({code:"farcaster_polling_timeout",error:"Farcasting polling timed out"})}catch(E){throw d(E)}}),[o,e==null?void 0:e.onSuccess,d,n,a]),state:s,cancel:f}};var oa=e=>{let{client:r}=_react.useContext.call(void 0, _chunkIVJEK62Cjs.x),t=_react.useCallback.call(void 0, a=>{var n;let s=_chunkIVJEK62Cjs.f.call(void 0, a);return(n=e==null?void 0:e.onError)==null||n.call(e,s),s},[e==null?void 0:e.onError]);return{unlinkFarcaster:_react.useCallback.call(void 0, s=>_chunkIVJEK62Cjs.d.call(void 0, void 0,[s],function*({fid:a}){var n;try{let i=yield r.auth.farcaster.unlink({fid:a});return(n=e==null?void 0:e.onSuccess)==null||n.call(e,i),i}catch(i){throw t(i)}}),[r,e==null?void 0:e.onSuccess,t])}};var ua=e=>{let{appState:r,getCurrentAppState:t}=_chunkIVJEK62Cjs.h.call(void 0, ),{client:o,user:a,farcasterState:s,setFarcasterState:n}=_react.useContext.call(void 0, _chunkIVJEK62Cjs.x),i=_react.useRef.call(void 0, !1),d=_react.useCallback.call(void 0, g=>{var c;let l=_chunkIVJEK62Cjs.f.call(void 0, g);return n({status:"error",error:l}),(c=e==null?void 0:e.onError)==null||c.call(e,l),l},[e==null?void 0:e.onError,n]),f=_react.useCallback.call(void 0, ()=>{i.current=!0},[]);return{loginWithFarcaster:_react.useCallback.call(void 0, (C,...p)=>_chunkIVJEK62Cjs.d.call(void 0, void 0,[C,...p],function*({relyingParty:g,redirectUrl:l,disableSignup:c},y={pollAttempts:10,pollIntervalMs:1e3}){var E;try{if(i.current=!1,a)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_login_with_farcaster_while_already_logged_in",error:"Already logged in, use `useLinkWithFarcaster` if you are trying to link farcaster to an existing account"});n({status:"generating-uri"});let{connect_uri:L,channel_token:_}=yield o.auth.farcaster.initializeAuth({relyingParty:g,redirectUrl:J.createURL(l!=null?l:"/")});if(!L)throw new (0, _jssdkcore.PrivyClientError)({code:"failed_to_generate_farcaster_uri",error:"Failed to generate farcaster uri"});if(!_)throw new (0, _jssdkcore.PrivyClientError)({code:"failed_to_generate_farcaster_channel_token",error:"Failed to generate farcaster channel token"});yield J.openURL(L),n({status:"polling-status"});let V=0;for(;V<y.pollAttempts;){if(i.current)throw new (0, _jssdkcore.PrivyClientError)({code:"farcaster_polling_canceled",error:"Farcaster polling canceled"});if(r.current!=="active"&&t()!=="active"){yield _chunkIVJEK62Cjs.g.call(void 0, y.pollIntervalMs);continue}let H=yield o.auth.farcaster.getFarcasterStatus({channel_token:_});if(H.state==="completed"){n({status:"submitting-token"});let le=yield o.auth.farcaster.authenticate(_chunkIVJEK62Cjs.a.call(void 0, {channel_token:_,mode:c?"no-signup":"login-or-sign-up"},H));return n({status:"done"}),(E=e==null?void 0:e.onSuccess)==null||E.call(e,le.user,le.is_new_user),le.user}V++,yield _chunkIVJEK62Cjs.g.call(void 0, y.pollIntervalMs)}throw new (0, _jssdkcore.PrivyClientError)({code:"farcaster_polling_timeout",error:"Farcasting polling timed out"})}catch(L){throw d(L)}}),[o,d,e==null?void 0:e.onSuccess,n,a,r]),state:s,cancel:f}};var pa=e=>{let{client:r}=_react.useContext.call(void 0, _chunkIVJEK62Cjs.x),t=_react.useCallback.call(void 0, a=>{var n;let s=_chunkIVJEK62Cjs.f.call(void 0, a);return(n=e==null?void 0:e.onError)==null||n.call(e,s),s},[e==null?void 0:e.onError]);return{unlinkOAuth:_react.useCallback.call(void 0, n=>_chunkIVJEK62Cjs.d.call(void 0, void 0,[n],function*({provider:a,subject:s}){var i;try{let d=yield r.auth.oauth.unlink(a,s);return(i=e==null?void 0:e.onSuccess)==null||i.call(e,d),d}catch(d){throw t(d)}}),[r,e==null?void 0:e.onSuccess,t])}};var ka=e=>{let{client:r}=_react.useContext.call(void 0, _chunkIVJEK62Cjs.x),t=_react.useRef.call(void 0, e.onOAuthTokenGrant);t.current=e.onOAuthTokenGrant,_react.useEffect.call(void 0, ()=>{let{unsubscribe:o}=r.addOAuthTokensListener(a=>{t.current(a)});return o},[r])};var be=(e={})=>{let{wallet:r,createWalletCallbacks:t,recoverWalletCallbacks:o,setWalletRecoveryCallbacks:a}=_react.useContext.call(void 0, _chunkIVJEK62Cjs.x),{onCreateWalletSuccess:s,onCreateWalletError:n,onRecoverWalletError:i,onRecoverWalletSuccess:d,onSetWalletRecoverySuccess:f,onSetWalletRecoveryError:u}=e;return _react.useEffect.call(void 0, ()=>{t.current={onSuccess:s,onError:n}},[s,n]),_react.useEffect.call(void 0, ()=>{o.current={onSuccess:d,onError:i}},[d,i]),_react.useEffect.call(void 0, ()=>{a.current={onSuccess:f,onError:u}},[d,i]),r};var Fa=({onStateChange:e})=>{let r=be();return _react.useEffect.call(void 0, ()=>{e(r)},[r])};var Aa=()=>{let{getIdentityToken:e}=_react.useContext.call(void 0, _chunkIVJEK62Cjs.x);return{getIdentityToken:e}};var Va=e=>{let{user:r,client:t}=_react.useContext.call(void 0, _chunkIVJEK62Cjs.x),o=_react.useCallback.call(void 0, s=>{var i;let n=_chunkIVJEK62Cjs.f.call(void 0, s);return(i=e==null?void 0:e.onError)==null||i.call(e,n),n},[e==null?void 0:e.onError]);return{create:_react.useCallback.call(void 0, ()=>_chunkIVJEK62Cjs.d.call(void 0, void 0,null,function*(){var s;try{if(r)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_to_create_guest_account_for_logged_in_user",error:"Already logged in, you cannot create a guest account"});let n=yield t.auth.guest.create();return(s=e==null?void 0:e.onSuccess)==null||s.call(e,n.user,n.is_new_user),n.user}catch(n){throw o(n)}}),[t,o,r,e==null?void 0:e.onSuccess])}};var Pt=(e={})=>{let{solanaWallet:r,createSolanaWalletCallbacks:t,recoverSolanaWalletCallbacks:o}=_react.useContext.call(void 0, _chunkIVJEK62Cjs.x),{onCreateWalletSuccess:a,onCreateWalletError:s,onRecoverWalletError:n,onRecoverWalletSuccess:i}=e;return _react.useEffect.call(void 0, ()=>{t.current={onSuccess:a,onError:s}},[a,s]),_react.useEffect.call(void 0, ()=>{o.current={onSuccess:i,onError:n}},[i,n]),r};var Mt=()=>{let{client:e}=_react.useContext.call(void 0, _chunkIVJEK62Cjs.x);return e};var Wt=()=>{let{user:e,isReady:r,logout:t,getAccessToken:o}=_react.useContext.call(void 0, _chunkIVJEK62Cjs.x);return{user:e,isReady:r,logout:t,getAccessToken:o}};var _reactnative = require('react-native');var _reactnativesvg = require('react-native-svg'); var _reactnativesvg2 = _interopRequireDefault(_reactnativesvg);var sr=()=>{let e=_reactnative.useAnimatedValue.call(void 0, 0);_react.useEffect.call(void 0, ()=>{e.setValue(0);let t=_reactnative.Animated.loop(_reactnative.Animated.timing(e,{toValue:1,duration:1200,useNativeDriver:!0,easing:_reactnative.Easing.linear}));return t.start(),()=>t.stop()},[]);let r=e.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return Te.default.createElement(_reactnative.Animated.View,{style:{transform:[{rotate:r}]}},Te.default.createElement(_reactnativesvg2.default,{width:20,height:20,viewBox:"0 0 20 20",fill:"none"},Te.default.createElement(_reactnativesvg.Path,{d:"M19 10a9 9 0 11-6.219-8.56",stroke:"#fff",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})))};var m={interactive:"#5B4FFF",white:"#FFFFFF",black:"#000000",brand:"#010110",placeholder:"#9498B8",success:"#22C55E",successDark:"#15803D",inputBackground:"#F3F3F3",text:"#040217",icon:"#110F2A",border:"#E2E3F0",error:"#EF4444",errorDark:"#B91C1C",textMuted:"#64668B",textTitle:"#1A1C29"};var v=a=>{var s=a,{variant:e="primary",title:r,loading:t=!1}=s,o=_chunkIVJEK62Cjs.c.call(void 0, s,["variant","title","loading"]);return Te.default.createElement(_reactnative.Pressable,_chunkIVJEK62Cjs.a.call(void 0, {},o),Te.default.createElement(_reactnative.View,{style:[O.buttonBox,e==="secondary"&&O.buttonBoxSecondary,e==="tertiary"&&O.buttonBoxTertiary]},t?Te.default.createElement(sr,null):Te.default.createElement(_reactnative.Text,{style:[O.buttonLabel,e==="secondary"&&O.buttonLabelSecondary,e==="tertiary"&&O.buttonLabelTertiary]},r)))},O=_reactnative.StyleSheet.create({buttonBox:{height:54,justifyContent:"center",alignItems:"center",borderRadius:14,paddingHorizontal:16,backgroundColor:m.interactive},buttonBoxSecondary:{backgroundColor:m.white,alignItems:"flex-start",borderColor:m.border,borderWidth:1,borderRadius:12},buttonBoxTertiary:{backgroundColor:m.white},buttonLabel:{fontFamily:"Inter_600SemiBold",fontSize:16,lineHeight:24,color:m.white},buttonLabelSecondary:{fontFamily:"Inter_400Regular",color:m.text},buttonLabelTertiary:{fontFamily:"Inter_500Medium",color:m.interactive}});var cr=({value:e,isFocused:r,isSuccess:t,isError:o})=>Te.default.createElement(_reactnative.View,{style:[D.box,r&&D.focusedBox,t&&D.successBox,o&&D.errorBox]},Te.default.createElement(_reactnative.Text,{style:D.text},e)),D=_reactnative.StyleSheet.create({box:{borderWidth:1,borderColor:m.border,borderRadius:12,height:64,width:48,justifyContent:"center",alignItems:"center"},focusedBox:{borderWidth:2,borderColor:m.interactive},successBox:{borderColor:m.success},errorBox:{borderColor:m.error},text:{fontFamily:"Inter_500Medium",fontSize:16,lineHeight:20,color:m.text}});var mr=6,Jt=[0,1,2,"-",3,4,5];function Ee({value:e="",status:r=" ",onChangeText:t=()=>{},editable:o=!0,success:a=!1,error:s=!1,autoFocus:n=!1}){let i=_react.useRef.call(void 0, null),[d,f]=_react.useState.call(void 0, !1),u=()=>{var c;(c=i==null?void 0:i.current)==null||c.focus()},g=c=>{let y=c.replace(/\D/g,"");t(y)},l=d?Math.min(e.length,mr-1):void 0;return Te.default.createElement(_reactnative.View,{style:W.container},Te.default.createElement(_reactnative.TextInput,{autoFocus:n,style:W.invisibleTextInput,value:e,onChangeText:g,maxLength:mr,ref:i,editable:o,onFocus:()=>f(!0),onBlur:()=>f(!1),keyboardType:"numeric"}),Te.default.createElement(_reactnative.Pressable,{onPress:u,disabled:!o},Te.default.createElement(_reactnative.View,{style:W.codeContainer},Jt.map((c,y)=>c==="-"?Te.default.createElement(Yt,{key:y}):Te.default.createElement(cr,{key:y,isFocused:l===c,value:e[c]||"",isSuccess:a,isError:s})))),Te.default.createElement(_reactnative.Text,{style:[W.statusText,a&&W.statusSuccess,s&&W.statusError]},r))}var Yt=()=>Te.default.createElement(_reactnative.Text,{style:W.separator},"-"),W=_reactnative.StyleSheet.create({container:{justifyContent:"center",paddingHorizontal:0,gap:6},invisibleTextInput:{position:"absolute",opacity:0},codeContainer:{flexDirection:"row",alignItems:"center",gap:10,justifyContent:"space-between"},separator:{fontFamily:"Inter_600SemiBold",fontSize:18,lineHeight:24,color:m.black},statusText:{textAlign:"left",color:m.textMuted,fontFamily:"Inter_400Regular",fontSize:14,lineHeight:22},statusError:{color:m.errorDark},statusSuccess:{color:m.successDark}});var F=({title:e,subtitle:r})=>Te.default.createElement(_reactnative.View,{style:Pe.titleContainer},Te.default.createElement(_reactnative.Text,{style:Pe.title},e),r&&Te.default.createElement(_reactnative.Text,{style:Pe.subtitle},r)),Pe=_reactnative.StyleSheet.create({titleContainer:{alignItems:"center",gap:16},title:{fontFamily:"Inter_600SemiBold",fontSize:20,lineHeight:32,color:m.textTitle},subtitle:{fontFamily:"Inter_400Regular",fontSize:16,lineHeight:24,color:m.textMuted,textAlign:"center"}});var hr=({hint:e,link:r,onPress:t,disabled:o})=>Te.default.createElement(_reactnative.View,{style:$.container},Te.default.createElement(_reactnative.Text,{style:$.hintText},e),r&&Te.default.createElement(_reactnative.Pressable,{onPress:t,disabled:o},Te.default.createElement(_reactnative.Text,{style:[$.linkText,o&&$.disabledLink]}," ",r))),$=_reactnative.StyleSheet.create({container:{display:"flex",flexDirection:"row",gap:2},hintText:{fontFamily:"Inter_400Regular",fontSize:14,lineHeight:22,color:m.textMuted},linkText:{fontFamily:"Inter_500Medium",fontSize:14,lineHeight:22,color:m.interactive},disabledLink:{color:m.textMuted}});var lo=3e4,co=()=>{let[e,r]=_react.useState.call(void 0, !1),t=_react.useCallback.call(void 0, ()=>{r(!1),setTimeout(()=>{r(!0)},lo)},[]);return _react.useEffect.call(void 0, ()=>{t()},[]),[e,t]},X=({loginWithCode:e,requestNewCode:r,subtitle:t,isLoading:o,error:a,isDone:s})=>{let[n,i]=_react.useState.call(void 0, ""),d=l=>{i(l),l.length===6&&e(l)},[f,u]=co(),g=()=>{r(),u()};return Te.default.createElement(_reactnative.KeyboardAvoidingView,{behavior:_reactnative.Platform.OS==="ios"?"padding":void 0,style:Me.innerContainer},Te.default.createElement(_reactnative.View,{style:{flex:1,justifyContent:"space-between",paddingHorizontal:16,paddingBottom:16}},Te.default.createElement(_reactnative.View,{style:Me.content},Te.default.createElement(_reactnative.View,{style:Me.formContainer},Te.default.createElement(F,{title:"Enter confirmation code",subtitle:t}),Te.default.createElement(Ee,{value:n,editable:!o,onChangeText:d,success:s,error:!!a,status:s?"Success.":a?uo(a):" ",autoFocus:!0}),Te.default.createElement(hr,{hint:"Didn\u2019t get an email?",link:"Resend code",onPress:g,disabled:!f}))),Te.default.createElement(v,{title:"Continue",loading:o,onPress:()=>e(n)})))},uo=_jssdkcore.createErrorFormatter.call(void 0, {invalid_credentials:"Invalid code.",invalid_data:"The code has expired.",too_many_requests:"Too many requests. Please try again later.",default:"Something went wrong. Please try again."}),Me=_reactnative.StyleSheet.create({modalContent:{backgroundColor:"#ffffff"},innerContainer:{flex:1},content:{gap:16},formContainer:{rowGap:24}});var fo=e=>Te.createElement(_reactnativesvg2.default,_chunkIVJEK62Cjs.a.call(void 0, {xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 460 40"},e),Te.createElement(_reactnativesvg.Path,{fill:e.color,d:"M0 15.4v15.38h4.64V19.96h3.58c2.47 0 3.63-.01 3.77-.02 1-.08 1.49-.15 2.18-.3a9.45 9.45 0 0 0 4.6-2.37c1.66-1.57 2.64-3.87 2.81-6.56.02-.3.02-1.19 0-1.49-.1-1.77-.56-3.35-1.36-4.72A8.84 8.84 0 0 0 15.14.57c-.93-.3-1.75-.43-3.09-.54C11.9.02 10.2 0 5.93 0H0ZM10.85 4c1.85.05 3.1.45 4.16 1.3.22.17.54.49.69.68a5.97 5.97 0 0 1 1.19 3.13c.04.35.04 1.36 0 1.71-.08.68-.23 1.3-.44 1.85a4.8 4.8 0 0 1-1.09 1.68A5.63 5.63 0 0 1 12 15.92c-.6.08-.4.08-4.01.09H4.64V3.98h2.9c1.6 0 3.08 0 3.31.02m176.8 1.71v5.72h-.27l-.09-.14a16 16 0 0 0-1.21-1.73c-.43-.5-1-.95-1.7-1.36-.54-.3-1.05-.5-1.73-.63a9 9 0 0 0-1.7-.17 8.84 8.84 0 0 0-7.8 4.03 12.95 12.95 0 0 0-2.03 6.39c-.07.98-.06 2.15.02 3.13.2 2.47.87 4.53 2.02 6.25a8.98 8.98 0 0 0 10.22 3.65 6.5 6.5 0 0 0 2.8-1.93c.41-.51.84-1.1 1.1-1.55l.1-.17h.37v3.58h4.38V0h-4.48Zm-5.24 5.54c1.3.14 2.3.6 3.17 1.48.9.9 1.5 2.09 1.85 3.64.36 1.6.39 3.72.06 5.43a8.1 8.1 0 0 1-1.54 3.62 5.1 5.1 0 0 1-3.93 1.96 6.1 6.1 0 0 1-2.32-.31 5.87 5.87 0 0 1-3.33-3.5c-.39-1-.62-2.05-.72-3.32-.03-.32-.04-1.35-.02-1.73q.12-2.34.96-4.05a6.2 6.2 0 0 1 1.06-1.58 5.08 5.08 0 0 1 3.6-1.66c.25-.02.9 0 1.16.02m27.66 4.14.01 15.38h4.38l.01-3.57h.37l.09.15c.24.44.84 1.26 1.21 1.7a6.8 6.8 0 0 0 2.57 1.75 9.3 9.3 0 0 0 6.86-.49 9.28 9.28 0 0 0 4.05-4.07A13 13 0 0 0 231 21.6c.21-1.73.18-3.7-.09-5.32a13 13 0 0 0-1.5-4.3 9.1 9.1 0 0 0-3.75-3.63 9.15 9.15 0 0 0-4.43-.96 7.5 7.5 0 0 0-2.8.5A7.1 7.1 0 0 0 216 9.7c-.4.52-.82 1.12-1.1 1.59l-.07.14h-.27V0h-4.5Zm11.13-4.14c1.07.1 1.94.44 2.7 1.04a6.1 6.1 0 0 1 1.64 1.98c.43.84.78 2 .94 3.11.15 1.16.16 2.4.02 3.54a9.34 9.34 0 0 1-1.39 4.03 5.33 5.33 0 0 1-2.69 2.15c-.9.3-2.04.38-3.06.2a5.14 5.14 0 0 1-3.45-2.37 6 6 0 0 1-.45-.8c-.5-1.03-.8-2.2-.92-3.58-.04-.49-.06-.89-.05-1.53.01-.76.05-1.23.13-1.85.38-2.53 1.47-4.38 3.15-5.31a5.5 5.5 0 0 1 2.3-.63 10 10 0 0 1 1.13.02M69.05 2.17l-.01 2.77V7.7h-3.36v3.6h3.36v6.8l.01 7.15c.06 1.4.4 2.44 1.1 3.37a5.8 5.8 0 0 0 2.97 2.07c.91.3 1.83.42 2.9.38a8.7 8.7 0 0 0 2.66-.48l-.8-3.7-.38.06a4.96 4.96 0 0 1-2.43-.06c-.33-.1-.56-.25-.8-.49-.4-.41-.6-.88-.7-1.67-.02-.2-.02-.62-.03-6.82v-6.6h4.73V7.7h-4.73V2.16h-4.49Zm64.29 0V7.7h-3.39v3.6h3.38v6.9l.01 7.17a5.66 5.66 0 0 0 2.36 4.49c.85.6 2.03 1.03 3.26 1.17.85.1 2.03.05 2.81-.1.3-.06.75-.18 1-.26l.2-.06v-.05l-.81-3.67-.37.06a5 5 0 0 1-1.8.09c-.85-.13-1.32-.4-1.7-.97a2.6 2.6 0 0 1-.39-1.04c-.06-.4-.06 0-.06-7.1V11.3h4.7V7.7h-4.7l-.01-2.77V2.16h-4.49Zm160.07.19a14.56 14.56 0 0 0-13.7 16.07 14.59 14.59 0 0 0 21.86 11.08 14.5 14.5 0 0 0 7.11-14.07 14.61 14.61 0 0 0-6.53-10.73 14.5 14.5 0 0 0-8.74-2.35m57.39 0a10.17 10.17 0 0 0-7.56 4.2c-.16.2-.45.63-.58.83l-.05.1h-.47l-.01-4.36h-7.36v36.4h7.82V27.27h.49l.05.07a11.3 11.3 0 0 0 7.49 4.15 10.52 10.52 0 0 0 9.38-4.1c1.66-2.1 2.73-4.9 3.07-8.06.1-.87.13-1.4.13-2.37 0-.8 0-1.1-.07-1.76a15.95 15.95 0 0 0-3.23-8.72 12.8 12.8 0 0 0-1.85-1.84 10.5 10.5 0 0 0-7.26-2.28Zm-.94 6.05c1.27.15 2.33.65 3.2 1.5.98.96 1.67 2.31 2.03 4 .34 1.57.38 3.68.12 5.39a9.8 9.8 0 0 1-1.04 3.25c-.14.25-.44.69-.6.89a5.35 5.35 0 0 1-4.31 2.07 5.25 5.25 0 0 1-4.41-1.9 7.4 7.4 0 0 1-1.26-2.32 14.1 14.1 0 0 1-.62-4.83c.05-1.98.38-3.53 1.02-4.85a5.63 5.63 0 0 1 2.5-2.65c.66-.34 1.3-.5 2.14-.58.18-.02 1.04 0 1.23.03m13.77-5.31-.01 3.2v3.16h1.43c1.26.01 1.44.02 1.54.04.42.09.66.28.79.62.08.23.08.08.08 2.96a912 912 0 0 1 .03 10.18v7.54h7.82v-7.4l.01-7.83c.03-.94.11-1.63.27-2.28.46-1.9 1.54-2.93 3.35-3.23.52-.08.2-.08 5-.08h4.4v-6.9h-3.1c-3.48 0-3.91.01-4.67.1-1.83.2-3.04.79-3.96 1.88-.5.6-.9 1.32-1.26 2.26l-.06.17h-.46v-4.4h-5.6c-4.46 0-5.6 0-5.6.02Zm27.17 13.85V30.8h3.87l3.86-.01V3.09h-7.73Zm9.8-13.85-.01.4v.38l4.66 13.4 4.69 13.47.02.05h10.3l.03-.05 4.67-13.45 4.67-13.4v-.8h-7.43l-6.7 19.26h-.5l-3.28-9.5-3.31-9.64-.05-.12h-3.88l-3.88.01Zm30.38 0c-.01 0-.02.19-.02.4v.39l5.08 14.59c2.8 8.02 5.08 14.6 5.08 14.61.01.02-.22.02-4.8.02h-4.82v6.42h4.95c5.09 0 5.23 0 5.87-.06 3.15-.28 5.29-1.63 6.63-4.15.28-.55.44-.95.87-2.16L459 6.78l1-2.89v-.8h-7.43l-6.69 19.26h-.5l-3.27-9.46-3.31-9.64-.06-.16h-3.88zM36.57 7.36c-1.36.1-2.6.6-3.62 1.45a5.65 5.65 0 0 0-1.67 2.42l-.05.13H31V7.7h-4.35v23.08h4.5v-7.3c0-8 0-7.34.08-7.82a4.9 4.9 0 0 1 2.06-3.18c.83-.58 1.74-.89 2.87-.98a12 12 0 0 1 2.8.25H39v-4.3l-.21-.02c-.61-.07-1.74-.1-2.22-.07m14.51.05c-2.33.12-4.3.84-5.95 2.16a9.9 9.9 0 0 0-2.03 2.2 12.5 12.5 0 0 0-2 5.78 18 18 0 0 0 0 3.65 12.13 12.13 0 0 0 2.26 6.05 9.74 9.74 0 0 0 5 3.52c2.11.64 4.7.64 6.8 0a9.8 9.8 0 0 0 4.88-3.37c1.38-1.78 2.19-4 2.4-6.58.13-1.46.06-3.06-.18-4.42a11.24 11.24 0 0 0-3.58-6.6 10 10 0 0 0-5.75-2.35c-.56-.06-1.31-.07-1.85-.04m1.42 3.78c.88.1 1.62.34 2.28.75a6.1 6.1 0 0 1 1.99 2.15 10.3 10.3 0 0 1 1.2 5c.02 1.23-.12 2.44-.42 3.51a7.14 7.14 0 0 1-1.81 3.32c-.61.6-1.2.98-1.95 1.24a6 6 0 0 1-2 .3 5.7 5.7 0 0 1-2.72-.6 5 5 0 0 1-1.28-.94A7.1 7.1 0 0 1 46 22.73c-.57-1.99-.6-4.46-.08-6.5a7.24 7.24 0 0 1 2.03-3.67 5.13 5.13 0 0 1 3.35-1.4 11 11 0 0 1 1.2.03M92.05 7.4c-.96.06-1.56.15-2.3.33a9.62 9.62 0 0 0-6.09 4.66 13.5 13.5 0 0 0-1.71 7c0 .83 0 1.04.06 1.6.16 1.77.58 3.32 1.29 4.7A9.72 9.72 0 0 0 90.28 31c1.84.37 4.08.32 5.85-.13a9.07 9.07 0 0 0 5.02-3.1A7.6 7.6 0 0 0 102.5 25l-2.11-.39-2.11-.38-.08.13a4.72 4.72 0 0 1-2.35 2.55 6.3 6.3 0 0 1-2.23.58c-.29.03-1.13.03-1.44 0a6.35 6.35 0 0 1-3.02-1.04 5.93 5.93 0 0 1-2.02-2.43 8.4 8.4 0 0 1-.72-3.18v-.26h16.38v-.81c0-1.83-.06-2.76-.25-3.87-.2-1.22-.53-2.24-1.05-3.28a8.9 8.9 0 0 0-2.66-3.26 10.1 10.1 0 0 0-5.34-1.94 18 18 0 0 0-1.46-.03Zm1.3 3.75c1.2.13 2.19.55 3.05 1.3a5.8 5.8 0 0 1 1.78 2.96c.13.51.21 1.17.21 1.66v.15H86.43v-.12c.08-.97.3-1.78.72-2.61.5-1 1.2-1.8 2.14-2.42a5.3 5.3 0 0 1 2.9-.95c.2-.01.97 0 1.17.03Zm23.44-3.74c-2 .1-3.73.65-5.22 1.65a10.7 10.7 0 0 0-4.25 6.06 16.1 16.1 0 0 0-.5 5.8c.2 2.17.84 4.13 1.88 5.76.58.9 1.32 1.73 2.15 2.4a9.4 9.4 0 0 0 3.6 1.8 12 12 0 0 0 3.92.34 10.2 10.2 0 0 0 3.84-.95 8.31 8.31 0 0 0 4.76-6.75l.01-.04h-4.37l-.05.16a4.87 4.87 0 0 1-4.24 3.75c-.59.07-1.32.06-1.93-.05a5.47 5.47 0 0 1-3.5-2.27c-.56-.75-1-1.73-1.26-2.79a13.8 13.8 0 0 1-.16-5.24 7.77 7.77 0 0 1 2.1-4.3 5.5 5.5 0 0 1 2.15-1.3 6.4 6.4 0 0 1 3.89.1c.59.21 1.03.5 1.5.96a5.3 5.3 0 0 1 1.46 2.5l.04.15h4.37v-.06a8.22 8.22 0 0 0-5.31-6.94 11 11 0 0 0-4.88-.74m39.41 0a9.87 9.87 0 0 0-6 2.29 11 11 0 0 0-3.41 5.43c-.52 1.78-.68 3.9-.48 5.97.17 1.8.63 3.38 1.37 4.8a9.68 9.68 0 0 0 5.91 4.86c1.65.48 3.63.61 5.53.36 3.72-.49 6.55-2.62 7.56-5.69.12-.39.13-.42.1-.43-.02 0-4.13-.75-4.19-.75-.03 0-.04 0-.1.16-.18.42-.45.9-.72 1.22-.16.2-.49.53-.7.7-.67.54-1.5.9-2.43 1.08-.48.08-.83.11-1.41.11-.64 0-1.07-.04-1.6-.15a5.76 5.76 0 0 1-3.93-2.83 8 8 0 0 1-.99-3.79v-.16h16.38v-1.11l-.02-1.43c-.1-2.25-.53-4-1.35-5.59a9.24 9.24 0 0 0-6.18-4.75c-1.04-.26-2.2-.36-3.33-.3Zm1.45 3.74a5.35 5.35 0 0 1 3.66 1.94 6.1 6.1 0 0 1 1.38 4.01v.12h-11.97v-.06c0-.02 0-.14.02-.25a6.6 6.6 0 0 1 2.15-4.32 5.73 5.73 0 0 1 3.5-1.46c.25-.02 1 0 1.26.02m75.93-3.33 8.37 23.22a49 49 0 0 1-.67 1.9 5.4 5.4 0 0 1-1.14 1.8c-.41.4-.82.58-1.48.69-.27.04-1.03.03-1.35 0a8 8 0 0 1-1.1-.23l-1.08 3.67c0 .02.32.14.66.22.83.21 1.57.29 2.56.28.56-.01.8-.03 1.24-.1 2.71-.4 4.66-2.09 5.86-5.08l9.64-26.44c0-.02-4.82-.06-4.83-.05l-2.93 8.96-2.91 8.94h-.24l-.22-.65-2.91-8.95-2.7-8.3h-4.82Zm59.47 27.98c-1.18.04-1.93.09-2.8.16-2.52.24-4.53.69-5.43 1.23-.7.41-.76.86-.2 1.28.88.66 3.29 1.19 6.36 1.4a49 49 0 0 0 5.75.05c3.47-.19 6.24-.78 7.11-1.5.22-.19.3-.34.3-.53 0-.1 0-.12-.04-.22-.35-.69-2.32-1.3-5.25-1.63a41 41 0 0 0-5.8-.24m0 0"})),yr=fo;var ee=()=>Te.default.createElement(_reactnative.View,{style:yo.legalFooterContainer},Te.default.createElement(yr,{color:m.brand,width:"100%",height:11})),yo=_reactnative.StyleSheet.create({legalFooterContainer:{flexDirection:"row",alignItems:"center",marginVertical:16,justifyContent:"center",gap:2}});var B=a=>{var s=a,{error:e,status:r,LeftIcon:t}=s,o=_chunkIVJEK62Cjs.c.call(void 0, s,["error","status","LeftIcon"]);let[n,i]=_react.useState.call(void 0, !1);return Te.default.createElement(_reactnative.View,{style:A.container},Te.default.createElement(_reactnative.View,{style:[A.inputBox,n&&A.inputBoxFocused,e&&A.inputBoxError]},t,Te.default.createElement(_reactnative.TextInput,_chunkIVJEK62Cjs.a.call(void 0, {cursorColor:m.interactive,placeholderTextColor:m.placeholder,onFocus:()=>i(!0),onBlur:()=>i(!1),autoCapitalize:"none",returnKeyType:"next",multiline:!1,numberOfLines:1,style:A.input},o))),r&&Te.default.createElement(_reactnative.Text,{style:[A.statusText,e&&A.statusError]},r))},A=_reactnative.StyleSheet.create({container:{gap:6},input:{flex:1,fontFamily:"Inter_400Regular",fontSize:18,height:30,color:m.text},inputBox:{flexDirection:"row",paddingHorizontal:16,height:64,backgroundColor:m.inputBackground,borderRadius:14,alignItems:"center",columnGap:10,borderWidth:2,borderColor:m.border},inputBoxFocused:{borderColor:m.interactive},inputBoxError:{borderColor:m.error},statusText:{textAlign:"left",color:m.textMuted,fontFamily:"Inter_400Regular",fontSize:14,lineHeight:22},statusError:{color:m.errorDark}});var xo=e=>We.createElement(_reactnativesvg2.default,_chunkIVJEK62Cjs.a.call(void 0, {xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),We.createElement(_reactnativesvg.Path,{stroke:e.color,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7m2-3h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2"})),wr=xo;var kr=({sendCode:e,isLoading:r,error:t,initialEmail:o,FooterComponent:a})=>{let[s,n]=_react.useState.call(void 0, o!=null?o:"");return Te.default.createElement(_reactnative.KeyboardAvoidingView,{behavior:_reactnative.Platform.OS==="ios"?"padding":void 0,style:oe.innerContainer},Te.default.createElement(_reactnative.View,{style:{flex:1,justifyContent:"space-between",paddingHorizontal:16,paddingBottom:16}},Te.default.createElement(_reactnative.View,{style:oe.content},Te.default.createElement(_reactnative.View,{style:oe.content},Te.default.createElement(_reactnative.View,{style:oe.formContainer},Te.default.createElement(F,{title:"Enter your email"}),Te.default.createElement(B,{LeftIcon:Te.default.createElement(wr,{color:m.icon}),value:s,onChangeText:n,error:!!t,status:t?To(t):" ",placeholder:"your@email.com",autoComplete:"email",keyboardType:"email-address",autoFocus:!0})),a),Te.default.createElement(ee,null)),Te.default.createElement(v,{title:"Continue",loading:r,onPress:()=>e(s)})))},To=_jssdkcore.createErrorFormatter.call(void 0, {invalid_data:"Invalid email address.",too_many_requests:"Too many requests. Please try again later.",default:"Something went wrong. Please try again."}),oe=_reactnative.StyleSheet.create({innerContainer:{flex:1},content:{gap:4},formContainer:{rowGap:24}});var ne=({onLoginMethodChange:e,otherLoginMethod:r})=>r?Te.default.createElement(v,{variant:"tertiary",title:`Use ${_chunkIVJEK62Cjs.r[r]} instead`,onPress:()=>e(r)}):null;var Io=600,xr=({goBackRef:e,onLoginMethodChange:r,otherLoginMethod:t})=>{let{setOtpState:o}=_react.useContext.call(void 0, _chunkIVJEK62Cjs.x),a=_chunkIVJEK62Cjs.u.call(void 0, ),[s,n]=_react.useState.call(void 0, ""),{state:i,loginWithCode:d,sendCode:f}=Xe(),[u,g]=_react.useState.call(void 0, "email"),{step:l,error:c=null,isLoading:y=!1,isDone:C=!1}=_react.useMemo.call(void 0, ()=>{var p;switch(i.status){case"initial":return{step:{type:"email"}};case"sending-code":return{step:{type:u},isLoading:!0};case"awaiting-code-input":return{step:{type:"code"}};case"submitting-code":return{step:{type:"code"},isLoading:!0};case"done":return{step:{type:"code"},isDone:!0};case"error":return{step:{type:u},error:(p=i.error)!=null?p:new Error("Unknown error")}}},[u,i.status]);switch(u!==l.type&&g(l.type),_react.useEffect.call(void 0, ()=>{if(!C)return;let p=setTimeout(()=>{a()},Io);return()=>clearTimeout(p)},[C,a]),_react.useEffect.call(void 0, ()=>{if(l.type==="code")return e.current=()=>{o({status:"initial"})},()=>{e.current=null}},[l.type,o]),l.type){case"code":return Te.default.createElement(X,{loginWithCode:p=>d({code:p,email:s}),requestNewCode:()=>f({email:s}),subtitle:`Please check ${s} for a message with your login code.`,isLoading:y,error:c,isDone:C});case"email":return Te.default.createElement(kr,{initialEmail:s,sendCode:p=>{n(p),f({email:p})},isLoading:y,error:c,FooterComponent:Te.default.createElement(ne,{onLoginMethodChange:r,otherLoginMethod:t})})}};function Er(e,r){let[t,o]=_react.useState.call(void 0, e);return _react.useEffect.call(void 0, ()=>{let a=setTimeout(()=>{o(e)},r);return()=>{clearTimeout(a)}},[e,r]),t}var Lr=[["Afghanistan","AF","\u{1F1E6}\u{1F1EB}"],["Albania","AL","\u{1F1E6}\u{1F1F1}"],["Algeria","DZ","\u{1F1E9}\u{1F1FF}"],["American Samoa","AS","\u{1F1E6}\u{1F1F8}"],["Andorra","AD","\u{1F1E6}\u{1F1E9}"],["Angola","AO","\u{1F1E6}\u{1F1F4}"],["Anguilla","AI","\u{1F1E6}\u{1F1EE}"],["Antigua & Barbuda","AG","\u{1F1E6}\u{1F1EC}"],["Argentina","AR","\u{1F1E6}\u{1F1F7}"],["Armenia","AM","\u{1F1E6}\u{1F1F2}"],["Aruba","AW","\u{1F1E6}\u{1F1FC}"],["Ascension Island","AC","\u{1F1E6}\u{1F1E8}"],["Australia","AU","\u{1F1E6}\u{1F1FA}"],["Austria","AT","\u{1F1E6}\u{1F1F9}"],["Azerbaijan","AZ","\u{1F1E6}\u{1F1FF}"],["Bahamas","BS","\u{1F1E7}\u{1F1F8}"],["Bahrain","BH","\u{1F1E7}\u{1F1ED}"],["Bangladesh","BD","\u{1F1E7}\u{1F1E9}"],["Barbados","BB","\u{1F1E7}\u{1F1E7}"],["Belarus","BY","\u{1F1E7}\u{1F1FE}"],["Belgium","BE","\u{1F1E7}\u{1F1EA}"],["Belize","BZ","\u{1F1E7}\u{1F1FF}"],["Benin","BJ","\u{1F1E7}\u{1F1EF}"],["Bermuda","BM","\u{1F1E7}\u{1F1F2}"],["Bhutan","BT","\u{1F1E7}\u{1F1F9}"],["Bolivia","BO","\u{1F1E7}\u{1F1F4}"],["Bosnia & Herzegovina","BA","\u{1F1E7}\u{1F1E6}"],["Botswana","BW","\u{1F1E7}\u{1F1FC}"],["Brazil","BR","\u{1F1E7}\u{1F1F7}"],["British Indian Ocean Territory","IO","\u{1F1EE}\u{1F1F4}"],["British Virgin Islands","VG","\u{1F1FB}\u{1F1EC}"],["Brunei","BN","\u{1F1E7}\u{1F1F3}"],["Bulgaria","BG","\u{1F1E7}\u{1F1EC}"],["Burkina Faso","BF","\u{1F1E7}\u{1F1EB}"],["Burundi","BI","\u{1F1E7}\u{1F1EE}"],["Cambodia","KH","\u{1F1F0}\u{1F1ED}"],["Cameroon","CM","\u{1F1E8}\u{1F1F2}"],["Canada","CA","\u{1F1E8}\u{1F1E6}"],["Cape Verde","CV","\u{1F1E8}\u{1F1FB}"],["Caribbean Netherlands","BQ","\u{1F1E7}\u{1F1F6}"],["Cayman Islands","KY","\u{1F1F0}\u{1F1FE}"],["Central African Republic","CF","\u{1F1E8}\u{1F1EB}"],["Chad","TD","\u{1F1F9}\u{1F1E9}"],["Chile","CL","\u{1F1E8}\u{1F1F1}"],["China","CN","\u{1F1E8}\u{1F1F3}"],["Christmas Island","CX","\u{1F1E8}\u{1F1FD}"],["Cocos (Keeling) Islands","CC","\u{1F1E8}\u{1F1E8}"],["Colombia","CO","\u{1F1E8}\u{1F1F4}"],["Comoros","KM","\u{1F1F0}\u{1F1F2}"],["Congo - Brazzaville","CG","\u{1F1E8}\u{1F1EC}"],["Congo - Kinshasa","CD","\u{1F1E8}\u{1F1E9}"],["Cook Islands","CK","\u{1F1E8}\u{1F1F0}"],["Costa Rica","CR","\u{1F1E8}\u{1F1F7}"],["Croatia","HR","\u{1F1ED}\u{1F1F7}"],["Cuba","CU","\u{1F1E8}\u{1F1FA}"],["Cura\xE7ao","CW","\u{1F1E8}\u{1F1FC}"],["Cyprus","CY","\u{1F1E8}\u{1F1FE}"],["Czechia","CZ","\u{1F1E8}\u{1F1FF}"],["C\xF4te d\u2019Ivoire","CI","\u{1F1E8}\u{1F1EE}"],["Denmark","DK","\u{1F1E9}\u{1F1F0}"],["Djibouti","DJ","\u{1F1E9}\u{1F1EF}"],["Dominica","DM","\u{1F1E9}\u{1F1F2}"],["Dominican Republic","DO","\u{1F1E9}\u{1F1F4}"],["Ecuador","EC","\u{1F1EA}\u{1F1E8}"],["Egypt","EG","\u{1F1EA}\u{1F1EC}"],["El Salvador","SV","\u{1F1F8}\u{1F1FB}"],["Equatorial Guinea","GQ","\u{1F1EC}\u{1F1F6}"],["Eritrea","ER","\u{1F1EA}\u{1F1F7}"],["Estonia","EE","\u{1F1EA}\u{1F1EA}"],["Eswatini","SZ","\u{1F1F8}\u{1F1FF}"],["Ethiopia","ET","\u{1F1EA}\u{1F1F9}"],["Falkland Islands","FK","\u{1F1EB}\u{1F1F0}"],["Faroe Islands","FO","\u{1F1EB}\u{1F1F4}"],["Fiji","FJ","\u{1F1EB}\u{1F1EF}"],["Finland","FI","\u{1F1EB}\u{1F1EE}"],["France","FR","\u{1F1EB}\u{1F1F7}"],["French Guiana","GF","\u{1F1EC}\u{1F1EB}"],["French Polynesia","PF","\u{1F1F5}\u{1F1EB}"],["Gabon","GA","\u{1F1EC}\u{1F1E6}"],["Gambia","GM","\u{1F1EC}\u{1F1F2}"],["Georgia","GE","\u{1F1EC}\u{1F1EA}"],["Germany","DE","\u{1F1E9}\u{1F1EA}"],["Ghana","GH","\u{1F1EC}\u{1F1ED}"],["Gibraltar","GI","\u{1F1EC}\u{1F1EE}"],["Greece","GR","\u{1F1EC}\u{1F1F7}"],["Greenland","GL","\u{1F1EC}\u{1F1F1}"],["Grenada","GD","\u{1F1EC}\u{1F1E9}"],["Guadeloupe","GP","\u{1F1EC}\u{1F1F5}"],["Guam","GU","\u{1F1EC}\u{1F1FA}"],["Guatemala","GT","\u{1F1EC}\u{1F1F9}"],["Guernsey","GG","\u{1F1EC}\u{1F1EC}"],["Guinea","GN","\u{1F1EC}\u{1F1F3}"],["Guinea-Bissau","GW","\u{1F1EC}\u{1F1FC}"],["Guyana","GY","\u{1F1EC}\u{1F1FE}"],["Haiti","HT","\u{1F1ED}\u{1F1F9}"],["Honduras","HN","\u{1F1ED}\u{1F1F3}"],["Hong Kong SAR China","HK","\u{1F1ED}\u{1F1F0}"],["Hungary","HU","\u{1F1ED}\u{1F1FA}"],["Iceland","IS","\u{1F1EE}\u{1F1F8}"],["India","IN","\u{1F1EE}\u{1F1F3}"],["Indonesia","ID","\u{1F1EE}\u{1F1E9}"],["Iran","IR","\u{1F1EE}\u{1F1F7}"],["Iraq","IQ","\u{1F1EE}\u{1F1F6}"],["Ireland","IE","\u{1F1EE}\u{1F1EA}"],["Isle of Man","IM","\u{1F1EE}\u{1F1F2}"],["Israel","IL","\u{1F1EE}\u{1F1F1}"],["Italy","IT","\u{1F1EE}\u{1F1F9}"],["Jamaica","JM","\u{1F1EF}\u{1F1F2}"],["Japan","JP","\u{1F1EF}\u{1F1F5}"],["Jersey","JE","\u{1F1EF}\u{1F1EA}"],["Jordan","JO","\u{1F1EF}\u{1F1F4}"],["Kazakhstan","KZ","\u{1F1F0}\u{1F1FF}"],["Kenya","KE","\u{1F1F0}\u{1F1EA}"],["Kiribati","KI","\u{1F1F0}\u{1F1EE}"],["Kosovo","XK","\u{1F1FD}\u{1F1F0}"],["Kuwait","KW","\u{1F1F0}\u{1F1FC}"],["Kyrgyzstan","KG","\u{1F1F0}\u{1F1EC}"],["Laos","LA","\u{1F1F1}\u{1F1E6}"],["Latvia","LV","\u{1F1F1}\u{1F1FB}"],["Lebanon","LB","\u{1F1F1}\u{1F1E7}"],["Lesotho","LS","\u{1F1F1}\u{1F1F8}"],["Liberia","LR","\u{1F1F1}\u{1F1F7}"],["Libya","LY","\u{1F1F1}\u{1F1FE}"],["Liechtenstein","LI","\u{1F1F1}\u{1F1EE}"],["Lithuania","LT","\u{1F1F1}\u{1F1F9}"],["Luxembourg","LU","\u{1F1F1}\u{1F1FA}"],["Macao SAR China","MO","\u{1F1F2}\u{1F1F4}"],["Madagascar","MG","\u{1F1F2}\u{1F1EC}"],["Malawi","MW","\u{1F1F2}\u{1F1FC}"],["Malaysia","MY","\u{1F1F2}\u{1F1FE}"],["Maldives","MV","\u{1F1F2}\u{1F1FB}"],["Mali","ML","\u{1F1F2}\u{1F1F1}"],["Malta","MT","\u{1F1F2}\u{1F1F9}"],["Marshall Islands","MH","\u{1F1F2}\u{1F1ED}"],["Martinique","MQ","\u{1F1F2}\u{1F1F6}"],["Mauritania","MR","\u{1F1F2}\u{1F1F7}"],["Mauritius","MU","\u{1F1F2}\u{1F1FA}"],["Mayotte","YT","\u{1F1FE}\u{1F1F9}"],["Mexico","MX","\u{1F1F2}\u{1F1FD}"],["Micronesia","FM","\u{1F1EB}\u{1F1F2}"],["Moldova","MD","\u{1F1F2}\u{1F1E9}"],["Monaco","MC","\u{1F1F2}\u{1F1E8}"],["Mongolia","MN","\u{1F1F2}\u{1F1F3}"],["Montenegro","ME","\u{1F1F2}\u{1F1EA}"],["Montserrat","MS","\u{1F1F2}\u{1F1F8}"],["Morocco","MA","\u{1F1F2}\u{1F1E6}"],["Mozambique","MZ","\u{1F1F2}\u{1F1FF}"],["Myanmar (Burma)","MM","\u{1F1F2}\u{1F1F2}"],["Namibia","NA","\u{1F1F3}\u{1F1E6}"],["Nauru","NR","\u{1F1F3}\u{1F1F7}"],["Nepal","NP","\u{1F1F3}\u{1F1F5}"],["Netherlands","NL","\u{1F1F3}\u{1F1F1}"],["New Caledonia","NC","\u{1F1F3}\u{1F1E8}"],["New Zealand","NZ","\u{1F1F3}\u{1F1FF}"],["Nicaragua","NI","\u{1F1F3}\u{1F1EE}"],["Niger","NE","\u{1F1F3}\u{1F1EA}"],["Nigeria","NG","\u{1F1F3}\u{1F1EC}"],["Niue","NU","\u{1F1F3}\u{1F1FA}"],["Norfolk Island","NF","\u{1F1F3}\u{1F1EB}"],["North Korea","KP","\u{1F1F0}\u{1F1F5}"],["North Macedonia","MK","\u{1F1F2}\u{1F1F0}"],["Northern Mariana Islands","MP","\u{1F1F2}\u{1F1F5}"],["Norway","NO","\u{1F1F3}\u{1F1F4}"],["Oman","OM","\u{1F1F4}\u{1F1F2}"],["Pakistan","PK","\u{1F1F5}\u{1F1F0}"],["Palau","PW","\u{1F1F5}\u{1F1FC}"],["Palestinian Territories","PS","\u{1F1F5}\u{1F1F8}"],["Panama","PA","\u{1F1F5}\u{1F1E6}"],["Papua New Guinea","PG","\u{1F1F5}\u{1F1EC}"],["Paraguay","PY","\u{1F1F5}\u{1F1FE}"],["Peru","PE","\u{1F1F5}\u{1F1EA}"],["Philippines","PH","\u{1F1F5}\u{1F1ED}"],["Poland","PL","\u{1F1F5}\u{1F1F1}"],["Portugal","PT","\u{1F1F5}\u{1F1F9}"],["Puerto Rico","PR","\u{1F1F5}\u{1F1F7}"],["Qatar","QA","\u{1F1F6}\u{1F1E6}"],["Romania","RO","\u{1F1F7}\u{1F1F4}"],["Russia","RU","\u{1F1F7}\u{1F1FA}"],["Rwanda","RW","\u{1F1F7}\u{1F1FC}"],["R\xE9union","RE","\u{1F1F7}\u{1F1EA}"],["Samoa","WS","\u{1F1FC}\u{1F1F8}"],["San Marino","SM","\u{1F1F8}\u{1F1F2}"],["Saudi Arabia","SA","\u{1F1F8}\u{1F1E6}"],["Senegal","SN","\u{1F1F8}\u{1F1F3}"],["Serbia","RS","\u{1F1F7}\u{1F1F8}"],["Seychelles","SC","\u{1F1F8}\u{1F1E8}"],["Sierra Leone","SL","\u{1F1F8}\u{1F1F1}"],["Singapore","SG","\u{1F1F8}\u{1F1EC}"],["Sint Maarten","SX","\u{1F1F8}\u{1F1FD}"],["Slovakia","SK","\u{1F1F8}\u{1F1F0}"],["Slovenia","SI","\u{1F1F8}\u{1F1EE}"],["Solomon Islands","SB","\u{1F1F8}\u{1F1E7}"],["Somalia","SO","\u{1F1F8}\u{1F1F4}"],["South Africa","ZA","\u{1F1FF}\u{1F1E6}"],["South Korea","KR","\u{1F1F0}\u{1F1F7}"],["South Sudan","SS","\u{1F1F8}\u{1F1F8}"],["Spain","ES","\u{1F1EA}\u{1F1F8}"],["Sri Lanka","LK","\u{1F1F1}\u{1F1F0}"],["St. Barth\xE9lemy","BL","\u{1F1E7}\u{1F1F1}"],["St. Helena","SH","\u{1F1F8}\u{1F1ED}"],["St. Kitts & Nevis","KN","\u{1F1F0}\u{1F1F3}"],["St. Lucia","LC","\u{1F1F1}\u{1F1E8}"],["St. Martin","MF","\u{1F1F2}\u{1F1EB}"],["St. Pierre & Miquelon","PM","\u{1F1F5}\u{1F1F2}"],["St. Vincent & Grenadines","VC","\u{1F1FB}\u{1F1E8}"],["Sudan","SD","\u{1F1F8}\u{1F1E9}"],["Suriname","SR","\u{1F1F8}\u{1F1F7}"],["Svalbard & Jan Mayen","SJ","\u{1F1F8}\u{1F1EF}"],["Sweden","SE","\u{1F1F8}\u{1F1EA}"],["Switzerland","CH","\u{1F1E8}\u{1F1ED}"],["Syria","SY","\u{1F1F8}\u{1F1FE}"],["S\xE3o Tom\xE9 & Pr\xEDncipe","ST","\u{1F1F8}\u{1F1F9}"],["Taiwan","TW","\u{1F1F9}\u{1F1FC}"],["Tajikistan","TJ","\u{1F1F9}\u{1F1EF}"],["Tanzania","TZ","\u{1F1F9}\u{1F1FF}"],["Thailand","TH","\u{1F1F9}\u{1F1ED}"],["Timor-Leste","TL","\u{1F1F9}\u{1F1F1}"],["Togo","TG","\u{1F1F9}\u{1F1EC}"],["Tokelau","TK","\u{1F1F9}\u{1F1F0}"],["Tonga","TO","\u{1F1F9}\u{1F1F4}"],["Trinidad & Tobago","TT","\u{1F1F9}\u{1F1F9}"],["Tristan da Cunha","TA","\u{1F1F9}\u{1F1E6}"],["Tunisia","TN","\u{1F1F9}\u{1F1F3}"],["Turkey","TR","\u{1F1F9}\u{1F1F7}"],["Turkmenistan","TM","\u{1F1F9}\u{1F1F2}"],["Turks & Caicos Islands","TC","\u{1F1F9}\u{1F1E8}"],["Tuvalu","TV","\u{1F1F9}\u{1F1FB}"],["U.S. Virgin Islands","VI","\u{1F1FB}\u{1F1EE}"],["Uganda","UG","\u{1F1FA}\u{1F1EC}"],["Ukraine","UA","\u{1F1FA}\u{1F1E6}"],["United Arab Emirates","AE","\u{1F1E6}\u{1F1EA}"],["United Kingdom","GB","\u{1F1EC}\u{1F1E7}"],["United States","US","\u{1F1FA}\u{1F1F8}"],["Uruguay","UY","\u{1F1FA}\u{1F1FE}"],["Uzbekistan","UZ","\u{1F1FA}\u{1F1FF}"],["Vanuatu","VU","\u{1F1FB}\u{1F1FA}"],["Vatican City","VA","\u{1F1FB}\u{1F1E6}"],["Venezuela","VE","\u{1F1FB}\u{1F1EA}"],["Vietnam","VN","\u{1F1FB}\u{1F1F3}"],["Wallis & Futuna","WF","\u{1F1FC}\u{1F1EB}"],["Western Sahara","EH","\u{1F1EA}\u{1F1ED}"],["Yemen","YE","\u{1F1FE}\u{1F1EA}"],["Zambia","ZM","\u{1F1FF}\u{1F1F2}"],["Zimbabwe","ZW","\u{1F1FF}\u{1F1FC}"],["\xC5land Islands","AX","\u{1F1E6}\u{1F1FD}"]];var Ho=Lr,Pr=Ho.map(([e,r,t])=>({name:e,code:r,callCode:_jssdkcore.getCountryCallingCode.call(void 0, r),flag:t}));var Do=e=>_e.createElement(_reactnativesvg2.default,_chunkIVJEK62Cjs.a.call(void 0, {xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),_e.createElement(_reactnativesvg.Path,{stroke:e.color,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 6 9 17l-5-5"})),Fr=Do;var Tr=({country:e,onPress:r,selected:t})=>Te.default.createElement(_reactnative.Pressable,{onPress:r},Te.default.createElement(_reactnative.View,{style:Ie.row},Te.default.createElement(_reactnative.Text,{style:Ie.rowFlag},e.flag),Te.default.createElement(_reactnative.Text,{style:Ie.rowLabel},e.name," (+",e.callCode,")"),t&&Te.default.createElement(Fr,{color:m.interactive}))),Ie=_reactnative.StyleSheet.create({row:{flexDirection:"row",alignItems:"center",gap:10,height:56},rowFlag:{fontFamily:"Inter_400Regular",fontSize:17,lineHeight:22},rowLabel:{flex:1,fontFamily:"Inter_400Regular",fontSize:17,lineHeight:22,color:m.black}});var qo=e=>Ue.createElement(_reactnativesvg2.default,_chunkIVJEK62Cjs.a.call(void 0, {xmlns:"http://www.w3.org/2000/svg",width:17,height:16,fill:"none",viewBox:"0 0 17 16"},e),Ue.createElement(_reactnativesvg.Path,{fill:e.color,fillRule:"evenodd",d:"M7.01 12.01a5.5 5.5 0 1 1 4.304-2.075.7.7 0 0 1 .156.115l3.818 3.819a.65.65 0 0 1-.92.92l-3.818-3.82a.7.7 0 0 1-.115-.155A5.48 5.48 0 0 1 7.01 12.01m4.5-5.5a4.5 4.5 0 1 1-9 0 4.5 4.5 0 0 1 9 0",clipRule:"evenodd"})),Wr=qo;var tn=600,_r=({countryCode:e,onChangeCountryCode:r,onComplete:t})=>{let[o,a]=_react.useState.call(void 0, ""),s=Er(o,tn),n=_react.useMemo.call(void 0, ()=>Pr.filter(i=>i.name.toLowerCase().includes(s.toLowerCase())),[s]);return Te.default.createElement(_reactnative.KeyboardAvoidingView,{behavior:_reactnative.Platform.OS==="ios"?"padding":void 0,style:Ar.innerContainer},Te.default.createElement(_reactnative.View,{style:Ar.header},Te.default.createElement(F,{title:"Select country code"}),Te.default.createElement(B,{LeftIcon:Te.default.createElement(Wr,{color:m.placeholder}),value:o,onChangeText:a,placeholder:"Search country"})),Te.default.createElement(_reactnative.FlatList,{style:{flex:1},data:n,keyExtractor:i=>`country-option-${i.code}`,renderItem:({item:i})=>Te.default.createElement(Tr,{country:i,selected:i.code===e,onPress:()=>{r(i.code),t()}})}),Te.default.createElement(v,{title:"Continue",onPress:t}))},Ar=_reactnative.StyleSheet.create({innerContainer:{flex:1,paddingHorizontal:16},header:{gap:20}});var an=e=>Oe.createElement(_reactnativesvg2.default,_chunkIVJEK62Cjs.a.call(void 0, {xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},e),Oe.createElement(_reactnativesvg.Path,{stroke:e.color,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"m4 6 4 4 4-4"})),Ir=an;var Or=({countryCode:e,onPress:r})=>Te.default.createElement(_reactnative.Pressable,{onPress:r},Te.default.createElement(_reactnative.View,{style:Ur.cell},Te.default.createElement(_reactnative.Text,{style:Ur.text},e," +",_jssdkcore.getCountryCallingCode.call(void 0, e)),Te.default.createElement(Ir,{color:m.icon}))),Ur=_reactnative.StyleSheet.create({cell:{flexDirection:"row",alignItems:"center",gap:6},text:{fontFamily:"Inter_400Regular",fontSize:18,lineHeight:30,color:m.text}});var Br=({sendCode:e,isLoading:r,error:t,initialPhone:o,FooterComponent:a})=>{let[s,n]=_react.useState.call(void 0, o!=null?o:""),[i,d]=_react.useState.call(void 0, "US"),[f,u]=_react.useState.call(void 0, !1),g=_jssdkcore.phoneNumberTypingFormatter.call(void 0, i),l=_jssdkcore.getPlaceholderPhoneNumber.call(void 0, i),c=y=>{try{let C=y.replace(/\D/g,""),p=s.replace(/\D/g,""),E=C===p?y:g.input(y);n(E)}catch(C){console.error("Error processing phone number:",C),n("")}};return f?Te.default.createElement(_r,{countryCode:i,onChangeCountryCode:d,onComplete:()=>u(!1)}):Te.default.createElement(_reactnative.KeyboardAvoidingView,{behavior:_reactnative.Platform.OS==="ios"?"padding":void 0,style:se.innerContainer},Te.default.createElement(_reactnative.View,{style:{flex:1,justifyContent:"space-between",paddingHorizontal:16,paddingBottom:16}},Te.default.createElement(_reactnative.View,{style:se.content},Te.default.createElement(_reactnative.View,{style:se.content},Te.default.createElement(_reactnative.View,{style:se.formContainer},Te.default.createElement(F,{title:"Enter your phone"}),Te.default.createElement(B,{LeftIcon:Te.default.createElement(Or,{countryCode:i,onPress:()=>u(!0)}),value:s,onChangeText:c,error:!!t,status:t?Sn(t):" ",placeholder:l,autoComplete:"tel",keyboardType:"phone-pad",autoFocus:!0})),a),Te.default.createElement(ee,null)),Te.default.createElement(v,{title:"Continue",loading:r,onPress:()=>e(s)})))},Sn=_jssdkcore.createErrorFormatter.call(void 0, {invalid_data:"Phone is incorrect.",not_supported:"Region or carrier not yet supported.",too_many_requests:"Too many requests. Please try again later.",default:"Something went wrong. Please try again."}),se=_reactnative.StyleSheet.create({innerContainer:{flex:1},content:{gap:4},formContainer:{rowGap:24}});var kn=600,Gr=({goBackRef:e,onLoginMethodChange:r,otherLoginMethod:t})=>{let{setOtpState:o}=_react.useContext.call(void 0, _chunkIVJEK62Cjs.x),a=_chunkIVJEK62Cjs.u.call(void 0, ),[s,n]=_react.useState.call(void 0, ""),{state:i,loginWithCode:d,sendCode:f}=tr(),[u,g]=_react.useState.call(void 0, "phone"),{step:l,error:c=null,isLoading:y=!1,isDone:C=!1}=_react.useMemo.call(void 0, ()=>{var p;switch(i.status){case"initial":return{step:{type:"phone"}};case"sending-code":return{step:{type:u},isLoading:!0};case"awaiting-code-input":return{step:{type:"code"}};case"submitting-code":return{step:{type:"code"},isLoading:!0};case"done":return{step:{type:"code"},isDone:!0};case"error":return{step:{type:u},error:(p=i.error)!=null?p:new Error("Unknown error")}}},[u,i.status]);switch(u!==l.type&&g(l.type),_react.useEffect.call(void 0, ()=>{if(!C)return;let p=setTimeout(()=>{a()},kn);return()=>clearTimeout(p)},[C,a]),_react.useEffect.call(void 0, ()=>{if(l.type==="code")return e.current=()=>{o({status:"initial"})},()=>{e.current=null}},[l.type,o,a]),l.type){case"phone":return Te.default.createElement(Br,{initialPhone:s,sendCode:p=>{n(p),f({phone:p})},isLoading:y,error:c,FooterComponent:Te.default.createElement(ne,{onLoginMethodChange:r,otherLoginMethod:t})});case"code":return Te.default.createElement(X,{loginWithCode:p=>d({code:p,phone:s}),requestNewCode:()=>f({phone:s}),subtitle:`Please check ${s} for a message with your login code.`,isLoading:y,error:c,isDone:C})}};var xn=e=>He.createElement(_reactnativesvg2.default,_chunkIVJEK62Cjs.a.call(void 0, {xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),He.createElement(_reactnativesvg.Path,{fill:e.color,d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"})),Nr=xn;var Rr=({goBack:e})=>Te.default.createElement(_reactnative.View,{style:Kr.navigationBar},Te.default.createElement(Pn,{onPress:e})),Pn=e=>Te.default.createElement(_reactnative.Pressable,_chunkIVJEK62Cjs.a.call(void 0, {},e),Te.default.createElement(_reactnative.View,{style:Kr.backButton},Te.default.createElement(Nr,{color:m.icon}))),Kr=_reactnative.StyleSheet.create({navigationBar:{height:48},backButton:{width:48,height:48,justifyContent:"center",alignItems:"center"}});var _reactnativesafeareacontext = require('react-native-safe-area-context');var Wn=()=>{let e=_reactnativesafeareacontext.useSafeAreaInsets.call(void 0, );return{paddingTop:e.top,paddingBottom:e.bottom,paddingLeft:e.left,paddingRight:e.right}},jr=({children:e,visible:r})=>{let t=Wn();return Te.default.createElement(_reactnative.Modal,{animationType:"slide",transparent:!0,visible:r},Te.default.createElement(_reactnative.View,{style:[_reactnative.StyleSheet.absoluteFill,An.modalContent,t]},e))},An=_reactnative.StyleSheet.create({modalContent:{backgroundColor:m.white}});var Un=({config:e,goBackRef:r})=>{let[t,o]=_react.useState.call(void 0, ()=>_chunkIVJEK62Cjs.p.call(void 0, e.loginMethods)),a=t&&_chunkIVJEK62Cjs.q.call(void 0, e.loginMethods,t);switch(t){case"email":return Te.default.createElement(xr,{goBackRef:r,otherLoginMethod:a,onLoginMethodChange:o});case"sms":return Te.default.createElement(Gr,{goBackRef:r,otherLoginMethod:a,onLoginMethodChange:o});default:throw new (0, _chunkIVJEK62Cjs.o)("unsupported_login_method",`Unsupported login method: ${t}`)}},On= exports.PrivyElements =()=>{let e=_chunkIVJEK62Cjs.u.call(void 0, ),r=_chunkIVJEK62Cjs.s.call(void 0, ),t=_chunkIVJEK62Cjs.w.call(void 0, );_chunkIVJEK62Cjs.v.call(void 0, );let o=_react.useRef.call(void 0, null);return Te.default.createElement(jr,{visible:t},Te.default.createElement(Rr,{goBack:()=>{var a;return((a=o.current)!=null?a:e)()}}),r&&Te.default.createElement(Un,{config:r,goBackRef:o}))};var Gn=()=>{let e=_chunkIVJEK62Cjs.t.call(void 0, ),{setOtpState:r,user:t}=_react.useContext.call(void 0, _chunkIVJEK62Cjs.x),o=_react.useCallback.call(void 0, ()=>r({status:"initial"}),[]),a=_react.useRef.call(void 0, t);return _react.useEffect.call(void 0, ()=>{a.current=t}),{login:_react.useCallback.call(void 0, n=>_chunkIVJEK62Cjs.d.call(void 0, void 0,null,function*(){return{user:yield e(n,a.current,o)}}),[e,o])}};var _expocrypto = require('expo-crypto');var Rn=({appId:e,clientId:r,storage:t=_chunkIVJEK62Cjs.n,supportedChains:o,baseUrl:a,logLevel:s})=>new (0, _jssdkcore2.default)({appId:e,clientId:r,supportedChains:o,storage:_chunkIVJEK62Cjs.m.call(void 0, t),sdkVersion:`expo:${_chunkIVJEK62Cjs.e.version}`,nativeAppIdentifier:_chunkIVJEK62Cjs.l.call(void 0, ),crypto:{digest:_expocrypto.digest},baseUrl:a,logLevel:s});exports.PrivyContext = _chunkIVJEK62Cjs.x; exports.PrivyElements = On; exports.PrivyProvider = _chunkIVJEK62Cjs.z; exports.PrivyUIError = _chunkIVJEK62Cjs.o; exports.SecureStorageAdapter = _chunkIVJEK62Cjs.n; exports.createPrivyClient = Rn; exports.getAccessToken = _chunkIVJEK62Cjs.y; exports.hasError = _chunkIVJEK62Cjs.G; exports.isConnected = _chunkIVJEK62Cjs.A; exports.isConnecting = _chunkIVJEK62Cjs.C; exports.isCreating = _chunkIVJEK62Cjs.F; exports.isDisconnected = _chunkIVJEK62Cjs.D; exports.isNotCreated = _chunkIVJEK62Cjs.E; exports.isReconnecting = _chunkIVJEK62Cjs.B; exports.needsRecovery = _chunkIVJEK62Cjs.H; exports.useCreateGuestAccount = Va; exports.useEmbeddedSolanaWallet = Pt; exports.useEmbeddedWallet = be; exports.useEmbeddedWalletStateChange = Fa; exports.useIdentityToken = Aa; exports.useLinkEmail = Ei; exports.useLinkSMS = Vi; exports.useLinkWithFarcaster = Qi; exports.useLinkWithOAuth = _chunkIVJEK62Cjs.j; exports.useLinkWithSiwe = ni; exports.useLogin = Gn; exports.useLoginWithEmail = Xe; exports.useLoginWithFarcaster = ua; exports.useLoginWithOAuth = _chunkIVJEK62Cjs.i; exports.useLoginWithSMS = tr; exports.useLoginWithSiwe = mi; exports.useOAuthFlow = _chunkIVJEK62Cjs.k; exports.useOAuthTokens = ka; exports.usePrivy = Wt; exports.usePrivyClient = Mt; exports.useUnlinkFarcaster = oa; exports.useUnlinkOAuth = pa; exports.useUnlinkWallet = Si;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _createStarExport(obj) { Object.keys(obj) .filter((key) => key !== "default" && key !== "__esModule") .forEach((key) => { if (exports.hasOwnProperty(key)) { return; } Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]}); }); }var _chunkLE4QILEJjs = require('./chunk-LE4QILEJ.js');var _jssdkcore = require('@privy-io/js-sdk-core'); var _jssdkcore2 = _interopRequireDefault(_jssdkcore); _createStarExport(_jssdkcore);var _react = require('react'); var Te = _interopRequireWildcard(_react); var We = _interopRequireWildcard(_react); var _e = _interopRequireWildcard(_react); var Ue = _interopRequireWildcard(_react); var Oe = _interopRequireWildcard(_react); var He = _interopRequireWildcard(_react);var ni=e=>{let{user:r,client:t,setSiweState:o,siweState:a}=_react.useContext.call(void 0, _chunkLE4QILEJjs.x),s=_react.useCallback.call(void 0, d=>{var u;let f=_chunkLE4QILEJjs.f.call(void 0, d);return o({status:"error",error:f}),(u=e==null?void 0:e.onError)==null||u.call(e,f),f},[e==null?void 0:e.onError]),n=_react.useCallback.call(void 0, g=>_chunkLE4QILEJjs.d.call(void 0, void 0,[g],function*({wallet:d,from:{domain:f,uri:u}}){var l;try{o({status:"generating-message"});let c=yield t.auth.siwe.init(d,f,u);return o({status:"awaiting-signature"}),(l=e==null?void 0:e.onGenerateMessage)==null||l.call(e,c.message),c.message}catch(c){throw s(c)}}),[t,s,e==null?void 0:e.onGenerateMessage]),i=_react.useCallback.call(void 0, u=>_chunkLE4QILEJjs.d.call(void 0, void 0,[u],function*({signature:d,messageOverride:f}){var g;try{if(!r)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_link_siwe_before_logged_in",error:"Must be logged in to link a wallet, Use `useLoginWithSiwe` to login with a wallet"});o({status:"submitting-signature"});let l=yield t.auth.siwe.linkWithSiwe(d,void 0,f);return o({status:"done"}),(g=e==null?void 0:e.onSuccess)==null||g.call(e,l),l}catch(l){throw s(l)}}),[r,t,s,e==null?void 0:e.onSuccess]);return{generateSiweMessage:n,linkWithSiwe:i,state:a}};var mi=e=>{let{user:r,client:t,setSiweState:o,siweState:a}=_react.useContext.call(void 0, _chunkLE4QILEJjs.x),s=_react.useCallback.call(void 0, d=>{var u;let f=_chunkLE4QILEJjs.f.call(void 0, d);return o({status:"error",error:f}),(u=e==null?void 0:e.onError)==null||u.call(e,f),f},[e==null?void 0:e.onError]),n=_react.useCallback.call(void 0, g=>_chunkLE4QILEJjs.d.call(void 0, void 0,[g],function*({wallet:d,from:{domain:f,uri:u}}){var l;try{o({status:"generating-message"});let c=yield t.auth.siwe.init(d,f,u);return o({status:"awaiting-signature"}),(l=e==null?void 0:e.onGenerateMessage)==null||l.call(e,c.message),c.message}catch(c){throw s(c)}}),[t,s,e==null?void 0:e.onGenerateMessage]);return{loginWithSiwe:_react.useCallback.call(void 0, g=>_chunkLE4QILEJjs.d.call(void 0, void 0,[g],function*({signature:d,messageOverride:f,disableSignup:u}){var l;try{if(r)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_login_with_siwe_while_already_logged_in",error:"Already logged in, use `useLinkWithSiwe` if you are trying to link a wallet to an existing account"});o({status:"submitting-signature"});let c=yield t.auth.siwe.loginWithSiwe(d,void 0,f,u?"no-signup":"login-or-sign-up");return o({status:"done"}),(l=e==null?void 0:e.onSuccess)==null||l.call(e,c.user,c.is_new_user),c.user}catch(c){throw s(c)}}),[r,t,s,e==null?void 0:e.onSuccess]),generateSiweMessage:n,state:a}};var Si=e=>{let{user:r,client:t}=_react.useContext.call(void 0, _chunkLE4QILEJjs.x),o=_react.useCallback.call(void 0, s=>{var i;let n=_chunkLE4QILEJjs.f.call(void 0, s);return(i=e==null?void 0:e.onError)==null||i.call(e,n),n},[e==null?void 0:e.onError]);return{unlinkWallet:_react.useCallback.call(void 0, n=>_chunkLE4QILEJjs.d.call(void 0, void 0,[n],function*({address:s}){var i;try{if(!r)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_unlink_siwe_before_logged_in",error:"Must be logged in to unlink a wallet, Use `useLoginWithSiwe` to login with a wallet"});let d=yield t.auth.siwe.unlinkWallet(s);return(i=e==null?void 0:e.onSuccess)==null||i.call(e,d),d}catch(d){throw o(d)}}),[r,t,o,e==null?void 0:e.onSuccess])}};var Ei=e=>{let[r,t]=_react.useState.call(void 0, ""),{user:o,client:a,otpState:s,setOtpState:n}=_react.useContext.call(void 0, _chunkLE4QILEJjs.x),i=_react.useCallback.call(void 0, u=>{var l;let g=_chunkLE4QILEJjs.f.call(void 0, u);return n({status:"error",error:g}),(l=e==null?void 0:e.onError)==null||l.call(e,g),g},[e==null?void 0:e.onError]),d=_react.useCallback.call(void 0, g=>_chunkLE4QILEJjs.d.call(void 0, void 0,[g],function*({email:u}){var l;t(u);try{n({status:"sending-code"});let c=yield a.auth.email.sendCode(u);return n({status:"awaiting-code-input"}),(l=e==null?void 0:e.onSendCodeSuccess)==null||l.call(e,{email:u}),c}catch(c){return i(c),{success:!1}}}),[a,i,e==null?void 0:e.onSendCodeSuccess]),f=_react.useCallback.call(void 0, l=>_chunkLE4QILEJjs.d.call(void 0, void 0,[l],function*({code:u,email:g}){var c;try{if(!o)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_link_email_before_logged_in",error:"Must be logged in to link an email, Use `useLoginWithEmail` to login with email"});let y=g||r;if(!y)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_submit_otp_before_sending",error:"Must `sendCode` with a valid email before calling `linkWithCode`"});n({status:"submitting-code"});let C=yield a.auth.email.linkWithCode(y,u);return n({status:"done"}),(c=e==null?void 0:e.onLinkSuccess)==null||c.call(e,C),C}catch(y){i(y)}}),[o,a,r,i,e==null?void 0:e.onLinkSuccess]);return{sendCode:d,linkWithCode:f,state:s}};var Xe=e=>{let[r,t]=_react.useState.call(void 0, ""),{user:o,client:a,otpState:s,setOtpState:n}=_react.useContext.call(void 0, _chunkLE4QILEJjs.x),i=_react.useCallback.call(void 0, u=>{var l;let g=_chunkLE4QILEJjs.f.call(void 0, u);return n({status:"error",error:g}),(l=e==null?void 0:e.onError)==null||l.call(e,g),g},[e==null?void 0:e.onError]),d=_react.useCallback.call(void 0, g=>_chunkLE4QILEJjs.d.call(void 0, void 0,[g],function*({email:u}){var l;t(u);try{n({status:"sending-code"});let c=yield a.auth.email.sendCode(u);return n({status:"awaiting-code-input"}),(l=e==null?void 0:e.onSendCodeSuccess)==null||l.call(e,{email:u}),c}catch(c){return i(c),{success:!1}}}),[a,i,e==null?void 0:e.onSendCodeSuccess]),f=_react.useCallback.call(void 0, c=>_chunkLE4QILEJjs.d.call(void 0, void 0,[c],function*({code:u,email:g,disableSignup:l}){var y;try{if(o)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_login_with_email_while_already_logged_in",error:"Already logged in, use `useLinkWithEmail` if you are trying to link an email to an existing account"});let C=g||r;if(!C)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_submit_otp_before_sending",error:"Must `sendCode` with a valid email before calling `loginWithCode`"});n({status:"submitting-code"});let p=yield a.auth.email.loginWithCode(C,u,l?"no-signup":"login-or-sign-up");return n({status:"done"}),(y=e==null?void 0:e.onLoginSuccess)==null||y.call(e,p.user,p.is_new_user),p==null?void 0:p.user}catch(C){i(C)}}),[o,a,r,i,e==null?void 0:e.onLoginSuccess]);return{sendCode:d,loginWithCode:f,state:s}};var Vi=e=>{let[r,t]=_react.useState.call(void 0, ""),{user:o,client:a,otpState:s,setOtpState:n}=_react.useContext.call(void 0, _chunkLE4QILEJjs.x),i=_react.useCallback.call(void 0, u=>{var l;let g=_chunkLE4QILEJjs.f.call(void 0, u);return n({status:"error",error:g}),(l=e==null?void 0:e.onError)==null||l.call(e,g),g},[e==null?void 0:e.onError]),d=_react.useCallback.call(void 0, g=>_chunkLE4QILEJjs.d.call(void 0, void 0,[g],function*({phone:u}){var l;t(u);try{n({status:"sending-code"});let c=yield a.auth.phone.sendCode(u);return n({status:"awaiting-code-input"}),(l=e==null?void 0:e.onSendCodeSuccess)==null||l.call(e,{phone:u}),c}catch(c){return i(c),{success:!1}}}),[a,i,e==null?void 0:e.onSendCodeSuccess]),f=_react.useCallback.call(void 0, l=>_chunkLE4QILEJjs.d.call(void 0, void 0,[l],function*({code:u,phone:g}){var c;try{if(!o)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_link_sms_before_logged_in",error:"Must be logged in to link a phone number, Use `useLoginWithSMS` to login with a phone number"});if(!(g||r))throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_submit_otp_before_sending",error:"Must `sendCode` with a valid phone number before calling `linkWithCode`"});n({status:"submitting-code"});let C=yield a.auth.phone.linkWithCode(g||r,u);return n({status:"done"}),(c=e==null?void 0:e.onLinkSuccess)==null||c.call(e,C),C}catch(y){i(y)}}),[o,a,r,i,e==null?void 0:e.onLinkSuccess]);return{sendCode:d,linkWithCode:f,state:s}};var tr=e=>{let[r,t]=_react.useState.call(void 0, ""),{user:o,client:a,otpState:s,setOtpState:n}=_react.useContext.call(void 0, _chunkLE4QILEJjs.x),i=_react.useCallback.call(void 0, u=>{var l;let g=_chunkLE4QILEJjs.f.call(void 0, u);return n({status:"error",error:g}),(l=e==null?void 0:e.onError)==null||l.call(e,g),g},[e==null?void 0:e.onError]),d=_react.useCallback.call(void 0, g=>_chunkLE4QILEJjs.d.call(void 0, void 0,[g],function*({phone:u}){var l;t(u);try{n({status:"sending-code"});let c=yield a.auth.phone.sendCode(u);return n({status:"awaiting-code-input"}),(l=e==null?void 0:e.onSendCodeSuccess)==null||l.call(e,{phone:u}),c}catch(c){return i(c),{success:!1}}}),[a,i,e==null?void 0:e.onSendCodeSuccess]),f=_react.useCallback.call(void 0, c=>_chunkLE4QILEJjs.d.call(void 0, void 0,[c],function*({code:u,phone:g,disableSignup:l}){var y;try{if(o)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_login_with_sms_while_already_logged_in",error:"Already logged in, use `useLinkWithSMS` if you are trying to link a phone number to an existing account"});if(!(g||r))throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_submit_otp_before_sending",error:"Must `sendCode` with a valid phone number before calling `loginWithCode`"});n({status:"submitting-code"});let p=yield a.auth.phone.loginWithCode(g||r,u,l?"no-signup":"login-or-sign-up");return n({status:"done"}),(y=e==null?void 0:e.onLoginSuccess)==null||y.call(e,p.user,p.is_new_user),p==null?void 0:p.user}catch(C){i(C)}}),[o,a,r,i,e==null?void 0:e.onLoginSuccess]);return{sendCode:d,loginWithCode:f,state:s}};var _expolinking = require('expo-linking'); var q = _interopRequireWildcard(_expolinking); var J = _interopRequireWildcard(_expolinking);var Qi=e=>{let{appState:r,getCurrentAppState:t}=_chunkLE4QILEJjs.h.call(void 0, ),{client:o,user:a,farcasterState:s,setFarcasterState:n}=_react.useContext.call(void 0, _chunkLE4QILEJjs.x),i=_react.useRef.call(void 0, !1),d=_react.useCallback.call(void 0, g=>{var c;let l=_chunkLE4QILEJjs.f.call(void 0, g);return n({status:"error",error:l}),(c=e==null?void 0:e.onError)==null||c.call(e,l),l},[e==null?void 0:e.onError,n]),f=_react.useCallback.call(void 0, ()=>{i.current=!0},[]);return{linkWithFarcaster:_react.useCallback.call(void 0, (y,...C)=>_chunkLE4QILEJjs.d.call(void 0, void 0,[y,...C],function*({relyingParty:g,redirectUrl:l},c={pollAttempts:10,pollIntervalMs:1e3}){var p;try{if(i.current=!1,!a)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_link_farcaster_before_logged_in",error:"Must be logged in to link a Farcaster account."});n({status:"generating-uri"});let{connect_uri:E,channel_token:L}=yield o.auth.farcaster.initializeAuth({relyingParty:g,redirectUrl:q.createURL(l!=null?l:"/")});if(!E)throw new (0, _jssdkcore.PrivyClientError)({code:"failed_to_generate_farcaster_uri",error:"Failed to generate farcaster uri"});if(!L)throw new (0, _jssdkcore.PrivyClientError)({code:"failed_to_generate_farcaster_channel_token",error:"Failed to generate farcaster channel token"});yield q.openURL(E),n({status:"polling-status"});let _=0;for(;_<c.pollAttempts;){if(i.current)throw new (0, _jssdkcore.PrivyClientError)({code:"farcaster_polling_canceled",error:"Farcaster polling canceled"});if(r.current!=="active"&&t()!=="active"){yield _chunkLE4QILEJjs.g.call(void 0, c.pollIntervalMs);continue}let V=yield o.auth.farcaster.getFarcasterStatus({channel_token:L});if(V.state==="completed"){n({status:"submitting-token"});let H=yield o.auth.farcaster.link(_chunkLE4QILEJjs.a.call(void 0, {channel_token:L},V));return n({status:"done"}),(p=e==null?void 0:e.onSuccess)==null||p.call(e,H),H}_++,yield _chunkLE4QILEJjs.g.call(void 0, c.pollIntervalMs)}throw new (0, _jssdkcore.PrivyClientError)({code:"farcaster_polling_timeout",error:"Farcasting polling timed out"})}catch(E){throw d(E)}}),[o,e==null?void 0:e.onSuccess,d,n,a]),state:s,cancel:f}};var oa=e=>{let{client:r}=_react.useContext.call(void 0, _chunkLE4QILEJjs.x),t=_react.useCallback.call(void 0, a=>{var n;let s=_chunkLE4QILEJjs.f.call(void 0, a);return(n=e==null?void 0:e.onError)==null||n.call(e,s),s},[e==null?void 0:e.onError]);return{unlinkFarcaster:_react.useCallback.call(void 0, s=>_chunkLE4QILEJjs.d.call(void 0, void 0,[s],function*({fid:a}){var n;try{let i=yield r.auth.farcaster.unlink({fid:a});return(n=e==null?void 0:e.onSuccess)==null||n.call(e,i),i}catch(i){throw t(i)}}),[r,e==null?void 0:e.onSuccess,t])}};var ua=e=>{let{appState:r,getCurrentAppState:t}=_chunkLE4QILEJjs.h.call(void 0, ),{client:o,user:a,farcasterState:s,setFarcasterState:n}=_react.useContext.call(void 0, _chunkLE4QILEJjs.x),i=_react.useRef.call(void 0, !1),d=_react.useCallback.call(void 0, g=>{var c;let l=_chunkLE4QILEJjs.f.call(void 0, g);return n({status:"error",error:l}),(c=e==null?void 0:e.onError)==null||c.call(e,l),l},[e==null?void 0:e.onError,n]),f=_react.useCallback.call(void 0, ()=>{i.current=!0},[]);return{loginWithFarcaster:_react.useCallback.call(void 0, (C,...p)=>_chunkLE4QILEJjs.d.call(void 0, void 0,[C,...p],function*({relyingParty:g,redirectUrl:l,disableSignup:c},y={pollAttempts:10,pollIntervalMs:1e3}){var E;try{if(i.current=!1,a)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_login_with_farcaster_while_already_logged_in",error:"Already logged in, use `useLinkWithFarcaster` if you are trying to link farcaster to an existing account"});n({status:"generating-uri"});let{connect_uri:L,channel_token:_}=yield o.auth.farcaster.initializeAuth({relyingParty:g,redirectUrl:J.createURL(l!=null?l:"/")});if(!L)throw new (0, _jssdkcore.PrivyClientError)({code:"failed_to_generate_farcaster_uri",error:"Failed to generate farcaster uri"});if(!_)throw new (0, _jssdkcore.PrivyClientError)({code:"failed_to_generate_farcaster_channel_token",error:"Failed to generate farcaster channel token"});yield J.openURL(L),n({status:"polling-status"});let V=0;for(;V<y.pollAttempts;){if(i.current)throw new (0, _jssdkcore.PrivyClientError)({code:"farcaster_polling_canceled",error:"Farcaster polling canceled"});if(r.current!=="active"&&t()!=="active"){yield _chunkLE4QILEJjs.g.call(void 0, y.pollIntervalMs);continue}let H=yield o.auth.farcaster.getFarcasterStatus({channel_token:_});if(H.state==="completed"){n({status:"submitting-token"});let le=yield o.auth.farcaster.authenticate(_chunkLE4QILEJjs.a.call(void 0, {channel_token:_,mode:c?"no-signup":"login-or-sign-up"},H));return n({status:"done"}),(E=e==null?void 0:e.onSuccess)==null||E.call(e,le.user,le.is_new_user),le.user}V++,yield _chunkLE4QILEJjs.g.call(void 0, y.pollIntervalMs)}throw new (0, _jssdkcore.PrivyClientError)({code:"farcaster_polling_timeout",error:"Farcasting polling timed out"})}catch(L){throw d(L)}}),[o,d,e==null?void 0:e.onSuccess,n,a,r]),state:s,cancel:f}};var pa=e=>{let{client:r}=_react.useContext.call(void 0, _chunkLE4QILEJjs.x),t=_react.useCallback.call(void 0, a=>{var n;let s=_chunkLE4QILEJjs.f.call(void 0, a);return(n=e==null?void 0:e.onError)==null||n.call(e,s),s},[e==null?void 0:e.onError]);return{unlinkOAuth:_react.useCallback.call(void 0, n=>_chunkLE4QILEJjs.d.call(void 0, void 0,[n],function*({provider:a,subject:s}){var i;try{let d=yield r.auth.oauth.unlink(a,s);return(i=e==null?void 0:e.onSuccess)==null||i.call(e,d),d}catch(d){throw t(d)}}),[r,e==null?void 0:e.onSuccess,t])}};var ka=e=>{let{client:r}=_react.useContext.call(void 0, _chunkLE4QILEJjs.x),t=_react.useRef.call(void 0, e.onOAuthTokenGrant);t.current=e.onOAuthTokenGrant,_react.useEffect.call(void 0, ()=>{let{unsubscribe:o}=r.addOAuthTokensListener(a=>{t.current(a)});return o},[r])};var be=(e={})=>{let{wallet:r,createWalletCallbacks:t,recoverWalletCallbacks:o,setWalletRecoveryCallbacks:a}=_react.useContext.call(void 0, _chunkLE4QILEJjs.x),{onCreateWalletSuccess:s,onCreateWalletError:n,onRecoverWalletError:i,onRecoverWalletSuccess:d,onSetWalletRecoverySuccess:f,onSetWalletRecoveryError:u}=e;return _react.useEffect.call(void 0, ()=>{t.current={onSuccess:s,onError:n}},[s,n]),_react.useEffect.call(void 0, ()=>{o.current={onSuccess:d,onError:i}},[d,i]),_react.useEffect.call(void 0, ()=>{a.current={onSuccess:f,onError:u}},[d,i]),r};var Fa=({onStateChange:e})=>{let r=be();return _react.useEffect.call(void 0, ()=>{e(r)},[r])};var Aa=()=>{let{getIdentityToken:e}=_react.useContext.call(void 0, _chunkLE4QILEJjs.x);return{getIdentityToken:e}};var Va=e=>{let{user:r,client:t}=_react.useContext.call(void 0, _chunkLE4QILEJjs.x),o=_react.useCallback.call(void 0, s=>{var i;let n=_chunkLE4QILEJjs.f.call(void 0, s);return(i=e==null?void 0:e.onError)==null||i.call(e,n),n},[e==null?void 0:e.onError]);return{create:_react.useCallback.call(void 0, ()=>_chunkLE4QILEJjs.d.call(void 0, void 0,null,function*(){var s;try{if(r)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_to_create_guest_account_for_logged_in_user",error:"Already logged in, you cannot create a guest account"});let n=yield t.auth.guest.create();return(s=e==null?void 0:e.onSuccess)==null||s.call(e,n.user,n.is_new_user),n.user}catch(n){throw o(n)}}),[t,o,r,e==null?void 0:e.onSuccess])}};var Pt=(e={})=>{let{solanaWallet:r,createSolanaWalletCallbacks:t,recoverSolanaWalletCallbacks:o}=_react.useContext.call(void 0, _chunkLE4QILEJjs.x),{onCreateWalletSuccess:a,onCreateWalletError:s,onRecoverWalletError:n,onRecoverWalletSuccess:i}=e;return _react.useEffect.call(void 0, ()=>{t.current={onSuccess:a,onError:s}},[a,s]),_react.useEffect.call(void 0, ()=>{o.current={onSuccess:i,onError:n}},[i,n]),r};var Mt=()=>{let{client:e}=_react.useContext.call(void 0, _chunkLE4QILEJjs.x);return e};var Wt=()=>{let{user:e,isReady:r,logout:t,getAccessToken:o}=_react.useContext.call(void 0, _chunkLE4QILEJjs.x);return{user:e,isReady:r,logout:t,getAccessToken:o}};var _reactnative = require('react-native');var _reactnativesvg = require('react-native-svg'); var _reactnativesvg2 = _interopRequireDefault(_reactnativesvg);var sr=()=>{let e=_reactnative.useAnimatedValue.call(void 0, 0);_react.useEffect.call(void 0, ()=>{e.setValue(0);let t=_reactnative.Animated.loop(_reactnative.Animated.timing(e,{toValue:1,duration:1200,useNativeDriver:!0,easing:_reactnative.Easing.linear}));return t.start(),()=>t.stop()},[]);let r=e.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return Te.default.createElement(_reactnative.Animated.View,{style:{transform:[{rotate:r}]}},Te.default.createElement(_reactnativesvg2.default,{width:20,height:20,viewBox:"0 0 20 20",fill:"none"},Te.default.createElement(_reactnativesvg.Path,{d:"M19 10a9 9 0 11-6.219-8.56",stroke:"#fff",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})))};var m={interactive:"#5B4FFF",white:"#FFFFFF",black:"#000000",brand:"#010110",placeholder:"#9498B8",success:"#22C55E",successDark:"#15803D",inputBackground:"#F3F3F3",text:"#040217",icon:"#110F2A",border:"#E2E3F0",error:"#EF4444",errorDark:"#B91C1C",textMuted:"#64668B",textTitle:"#1A1C29"};var v=a=>{var s=a,{variant:e="primary",title:r,loading:t=!1}=s,o=_chunkLE4QILEJjs.c.call(void 0, s,["variant","title","loading"]);return Te.default.createElement(_reactnative.Pressable,_chunkLE4QILEJjs.a.call(void 0, {},o),Te.default.createElement(_reactnative.View,{style:[O.buttonBox,e==="secondary"&&O.buttonBoxSecondary,e==="tertiary"&&O.buttonBoxTertiary]},t?Te.default.createElement(sr,null):Te.default.createElement(_reactnative.Text,{style:[O.buttonLabel,e==="secondary"&&O.buttonLabelSecondary,e==="tertiary"&&O.buttonLabelTertiary]},r)))},O=_reactnative.StyleSheet.create({buttonBox:{height:54,justifyContent:"center",alignItems:"center",borderRadius:14,paddingHorizontal:16,backgroundColor:m.interactive},buttonBoxSecondary:{backgroundColor:m.white,alignItems:"flex-start",borderColor:m.border,borderWidth:1,borderRadius:12},buttonBoxTertiary:{backgroundColor:m.white},buttonLabel:{fontFamily:"Inter_600SemiBold",fontSize:16,lineHeight:24,color:m.white},buttonLabelSecondary:{fontFamily:"Inter_400Regular",color:m.text},buttonLabelTertiary:{fontFamily:"Inter_500Medium",color:m.interactive}});var cr=({value:e,isFocused:r,isSuccess:t,isError:o})=>Te.default.createElement(_reactnative.View,{style:[D.box,r&&D.focusedBox,t&&D.successBox,o&&D.errorBox]},Te.default.createElement(_reactnative.Text,{style:D.text},e)),D=_reactnative.StyleSheet.create({box:{borderWidth:1,borderColor:m.border,borderRadius:12,height:64,width:48,justifyContent:"center",alignItems:"center"},focusedBox:{borderWidth:2,borderColor:m.interactive},successBox:{borderColor:m.success},errorBox:{borderColor:m.error},text:{fontFamily:"Inter_500Medium",fontSize:16,lineHeight:20,color:m.text}});var mr=6,Jt=[0,1,2,"-",3,4,5];function Ee({value:e="",status:r=" ",onChangeText:t=()=>{},editable:o=!0,success:a=!1,error:s=!1,autoFocus:n=!1}){let i=_react.useRef.call(void 0, null),[d,f]=_react.useState.call(void 0, !1),u=()=>{var c;(c=i==null?void 0:i.current)==null||c.focus()},g=c=>{let y=c.replace(/\D/g,"");t(y)},l=d?Math.min(e.length,mr-1):void 0;return Te.default.createElement(_reactnative.View,{style:W.container},Te.default.createElement(_reactnative.TextInput,{autoFocus:n,style:W.invisibleTextInput,value:e,onChangeText:g,maxLength:mr,ref:i,editable:o,onFocus:()=>f(!0),onBlur:()=>f(!1),keyboardType:"numeric"}),Te.default.createElement(_reactnative.Pressable,{onPress:u,disabled:!o},Te.default.createElement(_reactnative.View,{style:W.codeContainer},Jt.map((c,y)=>c==="-"?Te.default.createElement(Yt,{key:y}):Te.default.createElement(cr,{key:y,isFocused:l===c,value:e[c]||"",isSuccess:a,isError:s})))),Te.default.createElement(_reactnative.Text,{style:[W.statusText,a&&W.statusSuccess,s&&W.statusError]},r))}var Yt=()=>Te.default.createElement(_reactnative.Text,{style:W.separator},"-"),W=_reactnative.StyleSheet.create({container:{justifyContent:"center",paddingHorizontal:0,gap:6},invisibleTextInput:{position:"absolute",opacity:0},codeContainer:{flexDirection:"row",alignItems:"center",gap:10,justifyContent:"space-between"},separator:{fontFamily:"Inter_600SemiBold",fontSize:18,lineHeight:24,color:m.black},statusText:{textAlign:"left",color:m.textMuted,fontFamily:"Inter_400Regular",fontSize:14,lineHeight:22},statusError:{color:m.errorDark},statusSuccess:{color:m.successDark}});var F=({title:e,subtitle:r})=>Te.default.createElement(_reactnative.View,{style:Pe.titleContainer},Te.default.createElement(_reactnative.Text,{style:Pe.title},e),r&&Te.default.createElement(_reactnative.Text,{style:Pe.subtitle},r)),Pe=_reactnative.StyleSheet.create({titleContainer:{alignItems:"center",gap:16},title:{fontFamily:"Inter_600SemiBold",fontSize:20,lineHeight:32,color:m.textTitle},subtitle:{fontFamily:"Inter_400Regular",fontSize:16,lineHeight:24,color:m.textMuted,textAlign:"center"}});var hr=({hint:e,link:r,onPress:t,disabled:o})=>Te.default.createElement(_reactnative.View,{style:$.container},Te.default.createElement(_reactnative.Text,{style:$.hintText},e),r&&Te.default.createElement(_reactnative.Pressable,{onPress:t,disabled:o},Te.default.createElement(_reactnative.Text,{style:[$.linkText,o&&$.disabledLink]}," ",r))),$=_reactnative.StyleSheet.create({container:{display:"flex",flexDirection:"row",gap:2},hintText:{fontFamily:"Inter_400Regular",fontSize:14,lineHeight:22,color:m.textMuted},linkText:{fontFamily:"Inter_500Medium",fontSize:14,lineHeight:22,color:m.interactive},disabledLink:{color:m.textMuted}});var lo=3e4,co=()=>{let[e,r]=_react.useState.call(void 0, !1),t=_react.useCallback.call(void 0, ()=>{r(!1),setTimeout(()=>{r(!0)},lo)},[]);return _react.useEffect.call(void 0, ()=>{t()},[]),[e,t]},X=({loginWithCode:e,requestNewCode:r,subtitle:t,isLoading:o,error:a,isDone:s})=>{let[n,i]=_react.useState.call(void 0, ""),d=l=>{i(l),l.length===6&&e(l)},[f,u]=co(),g=()=>{r(),u()};return Te.default.createElement(_reactnative.KeyboardAvoidingView,{behavior:_reactnative.Platform.OS==="ios"?"padding":void 0,style:Me.innerContainer},Te.default.createElement(_reactnative.View,{style:{flex:1,justifyContent:"space-between",paddingHorizontal:16,paddingBottom:16}},Te.default.createElement(_reactnative.View,{style:Me.content},Te.default.createElement(_reactnative.View,{style:Me.formContainer},Te.default.createElement(F,{title:"Enter confirmation code",subtitle:t}),Te.default.createElement(Ee,{value:n,editable:!o,onChangeText:d,success:s,error:!!a,status:s?"Success.":a?uo(a):" ",autoFocus:!0}),Te.default.createElement(hr,{hint:"Didn\u2019t get an email?",link:"Resend code",onPress:g,disabled:!f}))),Te.default.createElement(v,{title:"Continue",loading:o,onPress:()=>e(n)})))},uo=_jssdkcore.createErrorFormatter.call(void 0, {invalid_credentials:"Invalid code.",invalid_data:"The code has expired.",too_many_requests:"Too many requests. Please try again later.",default:"Something went wrong. Please try again."}),Me=_reactnative.StyleSheet.create({modalContent:{backgroundColor:"#ffffff"},innerContainer:{flex:1},content:{gap:16},formContainer:{rowGap:24}});var fo=e=>Te.createElement(_reactnativesvg2.default,_chunkLE4QILEJjs.a.call(void 0, {xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 460 40"},e),Te.createElement(_reactnativesvg.Path,{fill:e.color,d:"M0 15.4v15.38h4.64V19.96h3.58c2.47 0 3.63-.01 3.77-.02 1-.08 1.49-.15 2.18-.3a9.45 9.45 0 0 0 4.6-2.37c1.66-1.57 2.64-3.87 2.81-6.56.02-.3.02-1.19 0-1.49-.1-1.77-.56-3.35-1.36-4.72A8.84 8.84 0 0 0 15.14.57c-.93-.3-1.75-.43-3.09-.54C11.9.02 10.2 0 5.93 0H0ZM10.85 4c1.85.05 3.1.45 4.16 1.3.22.17.54.49.69.68a5.97 5.97 0 0 1 1.19 3.13c.04.35.04 1.36 0 1.71-.08.68-.23 1.3-.44 1.85a4.8 4.8 0 0 1-1.09 1.68A5.63 5.63 0 0 1 12 15.92c-.6.08-.4.08-4.01.09H4.64V3.98h2.9c1.6 0 3.08 0 3.31.02m176.8 1.71v5.72h-.27l-.09-.14a16 16 0 0 0-1.21-1.73c-.43-.5-1-.95-1.7-1.36-.54-.3-1.05-.5-1.73-.63a9 9 0 0 0-1.7-.17 8.84 8.84 0 0 0-7.8 4.03 12.95 12.95 0 0 0-2.03 6.39c-.07.98-.06 2.15.02 3.13.2 2.47.87 4.53 2.02 6.25a8.98 8.98 0 0 0 10.22 3.65 6.5 6.5 0 0 0 2.8-1.93c.41-.51.84-1.1 1.1-1.55l.1-.17h.37v3.58h4.38V0h-4.48Zm-5.24 5.54c1.3.14 2.3.6 3.17 1.48.9.9 1.5 2.09 1.85 3.64.36 1.6.39 3.72.06 5.43a8.1 8.1 0 0 1-1.54 3.62 5.1 5.1 0 0 1-3.93 1.96 6.1 6.1 0 0 1-2.32-.31 5.87 5.87 0 0 1-3.33-3.5c-.39-1-.62-2.05-.72-3.32-.03-.32-.04-1.35-.02-1.73q.12-2.34.96-4.05a6.2 6.2 0 0 1 1.06-1.58 5.08 5.08 0 0 1 3.6-1.66c.25-.02.9 0 1.16.02m27.66 4.14.01 15.38h4.38l.01-3.57h.37l.09.15c.24.44.84 1.26 1.21 1.7a6.8 6.8 0 0 0 2.57 1.75 9.3 9.3 0 0 0 6.86-.49 9.28 9.28 0 0 0 4.05-4.07A13 13 0 0 0 231 21.6c.21-1.73.18-3.7-.09-5.32a13 13 0 0 0-1.5-4.3 9.1 9.1 0 0 0-3.75-3.63 9.15 9.15 0 0 0-4.43-.96 7.5 7.5 0 0 0-2.8.5A7.1 7.1 0 0 0 216 9.7c-.4.52-.82 1.12-1.1 1.59l-.07.14h-.27V0h-4.5Zm11.13-4.14c1.07.1 1.94.44 2.7 1.04a6.1 6.1 0 0 1 1.64 1.98c.43.84.78 2 .94 3.11.15 1.16.16 2.4.02 3.54a9.34 9.34 0 0 1-1.39 4.03 5.33 5.33 0 0 1-2.69 2.15c-.9.3-2.04.38-3.06.2a5.14 5.14 0 0 1-3.45-2.37 6 6 0 0 1-.45-.8c-.5-1.03-.8-2.2-.92-3.58-.04-.49-.06-.89-.05-1.53.01-.76.05-1.23.13-1.85.38-2.53 1.47-4.38 3.15-5.31a5.5 5.5 0 0 1 2.3-.63 10 10 0 0 1 1.13.02M69.05 2.17l-.01 2.77V7.7h-3.36v3.6h3.36v6.8l.01 7.15c.06 1.4.4 2.44 1.1 3.37a5.8 5.8 0 0 0 2.97 2.07c.91.3 1.83.42 2.9.38a8.7 8.7 0 0 0 2.66-.48l-.8-3.7-.38.06a4.96 4.96 0 0 1-2.43-.06c-.33-.1-.56-.25-.8-.49-.4-.41-.6-.88-.7-1.67-.02-.2-.02-.62-.03-6.82v-6.6h4.73V7.7h-4.73V2.16h-4.49Zm64.29 0V7.7h-3.39v3.6h3.38v6.9l.01 7.17a5.66 5.66 0 0 0 2.36 4.49c.85.6 2.03 1.03 3.26 1.17.85.1 2.03.05 2.81-.1.3-.06.75-.18 1-.26l.2-.06v-.05l-.81-3.67-.37.06a5 5 0 0 1-1.8.09c-.85-.13-1.32-.4-1.7-.97a2.6 2.6 0 0 1-.39-1.04c-.06-.4-.06 0-.06-7.1V11.3h4.7V7.7h-4.7l-.01-2.77V2.16h-4.49Zm160.07.19a14.56 14.56 0 0 0-13.7 16.07 14.59 14.59 0 0 0 21.86 11.08 14.5 14.5 0 0 0 7.11-14.07 14.61 14.61 0 0 0-6.53-10.73 14.5 14.5 0 0 0-8.74-2.35m57.39 0a10.17 10.17 0 0 0-7.56 4.2c-.16.2-.45.63-.58.83l-.05.1h-.47l-.01-4.36h-7.36v36.4h7.82V27.27h.49l.05.07a11.3 11.3 0 0 0 7.49 4.15 10.52 10.52 0 0 0 9.38-4.1c1.66-2.1 2.73-4.9 3.07-8.06.1-.87.13-1.4.13-2.37 0-.8 0-1.1-.07-1.76a15.95 15.95 0 0 0-3.23-8.72 12.8 12.8 0 0 0-1.85-1.84 10.5 10.5 0 0 0-7.26-2.28Zm-.94 6.05c1.27.15 2.33.65 3.2 1.5.98.96 1.67 2.31 2.03 4 .34 1.57.38 3.68.12 5.39a9.8 9.8 0 0 1-1.04 3.25c-.14.25-.44.69-.6.89a5.35 5.35 0 0 1-4.31 2.07 5.25 5.25 0 0 1-4.41-1.9 7.4 7.4 0 0 1-1.26-2.32 14.1 14.1 0 0 1-.62-4.83c.05-1.98.38-3.53 1.02-4.85a5.63 5.63 0 0 1 2.5-2.65c.66-.34 1.3-.5 2.14-.58.18-.02 1.04 0 1.23.03m13.77-5.31-.01 3.2v3.16h1.43c1.26.01 1.44.02 1.54.04.42.09.66.28.79.62.08.23.08.08.08 2.96a912 912 0 0 1 .03 10.18v7.54h7.82v-7.4l.01-7.83c.03-.94.11-1.63.27-2.28.46-1.9 1.54-2.93 3.35-3.23.52-.08.2-.08 5-.08h4.4v-6.9h-3.1c-3.48 0-3.91.01-4.67.1-1.83.2-3.04.79-3.96 1.88-.5.6-.9 1.32-1.26 2.26l-.06.17h-.46v-4.4h-5.6c-4.46 0-5.6 0-5.6.02Zm27.17 13.85V30.8h3.87l3.86-.01V3.09h-7.73Zm9.8-13.85-.01.4v.38l4.66 13.4 4.69 13.47.02.05h10.3l.03-.05 4.67-13.45 4.67-13.4v-.8h-7.43l-6.7 19.26h-.5l-3.28-9.5-3.31-9.64-.05-.12h-3.88l-3.88.01Zm30.38 0c-.01 0-.02.19-.02.4v.39l5.08 14.59c2.8 8.02 5.08 14.6 5.08 14.61.01.02-.22.02-4.8.02h-4.82v6.42h4.95c5.09 0 5.23 0 5.87-.06 3.15-.28 5.29-1.63 6.63-4.15.28-.55.44-.95.87-2.16L459 6.78l1-2.89v-.8h-7.43l-6.69 19.26h-.5l-3.27-9.46-3.31-9.64-.06-.16h-3.88zM36.57 7.36c-1.36.1-2.6.6-3.62 1.45a5.65 5.65 0 0 0-1.67 2.42l-.05.13H31V7.7h-4.35v23.08h4.5v-7.3c0-8 0-7.34.08-7.82a4.9 4.9 0 0 1 2.06-3.18c.83-.58 1.74-.89 2.87-.98a12 12 0 0 1 2.8.25H39v-4.3l-.21-.02c-.61-.07-1.74-.1-2.22-.07m14.51.05c-2.33.12-4.3.84-5.95 2.16a9.9 9.9 0 0 0-2.03 2.2 12.5 12.5 0 0 0-2 5.78 18 18 0 0 0 0 3.65 12.13 12.13 0 0 0 2.26 6.05 9.74 9.74 0 0 0 5 3.52c2.11.64 4.7.64 6.8 0a9.8 9.8 0 0 0 4.88-3.37c1.38-1.78 2.19-4 2.4-6.58.13-1.46.06-3.06-.18-4.42a11.24 11.24 0 0 0-3.58-6.6 10 10 0 0 0-5.75-2.35c-.56-.06-1.31-.07-1.85-.04m1.42 3.78c.88.1 1.62.34 2.28.75a6.1 6.1 0 0 1 1.99 2.15 10.3 10.3 0 0 1 1.2 5c.02 1.23-.12 2.44-.42 3.51a7.14 7.14 0 0 1-1.81 3.32c-.61.6-1.2.98-1.95 1.24a6 6 0 0 1-2 .3 5.7 5.7 0 0 1-2.72-.6 5 5 0 0 1-1.28-.94A7.1 7.1 0 0 1 46 22.73c-.57-1.99-.6-4.46-.08-6.5a7.24 7.24 0 0 1 2.03-3.67 5.13 5.13 0 0 1 3.35-1.4 11 11 0 0 1 1.2.03M92.05 7.4c-.96.06-1.56.15-2.3.33a9.62 9.62 0 0 0-6.09 4.66 13.5 13.5 0 0 0-1.71 7c0 .83 0 1.04.06 1.6.16 1.77.58 3.32 1.29 4.7A9.72 9.72 0 0 0 90.28 31c1.84.37 4.08.32 5.85-.13a9.07 9.07 0 0 0 5.02-3.1A7.6 7.6 0 0 0 102.5 25l-2.11-.39-2.11-.38-.08.13a4.72 4.72 0 0 1-2.35 2.55 6.3 6.3 0 0 1-2.23.58c-.29.03-1.13.03-1.44 0a6.35 6.35 0 0 1-3.02-1.04 5.93 5.93 0 0 1-2.02-2.43 8.4 8.4 0 0 1-.72-3.18v-.26h16.38v-.81c0-1.83-.06-2.76-.25-3.87-.2-1.22-.53-2.24-1.05-3.28a8.9 8.9 0 0 0-2.66-3.26 10.1 10.1 0 0 0-5.34-1.94 18 18 0 0 0-1.46-.03Zm1.3 3.75c1.2.13 2.19.55 3.05 1.3a5.8 5.8 0 0 1 1.78 2.96c.13.51.21 1.17.21 1.66v.15H86.43v-.12c.08-.97.3-1.78.72-2.61.5-1 1.2-1.8 2.14-2.42a5.3 5.3 0 0 1 2.9-.95c.2-.01.97 0 1.17.03Zm23.44-3.74c-2 .1-3.73.65-5.22 1.65a10.7 10.7 0 0 0-4.25 6.06 16.1 16.1 0 0 0-.5 5.8c.2 2.17.84 4.13 1.88 5.76.58.9 1.32 1.73 2.15 2.4a9.4 9.4 0 0 0 3.6 1.8 12 12 0 0 0 3.92.34 10.2 10.2 0 0 0 3.84-.95 8.31 8.31 0 0 0 4.76-6.75l.01-.04h-4.37l-.05.16a4.87 4.87 0 0 1-4.24 3.75c-.59.07-1.32.06-1.93-.05a5.47 5.47 0 0 1-3.5-2.27c-.56-.75-1-1.73-1.26-2.79a13.8 13.8 0 0 1-.16-5.24 7.77 7.77 0 0 1 2.1-4.3 5.5 5.5 0 0 1 2.15-1.3 6.4 6.4 0 0 1 3.89.1c.59.21 1.03.5 1.5.96a5.3 5.3 0 0 1 1.46 2.5l.04.15h4.37v-.06a8.22 8.22 0 0 0-5.31-6.94 11 11 0 0 0-4.88-.74m39.41 0a9.87 9.87 0 0 0-6 2.29 11 11 0 0 0-3.41 5.43c-.52 1.78-.68 3.9-.48 5.97.17 1.8.63 3.38 1.37 4.8a9.68 9.68 0 0 0 5.91 4.86c1.65.48 3.63.61 5.53.36 3.72-.49 6.55-2.62 7.56-5.69.12-.39.13-.42.1-.43-.02 0-4.13-.75-4.19-.75-.03 0-.04 0-.1.16-.18.42-.45.9-.72 1.22-.16.2-.49.53-.7.7-.67.54-1.5.9-2.43 1.08-.48.08-.83.11-1.41.11-.64 0-1.07-.04-1.6-.15a5.76 5.76 0 0 1-3.93-2.83 8 8 0 0 1-.99-3.79v-.16h16.38v-1.11l-.02-1.43c-.1-2.25-.53-4-1.35-5.59a9.24 9.24 0 0 0-6.18-4.75c-1.04-.26-2.2-.36-3.33-.3Zm1.45 3.74a5.35 5.35 0 0 1 3.66 1.94 6.1 6.1 0 0 1 1.38 4.01v.12h-11.97v-.06c0-.02 0-.14.02-.25a6.6 6.6 0 0 1 2.15-4.32 5.73 5.73 0 0 1 3.5-1.46c.25-.02 1 0 1.26.02m75.93-3.33 8.37 23.22a49 49 0 0 1-.67 1.9 5.4 5.4 0 0 1-1.14 1.8c-.41.4-.82.58-1.48.69-.27.04-1.03.03-1.35 0a8 8 0 0 1-1.1-.23l-1.08 3.67c0 .02.32.14.66.22.83.21 1.57.29 2.56.28.56-.01.8-.03 1.24-.1 2.71-.4 4.66-2.09 5.86-5.08l9.64-26.44c0-.02-4.82-.06-4.83-.05l-2.93 8.96-2.91 8.94h-.24l-.22-.65-2.91-8.95-2.7-8.3h-4.82Zm59.47 27.98c-1.18.04-1.93.09-2.8.16-2.52.24-4.53.69-5.43 1.23-.7.41-.76.86-.2 1.28.88.66 3.29 1.19 6.36 1.4a49 49 0 0 0 5.75.05c3.47-.19 6.24-.78 7.11-1.5.22-.19.3-.34.3-.53 0-.1 0-.12-.04-.22-.35-.69-2.32-1.3-5.25-1.63a41 41 0 0 0-5.8-.24m0 0"})),yr=fo;var ee=()=>Te.default.createElement(_reactnative.View,{style:yo.legalFooterContainer},Te.default.createElement(yr,{color:m.brand,width:"100%",height:11})),yo=_reactnative.StyleSheet.create({legalFooterContainer:{flexDirection:"row",alignItems:"center",marginVertical:16,justifyContent:"center",gap:2}});var B=a=>{var s=a,{error:e,status:r,LeftIcon:t}=s,o=_chunkLE4QILEJjs.c.call(void 0, s,["error","status","LeftIcon"]);let[n,i]=_react.useState.call(void 0, !1);return Te.default.createElement(_reactnative.View,{style:A.container},Te.default.createElement(_reactnative.View,{style:[A.inputBox,n&&A.inputBoxFocused,e&&A.inputBoxError]},t,Te.default.createElement(_reactnative.TextInput,_chunkLE4QILEJjs.a.call(void 0, {cursorColor:m.interactive,placeholderTextColor:m.placeholder,onFocus:()=>i(!0),onBlur:()=>i(!1),autoCapitalize:"none",returnKeyType:"next",multiline:!1,numberOfLines:1,style:A.input},o))),r&&Te.default.createElement(_reactnative.Text,{style:[A.statusText,e&&A.statusError]},r))},A=_reactnative.StyleSheet.create({container:{gap:6},input:{flex:1,fontFamily:"Inter_400Regular",fontSize:18,height:30,color:m.text},inputBox:{flexDirection:"row",paddingHorizontal:16,height:64,backgroundColor:m.inputBackground,borderRadius:14,alignItems:"center",columnGap:10,borderWidth:2,borderColor:m.border},inputBoxFocused:{borderColor:m.interactive},inputBoxError:{borderColor:m.error},statusText:{textAlign:"left",color:m.textMuted,fontFamily:"Inter_400Regular",fontSize:14,lineHeight:22},statusError:{color:m.errorDark}});var xo=e=>We.createElement(_reactnativesvg2.default,_chunkLE4QILEJjs.a.call(void 0, {xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),We.createElement(_reactnativesvg.Path,{stroke:e.color,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7m2-3h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2"})),wr=xo;var kr=({sendCode:e,isLoading:r,error:t,initialEmail:o,FooterComponent:a})=>{let[s,n]=_react.useState.call(void 0, o!=null?o:"");return Te.default.createElement(_reactnative.KeyboardAvoidingView,{behavior:_reactnative.Platform.OS==="ios"?"padding":void 0,style:oe.innerContainer},Te.default.createElement(_reactnative.View,{style:{flex:1,justifyContent:"space-between",paddingHorizontal:16,paddingBottom:16}},Te.default.createElement(_reactnative.View,{style:oe.content},Te.default.createElement(_reactnative.View,{style:oe.content},Te.default.createElement(_reactnative.View,{style:oe.formContainer},Te.default.createElement(F,{title:"Enter your email"}),Te.default.createElement(B,{LeftIcon:Te.default.createElement(wr,{color:m.icon}),value:s,onChangeText:n,error:!!t,status:t?To(t):" ",placeholder:"your@email.com",autoComplete:"email",keyboardType:"email-address",autoFocus:!0})),a),Te.default.createElement(ee,null)),Te.default.createElement(v,{title:"Continue",loading:r,onPress:()=>e(s)})))},To=_jssdkcore.createErrorFormatter.call(void 0, {invalid_data:"Invalid email address.",too_many_requests:"Too many requests. Please try again later.",default:"Something went wrong. Please try again."}),oe=_reactnative.StyleSheet.create({innerContainer:{flex:1},content:{gap:4},formContainer:{rowGap:24}});var ne=({onLoginMethodChange:e,otherLoginMethod:r})=>r?Te.default.createElement(v,{variant:"tertiary",title:`Use ${_chunkLE4QILEJjs.r[r]} instead`,onPress:()=>e(r)}):null;var Io=600,xr=({goBackRef:e,onLoginMethodChange:r,otherLoginMethod:t})=>{let{setOtpState:o}=_react.useContext.call(void 0, _chunkLE4QILEJjs.x),a=_chunkLE4QILEJjs.u.call(void 0, ),[s,n]=_react.useState.call(void 0, ""),{state:i,loginWithCode:d,sendCode:f}=Xe(),[u,g]=_react.useState.call(void 0, "email"),{step:l,error:c=null,isLoading:y=!1,isDone:C=!1}=_react.useMemo.call(void 0, ()=>{var p;switch(i.status){case"initial":return{step:{type:"email"}};case"sending-code":return{step:{type:u},isLoading:!0};case"awaiting-code-input":return{step:{type:"code"}};case"submitting-code":return{step:{type:"code"},isLoading:!0};case"done":return{step:{type:"code"},isDone:!0};case"error":return{step:{type:u},error:(p=i.error)!=null?p:new Error("Unknown error")}}},[u,i.status]);switch(u!==l.type&&g(l.type),_react.useEffect.call(void 0, ()=>{if(!C)return;let p=setTimeout(()=>{a()},Io);return()=>clearTimeout(p)},[C,a]),_react.useEffect.call(void 0, ()=>{if(l.type==="code")return e.current=()=>{o({status:"initial"})},()=>{e.current=null}},[l.type,o]),l.type){case"code":return Te.default.createElement(X,{loginWithCode:p=>d({code:p,email:s}),requestNewCode:()=>f({email:s}),subtitle:`Please check ${s} for a message with your login code.`,isLoading:y,error:c,isDone:C});case"email":return Te.default.createElement(kr,{initialEmail:s,sendCode:p=>{n(p),f({email:p})},isLoading:y,error:c,FooterComponent:Te.default.createElement(ne,{onLoginMethodChange:r,otherLoginMethod:t})})}};function Er(e,r){let[t,o]=_react.useState.call(void 0, e);return _react.useEffect.call(void 0, ()=>{let a=setTimeout(()=>{o(e)},r);return()=>{clearTimeout(a)}},[e,r]),t}var Lr=[["Afghanistan","AF","\u{1F1E6}\u{1F1EB}"],["Albania","AL","\u{1F1E6}\u{1F1F1}"],["Algeria","DZ","\u{1F1E9}\u{1F1FF}"],["American Samoa","AS","\u{1F1E6}\u{1F1F8}"],["Andorra","AD","\u{1F1E6}\u{1F1E9}"],["Angola","AO","\u{1F1E6}\u{1F1F4}"],["Anguilla","AI","\u{1F1E6}\u{1F1EE}"],["Antigua & Barbuda","AG","\u{1F1E6}\u{1F1EC}"],["Argentina","AR","\u{1F1E6}\u{1F1F7}"],["Armenia","AM","\u{1F1E6}\u{1F1F2}"],["Aruba","AW","\u{1F1E6}\u{1F1FC}"],["Ascension Island","AC","\u{1F1E6}\u{1F1E8}"],["Australia","AU","\u{1F1E6}\u{1F1FA}"],["Austria","AT","\u{1F1E6}\u{1F1F9}"],["Azerbaijan","AZ","\u{1F1E6}\u{1F1FF}"],["Bahamas","BS","\u{1F1E7}\u{1F1F8}"],["Bahrain","BH","\u{1F1E7}\u{1F1ED}"],["Bangladesh","BD","\u{1F1E7}\u{1F1E9}"],["Barbados","BB","\u{1F1E7}\u{1F1E7}"],["Belarus","BY","\u{1F1E7}\u{1F1FE}"],["Belgium","BE","\u{1F1E7}\u{1F1EA}"],["Belize","BZ","\u{1F1E7}\u{1F1FF}"],["Benin","BJ","\u{1F1E7}\u{1F1EF}"],["Bermuda","BM","\u{1F1E7}\u{1F1F2}"],["Bhutan","BT","\u{1F1E7}\u{1F1F9}"],["Bolivia","BO","\u{1F1E7}\u{1F1F4}"],["Bosnia & Herzegovina","BA","\u{1F1E7}\u{1F1E6}"],["Botswana","BW","\u{1F1E7}\u{1F1FC}"],["Brazil","BR","\u{1F1E7}\u{1F1F7}"],["British Indian Ocean Territory","IO","\u{1F1EE}\u{1F1F4}"],["British Virgin Islands","VG","\u{1F1FB}\u{1F1EC}"],["Brunei","BN","\u{1F1E7}\u{1F1F3}"],["Bulgaria","BG","\u{1F1E7}\u{1F1EC}"],["Burkina Faso","BF","\u{1F1E7}\u{1F1EB}"],["Burundi","BI","\u{1F1E7}\u{1F1EE}"],["Cambodia","KH","\u{1F1F0}\u{1F1ED}"],["Cameroon","CM","\u{1F1E8}\u{1F1F2}"],["Canada","CA","\u{1F1E8}\u{1F1E6}"],["Cape Verde","CV","\u{1F1E8}\u{1F1FB}"],["Caribbean Netherlands","BQ","\u{1F1E7}\u{1F1F6}"],["Cayman Islands","KY","\u{1F1F0}\u{1F1FE}"],["Central African Republic","CF","\u{1F1E8}\u{1F1EB}"],["Chad","TD","\u{1F1F9}\u{1F1E9}"],["Chile","CL","\u{1F1E8}\u{1F1F1}"],["China","CN","\u{1F1E8}\u{1F1F3}"],["Christmas Island","CX","\u{1F1E8}\u{1F1FD}"],["Cocos (Keeling) Islands","CC","\u{1F1E8}\u{1F1E8}"],["Colombia","CO","\u{1F1E8}\u{1F1F4}"],["Comoros","KM","\u{1F1F0}\u{1F1F2}"],["Congo - Brazzaville","CG","\u{1F1E8}\u{1F1EC}"],["Congo - Kinshasa","CD","\u{1F1E8}\u{1F1E9}"],["Cook Islands","CK","\u{1F1E8}\u{1F1F0}"],["Costa Rica","CR","\u{1F1E8}\u{1F1F7}"],["Croatia","HR","\u{1F1ED}\u{1F1F7}"],["Cuba","CU","\u{1F1E8}\u{1F1FA}"],["Cura\xE7ao","CW","\u{1F1E8}\u{1F1FC}"],["Cyprus","CY","\u{1F1E8}\u{1F1FE}"],["Czechia","CZ","\u{1F1E8}\u{1F1FF}"],["C\xF4te d\u2019Ivoire","CI","\u{1F1E8}\u{1F1EE}"],["Denmark","DK","\u{1F1E9}\u{1F1F0}"],["Djibouti","DJ","\u{1F1E9}\u{1F1EF}"],["Dominica","DM","\u{1F1E9}\u{1F1F2}"],["Dominican Republic","DO","\u{1F1E9}\u{1F1F4}"],["Ecuador","EC","\u{1F1EA}\u{1F1E8}"],["Egypt","EG","\u{1F1EA}\u{1F1EC}"],["El Salvador","SV","\u{1F1F8}\u{1F1FB}"],["Equatorial Guinea","GQ","\u{1F1EC}\u{1F1F6}"],["Eritrea","ER","\u{1F1EA}\u{1F1F7}"],["Estonia","EE","\u{1F1EA}\u{1F1EA}"],["Eswatini","SZ","\u{1F1F8}\u{1F1FF}"],["Ethiopia","ET","\u{1F1EA}\u{1F1F9}"],["Falkland Islands","FK","\u{1F1EB}\u{1F1F0}"],["Faroe Islands","FO","\u{1F1EB}\u{1F1F4}"],["Fiji","FJ","\u{1F1EB}\u{1F1EF}"],["Finland","FI","\u{1F1EB}\u{1F1EE}"],["France","FR","\u{1F1EB}\u{1F1F7}"],["French Guiana","GF","\u{1F1EC}\u{1F1EB}"],["French Polynesia","PF","\u{1F1F5}\u{1F1EB}"],["Gabon","GA","\u{1F1EC}\u{1F1E6}"],["Gambia","GM","\u{1F1EC}\u{1F1F2}"],["Georgia","GE","\u{1F1EC}\u{1F1EA}"],["Germany","DE","\u{1F1E9}\u{1F1EA}"],["Ghana","GH","\u{1F1EC}\u{1F1ED}"],["Gibraltar","GI","\u{1F1EC}\u{1F1EE}"],["Greece","GR","\u{1F1EC}\u{1F1F7}"],["Greenland","GL","\u{1F1EC}\u{1F1F1}"],["Grenada","GD","\u{1F1EC}\u{1F1E9}"],["Guadeloupe","GP","\u{1F1EC}\u{1F1F5}"],["Guam","GU","\u{1F1EC}\u{1F1FA}"],["Guatemala","GT","\u{1F1EC}\u{1F1F9}"],["Guernsey","GG","\u{1F1EC}\u{1F1EC}"],["Guinea","GN","\u{1F1EC}\u{1F1F3}"],["Guinea-Bissau","GW","\u{1F1EC}\u{1F1FC}"],["Guyana","GY","\u{1F1EC}\u{1F1FE}"],["Haiti","HT","\u{1F1ED}\u{1F1F9}"],["Honduras","HN","\u{1F1ED}\u{1F1F3}"],["Hong Kong SAR China","HK","\u{1F1ED}\u{1F1F0}"],["Hungary","HU","\u{1F1ED}\u{1F1FA}"],["Iceland","IS","\u{1F1EE}\u{1F1F8}"],["India","IN","\u{1F1EE}\u{1F1F3}"],["Indonesia","ID","\u{1F1EE}\u{1F1E9}"],["Iran","IR","\u{1F1EE}\u{1F1F7}"],["Iraq","IQ","\u{1F1EE}\u{1F1F6}"],["Ireland","IE","\u{1F1EE}\u{1F1EA}"],["Isle of Man","IM","\u{1F1EE}\u{1F1F2}"],["Israel","IL","\u{1F1EE}\u{1F1F1}"],["Italy","IT","\u{1F1EE}\u{1F1F9}"],["Jamaica","JM","\u{1F1EF}\u{1F1F2}"],["Japan","JP","\u{1F1EF}\u{1F1F5}"],["Jersey","JE","\u{1F1EF}\u{1F1EA}"],["Jordan","JO","\u{1F1EF}\u{1F1F4}"],["Kazakhstan","KZ","\u{1F1F0}\u{1F1FF}"],["Kenya","KE","\u{1F1F0}\u{1F1EA}"],["Kiribati","KI","\u{1F1F0}\u{1F1EE}"],["Kosovo","XK","\u{1F1FD}\u{1F1F0}"],["Kuwait","KW","\u{1F1F0}\u{1F1FC}"],["Kyrgyzstan","KG","\u{1F1F0}\u{1F1EC}"],["Laos","LA","\u{1F1F1}\u{1F1E6}"],["Latvia","LV","\u{1F1F1}\u{1F1FB}"],["Lebanon","LB","\u{1F1F1}\u{1F1E7}"],["Lesotho","LS","\u{1F1F1}\u{1F1F8}"],["Liberia","LR","\u{1F1F1}\u{1F1F7}"],["Libya","LY","\u{1F1F1}\u{1F1FE}"],["Liechtenstein","LI","\u{1F1F1}\u{1F1EE}"],["Lithuania","LT","\u{1F1F1}\u{1F1F9}"],["Luxembourg","LU","\u{1F1F1}\u{1F1FA}"],["Macao SAR China","MO","\u{1F1F2}\u{1F1F4}"],["Madagascar","MG","\u{1F1F2}\u{1F1EC}"],["Malawi","MW","\u{1F1F2}\u{1F1FC}"],["Malaysia","MY","\u{1F1F2}\u{1F1FE}"],["Maldives","MV","\u{1F1F2}\u{1F1FB}"],["Mali","ML","\u{1F1F2}\u{1F1F1}"],["Malta","MT","\u{1F1F2}\u{1F1F9}"],["Marshall Islands","MH","\u{1F1F2}\u{1F1ED}"],["Martinique","MQ","\u{1F1F2}\u{1F1F6}"],["Mauritania","MR","\u{1F1F2}\u{1F1F7}"],["Mauritius","MU","\u{1F1F2}\u{1F1FA}"],["Mayotte","YT","\u{1F1FE}\u{1F1F9}"],["Mexico","MX","\u{1F1F2}\u{1F1FD}"],["Micronesia","FM","\u{1F1EB}\u{1F1F2}"],["Moldova","MD","\u{1F1F2}\u{1F1E9}"],["Monaco","MC","\u{1F1F2}\u{1F1E8}"],["Mongolia","MN","\u{1F1F2}\u{1F1F3}"],["Montenegro","ME","\u{1F1F2}\u{1F1EA}"],["Montserrat","MS","\u{1F1F2}\u{1F1F8}"],["Morocco","MA","\u{1F1F2}\u{1F1E6}"],["Mozambique","MZ","\u{1F1F2}\u{1F1FF}"],["Myanmar (Burma)","MM","\u{1F1F2}\u{1F1F2}"],["Namibia","NA","\u{1F1F3}\u{1F1E6}"],["Nauru","NR","\u{1F1F3}\u{1F1F7}"],["Nepal","NP","\u{1F1F3}\u{1F1F5}"],["Netherlands","NL","\u{1F1F3}\u{1F1F1}"],["New Caledonia","NC","\u{1F1F3}\u{1F1E8}"],["New Zealand","NZ","\u{1F1F3}\u{1F1FF}"],["Nicaragua","NI","\u{1F1F3}\u{1F1EE}"],["Niger","NE","\u{1F1F3}\u{1F1EA}"],["Nigeria","NG","\u{1F1F3}\u{1F1EC}"],["Niue","NU","\u{1F1F3}\u{1F1FA}"],["Norfolk Island","NF","\u{1F1F3}\u{1F1EB}"],["North Korea","KP","\u{1F1F0}\u{1F1F5}"],["North Macedonia","MK","\u{1F1F2}\u{1F1F0}"],["Northern Mariana Islands","MP","\u{1F1F2}\u{1F1F5}"],["Norway","NO","\u{1F1F3}\u{1F1F4}"],["Oman","OM","\u{1F1F4}\u{1F1F2}"],["Pakistan","PK","\u{1F1F5}\u{1F1F0}"],["Palau","PW","\u{1F1F5}\u{1F1FC}"],["Palestinian Territories","PS","\u{1F1F5}\u{1F1F8}"],["Panama","PA","\u{1F1F5}\u{1F1E6}"],["Papua New Guinea","PG","\u{1F1F5}\u{1F1EC}"],["Paraguay","PY","\u{1F1F5}\u{1F1FE}"],["Peru","PE","\u{1F1F5}\u{1F1EA}"],["Philippines","PH","\u{1F1F5}\u{1F1ED}"],["Poland","PL","\u{1F1F5}\u{1F1F1}"],["Portugal","PT","\u{1F1F5}\u{1F1F9}"],["Puerto Rico","PR","\u{1F1F5}\u{1F1F7}"],["Qatar","QA","\u{1F1F6}\u{1F1E6}"],["Romania","RO","\u{1F1F7}\u{1F1F4}"],["Russia","RU","\u{1F1F7}\u{1F1FA}"],["Rwanda","RW","\u{1F1F7}\u{1F1FC}"],["R\xE9union","RE","\u{1F1F7}\u{1F1EA}"],["Samoa","WS","\u{1F1FC}\u{1F1F8}"],["San Marino","SM","\u{1F1F8}\u{1F1F2}"],["Saudi Arabia","SA","\u{1F1F8}\u{1F1E6}"],["Senegal","SN","\u{1F1F8}\u{1F1F3}"],["Serbia","RS","\u{1F1F7}\u{1F1F8}"],["Seychelles","SC","\u{1F1F8}\u{1F1E8}"],["Sierra Leone","SL","\u{1F1F8}\u{1F1F1}"],["Singapore","SG","\u{1F1F8}\u{1F1EC}"],["Sint Maarten","SX","\u{1F1F8}\u{1F1FD}"],["Slovakia","SK","\u{1F1F8}\u{1F1F0}"],["Slovenia","SI","\u{1F1F8}\u{1F1EE}"],["Solomon Islands","SB","\u{1F1F8}\u{1F1E7}"],["Somalia","SO","\u{1F1F8}\u{1F1F4}"],["South Africa","ZA","\u{1F1FF}\u{1F1E6}"],["South Korea","KR","\u{1F1F0}\u{1F1F7}"],["South Sudan","SS","\u{1F1F8}\u{1F1F8}"],["Spain","ES","\u{1F1EA}\u{1F1F8}"],["Sri Lanka","LK","\u{1F1F1}\u{1F1F0}"],["St. Barth\xE9lemy","BL","\u{1F1E7}\u{1F1F1}"],["St. Helena","SH","\u{1F1F8}\u{1F1ED}"],["St. Kitts & Nevis","KN","\u{1F1F0}\u{1F1F3}"],["St. Lucia","LC","\u{1F1F1}\u{1F1E8}"],["St. Martin","MF","\u{1F1F2}\u{1F1EB}"],["St. Pierre & Miquelon","PM","\u{1F1F5}\u{1F1F2}"],["St. Vincent & Grenadines","VC","\u{1F1FB}\u{1F1E8}"],["Sudan","SD","\u{1F1F8}\u{1F1E9}"],["Suriname","SR","\u{1F1F8}\u{1F1F7}"],["Svalbard & Jan Mayen","SJ","\u{1F1F8}\u{1F1EF}"],["Sweden","SE","\u{1F1F8}\u{1F1EA}"],["Switzerland","CH","\u{1F1E8}\u{1F1ED}"],["Syria","SY","\u{1F1F8}\u{1F1FE}"],["S\xE3o Tom\xE9 & Pr\xEDncipe","ST","\u{1F1F8}\u{1F1F9}"],["Taiwan","TW","\u{1F1F9}\u{1F1FC}"],["Tajikistan","TJ","\u{1F1F9}\u{1F1EF}"],["Tanzania","TZ","\u{1F1F9}\u{1F1FF}"],["Thailand","TH","\u{1F1F9}\u{1F1ED}"],["Timor-Leste","TL","\u{1F1F9}\u{1F1F1}"],["Togo","TG","\u{1F1F9}\u{1F1EC}"],["Tokelau","TK","\u{1F1F9}\u{1F1F0}"],["Tonga","TO","\u{1F1F9}\u{1F1F4}"],["Trinidad & Tobago","TT","\u{1F1F9}\u{1F1F9}"],["Tristan da Cunha","TA","\u{1F1F9}\u{1F1E6}"],["Tunisia","TN","\u{1F1F9}\u{1F1F3}"],["Turkey","TR","\u{1F1F9}\u{1F1F7}"],["Turkmenistan","TM","\u{1F1F9}\u{1F1F2}"],["Turks & Caicos Islands","TC","\u{1F1F9}\u{1F1E8}"],["Tuvalu","TV","\u{1F1F9}\u{1F1FB}"],["U.S. Virgin Islands","VI","\u{1F1FB}\u{1F1EE}"],["Uganda","UG","\u{1F1FA}\u{1F1EC}"],["Ukraine","UA","\u{1F1FA}\u{1F1E6}"],["United Arab Emirates","AE","\u{1F1E6}\u{1F1EA}"],["United Kingdom","GB","\u{1F1EC}\u{1F1E7}"],["United States","US","\u{1F1FA}\u{1F1F8}"],["Uruguay","UY","\u{1F1FA}\u{1F1FE}"],["Uzbekistan","UZ","\u{1F1FA}\u{1F1FF}"],["Vanuatu","VU","\u{1F1FB}\u{1F1FA}"],["Vatican City","VA","\u{1F1FB}\u{1F1E6}"],["Venezuela","VE","\u{1F1FB}\u{1F1EA}"],["Vietnam","VN","\u{1F1FB}\u{1F1F3}"],["Wallis & Futuna","WF","\u{1F1FC}\u{1F1EB}"],["Western Sahara","EH","\u{1F1EA}\u{1F1ED}"],["Yemen","YE","\u{1F1FE}\u{1F1EA}"],["Zambia","ZM","\u{1F1FF}\u{1F1F2}"],["Zimbabwe","ZW","\u{1F1FF}\u{1F1FC}"],["\xC5land Islands","AX","\u{1F1E6}\u{1F1FD}"]];var Ho=Lr,Pr=Ho.map(([e,r,t])=>({name:e,code:r,callCode:_jssdkcore.getCountryCallingCode.call(void 0, r),flag:t}));var Do=e=>_e.createElement(_reactnativesvg2.default,_chunkLE4QILEJjs.a.call(void 0, {xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),_e.createElement(_reactnativesvg.Path,{stroke:e.color,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 6 9 17l-5-5"})),Fr=Do;var Tr=({country:e,onPress:r,selected:t})=>Te.default.createElement(_reactnative.Pressable,{onPress:r},Te.default.createElement(_reactnative.View,{style:Ie.row},Te.default.createElement(_reactnative.Text,{style:Ie.rowFlag},e.flag),Te.default.createElement(_reactnative.Text,{style:Ie.rowLabel},e.name," (+",e.callCode,")"),t&&Te.default.createElement(Fr,{color:m.interactive}))),Ie=_reactnative.StyleSheet.create({row:{flexDirection:"row",alignItems:"center",gap:10,height:56},rowFlag:{fontFamily:"Inter_400Regular",fontSize:17,lineHeight:22},rowLabel:{flex:1,fontFamily:"Inter_400Regular",fontSize:17,lineHeight:22,color:m.black}});var qo=e=>Ue.createElement(_reactnativesvg2.default,_chunkLE4QILEJjs.a.call(void 0, {xmlns:"http://www.w3.org/2000/svg",width:17,height:16,fill:"none",viewBox:"0 0 17 16"},e),Ue.createElement(_reactnativesvg.Path,{fill:e.color,fillRule:"evenodd",d:"M7.01 12.01a5.5 5.5 0 1 1 4.304-2.075.7.7 0 0 1 .156.115l3.818 3.819a.65.65 0 0 1-.92.92l-3.818-3.82a.7.7 0 0 1-.115-.155A5.48 5.48 0 0 1 7.01 12.01m4.5-5.5a4.5 4.5 0 1 1-9 0 4.5 4.5 0 0 1 9 0",clipRule:"evenodd"})),Wr=qo;var tn=600,_r=({countryCode:e,onChangeCountryCode:r,onComplete:t})=>{let[o,a]=_react.useState.call(void 0, ""),s=Er(o,tn),n=_react.useMemo.call(void 0, ()=>Pr.filter(i=>i.name.toLowerCase().includes(s.toLowerCase())),[s]);return Te.default.createElement(_reactnative.KeyboardAvoidingView,{behavior:_reactnative.Platform.OS==="ios"?"padding":void 0,style:Ar.innerContainer},Te.default.createElement(_reactnative.View,{style:Ar.header},Te.default.createElement(F,{title:"Select country code"}),Te.default.createElement(B,{LeftIcon:Te.default.createElement(Wr,{color:m.placeholder}),value:o,onChangeText:a,placeholder:"Search country"})),Te.default.createElement(_reactnative.FlatList,{style:{flex:1},data:n,keyExtractor:i=>`country-option-${i.code}`,renderItem:({item:i})=>Te.default.createElement(Tr,{country:i,selected:i.code===e,onPress:()=>{r(i.code),t()}})}),Te.default.createElement(v,{title:"Continue",onPress:t}))},Ar=_reactnative.StyleSheet.create({innerContainer:{flex:1,paddingHorizontal:16},header:{gap:20}});var an=e=>Oe.createElement(_reactnativesvg2.default,_chunkLE4QILEJjs.a.call(void 0, {xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},e),Oe.createElement(_reactnativesvg.Path,{stroke:e.color,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"m4 6 4 4 4-4"})),Ir=an;var Or=({countryCode:e,onPress:r})=>Te.default.createElement(_reactnative.Pressable,{onPress:r},Te.default.createElement(_reactnative.View,{style:Ur.cell},Te.default.createElement(_reactnative.Text,{style:Ur.text},e," +",_jssdkcore.getCountryCallingCode.call(void 0, e)),Te.default.createElement(Ir,{color:m.icon}))),Ur=_reactnative.StyleSheet.create({cell:{flexDirection:"row",alignItems:"center",gap:6},text:{fontFamily:"Inter_400Regular",fontSize:18,lineHeight:30,color:m.text}});var Br=({sendCode:e,isLoading:r,error:t,initialPhone:o,FooterComponent:a})=>{let[s,n]=_react.useState.call(void 0, o!=null?o:""),[i,d]=_react.useState.call(void 0, "US"),[f,u]=_react.useState.call(void 0, !1),g=_jssdkcore.phoneNumberTypingFormatter.call(void 0, i),l=_jssdkcore.getPlaceholderPhoneNumber.call(void 0, i),c=y=>{try{let C=y.replace(/\D/g,""),p=s.replace(/\D/g,""),E=C===p?y:g.input(y);n(E)}catch(C){console.error("Error processing phone number:",C),n("")}};return f?Te.default.createElement(_r,{countryCode:i,onChangeCountryCode:d,onComplete:()=>u(!1)}):Te.default.createElement(_reactnative.KeyboardAvoidingView,{behavior:_reactnative.Platform.OS==="ios"?"padding":void 0,style:se.innerContainer},Te.default.createElement(_reactnative.View,{style:{flex:1,justifyContent:"space-between",paddingHorizontal:16,paddingBottom:16}},Te.default.createElement(_reactnative.View,{style:se.content},Te.default.createElement(_reactnative.View,{style:se.content},Te.default.createElement(_reactnative.View,{style:se.formContainer},Te.default.createElement(F,{title:"Enter your phone"}),Te.default.createElement(B,{LeftIcon:Te.default.createElement(Or,{countryCode:i,onPress:()=>u(!0)}),value:s,onChangeText:c,error:!!t,status:t?Sn(t):" ",placeholder:l,autoComplete:"tel",keyboardType:"phone-pad",autoFocus:!0})),a),Te.default.createElement(ee,null)),Te.default.createElement(v,{title:"Continue",loading:r,onPress:()=>e(s)})))},Sn=_jssdkcore.createErrorFormatter.call(void 0, {invalid_data:"Phone is incorrect.",not_supported:"Region or carrier not yet supported.",too_many_requests:"Too many requests. Please try again later.",default:"Something went wrong. Please try again."}),se=_reactnative.StyleSheet.create({innerContainer:{flex:1},content:{gap:4},formContainer:{rowGap:24}});var kn=600,Gr=({goBackRef:e,onLoginMethodChange:r,otherLoginMethod:t})=>{let{setOtpState:o}=_react.useContext.call(void 0, _chunkLE4QILEJjs.x),a=_chunkLE4QILEJjs.u.call(void 0, ),[s,n]=_react.useState.call(void 0, ""),{state:i,loginWithCode:d,sendCode:f}=tr(),[u,g]=_react.useState.call(void 0, "phone"),{step:l,error:c=null,isLoading:y=!1,isDone:C=!1}=_react.useMemo.call(void 0, ()=>{var p;switch(i.status){case"initial":return{step:{type:"phone"}};case"sending-code":return{step:{type:u},isLoading:!0};case"awaiting-code-input":return{step:{type:"code"}};case"submitting-code":return{step:{type:"code"},isLoading:!0};case"done":return{step:{type:"code"},isDone:!0};case"error":return{step:{type:u},error:(p=i.error)!=null?p:new Error("Unknown error")}}},[u,i.status]);switch(u!==l.type&&g(l.type),_react.useEffect.call(void 0, ()=>{if(!C)return;let p=setTimeout(()=>{a()},kn);return()=>clearTimeout(p)},[C,a]),_react.useEffect.call(void 0, ()=>{if(l.type==="code")return e.current=()=>{o({status:"initial"})},()=>{e.current=null}},[l.type,o,a]),l.type){case"phone":return Te.default.createElement(Br,{initialPhone:s,sendCode:p=>{n(p),f({phone:p})},isLoading:y,error:c,FooterComponent:Te.default.createElement(ne,{onLoginMethodChange:r,otherLoginMethod:t})});case"code":return Te.default.createElement(X,{loginWithCode:p=>d({code:p,phone:s}),requestNewCode:()=>f({phone:s}),subtitle:`Please check ${s} for a message with your login code.`,isLoading:y,error:c,isDone:C})}};var xn=e=>He.createElement(_reactnativesvg2.default,_chunkLE4QILEJjs.a.call(void 0, {xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),He.createElement(_reactnativesvg.Path,{fill:e.color,d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"})),Nr=xn;var Rr=({goBack:e})=>Te.default.createElement(_reactnative.View,{style:Kr.navigationBar},Te.default.createElement(Pn,{onPress:e})),Pn=e=>Te.default.createElement(_reactnative.Pressable,_chunkLE4QILEJjs.a.call(void 0, {},e),Te.default.createElement(_reactnative.View,{style:Kr.backButton},Te.default.createElement(Nr,{color:m.icon}))),Kr=_reactnative.StyleSheet.create({navigationBar:{height:48},backButton:{width:48,height:48,justifyContent:"center",alignItems:"center"}});var _reactnativesafeareacontext = require('react-native-safe-area-context');var Wn=()=>{let e=_reactnativesafeareacontext.useSafeAreaInsets.call(void 0, );return{paddingTop:e.top,paddingBottom:e.bottom,paddingLeft:e.left,paddingRight:e.right}},jr=({children:e,visible:r})=>{let t=Wn();return Te.default.createElement(_reactnative.Modal,{animationType:"slide",transparent:!0,visible:r},Te.default.createElement(_reactnative.View,{style:[_reactnative.StyleSheet.absoluteFill,An.modalContent,t]},e))},An=_reactnative.StyleSheet.create({modalContent:{backgroundColor:m.white}});var Un=({config:e,goBackRef:r})=>{let[t,o]=_react.useState.call(void 0, ()=>_chunkLE4QILEJjs.p.call(void 0, e.loginMethods)),a=t&&_chunkLE4QILEJjs.q.call(void 0, e.loginMethods,t);switch(t){case"email":return Te.default.createElement(xr,{goBackRef:r,otherLoginMethod:a,onLoginMethodChange:o});case"sms":return Te.default.createElement(Gr,{goBackRef:r,otherLoginMethod:a,onLoginMethodChange:o});default:throw new (0, _chunkLE4QILEJjs.o)("unsupported_login_method",`Unsupported login method: ${t}`)}},On= exports.PrivyElements =()=>{let e=_chunkLE4QILEJjs.u.call(void 0, ),r=_chunkLE4QILEJjs.s.call(void 0, ),t=_chunkLE4QILEJjs.w.call(void 0, );_chunkLE4QILEJjs.v.call(void 0, );let o=_react.useRef.call(void 0, null);return Te.default.createElement(jr,{visible:t},Te.default.createElement(Rr,{goBack:()=>{var a;return((a=o.current)!=null?a:e)()}}),r&&Te.default.createElement(Un,{config:r,goBackRef:o}))};var Gn=()=>{let e=_chunkLE4QILEJjs.t.call(void 0, ),{setOtpState:r,user:t}=_react.useContext.call(void 0, _chunkLE4QILEJjs.x),o=_react.useCallback.call(void 0, ()=>r({status:"initial"}),[]),a=_react.useRef.call(void 0, t);return _react.useEffect.call(void 0, ()=>{a.current=t}),{login:_react.useCallback.call(void 0, n=>_chunkLE4QILEJjs.d.call(void 0, void 0,null,function*(){return{user:yield e(n,a.current,o)}}),[e,o])}};var _expocrypto = require('expo-crypto');var Rn=({appId:e,clientId:r,storage:t=_chunkLE4QILEJjs.n,supportedChains:o,baseUrl:a,logLevel:s})=>new (0, _jssdkcore2.default)({appId:e,clientId:r,supportedChains:o,storage:_chunkLE4QILEJjs.m.call(void 0, t),sdkVersion:`expo:${_chunkLE4QILEJjs.e.version}`,nativeAppIdentifier:_chunkLE4QILEJjs.l.call(void 0, ),crypto:{digest:_expocrypto.digest},baseUrl:a,logLevel:s});exports.PrivyContext = _chunkLE4QILEJjs.x; exports.PrivyElements = On; exports.PrivyProvider = _chunkLE4QILEJjs.z; exports.PrivyUIError = _chunkLE4QILEJjs.o; exports.SecureStorageAdapter = _chunkLE4QILEJjs.n; exports.createPrivyClient = Rn; exports.getAccessToken = _chunkLE4QILEJjs.y; exports.hasError = _chunkLE4QILEJjs.G; exports.isConnected = _chunkLE4QILEJjs.A; exports.isConnecting = _chunkLE4QILEJjs.C; exports.isCreating = _chunkLE4QILEJjs.F; exports.isDisconnected = _chunkLE4QILEJjs.D; exports.isNotCreated = _chunkLE4QILEJjs.E; exports.isReconnecting = _chunkLE4QILEJjs.B; exports.needsRecovery = _chunkLE4QILEJjs.H; exports.useCreateGuestAccount = Va; exports.useEmbeddedSolanaWallet = Pt; exports.useEmbeddedWallet = be; exports.useEmbeddedWalletStateChange = Fa; exports.useIdentityToken = Aa; exports.useLinkEmail = Ei; exports.useLinkSMS = Vi; exports.useLinkWithFarcaster = Qi; exports.useLinkWithOAuth = _chunkLE4QILEJjs.j; exports.useLinkWithSiwe = ni; exports.useLogin = Gn; exports.useLoginWithEmail = Xe; exports.useLoginWithFarcaster = ua; exports.useLoginWithOAuth = _chunkLE4QILEJjs.i; exports.useLoginWithSMS = tr; exports.useLoginWithSiwe = mi; exports.useOAuthFlow = _chunkLE4QILEJjs.k; exports.useOAuthTokens = ka; exports.usePrivy = Wt; exports.usePrivyClient = Mt; exports.useUnlinkFarcaster = oa; exports.useUnlinkOAuth = pa; exports.useUnlinkWallet = Si;
package/dist/passkey.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }var _chunkIVJEK62Cjs = require('./chunk-IVJEK62C.js');var _react = require('react');var _jssdkcore = require('@privy-io/js-sdk-core');var w=e=>_chunkIVJEK62Cjs.d.call(void 0, void 0,null,function*(){var a;let r=yield(yield Promise.resolve().then(() => _interopRequireWildcard(require("react-native-passkeys")))).create({rp:e.rp,user:e.user,challenge:e.challenge,pubKeyCredParams:e.pubKeyCredParams,excludeCredentials:e.excludeCredentials,authenticatorSelection:e.authenticatorSelection,timeout:12e4});if(!r)throw new (0, _jssdkcore.PrivyClientError)({code:"failed_to_create_passkey",error:"Could not create passkey"});return _chunkIVJEK62Cjs.b.call(void 0, _chunkIVJEK62Cjs.a.call(void 0, {},r),{type:(a=r.type)!=null?a:"public-key",clientExtensionResults:{}})});var C=e=>_chunkIVJEK62Cjs.d.call(void 0, void 0,null,function*(){var a;let r=yield(yield Promise.resolve().then(() => _interopRequireWildcard(require("react-native-passkeys")))).get({rpId:e.rpId,challenge:e.challenge,allowCredentials:e.allowCredentials,timeout:12e4});if(!r)throw new (0, _jssdkcore.PrivyClientError)({code:"no_passkey_found_for_challenge",error:"Could not find a matching passkey to login with"});return _chunkIVJEK62Cjs.b.call(void 0, _chunkIVJEK62Cjs.a.call(void 0, {},r),{type:(a=r.type)!=null?a:"public-key",clientExtensionResults:{}})});var oe=e=>{let{user:l,client:r,passkeyState:a,setPasskeyState:i}=_react.useContext.call(void 0, _chunkIVJEK62Cjs.x),d=_react.useCallback.call(void 0, o=>{var n;let u=_chunkIVJEK62Cjs.f.call(void 0, o);return i({status:"error",error:u}),(n=e==null?void 0:e.onError)==null||n.call(e,u),u},[e==null?void 0:e.onError]);return{linkWithPasskey:_react.useCallback.call(void 0, u=>_chunkIVJEK62Cjs.d.call(void 0, void 0,[u],function*({relyingParty:o}){var n,p,h,P,s,_,y,x,b;try{if(!l)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_link_passkey_before_logged_in",error:"Must be logged in to link a passkey."});i({status:"generating-challenege"});let{options:t}=yield r.auth.passkey.generateRegistrationOptions(o);i({status:"awaiting-passkey"});let N=yield w({rp:t.rp,user:{id:t.user.id,name:t.user.name,displayName:t.user.display_name},challenge:t.challenge,pubKeyCredParams:t.pub_key_cred_params,extensions:{hmacCreateSecret:(n=t.extensions)==null?void 0:n.hmac_create_secret,credProps:(h=(p=t.extensions)==null?void 0:p.cred_props)==null?void 0:h.rk,appid:(P=t.extensions)==null?void 0:P.app_id},attestation:t.attestation,excludeCredentials:t.exclude_credentials,authenticatorSelection:{authenticatorAttachment:(s=t.authenticator_selection)==null?void 0:s.authenticator_attachment,residentKey:(_=t.authenticator_selection)==null?void 0:_.resident_key,userVerification:(y=t.authenticator_selection)==null?void 0:y.user_verification,requireResidentKey:(x=t.authenticator_selection)==null?void 0:x.require_resident_key}});i({status:"submitting-response"});let O=yield r.auth.passkey.linkWithPasskey(N,o);return i({status:"done"}),(b=e==null?void 0:e.onSuccess)==null||b.call(e,O),O}catch(t){throw d(t)}}),[l,r,d,e==null?void 0:e.onSuccess]),state:a}};var de=e=>{let{user:l,client:r,passkeyState:a,setPasskeyState:i}=_react.useContext.call(void 0, _chunkIVJEK62Cjs.x),d=_react.useCallback.call(void 0, o=>{var n;let u=_chunkIVJEK62Cjs.f.call(void 0, o);return i({status:"error",error:u}),(n=e==null?void 0:e.onError)==null||n.call(e,u),u},[e==null?void 0:e.onError]);return{loginWithPasskey:_react.useCallback.call(void 0, u=>_chunkIVJEK62Cjs.d.call(void 0, void 0,[u],function*({relyingParty:o}){var n,p,h,P;try{if(l)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_login_with_passkey_while_already_logged_in",error:"Already logged in, use `useLinkWithPasskey` if you are trying to link a passkey to an existing account"});i({status:"generating-challenege"});let{options:s}=yield r.auth.passkey.generateAuthenticationOptions(o);i({status:"awaiting-passkey"});let _=yield C({challenge:s.challenge,rpId:s.rp_id,extensions:{appid:(n=s.extensions)==null?void 0:n.app_id,credProps:(p=s.extensions)==null?void 0:p.cred_props,hmacCreateSecret:(h=s.extensions)==null?void 0:h.hmac_create_secret},timeout:s.timeout,allowCredentials:s.allow_credentials,userVerification:s.user_verification});i({status:"submitting-response"});let y=yield r.auth.passkey.loginWithPasskey(_chunkIVJEK62Cjs.b.call(void 0, _chunkIVJEK62Cjs.a.call(void 0, {},_),{clientExtensionResults:{}}),s.challenge,o);return i({status:"done"}),(P=e==null?void 0:e.onSuccess)==null||P.call(e,y.user,y.is_new_user),y.user}catch(s){throw d(s)}}),[r,d,e==null?void 0:e.onSuccess]),state:a}};exports.hasError = _chunkIVJEK62Cjs.G; exports.isConnected = _chunkIVJEK62Cjs.A; exports.isConnecting = _chunkIVJEK62Cjs.C; exports.isCreating = _chunkIVJEK62Cjs.F; exports.isDisconnected = _chunkIVJEK62Cjs.D; exports.isNotCreated = _chunkIVJEK62Cjs.E; exports.isReconnecting = _chunkIVJEK62Cjs.B; exports.needsRecovery = _chunkIVJEK62Cjs.H; exports.useLinkWithPasskey = oe; exports.useLoginWithPasskey = de;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }var _chunkLE4QILEJjs = require('./chunk-LE4QILEJ.js');var _react = require('react');var _jssdkcore = require('@privy-io/js-sdk-core');var w=e=>_chunkLE4QILEJjs.d.call(void 0, void 0,null,function*(){var a;let r=yield(yield Promise.resolve().then(() => _interopRequireWildcard(require("react-native-passkeys")))).create({rp:e.rp,user:e.user,challenge:e.challenge,pubKeyCredParams:e.pubKeyCredParams,excludeCredentials:e.excludeCredentials,authenticatorSelection:e.authenticatorSelection,timeout:12e4});if(!r)throw new (0, _jssdkcore.PrivyClientError)({code:"failed_to_create_passkey",error:"Could not create passkey"});return _chunkLE4QILEJjs.b.call(void 0, _chunkLE4QILEJjs.a.call(void 0, {},r),{type:(a=r.type)!=null?a:"public-key",clientExtensionResults:{}})});var C=e=>_chunkLE4QILEJjs.d.call(void 0, void 0,null,function*(){var a;let r=yield(yield Promise.resolve().then(() => _interopRequireWildcard(require("react-native-passkeys")))).get({rpId:e.rpId,challenge:e.challenge,allowCredentials:e.allowCredentials,timeout:12e4});if(!r)throw new (0, _jssdkcore.PrivyClientError)({code:"no_passkey_found_for_challenge",error:"Could not find a matching passkey to login with"});return _chunkLE4QILEJjs.b.call(void 0, _chunkLE4QILEJjs.a.call(void 0, {},r),{type:(a=r.type)!=null?a:"public-key",clientExtensionResults:{}})});var oe=e=>{let{user:l,client:r,passkeyState:a,setPasskeyState:i}=_react.useContext.call(void 0, _chunkLE4QILEJjs.x),d=_react.useCallback.call(void 0, o=>{var n;let u=_chunkLE4QILEJjs.f.call(void 0, o);return i({status:"error",error:u}),(n=e==null?void 0:e.onError)==null||n.call(e,u),u},[e==null?void 0:e.onError]);return{linkWithPasskey:_react.useCallback.call(void 0, u=>_chunkLE4QILEJjs.d.call(void 0, void 0,[u],function*({relyingParty:o}){var n,p,h,P,s,_,y,x,b;try{if(!l)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_link_passkey_before_logged_in",error:"Must be logged in to link a passkey."});i({status:"generating-challenege"});let{options:t}=yield r.auth.passkey.generateRegistrationOptions(o);i({status:"awaiting-passkey"});let N=yield w({rp:t.rp,user:{id:t.user.id,name:t.user.name,displayName:t.user.display_name},challenge:t.challenge,pubKeyCredParams:t.pub_key_cred_params,extensions:{hmacCreateSecret:(n=t.extensions)==null?void 0:n.hmac_create_secret,credProps:(h=(p=t.extensions)==null?void 0:p.cred_props)==null?void 0:h.rk,appid:(P=t.extensions)==null?void 0:P.app_id},attestation:t.attestation,excludeCredentials:t.exclude_credentials,authenticatorSelection:{authenticatorAttachment:(s=t.authenticator_selection)==null?void 0:s.authenticator_attachment,residentKey:(_=t.authenticator_selection)==null?void 0:_.resident_key,userVerification:(y=t.authenticator_selection)==null?void 0:y.user_verification,requireResidentKey:(x=t.authenticator_selection)==null?void 0:x.require_resident_key}});i({status:"submitting-response"});let O=yield r.auth.passkey.linkWithPasskey(N,o);return i({status:"done"}),(b=e==null?void 0:e.onSuccess)==null||b.call(e,O),O}catch(t){throw d(t)}}),[l,r,d,e==null?void 0:e.onSuccess]),state:a}};var de=e=>{let{user:l,client:r,passkeyState:a,setPasskeyState:i}=_react.useContext.call(void 0, _chunkLE4QILEJjs.x),d=_react.useCallback.call(void 0, o=>{var n;let u=_chunkLE4QILEJjs.f.call(void 0, o);return i({status:"error",error:u}),(n=e==null?void 0:e.onError)==null||n.call(e,u),u},[e==null?void 0:e.onError]);return{loginWithPasskey:_react.useCallback.call(void 0, u=>_chunkLE4QILEJjs.d.call(void 0, void 0,[u],function*({relyingParty:o}){var n,p,h,P;try{if(l)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_login_with_passkey_while_already_logged_in",error:"Already logged in, use `useLinkWithPasskey` if you are trying to link a passkey to an existing account"});i({status:"generating-challenege"});let{options:s}=yield r.auth.passkey.generateAuthenticationOptions(o);i({status:"awaiting-passkey"});let _=yield C({challenge:s.challenge,rpId:s.rp_id,extensions:{appid:(n=s.extensions)==null?void 0:n.app_id,credProps:(p=s.extensions)==null?void 0:p.cred_props,hmacCreateSecret:(h=s.extensions)==null?void 0:h.hmac_create_secret},timeout:s.timeout,allowCredentials:s.allow_credentials,userVerification:s.user_verification});i({status:"submitting-response"});let y=yield r.auth.passkey.loginWithPasskey(_chunkLE4QILEJjs.b.call(void 0, _chunkLE4QILEJjs.a.call(void 0, {},_),{clientExtensionResults:{}}),s.challenge,o);return i({status:"done"}),(P=e==null?void 0:e.onSuccess)==null||P.call(e,y.user,y.is_new_user),y.user}catch(s){throw d(s)}}),[r,d,e==null?void 0:e.onSuccess]),state:a}};exports.hasError = _chunkLE4QILEJjs.G; exports.isConnected = _chunkLE4QILEJjs.A; exports.isConnecting = _chunkLE4QILEJjs.C; exports.isCreating = _chunkLE4QILEJjs.F; exports.isDisconnected = _chunkLE4QILEJjs.D; exports.isNotCreated = _chunkLE4QILEJjs.E; exports.isReconnecting = _chunkLE4QILEJjs.B; exports.needsRecovery = _chunkLE4QILEJjs.H; exports.useLinkWithPasskey = oe; exports.useLoginWithPasskey = de;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@privy-io/expo",
3
- "version": "0.26.1",
3
+ "version": "0.26.2-beta-20241010170842",
4
4
  "description": "Expo client for the Privy Auth API",
5
5
  "keywords": [
6
6
  "authentication",
@@ -71,7 +71,7 @@
71
71
  }
72
72
  },
73
73
  "dependencies": {
74
- "@privy-io/js-sdk-core": "0.28.8",
74
+ "@privy-io/js-sdk-core": "0.28.9-beta-20241010170842",
75
75
  "react-fast-compare": "^3.2.2",
76
76
  "zustand": "^4.4.1"
77
77
  },
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var pt=Object.defineProperty,mt=Object.defineProperties;var yt=Object.getOwnPropertyDescriptors;var oe=Object.getOwnPropertySymbols;var Ce=Object.prototype.hasOwnProperty,Re=Object.prototype.propertyIsEnumerable;var We=(e,t,o)=>t in e?pt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,R= exports.a =(e,t)=>{for(var o in t||(t={}))Ce.call(t,o)&&We(e,o,t[o]);if(oe)for(var o of oe(t))Re.call(t,o)&&We(e,o,t[o]);return e},V= exports.b =(e,t)=>mt(e,yt(t));var lr=(e,t)=>{var o={};for(var r in e)Ce.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&oe)for(var r of oe(e))t.indexOf(r)<0&&Re.call(e,r)&&(o[r]=e[r]);return o};var y=(e,t,o)=>new Promise((r,c)=>{var a=n=>{try{s(o.next(n))}catch(d){c(d)}},l=n=>{try{s(o.throw(n))}catch(d){c(d)}},s=n=>n.done?r(n.value):Promise.resolve(n.value).then(a,l);s((o=o.apply(e,t)).next())});var _expoappleauthentication = require('expo-apple-authentication'); var ot = _interopRequireWildcard(_expoappleauthentication);var _expoapplication = require('expo-application');var _expolinking = require('expo-linking'); var B = _interopRequireWildcard(_expolinking); var ie = _interopRequireWildcard(_expolinking); var z = _interopRequireWildcard(_expolinking); var H = _interopRequireWildcard(_expolinking);var _exposecurestore = require('expo-secure-store'); var O = _interopRequireWildcard(_exposecurestore);var _expowebbrowser = require('expo-web-browser'); var re = _interopRequireWildcard(_expowebbrowser); var De = _interopRequireWildcard(_expowebbrowser);var _react = require('react'); var _react2 = _interopRequireDefault(_react);var _reactnative = require('react-native');var _jssdkcore = require('@privy-io/js-sdk-core'); var _jssdkcore2 = _interopRequireDefault(_jssdkcore);var _expocrypto = require('expo-crypto');var ke={name:"@privy-io/expo",version:"0.26.1",description:"Expo client for the Privy Auth API",keywords:["authentication","authorization","identity","privacy","privy","user data","react-native","expo","web3"],license:"Apache-2.0",source:"./src/index.ts",main:"./dist/esm/index.js",types:"./dist/index.d.ts",exports:{".":{require:"./dist/index.js",import:"./dist/esm/index.js",types:"./dist/index.d.ts"},"./passkey":{require:"./dist/passkey.js",import:"./dist/esm/passkey.js",types:"./dist/passkey.d.ts"}},files:["dist/**/*","LICENSE","README.md"],scripts:{build:"npx tsup --clean --minify","generate-types":"npx tsup --dts-only",clean:"rm -rf dist .turbo",dev:"npx tsup --watch",test:'jest --testMatch "**/test/**/*.test.ts"',"test:ci":"npm run test",lint:'eslint "src/**/*.{ts,tsx,js,jsx}" && npx tsc --noEmit',format:'eslint "src/**/*.{ts,tsx,js,jsx}" --fix'},peerDependencies:{"@privy-io/expo-native-extensions":"0.0.3",react:"*","react-native":"*","react-native-passkeys":"^0.2.1","react-native-webview":"*","react-native-safe-area-context":"*","react-native-svg":"*","expo-constants":"*","expo-linking":"*","expo-crypto":"*","expo-font":"*","@expo-google-fonts/inter":"*","expo-secure-store":"*","expo-application":"*","expo-apple-authentication":"*","expo-web-browser":"*"},peerDependenciesMeta:{"expo-font":{optional:!0},"@expo-google-fonts/inter":{optional:!0}},dependencies:{"@privy-io/js-sdk-core":"0.28.8","react-fast-compare":"^3.2.2",zustand:"^4.4.1"},devDependencies:{"@privy-io/eslint-config-custom":"*","@privy-io/tsconfig":"*","@simplewebauthn/types":"9.0.1","@tsconfig/node16-strictest-esm":"^1.0.3","@svgr/core":"^8.1.0","@svgr/plugin-jsx":"^8.1.0","@svgr/plugin-svgo":"^8.1.0",tsup:"^6.2.3",typescript:"~5.5.3"},author:"privy.io",publishConfig:{access:"public"}};var _reactnativewebview = require('react-native-webview'); var _reactnativewebview2 = _interopRequireDefault(_reactnativewebview);var xe=({client:e,isClientReady:t,setWebViewState:o,webViewState:r,logLevel:c})=>{let a=_react.useRef.call(void 0, null);_react.useEffect.call(void 0, ()=>{a.current&&r==="loaded"&&e.setMessagePoster(a.current)},[e,a.current,r==="loaded"]),_react.useEffect.call(void 0, ()=>_reactnative.AppState.addEventListener("change",n=>y(void 0,null,function*(){a.current&&n==="active"&&((yield e.embeddedWallet.ping(500))||(a.current.reload(),o("reloading")))})).remove,[]);let l=_react.useCallback.call(void 0, s=>y(void 0,null,function*(){let{data:n}=s.nativeEvent;e.embeddedWallet.onMessage(JSON.parse(n))}),[e]);return t?_react2.default.createElement(_reactnativewebview2.default,{style:{flex:1},ref:a,cacheEnabled:!1,cacheMode:"LOAD_NO_CACHE",source:{uri:e.embeddedWallet.getURL()},webviewDebuggingEnabled:c==="DEBUG",onLoad:()=>o("loaded"),onError:console.error,onMessage:l}):null};function ae(i){return y(this,arguments,function*({client:e,setWallet:t,createWalletCallbacks:o,recoveryMethod:r,setRecoveryFlowState:c,password:a,recoveryToken:l,recoverySecretOverride:s,iCloudRecordNameOverride:n,solanaAccount:d}){var p,g;switch(r){case"user-passcode":if(!a)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"password is required for user-passcode recovery method"});break;case"google-drive":if(!l)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"Recovery token is required for google-drive recovery method"});break;case"icloud":if(!s||!n)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"iCloud recovery failed due to inability to store credentials"});break}t({status:"creating",account:null});let u=r==="icloud"?"icloud-native":r;try{let{provider:v,user:h}=yield e.embeddedWallet.create(a,u,l,s,n,d),m=_jssdkcore.getUserEmbeddedWallet.call(void 0, h);return(g=(p=o.current)==null?void 0:p.onSuccess)==null||g.call(p,v),t({status:"connected",provider:v,account:m}),c({status:"initial"}),v}catch(v){let h=v instanceof Error?v.message:"Error creating embedded wallet";throw t({status:"error",error:h,account:null}),c({status:"initial"}),new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_creation_error",error:h})}})}function Oe(a){return y(this,arguments,function*({client:e,setSolanaWallet:t,createSolanaWalletCallbacks:o,setSolanaRecoveryFlowState:r,ethereumAccount:c}){var l,s;t({status:"creating"});try{let n=yield e.embeddedWallet.createSolana({ethereumAccount:c});return(s=(l=o.current)==null?void 0:l.onSuccess)==null||s.call(l,n),t({status:"connected",publicKey:n._publicKey}),r({status:"initial"}),n}catch(n){let d=n instanceof Error?n.message:"Error creating embedded wallet";throw t({status:"error",error:d}),r({status:"initial"}),new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_creation_error",error:d})}})}function ne(d){return y(this,arguments,function*({client:e,account:t,setWallet:o,recoverWalletCallbacks:r,recoveryMethod:c,setRecoveryFlowState:a,password:l,recoveryToken:s,recoverySecretOverride:n}){var i,u,p,g;if(!t)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});switch(c){case"user-passcode":if(!l)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"password is required for user-passcode recovery method"});break;case"google-drive":if(!s)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"Recovery token is required for google-drive recovery method"});break;case"icloud":if(!n)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"Record name is required for icloud recovery method"});break}o({status:"connecting",account:t});try{let v=yield e.embeddedWallet.getProvider(t,l,s,n);return o({status:"connected",provider:v,account:t}),a({status:"initial"}),(u=(i=r.current)==null?void 0:i.onSuccess)==null||u.call(i,v),v}catch(v){o({status:"needs-recovery",account:t}),a({status:"initial"});let h=new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:v instanceof Error?v.message:"Error recovering embedded wallet"});throw(g=(p=r.current)==null?void 0:p.onError)==null||g.call(p,h),h}})}function Pe(a){return y(this,arguments,function*({client:e,solanaAccount:t,setSolanaWallet:o,recoverSolanaWalletCallbacks:r,setSolanaRecoveryFlowState:c}){var l,s,n,d;if(!t)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});o({status:"connecting"});try{let i=yield e.embeddedWallet.getSolanaProvider(t);return o({status:"connected",publicKey:i._publicKey}),c({status:"initial"}),(s=(l=r.current)==null?void 0:l.onSuccess)==null||s.call(l,i),i}catch(i){o({status:"needs-recovery"}),c({status:"initial"});let u=new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:i instanceof Error?i.message:"Error recovering embedded wallet"});throw(d=(n=r.current)==null?void 0:n.onError)==null||d.call(n,u),u}})}var Ie=({client:e,user:t,solanaWallet:o,setSolanaWallet:r,setSolanaRecoveryFlowState:c,webViewState:a,createSolanaWalletCallbacks:l,recoverSolanaWalletCallbacks:s})=>{let n=_react.useMemo.call(void 0, ()=>_jssdkcore.getUserEmbeddedSolanaWallet.call(void 0, t),[t]),d=_react.useCallback.call(void 0, ()=>y(void 0,null,function*(){var v;let{user:p}=yield e.user.get(),g=(v=_jssdkcore.getUserEmbeddedWallet.call(void 0, p))!=null?v:void 0;return yield Oe({client:e,setSolanaWallet:r,createSolanaWalletCallbacks:l,setSolanaRecoveryFlowState:c,ethereumAccount:g})}),[e,l]),i=_react.useCallback.call(void 0, ()=>y(void 0,null,function*(){if(!n)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});return Pe({client:e,solanaAccount:n,setSolanaWallet:r,recoverSolanaWalletCallbacks:s,setSolanaRecoveryFlowState:c})}),[e,n]),u=_react.useCallback.call(void 0, ()=>y(void 0,null,function*(){if(!n)throw r({status:"not-created"}),new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});r(p=>p.status==="connected"?{status:"reconnecting"}:{status:"connecting"});try{let p=yield e.embeddedWallet.getSolanaProvider(n);return r({status:"connected",publicKey:p._publicKey}),p}catch(p){throw _jssdkcore.errorIndicatesRecoveryIsNeeded.call(void 0, p)?(r({status:"needs-recovery"}),new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_needs_recovery",error:"Embedded wallet not loaded on device"})):p instanceof Error?(r({status:"error",error:p.message}),new (0, _jssdkcore.PrivyClientError)({code:"unknown_embedded_wallet_error",error:p.message})):(r({status:"error",error:"Error loading embedded wallet"}),new (0, _jssdkcore.PrivyClientError)({code:"unknown_embedded_wallet_error",error:"Error loading embedded wallet"}))}}),[e,n]);return _react.useEffect.call(void 0, ()=>{if(!t&&o.status!=="disconnected")return r({status:"disconnected"});a==="loaded"&&u().catch(()=>{})},[a,t,n]),_react.useEffect.call(void 0, ()=>{o.status==="error"&&o.error.includes("User must be logged in")&&u()},[o.status]),{create:d,recover:i,getProvider:u}};function Fe(){return y(this,null,function*(){try{return yield Promise.resolve().then(() => _interopRequireWildcard(require("@privy-io/expo-native-extensions")))}catch(e){throw new Error("@privy-io/expo-native-extensions not found. Ensure that you're explicitly including as a dependency, and running an Expo development build")}})}function ve(r){return y(this,arguments,function*({user:e,appId:t,client:o}){var s;if(_reactnative.Platform.OS==="android")throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"iCloud recovery is not supported on Android"});let c=yield Fe(),a=yield o.recovery.icloudAuth.getICloudConfiguration("expo-ios");if(!(a==null?void 0:a.container_identifier))throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"An iCloud Container ID must be specified in the Privy Dashboard."});try{let{recoverySecret:n,iCloudRecordName:d}=yield c.writeRecoverySecretToICloud({containerId:a.container_identifier,appId:t,userId:e.id});return{recoverySecret:n,iCloudRecordName:d}}catch(n){if(n instanceof Error){let d=(s=n.message.split("Caused by: ")[1])!=null?s:"Error writing to iCloud";throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:d})}throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"Error writing to iCloud"})}})}function Me(o){return y(this,arguments,function*({walletAddress:e,client:t}){var n;if(_reactnative.Platform.OS==="android")throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"iCloud recovery is not supported on Android"});let r=yield Fe(),a=(yield t.recovery.getRecoveryKeyMaterial(e)).icloud_record_name;if(!a)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"iCloud recovery not properly backed up."});let l=yield t.recovery.icloudAuth.getICloudConfiguration("expo-ios"),s=l==null?void 0:l.container_identifier;if(!s)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"An iCloud Container ID must be specified in the Privy Dashboard."});try{let{recoverySecret:d}=yield r.readRecoverySecretFromICloud({containerId:s,recordName:a});return{recoverySecret:d}}catch(d){if(d instanceof Error){let i=(n=d.message.split("Caused by: ")[1])!=null?n:"Error writing to iCloud";throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:i})}throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"Error writing to iCloud"})}})}var _reactfastcompare = require('react-fast-compare'); var _reactfastcompare2 = _interopRequireDefault(_reactfastcompare);var Te=e=>t=>e(o=>_reactfastcompare2.default.call(void 0, o,t)?o:t);function x(e){return e instanceof Error||e instanceof _jssdkcore.PrivyApiError||e instanceof _jssdkcore.PrivyClientError?e:typeof e=="string"?new Error(e):new Error("Unknown error")}var jr=e=>new Promise(t=>setTimeout(t,e));function qr(){let e=_react.useRef.call(void 0, _reactnative.AppState.currentState);_react.useEffect.call(void 0, ()=>_reactnative.AppState.addEventListener("change",r=>{e.current=r}).remove,[]);function t(){return _reactnative.AppState.currentState}return{appState:e,getCurrentAppState:t}}function se(c){return y(this,arguments,function*({provider:e,redirectUri:t,client:o,onError:r}){try{let a;switch(e){case"google-drive":{let{url:d}=yield o.recovery.auth.generateURL(ie.createURL(t||"/"));a=d;break}default:throw new (0, _jssdkcore.PrivyClientError)({error:"OAuth invalid provider",code:"embedded_wallet_recovery_error"})}let l=yield De.openAuthSessionAsync(a);if(_reactnative.Platform.OS==="android")return;if(l.type!=="success")throw new (0, _jssdkcore.PrivyClientError)({error:"Recovery OAuth session failed",code:"embedded_wallet_recovery_error"});let{queryParams:s}=ie.parse(l.url),n;switch(e){case"google-drive":{let{privy_oauth_state:d,privy_oauth_code:i}=s;if(!i||!d)throw new (0, _jssdkcore.PrivyClientError)({error:"Recovery OAuth invalid credentials",code:"embedded_wallet_recovery_error"});n=yield fe({oAuthCode:i,oAuthState:d,client:o});break}default:throw new (0, _jssdkcore.PrivyClientError)({error:"Recovery OAuth invalid provider",code:"embedded_wallet_recovery_error"})}return n}catch(a){throw r==null||r(x(a)),a}})}function fe(r){return y(this,arguments,function*({oAuthCode:e,oAuthState:t,client:o}){let{access_token:c}=yield o.recovery.auth.authorize(e,t);if(!c)throw new (0, _jssdkcore.PrivyClientError)({error:"OAuth invalid credentials",code:"login_with_oauth_returned_with_invalid_credentials"});return c})}function de(a){return y(this,arguments,function*({client:e,recoveryInput:t,setWalletRecoveryCallbacks:o,setRecoveryFlowState:r,setWallet:c}){var l,s,n,d;try{let{provider:i,user:u}=yield e.embeddedWallet.setRecovery(t),p=_jssdkcore.getUserEmbeddedWallet.call(void 0, u);return c({status:"connected",provider:i,account:p}),(s=(l=o.current)==null?void 0:l.onSuccess)==null||s.call(l,i),r({status:"initial"}),i}catch(i){let u=new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_set_recovery_error",error:i instanceof Error?i.message:"Error setting password on embedded wallet"});throw(d=(n=o.current)==null?void 0:n.onError)==null||d.call(n,u),r({status:"initial"}),u}})}function Ve(e){return e===void 0?{recoveryMethod:"privy"}:typeof e=="string"?{recoveryMethod:"user-passcode",password:e}:e.recoveryMethod==="user-passcode"?{recoveryMethod:"user-passcode",password:e.password}:{recoveryMethod:e.recoveryMethod}}var ze=({client:e,user:t,appId:o,wallet:r,setWallet:c,setRecoveryFlowState:a,webViewState:l,createWalletCallbacks:s,recoverWalletCallbacks:n,setWalletRecoveryCallbacks:d})=>{let i=_react.useMemo.call(void 0, ()=>_jssdkcore.getUserEmbeddedWallet.call(void 0, t),[t]),u=_react.useCallback.call(void 0, m=>y(void 0,null,function*(){var A,N;if(i)throw new (0, _jssdkcore.PrivyClientError)({error:"This user already has an embedded wallet",code:"embedded_wallet_already_exists"});let{user:w}=yield e.user.get(),{password:f,recoveryMethod:b}=Ve(m),S,E,U;if(b==="google-drive"&&(S=yield se({provider:b,client:e,onError:(A=s.current)==null?void 0:A.onError}),a({status:"creating-wallet"}),!S))return null;if(b==="icloud"){if(!w)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"User must be loaded before creating a wallet with iCloud."});let{recoverySecret:I,iCloudRecordName:L}=yield ve({user:w,appId:o,client:e});E=I,U=L}return yield ae({client:e,setWallet:c,createWalletCallbacks:s,recoveryMethod:b,setRecoveryFlowState:a,password:f,recoverySecretOverride:E,iCloudRecordNameOverride:U,solanaAccount:(N=_jssdkcore.getUserEmbeddedSolanaWallet.call(void 0, w))!=null?N:void 0})}),[e,i,t]),p=_react.useCallback.call(void 0, m=>y(void 0,null,function*(){var b;if(r.status!=="connected")throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_to_set_password_before_connected",error:"Embedded wallet must be connected before setting password"});if(!i)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});if(_jssdkcore.getUserEmbeddedSolanaWallet.call(void 0, t))throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_set_recovery_error",error:"Cannot set user-controlled recovery for a user with an embedded Solana wallet."});_jssdkcore.throwIfInvalidRecoveryUpgradePath.call(void 0, {currentRecoveryMethod:i.recovery_method,upgradeToRecoveryMethod:m.recoveryMethod});let w,f;switch(m.recoveryMethod){case"privy":f=V(R({},m),{wallet:i});break;case"user-passcode":f=V(R({},m),{wallet:i,password:m.password});break;case"google-drive":if(w=yield se({provider:m.recoveryMethod,client:e,onError:(b=d.current)==null?void 0:b.onError}),a({status:"upgrading-recovery"}),!w)return null;f={recoveryMethod:"google-drive",wallet:i,recoveryAccessToken:w};break;case"icloud":if(!t)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"User must be loaded before backing up to iCloud."});let{recoverySecret:S,iCloudRecordName:E}=yield ve({user:t,appId:o,client:e});f={recoveryMethod:"icloud-native",recoverySecretOverride:S,iCloudRecordNameOverride:E,wallet:i};break;default:throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"Unrecognized recovery method"})}return de({client:e,recoveryInput:f,setWalletRecoveryCallbacks:d,setRecoveryFlowState:a,setWallet:c})}),[e,i,r.status,t]),g=_react.useCallback.call(void 0, m=>y(void 0,null,function*(){return p({recoveryMethod:"user-passcode",password:m})}),[e,i,r.status]),v=_react.useCallback.call(void 0, m=>y(void 0,null,function*(){var E;if(!i)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});let{password:w,recoveryMethod:f}=Ve(m),b,S;if(f==="google-drive"&&(b=yield se({provider:f,client:e,onError:(E=n.current)==null?void 0:E.onError}),a({status:"recovering"}),!b))return null;if(f==="icloud"){if(!t)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"User must be loaded before recovering via iCloud."});let{recoverySecret:U}=yield Me({client:e,walletAddress:i.address});S=U}return ne({client:e,account:i,setWallet:c,recoverWalletCallbacks:n,recoveryMethod:f,setRecoveryFlowState:a,password:w,recoveryToken:b,recoverySecretOverride:S})}),[e,i]),h=_react.useCallback.call(void 0, ()=>y(void 0,null,function*(){if(!i)throw c({status:"not-created",account:null}),new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});c(m=>m.status==="connected"?{status:"reconnecting",account:i}:{status:"connecting",account:i});try{let m=yield e.embeddedWallet.getProvider(i);return c({status:"connected",provider:m,account:i}),m}catch(m){throw _jssdkcore.errorIndicatesRecoveryIsNeeded.call(void 0, m)?(c({status:"needs-recovery",account:i}),new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_needs_recovery",error:"Embedded wallet not loaded on device"})):m instanceof Error?(c({status:"error",error:m.message,account:i}),new (0, _jssdkcore.PrivyClientError)({code:"unknown_embedded_wallet_error",error:m.message})):(c({status:"error",error:"Error loading embedded wallet",account:i}),new (0, _jssdkcore.PrivyClientError)({code:"unknown_embedded_wallet_error",error:"Error loading embedded wallet"}))}}),[e,i]);return _react.useEffect.call(void 0, ()=>{if(!t&&r.status!=="disconnected")return c({status:"disconnected",account:null});l==="loaded"&&h().catch(()=>{})},[l,t,i]),_react.useEffect.call(void 0, ()=>{r.status==="error"&&r.error.includes("User must be logged in")&&h()},[r.status]),{create:u,recover:v,setPassword:g,setRecovery:p,getProvider:h}};var qe=({client:e,user:t,isReady:o,customAuth:r})=>{let[c,a]=_react.useState.call(void 0, {status:"initial"});return _react.useEffect.call(void 0, ()=>{(()=>y(void 0,null,function*(){if(!(r!=null&&r.enabled)){a({status:"not-enabled"});return}a({status:"loading"});let{getCustomAccessToken:s,isLoading:n}=r;if(!(!o||n))try{let d=yield s();if(!d&&t){yield e.auth.logout(),a({status:"done"});return}if(!d){a({status:"done"});return}if(t){a({status:"done"});return}if(!(yield e.auth.customProvider.syncWithToken(d))){yield e.auth.logout(),a({status:"error",error:new (0, _jssdkcore.PrivyClientError)({error:"Failed to sync with custom auth provider",code:"third_party_auth_error"})});return}a({status:"done"})}catch(d){if(console.log("Error syncing with custom auth provider",d),a({status:"error",error:d}),t)throw yield e.auth.logout(),new (0, _jssdkcore.PrivyClientError)({error:"Third-party auth failed",code:"third_party_auth_error"})}}))()},[e,t,o,r==null?void 0:r.enabled,r==null?void 0:r.getCustomAccessToken,r==null?void 0:r.isLoading]),{customAuthState:c,customAuthStateIsSettled:c.status!=="loading"&&c.status!=="initial"}};var Be=({client:e,user:t,isUserInitialized:o,oAuthState:r,oAuthCallbacks:c,setOAuthState:a,recoveryFlowState:l,oAuthStateRef:s})=>{let n=z.useURL(),d=_react.useCallback.call(void 0, i=>{var p,g;let u=x(i);a({status:"error",error:u}),(g=(p=c.current).onError)==null||g.call(p,u)},[a]);return _react.useEffect.call(void 0, ()=>{function i(){return y(this,null,function*(){var v,h;if(!n||r.status!=="loading"||l.status!=="initial")return;let{queryParams:u}=z.parse(n),{privy_oauth_state:p,privy_oauth_code:g}=u;if(!g||!p){a({status:"done"});return}try{let m,w;if(t)m=yield e.auth.oauth.linkWithCode(g,p);else{let f=yield e.auth.oauth.loginWithCode(g,p,void 0,void 0,s.current.disableSignup?"no-signup":"login-or-sign-up");m=f.user,w=!!f.is_new_user}return(h=(v=c.current).onSuccess)==null||h.call(v,m,w),s.current={},a({status:"done"}),yield z.openURL(n.split("?")[0])}catch(m){s.current={},d(m)}})}_reactnative.Platform.OS==="android"&&o&&i()},[n,o])};var Ke=({client:e,user:t,createWalletCallbacks:o,recoverWalletCallbacks:r,setWalletRecoveryCallbacks:c,recoveryFlowState:a,oAuthState:l,setRecoveryFlowState:s,setWallet:n,appStateVisible:d,webViewLoaded:i})=>{let u=H.useURL(),p=_react.useMemo.call(void 0, ()=>_jssdkcore.getUserEmbeddedWallet.call(void 0, t),[t]),g=_react.useCallback.call(void 0, v=>{var m,w,f,b;let h=x(v);a.status==="creating-wallet"?(w=(m=o.current).onError)==null||w.call(m,x(h)):(b=(f=r.current).onError)==null||b.call(f,x(h)),s({status:"initial"})},[a]);return _react.useEffect.call(void 0, ()=>{function v(){return y(this,null,function*(){var f;if(!u&&a.status!=="initial"&&d&&g(new Error("Recovery OAuth session failed")),!u||a.status==="initial"||l.status!=="initial"||!d||!i)return;let{queryParams:h}=H.parse(u),{privy_oauth_state:m,privy_oauth_code:w}=h;if(!(!w||!m)){yield H.openURL(u.split("?")[0]);try{let b=yield fe({oAuthCode:w,oAuthState:m,client:e});if(a.status==="creating-wallet"){let S=(f=_jssdkcore.getUserEmbeddedSolanaWallet.call(void 0, t))!=null?f:void 0;yield ae({client:e,setWallet:n,createWalletCallbacks:o,recoveryMethod:"google-drive",setRecoveryFlowState:s,recoveryToken:b,solanaAccount:S})}else if(a.status==="upgrading-recovery"){if(!p)throw new Error("Embedded wallet not found");yield de({client:e,recoveryInput:{recoveryMethod:"google-drive",wallet:p,recoveryAccessToken:b},setWalletRecoveryCallbacks:c,setRecoveryFlowState:s,setWallet:n})}else yield ne({client:e,account:p,setWallet:n,recoverWalletCallbacks:r,recoveryMethod:"google-drive",setRecoveryFlowState:s,recoveryToken:b})}catch(b){g(b)}}})}_reactnative.Platform.OS==="android"&&v()},[u,a.status,d,i])};var Ge=({client:e,isUserInitialized:t,setIsUserInitialized:o})=>{_react.useEffect.call(void 0, ()=>{t||(()=>y(void 0,null,function*(){try{yield e.user.get()}catch(c){}finally{o(!0)}}))()},[t])};var _zustand = require('zustand');var k=class extends Error{constructor(o,r){super(r);this.code=o,this.error=r}};var le={success:e=>({value:e}),error:e=>({error:e})};var Ye=e=>{let t=Array.from(new Set(e)),o=t.length;return o===0?le.error(new k("no_login_methods_available","No login methods available")):o>2?le.error(new k("too_many_login_methods",`More than two (${o}) login methods were provided`)):le.success(t)},Ho= exports.p =e=>e[0],qo= exports.q =(e,t)=>{if(e.length!==2)return null;let[o,r]=e;return t===o?r:o},Bo= exports.r ={email:"email",sms:"phone"};var Qt=1e3*60*5,q=_zustand.create.call(void 0, )((e,t)=>({privyElementsConfig:null,loginPromiseExecutor:null,isUIMounted:!1,updateUIMounted:o=>e({isUIMounted:o}),openLoginFlow:(o,r,c)=>new Promise((a,l)=>{if(r!==null)return l(new k("user_already_logged_in","User is already logged in"));if(!t().isUIMounted)return l(new k("privy_elements_not_ready","Privy Elements is not mounted"));if(t().loginPromiseExecutor!==null)return l(new k("existing_login_flow_in_progress","A login flow is already in progress"));let s=Ye(o.loginMethods);if(s.error)return l(s.error);let n={loginMethods:s.value},d=setTimeout(()=>{l(new k("login_flow_timeout","The login flow timed out")),t().closeLoginFlow()},Qt);c(),e({loginPromiseExecutor:{resolve(u){clearTimeout(d),a(u)},reject(u){clearTimeout(d),l(u)}},privyElementsConfig:n})}),closeLoginFlow:()=>{var o;return(o=t().loginPromiseExecutor)==null||o.reject(new k("login_flow_closed","The login flow was closed")),e({privyElementsConfig:null,loginPromiseExecutor:null})}})),Jo= exports.s =()=>q(e=>e.privyElementsConfig),Qo= exports.t =()=>q(e=>e.openLoginFlow),Zo= exports.u =()=>q(e=>e.closeLoginFlow),Zt=e=>{let{loginPromiseExecutor:t}=q.getState();t==null||t.resolve(e)},Xe=()=>Zt,ea= exports.v =()=>{let e=q(t=>t.updateUIMounted);_react.useEffect.call(void 0, ()=>(e(!0),()=>{e(!1)}),[e])},ta= exports.w =()=>q(e=>e.privyElementsConfig!==null);var we=_react.createContext.call(void 0, {}),D;function wa(e){return D?D.getAccessToken():e!=null&&e.strict?Promise.reject(new (0, _jssdkcore.PrivyClientError)({code:"attempted_to_read_storage_before_client_initialized",error:"Called `getAccessToken` before client initialized"})):(console.warn("Called `getAccessToken` before client initialized"),Promise.resolve(null))}var Sa=e=>{var _e;let[t,o]=_react.useState.call(void 0, _reactnative.AppState.currentState==="active");_react.useEffect.call(void 0, ()=>{let F=_reactnative.AppState.addEventListener("change",ut=>{o(ut==="active")});return()=>{F.remove()}},[]);let[r,c]=_react.useState.call(void 0, !1),[a,l]=_react.useState.call(void 0, "loading"),[s,n]=_react.useState.call(void 0, !1),[d,i]=_react.useState.call(void 0, null),[u,p]=_react.useState.call(void 0, {status:"disconnected",account:null}),[g,v]=_react.useState.call(void 0, {status:"disconnected"}),[h,m]=_react.useState.call(void 0, {status:"initial"}),[w,f]=_react.useState.call(void 0, {status:"initial"}),b=_react.useRef.call(void 0, {}),[S,E]=_react.useState.call(void 0, {status:"initial"}),[U,A]=_react.useState.call(void 0, {status:"initial"}),[N,I]=_react.useState.call(void 0, {status:"initial"}),[L,K]=_react.useState.call(void 0, {status:"initial"}),[G,Y]=_react.useState.call(void 0, {status:"initial"}),X=_react.useRef.call(void 0, {}),ue=_react.useRef.call(void 0, {}),pe=_react.useRef.call(void 0, {}),me=_react.useRef.call(void 0, {}),he=_react.useRef.call(void 0, {}),Ee=_react.useRef.call(void 0, {}),at=Xe(),$=_react.useCallback.call(void 0, F=>{if(F){at(F),Te(i)(F);return}i(null),m({status:"initial"}),f({status:"initial"}),p({status:"disconnected",account:null})},[]),_=_react.useMemo.call(void 0, ()=>{let F=e.storage||et;return e.client?(D=e.client,D.setCallbacks({setUser:$,setIsReady:n}),D):(D=new (0, _jssdkcore2.default)({storage:Ze(F),appId:e.appId,clientId:e.clientId,supportedChains:e.supportedChains,nativeAppIdentifier:Qe(),baseUrl:e.baseUrl,sdkVersion:`expo:${ke.version}`,callbacks:{setUser:$,setIsReady:n},logLevel:e.logLevel,crypto:{digest:_expocrypto.digest}}),D)},[e.client,e.storage,e.appId,e.clientId,e.baseUrl,e.supportedChains,e.logLevel,$]),nt=_react.useCallback.call(void 0, ()=>($(null),_.auth.logout()),[$,_]),it=_react.useCallback.call(void 0, ()=>_.getAccessToken(),[_]),st=_react.useCallback.call(void 0, ()=>_.getIdentityToken(),[_]);Ge({client:_,isUserInitialized:r,setIsUserInitialized:c});let dt=ze({client:_,user:d,appId:e.appId,webViewState:a,createWalletCallbacks:ue,recoverWalletCallbacks:pe,setWalletRecoveryCallbacks:me,setRecoveryFlowState:E,wallet:u,setWallet:p}),lt=Ie({client:_,user:d,webViewState:a,createSolanaWalletCallbacks:he,recoverSolanaWalletCallbacks:Ee,setSolanaRecoveryFlowState:A,solanaWallet:g,setSolanaWallet:v});Be({client:_,isUserInitialized:r,user:d,oAuthState:w,setOAuthState:f,oAuthCallbacks:X,recoveryFlowState:S,oAuthStateRef:b}),Ke({client:_,user:d,webViewLoaded:a==="loaded",createWalletCallbacks:ue,recoverWalletCallbacks:pe,setWalletRecoveryCallbacks:me,recoveryFlowState:S,oAuthState:w,setRecoveryFlowState:E,setWallet:p,appStateVisible:t});let{customAuthStateIsSettled:ct}=qe({client:_,user:d,isReady:r,customAuth:(_e=e.config)==null?void 0:_e.customAuth});return _react2.default.createElement(_react2.default.Fragment,null,_react2.default.createElement(we.Provider,{value:{client:_,user:d,isReady:a!=="loading"&&r&&Je(w)&&ct,logout:nt,getAccessToken:it,getIdentityToken:st,wallet:R(R({},u),dt),solanaWallet:R(R({},g),lt),oAuthState:w,oAuthCallbacks:X,recoveryFlowState:S,setRecoveryFlowState:E,solanaRecoveryFlowState:U,setSolanaRecoveryFlowState:A,createWalletCallbacks:ue,recoverWalletCallbacks:pe,setWalletRecoveryCallbacks:me,createSolanaWalletCallbacks:he,recoverSolanaWalletCallbacks:Ee,setOAuthState:f,siweState:N,setSiweState:I,otpState:h,setOtpState:m,passkeyState:L,setPasskeyState:K,farcasterState:G,setFarcasterState:Y,oAuthStateRef:b}},e.children),_react2.default.createElement(_reactnative.View,{style:{width:0,height:0,overflow:"hidden"}},_react2.default.createElement(xe,{logLevel:e.logLevel,client:_,isClientReady:s,setWebViewState:l,webViewState:a})))};var Je=e=>e.status!=="loading",ge=(e={})=>{let{user:t,oAuthState:o,setOAuthState:r,oAuthCallbacks:c,client:a,oAuthStateRef:l}=_react.useContext.call(void 0, we),s=e.action?e.action==="login":!t;_react.useEffect.call(void 0, ()=>{c.current={onSuccess:e.onSuccess,onError:e.onError}},[e.onSuccess,e.onError]);let n=_react.useCallback.call(void 0, i=>{var p;let u=x(i);return r({status:"error",error:u}),(p=e==null?void 0:e.onError)==null||p.call(e,u),u},[e==null?void 0:e.onError]);return{start:_react.useCallback.call(void 0, function(h){return y(this,arguments,function*({provider:u,redirectUri:p,isLegacyAppleIosBehaviorEnabled:g=!1,disableSignup:v}){var m,w,f;r({status:"loading"}),l.current={disableSignup:v};try{if(t&&e.action==="login")throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_login_with_oauth_while_already_logged_in",error:"Already logged in, if trying to link an OAuth account use `useLinkWithOAuth`"});if(!t&&e.action==="link")throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_link_oauth_before_logged_in",error:"Must be logged in to link an OAuth account, use `useLoginWithOAuth`"});let{url:b}=yield a.auth.oauth.generateURL(u,B.createURL(p||"/")),S,E;if(_reactnative.Platform.OS==="ios"&&u==="apple"&&!g){let G=(m=new URL(b).searchParams.get("state"))!=null?m:"",Y=yield ot.signInAsync({state:G});if(!Y.authorizationCode)throw new (0, _jssdkcore.PrivyClientError)({error:"OAuth invalid credentials",code:s?"login_with_oauth_returned_with_invalid_credentials":"link_with_oauth_returned_with_invalid_credentials"});if(s){let X=yield a.auth.oauth.loginWithCode(Y.authorizationCode,G,u,"raw",v?"no-signup":"login-or-sign-up");S=X.user,E=X.is_new_user}else S=yield a.auth.oauth.linkWithCode(Y.authorizationCode,G,u,"raw");return(w=e==null?void 0:e.onSuccess)==null||w.call(e,S,E),r({status:"done"}),S!=null?S:void 0}let U=_reactnative.Platform.OS==="android"?b.replace("x.com","twitter.com"):b,A=yield re.openAuthSessionAsync(U);if(_reactnative.Platform.OS==="android")return;if(A.type!=="success")throw[re.WebBrowserResultType.CANCEL,re.WebBrowserResultType.DISMISS].includes(A.type)?new (0, _jssdkcore.PrivyClientError)({error:"OAuth was cancelled",code:s?"login_with_oauth_was_cancelled_by_user":"link_with_oauth_was_cancelled_by_user"}):new (0, _jssdkcore.PrivyClientError)({error:"OAuth session failed",code:s?"failed_to_complete_login_with_oauth":"failed_to_complete_link_with_oauth"});let{queryParams:N}=B.parse(A.url),{privy_oauth_state:I,privy_oauth_code:L}=N;if(!L||!I)throw new (0, _jssdkcore.PrivyClientError)({error:"OAuth invalid credentials",code:s?"login_with_oauth_returned_with_invalid_credentials":"link_with_oauth_returned_with_invalid_credentials"});if(s){let K=yield a.auth.oauth.loginWithCode(L,I,u,void 0,v?"no-signup":"login-or-sign-up");S=K.user,E=K.is_new_user}else S=yield a.auth.oauth.linkWithCode(L,I,u);return(f=e==null?void 0:e.onSuccess)==null||f.call(e,S,E),yield B.openURL(A.url.split("?")[0]),r({status:"done"}),S!=null?S:void 0}catch(b){n(b)}})},[t,a,r,n]),state:o}};function Aa(e){let{state:t,start:o}=ge(V(R({},e),{action:"login"}));return{state:t,login:o}}function xa(e){let{state:t,start:o}=ge(V(R({},e),{action:"link"}));return{state:t,link:o}}function Oa(e){return ge(e)}var Qe=()=>{if(typeof _expoapplication.applicationId!="string")throw new (0, _jssdkcore.PrivyClientError)({error:"Cannot determine native application ID. Please make sure `expo-application` is installed as a dependency and that `ios.bundleId` or `android.package` is set.",code:"invalid_native_app_id"});return _expoapplication.applicationId};function Ze(e){return{get(t){return e.get(t.replaceAll(":","-"))},put(t,o){return e.put(t.replaceAll(":","-"),o)},del(t){return e.del(t.replaceAll(":","-"))},getKeys:()=>y(this,null,function*(){return[]})}}var et={get(e){return O.getItemAsync(e,{keychainAccessible:O.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY})},put(e,t){return O.setItemAsync(e,t,{keychainAccessible:O.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY})},del(e){return O.deleteItemAsync(e,{keychainAccessible:O.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY})},getKeys:()=>y(void 0,null,function*(){return[]})};function Ia(e){return e.status==="connected"}function La(e){return e.status==="reconnecting"}function Fa(e){return e.status==="connecting"}function Ma(e){return e.status==="disconnected"}function Ta(e){return e.status==="not-created"}function Da(e){return e.status==="creating"}function ja(e){return e.status==="error"}function Na(e){return e.status==="needs-recovery"}exports.a = R; exports.b = V; exports.c = lr; exports.d = y; exports.e = ke; exports.f = x; exports.g = jr; exports.h = qr; exports.i = Aa; exports.j = xa; exports.k = Oa; exports.l = Qe; exports.m = Ze; exports.n = et; exports.o = k; exports.p = Ho; exports.q = qo; exports.r = Bo; exports.s = Jo; exports.t = Qo; exports.u = Zo; exports.v = ea; exports.w = ta; exports.x = we; exports.y = wa; exports.z = Sa; exports.A = Ia; exports.B = La; exports.C = Fa; exports.D = Ma; exports.E = Ta; exports.F = Da; exports.G = ja; exports.H = Na;
@@ -1 +0,0 @@
1
- var pt=Object.defineProperty,mt=Object.defineProperties;var yt=Object.getOwnPropertyDescriptors;var oe=Object.getOwnPropertySymbols;var Ce=Object.prototype.hasOwnProperty,Re=Object.prototype.propertyIsEnumerable;var We=(e,t,o)=>t in e?pt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,R=(e,t)=>{for(var o in t||(t={}))Ce.call(t,o)&&We(e,o,t[o]);if(oe)for(var o of oe(t))Re.call(t,o)&&We(e,o,t[o]);return e},V=(e,t)=>mt(e,yt(t));var lr=(e,t)=>{var o={};for(var r in e)Ce.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&oe)for(var r of oe(e))t.indexOf(r)<0&&Re.call(e,r)&&(o[r]=e[r]);return o};var y=(e,t,o)=>new Promise((r,c)=>{var a=n=>{try{s(o.next(n))}catch(d){c(d)}},l=n=>{try{s(o.throw(n))}catch(d){c(d)}},s=n=>n.done?r(n.value):Promise.resolve(n.value).then(a,l);s((o=o.apply(e,t)).next())});import*as ot from"expo-apple-authentication";import{applicationId as tt}from"expo-application";import*as B from"expo-linking";import*as O from"expo-secure-store";import*as re from"expo-web-browser";import{useCallback as rt,useContext as sr,useEffect as dr}from"react";import{Platform as Se}from"react-native";import{PrivyClientError as j}from"@privy-io/js-sdk-core";import{digest as er}from"expo-crypto";import te,{useState as W,useMemo as tr,createContext as rr,useCallback as ce,useRef as T,useEffect as or}from"react";import{AppState as $e,View as ar}from"react-native";import nr,{PrivyClientError as ir}from"@privy-io/js-sdk-core";var ke={name:"@privy-io/expo",version:"0.26.1",description:"Expo client for the Privy Auth API",keywords:["authentication","authorization","identity","privacy","privy","user data","react-native","expo","web3"],license:"Apache-2.0",source:"./src/index.ts",main:"./dist/esm/index.js",types:"./dist/index.d.ts",exports:{".":{require:"./dist/index.js",import:"./dist/esm/index.js",types:"./dist/index.d.ts"},"./passkey":{require:"./dist/passkey.js",import:"./dist/esm/passkey.js",types:"./dist/passkey.d.ts"}},files:["dist/**/*","LICENSE","README.md"],scripts:{build:"npx tsup --clean --minify","generate-types":"npx tsup --dts-only",clean:"rm -rf dist .turbo",dev:"npx tsup --watch",test:'jest --testMatch "**/test/**/*.test.ts"',"test:ci":"npm run test",lint:'eslint "src/**/*.{ts,tsx,js,jsx}" && npx tsc --noEmit',format:'eslint "src/**/*.{ts,tsx,js,jsx}" --fix'},peerDependencies:{"@privy-io/expo-native-extensions":"0.0.3",react:"*","react-native":"*","react-native-passkeys":"^0.2.1","react-native-webview":"*","react-native-safe-area-context":"*","react-native-svg":"*","expo-constants":"*","expo-linking":"*","expo-crypto":"*","expo-font":"*","@expo-google-fonts/inter":"*","expo-secure-store":"*","expo-application":"*","expo-apple-authentication":"*","expo-web-browser":"*"},peerDependenciesMeta:{"expo-font":{optional:!0},"@expo-google-fonts/inter":{optional:!0}},dependencies:{"@privy-io/js-sdk-core":"0.28.8","react-fast-compare":"^3.2.2",zustand:"^4.4.1"},devDependencies:{"@privy-io/eslint-config-custom":"*","@privy-io/tsconfig":"*","@simplewebauthn/types":"9.0.1","@tsconfig/node16-strictest-esm":"^1.0.3","@svgr/core":"^8.1.0","@svgr/plugin-jsx":"^8.1.0","@svgr/plugin-svgo":"^8.1.0",tsup:"^6.2.3",typescript:"~5.5.3"},author:"privy.io",publishConfig:{access:"public"}};import bt from"react";import{useCallback as ft,useEffect as Ae,useRef as wt}from"react";import{AppState as St}from"react-native";import gt from"react-native-webview";var xe=({client:e,isClientReady:t,setWebViewState:o,webViewState:r,logLevel:c})=>{let a=wt(null);Ae(()=>{a.current&&r==="loaded"&&e.setMessagePoster(a.current)},[e,a.current,r==="loaded"]),Ae(()=>St.addEventListener("change",n=>y(void 0,null,function*(){a.current&&n==="active"&&((yield e.embeddedWallet.ping(500))||(a.current.reload(),o("reloading")))})).remove,[]);let l=ft(s=>y(void 0,null,function*(){let{data:n}=s.nativeEvent;e.embeddedWallet.onMessage(JSON.parse(n))}),[e]);return t?bt.createElement(gt,{style:{flex:1},ref:a,cacheEnabled:!1,cacheMode:"LOAD_NO_CACHE",source:{uri:e.embeddedWallet.getURL()},webviewDebuggingEnabled:c==="DEBUG",onLoad:()=>o("loaded"),onError:console.error,onMessage:l}):null};import{useCallback as ye,useEffect as Ue,useMemo as Et}from"react";import{errorIndicatesRecoveryIsNeeded as _t,getUserEmbeddedSolanaWallet as Wt,getUserEmbeddedWallet as Ct,PrivyClientError as Q}from"@privy-io/js-sdk-core";import{getUserEmbeddedWallet as ht}from"@privy-io/js-sdk-core";import{PrivyClientError as J}from"@privy-io/js-sdk-core";function ae(i){return y(this,arguments,function*({client:e,setWallet:t,createWalletCallbacks:o,recoveryMethod:r,setRecoveryFlowState:c,password:a,recoveryToken:l,recoverySecretOverride:s,iCloudRecordNameOverride:n,solanaAccount:d}){var p,g;switch(r){case"user-passcode":if(!a)throw new J({code:"embedded_wallet_recovery_error",error:"password is required for user-passcode recovery method"});break;case"google-drive":if(!l)throw new J({code:"embedded_wallet_recovery_error",error:"Recovery token is required for google-drive recovery method"});break;case"icloud":if(!s||!n)throw new J({code:"embedded_wallet_recovery_error",error:"iCloud recovery failed due to inability to store credentials"});break}t({status:"creating",account:null});let u=r==="icloud"?"icloud-native":r;try{let{provider:v,user:h}=yield e.embeddedWallet.create(a,u,l,s,n,d),m=ht(h);return(g=(p=o.current)==null?void 0:p.onSuccess)==null||g.call(p,v),t({status:"connected",provider:v,account:m}),c({status:"initial"}),v}catch(v){let h=v instanceof Error?v.message:"Error creating embedded wallet";throw t({status:"error",error:h,account:null}),c({status:"initial"}),new J({code:"embedded_wallet_creation_error",error:h})}})}function Oe(a){return y(this,arguments,function*({client:e,setSolanaWallet:t,createSolanaWalletCallbacks:o,setSolanaRecoveryFlowState:r,ethereumAccount:c}){var l,s;t({status:"creating"});try{let n=yield e.embeddedWallet.createSolana({ethereumAccount:c});return(s=(l=o.current)==null?void 0:l.onSuccess)==null||s.call(l,n),t({status:"connected",publicKey:n._publicKey}),r({status:"initial"}),n}catch(n){let d=n instanceof Error?n.message:"Error creating embedded wallet";throw t({status:"error",error:d}),r({status:"initial"}),new J({code:"embedded_wallet_creation_error",error:d})}})}import{PrivyClientError as M}from"@privy-io/js-sdk-core";function ne(d){return y(this,arguments,function*({client:e,account:t,setWallet:o,recoverWalletCallbacks:r,recoveryMethod:c,setRecoveryFlowState:a,password:l,recoveryToken:s,recoverySecretOverride:n}){var i,u,p,g;if(!t)throw new M({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});switch(c){case"user-passcode":if(!l)throw new M({code:"embedded_wallet_recovery_error",error:"password is required for user-passcode recovery method"});break;case"google-drive":if(!s)throw new M({code:"embedded_wallet_recovery_error",error:"Recovery token is required for google-drive recovery method"});break;case"icloud":if(!n)throw new M({code:"embedded_wallet_recovery_error",error:"Record name is required for icloud recovery method"});break}o({status:"connecting",account:t});try{let v=yield e.embeddedWallet.getProvider(t,l,s,n);return o({status:"connected",provider:v,account:t}),a({status:"initial"}),(u=(i=r.current)==null?void 0:i.onSuccess)==null||u.call(i,v),v}catch(v){o({status:"needs-recovery",account:t}),a({status:"initial"});let h=new M({code:"embedded_wallet_recovery_error",error:v instanceof Error?v.message:"Error recovering embedded wallet"});throw(g=(p=r.current)==null?void 0:p.onError)==null||g.call(p,h),h}})}function Pe(a){return y(this,arguments,function*({client:e,solanaAccount:t,setSolanaWallet:o,recoverSolanaWalletCallbacks:r,setSolanaRecoveryFlowState:c}){var l,s,n,d;if(!t)throw new M({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});o({status:"connecting"});try{let i=yield e.embeddedWallet.getSolanaProvider(t);return o({status:"connected",publicKey:i._publicKey}),c({status:"initial"}),(s=(l=r.current)==null?void 0:l.onSuccess)==null||s.call(l,i),i}catch(i){o({status:"needs-recovery"}),c({status:"initial"});let u=new M({code:"embedded_wallet_recovery_error",error:i instanceof Error?i.message:"Error recovering embedded wallet"});throw(d=(n=r.current)==null?void 0:n.onError)==null||d.call(n,u),u}})}var Ie=({client:e,user:t,solanaWallet:o,setSolanaWallet:r,setSolanaRecoveryFlowState:c,webViewState:a,createSolanaWalletCallbacks:l,recoverSolanaWalletCallbacks:s})=>{let n=Et(()=>Wt(t),[t]),d=ye(()=>y(void 0,null,function*(){var v;let{user:p}=yield e.user.get(),g=(v=Ct(p))!=null?v:void 0;return yield Oe({client:e,setSolanaWallet:r,createSolanaWalletCallbacks:l,setSolanaRecoveryFlowState:c,ethereumAccount:g})}),[e,l]),i=ye(()=>y(void 0,null,function*(){if(!n)throw new Q({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});return Pe({client:e,solanaAccount:n,setSolanaWallet:r,recoverSolanaWalletCallbacks:s,setSolanaRecoveryFlowState:c})}),[e,n]),u=ye(()=>y(void 0,null,function*(){if(!n)throw r({status:"not-created"}),new Q({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});r(p=>p.status==="connected"?{status:"reconnecting"}:{status:"connecting"});try{let p=yield e.embeddedWallet.getSolanaProvider(n);return r({status:"connected",publicKey:p._publicKey}),p}catch(p){throw _t(p)?(r({status:"needs-recovery"}),new Q({code:"embedded_wallet_needs_recovery",error:"Embedded wallet not loaded on device"})):p instanceof Error?(r({status:"error",error:p.message}),new Q({code:"unknown_embedded_wallet_error",error:p.message})):(r({status:"error",error:"Error loading embedded wallet"}),new Q({code:"unknown_embedded_wallet_error",error:"Error loading embedded wallet"}))}}),[e,n]);return Ue(()=>{if(!t&&o.status!=="disconnected")return r({status:"disconnected"});a==="loaded"&&u().catch(()=>{})},[a,t,n]),Ue(()=>{o.status==="error"&&o.error.includes("User must be logged in")&&u()},[o.status]),{create:d,recover:i,getProvider:u}};import{useCallback as ee,useEffect as je,useMemo as Lt}from"react";import{getUserEmbeddedSolanaWallet as Ne,throwIfInvalidRecoveryUpgradePath as Ft}from"@privy-io/js-sdk-core";import{errorIndicatesRecoveryIsNeeded as Mt,getUserEmbeddedWallet as Tt,PrivyClientError as C}from"@privy-io/js-sdk-core";import{Platform as Le}from"react-native";import{PrivyClientError as P}from"@privy-io/js-sdk-core";function Fe(){return y(this,null,function*(){try{return yield import("@privy-io/expo-native-extensions")}catch(e){throw new Error("@privy-io/expo-native-extensions not found. Ensure that you're explicitly including as a dependency, and running an Expo development build")}})}function ve(r){return y(this,arguments,function*({user:e,appId:t,client:o}){var s;if(Le.OS==="android")throw new P({code:"embedded_wallet_recovery_error",error:"iCloud recovery is not supported on Android"});let c=yield Fe(),a=yield o.recovery.icloudAuth.getICloudConfiguration("expo-ios");if(!(a==null?void 0:a.container_identifier))throw new P({code:"embedded_wallet_recovery_error",error:"An iCloud Container ID must be specified in the Privy Dashboard."});try{let{recoverySecret:n,iCloudRecordName:d}=yield c.writeRecoverySecretToICloud({containerId:a.container_identifier,appId:t,userId:e.id});return{recoverySecret:n,iCloudRecordName:d}}catch(n){if(n instanceof Error){let d=(s=n.message.split("Caused by: ")[1])!=null?s:"Error writing to iCloud";throw new P({code:"embedded_wallet_recovery_error",error:d})}throw new P({code:"embedded_wallet_recovery_error",error:"Error writing to iCloud"})}})}function Me(o){return y(this,arguments,function*({walletAddress:e,client:t}){var n;if(Le.OS==="android")throw new P({code:"embedded_wallet_recovery_error",error:"iCloud recovery is not supported on Android"});let r=yield Fe(),a=(yield t.recovery.getRecoveryKeyMaterial(e)).icloud_record_name;if(!a)throw new P({code:"embedded_wallet_recovery_error",error:"iCloud recovery not properly backed up."});let l=yield t.recovery.icloudAuth.getICloudConfiguration("expo-ios"),s=l==null?void 0:l.container_identifier;if(!s)throw new P({code:"embedded_wallet_recovery_error",error:"An iCloud Container ID must be specified in the Privy Dashboard."});try{let{recoverySecret:d}=yield r.readRecoverySecretFromICloud({containerId:s,recordName:a});return{recoverySecret:d}}catch(d){if(d instanceof Error){let i=(n=d.message.split("Caused by: ")[1])!=null?n:"Error writing to iCloud";throw new P({code:"embedded_wallet_recovery_error",error:i})}throw new P({code:"embedded_wallet_recovery_error",error:"Error writing to iCloud"})}})}import*as ie from"expo-linking";import*as De from"expo-web-browser";import{Platform as Pt}from"react-native";import{PrivyClientError as Z}from"@privy-io/js-sdk-core";import Rt from"react-fast-compare";var Te=e=>t=>e(o=>Rt(o,t)?o:t);import{PrivyApiError as kt,PrivyClientError as At}from"@privy-io/js-sdk-core";function x(e){return e instanceof Error||e instanceof kt||e instanceof At?e:typeof e=="string"?new Error(e):new Error("Unknown error")}var jr=e=>new Promise(t=>setTimeout(t,e));import{useEffect as xt,useRef as Ot}from"react";import{AppState as be}from"react-native";function qr(){let e=Ot(be.currentState);xt(()=>be.addEventListener("change",r=>{e.current=r}).remove,[]);function t(){return be.currentState}return{appState:e,getCurrentAppState:t}}function se(c){return y(this,arguments,function*({provider:e,redirectUri:t,client:o,onError:r}){try{let a;switch(e){case"google-drive":{let{url:d}=yield o.recovery.auth.generateURL(ie.createURL(t||"/"));a=d;break}default:throw new Z({error:"OAuth invalid provider",code:"embedded_wallet_recovery_error"})}let l=yield De.openAuthSessionAsync(a);if(Pt.OS==="android")return;if(l.type!=="success")throw new Z({error:"Recovery OAuth session failed",code:"embedded_wallet_recovery_error"});let{queryParams:s}=ie.parse(l.url),n;switch(e){case"google-drive":{let{privy_oauth_state:d,privy_oauth_code:i}=s;if(!i||!d)throw new Z({error:"Recovery OAuth invalid credentials",code:"embedded_wallet_recovery_error"});n=yield fe({oAuthCode:i,oAuthState:d,client:o});break}default:throw new Z({error:"Recovery OAuth invalid provider",code:"embedded_wallet_recovery_error"})}return n}catch(a){throw r==null||r(x(a)),a}})}function fe(r){return y(this,arguments,function*({oAuthCode:e,oAuthState:t,client:o}){let{access_token:c}=yield o.recovery.auth.authorize(e,t);if(!c)throw new Z({error:"OAuth invalid credentials",code:"login_with_oauth_returned_with_invalid_credentials"});return c})}import{getUserEmbeddedWallet as Ut,PrivyClientError as It}from"@privy-io/js-sdk-core";function de(a){return y(this,arguments,function*({client:e,recoveryInput:t,setWalletRecoveryCallbacks:o,setRecoveryFlowState:r,setWallet:c}){var l,s,n,d;try{let{provider:i,user:u}=yield e.embeddedWallet.setRecovery(t),p=Ut(u);return c({status:"connected",provider:i,account:p}),(s=(l=o.current)==null?void 0:l.onSuccess)==null||s.call(l,i),r({status:"initial"}),i}catch(i){let u=new It({code:"embedded_wallet_set_recovery_error",error:i instanceof Error?i.message:"Error setting password on embedded wallet"});throw(d=(n=o.current)==null?void 0:n.onError)==null||d.call(n,u),r({status:"initial"}),u}})}function Ve(e){return e===void 0?{recoveryMethod:"privy"}:typeof e=="string"?{recoveryMethod:"user-passcode",password:e}:e.recoveryMethod==="user-passcode"?{recoveryMethod:"user-passcode",password:e.password}:{recoveryMethod:e.recoveryMethod}}var ze=({client:e,user:t,appId:o,wallet:r,setWallet:c,setRecoveryFlowState:a,webViewState:l,createWalletCallbacks:s,recoverWalletCallbacks:n,setWalletRecoveryCallbacks:d})=>{let i=Lt(()=>Tt(t),[t]),u=ee(m=>y(void 0,null,function*(){var A,N;if(i)throw new C({error:"This user already has an embedded wallet",code:"embedded_wallet_already_exists"});let{user:w}=yield e.user.get(),{password:f,recoveryMethod:b}=Ve(m),S,E,U;if(b==="google-drive"&&(S=yield se({provider:b,client:e,onError:(A=s.current)==null?void 0:A.onError}),a({status:"creating-wallet"}),!S))return null;if(b==="icloud"){if(!w)throw new C({code:"embedded_wallet_recovery_error",error:"User must be loaded before creating a wallet with iCloud."});let{recoverySecret:I,iCloudRecordName:L}=yield ve({user:w,appId:o,client:e});E=I,U=L}return yield ae({client:e,setWallet:c,createWalletCallbacks:s,recoveryMethod:b,setRecoveryFlowState:a,password:f,recoverySecretOverride:E,iCloudRecordNameOverride:U,solanaAccount:(N=Ne(w))!=null?N:void 0})}),[e,i,t]),p=ee(m=>y(void 0,null,function*(){var b;if(r.status!=="connected")throw new C({code:"attempted_to_set_password_before_connected",error:"Embedded wallet must be connected before setting password"});if(!i)throw new C({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});if(Ne(t))throw new C({code:"embedded_wallet_set_recovery_error",error:"Cannot set user-controlled recovery for a user with an embedded Solana wallet."});Ft({currentRecoveryMethod:i.recovery_method,upgradeToRecoveryMethod:m.recoveryMethod});let w,f;switch(m.recoveryMethod){case"privy":f=V(R({},m),{wallet:i});break;case"user-passcode":f=V(R({},m),{wallet:i,password:m.password});break;case"google-drive":if(w=yield se({provider:m.recoveryMethod,client:e,onError:(b=d.current)==null?void 0:b.onError}),a({status:"upgrading-recovery"}),!w)return null;f={recoveryMethod:"google-drive",wallet:i,recoveryAccessToken:w};break;case"icloud":if(!t)throw new C({code:"embedded_wallet_recovery_error",error:"User must be loaded before backing up to iCloud."});let{recoverySecret:S,iCloudRecordName:E}=yield ve({user:t,appId:o,client:e});f={recoveryMethod:"icloud-native",recoverySecretOverride:S,iCloudRecordNameOverride:E,wallet:i};break;default:throw new C({code:"embedded_wallet_recovery_error",error:"Unrecognized recovery method"})}return de({client:e,recoveryInput:f,setWalletRecoveryCallbacks:d,setRecoveryFlowState:a,setWallet:c})}),[e,i,r.status,t]),g=ee(m=>y(void 0,null,function*(){return p({recoveryMethod:"user-passcode",password:m})}),[e,i,r.status]),v=ee(m=>y(void 0,null,function*(){var E;if(!i)throw new C({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});let{password:w,recoveryMethod:f}=Ve(m),b,S;if(f==="google-drive"&&(b=yield se({provider:f,client:e,onError:(E=n.current)==null?void 0:E.onError}),a({status:"recovering"}),!b))return null;if(f==="icloud"){if(!t)throw new C({code:"embedded_wallet_recovery_error",error:"User must be loaded before recovering via iCloud."});let{recoverySecret:U}=yield Me({client:e,walletAddress:i.address});S=U}return ne({client:e,account:i,setWallet:c,recoverWalletCallbacks:n,recoveryMethod:f,setRecoveryFlowState:a,password:w,recoveryToken:b,recoverySecretOverride:S})}),[e,i]),h=ee(()=>y(void 0,null,function*(){if(!i)throw c({status:"not-created",account:null}),new C({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});c(m=>m.status==="connected"?{status:"reconnecting",account:i}:{status:"connecting",account:i});try{let m=yield e.embeddedWallet.getProvider(i);return c({status:"connected",provider:m,account:i}),m}catch(m){throw Mt(m)?(c({status:"needs-recovery",account:i}),new C({code:"embedded_wallet_needs_recovery",error:"Embedded wallet not loaded on device"})):m instanceof Error?(c({status:"error",error:m.message,account:i}),new C({code:"unknown_embedded_wallet_error",error:m.message})):(c({status:"error",error:"Error loading embedded wallet",account:i}),new C({code:"unknown_embedded_wallet_error",error:"Error loading embedded wallet"}))}}),[e,i]);return je(()=>{if(!t&&r.status!=="disconnected")return c({status:"disconnected",account:null});l==="loaded"&&h().catch(()=>{})},[l,t,i]),je(()=>{r.status==="error"&&r.error.includes("User must be logged in")&&h()},[r.status]),{create:u,recover:v,setPassword:g,setRecovery:p,getProvider:h}};import{useEffect as Dt,useState as jt}from"react";import{PrivyClientError as He}from"@privy-io/js-sdk-core";var qe=({client:e,user:t,isReady:o,customAuth:r})=>{let[c,a]=jt({status:"initial"});return Dt(()=>{(()=>y(void 0,null,function*(){if(!(r!=null&&r.enabled)){a({status:"not-enabled"});return}a({status:"loading"});let{getCustomAccessToken:s,isLoading:n}=r;if(!(!o||n))try{let d=yield s();if(!d&&t){yield e.auth.logout(),a({status:"done"});return}if(!d){a({status:"done"});return}if(t){a({status:"done"});return}if(!(yield e.auth.customProvider.syncWithToken(d))){yield e.auth.logout(),a({status:"error",error:new He({error:"Failed to sync with custom auth provider",code:"third_party_auth_error"})});return}a({status:"done"})}catch(d){if(console.log("Error syncing with custom auth provider",d),a({status:"error",error:d}),t)throw yield e.auth.logout(),new He({error:"Third-party auth failed",code:"third_party_auth_error"})}}))()},[e,t,o,r==null?void 0:r.enabled,r==null?void 0:r.getCustomAccessToken,r==null?void 0:r.isLoading]),{customAuthState:c,customAuthStateIsSettled:c.status!=="loading"&&c.status!=="initial"}};import*as z from"expo-linking";import{useCallback as Nt,useEffect as Vt}from"react";import{Platform as zt}from"react-native";var Be=({client:e,user:t,isUserInitialized:o,oAuthState:r,oAuthCallbacks:c,setOAuthState:a,recoveryFlowState:l,oAuthStateRef:s})=>{let n=z.useURL(),d=Nt(i=>{var p,g;let u=x(i);a({status:"error",error:u}),(g=(p=c.current).onError)==null||g.call(p,u)},[a]);return Vt(()=>{function i(){return y(this,null,function*(){var v,h;if(!n||r.status!=="loading"||l.status!=="initial")return;let{queryParams:u}=z.parse(n),{privy_oauth_state:p,privy_oauth_code:g}=u;if(!g||!p){a({status:"done"});return}try{let m,w;if(t)m=yield e.auth.oauth.linkWithCode(g,p);else{let f=yield e.auth.oauth.loginWithCode(g,p,void 0,void 0,s.current.disableSignup?"no-signup":"login-or-sign-up");m=f.user,w=!!f.is_new_user}return(h=(v=c.current).onSuccess)==null||h.call(v,m,w),s.current={},a({status:"done"}),yield z.openURL(n.split("?")[0])}catch(m){s.current={},d(m)}})}zt.OS==="android"&&o&&i()},[n,o])};import*as H from"expo-linking";import{useCallback as Ht,useEffect as qt,useMemo as Bt}from"react";import{Platform as Kt}from"react-native";import{getUserEmbeddedSolanaWallet as Gt,getUserEmbeddedWallet as Yt}from"@privy-io/js-sdk-core";var Ke=({client:e,user:t,createWalletCallbacks:o,recoverWalletCallbacks:r,setWalletRecoveryCallbacks:c,recoveryFlowState:a,oAuthState:l,setRecoveryFlowState:s,setWallet:n,appStateVisible:d,webViewLoaded:i})=>{let u=H.useURL(),p=Bt(()=>Yt(t),[t]),g=Ht(v=>{var m,w,f,b;let h=x(v);a.status==="creating-wallet"?(w=(m=o.current).onError)==null||w.call(m,x(h)):(b=(f=r.current).onError)==null||b.call(f,x(h)),s({status:"initial"})},[a]);return qt(()=>{function v(){return y(this,null,function*(){var f;if(!u&&a.status!=="initial"&&d&&g(new Error("Recovery OAuth session failed")),!u||a.status==="initial"||l.status!=="initial"||!d||!i)return;let{queryParams:h}=H.parse(u),{privy_oauth_state:m,privy_oauth_code:w}=h;if(!(!w||!m)){yield H.openURL(u.split("?")[0]);try{let b=yield fe({oAuthCode:w,oAuthState:m,client:e});if(a.status==="creating-wallet"){let S=(f=Gt(t))!=null?f:void 0;yield ae({client:e,setWallet:n,createWalletCallbacks:o,recoveryMethod:"google-drive",setRecoveryFlowState:s,recoveryToken:b,solanaAccount:S})}else if(a.status==="upgrading-recovery"){if(!p)throw new Error("Embedded wallet not found");yield de({client:e,recoveryInput:{recoveryMethod:"google-drive",wallet:p,recoveryAccessToken:b},setWalletRecoveryCallbacks:c,setRecoveryFlowState:s,setWallet:n})}else yield ne({client:e,account:p,setWallet:n,recoverWalletCallbacks:r,recoveryMethod:"google-drive",setRecoveryFlowState:s,recoveryToken:b})}catch(b){g(b)}}})}Kt.OS==="android"&&v()},[u,a.status,d,i])};import{useEffect as Xt}from"react";var Ge=({client:e,isUserInitialized:t,setIsUserInitialized:o})=>{Xt(()=>{t||(()=>y(void 0,null,function*(){try{yield e.user.get()}catch(c){}finally{o(!0)}}))()},[t])};import{useEffect as $t}from"react";import{create as Jt}from"zustand";var k=class extends Error{constructor(o,r){super(r);this.code=o,this.error=r}};var le={success:e=>({value:e}),error:e=>({error:e})};var Ye=e=>{let t=Array.from(new Set(e)),o=t.length;return o===0?le.error(new k("no_login_methods_available","No login methods available")):o>2?le.error(new k("too_many_login_methods",`More than two (${o}) login methods were provided`)):le.success(t)},Ho=e=>e[0],qo=(e,t)=>{if(e.length!==2)return null;let[o,r]=e;return t===o?r:o},Bo={email:"email",sms:"phone"};var Qt=1e3*60*5,q=Jt()((e,t)=>({privyElementsConfig:null,loginPromiseExecutor:null,isUIMounted:!1,updateUIMounted:o=>e({isUIMounted:o}),openLoginFlow:(o,r,c)=>new Promise((a,l)=>{if(r!==null)return l(new k("user_already_logged_in","User is already logged in"));if(!t().isUIMounted)return l(new k("privy_elements_not_ready","Privy Elements is not mounted"));if(t().loginPromiseExecutor!==null)return l(new k("existing_login_flow_in_progress","A login flow is already in progress"));let s=Ye(o.loginMethods);if(s.error)return l(s.error);let n={loginMethods:s.value},d=setTimeout(()=>{l(new k("login_flow_timeout","The login flow timed out")),t().closeLoginFlow()},Qt);c(),e({loginPromiseExecutor:{resolve(u){clearTimeout(d),a(u)},reject(u){clearTimeout(d),l(u)}},privyElementsConfig:n})}),closeLoginFlow:()=>{var o;return(o=t().loginPromiseExecutor)==null||o.reject(new k("login_flow_closed","The login flow was closed")),e({privyElementsConfig:null,loginPromiseExecutor:null})}})),Jo=()=>q(e=>e.privyElementsConfig),Qo=()=>q(e=>e.openLoginFlow),Zo=()=>q(e=>e.closeLoginFlow),Zt=e=>{let{loginPromiseExecutor:t}=q.getState();t==null||t.resolve(e)},Xe=()=>Zt,ea=()=>{let e=q(t=>t.updateUIMounted);$t(()=>(e(!0),()=>{e(!1)}),[e])},ta=()=>q(e=>e.privyElementsConfig!==null);var we=rr({}),D;function wa(e){return D?D.getAccessToken():e!=null&&e.strict?Promise.reject(new ir({code:"attempted_to_read_storage_before_client_initialized",error:"Called `getAccessToken` before client initialized"})):(console.warn("Called `getAccessToken` before client initialized"),Promise.resolve(null))}var Sa=e=>{var _e;let[t,o]=W($e.currentState==="active");or(()=>{let F=$e.addEventListener("change",ut=>{o(ut==="active")});return()=>{F.remove()}},[]);let[r,c]=W(!1),[a,l]=W("loading"),[s,n]=W(!1),[d,i]=W(null),[u,p]=W({status:"disconnected",account:null}),[g,v]=W({status:"disconnected"}),[h,m]=W({status:"initial"}),[w,f]=W({status:"initial"}),b=T({}),[S,E]=W({status:"initial"}),[U,A]=W({status:"initial"}),[N,I]=W({status:"initial"}),[L,K]=W({status:"initial"}),[G,Y]=W({status:"initial"}),X=T({}),ue=T({}),pe=T({}),me=T({}),he=T({}),Ee=T({}),at=Xe(),$=ce(F=>{if(F){at(F),Te(i)(F);return}i(null),m({status:"initial"}),f({status:"initial"}),p({status:"disconnected",account:null})},[]),_=tr(()=>{let F=e.storage||et;return e.client?(D=e.client,D.setCallbacks({setUser:$,setIsReady:n}),D):(D=new nr({storage:Ze(F),appId:e.appId,clientId:e.clientId,supportedChains:e.supportedChains,nativeAppIdentifier:Qe(),baseUrl:e.baseUrl,sdkVersion:`expo:${ke.version}`,callbacks:{setUser:$,setIsReady:n},logLevel:e.logLevel,crypto:{digest:er}}),D)},[e.client,e.storage,e.appId,e.clientId,e.baseUrl,e.supportedChains,e.logLevel,$]),nt=ce(()=>($(null),_.auth.logout()),[$,_]),it=ce(()=>_.getAccessToken(),[_]),st=ce(()=>_.getIdentityToken(),[_]);Ge({client:_,isUserInitialized:r,setIsUserInitialized:c});let dt=ze({client:_,user:d,appId:e.appId,webViewState:a,createWalletCallbacks:ue,recoverWalletCallbacks:pe,setWalletRecoveryCallbacks:me,setRecoveryFlowState:E,wallet:u,setWallet:p}),lt=Ie({client:_,user:d,webViewState:a,createSolanaWalletCallbacks:he,recoverSolanaWalletCallbacks:Ee,setSolanaRecoveryFlowState:A,solanaWallet:g,setSolanaWallet:v});Be({client:_,isUserInitialized:r,user:d,oAuthState:w,setOAuthState:f,oAuthCallbacks:X,recoveryFlowState:S,oAuthStateRef:b}),Ke({client:_,user:d,webViewLoaded:a==="loaded",createWalletCallbacks:ue,recoverWalletCallbacks:pe,setWalletRecoveryCallbacks:me,recoveryFlowState:S,oAuthState:w,setRecoveryFlowState:E,setWallet:p,appStateVisible:t});let{customAuthStateIsSettled:ct}=qe({client:_,user:d,isReady:r,customAuth:(_e=e.config)==null?void 0:_e.customAuth});return te.createElement(te.Fragment,null,te.createElement(we.Provider,{value:{client:_,user:d,isReady:a!=="loading"&&r&&Je(w)&&ct,logout:nt,getAccessToken:it,getIdentityToken:st,wallet:R(R({},u),dt),solanaWallet:R(R({},g),lt),oAuthState:w,oAuthCallbacks:X,recoveryFlowState:S,setRecoveryFlowState:E,solanaRecoveryFlowState:U,setSolanaRecoveryFlowState:A,createWalletCallbacks:ue,recoverWalletCallbacks:pe,setWalletRecoveryCallbacks:me,createSolanaWalletCallbacks:he,recoverSolanaWalletCallbacks:Ee,setOAuthState:f,siweState:N,setSiweState:I,otpState:h,setOtpState:m,passkeyState:L,setPasskeyState:K,farcasterState:G,setFarcasterState:Y,oAuthStateRef:b}},e.children),te.createElement(ar,{style:{width:0,height:0,overflow:"hidden"}},te.createElement(xe,{logLevel:e.logLevel,client:_,isClientReady:s,setWebViewState:l,webViewState:a})))};var Je=e=>e.status!=="loading",ge=(e={})=>{let{user:t,oAuthState:o,setOAuthState:r,oAuthCallbacks:c,client:a,oAuthStateRef:l}=sr(we),s=e.action?e.action==="login":!t;dr(()=>{c.current={onSuccess:e.onSuccess,onError:e.onError}},[e.onSuccess,e.onError]);let n=rt(i=>{var p;let u=x(i);return r({status:"error",error:u}),(p=e==null?void 0:e.onError)==null||p.call(e,u),u},[e==null?void 0:e.onError]);return{start:rt(function(h){return y(this,arguments,function*({provider:u,redirectUri:p,isLegacyAppleIosBehaviorEnabled:g=!1,disableSignup:v}){var m,w,f;r({status:"loading"}),l.current={disableSignup:v};try{if(t&&e.action==="login")throw new j({code:"attempted_login_with_oauth_while_already_logged_in",error:"Already logged in, if trying to link an OAuth account use `useLinkWithOAuth`"});if(!t&&e.action==="link")throw new j({code:"attempted_link_oauth_before_logged_in",error:"Must be logged in to link an OAuth account, use `useLoginWithOAuth`"});let{url:b}=yield a.auth.oauth.generateURL(u,B.createURL(p||"/")),S,E;if(Se.OS==="ios"&&u==="apple"&&!g){let G=(m=new URL(b).searchParams.get("state"))!=null?m:"",Y=yield ot.signInAsync({state:G});if(!Y.authorizationCode)throw new j({error:"OAuth invalid credentials",code:s?"login_with_oauth_returned_with_invalid_credentials":"link_with_oauth_returned_with_invalid_credentials"});if(s){let X=yield a.auth.oauth.loginWithCode(Y.authorizationCode,G,u,"raw",v?"no-signup":"login-or-sign-up");S=X.user,E=X.is_new_user}else S=yield a.auth.oauth.linkWithCode(Y.authorizationCode,G,u,"raw");return(w=e==null?void 0:e.onSuccess)==null||w.call(e,S,E),r({status:"done"}),S!=null?S:void 0}let U=Se.OS==="android"?b.replace("x.com","twitter.com"):b,A=yield re.openAuthSessionAsync(U);if(Se.OS==="android")return;if(A.type!=="success")throw[re.WebBrowserResultType.CANCEL,re.WebBrowserResultType.DISMISS].includes(A.type)?new j({error:"OAuth was cancelled",code:s?"login_with_oauth_was_cancelled_by_user":"link_with_oauth_was_cancelled_by_user"}):new j({error:"OAuth session failed",code:s?"failed_to_complete_login_with_oauth":"failed_to_complete_link_with_oauth"});let{queryParams:N}=B.parse(A.url),{privy_oauth_state:I,privy_oauth_code:L}=N;if(!L||!I)throw new j({error:"OAuth invalid credentials",code:s?"login_with_oauth_returned_with_invalid_credentials":"link_with_oauth_returned_with_invalid_credentials"});if(s){let K=yield a.auth.oauth.loginWithCode(L,I,u,void 0,v?"no-signup":"login-or-sign-up");S=K.user,E=K.is_new_user}else S=yield a.auth.oauth.linkWithCode(L,I,u);return(f=e==null?void 0:e.onSuccess)==null||f.call(e,S,E),yield B.openURL(A.url.split("?")[0]),r({status:"done"}),S!=null?S:void 0}catch(b){n(b)}})},[t,a,r,n]),state:o}};function Aa(e){let{state:t,start:o}=ge(V(R({},e),{action:"login"}));return{state:t,login:o}}function xa(e){let{state:t,start:o}=ge(V(R({},e),{action:"link"}));return{state:t,link:o}}function Oa(e){return ge(e)}var Qe=()=>{if(typeof tt!="string")throw new j({error:"Cannot determine native application ID. Please make sure `expo-application` is installed as a dependency and that `ios.bundleId` or `android.package` is set.",code:"invalid_native_app_id"});return tt};function Ze(e){return{get(t){return e.get(t.replaceAll(":","-"))},put(t,o){return e.put(t.replaceAll(":","-"),o)},del(t){return e.del(t.replaceAll(":","-"))},getKeys:()=>y(this,null,function*(){return[]})}}var et={get(e){return O.getItemAsync(e,{keychainAccessible:O.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY})},put(e,t){return O.setItemAsync(e,t,{keychainAccessible:O.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY})},del(e){return O.deleteItemAsync(e,{keychainAccessible:O.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY})},getKeys:()=>y(void 0,null,function*(){return[]})};function Ia(e){return e.status==="connected"}function La(e){return e.status==="reconnecting"}function Fa(e){return e.status==="connecting"}function Ma(e){return e.status==="disconnected"}function Ta(e){return e.status==="not-created"}function Da(e){return e.status==="creating"}function ja(e){return e.status==="error"}function Na(e){return e.status==="needs-recovery"}export{R as a,V as b,lr as c,y as d,ke as e,x as f,jr as g,qr as h,Aa as i,xa as j,Oa as k,Qe as l,Ze as m,et as n,k as o,Ho as p,qo as q,Bo as r,Jo as s,Qo as t,Zo as u,ea as v,ta as w,we as x,wa as y,Sa as z,Ia as A,La as B,Fa as C,Ma as D,Ta as E,Da as F,ja as G,Na as H};