@hot-updater/react-native 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/HotUpdater.podspec +1 -2
  2. package/android/build.gradle +16 -3
  3. package/android/generated/java/com/hotupdater/NativeHotUpdaterSpec.java +54 -0
  4. package/android/generated/jni/CMakeLists.txt +36 -0
  5. package/android/generated/jni/HotUpdaterSpec-generated.cpp +56 -0
  6. package/android/generated/jni/HotUpdaterSpec.h +31 -0
  7. package/android/generated/jni/react/renderer/components/HotUpdaterSpec/HotUpdaterSpecJSI-generated.cpp +57 -0
  8. package/android/generated/jni/react/renderer/components/HotUpdaterSpec/HotUpdaterSpecJSI.h +103 -0
  9. package/android/react-native-helpers.gradle +42 -0
  10. package/android/src/main/java/com/hotupdater/HotUpdater.kt +151 -240
  11. package/android/src/main/java/com/hotupdater/HotUpdaterModule.kt +52 -40
  12. package/android/src/main/java/com/hotupdater/HotUpdaterPackage.kt +25 -24
  13. package/android/src/main/java/com/hotupdater/ReactIntegrationManagerBase.kt +34 -0
  14. package/android/src/newarch/HotUpdaterSpec.kt +3 -2
  15. package/android/src/newarch/ReactIntegrationManager.kt +46 -0
  16. package/android/src/oldarch/HotUpdaterSpec.kt +12 -8
  17. package/android/src/oldarch/ReactIntegrationManager.kt +41 -0
  18. package/dist/index.d.mts +71 -0
  19. package/dist/index.d.ts +43 -52
  20. package/dist/index.js +2366 -139
  21. package/dist/index.mjs +2411 -0
  22. package/ios/HotUpdater/HotUpdater.h +8 -4
  23. package/ios/HotUpdater/HotUpdater.mm +167 -116
  24. package/ios/generated/HotUpdaterSpec/HotUpdaterSpec-generated.mm +67 -0
  25. package/ios/generated/HotUpdaterSpec/HotUpdaterSpec.h +67 -0
  26. package/ios/generated/HotUpdaterSpecJSI-generated.cpp +57 -0
  27. package/ios/generated/HotUpdaterSpecJSI.h +103 -0
  28. package/package.json +26 -10
  29. package/react-native.config.js +12 -0
  30. package/src/const.ts +1 -0
  31. package/src/ensureBundles.ts +21 -0
  32. package/src/global.d.ts +3 -0
  33. package/src/index.ts +27 -5
  34. package/src/init.tsx +25 -7
  35. package/src/native.ts +50 -42
  36. package/src/specs/{NativeHotUpdaterModule.ts → NativeHotUpdater.ts} +6 -7
  37. package/src/store.ts +48 -0
  38. package/dist/index.cjs +0 -220
  39. package/dist/index.d.cts +0 -80
  40. package/src/checkForUpdate.test.ts +0 -517
  41. package/src/checkForUpdate.ts +0 -111
  42. package/src/utils.ts +0 -2
package/dist/index.js CHANGED
@@ -1,9 +1,2247 @@
1
- // src/checkForUpdate.ts
2
- import { filterTargetVersion } from "@hot-updater/utils";
3
- import { Platform } from "react-native";
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __esm = (fn, res) => function __init() {
9
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
10
+ };
11
+ var __commonJS = (cb, mod) => function __require() {
12
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
13
+ };
14
+ var __export = (target, all) => {
15
+ for (var name in all)
16
+ __defProp(target, name, { get: all[name], enumerable: true });
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") {
20
+ for (let key of __getOwnPropNames(from))
21
+ if (!__hasOwnProp.call(to, key) && key !== except)
22
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
+ }
24
+ return to;
25
+ };
26
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
27
+ // If the importer is in node compatibility mode or this is not an ESM
28
+ // file that has been converted to a CommonJS file using a Babel-
29
+ // compatible transform (i.e. "__esModule" has not been set), then set
30
+ // "default" to the CommonJS "module.exports" for node compatibility.
31
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
32
+ mod
33
+ ));
34
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
4
35
 
