@smoothsend/sdk 2.2.3 → 2.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -4,11 +4,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var axios = require('axios');
6
6
  var tsSdk = require('@aptos-labs/ts-sdk');
7
- var require$$0 = require('react');
7
+ var react = require('react');
8
8
  var walletAdapterReact = require('@aptos-labs/wallet-adapter-react');
9
9
  var viem = require('viem');
10
10
  var accountAbstraction = require('viem/account-abstraction');
11
11
  var actions = require('viem/actions');
12
+ var jsxRuntime = require('react/jsx-runtime');
12
13
 
13
14
  /**
14
15
  * Error handling system for SmoothSend SDK v2
@@ -2545,15 +2546,15 @@ function useSmoothSend(submitter) {
2545
2546
  const { account, signTransaction, signAndSubmitTransaction: walletSignAndSubmit, } = walletAdapterReact.useWallet();
2546
2547
  // Track session state reactively so UI updates when session is created/expires
2547
2548
  const initialHasSession = submitter?.hasSession?.() ?? false;
2548
- const [hasSessionState, setHasSessionState] = require$$0.useState(initialHasSession);
2549
+ const [hasSessionState, setHasSessionState] = react.useState(initialHasSession);
2549
2550
  // Prefetch the sponsored-functions list on mount so the first transaction
2550
2551
  // benefits from an already-populated cache with no added latency.
2551
- require$$0.useEffect(() => {
2552
+ react.useEffect(() => {
2552
2553
  submitter.getSponsoredFunctions().catch(() => {
2553
2554
  // Fail-open: getSponsoredFunctions already handles errors internally
2554
2555
  });
2555
2556
  }, [submitter]);
2556
- require$$0.useEffect(() => {
2557
+ react.useEffect(() => {
2557
2558
  if (!submitter)
2558
2559
  return;
2559
2560
  const refresh = () => {
@@ -2564,7 +2565,7 @@ function useSmoothSend(submitter) {
2564
2565
  const timer = setInterval(refresh, 1000);
2565
2566
  return () => clearInterval(timer);
2566
2567
  }, [submitter]);
2567
- const signAndSubmitTransaction = require$$0.useCallback(async (input) => {
2568
+ const signAndSubmitTransaction = react.useCallback(async (input) => {
2568
2569
  if (!account?.address) {
2569
2570
  throw new Error('[SmoothSend] Wallet not connected');
2570
2571
  }
@@ -3047,1374 +3048,19 @@ async function fetchAvaxAaPublicDefaults(gatewayUrl = 'https://proxy.smoothsend.
3047
3048
  };
3048
3049
  }
3049
3050
 
3050
- var jsxRuntime = {exports: {}};
3051
-
3052
- var reactJsxRuntime_production_min = {};
3053
-
3054
- /**
3055
- * @license React
3056
- * react-jsx-runtime.production.min.js
3057
- *
3058
- * Copyright (c) Facebook, Inc. and its affiliates.
3059
- *
3060
- * This source code is licensed under the MIT license found in the
3061
- * LICENSE file in the root directory of this source tree.
3062
- */
3063
-
3064
- var hasRequiredReactJsxRuntime_production_min;
3065
-
3066
- function requireReactJsxRuntime_production_min () {
3067
- if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
3068
- hasRequiredReactJsxRuntime_production_min = 1;
3069
- 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};
3070
- 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;
3071
- return reactJsxRuntime_production_min;
3072
- }
3073
-
3074
- var reactJsxRuntime_development = {};
3075
-
3076
- /**
3077
- * @license React
3078
- * react-jsx-runtime.development.js
3079
- *
3080
- * Copyright (c) Facebook, Inc. and its affiliates.
3081
- *
3082
- * This source code is licensed under the MIT license found in the
3083
- * LICENSE file in the root directory of this source tree.
3084
- */
3085
-
3086
- var hasRequiredReactJsxRuntime_development;
3087
-
3088
- function requireReactJsxRuntime_development () {
3089
- if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
3090
- hasRequiredReactJsxRuntime_development = 1;
3091
-
3092
- if (process.env.NODE_ENV !== "production") {
3093
- (function() {
3094
-
3095
- var React = require$$0;
3096
-
3097
- // ATTENTION
3098
- // When adding new symbols to this file,
3099
- // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
3100
- // The Symbol used to tag the ReactElement-like types.
3101
- var REACT_ELEMENT_TYPE = Symbol.for('react.element');
3102
- var REACT_PORTAL_TYPE = Symbol.for('react.portal');
3103
- var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
3104
- var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
3105
- var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
3106
- var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
3107
- var REACT_CONTEXT_TYPE = Symbol.for('react.context');
3108
- var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
3109
- var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
3110
- var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
3111
- var REACT_MEMO_TYPE = Symbol.for('react.memo');
3112
- var REACT_LAZY_TYPE = Symbol.for('react.lazy');
3113
- var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
3114
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
3115
- var FAUX_ITERATOR_SYMBOL = '@@iterator';
3116
- function getIteratorFn(maybeIterable) {
3117
- if (maybeIterable === null || typeof maybeIterable !== 'object') {
3118
- return null;
3119
- }
3120
-
3121
- var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
3122
-
3123
- if (typeof maybeIterator === 'function') {
3124
- return maybeIterator;
3125
- }
3126
-
3127
- return null;
3128
- }
3129
-
3130
- var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
3131
-
3132
- function error(format) {
3133
- {
3134
- {
3135
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
3136
- args[_key2 - 1] = arguments[_key2];
3137
- }
3138
-
3139
- printWarning('error', format, args);
3140
- }
3141
- }
3142
- }
3143
-
3144
- function printWarning(level, format, args) {
3145
- // When changing this logic, you might want to also
3146
- // update consoleWithStackDev.www.js as well.
3147
- {
3148
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
3149
- var stack = ReactDebugCurrentFrame.getStackAddendum();
3150
-
3151
- if (stack !== '') {
3152
- format += '%s';
3153
- args = args.concat([stack]);
3154
- } // eslint-disable-next-line react-internal/safe-string-coercion
3155
-
3156
-
3157
- var argsWithFormat = args.map(function (item) {
3158
- return String(item);
3159
- }); // Careful: RN currently depends on this prefix
3160
-
3161
- argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
3162
- // breaks IE9: https://github.com/facebook/react/issues/13610
3163
- // eslint-disable-next-line react-internal/no-production-logging
3164
-
3165
- Function.prototype.apply.call(console[level], console, argsWithFormat);
3166
- }
3167
- }
3168
-
3169
- // -----------------------------------------------------------------------------
3170
-
3171
- var enableScopeAPI = false; // Experimental Create Event Handle API.
3172
- var enableCacheElement = false;
3173
- var enableTransitionTracing = false; // No known bugs, but needs performance testing
3174
-
3175
- var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
3176
- // stuff. Intended to enable React core members to more easily debug scheduling
3177
- // issues in DEV builds.
3178
-
3179
- var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
3180
-
3181
- var REACT_MODULE_REFERENCE;
3182
-
3183
- {
3184
- REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
3185
- }
3186
-
3187
- function isValidElementType(type) {
3188
- if (typeof type === 'string' || typeof type === 'function') {
3189
- return true;
3190
- } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
3191
-
3192
-
3193
- 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 ) {
3194
- return true;
3195
- }
3196
-
3197
- if (typeof type === 'object' && type !== null) {
3198
- 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
3199
- // types supported by any Flight configuration anywhere since
3200
- // we don't know which Flight build this will end up being used
3201
- // with.
3202
- type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
3203
- return true;
3204
- }
3205
- }
3206
-
3207
- return false;
3208
- }
3209
-
3210
- function getWrappedName(outerType, innerType, wrapperName) {
3211
- var displayName = outerType.displayName;
3212
-
3213
- if (displayName) {
3214
- return displayName;
3215
- }
3216
-
3217
- var functionName = innerType.displayName || innerType.name || '';
3218
- return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
3219
- } // Keep in sync with react-reconciler/getComponentNameFromFiber
3220
-
3221
-
3222
- function getContextName(type) {
3223
- return type.displayName || 'Context';
3224
- } // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
3225
-
3226
-
3227
- function getComponentNameFromType(type) {
3228
- if (type == null) {
3229
- // Host root, text node or just invalid type.
3230
- return null;
3231
- }
3232
-
3233
- {
3234
- if (typeof type.tag === 'number') {
3235
- error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
3236
- }
3237
- }
3238
-
3239
- if (typeof type === 'function') {
3240
- return type.displayName || type.name || null;
3241
- }
3242
-
3243
- if (typeof type === 'string') {
3244
- return type;
3245
- }
3246
-
3247
- switch (type) {
3248
- case REACT_FRAGMENT_TYPE:
3249
- return 'Fragment';
3250
-
3251
- case REACT_PORTAL_TYPE:
3252
- return 'Portal';
3253
-
3254
- case REACT_PROFILER_TYPE:
3255
- return 'Profiler';
3256
-
3257
- case REACT_STRICT_MODE_TYPE:
3258
- return 'StrictMode';
3259
-
3260
- case REACT_SUSPENSE_TYPE:
3261
- return 'Suspense';
3262
-
3263
- case REACT_SUSPENSE_LIST_TYPE:
3264
- return 'SuspenseList';
3265
-
3266
- }
3267
-
3268
- if (typeof type === 'object') {
3269
- switch (type.$$typeof) {
3270
- case REACT_CONTEXT_TYPE:
3271
- var context = type;
3272
- return getContextName(context) + '.Consumer';
3273
-
3274
- case REACT_PROVIDER_TYPE:
3275
- var provider = type;
3276
- return getContextName(provider._context) + '.Provider';
3277
-
3278
- case REACT_FORWARD_REF_TYPE:
3279
- return getWrappedName(type, type.render, 'ForwardRef');
3280
-
3281
- case REACT_MEMO_TYPE:
3282
- var outerName = type.displayName || null;
3283
-
3284
- if (outerName !== null) {
3285
- return outerName;
3286
- }
3287
-
3288
- return getComponentNameFromType(type.type) || 'Memo';
3289
-
3290
- case REACT_LAZY_TYPE:
3291
- {
3292
- var lazyComponent = type;
3293
- var payload = lazyComponent._payload;
3294
- var init = lazyComponent._init;
3295
-
3296
- try {
3297
- return getComponentNameFromType(init(payload));
3298
- } catch (x) {
3299
- return null;
3300
- }
3301
- }
3302
-
3303
- // eslint-disable-next-line no-fallthrough
3304
- }
3305
- }
3306
-
3307
- return null;
3308
- }
3309
-
3310
- var assign = Object.assign;
3311
-
3312
- // Helpers to patch console.logs to avoid logging during side-effect free
3313
- // replaying on render function. This currently only patches the object
3314
- // lazily which won't cover if the log function was extracted eagerly.
3315
- // We could also eagerly patch the method.
3316
- var disabledDepth = 0;
3317
- var prevLog;
3318
- var prevInfo;
3319
- var prevWarn;
3320
- var prevError;
3321
- var prevGroup;
3322
- var prevGroupCollapsed;
3323
- var prevGroupEnd;
3324
-
3325
- function disabledLog() {}
3326
-
3327
- disabledLog.__reactDisabledLog = true;
3328
- function disableLogs() {
3329
- {
3330
- if (disabledDepth === 0) {
3331
- /* eslint-disable react-internal/no-production-logging */
3332
- prevLog = console.log;
3333
- prevInfo = console.info;
3334
- prevWarn = console.warn;
3335
- prevError = console.error;
3336
- prevGroup = console.group;
3337
- prevGroupCollapsed = console.groupCollapsed;
3338
- prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
3339
-
3340
- var props = {
3341
- configurable: true,
3342
- enumerable: true,
3343
- value: disabledLog,
3344
- writable: true
3345
- }; // $FlowFixMe Flow thinks console is immutable.
3346
-
3347
- Object.defineProperties(console, {
3348
- info: props,
3349
- log: props,
3350
- warn: props,
3351
- error: props,
3352
- group: props,
3353
- groupCollapsed: props,
3354
- groupEnd: props
3355
- });
3356
- /* eslint-enable react-internal/no-production-logging */
3357
- }
3358
-
3359
- disabledDepth++;
3360
- }
3361
- }
3362
- function reenableLogs() {
3363
- {
3364
- disabledDepth--;
3365
-
3366
- if (disabledDepth === 0) {
3367
- /* eslint-disable react-internal/no-production-logging */
3368
- var props = {
3369
- configurable: true,
3370
- enumerable: true,
3371
- writable: true
3372
- }; // $FlowFixMe Flow thinks console is immutable.
3373
-
3374
- Object.defineProperties(console, {
3375
- log: assign({}, props, {
3376
- value: prevLog
3377
- }),
3378
- info: assign({}, props, {
3379
- value: prevInfo
3380
- }),
3381
- warn: assign({}, props, {
3382
- value: prevWarn
3383
- }),
3384
- error: assign({}, props, {
3385
- value: prevError
3386
- }),
3387
- group: assign({}, props, {
3388
- value: prevGroup
3389
- }),
3390
- groupCollapsed: assign({}, props, {
3391
- value: prevGroupCollapsed
3392
- }),
3393
- groupEnd: assign({}, props, {
3394
- value: prevGroupEnd
3395
- })
3396
- });
3397
- /* eslint-enable react-internal/no-production-logging */
3398
- }
3399
-
3400
- if (disabledDepth < 0) {
3401
- error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
3402
- }
3403
- }
3404
- }
3405
-
3406
- var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
3407
- var prefix;
3408
- function describeBuiltInComponentFrame(name, source, ownerFn) {
3409
- {
3410
- if (prefix === undefined) {
3411
- // Extract the VM specific prefix used by each line.
3412
- try {
3413
- throw Error();
3414
- } catch (x) {
3415
- var match = x.stack.trim().match(/\n( *(at )?)/);
3416
- prefix = match && match[1] || '';
3417
- }
3418
- } // We use the prefix to ensure our stacks line up with native stack frames.
3419
-
3420
-
3421
- return '\n' + prefix + name;
3422
- }
3423
- }
3424
- var reentry = false;
3425
- var componentFrameCache;
3426
-
3427
- {
3428
- var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
3429
- componentFrameCache = new PossiblyWeakMap();
3430
- }
3431
-
3432
- function describeNativeComponentFrame(fn, construct) {
3433
- // If something asked for a stack inside a fake render, it should get ignored.
3434
- if ( !fn || reentry) {
3435
- return '';
3436
- }
3437
-
3438
- {
3439
- var frame = componentFrameCache.get(fn);
3440
-
3441
- if (frame !== undefined) {
3442
- return frame;
3443
- }
3444
- }
3445
-
3446
- var control;
3447
- reentry = true;
3448
- var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
3449
-
3450
- Error.prepareStackTrace = undefined;
3451
- var previousDispatcher;
3452
-
3453
- {
3454
- previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function
3455
- // for warnings.
3456
-
3457
- ReactCurrentDispatcher.current = null;
3458
- disableLogs();
3459
- }
3460
-
3461
- try {
3462
- // This should throw.
3463
- if (construct) {
3464
- // Something should be setting the props in the constructor.
3465
- var Fake = function () {
3466
- throw Error();
3467
- }; // $FlowFixMe
3468
-
3469
-
3470
- Object.defineProperty(Fake.prototype, 'props', {
3471
- set: function () {
3472
- // We use a throwing setter instead of frozen or non-writable props
3473
- // because that won't throw in a non-strict mode function.
3474
- throw Error();
3475
- }
3476
- });
3477
-
3478
- if (typeof Reflect === 'object' && Reflect.construct) {
3479
- // We construct a different control for this case to include any extra
3480
- // frames added by the construct call.
3481
- try {
3482
- Reflect.construct(Fake, []);
3483
- } catch (x) {
3484
- control = x;
3485
- }
3486
-
3487
- Reflect.construct(fn, [], Fake);
3488
- } else {
3489
- try {
3490
- Fake.call();
3491
- } catch (x) {
3492
- control = x;
3493
- }
3494
-
3495
- fn.call(Fake.prototype);
3496
- }
3497
- } else {
3498
- try {
3499
- throw Error();
3500
- } catch (x) {
3501
- control = x;
3502
- }
3503
-
3504
- fn();
3505
- }
3506
- } catch (sample) {
3507
- // This is inlined manually because closure doesn't do it for us.
3508
- if (sample && control && typeof sample.stack === 'string') {
3509
- // This extracts the first frame from the sample that isn't also in the control.
3510
- // Skipping one frame that we assume is the frame that calls the two.
3511
- var sampleLines = sample.stack.split('\n');
3512
- var controlLines = control.stack.split('\n');
3513
- var s = sampleLines.length - 1;
3514
- var c = controlLines.length - 1;
3515
-
3516
- while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
3517
- // We expect at least one stack frame to be shared.
3518
- // Typically this will be the root most one. However, stack frames may be
3519
- // cut off due to maximum stack limits. In this case, one maybe cut off
3520
- // earlier than the other. We assume that the sample is longer or the same
3521
- // and there for cut off earlier. So we should find the root most frame in
3522
- // the sample somewhere in the control.
3523
- c--;
3524
- }
3525
-
3526
- for (; s >= 1 && c >= 0; s--, c--) {
3527
- // Next we find the first one that isn't the same which should be the
3528
- // frame that called our sample function and the control.
3529
- if (sampleLines[s] !== controlLines[c]) {
3530
- // In V8, the first line is describing the message but other VMs don't.
3531
- // If we're about to return the first line, and the control is also on the same
3532
- // line, that's a pretty good indicator that our sample threw at same line as
3533
- // the control. I.e. before we entered the sample frame. So we ignore this result.
3534
- // This can happen if you passed a class to function component, or non-function.
3535
- if (s !== 1 || c !== 1) {
3536
- do {
3537
- s--;
3538
- c--; // We may still have similar intermediate frames from the construct call.
3539
- // The next one that isn't the same should be our match though.
3540
-
3541
- if (c < 0 || sampleLines[s] !== controlLines[c]) {
3542
- // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
3543
- var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
3544
- // but we have a user-provided "displayName"
3545
- // splice it in to make the stack more readable.
3546
-
3547
-
3548
- if (fn.displayName && _frame.includes('<anonymous>')) {
3549
- _frame = _frame.replace('<anonymous>', fn.displayName);
3550
- }
3551
-
3552
- {
3553
- if (typeof fn === 'function') {
3554
- componentFrameCache.set(fn, _frame);
3555
- }
3556
- } // Return the line we found.
3557
-
3558
-
3559
- return _frame;
3560
- }
3561
- } while (s >= 1 && c >= 0);
3562
- }
3563
-
3564
- break;
3565
- }
3566
- }
3567
- }
3568
- } finally {
3569
- reentry = false;
3570
-
3571
- {
3572
- ReactCurrentDispatcher.current = previousDispatcher;
3573
- reenableLogs();
3574
- }
3575
-
3576
- Error.prepareStackTrace = previousPrepareStackTrace;
3577
- } // Fallback to just using the name if we couldn't make it throw.
3578
-
3579
-
3580
- var name = fn ? fn.displayName || fn.name : '';
3581
- var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
3582
-
3583
- {
3584
- if (typeof fn === 'function') {
3585
- componentFrameCache.set(fn, syntheticFrame);
3586
- }
3587
- }
3588
-
3589
- return syntheticFrame;
3590
- }
3591
- function describeFunctionComponentFrame(fn, source, ownerFn) {
3592
- {
3593
- return describeNativeComponentFrame(fn, false);
3594
- }
3595
- }
3596
-
3597
- function shouldConstruct(Component) {
3598
- var prototype = Component.prototype;
3599
- return !!(prototype && prototype.isReactComponent);
3600
- }
3601
-
3602
- function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
3603
-
3604
- if (type == null) {
3605
- return '';
3606
- }
3607
-
3608
- if (typeof type === 'function') {
3609
- {
3610
- return describeNativeComponentFrame(type, shouldConstruct(type));
3611
- }
3612
- }
3613
-
3614
- if (typeof type === 'string') {
3615
- return describeBuiltInComponentFrame(type);
3616
- }
3617
-
3618
- switch (type) {
3619
- case REACT_SUSPENSE_TYPE:
3620
- return describeBuiltInComponentFrame('Suspense');
3621
-
3622
- case REACT_SUSPENSE_LIST_TYPE:
3623
- return describeBuiltInComponentFrame('SuspenseList');
3624
- }
3625
-
3626
- if (typeof type === 'object') {
3627
- switch (type.$$typeof) {
3628
- case REACT_FORWARD_REF_TYPE:
3629
- return describeFunctionComponentFrame(type.render);
3630
-
3631
- case REACT_MEMO_TYPE:
3632
- // Memo may contain any component type so we recursively resolve it.
3633
- return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
3634
-
3635
- case REACT_LAZY_TYPE:
3636
- {
3637
- var lazyComponent = type;
3638
- var payload = lazyComponent._payload;
3639
- var init = lazyComponent._init;
3640
-
3641
- try {
3642
- // Lazy may contain any component type so we recursively resolve it.
3643
- return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
3644
- } catch (x) {}
3645
- }
3646
- }
3647
- }
3648
-
3649
- return '';
3650
- }
3651
-
3652
- var hasOwnProperty = Object.prototype.hasOwnProperty;
3653
-
3654
- var loggedTypeFailures = {};
3655
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
3656
-
3657
- function setCurrentlyValidatingElement(element) {
3658
- {
3659
- if (element) {
3660
- var owner = element._owner;
3661
- var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
3662
- ReactDebugCurrentFrame.setExtraStackFrame(stack);
3663
- } else {
3664
- ReactDebugCurrentFrame.setExtraStackFrame(null);
3665
- }
3666
- }
3667
- }
3668
-
3669
- function checkPropTypes(typeSpecs, values, location, componentName, element) {
3670
- {
3671
- // $FlowFixMe This is okay but Flow doesn't know it.
3672
- var has = Function.call.bind(hasOwnProperty);
3673
-
3674
- for (var typeSpecName in typeSpecs) {
3675
- if (has(typeSpecs, typeSpecName)) {
3676
- var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
3677
- // fail the render phase where it didn't fail before. So we log it.
3678
- // After these have been cleaned up, we'll let them throw.
3679
-
3680
- try {
3681
- // This is intentionally an invariant that gets caught. It's the same
3682
- // behavior as without this statement except with a better message.
3683
- if (typeof typeSpecs[typeSpecName] !== 'function') {
3684
- // eslint-disable-next-line react-internal/prod-error-codes
3685
- 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`.');
3686
- err.name = 'Invariant Violation';
3687
- throw err;
3688
- }
3689
-
3690
- error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
3691
- } catch (ex) {
3692
- error$1 = ex;
3693
- }
3694
-
3695
- if (error$1 && !(error$1 instanceof Error)) {
3696
- setCurrentlyValidatingElement(element);
3697
-
3698
- 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);
3699
-
3700
- setCurrentlyValidatingElement(null);
3701
- }
3702
-
3703
- if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
3704
- // Only monitor this failure once because there tends to be a lot of the
3705
- // same error.
3706
- loggedTypeFailures[error$1.message] = true;
3707
- setCurrentlyValidatingElement(element);
3708
-
3709
- error('Failed %s type: %s', location, error$1.message);
3710
-
3711
- setCurrentlyValidatingElement(null);
3712
- }
3713
- }
3714
- }
3715
- }
3716
- }
3717
-
3718
- var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
3719
-
3720
- function isArray(a) {
3721
- return isArrayImpl(a);
3722
- }
3723
-
3724
- /*
3725
- * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
3726
- * and Temporal.* types. See https://github.com/facebook/react/pull/22064.
3727
- *
3728
- * The functions in this module will throw an easier-to-understand,
3729
- * easier-to-debug exception with a clear errors message message explaining the
3730
- * problem. (Instead of a confusing exception thrown inside the implementation
3731
- * of the `value` object).
3732
- */
3733
- // $FlowFixMe only called in DEV, so void return is not possible.
3734
- function typeName(value) {
3735
- {
3736
- // toStringTag is needed for namespaced types like Temporal.Instant
3737
- var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
3738
- var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
3739
- return type;
3740
- }
3741
- } // $FlowFixMe only called in DEV, so void return is not possible.
3742
-
3743
-
3744
- function willCoercionThrow(value) {
3745
- {
3746
- try {
3747
- testStringCoercion(value);
3748
- return false;
3749
- } catch (e) {
3750
- return true;
3751
- }
3752
- }
3753
- }
3754
-
3755
- function testStringCoercion(value) {
3756
- // If you ended up here by following an exception call stack, here's what's
3757
- // happened: you supplied an object or symbol value to React (as a prop, key,
3758
- // DOM attribute, CSS property, string ref, etc.) and when React tried to
3759
- // coerce it to a string using `'' + value`, an exception was thrown.
3760
- //
3761
- // The most common types that will cause this exception are `Symbol` instances
3762
- // and Temporal objects like `Temporal.Instant`. But any object that has a
3763
- // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
3764
- // exception. (Library authors do this to prevent users from using built-in
3765
- // numeric operators like `+` or comparison operators like `>=` because custom
3766
- // methods are needed to perform accurate arithmetic or comparison.)
3767
- //
3768
- // To fix the problem, coerce this object or symbol value to a string before
3769
- // passing it to React. The most reliable way is usually `String(value)`.
3770
- //
3771
- // To find which value is throwing, check the browser or debugger console.
3772
- // Before this exception was thrown, there should be `console.error` output
3773
- // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
3774
- // problem and how that type was used: key, atrribute, input value prop, etc.
3775
- // In most cases, this console output also shows the component and its
3776
- // ancestor components where the exception happened.
3777
- //
3778
- // eslint-disable-next-line react-internal/safe-string-coercion
3779
- return '' + value;
3780
- }
3781
- function checkKeyStringCoercion(value) {
3782
- {
3783
- if (willCoercionThrow(value)) {
3784
- error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
3785
-
3786
- return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
3787
- }
3788
- }
3789
- }
3790
-
3791
- var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
3792
- var RESERVED_PROPS = {
3793
- key: true,
3794
- ref: true,
3795
- __self: true,
3796
- __source: true
3797
- };
3798
- var specialPropKeyWarningShown;
3799
- var specialPropRefWarningShown;
3800
-
3801
- function hasValidRef(config) {
3802
- {
3803
- if (hasOwnProperty.call(config, 'ref')) {
3804
- var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
3805
-
3806
- if (getter && getter.isReactWarning) {
3807
- return false;
3808
- }
3809
- }
3810
- }
3811
-
3812
- return config.ref !== undefined;
3813
- }
3814
-
3815
- function hasValidKey(config) {
3816
- {
3817
- if (hasOwnProperty.call(config, 'key')) {
3818
- var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
3819
-
3820
- if (getter && getter.isReactWarning) {
3821
- return false;
3822
- }
3823
- }
3824
- }
3825
-
3826
- return config.key !== undefined;
3827
- }
3828
-
3829
- function warnIfStringRefCannotBeAutoConverted(config, self) {
3830
- {
3831
- if (typeof config.ref === 'string' && ReactCurrentOwner.current && self) ;
3832
- }
3833
- }
3834
-
3835
- function defineKeyPropWarningGetter(props, displayName) {
3836
- {
3837
- var warnAboutAccessingKey = function () {
3838
- if (!specialPropKeyWarningShown) {
3839
- specialPropKeyWarningShown = true;
3840
-
3841
- 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);
3842
- }
3843
- };
3844
-
3845
- warnAboutAccessingKey.isReactWarning = true;
3846
- Object.defineProperty(props, 'key', {
3847
- get: warnAboutAccessingKey,
3848
- configurable: true
3849
- });
3850
- }
3851
- }
3852
-
3853
- function defineRefPropWarningGetter(props, displayName) {
3854
- {
3855
- var warnAboutAccessingRef = function () {
3856
- if (!specialPropRefWarningShown) {
3857
- specialPropRefWarningShown = true;
3858
-
3859
- 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);
3860
- }
3861
- };
3862
-
3863
- warnAboutAccessingRef.isReactWarning = true;
3864
- Object.defineProperty(props, 'ref', {
3865
- get: warnAboutAccessingRef,
3866
- configurable: true
3867
- });
3868
- }
3869
- }
3870
- /**
3871
- * Factory method to create a new React element. This no longer adheres to
3872
- * the class pattern, so do not use new to call it. Also, instanceof check
3873
- * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
3874
- * if something is a React Element.
3875
- *
3876
- * @param {*} type
3877
- * @param {*} props
3878
- * @param {*} key
3879
- * @param {string|object} ref
3880
- * @param {*} owner
3881
- * @param {*} self A *temporary* helper to detect places where `this` is
3882
- * different from the `owner` when React.createElement is called, so that we
3883
- * can warn. We want to get rid of owner and replace string `ref`s with arrow
3884
- * functions, and as long as `this` and owner are the same, there will be no
3885
- * change in behavior.
3886
- * @param {*} source An annotation object (added by a transpiler or otherwise)
3887
- * indicating filename, line number, and/or other information.
3888
- * @internal
3889
- */
3890
-
3891
-
3892
- var ReactElement = function (type, key, ref, self, source, owner, props) {
3893
- var element = {
3894
- // This tag allows us to uniquely identify this as a React Element
3895
- $$typeof: REACT_ELEMENT_TYPE,
3896
- // Built-in properties that belong on the element
3897
- type: type,
3898
- key: key,
3899
- ref: ref,
3900
- props: props,
3901
- // Record the component responsible for creating this element.
3902
- _owner: owner
3903
- };
3904
-
3905
- {
3906
- // The validation flag is currently mutative. We put it on
3907
- // an external backing store so that we can freeze the whole object.
3908
- // This can be replaced with a WeakMap once they are implemented in
3909
- // commonly used development environments.
3910
- element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
3911
- // the validation flag non-enumerable (where possible, which should
3912
- // include every environment we run tests in), so the test framework
3913
- // ignores it.
3914
-
3915
- Object.defineProperty(element._store, 'validated', {
3916
- configurable: false,
3917
- enumerable: false,
3918
- writable: true,
3919
- value: false
3920
- }); // self and source are DEV only properties.
3921
-
3922
- Object.defineProperty(element, '_self', {
3923
- configurable: false,
3924
- enumerable: false,
3925
- writable: false,
3926
- value: self
3927
- }); // Two elements created in two different places should be considered
3928
- // equal for testing purposes and therefore we hide it from enumeration.
3929
-
3930
- Object.defineProperty(element, '_source', {
3931
- configurable: false,
3932
- enumerable: false,
3933
- writable: false,
3934
- value: source
3935
- });
3936
-
3937
- if (Object.freeze) {
3938
- Object.freeze(element.props);
3939
- Object.freeze(element);
3940
- }
3941
- }
3942
-
3943
- return element;
3944
- };
3945
- /**
3946
- * https://github.com/reactjs/rfcs/pull/107
3947
- * @param {*} type
3948
- * @param {object} props
3949
- * @param {string} key
3950
- */
3951
-
3952
- function jsxDEV(type, config, maybeKey, source, self) {
3953
- {
3954
- var propName; // Reserved names are extracted
3955
-
3956
- var props = {};
3957
- var key = null;
3958
- var ref = null; // Currently, key can be spread in as a prop. This causes a potential
3959
- // issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
3960
- // or <div key="Hi" {...props} /> ). We want to deprecate key spread,
3961
- // but as an intermediary step, we will use jsxDEV for everything except
3962
- // <div {...props} key="Hi" />, because we aren't currently able to tell if
3963
- // key is explicitly declared to be undefined or not.
3964
-
3965
- if (maybeKey !== undefined) {
3966
- {
3967
- checkKeyStringCoercion(maybeKey);
3968
- }
3969
-
3970
- key = '' + maybeKey;
3971
- }
3972
-
3973
- if (hasValidKey(config)) {
3974
- {
3975
- checkKeyStringCoercion(config.key);
3976
- }
3977
-
3978
- key = '' + config.key;
3979
- }
3980
-
3981
- if (hasValidRef(config)) {
3982
- ref = config.ref;
3983
- warnIfStringRefCannotBeAutoConverted(config, self);
3984
- } // Remaining properties are added to a new props object
3985
-
3986
-
3987
- for (propName in config) {
3988
- if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
3989
- props[propName] = config[propName];
3990
- }
3991
- } // Resolve default props
3992
-
3993
-
3994
- if (type && type.defaultProps) {
3995
- var defaultProps = type.defaultProps;
3996
-
3997
- for (propName in defaultProps) {
3998
- if (props[propName] === undefined) {
3999
- props[propName] = defaultProps[propName];
4000
- }
4001
- }
4002
- }
4003
-
4004
- if (key || ref) {
4005
- var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
4006
-
4007
- if (key) {
4008
- defineKeyPropWarningGetter(props, displayName);
4009
- }
4010
-
4011
- if (ref) {
4012
- defineRefPropWarningGetter(props, displayName);
4013
- }
4014
- }
4015
-
4016
- return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
4017
- }
4018
- }
4019
-
4020
- var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
4021
- var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
4022
-
4023
- function setCurrentlyValidatingElement$1(element) {
4024
- {
4025
- if (element) {
4026
- var owner = element._owner;
4027
- var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
4028
- ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
4029
- } else {
4030
- ReactDebugCurrentFrame$1.setExtraStackFrame(null);
4031
- }
4032
- }
4033
- }
4034
-
4035
- var propTypesMisspellWarningShown;
4036
-
4037
- {
4038
- propTypesMisspellWarningShown = false;
4039
- }
4040
- /**
4041
- * Verifies the object is a ReactElement.
4042
- * See https://reactjs.org/docs/react-api.html#isvalidelement
4043
- * @param {?object} object
4044
- * @return {boolean} True if `object` is a ReactElement.
4045
- * @final
4046
- */
4047
-
4048
-
4049
- function isValidElement(object) {
4050
- {
4051
- return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
4052
- }
4053
- }
4054
-
4055
- function getDeclarationErrorAddendum() {
4056
- {
4057
- if (ReactCurrentOwner$1.current) {
4058
- var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
4059
-
4060
- if (name) {
4061
- return '\n\nCheck the render method of `' + name + '`.';
4062
- }
4063
- }
4064
-
4065
- return '';
4066
- }
4067
- }
4068
-
4069
- function getSourceInfoErrorAddendum(source) {
4070
- {
4071
-
4072
- return '';
4073
- }
4074
- }
4075
- /**
4076
- * Warn if there's no key explicitly set on dynamic arrays of children or
4077
- * object keys are not valid. This allows us to keep track of children between
4078
- * updates.
4079
- */
4080
-
4081
-
4082
- var ownerHasKeyUseWarning = {};
4083
-
4084
- function getCurrentComponentErrorInfo(parentType) {
4085
- {
4086
- var info = getDeclarationErrorAddendum();
4087
-
4088
- if (!info) {
4089
- var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
4090
-
4091
- if (parentName) {
4092
- info = "\n\nCheck the top-level render call using <" + parentName + ">.";
4093
- }
4094
- }
4095
-
4096
- return info;
4097
- }
4098
- }
4099
- /**
4100
- * Warn if the element doesn't have an explicit key assigned to it.
4101
- * This element is in an array. The array could grow and shrink or be
4102
- * reordered. All children that haven't already been validated are required to
4103
- * have a "key" property assigned to it. Error statuses are cached so a warning
4104
- * will only be shown once.
4105
- *
4106
- * @internal
4107
- * @param {ReactElement} element Element that requires a key.
4108
- * @param {*} parentType element's parent's type.
4109
- */
4110
-
4111
-
4112
- function validateExplicitKey(element, parentType) {
4113
- {
4114
- if (!element._store || element._store.validated || element.key != null) {
4115
- return;
4116
- }
4117
-
4118
- element._store.validated = true;
4119
- var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
4120
-
4121
- if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
4122
- return;
4123
- }
4124
-
4125
- ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
4126
- // property, it may be the creator of the child that's responsible for
4127
- // assigning it a key.
4128
-
4129
- var childOwner = '';
4130
-
4131
- if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
4132
- // Give the component that originally created this child.
4133
- childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
4134
- }
4135
-
4136
- setCurrentlyValidatingElement$1(element);
4137
-
4138
- 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);
4139
-
4140
- setCurrentlyValidatingElement$1(null);
4141
- }
4142
- }
4143
- /**
4144
- * Ensure that every element either is passed in a static location, in an
4145
- * array with an explicit keys property defined, or in an object literal
4146
- * with valid key property.
4147
- *
4148
- * @internal
4149
- * @param {ReactNode} node Statically passed child of any type.
4150
- * @param {*} parentType node's parent's type.
4151
- */
4152
-
4153
-
4154
- function validateChildKeys(node, parentType) {
4155
- {
4156
- if (typeof node !== 'object') {
4157
- return;
4158
- }
4159
-
4160
- if (isArray(node)) {
4161
- for (var i = 0; i < node.length; i++) {
4162
- var child = node[i];
4163
-
4164
- if (isValidElement(child)) {
4165
- validateExplicitKey(child, parentType);
4166
- }
4167
- }
4168
- } else if (isValidElement(node)) {
4169
- // This element was passed in a valid location.
4170
- if (node._store) {
4171
- node._store.validated = true;
4172
- }
4173
- } else if (node) {
4174
- var iteratorFn = getIteratorFn(node);
4175
-
4176
- if (typeof iteratorFn === 'function') {
4177
- // Entry iterators used to provide implicit keys,
4178
- // but now we print a separate warning for them later.
4179
- if (iteratorFn !== node.entries) {
4180
- var iterator = iteratorFn.call(node);
4181
- var step;
4182
-
4183
- while (!(step = iterator.next()).done) {
4184
- if (isValidElement(step.value)) {
4185
- validateExplicitKey(step.value, parentType);
4186
- }
4187
- }
4188
- }
4189
- }
4190
- }
4191
- }
4192
- }
4193
- /**
4194
- * Given an element, validate that its props follow the propTypes definition,
4195
- * provided by the type.
4196
- *
4197
- * @param {ReactElement} element
4198
- */
4199
-
4200
-
4201
- function validatePropTypes(element) {
4202
- {
4203
- var type = element.type;
4204
-
4205
- if (type === null || type === undefined || typeof type === 'string') {
4206
- return;
4207
- }
4208
-
4209
- var propTypes;
4210
-
4211
- if (typeof type === 'function') {
4212
- propTypes = type.propTypes;
4213
- } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
4214
- // Inner props are checked in the reconciler.
4215
- type.$$typeof === REACT_MEMO_TYPE)) {
4216
- propTypes = type.propTypes;
4217
- } else {
4218
- return;
4219
- }
4220
-
4221
- if (propTypes) {
4222
- // Intentionally inside to avoid triggering lazy initializers:
4223
- var name = getComponentNameFromType(type);
4224
- checkPropTypes(propTypes, element.props, 'prop', name, element);
4225
- } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
4226
- propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
4227
-
4228
- var _name = getComponentNameFromType(type);
4229
-
4230
- error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
4231
- }
4232
-
4233
- if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
4234
- error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
4235
- }
4236
- }
4237
- }
4238
- /**
4239
- * Given a fragment, validate that it can only be provided with fragment props
4240
- * @param {ReactElement} fragment
4241
- */
4242
-
4243
-
4244
- function validateFragmentProps(fragment) {
4245
- {
4246
- var keys = Object.keys(fragment.props);
4247
-
4248
- for (var i = 0; i < keys.length; i++) {
4249
- var key = keys[i];
4250
-
4251
- if (key !== 'children' && key !== 'key') {
4252
- setCurrentlyValidatingElement$1(fragment);
4253
-
4254
- error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
4255
-
4256
- setCurrentlyValidatingElement$1(null);
4257
- break;
4258
- }
4259
- }
4260
-
4261
- if (fragment.ref !== null) {
4262
- setCurrentlyValidatingElement$1(fragment);
4263
-
4264
- error('Invalid attribute `ref` supplied to `React.Fragment`.');
4265
-
4266
- setCurrentlyValidatingElement$1(null);
4267
- }
4268
- }
4269
- }
4270
-
4271
- var didWarnAboutKeySpread = {};
4272
- function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
4273
- {
4274
- var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
4275
- // succeed and there will likely be errors in render.
4276
-
4277
- if (!validType) {
4278
- var info = '';
4279
-
4280
- if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
4281
- 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.";
4282
- }
4283
-
4284
- var sourceInfo = getSourceInfoErrorAddendum();
4285
-
4286
- if (sourceInfo) {
4287
- info += sourceInfo;
4288
- } else {
4289
- info += getDeclarationErrorAddendum();
4290
- }
4291
-
4292
- var typeString;
4293
-
4294
- if (type === null) {
4295
- typeString = 'null';
4296
- } else if (isArray(type)) {
4297
- typeString = 'array';
4298
- } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
4299
- typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
4300
- info = ' Did you accidentally export a JSX literal instead of a component?';
4301
- } else {
4302
- typeString = typeof type;
4303
- }
4304
-
4305
- 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);
4306
- }
4307
-
4308
- var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
4309
- // TODO: Drop this when these are no longer allowed as the type argument.
4310
-
4311
- if (element == null) {
4312
- return element;
4313
- } // Skip key warning if the type isn't valid since our key validation logic
4314
- // doesn't expect a non-string/function type and can throw confusing errors.
4315
- // We don't want exception behavior to differ between dev and prod.
4316
- // (Rendering will throw with a helpful message and as soon as the type is
4317
- // fixed, the key warnings will appear.)
4318
-
4319
-
4320
- if (validType) {
4321
- var children = props.children;
4322
-
4323
- if (children !== undefined) {
4324
- if (isStaticChildren) {
4325
- if (isArray(children)) {
4326
- for (var i = 0; i < children.length; i++) {
4327
- validateChildKeys(children[i], type);
4328
- }
4329
-
4330
- if (Object.freeze) {
4331
- Object.freeze(children);
4332
- }
4333
- } else {
4334
- 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.');
4335
- }
4336
- } else {
4337
- validateChildKeys(children, type);
4338
- }
4339
- }
4340
- }
4341
-
4342
- {
4343
- if (hasOwnProperty.call(props, 'key')) {
4344
- var componentName = getComponentNameFromType(type);
4345
- var keys = Object.keys(props).filter(function (k) {
4346
- return k !== 'key';
4347
- });
4348
- var beforeExample = keys.length > 0 ? '{key: someKey, ' + keys.join(': ..., ') + ': ...}' : '{key: someKey}';
4349
-
4350
- if (!didWarnAboutKeySpread[componentName + beforeExample]) {
4351
- var afterExample = keys.length > 0 ? '{' + keys.join(': ..., ') + ': ...}' : '{}';
4352
-
4353
- 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);
4354
-
4355
- didWarnAboutKeySpread[componentName + beforeExample] = true;
4356
- }
4357
- }
4358
- }
4359
-
4360
- if (type === REACT_FRAGMENT_TYPE) {
4361
- validateFragmentProps(element);
4362
- } else {
4363
- validatePropTypes(element);
4364
- }
4365
-
4366
- return element;
4367
- }
4368
- } // These two functions exist to still get child warnings in dev
4369
- // even with the prod transform. This means that jsxDEV is purely
4370
- // opt-in behavior for better messages but that we won't stop
4371
- // giving you warnings if you use production apis.
4372
-
4373
- function jsxWithValidationStatic(type, props, key) {
4374
- {
4375
- return jsxWithValidation(type, props, key, true);
4376
- }
4377
- }
4378
- function jsxWithValidationDynamic(type, props, key) {
4379
- {
4380
- return jsxWithValidation(type, props, key, false);
4381
- }
4382
- }
4383
-
4384
- var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.
4385
- // for now we can ship identical prod functions
4386
-
4387
- var jsxs = jsxWithValidationStatic ;
4388
-
4389
- reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
4390
- reactJsxRuntime_development.jsx = jsx;
4391
- reactJsxRuntime_development.jsxs = jsxs;
4392
- })();
4393
- }
4394
- return reactJsxRuntime_development;
4395
- }
4396
-
4397
- if (process.env.NODE_ENV === 'production') {
4398
- jsxRuntime.exports = requireReactJsxRuntime_production_min();
4399
- } else {
4400
- jsxRuntime.exports = requireReactJsxRuntime_development();
4401
- }
4402
-
4403
- var jsxRuntimeExports = jsxRuntime.exports;
4404
-
4405
- const SmoothSendAvaxContext = require$$0.createContext(null);
3051
+ const SmoothSendAvaxContext = react.createContext(null);
4406
3052
  function SmoothSendAvaxProvider({ apiKey, network = 'testnet', smartAccountAddress, accountFactory, accountSalt, children, }) {
4407
- const value = require$$0.useMemo(() => ({
3053
+ const value = react.useMemo(() => ({
4408
3054
  apiKey,
4409
3055
  network,
4410
3056
  smartAccountAddress,
4411
3057
  accountFactory,
4412
3058
  accountSalt: accountSalt ?? 0n,
4413
3059
  }), [apiKey, network, smartAccountAddress, accountFactory, accountSalt]);
4414
- return (jsxRuntimeExports.jsx(SmoothSendAvaxContext.Provider, { value: value, children: children }));
3060
+ return (jsxRuntime.jsx(SmoothSendAvaxContext.Provider, { value: value, children: children }));
4415
3061
  }
4416
3062
  function useSmoothSendAvaxContext() {
4417
- return require$$0.useContext(SmoothSendAvaxContext);
3063
+ return react.useContext(SmoothSendAvaxContext);
4418
3064
  }
4419
3065
  function useSmoothSendAvax(params) {
4420
3066
  const ctx = useSmoothSendAvaxContext();
@@ -4429,9 +3075,9 @@ function useSmoothSendAvax(params) {
4429
3075
  if (!smartAccountAddressProp && !accountFactory) {
4430
3076
  throw new Error('[SmoothSend AVAX] Provide smartAccountAddress and/or accountFactory (SimpleAccountFactory)');
4431
3077
  }
4432
- const submitter = require$$0.useMemo(() => new SmoothSendAvaxSubmitter({ apiKey, network }), [apiKey, network]);
3078
+ const submitter = react.useMemo(() => new SmoothSendAvaxSubmitter({ apiKey, network }), [apiKey, network]);
4433
3079
  const { publicClient, walletClient } = params;
4434
- const submitCall = require$$0.useCallback(async (call) => {
3080
+ const submitCall = react.useCallback(async (call) => {
4435
3081
  if (!publicClient) {
4436
3082
  throw new Error('[SmoothSend AVAX] publicClient missing (wagmi usePublicClient)');
4437
3083
  }
@@ -4530,7 +3176,22 @@ function useSmoothSendAvax(params) {
4530
3176
  submitter,
4531
3177
  walletClient,
4532
3178
  ]);
4533
- return { submitter, submitCall };
3179
+ const submitSponsoredUserOp = react.useCallback(async (args) => {
3180
+ if (args.calls.length === 0) {
3181
+ throw new Error('[SmoothSend AVAX] No calls provided');
3182
+ }
3183
+ // For now, use the first call (single execution)
3184
+ const call = args.calls[0];
3185
+ return submitCall({
3186
+ to: call.to,
3187
+ data: call.data,
3188
+ value: call.value,
3189
+ mode: args.sponsorshipMode,
3190
+ paymaster: args.paymaster,
3191
+ waitForReceipt: args.waitForReceipt,
3192
+ });
3193
+ }, [submitCall]);
3194
+ return { submitter, submitCall, submitSponsoredUserOp };
4534
3195
  }
4535
3196
 
4536
3197
  // ─── helpers ────────────────────────────────────────────────────────────────