@0xchain/web-worker 1.1.0-beta.2 → 1.1.0-beta.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1656 @@
1
+ var react = { exports: {} };
2
+ var react_production = {};
3
+ var hasRequiredReact_production;
4
+ function requireReact_production() {
5
+ if (hasRequiredReact_production) return react_production;
6
+ hasRequiredReact_production = 1;
7
+ var REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = /* @__PURE__ */ Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = /* @__PURE__ */ Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = /* @__PURE__ */ Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense"), REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo"), REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"), MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
8
+ function getIteratorFn(maybeIterable) {
9
+ if (null === maybeIterable || "object" !== typeof maybeIterable) return null;
10
+ maybeIterable = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable["@@iterator"];
11
+ return "function" === typeof maybeIterable ? maybeIterable : null;
12
+ }
13
+ var ReactNoopUpdateQueue = {
14
+ isMounted: function() {
15
+ return false;
16
+ },
17
+ enqueueForceUpdate: function() {
18
+ },
19
+ enqueueReplaceState: function() {
20
+ },
21
+ enqueueSetState: function() {
22
+ }
23
+ }, assign = Object.assign, emptyObject = {};
24
+ function Component(props, context, updater) {
25
+ this.props = props;
26
+ this.context = context;
27
+ this.refs = emptyObject;
28
+ this.updater = updater || ReactNoopUpdateQueue;
29
+ }
30
+ Component.prototype.isReactComponent = {};
31
+ Component.prototype.setState = function(partialState, callback) {
32
+ if ("object" !== typeof partialState && "function" !== typeof partialState && null != partialState)
33
+ throw Error(
34
+ "takes an object of state variables to update or a function which returns an object of state variables."
35
+ );
36
+ this.updater.enqueueSetState(this, partialState, callback, "setState");
37
+ };
38
+ Component.prototype.forceUpdate = function(callback) {
39
+ this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
40
+ };
41
+ function ComponentDummy() {
42
+ }
43
+ ComponentDummy.prototype = Component.prototype;
44
+ function PureComponent(props, context, updater) {
45
+ this.props = props;
46
+ this.context = context;
47
+ this.refs = emptyObject;
48
+ this.updater = updater || ReactNoopUpdateQueue;
49
+ }
50
+ var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
51
+ pureComponentPrototype.constructor = PureComponent;
52
+ assign(pureComponentPrototype, Component.prototype);
53
+ pureComponentPrototype.isPureReactComponent = true;
54
+ var isArrayImpl = Array.isArray, ReactSharedInternals = { H: null, A: null, T: null, S: null, V: null }, hasOwnProperty = Object.prototype.hasOwnProperty;
55
+ function ReactElement(type, key, self2, source, owner, props) {
56
+ self2 = props.ref;
57
+ return {
58
+ $$typeof: REACT_ELEMENT_TYPE,
59
+ type,
60
+ key,
61
+ ref: void 0 !== self2 ? self2 : null,
62
+ props
63
+ };
64
+ }
65
+ function cloneAndReplaceKey(oldElement, newKey) {
66
+ return ReactElement(
67
+ oldElement.type,
68
+ newKey,
69
+ void 0,
70
+ void 0,
71
+ void 0,
72
+ oldElement.props
73
+ );
74
+ }
75
+ function isValidElement(object) {
76
+ return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
77
+ }
78
+ function escape(key) {
79
+ var escaperLookup = { "=": "=0", ":": "=2" };
80
+ return "$" + key.replace(/[=:]/g, function(match) {
81
+ return escaperLookup[match];
82
+ });
83
+ }
84
+ var userProvidedKeyEscapeRegex = /\/+/g;
85
+ function getElementKey(element, index) {
86
+ return "object" === typeof element && null !== element && null != element.key ? escape("" + element.key) : index.toString(36);
87
+ }
88
+ function noop$1() {
89
+ }
90
+ function resolveThenable(thenable) {
91
+ switch (thenable.status) {
92
+ case "fulfilled":
93
+ return thenable.value;
94
+ case "rejected":
95
+ throw thenable.reason;
96
+ default:
97
+ switch ("string" === typeof thenable.status ? thenable.then(noop$1, noop$1) : (thenable.status = "pending", thenable.then(
98
+ function(fulfilledValue) {
99
+ "pending" === thenable.status && (thenable.status = "fulfilled", thenable.value = fulfilledValue);
100
+ },
101
+ function(error) {
102
+ "pending" === thenable.status && (thenable.status = "rejected", thenable.reason = error);
103
+ }
104
+ )), thenable.status) {
105
+ case "fulfilled":
106
+ return thenable.value;
107
+ case "rejected":
108
+ throw thenable.reason;
109
+ }
110
+ }
111
+ throw thenable;
112
+ }
113
+ function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
114
+ var type = typeof children;
115
+ if ("undefined" === type || "boolean" === type) children = null;
116
+ var invokeCallback = false;
117
+ if (null === children) invokeCallback = true;
118
+ else
119
+ switch (type) {
120
+ case "bigint":
121
+ case "string":
122
+ case "number":
123
+ invokeCallback = true;
124
+ break;
125
+ case "object":
126
+ switch (children.$$typeof) {
127
+ case REACT_ELEMENT_TYPE:
128
+ case REACT_PORTAL_TYPE:
129
+ invokeCallback = true;
130
+ break;
131
+ case REACT_LAZY_TYPE:
132
+ return invokeCallback = children._init, mapIntoArray(
133
+ invokeCallback(children._payload),
134
+ array,
135
+ escapedPrefix,
136
+ nameSoFar,
137
+ callback
138
+ );
139
+ }
140
+ }
141
+ if (invokeCallback)
142
+ 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) {
143
+ return c;
144
+ })) : null != callback && (isValidElement(callback) && (callback = cloneAndReplaceKey(
145
+ callback,
146
+ escapedPrefix + (null == callback.key || children && children.key === callback.key ? "" : ("" + callback.key).replace(
147
+ userProvidedKeyEscapeRegex,
148
+ "$&/"
149
+ ) + "/") + invokeCallback
150
+ )), array.push(callback)), 1;
151
+ invokeCallback = 0;
152
+ var nextNamePrefix = "" === nameSoFar ? "." : nameSoFar + ":";
153
+ if (isArrayImpl(children))
154
+ for (var i = 0; i < children.length; i++)
155
+ nameSoFar = children[i], type = nextNamePrefix + getElementKey(nameSoFar, i), invokeCallback += mapIntoArray(
156
+ nameSoFar,
157
+ array,
158
+ escapedPrefix,
159
+ type,
160
+ callback
161
+ );
162
+ else if (i = getIteratorFn(children), "function" === typeof i)
163
+ for (children = i.call(children), i = 0; !(nameSoFar = children.next()).done; )
164
+ nameSoFar = nameSoFar.value, type = nextNamePrefix + getElementKey(nameSoFar, i++), invokeCallback += mapIntoArray(
165
+ nameSoFar,
166
+ array,
167
+ escapedPrefix,
168
+ type,
169
+ callback
170
+ );
171
+ else if ("object" === type) {
172
+ if ("function" === typeof children.then)
173
+ return mapIntoArray(
174
+ resolveThenable(children),
175
+ array,
176
+ escapedPrefix,
177
+ nameSoFar,
178
+ callback
179
+ );
180
+ array = String(children);
181
+ throw Error(
182
+ "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."
183
+ );
184
+ }
185
+ return invokeCallback;
186
+ }
187
+ function mapChildren(children, func, context) {
188
+ if (null == children) return children;
189
+ var result = [], count = 0;
190
+ mapIntoArray(children, result, "", "", function(child) {
191
+ return func.call(context, child, count++);
192
+ });
193
+ return result;
194
+ }
195
+ function lazyInitializer(payload) {
196
+ if (-1 === payload._status) {
197
+ var ctor = payload._result;
198
+ ctor = ctor();
199
+ ctor.then(
200
+ function(moduleObject) {
201
+ if (0 === payload._status || -1 === payload._status)
202
+ payload._status = 1, payload._result = moduleObject;
203
+ },
204
+ function(error) {
205
+ if (0 === payload._status || -1 === payload._status)
206
+ payload._status = 2, payload._result = error;
207
+ }
208
+ );
209
+ -1 === payload._status && (payload._status = 0, payload._result = ctor);
210
+ }
211
+ if (1 === payload._status) return payload._result.default;
212
+ throw payload._result;
213
+ }
214
+ var reportGlobalError = "function" === typeof reportError ? reportError : function(error) {
215
+ if ("object" === typeof window && "function" === typeof window.ErrorEvent) {
216
+ var event = new window.ErrorEvent("error", {
217
+ bubbles: true,
218
+ cancelable: true,
219
+ message: "object" === typeof error && null !== error && "string" === typeof error.message ? String(error.message) : String(error),
220
+ error
221
+ });
222
+ if (!window.dispatchEvent(event)) return;
223
+ } else if ("object" === typeof process && "function" === typeof process.emit) {
224
+ process.emit("uncaughtException", error);
225
+ return;
226
+ }
227
+ console.error(error);
228
+ };
229
+ function noop() {
230
+ }
231
+ react_production.Children = {
232
+ map: mapChildren,
233
+ forEach: function(children, forEachFunc, forEachContext) {
234
+ mapChildren(
235
+ children,
236
+ function() {
237
+ forEachFunc.apply(this, arguments);
238
+ },
239
+ forEachContext
240
+ );
241
+ },
242
+ count: function(children) {
243
+ var n = 0;
244
+ mapChildren(children, function() {
245
+ n++;
246
+ });
247
+ return n;
248
+ },
249
+ toArray: function(children) {
250
+ return mapChildren(children, function(child) {
251
+ return child;
252
+ }) || [];
253
+ },
254
+ only: function(children) {
255
+ if (!isValidElement(children))
256
+ throw Error(
257
+ "React.Children.only expected to receive a single React element child."
258
+ );
259
+ return children;
260
+ }
261
+ };
262
+ react_production.Component = Component;
263
+ react_production.Fragment = REACT_FRAGMENT_TYPE;
264
+ react_production.Profiler = REACT_PROFILER_TYPE;
265
+ react_production.PureComponent = PureComponent;
266
+ react_production.StrictMode = REACT_STRICT_MODE_TYPE;
267
+ react_production.Suspense = REACT_SUSPENSE_TYPE;
268
+ react_production.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals;
269
+ react_production.__COMPILER_RUNTIME = {
270
+ __proto__: null,
271
+ c: function(size) {
272
+ return ReactSharedInternals.H.useMemoCache(size);
273
+ }
274
+ };
275
+ react_production.cache = function(fn) {
276
+ return function() {
277
+ return fn.apply(null, arguments);
278
+ };
279
+ };
280
+ react_production.cloneElement = function(element, config, children) {
281
+ if (null === element || void 0 === element)
282
+ throw Error(
283
+ "The argument must be a React element, but you passed " + element + "."
284
+ );
285
+ var props = assign({}, element.props), key = element.key, owner = void 0;
286
+ if (null != config)
287
+ for (propName in void 0 !== config.ref && (owner = void 0), void 0 !== config.key && (key = "" + config.key), config)
288
+ !hasOwnProperty.call(config, propName) || "key" === propName || "__self" === propName || "__source" === propName || "ref" === propName && void 0 === config.ref || (props[propName] = config[propName]);
289
+ var propName = arguments.length - 2;
290
+ if (1 === propName) props.children = children;
291
+ else if (1 < propName) {
292
+ for (var childArray = Array(propName), i = 0; i < propName; i++)
293
+ childArray[i] = arguments[i + 2];
294
+ props.children = childArray;
295
+ }
296
+ return ReactElement(element.type, key, void 0, void 0, owner, props);
297
+ };
298
+ react_production.createContext = function(defaultValue) {
299
+ defaultValue = {
300
+ $$typeof: REACT_CONTEXT_TYPE,
301
+ _currentValue: defaultValue,
302
+ _currentValue2: defaultValue,
303
+ _threadCount: 0,
304
+ Provider: null,
305
+ Consumer: null
306
+ };
307
+ defaultValue.Provider = defaultValue;
308
+ defaultValue.Consumer = {
309
+ $$typeof: REACT_CONSUMER_TYPE,
310
+ _context: defaultValue
311
+ };
312
+ return defaultValue;
313
+ };
314
+ react_production.createElement = function(type, config, children) {
315
+ var propName, props = {}, key = null;
316
+ if (null != config)
317
+ for (propName in void 0 !== config.key && (key = "" + config.key), config)
318
+ hasOwnProperty.call(config, propName) && "key" !== propName && "__self" !== propName && "__source" !== propName && (props[propName] = config[propName]);
319
+ var childrenLength = arguments.length - 2;
320
+ if (1 === childrenLength) props.children = children;
321
+ else if (1 < childrenLength) {
322
+ for (var childArray = Array(childrenLength), i = 0; i < childrenLength; i++)
323
+ childArray[i] = arguments[i + 2];
324
+ props.children = childArray;
325
+ }
326
+ if (type && type.defaultProps)
327
+ for (propName in childrenLength = type.defaultProps, childrenLength)
328
+ void 0 === props[propName] && (props[propName] = childrenLength[propName]);
329
+ return ReactElement(type, key, void 0, void 0, null, props);
330
+ };
331
+ react_production.createRef = function() {
332
+ return { current: null };
333
+ };
334
+ react_production.forwardRef = function(render) {
335
+ return { $$typeof: REACT_FORWARD_REF_TYPE, render };
336
+ };
337
+ react_production.isValidElement = isValidElement;
338
+ react_production.lazy = function(ctor) {
339
+ return {
340
+ $$typeof: REACT_LAZY_TYPE,
341
+ _payload: { _status: -1, _result: ctor },
342
+ _init: lazyInitializer
343
+ };
344
+ };
345
+ react_production.memo = function(type, compare) {
346
+ return {
347
+ $$typeof: REACT_MEMO_TYPE,
348
+ type,
349
+ compare: void 0 === compare ? null : compare
350
+ };
351
+ };
352
+ react_production.startTransition = function(scope) {
353
+ var prevTransition = ReactSharedInternals.T, currentTransition = {};
354
+ ReactSharedInternals.T = currentTransition;
355
+ try {
356
+ var returnValue = scope(), onStartTransitionFinish = ReactSharedInternals.S;
357
+ null !== onStartTransitionFinish && onStartTransitionFinish(currentTransition, returnValue);
358
+ "object" === typeof returnValue && null !== returnValue && "function" === typeof returnValue.then && returnValue.then(noop, reportGlobalError);
359
+ } catch (error) {
360
+ reportGlobalError(error);
361
+ } finally {
362
+ ReactSharedInternals.T = prevTransition;
363
+ }
364
+ };
365
+ react_production.unstable_useCacheRefresh = function() {
366
+ return ReactSharedInternals.H.useCacheRefresh();
367
+ };
368
+ react_production.use = function(usable) {
369
+ return ReactSharedInternals.H.use(usable);
370
+ };
371
+ react_production.useActionState = function(action, initialState, permalink) {
372
+ return ReactSharedInternals.H.useActionState(action, initialState, permalink);
373
+ };
374
+ react_production.useCallback = function(callback, deps) {
375
+ return ReactSharedInternals.H.useCallback(callback, deps);
376
+ };
377
+ react_production.useContext = function(Context) {
378
+ return ReactSharedInternals.H.useContext(Context);
379
+ };
380
+ react_production.useDebugValue = function() {
381
+ };
382
+ react_production.useDeferredValue = function(value, initialValue) {
383
+ return ReactSharedInternals.H.useDeferredValue(value, initialValue);
384
+ };
385
+ react_production.useEffect = function(create, createDeps, update) {
386
+ var dispatcher = ReactSharedInternals.H;
387
+ if ("function" === typeof update)
388
+ throw Error(
389
+ "useEffect CRUD overload is not enabled in this build of React."
390
+ );
391
+ return dispatcher.useEffect(create, createDeps);
392
+ };
393
+ react_production.useId = function() {
394
+ return ReactSharedInternals.H.useId();
395
+ };
396
+ react_production.useImperativeHandle = function(ref, create, deps) {
397
+ return ReactSharedInternals.H.useImperativeHandle(ref, create, deps);
398
+ };
399
+ react_production.useInsertionEffect = function(create, deps) {
400
+ return ReactSharedInternals.H.useInsertionEffect(create, deps);
401
+ };
402
+ react_production.useLayoutEffect = function(create, deps) {
403
+ return ReactSharedInternals.H.useLayoutEffect(create, deps);
404
+ };
405
+ react_production.useMemo = function(create, deps) {
406
+ return ReactSharedInternals.H.useMemo(create, deps);
407
+ };
408
+ react_production.useOptimistic = function(passthrough, reducer) {
409
+ return ReactSharedInternals.H.useOptimistic(passthrough, reducer);
410
+ };
411
+ react_production.useReducer = function(reducer, initialArg, init) {
412
+ return ReactSharedInternals.H.useReducer(reducer, initialArg, init);
413
+ };
414
+ react_production.useRef = function(initialValue) {
415
+ return ReactSharedInternals.H.useRef(initialValue);
416
+ };
417
+ react_production.useState = function(initialState) {
418
+ return ReactSharedInternals.H.useState(initialState);
419
+ };
420
+ react_production.useSyncExternalStore = function(subscribe, getSnapshot, getServerSnapshot) {
421
+ return ReactSharedInternals.H.useSyncExternalStore(
422
+ subscribe,
423
+ getSnapshot,
424
+ getServerSnapshot
425
+ );
426
+ };
427
+ react_production.useTransition = function() {
428
+ return ReactSharedInternals.H.useTransition();
429
+ };
430
+ react_production.version = "19.1.1";
431
+ return react_production;
432
+ }
433
+ var react_development = { exports: {} };
434
+ react_development.exports;
435
+ var hasRequiredReact_development;
436
+ function requireReact_development() {
437
+ if (hasRequiredReact_development) return react_development.exports;
438
+ hasRequiredReact_development = 1;
439
+ (function(module, exports$1) {
440
+ "production" !== process.env.NODE_ENV && (function() {
441
+ function defineDeprecationWarning(methodName, info) {
442
+ Object.defineProperty(Component.prototype, methodName, {
443
+ get: function() {
444
+ console.warn(
445
+ "%s(...) is deprecated in plain JavaScript React classes. %s",
446
+ info[0],
447
+ info[1]
448
+ );
449
+ }
450
+ });
451
+ }
452
+ function getIteratorFn(maybeIterable) {
453
+ if (null === maybeIterable || "object" !== typeof maybeIterable)
454
+ return null;
455
+ maybeIterable = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable["@@iterator"];
456
+ return "function" === typeof maybeIterable ? maybeIterable : null;
457
+ }
458
+ function warnNoop(publicInstance, callerName) {
459
+ publicInstance = (publicInstance = publicInstance.constructor) && (publicInstance.displayName || publicInstance.name) || "ReactClass";
460
+ var warningKey = publicInstance + "." + callerName;
461
+ didWarnStateUpdateForUnmountedComponent[warningKey] || (console.error(
462
+ "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.",
463
+ callerName,
464
+ publicInstance
465
+ ), didWarnStateUpdateForUnmountedComponent[warningKey] = true);
466
+ }
467
+ function Component(props, context, updater) {
468
+ this.props = props;
469
+ this.context = context;
470
+ this.refs = emptyObject;
471
+ this.updater = updater || ReactNoopUpdateQueue;
472
+ }
473
+ function ComponentDummy() {
474
+ }
475
+ function PureComponent(props, context, updater) {
476
+ this.props = props;
477
+ this.context = context;
478
+ this.refs = emptyObject;
479
+ this.updater = updater || ReactNoopUpdateQueue;
480
+ }
481
+ function testStringCoercion(value) {
482
+ return "" + value;
483
+ }
484
+ function checkKeyStringCoercion(value) {
485
+ try {
486
+ testStringCoercion(value);
487
+ var JSCompiler_inline_result = false;
488
+ } catch (e) {
489
+ JSCompiler_inline_result = true;
490
+ }
491
+ if (JSCompiler_inline_result) {
492
+ JSCompiler_inline_result = console;
493
+ var JSCompiler_temp_const = JSCompiler_inline_result.error;
494
+ var JSCompiler_inline_result$jscomp$0 = "function" === typeof Symbol && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
495
+ JSCompiler_temp_const.call(
496
+ JSCompiler_inline_result,
497
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
498
+ JSCompiler_inline_result$jscomp$0
499
+ );
500
+ return testStringCoercion(value);
501
+ }
502
+ }
503
+ function getComponentNameFromType(type) {
504
+ if (null == type) return null;
505
+ if ("function" === typeof type)
506
+ return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
507
+ if ("string" === typeof type) return type;
508
+ switch (type) {
509
+ case REACT_FRAGMENT_TYPE:
510
+ return "Fragment";
511
+ case REACT_PROFILER_TYPE:
512
+ return "Profiler";
513
+ case REACT_STRICT_MODE_TYPE:
514
+ return "StrictMode";
515
+ case REACT_SUSPENSE_TYPE:
516
+ return "Suspense";
517
+ case REACT_SUSPENSE_LIST_TYPE:
518
+ return "SuspenseList";
519
+ case REACT_ACTIVITY_TYPE:
520
+ return "Activity";
521
+ }
522
+ if ("object" === typeof type)
523
+ switch ("number" === typeof type.tag && console.error(
524
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
525
+ ), type.$$typeof) {
526
+ case REACT_PORTAL_TYPE:
527
+ return "Portal";
528
+ case REACT_CONTEXT_TYPE:
529
+ return (type.displayName || "Context") + ".Provider";
530
+ case REACT_CONSUMER_TYPE:
531
+ return (type._context.displayName || "Context") + ".Consumer";
532
+ case REACT_FORWARD_REF_TYPE:
533
+ var innerType = type.render;
534
+ type = type.displayName;
535
+ type || (type = innerType.displayName || innerType.name || "", type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef");
536
+ return type;
537
+ case REACT_MEMO_TYPE:
538
+ return innerType = type.displayName || null, null !== innerType ? innerType : getComponentNameFromType(type.type) || "Memo";
539
+ case REACT_LAZY_TYPE:
540
+ innerType = type._payload;
541
+ type = type._init;
542
+ try {
543
+ return getComponentNameFromType(type(innerType));
544
+ } catch (x) {
545
+ }
546
+ }
547
+ return null;
548
+ }
549
+ function getTaskName(type) {
550
+ if (type === REACT_FRAGMENT_TYPE) return "<>";
551
+ if ("object" === typeof type && null !== type && type.$$typeof === REACT_LAZY_TYPE)
552
+ return "<...>";
553
+ try {
554
+ var name = getComponentNameFromType(type);
555
+ return name ? "<" + name + ">" : "<...>";
556
+ } catch (x) {
557
+ return "<...>";
558
+ }
559
+ }
560
+ function getOwner() {
561
+ var dispatcher = ReactSharedInternals.A;
562
+ return null === dispatcher ? null : dispatcher.getOwner();
563
+ }
564
+ function UnknownOwner() {
565
+ return Error("react-stack-top-frame");
566
+ }
567
+ function hasValidKey(config) {
568
+ if (hasOwnProperty.call(config, "key")) {
569
+ var getter = Object.getOwnPropertyDescriptor(config, "key").get;
570
+ if (getter && getter.isReactWarning) return false;
571
+ }
572
+ return void 0 !== config.key;
573
+ }
574
+ function defineKeyPropWarningGetter(props, displayName) {
575
+ function warnAboutAccessingKey() {
576
+ specialPropKeyWarningShown || (specialPropKeyWarningShown = true, console.error(
577
+ "%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)",
578
+ displayName
579
+ ));
580
+ }
581
+ warnAboutAccessingKey.isReactWarning = true;
582
+ Object.defineProperty(props, "key", {
583
+ get: warnAboutAccessingKey,
584
+ configurable: true
585
+ });
586
+ }
587
+ function elementRefGetterWithDeprecationWarning() {
588
+ var componentName = getComponentNameFromType(this.type);
589
+ didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = true, console.error(
590
+ "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."
591
+ ));
592
+ componentName = this.props.ref;
593
+ return void 0 !== componentName ? componentName : null;
594
+ }
595
+ function ReactElement(type, key, self2, source, owner, props, debugStack, debugTask) {
596
+ self2 = props.ref;
597
+ type = {
598
+ $$typeof: REACT_ELEMENT_TYPE,
599
+ type,
600
+ key,
601
+ props,
602
+ _owner: owner
603
+ };
604
+ null !== (void 0 !== self2 ? self2 : null) ? Object.defineProperty(type, "ref", {
605
+ enumerable: false,
606
+ get: elementRefGetterWithDeprecationWarning
607
+ }) : Object.defineProperty(type, "ref", { enumerable: false, value: null });
608
+ type._store = {};
609
+ Object.defineProperty(type._store, "validated", {
610
+ configurable: false,
611
+ enumerable: false,
612
+ writable: true,
613
+ value: 0
614
+ });
615
+ Object.defineProperty(type, "_debugInfo", {
616
+ configurable: false,
617
+ enumerable: false,
618
+ writable: true,
619
+ value: null
620
+ });
621
+ Object.defineProperty(type, "_debugStack", {
622
+ configurable: false,
623
+ enumerable: false,
624
+ writable: true,
625
+ value: debugStack
626
+ });
627
+ Object.defineProperty(type, "_debugTask", {
628
+ configurable: false,
629
+ enumerable: false,
630
+ writable: true,
631
+ value: debugTask
632
+ });
633
+ Object.freeze && (Object.freeze(type.props), Object.freeze(type));
634
+ return type;
635
+ }
636
+ function cloneAndReplaceKey(oldElement, newKey) {
637
+ newKey = ReactElement(
638
+ oldElement.type,
639
+ newKey,
640
+ void 0,
641
+ void 0,
642
+ oldElement._owner,
643
+ oldElement.props,
644
+ oldElement._debugStack,
645
+ oldElement._debugTask
646
+ );
647
+ oldElement._store && (newKey._store.validated = oldElement._store.validated);
648
+ return newKey;
649
+ }
650
+ function isValidElement(object) {
651
+ return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
652
+ }
653
+ function escape(key) {
654
+ var escaperLookup = { "=": "=0", ":": "=2" };
655
+ return "$" + key.replace(/[=:]/g, function(match) {
656
+ return escaperLookup[match];
657
+ });
658
+ }
659
+ function getElementKey(element, index) {
660
+ return "object" === typeof element && null !== element && null != element.key ? (checkKeyStringCoercion(element.key), escape("" + element.key)) : index.toString(36);
661
+ }
662
+ function noop$1() {
663
+ }
664
+ function resolveThenable(thenable) {
665
+ switch (thenable.status) {
666
+ case "fulfilled":
667
+ return thenable.value;
668
+ case "rejected":
669
+ throw thenable.reason;
670
+ default:
671
+ switch ("string" === typeof thenable.status ? thenable.then(noop$1, noop$1) : (thenable.status = "pending", thenable.then(
672
+ function(fulfilledValue) {
673
+ "pending" === thenable.status && (thenable.status = "fulfilled", thenable.value = fulfilledValue);
674
+ },
675
+ function(error) {
676
+ "pending" === thenable.status && (thenable.status = "rejected", thenable.reason = error);
677
+ }
678
+ )), thenable.status) {
679
+ case "fulfilled":
680
+ return thenable.value;
681
+ case "rejected":
682
+ throw thenable.reason;
683
+ }
684
+ }
685
+ throw thenable;
686
+ }
687
+ function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
688
+ var type = typeof children;
689
+ if ("undefined" === type || "boolean" === type) children = null;
690
+ var invokeCallback = false;
691
+ if (null === children) invokeCallback = true;
692
+ else
693
+ switch (type) {
694
+ case "bigint":
695
+ case "string":
696
+ case "number":
697
+ invokeCallback = true;
698
+ break;
699
+ case "object":
700
+ switch (children.$$typeof) {
701
+ case REACT_ELEMENT_TYPE:
702
+ case REACT_PORTAL_TYPE:
703
+ invokeCallback = true;
704
+ break;
705
+ case REACT_LAZY_TYPE:
706
+ return invokeCallback = children._init, mapIntoArray(
707
+ invokeCallback(children._payload),
708
+ array,
709
+ escapedPrefix,
710
+ nameSoFar,
711
+ callback
712
+ );
713
+ }
714
+ }
715
+ if (invokeCallback) {
716
+ invokeCallback = children;
717
+ callback = callback(invokeCallback);
718
+ var childKey = "" === nameSoFar ? "." + getElementKey(invokeCallback, 0) : nameSoFar;
719
+ isArrayImpl(callback) ? (escapedPrefix = "", null != childKey && (escapedPrefix = childKey.replace(userProvidedKeyEscapeRegex, "$&/") + "/"), mapIntoArray(callback, array, escapedPrefix, "", function(c) {
720
+ return c;
721
+ })) : null != callback && (isValidElement(callback) && (null != callback.key && (invokeCallback && invokeCallback.key === callback.key || checkKeyStringCoercion(callback.key)), escapedPrefix = cloneAndReplaceKey(
722
+ callback,
723
+ escapedPrefix + (null == callback.key || invokeCallback && invokeCallback.key === callback.key ? "" : ("" + callback.key).replace(
724
+ userProvidedKeyEscapeRegex,
725
+ "$&/"
726
+ ) + "/") + childKey
727
+ ), "" !== nameSoFar && null != invokeCallback && isValidElement(invokeCallback) && null == invokeCallback.key && invokeCallback._store && !invokeCallback._store.validated && (escapedPrefix._store.validated = 2), callback = escapedPrefix), array.push(callback));
728
+ return 1;
729
+ }
730
+ invokeCallback = 0;
731
+ childKey = "" === nameSoFar ? "." : nameSoFar + ":";
732
+ if (isArrayImpl(children))
733
+ for (var i = 0; i < children.length; i++)
734
+ nameSoFar = children[i], type = childKey + getElementKey(nameSoFar, i), invokeCallback += mapIntoArray(
735
+ nameSoFar,
736
+ array,
737
+ escapedPrefix,
738
+ type,
739
+ callback
740
+ );
741
+ else if (i = getIteratorFn(children), "function" === typeof i)
742
+ for (i === children.entries && (didWarnAboutMaps || console.warn(
743
+ "Using Maps as children is not supported. Use an array of keyed ReactElements instead."
744
+ ), didWarnAboutMaps = true), children = i.call(children), i = 0; !(nameSoFar = children.next()).done; )
745
+ nameSoFar = nameSoFar.value, type = childKey + getElementKey(nameSoFar, i++), invokeCallback += mapIntoArray(
746
+ nameSoFar,
747
+ array,
748
+ escapedPrefix,
749
+ type,
750
+ callback
751
+ );
752
+ else if ("object" === type) {
753
+ if ("function" === typeof children.then)
754
+ return mapIntoArray(
755
+ resolveThenable(children),
756
+ array,
757
+ escapedPrefix,
758
+ nameSoFar,
759
+ callback
760
+ );
761
+ array = String(children);
762
+ throw Error(
763
+ "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."
764
+ );
765
+ }
766
+ return invokeCallback;
767
+ }
768
+ function mapChildren(children, func, context) {
769
+ if (null == children) return children;
770
+ var result = [], count = 0;
771
+ mapIntoArray(children, result, "", "", function(child) {
772
+ return func.call(context, child, count++);
773
+ });
774
+ return result;
775
+ }
776
+ function lazyInitializer(payload) {
777
+ if (-1 === payload._status) {
778
+ var ctor = payload._result;
779
+ ctor = ctor();
780
+ ctor.then(
781
+ function(moduleObject) {
782
+ if (0 === payload._status || -1 === payload._status)
783
+ payload._status = 1, payload._result = moduleObject;
784
+ },
785
+ function(error) {
786
+ if (0 === payload._status || -1 === payload._status)
787
+ payload._status = 2, payload._result = error;
788
+ }
789
+ );
790
+ -1 === payload._status && (payload._status = 0, payload._result = ctor);
791
+ }
792
+ if (1 === payload._status)
793
+ return ctor = payload._result, void 0 === ctor && console.error(
794
+ "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?",
795
+ ctor
796
+ ), "default" in ctor || console.error(
797
+ "lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))",
798
+ ctor
799
+ ), ctor.default;
800
+ throw payload._result;
801
+ }
802
+ function resolveDispatcher() {
803
+ var dispatcher = ReactSharedInternals.H;
804
+ null === dispatcher && console.error(
805
+ "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."
806
+ );
807
+ return dispatcher;
808
+ }
809
+ function noop() {
810
+ }
811
+ function enqueueTask(task) {
812
+ if (null === enqueueTaskImpl)
813
+ try {
814
+ var requireString = ("require" + Math.random()).slice(0, 7);
815
+ enqueueTaskImpl = (module && module[requireString]).call(
816
+ module,
817
+ "timers"
818
+ ).setImmediate;
819
+ } catch (_err) {
820
+ enqueueTaskImpl = function(callback) {
821
+ false === didWarnAboutMessageChannel && (didWarnAboutMessageChannel = true, "undefined" === typeof MessageChannel && console.error(
822
+ "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."
823
+ ));
824
+ var channel = new MessageChannel();
825
+ channel.port1.onmessage = callback;
826
+ channel.port2.postMessage(void 0);
827
+ };
828
+ }
829
+ return enqueueTaskImpl(task);
830
+ }
831
+ function aggregateErrors(errors) {
832
+ return 1 < errors.length && "function" === typeof AggregateError ? new AggregateError(errors) : errors[0];
833
+ }
834
+ function popActScope(prevActQueue, prevActScopeDepth) {
835
+ prevActScopeDepth !== actScopeDepth - 1 && console.error(
836
+ "You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "
837
+ );
838
+ actScopeDepth = prevActScopeDepth;
839
+ }
840
+ function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
841
+ var queue = ReactSharedInternals.actQueue;
842
+ if (null !== queue)
843
+ if (0 !== queue.length)
844
+ try {
845
+ flushActQueue(queue);
846
+ enqueueTask(function() {
847
+ return recursivelyFlushAsyncActWork(returnValue, resolve, reject);
848
+ });
849
+ return;
850
+ } catch (error) {
851
+ ReactSharedInternals.thrownErrors.push(error);
852
+ }
853
+ else ReactSharedInternals.actQueue = null;
854
+ 0 < ReactSharedInternals.thrownErrors.length ? (queue = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(queue)) : resolve(returnValue);
855
+ }
856
+ function flushActQueue(queue) {
857
+ if (!isFlushing) {
858
+ isFlushing = true;
859
+ var i = 0;
860
+ try {
861
+ for (; i < queue.length; i++) {
862
+ var callback = queue[i];
863
+ do {
864
+ ReactSharedInternals.didUsePromise = false;
865
+ var continuation = callback(false);
866
+ if (null !== continuation) {
867
+ if (ReactSharedInternals.didUsePromise) {
868
+ queue[i] = callback;
869
+ queue.splice(0, i);
870
+ return;
871
+ }
872
+ callback = continuation;
873
+ } else break;
874
+ } while (1);
875
+ }
876
+ queue.length = 0;
877
+ } catch (error) {
878
+ queue.splice(0, i + 1), ReactSharedInternals.thrownErrors.push(error);
879
+ } finally {
880
+ isFlushing = false;
881
+ }
882
+ }
883
+ }
884
+ "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
885
+ var REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = /* @__PURE__ */ Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = /* @__PURE__ */ Symbol.for("react.profiler");
886
+ var REACT_CONSUMER_TYPE = /* @__PURE__ */ Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = /* @__PURE__ */ Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo"), REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = /* @__PURE__ */ Symbol.for("react.activity"), MAYBE_ITERATOR_SYMBOL = Symbol.iterator, didWarnStateUpdateForUnmountedComponent = {}, ReactNoopUpdateQueue = {
887
+ isMounted: function() {
888
+ return false;
889
+ },
890
+ enqueueForceUpdate: function(publicInstance) {
891
+ warnNoop(publicInstance, "forceUpdate");
892
+ },
893
+ enqueueReplaceState: function(publicInstance) {
894
+ warnNoop(publicInstance, "replaceState");
895
+ },
896
+ enqueueSetState: function(publicInstance) {
897
+ warnNoop(publicInstance, "setState");
898
+ }
899
+ }, assign = Object.assign, emptyObject = {};
900
+ Object.freeze(emptyObject);
901
+ Component.prototype.isReactComponent = {};
902
+ Component.prototype.setState = function(partialState, callback) {
903
+ if ("object" !== typeof partialState && "function" !== typeof partialState && null != partialState)
904
+ throw Error(
905
+ "takes an object of state variables to update or a function which returns an object of state variables."
906
+ );
907
+ this.updater.enqueueSetState(this, partialState, callback, "setState");
908
+ };
909
+ Component.prototype.forceUpdate = function(callback) {
910
+ this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
911
+ };
912
+ var deprecatedAPIs = {
913
+ isMounted: [
914
+ "isMounted",
915
+ "Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."
916
+ ],
917
+ replaceState: [
918
+ "replaceState",
919
+ "Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."
920
+ ]
921
+ }, fnName;
922
+ for (fnName in deprecatedAPIs)
923
+ deprecatedAPIs.hasOwnProperty(fnName) && defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
924
+ ComponentDummy.prototype = Component.prototype;
925
+ deprecatedAPIs = PureComponent.prototype = new ComponentDummy();
926
+ deprecatedAPIs.constructor = PureComponent;
927
+ assign(deprecatedAPIs, Component.prototype);
928
+ deprecatedAPIs.isPureReactComponent = true;
929
+ var isArrayImpl = Array.isArray, REACT_CLIENT_REFERENCE = /* @__PURE__ */ Symbol.for("react.client.reference"), ReactSharedInternals = {
930
+ H: null,
931
+ A: null,
932
+ T: null,
933
+ S: null,
934
+ V: null,
935
+ actQueue: null,
936
+ isBatchingLegacy: false,
937
+ didScheduleLegacyUpdate: false,
938
+ didUsePromise: false,
939
+ thrownErrors: [],
940
+ getCurrentStack: null,
941
+ recentlyCreatedOwnerStacks: 0
942
+ }, hasOwnProperty = Object.prototype.hasOwnProperty, createTask = console.createTask ? console.createTask : function() {
943
+ return null;
944
+ };
945
+ deprecatedAPIs = {
946
+ react_stack_bottom_frame: function(callStackForError) {
947
+ return callStackForError();
948
+ }
949
+ };
950
+ var specialPropKeyWarningShown, didWarnAboutOldJSXRuntime;
951
+ var didWarnAboutElementRef = {};
952
+ var unknownOwnerDebugStack = deprecatedAPIs.react_stack_bottom_frame.bind(
953
+ deprecatedAPIs,
954
+ UnknownOwner
955
+ )();
956
+ var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
957
+ var didWarnAboutMaps = false, userProvidedKeyEscapeRegex = /\/+/g, reportGlobalError = "function" === typeof reportError ? reportError : function(error) {
958
+ if ("object" === typeof window && "function" === typeof window.ErrorEvent) {
959
+ var event = new window.ErrorEvent("error", {
960
+ bubbles: true,
961
+ cancelable: true,
962
+ message: "object" === typeof error && null !== error && "string" === typeof error.message ? String(error.message) : String(error),
963
+ error
964
+ });
965
+ if (!window.dispatchEvent(event)) return;
966
+ } else if ("object" === typeof process && "function" === typeof process.emit) {
967
+ process.emit("uncaughtException", error);
968
+ return;
969
+ }
970
+ console.error(error);
971
+ }, didWarnAboutMessageChannel = false, enqueueTaskImpl = null, actScopeDepth = 0, didWarnNoAwaitAct = false, isFlushing = false, queueSeveralMicrotasks = "function" === typeof queueMicrotask ? function(callback) {
972
+ queueMicrotask(function() {
973
+ return queueMicrotask(callback);
974
+ });
975
+ } : enqueueTask;
976
+ deprecatedAPIs = Object.freeze({
977
+ __proto__: null,
978
+ c: function(size) {
979
+ return resolveDispatcher().useMemoCache(size);
980
+ }
981
+ });
982
+ exports$1.Children = {
983
+ map: mapChildren,
984
+ forEach: function(children, forEachFunc, forEachContext) {
985
+ mapChildren(
986
+ children,
987
+ function() {
988
+ forEachFunc.apply(this, arguments);
989
+ },
990
+ forEachContext
991
+ );
992
+ },
993
+ count: function(children) {
994
+ var n = 0;
995
+ mapChildren(children, function() {
996
+ n++;
997
+ });
998
+ return n;
999
+ },
1000
+ toArray: function(children) {
1001
+ return mapChildren(children, function(child) {
1002
+ return child;
1003
+ }) || [];
1004
+ },
1005
+ only: function(children) {
1006
+ if (!isValidElement(children))
1007
+ throw Error(
1008
+ "React.Children.only expected to receive a single React element child."
1009
+ );
1010
+ return children;
1011
+ }
1012
+ };
1013
+ exports$1.Component = Component;
1014
+ exports$1.Fragment = REACT_FRAGMENT_TYPE;
1015
+ exports$1.Profiler = REACT_PROFILER_TYPE;
1016
+ exports$1.PureComponent = PureComponent;
1017
+ exports$1.StrictMode = REACT_STRICT_MODE_TYPE;
1018
+ exports$1.Suspense = REACT_SUSPENSE_TYPE;
1019
+ exports$1.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals;
1020
+ exports$1.__COMPILER_RUNTIME = deprecatedAPIs;
1021
+ exports$1.act = function(callback) {
1022
+ var prevActQueue = ReactSharedInternals.actQueue, prevActScopeDepth = actScopeDepth;
1023
+ actScopeDepth++;
1024
+ var queue = ReactSharedInternals.actQueue = null !== prevActQueue ? prevActQueue : [], didAwaitActCall = false;
1025
+ try {
1026
+ var result = callback();
1027
+ } catch (error) {
1028
+ ReactSharedInternals.thrownErrors.push(error);
1029
+ }
1030
+ if (0 < ReactSharedInternals.thrownErrors.length)
1031
+ throw popActScope(prevActQueue, prevActScopeDepth), callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
1032
+ if (null !== result && "object" === typeof result && "function" === typeof result.then) {
1033
+ var thenable = result;
1034
+ queueSeveralMicrotasks(function() {
1035
+ didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error(
1036
+ "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 () => ...);"
1037
+ ));
1038
+ });
1039
+ return {
1040
+ then: function(resolve, reject) {
1041
+ didAwaitActCall = true;
1042
+ thenable.then(
1043
+ function(returnValue) {
1044
+ popActScope(prevActQueue, prevActScopeDepth);
1045
+ if (0 === prevActScopeDepth) {
1046
+ try {
1047
+ flushActQueue(queue), enqueueTask(function() {
1048
+ return recursivelyFlushAsyncActWork(
1049
+ returnValue,
1050
+ resolve,
1051
+ reject
1052
+ );
1053
+ });
1054
+ } catch (error$0) {
1055
+ ReactSharedInternals.thrownErrors.push(error$0);
1056
+ }
1057
+ if (0 < ReactSharedInternals.thrownErrors.length) {
1058
+ var _thrownError = aggregateErrors(
1059
+ ReactSharedInternals.thrownErrors
1060
+ );
1061
+ ReactSharedInternals.thrownErrors.length = 0;
1062
+ reject(_thrownError);
1063
+ }
1064
+ } else resolve(returnValue);
1065
+ },
1066
+ function(error) {
1067
+ popActScope(prevActQueue, prevActScopeDepth);
1068
+ 0 < ReactSharedInternals.thrownErrors.length ? (error = aggregateErrors(
1069
+ ReactSharedInternals.thrownErrors
1070
+ ), ReactSharedInternals.thrownErrors.length = 0, reject(error)) : reject(error);
1071
+ }
1072
+ );
1073
+ }
1074
+ };
1075
+ }
1076
+ var returnValue$jscomp$0 = result;
1077
+ popActScope(prevActQueue, prevActScopeDepth);
1078
+ 0 === prevActScopeDepth && (flushActQueue(queue), 0 !== queue.length && queueSeveralMicrotasks(function() {
1079
+ didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error(
1080
+ "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(() => ...)"
1081
+ ));
1082
+ }), ReactSharedInternals.actQueue = null);
1083
+ if (0 < ReactSharedInternals.thrownErrors.length)
1084
+ throw callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
1085
+ return {
1086
+ then: function(resolve, reject) {
1087
+ didAwaitActCall = true;
1088
+ 0 === prevActScopeDepth ? (ReactSharedInternals.actQueue = queue, enqueueTask(function() {
1089
+ return recursivelyFlushAsyncActWork(
1090
+ returnValue$jscomp$0,
1091
+ resolve,
1092
+ reject
1093
+ );
1094
+ })) : resolve(returnValue$jscomp$0);
1095
+ }
1096
+ };
1097
+ };
1098
+ exports$1.cache = function(fn) {
1099
+ return function() {
1100
+ return fn.apply(null, arguments);
1101
+ };
1102
+ };
1103
+ exports$1.captureOwnerStack = function() {
1104
+ var getCurrentStack = ReactSharedInternals.getCurrentStack;
1105
+ return null === getCurrentStack ? null : getCurrentStack();
1106
+ };
1107
+ exports$1.cloneElement = function(element, config, children) {
1108
+ if (null === element || void 0 === element)
1109
+ throw Error(
1110
+ "The argument must be a React element, but you passed " + element + "."
1111
+ );
1112
+ var props = assign({}, element.props), key = element.key, owner = element._owner;
1113
+ if (null != config) {
1114
+ var JSCompiler_inline_result;
1115
+ a: {
1116
+ if (hasOwnProperty.call(config, "ref") && (JSCompiler_inline_result = Object.getOwnPropertyDescriptor(
1117
+ config,
1118
+ "ref"
1119
+ ).get) && JSCompiler_inline_result.isReactWarning) {
1120
+ JSCompiler_inline_result = false;
1121
+ break a;
1122
+ }
1123
+ JSCompiler_inline_result = void 0 !== config.ref;
1124
+ }
1125
+ JSCompiler_inline_result && (owner = getOwner());
1126
+ hasValidKey(config) && (checkKeyStringCoercion(config.key), key = "" + config.key);
1127
+ for (propName in config)
1128
+ !hasOwnProperty.call(config, propName) || "key" === propName || "__self" === propName || "__source" === propName || "ref" === propName && void 0 === config.ref || (props[propName] = config[propName]);
1129
+ }
1130
+ var propName = arguments.length - 2;
1131
+ if (1 === propName) props.children = children;
1132
+ else if (1 < propName) {
1133
+ JSCompiler_inline_result = Array(propName);
1134
+ for (var i = 0; i < propName; i++)
1135
+ JSCompiler_inline_result[i] = arguments[i + 2];
1136
+ props.children = JSCompiler_inline_result;
1137
+ }
1138
+ props = ReactElement(
1139
+ element.type,
1140
+ key,
1141
+ void 0,
1142
+ void 0,
1143
+ owner,
1144
+ props,
1145
+ element._debugStack,
1146
+ element._debugTask
1147
+ );
1148
+ for (key = 2; key < arguments.length; key++)
1149
+ owner = arguments[key], isValidElement(owner) && owner._store && (owner._store.validated = 1);
1150
+ return props;
1151
+ };
1152
+ exports$1.createContext = function(defaultValue) {
1153
+ defaultValue = {
1154
+ $$typeof: REACT_CONTEXT_TYPE,
1155
+ _currentValue: defaultValue,
1156
+ _currentValue2: defaultValue,
1157
+ _threadCount: 0,
1158
+ Provider: null,
1159
+ Consumer: null
1160
+ };
1161
+ defaultValue.Provider = defaultValue;
1162
+ defaultValue.Consumer = {
1163
+ $$typeof: REACT_CONSUMER_TYPE,
1164
+ _context: defaultValue
1165
+ };
1166
+ defaultValue._currentRenderer = null;
1167
+ defaultValue._currentRenderer2 = null;
1168
+ return defaultValue;
1169
+ };
1170
+ exports$1.createElement = function(type, config, children) {
1171
+ for (var i = 2; i < arguments.length; i++) {
1172
+ var node = arguments[i];
1173
+ isValidElement(node) && node._store && (node._store.validated = 1);
1174
+ }
1175
+ i = {};
1176
+ node = null;
1177
+ if (null != config)
1178
+ for (propName in didWarnAboutOldJSXRuntime || !("__self" in config) || "key" in config || (didWarnAboutOldJSXRuntime = true, console.warn(
1179
+ "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"
1180
+ )), hasValidKey(config) && (checkKeyStringCoercion(config.key), node = "" + config.key), config)
1181
+ hasOwnProperty.call(config, propName) && "key" !== propName && "__self" !== propName && "__source" !== propName && (i[propName] = config[propName]);
1182
+ var childrenLength = arguments.length - 2;
1183
+ if (1 === childrenLength) i.children = children;
1184
+ else if (1 < childrenLength) {
1185
+ for (var childArray = Array(childrenLength), _i = 0; _i < childrenLength; _i++)
1186
+ childArray[_i] = arguments[_i + 2];
1187
+ Object.freeze && Object.freeze(childArray);
1188
+ i.children = childArray;
1189
+ }
1190
+ if (type && type.defaultProps)
1191
+ for (propName in childrenLength = type.defaultProps, childrenLength)
1192
+ void 0 === i[propName] && (i[propName] = childrenLength[propName]);
1193
+ node && defineKeyPropWarningGetter(
1194
+ i,
1195
+ "function" === typeof type ? type.displayName || type.name || "Unknown" : type
1196
+ );
1197
+ var propName = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
1198
+ return ReactElement(
1199
+ type,
1200
+ node,
1201
+ void 0,
1202
+ void 0,
1203
+ getOwner(),
1204
+ i,
1205
+ propName ? Error("react-stack-top-frame") : unknownOwnerDebugStack,
1206
+ propName ? createTask(getTaskName(type)) : unknownOwnerDebugTask
1207
+ );
1208
+ };
1209
+ exports$1.createRef = function() {
1210
+ var refObject = { current: null };
1211
+ Object.seal(refObject);
1212
+ return refObject;
1213
+ };
1214
+ exports$1.forwardRef = function(render) {
1215
+ null != render && render.$$typeof === REACT_MEMO_TYPE ? console.error(
1216
+ "forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."
1217
+ ) : "function" !== typeof render ? console.error(
1218
+ "forwardRef requires a render function but was given %s.",
1219
+ null === render ? "null" : typeof render
1220
+ ) : 0 !== render.length && 2 !== render.length && console.error(
1221
+ "forwardRef render functions accept exactly two parameters: props and ref. %s",
1222
+ 1 === render.length ? "Did you forget to use the ref parameter?" : "Any additional parameter will be undefined."
1223
+ );
1224
+ null != render && null != render.defaultProps && console.error(
1225
+ "forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?"
1226
+ );
1227
+ var elementType = { $$typeof: REACT_FORWARD_REF_TYPE, render }, ownName;
1228
+ Object.defineProperty(elementType, "displayName", {
1229
+ enumerable: false,
1230
+ configurable: true,
1231
+ get: function() {
1232
+ return ownName;
1233
+ },
1234
+ set: function(name) {
1235
+ ownName = name;
1236
+ render.name || render.displayName || (Object.defineProperty(render, "name", { value: name }), render.displayName = name);
1237
+ }
1238
+ });
1239
+ return elementType;
1240
+ };
1241
+ exports$1.isValidElement = isValidElement;
1242
+ exports$1.lazy = function(ctor) {
1243
+ return {
1244
+ $$typeof: REACT_LAZY_TYPE,
1245
+ _payload: { _status: -1, _result: ctor },
1246
+ _init: lazyInitializer
1247
+ };
1248
+ };
1249
+ exports$1.memo = function(type, compare) {
1250
+ null == type && console.error(
1251
+ "memo: The first argument must be a component. Instead received: %s",
1252
+ null === type ? "null" : typeof type
1253
+ );
1254
+ compare = {
1255
+ $$typeof: REACT_MEMO_TYPE,
1256
+ type,
1257
+ compare: void 0 === compare ? null : compare
1258
+ };
1259
+ var ownName;
1260
+ Object.defineProperty(compare, "displayName", {
1261
+ enumerable: false,
1262
+ configurable: true,
1263
+ get: function() {
1264
+ return ownName;
1265
+ },
1266
+ set: function(name) {
1267
+ ownName = name;
1268
+ type.name || type.displayName || (Object.defineProperty(type, "name", { value: name }), type.displayName = name);
1269
+ }
1270
+ });
1271
+ return compare;
1272
+ };
1273
+ exports$1.startTransition = function(scope) {
1274
+ var prevTransition = ReactSharedInternals.T, currentTransition = {};
1275
+ ReactSharedInternals.T = currentTransition;
1276
+ currentTransition._updatedFibers = /* @__PURE__ */ new Set();
1277
+ try {
1278
+ var returnValue = scope(), onStartTransitionFinish = ReactSharedInternals.S;
1279
+ null !== onStartTransitionFinish && onStartTransitionFinish(currentTransition, returnValue);
1280
+ "object" === typeof returnValue && null !== returnValue && "function" === typeof returnValue.then && returnValue.then(noop, reportGlobalError);
1281
+ } catch (error) {
1282
+ reportGlobalError(error);
1283
+ } finally {
1284
+ null === prevTransition && currentTransition._updatedFibers && (scope = currentTransition._updatedFibers.size, currentTransition._updatedFibers.clear(), 10 < scope && console.warn(
1285
+ "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."
1286
+ )), ReactSharedInternals.T = prevTransition;
1287
+ }
1288
+ };
1289
+ exports$1.unstable_useCacheRefresh = function() {
1290
+ return resolveDispatcher().useCacheRefresh();
1291
+ };
1292
+ exports$1.use = function(usable) {
1293
+ return resolveDispatcher().use(usable);
1294
+ };
1295
+ exports$1.useActionState = function(action, initialState, permalink) {
1296
+ return resolveDispatcher().useActionState(
1297
+ action,
1298
+ initialState,
1299
+ permalink
1300
+ );
1301
+ };
1302
+ exports$1.useCallback = function(callback, deps) {
1303
+ return resolveDispatcher().useCallback(callback, deps);
1304
+ };
1305
+ exports$1.useContext = function(Context) {
1306
+ var dispatcher = resolveDispatcher();
1307
+ Context.$$typeof === REACT_CONSUMER_TYPE && console.error(
1308
+ "Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"
1309
+ );
1310
+ return dispatcher.useContext(Context);
1311
+ };
1312
+ exports$1.useDebugValue = function(value, formatterFn) {
1313
+ return resolveDispatcher().useDebugValue(value, formatterFn);
1314
+ };
1315
+ exports$1.useDeferredValue = function(value, initialValue) {
1316
+ return resolveDispatcher().useDeferredValue(value, initialValue);
1317
+ };
1318
+ exports$1.useEffect = function(create, createDeps, update) {
1319
+ null == create && console.warn(
1320
+ "React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?"
1321
+ );
1322
+ var dispatcher = resolveDispatcher();
1323
+ if ("function" === typeof update)
1324
+ throw Error(
1325
+ "useEffect CRUD overload is not enabled in this build of React."
1326
+ );
1327
+ return dispatcher.useEffect(create, createDeps);
1328
+ };
1329
+ exports$1.useId = function() {
1330
+ return resolveDispatcher().useId();
1331
+ };
1332
+ exports$1.useImperativeHandle = function(ref, create, deps) {
1333
+ return resolveDispatcher().useImperativeHandle(ref, create, deps);
1334
+ };
1335
+ exports$1.useInsertionEffect = function(create, deps) {
1336
+ null == create && console.warn(
1337
+ "React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"
1338
+ );
1339
+ return resolveDispatcher().useInsertionEffect(create, deps);
1340
+ };
1341
+ exports$1.useLayoutEffect = function(create, deps) {
1342
+ null == create && console.warn(
1343
+ "React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"
1344
+ );
1345
+ return resolveDispatcher().useLayoutEffect(create, deps);
1346
+ };
1347
+ exports$1.useMemo = function(create, deps) {
1348
+ return resolveDispatcher().useMemo(create, deps);
1349
+ };
1350
+ exports$1.useOptimistic = function(passthrough, reducer) {
1351
+ return resolveDispatcher().useOptimistic(passthrough, reducer);
1352
+ };
1353
+ exports$1.useReducer = function(reducer, initialArg, init) {
1354
+ return resolveDispatcher().useReducer(reducer, initialArg, init);
1355
+ };
1356
+ exports$1.useRef = function(initialValue) {
1357
+ return resolveDispatcher().useRef(initialValue);
1358
+ };
1359
+ exports$1.useState = function(initialState) {
1360
+ return resolveDispatcher().useState(initialState);
1361
+ };
1362
+ exports$1.useSyncExternalStore = function(subscribe, getSnapshot, getServerSnapshot) {
1363
+ return resolveDispatcher().useSyncExternalStore(
1364
+ subscribe,
1365
+ getSnapshot,
1366
+ getServerSnapshot
1367
+ );
1368
+ };
1369
+ exports$1.useTransition = function() {
1370
+ return resolveDispatcher().useTransition();
1371
+ };
1372
+ exports$1.version = "19.1.1";
1373
+ "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
1374
+ })();
1375
+ })(react_development, react_development.exports);
1376
+ return react_development.exports;
1377
+ }
1378
+ var hasRequiredReact;
1379
+ function requireReact() {
1380
+ if (hasRequiredReact) return react.exports;
1381
+ hasRequiredReact = 1;
1382
+ if (process.env.NODE_ENV === "production") {
1383
+ react.exports = requireReact_production();
1384
+ } else {
1385
+ react.exports = requireReact_development();
1386
+ }
1387
+ return react.exports;
1388
+ }
1389
+ requireReact();
1390
+ var ConnectionStatus = /* @__PURE__ */ ((ConnectionStatus2) => {
1391
+ ConnectionStatus2["CONNECTING"] = "connecting";
1392
+ ConnectionStatus2["CONNECTED"] = "connected";
1393
+ ConnectionStatus2["DISCONNECTED"] = "disconnected";
1394
+ ConnectionStatus2["RECONNECTING"] = "reconnecting";
1395
+ ConnectionStatus2["ERROR"] = "error";
1396
+ return ConnectionStatus2;
1397
+ })(ConnectionStatus || {});
1398
+ class SocketConnection {
1399
+ static instance = null;
1400
+ socket = null;
1401
+ config;
1402
+ status = ConnectionStatus.DISCONNECTED;
1403
+ reconnectAttempts = 0;
1404
+ reconnectTimer = null;
1405
+ heartbeatTimer = null;
1406
+ eventListeners = {};
1407
+ constructor(config) {
1408
+ this.config = {
1409
+ reconnectInterval: 3e3,
1410
+ maxReconnectAttempts: 5,
1411
+ heartbeatInterval: 3e4,
1412
+ debug: false,
1413
+ ...config
1414
+ };
1415
+ }
1416
+ /**
1417
+ * 获取单例实例
1418
+ */
1419
+ static getInstance(config) {
1420
+ if (!SocketConnection.instance) {
1421
+ if (!config) {
1422
+ throw new Error("首次创建SocketConnection实例时必须提供配置");
1423
+ }
1424
+ SocketConnection.instance = new SocketConnection(config);
1425
+ } else if (config) {
1426
+ if (JSON.stringify(SocketConnection.instance.config) !== JSON.stringify(config)) {
1427
+ SocketConnection.instance = new SocketConnection(config);
1428
+ }
1429
+ if (config) {
1430
+ SocketConnection.instance.config = {
1431
+ ...SocketConnection.instance.config,
1432
+ ...config
1433
+ };
1434
+ }
1435
+ }
1436
+ return SocketConnection.instance;
1437
+ }
1438
+ /**
1439
+ * 连接WebSocket
1440
+ */
1441
+ connect(config) {
1442
+ this.config = {
1443
+ ...this.config,
1444
+ ...config
1445
+ };
1446
+ return new Promise((resolve, reject) => {
1447
+ if (this.socket?.readyState === WebSocket.OPEN) {
1448
+ resolve();
1449
+ return;
1450
+ }
1451
+ const url = this.config.url + (this.config?.params ? `?${Object.entries(this.config.params).map(([key, value]) => `${key}=${value}`).join("&")}` : "");
1452
+ if (url) {
1453
+ this.setStatus(ConnectionStatus.CONNECTING);
1454
+ this.log("正在连接WebSocket...", url);
1455
+ try {
1456
+ this.socket = new WebSocket(url, this.config.protocols);
1457
+ this.setupEventListeners();
1458
+ this.socket.onopen = () => {
1459
+ this.log("WebSocket连接成功");
1460
+ this.setStatus(ConnectionStatus.CONNECTED);
1461
+ this.reconnectAttempts = 0;
1462
+ this.startHeartbeat();
1463
+ this.eventListeners.open?.();
1464
+ resolve();
1465
+ };
1466
+ this.socket.onerror = (error) => {
1467
+ this.log("WebSocket连接错误:", error);
1468
+ this.setStatus(ConnectionStatus.ERROR);
1469
+ this.eventListeners.error?.(error);
1470
+ reject(error);
1471
+ };
1472
+ } catch (error) {
1473
+ this.log("创建WebSocket连接失败:", error);
1474
+ this.setStatus(ConnectionStatus.ERROR);
1475
+ reject(error);
1476
+ }
1477
+ }
1478
+ });
1479
+ }
1480
+ /**
1481
+ * 断开连接
1482
+ */
1483
+ disconnect() {
1484
+ this.log("正在断开WebSocket连接...");
1485
+ this.stopHeartbeat();
1486
+ this.clearReconnectTimer();
1487
+ if (this.socket) {
1488
+ this.socket.close(1e3, "主动断开连接");
1489
+ this.socket = null;
1490
+ }
1491
+ this.setStatus(ConnectionStatus.DISCONNECTED);
1492
+ }
1493
+ /**
1494
+ * 发送消息
1495
+ */
1496
+ send(data) {
1497
+ if (this.socket?.readyState === WebSocket.OPEN) {
1498
+ this.socket.send(data);
1499
+ this.log("发送消息:", data);
1500
+ return true;
1501
+ } else {
1502
+ this.log("WebSocket未连接,无法发送消息");
1503
+ return false;
1504
+ }
1505
+ }
1506
+ /**
1507
+ * 发送JSON消息
1508
+ */
1509
+ sendJSON(data) {
1510
+ return this.send(JSON.stringify(data));
1511
+ }
1512
+ /**
1513
+ * 添加事件监听器
1514
+ */
1515
+ on(event, listener) {
1516
+ this.eventListeners[event] = listener;
1517
+ }
1518
+ /**
1519
+ * 移除事件监听器
1520
+ */
1521
+ off(event) {
1522
+ delete this.eventListeners[event];
1523
+ }
1524
+ /**
1525
+ * 获取连接状态
1526
+ */
1527
+ getStatus() {
1528
+ return this.status;
1529
+ }
1530
+ /**
1531
+ * 检查是否已连接
1532
+ */
1533
+ isConnected() {
1534
+ return this.status === ConnectionStatus.CONNECTED && this.socket?.readyState === WebSocket.OPEN;
1535
+ }
1536
+ /**
1537
+ * 设置事件监听器
1538
+ */
1539
+ setupEventListeners() {
1540
+ if (!this.socket) return;
1541
+ this.socket.onmessage = (event) => {
1542
+ this.log("收到消息:", event.data);
1543
+ if (event.data !== "pong") {
1544
+ this.eventListeners.message?.(event.data);
1545
+ }
1546
+ };
1547
+ this.socket.onclose = (event) => {
1548
+ this.log("WebSocket连接关闭:", event.code, event.reason);
1549
+ this.setStatus(ConnectionStatus.DISCONNECTED);
1550
+ this.stopHeartbeat();
1551
+ this.eventListeners.close?.(event);
1552
+ if (event.code !== 1e3 && this.reconnectAttempts < (this.config.maxReconnectAttempts || 5)) {
1553
+ this.scheduleReconnect();
1554
+ }
1555
+ };
1556
+ this.socket.onerror = (error) => {
1557
+ this.log("WebSocket错误:", error);
1558
+ this.setStatus(ConnectionStatus.ERROR);
1559
+ this.eventListeners.error?.(error);
1560
+ };
1561
+ }
1562
+ /**
1563
+ * 设置连接状态
1564
+ */
1565
+ setStatus(status) {
1566
+ if (this.status !== status) {
1567
+ this.status = status;
1568
+ this.log("连接状态变更:", status);
1569
+ this.eventListeners.statusChange?.(status);
1570
+ }
1571
+ }
1572
+ /**
1573
+ * 安排重连
1574
+ */
1575
+ scheduleReconnect() {
1576
+ if (this.reconnectTimer) return;
1577
+ this.reconnectAttempts++;
1578
+ this.setStatus(ConnectionStatus.RECONNECTING);
1579
+ this.log(`准备重连 (第${this.reconnectAttempts}次)...`);
1580
+ this.reconnectTimer = setTimeout(() => {
1581
+ this.reconnectTimer = null;
1582
+ this.connect().catch(() => {
1583
+ });
1584
+ }, this.config.reconnectInterval || 3e3);
1585
+ }
1586
+ /**
1587
+ * 清除重连定时器
1588
+ */
1589
+ clearReconnectTimer() {
1590
+ if (this.reconnectTimer) {
1591
+ clearTimeout(this.reconnectTimer);
1592
+ this.reconnectTimer = null;
1593
+ }
1594
+ }
1595
+ /**
1596
+ * 开始心跳检测
1597
+ */
1598
+ startHeartbeat() {
1599
+ this.stopHeartbeat();
1600
+ if (this.config.heartbeatInterval && this.config.heartbeatInterval > 0) {
1601
+ this.heartbeatTimer = setInterval(() => {
1602
+ if (this.isConnected()) {
1603
+ this.send("ping");
1604
+ }
1605
+ }, this.config.heartbeatInterval);
1606
+ }
1607
+ }
1608
+ /**
1609
+ * 停止心跳检测
1610
+ */
1611
+ stopHeartbeat() {
1612
+ if (this.heartbeatTimer) {
1613
+ clearInterval(this.heartbeatTimer);
1614
+ this.heartbeatTimer = null;
1615
+ }
1616
+ }
1617
+ /**
1618
+ * 日志输出
1619
+ */
1620
+ log(...args) {
1621
+ if (this.config.debug) {
1622
+ console.log("[SocketConnection]", ...args);
1623
+ }
1624
+ }
1625
+ /**
1626
+ * 销毁实例
1627
+ */
1628
+ destroy() {
1629
+ this.disconnect();
1630
+ this.eventListeners = {};
1631
+ SocketConnection.instance = null;
1632
+ }
1633
+ }
1634
+ let socket = null;
1635
+ self.onmessage = (event) => {
1636
+ const { type, data } = event?.data || {};
1637
+ switch (type) {
1638
+ case "INIT":
1639
+ socket = SocketConnection.getInstance({ url: data?.url, debug: data?.debug ?? true });
1640
+ socket?.connect();
1641
+ socket?.on("open", () => {
1642
+ self.postMessage({ type: "INIT_OK" });
1643
+ });
1644
+ socket?.on("message", (msg) => {
1645
+ self.postMessage({ type: "RECEIVE_MESSAGE", data: msg });
1646
+ });
1647
+ break;
1648
+ case "SEND_MESSAGE":
1649
+ socket?.send(JSON.stringify(data));
1650
+ break;
1651
+ case "CLOSE":
1652
+ socket?.disconnect();
1653
+ socket = null;
1654
+ break;
1655
+ }
1656
+ };