5
- // src/native.ts
6
- import { NativeModules } from "react-native";
36
+ // src/specs/NativeHotUpdater.ts
37
+ var NativeHotUpdater_exports = {};
38
+ __export(NativeHotUpdater_exports, {
39
+ default: () => NativeHotUpdater_default
40
+ });
41
+ var import_react_native, NativeHotUpdater_default;
42
+ var init_NativeHotUpdater = __esm({
43
+ "src/specs/NativeHotUpdater.ts"() {
44
+ "use strict";
45
+ import_react_native = require("react-native");
46
+ NativeHotUpdater_default = import_react_native.TurboModuleRegistry.get("HotUpdater");
47
+ }
48
+ });
49
+
50
+ // ../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.production.min.js
51
+ var require_react_production_min = __commonJS({
52
+ "../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.production.min.js"(exports2) {
53
+ "use strict";
54
+ var l = Symbol.for("react.element");
55
+ var n = Symbol.for("react.portal");
56
+ var p = Symbol.for("react.fragment");
57
+ var q = Symbol.for("react.strict_mode");
58
+ var r = Symbol.for("react.profiler");
59
+ var t = Symbol.for("react.provider");
60
+ var u = Symbol.for("react.context");
61
+ var v = Symbol.for("react.forward_ref");
62
+ var w = Symbol.for("react.suspense");
63
+ var x = Symbol.for("react.memo");
64
+ var y = Symbol.for("react.lazy");
65
+ var z = Symbol.iterator;
66
+ function A(a) {
67
+ if (null === a || "object" !== typeof a) return null;
68
+ a = z && a[z] || a["@@iterator"];
69
+ return "function" === typeof a ? a : null;
70
+ }
71
+ var B = { isMounted: function() {
72
+ return false;
73
+ }, enqueueForceUpdate: function() {
74
+ }, enqueueReplaceState: function() {
75
+ }, enqueueSetState: function() {
76
+ } };
77
+ var C = Object.assign;
78
+ var D = {};
79
+ function E(a, b, e) {
80
+ this.props = a;
81
+ this.context = b;
82
+ this.refs = D;
83
+ this.updater = e || B;
84
+ }
85
+ E.prototype.isReactComponent = {};
86
+ E.prototype.setState = function(a, b) {
87
+ if ("object" !== typeof a && "function" !== typeof a && null != a) throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");
88
+ this.updater.enqueueSetState(this, a, b, "setState");
89
+ };
90
+ E.prototype.forceUpdate = function(a) {
91
+ this.updater.enqueueForceUpdate(this, a, "forceUpdate");
92
+ };
93
+ function F() {
94
+ }
95
+ F.prototype = E.prototype;
96
+ function G(a, b, e) {
97
+ this.props = a;
98
+ this.context = b;
99
+ this.refs = D;
100
+ this.updater = e || B;
101
+ }
102
+ var H = G.prototype = new F();
103
+ H.constructor = G;
104
+ C(H, E.prototype);
105
+ H.isPureReactComponent = true;
106
+ var I = Array.isArray;
107
+ var J = Object.prototype.hasOwnProperty;
108
+ var K = { current: null };
109
+ var L = { key: true, ref: true, __self: true, __source: true };
110
+ function M(a, b, e) {
111
+ var d, c = {}, k = null, h = null;
112
+ if (null != b) for (d in void 0 !== b.ref && (h = b.ref), void 0 !== b.key && (k = "" + b.key), b) J.call(b, d) && !L.hasOwnProperty(d) && (c[d] = b[d]);
113
+ var g = arguments.length - 2;
114
+ if (1 === g) c.children = e;
115
+ else if (1 < g) {
116
+ for (var f = Array(g), m = 0; m < g; m++) f[m] = arguments[m + 2];
117
+ c.children = f;
118
+ }
119
+ if (a && a.defaultProps) for (d in g = a.defaultProps, g) void 0 === c[d] && (c[d] = g[d]);
120
+ return { $$typeof: l, type: a, key: k, ref: h, props: c, _owner: K.current };
121
+ }
122
+ function N(a, b) {
123
+ return { $$typeof: l, type: a.type, key: b, ref: a.ref, props: a.props, _owner: a._owner };
124
+ }
125
+ function O(a) {
126
+ return "object" === typeof a && null !== a && a.$$typeof === l;
127
+ }
128
+ function escape(a) {
129
+ var b = { "=": "=0", ":": "=2" };
130
+ return "$" + a.replace(/[=:]/g, function(a2) {
131
+ return b[a2];
132
+ });
133
+ }
134
+ var P = /\/+/g;
135
+ function Q(a, b) {
136
+ return "object" === typeof a && null !== a && null != a.key ? escape("" + a.key) : b.toString(36);
137
+ }
138
+ function R(a, b, e, d, c) {
139
+ var k = typeof a;
140
+ if ("undefined" === k || "boolean" === k) a = null;
141
+ var h = false;
142
+ if (null === a) h = true;
143
+ else switch (k) {
144
+ case "string":
145
+ case "number":
146
+ h = true;
147
+ break;
148
+ case "object":
149
+ switch (a.$$typeof) {
150
+ case l:
151
+ case n:
152
+ h = true;
153
+ }
154
+ }
155
+ if (h) return h = a, c = c(h), a = "" === d ? "." + Q(h, 0) : d, I(c) ? (e = "", null != a && (e = a.replace(P, "$&/") + "/"), R(c, b, e, "", function(a2) {
156
+ return a2;
157
+ })) : null != c && (O(c) && (c = N(c, e + (!c.key || h && h.key === c.key ? "" : ("" + c.key).replace(P, "$&/") + "/") + a)), b.push(c)), 1;
158
+ h = 0;
159
+ d = "" === d ? "." : d + ":";
160
+ if (I(a)) for (var g = 0; g < a.length; g++) {
161
+ k = a[g];
162
+ var f = d + Q(k, g);
163
+ h += R(k, b, e, f, c);
164
+ }
165
+ else if (f = A(a), "function" === typeof f) for (a = f.call(a), g = 0; !(k = a.next()).done; ) k = k.value, f = d + Q(k, g++), h += R(k, b, e, f, c);
166
+ else if ("object" === k) throw b = String(a), Error("Objects are not valid as a React child (found: " + ("[object Object]" === b ? "object with keys {" + Object.keys(a).join(", ") + "}" : b) + "). If you meant to render a collection of children, use an array instead.");
167
+ return h;
168
+ }
169
+ function S(a, b, e) {
170
+ if (null == a) return a;
171
+ var d = [], c = 0;
172
+ R(a, d, "", "", function(a2) {
173
+ return b.call(e, a2, c++);
174
+ });
175
+ return d;
176
+ }
177
+ function T(a) {
178
+ if (-1 === a._status) {
179
+ var b = a._result;
180
+ b = b();
181
+ b.then(function(b2) {
182
+ if (0 === a._status || -1 === a._status) a._status = 1, a._result = b2;
183
+ }, function(b2) {
184
+ if (0 === a._status || -1 === a._status) a._status = 2, a._result = b2;
185
+ });
186
+ -1 === a._status && (a._status = 0, a._result = b);
187
+ }
188
+ if (1 === a._status) return a._result.default;
189
+ throw a._result;
190
+ }
191
+ var U = { current: null };
192
+ var V = { transition: null };
193
+ var W = { ReactCurrentDispatcher: U, ReactCurrentBatchConfig: V, ReactCurrentOwner: K };
194
+ function X() {
195
+ throw Error("act(...) is not supported in production builds of React.");
196
+ }
197
+ exports2.Children = { map: S, forEach: function(a, b, e) {
198
+ S(a, function() {
199
+ b.apply(this, arguments);
200
+ }, e);
201
+ }, count: function(a) {
202
+ var b = 0;
203
+ S(a, function() {
204
+ b++;
205
+ });
206
+ return b;
207
+ }, toArray: function(a) {
208
+ return S(a, function(a2) {
209
+ return a2;
210
+ }) || [];
211
+ }, only: function(a) {
212
+ if (!O(a)) throw Error("React.Children.only expected to receive a single React element child.");
213
+ return a;
214
+ } };
215
+ exports2.Component = E;
216
+ exports2.Fragment = p;
217
+ exports2.Profiler = r;
218
+ exports2.PureComponent = G;
219
+ exports2.StrictMode = q;
220
+ exports2.Suspense = w;
221
+ exports2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = W;
222
+ exports2.act = X;
223
+ exports2.cloneElement = function(a, b, e) {
224
+ if (null === a || void 0 === a) throw Error("React.cloneElement(...): The argument must be a React element, but you passed " + a + ".");
225
+ var d = C({}, a.props), c = a.key, k = a.ref, h = a._owner;
226
+ if (null != b) {
227
+ void 0 !== b.ref && (k = b.ref, h = K.current);
228
+ void 0 !== b.key && (c = "" + b.key);
229
+ if (a.type && a.type.defaultProps) var g = a.type.defaultProps;
230
+ for (f in b) J.call(b, f) && !L.hasOwnProperty(f) && (d[f] = void 0 === b[f] && void 0 !== g ? g[f] : b[f]);
231
+ }
232
+ var f = arguments.length - 2;
233
+ if (1 === f) d.children = e;
234
+ else if (1 < f) {
235
+ g = Array(f);
236
+ for (var m = 0; m < f; m++) g[m] = arguments[m + 2];
237
+ d.children = g;
238
+ }
239
+ return { $$typeof: l, type: a.type, key: c, ref: k, props: d, _owner: h };
240
+ };
241
+ exports2.createContext = function(a) {
242
+ a = { $$typeof: u, _currentValue: a, _currentValue2: a, _threadCount: 0, Provider: null, Consumer: null, _defaultValue: null, _globalName: null };
243
+ a.Provider = { $$typeof: t, _context: a };
244
+ return a.Consumer = a;
245
+ };
246
+ exports2.createElement = M;
247
+ exports2.createFactory = function(a) {
248
+ var b = M.bind(null, a);
249
+ b.type = a;
250
+ return b;
251
+ };
252
+ exports2.createRef = function() {
253
+ return { current: null };
254
+ };
255
+ exports2.forwardRef = function(a) {
256
+ return { $$typeof: v, render: a };
257
+ };
258
+ exports2.isValidElement = O;
259
+ exports2.lazy = function(a) {
260
+ return { $$typeof: y, _payload: { _status: -1, _result: a }, _init: T };
261
+ };
262
+ exports2.memo = function(a, b) {
263
+ return { $$typeof: x, type: a, compare: void 0 === b ? null : b };
264
+ };
265
+ exports2.startTransition = function(a) {
266
+ var b = V.transition;
267
+ V.transition = {};
268
+ try {
269
+ a();
270
+ } finally {
271
+ V.transition = b;
272
+ }
273
+ };
274
+ exports2.unstable_act = X;
275
+ exports2.useCallback = function(a, b) {
276
+ return U.current.useCallback(a, b);
277
+ };
278
+ exports2.useContext = function(a) {
279
+ return U.current.useContext(a);
280
+ };
281
+ exports2.useDebugValue = function() {
282
+ };
283
+ exports2.useDeferredValue = function(a) {
284
+ return U.current.useDeferredValue(a);
285
+ };
286
+ exports2.useEffect = function(a, b) {
287
+ return U.current.useEffect(a, b);
288
+ };
289
+ exports2.useId = function() {
290
+ return U.current.useId();
291
+ };
292
+ exports2.useImperativeHandle = function(a, b, e) {
293
+ return U.current.useImperativeHandle(a, b, e);
294
+ };
295
+ exports2.useInsertionEffect = function(a, b) {
296
+ return U.current.useInsertionEffect(a, b);
297
+ };
298
+ exports2.useLayoutEffect = function(a, b) {
299
+ return U.current.useLayoutEffect(a, b);
300
+ };
301
+ exports2.useMemo = function(a, b) {
302
+ return U.current.useMemo(a, b);
303
+ };
304
+ exports2.useReducer = function(a, b, e) {
305
+ return U.current.useReducer(a, b, e);
306
+ };
307
+ exports2.useRef = function(a) {
308
+ return U.current.useRef(a);
309
+ };
310
+ exports2.useState = function(a) {
311
+ return U.current.useState(a);
312
+ };
313
+ exports2.useSyncExternalStore = function(a, b, e) {
314
+ return U.current.useSyncExternalStore(a, b, e);
315
+ };
316
+ exports2.useTransition = function() {
317
+ return U.current.useTransition();
318
+ };
319
+ exports2.version = "18.3.1";
320
+ }
321
+ });
322
+
323
+ // ../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.development.js
324
+ var require_react_development = __commonJS({
325
+ "../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.development.js"(exports2, module2) {
326
+ "use strict";
327
+ if (process.env.NODE_ENV !== "production") {
328
+ (function() {
329
+ "use strict";
330
+ if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
331
+ __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
332
+ }
333
+ var ReactVersion = "18.3.1";
334
+ var REACT_ELEMENT_TYPE = Symbol.for("react.element");
335
+ var REACT_PORTAL_TYPE = Symbol.for("react.portal");
336
+ var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
337
+ var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
338
+ var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
339
+ var REACT_PROVIDER_TYPE = Symbol.for("react.provider");
340
+ var REACT_CONTEXT_TYPE = Symbol.for("react.context");
341
+ var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
342
+ var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
343
+ var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list");
344
+ var REACT_MEMO_TYPE = Symbol.for("react.memo");
345
+ var REACT_LAZY_TYPE = Symbol.for("react.lazy");
346
+ var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen");
347
+ var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
348
+ var FAUX_ITERATOR_SYMBOL = "@@iterator";
349
+ function getIteratorFn(maybeIterable) {
350
+ if (maybeIterable === null || typeof maybeIterable !== "object") {
351
+ return null;
352
+ }
353
+ var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
354
+ if (typeof maybeIterator === "function") {
355
+ return maybeIterator;
356
+ }
357
+ return null;
358
+ }
359
+ var ReactCurrentDispatcher = {
360
+ /**
361
+ * @internal
362
+ * @type {ReactComponent}
363
+ */
364
+ current: null
365
+ };
366
+ var ReactCurrentBatchConfig = {
367
+ transition: null
368
+ };
369
+ var ReactCurrentActQueue = {
370
+ current: null,
371
+ // Used to reproduce behavior of `batchedUpdates` in legacy mode.
372
+ isBatchingLegacy: false,
373
+ didScheduleLegacyUpdate: false
374
+ };
375
+ var ReactCurrentOwner = {
376
+ /**
377
+ * @internal
378
+ * @type {ReactComponent}
379
+ */
380
+ current: null
381
+ };
382
+ var ReactDebugCurrentFrame = {};
383
+ var currentExtraStackFrame = null;
384
+ function setExtraStackFrame(stack) {
385
+ {
386
+ currentExtraStackFrame = stack;
387
+ }
388
+ }
389
+ {
390
+ ReactDebugCurrentFrame.setExtraStackFrame = function(stack) {
391
+ {
392
+ currentExtraStackFrame = stack;
393
+ }
394
+ };
395
+ ReactDebugCurrentFrame.getCurrentStack = null;
396
+ ReactDebugCurrentFrame.getStackAddendum = function() {
397
+ var stack = "";
398
+ if (currentExtraStackFrame) {
399
+ stack += currentExtraStackFrame;
400
+ }
401
+ var impl = ReactDebugCurrentFrame.getCurrentStack;
402
+ if (impl) {
403
+ stack += impl() || "";
404
+ }
405
+ return stack;
406
+ };
407
+ }
408
+ var enableScopeAPI = false;
409
+ var enableCacheElement = false;
410
+ var enableTransitionTracing = false;
411
+ var enableLegacyHidden = false;
412
+ var enableDebugTracing = false;
413
+ var ReactSharedInternals = {
414
+ ReactCurrentDispatcher,
415
+ ReactCurrentBatchConfig,
416
+ ReactCurrentOwner
417
+ };
418
+ {
419
+ ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame;
420
+ ReactSharedInternals.ReactCurrentActQueue = ReactCurrentActQueue;
421
+ }
422
+ function warn(format) {
423
+ {
424
+ {
425
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
426
+ args[_key - 1] = arguments[_key];
427
+ }
428
+ printWarning("warn", format, args);
429
+ }
430
+ }
431
+ }
432
+ function error(format) {
433
+ {
434
+ {
435
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
436
+ args[_key2 - 1] = arguments[_key2];
437
+ }
438
+ printWarning("error", format, args);
439
+ }
440
+ }
441
+ }
442
+ function printWarning(level, format, args) {
443
+ {
444
+ var ReactDebugCurrentFrame2 = ReactSharedInternals.ReactDebugCurrentFrame;
445
+ var stack = ReactDebugCurrentFrame2.getStackAddendum();
446
+ if (stack !== "") {
447
+ format += "%s";
448
+ args = args.concat([stack]);
449
+ }
450
+ var argsWithFormat = args.map(function(item) {
451
+ return String(item);
452
+ });
453
+ argsWithFormat.unshift("Warning: " + format);
454
+ Function.prototype.apply.call(console[level], console, argsWithFormat);
455
+ }
456
+ }
457
+ var didWarnStateUpdateForUnmountedComponent = {};
458
+ function warnNoop(publicInstance, callerName) {
459
+ {
460
+ var _constructor = publicInstance.constructor;
461
+ var componentName = _constructor && (_constructor.displayName || _constructor.name) || "ReactClass";
462
+ var warningKey = componentName + "." + callerName;
463
+ if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
464
+ return;
465
+ }
466
+ error("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.", callerName, componentName);
467
+ didWarnStateUpdateForUnmountedComponent[warningKey] = true;
468
+ }
469
+ }
470
+ var ReactNoopUpdateQueue = {
471
+ /**
472
+ * Checks whether or not this composite component is mounted.
473
+ * @param {ReactClass} publicInstance The instance we want to test.
474
+ * @return {boolean} True if mounted, false otherwise.
475
+ * @protected
476
+ * @final
477
+ */
478
+ isMounted: function(publicInstance) {
479
+ return false;
480
+ },
481
+ /**
482
+ * Forces an update. This should only be invoked when it is known with
483
+ * certainty that we are **not** in a DOM transaction.
484
+ *
485
+ * You may want to call this when you know that some deeper aspect of the
486
+ * component's state has changed but `setState` was not called.
487
+ *
488
+ * This will not invoke `shouldComponentUpdate`, but it will invoke
489
+ * `componentWillUpdate` and `componentDidUpdate`.
490
+ *
491
+ * @param {ReactClass} publicInstance The instance that should rerender.
492
+ * @param {?function} callback Called after component is updated.
493
+ * @param {?string} callerName name of the calling function in the public API.
494
+ * @internal
495
+ */
496
+ enqueueForceUpdate: function(publicInstance, callback, callerName) {
497
+ warnNoop(publicInstance, "forceUpdate");
498
+ },
499
+ /**
500
+ * Replaces all of the state. Always use this or `setState` to mutate state.
501
+ * You should treat `this.state` as immutable.
502
+ *
503
+ * There is no guarantee that `this.state` will be immediately updated, so
504
+ * accessing `this.state` after calling this method may return the old value.
505
+ *
506
+ * @param {ReactClass} publicInstance The instance that should rerender.
507
+ * @param {object} completeState Next state.
508
+ * @param {?function} callback Called after component is updated.
509
+ * @param {?string} callerName name of the calling function in the public API.
510
+ * @internal
511
+ */
512
+ enqueueReplaceState: function(publicInstance, completeState, callback, callerName) {
513
+ warnNoop(publicInstance, "replaceState");
514
+ },
515
+ /**
516
+ * Sets a subset of the state. This only exists because _pendingState is
517
+ * internal. This provides a merging strategy that is not available to deep
518
+ * properties which is confusing. TODO: Expose pendingState or don't use it
519
+ * during the merge.
520
+ *
521
+ * @param {ReactClass} publicInstance The instance that should rerender.
522
+ * @param {object} partialState Next partial state to be merged with state.
523
+ * @param {?function} callback Called after component is updated.
524
+ * @param {?string} Name of the calling function in the public API.
525
+ * @internal
526
+ */
527
+ enqueueSetState: function(publicInstance, partialState, callback, callerName) {
528
+ warnNoop(publicInstance, "setState");
529
+ }
530
+ };
531
+ var assign = Object.assign;
532
+ var emptyObject = {};
533
+ {
534
+ Object.freeze(emptyObject);
535
+ }
536
+ function Component(props, context, updater) {
537
+ this.props = props;
538
+ this.context = context;
539
+ this.refs = emptyObject;
540
+ this.updater = updater || ReactNoopUpdateQueue;
541
+ }
542
+ Component.prototype.isReactComponent = {};
543
+ Component.prototype.setState = function(partialState, callback) {
544
+ if (typeof partialState !== "object" && typeof partialState !== "function" && partialState != null) {
545
+ throw new Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");
546
+ }
547
+ this.updater.enqueueSetState(this, partialState, callback, "setState");
548
+ };
549
+ Component.prototype.forceUpdate = function(callback) {
550
+ this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
551
+ };
552
+ {
553
+ var deprecatedAPIs = {
554
+ isMounted: ["isMounted", "Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],
555
+ replaceState: ["replaceState", "Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]
556
+ };
557
+ var defineDeprecationWarning = function(methodName, info) {
558
+ Object.defineProperty(Component.prototype, methodName, {
559
+ get: function() {
560
+ warn("%s(...) is deprecated in plain JavaScript React classes. %s", info[0], info[1]);
561
+ return void 0;
562
+ }
563
+ });
564
+ };
565
+ for (var fnName in deprecatedAPIs) {
566
+ if (deprecatedAPIs.hasOwnProperty(fnName)) {
567
+ defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
568
+ }
569
+ }
570
+ }
571
+ function ComponentDummy() {
572
+ }
573
+ ComponentDummy.prototype = Component.prototype;
574
+ function PureComponent(props, context, updater) {
575
+ this.props = props;
576
+ this.context = context;
577
+ this.refs = emptyObject;
578
+ this.updater = updater || ReactNoopUpdateQueue;
579
+ }
580
+ var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
581
+ pureComponentPrototype.constructor = PureComponent;
582
+ assign(pureComponentPrototype, Component.prototype);
583
+ pureComponentPrototype.isPureReactComponent = true;
584
+ function createRef() {
585
+ var refObject = {
586
+ current: null
587
+ };
588
+ {
589
+ Object.seal(refObject);
590
+ }
591
+ return refObject;
592
+ }
593
+ var isArrayImpl = Array.isArray;
594
+ function isArray(a) {
595
+ return isArrayImpl(a);
596
+ }
597
+ function typeName(value) {
598
+ {
599
+ var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag;
600
+ var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
601
+ return type;
602
+ }
603
+ }
604
+ function willCoercionThrow(value) {
605
+ {
606
+ try {
607
+ testStringCoercion(value);
608
+ return false;
609
+ } catch (e) {
610
+ return true;
611
+ }
612
+ }
613
+ }
614
+ function testStringCoercion(value) {
615
+ return "" + value;
616
+ }
617
+ function checkKeyStringCoercion(value) {
618
+ {
619
+ if (willCoercionThrow(value)) {
620
+ error("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", typeName(value));
621
+ return testStringCoercion(value);
622
+ }
623
+ }
624
+ }
625
+ function getWrappedName(outerType, innerType, wrapperName) {
626
+ var displayName = outerType.displayName;
627
+ if (displayName) {
628
+ return displayName;
629
+ }
630
+ var functionName = innerType.displayName || innerType.name || "";
631
+ return functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName;
632
+ }
633
+ function getContextName(type) {
634
+ return type.displayName || "Context";
635
+ }
636
+ function getComponentNameFromType(type) {
637
+ if (type == null) {
638
+ return null;
639
+ }
640
+ {
641
+ if (typeof type.tag === "number") {
642
+ error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.");
643
+ }
644
+ }
645
+ if (typeof type === "function") {
646
+ return type.displayName || type.name || null;
647
+ }
648
+ if (typeof type === "string") {
649
+ return type;
650
+ }
651
+ switch (type) {
652
+ case REACT_FRAGMENT_TYPE:
653
+ return "Fragment";
654
+ case REACT_PORTAL_TYPE:
655
+ return "Portal";
656
+ case REACT_PROFILER_TYPE:
657
+ return "Profiler";
658
+ case REACT_STRICT_MODE_TYPE:
659
+ return "StrictMode";
660
+ case REACT_SUSPENSE_TYPE:
661
+ return "Suspense";
662
+ case REACT_SUSPENSE_LIST_TYPE:
663
+ return "SuspenseList";
664
+ }
665
+ if (typeof type === "object") {
666
+ switch (type.$$typeof) {
667
+ case REACT_CONTEXT_TYPE:
668
+ var context = type;
669
+ return getContextName(context) + ".Consumer";
670
+ case REACT_PROVIDER_TYPE:
671
+ var provider = type;
672
+ return getContextName(provider._context) + ".Provider";
673
+ case REACT_FORWARD_REF_TYPE:
674
+ return getWrappedName(type, type.render, "ForwardRef");
675
+ case REACT_MEMO_TYPE:
676
+ var outerName = type.displayName || null;
677
+ if (outerName !== null) {
678
+ return outerName;
679
+ }
680
+ return getComponentNameFromType(type.type) || "Memo";
681
+ case REACT_LAZY_TYPE: {
682
+ var lazyComponent = type;
683
+ var payload = lazyComponent._payload;
684
+ var init2 = lazyComponent._init;
685
+ try {
686
+ return getComponentNameFromType(init2(payload));
687
+ } catch (x) {
688
+ return null;
689
+ }
690
+ }
691
+ }
692
+ }
693
+ return null;
694
+ }
695
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
696
+ var RESERVED_PROPS = {
697
+ key: true,
698
+ ref: true,
699
+ __self: true,
700
+ __source: true
701
+ };
702
+ var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;
703
+ {
704
+ didWarnAboutStringRefs = {};
705
+ }
706
+ function hasValidRef(config) {
707
+ {
708
+ if (hasOwnProperty.call(config, "ref")) {
709
+ var getter = Object.getOwnPropertyDescriptor(config, "ref").get;
710
+ if (getter && getter.isReactWarning) {
711
+ return false;
712
+ }
713
+ }
714
+ }
715
+ return config.ref !== void 0;
716
+ }
717
+ function hasValidKey(config) {
718
+ {
719
+ if (hasOwnProperty.call(config, "key")) {
720
+ var getter = Object.getOwnPropertyDescriptor(config, "key").get;
721
+ if (getter && getter.isReactWarning) {
722
+ return false;
723
+ }
724
+ }
725
+ }
726
+ return config.key !== void 0;
727
+ }
728
+ function defineKeyPropWarningGetter(props, displayName) {
729
+ var warnAboutAccessingKey = function() {
730
+ {
731
+ if (!specialPropKeyWarningShown) {
732
+ specialPropKeyWarningShown = true;
733
+ error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName);
734
+ }
735
+ }
736
+ };
737
+ warnAboutAccessingKey.isReactWarning = true;
738
+ Object.defineProperty(props, "key", {
739
+ get: warnAboutAccessingKey,
740
+ configurable: true
741
+ });
742
+ }
743
+ function defineRefPropWarningGetter(props, displayName) {
744
+ var warnAboutAccessingRef = function() {
745
+ {
746
+ if (!specialPropRefWarningShown) {
747
+ specialPropRefWarningShown = true;
748
+ error("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName);
749
+ }
750
+ }
751
+ };
752
+ warnAboutAccessingRef.isReactWarning = true;
753
+ Object.defineProperty(props, "ref", {
754
+ get: warnAboutAccessingRef,
755
+ configurable: true
756
+ });
757
+ }
758
+ function warnIfStringRefCannotBeAutoConverted(config) {
759
+ {
760
+ if (typeof config.ref === "string" && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
761
+ var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
762
+ if (!didWarnAboutStringRefs[componentName]) {
763
+ error('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', componentName, config.ref);
764
+ didWarnAboutStringRefs[componentName] = true;
765
+ }
766
+ }
767
+ }
768
+ }
769
+ var ReactElement = function(type, key, ref, self, source, owner, props) {
770
+ var element = {
771
+ // This tag allows us to uniquely identify this as a React Element
772
+ $$typeof: REACT_ELEMENT_TYPE,
773
+ // Built-in properties that belong on the element
774
+ type,
775
+ key,
776
+ ref,
777
+ props,
778
+ // Record the component responsible for creating this element.
779
+ _owner: owner
780
+ };
781
+ {
782
+ element._store = {};
783
+ Object.defineProperty(element._store, "validated", {
784
+ configurable: false,
785
+ enumerable: false,
786
+ writable: true,
787
+ value: false
788
+ });
789
+ Object.defineProperty(element, "_self", {
790
+ configurable: false,
791
+ enumerable: false,
792
+ writable: false,
793
+ value: self
794
+ });
795
+ Object.defineProperty(element, "_source", {
796
+ configurable: false,
797
+ enumerable: false,
798
+ writable: false,
799
+ value: source
800
+ });
801
+ if (Object.freeze) {
802
+ Object.freeze(element.props);
803
+ Object.freeze(element);
804
+ }
805
+ }
806
+ return element;
807
+ };
808
+ function createElement(type, config, children) {
809
+ var propName;
810
+ var props = {};
811
+ var key = null;
812
+ var ref = null;
813
+ var self = null;
814
+ var source = null;
815
+ if (config != null) {
816
+ if (hasValidRef(config)) {
817
+ ref = config.ref;
818
+ {
819
+ warnIfStringRefCannotBeAutoConverted(config);
820
+ }
821
+ }
822
+ if (hasValidKey(config)) {
823
+ {
824
+ checkKeyStringCoercion(config.key);
825
+ }
826
+ key = "" + config.key;
827
+ }
828
+ self = config.__self === void 0 ? null : config.__self;
829
+ source = config.__source === void 0 ? null : config.__source;
830
+ for (propName in config) {
831
+ if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
832
+ props[propName] = config[propName];
833
+ }
834
+ }
835
+ }
836
+ var childrenLength = arguments.length - 2;
837
+ if (childrenLength === 1) {
838
+ props.children = children;
839
+ } else if (childrenLength > 1) {
840
+ var childArray = Array(childrenLength);
841
+ for (var i = 0; i < childrenLength; i++) {
842
+ childArray[i] = arguments[i + 2];
843
+ }
844
+ {
845
+ if (Object.freeze) {
846
+ Object.freeze(childArray);
847
+ }
848
+ }
849
+ props.children = childArray;
850
+ }
851
+ if (type && type.defaultProps) {
852
+ var defaultProps = type.defaultProps;
853
+ for (propName in defaultProps) {
854
+ if (props[propName] === void 0) {
855
+ props[propName] = defaultProps[propName];
856
+ }
857
+ }
858
+ }
859
+ {
860
+ if (key || ref) {
861
+ var displayName = typeof type === "function" ? type.displayName || type.name || "Unknown" : type;
862
+ if (key) {
863
+ defineKeyPropWarningGetter(props, displayName);
864
+ }
865
+ if (ref) {
866
+ defineRefPropWarningGetter(props, displayName);
867
+ }
868
+ }
869
+ }
870
+ return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
871
+ }
872
+ function cloneAndReplaceKey(oldElement, newKey) {
873
+ var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
874
+ return newElement;
875
+ }
876
+ function cloneElement(element, config, children) {
877
+ if (element === null || element === void 0) {
878
+ throw new Error("React.cloneElement(...): The argument must be a React element, but you passed " + element + ".");
879
+ }
880
+ var propName;
881
+ var props = assign({}, element.props);
882
+ var key = element.key;
883
+ var ref = element.ref;
884
+ var self = element._self;
885
+ var source = element._source;
886
+ var owner = element._owner;
887
+ if (config != null) {
888
+ if (hasValidRef(config)) {
889
+ ref = config.ref;
890
+ owner = ReactCurrentOwner.current;
891
+ }
892
+ if (hasValidKey(config)) {
893
+ {
894
+ checkKeyStringCoercion(config.key);
895
+ }
896
+ key = "" + config.key;
897
+ }
898
+ var defaultProps;
899
+ if (element.type && element.type.defaultProps) {
900
+ defaultProps = element.type.defaultProps;
901
+ }
902
+ for (propName in config) {
903
+ if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
904
+ if (config[propName] === void 0 && defaultProps !== void 0) {
905
+ props[propName] = defaultProps[propName];
906
+ } else {
907
+ props[propName] = config[propName];
908
+ }
909
+ }
910
+ }
911
+ }
912
+ var childrenLength = arguments.length - 2;
913
+ if (childrenLength === 1) {
914
+ props.children = children;
915
+ } else if (childrenLength > 1) {
916
+ var childArray = Array(childrenLength);
917
+ for (var i = 0; i < childrenLength; i++) {
918
+ childArray[i] = arguments[i + 2];
919
+ }
920
+ props.children = childArray;
921
+ }
922
+ return ReactElement(element.type, key, ref, self, source, owner, props);
923
+ }
924
+ function isValidElement(object) {
925
+ return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
926
+ }
927
+ var SEPARATOR = ".";
928
+ var SUBSEPARATOR = ":";
929
+ function escape(key) {
930
+ var escapeRegex = /[=:]/g;
931
+ var escaperLookup = {
932
+ "=": "=0",
933
+ ":": "=2"
934
+ };
935
+ var escapedString = key.replace(escapeRegex, function(match) {
936
+ return escaperLookup[match];
937
+ });
938
+ return "$" + escapedString;
939
+ }
940
+ var didWarnAboutMaps = false;
941
+ var userProvidedKeyEscapeRegex = /\/+/g;
942
+ function escapeUserProvidedKey(text) {
943
+ return text.replace(userProvidedKeyEscapeRegex, "$&/");
944
+ }
945
+ function getElementKey(element, index) {
946
+ if (typeof element === "object" && element !== null && element.key != null) {
947
+ {
948
+ checkKeyStringCoercion(element.key);
949
+ }
950
+ return escape("" + element.key);
951
+ }
952
+ return index.toString(36);
953
+ }
954
+ function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
955
+ var type = typeof children;
956
+ if (type === "undefined" || type === "boolean") {
957
+ children = null;
958
+ }
959
+ var invokeCallback = false;
960
+ if (children === null) {
961
+ invokeCallback = true;
962
+ } else {
963
+ switch (type) {
964
+ case "string":
965
+ case "number":
966
+ invokeCallback = true;
967
+ break;
968
+ case "object":
969
+ switch (children.$$typeof) {
970
+ case REACT_ELEMENT_TYPE:
971
+ case REACT_PORTAL_TYPE:
972
+ invokeCallback = true;
973
+ }
974
+ }
975
+ }
976
+ if (invokeCallback) {
977
+ var _child = children;
978
+ var mappedChild = callback(_child);
979
+ var childKey = nameSoFar === "" ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;
980
+ if (isArray(mappedChild)) {
981
+ var escapedChildKey = "";
982
+ if (childKey != null) {
983
+ escapedChildKey = escapeUserProvidedKey(childKey) + "/";
984
+ }
985
+ mapIntoArray(mappedChild, array, escapedChildKey, "", function(c) {
986
+ return c;
987
+ });
988
+ } else if (mappedChild != null) {
989
+ if (isValidElement(mappedChild)) {
990
+ {
991
+ if (mappedChild.key && (!_child || _child.key !== mappedChild.key)) {
992
+ checkKeyStringCoercion(mappedChild.key);
993
+ }
994
+ }
995
+ mappedChild = cloneAndReplaceKey(
996
+ mappedChild,
997
+ // Keep both the (mapped) and old keys if they differ, just as
998
+ // traverseAllChildren used to do for objects as children
999
+ escapedPrefix + // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
1000
+ (mappedChild.key && (!_child || _child.key !== mappedChild.key) ? (
1001
+ // $FlowFixMe Flow incorrectly thinks existing element's key can be a number
1002
+ // eslint-disable-next-line react-internal/safe-string-coercion
1003
+ escapeUserProvidedKey("" + mappedChild.key) + "/"
1004
+ ) : "") + childKey
1005
+ );
1006
+ }
1007
+ array.push(mappedChild);
1008
+ }
1009
+ return 1;
1010
+ }
1011
+ var child;
1012
+ var nextName;
1013
+ var subtreeCount = 0;
1014
+ var nextNamePrefix = nameSoFar === "" ? SEPARATOR : nameSoFar + SUBSEPARATOR;
1015
+ if (isArray(children)) {
1016
+ for (var i = 0; i < children.length; i++) {
1017
+ child = children[i];
1018
+ nextName = nextNamePrefix + getElementKey(child, i);
1019
+ subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
1020
+ }
1021
+ } else {
1022
+ var iteratorFn = getIteratorFn(children);
1023
+ if (typeof iteratorFn === "function") {
1024
+ var iterableChildren = children;
1025
+ {
1026
+ if (iteratorFn === iterableChildren.entries) {
1027
+ if (!didWarnAboutMaps) {
1028
+ warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead.");
1029
+ }
1030
+ didWarnAboutMaps = true;
1031
+ }
1032
+ }
1033
+ var iterator = iteratorFn.call(iterableChildren);
1034
+ var step;
1035
+ var ii = 0;
1036
+ while (!(step = iterator.next()).done) {
1037
+ child = step.value;
1038
+ nextName = nextNamePrefix + getElementKey(child, ii++);
1039
+ subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
1040
+ }
1041
+ } else if (type === "object") {
1042
+ var childrenString = String(children);
1043
+ throw new Error("Objects are not valid as a React child (found: " + (childrenString === "[object Object]" ? "object with keys {" + Object.keys(children).join(", ") + "}" : childrenString) + "). If you meant to render a collection of children, use an array instead.");
1044
+ }
1045
+ }
1046
+ return subtreeCount;
1047
+ }
1048
+ function mapChildren(children, func, context) {
1049
+ if (children == null) {
1050
+ return children;
1051
+ }
1052
+ var result = [];
1053
+ var count = 0;
1054
+ mapIntoArray(children, result, "", "", function(child) {
1055
+ return func.call(context, child, count++);
1056
+ });
1057
+ return result;
1058
+ }
1059
+ function countChildren(children) {
1060
+ var n = 0;
1061
+ mapChildren(children, function() {
1062
+ n++;
1063
+ });
1064
+ return n;
1065
+ }
1066
+ function forEachChildren(children, forEachFunc, forEachContext) {
1067
+ mapChildren(children, function() {
1068
+ forEachFunc.apply(this, arguments);
1069
+ }, forEachContext);
1070
+ }
1071
+ function toArray(children) {
1072
+ return mapChildren(children, function(child) {
1073
+ return child;
1074
+ }) || [];
1075
+ }
1076
+ function onlyChild(children) {
1077
+ if (!isValidElement(children)) {
1078
+ throw new Error("React.Children.only expected to receive a single React element child.");
1079
+ }
1080
+ return children;
1081
+ }
1082
+ function createContext(defaultValue) {
1083
+ var context = {
1084
+ $$typeof: REACT_CONTEXT_TYPE,
1085
+ // As a workaround to support multiple concurrent renderers, we categorize
1086
+ // some renderers as primary and others as secondary. We only expect
1087
+ // there to be two concurrent renderers at most: React Native (primary) and
1088
+ // Fabric (secondary); React DOM (primary) and React ART (secondary).
1089
+ // Secondary renderers store their context values on separate fields.
1090
+ _currentValue: defaultValue,
1091
+ _currentValue2: defaultValue,
1092
+ // Used to track how many concurrent renderers this context currently
1093
+ // supports within in a single renderer. Such as parallel server rendering.
1094
+ _threadCount: 0,
1095
+ // These are circular
1096
+ Provider: null,
1097
+ Consumer: null,
1098
+ // Add these to use same hidden class in VM as ServerContext
1099
+ _defaultValue: null,
1100
+ _globalName: null
1101
+ };
1102
+ context.Provider = {
1103
+ $$typeof: REACT_PROVIDER_TYPE,
1104
+ _context: context
1105
+ };
1106
+ var hasWarnedAboutUsingNestedContextConsumers = false;
1107
+ var hasWarnedAboutUsingConsumerProvider = false;
1108
+ var hasWarnedAboutDisplayNameOnConsumer = false;
1109
+ {
1110
+ var Consumer = {
1111
+ $$typeof: REACT_CONTEXT_TYPE,
1112
+ _context: context
1113
+ };
1114
+ Object.defineProperties(Consumer, {
1115
+ Provider: {
1116
+ get: function() {
1117
+ if (!hasWarnedAboutUsingConsumerProvider) {
1118
+ hasWarnedAboutUsingConsumerProvider = true;
1119
+ error("Rendering <Context.Consumer.Provider> is not supported and will be removed in a future major release. Did you mean to render <Context.Provider> instead?");
1120
+ }
1121
+ return context.Provider;
1122
+ },
1123
+ set: function(_Provider) {
1124
+ context.Provider = _Provider;
1125
+ }
1126
+ },
1127
+ _currentValue: {
1128
+ get: function() {
1129
+ return context._currentValue;
1130
+ },
1131
+ set: function(_currentValue) {
1132
+ context._currentValue = _currentValue;
1133
+ }
1134
+ },
1135
+ _currentValue2: {
1136
+ get: function() {
1137
+ return context._currentValue2;
1138
+ },
1139
+ set: function(_currentValue2) {
1140
+ context._currentValue2 = _currentValue2;
1141
+ }
1142
+ },
1143
+ _threadCount: {
1144
+ get: function() {
1145
+ return context._threadCount;
1146
+ },
1147
+ set: function(_threadCount) {
1148
+ context._threadCount = _threadCount;
1149
+ }
1150
+ },
1151
+ Consumer: {
1152
+ get: function() {
1153
+ if (!hasWarnedAboutUsingNestedContextConsumers) {
1154
+ hasWarnedAboutUsingNestedContextConsumers = true;
1155
+ error("Rendering <Context.Consumer.Consumer> is not supported and will be removed in a future major release. Did you mean to render <Context.Consumer> instead?");
1156
+ }
1157
+ return context.Consumer;
1158
+ }
1159
+ },
1160
+ displayName: {
1161
+ get: function() {
1162
+ return context.displayName;
1163
+ },
1164
+ set: function(displayName) {
1165
+ if (!hasWarnedAboutDisplayNameOnConsumer) {
1166
+ warn("Setting `displayName` on Context.Consumer has no effect. You should set it directly on the context with Context.displayName = '%s'.", displayName);
1167
+ hasWarnedAboutDisplayNameOnConsumer = true;
1168
+ }
1169
+ }
1170
+ }
1171
+ });
1172
+ context.Consumer = Consumer;
1173
+ }
1174
+ {
1175
+ context._currentRenderer = null;
1176
+ context._currentRenderer2 = null;
1177
+ }
1178
+ return context;
1179
+ }
1180
+ var Uninitialized = -1;
1181
+ var Pending = 0;
1182
+ var Resolved = 1;
1183
+ var Rejected = 2;
1184
+ function lazyInitializer(payload) {
1185
+ if (payload._status === Uninitialized) {
1186
+ var ctor = payload._result;
1187
+ var thenable = ctor();
1188
+ thenable.then(function(moduleObject2) {
1189
+ if (payload._status === Pending || payload._status === Uninitialized) {
1190
+ var resolved = payload;
1191
+ resolved._status = Resolved;
1192
+ resolved._result = moduleObject2;
1193
+ }
1194
+ }, function(error2) {
1195
+ if (payload._status === Pending || payload._status === Uninitialized) {
1196
+ var rejected = payload;
1197
+ rejected._status = Rejected;
1198
+ rejected._result = error2;
1199
+ }
1200
+ });
1201
+ if (payload._status === Uninitialized) {
1202
+ var pending = payload;
1203
+ pending._status = Pending;
1204
+ pending._result = thenable;
1205
+ }
1206
+ }
1207
+ if (payload._status === Resolved) {
1208
+ var moduleObject = payload._result;
1209
+ {
1210
+ if (moduleObject === void 0) {
1211
+ error("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?", moduleObject);
1212
+ }
1213
+ }
1214
+ {
1215
+ if (!("default" in moduleObject)) {
1216
+ error("lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))", moduleObject);
1217
+ }
1218
+ }
1219
+ return moduleObject.default;
1220
+ } else {
1221
+ throw payload._result;
1222
+ }
1223
+ }
1224
+ function lazy(ctor) {
1225
+ var payload = {
1226
+ // We use these fields to store the result.
1227
+ _status: Uninitialized,
1228
+ _result: ctor
1229
+ };
1230
+ var lazyType = {
1231
+ $$typeof: REACT_LAZY_TYPE,
1232
+ _payload: payload,
1233
+ _init: lazyInitializer
1234
+ };
1235
+ {
1236
+ var defaultProps;
1237
+ var propTypes;
1238
+ Object.defineProperties(lazyType, {
1239
+ defaultProps: {
1240
+ configurable: true,
1241
+ get: function() {
1242
+ return defaultProps;
1243
+ },
1244
+ set: function(newDefaultProps) {
1245
+ error("React.lazy(...): It is not supported to assign `defaultProps` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it.");
1246
+ defaultProps = newDefaultProps;
1247
+ Object.defineProperty(lazyType, "defaultProps", {
1248
+ enumerable: true
1249
+ });
1250
+ }
1251
+ },
1252
+ propTypes: {
1253
+ configurable: true,
1254
+ get: function() {
1255
+ return propTypes;
1256
+ },
1257
+ set: function(newPropTypes) {
1258
+ error("React.lazy(...): It is not supported to assign `propTypes` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it.");
1259
+ propTypes = newPropTypes;
1260
+ Object.defineProperty(lazyType, "propTypes", {
1261
+ enumerable: true
1262
+ });
1263
+ }
1264
+ }
1265
+ });
1266
+ }
1267
+ return lazyType;
1268
+ }
1269
+ function forwardRef(render) {
1270
+ {
1271
+ if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
1272
+ error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...)).");
1273
+ } else if (typeof render !== "function") {
1274
+ error("forwardRef requires a render function but was given %s.", render === null ? "null" : typeof render);
1275
+ } else {
1276
+ if (render.length !== 0 && render.length !== 2) {
1277
+ error("forwardRef render functions accept exactly two parameters: props and ref. %s", render.length === 1 ? "Did you forget to use the ref parameter?" : "Any additional parameter will be undefined.");
1278
+ }
1279
+ }
1280
+ if (render != null) {
1281
+ if (render.defaultProps != null || render.propTypes != null) {
1282
+ error("forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?");
1283
+ }
1284
+ }
1285
+ }
1286
+ var elementType = {
1287
+ $$typeof: REACT_FORWARD_REF_TYPE,
1288
+ render
1289
+ };
1290
+ {
1291
+ var ownName;
1292
+ Object.defineProperty(elementType, "displayName", {
1293
+ enumerable: false,
1294
+ configurable: true,
1295
+ get: function() {
1296
+ return ownName;
1297
+ },
1298
+ set: function(name) {
1299
+ ownName = name;
1300
+ if (!render.name && !render.displayName) {
1301
+ render.displayName = name;
1302
+ }
1303
+ }
1304
+ });
1305
+ }
1306
+ return elementType;
1307
+ }
1308
+ var REACT_MODULE_REFERENCE;
1309
+ {
1310
+ REACT_MODULE_REFERENCE = Symbol.for("react.module.reference");
1311
+ }
1312
+ function isValidElementType(type) {
1313
+ if (typeof type === "string" || typeof type === "function") {
1314
+ return true;
1315
+ }
1316
+ if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing) {
1317
+ return true;
1318
+ }
1319
+ if (typeof type === "object" && type !== null) {
1320
+ if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
1321
+ // types supported by any Flight configuration anywhere since
1322
+ // we don't know which Flight build this will end up being used
1323
+ // with.
1324
+ type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0) {
1325
+ return true;
1326
+ }
1327
+ }
1328
+ return false;
1329
+ }
1330
+ function memo(type, compare) {
1331
+ {
1332
+ if (!isValidElementType(type)) {
1333
+ error("memo: The first argument must be a component. Instead received: %s", type === null ? "null" : typeof type);
1334
+ }
1335
+ }
1336
+ var elementType = {
1337
+ $$typeof: REACT_MEMO_TYPE,
1338
+ type,
1339
+ compare: compare === void 0 ? null : compare
1340
+ };
1341
+ {
1342
+ var ownName;
1343
+ Object.defineProperty(elementType, "displayName", {
1344
+ enumerable: false,
1345
+ configurable: true,
1346
+ get: function() {
1347
+ return ownName;
1348
+ },
1349
+ set: function(name) {
1350
+ ownName = name;
1351
+ if (!type.name && !type.displayName) {
1352
+ type.displayName = name;
1353
+ }
1354
+ }
1355
+ });
1356
+ }
1357
+ return elementType;
1358
+ }
1359
+ function resolveDispatcher() {
1360
+ var dispatcher = ReactCurrentDispatcher.current;
1361
+ {
1362
+ if (dispatcher === null) {
1363
+ error("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://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.");
1364
+ }
1365
+ }
1366
+ return dispatcher;
1367
+ }
1368
+ function useContext(Context) {
1369
+ var dispatcher = resolveDispatcher();
1370
+ {
1371
+ if (Context._context !== void 0) {
1372
+ var realContext = Context._context;
1373
+ if (realContext.Consumer === Context) {
1374
+ error("Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be removed in a future major release. Did you mean to call useContext(Context) instead?");
1375
+ } else if (realContext.Provider === Context) {
1376
+ error("Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?");
1377
+ }
1378
+ }
1379
+ }
1380
+ return dispatcher.useContext(Context);
1381
+ }
1382
+ function useState(initialState) {
1383
+ var dispatcher = resolveDispatcher();
1384
+ return dispatcher.useState(initialState);
1385
+ }
1386
+ function useReducer(reducer, initialArg, init2) {
1387
+ var dispatcher = resolveDispatcher();
1388
+ return dispatcher.useReducer(reducer, initialArg, init2);
1389
+ }
1390
+ function useRef(initialValue) {
1391
+ var dispatcher = resolveDispatcher();
1392
+ return dispatcher.useRef(initialValue);
1393
+ }
1394
+ function useEffect(create, deps) {
1395
+ var dispatcher = resolveDispatcher();
1396
+ return dispatcher.useEffect(create, deps);
1397
+ }
1398
+ function useInsertionEffect(create, deps) {
1399
+ var dispatcher = resolveDispatcher();
1400
+ return dispatcher.useInsertionEffect(create, deps);
1401
+ }
1402
+ function useLayoutEffect(create, deps) {
1403
+ var dispatcher = resolveDispatcher();
1404
+ return dispatcher.useLayoutEffect(create, deps);
1405
+ }
1406
+ function useCallback(callback, deps) {
1407
+ var dispatcher = resolveDispatcher();
1408
+ return dispatcher.useCallback(callback, deps);
1409
+ }
1410
+ function useMemo(create, deps) {
1411
+ var dispatcher = resolveDispatcher();
1412
+ return dispatcher.useMemo(create, deps);
1413
+ }
1414
+ function useImperativeHandle(ref, create, deps) {
1415
+ var dispatcher = resolveDispatcher();
1416
+ return dispatcher.useImperativeHandle(ref, create, deps);
1417
+ }
1418
+ function useDebugValue(value, formatterFn) {
1419
+ {
1420
+ var dispatcher = resolveDispatcher();
1421
+ return dispatcher.useDebugValue(value, formatterFn);
1422
+ }
1423
+ }
1424
+ function useTransition() {
1425
+ var dispatcher = resolveDispatcher();
1426
+ return dispatcher.useTransition();
1427
+ }
1428
+ function useDeferredValue(value) {
1429
+ var dispatcher = resolveDispatcher();
1430
+ return dispatcher.useDeferredValue(value);
1431
+ }
1432
+ function useId() {
1433
+ var dispatcher = resolveDispatcher();
1434
+ return dispatcher.useId();
1435
+ }
1436
+ function useSyncExternalStore2(subscribe, getSnapshot, getServerSnapshot) {
1437
+ var dispatcher = resolveDispatcher();
1438
+ return dispatcher.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
1439
+ }
1440
+ var disabledDepth = 0;
1441
+ var prevLog;
1442
+ var prevInfo;
1443
+ var prevWarn;
1444
+ var prevError;
1445
+ var prevGroup;
1446
+ var prevGroupCollapsed;
1447
+ var prevGroupEnd;
1448
+ function disabledLog() {
1449
+ }
1450
+ disabledLog.__reactDisabledLog = true;
1451
+ function disableLogs() {
1452
+ {
1453
+ if (disabledDepth === 0) {
1454
+ prevLog = console.log;
1455
+ prevInfo = console.info;
1456
+ prevWarn = console.warn;
1457
+ prevError = console.error;
1458
+ prevGroup = console.group;
1459
+ prevGroupCollapsed = console.groupCollapsed;
1460
+ prevGroupEnd = console.groupEnd;
1461
+ var props = {
1462
+ configurable: true,
1463
+ enumerable: true,
1464
+ value: disabledLog,
1465
+ writable: true
1466
+ };
1467
+ Object.defineProperties(console, {
1468
+ info: props,
1469
+ log: props,
1470
+ warn: props,
1471
+ error: props,
1472
+ group: props,
1473
+ groupCollapsed: props,
1474
+ groupEnd: props
1475
+ });
1476
+ }
1477
+ disabledDepth++;
1478
+ }
1479
+ }
1480
+ function reenableLogs() {
1481
+ {
1482
+ disabledDepth--;
1483
+ if (disabledDepth === 0) {
1484
+ var props = {
1485
+ configurable: true,
1486
+ enumerable: true,
1487
+ writable: true
1488
+ };
1489
+ Object.defineProperties(console, {
1490
+ log: assign({}, props, {
1491
+ value: prevLog
1492
+ }),
1493
+ info: assign({}, props, {
1494
+ value: prevInfo
1495
+ }),
1496
+ warn: assign({}, props, {
1497
+ value: prevWarn
1498
+ }),
1499
+ error: assign({}, props, {
1500
+ value: prevError
1501
+ }),
1502
+ group: assign({}, props, {
1503
+ value: prevGroup
1504
+ }),
1505
+ groupCollapsed: assign({}, props, {
1506
+ value: prevGroupCollapsed
1507
+ }),
1508
+ groupEnd: assign({}, props, {
1509
+ value: prevGroupEnd
1510
+ })
1511
+ });
1512
+ }
1513
+ if (disabledDepth < 0) {
1514
+ error("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
1515
+ }
1516
+ }
1517
+ }
1518
+ var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
1519
+ var prefix;
1520
+ function describeBuiltInComponentFrame(name, source, ownerFn) {
1521
+ {
1522
+ if (prefix === void 0) {
1523
+ try {
1524
+ throw Error();
1525
+ } catch (x) {
1526
+ var match = x.stack.trim().match(/\n( *(at )?)/);
1527
+ prefix = match && match[1] || "";
1528
+ }
1529
+ }
1530
+ return "\n" + prefix + name;
1531
+ }
1532
+ }
1533
+ var reentry = false;
1534
+ var componentFrameCache;
1535
+ {
1536
+ var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map;
1537
+ componentFrameCache = new PossiblyWeakMap();
1538
+ }
1539
+ function describeNativeComponentFrame(fn, construct) {
1540
+ if (!fn || reentry) {
1541
+ return "";
1542
+ }
1543
+ {
1544
+ var frame = componentFrameCache.get(fn);
1545
+ if (frame !== void 0) {
1546
+ return frame;
1547
+ }
1548
+ }
1549
+ var control;
1550
+ reentry = true;
1551
+ var previousPrepareStackTrace = Error.prepareStackTrace;
1552
+ Error.prepareStackTrace = void 0;
1553
+ var previousDispatcher;
1554
+ {
1555
+ previousDispatcher = ReactCurrentDispatcher$1.current;
1556
+ ReactCurrentDispatcher$1.current = null;
1557
+ disableLogs();
1558
+ }
1559
+ try {
1560
+ if (construct) {
1561
+ var Fake = function() {
1562
+ throw Error();
1563
+ };
1564
+ Object.defineProperty(Fake.prototype, "props", {
1565
+ set: function() {
1566
+ throw Error();
1567
+ }
1568
+ });
1569
+ if (typeof Reflect === "object" && Reflect.construct) {
1570
+ try {
1571
+ Reflect.construct(Fake, []);
1572
+ } catch (x) {
1573
+ control = x;
1574
+ }
1575
+ Reflect.construct(fn, [], Fake);
1576
+ } else {
1577
+ try {
1578
+ Fake.call();
1579
+ } catch (x) {
1580
+ control = x;
1581
+ }
1582
+ fn.call(Fake.prototype);
1583
+ }
1584
+ } else {
1585
+ try {
1586
+ throw Error();
1587
+ } catch (x) {
1588
+ control = x;
1589
+ }
1590
+ fn();
1591
+ }
1592
+ } catch (sample) {
1593
+ if (sample && control && typeof sample.stack === "string") {
1594
+ var sampleLines = sample.stack.split("\n");
1595
+ var controlLines = control.stack.split("\n");
1596
+ var s = sampleLines.length - 1;
1597
+ var c = controlLines.length - 1;
1598
+ while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
1599
+ c--;
1600
+ }
1601
+ for (; s >= 1 && c >= 0; s--, c--) {
1602
+ if (sampleLines[s] !== controlLines[c]) {
1603
+ if (s !== 1 || c !== 1) {
1604
+ do {
1605
+ s--;
1606
+ c--;
1607
+ if (c < 0 || sampleLines[s] !== controlLines[c]) {
1608
+ var _frame = "\n" + sampleLines[s].replace(" at new ", " at ");
1609
+ if (fn.displayName && _frame.includes("<anonymous>")) {
1610
+ _frame = _frame.replace("<anonymous>", fn.displayName);
1611
+ }
1612
+ {
1613
+ if (typeof fn === "function") {
1614
+ componentFrameCache.set(fn, _frame);
1615
+ }
1616
+ }
1617
+ return _frame;
1618
+ }
1619
+ } while (s >= 1 && c >= 0);
1620
+ }
1621
+ break;
1622
+ }
1623
+ }
1624
+ }
1625
+ } finally {
1626
+ reentry = false;
1627
+ {
1628
+ ReactCurrentDispatcher$1.current = previousDispatcher;
1629
+ reenableLogs();
1630
+ }
1631
+ Error.prepareStackTrace = previousPrepareStackTrace;
1632
+ }
1633
+ var name = fn ? fn.displayName || fn.name : "";
1634
+ var syntheticFrame = name ? describeBuiltInComponentFrame(name) : "";
1635
+ {
1636
+ if (typeof fn === "function") {
1637
+ componentFrameCache.set(fn, syntheticFrame);
1638
+ }
1639
+ }
1640
+ return syntheticFrame;
1641
+ }
1642
+ function describeFunctionComponentFrame(fn, source, ownerFn) {
1643
+ {
1644
+ return describeNativeComponentFrame(fn, false);
1645
+ }
1646
+ }
1647
+ function shouldConstruct(Component2) {
1648
+ var prototype = Component2.prototype;
1649
+ return !!(prototype && prototype.isReactComponent);
1650
+ }
1651
+ function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
1652
+ if (type == null) {
1653
+ return "";
1654
+ }
1655
+ if (typeof type === "function") {
1656
+ {
1657
+ return describeNativeComponentFrame(type, shouldConstruct(type));
1658
+ }
1659
+ }
1660
+ if (typeof type === "string") {
1661
+ return describeBuiltInComponentFrame(type);
1662
+ }
1663
+ switch (type) {
1664
+ case REACT_SUSPENSE_TYPE:
1665
+ return describeBuiltInComponentFrame("Suspense");
1666
+ case REACT_SUSPENSE_LIST_TYPE:
1667
+ return describeBuiltInComponentFrame("SuspenseList");
1668
+ }
1669
+ if (typeof type === "object") {
1670
+ switch (type.$$typeof) {
1671
+ case REACT_FORWARD_REF_TYPE:
1672
+ return describeFunctionComponentFrame(type.render);
1673
+ case REACT_MEMO_TYPE:
1674
+ return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
1675
+ case REACT_LAZY_TYPE: {
1676
+ var lazyComponent = type;
1677
+ var payload = lazyComponent._payload;
1678
+ var init2 = lazyComponent._init;
1679
+ try {
1680
+ return describeUnknownElementTypeFrameInDEV(init2(payload), source, ownerFn);
1681
+ } catch (x) {
1682
+ }
1683
+ }
1684
+ }
1685
+ }
1686
+ return "";
1687
+ }
1688
+ var loggedTypeFailures = {};
1689
+ var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
1690
+ function setCurrentlyValidatingElement(element) {
1691
+ {
1692
+ if (element) {
1693
+ var owner = element._owner;
1694
+ var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
1695
+ ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
1696
+ } else {
1697
+ ReactDebugCurrentFrame$1.setExtraStackFrame(null);
1698
+ }
1699
+ }
1700
+ }
1701
+ function checkPropTypes(typeSpecs, values, location, componentName, element) {
1702
+ {
1703
+ var has = Function.call.bind(hasOwnProperty);
1704
+ for (var typeSpecName in typeSpecs) {
1705
+ if (has(typeSpecs, typeSpecName)) {
1706
+ var error$1 = void 0;
1707
+ try {
1708
+ if (typeof typeSpecs[typeSpecName] !== "function") {
1709
+ var err = Error((componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
1710
+ err.name = "Invariant Violation";
1711
+ throw err;
1712
+ }
1713
+ error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
1714
+ } catch (ex) {
1715
+ error$1 = ex;
1716
+ }
1717
+ if (error$1 && !(error$1 instanceof Error)) {
1718
+ setCurrentlyValidatingElement(element);
1719
+ error("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", componentName || "React class", location, typeSpecName, typeof error$1);
1720
+ setCurrentlyValidatingElement(null);
1721
+ }
1722
+ if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
1723
+ loggedTypeFailures[error$1.message] = true;
1724
+ setCurrentlyValidatingElement(element);
1725
+ error("Failed %s type: %s", location, error$1.message);
1726
+ setCurrentlyValidatingElement(null);
1727
+ }
1728
+ }
1729
+ }
1730
+ }
1731
+ }
1732
+ function setCurrentlyValidatingElement$1(element) {
1733
+ {
1734
+ if (element) {
1735
+ var owner = element._owner;
1736
+ var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
1737
+ setExtraStackFrame(stack);
1738
+ } else {
1739
+ setExtraStackFrame(null);
1740
+ }
1741
+ }
1742
+ }
1743
+ var propTypesMisspellWarningShown;
1744
+ {
1745
+ propTypesMisspellWarningShown = false;
1746
+ }
1747
+ function getDeclarationErrorAddendum() {
1748
+ if (ReactCurrentOwner.current) {
1749
+ var name = getComponentNameFromType(ReactCurrentOwner.current.type);
1750
+ if (name) {
1751
+ return "\n\nCheck the render method of `" + name + "`.";
1752
+ }
1753
+ }
1754
+ return "";
1755
+ }
1756
+ function getSourceInfoErrorAddendum(source) {
1757
+ if (source !== void 0) {
1758
+ var fileName = source.fileName.replace(/^.*[\\\/]/, "");
1759
+ var lineNumber = source.lineNumber;
1760
+ return "\n\nCheck your code at " + fileName + ":" + lineNumber + ".";
1761
+ }
1762
+ return "";
1763
+ }
1764
+ function getSourceInfoErrorAddendumForProps(elementProps) {
1765
+ if (elementProps !== null && elementProps !== void 0) {
1766
+ return getSourceInfoErrorAddendum(elementProps.__source);
1767
+ }
1768
+ return "";
1769
+ }
1770
+ var ownerHasKeyUseWarning = {};
1771
+ function getCurrentComponentErrorInfo(parentType) {
1772
+ var info = getDeclarationErrorAddendum();
1773
+ if (!info) {
1774
+ var parentName = typeof parentType === "string" ? parentType : parentType.displayName || parentType.name;
1775
+ if (parentName) {
1776
+ info = "\n\nCheck the top-level render call using <" + parentName + ">.";
1777
+ }
1778
+ }
1779
+ return info;
1780
+ }
1781
+ function validateExplicitKey(element, parentType) {
1782
+ if (!element._store || element._store.validated || element.key != null) {
1783
+ return;
1784
+ }
1785
+ element._store.validated = true;
1786
+ var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
1787
+ if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
1788
+ return;
1789
+ }
1790
+ ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
1791
+ var childOwner = "";
1792
+ if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
1793
+ childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
1794
+ }
1795
+ {
1796
+ setCurrentlyValidatingElement$1(element);
1797
+ error('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
1798
+ setCurrentlyValidatingElement$1(null);
1799
+ }
1800
+ }
1801
+ function validateChildKeys(node, parentType) {
1802
+ if (typeof node !== "object") {
1803
+ return;
1804
+ }
1805
+ if (isArray(node)) {
1806
+ for (var i = 0; i < node.length; i++) {
1807
+ var child = node[i];
1808
+ if (isValidElement(child)) {
1809
+ validateExplicitKey(child, parentType);
1810
+ }
1811
+ }
1812
+ } else if (isValidElement(node)) {
1813
+ if (node._store) {
1814
+ node._store.validated = true;
1815
+ }
1816
+ } else if (node) {
1817
+ var iteratorFn = getIteratorFn(node);
1818
+ if (typeof iteratorFn === "function") {
1819
+ if (iteratorFn !== node.entries) {
1820
+ var iterator = iteratorFn.call(node);
1821
+ var step;
1822
+ while (!(step = iterator.next()).done) {
1823
+ if (isValidElement(step.value)) {
1824
+ validateExplicitKey(step.value, parentType);
1825
+ }
1826
+ }
1827
+ }
1828
+ }
1829
+ }
1830
+ }
1831
+ function validatePropTypes(element) {
1832
+ {
1833
+ var type = element.type;
1834
+ if (type === null || type === void 0 || typeof type === "string") {
1835
+ return;
1836
+ }
1837
+ var propTypes;
1838
+ if (typeof type === "function") {
1839
+ propTypes = type.propTypes;
1840
+ } else if (typeof type === "object" && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
1841
+ // Inner props are checked in the reconciler.
1842
+ type.$$typeof === REACT_MEMO_TYPE)) {
1843
+ propTypes = type.propTypes;
1844
+ } else {
1845
+ return;
1846
+ }
1847
+ if (propTypes) {
1848
+ var name = getComponentNameFromType(type);
1849
+ checkPropTypes(propTypes, element.props, "prop", name, element);
1850
+ } else if (type.PropTypes !== void 0 && !propTypesMisspellWarningShown) {
1851
+ propTypesMisspellWarningShown = true;
1852
+ var _name = getComponentNameFromType(type);
1853
+ error("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _name || "Unknown");
1854
+ }
1855
+ if (typeof type.getDefaultProps === "function" && !type.getDefaultProps.isReactClassApproved) {
1856
+ error("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
1857
+ }
1858
+ }
1859
+ }
1860
+ function validateFragmentProps(fragment) {
1861
+ {
1862
+ var keys = Object.keys(fragment.props);
1863
+ for (var i = 0; i < keys.length; i++) {
1864
+ var key = keys[i];
1865
+ if (key !== "children" && key !== "key") {
1866
+ setCurrentlyValidatingElement$1(fragment);
1867
+ error("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", key);
1868
+ setCurrentlyValidatingElement$1(null);
1869
+ break;
1870
+ }
1871
+ }
1872
+ if (fragment.ref !== null) {
1873
+ setCurrentlyValidatingElement$1(fragment);
1874
+ error("Invalid attribute `ref` supplied to `React.Fragment`.");
1875
+ setCurrentlyValidatingElement$1(null);
1876
+ }
1877
+ }
1878
+ }
1879
+ function createElementWithValidation(type, props, children) {
1880
+ var validType = isValidElementType(type);
1881
+ if (!validType) {
1882
+ var info = "";
1883
+ if (type === void 0 || typeof type === "object" && type !== null && Object.keys(type).length === 0) {
1884
+ info += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.";
1885
+ }
1886
+ var sourceInfo = getSourceInfoErrorAddendumForProps(props);
1887
+ if (sourceInfo) {
1888
+ info += sourceInfo;
1889
+ } else {
1890
+ info += getDeclarationErrorAddendum();
1891
+ }
1892
+ var typeString;
1893
+ if (type === null) {
1894
+ typeString = "null";
1895
+ } else if (isArray(type)) {
1896
+ typeString = "array";
1897
+ } else if (type !== void 0 && type.$$typeof === REACT_ELEMENT_TYPE) {
1898
+ typeString = "<" + (getComponentNameFromType(type.type) || "Unknown") + " />";
1899
+ info = " Did you accidentally export a JSX literal instead of a component?";
1900
+ } else {
1901
+ typeString = typeof type;
1902
+ }
1903
+ {
1904
+ error("React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", typeString, info);
1905
+ }
1906
+ }
1907
+ var element = createElement.apply(this, arguments);
1908
+ if (element == null) {
1909
+ return element;
1910
+ }
1911
+ if (validType) {
1912
+ for (var i = 2; i < arguments.length; i++) {
1913
+ validateChildKeys(arguments[i], type);
1914
+ }
1915
+ }
1916
+ if (type === REACT_FRAGMENT_TYPE) {
1917
+ validateFragmentProps(element);
1918
+ } else {
1919
+ validatePropTypes(element);
1920
+ }
1921
+ return element;
1922
+ }
1923
+ var didWarnAboutDeprecatedCreateFactory = false;
1924
+ function createFactoryWithValidation(type) {
1925
+ var validatedFactory = createElementWithValidation.bind(null, type);
1926
+ validatedFactory.type = type;
1927
+ {
1928
+ if (!didWarnAboutDeprecatedCreateFactory) {
1929
+ didWarnAboutDeprecatedCreateFactory = true;
1930
+ warn("React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead.");
1931
+ }
1932
+ Object.defineProperty(validatedFactory, "type", {
1933
+ enumerable: false,
1934
+ get: function() {
1935
+ warn("Factory.type is deprecated. Access the class directly before passing it to createFactory.");
1936
+ Object.defineProperty(this, "type", {
1937
+ value: type
1938
+ });
1939
+ return type;
1940
+ }
1941
+ });
1942
+ }
1943
+ return validatedFactory;
1944
+ }
1945
+ function cloneElementWithValidation(element, props, children) {
1946
+ var newElement = cloneElement.apply(this, arguments);
1947
+ for (var i = 2; i < arguments.length; i++) {
1948
+ validateChildKeys(arguments[i], newElement.type);
1949
+ }
1950
+ validatePropTypes(newElement);
1951
+ return newElement;
1952
+ }
1953
+ function startTransition(scope, options) {
1954
+ var prevTransition = ReactCurrentBatchConfig.transition;
1955
+ ReactCurrentBatchConfig.transition = {};
1956
+ var currentTransition = ReactCurrentBatchConfig.transition;
1957
+ {
1958
+ ReactCurrentBatchConfig.transition._updatedFibers = /* @__PURE__ */ new Set();
1959
+ }
1960
+ try {
1961
+ scope();
1962
+ } finally {
1963
+ ReactCurrentBatchConfig.transition = prevTransition;
1964
+ {
1965
+ if (prevTransition === null && currentTransition._updatedFibers) {
1966
+ var updatedFibersCount = currentTransition._updatedFibers.size;
1967
+ if (updatedFibersCount > 10) {
1968
+ warn("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.");
1969
+ }
1970
+ currentTransition._updatedFibers.clear();
1971
+ }
1972
+ }
1973
+ }
1974
+ }
1975
+ var didWarnAboutMessageChannel = false;
1976
+ var enqueueTaskImpl = null;
1977
+ function enqueueTask(task) {
1978
+ if (enqueueTaskImpl === null) {
1979
+ try {
1980
+ var requireString = ("require" + Math.random()).slice(0, 7);
1981
+ var nodeRequire = module2 && module2[requireString];
1982
+ enqueueTaskImpl = nodeRequire.call(module2, "timers").setImmediate;
1983
+ } catch (_err) {
1984
+ enqueueTaskImpl = function(callback) {
1985
+ {
1986
+ if (didWarnAboutMessageChannel === false) {
1987
+ didWarnAboutMessageChannel = true;
1988
+ if (typeof MessageChannel === "undefined") {
1989
+ error("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.");
1990
+ }
1991
+ }
1992
+ }
1993
+ var channel = new MessageChannel();
1994
+ channel.port1.onmessage = callback;
1995
+ channel.port2.postMessage(void 0);
1996
+ };
1997
+ }
1998
+ }
1999
+ return enqueueTaskImpl(task);
2000
+ }
2001
+ var actScopeDepth = 0;
2002
+ var didWarnNoAwaitAct = false;
2003
+ function act(callback) {
2004
+ {
2005
+ var prevActScopeDepth = actScopeDepth;
2006
+ actScopeDepth++;
2007
+ if (ReactCurrentActQueue.current === null) {
2008
+ ReactCurrentActQueue.current = [];
2009
+ }
2010
+ var prevIsBatchingLegacy = ReactCurrentActQueue.isBatchingLegacy;
2011
+ var result;
2012
+ try {
2013
+ ReactCurrentActQueue.isBatchingLegacy = true;
2014
+ result = callback();
2015
+ if (!prevIsBatchingLegacy && ReactCurrentActQueue.didScheduleLegacyUpdate) {
2016
+ var queue = ReactCurrentActQueue.current;
2017
+ if (queue !== null) {
2018
+ ReactCurrentActQueue.didScheduleLegacyUpdate = false;
2019
+ flushActQueue(queue);
2020
+ }
2021
+ }
2022
+ } catch (error2) {
2023
+ popActScope(prevActScopeDepth);
2024
+ throw error2;
2025
+ } finally {
2026
+ ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy;
2027
+ }
2028
+ if (result !== null && typeof result === "object" && typeof result.then === "function") {
2029
+ var thenableResult = result;
2030
+ var wasAwaited = false;
2031
+ var thenable = {
2032
+ then: function(resolve, reject) {
2033
+ wasAwaited = true;
2034
+ thenableResult.then(function(returnValue2) {
2035
+ popActScope(prevActScopeDepth);
2036
+ if (actScopeDepth === 0) {
2037
+ recursivelyFlushAsyncActWork(returnValue2, resolve, reject);
2038
+ } else {
2039
+ resolve(returnValue2);
2040
+ }
2041
+ }, function(error2) {
2042
+ popActScope(prevActScopeDepth);
2043
+ reject(error2);
2044
+ });
2045
+ }
2046
+ };
2047
+ {
2048
+ if (!didWarnNoAwaitAct && typeof Promise !== "undefined") {
2049
+ Promise.resolve().then(function() {
2050
+ }).then(function() {
2051
+ if (!wasAwaited) {
2052
+ didWarnNoAwaitAct = true;
2053
+ error("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 () => ...);");
2054
+ }
2055
+ });
2056
+ }
2057
+ }
2058
+ return thenable;
2059
+ } else {
2060
+ var returnValue = result;
2061
+ popActScope(prevActScopeDepth);
2062
+ if (actScopeDepth === 0) {
2063
+ var _queue = ReactCurrentActQueue.current;
2064
+ if (_queue !== null) {
2065
+ flushActQueue(_queue);
2066
+ ReactCurrentActQueue.current = null;
2067
+ }
2068
+ var _thenable = {
2069
+ then: function(resolve, reject) {
2070
+ if (ReactCurrentActQueue.current === null) {
2071
+ ReactCurrentActQueue.current = [];
2072
+ recursivelyFlushAsyncActWork(returnValue, resolve, reject);
2073
+ } else {
2074
+ resolve(returnValue);
2075
+ }
2076
+ }
2077
+ };
2078
+ return _thenable;
2079
+ } else {
2080
+ var _thenable2 = {
2081
+ then: function(resolve, reject) {
2082
+ resolve(returnValue);
2083
+ }
2084
+ };
2085
+ return _thenable2;
2086
+ }
2087
+ }
2088
+ }
2089
+ }
2090
+ function popActScope(prevActScopeDepth) {
2091
+ {
2092
+ if (prevActScopeDepth !== actScopeDepth - 1) {
2093
+ error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. ");
2094
+ }
2095
+ actScopeDepth = prevActScopeDepth;
2096
+ }
2097
+ }
2098
+ function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
2099
+ {
2100
+ var queue = ReactCurrentActQueue.current;
2101
+ if (queue !== null) {
2102
+ try {
2103
+ flushActQueue(queue);
2104
+ enqueueTask(function() {
2105
+ if (queue.length === 0) {
2106
+ ReactCurrentActQueue.current = null;
2107
+ resolve(returnValue);
2108
+ } else {
2109
+ recursivelyFlushAsyncActWork(returnValue, resolve, reject);
2110
+ }
2111
+ });
2112
+ } catch (error2) {
2113
+ reject(error2);
2114
+ }
2115
+ } else {
2116
+ resolve(returnValue);
2117
+ }
2118
+ }
2119
+ }
2120
+ var isFlushing = false;
2121
+ function flushActQueue(queue) {
2122
+ {
2123
+ if (!isFlushing) {
2124
+ isFlushing = true;
2125
+ var i = 0;
2126
+ try {
2127
+ for (; i < queue.length; i++) {
2128
+ var callback = queue[i];
2129
+ do {
2130
+ callback = callback(true);
2131
+ } while (callback !== null);
2132
+ }
2133
+ queue.length = 0;
2134
+ } catch (error2) {
2135
+ queue = queue.slice(i + 1);
2136
+ throw error2;
2137
+ } finally {
2138
+ isFlushing = false;
2139
+ }
2140
+ }
2141
+ }
2142
+ }
2143
+ var createElement$1 = createElementWithValidation;
2144
+ var cloneElement$1 = cloneElementWithValidation;
2145
+ var createFactory = createFactoryWithValidation;
2146
+ var Children = {
2147
+ map: mapChildren,
2148
+ forEach: forEachChildren,
2149
+ count: countChildren,
2150
+ toArray,
2151
+ only: onlyChild
2152
+ };
2153
+ exports2.Children = Children;
2154
+ exports2.Component = Component;
2155
+ exports2.Fragment = REACT_FRAGMENT_TYPE;
2156
+ exports2.Profiler = REACT_PROFILER_TYPE;
2157
+ exports2.PureComponent = PureComponent;
2158
+ exports2.StrictMode = REACT_STRICT_MODE_TYPE;
2159
+ exports2.Suspense = REACT_SUSPENSE_TYPE;
2160
+ exports2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
2161
+ exports2.act = act;
2162
+ exports2.cloneElement = cloneElement$1;
2163
+ exports2.createContext = createContext;
2164
+ exports2.createElement = createElement$1;
2165
+ exports2.createFactory = createFactory;
2166
+ exports2.createRef = createRef;
2167
+ exports2.forwardRef = forwardRef;
2168
+ exports2.isValidElement = isValidElement;
2169
+ exports2.lazy = lazy;
2170
+ exports2.memo = memo;
2171
+ exports2.startTransition = startTransition;
2172
+ exports2.unstable_act = act;
2173
+ exports2.useCallback = useCallback;
2174
+ exports2.useContext = useContext;
2175
+ exports2.useDebugValue = useDebugValue;
2176
+ exports2.useDeferredValue = useDeferredValue;
2177
+ exports2.useEffect = useEffect;
2178
+ exports2.useId = useId;
2179
+ exports2.useImperativeHandle = useImperativeHandle;
2180
+ exports2.useInsertionEffect = useInsertionEffect;
2181
+ exports2.useLayoutEffect = useLayoutEffect;
2182
+ exports2.useMemo = useMemo;
2183
+ exports2.useReducer = useReducer;
2184
+ exports2.useRef = useRef;
2185
+ exports2.useState = useState;
2186
+ exports2.useSyncExternalStore = useSyncExternalStore2;
2187
+ exports2.useTransition = useTransition;
2188
+ exports2.version = ReactVersion;
2189
+ if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") {
2190
+ __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
2191
+ }
2192
+ })();
2193
+ }
2194
+ }
2195
+ });
2196
+
2197
+ // ../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js
2198
+ var require_react = __commonJS({
2199
+ "../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js"(exports2, module2) {
2200
+ "use strict";
2201
+ if (process.env.NODE_ENV === "production") {
2202
+ module2.exports = require_react_production_min();
2203
+ } else {
2204
+ module2.exports = require_react_development();
2205
+ }
2206
+ }
2207
+ });
2208
+
2209
+ // src/index.ts
2210
+ var src_exports = {};
2211
+ __export(src_exports, {
2212
+ HotUpdater: () => HotUpdater2,
2213
+ hotUpdaterStore: () => hotUpdaterStore,
2214
+ useHotUpdaterStore: () => useHotUpdaterStore
2215
+ });
2216
+ module.exports = __toCommonJS(src_exports);
2217
+ var import_utils2 = require("@hot-updater/utils");
2218
+
2219
+ // src/const.ts
2220
+ var NIL_UUID = "00000000-0000-0000-0000-000000000000";
2221
+
2222
+ // src/ensureBundles.ts
2223
+ var ensureBundles = async (bundle) => {
2224
+ try {
2225
+ let bundles = null;
2226
+ if (typeof bundle === "string") {
2227
+ if (bundle.startsWith("http")) {
2228
+ const response = await fetch(bundle);
2229
+ bundles = await response.json();
2230
+ }
2231
+ } else if (typeof bundle === "function") {
2232
+ bundles = await bundle();
2233
+ } else {
2234
+ bundles = bundle;
2235
+ }
2236
+ return bundles ?? [];
2237
+ } catch {
2238
+ return [];
2239
+ }
2240
+ };
2241
+
2242
+ // src/init.tsx
2243
+ var import_utils = require("@hot-updater/utils");
2244
+ var import_react_native3 = require("react-native");
7
2245
 
