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