@shogun-sdk/swap 0.0.2-test.1 → 0.0.2-test.11

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
@@ -1,13 +1,8 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __commonJS = (cb, mod) => function __require() {
9
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
- };
11
6
  var __export = (target, all) => {
12
7
  for (var name in all)
13
8
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -20,1441 +15,8 @@ var __copyProps = (to, from, except, desc) => {
20
15
  }
21
16
  return to;
22
17
  };
23
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
- // If the importer is in node compatibility mode or this is not an ESM
25
- // file that has been converted to a CommonJS file using a Babel-
26
- // compatible transform (i.e. "__esModule" has not been set), then set
27
- // "default" to the CommonJS "module.exports" for node compatibility.
28
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
- mod
30
- ));
31
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
19
 
33
- // ../../node_modules/.pnpm/react@19.2.0/node_modules/react/cjs/react.production.js
34
- var require_react_production = __commonJS({
35
- "../../node_modules/.pnpm/react@19.2.0/node_modules/react/cjs/react.production.js"(exports2) {
36
- "use strict";
37
- var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element");
38
- var REACT_PORTAL_TYPE = Symbol.for("react.portal");
39
- var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
40
- var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
41
- var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
42
- var REACT_CONSUMER_TYPE = Symbol.for("react.consumer");
43
- var REACT_CONTEXT_TYPE = Symbol.for("react.context");
44
- var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
45
- var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
46
- var REACT_MEMO_TYPE = Symbol.for("react.memo");
47
- var REACT_LAZY_TYPE = Symbol.for("react.lazy");
48
- var REACT_ACTIVITY_TYPE = Symbol.for("react.activity");
49
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
50
- function getIteratorFn(maybeIterable) {
51
- if (null === maybeIterable || "object" !== typeof maybeIterable) return null;
52
- maybeIterable = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable["@@iterator"];
53
- return "function" === typeof maybeIterable ? maybeIterable : null;
54
- }
55
- var ReactNoopUpdateQueue = {
56
- isMounted: function() {
57
- return false;
58
- },
59
- enqueueForceUpdate: function() {
60
- },
61
- enqueueReplaceState: function() {
62
- },
63
- enqueueSetState: function() {
64
- }
65
- };
66
- var assign = Object.assign;
67
- var emptyObject = {};
68
- function Component(props, context, updater) {
69
- this.props = props;
70
- this.context = context;
71
- this.refs = emptyObject;
72
- this.updater = updater || ReactNoopUpdateQueue;
73
- }
74
- Component.prototype.isReactComponent = {};
75
- Component.prototype.setState = function(partialState, callback) {
76
- if ("object" !== typeof partialState && "function" !== typeof partialState && null != partialState)
77
- throw Error(
78
- "takes an object of state variables to update or a function which returns an object of state variables."
79
- );
80
- this.updater.enqueueSetState(this, partialState, callback, "setState");
81
- };
82
- Component.prototype.forceUpdate = function(callback) {
83
- this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
84
- };
85
- function ComponentDummy() {
86
- }
87
- ComponentDummy.prototype = Component.prototype;
88
- function PureComponent(props, context, updater) {
89
- this.props = props;
90
- this.context = context;
91
- this.refs = emptyObject;
92
- this.updater = updater || ReactNoopUpdateQueue;
93
- }
94
- var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
95
- pureComponentPrototype.constructor = PureComponent;
96
- assign(pureComponentPrototype, Component.prototype);
97
- pureComponentPrototype.isPureReactComponent = true;
98
- var isArrayImpl = Array.isArray;
99
- function noop() {
100
- }
101
- var ReactSharedInternals = { H: null, A: null, T: null, S: null };
102
- var hasOwnProperty = Object.prototype.hasOwnProperty;
103
- function ReactElement(type, key, props) {
104
- var refProp = props.ref;
105
- return {
106
- $$typeof: REACT_ELEMENT_TYPE,
107
- type,
108
- key,
109
- ref: void 0 !== refProp ? refProp : null,
110
- props
111
- };
112
- }
113
- function cloneAndReplaceKey(oldElement, newKey) {
114
- return ReactElement(oldElement.type, newKey, oldElement.props);
115
- }
116
- function isValidElement(object) {
117
- return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
118
- }
119
- function escape(key) {
120
- var escaperLookup = { "=": "=0", ":": "=2" };
121
- return "$" + key.replace(/[=:]/g, function(match) {
122
- return escaperLookup[match];
123
- });
124
- }
125
- var userProvidedKeyEscapeRegex = /\/+/g;
126
- function getElementKey(element, index) {
127
- return "object" === typeof element && null !== element && null != element.key ? escape("" + element.key) : index.toString(36);
128
- }
129
- function resolveThenable(thenable) {
130
- switch (thenable.status) {
131
- case "fulfilled":
132
- return thenable.value;
133
- case "rejected":
134
- throw thenable.reason;
135
- default:
136
- switch ("string" === typeof thenable.status ? thenable.then(noop, noop) : (thenable.status = "pending", thenable.then(
137
- function(fulfilledValue) {
138
- "pending" === thenable.status && (thenable.status = "fulfilled", thenable.value = fulfilledValue);
139
- },
140
- function(error) {
141
- "pending" === thenable.status && (thenable.status = "rejected", thenable.reason = error);
142
- }
143
- )), thenable.status) {
144
- case "fulfilled":
145
- return thenable.value;
146
- case "rejected":
147
- throw thenable.reason;
148
- }
149
- }
150
- throw thenable;
151
- }
152
- function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
153
- var type = typeof children;
154
- if ("undefined" === type || "boolean" === type) children = null;
155
- var invokeCallback = false;
156
- if (null === children) invokeCallback = true;
157
- else
158
- switch (type) {
159
- case "bigint":
160
- case "string":
161
- case "number":
162
- invokeCallback = true;
163
- break;
164
- case "object":
165
- switch (children.$$typeof) {
166
- case REACT_ELEMENT_TYPE:
167
- case REACT_PORTAL_TYPE:
168
- invokeCallback = true;
169
- break;
170
- case REACT_LAZY_TYPE:
171
- return invokeCallback = children._init, mapIntoArray(
172
- invokeCallback(children._payload),
173
- array,
174
- escapedPrefix,
175
- nameSoFar,
176
- callback
177
- );
178
- }
179
- }
180
- if (invokeCallback)
181
- return callback = callback(children), invokeCallback = "" === nameSoFar ? "." + getElementKey(children, 0) : nameSoFar, isArrayImpl(callback) ? (escapedPrefix = "", null != invokeCallback && (escapedPrefix = invokeCallback.replace(userProvidedKeyEscapeRegex, "$&/") + "/"), mapIntoArray(callback, array, escapedPrefix, "", function(c) {
182
- return c;
183
- })) : null != callback && (isValidElement(callback) && (callback = cloneAndReplaceKey(
184
- callback,
185
- escapedPrefix + (null == callback.key || children && children.key === callback.key ? "" : ("" + callback.key).replace(
186
- userProvidedKeyEscapeRegex,
187
- "$&/"
188
- ) + "/") + invokeCallback
189
- )), array.push(callback)), 1;
190
- invokeCallback = 0;
191
- var nextNamePrefix = "" === nameSoFar ? "." : nameSoFar + ":";
192
- if (isArrayImpl(children))
193
- for (var i = 0; i < children.length; i++)
194
- nameSoFar = children[i], type = nextNamePrefix + getElementKey(nameSoFar, i), invokeCallback += mapIntoArray(
195
- nameSoFar,
196
- array,
197
- escapedPrefix,
198
- type,
199
- callback
200
- );
201
- else if (i = getIteratorFn(children), "function" === typeof i)
202
- for (children = i.call(children), i = 0; !(nameSoFar = children.next()).done; )
203
- nameSoFar = nameSoFar.value, type = nextNamePrefix + getElementKey(nameSoFar, i++), invokeCallback += mapIntoArray(
204
- nameSoFar,
205
- array,
206
- escapedPrefix,
207
- type,
208
- callback
209
- );
210
- else if ("object" === type) {
211
- if ("function" === typeof children.then)
212
- return mapIntoArray(
213
- resolveThenable(children),
214
- array,
215
- escapedPrefix,
216
- nameSoFar,
217
- callback
218
- );
219
- array = String(children);
220
- throw Error(
221
- "Objects are not valid as a React child (found: " + ("[object Object]" === array ? "object with keys {" + Object.keys(children).join(", ") + "}" : array) + "). If you meant to render a collection of children, use an array instead."
222
- );
223
- }
224
- return invokeCallback;
225
- }
226
- function mapChildren(children, func, context) {
227
- if (null == children) return children;
228
- var result = [], count = 0;
229
- mapIntoArray(children, result, "", "", function(child) {
230
- return func.call(context, child, count++);
231
- });
232
- return result;
233
- }
234
- function lazyInitializer(payload) {
235
- if (-1 === payload._status) {
236
- var ctor = payload._result;
237
- ctor = ctor();
238
- ctor.then(
239
- function(moduleObject) {
240
- if (0 === payload._status || -1 === payload._status)
241
- payload._status = 1, payload._result = moduleObject;
242
- },
243
- function(error) {
244
- if (0 === payload._status || -1 === payload._status)
245
- payload._status = 2, payload._result = error;
246
- }
247
- );
248
- -1 === payload._status && (payload._status = 0, payload._result = ctor);
249
- }
250
- if (1 === payload._status) return payload._result.default;
251
- throw payload._result;
252
- }
253
- var reportGlobalError = "function" === typeof reportError ? reportError : function(error) {
254
- if ("object" === typeof window && "function" === typeof window.ErrorEvent) {
255
- var event = new window.ErrorEvent("error", {
256
- bubbles: true,
257
- cancelable: true,
258
- message: "object" === typeof error && null !== error && "string" === typeof error.message ? String(error.message) : String(error),
259
- error
260
- });
261
- if (!window.dispatchEvent(event)) return;
262
- } else if ("object" === typeof process && "function" === typeof process.emit) {
263
- process.emit("uncaughtException", error);
264
- return;
265
- }
266
- console.error(error);
267
- };
268
- var Children = {
269
- map: mapChildren,
270
- forEach: function(children, forEachFunc, forEachContext) {
271
- mapChildren(
272
- children,
273
- function() {
274
- forEachFunc.apply(this, arguments);
275
- },
276
- forEachContext
277
- );
278
- },
279
- count: function(children) {
280
- var n = 0;
281
- mapChildren(children, function() {
282
- n++;
283
- });
284
- return n;
285
- },
286
- toArray: function(children) {
287
- return mapChildren(children, function(child) {
288
- return child;
289
- }) || [];
290
- },
291
- only: function(children) {
292
- if (!isValidElement(children))
293
- throw Error(
294
- "React.Children.only expected to receive a single React element child."
295
- );
296
- return children;
297
- }
298
- };
299
- exports2.Activity = REACT_ACTIVITY_TYPE;
300
- exports2.Children = Children;
301
- exports2.Component = Component;
302
- exports2.Fragment = REACT_FRAGMENT_TYPE;
303
- exports2.Profiler = REACT_PROFILER_TYPE;
304
- exports2.PureComponent = PureComponent;
305
- exports2.StrictMode = REACT_STRICT_MODE_TYPE;
306
- exports2.Suspense = REACT_SUSPENSE_TYPE;
307
- exports2.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals;
308
- exports2.__COMPILER_RUNTIME = {
309
- __proto__: null,
310
- c: function(size) {
311
- return ReactSharedInternals.H.useMemoCache(size);
312
- }
313
- };
314
- exports2.cache = function(fn) {
315
- return function() {
316
- return fn.apply(null, arguments);
317
- };
318
- };
319
- exports2.cacheSignal = function() {
320
- return null;
321
- };
322
- exports2.cloneElement = function(element, config, children) {
323
- if (null === element || void 0 === element)
324
- throw Error(
325
- "The argument must be a React element, but you passed " + element + "."
326
- );
327
- var props = assign({}, element.props), key = element.key;
328
- if (null != config)
329
- for (propName in void 0 !== config.key && (key = "" + config.key), config)
330
- !hasOwnProperty.call(config, propName) || "key" === propName || "__self" === propName || "__source" === propName || "ref" === propName && void 0 === config.ref || (props[propName] = config[propName]);
331
- var propName = arguments.length - 2;
332
- if (1 === propName) props.children = children;
333
- else if (1 < propName) {
334
- for (var childArray = Array(propName), i = 0; i < propName; i++)
335
- childArray[i] = arguments[i + 2];
336
- props.children = childArray;
337
- }
338
- return ReactElement(element.type, key, props);
339
- };
340
- exports2.createContext = function(defaultValue) {
341
- defaultValue = {
342
- $$typeof: REACT_CONTEXT_TYPE,
343
- _currentValue: defaultValue,
344
- _currentValue2: defaultValue,
345
- _threadCount: 0,
346
- Provider: null,
347
- Consumer: null
348
- };
349
- defaultValue.Provider = defaultValue;
350
- defaultValue.Consumer = {
351
- $$typeof: REACT_CONSUMER_TYPE,
352
- _context: defaultValue
353
- };
354
- return defaultValue;
355
- };
356
- exports2.createElement = function(type, config, children) {
357
- var propName, props = {}, key = null;
358
- if (null != config)
359
- for (propName in void 0 !== config.key && (key = "" + config.key), config)
360
- hasOwnProperty.call(config, propName) && "key" !== propName && "__self" !== propName && "__source" !== propName && (props[propName] = config[propName]);
361
- var childrenLength = arguments.length - 2;
362
- if (1 === childrenLength) props.children = children;
363
- else if (1 < childrenLength) {
364
- for (var childArray = Array(childrenLength), i = 0; i < childrenLength; i++)
365
- childArray[i] = arguments[i + 2];
366
- props.children = childArray;
367
- }
368
- if (type && type.defaultProps)
369
- for (propName in childrenLength = type.defaultProps, childrenLength)
370
- void 0 === props[propName] && (props[propName] = childrenLength[propName]);
371
- return ReactElement(type, key, props);
372
- };
373
- exports2.createRef = function() {
374
- return { current: null };
375
- };
376
- exports2.forwardRef = function(render) {
377
- return { $$typeof: REACT_FORWARD_REF_TYPE, render };
378
- };
379
- exports2.isValidElement = isValidElement;
380
- exports2.lazy = function(ctor) {
381
- return {
382
- $$typeof: REACT_LAZY_TYPE,
383
- _payload: { _status: -1, _result: ctor },
384
- _init: lazyInitializer
385
- };
386
- };
387
- exports2.memo = function(type, compare) {
388
- return {
389
- $$typeof: REACT_MEMO_TYPE,
390
- type,
391
- compare: void 0 === compare ? null : compare
392
- };
393
- };
394
- exports2.startTransition = function(scope) {
395
- var prevTransition = ReactSharedInternals.T, currentTransition = {};
396
- ReactSharedInternals.T = currentTransition;
397
- try {
398
- var returnValue = scope(), onStartTransitionFinish = ReactSharedInternals.S;
399
- null !== onStartTransitionFinish && onStartTransitionFinish(currentTransition, returnValue);
400
- "object" === typeof returnValue && null !== returnValue && "function" === typeof returnValue.then && returnValue.then(noop, reportGlobalError);
401
- } catch (error) {
402
- reportGlobalError(error);
403
- } finally {
404
- null !== prevTransition && null !== currentTransition.types && (prevTransition.types = currentTransition.types), ReactSharedInternals.T = prevTransition;
405
- }
406
- };
407
- exports2.unstable_useCacheRefresh = function() {
408
- return ReactSharedInternals.H.useCacheRefresh();
409
- };
410
- exports2.use = function(usable) {
411
- return ReactSharedInternals.H.use(usable);
412
- };
413
- exports2.useActionState = function(action, initialState, permalink) {
414
- return ReactSharedInternals.H.useActionState(action, initialState, permalink);
415
- };
416
- exports2.useCallback = function(callback, deps) {
417
- return ReactSharedInternals.H.useCallback(callback, deps);
418
- };
419
- exports2.useContext = function(Context) {
420
- return ReactSharedInternals.H.useContext(Context);
421
- };
422
- exports2.useDebugValue = function() {
423
- };
424
- exports2.useDeferredValue = function(value, initialValue) {
425
- return ReactSharedInternals.H.useDeferredValue(value, initialValue);
426
- };
427
- exports2.useEffect = function(create, deps) {
428
- return ReactSharedInternals.H.useEffect(create, deps);
429
- };
430
- exports2.useEffectEvent = function(callback) {
431
- return ReactSharedInternals.H.useEffectEvent(callback);
432
- };
433
- exports2.useId = function() {
434
- return ReactSharedInternals.H.useId();
435
- };
436
- exports2.useImperativeHandle = function(ref, create, deps) {
437
- return ReactSharedInternals.H.useImperativeHandle(ref, create, deps);
438
- };
439
- exports2.useInsertionEffect = function(create, deps) {
440
- return ReactSharedInternals.H.useInsertionEffect(create, deps);
441
- };
442
- exports2.useLayoutEffect = function(create, deps) {
443
- return ReactSharedInternals.H.useLayoutEffect(create, deps);
444
- };
445
- exports2.useMemo = function(create, deps) {
446
- return ReactSharedInternals.H.useMemo(create, deps);
447
- };
448
- exports2.useOptimistic = function(passthrough, reducer) {
449
- return ReactSharedInternals.H.useOptimistic(passthrough, reducer);
450
- };
451
- exports2.useReducer = function(reducer, initialArg, init) {
452
- return ReactSharedInternals.H.useReducer(reducer, initialArg, init);
453
- };
454
- exports2.useRef = function(initialValue) {
455
- return ReactSharedInternals.H.useRef(initialValue);
456
- };
457
- exports2.useState = function(initialState) {
458
- return ReactSharedInternals.H.useState(initialState);
459
- };
460
- exports2.useSyncExternalStore = function(subscribe, getSnapshot, getServerSnapshot) {
461
- return ReactSharedInternals.H.useSyncExternalStore(
462
- subscribe,
463
- getSnapshot,
464
- getServerSnapshot
465
- );
466
- };
467
- exports2.useTransition = function() {
468
- return ReactSharedInternals.H.useTransition();
469
- };
470
- exports2.version = "19.2.0";
471
- }
472
- });
473
-
474
- // ../../node_modules/.pnpm/react@19.2.0/node_modules/react/cjs/react.development.js
475
- var require_react_development = __commonJS({
476
- "../../node_modules/.pnpm/react@19.2.0/node_modules/react/cjs/react.development.js"(exports2, module2) {
477
- "use strict";
478
- "production" !== process.env.NODE_ENV && function() {
479
- function defineDeprecationWarning(methodName, info) {
480
- Object.defineProperty(Component.prototype, methodName, {
481
- get: function() {
482
- console.warn(
483
- "%s(...) is deprecated in plain JavaScript React classes. %s",
484
- info[0],
485
- info[1]
486
- );
487
- }
488
- });
489
- }
490
- function getIteratorFn(maybeIterable) {
491
- if (null === maybeIterable || "object" !== typeof maybeIterable)
492
- return null;
493
- maybeIterable = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable["@@iterator"];
494
- return "function" === typeof maybeIterable ? maybeIterable : null;
495
- }
496
- function warnNoop(publicInstance, callerName) {
497
- publicInstance = (publicInstance = publicInstance.constructor) && (publicInstance.displayName || publicInstance.name) || "ReactClass";
498
- var warningKey = publicInstance + "." + callerName;
499
- didWarnStateUpdateForUnmountedComponent[warningKey] || (console.error(
500
- "Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",
501
- callerName,
502
- publicInstance
503
- ), didWarnStateUpdateForUnmountedComponent[warningKey] = true);
504
- }
505
- function Component(props, context, updater) {
506
- this.props = props;
507
- this.context = context;
508
- this.refs = emptyObject;
509
- this.updater = updater || ReactNoopUpdateQueue;
510
- }
511
- function ComponentDummy() {
512
- }
513
- function PureComponent(props, context, updater) {
514
- this.props = props;
515
- this.context = context;
516
- this.refs = emptyObject;
517
- this.updater = updater || ReactNoopUpdateQueue;
518
- }
519
- function noop() {
520
- }
521
- function testStringCoercion(value) {
522
- return "" + value;
523
- }
524
- function checkKeyStringCoercion(value) {
525
- try {
526
- testStringCoercion(value);
527
- var JSCompiler_inline_result = false;
528
- } catch (e) {
529
- JSCompiler_inline_result = true;
530
- }
531
- if (JSCompiler_inline_result) {
532
- JSCompiler_inline_result = console;
533
- var JSCompiler_temp_const = JSCompiler_inline_result.error;
534
- var JSCompiler_inline_result$jscomp$0 = "function" === typeof Symbol && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
535
- JSCompiler_temp_const.call(
536
- JSCompiler_inline_result,
537
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
538
- JSCompiler_inline_result$jscomp$0
539
- );
540
- return testStringCoercion(value);
541
- }
542
- }
543
- function getComponentNameFromType(type) {
544
- if (null == type) return null;
545
- if ("function" === typeof type)
546
- return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
547
- if ("string" === typeof type) return type;
548
- switch (type) {
549
- case REACT_FRAGMENT_TYPE:
550
- return "Fragment";
551
- case REACT_PROFILER_TYPE:
552
- return "Profiler";
553
- case REACT_STRICT_MODE_TYPE:
554
- return "StrictMode";
555
- case REACT_SUSPENSE_TYPE:
556
- return "Suspense";
557
- case REACT_SUSPENSE_LIST_TYPE:
558
- return "SuspenseList";
559
- case REACT_ACTIVITY_TYPE:
560
- return "Activity";
561
- }
562
- if ("object" === typeof type)
563
- switch ("number" === typeof type.tag && console.error(
564
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
565
- ), type.$$typeof) {
566
- case REACT_PORTAL_TYPE:
567
- return "Portal";
568
- case REACT_CONTEXT_TYPE:
569
- return type.displayName || "Context";
570
- case REACT_CONSUMER_TYPE:
571
- return (type._context.displayName || "Context") + ".Consumer";
572
- case REACT_FORWARD_REF_TYPE:
573
- var innerType = type.render;
574
- type = type.displayName;
575
- type || (type = innerType.displayName || innerType.name || "", type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef");
576
- return type;
577
- case REACT_MEMO_TYPE:
578
- return innerType = type.displayName || null, null !== innerType ? innerType : getComponentNameFromType(type.type) || "Memo";
579
- case REACT_LAZY_TYPE:
580
- innerType = type._payload;
581
- type = type._init;
582
- try {
583
- return getComponentNameFromType(type(innerType));
584
- } catch (x) {
585
- }
586
- }
587
- return null;
588
- }
589
- function getTaskName(type) {
590
- if (type === REACT_FRAGMENT_TYPE) return "<>";
591
- if ("object" === typeof type && null !== type && type.$$typeof === REACT_LAZY_TYPE)
592
- return "<...>";
593
- try {
594
- var name = getComponentNameFromType(type);
595
- return name ? "<" + name + ">" : "<...>";
596
- } catch (x) {
597
- return "<...>";
598
- }
599
- }
600
- function getOwner() {
601
- var dispatcher = ReactSharedInternals.A;
602
- return null === dispatcher ? null : dispatcher.getOwner();
603
- }
604
- function UnknownOwner() {
605
- return Error("react-stack-top-frame");
606
- }
607
- function hasValidKey(config) {
608
- if (hasOwnProperty.call(config, "key")) {
609
- var getter = Object.getOwnPropertyDescriptor(config, "key").get;
610
- if (getter && getter.isReactWarning) return false;
611
- }
612
- return void 0 !== config.key;
613
- }
614
- function defineKeyPropWarningGetter(props, displayName) {
615
- function warnAboutAccessingKey() {
616
- specialPropKeyWarningShown || (specialPropKeyWarningShown = true, console.error(
617
- "%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://react.dev/link/special-props)",
618
- displayName
619
- ));
620
- }
621
- warnAboutAccessingKey.isReactWarning = true;
622
- Object.defineProperty(props, "key", {
623
- get: warnAboutAccessingKey,
624
- configurable: true
625
- });
626
- }
627
- function elementRefGetterWithDeprecationWarning() {
628
- var componentName = getComponentNameFromType(this.type);
629
- didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = true, console.error(
630
- "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
631
- ));
632
- componentName = this.props.ref;
633
- return void 0 !== componentName ? componentName : null;
634
- }
635
- function ReactElement(type, key, props, owner, debugStack, debugTask) {
636
- var refProp = props.ref;
637
- type = {
638
- $$typeof: REACT_ELEMENT_TYPE,
639
- type,
640
- key,
641
- props,
642
- _owner: owner
643
- };
644
- null !== (void 0 !== refProp ? refProp : null) ? Object.defineProperty(type, "ref", {
645
- enumerable: false,
646
- get: elementRefGetterWithDeprecationWarning
647
- }) : Object.defineProperty(type, "ref", { enumerable: false, value: null });
648
- type._store = {};
649
- Object.defineProperty(type._store, "validated", {
650
- configurable: false,
651
- enumerable: false,
652
- writable: true,
653
- value: 0
654
- });
655
- Object.defineProperty(type, "_debugInfo", {
656
- configurable: false,
657
- enumerable: false,
658
- writable: true,
659
- value: null
660
- });
661
- Object.defineProperty(type, "_debugStack", {
662
- configurable: false,
663
- enumerable: false,
664
- writable: true,
665
- value: debugStack
666
- });
667
- Object.defineProperty(type, "_debugTask", {
668
- configurable: false,
669
- enumerable: false,
670
- writable: true,
671
- value: debugTask
672
- });
673
- Object.freeze && (Object.freeze(type.props), Object.freeze(type));
674
- return type;
675
- }
676
- function cloneAndReplaceKey(oldElement, newKey) {
677
- newKey = ReactElement(
678
- oldElement.type,
679
- newKey,
680
- oldElement.props,
681
- oldElement._owner,
682
- oldElement._debugStack,
683
- oldElement._debugTask
684
- );
685
- oldElement._store && (newKey._store.validated = oldElement._store.validated);
686
- return newKey;
687
- }
688
- function validateChildKeys(node) {
689
- isValidElement(node) ? node._store && (node._store.validated = 1) : "object" === typeof node && null !== node && node.$$typeof === REACT_LAZY_TYPE && ("fulfilled" === node._payload.status ? isValidElement(node._payload.value) && node._payload.value._store && (node._payload.value._store.validated = 1) : node._store && (node._store.validated = 1));
690
- }
691
- function isValidElement(object) {
692
- return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
693
- }
694
- function escape(key) {
695
- var escaperLookup = { "=": "=0", ":": "=2" };
696
- return "$" + key.replace(/[=:]/g, function(match) {
697
- return escaperLookup[match];
698
- });
699
- }
700
- function getElementKey(element, index) {
701
- return "object" === typeof element && null !== element && null != element.key ? (checkKeyStringCoercion(element.key), escape("" + element.key)) : index.toString(36);
702
- }
703
- function resolveThenable(thenable) {
704
- switch (thenable.status) {
705
- case "fulfilled":
706
- return thenable.value;
707
- case "rejected":
708
- throw thenable.reason;
709
- default:
710
- switch ("string" === typeof thenable.status ? thenable.then(noop, noop) : (thenable.status = "pending", thenable.then(
711
- function(fulfilledValue) {
712
- "pending" === thenable.status && (thenable.status = "fulfilled", thenable.value = fulfilledValue);
713
- },
714
- function(error) {
715
- "pending" === thenable.status && (thenable.status = "rejected", thenable.reason = error);
716
- }
717
- )), thenable.status) {
718
- case "fulfilled":
719
- return thenable.value;
720
- case "rejected":
721
- throw thenable.reason;
722
- }
723
- }
724
- throw thenable;
725
- }
726
- function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
727
- var type = typeof children;
728
- if ("undefined" === type || "boolean" === type) children = null;
729
- var invokeCallback = false;
730
- if (null === children) invokeCallback = true;
731
- else
732
- switch (type) {
733
- case "bigint":
734
- case "string":
735
- case "number":
736
- invokeCallback = true;
737
- break;
738
- case "object":
739
- switch (children.$$typeof) {
740
- case REACT_ELEMENT_TYPE:
741
- case REACT_PORTAL_TYPE:
742
- invokeCallback = true;
743
- break;
744
- case REACT_LAZY_TYPE:
745
- return invokeCallback = children._init, mapIntoArray(
746
- invokeCallback(children._payload),
747
- array,
748
- escapedPrefix,
749
- nameSoFar,
750
- callback
751
- );
752
- }
753
- }
754
- if (invokeCallback) {
755
- invokeCallback = children;
756
- callback = callback(invokeCallback);
757
- var childKey = "" === nameSoFar ? "." + getElementKey(invokeCallback, 0) : nameSoFar;
758
- isArrayImpl(callback) ? (escapedPrefix = "", null != childKey && (escapedPrefix = childKey.replace(userProvidedKeyEscapeRegex, "$&/") + "/"), mapIntoArray(callback, array, escapedPrefix, "", function(c) {
759
- return c;
760
- })) : null != callback && (isValidElement(callback) && (null != callback.key && (invokeCallback && invokeCallback.key === callback.key || checkKeyStringCoercion(callback.key)), escapedPrefix = cloneAndReplaceKey(
761
- callback,
762
- escapedPrefix + (null == callback.key || invokeCallback && invokeCallback.key === callback.key ? "" : ("" + callback.key).replace(
763
- userProvidedKeyEscapeRegex,
764
- "$&/"
765
- ) + "/") + childKey
766
- ), "" !== nameSoFar && null != invokeCallback && isValidElement(invokeCallback) && null == invokeCallback.key && invokeCallback._store && !invokeCallback._store.validated && (escapedPrefix._store.validated = 2), callback = escapedPrefix), array.push(callback));
767
- return 1;
768
- }
769
- invokeCallback = 0;
770
- childKey = "" === nameSoFar ? "." : nameSoFar + ":";
771
- if (isArrayImpl(children))
772
- for (var i = 0; i < children.length; i++)
773
- nameSoFar = children[i], type = childKey + getElementKey(nameSoFar, i), invokeCallback += mapIntoArray(
774
- nameSoFar,
775
- array,
776
- escapedPrefix,
777
- type,
778
- callback
779
- );
780
- else if (i = getIteratorFn(children), "function" === typeof i)
781
- for (i === children.entries && (didWarnAboutMaps || console.warn(
782
- "Using Maps as children is not supported. Use an array of keyed ReactElements instead."
783
- ), didWarnAboutMaps = true), children = i.call(children), i = 0; !(nameSoFar = children.next()).done; )
784
- nameSoFar = nameSoFar.value, type = childKey + getElementKey(nameSoFar, i++), invokeCallback += mapIntoArray(
785
- nameSoFar,
786
- array,
787
- escapedPrefix,
788
- type,
789
- callback
790
- );
791
- else if ("object" === type) {
792
- if ("function" === typeof children.then)
793
- return mapIntoArray(
794
- resolveThenable(children),
795
- array,
796
- escapedPrefix,
797
- nameSoFar,
798
- callback
799
- );
800
- array = String(children);
801
- throw Error(
802
- "Objects are not valid as a React child (found: " + ("[object Object]" === array ? "object with keys {" + Object.keys(children).join(", ") + "}" : array) + "). If you meant to render a collection of children, use an array instead."
803
- );
804
- }
805
- return invokeCallback;
806
- }
807
- function mapChildren(children, func, context) {
808
- if (null == children) return children;
809
- var result = [], count = 0;
810
- mapIntoArray(children, result, "", "", function(child) {
811
- return func.call(context, child, count++);
812
- });
813
- return result;
814
- }
815
- function lazyInitializer(payload) {
816
- if (-1 === payload._status) {
817
- var ioInfo = payload._ioInfo;
818
- null != ioInfo && (ioInfo.start = ioInfo.end = performance.now());
819
- ioInfo = payload._result;
820
- var thenable = ioInfo();
821
- thenable.then(
822
- function(moduleObject) {
823
- if (0 === payload._status || -1 === payload._status) {
824
- payload._status = 1;
825
- payload._result = moduleObject;
826
- var _ioInfo = payload._ioInfo;
827
- null != _ioInfo && (_ioInfo.end = performance.now());
828
- void 0 === thenable.status && (thenable.status = "fulfilled", thenable.value = moduleObject);
829
- }
830
- },
831
- function(error) {
832
- if (0 === payload._status || -1 === payload._status) {
833
- payload._status = 2;
834
- payload._result = error;
835
- var _ioInfo2 = payload._ioInfo;
836
- null != _ioInfo2 && (_ioInfo2.end = performance.now());
837
- void 0 === thenable.status && (thenable.status = "rejected", thenable.reason = error);
838
- }
839
- }
840
- );
841
- ioInfo = payload._ioInfo;
842
- if (null != ioInfo) {
843
- ioInfo.value = thenable;
844
- var displayName = thenable.displayName;
845
- "string" === typeof displayName && (ioInfo.name = displayName);
846
- }
847
- -1 === payload._status && (payload._status = 0, payload._result = thenable);
848
- }
849
- if (1 === payload._status)
850
- return ioInfo = payload._result, void 0 === ioInfo && console.error(
851
- "lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))\n\nDid you accidentally put curly braces around the import?",
852
- ioInfo
853
- ), "default" in ioInfo || console.error(
854
- "lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))",
855
- ioInfo
856
- ), ioInfo.default;
857
- throw payload._result;
858
- }
859
- function resolveDispatcher() {
860
- var dispatcher = ReactSharedInternals.H;
861
- null === dispatcher && console.error(
862
- "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem."
863
- );
864
- return dispatcher;
865
- }
866
- function releaseAsyncTransition() {
867
- ReactSharedInternals.asyncTransitions--;
868
- }
869
- function enqueueTask(task) {
870
- if (null === enqueueTaskImpl)
871
- try {
872
- var requireString = ("require" + Math.random()).slice(0, 7);
873
- enqueueTaskImpl = (module2 && module2[requireString]).call(
874
- module2,
875
- "timers"
876
- ).setImmediate;
877
- } catch (_err) {
878
- enqueueTaskImpl = function(callback) {
879
- false === didWarnAboutMessageChannel && (didWarnAboutMessageChannel = true, "undefined" === typeof MessageChannel && console.error(
880
- "This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."
881
- ));
882
- var channel = new MessageChannel();
883
- channel.port1.onmessage = callback;
884
- channel.port2.postMessage(void 0);
885
- };
886
- }
887
- return enqueueTaskImpl(task);
888
- }
889
- function aggregateErrors(errors) {
890
- return 1 < errors.length && "function" === typeof AggregateError ? new AggregateError(errors) : errors[0];
891
- }
892
- function popActScope(prevActQueue, prevActScopeDepth) {
893
- prevActScopeDepth !== actScopeDepth - 1 && console.error(
894
- "You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "
895
- );
896
- actScopeDepth = prevActScopeDepth;
897
- }
898
- function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
899
- var queue = ReactSharedInternals.actQueue;
900
- if (null !== queue)
901
- if (0 !== queue.length)
902
- try {
903
- flushActQueue(queue);
904
- enqueueTask(function() {
905
- return recursivelyFlushAsyncActWork(returnValue, resolve, reject);
906
- });
907
- return;
908
- } catch (error) {
909
- ReactSharedInternals.thrownErrors.push(error);
910
- }
911
- else ReactSharedInternals.actQueue = null;
912
- 0 < ReactSharedInternals.thrownErrors.length ? (queue = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(queue)) : resolve(returnValue);
913
- }
914
- function flushActQueue(queue) {
915
- if (!isFlushing) {
916
- isFlushing = true;
917
- var i = 0;
918
- try {
919
- for (; i < queue.length; i++) {
920
- var callback = queue[i];
921
- do {
922
- ReactSharedInternals.didUsePromise = false;
923
- var continuation = callback(false);
924
- if (null !== continuation) {
925
- if (ReactSharedInternals.didUsePromise) {
926
- queue[i] = callback;
927
- queue.splice(0, i);
928
- return;
929
- }
930
- callback = continuation;
931
- } else break;
932
- } while (1);
933
- }
934
- queue.length = 0;
935
- } catch (error) {
936
- queue.splice(0, i + 1), ReactSharedInternals.thrownErrors.push(error);
937
- } finally {
938
- isFlushing = false;
939
- }
940
- }
941
- }
942
- "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
943
- var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), MAYBE_ITERATOR_SYMBOL = Symbol.iterator, didWarnStateUpdateForUnmountedComponent = {}, ReactNoopUpdateQueue = {
944
- isMounted: function() {
945
- return false;
946
- },
947
- enqueueForceUpdate: function(publicInstance) {
948
- warnNoop(publicInstance, "forceUpdate");
949
- },
950
- enqueueReplaceState: function(publicInstance) {
951
- warnNoop(publicInstance, "replaceState");
952
- },
953
- enqueueSetState: function(publicInstance) {
954
- warnNoop(publicInstance, "setState");
955
- }
956
- }, assign = Object.assign, emptyObject = {};
957
- Object.freeze(emptyObject);
958
- Component.prototype.isReactComponent = {};
959
- Component.prototype.setState = function(partialState, callback) {
960
- if ("object" !== typeof partialState && "function" !== typeof partialState && null != partialState)
961
- throw Error(
962
- "takes an object of state variables to update or a function which returns an object of state variables."
963
- );
964
- this.updater.enqueueSetState(this, partialState, callback, "setState");
965
- };
966
- Component.prototype.forceUpdate = function(callback) {
967
- this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
968
- };
969
- var deprecatedAPIs = {
970
- isMounted: [
971
- "isMounted",
972
- "Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."
973
- ],
974
- replaceState: [
975
- "replaceState",
976
- "Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."
977
- ]
978
- };
979
- for (fnName in deprecatedAPIs)
980
- deprecatedAPIs.hasOwnProperty(fnName) && defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
981
- ComponentDummy.prototype = Component.prototype;
982
- deprecatedAPIs = PureComponent.prototype = new ComponentDummy();
983
- deprecatedAPIs.constructor = PureComponent;
984
- assign(deprecatedAPIs, Component.prototype);
985
- deprecatedAPIs.isPureReactComponent = true;
986
- var isArrayImpl = Array.isArray, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = {
987
- H: null,
988
- A: null,
989
- T: null,
990
- S: null,
991
- actQueue: null,
992
- asyncTransitions: 0,
993
- isBatchingLegacy: false,
994
- didScheduleLegacyUpdate: false,
995
- didUsePromise: false,
996
- thrownErrors: [],
997
- getCurrentStack: null,
998
- recentlyCreatedOwnerStacks: 0
999
- }, hasOwnProperty = Object.prototype.hasOwnProperty, createTask = console.createTask ? console.createTask : function() {
1000
- return null;
1001
- };
1002
- deprecatedAPIs = {
1003
- react_stack_bottom_frame: function(callStackForError) {
1004
- return callStackForError();
1005
- }
1006
- };
1007
- var specialPropKeyWarningShown, didWarnAboutOldJSXRuntime;
1008
- var didWarnAboutElementRef = {};
1009
- var unknownOwnerDebugStack = deprecatedAPIs.react_stack_bottom_frame.bind(
1010
- deprecatedAPIs,
1011
- UnknownOwner
1012
- )();
1013
- var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
1014
- var didWarnAboutMaps = false, userProvidedKeyEscapeRegex = /\/+/g, reportGlobalError = "function" === typeof reportError ? reportError : function(error) {
1015
- if ("object" === typeof window && "function" === typeof window.ErrorEvent) {
1016
- var event = new window.ErrorEvent("error", {
1017
- bubbles: true,
1018
- cancelable: true,
1019
- message: "object" === typeof error && null !== error && "string" === typeof error.message ? String(error.message) : String(error),
1020
- error
1021
- });
1022
- if (!window.dispatchEvent(event)) return;
1023
- } else if ("object" === typeof process && "function" === typeof process.emit) {
1024
- process.emit("uncaughtException", error);
1025
- return;
1026
- }
1027
- console.error(error);
1028
- }, didWarnAboutMessageChannel = false, enqueueTaskImpl = null, actScopeDepth = 0, didWarnNoAwaitAct = false, isFlushing = false, queueSeveralMicrotasks = "function" === typeof queueMicrotask ? function(callback) {
1029
- queueMicrotask(function() {
1030
- return queueMicrotask(callback);
1031
- });
1032
- } : enqueueTask;
1033
- deprecatedAPIs = Object.freeze({
1034
- __proto__: null,
1035
- c: function(size) {
1036
- return resolveDispatcher().useMemoCache(size);
1037
- }
1038
- });
1039
- var fnName = {
1040
- map: mapChildren,
1041
- forEach: function(children, forEachFunc, forEachContext) {
1042
- mapChildren(
1043
- children,
1044
- function() {
1045
- forEachFunc.apply(this, arguments);
1046
- },
1047
- forEachContext
1048
- );
1049
- },
1050
- count: function(children) {
1051
- var n = 0;
1052
- mapChildren(children, function() {
1053
- n++;
1054
- });
1055
- return n;
1056
- },
1057
- toArray: function(children) {
1058
- return mapChildren(children, function(child) {
1059
- return child;
1060
- }) || [];
1061
- },
1062
- only: function(children) {
1063
- if (!isValidElement(children))
1064
- throw Error(
1065
- "React.Children.only expected to receive a single React element child."
1066
- );
1067
- return children;
1068
- }
1069
- };
1070
- exports2.Activity = REACT_ACTIVITY_TYPE;
1071
- exports2.Children = fnName;
1072
- exports2.Component = Component;
1073
- exports2.Fragment = REACT_FRAGMENT_TYPE;
1074
- exports2.Profiler = REACT_PROFILER_TYPE;
1075
- exports2.PureComponent = PureComponent;
1076
- exports2.StrictMode = REACT_STRICT_MODE_TYPE;
1077
- exports2.Suspense = REACT_SUSPENSE_TYPE;
1078
- exports2.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals;
1079
- exports2.__COMPILER_RUNTIME = deprecatedAPIs;
1080
- exports2.act = function(callback) {
1081
- var prevActQueue = ReactSharedInternals.actQueue, prevActScopeDepth = actScopeDepth;
1082
- actScopeDepth++;
1083
- var queue = ReactSharedInternals.actQueue = null !== prevActQueue ? prevActQueue : [], didAwaitActCall = false;
1084
- try {
1085
- var result = callback();
1086
- } catch (error) {
1087
- ReactSharedInternals.thrownErrors.push(error);
1088
- }
1089
- if (0 < ReactSharedInternals.thrownErrors.length)
1090
- throw popActScope(prevActQueue, prevActScopeDepth), callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
1091
- if (null !== result && "object" === typeof result && "function" === typeof result.then) {
1092
- var thenable = result;
1093
- queueSeveralMicrotasks(function() {
1094
- didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error(
1095
- "You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"
1096
- ));
1097
- });
1098
- return {
1099
- then: function(resolve, reject) {
1100
- didAwaitActCall = true;
1101
- thenable.then(
1102
- function(returnValue) {
1103
- popActScope(prevActQueue, prevActScopeDepth);
1104
- if (0 === prevActScopeDepth) {
1105
- try {
1106
- flushActQueue(queue), enqueueTask(function() {
1107
- return recursivelyFlushAsyncActWork(
1108
- returnValue,
1109
- resolve,
1110
- reject
1111
- );
1112
- });
1113
- } catch (error$0) {
1114
- ReactSharedInternals.thrownErrors.push(error$0);
1115
- }
1116
- if (0 < ReactSharedInternals.thrownErrors.length) {
1117
- var _thrownError = aggregateErrors(
1118
- ReactSharedInternals.thrownErrors
1119
- );
1120
- ReactSharedInternals.thrownErrors.length = 0;
1121
- reject(_thrownError);
1122
- }
1123
- } else resolve(returnValue);
1124
- },
1125
- function(error) {
1126
- popActScope(prevActQueue, prevActScopeDepth);
1127
- 0 < ReactSharedInternals.thrownErrors.length ? (error = aggregateErrors(
1128
- ReactSharedInternals.thrownErrors
1129
- ), ReactSharedInternals.thrownErrors.length = 0, reject(error)) : reject(error);
1130
- }
1131
- );
1132
- }
1133
- };
1134
- }
1135
- var returnValue$jscomp$0 = result;
1136
- popActScope(prevActQueue, prevActScopeDepth);
1137
- 0 === prevActScopeDepth && (flushActQueue(queue), 0 !== queue.length && queueSeveralMicrotasks(function() {
1138
- didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error(
1139
- "A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"
1140
- ));
1141
- }), ReactSharedInternals.actQueue = null);
1142
- if (0 < ReactSharedInternals.thrownErrors.length)
1143
- throw callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
1144
- return {
1145
- then: function(resolve, reject) {
1146
- didAwaitActCall = true;
1147
- 0 === prevActScopeDepth ? (ReactSharedInternals.actQueue = queue, enqueueTask(function() {
1148
- return recursivelyFlushAsyncActWork(
1149
- returnValue$jscomp$0,
1150
- resolve,
1151
- reject
1152
- );
1153
- })) : resolve(returnValue$jscomp$0);
1154
- }
1155
- };
1156
- };
1157
- exports2.cache = function(fn) {
1158
- return function() {
1159
- return fn.apply(null, arguments);
1160
- };
1161
- };
1162
- exports2.cacheSignal = function() {
1163
- return null;
1164
- };
1165
- exports2.captureOwnerStack = function() {
1166
- var getCurrentStack = ReactSharedInternals.getCurrentStack;
1167
- return null === getCurrentStack ? null : getCurrentStack();
1168
- };
1169
- exports2.cloneElement = function(element, config, children) {
1170
- if (null === element || void 0 === element)
1171
- throw Error(
1172
- "The argument must be a React element, but you passed " + element + "."
1173
- );
1174
- var props = assign({}, element.props), key = element.key, owner = element._owner;
1175
- if (null != config) {
1176
- var JSCompiler_inline_result;
1177
- a: {
1178
- if (hasOwnProperty.call(config, "ref") && (JSCompiler_inline_result = Object.getOwnPropertyDescriptor(
1179
- config,
1180
- "ref"
1181
- ).get) && JSCompiler_inline_result.isReactWarning) {
1182
- JSCompiler_inline_result = false;
1183
- break a;
1184
- }
1185
- JSCompiler_inline_result = void 0 !== config.ref;
1186
- }
1187
- JSCompiler_inline_result && (owner = getOwner());
1188
- hasValidKey(config) && (checkKeyStringCoercion(config.key), key = "" + config.key);
1189
- for (propName in config)
1190
- !hasOwnProperty.call(config, propName) || "key" === propName || "__self" === propName || "__source" === propName || "ref" === propName && void 0 === config.ref || (props[propName] = config[propName]);
1191
- }
1192
- var propName = arguments.length - 2;
1193
- if (1 === propName) props.children = children;
1194
- else if (1 < propName) {
1195
- JSCompiler_inline_result = Array(propName);
1196
- for (var i = 0; i < propName; i++)
1197
- JSCompiler_inline_result[i] = arguments[i + 2];
1198
- props.children = JSCompiler_inline_result;
1199
- }
1200
- props = ReactElement(
1201
- element.type,
1202
- key,
1203
- props,
1204
- owner,
1205
- element._debugStack,
1206
- element._debugTask
1207
- );
1208
- for (key = 2; key < arguments.length; key++)
1209
- validateChildKeys(arguments[key]);
1210
- return props;
1211
- };
1212
- exports2.createContext = function(defaultValue) {
1213
- defaultValue = {
1214
- $$typeof: REACT_CONTEXT_TYPE,
1215
- _currentValue: defaultValue,
1216
- _currentValue2: defaultValue,
1217
- _threadCount: 0,
1218
- Provider: null,
1219
- Consumer: null
1220
- };
1221
- defaultValue.Provider = defaultValue;
1222
- defaultValue.Consumer = {
1223
- $$typeof: REACT_CONSUMER_TYPE,
1224
- _context: defaultValue
1225
- };
1226
- defaultValue._currentRenderer = null;
1227
- defaultValue._currentRenderer2 = null;
1228
- return defaultValue;
1229
- };
1230
- exports2.createElement = function(type, config, children) {
1231
- for (var i = 2; i < arguments.length; i++)
1232
- validateChildKeys(arguments[i]);
1233
- i = {};
1234
- var key = null;
1235
- if (null != config)
1236
- for (propName in didWarnAboutOldJSXRuntime || !("__self" in config) || "key" in config || (didWarnAboutOldJSXRuntime = true, console.warn(
1237
- "Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform"
1238
- )), hasValidKey(config) && (checkKeyStringCoercion(config.key), key = "" + config.key), config)
1239
- hasOwnProperty.call(config, propName) && "key" !== propName && "__self" !== propName && "__source" !== propName && (i[propName] = config[propName]);
1240
- var childrenLength = arguments.length - 2;
1241
- if (1 === childrenLength) i.children = children;
1242
- else if (1 < childrenLength) {
1243
- for (var childArray = Array(childrenLength), _i = 0; _i < childrenLength; _i++)
1244
- childArray[_i] = arguments[_i + 2];
1245
- Object.freeze && Object.freeze(childArray);
1246
- i.children = childArray;
1247
- }
1248
- if (type && type.defaultProps)
1249
- for (propName in childrenLength = type.defaultProps, childrenLength)
1250
- void 0 === i[propName] && (i[propName] = childrenLength[propName]);
1251
- key && defineKeyPropWarningGetter(
1252
- i,
1253
- "function" === typeof type ? type.displayName || type.name || "Unknown" : type
1254
- );
1255
- var propName = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
1256
- return ReactElement(
1257
- type,
1258
- key,
1259
- i,
1260
- getOwner(),
1261
- propName ? Error("react-stack-top-frame") : unknownOwnerDebugStack,
1262
- propName ? createTask(getTaskName(type)) : unknownOwnerDebugTask
1263
- );
1264
- };
1265
- exports2.createRef = function() {
1266
- var refObject = { current: null };
1267
- Object.seal(refObject);
1268
- return refObject;
1269
- };
1270
- exports2.forwardRef = function(render) {
1271
- null != render && render.$$typeof === REACT_MEMO_TYPE ? console.error(
1272
- "forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."
1273
- ) : "function" !== typeof render ? console.error(
1274
- "forwardRef requires a render function but was given %s.",
1275
- null === render ? "null" : typeof render
1276
- ) : 0 !== render.length && 2 !== render.length && console.error(
1277
- "forwardRef render functions accept exactly two parameters: props and ref. %s",
1278
- 1 === render.length ? "Did you forget to use the ref parameter?" : "Any additional parameter will be undefined."
1279
- );
1280
- null != render && null != render.defaultProps && console.error(
1281
- "forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?"
1282
- );
1283
- var elementType = { $$typeof: REACT_FORWARD_REF_TYPE, render }, ownName;
1284
- Object.defineProperty(elementType, "displayName", {
1285
- enumerable: false,
1286
- configurable: true,
1287
- get: function() {
1288
- return ownName;
1289
- },
1290
- set: function(name) {
1291
- ownName = name;
1292
- render.name || render.displayName || (Object.defineProperty(render, "name", { value: name }), render.displayName = name);
1293
- }
1294
- });
1295
- return elementType;
1296
- };
1297
- exports2.isValidElement = isValidElement;
1298
- exports2.lazy = function(ctor) {
1299
- ctor = { _status: -1, _result: ctor };
1300
- var lazyType = {
1301
- $$typeof: REACT_LAZY_TYPE,
1302
- _payload: ctor,
1303
- _init: lazyInitializer
1304
- }, ioInfo = {
1305
- name: "lazy",
1306
- start: -1,
1307
- end: -1,
1308
- value: null,
1309
- owner: null,
1310
- debugStack: Error("react-stack-top-frame"),
1311
- debugTask: console.createTask ? console.createTask("lazy()") : null
1312
- };
1313
- ctor._ioInfo = ioInfo;
1314
- lazyType._debugInfo = [{ awaited: ioInfo }];
1315
- return lazyType;
1316
- };
1317
- exports2.memo = function(type, compare) {
1318
- null == type && console.error(
1319
- "memo: The first argument must be a component. Instead received: %s",
1320
- null === type ? "null" : typeof type
1321
- );
1322
- compare = {
1323
- $$typeof: REACT_MEMO_TYPE,
1324
- type,
1325
- compare: void 0 === compare ? null : compare
1326
- };
1327
- var ownName;
1328
- Object.defineProperty(compare, "displayName", {
1329
- enumerable: false,
1330
- configurable: true,
1331
- get: function() {
1332
- return ownName;
1333
- },
1334
- set: function(name) {
1335
- ownName = name;
1336
- type.name || type.displayName || (Object.defineProperty(type, "name", { value: name }), type.displayName = name);
1337
- }
1338
- });
1339
- return compare;
1340
- };
1341
- exports2.startTransition = function(scope) {
1342
- var prevTransition = ReactSharedInternals.T, currentTransition = {};
1343
- currentTransition._updatedFibers = /* @__PURE__ */ new Set();
1344
- ReactSharedInternals.T = currentTransition;
1345
- try {
1346
- var returnValue = scope(), onStartTransitionFinish = ReactSharedInternals.S;
1347
- null !== onStartTransitionFinish && onStartTransitionFinish(currentTransition, returnValue);
1348
- "object" === typeof returnValue && null !== returnValue && "function" === typeof returnValue.then && (ReactSharedInternals.asyncTransitions++, returnValue.then(releaseAsyncTransition, releaseAsyncTransition), returnValue.then(noop, reportGlobalError));
1349
- } catch (error) {
1350
- reportGlobalError(error);
1351
- } finally {
1352
- null === prevTransition && currentTransition._updatedFibers && (scope = currentTransition._updatedFibers.size, currentTransition._updatedFibers.clear(), 10 < scope && console.warn(
1353
- "Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table."
1354
- )), null !== prevTransition && null !== currentTransition.types && (null !== prevTransition.types && prevTransition.types !== currentTransition.types && console.error(
1355
- "We expected inner Transitions to have transferred the outer types set and that you cannot add to the outer Transition while inside the inner.This is a bug in React."
1356
- ), prevTransition.types = currentTransition.types), ReactSharedInternals.T = prevTransition;
1357
- }
1358
- };
1359
- exports2.unstable_useCacheRefresh = function() {
1360
- return resolveDispatcher().useCacheRefresh();
1361
- };
1362
- exports2.use = function(usable) {
1363
- return resolveDispatcher().use(usable);
1364
- };
1365
- exports2.useActionState = function(action, initialState, permalink) {
1366
- return resolveDispatcher().useActionState(
1367
- action,
1368
- initialState,
1369
- permalink
1370
- );
1371
- };
1372
- exports2.useCallback = function(callback, deps) {
1373
- return resolveDispatcher().useCallback(callback, deps);
1374
- };
1375
- exports2.useContext = function(Context) {
1376
- var dispatcher = resolveDispatcher();
1377
- Context.$$typeof === REACT_CONSUMER_TYPE && console.error(
1378
- "Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"
1379
- );
1380
- return dispatcher.useContext(Context);
1381
- };
1382
- exports2.useDebugValue = function(value, formatterFn) {
1383
- return resolveDispatcher().useDebugValue(value, formatterFn);
1384
- };
1385
- exports2.useDeferredValue = function(value, initialValue) {
1386
- return resolveDispatcher().useDeferredValue(value, initialValue);
1387
- };
1388
- exports2.useEffect = function(create, deps) {
1389
- null == create && console.warn(
1390
- "React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?"
1391
- );
1392
- return resolveDispatcher().useEffect(create, deps);
1393
- };
1394
- exports2.useEffectEvent = function(callback) {
1395
- return resolveDispatcher().useEffectEvent(callback);
1396
- };
1397
- exports2.useId = function() {
1398
- return resolveDispatcher().useId();
1399
- };
1400
- exports2.useImperativeHandle = function(ref, create, deps) {
1401
- return resolveDispatcher().useImperativeHandle(ref, create, deps);
1402
- };
1403
- exports2.useInsertionEffect = function(create, deps) {
1404
- null == create && console.warn(
1405
- "React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"
1406
- );
1407
- return resolveDispatcher().useInsertionEffect(create, deps);
1408
- };
1409
- exports2.useLayoutEffect = function(create, deps) {
1410
- null == create && console.warn(
1411
- "React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"
1412
- );
1413
- return resolveDispatcher().useLayoutEffect(create, deps);
1414
- };
1415
- exports2.useMemo = function(create, deps) {
1416
- return resolveDispatcher().useMemo(create, deps);
1417
- };
1418
- exports2.useOptimistic = function(passthrough, reducer) {
1419
- return resolveDispatcher().useOptimistic(passthrough, reducer);
1420
- };
1421
- exports2.useReducer = function(reducer, initialArg, init) {
1422
- return resolveDispatcher().useReducer(reducer, initialArg, init);
1423
- };
1424
- exports2.useRef = function(initialValue) {
1425
- return resolveDispatcher().useRef(initialValue);
1426
- };
1427
- exports2.useState = function(initialState) {
1428
- return resolveDispatcher().useState(initialState);
1429
- };
1430
- exports2.useSyncExternalStore = function(subscribe, getSnapshot, getServerSnapshot) {
1431
- return resolveDispatcher().useSyncExternalStore(
1432
- subscribe,
1433
- getSnapshot,
1434
- getServerSnapshot
1435
- );
1436
- };
1437
- exports2.useTransition = function() {
1438
- return resolveDispatcher().useTransition();
1439
- };
1440
- exports2.version = "19.2.0";
1441
- "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
1442
- }();
1443
- }
1444
- });
1445
-
1446
- // ../../node_modules/.pnpm/react@19.2.0/node_modules/react/index.js
1447
- var require_react = __commonJS({
1448
- "../../node_modules/.pnpm/react@19.2.0/node_modules/react/index.js"(exports2, module2) {
1449
- "use strict";
1450
- if (process.env.NODE_ENV === "production") {
1451
- module2.exports = require_react_production();
1452
- } else {
1453
- module2.exports = require_react_development();
1454
- }
1455
- }
1456
- });
1457
-
1458
20
  // src/index.ts