8
2246
  // src/error.ts
9
2247
  var HotUpdaterError = class extends Error {
@@ -14,138 +2252,41 @@ var HotUpdaterError = class extends Error {
14
2252
  };
15
2253
 
16
2254
  // src/native.ts
17
- var { HotUpdater } = NativeModules;
18
- var getBundleVersion = async () => {
19
- return new Promise((resolve) => {
20
- HotUpdater.getBundleVersion((version) => {
21
- resolve(version ?? -1);
22
- });
23
- });
24
- };
25
- var updateBundle = (bundleVersion, zipUrl) => {
26
- return new Promise((resolve, reject) => {
27
- HotUpdater.updateBundle(
28
- String(bundleVersion),
29
- zipUrl,
30
- (success) => {
31
- if (success) {
32
- resolve(success);
33
- } else {
34
- reject(
35
- new HotUpdaterError("Failed to download and install the update")
36
- );
37
- }
38
- }
39
- );
40
- });
41
- };
42
- var getAppVersion = async () => {
43
- return new Promise((resolve) => {
44
- HotUpdater.getAppVersion((version) => {
45
- resolve(version);
46
- });
47
- });
48
- };
49
- var reload = () => {
50
- HotUpdater.reload();
51
- };
52
- var initializeOnAppUpdate = () => {
53
- HotUpdater.initializeOnAppUpdate();
54
- };
2255
+ var import_react_native2 = require("react-native");
2256
+ var LINKING_ERROR = (
2257
+ // biome-ignore lint/style/useTemplate: <explanation>
2258
+ `The package '@hot-updater/react-native' doesn't seem to be linked. Make sure:
55
2259
 
56
- // src/utils.ts
57
- var isNullable = (value) => value === null || value === void 0;
58
-
59
- // src/checkForUpdate.ts
60
- var findLatestSources = (sources) => {
61
- return sources?.filter((item) => item.enabled)?.sort((a, b) => b.bundleVersion - a.bundleVersion)?.[0] ?? null;
62
- };
63
- var checkForRollback = (sources, currentBundleVersion) => {
64
- const enabled = sources?.find(
65
- (item) => item.bundleVersion === currentBundleVersion
66
- )?.enabled;
67
- const availableOldVersion = sources?.find(
68
- (item) => item.bundleVersion < currentBundleVersion && item.enabled
69
- )?.enabled;
70
- if (isNullable(enabled)) {
71
- return availableOldVersion;
2260
+ ` + import_react_native2.Platform.select({ ios: "- You have run 'pod install'\n", default: "" }) + "- You rebuilt the app after installing the package\n- You are not using Expo Go\n"
2261
+ );
2262
+ var isTurboModuleEnabled = global.__turboModuleProxy != null;
2263
+ var HotUpdaterModule = isTurboModuleEnabled ? (init_NativeHotUpdater(), __toCommonJS(NativeHotUpdater_exports)).default : import_react_native2.NativeModules.HotUpdater;
2264
+ var HotUpdaterNative = HotUpdaterModule ? HotUpdaterModule : new Proxy(
2265
+ {},
2266
+ {
2267
+ get() {
2268
+ throw new Error(LINKING_ERROR);
2269
+ }
72
2270
  }
73
- return !enabled;
2271
+ );
2272
+ var addListener = (eventName, listener) => {
2273
+ const eventEmitter = new import_react_native2.NativeEventEmitter(HotUpdaterNative);
2274
+ eventEmitter?.addListener(eventName, listener);
74
2275
  };
75
- var ensureUpdateSource = async (updateSource) => {
76
- let source = null;
77
- if (typeof updateSource === "string") {
78
- if (updateSource.startsWith("http")) {
79
- const response = await fetch(updateSource);
80
- source = await response.json();
81
- }
82
- } else if (typeof updateSource === "function") {
83
- source = await updateSource();
84
- } else {
85
- source = updateSource;
86
- }
87
- if (!source) {
88
- throw new Error("Invalid source");
89
- }
90
- return source;
2276
+ var getBundleId = () => {
2277
+ return HotUpdater.HOT_UPDATER_BUNDLE_ID ?? NIL_UUID;
91
2278
  };
92
- var checkForUpdate = async (updateSources) => {
93
- const sources = await ensureUpdateSource(updateSources);
94
- const currentAppVersion = await getAppVersion();
95
- const platform = Platform.OS;
96
- const appVersionSources = currentAppVersion ? filterTargetVersion(sources, currentAppVersion, platform) : [];
97
- const currentBundleVersion = await getBundleVersion();
98
- const isRollback = checkForRollback(appVersionSources, currentBundleVersion);
99
- const latestSource = await findLatestSources(appVersionSources);
100
- if (!latestSource) {
101
- if (isRollback) {
102
- return {
103
- bundleVersion: 0,
104
- forceUpdate: true,
105
- file: null,
106
- hash: null,
107
- status: "ROLLBACK"
108
- };
109
- }
110
- return null;
111
- }
112
- if (latestSource.file) {
113
- if (isRollback) {
114
- if (latestSource.bundleVersion === currentBundleVersion) {
115
- return null;
116
- }
117
- if (latestSource.bundleVersion > currentBundleVersion) {
118
- return {
119
- bundleVersion: latestSource.bundleVersion,
120
- forceUpdate: latestSource.forceUpdate,
121
- file: latestSource.file,
122
- hash: latestSource.hash,
123
- status: "UPDATE"
124
- };
125
- }
126
- return {
127
- bundleVersion: latestSource.bundleVersion,
128
- forceUpdate: true,
129
- file: latestSource.file,
130
- hash: latestSource.hash,
131
- status: "ROLLBACK"
132
- };
133
- }
134
- }
135
- if (latestSource.bundleVersion > currentBundleVersion) {
136
- return {
137
- bundleVersion: latestSource.bundleVersion,
138
- forceUpdate: latestSource.forceUpdate,
139
- file: latestSource.file,
140
- hash: latestSource.hash,
141
- status: "UPDATE"
142
- };
143
- }
144
- return null;
2279
+ var updateBundle = (bundleId, zipUrl) => {
2280
+ return HotUpdaterNative.updateBundle(bundleId, zipUrl);
2281
+ };
2282
+ var getAppVersion = () => {
2283
+ return HotUpdaterNative.getAppVersion();
2284
+ };
2285
+ var reload = () => {
2286
+ HotUpdaterNative.reload();
145
2287
  };
146
2288
 
147
2289
  // src/init.tsx
148
- import { Platform as Platform2 } from "react-native";
149
2290
  var init = async (config) => {
150
2291
  if (__DEV__) {
151
2292
  console.warn(
@@ -153,21 +2294,33 @@ var init = async (config) => {
153
2294
  );
154
2295
  return;
155
2296
  }
156
- if (!["ios", "android"].includes(Platform2.OS)) {
2297
+ if (!["ios", "android"].includes(import_react_native3.Platform.OS)) {
157
2298
  const error = new HotUpdaterError(
158
2299
  "HotUpdater is only supported on iOS and Android"
159
2300
  );
160
2301
  config?.onError?.(error);
161
2302
  throw error;
162
2303
  }
163
- await initializeOnAppUpdate();
164
- const update = await checkForUpdate(config.source);
2304
+ const currentAppVersion = await getAppVersion();
2305
+ const platform = import_react_native3.Platform.OS;
2306
+ const currentBundleId = await getBundleId();
2307
+ if (!currentAppVersion) {
2308
+ const error = new HotUpdaterError("Failed to get app version");
2309
+ config?.onError?.(error);
2310
+ throw error;
2311
+ }
2312
+ const bundles = await ensureBundles(config.source);
2313
+ const update = await (0, import_utils.checkForUpdate)(bundles, {
2314
+ appVersion: currentAppVersion,
2315
+ bundleId: currentBundleId,
2316
+ platform
2317
+ });
165
2318
  if (!update) {
166
2319
  config?.onSuccess?.("UP_TO_DATE");
167
2320
  return;
168
2321
  }
169
2322
  try {
170
- const isSuccess = await updateBundle(update.bundleVersion, update.file);
2323
+ const isSuccess = await updateBundle(update.id, update.file || "");
171
2324
  if (isSuccess && update.forceUpdate) {
172
2325
  reload();
173
2326
  config?.onSuccess?.("INSTALLING_UPDATE");
@@ -180,14 +2333,88 @@ var init = async (config) => {
180
2333
  }
181
2334
  };
182
2335
 
2336
+ // src/store.ts
2337
+ var import_react = __toESM(require_react());
2338
+ var createHotUpdaterStore = () => {
2339
+ let state = {
2340
+ progress: 0
2341
+ };
2342
+ const getState = () => {
2343
+ return state;
2344
+ };
2345
+ const listeners = /* @__PURE__ */ new Set();
2346
+ const emitChange = () => {
2347
+ for (const listener of listeners) {
2348
+ listener();
2349
+ }
2350
+ };
2351
+ const setState = (newState) => {
2352
+ state = {
2353
+ ...state,
2354
+ ...newState
2355
+ };
2356
+ emitChange();
2357
+ };
2358
+ const subscribe = (listener) => {
2359
+ listeners.add(listener);
2360
+ return () => listeners.delete(listener);
2361
+ };
2362
+ return { getState, setState, subscribe };
2363
+ };
2364
+ var hotUpdaterStore = createHotUpdaterStore();
2365
+ var useHotUpdaterStore = () => {
2366
+ return (0, import_react.useSyncExternalStore)(
2367
+ hotUpdaterStore.subscribe,
2368
+ hotUpdaterStore.getState,
2369
+ hotUpdaterStore.getState
2370
+ );
2371
+ };
2372
+
183
2373
  // src/index.ts
2374
+ addListener("onProgress", ({ progress }) => {
2375
+ hotUpdaterStore.setState({ progress });
2376
+ });
184
2377
  var HotUpdater2 = {
185
2378
  init,
186
2379
  reload,
187
- checkForUpdate,
188
2380
  getAppVersion,
189
- getBundleVersion
190
- };
191
- export {
192
- HotUpdater2 as HotUpdater
2381
+ getBundleId,
2382
+ addListener,
2383
+ ensureBundles,
2384
+ updateBundle,
2385
+ checkForUpdate: import_utils2.checkForUpdate,
2386
+ /**
2387
+ * In production environment, this value will be replaced with a uuidv7.
2388
+ */
2389
+ HOT_UPDATER_BUNDLE_ID: NIL_UUID
193
2390
  };
2391
+ // Annotate the CommonJS export names for ESM import in node:
2392
+ 0 && (module.exports = {
2393
+ HotUpdater,
2394
+ hotUpdaterStore,
2395
+ useHotUpdaterStore
2396
+ });
2397
+ /*! Bundled license information:
2398
+
2399
+ react/cjs/react.production.min.js:
2400
+ (**
2401
+ * @license React
2402
+ * react.production.min.js
2403
+ *
2404
+ * Copyright (c) Facebook, Inc. and its affiliates.
2405
+ *
2406
+ * This source code is licensed under the MIT license found in the
2407
+ * LICENSE file in the root directory of this source tree.
2408
+ *)
2409
+
2410
+ react/cjs/react.development.js:
2411
+ (**
2412
+ * @license React
2413
+ * react.development.js
2414
+ *
2415
+ * Copyright (c) Facebook, Inc. and its affiliates.
2416
+ *
2417
+ * This source code is licensed under the MIT license found in the
2418
+ * LICENSE file in the root directory of this source tree.
2419
+ *)
2420
+ */