@yoltra/devtools-ui 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.es.md +1 -1
- package/README.md +1 -1
- package/dist/devtools-ui.cjs.js +18 -2
- package/dist/devtools-ui.cjs.js.map +1 -1
- package/dist/devtools-ui.esm.js +475 -437
- package/dist/devtools-ui.esm.js.map +1 -1
- package/dist/types/context/HubProvider.d.ts +1 -1
- package/dist/types/hooks/stateReplay.d.ts +53 -0
- package/dist/types/types.d.ts +10 -0
- package/package.json +20 -8
package/dist/devtools-ui.esm.js
CHANGED
|
@@ -1,291 +1,310 @@
|
|
|
1
|
-
import Re, { createContext as ve, useState as
|
|
2
|
-
import { DevtoolsRole as
|
|
1
|
+
import Re, { createContext as ve, useState as k, useRef as A, useCallback as O, useEffect as M, useContext as be, useMemo as Oe } from "react";
|
|
2
|
+
import { DevtoolsRole as b, PROTOCOL_VERSION as K } from "@yoltra/devtools-protocol";
|
|
3
3
|
const H = () => {
|
|
4
4
|
}, de = ve({
|
|
5
5
|
status: "disconnected",
|
|
6
|
+
extensionId: "",
|
|
6
7
|
send: H,
|
|
7
8
|
subscribe: () => H,
|
|
8
9
|
disconnect: H,
|
|
9
10
|
reconnect: H
|
|
10
11
|
});
|
|
11
12
|
var X = { exports: {} }, L = {};
|
|
13
|
+
/**
|
|
14
|
+
* @license React
|
|
15
|
+
* react-jsx-runtime.production.js
|
|
16
|
+
*
|
|
17
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the MIT license found in the
|
|
20
|
+
* LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/
|
|
12
22
|
var ie;
|
|
13
|
-
function
|
|
23
|
+
function ye() {
|
|
14
24
|
if (ie) return L;
|
|
15
25
|
ie = 1;
|
|
16
|
-
var e =
|
|
17
|
-
function
|
|
18
|
-
var
|
|
19
|
-
if (c !== void 0 && (
|
|
26
|
+
var e = Symbol.for("react.transitional.element"), s = Symbol.for("react.fragment");
|
|
27
|
+
function r(o, t, c) {
|
|
28
|
+
var i = null;
|
|
29
|
+
if (c !== void 0 && (i = "" + c), t.key !== void 0 && (i = "" + t.key), "key" in t) {
|
|
20
30
|
c = {};
|
|
21
|
-
for (var
|
|
22
|
-
|
|
23
|
-
} else c =
|
|
24
|
-
return
|
|
31
|
+
for (var a in t)
|
|
32
|
+
a !== "key" && (c[a] = t[a]);
|
|
33
|
+
} else c = t;
|
|
34
|
+
return t = c.ref, {
|
|
25
35
|
$$typeof: e,
|
|
26
36
|
type: o,
|
|
27
|
-
key:
|
|
28
|
-
ref:
|
|
37
|
+
key: i,
|
|
38
|
+
ref: t !== void 0 ? t : null,
|
|
29
39
|
props: c
|
|
30
40
|
};
|
|
31
41
|
}
|
|
32
|
-
return L.Fragment = s, L.jsx =
|
|
42
|
+
return L.Fragment = s, L.jsx = r, L.jsxs = r, L;
|
|
33
43
|
}
|
|
34
44
|
var U = {};
|
|
45
|
+
/**
|
|
46
|
+
* @license React
|
|
47
|
+
* react-jsx-runtime.development.js
|
|
48
|
+
*
|
|
49
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
50
|
+
*
|
|
51
|
+
* This source code is licensed under the MIT license found in the
|
|
52
|
+
* LICENSE file in the root directory of this source tree.
|
|
53
|
+
*/
|
|
35
54
|
var ae;
|
|
36
|
-
function
|
|
55
|
+
function _e() {
|
|
37
56
|
return ae || (ae = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
38
|
-
function e(
|
|
39
|
-
if (
|
|
40
|
-
if (typeof
|
|
41
|
-
return
|
|
42
|
-
if (typeof
|
|
43
|
-
switch (
|
|
44
|
-
case p:
|
|
45
|
-
return "Fragment";
|
|
57
|
+
function e(n) {
|
|
58
|
+
if (n == null) return null;
|
|
59
|
+
if (typeof n == "function")
|
|
60
|
+
return n.$$typeof === he ? null : n.displayName || n.name || null;
|
|
61
|
+
if (typeof n == "string") return n;
|
|
62
|
+
switch (n) {
|
|
46
63
|
case N:
|
|
64
|
+
return "Fragment";
|
|
65
|
+
case R:
|
|
47
66
|
return "Profiler";
|
|
48
|
-
case
|
|
67
|
+
case E:
|
|
49
68
|
return "StrictMode";
|
|
50
|
-
case
|
|
69
|
+
case d:
|
|
51
70
|
return "Suspense";
|
|
52
|
-
case
|
|
71
|
+
case w:
|
|
53
72
|
return "SuspenseList";
|
|
54
73
|
case Se:
|
|
55
74
|
return "Activity";
|
|
56
75
|
}
|
|
57
|
-
if (typeof
|
|
58
|
-
switch (typeof
|
|
76
|
+
if (typeof n == "object")
|
|
77
|
+
switch (typeof n.tag == "number" && console.error(
|
|
59
78
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
60
|
-
),
|
|
61
|
-
case
|
|
79
|
+
), n.$$typeof) {
|
|
80
|
+
case T:
|
|
62
81
|
return "Portal";
|
|
63
|
-
case d:
|
|
64
|
-
return (t.displayName || "Context") + ".Provider";
|
|
65
82
|
case g:
|
|
66
|
-
return (
|
|
67
|
-
case R:
|
|
68
|
-
var u = t.render;
|
|
69
|
-
return t = t.displayName, t || (t = u.displayName || u.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
|
|
83
|
+
return (n.displayName || "Context") + ".Provider";
|
|
70
84
|
case x:
|
|
71
|
-
return
|
|
85
|
+
return (n._context.displayName || "Context") + ".Consumer";
|
|
86
|
+
case I:
|
|
87
|
+
var f = n.render;
|
|
88
|
+
return n = n.displayName, n || (n = f.displayName || f.name || "", n = n !== "" ? "ForwardRef(" + n + ")" : "ForwardRef"), n;
|
|
89
|
+
case C:
|
|
90
|
+
return f = n.displayName || null, f !== null ? f : e(n.type) || "Memo";
|
|
72
91
|
case V:
|
|
73
|
-
|
|
92
|
+
f = n._payload, n = n._init;
|
|
74
93
|
try {
|
|
75
|
-
return e(
|
|
94
|
+
return e(n(f));
|
|
76
95
|
} catch {
|
|
77
96
|
}
|
|
78
97
|
}
|
|
79
98
|
return null;
|
|
80
99
|
}
|
|
81
|
-
function s(
|
|
82
|
-
return "" +
|
|
100
|
+
function s(n) {
|
|
101
|
+
return "" + n;
|
|
83
102
|
}
|
|
84
|
-
function n
|
|
103
|
+
function r(n) {
|
|
85
104
|
try {
|
|
86
|
-
s(
|
|
87
|
-
var
|
|
105
|
+
s(n);
|
|
106
|
+
var f = !1;
|
|
88
107
|
} catch {
|
|
89
|
-
|
|
108
|
+
f = !0;
|
|
90
109
|
}
|
|
91
|
-
if (
|
|
92
|
-
|
|
93
|
-
var
|
|
94
|
-
return
|
|
95
|
-
|
|
110
|
+
if (f) {
|
|
111
|
+
f = console;
|
|
112
|
+
var p = f.error, y = typeof Symbol == "function" && Symbol.toStringTag && n[Symbol.toStringTag] || n.constructor.name || "Object";
|
|
113
|
+
return p.call(
|
|
114
|
+
f,
|
|
96
115
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
97
|
-
|
|
98
|
-
), s(
|
|
116
|
+
y
|
|
117
|
+
), s(n);
|
|
99
118
|
}
|
|
100
119
|
}
|
|
101
|
-
function o(
|
|
102
|
-
if (
|
|
103
|
-
if (typeof
|
|
120
|
+
function o(n) {
|
|
121
|
+
if (n === N) return "<>";
|
|
122
|
+
if (typeof n == "object" && n !== null && n.$$typeof === V)
|
|
104
123
|
return "<...>";
|
|
105
124
|
try {
|
|
106
|
-
var
|
|
107
|
-
return
|
|
125
|
+
var f = e(n);
|
|
126
|
+
return f ? "<" + f + ">" : "<...>";
|
|
108
127
|
} catch {
|
|
109
128
|
return "<...>";
|
|
110
129
|
}
|
|
111
130
|
}
|
|
112
|
-
function
|
|
113
|
-
var
|
|
114
|
-
return
|
|
131
|
+
function t() {
|
|
132
|
+
var n = J.A;
|
|
133
|
+
return n === null ? null : n.getOwner();
|
|
115
134
|
}
|
|
116
135
|
function c() {
|
|
117
136
|
return Error("react-stack-top-frame");
|
|
118
137
|
}
|
|
119
|
-
function
|
|
120
|
-
if (te.call(
|
|
121
|
-
var
|
|
122
|
-
if (
|
|
138
|
+
function i(n) {
|
|
139
|
+
if (te.call(n, "key")) {
|
|
140
|
+
var f = Object.getOwnPropertyDescriptor(n, "key").get;
|
|
141
|
+
if (f && f.isReactWarning) return !1;
|
|
123
142
|
}
|
|
124
|
-
return
|
|
143
|
+
return n.key !== void 0;
|
|
125
144
|
}
|
|
126
|
-
function
|
|
127
|
-
function
|
|
145
|
+
function a(n, f) {
|
|
146
|
+
function p() {
|
|
128
147
|
re || (re = !0, console.error(
|
|
129
148
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
130
|
-
|
|
149
|
+
f
|
|
131
150
|
));
|
|
132
151
|
}
|
|
133
|
-
|
|
134
|
-
get:
|
|
152
|
+
p.isReactWarning = !0, Object.defineProperty(n, "key", {
|
|
153
|
+
get: p,
|
|
135
154
|
configurable: !0
|
|
136
155
|
});
|
|
137
156
|
}
|
|
138
|
-
function
|
|
139
|
-
var
|
|
140
|
-
return ne[
|
|
157
|
+
function u() {
|
|
158
|
+
var n = e(this.type);
|
|
159
|
+
return ne[n] || (ne[n] = !0, console.error(
|
|
141
160
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
142
|
-
)),
|
|
161
|
+
)), n = this.props.ref, n !== void 0 ? n : null;
|
|
143
162
|
}
|
|
144
|
-
function
|
|
145
|
-
return
|
|
146
|
-
$$typeof:
|
|
147
|
-
type:
|
|
148
|
-
key:
|
|
149
|
-
props:
|
|
163
|
+
function S(n, f, p, y, D, P, W, G) {
|
|
164
|
+
return p = P.ref, n = {
|
|
165
|
+
$$typeof: v,
|
|
166
|
+
type: n,
|
|
167
|
+
key: f,
|
|
168
|
+
props: P,
|
|
150
169
|
_owner: D
|
|
151
|
-
}, (
|
|
170
|
+
}, (p !== void 0 ? p : null) !== null ? Object.defineProperty(n, "ref", {
|
|
152
171
|
enumerable: !1,
|
|
153
|
-
get:
|
|
154
|
-
}) : Object.defineProperty(
|
|
172
|
+
get: u
|
|
173
|
+
}) : Object.defineProperty(n, "ref", { enumerable: !1, value: null }), n._store = {}, Object.defineProperty(n._store, "validated", {
|
|
155
174
|
configurable: !1,
|
|
156
175
|
enumerable: !1,
|
|
157
176
|
writable: !0,
|
|
158
177
|
value: 0
|
|
159
|
-
}), Object.defineProperty(
|
|
178
|
+
}), Object.defineProperty(n, "_debugInfo", {
|
|
160
179
|
configurable: !1,
|
|
161
180
|
enumerable: !1,
|
|
162
181
|
writable: !0,
|
|
163
182
|
value: null
|
|
164
|
-
}), Object.defineProperty(
|
|
183
|
+
}), Object.defineProperty(n, "_debugStack", {
|
|
165
184
|
configurable: !1,
|
|
166
185
|
enumerable: !1,
|
|
167
186
|
writable: !0,
|
|
168
187
|
value: W
|
|
169
|
-
}), Object.defineProperty(
|
|
188
|
+
}), Object.defineProperty(n, "_debugTask", {
|
|
170
189
|
configurable: !1,
|
|
171
190
|
enumerable: !1,
|
|
172
191
|
writable: !0,
|
|
173
192
|
value: G
|
|
174
|
-
}), Object.freeze && (Object.freeze(
|
|
193
|
+
}), Object.freeze && (Object.freeze(n.props), Object.freeze(n)), n;
|
|
175
194
|
}
|
|
176
|
-
function
|
|
177
|
-
var
|
|
178
|
-
if (
|
|
179
|
-
if (
|
|
180
|
-
if (
|
|
181
|
-
for (
|
|
182
|
-
|
|
183
|
-
Object.freeze && Object.freeze(
|
|
195
|
+
function l(n, f, p, y, D, P, W, G) {
|
|
196
|
+
var _ = f.children;
|
|
197
|
+
if (_ !== void 0)
|
|
198
|
+
if (y)
|
|
199
|
+
if (Te(_)) {
|
|
200
|
+
for (y = 0; y < _.length; y++)
|
|
201
|
+
h(_[y]);
|
|
202
|
+
Object.freeze && Object.freeze(_);
|
|
184
203
|
} else
|
|
185
204
|
console.error(
|
|
186
205
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
187
206
|
);
|
|
188
|
-
else
|
|
189
|
-
if (te.call(
|
|
190
|
-
|
|
191
|
-
var Y = Object.keys(
|
|
207
|
+
else h(_);
|
|
208
|
+
if (te.call(f, "key")) {
|
|
209
|
+
_ = e(n);
|
|
210
|
+
var Y = Object.keys(f).filter(function(me) {
|
|
192
211
|
return me !== "key";
|
|
193
212
|
});
|
|
194
|
-
|
|
213
|
+
y = 0 < Y.length ? "{key: someKey, " + Y.join(": ..., ") + ": ...}" : "{key: someKey}", ce[_ + y] || (Y = 0 < Y.length ? "{" + Y.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
195
214
|
`A props object containing a "key" prop is being spread into JSX:
|
|
196
215
|
let props = %s;
|
|
197
216
|
<%s {...props} />
|
|
198
217
|
React keys must be passed directly to JSX without using spread:
|
|
199
218
|
let props = %s;
|
|
200
219
|
<%s key={someKey} {...props} />`,
|
|
201
|
-
_,
|
|
202
220
|
y,
|
|
221
|
+
_,
|
|
203
222
|
Y,
|
|
204
|
-
|
|
205
|
-
), ce[
|
|
223
|
+
_
|
|
224
|
+
), ce[_ + y] = !0);
|
|
206
225
|
}
|
|
207
|
-
if (
|
|
208
|
-
|
|
209
|
-
for (var B in
|
|
210
|
-
B !== "key" && (
|
|
211
|
-
} else
|
|
212
|
-
return
|
|
213
|
-
|
|
214
|
-
typeof
|
|
215
|
-
),
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
226
|
+
if (_ = null, p !== void 0 && (r(p), _ = "" + p), i(f) && (r(f.key), _ = "" + f.key), "key" in f) {
|
|
227
|
+
p = {};
|
|
228
|
+
for (var B in f)
|
|
229
|
+
B !== "key" && (p[B] = f[B]);
|
|
230
|
+
} else p = f;
|
|
231
|
+
return _ && a(
|
|
232
|
+
p,
|
|
233
|
+
typeof n == "function" ? n.displayName || n.name || "Unknown" : n
|
|
234
|
+
), S(
|
|
235
|
+
n,
|
|
236
|
+
_,
|
|
237
|
+
P,
|
|
219
238
|
D,
|
|
220
|
-
|
|
221
|
-
|
|
239
|
+
t(),
|
|
240
|
+
p,
|
|
222
241
|
W,
|
|
223
242
|
G
|
|
224
243
|
);
|
|
225
244
|
}
|
|
226
|
-
function
|
|
227
|
-
typeof
|
|
245
|
+
function h(n) {
|
|
246
|
+
typeof n == "object" && n !== null && n.$$typeof === v && n._store && (n._store.validated = 1);
|
|
228
247
|
}
|
|
229
|
-
var
|
|
248
|
+
var m = Re, v = Symbol.for("react.transitional.element"), T = Symbol.for("react.portal"), N = Symbol.for("react.fragment"), E = Symbol.for("react.strict_mode"), R = Symbol.for("react.profiler"), x = Symbol.for("react.consumer"), g = Symbol.for("react.context"), I = Symbol.for("react.forward_ref"), d = Symbol.for("react.suspense"), w = Symbol.for("react.suspense_list"), C = Symbol.for("react.memo"), V = Symbol.for("react.lazy"), Se = Symbol.for("react.activity"), he = Symbol.for("react.client.reference"), J = m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, te = Object.prototype.hasOwnProperty, Te = Array.isArray, q = console.createTask ? console.createTask : function() {
|
|
230
249
|
return null;
|
|
231
250
|
};
|
|
232
|
-
|
|
233
|
-
react_stack_bottom_frame: function(
|
|
234
|
-
return
|
|
251
|
+
m = {
|
|
252
|
+
react_stack_bottom_frame: function(n) {
|
|
253
|
+
return n();
|
|
235
254
|
}
|
|
236
255
|
};
|
|
237
|
-
var re, ne = {}, se =
|
|
238
|
-
|
|
256
|
+
var re, ne = {}, se = m.react_stack_bottom_frame.bind(
|
|
257
|
+
m,
|
|
239
258
|
c
|
|
240
259
|
)(), oe = q(o(c)), ce = {};
|
|
241
|
-
U.Fragment =
|
|
242
|
-
var
|
|
243
|
-
return
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
260
|
+
U.Fragment = N, U.jsx = function(n, f, p, y, D) {
|
|
261
|
+
var P = 1e4 > J.recentlyCreatedOwnerStacks++;
|
|
262
|
+
return l(
|
|
263
|
+
n,
|
|
264
|
+
f,
|
|
265
|
+
p,
|
|
247
266
|
!1,
|
|
248
|
-
|
|
267
|
+
y,
|
|
249
268
|
D,
|
|
250
|
-
|
|
251
|
-
|
|
269
|
+
P ? Error("react-stack-top-frame") : se,
|
|
270
|
+
P ? q(o(n)) : oe
|
|
252
271
|
);
|
|
253
|
-
}, U.jsxs = function(
|
|
254
|
-
var
|
|
255
|
-
return
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
272
|
+
}, U.jsxs = function(n, f, p, y, D) {
|
|
273
|
+
var P = 1e4 > J.recentlyCreatedOwnerStacks++;
|
|
274
|
+
return l(
|
|
275
|
+
n,
|
|
276
|
+
f,
|
|
277
|
+
p,
|
|
259
278
|
!0,
|
|
260
|
-
|
|
279
|
+
y,
|
|
261
280
|
D,
|
|
262
|
-
|
|
263
|
-
|
|
281
|
+
P ? Error("react-stack-top-frame") : se,
|
|
282
|
+
P ? q(o(n)) : oe
|
|
264
283
|
);
|
|
265
284
|
};
|
|
266
285
|
})()), U;
|
|
267
286
|
}
|
|
268
287
|
var ue;
|
|
269
288
|
function Ne() {
|
|
270
|
-
return ue || (ue = 1, process.env.NODE_ENV === "production" ? X.exports =
|
|
289
|
+
return ue || (ue = 1, process.env.NODE_ENV === "production" ? X.exports = ye() : X.exports = _e()), X.exports;
|
|
271
290
|
}
|
|
272
|
-
var
|
|
273
|
-
const
|
|
291
|
+
var Ie = Ne();
|
|
292
|
+
const Ae = {
|
|
274
293
|
timeTravel: !0,
|
|
275
294
|
eventReplay: !0,
|
|
276
295
|
stateExplorer: !0,
|
|
277
296
|
eventEmit: !0,
|
|
278
297
|
performanceMetrics: !0
|
|
279
|
-
}, ke = 750,
|
|
280
|
-
function
|
|
298
|
+
}, ke = 750, xe = 3e4;
|
|
299
|
+
function Le({
|
|
281
300
|
config: e,
|
|
282
301
|
children: s
|
|
283
302
|
}) {
|
|
284
|
-
const [
|
|
285
|
-
|
|
286
|
-
const
|
|
287
|
-
const
|
|
288
|
-
if (!
|
|
303
|
+
const [r, o] = k("disconnected"), t = A(null), c = A(/* @__PURE__ */ new Set()), i = A(0), a = A(null), u = A(crypto.randomUUID()), S = A(e);
|
|
304
|
+
S.current = e;
|
|
305
|
+
const l = O(() => {
|
|
306
|
+
const E = S.current, x = `ws://${E.host ?? "localhost"}:${E.port}`, g = E.WebSocket ?? (typeof globalThis.WebSocket < "u" ? globalThis.WebSocket : void 0);
|
|
307
|
+
if (!g) {
|
|
289
308
|
console.error(
|
|
290
309
|
"[Yoltra DevTools] No WebSocket implementation available. In Node.js, pass { WebSocket } from 'ws' via config.WebSocket."
|
|
291
310
|
);
|
|
@@ -293,182 +312,183 @@ function Ye({
|
|
|
293
312
|
}
|
|
294
313
|
o("connecting");
|
|
295
314
|
try {
|
|
296
|
-
const
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
const
|
|
315
|
+
const I = new g(x);
|
|
316
|
+
t.current = I, I.onopen = () => {
|
|
317
|
+
i.current = 0;
|
|
318
|
+
const d = JSON.stringify({
|
|
300
319
|
type: "HANDSHAKE_REQUEST",
|
|
301
320
|
protocolVersion: K,
|
|
302
|
-
role:
|
|
321
|
+
role: b.EXTENSION,
|
|
303
322
|
extension: {
|
|
304
|
-
id:
|
|
305
|
-
name:
|
|
306
|
-
capabilities:
|
|
323
|
+
id: u.current,
|
|
324
|
+
name: E.extensionName ?? "DevTools UI",
|
|
325
|
+
capabilities: Ae
|
|
307
326
|
}
|
|
308
327
|
});
|
|
309
|
-
|
|
310
|
-
},
|
|
328
|
+
I.send(d);
|
|
329
|
+
}, I.onmessage = (d) => {
|
|
311
330
|
try {
|
|
312
|
-
const
|
|
313
|
-
if (
|
|
314
|
-
|
|
331
|
+
const w = typeof d.data == "string" ? d.data : String(d.data), C = JSON.parse(w);
|
|
332
|
+
if (C.type === "HANDSHAKE_RESPONSE") {
|
|
333
|
+
C.success ? o("connected") : I.close();
|
|
315
334
|
return;
|
|
316
335
|
}
|
|
317
|
-
c.current.forEach((V) => V(
|
|
336
|
+
c.current.forEach((V) => V(C));
|
|
318
337
|
} catch {
|
|
319
338
|
}
|
|
320
|
-
},
|
|
321
|
-
|
|
322
|
-
const
|
|
323
|
-
if (
|
|
324
|
-
const
|
|
325
|
-
ke * Math.pow(2,
|
|
326
|
-
|
|
339
|
+
}, I.onclose = () => {
|
|
340
|
+
t.current = null, o("disconnected");
|
|
341
|
+
const d = E.autoReconnect ?? !0, w = E.maxReconnectAttempts ?? 1 / 0;
|
|
342
|
+
if (d && i.current < w) {
|
|
343
|
+
const C = i.current++, V = Math.min(
|
|
344
|
+
ke * Math.pow(2, C) + Math.random() * 500,
|
|
345
|
+
xe
|
|
327
346
|
);
|
|
328
|
-
|
|
347
|
+
a.current = setTimeout(l, V);
|
|
329
348
|
}
|
|
330
|
-
},
|
|
349
|
+
}, I.onerror = () => {
|
|
331
350
|
};
|
|
332
351
|
} catch {
|
|
333
352
|
o("disconnected");
|
|
334
353
|
}
|
|
335
|
-
}, []),
|
|
336
|
-
|
|
337
|
-
}, []),
|
|
338
|
-
|
|
339
|
-
}, [
|
|
340
|
-
const
|
|
341
|
-
|
|
342
|
-
}, []),
|
|
343
|
-
c.current.delete(
|
|
354
|
+
}, []), h = O(() => {
|
|
355
|
+
a.current && (clearTimeout(a.current), a.current = null), i.current = 1 / 0, t.current?.close(), t.current = null, o("disconnected");
|
|
356
|
+
}, []), m = O(() => {
|
|
357
|
+
i.current = 0, t.current?.close(), t.current = null, l();
|
|
358
|
+
}, [l]), v = O((E) => {
|
|
359
|
+
const R = t.current;
|
|
360
|
+
R && R.readyState === 1 && R.send(JSON.stringify(E));
|
|
361
|
+
}, []), T = O((E) => (c.current.add(E), () => {
|
|
362
|
+
c.current.delete(E);
|
|
344
363
|
}), []);
|
|
345
|
-
M(() => (
|
|
346
|
-
|
|
347
|
-
}), [
|
|
348
|
-
const
|
|
349
|
-
status:
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
364
|
+
M(() => (l(), () => {
|
|
365
|
+
a.current && clearTimeout(a.current), i.current = 1 / 0, t.current?.close();
|
|
366
|
+
}), [l]);
|
|
367
|
+
const N = {
|
|
368
|
+
status: r,
|
|
369
|
+
extensionId: u.current,
|
|
370
|
+
send: v,
|
|
371
|
+
subscribe: T,
|
|
372
|
+
disconnect: h,
|
|
373
|
+
reconnect: m
|
|
354
374
|
};
|
|
355
|
-
return /* @__PURE__ */
|
|
375
|
+
return /* @__PURE__ */ Ie.jsx(de.Provider, { value: N, children: s });
|
|
356
376
|
}
|
|
357
377
|
function j() {
|
|
358
378
|
return be(de);
|
|
359
379
|
}
|
|
360
|
-
function
|
|
361
|
-
const { send: s } = j();
|
|
362
|
-
return { emit:
|
|
363
|
-
(
|
|
380
|
+
function Ue(e) {
|
|
381
|
+
const { send: s, extensionId: r } = j();
|
|
382
|
+
return { emit: O(
|
|
383
|
+
(t, c, i) => {
|
|
364
384
|
e && s({
|
|
365
385
|
type: "EMIT_TO_STORE",
|
|
366
386
|
storeId: e,
|
|
367
|
-
event: { channel:
|
|
387
|
+
event: { channel: t, type: c, payload: i },
|
|
368
388
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
369
|
-
sourceId:
|
|
370
|
-
sourceRole:
|
|
389
|
+
sourceId: r,
|
|
390
|
+
sourceRole: b.EXTENSION
|
|
371
391
|
});
|
|
372
392
|
},
|
|
373
|
-
[e, s]
|
|
393
|
+
[e, s, r]
|
|
374
394
|
) };
|
|
375
395
|
}
|
|
376
|
-
const
|
|
377
|
-
function
|
|
378
|
-
const { subscribe:
|
|
396
|
+
const we = 2e3;
|
|
397
|
+
function Fe(e, s) {
|
|
398
|
+
const { subscribe: r } = j(), o = s?.maxEntries ?? we, t = A(/* @__PURE__ */ new Map()), c = A(o);
|
|
379
399
|
c.current = o;
|
|
380
|
-
const [,
|
|
381
|
-
M(() =>
|
|
382
|
-
if (
|
|
383
|
-
const
|
|
384
|
-
event:
|
|
385
|
-
storeId:
|
|
386
|
-
patches:
|
|
387
|
-
snapshotVersion:
|
|
388
|
-
committed:
|
|
389
|
-
timestamp:
|
|
390
|
-
},
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
),
|
|
395
|
-
}), [
|
|
396
|
-
const
|
|
397
|
-
e && (
|
|
400
|
+
const [, i] = k(0);
|
|
401
|
+
M(() => r((l) => {
|
|
402
|
+
if (l.type !== "STORE_EVENT") return;
|
|
403
|
+
const h = l.storeId, m = {
|
|
404
|
+
event: l.event,
|
|
405
|
+
storeId: h,
|
|
406
|
+
patches: l.patches,
|
|
407
|
+
snapshotVersion: l.snapshotVersion,
|
|
408
|
+
committed: l.committed,
|
|
409
|
+
timestamp: l.timestamp
|
|
410
|
+
}, T = [...t.current.get(h) ?? [], m];
|
|
411
|
+
t.current.set(
|
|
412
|
+
h,
|
|
413
|
+
T.length > c.current ? T.slice(T.length - c.current) : T
|
|
414
|
+
), i((N) => N + 1);
|
|
415
|
+
}), [r]);
|
|
416
|
+
const a = O(() => {
|
|
417
|
+
e && (t.current.delete(e), i((S) => S + 1));
|
|
398
418
|
}, [e]);
|
|
399
|
-
return { entries: e ?
|
|
419
|
+
return { entries: e ? t.current.get(e) ?? [] : [], clear: a };
|
|
400
420
|
}
|
|
401
|
-
function
|
|
402
|
-
const { send: s } = j();
|
|
403
|
-
return { replay:
|
|
404
|
-
(
|
|
421
|
+
function He(e) {
|
|
422
|
+
const { send: s, extensionId: r } = j();
|
|
423
|
+
return { replay: O(
|
|
424
|
+
(t, c) => {
|
|
405
425
|
e && s({
|
|
406
426
|
type: "EVENT_REPLAY",
|
|
407
427
|
storeId: e,
|
|
408
|
-
snapshot:
|
|
409
|
-
events:
|
|
410
|
-
id:
|
|
411
|
-
channel:
|
|
412
|
-
type:
|
|
413
|
-
payload:
|
|
428
|
+
snapshot: t,
|
|
429
|
+
events: c.map((i) => ({
|
|
430
|
+
id: i.event.id,
|
|
431
|
+
channel: i.event.channel,
|
|
432
|
+
type: i.event.type,
|
|
433
|
+
payload: i.event.payload
|
|
414
434
|
})),
|
|
415
435
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
416
|
-
sourceId:
|
|
417
|
-
sourceRole:
|
|
436
|
+
sourceId: r,
|
|
437
|
+
sourceRole: b.EXTENSION
|
|
418
438
|
});
|
|
419
439
|
},
|
|
420
|
-
[e, s]
|
|
440
|
+
[e, s, r]
|
|
421
441
|
) };
|
|
422
442
|
}
|
|
423
|
-
function
|
|
424
|
-
const { send:
|
|
425
|
-
e && (
|
|
443
|
+
function Xe(e, s) {
|
|
444
|
+
const { send: r, subscribe: o, extensionId: t } = j(), [c, i] = k(null), [a, u] = k(!1), S = s?.refreshIntervalMs ?? 2e3, l = A(null), h = O(() => {
|
|
445
|
+
e && (u(!0), r({
|
|
426
446
|
type: "REQUEST_METRICS",
|
|
427
447
|
storeId: e,
|
|
428
448
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
429
|
-
sourceId:
|
|
430
|
-
sourceRole:
|
|
449
|
+
sourceId: t,
|
|
450
|
+
sourceRole: b.EXTENSION
|
|
431
451
|
}));
|
|
432
|
-
}, [e,
|
|
452
|
+
}, [e, r, t]);
|
|
433
453
|
return M(() => {
|
|
434
454
|
if (!e) {
|
|
435
|
-
|
|
455
|
+
i(null);
|
|
436
456
|
return;
|
|
437
457
|
}
|
|
438
|
-
|
|
439
|
-
const m = o((
|
|
440
|
-
|
|
458
|
+
h();
|
|
459
|
+
const m = o((v) => {
|
|
460
|
+
v.type === "STORE_METRICS" && v.storeId === e && (i(v.metrics), u(!1));
|
|
441
461
|
});
|
|
442
|
-
return
|
|
462
|
+
return S > 0 && (l.current = setInterval(h, S)), () => {
|
|
443
463
|
m(), l.current && (clearInterval(l.current), l.current = null);
|
|
444
464
|
};
|
|
445
|
-
}, [e, o,
|
|
465
|
+
}, [e, o, h, S]), { metrics: c, loading: a, refresh: h };
|
|
446
466
|
}
|
|
447
|
-
function
|
|
448
|
-
const { subscribe: e } = j(), [s,
|
|
449
|
-
return M(() => e((
|
|
450
|
-
switch (
|
|
467
|
+
function $e() {
|
|
468
|
+
const { subscribe: e } = j(), [s, r] = k([]);
|
|
469
|
+
return M(() => e((t) => {
|
|
470
|
+
switch (t.type) {
|
|
451
471
|
case "STORE_REGISTRY":
|
|
452
|
-
|
|
472
|
+
r(t.stores);
|
|
453
473
|
break;
|
|
454
474
|
case "STORE_CONNECTED":
|
|
455
|
-
|
|
456
|
-
(
|
|
475
|
+
r((c) => c.some((a) => a.id === t.store.id) ? c.map(
|
|
476
|
+
(a) => a.id === t.store.id ? { ...a, status: "connected" } : a
|
|
457
477
|
) : [
|
|
458
478
|
...c,
|
|
459
479
|
{
|
|
460
|
-
id:
|
|
461
|
-
name:
|
|
480
|
+
id: t.store.id,
|
|
481
|
+
name: t.store.name,
|
|
462
482
|
status: "connected",
|
|
463
|
-
capabilities:
|
|
464
|
-
connectedAt:
|
|
483
|
+
capabilities: t.store.capabilities,
|
|
484
|
+
connectedAt: t.timestamp
|
|
465
485
|
}
|
|
466
486
|
]);
|
|
467
487
|
break;
|
|
468
488
|
case "STORE_DISCONNECTED":
|
|
469
|
-
|
|
489
|
+
r(
|
|
470
490
|
(c) => c.map(
|
|
471
|
-
(
|
|
491
|
+
(i) => i.id === t.storeId ? { ...i, status: "disconnected" } : i
|
|
472
492
|
)
|
|
473
493
|
);
|
|
474
494
|
break;
|
|
@@ -476,52 +496,52 @@ function Xe() {
|
|
|
476
496
|
}), [e]), s;
|
|
477
497
|
}
|
|
478
498
|
function Z(e, s) {
|
|
479
|
-
let
|
|
499
|
+
let r = e;
|
|
480
500
|
for (const o of s) {
|
|
481
|
-
const
|
|
501
|
+
const t = Ce(o.path);
|
|
482
502
|
switch (o.op) {
|
|
483
503
|
case "add":
|
|
484
|
-
|
|
504
|
+
r = ee(r, t, o.value, !0);
|
|
485
505
|
break;
|
|
486
506
|
case "replace":
|
|
487
|
-
|
|
507
|
+
r = ee(r, t, o.value, !1);
|
|
488
508
|
break;
|
|
489
509
|
case "remove":
|
|
490
|
-
|
|
510
|
+
r = pe(r, t);
|
|
491
511
|
break;
|
|
492
512
|
}
|
|
493
513
|
}
|
|
494
|
-
return
|
|
514
|
+
return r;
|
|
495
515
|
}
|
|
496
516
|
function Ce(e) {
|
|
497
517
|
return e === "" || e === "/" ? [] : e.slice(1).split("/").map((s) => s.replace(/~1/g, "/").replace(/~0/g, "~"));
|
|
498
518
|
}
|
|
499
519
|
const Ee = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
500
|
-
function ee(e, s,
|
|
501
|
-
if (s.length === 0) return
|
|
502
|
-
const
|
|
503
|
-
if (Ee.has(c)) return
|
|
504
|
-
if (
|
|
505
|
-
if (o && Array.isArray(
|
|
506
|
-
const
|
|
507
|
-
Number.isInteger(
|
|
520
|
+
function ee(e, s, r, o) {
|
|
521
|
+
if (s.length === 0) return r;
|
|
522
|
+
const t = Array.isArray(e) ? [...e] : { ...e }, [c, ...i] = s;
|
|
523
|
+
if (Ee.has(c)) return t;
|
|
524
|
+
if (i.length === 0)
|
|
525
|
+
if (o && Array.isArray(t)) {
|
|
526
|
+
const a = c === "-" ? t.length : Number(c);
|
|
527
|
+
Number.isInteger(a) && a >= 0 && a <= t.length ? t.splice(a, 0, r) : t[c] = r;
|
|
508
528
|
} else
|
|
509
|
-
|
|
529
|
+
t[c] = r;
|
|
510
530
|
else
|
|
511
|
-
|
|
512
|
-
return
|
|
531
|
+
t[c] = ee(t[c] ?? {}, i, r, o);
|
|
532
|
+
return t;
|
|
513
533
|
}
|
|
514
534
|
function pe(e, s) {
|
|
515
535
|
if (s.length === 0) return;
|
|
516
|
-
const
|
|
517
|
-
return Ee.has(o) || (
|
|
536
|
+
const r = Array.isArray(e) ? [...e] : { ...e }, [o, ...t] = s;
|
|
537
|
+
return Ee.has(o) || (t.length === 0 ? Array.isArray(r) ? r.splice(Number(o), 1) : delete r[o] : r[o] = pe(r[o], t)), r;
|
|
518
538
|
}
|
|
519
539
|
function ge(e) {
|
|
520
540
|
const s = e.scheduler ?? {
|
|
521
|
-
setInterval: (
|
|
522
|
-
clearInterval: (
|
|
541
|
+
setInterval: (t, c) => setInterval(t, c),
|
|
542
|
+
clearInterval: (t) => clearInterval(t)
|
|
523
543
|
};
|
|
524
|
-
let
|
|
544
|
+
let r = s.setInterval(() => {
|
|
525
545
|
if (e.isSettled()) {
|
|
526
546
|
o();
|
|
527
547
|
return;
|
|
@@ -529,84 +549,84 @@ function ge(e) {
|
|
|
529
549
|
e.request();
|
|
530
550
|
}, e.intervalMs);
|
|
531
551
|
function o() {
|
|
532
|
-
|
|
552
|
+
r !== null && (s.clearInterval(r), r = null);
|
|
533
553
|
}
|
|
534
554
|
return o;
|
|
535
555
|
}
|
|
536
556
|
const Pe = 1500;
|
|
537
|
-
function
|
|
538
|
-
const { send: s, subscribe:
|
|
557
|
+
function Je(e) {
|
|
558
|
+
const { send: s, subscribe: r, extensionId: o } = j(), [t, c] = k(null), [i, a] = k(0), [u, S] = k(!1), l = A(0), h = A([]), m = A(null), v = O(() => {
|
|
539
559
|
m.current?.(), m.current = null;
|
|
540
|
-
}, []),
|
|
541
|
-
e && (
|
|
560
|
+
}, []), T = O(() => {
|
|
561
|
+
e && (S(!0), s({
|
|
542
562
|
type: "REQUEST_STATE",
|
|
543
563
|
storeId: e,
|
|
544
564
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
545
|
-
sourceId:
|
|
546
|
-
sourceRole:
|
|
565
|
+
sourceId: o,
|
|
566
|
+
sourceRole: b.EXTENSION
|
|
547
567
|
}));
|
|
548
|
-
}, [e, s]);
|
|
568
|
+
}, [e, s, o]);
|
|
549
569
|
return M(() => {
|
|
550
570
|
if (!e) {
|
|
551
|
-
|
|
571
|
+
c(null), a(0), l.current = 0;
|
|
552
572
|
return;
|
|
553
573
|
}
|
|
554
|
-
|
|
555
|
-
request:
|
|
574
|
+
T(), m.current = ge({
|
|
575
|
+
request: T,
|
|
556
576
|
isSettled: () => l.current !== 0,
|
|
557
577
|
intervalMs: Pe
|
|
558
578
|
});
|
|
559
|
-
const
|
|
560
|
-
if (
|
|
561
|
-
|
|
562
|
-
const
|
|
563
|
-
if (
|
|
564
|
-
|
|
565
|
-
let
|
|
566
|
-
for (const
|
|
567
|
-
|
|
568
|
-
return
|
|
579
|
+
const N = r((E) => {
|
|
580
|
+
if (E.type === "STATE_SNAPSHOT" && E.storeId === e) {
|
|
581
|
+
v(), c(E.state), a(E.version), l.current = E.version, S(!1);
|
|
582
|
+
const R = h.current.filter((x) => x.version > E.version).sort((x, g) => x.version - g.version);
|
|
583
|
+
if (h.current = [], R.length > 0) {
|
|
584
|
+
c((g) => {
|
|
585
|
+
let I = g;
|
|
586
|
+
for (const d of R)
|
|
587
|
+
I = Z(I, d.patches);
|
|
588
|
+
return I;
|
|
569
589
|
});
|
|
570
|
-
const
|
|
571
|
-
a(
|
|
590
|
+
const x = R[R.length - 1].version;
|
|
591
|
+
a(x), l.current = x;
|
|
572
592
|
}
|
|
573
593
|
return;
|
|
574
594
|
}
|
|
575
|
-
if (
|
|
595
|
+
if (E.type === "STORE_EVENT" && E.storeId === e && E.committed) {
|
|
576
596
|
if (l.current === 0) {
|
|
577
|
-
|
|
578
|
-
patches:
|
|
579
|
-
version:
|
|
597
|
+
h.current.push({
|
|
598
|
+
patches: E.patches,
|
|
599
|
+
version: E.snapshotVersion
|
|
580
600
|
});
|
|
581
601
|
return;
|
|
582
602
|
}
|
|
583
|
-
if (
|
|
603
|
+
if (E.snapshotVersion <= l.current)
|
|
584
604
|
return;
|
|
585
|
-
|
|
605
|
+
c((R) => Z(R, E.patches)), a(E.snapshotVersion), l.current = E.snapshotVersion;
|
|
586
606
|
}
|
|
587
607
|
});
|
|
588
608
|
return () => {
|
|
589
|
-
|
|
609
|
+
N(), v(), h.current = [];
|
|
590
610
|
};
|
|
591
|
-
}, [e,
|
|
611
|
+
}, [e, r, T, v]), { state: t, version: i, loading: u, refresh: T };
|
|
592
612
|
}
|
|
593
|
-
function
|
|
594
|
-
const { send: s, subscribe:
|
|
613
|
+
function qe(e) {
|
|
614
|
+
const { send: s, subscribe: r, extensionId: o } = j(), [t, c] = k(null), [i, a] = k(!1), u = O(() => {
|
|
595
615
|
e && (a(!0), s({
|
|
596
616
|
type: "REQUEST_SUBSCRIPTIONS",
|
|
597
617
|
storeId: e,
|
|
598
618
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
599
|
-
sourceId:
|
|
600
|
-
sourceRole:
|
|
619
|
+
sourceId: o,
|
|
620
|
+
sourceRole: b.EXTENSION
|
|
601
621
|
}));
|
|
602
|
-
}, [e, s]);
|
|
622
|
+
}, [e, s, o]);
|
|
603
623
|
return M(() => {
|
|
604
624
|
if (!e) {
|
|
605
|
-
|
|
625
|
+
c(null);
|
|
606
626
|
return;
|
|
607
627
|
}
|
|
608
|
-
return
|
|
609
|
-
l.type === "STORE_SUBSCRIPTIONS" && l.storeId === e && (
|
|
628
|
+
return u(), r((l) => {
|
|
629
|
+
l.type === "STORE_SUBSCRIPTIONS" && l.storeId === e && (c({
|
|
610
630
|
atomic: l.atomic,
|
|
611
631
|
event: l.event,
|
|
612
632
|
coarse: l.coarse,
|
|
@@ -615,132 +635,146 @@ function Je(e) {
|
|
|
615
635
|
reducers: l.reducers
|
|
616
636
|
}), a(!1));
|
|
617
637
|
});
|
|
618
|
-
}, [e,
|
|
638
|
+
}, [e, r, u]), { data: t, loading: i, refresh: u };
|
|
619
639
|
}
|
|
620
640
|
function le(e, s) {
|
|
621
|
-
const { isTimeTraveling:
|
|
641
|
+
const { isTimeTraveling: r, currentIndex: o, entryCount: t } = s, c = t - 1;
|
|
622
642
|
if (e === "back") {
|
|
623
|
-
const
|
|
624
|
-
return
|
|
643
|
+
const u = (r ? o : c) - 1;
|
|
644
|
+
return u >= 0 ? { kind: "jump", index: u } : { kind: "none" };
|
|
645
|
+
}
|
|
646
|
+
if (!r) return { kind: "none" };
|
|
647
|
+
const i = o + 1;
|
|
648
|
+
return i > c ? { kind: "resume" } : { kind: "jump", index: i };
|
|
649
|
+
}
|
|
650
|
+
function De(e) {
|
|
651
|
+
const { baseline: s, entries: r, index: o, cache: t } = e;
|
|
652
|
+
if (s === null) return { state: null, cache: null };
|
|
653
|
+
let c = 0, i = s.state;
|
|
654
|
+
t !== null && t.index <= o && r[t.index] === t.marker && (c = t.index + 1, i = t.state);
|
|
655
|
+
for (let u = c; u <= o; u++) {
|
|
656
|
+
const S = r[u];
|
|
657
|
+
if (S === void 0) break;
|
|
658
|
+
S.snapshotVersion <= s.version || (i = Z(i, S.patches));
|
|
625
659
|
}
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
660
|
+
const a = r[o];
|
|
661
|
+
return {
|
|
662
|
+
state: i,
|
|
663
|
+
cache: o >= 0 && a !== void 0 ? { index: o, state: i, marker: a } : null
|
|
664
|
+
};
|
|
629
665
|
}
|
|
630
|
-
function
|
|
631
|
-
const { send: o, subscribe:
|
|
666
|
+
function We(e, s, r = !0) {
|
|
667
|
+
const { send: o, subscribe: t, extensionId: c } = j(), [i, a] = k(-1), [u, S] = k(!1), [l, h] = k(null), m = A(null), v = A(null);
|
|
632
668
|
M(() => {
|
|
633
|
-
if (m.current = null,
|
|
634
|
-
return
|
|
669
|
+
if (m.current = null, v.current = null, h(null), !!e)
|
|
670
|
+
return t((d) => {
|
|
635
671
|
d.type === "STATE_SNAPSHOT" && d.storeId === e && m.current === null && (m.current = { state: d.state, version: d.version });
|
|
636
672
|
});
|
|
637
|
-
}, [e,
|
|
638
|
-
const
|
|
673
|
+
}, [e, t]);
|
|
674
|
+
const T = O(
|
|
639
675
|
(d) => {
|
|
640
|
-
const
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
}
|
|
648
|
-
return A;
|
|
676
|
+
const { state: w, cache: C } = De({
|
|
677
|
+
baseline: m.current,
|
|
678
|
+
entries: s,
|
|
679
|
+
index: d,
|
|
680
|
+
cache: v.current
|
|
681
|
+
});
|
|
682
|
+
return v.current = C, w;
|
|
649
683
|
},
|
|
650
684
|
[s]
|
|
651
|
-
),
|
|
685
|
+
), N = O(
|
|
652
686
|
(d) => {
|
|
653
|
-
if (!e || !
|
|
654
|
-
|
|
655
|
-
const
|
|
687
|
+
if (!e || !r || d < 0 || d >= s.length) return;
|
|
688
|
+
h((C) => C ?? s.length), a(d), S(!0);
|
|
689
|
+
const w = s[d];
|
|
656
690
|
o({
|
|
657
691
|
type: "TIME_TRAVEL",
|
|
658
692
|
storeId: e,
|
|
659
|
-
state:
|
|
660
|
-
snapshotVersion:
|
|
693
|
+
state: T(d),
|
|
694
|
+
snapshotVersion: w.snapshotVersion,
|
|
661
695
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
662
|
-
sourceId:
|
|
663
|
-
sourceRole:
|
|
696
|
+
sourceId: c,
|
|
697
|
+
sourceRole: b.EXTENSION
|
|
664
698
|
});
|
|
665
699
|
},
|
|
666
|
-
[e, s, o,
|
|
667
|
-
),
|
|
668
|
-
if (
|
|
669
|
-
const d = s.length - 1,
|
|
700
|
+
[e, s, o, T, r, c]
|
|
701
|
+
), E = O(() => {
|
|
702
|
+
if (S(!1), a(-1), h(null), r && e && s.length > 0) {
|
|
703
|
+
const d = s.length - 1, w = s[d];
|
|
670
704
|
o({
|
|
671
705
|
type: "TIME_TRAVEL",
|
|
672
706
|
storeId: e,
|
|
673
|
-
state:
|
|
674
|
-
snapshotVersion:
|
|
707
|
+
state: T(d),
|
|
708
|
+
snapshotVersion: w.snapshotVersion,
|
|
675
709
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
676
|
-
sourceId:
|
|
677
|
-
sourceRole:
|
|
710
|
+
sourceId: c,
|
|
711
|
+
sourceRole: b.EXTENSION
|
|
678
712
|
});
|
|
679
713
|
}
|
|
680
|
-
}, [e, s, o,
|
|
714
|
+
}, [e, s, o, T, r, c]), R = l ?? s.length, x = O(() => {
|
|
681
715
|
const d = le("back", {
|
|
682
|
-
isTimeTraveling:
|
|
683
|
-
currentIndex:
|
|
684
|
-
entryCount:
|
|
716
|
+
isTimeTraveling: u,
|
|
717
|
+
currentIndex: i,
|
|
718
|
+
entryCount: R
|
|
685
719
|
});
|
|
686
|
-
d.kind === "jump" &&
|
|
687
|
-
}, [
|
|
720
|
+
d.kind === "jump" && N(d.index);
|
|
721
|
+
}, [u, i, R, N]), g = O(() => {
|
|
688
722
|
const d = le("forward", {
|
|
689
|
-
isTimeTraveling:
|
|
690
|
-
currentIndex:
|
|
691
|
-
entryCount:
|
|
723
|
+
isTimeTraveling: u,
|
|
724
|
+
currentIndex: i,
|
|
725
|
+
entryCount: R
|
|
692
726
|
});
|
|
693
|
-
d.kind === "jump" ?
|
|
694
|
-
}, [
|
|
695
|
-
() =>
|
|
696
|
-
[
|
|
727
|
+
d.kind === "jump" ? N(d.index) : d.kind === "resume" && E();
|
|
728
|
+
}, [u, i, R, N, E]), I = Oe(
|
|
729
|
+
() => T(u ? i : s.length - 1),
|
|
730
|
+
[T, u, i, s.length]
|
|
697
731
|
);
|
|
698
732
|
return {
|
|
699
|
-
currentIndex:
|
|
700
|
-
isTimeTraveling:
|
|
701
|
-
previewState:
|
|
733
|
+
currentIndex: i,
|
|
734
|
+
isTimeTraveling: u,
|
|
735
|
+
previewState: I,
|
|
702
736
|
frameCount: l,
|
|
703
|
-
jumpTo:
|
|
704
|
-
stepBack:
|
|
705
|
-
stepForward:
|
|
706
|
-
resume:
|
|
737
|
+
jumpTo: N,
|
|
738
|
+
stepBack: x,
|
|
739
|
+
stepForward: g,
|
|
740
|
+
resume: E
|
|
707
741
|
};
|
|
708
742
|
}
|
|
709
|
-
const z = 0, Q = 1,
|
|
743
|
+
const z = 0, Q = 1, je = 2, F = 3;
|
|
710
744
|
function $() {
|
|
711
745
|
return {
|
|
712
746
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
713
747
|
sourceId: "loopback-hub",
|
|
714
|
-
sourceRole:
|
|
748
|
+
sourceRole: b.HUB
|
|
715
749
|
};
|
|
716
750
|
}
|
|
717
751
|
function fe(e) {
|
|
718
752
|
return e.split(".")[0] ?? "0";
|
|
719
753
|
}
|
|
720
|
-
class
|
|
754
|
+
class Me {
|
|
721
755
|
constructor() {
|
|
722
756
|
this.peers = /* @__PURE__ */ new Set();
|
|
723
757
|
}
|
|
724
758
|
add(s) {
|
|
725
|
-
const
|
|
726
|
-
return this.peers.add(
|
|
759
|
+
const r = { role: null, id: null, deliver: s, closed: !1 };
|
|
760
|
+
return this.peers.add(r), r;
|
|
727
761
|
}
|
|
728
762
|
remove(s) {
|
|
729
|
-
if (this.peers.delete(s) && (s.closed = !0, s.role ===
|
|
730
|
-
const
|
|
763
|
+
if (this.peers.delete(s) && (s.closed = !0, s.role === b.STORE && s.id)) {
|
|
764
|
+
const r = JSON.stringify({
|
|
731
765
|
type: "STORE_DISCONNECTED",
|
|
732
766
|
storeId: s.id,
|
|
733
767
|
reason: "disconnected",
|
|
734
768
|
...$()
|
|
735
769
|
});
|
|
736
|
-
this.eachExtension((o) => o.deliver(
|
|
770
|
+
this.eachExtension((o) => o.deliver(r));
|
|
737
771
|
}
|
|
738
772
|
}
|
|
739
|
-
receive(s,
|
|
773
|
+
receive(s, r) {
|
|
740
774
|
if (s.closed) return;
|
|
741
775
|
let o;
|
|
742
776
|
try {
|
|
743
|
-
o = JSON.parse(
|
|
777
|
+
o = JSON.parse(r);
|
|
744
778
|
} catch {
|
|
745
779
|
return;
|
|
746
780
|
}
|
|
@@ -749,69 +783,73 @@ class je {
|
|
|
749
783
|
this.handshake(s, o);
|
|
750
784
|
return;
|
|
751
785
|
}
|
|
752
|
-
if (s.role ===
|
|
753
|
-
this.eachExtension((
|
|
786
|
+
if (s.role === b.STORE)
|
|
787
|
+
this.eachExtension((t) => t.deliver(r));
|
|
754
788
|
else if (typeof o.storeId == "string")
|
|
755
|
-
for (const
|
|
756
|
-
|
|
789
|
+
for (const t of this.peers)
|
|
790
|
+
t.role === b.STORE && t.id === o.storeId && t.deliver(r);
|
|
757
791
|
}
|
|
758
792
|
}
|
|
759
|
-
handshake(s,
|
|
760
|
-
if (
|
|
761
|
-
const o =
|
|
793
|
+
handshake(s, r) {
|
|
794
|
+
if (r.type !== "HANDSHAKE_REQUEST") return;
|
|
795
|
+
const o = r.role, t = o === b.STORE ? r.store?.id : o === b.EXTENSION ? r.extension?.id : void 0, i = fe(String(r.protocolVersion ?? "")) === fe(K) && typeof t == "string";
|
|
762
796
|
if (s.deliver(
|
|
763
797
|
JSON.stringify({
|
|
764
798
|
type: "HANDSHAKE_RESPONSE",
|
|
765
|
-
success:
|
|
766
|
-
|
|
799
|
+
success: i,
|
|
800
|
+
// `negotiatedVersion`, the name the interface and the real hub use. This sent
|
|
801
|
+
// `protocolVersion` instead — harmless only for as long as nothing reads it, and the
|
|
802
|
+
// moment something did, the embedded panel would have failed where the real hub worked,
|
|
803
|
+
// in the one path with no server to inspect.
|
|
804
|
+
negotiatedVersion: K,
|
|
767
805
|
...$(),
|
|
768
|
-
...
|
|
806
|
+
...i ? {} : { error: "Loopback handshake rejected (version or id mismatch)" }
|
|
769
807
|
})
|
|
770
|
-
), !!
|
|
771
|
-
if (s.role = o, s.id =
|
|
772
|
-
s.storeInfo = { name:
|
|
773
|
-
const
|
|
808
|
+
), !!i)
|
|
809
|
+
if (s.role = o, s.id = t, o === b.STORE) {
|
|
810
|
+
s.storeInfo = { name: r.store?.name ?? t, capabilities: r.store?.capabilities };
|
|
811
|
+
const a = JSON.stringify({
|
|
774
812
|
type: "STORE_CONNECTED",
|
|
775
|
-
store: { id:
|
|
813
|
+
store: { id: t, name: s.storeInfo.name, capabilities: s.storeInfo.capabilities },
|
|
776
814
|
...$()
|
|
777
815
|
});
|
|
778
|
-
this.eachExtension((
|
|
816
|
+
this.eachExtension((u) => u.deliver(a));
|
|
779
817
|
} else {
|
|
780
|
-
const
|
|
781
|
-
id:
|
|
782
|
-
name:
|
|
818
|
+
const a = [...this.peers].filter((u) => u.role === b.STORE && u.storeInfo).map((u) => ({
|
|
819
|
+
id: u.id,
|
|
820
|
+
name: u.storeInfo.name,
|
|
783
821
|
status: "connected",
|
|
784
|
-
capabilities:
|
|
822
|
+
capabilities: u.storeInfo.capabilities,
|
|
785
823
|
connectedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
786
824
|
}));
|
|
787
|
-
s.deliver(JSON.stringify({ type: "STORE_REGISTRY", stores:
|
|
825
|
+
s.deliver(JSON.stringify({ type: "STORE_REGISTRY", stores: a, ...$() }));
|
|
788
826
|
}
|
|
789
827
|
}
|
|
790
828
|
eachExtension(s) {
|
|
791
|
-
for (const
|
|
829
|
+
for (const r of this.peers) r.role === b.EXTENSION && s(r);
|
|
792
830
|
}
|
|
793
831
|
}
|
|
794
|
-
function
|
|
795
|
-
const e = new
|
|
796
|
-
let
|
|
797
|
-
const
|
|
832
|
+
function Ge() {
|
|
833
|
+
const e = new Me(), s = (t, c) => {
|
|
834
|
+
let i = z;
|
|
835
|
+
const a = e.add((u) => c.onMessage(u));
|
|
798
836
|
return queueMicrotask(() => {
|
|
799
|
-
|
|
837
|
+
i = Q, c.onOpen();
|
|
800
838
|
}), {
|
|
801
839
|
get readyState() {
|
|
802
|
-
return
|
|
840
|
+
return i;
|
|
803
841
|
},
|
|
804
|
-
send: (
|
|
842
|
+
send: (u) => e.receive(a, u),
|
|
805
843
|
close: () => {
|
|
806
|
-
|
|
844
|
+
i !== F && (i = F, e.remove(a), c.onClose());
|
|
807
845
|
},
|
|
808
846
|
dispose: () => {
|
|
809
|
-
|
|
847
|
+
a.closed = !0;
|
|
810
848
|
}
|
|
811
849
|
};
|
|
812
850
|
}, o = class o {
|
|
813
851
|
constructor(c) {
|
|
814
|
-
this.onopen = null, this.onmessage = null, this.onclose = null, this.onerror = null, this.readyState = z, this.peer = e.add((
|
|
852
|
+
this.onopen = null, this.onmessage = null, this.onclose = null, this.onerror = null, this.readyState = z, this.peer = e.add((i) => this.onmessage?.({ data: i })), queueMicrotask(() => {
|
|
815
853
|
this.readyState = Q, this.onopen?.();
|
|
816
854
|
});
|
|
817
855
|
}
|
|
@@ -822,26 +860,26 @@ function We() {
|
|
|
822
860
|
this.readyState !== F && (this.readyState = F, e.remove(this.peer), this.onclose?.());
|
|
823
861
|
}
|
|
824
862
|
};
|
|
825
|
-
o.CONNECTING = z, o.OPEN = Q, o.CLOSING =
|
|
826
|
-
let
|
|
863
|
+
o.CONNECTING = z, o.OPEN = Q, o.CLOSING = je, o.CLOSED = F;
|
|
864
|
+
let r = o;
|
|
827
865
|
return {
|
|
828
866
|
agentSocketFactory: s,
|
|
829
|
-
WebSocket:
|
|
867
|
+
WebSocket: r
|
|
830
868
|
};
|
|
831
869
|
}
|
|
832
870
|
export {
|
|
833
871
|
de as HubContext,
|
|
834
|
-
|
|
872
|
+
Le as HubProvider,
|
|
835
873
|
Z as applyPatches,
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
874
|
+
Ge as createLoopbackHub,
|
|
875
|
+
Ue as useEventEmitter,
|
|
876
|
+
Fe as useEventLog,
|
|
877
|
+
He as useEventReplay,
|
|
840
878
|
j as useHubConnection,
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
879
|
+
Xe as useStoreMetrics,
|
|
880
|
+
$e as useStoreRegistry,
|
|
881
|
+
Je as useStoreState,
|
|
882
|
+
qe as useStoreSubscriptions,
|
|
883
|
+
We as useTimeTravel
|
|
846
884
|
};
|
|
847
885
|
//# sourceMappingURL=devtools-ui.esm.js.map
|