@smoothsend/sdk 2.2.2 → 2.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/aptos/index.cjs +1256 -0
  2. package/dist/aptos/index.cjs.map +1 -0
  3. package/dist/aptos/index.d.ts +783 -0
  4. package/dist/aptos/index.js +1230 -0
  5. package/dist/aptos/index.js.map +1 -0
  6. package/dist/aptos-entry.d.ts +36 -0
  7. package/dist/aptos-entry.d.ts.map +1 -0
  8. package/dist/avax/index.cjs +1869 -0
  9. package/dist/avax/index.cjs.map +1 -0
  10. package/dist/avax/index.d.ts +306 -7
  11. package/dist/avax/index.js +1849 -0
  12. package/dist/avax/index.js.map +1 -0
  13. package/dist/avax-entry.d.ts +24 -0
  14. package/dist/avax-entry.d.ts.map +1 -0
  15. package/dist/chunks/SmoothSendSDK-C_ofuBkk.cjs +1519 -0
  16. package/dist/chunks/SmoothSendSDK-C_ofuBkk.cjs.map +1 -0
  17. package/dist/chunks/SmoothSendSDK-CaV_PCIG.js +1511 -0
  18. package/dist/chunks/SmoothSendSDK-CaV_PCIG.js.map +1 -0
  19. package/dist/chunks/SmoothSendSDK.d-9GBgZONY.d.ts +262 -0
  20. package/dist/chunks/TrueGaslessClient-DThO4Tpb.cjs +1237 -0
  21. package/dist/chunks/TrueGaslessClient-DThO4Tpb.cjs.map +1 -0
  22. package/dist/chunks/TrueGaslessClient-l2uFvNAa.js +1228 -0
  23. package/dist/chunks/TrueGaslessClient-l2uFvNAa.js.map +1 -0
  24. package/dist/chunks/shared-CNF22ESH.js +557 -0
  25. package/dist/chunks/shared-CNF22ESH.js.map +1 -0
  26. package/dist/chunks/shared-CaQMAGQR.js +1511 -0
  27. package/dist/chunks/shared-CaQMAGQR.js.map +1 -0
  28. package/dist/chunks/shared-Cn4duBJT.d.ts +1279 -0
  29. package/dist/chunks/shared-DEurKmpI.cjs +1519 -0
  30. package/dist/chunks/shared-DEurKmpI.cjs.map +1 -0
  31. package/dist/chunks/shared-RVkwmkG7.d.ts +262 -0
  32. package/dist/chunks/shared-x1-VC-Li.cjs +568 -0
  33. package/dist/chunks/shared-x1-VC-Li.cjs.map +1 -0
  34. package/dist/chunks/useSmoothSendAvax-BHeW_6x8.cjs +1865 -0
  35. package/dist/chunks/useSmoothSendAvax-BHeW_6x8.cjs.map +1 -0
  36. package/dist/chunks/useSmoothSendAvax-ZuHw1aYi.js +1848 -0
  37. package/dist/chunks/useSmoothSendAvax-ZuHw1aYi.js.map +1 -0
  38. package/dist/chunks/version-CNF22ESH.js +557 -0
  39. package/dist/chunks/version-CNF22ESH.js.map +1 -0
  40. package/dist/chunks/version-x1-VC-Li.cjs +568 -0
  41. package/dist/chunks/version-x1-VC-Li.cjs.map +1 -0
  42. package/dist/chunks/version.d-Cn4duBJT.d.ts +1279 -0
  43. package/dist/index.cjs +5209 -0
  44. package/dist/index.cjs.map +1 -0
  45. package/dist/index.d.ts +11 -2853
  46. package/dist/index.d.ts.map +1 -1
  47. package/dist/index.esm.js +1 -1
  48. package/dist/index.js +61 -102
  49. package/dist/index.js.map +1 -1
  50. package/dist/stellar/index.cjs +27 -0
  51. package/dist/stellar/index.cjs.map +1 -0
  52. package/dist/stellar/index.d.ts +214 -0
  53. package/dist/stellar/index.js +3 -0
  54. package/dist/stellar/index.js.map +1 -0
  55. package/dist/stellar-entry.d.ts +37 -0
  56. package/dist/stellar-entry.d.ts.map +1 -0
  57. package/dist/version.d.ts +2 -0
  58. package/dist/version.d.ts.map +1 -0
  59. package/package.json +23 -24