1459
21
  var src_exports = {};
1460
22
  __export(src_exports, {
@@ -1620,22 +182,26 @@ async function getQuote(params) {
1620
182
  tokenOut: params.tokenOut.address,
1621
183
  amount: params.amount
1622
184
  });
1623
- const inputSlippage = params.slippage ?? 5;
1624
- const slippageDecimal = inputSlippage / 100;
1625
- const slippage = Math.min(Math.max(slippageDecimal, 0), 0.5);
185
+ console.log({ data });
186
+ const slippagePercent = Math.min(Math.max(params.slippage ?? 0.5, 0), 50);
1626
187
  let warning;
1627
- if (slippage > 0.1) {
1628
- warning = `\u26A0\uFE0F High slippage tolerance (${(slippage * 100).toFixed(2)}%) \u2014 price may vary significantly.`;
188
+ if (slippagePercent > 10) {
189
+ warning = `\u26A0\uFE0F High slippage tolerance (${slippagePercent.toFixed(2)}%) \u2014 price may vary significantly.`;
1629
190
  }
1630
- const estimatedAmountOut = BigInt(data.estimatedAmountOutReduced);
1631
- const slippageBps = BigInt(Math.round(slippage * 1e4));
191
+ const estimatedAmountOut = BigInt(data.estimatedAmountOut);
192
+ const slippageBps = BigInt(Math.round(slippagePercent * 100));
1632
193
  const estimatedAmountOutAfterSlippage = estimatedAmountOut * (10000n - slippageBps) / 10000n;
194
+ const pricePerTokenOutInUsd = data.estimatedAmountOutUsd / Number(data.estimatedAmountOut);
195
+ const amountOutUsdAfterSlippage = Number(estimatedAmountOutAfterSlippage) * pricePerTokenOutInUsd;
196
+ const minStablecoinsAmountValue = BigInt(data.estimatedAmountInAsMinStablecoinAmount);
197
+ const minStablecoinsAmountAfterSlippage = minStablecoinsAmountValue * (10000n - slippageBps) / 10000n;
1633
198
  const pricePerInputToken = estimatedAmountOut * 10n ** BigInt(params.tokenIn.decimals ?? 18) / BigInt(params.amount);
1634
199
  return {
1635
- amountOut: estimatedAmountOut,
1636
- amountOutUsd: data.estimatedAmountOutUsd,
200
+ amountOut: estimatedAmountOutAfterSlippage,
201
+ amountOutUsd: amountOutUsdAfterSlippage,
1637
202
  amountInUsd: data.amountInUsd,
1638
- minStablecoinsAmount: data.estimatedAmountInAsMinStablecoinAmount,
203
+ // Input USD stays the same
204
+ minStablecoinsAmount: minStablecoinsAmountAfterSlippage,
1639
205
  tokenIn: {
1640
206
  address: params.tokenIn.address,
1641
207
  decimals: params.tokenIn.decimals ?? 18,
@@ -1648,10 +214,11 @@ async function getQuote(params) {
1648
214
  },
1649
215
  amountIn: params.amount,
1650
216
  pricePerInputToken,
1651
- slippage,
217
+ slippage: slippagePercent,
1652
218
  internal: {
1653
219
  ...data,
1654
- estimatedAmountOutReduced: estimatedAmountOutAfterSlippage
220
+ estimatedAmountOutReduced: estimatedAmountOutAfterSlippage,
221
+ estimatedAmountOutUsdReduced: amountOutUsdAfterSlippage
1655
222
  },
1656
223
  warning
1657
224
  };
@@ -1724,7 +291,7 @@ async function getBalances(params, options) {
1724
291
  }
1725
292
 
1726
293
  // src/core/executeOrder/execute.ts
1727
- var import_intents_sdk9 = require("@shogun-sdk/intents-sdk");
294
+ var import_intents_sdk10 = require("@shogun-sdk/intents-sdk");
1728
295
  var import_viem4 = require("viem");
1729
296
 
1730
297
  // src/wallet-adapter/svm-wallet-adapter/adapter.ts
@@ -1870,7 +437,7 @@ var adaptViemWallet = (wallet) => {
1870
437
  };
1871
438
 
1872
439
  // src/core/executeOrder/handleEvmExecution.ts
1873
- var import_intents_sdk7 = require("@shogun-sdk/intents-sdk");
440
+ var import_intents_sdk8 = require("@shogun-sdk/intents-sdk");
1874
441
  var import_viem3 = require("viem");
1875
442
 
1876
443
  // src/core/executeOrder/stageMessages.ts
@@ -1878,10 +445,12 @@ var DEFAULT_STAGE_MESSAGES = {
1878
445
  processing: "Preparing transaction for execution",
1879
446
  approving: "Approving token allowance",
1880
447
  approved: "Token approved successfully",
1881
- signing: "Signing order for submission",
1882
- submitting: "Submitting order to Auctioneer",
1883
- success: "Order executed successfully",
1884
- error: "Order execution failed"
448
+ signing: "Signing transaction for submission",
449
+ submitting: "Submitting transaction",
450
+ initiated: "Transaction initiated.",
451
+ success: "Transaction Executed successfully",
452
+ shogun_processing: "Shogun is processing your transaction",
453
+ error: "Transaction failed during submission"
1885
454
  };
1886
455
 
1887
456
  // src/core/executeOrder/buildOrder.ts
@@ -1920,6 +489,95 @@ async function buildOrder({
1920
489
  });
1921
490
  }
1922
491
 
492
+ // src/utils/pollOrderStatus.ts
493
+ var import_intents_sdk7 = require("@shogun-sdk/intents-sdk");
494
+ async function pollOrderStatus(jwt, orderId, options = {}) {
495
+ const { intervalMs = 2e3, timeoutMs = 3e5 } = options;
496
+ const startTime = Date.now();
497
+ return new Promise((resolve, reject) => {
498
+ const pollInterval = setInterval(async () => {
499
+ try {
500
+ if (Date.now() - startTime > timeoutMs) {
501
+ clearInterval(pollInterval);
502
+ return resolve("Timeout");
503
+ }
504
+ const res = await fetch(`${import_intents_sdk7.AUCTIONEER_URL}/user_intent`, {
505
+ method: "GET",
506
+ headers: {
507
+ Authorization: `Bearer ${jwt}`,
508
+ "Content-Type": "application/json"
509
+ }
510
+ });
511
+ if (!res.ok) {
512
+ clearInterval(pollInterval);
513
+ return reject(
514
+ new Error(`Failed to fetch orders: ${res.status} ${res.statusText}`)
515
+ );
516
+ }
517
+ const json = await res.json();
518
+ const data = json?.data ?? {};
519
+ const allOrders = [
520
+ ...data.crossChainDcaOrders ?? [],
521
+ ...data.crossChainLimitOrders ?? [],
522
+ ...data.singleChainDcaOrders ?? [],
523
+ ...data.singleChainLimitOrders ?? []
524
+ ];
525
+ const targetOrder = allOrders.find((o) => o.orderId === orderId);
526
+ if (!targetOrder) {
527
+ clearInterval(pollInterval);
528
+ return resolve("NotFound");
529
+ }
530
+ const { orderStatus } = targetOrder;
531
+ if (orderStatus === "Fulfilled" || orderStatus === "Cancelled" || orderStatus === "Outdated") {
532
+ clearInterval(pollInterval);
533
+ return resolve(orderStatus);
534
+ }
535
+ } catch (error) {
536
+ clearInterval(pollInterval);
537
+ return reject(error);
538
+ }
539
+ }, intervalMs);
540
+ });
541
+ }
542
+
543
+ // src/core/executeOrder/handleOrderPollingResult.ts
544
+ async function handleOrderPollingResult({
545
+ status,
546
+ orderId,
547
+ chainId,
548
+ update,
549
+ messageFor
550
+ }) {
551
+ switch (status) {
552
+ case "Fulfilled":
553
+ update("success", messageFor("success"));
554
+ return {
555
+ status: true,
556
+ orderId,
557
+ chainId,
558
+ finalStatus: status,
559
+ stage: "success"
560
+ };
561
+ case "Cancelled":
562
+ update("error", "Order was cancelled before fulfillment");
563
+ break;
564
+ case "Timeout":
565
+ update("error", "Order polling timed out");
566
+ break;
567
+ case "NotFound":
568
+ default:
569
+ update("error", "Order not found");
570
+ break;
571
+ }
572
+ return {
573
+ status: false,
574
+ orderId,
575
+ chainId,
576
+ finalStatus: status,
577
+ stage: "error"
578
+ };
579
+ }
580
+
1923
581
  // src/core/executeOrder/handleEvmExecution.ts
1924
582
  async function handleEvmExecution({
1925
583
  recipientAddress,
@@ -1948,18 +606,18 @@ async function handleEvmExecution({
1948
606
  from: accountAddress
1949
607
  });
1950
608
  }
1951
- update("approving", messageFor("approving"));
609
+ update("processing", messageFor("approving"));
1952
610
  await wallet.sendTransaction({
1953
611
  to: tokenIn,
1954
612
  data: (0, import_viem3.encodeFunctionData)({
1955
613
  abi: import_viem3.erc20Abi,
1956
614
  functionName: "approve",
1957
- args: [import_intents_sdk7.PERMIT2_ADDRESS[chainId], BigInt(quote.amountIn)]
615
+ args: [import_intents_sdk8.PERMIT2_ADDRESS[chainId], BigInt(quote.amountIn)]
1958
616
  }),
1959
617
  value: 0n,
1960
618
  from: accountAddress
1961
619
  });
1962
- update("approved", messageFor("approved"));
620
+ update("processing", messageFor("approved"));
1963
621
  const destination = recipientAddress ?? accountAddress;
1964
622
  const order = await buildOrder({
1965
623
  quote,
@@ -1968,23 +626,32 @@ async function handleEvmExecution({
1968
626
  deadline,
1969
627
  isSingleChain
1970
628
  });
1971
- update("signing", messageFor("signing"));
1972
- const { orderTypedData, nonce } = isSingleChain ? await (0, import_intents_sdk7.getEVMSingleChainOrderTypedData)(order) : await (0, import_intents_sdk7.getEVMCrossChainOrderTypedData)(order);
629
+ update("processing", messageFor("signing"));
630
+ const { orderTypedData, nonce } = isSingleChain ? await (0, import_intents_sdk8.getEVMSingleChainOrderTypedData)(order) : await (0, import_intents_sdk8.getEVMCrossChainOrderTypedData)(order);
1973
631
  if (!wallet.signTypedData) {
1974
632
  throw new Error("Wallet does not support EIP-712 signing");
1975
633
  }
1976
634
  const signature = await wallet.signTypedData(serializeBigIntsToStrings(orderTypedData));
1977
- update("submitting", messageFor("submitting"));
635
+ update("processing", messageFor("submitting"));
1978
636
  const res = await order.sendToAuctioneer({ signature, nonce: nonce.toString() });
1979
637
  if (!res.success) {
1980
638
  throw new Error("Auctioneer submission failed");
1981
639
  }
1982
- update("success", messageFor("success"));
1983
- return { status: true, txHash: res.data, chainId, stage: "success" };
640
+ update("initiated", messageFor("initiated"));
641
+ const { jwt, intentId: orderId } = res.data;
642
+ update("initiated", messageFor("shogun_processing"));
643
+ const status = await pollOrderStatus(jwt, orderId);
644
+ return await handleOrderPollingResult({
645
+ status,
646
+ orderId,
647
+ chainId,
648
+ update,
649
+ messageFor
650
+ });
1984
651
  }
1985
652
 
1986
653
  // src/core/executeOrder/handleSolanaExecution.ts
1987
- var import_intents_sdk8 = require("@shogun-sdk/intents-sdk");
654
+ var import_intents_sdk9 = require("@shogun-sdk/intents-sdk");
1988
655
  var import_web32 = require("@solana/web3.js");
1989
656
  async function handleSolanaExecution({
1990
657
  recipientAddress,
@@ -2014,10 +681,9 @@ async function handleSolanaExecution({
2014
681
  rpcUrl: wallet.rpcUrl
2015
682
  });
2016
683
  const transaction = import_web32.VersionedTransaction.deserialize(Uint8Array.from(txData.txBytes));
2017
- update("signing", messageFor("signing"));
2018
- console.log({ order });
2019
- const txSignature = await wallet.sendTransaction(transaction);
2020
- update("submitting", messageFor("submitting"));
684
+ update("processing", messageFor("signing"));
685
+ await wallet.sendTransaction(transaction);
686
+ update("processing", messageFor("submitting"));
2021
687
  const response = await submitToAuctioneer({
2022
688
  order,
2023
689
  isSingleChain,
@@ -2026,13 +692,17 @@ async function handleSolanaExecution({
2026
692
  if (!response.success) {
2027
693
  throw new Error("Auctioneer submission failed");
2028
694
  }
2029
- update("success", messageFor("success"));
2030
- return {
2031
- status: true,
2032
- txHash: txSignature,
2033
- chainId: import_intents_sdk8.ChainID.Solana,
2034
- stage: "success"
2035
- };
695
+ update("initiated", messageFor("initiated"));
696
+ const { jwt, intentId: orderId } = response.data;
697
+ update("initiated", messageFor("shogun_processing"));
698
+ const status = await pollOrderStatus(jwt, orderId);
699
+ return await handleOrderPollingResult({
700
+ status,
701
+ orderId,
702
+ chainId: SOLANA_CHAIN_ID,
703
+ update,
704
+ messageFor
705
+ });
2036
706
  }
2037
707
  async function getSolanaOrderInstructions({
2038
708
  order,
@@ -2040,11 +710,11 @@ async function getSolanaOrderInstructions({
2040
710
  rpcUrl
2041
711
  }) {
2042
712
  if (isSingleChain) {
2043
- return await (0, import_intents_sdk8.getSolanaSingleChainOrderInstructions)(order, {
713
+ return await (0, import_intents_sdk9.getSolanaSingleChainOrderInstructions)(order, {
2044
714
  rpcUrl
2045
715
  });
2046
716
  }
2047
- return await (0, import_intents_sdk8.getSolanaCrossChainOrderInstructions)(order, {
717
+ return await (0, import_intents_sdk9.getSolanaCrossChainOrderInstructions)(order, {
2048
718
  rpcUrl
2049
719
  });
2050
720
  }
@@ -2074,18 +744,33 @@ async function executeOrder({
2074
744
  onStatus,
2075
745
  options = {}
2076
746
  }) {
2077
- const deadline = options.deadline ?? Math.floor(Date.now() / 1e3) + 20 * 60;
747
+ const isDev = process.env.NODE_ENV !== "production";
748
+ const log = (...args) => {
749
+ if (isDev) console.log("[OneShot::executeOrder]", ...args);
750
+ };
2078
751
  const messageFor = (stage) => DEFAULT_STAGE_MESSAGES[stage];
2079
- const update = (stage, message) => onStatus?.(stage, message ?? messageFor(stage));
752
+ const update = (stage, message) => {
753
+ log("Stage:", stage, "| Message:", message ?? messageFor(stage));
754
+ onStatus?.(stage, message ?? messageFor(stage));
755
+ };
2080
756
  try {
757
+ const deadline = options.deadline ?? Math.floor(Date.now() / 1e3) + 20 * 60;
758
+ log("Starting execution:", {
759
+ accountAddress,
760
+ recipientAddress,
761
+ deadline,
762
+ tokenIn: quote?.tokenIn?.symbol,
763
+ tokenOut: quote?.tokenOut?.symbol
764
+ });
2081
765
  const adapter = normalizeWallet(wallet);
2082
766
  if (!adapter) throw new Error("No wallet provided");
2083
767
  const { tokenIn, tokenOut } = quote;
2084
768
  const isSingleChain = tokenIn.chainId === tokenOut.chainId;
2085
769
  const chainId = Number(tokenIn.chainId);
2086
- update("processing", messageFor("processing"));
2087
- if ((0, import_intents_sdk9.isEvmChain)(chainId)) {
2088
- return await handleEvmExecution({
770
+ update("processing");
771
+ if ((0, import_intents_sdk10.isEvmChain)(chainId)) {
772
+ log("Detected EVM chain:", chainId);
773
+ const result = await handleEvmExecution({
2089
774
  recipientAddress,
2090
775
  quote,
2091
776
  chainId,
@@ -2095,9 +780,12 @@ async function executeOrder({
2095
780
  deadline,
2096
781
  update
2097
782
  });
783
+ log("EVM execution result:", result);
784
+ return result;
2098
785
  }
2099
- if (chainId === import_intents_sdk9.ChainID.Solana) {
2100
- return await handleSolanaExecution({
786
+ if (chainId === import_intents_sdk10.ChainID.Solana) {
787
+ log("Detected Solana chain");
788
+ const result = await handleSolanaExecution({
2101
789
  recipientAddress,
2102
790
  quote,
2103
791
  accountAddress,
@@ -2106,11 +794,16 @@ async function executeOrder({
2106
794
  deadline,
2107
795
  update
2108
796
  });
797
+ log("Solana execution result:", result);
798
+ return result;
2109
799
  }
2110
- update("error", "Unsupported chain");
2111
- return { status: false, message: "Unsupported chain", stage: "error" };
800
+ const unsupported = `Unsupported chain: ${chainId}`;
801
+ update("error", unsupported);
802
+ log("Error:", unsupported);
803
+ return { status: false, message: unsupported, stage: "error" };
2112
804
  } catch (error) {
2113
805
  const message = error instanceof import_viem4.BaseError ? error.shortMessage : error instanceof Error ? error.message : String(error);
806
+ log("Execution failed:", { message, error });
2114
807
  update("error", message);
2115
808
  return { status: false, message, stage: "error" };
2116
809
  }
@@ -2122,7 +815,7 @@ function normalizeWallet(wallet) {
2122
815
  }
2123
816
 
2124
817
  // src/react/useTokenList.ts
2125
- var import_react = __toESM(require_react(), 1);
818
+ var import_react = require("react");
2126
819
  var tokenCache = /* @__PURE__ */ new Map();
2127
820
  function useTokenList(params) {
2128
821
  const [data, setData] = (0, import_react.useState)(null);
@@ -2193,7 +886,7 @@ function useTokenList(params) {
2193
886
  }
2194
887
 
2195
888
  // src/react/useExecuteOrder.ts
2196
- var import_react2 = __toESM(require_react(), 1);
889
+ var import_react2 = require("react");
2197
890
  function useExecuteOrder() {
2198
891
  const [status, setStatus] = (0, import_react2.useState)("processing");
2199
892
  const [message, setMessage] = (0, import_react2.useState)(null);
@@ -2281,7 +974,7 @@ function useExecuteOrder() {
2281
974
  }
2282
975
 
2283
976
  // src/react/useQuote.ts
2284
- var import_react3 = __toESM(require_react(), 1);
977
+ var import_react3 = require("react");
2285
978
  function useQuote(params, options) {
2286
979
  const [data, setData] = (0, import_react3.useState)(null);
2287
980
  const [loading, setLoading] = (0, import_react3.useState)(false);
@@ -2291,84 +984,71 @@ function useQuote(params, options) {
2291
984
  const autoRefreshMs = options?.autoRefreshMs;
2292
985
  const abortRef = (0, import_react3.useRef)(null);
2293
986
  const debounceRef = (0, import_react3.useRef)(null);
2294
- const mountedRef = (0, import_react3.useRef)(true);
987
+ const mounted = (0, import_react3.useRef)(false);
988
+ const paramsKey = (0, import_react3.useMemo)(
989
+ () => params ? JSON.stringify(serializeBigIntsToStrings(params)) : null,
990
+ [params]
991
+ );
2295
992
  (0, import_react3.useEffect)(() => {
993
+ mounted.current = true;
2296
994
  return () => {
2297
- mountedRef.current = false;
995
+ mounted.current = false;
2298
996
  abortRef.current?.abort();
2299
997
  if (debounceRef.current) clearTimeout(debounceRef.current);
2300
998
  };
2301
999
  }, []);
2302
- const fetchQuote = (0, import_react3.useCallback)(
2303
- async (signal) => {
2304
- if (!params) return;
2305
- try {
2306
- setLoading(true);
2307
- setWarning(null);
2308
- const result = await getQuote({ ...params, signal });
2309
- if (!mountedRef.current) return;
2310
- setData((prev) => {
2311
- if (JSON.stringify(prev) === JSON.stringify(result)) return prev;
2312
- return result;
2313
- });
2314
- setWarning(result.warning ?? null);
2315
- setError(null);
2316
- } catch (err) {
2317
- if (err.name === "AbortError") return;
2318
- const e = err instanceof Error ? err : new Error(String(err));
2319
- if (mountedRef.current) setError(e);
2320
- } finally {
2321
- if (mountedRef.current) setLoading(false);
2322
- }
2323
- },
2324
- [params]
2325
- );
2326
- (0, import_react3.useEffect)(() => {
1000
+ const fetchQuote = (0, import_react3.useCallback)(async () => {
2327
1001
  if (!params) return;
1002
+ try {
1003
+ setLoading(true);
1004
+ setWarning(null);
1005
+ const result = await getQuote(params);
1006
+ const serializeResult = serializeBigIntsToStrings(result);
1007
+ if (!mounted.current) return;
1008
+ setData((prev) => {
1009
+ if (JSON.stringify(prev) === JSON.stringify(serializeResult)) return prev;
1010
+ return serializeResult;
1011
+ });
1012
+ setWarning(result.warning ?? null);
1013
+ setError(null);
1014
+ } catch (err) {
1015
+ if (err.name === "AbortError") return;
1016
+ console.error("[useQuote] fetch error:", err);
1017
+ if (mounted.current) setError(err instanceof Error ? err : new Error(String(err)));
1018
+ } finally {
1019
+ if (mounted.current) setLoading(false);
1020
+ }
1021
+ }, [paramsKey]);
1022
+ (0, import_react3.useEffect)(() => {
1023
+ if (!paramsKey) return;
2328
1024
  if (debounceRef.current) clearTimeout(debounceRef.current);
2329
- abortRef.current?.abort();
2330
- const controller = new AbortController();
2331
- abortRef.current = controller;
2332
1025
  debounceRef.current = setTimeout(() => {
2333
- fetchQuote(controller.signal);
1026
+ fetchQuote();
2334
1027
  }, debounceMs);
2335
1028
  return () => {
2336
- controller.abort();
2337
1029
  if (debounceRef.current) clearTimeout(debounceRef.current);
1030
+ abortRef.current?.abort();
2338
1031
  };
2339
- }, [
2340
- params?.tokenIn?.address,
2341
- params?.tokenOut?.address,
2342
- params?.sourceChainId,
2343
- params?.destChainId,
2344
- params?.amount,
2345
- debounceMs,
2346
- fetchQuote
2347
- ]);
1032
+ }, [paramsKey, debounceMs, fetchQuote]);
2348
1033
  (0, import_react3.useEffect)(() => {
2349
- if (!autoRefreshMs || !params) return;
1034
+ if (!autoRefreshMs || !paramsKey) return;
2350
1035
  const interval = setInterval(() => fetchQuote(), autoRefreshMs);
2351
1036
  return () => clearInterval(interval);
2352
- }, [autoRefreshMs, params, fetchQuote]);
1037
+ }, [autoRefreshMs, paramsKey, fetchQuote]);
2353
1038
  return (0, import_react3.useMemo)(
2354
1039
  () => ({
2355
- /** Latest quote data */
2356
1040
  data,
2357
- /** Whether a fetch is ongoing */
2358
1041
  loading,
2359
- /** Error (if any) */
2360
1042
  error,
2361
- /** Warning (e.g. high slippage alert) */
2362
1043
  warning,
2363
- /** Manual refetch */
2364
- refetch: () => fetchQuote()
1044
+ refetch: fetchQuote
2365
1045
  }),
2366
1046
  [data, loading, error, warning, fetchQuote]
2367
1047
  );
2368
1048
  }
2369
1049
 
2370
1050
  // src/react/useBalances.ts
2371
- var import_react4 = __toESM(require_react(), 1);
1051
+ var import_react4 = require("react");
2372
1052
  function useBalances(params) {
2373
1053
  const [data, setData] = (0, import_react4.useState)(null);
2374
1054
  const [loading, setLoading] = (0, import_react4.useState)(false);
@@ -2451,27 +1131,3 @@ function useBalances(params) {
2451
1131
  useQuote,
2452
1132
  useTokenList
2453
1133
  });
2454
- /*! Bundled license information:
2455
-
2456
- react/cjs/react.production.js:
2457
- (**
2458
- * @license React
2459
- * react.production.js
2460
- *
2461
- * Copyright (c) Meta Platforms, Inc. and affiliates.
2462
- *
2463
- * This source code is licensed under the MIT license found in the
2464
- * LICENSE file in the root directory of this source tree.
2465
- *)
2466
-
2467
- react/cjs/react.development.js:
2468
- (**
2469
- * @license React
2470
- * react.development.js
2471
- *
2472
- * Copyright (c) Meta Platforms, Inc. and affiliates.
2473
- *
2474
- * This source code is licensed under the MIT license found in the
2475
- * LICENSE file in the root directory of this source tree.
2476
- *)
2477
- */