@@ -0,0 +1,1848 @@
1
+ import require$$0, { createContext, useMemo, useCallback, useContext } from 'react';
2
+ import { encodeFunctionData, slice, size, hexToBigInt, toHex } from 'viem';
3
+ import { H as HttpClient } from './version-CNF22ESH.js';
4
+ import { getUserOperationHash, entryPoint07Abi } from 'viem/account-abstraction';
5
+ import { readContract } from 'viem/actions';
6
+
7
+ /**
8
+ * Avalanche ERC-4337 (EntryPoint v0.7) via SmoothSend gateway — same idea as Aptos submitter.
9
+ *
10
+ * Minimal dApp flow:
11
+ * ```ts
12
+ * const avax = new SmoothSendAvaxSubmitter({ apiKey, network: 'testnet' });
13
+ * await avax.submitSponsoredUserOperation({ userOp: draft, signUserOp: wallet.sign });
14
+ * ```
15
+ */
16
+ const DEFAULT_GATEWAY = 'https://proxy.smoothsend.xyz';
17
+ /** Strip ethers@v6 UTF-8 decode noise from bundler JSON-RPC errors (viem shows as “internal error … Details”). */
18
+ function sanitizeAvaxBundlerRpcMessage(raw) {
19
+ if (raw.includes('invalid codepoint') ||
20
+ raw.includes('INVALID_ARGUMENT') ||
21
+ raw.includes('MISSING_CONTINUE')) {
22
+ return 'RPC reverted; revert payload could not be decoded as text (usually EntryPoint/account — trace tx on explorer or update bundler).';
23
+ }
24
+ return raw;
25
+ }
26
+ class SmoothSendAvaxSubmitter {
27
+ constructor(config) {
28
+ this.config = config;
29
+ this.rpcId = 1;
30
+ if (!config?.apiKey) {
31
+ throw new Error('[SmoothSendAvaxSubmitter] apiKey is required');
32
+ }
33
+ const headers = {
34
+ 'X-Chain': (config.chain ?? 'avalanche').toLowerCase(),
35
+ };
36
+ if (config.corsOrigin?.trim()) {
37
+ headers.Origin = config.corsOrigin.trim();
38
+ }
39
+ this.http = new HttpClient({
40
+ apiKey: config.apiKey,
41
+ network: config.network ?? 'testnet',
42
+ baseUrl: config.gatewayUrl ?? DEFAULT_GATEWAY,
43
+ timeout: config.timeout ?? 45000,
44
+ customHeaders: headers,
45
+ });
46
+ }
47
+ getConfig() {
48
+ return { ...this.config };
49
+ }
50
+ /** Merge gas estimate fields into a partial UserOp */
51
+ static applyGasEstimate(userOp, gas) {
52
+ return {
53
+ ...userOp,
54
+ preVerificationGas: gas.preVerificationGas,
55
+ verificationGasLimit: gas.verificationGasLimit,
56
+ callGasLimit: gas.callGasLimit,
57
+ paymasterVerificationGasLimit: gas.paymasterVerificationGasLimit ??
58
+ userOp.paymasterVerificationGasLimit,
59
+ paymasterPostOpGasLimit: gas.paymasterPostOpGasLimit ?? userOp.paymasterPostOpGasLimit,
60
+ };
61
+ }
62
+ /** Attach packed paymaster data returned from {@link paymasterSign} */
63
+ static applyPaymasterAndData(userOp, paymasterAndData) {
64
+ return {
65
+ ...userOp,
66
+ paymasterAndData,
67
+ paymaster: undefined,
68
+ paymasterData: undefined,
69
+ paymasterVerificationGasLimit: undefined,
70
+ paymasterPostOpGasLimit: undefined,
71
+ };
72
+ }
73
+ async getChainId() {
74
+ return this.rpc('eth_chainId', []);
75
+ }
76
+ async getSupportedEntryPoints() {
77
+ return this.rpc('eth_supportedEntryPoints', []);
78
+ }
79
+ async estimateUserOperationGas(userOp, entryPoint) {
80
+ return this.rpc('eth_estimateUserOperationGas', [
81
+ userOp,
82
+ entryPoint,
83
+ ]);
84
+ }
85
+ async sendUserOperation(userOp, entryPoint) {
86
+ return this.rpc('eth_sendUserOperation', [userOp, entryPoint]);
87
+ }
88
+ async getUserOperationReceipt(userOpHash) {
89
+ return this.rpc('eth_getUserOperationReceipt', [userOpHash]);
90
+ }
91
+ async waitForUserOperationReceipt(userOpHash, options) {
92
+ const pollMs = options?.pollMs ?? 2000;
93
+ const timeoutMs = options?.timeoutMs ?? 120000;
94
+ const deadline = Date.now() + timeoutMs;
95
+ while (Date.now() < deadline) {
96
+ const receipt = await this.getUserOperationReceipt(userOpHash);
97
+ if (receipt)
98
+ return receipt;
99
+ await new Promise((r) => setTimeout(r, pollMs));
100
+ }
101
+ return null;
102
+ }
103
+ async paymasterSign(body) {
104
+ const res = await this.http.post('/api/v1/bundler/paymaster/sign', body);
105
+ if (!res.success || !res.data) {
106
+ throw new Error('[SmoothSendAvaxSubmitter] paymasterSign failed');
107
+ }
108
+ const data = res.data;
109
+ if (!data.success) {
110
+ throw new Error(`[SmoothSendAvaxSubmitter] paymasterSign: ${data.error ?? 'unknown error'}`);
111
+ }
112
+ return data;
113
+ }
114
+ async getBundlerHealth() {
115
+ const res = await this.http.get('/api/v1/bundler/health');
116
+ if (!res.success)
117
+ throw new Error('[SmoothSendAvaxSubmitter] health failed');
118
+ return res.data;
119
+ }
120
+ /**
121
+ * One call: estimate gas → paymaster/sign → merge → your sign → send → (optional) wait for receipt.
122
+ */
123
+ async submitSponsoredUserOperation(opts) {
124
+ const entryPoint = opts.entryPoint ?? (await this.getSupportedEntryPoints())[0];
125
+ if (!entryPoint) {
126
+ throw new Error('[SmoothSendAvaxSubmitter] no EntryPoint from bundler');
127
+ }
128
+ let userOp = {
129
+ ...opts.userOp,
130
+ signature: opts.userOp.signature ?? '0x',
131
+ };
132
+ const gas = await this.estimateUserOperationGas(userOp, entryPoint);
133
+ userOp = SmoothSendAvaxSubmitter.applyGasEstimate(userOp, gas);
134
+ const signedPm = await this.paymasterSign({
135
+ mode: opts.mode ?? 'developer-sponsored',
136
+ userOp,
137
+ ...opts.paymaster,
138
+ });
139
+ userOp = SmoothSendAvaxSubmitter.applyPaymasterAndData(userOp, signedPm.paymasterAndData);
140
+ userOp = {
141
+ ...userOp,
142
+ signature: await opts.signUserOp(userOp),
143
+ };
144
+ const userOpHash = await this.sendUserOperation(userOp, entryPoint);
145
+ if (opts.waitForReceipt === false) {
146
+ return { userOpHash, receipt: null };
147
+ }
148
+ const receipt = await this.waitForUserOperationReceipt(userOpHash, opts.receiptPoll);
149
+ return { userOpHash, receipt };
150
+ }
151
+ async rpc(method, params) {
152
+ const id = this.rpcId++;
153
+ const envelope = await this.http.post('/', {
154
+ jsonrpc: '2.0',
155
+ id,
156
+ method,
157
+ params,
158
+ });
159
+ if (!envelope.success || envelope.data == null) {
160
+ throw new Error(`[SmoothSendAvaxSubmitter] ${method}: empty response`);
161
+ }
162
+ const body = envelope.data;
163
+ if (body.error) {
164
+ const msg = sanitizeAvaxBundlerRpcMessage(String(body.error.message ?? ''));
165
+ throw new Error(`[SmoothSendAvaxSubmitter] ${method}: ${body.error.code} ${msg}`);
166
+ }
167
+ if (body.result === undefined) {
168
+ throw new Error(`[SmoothSendAvaxSubmitter] ${method}: missing result`);
169
+ }
170
+ return body.result;
171
+ }
172
+ }
173
+ /**
174
+ * @alias {@link SmoothSendAvaxSubmitter}
175
+ */
176
+ const AvaxSubmitter = SmoothSendAvaxSubmitter;
177
+ function createSmoothSendAvaxSubmitter(config) {
178
+ return new SmoothSendAvaxSubmitter(config);
179
+ }
180
+
181
+ /**
182
+ * Viem helpers for ERC-4337 v0.7 + common smart-account `execute` encoding.
183
+ * Peer dependency: `viem` (optional install).
184
+ */
185
+ /** Typical SimpleAccount-style `execute(dest,value,func)`. */
186
+ const avaxExecuteAbi = [
187
+ {
188
+ name: 'execute',
189
+ type: 'function',
190
+ stateMutability: 'nonpayable',
191
+ inputs: [
192
+ { name: 'dest', type: 'address' },
193
+ { name: 'value', type: 'uint256' },
194
+ { name: 'func', type: 'bytes' },
195
+ ],
196
+ outputs: [],
197
+ },
198
+ ];
199
+ function encodeAvaxExecuteCalldata(to, value, data = '0x') {
200
+ return encodeFunctionData({
201
+ abi: avaxExecuteAbi,
202
+ functionName: 'execute',
203
+ args: [to, value, data],
204
+ });
205
+ }
206
+ function parseUint(name, v) {
207
+ if (v === undefined || v === '') {
208
+ throw new Error(`[SmoothSend AVAX] UserOp missing ${name}`);
209
+ }
210
+ return BigInt(v);
211
+ }
212
+ /** Convert API UserOp → viem shape for {@link getUserOperationHash}. */
213
+ function userOperationAvaxToViem(u) {
214
+ const base = {
215
+ sender: u.sender,
216
+ nonce: parseUint('nonce', u.nonce),
217
+ callData: (u.callData ?? '0x'),
218
+ callGasLimit: parseUint('callGasLimit', u.callGasLimit),
219
+ verificationGasLimit: parseUint('verificationGasLimit', u.verificationGasLimit),
220
+ preVerificationGas: parseUint('preVerificationGas', u.preVerificationGas),
221
+ maxFeePerGas: parseUint('maxFeePerGas', u.maxFeePerGas),
222
+ maxPriorityFeePerGas: parseUint('maxPriorityFeePerGas', u.maxPriorityFeePerGas),
223
+ signature: (u.signature ?? '0x'),
224
+ };
225
+ let out = { ...base };
226
+ if (u.factory && u.factoryData) {
227
+ out = {
228
+ ...out,
229
+ factory: u.factory,
230
+ factoryData: u.factoryData,
231
+ };
232
+ }
233
+ else if (u.initCode && u.initCode !== '0x') {
234
+ const ic = u.initCode;
235
+ out = {
236
+ ...out,
237
+ factory: slice(ic, 0, 20),
238
+ factoryData: slice(ic, 20),
239
+ };
240
+ }
241
+ if (u.paymasterAndData && u.paymasterAndData !== '0x') {
242
+ const pm = u.paymasterAndData;
243
+ if (size(pm) < 52) {
244
+ throw new Error('[SmoothSend AVAX] paymasterAndData too short');
245
+ }
246
+ out = {
247
+ ...out,
248
+ paymaster: slice(pm, 0, 20),
249
+ paymasterVerificationGasLimit: hexToBigInt(slice(pm, 20, 36)),
250
+ paymasterPostOpGasLimit: hexToBigInt(slice(pm, 36, 52)),
251
+ paymasterData: size(pm) > 52 ? slice(pm, 52) : '0x',
252
+ };
253
+ }
254
+ else if (u.paymaster) {
255
+ out = {
256
+ ...out,
257
+ paymaster: u.paymaster,
258
+ paymasterVerificationGasLimit: u.paymasterVerificationGasLimit
259
+ ? BigInt(u.paymasterVerificationGasLimit)
260
+ : 0n,
261
+ paymasterPostOpGasLimit: u.paymasterPostOpGasLimit
262
+ ? BigInt(u.paymasterPostOpGasLimit)
263
+ : 0n,
264
+ paymasterData: (u.paymasterData ?? '0x'),
265
+ };
266
+ }
267
+ return out;
268
+ }
269
+ function hashUserOperationAvax(params) {
270
+ return getUserOperationHash({
271
+ chainId: params.chainId,
272
+ entryPointAddress: params.entryPointAddress,
273
+ entryPointVersion: '0.7',
274
+ userOperation: userOperationAvaxToViem(params.userOperation),
275
+ });
276
+ }
277
+ /** EntryPoint v0.7 `getNonce(sender, key)` with key `0`. */
278
+ async function readAvaxSenderNonce(params) {
279
+ return readContract(params.publicClient, {
280
+ address: params.entryPointAddress,
281
+ abi: entryPoint07Abi,
282
+ functionName: 'getNonce',
283
+ args: [params.sender, params.key ?? 0n],
284
+ });
285
+ }
286
+
287
+ /**
288
+ * Standard SimpleAccountFactory (EntryPoint v0.7) helpers for counterfactual address + init calldata.
289
+ */
290
+ /** Minimal ABI for eth-infinitism–style SimpleAccountFactory. */
291
+ const SIMPLE_ACCOUNT_FACTORY_ABI = [
292
+ {
293
+ inputs: [
294
+ { name: 'owner', type: 'address' },
295
+ { name: 'salt', type: 'uint256' },
296
+ ],
297
+ name: 'createAccount',
298
+ outputs: [{ name: 'account', type: 'address' }],
299
+ stateMutability: 'nonpayable',
300
+ type: 'function',
301
+ },
302
+ {
303
+ inputs: [
304
+ { name: 'owner', type: 'address' },
305
+ { name: 'salt', type: 'uint256' },
306
+ ],
307
+ name: 'getAddress',
308
+ outputs: [{ name: '', type: 'address' }],
309
+ stateMutability: 'view',
310
+ type: 'function',
311
+ },
312
+ ];
313
+ async function predictSimpleAccountAddress(params) {
314
+ const salt = params.salt ?? 0n;
315
+ const addr = await readContract(params.publicClient, {
316
+ address: params.factory,
317
+ abi: SIMPLE_ACCOUNT_FACTORY_ABI,
318
+ functionName: 'getAddress',
319
+ args: [params.owner, salt],
320
+ });
321
+ return addr;
322
+ }
323
+ function encodeCreateAccountFactoryData(owner, salt) {
324
+ return encodeFunctionData({
325
+ abi: SIMPLE_ACCOUNT_FACTORY_ABI,
326
+ functionName: 'createAccount',
327
+ args: [owner, salt],
328
+ });
329
+ }
330
+
331
+ /**
332
+ * Public gateway defaults for Avalanche AA (no API key).
333
+ */
334
+ /** Canonical ERC-4337 EntryPoint v0.7 on Fuji / Avalanche C-Chain */
335
+ const ENTRY_POINT_V07_ADDRESS = '0x0000000071727De22E5E9d8BAf0edAc6f37da032';
336
+ /**
337
+ * Fetch SimpleAccount factory hint from SmoothSend gateway (GET; no auth).
338
+ * Ops configure {@link https://proxy.smoothsend.xyz} `AVAX_FUJI_SIMPLE_ACCOUNT_FACTORY`; until then this returns null.
339
+ */
340
+ async function fetchAvaxAaPublicDefaults(gatewayUrl = 'https://proxy.smoothsend.xyz') {
341
+ const base = gatewayUrl.replace(/\/$/, '');
342
+ const res = await fetch(`${base}/api/v1/public/avax-aa-defaults`);
343
+ if (!res.ok) {
344
+ throw new Error(`fetchAvaxAaPublicDefaults failed: HTTP ${res.status}`);
345
+ }
346
+ const j = (await res.json());
347
+ let factory = null;
348
+ const fac = j.simpleAccountFactoryFuji?.trim();
349
+ if (fac && fac.startsWith('0x') && /^0x[a-fA-F0-9]{40}$/.test(fac)) {
350
+ factory = fac;
351
+ }
352
+ return {
353
+ success: j.success,
354
+ simpleAccountFactoryFuji: factory,
355
+ entryPointV07: j.entryPointV07?.startsWith('0x') && /^0x[a-fA-F0-9]{40}$/.test(j.entryPointV07)
356
+ ? j.entryPointV07
357
+ : ENTRY_POINT_V07_ADDRESS,
358
+ };
359
+ }
360
+
361
+ var jsxRuntime = {exports: {}};
362
+
363
+ var reactJsxRuntime_production_min = {};
364
+
365
+ /**
366
+ * @license React
367
+ * react-jsx-runtime.production.min.js
368
+ *
369
+ * Copyright (c) Facebook, Inc. and its affiliates.
370
+ *
371
+ * This source code is licensed under the MIT license found in the
372
+ * LICENSE file in the root directory of this source tree.
373
+ */
374
+
375
+ var hasRequiredReactJsxRuntime_production_min;
376
+
377
+ function requireReactJsxRuntime_production_min () {
378
+ if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
379
+ hasRequiredReactJsxRuntime_production_min = 1;
380
+ var f=require$$0,k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:true,ref:true,__self:true,__source:true};
381
+ function q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=""+g);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a) void 0===d[b]&&(d[b]=a[b]);return {$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}reactJsxRuntime_production_min.Fragment=l;reactJsxRuntime_production_min.jsx=q;reactJsxRuntime_production_min.jsxs=q;
382
+ return reactJsxRuntime_production_min;
383
+ }
384
+
385
+ var reactJsxRuntime_development = {};
386
+
387
+ /**
388
+ * @license React
389
+ * react-jsx-runtime.development.js
390
+ *
391
+ * Copyright (c) Facebook, Inc. and its affiliates.
392
+ *
393
+ * This source code is licensed under the MIT license found in the
394
+ * LICENSE file in the root directory of this source tree.
395
+ */
396
+
397
+ var hasRequiredReactJsxRuntime_development;
398
+
399
+ function requireReactJsxRuntime_development () {
400
+ if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
401
+ hasRequiredReactJsxRuntime_development = 1;
402
+
403
+ if (process.env.NODE_ENV !== "production") {
404
+ (function() {
405
+
406
+ var React = require$$0;
407
+
408
+ // ATTENTION
409
+ // When adding new symbols to this file,
410
+ // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
411
+ // The Symbol used to tag the ReactElement-like types.
412
+ var REACT_ELEMENT_TYPE = Symbol.for('react.element');
413
+ var REACT_PORTAL_TYPE = Symbol.for('react.portal');
414
+ var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
415
+ var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
416
+ var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
417
+ var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
418
+ var REACT_CONTEXT_TYPE = Symbol.for('react.context');
419
+ var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
420
+ var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
421
+ var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
422
+ var REACT_MEMO_TYPE = Symbol.for('react.memo');
423
+ var REACT_LAZY_TYPE = Symbol.for('react.lazy');
424
+ var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
425
+ var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
426
+ var FAUX_ITERATOR_SYMBOL = '@@iterator';
427
+ function getIteratorFn(maybeIterable) {
428
+ if (maybeIterable === null || typeof maybeIterable !== 'object') {
429
+ return null;
430
+ }
431
+
432
+ var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
433
+
434
+ if (typeof maybeIterator === 'function') {
435
+ return maybeIterator;
436
+ }
437
+
438
+ return null;
439
+ }
440
+
441
+ var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
442
+
443
+ function error(format) {
444
+ {
445
+ {
446
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
447
+ args[_key2 - 1] = arguments[_key2];
448
+ }
449
+
450
+ printWarning('error', format, args);
451
+ }
452
+ }
453
+ }
454
+
455
+ function printWarning(level, format, args) {
456
+ // When changing this logic, you might want to also
457
+ // update consoleWithStackDev.www.js as well.
458
+ {
459
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
460
+ var stack = ReactDebugCurrentFrame.getStackAddendum();
461
+
462
+ if (stack !== '') {
463
+ format += '%s';
464
+ args = args.concat([stack]);
465
+ } // eslint-disable-next-line react-internal/safe-string-coercion
466
+
467
+
468
+ var argsWithFormat = args.map(function (item) {
469
+ return String(item);
470
+ }); // Careful: RN currently depends on this prefix
471
+
472
+ argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
473
+ // breaks IE9: https://github.com/facebook/react/issues/13610
474
+ // eslint-disable-next-line react-internal/no-production-logging
475
+
476
+ Function.prototype.apply.call(console[level], console, argsWithFormat);
477
+ }
478
+ }
479
+
480
+ // -----------------------------------------------------------------------------
481
+
482
+ var enableScopeAPI = false; // Experimental Create Event Handle API.
483
+ var enableCacheElement = false;
484
+ var enableTransitionTracing = false; // No known bugs, but needs performance testing
485
+
486
+ var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
487
+ // stuff. Intended to enable React core members to more easily debug scheduling
488
+ // issues in DEV builds.
489
+
490
+ var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
491
+
492
+ var REACT_MODULE_REFERENCE;
493
+
494
+ {
495
+ REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
496
+ }
497
+
498
+ function isValidElementType(type) {
499
+ if (typeof type === 'string' || typeof type === 'function') {
500
+ return true;
501
+ } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
502
+
503
+
504
+ if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
505
+ return true;
506
+ }
507
+
508
+ if (typeof type === 'object' && type !== null) {
509
+ if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
510
+ // types supported by any Flight configuration anywhere since
511
+ // we don't know which Flight build this will end up being used
512
+ // with.
513
+ type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
514
+ return true;
515
+ }
516
+ }
517
+
518
+ return false;
519
+ }
520
+
521
+ function getWrappedName(outerType, innerType, wrapperName) {
522
+ var displayName = outerType.displayName;
523
+
524
+ if (displayName) {
525
+ return displayName;
526
+ }
527
+
528
+ var functionName = innerType.displayName || innerType.name || '';
529
+ return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
530
+ } // Keep in sync with react-reconciler/getComponentNameFromFiber
531
+
532
+
533
+ function getContextName(type) {
534
+ return type.displayName || 'Context';
535
+ } // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
536
+
537
+
538
+ function getComponentNameFromType(type) {
539
+ if (type == null) {
540
+ // Host root, text node or just invalid type.
541
+ return null;
542
+ }
543
+
544
+ {
545
+ if (typeof type.tag === 'number') {
546
+ error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
547
+ }
548
+ }
549
+
550
+ if (typeof type === 'function') {
551
+ return type.displayName || type.name || null;
552
+ }
553
+
554
+ if (typeof type === 'string') {
555
+ return type;
556
+ }
557
+
558
+ switch (type) {
559
+ case REACT_FRAGMENT_TYPE:
560
+ return 'Fragment';
561
+
562
+ case REACT_PORTAL_TYPE:
563
+ return 'Portal';
564
+
565
+ case REACT_PROFILER_TYPE:
566
+ return 'Profiler';
567
+
568
+ case REACT_STRICT_MODE_TYPE:
569
+ return 'StrictMode';
570
+
571
+ case REACT_SUSPENSE_TYPE:
572
+ return 'Suspense';
573
+
574
+ case REACT_SUSPENSE_LIST_TYPE:
575
+ return 'SuspenseList';
576
+
577
+ }
578
+
579
+ if (typeof type === 'object') {
580
+ switch (type.$$typeof) {
581
+ case REACT_CONTEXT_TYPE:
582
+ var context = type;
583
+ return getContextName(context) + '.Consumer';
584
+
585
+ case REACT_PROVIDER_TYPE:
586
+ var provider = type;
587
+ return getContextName(provider._context) + '.Provider';
588
+
589
+ case REACT_FORWARD_REF_TYPE:
590
+ return getWrappedName(type, type.render, 'ForwardRef');
591
+
592
+ case REACT_MEMO_TYPE:
593
+ var outerName = type.displayName || null;
594
+
595
+ if (outerName !== null) {
596
+ return outerName;
597
+ }
598
+
599
+ return getComponentNameFromType(type.type) || 'Memo';
600
+
601
+ case REACT_LAZY_TYPE:
602
+ {
603
+ var lazyComponent = type;
604
+ var payload = lazyComponent._payload;
605
+ var init = lazyComponent._init;
606
+
607
+ try {
608
+ return getComponentNameFromType(init(payload));
609
+ } catch (x) {
610
+ return null;
611
+ }
612
+ }
613
+
614
+ // eslint-disable-next-line no-fallthrough
615
+ }
616
+ }
617
+
618
+ return null;
619
+ }
620
+
621
+ var assign = Object.assign;
622
+
623
+ // Helpers to patch console.logs to avoid logging during side-effect free
624
+ // replaying on render function. This currently only patches the object
625
+ // lazily which won't cover if the log function was extracted eagerly.
626
+ // We could also eagerly patch the method.
627
+ var disabledDepth = 0;
628
+ var prevLog;
629
+ var prevInfo;
630
+ var prevWarn;
631
+ var prevError;
632
+ var prevGroup;
633
+ var prevGroupCollapsed;
634
+ var prevGroupEnd;
635
+
636
+ function disabledLog() {}
637
+
638
+ disabledLog.__reactDisabledLog = true;
639
+ function disableLogs() {
640
+ {
641
+ if (disabledDepth === 0) {
642
+ /* eslint-disable react-internal/no-production-logging */
643
+ prevLog = console.log;
644
+ prevInfo = console.info;
645
+ prevWarn = console.warn;
646
+ prevError = console.error;
647
+ prevGroup = console.group;
648
+ prevGroupCollapsed = console.groupCollapsed;
649
+ prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
650
+
651
+ var props = {
652
+ configurable: true,
653
+ enumerable: true,
654
+ value: disabledLog,
655
+ writable: true
656
+ }; // $FlowFixMe Flow thinks console is immutable.
657
+
658
+ Object.defineProperties(console, {
659
+ info: props,
660
+ log: props,
661
+ warn: props,
662
+ error: props,
663
+ group: props,
664
+ groupCollapsed: props,
665
+ groupEnd: props
666
+ });
667
+ /* eslint-enable react-internal/no-production-logging */
668
+ }
669
+
670
+ disabledDepth++;
671
+ }
672
+ }
673
+ function reenableLogs() {
674
+ {
675
+ disabledDepth--;
676
+
677
+ if (disabledDepth === 0) {
678
+ /* eslint-disable react-internal/no-production-logging */
679
+ var props = {
680
+ configurable: true,
681
+ enumerable: true,
682
+ writable: true
683
+ }; // $FlowFixMe Flow thinks console is immutable.
684
+
685
+ Object.defineProperties(console, {
686
+ log: assign({}, props, {
687
+ value: prevLog
688
+ }),
689
+ info: assign({}, props, {
690
+ value: prevInfo
691
+ }),
692
+ warn: assign({}, props, {
693
+ value: prevWarn
694
+ }),
695
+ error: assign({}, props, {
696
+ value: prevError
697
+ }),
698
+ group: assign({}, props, {
699
+ value: prevGroup
700
+ }),
701
+ groupCollapsed: assign({}, props, {
702
+ value: prevGroupCollapsed
703
+ }),
704
+ groupEnd: assign({}, props, {
705
+ value: prevGroupEnd
706
+ })
707
+ });
708
+ /* eslint-enable react-internal/no-production-logging */
709
+ }
710
+
711
+ if (disabledDepth < 0) {
712
+ error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
713
+ }
714
+ }
715
+ }
716
+
717
+ var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
718
+ var prefix;
719
+ function describeBuiltInComponentFrame(name, source, ownerFn) {
720
+ {
721
+ if (prefix === undefined) {
722
+ // Extract the VM specific prefix used by each line.
723
+ try {
724
+ throw Error();
725
+ } catch (x) {
726
+ var match = x.stack.trim().match(/\n( *(at )?)/);
727
+ prefix = match && match[1] || '';
728
+ }
729
+ } // We use the prefix to ensure our stacks line up with native stack frames.
730
+
731
+
732
+ return '\n' + prefix + name;
733
+ }
734
+ }
735
+ var reentry = false;
736
+ var componentFrameCache;
737
+
738
+ {
739
+ var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
740
+ componentFrameCache = new PossiblyWeakMap();
741
+ }
742
+
743
+ function describeNativeComponentFrame(fn, construct) {
744
+ // If something asked for a stack inside a fake render, it should get ignored.
745
+ if ( !fn || reentry) {
746
+ return '';
747
+ }
748
+
749
+ {
750
+ var frame = componentFrameCache.get(fn);
751
+
752
+ if (frame !== undefined) {
753
+ return frame;
754
+ }
755
+ }
756
+
757
+ var control;
758
+ reentry = true;
759
+ var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
760
+
761
+ Error.prepareStackTrace = undefined;
762
+ var previousDispatcher;
763
+
764
+ {
765
+ previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function
766
+ // for warnings.
767
+
768
+ ReactCurrentDispatcher.current = null;
769
+ disableLogs();
770
+ }
771
+
772
+ try {
773
+ // This should throw.
774
+ if (construct) {
775
+ // Something should be setting the props in the constructor.
776
+ var Fake = function () {
777
+ throw Error();
778
+ }; // $FlowFixMe
779
+
780
+
781
+ Object.defineProperty(Fake.prototype, 'props', {
782
+ set: function () {
783
+ // We use a throwing setter instead of frozen or non-writable props
784
+ // because that won't throw in a non-strict mode function.
785
+ throw Error();
786
+ }
787
+ });
788
+
789
+ if (typeof Reflect === 'object' && Reflect.construct) {
790
+ // We construct a different control for this case to include any extra
791
+ // frames added by the construct call.
792
+ try {
793
+ Reflect.construct(Fake, []);
794
+ } catch (x) {
795
+ control = x;
796
+ }
797
+
798
+ Reflect.construct(fn, [], Fake);
799
+ } else {
800
+ try {
801
+ Fake.call();
802
+ } catch (x) {
803
+ control = x;
804
+ }
805
+
806
+ fn.call(Fake.prototype);
807
+ }
808
+ } else {
809
+ try {
810
+ throw Error();
811
+ } catch (x) {
812
+ control = x;
813
+ }
814
+
815
+ fn();
816
+ }
817
+ } catch (sample) {
818
+ // This is inlined manually because closure doesn't do it for us.
819
+ if (sample && control && typeof sample.stack === 'string') {
820
+ // This extracts the first frame from the sample that isn't also in the control.
821
+ // Skipping one frame that we assume is the frame that calls the two.
822
+ var sampleLines = sample.stack.split('\n');
823
+ var controlLines = control.stack.split('\n');
824
+ var s = sampleLines.length - 1;
825
+ var c = controlLines.length - 1;
826
+
827
+ while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
828
+ // We expect at least one stack frame to be shared.
829
+ // Typically this will be the root most one. However, stack frames may be
830
+ // cut off due to maximum stack limits. In this case, one maybe cut off
831
+ // earlier than the other. We assume that the sample is longer or the same
832
+ // and there for cut off earlier. So we should find the root most frame in
833
+ // the sample somewhere in the control.
834
+ c--;
835
+ }
836
+
837
+ for (; s >= 1 && c >= 0; s--, c--) {
838
+ // Next we find the first one that isn't the same which should be the
839
+ // frame that called our sample function and the control.
840
+ if (sampleLines[s] !== controlLines[c]) {
841
+ // In V8, the first line is describing the message but other VMs don't.
842
+ // If we're about to return the first line, and the control is also on the same
843
+ // line, that's a pretty good indicator that our sample threw at same line as
844
+ // the control. I.e. before we entered the sample frame. So we ignore this result.
845
+ // This can happen if you passed a class to function component, or non-function.
846
+ if (s !== 1 || c !== 1) {
847
+ do {
848
+ s--;
849
+ c--; // We may still have similar intermediate frames from the construct call.
850
+ // The next one that isn't the same should be our match though.
851
+
852
+ if (c < 0 || sampleLines[s] !== controlLines[c]) {
853
+ // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
854
+ var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
855
+ // but we have a user-provided "displayName"
856
+ // splice it in to make the stack more readable.
857
+
858
+
859
+ if (fn.displayName && _frame.includes('<anonymous>')) {
860
+ _frame = _frame.replace('<anonymous>', fn.displayName);
861
+ }
862
+
863
+ {
864
+ if (typeof fn === 'function') {
865
+ componentFrameCache.set(fn, _frame);
866
+ }
867
+ } // Return the line we found.
868
+
869
+
870
+ return _frame;
871
+ }
872
+ } while (s >= 1 && c >= 0);
873
+ }
874
+
875
+ break;
876
+ }
877
+ }
878
+ }
879
+ } finally {
880
+ reentry = false;
881
+
882
+ {
883
+ ReactCurrentDispatcher.current = previousDispatcher;
884
+ reenableLogs();
885
+ }
886
+
887
+ Error.prepareStackTrace = previousPrepareStackTrace;
888
+ } // Fallback to just using the name if we couldn't make it throw.
889
+
890
+
891
+ var name = fn ? fn.displayName || fn.name : '';
892
+ var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
893
+
894
+ {
895
+ if (typeof fn === 'function') {
896
+ componentFrameCache.set(fn, syntheticFrame);
897
+ }
898
+ }
899
+
900
+ return syntheticFrame;
901
+ }
902
+ function describeFunctionComponentFrame(fn, source, ownerFn) {
903
+ {
904
+ return describeNativeComponentFrame(fn, false);
905
+ }
906
+ }
907
+
908
+ function shouldConstruct(Component) {
909
+ var prototype = Component.prototype;
910
+ return !!(prototype && prototype.isReactComponent);
911
+ }
912
+
913
+ function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
914
+
915
+ if (type == null) {
916
+ return '';
917
+ }
918
+
919
+ if (typeof type === 'function') {
920
+ {
921
+ return describeNativeComponentFrame(type, shouldConstruct(type));
922
+ }
923
+ }
924
+
925
+ if (typeof type === 'string') {
926
+ return describeBuiltInComponentFrame(type);
927
+ }
928
+
929
+ switch (type) {
930
+ case REACT_SUSPENSE_TYPE:
931
+ return describeBuiltInComponentFrame('Suspense');
932
+
933
+ case REACT_SUSPENSE_LIST_TYPE:
934
+ return describeBuiltInComponentFrame('SuspenseList');
935
+ }
936
+
937
+ if (typeof type === 'object') {
938
+ switch (type.$$typeof) {
939
+ case REACT_FORWARD_REF_TYPE:
940
+ return describeFunctionComponentFrame(type.render);
941
+
942
+ case REACT_MEMO_TYPE:
943
+ // Memo may contain any component type so we recursively resolve it.
944
+ return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
945
+
946
+ case REACT_LAZY_TYPE:
947
+ {
948
+ var lazyComponent = type;
949
+ var payload = lazyComponent._payload;
950
+ var init = lazyComponent._init;
951
+
952
+ try {
953
+ // Lazy may contain any component type so we recursively resolve it.
954
+ return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
955
+ } catch (x) {}
956
+ }
957
+ }
958
+ }
959
+
960
+ return '';
961
+ }
962
+
963
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
964
+
965
+ var loggedTypeFailures = {};
966
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
967
+
968
+ function setCurrentlyValidatingElement(element) {
969
+ {
970
+ if (element) {
971
+ var owner = element._owner;
972
+ var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
973
+ ReactDebugCurrentFrame.setExtraStackFrame(stack);
974
+ } else {
975
+ ReactDebugCurrentFrame.setExtraStackFrame(null);
976
+ }
977
+ }
978
+ }
979
+
980
+ function checkPropTypes(typeSpecs, values, location, componentName, element) {
981
+ {
982
+ // $FlowFixMe This is okay but Flow doesn't know it.
983
+ var has = Function.call.bind(hasOwnProperty);
984
+
985
+ for (var typeSpecName in typeSpecs) {
986
+ if (has(typeSpecs, typeSpecName)) {
987
+ var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
988
+ // fail the render phase where it didn't fail before. So we log it.
989
+ // After these have been cleaned up, we'll let them throw.
990
+
991
+ try {
992
+ // This is intentionally an invariant that gets caught. It's the same
993
+ // behavior as without this statement except with a better message.
994
+ if (typeof typeSpecs[typeSpecName] !== 'function') {
995
+ // eslint-disable-next-line react-internal/prod-error-codes
996
+ var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
997
+ err.name = 'Invariant Violation';
998
+ throw err;
999
+ }
1000
+
1001
+ error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
1002
+ } catch (ex) {
1003
+ error$1 = ex;
1004
+ }
1005
+
1006
+ if (error$1 && !(error$1 instanceof Error)) {
1007
+ setCurrentlyValidatingElement(element);
1008
+
1009
+ error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);
1010
+
1011
+ setCurrentlyValidatingElement(null);
1012
+ }
1013
+
1014
+ if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
1015
+ // Only monitor this failure once because there tends to be a lot of the
1016
+ // same error.
1017
+ loggedTypeFailures[error$1.message] = true;
1018
+ setCurrentlyValidatingElement(element);
1019
+
1020
+ error('Failed %s type: %s', location, error$1.message);
1021
+
1022
+ setCurrentlyValidatingElement(null);
1023
+ }
1024
+ }
1025
+ }
1026
+ }
1027
+ }
1028
+
1029
+ var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
1030
+
1031
+ function isArray(a) {
1032
+ return isArrayImpl(a);
1033
+ }
1034
+
1035
+ /*
1036
+ * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
1037
+ * and Temporal.* types. See https://github.com/facebook/react/pull/22064.
1038
+ *
1039
+ * The functions in this module will throw an easier-to-understand,
1040
+ * easier-to-debug exception with a clear errors message message explaining the
1041
+ * problem. (Instead of a confusing exception thrown inside the implementation
1042
+ * of the `value` object).
1043
+ */
1044
+ // $FlowFixMe only called in DEV, so void return is not possible.
1045
+ function typeName(value) {
1046
+ {
1047
+ // toStringTag is needed for namespaced types like Temporal.Instant
1048
+ var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
1049
+ var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
1050
+ return type;
1051
+ }
1052
+ } // $FlowFixMe only called in DEV, so void return is not possible.
1053
+
1054
+
1055
+ function willCoercionThrow(value) {
1056
+ {
1057
+ try {
1058
+ testStringCoercion(value);
1059
+ return false;
1060
+ } catch (e) {
1061
+ return true;
1062
+ }
1063
+ }
1064
+ }
1065
+
1066
+ function testStringCoercion(value) {
1067
+ // If you ended up here by following an exception call stack, here's what's
1068
+ // happened: you supplied an object or symbol value to React (as a prop, key,
1069
+ // DOM attribute, CSS property, string ref, etc.) and when React tried to
1070
+ // coerce it to a string using `'' + value`, an exception was thrown.
1071
+ //
1072
+ // The most common types that will cause this exception are `Symbol` instances
1073
+ // and Temporal objects like `Temporal.Instant`. But any object that has a
1074
+ // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
1075
+ // exception. (Library authors do this to prevent users from using built-in
1076
+ // numeric operators like `+` or comparison operators like `>=` because custom
1077
+ // methods are needed to perform accurate arithmetic or comparison.)
1078
+ //
1079
+ // To fix the problem, coerce this object or symbol value to a string before
1080
+ // passing it to React. The most reliable way is usually `String(value)`.
1081
+ //
1082
+ // To find which value is throwing, check the browser or debugger console.
1083
+ // Before this exception was thrown, there should be `console.error` output
1084
+ // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
1085
+ // problem and how that type was used: key, atrribute, input value prop, etc.
1086
+ // In most cases, this console output also shows the component and its
1087
+ // ancestor components where the exception happened.
1088
+ //
1089
+ // eslint-disable-next-line react-internal/safe-string-coercion
1090
+ return '' + value;
1091
+ }
1092
+ function checkKeyStringCoercion(value) {
1093
+ {
1094
+ if (willCoercionThrow(value)) {
1095
+ error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
1096
+
1097
+ return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
1098
+ }
1099
+ }
1100
+ }
1101
+
1102
+ var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
1103
+ var RESERVED_PROPS = {
1104
+ key: true,
1105
+ ref: true,
1106
+ __self: true,
1107
+ __source: true
1108
+ };
1109
+ var specialPropKeyWarningShown;
1110
+ var specialPropRefWarningShown;
1111
+
1112
+ function hasValidRef(config) {
1113
+ {
1114
+ if (hasOwnProperty.call(config, 'ref')) {
1115
+ var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
1116
+
1117
+ if (getter && getter.isReactWarning) {
1118
+ return false;
1119
+ }
1120
+ }
1121
+ }
1122
+
1123
+ return config.ref !== undefined;
1124
+ }
1125
+
1126
+ function hasValidKey(config) {
1127
+ {
1128
+ if (hasOwnProperty.call(config, 'key')) {
1129
+ var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
1130
+
1131
+ if (getter && getter.isReactWarning) {
1132
+ return false;
1133
+ }
1134
+ }
1135
+ }
1136
+
1137
+ return config.key !== undefined;
1138
+ }
1139
+
1140
+ function warnIfStringRefCannotBeAutoConverted(config, self) {
1141
+ {
1142
+ if (typeof config.ref === 'string' && ReactCurrentOwner.current && self) ;
1143
+ }
1144
+ }
1145
+
1146
+ function defineKeyPropWarningGetter(props, displayName) {
1147
+ {
1148
+ var warnAboutAccessingKey = function () {
1149
+ if (!specialPropKeyWarningShown) {
1150
+ specialPropKeyWarningShown = true;
1151
+
1152
+ error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
1153
+ }
1154
+ };
1155
+
1156
+ warnAboutAccessingKey.isReactWarning = true;
1157
+ Object.defineProperty(props, 'key', {
1158
+ get: warnAboutAccessingKey,
1159
+ configurable: true
1160
+ });
1161
+ }
1162
+ }
1163
+
1164
+ function defineRefPropWarningGetter(props, displayName) {
1165
+ {
1166
+ var warnAboutAccessingRef = function () {
1167
+ if (!specialPropRefWarningShown) {
1168
+ specialPropRefWarningShown = true;
1169
+
1170
+ error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
1171
+ }
1172
+ };
1173
+
1174
+ warnAboutAccessingRef.isReactWarning = true;
1175
+ Object.defineProperty(props, 'ref', {
1176
+ get: warnAboutAccessingRef,
1177
+ configurable: true
1178
+ });
1179
+ }
1180
+ }
1181
+ /**
1182
+ * Factory method to create a new React element. This no longer adheres to
1183
+ * the class pattern, so do not use new to call it. Also, instanceof check
1184
+ * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
1185
+ * if something is a React Element.
1186
+ *
1187
+ * @param {*} type
1188
+ * @param {*} props
1189
+ * @param {*} key
1190
+ * @param {string|object} ref
1191
+ * @param {*} owner
1192
+ * @param {*} self A *temporary* helper to detect places where `this` is
1193
+ * different from the `owner` when React.createElement is called, so that we
1194
+ * can warn. We want to get rid of owner and replace string `ref`s with arrow
1195
+ * functions, and as long as `this` and owner are the same, there will be no
1196
+ * change in behavior.
1197
+ * @param {*} source An annotation object (added by a transpiler or otherwise)
1198
+ * indicating filename, line number, and/or other information.
1199
+ * @internal
1200
+ */
1201
+
1202
+
1203
+ var ReactElement = function (type, key, ref, self, source, owner, props) {
1204
+ var element = {
1205
+ // This tag allows us to uniquely identify this as a React Element
1206
+ $$typeof: REACT_ELEMENT_TYPE,
1207
+ // Built-in properties that belong on the element
1208
+ type: type,
1209
+ key: key,
1210
+ ref: ref,
1211
+ props: props,
1212
+ // Record the component responsible for creating this element.
1213
+ _owner: owner
1214
+ };
1215
+
1216
+ {
1217
+ // The validation flag is currently mutative. We put it on
1218
+ // an external backing store so that we can freeze the whole object.
1219
+ // This can be replaced with a WeakMap once they are implemented in
1220
+ // commonly used development environments.
1221
+ element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
1222
+ // the validation flag non-enumerable (where possible, which should
1223
+ // include every environment we run tests in), so the test framework
1224
+ // ignores it.
1225
+
1226
+ Object.defineProperty(element._store, 'validated', {
1227
+ configurable: false,
1228
+ enumerable: false,
1229
+ writable: true,
1230
+ value: false
1231
+ }); // self and source are DEV only properties.
1232
+
1233
+ Object.defineProperty(element, '_self', {
1234
+ configurable: false,
1235
+ enumerable: false,
1236
+ writable: false,
1237
+ value: self
1238
+ }); // Two elements created in two different places should be considered
1239
+ // equal for testing purposes and therefore we hide it from enumeration.
1240
+
1241
+ Object.defineProperty(element, '_source', {
1242
+ configurable: false,
1243
+ enumerable: false,
1244
+ writable: false,
1245
+ value: source
1246
+ });
1247
+
1248
+ if (Object.freeze) {
1249
+ Object.freeze(element.props);
1250
+ Object.freeze(element);
1251
+ }
1252
+ }
1253
+
1254
+ return element;
1255
+ };
1256
+ /**
1257
+ * https://github.com/reactjs/rfcs/pull/107
1258
+ * @param {*} type
1259
+ * @param {object} props
1260
+ * @param {string} key
1261
+ */
1262
+
1263
+ function jsxDEV(type, config, maybeKey, source, self) {
1264
+ {
1265
+ var propName; // Reserved names are extracted
1266
+
1267
+ var props = {};
1268
+ var key = null;
1269
+ var ref = null; // Currently, key can be spread in as a prop. This causes a potential
1270
+ // issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
1271
+ // or <div key="Hi" {...props} /> ). We want to deprecate key spread,
1272
+ // but as an intermediary step, we will use jsxDEV for everything except
1273
+ // <div {...props} key="Hi" />, because we aren't currently able to tell if
1274
+ // key is explicitly declared to be undefined or not.
1275
+
1276
+ if (maybeKey !== undefined) {
1277
+ {
1278
+ checkKeyStringCoercion(maybeKey);
1279
+ }
1280
+
1281
+ key = '' + maybeKey;
1282
+ }
1283
+
1284
+ if (hasValidKey(config)) {
1285
+ {
1286
+ checkKeyStringCoercion(config.key);
1287
+ }
1288
+
1289
+ key = '' + config.key;
1290
+ }
1291
+
1292
+ if (hasValidRef(config)) {
1293
+ ref = config.ref;
1294
+ warnIfStringRefCannotBeAutoConverted(config, self);
1295
+ } // Remaining properties are added to a new props object
1296
+
1297
+
1298
+ for (propName in config) {
1299
+ if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
1300
+ props[propName] = config[propName];
1301
+ }
1302
+ } // Resolve default props
1303
+
1304
+
1305
+ if (type && type.defaultProps) {
1306
+ var defaultProps = type.defaultProps;
1307
+
1308
+ for (propName in defaultProps) {
1309
+ if (props[propName] === undefined) {
1310
+ props[propName] = defaultProps[propName];
1311
+ }
1312
+ }
1313
+ }
1314
+
1315
+ if (key || ref) {
1316
+ var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
1317
+
1318
+ if (key) {
1319
+ defineKeyPropWarningGetter(props, displayName);
1320
+ }
1321
+
1322
+ if (ref) {
1323
+ defineRefPropWarningGetter(props, displayName);
1324
+ }
1325
+ }
1326
+
1327
+ return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
1328
+ }
1329
+ }
1330
+
1331
+ var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
1332
+ var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
1333
+
1334
+ function setCurrentlyValidatingElement$1(element) {
1335
+ {
1336
+ if (element) {
1337
+ var owner = element._owner;
1338
+ var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
1339
+ ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
1340
+ } else {
1341
+ ReactDebugCurrentFrame$1.setExtraStackFrame(null);
1342
+ }
1343
+ }
1344
+ }
1345
+
1346
+ var propTypesMisspellWarningShown;
1347
+
1348
+ {
1349
+ propTypesMisspellWarningShown = false;
1350
+ }
1351
+ /**
1352
+ * Verifies the object is a ReactElement.
1353
+ * See https://reactjs.org/docs/react-api.html#isvalidelement
1354
+ * @param {?object} object
1355
+ * @return {boolean} True if `object` is a ReactElement.
1356
+ * @final
1357
+ */
1358
+
1359
+
1360
+ function isValidElement(object) {
1361
+ {
1362
+ return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
1363
+ }
1364
+ }
1365
+
1366
+ function getDeclarationErrorAddendum() {
1367
+ {
1368
+ if (ReactCurrentOwner$1.current) {
1369
+ var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
1370
+
1371
+ if (name) {
1372
+ return '\n\nCheck the render method of `' + name + '`.';
1373
+ }
1374
+ }
1375
+
1376
+ return '';
1377
+ }
1378
+ }
1379
+
1380
+ function getSourceInfoErrorAddendum(source) {
1381
+ {
1382
+
1383
+ return '';
1384
+ }
1385
+ }
1386
+ /**
1387
+ * Warn if there's no key explicitly set on dynamic arrays of children or
1388
+ * object keys are not valid. This allows us to keep track of children between
1389
+ * updates.
1390
+ */
1391
+
1392
+
1393
+ var ownerHasKeyUseWarning = {};
1394
+
1395
+ function getCurrentComponentErrorInfo(parentType) {
1396
+ {
1397
+ var info = getDeclarationErrorAddendum();
1398
+
1399
+ if (!info) {
1400
+ var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
1401
+
1402
+ if (parentName) {
1403
+ info = "\n\nCheck the top-level render call using <" + parentName + ">.";
1404
+ }
1405
+ }
1406
+
1407
+ return info;
1408
+ }
1409
+ }
1410
+ /**
1411
+ * Warn if the element doesn't have an explicit key assigned to it.
1412
+ * This element is in an array. The array could grow and shrink or be
1413
+ * reordered. All children that haven't already been validated are required to
1414
+ * have a "key" property assigned to it. Error statuses are cached so a warning
1415
+ * will only be shown once.
1416
+ *
1417
+ * @internal
1418
+ * @param {ReactElement} element Element that requires a key.
1419
+ * @param {*} parentType element's parent's type.
1420
+ */
1421
+
1422
+
1423
+ function validateExplicitKey(element, parentType) {
1424
+ {
1425
+ if (!element._store || element._store.validated || element.key != null) {
1426
+ return;
1427
+ }
1428
+
1429
+ element._store.validated = true;
1430
+ var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
1431
+
1432
+ if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
1433
+ return;
1434
+ }
1435
+
1436
+ ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
1437
+ // property, it may be the creator of the child that's responsible for
1438
+ // assigning it a key.
1439
+
1440
+ var childOwner = '';
1441
+
1442
+ if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
1443
+ // Give the component that originally created this child.
1444
+ childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
1445
+ }
1446
+
1447
+ setCurrentlyValidatingElement$1(element);
1448
+
1449
+ error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
1450
+
1451
+ setCurrentlyValidatingElement$1(null);
1452
+ }
1453
+ }
1454
+ /**
1455
+ * Ensure that every element either is passed in a static location, in an
1456
+ * array with an explicit keys property defined, or in an object literal
1457
+ * with valid key property.
1458
+ *
1459
+ * @internal
1460
+ * @param {ReactNode} node Statically passed child of any type.
1461
+ * @param {*} parentType node's parent's type.
1462
+ */
1463
+
1464
+
1465
+ function validateChildKeys(node, parentType) {
1466
+ {
1467
+ if (typeof node !== 'object') {
1468
+ return;
1469
+ }
1470
+
1471
+ if (isArray(node)) {
1472
+ for (var i = 0; i < node.length; i++) {
1473
+ var child = node[i];
1474
+
1475
+ if (isValidElement(child)) {
1476
+ validateExplicitKey(child, parentType);
1477
+ }
1478
+ }
1479
+ } else if (isValidElement(node)) {
1480
+ // This element was passed in a valid location.
1481
+ if (node._store) {
1482
+ node._store.validated = true;
1483
+ }
1484
+ } else if (node) {
1485
+ var iteratorFn = getIteratorFn(node);
1486
+
1487
+ if (typeof iteratorFn === 'function') {
1488
+ // Entry iterators used to provide implicit keys,
1489
+ // but now we print a separate warning for them later.
1490
+ if (iteratorFn !== node.entries) {
1491
+ var iterator = iteratorFn.call(node);
1492
+ var step;
1493
+
1494
+ while (!(step = iterator.next()).done) {
1495
+ if (isValidElement(step.value)) {
1496
+ validateExplicitKey(step.value, parentType);
1497
+ }
1498
+ }
1499
+ }
1500
+ }
1501
+ }
1502
+ }
1503
+ }
1504
+ /**
1505
+ * Given an element, validate that its props follow the propTypes definition,
1506
+ * provided by the type.
1507
+ *
1508
+ * @param {ReactElement} element
1509
+ */
1510
+
1511
+
1512
+ function validatePropTypes(element) {
1513
+ {
1514
+ var type = element.type;
1515
+
1516
+ if (type === null || type === undefined || typeof type === 'string') {
1517
+ return;
1518
+ }
1519
+
1520
+ var propTypes;
1521
+
1522
+ if (typeof type === 'function') {
1523
+ propTypes = type.propTypes;
1524
+ } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
1525
+ // Inner props are checked in the reconciler.
1526
+ type.$$typeof === REACT_MEMO_TYPE)) {
1527
+ propTypes = type.propTypes;
1528
+ } else {
1529
+ return;
1530
+ }
1531
+
1532
+ if (propTypes) {
1533
+ // Intentionally inside to avoid triggering lazy initializers:
1534
+ var name = getComponentNameFromType(type);
1535
+ checkPropTypes(propTypes, element.props, 'prop', name, element);
1536
+ } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
1537
+ propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
1538
+
1539
+ var _name = getComponentNameFromType(type);
1540
+
1541
+ error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
1542
+ }
1543
+
1544
+ if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
1545
+ error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
1546
+ }
1547
+ }
1548
+ }
1549
+ /**
1550
+ * Given a fragment, validate that it can only be provided with fragment props
1551
+ * @param {ReactElement} fragment
1552
+ */
1553
+
1554
+
1555
+ function validateFragmentProps(fragment) {
1556
+ {
1557
+ var keys = Object.keys(fragment.props);
1558
+
1559
+ for (var i = 0; i < keys.length; i++) {
1560
+ var key = keys[i];
1561
+
1562
+ if (key !== 'children' && key !== 'key') {
1563
+ setCurrentlyValidatingElement$1(fragment);
1564
+
1565
+ error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
1566
+
1567
+ setCurrentlyValidatingElement$1(null);
1568
+ break;
1569
+ }
1570
+ }
1571
+
1572
+ if (fragment.ref !== null) {
1573
+ setCurrentlyValidatingElement$1(fragment);
1574
+
1575
+ error('Invalid attribute `ref` supplied to `React.Fragment`.');
1576
+
1577
+ setCurrentlyValidatingElement$1(null);
1578
+ }
1579
+ }
1580
+ }
1581
+
1582
+ var didWarnAboutKeySpread = {};
1583
+ function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
1584
+ {
1585
+ var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
1586
+ // succeed and there will likely be errors in render.
1587
+
1588
+ if (!validType) {
1589
+ var info = '';
1590
+
1591
+ if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
1592
+ info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
1593
+ }
1594
+
1595
+ var sourceInfo = getSourceInfoErrorAddendum();
1596
+
1597
+ if (sourceInfo) {
1598
+ info += sourceInfo;
1599
+ } else {
1600
+ info += getDeclarationErrorAddendum();
1601
+ }
1602
+
1603
+ var typeString;
1604
+
1605
+ if (type === null) {
1606
+ typeString = 'null';
1607
+ } else if (isArray(type)) {
1608
+ typeString = 'array';
1609
+ } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
1610
+ typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
1611
+ info = ' Did you accidentally export a JSX literal instead of a component?';
1612
+ } else {
1613
+ typeString = typeof type;
1614
+ }
1615
+
1616
+ error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
1617
+ }
1618
+
1619
+ var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
1620
+ // TODO: Drop this when these are no longer allowed as the type argument.
1621
+
1622
+ if (element == null) {
1623
+ return element;
1624
+ } // Skip key warning if the type isn't valid since our key validation logic
1625
+ // doesn't expect a non-string/function type and can throw confusing errors.
1626
+ // We don't want exception behavior to differ between dev and prod.
1627
+ // (Rendering will throw with a helpful message and as soon as the type is
1628
+ // fixed, the key warnings will appear.)
1629
+
1630
+
1631
+ if (validType) {
1632
+ var children = props.children;
1633
+
1634
+ if (children !== undefined) {
1635
+ if (isStaticChildren) {
1636
+ if (isArray(children)) {
1637
+ for (var i = 0; i < children.length; i++) {
1638
+ validateChildKeys(children[i], type);
1639
+ }
1640
+
1641
+ if (Object.freeze) {
1642
+ Object.freeze(children);
1643
+ }
1644
+ } else {
1645
+ error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
1646
+ }
1647
+ } else {
1648
+ validateChildKeys(children, type);
1649
+ }
1650
+ }
1651
+ }
1652
+
1653
+ {
1654
+ if (hasOwnProperty.call(props, 'key')) {
1655
+ var componentName = getComponentNameFromType(type);
1656
+ var keys = Object.keys(props).filter(function (k) {
1657
+ return k !== 'key';
1658
+ });
1659
+ var beforeExample = keys.length > 0 ? '{key: someKey, ' + keys.join(': ..., ') + ': ...}' : '{key: someKey}';
1660
+
1661
+ if (!didWarnAboutKeySpread[componentName + beforeExample]) {
1662
+ var afterExample = keys.length > 0 ? '{' + keys.join(': ..., ') + ': ...}' : '{}';
1663
+
1664
+ error('A props object containing a "key" prop is being spread into JSX:\n' + ' let props = %s;\n' + ' <%s {...props} />\n' + 'React keys must be passed directly to JSX without using spread:\n' + ' let props = %s;\n' + ' <%s key={someKey} {...props} />', beforeExample, componentName, afterExample, componentName);
1665
+
1666
+ didWarnAboutKeySpread[componentName + beforeExample] = true;
1667
+ }
1668
+ }
1669
+ }
1670
+
1671
+ if (type === REACT_FRAGMENT_TYPE) {
1672
+ validateFragmentProps(element);
1673
+ } else {
1674
+ validatePropTypes(element);
1675
+ }
1676
+
1677
+ return element;
1678
+ }
1679
+ } // These two functions exist to still get child warnings in dev
1680
+ // even with the prod transform. This means that jsxDEV is purely
1681
+ // opt-in behavior for better messages but that we won't stop
1682
+ // giving you warnings if you use production apis.
1683
+
1684
+ function jsxWithValidationStatic(type, props, key) {
1685
+ {
1686
+ return jsxWithValidation(type, props, key, true);
1687
+ }
1688
+ }
1689
+ function jsxWithValidationDynamic(type, props, key) {
1690
+ {
1691
+ return jsxWithValidation(type, props, key, false);
1692
+ }
1693
+ }
1694
+
1695
+ var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.
1696
+ // for now we can ship identical prod functions
1697
+
1698
+ var jsxs = jsxWithValidationStatic ;
1699
+
1700
+ reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
1701
+ reactJsxRuntime_development.jsx = jsx;
1702
+ reactJsxRuntime_development.jsxs = jsxs;
1703
+ })();
1704
+ }
1705
+ return reactJsxRuntime_development;
1706
+ }
1707
+
1708
+ if (process.env.NODE_ENV === 'production') {
1709
+ jsxRuntime.exports = requireReactJsxRuntime_production_min();
1710
+ } else {
1711
+ jsxRuntime.exports = requireReactJsxRuntime_development();
1712
+ }
1713
+
1714
+ var jsxRuntimeExports = jsxRuntime.exports;
1715
+
1716
+ const SmoothSendAvaxContext = createContext(null);
1717
+ function SmoothSendAvaxProvider({ apiKey, network = 'testnet', smartAccountAddress, accountFactory, accountSalt, children, }) {
1718
+ const value = useMemo(() => ({
1719
+ apiKey,
1720
+ network,
1721
+ smartAccountAddress,
1722
+ accountFactory,
1723
+ accountSalt: accountSalt ?? 0n,
1724
+ }), [apiKey, network, smartAccountAddress, accountFactory, accountSalt]);
1725
+ return (jsxRuntimeExports.jsx(SmoothSendAvaxContext.Provider, { value: value, children: children }));
1726
+ }
1727
+ function useSmoothSendAvaxContext() {
1728
+ return useContext(SmoothSendAvaxContext);
1729
+ }
1730
+ function useSmoothSendAvax(params) {
1731
+ const ctx = useSmoothSendAvaxContext();
1732
+ const apiKey = params.apiKey ?? ctx?.apiKey;
1733
+ const network = params.network ?? ctx?.network ?? 'testnet';
1734
+ const smartAccountAddressProp = params.smartAccountAddress ?? ctx?.smartAccountAddress;
1735
+ const accountFactory = params.accountFactory ?? ctx?.accountFactory;
1736
+ const accountSalt = params.accountSalt ?? ctx?.accountSalt ?? 0n;
1737
+ if (!apiKey) {
1738
+ throw new Error('[SmoothSend AVAX] apiKey required — pass useSmoothSendAvax({ apiKey }) or wrap SmoothSendAvaxProvider');
1739
+ }
1740
+ if (!smartAccountAddressProp && !accountFactory) {
1741
+ throw new Error('[SmoothSend AVAX] Provide smartAccountAddress and/or accountFactory (SimpleAccountFactory)');
1742
+ }
1743
+ const submitter = useMemo(() => new SmoothSendAvaxSubmitter({ apiKey, network }), [apiKey, network]);
1744
+ const { publicClient, walletClient } = params;
1745
+ const submitCall = useCallback(async (call) => {
1746
+ if (!publicClient) {
1747
+ throw new Error('[SmoothSend AVAX] publicClient missing (wagmi usePublicClient)');
1748
+ }
1749
+ if (!walletClient) {
1750
+ throw new Error('[SmoothSend AVAX] walletClient missing (wagmi useWalletClient)');
1751
+ }
1752
+ const account = walletClient.account;
1753
+ if (!account) {
1754
+ throw new Error('[SmoothSend AVAX] walletClient.account missing — connect wallet (wagmi useWalletClient)');
1755
+ }
1756
+ const ownerAddress = account.address;
1757
+ const chainId = Number(publicClient.chain?.id ?? (await publicClient.getChainId()));
1758
+ const entryPoint = (await submitter.getSupportedEntryPoints())[0];
1759
+ let sender;
1760
+ if (accountFactory) {
1761
+ const predicted = await predictSimpleAccountAddress({
1762
+ publicClient,
1763
+ factory: accountFactory,
1764
+ owner: ownerAddress,
1765
+ salt: accountSalt,
1766
+ });
1767
+ if (smartAccountAddressProp &&
1768
+ predicted.toLowerCase() !== smartAccountAddressProp.toLowerCase()) {
1769
+ throw new Error(`[SmoothSend AVAX] smartAccountAddress ${smartAccountAddressProp} does not match factory prediction ${predicted}`);
1770
+ }
1771
+ sender = predicted;
1772
+ }
1773
+ else {
1774
+ sender = smartAccountAddressProp;
1775
+ }
1776
+ const code = await publicClient.getBytecode({ address: sender });
1777
+ const deployed = typeof code === 'string' &&
1778
+ code !== '0x' &&
1779
+ code.length > 2;
1780
+ let nonce;
1781
+ let factory;
1782
+ let factoryData;
1783
+ if (!deployed) {
1784
+ if (!accountFactory) {
1785
+ throw new Error('[SmoothSend AVAX] No bytecode at sender — pass accountFactory so the paymaster can sponsor deploy + call in one UserOp');
1786
+ }
1787
+ nonce = 0n;
1788
+ factory = accountFactory;
1789
+ factoryData = encodeCreateAccountFactoryData(ownerAddress, accountSalt);
1790
+ }
1791
+ else {
1792
+ nonce = await readAvaxSenderNonce({
1793
+ publicClient,
1794
+ entryPointAddress: entryPoint,
1795
+ sender,
1796
+ });
1797
+ }
1798
+ let maxFeePerGas = 50n * 10n ** 9n;
1799
+ let maxPriorityFeePerGas = 2n * 10n ** 9n;
1800
+ try {
1801
+ const est = await publicClient.estimateFeesPerGas();
1802
+ if (est.maxFeePerGas)
1803
+ maxFeePerGas = est.maxFeePerGas;
1804
+ if (est.maxPriorityFeePerGas) {
1805
+ maxPriorityFeePerGas = est.maxPriorityFeePerGas;
1806
+ }
1807
+ }
1808
+ catch {
1809
+ /* chain may not support EIP-1559 estimation */
1810
+ }
1811
+ const callData = encodeAvaxExecuteCalldata(call.to, call.value ?? 0n, call.data ?? '0x');
1812
+ return submitter.submitSponsoredUserOperation({
1813
+ userOp: {
1814
+ sender,
1815
+ nonce: toHex(nonce),
1816
+ callData,
1817
+ maxFeePerGas: toHex(maxFeePerGas),
1818
+ maxPriorityFeePerGas: toHex(maxPriorityFeePerGas),
1819
+ ...(factory && factoryData ? { factory, factoryData } : {}),
1820
+ },
1821
+ mode: call.mode ?? 'developer-sponsored',
1822
+ paymaster: call.paymaster,
1823
+ waitForReceipt: call.waitForReceipt,
1824
+ signUserOp: async (op) => {
1825
+ const hash = hashUserOperationAvax({
1826
+ chainId,
1827
+ entryPointAddress: entryPoint,
1828
+ userOperation: op,
1829
+ });
1830
+ return walletClient.signMessage({
1831
+ account,
1832
+ message: { raw: hash },
1833
+ });
1834
+ },
1835
+ });
1836
+ }, [
1837
+ accountFactory,
1838
+ accountSalt,
1839
+ publicClient,
1840
+ smartAccountAddressProp,
1841
+ submitter,
1842
+ walletClient,
1843
+ ]);
1844
+ return { submitter, submitCall };
1845
+ }
1846
+
1847
+ export { AvaxSubmitter as A, ENTRY_POINT_V07_ADDRESS as E, SmoothSendAvaxSubmitter as S, SmoothSendAvaxProvider as a, useSmoothSendAvaxContext as b, createSmoothSendAvaxSubmitter as c, userOperationAvaxToViem as d, encodeAvaxExecuteCalldata as e, avaxExecuteAbi as f, SIMPLE_ACCOUNT_FACTORY_ABI as g, hashUserOperationAvax as h, encodeCreateAccountFactoryData as i, fetchAvaxAaPublicDefaults as j, predictSimpleAccountAddress as p, readAvaxSenderNonce as r, useSmoothSendAvax as u };
1848
+ //# sourceMappingURL=useSmoothSendAvax-ZuHw1aYi.js.map